Bug 8303 – [ICE] (interpret.c, line 100) Maybe caused by a closure
Status
RESOLVED
Resolution
WORKSFORME
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
x86
OS
Windows
Creation time
2012-06-26T15:39:00Z
Last change time
2012-11-13T23:43:44Z
Keywords
CTFE, ice
Assigned to
nobody
Creator
bearophile_hugs
Comments
Comment #0 by bearophile_hugs — 2012-06-26T15:39:18Z
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'
Comment #1 by clugdbug — 2012-11-13T23:43:44Z
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.