www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 24219] New: Can't compare AliasSeq with is operator

https://issues.dlang.org/show_bug.cgi?id=24219

          Issue ID: 24219
           Summary: Can't compare AliasSeq with is operator
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: P1
         Component: dmd
          Assignee: nobody puremagic.com
          Reporter: snarwin+bugzilla gmail.com

As of DMD 2.105.2, the following program fails to compile:

---
struct S { int x, y; }

void main()
{
    auto s1 = S(123, 456);
    auto s2 = S(123, 456);
    assert(s1.tupleof is s2.tupleof);
}
---

The error message is:

---
test.d(7): Error: incompatible types for `(AliasSeq!(s1.x, s1.y)) is
(AliasSeq!(s2.x, s2.y))`: both operands are of type `(int, int)`
---

If the `is` operator is replaced with `==`, the program compiles and runs
successfully.

--
Nov 02 2023