https://gcc.gnu.org/g:6a5dcdb7ae6bbd9c5a273ceadc7f7c7cd8a6c8ec
commit r12-10469-g6a5dcdb7ae6bbd9c5a273ceadc7f7c7cd8a6c8ec Author: Jason Merrill <ja...@redhat.com> Date: Fri May 24 11:19:29 2024 -0400 c++: fix PR111529 backport r12-10468-g19827831516023 added the ANNOTATE_EXPR in the wrong place, leading to ICEs on several testcases. gcc/cp/ChangeLog: * pt.cc (tsubst_copy_and_build): Move ANNOTATE_EXPR out of fallthrough path. Diff: --- gcc/cp/pt.cc | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/gcc/cp/pt.cc b/gcc/cp/pt.cc index 1dcdaad571a..d6cdab5ad80 100644 --- a/gcc/cp/pt.cc +++ b/gcc/cp/pt.cc @@ -21535,6 +21535,13 @@ tsubst_copy_and_build (tree t, with constant operands. */ RETURN (t); + case ANNOTATE_EXPR: + op1 = RECUR (TREE_OPERAND (t, 0)); + RETURN (build3_loc (EXPR_LOCATION (t), ANNOTATE_EXPR, + TREE_TYPE (op1), op1, + RECUR (TREE_OPERAND (t, 1)), + RECUR (TREE_OPERAND (t, 2)))); + case NON_LVALUE_EXPR: case VIEW_CONVERT_EXPR: if (location_wrapper_p (t)) @@ -21544,13 +21551,6 @@ tsubst_copy_and_build (tree t, EXPR_LOCATION (t))); /* fallthrough. */ - case ANNOTATE_EXPR: - op1 = RECUR (TREE_OPERAND (t, 0)); - RETURN (build3_loc (EXPR_LOCATION (t), ANNOTATE_EXPR, - TREE_TYPE (op1), op1, - RECUR (TREE_OPERAND (t, 1)), - RECUR (TREE_OPERAND (t, 2)))); - default: /* Handle Objective-C++ constructs, if appropriate. */ {