Mercurial > projects > dstress
changeset 1438:ca5b18e46ec7
r7386@birke: tk | 2007-03-29 15:38:42 +0200
[Issue 1055] union forward reference "overlapping initialization" error
Bill Baxter <wbaxter@gmail.com>
2007-03-12
http://d.puremagic.com/issues/show_bug.cgi?id=1055
author | thomask |
---|---|
date | Sat, 31 Mar 2007 08:25:16 +0000 |
parents | e489e020a55d |
children | ff8d07dc1454 |
files | run/f/forward_reference_20_A.d run/f/forward_reference_20_B.d run/f/forward_reference_20_C.d run/f/forward_reference_20_D.d |
diffstat | 4 files changed, 130 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/run/f/forward_reference_20_A.d Sat Mar 31 08:25:16 2007 +0000 @@ -0,0 +1,33 @@ +// $HeadURL$ +// $Date$ +// $Author$ + +// @author@ Bill Baxter <wbaxter@gmail.com> +// @date@ 2007-03-12 +// @uri@ http://d.puremagic.com/issues/show_bug.cgi?id=1055 +// @desc@ [Issue 1055] union forward reference "overlapping initialization" error + +module dstress.run.f.forward_reference_20_A; + + +struct Z { + int x = 0x9ABC_DEF0; + union { + S s; + } +} + +struct S{ + int y = 0x1234_5678; +} + +int main(){ + Z z; + if(0x9ABC_DEF0 != z.x){ + assert(0); + } + if(0x1234_5678 != z.s.y){ + assert(0); + } + return 0; +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/run/f/forward_reference_20_B.d Sat Mar 31 08:25:16 2007 +0000 @@ -0,0 +1,33 @@ +// $HeadURL$ +// $Date$ +// $Author$ + +// @author@ Bill Baxter <wbaxter@gmail.com> +// @date@ 2007-03-12 +// @uri@ http://d.puremagic.com/issues/show_bug.cgi?id=1055 +// @desc@ [Issue 1055] union forward reference "overlapping initialization" error + +module dstress.run.f.forward_reference_20_B; + + +struct Z { + union { + S s; + } + int x = 0x9ABC_DEF0; +} + +struct S{ + int y = 0x1234_5678; +} + +int main(){ + Z z; + if(0x9ABC_DEF0 != z.x){ + assert(0); + } + if(0x1234_5678 != z.s.y){ + assert(0); + } + return 0; +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/run/f/forward_reference_20_C.d Sat Mar 31 08:25:16 2007 +0000 @@ -0,0 +1,32 @@ +// $HeadURL$ +// $Date$ +// $Author$ + +// @author@ Bill Baxter <wbaxter@gmail.com> +// @date@ 2007-03-12 +// @uri@ http://d.puremagic.com/issues/show_bug.cgi?id=1055 +// @desc@ [Issue 1055] union forward reference "overlapping initialization" error + +module dstress.run.f.forward_reference_20_C; + +struct S{ + int y = 0x1234_5678; +} + +struct Z { + union { + S s; + } + int x = 0x9ABC_DEF0; +} + +int main(){ + Z z; + if(0x9ABC_DEF0 != z.x){ + assert(0); + } + if(0x1234_5678 != z.s.y){ + assert(0); + } + return 0; +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/run/f/forward_reference_20_D.d Sat Mar 31 08:25:16 2007 +0000 @@ -0,0 +1,32 @@ +// $HeadURL$ +// $Date$ +// $Author$ + +// @author@ Bill Baxter <wbaxter@gmail.com> +// @date@ 2007-03-12 +// @uri@ http://d.puremagic.com/issues/show_bug.cgi?id=1055 +// @desc@ [Issue 1055] union forward reference "overlapping initialization" error + +module dstress.run.f.forward_reference_20_D; + +struct S{ + int y = 0x1234_5678; +} + +struct Z { + int x = 0x9ABC_DEF0; + union { + S s; + } +} + +int main(){ + Z z; + if(0x9ABC_DEF0 != z.x){ + assert(0); + } + if(0x1234_5678 != z.s.y){ + assert(0); + } + return 0; +}