[Issue 8575] New: Lambda expression causes compilation error with template function

d-bugmail at puremagic.com d-bugmail at puremagic.com
Tue Aug 21 09:05:51 PDT 2012


http://d.puremagic.com/issues/show_bug.cgi?id=8575

           Summary: Lambda expression causes compilation error with
                    template function
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody at puremagic.com
        ReportedBy: zan77137 at nifty.com


--- Comment #0 from SHOO <zan77137 at nifty.com> 2012-08-21 09:05:50 PDT ---
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
------------

-- 
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