Title
Empty pack expansion in dynamic-exception-specification
Status
cd4
Section
14.5 [except.spec]
Submitter
Richard Smith

Created on 2013-09-24.00:00:00 last changed 86 months ago

Messages

Date: 2014-11-15.00:00:00

[Moved to DR at the November, 2014 meeting.]

Date: 2014-02-15.00:00:00

Proposed resolution (February, 2014):

Change 14.5 [except.spec] paragraph 12 as follows:

A function with no exception-specification or with an exception-specification of the form noexcept(constant-expression ) where the constant-expression yields false allows all exceptions. An exception-specification is non-throwing if it is of the form throw(), noexcept, or noexcept(constant-expression ) where the a dynamic-exception-specification whose set of adjusted types is empty (after any packs are expanded) or a noexcept-specification whose constant-expression is either absent or yields true. A function with a non-throwing exception-specification does not allow any exceptions.
Date: 2013-09-24.00:00:00

According to 13.7.4 [temp.variadic] paragraph 6, describing an empty pack expansion,

When N is zero, the instantiation of the expansion produces an empty list. Such an instantiation does not alter the syntactic interpretation of the enclosing construct, even in cases where omitting the list entirely would otherwise be ill-formed or would result in an ambiguity in the grammar.

This leaves open the question of whether something like

  template<typename...T> void f() throw(T...);

should be considered to have a non-throwing exception-specification when T... is empty. The definition in 14.5 [except.spec] paragraph 12 appears to be syntactic regarding dynamic-exception-specifications:

An exception-specification is non-throwing if it is of the form throw(), noexcept, or noexcept(constant-expression ) where the constant-expression yields true. A function with a non-throwing exception-specification does not allow any exceptions.

It seems evident, however, that a dynamic-exception-specification with an empty pack expansion “does not allow any exceptions.”

History
Date User Action Args
2017-02-06 00:00:00adminsetstatus: drwp -> cd4
2015-05-25 00:00:00adminsetstatus: dr -> drwp
2015-04-13 00:00:00adminsetmessages: + msg5426
2014-11-24 00:00:00adminsetstatus: ready -> dr
2014-03-03 00:00:00adminsetmessages: + msg4859
2014-03-03 00:00:00adminsetstatus: open -> ready
2013-09-24 00:00:00admincreate