1 // { dg-do compile { target c++11 } }
2 
3 template<typename T, typename U>
4 struct is_same
5 {
6   static const bool value = false;
7 };
8 
9 template<typename T>
10 struct is_same<T, T>
11 {
12   static const bool value = true;
13 };
14 
15 template<typename T> const T& foo();
16 
17 
18 int i;
19 
20 template<typename T>
21 struct A
22 {
23   double x;
24 };
25 
26 const A<double>* a = new A<double>();
27 
28 static_assert(is_same<decltype(foo<int>()), const int&>::value,
29               "type should be const int&");
30 static_assert(is_same<decltype(i), int>::value,
31               "type should be int");
32 static_assert(is_same<decltype(a->x), double>::value,
33               "type should be double");
34 static_assert(is_same<decltype((a->x)), const double&>::value,
35               "type should be const double&");
36