[clang] [Clang][Parser] Report error when attribute missing ]] followed by ;; (PR #187580)

Amr Hesham via cfe-commits cfe-commits at lists.llvm.org
Sat May 16 09:56:40 PDT 2026


================
@@ -0,0 +1,15 @@
+// RUN: %clang_cc1 -fsyntax-only -verify %s
+
+// expected-note at +1 {{to match this '{'}}
+void a(int i) {
+    switch(i) {
+        case 1:
+  // expected-error at +2 {{expected ']'}}
+  // expected-error at +3 {{expected ']'}}
+  [[fallthrough;;
+        case 2:
+        ;
+    };
+   // expected-error at +2 {{expected statement}}
----------------
AmrDeveloper wrote:

- The statement diagnostic is because during parsing the case statement, we started by parsing the attribute, which moved the cursor to EoF (No ] to skip to).

- Then after that, we report missing `}` because we have `[` but it's unclosed

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


More information about the cfe-commits mailing list