mirror of
https://github.com/llvm/llvm-project.git
synced 2025-04-28 06:46:07 +00:00

According to [[template.bitset.general]](https://eel.is/c++draft/template.bitset.general), `std::bitset` is supposed to have only one (public) member typedef, `reference`. However, libc++'s implementation of `std::bitset` offers more that that. Specifically, it offers a public typedef `const_reference` and two private typedefs `size_type` and `difference_type`. These non-standard member typedefs, despite being private, can cause potential ambiguities in name lookup in user-defined classes, as demonstrated in issue #121618. Fixing the public member typedef `const_reference` is straightforward: we can simply replace it with an `__ugly_name` such as `__const_reference`. However, fixing the private member typedefs `size_type` and `difference_type` is not so straightforward as they are required by the `__bit_iterator` class and the corresponding algorithms optimized for `__bit_iterator`s (e.g., `ranges::fill`). This PR fixes the member typedef `const_reference` by using uglified name for it. Further work will be undertaken to address `size_type` and `difference_type`. Follows up #80706, #111127, and #112843,