[Issue 7947] typeof on anonymous function literal returns void
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Fri Apr 20 02:47:02 PDT 2012
http://d.puremagic.com/issues/show_bug.cgi?id=7947
--- Comment #1 from Kenji Hara <k.hara.pg at gmail.com> 2012-04-20 02:47:58 PDT ---
A lambda expression that needs parameter type inference is internally
translated to template function.
x => x
// auto __lambda(T1)(T1 x){ return x; }
So this:
pragma(msg, typeof(x => x));
is same as:
pragma(msg, typeof(__lambda));
// template itself has no type, then typeof(template) always returns void
And, long years, typeof(template) returns void.
Therefore, typeof(x => x) == void is current implementation design.
I don't know why typeof(template) returns void, but changing the behavior will
break some existing meta-programming codes.
--
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
More information about the Digitalmars-d-bugs
mailing list