(j3.2006) derived types with type parameters are different
Robert Corbett
Robert.Corbett
Thu Jul 24 02:20:35 EDT 2008
Jim Xia wrote:
>
> >
> > 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
>
> Why would you think x and y are of different types? They look to be the
> same type to me.
To expand on the point, consider the modules
MODULE M1
TYPE T(N)
INTEGER(KIND=4), KIND :: N
SEQUENCE
REAL A(N+N)
END TYPE
TYPE(T(2)) :: X1
TYPE(T(3)) :: X2
END
MODULE M2
TYPE T(N)
INTEGER(KIND=4), KIND :: N
SEQUENCE
REAL A(N*N)
END TYPE
TYPE(T(2)) :: Y1
TYPE(T(3)) :: Y2
END
In the case, would X1 and Y1 has the same type? Would X2 and Y2?
Bob Corbett
More information about the J3
mailing list