gcc/testsuite/g++.dg/cpp0x/sfinae33.C
raw| 1 | // PR c++/52422 |
| 2 | // { dg-do compile { target c++11 } } |
| 3 | |
| 4 | template<class T> |
| 5 | struct add_rval_ref |
| 6 | { |
| 7 | typedef T&& type; |
| 8 | }; |
| 9 | |
| 10 | template<> |
| 11 | struct add_rval_ref<void> |
| 12 | { |
| 13 | typedef void type; |
| 14 | }; |
| 15 | |
| 16 | template<class T> |
| 17 | typename add_rval_ref<T>::type create(); |
| 18 | |
| 19 | template<class T, |
| 20 | class = decltype(create<T>()()) |
| 21 | > |
| 22 | auto f(int) -> char(&)[1]; |
| 23 | |
| 24 | template<class> |
| 25 | auto f(...) -> char(&)[2]; |
| 26 | |
| 27 | static_assert(sizeof(f<void>(0)) != 1, ""); |