mirror of
https://github.com/dlang/dmd.git
synced 2025-04-26 13:10:12 +03:00
fix Issue 24029 - ImportC: symbol name clash on statement expressions (#15378)
This commit is contained in:
parent
17fc037fc2
commit
9c7e5b18ef
2 changed files with 26 additions and 0 deletions
|
@ -3179,6 +3179,9 @@ private extern(C++) final class DsymbolSemanticVisitor : Visitor
|
|||
funcdecl.skipCodegen = true;
|
||||
|
||||
funcdecl._linkage = sc.linkage;
|
||||
if (sc.flags & SCOPE.Cfile && funcdecl.isFuncLiteralDeclaration())
|
||||
funcdecl._linkage = LINK.d; // so they are uniquely mangled
|
||||
|
||||
if (auto fld = funcdecl.isFuncLiteralDeclaration())
|
||||
{
|
||||
if (fld.treq)
|
||||
|
|
23
compiler/test/runnable/test24029.c
Normal file
23
compiler/test/runnable/test24029.c
Normal file
|
@ -0,0 +1,23 @@
|
|||
// https://issues.dlang.org/show_bug.cgi?id=24029
|
||||
|
||||
int x = 0;
|
||||
int y = 0;
|
||||
|
||||
void a()
|
||||
{
|
||||
(__extension__ ({ x += 2; })); // test.a.__dgliteral1
|
||||
}
|
||||
|
||||
void b()
|
||||
{
|
||||
(__extension__ ({ y += 1; })); // test.b.__dgliteral1
|
||||
}
|
||||
|
||||
int main(void)
|
||||
{
|
||||
a();
|
||||
b();
|
||||
__check(x == 2);
|
||||
__check(y == 1);
|
||||
return 0;
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue