Struct with lambda argument causes segfault at runtime
Timon Gehr via Digitalmars-d
digitalmars-d at puremagic.com
Sat Aug 9 10:39:51 PDT 2014
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
More information about the Digitalmars-d
mailing list