* decl.c (make_typename_type): s/parameters/arguments/.
[official-gcc.git] / gcc / testsuite / g++.dg / cpp0x / decltype42.C
blob6c1aa43647817f6a3c019fb2c138af45caad7039
1 // PR c++/50545
2 // { dg-do compile { target c++11 } }
4 template< class T >
5 T&& declval();
7 // #1
8 template< class T >
9 auto f( int )
10   -> decltype( int{ declval<T>() } );
12 // #2
13 template< class >
14 void f( ... );
17 #define STATIC_ASSERT( ... ) static_assert( __VA_ARGS__, #__VA_ARGS__ )
19 template< class T, class U >
20 struct is_same {
21   static constexpr bool value = false;
24 template< class T >
25 struct is_same<T, T> {
26   static constexpr bool value = true;
30 STATIC_ASSERT( is_same< decltype( f<int>(0) ),  int >::value );  // OK; f<int>(0) calls #1.
31 STATIC_ASSERT( is_same< decltype( f<int*>(0) ), void >::value ); // static assertion fails; f<int*>(0) should call #2, because int{ (int*)0 } is ill-formed, but calls #1.