Mercurial > projects > dstress
changeset 1366:cb2353467b1c
[Issue 995] compile-time function return element of Tuple / const array
Daniel <Daniel919@web.de>
2007-02-22
http://d.puremagic.com/issues/show_bug.cgi?id=995
author | thomask |
---|---|
date | Mon, 26 Feb 2007 11:32:43 +0000 |
parents | 3da73e4504c4 |
children | 24d5585f4fc0 |
files | reporter.txt run/t/tuple_16_A.d run/t/tuple_16_B.d run/t/tuple_16_C.d run/t/tuple_16_D.d |
diffstat | 5 files changed, 102 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/reporter.txt Mon Feb 26 11:31:35 2007 +0000 +++ b/reporter.txt Mon Feb 26 11:32:43 2007 +0000 @@ -42,6 +42,7 @@ clayasaurus <clayasaurus@gmail.com> D Trebbien Dan <ddaglas@gmail.com> +Daniel <Daniel919@web.de> Daniel Horn <hellcatv@hotmail.com> Dave <godaves@yahoo.com> david <davidl@126.com>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/run/t/tuple_16_A.d Mon Feb 26 11:32:43 2007 +0000 @@ -0,0 +1,27 @@ +// $HeadURL$ +// $Date$ +// $Author$ + +// @author@ Daniel <Daniel919@web.de> +// @date@ 2007-02-22 +// @uri@ http://d.puremagic.com/issues/show_bug.cgi?id=995 +// @desc@ [Issue 995] compile-time function return element of Tuple / const array + +module dstress.run.t.tuple_16_A; + +template eval(A...) { + alias A eval; +} + +alias eval!("a","b") foo; + +char[] test(int i){ + return foo[i]; +} + +int main(){ + if("a" != test(0)){ + assert(0); + } + return 0; +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/run/t/tuple_16_B.d Mon Feb 26 11:32:43 2007 +0000 @@ -0,0 +1,23 @@ +// $HeadURL$ +// $Date$ +// $Author$ + +// @author@ Daniel <Daniel919@web.de> +// @date@ 2007-02-22 +// @uri@ http://d.puremagic.com/issues/show_bug.cgi?id=995 +// @desc@ [Issue 995] compile-time function return element of Tuple / const array + +module dstress.run.t.tuple_16_B; + +template eval(A...) { + alias A eval; +} + +alias eval!("a","b") foo; + +int main(){ + if("a" != eval!(foo[0])){ + assert(0); + } + return 0; +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/run/t/tuple_16_C.d Mon Feb 26 11:32:43 2007 +0000 @@ -0,0 +1,24 @@ +// $HeadURL$ +// $Date$ +// $Author$ + +// @author@ Daniel <Daniel919@web.de> +// @date@ 2007-02-22 +// @uri@ http://d.puremagic.com/issues/show_bug.cgi?id=995 +// @desc@ [Issue 995] compile-time function return element of Tuple / const array + +module dstress.run.t.tuple_16_C; + +template eval(A...) { + alias A eval; +} + +alias eval!("a","b") foo; + +int main(){ + static x = eval!(foo[0]); + if("a" != x){ + assert(0); + } + return 0; +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/run/t/tuple_16_D.d Mon Feb 26 11:32:43 2007 +0000 @@ -0,0 +1,27 @@ +// $HeadURL$ +// $Date$ +// $Author$ + +// @author@ Daniel <Daniel919@web.de> +// @date@ 2007-02-22 +// @uri@ http://d.puremagic.com/issues/show_bug.cgi?id=995 +// @desc@ [Issue 995] compile-time function return element of Tuple / const array + +module dstress.run.t.tuple_16_D; + +template eval(A...) { + alias A eval; +} + +const char[] foo[2] = ["a","b"]; + +char[] test(int i){ + return foo[i]; +} + +int main(){ + if("a" != eval!(test(0))){ + assert(0); + } + return 0; +}