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

    <tr>
        <th>Summary</th>
        <td>
            [Clang] Implement the `__builtin_type_order` intrinsic for P2830R10 Constexpr Type Ordering
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            clang:frontend,
            c++26
      </td>
    </tr>

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

    <tr>
      <th>Reporter</th>
      <td>
          frederick-vs-ja
      </td>
    </tr>
</table>

<pre>
    Recently, GCC & libstdc++ has implemented [P2830R10](https://wg21.link/p2830r10) Constexpr Type Ordering (per gcc-mirror/gcc@29c7661c6f92d80f63a9a3cc37f3dc790a161f3f). A new intrinsic `__builtin_type_order` is added for this. It's probably better to have this intrinsic in Clang to improve compatibility with GCC.

If I understood correctly, `__builtin_type_order(T, U)` returns a `std::strong_ordering` value equal to `strcmp(mangled-name(T), mangled-name(U)) <=> 0`.
</pre>
<img width="1" height="1" alt="" src="http://email.email.llvm.org/o/eJx8U02P4zYM_TX0hUggU7FjH3zIJE0xpxaL7XkgS7SjXVlyJTnb_PtCmdl-AduTAfLx8fnpUaVkZ888QPMCzaVSW76FOEyRDUerv-7uafdFVWMwj-ETa_bZPYDO-PP5jEAtOjumbDTQC9AL3lRCu6yOF_aZDULz8it1UnyqBTQXoO6W85pAnoCuQNdvM9V7Z_1XoOtacLEWQD2eg0-Z_1gjfn6sjL_EosXPCNStHHHWerfYGEMEus5aw0FQr49tW-t26sl0Ymql6pXUWh4nafSxF6pu60lOQP0eT-j5G1qfo_XJaoRWvL2Nm3XZ-rf8WPktlI3QCrQJlTFscAoR882mPb5moGPCNYZRje6BI-fMEXPAm7rzE_QPbuvx7JSfS98uawx3Rh2WVWU7WmfzA7_ZfCt27kGcQJxeJ3zFzRuOKYdgUIcYWX-4_iOl1H0u7d-A-qI6ct6iT6jKQMqmGC5PKcfg5_cJ6-cCvCu3MfLvm3JF4BMd9bICdYvys2Oz82rhd_6-rPhP-bmRegR5BnkB-RMKaMW-MoM0vexVxUN9bOpGHkTTV7ehN5PgVhxVPYlGGurYTMeepGajjTGisgMJasRRSNHXh7rfC1GPxggpjO4OjSA4CF6UdXvn7ss-xLmyKW081Ie2k13l1MguPdNMpIvzIE9TDD6zN0AEdC6N97xSWyrNpYpDYduN25zgIJxNOf3Nn212z_t4PiQ0F3z9HnHMN_7f-PyVg5Kf76fwo3xXW3TDvy9ktvm2jXsdFqBrUfTx2a0xfGGdga7P309A1w8H7gP9GQAA__9vizh0">