This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: [Q] destructors vs terminate
- To: Richard Henderson <rth at redhat dot com>
- Subject: Re: [Q] destructors vs terminate
- From: Alexandre Oliva <aoliva at redhat dot com>
- Date: 04 Aug 2001 01:06:59 -0300
- Cc: gcc at gcc dot gnu dot org
- Organization: GCC Team, Red Hat
- References: <20010803165118.A17516@redhat.com>
On Aug 3, 2001, Richard Henderson <rth@redhat.com> wrote:
> Should the following test case pass?
It shall terminate with exit status 1. As control passes from `throw
1' to `catch (...)' in main, the destructor of `A obj' is invoked
[except.ctor]/1. It calls std::set_terminate(), which modifies the
terminate_handler that will be run by std::terminate()
[lib.set.terminate], and only then does it throw 1, that triggers the
invocation of std::terminate() because the destruction of an object
during stack unwinding exits using an exception [except.terminate]/1
and [except.ctor]/3. std::terminate() will call exit_err() because
that is the terminate_handler function in effect immediately after
evaluating the throw-expression `throw 1' in A::~A()
[lib.terminate]/1.
--
Alexandre Oliva Enjoy Guarana', see http://www.ic.unicamp.br/~oliva/
Red Hat GCC Developer aoliva@{cygnus.com, redhat.com}
CS PhD student at IC-Unicamp oliva@{lsd.ic.unicamp.br, gnu.org}
Free Software Evangelist *Please* write to mailing lists, not to me