<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/75924>75924</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
missing branch coverage in defaulted operator<=>
</td>
</tr>
<tr>
<th>Labels</th>
<td>
new issue
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
hanickadot
</td>
</tr>
</table>
<pre>
For code:
```c++
#include <compare>
struct foo {
char value;
friend auto operator<=>(foo, foo) = default;
};
int main() {
auto a1 = foo{0} <=> foo{1};
auto a2 = foo{1} <=> foo{0};
auto a3 = foo{0} <=> foo{0};
}
```
There shouldn't be any missing branch. But some `false` path is never taken. This makes 100% test-coverage impossible.
```
1| |#include <compare>
2| |
3| |struct foo {
4| | char value;
5| 15| friend auto operator<=>(foo, foo) = default;
------------------
| Branch (5:45): [True: 100.00%, False: 0.00%]
------------------
6| |};
7| |
8| 1|int main() {
9| 1| auto a1 = foo{0} <=> foo{1};
10| 1| auto a2 = foo{1} <=> foo{0};
11| 1| auto a3 = foo{0} <=> foo{0};
12| 1|}
```
This happens to other types I tried even `std::string`
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJysVMtu6zgM_Rp6QzTQw4944UUeE2D2_QHZZmJNbcmQ5Az69wOpTRqjuXMxxRiGbFA8hxTFQ-W9vhiiBoo9FMdMLWGwrhmU0d2b6m3IWtu_NyfrsLM9gdwBOwK7rSX7eDsQ-_h-WIXUphuXnhDkobPTrByB_OMR6YNbuoBnaxGqTxxiNyiHVzUuBPJuPDtNpke1BIt2JqeCdSAPII-RU2zP1oI4YPrUCPKIPZ3VMoY7B1THr_-0ahNwUtqA2CbQVwopjOKJJ1JWewbVEe8BP438kfOGEg8o_gzFnqHk72KtUPF_XfvHc70O5Aj9YJexNyCqgC2hMu84ae-1uWDrlOmGDe6XgN5OhFCysxo9QclwVmFA7dHQlRwG9UZmg6-D9jipN_LIGQNRYCAfXjp7JacuhHqarfe6HWnztDVuh0XkUB3w44Hq8O9dEp1E9I-ed4tcMTzvIcR85fWLrkIs4iZP6__QY4gv357PnRRhnwqPILYFyF1egKhB7hCK_auLie1idTepwDHSKd2J3OHNVhx_G6dc13fVaojVevdu397t8X5-LQzEOhUsuf9MJcjZKthPdYOcP-X5b0qKYHE70l1WsTzfWvcmLu1xUPNMxmNslDBEmbzP5PFPDE5Tj3QlEwl86OOslHHQaXOBkmV9I_ta1iqjhldM1NtK5DwbGl4JWVJbV-22bM91R-ey6s5c9WW9ZSX1mW4EE5ILXnPBmKw3nOVbKXLqi5zqvK0gZzQpPW7G8TptrLtk2vuFmqqoRZ6NqqXRpwEvhKG_MW2CEHHeuyZiXtrl4iFno_bBf7EEHUZq1qMDv4RvbiKg_rtossWNzRDC7GMdxAnE6aLDsLSbzk4gTjHI5-dldvYv6gKIU0rNgzil1P8JAAD__2jwwQY">