+2007-09-16 Nathan Sidwell <nathan@codesourcery.com>
+
+ cp/
+ PR c++/32756
+ * call.c (maybe_handle_implicit_object): Set this_p, clear
+ rvaluedness_matches_p.
+ (compare_ics): Do not compare rvaluedness matching when one of the
+ operands is an implicit object.
+
+ testsuite/
+ PR c++/32756
+ * g++.dg/overload/operator3.C: New.
+
2007-09-14 Jason Merrill <jason@redhat.com>
PR c++/17743, c++/19163
t = t->u.next;
t = build_identity_conv (TREE_TYPE (t->type), NULL_TREE);
t = direct_reference_binding (reference_type, t);
- t->rvaluedness_matches_p = 1;
+ t->this_p = 1;
+ t->rvaluedness_matches_p = 0;
*ics = t;
}
}
initialized by S2 refers is more cv-qualified than the type to
which the reference initialized by S1 refers */
- if (ref_conv1 && ref_conv2
- && same_type_ignoring_top_level_qualifiers_p (to_type1, to_type2))
+ if (ref_conv1 && ref_conv2)
{
- if (ref_conv1->rvaluedness_matches_p
- && !ref_conv2->rvaluedness_matches_p)
- return 1;
- else if (!ref_conv1->rvaluedness_matches_p
- && ref_conv2->rvaluedness_matches_p)
- return -1;
+ if (!ref_conv1->this_p && !ref_conv2->this_p
+ && (TYPE_REF_IS_RVALUE (ref_conv1->type)
+ != TYPE_REF_IS_RVALUE (ref_conv2->type)))
+ {
+ if (ref_conv1->rvaluedness_matches_p)
+ return 1;
+ if (ref_conv2->rvaluedness_matches_p)
+ return -1;
+ }
- return comp_cv_qualification (TREE_TYPE (ref_conv2->type),
- TREE_TYPE (ref_conv1->type));
+ if (same_type_ignoring_top_level_qualifiers_p (to_type1, to_type2))
+ return comp_cv_qualification (TREE_TYPE (ref_conv2->type),
+ TREE_TYPE (ref_conv1->type));
}
/* Neither conversion sequence is better than the other. */
--- /dev/null
+// PR c++/32756
+// { dg-do compile }
+
+// bogus overload warning
+
+class QString;
+
+struct QByteArray
+{
+ QByteArray ();
+ bool operator!= (const QString & s2) const;
+};
+
+bool operator!= (const QByteArray & a1, const QByteArray & a2);
+
+struct QString
+{
+ QString ();
+ QString (const QByteArray & a);
+};
+
+QByteArray abbreviation ();
+
+void
+fromString ()
+{
+ QByteArray zoneAbbrev;
+ if (abbreviation () != zoneAbbrev)
+ {
+ }
+}