This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug fortran/49592] New: [OOP] Non-polymorphic ALLOCATE with polymorphic SOURCE= rejected
- From: "burnus at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Thu, 30 Jun 2011 12:57:13 +0000
- Subject: [Bug fortran/49592] New: [OOP] Non-polymorphic ALLOCATE with polymorphic SOURCE= rejected
- Auto-submitted: auto-generated
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49592
Summary: [OOP] Non-polymorphic ALLOCATE with polymorphic
SOURCE= rejected
Product: gcc
Version: 4.7.0
Status: UNCONFIRMED
Keywords: rejects-valid
Severity: normal
Priority: P3
Component: fortran
AssignedTo: unassigned@gcc.gnu.org
ReportedBy: burnus@gcc.gnu.org
CC: janus@gcc.gnu.org
http://j3-fortran.org/doc/meeting/195/11-194r1.txt
According to the first round of interpretation requests (namely: J3, WG5 will
follow later), the following program is valid. gfortran rejects it with:
Allocate(y,Source=x) ! (*)
1 2
Error: Type of entity at (1) is type incompatible with source-expr at (2)
Program m195_m1
Type t
Real c
End Type
Type,Extends(t) :: t2
Real d
End Type
Class(t),Allocatable :: x
Type(t),Allocatable :: y
Allocate(x,Source=t2(1.5,-1.5))
Allocate(y,Source=x) ! (*)
! ...
End Program
Proposed edits:
[128:24] In 6.7.1.2p7, before "On successful", insert
"If an <allocate-object> is not polymorphic and the <source-expr> is
polymorphic with a dynamic type that differs from its declared
type, the value provided for that <allocate-object> is the ancestor
component of the <source-expr> that has the type of the
<allocate-object>; otherwise, the value provided is the value of
the <source-expr>."
[128:25-26] Replace "that of <source-expr>" with "the value provided",
twice.