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

Eric Christopher echristo at apple.com
Thu May 3 13:09:12 PDT 2012


On May 3, 2012, at 1:07 PM, "Paul J. Lucas" <paul at lucasmail.org> wrote:

> On May 3, 2012, at 12:20 PM, Eric Christopher wrote:
> 
>> 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.
> 
> As nice at that is, I also need to have code compile and execute as expected under Windows.

I merely don't have a machine to test on. You should try top of tree and see how that goes. If not, you should file a bug and or diagnose what's going on.

-eric



More information about the cfe-dev mailing list