[STLExtras] Add out-of-line definition of friend operator== for C++20 (#72348)
The last attempt at https://github.com/llvm/llvm-project/pull/72220 was reverted by https://github.com/llvm/llvm-project/commit/94d6699bf5eeb5aa4c50d1d90f8bf69b79201ceb because it breaks C++20 build in clang-17 and before. This is a workaround of https://github.com/llvm/llvm-project/issues/70210 and unblocks https://github.com/llvm/llvm-project/pull/72213 which rectifies rewriting template operator and thus introduces new breakages. Moving the function definition out of the class makes clang find a matching `operator!=` for the `operator==`. This makes clang not rewrite the `operator==` with reversed args. Hence, the ambiguity is resolved. The final plan, when https://github.com/llvm/llvm-project/issues/70210 is fixed, is to move these back to inline definition or even convert to a member template operator. This should not be urgent and could even wait for a major clang release including https://github.com/llvm/llvm-project/pull/72213
Loading
Please sign in to comment