annotate run/t/throw_07_A.d @ 1025:8516fcb66401

Exception handling is broken for delegates on Linux <mclysenk@mtu.edu> 2006-05-11 news:e3u2au$2l0c$1@digitaldaemon.com
author thomask
date Wed, 24 May 2006 16:23:57 +0000
parents
children b8c0195059d9
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
1025
8516fcb66401 Exception handling is broken for delegates on Linux
thomask
parents:
diff changeset
1 // $HeadURL$
8516fcb66401 Exception handling is broken for delegates on Linux
thomask
parents:
diff changeset
2 // $Date$
8516fcb66401 Exception handling is broken for delegates on Linux
thomask
parents:
diff changeset
3 // $Author$
8516fcb66401 Exception handling is broken for delegates on Linux
thomask
parents:
diff changeset
4
8516fcb66401 Exception handling is broken for delegates on Linux
thomask
parents:
diff changeset
5 // @author@ <mclysenk@mtu.edu>
8516fcb66401 Exception handling is broken for delegates on Linux
thomask
parents:
diff changeset
6 // @date@ 2006-05-11
8516fcb66401 Exception handling is broken for delegates on Linux
thomask
parents:
diff changeset
7 // @uri@ news:e3u2au$2l0c$1@digitaldaemon.com
8516fcb66401 Exception handling is broken for delegates on Linux
thomask
parents:
diff changeset
8
8516fcb66401 Exception handling is broken for delegates on Linux
thomask
parents:
diff changeset
9 module dstress.run.t.throw_07_C;
8516fcb66401 Exception handling is broken for delegates on Linux
thomask
parents:
diff changeset
10
8516fcb66401 Exception handling is broken for delegates on Linux
thomask
parents:
diff changeset
11 int status;
8516fcb66401 Exception handling is broken for delegates on Linux
thomask
parents:
diff changeset
12
8516fcb66401 Exception handling is broken for delegates on Linux
thomask
parents:
diff changeset
13 class XException : Exception{
8516fcb66401 Exception handling is broken for delegates on Linux
thomask
parents:
diff changeset
14 this(char[] msg){
8516fcb66401 Exception handling is broken for delegates on Linux
thomask
parents:
diff changeset
15 super(msg);
8516fcb66401 Exception handling is broken for delegates on Linux
thomask
parents:
diff changeset
16 }
8516fcb66401 Exception handling is broken for delegates on Linux
thomask
parents:
diff changeset
17 }
8516fcb66401 Exception handling is broken for delegates on Linux
thomask
parents:
diff changeset
18
8516fcb66401 Exception handling is broken for delegates on Linux
thomask
parents:
diff changeset
19 class Tester{
8516fcb66401 Exception handling is broken for delegates on Linux
thomask
parents:
diff changeset
20 this(void delegate() dg_){
8516fcb66401 Exception handling is broken for delegates on Linux
thomask
parents:
diff changeset
21 if(status++ != 0){
8516fcb66401 Exception handling is broken for delegates on Linux
thomask
parents:
diff changeset
22 assert(0);
8516fcb66401 Exception handling is broken for delegates on Linux
thomask
parents:
diff changeset
23 }
8516fcb66401 Exception handling is broken for delegates on Linux
thomask
parents:
diff changeset
24 dg = dg_;
8516fcb66401 Exception handling is broken for delegates on Linux
thomask
parents:
diff changeset
25 }
8516fcb66401 Exception handling is broken for delegates on Linux
thomask
parents:
diff changeset
26
8516fcb66401 Exception handling is broken for delegates on Linux
thomask
parents:
diff changeset
27 void delegate() dg;
8516fcb66401 Exception handling is broken for delegates on Linux
thomask
parents:
diff changeset
28
8516fcb66401 Exception handling is broken for delegates on Linux
thomask
parents:
diff changeset
29 void test() {
8516fcb66401 Exception handling is broken for delegates on Linux
thomask
parents:
diff changeset
30 if(status++ != 1){
8516fcb66401 Exception handling is broken for delegates on Linux
thomask
parents:
diff changeset
31 assert(0);
8516fcb66401 Exception handling is broken for delegates on Linux
thomask
parents:
diff changeset
32 }
8516fcb66401 Exception handling is broken for delegates on Linux
thomask
parents:
diff changeset
33 dg();
8516fcb66401 Exception handling is broken for delegates on Linux
thomask
parents:
diff changeset
34
8516fcb66401 Exception handling is broken for delegates on Linux
thomask
parents:
diff changeset
35 assert(0);
8516fcb66401 Exception handling is broken for delegates on Linux
thomask
parents:
diff changeset
36 }
8516fcb66401 Exception handling is broken for delegates on Linux
thomask
parents:
diff changeset
37 }
8516fcb66401 Exception handling is broken for delegates on Linux
thomask
parents:
diff changeset
38
8516fcb66401 Exception handling is broken for delegates on Linux
thomask
parents:
diff changeset
39 int main(){
8516fcb66401 Exception handling is broken for delegates on Linux
thomask
parents:
diff changeset
40 void foo(){
8516fcb66401 Exception handling is broken for delegates on Linux
thomask
parents:
diff changeset
41 try{
8516fcb66401 Exception handling is broken for delegates on Linux
thomask
parents:
diff changeset
42 if(status++ != 2){
8516fcb66401 Exception handling is broken for delegates on Linux
thomask
parents:
diff changeset
43 assert(0);
8516fcb66401 Exception handling is broken for delegates on Linux
thomask
parents:
diff changeset
44 }
8516fcb66401 Exception handling is broken for delegates on Linux
thomask
parents:
diff changeset
45 throw new XException("test2");
8516fcb66401 Exception handling is broken for delegates on Linux
thomask
parents:
diff changeset
46
8516fcb66401 Exception handling is broken for delegates on Linux
thomask
parents:
diff changeset
47 assert(0);
8516fcb66401 Exception handling is broken for delegates on Linux
thomask
parents:
diff changeset
48 }catch(XException e){
8516fcb66401 Exception handling is broken for delegates on Linux
thomask
parents:
diff changeset
49 if(status++ != 3){
8516fcb66401 Exception handling is broken for delegates on Linux
thomask
parents:
diff changeset
50 assert(0);
8516fcb66401 Exception handling is broken for delegates on Linux
thomask
parents:
diff changeset
51 }
8516fcb66401 Exception handling is broken for delegates on Linux
thomask
parents:
diff changeset
52 throw e;
8516fcb66401 Exception handling is broken for delegates on Linux
thomask
parents:
diff changeset
53 assert(0);
8516fcb66401 Exception handling is broken for delegates on Linux
thomask
parents:
diff changeset
54 }finally{
8516fcb66401 Exception handling is broken for delegates on Linux
thomask
parents:
diff changeset
55 if(status++ != 4){
8516fcb66401 Exception handling is broken for delegates on Linux
thomask
parents:
diff changeset
56 assert(0);
8516fcb66401 Exception handling is broken for delegates on Linux
thomask
parents:
diff changeset
57 }
8516fcb66401 Exception handling is broken for delegates on Linux
thomask
parents:
diff changeset
58 }
8516fcb66401 Exception handling is broken for delegates on Linux
thomask
parents:
diff changeset
59 assert(0);
8516fcb66401 Exception handling is broken for delegates on Linux
thomask
parents:
diff changeset
60 }
8516fcb66401 Exception handling is broken for delegates on Linux
thomask
parents:
diff changeset
61
8516fcb66401 Exception handling is broken for delegates on Linux
thomask
parents:
diff changeset
62 Tester t = new Tester(&foo);
8516fcb66401 Exception handling is broken for delegates on Linux
thomask
parents:
diff changeset
63
8516fcb66401 Exception handling is broken for delegates on Linux
thomask
parents:
diff changeset
64 try{
8516fcb66401 Exception handling is broken for delegates on Linux
thomask
parents:
diff changeset
65 if(status++ != 5){
8516fcb66401 Exception handling is broken for delegates on Linux
thomask
parents:
diff changeset
66 assert(0);
8516fcb66401 Exception handling is broken for delegates on Linux
thomask
parents:
diff changeset
67 }
8516fcb66401 Exception handling is broken for delegates on Linux
thomask
parents:
diff changeset
68 t.test();
8516fcb66401 Exception handling is broken for delegates on Linux
thomask
parents:
diff changeset
69 assert(0);
8516fcb66401 Exception handling is broken for delegates on Linux
thomask
parents:
diff changeset
70 }catch(XException e){
8516fcb66401 Exception handling is broken for delegates on Linux
thomask
parents:
diff changeset
71 if(status++ != 6){
8516fcb66401 Exception handling is broken for delegates on Linux
thomask
parents:
diff changeset
72 assert(0);
8516fcb66401 Exception handling is broken for delegates on Linux
thomask
parents:
diff changeset
73 }
8516fcb66401 Exception handling is broken for delegates on Linux
thomask
parents:
diff changeset
74 }finally{
8516fcb66401 Exception handling is broken for delegates on Linux
thomask
parents:
diff changeset
75 if(status++ != 7){
8516fcb66401 Exception handling is broken for delegates on Linux
thomask
parents:
diff changeset
76 assert(0);
8516fcb66401 Exception handling is broken for delegates on Linux
thomask
parents:
diff changeset
77 }
8516fcb66401 Exception handling is broken for delegates on Linux
thomask
parents:
diff changeset
78 }
8516fcb66401 Exception handling is broken for delegates on Linux
thomask
parents:
diff changeset
79
8516fcb66401 Exception handling is broken for delegates on Linux
thomask
parents:
diff changeset
80 if(status != 8){
8516fcb66401 Exception handling is broken for delegates on Linux
thomask
parents:
diff changeset
81 assert(0);
8516fcb66401 Exception handling is broken for delegates on Linux
thomask
parents:
diff changeset
82 }
8516fcb66401 Exception handling is broken for delegates on Linux
thomask
parents:
diff changeset
83 return 0;
8516fcb66401 Exception handling is broken for delegates on Linux
thomask
parents:
diff changeset
84 }