Title
Cpp17NullablePointer should require that some expression can be contextually converted to bool
Status
new
Section
[nullablepointer.requirements]
Submitter
Jiang An

Created on 2024-09-18.00:00:00 last changed 2 weeks ago

Messages

Date: 2024-10-02.12:43:09

Proposed resolution:

This wording is relative to N4988.

  1. Modify [nullablepointer.requirements] as indicated:

    -3- An object `p` of type `P` can be contextually converted to `bool`. The effect shall be as if `p != nullptr` had been evaluated in place of `p`.

  2. Add a row to the bottom of [tab:cpp17.nullablepointer]:

    ExpressionReturn typeOperational semantics
    ... ... ...
    `a ? true : false` `bool` `a != np`
Date: 2024-10-15.00:00:00

[ 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."

Date: 2024-09-18.00:00:00

Currently, [nullablepointer.requirements]/3 requires "An object `p` of type `P` can be contextually converted to `bool`", while the core language wording ([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.

History
Date User Action Args
2024-10-02 12:43:09adminsetmessages: + msg14407
2024-09-18 20:08:38adminsetmessages: + msg14373
2024-09-18 00:00:00admincreate