Mercurial > projects > dstress
changeset 1577:45e89f20882a
[Issue 1400] New: static array in struct as parameter BROKEN
<default_357-line@yahoo.de>
2007-08-04
http://d.puremagic.com/issues/show_bug.cgi?id=1400
author | thomask |
---|---|
date | Thu, 21 Feb 2008 15:20:29 +0000 |
parents | b3e16c86558e |
children | 10a4a6037695 |
files | run/f/foreach_39_A.d run/f/foreach_39_B.d run/f/foreach_39_C.d |
diffstat | 3 files changed, 111 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/run/f/foreach_39_A.d Thu Feb 21 15:20:29 2008 +0000 @@ -0,0 +1,39 @@ +// $HeadURL$ +// $Date$ +// $Author$ + +// @author@ <default_357-line@yahoo.de> +// @date@ 2007-08-04 +// @uri@ http://d.puremagic.com/issues/show_bug.cgi?id=1400 +// @desc@ [Issue 1400] New: static array in struct as parameter BROKEN + +module dstress.run.f.foreach_39_A; + +void test(float[3] t) { + if(5.0f != t[0]){ + assert(0); + } + if(6.0f != t[1]){ + assert(0); + } + if(7.0f != t[2]){ + assert(0); + } +} + +struct E { + float[3] data = [5.0f, 6.0f, 7.0f]; +} + +int main() { + E[] es; + E e; + + es~=e; + + foreach(inout v; es){ + test(v.data); + } + + return 0; +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/run/f/foreach_39_B.d Thu Feb 21 15:20:29 2008 +0000 @@ -0,0 +1,39 @@ +// $HeadURL$ +// $Date$ +// $Author$ + +// @author@ <default_357-line@yahoo.de> +// @date@ 2007-08-04 +// @uri@ http://d.puremagic.com/issues/show_bug.cgi?id=1400 +// @desc@ [Issue 1400] New: static array in struct as parameter BROKEN + +module dstress.run.f.foreach_39_B; + +void test(float[3] t) { + if(5.0f != t[0]){ + assert(0); + } + if(6.0f != t[1]){ + assert(0); + } + if(7.0f != t[2]){ + assert(0); + } +} + +struct E { + float[3] data = [5.0f, 6.0f, 7.0f]; +} + +int main() { + E[] es; + E e; + + es~=e; + + foreach(v; es){ + test(v.data); + } + + return 0; +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/run/f/foreach_39_C.d Thu Feb 21 15:20:29 2008 +0000 @@ -0,0 +1,33 @@ +// $HeadURL$ +// $Date$ +// $Author$ + +// @author@ <default_357-line@yahoo.de> +// @date@ 2007-08-04 +// @uri@ http://d.puremagic.com/issues/show_bug.cgi?id=1400 +// @desc@ [Issue 1400] New: static array in struct as parameter BROKEN + +module dstress.run.f.foreach_39_C; + +void test(float[3] t) { + if(5.0f != t[0]){ + assert(0); + } + if(6.0f != t[1]){ + assert(0); + } + if(7.0f != t[2]){ + assert(0); + } +} + +struct E { + float[3] data = [5.0f, 6.0f, 7.0f]; +} + +int main() { + E e; + test(e.data); + + return 0; +}