http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45516
janus at gcc dot gnu.org changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
Last reconfirmed| |2011.02.03 22:03:06
Ever Confirmed|0 |1
--- Comment #3 from janus at gcc dot gnu.org 2011-02-03 22:03:06 UTC ---
(In reply to comment #2)
> (In reply to comment #1)
> > Here is a patch to accept the type declaration in comment #0:
>
> Well, you at least need to use gfc_notify_std(GFC_STD_F2008, ...
This variant keeps the old error message for -std=f2003:
Index: gcc/fortran/decl.c
===================================================================
--- gcc/fortran/decl.c (revision 169519)
+++ gcc/fortran/decl.c (working copy)
@@ -1515,14 +1515,20 @@ build_struct (const char *name, gfc_charlen *cl, g
gfc_component *c;
gfc_try t = SUCCESS;
- /* F03:C438/C439. If the current symbol is of the same derived type that
we're
- constructing, it must have the pointer attribute. */
+ /* F03:C438/C439, F08:C440. If the current symbol is of the same derived
type
+ that we're constructing, it must be POINTER or ALLOCATABLE. */
if ((current_ts.type == BT_DERIVED || current_ts.type == BT_CLASS)
&& current_ts.u.derived == gfc_current_block ()
&& current_attr.pointer == 0)
{
- gfc_error ("Component at %C must have the POINTER attribute");
- return FAILURE;
+ if (gfc_notify_std (GFC_STD_F2008, "Component at %C must have the "
+ "POINTER attribute") == FAILURE)
+ return FAILURE;
+ else if (current_attr.allocatable == 0)
+ {
+ gfc_error ("Component at %C must be POINTER or ALLOCATABLE");
+ return FAILURE;
+ }
}
if (gfc_current_block ()->attr.pointer && (*as)->rank != 0)