<table border="1" cellspacing="0" cellpadding="8">
    <tr>
        <th>Issue</th>
        <td>
            <a href=https://github.com/llvm/llvm-project/issues/101500>101500</a>
        </td>
    </tr>

    <tr>
        <th>Summary</th>
        <td>
            [libc++] Add tests for strict-weak-ordering checks using __comp_ref_type
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            libc++,
            hardening
      </td>
    </tr>

    <tr>
      <th>Assignees</th>
      <td>
      </td>
    </tr>

    <tr>
      <th>Reporter</th>
      <td>
          ldionne
      </td>
    </tr>
</table>

<pre>
    We currently support catching some invalid strict-weak-orderings when passed to algorithms. This is done in two ways, first there is `__check_strict_weak_ordering_sorted` in https://github.com/llvm/llvm-project/blob/main/libcxx/include/__debug_utils/strict_weak_ordering_check.h#L28, and there is `__debug_less` in https://github.com/llvm/llvm-project/blob/main/libcxx/include/__algorithm/comp_ref_type.h#L59.

The latter is basically untested, and as we move away from using `__comp_ref_type` (because we all kinda hate that type), we are regressing how many algorithms can catch invalid strict-weak-orderings. This issue tracks adding tests for that and also probably designing a better principled way of doing these checks in the first place.
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJy0lEGL4zgQhX-NfCk6KEqcjg8-9Ezj0x4H9mhKUsXStiwZldyZ_PtFTvdsGJqFPSyEGOzyq_dKXxmZ_RSJetF-E-1rg2txKffB-hQjNTrZW_8ngVlzpljCDXhdlpQLGCzG-TgBp5nAx3cM3gKX7E15uhK-PaVsKfs4MVwdRViQmSyUBBimlH1xM-_gh_MMnsGmWFWgXBNc8cZCfYeLz1ygOMpUS8RJjqNxZN7Ge5uxthk_24ycciErTrLquFIWFocXoQahhskXt-qdSbNQQwjvn5enJae_yBShBh2SFmqY0cf60Gvz86dQg48mrJaEGsbRkl6ncS0-sFDDlx42ezsn1OEPda4ZMNrfEtxVAjH_j1Z_jViowaR5GTNdxnJb6O6t7XZCvgr5cv__4QgClkK5utTI3mAIN1hjIa4z_QiCDFeCOb0T4BVvcMlphpUrBffDeexU0wl11mRwZaovYgjw5qNFcFgIisMCW6XqaodakQkyTZl4E3XpCjPG2wMxYDDe2ft35n6RxStByWjeGNDaqlozMVxSvjvYggVOsOSkUYcbWKo7UUsRNG1jWbKPxi-BbKUT0gVs2rQcMcF26rzh6-gD2yWgoV1j-4PtDh021O-flWpV28lT4_oOre7s2Up50grJmCMen58veHhW6mhM1_heSXWUZ7nft6qV7a7t8NwdLEqp9KXrTuIoaUYfdpWOXcpTs4Xt93LfStkE1BR4W2ulKiNCfdt-SqjvQimH2VINWe-0r03uN8r0OrE4yuC58D_KxZewfSIehNpXeLH2YZpfncPnaO6Q_EZIs-bQ_2f6t5R1AT-Cvvfq7wAAAP__SxiizQ">