Fix 23722 - Lambdas are mangled incorrectly when using multiple compi… (#15343)

* Fix 23722 - Lambdas are mangled incorrectly when using multiple compilation units, resulting in incorrect code

* Update test cases
This commit is contained in:
Dennis 2024-11-27 12:03:16 +01:00 committed by GitHub
parent 4c645bbaf9
commit a3abf1187e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
44 changed files with 102 additions and 84 deletions

View file

@ -5548,7 +5548,7 @@ private extern (C++) final class ExpressionSemanticVisitor : Visitor
{
if (exp.fd.ident == Id.empty)
{
const(char)[] s;
string s;
if (exp.fd.fes)
s = "__foreachbody";
else if (exp.fd.tok == TOK.reserved)
@ -5582,7 +5582,7 @@ private extern (C++) final class ExpressionSemanticVisitor : Visitor
symtab = sds.symtab;
}
assert(symtab);
Identifier id = Identifier.generateId(s, symtab.length() + 1);
Identifier id = Identifier.generateIdWithLoc(s, exp.loc);
exp.fd.ident = id;
if (exp.td)
exp.td.ident = id;