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_C;
|
|
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
|
1090
|
24 if(counter != 0){
|
|
25 assert(0);
|
|
26 }
|
|
27
|
593
|
28 foreach(char[] s, int i; bb){
|
|
29 dummy();
|
|
30 }
|
|
31
|
1090
|
32 if(counter != 1){
|
|
33 assert(0);
|
|
34 }
|
593
|
35
|
|
36 bb["a"] = 1;
|
|
37
|
|
38 foreach(int b; bb){
|
|
39 try{
|
|
40 throw new Error("foo");
|
|
41 }catch(Error e){
|
1090
|
42 if(!e){
|
|
43 assert(0);
|
|
44 }
|
|
45 if(counter != 1){
|
|
46 assert(0);
|
|
47 }
|
593
|
48 return 0;
|
|
49 }catch{
|
|
50 assert(0);
|
|
51 }
|
|
52 assert(0);
|
|
53 }
|
|
54
|
|
55 assert(0);
|
|
56 }
|