CWG Issue 1308 (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


1308. Completeness of class type within an exception-specification

Section: 11.4 [class.mem]Status: CD3Submitter: Nikolay IvchenkovDate: 2011-05-03

[Voted into the WP at the February, 2012 meeting; moved to DR at the October, 2012 meeting.]

According to 11.4 [class.mem] paragraph 2,

A class is considered a completely-defined object type (6.9 [basic.types]) (or complete type) at the closing } of the_class-specifier_. Within the class member-specification, the class is regarded as complete within function bodies, default arguments, _exception-specification_s, and_brace-or-equal-initializer_s for non-static data members (including such things in nested classes). Otherwise it is regarded as incomplete within its own class member-specification.

With the advent of the noexcept operator, treating the class type as complete in _exception-specification_s is obviously not possible, e.g.,

struct X { // should X be considered as complete here? static void create() noexcept(noexcept(X())); X() noexcept(!noexcept(X::create())); };

Proposed resolution (August, 2011):

  1. Change 11.4 [class.mem] paragraph 2 as follows:

A class is considered a completely-defined object type (6.9 [basic.types]) (or complete type) at the closing } of the_class-specifier_. Within the class member-specification, the class is regarded as complete within function bodies, default arguments, _exception-specification_s, and_brace-or-equal-initializers_ for non-static data members (including such things in nested classes). Otherwise it is regarded as incomplete within its own class member-specification.

  1. Change 14.5 [except.spec] paragraph 2 as follows:

...A type denoted in an exception-specification shall not denote an incomplete type other than a class currently being defined. A type denoted in an_exception-specification_ shall not denote a pointer or reference to an incomplete type, other than cv void*, const void*, volatile void*, orconst volatile void* or a pointer or reference to a class currently being defined. 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.

Note:

This change was subsequently removed by the resolution ofissue 1330.