(j3.2006) another example of a forward reference

Van Snyder Van.Snyder
Thu Mar 12 15:57:56 EDT 2015


On Thu, 2015-03-12 at 02:30 -0700, Robert Corbett wrote:
> Ian Harvey posted an article on comp.lang.fortran
> in which he asserts that the Fortran standards
> allow an array constructor to include a <type-spec>
> that is the name of a derived type that is defined
> after the occurrence of the array constructor.  The
> array constructor cannot include any values, because
> the values would require the derived type to be
> defined before the array constructor.

This appears to justify an interp, probably affecting C4105 (C4110 in
15-007 is slightly different, maybe from a corrigendum).  Maybe simply
insert ", that derived type shall have been defined previously in the
scoping unit or be accessible there by use or host association, and"
after the first "derived type".

Or, maybe there isn't a problem, since the type constructor also isn't
constrained to refer to a previously-defined type.  At least, I couldn't
find such a constraint in 4.5.10.  Maybe C489 needs a similar repair,
something like "The <derived-type-spec> shall specify a type that is
defined previously in the scoping unit or be accessible there by use or
host association, and that type shall not be an abstract type (4.5.7)."

Maybe the requirement for backward reference in 4.3.1.2 should be a
constraint on R453, with exceptions for POINTER or ALLOCATABLE
components.  But that would cover CLASS too, which is not presently
restricted to backward references, so (maybe) it would need an exception
too.

> Bob Corbett
> _______________________________________________
> J3 mailing list
> J3 at mailman.j3-fortran.org
> http://mailman.j3-fortran.org/mailman/listinfo/j3





More information about the J3 mailing list