Mercurial > projects > dstress
changeset 1145:8c53d3cfa6f6
[Issue 351] New: Recursive string template doesn't work if the terminating specialisation is given first
Stewart Gordon <smjg@iname.com>
2006-09-16
news:bug-351-3@http.d.puremagic.com/issues/
author | thomask |
---|---|
date | Wed, 20 Sep 2006 19:11:17 +0000 |
parents | afe5081510a3 |
children | e6b33dbd93fe |
files | compile/t/template_44_A.d compile/t/template_44_B.d |
diffstat | 2 files changed, 40 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/compile/t/template_44_A.d Wed Sep 20 19:11:17 2006 +0000 @@ -0,0 +1,20 @@ +// $HeadURL$ +// $Date$ +// $Author$ + +// @author@ Stewart Gordon <smjg@iname.com> +// @date@ 2006-09-16 +// @uri@ news:bug-351-3@http.d.puremagic.com/issues/ +// @desc@ [Issue 351] New: Recursive string template doesn't work if the terminating specialisation is given first + +module dstress.compile.t.template_44_A; + +template Reverse(char[] s) { + const char[] Reverse = Reverse!(s[1 .. s.length]) ~ s[0]; +} + +template Reverse(char[] s : "") { + const char[] Reverse = ""; +} + +static assert(Reverse!("abcD") == "Dcba");
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/compile/t/template_44_B.d Wed Sep 20 19:11:17 2006 +0000 @@ -0,0 +1,20 @@ +// $HeadURL$ +// $Date$ +// $Author$ + +// @author@ Stewart Gordon <smjg@iname.com> +// @date@ 2006-09-16 +// @uri@ news:bug-351-3@http.d.puremagic.com/issues/ +// @desc@ [Issue 351] New: Recursive string template doesn't work if the terminating specialisation is given first + +module dstress.compile.t.template_44_B; + +template Reverse(char[] s : "") { + const char[] Reverse = ""; +} + +template Reverse(char[] s) { + const char[] Reverse = Reverse!(s[1 .. s.length]) ~ s[0]; +} + +static assert(Reverse!("abcD") == "Dcba");