Title
Implicit-lifetime aggregates
Status
open
Section
11.2 [class.prop]
Submitter
Davis Herring

Created on 2022-06-27.00:00:00 last changed 1 month ago

Messages

Date: 2022-06-27.00:00:00

Subclause 11.2 [class.prop] paragraph 9 specifies:

A class S is an implicit-lifetime class if
  • it is an aggregate or
  • it has at least one trivial eligible constructor and a trivial, non-deleted destructor.

However, an aggregate may have a non-deleted non-trivial destructor:

  struct X {
    Y i;
    ~X();
  };

This class is an aggregate, but destroying X itself (ignoring the subobjects) does not satisfy "destroying an instance of the type runs no code".

Possible resolution:

Change in 11.2 [class.prop] paragraph 9 as follows:

A class S is an implicit-lifetime class if
  • it is an aggregate whose destructor is not user-provided or
  • it has at least one trivial eligible constructor and a trivial, non-deleted destructor.
History
Date User Action Args
2022-06-27 00:00:00admincreate