Mercurial > projects > dstress
changeset 1467:c41d70e10b6f
[Issue 993] No constant folding for template value default arguments
Don Clugston <clugdbug@yahoo.com.au>
2007-02-02
http://d.puremagic.com/issues/show_bug.cgi?id=993
author | thomask |
---|---|
date | Thu, 05 Apr 2007 16:33:20 +0000 |
parents | d74530a60502 |
children | c9244d89796e |
files | run/t/template_58_A.d run/t/template_58_B.d run/t/template_58_C.d run/t/template_58_D.d run/t/template_58_E.d |
diffstat | 5 files changed, 111 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/run/t/template_58_A.d Thu Apr 05 16:33:20 2007 +0000 @@ -0,0 +1,23 @@ +// $HeadURL$ +// $Date$ +// $Author$ + +// @author@ Don Clugston <clugdbug@yahoo.com.au> +// @date@ 2007-02-02 +// @uri@ http://d.puremagic.com/issues/show_bug.cgi?id=993 +// @desc@ [Issue 993] No constant folding for template value default arguments + +module dstress.run.t.template_58_A; + +const int x = 7; + +int a(int b = x * 2)(){ + return b + 1; +} + +int main() { + if(15 != a()){ + assert(0); + } + return 0; +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/run/t/template_58_B.d Thu Apr 05 16:33:20 2007 +0000 @@ -0,0 +1,23 @@ +// $HeadURL$ +// $Date$ +// $Author$ + +// @author@ Don Clugston <clugdbug@yahoo.com.au> +// @date@ 2007-02-02 +// @uri@ http://d.puremagic.com/issues/show_bug.cgi?id=993 +// @desc@ [Issue 993] No constant folding for template value default arguments + +module dstress.run.t.template_58_B; + +const int x = 7; + +int a(int b = x * 2)(){ + return b + 1; +} + +int main() { + if(15 != a!(14)()){ + assert(0); + } + return 0; +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/run/t/template_58_C.d Thu Apr 05 16:33:20 2007 +0000 @@ -0,0 +1,23 @@ +// $HeadURL$ +// $Date$ +// $Author$ + +// @author@ Don Clugston <clugdbug@yahoo.com.au> +// @date@ 2007-02-02 +// @uri@ http://d.puremagic.com/issues/show_bug.cgi?id=993 +// @desc@ [Issue 993] No constant folding for template value default arguments + +module dstress.run.t.template_58_C; + +const int x = 7 * 2; + +int a(int b = x)(){ + return b + 1; +} + +int main() { + if(15 != a!()()){ + assert(0); + } + return 0; +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/run/t/template_58_D.d Thu Apr 05 16:33:20 2007 +0000 @@ -0,0 +1,21 @@ +// $HeadURL$ +// $Date$ +// $Author$ + +// @author@ Don Clugston <clugdbug@yahoo.com.au> +// @date@ 2007-02-02 +// @uri@ http://d.puremagic.com/issues/show_bug.cgi?id=993 +// @desc@ [Issue 993] No constant folding for template value default arguments + +module dstress.run.t.template_58_D; + +int a(int b = 7 * 2)(){ + return b + 1; +} + +int main() { + if(15 != a()){ + assert(0); + } + return 0; +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/run/t/template_58_E.d Thu Apr 05 16:33:20 2007 +0000 @@ -0,0 +1,21 @@ +// $HeadURL$ +// $Date$ +// $Author$ + +// @author@ Don Clugston <clugdbug@yahoo.com.au> +// @date@ 2007-02-02 +// @uri@ http://d.puremagic.com/issues/show_bug.cgi?id=993 +// @desc@ [Issue 993] No constant folding for template value default arguments + +module dstress.run.t.template_58_E; + +int a(int b = 7 * 2)(){ + return b + 1; +} + +int main() { + if(15 != a()){ + assert(0); + } + return 0; +}