www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 19618] New: Incorrect conversion of function returning

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

          Issue ID: 19618
           Summary: Incorrect conversion of function returning
                    `typeof(null)` to function returning an associative
                    array
           Product: D
           Version: D2
          Hardware: x86
                OS: All
            Status: NEW
          Severity: regression
          Priority: P1
         Component: dmd
          Assignee: nobody puremagic.com
          Reporter: ibuclaw gdcproject.org

Fix for issue 8589 was incomplete.

---
void f(int[int] function() del)
{
    assert(!del());
}

typeof(null) g() { return null; }

void main()
{
    f(&g);
    f(() => null);
}
---

As typeof(null) is a pointer type, whilst associative arrays are value types. 
So can't possibly be covariant.

--
Jan 26