[Issue 22388] New: Wrong overload selected for @safe delegate

d-bugmail at puremagic.com d-bugmail at puremagic.com
Thu Oct 14 23:31:04 UTC 2021


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 at puremagic.com
          Reporter: moonlightsentinel at 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);
}

--


More information about the Digitalmars-d-bugs mailing list