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++] std::type_index equality broken for anonymous namespace classes with same name with NonUnique implementation #79367

Open
aeubanks opened this issue Jan 24, 2024 · 1 comment
Labels
libc++ libc++ C++ Standard Library. Not GNU libstdc++. Not libc++abi.

Comments

@aeubanks
Copy link
Contributor

// ========================================================================== //
describes the various ways of implementing type_info comparison.

With _LIBCPP_TYPEINFO_COMPARISON_IMPLEMENTATION = 2, classes in different anonymous namespace with the same name are considered equal. #44894 already reported this, but the issue was merely worked around for Apple builds.

I believe libstdc++ handles this correctly by not doing the name comparison when it detects these sorts of anonymous namespace classes: https://github.com/gcc-mirror/gcc/blob/aedfdd340cbb4a97a8f6d432720a4df374c1e467/libstdc%2B%2B-v3/libsupc%2B%2B/typeinfo#L205.

@frederick-vs-ja
Copy link
Contributor

This is essentially a duplicate of #59790 and #34255. (Note that the equality of std::type_index is based on the referenced-to std::type_info.)

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

No branches or pull requests

2 participants