]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
re PR c++/34111 (new overload resolution error)
authorJason Merrill <jason@redhat.com>
Thu, 20 Dec 2007 22:16:19 +0000 (17:16 -0500)
committerJason Merrill <jason@gcc.gnu.org>
Thu, 20 Dec 2007 22:16:19 +0000 (17:16 -0500)
        PR c++/34111
        * call.c (standard_conversion): Derived-to-base is considered a
        standard conversion.

From-SVN: r131107

gcc/cp/ChangeLog
gcc/cp/call.c
gcc/testsuite/g++.dg/overload/arg5.C [new file with mode: 0644]

index 39eb736c5b37c0cb1540b1c7a89732c620555319..a67b941bb22490252f604e28a6b6feed614cf573 100644 (file)
@@ -1,3 +1,9 @@
+2007-12-20  Jason Merrill  <jason@redhat.com>
+
+       PR c++/34111
+       * call.c (standard_conversion): Derived-to-base is considered a
+       standard conversion.
+
 2007-12-19  Jakub Jelinek  <jakub@redhat.com>
 
        PR c++/34513
index d240b85b03a7c1ca8e8009faae3b508776957194..f15550d7fda0a7f359ee63bf9f3b74410b549545 100644 (file)
@@ -861,14 +861,7 @@ standard_conversion (tree to, tree from, tree expr, bool c_cast_p,
   else if (fcode == VECTOR_TYPE && tcode == VECTOR_TYPE
           && vector_types_convertible_p (from, to, false))
     return build_conv (ck_std, to, conv);
-  /* A derived-to-base conversion sequence is a user-defined conversion
-     because it involves a constructor call, even though it has the rank of
-     a standard conversion, so we don't consider it if we aren't allowing
-     user-defined conversions.  But if we're binding directly to a
-     reference, it's only a pointer conversion.  */
-  else if ((!(flags & LOOKUP_NO_CONVERSION)
-           || (flags & LOOKUP_NO_TEMP_BIND))
-          && IS_AGGR_TYPE (to) && IS_AGGR_TYPE (from)
+  else if (IS_AGGR_TYPE (to) && IS_AGGR_TYPE (from)
           && is_properly_derived_from (from, to))
     {
       if (conv->kind == ck_rvalue)
diff --git a/gcc/testsuite/g++.dg/overload/arg5.C b/gcc/testsuite/g++.dg/overload/arg5.C
new file mode 100644 (file)
index 0000000..63c66d4
--- /dev/null
@@ -0,0 +1,24 @@
+// PR c++/34111
+
+class QChar
+{
+};
+struct QString
+{
+  QString(QChar);
+};
+struct QPainter
+{
+  void drawText (int x, int y, const QString &);
+};
+
+  class KHEChar:public QChar
+  {
+  public:KHEChar (QChar C);
+  };
+
+void
+drawByte (QPainter * P, char, KHEChar B)
+{
+  P->drawText (0, 0, B);
+}