diff --git a/std/sumtype.d b/std/sumtype.d index ee2d73a1233..715a4119404 100644 --- a/std/sumtype.d +++ b/std/sumtype.d @@ -714,16 +714,24 @@ public: { static if (is(This == Rhs)) { - return AliasSeq!(this, rhs).match!((ref value, ref rhsValue) { - static if (is(typeof(value) == typeof(rhsValue))) - { - return value == rhsValue; - } - else + final switch(tag) + { + static foreach(idx, T; Types) { - return false; + case idx: + final switch (rhs.tag) + { + static foreach(ridx, U; typeof(rhs).Types) + { + case ridx: + static if (is(immutable T == immutable U)) + return get!T == rhs.get!U; + else + return false; + } + } } - }); + } } else {