Title
Lvalue-to-rvalue conversion of std::nullptr_t
Status
cd4
Section
7.3.2 [conv.lval]
Submitter
Richard Smith

Created on 2015-06-12.00:00:00 last changed 94 months ago

Messages

Date: 2016-01-15.00:00:00

Proposed resolution (January, 2016):

Change 7.3.2 [conv.lval] bullet 2.3 as follows:

...In all other cases, the result of the conversion is determined according to the following rules:

  • If T is (possibly cv-qualified) std::nullptr_t, the result is a null pointer constant (7.3.12 [conv.ptr]). [Note: Since no value is fetched from memory, there is no side effect for a volatile access (6.9.1 [intro.execution]), and an inactive member of a union (11.5 [class.union]) may be accessed. —end note]

  • ...

Date: 2016-02-15.00:00:00

[Adopted at the February, 2016 meeting.]

The current rules in 7.3.2 [conv.lval] paragraph 2 do not require fetching the value in memory of an object of type std::nullpt_t in order to produce its prvalue. This choice has implications that may not have been considered for questions like whether use of a std::nullptr_t that is an inactive member of a union results in undefined behavior or whether a volatile std::nullptr_t variable in a discarded-value expression produces a side effect.

History
Date User Action Args
2017-02-06 00:00:00adminsetstatus: tentatively ready -> cd4
2016-02-15 00:00:00adminsetmessages: + msg5694
2016-02-15 00:00:00adminsetstatus: drafting -> tentatively ready
2015-06-12 00:00:00admincreate