[cfe-dev] terminate called, but shouldn't be

Eric Christopher echristo at apple.com
Thu May 3 12:20:47 PDT 2012


On May 3, 2012, at 11:18 AM, "Paul J. Lucas" <paul at lucasmail.org> wrote:

> Given this program:
> 
>> #include <stdexcept>
>> #include <iostream>
>> 
>> using namespace std;
>> 
>> int main() {
>>  try {
>>    throw std::runtime_error( "whoops!" );
>>  }
>>  catch ( std::exception const &e ) {
>>    cout << e.what() << endl;
>>  }
>>  return 0;
>> }
> 
> and compiled with g++ under cygwin, I get only the output "whoops!" as expected.  When compiled with clang++ 3.0 under MinGW, I get:
> 
>> terminate called after throwing an instance of 'std::runtime_error'
>>  what():  whoops!
>> 
>> This application has requested the Runtime to terminate it in an unusual way.
>> Please contact the application's support team for more information.
> 
> Why?  terminate should NOT be called since the exception is caught.

With ToT clang on darwin it works fine.

-eric



More information about the cfe-dev mailing list