C++ exception handling issue ?

jean-marie.verdun at splitted-desktop.org jean-marie.verdun at splitted-desktop.org
Tue Jul 18 11:38:28 UTC 2006


Hi,

Here is a small reproducer of the issue.

#include <iostream.h>


class Exception{
   public:
     Exception() {}
     ~Exception() {}
};

std::string foo(bool throwException)
{
    if( throwException ) {
      throw Exception();
    } else {
      std:: string x = "hello world";
      return x;
   }
}

int main(int argc, char** argv)
{
   try {
     const std::string & str  = foo(true);
   } catch(...) {
     cout << "Caught an exception" << endl;
   }
   return 0;
}

I think this is a GCC issue but would like to confirm.

Jm




More information about the uClibc mailing list