This is an unofficial snapshot of the ISO/IEC JTC1 SC22 WG21 Core Issues List revision 116a. See http://www.open-std.org/jtc1/sc22/wg21/ for the official list.
2024-12-19
[Voted into the WP at the March, 2011 meeting.]
It is not clear how to handle compatible dynamic-exception-specifications and noexcept-specifications. For example, given
void f() throw(); void f() noexcept { throw 1; }
should we call terminate() or unexpected()? And for
void g() throw (int); void g() noexcept (false) { throw 1.0; }
should this call unexpected or propagate the exception? Does the order of the declarations (and which is the definition) matter?
Alisdair Meredith:
And what about something like
struct A { ~A() throw() { } }; struct B { ~B() noexcept { } }; struct C: A, B { };
What is the exception specification for C's destructor?
Proposed resolution (November, 2010):
Change 14.5 [except.spec] paragraph 3 as follows:
Two exception-specifications are compatible if:
both are non-throwing (see below), regardless of their form,
both have the form noexcept(constant-expression) and the constant-expressions are equivalent, or
one exception-specification is a noexcept-specification allowing all exceptions and the other is of the form throw(type-id-list), orboth are dynamic-exception-specifications that have the same set of adjusted types.
Add the following note to the end of 14.5 [except.spec] paragraph 9:
Whenever an exception is thrown and the search...
—end example]
[Note: A function can have multiple declarations with different non-throwing exception-specifications; for this purpose, the one on the function definition is used. —end note]