1 // { dg-do compile { target c++11 } }
2 // { dg-additional-options "-Wno-return-type" }
4 template<typename T, typename U>
7 static const bool value = false;
13 static const bool value = true;
16 int&& f(const int&) {}
17 int&& (*fp)(const int&) = f;
18 int&& (&fr)(const int&) = f;
20 struct X { int&& f(const int&); };
22 int&& (X::*mfp)(const int&) = &X::f;
27 static_assert(is_same<decltype(f(i)), int&&>::value, "direct call");
28 static_assert(is_same<decltype(fp(i)), int&&>::value, "pointer");
29 static_assert(is_same<decltype((*fp)(i)), int&&>::value,
30 "dereferenced pointer");
31 static_assert(is_same<decltype(fr(i)), int&&>::value,
33 static_assert(is_same<decltype(xr.f(i)), int&&>::value,
34 "member function call");
35 static_assert(is_same<decltype((xr.*mfp)(i)), int&&>::value,
36 "member function pointer with .*");
37 static_assert(is_same<decltype((xp->*mfp)(i)), int&&>::value,
38 "member function pointer with ->*");