https://gcc.gnu.org/bugzilla/show_bug.cgi?id=59238
Jakub Jelinek <jakub at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |jakub at gcc dot gnu.org --- Comment #3 from Jakub Jelinek <jakub at gcc dot gnu.org> --- I guess the difference is that when type_build_ctor_call (type) is true, we explicitly say we don't want cleanups: if (type_build_ctor_call (type) && !explicit_value_init_p) { init_expr = build_special_member_call (init_expr, complete_ctor_identifier, init, elt_type, LOOKUP_NORMAL, complain|tf_no_cleanup); } then the explicit_value_init_p doesn't either: else if (explicit_value_init_p) { /* Something like `new int()'. NO_CLEANUP is needed so we don't try and build a (possibly ill-formed) destructor. */ tree val = build_value_init (type, complain | tf_no_cleanup); if (val == error_mark_node) return error_mark_node; init_expr = build2 (INIT_EXPR, type, init_expr, val); } but the ie = build_x_compound_expr_from_vec (*init, "new initializer", complain); init_expr = cp_build_modify_expr (input_location, init_expr, INIT_EXPR, ie, complain); case doesn't do that. Adding | tf_no_cleanup to those 3 cases seems to fix this, testing it with make check-c++-all now.