Debian Codegraph @

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

raw
1 // PR c++/71504
2 // { dg-do compile { target c++14 } }
3
4 template <typename A>
5 constexpr auto
6 sum (A const &a)
7 {
8 int tot = 0;
9 for (auto &row : a)
10 for (auto elem : row)
11 tot += elem;
12 return tot;
13 }
14
15 constexpr int const a22[2][2] = {{1,2},{3,4}};
16 static_assert (sum(a22) == 10, "badsum");