aboutsummaryrefslogtreecommitdiff
path: root/gcc/cp/search.c
diff options
context:
space:
mode:
authorMark Mitchell <mmitchel@gcc.gnu.org>2003-08-04 11:30:06 +0000
committerMark Mitchell <mmitchel@gcc.gnu.org>2003-08-04 11:30:06 +0000
commitb9445edd9a0bf06e1a06be55afb3b53f1bdeaa49 (patch)
tree1395990e284717f4831de3f2654ce356905a48f2 /gcc/cp/search.c
parentf9eb610fbeb3e02b9006549a4e39fd7d242abe68 (diff)
downloadgcc-b9445edd9a0bf06e1a06be55afb3b53f1bdeaa49.zip
gcc-b9445edd9a0bf06e1a06be55afb3b53f1bdeaa49.tar.gz
gcc-b9445edd9a0bf06e1a06be55afb3b53f1bdeaa49.tar.bz2
re PR c++/11713 (declaration conflicts)
PR c++/11713 * search.c (setup_class_bindings): Handle conversion operators specially. PR c++/11713 * g++.dg/overload/operator1.C: New test. From-SVN: r70136
Diffstat (limited to 'gcc/cp/search.c')
-rw-r--r--gcc/cp/search.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/gcc/cp/search.c b/gcc/cp/search.c
index 3f8e2da..c646375 100644
--- a/gcc/cp/search.c
+++ b/gcc/cp/search.c
@@ -2123,6 +2123,20 @@ setup_class_bindings (tree name, int type_binding_p)
if (BASELINK_P (value_binding))
/* NAME is some overloaded functions. */
value_binding = BASELINK_FUNCTIONS (value_binding);
+ /* Two conversion operators that convert to the same type
+ may have different names. (See
+ mangle_conv_op_name_for_type.) To avoid recording the
+ same conversion operator declaration more than once we
+ must check to see that the same operator was not already
+ found under another name. */
+ if (IDENTIFIER_TYPENAME_P (name)
+ && is_overloaded_fn (value_binding))
+ {
+ tree fns;
+ for (fns = value_binding; fns; fns = OVL_NEXT (fns))
+ if (IDENTIFIER_CLASS_VALUE (DECL_NAME (OVL_CURRENT (fns))))
+ return;
+ }
pushdecl_class_level (value_binding);
}
}