www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 23560] New: Deduce ABI from function parameter for function

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 puremagic.com
          Reporter: alphaglosined 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`
```

--
Dec 15 2022