Bug 8893 – [ICE][CTFE] (interpret.c, line 3598) with failed array access
Status
RESOLVED
Resolution
FIXED
Severity
major
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2012-10-25T09:58:00Z
Last change time
2015-06-09T05:11:51Z
Keywords
CTFE, ice, pull
Assigned to
clugdbug
Creator
bearophile_hugs
Comments
Comment #0 by bearophile_hugs — 2012-10-25T09:58:42Z
struct Foo {
char[3] data;
}
int bar(Foo f) {
return f.data[0];
}
void main() {
enum f = Foo(['A', 'B']);
enum int b = bar(f);
}
DMD 2.061alpha:
test.d(8): Error: cannot implicitly convert expression (['A','B']) of type char[] to char
Assertion failure: '0' on line 3598 in file 'interpret.c'
Comment #4 by bearophile_hugs — 2012-10-30T06:01:42Z
struct Foo {
char[3] data;
}
int bar(Foo f) {
return f.data[0];
}
void main() {
enum f = Foo(['A', 'B']);
enum int b = bar(f);
}
The error message seems not correct:
test.d(8): Error: cannot implicitly convert expression (['A','B']) of type char[] to char
Instead of:
test.d(8): Error: cannot implicitly convert expression (['A','B']) of type char[] to char[3]
Comment #5 by bearophile_hugs — 2012-10-30T10:58:55Z
(In reply to comment #4)
> The error message seems not correct:
Moved to Issue 8918