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

Douglas Gregor dgregor at apple.com
Mon Oct 24 07:54:52 PDT 2011


On Oct 21, 2011, at 8:30 PM, Nick Walters wrote:

> 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

g++ produces the same result on Mac OS X 10.7.2. Please file a bug with Apple at

	https://bugreport.apple.com/

because what you're seeing is more likely a C++ runtime issue rather than a compiler issue.

	- Doug



More information about the cfe-dev mailing list