gcc/testsuite/g++.dg/cpp23/auto-fncast1.C
raw| 1 | // PR c++/103049 |
| 2 | // P0849R8 - auto(x) |
| 3 | // { dg-do compile { target c++23 } } |
| 4 | // Testcase from P0849R8. |
| 5 | |
| 6 | struct A {}; |
| 7 | void f(A&) = delete; // #1 |
| 8 | void f(A&&); // #2 |
| 9 | A& g(); |
| 10 | void h() { |
| 11 | // f(g()); // calls #1 |
| 12 | f(A(g())); // calls #2 with a temporary object |
| 13 | f(auto(g())); // calls #2 with a temporary object |
| 14 | } |