9 Commits

Author SHA1 Message Date
Louis Dionne
8a0c070309
[libc++] Revert recent changes to __hash_table and ext/hash_map (#189427)
This reverts commits 30084d74765c and 5b8c17580482. The second commit
was landed without proper review: not by fault of the submitter, but
because I mistakenly thought this was modifying something else entirely
that is unsupported. The first commit must also be reverted because it
is a breaking change without the second commit.

This corresponds to PRs #183223 and #188660, see those for more details.
2026-03-31 00:12:01 -04:00
Peter Collingbourne
5b8c175804
[libc++] Add another const_cast to support hash_map copy assignment
There was one more const_cast needed after #183223 without which
copy assignment of hash_map was broken. Add it, together with a copy
assignment test.

Reviewers: ldionne

Pull Request: https://github.com/llvm/llvm-project/pull/188660
2026-03-26 12:12:01 -07:00
Peter Collingbourne
30084d7476
[libc++] Fix type confusion in hash_{,multi}map
The type `__gnu_cxx::hash_{,multi}map` creates objects of type
`std::pair<Key, Value>` and returns pointers to them of type
`std::pair<const Key, Value>`. If either `Key` or `Value` are
non-standard-layout, this is UB, and is furthermore considered by
pointer field protection to be a type confusion, which leads to a
program crash. Fix it by using the correct type for the pair's storage
and using const_cast to form a pointer to the key in the one place where
that is needed.

Reviewers: ldionne

Reviewed By: ldionne

Pull Request: https://github.com/llvm/llvm-project/pull/183223
2026-03-24 15:44:54 -07:00
asmok-g
d97746c56b
[libc++] Fix the rest of __gnu_cxx::hash_XXX copy construction (#160525)
Co-authored-by: Alexander Kornienko <alexfh@google.com>
Co-authored-by: Louis Dionne <ldionne.2@gmail.com>
2025-12-02 22:18:50 +01:00
Nikolas Klauser
9cd0279a76
[libc++] Fix __gnu_cxx::hash_multiset copy construction (#160466) 2025-09-24 15:49:55 +02:00
Nikolas Klauser
5e23f8aa83
[libc++] Fix __gnu_cxx::hash_multimap copy construction (#160043) 2025-09-23 16:15:20 +02:00
Nikolas Klauser
6b371cab94
[libc++] Move a bunch of extensions tests to test/extensions (#149275) 2025-07-19 09:44:25 +02:00
Nikolas Klauser
be3d614cc1
[libc++] Fix hash_multi{map,set}::insert (#149290) 2025-07-17 23:23:04 +02:00
Nikolas Klauser
e9805235bf
[libc++] Move libcxx/test/libcxx/extensions to libcxx/test/extensions and update the tests (#145476)
This patch adds a separate `extensions` directory, since there are quite
a few extensions in libc++ that aren't necessarily libc++-specific. For
example, the tests currently in `libcxx/test/libcxx/extensions` should
also pass with libstdc++, since they originally added the extension.
This also "documents" what users are allowed to rely on and what parts
are just libc++ tests to make sure our implementation is behaving as we
expect, which may be subject to change.

This patch also formats the tests and refactors `.fail.cpp` tests to
`.verify.cpp` tests.
2025-06-27 13:16:37 +02:00