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/48095] [OOP] Invalid assignment to procedure pointer component not rejected


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

--- Comment #8 from janus at gcc dot gnu.org 2011-09-05 13:14:27 UTC ---
(In reply to comment #6)
> That should then also take care of:
> 
>   rect = rectangle (1.0, 2.0, get_my_area)
> 
> which had the same issue, except that it is currently rejected with:
> 
>   Error: Function 'get_my_area' requires an argument list at (1)
> 
> However, if I read the standard correctly (F2008, 4.5.10 Construction of
> derived-type values), it should be valid:

Yes. The false error demanding an argument list is cured by:


Index: gcc/fortran/primary.c
===================================================================
--- gcc/fortran/primary.c    (revision 178527)
+++ gcc/fortran/primary.c    (working copy)
@@ -2418,7 +2418,10 @@ gfc_match_structure_constructor (gfc_symbol *sym,
         }

       /* Match the current initializer expression.  */
+      if (this_comp->attr.proc_pointer)
+        gfc_matching_procptr_assignment = 1;
       m = gfc_match_expr (&comp_tail->val);
+      gfc_matching_procptr_assignment = 0;
       if (m == MATCH_NO)
         goto syntax;
       if (m == MATCH_ERROR)


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