This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug fortran/41719] [OOP] invalid: Intrinsic assignment involving polymorphic variables
- From: "burnus at gcc dot gnu dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 16 Oct 2009 20:25:59 -0000
- Subject: [Bug fortran/41719] [OOP] invalid: Intrinsic assignment involving polymorphic variables
- References: <bug-41719-13404@http.gcc.gnu.org/bugzilla/>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Comment #6 from burnus at gcc dot gnu dot org 2009-10-16 20:25 -------
(In reply to comment #5)
> (In reply to comment #4)
> > Note: It seems this will be legal again in F08.
>
> That is: for certain cases (ALLOCATABLE). The example in comment #0 is still
> illegal.
"if the variable is polymorphic it shall be type compatible with expr"
That's obvious. If I have "CLASS(t) :: c", I cannot do an intrinsic assignment
such as "c = .true." - or "c = t2" (assuming that "t2" does not extend "t").
Regarding:
"if the variable is polymorphic it shall be allocatable and not a coarray,"
Allocatables are special as for "A = B", A is (re)allocated on the fly iff A
is unallocated or the shape/length type parameters does not match the RHS. (If
they do match, no reallocation is happening - which matters if "A" has the
TARGET attribute and is associated with a pointer.)
Cf. "7.2.1.3 Interpretation of intrinsic assignments".
I suggest to ignore F2008 and defer it until we have the realloc on assignment
implemented. Cf. PR 35810.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=41719