Mercurial > projects > dstress
changeset 942:00517392e540
<jarrett.billingsley@gmail.com>
2006-04-02
news:bug-80-3@http.d.puremagic.com/bugzilla/
author | thomask |
---|---|
date | Sun, 02 Apr 2006 11:53:35 +0000 |
parents | 60f9aece9c62 |
children | 807744a6e42b |
files | run/n/nested_class_04_A.d run/n/nested_class_04_B.d run/n/nested_class_04_C.d run/n/nested_class_04_D.d |
diffstat | 4 files changed, 172 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/run/n/nested_class_04_A.d Sun Apr 02 11:53:35 2006 +0000 @@ -0,0 +1,38 @@ +// $HeadURL$ +// $Date$ +// $Author$ + +// @author@ <jarrett.billingsley@gmail.com> +// @date@ 2006-04-02 +// @uri@ news:bug-80-3@http.d.puremagic.com/bugzilla/ + +module dstress.run.n.nested_class_04_A; + +class Outer{ + int i; + + class Inner{ + int x; + + this(){ + x = i; + } + } + + Inner test(){ + return new Inner(); + } +} + +int main(){ + Outer outer = new Outer(); + outer.i = 1; + Outer.Inner inner = outer.test(); + outer.i = 2; + + if(inner.x != 1){ + assert(0); + } + + return 0; +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/run/n/nested_class_04_B.d Sun Apr 02 11:53:35 2006 +0000 @@ -0,0 +1,46 @@ +// $HeadURL$ +// $Date$ +// $Author$ + +// @author@ <jarrett.billingsley@gmail.com> +// @date@ 2006-04-02 +// @uri@ news:bug-80-3@http.d.puremagic.com/bugzilla/ + +module dstress.run.n.nested_class_04_B; + +class Outer{ + int i; + + class Inner{ + int x; + + this(){ + x = i; + } + } + + Inner test(){ + Inner o; + + void bug(){ + o = new Inner(); + } + + bug(); + + return o; + } +} + +int main(){ + Outer outer = new Outer(); + outer.i = 1; + Outer.Inner inner = outer.test(); + outer.i = 2; + + if(inner.x != 1){ + assert(0); + } + + return 0; +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/run/n/nested_class_04_C.d Sun Apr 02 11:53:35 2006 +0000 @@ -0,0 +1,46 @@ +// $HeadURL$ +// $Date$ +// $Author$ + +// @author@ <jarrett.billingsley@gmail.com> +// @date@ 2006-04-02 +// @uri@ news:bug-80-3@http.d.puremagic.com/bugzilla/ + +module dstress.run.n.nested_class_04_C; + +struct Outer{ + int i; + + class Inner{ + int x; + + this(){ + x = i; + } + } + + Inner test(){ + Inner o; + + void bug(){ + o = new Inner(); + } + + bug(); + + return o; + } +} + +int main(){ + Outer* outer = new Outer(); + outer.i = 1; + Outer.Inner inner = outer.test(); + outer.i = 2; + + if(inner.x != 1){ + assert(0); + } + + return 0; +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/run/n/nested_class_04_D.d Sun Apr 02 11:53:35 2006 +0000 @@ -0,0 +1,42 @@ +// $HeadURL$ +// $Date$ +// $Author$ + +// @author@ <jarrett.billingsley@gmail.com> +// @date@ 2006-04-02 +// @uri@ news:bug-80-3@http.d.puremagic.com/bugzilla/ + +module dstress.run.n.nested_class_04_D; + +struct Outer{ + int i; + + class Inner{ + int x; + + this(){ + x = i; + } + } + + Inner test(){ + Inner o; + + o = new Inner(); + + return o; + } +} + +int main(){ + Outer* outer = new Outer(); + outer.i = 1; + Outer.Inner inner = outer.test(); + outer.i = 2; + + if(inner.x != 1){ + assert(0); + } + + return 0; +}