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
(From submission #597.)
Paper P3144R2 (Deleting a Pointer to an Incomplete Type Should be Ill-formed), approved in June, 2024, only covered deletion of incomplete class types. However, enumeration types can also be incomplete per 9.7.1 [dcl.enum] paragraph 6:
An enumeration whose underlying type is fixed is an incomplete type until immediately after its enum-base (if any), at which point it becomes a complete type. An enumeration whose underlying type is not fixed is an incomplete type until the closing } of its enum-specifier , at which point it becomes a complete type.
This leads to the following example that ought to be ill-formed as well:
enum E { zero = decltype(delete static_cast<E*>(nullptr), 0){} };
Suggested resolution:
Change in 7.6.2.9 [expr.delete] paragraph 4 as follows:
If the static type of the objectbeingto be deleted has incompleteclasstype at the point of deletion, the program is ill-formed.
CWG 2024-09-13
Since an enumeration type can never have a user-declared destructor, there is no risk of introducing undefined behavior that would be prevented by making deletions involving incomplete enumeration types ill-formed. In short, the situation discussed in this issue is harmless and thus lacks rationale to be made ill-formed.