On Wed, Jan 15, 2025 at 10:27:56AM -0500, Jason Merrill wrote: > > @@ -7432,12 +7426,18 @@ reshape_init_r (tree type, reshape_iter > > { > > vec<constructor_elt, va_gc> *v = 0; > > CONSTRUCTOR_APPEND_ELT (v, NULL_TREE, init); > > - tree raw_init = cp_maybe_split_raw_data (d); > > + bool inc_cur; > > + reshape_iter dsave = *d; > > + tree raw_init = cp_maybe_split_raw_data (d, &inc_cur); > > CONSTRUCTOR_APPEND_ELT (v, NULL_TREE, > > raw_init ? raw_init : d->cur->value); > > if (has_designator_problem (d, complain)) > > - return error_mark_node; > > - if (!raw_init) > > + { > > + if (!inc_cur) > > + *d = dsave; > > Why restore *d on the error path? Won't the caller just return > error_mark_node as well?
I vaguely remember from writing the original patch (which introduced cp_maybe_split_raw_data) that here it actually mattered whether in the error case we move the reshape_iter or not and that it broke some tests, but I no longer remember what was it exactly. Otherwise it would also just use consume_init like most of the other cases. I can surely try without that again and see what breaks. Jakub