Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Core language issue: Exceptions during destruction of local static objects

0 views
Skip to first unread message

Daniel Krügler

unread,
Dec 17, 2007, 1:48:47 AM12/17/07
to
It seems that neither 14882-2003 nor the most recent draft N2461
explicitely list in [except.terminate]/1 the situation of a throwing
destructor of a static local object. The nearest positions are bullet
4 (constructions and destruction of *non-local* objects of static
storage duration) and bullet 5 (exceptions during execution of a
function registered with std::atexit), but neither matches.

[basic.start.init] does only handle non-local objects of static
duration in this regard - p. 4 is actually a repetition of
[except.terminate]/1, bullet 4.

[basic.start.term] does not say what happens when a local
static object throws during destruction.

[stmt.dcl] 4+5 handle properly the case of constructors of local
statics that throw exceptions (these can be caught), but do not
mention corresponding destructors.

What I have understood so far is that typical implementations do
queue such destructor (functions) into the atexit registry anyway
([basic.start.term]/3 indirectly allows this), so wouldn't it be
appropriate to require an analogous handling and guarantee the
invocation of std::terminate here?

Proposed resolution: Add one further bullet between bullets 4 and
5 of [except.terminate]/1:

"- when destruction of a local object with static storage duration
exits using an exception (3.6.2), or"

Greetings from Bremen,

Daniel Krügler

---
[ comp.std.c++ is moderated. To submit articles, try just posting with ]
[ your news-reader. If that fails, use mailto:std...@ncar.ucar.edu ]
[ --- Please see the FAQ before posting. --- ]
[ FAQ: http://www.comeaucomputing.com/csc/faq.html ]

Daniel Krügler

unread,
Dec 17, 2007, 1:01:02 PM12/17/07
to
On Dec 17, 7:48 am, "Daniel Krügler" <daniel.krueg...@googlemail.com>
wrote:

> Proposed resolution: Add one further bullet between bullets 4 and
> 5 of [except.terminate]/1:
>
> "- when destruction of a local object with static storage duration
> exits using an exception (3.6.2), or"

The last reference to 3.6.2 should not be given here. Corrected
version:

- when destruction of a local object with static storage duration

exits using an exception, or"

I apologize for any irritations,

0 new messages