https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81942
--- Comment #12 from Paolo Carlini <paolo.carlini at oracle dot com> --- I think this is getting closer: Index: constexpr.c =================================================================== --- constexpr.c (revision 251607) +++ constexpr.c (working copy) @@ -3671,7 +3671,9 @@ static bool returns (tree *jump_target) { return *jump_target - && TREE_CODE (*jump_target) == RETURN_EXPR; + && (TREE_CODE (*jump_target) == RETURN_EXPR + || (TREE_CODE (*jump_target) == LABEL_DECL + && LABEL_DECL_CDTOR (*jump_target))); } static bool @@ -4554,7 +4556,9 @@ cxx_eval_constant_expression (const constexpr_ctx case GOTO_EXPR: *jump_target = TREE_OPERAND (t, 0); - gcc_assert (breaks (jump_target) || continues (jump_target)); + gcc_assert (breaks (jump_target) || continues (jump_target) + /* Allow for jumping to a cdtor_label. */ + || returns (jump_target)); break; case LOOP_EXPR: Index: cp-tree.h =================================================================== --- cp-tree.h (revision 251607) +++ cp-tree.h (working copy) @@ -3833,6 +3833,11 @@ more_aggr_init_expr_args_p (const aggr_init_expr_a #define LABEL_DECL_CONTINUE(NODE) \ DECL_LANG_FLAG_1 (LABEL_DECL_CHECK (NODE)) +/* Nonzero if NODE is the target for genericization of 'return' stmts + in constructors/destructors of targetm.cxx.cdtor_returns_this targets. */ +#define LABEL_DECL_CDTOR(NODE) \ + DECL_LANG_FLAG_2 (LABEL_DECL_CHECK (NODE)) + /* True if NODE was declared with auto in its return type, but it has started compilation and so the return type might have been changed by return type deduction; its declared return type should be found in Index: decl.c =================================================================== --- decl.c (revision 251607) +++ decl.c (working copy) @@ -15072,7 +15073,10 @@ start_preparsed_function (tree decl1, tree attrs, if (DECL_DESTRUCTOR_P (decl1) || (DECL_CONSTRUCTOR_P (decl1) && targetm.cxx.cdtor_returns_this ())) - cdtor_label = create_artificial_label (input_location); + { + cdtor_label = create_artificial_label (input_location); + LABEL_DECL_CDTOR (cdtor_label) = true; + } start_fname_decls ();