[cfe-dev] Uncaught exceptions do not show what()

Nick Walters nickwalters99 at gmail.com
Fri Oct 21 20:30:06 PDT 2011


I am compiling with the latest Clang/LLVM on my Mac (10.7.2). Uncaught
exceptions do not display the what() message from a std exception. Here’s my
test program:


#include <exception>


using namespace std;


class my_exception : public exception{

  virtual const char* what() const throw(){

    return "my error occurred";

  }

};


int main(int argc, char** argv){

  throw my_exception();


  return 0;

}


Instead, I just get:


terminate called after throwing an instance of 'my_exception'

terminate called without an active exception

Abort trap: 6


Nick
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20111021/964ad1c1/attachment.html>


More information about the cfe-dev mailing list