593
|
1 // $HeadURL$
|
|
2 // $Date$
|
|
3 // $Author$
|
|
4
|
|
5 // @author@ Nick <Nick_member@pathlink.com>
|
|
6 // @date@ 2005-06-21
|
1489
|
7 // @uri@ http://www.digitalmars.com/pnews/read.php?server=news.digitalmars.com&group=digitalmars.D.bugs&artnum=4383
|
593
|
8 // @desc@ foreach and throw/catch code generation
|
|
9
|
|
10 module dstress.run.c.catch_05_D;
|
|
11
|
|
12 int counter;
|
|
13
|
|
14 void dummy(){
|
|
15 counter++;
|
|
16 }
|
|
17
|
|
18 int bb[char[]];
|
|
19
|
|
20 int main(){
|
|
21
|
|
22 bb["zwei"] = 2;
|
|
23
|
|
24 assert(counter==0);
|
1090
|
25
|
593
|
26 foreach(int i; bb){
|
|
27 dummy();
|
|
28 }
|
|
29
|
|
30 assert(counter==1);
|
|
31
|
|
32 bb["a"] = 1;
|
|
33
|
|
34 foreach(int b; bb){
|
|
35 try{
|
|
36 throw new Error("foo");
|
|
37 }catch(Error e){
|
|
38 assert(e);
|
|
39 assert(counter==1);
|
|
40 return 0;
|
|
41 }catch{
|
|
42 assert(0);
|
|
43 }
|
|
44 assert(0);
|
|
45 }
|
|
46
|
|
47 assert(0);
|
|
48 }
|