Mercurial > projects > dstress
comparison run/mini/scope5.d @ 1628:c6ef09dfba4d
add mini test set from ldc project
author | Moritz Warning <moritzwarning@web.de> |
---|---|
date | Mon, 10 Jan 2011 19:47:18 +0100 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
1627:e1b954780837 | 1628:c6ef09dfba4d |
---|---|
1 module scope5; | |
2 | |
3 int i; | |
4 | |
5 void func(int a, int b) | |
6 { | |
7 i = 0; | |
8 { | |
9 scope(exit) i++; | |
10 if (a) { | |
11 scope(exit) i++; | |
12 if (b) return; | |
13 i++; | |
14 } | |
15 } | |
16 i++; | |
17 } | |
18 | |
19 void main() | |
20 { | |
21 func(0,0); | |
22 assert(i == 2); | |
23 func(1,1); | |
24 assert(i == 2); | |
25 func(1,0); | |
26 assert(i == 4); | |
27 } |