[Issue 15743] typeof function literal with unnamed parameter of aliased type is void
via Digitalmars-d-bugs
digitalmars-d-bugs at puremagic.com
Wed Mar 2 12:44:16 PST 2016
https://issues.dlang.org/show_bug.cgi?id=15743
ag0aep6g at gmail.com changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |ag0aep6g at gmail.com
--- Comment #1 from ag0aep6g at gmail.com ---
In `(string){}` and `(T){}`, `string` and `T` are actually parameter names, not
types. The function literals generate function templates like these:
void foo(A)(A string) {}
void foo(A)(A T) {}
And typeof of a template is void.
The same does not happen with `(int){}` because you can't have a parameter
named "int". So it's taken as a type instead.
I'm not sure if there's anything to be fixed/improved here. Maybe function
signatures like `void f(int string) {}` should not be allowed ("string" being
the name of the parameter here).
--
More information about the Digitalmars-d-bugs
mailing list