Debian Codegraph @

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

raw
1 // PR c++/96197
2 // { dg-do compile { target c++14 } }
3
4 struct S {
5 S* p = this;
6 };
7
8 constexpr S ary[5000] = {};
9
10 constexpr int foo() {
11 int count = 0;
12 for (int i = 0; i < 5000; i++)
13 if (ary[i].p != nullptr)
14 count++;
15 return count;
16 }
17
18 constexpr int bar = foo();