https://gcc.gnu.org/bugzilla/show_bug.cgi?id=124277
Bug ID: 124277
Summary: Accepts invalid attribute-specifier in
elaborated-type-specifier
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: ---
GCC accepts an attribute-specifier on an elaborated-type-specifier used in a
type-id. This is ill-formed per [dcl.type.elab]/3. Clang rejects it, and LLVM
developers confirm Clang is correct
(https://github.com/llvm/llvm-project/issues/183480).
Code:
using X1 = class [[ ]] X0 ;
Command:
clang++ test.cpp
<source>:1:18: error: an attribute list cannot appear here
1 | using X1 = class [ [ ] ] X0 ;
| ^~~~~~~
1 error generated.
Compiler returned: 1
See Compiler Explorer: https://godbolt.org/z/z996jdT5Y
The test case was generated by a fuzzer.