boostorg / fiber

userland threads
464 stars 108 forks source link

Add missing const on comparison operators #294

Closed ecatmur closed 2 years ago

ecatmur commented 2 years ago

This is detected as an error in C++20 (spaceship) in clang 14, since the operators become ambiguous against reversed candidates.

ecatmur commented 2 years ago
src/numa/linux/topology.cpp:165:17: error: ISO C++20 considers use of overloaded operator '!=' (with operand types '(anonymous namespace)::directory_iterator' and '(anonymous namespace)::directory_iterator') to be ambiguous despite there being a unique best viable function with non-reversed arguments [-Werror,-Wambiguous-reversed-operator]
              i != e; ++i) {
              ~ ^  ~
src/numa/linux/topology.cpp:75:10: note: candidate function with non-reversed arguments
    bool operator!=( directory_iterator const& other) {
         ^
src/numa/linux/topology.cpp:71:10: note: ambiguous candidate function with reversed arguments
    bool operator==( directory_iterator const& other) {
         ^
1 error generated.
olk commented 2 years ago

ty