https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68782
--- Comment #4 from Jakub Jelinek <jakub at gcc dot gnu.org> --- (In reply to Jason Merrill from comment #3) > Hmm, any element without TREE_CONSTANT should have caused us to return > the original CONSTRUCTOR. Perhaps the TREE_SIDE_EFFECTS stuff is not needed, but for TREE_CONSTANT perhaps the reason is that constexpr.c has different POV on what is a constant compared to ../tree.c - at least it seems that cxx_eval_constant_expression happily accepts &y->c as *non_constant_p = false, but if CONSTRUCTOR containing that is marked TREE_CONSTANT (which is IMHO wrong, because in that case all elements should be TREE_CONSTANT), then we e.g. trigger: case CONSTRUCTOR: if (TREE_CONSTANT (t)) /* Don't re-process a constant CONSTRUCTOR, but do fold it to VECTOR_CST if applicable. */ return fold (t); r = cxx_eval_bare_aggregate (ctx, t, lval, non_constant_p, overflow_p); break; and just fold it instead of calling cxx_eval_bare_aggregate on it. > I thought there was already a function to recompute these flags, but I'm > not finding it. I can't find it either, we have that only for ADDR_EXPR it seems - recompute_tree_invariant_for_addr_expr.