[Issue 17871] Delegate type inference doesn't work

d-bugmail at puremagic.com d-bugmail at puremagic.com
Mon Oct 2 10:54:55 UTC 2017


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

--- Comment #2 from Mathias Lang <mathias.lang at sociomantic.com> ---
Oh damn, of course. Thanks for pointing this out!

It is rather inconsistent though:
```
auto wrapper = (foo) {};
```
Doesn't compile, but:
```
auto wrapper = (int) {};
```
Does.
Likewise, naming the parameter make it compile:
```
auto wrapper = (size_t foo) {};
```

The grammar mentions that a FunctionLiteral
(https://dlang.org/spec/grammar.html#FunctionLiteral) is, in this case:
ParameterMemberAttributes FunctionLiteralBody

Skipping a couple of intermediate steps, we end up with a list of Parameter
(https://dlang.org/spec/grammar.html#Parameter) which always starts with `Type`
or `BasicType`, so it looks like the grammar is not up to date in that regard
(unless I'm again missing something?).

--


More information about the Digitalmars-d-bugs mailing list