https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84582
--- Comment #3 from Marek Polacek <mpolacek at gcc dot gnu.org> --- It looks like we shouldn't skip the evaluation when ALLOW_NON_CONSTANT is false, similarly to the CONSTANT_CLASS_P case: @@ -5137,10 +5147,10 @@ maybe_constant_init_1 (tree t, tree decl, bool allow_non_constant) t = TREE_OPERAND (t, 1); if (TREE_CODE (t) == TARGET_EXPR) t = TARGET_EXPR_INITIAL (t); - if (!is_nondependent_static_init_expression (t)) + if (allow_non_constant + && (!is_nondependent_static_init_expression (t) + || CONSTANT_CLASS_P (t))) /* Don't try to evaluate it. */; - else if (CONSTANT_CLASS_P (t) && allow_non_constant) - /* No evaluation needed. */; else t = cxx_eval_outermost_constant_expr (t, allow_non_constant, false, decl); if (TREE_CODE (t) == TARGET_EXPR)