diff options
author | Jason Merrill <jason@redhat.com> | 2022-02-25 09:58:47 -0500 |
---|---|---|
committer | Jason Merrill <jason@redhat.com> | 2022-05-04 09:54:02 -0400 |
commit | 9c6a4beeed572f9e235f881e00ad8c63b6bcc9df (patch) | |
tree | 356ad0232c7b7fa9861bd7124187ec792219087d /gcc/cp/constexpr.cc | |
parent | eca04dc8555f5fae462fbd16386da9aaf38a0711 (diff) | |
download | gcc-9c6a4beeed572f9e235f881e00ad8c63b6bcc9df.zip gcc-9c6a4beeed572f9e235f881e00ad8c63b6bcc9df.tar.gz gcc-9c6a4beeed572f9e235f881e00ad8c63b6bcc9df.tar.bz2 |
c++: Remove cdtor_label
Jakub pointed out that cdtor_label is unnecessary, we should get all the
desired semantics with a normal return.
gcc/cp/ChangeLog:
* cp-tree.h (struct language_function): Remove x_cdtor_label.
(cdtor_label, LABEL_DECL_CDTOR): Remove.
* constexpr.cc (returns): Don't check LABEL_DECL_CDTOR.
(cxx_eval_constant_expression): Don't call returns.
* decl.cc (check_goto): Don't check cdtor_label.
(start_preparsed_function): And don't set it.
(finish_constructor_body, finish_destructor_body): Remove.
(finish_function_body): Don't call them.
* typeck.cc (check_return_expr): Handle cdtor_returns_this here.
* semantics.cc (finish_return_stmt): Not here.
Diffstat (limited to 'gcc/cp/constexpr.cc')
-rw-r--r-- | gcc/cp/constexpr.cc | 8 |
1 files changed, 2 insertions, 6 deletions
diff --git a/gcc/cp/constexpr.cc b/gcc/cp/constexpr.cc index c40efa6..9b1e718 100644 --- a/gcc/cp/constexpr.cc +++ b/gcc/cp/constexpr.cc @@ -6060,9 +6060,7 @@ static bool returns (tree *jump_target) { return *jump_target - && (TREE_CODE (*jump_target) == RETURN_EXPR - || (TREE_CODE (*jump_target) == LABEL_DECL - && LABEL_DECL_CDTOR (*jump_target))); + && TREE_CODE (*jump_target) == RETURN_EXPR; } static bool @@ -7473,9 +7471,7 @@ cxx_eval_constant_expression (const constexpr_ctx *ctx, tree t, case GOTO_EXPR: if (breaks (&TREE_OPERAND (t, 0)) - || continues (&TREE_OPERAND (t, 0)) - /* Allow for jumping to a cdtor_label. */ - || returns (&TREE_OPERAND (t, 0))) + || continues (&TREE_OPERAND (t, 0))) *jump_target = TREE_OPERAND (t, 0); else { |