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

d-bugmail at puremagic.com d-bugmail at puremagic.com
Mon Aug 23 14:11:51 UTC 2021


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

Iain Buclaw <ibuclaw at gdcproject.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |ibuclaw at gdcproject.org

--- Comment #3 from Iain Buclaw <ibuclaw at gdcproject.org> ---
Possibly reduced test:
---
template binaryFun(alias fun)
{
    alias binaryFun = fun;
}

struct ChunkByImpl(alias pred, Range)
{
    alias eq = binaryFun!((a, b) => pred(a));
    Range r;
    this(Range )
    {
        eq(r, r);
    }
}

auto chunkBy(alias pred, Range)(Range)
{
    ChunkByImpl!(pred, Range);
}

void main()
{
    auto n = 3;
    1.chunkBy!(a => a+n);
}

--


More information about the Digitalmars-d-bugs mailing list