[Issue 2017] Dynamic array creation

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sat Oct 25 03:48:39 PDT 2008


http://d.puremagic.com/issues/show_bug.cgi?id=2017





------- Comment #1 from gide at nwawudu.com  2008-10-25 05:48 -------
The following example now compiles in DMD v2.020, but it wasn't mentioned in
the changelog, but the docs don't mention "abc"[] as a method of creating
dynamic arrays.

test.d
------
import std.stdio;

void main() {
        auto str1 = "abc"[]; // OK
        auto str2 = ['a', 'b', 'c'][];
        writefln(typeof(str1).stringof);
        writefln(typeof(str2).stringof);
}

Output
------
invariant(char)[]
char[]


-- 



More information about the Digitalmars-d-bugs mailing list