CWG Issue 973 (original) (raw)

This is an unofficial snapshot of the ISO/IEC JTC1 SC22 WG21 Core Issues List revision 118e. See http://www.open-std.org/jtc1/sc22/wg21/ for the official list.

2025-11-05


973. Function types in _exception-specification_s

Section: 14.5 [except.spec]Status: CD2Submitter: Daniel KrüglerDate: 12 October, 2009

[Voted into WP at March, 2010 meeting.]

There is no prohibition against specifying a function type in an_exception-specification_, and the normal conversion of a function type to a pointer-to-function type occurs in both_throw-expression_s (14.2 [except.throw] paragraph 3) and in _handler_s (14.4 [except.handle] paragraph 2), but that was apparently overlooked in the description of_exception-specification_s.

Proposed resolution (February, 2010):

Change 14.5 [except.spec] paragraphs 2-3 as follows:

A type denoted in an exception-specification shall not denote an incomplete type. A type denoted in an_exception-specification_ shall not denote a pointer or reference to an incomplete type, other than void*,const void*, volatile void*, or const volatile void*. A type cv T, “array of T,” or “function returningT” denoted in an exception-specification is adjusted to type T, “pointer to T,” or “pointer to function returning T,” respectively.

If any declaration of a function has an_exception-specification_, all declarations, including the definition and an any explicit specialization, of that function shall have an_exception-specification_ with the same set of_type-id_s adjusted types. If any declaration of a pointer to function, reference to function, or pointer to member function has an exception-specification, all occurrences of that declaration shall have an_exception-specification_ with the same set of_type-id_s adjusted types. In an explicit instantiation an exception-specification may be specified, but is not required. If an_exception-specification_ is specified in an explicit instantiation directive, it shall have the same set of_type-id_s adjusted types as other declarations of that function. A diagnostic is required only if the sets of _type-id_s adjusted typesare different within a single translation unit.