Mercurial > projects > dstress
changeset 556:5cfc11e8cfce
-inline calling wrong virtual function
Vathix <vathix@dprogramming.com>
2005-05-22
news:op.sq4gt8ddkcck4r@esi
author | thomask |
---|---|
date | Wed, 01 Jun 2005 11:58:48 +0000 |
parents | 1300c1aab744 |
children | 1c17ba0ad3cd |
files | run/i/inline_10_A.d run/i/inline_10_B.d run/i/inline_10_C.d |
diffstat | 3 files changed, 112 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/run/i/inline_10_A.d Wed Jun 01 11:58:48 2005 +0000 @@ -0,0 +1,36 @@ +// $HeadURL$ +// $Date$ +// $Author$ + +// @author@ Vathix <vathix@dprogramming.com> +// @date@ 2005-05-22 +// @uri@ news:op.sq4gt8ddkcck4r@esi +// @desc@ -inline calling wrong virtual function + +module dstress.run.i.inline_10_A; + +class Base{ + int test(){ + return 1; + } +} + +class Derived : Base{ + int test(){ + return 2; + } + + package int baseTest(){ + return super.test(); + } +} + +int main(){ + Base b = new Base(); + assert(b.test()==1); + + Derived f = new Derived(); + assert(f.test()==2); + assert(f.baseTest()==1); + return 0; +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/run/i/inline_10_B.d Wed Jun 01 11:58:48 2005 +0000 @@ -0,0 +1,38 @@ +// $HeadURL$ +// $Date$ +// $Author$ + +// @author@ Vathix <vathix@dprogramming.com> +// @date@ 2005-05-22 +// @uri@ news:op.sq4gt8ddkcck4r@esi +// @desc@ -inline calling wrong virtual function + +// __DSTRESS_DFLAGS__ -inline + +module dstress.run.i.inline_10_B; + +class Base{ + int test(){ + return 1; + } +} + +class Derived : Base{ + int test(){ + return 2; + } + + package int baseTest(){ + return super.test(); + } +} + +int main(){ + Base b = new Base(); + assert(b.test()==1); + + Derived f = new Derived(); + assert(f.test()==2); + assert(f.baseTest()==1); + return 0; +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/run/i/inline_10_C.d Wed Jun 01 11:58:48 2005 +0000 @@ -0,0 +1,38 @@ +// $HeadURL$ +// $Date$ +// $Author$ + +// @author@ Vathix <vathix@dprogramming.com> +// @date@ 2005-05-22 +// @uri@ news:op.sq4gt8ddkcck4r@esi +// @desc@ -inline calling wrong virtual function + +// __DSTRESS_DFLAGS__ -inline + +module dstress.run.i.inline_10_C; + +class Base{ + int test(){ + return 1; + } +} + +class Derived : Base{ + int test(){ + return 2; + } + + int baseTest(){ + return super.test(); + } +} + +int main(){ + Base b = new Base(); + assert(b.test()==1); + + Derived f = new Derived(); + assert(f.test()==2); + assert(f.baseTest()==1); + return 0; +}