This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/11238] A constructor with exception handler rethrows the exception to the constructor caller
- From: "bangerth at dealii dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 18 Jun 2003 14:50:53 -0000
- Subject: [Bug c++/11238] A constructor with exception handler rethrows the exception to the constructor caller
- References: <20030618142539.11238.ejyanezp@yahoo.com>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
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.