[Issue 16179] [REG2.072] git HEAD: multiSort no longer callable with delegate with context

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Thu Aug 18 05:37:22 PDT 2016


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

John Colvin <john.loughran.colvin at gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |john.loughran.colvin at gmail.
                   |                            |com

--- Comment #2 from John Colvin <john.loughran.colvin at gmail.com> ---
Here's a subtly different example that doesn't actually access the frame, but
the compiler says it does:

import std.algorithm : multiSort;

struct N
{
    string p;
    string q;
}

auto foo(N[] t)
{
    t.multiSort!((u, v) => u.q < v.q,
        (u, v) => u.p < v.p);
}

with a similar error message:

phobos/std/algorithm/sorting.d(897): Error: static function
blah.foo.multiSortImpl!((u, v) => u.q < v.q, (u, v) => u.p < v.p).multiSortImpl
cannot access frame of function blah.foo
phobos/std/algorithm/sorting.d(915): Error: static function
blah.foo.multiSortImpl!((u, v) => u.p < v.p).multiSortImpl cannot access frame
of function blah.foo
phobos/std/algorithm/sorting.d(902): Error: template instance
blah.foo.multiSortImpl!((u, v) => u.p < v.p) error instantiating
phobos/std/algorithm/sorting.d(929):        instantiated from here:
multiSortImpl!((u, v) => u.q < v.q, (u, v) => u.p < v.p)
blah.d(11):        instantiated from here: multiSort!(N[])

note that the error message also exhibits
https://issues.dlang.org/show_bug.cgi?id=16401  so it's possible this is
actually a compiler bug

--


More information about the Digitalmars-d-bugs mailing list