Created on 2025-07-03.00:00:00 last changed 1 month ago
Suggested resolution:
Change in 11.4.7 [class.dtor] paragraph 7 as follows:
A defaulted destructor for a class X is defined as deleted if
- X is a non-union class and any non-variant potentially constructed subobject has class type M (or possibly multidimensional array thereof) where M has a destructor that is deleted or is inaccessible from the defaulted destructor,
- X is a union and there is a subobject S of class type M (or possibly multi-dimensional array thereof) where M has a destructor that is deleted, inaccessible from the defaulted destructor, or non-trivial, and either
- overload resolution to select a constructor to default-initialize an object of type X either fails or selects a constructor that is either deleted or
not trivialuser-provided, orX has a variant member V of class type M (or possibly multi-dimensional array thereof) where VS has a default member initializerand M has a destructor that is non-trivial, or,- for a virtual destructor, lookup of the non-array deallocation function results in an ambiguity or in a function that is deleted or inaccessible from the defaulted destructor.
(From submission #722.)
Paper P3074R7 added an overly aggressive rule to delete destructors of unions, making the following example have a deleted destructor:
union U { U(int i) : i(i) { } int i; };
History | |||
---|---|---|---|
Date | User | Action | Args |
2025-07-27 10:49:11 | admin | set | messages: + msg8055 |
2025-07-03 00:00:00 | admin | create |