gcc/testsuite/g++.dg/cpp23/auto-fncast6.C
raw| 1 | // PR c++/103049 |
| 2 | // P0849R8 - auto(x) |
| 3 | // { dg-do compile { target c++20 } } |
| 4 | |
| 5 | void f (int); |
| 6 | |
| 7 | void |
| 8 | g () |
| 9 | { |
| 10 | auto a1 = auto(f); // { dg-error "only available with" "" { target c++20_only } } |
| 11 | auto a2 = auto{f}; // { dg-error "only available with" "" { target c++20_only } } |
| 12 | static_assert (__is_same_as (decltype (a1), void(*)(int))); |
| 13 | static_assert (__is_same_as (decltype (a2), void(*)(int))); |
| 14 | } |