Mercurial > projects > dstress
changeset 137:3160d72a93a7
1) anonymous nested structs/unions
2) access to private nested class functions
Stewart Gordon <smjg_1998@yahoo.com>
news://cn9vah$1shn$1@digitaldaemon.com
nttp://digitalmars.com/digitalmars.D.bugs:2270
author | thomask |
---|---|
date | Mon, 15 Nov 2004 13:03:18 +0000 |
parents | 98c7b15cc09e |
children | c1b6e831a92a |
files | compile/struct_18.d compile/union_10.d run/private_02.d run/private_03.d |
diffstat | 4 files changed, 88 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/compile/struct_18.d Mon Nov 15 13:03:18 2004 +0000 @@ -0,0 +1,16 @@ +// $HeadURL$ +// $Date$ +// $Author$ + +// @author@ Stewart Gordon <smjg_1998@yahoo.com> +// @date@ 2004-11-15 +// @uri@ news://cn9vah$1shn$1@digitaldaemon.com +// @url@ nttp://digitalmars.com/digitalmars.D.bugs:2270 + +module dstress.compile.struct_18; + +class MyClass{ + struct { + int dummy=3; + } +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/compile/union_10.d Mon Nov 15 13:03:18 2004 +0000 @@ -0,0 +1,18 @@ +// $HeadURL$ +// $Date$ +// $Author$ + +// @author@ Stewart Gordon <smjg_1998@yahoo.com> +// @date@ 2004-11-15 +// @uri@ news://cn9vah$1shn$1@digitaldaemon.com +// @url@ nttp://digitalmars.com/digitalmars.D.bugs:2270 + +module dstress.compile.union_10; + +class MyClass{ + union { + int dummy=3; + byte b; + } + int i = 1; +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/run/private_02.d Mon Nov 15 13:03:18 2004 +0000 @@ -0,0 +1,28 @@ +// $HeadURL$ +// $Date$ +// $Author$ + +// @author@ Stewart Gordon <smjg_1998@yahoo.com> +// @date@ 2004-11-15 +// @uri@ news://cn9vah$1shn$1@digitaldaemon.com +// @url@ nttp://digitalmars.com/digitalmars.D.bugs:2270 + +module dstress.compile.private_02; + +class Outer{ + class Inner{ + private this(){ + } + + private int i=3; + } + + int test(){ + return new Inner().i; + } +} + +int main(){ + assert(new Outer().test()==3); + return 0; +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/run/private_03.d Mon Nov 15 13:03:18 2004 +0000 @@ -0,0 +1,26 @@ +// $HeadURL$ +// $Date$ +// $Author$ + +// @author@ Stewart Gordon <smjg_1998@yahoo.com> +// @date@ 2004-11-15 +// @uri@ news://cn9vah$1shn$1@digitaldaemon.com +// @url@ nttp://digitalmars.com/digitalmars.D.bugs:2270 + +module dstress.compile.private_03; + +class Outer{ + class Inner{ + private this(){ + } + + private int i=3; + } +} + +int main(){ + Outer outer = new Outer; + Outer.Inner inner = new outer.Inner(); + assert(inner.i==3); + return 0; +}