-
Notifications
You must be signed in to change notification settings - Fork 1.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
<memory>
: !_Get_ptr()
in the destructors of inout_ptr_t
and out_ptr_t
_should_ be correct
#4964
Comments
[nullablepointer.requirements]:
Pedantically, this doesn't require |
Sounds like that contextual version of boolean-testability is wanted. |
<memory>
: Should we avoid !_Get_ptr()
in the destructors of inout_ptr_t
and out_ptr_t
?<memory>
: We should avoid !_Get_ptr()
in the destructors of inout_ptr_t
and out_ptr_t
We talked about this at the weekly maintainer meeting. The fact that the Majestic Three implementations all want |
<memory>
: We should avoid !_Get_ptr()
in the destructors of inout_ptr_t
and out_ptr_t
<memory>
: !_Get_ptr()
in the destructors of inout_ptr_t
and out_ptr_t
_should_ be correct
I guess it's intentional that implicit convertibility to |
This is LWG-4155. (Good point about not wanting implicit conversions to |
Describe the bug
Currently
!_Get_ptr()
is used in the destructors ofinout_ptr_t
andout_ptr_t
.STL/stl/inc/memory
Lines 4409 to 4411 in a26f4ad
STL/stl/inc/memory
Lines 4328 to 4330 in a26f4ad
However, it seems that nothing in Cpp17NullablePointer ([nullablepointer.requirements]) requires
!p
to be semantically equivalent top != nullptr
or even to be well-formed. E.g. a type with a deleted memberoperator!
(theNoExclamation
type shown below) can still meet the Cpp17NullablePointer requirements.Currently no implementation accepts the example due to the deleted
operator!
.Command-line test case
Godbolt link
Expected behavior
Perhaps the program should compile.
STL version
a26f4ad (probably every version after #1998)
Additional context
As libc++ and libstdc++ also expect usable
operator!
, should there be an LWG issue to make current implementation strategies comforming?The text was updated successfully, but these errors were encountered: