# HG changeset patch # User thomask # Date 1148487837 0 # Node ID 8516fcb6640123ed9ed53ec019cd5f2bcc9c61c7 # Parent adf31c7a5127026e816614ce96b41175865c9a7c Exception handling is broken for delegates on Linux 2006-05-11 news:e3u2au$2l0c$1@digitaldaemon.com diff -r adf31c7a5127 -r 8516fcb66401 run/t/throw_07_A.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/run/t/throw_07_A.d Wed May 24 16:23:57 2006 +0000 @@ -0,0 +1,84 @@ +// $HeadURL$ +// $Date$ +// $Author$ + +// @author@ +// @date@ 2006-05-11 +// @uri@ news:e3u2au$2l0c$1@digitaldaemon.com + +module dstress.run.t.throw_07_C; + +int status; + +class XException : Exception{ + this(char[] msg){ + super(msg); + } +} + +class Tester{ + this(void delegate() dg_){ + if(status++ != 0){ + assert(0); + } + dg = dg_; + } + + void delegate() dg; + + void test() { + if(status++ != 1){ + assert(0); + } + dg(); + + assert(0); + } +} + +int main(){ + void foo(){ + try{ + if(status++ != 2){ + assert(0); + } + throw new XException("test2"); + + assert(0); + }catch(XException e){ + if(status++ != 3){ + assert(0); + } + throw e; + assert(0); + }finally{ + if(status++ != 4){ + assert(0); + } + } + assert(0); + } + + Tester t = new Tester(&foo); + + try{ + if(status++ != 5){ + assert(0); + } + t.test(); + assert(0); + }catch(XException e){ + if(status++ != 6){ + assert(0); + } + }finally{ + if(status++ != 7){ + assert(0); + } + } + + if(status != 8){ + assert(0); + } + return 0; +} diff -r adf31c7a5127 -r 8516fcb66401 run/t/throw_07_B.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/run/t/throw_07_B.d Wed May 24 16:23:57 2006 +0000 @@ -0,0 +1,85 @@ +// $HeadURL$ +// $Date$ +// $Author$ + +// @author@ +// @date@ 2006-05-11 +// @uri@ news:e3u2au$2l0c$1@digitaldaemon.com + +module dstress.run.t.throw_07_B; + +int status; + +class XException : Exception{ + this(char[] msg){ + super(msg); + } +} + +class Tester{ + this(void function() dg_){ + if(status++ != 0){ + assert(0); + } + dg = dg_; + } + + void function() dg; + + void test() { + if(status++ != 1){ + assert(0); + } + dg(); + + assert(0); + } +} + +void foo(){ + try{ + if(status++ != 2){ + assert(0); + } + throw new XException("test2"); + + assert(0); + }catch(XException e){ + if(status++ != 3){ + assert(0); + } + throw e; + assert(0); + }finally{ + if(status++ != 4){ + assert(0); + } + } + assert(0); +} + +int main(){ + + Tester t = new Tester(&foo); + + try{ + if(status++ != 5){ + assert(0); + } + t.test(); + assert(0); + }catch(XException e){ + if(status++ != 6){ + assert(0); + } + }finally{ + if(status++ != 7){ + assert(0); + } + } + + if(status != 8){ + assert(0); + } + return 0; +}