Hi, i ran into a problem with parameterized derived types. If i try to compile the following code with the 15.0.4 Compiler on Windows i get error 6633
"The type of the actual argument differs from the type of the dummy argument. [A]". (in Line 37)
module M_MATRIX use, intrinsic :: iso_fortran_env, only: real64 type, public :: DT_MATRIX(knd, k, n) integer, kind :: knd integer, len :: k integer, len :: n real(kind = knd), dimension(k,n) :: m end type end module M_MATRIX !------------------------------------------------------- module M_EXAMPLE use M_MATRIX ! public ! <- compiles private ! public :: foo ! <- does not compile contains subroutine foo(matrix) type(DT_MATRIX(real64,2,2)) :: matrix matrix%m = 0.0d0 end subroutine end module M_EXAMPLE !------------------------------------------------------- program test use M_EXAMPLE !, only: foo ! <- "only" disables the public-workaround use M_MATRIX Implicit none type(DT_MATRIX(real64,2,2)) :: A call foo(A) end
There seems to be no change in behavior, whether there are kind- or len-parameters in the type definition of DT_MATRIX.
As i searched the forum, i read about some bug-fixes to PTDs in the 16.0 release, so this might be unimportant.
Wolf