https://issues.dlang.org/show_bug.cgi?id=15056
Martin Nowak <[email protected]> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |[email protected] --- Comment #4 from Martin Nowak <[email protected]> --- But the error message seems correct, default arguments are passed from the caller site and b/c of the destructor a try catch block is needed around statements that might throw. > This idiom allows for concise code that executes extremely fast and uses the > least possible amount of stack memory Not exactly sure why alloca doesn't work with EH handling, but I guess we need fixed addresses for variables to unwind them. You could pass in a buffer to avoid alloca. ubyte[1234] buf = void; foo(buf.ptr); It's even possible to wrap the buffer with the function return value. auto withBuf(size_t n, alias func, Args...)(auto ref Args args) { static struct Result { ubyte[n] __buf; ReturnType!func val; alias val this; } Result res = void; emplace(res.val, func(res.ptr, args)); return res; } I'll still try to find out whether 2.068.1 broke something unintentionally. --
