(j3.2006) Did we intend to prevent this?

Van Snyder Van.Snyder
Wed Nov 9 19:55:34 EST 2011


On Wed, 2011-11-09 at 15:44 -0800, Malcolm Cohen wrote:
> 
> >Since one can have an initial data target in a variable declaration,
> >viz.
> >
> >  character(len=42), target, save :: A
> >  character(len=:), pointer :: B => A
> >
> >and in a type definition
> >
> >  type :: t
> >    character(len=:), pointer :: P => A
> >  end type t
> >
> >it just seemed inconsistent that one cannot appear as part of a
> >structure constructor that is required to be a constant expression,
> viz.
> >
> >  type(t), parameter :: Z = t(a)
> >
> >(or at least two compilers told me this is not allowed).
> 
> That's very sensible of them.

It's because they're mostly-F03 processors that don't yet completely
handle the new initial-data-target of F08.

> >  Except Bob has
> >found that according to 7.1.12p1(3)(b), t(a) is a constant
> expression.
> 
> Yes, so we will need an interp to fix the standard.  This one does not
> look so 
> easy.

This problem doesn't arise in F03.

Why do we need to fix F08?

I don't understand why

  character(len=42), target, save :: A
  type :: t
    character(len=:), pointer :: P => A
  end type t

isn't a problem, and

  type(t) :: Z = t(a)

isn't a problem, and

  type(t), parameter :: Z = t()

isn't a problem, but

  type(t), parameter :: Z = t(a)

is a problem.  In all cases, the P component of Z gets initially
associated with A.





More information about the J3 mailing list