[PATCH] Add __gnu_test::NullablePointer utility to testsuite
Daniel Krügler
daniel.kruegler@gmail.com
Tue May 14 17:09:00 GMT 2019
Am Di., 14. Mai 2019 um 13:20 Uhr schrieb Jonathan Wakely <jwakely@redhat.com>:
>
> * testsuite/20_util/allocator_traits/members/allocate_hint_nonpod.cc:
> Use operator-> to access raw pointer member.
> * testsuite/23_containers/vector/59829.cc: Likewise.
> * testsuite/23_containers/vector/bool/80893.cc: Likewise.
> * testsuite/libstdc++-prettyprinters/cxx11.cc: Use NullablePointer.
> * testsuite/util/testsuite_allocator.h (NullablePointer): New utility
> for tests.
> (PointerBase, PointerBase_void): Derive from NullablePointer and use
> its constructors and equality operators. Change converting
> constructors to use operator-> to access private member of the other
> pointer type.
> (PointerBase_void::operator->()): Add, for access to private member.
> (operator-(PointerBase, PointerBase)): Change to hidden friend.
> (operator==(PointerBase, PointerBase)): Remove.
> (operator!=(PointerBase, PointerBase)): Remove.
>
> There are probably more places in the testsuite that could use
> NullablePointer as a minimally-conforming type that meets the
> Cpp17NullablePointer requirements, instead of defining a new type each
> time one is needed.
>
> Tested powerpc64le-linux, committed to trunk.
>
In the primary template of NullablePointer we have:
explicit operator bool() const noexcept { return value == nullptr; }
This is incorrect according to the NullablePointer requirements, it needs to be:
explicit operator bool() const noexcept { return value != nullptr; }
- Daniel
More information about the Libstdc++
mailing list