[Bug c++/77830] internal compiler error: in output_constructor_regular_field, at varasm.c:4968, when using constexpr (with testcase)

marxin at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Mon Oct 3 21:51:00 GMT 2016


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=77830

--- Comment #3 from Martin Liška <marxin at gcc dot gnu.org> ---
Reduced test-case:

#include <cstddef>
template <size_t N> struct Parser
{
  char arr[N][1];
  constexpr void setMember (const char *, int);
};
template <size_t N>
constexpr void
Parser<N>::setMember (const char *, int i)
{
  for (auto j = 0; j < 2; ++j)
    arr[i][j] = true;
}
template <typename... T> constexpr auto create_parser (T... a)
{
  const char *strings[]{a...};
  Parser<sizeof...(a)> p{};
  for (auto i = 0; i < sizeof...(a); ++i)
    p.setMember (strings[i], i);
  return p;
}
main () { constexpr auto a = create_parser ("", ""); }


More information about the Gcc-bugs mailing list