gcc/testsuite/g++.dg/cpp1z/nontype6a.C
raw| 1 | // PR c++/101463 |
| 2 | // A version of nontype6.C where v and vt are constexpr. |
| 3 | // { dg-do compile { target c++17 } } |
| 4 | |
| 5 | int a; |
| 6 | |
| 7 | constexpr int& v = a; |
| 8 | |
| 9 | template<const int& = v> |
| 10 | void f(int) { } |
| 11 | |
| 12 | template<class T, const int& = v> |
| 13 | void g(T) { } |
| 14 | |
| 15 | template<class T> |
| 16 | constexpr int& vt = a; |
| 17 | |
| 18 | template<class T, const int& = vt<T>> |
| 19 | void h(T) { } |
| 20 | |
| 21 | int main() { |
| 22 | f(0); |
| 23 | g(0); |
| 24 | h(0); |
| 25 | } |