gcc/testsuite/g++.dg/cpp0x/decltype52.C
raw| 1 | // PR c++/56450 |
| 2 | // { dg-do compile { target c++11 } } |
| 3 | |
| 4 | template<typename T> |
| 5 | T&& declval(); |
| 6 | |
| 7 | template<typename, typename> |
| 8 | struct is_same |
| 9 | { static constexpr bool value = false; }; |
| 10 | |
| 11 | template<typename T> |
| 12 | struct is_same<T, T> |
| 13 | { static constexpr bool value = true; }; |
| 14 | |
| 15 | struct A { static const int dummy = 0; }; |
| 16 | |
| 17 | static_assert(is_same<decltype(declval<A>().dummy), const int>::value, ""); |
| 18 | static_assert(!is_same<decltype(declval<A>().dummy), const int&>::value, ""); |