Bug 8575 – Lambda expression causes compilation error with template function
Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2012-08-21T09:05:00Z
Last change time
2012-10-27T07:58:58Z
Keywords
pull, rejects-valid
Assigned to
nobody
Creator
zan77137
Comments
Comment #0 by zan77137 — 2012-08-21T09:05:50Z
This code doesn't work!
------------
template tfunc(fun...) {
auto tfunc(U)(U r) {
return r;
}
}
void bar(T)(T x) {
// import std.functional; x.tfunc!(unaryFun!"a"); // <- OK
x.tfunc!(a=>a); // <- NG
}
void test() {
bar(uint.init);
}
void main() {
bar(int.init);
}
------------
RESULT
------------
$ dmd -run main
Error: function main.bar!(uint).bar.tfunc!(__lambda2).tfunc!(int).tfunc is a nested function and cannot be accessed from main.bar!(int).bar
------------