Mercurial > projects > dstress
changeset 1462:4bf2a846ddf2
[Issue 850] we need (*type).property to refer to property if we use typedef
davidl <david@126.com>
2007-01-14
http://d.puremagic.com/issues/show_bug.cgi?id=850
author | thomask |
---|---|
date | Thu, 05 Apr 2007 10:29:26 +0000 |
parents | 030ce9dfefeb |
children | a88dcaf5c0d0 |
files | run/t/typedef_23_A.d run/t/typedef_23_B.d run/t/typedef_23_C.d run/t/typedef_23_D.d |
diffstat | 4 files changed, 122 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/run/t/typedef_23_A.d Thu Apr 05 10:29:26 2007 +0000 @@ -0,0 +1,29 @@ +// $HeadURL$ +// $Date$ +// $Author$ + +// @author@ davidl <david@126.com> +// @date@ 2007-01-14 +// @uri@ http://d.puremagic.com/issues/show_bug.cgi?id=850 +// @desc@ [Issue 850] we need (*type).property to refer to property if we use typedef + +module dstress.run.t.typedef_23_A; + +class C{ + int myMember; +} + +void foo(C* x){ + x.myMember = 0xDEAD_DEED; +} + +int main(){ + C c = new C(); + foo(&c); + + if(0xDEAD_DEED != c.myMember){ + assert(0); + } + + return 0; +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/run/t/typedef_23_B.d Thu Apr 05 10:29:26 2007 +0000 @@ -0,0 +1,31 @@ +// $HeadURL$ +// $Date$ +// $Author$ + +// @author@ davidl <david@126.com> +// @date@ 2007-01-14 +// @uri@ http://d.puremagic.com/issues/show_bug.cgi?id=850 +// @desc@ [Issue 850] we need (*type).property to refer to property if we use typedef + +module dstress.run.t.typedef_23_B; + +class C{ + int myMember; +} + +alias C* X; + +void foo(X x){ + x.myMember = 0xDEAD_DEED; +} + +int main(){ + C c = new C(); + foo(&c); + + if(0xDEAD_DEED != c.myMember){ + assert(0); + } + + return 0; +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/run/t/typedef_23_C.d Thu Apr 05 10:29:26 2007 +0000 @@ -0,0 +1,31 @@ +// $HeadURL$ +// $Date$ +// $Author$ + +// @author@ davidl <david@126.com> +// @date@ 2007-01-14 +// @uri@ http://d.puremagic.com/issues/show_bug.cgi?id=850 +// @desc@ [Issue 850] we need (*type).property to refer to property if we use typedef + +module dstress.run.t.typedef_23_C; + +class C{ + int myMember; +} + +typedef C* X; + +void foo(X x){ + x.myMember = 0xDEAD_DEED; +} + +int main(){ + C c = new C(); + foo(cast(X) &c); + + if(0xDEAD_DEED != c.myMember){ + assert(0); + } + + return 0; +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/run/t/typedef_23_D.d Thu Apr 05 10:29:26 2007 +0000 @@ -0,0 +1,31 @@ +// $HeadURL$ +// $Date$ +// $Author$ + +// @author@ davidl <david@126.com> +// @date@ 2007-01-14 +// @uri@ http://d.puremagic.com/issues/show_bug.cgi?id=850 +// @desc@ [Issue 850] we need (*type).property to refer to property if we use typedef + +module dstress.run.t.typedef_23_D; + +class C{ + int myMember; +} + +typedef C* X; + +void foo(X x){ + (*x).myMember = 0xDEAD_DEED; +} + +int main(){ + C c = new C(); + foo(cast(X) &c); + + if(0xDEAD_DEED != c.myMember){ + assert(0); + } + + return 0; +}