Title
Completeness of class type within an exception-specification
Status
cd3
Section
11.4 [class.mem]
Submitter
Nikolay Ivchenkov

Created on 2011-05-03.00:00:00 last changed 17 months ago

Messages

Date: 2012-02-15.00:00:00

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

Date: 2022-11-20.07:54:16

Note:

This change was subsequently removed by the resolution of issue 1330.

Date: 2011-08-15.00:00:00

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.
Date: 2012-09-24.00:00:00

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()));
  };
History
Date User Action Args
2022-11-20 07:54:16adminsetmessages: + msg7029
2014-03-03 00:00:00adminsetstatus: drwp -> cd3
2012-11-03 00:00:00adminsetstatus: dr -> drwp
2012-09-24 00:00:00adminsetmessages: + msg4010
2012-02-27 00:00:00adminsetmessages: + msg3820
2012-02-27 00:00:00adminsetstatus: ready -> dr
2011-05-03 00:00:00admincreate