Fix #20831 - Mangle conflict after ImportC statement expression gets expanded from macro (#20854)

This commit is contained in:
Dennis 2025-02-12 13:44:16 +01:00 committed by GitHub
parent ffbad272b6
commit f37cfdf837
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 19 additions and 3 deletions

View file

@ -248,13 +248,14 @@ nothrow:
* directly, but that would unnecessary lengthen symbols names. See issue:
* https://issues.dlang.org/show_bug.cgi?id=23722
*/
static struct Key { uint fileOffset; string prefix; string parent; }
static struct Key { string locKey; string prefix; string parent; }
__gshared uint[Key] counters;
string locKey = cast(string) (sl.filename ~ idBuf[]);
static if (__traits(compiles, counters.update(Key.init, () => 0u, (ref uint a) => 0u)))
{
// 2.082+
counters.update(Key(loc.fileOffset, prefix, parent),
counters.update(Key(locKey, prefix, parent),
() => 1u, // insertion
(ref uint counter) // update
{
@ -266,7 +267,7 @@ nothrow:
}
else
{
const key = Key(loc.fileOffset, prefix, parent);
const key = Key(locKey, prefix, parent);
if (auto pCounter = key in counters)
{
idBuf.writestring("_");