1 // Test for variable templates in pack expansion 2 // { dg-do compile { target c++14 } } 3 4 template <int I> const int Val = I; 5 f()6constexpr int f () { return 0; } 7 template <class T, class ...Ts> f(T t,Ts...ts)8constexpr int f(T t, Ts... ts) 9 { 10 return t + f(ts...); 11 } 12 13 template <int... Is> g()14constexpr int g() 15 { 16 return f(Val<Is>...); 17 } 18 19 #define SA(X) static_assert((X),#X) 20 SA((g<1,2,3,4>() == 1+2+3+4)); 21