<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/121618>121618</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
`std::bitset` has non-conforming member typedefs `size_type`, `difference_type`, and `const_reference`
</td>
</tr>
<tr>
<th>Labels</th>
<td>
new issue
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
winner245
</td>
</tr>
</table>
<pre>
Due to the presence of non-conforming member typedef-names in `std::bitset`, the following program fails to compile in libc++ (while it compiles successfully in libstdc++ and MSVC):
https://godbolt.org/z/4EGY13eah
```cpp
#include <bitset>
struct MyBase {
using const_reference = const int&;
using size_type = unsigned;
using difference_type = int;
};
struct MyDerived : MyBase, std::bitset<42> {};
int main() {
MyDerived::const_reference r{};
MyDerived::size_type s{};
MyDerived::difference_type d{};
}
```
#### Affected Lines:
https://github.com/llvm/llvm-project/blob/e3dafa88a8f651825ac65aad9b273983598279dd/libcxx/include/bitset#L170-L174
https://github.com/llvm/llvm-project/blob/e3dafa88a8f651825ac65aad9b273983598279dd/libcxx/include/bitset#L433-L436
https://github.com/llvm/llvm-project/blob/e3dafa88a8f651825ac65aad9b273983598279dd/libcxx/include/bitset#L550-L553
https://github.com/llvm/llvm-project/blob/e3dafa88a8f651825ac65aad9b273983598279dd/libcxx/include/bitset#L622
#### Proposed Solution:
To fix this, we should either uglify or remove the non-conforming typedefs:
- uglify `const_reference` as `__const_reference`;
- remove `size_type` and `difference_type` typedefs:
- `difference_type` is not used at all and thus can be safely removed.
- `size_type` is a synonym of `size_t` and can be replaced by `size_t`.
</pre>
<img width="1" height="1" alt="" src="http://email.email.llvm.org/o/eJzMVU1v4zYQ_TX0ZWBDGurzoEMSx71kgQJbFOgpoMSRxYIiDZJK4v31BWXZcZzdBXoLQMAW5_HxzRdHeK_2hqhh-T3LtysxhcG65lUZQw6zfNVaeWy2E0GwEAaCgyNPpiOwPRhr1p01vXWjMns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