[Bug c++/68585] [5/6 Regression] c++14 code accepted by 4.9 not accepted by 5 and 6

redi at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Tue Dec 1 14:29:00 GMT 2015


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

--- Comment #2 from Jonathan Wakely <redi at gcc dot gnu.org> ---
template<typename T, unsigned N>
  struct array
  {
    T _M_data[N];
  };

template<typename _Tp, _Tp... _Idx>
  struct integer_sequence
  {
  };

struct Pos
{
  unsigned l;
};

template<class T, T... Ints>
constexpr auto make_grid_position(integer_sequence<T, Ints...>)
{
  return array<Pos, sizeof...(Ints)>{{ Pos{Ints}... }};
}

constexpr auto make_grid_positions()
{
  return make_grid_position(integer_sequence<unsigned, 0, 1, 2, 3>{});
}

template<class T>
void generate_sudoku(T)
{
  constexpr auto positions = make_grid_positions(); // fail
}

int main()
{
  constexpr auto positions = make_grid_positions(); // ok
  generate_sudoku(1);
}


More information about the Gcc-bugs mailing list