www.digitalmars.com         C & C++   DMDScript  

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

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 puremagic.com
        ReportedBy: opantm2+dbugs gmail.com



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: -------
Sep 17 2013