[clang] [clang-repl] Fix duplicate definition error for symbols in C mode (PR #164597)

Anutosh Bhat via cfe-commits cfe-commits at lists.llvm.org
Wed Oct 22 06:10:06 PDT 2025


anutosh491 wrote:

Added tests and some comments too (cause its easy to miss out on this detail I think, can remove if not needed !)

Not sure how handling tentative definitions also fixes the union TODO test (the struct ones still fail)

And then I've added a block for tentative definitions which is actually what the PR was addressing. Something like this I guess (definitions and then assignment)
```
(base) anutosh491 at Anutoshs-MacBook-Air bin % ./clang-repl --Xcc=-x --Xcc=c --Xcc=-std=c23                   
clang-repl> int a;
clang-repl>  int b;
clang-repl> int c;
clang-repl> struct S { int v; } s;
clang-repl> s.v = 42;
clang-repl> s.v
(int) 42
clang-repl> static int s1;
clang-repl> static int s2 = 10;
clang-repl> s2
(int) 10
clang-repl> s1
(int) 0
```

https://github.com/llvm/llvm-project/pull/164597


More information about the cfe-commits mailing list