view gcc/testsuite/g++.dg/cpp1y/var-templ33.C @ 131:84e7813d76e9

gcc-8.2
author mir3636
date Thu, 25 Oct 2018 07:37:49 +0900
parents 04ced10e8804
children
line wrap: on
line source

// Test for variable templates in pack expansion
// { dg-do compile { target c++14 } }

template <int I> const int Val = I;

constexpr int f () { return 0; }
template <class T, class ...Ts>
constexpr int f(T t, Ts... ts)
{
  return t + f(ts...);
}

template <int... Is>
constexpr int g()
{
  return f(Val<Is>...);
}

#define SA(X) static_assert((X),#X)
SA((g<1,2,3,4>() == 1+2+3+4));