[Bug fortran/49592] New: [OOP] Non-polymorphic ALLOCATE with polymorphic SOURCE= rejected
burnus at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Thu Jun 30 12:57:00 GMT 2011
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.
More information about the Gcc-bugs
mailing list