[Issue 11161] New: If `opEquals` is not defined, compiler should translate struct objects equality to member-wise equality even if there is `alias this`

d-bugmail at puremagic.com d-bugmail at puremagic.com
Thu Oct 3 00:59:39 PDT 2013


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

           Summary: If `opEquals` is not defined, compiler should
                    translate struct objects equality to member-wise
                    equality even if there is `alias this`
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Keywords: wrong-code
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody at puremagic.com
        ReportedBy: verylonglogin.reg at gmail.com


--- Comment #0 from Denis Shelomovskij <verylonglogin.reg at gmail.com> 2013-10-03 11:59:38 MSD ---
---
struct S {
    bool opEquals(ref const S) { return false; } 
}
struct T {
    S s;
    int value;
    alias value this;
}

void main() {
    T t1, t2;
    assert(t1.tupleof != t2.tupleof);
    assert(t1 != t2); // fails
}
---

If this behavior is expected, please write the reasons shortly and change it to
documentation issue unless this feature is documented.

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


More information about the Digitalmars-d-bugs mailing list