mirror of
https://forge.sourceware.org/marek/gcc.git
synced 2026-02-22 20:01:31 -05:00
PR c++/71504 * constexpr.c (cxx_fold_indirect_ref_1): New function. (cxx_fold_indirect_ref): Use it. * g++.dg/cpp0x/constexpr-array21.C: New test. * g++.dg/cpp1y/constexpr-array7.C: New test. * g++.dg/cpp1z/constexpr-array1.C: New test. 2019-10-04 Jason Merrill <jason@redhat.com> PR c++/71504 * g++.dg/cpp0x/constexpr-array20.C: New test. From-SVN: r276563
17 lines
299 B
C
17 lines
299 B
C
// PR c++/71504
|
|
// { dg-do compile { target c++14 } }
|
|
|
|
template <typename A>
|
|
constexpr auto
|
|
sum (A const &a)
|
|
{
|
|
int tot = 0;
|
|
for (auto &row : a)
|
|
for (auto elem : row)
|
|
tot += elem;
|
|
return tot;
|
|
}
|
|
|
|
constexpr int const a22[2][2] = {{1,2},{3,4}};
|
|
static_assert (sum(a22) == 10, "badsum");
|