[cfe-dev] terminate called, but shouldn't be
Paul J. Lucas
paul at lucasmail.org
Thu May 3 11:18:51 PDT 2012
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.
- Paul
More information about the cfe-dev
mailing list