360
|
1 // $HeadURL$
|
|
2 // $Date$
|
|
3 // $Author$
|
|
4
|
736
|
5 // __DSTRESS_TORTURE_BLOCK__ -release
|
|
6
|
59
|
7 module dstress.run.invariant_12.d;
|
|
8
|
360
|
9 bool checked;
|
|
10
|
59
|
11 class Parent{
|
|
12 int x;
|
|
13
|
|
14 void test(){
|
|
15 }
|
|
16
|
1559
|
17 invariant(){
|
|
18 if(checked){
|
|
19 assert(0);
|
|
20 }
|
360
|
21 checked=true;
|
59
|
22 // even number
|
1559
|
23 if(x & 1u){
|
|
24 assert(0);
|
|
25 }
|
59
|
26 }
|
|
27 }
|
|
28
|
|
29 class Child : Parent{
|
|
30 }
|
|
31
|
|
32 class GrandChild : Child{
|
|
33 this(){
|
|
34 x=5;
|
|
35 }
|
|
36 }
|
|
37
|
|
38 int main(){
|
|
39 try{
|
1559
|
40 if(checked){
|
|
41 assert(0);
|
|
42 }
|
59
|
43 GrandChild gc = new GrandChild();
|
|
44 }catch{
|
1559
|
45 if(!checked){
|
|
46 assert(0);
|
|
47 }
|
59
|
48 return 0;
|
|
49 }
|
|
50 assert(0);
|
|
51 }
|