mirror of
https://github.com/dlang/dmd.git
synced 2025-04-25 12:40:11 +03:00
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:
parent
d657667ff8
commit
292019346b
2 changed files with 8 additions and 1 deletions
|
@ -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()));
|
||||
|
||||
|
|
7
compiler/test/compilable/test21225.c
Normal file
7
compiler/test/compilable/test21225.c
Normal 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
|
Loading…
Add table
Add a link
Reference in a new issue