Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[libc++] bitset has non-conforming member typedef-names iterator and const_iterator #111125

Closed
frederick-vs-ja opened this issue Oct 4, 2024 · 0 comments · Fixed by #111127
Closed
Assignees
Labels
libc++ libc++ C++ Standard Library. Not GNU libstdc++. Not libc++abi.

Comments

@frederick-vs-ja
Copy link
Contributor

Currently, the following program doesn't compile with libc++ because libc++'s bitset has non-conforming iterator and const_iterator members (despite being private). Godbolt link.

#include <bitset>

struct R {
    using iterator = int*;
    using const_iterator = const int*;
};

struct Derived : R, std::bitset<42> {};

int main()
{
    Derived::iterator i [[maybe_unused]]{};
    Derived::const_iterator j [[maybe_unused]]{};
}

typedef __bit_iterator<__bitset, false> iterator;
typedef __bit_iterator<__bitset, true> const_iterator;

typedef __bit_iterator<__bitset, false> iterator;
typedef __bit_iterator<__bitset, true> const_iterator;

typedef __bit_iterator<__bitset, false> iterator;
typedef __bit_iterator<__bitset, true> const_iterator;

These iterator types are themselves useful, so I think we should just __uglify these typedef-names.

@github-actions github-actions bot added the libc++ libc++ C++ Standard Library. Not GNU libstdc++. Not libc++abi. label Oct 4, 2024
@frederick-vs-ja frederick-vs-ja self-assigned this Oct 4, 2024
DanielCChen pushed a commit to DanielCChen/llvm-project that referenced this issue Oct 16, 2024
…m#111127)

[template.bitset.general] indicates that `bitset` shouldn't have member
typedef-names `iterator` and `const_iterator`. Currently libc++'s
typedef-names are causing ambiguity in name lookup, which isn't
conforming.

As these iterator types are themselves useful, I think we should just
use __uglified member typedef-names for them.

Fixes llvm#111125
bricknerb pushed a commit to bricknerb/llvm-project that referenced this issue Oct 17, 2024
…m#111127)

[template.bitset.general] indicates that `bitset` shouldn't have member
typedef-names `iterator` and `const_iterator`. Currently libc++'s
typedef-names are causing ambiguity in name lookup, which isn't
conforming.

As these iterator types are themselves useful, I think we should just
use __uglified member typedef-names for them.

Fixes llvm#111125
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
libc++ libc++ C++ Standard Library. Not GNU libstdc++. Not libc++abi.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant