summaryrefslogtreecommitdiffstats
path: root/contrib/gcc/cp/search.c
diff options
context:
space:
mode:
Diffstat (limited to 'contrib/gcc/cp/search.c')
-rw-r--r--contrib/gcc/cp/search.c23
1 files changed, 21 insertions, 2 deletions
diff --git a/contrib/gcc/cp/search.c b/contrib/gcc/cp/search.c
index 4721a58..c43dd21 100644
--- a/contrib/gcc/cp/search.c
+++ b/contrib/gcc/cp/search.c
@@ -2855,8 +2855,27 @@ add_conversions (binfo, data)
/* Make sure we don't already have this conversion. */
if (! IDENTIFIER_MARKED (name))
{
- *conversions = tree_cons (binfo, tmp, *conversions);
- IDENTIFIER_MARKED (name) = 1;
+ tree t;
+
+ /* Make sure that we do not already have a conversion
+ operator for this type. Merely checking the NAME is not
+ enough because two conversion operators to the same type
+ may not have the same NAME. */
+ for (t = *conversions; t; t = TREE_CHAIN (t))
+ {
+ tree fn;
+ for (fn = TREE_VALUE (t); fn; fn = OVL_NEXT (fn))
+ if (same_type_p (TREE_TYPE (name),
+ DECL_CONV_FN_TYPE (OVL_CURRENT (fn))))
+ break;
+ if (fn)
+ break;
+ }
+ if (!t)
+ {
+ *conversions = tree_cons (binfo, tmp, *conversions);
+ IDENTIFIER_MARKED (name) = 1;
+ }
}
}
return NULL_TREE;
OpenPOWER on IntegriCloud