I wrote a small D program. When compiled with DMD, it works fine, but neither GDC nor LDC2 can catch exceptions thrown from Phobos (proven by GDB). How do I fix this?

Example code:

    import std.process;
    void main(){
      try
      {
        spawnProcess(["/dev/null"]);
      }
      catch (Throwable p)
      {
        return;
      }
    }

which dies with SIGABRT when compiled and executed, even though the catch block should catch the ProcessException.

Compiler: ldc2 based on LLVM 3.3 and DMD 2.063.2 (invoked via ldmd2 -O -inline -release), but also happens with gdc 4.8.2 (invoked via gdmd -O -inline -release). The execption is caught when I use dmd -O -inline -release to compile, even when I only catch ProcessException and not Throwable.

Reply via email to