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::hash should not accept std::basic_strings with custom character traits #41221

Closed
llvmbot opened this issue May 14, 2019 · 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 May 14, 2019

Bugzilla Link 41876
Resolution FIXED
Resolved on May 20, 2019 14:57
Version 8.0
OS Linux
Reporter LLVM Bugzilla Contributor
CC @hfinkel,@mclow,@zoecarver

Extended Description

libc++ provides a specialization of std::hash that works for arbitrary instantiations of std::basic_string. This can produce incorrect behavior for basic_string instantiations with custom character traits that override equality (e.g. traits for case-insensitive comparison). Since the standard only requires that hash for for the typedefed instantiations (e.g. hash, hash, etc), libc++ should not support hashing basic_strings with custom character traits to avoid incorrect behavior.

@llvmbot
Copy link
Collaborator Author

llvmbot commented May 14, 2019

assigned to @zoecarver

@zoecarver
Copy link
Contributor

Good catch. My fix is up for review here: https://reviews.llvm.org/D61954

@mclow
Copy link
Contributor

mclow commented May 20, 2019

Fixed in revision 361201

@llvmbot llvmbot transferred this issue from llvm/llvm-bugzilla-archive Dec 10, 2021
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

3 participants