[J3] surprisingly PURE
Van Snyder
van.snyder at jpl.nasa.gov
Wed Apr 22 17:38:41 EDT 2020
On Wed, 2020-04-22 at 10:09 -0400, Vipul Parekh via J3 wrote:
> C1589a A local variable of a pure subprogram, or of a BLOCK construct
> within a pure subprogram, shall not be of a derived type with a
> pointer component at any level of component selection that is default
> initialized to an initial-data-target.
>
> Such a constraint will disallow, I think, "TYPE(T) Y" declaration in
> Bob's example and "CLASS(T1), allocatable :: Y" in Van's case. Thus
> get the standard to treat it at the very root of the matter as advised
> by Malcolm.
It wouldn't disallow
class(t1), allocatable :: Y
in my example because T1 doesn't have a pointer component. It's T2 that
has the pointer component.
It's probably a bit too strong for PURE because it doesn't allow
references. It's probably useful for PURE and SIMPLE.
Adding prohibition against such a type to the properties for base
objects in C1594 might be useful:
C1594 In a pure subprogram, any designator with a base object that
is ... of a type that is accessed by host or use association that has a
pointer component at any level of component selection that is default
initialized to other than NULL()...
(wordsmithing needs some polish).
Adding MOLD= to C1594(6) would make my example non-conformant.
More information about the J3
mailing list