gcc/testsuite/g++.dg/cpp1y/var-templ81.C
raw| 1 | // Verify we don't ICE on an invalid dereference of a variable |
| 2 | // template-id of reference type. |
| 3 | // { dg-do compile { target c++14 } } |
| 4 | |
| 5 | template<class> |
| 6 | static constexpr const int& var = 0; |
| 7 | |
| 8 | template<class T> |
| 9 | struct B { |
| 10 | static constexpr int x = *var<T>; // { dg-error "argument of unary" } |
| 11 | static constexpr const int& y = *var<T>; // { dg-error "argument of unary" } |
| 12 | }; |
| 13 | |
| 14 | template struct B<int>; |