Mercurial > projects > ldc
annotate test/arrays7.d @ 339:385a18242485 trunk
[svn r360] Another mostly rewrite of DtoArrayInit. Should be much more robust now, and probably faster code generated for the most common cases too!
Fixed issues with slice initialization (!!!) of multidimensional static arrays.
Attempt to fix issue with referencing nested 'this' pointers introduced in DMD 1.033 merge.
author | lindquist |
---|---|
date | Sun, 13 Jul 2008 01:29:49 +0200 |
parents | c44e6a711885 |
children |
rev | line source |
---|---|
40 | 1 module arrays7; |
2 | |
175
c44e6a711885
[svn r191] Fixed: array literals did not support all type/storage combinations.
lindquist
parents:
86
diff
changeset
|
3 extern(C) int printf(char*, ...); |
c44e6a711885
[svn r191] Fixed: array literals did not support all type/storage combinations.
lindquist
parents:
86
diff
changeset
|
4 |
86
fd32135dca3e
[svn r90] Major updates to the gen directory. Redesigned the 'elem' struct. Much more... !!!
lindquist
parents:
40
diff
changeset
|
5 pragma(LLVM_internal, "notypeinfo") |
40 | 6 struct S |
7 { | |
8 int i; | |
9 float f; | |
10 long l; | |
86
fd32135dca3e
[svn r90] Major updates to the gen directory. Redesigned the 'elem' struct. Much more... !!!
lindquist
parents:
40
diff
changeset
|
11 |
fd32135dca3e
[svn r90] Major updates to the gen directory. Redesigned the 'elem' struct. Much more... !!!
lindquist
parents:
40
diff
changeset
|
12 void print() |
fd32135dca3e
[svn r90] Major updates to the gen directory. Redesigned the 'elem' struct. Much more... !!!
lindquist
parents:
40
diff
changeset
|
13 { |
fd32135dca3e
[svn r90] Major updates to the gen directory. Redesigned the 'elem' struct. Much more... !!!
lindquist
parents:
40
diff
changeset
|
14 printf("%d %f %lx\n", i, f, l); |
fd32135dca3e
[svn r90] Major updates to the gen directory. Redesigned the 'elem' struct. Much more... !!!
lindquist
parents:
40
diff
changeset
|
15 } |
40 | 16 } |
17 | |
18 void main() | |
19 { | |
20 S[] arr; | |
21 S s; | |
86
fd32135dca3e
[svn r90] Major updates to the gen directory. Redesigned the 'elem' struct. Much more... !!!
lindquist
parents:
40
diff
changeset
|
22 assert(arr.length == 0); |
40 | 23 arr ~= s; |
86
fd32135dca3e
[svn r90] Major updates to the gen directory. Redesigned the 'elem' struct. Much more... !!!
lindquist
parents:
40
diff
changeset
|
24 assert(arr.length == 1); |
40 | 25 arr ~= S(1,2.64,0xFFFF_FFFF_FFFF); |
86
fd32135dca3e
[svn r90] Major updates to the gen directory. Redesigned the 'elem' struct. Much more... !!!
lindquist
parents:
40
diff
changeset
|
26 assert(arr.length == 2); |
fd32135dca3e
[svn r90] Major updates to the gen directory. Redesigned the 'elem' struct. Much more... !!!
lindquist
parents:
40
diff
changeset
|
27 arr[0].print(); |
fd32135dca3e
[svn r90] Major updates to the gen directory. Redesigned the 'elem' struct. Much more... !!!
lindquist
parents:
40
diff
changeset
|
28 arr[1].print(); |
40 | 29 assert(arr[1].i == 1); |
30 assert(arr[1].f > 2.63 && arr[1].f < 2.65); | |
31 assert(arr[1].l == 0xFFFF_FFFF_FFFF); | |
32 } |