Topic: Core language issue: Exceptions during destruction of local static
Author: "=?ISO-8859-1?Q?Daniel_Kr=FCgler?=" <daniel.kruegler@googlemail.com>
Date: Mon, 17 Dec 2007 00:48:47 CST Raw View
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-c++@ncar.ucar.edu ]
[ --- Please see the FAQ before posting. --- ]
[ FAQ: http://www.comeaucomputing.com/csc/faq.html ]