CWG Issue 2140 (original) (raw)
This is an unofficial snapshot of the ISO/IEC JTC1 SC22 WG21 Core Issues List revision 118e. See http://www.open-std.org/jtc1/sc22/wg21/ for the official list.
2025-11-05
2140. Lvalue-to-rvalue conversion of std::nullptr_t
Section: 7.3.2 [conv.lval]Status: CD4Submitter: Richard SmithDate: 2015-06-12
[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 typestd::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 volatilestd::nullptr_t variable in a discarded-value expression produces a side effect.
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.10.1 [intro.execution]), and an inactive member of a union (11.5 [class.union]) may be accessed. —_end note_]
- ...