June 21, 2023
https://issues.dlang.org/show_bug.cgi?id=24007

          Issue ID: 24007
           Summary: function/delegate literals cannot specify linkage
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: P1
         Component: dmd
          Assignee: nobody@puremagic.com
          Reporter: qs.il.paperinik@gmail.com

There is no way to express the linkage for a [function literal](https://dlang.org/spec/expression.html#function_literals).

I suggest to add
[LinkageAttribute](https://dlang.org/spec/attribute.html#linkage) in the first
two production rules for `FunctionLiteral`:
```
FunctionLiteral:
    function LinkageAttribute? RefOrAutoRef? Type? ParameterWithAttributes?
FunctionLiteralBody2
    delegate LinkageAttribute? RefOrAutoRef? Type?
ParameterWithMemberAttributes? FunctionLiteralBody2
```
(Replaced opt with `?` for better readability.)

Linkage is niche enough to justify why it’s not needed in other production rules.

--