<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/118559>118559</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
[libc++] ABI compat breakage using reference type for std::set key_compare
</td>
</tr>
<tr>
<th>Labels</th>
<td>
libc++
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
hubert-reinterpretcast
</td>
</tr>
</table>
<pre>
The following compiled fine with libc++ version 19:
```cpp
#include <set>
struct Cmp {
__int128 x;
bool operator()(__int128, __int128) const;
};
struct MySet {
unsigned char b;
std::set<__int128, const Cmp &> s;
};
extern char q[sizeof(MySet)];
extern char q[40];
```
It no longer compiles with libc++ trunk (https://godbolt.org/z/cTbEovcer). It seems the size of `MySet` has changed because of a change in `std::set`.
The draft release notes (https://libcxx.llvm.org/ReleaseNotes.html#abi-affecting-changes) mention issues with overaligned empty types, but nothing about reference types.
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJxkU8Fu47gS_Br60rAhk5IiHXSwnRjI4b3D7twDkmpJ3FCklmx54vn6BSXbmUwAA6bp6q6qrqaM0fQOsWHFkRXPGznT4EMzzAoDbQMaRximgKRlpI3y7bX5MSB03lr_07getB8nY7GFzjiEn4YGsEZpxo-MH-GCIRrvYF8zcWDZgZXZ-tHTlH5yYZy2c4vAxCkiMfGSrrNDpDBrgtM4AXs6suwA8PZmHO15BR9MrDfKewt-wiDJB8YrxmvGqzuO8RN8nmvQ3kVaS9nT8-3wYPrf9W-kB9fslrG0oAcZQN0JI7XJhzgsUk-_My3dV728ZOIF4ncq_CAMbu35LyuO0fxC3zFeLeRJfXED_4nMs8dfjxGuPV8JnAfrXY_hHkb8lgOF2b0D49VANMXkgZ8ZP_e-Vd7Szoee8fMvxs_6h3rxF42B8XoHrwQRcYxAA0JSC74DVmar3jKDQcYk0vXYgkIt57hA5O0SjEvwL2Mrsx3LDmmJ2iA7goAWZURwnjB-l5hMfHzsrL2MN5l_rQX_T_jdQKNlXEhltrLrUJNx_XYljyn0ER2lBTQxzve5-AsGadd8cZzoCnSdEvwEak7jpCFttlR-TvI6DOg0rqCkfdM2oq1FLTfY7J-E4GVVinozNFW-x07ngtf5HqusLZQShW4zqRXmNS82puEZz_c8E1yITNS7slZPFXZt2eWq0mXB8gxHaezD72YR3uz3VVHUGysV2ri8Vc4_42Wcp7cbmlS1VXMfWZ5ZEyl-9iFDdnnlv5UVz3A4vi5bIwlUQPkue4Q5JvtfjUPnw5f1h3e8vi2VATdzsM0fm2VomNVO-zFlaC_3r-0U_D-oifHzGgnj55u5S8P_CwAA__9UZW-l">