gcc/testsuite/g++.dg/cpp0x/overload-conv-1.C
raw| 1 | // { dg-do link { target c++11 } } |
| 2 | |
| 3 | struct S {}; |
| 4 | |
| 5 | struct T |
| 6 | { |
| 7 | operator S() { return S(); } |
| 8 | }; |
| 9 | |
| 10 | struct U |
| 11 | { |
| 12 | operator S&() { return *static_cast<S*>(0); } |
| 13 | }; |
| 14 | |
| 15 | void f(const S&); |
| 16 | void f(S&&) {} |
| 17 | |
| 18 | void g(const S&) {} |
| 19 | void g(S&&); |
| 20 | |
| 21 | int main() |
| 22 | { |
| 23 | T t; |
| 24 | f(t); |
| 25 | |
| 26 | U u; |
| 27 | g(u); |
| 28 | } |