http://d.puremagic.com/issues/show_bug.cgi?id=9192

           Summary: Allow opEquals for .tupleof expressions
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: enhancement
          Priority: P2
         Component: DMD
        AssignedTo: [email protected]
        ReportedBy: [email protected]


--- Comment #0 from Andrej Mitrovic <[email protected]> 2012-12-21 
07:02:39 PST ---
struct S
{
    this(S rhs)
    {
        this.tupleof = rhs.tupleof;
    }

    bool opEquals(const ref S rhs) const
    {
        return this.tupleof == rhs.tupleof;
    }

    int x;
}

void main()
{
    S s1, s2;
    assert(s1 == s2);
}

test.d(12): Error: incompatible types for ((tuple(this.x)) == (tuple(rhs.x))):
'(const(int))' and '(const(int))'

Since we're allowed to assign to a .tupleof, why not allow comparisons? For one
use-case this would make it easy to implement a workaround until Issue 3789 is
fixed.

Although only the == and != should probably be implemented, < and > don't make
much sense.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------

Reply via email to