]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
c++: fix PR111529 backport
authorJason Merrill <jason@redhat.com>
Fri, 24 May 2024 15:19:29 +0000 (11:19 -0400)
committerJason Merrill <jason@redhat.com>
Fri, 24 May 2024 15:58:37 +0000 (11:58 -0400)
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.

gcc/cp/pt.cc

index 1dcdaad571a7b90b0ff6e2f4b119694d473c2abe..d6cdab5ad80af00f6473d43920255c7ecfa08149 100644 (file)
@@ -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.  */
       {