This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/15764] no cleanup if temporary's dtor terminates with an exception
- From: "jason at gcc dot gnu dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 6 Sep 2007 05:36:24 -0000
- Subject: [Bug c++/15764] no cleanup if temporary's dtor terminates with an exception
- References: <bug-15764-5779@http.gcc.gnu.org/bugzilla/>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Comment #9 from jason at gcc dot gnu dot org 2007-09-06 05:36 -------
This version of the test breaks under ICC:
----------------------
extern "C" void abort ();
int counter = 0;
int thrown = 0;
struct a {
~a () { if (!thrown++) throw 1; }
};
int f (a const&, const a&) { return 1; }
struct b {
b (...) { ++counter; }
~b () { --counter; }
};
void g();
int main () {
try {
b tmp(f (a(), a()));
}
catch (...) {}
if (counter != 0)
abort ();
}
----------------------
For whatever reason, if the first ~a throws, ICC doesn't try to destroy tmp,
but if the second ~a throws, ICC cleans up tmp properly. Odd.
--
jason at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
AssignedTo|unassigned at gcc dot gnu |jason at gcc dot gnu dot org
|dot org |
Status|NEW |ASSIGNED
Last reconfirmed|2005-06-19 15:11:05 |2007-09-06 05:36:24
date| |
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=15764