[Issue 11061] New: std.variant.Variant equality comparison always returns false for static array literals.

d-bugmail at puremagic.com d-bugmail at puremagic.com
Tue Sep 17 22:35:16 PDT 2013


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

           Summary: std.variant.Variant equality comparison always returns
                    false for static array literals.
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Phobos
        AssignedTo: nobody at puremagic.com
        ReportedBy: opantm2+dbugs at gmail.com


--- Comment #0 from Kapps <opantm2+dbugs at gmail.com> 2013-09-17 22:35:14 PDT ---
Attempting to compare a Variant containing a static array to an array literal
will always return false. The same code using a dynamic array instead of a
static array works. Presumably it's checking the pointer instead of the
contents.

Example:
import std.variant;
void main() {
    int[4] el = [0, 1, 2, 3];
    Variant v1 = el;
    assert(v1 == el); // passes
    assert(v1 == [0, 1, 2, 3]); // fails
}

-- 
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