Mercurial > projects > dstress
changeset 1491:c1943ae1abbf
[Issue 789] const initialization in forwarding constructors doesn't work
Vladimir <thecybershadow@gmail.com>
2007-01-03
http://d.puremagic.com/issues/show_bug.cgi?id=789
author | thomask |
---|---|
date | Mon, 23 Apr 2007 17:52:03 +0000 |
parents | 8732ccec11b2 |
children | 1327a7ff1be6 |
files | run/c/const_47_A.d run/c/const_47_B.d |
diffstat | 2 files changed, 62 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/run/c/const_47_A.d Mon Apr 23 17:52:03 2007 +0000 @@ -0,0 +1,30 @@ +// $HeadURL$ +// $Date$ +// $Author$ + +// @author@ Vladimir <thecybershadow@gmail.com> +// @date@ 2007-01-03 +// @uri@ http://d.puremagic.com/issues/show_bug.cgi?id=789 +// @desc@ [Issue 789] const initialization in forwarding constructors doesn't work + +module dstress.run.c.const_47_A; + +class C{ + const int a; + + this(){ + a = 3; + } + + this(int x){ + this(); + } +} + +int main(){ + C c = new C(2); + if(3 != c.a){ + assert(0); + } + return 0; +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/run/c/const_47_B.d Mon Apr 23 17:52:03 2007 +0000 @@ -0,0 +1,32 @@ +// $HeadURL$ +// $Date$ +// $Author$ + +// @author@ Vladimir <thecybershadow@gmail.com> +// @date@ 2007-01-03 +// @uri@ http://d.puremagic.com/issues/show_bug.cgi?id=789 +// @desc@ [Issue 789] const initialization in forwarding constructors doesn't work + +module dstress.run.c.const_47_B; + +class C{ + const int a; + + this(){ + a = 3; + } +} + +class D : C { + this(int x){ + super(); + } +} + +int main(){ + D d = new D(2); + if(3 != d.a){ + assert(0); + } + return 0; +}