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