This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug optimization/14535] [3.3/3.4/3.5 Regression] exception throwing in virtual function doesn't turn on the local destructors
- From: "bangerth at dealii dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 11 Mar 2004 16:19:52 -0000
- Subject: [Bug optimization/14535] [3.3/3.4/3.5 Regression] exception throwing in virtual function doesn't turn on the local destructors
- References: <20040311143002.14535.lassinovsky@algorithm.aelita.com>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Additional Comments From bangerth at dealii dot org 2004-03-11 16:19 -------
Confirmed indeed. Here is something more selfcontained:
---------------------
extern "C" void abort();
bool destructor_called = false;
struct B {
virtual void Run(){};
};
struct D : public B {
virtual void Run()
{
struct O {
~O() { destructor_called = true; };
} o;
struct Raiser {
Raiser() throw( int ) {throw 1;};
} raiser;
};
};
int main() {
try {
D d;
static_cast<B&>(d).Run();
} catch (...) {}
if (!destructor_called)
abort ();
}
-----------------------
g/x> /home/bangerth/bin/gcc-3.4-pre/bin/c++ x.cc ; ./a.out
g/x> /home/bangerth/bin/gcc-3.4-pre/bin/c++ -finline x.cc ; ./a.out
Aborted
W.
--
What |Removed |Added
----------------------------------------------------------------------------
Known to fail|3.4.0 3.3.1 3.5.0 tree-ssa |3.4.0 3.3.1 3.5.0 tree-ssa
| |3.2.3
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14535