52 lines
1.5 KiB
Diff
52 lines
1.5 KiB
Diff
2007-12-20 Jason Merrill <jason@redhat.com>
|
|
|
|
PR c++/34111
|
|
* call.c (standard_conversion): Derived-to-base is considered a
|
|
standard conversion.
|
|
|
|
--- gcc/cp/call.c (revision 131106)
|
|
+++ gcc/cp/call.c (revision 131107)
|
|
@@ -861,14 +861,7 @@ standard_conversion (tree to, tree from,
|
|
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)
|
|
--- gcc/testsuite/g++.dg/overload/arg5.C (revision 0)
|
|
+++ gcc/testsuite/g++.dg/overload/arg5.C (revision 131107)
|
|
@@ -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);
|
|
+}
|