[Issue 23560] New: Deduce ABI from function parameter for function literal

d-bugmail at puremagic.com d-bugmail at puremagic.com
Thu Dec 15 18:51:13 UTC 2022


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

          Issue ID: 23560
           Summary: Deduce ABI from function parameter for function
                    literal
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: enhancement
          Priority: P1
         Component: dmd
          Assignee: nobody at puremagic.com
          Reporter: alphaglosined at gmail.com

This was discovered by Hipreme on Discord.

```d
alias myArg = extern(C) void function();

void test(scope myArg b){
    b();
}

void main() {
    test((){});
}
```

Error:

```
<source>(8): Error: function `example.test(scope extern (C) void function() b)`
is not callable using argument types `(void function() pure nothrow @nogc
@safe)`
<source>(8):        cannot pass argument `__lambda1` of type `void function()
pure nothrow @nogc @safe` to parameter `scope extern (C) void function() b`
```

--


More information about the Digitalmars-d-bugs mailing list