Debian Codegraph @

gcc/testsuite/g++.dg/cpp0x/pr81167.C

raw
1 // PR c++/81167
2 // { dg-do compile { target c++11 } }
3 // { dg-options "-Wconversion" }
4
5 struct bar;
6
7 struct foo
8 {
9 foo () {}
10 foo (const bar &) {}
11 };
12
13 struct bar
14 {
15 operator foo () && { return foo (); }
16 };
17
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 }