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

Oleksandr T. via cfe-commits cfe-commits at lists.llvm.org
Mon Jul 7 09:35:25 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}}
----------------
a-tarasyuk wrote:

@cor3ntin Thanks for the feedback. I've added additional tests

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


More information about the cfe-commits mailing list