dmd 2.057 release
Jonathan M Davis
jmdavisProg at gmx.com
Fri Dec 16 14:48:04 PST 2011
On Friday, December 16, 2011 22:37:50 Christian Manning wrote:
> How about this as a better test case?
>
> ubyte[4] a;
> auto x() {
> return a;
> }
> void main() {
> auto b = x()[1..$];
> }
That actually has exactly the same problem. You're slicing a temporary. You
can't slice a static array unless it's an actual variable, or you're going to
have problems. b points to a slice of a static array which doesn't exist
anymore. It _might_ work depending on how the registers used and how the stack
is laid out, but it's still a bad idea.
Regardless, the compiler shouldn't be ICEing though.
- Jonathan M Davis
More information about the Digitalmars-d-announce
mailing list