Mercurial > projects > dstress
changeset 1558:d40d75fcd5c5
[Issue 1268] Struct literals try to initialize static arrays of non-static structs incorrectly
Matti Niemenmaa <deewiant@gmail.com>
2007-06-15
http://d.puremagic.com/issues/show_bug.cgi?id=1268
author | thomask |
---|---|
date | Mon, 23 Jul 2007 18:47:01 +0000 |
parents | de3b217ccd1e |
children | ec5e144583ea |
files | run/s/struct_initialization_12_A.d run/s/struct_initialization_12_B.d run/s/struct_initialization_12_C.d run/s/struct_initialization_12_D.d |
diffstat | 4 files changed, 90 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/run/s/struct_initialization_12_A.d Mon Jul 23 18:47:01 2007 +0000 @@ -0,0 +1,19 @@ +// $HeadURL$ +// $Date$ +// $Author$ + +// @author@ Matti Niemenmaa <deewiant@gmail.com> +// @date@ 2007-06-15 +// @uri@ http://d.puremagic.com/issues/show_bug.cgi?id=1268 +// @desc@ [Issue 1268] Struct literals try to initialize static arrays of non-static structs incorrectly + +module dstress.run.s.struct_initialization_12_A; + +struct S{ + int[5] i; +} + +int main(){ + S s = S(); + return 0; +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/run/s/struct_initialization_12_B.d Mon Jul 23 18:47:01 2007 +0000 @@ -0,0 +1,19 @@ +// $HeadURL$ +// $Date$ +// $Author$ + +// @author@ Matti Niemenmaa <deewiant@gmail.com> +// @date@ 2007-06-15 +// @uri@ http://d.puremagic.com/issues/show_bug.cgi?id=1268 +// @desc@ [Issue 1268] Struct literals try to initialize static arrays of non-static structs incorrectly + +module dstress.run.s.struct_initialization_12_B; + +struct S{ + int[5] i; +} + +int main(){ + S s; + return 0; +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/run/s/struct_initialization_12_C.d Mon Jul 23 18:47:01 2007 +0000 @@ -0,0 +1,26 @@ +// $HeadURL$ +// $Date$ +// $Author$ + +// @author@ Matti Niemenmaa <deewiant@gmail.com> +// @date@ 2007-06-15 +// @uri@ http://d.puremagic.com/issues/show_bug.cgi?id=1268 +// @desc@ [Issue 1268] Struct literals try to initialize static arrays of non-static structs incorrectly + +module dstress.run.s.struct_initialization_12_C; + +typedef int I = 13; + +struct S{ + I[5] x; +} + +int main(){ + S s; + for(size_t i = 0; i < 5; i++){ + if(13 != s.x[i]){ + assert(0); + } + } + return 0; +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/run/s/struct_initialization_12_D.d Mon Jul 23 18:47:01 2007 +0000 @@ -0,0 +1,26 @@ +// $HeadURL$ +// $Date$ +// $Author$ + +// @author@ Matti Niemenmaa <deewiant@gmail.com> +// @date@ 2007-06-15 +// @uri@ http://d.puremagic.com/issues/show_bug.cgi?id=1268 +// @desc@ [Issue 1268] Struct literals try to initialize static arrays of non-static structs incorrectly + +module dstress.run.s.struct_initialization_12_D; + +typedef int I = 13; + +struct S{ + I[5] x; +} + +int main(){ + S s = S(); + for(size_t i = 0; i < 5; i++){ + if(13 != s.x[i]){ + assert(0); + } + } + return 0; +}