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

std::type_index equality broken with LIBCPP_HAS_MERGED_TYPEINFO_NAMES_DEFAULT=OFF #44894

Closed
llvmbot opened this issue Apr 15, 2020 · 3 comments
Closed
Assignees
Labels
bugzilla Issues migrated from bugzilla libc++ libc++ C++ Standard Library. Not GNU libstdc++. Not libc++abi.

Comments

@llvmbot
Copy link
Collaborator

llvmbot commented Apr 15, 2020

Bugzilla Link 45549
Resolution FIXED
Resolved on Jan 26, 2021 06:23
Version 9.0
OS All
Reporter LLVM Bugzilla Contributor
CC @k15tfu,@ldionne,@mclow
Fixed by commit(s) 2464d81

Extended Description

When using LIBCXX_HAS_MERGED_TYPEINFO_NAMES_DEFAULT=OFF, distinct classes with the same name, each in a different TU and anonymous namespace, are considered equal by std::type_index.

LIBCXX_HAS_MERGED_TYPEINFO_NAMES_DEFAULT=OFF is used in the libc++ shipped with Xcode as of Xcode 11.4. The bug does not occur in Xcode 11.3.1, the previous version. LIBCXX_HAS_MERGED_TYPEINFO_NAMES_DEFAULT was introduced in 2405bd6 for LLVM 9.0.0.

See https://gist.github.com/ryb-ableton/1805b61e2d0976de4ba04c2aa2f5992b for a minimal test case.

May be related to #34255


Steps to reproduce on Linux/x86:

  1. Build and install libc++ 9.0 or 10.0 by passing -DLIBCXX_HAS_MERGED_TYPEINFO_NAMES_DEFAULT=OFF to cmake
  2. Download and extract a zip of the Gist linked above
  3. Run "bash ./build_and_run"

Steps to reproduce on macOS:

  1. Install and select Xcode 11.4, which uses LIBCXX_HAS_MERGED_TYPEINFO_NAMES_DEFAULT=OFF by default
  2. Download and extract a zip of the Gist linked above
  3. Run "bash ./build_and_run"

Actual Output:

Assertion failed: (registry[0] != registry[1]), function main, file main.cpp, line 13.
./run: line 4: 39942 Abort trap: 6 ./test
Failure

Expected Output:

Success

@llvmbot
Copy link
Collaborator Author

llvmbot commented Apr 15, 2020

assigned to @ldionne

@ldionne
Copy link
Member

ldionne commented Apr 27, 2020

Thanks for the report and the nice analysis of the issue!

I fixed the issue on Apple platforms in 2464d81, and I'm adding tests so we don't regress in https://reviews.llvm.org/D78963.

@llvmbot
Copy link
Collaborator Author

llvmbot commented Apr 28, 2020

Nice, thanks for the quick fix!

This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bugzilla Issues migrated from bugzilla libc++ libc++ C++ Standard Library. Not GNU libstdc++. Not libc++abi.
Projects
None yet
Development

No branches or pull requests

2 participants