Quantcast
Viewing all articles
Browse latest Browse all 1175

c++17 fold expression causes internal error

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?


Viewing all articles
Browse latest Browse all 1175

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>