This page is a snapshot from the LWG issues list, see the Library Active Issues List for more information and the meaning of New status.
4155. Cpp17NullablePointer should require that some expression can be contextually converted to boolSection: 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 object
p
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
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4