Mercurial > projects > dstress
changeset 1512:b171e38c078b
[Issue 1135] invariant keyword parsing is messed up
<torhu@yahoo.com>
2007-04-12
http://d.puremagic.com/issues/show_bug.cgi?id=1135
author | thomask |
---|---|
date | Mon, 23 Apr 2007 18:08:57 +0000 |
parents | fcafb2c9da5f |
children | 45c339264b57 |
files | run/i/invariant_33_A.d run/i/invariant_33_B.d |
diffstat | 2 files changed, 70 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/run/i/invariant_33_A.d Mon Apr 23 18:08:57 2007 +0000 @@ -0,0 +1,44 @@ +// $HeadURL$ +// $Date$ +// $Author$ + +// @author@ <torhu@yahoo.com> +// @date@ 2007-04-12 +// @uri@ http://d.puremagic.com/issues/show_bug.cgi?id=1135 +// @desc@ [Issue 1135] invariant keyword parsing is messed up + +// __DSTRESS_TORTURE_BLOCK__ -release + +module dstress.run.i.invariant_33_A; + +int state; + +class X{ + synchronized invariant{ + int x; + state += ++x; + } + + void foo(){ + } +} + +int main(){ + X x = new X(); + + x.foo(); + if(2 != state){ + assert(0); + } + + x.foo(); + if(4 != state){ + assert(0); + } + + x.foo(); + if(6 != state){ + assert(0); + } + return 0; +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/run/i/invariant_33_B.d Mon Apr 23 18:08:57 2007 +0000 @@ -0,0 +1,26 @@ +// $HeadURL$ +// $Date$ +// $Author$ + +// @author@ <torhu@yahoo.com> +// @date@ 2007-04-12 +// @uri@ http://d.puremagic.com/issues/show_bug.cgi?id=1135 +// @desc@ [Issue 1135] invariant keyword parsing is messed up + +module dstress.run.i.invariant_33_B; + +struct X{ + synchronized invariant{ + int x; + } + + void foo(){ + } +} + +int main(){ + X x; + + x.foo(); + return 0; +}