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

    <tr>
        <th>Summary</th>
        <td>
            Default spaceship operator does not work with bitfields
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            new issue
      </td>
    </tr>

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

    <tr>
      <th>Reporter</th>
      <td>
          slavek-kucera
      </td>
    </tr>
</table>

<pre>
    The following source code
```
#include <compare>

struct X {
    unsigned long long a : 1 = 0;
    auto operator<=>(const X&) const = default;
};

void f() { X() <=> X(); }
```
causes clang to produce the following error messages:
```
<source>:5:46: error: argument to 'operator<=>' cannot be narrowed from type 'unsigned long long' to 'int'
    auto operator<=>(const X&) const = default;
 ^
<source>:8:16: note: in defaulted three-way comparison operator for 'X' first required here
void f() { X() <=> X(); }
 ^
<source>:5:46: error: argument to 'operator<=>' cannot be narrowed from type 'unsigned long long' to 'int'
    auto operator<=>(const X&) const = default;
                                             ^
2 errors generated.
Compiler returned: 1
```
However, a bitfield with length of 33 bits or more works fine.

https://godbolt.org/z/MhPYz65nv
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJzcVE2PszYQ_jXDZbQR2AHCgUM2eaNeKvXQw_Zo8ADuGpv6I9G-v74ybHa3bXqo2lOjyF_DM_PM4xkL79VoiFoon6E8ZyKGybrWa3Gl16fX2JMTWWflW_vzRDhYre1NmRG9ja4n7K0kyM-QH6HK3__blnFleh0lIfBTb-dFOAL-7d26jj642Ad8QaiftxNExGhWRhK1NeM2CAR-xAKBnzEH_uVjEYNFu5ATwTrgJ-DnFIQdemt8wBdgFbAGt12CSxpE1OHDCdTnz_U6Xq2SOAA7JCDUz8nJtr67v58Af8aEf5R_L6Inj70WZsRgcXFWxp4w_EFFcs46nMl7MZIHfnysJT9tcqfU-LEEftxXSZEVnhbCjXEmE1IkYPUDQWrshTE2YEdohHP2RhIHZ2cMbwsl0F91T6jNoTIBWP0fyo5QfnuY3AH4sViTMzZQmpW5o0limBzR00284VZSylvzQQQH6xLbl0R8UM4HdPRbVI4kTuToX93v3zL-X1zHP_l9CMG2jD2OZFJskrvNcLLzojQ5dBSiMyTX9n1Y2z_YG13JATuhwE6FQZGWeFNhQk1mDBPaATlPJo-pV6wjvFn36nFQhnZfO3cKYVmbiF2AXUYrO6vDzroR2OU7sMuP00-_fK9Kc81ky2XDG5FRW1R1wfK8ODTZ1NZSloMYiqI6FNTsh30huWCyPtB-EHlTZaplOWMFK6piX1Ss2e2pL7qcGl7nVc9ZB_ucZqH0TuvrnGJnyvtIbdmUZZFp0ZH261vLmKEbrkZgLD29rk2Ypy6OHva5Vj74Ty9BBU3tebs39IvoyU9q-ax9acmnnlnF2QS8y-mz6HT7J3VUmGK36-0M7JKivE9Pi7O_Uh-AXVZuHthl5f57AAAA__8PLNNJ">