PR c++/81167
* call.c (joust): Use TREE_TYPE (source) if source is
a POINTER_TYPE_P rather than if ! DECL_CONSTRUCTOR_P (w->fn).
* g++.dg/cpp0x/pr81167.C: New test.
From-SVN: r256905
2018-01-19 Jakub Jelinek <jakub@redhat.com>
+ PR c++/81167
+ * call.c (joust): Use TREE_TYPE (source) if source is
+ a POINTER_TYPE_P rather than if ! DECL_CONSTRUCTOR_P (w->fn).
+
PR c++/83919
* typeck.c (convert_for_assignment): Suppress warn_ignored_qualifiers
for direct enum init.
else if (warn)
{
tree source = source_type (w->convs[0]);
- if (! DECL_CONSTRUCTOR_P (w->fn))
+ if (POINTER_TYPE_P (source))
source = TREE_TYPE (source);
if (warning (OPT_Wconversion, "choosing %qD over %qD", w->fn, l->fn)
&& warning (OPT_Wconversion, " for conversion from %qH to %qI",
2018-01-19 Jakub Jelinek <jakub@redhat.com>
+ PR c++/81167
+ * g++.dg/cpp0x/pr81167.C: New test.
+
PR c++/83919
* g++.dg/cpp0x/pr83919.C: New test.
--- /dev/null
+// PR c++/81167
+// { dg-do compile { target c++11 } }
+// { dg-options "-Wconversion" }
+
+struct bar;
+
+struct foo
+{
+ foo () {}
+ foo (const bar &) {}
+};
+
+struct bar
+{
+ operator foo () && { return foo (); }
+};
+
+void test ()
+{
+ foo f = bar ();
+// { dg-warning "choosing 'bar::operator foo\\(\\) &&' over 'foo::foo\\(const bar&\\)'" "" { target *-*-* } .-1 }
+// { dg-warning "for conversion from 'bar' to 'foo'" "" { target *-*-* } .-2 }
+// { dg-message "because conversion sequence for the argument is better" "" { target *-*-* } .-3 }
+}