Structure and union definitions with missing member declaration list should still be rejected in C2Y
Open
accepts-invalid
c2y
clang:frontend
- Dominant language
- LLVM
- Stars
- 40.5k
- Forks
- 18.7k
- PR merge metrics
- PR metrics pending
Description
The following program demonstrates the issue:
```c
int main(){
(struct{}){};
}
```
Clang accepts this with -pedantic-errors and -std=c2y, but this should still be invalid because this is syntactically invalid. At least one member declaration needs to be added for it to be syntactically valid.
Contributor guide
Research direction
Start by compiling the reduced program with Clang using -pedantic-errors and -std=c2y, then trace the parser path for empty struct and union definitions. Add regression coverage for the shown case and its union counterpart; done means both are rejected as syntactically invalid in C2Y.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- c
- Domain
- compilers
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Active
- Clarity
- Clearly specified
- Newbie friendliness
- 72/100