Mercurial > projects > dstress
changeset 1031:230884fb9d6e
"Unexpected FunExp type" error on function literals
<dvdfrdmn@users.sf.net>
2006-05-27
news:bug-157-31@http.d.puremagic.com/bugzilla/
author | thomask |
---|---|
date | Sun, 28 May 2006 15:49:26 +0000 |
parents | 6c80930a0050 |
children | b9476c6a7614 |
files | run/f/function_06_A.d run/f/function_06_B.d |
diffstat | 2 files changed, 48 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/run/f/function_06_A.d Sun May 28 15:49:26 2006 +0000 @@ -0,0 +1,24 @@ +// $HeadURL$ +// $Date$ +// $Author$ + +// @author@ <dvdfrdmn@users.sf.net> +// @date@ 2006-05-27 +// @uri@ news:bug-157-31@http.d.puremagic.com/bugzilla/ + +module dstress.run.f.function_06_A; + +int function(int)[] table; + +int main() { + table ~= function int(int x) { + return x + 99; + }; + + if(table[0](1) != 100){ + assert(0); + } + + return 0; +} +
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/run/f/function_06_B.d Sun May 28 15:49:26 2006 +0000 @@ -0,0 +1,24 @@ +// $HeadURL$ +// $Date$ +// $Author$ + +// @author@ <dvdfrdmn@users.sf.net> +// @date@ 2006-05-27 +// @uri@ news:bug-157-31@http.d.puremagic.com/bugzilla/ + +module dstress.run.f.function_06_B; + +int function(int)[1] table; + +int main() { + table[0] = function int(int x) { + return x + 99; + }; + + if(table[0](1) != 100){ + assert(0); + } + + return 0; +} +