[all-commits] [llvm/llvm-project] 8fe609: [libc++][spaceship] Fixed `__debug_three_way_comp`...

Hristo Hristov via All-commits all-commits at lists.llvm.org
Fri Jun 9 20:48:16 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 8fe609cb3a701a7f2136e670cb70aa8ffb0ca5e1
      https://github.com/llvm/llvm-project/commit/8fe609cb3a701a7f2136e670cb70aa8ffb0ca5e1
  Author: Hristo Hristov <zingam at outlook.com>
  Date:   2023-06-10 (Sat, 10 Jun 2023)

  Changed paths:
    M libcxx/include/__algorithm/three_way_comp_ref_type.h
    M libcxx/test/std/algorithms/alg.sorting/alg.three.way/lexicographical_compare_three_way_comp.pass.cpp

  Log Message:
  -----------
  [libc++][spaceship] Fixed `__debug_three_way_comp`'s `operator()` for `vector<bool>'s `operator<=>`

An issue with `operator()` was found during the implementation of https://reviews.llvm.org/D132268.

This patch aims to resolve the issues by updating the operator to use perfect forwarding.

The original motivation for `three_way_comp_ref_type` is given in: https://reviews.llvm.org/D131395

`three_way_comp_ref_type`'s implementation is inspired by `comp_ref_type`, which has two overloads:

```
    template <class _Tp, class _Up>
    bool operator()(const _Tp& __x,  const _Up& __y);

    template <class _Tp, class _Up>
    bool operator()(_Tp& __x,  _Up& __y);
```

`__debug_three_way_comp` is missing the first overload and also declares the typealias`_three_way_comp_ref_type ` incorrectly.

Reviewed By: #libc, philnik

Differential Revision: https://reviews.llvm.org/D150188




More information about the All-commits mailing list