The fold expression will generate the following error message only when the value is not used:
"internal error: assertion failed: node_has_side_effects: bad node kind ... "
(compiled with icc -std=c++17)
template<int... I> void f1(int* a) { auto x = (a[I] + ...); } template<int... I> void f2(int* a) { (a[I] + ...); } void g() { int a[1]; f1<0>(a); // ok f2<0>(a); // internal error }
Is there any solution to this problem?