[Issue 20491] New: extern(C) is not inferred for lambda agruments

d-bugmail at puremagic.com d-bugmail at puremagic.com
Wed Jan 8 23:38:00 UTC 2020


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

          Issue ID: 20491
           Summary: extern(C) is not inferred for lambda agruments
           Product: D
           Version: D2
          Hardware: All
                OS: Windows
            Status: NEW
          Severity: normal
          Priority: P1
         Component: dmd
          Assignee: nobody at puremagic.com
          Reporter: maxsamukha at gmail.com

extern(C++) alias F = void function();
void foo(F f) {
}

void bar(void function() f) {
}

void main() {
    F f = () {}; // ok
    bar(() {}); // ok without extern(C);
    foo(() {}); // fail
}

onlineapp.d(12): Error: function onlineapp.foo(extern (C++) void function() f)
is not callable using argument types (void function() pure nothrow @nogc @safe)
onlineapp.d(12):        cannot pass argument __funcliteral3 of type void
function() pure nothrow @nogc @safe to parameter extern (C++) void function() f

Same for extern(C++).

--


More information about the Digitalmars-d-bugs mailing list