2016-02-17 Jason Merrill <jason@redhat.com>
+ PR c++/68585
+ * constexpr.c (cxx_eval_bare_aggregate): Fix 'changed' detection.
+
PR c++/68679
* decl2.c (reset_type_linkage_2): Look through member templates.
bool side_effects_p = false;
FOR_EACH_CONSTRUCTOR_ELT (v, i, index, value)
{
+ tree orig_value = value;
constexpr_ctx new_ctx;
init_subob_ctx (ctx, new_ctx, index, value);
if (new_ctx.ctor != ctx->ctor)
/* Don't VERIFY_CONSTANT here. */
if (ctx->quiet && *non_constant_p)
break;
- if (elt != value)
+ if (elt != orig_value)
changed = true;
if (!TREE_CONSTANT (elt))
--- /dev/null
+// PR c++/68585
+// { dg-do compile { target c++11 } }
+
+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 array<Pos, sizeof...(Ints)> make_grid_position(integer_sequence<T, Ints...>)
+{
+ return {{ Pos{Ints}... }};
+}
+
+constexpr array<Pos, 1> make_grid_positions()
+{
+ return make_grid_position(integer_sequence<unsigned, 0>{});
+}
+
+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);
+}