mirror of
https://github.com/xomboverlord/ldc.git
synced 2026-02-22 22:53:13 +01:00
[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:
@@ -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
14
test/arrays5.d
Normal 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
11
test/goto1.d
Normal file
@@ -0,0 +1,11 @@
|
||||
module goto1;
|
||||
|
||||
void main()
|
||||
{
|
||||
int i;
|
||||
goto lbl;
|
||||
i++;
|
||||
lbl:
|
||||
assert(i == 0);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user