gcc/testsuite/g++.dg/cpp0x/sfinae71.C
raw| 1 | // PR c++/113789 |
| 2 | // { dg-do compile { target c++11 } } |
| 3 | // Like sfinae70.C but T&&. |
| 4 | |
| 5 | struct AutoPtr { |
| 6 | AutoPtr() = default; |
| 7 | AutoPtr(AutoPtr&) {} |
| 8 | }; |
| 9 | |
| 10 | template<class T> auto f(T&& p, int) -> decltype(throw p, 1) = delete; |
| 11 | template<class T> void f(T p, long); |
| 12 | |
| 13 | void |
| 14 | g () |
| 15 | { |
| 16 | f (AutoPtr (), 42); // { dg-error "use of deleted function" "" { target c++20_down } } |
| 17 | } |