annotate run/constructor_09.d @ 1576:b3e16c86558e

[Issue 1398] New: GDC doesn't generate correct code <mariusmuja@gmail.com> 2007-08-04 http://d.puremagic.com/issues/show_bug.cgi?id=1398
author thomask
date Thu, 21 Feb 2008 15:20:08 +0000
parents 1f6cf5ccfbc9
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
338
1f6cf5ccfbc9 1) updated rules to dmd-0.119
thomask
parents:
diff changeset
1 // $HeadURL$
1f6cf5ccfbc9 1) updated rules to dmd-0.119
thomask
parents:
diff changeset
2 // $Date$
1f6cf5ccfbc9 1) updated rules to dmd-0.119
thomask
parents:
diff changeset
3 // $Author$
1f6cf5ccfbc9 1) updated rules to dmd-0.119
thomask
parents:
diff changeset
4
1f6cf5ccfbc9 1) updated rules to dmd-0.119
thomask
parents:
diff changeset
5 // Static constructors within a module are executed in the lexical order in which they appear.
1f6cf5ccfbc9 1) updated rules to dmd-0.119
thomask
parents:
diff changeset
6
1f6cf5ccfbc9 1) updated rules to dmd-0.119
thomask
parents:
diff changeset
7 module dstress.run.constructor_09;
1f6cf5ccfbc9 1) updated rules to dmd-0.119
thomask
parents:
diff changeset
8
1f6cf5ccfbc9 1) updated rules to dmd-0.119
thomask
parents:
diff changeset
9 bool init;
1f6cf5ccfbc9 1) updated rules to dmd-0.119
thomask
parents:
diff changeset
10 bool initA;
1f6cf5ccfbc9 1) updated rules to dmd-0.119
thomask
parents:
diff changeset
11 bool initB;
1f6cf5ccfbc9 1) updated rules to dmd-0.119
thomask
parents:
diff changeset
12
1f6cf5ccfbc9 1) updated rules to dmd-0.119
thomask
parents:
diff changeset
13 static this(){
1f6cf5ccfbc9 1) updated rules to dmd-0.119
thomask
parents:
diff changeset
14 assert(!init);
1f6cf5ccfbc9 1) updated rules to dmd-0.119
thomask
parents:
diff changeset
15 assert(!initA);
1f6cf5ccfbc9 1) updated rules to dmd-0.119
thomask
parents:
diff changeset
16 assert(!initB);
1f6cf5ccfbc9 1) updated rules to dmd-0.119
thomask
parents:
diff changeset
17 init=true;
1f6cf5ccfbc9 1) updated rules to dmd-0.119
thomask
parents:
diff changeset
18 }
1f6cf5ccfbc9 1) updated rules to dmd-0.119
thomask
parents:
diff changeset
19
1f6cf5ccfbc9 1) updated rules to dmd-0.119
thomask
parents:
diff changeset
20 class A{
1f6cf5ccfbc9 1) updated rules to dmd-0.119
thomask
parents:
diff changeset
21 static this(){
1f6cf5ccfbc9 1) updated rules to dmd-0.119
thomask
parents:
diff changeset
22 assert(init);
1f6cf5ccfbc9 1) updated rules to dmd-0.119
thomask
parents:
diff changeset
23 assert(!initA);
1f6cf5ccfbc9 1) updated rules to dmd-0.119
thomask
parents:
diff changeset
24 assert(!initB);
1f6cf5ccfbc9 1) updated rules to dmd-0.119
thomask
parents:
diff changeset
25 initA=true;
1f6cf5ccfbc9 1) updated rules to dmd-0.119
thomask
parents:
diff changeset
26 }
1f6cf5ccfbc9 1) updated rules to dmd-0.119
thomask
parents:
diff changeset
27 }
1f6cf5ccfbc9 1) updated rules to dmd-0.119
thomask
parents:
diff changeset
28
1f6cf5ccfbc9 1) updated rules to dmd-0.119
thomask
parents:
diff changeset
29 class B{
1f6cf5ccfbc9 1) updated rules to dmd-0.119
thomask
parents:
diff changeset
30 static this(){
1f6cf5ccfbc9 1) updated rules to dmd-0.119
thomask
parents:
diff changeset
31 assert(init);
1f6cf5ccfbc9 1) updated rules to dmd-0.119
thomask
parents:
diff changeset
32 assert(initA);
1f6cf5ccfbc9 1) updated rules to dmd-0.119
thomask
parents:
diff changeset
33 assert(!initB);
1f6cf5ccfbc9 1) updated rules to dmd-0.119
thomask
parents:
diff changeset
34 initB=true;
1f6cf5ccfbc9 1) updated rules to dmd-0.119
thomask
parents:
diff changeset
35 }
1f6cf5ccfbc9 1) updated rules to dmd-0.119
thomask
parents:
diff changeset
36 }
1f6cf5ccfbc9 1) updated rules to dmd-0.119
thomask
parents:
diff changeset
37
1f6cf5ccfbc9 1) updated rules to dmd-0.119
thomask
parents:
diff changeset
38 int main(){
1f6cf5ccfbc9 1) updated rules to dmd-0.119
thomask
parents:
diff changeset
39 assert(init);
1f6cf5ccfbc9 1) updated rules to dmd-0.119
thomask
parents:
diff changeset
40 assert(initA);
1f6cf5ccfbc9 1) updated rules to dmd-0.119
thomask
parents:
diff changeset
41 assert(initB);
1f6cf5ccfbc9 1) updated rules to dmd-0.119
thomask
parents:
diff changeset
42 return 0;
1f6cf5ccfbc9 1) updated rules to dmd-0.119
thomask
parents:
diff changeset
43 }