-
Type: Bug
-
Resolution: Fixed
-
Priority: Major - P3
-
Affects Version/s: None
-
Component/s: None
-
None
-
Fully Compatible
-
ALL
-
Execution Team 2021-12-13
The RadixStore::radix_iterator class defines operator== and operator!= without declaring them const. When building in C++20 mode, clang-12 complains:
src/mongo/db/storage/ephemeral_for_test/ephemeral_for_test_sorted_impl.cpp:952:24: error: ISO C++20 considers use of overloaded operator '==' (with operand types 'StringStore::const_iterator' (aka 'radix_iterator<const std::pair<const std::basic_string<char>, std::basic_string<char>> *, const pair<const std::basic_string<char>, std::basic_string<char>> &>') and 'mongo::ephemeral_for_test::RadixStore<std::basic_string<char>, std::basic_string<char>>::const_iterator' (aka 'radix_iterator<const std::pair<const std::basic_string<char>, std::basic_string<char>> *, const pair<const std::basic_string<char>, std::basic_string<char>> &>')) to be ambiguous despite there being a unique best viable function [-Werror,-Wambiguous-reversed-operator] if (_forwardIt == _workingCopy->end()) { ~~~~~~~~~~ ^ ~~~~~~~~~~~~~~~~~~~ src/mongo/db/storage/ephemeral_for_test/ephemeral_for_test_radix_store.h:148:14: note: ambiguity is between a regular call to this operator and a call with the argument order reversed bool operator==(const radix_iterator& other) { ^
The iterator class should be re-worked to allow the [in]equality operators to be defined as const. In the meantime, we will suppress this warning.
- related to
-
SERVER-61874 Complete TODO listed in SERVER-60031
- Closed