fix Issue 24029 - ImportC: symbol name clash on statement expressions (#15378)

This commit is contained in:
Walter Bright 2023-07-04 01:15:48 -07:00 committed by GitHub
parent 17fc037fc2
commit 9c7e5b18ef
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 26 additions and 0 deletions

View file

@ -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)

View 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;
}