diff options
author | Janus Weil <janus@gcc.gnu.org> | 2009-11-05 16:31:07 +0100 |
---|---|---|
committer | Janus Weil <janus@gcc.gnu.org> | 2009-11-05 16:31:07 +0100 |
commit | 4b7dd692c22b6fcef9d5f4178d0e9668c03e2941 (patch) | |
tree | 02287a8f3acb6b68ce238799e00e9fa3d9058b60 /gcc/fortran | |
parent | 5ddf0258515492f285e8bda0c4bb8c2219979d7a (diff) | |
download | gcc-4b7dd692c22b6fcef9d5f4178d0e9668c03e2941.zip gcc-4b7dd692c22b6fcef9d5f4178d0e9668c03e2941.tar.gz gcc-4b7dd692c22b6fcef9d5f4178d0e9668c03e2941.tar.bz2 |
re PR fortran/41556 ([OOP] Errors in applying operator/assignment to an abstract type)
2009-11-05 Janus Weil <janus@gcc.gnu.org>
PR fortran/41556
* interface.c (matching_typebound_op,gfc_extend_assign): Handle CLASS
variables.
2009-11-05 Janus Weil <janus@gcc.gnu.org>
PR fortran/41556
* gfortran.dg/class_12.f03: New test.
From-SVN: r153946
Diffstat (limited to 'gcc/fortran')
-rw-r--r-- | gcc/fortran/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/fortran/interface.c | 9 |
2 files changed, 12 insertions, 3 deletions
diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog index dca8031..3a1aa63 100644 --- a/gcc/fortran/ChangeLog +++ b/gcc/fortran/ChangeLog @@ -1,6 +1,12 @@ 2009-11-05 Janus Weil <janus@gcc.gnu.org> PR fortran/41556 + * interface.c (matching_typebound_op,gfc_extend_assign): Handle CLASS + variables. + +2009-11-05 Janus Weil <janus@gcc.gnu.org> + + PR fortran/41556 PR fortran/41873 * resolve.c (resolve_function,resolve_call): Prevent abstract interfaces from being called, but allow deferred type-bound procedures with diff --git a/gcc/fortran/interface.c b/gcc/fortran/interface.c index 05e5d2d..866a81c 100644 --- a/gcc/fortran/interface.c +++ b/gcc/fortran/interface.c @@ -2574,13 +2574,16 @@ matching_typebound_op (gfc_expr** tb_base, gfc_actual_arglist* base; for (base = args; base; base = base->next) - if (base->expr->ts.type == BT_DERIVED) + if (base->expr->ts.type == BT_DERIVED || base->expr->ts.type == BT_CLASS) { gfc_typebound_proc* tb; gfc_symbol* derived; gfc_try result; - derived = base->expr->ts.u.derived; + if (base->expr->ts.type == BT_CLASS) + derived = base->expr->ts.u.derived->components->ts.u.derived; + else + derived = base->expr->ts.u.derived; if (op == INTRINSIC_USER) { @@ -2837,7 +2840,7 @@ gfc_extend_assign (gfc_code *c, gfc_namespace *ns) rhs = c->expr2; /* Don't allow an intrinsic assignment to be replaced. */ - if (lhs->ts.type != BT_DERIVED + if (lhs->ts.type != BT_DERIVED && lhs->ts.type != BT_CLASS && (rhs->rank == 0 || rhs->rank == lhs->rank) && (lhs->ts.type == rhs->ts.type || (gfc_numeric_ts (&lhs->ts) && gfc_numeric_ts (&rhs->ts)))) |