[all-commits] [llvm/llvm-project] 77f2cc: [STLExtras] Add out-of-line definition of friend o...

Utkarsh Saxena via All-commits all-commits at lists.llvm.org
Thu Jan 11 01:50:01 PST 2024


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 77f2ccbaac5e05e14827247ea8f6cc0f9d214390
      https://github.com/llvm/llvm-project/commit/77f2ccbaac5e05e14827247ea8f6cc0f9d214390
  Author: Utkarsh Saxena <usx at google.com>
  Date:   2024-01-11 (Thu, 11 Jan 2024)

  Changed paths:
    M llvm/docs/ReleaseNotes.rst
    M llvm/include/llvm/ADT/STLExtras.h

  Log Message:
  -----------
  [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




More information about the All-commits mailing list