[clang] [clang] Non-trivial fixes in C++ DR tests (PR #179813)

Aaron Ballman via cfe-commits cfe-commits at lists.llvm.org
Tue Feb 10 07:41:45 PST 2026


================
@@ -0,0 +1,35 @@
+// RUN: %clang_cc1 -std=c++98 %s -fexceptions -fcxx-exceptions -pedantic-errors -triple %itanium_abi_triple -verify=expected
+// RUN: %clang_cc1 -std=c++11 %s -fexceptions -fcxx-exceptions -pedantic-errors -triple %itanium_abi_triple -verify=expected
+// RUN: %clang_cc1 -std=c++14 %s -fexceptions -fcxx-exceptions -pedantic-errors -triple %itanium_abi_triple -verify=expected
+// RUN: %clang_cc1 -std=c++17 %s -fexceptions -fcxx-exceptions -pedantic-errors -triple %itanium_abi_triple -verify=expected
+// RUN: %clang_cc1 -std=c++20 %s -fexceptions -fcxx-exceptions -pedantic-errors -triple %itanium_abi_triple -verify=expected
+// RUN: %clang_cc1 -std=c++23 %s -fexceptions -fcxx-exceptions -pedantic-errors -triple %itanium_abi_triple -verify=expected
+// RUN: %clang_cc1 -std=c++2c %s -fexceptions -fcxx-exceptions -pedantic-errors -triple %itanium_abi_triple -verify=expected
+
+namespace cwg98 { // cwg98: 2.7
+  void test(int n) {
+    switch (n) {
+      try { // #cwg98-try
+        case 0:
+        // expected-error at -1 {{cannot jump from switch statement to this case label}}
+        //   expected-note@#cwg98-try {{jump bypasses initialization of try block}}
+        x:
+          throw n;
+      } catch (...) { // #cwg98-catch
+        case 1:
+        // expected-error at -1 {{cannot jump from switch statement to this case label}}
+        //   expected-note@#cwg98-catch {{jump bypasses initialization of catch block}}
+        y:
+          throw n;
+      }
+      case 2:
+        goto x;
+        // expected-error at -1 {{cannot jump from this goto statement to its label}}
+        //   expected-note@#cwg98-try {{jump bypasses initialization of try block}}
+      case 3:
+        goto y;
+        // expected-error at -1 {{cannot jump from this goto statement to its label}}
+        //   expected-note@#cwg98-catch {{jump bypasses initialization of catch block}}
+    }
+  }
+} // namespace cwg98
----------------
AaronBallman wrote:

Add newline

https://github.com/llvm/llvm-project/pull/179813


More information about the cfe-commits mailing list