# HG changeset patch # User thomask # Date 1172489563 0 # Node ID cb2353467b1cc4bd47bc668a3e8b919646ef2a84 # Parent 3da73e4504c488d2cbe860a9676ee33a430d4ba1 [Issue 995] compile-time function return element of Tuple / const array Daniel 2007-02-22 http://d.puremagic.com/issues/show_bug.cgi?id=995 diff -r 3da73e4504c4 -r cb2353467b1c reporter.txt --- 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 D Trebbien Dan +Daniel Daniel Horn Dave david diff -r 3da73e4504c4 -r cb2353467b1c run/t/tuple_16_A.d --- /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 +// @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; +} diff -r 3da73e4504c4 -r cb2353467b1c run/t/tuple_16_B.d --- /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 +// @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; +} diff -r 3da73e4504c4 -r cb2353467b1c run/t/tuple_16_C.d --- /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 +// @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; +} diff -r 3da73e4504c4 -r cb2353467b1c run/t/tuple_16_D.d --- /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 +// @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; +}