[clang] [Clang] disallow # operators in attribute argument lists (PR #147308)

Corentin Jabot via cfe-commits cfe-commits at lists.llvm.org
Mon Jul 7 08:11:55 PDT 2025


================
@@ -477,3 +477,8 @@ namespace P2361 {
 }
 
 alignas(int) struct AlignAsAttribute {}; // expected-error {{misplaced attributes; expected attributes here}}
+
+namespace GH147217 {
+  [[clang::annotate(#)]] void a();      // expected-error {{'#' is not allowed in attribute argument lists}}
+  [[clang::annotate(##)]] void b();     // expected-error {{'##' is not allowed in attribute argument lists}}
----------------
cor3ntin wrote:

 We are also supposed to reject `#` in an unknown attribute, can you add tests for that?


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


More information about the cfe-commits mailing list