Thread overview
[Issue 18091] "Error instantiating" cumulativeFold when passing a function inside another function
Dec 24, 2017
greenify
Dec 01, 2019
berni44
Sep 21, 2020
Paul Backus
December 24, 2017
https://issues.dlang.org/show_bug.cgi?id=18091

greenify <greeenify@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |greeenify@gmail.com

--- Comment #1 from greenify <greeenify@gmail.com> ---
This is an issue with delegates:

/dlang/dmd/linux/bin64/../../src/phobos/std/algorithm/iteration.d(3377): Error:
constructor onlineapp.main.cumulativeFold!(t2).cumulativeFoldImpl!(int[],
T).cumulativeFoldImpl.Result.this cannot access frame of function D main
/dlang/dmd/linux/bin64/../../src/phobos/std/algorithm/iteration.d(3412): Error:
function onlineapp.main.cumulativeFold!(t2).cumulativeFoldImpl!(int[],
T).cumulativeFoldImpl.Result.popFront cannot access frame of function D main
/dlang/dmd/linux/bin64/../../src/phobos/std/algorithm/iteration.d(3336): Error:
template instance onlineapp.main.cumulativeFold!(t2).cumulativeFoldImpl!(int[],
T) error instantiating
onlineapp.d(19):        instantiated from here: cumulativeFold!(int[], T)

Run:

https://run.dlang.io/is/fh0WCC

--
December 01, 2019
https://issues.dlang.org/show_bug.cgi?id=18091

berni44 <bugzilla@d-ecke.de> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |bugzilla@d-ecke.de

--- Comment #2 from berni44 <bugzilla@d-ecke.de> ---
With the help of dustmite I got this down to:

template foo(T...)
{
    static void bar()
    {
        T[0];
    }
}

void main()
{
    void t() {}

    foo!t();
}

Don't know, if this helps anybody... The variadic argument seems to matter somehow.

--
September 21, 2020
https://issues.dlang.org/show_bug.cgi?id=18091

Paul Backus <snarwin+bugzilla@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |snarwin+bugzilla@gmail.com
         Resolution|---                         |DUPLICATE

--- Comment #3 from Paul Backus <snarwin+bugzilla@gmail.com> ---


*** This issue has been marked as a duplicate of issue 17841 ***

--