www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 8303] New: [ICE] (interpret.c, line 100) Maybe caused by a closure

reply d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=8303

           Summary: [ICE] (interpret.c, line 100) Maybe caused by a
                    closure
           Product: D
           Version: D2
          Platform: x86
        OS/Version: Windows
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody puremagic.com
        ReportedBy: bearophile_hugs eml.cc



This bug seems to require several details to happen:


import std.algorithm: map;
auto foo(in int[] table) {
    return (int x) {
        return table[0];
    };
}
void main() {
    const int[] table = [1];
    auto bar = foo(table);
    [1].map!bar(); // OK
    [1].map!(foo(table))(); // crash
}



DMD 2.060alpha:

test.d(3): Error: closures are not yet supported in CTFE
test.d(11):        called from here: foo(table)
Assertion failure: 'v->ctfeAdrOnStack >= 0 && v->ctfeAdrOnStack <
stackPointer()' on line 100 in file 'interpret.c'

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Jun 26 2012
parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=8303


Don <clugdbug yahoo.com.au> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |WORKSFORME



Slightly reduced:
---
auto foo8303(in int[] table) {
    return (int x) {
        return table[0];
    };
}

void map8303(X...)(int[] y) {}

void test8303() {
    const int[] table = [1];
    [1].map8303!(foo8303(table))();
}
----
But the ICE is gone now, on git head:

vug.d(16): Error: closures are not yet supported in CTFE
vug.d(24):        called from here: foo8303(table)

Probably a duplicate of a recently fixed bug.

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