Can't catch Phobos exceptions

Demetri Supernova2003dh at yahoo.com
Mon Mar 17 11:13:36 PDT 2014


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.


More information about the D.gnu mailing list