view gcc/testsuite/g++.dg/cpp1y/constexpr-array7.C @ 145:1830386684a0

gcc-9.2.0
author anatofuz
date Thu, 13 Feb 2020 11:34:05 +0900
parents
children
line wrap: on
line source

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