On 18 February 2015 at 11:57, Liran Zvibel via D.gnu <d.gnu@puremagic.com> wrote: > Hi, > > We would like to use exceptions in some cases, but we don't want to allocate > them when we send them. > What we do with dmd is create bunch of "static immutable Throwable" members > in our objects during creation (for every possible case), then we just throw > these members in the code. > > When compiling with GDC we get a segfault in the code that tries to generate > the backtrace. > > We will start investigate this now so we can create a bug report, I would > just like to ask whether anyone else has seen this behavior, and what is the > recommended way to raise an exception without GC allocations in GDC. >
You can't throw without a GC allocation currently. I'm open to suggestions and patches welcome. See here: https://github.com/D-Programming-GDC/GDC/blob/master/libphobos/libdruntime/gcc/deh.d#L152 Iain.