[Bug fortran/47572] [OOP] Invalid: Allocatable polymorphic with init expression.
janus at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Tue Feb 1 15:52:00 GMT 2011
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47572
janus at gcc dot gnu.org changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |ASSIGNED
Last reconfirmed| |2011.02.01 15:52:21
AssignedTo|unassigned at gcc dot |janus at gcc dot gnu.org
|gnu.org |
Ever Confirmed|0 |1
--- Comment #1 from janus at gcc dot gnu.org 2011-02-01 15:52:21 UTC ---
The following should be enough to fix it:
Index: gcc/fortran/resolve.c
===================================================================
--- gcc/fortran/resolve.c (revision 169479)
+++ gcc/fortran/resolve.c (working copy)
@@ -10063,7 +10063,8 @@ resolve_fl_variable (gfc_symbol *sym, int mp_flag)
/* Reject illegal initializers. */
if (!sym->mark && sym->value)
{
- if (sym->attr.allocatable)
+ if (sym->attr.allocatable || (sym->ts.type == BT_CLASS
+ && CLASS_DATA (sym)->attr.allocatable))
gfc_error ("Allocatable '%s' at %L cannot have an initializer",
sym->name, &sym->declared_at);
else if (sym->attr.external)
More information about the Gcc-bugs
mailing list