Merged with mainline at revision 128810.
[official-gcc.git] / gcc / testsuite / g++.dg / cpp0x / decltype6.C
blobc407c182c86ecbbee7254a5aa1e1b1c400facd6e
1 // { dg-do "compile" }
2 // { dg-options "-std=gnu++0x" }
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 template<typename T> const T& foo(); 
19 int i; 
21 template<typename T>
22 struct A 
23
24   double x; 
27 const A<double>* a = new A<double>(); 
29 static_assert(is_same<decltype(foo<int>()), const int&>::value,
30               "type should be const int&");
31 static_assert(is_same<decltype(i), int>::value,
32               "type should be int");
33 static_assert(is_same<decltype(a->x), double>::value,
34               "type should be double");
35 static_assert(is_same<decltype((a->x)), const double&>::value,
36               "type should be const double&");