Debian Codegraph @

gcc/testsuite/g++.dg/cpp1y/constexpr-79379.C

raw
1 // PR c++/79379
2 // { dg-do compile { target c++14 } }
3 // { dg-options "-O2" }
4
5 template <int N>
6 constexpr int
7 foo (int x)
8 {
9 int q[64] = { 0 }, r = 0;
10 #pragma GCC ivdep
11 for (int i = 0; i < x; ++i)
12 q[i] += 2;
13 for (int i = 0; i < x; ++i)
14 r += q[i];
15 return r + N;
16 }
17
18 constexpr int a = foo<0> (17);
19 static_assert (a == 34, "");