[Bug fortran/47572] New: [OOP] Invalid: Allocatable polymorphic with init expression.
burnus at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Tue Feb 1 14:34:00 GMT 2011
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47572
Summary: [OOP] Invalid: Allocatable polymorphic with init
expression.
Product: gcc
Version: 4.6.0
Status: UNCONFIRMED
Keywords: accepts-invalid
Severity: normal
Priority: P3
Component: fortran
AssignedTo: unassigned@gcc.gnu.org
ReportedBy: burnus@gcc.gnu.org
CC: janus@gcc.gnu.org
Found at
http://groups.google.com/group/comp.lang.fortran/browse_thread/thread/763785b16883ed68
The program looks very odd and surely is wrong; however, gfortran accepts it.
ifort does:
error #6562: A data initialization-expr is not valid for this object. [B]
I assume that one checks against the CLASS container and not against the actual
_data object.
"C506 (R503) An initialization shall not appear if object-name is a dummy
argument, a function result, an object in a named common block unless the type
declaration is in a block data program unit, an object in blank common, an
allocatable variable, or an automatic object." (F2008)
program scalarallocation
type test
real :: a
end type
class (test), allocatable :: b = test(3.4)
print *,'B', allocated(b)
end program
More information about the Gcc-bugs
mailing list