www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 22388] New: Wrong overload selected for safe delegate

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

          Issue ID: 22388
           Summary: Wrong overload selected for  safe delegate
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: P1
         Component: dmd
          Assignee: nobody puremagic.com
          Reporter: moonlightsentinel disroot.org

The following code fails to compile because the compiler selects the compiler
wrongly selects the first overload instead of the second one:


void setTimer(void delegate() callback)  system;

void setTimer(void delegate()  safe callback)  safe;

void main()  safe
{
    alias lambda = { assert(false); };
    setTimer(lambda);
}

--
Oct 14 2021