This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug fortran/49213] [OOP] gfortran rejects structure constructor expression
- From: "janus at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Thu, 16 Jun 2011 21:29:27 +0000
- Subject: [Bug fortran/49213] [OOP] gfortran rejects structure constructor expression
- Auto-submitted: auto-generated
- References: <bug-49213-4@http.gcc.gnu.org/bugzilla/>
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49213
--- Comment #5 from janus at gcc dot gnu.org 2011-06-16 21:29:07 UTC ---
(In reply to comment #4)
> An intuitive way of viewing (and maybe even implementing I guess) the process
> triggered by a structure constructor is as a sequence of assignment statements
> for the components of the structure. But that's not how the (2008) standard
> describes what takes place, and so constraints that apply to assignments (like
> assigning to a polymorphic) don't apply in this context.
I think you are wrong here.
F08:7.2.1.3p13:
"An intrinsic assignment where the variable is of derived type is performed as
if each component of the variable were assigned from the corresponding
component of expr using pointer assignment (7.2.2) for each pointer component,
deïned assignment for each nonpointer nonallocatable component of a type that
has a type-bound deïned assignment consistent with the component, intrinsic
assignment for each other nonpointer nonallocatable component, and intrinsic
assignment for each allocated coarray component. For unallocated coarray
components, the corresponding component of the variable shall be unallocated.
For a noncoarray allocatable component the following sequence of operations is
applied."
In essence this means that a derived type assignment *is* viewed as a sequence
of component assignments. Therefore I think that the corresponding restrictions
*do* apply.