diff options
author | Jonathan Wakely <jwakely@redhat.com> | 2020-08-07 20:29:11 +0100 |
---|---|---|
committer | Giuliano Belinassi <giuliano.belinassi@usp.br> | 2020-08-17 15:07:49 -0300 |
commit | f2e7661aad6ca8b75e9c9c5dc7eb489df52646f6 (patch) | |
tree | b3befdd8a58d1a99c5873276ac677019ca036341 /gcc | |
parent | 10e74e97504463ca890ce0a0e03528f6b0242419 (diff) | |
download | gcc-f2e7661aad6ca8b75e9c9c5dc7eb489df52646f6.zip gcc-f2e7661aad6ca8b75e9c9c5dc7eb489df52646f6.tar.gz gcc-f2e7661aad6ca8b75e9c9c5dc7eb489df52646f6.tar.bz2 |
libstdc++: Fix ambiguous comparisons in __gnu_debug::bitset [PR 96303]
With -pedantic the debug mode bitset has an ambiguous equality
comparison operator, because it tries to compare the non-debug base to
the debug object. The base object can be converted to another debug
bitset, making the same operator== a candidate again.
The fix is to do the comparison on both base objects, so the operator
for the derived type isn't a candidate.
For the inequality operator the same change should be done, but that
operator can be removed entirely for C++20 because it can be synthesized
by the compiler.
I don't think either equality or inequality operators are really needed,
because the public _GLIBCXX_STD_C::bitset base class cam always be
compared using its own comparison operators. I'm not changing that here
though.
libstdc++-v3/ChangeLog:
PR libstdc++/96303
* include/debug/bitset (bitset::operator==): Call _M_base() on
right operand.
(bitset::operator!=): Likewise, but don't define it at all when
default comparisons are supported by the compiler.
* testsuite/23_containers/bitset/operations/96303.cc: New test.
Diffstat (limited to 'gcc')
0 files changed, 0 insertions, 0 deletions