Fix 21225: ImportC: macro interpreted as an enum conflicts with function (#21228)

Fixes https://github.com/dlang/dmd/issues/21225

Don't let C macro variable declarations shadow any symbol.
This commit is contained in:
drpriver 2025-04-14 01:37:38 -07:00 committed by GitHub
parent d657667ff8
commit 292019346b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 8 additions and 1 deletions

View file

@ -548,7 +548,7 @@ Dsymbol handleSymbolRedeclarations(ref Scope sc, Dsymbol s, Dsymbol s2, ScopeDsy
auto vd2 = s2.isVarDeclaration(); // existing declaration
if (vd && vd.isCmacro())
return vd2;
return s2;
assert(!(vd2 && vd2.isCmacro()));

View file

@ -0,0 +1,7 @@
// https://github.com/dlang/dmd/issues/21225
void x(void){
}
#define x 3
typedef struct Foo {int y; } foo;
#define foo 3