aboutsummaryrefslogtreecommitdiff
path: root/gcc/fortran/interface.c
diff options
context:
space:
mode:
authorJanus Weil <janus@gcc.gnu.org>2012-06-27 19:38:00 +0200
committerJanus Weil <janus@gcc.gnu.org>2012-06-27 19:38:00 +0200
commit362aa474604751c48e9ff6c39fcf81ee9adad8d2 (patch)
treee4e01843836bcc2058fb6dd585f2390353bb6a21 /gcc/fortran/interface.c
parentb585a51fb9b8c310ec7877bd7f0a93626b1d822a (diff)
downloadgcc-362aa474604751c48e9ff6c39fcf81ee9adad8d2.zip
gcc-362aa474604751c48e9ff6c39fcf81ee9adad8d2.tar.gz
gcc-362aa474604751c48e9ff6c39fcf81ee9adad8d2.tar.bz2
re PR fortran/41951 ([OOP] Not diagnosing ambiguous operators (TB vs. INTERFACE))
2012-06-27 Janus Weil <janus@gcc.gnu.org> PR fortran/41951 PR fortran/49591 * interface.c (check_new_interface): Rename, add 'loc' argument, make non-static. (gfc_add_interface): Rename 'check_new_interface' * gfortran.h (gfc_check_new_interface): Add prototype. * resolve.c (resolve_typebound_intrinsic_op): Add typebound operator targets to non-typebound operator list. 2012-06-27 Janus Weil <janus@gcc.gnu.org> PR fortran/41951 PR fortran/49591 * gfortran.dg/typebound_operator_16.f03: New. From-SVN: r189022
Diffstat (limited to 'gcc/fortran/interface.c')
-rw-r--r--gcc/fortran/interface.c54
1 files changed, 34 insertions, 20 deletions
diff --git a/gcc/fortran/interface.c b/gcc/fortran/interface.c
index 7a63f69..34e1ad7 100644
--- a/gcc/fortran/interface.c
+++ b/gcc/fortran/interface.c
@@ -3551,8 +3551,8 @@ gfc_extend_assign (gfc_code *c, gfc_namespace *ns)
the given interface list. Ambiguity isn't checked yet since module
procedures can be present without interfaces. */
-static gfc_try
-check_new_interface (gfc_interface *base, gfc_symbol *new_sym)
+gfc_try
+gfc_check_new_interface (gfc_interface *base, gfc_symbol *new_sym, locus loc)
{
gfc_interface *ip;
@@ -3560,8 +3560,8 @@ check_new_interface (gfc_interface *base, gfc_symbol *new_sym)
{
if (ip->sym == new_sym)
{
- gfc_error ("Entity '%s' at %C is already present in the interface",
- new_sym->name);
+ gfc_error ("Entity '%s' at %L is already present in the interface",
+ new_sym->name, &loc);
return FAILURE;
}
}
@@ -3591,48 +3591,61 @@ gfc_add_interface (gfc_symbol *new_sym)
{
case INTRINSIC_EQ:
case INTRINSIC_EQ_OS:
- if (check_new_interface (ns->op[INTRINSIC_EQ], new_sym) == FAILURE ||
- check_new_interface (ns->op[INTRINSIC_EQ_OS], new_sym) == FAILURE)
+ if (gfc_check_new_interface (ns->op[INTRINSIC_EQ], new_sym,
+ gfc_current_locus) == FAILURE
+ || gfc_check_new_interface (ns->op[INTRINSIC_EQ_OS], new_sym,
+ gfc_current_locus) == FAILURE)
return FAILURE;
break;
case INTRINSIC_NE:
case INTRINSIC_NE_OS:
- if (check_new_interface (ns->op[INTRINSIC_NE], new_sym) == FAILURE ||
- check_new_interface (ns->op[INTRINSIC_NE_OS], new_sym) == FAILURE)
+ if (gfc_check_new_interface (ns->op[INTRINSIC_NE], new_sym,
+ gfc_current_locus) == FAILURE
+ || gfc_check_new_interface (ns->op[INTRINSIC_NE_OS], new_sym,
+ gfc_current_locus) == FAILURE)
return FAILURE;
break;
case INTRINSIC_GT:
case INTRINSIC_GT_OS:
- if (check_new_interface (ns->op[INTRINSIC_GT], new_sym) == FAILURE ||
- check_new_interface (ns->op[INTRINSIC_GT_OS], new_sym) == FAILURE)
+ if (gfc_check_new_interface (ns->op[INTRINSIC_GT], new_sym,
+ gfc_current_locus) == FAILURE
+ || gfc_check_new_interface (ns->op[INTRINSIC_GT_OS], new_sym,
+ gfc_current_locus) == FAILURE)
return FAILURE;
break;
case INTRINSIC_GE:
case INTRINSIC_GE_OS:
- if (check_new_interface (ns->op[INTRINSIC_GE], new_sym) == FAILURE ||
- check_new_interface (ns->op[INTRINSIC_GE_OS], new_sym) == FAILURE)
+ if (gfc_check_new_interface (ns->op[INTRINSIC_GE], new_sym,
+ gfc_current_locus) == FAILURE
+ || gfc_check_new_interface (ns->op[INTRINSIC_GE_OS], new_sym,
+ gfc_current_locus) == FAILURE)
return FAILURE;
break;
case INTRINSIC_LT:
case INTRINSIC_LT_OS:
- if (check_new_interface (ns->op[INTRINSIC_LT], new_sym) == FAILURE ||
- check_new_interface (ns->op[INTRINSIC_LT_OS], new_sym) == FAILURE)
+ if (gfc_check_new_interface (ns->op[INTRINSIC_LT], new_sym,
+ gfc_current_locus) == FAILURE
+ || gfc_check_new_interface (ns->op[INTRINSIC_LT_OS], new_sym,
+ gfc_current_locus) == FAILURE)
return FAILURE;
break;
case INTRINSIC_LE:
case INTRINSIC_LE_OS:
- if (check_new_interface (ns->op[INTRINSIC_LE], new_sym) == FAILURE ||
- check_new_interface (ns->op[INTRINSIC_LE_OS], new_sym) == FAILURE)
+ if (gfc_check_new_interface (ns->op[INTRINSIC_LE], new_sym,
+ gfc_current_locus) == FAILURE
+ || gfc_check_new_interface (ns->op[INTRINSIC_LE_OS], new_sym,
+ gfc_current_locus) == FAILURE)
return FAILURE;
break;
default:
- if (check_new_interface (ns->op[current_interface.op], new_sym) == FAILURE)
+ if (gfc_check_new_interface (ns->op[current_interface.op], new_sym,
+ gfc_current_locus) == FAILURE)
return FAILURE;
}
@@ -3646,7 +3659,8 @@ gfc_add_interface (gfc_symbol *new_sym)
if (sym == NULL)
continue;
- if (check_new_interface (sym->generic, new_sym) == FAILURE)
+ if (gfc_check_new_interface (sym->generic, new_sym, gfc_current_locus)
+ == FAILURE)
return FAILURE;
}
@@ -3654,8 +3668,8 @@ gfc_add_interface (gfc_symbol *new_sym)
break;
case INTERFACE_USER_OP:
- if (check_new_interface (current_interface.uop->op, new_sym)
- == FAILURE)
+ if (gfc_check_new_interface (current_interface.uop->op, new_sym,
+ gfc_current_locus) == FAILURE)
return FAILURE;
head = &current_interface.uop->op;