Thread overview
[Issue 8575] New: Lambda expression causes compilation error with template function
Aug 21, 2012
SHOO
Oct 02, 2012
Kenji Hara
[Issue 8575] (D1 only) Lambda expression causes compilation error with template function
Oct 27, 2012
yebblies
Oct 27, 2012
Kenji Hara
Oct 27, 2012
yebblies
August 21, 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@puremagic.com
        ReportedBy: zan77137@nifty.com


--- Comment #0 from SHOO <zan77137@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: -------
October 02, 2012
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


--- Comment #1 from Kenji Hara <k.hara.pg@gmail.com> 2012-10-02 03:57:08 PDT ---
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: -------
October 27, 2012
http://d.puremagic.com/issues/show_bug.cgi?id=8575



--- Comment #2 from github-bugzilla@puremagic.com 2012-10-27 07:04:57 PDT ---
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 Merge pull request #1158 from 9rnsr/fix8575

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: -------
October 27, 2012
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


--- Comment #3 from yebblies <yebblies@gmail.com> 2012-10-28 01:41:47 EST ---
Fixed for D2

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
October 27, 2012
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


--- Comment #4 from Kenji Hara <k.hara.pg@gmail.com> 2012-10-27 07:50:56 PDT ---
(In reply to comment #3)
> 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: -------
October 27, 2012
http://d.puremagic.com/issues/show_bug.cgi?id=8575



--- Comment #5 from yebblies <yebblies@gmail.com> 2012-10-28 01:58:58 EST ---
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: -------