[all-commits] [llvm/llvm-project] 06673a: [libc++] Uglify non-standard member typedef const_...

Peng Liu via All-commits all-commits at lists.llvm.org
Thu Jan 9 01:43:02 PST 2025


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 06673a9e9b186a65f5eb60a59a4ee9afba6637d4
      https://github.com/llvm/llvm-project/commit/06673a9e9b186a65f5eb60a59a4ee9afba6637d4
  Author: Peng Liu <winner245 at hotmail.com>
  Date:   2025-01-09 (Thu, 09 Jan 2025)

  Changed paths:
    M libcxx/docs/ReleaseNotes/20.rst
    M libcxx/include/bitset
    M libcxx/test/std/utilities/template.bitset/bitset.members/index_const.pass.cpp
    M libcxx/test/std/utilities/template.bitset/bitset.members/nonstdmem.uglified.compile.pass.cpp

  Log Message:
  -----------
  [libc++] Uglify non-standard member typedef const_reference in bitset (#121620)

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,



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list