<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/115326>115326</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
[libc++] Rejects-valid on unexpected(1) == unexpected(1L)
</td>
</tr>
<tr>
<th>Labels</th>
<td>
libc++
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
frederick-vs-ja
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
ldionne
</td>
</tr>
</table>
<pre>
Minimal reproducer:
```
#include <expected>
static_assert(std::unexpected(1) == std::unexpected(1L));
```
Output:
```
__expected/unexpected.h:111:31: error: '__unex_' is a private member of 'std::unexpected<long>'
111 | return __x.__unex_ == __y.__unex_;
| ^
```
Godbolt: https://godbolt.org/z/a8rPnKz1Y
The fix is to use `__y.error()` instead of `__y.__unex_`.
This was originally discovered in https://github.com/Quuxplusone/llvm-project/issues/40.
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJx8U8tu6zYQ_ZrRhrAgDq3XQgsnjrpoiz7QTVcCJY5tprRo8OE6-foLys7j3ptEGBAQOXPmnAMc6b3ez0QdlHeAuHOkyOnpv9XZrx4lIEK5zWQMB-s6o7SdZ8pGq5663_Wsj9IwRydnVZzIgdhAsYViA1Vxq-svCj1PJipiIO7pcqIpkALxcH32QQY9DdJ7cgGw8UElJLGJ82svNhywZSC2ILbsk47fANtU4u5jGsv5RwynGD6jOgxvgP0ben4AseGcg9iIdDByzia9DLAehtQ4ANZMeybZyemzDMSOdBzJMbtLTR9RFvfGzvvkA9bX9YxxzhnU98xRiG5mw3DJb_gv4ofh6eXqVSlbvjQH5cMX4n-xarQmqWeHEE4-UcIesN9fH3Lr9oD9M2AvG_fn_Osz__f9_D8HYjt9STqDZdETg6pIhK5-YJPsrwqmZx9IqkX7teGFcVXk3wNqz_6Xnlmn93qWxjwxpf1kz-RIMT3_yFOHQxzzyR4B-79ivJxM9HYmwN6Y83F1cvaRpgDYa-8jecB-XeSZ6oRqRSsz6ngtirYtynKdHbp2Um254zuFI28UjlUzFmMjxnKcplbVu0x3WOCa86Lm6zUKzMVYERZlXUrVYjU1sC7oKLXJ0_pkX7Ys7jgvBVaZkSMZf8uW0eMEeLfUEivXLaTHuPewLoz2wb_hBB3Mksp3Y-WW_U1JoF-dpdGK2Zl9mpKfw5FFZ7ovDE27v3Dypunc4bcAAAD__61rQmQ">