Files
gcc-reflection/gcc/testsuite/g++.dg/cpp1y/constexpr-array7.C
Jakub Jelinek 0fe2ae2902 re PR c++/71504 ([C++11] constexpr fails with multidimensional arrays)
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
2019-10-04 08:56:02 +02:00

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");