I am trying to use parameterized derived types in a routine using an unlimited polymorphic pointer.
Can I use the select type clause for parameterized types?
I tried something in the following lines, but getting a compilation error. (Syntax error in or near TYPE)
module mod_real implicit none type :: type1(k) integer, kind :: k = 4 real(kind=k) :: val end type type1 contains subroutine out(in) class(*) :: in select type(in) type is (type1(4)) print *, 'real(4):', in%val type is (type1(8)) print *, 'real(8):', in%val end select end subroutine out end module mod_real program real_test use mod_real type(type1(4)) :: p type(type1(8)) :: p2 p%val = 3.14 p2%val = 3.1456d0 call out(p) call out(p2) end program real_test
strings with "type is (type1 (4))" and "type is (type1 (8))" are indicated as having the wrong syntax. I am using the Fortran Group Fortran compiler (version 13.5-0).
Alri source share