Constant destruction of constexpr references
tentatively ready
7.7 [expr.const]
Jiang An

Created on 2022-02-08.00:00:00 last changed 3 days ago


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: 2022-02-08.00:00:00

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.

Date User Action Args
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