[clang] [Clang][Parser] Reject unbalanced unknown attribute arguments (PR #220259)

Aaron Ballman via cfe-commits cfe-commits at lists.llvm.org
Fri Oct 2 04:36:58 PDT 2026


================
@@ -0,0 +1,11 @@
+// RUN: %clang_cc1 -fsyntax-only -verify -std=c++11 %s
+// RUN: %clang_cc1 -fsyntax-only -verify=expected,pedantic -std=c++11 -pedantic %s
+// RUN: %clang_cc1 -fsyntax-only -verify -x c -std=c23 %s
+// RUN: %clang_cc1 -fsyntax-only -verify=expected,pedantic -x c -std=c23 -pedantic %s
+
+void test() {
+  [[X1(])]]; // expected-warning {{unknown attribute 'X1' ignored}} pedantic-warning {{attribute argument list is not a balanced token sequence}}
+  [[X1(})]]; // expected-warning {{unknown attribute 'X1' ignored}} pedantic-warning {{attribute argument list is not a balanced token sequence}}
----------------
AaronBallman wrote:

Some additional tests to consider:
```
[[X1())]];
[[X1([)]];
[[X1({)]];
[[X1(()]];
[[X1([[[[[]]]])]];
```

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


More information about the cfe-commits mailing list