1 // PR c++/81167
2 // { dg-do compile { target c++11 } }
3 // { dg-options "-Wconversion" }
4 
5 struct bar;
6 
7 struct foo
8 {
foofoo9   foo () {}
foofoo10   foo (const bar &) {}
11 };
12 
13 struct bar
14 {
foobar15   operator foo () && { return foo (); }
16 };
17 
test()18 void test ()
19 {
20   foo f = bar ();
21 // { dg-warning "choosing 'bar::operator foo\\(\\) &&' over 'foo::foo\\(const bar&\\)'" "" { target *-*-* } .-1 }
22 // { dg-warning "for conversion from 'bar' to 'foo'" "" { target *-*-* } .-2 }
23 // { dg-message "because conversion sequence for the argument is better" "" { target *-*-* } .-3 }
24 }
25