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


1308. Completeness of class type within an exception-specification

Section: 11.4  [class.mem]     Status: CD3     Submitter: Nikolay Ivchenkov     Date: 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.8 [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-specifications, 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.

With the advent of the noexcept operator, treating the class type as complete in exception-specifications 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:

  2. A class is considered a completely-defined object type (6.8 [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-specifications, 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.
  3. Change 14.5 [except.spec] paragraph 2 as follows:

  4. ...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*, or const volatile void* or a pointer or reference to a class currently being defined. A type cv T, “array of T”, or “function returning T” 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 of issue 1330.