* decl.c (make_typename_type): s/parameters/arguments/.
[official-gcc.git] / gcc / testsuite / g++.dg / cpp0x / decltype12.C
blob58fd415eea5a2fbe5e208d6dcfef59c4abd205a8
1 // { dg-do compile { target c++11 } }
2 // { dg-additional-options "-Wno-return-type" }
4 template<typename T, typename U>
5 struct is_same
7   static const bool value = false;
8 };
10 template<typename T>
11 struct is_same<T, T>
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;
24 void g(X& xr, X* xp)
26   int i;
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, 
32                 "reference");
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 ->*");