[clang] [Clang] disallow attributes on void parameters (PR #124920)

Aaron Ballman via cfe-commits cfe-commits at lists.llvm.org
Wed Jan 29 06:11:27 PST 2025


================
@@ -453,3 +453,12 @@ namespace P2361 {
 }
 
 alignas(int) struct AlignAsAttribute {}; // expected-error {{misplaced attributes; expected attributes here}}
+
+namespace GH108819 {
+void a([[maybe_unused]] void) {}                 // expected-error {{an attribute list cannot appear here}} \
----------------
AaronBallman wrote:

I think this is a confusing diagnostic -- an attribute list *can* appear here. The problem is that an attribute which appertains to a declaration cannot appertain to a void parameter. I think that should be handled in SemaDeclAttr.cpp when doing the usual appertainment checks.

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


More information about the cfe-commits mailing list