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++).
Comment #1 by maxsamukha — 2020-01-08T23:39:55Z
(In reply to Max Samukha from comment #0)
> Same for extern(C++).
extern(C)
Comment #2 by qs.il.paperinik — 2024-05-29T10:19:42Z