Summary: | [OOP] Invalid: Passing non-polymorphic to allocatable polymorphic dummy | ||
---|---|---|---|
Product: | gcc | Reporter: | Tobias Burnus <burnus> |
Component: | fortran | Assignee: | janus |
Status: | RESOLVED FIXED | ||
Severity: | normal | CC: | janus |
Priority: | P3 | Keywords: | accepts-invalid |
Version: | 4.6.0 | ||
Target Milestone: | 4.6.0 | ||
Host: | Target: | ||
Build: | Known to work: | ||
Known to fail: | Last reconfirmed: | 2010-10-26 13:04:05 |
Description
Tobias Burnus
2010-10-24 22:28:07 UTC
Preliminary patch: Index: gcc/fortran/interface.c =================================================================== --- gcc/fortran/interface.c (revision 165936) +++ gcc/fortran/interface.c (working copy) @@ -1519,6 +1520,18 @@ compare_parameter (gfc_symbol *formal, gfc_expr *a gfc_typename (&formal->ts)); return 0; } + + /* F2003, 12.5.2.5. */ + if (formal->ts.type == BT_CLASS + && (CLASS_DATA (formal)->attr.pointer + || CLASS_DATA (formal)->attr.allocatable) + && actual->ts.type != BT_CLASS) + { + if (where) + gfc_error ("Actual argument to '%s' at %L must be polymorphic", + formal->name, &actual->where); + return 0; + } if (formal->attr.codimension) { Author: janus Date: Wed Oct 27 21:41:52 2010 New Revision: 166018 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=166018 Log: 2010-10-27 Janus Weil <janus@gcc.gnu.org> PR fortran/46161 * interface.c (compare_allocatable): Handle polymorphic allocatables. (compare_parameter): Add two error messages for polymorphic dummies. 2010-10-27 Janus Weil <janus@gcc.gnu.org> PR fortran/46161 * gfortran.dg/class_dummy_3.f03: New. Added: trunk/gcc/testsuite/gfortran.dg/class_dummy_3.f03 Modified: trunk/gcc/fortran/ChangeLog trunk/gcc/fortran/interface.c trunk/gcc/testsuite/ChangeLog |