Mercurial > projects > dstress
comparison run/l/lazy_03_D.d @ 1451:623963e374c5
[Issue 1088] structs allocated with a struct allocator will not have default initializer values assigned
Mark Guidarelli <guido@grumpy-cat.com>
2007-03-31
http://d.puremagic.com/issues/show_bug.cgi?id=1088
author | thomask |
---|---|
date | Wed, 04 Apr 2007 20:34:04 +0000 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
1450:2322c29c00be | 1451:623963e374c5 |
---|---|
1 // $HeadURL$ | |
2 // $Date$ | |
3 // $Author$ | |
4 | |
5 // @author@ Mark Guidarelli <guido@grumpy-cat.com> | |
6 // @date@ 2007-03-31 | |
7 // @uri@ http://d.puremagic.com/issues/show_bug.cgi?id=1088 | |
8 // @desc@ [Issue 1088] structs allocated with a struct allocator will not have default initializer values assigned | |
9 | |
10 module dstress.run.l.lazy_03_D; | |
11 | |
12 import std.stdarg; | |
13 | |
14 int step; | |
15 int[] master = [0x12_34_56_78, 0x12_34_56_78, 0xAB_CD_EF_00, 0xAB_CD_EF_00]; | |
16 | |
17 void test(...){ | |
18 if(1 != _arguments.length){ | |
19 assert(0); | |
20 } | |
21 if(typeid(int) != _arguments[0]){ | |
22 assert(0); | |
23 } | |
24 int i = va_arg!(int)(_argptr); | |
25 if(master[step] != i){ | |
26 assert(0); | |
27 } | |
28 step++; | |
29 } | |
30 | |
31 int foo() { | |
32 test(0x12_34_56_78); | |
33 return 0xAB_CD_EF_00; | |
34 } | |
35 | |
36 void bar(lazy int[] bla) { | |
37 foreach (elem; bla){ | |
38 test(elem); | |
39 } | |
40 } | |
41 | |
42 int main() { | |
43 bar([foo(), foo()]); | |
44 if(step != master.length){ | |
45 assert(0); | |
46 } | |
47 return 0; | |
48 } |