This is an unofficial snapshot of the ISO/IEC JTC1 SC22 WG21 Core Issues List revision 115e. See http://www.open-std.org/jtc1/sc22/wg21/ for the official list.
2024-11-11
[Adopted at the February, 2016 meeting.]
The resolutions of issues 330 and 1351 use different terminology for an exception specification that can throw anything: the former refers to a “(conceptual) set of all types,” while the latter uses a “pseudo-type, denoted by 'any'.” These should be unified.
Proposed resolution (October, 2015) [SUPERSEDED]:
Change 14.5 [except.spec] paragraph 13 as follows:
AThe set of potential exceptions of a given context iseither a typea set of types that might be thrown as an exceptionor a pseudo-type, denoted by “any”, that represents the situation where an exception of an arbitrary type might be thrown; the (conceptual) set of all types is used to denote that an exception of arbitrary type might be thrown. A subexpression e1 of an expression e is an immediate subexpression if there is no subexpression e2 of e such that e1 is a subexpression of e2.
Delete 14.5 [except.spec] paragraph 14:
The set of potential exceptions of a function, function pointer, or member function pointer f is defined as follows:
If the exception specification of f is the set of all types, the set consists of the pseudo-type “any”.
Otherwise, the set consists of every type in the exception specification of f.
Change 14.5 [except.spec] paragraph 15 as follows:
The set of potential exceptions of an expression e is empty if e is a core constant expression (7.7 [expr.const]). Otherwise, it is the union of the sets of potential exceptions of the immediate subexpressions of e, including default argument expressions used in a function call, combined with a set S defined by the form of e, as follows:
If e is a function call (7.6.1.3 [expr.call]):
If its postfix-expression is a (possibly parenthesized) id-expression (_N4567_.5.1.1 [expr.prim.general]), class member access (7.6.1.5 [expr.ref]), or pointer-to-member operation (7.6.4 [expr.mptr.oper]) whose cast-expression is an id-expression, S is the set of
potential exceptionstypes in the exception specification of the entity selected by the contained id-expression (after overload resolution, if applicable).Otherwise, S
contains the pseudo-type “any”is the set of all types.If e implicitly invokes a function (such as an overloaded operator, an allocation function in a new-expression, or a destructor if e is a full-expression (6.9.1 [intro.execution])), S is the set of
potential exceptionstypes in the exception specification of the function.if e is a throw-expression (7.6.18 [expr.throw]), S consists of the type of the exception object that would be initialized by the operand, if present, or is the
pseudo-type “any”set of all types otherwise.if e is a dynamic_cast expression that casts to a reference type and requires a run-time check (7.6.1.7 [expr.dynamic.cast]), S consists of the type std::bad_cast.
if e is a typeid expression applied to a glvalue expression whose type is a polymorphic class type (7.6.1.8 [expr.typeid]), S consists of the type std::bad_typeid.
if e is a new-expression with a non-constant expression in the noptr-new-declarator (7.6.2.8 [expr.new]), S consists of the type std::bad_array_new_length.
[Example: Given the following declarations
void f() throw(int); void g(); struct A { A(); }; struct B { B() noexcept; }; struct D(){ D() throw (double); };the set of potential exceptions for some sample expressions is:
for f(), the set consists of int;
for g(), the set
consists of “any”is the set of all types;for new A, the set
consists of “any”is the set of all types;for B(), the set is empty;
for new D, the set
consists of “any” and doubleis the set of all types. [Note: This set conceptually includes the type double. —end note]—end example]
Change 14.5 [except.spec] paragraph 16 as follows:
Given aA member function f of some class X, where f is an inheriting constructor (_N4527_.12.9 [class.inhctor]) or an implicitly-declared special member function,the set of potential exceptions of the implicitly-declared member function fis considered to have an implicit exception specification that consists of all the members from the following sets...
Delete the normative portion of 14.5 [except.spec] paragraph 17 and merge the note and example into the preceding paragraph, as follows:
An inheriting constructor (_N4527_.12.9 [class.inhctor]) and an implicitly-declared special member function ( 11.4.4 [special]) are considered to have an implicit exception specification, as follows, where S is the set of potential exceptions of the implicitly-declared member function:
if S contains the pseudo-type “any”, the implicit exception specification is the set of all types;
otherwise, the implicit exception specification contains all the types in S.[Note: An instantiation of an inheriting constructor template...
Additional note (November, 2015):
The base text underlying the preceding proposed resolution was changed at the October, 2015 meeting by the adoption of paper P0136R1. As a result, this issue has been returned to "drafting" status to allow reconciliation of the two sets of changes.
Proposed resolution (January, 2016):
Change 14.5 [except.spec] paragraph 12 as follows:
AThe set of potential exceptions of a given context iseither a typea set of types that might be thrown as an exceptionor a pseudo-type, denoted by “any”, that represents the situation where an exception of an arbitrary type might be thrown; the (conceptual) set of all types is used to denote that an exception of arbitrary type might be thrown. A subexpression e1 of an expression e is an immediate subexpression if there is no subexpression e2 of e such that e1 is a subexpression of e2.
Delete 14.5 [except.spec] paragraph 13:
The set of potential exceptions of a function, function pointer, or member function pointer f is defined as follows:
If the exception specification of f is the set of all types, the set consists of the pseudo-type “any”.
Otherwise, the set consists of every type in the exception specification of f.
Change 14.5 [except.spec] paragraph 14 as follows:
The set of potential exceptions of an expression e is empty if e is a core constant expression (7.7 [expr.const]). Otherwise, it is the union of the sets of potential exceptions of the immediate subexpressions of e, including default argument expressions used in a function call, combined with a set S defined by the form of e, as follows:
If e is a function call (7.6.1.3 [expr.call]):
If its postfix-expression is a (possibly parenthesized) id-expression (_N4567_.5.1.1 [expr.prim.general]), class member access (7.6.1.5 [expr.ref]), or pointer-to-member operation (7.6.4 [expr.mptr.oper]) whose cast-expression is an id-expression, S is the set of
potential exceptionstypes in the exception specification of the entity selected by the contained id-expression (after overload resolution, if applicable).Otherwise, if the postfix-expression has type “noexcept function” or “pointer to noexcept function”, S is the empty set.
Otherwise, S
contains the pseudo-type “any”is the set of all types.If e implicitly invokes a function (such as an overloaded operator, an allocation function in a new-expression, or a destructor if e is a full-expression (6.9.1 [intro.execution])), S is the set of
potential exceptionstypes in the exception specification of the function.If e initializes an object of type D using an inherited constructor for a class of type B (11.9.4 [class.inhctor.init]), S also contains the sets of potential exceptions of the implied constructor invocations for subobjects of D that are not subobjects of B (including default argument expressions used in such invocations) as selected by overload resolution, and the sets of potential exceptions of the initialization of non-static data members from brace-or-equal-initializers (11.9.3 [class.base.init]).
If e is a throw-expression (7.6.18 [expr.throw]), S consists of the type of the exception object that would be initialized by the operand, if present, or is the
pseudo-type “any”set of all types otherwise.If e is a dynamic_cast expression that casts to a reference type and requires a run-time check (7.6.1.7 [expr.dynamic.cast]), S consists of the type std::bad_cast.
If e is a typeid expression applied to a glvalue expression whose type is a polymorphic class type (7.6.1.8 [expr.typeid]), S consists of the type std::bad_typeid.
If e is a new-expression with a non-constant expression in the noptr-new-declarator (7.6.2.8 [expr.new]), S consists of the type std::bad_array_new_length.
[Example: Given the following declarations
void f() throw(int); void g(); struct A { A(); }; struct B { B() noexcept; }; struct D { D() throw (double); };the set of potential exceptions for some sample expressions is:
for f(), the set consists of int;
for g(), the set
consists of “any”is the set of all types;for new A, the set
consists of “any”is the set of all types;for B(), the set is empty;
for new D, the set
consists of “any” and doubleis the set of all types.—end example]
Change 14.5 [except.spec] paragraph 16 as follows:
Given anAn implicitly-declared special member function f of some class X, the set of potential exceptions of the implicitly-declared special member function fis considered to have an implicit exception specification that consists of all the members from the following sets:...
Delete the normative text of 14.5 [except.spec] paragraph 17 and merge the example with the preceding paragraph:
An implicitly-declared special member function ( 11.4.4 [special]) is considered to have an implicit exception specification, as follows, where S is the set of potential exceptions of the implicitly-declared special member function:
if S contains the pseudo-type “any”, the implicit exception specification is the set of all types;
otherwise, the implicit exception specification contains all the types in S.[Example:...