On 08/09/2014 07:11 PM, H. S. Teoh via Digitalmars-d wrote:
This causes a segfault at runtime. Moving the declaration of r inside main() fixes the problem. Why?
My guess is it is just a missing diagnostic for the missing support for closures in CTFE.
You are effectively trying to do something like
auto foo(int a){
return (int x)=>x+a;
}
auto d=foo(2);
which fails with
Error: closures are not yet supported in CTFE
