This is an unofficial snapshot of the ISO/IEC JTC1 SC22 WG21 Core Issues List revision 113d. See http://www.open-std.org/jtc1/sc22/wg21/ for the official list.

2024-03-20


1423. Convertibility of nullptr to bool

Section: 7.3.14  [conv.fctptr]     Status: CD3     Submitter: Dave Abrahams     Date: 2011-12-04

[Moved to DR at the October, 2012 meeting.]

The resolution of issue 654 (found in paper N2656) enabled conversion of rvalues of type std::nullptr_t to bool. It appears that the use cases for this conversion are primarily or exclusively the “contextually converted to bool” cases, with some possibility for inadvertent misuse in other contexts. Paper N2656 mentioned the idea of limiting the conversions to the direct initialization contexts; that possibility should be reexamined.

Proposed resolution (February, 2012):

Change 7.3.14 [conv.fctptr] paragraph 1 as follows:

...any other value is converted to true. A For direct-initialization (9.4 [dcl.init]), a prvalue of type std::nullptr_t can be converted to a prvalue of type bool; the resulting value is false.