diff options
author | Iain Buclaw <ibuclaw@gdcproject.org> | 2025-04-08 16:36:15 +0200 |
---|---|---|
committer | Iain Buclaw <ibuclaw@gdcproject.org> | 2025-04-08 16:36:15 +0200 |
commit | 639376154eaffe683f4027c95a08c5d30922b12d (patch) | |
tree | ac2b9254a96baae2e747cedcd6de03f2538f7002 /gcc/d | |
parent | 1b5b02be5740b69f670b1591ac63eb6a69ff1f79 (diff) | |
download | gcc-639376154eaffe683f4027c95a08c5d30922b12d.zip gcc-639376154eaffe683f4027c95a08c5d30922b12d.tar.gz gcc-639376154eaffe683f4027c95a08c5d30922b12d.tar.bz2 |
d: Fix infinite loop in isAliasThisTuple
This reverts a change in the upstream D implementation of the compiler,
as the refactoring introduced a regression.
gcc/d/ChangeLog:
* dmd/MERGE: Merge upstream dmd 51816cd01d.
Reviewed-on: https://github.com/dlang/dmd/pull/21155
Diffstat (limited to 'gcc/d')
-rw-r--r-- | gcc/d/dmd/MERGE | 2 | ||||
-rw-r--r-- | gcc/d/dmd/expressionsem.d | 30 |
2 files changed, 18 insertions, 14 deletions
diff --git a/gcc/d/dmd/MERGE b/gcc/d/dmd/MERGE index bd297b6..a05a50e 100644 --- a/gcc/d/dmd/MERGE +++ b/gcc/d/dmd/MERGE @@ -1,4 +1,4 @@ -ed17b3e95dc3fc3264a4c91843da824f5541f3e1 +51816cd01deee5cc1d7d2c6e1e24788ec655b73e The first line of this file holds the git revision number of the last merge done from the dlang/dmd repository. diff --git a/gcc/d/dmd/expressionsem.d b/gcc/d/dmd/expressionsem.d index b0278cb..19111e3 100644 --- a/gcc/d/dmd/expressionsem.d +++ b/gcc/d/dmd/expressionsem.d @@ -641,21 +641,25 @@ TupleDeclaration isAliasThisTuple(Expression e) Type t = e.type.toBasetype(); while (true) { - Dsymbol s = t.toDsymbol(null); - if (!s) - return null; - auto ad = s.isAggregateDeclaration(); - if (!ad) - return null; - s = ad.aliasthis ? ad.aliasthis.sym : null; - if (s && s.isVarDeclaration()) + if (Dsymbol s = t.toDsymbol(null)) { - TupleDeclaration td = s.isVarDeclaration().toAlias().isTupleDeclaration(); - if (td && td.isexp) - return td; + if (auto ad = s.isAggregateDeclaration()) + { + s = ad.aliasthis ? ad.aliasthis.sym : null; + if (s && s.isVarDeclaration()) + { + TupleDeclaration td = s.isVarDeclaration().toAlias().isTupleDeclaration(); + if (td && td.isexp) + return td; + } + if (Type att = t.aliasthisOf()) + { + t = att; + continue; + } + } } - if (Type att = t.aliasthisOf()) - t = att; + return null; } } |