https://gcc.gnu.org/bugzilla/show_bug.cgi?id=124254
Bug ID: 124254
Summary: Accepts invalid standalone alignas declaration
Product: gcc
Version: 15.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: suyuchang at whu dot edu.cn
Target Milestone: ---
The code applies alignas as a standalone declaration: alignas(long);.
According to the standard, alignas may only appear in a declaration of a
variable, data member, or type. Clang rejects the code but GCC accepts it.
Code:
alignas ( long ) ;
clang++ test.cpp
<source>:1:1: error: 'alignas' attribute only applies to variables, data
members and tag types
1 | alignas ( long ) ;
| ^
The test case was generated by a fuzzer.