Title
Cast from null pointer value in a constant expression
Status
tentatively ready
Section
7.7 [expr.const]
Submitter
Jason Merrill

Created on 2023-10-19.00:00:00 last changed 1 week ago

Messages

Date: 2024-04-19.21:17:21

CWG 2024-04-19

This issue is not a DR.

Date: 2024-03-18.12:50:42

CWG 2023-12-01

CWG seeks approval from EWG for the design direction. See paper issue 1698.

EWG 2024-03-18

EWG approves.

Date: 2023-12-02.13:35:39

Proposed resolution (approved by CWG 2023-12-01):

Change in 7.7 [expr.const] bullet 5.14 as follows:

  • ...
  • a conversion from a prvalue P of type “pointer to cv void” to a pointer-to-object type T unless P is a null pointer value or points to an object whose type is similar to T;
  • ...
Date: 2023-12-02.13:35:39

Subclause 7.7 [expr.const] bullet 5.14 was amended by P2738R1 to support certain casts from void* to object pointer types. The bullet specifies:

  • ...
  • a conversion from a prvalue P of type “pointer to cv void” to a pointer-to-object type T unless P points to an object whose type is similar to T;
  • ...

This wording does not, but should, support null pointer values. The implementation burden is negligible.

History
Date User Action Args
2024-04-19 21:17:21adminsetmessages: + msg7668
2024-04-19 21:17:21adminsetstatus: review -> tentatively ready
2023-12-02 13:35:39adminsetmessages: + msg7534
2023-12-02 13:35:39adminsetmessages: + msg7533
2023-12-02 13:35:39adminsetstatus: open -> review
2023-10-19 00:00:00admincreate