Parametrized derived types with type-bound procedures

Viewed 65

I manage to compile type-bound procedures of non-parametrized derived types, as well as parametrized types without bound procedures, but not parametrized derived types with bound procedures, using gfortran-9. Am I getting something wrong in the example below?

simple.f90:

module types
    implicit none
    type stype(s)
        integer, LEN :: s = 3
    contains
        procedure :: p=>print
    end type stype
contains
subroutine print(q)
    class(stype(*)), intent(in) :: q
    print*, q%s
end
end module

program p
    use types
    type(stype(5)) :: q
    call q%p
end program 

gfortran-9 simple.f90 gives:

simple.f90:6:17:

    6 |         procedure :: p=>print
      |                 1
Error: Argument ‘q’ of ‘print’ with PASS(q) at (1) must be of the derived-type ‘stype’
0 Answers
Related