www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 15367] New: array of delegates comparison fails

https://issues.dlang.org/show_bug.cgi?id=15367

          Issue ID: 15367
           Summary: array of delegates comparison fails
           Product: D
           Version: D2
          Hardware: x86_64
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P1
         Component: druntime
          Assignee: nobody puremagic.com
          Reporter: dmdtracker supradigital.org

To my understanding the code below should work, however the assert fails.

module main;

void main()
{
    void a () {}
    void b () {}

    auto array  = [&b, &a];
    auto array2 = [&b, &a];

    for (auto i = 0; i < 2; i++)
        assert(array[i] == array2[i]);

    assert(array ==  array2); // Assert failure
}

--
Nov 20 2015