1 // PR c++/6709 (DR 743) 2 // PR c++/42603 (DR 950) 3 // { dg-do compile { target c++11 } } 4 5 template <class T> 6 T make(); 7 8 struct p { typedef int t; }; 9 struct c : decltype(make<p>()) {}; 10 11 decltype(make<p>())::t t; 12 13 // PR c++/49823 14 15 template < typename T > 16 auto f( const T &x ) 17 -> typename decltype( x )::type; // ICE on here 18 19 template < typename T > 20 typename decltype( T{} )::type // ICE on here 21 f( T ); 22 23 template < typename T > f(T x)24void f( T x ) 25 { typename decltype( x )::type t; } // ICE on here 26 27 // Negative tests 28 29 int f(); 30 decltype(f())::t t2; // { dg-error "not a class" } 31 32 struct D: decltype(f()) { }; // { dg-error "not a class" } 33 34 // { dg-prune-output "expected initializer" } 35