This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug fortran/54756] [OOP] [F08] Should reject CLASS, intent(out) in PURE procedures


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54756

--- Comment #4 from janus at gcc dot gnu.org 2012-11-06 17:58:36 UTC ---
Draft patch:

Index: gcc/fortran/resolve.c
===================================================================
--- gcc/fortran/resolve.c    (revision 193224)
+++ gcc/fortran/resolve.c    (working copy)
@@ -419,6 +419,16 @@ resolve_formal_arglist (gfc_symbol *proc)
                    &sym->declared_at);
         }
         }
+
+      /* F08:C1278a.  */
+      if (sym->ts.type == BT_CLASS && sym->attr.intent == INTENT_OUT
+          && (gfc_option.allow_std & GFC_STD_F2008) != 0)
+        {
+          gfc_error ("INTENT(OUT) argument '%s' of pure procedure '%s' "
+             "at %L may not be polymorphic in Fortran 2008",
+             sym->name, proc->name, &sym->declared_at);
+          continue;
+        }
     }

       if (proc->attr.implicit_pure)


Unfortunately, we cannot use 'gfc_notify_std' here (or we would need to add
something like GFC_STD_F2008_DEL, although this is not officially a 'deleted
feature', I guess).

So, we could just go with the above, or alternatively reject it regardless of
the chosen standard. This 'feature' probably counts as an 'oversight' which was
missed in F03 and added to F08 only in a corrigendum.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]