*** Issue 4515 has been marked as a duplicate of this issue. ***
Comment #2 by andrej.mitrovich — 2010-08-29T19:52:03Z
This passes:
import std.stdio : writeln;
int[1] foo()
{
return [0];
}
void main()
{
int x = foo()[0];
writeln(typeid(x)); // writes int
//~ writeln(x);
}
But if I uncomment the last line then I get a different error:
Internal error: ..\ztc\cod2.c 4494
Comment #3 by andrej.mitrovich — 2010-08-29T19:52:22Z
I forgot to mention this is on 2.048.
Comment #4 by d-bugzilla — 2010-11-16T03:41:16Z
(Digital Mars D Compiler v2.050)
I have a variation on this theme:
int f(lazy int[2] iarr) {
return iarr[1];
}
void main() {
int[2] iarr;
f(iarr);
}
Internal error: ../ztc/cgcs.c 359
It works if I remove the lazy keyword. Of course, lazy is quite meaningless in this context, but anyhow.
Comment #5 by kennytm — 2011-03-19T16:47:22Z
*** Issue 5755 has been marked as a duplicate of this issue. ***
Comment #6 by zetetyck — 2011-11-16T06:59:55Z
To make searching easier, I just want to mention that with DMD 2.056, this code:
int[1] foo() {
return [0];
}
void main() {
int x = foo()[0];
}
Now gives:
Internal error: ..\ztc\cgcs.c 352
Comment #7 by issues.dlang — 2012-06-06T01:21:52Z
Still fails on pre-2.060 HEAD with
Internal error: backend/cgcs.c 343
Comment #8 by clugdbug — 2012-09-13T07:49:33Z
*** Issue 8627 has been marked as a duplicate of this issue. ***
Comment #9 by yebblies — 2012-12-26T05:39:58Z
*** Issue 8159 has been marked as a duplicate of this issue. ***
Comment #10 by yebblies — 2012-12-26T05:40:35Z
Same thing happens with slicing
ubyte[4] bytes()
{
ubyte[4] x;
return x;
}
void main()
{
auto x = bytes()[0..4];
}