Title
Constant destruction of constexpr references
Status
c++23
Section
7.7 [expr.const]
Submitter
Jiang An

Created on 2022-02-08.00:00:00 last changed 16 months ago

Messages

Date: 2022-12-03.20:33:18

Proposed resolution (approved by CWG 2022-12-02):

Change in 9.2.6 [dcl.constexpr] paragraph 7 as follows:

A constexpr specifier used in an object declaration declares the object as const. Such an object shall have literal type and shall be initialized. In any constexpr variable declaration, the full-expression of the initialization shall be a constant expression (7.7 [expr.const]). A constexpr variable that is an object, as well as any temporary to which a constexpr reference is bound, shall have constant destruction. [ Example: ... ]
Date: 2023-02-15.00:00:00

[Accepted as a DR at the February, 2023 meeting.]

According to 9.2.6 [dcl.constexpr] paragraph 10, a constexpr variable must have constant destruction. However, 7.7 [expr.const] paragraph 7 only defines constant destruction for objects, not for references. Presumably constexpr references should also be able to have constant destruction, and any temporary object to which such a reference is bound should also be required to have constant destruction.

History
Date User Action Args
2023-07-16 13:00:43adminsetstatus: open -> c++23
2023-07-16 13:00:43adminsetstatus: dr -> open
2023-02-18 18:43:04adminsetstatus: ready -> dr
2023-02-06 20:45:44adminsetstatus: tentatively ready -> ready
2022-12-03 20:33:18adminsetmessages: + msg7078
2022-12-03 20:33:18adminsetstatus: drafting -> tentatively ready
2022-11-20 07:54:16adminsetstatus: open -> drafting
2022-02-08 00:00:00admincreate