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

    <tr>
        <th>Summary</th>
        <td>
            [C++20][Modules]  incorrect error regarding ambiguous overloaded operator
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            clang:modules
      </td>
    </tr>

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

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

<pre>
    Tested with 
clang version 17.0.0 (++20230624042319+ee2bf319bc05-1~exp1~20230624042420.1017)

The issue looks similar to #62943 but that fix is this version of clang. Testing this code with libc++'s `std` module
```
import std;
  
int main(int, char**) {
  int t{3};
  std::optional<int> op{3};
  return op <=> t;
}
```
Gives the following compiler output
```
libcxx/test/std/utilities/optional/optional.comp_with_t/compare.three_way.pass.cpp:6:13: error: use of overloaded operator '<=>' is ambiguous (with operand types 'std::optional<int>' and 'int')
    6 |   return op <=> t;
      | ~~ ^ ~
/llvm/build/generic-module-std-cxx23/include/c++/v1/optional:1612:1: note: candidate function [with _Tp = int, _Up = int]
 1612 | operator<=>(const optional<_Tp>& __x, const _Up& __v) {
      | ^
/llvm/build/generic-module-std-cxx23/include/c++/v1/optional:1612:1: note: candidate function [with _Tp = int, _Up = int]
 1612 | operator<=>(const optional<_Tp>& __x, const _Up& __v) {
      | ^
/llvm/build/generic-module-std-cxx23/include/c++/v1/optional:1612:1: note: candidate function [with _Tp = int, _Up = int]
 1612 | operator<=>(const optional<_Tp>& __x, const _Up& __v) {
      | ^
/llvm/build/generic-module-std-cxx23/include/c++/v1/optional:1612:1: note: candidate function [with _Tp = int, _Up = int]
 1612 | operator<=>(const optional<_Tp>& __x, const _Up& __v) {
      | ^
/llvm/build/generic-module-std-cxx23/include/c++/v1/optional:1612:1: note: candidate function [with _Tp = int, _Up = int]
 1612 | operator<=>(const optional<_Tp>& __x, const _Up& __v) {
      | ^
1 error generated.

error: command failed with exit status: 1
```
This is a manual reduction of the file `libcxx/test/std/utilities/optional/optional.comp_with_t/compare.three_way.pass.cpp`
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJzslstu6zYQhp-G3gwiUKQlRQsvfIm76i4H6M6gxLHNlhJVXhxnk2cvRlJso03RTc8ugRDdfg6G34w8vwrBnHrEFSs2TIjtOan-T_NbqpkQrNgtVIpn51ed81r1EReN0--rVwwRNbyZeAbGd4yvW6v6E1zQB-N6yKuMZxyYeGZiw8RGcCF5KZZ8KWReM7FBFM1R5nXT8uIp_8DrkH88iJaCZznPKybqKfz0__WMYEJICNa5PwIE0xmrPEQHTMhS1EsJTYoQzyrC0VzBBIhnE255uSOMiWZAOzD9aXrdOo3TZqxp2illJqoArOQhalZy6JxOFudkSj4f463pBucjkFBupkcwUzF9hE6Znoln00cmttCelWdiPR41sOq2gKSRVRvJqt1DnDHqmsm1G6JxvbJMbimUfAE3_FPuMSbfgxuAyS2TO9LF23vSfrWDX8wFiRTC0Vnr3ghM67rBWPTgUhxS_HId0bpemdhHDJGJPSUr9ikaa6LBwMT-lvX9MqPIB6J9oDV0pzxm8ewRD2_qPRtUCFk7DEyuSybXuWRyDei983SRAlIZ3QW9dUqjBjegV9F5YKK67ZqJiqqvusackkuBenGs8KjuNcT3Aelp9e-EKQZJmajG6t3bEQCgBFZt4b-Qw_hHyo8PYMULfMwkxd7aS8fEvknGErYT9uhN-zR12lOI-qm9XoVkYm_61iaNROuzOfeX_BGvXOdlLuhEjHoXkc6t6rXRKiIcU9-SFFixGTEcXinfHcxtefhxvy3mJgEKOab-SfiB7nPr-hDhgdnhdRjflHA4XMdWHxWHH8P07PK3hv_kwoqXbyTfSL6RfCP5_5Dk08CAEYSKqLNHH3EbJq3rOvqFPypjP_0MXg0NcxVTIEn-5eR7JdtA8wU61SdlwaNOExV3nCapsUj-4SfPyJIv9ErqWtZqgau8fK6quljmy8V5JXLR1rVGzpe1arksCy5roY8Fl82x1WphVrPlKvOSS1FlpWzK5_xY1GqJWssjW3LslLEZtVfm_Gkxuq9VKQvJF1Y1aMPsG0dbxeR66rgwm0e_opVPTToFtuTWhBjusaKJdrSd20-TSO1SbH6dQxQ7ckWt8x7bONfT40l5Tf7kPtm_sAKL5O3qHONAJWRiT5-EiefUENj75zImN3j3O7aEedwcVWTc318BAAD__7ykUY4">