From a686d5e86a5aae2e158027d02672686ad8814194 Mon Sep 17 00:00:00 2001 From: Martin Kinkelin Date: Tue, 1 Feb 2022 13:24:02 +0100 Subject: [PATCH] Prepare for an upcoming breaking change with frontend v2.099 regarding opEquals order Affecting the frontend itself, see https://issues.dlang.org/show_bug.cgi?id=22717. Preparing LDC early is required to make DMD's Buildkite CI pass with the proposed fix in https://github.com/dlang/dmd/pull/13593. --- dmd/dtemplate.d | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/dmd/dtemplate.d b/dmd/dtemplate.d index 438ab26abd7..8f96d9cec8a 100644 --- a/dmd/dtemplate.d +++ b/dmd/dtemplate.d @@ -7858,15 +7858,22 @@ struct TemplateInstanceBox { bool res = void; if (ti.inst && s.ti.inst) + { /* This clause is only used when an instance with errors * is replaced with a correct instance. */ res = ti is s.ti; + } else + { /* Used when a proposed instance is used to see if there's * an existing instance. */ - res = (cast()s.ti).equalsx(cast()ti); + static if (__VERSION__ >= 2099) + res = (cast()ti).equalsx(cast()s.ti); + else // https://issues.dlang.org/show_bug.cgi?id=22717 + res = (cast()s.ti).equalsx(cast()ti); + } debug (FindExistingInstance) ++(res ? nHits : nCollisions); return res;