[Issue 8832] Segfault when accessing range returned by function that has delegate referencing local variables

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sat Dec 29 00:41:06 PST 2012


http://d.puremagic.com/issues/show_bug.cgi?id=8832


Walter Bright <bugzilla at digitalmars.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |bugzilla at digitalmars.com


--- Comment #4 from Walter Bright <bugzilla at digitalmars.com> 2012-12-29 00:41:00 PST ---
A clearer test case:

import std.algorithm;
import std.range;
import std.stdio;

auto boo() {
    auto C = [2];
    auto bar(int) { return C; }
    return [1,1].map!(bar).joiner;
}

void main() {
    writeln(boo().take(12));
}

The problem is that joiner!(MapResult!(bar,int[])) is not recognized as a
'local' template instantiation, even though MapResult!(bar,int[]) is marked as
local. Hence, boo() is not marked as needing a closure (case (4) in
FuncDeclaration::needsClosure()).

The fix listed for Issue 8863 correctly fixes this one. But there are other
problems with that fix, as listed in 8863.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------


More information about the Digitalmars-d-bugs mailing list