1 // PR c++/56913
2 // { dg-do compile { target c++11 } }
3
4 template<typename T>
5 T &&declval();
6
7 template<typename T, typename U,
8 typename = decltype((declval<T>().*declval<U>())())>
test(int)9 constexpr bool test(int)
10 {
11 return true;
12 }
13
14 template<typename T, typename U>
test(...)15 constexpr bool test(...)
16 {
17 return false;
18 }
19
20 struct S
21 {};
22
23 static_assert(!test<S, void (S::*)() &>(0), "");
24 static_assert(test<S, void (S::*)() &&>(0), "");
25 static_assert(test<S &, void (S::*)() &>(0), "");
26 static_assert(!test<S &, void (S::*)() &&>(0), "");
27