| 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, class U, |
| 20 |
class = decltype( (create<T>().*create<U>())() ) |
| 21 |
> |
| 22 |
auto f(int) -> char(&)[1]; |
| 23 |
|
| 24 |
template<class, class> |
| 25 |
auto f(...) -> char(&)[2]; |
| 26 |
|
| 27 |
static_assert(sizeof(f<void, void>(0)) != 1, ""); |