Section: 16.4.4.4 [nullablepointer.requirements] Status: New Submitter: Jiang An Opened: 2024-09-18 Last modified: 2024-10-02
Priority: 3
View all other issues in [nullablepointer.requirements].
View all issues with New status.
Discussion:
Currently, 16.4.4.4 [nullablepointer.requirements]/3 requires
"An object p
of type P
can be contextually converted to bool
",
while the core language wording (7.3.1 [conv.general]/4) only says
some expressions can be contextually converted to bool
.
Moreover, the value category and cv-qualification are not mentioned,
presumably both non-const and const P
,
together with all value categories are expected.
[2024-10-02; Reflector poll]
Set priority to 3 after reflector poll.
"This is an improvement, but judging from microsoft/STL 4964, I think we actually want to define a "contextually-boolean-testable" for this."
Proposed resolution:
This wording is relative to N4988.
Modify 16.4.4.4 [nullablepointer.requirements] as indicated:
-3- An objectp
of typeP
can be contextually converted tobool
. The effect shall be as ifp != nullptr
had been evaluated in place ofp
.
Add a row to the bottom of [tab:cpp17.nullablepointer]:
Expression Return type Operational semantics ... ... ... a ? true : false
bool
a != np