[svn r41] new'd dynamic arrays are now initialized with the element type's default initializer.

initial label/goto support.
This commit is contained in:
Tomas Lindquist Olsen
2007-10-10 03:38:24 +02:00
parent 4fdad2c750
commit 67a92f5d51
10 changed files with 206 additions and 113 deletions

View File

@@ -3,5 +3,7 @@ module arrays4;
void main()
{
auto arr = new int[4];
{auto arrcat = arr ~ arr;}
auto arrcat = arr ~ arr;
assert(arrcat.length == arr.length * 2);
}

14
test/arrays5.d Normal file
View File

@@ -0,0 +1,14 @@
module arrays5;
//import std.stdio;
void main()
{
auto arr = new float[5];
arr[4] = 1f;
//writefln(arr);
assert(arr[0] !<>= 0f);
assert(arr[1] !<>= 0f);
assert(arr[2] !<>= 0f);
assert(arr[3] !<>= 0f);
assert(arr[4] == 1f);
}

11
test/goto1.d Normal file
View File

@@ -0,0 +1,11 @@
module goto1;
void main()
{
int i;
goto lbl;
i++;
lbl:
assert(i == 0);
}