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 const int& foo(); 16 int i; 17 struct A { double x; }; 18 const A* a = new A(); 19 20 static_assert(is_same<decltype(foo()), const int&>::value, 21 "type should be const int&"); 22 static_assert(is_same<decltype(i), int>::value, 23 "type should be int"); 24 static_assert(is_same<decltype(a->x), double>::value, 25 "type should be double"); 26 static_assert(is_same<decltype((a->x)), const double&>::value, 27 "type should be const double&"); 28