PR libstdc++/90945 Patch to have pretty printer for std::vector<bool> return bool intead of int for elements
Jonathan Wakely
jwakely@redhat.com
Thu Jun 20 09:08:00 GMT 2019
On 20/06/19 08:12 +0200, Stephan Bergmann wrote:
>On 19/06/2019 21:54, Jonathan Wakely wrote:
>>On 19/06/19 21:49 +0200, Michael Weghorn wrote:
>>>On 19/06/2019 21.37, Jonathan Wakely wrote:
>>>>+Â std::vector<bool> vb;
>>>>+Â vb.reserve(100);
>>>>+Â vb.push_back(true);
>>>>+Â vb.push_back(true);
>>>>+Â vb.push_back(false);
>>>>+Â vb.push_back(false);
>>>>+Â vb.push_back(true);
>>>>+Â vb.erase(vb.begin());
>>>>+// { dg-final { regexp-test vb {std::(__debug::)?vector of
>>>>length 4, capacity 100 = \\{true, false, false, true\\}} } }
>>>>+
>>>
>>>This inserts 5 elements, so I'd expect that either "vector of length 5"
>>>and an additional "true" element at the beginning need to be added for
>>>the expected result or one of the two first 'vb.push_back(true)' needs
>>>to be removed.
>>
>>It inserts five then erases one, the test is right.
>
>Just one thought that occurred to me while idly browsing this thread:
>Wouldn't it be better in general to have non-symmetric content to test
>against, to check that the printer doesn't print it in reverse?
It certainly would, good idea! It's not inconceivable that the
bit-shifting code in the printer could be backwards, or affected by
endianness.
Ideally we'd also test a vector<bool> with more than 64 elements, but
I don't have the patience to add it to the test ;-)
Tested x86_64-linux, committed to trunk.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: patch.txt
Type: text/x-patch
Size: 2255 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20190620/725a0e8f/attachment.bin>
More information about the Gcc-patches
mailing list