https://gcc.gnu.org/bugzilla/show_bug.cgi?id=120978
Bug ID: 120978 Summary: Punctuators that contain # or %: are incorrectly rejected within attributes Product: gcc Version: 16.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c Assignee: unassigned at gcc dot gnu.org Reporter: luigighiron at gmail dot com Target Milestone: --- The following code is not accepted by GCC: [[ignored(##)]]int main(){} Unknown attributes should be ignored, so this code should be valid. The issue seems to be that GCC rejects any code that contains #, ##, %:, and %:%: punctuators after preprocessing. However, these punctuators can be validly used within attributes so they shouldn't be rejected unconditionally. Clang accepts this code, ignoring the warning for an ignored attribute. This bug also exists in the GCC C++ compiler.