[Issue 12157] New: Variant opEquals always returns false for classes.

d-bugmail at puremagic.com d-bugmail at puremagic.com
Thu Feb 13 22:02:09 PST 2014


https://d.puremagic.com/issues/show_bug.cgi?id=12157

           Summary: Variant opEquals always returns false for classes.
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: ASSIGNED
          Severity: normal
          Priority: P2
         Component: Phobos
        AssignedTo: opantm2+dbugs at gmail.com
        ReportedBy: opantm2+dbugs at gmail.com


--- Comment #0 from Kapps <opantm2+dbugs at gmail.com> 2014-02-13 22:02:00 PST ---
Sample:

import std.variant;

class Foo {
    int a;
}

void main() {
    Foo f = new Foo();
    Variant v = f;
    assert(v == f);
}


Because the check for if it's possible checks if typeof T.init == T.init, which
is a compiler error for classes as it compares to null.

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


More information about the Digitalmars-d-bugs mailing list