From: Jason Merrill Date: Fri, 24 May 2024 15:19:29 +0000 (-0400) Subject: c++: fix PR111529 backport X-Git-Tag: releases/gcc-12.4.0~97 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=6a5dcdb7ae6bbd9c5a273ceadc7f7c7cd8a6c8ec;p=thirdparty%2Fgcc.git 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 --git a/gcc/cp/pt.cc b/gcc/cp/pt.cc index 1dcdaad571a7..d6cdab5ad80a 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. */ {