gcc/testsuite/g++.dg/cpp0x/sfinae14.C
raw| 1 | // PR c++/48557 |
| 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, class U, |
| 20 | class = decltype(create<T>() + create<U>()) |
| 21 | > |
| 22 | char f(int); |
| 23 | |
| 24 | template<class, class> |
| 25 | char (&f(...))[2]; |
| 26 | |
| 27 | static_assert(sizeof(f<void, int>(0)) != 1, "Error"); // (a) |