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

Tom Honermann thonermann at coverity.com
Thu May 3 19:17:00 PDT 2012


On 5/3/2012 2:18 PM, Paul J. Lucas 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.

As I understand it, Clang does not implement parts of the Win32/64 ABI 
needed for exception handling compatibility with the msvc6 C/C++ 
run-time used by MinGW.  See the following link for previous discussion 
with subject "LLVM/Clang and setjmp/longjmp exception handling on MinGW"

http://www.digipedia.pl/usenet/thread/11413/12904/

Tom.




More information about the cfe-dev mailing list