[PATCH] Add __gnu_test::NullablePointer utility to testsuite
Jonathan Wakely
jwakely@redhat.com
Tue May 14 20:01:00 GMT 2019
On 14/05/19 19:09 +0200, Daniel Krügler wrote:
>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; }
Argh! I changed that to test something and then didn't change it back
before committing.
It looks like we need a testsuite for our testsuite utilities.
Fixed with this patch, tested ppc64le-linux and committed to trunk.
Thanks for the diligent checks!
-------------- next part --------------
A non-text attachment was scrubbed...
Name: patch.txt
Type: text/x-patch
Size: 946 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/libstdc++/attachments/20190514/93b70de4/attachment.bin>
More information about the Libstdc++
mailing list