(j3.2006) derived types with type parameters are different

Robert Corbett Robert.Corbett
Wed Jul 23 03:38:11 EDT 2008


Consider the modules

       MODULE M1
         TYPE T
           SEQUENCE
           REAL A(4)
         END TYPE
         TYPE(T) :: X
       END

       MODULE M2
         TYPE T
           SEQUENCE
           REAL A(4+0)
         END TYPE
         TYPE(T) :: Y
       END

I think everyone will agree that the variables X and Y have
the same type and that the value of X can be assigned to Y
and vice versa, assuming, of course, that the variable on the
right-hand side of the assignment is defined.

Now consider the modules

       MODULE M1
         TYPE T(N)
           INTEGER(KIND=4), KIND :: N
           SEQUENCE
           REAL A(N)
         END TYPE
         TYPE(T(4)) :: X
       END

       MODULE M2
         TYPE T(N)
           INTEGER(KIND=4), KIND :: N
           SEQUENCE
           REAL A(N+0)
         END TYPE
         TYPE(T(4)) :: Y
       END

In this case, should X and Y be considered to have the same
type?  I think not, but I find no language in the standard
that justifies considering these variables to have different
types but the variables in the previous example to have the
same type.

Bob Corbett



More information about the J3 mailing list