(j3.2006) Did we intend to prevent this?
Bill Long
longb
Thu Nov 10 08:53:32 EST 2011
On 11/10/11 3:47 AM, Robert Corbett wrote:
> The problem seems worse than Malcolm makes it out to be. Assume a named
> constant has a pointer component that is initialized to be pointer associated
> with a variable. Item (1) of the list given in Clause 7.1.12 (page 151) is
>
> (1) a constant or a subobject of a constant,
>
> As Val noted, a reference to a pointer component of a named constant will get
> the value of the variable that is the target of the pointer component.
I don't think this situation can occur if the original problem is fixed.
Constructors of a type that has component initialization, and in which
the values of components that are default initialized to a non-constant
object are not overridden with actual constants in the constructor
simply should not qualify as constant expressions.
The current wording of 7.1.12 (3)(b) reads
" a pointer component is an initialization target or a reference to
the intrinsic function NULL,"
The problem goes away of this is changed to
"a pointer component is a reference to the intrinsic function NULL,"
It was not clear what "initialization target" meant here anyway. It
would seem that the only thing that could qualify would be a reference
to NULL() or a reference to a function that returned NULL().
Cheers,
Bill
> According to item (1), that reference to a pointer component can be a primary in
> a constant expression. That is not good.
>
> Clause 16.5.2.3 does not cover the case of a target corresponding to an item in
> a structure constructor.
>
> Bob Corbett
> _______________________________________________
> J3 mailing list
> J3 at j3-fortran.org
> http://j3-fortran.org/mailman/listinfo/j3
--
Bill Long longb at cray.com
Fortran Technical Support & voice: 651-605-9024
Bioinformatics Software Development fax: 651-605-9142
Cray Inc./Cray Plaza, Suite 210/380 Jackson St./St. Paul, MN 55101
More information about the J3
mailing list