llvm / llvm/llvm-project

[Clang] Assignability of statement-expression struct result diverges from GCC

Open
#221,538 5 comments 0 reactions 0 assignees View on GitHub
clang:frontend diverges-from:gcc
Dominant language
LLVM
Stars
40.5k
Forks
18.7k
PR merge metrics
PR metrics pending

Description

```c
int main() {
struct { int i; } s;
({ s; }).i = 7; // GCC allow, Clang reject
}
```
https://c.godbolt.org/z/W5zv7rMaY

Contributor guide

Open the contributing guide

Research direction

Start by compiling the provided C reproducer with Clang and GCC and compare the diagnostics for assigning through the statement-expression result. The issue names no source file or test, so trace Clang's statement-expression and member-assignment handling; done means Clang accepts the assignment consistently with GCC and has regression coverage.

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
Active
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.