[Issue 14909] New: Template argument of std.algoirthm.iteration.chunkBy cannot access a local variable

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Wed Aug 12 00:49:50 PDT 2015


https://issues.dlang.org/show_bug.cgi?id=14909

          Issue ID: 14909
           Summary: Template argument of std.algoirthm.iteration.chunkBy
                    cannot access a local variable
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: P1
         Component: phobos
          Assignee: nobody at puremagic.com
          Reporter: ttanjo at gmail.com

The following code cannot be compiled.
I checked it by using DMD trunk (v2.068-devel-407dac3) in Mac OSX.

---
import std.algorithm.iteration;

void main()
{
    auto n = 3;
    auto s = [1,2,3].chunkBy!(a => a+n); ///  Error: function
sample.main.ChunkByImpl!(__lambda1, int[]).ChunkByImpl.__lambda12 cannot access
frame of function D main
}
---

--


More information about the Digitalmars-d-bugs mailing list