This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c++/11238] A constructor with exception handler rethrows the exception to the constructor caller


PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=11238



------- Additional Comments From bangerth at dealii dot org  2003-06-18 14:50 -------
I think I must be missing something, so I leave this unconfirmed for now.
This code
------------------------------
#include <cstdlib>

struct M {
    M() { throw 1; }
};

struct C {
    C()   try : m()
          {}
          catch (...) {}
    M m;
};

int main() {
  try { C c; }
  catch (...) { abort(); }
}
----------------------------------------
indeed aborts. I thought, the catch-clause in the constructor should
catch and handle the exception. It does catch it, but the exception
propagates back to main(). I suspect this is what the standard says,
since the program as-is also aborts with icc. But I have to look this
up.

W.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]