]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
re PR c++/31419 (template user defined conversion operator instantiated for conversio...
authorJason Merrill <jason@redhat.com>
Tue, 11 Sep 2007 15:40:51 +0000 (11:40 -0400)
committerJason Merrill <jason@gcc.gnu.org>
Tue, 11 Sep 2007 15:40:51 +0000 (11:40 -0400)
        PR c++/31419
        * call.c (reference_binding): Don't look for user-defined conversions
        to the same type.

From-SVN: r128383

gcc/cp/ChangeLog
gcc/cp/call.c

index 897e9e3e705b1a2bb928671d6519bd8c6aae5d32..e975e4b17927f82290c0b3a69540df4b4c81c947 100644 (file)
@@ -1,5 +1,9 @@
 2007-09-11  Jason Merrill  <jason@redhat.com>
 
+       PR c++/31419
+       * call.c (reference_binding): Don't look for user-defined conversions
+       to the same type.
+
        PR c++/15745
        * except.c (prepare_eh_type): Use type_decays_to.
 
index c67e844d7fedc1e719d6bb1ecbdd6c25255cde49..891ebb96829c4f9a6867ae3520914623523b9a08 100644 (file)
@@ -1153,7 +1153,12 @@ reference_binding (tree rto, tree rfrom, tree expr, bool c_cast_p, int flags)
 
       return conv;
     }
-  else if (CLASS_TYPE_P (from) && !(flags & LOOKUP_NO_CONVERSION))
+  /* [class.conv.fct] A conversion function is never used to convert a
+     (possibly cv-qualified) object to the (possibly cv-qualified) same
+     object type (or a reference to it), to a (possibly cv-qualified) base
+     class of that type (or a reference to it).... */
+  else if (CLASS_TYPE_P (from) && !related_p
+          && !(flags & LOOKUP_NO_CONVERSION))
     {
       /* [dcl.init.ref]