llvm / llvm/llvm-project

[Clang] C23 Fixed-type enum specifier rejected in _Generic association list

Open
#207,357 9 comments 0 reactions 0 assignees View on GitHub
c23 clang:frontend confirmed diverges-from:gcc
Dominant language
LLVM
Stars
40.5k
Forks
18.7k
PR merge metrics
PR metrics pending

Description

```C
int main() {
// clang error: unnamed enumeration must be a definition
(void)_Generic(0, enum:long{A}:1, default: 0);

// clang error: expected expression
(void)_Generic(0, enum E:long{B}:1, default: 0);
}
```
GCC accepts both : https://c.godbolt.org/z/GdhcWx5hM

Contributor guide

Open the contributing guide

Research direction

Start by compiling the two C23 _Generic reproductions from the issue and compare Clang's behavior with GCC. Trace the parser or semantic handling of fixed-type enum specifiers in association lists; done means both forms are accepted and covered by regression tests.

Written by the indexing model from the issue text.

Assessment

Tech stack
c
Domain
compilers
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
55/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.