Classical bug
Fyodor Ustinov via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Tue Jan 27 04:23:17 PST 2015
On Tuesday, 27 January 2015 at 12:02:59 UTC, Vladimir Panteleev
wrote:
> Always. But the check seems very simple, and is easily
> circumvented. This compiles:
>
> byte[] func() {
> byte[1024] buffer;
> auto p = buffer[0..3];
> return p;
> }
I think this is the first step of a long and difficult way.
byte[] func(byte[] a) {
return a[0..1];
}
byte[] func1() {
byte[1024] buffer;
return func(buffer[1...$]);
}
byte[] func2() {
static byte[1024] buffer;
return func(buffer[1..$]);
}
More information about the Digitalmars-d-learn
mailing list