www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 8575] New: Lambda expression causes compilation error with template function

reply d-bugmail puremagic.com writes:
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 puremagic.com
        ReportedBy: zan77137 nifty.com



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: -------
Aug 21 2012
next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=8575


Kenji Hara <k.hara.pg gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |pull, rejects-valid



https://github.com/D-Programming-Language/dmd/pull/1158

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Oct 02 2012
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=8575




Commits pushed to master at https://github.com/D-Programming-Language/dmd

https://github.com/D-Programming-Language/dmd/commit/688f7ce593eef75997a2b8f2527d3cd9338692aa
fix Issue 8575 - Lambda expression causes compilation error with template
function

Template lambda is an expression, so we should keep FuncExp until actually
starting instantiation of passed template instance.

https://github.com/D-Programming-Language/dmd/commit/8b82a0aa4feb863e9bbc53b36cc2008a7d994696


fix Issue 8575 - Lambda expression causes compilation error with template
function

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Oct 27 2012
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=8575


yebblies <yebblies gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |yebblies gmail.com
            Version|D2                          |D1
            Summary|Lambda expression causes    |(D1 only) Lambda expression
                   |compilation error with      |causes compilation error
                   |template function           |with template function



Fixed for D2

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Oct 27 2012
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=8575


Kenji Hara <k.hara.pg gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
            Version|D1                          |D2
         Resolution|                            |FIXED
            Summary|(D1 only) Lambda expression |Lambda expression causes
                   |causes compilation error    |compilation error with
                   |with template function      |template function




 Fixed for D2
Lambda literal is only in D2. So we should mark this "RESOLVED FIXED". -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Oct 27 2012
prev sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=8575




Heh, the online documentation disagrees, but you're right.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Oct 27 2012