(j3.2006) derived types with type parameters are different
Robert Corbett
Robert.Corbett
Wed Jul 23 22:49:56 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.
In this case, it is easy for a human to see that the two
bounds expressions are equivalent. In general, it is very
difficult. Depending on what criteria are used for deciding
two bounds expressions are equivalent, it could be impossible.
The compiler needs to be able to determine whether two derived
types are equivalent in order to correctly resolve generics
and in order to properly report constraint violations.
Bob Corbett
More information about the J3
mailing list