Skip to content

Commit

Permalink
dmd.mtype: Add workaround for building with version 2.081.x
Browse files Browse the repository at this point in the history
  • Loading branch information
ibuclaw committed May 31, 2024
1 parent cbaad6f commit bfb6522
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion compiler/src/dmd/mtype.d
Original file line number Diff line number Diff line change
Expand Up @@ -597,6 +597,14 @@ extern (C++) abstract class Type : ASTNode
tsize_t = basic[isLP64 ? Tuns64 : Tuns32];
tptrdiff_t = basic[isLP64 ? Tint64 : Tint32];
thash_t = tsize_t;

static if (__VERSION__ == 2081)
{
// Related issue: https://issues.dlang.org/show_bug.cgi?id=19134
// D 2.081.x regressed initializing class objects at compile time.
// As a workaround initialize this global at run-time instead.
TypeTuple.empty = new TypeTuple();
}
}

/**
Expand Down Expand Up @@ -4405,7 +4413,10 @@ extern (C++) final class TypeClass : Type
extern (C++) final class TypeTuple : Type
{
// 'logically immutable' cached global - don't modify!
__gshared TypeTuple empty = new TypeTuple();
static if (__VERSION__ == 2081)
__gshared TypeTuple empty; // See comment in Type._init
else
__gshared TypeTuple empty = new TypeTuple();

Parameters* arguments; // types making up the tuple

Expand Down

0 comments on commit bfb6522

Please sign in to comment.