[libcxx-commits] [libcxx] [libc++][C++03] Split libc++-specific tests for the frozen headers (PR #144093)
Nikolas Klauser via libcxx-commits
libcxx-commits at lists.llvm.org
Sun Jul 13 01:05:19 PDT 2025
https://github.com/philnik777 updated https://github.com/llvm/llvm-project/pull/144093
>From c18b130e9c62b32b3cc129fe8ca8b4046995044a Mon Sep 17 00:00:00 2001
From: Nikolas Klauser <nikolasklauser at berlin.de>
Date: Fri, 13 Jun 2025 17:24:09 +0200
Subject: [PATCH] [libc++] Split libc++-specific tests for the frozen headers
---
.../random_shuffle.cxx1z.pass.cpp | 51 +
.../algorithms/bad_iterator_traits.verify.cpp | 61 +
.../algorithms/half_positive.pass.cpp | 59 +
...pstl.libdispatch.chunk_partitions.pass.cpp | 41 +
...obust_against_copying_comparators.pass.cpp | 323 ++
...t_cpp20_hostile_iterators.compile.pass.cpp | 225 ++
...using_non_transparent_comparators.pass.cpp | 80 +
...tomize_verbose_abort.compile-time.pass.cpp | 27 +
...customize_verbose_abort.link-time.pass.cpp | 25 +
.../assertions/default_verbose_abort.pass.cpp | 28 +
.../hardening_mode_incorrect_value.sh.cpp | 26 +
.../libcxx-03/assertions/modes/none.pass.cpp | 32 +
.../assertions/single_expression.pass.cpp | 34 +
.../atomics/atomics.flag/init_bool.pass.cpp | 43 +
.../memory_order.underlying_type.pass.cpp | 34 +
.../incompatible_with_stdatomic.verify.cpp | 25 +
.../atomic_fetch_add.verify.cpp | 76 +
.../atomic_fetch_add_explicit.verify.cpp | 79 +
.../atomic_fetch_sub.verify.cpp | 76 +
.../atomic_fetch_sub_explicit.verify.cpp | 79 +
.../diagnose_invalid_memory_order.verify.cpp | 122 +
.../dont_hijack_header.compile.pass.cpp | 24 +
.../dont_hijack_header.cxx23.compile.pass.cpp | 28 +
libcxx/test/libcxx-03/clang_tidy.gen.py | 40 +
libcxx/test/libcxx-03/clang_tidy.sh.py | 11 +
.../associative/map/at.abort.pass.cpp | 33 +
.../associative/map/at.const.abort.pass.cpp | 33 +
.../map/find.modules.compile.pass.mm | 16 +
.../associative/map/scary.compile.pass.cpp | 26 +
.../reference_comparator_abi.compile.pass.cpp | 57 +
.../associative/set/scary.compile.pass.cpp | 26 +
.../tree_balance_after_insert.pass.cpp | 1612 ++++++++++
.../tree_key_value_traits.pass.cpp | 56 +
.../associative/tree_left_rotate.pass.cpp | 100 +
.../associative/tree_remove.pass.cpp | 1646 ++++++++++
.../associative/tree_right_rotate.pass.cpp | 100 +
.../unord.map/abi.compile.pass.cpp | 141 +
.../unord.map/scary.compile.pass.cpp | 28 +
.../unord.set/abi.compile.pass.cpp | 139 +
.../unord.set/scary.compile.pass.cpp | 28 +
.../container_traits.compile.pass.cpp | 165 +
.../containers/gnu_cxx/hash_map.pass.cpp | 36 +
.../gnu_cxx/hash_map_name_lookup.pass.cpp | 36 +
.../containers/gnu_cxx/hash_set.pass.cpp | 36 +
.../gnu_cxx/hash_set_name_lookup.pass.cpp | 36 +
.../sequences/array/triviality.pass.cpp | 51 +
.../sequences/deque/abi.compile.pass.cpp | 117 +
.../containers/sequences/deque/asan.pass.cpp | 68 +
.../sequences/deque/asan_caterpillar.pass.cpp | 53 +
.../sequences/deque/incomplete.pass.cpp | 34 +
.../deque/segmented_iterator.compile.pass.cpp | 12 +
.../forwardlist/bool-conversion.pass.cpp | 37 +
.../sequences/list/abi.compile.pass.cpp | 87 +
.../vector.bool/abi.compile.pass.cpp | 69 +
.../sequences/vector/abi.compile.pass.cpp | 95 +
.../containers/sequences/vector/asan.pass.cpp | 76 +
.../sequences/vector/asan_throw.pass.cpp | 233 ++
.../vector/erase.modules.compile.pass.mm | 16 +
.../sequences/vector/fill_to_capacity.h | 24 +
.../vector/invalid_allocator.verify.cpp | 29 +
.../vector.cons/construct_iter_iter.pass.cpp | 56 +
.../construct_iter_iter_alloc.pass.cpp | 59 +
.../unord/key_value_traits.pass.cpp | 60 +
.../containers/unord/next_prime.pass.cpp | 51 +
.../auto.ptr/auto_ptr.cxx1z.pass.cpp | 31 +
.../depr/depr.c.headers/extern_c.pass.cpp | 53 +
.../depr.c.headers/math_h.compile.pass.cpp | 26 +
.../stdint_h.std_types_t.compile.pass.cpp | 263 ++
.../stdint_h.xopen_source.compile.pass.cpp | 263 ++
.../allocator.members/address.cxx20.pass.cpp | 44 +
.../allocator.members/allocate.cxx20.pass.cpp | 92 +
.../construct.cxx20.pass.cpp | 147 +
.../allocator.members/max_size.cxx20.pass.cpp | 34 +
.../allocator_types.cxx20.pass.cpp | 53 +
.../depr.adaptors.cxx1z.pass.cpp | 68 +
.../get_unexpected.pass.cpp | 44 +
.../set_unexpected.pass.cpp | 40 +
.../exception.unexpected/unexpected.pass.cpp | 31 +
.../system_error_win_codes.pass.cpp | 25 +
.../fexperimental-library.compile.pass.cpp | 31 +
.../feature_test_macro/ftm_metadata.sh.py | 82 +
.../generate_header_test.sh.py | 637 ++++
.../feature_test_macro/implemented_ftms.sh.py | 68 +
.../feature_test_macro/invalid.sh.py | 108 +
.../feature_test_macro/is_implemented.sh.py | 39 +
.../feature_test_macro/standard_ftms.sh.py | 81 +
.../standard_library_headers.sh.py | 44 +
.../feature_test_macro/std_dialects.sh.py | 39 +
.../feature_test_macro/test_data.json | 213 ++
.../feature_test_macro/version_header.sh.py | 84 +
.../version_header_implementation.sh.py | 163 +
.../libcxx-03/gdb/gdb_pretty_printer_test.py | 162 +
.../gdb/gdb_pretty_printer_test.sh.cpp | 722 +++++
.../test/libcxx-03/headers_in_modulemap.sh.py | 20 +
.../filebuf/traits_mismatch.verify.cpp | 22 +
.../fstreams/fstream.close.pass.cpp | 38 +
.../fstream.cons/wchar_pointer.pass.cpp | 52 +
.../open_wchar_pointer.pass.cpp | 58 +
.../fstreams/ifstream.cons/test.dat | 1 +
.../ifstream.cons/wchar_pointer.pass.cpp | 48 +
.../open_wchar_pointer.pass.cpp | 54 +
.../fstreams/ifstream.members/test.dat | 1 +
.../ofstream.cons/wchar_pointer.pass.cpp | 66 +
.../open_wchar_pointer.pass.cpp | 66 +
.../fstreams/traits_mismatch.verify.cpp | 29 +
.../input.output/file.streams/lit.local.cfg | 7 +
.../input.streams/traits_mismatch.verify.cpp | 25 +
.../iostream.format/lit.local.cfg | 7 +
.../output.streams/traits_mismatch.verify.cpp | 25 +
.../iostream.objects/lit.local.cfg | 7 +
.../ios.base.cons/dtor.uninitialized.pass.cpp | 83 +
.../ios/iostate.flags/clear.abort.pass.cpp | 43 +
.../input.output/iostreams.base/lit.local.cfg | 7 +
.../input.output/stream.buffers/lit.local.cfg | 7 +
.../input.output/string.streams/lit.local.cfg | 7 +
.../stringbuf/const_sso_buffer.pass.cpp | 171 ++
.../string.streams/traits_mismatch.verify.cpp | 25 +
.../iterators/aliasing_iterator.pass.cpp | 47 +
.../bounded_iter/arithmetic.pass.cpp | 114 +
.../bounded_iter/comparison.pass.cpp | 89 +
.../bounded_iter/pointer_traits.pass.cpp | 63 +
.../bounded_iter/types.compile.pass.cpp | 51 +
...contiguous_iterators.conv.compile.pass.cpp | 65 +
.../iterators/contiguous_iterators.pass.cpp | 265 ++
.../iterators/contiguous_iterators.verify.cpp | 27 +
.../iterator.operations/prev.verify.cpp | 21 +
.../get_container.pass.cpp | 37 +
.../ostreambuf.iter.ops/failed.pass.cpp | 36 +
.../libcxx-03/iterators/unwrap_iter.pass.cpp | 59 +
.../math.lerp.verify.cpp | 39 +
.../support.dynamic/libcpp_deallocate.sh.cpp | 255 ++
...ype_info.comparison.apple.compile.pass.cpp | 30 +
.../type_info.comparison.merged.sh.cpp | 48 +
.../type_info.comparison.unmerged.sh.cpp | 45 +
libcxx/test/libcxx-03/libcpp_alignof.pass.cpp | 36 +
.../test/libcxx-03/libcpp_freestanding.sh.cpp | 20 +
.../test/libcxx-03/lint/lint_cmakelists.sh.py | 33 +
libcxx/test/libcxx-03/lint/lint_headers.sh.py | 63 +
libcxx/test/libcxx-03/lit.local.cfg | 9 +
.../test/libcxx-03/localization/lit.local.cfg | 7 +
.../locale.categories/__scan_keyword.pass.cpp | 121 +
.../locales/locale.abort.pass.cpp | 36 +
.../locales/locale.category.abort.pass.cpp | 36 +
.../locale.types/locale.facet/facet.pass.cpp | 56 +
.../locale.facet/no_allocation.pass.cpp | 23 +
.../locale/locale.types/locale.id/id.pass.cpp | 53 +
.../locales/use_facet.abort.pass.cpp | 39 +
.../memory/allocation_guard.pass.cpp | 194 ++
.../allocator_void.trivial.compile.pass.cpp | 26 +
.../memory/allocator_volatile.verify.cpp | 14 +
.../libcxx-03/memory/is_allocator.pass.cpp | 43 +
.../libcxx-03/memory/swap_allocator.pass.cpp | 83 +
.../trivial_abi/unique_ptr_arg.pass.cpp | 52 +
.../unique_ptr_destruction_order.pass.cpp | 68 +
.../trivial_abi/unique_ptr_ret.pass.cpp | 59 +
.../memory/trivial_abi/weak_ptr_ret.pass.cpp | 62 +
.../uninitialized_allocator_copy.pass.cpp | 67 +
.../minimal_cxx11_configuration.pass.cpp | 130 +
libcxx/test/libcxx-03/module_std.gen.py | 38 +
.../test/libcxx-03/module_std_compat.gen.py | 42 +
.../test/libcxx-03/no_assert_include.gen.py | 39 +
.../test/libcxx-03/numerics/bit.ops.pass.cpp | 45 +
.../c.math/fdelayed-template-parsing.pass.cpp | 28 +
.../numerics/clamp_to_integral.pass.cpp | 94 +
.../numerics/complex.number/__sqr.pass.cpp | 84 +
.../complex.number/cmplx.over.pow.pass.cpp | 86 +
.../numarray/class.gslice.array/get.pass.cpp | 52 +
.../class.indirect.array/get.pass.cpp | 44 +
.../numarray/class.mask.array/get.pass.cpp | 51 +
.../numarray/class.slice.array/get.pass.cpp | 46 +
.../has-no-random-device.verify.cpp | 18 +
.../rand.req.urng/valid_int_type.verify.cpp | 51 +
.../rand.req.urng/valid_real_type.verify.cpp | 109 +
.../libcxx-03/odr_signature.exceptions.sh.cpp | 46 +
.../libcxx-03/odr_signature.hardening.sh.cpp | 67 +
.../basic.string/sizeof.compile.pass.cpp | 145 +
.../string.capacity/PR53170.pass.cpp | 84 +
.../string.capacity/allocation_size.pass.cpp | 37 +
.../string.capacity/max_size.pass.cpp | 122 +
.../string.cons/copy_shrunk_long.pass.cpp | 45 +
.../resize_default_initialized.pass.cpp | 75 +
.../c.strings/constexpr_memmove.pass.cpp | 157 +
.../assert.iterator-indexing.pass.cpp | 158 +
.../libcxx-03/system_reserved_names.gen.py | 206 ++
.../native_handle.pass.cpp | 36 +
.../thread.mutex.class/native_handle.pass.cpp | 32 +
.../native_handle.pass.cpp | 32 +
.../thread_safety_lock_guard.pass.cpp | 40 +
.../thread_safety_lock_unlock.pass.cpp | 33 +
.../thread_safety_missing_unlock.verify.cpp | 26 +
...thread_safety_requires_capability.pass.cpp | 37 +
.../native_handle.pass.cpp | 59 +
.../thread.thread.class/types.pass.cpp | 31 +
.../thread.thread.this/sleep_for.pass.cpp | 35 +
.../sleep_for.signals.pass.cpp | 67 +
.../test/libcxx-03/transitive_includes.gen.py | 102 +
.../libcxx-03/transitive_includes/cxx03.csv | 2568 ++++++++++++++++
.../libcxx-03/transitive_includes/cxx11.csv | 2568 ++++++++++++++++
.../libcxx-03/transitive_includes/cxx14.csv | 2619 ++++++++++++++++
.../libcxx-03/transitive_includes/cxx17.csv | 2621 ++++++++++++++++
.../libcxx-03/transitive_includes/cxx20.csv | 2649 +++++++++++++++++
.../libcxx-03/transitive_includes/cxx23.csv | 1166 ++++++++
.../libcxx-03/transitive_includes/cxx26.csv | 1167 ++++++++
.../libcxx-03/transitive_includes/to_csv.py | 120 +
.../type_traits/convert_to_integral.pass.cpp | 123 +
.../type_traits/datasizeof.compile.pass.cpp | 62 +
.../type_traits/desugars_to.compile.pass.cpp | 42 +
.../type_traits/is_callable.compile.pass.cpp | 31 +
.../is_constant_evaluated.pass.cpp | 36 +
.../is_replaceable.compile.pass.cpp | 313 ++
.../is_trivially_comparable.compile.pass.cpp | 67 +
.../is_trivially_relocatable.compile.pass.cpp | 243 ++
.../utilities/exception_guard.odr.sh.cpp | 45 +
.../func.require/bullet_1_2_3.pass.cpp | 405 +++
.../func.require/bullet_4_5_6.pass.cpp | 210 ++
.../func.require/bullet_7.pass.cpp | 328 ++
.../func.require/invoke.pass.cpp | 46 +
.../func.require/invoke_helpers.h | 375 +++
.../function.objects/refwrap/binary.pass.cpp | 87 +
.../refwrap/desugars_to.compile.pass.cpp | 36 +
.../refwrap/layout.binary.compile.pass.cpp | 21 +
.../function.objects/refwrap/unary.pass.cpp | 85 +
...h_ubsan_unsigned_overflow_ignored.pass.cpp | 43 +
.../utilities/is_pointer_in_range.pass.cpp | 58 +
.../utilities/is_valid_range.pass.cpp | 70 +
.../pointer.conversion/to_address.pass.cpp | 159 +
.../to_address_on_funcptr.verify.cpp | 20 +
.../to_address_on_function.verify.cpp | 20 +
.../to_address_std_iterators.pass.cpp | 56 +
.../util.smartptr/race_condition.pass.cpp | 99 +
.../meta/is_referenceable.compile.pass.cpp | 192 ++
.../utilities/meta/meta_base.pass.cpp | 92 +
.../stress_tests/stress_test_is_same.sh.cpp | 55 +
.../stress_test_metafunctions.sh.cpp | 65 +
.../stress_test_variant_overloads_impl.sh.cpp | 119 +
.../libcxx-03/utilities/no_destroy.pass.cpp | 33 +
.../template.bitset/includes.pass.cpp | 33 +
.../abi.non_trivial_copy_move.pass.cpp | 154 +
.../pairs.pair/abi.trivial_copy_move.pass.cpp | 182 ++
.../abi.trivially_copyable.compile.pass.cpp | 68 +
.../pair.incomplete.compile.pass.cpp | 22 +
.../pairs.pair/pair.tuple_element.verify.cpp | 21 +
.../private_constructor_tag.compile.pass.cpp | 22 +
...lity-with-pedantic-errors.compile.pass.cpp | 22 +
.../vendor/apple/disable-availability.sh.cpp | 49 +
.../apple/system-install-properties.sh.cpp | 46 +
.../vendor/clang-cl/static-lib-exports.sh.cpp | 16 +
.../vendor/ibm/bad_function_call.pass.cpp | 45 +
.../vendor/mingw/static-lib-exports.sh.cpp | 16 +
libcxx/test/libcxx-03/xopen_source.gen.py | 56 +
libcxx/test/libcxx/lit.local.cfg | 4 +
251 files changed, 36772 insertions(+)
create mode 100644 libcxx/test/libcxx-03/algorithms/alg.modifying.operations/alg.random.shuffle/random_shuffle.cxx1z.pass.cpp
create mode 100644 libcxx/test/libcxx-03/algorithms/bad_iterator_traits.verify.cpp
create mode 100644 libcxx/test/libcxx-03/algorithms/half_positive.pass.cpp
create mode 100644 libcxx/test/libcxx-03/algorithms/pstl.libdispatch.chunk_partitions.pass.cpp
create mode 100644 libcxx/test/libcxx-03/algorithms/robust_against_copying_comparators.pass.cpp
create mode 100644 libcxx/test/libcxx-03/algorithms/robust_against_cpp20_hostile_iterators.compile.pass.cpp
create mode 100644 libcxx/test/libcxx-03/algorithms/robust_against_using_non_transparent_comparators.pass.cpp
create mode 100644 libcxx/test/libcxx-03/assertions/customize_verbose_abort.compile-time.pass.cpp
create mode 100644 libcxx/test/libcxx-03/assertions/customize_verbose_abort.link-time.pass.cpp
create mode 100644 libcxx/test/libcxx-03/assertions/default_verbose_abort.pass.cpp
create mode 100644 libcxx/test/libcxx-03/assertions/modes/hardening_mode_incorrect_value.sh.cpp
create mode 100644 libcxx/test/libcxx-03/assertions/modes/none.pass.cpp
create mode 100644 libcxx/test/libcxx-03/assertions/single_expression.pass.cpp
create mode 100644 libcxx/test/libcxx-03/atomics/atomics.flag/init_bool.pass.cpp
create mode 100644 libcxx/test/libcxx-03/atomics/atomics.order/memory_order.underlying_type.pass.cpp
create mode 100644 libcxx/test/libcxx-03/atomics/atomics.syn/incompatible_with_stdatomic.verify.cpp
create mode 100644 libcxx/test/libcxx-03/atomics/atomics.types.operations/atomics.types.operations.req/atomic_fetch_add.verify.cpp
create mode 100644 libcxx/test/libcxx-03/atomics/atomics.types.operations/atomics.types.operations.req/atomic_fetch_add_explicit.verify.cpp
create mode 100644 libcxx/test/libcxx-03/atomics/atomics.types.operations/atomics.types.operations.req/atomic_fetch_sub.verify.cpp
create mode 100644 libcxx/test/libcxx-03/atomics/atomics.types.operations/atomics.types.operations.req/atomic_fetch_sub_explicit.verify.cpp
create mode 100644 libcxx/test/libcxx-03/atomics/diagnose_invalid_memory_order.verify.cpp
create mode 100644 libcxx/test/libcxx-03/atomics/stdatomic.h.syn/dont_hijack_header.compile.pass.cpp
create mode 100644 libcxx/test/libcxx-03/atomics/stdatomic.h.syn/dont_hijack_header.cxx23.compile.pass.cpp
create mode 100644 libcxx/test/libcxx-03/clang_tidy.gen.py
create mode 100644 libcxx/test/libcxx-03/clang_tidy.sh.py
create mode 100644 libcxx/test/libcxx-03/containers/associative/map/at.abort.pass.cpp
create mode 100644 libcxx/test/libcxx-03/containers/associative/map/at.const.abort.pass.cpp
create mode 100644 libcxx/test/libcxx-03/containers/associative/map/find.modules.compile.pass.mm
create mode 100644 libcxx/test/libcxx-03/containers/associative/map/scary.compile.pass.cpp
create mode 100644 libcxx/test/libcxx-03/containers/associative/reference_comparator_abi.compile.pass.cpp
create mode 100644 libcxx/test/libcxx-03/containers/associative/set/scary.compile.pass.cpp
create mode 100644 libcxx/test/libcxx-03/containers/associative/tree_balance_after_insert.pass.cpp
create mode 100644 libcxx/test/libcxx-03/containers/associative/tree_key_value_traits.pass.cpp
create mode 100644 libcxx/test/libcxx-03/containers/associative/tree_left_rotate.pass.cpp
create mode 100644 libcxx/test/libcxx-03/containers/associative/tree_remove.pass.cpp
create mode 100644 libcxx/test/libcxx-03/containers/associative/tree_right_rotate.pass.cpp
create mode 100644 libcxx/test/libcxx-03/containers/associative/unord.map/abi.compile.pass.cpp
create mode 100644 libcxx/test/libcxx-03/containers/associative/unord.map/scary.compile.pass.cpp
create mode 100644 libcxx/test/libcxx-03/containers/associative/unord.set/abi.compile.pass.cpp
create mode 100644 libcxx/test/libcxx-03/containers/associative/unord.set/scary.compile.pass.cpp
create mode 100644 libcxx/test/libcxx-03/containers/container_traits.compile.pass.cpp
create mode 100644 libcxx/test/libcxx-03/containers/gnu_cxx/hash_map.pass.cpp
create mode 100644 libcxx/test/libcxx-03/containers/gnu_cxx/hash_map_name_lookup.pass.cpp
create mode 100644 libcxx/test/libcxx-03/containers/gnu_cxx/hash_set.pass.cpp
create mode 100644 libcxx/test/libcxx-03/containers/gnu_cxx/hash_set_name_lookup.pass.cpp
create mode 100644 libcxx/test/libcxx-03/containers/sequences/array/triviality.pass.cpp
create mode 100644 libcxx/test/libcxx-03/containers/sequences/deque/abi.compile.pass.cpp
create mode 100644 libcxx/test/libcxx-03/containers/sequences/deque/asan.pass.cpp
create mode 100644 libcxx/test/libcxx-03/containers/sequences/deque/asan_caterpillar.pass.cpp
create mode 100644 libcxx/test/libcxx-03/containers/sequences/deque/incomplete.pass.cpp
create mode 100644 libcxx/test/libcxx-03/containers/sequences/deque/segmented_iterator.compile.pass.cpp
create mode 100644 libcxx/test/libcxx-03/containers/sequences/forwardlist/bool-conversion.pass.cpp
create mode 100644 libcxx/test/libcxx-03/containers/sequences/list/abi.compile.pass.cpp
create mode 100644 libcxx/test/libcxx-03/containers/sequences/vector.bool/abi.compile.pass.cpp
create mode 100644 libcxx/test/libcxx-03/containers/sequences/vector/abi.compile.pass.cpp
create mode 100644 libcxx/test/libcxx-03/containers/sequences/vector/asan.pass.cpp
create mode 100644 libcxx/test/libcxx-03/containers/sequences/vector/asan_throw.pass.cpp
create mode 100644 libcxx/test/libcxx-03/containers/sequences/vector/erase.modules.compile.pass.mm
create mode 100644 libcxx/test/libcxx-03/containers/sequences/vector/fill_to_capacity.h
create mode 100644 libcxx/test/libcxx-03/containers/sequences/vector/invalid_allocator.verify.cpp
create mode 100644 libcxx/test/libcxx-03/containers/sequences/vector/vector.cons/construct_iter_iter.pass.cpp
create mode 100644 libcxx/test/libcxx-03/containers/sequences/vector/vector.cons/construct_iter_iter_alloc.pass.cpp
create mode 100644 libcxx/test/libcxx-03/containers/unord/key_value_traits.pass.cpp
create mode 100644 libcxx/test/libcxx-03/containers/unord/next_prime.pass.cpp
create mode 100644 libcxx/test/libcxx-03/depr/depr.auto.ptr/auto.ptr/auto_ptr.cxx1z.pass.cpp
create mode 100644 libcxx/test/libcxx-03/depr/depr.c.headers/extern_c.pass.cpp
create mode 100644 libcxx/test/libcxx-03/depr/depr.c.headers/math_h.compile.pass.cpp
create mode 100644 libcxx/test/libcxx-03/depr/depr.c.headers/stdint_h.std_types_t.compile.pass.cpp
create mode 100644 libcxx/test/libcxx-03/depr/depr.c.headers/stdint_h.xopen_source.compile.pass.cpp
create mode 100644 libcxx/test/libcxx-03/depr/depr.default.allocator/allocator.members/address.cxx20.pass.cpp
create mode 100644 libcxx/test/libcxx-03/depr/depr.default.allocator/allocator.members/allocate.cxx20.pass.cpp
create mode 100644 libcxx/test/libcxx-03/depr/depr.default.allocator/allocator.members/construct.cxx20.pass.cpp
create mode 100644 libcxx/test/libcxx-03/depr/depr.default.allocator/allocator.members/max_size.cxx20.pass.cpp
create mode 100644 libcxx/test/libcxx-03/depr/depr.default.allocator/allocator_types.cxx20.pass.cpp
create mode 100644 libcxx/test/libcxx-03/depr/depr.function.objects/depr.adaptors.cxx1z.pass.cpp
create mode 100644 libcxx/test/libcxx-03/depr/exception.unexpected/get_unexpected.pass.cpp
create mode 100644 libcxx/test/libcxx-03/depr/exception.unexpected/set_unexpected.pass.cpp
create mode 100644 libcxx/test/libcxx-03/depr/exception.unexpected/unexpected.pass.cpp
create mode 100644 libcxx/test/libcxx-03/diagnostics/system_error_win_codes.pass.cpp
create mode 100644 libcxx/test/libcxx-03/experimental/fexperimental-library.compile.pass.cpp
create mode 100644 libcxx/test/libcxx-03/feature_test_macro/ftm_metadata.sh.py
create mode 100644 libcxx/test/libcxx-03/feature_test_macro/generate_header_test.sh.py
create mode 100644 libcxx/test/libcxx-03/feature_test_macro/implemented_ftms.sh.py
create mode 100644 libcxx/test/libcxx-03/feature_test_macro/invalid.sh.py
create mode 100644 libcxx/test/libcxx-03/feature_test_macro/is_implemented.sh.py
create mode 100644 libcxx/test/libcxx-03/feature_test_macro/standard_ftms.sh.py
create mode 100644 libcxx/test/libcxx-03/feature_test_macro/standard_library_headers.sh.py
create mode 100644 libcxx/test/libcxx-03/feature_test_macro/std_dialects.sh.py
create mode 100644 libcxx/test/libcxx-03/feature_test_macro/test_data.json
create mode 100644 libcxx/test/libcxx-03/feature_test_macro/version_header.sh.py
create mode 100644 libcxx/test/libcxx-03/feature_test_macro/version_header_implementation.sh.py
create mode 100644 libcxx/test/libcxx-03/gdb/gdb_pretty_printer_test.py
create mode 100644 libcxx/test/libcxx-03/gdb/gdb_pretty_printer_test.sh.cpp
create mode 100644 libcxx/test/libcxx-03/headers_in_modulemap.sh.py
create mode 100644 libcxx/test/libcxx-03/input.output/file.streams/fstreams/filebuf/traits_mismatch.verify.cpp
create mode 100644 libcxx/test/libcxx-03/input.output/file.streams/fstreams/fstream.close.pass.cpp
create mode 100644 libcxx/test/libcxx-03/input.output/file.streams/fstreams/fstream.cons/wchar_pointer.pass.cpp
create mode 100644 libcxx/test/libcxx-03/input.output/file.streams/fstreams/fstream.members/open_wchar_pointer.pass.cpp
create mode 100644 libcxx/test/libcxx-03/input.output/file.streams/fstreams/ifstream.cons/test.dat
create mode 100644 libcxx/test/libcxx-03/input.output/file.streams/fstreams/ifstream.cons/wchar_pointer.pass.cpp
create mode 100644 libcxx/test/libcxx-03/input.output/file.streams/fstreams/ifstream.members/open_wchar_pointer.pass.cpp
create mode 100644 libcxx/test/libcxx-03/input.output/file.streams/fstreams/ifstream.members/test.dat
create mode 100644 libcxx/test/libcxx-03/input.output/file.streams/fstreams/ofstream.cons/wchar_pointer.pass.cpp
create mode 100644 libcxx/test/libcxx-03/input.output/file.streams/fstreams/ofstream.members/open_wchar_pointer.pass.cpp
create mode 100644 libcxx/test/libcxx-03/input.output/file.streams/fstreams/traits_mismatch.verify.cpp
create mode 100644 libcxx/test/libcxx-03/input.output/file.streams/lit.local.cfg
create mode 100644 libcxx/test/libcxx-03/input.output/iostream.format/input.streams/traits_mismatch.verify.cpp
create mode 100644 libcxx/test/libcxx-03/input.output/iostream.format/lit.local.cfg
create mode 100644 libcxx/test/libcxx-03/input.output/iostream.format/output.streams/traits_mismatch.verify.cpp
create mode 100644 libcxx/test/libcxx-03/input.output/iostream.objects/lit.local.cfg
create mode 100644 libcxx/test/libcxx-03/input.output/iostreams.base/ios.base/ios.base.cons/dtor.uninitialized.pass.cpp
create mode 100644 libcxx/test/libcxx-03/input.output/iostreams.base/ios/iostate.flags/clear.abort.pass.cpp
create mode 100644 libcxx/test/libcxx-03/input.output/iostreams.base/lit.local.cfg
create mode 100644 libcxx/test/libcxx-03/input.output/stream.buffers/lit.local.cfg
create mode 100644 libcxx/test/libcxx-03/input.output/string.streams/lit.local.cfg
create mode 100644 libcxx/test/libcxx-03/input.output/string.streams/stringbuf/const_sso_buffer.pass.cpp
create mode 100644 libcxx/test/libcxx-03/input.output/string.streams/traits_mismatch.verify.cpp
create mode 100644 libcxx/test/libcxx-03/iterators/aliasing_iterator.pass.cpp
create mode 100644 libcxx/test/libcxx-03/iterators/bounded_iter/arithmetic.pass.cpp
create mode 100644 libcxx/test/libcxx-03/iterators/bounded_iter/comparison.pass.cpp
create mode 100644 libcxx/test/libcxx-03/iterators/bounded_iter/pointer_traits.pass.cpp
create mode 100644 libcxx/test/libcxx-03/iterators/bounded_iter/types.compile.pass.cpp
create mode 100644 libcxx/test/libcxx-03/iterators/contiguous_iterators.conv.compile.pass.cpp
create mode 100644 libcxx/test/libcxx-03/iterators/contiguous_iterators.pass.cpp
create mode 100644 libcxx/test/libcxx-03/iterators/contiguous_iterators.verify.cpp
create mode 100644 libcxx/test/libcxx-03/iterators/iterator.primitives/iterator.operations/prev.verify.cpp
create mode 100644 libcxx/test/libcxx-03/iterators/predef.iterators/insert.iterators/back.insert.iter.ops/get_container.pass.cpp
create mode 100644 libcxx/test/libcxx-03/iterators/stream.iterators/ostreambuf.iterator/ostreambuf.iter.ops/failed.pass.cpp
create mode 100644 libcxx/test/libcxx-03/iterators/unwrap_iter.pass.cpp
create mode 100644 libcxx/test/libcxx-03/language.support/support.c.headers/support.c.headers.other/math.lerp.verify.cpp
create mode 100644 libcxx/test/libcxx-03/language.support/support.dynamic/libcpp_deallocate.sh.cpp
create mode 100644 libcxx/test/libcxx-03/language.support/support.rtti/type.info/type_info.comparison.apple.compile.pass.cpp
create mode 100644 libcxx/test/libcxx-03/language.support/support.rtti/type.info/type_info.comparison.merged.sh.cpp
create mode 100644 libcxx/test/libcxx-03/language.support/support.rtti/type.info/type_info.comparison.unmerged.sh.cpp
create mode 100644 libcxx/test/libcxx-03/libcpp_alignof.pass.cpp
create mode 100644 libcxx/test/libcxx-03/libcpp_freestanding.sh.cpp
create mode 100644 libcxx/test/libcxx-03/lint/lint_cmakelists.sh.py
create mode 100644 libcxx/test/libcxx-03/lint/lint_headers.sh.py
create mode 100644 libcxx/test/libcxx-03/lit.local.cfg
create mode 100644 libcxx/test/libcxx-03/localization/lit.local.cfg
create mode 100644 libcxx/test/libcxx-03/localization/locale.categories/__scan_keyword.pass.cpp
create mode 100644 libcxx/test/libcxx-03/localization/locales/locale.abort.pass.cpp
create mode 100644 libcxx/test/libcxx-03/localization/locales/locale.category.abort.pass.cpp
create mode 100644 libcxx/test/libcxx-03/localization/locales/locale/locale.types/locale.facet/facet.pass.cpp
create mode 100644 libcxx/test/libcxx-03/localization/locales/locale/locale.types/locale.facet/no_allocation.pass.cpp
create mode 100644 libcxx/test/libcxx-03/localization/locales/locale/locale.types/locale.id/id.pass.cpp
create mode 100644 libcxx/test/libcxx-03/localization/locales/use_facet.abort.pass.cpp
create mode 100644 libcxx/test/libcxx-03/memory/allocation_guard.pass.cpp
create mode 100644 libcxx/test/libcxx-03/memory/allocator_void.trivial.compile.pass.cpp
create mode 100644 libcxx/test/libcxx-03/memory/allocator_volatile.verify.cpp
create mode 100644 libcxx/test/libcxx-03/memory/is_allocator.pass.cpp
create mode 100644 libcxx/test/libcxx-03/memory/swap_allocator.pass.cpp
create mode 100644 libcxx/test/libcxx-03/memory/trivial_abi/unique_ptr_arg.pass.cpp
create mode 100644 libcxx/test/libcxx-03/memory/trivial_abi/unique_ptr_destruction_order.pass.cpp
create mode 100644 libcxx/test/libcxx-03/memory/trivial_abi/unique_ptr_ret.pass.cpp
create mode 100644 libcxx/test/libcxx-03/memory/trivial_abi/weak_ptr_ret.pass.cpp
create mode 100644 libcxx/test/libcxx-03/memory/uninitialized_allocator_copy.pass.cpp
create mode 100644 libcxx/test/libcxx-03/minimal_cxx11_configuration.pass.cpp
create mode 100644 libcxx/test/libcxx-03/module_std.gen.py
create mode 100644 libcxx/test/libcxx-03/module_std_compat.gen.py
create mode 100644 libcxx/test/libcxx-03/no_assert_include.gen.py
create mode 100644 libcxx/test/libcxx-03/numerics/bit.ops.pass.cpp
create mode 100644 libcxx/test/libcxx-03/numerics/c.math/fdelayed-template-parsing.pass.cpp
create mode 100644 libcxx/test/libcxx-03/numerics/clamp_to_integral.pass.cpp
create mode 100644 libcxx/test/libcxx-03/numerics/complex.number/__sqr.pass.cpp
create mode 100644 libcxx/test/libcxx-03/numerics/complex.number/cmplx.over.pow.pass.cpp
create mode 100644 libcxx/test/libcxx-03/numerics/numarray/class.gslice.array/get.pass.cpp
create mode 100644 libcxx/test/libcxx-03/numerics/numarray/class.indirect.array/get.pass.cpp
create mode 100644 libcxx/test/libcxx-03/numerics/numarray/class.mask.array/get.pass.cpp
create mode 100644 libcxx/test/libcxx-03/numerics/numarray/class.slice.array/get.pass.cpp
create mode 100644 libcxx/test/libcxx-03/numerics/rand/rand.device/has-no-random-device.verify.cpp
create mode 100644 libcxx/test/libcxx-03/numerics/rand/rand.req.urng/valid_int_type.verify.cpp
create mode 100644 libcxx/test/libcxx-03/numerics/rand/rand.req.urng/valid_real_type.verify.cpp
create mode 100644 libcxx/test/libcxx-03/odr_signature.exceptions.sh.cpp
create mode 100644 libcxx/test/libcxx-03/odr_signature.hardening.sh.cpp
create mode 100644 libcxx/test/libcxx-03/strings/basic.string/sizeof.compile.pass.cpp
create mode 100644 libcxx/test/libcxx-03/strings/basic.string/string.capacity/PR53170.pass.cpp
create mode 100644 libcxx/test/libcxx-03/strings/basic.string/string.capacity/allocation_size.pass.cpp
create mode 100644 libcxx/test/libcxx-03/strings/basic.string/string.capacity/max_size.pass.cpp
create mode 100644 libcxx/test/libcxx-03/strings/basic.string/string.cons/copy_shrunk_long.pass.cpp
create mode 100644 libcxx/test/libcxx-03/strings/basic.string/string.modifiers/resize_default_initialized.pass.cpp
create mode 100644 libcxx/test/libcxx-03/strings/c.strings/constexpr_memmove.pass.cpp
create mode 100644 libcxx/test/libcxx-03/strings/string.view/string.view.iterators/assert.iterator-indexing.pass.cpp
create mode 100644 libcxx/test/libcxx-03/system_reserved_names.gen.py
create mode 100644 libcxx/test/libcxx-03/thread/thread.condition/thread.condition.condvar/native_handle.pass.cpp
create mode 100644 libcxx/test/libcxx-03/thread/thread.mutex/thread.mutex.requirements/thread.mutex.requirements.mutex/thread.mutex.class/native_handle.pass.cpp
create mode 100644 libcxx/test/libcxx-03/thread/thread.mutex/thread.mutex.requirements/thread.mutex.requirements.mutex/thread.mutex.recursive/native_handle.pass.cpp
create mode 100644 libcxx/test/libcxx-03/thread/thread.mutex/thread_safety_lock_guard.pass.cpp
create mode 100644 libcxx/test/libcxx-03/thread/thread.mutex/thread_safety_lock_unlock.pass.cpp
create mode 100644 libcxx/test/libcxx-03/thread/thread.mutex/thread_safety_missing_unlock.verify.cpp
create mode 100644 libcxx/test/libcxx-03/thread/thread.mutex/thread_safety_requires_capability.pass.cpp
create mode 100644 libcxx/test/libcxx-03/thread/thread.threads/thread.thread.class/thread.thread.member/native_handle.pass.cpp
create mode 100644 libcxx/test/libcxx-03/thread/thread.threads/thread.thread.class/types.pass.cpp
create mode 100644 libcxx/test/libcxx-03/thread/thread.threads/thread.thread.this/sleep_for.pass.cpp
create mode 100644 libcxx/test/libcxx-03/thread/thread.threads/thread.thread.this/sleep_for.signals.pass.cpp
create mode 100644 libcxx/test/libcxx-03/transitive_includes.gen.py
create mode 100644 libcxx/test/libcxx-03/transitive_includes/cxx03.csv
create mode 100644 libcxx/test/libcxx-03/transitive_includes/cxx11.csv
create mode 100644 libcxx/test/libcxx-03/transitive_includes/cxx14.csv
create mode 100644 libcxx/test/libcxx-03/transitive_includes/cxx17.csv
create mode 100644 libcxx/test/libcxx-03/transitive_includes/cxx20.csv
create mode 100644 libcxx/test/libcxx-03/transitive_includes/cxx23.csv
create mode 100644 libcxx/test/libcxx-03/transitive_includes/cxx26.csv
create mode 100755 libcxx/test/libcxx-03/transitive_includes/to_csv.py
create mode 100644 libcxx/test/libcxx-03/type_traits/convert_to_integral.pass.cpp
create mode 100644 libcxx/test/libcxx-03/type_traits/datasizeof.compile.pass.cpp
create mode 100644 libcxx/test/libcxx-03/type_traits/desugars_to.compile.pass.cpp
create mode 100644 libcxx/test/libcxx-03/type_traits/is_callable.compile.pass.cpp
create mode 100644 libcxx/test/libcxx-03/type_traits/is_constant_evaluated.pass.cpp
create mode 100644 libcxx/test/libcxx-03/type_traits/is_replaceable.compile.pass.cpp
create mode 100644 libcxx/test/libcxx-03/type_traits/is_trivially_comparable.compile.pass.cpp
create mode 100644 libcxx/test/libcxx-03/type_traits/is_trivially_relocatable.compile.pass.cpp
create mode 100644 libcxx/test/libcxx-03/utilities/exception_guard.odr.sh.cpp
create mode 100644 libcxx/test/libcxx-03/utilities/function.objects/func.require/bullet_1_2_3.pass.cpp
create mode 100644 libcxx/test/libcxx-03/utilities/function.objects/func.require/bullet_4_5_6.pass.cpp
create mode 100644 libcxx/test/libcxx-03/utilities/function.objects/func.require/bullet_7.pass.cpp
create mode 100644 libcxx/test/libcxx-03/utilities/function.objects/func.require/invoke.pass.cpp
create mode 100644 libcxx/test/libcxx-03/utilities/function.objects/func.require/invoke_helpers.h
create mode 100644 libcxx/test/libcxx-03/utilities/function.objects/refwrap/binary.pass.cpp
create mode 100644 libcxx/test/libcxx-03/utilities/function.objects/refwrap/desugars_to.compile.pass.cpp
create mode 100644 libcxx/test/libcxx-03/utilities/function.objects/refwrap/layout.binary.compile.pass.cpp
create mode 100644 libcxx/test/libcxx-03/utilities/function.objects/refwrap/unary.pass.cpp
create mode 100644 libcxx/test/libcxx-03/utilities/function.objects/unord.hash/murmur2_or_cityhash_ubsan_unsigned_overflow_ignored.pass.cpp
create mode 100644 libcxx/test/libcxx-03/utilities/is_pointer_in_range.pass.cpp
create mode 100644 libcxx/test/libcxx-03/utilities/is_valid_range.pass.cpp
create mode 100644 libcxx/test/libcxx-03/utilities/memory/pointer.conversion/to_address.pass.cpp
create mode 100644 libcxx/test/libcxx-03/utilities/memory/pointer.conversion/to_address_on_funcptr.verify.cpp
create mode 100644 libcxx/test/libcxx-03/utilities/memory/pointer.conversion/to_address_on_function.verify.cpp
create mode 100644 libcxx/test/libcxx-03/utilities/memory/pointer.conversion/to_address_std_iterators.pass.cpp
create mode 100644 libcxx/test/libcxx-03/utilities/memory/util.smartptr/race_condition.pass.cpp
create mode 100644 libcxx/test/libcxx-03/utilities/meta/is_referenceable.compile.pass.cpp
create mode 100644 libcxx/test/libcxx-03/utilities/meta/meta_base.pass.cpp
create mode 100644 libcxx/test/libcxx-03/utilities/meta/stress_tests/stress_test_is_same.sh.cpp
create mode 100644 libcxx/test/libcxx-03/utilities/meta/stress_tests/stress_test_metafunctions.sh.cpp
create mode 100644 libcxx/test/libcxx-03/utilities/meta/stress_tests/stress_test_variant_overloads_impl.sh.cpp
create mode 100644 libcxx/test/libcxx-03/utilities/no_destroy.pass.cpp
create mode 100644 libcxx/test/libcxx-03/utilities/template.bitset/includes.pass.cpp
create mode 100644 libcxx/test/libcxx-03/utilities/utility/pairs/pairs.pair/abi.non_trivial_copy_move.pass.cpp
create mode 100644 libcxx/test/libcxx-03/utilities/utility/pairs/pairs.pair/abi.trivial_copy_move.pass.cpp
create mode 100644 libcxx/test/libcxx-03/utilities/utility/pairs/pairs.pair/abi.trivially_copyable.compile.pass.cpp
create mode 100644 libcxx/test/libcxx-03/utilities/utility/pairs/pairs.pair/pair.incomplete.compile.pass.cpp
create mode 100644 libcxx/test/libcxx-03/utilities/utility/pairs/pairs.pair/pair.tuple_element.verify.cpp
create mode 100644 libcxx/test/libcxx-03/utilities/utility/private_constructor_tag.compile.pass.cpp
create mode 100644 libcxx/test/libcxx-03/vendor/apple/availability-with-pedantic-errors.compile.pass.cpp
create mode 100644 libcxx/test/libcxx-03/vendor/apple/disable-availability.sh.cpp
create mode 100644 libcxx/test/libcxx-03/vendor/apple/system-install-properties.sh.cpp
create mode 100644 libcxx/test/libcxx-03/vendor/clang-cl/static-lib-exports.sh.cpp
create mode 100644 libcxx/test/libcxx-03/vendor/ibm/bad_function_call.pass.cpp
create mode 100644 libcxx/test/libcxx-03/vendor/mingw/static-lib-exports.sh.cpp
create mode 100644 libcxx/test/libcxx-03/xopen_source.gen.py
create mode 100644 libcxx/test/libcxx/lit.local.cfg
diff --git a/libcxx/test/libcxx-03/algorithms/alg.modifying.operations/alg.random.shuffle/random_shuffle.cxx1z.pass.cpp b/libcxx/test/libcxx-03/algorithms/alg.modifying.operations/alg.random.shuffle/random_shuffle.cxx1z.pass.cpp
new file mode 100644
index 0000000000000..4e51014f20b18
--- /dev/null
+++ b/libcxx/test/libcxx-03/algorithms/alg.modifying.operations/alg.random.shuffle/random_shuffle.cxx1z.pass.cpp
@@ -0,0 +1,51 @@
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// <algorithm>
+
+// template <class RandomAccessIterator>
+// void
+// random_shuffle(RandomAccessIterator first, RandomAccessIterator last);
+//
+// template <class RandomAccessIterator, class RandomNumberGenerator>
+// void
+// random_shuffle(RandomAccessIterator first, RandomAccessIterator last,
+// RandomNumberGenerator& rand);
+
+//
+// In C++17, random_shuffle has been removed.
+// However, for backwards compatibility, if _LIBCPP_ENABLE_CXX17_REMOVED_RANDOM_SHUFFLE
+// is defined before including <algorithm>, then random_shuffle will be restored.
+
+// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_ENABLE_CXX17_REMOVED_RANDOM_SHUFFLE
+// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DISABLE_DEPRECATION_WARNINGS
+
+#include <algorithm>
+#include <cstddef>
+#include <vector>
+
+#include "test_macros.h"
+
+struct gen
+{
+ std::ptrdiff_t operator()(std::ptrdiff_t n)
+ {
+ return n-1;
+ }
+};
+
+
+int main(int, char**)
+{
+ std::vector<int> v;
+ std::random_shuffle(v.begin(), v.end());
+ gen r;
+ std::random_shuffle(v.begin(), v.end(), r);
+
+ return 0;
+}
diff --git a/libcxx/test/libcxx-03/algorithms/bad_iterator_traits.verify.cpp b/libcxx/test/libcxx-03/algorithms/bad_iterator_traits.verify.cpp
new file mode 100644
index 0000000000000..a0b5b88bb9f0e
--- /dev/null
+++ b/libcxx/test/libcxx-03/algorithms/bad_iterator_traits.verify.cpp
@@ -0,0 +1,61 @@
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// std::sort
+
+#include <algorithm>
+#include <iterator>
+#include <type_traits>
+#include <utility>
+
+struct BadIter {
+ struct Value {
+ friend bool operator==(const Value& x, const Value& y);
+ friend bool operator!=(const Value& x, const Value& y);
+ friend bool operator< (const Value& x, const Value& y);
+ friend bool operator<=(const Value& x, const Value& y);
+ friend bool operator> (const Value& x, const Value& y);
+ friend bool operator>=(const Value& x, const Value& y);
+ friend void swap(Value, Value);
+ };
+
+ using iterator_category = std::random_access_iterator_tag;
+ using value_type = Value;
+ using reference = Value&;
+ using difference_type = long;
+ using pointer = Value*;
+
+ Value operator*() const; // Not `Value&`.
+ reference operator[](difference_type n) const;
+
+ BadIter& operator++();
+ BadIter& operator--();
+ BadIter operator++(int);
+ BadIter operator--(int);
+
+ BadIter& operator+=(difference_type n);
+ BadIter& operator-=(difference_type n);
+ friend BadIter operator+(BadIter x, difference_type n);
+ friend BadIter operator+(difference_type n, BadIter x);
+ friend BadIter operator-(BadIter x, difference_type n);
+ friend difference_type operator-(BadIter x, BadIter y);
+
+ friend bool operator==(const BadIter& x, const BadIter& y);
+ friend bool operator!=(const BadIter& x, const BadIter& y);
+ friend bool operator< (const BadIter& x, const BadIter& y);
+ friend bool operator<=(const BadIter& x, const BadIter& y);
+ friend bool operator> (const BadIter& x, const BadIter& y);
+ friend bool operator>=(const BadIter& x, const BadIter& y);
+};
+
+// Verify that iterators with incorrect `iterator_traits` are rejected. This protects against potential undefined
+// behavior when these iterators are passed to standard algorithms.
+void test() {
+ std::sort(BadIter(), BadIter());
+ //expected-error-re@*:* {{static assertion failed {{.*}}It looks like your iterator's `iterator_traits<It>::reference` does not match the return type of dereferencing the iterator}}
+}
diff --git a/libcxx/test/libcxx-03/algorithms/half_positive.pass.cpp b/libcxx/test/libcxx-03/algorithms/half_positive.pass.cpp
new file mode 100644
index 0000000000000..88a18e8592921
--- /dev/null
+++ b/libcxx/test/libcxx-03/algorithms/half_positive.pass.cpp
@@ -0,0 +1,59 @@
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// <algorithm>
+
+// __half_positive divides an integer number by 2 as unsigned number for known types.
+// It can be an important optimization for lower bound, for example.
+
+// XFAIL: FROZEN-CXX03-HEADERS-FIXME
+
+#include <__algorithm/half_positive.h>
+#include <cassert>
+#include <cstddef>
+#include <limits>
+
+#include "test_macros.h"
+#include "user_defined_integral.h"
+
+namespace {
+
+template <class IntType, class UnderlyingType = IntType>
+TEST_CONSTEXPR bool test(IntType max_v = IntType(std::numeric_limits<UnderlyingType>::max())) {
+ return std::__half_positive(max_v) == max_v / 2;
+}
+
+} // namespace
+
+int main(int, char**)
+{
+ {
+ assert(test<char>());
+ assert(test<int>());
+ assert(test<long>());
+ assert((test<UserDefinedIntegral<int>, int>()));
+ assert(test<std::size_t>());
+#if !defined(TEST_HAS_NO_INT128)
+ assert(test<__int128_t>());
+#endif // !defined(TEST_HAS_NO_INT128)
+ }
+
+#if TEST_STD_VER >= 11
+ {
+ static_assert(test<char>(), "");
+ static_assert(test<int>(), "");
+ static_assert(test<long>(), "");
+ static_assert(test<std::size_t>(), "");
+#if !defined(TEST_HAS_NO_INT128)
+ static_assert(test<__int128_t>(), "");
+#endif // !defined(TEST_HAS_NO_INT128)
+ }
+#endif // TEST_STD_VER >= 11
+
+ return 0;
+}
diff --git a/libcxx/test/libcxx-03/algorithms/pstl.libdispatch.chunk_partitions.pass.cpp b/libcxx/test/libcxx-03/algorithms/pstl.libdispatch.chunk_partitions.pass.cpp
new file mode 100644
index 0000000000000..b48ac02dd79c5
--- /dev/null
+++ b/libcxx/test/libcxx-03/algorithms/pstl.libdispatch.chunk_partitions.pass.cpp
@@ -0,0 +1,41 @@
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// <algorithm>
+
+// REQUIRES: libcpp-pstl-backend-libdispatch
+
+// __chunk_partitions __partition_chunks(ptrdiff_t);
+
+#include <__pstl/backends/libdispatch.h>
+#include <cassert>
+#include <cstddef>
+
+int main(int, char**) {
+ {
+ auto chunks = std::__pstl::__libdispatch::__partition_chunks(0);
+ assert(chunks.__chunk_count_ == 1);
+ assert(chunks.__first_chunk_size_ == 0);
+ assert(chunks.__chunk_size_ == 0);
+ }
+
+ {
+ auto chunks = std::__pstl::__libdispatch::__partition_chunks(1);
+ assert(chunks.__chunk_count_ == 1);
+ assert(chunks.__first_chunk_size_ == 1);
+ assert(chunks.__chunk_size_ == 1);
+ }
+
+ for (std::ptrdiff_t i = 2; i != 2ll << 20; ++i) {
+ auto chunks = std::__pstl::__libdispatch::__partition_chunks(i);
+ assert(chunks.__chunk_count_ >= 1);
+ assert(chunks.__chunk_count_ <= i);
+ assert((chunks.__chunk_count_ - 1) * chunks.__chunk_size_ + chunks.__first_chunk_size_ == i);
+ }
+ return 0;
+}
diff --git a/libcxx/test/libcxx-03/algorithms/robust_against_copying_comparators.pass.cpp b/libcxx/test/libcxx-03/algorithms/robust_against_copying_comparators.pass.cpp
new file mode 100644
index 0000000000000..256251686bb3e
--- /dev/null
+++ b/libcxx/test/libcxx-03/algorithms/robust_against_copying_comparators.pass.cpp
@@ -0,0 +1,323 @@
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// <algorithm>
+
+#include <algorithm>
+#include <cassert>
+#include <compare>
+#include <cstddef>
+#include <deque>
+#include <ranges>
+#include <type_traits>
+#include <vector>
+
+#include "test_macros.h"
+
+template <class T>
+struct Less {
+ int* copies_;
+ TEST_CONSTEXPR explicit Less(int* copies) : copies_(copies) {}
+ TEST_CONSTEXPR_CXX14 Less(const Less& rhs) : copies_(rhs.copies_) { *copies_ += 1; }
+ TEST_CONSTEXPR_CXX14 Less& operator=(const Less&) = default;
+ TEST_CONSTEXPR bool operator()(T, T) const { return false; }
+};
+
+template <class T>
+struct Equal {
+ int* copies_;
+ TEST_CONSTEXPR explicit Equal(int* copies) : copies_(copies) {}
+ TEST_CONSTEXPR_CXX14 Equal(const Equal& rhs) : copies_(rhs.copies_) { *copies_ += 1; }
+ TEST_CONSTEXPR_CXX14 Equal& operator=(const Equal&) = default;
+ TEST_CONSTEXPR bool operator()(T, T) const { return true; }
+};
+
+template <class T>
+struct UnaryVoid {
+ int* copies_;
+ TEST_CONSTEXPR explicit UnaryVoid(int* copies) : copies_(copies) {}
+ TEST_CONSTEXPR_CXX14 UnaryVoid(const UnaryVoid& rhs) : copies_(rhs.copies_) { *copies_ += 1; }
+ TEST_CONSTEXPR_CXX14 UnaryVoid& operator=(const UnaryVoid&) = default;
+ TEST_CONSTEXPR_CXX14 void operator()(T) const {}
+};
+
+template <class T>
+struct UnaryTrue {
+ int* copies_;
+ TEST_CONSTEXPR explicit UnaryTrue(int* copies) : copies_(copies) {}
+ TEST_CONSTEXPR_CXX14 UnaryTrue(const UnaryTrue& rhs) : copies_(rhs.copies_) { *copies_ += 1; }
+ TEST_CONSTEXPR_CXX14 UnaryTrue& operator=(const UnaryTrue&) = default;
+ TEST_CONSTEXPR bool operator()(T) const { return true; }
+};
+
+template <class T>
+struct NullaryValue {
+ int* copies_;
+ TEST_CONSTEXPR explicit NullaryValue(int* copies) : copies_(copies) {}
+ TEST_CONSTEXPR_CXX14 NullaryValue(const NullaryValue& rhs) : copies_(rhs.copies_) { *copies_ += 1; }
+ TEST_CONSTEXPR_CXX14 NullaryValue& operator=(const NullaryValue&) = default;
+ TEST_CONSTEXPR T operator()() const { return 0; }
+};
+
+template <class T>
+struct UnaryTransform {
+ int* copies_;
+ TEST_CONSTEXPR explicit UnaryTransform(int* copies) : copies_(copies) {}
+ TEST_CONSTEXPR_CXX14 UnaryTransform(const UnaryTransform& rhs) : copies_(rhs.copies_) { *copies_ += 1; }
+ TEST_CONSTEXPR_CXX14 UnaryTransform& operator=(const UnaryTransform&) = default;
+ TEST_CONSTEXPR T operator()(T) const { return 0; }
+};
+
+template <class T>
+struct BinaryTransform {
+ int* copies_;
+ TEST_CONSTEXPR explicit BinaryTransform(int* copies) : copies_(copies) {}
+ TEST_CONSTEXPR_CXX14 BinaryTransform(const BinaryTransform& rhs) : copies_(rhs.copies_) { *copies_ += 1; }
+ TEST_CONSTEXPR_CXX14 BinaryTransform& operator=(const BinaryTransform&) = default;
+ TEST_CONSTEXPR T operator()(T, T) const { return 0; }
+};
+
+#if TEST_STD_VER > 17
+template <class T>
+struct ThreeWay {
+ int* copies_;
+ constexpr explicit ThreeWay(int* copies) : copies_(copies) {}
+ constexpr ThreeWay(const ThreeWay& rhs) : copies_(rhs.copies_) { *copies_ += 1; }
+ constexpr ThreeWay& operator=(const ThreeWay&) = default;
+ constexpr std::strong_ordering operator()(T, T) const { return std::strong_ordering::equal; }
+};
+#endif
+
+template <class T>
+TEST_CONSTEXPR_CXX20 bool all_the_algorithms() {
+ T a[10] = {};
+ T b[10] = {};
+ T* first = a;
+ T* mid = a + 5;
+ T* last = a + 10;
+ T* first2 = b;
+ T* mid2 = b + 5;
+ T* last2 = b + 10;
+ T value = 0;
+ int count = 1;
+
+ int copies = 0;
+ (void)std::adjacent_find(first, last, Equal<T>(&copies));
+ assert(copies == 0);
+#if TEST_STD_VER >= 11
+ (void)std::all_of(first, last, UnaryTrue<T>(&copies));
+ assert(copies == 0);
+ (void)std::any_of(first, last, UnaryTrue<T>(&copies));
+ assert(copies == 0);
+#endif
+ (void)std::binary_search(first, last, value, Less<T>(&copies));
+ assert(copies == 0);
+#if TEST_STD_VER > 17
+ (void)std::clamp(value, value, value, Less<T>(&copies));
+ assert(copies == 0);
+#endif
+ (void)std::count_if(first, last, UnaryTrue<T>(&copies));
+ assert(copies == 0);
+ (void)std::copy_if(first, last, first2, UnaryTrue<T>(&copies));
+ assert(copies == 0);
+ (void)std::equal(first, last, first2, Equal<T>(&copies));
+ assert(copies == 0);
+#if TEST_STD_VER > 11
+ (void)std::equal(first, last, first2, last2, Equal<T>(&copies));
+ assert(copies == 0);
+#endif
+ (void)std::equal_range(first, last, value, Less<T>(&copies));
+ assert(copies == 0);
+ (void)std::find_end(first, last, first2, mid2, Equal<T>(&copies));
+ assert(copies == 0);
+ (void)std::find_first_of(first, last, first2, last2, Equal<T>(&copies));
+ assert(copies == 0);
+ (void)std::find_if(first, last, UnaryTrue<T>(&copies));
+ assert(copies == 0);
+ (void)std::find_if_not(first, last, UnaryTrue<T>(&copies));
+ assert(copies == 0);
+ (void)std::for_each(first, last, UnaryVoid<T>(&copies));
+ assert(copies == 1);
+ copies = 0;
+#if TEST_STD_VER > 14
+ (void)std::for_each_n(first, count, UnaryVoid<T>(&copies));
+ assert(copies == 0);
+#endif
+ (void)std::generate(first, last, NullaryValue<T>(&copies));
+ assert(copies == 0);
+ (void)std::generate_n(first, count, NullaryValue<T>(&copies));
+ assert(copies == 0);
+ (void)std::includes(first, last, first2, last2, Less<T>(&copies));
+ assert(copies == 0);
+ (void)std::is_heap(first, last, Less<T>(&copies));
+ assert(copies == 0);
+ (void)std::is_heap_until(first, last, Less<T>(&copies));
+ assert(copies == 0);
+ (void)std::is_partitioned(first, last, UnaryTrue<T>(&copies));
+ assert(copies == 0);
+ (void)std::is_permutation(first, last, first2, Equal<T>(&copies));
+ assert(copies == 0);
+#if TEST_STD_VER > 11
+ (void)std::is_permutation(first, last, first2, last2, Equal<T>(&copies));
+ assert(copies == 0);
+#endif
+ (void)std::is_sorted(first, last, Less<T>(&copies));
+ assert(copies == 0);
+ (void)std::is_sorted_until(first, last, Less<T>(&copies));
+ assert(copies == 0);
+ if (!TEST_IS_CONSTANT_EVALUATED) {
+ (void)std::inplace_merge(first, mid, last, Less<T>(&copies));
+ assert(copies == 0);
+ }
+ (void)std::lexicographical_compare(first, last, first2, last2, Less<T>(&copies));
+ assert(copies == 0);
+#if TEST_STD_VER > 17
+ (void)std::lexicographical_compare_three_way(first, last, first2, last2, ThreeWay<T>(&copies));
+ assert(copies == 0);
+#endif
+ (void)std::lower_bound(first, last, value, Less<T>(&copies));
+ assert(copies == 0);
+ (void)std::make_heap(first, last, Less<T>(&copies));
+ assert(copies == 0);
+ (void)std::max(value, value, Less<T>(&copies));
+ assert(copies == 0);
+#if TEST_STD_VER >= 11
+ (void)std::max({value, value}, Less<T>(&copies));
+ assert(copies == 0);
+#endif
+ (void)std::max_element(first, last, Less<T>(&copies));
+ assert(copies == 0);
+ (void)std::merge(first, mid, mid, last, first2, Less<T>(&copies));
+ assert(copies == 0);
+ (void)std::min(value, value, Less<T>(&copies));
+ assert(copies == 0);
+#if TEST_STD_VER >= 11
+ (void)std::min({value, value}, Less<T>(&copies));
+ assert(copies == 0);
+#endif
+ (void)std::min_element(first, last, Less<T>(&copies));
+ assert(copies == 0);
+ (void)std::minmax(value, value, Less<T>(&copies));
+ assert(copies == 0);
+#if TEST_STD_VER >= 11
+ (void)std::minmax({value, value}, Less<T>(&copies));
+ assert(copies == 0);
+#endif
+ (void)std::minmax_element(first, last, Less<T>(&copies));
+ assert(copies == 0);
+ (void)std::mismatch(first, last, first2, Equal<T>(&copies));
+ assert(copies == 0);
+#if TEST_STD_VER > 11
+ (void)std::mismatch(first, last, first2, last2, Equal<T>(&copies));
+ assert(copies == 0);
+#endif
+ (void)std::next_permutation(first, last, Less<T>(&copies));
+ assert(copies == 0);
+#if TEST_STD_VER >= 11
+ (void)std::none_of(first, last, UnaryTrue<T>(&copies));
+ assert(copies == 0);
+#endif
+ (void)std::nth_element(first, mid, last, Less<T>(&copies));
+ assert(copies == 0);
+ (void)std::partial_sort(first, mid, last, Less<T>(&copies));
+ assert(copies == 0);
+ (void)std::partial_sort_copy(first, last, first2, mid2, Less<T>(&copies));
+ assert(copies == 0);
+ (void)std::partition(first, last, UnaryTrue<T>(&copies));
+ assert(copies == 0);
+ (void)std::partition_copy(first, last, first2, last2, UnaryTrue<T>(&copies));
+ assert(copies == 0);
+ (void)std::partition_point(first, last, UnaryTrue<T>(&copies));
+ assert(copies == 0);
+ (void)std::pop_heap(first, last, Less<T>(&copies));
+ assert(copies == 0);
+ (void)std::prev_permutation(first, last, Less<T>(&copies));
+ assert(copies == 0);
+ (void)std::push_heap(first, last, Less<T>(&copies));
+ assert(copies == 0);
+ (void)std::remove_copy_if(first, last, first2, UnaryTrue<T>(&copies));
+ assert(copies == 0);
+ (void)std::remove_if(first, last, UnaryTrue<T>(&copies));
+ assert(copies == 0);
+ (void)std::replace_copy_if(first, last, first2, UnaryTrue<T>(&copies), value);
+ assert(copies == 0);
+ (void)std::replace_if(first, last, UnaryTrue<T>(&copies), value);
+ assert(copies == 0);
+ (void)std::search(first, last, first2, mid2, Equal<T>(&copies));
+ assert(copies == 0);
+ (void)std::search_n(first, last, count, value, Equal<T>(&copies));
+ assert(copies == 0);
+ (void)std::set_difference(first, mid, mid, last, first2, Less<T>(&copies));
+ assert(copies == 0);
+ (void)std::set_intersection(first, mid, mid, last, first2, Less<T>(&copies));
+ assert(copies == 0);
+ (void)std::set_symmetric_difference(first, mid, mid, last, first2, Less<T>(&copies));
+ assert(copies == 0);
+ (void)std::set_union(first, mid, mid, last, first2, Less<T>(&copies));
+ assert(copies == 0);
+ (void)std::sort(first, first + 3, Less<T>(&copies));
+ assert(copies == 0);
+ (void)std::sort(first, first + 4, Less<T>(&copies));
+ assert(copies == 0);
+ (void)std::sort(first, first + 5, Less<T>(&copies));
+ assert(copies == 0);
+ (void)std::sort(first, last, Less<T>(&copies));
+ assert(copies == 0);
+ (void)std::sort_heap(first, last, Less<T>(&copies));
+ assert(copies == 0);
+ if (!TEST_IS_CONSTANT_EVALUATED) {
+ (void)std::stable_partition(first, last, UnaryTrue<T>(&copies));
+ assert(copies == 0);
+ }
+ if (!TEST_IS_CONSTANT_EVALUATED) {
+ (void)std::stable_sort(first, last, Less<T>(&copies));
+ assert(copies == 0);
+ }
+ (void)std::transform(first, last, first2, UnaryTransform<T>(&copies));
+ assert(copies == 0);
+ (void)std::transform(first, mid, mid, first2, BinaryTransform<T>(&copies));
+ assert(copies == 0);
+ (void)std::unique(first, last, Equal<T>(&copies));
+ assert(copies == 0);
+ (void)std::unique_copy(first, last, first2, Equal<T>(&copies));
+ assert(copies == 0);
+ (void)std::upper_bound(first, last, value, Less<T>(&copies));
+ assert(copies == 0);
+
+ return true;
+}
+
+bool test_segmented_iterator() {
+ int copies = 0;
+ std::deque<int> dq(10);
+ (void)std::for_each(dq.begin(), dq.end(), UnaryVoid<int>(&copies));
+ assert(copies == 1);
+ copies = 0;
+
+#if TEST_STD_VER >= 20
+ std::vector<std::vector<int>> vecs(3, std::vector<int>(10));
+ auto v = std::views::join(vecs);
+ (void)std::for_each(v.begin(), v.end(), UnaryVoid<int>(&copies));
+ assert(copies == 1);
+ copies = 0;
+#endif
+
+ return true;
+}
+
+int main(int, char**) {
+ all_the_algorithms<void*>();
+ all_the_algorithms<int>();
+ assert(test_segmented_iterator());
+#if TEST_STD_VER > 17
+ static_assert(all_the_algorithms<void*>());
+ static_assert(all_the_algorithms<int>());
+#endif
+
+ return 0;
+}
diff --git a/libcxx/test/libcxx-03/algorithms/robust_against_cpp20_hostile_iterators.compile.pass.cpp b/libcxx/test/libcxx-03/algorithms/robust_against_cpp20_hostile_iterators.compile.pass.cpp
new file mode 100644
index 0000000000000..03fef57ee259a
--- /dev/null
+++ b/libcxx/test/libcxx-03/algorithms/robust_against_cpp20_hostile_iterators.compile.pass.cpp
@@ -0,0 +1,225 @@
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// Check that all STL classic algorithms can be instantiated with a C++20-hostile iterator
+
+// ADDITIONAL_COMPILE_FLAGS: -Wno-ambiguous-reversed-operator
+
+#include <algorithm>
+#include <functional>
+#include <iterator>
+#include <random>
+
+#include "test_macros.h"
+
+template <class Sub, class Iterator>
+struct IteratorAdaptorBase {
+ using OutTraits = std::iterator_traits<Iterator>;
+ using iterator_category = typename OutTraits::iterator_category;
+ using value_type = typename OutTraits::value_type;
+ using pointer = typename OutTraits::pointer;
+ using reference = typename OutTraits::reference;
+ using difference_type = typename OutTraits::difference_type;
+
+ IteratorAdaptorBase() {}
+ IteratorAdaptorBase(Iterator) {}
+
+ Sub& sub() { return static_cast<Sub&>(*this); }
+ const Sub& sub() const { return static_cast<Sub&>(*this); }
+
+ const Iterator& base() const { return it_; }
+
+ reference get() const { return *it_; }
+ reference operator*() const { return *it_; }
+ pointer operator->() const { return it_; }
+ reference operator[](difference_type) const { return *it_; }
+
+ Sub& operator++() { return static_cast<Sub&>(*this); }
+ Sub& operator--() { return static_cast<Sub&>(*this); }
+ Sub operator++(int) { return static_cast<Sub&>(*this); }
+ Sub operator--(int) { return static_cast<Sub&>(*this); }
+
+ Sub& operator+=(difference_type) { return static_cast<Sub&>(*this); }
+ Sub& operator-=(difference_type) { return static_cast<Sub&>(*this); }
+ bool operator==(Sub) const { return false; }
+ bool operator!=(Sub) const { return false; }
+ bool operator==(Iterator b) const { return *this == Sub(b); }
+ bool operator!=(Iterator b) const { return *this != Sub(b); }
+
+ friend Sub operator+(Sub, difference_type) { return Sub(); }
+ friend Sub operator+(difference_type, Sub) { return Sub(); }
+ friend Sub operator-(Sub, difference_type) { return Sub(); }
+ friend difference_type operator-(Sub, Sub) { return 0; }
+
+ friend bool operator<(Sub, Sub) { return false; }
+ friend bool operator>(Sub, Sub) { return false; }
+ friend bool operator<=(Sub, Sub) { return false; }
+ friend bool operator>=(Sub, Sub) { return false; }
+
+ private:
+ Iterator it_;
+};
+
+template <typename It>
+struct Cpp20HostileIterator
+ : IteratorAdaptorBase<Cpp20HostileIterator<It>, It> {
+ Cpp20HostileIterator() {}
+ Cpp20HostileIterator(It) {}
+};
+
+struct Pred {
+ bool operator()(int, int) const { return false; }
+ bool operator()(int) const { return false; }
+ int operator()() const { return 0; }
+};
+
+void test() {
+ Cpp20HostileIterator<int*> it;
+ Pred pred;
+ std::mt19937_64 rng;
+
+ (void) std::adjacent_find(it, it);
+ (void) std::adjacent_find(it, it, pred);
+ (void) std::all_of(it, it, pred);
+ (void) std::any_of(it, it, pred);
+ (void) std::binary_search(it, it, 0);
+ (void) std::binary_search(it, it, 0, pred);
+ (void) std::copy_backward(it, it, it);
+ (void) std::copy_if(it, it, it, pred);
+ (void) std::copy_n(it, 0, it);
+ (void) std::copy(it, it, it);
+ (void) std::count_if(it, it, pred);
+ (void) std::count(it, it, 0);
+ (void) std::equal_range(it, it, 0);
+ (void) std::equal_range(it, it, 0, pred);
+ (void) std::equal(it, it, it);
+ (void) std::equal(it, it, it, pred);
+#if TEST_STD_VER > 11
+ (void) std::equal(it, it, it, it);
+ (void) std::equal(it, it, it, it, pred);
+#endif
+ (void) std::fill_n(it, 0, 0);
+ (void) std::fill(it, it, 0);
+ (void) std::find_end(it, it, it, it);
+ (void) std::find_end(it, it, it, it, pred);
+ (void) std::find_first_of(it, it, it, it);
+ (void) std::find_first_of(it, it, it, it, pred);
+ (void) std::find_if_not(it, it, pred);
+ (void) std::find_if(it, it, pred);
+ (void) std::find(it, it, 0);
+#if TEST_STD_VER > 14
+ (void) std::for_each_n(it, 0, pred);
+#endif
+ (void) std::for_each(it, it, pred);
+ (void) std::generate_n(it, 0, pred);
+ (void) std::generate(it, it, pred);
+ (void) std::includes(it, it, it, it);
+ (void) std::includes(it, it, it, it, pred);
+ (void) std::inplace_merge(it, it, it);
+ (void) std::inplace_merge(it, it, it, pred);
+ (void) std::is_heap_until(it, it);
+ (void) std::is_heap_until(it, it, pred);
+ (void) std::is_heap(it, it);
+ (void) std::is_heap(it, it, pred);
+ (void) std::is_partitioned(it, it, pred);
+ (void) std::is_permutation(it, it, it);
+ (void) std::is_permutation(it, it, it, pred);
+#if TEST_STD_VER > 11
+ (void) std::is_permutation(it, it, it, it);
+ (void) std::is_permutation(it, it, it, it, pred);
+#endif
+ (void) std::is_sorted_until(it, it);
+ (void) std::is_sorted_until(it, it, pred);
+ (void) std::is_sorted(it, it);
+ (void) std::is_sorted(it, it, pred);
+ (void) std::lexicographical_compare(it, it, it, it);
+ (void) std::lexicographical_compare(it, it, it, it, pred);
+#if TEST_STD_VER > 17
+ (void)std::lexicographical_compare_three_way(it, it, it, it);
+ (void)std::lexicographical_compare_three_way(it, it, it, it, std::compare_three_way());
+#endif
+ (void) std::lower_bound(it, it, 0);
+ (void) std::lower_bound(it, it, 0, pred);
+ (void) std::make_heap(it, it);
+ (void) std::make_heap(it, it, pred);
+ (void) std::max_element(it, it);
+ (void) std::max_element(it, it, pred);
+ (void) std::merge(it, it, it, it, it);
+ (void) std::merge(it, it, it, it, it, pred);
+ (void) std::min_element(it, it);
+ (void) std::min_element(it, it, pred);
+ (void) std::minmax_element(it, it);
+ (void) std::minmax_element(it, it, pred);
+ (void) std::mismatch(it, it, it);
+ (void) std::mismatch(it, it, it, pred);
+ (void) std::move_backward(it, it, it);
+ (void) std::move(it, it, it);
+ (void) std::next_permutation(it, it);
+ (void) std::next_permutation(it, it, pred);
+ (void) std::none_of(it, it, pred);
+ (void) std::nth_element(it, it, it);
+ (void) std::nth_element(it, it, it, pred);
+ (void) std::partial_sort_copy(it, it, it, it);
+ (void) std::partial_sort_copy(it, it, it, it, pred);
+ (void) std::partial_sort(it, it, it);
+ (void) std::partial_sort(it, it, it, pred);
+ (void) std::partition_copy(it, it, it, it, pred);
+ (void) std::partition_point(it, it, pred);
+ (void) std::partition(it, it, pred);
+ (void) std::pop_heap(it, it);
+ (void) std::pop_heap(it, it, pred);
+ (void) std::prev_permutation(it, it);
+ (void) std::prev_permutation(it, it, pred);
+ (void) std::push_heap(it, it);
+ (void) std::push_heap(it, it, pred);
+ (void) std::remove_copy_if(it, it, it, pred);
+ (void) std::remove_copy(it, it, it, 0);
+ (void) std::remove_if(it, it, pred);
+ (void) std::remove(it, it, 0);
+ (void) std::replace_copy_if(it, it, it, pred, 0);
+ (void) std::replace_copy(it, it, it, 0, 0);
+ (void) std::replace_if(it, it, pred, 0);
+ (void) std::replace(it, it, 0, 0);
+ (void) std::reverse_copy(it, it, it);
+ (void) std::reverse(it, it);
+ (void) std::rotate_copy(it, it, it, it);
+ (void) std::rotate(it, it, it);
+#if TEST_STD_VER > 14
+ (void) std::sample(it, it, it, 0, rng);
+#endif
+ (void) std::search(it, it, it, it);
+ (void) std::search(it, it, it, it, pred);
+#if TEST_STD_VER > 14
+ (void) std::search(it, it, std::default_searcher<Cpp20HostileIterator<int*>>(it, it));
+#endif
+ (void) std::set_difference(it, it, it, it, it);
+ (void) std::set_difference(it, it, it, it, it, pred);
+ (void) std::set_intersection(it, it, it, it, it);
+ (void) std::set_intersection(it, it, it, it, it, pred);
+ (void) std::set_symmetric_difference(it, it, it, it, it);
+ (void) std::set_symmetric_difference(it, it, it, it, it, pred);
+ (void) std::set_union(it, it, it, it, it);
+ (void) std::set_union(it, it, it, it, it, pred);
+#if TEST_STD_VER > 17
+ (void) std::shift_left(it, it, 0);
+ (void) std::shift_right(it, it, 0);
+#endif
+ (void) std::shuffle(it, it, rng);
+ (void) std::sort_heap(it, it);
+ (void) std::sort_heap(it, it, pred);
+ (void) std::sort(it, it);
+ (void) std::sort(it, it, pred);
+ (void) std::stable_partition(it, it, pred);
+ (void) std::stable_sort(it, it);
+ (void) std::swap_ranges(it, it, it);
+ (void) std::transform(it, it, it, pred);
+ (void) std::transform(it, it, it, it, pred);
+ (void) std::unique_copy(it, it, it);
+ (void) std::unique(it, it);
+ (void) std::upper_bound(it, it, 0);
+}
diff --git a/libcxx/test/libcxx-03/algorithms/robust_against_using_non_transparent_comparators.pass.cpp b/libcxx/test/libcxx-03/algorithms/robust_against_using_non_transparent_comparators.pass.cpp
new file mode 100644
index 0000000000000..39870ebe7ff02
--- /dev/null
+++ b/libcxx/test/libcxx-03/algorithms/robust_against_using_non_transparent_comparators.pass.cpp
@@ -0,0 +1,80 @@
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#include <algorithm>
+#include <cassert>
+#include <cstddef>
+#include <iterator>
+
+#include "test_macros.h"
+
+template <class T>
+struct Iterator {
+ using value_type = T;
+ using pointer = value_type*;
+ using difference_type = std::ptrdiff_t;
+ using iterator_category = std::forward_iterator_tag;
+ struct reference {
+ T* ptr_;
+
+ reference(T* ptr) : ptr_(ptr) {}
+
+ friend bool operator<(reference a, reference b) { return *a.ptr_ < *b.ptr_; }
+ friend bool operator<(reference a, value_type const& b) { return *a.ptr_ < b; }
+ friend bool operator<(value_type const& a, reference b) { return a < *b.ptr_; }
+
+ operator T&() const;
+ };
+
+ Iterator& operator++() {
+ ptr_++;
+ return *this;
+ }
+
+ Iterator operator++(int) {
+ Iterator tmp = *this;
+ ptr_++;
+ return tmp;
+ }
+
+ friend bool operator==(Iterator const& a, Iterator const& b) { return a.ptr_ == b.ptr_; }
+ friend bool operator!=(Iterator const& a, Iterator const& b) { return !(a == b); }
+
+ reference operator*() const { return reference(ptr_); }
+
+ explicit Iterator(T* ptr) : ptr_(ptr) {}
+ Iterator() = default;
+ Iterator(Iterator const&) = default;
+ Iterator(Iterator&&) = default;
+
+ Iterator& operator=(Iterator const&) = default;
+ Iterator& operator=(Iterator&&) = default;
+
+private:
+ T* ptr_;
+};
+
+int main(int, char**) {
+ int array[5] = {1, 2, 3, 4, 5};
+ Iterator<int> first(array);
+ Iterator<int> middle(array + 3);
+ Iterator<int> last(array + 5);
+ (void)std::binary_search(first, last, 3);
+ (void)std::equal_range(first, last, 3);
+ (void)std::includes(first, last, first, last);
+ (void)std::is_sorted_until(first, last);
+ (void)std::is_sorted(first, last);
+ (void)std::lexicographical_compare(first, last, first, last);
+ (void)std::lower_bound(first, last, 3);
+ (void)std::max_element(first, last);
+ (void)std::min_element(first, last);
+ (void)std::minmax_element(first, last);
+ (void)std::upper_bound(first, last, 3);
+
+ return 0;
+}
diff --git a/libcxx/test/libcxx-03/assertions/customize_verbose_abort.compile-time.pass.cpp b/libcxx/test/libcxx-03/assertions/customize_verbose_abort.compile-time.pass.cpp
new file mode 100644
index 0000000000000..69154c3f7eaff
--- /dev/null
+++ b/libcxx/test/libcxx-03/assertions/customize_verbose_abort.compile-time.pass.cpp
@@ -0,0 +1,27 @@
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// This compile-time customization requires cross-file macros, which doesn't work with modules.
+// UNSUPPORTED: clang-modules-build
+
+// Make sure that we can customize the verbose termination function at compile-time by
+// defining _LIBCPP_VERBOSE_ABORT ourselves. Note that this does not have any
+// deployment target requirements.
+
+// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_VERBOSE_ABORT(...)=my_abort(__VA_ARGS__)
+
+#include <cstdlib>
+
+void my_abort(char const*, ...) {
+ std::exit(EXIT_SUCCESS);
+}
+
+int main(int, char**) {
+ _LIBCPP_VERBOSE_ABORT("%s", "message");
+ return EXIT_FAILURE;
+}
diff --git a/libcxx/test/libcxx-03/assertions/customize_verbose_abort.link-time.pass.cpp b/libcxx/test/libcxx-03/assertions/customize_verbose_abort.link-time.pass.cpp
new file mode 100644
index 0000000000000..390c6b6db190d
--- /dev/null
+++ b/libcxx/test/libcxx-03/assertions/customize_verbose_abort.link-time.pass.cpp
@@ -0,0 +1,25 @@
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// Test that we can set a custom verbose termination function at link-time.
+
+// We flag uses of the verbose termination function in older dylibs at compile-time to avoid runtime
+// failures when back-deploying.
+// XFAIL: availability-verbose_abort-missing
+
+// XFAIL: FROZEN-CXX03-HEADERS-FIXME
+
+#include <__verbose_abort>
+#include <cstdlib>
+
+void std::__libcpp_verbose_abort(char const*, ...) _NOEXCEPT { std::exit(EXIT_SUCCESS); }
+
+int main(int, char**) {
+ std::__libcpp_verbose_abort("%s", "message");
+ return EXIT_FAILURE;
+}
diff --git a/libcxx/test/libcxx-03/assertions/default_verbose_abort.pass.cpp b/libcxx/test/libcxx-03/assertions/default_verbose_abort.pass.cpp
new file mode 100644
index 0000000000000..803868b757794
--- /dev/null
+++ b/libcxx/test/libcxx-03/assertions/default_verbose_abort.pass.cpp
@@ -0,0 +1,28 @@
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// Test that the default verbose termination function aborts the program.
+// XFAIL: availability-verbose_abort-missing
+
+// XFAIL: FROZEN-CXX03-HEADERS-FIXME
+
+#include <__verbose_abort>
+#include <csignal>
+#include <cstdlib>
+
+void signal_handler(int signal) {
+ if (signal == SIGABRT)
+ std::_Exit(EXIT_SUCCESS);
+ std::_Exit(EXIT_FAILURE);
+}
+
+int main(int, char**) {
+ if (std::signal(SIGABRT, signal_handler) != SIG_ERR)
+ std::__libcpp_verbose_abort("%s", "foo");
+ return EXIT_FAILURE;
+}
diff --git a/libcxx/test/libcxx-03/assertions/modes/hardening_mode_incorrect_value.sh.cpp b/libcxx/test/libcxx-03/assertions/modes/hardening_mode_incorrect_value.sh.cpp
new file mode 100644
index 0000000000000..751ff7247445f
--- /dev/null
+++ b/libcxx/test/libcxx-03/assertions/modes/hardening_mode_incorrect_value.sh.cpp
@@ -0,0 +1,26 @@
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// This test verifies that setting the hardening mode to a value that's not part of the predefined constants triggers
+// a compile-time error.
+
+// Modules build produces a different error ("Could not build module 'std'").
+// UNSUPPORTED: clang-modules-build
+// REQUIRES: verify-support
+
+// Note that GCC doesn't support `-Wno-macro-redefined`.
+// RUN: %{verify} -U_LIBCPP_HARDENING_MODE -D_LIBCPP_HARDENING_MODE=42
+// Make sure that common cases of misuse produce readable errors. We deliberately disallow setting the hardening mode as
+// if it were a boolean flag.
+// RUN: %{verify} -U_LIBCPP_HARDENING_MODE -D_LIBCPP_HARDENING_MODE=0
+// RUN: %{verify} -U_LIBCPP_HARDENING_MODE -D_LIBCPP_HARDENING_MODE=1
+// RUN: %{verify} -U_LIBCPP_HARDENING_MODE -D_LIBCPP_HARDENING_MODE
+
+#include <cassert>
+
+// expected-error@*:* {{_LIBCPP_HARDENING_MODE must be set to one of the following values: _LIBCPP_HARDENING_MODE_NONE, _LIBCPP_HARDENING_MODE_FAST, _LIBCPP_HARDENING_MODE_EXTENSIVE, _LIBCPP_HARDENING_MODE_DEBUG}}
diff --git a/libcxx/test/libcxx-03/assertions/modes/none.pass.cpp b/libcxx/test/libcxx-03/assertions/modes/none.pass.cpp
new file mode 100644
index 0000000000000..b64290a31a129
--- /dev/null
+++ b/libcxx/test/libcxx-03/assertions/modes/none.pass.cpp
@@ -0,0 +1,32 @@
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// This test checks that if no hardening mode is defined (i.e., in the unchecked mode), by default assertions aren't
+// triggered.
+
+// REQUIRES: libcpp-hardening-mode=none
+
+// XFAIL: FROZEN-CXX03-HEADERS-FIXME
+
+#include <__assert>
+#include <cassert>
+
+bool executed_condition = false;
+bool f() {
+ executed_condition = true;
+ return false;
+}
+
+int main(int, char**) {
+ _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(true, "Should not fire");
+ _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(false, "Also should not fire");
+ _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(f(), "Should not execute anything");
+ assert(!executed_condition); // Really make sure we did not execute anything.
+
+ return 0;
+}
diff --git a/libcxx/test/libcxx-03/assertions/single_expression.pass.cpp b/libcxx/test/libcxx-03/assertions/single_expression.pass.cpp
new file mode 100644
index 0000000000000..474edc9dc0833
--- /dev/null
+++ b/libcxx/test/libcxx-03/assertions/single_expression.pass.cpp
@@ -0,0 +1,34 @@
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// Make sure that `_LIBCPP_ASSERT` and `_LIBCPP_ASSUME` are each a single expression.
+// This is useful so we can use them in places that require an expression, such as
+// in a constructor initializer list.
+
+// XFAIL: FROZEN-CXX03-HEADERS-FIXME
+
+#include <__assert>
+#include <cassert>
+
+void f() {
+ int i = (_LIBCPP_ASSERT(true, "message"), 3);
+ assert(i == 3);
+ return _LIBCPP_ASSERT(true, "message");
+}
+
+void g() {
+ int i = (_LIBCPP_ASSUME(true), 3);
+ assert(i == 3);
+ return _LIBCPP_ASSUME(true);
+}
+
+int main(int, char**) {
+ f();
+ g();
+ return 0;
+}
diff --git a/libcxx/test/libcxx-03/atomics/atomics.flag/init_bool.pass.cpp b/libcxx/test/libcxx-03/atomics/atomics.flag/init_bool.pass.cpp
new file mode 100644
index 0000000000000..7678775527419
--- /dev/null
+++ b/libcxx/test/libcxx-03/atomics/atomics.flag/init_bool.pass.cpp
@@ -0,0 +1,43 @@
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// <atomic>
+
+// struct atomic_flag
+
+// TESTING EXTENSION atomic_flag(bool)
+
+#include <atomic>
+#include <cassert>
+
+#include "test_macros.h"
+
+#if TEST_STD_VER >= 11
+// Ensure that static initialization happens; this is PR#37226
+extern std::atomic_flag global;
+struct X { X() { global.test_and_set(); }};
+X x;
+std::atomic_flag global{false};
+#endif
+
+int main(int, char**)
+{
+#if TEST_STD_VER >= 11
+ assert(global.test_and_set() == 1);
+#endif
+ {
+ std::atomic_flag f(false);
+ assert(f.test_and_set() == 0);
+ }
+ {
+ std::atomic_flag f(true);
+ assert(f.test_and_set() == 1);
+ }
+
+ return 0;
+}
diff --git a/libcxx/test/libcxx-03/atomics/atomics.order/memory_order.underlying_type.pass.cpp b/libcxx/test/libcxx-03/atomics/atomics.order/memory_order.underlying_type.pass.cpp
new file mode 100644
index 0000000000000..5379ef8787d56
--- /dev/null
+++ b/libcxx/test/libcxx-03/atomics/atomics.order/memory_order.underlying_type.pass.cpp
@@ -0,0 +1,34 @@
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// This test ensures that std::memory_order has the same size under all
+// standard versions to make sure we're not breaking the ABI. This is
+// relevant because std::memory_order is a scoped enumeration in C++20,
+// but an unscoped enumeration pre-C++20.
+//
+// See PR40977 for details.
+
+#include <atomic>
+#include <type_traits>
+
+#include "test_macros.h"
+
+
+enum cpp17_memory_order {
+ cpp17_memory_order_relaxed, cpp17_memory_order_consume, cpp17_memory_order_acquire,
+ cpp17_memory_order_release, cpp17_memory_order_acq_rel, cpp17_memory_order_seq_cst
+};
+
+static_assert((std::is_same<std::underlying_type<cpp17_memory_order>::type,
+ std::underlying_type<std::memory_order>::type>::value),
+ "std::memory_order should have the same underlying type as a corresponding "
+ "unscoped enumeration would. Otherwise, our ABI changes from C++17 to C++20.");
+
+int main(int, char**) {
+ return 0;
+}
diff --git a/libcxx/test/libcxx-03/atomics/atomics.syn/incompatible_with_stdatomic.verify.cpp b/libcxx/test/libcxx-03/atomics/atomics.syn/incompatible_with_stdatomic.verify.cpp
new file mode 100644
index 0000000000000..a788ea32dddc8
--- /dev/null
+++ b/libcxx/test/libcxx-03/atomics/atomics.syn/incompatible_with_stdatomic.verify.cpp
@@ -0,0 +1,25 @@
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: no-threads
+// REQUIRES: c++03 || c++11 || c++14 || c++17 || c++20
+
+// No diagnostic gets emitted when we build with modules.
+// XFAIL: clang-modules-build
+
+// This test ensures that we issue a reasonable diagnostic when including <atomic> after
+// <stdatomic.h> has been included. Before C++23, this otherwise leads to obscure errors
+// because <atomic> may try to redefine things defined by <stdatomic.h>.
+
+// Ignore additional weird errors that happen when the two headers are mixed.
+// ADDITIONAL_COMPILE_FLAGS: -Xclang -verify-ignore-unexpected=error -Xclang -verify-ignore-unexpected=warning
+
+#include <stdatomic.h>
+#include <atomic>
+
+// expected-error@*:* {{<atomic> is incompatible with <stdatomic.h> before C++23.}}
diff --git a/libcxx/test/libcxx-03/atomics/atomics.types.operations/atomics.types.operations.req/atomic_fetch_add.verify.cpp b/libcxx/test/libcxx-03/atomics/atomics.types.operations/atomics.types.operations.req/atomic_fetch_add.verify.cpp
new file mode 100644
index 0000000000000..320ef57dcb6f9
--- /dev/null
+++ b/libcxx/test/libcxx-03/atomics/atomics.types.operations/atomics.types.operations.req/atomic_fetch_add.verify.cpp
@@ -0,0 +1,76 @@
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// XFAIL: FROZEN-CXX03-HEADERS-FIXME
+
+// <atomic>
+
+// template <class T>
+// T* atomic_fetch_add(volatile atomic<T*>* obj, ptrdiff_t op)
+// template <class T>
+// T* atomic_fetch_add(atomic<T*>* obj, ptrdiff_t op);
+
+#include <atomic>
+
+void void_pointer() {
+ {
+ volatile std::atomic<void*> obj;
+ // expected-error@*:* {{incomplete type 'void' where a complete type is required}}
+ std::atomic_fetch_add(&obj, 0);
+ }
+ {
+ std::atomic<void*> obj;
+ // expected-error@*:* {{incomplete type 'void' where a complete type is required}}
+ std::atomic_fetch_add(&obj, 0);
+ }
+}
+
+struct Incomplete;
+
+void pointer_to_incomplete_type() {
+ {
+ volatile std::atomic<Incomplete*> obj;
+ // expected-error@*:* {{incomplete type 'Incomplete' where a complete type is required}}
+ std::atomic_fetch_add(&obj, 0);
+ }
+ {
+ std::atomic<Incomplete*> obj;
+ // expected-error@*:* {{incomplete type 'Incomplete' where a complete type is required}}
+ std::atomic_fetch_add(&obj, 0);
+ }
+}
+
+void function_pointer() {
+ {
+ volatile std::atomic<void (*)(int)> fun;
+ // expected-error-re@*:* {{static assertion failed due to requirement '!is_function<void (int)>::value'{{.*}}Pointer to function isn't allowed}}
+ std::atomic_fetch_add(&fun, 0);
+ }
+ {
+ std::atomic<void (*)(int)> fun;
+ // expected-error-re@*:* {{static assertion failed due to requirement '!is_function<void (int)>::value'{{.*}}Pointer to function isn't allowed}}
+ std::atomic_fetch_add(&fun, 0);
+ }
+}
+
+struct S {
+ void fun(int);
+};
+
+void member_function_pointer() {
+ {
+ volatile std::atomic<void (S::*)(int)> fun;
+ // expected-error@*:* {{no matching function for call to 'atomic_fetch_add'}}
+ std::atomic_fetch_add(&fun, 0);
+ }
+ {
+ std::atomic<void (S::*)(int)> fun;
+ // expected-error@*:* {{no matching function for call to 'atomic_fetch_add'}}
+ std::atomic_fetch_add(&fun, 0);
+ }
+}
diff --git a/libcxx/test/libcxx-03/atomics/atomics.types.operations/atomics.types.operations.req/atomic_fetch_add_explicit.verify.cpp b/libcxx/test/libcxx-03/atomics/atomics.types.operations/atomics.types.operations.req/atomic_fetch_add_explicit.verify.cpp
new file mode 100644
index 0000000000000..bdd8089feb281
--- /dev/null
+++ b/libcxx/test/libcxx-03/atomics/atomics.types.operations/atomics.types.operations.req/atomic_fetch_add_explicit.verify.cpp
@@ -0,0 +1,79 @@
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// XFAIL: FROZEN-CXX03-HEADERS-FIXME
+
+// <atomic>
+
+// template <class T>
+// T*
+// atomic_fetch_add_explicit(volatile atomic<T*>* obj, ptrdiff_t op,
+// memory_order m);
+// template <class T>
+// T*
+// atomic_fetch_add_explicit(atomic<T*>* obj, ptrdiff_t op, memory_order m);
+
+#include <atomic>
+
+void void_pointer() {
+ {
+ volatile std::atomic<void*> obj;
+ // expected-error@*:* {{incomplete type 'void' where a complete type is required}}
+ std::atomic_fetch_add_explicit(&obj, 0, std::memory_order_relaxed);
+ }
+ {
+ std::atomic<void*> obj;
+ // expected-error@*:* {{incomplete type 'void' where a complete type is required}}
+ std::atomic_fetch_add_explicit(&obj, 0, std::memory_order_relaxed);
+ }
+}
+
+struct Incomplete;
+
+void pointer_to_incomplete_type() {
+ {
+ volatile std::atomic<Incomplete*> obj;
+ // expected-error@*:* {{incomplete type 'Incomplete' where a complete type is required}}
+ std::atomic_fetch_add_explicit(&obj, 0, std::memory_order_relaxed);
+ }
+ {
+ std::atomic<Incomplete*> obj;
+ // expected-error@*:* {{incomplete type 'Incomplete' where a complete type is required}}
+ std::atomic_fetch_add_explicit(&obj, 0, std::memory_order_relaxed);
+ }
+}
+
+void function_pointer() {
+ {
+ volatile std::atomic<void (*)(int)> fun;
+ // expected-error-re@*:* {{static assertion failed due to requirement '!is_function<void (int)>::value'{{.*}}Pointer to function isn't allowed}}
+ std::atomic_fetch_add_explicit(&fun, 0, std::memory_order_relaxed);
+ }
+ {
+ std::atomic<void (*)(int)> fun;
+ // expected-error-re@*:* {{static assertion failed due to requirement '!is_function<void (int)>::value'{{.*}}Pointer to function isn't allowed}}
+ std::atomic_fetch_add_explicit(&fun, 0, std::memory_order_relaxed);
+ }
+}
+
+struct S {
+ void fun(int);
+};
+
+void member_function_pointer() {
+ {
+ volatile std::atomic<void (S::*)(int)> fun;
+ // expected-error@*:* {{no matching function for call to 'atomic_fetch_add_explicit'}}
+ std::atomic_fetch_add_explicit(&fun, 0, std::memory_order_relaxed);
+ }
+ {
+ std::atomic<void (S::*)(int)> fun;
+ // expected-error@*:* {{no matching function for call to 'atomic_fetch_add_explicit'}}
+ std::atomic_fetch_add_explicit(&fun, 0, std::memory_order_relaxed);
+ }
+}
diff --git a/libcxx/test/libcxx-03/atomics/atomics.types.operations/atomics.types.operations.req/atomic_fetch_sub.verify.cpp b/libcxx/test/libcxx-03/atomics/atomics.types.operations/atomics.types.operations.req/atomic_fetch_sub.verify.cpp
new file mode 100644
index 0000000000000..2c9f89891d5be
--- /dev/null
+++ b/libcxx/test/libcxx-03/atomics/atomics.types.operations/atomics.types.operations.req/atomic_fetch_sub.verify.cpp
@@ -0,0 +1,76 @@
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// XFAIL: FROZEN-CXX03-HEADERS-FIXME
+
+// <atomic>
+
+// template <class T>
+// T* atomic_fetch_sub(volatile atomic<T*>* obj, ptrdiff_t op)
+// template <class T>
+// T* atomic_fetch_sub(atomic<T*>* obj, ptrdiff_t op);
+
+#include <atomic>
+
+void void_pointer() {
+ {
+ volatile std::atomic<void*> obj;
+ // expected-error@*:* {{incomplete type 'void' where a complete type is required}}
+ std::atomic_fetch_sub(&obj, 0);
+ }
+ {
+ std::atomic<void*> obj;
+ // expected-error@*:* {{incomplete type 'void' where a complete type is required}}
+ std::atomic_fetch_sub(&obj, 0);
+ }
+}
+
+struct Incomplete;
+
+void pointer_to_incomplete_type() {
+ {
+ volatile std::atomic<Incomplete*> obj;
+ // expected-error@*:* {{incomplete type 'Incomplete' where a complete type is required}}
+ std::atomic_fetch_sub(&obj, 0);
+ }
+ {
+ std::atomic<Incomplete*> obj;
+ // expected-error@*:* {{incomplete type 'Incomplete' where a complete type is required}}
+ std::atomic_fetch_sub(&obj, 0);
+ }
+}
+
+void function_pointer() {
+ {
+ volatile std::atomic<void (*)(int)> fun;
+ // expected-error-re@*:* {{static assertion failed due to requirement '!is_function<void (int)>::value'{{.*}}Pointer to function isn't allowed}}
+ std::atomic_fetch_sub(&fun, 0);
+ }
+ {
+ std::atomic<void (*)(int)> fun;
+ // expected-error-re@*:* {{static assertion failed due to requirement '!is_function<void (int)>::value'{{.*}}Pointer to function isn't allowed}}
+ std::atomic_fetch_sub(&fun, 0);
+ }
+}
+
+struct S {
+ void fun(int);
+};
+
+void member_function_pointer() {
+ {
+ volatile std::atomic<void (S::*)(int)> fun;
+ // expected-error@*:* {{no matching function for call to 'atomic_fetch_sub'}}
+ std::atomic_fetch_sub(&fun, 0);
+ }
+ {
+ std::atomic<void (S::*)(int)> fun;
+ // expected-error@*:* {{no matching function for call to 'atomic_fetch_sub'}}
+ std::atomic_fetch_sub(&fun, 0);
+ }
+}
diff --git a/libcxx/test/libcxx-03/atomics/atomics.types.operations/atomics.types.operations.req/atomic_fetch_sub_explicit.verify.cpp b/libcxx/test/libcxx-03/atomics/atomics.types.operations/atomics.types.operations.req/atomic_fetch_sub_explicit.verify.cpp
new file mode 100644
index 0000000000000..88c42750b608a
--- /dev/null
+++ b/libcxx/test/libcxx-03/atomics/atomics.types.operations/atomics.types.operations.req/atomic_fetch_sub_explicit.verify.cpp
@@ -0,0 +1,79 @@
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// XFAIL: FROZEN-CXX03-HEADERS-FIXME
+
+// <atomic>
+
+// template <class T>
+// T*
+// atomic_fetch_sub_explicit(volatile atomic<T*>* obj, ptrdiff_t op,
+// memory_order m);
+// template <class T>
+// T*
+// atomic_fetch_sub_explicit(atomic<T*>* obj, ptrdiff_t op, memory_order m);
+
+#include <atomic>
+
+void void_pointer() {
+ {
+ volatile std::atomic<void*> obj;
+ // expected-error@*:* {{incomplete type 'void' where a complete type is required}}
+ std::atomic_fetch_sub_explicit(&obj, 0, std::memory_order_relaxed);
+ }
+ {
+ std::atomic<void*> obj;
+ // expected-error@*:* {{incomplete type 'void' where a complete type is required}}
+ std::atomic_fetch_sub_explicit(&obj, 0, std::memory_order_relaxed);
+ }
+}
+
+struct Incomplete;
+
+void pointer_to_incomplete_type() {
+ {
+ volatile std::atomic<Incomplete*> obj;
+ // expected-error@*:* {{incomplete type 'Incomplete' where a complete type is required}}
+ std::atomic_fetch_sub_explicit(&obj, 0, std::memory_order_relaxed);
+ }
+ {
+ std::atomic<Incomplete*> obj;
+ // expected-error@*:* {{incomplete type 'Incomplete' where a complete type is required}}
+ std::atomic_fetch_sub_explicit(&obj, 0, std::memory_order_relaxed);
+ }
+}
+
+void function_pointer() {
+ {
+ volatile std::atomic<void (*)(int)> fun;
+ // expected-error-re@*:* {{static assertion failed due to requirement '!is_function<void (int)>::value'{{.*}}Pointer to function isn't allowed}}
+ std::atomic_fetch_sub_explicit(&fun, 0, std::memory_order_relaxed);
+ }
+ {
+ std::atomic<void (*)(int)> fun;
+ // expected-error-re@*:* {{static assertion failed due to requirement '!is_function<void (int)>::value'{{.*}}Pointer to function isn't allowed}}
+ std::atomic_fetch_sub_explicit(&fun, 0, std::memory_order_relaxed);
+ }
+}
+
+struct S {
+ void fun(int);
+};
+
+void member_function_pointer() {
+ {
+ volatile std::atomic<void (S::*)(int)> fun;
+ // expected-error@*:* {{no matching function for call to 'atomic_fetch_sub_explicit'}}
+ std::atomic_fetch_sub_explicit(&fun, 0, std::memory_order_relaxed);
+ }
+ {
+ std::atomic<void (S::*)(int)> fun;
+ // expected-error@*:* {{no matching function for call to 'atomic_fetch_sub_explicit'}}
+ std::atomic_fetch_sub_explicit(&fun, 0, std::memory_order_relaxed);
+ }
+}
diff --git a/libcxx/test/libcxx-03/atomics/diagnose_invalid_memory_order.verify.cpp b/libcxx/test/libcxx-03/atomics/diagnose_invalid_memory_order.verify.cpp
new file mode 100644
index 0000000000000..1b0b945f33700
--- /dev/null
+++ b/libcxx/test/libcxx-03/atomics/diagnose_invalid_memory_order.verify.cpp
@@ -0,0 +1,122 @@
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// REQUIRES: diagnose-if-support
+
+// <atomic>
+
+// Test that invalid memory order arguments are diagnosed where possible.
+
+#include <atomic>
+
+void f() {
+ std::atomic<int> x(42);
+ volatile std::atomic<int>& vx = x;
+ int val1 = 1; ((void)val1);
+ int val2 = 2; ((void)val2);
+ // load operations
+ {
+ x.load(std::memory_order_release); // expected-warning {{memory order argument to atomic operation is invalid}}
+ x.load(std::memory_order_acq_rel); // expected-warning {{memory order argument to atomic operation is invalid}}
+ vx.load(std::memory_order_release); // expected-warning {{memory order argument to atomic operation is invalid}}
+ vx.load(std::memory_order_acq_rel); // expected-warning {{memory order argument to atomic operation is invalid}}
+ // valid memory orders
+ x.load(std::memory_order_relaxed);
+ x.load(std::memory_order_consume);
+ x.load(std::memory_order_acquire);
+ x.load(std::memory_order_seq_cst);
+ }
+ {
+ std::atomic_load_explicit(&x, std::memory_order_release); // expected-warning {{memory order argument to atomic operation is invalid}}
+ std::atomic_load_explicit(&x, std::memory_order_acq_rel); // expected-warning {{memory order argument to atomic operation is invalid}}
+ std::atomic_load_explicit(&vx, std::memory_order_release); // expected-warning {{memory order argument to atomic operation is invalid}}
+ std::atomic_load_explicit(&vx, std::memory_order_acq_rel); // expected-warning {{memory order argument to atomic operation is invalid}}
+ // valid memory orders
+ std::atomic_load_explicit(&x, std::memory_order_relaxed);
+ std::atomic_load_explicit(&x, std::memory_order_consume);
+ std::atomic_load_explicit(&x, std::memory_order_acquire);
+ std::atomic_load_explicit(&x, std::memory_order_seq_cst);
+ }
+ // store operations
+ {
+ x.store(42, std::memory_order_consume); // expected-warning {{memory order argument to atomic operation is invalid}}
+ x.store(42, std::memory_order_acquire); // expected-warning {{memory order argument to atomic operation is invalid}}
+ x.store(42, std::memory_order_acq_rel); // expected-warning {{memory order argument to atomic operation is invalid}}
+ vx.store(42, std::memory_order_consume); // expected-warning {{memory order argument to atomic operation is invalid}}
+ vx.store(42, std::memory_order_acquire); // expected-warning {{memory order argument to atomic operation is invalid}}
+ vx.store(42, std::memory_order_acq_rel); // expected-warning {{memory order argument to atomic operation is invalid}}
+ // valid memory orders
+ x.store(42, std::memory_order_relaxed);
+ x.store(42, std::memory_order_release);
+ x.store(42, std::memory_order_seq_cst);
+ }
+ {
+ std::atomic_store_explicit(&x, 42, std::memory_order_consume); // expected-warning {{memory order argument to atomic operation is invalid}}
+ std::atomic_store_explicit(&x, 42, std::memory_order_acquire); // expected-warning {{memory order argument to atomic operation is invalid}}
+ std::atomic_store_explicit(&x, 42, std::memory_order_acq_rel); // expected-warning {{memory order argument to atomic operation is invalid}}
+ std::atomic_store_explicit(&vx, 42, std::memory_order_consume); // expected-warning {{memory order argument to atomic operation is invalid}}
+ std::atomic_store_explicit(&vx, 42, std::memory_order_acquire); // expected-warning {{memory order argument to atomic operation is invalid}}
+ std::atomic_store_explicit(&vx, 42, std::memory_order_acq_rel); // expected-warning {{memory order argument to atomic operation is invalid}}
+ // valid memory orders
+ std::atomic_store_explicit(&x, 42, std::memory_order_relaxed);
+ std::atomic_store_explicit(&x, 42, std::memory_order_release);
+ std::atomic_store_explicit(&x, 42, std::memory_order_seq_cst);
+ }
+ // compare exchange weak
+ {
+ x.compare_exchange_weak(val1, val2, std::memory_order_seq_cst, std::memory_order_release); // expected-warning {{memory order argument to atomic operation is invalid}}
+ x.compare_exchange_weak(val1, val2, std::memory_order_seq_cst, std::memory_order_acq_rel); // expected-warning {{memory order argument to atomic operation is invalid}}
+ vx.compare_exchange_weak(val1, val2, std::memory_order_seq_cst, std::memory_order_release); // expected-warning {{memory order argument to atomic operation is invalid}}
+ vx.compare_exchange_weak(val1, val2, std::memory_order_seq_cst, std::memory_order_acq_rel); // expected-warning {{memory order argument to atomic operation is invalid}}
+ // valid memory orders
+ x.compare_exchange_weak(val1, val2, std::memory_order_seq_cst, std::memory_order_relaxed);
+ x.compare_exchange_weak(val1, val2, std::memory_order_seq_cst, std::memory_order_consume);
+ x.compare_exchange_weak(val1, val2, std::memory_order_seq_cst, std::memory_order_acquire);
+ x.compare_exchange_weak(val1, val2, std::memory_order_seq_cst, std::memory_order_seq_cst);
+ // Test that the cmpxchg overload with only one memory order argument
+ // does not generate any diagnostics.
+ x.compare_exchange_weak(val1, val2, std::memory_order_release);
+ }
+ {
+ std::atomic_compare_exchange_weak_explicit(&x, &val1, val2, std::memory_order_seq_cst, std::memory_order_release); // expected-warning {{memory order argument to atomic operation is invalid}}
+ std::atomic_compare_exchange_weak_explicit(&x, &val1, val2, std::memory_order_seq_cst, std::memory_order_acq_rel); // expected-warning {{memory order argument to atomic operation is invalid}}
+ std::atomic_compare_exchange_weak_explicit(&vx, &val1, val2, std::memory_order_seq_cst, std::memory_order_release); // expected-warning {{memory order argument to atomic operation is invalid}}
+ std::atomic_compare_exchange_weak_explicit(&vx, &val1, val2, std::memory_order_seq_cst, std::memory_order_acq_rel); // expected-warning {{memory order argument to atomic operation is invalid}}
+ // valid memory orders
+ std::atomic_compare_exchange_weak_explicit(&x, &val1, val2, std::memory_order_seq_cst, std::memory_order_relaxed);
+ std::atomic_compare_exchange_weak_explicit(&x, &val1, val2, std::memory_order_seq_cst, std::memory_order_consume);
+ std::atomic_compare_exchange_weak_explicit(&x, &val1, val2, std::memory_order_seq_cst, std::memory_order_acquire);
+ std::atomic_compare_exchange_weak_explicit(&x, &val1, val2, std::memory_order_seq_cst, std::memory_order_seq_cst);
+ }
+ // compare exchange strong
+ {
+ x.compare_exchange_strong(val1, val2, std::memory_order_seq_cst, std::memory_order_release); // expected-warning {{memory order argument to atomic operation is invalid}}
+ x.compare_exchange_strong(val1, val2, std::memory_order_seq_cst, std::memory_order_acq_rel); // expected-warning {{memory order argument to atomic operation is invalid}}
+ vx.compare_exchange_strong(val1, val2, std::memory_order_seq_cst, std::memory_order_release); // expected-warning {{memory order argument to atomic operation is invalid}}
+ vx.compare_exchange_strong(val1, val2, std::memory_order_seq_cst, std::memory_order_acq_rel); // expected-warning {{memory order argument to atomic operation is invalid}}
+ // valid memory orders
+ x.compare_exchange_strong(val1, val2, std::memory_order_seq_cst, std::memory_order_relaxed);
+ x.compare_exchange_strong(val1, val2, std::memory_order_seq_cst, std::memory_order_consume);
+ x.compare_exchange_strong(val1, val2, std::memory_order_seq_cst, std::memory_order_acquire);
+ x.compare_exchange_strong(val1, val2, std::memory_order_seq_cst, std::memory_order_seq_cst);
+ // Test that the cmpxchg overload with only one memory order argument
+ // does not generate any diagnostics.
+ x.compare_exchange_strong(val1, val2, std::memory_order_release);
+ }
+ {
+ std::atomic_compare_exchange_strong_explicit(&x, &val1, val2, std::memory_order_seq_cst, std::memory_order_release); // expected-warning {{memory order argument to atomic operation is invalid}}
+ std::atomic_compare_exchange_strong_explicit(&x, &val1, val2, std::memory_order_seq_cst, std::memory_order_acq_rel); // expected-warning {{memory order argument to atomic operation is invalid}}
+ std::atomic_compare_exchange_strong_explicit(&vx, &val1, val2, std::memory_order_seq_cst, std::memory_order_release); // expected-warning {{memory order argument to atomic operation is invalid}}
+ std::atomic_compare_exchange_strong_explicit(&vx, &val1, val2, std::memory_order_seq_cst, std::memory_order_acq_rel); // expected-warning {{memory order argument to atomic operation is invalid}}
+ // valid memory orders
+ std::atomic_compare_exchange_strong_explicit(&x, &val1, val2, std::memory_order_seq_cst, std::memory_order_relaxed);
+ std::atomic_compare_exchange_strong_explicit(&x, &val1, val2, std::memory_order_seq_cst, std::memory_order_consume);
+ std::atomic_compare_exchange_strong_explicit(&x, &val1, val2, std::memory_order_seq_cst, std::memory_order_acquire);
+ std::atomic_compare_exchange_strong_explicit(&x, &val1, val2, std::memory_order_seq_cst, std::memory_order_seq_cst);
+ }
+}
diff --git a/libcxx/test/libcxx-03/atomics/stdatomic.h.syn/dont_hijack_header.compile.pass.cpp b/libcxx/test/libcxx-03/atomics/stdatomic.h.syn/dont_hijack_header.compile.pass.cpp
new file mode 100644
index 0000000000000..6df80daf9414e
--- /dev/null
+++ b/libcxx/test/libcxx-03/atomics/stdatomic.h.syn/dont_hijack_header.compile.pass.cpp
@@ -0,0 +1,24 @@
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: no-threads
+
+// This test ensures that we don't hijack the <stdatomic.h> header (e.g. by providing
+// an empty header) even when compiling before C++23, since some users were using the
+// Clang or platform provided header before libc++ added its own.
+
+// On GCC, the compiler-provided <stdatomic.h> is not C++ friendly, so including <stdatomic.h>
+// doesn't work at all if we don't use the <stdatomic.h> provided by libc++ in C++23 and above.
+// XFAIL: (c++11 || c++14 || c++17 || c++20) && gcc
+
+#include <stdatomic.h>
+
+void f() {
+ atomic_int i; // just make sure the header isn't empty
+ (void)i;
+}
diff --git a/libcxx/test/libcxx-03/atomics/stdatomic.h.syn/dont_hijack_header.cxx23.compile.pass.cpp b/libcxx/test/libcxx-03/atomics/stdatomic.h.syn/dont_hijack_header.cxx23.compile.pass.cpp
new file mode 100644
index 0000000000000..a8a99e6937f31
--- /dev/null
+++ b/libcxx/test/libcxx-03/atomics/stdatomic.h.syn/dont_hijack_header.cxx23.compile.pass.cpp
@@ -0,0 +1,28 @@
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: no-threads
+
+// This test verifies that <stdatomic.h> DOES NOT redirect to <atomic> before C++23,
+// since doing so is a breaking change. Several things can break when that happens,
+// because the type of _Atomic(T) changes from _Atomic(T) to std::atomic<T>.
+//
+// For example, redeclarations can become invalid depending on whether they
+// have been declared with <stdatomic.h> in scope or not.
+
+// REQUIRES: c++03 || c++11 || c++14 || c++17 || c++20
+
+// On GCC, the compiler-provided <stdatomic.h> is not C++ friendly, so including <stdatomic.h>
+// doesn't work at all if we don't use the <stdatomic.h> provided by libc++ in C++23 and above.
+// XFAIL: (c++11 || c++14 || c++17 || c++20) && gcc
+
+#include <atomic>
+#include <stdatomic.h>
+#include <type_traits>
+
+static_assert(!std::is_same<_Atomic(int), std::atomic<int> >::value, "");
diff --git a/libcxx/test/libcxx-03/clang_tidy.gen.py b/libcxx/test/libcxx-03/clang_tidy.gen.py
new file mode 100644
index 0000000000000..dbab2875e3126
--- /dev/null
+++ b/libcxx/test/libcxx-03/clang_tidy.gen.py
@@ -0,0 +1,40 @@
+# ===----------------------------------------------------------------------===##
+#
+# Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+# See https://llvm.org/LICENSE.txt for license information.
+# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+#
+# ===----------------------------------------------------------------------===##
+
+
+# Run our custom libc++ clang-tidy checks on all public headers.
+
+# RUN: %{python} %s %{libcxx-dir}/utils
+
+# block Lit from interpreting a RUN/XFAIL/etc inside the generation script
+# END.
+
+import sys
+sys.path.append(sys.argv[1])
+from libcxx.header_information import lit_header_restrictions, lit_header_undeprecations, public_headers
+
+for header in public_headers:
+ print(f"""\
+//--- {header}.sh.cpp
+
+// REQUIRES: has-clang-tidy
+
+// The frozen headers should not be updated to the latest libc++ style, so don't test.
+// UNSUPPORTED: FROZEN-CXX03-HEADERS-FIXME
+
+// The GCC compiler flags are not always compatible with clang-tidy.
+// UNSUPPORTED: gcc
+
+{lit_header_restrictions.get(header, '')}
+{lit_header_undeprecations.get(header, '')}
+
+// TODO: run clang-tidy with modules enabled once they are supported
+// RUN: %{{clang-tidy}} %s --warnings-as-errors=* -header-filter=.* --config-file=%{{libcxx-dir}}/.clang-tidy --load=%{{test-tools-dir}}/clang_tidy_checks/libcxx-tidy.plugin -- -Wweak-vtables %{{compile_flags}} -fno-modules
+
+#include <{header}>
+""")
diff --git a/libcxx/test/libcxx-03/clang_tidy.sh.py b/libcxx/test/libcxx-03/clang_tidy.sh.py
new file mode 100644
index 0000000000000..46f281f359209
--- /dev/null
+++ b/libcxx/test/libcxx-03/clang_tidy.sh.py
@@ -0,0 +1,11 @@
+# ===----------------------------------------------------------------------===##
+#
+# Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+# See https://llvm.org/LICENSE.txt for license information.
+# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+#
+# ===----------------------------------------------------------------------===##
+
+# REQUIRES: has-clang-tidy
+
+# RUN: %{python} %{libcxx-dir}/../clang-tools-extra/clang-tidy/tool/run-clang-tidy.py -clang-tidy-binary %{clang-tidy} -warnings-as-errors "*" -source-filter=".*libcxx/src.*" -quiet -p %{bin-dir}/..
diff --git a/libcxx/test/libcxx-03/containers/associative/map/at.abort.pass.cpp b/libcxx/test/libcxx-03/containers/associative/map/at.abort.pass.cpp
new file mode 100644
index 0000000000000..d68ee5f528599
--- /dev/null
+++ b/libcxx/test/libcxx-03/containers/associative/map/at.abort.pass.cpp
@@ -0,0 +1,33 @@
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// <map>
+
+// class map
+
+// mapped_type& at(const key_type& k);
+
+// Make sure we abort() when exceptions are disabled and we fetch a key that
+// is not in the map.
+
+// REQUIRES: no-exceptions
+
+#include <csignal>
+#include <cstdlib>
+#include <map>
+
+#include "test_macros.h"
+
+void exit_success(int) { std::_Exit(EXIT_SUCCESS); }
+
+int main(int, char**) {
+ std::signal(SIGABRT, exit_success);
+ std::map<int, int> map;
+ map.at(1);
+ return EXIT_FAILURE;
+}
diff --git a/libcxx/test/libcxx-03/containers/associative/map/at.const.abort.pass.cpp b/libcxx/test/libcxx-03/containers/associative/map/at.const.abort.pass.cpp
new file mode 100644
index 0000000000000..bbc8c7c4d726a
--- /dev/null
+++ b/libcxx/test/libcxx-03/containers/associative/map/at.const.abort.pass.cpp
@@ -0,0 +1,33 @@
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// <map>
+
+// class map
+
+// const mapped_type& at(const key_type& k) const;
+
+// Make sure we abort() when exceptions are disabled and we fetch a key that
+// is not in the map.
+
+// REQUIRES: no-exceptions
+
+#include <csignal>
+#include <cstdlib>
+#include <map>
+
+#include "test_macros.h"
+
+void exit_success(int) { std::_Exit(EXIT_SUCCESS); }
+
+int main(int, char**) {
+ std::signal(SIGABRT, exit_success);
+ std::map<int, int> const map;
+ map.at(1);
+ return EXIT_FAILURE;
+}
diff --git a/libcxx/test/libcxx-03/containers/associative/map/find.modules.compile.pass.mm b/libcxx/test/libcxx-03/containers/associative/map/find.modules.compile.pass.mm
new file mode 100644
index 0000000000000..82b1c494c9566
--- /dev/null
+++ b/libcxx/test/libcxx-03/containers/associative/map/find.modules.compile.pass.mm
@@ -0,0 +1,16 @@
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// Make sure that we don't get a compiler error when trying to use std::map::find
+// from Objective-C++. This happened in Objective-C++ mode with modules enabled (rdar://106813461).
+
+// REQUIRES: objective-c++
+
+#include <map>
+
+void f(std::map<int, int> const& map, int key) { (void)map.find(key); }
diff --git a/libcxx/test/libcxx-03/containers/associative/map/scary.compile.pass.cpp b/libcxx/test/libcxx-03/containers/associative/map/scary.compile.pass.cpp
new file mode 100644
index 0000000000000..89e753f854926
--- /dev/null
+++ b/libcxx/test/libcxx-03/containers/associative/map/scary.compile.pass.cpp
@@ -0,0 +1,26 @@
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// <map>
+
+// class map
+// class multimap
+
+// Extension: SCARY/N2913 iterator compatibility between map and multimap
+
+#include <map>
+
+#include "test_macros.h"
+
+void test() {
+ typedef std::map<int, int> M1;
+ typedef std::multimap<int, int> M2;
+
+ ASSERT_SAME_TYPE(M1::iterator, M2::iterator);
+ ASSERT_SAME_TYPE(M1::const_iterator, M2::const_iterator);
+}
diff --git a/libcxx/test/libcxx-03/containers/associative/reference_comparator_abi.compile.pass.cpp b/libcxx/test/libcxx-03/containers/associative/reference_comparator_abi.compile.pass.cpp
new file mode 100644
index 0000000000000..f364fc817c164
--- /dev/null
+++ b/libcxx/test/libcxx-03/containers/associative/reference_comparator_abi.compile.pass.cpp
@@ -0,0 +1,57 @@
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// Pin down the ABI of associative containers with respect to their size and alignment
+// when passed a comparator that is a reference.
+//
+// While it's not even clear that reference comparators are legal in containers, an
+// unintended ABI break was discovered after implementing the new compressed pair
+// mechanism based on [[no_unique_address]], and this is a regression test for that.
+// If we decide to make reference comparators ill-formed, this test would become
+// unnecessary.
+//
+// See https://github.com/llvm/llvm-project/issues/118559 for more details.
+
+#include <set>
+#include <map>
+
+#include "test_macros.h"
+
+struct TEST_ALIGNAS(16) Cmp {
+ bool operator()(int, int) const;
+};
+
+template <class Compare>
+struct Set {
+ char b;
+ std::set<int, Compare> s;
+};
+
+template <class Compare>
+struct Multiset {
+ char b;
+ std::multiset<int, Compare> s;
+};
+
+template <class Compare>
+struct Map {
+ char b;
+ std::map<int, char, Compare> s;
+};
+
+template <class Compare>
+struct Multimap {
+ char b;
+ std::multimap<int, char, Compare> s;
+};
+
+static_assert(sizeof(Set<Cmp&>) == sizeof(Set<bool (*)(int, int)>), "");
+static_assert(sizeof(Multiset<Cmp&>) == sizeof(Multiset<bool (*)(int, int)>), "");
+
+static_assert(sizeof(Map<Cmp&>) == sizeof(Map<bool (*)(int, int)>), "");
+static_assert(sizeof(Multimap<Cmp&>) == sizeof(Multimap<bool (*)(int, int)>), "");
diff --git a/libcxx/test/libcxx-03/containers/associative/set/scary.compile.pass.cpp b/libcxx/test/libcxx-03/containers/associative/set/scary.compile.pass.cpp
new file mode 100644
index 0000000000000..87ed05d84cdd7
--- /dev/null
+++ b/libcxx/test/libcxx-03/containers/associative/set/scary.compile.pass.cpp
@@ -0,0 +1,26 @@
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// <set>
+
+// class set
+// class multiset
+
+// Extension: SCARY/N2913 iterator compatibility between set and multiset
+
+#include <set>
+
+#include "test_macros.h"
+
+void test() {
+ typedef std::set<int> M1;
+ typedef std::multiset<int> M2;
+
+ ASSERT_SAME_TYPE(M1::iterator, M2::iterator);
+ ASSERT_SAME_TYPE(M1::const_iterator, M2::const_iterator);
+}
diff --git a/libcxx/test/libcxx-03/containers/associative/tree_balance_after_insert.pass.cpp b/libcxx/test/libcxx-03/containers/associative/tree_balance_after_insert.pass.cpp
new file mode 100644
index 0000000000000..ccd84af44c3a5
--- /dev/null
+++ b/libcxx/test/libcxx-03/containers/associative/tree_balance_after_insert.pass.cpp
@@ -0,0 +1,1612 @@
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// Not a portable test
+
+// Precondition: __root->__is_black_ == true
+// template <class _NodePtr>
+// void
+// __tree_balance_after_insert(_NodePtr __root, _NodePtr __x)
+
+// XFAIL: FROZEN-CXX03-HEADERS-FIXME
+
+#include <__tree>
+#include <cassert>
+
+#include "test_macros.h"
+
+struct Node {
+ Node* __left_;
+ Node* __right_;
+ Node* __parent_;
+ bool __is_black_;
+
+ Node* __parent_unsafe() const { return __parent_; }
+ void __set_parent(Node* x) { __parent_ = x; }
+
+ Node() : __left_(), __right_(), __parent_(), __is_black_() {}
+};
+
+void test1() {
+ {
+ Node root;
+ Node a;
+ Node b;
+ Node c;
+ Node d;
+
+ root.__left_ = &c;
+
+ c.__parent_ = &root;
+ c.__left_ = &b;
+ c.__right_ = &d;
+ c.__is_black_ = true;
+
+ b.__parent_ = &c;
+ b.__left_ = &a;
+ b.__right_ = 0;
+ b.__is_black_ = false;
+
+ d.__parent_ = &c;
+ d.__left_ = 0;
+ d.__right_ = 0;
+ d.__is_black_ = false;
+
+ a.__parent_ = &b;
+ a.__left_ = 0;
+ a.__right_ = 0;
+ a.__is_black_ = false;
+
+ std::__tree_balance_after_insert(root.__left_, &a);
+
+ assert(std::__tree_invariant(root.__left_));
+
+ assert(root.__left_ == &c);
+
+ assert(c.__parent_ == &root);
+ assert(c.__left_ == &b);
+ assert(c.__right_ == &d);
+ assert(c.__is_black_ == true);
+
+ assert(b.__parent_ == &c);
+ assert(b.__left_ == &a);
+ assert(b.__right_ == 0);
+ assert(b.__is_black_ == true);
+
+ assert(d.__parent_ == &c);
+ assert(d.__left_ == 0);
+ assert(d.__right_ == 0);
+ assert(d.__is_black_ == true);
+
+ assert(a.__parent_ == &b);
+ assert(a.__left_ == 0);
+ assert(a.__right_ == 0);
+ assert(a.__is_black_ == false);
+ }
+ {
+ Node root;
+ Node a;
+ Node b;
+ Node c;
+ Node d;
+
+ root.__left_ = &c;
+
+ c.__parent_ = &root;
+ c.__left_ = &b;
+ c.__right_ = &d;
+ c.__is_black_ = true;
+
+ b.__parent_ = &c;
+ b.__left_ = 0;
+ b.__right_ = &a;
+ b.__is_black_ = false;
+
+ d.__parent_ = &c;
+ d.__left_ = 0;
+ d.__right_ = 0;
+ d.__is_black_ = false;
+
+ a.__parent_ = &b;
+ a.__left_ = 0;
+ a.__right_ = 0;
+ a.__is_black_ = false;
+
+ std::__tree_balance_after_insert(root.__left_, &a);
+
+ assert(std::__tree_invariant(root.__left_));
+
+ assert(root.__left_ == &c);
+
+ assert(c.__parent_ == &root);
+ assert(c.__left_ == &b);
+ assert(c.__right_ == &d);
+ assert(c.__is_black_ == true);
+
+ assert(b.__parent_ == &c);
+ assert(b.__left_ == 0);
+ assert(b.__right_ == &a);
+ assert(b.__is_black_ == true);
+
+ assert(d.__parent_ == &c);
+ assert(d.__left_ == 0);
+ assert(d.__right_ == 0);
+ assert(d.__is_black_ == true);
+
+ assert(a.__parent_ == &b);
+ assert(a.__left_ == 0);
+ assert(a.__right_ == 0);
+ assert(a.__is_black_ == false);
+ }
+ {
+ Node root;
+ Node a;
+ Node b;
+ Node c;
+ Node d;
+
+ root.__left_ = &c;
+
+ c.__parent_ = &root;
+ c.__left_ = &b;
+ c.__right_ = &d;
+ c.__is_black_ = true;
+
+ b.__parent_ = &c;
+ b.__left_ = 0;
+ b.__right_ = 0;
+ b.__is_black_ = false;
+
+ d.__parent_ = &c;
+ d.__left_ = &a;
+ d.__right_ = 0;
+ d.__is_black_ = false;
+
+ a.__parent_ = &d;
+ a.__left_ = 0;
+ a.__right_ = 0;
+ a.__is_black_ = false;
+
+ std::__tree_balance_after_insert(root.__left_, &a);
+
+ assert(std::__tree_invariant(root.__left_));
+
+ assert(root.__left_ == &c);
+
+ assert(c.__parent_ == &root);
+ assert(c.__left_ == &b);
+ assert(c.__right_ == &d);
+ assert(c.__is_black_ == true);
+
+ assert(b.__parent_ == &c);
+ assert(b.__left_ == 0);
+ assert(b.__right_ == 0);
+ assert(b.__is_black_ == true);
+
+ assert(d.__parent_ == &c);
+ assert(d.__left_ == &a);
+ assert(d.__right_ == 0);
+ assert(d.__is_black_ == true);
+
+ assert(a.__parent_ == &d);
+ assert(a.__left_ == 0);
+ assert(a.__right_ == 0);
+ assert(a.__is_black_ == false);
+ }
+ {
+ Node root;
+ Node a;
+ Node b;
+ Node c;
+ Node d;
+
+ root.__left_ = &c;
+
+ c.__parent_ = &root;
+ c.__left_ = &b;
+ c.__right_ = &d;
+ c.__is_black_ = true;
+
+ b.__parent_ = &c;
+ b.__left_ = 0;
+ b.__right_ = 0;
+ b.__is_black_ = false;
+
+ d.__parent_ = &c;
+ d.__left_ = 0;
+ d.__right_ = &a;
+ d.__is_black_ = false;
+
+ a.__parent_ = &d;
+ a.__left_ = 0;
+ a.__right_ = 0;
+ a.__is_black_ = false;
+
+ std::__tree_balance_after_insert(root.__left_, &a);
+
+ assert(std::__tree_invariant(root.__left_));
+
+ assert(root.__left_ == &c);
+
+ assert(c.__parent_ == &root);
+ assert(c.__left_ == &b);
+ assert(c.__right_ == &d);
+ assert(c.__is_black_ == true);
+
+ assert(b.__parent_ == &c);
+ assert(b.__left_ == 0);
+ assert(b.__right_ == 0);
+ assert(b.__is_black_ == true);
+
+ assert(d.__parent_ == &c);
+ assert(d.__left_ == 0);
+ assert(d.__right_ == &a);
+ assert(d.__is_black_ == true);
+
+ assert(a.__parent_ == &d);
+ assert(a.__left_ == 0);
+ assert(a.__right_ == 0);
+ assert(a.__is_black_ == false);
+ }
+ {
+ Node root;
+ Node a;
+ Node b;
+ Node c;
+ Node d;
+ Node e;
+ Node f;
+ Node g;
+ Node h;
+ Node i;
+
+ root.__left_ = &c;
+
+ c.__parent_ = &root;
+ c.__left_ = &b;
+ c.__right_ = &d;
+ c.__is_black_ = true;
+
+ b.__parent_ = &c;
+ b.__left_ = &a;
+ b.__right_ = &g;
+ b.__is_black_ = false;
+
+ d.__parent_ = &c;
+ d.__left_ = &h;
+ d.__right_ = &i;
+ d.__is_black_ = false;
+
+ a.__parent_ = &b;
+ a.__left_ = &e;
+ a.__right_ = &f;
+ a.__is_black_ = false;
+
+ e.__parent_ = &a;
+ e.__is_black_ = true;
+
+ f.__parent_ = &a;
+ f.__is_black_ = true;
+
+ g.__parent_ = &b;
+ g.__is_black_ = true;
+
+ h.__parent_ = &d;
+ h.__is_black_ = true;
+
+ i.__parent_ = &d;
+ i.__is_black_ = true;
+
+ std::__tree_balance_after_insert(root.__left_, &a);
+
+ assert(std::__tree_invariant(root.__left_));
+
+ assert(root.__left_ == &c);
+
+ assert(c.__parent_ == &root);
+ assert(c.__left_ == &b);
+ assert(c.__right_ == &d);
+ assert(c.__is_black_ == true);
+
+ assert(b.__parent_ == &c);
+ assert(b.__left_ == &a);
+ assert(b.__right_ == &g);
+ assert(b.__is_black_ == true);
+
+ assert(d.__parent_ == &c);
+ assert(d.__left_ == &h);
+ assert(d.__right_ == &i);
+ assert(d.__is_black_ == true);
+
+ assert(a.__parent_ == &b);
+ assert(a.__left_ == &e);
+ assert(a.__right_ == &f);
+ assert(a.__is_black_ == false);
+ }
+ {
+ Node root;
+ Node a;
+ Node b;
+ Node c;
+ Node d;
+ Node e;
+ Node f;
+ Node g;
+ Node h;
+ Node i;
+
+ root.__left_ = &c;
+
+ c.__parent_ = &root;
+ c.__left_ = &b;
+ c.__right_ = &d;
+ c.__is_black_ = true;
+
+ b.__parent_ = &c;
+ b.__left_ = &g;
+ b.__right_ = &a;
+ b.__is_black_ = false;
+
+ d.__parent_ = &c;
+ d.__left_ = &h;
+ d.__right_ = &i;
+ d.__is_black_ = false;
+
+ a.__parent_ = &b;
+ a.__left_ = &e;
+ a.__right_ = &f;
+ a.__is_black_ = false;
+
+ e.__parent_ = &a;
+ e.__is_black_ = true;
+
+ f.__parent_ = &a;
+ f.__is_black_ = true;
+
+ g.__parent_ = &b;
+ g.__is_black_ = true;
+
+ h.__parent_ = &d;
+ h.__is_black_ = true;
+
+ i.__parent_ = &d;
+ i.__is_black_ = true;
+
+ std::__tree_balance_after_insert(root.__left_, &a);
+
+ assert(std::__tree_invariant(root.__left_));
+
+ assert(root.__left_ == &c);
+
+ assert(c.__parent_ == &root);
+ assert(c.__left_ == &b);
+ assert(c.__right_ == &d);
+ assert(c.__is_black_ == true);
+
+ assert(b.__parent_ == &c);
+ assert(b.__left_ == &g);
+ assert(b.__right_ == &a);
+ assert(b.__is_black_ == true);
+
+ assert(d.__parent_ == &c);
+ assert(d.__left_ == &h);
+ assert(d.__right_ == &i);
+ assert(d.__is_black_ == true);
+
+ assert(a.__parent_ == &b);
+ assert(a.__left_ == &e);
+ assert(a.__right_ == &f);
+ assert(a.__is_black_ == false);
+ }
+ {
+ Node root;
+ Node a;
+ Node b;
+ Node c;
+ Node d;
+ Node e;
+ Node f;
+ Node g;
+ Node h;
+ Node i;
+
+ root.__left_ = &c;
+
+ c.__parent_ = &root;
+ c.__left_ = &b;
+ c.__right_ = &d;
+ c.__is_black_ = true;
+
+ b.__parent_ = &c;
+ b.__left_ = &g;
+ b.__right_ = &h;
+ b.__is_black_ = false;
+
+ d.__parent_ = &c;
+ d.__left_ = &a;
+ d.__right_ = &i;
+ d.__is_black_ = false;
+
+ a.__parent_ = &d;
+ a.__left_ = &e;
+ a.__right_ = &f;
+ a.__is_black_ = false;
+
+ e.__parent_ = &a;
+ e.__is_black_ = true;
+
+ f.__parent_ = &a;
+ f.__is_black_ = true;
+
+ g.__parent_ = &b;
+ g.__is_black_ = true;
+
+ h.__parent_ = &b;
+ h.__is_black_ = true;
+
+ i.__parent_ = &d;
+ i.__is_black_ = true;
+
+ std::__tree_balance_after_insert(root.__left_, &a);
+
+ assert(std::__tree_invariant(root.__left_));
+
+ assert(root.__left_ == &c);
+
+ assert(c.__parent_ == &root);
+ assert(c.__left_ == &b);
+ assert(c.__right_ == &d);
+ assert(c.__is_black_ == true);
+
+ assert(b.__parent_ == &c);
+ assert(b.__left_ == &g);
+ assert(b.__right_ == &h);
+ assert(b.__is_black_ == true);
+
+ assert(d.__parent_ == &c);
+ assert(d.__left_ == &a);
+ assert(d.__right_ == &i);
+ assert(d.__is_black_ == true);
+
+ assert(a.__parent_ == &d);
+ assert(a.__left_ == &e);
+ assert(a.__right_ == &f);
+ assert(a.__is_black_ == false);
+ }
+ {
+ Node root;
+ Node a;
+ Node b;
+ Node c;
+ Node d;
+ Node e;
+ Node f;
+ Node g;
+ Node h;
+ Node i;
+
+ root.__left_ = &c;
+
+ c.__parent_ = &root;
+ c.__left_ = &b;
+ c.__right_ = &d;
+ c.__is_black_ = true;
+
+ b.__parent_ = &c;
+ b.__left_ = &g;
+ b.__right_ = &h;
+ b.__is_black_ = false;
+
+ d.__parent_ = &c;
+ d.__left_ = &i;
+ d.__right_ = &a;
+ d.__is_black_ = false;
+
+ a.__parent_ = &d;
+ a.__left_ = &e;
+ a.__right_ = &f;
+ a.__is_black_ = false;
+
+ e.__parent_ = &a;
+ e.__is_black_ = true;
+
+ f.__parent_ = &a;
+ f.__is_black_ = true;
+
+ g.__parent_ = &b;
+ g.__is_black_ = true;
+
+ h.__parent_ = &b;
+ h.__is_black_ = true;
+
+ i.__parent_ = &d;
+ i.__is_black_ = true;
+
+ std::__tree_balance_after_insert(root.__left_, &a);
+
+ assert(std::__tree_invariant(root.__left_));
+
+ assert(root.__left_ == &c);
+
+ assert(c.__parent_ == &root);
+ assert(c.__left_ == &b);
+ assert(c.__right_ == &d);
+ assert(c.__is_black_ == true);
+
+ assert(b.__parent_ == &c);
+ assert(b.__left_ == &g);
+ assert(b.__right_ == &h);
+ assert(b.__is_black_ == true);
+
+ assert(d.__parent_ == &c);
+ assert(d.__left_ == &i);
+ assert(d.__right_ == &a);
+ assert(d.__is_black_ == true);
+
+ assert(a.__parent_ == &d);
+ assert(a.__left_ == &e);
+ assert(a.__right_ == &f);
+ assert(a.__is_black_ == false);
+ }
+}
+
+void test2() {
+ {
+ Node root;
+ Node a;
+ Node b;
+ Node c;
+
+ root.__left_ = &c;
+
+ c.__parent_ = &root;
+ c.__left_ = &a;
+ c.__right_ = 0;
+ c.__is_black_ = true;
+
+ a.__parent_ = &c;
+ a.__left_ = 0;
+ a.__right_ = &b;
+ a.__is_black_ = false;
+
+ b.__parent_ = &a;
+ b.__left_ = 0;
+ b.__right_ = 0;
+ b.__is_black_ = false;
+
+ std::__tree_balance_after_insert(root.__left_, &b);
+
+ assert(std::__tree_invariant(root.__left_));
+
+ assert(root.__left_ == &b);
+
+ assert(c.__parent_ == &b);
+ assert(c.__left_ == 0);
+ assert(c.__right_ == 0);
+ assert(c.__is_black_ == false);
+
+ assert(a.__parent_ == &b);
+ assert(a.__left_ == 0);
+ assert(a.__right_ == 0);
+ assert(a.__is_black_ == false);
+
+ assert(b.__parent_ == &root);
+ assert(b.__left_ == &a);
+ assert(b.__right_ == &c);
+ assert(b.__is_black_ == true);
+ }
+ {
+ Node root;
+ Node a;
+ Node b;
+ Node c;
+
+ root.__left_ = &a;
+
+ a.__parent_ = &root;
+ a.__left_ = 0;
+ a.__right_ = &c;
+ a.__is_black_ = true;
+
+ c.__parent_ = &a;
+ c.__left_ = &b;
+ c.__right_ = 0;
+ c.__is_black_ = false;
+
+ b.__parent_ = &c;
+ b.__left_ = 0;
+ b.__right_ = 0;
+ b.__is_black_ = false;
+
+ std::__tree_balance_after_insert(root.__left_, &b);
+
+ assert(std::__tree_invariant(root.__left_));
+
+ assert(root.__left_ == &b);
+
+ assert(a.__parent_ == &b);
+ assert(a.__left_ == 0);
+ assert(a.__right_ == 0);
+ assert(a.__is_black_ == false);
+
+ assert(c.__parent_ == &b);
+ assert(c.__left_ == 0);
+ assert(c.__right_ == 0);
+ assert(c.__is_black_ == false);
+
+ assert(b.__parent_ == &root);
+ assert(b.__left_ == &a);
+ assert(b.__right_ == &c);
+ assert(b.__is_black_ == true);
+ }
+ {
+ Node root;
+ Node a;
+ Node b;
+ Node c;
+ Node d;
+ Node e;
+ Node f;
+ Node g;
+
+ root.__left_ = &c;
+
+ c.__parent_ = &root;
+ c.__left_ = &a;
+ c.__right_ = &g;
+ c.__is_black_ = true;
+
+ a.__parent_ = &c;
+ a.__left_ = &d;
+ a.__right_ = &b;
+ a.__is_black_ = false;
+
+ b.__parent_ = &a;
+ b.__left_ = &e;
+ b.__right_ = &f;
+ b.__is_black_ = false;
+
+ d.__parent_ = &a;
+ d.__is_black_ = true;
+
+ e.__parent_ = &b;
+ e.__is_black_ = true;
+
+ f.__parent_ = &b;
+ f.__is_black_ = true;
+
+ g.__parent_ = &c;
+ g.__is_black_ = true;
+
+ std::__tree_balance_after_insert(root.__left_, &b);
+
+ assert(std::__tree_invariant(root.__left_));
+
+ assert(root.__left_ == &b);
+
+ assert(c.__parent_ == &b);
+ assert(c.__left_ == &f);
+ assert(c.__right_ == &g);
+ assert(c.__is_black_ == false);
+
+ assert(a.__parent_ == &b);
+ assert(a.__left_ == &d);
+ assert(a.__right_ == &e);
+ assert(a.__is_black_ == false);
+
+ assert(b.__parent_ == &root);
+ assert(b.__left_ == &a);
+ assert(b.__right_ == &c);
+ assert(b.__is_black_ == true);
+
+ assert(d.__parent_ == &a);
+ assert(d.__is_black_ == true);
+
+ assert(e.__parent_ == &a);
+ assert(e.__is_black_ == true);
+
+ assert(f.__parent_ == &c);
+ assert(f.__is_black_ == true);
+
+ assert(g.__parent_ == &c);
+ assert(g.__is_black_ == true);
+ }
+ {
+ Node root;
+ Node a;
+ Node b;
+ Node c;
+ Node d;
+ Node e;
+ Node f;
+ Node g;
+
+ root.__left_ = &a;
+
+ a.__parent_ = &root;
+ a.__left_ = &d;
+ a.__right_ = &c;
+ a.__is_black_ = true;
+
+ c.__parent_ = &a;
+ c.__left_ = &b;
+ c.__right_ = &g;
+ c.__is_black_ = false;
+
+ b.__parent_ = &c;
+ b.__left_ = &e;
+ b.__right_ = &f;
+ b.__is_black_ = false;
+
+ d.__parent_ = &a;
+ d.__is_black_ = true;
+
+ e.__parent_ = &b;
+ e.__is_black_ = true;
+
+ f.__parent_ = &b;
+ f.__is_black_ = true;
+
+ g.__parent_ = &c;
+ g.__is_black_ = true;
+
+ std::__tree_balance_after_insert(root.__left_, &b);
+
+ assert(std::__tree_invariant(root.__left_));
+
+ assert(root.__left_ == &b);
+
+ assert(c.__parent_ == &b);
+ assert(c.__left_ == &f);
+ assert(c.__right_ == &g);
+ assert(c.__is_black_ == false);
+
+ assert(a.__parent_ == &b);
+ assert(a.__left_ == &d);
+ assert(a.__right_ == &e);
+ assert(a.__is_black_ == false);
+
+ assert(b.__parent_ == &root);
+ assert(b.__left_ == &a);
+ assert(b.__right_ == &c);
+ assert(b.__is_black_ == true);
+
+ assert(d.__parent_ == &a);
+ assert(d.__is_black_ == true);
+
+ assert(e.__parent_ == &a);
+ assert(e.__is_black_ == true);
+
+ assert(f.__parent_ == &c);
+ assert(f.__is_black_ == true);
+
+ assert(g.__parent_ == &c);
+ assert(g.__is_black_ == true);
+ }
+}
+
+void test3() {
+ {
+ Node root;
+ Node a;
+ Node b;
+ Node c;
+
+ root.__left_ = &c;
+
+ c.__parent_ = &root;
+ c.__left_ = &b;
+ c.__right_ = 0;
+ c.__is_black_ = true;
+
+ b.__parent_ = &c;
+ b.__left_ = &a;
+ b.__right_ = 0;
+ b.__is_black_ = false;
+
+ a.__parent_ = &b;
+ a.__left_ = 0;
+ a.__right_ = 0;
+ a.__is_black_ = false;
+
+ std::__tree_balance_after_insert(root.__left_, &a);
+
+ assert(std::__tree_invariant(root.__left_));
+
+ assert(root.__left_ == &b);
+
+ assert(c.__parent_ == &b);
+ assert(c.__left_ == 0);
+ assert(c.__right_ == 0);
+ assert(c.__is_black_ == false);
+
+ assert(a.__parent_ == &b);
+ assert(a.__left_ == 0);
+ assert(a.__right_ == 0);
+ assert(a.__is_black_ == false);
+
+ assert(b.__parent_ == &root);
+ assert(b.__left_ == &a);
+ assert(b.__right_ == &c);
+ assert(b.__is_black_ == true);
+ }
+ {
+ Node root;
+ Node a;
+ Node b;
+ Node c;
+
+ root.__left_ = &a;
+
+ a.__parent_ = &root;
+ a.__left_ = 0;
+ a.__right_ = &b;
+ a.__is_black_ = true;
+
+ b.__parent_ = &a;
+ b.__left_ = 0;
+ b.__right_ = &c;
+ b.__is_black_ = false;
+
+ c.__parent_ = &b;
+ c.__left_ = 0;
+ c.__right_ = 0;
+ c.__is_black_ = false;
+
+ std::__tree_balance_after_insert(root.__left_, &c);
+
+ assert(std::__tree_invariant(root.__left_));
+
+ assert(root.__left_ == &b);
+
+ assert(a.__parent_ == &b);
+ assert(a.__left_ == 0);
+ assert(a.__right_ == 0);
+ assert(a.__is_black_ == false);
+
+ assert(c.__parent_ == &b);
+ assert(c.__left_ == 0);
+ assert(c.__right_ == 0);
+ assert(c.__is_black_ == false);
+
+ assert(b.__parent_ == &root);
+ assert(b.__left_ == &a);
+ assert(b.__right_ == &c);
+ assert(b.__is_black_ == true);
+ }
+ {
+ Node root;
+ Node a;
+ Node b;
+ Node c;
+ Node d;
+ Node e;
+ Node f;
+ Node g;
+
+ root.__left_ = &c;
+
+ c.__parent_ = &root;
+ c.__left_ = &b;
+ c.__right_ = &g;
+ c.__is_black_ = true;
+
+ b.__parent_ = &c;
+ b.__left_ = &a;
+ b.__right_ = &f;
+ b.__is_black_ = false;
+
+ a.__parent_ = &b;
+ a.__left_ = &d;
+ a.__right_ = &e;
+ a.__is_black_ = false;
+
+ d.__parent_ = &a;
+ d.__is_black_ = true;
+
+ e.__parent_ = &a;
+ e.__is_black_ = true;
+
+ f.__parent_ = &b;
+ f.__is_black_ = true;
+
+ g.__parent_ = &c;
+ g.__is_black_ = true;
+
+ std::__tree_balance_after_insert(root.__left_, &a);
+
+ assert(std::__tree_invariant(root.__left_));
+
+ assert(root.__left_ == &b);
+
+ assert(c.__parent_ == &b);
+ assert(c.__left_ == &f);
+ assert(c.__right_ == &g);
+ assert(c.__is_black_ == false);
+
+ assert(a.__parent_ == &b);
+ assert(a.__left_ == &d);
+ assert(a.__right_ == &e);
+ assert(a.__is_black_ == false);
+
+ assert(b.__parent_ == &root);
+ assert(b.__left_ == &a);
+ assert(b.__right_ == &c);
+ assert(b.__is_black_ == true);
+
+ assert(d.__parent_ == &a);
+ assert(d.__is_black_ == true);
+
+ assert(e.__parent_ == &a);
+ assert(e.__is_black_ == true);
+
+ assert(f.__parent_ == &c);
+ assert(f.__is_black_ == true);
+
+ assert(g.__parent_ == &c);
+ assert(g.__is_black_ == true);
+ }
+ {
+ Node root;
+ Node a;
+ Node b;
+ Node c;
+ Node d;
+ Node e;
+ Node f;
+ Node g;
+
+ root.__left_ = &a;
+
+ a.__parent_ = &root;
+ a.__left_ = &d;
+ a.__right_ = &b;
+ a.__is_black_ = true;
+
+ b.__parent_ = &a;
+ b.__left_ = &e;
+ b.__right_ = &c;
+ b.__is_black_ = false;
+
+ c.__parent_ = &b;
+ c.__left_ = &f;
+ c.__right_ = &g;
+ c.__is_black_ = false;
+
+ d.__parent_ = &a;
+ d.__is_black_ = true;
+
+ e.__parent_ = &b;
+ e.__is_black_ = true;
+
+ f.__parent_ = &c;
+ f.__is_black_ = true;
+
+ g.__parent_ = &c;
+ g.__is_black_ = true;
+
+ std::__tree_balance_after_insert(root.__left_, &c);
+
+ assert(std::__tree_invariant(root.__left_));
+
+ assert(root.__left_ == &b);
+
+ assert(c.__parent_ == &b);
+ assert(c.__left_ == &f);
+ assert(c.__right_ == &g);
+ assert(c.__is_black_ == false);
+
+ assert(a.__parent_ == &b);
+ assert(a.__left_ == &d);
+ assert(a.__right_ == &e);
+ assert(a.__is_black_ == false);
+
+ assert(b.__parent_ == &root);
+ assert(b.__left_ == &a);
+ assert(b.__right_ == &c);
+ assert(b.__is_black_ == true);
+
+ assert(d.__parent_ == &a);
+ assert(d.__is_black_ == true);
+
+ assert(e.__parent_ == &a);
+ assert(e.__is_black_ == true);
+
+ assert(f.__parent_ == &c);
+ assert(f.__is_black_ == true);
+
+ assert(g.__parent_ == &c);
+ assert(g.__is_black_ == true);
+ }
+}
+
+void test4() {
+ Node root;
+ Node a;
+ Node b;
+ Node c;
+ Node d;
+ Node e;
+ Node f;
+ Node g;
+ Node h;
+
+ root.__left_ = &a;
+ a.__parent_ = &root;
+
+ std::__tree_balance_after_insert(root.__left_, &a);
+
+ assert(std::__tree_invariant(root.__left_));
+
+ assert(root.__parent_ == 0);
+ assert(root.__left_ == &a);
+ assert(root.__right_ == 0);
+ assert(root.__is_black_ == false);
+
+ assert(a.__parent_ == &root);
+ assert(a.__left_ == 0);
+ assert(a.__right_ == 0);
+ assert(a.__is_black_ == true);
+
+ a.__right_ = &b;
+ b.__parent_ = &a;
+
+ std::__tree_balance_after_insert(root.__left_, &b);
+
+ assert(std::__tree_invariant(root.__left_));
+
+ assert(root.__parent_ == 0);
+ assert(root.__left_ == &a);
+ assert(root.__right_ == 0);
+ assert(root.__is_black_ == false);
+
+ assert(a.__parent_ == &root);
+ assert(a.__left_ == 0);
+ assert(a.__right_ == &b);
+ assert(a.__is_black_ == true);
+
+ assert(b.__parent_ == &a);
+ assert(b.__left_ == 0);
+ assert(b.__right_ == 0);
+ assert(b.__is_black_ == false);
+
+ b.__right_ = &c;
+ c.__parent_ = &b;
+
+ std::__tree_balance_after_insert(root.__left_, &c);
+
+ assert(std::__tree_invariant(root.__left_));
+
+ assert(root.__parent_ == 0);
+ assert(root.__left_ == &b);
+ assert(root.__right_ == 0);
+ assert(root.__is_black_ == false);
+
+ assert(a.__parent_ == &b);
+ assert(a.__left_ == 0);
+ assert(a.__right_ == 0);
+ assert(a.__is_black_ == false);
+
+ assert(b.__parent_ == &root);
+ assert(b.__left_ == &a);
+ assert(b.__right_ == &c);
+ assert(b.__is_black_ == true);
+
+ assert(c.__parent_ == &b);
+ assert(c.__left_ == 0);
+ assert(c.__right_ == 0);
+ assert(c.__is_black_ == false);
+
+ c.__right_ = &d;
+ d.__parent_ = &c;
+
+ std::__tree_balance_after_insert(root.__left_, &d);
+
+ assert(std::__tree_invariant(root.__left_));
+
+ assert(root.__parent_ == 0);
+ assert(root.__left_ == &b);
+ assert(root.__right_ == 0);
+ assert(root.__is_black_ == false);
+
+ assert(a.__parent_ == &b);
+ assert(a.__left_ == 0);
+ assert(a.__right_ == 0);
+ assert(a.__is_black_ == true);
+
+ assert(b.__parent_ == &root);
+ assert(b.__left_ == &a);
+ assert(b.__right_ == &c);
+ assert(b.__is_black_ == true);
+
+ assert(c.__parent_ == &b);
+ assert(c.__left_ == 0);
+ assert(c.__right_ == &d);
+ assert(c.__is_black_ == true);
+
+ assert(d.__parent_ == &c);
+ assert(d.__left_ == 0);
+ assert(d.__right_ == 0);
+ assert(d.__is_black_ == false);
+
+ d.__right_ = &e;
+ e.__parent_ = &d;
+
+ std::__tree_balance_after_insert(root.__left_, &e);
+
+ assert(std::__tree_invariant(root.__left_));
+
+ assert(root.__parent_ == 0);
+ assert(root.__left_ == &b);
+ assert(root.__right_ == 0);
+ assert(root.__is_black_ == false);
+
+ assert(b.__parent_ == &root);
+ assert(b.__left_ == &a);
+ assert(b.__right_ == &d);
+ assert(b.__is_black_ == true);
+
+ assert(a.__parent_ == &b);
+ assert(a.__left_ == 0);
+ assert(a.__right_ == 0);
+ assert(a.__is_black_ == true);
+
+ assert(d.__parent_ == &b);
+ assert(d.__left_ == &c);
+ assert(d.__right_ == &e);
+ assert(d.__is_black_ == true);
+
+ assert(c.__parent_ == &d);
+ assert(c.__left_ == 0);
+ assert(c.__right_ == 0);
+ assert(c.__is_black_ == false);
+
+ assert(e.__parent_ == &d);
+ assert(e.__left_ == 0);
+ assert(e.__right_ == 0);
+ assert(e.__is_black_ == false);
+
+ e.__right_ = &f;
+ f.__parent_ = &e;
+
+ std::__tree_balance_after_insert(root.__left_, &f);
+
+ assert(std::__tree_invariant(root.__left_));
+
+ assert(root.__parent_ == 0);
+ assert(root.__left_ == &b);
+ assert(root.__right_ == 0);
+ assert(root.__is_black_ == false);
+
+ assert(b.__parent_ == &root);
+ assert(b.__left_ == &a);
+ assert(b.__right_ == &d);
+ assert(b.__is_black_ == true);
+
+ assert(a.__parent_ == &b);
+ assert(a.__left_ == 0);
+ assert(a.__right_ == 0);
+ assert(a.__is_black_ == true);
+
+ assert(d.__parent_ == &b);
+ assert(d.__left_ == &c);
+ assert(d.__right_ == &e);
+ assert(d.__is_black_ == false);
+
+ assert(c.__parent_ == &d);
+ assert(c.__left_ == 0);
+ assert(c.__right_ == 0);
+ assert(c.__is_black_ == true);
+
+ assert(e.__parent_ == &d);
+ assert(e.__left_ == 0);
+ assert(e.__right_ == &f);
+ assert(e.__is_black_ == true);
+
+ assert(f.__parent_ == &e);
+ assert(f.__left_ == 0);
+ assert(f.__right_ == 0);
+ assert(f.__is_black_ == false);
+
+ f.__right_ = &g;
+ g.__parent_ = &f;
+
+ std::__tree_balance_after_insert(root.__left_, &g);
+
+ assert(std::__tree_invariant(root.__left_));
+
+ assert(root.__parent_ == 0);
+ assert(root.__left_ == &b);
+ assert(root.__right_ == 0);
+ assert(root.__is_black_ == false);
+
+ assert(b.__parent_ == &root);
+ assert(b.__left_ == &a);
+ assert(b.__right_ == &d);
+ assert(b.__is_black_ == true);
+
+ assert(a.__parent_ == &b);
+ assert(a.__left_ == 0);
+ assert(a.__right_ == 0);
+ assert(a.__is_black_ == true);
+
+ assert(d.__parent_ == &b);
+ assert(d.__left_ == &c);
+ assert(d.__right_ == &f);
+ assert(d.__is_black_ == false);
+
+ assert(c.__parent_ == &d);
+ assert(c.__left_ == 0);
+ assert(c.__right_ == 0);
+ assert(c.__is_black_ == true);
+
+ assert(f.__parent_ == &d);
+ assert(f.__left_ == &e);
+ assert(f.__right_ == &g);
+ assert(f.__is_black_ == true);
+
+ assert(e.__parent_ == &f);
+ assert(e.__left_ == 0);
+ assert(e.__right_ == 0);
+ assert(e.__is_black_ == false);
+
+ assert(g.__parent_ == &f);
+ assert(g.__left_ == 0);
+ assert(g.__right_ == 0);
+ assert(g.__is_black_ == false);
+
+ g.__right_ = &h;
+ h.__parent_ = &g;
+
+ std::__tree_balance_after_insert(root.__left_, &h);
+
+ assert(std::__tree_invariant(root.__left_));
+
+ assert(root.__parent_ == 0);
+ assert(root.__left_ == &d);
+ assert(root.__right_ == 0);
+ assert(root.__is_black_ == false);
+
+ assert(d.__parent_ == &root);
+ assert(d.__left_ == &b);
+ assert(d.__right_ == &f);
+ assert(d.__is_black_ == true);
+
+ assert(b.__parent_ == &d);
+ assert(b.__left_ == &a);
+ assert(b.__right_ == &c);
+ assert(b.__is_black_ == false);
+
+ assert(a.__parent_ == &b);
+ assert(a.__left_ == 0);
+ assert(a.__right_ == 0);
+ assert(a.__is_black_ == true);
+
+ assert(c.__parent_ == &b);
+ assert(c.__left_ == 0);
+ assert(c.__right_ == 0);
+ assert(c.__is_black_ == true);
+
+ assert(f.__parent_ == &d);
+ assert(f.__left_ == &e);
+ assert(f.__right_ == &g);
+ assert(f.__is_black_ == false);
+
+ assert(e.__parent_ == &f);
+ assert(e.__left_ == 0);
+ assert(e.__right_ == 0);
+ assert(e.__is_black_ == true);
+
+ assert(g.__parent_ == &f);
+ assert(g.__left_ == 0);
+ assert(g.__right_ == &h);
+ assert(g.__is_black_ == true);
+
+ assert(h.__parent_ == &g);
+ assert(h.__left_ == 0);
+ assert(h.__right_ == 0);
+ assert(h.__is_black_ == false);
+}
+
+void test5() {
+ Node root;
+ Node a;
+ Node b;
+ Node c;
+ Node d;
+ Node e;
+ Node f;
+ Node g;
+ Node h;
+
+ root.__left_ = &h;
+ h.__parent_ = &root;
+
+ std::__tree_balance_after_insert(root.__left_, &h);
+
+ assert(std::__tree_invariant(root.__left_));
+
+ assert(root.__parent_ == 0);
+ assert(root.__left_ == &h);
+ assert(root.__right_ == 0);
+ assert(root.__is_black_ == false);
+
+ assert(h.__parent_ == &root);
+ assert(h.__left_ == 0);
+ assert(h.__right_ == 0);
+ assert(h.__is_black_ == true);
+
+ h.__left_ = &g;
+ g.__parent_ = &h;
+
+ std::__tree_balance_after_insert(root.__left_, &g);
+
+ assert(std::__tree_invariant(root.__left_));
+
+ assert(root.__parent_ == 0);
+ assert(root.__left_ == &h);
+ assert(root.__right_ == 0);
+ assert(root.__is_black_ == false);
+
+ assert(h.__parent_ == &root);
+ assert(h.__left_ == &g);
+ assert(h.__right_ == 0);
+ assert(h.__is_black_ == true);
+
+ assert(g.__parent_ == &h);
+ assert(g.__left_ == 0);
+ assert(g.__right_ == 0);
+ assert(g.__is_black_ == false);
+
+ g.__left_ = &f;
+ f.__parent_ = &g;
+
+ std::__tree_balance_after_insert(root.__left_, &f);
+
+ assert(std::__tree_invariant(root.__left_));
+
+ assert(root.__parent_ == 0);
+ assert(root.__left_ == &g);
+ assert(root.__right_ == 0);
+ assert(root.__is_black_ == false);
+
+ assert(g.__parent_ == &root);
+ assert(g.__left_ == &f);
+ assert(g.__right_ == &h);
+ assert(g.__is_black_ == true);
+
+ assert(f.__parent_ == &g);
+ assert(f.__left_ == 0);
+ assert(f.__right_ == 0);
+ assert(f.__is_black_ == false);
+
+ assert(h.__parent_ == &g);
+ assert(h.__left_ == 0);
+ assert(h.__right_ == 0);
+ assert(h.__is_black_ == false);
+
+ f.__left_ = &e;
+ e.__parent_ = &f;
+
+ std::__tree_balance_after_insert(root.__left_, &e);
+
+ assert(std::__tree_invariant(root.__left_));
+
+ assert(root.__parent_ == 0);
+ assert(root.__left_ == &g);
+ assert(root.__right_ == 0);
+ assert(root.__is_black_ == false);
+
+ assert(g.__parent_ == &root);
+ assert(g.__left_ == &f);
+ assert(g.__right_ == &h);
+ assert(g.__is_black_ == true);
+
+ assert(f.__parent_ == &g);
+ assert(f.__left_ == &e);
+ assert(f.__right_ == 0);
+ assert(f.__is_black_ == true);
+
+ assert(e.__parent_ == &f);
+ assert(e.__left_ == 0);
+ assert(e.__right_ == 0);
+ assert(e.__is_black_ == false);
+
+ assert(h.__parent_ == &g);
+ assert(h.__left_ == 0);
+ assert(h.__right_ == 0);
+ assert(h.__is_black_ == true);
+
+ e.__left_ = &d;
+ d.__parent_ = &e;
+
+ std::__tree_balance_after_insert(root.__left_, &d);
+
+ assert(std::__tree_invariant(root.__left_));
+
+ assert(root.__parent_ == 0);
+ assert(root.__left_ == &g);
+ assert(root.__right_ == 0);
+ assert(root.__is_black_ == false);
+
+ assert(g.__parent_ == &root);
+ assert(g.__left_ == &e);
+ assert(g.__right_ == &h);
+ assert(g.__is_black_ == true);
+
+ assert(e.__parent_ == &g);
+ assert(e.__left_ == &d);
+ assert(e.__right_ == &f);
+ assert(e.__is_black_ == true);
+
+ assert(d.__parent_ == &e);
+ assert(d.__left_ == 0);
+ assert(d.__right_ == 0);
+ assert(d.__is_black_ == false);
+
+ assert(f.__parent_ == &e);
+ assert(f.__left_ == 0);
+ assert(f.__right_ == 0);
+ assert(f.__is_black_ == false);
+
+ assert(h.__parent_ == &g);
+ assert(h.__left_ == 0);
+ assert(h.__right_ == 0);
+ assert(h.__is_black_ == true);
+
+ d.__left_ = &c;
+ c.__parent_ = &d;
+
+ std::__tree_balance_after_insert(root.__left_, &c);
+
+ assert(std::__tree_invariant(root.__left_));
+
+ assert(root.__parent_ == 0);
+ assert(root.__left_ == &g);
+ assert(root.__right_ == 0);
+ assert(root.__is_black_ == false);
+
+ assert(g.__parent_ == &root);
+ assert(g.__left_ == &e);
+ assert(g.__right_ == &h);
+ assert(g.__is_black_ == true);
+
+ assert(e.__parent_ == &g);
+ assert(e.__left_ == &d);
+ assert(e.__right_ == &f);
+ assert(e.__is_black_ == false);
+
+ assert(d.__parent_ == &e);
+ assert(d.__left_ == &c);
+ assert(d.__right_ == 0);
+ assert(d.__is_black_ == true);
+
+ assert(c.__parent_ == &d);
+ assert(c.__left_ == 0);
+ assert(c.__right_ == 0);
+ assert(c.__is_black_ == false);
+
+ assert(f.__parent_ == &e);
+ assert(f.__left_ == 0);
+ assert(f.__right_ == 0);
+ assert(f.__is_black_ == true);
+
+ assert(h.__parent_ == &g);
+ assert(h.__left_ == 0);
+ assert(h.__right_ == 0);
+ assert(h.__is_black_ == true);
+
+ c.__left_ = &b;
+ b.__parent_ = &c;
+
+ std::__tree_balance_after_insert(root.__left_, &b);
+
+ assert(std::__tree_invariant(root.__left_));
+
+ assert(root.__parent_ == 0);
+ assert(root.__left_ == &g);
+ assert(root.__right_ == 0);
+ assert(root.__is_black_ == false);
+
+ assert(g.__parent_ == &root);
+ assert(g.__left_ == &e);
+ assert(g.__right_ == &h);
+ assert(g.__is_black_ == true);
+
+ assert(e.__parent_ == &g);
+ assert(e.__left_ == &c);
+ assert(e.__right_ == &f);
+ assert(e.__is_black_ == false);
+
+ assert(c.__parent_ == &e);
+ assert(c.__left_ == &b);
+ assert(c.__right_ == &d);
+ assert(c.__is_black_ == true);
+
+ assert(b.__parent_ == &c);
+ assert(b.__left_ == 0);
+ assert(b.__right_ == 0);
+ assert(b.__is_black_ == false);
+
+ assert(d.__parent_ == &c);
+ assert(d.__left_ == 0);
+ assert(d.__right_ == 0);
+ assert(d.__is_black_ == false);
+
+ assert(f.__parent_ == &e);
+ assert(f.__left_ == 0);
+ assert(f.__right_ == 0);
+ assert(f.__is_black_ == true);
+
+ assert(h.__parent_ == &g);
+ assert(h.__left_ == 0);
+ assert(h.__right_ == 0);
+ assert(h.__is_black_ == true);
+
+ b.__left_ = &a;
+ a.__parent_ = &b;
+
+ std::__tree_balance_after_insert(root.__left_, &a);
+
+ assert(std::__tree_invariant(root.__left_));
+
+ assert(root.__parent_ == 0);
+ assert(root.__left_ == &e);
+ assert(root.__right_ == 0);
+ assert(root.__is_black_ == false);
+
+ assert(e.__parent_ == &root);
+ assert(e.__left_ == &c);
+ assert(e.__right_ == &g);
+ assert(e.__is_black_ == true);
+
+ assert(c.__parent_ == &e);
+ assert(c.__left_ == &b);
+ assert(c.__right_ == &d);
+ assert(c.__is_black_ == false);
+
+ assert(b.__parent_ == &c);
+ assert(b.__left_ == &a);
+ assert(b.__right_ == 0);
+ assert(b.__is_black_ == true);
+
+ assert(a.__parent_ == &b);
+ assert(a.__left_ == 0);
+ assert(a.__right_ == 0);
+ assert(a.__is_black_ == false);
+
+ assert(d.__parent_ == &c);
+ assert(d.__left_ == 0);
+ assert(d.__right_ == 0);
+ assert(d.__is_black_ == true);
+
+ assert(g.__parent_ == &e);
+ assert(g.__left_ == &f);
+ assert(g.__right_ == &h);
+ assert(g.__is_black_ == false);
+
+ assert(f.__parent_ == &g);
+ assert(f.__left_ == 0);
+ assert(f.__right_ == 0);
+ assert(f.__is_black_ == true);
+
+ assert(h.__parent_ == &g);
+ assert(h.__left_ == 0);
+ assert(h.__right_ == 0);
+ assert(h.__is_black_ == true);
+}
+
+int main(int, char**) {
+ test1();
+ test2();
+ test3();
+ test4();
+ test5();
+
+ return 0;
+}
diff --git a/libcxx/test/libcxx-03/containers/associative/tree_key_value_traits.pass.cpp b/libcxx/test/libcxx-03/containers/associative/tree_key_value_traits.pass.cpp
new file mode 100644
index 0000000000000..04dcb8f54fafc
--- /dev/null
+++ b/libcxx/test/libcxx-03/containers/associative/tree_key_value_traits.pass.cpp
@@ -0,0 +1,56 @@
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// XFAIL: FROZEN-CXX03-HEADERS-FIXME
+
+#include <__tree>
+#include <map>
+#include <set>
+#include <type_traits>
+
+#include "test_macros.h"
+#include "min_allocator.h"
+
+void testKeyValueTrait() {
+ {
+ typedef int Tp;
+ typedef std::__tree_key_value_types<Tp> Traits;
+ static_assert((std::is_same<Traits::key_type, int>::value), "");
+ static_assert((std::is_same<Traits::__container_value_type, Tp>::value), "");
+ static_assert(Traits::__is_map == false, "");
+ }
+ {
+ typedef std::pair<int, int> Tp;
+ typedef std::__tree_key_value_types<Tp> Traits;
+ static_assert((std::is_same<Traits::key_type, Tp>::value), "");
+ static_assert((std::is_same<Traits::__container_value_type, Tp>::value), "");
+ static_assert(Traits::__is_map == false, "");
+ }
+ {
+ typedef std::pair<const int, int> Tp;
+ typedef std::__tree_key_value_types<Tp> Traits;
+ static_assert((std::is_same<Traits::key_type, Tp>::value), "");
+ static_assert((std::is_same<Traits::__container_value_type, Tp>::value), "");
+ static_assert(Traits::__is_map == false, "");
+ }
+ {
+ typedef std::__value_type<int, int> Tp;
+ typedef std::__tree_key_value_types<Tp> Traits;
+ static_assert((std::is_same<Traits::key_type, int>::value), "");
+ static_assert((std::is_same<Traits::mapped_type, int>::value), "");
+ static_assert((std::is_same<Traits::__container_value_type, std::pair<const int, int> >::value), "");
+ static_assert((std::is_same<Traits::__map_value_type, std::pair<const int, int> >::value), "");
+ static_assert(Traits::__is_map == true, "");
+ }
+}
+
+int main(int, char**) {
+ testKeyValueTrait();
+
+ return 0;
+}
diff --git a/libcxx/test/libcxx-03/containers/associative/tree_left_rotate.pass.cpp b/libcxx/test/libcxx-03/containers/associative/tree_left_rotate.pass.cpp
new file mode 100644
index 0000000000000..d97a1c89f1f70
--- /dev/null
+++ b/libcxx/test/libcxx-03/containers/associative/tree_left_rotate.pass.cpp
@@ -0,0 +1,100 @@
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// Not a portable test
+
+// Precondition: __x->__right_ != nullptr
+// template <class _NodePtr>
+// void
+// __tree_left_rotate(_NodePtr __x);
+
+// XFAIL: FROZEN-CXX03-HEADERS-FIXME
+
+#include <__tree>
+#include <cassert>
+
+#include "test_macros.h"
+
+struct Node {
+ Node* __left_;
+ Node* __right_;
+ Node* __parent_;
+
+ Node* __parent_unsafe() const { return __parent_; }
+ void __set_parent(Node* x) { __parent_ = x; }
+
+ Node() : __left_(), __right_(), __parent_() {}
+};
+
+void test1() {
+ Node root;
+ Node x;
+ Node y;
+ root.__left_ = &x;
+ x.__left_ = 0;
+ x.__right_ = &y;
+ x.__parent_ = &root;
+ y.__left_ = 0;
+ y.__right_ = 0;
+ y.__parent_ = &x;
+ std::__tree_left_rotate(&x);
+ assert(root.__parent_ == 0);
+ assert(root.__left_ == &y);
+ assert(root.__right_ == 0);
+ assert(y.__parent_ == &root);
+ assert(y.__left_ == &x);
+ assert(y.__right_ == 0);
+ assert(x.__parent_ == &y);
+ assert(x.__left_ == 0);
+ assert(x.__right_ == 0);
+}
+
+void test2() {
+ Node root;
+ Node x;
+ Node y;
+ Node a;
+ Node b;
+ Node c;
+ root.__left_ = &x;
+ x.__left_ = &a;
+ x.__right_ = &y;
+ x.__parent_ = &root;
+ y.__left_ = &b;
+ y.__right_ = &c;
+ y.__parent_ = &x;
+ a.__parent_ = &x;
+ b.__parent_ = &y;
+ c.__parent_ = &y;
+ std::__tree_left_rotate(&x);
+ assert(root.__parent_ == 0);
+ assert(root.__left_ == &y);
+ assert(root.__right_ == 0);
+ assert(y.__parent_ == &root);
+ assert(y.__left_ == &x);
+ assert(y.__right_ == &c);
+ assert(x.__parent_ == &y);
+ assert(x.__left_ == &a);
+ assert(x.__right_ == &b);
+ assert(a.__parent_ == &x);
+ assert(a.__left_ == 0);
+ assert(a.__right_ == 0);
+ assert(b.__parent_ == &x);
+ assert(b.__left_ == 0);
+ assert(b.__right_ == 0);
+ assert(c.__parent_ == &y);
+ assert(c.__left_ == 0);
+ assert(c.__right_ == 0);
+}
+
+int main(int, char**) {
+ test1();
+ test2();
+
+ return 0;
+}
diff --git a/libcxx/test/libcxx-03/containers/associative/tree_remove.pass.cpp b/libcxx/test/libcxx-03/containers/associative/tree_remove.pass.cpp
new file mode 100644
index 0000000000000..e543c3360a685
--- /dev/null
+++ b/libcxx/test/libcxx-03/containers/associative/tree_remove.pass.cpp
@@ -0,0 +1,1646 @@
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// Not a portable test
+
+// Returns __tree_next(__z)
+// template <class _NodePtr>
+// void
+// __tree_remove(_NodePtr __root, _NodePtr __z)
+
+// XFAIL: FROZEN-CXX03-HEADERS-FIXME
+
+#include <__tree>
+#include <cassert>
+
+#include "test_macros.h"
+
+struct Node {
+ Node* __left_;
+ Node* __right_;
+ Node* __parent_;
+ bool __is_black_;
+
+ Node* __parent_unsafe() const { return __parent_; }
+ void __set_parent(Node* x) { __parent_ = x; }
+
+ Node() : __left_(), __right_(), __parent_(), __is_black_() {}
+};
+
+void test1() {
+ {
+ // Left
+ // Case 1 -> Case 2 -> x is red turned to black
+ Node root;
+ Node b;
+ Node c;
+ Node d;
+ Node e;
+ Node y;
+
+ root.__left_ = &b;
+
+ b.__parent_ = &root;
+ b.__left_ = &y;
+ b.__right_ = &d;
+ b.__is_black_ = true;
+
+ y.__parent_ = &b;
+ y.__left_ = 0;
+ y.__right_ = 0;
+ y.__is_black_ = true;
+
+ d.__parent_ = &b;
+ d.__left_ = &c;
+ d.__right_ = &e;
+ d.__is_black_ = false;
+
+ c.__parent_ = &d;
+ c.__left_ = 0;
+ c.__right_ = 0;
+ c.__is_black_ = true;
+
+ e.__parent_ = &d;
+ e.__left_ = 0;
+ e.__right_ = 0;
+ e.__is_black_ = true;
+
+ std::__tree_remove(root.__left_, &y);
+ assert(std::__tree_invariant(root.__left_));
+
+ assert(root.__parent_ == 0);
+ assert(root.__left_ == &d);
+ assert(root.__right_ == 0);
+ assert(root.__is_black_ == false);
+
+ assert(d.__parent_ == &root);
+ assert(d.__left_ == &b);
+ assert(d.__right_ == &e);
+ assert(d.__is_black_ == true);
+
+ assert(b.__parent_ == &d);
+ assert(b.__left_ == 0);
+ assert(b.__right_ == &c);
+ assert(b.__is_black_ == true);
+
+ assert(c.__parent_ == &b);
+ assert(c.__left_ == 0);
+ assert(c.__right_ == 0);
+ assert(c.__is_black_ == false);
+
+ assert(e.__parent_ == &d);
+ assert(e.__left_ == 0);
+ assert(e.__right_ == 0);
+ assert(e.__is_black_ == true);
+ }
+ {
+ // Right
+ // Case 1 -> Case 2 -> x is red turned to black
+ Node root;
+ Node b;
+ Node c;
+ Node d;
+ Node e;
+ Node y;
+
+ root.__left_ = &b;
+
+ b.__parent_ = &root;
+ b.__right_ = &y;
+ b.__left_ = &d;
+ b.__is_black_ = true;
+
+ y.__parent_ = &b;
+ y.__right_ = 0;
+ y.__left_ = 0;
+ y.__is_black_ = true;
+
+ d.__parent_ = &b;
+ d.__right_ = &c;
+ d.__left_ = &e;
+ d.__is_black_ = false;
+
+ c.__parent_ = &d;
+ c.__right_ = 0;
+ c.__left_ = 0;
+ c.__is_black_ = true;
+
+ e.__parent_ = &d;
+ e.__right_ = 0;
+ e.__left_ = 0;
+ e.__is_black_ = true;
+
+ std::__tree_remove(root.__left_, &y);
+ assert(std::__tree_invariant(root.__left_));
+
+ assert(root.__parent_ == 0);
+ assert(root.__left_ == &d);
+ assert(root.__right_ == 0);
+ assert(root.__is_black_ == false);
+
+ assert(d.__parent_ == &root);
+ assert(d.__right_ == &b);
+ assert(d.__left_ == &e);
+ assert(d.__is_black_ == true);
+
+ assert(b.__parent_ == &d);
+ assert(b.__right_ == 0);
+ assert(b.__left_ == &c);
+ assert(b.__is_black_ == true);
+
+ assert(c.__parent_ == &b);
+ assert(c.__right_ == 0);
+ assert(c.__left_ == 0);
+ assert(c.__is_black_ == false);
+
+ assert(e.__parent_ == &d);
+ assert(e.__right_ == 0);
+ assert(e.__left_ == 0);
+ assert(e.__is_black_ == true);
+ }
+ {
+ // Left
+ // Case 1 -> Case 3 -> Case 4
+ Node root;
+ Node b;
+ Node c;
+ Node d;
+ Node e;
+ Node f;
+ Node y;
+
+ root.__left_ = &b;
+
+ b.__parent_ = &root;
+ b.__left_ = &y;
+ b.__right_ = &d;
+ b.__is_black_ = true;
+
+ y.__parent_ = &b;
+ y.__left_ = 0;
+ y.__right_ = 0;
+ y.__is_black_ = true;
+
+ d.__parent_ = &b;
+ d.__left_ = &c;
+ d.__right_ = &e;
+ d.__is_black_ = false;
+
+ c.__parent_ = &d;
+ c.__left_ = &f;
+ c.__right_ = 0;
+ c.__is_black_ = true;
+
+ e.__parent_ = &d;
+ e.__left_ = 0;
+ e.__right_ = 0;
+ e.__is_black_ = true;
+
+ f.__parent_ = &c;
+ f.__left_ = 0;
+ f.__right_ = 0;
+ f.__is_black_ = false;
+
+ std::__tree_remove(root.__left_, &y);
+ assert(std::__tree_invariant(root.__left_));
+
+ assert(root.__parent_ == 0);
+ assert(root.__left_ == &d);
+ assert(root.__right_ == 0);
+ assert(root.__is_black_ == false);
+
+ assert(d.__parent_ == &root);
+ assert(d.__left_ == &f);
+ assert(d.__right_ == &e);
+ assert(d.__is_black_ == true);
+
+ assert(f.__parent_ == &d);
+ assert(f.__left_ == &b);
+ assert(f.__right_ == &c);
+ assert(f.__is_black_ == false);
+
+ assert(b.__parent_ == &f);
+ assert(b.__left_ == 0);
+ assert(b.__right_ == 0);
+ assert(b.__is_black_ == true);
+
+ assert(c.__parent_ == &f);
+ assert(c.__left_ == 0);
+ assert(c.__right_ == 0);
+ assert(c.__is_black_ == true);
+
+ assert(e.__parent_ == &d);
+ assert(e.__left_ == 0);
+ assert(e.__right_ == 0);
+ assert(e.__is_black_ == true);
+ }
+ {
+ // Right
+ // Case 1 -> Case 3 -> Case 4
+ Node root;
+ Node b;
+ Node c;
+ Node d;
+ Node e;
+ Node f;
+ Node y;
+
+ root.__left_ = &b;
+
+ b.__parent_ = &root;
+ b.__right_ = &y;
+ b.__left_ = &d;
+ b.__is_black_ = true;
+
+ y.__parent_ = &b;
+ y.__right_ = 0;
+ y.__left_ = 0;
+ y.__is_black_ = true;
+
+ d.__parent_ = &b;
+ d.__right_ = &c;
+ d.__left_ = &e;
+ d.__is_black_ = false;
+
+ c.__parent_ = &d;
+ c.__right_ = &f;
+ c.__left_ = 0;
+ c.__is_black_ = true;
+
+ e.__parent_ = &d;
+ e.__right_ = 0;
+ e.__left_ = 0;
+ e.__is_black_ = true;
+
+ f.__parent_ = &c;
+ f.__right_ = 0;
+ f.__left_ = 0;
+ f.__is_black_ = false;
+
+ std::__tree_remove(root.__left_, &y);
+ assert(std::__tree_invariant(root.__left_));
+
+ assert(root.__parent_ == 0);
+ assert(root.__left_ == &d);
+ assert(root.__right_ == 0);
+ assert(root.__is_black_ == false);
+
+ assert(d.__parent_ == &root);
+ assert(d.__right_ == &f);
+ assert(d.__left_ == &e);
+ assert(d.__is_black_ == true);
+
+ assert(f.__parent_ == &d);
+ assert(f.__right_ == &b);
+ assert(f.__left_ == &c);
+ assert(f.__is_black_ == false);
+
+ assert(b.__parent_ == &f);
+ assert(b.__right_ == 0);
+ assert(b.__left_ == 0);
+ assert(b.__is_black_ == true);
+
+ assert(c.__parent_ == &f);
+ assert(c.__right_ == 0);
+ assert(c.__left_ == 0);
+ assert(c.__is_black_ == true);
+
+ assert(e.__parent_ == &d);
+ assert(e.__right_ == 0);
+ assert(e.__left_ == 0);
+ assert(e.__is_black_ == true);
+ }
+}
+
+void test2() {
+ {
+ Node root;
+ Node a;
+ Node b;
+ Node c;
+
+ root.__left_ = &b;
+
+ b.__parent_ = &root;
+ b.__left_ = &a;
+ b.__right_ = &c;
+ b.__is_black_ = true;
+
+ a.__parent_ = &b;
+ a.__left_ = 0;
+ a.__right_ = 0;
+ a.__is_black_ = true;
+
+ c.__parent_ = &b;
+ c.__left_ = 0;
+ c.__right_ = 0;
+ c.__is_black_ = true;
+
+ std::__tree_remove(root.__left_, &a);
+
+ assert(std::__tree_invariant(root.__left_));
+
+ assert(root.__parent_ == 0);
+ assert(root.__left_ == &b);
+ assert(root.__right_ == 0);
+ assert(root.__is_black_ == false);
+
+ assert(b.__parent_ == &root);
+ assert(b.__left_ == 0);
+ assert(b.__right_ == &c);
+ assert(b.__is_black_ == true);
+
+ assert(c.__parent_ == &b);
+ assert(c.__left_ == 0);
+ assert(c.__right_ == 0);
+ assert(c.__is_black_ == false);
+
+ std::__tree_remove(root.__left_, &b);
+
+ assert(std::__tree_invariant(root.__left_));
+
+ assert(root.__parent_ == 0);
+ assert(root.__left_ == &c);
+ assert(root.__right_ == 0);
+ assert(root.__is_black_ == false);
+
+ assert(c.__parent_ == &root);
+ assert(c.__left_ == 0);
+ assert(c.__right_ == 0);
+ assert(c.__is_black_ == true);
+
+ std::__tree_remove(root.__left_, &c);
+
+ assert(std::__tree_invariant(root.__left_));
+
+ assert(root.__parent_ == 0);
+ assert(root.__left_ == 0);
+ assert(root.__right_ == 0);
+ assert(root.__is_black_ == false);
+ }
+ {
+ Node root;
+ Node a;
+ Node b;
+ Node c;
+
+ root.__left_ = &b;
+
+ b.__parent_ = &root;
+ b.__left_ = &a;
+ b.__right_ = &c;
+ b.__is_black_ = true;
+
+ a.__parent_ = &b;
+ a.__left_ = 0;
+ a.__right_ = 0;
+ a.__is_black_ = false;
+
+ c.__parent_ = &b;
+ c.__left_ = 0;
+ c.__right_ = 0;
+ c.__is_black_ = false;
+
+ std::__tree_remove(root.__left_, &a);
+
+ assert(std::__tree_invariant(root.__left_));
+
+ assert(root.__parent_ == 0);
+ assert(root.__left_ == &b);
+ assert(root.__right_ == 0);
+ assert(root.__is_black_ == false);
+
+ assert(b.__parent_ == &root);
+ assert(b.__left_ == 0);
+ assert(b.__right_ == &c);
+ assert(b.__is_black_ == true);
+
+ assert(c.__parent_ == &b);
+ assert(c.__left_ == 0);
+ assert(c.__right_ == 0);
+ assert(c.__is_black_ == false);
+
+ std::__tree_remove(root.__left_, &b);
+
+ assert(std::__tree_invariant(root.__left_));
+
+ assert(root.__parent_ == 0);
+ assert(root.__left_ == &c);
+ assert(root.__right_ == 0);
+ assert(root.__is_black_ == false);
+
+ assert(c.__parent_ == &root);
+ assert(c.__left_ == 0);
+ assert(c.__right_ == 0);
+ assert(c.__is_black_ == true);
+
+ std::__tree_remove(root.__left_, &c);
+
+ assert(std::__tree_invariant(root.__left_));
+
+ assert(root.__parent_ == 0);
+ assert(root.__left_ == 0);
+ assert(root.__right_ == 0);
+ assert(root.__is_black_ == false);
+ }
+ {
+ Node root;
+ Node a;
+ Node b;
+ Node c;
+
+ root.__left_ = &b;
+
+ b.__parent_ = &root;
+ b.__left_ = &a;
+ b.__right_ = &c;
+ b.__is_black_ = true;
+
+ a.__parent_ = &b;
+ a.__left_ = 0;
+ a.__right_ = 0;
+ a.__is_black_ = true;
+
+ c.__parent_ = &b;
+ c.__left_ = 0;
+ c.__right_ = 0;
+ c.__is_black_ = true;
+
+ std::__tree_remove(root.__left_, &a);
+
+ assert(std::__tree_invariant(root.__left_));
+
+ assert(root.__parent_ == 0);
+ assert(root.__left_ == &b);
+ assert(root.__right_ == 0);
+ assert(root.__is_black_ == false);
+
+ assert(b.__parent_ == &root);
+ assert(b.__left_ == 0);
+ assert(b.__right_ == &c);
+ assert(b.__is_black_ == true);
+
+ assert(c.__parent_ == &b);
+ assert(c.__left_ == 0);
+ assert(c.__right_ == 0);
+ assert(c.__is_black_ == false);
+
+ std::__tree_remove(root.__left_, &c);
+
+ assert(std::__tree_invariant(root.__left_));
+
+ assert(root.__parent_ == 0);
+ assert(root.__left_ == &b);
+ assert(root.__right_ == 0);
+ assert(root.__is_black_ == false);
+
+ assert(b.__parent_ == &root);
+ assert(b.__left_ == 0);
+ assert(b.__right_ == 0);
+ assert(b.__is_black_ == true);
+
+ std::__tree_remove(root.__left_, &b);
+
+ assert(std::__tree_invariant(root.__left_));
+
+ assert(root.__parent_ == 0);
+ assert(root.__left_ == 0);
+ assert(root.__right_ == 0);
+ assert(root.__is_black_ == false);
+ }
+ {
+ Node root;
+ Node a;
+ Node b;
+ Node c;
+
+ root.__left_ = &b;
+
+ b.__parent_ = &root;
+ b.__left_ = &a;
+ b.__right_ = &c;
+ b.__is_black_ = true;
+
+ a.__parent_ = &b;
+ a.__left_ = 0;
+ a.__right_ = 0;
+ a.__is_black_ = false;
+
+ c.__parent_ = &b;
+ c.__left_ = 0;
+ c.__right_ = 0;
+ c.__is_black_ = false;
+
+ std::__tree_remove(root.__left_, &a);
+
+ assert(std::__tree_invariant(root.__left_));
+
+ assert(root.__parent_ == 0);
+ assert(root.__left_ == &b);
+ assert(root.__right_ == 0);
+ assert(root.__is_black_ == false);
+
+ assert(b.__parent_ == &root);
+ assert(b.__left_ == 0);
+ assert(b.__right_ == &c);
+ assert(b.__is_black_ == true);
+
+ assert(c.__parent_ == &b);
+ assert(c.__left_ == 0);
+ assert(c.__right_ == 0);
+ assert(c.__is_black_ == false);
+
+ std::__tree_remove(root.__left_, &c);
+
+ assert(std::__tree_invariant(root.__left_));
+
+ assert(root.__parent_ == 0);
+ assert(root.__left_ == &b);
+ assert(root.__right_ == 0);
+ assert(root.__is_black_ == false);
+
+ assert(b.__parent_ == &root);
+ assert(b.__left_ == 0);
+ assert(b.__right_ == 0);
+ assert(b.__is_black_ == true);
+
+ std::__tree_remove(root.__left_, &b);
+
+ assert(std::__tree_invariant(root.__left_));
+
+ assert(root.__parent_ == 0);
+ assert(root.__left_ == 0);
+ assert(root.__right_ == 0);
+ assert(root.__is_black_ == false);
+ }
+ {
+ Node root;
+ Node a;
+ Node b;
+ Node c;
+
+ root.__left_ = &b;
+
+ b.__parent_ = &root;
+ b.__left_ = &a;
+ b.__right_ = &c;
+ b.__is_black_ = true;
+
+ a.__parent_ = &b;
+ a.__left_ = 0;
+ a.__right_ = 0;
+ a.__is_black_ = true;
+
+ c.__parent_ = &b;
+ c.__left_ = 0;
+ c.__right_ = 0;
+ c.__is_black_ = true;
+
+ std::__tree_remove(root.__left_, &b);
+
+ assert(std::__tree_invariant(root.__left_));
+
+ assert(root.__parent_ == 0);
+ assert(root.__left_ == &c);
+ assert(root.__right_ == 0);
+ assert(root.__is_black_ == false);
+
+ assert(a.__parent_ == &c);
+ assert(a.__left_ == 0);
+ assert(a.__right_ == 0);
+ assert(a.__is_black_ == false);
+
+ assert(c.__parent_ == &root);
+ assert(c.__left_ == &a);
+ assert(c.__right_ == 0);
+ assert(c.__is_black_ == true);
+
+ std::__tree_remove(root.__left_, &a);
+
+ assert(std::__tree_invariant(root.__left_));
+
+ assert(root.__parent_ == 0);
+ assert(root.__left_ == &c);
+ assert(root.__right_ == 0);
+ assert(root.__is_black_ == false);
+
+ assert(c.__parent_ == &root);
+ assert(c.__left_ == 0);
+ assert(c.__right_ == 0);
+ assert(c.__is_black_ == true);
+
+ std::__tree_remove(root.__left_, &c);
+
+ assert(std::__tree_invariant(root.__left_));
+
+ assert(root.__parent_ == 0);
+ assert(root.__left_ == 0);
+ assert(root.__right_ == 0);
+ assert(root.__is_black_ == false);
+ }
+ {
+ Node root;
+ Node a;
+ Node b;
+ Node c;
+
+ root.__left_ = &b;
+
+ b.__parent_ = &root;
+ b.__left_ = &a;
+ b.__right_ = &c;
+ b.__is_black_ = true;
+
+ a.__parent_ = &b;
+ a.__left_ = 0;
+ a.__right_ = 0;
+ a.__is_black_ = false;
+
+ c.__parent_ = &b;
+ c.__left_ = 0;
+ c.__right_ = 0;
+ c.__is_black_ = false;
+
+ std::__tree_remove(root.__left_, &b);
+
+ assert(std::__tree_invariant(root.__left_));
+
+ assert(root.__parent_ == 0);
+ assert(root.__left_ == &c);
+ assert(root.__right_ == 0);
+ assert(root.__is_black_ == false);
+
+ assert(a.__parent_ == &c);
+ assert(a.__left_ == 0);
+ assert(a.__right_ == 0);
+ assert(a.__is_black_ == false);
+
+ assert(c.__parent_ == &root);
+ assert(c.__left_ == &a);
+ assert(c.__right_ == 0);
+ assert(c.__is_black_ == true);
+
+ std::__tree_remove(root.__left_, &a);
+
+ assert(std::__tree_invariant(root.__left_));
+
+ assert(root.__parent_ == 0);
+ assert(root.__left_ == &c);
+ assert(root.__right_ == 0);
+ assert(root.__is_black_ == false);
+
+ assert(c.__parent_ == &root);
+ assert(c.__left_ == 0);
+ assert(c.__right_ == 0);
+ assert(c.__is_black_ == true);
+
+ std::__tree_remove(root.__left_, &c);
+
+ assert(std::__tree_invariant(root.__left_));
+
+ assert(root.__parent_ == 0);
+ assert(root.__left_ == 0);
+ assert(root.__right_ == 0);
+ assert(root.__is_black_ == false);
+ }
+ {
+ Node root;
+ Node a;
+ Node b;
+ Node c;
+
+ root.__left_ = &b;
+
+ b.__parent_ = &root;
+ b.__left_ = &a;
+ b.__right_ = &c;
+ b.__is_black_ = true;
+
+ a.__parent_ = &b;
+ a.__left_ = 0;
+ a.__right_ = 0;
+ a.__is_black_ = true;
+
+ c.__parent_ = &b;
+ c.__left_ = 0;
+ c.__right_ = 0;
+ c.__is_black_ = true;
+
+ std::__tree_remove(root.__left_, &b);
+
+ assert(std::__tree_invariant(root.__left_));
+
+ assert(root.__parent_ == 0);
+ assert(root.__left_ == &c);
+ assert(root.__right_ == 0);
+ assert(root.__is_black_ == false);
+
+ assert(a.__parent_ == &c);
+ assert(a.__left_ == 0);
+ assert(a.__right_ == 0);
+ assert(a.__is_black_ == false);
+
+ assert(c.__parent_ == &root);
+ assert(c.__left_ == &a);
+ assert(c.__right_ == 0);
+ assert(c.__is_black_ == true);
+
+ std::__tree_remove(root.__left_, &c);
+
+ assert(std::__tree_invariant(root.__left_));
+
+ assert(root.__parent_ == 0);
+ assert(root.__left_ == &a);
+ assert(root.__right_ == 0);
+ assert(root.__is_black_ == false);
+
+ assert(a.__parent_ == &root);
+ assert(a.__left_ == 0);
+ assert(a.__right_ == 0);
+ assert(a.__is_black_ == true);
+
+ std::__tree_remove(root.__left_, &a);
+
+ assert(std::__tree_invariant(root.__left_));
+
+ assert(root.__parent_ == 0);
+ assert(root.__left_ == 0);
+ assert(root.__right_ == 0);
+ assert(root.__is_black_ == false);
+ }
+ {
+ Node root;
+ Node a;
+ Node b;
+ Node c;
+
+ root.__left_ = &b;
+
+ b.__parent_ = &root;
+ b.__left_ = &a;
+ b.__right_ = &c;
+ b.__is_black_ = true;
+
+ a.__parent_ = &b;
+ a.__left_ = 0;
+ a.__right_ = 0;
+ a.__is_black_ = false;
+
+ c.__parent_ = &b;
+ c.__left_ = 0;
+ c.__right_ = 0;
+ c.__is_black_ = false;
+
+ std::__tree_remove(root.__left_, &b);
+
+ assert(std::__tree_invariant(root.__left_));
+
+ assert(root.__parent_ == 0);
+ assert(root.__left_ == &c);
+ assert(root.__right_ == 0);
+ assert(root.__is_black_ == false);
+
+ assert(a.__parent_ == &c);
+ assert(a.__left_ == 0);
+ assert(a.__right_ == 0);
+ assert(a.__is_black_ == false);
+
+ assert(c.__parent_ == &root);
+ assert(c.__left_ == &a);
+ assert(c.__right_ == 0);
+ assert(c.__is_black_ == true);
+
+ std::__tree_remove(root.__left_, &c);
+
+ assert(std::__tree_invariant(root.__left_));
+
+ assert(root.__parent_ == 0);
+ assert(root.__left_ == &a);
+ assert(root.__right_ == 0);
+ assert(root.__is_black_ == false);
+
+ assert(a.__parent_ == &root);
+ assert(a.__left_ == 0);
+ assert(a.__right_ == 0);
+ assert(a.__is_black_ == true);
+
+ std::__tree_remove(root.__left_, &a);
+
+ assert(std::__tree_invariant(root.__left_));
+
+ assert(root.__parent_ == 0);
+ assert(root.__left_ == 0);
+ assert(root.__right_ == 0);
+ assert(root.__is_black_ == false);
+ }
+ {
+ Node root;
+ Node a;
+ Node b;
+ Node c;
+
+ root.__left_ = &b;
+
+ b.__parent_ = &root;
+ b.__left_ = &a;
+ b.__right_ = &c;
+ b.__is_black_ = true;
+
+ a.__parent_ = &b;
+ a.__left_ = 0;
+ a.__right_ = 0;
+ a.__is_black_ = true;
+
+ c.__parent_ = &b;
+ c.__left_ = 0;
+ c.__right_ = 0;
+ c.__is_black_ = true;
+
+ std::__tree_remove(root.__left_, &c);
+
+ assert(std::__tree_invariant(root.__left_));
+
+ assert(root.__parent_ == 0);
+ assert(root.__left_ == &b);
+ assert(root.__right_ == 0);
+ assert(root.__is_black_ == false);
+
+ assert(a.__parent_ == &b);
+ assert(a.__left_ == 0);
+ assert(a.__right_ == 0);
+ assert(a.__is_black_ == false);
+
+ assert(b.__parent_ == &root);
+ assert(b.__left_ == &a);
+ assert(b.__right_ == 0);
+ assert(b.__is_black_ == true);
+
+ std::__tree_remove(root.__left_, &b);
+
+ assert(std::__tree_invariant(root.__left_));
+
+ assert(root.__parent_ == 0);
+ assert(root.__left_ == &a);
+ assert(root.__right_ == 0);
+ assert(root.__is_black_ == false);
+
+ assert(a.__parent_ == &root);
+ assert(a.__left_ == 0);
+ assert(a.__right_ == 0);
+ assert(a.__is_black_ == true);
+
+ std::__tree_remove(root.__left_, &a);
+
+ assert(std::__tree_invariant(root.__left_));
+
+ assert(root.__parent_ == 0);
+ assert(root.__left_ == 0);
+ assert(root.__right_ == 0);
+ assert(root.__is_black_ == false);
+ }
+ {
+ Node root;
+ Node a;
+ Node b;
+ Node c;
+
+ root.__left_ = &b;
+
+ b.__parent_ = &root;
+ b.__left_ = &a;
+ b.__right_ = &c;
+ b.__is_black_ = true;
+
+ a.__parent_ = &b;
+ a.__left_ = 0;
+ a.__right_ = 0;
+ a.__is_black_ = false;
+
+ c.__parent_ = &b;
+ c.__left_ = 0;
+ c.__right_ = 0;
+ c.__is_black_ = false;
+
+ std::__tree_remove(root.__left_, &c);
+
+ assert(std::__tree_invariant(root.__left_));
+
+ assert(root.__parent_ == 0);
+ assert(root.__left_ == &b);
+ assert(root.__right_ == 0);
+ assert(root.__is_black_ == false);
+
+ assert(a.__parent_ == &b);
+ assert(a.__left_ == 0);
+ assert(a.__right_ == 0);
+ assert(a.__is_black_ == false);
+
+ assert(b.__parent_ == &root);
+ assert(b.__left_ == &a);
+ assert(b.__right_ == 0);
+ assert(b.__is_black_ == true);
+
+ std::__tree_remove(root.__left_, &b);
+
+ assert(std::__tree_invariant(root.__left_));
+
+ assert(root.__parent_ == 0);
+ assert(root.__left_ == &a);
+ assert(root.__right_ == 0);
+ assert(root.__is_black_ == false);
+
+ assert(a.__parent_ == &root);
+ assert(a.__left_ == 0);
+ assert(a.__right_ == 0);
+ assert(a.__is_black_ == true);
+
+ std::__tree_remove(root.__left_, &a);
+
+ assert(std::__tree_invariant(root.__left_));
+
+ assert(root.__parent_ == 0);
+ assert(root.__left_ == 0);
+ assert(root.__right_ == 0);
+ assert(root.__is_black_ == false);
+ }
+ {
+ Node root;
+ Node a;
+ Node b;
+ Node c;
+
+ root.__left_ = &b;
+
+ b.__parent_ = &root;
+ b.__left_ = &a;
+ b.__right_ = &c;
+ b.__is_black_ = true;
+
+ a.__parent_ = &b;
+ a.__left_ = 0;
+ a.__right_ = 0;
+ a.__is_black_ = true;
+
+ c.__parent_ = &b;
+ c.__left_ = 0;
+ c.__right_ = 0;
+ c.__is_black_ = true;
+
+ std::__tree_remove(root.__left_, &c);
+
+ assert(std::__tree_invariant(root.__left_));
+
+ assert(root.__parent_ == 0);
+ assert(root.__left_ == &b);
+ assert(root.__right_ == 0);
+ assert(root.__is_black_ == false);
+
+ assert(a.__parent_ == &b);
+ assert(a.__left_ == 0);
+ assert(a.__right_ == 0);
+ assert(a.__is_black_ == false);
+
+ assert(b.__parent_ == &root);
+ assert(b.__left_ == &a);
+ assert(b.__right_ == 0);
+ assert(b.__is_black_ == true);
+
+ std::__tree_remove(root.__left_, &a);
+
+ assert(std::__tree_invariant(root.__left_));
+
+ assert(root.__parent_ == 0);
+ assert(root.__left_ == &b);
+ assert(root.__right_ == 0);
+ assert(root.__is_black_ == false);
+
+ assert(b.__parent_ == &root);
+ assert(b.__left_ == 0);
+ assert(b.__right_ == 0);
+ assert(b.__is_black_ == true);
+
+ std::__tree_remove(root.__left_, &b);
+
+ assert(std::__tree_invariant(root.__left_));
+
+ assert(root.__parent_ == 0);
+ assert(root.__left_ == 0);
+ assert(root.__right_ == 0);
+ assert(root.__is_black_ == false);
+ }
+ {
+ Node root;
+ Node a;
+ Node b;
+ Node c;
+
+ root.__left_ = &b;
+
+ b.__parent_ = &root;
+ b.__left_ = &a;
+ b.__right_ = &c;
+ b.__is_black_ = true;
+
+ a.__parent_ = &b;
+ a.__left_ = 0;
+ a.__right_ = 0;
+ a.__is_black_ = false;
+
+ c.__parent_ = &b;
+ c.__left_ = 0;
+ c.__right_ = 0;
+ c.__is_black_ = false;
+
+ std::__tree_remove(root.__left_, &c);
+
+ assert(std::__tree_invariant(root.__left_));
+
+ assert(root.__parent_ == 0);
+ assert(root.__left_ == &b);
+ assert(root.__right_ == 0);
+ assert(root.__is_black_ == false);
+
+ assert(a.__parent_ == &b);
+ assert(a.__left_ == 0);
+ assert(a.__right_ == 0);
+ assert(a.__is_black_ == false);
+
+ assert(b.__parent_ == &root);
+ assert(b.__left_ == &a);
+ assert(b.__right_ == 0);
+ assert(b.__is_black_ == true);
+
+ std::__tree_remove(root.__left_, &a);
+
+ assert(std::__tree_invariant(root.__left_));
+
+ assert(root.__parent_ == 0);
+ assert(root.__left_ == &b);
+ assert(root.__right_ == 0);
+ assert(root.__is_black_ == false);
+
+ assert(b.__parent_ == &root);
+ assert(b.__left_ == 0);
+ assert(b.__right_ == 0);
+ assert(b.__is_black_ == true);
+
+ std::__tree_remove(root.__left_, &b);
+
+ assert(std::__tree_invariant(root.__left_));
+
+ assert(root.__parent_ == 0);
+ assert(root.__left_ == 0);
+ assert(root.__right_ == 0);
+ assert(root.__is_black_ == false);
+ }
+}
+
+void test3() {
+ Node root;
+ Node a;
+ Node b;
+ Node c;
+ Node d;
+ Node e;
+ Node f;
+ Node g;
+ Node h;
+
+ root.__left_ = &e;
+
+ e.__parent_ = &root;
+ e.__left_ = &c;
+ e.__right_ = &g;
+ e.__is_black_ = true;
+
+ c.__parent_ = &e;
+ c.__left_ = &b;
+ c.__right_ = &d;
+ c.__is_black_ = false;
+
+ g.__parent_ = &e;
+ g.__left_ = &f;
+ g.__right_ = &h;
+ g.__is_black_ = false;
+
+ b.__parent_ = &c;
+ b.__left_ = &a;
+ b.__right_ = 0;
+ b.__is_black_ = true;
+
+ d.__parent_ = &c;
+ d.__left_ = 0;
+ d.__right_ = 0;
+ d.__is_black_ = true;
+
+ f.__parent_ = &g;
+ f.__left_ = 0;
+ f.__right_ = 0;
+ f.__is_black_ = true;
+
+ h.__parent_ = &g;
+ h.__left_ = 0;
+ h.__right_ = 0;
+ h.__is_black_ = true;
+
+ a.__parent_ = &b;
+ a.__left_ = 0;
+ a.__right_ = 0;
+ a.__is_black_ = false;
+
+ assert(std::__tree_invariant(root.__left_));
+
+ std::__tree_remove(root.__left_, &h);
+
+ assert(std::__tree_invariant(root.__left_));
+
+ assert(root.__parent_ == 0);
+ assert(root.__left_ == &e);
+ assert(root.__right_ == 0);
+ assert(root.__is_black_ == false);
+
+ assert(e.__parent_ == &root);
+ assert(e.__left_ == &c);
+ assert(e.__right_ == &g);
+ assert(e.__is_black_ == true);
+
+ assert(c.__parent_ == &e);
+ assert(c.__left_ == &b);
+ assert(c.__right_ == &d);
+ assert(c.__is_black_ == false);
+
+ assert(g.__parent_ == &e);
+ assert(g.__left_ == &f);
+ assert(g.__right_ == 0);
+ assert(g.__is_black_ == true);
+
+ assert(b.__parent_ == &c);
+ assert(b.__left_ == &a);
+ assert(b.__right_ == 0);
+ assert(b.__is_black_ == true);
+
+ assert(a.__parent_ == &b);
+ assert(a.__left_ == 0);
+ assert(a.__right_ == 0);
+ assert(a.__is_black_ == false);
+
+ assert(d.__parent_ == &c);
+ assert(d.__left_ == 0);
+ assert(d.__right_ == 0);
+ assert(d.__is_black_ == true);
+
+ assert(f.__parent_ == &g);
+ assert(f.__left_ == 0);
+ assert(f.__right_ == 0);
+ assert(f.__is_black_ == false);
+
+ std::__tree_remove(root.__left_, &g);
+
+ assert(std::__tree_invariant(root.__left_));
+
+ assert(root.__parent_ == 0);
+ assert(root.__left_ == &e);
+ assert(root.__right_ == 0);
+ assert(root.__is_black_ == false);
+
+ assert(e.__parent_ == &root);
+ assert(e.__left_ == &c);
+ assert(e.__right_ == &f);
+ assert(e.__is_black_ == true);
+
+ assert(c.__parent_ == &e);
+ assert(c.__left_ == &b);
+ assert(c.__right_ == &d);
+ assert(c.__is_black_ == false);
+
+ assert(b.__parent_ == &c);
+ assert(b.__left_ == &a);
+ assert(b.__right_ == 0);
+ assert(b.__is_black_ == true);
+
+ assert(a.__parent_ == &b);
+ assert(a.__left_ == 0);
+ assert(a.__right_ == 0);
+ assert(a.__is_black_ == false);
+
+ assert(d.__parent_ == &c);
+ assert(d.__left_ == 0);
+ assert(d.__right_ == 0);
+ assert(d.__is_black_ == true);
+
+ assert(f.__parent_ == &e);
+ assert(f.__left_ == 0);
+ assert(f.__right_ == 0);
+ assert(f.__is_black_ == true);
+
+ std::__tree_remove(root.__left_, &f);
+
+ assert(std::__tree_invariant(root.__left_));
+
+ assert(root.__parent_ == 0);
+ assert(root.__left_ == &c);
+ assert(root.__right_ == 0);
+ assert(root.__is_black_ == false);
+
+ assert(c.__parent_ == &root);
+ assert(c.__left_ == &b);
+ assert(c.__right_ == &e);
+ assert(c.__is_black_ == true);
+
+ assert(b.__parent_ == &c);
+ assert(b.__left_ == &a);
+ assert(b.__right_ == 0);
+ assert(b.__is_black_ == true);
+
+ assert(e.__parent_ == &c);
+ assert(e.__left_ == &d);
+ assert(e.__right_ == 0);
+ assert(e.__is_black_ == true);
+
+ assert(a.__parent_ == &b);
+ assert(a.__left_ == 0);
+ assert(a.__right_ == 0);
+ assert(a.__is_black_ == false);
+
+ assert(d.__parent_ == &e);
+ assert(d.__left_ == 0);
+ assert(d.__right_ == 0);
+ assert(d.__is_black_ == false);
+
+ std::__tree_remove(root.__left_, &e);
+
+ assert(std::__tree_invariant(root.__left_));
+
+ assert(root.__parent_ == 0);
+ assert(root.__left_ == &c);
+ assert(root.__right_ == 0);
+ assert(root.__is_black_ == false);
+
+ assert(c.__parent_ == &root);
+ assert(c.__left_ == &b);
+ assert(c.__right_ == &d);
+ assert(c.__is_black_ == true);
+
+ assert(b.__parent_ == &c);
+ assert(b.__left_ == &a);
+ assert(b.__right_ == 0);
+ assert(b.__is_black_ == true);
+
+ assert(a.__parent_ == &b);
+ assert(a.__left_ == 0);
+ assert(a.__right_ == 0);
+ assert(a.__is_black_ == false);
+
+ assert(d.__parent_ == &c);
+ assert(d.__left_ == 0);
+ assert(d.__right_ == 0);
+ assert(d.__is_black_ == true);
+
+ std::__tree_remove(root.__left_, &d);
+
+ assert(std::__tree_invariant(root.__left_));
+
+ assert(root.__parent_ == 0);
+ assert(root.__left_ == &b);
+ assert(root.__right_ == 0);
+ assert(root.__is_black_ == false);
+
+ assert(b.__parent_ == &root);
+ assert(b.__left_ == &a);
+ assert(b.__right_ == &c);
+ assert(b.__is_black_ == true);
+
+ assert(a.__parent_ == &b);
+ assert(a.__left_ == 0);
+ assert(a.__right_ == 0);
+ assert(a.__is_black_ == true);
+
+ assert(c.__parent_ == &b);
+ assert(c.__left_ == 0);
+ assert(c.__right_ == 0);
+ assert(c.__is_black_ == true);
+
+ std::__tree_remove(root.__left_, &c);
+
+ assert(std::__tree_invariant(root.__left_));
+
+ assert(root.__parent_ == 0);
+ assert(root.__left_ == &b);
+ assert(root.__right_ == 0);
+ assert(root.__is_black_ == false);
+
+ assert(b.__parent_ == &root);
+ assert(b.__left_ == &a);
+ assert(b.__right_ == 0);
+ assert(b.__is_black_ == true);
+
+ assert(a.__parent_ == &b);
+ assert(a.__left_ == 0);
+ assert(a.__right_ == 0);
+ assert(a.__is_black_ == false);
+
+ std::__tree_remove(root.__left_, &b);
+
+ assert(std::__tree_invariant(root.__left_));
+
+ assert(root.__parent_ == 0);
+ assert(root.__left_ == &a);
+ assert(root.__right_ == 0);
+ assert(root.__is_black_ == false);
+
+ assert(a.__parent_ == &root);
+ assert(a.__left_ == 0);
+ assert(a.__right_ == 0);
+ assert(a.__is_black_ == true);
+
+ std::__tree_remove(root.__left_, &a);
+
+ assert(std::__tree_invariant(root.__left_));
+
+ assert(root.__parent_ == 0);
+ assert(root.__left_ == 0);
+ assert(root.__right_ == 0);
+ assert(root.__is_black_ == false);
+}
+
+void test4() {
+ Node root;
+ Node a;
+ Node b;
+ Node c;
+ Node d;
+ Node e;
+ Node f;
+ Node g;
+ Node h;
+
+ root.__left_ = &d;
+
+ d.__parent_ = &root;
+ d.__left_ = &b;
+ d.__right_ = &f;
+ d.__is_black_ = true;
+
+ b.__parent_ = &d;
+ b.__left_ = &a;
+ b.__right_ = &c;
+ b.__is_black_ = false;
+
+ f.__parent_ = &d;
+ f.__left_ = &e;
+ f.__right_ = &g;
+ f.__is_black_ = false;
+
+ a.__parent_ = &b;
+ a.__left_ = 0;
+ a.__right_ = 0;
+ a.__is_black_ = true;
+
+ c.__parent_ = &b;
+ c.__left_ = 0;
+ c.__right_ = 0;
+ c.__is_black_ = true;
+
+ e.__parent_ = &f;
+ e.__left_ = 0;
+ e.__right_ = 0;
+ e.__is_black_ = true;
+
+ g.__parent_ = &f;
+ g.__left_ = 0;
+ g.__right_ = &h;
+ g.__is_black_ = true;
+
+ h.__parent_ = &g;
+ h.__left_ = 0;
+ h.__right_ = 0;
+ h.__is_black_ = false;
+
+ assert(std::__tree_invariant(root.__left_));
+
+ std::__tree_remove(root.__left_, &a);
+
+ assert(std::__tree_invariant(root.__left_));
+
+ assert(root.__parent_ == 0);
+ assert(root.__left_ == &d);
+ assert(root.__right_ == 0);
+ assert(root.__is_black_ == false);
+
+ assert(d.__parent_ == &root);
+ assert(d.__left_ == &b);
+ assert(d.__right_ == &f);
+ assert(d.__is_black_ == true);
+
+ assert(b.__parent_ == &d);
+ assert(b.__left_ == 0);
+ assert(b.__right_ == &c);
+ assert(b.__is_black_ == true);
+
+ assert(f.__parent_ == &d);
+ assert(f.__left_ == &e);
+ assert(f.__right_ == &g);
+ assert(f.__is_black_ == false);
+
+ assert(c.__parent_ == &b);
+ assert(c.__left_ == 0);
+ assert(c.__right_ == 0);
+ assert(c.__is_black_ == false);
+
+ assert(e.__parent_ == &f);
+ assert(e.__left_ == 0);
+ assert(e.__right_ == 0);
+ assert(e.__is_black_ == true);
+
+ assert(g.__parent_ == &f);
+ assert(g.__left_ == 0);
+ assert(g.__right_ == &h);
+ assert(g.__is_black_ == true);
+
+ assert(h.__parent_ == &g);
+ assert(h.__left_ == 0);
+ assert(h.__right_ == 0);
+ assert(h.__is_black_ == false);
+
+ std::__tree_remove(root.__left_, &b);
+
+ assert(std::__tree_invariant(root.__left_));
+
+ assert(root.__parent_ == 0);
+ assert(root.__left_ == &d);
+ assert(root.__right_ == 0);
+ assert(root.__is_black_ == false);
+
+ assert(d.__parent_ == &root);
+ assert(d.__left_ == &c);
+ assert(d.__right_ == &f);
+ assert(d.__is_black_ == true);
+
+ assert(c.__parent_ == &d);
+ assert(c.__left_ == 0);
+ assert(c.__right_ == 0);
+ assert(c.__is_black_ == true);
+
+ assert(f.__parent_ == &d);
+ assert(f.__left_ == &e);
+ assert(f.__right_ == &g);
+ assert(f.__is_black_ == false);
+
+ assert(e.__parent_ == &f);
+ assert(e.__left_ == 0);
+ assert(e.__right_ == 0);
+ assert(e.__is_black_ == true);
+
+ assert(g.__parent_ == &f);
+ assert(g.__left_ == 0);
+ assert(g.__right_ == &h);
+ assert(g.__is_black_ == true);
+
+ assert(h.__parent_ == &g);
+ assert(h.__left_ == 0);
+ assert(h.__right_ == 0);
+ assert(h.__is_black_ == false);
+
+ std::__tree_remove(root.__left_, &c);
+
+ assert(std::__tree_invariant(root.__left_));
+
+ assert(root.__parent_ == 0);
+ assert(root.__left_ == &f);
+ assert(root.__right_ == 0);
+ assert(root.__is_black_ == false);
+
+ assert(f.__parent_ == &root);
+ assert(f.__left_ == &d);
+ assert(f.__right_ == &g);
+ assert(f.__is_black_ == true);
+
+ assert(d.__parent_ == &f);
+ assert(d.__left_ == 0);
+ assert(d.__right_ == &e);
+ assert(d.__is_black_ == true);
+
+ assert(g.__parent_ == &f);
+ assert(g.__left_ == 0);
+ assert(g.__right_ == &h);
+ assert(g.__is_black_ == true);
+
+ assert(e.__parent_ == &d);
+ assert(e.__left_ == 0);
+ assert(e.__right_ == 0);
+ assert(e.__is_black_ == false);
+
+ assert(h.__parent_ == &g);
+ assert(h.__left_ == 0);
+ assert(h.__right_ == 0);
+ assert(h.__is_black_ == false);
+
+ std::__tree_remove(root.__left_, &d);
+
+ assert(std::__tree_invariant(root.__left_));
+
+ assert(root.__parent_ == 0);
+ assert(root.__left_ == &f);
+ assert(root.__right_ == 0);
+ assert(root.__is_black_ == false);
+
+ assert(f.__parent_ == &root);
+ assert(f.__left_ == &e);
+ assert(f.__right_ == &g);
+ assert(f.__is_black_ == true);
+
+ assert(e.__parent_ == &f);
+ assert(e.__left_ == 0);
+ assert(e.__right_ == 0);
+ assert(e.__is_black_ == true);
+
+ assert(g.__parent_ == &f);
+ assert(g.__left_ == 0);
+ assert(g.__right_ == &h);
+ assert(g.__is_black_ == true);
+
+ assert(h.__parent_ == &g);
+ assert(h.__left_ == 0);
+ assert(h.__right_ == 0);
+ assert(h.__is_black_ == false);
+
+ std::__tree_remove(root.__left_, &e);
+
+ assert(std::__tree_invariant(root.__left_));
+
+ assert(root.__parent_ == 0);
+ assert(root.__left_ == &g);
+ assert(root.__right_ == 0);
+ assert(root.__is_black_ == false);
+
+ assert(g.__parent_ == &root);
+ assert(g.__left_ == &f);
+ assert(g.__right_ == &h);
+ assert(g.__is_black_ == true);
+
+ assert(f.__parent_ == &g);
+ assert(f.__left_ == 0);
+ assert(f.__right_ == 0);
+ assert(f.__is_black_ == true);
+
+ assert(h.__parent_ == &g);
+ assert(h.__left_ == 0);
+ assert(h.__right_ == 0);
+ assert(h.__is_black_ == true);
+
+ std::__tree_remove(root.__left_, &f);
+
+ assert(std::__tree_invariant(root.__left_));
+
+ assert(root.__parent_ == 0);
+ assert(root.__left_ == &g);
+ assert(root.__right_ == 0);
+ assert(root.__is_black_ == false);
+
+ assert(g.__parent_ == &root);
+ assert(g.__left_ == 0);
+ assert(g.__right_ == &h);
+ assert(g.__is_black_ == true);
+
+ assert(h.__parent_ == &g);
+ assert(h.__left_ == 0);
+ assert(h.__right_ == 0);
+ assert(h.__is_black_ == false);
+
+ std::__tree_remove(root.__left_, &g);
+
+ assert(std::__tree_invariant(root.__left_));
+
+ assert(root.__parent_ == 0);
+ assert(root.__left_ == &h);
+ assert(root.__right_ == 0);
+ assert(root.__is_black_ == false);
+
+ assert(h.__parent_ == &root);
+ assert(h.__left_ == 0);
+ assert(h.__right_ == 0);
+ assert(h.__is_black_ == true);
+
+ std::__tree_remove(root.__left_, &h);
+
+ assert(std::__tree_invariant(root.__left_));
+
+ assert(root.__parent_ == 0);
+ assert(root.__left_ == 0);
+ assert(root.__right_ == 0);
+ assert(root.__is_black_ == false);
+}
+
+int main(int, char**) {
+ test1();
+ test2();
+ test3();
+ test4();
+
+ return 0;
+}
diff --git a/libcxx/test/libcxx-03/containers/associative/tree_right_rotate.pass.cpp b/libcxx/test/libcxx-03/containers/associative/tree_right_rotate.pass.cpp
new file mode 100644
index 0000000000000..b86446f5be101
--- /dev/null
+++ b/libcxx/test/libcxx-03/containers/associative/tree_right_rotate.pass.cpp
@@ -0,0 +1,100 @@
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// Not a portable test
+
+// Precondition: __x->__left_ != nullptr
+// template <class _NodePtr>
+// void
+// __tree_right_rotate(_NodePtr __x);
+
+// XFAIL: FROZEN-CXX03-HEADERS-FIXME
+
+#include <__tree>
+#include <cassert>
+
+#include "test_macros.h"
+
+struct Node {
+ Node* __left_;
+ Node* __right_;
+ Node* __parent_;
+
+ Node* __parent_unsafe() const { return __parent_; }
+ void __set_parent(Node* x) { __parent_ = x; }
+
+ Node() : __left_(), __right_(), __parent_() {}
+};
+
+void test1() {
+ Node root;
+ Node x;
+ Node y;
+ root.__left_ = &x;
+ x.__left_ = &y;
+ x.__right_ = 0;
+ x.__parent_ = &root;
+ y.__left_ = 0;
+ y.__right_ = 0;
+ y.__parent_ = &x;
+ std::__tree_right_rotate(&x);
+ assert(root.__parent_ == 0);
+ assert(root.__left_ == &y);
+ assert(root.__right_ == 0);
+ assert(y.__parent_ == &root);
+ assert(y.__left_ == 0);
+ assert(y.__right_ == &x);
+ assert(x.__parent_ == &y);
+ assert(x.__left_ == 0);
+ assert(x.__right_ == 0);
+}
+
+void test2() {
+ Node root;
+ Node x;
+ Node y;
+ Node a;
+ Node b;
+ Node c;
+ root.__left_ = &x;
+ x.__left_ = &y;
+ x.__right_ = &c;
+ x.__parent_ = &root;
+ y.__left_ = &a;
+ y.__right_ = &b;
+ y.__parent_ = &x;
+ a.__parent_ = &y;
+ b.__parent_ = &y;
+ c.__parent_ = &x;
+ std::__tree_right_rotate(&x);
+ assert(root.__parent_ == 0);
+ assert(root.__left_ == &y);
+ assert(root.__right_ == 0);
+ assert(y.__parent_ == &root);
+ assert(y.__left_ == &a);
+ assert(y.__right_ == &x);
+ assert(x.__parent_ == &y);
+ assert(x.__left_ == &b);
+ assert(x.__right_ == &c);
+ assert(a.__parent_ == &y);
+ assert(a.__left_ == 0);
+ assert(a.__right_ == 0);
+ assert(b.__parent_ == &x);
+ assert(b.__left_ == 0);
+ assert(b.__right_ == 0);
+ assert(c.__parent_ == &x);
+ assert(c.__left_ == 0);
+ assert(c.__right_ == 0);
+}
+
+int main(int, char**) {
+ test1();
+ test2();
+
+ return 0;
+}
diff --git a/libcxx/test/libcxx-03/containers/associative/unord.map/abi.compile.pass.cpp b/libcxx/test/libcxx-03/containers/associative/unord.map/abi.compile.pass.cpp
new file mode 100644
index 0000000000000..55d42a8d017e1
--- /dev/null
+++ b/libcxx/test/libcxx-03/containers/associative/unord.map/abi.compile.pass.cpp
@@ -0,0 +1,141 @@
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: libcpp-has-abi-fix-unordered-container-size-type, libcpp-abi-no-compressed-pair-padding
+
+// std::unique_ptr is used as an implementation detail of the unordered containers, so the layout of
+// unordered containers changes when bounded unique_ptr is enabled.
+// UNSUPPORTED: libcpp-has-abi-bounded-unique_ptr
+
+// XFAIL: FROZEN-CXX03-HEADERS-FIXME
+
+#include <cstdint>
+#include <unordered_map>
+
+#include "min_allocator.h"
+#include "test_allocator.h"
+#include "test_macros.h"
+
+template <class T>
+class small_pointer {
+ std::uint16_t offset;
+};
+
+template <class T>
+class small_iter_allocator {
+public:
+ using value_type = T;
+ using pointer = small_pointer<T>;
+ using size_type = std::uint16_t;
+ using difference_type = std::int16_t;
+
+ small_iter_allocator() TEST_NOEXCEPT {}
+
+ template <class U>
+ small_iter_allocator(small_iter_allocator<U>) TEST_NOEXCEPT {}
+
+ T* allocate(std::size_t n);
+ void deallocate(T* p, std::size_t);
+
+ friend bool operator==(small_iter_allocator, small_iter_allocator) { return true; }
+ friend bool operator!=(small_iter_allocator, small_iter_allocator) { return false; }
+};
+
+template <class T>
+class final_small_iter_allocator final {
+public:
+ using value_type = T;
+ using pointer = small_pointer<T>;
+ using size_type = std::uint16_t;
+ using difference_type = std::int16_t;
+
+ final_small_iter_allocator() TEST_NOEXCEPT {}
+
+ template <class U>
+ final_small_iter_allocator(final_small_iter_allocator<U>) TEST_NOEXCEPT {}
+
+ T* allocate(std::size_t n);
+ void deallocate(T* p, std::size_t);
+
+ friend bool operator==(final_small_iter_allocator, final_small_iter_allocator) { return true; }
+ friend bool operator!=(final_small_iter_allocator, final_small_iter_allocator) { return false; }
+};
+
+template <class T, class Alloc>
+using unordered_map_alloc = std::unordered_map<T, T, std::hash<T>, std::equal_to<T>, Alloc>;
+
+#if __SIZE_WIDTH__ == 64
+
+static_assert(sizeof(unordered_map_alloc<int, std::allocator<std::pair<const int, int> > >) == 40, "");
+static_assert(sizeof(unordered_map_alloc<int, min_allocator<std::pair<const int, int> > >) == 40, "");
+static_assert(sizeof(unordered_map_alloc<int, test_allocator<std::pair<const int, int> > >) == 64, "");
+static_assert(sizeof(unordered_map_alloc<int, small_iter_allocator<std::pair<const int, int> > >) == 12, "");
+static_assert(sizeof(unordered_map_alloc<int, final_small_iter_allocator<std::pair<const int, int> > >) == 16, "");
+
+static_assert(sizeof(unordered_map_alloc<char, std::allocator<std::pair<const char, char> > >) == 40, "");
+static_assert(sizeof(unordered_map_alloc<char, min_allocator<std::pair<const char, char> > >) == 40, "");
+static_assert(sizeof(unordered_map_alloc<char, test_allocator<std::pair<const char, char> > >) == 64, "");
+static_assert(sizeof(unordered_map_alloc<char, small_iter_allocator<std::pair<const char, char> > >) == 12, "");
+static_assert(sizeof(unordered_map_alloc<char, final_small_iter_allocator<std::pair<const char, char> > >) == 16, "");
+
+static_assert(TEST_ALIGNOF(unordered_map_alloc<int, std::allocator<std::pair<const int, int> > >) == 8, "");
+static_assert(TEST_ALIGNOF(unordered_map_alloc<int, min_allocator<std::pair<const int, int> > >) == 8, "");
+static_assert(TEST_ALIGNOF(unordered_map_alloc<int, test_allocator<std::pair<const int, int> > >) == 8, "");
+static_assert(TEST_ALIGNOF(unordered_map_alloc<int, small_iter_allocator<std::pair<const int, int> > >) == 4, "");
+static_assert(TEST_ALIGNOF(unordered_map_alloc<int, final_small_iter_allocator<std::pair<const int, int> > >) == 4, "");
+
+static_assert(TEST_ALIGNOF(unordered_map_alloc<char, std::allocator<std::pair<const char, char> > >) == 8, "");
+static_assert(TEST_ALIGNOF(unordered_map_alloc<char, min_allocator<std::pair<const char, char> > >) == 8, "");
+static_assert(TEST_ALIGNOF(unordered_map_alloc<char, test_allocator<std::pair<const char, char> > >) == 8, "");
+static_assert(TEST_ALIGNOF(unordered_map_alloc<char, small_iter_allocator<std::pair<const char, char> > >) == 4, "");
+static_assert(TEST_ALIGNOF(unordered_map_alloc<char, final_small_iter_allocator<std::pair<const char, char> > >) == 4,
+ "");
+
+struct TEST_ALIGNAS(32) AlignedHash {};
+struct UnalignedEqualTo {};
+
+// This part of the ABI has been broken between LLVM 19 and LLVM 20.
+static_assert(sizeof(std::unordered_map<int, int, AlignedHash, UnalignedEqualTo>) == 64, "");
+static_assert(TEST_ALIGNOF(std::unordered_map<int, int, AlignedHash, UnalignedEqualTo>) == 32, "");
+
+#elif __SIZE_WIDTH__ == 32
+
+static_assert(sizeof(unordered_map_alloc<int, std::allocator<std::pair<const int, int> > >) == 20, "");
+static_assert(sizeof(unordered_map_alloc<int, min_allocator<std::pair<const int, int> > >) == 20, "");
+static_assert(sizeof(unordered_map_alloc<int, test_allocator<std::pair<const int, int> > >) == 44, "");
+static_assert(sizeof(unordered_map_alloc<int, small_iter_allocator<std::pair<const int, int> > >) == 12, "");
+static_assert(sizeof(unordered_map_alloc<int, final_small_iter_allocator<std::pair<const int, int> > >) == 16, "");
+
+static_assert(sizeof(unordered_map_alloc<char, std::allocator<std::pair<const char, char> > >) == 20, "");
+static_assert(sizeof(unordered_map_alloc<char, min_allocator<std::pair<const char, char> > >) == 20, "");
+static_assert(sizeof(unordered_map_alloc<char, test_allocator<std::pair<const char, char> > >) == 44, "");
+static_assert(sizeof(unordered_map_alloc<char, small_iter_allocator<std::pair<const char, char> > >) == 12, "");
+static_assert(sizeof(unordered_map_alloc<char, final_small_iter_allocator<std::pair<const char, char> > >) == 16, "");
+
+static_assert(TEST_ALIGNOF(unordered_map_alloc<int, std::allocator<std::pair<const int, int> > >) == 4, "");
+static_assert(TEST_ALIGNOF(unordered_map_alloc<int, min_allocator<std::pair<const int, int> > >) == 4, "");
+static_assert(TEST_ALIGNOF(unordered_map_alloc<int, test_allocator<std::pair<const int, int> > >) == 4, "");
+static_assert(TEST_ALIGNOF(unordered_map_alloc<int, small_iter_allocator<std::pair<const int, int> > >) == 4, "");
+static_assert(TEST_ALIGNOF(unordered_map_alloc<int, final_small_iter_allocator<std::pair<const int, int> > >) == 4, "");
+
+static_assert(TEST_ALIGNOF(unordered_map_alloc<char, std::allocator<std::pair<const char, char> > >) == 4, "");
+static_assert(TEST_ALIGNOF(unordered_map_alloc<char, min_allocator<std::pair<const char, char> > >) == 4, "");
+static_assert(TEST_ALIGNOF(unordered_map_alloc<char, test_allocator<std::pair<const char, char> > >) == 4, "");
+static_assert(TEST_ALIGNOF(unordered_map_alloc<char, small_iter_allocator<std::pair<const char, char> > >) == 4, "");
+static_assert(TEST_ALIGNOF(unordered_map_alloc<char, final_small_iter_allocator<std::pair<const char, char> > >) == 4,
+ "");
+
+struct TEST_ALIGNAS(32) AlignedHash {};
+struct UnalignedEqualTo {};
+
+static_assert(sizeof(std::unordered_map<int, int, AlignedHash, UnalignedEqualTo>) == 64);
+static_assert(TEST_ALIGNOF(std::unordered_map<int, int, AlignedHash, UnalignedEqualTo>) == 32);
+
+#else
+# error std::size_t has an unexpected size
+#endif
diff --git a/libcxx/test/libcxx-03/containers/associative/unord.map/scary.compile.pass.cpp b/libcxx/test/libcxx-03/containers/associative/unord.map/scary.compile.pass.cpp
new file mode 100644
index 0000000000000..db2ef33b6ebf8
--- /dev/null
+++ b/libcxx/test/libcxx-03/containers/associative/unord.map/scary.compile.pass.cpp
@@ -0,0 +1,28 @@
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// <unordered_map>
+
+// class unordered_map
+// class unordered_multimap
+
+// Extension: SCARY/N2913 iterator compatibility between unordered_map and unordered_multimap
+
+#include <unordered_map>
+
+#include "test_macros.h"
+
+void test() {
+ typedef std::unordered_map<int, int> M1;
+ typedef std::unordered_multimap<int, int> M2;
+
+ ASSERT_SAME_TYPE(M1::iterator, M2::iterator);
+ ASSERT_SAME_TYPE(M1::const_iterator, M2::const_iterator);
+ ASSERT_SAME_TYPE(M1::local_iterator, M2::local_iterator);
+ ASSERT_SAME_TYPE(M1::const_local_iterator, M2::const_local_iterator);
+}
diff --git a/libcxx/test/libcxx-03/containers/associative/unord.set/abi.compile.pass.cpp b/libcxx/test/libcxx-03/containers/associative/unord.set/abi.compile.pass.cpp
new file mode 100644
index 0000000000000..bee2012bbea29
--- /dev/null
+++ b/libcxx/test/libcxx-03/containers/associative/unord.set/abi.compile.pass.cpp
@@ -0,0 +1,139 @@
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: libcpp-has-abi-fix-unordered-container-size-type, libcpp-abi-no-compressed-pair-padding
+
+// std::unique_ptr is used as an implementation detail of the unordered containers, so the layout of
+// unordered containers changes when bounded unique_ptr is enabled.
+// UNSUPPORTED: libcpp-has-abi-bounded-unique_ptr
+
+// XFAIL: FROZEN-CXX03-HEADERS-FIXME
+
+#include <cstdint>
+#include <unordered_set>
+
+#include "min_allocator.h"
+#include "test_allocator.h"
+#include "test_macros.h"
+
+template <class T>
+class small_pointer {
+ std::uint16_t offset;
+};
+
+template <class T>
+class small_iter_allocator {
+public:
+ using value_type = T;
+ using pointer = small_pointer<T>;
+ using size_type = std::uint16_t;
+ using difference_type = std::int16_t;
+
+ small_iter_allocator() TEST_NOEXCEPT {}
+
+ template <class U>
+ small_iter_allocator(small_iter_allocator<U>) TEST_NOEXCEPT {}
+
+ T* allocate(std::size_t n);
+ void deallocate(T* p, std::size_t);
+
+ friend bool operator==(small_iter_allocator, small_iter_allocator) { return true; }
+ friend bool operator!=(small_iter_allocator, small_iter_allocator) { return false; }
+};
+
+template <class T>
+class final_small_iter_allocator final {
+public:
+ using value_type = T;
+ using pointer = small_pointer<T>;
+ using size_type = std::uint16_t;
+ using difference_type = std::int16_t;
+
+ final_small_iter_allocator() TEST_NOEXCEPT {}
+
+ template <class U>
+ final_small_iter_allocator(final_small_iter_allocator<U>) TEST_NOEXCEPT {}
+
+ T* allocate(std::size_t n);
+ void deallocate(T* p, std::size_t);
+
+ friend bool operator==(final_small_iter_allocator, final_small_iter_allocator) { return true; }
+ friend bool operator!=(final_small_iter_allocator, final_small_iter_allocator) { return false; }
+};
+
+template <class T, class Alloc>
+using unordered_set_alloc = std::unordered_set<T, std::hash<T>, std::equal_to<T>, Alloc>;
+
+#if __SIZE_WIDTH__ == 64
+
+static_assert(sizeof(unordered_set_alloc<int, std::allocator<int> >) == 40, "");
+static_assert(sizeof(unordered_set_alloc<int, min_allocator<int> >) == 40, "");
+static_assert(sizeof(unordered_set_alloc<int, test_allocator<int> >) == 64, "");
+static_assert(sizeof(unordered_set_alloc<int, small_iter_allocator<int> >) == 12, "");
+static_assert(sizeof(unordered_set_alloc<int, final_small_iter_allocator<int> >) == 16, "");
+
+static_assert(sizeof(unordered_set_alloc<char, std::allocator<char> >) == 40, "");
+static_assert(sizeof(unordered_set_alloc<char, min_allocator<char> >) == 40, "");
+static_assert(sizeof(unordered_set_alloc<char, test_allocator<char> >) == 64, "");
+static_assert(sizeof(unordered_set_alloc<char, small_iter_allocator<char> >) == 12, "");
+static_assert(sizeof(unordered_set_alloc<char, final_small_iter_allocator<char> >) == 16, "");
+
+static_assert(TEST_ALIGNOF(unordered_set_alloc<int, std::allocator<int> >) == 8, "");
+static_assert(TEST_ALIGNOF(unordered_set_alloc<int, min_allocator<int> >) == 8, "");
+static_assert(TEST_ALIGNOF(unordered_set_alloc<int, test_allocator<int> >) == 8, "");
+static_assert(TEST_ALIGNOF(unordered_set_alloc<int, small_iter_allocator<int> >) == 4, "");
+static_assert(TEST_ALIGNOF(unordered_set_alloc<int, final_small_iter_allocator<int> >) == 4, "");
+
+static_assert(TEST_ALIGNOF(unordered_set_alloc<char, std::allocator<char> >) == 8, "");
+static_assert(TEST_ALIGNOF(unordered_set_alloc<char, min_allocator<char> >) == 8, "");
+static_assert(TEST_ALIGNOF(unordered_set_alloc<char, test_allocator<char> >) == 8, "");
+static_assert(TEST_ALIGNOF(unordered_set_alloc<char, small_iter_allocator<char> >) == 4, "");
+static_assert(TEST_ALIGNOF(unordered_set_alloc<char, final_small_iter_allocator<char> >) == 4, "");
+
+struct TEST_ALIGNAS(32) AlignedHash {};
+struct UnalignedEqualTo {};
+
+// This part of the ABI has been broken between LLVM 19 and LLVM 20.
+static_assert(sizeof(std::unordered_set<int, AlignedHash, UnalignedEqualTo>) == 64, "");
+static_assert(TEST_ALIGNOF(std::unordered_set<int, AlignedHash, UnalignedEqualTo>) == 32, "");
+
+#elif __SIZE_WIDTH__ == 32
+
+static_assert(sizeof(unordered_set_alloc<int, std::allocator<int> >) == 20, "");
+static_assert(sizeof(unordered_set_alloc<int, min_allocator<int> >) == 20, "");
+static_assert(sizeof(unordered_set_alloc<int, test_allocator<int> >) == 44, "");
+static_assert(sizeof(unordered_set_alloc<int, small_iter_allocator<int> >) == 12, "");
+static_assert(sizeof(unordered_set_alloc<int, final_small_iter_allocator<int> >) == 16, "");
+
+static_assert(sizeof(unordered_set_alloc<char, std::allocator<char> >) == 20, "");
+static_assert(sizeof(unordered_set_alloc<char, min_allocator<char> >) == 20, "");
+static_assert(sizeof(unordered_set_alloc<char, test_allocator<char> >) == 44, "");
+static_assert(sizeof(unordered_set_alloc<char, small_iter_allocator<char> >) == 12, "");
+static_assert(sizeof(unordered_set_alloc<char, final_small_iter_allocator<char> >) == 16, "");
+
+static_assert(TEST_ALIGNOF(unordered_set_alloc<int, std::allocator<int> >) == 4, "");
+static_assert(TEST_ALIGNOF(unordered_set_alloc<int, min_allocator<int> >) == 4, "");
+static_assert(TEST_ALIGNOF(unordered_set_alloc<int, test_allocator<int> >) == 4, "");
+static_assert(TEST_ALIGNOF(unordered_set_alloc<int, small_iter_allocator<int> >) == 4, "");
+static_assert(TEST_ALIGNOF(unordered_set_alloc<int, final_small_iter_allocator<int> >) == 4, "");
+
+static_assert(TEST_ALIGNOF(unordered_set_alloc<char, std::allocator<char> >) == 4, "");
+static_assert(TEST_ALIGNOF(unordered_set_alloc<char, min_allocator<char> >) == 4, "");
+static_assert(TEST_ALIGNOF(unordered_set_alloc<char, test_allocator<char> >) == 4, "");
+static_assert(TEST_ALIGNOF(unordered_set_alloc<char, small_iter_allocator<char> >) == 4, "");
+static_assert(TEST_ALIGNOF(unordered_set_alloc<char, final_small_iter_allocator<char> >) == 4, "");
+
+struct TEST_ALIGNAS(32) AlignedHash {};
+struct UnalignedEqualTo {};
+
+static_assert(sizeof(std::unordered_set<int, AlignedHash, UnalignedEqualTo>) == 64);
+static_assert(TEST_ALIGNOF(std::unordered_set<int, AlignedHash, UnalignedEqualTo>) == 32);
+
+#else
+# error std::size_t has an unexpected size
+#endif
diff --git a/libcxx/test/libcxx-03/containers/associative/unord.set/scary.compile.pass.cpp b/libcxx/test/libcxx-03/containers/associative/unord.set/scary.compile.pass.cpp
new file mode 100644
index 0000000000000..cd33e1a91ec16
--- /dev/null
+++ b/libcxx/test/libcxx-03/containers/associative/unord.set/scary.compile.pass.cpp
@@ -0,0 +1,28 @@
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// <unordered_set>
+
+// class unordered_set
+// class unordered_multiset
+
+// Extension: SCARY/N2913 iterator compatibility between unordered_set and unordered_multiset
+
+#include <unordered_set>
+
+#include "test_macros.h"
+
+void test() {
+ typedef std::unordered_set<int> M1;
+ typedef std::unordered_multiset<int> M2;
+
+ ASSERT_SAME_TYPE(M1::iterator, M2::iterator);
+ ASSERT_SAME_TYPE(M1::const_iterator, M2::const_iterator);
+ ASSERT_SAME_TYPE(M1::local_iterator, M2::local_iterator);
+ ASSERT_SAME_TYPE(M1::const_local_iterator, M2::const_local_iterator);
+}
diff --git a/libcxx/test/libcxx-03/containers/container_traits.compile.pass.cpp b/libcxx/test/libcxx-03/containers/container_traits.compile.pass.cpp
new file mode 100644
index 0000000000000..22be217487951
--- /dev/null
+++ b/libcxx/test/libcxx-03/containers/container_traits.compile.pass.cpp
@@ -0,0 +1,165 @@
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+//
+// <__type_traits/container_traits.h>
+//
+
+// XFAIL: FROZEN-CXX03-HEADERS-FIXME
+
+#include <__type_traits/container_traits.h>
+
+#include <deque>
+#include <forward_list>
+#include <list>
+#include <vector>
+#include <map>
+#include <set>
+#include <unordered_map>
+#include <unordered_set>
+
+#include "test_allocator.h"
+#include "test_macros.h"
+#include "MoveOnly.h"
+
+struct ThrowOnMove {
+ ThrowOnMove();
+ ThrowOnMove(const ThrowOnMove&) TEST_NOEXCEPT_COND(false);
+ ThrowOnMove(ThrowOnMove&&) TEST_NOEXCEPT_COND(false);
+ ThrowOnMove& operator=(ThrowOnMove&&) TEST_NOEXCEPT_COND(false);
+ ThrowOnMove& operator=(const ThrowOnMove&) TEST_NOEXCEPT_COND(false);
+
+ bool operator<(ThrowOnMove const&) const;
+ bool operator==(ThrowOnMove const&) const;
+};
+
+struct NonCopyThrowOnMove {
+ NonCopyThrowOnMove();
+ NonCopyThrowOnMove(NonCopyThrowOnMove&&) TEST_NOEXCEPT_COND(false);
+ NonCopyThrowOnMove(const NonCopyThrowOnMove&) = delete;
+ NonCopyThrowOnMove& operator=(NonCopyThrowOnMove&&) TEST_NOEXCEPT_COND(false);
+ NonCopyThrowOnMove& operator=(const NonCopyThrowOnMove&) = delete;
+
+ bool operator<(NonCopyThrowOnMove const&) const;
+ bool operator==(NonCopyThrowOnMove const&) const;
+};
+
+struct ThrowingHash {
+ template <class T>
+ std::size_t operator()(const T&) const TEST_NOEXCEPT_COND(false);
+};
+
+struct NoThrowHash {
+ template <class T>
+ std::size_t operator()(const T&) const TEST_NOEXCEPT;
+};
+
+template <bool Expected, class Container>
+void check() {
+ static_assert(
+ std::__container_traits<Container>::__emplacement_has_strong_exception_safety_guarantee == Expected, "");
+}
+
+void test() {
+ check<true, std::list<int> >();
+ check<true, std::list<int, test_allocator<int> > >();
+ check<true, std::list<MoveOnly> >();
+ check<true, std::list<ThrowOnMove> >();
+ check<true, std::list<NonCopyThrowOnMove> >();
+
+ check<true, std::forward_list<int> >();
+ check<true, std::forward_list<int, test_allocator<int> > >();
+ check<true, std::forward_list<MoveOnly> >();
+ check<true, std::forward_list<ThrowOnMove> >();
+ check<true, std::forward_list<NonCopyThrowOnMove> >();
+
+ check<true, std::deque<int> >();
+ check<true, std::deque<int, test_allocator<int> > >();
+ check<true, std::deque<MoveOnly> >();
+ check<true, std::deque<ThrowOnMove> >();
+ check<false, std::deque<NonCopyThrowOnMove> >();
+
+ check<true, std::vector<int> >();
+ check<true, std::vector<int, test_allocator<int> > >();
+ check<true, std::vector<MoveOnly> >();
+ check<true, std::vector<ThrowOnMove> >();
+ check<false, std::vector<NonCopyThrowOnMove> >();
+
+ check<true, std::set<int> >();
+ check<true, std::set<int, std::less<int>, test_allocator<int> > >();
+ check<true, std::set<MoveOnly> >();
+ check<true, std::set<ThrowOnMove> >();
+ check<true, std::set<NonCopyThrowOnMove> >();
+
+ check<true, std::multiset<int> >();
+ check<true, std::multiset<int, std::less<int>, test_allocator<int> > >();
+ check<true, std::multiset<MoveOnly> >();
+ check<true, std::multiset<ThrowOnMove> >();
+ check<true, std::multiset<NonCopyThrowOnMove> >();
+
+ check<true, std::map<int, int> >();
+ check<true, std::map<int, int, std::less<int>, test_allocator<int> > >();
+ check<true, std::map<MoveOnly, MoveOnly> >();
+ check<true, std::map<ThrowOnMove, ThrowOnMove> >();
+ check<true, std::map<NonCopyThrowOnMove, NonCopyThrowOnMove> >();
+
+ check<true, std::multimap<int, int> >();
+ check<true, std::multimap<int, int, std::less<int>, test_allocator<int> > >();
+ check<true, std::multimap<MoveOnly, MoveOnly> >();
+ check<true, std::multimap<ThrowOnMove, ThrowOnMove> >();
+ check<true, std::multimap<NonCopyThrowOnMove, NonCopyThrowOnMove> >();
+
+#if TEST_STD_VER < 11
+ check<false, std::unordered_set<int> >();
+ check<false, std::unordered_set<int, std::hash<int>, std::less<int>, test_allocator<int> > >();
+ check<false, std::unordered_set<MoveOnly> >();
+ check<false, std::unordered_set<MoveOnly, NoThrowHash> >();
+ check<false, std::unordered_set<MoveOnly, ThrowingHash> >();
+
+ check<false, std::unordered_multiset<int> >();
+ check<false, std::unordered_multiset<int, std::hash<int>, std::less<int>, test_allocator<int> > >();
+ check<false, std::unordered_multiset<MoveOnly> >();
+ check<false, std::unordered_multiset<MoveOnly, NoThrowHash> >();
+ check<false, std::unordered_multiset<MoveOnly, ThrowingHash> >();
+
+ check<false, std::unordered_map<int, int> >();
+ check<false, std::unordered_map<int, int, std::hash<int>, std::less<int>, test_allocator<int> > >();
+ check<false, std::unordered_map<MoveOnly, MoveOnly> >();
+ check<false, std::unordered_map<MoveOnly, MoveOnly, NoThrowHash> >();
+ check<false, std::unordered_map<MoveOnly, MoveOnly, ThrowingHash> >();
+
+ check<false, std::unordered_multimap<int, int> >();
+ check<false, std::unordered_multimap<int, int, std::hash<int>, std::less<int>, test_allocator<int> > >();
+ check<false, std::unordered_multimap<MoveOnly, MoveOnly> >();
+ check<false, std::unordered_multimap<MoveOnly, MoveOnly, NoThrowHash> >();
+ check<false, std::unordered_multimap<MoveOnly, MoveOnly, ThrowingHash> >();
+#else
+ check<true, std::unordered_set<int> >();
+ check<true, std::unordered_set<int, std::hash<int>, std::less<int>, test_allocator<int> > >();
+ check<false, std::unordered_set<MoveOnly> >();
+ check<true, std::unordered_set<MoveOnly, NoThrowHash> >();
+ check<false, std::unordered_set<MoveOnly, ThrowingHash> >();
+
+ check<true, std::unordered_multiset<int> >();
+ check<true, std::unordered_multiset<int, std::hash<int>, std::less<int>, test_allocator<int> > >();
+ check<false, std::unordered_multiset<MoveOnly> >();
+ check<true, std::unordered_multiset<MoveOnly, NoThrowHash> >();
+ check<false, std::unordered_multiset<MoveOnly, ThrowingHash> >();
+
+ check<true, std::unordered_map<int, int> >();
+ check<true, std::unordered_map<int, int, std::hash<int>, std::less<int>, test_allocator<int> > >();
+ check<false, std::unordered_map<MoveOnly, MoveOnly> >();
+ check<true, std::unordered_map<MoveOnly, MoveOnly, NoThrowHash> >();
+ check<false, std::unordered_map<MoveOnly, MoveOnly, ThrowingHash> >();
+
+ check<true, std::unordered_multimap<int, int> >();
+ check<true, std::unordered_multimap<int, int, std::hash<int>, std::less<int>, test_allocator<int> > >();
+ check<false, std::unordered_multimap<MoveOnly, MoveOnly> >();
+ check<true, std::unordered_multimap<MoveOnly, MoveOnly, NoThrowHash> >();
+ check<false, std::unordered_multimap<MoveOnly, MoveOnly, ThrowingHash> >();
+#endif
+}
diff --git a/libcxx/test/libcxx-03/containers/gnu_cxx/hash_map.pass.cpp b/libcxx/test/libcxx-03/containers/gnu_cxx/hash_map.pass.cpp
new file mode 100644
index 0000000000000..a8988f73891a0
--- /dev/null
+++ b/libcxx/test/libcxx-03/containers/gnu_cxx/hash_map.pass.cpp
@@ -0,0 +1,36 @@
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: clang-modules-build
+
+// Prevent <ext/hash_map> from generating deprecated warnings for this test.
+// ADDITIONAL_COMPILE_FLAGS: -Wno-deprecated
+
+#include <ext/hash_map>
+#include <cassert>
+
+#include "test_macros.h"
+#include "count_new.h"
+
+void test_default_does_not_allocate() {
+ DisableAllocationGuard g;
+ ((void)g);
+ {
+ __gnu_cxx::hash_map<int, int> h;
+ assert(h.bucket_count() == 0);
+ }
+ {
+ __gnu_cxx::hash_multimap<int, int> h;
+ assert(h.bucket_count() == 0);
+ }
+}
+
+int main(int, char**) {
+ test_default_does_not_allocate();
+ return 0;
+}
diff --git a/libcxx/test/libcxx-03/containers/gnu_cxx/hash_map_name_lookup.pass.cpp b/libcxx/test/libcxx-03/containers/gnu_cxx/hash_map_name_lookup.pass.cpp
new file mode 100644
index 0000000000000..7e87330ef855d
--- /dev/null
+++ b/libcxx/test/libcxx-03/containers/gnu_cxx/hash_map_name_lookup.pass.cpp
@@ -0,0 +1,36 @@
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: clang-modules-build
+
+// Poison the std:: names we might use inside __gnu_cxx to ensure they're
+// properly qualified.
+struct allocator;
+struct pair;
+struct equal_to;
+struct unique_ptr;
+
+// Prevent <ext/hash_map> from generating deprecated warnings for this test.
+// ADDITIONAL_COMPILE_FLAGS: -Wno-deprecated
+
+#include <ext/hash_map>
+
+#include "test_macros.h"
+
+namespace __gnu_cxx {
+template class hash_map<int, int>;
+}
+
+int main(int, char**) {
+ typedef __gnu_cxx::hash_map<int, int> Map;
+ Map m;
+ Map m2(m);
+ ((void)m2);
+
+ return 0;
+}
diff --git a/libcxx/test/libcxx-03/containers/gnu_cxx/hash_set.pass.cpp b/libcxx/test/libcxx-03/containers/gnu_cxx/hash_set.pass.cpp
new file mode 100644
index 0000000000000..c325914bd4221
--- /dev/null
+++ b/libcxx/test/libcxx-03/containers/gnu_cxx/hash_set.pass.cpp
@@ -0,0 +1,36 @@
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: clang-modules-build
+
+// Prevent <ext/hash_set> from generating deprecated warnings for this test.
+// ADDITIONAL_COMPILE_FLAGS: -Wno-deprecated
+
+#include <ext/hash_set>
+#include <cassert>
+
+#include "test_macros.h"
+#include "count_new.h"
+
+void test_default_does_not_allocate() {
+ DisableAllocationGuard g;
+ ((void)g);
+ {
+ __gnu_cxx::hash_set<int> h;
+ assert(h.bucket_count() == 0);
+ }
+ {
+ __gnu_cxx::hash_multiset<int> h;
+ assert(h.bucket_count() == 0);
+ }
+}
+
+int main(int, char**) {
+ test_default_does_not_allocate();
+ return 0;
+}
diff --git a/libcxx/test/libcxx-03/containers/gnu_cxx/hash_set_name_lookup.pass.cpp b/libcxx/test/libcxx-03/containers/gnu_cxx/hash_set_name_lookup.pass.cpp
new file mode 100644
index 0000000000000..c5f64a4b820d5
--- /dev/null
+++ b/libcxx/test/libcxx-03/containers/gnu_cxx/hash_set_name_lookup.pass.cpp
@@ -0,0 +1,36 @@
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: clang-modules-build
+
+// Poison the std:: names we might use inside __gnu_cxx to ensure they're
+// properly qualified.
+struct allocator;
+struct pair;
+struct equal_to;
+struct unique_ptr;
+
+// Prevent <ext/hash_set> from generating deprecated warnings for this test.
+// ADDITIONAL_COMPILE_FLAGS: -Wno-deprecated
+
+#include <ext/hash_set>
+
+#include "test_macros.h"
+
+namespace __gnu_cxx {
+template class hash_set<int>;
+}
+
+int main(int, char**) {
+ typedef __gnu_cxx::hash_set<int> Set;
+ Set s;
+ Set s2(s);
+ ((void)s2);
+
+ return 0;
+}
diff --git a/libcxx/test/libcxx-03/containers/sequences/array/triviality.pass.cpp b/libcxx/test/libcxx-03/containers/sequences/array/triviality.pass.cpp
new file mode 100644
index 0000000000000..8b0f5a391eb32
--- /dev/null
+++ b/libcxx/test/libcxx-03/containers/sequences/array/triviality.pass.cpp
@@ -0,0 +1,51 @@
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// Make sure std::array<T, N> is trivially copyable whenever T is trivially copyable.
+// This is not technically mandated by the Standard, but libc++ has been providing
+// this property.
+
+#include <array>
+#include <type_traits>
+
+struct Empty {};
+
+struct TrivialCopy {
+ int i;
+ double j;
+};
+
+struct NonTrivialCopy {
+ NonTrivialCopy(NonTrivialCopy const&) {}
+ NonTrivialCopy& operator=(NonTrivialCopy const&) { return *this; }
+};
+
+template <typename T>
+void check_trivially_copyable() {
+ static_assert(std::is_trivially_copyable<std::array<T, 0> >::value, "");
+ static_assert(std::is_trivially_copyable<std::array<T, 1> >::value, "");
+ static_assert(std::is_trivially_copyable<std::array<T, 2> >::value, "");
+ static_assert(std::is_trivially_copyable<std::array<T, 3> >::value, "");
+}
+
+int main(int, char**) {
+ check_trivially_copyable<int>();
+ check_trivially_copyable<long>();
+ check_trivially_copyable<double>();
+ check_trivially_copyable<long double>();
+ check_trivially_copyable<Empty>();
+ check_trivially_copyable<TrivialCopy>();
+
+ // Check that std::array<T, 0> is still trivially copyable when T is not
+ static_assert(std::is_trivially_copyable<std::array<NonTrivialCopy, 0> >::value, "");
+ static_assert(!std::is_trivially_copyable<std::array<NonTrivialCopy, 1> >::value, "");
+ static_assert(!std::is_trivially_copyable<std::array<NonTrivialCopy, 2> >::value, "");
+ static_assert(!std::is_trivially_copyable<std::array<NonTrivialCopy, 3> >::value, "");
+
+ return 0;
+}
diff --git a/libcxx/test/libcxx-03/containers/sequences/deque/abi.compile.pass.cpp b/libcxx/test/libcxx-03/containers/sequences/deque/abi.compile.pass.cpp
new file mode 100644
index 0000000000000..30586d8b2422c
--- /dev/null
+++ b/libcxx/test/libcxx-03/containers/sequences/deque/abi.compile.pass.cpp
@@ -0,0 +1,117 @@
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: libcpp-abi-no-compressed-pair-padding
+
+#include <cstdint>
+#include <deque>
+
+#include "min_allocator.h"
+#include "test_allocator.h"
+#include "test_macros.h"
+
+template <class T>
+class small_pointer {
+ std::uint16_t offset;
+};
+
+template <class T>
+class small_iter_allocator {
+public:
+ using value_type = T;
+ using pointer = small_pointer<T>;
+ using size_type = std::uint16_t;
+ using difference_type = std::int16_t;
+
+ small_iter_allocator() TEST_NOEXCEPT {}
+
+ template <class U>
+ small_iter_allocator(small_iter_allocator<U>) TEST_NOEXCEPT {}
+
+ T* allocate(std::size_t n);
+ void deallocate(T* p, std::size_t);
+
+ friend bool operator==(small_iter_allocator, small_iter_allocator) { return true; }
+ friend bool operator!=(small_iter_allocator, small_iter_allocator) { return false; }
+};
+
+template <class T>
+class final_small_iter_allocator final {
+public:
+ using value_type = T;
+ using pointer = small_pointer<T>;
+ using size_type = std::uint16_t;
+ using difference_type = std::int16_t;
+
+ final_small_iter_allocator() TEST_NOEXCEPT {}
+
+ template <class U>
+ final_small_iter_allocator(final_small_iter_allocator<U>) TEST_NOEXCEPT {}
+
+ T* allocate(std::size_t n);
+ void deallocate(T* p, std::size_t);
+
+ friend bool operator==(final_small_iter_allocator, final_small_iter_allocator) { return true; }
+ friend bool operator!=(final_small_iter_allocator, final_small_iter_allocator) { return false; }
+};
+
+#if __SIZE_WIDTH__ == 64
+
+static_assert(sizeof(std::deque<int>) == 48, "");
+static_assert(sizeof(std::deque<int, min_allocator<int> >) == 48, "");
+static_assert(sizeof(std::deque<int, test_allocator<int> >) == 80, "");
+static_assert(sizeof(std::deque<int, small_iter_allocator<int> >) == 12, "");
+static_assert(sizeof(std::deque<int, final_small_iter_allocator<int> >) == 16, "");
+
+static_assert(sizeof(std::deque<char>) == 48, "");
+static_assert(sizeof(std::deque<char, min_allocator<char> >) == 48, "");
+static_assert(sizeof(std::deque<char, test_allocator<char> >) == 80, "");
+static_assert(sizeof(std::deque<char, small_iter_allocator<char> >) == 12, "");
+static_assert(sizeof(std::deque<char, final_small_iter_allocator<char> >) == 16, "");
+
+static_assert(TEST_ALIGNOF(std::deque<int>) == 8, "");
+static_assert(TEST_ALIGNOF(std::deque<int, min_allocator<int> >) == 8, "");
+static_assert(TEST_ALIGNOF(std::deque<int, test_allocator<int> >) == 8, "");
+static_assert(TEST_ALIGNOF(std::deque<int, small_iter_allocator<int> >) == 2, "");
+static_assert(TEST_ALIGNOF(std::deque<int, final_small_iter_allocator<int> >) == 2, "");
+
+static_assert(TEST_ALIGNOF(std::deque<char>) == 8, "");
+static_assert(TEST_ALIGNOF(std::deque<char, min_allocator<char> >) == 8, "");
+static_assert(TEST_ALIGNOF(std::deque<char, test_allocator<char> >) == 8, "");
+static_assert(TEST_ALIGNOF(std::deque<char, small_iter_allocator<char> >) == 2, "");
+static_assert(TEST_ALIGNOF(std::deque<char, final_small_iter_allocator<char> >) == 2, "");
+
+#elif __SIZE_WIDTH__ == 32
+
+static_assert(sizeof(std::deque<int>) == 24, "");
+static_assert(sizeof(std::deque<int, min_allocator<int> >) == 24, "");
+static_assert(sizeof(std::deque<int, test_allocator<int> >) == 48, "");
+static_assert(sizeof(std::deque<int, small_iter_allocator<int> >) == 12, "");
+static_assert(sizeof(std::deque<int, final_small_iter_allocator<int> >) == 16, "");
+
+static_assert(sizeof(std::deque<char>) == 24, "");
+static_assert(sizeof(std::deque<char, min_allocator<char> >) == 24, "");
+static_assert(sizeof(std::deque<char, test_allocator<char> >) == 48, "");
+static_assert(sizeof(std::deque<char, small_iter_allocator<char> >) == 12, "");
+static_assert(sizeof(std::deque<char, final_small_iter_allocator<char> >) == 16, "");
+
+static_assert(TEST_ALIGNOF(std::deque<int>) == 4, "");
+static_assert(TEST_ALIGNOF(std::deque<int, min_allocator<int> >) == 4, "");
+static_assert(TEST_ALIGNOF(std::deque<int, test_allocator<int> >) == 4, "");
+static_assert(TEST_ALIGNOF(std::deque<int, small_iter_allocator<int> >) == 2, "");
+static_assert(TEST_ALIGNOF(std::deque<int, final_small_iter_allocator<int> >) == 2, "");
+
+static_assert(TEST_ALIGNOF(std::deque<char>) == 4, "");
+static_assert(TEST_ALIGNOF(std::deque<char, min_allocator<char> >) == 4, "");
+static_assert(TEST_ALIGNOF(std::deque<char, test_allocator<char> >) == 4, "");
+static_assert(TEST_ALIGNOF(std::deque<char, small_iter_allocator<char> >) == 2, "");
+static_assert(TEST_ALIGNOF(std::deque<char, final_small_iter_allocator<char> >) == 2, "");
+
+#else
+# error std::size_t has an unexpected size
+#endif
diff --git a/libcxx/test/libcxx-03/containers/sequences/deque/asan.pass.cpp b/libcxx/test/libcxx-03/containers/sequences/deque/asan.pass.cpp
new file mode 100644
index 0000000000000..46ca62dda7b20
--- /dev/null
+++ b/libcxx/test/libcxx-03/containers/sequences/deque/asan.pass.cpp
@@ -0,0 +1,68 @@
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// REQUIRES: asan
+
+// <deque>
+
+// reference operator[](size_type n);
+
+#include "asan_testing.h"
+#include <deque>
+#include <cassert>
+#include <cstdlib>
+
+#include "min_allocator.h"
+#include "test_iterators.h"
+#include "test_macros.h"
+
+extern "C" void __sanitizer_set_death_callback(void (*callback)(void));
+
+void do_exit() { exit(0); }
+
+int main(int, char**) {
+ {
+ typedef cpp17_input_iterator<int*> MyInputIter;
+ // Should not trigger ASan.
+ std::deque<int> v;
+ int i[] = {42};
+ v.insert(v.begin(), MyInputIter(i), MyInputIter(i + 1));
+ assert(v[0] == 42);
+ assert(is_double_ended_contiguous_container_asan_correct(v));
+ }
+ {
+ typedef int T;
+ typedef std::deque<T, min_allocator<T> > C;
+ const T t[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
+ C c(std::begin(t), std::end(t));
+ assert(is_double_ended_contiguous_container_asan_correct(c));
+ }
+ {
+ typedef char T;
+ typedef std::deque<T, safe_allocator<T> > C;
+ const T t[] = {'0', '1', '2', '3', '4', '5', '6', '7', '8', '9'};
+ C c(std::begin(t), std::end(t));
+ c.pop_front();
+ assert(is_double_ended_contiguous_container_asan_correct(c));
+ }
+ __sanitizer_set_death_callback(do_exit);
+ {
+ typedef int T;
+ typedef std::deque<T> C;
+ const T t[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
+ C c(std::begin(t), std::end(t));
+ assert(is_double_ended_contiguous_container_asan_correct(c));
+ T* ptr = &c[0];
+ for (size_t i = 0; i < (8 + sizeof(T) - 1) / sizeof(T); ++i)
+ c.pop_front();
+ *ptr = 1;
+ volatile T foo = c[c.size()]; // should trigger ASAN. Use volatile to prevent being optimized away.
+ assert(false); // if we got here, ASAN didn't trigger
+ ((void)foo);
+ }
+}
diff --git a/libcxx/test/libcxx-03/containers/sequences/deque/asan_caterpillar.pass.cpp b/libcxx/test/libcxx-03/containers/sequences/deque/asan_caterpillar.pass.cpp
new file mode 100644
index 0000000000000..1701b89c72d87
--- /dev/null
+++ b/libcxx/test/libcxx-03/containers/sequences/deque/asan_caterpillar.pass.cpp
@@ -0,0 +1,53 @@
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// <deque>
+
+// Regression test to error in deque::__annotate_from_to in deque,
+// with origin in deque::__add_back_capacity.
+
+// `check_assertion.h` is only available starting from C++11 and requires Unix headers and regex support.
+// REQUIRES: has-unix-headers
+// UNSUPPORTED: c++03, no-localization
+
+#include <deque>
+#include <cstdio>
+#include "check_assertion.h"
+
+void test1() {
+ std::deque<char> test;
+ char buff[100000];
+ test.insert(test.begin(), buff, buff + 64000);
+
+ for (int i = 0; i < 1100; i += 1) {
+ test.insert(test.begin(), buff, buff + 320);
+ test.erase(test.end() - 320, test.end());
+ }
+
+ test.insert(test.begin(), buff, buff + 32000);
+}
+
+void test2() {
+ std::deque<char> test;
+ char buff[100000];
+ test.insert(test.end(), buff, buff + 64000);
+
+ for (int i = 0; i < 1100; i += 1) {
+ test.insert(test.end(), buff, buff + 320);
+ test.erase(test.begin(), test.begin() + 320);
+ }
+
+ test.insert(test.end(), buff, buff + 32000);
+}
+
+int main(int, char**) {
+ test1();
+ test2();
+
+ return 0;
+}
diff --git a/libcxx/test/libcxx-03/containers/sequences/deque/incomplete.pass.cpp b/libcxx/test/libcxx-03/containers/sequences/deque/incomplete.pass.cpp
new file mode 100644
index 0000000000000..ebf5869078331
--- /dev/null
+++ b/libcxx/test/libcxx-03/containers/sequences/deque/incomplete.pass.cpp
@@ -0,0 +1,34 @@
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// <deque>
+
+// deque()
+// deque::iterator()
+
+// ADDITIONAL_COMPILE_FLAGS: -Wno-macro-redefined -D_LIBCPP_ABI_INCOMPLETE_TYPES_IN_DEQUE
+
+#include <deque>
+#include <cassert>
+
+#include "test_macros.h"
+
+struct A {
+ std::deque<A> d;
+ std::deque<A>::iterator it;
+ std::deque<A>::reverse_iterator it2;
+};
+
+int main(int, char**) {
+ A a;
+ assert(a.d.size() == 0);
+ a.it = a.d.begin();
+ a.it2 = a.d.rend();
+
+ return 0;
+}
diff --git a/libcxx/test/libcxx-03/containers/sequences/deque/segmented_iterator.compile.pass.cpp b/libcxx/test/libcxx-03/containers/sequences/deque/segmented_iterator.compile.pass.cpp
new file mode 100644
index 0000000000000..7ae67d8d0252f
--- /dev/null
+++ b/libcxx/test/libcxx-03/containers/sequences/deque/segmented_iterator.compile.pass.cpp
@@ -0,0 +1,12 @@
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#include <deque>
+
+using DequeIterator = typename std::deque<int>::iterator;
+static_assert(std::__is_segmented_iterator<DequeIterator>::value, "");
diff --git a/libcxx/test/libcxx-03/containers/sequences/forwardlist/bool-conversion.pass.cpp b/libcxx/test/libcxx-03/containers/sequences/forwardlist/bool-conversion.pass.cpp
new file mode 100644
index 0000000000000..237b0f155c7be
--- /dev/null
+++ b/libcxx/test/libcxx-03/containers/sequences/forwardlist/bool-conversion.pass.cpp
@@ -0,0 +1,37 @@
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// REQUIRES: std-at-least-c++20
+
+// <forward_list>
+
+// This test shows the effect of implementing `LWG4135`, before it this code
+// was ill-formed, as the predicate is not bool. `LWG4135` suggests that
+// std::erase explicitly specifying the lambda's return type as bool.
+
+#include <forward_list>
+
+struct Bool {
+ Bool() = default;
+ Bool(const Bool&) = delete;
+ operator bool() const { return true; }
+};
+
+struct Int {
+ Bool& operator==(Int) const {
+ static Bool b;
+ return b;
+ }
+};
+
+int main(int, char**) {
+ std::forward_list<Int> l;
+ std::erase(l, Int{});
+
+ return 0;
+}
diff --git a/libcxx/test/libcxx-03/containers/sequences/list/abi.compile.pass.cpp b/libcxx/test/libcxx-03/containers/sequences/list/abi.compile.pass.cpp
new file mode 100644
index 0000000000000..a16ae1d527921
--- /dev/null
+++ b/libcxx/test/libcxx-03/containers/sequences/list/abi.compile.pass.cpp
@@ -0,0 +1,87 @@
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#include <cstdint>
+#include <list>
+
+#include "min_allocator.h"
+#include "test_allocator.h"
+#include "test_macros.h"
+
+template <class T>
+class small_pointer {
+ std::uint16_t offset;
+};
+
+template <class T>
+class small_iter_allocator {
+public:
+ using value_type = T;
+ using pointer = small_pointer<T>;
+ using size_type = std::int16_t;
+ using difference_type = std::int16_t;
+
+ small_iter_allocator() TEST_NOEXCEPT {}
+
+ template <class U>
+ small_iter_allocator(small_iter_allocator<U>) TEST_NOEXCEPT {}
+
+ T* allocate(std::size_t n);
+ void deallocate(T* p, std::size_t);
+
+ friend bool operator==(small_iter_allocator, small_iter_allocator) { return true; }
+ friend bool operator!=(small_iter_allocator, small_iter_allocator) { return false; }
+};
+
+#if __SIZE_WIDTH__ == 64
+
+static_assert(sizeof(std::list<int>) == 24, "");
+static_assert(sizeof(std::list<int, min_allocator<int> >) == 24, "");
+static_assert(sizeof(std::list<int, test_allocator<int> >) == 40, "");
+static_assert(sizeof(std::list<int, small_iter_allocator<int> >) == 6, "");
+
+static_assert(sizeof(std::list<char>) == 24, "");
+static_assert(sizeof(std::list<char, min_allocator<char> >) == 24, "");
+static_assert(sizeof(std::list<char, test_allocator<char> >) == 40, "");
+static_assert(sizeof(std::list<char, small_iter_allocator<char> >) == 6, "");
+
+static_assert(TEST_ALIGNOF(std::list<int>) == 8, "");
+static_assert(TEST_ALIGNOF(std::list<int, min_allocator<int> >) == 8, "");
+static_assert(TEST_ALIGNOF(std::list<int, test_allocator<int> >) == 8, "");
+static_assert(TEST_ALIGNOF(std::list<int, small_iter_allocator<int> >) == 2, "");
+
+static_assert(TEST_ALIGNOF(std::list<char>) == 8, "");
+static_assert(TEST_ALIGNOF(std::list<char, min_allocator<char> >) == 8, "");
+static_assert(TEST_ALIGNOF(std::list<char, test_allocator<char> >) == 8, "");
+static_assert(TEST_ALIGNOF(std::list<char, small_iter_allocator<char> >) == 2, "");
+
+#elif __SIZE_WIDTH__ == 32
+
+static_assert(sizeof(std::list<int>) == 12, "");
+static_assert(sizeof(std::list<int, min_allocator<int> >) == 12, "");
+static_assert(sizeof(std::list<int, test_allocator<int> >) == 24, "");
+static_assert(sizeof(std::list<int, small_iter_allocator<int> >) == 6, "");
+
+static_assert(sizeof(std::list<char>) == 12, "");
+static_assert(sizeof(std::list<char, min_allocator<char> >) == 12, "");
+static_assert(sizeof(std::list<char, test_allocator<char> >) == 24, "");
+static_assert(sizeof(std::list<char, small_iter_allocator<char> >) == 6, "");
+
+static_assert(TEST_ALIGNOF(std::list<int>) == 4, "");
+static_assert(TEST_ALIGNOF(std::list<int, min_allocator<int> >) == 4, "");
+static_assert(TEST_ALIGNOF(std::list<int, test_allocator<int> >) == 4, "");
+static_assert(TEST_ALIGNOF(std::list<int, small_iter_allocator<int> >) == 2, "");
+
+static_assert(TEST_ALIGNOF(std::list<char>) == 4, "");
+static_assert(TEST_ALIGNOF(std::list<char, min_allocator<char> >) == 4, "");
+static_assert(TEST_ALIGNOF(std::list<char, test_allocator<char> >) == 4, "");
+static_assert(TEST_ALIGNOF(std::list<char, small_iter_allocator<char> >) == 2, "");
+
+#else
+# error std::size_t has an unexpected size
+#endif
diff --git a/libcxx/test/libcxx-03/containers/sequences/vector.bool/abi.compile.pass.cpp b/libcxx/test/libcxx-03/containers/sequences/vector.bool/abi.compile.pass.cpp
new file mode 100644
index 0000000000000..cc6b0d94e7daf
--- /dev/null
+++ b/libcxx/test/libcxx-03/containers/sequences/vector.bool/abi.compile.pass.cpp
@@ -0,0 +1,69 @@
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: libcpp-abi-no-compressed-pair-padding
+
+#include <cstdint>
+#include <vector>
+
+#include "min_allocator.h"
+#include "test_allocator.h"
+#include "test_macros.h"
+
+template <class T>
+class small_pointer {
+ std::uint16_t offset;
+};
+
+template <class T>
+class small_iter_allocator {
+public:
+ using value_type = T;
+ using pointer = small_pointer<T>;
+ using size_type = std::int16_t;
+ using difference_type = std::int16_t;
+
+ small_iter_allocator() TEST_NOEXCEPT {}
+
+ template <class U>
+ small_iter_allocator(small_iter_allocator<U>) TEST_NOEXCEPT {}
+
+ T* allocate(std::size_t n);
+ void deallocate(T* p, std::size_t);
+
+ friend bool operator==(small_iter_allocator, small_iter_allocator) { return true; }
+ friend bool operator!=(small_iter_allocator, small_iter_allocator) { return false; }
+};
+
+#if __SIZE_WIDTH__ == 64
+
+static_assert(sizeof(std::vector<bool>) == 24, "");
+static_assert(sizeof(std::vector<bool, min_allocator<bool> >) == 24, "");
+static_assert(sizeof(std::vector<bool, test_allocator<bool> >) == 40, "");
+static_assert(sizeof(std::vector<bool, small_iter_allocator<bool> >) == 6, "");
+
+static_assert(TEST_ALIGNOF(std::vector<bool>) == 8, "");
+static_assert(TEST_ALIGNOF(std::vector<bool, min_allocator<bool> >) == 8, "");
+static_assert(TEST_ALIGNOF(std::vector<bool, test_allocator<bool> >) == 8, "");
+static_assert(TEST_ALIGNOF(std::vector<bool, small_iter_allocator<bool> >) == 2, "");
+
+#elif __SIZE_WIDTH__ == 32
+
+static_assert(sizeof(std::vector<bool>) == 12, "");
+static_assert(sizeof(std::vector<bool, min_allocator<bool> >) == 12, "");
+static_assert(sizeof(std::vector<bool, test_allocator<bool> >) == 24, "");
+static_assert(sizeof(std::vector<bool, small_iter_allocator<bool> >) == 6, "");
+
+static_assert(TEST_ALIGNOF(std::vector<bool>) == 4, "");
+static_assert(TEST_ALIGNOF(std::vector<bool, min_allocator<bool> >) == 4, "");
+static_assert(TEST_ALIGNOF(std::vector<bool, test_allocator<bool> >) == 4, "");
+static_assert(TEST_ALIGNOF(std::vector<bool, small_iter_allocator<bool> >) == 2, "");
+
+#else
+# error std::size_t has an unexpected size
+#endif
diff --git a/libcxx/test/libcxx-03/containers/sequences/vector/abi.compile.pass.cpp b/libcxx/test/libcxx-03/containers/sequences/vector/abi.compile.pass.cpp
new file mode 100644
index 0000000000000..57684951c8e8e
--- /dev/null
+++ b/libcxx/test/libcxx-03/containers/sequences/vector/abi.compile.pass.cpp
@@ -0,0 +1,95 @@
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#include <cstdint>
+#include <vector>
+
+#include "min_allocator.h"
+#include "test_allocator.h"
+#include "test_macros.h"
+
+template <class T>
+class small_pointer {
+public:
+ using value_type = T;
+ using difference_type = std::int16_t;
+ using pointer = small_pointer;
+ using reference = T&;
+ using iterator_category = std::random_access_iterator_tag;
+
+private:
+ std::uint16_t offset;
+};
+
+template <class T>
+class small_iter_allocator {
+public:
+ using value_type = T;
+ using pointer = small_pointer<T>;
+ using size_type = std::int16_t;
+ using difference_type = std::int16_t;
+
+ small_iter_allocator() TEST_NOEXCEPT {}
+
+ template <class U>
+ small_iter_allocator(small_iter_allocator<U>) TEST_NOEXCEPT {}
+
+ T* allocate(std::size_t n);
+ void deallocate(T* p, std::size_t);
+
+ friend bool operator==(small_iter_allocator, small_iter_allocator) { return true; }
+ friend bool operator!=(small_iter_allocator, small_iter_allocator) { return false; }
+};
+
+#if __SIZE_WIDTH__ == 64
+
+static_assert(sizeof(std::vector<int>) == 24, "");
+static_assert(sizeof(std::vector<int, min_allocator<int> >) == 24, "");
+static_assert(sizeof(std::vector<int, test_allocator<int> >) == 40, "");
+static_assert(sizeof(std::vector<int, small_iter_allocator<int> >) == 6, "");
+
+static_assert(sizeof(std::vector<char>) == 24, "");
+static_assert(sizeof(std::vector<char, min_allocator<char> >) == 24, "");
+static_assert(sizeof(std::vector<char, test_allocator<char> >) == 40, "");
+static_assert(sizeof(std::vector<char, small_iter_allocator<char> >) == 6, "");
+
+static_assert(TEST_ALIGNOF(std::vector<int>) == 8, "");
+static_assert(TEST_ALIGNOF(std::vector<int, min_allocator<int> >) == 8, "");
+static_assert(TEST_ALIGNOF(std::vector<int, test_allocator<int> >) == 8, "");
+static_assert(TEST_ALIGNOF(std::vector<int, small_iter_allocator<int> >) == 2, "");
+
+static_assert(TEST_ALIGNOF(std::vector<char>) == 8, "");
+static_assert(TEST_ALIGNOF(std::vector<char, min_allocator<char> >) == 8, "");
+static_assert(TEST_ALIGNOF(std::vector<char, test_allocator<char> >) == 8, "");
+static_assert(TEST_ALIGNOF(std::vector<char, small_iter_allocator<char> >) == 2, "");
+
+#elif __SIZE_WIDTH__ == 32
+
+static_assert(sizeof(std::vector<int>) == 12, "");
+static_assert(sizeof(std::vector<int, min_allocator<int> >) == 12, "");
+static_assert(sizeof(std::vector<int, test_allocator<int> >) == 24, "");
+static_assert(sizeof(std::vector<int, small_iter_allocator<int> >) == 6, "");
+
+static_assert(sizeof(std::vector<char>) == 12, "");
+static_assert(sizeof(std::vector<char, min_allocator<char> >) == 12, "");
+static_assert(sizeof(std::vector<char, test_allocator<char> >) == 24, "");
+static_assert(sizeof(std::vector<char, small_iter_allocator<char> >) == 6, "");
+
+static_assert(TEST_ALIGNOF(std::vector<int>) == 4, "");
+static_assert(TEST_ALIGNOF(std::vector<int, min_allocator<int> >) == 4, "");
+static_assert(TEST_ALIGNOF(std::vector<int, test_allocator<int> >) == 4, "");
+static_assert(TEST_ALIGNOF(std::vector<int, small_iter_allocator<int> >) == 2, "");
+
+static_assert(TEST_ALIGNOF(std::vector<char>) == 4, "");
+static_assert(TEST_ALIGNOF(std::vector<char, min_allocator<char> >) == 4, "");
+static_assert(TEST_ALIGNOF(std::vector<char, test_allocator<char> >) == 4, "");
+static_assert(TEST_ALIGNOF(std::vector<char, small_iter_allocator<char> >) == 2, "");
+
+#else
+# error std::size_t has an unexpected size
+#endif
diff --git a/libcxx/test/libcxx-03/containers/sequences/vector/asan.pass.cpp b/libcxx/test/libcxx-03/containers/sequences/vector/asan.pass.cpp
new file mode 100644
index 0000000000000..03d2b3e6ce9b9
--- /dev/null
+++ b/libcxx/test/libcxx-03/containers/sequences/vector/asan.pass.cpp
@@ -0,0 +1,76 @@
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// REQUIRES: asan
+
+// <vector>
+
+// reference operator[](size_type n);
+
+#include <vector>
+#include <cassert>
+#include <cstdlib>
+
+#include "asan_testing.h"
+#include "min_allocator.h"
+#include "test_iterators.h"
+#include "test_macros.h"
+
+extern "C" void __sanitizer_set_death_callback(void (*callback)(void));
+
+void do_exit() { exit(0); }
+
+int main(int, char**) {
+#if TEST_STD_VER >= 11
+ {
+ typedef int T;
+ typedef cpp17_input_iterator<T*> MyInputIter;
+ std::vector<T, min_allocator<T>> v;
+ v.reserve(1);
+ int i[] = {42};
+ v.insert(v.begin(), MyInputIter(i), MyInputIter(i + 1));
+ assert(v[0] == 42);
+ assert(is_contiguous_container_asan_correct(v));
+ }
+ {
+ typedef char T;
+ typedef cpp17_input_iterator<T*> MyInputIter;
+ std::vector<T, unaligned_allocator<T>> v;
+ v.reserve(1);
+ char i[] = {'a', 'b'};
+ v.insert(v.begin(), MyInputIter(i), MyInputIter(i + 2));
+ assert(v[0] == 'a');
+ assert(v[1] == 'b');
+ assert(is_contiguous_container_asan_correct(v));
+ }
+#endif // TEST_STD_VER >= 11
+ {
+ typedef cpp17_input_iterator<int*> MyInputIter;
+ // Sould not trigger ASan.
+ std::vector<int> v;
+ v.reserve(1);
+ int i[] = {42};
+ v.insert(v.begin(), MyInputIter(i), MyInputIter(i + 1));
+ assert(v[0] == 42);
+ assert(is_contiguous_container_asan_correct(v));
+ }
+
+ __sanitizer_set_death_callback(do_exit);
+ {
+ typedef int T;
+ typedef std::vector<T> C;
+ const T t[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
+ C c(std::begin(t), std::end(t));
+ c.reserve(2 * c.size());
+ assert(is_contiguous_container_asan_correct(c));
+ assert(!__sanitizer_verify_contiguous_container(c.data(), c.data() + 1, c.data() + c.capacity()));
+ volatile T foo = c[c.size()]; // should trigger ASAN. Use volatile to prevent being optimized away.
+ assert(false); // if we got here, ASAN didn't trigger
+ ((void)foo);
+ }
+}
diff --git a/libcxx/test/libcxx-03/containers/sequences/vector/asan_throw.pass.cpp b/libcxx/test/libcxx-03/containers/sequences/vector/asan_throw.pass.cpp
new file mode 100644
index 0000000000000..dcfa8029cfc0d
--- /dev/null
+++ b/libcxx/test/libcxx-03/containers/sequences/vector/asan_throw.pass.cpp
@@ -0,0 +1,233 @@
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: no-exceptions
+// Test asan vector annotations with a class that throws in a CTOR.
+
+#include <vector>
+#include <cassert>
+
+#include "test_macros.h"
+#include "asan_testing.h"
+
+class X {
+public:
+ X(const X& x) { Init(x.a); }
+ X(char arg) { Init(arg); }
+ X() { Init(42); }
+ X& operator=(const X& x) {
+ Init(x.a);
+ return *this;
+ }
+ void Init(char arg) {
+ if (arg == 42)
+ throw 0;
+ if (arg == 66)
+ arg = 42;
+ a = arg;
+ }
+ char get() const { return a; }
+ void set(char arg) { a = arg; }
+
+private:
+ char a;
+};
+
+class ThrowOnCopy {
+public:
+ ThrowOnCopy() : should_throw(false) {}
+ explicit ThrowOnCopy(bool xshould_throw) : should_throw(xshould_throw) {}
+
+ ThrowOnCopy(ThrowOnCopy const& other) : should_throw(other.should_throw) {
+ if (should_throw) {
+ throw 0;
+ }
+ }
+ ThrowOnCopy& operator=(ThrowOnCopy const&) = default;
+
+ bool should_throw;
+};
+
+void test_push_back() {
+ std::vector<X> v;
+ v.reserve(2);
+ v.push_back(X(2));
+ assert(v.size() == 1);
+ try {
+ v.push_back(X(66));
+ assert(0);
+ } catch (int e) {
+ assert(v.size() == 1);
+ }
+ assert(v.size() == 1);
+ assert(is_contiguous_container_asan_correct(v));
+}
+
+void test_emplace_back() {
+#if TEST_STD_VER >= 11
+ std::vector<X> v;
+ v.reserve(2);
+ v.push_back(X(2));
+ assert(v.size() == 1);
+ try {
+ v.emplace_back(42);
+ assert(0);
+ } catch (int e) {
+ assert(v.size() == 1);
+ }
+ assert(v.size() == 1);
+ assert(is_contiguous_container_asan_correct(v));
+#endif
+}
+
+void test_insert_range() {
+ std::vector<X> v;
+ v.reserve(4);
+ v.push_back(X(1));
+ v.push_back(X(2));
+ assert(v.size() == 2);
+ assert(v.capacity() >= 4);
+ try {
+ char a[2] = {21, 42};
+ v.insert(v.end(), a, a + 2);
+ assert(0);
+ } catch (int e) {
+ assert(v.size() == 2);
+ }
+ assert(v.size() == 2);
+ assert(is_contiguous_container_asan_correct(v));
+}
+
+void test_insert() {
+ std::vector<X> v;
+ v.reserve(3);
+ v.insert(v.end(), X(1));
+ v.insert(v.begin(), X(2));
+ assert(v.size() == 2);
+ try {
+ v.insert(v.end(), X(66));
+ assert(0);
+ } catch (int e) {
+ assert(v.size() == 2);
+ }
+ assert(v.size() == 2);
+ assert(is_contiguous_container_asan_correct(v));
+}
+
+void test_emplace() {
+#if TEST_STD_VER >= 11
+ std::vector<X> v;
+ v.reserve(3);
+ v.insert(v.end(), X(1));
+ v.insert(v.begin(), X(2));
+ assert(v.size() == 2);
+ try {
+ v.emplace(v.end(), 42);
+ assert(0);
+ } catch (int e) {
+ assert(v.size() == 2);
+ }
+ assert(v.size() == 2);
+ assert(is_contiguous_container_asan_correct(v));
+#endif
+}
+
+void test_insert_range2() {
+ std::vector<X> v;
+ v.reserve(4);
+ v.insert(v.end(), X(1));
+ v.insert(v.begin(), X(2));
+ assert(v.size() == 2);
+ assert(v.capacity() >= 4);
+ try {
+ char a[2] = {10, 42};
+ v.insert(v.begin(), a, a + 2);
+ assert(0);
+ } catch (int e) {
+ assert(v.size() <= 4);
+ assert(is_contiguous_container_asan_correct(v));
+ return;
+ }
+ assert(0);
+}
+
+void test_insert_n() {
+ std::vector<X> v;
+ v.reserve(10);
+ v.insert(v.end(), X(1));
+ v.insert(v.begin(), X(2));
+ assert(v.size() == 2);
+ try {
+ v.insert(v.begin(), 1, X(66));
+ assert(0);
+ } catch (int e) {
+ assert(v.size() <= 3);
+ assert(is_contiguous_container_asan_correct(v));
+ return;
+ }
+ assert(0);
+}
+
+void test_insert_n2() {
+ std::vector<ThrowOnCopy> v(10);
+ v.reserve(100);
+ assert(v.size() == 10);
+ v[6].should_throw = true;
+ try {
+ v.insert(v.cbegin(), 5, ThrowOnCopy());
+ assert(0);
+ } catch (int e) {
+ assert(v.size() == 11);
+ assert(is_contiguous_container_asan_correct(v));
+ return;
+ }
+ assert(0);
+}
+
+void test_resize() {
+ std::vector<X> v;
+ v.reserve(3);
+ v.push_back(X(0));
+ try {
+ v.resize(3);
+ assert(0);
+ } catch (int e) {
+ assert(v.size() == 1);
+ }
+ assert(v.size() == 1);
+ assert(is_contiguous_container_asan_correct(v));
+}
+
+void test_resize_param() {
+ std::vector<X> v;
+ v.reserve(3);
+ v.push_back(X(0));
+ try {
+ v.resize(3, X(66));
+ assert(0);
+ } catch (int e) {
+ assert(v.size() == 1);
+ }
+ assert(v.size() == 1);
+ assert(is_contiguous_container_asan_correct(v));
+}
+
+int main(int, char**) {
+ test_push_back();
+ test_emplace_back();
+ test_insert_range();
+ test_insert();
+ test_emplace();
+ test_insert_range2();
+ test_insert_n();
+ test_insert_n2();
+ test_resize();
+ test_resize_param();
+
+ return 0;
+}
diff --git a/libcxx/test/libcxx-03/containers/sequences/vector/erase.modules.compile.pass.mm b/libcxx/test/libcxx-03/containers/sequences/vector/erase.modules.compile.pass.mm
new file mode 100644
index 0000000000000..d27067399eda8
--- /dev/null
+++ b/libcxx/test/libcxx-03/containers/sequences/vector/erase.modules.compile.pass.mm
@@ -0,0 +1,16 @@
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// Make sure that we don't get a compiler error when trying to use std::vector::erase
+// from Objective-C++. This happened in Objective-C++ mode with modules enabled (rdar://106813461).
+
+// REQUIRES: objective-c++
+
+#include <vector>
+
+void f(std::vector<int> vec, std::vector<int>::iterator it) { (void)vec.erase(it); }
diff --git a/libcxx/test/libcxx-03/containers/sequences/vector/fill_to_capacity.h b/libcxx/test/libcxx-03/containers/sequences/vector/fill_to_capacity.h
new file mode 100644
index 0000000000000..abf88c477fece
--- /dev/null
+++ b/libcxx/test/libcxx-03/containers/sequences/vector/fill_to_capacity.h
@@ -0,0 +1,24 @@
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef LIBCXX_TEST_LIBCXX_CONTAINERS_SEQUENCES_VECTOR_FILL_TO_CAPACITY_H
+#define LIBCXX_TEST_LIBCXX_CONTAINERS_SEQUENCES_VECTOR_FILL_TO_CAPACITY_H
+
+#include <vector>
+
+template <typename T, typename A>
+void fill_to_capacity(std::vector<T, A>& vec) {
+ // Fill the given vector up to its capacity. Our bounded iterators are currently unable to catch an out-of-bounds
+ // access that goes beyond the container's logical storage (above the size) but is still within its physical storage
+ // (below the capacity) due to iterator stability guarantees. Filling a vector makes this distinction go away.
+ while (vec.size() < vec.capacity()) {
+ vec.push_back(T());
+ }
+}
+
+#endif // LIBCXX_TEST_LIBCXX_CONTAINERS_SEQUENCES_VECTOR_FILL_TO_CAPACITY_H
diff --git a/libcxx/test/libcxx-03/containers/sequences/vector/invalid_allocator.verify.cpp b/libcxx/test/libcxx-03/containers/sequences/vector/invalid_allocator.verify.cpp
new file mode 100644
index 0000000000000..e2de7730f2599
--- /dev/null
+++ b/libcxx/test/libcxx-03/containers/sequences/vector/invalid_allocator.verify.cpp
@@ -0,0 +1,29 @@
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// Check that vector diagnoses an allocator which has to implement rebind with an appropriate error message
+
+#include <vector>
+
+class FooAllocator {
+public:
+ using value_type = int;
+ FooAllocator() = default;
+
+ int* allocate(int num_objects);
+
+ void deallocate(int* ptr, int num_objects);
+
+ bool operator==(const FooAllocator&) const { return true; }
+ bool operator!=(const FooAllocator&) const { return false; }
+};
+
+void func() {
+ std::vector<int, FooAllocator>
+ v; //expected-error-re@*:* {{static assertion failed {{.*}}This allocator has to implement rebind}}
+}
diff --git a/libcxx/test/libcxx-03/containers/sequences/vector/vector.cons/construct_iter_iter.pass.cpp b/libcxx/test/libcxx-03/containers/sequences/vector/vector.cons/construct_iter_iter.pass.cpp
new file mode 100644
index 0000000000000..9e3fb886e6075
--- /dev/null
+++ b/libcxx/test/libcxx-03/containers/sequences/vector/vector.cons/construct_iter_iter.pass.cpp
@@ -0,0 +1,56 @@
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// <vector>
+
+// template <class InputIter> vector(InputIter first, InputIter last);
+
+#include <vector>
+#include <cassert>
+
+#include "test_macros.h"
+#include "min_allocator.h"
+
+void test_ctor_under_alloc() {
+ int arr1[] = {42};
+ int arr2[] = {1, 101, 42};
+ {
+ typedef std::vector<int, cpp03_allocator<int> > C;
+ typedef C::allocator_type Alloc;
+ {
+ Alloc::construct_called = false;
+ C v(arr1, arr1 + 1);
+ assert(Alloc::construct_called);
+ }
+ {
+ Alloc::construct_called = false;
+ C v(arr2, arr2 + 3);
+ assert(Alloc::construct_called);
+ }
+ }
+ {
+ typedef std::vector<int, cpp03_overload_allocator<int> > C;
+ typedef C::allocator_type Alloc;
+ {
+ Alloc::construct_called = false;
+ C v(arr1, arr1 + 1);
+ assert(Alloc::construct_called);
+ }
+ {
+ Alloc::construct_called = false;
+ C v(arr2, arr2 + 3);
+ assert(Alloc::construct_called);
+ }
+ }
+}
+
+int main(int, char**) {
+ test_ctor_under_alloc();
+
+ return 0;
+}
diff --git a/libcxx/test/libcxx-03/containers/sequences/vector/vector.cons/construct_iter_iter_alloc.pass.cpp b/libcxx/test/libcxx-03/containers/sequences/vector/vector.cons/construct_iter_iter_alloc.pass.cpp
new file mode 100644
index 0000000000000..fa1bd2d4fda32
--- /dev/null
+++ b/libcxx/test/libcxx-03/containers/sequences/vector/vector.cons/construct_iter_iter_alloc.pass.cpp
@@ -0,0 +1,59 @@
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// <vector>
+
+// template <class InputIter> vector(InputIter first, InputIter last,
+// const allocator_type& a);
+
+#include <vector>
+#include <cassert>
+
+#include "test_macros.h"
+#include "min_allocator.h"
+
+void test_ctor_under_alloc() {
+ int arr1[] = {42};
+ int arr2[] = {1, 101, 42};
+ {
+ typedef std::vector<int, cpp03_allocator<int> > C;
+ typedef C::allocator_type Alloc;
+ Alloc a;
+ {
+ Alloc::construct_called = false;
+ C v(arr1, arr1 + 1, a);
+ assert(Alloc::construct_called);
+ }
+ {
+ Alloc::construct_called = false;
+ C v(arr2, arr2 + 3, a);
+ assert(Alloc::construct_called);
+ }
+ }
+ {
+ typedef std::vector<int, cpp03_overload_allocator<int> > C;
+ typedef C::allocator_type Alloc;
+ Alloc a;
+ {
+ Alloc::construct_called = false;
+ C v(arr1, arr1 + 1, a);
+ assert(Alloc::construct_called);
+ }
+ {
+ Alloc::construct_called = false;
+ C v(arr2, arr2 + 3, a);
+ assert(Alloc::construct_called);
+ }
+ }
+}
+
+int main(int, char**) {
+ test_ctor_under_alloc();
+
+ return 0;
+}
diff --git a/libcxx/test/libcxx-03/containers/unord/key_value_traits.pass.cpp b/libcxx/test/libcxx-03/containers/unord/key_value_traits.pass.cpp
new file mode 100644
index 0000000000000..e00a028489a72
--- /dev/null
+++ b/libcxx/test/libcxx-03/containers/unord/key_value_traits.pass.cpp
@@ -0,0 +1,60 @@
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// XFAIL: FROZEN-CXX03-HEADERS-FIXME
+
+#include <__hash_table>
+#include <unordered_map>
+#include <unordered_set>
+#include <type_traits>
+
+#include "test_macros.h"
+#include "min_allocator.h"
+
+void testKeyValueTrait() {
+ {
+ typedef int Tp;
+ typedef std::__hash_key_value_types<Tp> Traits;
+ static_assert((std::is_same<Traits::key_type, int>::value), "");
+ static_assert((std::is_same<Traits::__node_value_type, Tp>::value), "");
+ static_assert((std::is_same<Traits::__container_value_type, Tp>::value), "");
+ static_assert(Traits::__is_map == false, "");
+ }
+ {
+ typedef std::pair<int, int> Tp;
+ typedef std::__hash_key_value_types<Tp> Traits;
+ static_assert((std::is_same<Traits::key_type, Tp>::value), "");
+ static_assert((std::is_same<Traits::__node_value_type, Tp>::value), "");
+ static_assert((std::is_same<Traits::__container_value_type, Tp>::value), "");
+ static_assert(Traits::__is_map == false, "");
+ }
+ {
+ typedef std::pair<const int, int> Tp;
+ typedef std::__hash_key_value_types<Tp> Traits;
+ static_assert((std::is_same<Traits::key_type, Tp>::value), "");
+ static_assert((std::is_same<Traits::__node_value_type, Tp>::value), "");
+ static_assert((std::is_same<Traits::__container_value_type, Tp>::value), "");
+ static_assert(Traits::__is_map == false, "");
+ }
+ {
+ typedef std::__hash_value_type<int, int> Tp;
+ typedef std::__hash_key_value_types<Tp> Traits;
+ static_assert((std::is_same<Traits::key_type, int>::value), "");
+ static_assert((std::is_same<Traits::mapped_type, int>::value), "");
+ static_assert((std::is_same<Traits::__node_value_type, Tp>::value), "");
+ static_assert((std::is_same<Traits::__container_value_type, std::pair<const int, int> >::value), "");
+ static_assert((std::is_same<Traits::__map_value_type, std::pair<const int, int> >::value), "");
+ static_assert(Traits::__is_map == true, "");
+ }
+}
+
+int main(int, char**) {
+ testKeyValueTrait();
+
+ return 0;
+}
diff --git a/libcxx/test/libcxx-03/containers/unord/next_prime.pass.cpp b/libcxx/test/libcxx-03/containers/unord/next_prime.pass.cpp
new file mode 100644
index 0000000000000..44b0eb96e2b9b
--- /dev/null
+++ b/libcxx/test/libcxx-03/containers/unord/next_prime.pass.cpp
@@ -0,0 +1,51 @@
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+//
+// REQUIRES: long_tests
+
+// Not a portable test
+
+// <__hash_table>
+
+// size_t __next_prime(size_t n);
+
+// If n == 0, return 0, else return the lowest prime greater than or equal to n
+
+// XFAIL: FROZEN-CXX03-HEADERS-FIXME
+
+#include <__hash_table>
+#include <cassert>
+#include <cstddef>
+
+#include "test_macros.h"
+
+bool is_prime(std::size_t n) {
+ switch (n) {
+ case 0:
+ case 1:
+ return false;
+ }
+ for (std::size_t i = 2; i * i <= n; ++i) {
+ if (n % i == 0)
+ return false;
+ }
+ return true;
+}
+
+int main(int, char**) {
+ assert(std::__next_prime(0) == 0);
+ for (std::size_t n = 1; n <= 100000; ++n) {
+ std::size_t p = std::__next_prime(n);
+ assert(p >= n);
+ for (std::size_t i = n; i < p; ++i)
+ assert(!is_prime(i));
+ assert(is_prime(p));
+ }
+
+ return 0;
+}
diff --git a/libcxx/test/libcxx-03/depr/depr.auto.ptr/auto.ptr/auto_ptr.cxx1z.pass.cpp b/libcxx/test/libcxx-03/depr/depr.auto.ptr/auto.ptr/auto_ptr.cxx1z.pass.cpp
new file mode 100644
index 0000000000000..cad0bd8b304ed
--- /dev/null
+++ b/libcxx/test/libcxx-03/depr/depr.auto.ptr/auto.ptr/auto_ptr.cxx1z.pass.cpp
@@ -0,0 +1,31 @@
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// <memory>
+
+// template <class X>
+// class auto_ptr;
+//
+// In C++17, auto_ptr has been removed.
+// However, for backwards compatibility, if _LIBCPP_ENABLE_CXX17_REMOVED_AUTO_PTR
+// is defined before including <memory>, then auto_ptr will be restored.
+
+// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_ENABLE_CXX17_REMOVED_AUTO_PTR
+// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DISABLE_DEPRECATION_WARNINGS
+
+#include <memory>
+#include <type_traits>
+
+#include "test_macros.h"
+
+int main(int, char**)
+{
+ std::auto_ptr<int> p;
+
+ return 0;
+}
diff --git a/libcxx/test/libcxx-03/depr/depr.c.headers/extern_c.pass.cpp b/libcxx/test/libcxx-03/depr/depr.c.headers/extern_c.pass.cpp
new file mode 100644
index 0000000000000..f756aacbc1cd5
--- /dev/null
+++ b/libcxx/test/libcxx-03/depr/depr.c.headers/extern_c.pass.cpp
@@ -0,0 +1,53 @@
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// When building with modules, including headers inside extern "C" is an anti-pattern
+// that we don't want to support and can't support with LSV enabled.
+// UNSUPPORTED: clang-modules-build
+
+// XFAIL: FROZEN-CXX03-HEADERS-FIXME
+
+// Sometimes C++'s <foo.h> headers get included within extern "C" contexts. This
+// is ill-formed (no diagnostic required), per [using.headers]p3, but we permit
+// it as an extension.
+
+#include <__config>
+
+extern "C" {
+#include <assert.h>
+// complex.h is not supported in extern "C".
+#include <ctype.h>
+#include <errno.h>
+#include <fenv.h>
+#include <float.h>
+#include <inttypes.h>
+#include <iso646.h>
+#include <limits.h>
+#include <math.h>
+#include <setjmp.h>
+#include <signal.h>
+#include <stdalign.h>
+#include <stdarg.h>
+#include <stdbool.h>
+#include <stddef.h>
+#include <stdint.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+// tgmath.h is not supported in extern "C".
+#include <time.h>
+// FIXME: #include <uchar.h>
+#if _LIBCPP_HAS_WIDE_CHARACTERS
+# include <wchar.h>
+# include <wctype.h>
+#endif
+}
+
+int main(int, char**) {
+ return 0;
+}
diff --git a/libcxx/test/libcxx-03/depr/depr.c.headers/math_h.compile.pass.cpp b/libcxx/test/libcxx-03/depr/depr.c.headers/math_h.compile.pass.cpp
new file mode 100644
index 0000000000000..045745b5ff95c
--- /dev/null
+++ b/libcxx/test/libcxx-03/depr/depr.c.headers/math_h.compile.pass.cpp
@@ -0,0 +1,26 @@
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// Code on Windows expects to be able to do:
+//
+// #define _USE_MATH_DEFINES
+// #include <math.h>
+//
+// and receive the definitions of mathematical constants, even if <math.h>
+// has previously been included. Make sure that works.
+//
+
+#ifdef _MSC_VER
+# include <math.h>
+# define _USE_MATH_DEFINES
+# include <math.h>
+
+# ifndef M_PI
+# error M_PI not defined
+# endif
+#endif
diff --git a/libcxx/test/libcxx-03/depr/depr.c.headers/stdint_h.std_types_t.compile.pass.cpp b/libcxx/test/libcxx-03/depr/depr.c.headers/stdint_h.std_types_t.compile.pass.cpp
new file mode 100644
index 0000000000000..3485ce755f976
--- /dev/null
+++ b/libcxx/test/libcxx-03/depr/depr.c.headers/stdint_h.std_types_t.compile.pass.cpp
@@ -0,0 +1,263 @@
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// AIX system headers need <stdint.h> to be re-enterable when macro _STD_TYPES_T
+// is defined. This test case checks that after defining _STD_TYPES_T, including
+// <stdint.h>, and undefining _STD_TYPES_T, <stdint.h> can be re-entered to get
+// to macros like UINT32_MAX.
+//
+// https://reviews.llvm.org/D59253
+
+#define _STD_TYPES_T
+# include <stdint.h>
+#undef _STD_TYPES_T
+#include <stdint.h>
+
+#ifndef INT8_MIN
+#error INT8_MIN not defined
+#endif
+
+#ifndef INT16_MIN
+#error INT16_MIN not defined
+#endif
+
+#ifndef INT32_MIN
+#error INT32_MIN not defined
+#endif
+
+#ifndef INT64_MIN
+#error INT64_MIN not defined
+#endif
+
+#ifndef INT8_MAX
+#error INT8_MAX not defined
+#endif
+
+#ifndef INT16_MAX
+#error INT16_MAX not defined
+#endif
+
+#ifndef INT32_MAX
+#error INT32_MAX not defined
+#endif
+
+#ifndef INT64_MAX
+#error INT64_MAX not defined
+#endif
+
+#ifndef UINT8_MAX
+#error UINT8_MAX not defined
+#endif
+
+#ifndef UINT16_MAX
+#error UINT16_MAX not defined
+#endif
+
+#ifndef UINT32_MAX
+#error UINT32_MAX not defined
+#endif
+
+#ifndef UINT64_MAX
+#error UINT64_MAX not defined
+#endif
+
+#ifndef INT_LEAST8_MIN
+#error INT_LEAST8_MIN not defined
+#endif
+
+#ifndef INT_LEAST16_MIN
+#error INT_LEAST16_MIN not defined
+#endif
+
+#ifndef INT_LEAST32_MIN
+#error INT_LEAST32_MIN not defined
+#endif
+
+#ifndef INT_LEAST64_MIN
+#error INT_LEAST64_MIN not defined
+#endif
+
+#ifndef INT_LEAST8_MAX
+#error INT_LEAST8_MAX not defined
+#endif
+
+#ifndef INT_LEAST16_MAX
+#error INT_LEAST16_MAX not defined
+#endif
+
+#ifndef INT_LEAST32_MAX
+#error INT_LEAST32_MAX not defined
+#endif
+
+#ifndef INT_LEAST64_MAX
+#error INT_LEAST64_MAX not defined
+#endif
+
+#ifndef UINT_LEAST8_MAX
+#error UINT_LEAST8_MAX not defined
+#endif
+
+#ifndef UINT_LEAST16_MAX
+#error UINT_LEAST16_MAX not defined
+#endif
+
+#ifndef UINT_LEAST32_MAX
+#error UINT_LEAST32_MAX not defined
+#endif
+
+#ifndef UINT_LEAST64_MAX
+#error UINT_LEAST64_MAX not defined
+#endif
+
+#ifndef INT_FAST8_MIN
+#error INT_FAST8_MIN not defined
+#endif
+
+#ifndef INT_FAST16_MIN
+#error INT_FAST16_MIN not defined
+#endif
+
+#ifndef INT_FAST32_MIN
+#error INT_FAST32_MIN not defined
+#endif
+
+#ifndef INT_FAST64_MIN
+#error INT_FAST64_MIN not defined
+#endif
+
+#ifndef INT_FAST8_MAX
+#error INT_FAST8_MAX not defined
+#endif
+
+#ifndef INT_FAST16_MAX
+#error INT_FAST16_MAX not defined
+#endif
+
+#ifndef INT_FAST32_MAX
+#error INT_FAST32_MAX not defined
+#endif
+
+#ifndef INT_FAST64_MAX
+#error INT_FAST64_MAX not defined
+#endif
+
+#ifndef UINT_FAST8_MAX
+#error UINT_FAST8_MAX not defined
+#endif
+
+#ifndef UINT_FAST16_MAX
+#error UINT_FAST16_MAX not defined
+#endif
+
+#ifndef UINT_FAST32_MAX
+#error UINT_FAST32_MAX not defined
+#endif
+
+#ifndef UINT_FAST64_MAX
+#error UINT_FAST64_MAX not defined
+#endif
+
+#ifndef INTPTR_MIN
+#error INTPTR_MIN not defined
+#endif
+
+#ifndef INTPTR_MAX
+#error INTPTR_MAX not defined
+#endif
+
+#ifndef UINTPTR_MAX
+#error UINTPTR_MAX not defined
+#endif
+
+#ifndef INTMAX_MIN
+#error INTMAX_MIN not defined
+#endif
+
+#ifndef INTMAX_MAX
+#error INTMAX_MAX not defined
+#endif
+
+#ifndef UINTMAX_MAX
+#error UINTMAX_MAX not defined
+#endif
+
+#ifndef PTRDIFF_MIN
+#error PTRDIFF_MIN not defined
+#endif
+
+#ifndef PTRDIFF_MAX
+#error PTRDIFF_MAX not defined
+#endif
+
+#ifndef SIG_ATOMIC_MIN
+#error SIG_ATOMIC_MIN not defined
+#endif
+
+#ifndef SIG_ATOMIC_MAX
+#error SIG_ATOMIC_MAX not defined
+#endif
+
+#ifndef SIZE_MAX
+#error SIZE_MAX not defined
+#endif
+
+#ifndef WCHAR_MIN
+#error WCHAR_MIN not defined
+#endif
+
+#ifndef WCHAR_MAX
+#error WCHAR_MAX not defined
+#endif
+
+#ifndef WINT_MIN
+#error WINT_MIN not defined
+#endif
+
+#ifndef WINT_MAX
+#error WINT_MAX not defined
+#endif
+
+#ifndef INT8_C
+#error INT8_C not defined
+#endif
+
+#ifndef INT16_C
+#error INT16_C not defined
+#endif
+
+#ifndef INT32_C
+#error INT32_C not defined
+#endif
+
+#ifndef INT64_C
+#error INT64_C not defined
+#endif
+
+#ifndef UINT8_C
+#error UINT8_C not defined
+#endif
+
+#ifndef UINT16_C
+#error UINT16_C not defined
+#endif
+
+#ifndef UINT32_C
+#error UINT32_C not defined
+#endif
+
+#ifndef UINT64_C
+#error UINT64_C not defined
+#endif
+
+#ifndef INTMAX_C
+#error INTMAX_C not defined
+#endif
+
+#ifndef UINTMAX_C
+#error UINTMAX_C not defined
+#endif
diff --git a/libcxx/test/libcxx-03/depr/depr.c.headers/stdint_h.xopen_source.compile.pass.cpp b/libcxx/test/libcxx-03/depr/depr.c.headers/stdint_h.xopen_source.compile.pass.cpp
new file mode 100644
index 0000000000000..75a4ab908ce21
--- /dev/null
+++ b/libcxx/test/libcxx-03/depr/depr.c.headers/stdint_h.xopen_source.compile.pass.cpp
@@ -0,0 +1,263 @@
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// This test breaks when enabling LSV.
+// UNSUPPORTED: clang-modules-build
+
+// Test that limits macros are available when <stdint.h> is included
+// with or without macro _XOPEN_SOURCE=700.
+//
+// https://reviews.llvm.org/D59253
+
+// ADDITIONAL_COMPILE_FLAGS: -D_XOPEN_SOURCE=700
+
+#include <stdint.h>
+
+#ifndef INT8_MIN
+#error INT8_MIN not defined
+#endif
+
+#ifndef INT16_MIN
+#error INT16_MIN not defined
+#endif
+
+#ifndef INT32_MIN
+#error INT32_MIN not defined
+#endif
+
+#ifndef INT64_MIN
+#error INT64_MIN not defined
+#endif
+
+#ifndef INT8_MAX
+#error INT8_MAX not defined
+#endif
+
+#ifndef INT16_MAX
+#error INT16_MAX not defined
+#endif
+
+#ifndef INT32_MAX
+#error INT32_MAX not defined
+#endif
+
+#ifndef INT64_MAX
+#error INT64_MAX not defined
+#endif
+
+#ifndef UINT8_MAX
+#error UINT8_MAX not defined
+#endif
+
+#ifndef UINT16_MAX
+#error UINT16_MAX not defined
+#endif
+
+#ifndef UINT32_MAX
+#error UINT32_MAX not defined
+#endif
+
+#ifndef UINT64_MAX
+#error UINT64_MAX not defined
+#endif
+
+#ifndef INT_LEAST8_MIN
+#error INT_LEAST8_MIN not defined
+#endif
+
+#ifndef INT_LEAST16_MIN
+#error INT_LEAST16_MIN not defined
+#endif
+
+#ifndef INT_LEAST32_MIN
+#error INT_LEAST32_MIN not defined
+#endif
+
+#ifndef INT_LEAST64_MIN
+#error INT_LEAST64_MIN not defined
+#endif
+
+#ifndef INT_LEAST8_MAX
+#error INT_LEAST8_MAX not defined
+#endif
+
+#ifndef INT_LEAST16_MAX
+#error INT_LEAST16_MAX not defined
+#endif
+
+#ifndef INT_LEAST32_MAX
+#error INT_LEAST32_MAX not defined
+#endif
+
+#ifndef INT_LEAST64_MAX
+#error INT_LEAST64_MAX not defined
+#endif
+
+#ifndef UINT_LEAST8_MAX
+#error UINT_LEAST8_MAX not defined
+#endif
+
+#ifndef UINT_LEAST16_MAX
+#error UINT_LEAST16_MAX not defined
+#endif
+
+#ifndef UINT_LEAST32_MAX
+#error UINT_LEAST32_MAX not defined
+#endif
+
+#ifndef UINT_LEAST64_MAX
+#error UINT_LEAST64_MAX not defined
+#endif
+
+#ifndef INT_FAST8_MIN
+#error INT_FAST8_MIN not defined
+#endif
+
+#ifndef INT_FAST16_MIN
+#error INT_FAST16_MIN not defined
+#endif
+
+#ifndef INT_FAST32_MIN
+#error INT_FAST32_MIN not defined
+#endif
+
+#ifndef INT_FAST64_MIN
+#error INT_FAST64_MIN not defined
+#endif
+
+#ifndef INT_FAST8_MAX
+#error INT_FAST8_MAX not defined
+#endif
+
+#ifndef INT_FAST16_MAX
+#error INT_FAST16_MAX not defined
+#endif
+
+#ifndef INT_FAST32_MAX
+#error INT_FAST32_MAX not defined
+#endif
+
+#ifndef INT_FAST64_MAX
+#error INT_FAST64_MAX not defined
+#endif
+
+#ifndef UINT_FAST8_MAX
+#error UINT_FAST8_MAX not defined
+#endif
+
+#ifndef UINT_FAST16_MAX
+#error UINT_FAST16_MAX not defined
+#endif
+
+#ifndef UINT_FAST32_MAX
+#error UINT_FAST32_MAX not defined
+#endif
+
+#ifndef UINT_FAST64_MAX
+#error UINT_FAST64_MAX not defined
+#endif
+
+#ifndef INTPTR_MIN
+#error INTPTR_MIN not defined
+#endif
+
+#ifndef INTPTR_MAX
+#error INTPTR_MAX not defined
+#endif
+
+#ifndef UINTPTR_MAX
+#error UINTPTR_MAX not defined
+#endif
+
+#ifndef INTMAX_MIN
+#error INTMAX_MIN not defined
+#endif
+
+#ifndef INTMAX_MAX
+#error INTMAX_MAX not defined
+#endif
+
+#ifndef UINTMAX_MAX
+#error UINTMAX_MAX not defined
+#endif
+
+#ifndef PTRDIFF_MIN
+#error PTRDIFF_MIN not defined
+#endif
+
+#ifndef PTRDIFF_MAX
+#error PTRDIFF_MAX not defined
+#endif
+
+#ifndef SIG_ATOMIC_MIN
+#error SIG_ATOMIC_MIN not defined
+#endif
+
+#ifndef SIG_ATOMIC_MAX
+#error SIG_ATOMIC_MAX not defined
+#endif
+
+#ifndef SIZE_MAX
+#error SIZE_MAX not defined
+#endif
+
+#ifndef WCHAR_MIN
+#error WCHAR_MIN not defined
+#endif
+
+#ifndef WCHAR_MAX
+#error WCHAR_MAX not defined
+#endif
+
+#ifndef WINT_MIN
+#error WINT_MIN not defined
+#endif
+
+#ifndef WINT_MAX
+#error WINT_MAX not defined
+#endif
+
+#ifndef INT8_C
+#error INT8_C not defined
+#endif
+
+#ifndef INT16_C
+#error INT16_C not defined
+#endif
+
+#ifndef INT32_C
+#error INT32_C not defined
+#endif
+
+#ifndef INT64_C
+#error INT64_C not defined
+#endif
+
+#ifndef UINT8_C
+#error UINT8_C not defined
+#endif
+
+#ifndef UINT16_C
+#error UINT16_C not defined
+#endif
+
+#ifndef UINT32_C
+#error UINT32_C not defined
+#endif
+
+#ifndef UINT64_C
+#error UINT64_C not defined
+#endif
+
+#ifndef INTMAX_C
+#error INTMAX_C not defined
+#endif
+
+#ifndef UINTMAX_C
+#error UINTMAX_C not defined
+#endif
diff --git a/libcxx/test/libcxx-03/depr/depr.default.allocator/allocator.members/address.cxx20.pass.cpp b/libcxx/test/libcxx-03/depr/depr.default.allocator/allocator.members/address.cxx20.pass.cpp
new file mode 100644
index 0000000000000..d9a65eee4c130
--- /dev/null
+++ b/libcxx/test/libcxx-03/depr/depr.default.allocator/allocator.members/address.cxx20.pass.cpp
@@ -0,0 +1,44 @@
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// <memory>
+
+// allocator:
+// pointer address(reference x) const;
+// const_pointer address(const_reference x) const;
+
+// Removed in C++20, deprecated in C++17.
+
+// REQUIRES: c++03 || c++11 || c++14 || c++17
+// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DISABLE_DEPRECATION_WARNINGS
+
+#include <memory>
+#include <cassert>
+
+#include "test_macros.h"
+
+template <class T>
+void test_address() {
+ T* tp = new T();
+ const T* ctp = tp;
+ const std::allocator<T> a;
+ assert(a.address(*tp) == tp);
+ assert(a.address(*ctp) == tp);
+ delete tp;
+}
+
+struct A {
+ void operator&() const {}
+};
+
+int main(int, char**) {
+ test_address<int>();
+ test_address<A>();
+
+ return 0;
+}
diff --git a/libcxx/test/libcxx-03/depr/depr.default.allocator/allocator.members/allocate.cxx20.pass.cpp b/libcxx/test/libcxx-03/depr/depr.default.allocator/allocator.members/allocate.cxx20.pass.cpp
new file mode 100644
index 0000000000000..8fc6628ebfba2
--- /dev/null
+++ b/libcxx/test/libcxx-03/depr/depr.default.allocator/allocator.members/allocate.cxx20.pass.cpp
@@ -0,0 +1,92 @@
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// <memory>
+
+// allocator:
+// T* allocate(size_t n, const void* hint);
+
+// Removed in C++20, deprecated in C++17.
+
+// REQUIRES: c++03 || c++11 || c++14 || c++17
+// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DISABLE_DEPRECATION_WARNINGS
+
+#include <memory>
+#include <cassert>
+#include <cstddef> // for std::max_align_t
+
+#include "test_macros.h"
+#include "count_new.h"
+
+#ifdef TEST_HAS_NO_ALIGNED_ALLOCATION
+static const bool UsingAlignedNew = false;
+#else
+static const bool UsingAlignedNew = true;
+#endif
+
+#ifdef __STDCPP_DEFAULT_NEW_ALIGNMENT__
+static const std::size_t MaxAligned = __STDCPP_DEFAULT_NEW_ALIGNMENT__;
+#else
+static const std::size_t MaxAligned = std::alignment_of<std::max_align_t>::value;
+#endif
+
+static const std::size_t OverAligned = MaxAligned * 2;
+
+template <std::size_t Align>
+struct TEST_ALIGNAS(Align) AlignedType {
+ char data;
+ static int constructed;
+ AlignedType() { ++constructed; }
+ AlignedType(AlignedType const&) { ++constructed; }
+ ~AlignedType() { --constructed; }
+};
+template <std::size_t Align>
+int AlignedType<Align>::constructed = 0;
+
+template <std::size_t Align>
+void test_aligned() {
+ typedef AlignedType<Align> T;
+ T::constructed = 0;
+ globalMemCounter.reset();
+ std::allocator<T> a;
+ const bool IsOverAlignedType = Align > MaxAligned;
+ const bool ExpectAligned = IsOverAlignedType && UsingAlignedNew;
+ {
+ globalMemCounter.last_new_size = 0;
+ globalMemCounter.last_new_align = 0;
+ T* ap2 = a.allocate(11, (const void*)5);
+ DoNotOptimize(ap2);
+ assert(globalMemCounter.checkOutstandingNewEq(1));
+ assert(globalMemCounter.checkNewCalledEq(1));
+ assert(globalMemCounter.checkAlignedNewCalledEq(ExpectAligned));
+ assert(globalMemCounter.checkLastNewSizeEq(11 * sizeof(T)));
+ assert(globalMemCounter.checkLastNewAlignEq(ExpectAligned ? Align : 0));
+ assert(T::constructed == 0);
+ globalMemCounter.last_delete_align = 0;
+ a.deallocate(ap2, 11);
+ DoNotOptimize(ap2);
+ assert(globalMemCounter.checkOutstandingNewEq(0));
+ assert(globalMemCounter.checkDeleteCalledEq(1));
+ assert(globalMemCounter.checkAlignedDeleteCalledEq(ExpectAligned));
+ assert(globalMemCounter.checkLastDeleteAlignEq(ExpectAligned ? Align : 0));
+ assert(T::constructed == 0);
+ }
+}
+
+int main(int, char**) {
+ test_aligned<1>();
+ test_aligned<2>();
+ test_aligned<4>();
+ test_aligned<8>();
+ test_aligned<16>();
+ test_aligned<MaxAligned>();
+ test_aligned<OverAligned>();
+ test_aligned<OverAligned * 2>();
+
+ return 0;
+}
diff --git a/libcxx/test/libcxx-03/depr/depr.default.allocator/allocator.members/construct.cxx20.pass.cpp b/libcxx/test/libcxx-03/depr/depr.default.allocator/allocator.members/construct.cxx20.pass.cpp
new file mode 100644
index 0000000000000..9a37cf8af8e69
--- /dev/null
+++ b/libcxx/test/libcxx-03/depr/depr.default.allocator/allocator.members/construct.cxx20.pass.cpp
@@ -0,0 +1,147 @@
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// <memory>
+
+// allocator:
+// template <class... Args> void construct(pointer p, Args&&... args);
+
+// In C++20, parts of std::allocator<T> have been removed.
+// In C++17, they were deprecated.
+// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DISABLE_DEPRECATION_WARNINGS
+// REQUIRES: c++03 || c++11 || c++14 || c++17
+
+#include <memory>
+#include <cassert>
+
+#include "test_macros.h"
+#include "count_new.h"
+
+int A_constructed = 0;
+
+struct A {
+ int data;
+ A() { ++A_constructed; }
+
+ A(const A&) { ++A_constructed; }
+
+ explicit A(int) { ++A_constructed; }
+ A(int, int*) { ++A_constructed; }
+
+ ~A() { --A_constructed; }
+};
+
+int move_only_constructed = 0;
+
+#if TEST_STD_VER >= 11
+class move_only {
+ move_only(const move_only&) = delete;
+ move_only& operator=(const move_only&) = delete;
+
+public:
+ move_only(move_only&&) { ++move_only_constructed; }
+ move_only& operator=(move_only&&) { return *this; }
+
+ move_only() { ++move_only_constructed; }
+ ~move_only() { --move_only_constructed; }
+
+public:
+ int data; // unused other than to make sizeof(move_only) == sizeof(int).
+ // but public to suppress "-Wunused-private-field"
+};
+#endif // TEST_STD_VER >= 11
+
+int main(int, char**) {
+ globalMemCounter.reset();
+ {
+ std::allocator<A> a;
+ assert(globalMemCounter.checkOutstandingNewEq(0));
+ assert(A_constructed == 0);
+
+ globalMemCounter.last_new_size = 0;
+ A* ap = a.allocate(3);
+ DoNotOptimize(ap);
+ assert(globalMemCounter.checkOutstandingNewEq(1));
+ assert(globalMemCounter.checkLastNewSizeEq(3 * sizeof(int)));
+ assert(A_constructed == 0);
+
+ a.construct(ap);
+ assert(globalMemCounter.checkOutstandingNewEq(1));
+ assert(A_constructed == 1);
+
+ a.destroy(ap);
+ assert(globalMemCounter.checkOutstandingNewEq(1));
+ assert(A_constructed == 0);
+
+ a.construct(ap, A());
+ assert(globalMemCounter.checkOutstandingNewEq(1));
+ assert(A_constructed == 1);
+
+ a.destroy(ap);
+ assert(globalMemCounter.checkOutstandingNewEq(1));
+ assert(A_constructed == 0);
+
+ a.construct(ap, 5);
+ assert(globalMemCounter.checkOutstandingNewEq(1));
+ assert(A_constructed == 1);
+
+ a.destroy(ap);
+ assert(globalMemCounter.checkOutstandingNewEq(1));
+ assert(A_constructed == 0);
+
+ a.construct(ap, 5, (int*)0);
+ assert(globalMemCounter.checkOutstandingNewEq(1));
+ assert(A_constructed == 1);
+
+ a.destroy(ap);
+ assert(globalMemCounter.checkOutstandingNewEq(1));
+ assert(A_constructed == 0);
+
+ a.deallocate(ap, 3);
+ DoNotOptimize(ap);
+ assert(globalMemCounter.checkOutstandingNewEq(0));
+ assert(A_constructed == 0);
+ }
+#if TEST_STD_VER >= 11
+ {
+ std::allocator<move_only> a;
+ assert(globalMemCounter.checkOutstandingNewEq(0));
+ assert(move_only_constructed == 0);
+
+ globalMemCounter.last_new_size = 0;
+ move_only* ap = a.allocate(3);
+ DoNotOptimize(ap);
+ assert(globalMemCounter.checkOutstandingNewEq(1));
+ assert(globalMemCounter.checkLastNewSizeEq(3 * sizeof(int)));
+ assert(move_only_constructed == 0);
+
+ a.construct(ap);
+ assert(globalMemCounter.checkOutstandingNewEq(1));
+ assert(move_only_constructed == 1);
+
+ a.destroy(ap);
+ assert(globalMemCounter.checkOutstandingNewEq(1));
+ assert(move_only_constructed == 0);
+
+ a.construct(ap, move_only());
+ assert(globalMemCounter.checkOutstandingNewEq(1));
+ assert(move_only_constructed == 1);
+
+ a.destroy(ap);
+ assert(globalMemCounter.checkOutstandingNewEq(1));
+ assert(move_only_constructed == 0);
+
+ a.deallocate(ap, 3);
+ DoNotOptimize(ap);
+ assert(globalMemCounter.checkOutstandingNewEq(0));
+ assert(move_only_constructed == 0);
+ }
+#endif
+
+ return 0;
+}
diff --git a/libcxx/test/libcxx-03/depr/depr.default.allocator/allocator.members/max_size.cxx20.pass.cpp b/libcxx/test/libcxx-03/depr/depr.default.allocator/allocator.members/max_size.cxx20.pass.cpp
new file mode 100644
index 0000000000000..92e3b919b0f76
--- /dev/null
+++ b/libcxx/test/libcxx-03/depr/depr.default.allocator/allocator.members/max_size.cxx20.pass.cpp
@@ -0,0 +1,34 @@
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// <memory>
+
+// allocator:
+// size_type max_size() const throw();
+
+// Removed in C++20, deprecated in C++17.
+
+// REQUIRES: c++03 || c++11 || c++14 || c++17
+// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DISABLE_DEPRECATION_WARNINGS
+
+#include <memory>
+#include <limits>
+#include <cstddef>
+#include <cassert>
+
+#include "test_macros.h"
+
+int new_called = 0;
+
+int main(int, char**) {
+ const std::allocator<int> a;
+ std::size_t M = a.max_size();
+ assert(M > 0xFFFF && M <= (std::numeric_limits<std::size_t>::max() / sizeof(int)));
+
+ return 0;
+}
diff --git a/libcxx/test/libcxx-03/depr/depr.default.allocator/allocator_types.cxx20.pass.cpp b/libcxx/test/libcxx-03/depr/depr.default.allocator/allocator_types.cxx20.pass.cpp
new file mode 100644
index 0000000000000..e462e07d896c5
--- /dev/null
+++ b/libcxx/test/libcxx-03/depr/depr.default.allocator/allocator_types.cxx20.pass.cpp
@@ -0,0 +1,53 @@
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// <memory>
+
+// Check that the following types are provided regardless of the Standard when
+// we request them from libc++.
+
+// template <class T>
+// class allocator
+// {
+// public:
+// typedef size_t size_type;
+// typedef ptrdiff_t difference_type;
+// typedef T* pointer;
+// typedef const T* const_pointer;
+// typedef typename add_lvalue_reference<T>::type reference;
+// typedef typename add_lvalue_reference<const T>::type const_reference;
+//
+// template <class U> struct rebind {typedef allocator<U> other;};
+// ...
+// };
+
+// Removed in C++20, deprecated in C++17.
+
+// REQUIRES: c++03 || c++11 || c++14 || c++17
+// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DISABLE_DEPRECATION_WARNINGS
+
+#include <memory>
+#include <type_traits>
+#include <cstddef>
+
+template <class T>
+void test() {
+ static_assert((std::is_same<typename std::allocator<T>::size_type, std::size_t>::value), "");
+ static_assert((std::is_same<typename std::allocator<T>::difference_type, std::ptrdiff_t>::value), "");
+ static_assert((std::is_same<typename std::allocator<T>::pointer, T*>::value), "");
+ static_assert((std::is_same<typename std::allocator<T>::const_pointer, const T*>::value), "");
+ static_assert((std::is_same<typename std::allocator<T>::reference, T&>::value), "");
+ static_assert((std::is_same<typename std::allocator<T>::const_reference, const T&>::value), "");
+ static_assert(
+ (std::is_same<typename std::allocator<T>::template rebind<int>::other, std::allocator<int> >::value), "");
+}
+
+int main(int, char**) {
+ test<char>();
+ return 0;
+}
diff --git a/libcxx/test/libcxx-03/depr/depr.function.objects/depr.adaptors.cxx1z.pass.cpp b/libcxx/test/libcxx-03/depr/depr.function.objects/depr.adaptors.cxx1z.pass.cpp
new file mode 100644
index 0000000000000..d212f36bb1ab4
--- /dev/null
+++ b/libcxx/test/libcxx-03/depr/depr.function.objects/depr.adaptors.cxx1z.pass.cpp
@@ -0,0 +1,68 @@
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// <functional>
+
+
+// In C++17, the function adapters mem_fun/mem_fun_ref, etc have been removed.
+// However, for backwards compatibility, if _LIBCPP_ENABLE_CXX17_REMOVED_BINDERS
+// is defined before including <functional>, then they will be restored.
+
+// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_ENABLE_CXX17_REMOVED_BINDERS
+// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DISABLE_DEPRECATION_WARNINGS
+
+#include <functional>
+#include <cassert>
+#include <type_traits>
+
+#include "test_macros.h"
+
+int identity(int v) { return v; }
+int sum(int a, int b) { return a + b; }
+
+struct Foo {
+ int zero() { return 0; }
+ int zero_const() const { return 1; }
+
+ int identity(int v) const { return v; }
+ int sum(int a, int b) const { return a + b; }
+};
+
+int main(int, char**)
+{
+ typedef std::pointer_to_unary_function<int, int> PUF;
+ typedef std::pointer_to_binary_function<int, int, int> PBF;
+
+ static_assert(
+ (std::is_same<PUF, decltype((std::ptr_fun<int, int>(identity)))>::value),
+ "");
+ static_assert(
+ (std::is_same<PBF, decltype((std::ptr_fun<int, int, int>(sum)))>::value),
+ "");
+
+ assert((std::ptr_fun<int, int>(identity)(4) == 4));
+ assert((std::ptr_fun<int, int, int>(sum)(4, 5) == 9));
+
+ Foo f;
+ assert((std::mem_fn(&Foo::identity)(f, 5) == 5));
+ assert((std::mem_fn(&Foo::sum)(f, 5, 6) == 11));
+
+ typedef std::mem_fun_ref_t<int, Foo> MFR;
+ typedef std::const_mem_fun_ref_t<int, Foo> CMFR;
+
+ static_assert(
+ (std::is_same<MFR, decltype((std::mem_fun_ref(&Foo::zero)))>::value), "");
+ static_assert((std::is_same<CMFR, decltype((std::mem_fun_ref(
+ &Foo::zero_const)))>::value),
+ "");
+
+ assert((std::mem_fun_ref(&Foo::zero)(f) == 0));
+ assert((std::mem_fun_ref(&Foo::identity)(f, 5) == 5));
+
+ return 0;
+}
diff --git a/libcxx/test/libcxx-03/depr/exception.unexpected/get_unexpected.pass.cpp b/libcxx/test/libcxx-03/depr/exception.unexpected/get_unexpected.pass.cpp
new file mode 100644
index 0000000000000..e4533a01c5bfd
--- /dev/null
+++ b/libcxx/test/libcxx-03/depr/exception.unexpected/get_unexpected.pass.cpp
@@ -0,0 +1,44 @@
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// test get_unexpected
+
+// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_ENABLE_CXX17_REMOVED_UNEXPECTED_FUNCTIONS
+
+#include <exception>
+#include <cassert>
+#include <cstdlib>
+
+#include "test_macros.h"
+
+void f1() {}
+void f2() {}
+
+void f3()
+{
+ std::exit(0);
+}
+
+int main(int, char**)
+{
+
+ std::unexpected_handler old = std::get_unexpected();
+ // verify there is a previous unexpected handler
+ assert(old);
+ std::set_unexpected(f1);
+ assert(std::get_unexpected() == f1);
+ // verify f1 was replace with f2
+ std::set_unexpected(f2);
+ assert(std::get_unexpected() == f2);
+ // verify calling original unexpected handler calls terminate
+ std::set_terminate(f3);
+ (*old)();
+ assert(0);
+
+ return 0;
+}
diff --git a/libcxx/test/libcxx-03/depr/exception.unexpected/set_unexpected.pass.cpp b/libcxx/test/libcxx-03/depr/exception.unexpected/set_unexpected.pass.cpp
new file mode 100644
index 0000000000000..f428790f6cc96
--- /dev/null
+++ b/libcxx/test/libcxx-03/depr/exception.unexpected/set_unexpected.pass.cpp
@@ -0,0 +1,40 @@
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// test set_unexpected
+
+// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_ENABLE_CXX17_REMOVED_UNEXPECTED_FUNCTIONS
+
+#include <exception>
+#include <cassert>
+#include <cstdlib>
+
+#include "test_macros.h"
+
+void f1() {}
+void f2() {}
+
+void f3()
+{
+ std::exit(0);
+}
+
+int main(int, char**)
+{
+ std::unexpected_handler old = std::set_unexpected(f1);
+ // verify there is a previous unexpected handler
+ assert(old);
+ // verify f1 was replace with f2
+ assert(std::set_unexpected(f2) == f1);
+ // verify calling original unexpected handler calls terminate
+ std::set_terminate(f3);
+ (*old)();
+ assert(0);
+
+ return 0;
+}
diff --git a/libcxx/test/libcxx-03/depr/exception.unexpected/unexpected.pass.cpp b/libcxx/test/libcxx-03/depr/exception.unexpected/unexpected.pass.cpp
new file mode 100644
index 0000000000000..6ab1147b912eb
--- /dev/null
+++ b/libcxx/test/libcxx-03/depr/exception.unexpected/unexpected.pass.cpp
@@ -0,0 +1,31 @@
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// test unexpected
+
+// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_ENABLE_CXX17_REMOVED_UNEXPECTED_FUNCTIONS
+
+#include <exception>
+#include <cstdlib>
+#include <cassert>
+
+#include "test_macros.h"
+
+void fexit()
+{
+ std::exit(0);
+}
+
+int main(int, char**)
+{
+ std::set_unexpected(fexit);
+ std::unexpected();
+ assert(false);
+
+ return 0;
+}
diff --git a/libcxx/test/libcxx-03/diagnostics/system_error_win_codes.pass.cpp b/libcxx/test/libcxx-03/diagnostics/system_error_win_codes.pass.cpp
new file mode 100644
index 0000000000000..799a5b5c0b086
--- /dev/null
+++ b/libcxx/test/libcxx-03/diagnostics/system_error_win_codes.pass.cpp
@@ -0,0 +1,25 @@
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// REQUIRES: windows
+
+// Validate that system_error on windows accepts Windows' System Error Codes (as
+// used by win32 APIs and reported by GetLastError), and that they are properly
+// translated to generic conditions.
+
+#include <windows.h>
+#include <system_error>
+#include <cassert>
+
+#include "test_macros.h"
+
+int main(int, char**) {
+ LIBCPP_ASSERT(std::error_code(ERROR_ACCESS_DENIED, std::system_category()) == std::errc::permission_denied);
+ LIBCPP_ASSERT(std::error_code(ERROR_PATH_NOT_FOUND, std::system_category()) == std::errc::no_such_file_or_directory);
+ return 0;
+}
diff --git a/libcxx/test/libcxx-03/experimental/fexperimental-library.compile.pass.cpp b/libcxx/test/libcxx-03/experimental/fexperimental-library.compile.pass.cpp
new file mode 100644
index 0000000000000..3cf497da233fb
--- /dev/null
+++ b/libcxx/test/libcxx-03/experimental/fexperimental-library.compile.pass.cpp
@@ -0,0 +1,31 @@
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// This test ensures that passing `-fexperimental-library` results in experimental
+// library features being enabled.
+
+// GCC does not support the -fexperimental-library flag
+// UNSUPPORTED: gcc
+
+// ADDITIONAL_COMPILE_FLAGS: -fexperimental-library
+
+// XFAIL: FROZEN-CXX03-HEADERS-FIXME
+
+#include <version>
+
+#if !_LIBCPP_HAS_EXPERIMENTAL_PSTL
+# error "-fexperimental-library should enable the PSTL"
+#endif
+
+#if !_LIBCPP_HAS_EXPERIMENTAL_TZDB
+# error "-fexperimental-library should enable the chrono TZDB"
+#endif
+
+#if !_LIBCPP_HAS_EXPERIMENTAL_SYNCSTREAM
+# error "-fexperimental-library should enable the syncstream header"
+#endif
diff --git a/libcxx/test/libcxx-03/feature_test_macro/ftm_metadata.sh.py b/libcxx/test/libcxx-03/feature_test_macro/ftm_metadata.sh.py
new file mode 100644
index 0000000000000..f727f9a2d9e0e
--- /dev/null
+++ b/libcxx/test/libcxx-03/feature_test_macro/ftm_metadata.sh.py
@@ -0,0 +1,82 @@
+# ===----------------------------------------------------------------------===##
+#
+# Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+# See https://llvm.org/LICENSE.txt for license information.
+# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+#
+# ===----------------------------------------------------------------------===##
+
+# RUN: %{python} %s %{libcxx-dir}/utils %{libcxx-dir}/test/libcxx/feature_test_macro/test_data.json
+
+import sys
+import unittest
+
+UTILS = sys.argv[1]
+TEST_DATA = sys.argv[2]
+del sys.argv[1:3]
+
+sys.path.append(UTILS)
+from generate_feature_test_macro_components import FeatureTestMacros, Metadata
+
+
+class Test(unittest.TestCase):
+ def setUp(self):
+ self.ftm = FeatureTestMacros(TEST_DATA, ["charconv"])
+ self.maxDiff = None # This causes the diff to be printed when the test fails
+
+ def test_implementation(self):
+ expected = {
+ "__cpp_lib_any": Metadata(
+ headers=["any"],
+ available_since="c++17",
+ test_suite_guard=None,
+ libcxx_guard=None,
+ ),
+ "__cpp_lib_barrier": Metadata(
+ headers=["barrier"],
+ available_since="c++20",
+ test_suite_guard="!defined(_LIBCPP_VERSION) || (_LIBCPP_HAS_THREADS && _LIBCPP_AVAILABILITY_HAS_SYNC)",
+ libcxx_guard="_LIBCPP_HAS_THREADS && _LIBCPP_AVAILABILITY_HAS_SYNC",
+ ),
+ "__cpp_lib_clamp": Metadata(
+ headers=["algorithm"],
+ available_since="c++17",
+ test_suite_guard=None,
+ libcxx_guard=None,
+ ),
+ "__cpp_lib_format": Metadata(
+ headers=["format"],
+ available_since="c++20",
+ test_suite_guard=None,
+ libcxx_guard=None,
+ ),
+ "__cpp_lib_parallel_algorithm": Metadata(
+ headers=["algorithm", "numeric"],
+ available_since="c++17",
+ test_suite_guard=None,
+ libcxx_guard=None,
+ ),
+ "__cpp_lib_to_chars": Metadata(
+ headers=["charconv"],
+ available_since="c++17",
+ test_suite_guard=None,
+ libcxx_guard=None,
+ ),
+ "__cpp_lib_variant": Metadata(
+ headers=["variant"],
+ available_since="c++17",
+ test_suite_guard=None,
+ libcxx_guard=None,
+ ),
+ "__cpp_lib_zz_missing_FTM_in_older_standard": Metadata(
+ headers=[],
+ available_since="c++17",
+ test_suite_guard=None,
+ libcxx_guard=None,
+ ),
+ }
+ self.assertEqual(self.ftm.ftm_metadata, expected)
+
+
+if __name__ == "__main__":
+ unittest.main()
diff --git a/libcxx/test/libcxx-03/feature_test_macro/generate_header_test.sh.py b/libcxx/test/libcxx-03/feature_test_macro/generate_header_test.sh.py
new file mode 100644
index 0000000000000..789a0bc25a87b
--- /dev/null
+++ b/libcxx/test/libcxx-03/feature_test_macro/generate_header_test.sh.py
@@ -0,0 +1,637 @@
+# ===----------------------------------------------------------------------===##
+#
+# Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+# See https://llvm.org/LICENSE.txt for license information.
+# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+#
+# ===----------------------------------------------------------------------===##
+
+# RUN: %{python} %s %{libcxx-dir}/utils %{libcxx-dir}/test/libcxx/feature_test_macro/test_data.json %t/tests
+# END.
+
+import os
+import sys
+import unittest
+
+UTILS = sys.argv[1]
+TEST_DATA = sys.argv[2]
+OUTPUT_PATH = sys.argv[3]
+del sys.argv[1:4]
+
+sys.path.append(UTILS)
+from generate_feature_test_macro_components import FeatureTestMacros
+
+
+class Test(unittest.TestCase):
+ def setUp(self):
+ self.ftm = FeatureTestMacros(TEST_DATA, ["charconv"])
+ self.maxDiff = None # This causes the diff to be printed when the test fails
+
+ self.expected = dict(
+ {
+ "algorithm": """\
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// WARNING: This test was generated by generate_feature_test_macro_components.py
+// and should not be edited manually.
+
+// <algorithm>
+
+// Test the feature test macros defined by <algorithm>
+
+// clang-format off
+
+#include <algorithm>
+#include "test_macros.h"
+
+#if TEST_STD_VER < 17
+
+# ifdef __cpp_lib_clamp
+# error "__cpp_lib_clamp should not be defined before c++17"
+# endif
+
+# ifdef __cpp_lib_parallel_algorithm
+# error "__cpp_lib_parallel_algorithm should not be defined before c++17"
+# endif
+
+#elif TEST_STD_VER == 17
+
+# ifndef __cpp_lib_clamp
+# error "__cpp_lib_clamp should be defined in c++17"
+# endif
+# if __cpp_lib_clamp != 201603L
+# error "__cpp_lib_clamp should have the value 201603L in c++17"
+# endif
+
+# ifndef __cpp_lib_parallel_algorithm
+# error "__cpp_lib_parallel_algorithm should be defined in c++17"
+# endif
+# if __cpp_lib_parallel_algorithm != 201603L
+# error "__cpp_lib_parallel_algorithm should have the value 201603L in c++17"
+# endif
+
+#elif TEST_STD_VER == 20
+
+# ifndef __cpp_lib_clamp
+# error "__cpp_lib_clamp should be defined in c++20"
+# endif
+# if __cpp_lib_clamp != 201603L
+# error "__cpp_lib_clamp should have the value 201603L in c++20"
+# endif
+
+# ifndef __cpp_lib_parallel_algorithm
+# error "__cpp_lib_parallel_algorithm should be defined in c++20"
+# endif
+# if __cpp_lib_parallel_algorithm != 201603L
+# error "__cpp_lib_parallel_algorithm should have the value 201603L in c++20"
+# endif
+
+#elif TEST_STD_VER == 23
+
+# ifndef __cpp_lib_clamp
+# error "__cpp_lib_clamp should be defined in c++23"
+# endif
+# if __cpp_lib_clamp != 201603L
+# error "__cpp_lib_clamp should have the value 201603L in c++23"
+# endif
+
+# ifndef __cpp_lib_parallel_algorithm
+# error "__cpp_lib_parallel_algorithm should be defined in c++23"
+# endif
+# if __cpp_lib_parallel_algorithm != 201603L
+# error "__cpp_lib_parallel_algorithm should have the value 201603L in c++23"
+# endif
+
+#elif TEST_STD_VER > 23
+
+# ifndef __cpp_lib_clamp
+# error "__cpp_lib_clamp should be defined in c++26"
+# endif
+# if __cpp_lib_clamp != 201603L
+# error "__cpp_lib_clamp should have the value 201603L in c++26"
+# endif
+
+# ifndef __cpp_lib_parallel_algorithm
+# error "__cpp_lib_parallel_algorithm should be defined in c++26"
+# endif
+# if __cpp_lib_parallel_algorithm != 201603L
+# error "__cpp_lib_parallel_algorithm should have the value 201603L in c++26"
+# endif
+
+#endif // TEST_STD_VER > 23
+
+// clang-format on
+
+""",
+ "any": """\
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// WARNING: This test was generated by generate_feature_test_macro_components.py
+// and should not be edited manually.
+
+// <any>
+
+// Test the feature test macros defined by <any>
+
+// clang-format off
+
+#include <any>
+#include "test_macros.h"
+
+#if TEST_STD_VER < 17
+
+# ifdef __cpp_lib_any
+# error "__cpp_lib_any should not be defined before c++17"
+# endif
+
+#elif TEST_STD_VER == 17
+
+# ifndef __cpp_lib_any
+# error "__cpp_lib_any should be defined in c++17"
+# endif
+# if __cpp_lib_any != 201606L
+# error "__cpp_lib_any should have the value 201606L in c++17"
+# endif
+
+#elif TEST_STD_VER == 20
+
+# ifndef __cpp_lib_any
+# error "__cpp_lib_any should be defined in c++20"
+# endif
+# if __cpp_lib_any != 201606L
+# error "__cpp_lib_any should have the value 201606L in c++20"
+# endif
+
+#elif TEST_STD_VER == 23
+
+# ifndef __cpp_lib_any
+# error "__cpp_lib_any should be defined in c++23"
+# endif
+# if __cpp_lib_any != 201606L
+# error "__cpp_lib_any should have the value 201606L in c++23"
+# endif
+
+#elif TEST_STD_VER > 23
+
+# ifndef __cpp_lib_any
+# error "__cpp_lib_any should be defined in c++26"
+# endif
+# if __cpp_lib_any != 201606L
+# error "__cpp_lib_any should have the value 201606L in c++26"
+# endif
+
+#endif // TEST_STD_VER > 23
+
+// clang-format on
+
+""",
+ "barrier": """\
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// WARNING: This test was generated by generate_feature_test_macro_components.py
+// and should not be edited manually.
+
+// UNSUPPORTED: no-threads
+
+// <barrier>
+
+// Test the feature test macros defined by <barrier>
+
+// clang-format off
+
+#include <barrier>
+#include "test_macros.h"
+
+#if TEST_STD_VER < 17
+
+# ifdef __cpp_lib_barrier
+# error "__cpp_lib_barrier should not be defined before c++20"
+# endif
+
+#elif TEST_STD_VER == 17
+
+# ifdef __cpp_lib_barrier
+# error "__cpp_lib_barrier should not be defined before c++20"
+# endif
+
+#elif TEST_STD_VER == 20
+
+# if !defined(_LIBCPP_VERSION) || (_LIBCPP_HAS_THREADS && _LIBCPP_AVAILABILITY_HAS_SYNC)
+# ifndef __cpp_lib_barrier
+# error "__cpp_lib_barrier should be defined in c++20"
+# endif
+# if __cpp_lib_barrier != 201907L
+# error "__cpp_lib_barrier should have the value 201907L in c++20"
+# endif
+# else
+# ifdef __cpp_lib_barrier
+# error "__cpp_lib_barrier should not be defined when the requirement '!defined(_LIBCPP_VERSION) || (_LIBCPP_HAS_THREADS && _LIBCPP_AVAILABILITY_HAS_SYNC)' is not met!"
+# endif
+# endif
+
+#elif TEST_STD_VER == 23
+
+# if !defined(_LIBCPP_VERSION) || (_LIBCPP_HAS_THREADS && _LIBCPP_AVAILABILITY_HAS_SYNC)
+# ifndef __cpp_lib_barrier
+# error "__cpp_lib_barrier should be defined in c++23"
+# endif
+# if __cpp_lib_barrier != 201907L
+# error "__cpp_lib_barrier should have the value 201907L in c++23"
+# endif
+# else
+# ifdef __cpp_lib_barrier
+# error "__cpp_lib_barrier should not be defined when the requirement '!defined(_LIBCPP_VERSION) || (_LIBCPP_HAS_THREADS && _LIBCPP_AVAILABILITY_HAS_SYNC)' is not met!"
+# endif
+# endif
+
+#elif TEST_STD_VER > 23
+
+# if !defined(_LIBCPP_VERSION) || (_LIBCPP_HAS_THREADS && _LIBCPP_AVAILABILITY_HAS_SYNC)
+# ifndef __cpp_lib_barrier
+# error "__cpp_lib_barrier should be defined in c++26"
+# endif
+# if __cpp_lib_barrier != 299900L
+# error "__cpp_lib_barrier should have the value 299900L in c++26"
+# endif
+# else
+# ifdef __cpp_lib_barrier
+# error "__cpp_lib_barrier should not be defined when the requirement '!defined(_LIBCPP_VERSION) || (_LIBCPP_HAS_THREADS && _LIBCPP_AVAILABILITY_HAS_SYNC)' is not met!"
+# endif
+# endif
+
+#endif // TEST_STD_VER > 23
+
+// clang-format on
+
+""",
+ "charconv": """\
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// WARNING: This test was generated by generate_feature_test_macro_components.py
+// and should not be edited manually.
+
+// <charconv>
+
+// Test the feature test macros defined by <charconv>
+
+// clang-format off
+
+#if !defined(_WIN32) && __has_include(<charconv>)
+# include <charconv>
+#endif
+#include "test_macros.h"
+
+#if TEST_STD_VER < 17
+
+# ifdef __cpp_lib_to_chars
+# error "__cpp_lib_to_chars should not be defined before c++17"
+# endif
+
+#elif TEST_STD_VER == 17
+
+# if !defined(_LIBCPP_VERSION)
+# ifndef __cpp_lib_to_chars
+# error "__cpp_lib_to_chars should be defined in c++17"
+# endif
+# if __cpp_lib_to_chars != 201611L
+# error "__cpp_lib_to_chars should have the value 201611L in c++17"
+# endif
+# else
+# ifdef __cpp_lib_to_chars
+# error "__cpp_lib_to_chars should not be defined because it is unimplemented in libc++!"
+# endif
+# endif
+
+#elif TEST_STD_VER == 20
+
+# if !defined(_LIBCPP_VERSION)
+# ifndef __cpp_lib_to_chars
+# error "__cpp_lib_to_chars should be defined in c++20"
+# endif
+# if __cpp_lib_to_chars != 201611L
+# error "__cpp_lib_to_chars should have the value 201611L in c++20"
+# endif
+# else
+# ifdef __cpp_lib_to_chars
+# error "__cpp_lib_to_chars should not be defined because it is unimplemented in libc++!"
+# endif
+# endif
+
+#elif TEST_STD_VER == 23
+
+# if !defined(_LIBCPP_VERSION)
+# ifndef __cpp_lib_to_chars
+# error "__cpp_lib_to_chars should be defined in c++23"
+# endif
+# if __cpp_lib_to_chars != 201611L
+# error "__cpp_lib_to_chars should have the value 201611L in c++23"
+# endif
+# else
+# ifdef __cpp_lib_to_chars
+# error "__cpp_lib_to_chars should not be defined because it is unimplemented in libc++!"
+# endif
+# endif
+
+#elif TEST_STD_VER > 23
+
+# if !defined(_LIBCPP_VERSION)
+# ifndef __cpp_lib_to_chars
+# error "__cpp_lib_to_chars should be defined in c++26"
+# endif
+# if __cpp_lib_to_chars != 201611L
+# error "__cpp_lib_to_chars should have the value 201611L in c++26"
+# endif
+# else
+# ifdef __cpp_lib_to_chars
+# error "__cpp_lib_to_chars should not be defined because it is unimplemented in libc++!"
+# endif
+# endif
+
+#endif // TEST_STD_VER > 23
+
+// clang-format on
+
+""",
+ "format": """\
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// WARNING: This test was generated by generate_feature_test_macro_components.py
+// and should not be edited manually.
+
+// <format>
+
+// Test the feature test macros defined by <format>
+
+// clang-format off
+
+#include <format>
+#include "test_macros.h"
+
+#if TEST_STD_VER < 17
+
+# ifdef __cpp_lib_format
+# error "__cpp_lib_format should not be defined before c++20"
+# endif
+
+#elif TEST_STD_VER == 17
+
+# ifdef __cpp_lib_format
+# error "__cpp_lib_format should not be defined before c++20"
+# endif
+
+#elif TEST_STD_VER == 20
+
+# if !defined(_LIBCPP_VERSION)
+# ifndef __cpp_lib_format
+# error "__cpp_lib_format should be defined in c++20"
+# endif
+# if __cpp_lib_format != 202110L
+# error "__cpp_lib_format should have the value 202110L in c++20"
+# endif
+# else
+# ifdef __cpp_lib_format
+# error "__cpp_lib_format should not be defined because it is unimplemented in libc++!"
+# endif
+# endif
+
+#elif TEST_STD_VER == 23
+
+# if !defined(_LIBCPP_VERSION)
+# ifndef __cpp_lib_format
+# error "__cpp_lib_format should be defined in c++23"
+# endif
+# if __cpp_lib_format != 202207L
+# error "__cpp_lib_format should have the value 202207L in c++23"
+# endif
+# else
+# ifdef __cpp_lib_format
+# error "__cpp_lib_format should not be defined because it is unimplemented in libc++!"
+# endif
+# endif
+
+#elif TEST_STD_VER > 23
+
+# if !defined(_LIBCPP_VERSION)
+# ifndef __cpp_lib_format
+# error "__cpp_lib_format should be defined in c++26"
+# endif
+# if __cpp_lib_format != 202311L
+# error "__cpp_lib_format should have the value 202311L in c++26"
+# endif
+# else
+# ifdef __cpp_lib_format
+# error "__cpp_lib_format should not be defined because it is unimplemented in libc++!"
+# endif
+# endif
+
+#endif // TEST_STD_VER > 23
+
+// clang-format on
+
+""",
+ "numeric": """\
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// WARNING: This test was generated by generate_feature_test_macro_components.py
+// and should not be edited manually.
+
+// <numeric>
+
+// Test the feature test macros defined by <numeric>
+
+// clang-format off
+
+#include <numeric>
+#include "test_macros.h"
+
+#if TEST_STD_VER < 17
+
+# ifdef __cpp_lib_parallel_algorithm
+# error "__cpp_lib_parallel_algorithm should not be defined before c++17"
+# endif
+
+#elif TEST_STD_VER == 17
+
+# ifndef __cpp_lib_parallel_algorithm
+# error "__cpp_lib_parallel_algorithm should be defined in c++17"
+# endif
+# if __cpp_lib_parallel_algorithm != 201603L
+# error "__cpp_lib_parallel_algorithm should have the value 201603L in c++17"
+# endif
+
+#elif TEST_STD_VER == 20
+
+# ifndef __cpp_lib_parallel_algorithm
+# error "__cpp_lib_parallel_algorithm should be defined in c++20"
+# endif
+# if __cpp_lib_parallel_algorithm != 201603L
+# error "__cpp_lib_parallel_algorithm should have the value 201603L in c++20"
+# endif
+
+#elif TEST_STD_VER == 23
+
+# ifndef __cpp_lib_parallel_algorithm
+# error "__cpp_lib_parallel_algorithm should be defined in c++23"
+# endif
+# if __cpp_lib_parallel_algorithm != 201603L
+# error "__cpp_lib_parallel_algorithm should have the value 201603L in c++23"
+# endif
+
+#elif TEST_STD_VER > 23
+
+# ifndef __cpp_lib_parallel_algorithm
+# error "__cpp_lib_parallel_algorithm should be defined in c++26"
+# endif
+# if __cpp_lib_parallel_algorithm != 201603L
+# error "__cpp_lib_parallel_algorithm should have the value 201603L in c++26"
+# endif
+
+#endif // TEST_STD_VER > 23
+
+// clang-format on
+
+""",
+ "variant": """\
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// WARNING: This test was generated by generate_feature_test_macro_components.py
+// and should not be edited manually.
+
+// <variant>
+
+// Test the feature test macros defined by <variant>
+
+// clang-format off
+
+#include <variant>
+#include "test_macros.h"
+
+#if TEST_STD_VER < 17
+
+# ifdef __cpp_lib_variant
+# error "__cpp_lib_variant should not be defined before c++17"
+# endif
+
+#elif TEST_STD_VER == 17
+
+# ifndef __cpp_lib_variant
+# error "__cpp_lib_variant should be defined in c++17"
+# endif
+# if __cpp_lib_variant != 202102L
+# error "__cpp_lib_variant should have the value 202102L in c++17"
+# endif
+
+#elif TEST_STD_VER == 20
+
+# if !defined(_LIBCPP_VERSION)
+# ifndef __cpp_lib_variant
+# error "__cpp_lib_variant should be defined in c++20"
+# endif
+# if __cpp_lib_variant != 202106L
+# error "__cpp_lib_variant should have the value 202106L in c++20"
+# endif
+# else
+# ifdef __cpp_lib_variant
+# error "__cpp_lib_variant should not be defined because it is unimplemented in libc++!"
+# endif
+# endif
+
+#elif TEST_STD_VER == 23
+
+# if !defined(_LIBCPP_VERSION)
+# ifndef __cpp_lib_variant
+# error "__cpp_lib_variant should be defined in c++23"
+# endif
+# if __cpp_lib_variant != 202106L
+# error "__cpp_lib_variant should have the value 202106L in c++23"
+# endif
+# else
+# ifdef __cpp_lib_variant
+# error "__cpp_lib_variant should not be defined because it is unimplemented in libc++!"
+# endif
+# endif
+
+#elif TEST_STD_VER > 23
+
+# if !defined(_LIBCPP_VERSION)
+# ifndef __cpp_lib_variant
+# error "__cpp_lib_variant should be defined in c++26"
+# endif
+# if __cpp_lib_variant != 202306L
+# error "__cpp_lib_variant should have the value 202306L in c++26"
+# endif
+# else
+# ifdef __cpp_lib_variant
+# error "__cpp_lib_variant should not be defined because it is unimplemented in libc++!"
+# endif
+# endif
+
+#endif // TEST_STD_VER > 23
+
+// clang-format on
+
+""",
+ }
+ )
+
+ def test_implementation(self):
+ # Generate the output
+ self.ftm.generate_header_test_directory(OUTPUT_PATH)
+
+ for key, value in self.expected.items():
+ # Test whether the per header generate function generates the proper output.
+ self.assertEqual(self.ftm.generate_header_test_file(key), value)
+
+ # Test whether all header generate function generates the proper output.
+ with open(
+ os.path.join(OUTPUT_PATH, f"{key}.version.compile.pass.cpp"),
+ "r",
+ newline="\n",
+ ) as f:
+ self.assertEqual(f.read(), value)
+
+
+if __name__ == "__main__":
+ unittest.main()
diff --git a/libcxx/test/libcxx-03/feature_test_macro/implemented_ftms.sh.py b/libcxx/test/libcxx-03/feature_test_macro/implemented_ftms.sh.py
new file mode 100644
index 0000000000000..2ca639e95e986
--- /dev/null
+++ b/libcxx/test/libcxx-03/feature_test_macro/implemented_ftms.sh.py
@@ -0,0 +1,68 @@
+# ===----------------------------------------------------------------------===##
+#
+# Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+# See https://llvm.org/LICENSE.txt for license information.
+# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+#
+# ===----------------------------------------------------------------------===##
+
+# RUN: %{python} %s %{libcxx-dir}/utils %{libcxx-dir}/test/libcxx/feature_test_macro/test_data.json
+
+import sys
+import unittest
+
+UTILS = sys.argv[1]
+TEST_DATA = sys.argv[2]
+del sys.argv[1:3]
+
+sys.path.append(UTILS)
+from generate_feature_test_macro_components import FeatureTestMacros
+
+
+class Test(unittest.TestCase):
+ def setUp(self):
+ self.ftm = FeatureTestMacros(TEST_DATA, ["charconv"])
+ self.maxDiff = None # This causes the diff to be printed when the test fails
+
+ def test_implementation(self):
+
+ expected = {
+ "__cpp_lib_any": {
+ "c++17": "201606L",
+ "c++20": "201606L",
+ "c++23": "201606L",
+ "c++26": "201606L",
+ },
+ "__cpp_lib_barrier": {
+ "c++20": "201907L",
+ "c++23": "201907L",
+ "c++26": "299900L",
+ },
+ "__cpp_lib_clamp": {
+ "c++17": "201603L",
+ "c++20": "201603L",
+ "c++23": "201603L",
+ "c++26": "201603L",
+ },
+ "__cpp_lib_format": {},
+ "__cpp_lib_parallel_algorithm": {
+ "c++17": "201603L",
+ "c++20": "201603L",
+ "c++23": "201603L",
+ "c++26": "201603L",
+ },
+ "__cpp_lib_to_chars": {},
+ "__cpp_lib_variant": {
+ "c++17": "202102L",
+ "c++20": "202102L",
+ "c++23": "202102L",
+ "c++26": "202102L",
+ },
+ "__cpp_lib_zz_missing_FTM_in_older_standard": {},
+ }
+
+ self.assertEqual(self.ftm.implemented_ftms, expected)
+
+
+if __name__ == "__main__":
+ unittest.main()
diff --git a/libcxx/test/libcxx-03/feature_test_macro/invalid.sh.py b/libcxx/test/libcxx-03/feature_test_macro/invalid.sh.py
new file mode 100644
index 0000000000000..4488af3244dd9
--- /dev/null
+++ b/libcxx/test/libcxx-03/feature_test_macro/invalid.sh.py
@@ -0,0 +1,108 @@
+# ===----------------------------------------------------------------------===##
+#
+# Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+# See https://llvm.org/LICENSE.txt for license information.
+# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+#
+# ===----------------------------------------------------------------------===##
+
+# RUN: %{python} %s %{libcxx-dir}/utils %t
+
+import sys
+import json
+
+sys.path.append(sys.argv[1])
+from generate_feature_test_macro_components import FeatureTestMacros
+
+
+def test(output, expected):
+ assert output == expected, f"expected\n{expected}\n\noutput\n{output}"
+
+
+def test_error(data, type, message):
+ tmp = sys.argv[2]
+ with open(tmp, "w") as file:
+ file.write(json.dumps(data))
+ ftm = FeatureTestMacros(tmp, ["charconv"])
+ try:
+ ftm.implemented_ftms
+ except type as error:
+ test(str(error), message)
+ else:
+ assert False, "no exception was thrown"
+
+
+test_error(
+ [
+ {
+ "values": {
+ "c++17": {
+ "197001": [
+ {
+ "implemented": False,
+ },
+ ],
+ },
+ },
+ "headers": [],
+ },
+ ],
+ KeyError,
+ "'name'",
+)
+
+test_error(
+ [
+ {
+ "name": "a",
+ "headers": [],
+ },
+ ],
+ KeyError,
+ "'values'",
+)
+
+test_error(
+ [
+ {
+ "name": "a",
+ "values": {},
+ "headers": [],
+ },
+ ],
+ AssertionError,
+ "'values' is empty",
+)
+
+
+test_error(
+ [
+ {
+ "name": "a",
+ "values": {
+ "c++17": {},
+ },
+ "headers": [],
+ },
+ ],
+ AssertionError,
+ "a[c++17] has no entries",
+)
+
+test_error(
+ [
+ {
+ "name": "a",
+ "values": {
+ "c++17": {
+ "197001": [
+ {},
+ ],
+ },
+ },
+ "headers": [],
+ },
+ ],
+ KeyError,
+ "'implemented'",
+)
diff --git a/libcxx/test/libcxx-03/feature_test_macro/is_implemented.sh.py b/libcxx/test/libcxx-03/feature_test_macro/is_implemented.sh.py
new file mode 100644
index 0000000000000..1ccba5ea74ec4
--- /dev/null
+++ b/libcxx/test/libcxx-03/feature_test_macro/is_implemented.sh.py
@@ -0,0 +1,39 @@
+# ===----------------------------------------------------------------------===##
+#
+# Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+# See https://llvm.org/LICENSE.txt for license information.
+# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+#
+# ===----------------------------------------------------------------------===##
+
+# RUN: %{python} %s %{libcxx-dir}/utils %{libcxx-dir}/test/libcxx/feature_test_macro/test_data.json
+
+import sys
+import unittest
+
+UTILS = sys.argv[1]
+TEST_DATA = sys.argv[2]
+del sys.argv[1:3]
+
+sys.path.append(UTILS)
+from generate_feature_test_macro_components import FeatureTestMacros, Metadata
+
+
+class Test(unittest.TestCase):
+ def setUp(self):
+ self.ftm = FeatureTestMacros(TEST_DATA, ["charconv"])
+ self.maxDiff = None # This causes the diff to be printed when the test fails
+
+ def test_implementation(self):
+ # FTM not available in C++14.
+ self.assertEqual(self.ftm.is_implemented("__cpp_lib_any", "c++14"), False)
+ self.assertEqual(self.ftm.is_implemented("__cpp_lib_any", "c++17"), True)
+
+ self.assertEqual(self.ftm.is_implemented("__cpp_lib_format", "c++20"), False)
+
+ # FTM C++20 202106L, libc++ has 202102L
+ self.assertEqual(self.ftm.is_implemented("__cpp_lib_variant", "c++20"), False)
+
+
+if __name__ == "__main__":
+ unittest.main()
diff --git a/libcxx/test/libcxx-03/feature_test_macro/standard_ftms.sh.py b/libcxx/test/libcxx-03/feature_test_macro/standard_ftms.sh.py
new file mode 100644
index 0000000000000..1a8d4437faa0a
--- /dev/null
+++ b/libcxx/test/libcxx-03/feature_test_macro/standard_ftms.sh.py
@@ -0,0 +1,81 @@
+# ===----------------------------------------------------------------------===##
+#
+# Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+# See https://llvm.org/LICENSE.txt for license information.
+# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+#
+# ===----------------------------------------------------------------------===##
+
+# RUN: %{python} %s %{libcxx-dir}/utils %{libcxx-dir}/test/libcxx/feature_test_macro/test_data.json
+
+import sys
+import unittest
+
+UTILS = sys.argv[1]
+TEST_DATA = sys.argv[2]
+del sys.argv[1:3]
+
+sys.path.append(UTILS)
+from generate_feature_test_macro_components import FeatureTestMacros
+
+
+class Test(unittest.TestCase):
+ def setUp(self):
+ self.ftm = FeatureTestMacros(TEST_DATA, ["charconv"])
+ self.maxDiff = None # This causes the diff to be printed when the test fails
+
+ def test_implementation(self):
+ expected = {
+ "__cpp_lib_any": {
+ "c++17": "201606L",
+ "c++20": "201606L",
+ "c++23": "201606L",
+ "c++26": "201606L",
+ },
+ "__cpp_lib_barrier": {
+ "c++20": "201907L",
+ "c++23": "201907L",
+ "c++26": "299900L",
+ },
+ "__cpp_lib_clamp": {
+ "c++17": "201603L",
+ "c++20": "201603L",
+ "c++23": "201603L",
+ "c++26": "201603L",
+ },
+ "__cpp_lib_format": {
+ "c++20": "202110L",
+ "c++23": "202207L",
+ "c++26": "202311L",
+ },
+ "__cpp_lib_parallel_algorithm": {
+ "c++17": "201603L",
+ "c++20": "201603L",
+ "c++23": "201603L",
+ "c++26": "201603L",
+ },
+ "__cpp_lib_to_chars": {
+ "c++17": "201611L",
+ "c++20": "201611L",
+ "c++23": "201611L",
+ "c++26": "201611L",
+ },
+ "__cpp_lib_variant": {
+ "c++17": "202102L",
+ "c++20": "202106L",
+ "c++23": "202106L",
+ "c++26": "202306L",
+ },
+ "__cpp_lib_zz_missing_FTM_in_older_standard": {
+ "c++17": "2017L",
+ "c++20": "2020L",
+ "c++23": "2020L",
+ "c++26": "2026L",
+ },
+ }
+
+ self.assertEqual(self.ftm.standard_ftms, expected)
+
+
+if __name__ == "__main__":
+ unittest.main()
diff --git a/libcxx/test/libcxx-03/feature_test_macro/standard_library_headers.sh.py b/libcxx/test/libcxx-03/feature_test_macro/standard_library_headers.sh.py
new file mode 100644
index 0000000000000..27a2953a2e321
--- /dev/null
+++ b/libcxx/test/libcxx-03/feature_test_macro/standard_library_headers.sh.py
@@ -0,0 +1,44 @@
+# ===----------------------------------------------------------------------===##
+#
+# Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+# See https://llvm.org/LICENSE.txt for license information.
+# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+#
+# ===----------------------------------------------------------------------===##
+
+# RUN: %{python} %s %{libcxx-dir}/utils %{libcxx-dir}/test/libcxx/feature_test_macro/test_data.json
+
+import sys
+
+import unittest
+
+UTILS = sys.argv[1]
+TEST_DATA = sys.argv[2]
+del sys.argv[1:3]
+
+sys.path.append(UTILS)
+from generate_feature_test_macro_components import FeatureTestMacros, Metadata
+
+
+class Test(unittest.TestCase):
+ def setUp(self):
+ self.ftm = FeatureTestMacros(TEST_DATA, ["charconv"])
+ self.maxDiff = None # This causes the diff to be printed when the test fails
+
+ def test_implementation(self):
+ self.assertEqual(
+ sorted(self.ftm.standard_library_headers),
+ [
+ "algorithm",
+ "any",
+ "barrier",
+ "charconv",
+ "format",
+ "numeric",
+ "variant",
+ ],
+ )
+
+
+if __name__ == "__main__":
+ unittest.main()
diff --git a/libcxx/test/libcxx-03/feature_test_macro/std_dialects.sh.py b/libcxx/test/libcxx-03/feature_test_macro/std_dialects.sh.py
new file mode 100644
index 0000000000000..f01dcb2f3c45c
--- /dev/null
+++ b/libcxx/test/libcxx-03/feature_test_macro/std_dialects.sh.py
@@ -0,0 +1,39 @@
+# ===----------------------------------------------------------------------===##
+#
+# Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+# See https://llvm.org/LICENSE.txt for license information.
+# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+#
+# ===----------------------------------------------------------------------===##
+
+# RUN: %{python} %s %{libcxx-dir}/utils %{libcxx-dir}/test/libcxx/feature_test_macro/test_data.json
+
+import sys
+import unittest
+
+UTILS = sys.argv[1]
+TEST_DATA = sys.argv[2]
+del sys.argv[1:3]
+
+sys.path.append(UTILS)
+from generate_feature_test_macro_components import FeatureTestMacros
+
+
+class Test(unittest.TestCase):
+ def setUp(self):
+ self.ftm = FeatureTestMacros(TEST_DATA, ["charconv"])
+ self.maxDiff = None # This causes the diff to be printed when the test fails
+
+ def test_implementation(self):
+ expected = [
+ "c++17",
+ "c++20",
+ "c++23",
+ "c++26",
+ ]
+
+ self.assertEqual(self.ftm.std_dialects, expected)
+
+
+if __name__ == "__main__":
+ unittest.main()
diff --git a/libcxx/test/libcxx-03/feature_test_macro/test_data.json b/libcxx/test/libcxx-03/feature_test_macro/test_data.json
new file mode 100644
index 0000000000000..b0122163f714f
--- /dev/null
+++ b/libcxx/test/libcxx-03/feature_test_macro/test_data.json
@@ -0,0 +1,213 @@
+[
+ {
+ "name": "__cpp_lib_any",
+ "values": {
+ "c++17": {
+ "201606": [
+ {
+ "implemented": true
+ }
+ ]
+ }
+ },
+ "headers": [
+ "any"
+ ]
+ },
+ {
+ "name": "__cpp_lib_barrier",
+ "values": {
+ "c++20": {
+ "201907": [
+ {
+ "implemented": true
+ }
+ ]
+ },
+ "c++26": {
+ "299900": [
+ {
+ "implemented": true
+ }
+ ]
+ }
+ },
+ "headers": [
+ "barrier"
+ ],
+ "test_suite_guard": "!defined(_LIBCPP_VERSION) || (_LIBCPP_HAS_THREADS && _LIBCPP_AVAILABILITY_HAS_SYNC)",
+ "libcxx_guard": "_LIBCPP_HAS_THREADS && _LIBCPP_AVAILABILITY_HAS_SYNC"
+ },
+ {
+ "name": "__cpp_lib_clamp",
+ "values": {
+ "c++17": {
+ "201603": [
+ {
+ "implemented": true
+ }
+ ]
+ }
+ },
+ "headers": ["algorithm"]
+ },
+ {
+ "name": "__cpp_lib_format",
+ "values": {
+ "c++20": {
+ "201907": [
+ {
+ "number": "P0645R10",
+ "title": "Text Formatting",
+ "implemented": true
+ },
+ {
+ "number": "P1361R2",
+ "title": "Integration of chrono with text formatting",
+ "implemented": false
+ }
+ ],
+ "202106": [
+ {
+ "number": "P2216R3",
+ "title": "std::format improvements",
+ "implemented": true
+ }
+ ],
+ "202110": [
+ {
+ "number": "P2372R3",
+ "title": "Fixing locale handling in chrono formatters",
+ "implemented": false
+ },
+ {
+ "number": "P2418R2",
+ "title": "FAdd support for std::generator-like types to std::format",
+ "implemented": true
+ }
+ ]
+ },
+ "c++23": {
+ "202207": [
+ {
+ "number": "P2419R2",
+ "title": "Clarify handling of encodings in localized formatting of chrono types",
+ "implemented": false
+ }
+ ]
+ },
+ "c++26": {
+ "202306": [
+ {
+ "number": "P2637R3",
+ "title": "Member Visit",
+ "implemented": true
+ }
+ ],
+ "202311": [
+ {
+ "number": "P2918R2",
+ "title": "Runtime format strings II",
+ "implemented": true
+ }
+ ]
+ }
+ },
+ "headers": [
+ "format"
+ ]
+ },
+ {
+ "name": "__cpp_lib_parallel_algorithm",
+ "values": {
+ "c++17": {
+ "201603": [
+ {
+ "implemented": true
+ }
+ ]
+ }
+ },
+ "headers": [
+ "algorithm",
+ "numeric"
+ ]
+ },
+ {
+ "name": "__cpp_lib_to_chars",
+ "values": {
+ "c++17": {
+ "201611": [
+ {
+ "implemented": false
+ }
+ ]
+ }
+ },
+ "headers": ["charconv"]
+ },
+ {
+ "name": "__cpp_lib_variant",
+ "values": {
+ "c++17": {
+ "202102": [
+ {
+ "title": "``std::visit`` for classes derived from ``std::variant``",
+ "implemented": true
+ }
+ ]
+ },
+ "c++20": {
+ "202106": [
+ {
+ "number": "",
+ "title": "Fully constexpr ``std::variant``",
+ "implemented": false
+ }
+ ]
+ },
+ "c++26": {
+ "202306": [
+ {
+ "number": "",
+ "title": "Member visit",
+ "implemented": true
+ }
+ ]
+ }
+ },
+ "headers": [
+ "variant"
+ ]
+ },
+ {
+ "name": "__cpp_lib_zz_missing_FTM_in_older_standard",
+ "values": {
+ "c++17": {
+ "2017": [
+ {
+ "title": "Some FTM missing a paper in an older Standard mode, which should result in the FTM never being defined.",
+ "implemented": false
+ }
+ ]
+ },
+ "c++20": {
+ "2020": [
+ {
+ "title": "",
+ "implemented": true
+ }
+ ]
+ },
+ "c++26": {
+ "2026": [
+ {
+ "title": "",
+ "implemented": true
+ }
+ ]
+ }
+ },
+ "headers": []
+ }
+]
diff --git a/libcxx/test/libcxx-03/feature_test_macro/version_header.sh.py b/libcxx/test/libcxx-03/feature_test_macro/version_header.sh.py
new file mode 100644
index 0000000000000..fa645c735f0bc
--- /dev/null
+++ b/libcxx/test/libcxx-03/feature_test_macro/version_header.sh.py
@@ -0,0 +1,84 @@
+# ===----------------------------------------------------------------------===##
+#
+# Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+# See https://llvm.org/LICENSE.txt for license information.
+# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+#
+# ===----------------------------------------------------------------------===##
+
+# RUN: %{python} %s %{libcxx-dir}/utils %{libcxx-dir}/test/libcxx/feature_test_macro/test_data.json
+
+import sys
+import unittest
+
+UTILS = sys.argv[1]
+TEST_DATA = sys.argv[2]
+del sys.argv[1:3]
+
+sys.path.append(UTILS)
+from generate_feature_test_macro_components import FeatureTestMacros
+
+
+class Test(unittest.TestCase):
+ def setUp(self):
+ self.ftm = FeatureTestMacros(TEST_DATA, ["charconv"])
+ self.maxDiff = None # This causes the diff to be printed when the test fails
+
+ def test_implementeation(self):
+ expected = """// -*- C++ -*-
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef _LIBCPP_VERSIONH
+#define _LIBCPP_VERSIONH
+
+#include <__config>
+
+#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
+# pragma GCC system_header
+#endif
+
+#if _LIBCPP_STD_VER >= 17
+# define __cpp_lib_any 201606L
+# define __cpp_lib_clamp 201603L
+# define __cpp_lib_parallel_algorithm 201603L
+// define __cpp_lib_to_chars 201611L
+# define __cpp_lib_variant 202102L
+// define __cpp_lib_zz_missing_FTM_in_older_standard 2017L
+#endif // _LIBCPP_STD_VER >= 17
+
+#if _LIBCPP_STD_VER >= 20
+# if _LIBCPP_HAS_THREADS && _LIBCPP_AVAILABILITY_HAS_SYNC
+# define __cpp_lib_barrier 201907L
+# endif
+// define __cpp_lib_format 202110L
+// define __cpp_lib_variant 202106L
+// define __cpp_lib_zz_missing_FTM_in_older_standard 2020L
+#endif // _LIBCPP_STD_VER >= 20
+
+#if _LIBCPP_STD_VER >= 23
+// define __cpp_lib_format 202207L
+#endif // _LIBCPP_STD_VER >= 23
+
+#if _LIBCPP_STD_VER >= 26
+# if _LIBCPP_HAS_THREADS && _LIBCPP_AVAILABILITY_HAS_SYNC
+# undef __cpp_lib_barrier
+# define __cpp_lib_barrier 299900L
+# endif
+// define __cpp_lib_format 202311L
+// define __cpp_lib_variant 202306L
+// define __cpp_lib_zz_missing_FTM_in_older_standard 2026L
+#endif // _LIBCPP_STD_VER >= 26
+
+#endif // _LIBCPP_VERSIONH
+"""
+ self.assertEqual(self.ftm.version_header, expected)
+
+
+if __name__ == "__main__":
+ unittest.main()
diff --git a/libcxx/test/libcxx-03/feature_test_macro/version_header_implementation.sh.py b/libcxx/test/libcxx-03/feature_test_macro/version_header_implementation.sh.py
new file mode 100644
index 0000000000000..6118a65b78357
--- /dev/null
+++ b/libcxx/test/libcxx-03/feature_test_macro/version_header_implementation.sh.py
@@ -0,0 +1,163 @@
+# ===----------------------------------------------------------------------===##
+#
+# Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+# See https://llvm.org/LICENSE.txt for license information.
+# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+#
+# ===----------------------------------------------------------------------===##
+
+# RUN: %{python} %s %{libcxx-dir}/utils %{libcxx-dir}/test/libcxx/feature_test_macro/test_data.json
+
+import sys
+import unittest
+
+UTILS = sys.argv[1]
+TEST_DATA = sys.argv[2]
+del sys.argv[1:3]
+
+sys.path.append(UTILS)
+from generate_feature_test_macro_components import FeatureTestMacros, VersionHeader
+
+
+class Test(unittest.TestCase):
+ def setUp(self):
+ self.ftm = FeatureTestMacros(TEST_DATA, ["charconv"])
+ self.maxDiff = None # This causes the diff to be printed when the test fails
+
+ def test_implementation(self):
+ expected = {
+ "17": [
+ {
+ "__cpp_lib_any": VersionHeader(
+ value="201606L",
+ implemented=True,
+ need_undef=False,
+ condition=None,
+ ),
+ },
+ {
+ "__cpp_lib_clamp": VersionHeader(
+ value="201603L",
+ implemented=True,
+ need_undef=False,
+ condition=None,
+ )
+ },
+ {
+ "__cpp_lib_parallel_algorithm": VersionHeader(
+ value="201603L",
+ implemented=True,
+ need_undef=False,
+ condition=None,
+ ),
+ },
+ {
+ "__cpp_lib_to_chars": VersionHeader(
+ value="201611L",
+ implemented=False,
+ need_undef=False,
+ condition=None,
+ ),
+ },
+ {
+ "__cpp_lib_variant": VersionHeader(
+ value="202102L",
+ implemented=True,
+ need_undef=False,
+ condition=None,
+ ),
+ },
+ {
+ "__cpp_lib_zz_missing_FTM_in_older_standard": VersionHeader(
+ value="2017L",
+ implemented=False,
+ need_undef=False,
+ condition=None,
+ ),
+ },
+ ],
+ "20": [
+ {
+ "__cpp_lib_barrier": VersionHeader(
+ value="201907L",
+ implemented=True,
+ need_undef=False,
+ condition="_LIBCPP_HAS_THREADS && _LIBCPP_AVAILABILITY_HAS_SYNC",
+ ),
+ },
+ {
+ "__cpp_lib_format": VersionHeader(
+ value="202110L",
+ implemented=False,
+ need_undef=False,
+ condition=None,
+ ),
+ },
+ {
+ "__cpp_lib_variant": VersionHeader(
+ value="202106L",
+ implemented=False,
+ need_undef=False,
+ condition=None,
+ ),
+ },
+ {
+ "__cpp_lib_zz_missing_FTM_in_older_standard": VersionHeader(
+ value="2020L",
+ implemented=False,
+ need_undef=False,
+ condition=None,
+ ),
+ },
+ ],
+ "23": [
+ {
+ "__cpp_lib_format": VersionHeader(
+ value="202207L",
+ implemented=False,
+ need_undef=False,
+ condition=None,
+ ),
+ },
+ ],
+ "26": [
+ {
+ "__cpp_lib_barrier": VersionHeader(
+ value="299900L",
+ implemented=True,
+ need_undef=True,
+ condition="_LIBCPP_HAS_THREADS && _LIBCPP_AVAILABILITY_HAS_SYNC",
+ ),
+ },
+ {
+ "__cpp_lib_format": VersionHeader(
+ value="202311L",
+ implemented=False,
+ need_undef=False,
+ condition=None,
+ ),
+ },
+ {
+ "__cpp_lib_variant": VersionHeader(
+ value="202306L",
+ implemented=False,
+ need_undef=False,
+ condition=None,
+ ),
+ },
+ {
+ "__cpp_lib_zz_missing_FTM_in_older_standard": VersionHeader(
+ value="2026L",
+ implemented=False,
+ need_undef=False,
+ condition=None,
+ ),
+ },
+ ],
+ }
+
+ self.assertEqual(self.ftm.version_header_implementation, expected)
+
+
+if __name__ == "__main__":
+ unittest.main()
diff --git a/libcxx/test/libcxx-03/gdb/gdb_pretty_printer_test.py b/libcxx/test/libcxx-03/gdb/gdb_pretty_printer_test.py
new file mode 100644
index 0000000000000..da09092b690c4
--- /dev/null
+++ b/libcxx/test/libcxx-03/gdb/gdb_pretty_printer_test.py
@@ -0,0 +1,162 @@
+# ===----------------------------------------------------------------------===##
+#
+# Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+# See https://llvm.org/LICENSE.txt for license information.
+# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+#
+# ===----------------------------------------------------------------------===##
+"""Commands used to automate testing gdb pretty printers.
+
+This script is part of a larger framework to test gdb pretty printers. It
+runs the program, detects test cases, checks them, and prints results.
+
+See gdb_pretty_printer_test.sh.cpp on how to write a test case.
+
+"""
+
+from __future__ import print_function
+import json
+import re
+import gdb
+import sys
+
+test_failures = 0
+# Sometimes the inital run command can fail to trace the process.
+# (e.g. you don't have ptrace permissions)
+# In these cases gdb still sends us an exited event so we cannot
+# see what "run" printed to check for a warning message, since
+# we get taken to our exit handler before we can look.
+# Instead check that at least one test has been run by the time
+# we exit.
+has_run_tests = False
+
+has_execute_mi = getattr(gdb, "execute_mi", None) is not None
+
+
+class CheckResult(gdb.Command):
+ def __init__(self):
+ super(CheckResult, self).__init__("print_and_compare", gdb.COMMAND_DATA)
+
+ def invoke(self, arg, from_tty):
+ global has_run_tests
+
+ try:
+ has_run_tests = True
+
+ # Stack frame is:
+ # 0. StopForDebugger
+ # 1. CompareListChildrenToChars, ComparePrettyPrintToChars or ComparePrettyPrintToRegex
+ # 2. TestCase
+ compare_frame = gdb.newest_frame().older()
+ testcase_frame = compare_frame.older()
+ test_loc = testcase_frame.find_sal()
+ test_loc_str = test_loc.symtab.filename + ":" + str(test_loc.line)
+ # Use interactive commands in the correct context to get the pretty
+ # printed version
+
+ frame_name = compare_frame.name()
+ if frame_name.startswith("CompareListChildren"):
+ if has_execute_mi:
+ value = self._get_children(compare_frame)
+ else:
+ print("SKIPPED: " + test_loc_str)
+ return
+ else:
+ value = self._get_value(compare_frame, testcase_frame)
+
+ gdb.newest_frame().select()
+ expectation_val = compare_frame.read_var("expectation")
+ check_literal = expectation_val.string(encoding="utf-8")
+ if "PrettyPrintToRegex" in frame_name:
+ test_fails = not re.search(check_literal, value)
+ else:
+ test_fails = value != check_literal
+
+ if test_fails:
+ global test_failures
+ print("FAIL: " + test_loc_str)
+ print("GDB printed:")
+ print(" " + repr(value))
+ print("Value should match:")
+ print(" " + repr(check_literal))
+ test_failures += 1
+ else:
+ print("PASS: " + test_loc_str)
+
+ except RuntimeError as e:
+ # At this point, lots of different things could be wrong, so don't try to
+ # recover or figure it out. Don't exit either, because then it's
+ # impossible to debug the framework itself.
+ print("FAIL: Something is wrong in the test framework.")
+ print(str(e))
+ test_failures += 1
+
+ def _get_children(self, compare_frame):
+ compare_frame.select()
+ gdb.execute_mi("-var-create", "value", "*", "value")
+ r = gdb.execute_mi("-var-list-children", "--simple-values", "value")
+ gdb.execute_mi("-var-delete", "value")
+ children = r["children"]
+ if r["displayhint"] == "map":
+ r = [
+ {
+ "key": json.loads(children[2 * i]["value"]),
+ "value": json.loads(children[2 * i + 1]["value"]),
+ }
+ for i in range(len(children) // 2)
+ ]
+ else:
+ r = [json.loads(el["value"]) for el in children]
+ return json.dumps(r, sort_keys=True)
+
+ def _get_value(self, compare_frame, testcase_frame):
+ compare_frame.select()
+ frame_name = compare_frame.name()
+ if frame_name.startswith("ComparePrettyPrint"):
+ s = gdb.execute("p value", to_string=True)
+ else:
+ value_str = str(compare_frame.read_var("value"))
+ clean_expression_str = value_str.strip("'\"")
+ testcase_frame.select()
+ s = gdb.execute("p " + clean_expression_str, to_string=True)
+ if sys.version_info.major == 2:
+ s = s.decode("utf-8")
+
+ # Ignore the convenience variable name and newline
+ return s[s.find("= ") + 2 : -1]
+
+
+def exit_handler(event=None):
+ global test_failures
+ global has_run_tests
+
+ if not has_run_tests:
+ print("FAILED test program did not run correctly, check gdb warnings")
+ test_failures = -1
+ elif test_failures:
+ print("FAILED %d cases" % test_failures)
+ exit(test_failures)
+
+
+# Start code executed at load time
+
+# Disable terminal paging
+gdb.execute("set height 0")
+gdb.execute("set python print-stack full")
+
+if has_execute_mi:
+ gdb.execute_mi("-enable-pretty-printing")
+
+test_failures = 0
+CheckResult()
+test_bp = gdb.Breakpoint("StopForDebugger")
+test_bp.enabled = True
+test_bp.silent = True
+test_bp.commands = "print_and_compare\ncontinue"
+# "run" won't return if the program exits; ensure the script regains control.
+gdb.events.exited.connect(exit_handler)
+gdb.execute("run")
+# If the program didn't exit, something went wrong, but we don't
+# know what. Fail on exit.
+test_failures += 1
+exit_handler(None)
diff --git a/libcxx/test/libcxx-03/gdb/gdb_pretty_printer_test.sh.cpp b/libcxx/test/libcxx-03/gdb/gdb_pretty_printer_test.sh.cpp
new file mode 100644
index 0000000000000..f125cc9adc491
--- /dev/null
+++ b/libcxx/test/libcxx-03/gdb/gdb_pretty_printer_test.sh.cpp
@@ -0,0 +1,722 @@
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// REQUIRES: host-has-gdb-with-python
+// REQUIRES: locale.en_US.UTF-8
+// REQUIRES: optimization=none
+// UNSUPPORTED: no-localization
+// UNSUPPORTED: c++03
+
+// TODO: Investigate why this fails on the arm bots
+// UNSUPPORTED: target=arm{{.*}}
+
+// The Android libc++ tests are run on a non-Android host, connected to an
+// Android device over adb. gdb needs special support to make this work (e.g.
+// gdbclient.py, ndk-gdb.py, gdbserver), and the Android organization doesn't
+// support gdb anymore, favoring lldb instead.
+// UNSUPPORTED: android
+
+// This test doesn't work as such on Windows.
+// UNSUPPORTED: windows
+
+// RUN: %{cxx} %{flags} %s -o %t.exe %{compile_flags} -g %{link_flags}
+// Ensure locale-independence for unicode tests.
+// RUN: env LANG=en_US.UTF-8 %{gdb} -nx -batch -iex "set autoload off" -ex "source %S/../../../utils/gdb/libcxx/printers.py" -ex "python register_libcxx_printer_loader()" -ex "source %S/gdb_pretty_printer_test.py" %t.exe
+
+#include <bitset>
+#include <deque>
+#include <list>
+#include <map>
+#include <memory>
+#include <queue>
+#include <set>
+#include <sstream>
+#include <stack>
+#include <string>
+#include <tuple>
+#include <unordered_map>
+#include <unordered_set>
+
+#include "test_macros.h"
+
+// To write a pretty-printer test:
+//
+// 1. Declare a variable of the type you want to test
+//
+// 2. Set its value to something which will test the pretty printer in an
+// interesting way.
+//
+// 3. Call ComparePrettyPrintToChars with that variable, and a "const char*"
+// value to compare to the printer's output.
+//
+// Or
+//
+// Call ComparePrettyPrintToRegex with that variable, and a "const char*"
+// *python* regular expression to match against the printer's output.
+// The set of special characters in a Python regular expression overlaps
+// with a lot of things the pretty printers print--brackets, for
+// example--so take care to escape appropriately.
+//
+// Alternatively, construct a string that gdb can parse as an expression,
+// so that printing the value of the expression will test the pretty printer
+// in an interesting way. Then, call CompareExpressionPrettyPrintToChars or
+// CompareExpressionPrettyPrintToRegex to compare the printer's output.
+
+// Avoids setting a breakpoint in every-single instantiation of
+// ComparePrettyPrintTo*. Also, make sure neither it, nor the
+// variables we need present in the Compare functions are optimized
+// away.
+#ifdef TEST_COMPILER_GCC
+#define OPT_NONE __attribute__((noinline))
+#else
+#define OPT_NONE __attribute__((optnone))
+#endif
+void StopForDebugger(void *, void *) OPT_NONE;
+void StopForDebugger(void *, void *) {}
+
+
+// Prevents the compiler optimizing away the parameter in the caller function.
+template <typename Type>
+void MarkAsLive(Type &&) OPT_NONE;
+template <typename Type>
+void MarkAsLive(Type &&) {}
+
+// In all of the Compare(Expression)PrettyPrintTo(Regex/Chars) functions below,
+// the python script sets a breakpoint just before the call to StopForDebugger,
+// compares the result to the expectation.
+//
+// The expectation is a literal string to be matched exactly in
+// *PrettyPrintToChars functions, and is a python regular expression in
+// *PrettyPrintToRegex functions.
+//
+// In ComparePrettyPrint* functions, the value is a variable of any type. In
+// CompareExpressionPrettyPrint functions, the value is a string expression that
+// gdb will parse and print the result.
+//
+// The python script will print either "PASS", or a detailed failure explanation
+// along with the line that has invoke the function. The testing will continue
+// in either case.
+
+template <typename TypeToPrint> void ComparePrettyPrintToChars(
+ TypeToPrint value,
+ const char *expectation) {
+ MarkAsLive(value);
+ StopForDebugger(&value, &expectation);
+}
+
+template <typename TypeToPrint> void ComparePrettyPrintToRegex(
+ TypeToPrint value,
+ const char *expectation) {
+ MarkAsLive(value);
+ StopForDebugger(&value, &expectation);
+}
+
+void CompareExpressionPrettyPrintToChars(
+ std::string value,
+ const char *expectation) {
+ MarkAsLive(value);
+ StopForDebugger(&value, &expectation);
+}
+
+void CompareExpressionPrettyPrintToRegex(
+ std::string value,
+ const char *expectation) {
+ MarkAsLive(value);
+ StopForDebugger(&value, &expectation);
+}
+
+template <typename TypeToPrint>
+void CompareListChildrenToChars(TypeToPrint value, const char* expectation) {
+ MarkAsLive(value);
+ StopForDebugger(&value, &expectation);
+}
+
+namespace example {
+ struct example_struct {
+ int a = 0;
+ int arr[1000];
+ };
+}
+
+// If enabled, the self test will "fail"--because we want to be sure it properly
+// diagnoses tests that *should* fail. Evaluate the output by hand.
+void framework_self_test() {
+#ifdef FRAMEWORK_SELF_TEST
+ // Use the most simple data structure we can.
+ const char a = 'a';
+
+ // Tests that should pass
+ ComparePrettyPrintToChars(a, "97 'a'");
+ ComparePrettyPrintToRegex(a, ".*");
+
+ // Tests that should fail.
+ ComparePrettyPrintToChars(a, "b");
+ ComparePrettyPrintToRegex(a, "b");
+#endif
+}
+
+// A simple pass-through allocator to check that we handle CompressedPair
+// correctly.
+template <typename T> class UncompressibleAllocator : public std::allocator<T> {
+ public:
+ char X;
+
+ template <class U>
+ struct rebind {
+ using other = UncompressibleAllocator<U>;
+ };
+};
+
+void string_test() {
+ std::string short_string("kdjflskdjf");
+ // The display_hint "string" adds quotes the printed result.
+ ComparePrettyPrintToChars(short_string, "\"kdjflskdjf\"");
+
+ std::basic_string<char, std::char_traits<char>, UncompressibleAllocator<char>>
+ long_string("mehmet bizim dostumuz agzi kirik testimiz");
+ ComparePrettyPrintToChars(long_string,
+ "\"mehmet bizim dostumuz agzi kirik testimiz\"");
+}
+
+namespace a_namespace {
+// To test name-lookup in the presence of using inside a namespace. Inside this
+// namespace, unqualified string_view variables will appear in the debug info as
+// "a_namespace::string_view, rather than "std::string_view".
+//
+// There is nothing special here about string_view; it's just the data structure
+// where lookup with using inside a namespace wasn't always working.
+
+using string_view = std::string_view;
+
+void string_view_test() {
+ std::string_view i_am_empty;
+ ComparePrettyPrintToChars(i_am_empty, "\"\"");
+
+ std::string source_string("to be or not to be");
+ std::string_view to_be(source_string);
+ ComparePrettyPrintToChars(to_be, "\"to be or not to be\"");
+
+ const char char_arr[] = "what a wonderful world";
+ std::string_view wonderful(&char_arr[7], 9);
+ ComparePrettyPrintToChars(wonderful, "\"wonderful\"");
+
+ const char char_arr1[] = "namespace_stringview";
+ string_view namespace_stringview(&char_arr1[10], 10);
+ ComparePrettyPrintToChars(namespace_stringview, "\"stringview\"");
+}
+}
+
+void u16string_test() {
+ std::u16string test0 = u"Hello World";
+ ComparePrettyPrintToChars(test0, "u\"Hello World\"");
+ std::u16string test1 = u"\U00010196\u20AC\u00A3\u0024";
+ ComparePrettyPrintToChars(test1, "u\"\U00010196\u20AC\u00A3\u0024\"");
+ std::u16string test2 = u"\u0024\u0025\u0026\u0027";
+ ComparePrettyPrintToChars(test2, "u\"\u0024\u0025\u0026\u0027\"");
+ std::u16string test3 = u"mehmet bizim dostumuz agzi kirik testimiz";
+ ComparePrettyPrintToChars(test3,
+ ("u\"mehmet bizim dostumuz agzi kirik testimiz\""));
+}
+
+void u32string_test() {
+ std::u32string test0 = U"Hello World";
+ ComparePrettyPrintToChars(test0, "U\"Hello World\"");
+ std::u32string test1 =
+ U"\U0001d552\U0001d553\U0001d554\U0001d555\U0001d556\U0001d557";
+ ComparePrettyPrintToChars(
+ test1,
+ ("U\"\U0001d552\U0001d553\U0001d554\U0001d555\U0001d556\U0001d557\""));
+ std::u32string test2 = U"\U00004f60\U0000597d";
+ ComparePrettyPrintToChars(test2, ("U\"\U00004f60\U0000597d\""));
+ std::u32string test3 = U"mehmet bizim dostumuz agzi kirik testimiz";
+ ComparePrettyPrintToChars(test3, ("U\"mehmet bizim dostumuz agzi kirik testimiz\""));
+}
+
+void tuple_test() {
+ std::tuple<int, int, int> test0(2, 3, 4);
+ ComparePrettyPrintToChars(test0, "std::tuple containing = {[0] = 2, [1] = 3, [2] = 4}");
+
+ std::tuple<> test1;
+ ComparePrettyPrintToChars(
+ test1,
+ "empty std::tuple");
+}
+
+void unique_ptr_test() {
+ std::unique_ptr<std::string> matilda(new std::string("Matilda"));
+ ComparePrettyPrintToRegex(
+ std::move(matilda),
+ R"(std::unique_ptr<std::string> containing = {__ptr_ = 0x[a-f0-9]+})");
+ std::unique_ptr<int> forty_two(new int(42));
+ ComparePrettyPrintToRegex(std::move(forty_two),
+ R"(std::unique_ptr<int> containing = {__ptr_ = 0x[a-f0-9]+})");
+
+ std::unique_ptr<int> this_is_null;
+ ComparePrettyPrintToChars(std::move(this_is_null),
+ R"(std::unique_ptr is nullptr)");
+}
+
+void bitset_test() {
+ std::bitset<258> i_am_empty(0);
+ ComparePrettyPrintToRegex(i_am_empty, "std::bitset<258(u|ul)?>");
+
+ std::bitset<0> very_empty;
+ ComparePrettyPrintToRegex(very_empty, "std::bitset<0(u|ul)?>");
+
+ std::bitset<15> b_000001111111100(1020);
+ ComparePrettyPrintToRegex(b_000001111111100,
+ R"(std::bitset<15(u|ul)?> = {\[2\] = 1, \[3\] = 1, \[4\] = 1, \[5\] = 1, \[6\] = 1, )"
+ R"(\[7\] = 1, \[8\] = 1, \[9\] = 1})");
+
+ std::bitset<258> b_0_129_132(0);
+ b_0_129_132[0] = true;
+ b_0_129_132[129] = true;
+ b_0_129_132[132] = true;
+ ComparePrettyPrintToRegex(b_0_129_132,
+ R"(std::bitset<258(u|ul)?> = {\[0\] = 1, \[129\] = 1, \[132\] = 1})");
+}
+
+void list_test() {
+ std::list<int> i_am_empty{};
+ ComparePrettyPrintToChars(i_am_empty, "std::list is empty");
+
+ std::list<int> one_two_three {1, 2, 3};
+ ComparePrettyPrintToChars(one_two_three,
+ "std::list with 3 elements = {1, 2, 3}");
+
+ std::list<std::string> colors {"red", "blue", "green"};
+ ComparePrettyPrintToChars(colors,
+ R"(std::list with 3 elements = {"red", "blue", "green"})");
+}
+
+void deque_test() {
+ std::deque<int> i_am_empty{};
+ ComparePrettyPrintToChars(i_am_empty, "std::deque is empty");
+
+ std::deque<int> one_two_three {1, 2, 3};
+ ComparePrettyPrintToChars(one_two_three,
+ "std::deque with 3 elements = {1, 2, 3}");
+
+ std::deque<example::example_struct> bfg;
+ for (int i = 0; i < 10; ++i) {
+ example::example_struct current;
+ current.a = i;
+ bfg.push_back(current);
+ }
+ for (int i = 0; i < 3; ++i) {
+ bfg.pop_front();
+ }
+ for (int i = 0; i < 3; ++i) {
+ bfg.pop_back();
+ }
+ ComparePrettyPrintToRegex(bfg,
+ "std::deque with 4 elements = {"
+ "{a = 3, arr = {[^}]+}}, "
+ "{a = 4, arr = {[^}]+}}, "
+ "{a = 5, arr = {[^}]+}}, "
+ "{a = 6, arr = {[^}]+}}}");
+}
+
+void map_test() {
+ std::map<int, int> i_am_empty{};
+ ComparePrettyPrintToChars(i_am_empty, "std::map is empty");
+
+ std::map<int, std::string> one_two_three;
+ one_two_three.insert({1, "one"});
+ one_two_three.insert({2, "two"});
+ one_two_three.insert({3, "three"});
+ ComparePrettyPrintToChars(one_two_three,
+ "std::map with 3 elements = "
+ R"({[1] = "one", [2] = "two", [3] = "three"})");
+
+ std::map<int, example::example_struct> bfg;
+ for (int i = 0; i < 4; ++i) {
+ example::example_struct current;
+ current.a = 17 * i;
+ bfg.insert({i, current});
+ }
+ ComparePrettyPrintToRegex(bfg,
+ R"(std::map with 4 elements = {)"
+ R"(\[0\] = {a = 0, arr = {[^}]+}}, )"
+ R"(\[1\] = {a = 17, arr = {[^}]+}}, )"
+ R"(\[2\] = {a = 34, arr = {[^}]+}}, )"
+ R"(\[3\] = {a = 51, arr = {[^}]+}}})");
+}
+
+void multimap_test() {
+ std::multimap<int, int> i_am_empty{};
+ ComparePrettyPrintToChars(i_am_empty, "std::multimap is empty");
+
+ std::multimap<int, std::string> one_two_three;
+ one_two_three.insert({1, "one"});
+ one_two_three.insert({3, "three"});
+ one_two_three.insert({1, "ein"});
+ one_two_three.insert({2, "two"});
+ one_two_three.insert({2, "zwei"});
+ one_two_three.insert({1, "bir"});
+
+ ComparePrettyPrintToChars(one_two_three,
+ "std::multimap with 6 elements = "
+ R"({[1] = "one", [1] = "ein", [1] = "bir", )"
+ R"([2] = "two", [2] = "zwei", [3] = "three"})");
+}
+
+void queue_test() {
+ std::queue<int> i_am_empty;
+ ComparePrettyPrintToChars(i_am_empty, "std::queue wrapping: std::deque is empty");
+
+ std::queue<int> one_two_three(std::deque<int>{1, 2, 3});
+ ComparePrettyPrintToChars(
+ one_two_three,
+ "std::queue wrapping: "
+ "std::deque with 3 elements = {1, 2, 3}");
+}
+
+void priority_queue_test() {
+ std::priority_queue<int> i_am_empty;
+ ComparePrettyPrintToChars(i_am_empty, "std::priority_queue wrapping: std::vector of length 0, capacity 0");
+
+ std::priority_queue<int> one_two_three;
+ one_two_three.push(11111);
+ one_two_three.push(22222);
+ one_two_three.push(33333);
+
+ ComparePrettyPrintToRegex(
+ one_two_three,
+ R"(std::priority_queue wrapping: )"
+ R"(std::vector of length 3, capacity 3 = {33333)");
+
+ ComparePrettyPrintToRegex(one_two_three, ".*11111.*");
+ ComparePrettyPrintToRegex(one_two_three, ".*22222.*");
+}
+
+void set_test() {
+ std::set<int> i_am_empty;
+ ComparePrettyPrintToChars(i_am_empty, "std::set is empty");
+
+ std::set<int> one_two_three {3, 1, 2};
+ ComparePrettyPrintToChars(one_two_three,
+ "std::set with 3 elements = {1, 2, 3}");
+
+ std::set<std::pair<int, int>> prime_pairs {
+ std::make_pair(3, 5), std::make_pair(5, 7), std::make_pair(3, 5)};
+
+ ComparePrettyPrintToChars(prime_pairs,
+ "std::set with 2 elements = {"
+ "{first = 3, second = 5}, {first = 5, second = 7}}");
+
+ using using_set = std::set<int>;
+ using_set other{1, 2, 3};
+ ComparePrettyPrintToChars(other, "std::set with 3 elements = {1, 2, 3}");
+}
+
+void stack_test() {
+ std::stack<int> test0;
+ ComparePrettyPrintToChars(test0, "std::stack wrapping: std::deque is empty");
+ test0.push(5);
+ test0.push(6);
+ ComparePrettyPrintToChars(test0, "std::stack wrapping: std::deque with 2 elements = {5, 6}");
+ std::stack<bool> test1;
+ test1.push(true);
+ test1.push(false);
+ ComparePrettyPrintToChars(test1, "std::stack wrapping: std::deque with 2 elements = {true, false}");
+
+ std::stack<std::string> test2;
+ test2.push("Hello");
+ test2.push("World");
+ ComparePrettyPrintToChars(
+ test2,
+ "std::stack wrapping: std::deque with 2 elements "
+ "= {\"Hello\", \"World\"}");
+}
+
+void multiset_test() {
+ std::multiset<int> i_am_empty;
+ ComparePrettyPrintToChars(i_am_empty, "std::multiset is empty");
+
+ std::multiset<std::string> one_two_three {"1:one", "2:two", "3:three", "1:one"};
+ ComparePrettyPrintToChars(one_two_three,
+ "std::multiset with 4 elements = {"
+ R"("1:one", "1:one", "2:two", "3:three"})");
+}
+
+void vector_test() {
+ std::vector<bool> test0 = {true, false};
+ ComparePrettyPrintToRegex(test0,
+ "std::vector<bool> of "
+ "length 2, capacity (32|64) = {1, 0}");
+ for (int i = 0; i < 31; ++i) {
+ test0.push_back(true);
+ test0.push_back(false);
+ }
+ ComparePrettyPrintToRegex(
+ test0,
+ "std::vector<bool> of length 64, "
+ "capacity 64 = {1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, "
+ "0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, "
+ "0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0}");
+ test0.push_back(true);
+ ComparePrettyPrintToRegex(
+ test0,
+ "std::vector<bool> of length 65, "
+ "capacity (96|128) = {1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, "
+ "0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, "
+ "0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1}");
+
+ std::vector<int> test1;
+ ComparePrettyPrintToChars(test1, "std::vector of length 0, capacity 0");
+
+ std::vector<int> test2 = {5, 6, 7};
+ ComparePrettyPrintToChars(test2,
+ "std::vector of length "
+ "3, capacity 3 = {5, 6, 7}");
+
+ std::vector<int, UncompressibleAllocator<int>> test3({7, 8});
+ ComparePrettyPrintToChars(std::move(test3),
+ "std::vector of length "
+ "2, capacity 2 = {7, 8}");
+}
+
+void set_iterator_test() {
+ std::set<int> one_two_three {1111, 2222, 3333};
+ auto it = one_two_three.find(2222);
+ MarkAsLive(it);
+ CompareExpressionPrettyPrintToRegex("it",
+ R"(std::__tree_const_iterator = {\[0x[a-f0-9]+\] = 2222})");
+
+ auto not_found = one_two_three.find(1234);
+ MarkAsLive(not_found);
+ // Because the end_node is not easily detected, just be sure it doesn't crash.
+ CompareExpressionPrettyPrintToRegex("not_found",
+ R"(std::__tree_const_iterator ( = {\[0x[a-f0-9]+\] = .*}|<error reading variable:.*>))");
+}
+
+void map_iterator_test() {
+ std::map<int, std::string> one_two_three;
+ one_two_three.insert({1, "one"});
+ one_two_three.insert({2, "two"});
+ one_two_three.insert({3, "three"});
+ auto it = one_two_three.begin();
+ MarkAsLive(it);
+ CompareExpressionPrettyPrintToRegex("it",
+ R"(std::__map_iterator = )"
+ R"({\[0x[a-f0-9]+\] = {first = 1, second = "one"}})");
+
+ auto not_found = one_two_three.find(7);
+ MarkAsLive(not_found);
+ // Because the end_node is not easily detected, just be sure it doesn't crash.
+ CompareExpressionPrettyPrintToRegex(
+ "not_found", R"(std::__map_iterator ( = {\[0x[a-f0-9]+\] = .*}|<error reading variable:.*>))");
+}
+
+void unordered_set_test() {
+ std::unordered_set<int> i_am_empty;
+ ComparePrettyPrintToChars(i_am_empty, "std::unordered_set is empty");
+
+ std::unordered_set<int> numbers {12345, 67890, 222333, 12345};
+ numbers.erase(numbers.find(222333));
+ ComparePrettyPrintToRegex(numbers, "std::unordered_set with 2 elements = ");
+ ComparePrettyPrintToRegex(numbers, ".*12345.*");
+ ComparePrettyPrintToRegex(numbers, ".*67890.*");
+
+ std::unordered_set<std::string> colors {"red", "blue", "green"};
+ ComparePrettyPrintToRegex(colors, "std::unordered_set with 3 elements = ");
+ ComparePrettyPrintToRegex(colors, R"(.*"red".*)");
+ ComparePrettyPrintToRegex(colors, R"(.*"blue".*)");
+ ComparePrettyPrintToRegex(colors, R"(.*"green".*)");
+}
+
+void unordered_multiset_test() {
+ std::unordered_multiset<int> i_am_empty;
+ ComparePrettyPrintToChars(i_am_empty, "std::unordered_multiset is empty");
+
+ std::unordered_multiset<int> numbers {12345, 67890, 222333, 12345};
+ ComparePrettyPrintToRegex(numbers,
+ "std::unordered_multiset with 4 elements = ");
+ ComparePrettyPrintToRegex(numbers, ".*12345.*12345.*");
+ ComparePrettyPrintToRegex(numbers, ".*67890.*");
+ ComparePrettyPrintToRegex(numbers, ".*222333.*");
+
+ std::unordered_multiset<std::string> colors {"red", "blue", "green", "red"};
+ ComparePrettyPrintToRegex(colors,
+ "std::unordered_multiset with 4 elements = ");
+ ComparePrettyPrintToRegex(colors, R"(.*"red".*"red".*)");
+ ComparePrettyPrintToRegex(colors, R"(.*"blue".*)");
+ ComparePrettyPrintToRegex(colors, R"(.*"green".*)");
+}
+
+void unordered_map_test() {
+ std::unordered_map<int, int> i_am_empty;
+ ComparePrettyPrintToChars(i_am_empty, "std::unordered_map is empty");
+
+ std::unordered_map<int, std::string> one_two_three;
+ one_two_three.insert({1, "one"});
+ one_two_three.insert({2, "two"});
+ one_two_three.insert({3, "three"});
+ ComparePrettyPrintToRegex(one_two_three,
+ "std::unordered_map with 3 elements = ");
+ ComparePrettyPrintToRegex(one_two_three, R"(.*\[1\] = "one".*)");
+ ComparePrettyPrintToRegex(one_two_three, R"(.*\[2\] = "two".*)");
+ ComparePrettyPrintToRegex(one_two_three, R"(.*\[3\] = "three".*)");
+}
+
+void unordered_multimap_test() {
+ std::unordered_multimap<int, int> i_am_empty;
+ ComparePrettyPrintToChars(i_am_empty, "std::unordered_multimap is empty");
+
+ std::unordered_multimap<int, std::string> one_two_three;
+ one_two_three.insert({1, "one"});
+ one_two_three.insert({2, "two"});
+ one_two_three.insert({3, "three"});
+ one_two_three.insert({2, "two"});
+ ComparePrettyPrintToRegex(one_two_three,
+ "std::unordered_multimap with 4 elements = ");
+ ComparePrettyPrintToRegex(one_two_three, R"(.*\[1\] = "one".*)");
+ ComparePrettyPrintToRegex(one_two_three, R"(.*\[2\] = "two".*\[2\] = "two")");
+ ComparePrettyPrintToRegex(one_two_three, R"(.*\[3\] = "three".*)");
+}
+
+void unordered_map_iterator_test() {
+ std::unordered_map<int, int> ones_to_eights;
+ ones_to_eights.insert({1, 8});
+ ones_to_eights.insert({11, 88});
+ ones_to_eights.insert({111, 888});
+
+ auto ones_to_eights_begin = ones_to_eights.begin();
+ MarkAsLive(ones_to_eights_begin);
+ CompareExpressionPrettyPrintToRegex("ones_to_eights_begin",
+ R"(std::__hash_map_iterator = {\[1+\] = 8+})");
+
+ auto not_found = ones_to_eights.find(5);
+ MarkAsLive(not_found);
+ CompareExpressionPrettyPrintToRegex("not_found",
+ R"(std::__hash_map_iterator = end\(\))");
+}
+
+void unordered_set_iterator_test() {
+ std::unordered_set<int> ones;
+ ones.insert(111);
+ ones.insert(1111);
+ ones.insert(11111);
+
+ auto ones_begin = ones.begin();
+ MarkAsLive(ones_begin);
+ CompareExpressionPrettyPrintToRegex("ones_begin",
+ R"(std::__hash_const_iterator = {1+})");
+
+ auto not_found = ones.find(5);
+ MarkAsLive(not_found);
+ CompareExpressionPrettyPrintToRegex("not_found",
+ R"(std::__hash_const_iterator = end\(\))");
+}
+
+// Check that libc++ pretty printers do not handle pointers.
+void pointer_negative_test() {
+ int abc = 123;
+ int *int_ptr = &abc;
+ // Check that the result is equivalent to "p/r int_ptr" command.
+ ComparePrettyPrintToRegex(int_ptr, R"(\(int \*\) 0x[a-f0-9]+)");
+}
+
+void shared_ptr_test() {
+ // Shared ptr tests while using test framework call another function
+ // due to which there is one more count for the pointer. Hence, all the
+ // following tests are testing with expected count plus 1.
+ std::shared_ptr<const int> test0 = std::make_shared<const int>(5);
+ // The python regular expression matcher treats newlines as significant, so
+ // these regular expressions should be on one line.
+ ComparePrettyPrintToRegex(
+ test0,
+ R"(std::shared_ptr<int> count [2\?], weak [0\?]( \(libc\+\+ missing debug info\))? containing = {__ptr_ = 0x[a-f0-9]+})");
+
+ std::shared_ptr<const int> test1(test0);
+ ComparePrettyPrintToRegex(
+ test1,
+ R"(std::shared_ptr<int> count [3\?], weak [0\?]( \(libc\+\+ missing debug info\))? containing = {__ptr_ = 0x[a-f0-9]+})");
+
+ {
+ std::weak_ptr<const int> test2 = test1;
+ ComparePrettyPrintToRegex(
+ test0,
+ R"(std::shared_ptr<int> count [3\?], weak [1\?]( \(libc\+\+ missing debug info\))? containing = {__ptr_ = 0x[a-f0-9]+})");
+ }
+
+ ComparePrettyPrintToRegex(
+ test0,
+ R"(std::shared_ptr<int> count [3\?], weak [0\?]( \(libc\+\+ missing debug info\))? containing = {__ptr_ = 0x[a-f0-9]+})");
+
+ std::shared_ptr<const int> test3;
+ ComparePrettyPrintToChars(test3, "std::shared_ptr is nullptr");
+}
+
+void streampos_test() {
+ std::streampos test0 = 67;
+ ComparePrettyPrintToRegex(test0, "^std::fpos with stream offset:67( with state: {count:0 value:0})?$");
+ std::istringstream input("testing the input stream here");
+ std::streampos test1 = input.tellg();
+ ComparePrettyPrintToRegex(test1, "^std::fpos with stream offset:0( with state: {count:0 value:0})?$");
+ std::unique_ptr<char[]> buffer(new char[5]);
+ input.read(buffer.get(), 5);
+ test1 = input.tellg();
+ ComparePrettyPrintToRegex(test1, "^std::fpos with stream offset:5( with state: {count:0 value:0})?$");
+}
+
+void mi_mode_test() {
+ std::map<int, std::string> one_two_three_map;
+ one_two_three_map.insert({1, "one"});
+ one_two_three_map.insert({2, "two"});
+ one_two_three_map.insert({3, "three"});
+ CompareListChildrenToChars(
+ one_two_three_map, R"([{"key": 1, "value": "one"}, {"key": 2, "value": "two"}, {"key": 3, "value": "three"}])");
+
+ std::unordered_map<int, std::string> one_two_three_umap;
+ one_two_three_umap.insert({3, "three"});
+ one_two_three_umap.insert({2, "two"});
+ one_two_three_umap.insert({1, "one"});
+ CompareListChildrenToChars(
+ one_two_three_umap, R"([{"key": 3, "value": "three"}, {"key": 2, "value": "two"}, {"key": 1, "value": "one"}])");
+
+ std::deque<int> one_two_three_deque{1, 2, 3};
+ CompareListChildrenToChars(one_two_three_deque, "[1, 2, 3]");
+}
+
+int main(int, char**) {
+ framework_self_test();
+
+ string_test();
+ a_namespace::string_view_test();
+
+ //u16string_test();
+ u32string_test();
+ tuple_test();
+ unique_ptr_test();
+ shared_ptr_test();
+ bitset_test();
+ list_test();
+ deque_test();
+ map_test();
+ multimap_test();
+ queue_test();
+ priority_queue_test();
+ stack_test();
+ set_test();
+ multiset_test();
+ vector_test();
+ set_iterator_test();
+ map_iterator_test();
+ unordered_set_test();
+ unordered_multiset_test();
+ unordered_map_test();
+ unordered_multimap_test();
+ unordered_map_iterator_test();
+ unordered_set_iterator_test();
+ pointer_negative_test();
+ streampos_test();
+ mi_mode_test();
+ return 0;
+}
diff --git a/libcxx/test/libcxx-03/headers_in_modulemap.sh.py b/libcxx/test/libcxx-03/headers_in_modulemap.sh.py
new file mode 100644
index 0000000000000..d4a18a20c8926
--- /dev/null
+++ b/libcxx/test/libcxx-03/headers_in_modulemap.sh.py
@@ -0,0 +1,20 @@
+# RUN: %{python} %s %{libcxx-dir}/utils
+
+import sys
+sys.path.append(sys.argv[1])
+from libcxx.header_information import all_headers, libcxx_include
+
+with open(libcxx_include / "module.modulemap.in") as f:
+ modulemap = f.read()
+
+isHeaderMissing = False
+for header in all_headers:
+ if not header.is_in_modulemap():
+ continue
+
+ if not str(header) in modulemap:
+ print(f"Header {header} seems to be missing from the modulemap!")
+ isHeaderMissing = True
+
+if isHeaderMissing:
+ exit(1)
diff --git a/libcxx/test/libcxx-03/input.output/file.streams/fstreams/filebuf/traits_mismatch.verify.cpp b/libcxx/test/libcxx-03/input.output/file.streams/fstreams/filebuf/traits_mismatch.verify.cpp
new file mode 100644
index 0000000000000..455c9979ae57d
--- /dev/null
+++ b/libcxx/test/libcxx-03/input.output/file.streams/fstreams/filebuf/traits_mismatch.verify.cpp
@@ -0,0 +1,22 @@
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// <fstream>
+
+// template<class charT, class traits = char_traits<charT>>
+// class basic_filebuf;
+//
+// The char type of the stream and the char_type of the traits have to match
+
+// UNSUPPORTED: no-wide-characters
+
+#include <fstream>
+
+std::basic_filebuf<char, std::char_traits<wchar_t> > f;
+// expected-error-re@*:* {{static assertion failed{{.*}}traits_type::char_type must be the same type as CharT}}
+// expected-error@*:* 9 {{only virtual member functions can be marked 'override'}}
diff --git a/libcxx/test/libcxx-03/input.output/file.streams/fstreams/fstream.close.pass.cpp b/libcxx/test/libcxx-03/input.output/file.streams/fstreams/fstream.close.pass.cpp
new file mode 100644
index 0000000000000..d77d5370f2c49
--- /dev/null
+++ b/libcxx/test/libcxx-03/input.output/file.streams/fstreams/fstream.close.pass.cpp
@@ -0,0 +1,38 @@
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// <fstream>
+
+// template <class charT, class traits = char_traits<charT> >
+// class basic_fstream
+
+// close();
+
+// Inspired by PR#38052 - std::fstream still good after closing and updating content
+
+#include <fstream>
+#include <cassert>
+#include "test_macros.h"
+#include "platform_support.h"
+
+int main(int, char**)
+{
+ std::string temp = get_temp_file_name();
+
+ std::fstream ofs(temp, std::ios::out | std::ios::trunc);
+ ofs << "Hello, World!\n";
+ assert( ofs.good());
+ ofs.close();
+ assert( ofs.good());
+ ofs << "Hello, World!\n";
+ assert(!ofs.good());
+
+ std::remove(temp.c_str());
+
+ return 0;
+}
diff --git a/libcxx/test/libcxx-03/input.output/file.streams/fstreams/fstream.cons/wchar_pointer.pass.cpp b/libcxx/test/libcxx-03/input.output/file.streams/fstreams/fstream.cons/wchar_pointer.pass.cpp
new file mode 100644
index 0000000000000..652783fc65134
--- /dev/null
+++ b/libcxx/test/libcxx-03/input.output/file.streams/fstreams/fstream.cons/wchar_pointer.pass.cpp
@@ -0,0 +1,52 @@
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// <fstream>
+
+// template <class charT, class traits = char_traits<charT> >
+// class basic_fstream
+
+// explicit basic_fstream(const wchar_t* s, ios_base::openmode mode = ios_base::in | ios_base::out);
+
+// This extension is only provided on Windows.
+// REQUIRES: windows
+// UNSUPPORTED: no-wide-characters
+
+// TODO: This should not be necessary
+// ADDITIONAL_COMPILE_FLAGS:-D_LIBCPP_ENABLE_CXX26_REMOVED_CODECVT -D_LIBCPP_ENABLE_CXX26_REMOVED_WSTRING_CONVERT
+
+#include <fstream>
+#include <cassert>
+#include "test_macros.h"
+#include "wide_temp_file.h"
+
+int main(int, char**) {
+ std::wstring temp = get_wide_temp_file_name();
+ {
+ std::fstream fs(temp.c_str(), std::ios_base::in | std::ios_base::out
+ | std::ios_base::trunc);
+ double x = 0;
+ fs << 3.25;
+ fs.seekg(0);
+ fs >> x;
+ assert(x == 3.25);
+ }
+ _wremove(temp.c_str());
+ {
+ std::wfstream fs(temp.c_str(), std::ios_base::in | std::ios_base::out
+ | std::ios_base::trunc);
+ double x = 0;
+ fs << 3.25;
+ fs.seekg(0);
+ fs >> x;
+ assert(x == 3.25);
+ }
+ _wremove(temp.c_str());
+
+ return 0;
+}
diff --git a/libcxx/test/libcxx-03/input.output/file.streams/fstreams/fstream.members/open_wchar_pointer.pass.cpp b/libcxx/test/libcxx-03/input.output/file.streams/fstreams/fstream.members/open_wchar_pointer.pass.cpp
new file mode 100644
index 0000000000000..b592492f84830
--- /dev/null
+++ b/libcxx/test/libcxx-03/input.output/file.streams/fstreams/fstream.members/open_wchar_pointer.pass.cpp
@@ -0,0 +1,58 @@
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// <fstream>
+
+// template <class charT, class traits = char_traits<charT> >
+// class basic_fstream
+
+// void open(const wchar_t* s, ios_base::openmode mode = ios_base::in|ios_base::out);
+
+// This extension is only provided on Windows.
+// REQUIRES: windows
+// UNSUPPORTED: no-wide-characters
+
+// TODO: This should not be necessary
+// ADDITIONAL_COMPILE_FLAGS:-D_LIBCPP_ENABLE_CXX26_REMOVED_CODECVT -D_LIBCPP_ENABLE_CXX26_REMOVED_WSTRING_CONVERT
+
+#include <fstream>
+#include <cassert>
+#include "test_macros.h"
+#include "wide_temp_file.h"
+
+int main(int, char**) {
+ std::wstring temp = get_wide_temp_file_name();
+ {
+ std::fstream fs;
+ assert(!fs.is_open());
+ fs.open(temp.c_str(), std::ios_base::in | std::ios_base::out
+ | std::ios_base::trunc);
+ assert(fs.is_open());
+ double x = 0;
+ fs << 3.25;
+ fs.seekg(0);
+ fs >> x;
+ assert(x == 3.25);
+ }
+ _wremove(temp.c_str());
+ {
+ std::wfstream fs;
+ assert(!fs.is_open());
+ fs.open(temp.c_str(), std::ios_base::in | std::ios_base::out
+ | std::ios_base::trunc);
+ assert(fs.is_open());
+ double x = 0;
+ fs << 3.25;
+ fs.seekg(0);
+ fs >> x;
+ assert(x == 3.25);
+ }
+ _wremove(temp.c_str());
+
+ return 0;
+}
diff --git a/libcxx/test/libcxx-03/input.output/file.streams/fstreams/ifstream.cons/test.dat b/libcxx/test/libcxx-03/input.output/file.streams/fstreams/ifstream.cons/test.dat
new file mode 100644
index 0000000000000..64064d34a8e3e
--- /dev/null
+++ b/libcxx/test/libcxx-03/input.output/file.streams/fstreams/ifstream.cons/test.dat
@@ -0,0 +1 @@
+3.25
\ No newline at end of file
diff --git a/libcxx/test/libcxx-03/input.output/file.streams/fstreams/ifstream.cons/wchar_pointer.pass.cpp b/libcxx/test/libcxx-03/input.output/file.streams/fstreams/ifstream.cons/wchar_pointer.pass.cpp
new file mode 100644
index 0000000000000..18e9b2910d872
--- /dev/null
+++ b/libcxx/test/libcxx-03/input.output/file.streams/fstreams/ifstream.cons/wchar_pointer.pass.cpp
@@ -0,0 +1,48 @@
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// <fstream>
+
+// template <class charT, class traits = char_traits<charT> >
+// class basic_ifstream
+
+// explicit basic_ifstream(const wchar_t* s, ios_base::openmode mode = ios_base::in);
+
+// This extension is only provided on Windows.
+// REQUIRES: windows
+// UNSUPPORTED: no-wide-characters
+
+// FILE_DEPENDENCIES: test.dat
+
+#include <fstream>
+#include <cassert>
+
+#include "test_macros.h"
+
+int main(int, char**) {
+ {
+ std::ifstream fs(L"test.dat");
+ double x = 0;
+ fs >> x;
+ assert(x == 3.25);
+ }
+ // std::ifstream(const wchar_t*, std::ios_base::openmode) is tested in
+ // test/libcxx/input.output/file.streams/fstreams/ofstream.cons/wchar_pointer.pass.cpp
+ // which creates writable files.
+ {
+ std::wifstream fs(L"test.dat");
+ double x = 0;
+ fs >> x;
+ assert(x == 3.25);
+ }
+ // std::wifstream(const wchar_t*, std::ios_base::openmode) is tested in
+ // test/libcxx/input.output/file.streams/fstreams/ofstream.cons/wchar_pointer.pass.cpp
+ // which creates writable files.
+
+ return 0;
+}
diff --git a/libcxx/test/libcxx-03/input.output/file.streams/fstreams/ifstream.members/open_wchar_pointer.pass.cpp b/libcxx/test/libcxx-03/input.output/file.streams/fstreams/ifstream.members/open_wchar_pointer.pass.cpp
new file mode 100644
index 0000000000000..3fa8a29e2995a
--- /dev/null
+++ b/libcxx/test/libcxx-03/input.output/file.streams/fstreams/ifstream.members/open_wchar_pointer.pass.cpp
@@ -0,0 +1,54 @@
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// <fstream>
+
+// template <class charT, class traits = char_traits<charT> >
+// class basic_ifstream
+
+// void open(const wchar_t* s, ios_base::openmode mode = ios_base::in);
+
+// This extension is only provided on Windows.
+// REQUIRES: windows
+// UNSUPPORTED: no-wide-characters
+
+// FILE_DEPENDENCIES: test.dat
+
+#include <fstream>
+#include <cassert>
+
+#include "test_macros.h"
+
+int main(int, char**) {
+ {
+ std::ifstream fs;
+ assert(!fs.is_open());
+ char c = 'a';
+ fs >> c;
+ assert(fs.fail());
+ assert(c == 'a');
+ fs.open(L"test.dat");
+ assert(fs.is_open());
+ fs >> c;
+ assert(c == 'r');
+ }
+ {
+ std::wifstream fs;
+ assert(!fs.is_open());
+ wchar_t c = L'a';
+ fs >> c;
+ assert(fs.fail());
+ assert(c == L'a');
+ fs.open(L"test.dat");
+ assert(fs.is_open());
+ fs >> c;
+ assert(c == L'r');
+ }
+
+ return 0;
+}
diff --git a/libcxx/test/libcxx-03/input.output/file.streams/fstreams/ifstream.members/test.dat b/libcxx/test/libcxx-03/input.output/file.streams/fstreams/ifstream.members/test.dat
new file mode 100644
index 0000000000000..1d2f01491f783
--- /dev/null
+++ b/libcxx/test/libcxx-03/input.output/file.streams/fstreams/ifstream.members/test.dat
@@ -0,0 +1 @@
+r
\ No newline at end of file
diff --git a/libcxx/test/libcxx-03/input.output/file.streams/fstreams/ofstream.cons/wchar_pointer.pass.cpp b/libcxx/test/libcxx-03/input.output/file.streams/fstreams/ofstream.cons/wchar_pointer.pass.cpp
new file mode 100644
index 0000000000000..3730e73648d30
--- /dev/null
+++ b/libcxx/test/libcxx-03/input.output/file.streams/fstreams/ofstream.cons/wchar_pointer.pass.cpp
@@ -0,0 +1,66 @@
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// <fstream>
+
+// template <class charT, class traits = char_traits<charT> >
+// class basic_ofstream
+
+// explicit basic_ofstream(const wchar_t* s, ios_base::openmode mode = ios_base::out);
+
+// This extension is only provided on Windows.
+// REQUIRES: windows
+// UNSUPPORTED: no-wide-characters
+
+// TODO: This should not be necessary
+// ADDITIONAL_COMPILE_FLAGS:-D_LIBCPP_ENABLE_CXX26_REMOVED_CODECVT -D_LIBCPP_ENABLE_CXX26_REMOVED_WSTRING_CONVERT
+
+#include <fstream>
+#include <cassert>
+#include "test_macros.h"
+#include "wide_temp_file.h"
+
+int main(int, char**) {
+ std::wstring temp = get_wide_temp_file_name();
+ {
+ std::ofstream fs(temp.c_str());
+ fs << 3.25;
+ }
+ {
+ std::ifstream fs(temp.c_str());
+ double x = 0;
+ fs >> x;
+ assert(x == 3.25);
+ }
+ {
+ std::ifstream fs(temp.c_str(), std::ios_base::out);
+ double x = 0;
+ fs >> x;
+ assert(x == 3.25);
+ }
+ _wremove(temp.c_str());
+ {
+ std::wofstream fs(temp.c_str());
+ fs << 3.25;
+ }
+ {
+ std::wifstream fs(temp.c_str());
+ double x = 0;
+ fs >> x;
+ assert(x == 3.25);
+ }
+ {
+ std::wifstream fs(temp.c_str(), std::ios_base::out);
+ double x = 0;
+ fs >> x;
+ assert(x == 3.25);
+ }
+ _wremove(temp.c_str());
+
+ return 0;
+}
diff --git a/libcxx/test/libcxx-03/input.output/file.streams/fstreams/ofstream.members/open_wchar_pointer.pass.cpp b/libcxx/test/libcxx-03/input.output/file.streams/fstreams/ofstream.members/open_wchar_pointer.pass.cpp
new file mode 100644
index 0000000000000..bfbbd5322161f
--- /dev/null
+++ b/libcxx/test/libcxx-03/input.output/file.streams/fstreams/ofstream.members/open_wchar_pointer.pass.cpp
@@ -0,0 +1,66 @@
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// <fstream>
+
+// template <class charT, class traits = char_traits<charT> >
+// class basic_ofstream
+
+// void open(const wchar_t* s, ios_base::openmode mode = ios_base::out);
+
+// This extension is only provided on Windows.
+// REQUIRES: windows
+// UNSUPPORTED: no-wide-characters
+
+// TODO: This should not be necessary
+// ADDITIONAL_COMPILE_FLAGS:-D_LIBCPP_ENABLE_CXX26_REMOVED_CODECVT -D_LIBCPP_ENABLE_CXX26_REMOVED_WSTRING_CONVERT
+
+#include <fstream>
+#include <cassert>
+#include "test_macros.h"
+#include "wide_temp_file.h"
+
+int main(int, char**) {
+ std::wstring temp = get_wide_temp_file_name();
+ {
+ std::ofstream fs;
+ assert(!fs.is_open());
+ char c = 'a';
+ fs << c;
+ assert(fs.fail());
+ fs.open(temp.c_str());
+ assert(fs.is_open());
+ fs << c;
+ }
+ {
+ std::ifstream fs(temp.c_str());
+ char c = 0;
+ fs >> c;
+ assert(c == 'a');
+ }
+ _wremove(temp.c_str());
+ {
+ std::wofstream fs;
+ assert(!fs.is_open());
+ wchar_t c = L'a';
+ fs << c;
+ assert(fs.fail());
+ fs.open(temp.c_str());
+ assert(fs.is_open());
+ fs << c;
+ }
+ {
+ std::wifstream fs(temp.c_str());
+ wchar_t c = 0;
+ fs >> c;
+ assert(c == L'a');
+ }
+ _wremove(temp.c_str());
+
+ return 0;
+}
diff --git a/libcxx/test/libcxx-03/input.output/file.streams/fstreams/traits_mismatch.verify.cpp b/libcxx/test/libcxx-03/input.output/file.streams/fstreams/traits_mismatch.verify.cpp
new file mode 100644
index 0000000000000..cc52cc119d50e
--- /dev/null
+++ b/libcxx/test/libcxx-03/input.output/file.streams/fstreams/traits_mismatch.verify.cpp
@@ -0,0 +1,29 @@
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// <fstream>
+
+// template <class charT, class traits = char_traits<charT> >
+// class basic_fstream
+
+// The char type of the stream and the char_type of the traits have to match
+
+// UNSUPPORTED: no-wide-characters
+
+#include <fstream>
+
+std::basic_fstream<char, std::char_traits<wchar_t> > f;
+// expected-error-re@*:* {{static assertion failed{{.*}}traits_type::char_type must be the same type as CharT}}
+// expected-error-re@*:* {{static assertion failed{{.*}}traits_type::char_type must be the same type as CharT}}
+
+// expected-error@*:* 11 {{only virtual member functions can be marked 'override'}}
+
+// FIXME: As of commit r324062 Clang incorrectly generates a diagnostic about mismatching
+// exception specifications for types which are already invalid for one reason or another.
+// For now we tolerate this diagnostic.
+// expected-error@*:* 0-1 {{exception specification of overriding function is more lax than base version}}
diff --git a/libcxx/test/libcxx-03/input.output/file.streams/lit.local.cfg b/libcxx/test/libcxx-03/input.output/file.streams/lit.local.cfg
new file mode 100644
index 0000000000000..ac628161afe73
--- /dev/null
+++ b/libcxx/test/libcxx-03/input.output/file.streams/lit.local.cfg
@@ -0,0 +1,7 @@
+# Load the same local configuration as the corresponding one in libcxx/test/std
+import os
+
+inLibcxx = os.path.join("libcxx", "test", "libcxx-03")
+inStd = os.path.join("libcxx", "test", "std")
+localConfig = os.path.normpath(os.path.realpath(__file__)).replace(inLibcxx, inStd)
+config.load_from_path(localConfig, lit_config)
diff --git a/libcxx/test/libcxx-03/input.output/iostream.format/input.streams/traits_mismatch.verify.cpp b/libcxx/test/libcxx-03/input.output/iostream.format/input.streams/traits_mismatch.verify.cpp
new file mode 100644
index 0000000000000..a03aed123c03c
--- /dev/null
+++ b/libcxx/test/libcxx-03/input.output/iostream.format/input.streams/traits_mismatch.verify.cpp
@@ -0,0 +1,25 @@
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// <istream>
+
+// template <class charT, class traits = char_traits<charT> >
+// class basic_istream;
+
+// The char type of the stream and the char_type of the traits have to match
+
+// UNSUPPORTED: no-wide-characters
+
+#include <istream>
+#include <string>
+
+struct test_istream
+ : public std::basic_istream<char, std::char_traits<wchar_t> > {};
+
+// expected-error-re@*:* {{static assertion failed{{.*}}traits_type::char_type must be the same type as CharT}}
+// expected-error@*:* {{only virtual member functions can be marked 'override'}}
diff --git a/libcxx/test/libcxx-03/input.output/iostream.format/lit.local.cfg b/libcxx/test/libcxx-03/input.output/iostream.format/lit.local.cfg
new file mode 100644
index 0000000000000..ac628161afe73
--- /dev/null
+++ b/libcxx/test/libcxx-03/input.output/iostream.format/lit.local.cfg
@@ -0,0 +1,7 @@
+# Load the same local configuration as the corresponding one in libcxx/test/std
+import os
+
+inLibcxx = os.path.join("libcxx", "test", "libcxx-03")
+inStd = os.path.join("libcxx", "test", "std")
+localConfig = os.path.normpath(os.path.realpath(__file__)).replace(inLibcxx, inStd)
+config.load_from_path(localConfig, lit_config)
diff --git a/libcxx/test/libcxx-03/input.output/iostream.format/output.streams/traits_mismatch.verify.cpp b/libcxx/test/libcxx-03/input.output/iostream.format/output.streams/traits_mismatch.verify.cpp
new file mode 100644
index 0000000000000..9e7bc998eb91c
--- /dev/null
+++ b/libcxx/test/libcxx-03/input.output/iostream.format/output.streams/traits_mismatch.verify.cpp
@@ -0,0 +1,25 @@
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// <ostream>
+
+// template <class charT, class traits = char_traits<charT> >
+// class basic_ostream;
+
+// The char type of the stream and the char_type of the traits have to match
+
+// UNSUPPORTED: no-wide-characters
+
+#include <ostream>
+#include <string>
+
+struct test_ostream
+ : public std::basic_ostream<char, std::char_traits<wchar_t> > {};
+
+// expected-error-re@*:* {{static assertion failed{{.*}}traits_type::char_type must be the same type as CharT}}
+// expected-error@*:* {{only virtual member functions can be marked 'override'}}
diff --git a/libcxx/test/libcxx-03/input.output/iostream.objects/lit.local.cfg b/libcxx/test/libcxx-03/input.output/iostream.objects/lit.local.cfg
new file mode 100644
index 0000000000000..ac628161afe73
--- /dev/null
+++ b/libcxx/test/libcxx-03/input.output/iostream.objects/lit.local.cfg
@@ -0,0 +1,7 @@
+# Load the same local configuration as the corresponding one in libcxx/test/std
+import os
+
+inLibcxx = os.path.join("libcxx", "test", "libcxx-03")
+inStd = os.path.join("libcxx", "test", "std")
+localConfig = os.path.normpath(os.path.realpath(__file__)).replace(inLibcxx, inStd)
+config.load_from_path(localConfig, lit_config)
diff --git a/libcxx/test/libcxx-03/input.output/iostreams.base/ios.base/ios.base.cons/dtor.uninitialized.pass.cpp b/libcxx/test/libcxx-03/input.output/iostreams.base/ios.base/ios.base.cons/dtor.uninitialized.pass.cpp
new file mode 100644
index 0000000000000..c04250987e8e2
--- /dev/null
+++ b/libcxx/test/libcxx-03/input.output/iostreams.base/ios.base/ios.base.cons/dtor.uninitialized.pass.cpp
@@ -0,0 +1,83 @@
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// TODO(mordante) Investigate
+// UNSUPPORTED: apple-clang
+
+// UNSUPPORTED: no-exceptions
+
+// The fix for issue 57964 requires an updated dylib due to explicit
+// instantiations. That means Apple backdeployment targets remain broken.
+// XFAIL using-built-library-before-llvm-19
+
+// <ios>
+
+// class ios_base
+
+// ~ios_base()
+//
+// Destroying a constructed ios_base object that has not been
+// initialized by basic_ios::init is undefined behaviour. This can
+// happen in practice, make sure the undefined behaviour is handled
+// gracefully.
+//
+//
+// [ios.base.cons]/1
+//
+// ios_base();
+// Effects: Each ios_base member has an indeterminate value after construction.
+// The object's members shall be initialized by calling basic_ios::init before
+// the object's first use or before it is destroyed, whichever comes first;
+// otherwise the behavior is undefined.
+//
+// [basic.ios.cons]/2
+//
+// basic_ios();
+// Effects: Leaves its member objects uninitialized. The object shall be
+// initialized by calling basic_ios::init before its first use or before it is
+// destroyed, whichever comes first; otherwise the behavior is undefined.
+//
+// ostream and friends have a basic_ios virtual base.
+// [class.base.init]/13
+// In a non-delegating constructor, initialization proceeds in the
+// following order:
+// - First, and only for the constructor of the most derived class
+// ([intro.object]), virtual base classes are initialized ...
+//
+// So in this example
+// struct Foo : AlwaysThrows, std::ostream {
+// Foo() : AlwaysThrows{}, std::ostream{nullptr} {}
+// };
+//
+// Here
+// - the ios_base object is constructed
+// - the AlwaysThrows object is constructed and throws an exception
+// - the AlwaysThrows object is destrodyed
+// - the ios_base object is destroyed
+//
+// The ios_base object is destroyed before it has been initialized and runs
+// into undefined behavior. By using __loc_ as a sentinel we can avoid
+// accessing uninitialized memory in the destructor.
+
+#include <ostream>
+
+struct AlwaysThrows {
+ AlwaysThrows() { throw 1; }
+};
+
+struct Foo : AlwaysThrows, std::ostream {
+ Foo() : AlwaysThrows(), std::ostream(nullptr) {}
+};
+
+int main(int, char**) {
+ try {
+ Foo foo;
+ } catch (...) {
+ };
+ return 0;
+}
diff --git a/libcxx/test/libcxx-03/input.output/iostreams.base/ios/iostate.flags/clear.abort.pass.cpp b/libcxx/test/libcxx-03/input.output/iostreams.base/ios/iostate.flags/clear.abort.pass.cpp
new file mode 100644
index 0000000000000..8f0f5a6d78b13
--- /dev/null
+++ b/libcxx/test/libcxx-03/input.output/iostreams.base/ios/iostate.flags/clear.abort.pass.cpp
@@ -0,0 +1,43 @@
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// <ios>
+
+// template <class charT, class traits> class basic_ios
+
+// void clear(iostate state);
+
+// Make sure that we abort() when exceptions are disabled and the exception
+// flag is set for the iostate we pass to clear().
+
+// REQUIRES: no-exceptions
+
+#include <csignal>
+#include <cstdlib>
+#include <ios>
+#include <streambuf>
+
+#include "test_macros.h"
+
+
+void exit_success(int) {
+ std::_Exit(EXIT_SUCCESS);
+}
+
+struct testbuf : public std::streambuf {};
+
+int main(int, char**) {
+ std::signal(SIGABRT, exit_success);
+
+ testbuf buf;
+ std::ios ios(&buf);
+ ios.exceptions(std::ios::badbit);
+ ios.clear(std::ios::badbit);
+
+ return EXIT_FAILURE;
+}
diff --git a/libcxx/test/libcxx-03/input.output/iostreams.base/lit.local.cfg b/libcxx/test/libcxx-03/input.output/iostreams.base/lit.local.cfg
new file mode 100644
index 0000000000000..ac628161afe73
--- /dev/null
+++ b/libcxx/test/libcxx-03/input.output/iostreams.base/lit.local.cfg
@@ -0,0 +1,7 @@
+# Load the same local configuration as the corresponding one in libcxx/test/std
+import os
+
+inLibcxx = os.path.join("libcxx", "test", "libcxx-03")
+inStd = os.path.join("libcxx", "test", "std")
+localConfig = os.path.normpath(os.path.realpath(__file__)).replace(inLibcxx, inStd)
+config.load_from_path(localConfig, lit_config)
diff --git a/libcxx/test/libcxx-03/input.output/stream.buffers/lit.local.cfg b/libcxx/test/libcxx-03/input.output/stream.buffers/lit.local.cfg
new file mode 100644
index 0000000000000..ac628161afe73
--- /dev/null
+++ b/libcxx/test/libcxx-03/input.output/stream.buffers/lit.local.cfg
@@ -0,0 +1,7 @@
+# Load the same local configuration as the corresponding one in libcxx/test/std
+import os
+
+inLibcxx = os.path.join("libcxx", "test", "libcxx-03")
+inStd = os.path.join("libcxx", "test", "std")
+localConfig = os.path.normpath(os.path.realpath(__file__)).replace(inLibcxx, inStd)
+config.load_from_path(localConfig, lit_config)
diff --git a/libcxx/test/libcxx-03/input.output/string.streams/lit.local.cfg b/libcxx/test/libcxx-03/input.output/string.streams/lit.local.cfg
new file mode 100644
index 0000000000000..ac628161afe73
--- /dev/null
+++ b/libcxx/test/libcxx-03/input.output/string.streams/lit.local.cfg
@@ -0,0 +1,7 @@
+# Load the same local configuration as the corresponding one in libcxx/test/std
+import os
+
+inLibcxx = os.path.join("libcxx", "test", "libcxx-03")
+inStd = os.path.join("libcxx", "test", "std")
+localConfig = os.path.normpath(os.path.realpath(__file__)).replace(inLibcxx, inStd)
+config.load_from_path(localConfig, lit_config)
diff --git a/libcxx/test/libcxx-03/input.output/string.streams/stringbuf/const_sso_buffer.pass.cpp b/libcxx/test/libcxx-03/input.output/string.streams/stringbuf/const_sso_buffer.pass.cpp
new file mode 100644
index 0000000000000..2b6c3802a56b6
--- /dev/null
+++ b/libcxx/test/libcxx-03/input.output/string.streams/stringbuf/const_sso_buffer.pass.cpp
@@ -0,0 +1,171 @@
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// <sstream>
+
+// XFAIL: FROZEN-CXX03-HEADERS-FIXME
+
+// How the constructors of basic_stringbuf initialize the buffer pointers is
+// not specified. For some constructors it's implementation defined whether the
+// pointers are set to nullptr. Libc++'s implementation directly uses the SSO
+// buffer of a std::string as the initial size. This test validates that
+// behaviour.
+//
+// This behaviour is allowed by LWG2995.
+
+#include <sstream>
+#include <cassert>
+
+#include "test_macros.h"
+#include "min_allocator.h"
+
+template <class CharT>
+struct test_buf : public std::basic_stringbuf<CharT> {
+ typedef std::basic_streambuf<CharT> base;
+ typedef typename base::char_type char_type;
+ typedef typename base::int_type int_type;
+ typedef typename base::traits_type traits_type;
+
+ char_type* pbase() const { return base::pbase(); }
+ char_type* pptr() const { return base::pptr(); }
+ char_type* epptr() const { return base::epptr(); }
+ void gbump(int n) { base::gbump(n); }
+
+ virtual int_type overflow(int_type c = traits_type::eof()) { return base::overflow(c); }
+
+ test_buf() = default;
+ explicit test_buf(std::ios_base::openmode which) : std::basic_stringbuf<CharT>(which) {}
+
+ explicit test_buf(const std::basic_string<CharT>& s) : std::basic_stringbuf<CharT>(s) {}
+#if TEST_STD_VER >= 20
+ explicit test_buf(const std::allocator<CharT>& a) : std::basic_stringbuf<CharT>(a) {}
+ test_buf(std::ios_base::openmode which, const std::allocator<CharT>& a) : std::basic_stringbuf<CharT>(which, a) {}
+ explicit test_buf(std::basic_string<CharT>&& s)
+ : std::basic_stringbuf<CharT>(std::forward<std::basic_string<CharT>>(s)) {}
+
+ test_buf(const std::basic_string<CharT, std::char_traits<CharT>, min_allocator<CharT>>& s,
+ const std::allocator<CharT>& a)
+ : std::basic_stringbuf<CharT>(s, a) {}
+ test_buf(const std::basic_string<CharT, std::char_traits<CharT>, min_allocator<CharT>>& s,
+ std::ios_base::openmode which,
+ const std::allocator<CharT>& a)
+ : std::basic_stringbuf<CharT>(s, which, a) {}
+ test_buf(const std::basic_string<CharT, std::char_traits<CharT>, min_allocator<CharT>>& s)
+ : std::basic_stringbuf<CharT>(s) {}
+#endif // TEST_STD_VER >= 20
+
+#if TEST_STD_VER >= 26
+ test_buf(std::basic_string_view<CharT> s) : std::basic_stringbuf<CharT>(s) {}
+ test_buf(std::basic_string_view<CharT> s, const std::allocator<CharT>& a) : std::basic_stringbuf<CharT>(s, a) {}
+ test_buf(std::basic_string_view<CharT> s, std::ios_base::openmode which, const std::allocator<CharT>& a)
+ : std::basic_stringbuf<CharT>(s, which, a) {}
+#endif // TEST_STD_VER >= 26
+};
+
+template <class CharT>
+static void test() {
+ std::size_t size = std::basic_string<CharT>().capacity(); // SSO buffer size.
+ {
+ test_buf<CharT> b;
+ assert(b.pbase() != nullptr);
+ assert(b.pptr() == b.pbase());
+ assert(b.epptr() == b.pbase() + size);
+ }
+ {
+ test_buf<CharT> b(std::ios_base::out);
+ assert(b.pbase() != nullptr);
+ assert(b.pptr() == b.pbase());
+ assert(b.epptr() == b.pbase() + size);
+ }
+ {
+ std::basic_string<CharT> s;
+ s.reserve(1024);
+ test_buf<CharT> b(s);
+ assert(b.pbase() != nullptr);
+ assert(b.pptr() == b.pbase());
+ assert(b.epptr() == b.pbase() + size); // copy so uses size
+ }
+#if TEST_STD_VER >= 20
+ {
+ test_buf<CharT> b = test_buf<CharT>(std::allocator<CharT>());
+ assert(b.pbase() != nullptr);
+ assert(b.pptr() == b.pbase());
+ assert(b.epptr() == b.pbase() + size);
+ }
+ {
+ test_buf<CharT> b = test_buf<CharT>(std::ios_base::out, std::allocator<CharT>());
+ assert(b.pbase() != nullptr);
+ assert(b.pptr() == b.pbase());
+ assert(b.epptr() == b.pbase() + size);
+ }
+ {
+ std::basic_string<CharT> s;
+ s.reserve(1024);
+ std::size_t capacity = s.capacity();
+ test_buf<CharT> b = test_buf<CharT>(std::move(s));
+ assert(b.pbase() != nullptr);
+ assert(b.pptr() == b.pbase());
+ assert(b.epptr() >= b.pbase() + capacity); // move so uses s.capacity()
+ }
+ {
+ std::basic_string<CharT, std::char_traits<CharT>, min_allocator<CharT>> s;
+ s.reserve(1024);
+ test_buf<CharT> b = test_buf<CharT>(s, std::allocator<CharT>());
+ assert(b.pbase() != nullptr);
+ assert(b.pptr() == b.pbase());
+ assert(b.epptr() == b.pbase() + size); // copy so uses size
+ }
+ {
+ std::basic_string<CharT, std::char_traits<CharT>, min_allocator<CharT>> s;
+ s.reserve(1024);
+ test_buf<CharT> b = test_buf<CharT>(s, std::ios_base::out, std::allocator<CharT>());
+ assert(b.pbase() != nullptr);
+ assert(b.pptr() == b.pbase());
+ assert(b.epptr() == b.pbase() + size); // copy so uses size
+ }
+ {
+ std::basic_string<CharT, std::char_traits<CharT>, min_allocator<CharT>> s;
+ s.reserve(1024);
+ test_buf<CharT> b = test_buf<CharT>(s);
+ assert(b.pbase() != nullptr);
+ assert(b.pptr() == b.pbase());
+ assert(b.epptr() == b.pbase() + size); // copy so uses size
+ }
+#endif // TEST_STD_VER >= 20
+#if TEST_STD_VER >= 26
+ {
+ std::basic_string_view<CharT> s;
+ test_buf<CharT> b = test_buf<CharT>(s);
+ assert(b.pbase() != nullptr);
+ assert(b.pptr() == b.pbase());
+ assert(b.epptr() == b.pbase() + size);
+ }
+ {
+ std::basic_string_view<CharT> s;
+ test_buf<CharT> b = test_buf<CharT>(s, std::allocator<CharT>());
+ assert(b.pbase() != nullptr);
+ assert(b.pptr() == b.pbase());
+ assert(b.epptr() == b.pbase() + size);
+ }
+ {
+ std::basic_string_view<CharT> s;
+ test_buf<CharT> b = test_buf<CharT>(s, std::ios_base::out, std::allocator<CharT>());
+ assert(b.pbase() != nullptr);
+ assert(b.pptr() == b.pbase());
+ assert(b.epptr() == b.pbase() + size);
+ }
+#endif // TEST_STD_VER >= 26
+}
+
+int main(int, char**) {
+ test<char>();
+#ifndef TEST_HAS_NO_WIDE_CHARACTERS
+ test<wchar_t>();
+#endif
+ return 0;
+}
diff --git a/libcxx/test/libcxx-03/input.output/string.streams/traits_mismatch.verify.cpp b/libcxx/test/libcxx-03/input.output/string.streams/traits_mismatch.verify.cpp
new file mode 100644
index 0000000000000..36f3222c3a7ac
--- /dev/null
+++ b/libcxx/test/libcxx-03/input.output/string.streams/traits_mismatch.verify.cpp
@@ -0,0 +1,25 @@
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// <sstream>
+
+// template<class charT, class traits = char_traits<charT>,
+// class Allocator = allocator<charT>>
+// class basic_stringbuf;
+//
+// The char type of the stream and the char_type of the traits have to match
+
+// UNSUPPORTED: no-wide-characters
+
+#include <sstream>
+
+std::basic_stringbuf<char, std::char_traits<wchar_t> > sb;
+// expected-error-re@*:* {{static assertion failed{{.*}}traits_type::char_type must be the same type as CharT}}
+// expected-error-re@*:* {{static assertion failed{{.*}}traits_type::char_type must be the same type as CharT}}
+
+// expected-error@*:* 5 {{only virtual member functions can be marked 'override'}}
diff --git a/libcxx/test/libcxx-03/iterators/aliasing_iterator.pass.cpp b/libcxx/test/libcxx-03/iterators/aliasing_iterator.pass.cpp
new file mode 100644
index 0000000000000..33774578e2337
--- /dev/null
+++ b/libcxx/test/libcxx-03/iterators/aliasing_iterator.pass.cpp
@@ -0,0 +1,47 @@
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// ADDITIONAL_COMPILE_FLAGS(clang): -Wprivate-header
+
+// XFAIL: FROZEN-CXX03-HEADERS-FIXME
+
+#include <__iterator/aliasing_iterator.h>
+#include <cassert>
+
+struct NonTrivial {
+ int i_;
+
+ NonTrivial(int i) : i_(i) {}
+ NonTrivial(const NonTrivial& other) : i_(other.i_) {}
+
+ NonTrivial& operator=(const NonTrivial& other) {
+ i_ = other.i_;
+ return *this;
+ }
+
+ ~NonTrivial() {}
+};
+
+int main(int, char**) {
+ {
+ NonTrivial arr[] = {1, 2, 3, 4};
+ std::__aliasing_iterator<NonTrivial*, int> iter(arr);
+
+ assert(*iter == 1);
+ assert(iter[0] == 1);
+ assert(iter[1] == 2);
+ ++iter;
+ assert(*iter == 2);
+ assert(iter[-1] == 1);
+ assert(iter.__base() == arr + 1);
+ assert(iter == iter);
+ assert(iter != (iter + 1));
+ }
+
+ return 0;
+}
diff --git a/libcxx/test/libcxx-03/iterators/bounded_iter/arithmetic.pass.cpp b/libcxx/test/libcxx-03/iterators/bounded_iter/arithmetic.pass.cpp
new file mode 100644
index 0000000000000..3fc735b441676
--- /dev/null
+++ b/libcxx/test/libcxx-03/iterators/bounded_iter/arithmetic.pass.cpp
@@ -0,0 +1,114 @@
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// template <class _Iterator>
+// struct __bounded_iter;
+//
+// Arithmetic operators
+
+// XFAIL: FROZEN-CXX03-HEADERS-FIXME
+
+#include <__iterator/bounded_iter.h>
+#include <cstddef>
+
+#include "test_iterators.h"
+#include "test_macros.h"
+
+template <class Iter>
+TEST_CONSTEXPR_CXX14 bool tests() {
+ int array[] = {40, 41, 42, 43, 44};
+ int* b = array + 0;
+ int* e = array + 5;
+
+ // ++it
+ {
+ std::__bounded_iter<Iter> iter = std::__make_bounded_iter(Iter(b), Iter(b), Iter(e));
+ std::__bounded_iter<Iter>& result = ++iter;
+ assert(&result == &iter);
+ assert(*iter == 41);
+ }
+ // it++
+ {
+ std::__bounded_iter<Iter> iter = std::__make_bounded_iter(Iter(b), Iter(b), Iter(e));
+ std::__bounded_iter<Iter> result = iter++;
+ assert(*result == 40);
+ assert(*iter == 41);
+ }
+ // --it
+ {
+ std::__bounded_iter<Iter> iter = std::__make_bounded_iter(Iter(b + 3), Iter(b), Iter(e));
+ std::__bounded_iter<Iter>& result = --iter;
+ assert(&result == &iter);
+ assert(*iter == 42);
+ }
+ // it--
+ {
+ std::__bounded_iter<Iter> iter = std::__make_bounded_iter(Iter(b + 3), Iter(b), Iter(e));
+ std::__bounded_iter<Iter> result = iter--;
+ assert(*result == 43);
+ assert(*iter == 42);
+ }
+ // it += n
+ {
+ std::__bounded_iter<Iter> iter = std::__make_bounded_iter(Iter(b), Iter(b), Iter(e));
+ std::__bounded_iter<Iter>& result = (iter += 3);
+ assert(&result == &iter);
+ assert(*iter == 43);
+ }
+ // it + n
+ {
+ std::__bounded_iter<Iter> iter = std::__make_bounded_iter(Iter(b), Iter(b), Iter(e));
+ std::__bounded_iter<Iter> result = iter + 3;
+ assert(*iter == 40);
+ assert(*result == 43);
+ }
+ // n + it
+ {
+ std::__bounded_iter<Iter> iter = std::__make_bounded_iter(Iter(b), Iter(b), Iter(e));
+ std::__bounded_iter<Iter> result = 3 + iter;
+ assert(*iter == 40);
+ assert(*result == 43);
+ }
+ // it -= n
+ {
+ std::__bounded_iter<Iter> iter = std::__make_bounded_iter(Iter(b + 3), Iter(b), Iter(e));
+ std::__bounded_iter<Iter>& result = (iter -= 3);
+ assert(&result == &iter);
+ assert(*iter == 40);
+ }
+ // it - n
+ {
+ std::__bounded_iter<Iter> iter = std::__make_bounded_iter(Iter(b + 3), Iter(b), Iter(e));
+ std::__bounded_iter<Iter> result = iter - 3;
+ assert(*iter == 43);
+ assert(*result == 40);
+ }
+ // it - it
+ {
+ std::__bounded_iter<Iter> iter1 = std::__make_bounded_iter(Iter(b), Iter(b), Iter(e));
+ std::__bounded_iter<Iter> iter2 = std::__make_bounded_iter(Iter(e), Iter(b), Iter(e));
+ std::ptrdiff_t result = iter2 - iter1;
+ assert(result == 5);
+ }
+
+ return true;
+}
+
+int main(int, char**) {
+ tests<int*>();
+#if TEST_STD_VER > 11
+ static_assert(tests<int*>(), "");
+#endif
+
+#if TEST_STD_VER > 17
+ tests<contiguous_iterator<int*> >();
+ static_assert(tests<contiguous_iterator<int*> >(), "");
+#endif
+
+ return 0;
+}
diff --git a/libcxx/test/libcxx-03/iterators/bounded_iter/comparison.pass.cpp b/libcxx/test/libcxx-03/iterators/bounded_iter/comparison.pass.cpp
new file mode 100644
index 0000000000000..a12b77afa0db0
--- /dev/null
+++ b/libcxx/test/libcxx-03/iterators/bounded_iter/comparison.pass.cpp
@@ -0,0 +1,89 @@
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// template <class _Iterator>
+// struct __bounded_iter;
+//
+// Comparison operators
+
+// XFAIL: FROZEN-CXX03-HEADERS-FIXME
+
+#include <concepts>
+#include <__iterator/bounded_iter.h>
+
+#include "test_iterators.h"
+#include "test_macros.h"
+
+template <class Iter>
+TEST_CONSTEXPR_CXX14 bool tests() {
+ int array[] = {0, 1, 2, 3, 4};
+ int* b = array + 0;
+ int* e = array + 5;
+ std::__bounded_iter<Iter> const iter1 = std::__make_bounded_iter(Iter(b), Iter(b), Iter(e));
+ std::__bounded_iter<Iter> const iter2 = std::__make_bounded_iter(Iter(e), Iter(b), Iter(e));
+
+ // operator==
+ {
+ assert(iter1 == iter1);
+ assert(!(iter1 == iter2));
+ }
+ // operator!=
+ {
+ assert(iter1 != iter2);
+ assert(!(iter1 != iter1));
+ }
+ // operator<
+ {
+ assert(iter1 < iter2);
+ assert(!(iter2 < iter1));
+ assert(!(iter1 < iter1));
+ }
+ // operator>
+ {
+ assert(iter2 > iter1);
+ assert(!(iter1 > iter2));
+ assert(!(iter1 > iter1));
+ }
+ // operator<=
+ {
+ assert(iter1 <= iter2);
+ assert(!(iter2 <= iter1));
+ assert(iter1 <= iter1);
+ }
+ // operator>=
+ {
+ assert(iter2 >= iter1);
+ assert(!(iter1 >= iter2));
+ assert(iter1 >= iter1);
+ }
+
+#if TEST_STD_VER >= 20
+ // P1614
+ std::same_as<std::strong_ordering> decltype(auto) r1 = iter1 <=> iter2;
+ assert(r1 == std::strong_ordering::less);
+#endif
+
+ return true;
+}
+
+int main(int, char**) {
+ tests<int*>();
+#if TEST_STD_VER > 11
+ static_assert(tests<int*>(), "");
+#endif
+
+#if TEST_STD_VER > 17
+ tests<contiguous_iterator<int*>>();
+ static_assert(tests<contiguous_iterator<int*>>());
+
+ tests<three_way_contiguous_iterator<int*>>();
+ static_assert(tests<three_way_contiguous_iterator<int*>>());
+#endif
+
+ return 0;
+}
diff --git a/libcxx/test/libcxx-03/iterators/bounded_iter/pointer_traits.pass.cpp b/libcxx/test/libcxx-03/iterators/bounded_iter/pointer_traits.pass.cpp
new file mode 100644
index 0000000000000..22ad8c6706d6f
--- /dev/null
+++ b/libcxx/test/libcxx-03/iterators/bounded_iter/pointer_traits.pass.cpp
@@ -0,0 +1,63 @@
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// template <class _Iterator>
+// struct __bounded_iter;
+//
+// std::pointer_traits specialization
+
+// XFAIL: FROZEN-CXX03-HEADERS-FIXME
+
+#include <__iterator/bounded_iter.h>
+#include <cassert>
+#include <cstddef>
+#include <memory>
+#include <type_traits>
+
+#include "test_iterators.h"
+#include "test_macros.h"
+
+template <class Iter>
+TEST_CONSTEXPR_CXX14 bool tests() {
+ using BoundedIter = std::__bounded_iter<Iter>;
+ using PointerTraits = std::pointer_traits<BoundedIter>;
+ using BasePointerTraits = std::pointer_traits<Iter>;
+ static_assert(std::is_same<typename PointerTraits::pointer, BoundedIter>::value, "");
+ static_assert(std::is_same<typename PointerTraits::element_type, typename BasePointerTraits::element_type>::value, "");
+ static_assert(std::is_same<typename PointerTraits::difference_type, typename BasePointerTraits::difference_type>::value, "");
+
+ {
+ int array[] = {0, 1, 2, 3, 4};
+ int* b = array + 0;
+ int* e = array + 5;
+ std::__bounded_iter<Iter> const iter1 = std::__make_bounded_iter(Iter(b), Iter(b), Iter(e));
+ std::__bounded_iter<Iter> const iter2 = std::__make_bounded_iter(Iter(e), Iter(b), Iter(e));
+ assert(std::__to_address(iter1) == b); // in-bounds iterator
+ assert(std::__to_address(iter2) == e); // out-of-bounds iterator
+#if TEST_STD_VER > 17
+ assert(std::to_address(iter1) == b); // in-bounds iterator
+ assert(std::to_address(iter2) == e); // out-of-bounds iterator
+#endif
+ }
+
+ return true;
+}
+
+int main(int, char**) {
+ tests<int*>();
+#if TEST_STD_VER > 11
+ static_assert(tests<int*>(), "");
+#endif
+
+#if TEST_STD_VER > 17
+ tests<contiguous_iterator<int*> >();
+ static_assert(tests<contiguous_iterator<int*> >(), "");
+#endif
+
+ return 0;
+}
diff --git a/libcxx/test/libcxx-03/iterators/bounded_iter/types.compile.pass.cpp b/libcxx/test/libcxx-03/iterators/bounded_iter/types.compile.pass.cpp
new file mode 100644
index 0000000000000..d205c5b03ee3f
--- /dev/null
+++ b/libcxx/test/libcxx-03/iterators/bounded_iter/types.compile.pass.cpp
@@ -0,0 +1,51 @@
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// template <class _Iterator>
+// struct __bounded_iter;
+//
+// Nested types
+
+// XFAIL: FROZEN-CXX03-HEADERS-FIXME
+
+#include <__iterator/bounded_iter.h>
+#include <cstddef>
+#include <iterator>
+#include <type_traits>
+
+#include "test_macros.h"
+
+#if TEST_STD_VER > 17
+struct Iterator {
+ struct value_type {};
+ using difference_type = int;
+ struct pointer {};
+ using reference = value_type&;
+ struct iterator_category : std::random_access_iterator_tag {};
+ using iterator_concept = std::contiguous_iterator_tag;
+};
+
+using BoundedIter1 = std::__bounded_iter<Iterator>;
+static_assert(std::is_same<BoundedIter1::value_type, Iterator::value_type>::value, "");
+static_assert(std::is_same<BoundedIter1::difference_type, Iterator::difference_type>::value, "");
+static_assert(std::is_same<BoundedIter1::pointer, Iterator::pointer>::value, "");
+static_assert(std::is_same<BoundedIter1::reference, Iterator::reference>::value, "");
+static_assert(std::is_same<BoundedIter1::iterator_category, Iterator::iterator_category>::value, "");
+static_assert(std::is_same<BoundedIter1::iterator_concept, Iterator::iterator_concept>::value, "");
+#endif
+
+
+using BoundedIter2 = std::__bounded_iter<int*>;
+static_assert(std::is_same<BoundedIter2::value_type, int>::value, "");
+static_assert(std::is_same<BoundedIter2::difference_type, std::ptrdiff_t>::value, "");
+static_assert(std::is_same<BoundedIter2::pointer, int*>::value, "");
+static_assert(std::is_same<BoundedIter2::reference, int&>::value, "");
+static_assert(std::is_same<BoundedIter2::iterator_category, std::random_access_iterator_tag>::value, "");
+#if TEST_STD_VER > 17
+static_assert(std::is_same<BoundedIter2::iterator_concept, std::contiguous_iterator_tag>::value, "");
+#endif
diff --git a/libcxx/test/libcxx-03/iterators/contiguous_iterators.conv.compile.pass.cpp b/libcxx/test/libcxx-03/iterators/contiguous_iterators.conv.compile.pass.cpp
new file mode 100644
index 0000000000000..4d3690953070f
--- /dev/null
+++ b/libcxx/test/libcxx-03/iterators/contiguous_iterators.conv.compile.pass.cpp
@@ -0,0 +1,65 @@
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+//
+
+// <iterator>
+
+// __bounded_iter<_Iter>
+// __static_bounded_iter<_Iter>
+// __wrap_iter<_Iter>
+
+// Verify that libc++-wrapped iterators do not permit slicing conversion or construction.
+
+// XFAIL: FROZEN-CXX03-HEADERS-FIXME
+
+#include <array>
+#include <span>
+#include <type_traits>
+#include <vector>
+
+#include "test_macros.h"
+
+struct Base {};
+struct Derived : Base {};
+
+template <class B, class D, bool = std::is_pointer<typename std::array<B, 1>::iterator>::value>
+struct test_array_helper : std::true_type {
+ typedef typename std::array<B, 1>::iterator BaseIter;
+ typedef typename std::array<D, 1>::iterator DerivedIter;
+ typedef typename std::array<B, 1>::const_iterator BaseConstIter;
+ typedef typename std::array<D, 1>::const_iterator DerivedConstIter;
+
+ static_assert(!std::is_convertible<DerivedIter, BaseIter>::value, "");
+ static_assert(!std::is_convertible<DerivedIter, BaseConstIter>::value, "");
+ static_assert(!std::is_convertible<DerivedConstIter, BaseConstIter>::value, "");
+ static_assert(!std::is_constructible<BaseIter, DerivedIter>::value, "");
+ static_assert(!std::is_constructible<BaseConstIter, DerivedIter>::value, "");
+ static_assert(!std::is_constructible<BaseConstIter, DerivedConstIter>::value, "");
+};
+
+template <class B, class D>
+struct test_array_helper<B, D, true> : std::true_type {};
+
+static_assert(test_array_helper<Base, Derived>::value, "");
+
+static_assert(!std::is_convertible<std::vector<Derived>::iterator, std::vector<Base>::iterator>::value, "");
+static_assert(!std::is_convertible<std::vector<Derived>::iterator, std::vector<Base>::const_iterator>::value, "");
+static_assert(!std::is_convertible<std::vector<Derived>::const_iterator, std::vector<Base>::const_iterator>::value, "");
+static_assert(!std::is_constructible<std::vector<Base>::iterator, std::vector<Derived>::iterator>::value, "");
+static_assert(!std::is_constructible<std::vector<Base>::const_iterator, std::vector<Derived>::iterator>::value, "");
+static_assert(!std::is_constructible<std::vector<Base>::const_iterator, std::vector<Derived>::const_iterator>::value,
+ "");
+
+#if TEST_STD_VER >= 20
+static_assert(!std::is_convertible_v<std::span<Derived>::iterator, std::span<Base>::iterator>);
+static_assert(!std::is_convertible_v<std::span<Derived>::iterator, std::span<const Base>::iterator>);
+static_assert(!std::is_convertible_v<std::span<const Derived>::iterator, std::span<Base>::iterator>);
+static_assert(!std::is_constructible_v<std::span<Base>::iterator, std::span<Derived>::iterator>);
+static_assert(!std::is_constructible_v<std::span<Base>::iterator, std::span<const Derived>::iterator>);
+static_assert(!std::is_constructible_v<std::span<const Base>::iterator, std::span<const Derived>::iterator>);
+#endif
diff --git a/libcxx/test/libcxx-03/iterators/contiguous_iterators.pass.cpp b/libcxx/test/libcxx-03/iterators/contiguous_iterators.pass.cpp
new file mode 100644
index 0000000000000..f00ca4e879403
--- /dev/null
+++ b/libcxx/test/libcxx-03/iterators/contiguous_iterators.pass.cpp
@@ -0,0 +1,265 @@
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+//
+
+// <iterator>
+
+// __libcpp_is_contiguous_iterator<_Tp>
+
+// __libcpp_is_contiguous_iterator determines if an iterator is contiguous,
+// either because it advertises itself as such (in C++20) or because it
+// is a pointer type or a known trivial wrapper around a pointer type,
+// such as __wrap_iter<T*>.
+//
+
+#include <cassert>
+#include <deque>
+#include <initializer_list>
+#include <iterator>
+#include <string>
+#include <vector>
+
+#include "test_macros.h"
+#include "test_iterators.h"
+
+#if TEST_STD_VER >= 17
+#include <string_view>
+#endif
+
+#if TEST_STD_VER >= 20
+#include <span>
+#endif
+
+class T; // incomplete
+
+class my_input_iterator
+{
+ struct tag : std::input_iterator_tag {};
+ typedef my_input_iterator Self;
+ int *state_;
+public:
+ typedef tag iterator_category;
+ typedef int value_type;
+ typedef int difference_type;
+ typedef int* pointer;
+ typedef int& reference;
+
+ my_input_iterator();
+ reference operator*() const;
+ pointer operator->() const;
+
+ Self& operator++();
+ Self operator++(int);
+ friend bool operator==(const Self&, const Self&);
+ friend bool operator!=(const Self&, const Self&);
+};
+
+class my_random_access_iterator
+{
+ struct tag : std::random_access_iterator_tag {};
+ typedef my_random_access_iterator Self;
+ int *state_;
+public:
+ typedef tag iterator_category;
+ typedef int value_type;
+ typedef int difference_type;
+ typedef int* pointer;
+ typedef int& reference;
+
+ my_random_access_iterator();
+ reference operator*() const;
+ pointer operator->() const;
+ reference operator[](difference_type) const;
+
+ Self& operator++();
+ Self operator++(int);
+ Self& operator--();
+ Self operator--(int);
+ friend Self& operator+=(Self&, difference_type);
+ friend Self& operator-=(Self&, difference_type);
+ friend Self operator+(Self, difference_type);
+ friend Self operator+(difference_type, Self);
+ friend Self operator-(Self, difference_type);
+ friend difference_type operator-(Self, Self);
+ friend bool operator==(const Self&, const Self&);
+ friend bool operator!=(const Self&, const Self&);
+ friend bool operator<(const Self&, const Self&);
+ friend bool operator>(const Self&, const Self&);
+ friend bool operator<=(const Self&, const Self&);
+ friend bool operator>=(const Self&, const Self&);
+};
+
+#if TEST_STD_VER >= 20
+class my_contiguous_iterator
+{
+ struct tag : std::contiguous_iterator_tag {};
+ typedef my_contiguous_iterator Self;
+ int *state_;
+public:
+ typedef tag iterator_category;
+ typedef int value_type;
+ typedef int difference_type;
+ typedef int* pointer;
+ typedef int& reference;
+ typedef int element_type; // enable to_address via pointer_traits
+
+ my_contiguous_iterator();
+ reference operator*() const;
+ pointer operator->() const;
+ reference operator[](difference_type) const;
+
+ Self& operator++();
+ Self operator++(int);
+ Self& operator--();
+ Self operator--(int);
+ friend Self& operator+=(Self&, difference_type);
+ friend Self& operator-=(Self&, difference_type);
+ friend Self operator+(Self, difference_type);
+ friend Self operator+(difference_type, Self);
+ friend Self operator-(Self, difference_type);
+ friend difference_type operator-(Self, Self);
+ friend bool operator==(const Self&, const Self&);
+ friend bool operator!=(const Self&, const Self&);
+ friend bool operator<(const Self&, const Self&);
+ friend bool operator>(const Self&, const Self&);
+ friend bool operator<=(const Self&, const Self&);
+ friend bool operator>=(const Self&, const Self&);
+};
+#endif
+
+struct fake_deque_iterator : std::deque<int>::iterator {
+ using element_type = int;
+};
+static_assert(std::__has_random_access_iterator_category<fake_deque_iterator>::value, "");
+static_assert(!std::__libcpp_is_contiguous_iterator<fake_deque_iterator>::value, "");
+
+#if TEST_STD_VER >= 20
+struct fake2_deque_iterator : std::deque<int>::iterator {
+ using iterator_concept = std::contiguous_iterator_tag;
+ using element_type = int;
+};
+static_assert(std::__has_random_access_iterator_category<fake2_deque_iterator>::value, "");
+static_assert(std::__libcpp_is_contiguous_iterator<fake2_deque_iterator>::value, "");
+#endif
+
+int main(int, char**)
+{
+// basic tests
+ static_assert(( std::__libcpp_is_contiguous_iterator<char *>::value), "");
+ static_assert(( std::__libcpp_is_contiguous_iterator<const char *>::value), "");
+ static_assert(( std::__libcpp_is_contiguous_iterator<int *>::value), "");
+ static_assert(( std::__libcpp_is_contiguous_iterator<int **>::value), "");
+ static_assert(( std::__libcpp_is_contiguous_iterator<T *>::value), "");
+
+ static_assert((!std::__libcpp_is_contiguous_iterator<my_input_iterator>::value), "");
+ static_assert((!std::__libcpp_is_contiguous_iterator<my_random_access_iterator>::value), "");
+#if TEST_STD_VER >= 20
+ static_assert(( std::__libcpp_is_contiguous_iterator<my_contiguous_iterator>::value), "");
+#endif
+
+ // move_iterator changes value category, which makes it pretty sketchy to use in optimized codepaths
+ static_assert((!std::__libcpp_is_contiguous_iterator<std::move_iterator<char *> >::value), "");
+ static_assert((!std::__libcpp_is_contiguous_iterator<std::move_iterator<const char *> >::value), "");
+ static_assert((!std::__libcpp_is_contiguous_iterator<std::move_iterator<int *> >::value), "");
+ static_assert((!std::__libcpp_is_contiguous_iterator<std::move_iterator<T *> >::value), "");
+ static_assert((!std::__libcpp_is_contiguous_iterator<std::move_iterator<my_random_access_iterator> >::value), "");
+#if TEST_STD_VER >= 20
+ static_assert((!std::__libcpp_is_contiguous_iterator<std::move_iterator<my_contiguous_iterator> >::value), "");
+#endif
+
+ static_assert((!std::__libcpp_is_contiguous_iterator<std::reverse_iterator<char *> >::value), "");
+ static_assert((!std::__libcpp_is_contiguous_iterator<std::reverse_iterator<const char *> >::value), "");
+ static_assert((!std::__libcpp_is_contiguous_iterator<std::reverse_iterator<int *> >::value), "");
+ static_assert((!std::__libcpp_is_contiguous_iterator<std::reverse_iterator<T *> >::value), "");
+ static_assert((!std::__libcpp_is_contiguous_iterator<std::reverse_iterator<my_random_access_iterator> >::value), "");
+#if TEST_STD_VER >= 20
+ static_assert((!std::__libcpp_is_contiguous_iterator<std::reverse_iterator<my_contiguous_iterator> >::value), "");
+#endif
+
+ static_assert(( std::__libcpp_is_contiguous_iterator<std::__wrap_iter<char *> >::value), "");
+ static_assert(( std::__libcpp_is_contiguous_iterator<std::__wrap_iter<const char *> >::value), "");
+ static_assert(( std::__libcpp_is_contiguous_iterator<std::__wrap_iter<int *> >::value), "");
+
+ static_assert(( std::__libcpp_is_contiguous_iterator<std::__wrap_iter<T *> >::value), "");
+ static_assert(( std::__libcpp_is_contiguous_iterator<std::__wrap_iter<std::__wrap_iter<T *> > >::value), "");
+
+ // Here my_random_access_iterator is standing in for some user's fancy pointer type, written pre-C++20.
+ static_assert(( std::__libcpp_is_contiguous_iterator<std::__wrap_iter<my_random_access_iterator> >::value), "");
+ static_assert(( std::__libcpp_is_contiguous_iterator<std::__wrap_iter<std::__wrap_iter<my_random_access_iterator> > >::value), "");
+
+#if TEST_STD_VER >= 20
+ static_assert(( std::__libcpp_is_contiguous_iterator<std::__wrap_iter<my_contiguous_iterator> >::value), "");
+ static_assert(( std::__libcpp_is_contiguous_iterator<std::__wrap_iter<std::__wrap_iter<my_contiguous_iterator> > >::value), "");
+#endif
+
+// iterators in the libc++ test suite
+ static_assert((!std::__libcpp_is_contiguous_iterator<cpp17_output_iterator <char *> >::value), "");
+ static_assert((!std::__libcpp_is_contiguous_iterator<cpp17_input_iterator <char *> >::value), "");
+ static_assert((!std::__libcpp_is_contiguous_iterator<forward_iterator <char *> >::value), "");
+ static_assert((!std::__libcpp_is_contiguous_iterator<bidirectional_iterator<char *> >::value), "");
+ static_assert((!std::__libcpp_is_contiguous_iterator<random_access_iterator<char *> >::value), "");
+#if TEST_STD_VER >= 20
+ static_assert(( std::__libcpp_is_contiguous_iterator<contiguous_iterator <char *> >::value), "");
+#endif
+ static_assert((!std::__libcpp_is_contiguous_iterator<ThrowingIterator <char *> >::value), "");
+ static_assert((!std::__libcpp_is_contiguous_iterator<NonThrowingIterator <char *> >::value), "");
+
+//
+// iterators from libc++'s containers
+//
+
+// vector
+ static_assert(( std::__libcpp_is_contiguous_iterator<std::vector<int>::iterator> ::value), "");
+ static_assert(( std::__libcpp_is_contiguous_iterator<std::vector<int>::const_iterator> ::value), "");
+ static_assert((!std::__libcpp_is_contiguous_iterator<std::vector<int>::reverse_iterator> ::value), "");
+ static_assert((!std::__libcpp_is_contiguous_iterator<std::vector<int>::const_reverse_iterator> ::value), "");
+ static_assert(( std::__libcpp_is_contiguous_iterator<std::__wrap_iter<std::vector<int>::iterator> >::value), "");
+
+// string
+ static_assert(( std::__libcpp_is_contiguous_iterator<std::string::iterator> ::value), "");
+ static_assert(( std::__libcpp_is_contiguous_iterator<std::string::const_iterator> ::value), "");
+ static_assert((!std::__libcpp_is_contiguous_iterator<std::string::reverse_iterator> ::value), "");
+ static_assert((!std::__libcpp_is_contiguous_iterator<std::string::const_reverse_iterator>::value), "");
+#ifndef TEST_HAS_NO_WIDE_CHARACTERS
+ static_assert(( std::__libcpp_is_contiguous_iterator<std::wstring::iterator> ::value), "");
+ static_assert(( std::__libcpp_is_contiguous_iterator<std::wstring::const_iterator> ::value), "");
+ static_assert((!std::__libcpp_is_contiguous_iterator<std::wstring::reverse_iterator> ::value), "");
+ static_assert((!std::__libcpp_is_contiguous_iterator<std::wstring::const_reverse_iterator>::value), "");
+#endif
+
+// deque is random-access but not contiguous
+ static_assert((!std::__libcpp_is_contiguous_iterator<std::deque<int>::iterator> ::value), "");
+ static_assert((!std::__libcpp_is_contiguous_iterator<std::deque<int>::const_iterator> ::value), "");
+ static_assert((!std::__libcpp_is_contiguous_iterator<std::deque<int>::reverse_iterator> ::value), "");
+ static_assert((!std::__libcpp_is_contiguous_iterator<std::deque<int>::const_reverse_iterator> ::value), "");
+
+// vector<bool> is random-access but not contiguous
+ static_assert((!std::__libcpp_is_contiguous_iterator<std::vector<bool>::iterator> ::value), "");
+ static_assert((!std::__libcpp_is_contiguous_iterator<std::vector<bool>::const_iterator> ::value), "");
+ static_assert((!std::__libcpp_is_contiguous_iterator<std::vector<bool>::reverse_iterator> ::value), "");
+ static_assert((!std::__libcpp_is_contiguous_iterator<std::vector<bool>::const_reverse_iterator> ::value), "");
+
+#if TEST_STD_VER >= 11
+ static_assert(( std::__libcpp_is_contiguous_iterator<std::initializer_list<int>::iterator> ::value), "");
+ static_assert(( std::__libcpp_is_contiguous_iterator<std::initializer_list<int>::const_iterator>::value), "");
+#endif
+
+#if TEST_STD_VER >= 17
+ static_assert(( std::__libcpp_is_contiguous_iterator<std::string_view::iterator> ::value), "");
+ static_assert(( std::__libcpp_is_contiguous_iterator<std::string_view::const_iterator>::value), "");
+#endif
+
+#if TEST_STD_VER >= 20
+ static_assert(( std::__libcpp_is_contiguous_iterator<std::span< int>::iterator> ::value), "");
+ static_assert((!std::__libcpp_is_contiguous_iterator<std::span< int>::reverse_iterator>::value), "");
+ static_assert(( std::__libcpp_is_contiguous_iterator<std::span<const int>::iterator> ::value), "");
+ static_assert((!std::__libcpp_is_contiguous_iterator<std::span<const int>::reverse_iterator>::value), "");
+#endif
+
+ return 0;
+}
diff --git a/libcxx/test/libcxx-03/iterators/contiguous_iterators.verify.cpp b/libcxx/test/libcxx-03/iterators/contiguous_iterators.verify.cpp
new file mode 100644
index 0000000000000..ba2697c78986c
--- /dev/null
+++ b/libcxx/test/libcxx-03/iterators/contiguous_iterators.verify.cpp
@@ -0,0 +1,27 @@
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+//
+
+// <iterator>
+
+// __bounded_iter<_Iter>
+
+// XFAIL: FROZEN-CXX03-HEADERS-FIXME
+
+// Verify that __bounded_iter does not accept non-contiguous iterators as determined by __libcpp_is_contiguous_iterator.
+// static_assert should be used, see https://github.com/llvm/llvm-project/issues/115002.
+// __wrap_iter cannot be so handled because it may directly wrap user-defined fancy pointers in libc++'s vector.
+
+#include <deque>
+#include <vector>
+#include <array>
+
+// expected-error-re@*:* {{static assertion failed due to requirement {{.*}}Only contiguous iterators can be adapted by __bounded_iter.}}
+std::__bounded_iter<std::deque<int>::iterator> bounded_iter;
+// expected-error-re@*:* {{static assertion failed due to requirement {{.*}}Only contiguous iterators can be adapted by __static_bounded_iter.}}
+std::__static_bounded_iter<std::deque<int>::iterator, 42> statically_bounded_iter;
diff --git a/libcxx/test/libcxx-03/iterators/iterator.primitives/iterator.operations/prev.verify.cpp b/libcxx/test/libcxx-03/iterators/iterator.primitives/iterator.operations/prev.verify.cpp
new file mode 100644
index 0000000000000..ffef687723983
--- /dev/null
+++ b/libcxx/test/libcxx-03/iterators/iterator.primitives/iterator.operations/prev.verify.cpp
@@ -0,0 +1,21 @@
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// std::prev
+
+// XFAIL: FROZEN-CXX03-HEADERS-FIXME
+
+#include <iterator>
+#include "test_iterators.h"
+
+void test() {
+ int arr[] = {1, 2};
+ cpp17_input_iterator<int*> it(&arr[0]);
+ it = std::prev(it);
+ // expected-error-re@*:* {{static assertion failed due to requirement {{.*}}: Attempt to prev(it) with a non-bidirectional iterator}}
+}
diff --git a/libcxx/test/libcxx-03/iterators/predef.iterators/insert.iterators/back.insert.iter.ops/get_container.pass.cpp b/libcxx/test/libcxx-03/iterators/predef.iterators/insert.iterators/back.insert.iter.ops/get_container.pass.cpp
new file mode 100644
index 0000000000000..9f45848e9d3ff
--- /dev/null
+++ b/libcxx/test/libcxx-03/iterators/predef.iterators/insert.iterators/back.insert.iter.ops/get_container.pass.cpp
@@ -0,0 +1,37 @@
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// <iterator>
+
+// back_insert_iterator
+
+// _Container* __get_container(); // constexpr in C++20
+
+#include <iterator>
+#include <vector>
+
+#include "test_macros.h"
+#include "nasty_containers.h"
+#include "test_constexpr_container.h"
+
+template <class C>
+TEST_CONSTEXPR_CXX20 bool test(C c) {
+ const std::back_insert_iterator<C> i(c);
+ assert(i.__get_container() == std::addressof(c));
+ return true;
+}
+
+int main(int, char**) {
+ test(std::vector<int>());
+ test(nasty_vector<int>());
+#if TEST_STD_VER >= 20
+ test(ConstexprFixedCapacityDeque<int, 10>());
+ static_assert(test(ConstexprFixedCapacityDeque<int, 10>()));
+#endif
+ return 0;
+}
diff --git a/libcxx/test/libcxx-03/iterators/stream.iterators/ostreambuf.iterator/ostreambuf.iter.ops/failed.pass.cpp b/libcxx/test/libcxx-03/iterators/stream.iterators/ostreambuf.iterator/ostreambuf.iter.ops/failed.pass.cpp
new file mode 100644
index 0000000000000..c856c931f5280
--- /dev/null
+++ b/libcxx/test/libcxx-03/iterators/stream.iterators/ostreambuf.iterator/ostreambuf.iter.ops/failed.pass.cpp
@@ -0,0 +1,36 @@
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// <iterator>
+
+// class ostreambuf_iterator
+
+// bool failed() const throw();
+//
+// Extension: constructing from NULL is UB; we just make it a failed iterator
+
+#include <iterator>
+#include <cassert>
+
+#include "test_macros.h"
+
+int main(int, char**)
+{
+ {
+ std::ostreambuf_iterator<char> i(nullptr);
+ assert(i.failed());
+ }
+#ifndef TEST_HAS_NO_WIDE_CHARACTERS
+ {
+ std::ostreambuf_iterator<wchar_t> i(nullptr);
+ assert(i.failed());
+ }
+#endif
+
+ return 0;
+}
diff --git a/libcxx/test/libcxx-03/iterators/unwrap_iter.pass.cpp b/libcxx/test/libcxx-03/iterators/unwrap_iter.pass.cpp
new file mode 100644
index 0000000000000..8ef2be2b01074
--- /dev/null
+++ b/libcxx/test/libcxx-03/iterators/unwrap_iter.pass.cpp
@@ -0,0 +1,59 @@
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// check that std::__unwrap_iter() returns the correct type
+
+#include <algorithm>
+#include <cassert>
+#include <string>
+#include <type_traits>
+
+#include "test_iterators.h"
+#include "test_macros.h"
+
+template <class Iter>
+using UnwrapT = decltype(std::__unwrap_iter(std::declval<Iter>()));
+
+template <class Iter>
+using rev_iter = std::reverse_iterator<Iter>;
+
+template <class Iter>
+using rev_rev_iter = rev_iter<rev_iter<Iter> >;
+
+static_assert(std::is_same<UnwrapT<int*>, int*>::value, "");
+static_assert(std::is_same<UnwrapT<std::__wrap_iter<int*> >, int*>::value, "");
+static_assert(std::is_same<UnwrapT<rev_iter<int*> >, std::reverse_iterator<int*> >::value, "");
+static_assert(std::is_same<UnwrapT<rev_rev_iter<int*> >, int*>::value, "");
+static_assert(std::is_same<UnwrapT<rev_rev_iter<std::__wrap_iter<int*> > >, int*>::value, "");
+static_assert(std::is_same<UnwrapT<rev_rev_iter<rev_iter<std::__wrap_iter<int*> > > >, rev_iter<std::__wrap_iter<int*> > >::value, "");
+
+static_assert(std::is_same<UnwrapT<random_access_iterator<int*> >, random_access_iterator<int*> >::value, "");
+static_assert(std::is_same<UnwrapT<rev_iter<random_access_iterator<int*> > >, rev_iter<random_access_iterator<int*> > >::value, "");
+static_assert(std::is_same<UnwrapT<rev_rev_iter<random_access_iterator<int*> > >, random_access_iterator<int*> >::value, "");
+static_assert(std::is_same<UnwrapT<rev_rev_iter<rev_iter<random_access_iterator<int*> > > >, rev_iter<random_access_iterator<int*> > >::value, "");
+
+TEST_CONSTEXPR_CXX20 bool test() {
+ std::string str = "Banane";
+ using Iter = std::string::iterator;
+
+ assert(std::__unwrap_iter(str.begin()) == str.data());
+ assert(std::__unwrap_iter(str.end()) == str.data() + str.size());
+ assert(std::__unwrap_iter(rev_rev_iter<Iter>(rev_iter<Iter>(str.begin()))) == str.data());
+ assert(std::__unwrap_iter(rev_rev_iter<Iter>(rev_iter<Iter>(str.end()))) == str.data() + str.size());
+
+ return true;
+}
+
+int main(int, char**) {
+ test();
+#if TEST_STD_VER > 17
+ static_assert(test());
+#endif
+
+ return 0;
+}
diff --git a/libcxx/test/libcxx-03/language.support/support.c.headers/support.c.headers.other/math.lerp.verify.cpp b/libcxx/test/libcxx-03/language.support/support.c.headers/support.c.headers.other/math.lerp.verify.cpp
new file mode 100644
index 0000000000000..1b84a9bfe47da
--- /dev/null
+++ b/libcxx/test/libcxx-03/language.support/support.c.headers/support.c.headers.other/math.lerp.verify.cpp
@@ -0,0 +1,39 @@
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// When built with modules, this test gives diagnostics like
+// declaration of 'lerp' must be imported from module 'std.compat.cmath'
+// before it is required
+// therefore disable the test in this configuration.
+// UNSUPPORTED: clang-modules-build
+
+// <math.h>
+
+// [support.c.headers.other]/1
+// ... except for the functions described in [sf.cmath], the
+// std::lerp function overloads ([c.math.lerp]) ...
+
+#include <math.h>
+
+void f() {
+ {
+ float f;
+ ::lerp(f, f, f); // expected-error {{no member named 'lerp' in the global namespace}}
+ std::lerp(f, f, f); // expected-error {{no member named 'lerp' in namespace 'std'}}
+ }
+ {
+ double d;
+ ::lerp(d, d, d); // expected-error {{no member named 'lerp' in the global namespace}}
+ std::lerp(d, d, d); // expected-error {{no member named 'lerp' in namespace 'std'}}
+ }
+ {
+ long double l;
+ ::lerp(l, l, l); // expected-error {{no member named 'lerp' in the global namespace}}
+ std::lerp(l, l, l); // expected-error {{no member named 'lerp' in namespace 'std'}}
+ }
+}
diff --git a/libcxx/test/libcxx-03/language.support/support.dynamic/libcpp_deallocate.sh.cpp b/libcxx/test/libcxx-03/language.support/support.dynamic/libcpp_deallocate.sh.cpp
new file mode 100644
index 0000000000000..7ead65caf9fda
--- /dev/null
+++ b/libcxx/test/libcxx-03/language.support/support.dynamic/libcpp_deallocate.sh.cpp
@@ -0,0 +1,255 @@
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// Test libc++'s implementation of align_val_t, and the relevant new/delete
+// overloads in all dialects when -faligned-allocation is present.
+
+// Libc++ when built for z/OS doesn't contain the aligned allocation functions,
+// nor does the dynamic library shipped with z/OS.
+// XFAIL: target={{.+}}-zos{{.*}}
+
+// XFAIL: sanitizer-new-delete && !hwasan
+
+// TODO: Investigate this failure
+// UNSUPPORTED: ubsan
+
+// GCC doesn't support the aligned-allocation flags.
+// XFAIL: gcc
+
+// XFAIL: FROZEN-CXX03-HEADERS-FIXME
+
+// RUN: %{build} -faligned-allocation -fsized-deallocation
+// RUN: %{run}
+// RUN: %{build} -faligned-allocation -fno-sized-deallocation -DNO_SIZE
+// RUN: %{run}
+// RUN: %{build} -fno-aligned-allocation -fsized-deallocation -DNO_ALIGN
+// RUN: %{run}
+// RUN: %{build} -fno-aligned-allocation -fno-sized-deallocation -DNO_ALIGN -DNO_SIZE
+// RUN: %{run}
+
+#include <cassert>
+#include <cstdlib>
+#include <new>
+
+#include "test_macros.h"
+
+TEST_DIAGNOSTIC_PUSH
+TEST_CLANG_DIAGNOSTIC_IGNORED("-Wprivate-header")
+#include <__memory/aligned_alloc.h>
+TEST_DIAGNOSTIC_POP
+
+struct alloc_stats {
+ alloc_stats() { reset(); }
+
+ int aligned_sized_called;
+ int aligned_called;
+ int sized_called;
+ int plain_called;
+ int last_size;
+ int last_align;
+
+ void reset() {
+ aligned_sized_called = aligned_called = sized_called = plain_called = 0;
+ last_align = last_size = -1;
+ }
+
+ bool expect_plain() const {
+ assert(aligned_sized_called == 0);
+ assert(aligned_called == 0);
+ assert(sized_called == 0);
+ assert(last_size == -1);
+ assert(last_align == -1);
+ return plain_called == 1;
+ }
+
+ bool expect_size(int n) const {
+ assert(plain_called == 0);
+ assert(aligned_sized_called == 0);
+ assert(aligned_called == 0);
+ assert(last_size == n);
+ assert(last_align == -1);
+ return sized_called == 1;
+ }
+
+ bool expect_align(int a) const {
+ assert(plain_called == 0);
+ assert(aligned_sized_called == 0);
+ assert(sized_called == 0);
+ assert(last_size == -1);
+ assert(last_align == a);
+ return aligned_called == 1;
+ }
+
+ bool expect_size_align(int n, int a) const {
+ assert(plain_called == 0);
+ assert(sized_called == 0);
+ assert(aligned_called == 0);
+ assert(last_size == n);
+ assert(last_align == a);
+ return aligned_sized_called == 1;
+ }
+};
+alloc_stats stats;
+
+void operator delete(void* p) TEST_NOEXCEPT {
+ ::free(p);
+ stats.plain_called++;
+ stats.last_size = stats.last_align = -1;
+}
+
+#ifndef NO_SIZE
+void operator delete(void* p, std::size_t n) TEST_NOEXCEPT {
+ ::free(p);
+ stats.sized_called++;
+ stats.last_size = n;
+ stats.last_align = -1;
+}
+#endif
+
+#ifndef NO_ALIGN
+void operator delete(void* p, std::align_val_t a) TEST_NOEXCEPT {
+ std::__libcpp_aligned_free(p);
+ stats.aligned_called++;
+ stats.last_align = static_cast<int>(a);
+ stats.last_size = -1;
+}
+
+void operator delete(void* p, std::size_t n, std::align_val_t a) TEST_NOEXCEPT {
+ std::__libcpp_aligned_free(p);
+ stats.aligned_sized_called++;
+ stats.last_align = static_cast<int>(a);
+ stats.last_size = n;
+}
+#endif
+
+void test_libcpp_dealloc() {
+ void* p = nullptr;
+#ifdef __STDCPP_DEFAULT_NEW_ALIGNMENT__
+ std::size_t over_align_val = __STDCPP_DEFAULT_NEW_ALIGNMENT__ * 2;
+#else
+ std::size_t over_align_val = TEST_ALIGNOF(std::max_align_t) * 2;
+#endif
+ std::size_t under_align_val = TEST_ALIGNOF(int);
+ std::size_t with_size_val = 2;
+
+ {
+ std::__libcpp_deallocate_unsized<char>(static_cast<char*>(p), under_align_val);
+ assert(stats.expect_plain());
+ }
+ stats.reset();
+
+#if defined(NO_SIZE) && defined(NO_ALIGN)
+ {
+ std::__libcpp_deallocate<char>(static_cast<char*>(p), std::__element_count(with_size_val), over_align_val);
+ assert(stats.expect_plain());
+ }
+ stats.reset();
+#elif defined(NO_SIZE)
+ {
+ std::__libcpp_deallocate<char>(static_cast<char*>(p), std::__element_count(with_size_val), over_align_val);
+ assert(stats.expect_align(over_align_val));
+ }
+ stats.reset();
+#elif defined(NO_ALIGN)
+ {
+ std::__libcpp_deallocate<char>(static_cast<char*>(p), std::__element_count(with_size_val), over_align_val);
+ assert(stats.expect_size(with_size_val));
+ }
+ stats.reset();
+#else
+ {
+ std::__libcpp_deallocate<char>(static_cast<char*>(p), std::__element_count(with_size_val), over_align_val);
+ assert(stats.expect_size_align(with_size_val, over_align_val));
+ }
+ stats.reset();
+ {
+ std::__libcpp_deallocate_unsized<char>(static_cast<char*>(p), over_align_val);
+ assert(stats.expect_align(over_align_val));
+ }
+ stats.reset();
+ {
+ std::__libcpp_deallocate<char>(static_cast<char*>(p), std::__element_count(with_size_val), under_align_val);
+ assert(stats.expect_size(with_size_val));
+ }
+ stats.reset();
+#endif
+}
+
+struct TEST_ALIGNAS(128) AlignedType {
+ AlignedType() : elem(0) {}
+ TEST_ALIGNAS(128) char elem;
+};
+
+void test_allocator_and_new_match() {
+ stats.reset();
+#if defined(NO_SIZE) && defined(NO_ALIGN)
+ {
+ int* x = DoNotOptimize(new int(42));
+ delete x;
+ assert(stats.expect_plain());
+ }
+ stats.reset();
+ {
+ AlignedType* a = DoNotOptimize(new AlignedType());
+ delete a;
+ assert(stats.expect_plain());
+ }
+ stats.reset();
+#elif defined(NO_SIZE)
+ stats.reset();
+# if TEST_STD_VER >= 11
+ {
+ int* x = DoNotOptimize(new int(42));
+ delete x;
+ assert(stats.expect_plain());
+ }
+# endif
+ stats.reset();
+ {
+ AlignedType* a = DoNotOptimize(new AlignedType());
+ delete a;
+ assert(stats.expect_align(TEST_ALIGNOF(AlignedType)));
+ }
+ stats.reset();
+#elif defined(NO_ALIGN)
+ stats.reset();
+ {
+ int* x = DoNotOptimize(new int(42));
+ delete x;
+ assert(stats.expect_size(sizeof(int)));
+ }
+ stats.reset();
+ {
+ AlignedType* a = DoNotOptimize(new AlignedType());
+ delete a;
+ assert(stats.expect_size(sizeof(AlignedType)));
+ }
+ stats.reset();
+#else
+ stats.reset();
+ {
+ int* x = DoNotOptimize(new int(42));
+ delete x;
+ assert(stats.expect_size(sizeof(int)));
+ }
+ stats.reset();
+ {
+ AlignedType* a = DoNotOptimize(new AlignedType());
+ delete a;
+ assert(stats.expect_size_align(sizeof(AlignedType), TEST_ALIGNOF(AlignedType)));
+ }
+ stats.reset();
+#endif
+}
+
+int main(int, char**) {
+ test_libcpp_dealloc();
+ test_allocator_and_new_match();
+
+ return 0;
+}
diff --git a/libcxx/test/libcxx-03/language.support/support.rtti/type.info/type_info.comparison.apple.compile.pass.cpp b/libcxx/test/libcxx-03/language.support/support.rtti/type.info/type_info.comparison.apple.compile.pass.cpp
new file mode 100644
index 0000000000000..6c6b1d44cc8f1
--- /dev/null
+++ b/libcxx/test/libcxx-03/language.support/support.rtti/type.info/type_info.comparison.apple.compile.pass.cpp
@@ -0,0 +1,30 @@
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// This test makes sure that we use the correct implementation for comparing
+// type_info objects on Apple platforms. See https://llvm.org/PR45549.
+
+// REQUIRES: darwin
+
+#include <typeinfo>
+
+#if !defined(_LIBCPP_TYPEINFO_COMPARISON_IMPLEMENTATION)
+# error "_LIBCPP_TYPEINFO_COMPARISON_IMPLEMENTATION should be defined on Apple platforms"
+#endif
+
+#if defined(__x86_64__) || defined(__ARM_ARCH_7M__)
+# if _LIBCPP_TYPEINFO_COMPARISON_IMPLEMENTATION != 1
+# error "_LIBCPP_TYPEINFO_COMPARISON_IMPLEMENTATION should be 1 (assume RTTI is merged) on Apple platforms"
+# endif
+#elif defined(__aarch64__)
+# if _LIBCPP_TYPEINFO_COMPARISON_IMPLEMENTATION != 3
+# error "_LIBCPP_TYPEINFO_COMPARISON_IMPLEMENTATION should be 3 (use the special ARM RTTI) on Apple platforms"
+# endif
+#else
+# error "This test should be updated to pin down the RTTI behavior on this ABI."
+#endif
diff --git a/libcxx/test/libcxx-03/language.support/support.rtti/type.info/type_info.comparison.merged.sh.cpp b/libcxx/test/libcxx-03/language.support/support.rtti/type.info/type_info.comparison.merged.sh.cpp
new file mode 100644
index 0000000000000..da82ea1d2c388
--- /dev/null
+++ b/libcxx/test/libcxx-03/language.support/support.rtti/type.info/type_info.comparison.merged.sh.cpp
@@ -0,0 +1,48 @@
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: no-rtti
+
+// In MSVC mode, the two anonymous types have identical type index in both object files.
+// XFAIL: msvc
+
+// RUN: %{cxx} %s %{flags} %{compile_flags} -c -o %t.tu1.o -DTU1 -D_LIBCPP_TYPEINFO_COMPARISON_IMPLEMENTATION=1
+// RUN: %{cxx} %s %{flags} %{compile_flags} -c -o %t.tu2.o -DTU2 -D_LIBCPP_TYPEINFO_COMPARISON_IMPLEMENTATION=1
+// RUN: %{cxx} %s %{flags} %{compile_flags} -c -o %t.main.o -DMAIN -D_LIBCPP_TYPEINFO_COMPARISON_IMPLEMENTATION=1
+// RUN: %{cxx} %t.tu1.o %t.tu2.o %t.main.o %{flags} %{link_flags} -o %t.exe
+// RUN: %{exec} %t.exe
+
+#include <cassert>
+#include <typeindex>
+#include <vector>
+
+extern std::vector<std::type_index> registry;
+
+void register1();
+void register2();
+
+#if defined(TU1)
+ namespace { struct A { bool x; }; }
+ void register1() { registry.push_back(std::type_index(typeid(A))); }
+#elif defined(TU2)
+ namespace { struct A { int x, y; }; }
+ void register2() { registry.push_back(std::type_index(typeid(A))); }
+#elif defined(MAIN)
+ std::vector<std::type_index> registry;
+
+ int main(int, char**) {
+ register1();
+ register2();
+
+ assert(registry.size() == 2);
+ assert(registry[0] != registry[1]);
+ return 0;
+ }
+#else
+# error
+#endif
diff --git a/libcxx/test/libcxx-03/language.support/support.rtti/type.info/type_info.comparison.unmerged.sh.cpp b/libcxx/test/libcxx-03/language.support/support.rtti/type.info/type_info.comparison.unmerged.sh.cpp
new file mode 100644
index 0000000000000..9b94fcbc1c92a
--- /dev/null
+++ b/libcxx/test/libcxx-03/language.support/support.rtti/type.info/type_info.comparison.unmerged.sh.cpp
@@ -0,0 +1,45 @@
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: no-rtti
+
+// RUN: %{cxx} %s %{flags} %{compile_flags} -c -o %t.tu1.o -DTU1 -D_LIBCPP_TYPEINFO_COMPARISON_IMPLEMENTATION=2
+// RUN: %{cxx} %s %{flags} %{compile_flags} -c -o %t.tu2.o -DTU2 -D_LIBCPP_TYPEINFO_COMPARISON_IMPLEMENTATION=2
+// RUN: %{cxx} %s %{flags} %{compile_flags} -c -o %t.main.o -DMAIN -D_LIBCPP_TYPEINFO_COMPARISON_IMPLEMENTATION=2
+// RUN: %{cxx} %t.tu1.o %t.tu2.o %t.main.o %{flags} %{link_flags} -o %t.exe
+// RUN: %{exec} %t.exe
+
+#include <cassert>
+#include <typeindex>
+#include <vector>
+
+extern std::vector<std::type_index> registry;
+
+void register1();
+void register2();
+
+#if defined(TU1)
+ namespace { struct A { bool x; }; }
+ void register1() { registry.push_back(std::type_index(typeid(A))); }
+#elif defined(TU2)
+ namespace { struct A { int x, y; }; }
+ void register2() { registry.push_back(std::type_index(typeid(A))); }
+#elif defined(MAIN)
+ std::vector<std::type_index> registry;
+
+ int main(int, char**) {
+ register1();
+ register2();
+
+ assert(registry.size() == 2);
+ assert(registry[0] == registry[1]);
+ return 0;
+ }
+#else
+# error
+#endif
diff --git a/libcxx/test/libcxx-03/libcpp_alignof.pass.cpp b/libcxx/test/libcxx-03/libcpp_alignof.pass.cpp
new file mode 100644
index 0000000000000..3ae7f7499d796
--- /dev/null
+++ b/libcxx/test/libcxx-03/libcpp_alignof.pass.cpp
@@ -0,0 +1,36 @@
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// Test that _LIBCPP_ALIGNOF acts the same as the C++11 keyword `alignof`, and
+// not as the GNU extension `__alignof`. The former returns the minimal required
+// alignment for a type, whereas the latter returns the preferred alignment.
+//
+// See llvm.org/PR39713
+
+#include <type_traits>
+#include "test_macros.h"
+
+template <class T>
+void test() {
+ static_assert(_LIBCPP_ALIGNOF(T) == std::alignment_of<T>::value, "");
+ static_assert(_LIBCPP_ALIGNOF(T) == TEST_ALIGNOF(T), "");
+#if TEST_STD_VER >= 11
+ static_assert(_LIBCPP_ALIGNOF(T) == alignof(T), "");
+#endif
+#ifdef TEST_COMPILER_CLANG
+ static_assert(_LIBCPP_ALIGNOF(T) == _Alignof(T), "");
+#endif
+}
+
+int main(int, char**) {
+ test<int>();
+ test<long long>();
+ test<double>();
+ test<long double>();
+ return 0;
+}
diff --git a/libcxx/test/libcxx-03/libcpp_freestanding.sh.cpp b/libcxx/test/libcxx-03/libcpp_freestanding.sh.cpp
new file mode 100644
index 0000000000000..8dd7a8ac85211
--- /dev/null
+++ b/libcxx/test/libcxx-03/libcpp_freestanding.sh.cpp
@@ -0,0 +1,20 @@
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// Test that _LIBCPP_FREESTANDING is not defined when -ffreestanding is not passed
+// to the compiler but defined when -ffreestanding is passed to the compiler.
+
+// RUN: %{cxx} %{flags} %{compile_flags} -fsyntax-only %s
+// RUN: %{cxx} %{flags} %{compile_flags} -fsyntax-only -ffreestanding -DFREESTANDING %s
+
+#include <__config>
+
+#if defined(FREESTANDING) != defined(_LIBCPP_FREESTANDING)
+#error _LIBCPP_FREESTANDING should be defined in freestanding mode and not \
+ defined in non-freestanding mode
+#endif
diff --git a/libcxx/test/libcxx-03/lint/lint_cmakelists.sh.py b/libcxx/test/libcxx-03/lint/lint_cmakelists.sh.py
new file mode 100644
index 0000000000000..286508c0d4f6d
--- /dev/null
+++ b/libcxx/test/libcxx-03/lint/lint_cmakelists.sh.py
@@ -0,0 +1,33 @@
+# RUN: %{python} %s
+
+# Verify that libcxx/include/CMakeLists.txt's list of header files
+# is maintained in alphabetical order.
+
+import os
+
+
+if __name__ == "__main__":
+ libcxx_test_libcxx_lint = os.path.dirname(os.path.abspath(__file__))
+ libcxx = os.path.abspath(os.path.join(libcxx_test_libcxx_lint, "../../.."))
+ cmakelists_name = os.path.join(libcxx, "include/CMakeLists.txt")
+ assert os.path.isfile(cmakelists_name)
+
+ with open(cmakelists_name, "r") as f:
+ lines = f.readlines()
+
+ assert lines[0] == "set(files\n"
+
+ okay = True
+ prevline = lines[1]
+ for line in lines[2:]:
+ if line == "\n":
+ continue
+ if line == "# C++03 frozen headers\n":
+ break
+ if line < prevline:
+ okay = False
+ print("LINES OUT OF ORDER in libcxx/include/CMakeLists.txt!")
+ print(prevline)
+ print(line)
+ prevline = line
+ assert okay
diff --git a/libcxx/test/libcxx-03/lint/lint_headers.sh.py b/libcxx/test/libcxx-03/lint/lint_headers.sh.py
new file mode 100644
index 0000000000000..ab237c968da7e
--- /dev/null
+++ b/libcxx/test/libcxx-03/lint/lint_headers.sh.py
@@ -0,0 +1,63 @@
+# RUN: %{python} %s
+
+# Verify that each run of consecutive #include directives
+# in each libcxx/include/ header is maintained in alphabetical order.
+
+import glob
+import os
+import re
+
+
+def exclude_from_consideration(path):
+ return (
+ path.endswith(".txt")
+ or path.endswith(".modulemap.in")
+ or os.path.basename(path) == "__config"
+ or os.path.basename(path) == "__config_site.in"
+ or os.path.basename(path) == "libcxx.imp"
+ or os.path.basename(path).startswith("__pstl")
+ or not os.path.isfile(path) # TODO: Remove once PSTL integration is finished
+ )
+
+
+def check_for_pragma_GCC_system_header(pretty_fname, lines):
+ if pretty_fname not in ["__undef_macros"]:
+ for line in lines:
+ if re.match("# *pragma GCC system_header\n", line):
+ return True
+ print(
+ "FAILED TO FIND # pragma GCC system_header in libcxx/include/%s"
+ % pretty_fname
+ )
+ return False
+ return True
+
+
+if __name__ == "__main__":
+ libcxx_test_libcxx_lint = os.path.dirname(os.path.abspath(__file__))
+ libcxx_include = os.path.abspath(
+ os.path.join(libcxx_test_libcxx_lint, "../../../include")
+ )
+ assert os.path.isdir(libcxx_include)
+
+ def pretty(path):
+ return path[len(libcxx_include) + 1 :]
+
+ all_headers = [
+ p
+ for p in (
+ glob.glob(os.path.join(libcxx_include, "*"))
+ + glob.glob(os.path.join(libcxx_include, "__*/*.h"))
+ )
+ if not exclude_from_consideration(p)
+ ]
+
+ okay = True
+ for fname in all_headers:
+ pretty_fname = pretty(fname)
+ with open(fname, "r") as f:
+ lines = f.readlines()
+
+ okay = check_for_pragma_GCC_system_header(pretty_fname, lines) and okay
+
+ assert okay
diff --git a/libcxx/test/libcxx-03/lit.local.cfg b/libcxx/test/libcxx-03/lit.local.cfg
new file mode 100644
index 0000000000000..abfc900678946
--- /dev/null
+++ b/libcxx/test/libcxx-03/lit.local.cfg
@@ -0,0 +1,9 @@
+# The tests in this directory need to run Python
+import shlex
+import sys
+
+config.substitutions.append(("%{python}", shlex.quote(sys.executable)))
+
+# run libcxx-03 tests only when running against the frozen headers. We have separate tests for non-frozen headers.
+if "FROZEN-CXX03-HEADERS-FIXME" not in config.available_features:
+ config.unsupported = True
diff --git a/libcxx/test/libcxx-03/localization/lit.local.cfg b/libcxx/test/libcxx-03/localization/lit.local.cfg
new file mode 100644
index 0000000000000..ac628161afe73
--- /dev/null
+++ b/libcxx/test/libcxx-03/localization/lit.local.cfg
@@ -0,0 +1,7 @@
+# Load the same local configuration as the corresponding one in libcxx/test/std
+import os
+
+inLibcxx = os.path.join("libcxx", "test", "libcxx-03")
+inStd = os.path.join("libcxx", "test", "std")
+localConfig = os.path.normpath(os.path.realpath(__file__)).replace(inLibcxx, inStd)
+config.load_from_path(localConfig, lit_config)
diff --git a/libcxx/test/libcxx-03/localization/locale.categories/__scan_keyword.pass.cpp b/libcxx/test/libcxx-03/localization/locale.categories/__scan_keyword.pass.cpp
new file mode 100644
index 0000000000000..1ecf378de5b61
--- /dev/null
+++ b/libcxx/test/libcxx-03/localization/locale.categories/__scan_keyword.pass.cpp
@@ -0,0 +1,121 @@
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// <locale>
+
+// Not a portable test
+
+// __scan_keyword
+// Scans [__b, __e) until a match is found in the basic_strings range
+// [__kb, __ke) or until it can be shown that there is no match in [__kb, __ke).
+// __b will be incremented (visibly), consuming CharT until a match is found
+// or proved to not exist. A keyword may be "", in which will match anything.
+// If one keyword is a prefix of another, and the next CharT in the input
+// might match another keyword, the algorithm will attempt to find the longest
+// matching keyword. If the longer matching keyword ends up not matching, then
+// no keyword match is found. If no keyword match is found, __ke is returned.
+// Else an iterator pointing to the matching keyword is found. If more than
+// one keyword matches, an iterator to the first matching keyword is returned.
+// If on exit __b == __e, eofbit is set in __err. If __case_sensitive is false,
+// __ct is used to force to lower case before comparing characters.
+// Examples:
+// Keywords: "a", "abb"
+// If the input is "a", the first keyword matches and eofbit is set.
+// If the input is "abc", no match is found and "ab" are consumed.
+//
+// template <class _InputIterator, class _ForwardIterator, class _Ctype>
+// _ForwardIterator
+// __scan_keyword(_InputIterator& __b, _InputIterator __e,
+// _ForwardIterator __kb, _ForwardIterator __ke,
+// const _Ctype& __ct, ios_base::iostate& __err,
+// bool __case_sensitive = true);
+
+#include <locale>
+#include <cassert>
+
+#include "test_macros.h"
+
+int main(int, char**)
+{
+ const std::ctype<char>& ct = std::use_facet<std::ctype<char> >(std::locale::classic());
+ std::ios_base::iostate err = std::ios_base::goodbit;
+ {
+ const char input[] = "a";
+ const char* in = input;
+ std::string keys[] = {"a", "abb"};
+ err = std::ios_base::goodbit;
+ std::string* k = std::__scan_keyword(in, input+sizeof(input)-1,
+ keys, keys+sizeof(keys)/sizeof(keys[0]),
+ ct, err);
+ assert(k - keys == 0);
+ assert(in == input+1);
+ assert(err == std::ios_base::eofbit);
+ }
+ {
+ const char input[] = "abc";
+ const char* in = input;
+ std::string keys[] = {"a", "abb"};
+ err = std::ios_base::goodbit;
+ std::string* k = std::__scan_keyword(in, input+sizeof(input)-1,
+ keys, keys+sizeof(keys)/sizeof(keys[0]),
+ ct, err);
+ assert(k - keys == 2);
+ assert(in == input+2);
+ assert(err == std::ios_base::failbit);
+ }
+ {
+ const char input[] = "abb";
+ const char* in = input;
+ std::string keys[] = {"a", "abb"};
+ err = std::ios_base::goodbit;
+ std::string* k = std::__scan_keyword(in, input+sizeof(input)-1,
+ keys, keys+sizeof(keys)/sizeof(keys[0]),
+ ct, err);
+ assert(k - keys == 1);
+ assert(in == input+3);
+ assert(err == std::ios_base::eofbit);
+ }
+ {
+ const char input[] = "Tue ";
+ const char* in = input;
+ std::string keys[] = {"Mon", "Monday", "Tue", "Tuesday"};
+ err = std::ios_base::goodbit;
+ std::string* k = std::__scan_keyword(in, input+sizeof(input)-1,
+ keys, keys+sizeof(keys)/sizeof(keys[0]),
+ ct, err);
+ assert(k - keys == 2);
+ assert(in == input+3);
+ assert(err == std::ios_base::goodbit);
+ }
+ {
+ const char input[] = "tue ";
+ const char* in = input;
+ std::string keys[] = {"Mon", "Monday", "Tue", "Tuesday"};
+ err = std::ios_base::goodbit;
+ std::string* k = std::__scan_keyword(in, input+sizeof(input)-1,
+ keys, keys+sizeof(keys)/sizeof(keys[0]),
+ ct, err);
+ assert(k - keys == 4);
+ assert(in == input+0);
+ assert(err == std::ios_base::failbit);
+ }
+ {
+ const char input[] = "tue ";
+ const char* in = input;
+ std::string keys[] = {"Mon", "Monday", "Tue", "Tuesday"};
+ err = std::ios_base::goodbit;
+ std::string* k = std::__scan_keyword(in, input+sizeof(input)-1,
+ keys, keys+sizeof(keys)/sizeof(keys[0]),
+ ct, err, false);
+ assert(k - keys == 2);
+ assert(in == input+3);
+ assert(err == std::ios_base::goodbit);
+ }
+
+ return 0;
+}
diff --git a/libcxx/test/libcxx-03/localization/locales/locale.abort.pass.cpp b/libcxx/test/libcxx-03/localization/locales/locale.abort.pass.cpp
new file mode 100644
index 0000000000000..9a47eb8f13c64
--- /dev/null
+++ b/libcxx/test/libcxx-03/localization/locales/locale.abort.pass.cpp
@@ -0,0 +1,36 @@
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// <locale>
+
+// class locale;
+
+// explicit locale( const char* std_name );
+
+// REQUIRES: no-exceptions
+
+// Make sure we abort() when we construct a locale with a null name and
+// exceptions are disabled.
+
+#include <csignal>
+#include <cstdlib>
+#include <locale>
+
+#include "test_macros.h"
+
+
+void exit_success(int) {
+ std::_Exit(EXIT_SUCCESS);
+}
+
+int main(int, char**) {
+ std::signal(SIGABRT, exit_success);
+ std::locale loc(NULL);
+ (void)loc;
+ return EXIT_FAILURE;
+}
diff --git a/libcxx/test/libcxx-03/localization/locales/locale.category.abort.pass.cpp b/libcxx/test/libcxx-03/localization/locales/locale.category.abort.pass.cpp
new file mode 100644
index 0000000000000..9b321e6b1fd3e
--- /dev/null
+++ b/libcxx/test/libcxx-03/localization/locales/locale.category.abort.pass.cpp
@@ -0,0 +1,36 @@
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// <locale>
+
+// class locale;
+
+// locale(const locale& other, const char* std_name, category cat);
+
+// REQUIRES: no-exceptions
+
+// Make sure we abort() when we construct a locale with a null name and
+// exceptions are disabled.
+
+#include <csignal>
+#include <cstdlib>
+#include <locale>
+
+#include "test_macros.h"
+
+
+void exit_success(int) {
+ std::_Exit(EXIT_SUCCESS);
+}
+
+int main(int, char**) {
+ std::signal(SIGABRT, exit_success);
+ std::locale loc(std::locale(), NULL, std::locale::ctype);
+ (void)loc;
+ return EXIT_FAILURE;
+}
diff --git a/libcxx/test/libcxx-03/localization/locales/locale/locale.types/locale.facet/facet.pass.cpp b/libcxx/test/libcxx-03/localization/locales/locale/locale.types/locale.facet/facet.pass.cpp
new file mode 100644
index 0000000000000..072c85a11d2b8
--- /dev/null
+++ b/libcxx/test/libcxx-03/localization/locales/locale/locale.types/locale.facet/facet.pass.cpp
@@ -0,0 +1,56 @@
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// <locale>
+
+// class locale::facet
+// {
+// protected:
+// explicit facet(size_t refs = 0);
+// virtual ~facet();
+// facet(const facet&) = delete;
+// void operator=(const facet&) = delete;
+// };
+
+// This test isn't portable
+
+#include <locale>
+#include <cassert>
+
+#include "test_macros.h"
+
+struct my_facet
+ : public std::locale::facet
+{
+ static int count;
+ my_facet(unsigned refs = 0)
+ : std::locale::facet(refs)
+ {++count;}
+
+ ~my_facet() {--count;}
+};
+
+int my_facet::count = 0;
+
+int main(int, char**)
+{
+ my_facet* f = new my_facet;
+ f->__add_shared();
+ assert(my_facet::count == 1);
+ f->__release_shared();
+ assert(my_facet::count == 0);
+ f = new my_facet(1);
+ f->__add_shared();
+ assert(my_facet::count == 1);
+ f->__release_shared();
+ assert(my_facet::count == 1);
+ f->__release_shared();
+ assert(my_facet::count == 0);
+
+ return 0;
+}
diff --git a/libcxx/test/libcxx-03/localization/locales/locale/locale.types/locale.facet/no_allocation.pass.cpp b/libcxx/test/libcxx-03/localization/locales/locale/locale.types/locale.facet/no_allocation.pass.cpp
new file mode 100644
index 0000000000000..6e59b8256ffe7
--- /dev/null
+++ b/libcxx/test/libcxx-03/localization/locales/locale/locale.types/locale.facet/no_allocation.pass.cpp
@@ -0,0 +1,23 @@
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// <locale>
+
+// This test verifies that the construction of locale::__imp does not allocate
+// for facets, as it uses __sso_allocator<facet*, N>. It would fail if new
+// facets have been added (using install()) but N hasn't been adjusted to
+// account for them.
+
+#include <cassert>
+
+#include "count_new.h"
+
+int main(int, char**) {
+ assert(globalMemCounter.checkOutstandingNewEq(0));
+ return 0;
+}
diff --git a/libcxx/test/libcxx-03/localization/locales/locale/locale.types/locale.id/id.pass.cpp b/libcxx/test/libcxx-03/localization/locales/locale/locale.types/locale.id/id.pass.cpp
new file mode 100644
index 0000000000000..5e0113474c9d1
--- /dev/null
+++ b/libcxx/test/libcxx-03/localization/locales/locale/locale.types/locale.id/id.pass.cpp
@@ -0,0 +1,53 @@
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// <locale>
+
+// class locale::id
+// {
+// public:
+// id();
+// void operator=(const id&) = delete;
+// id(const id&) = delete;
+// };
+
+// This test isn't portable
+
+#include <locale>
+#include <cassert>
+
+#include "test_macros.h"
+
+std::locale::id id0;
+std::locale::id id2;
+std::locale::id id1;
+
+int main(int, char**)
+{
+ long id = id0.__get();
+ assert(id0.__get() == id+0);
+ assert(id0.__get() == id+0);
+ assert(id0.__get() == id+0);
+ assert(id1.__get() == id+1);
+ assert(id1.__get() == id+1);
+ assert(id1.__get() == id+1);
+ assert(id2.__get() == id+2);
+ assert(id2.__get() == id+2);
+ assert(id2.__get() == id+2);
+ assert(id0.__get() == id+0);
+ assert(id0.__get() == id+0);
+ assert(id0.__get() == id+0);
+ assert(id1.__get() == id+1);
+ assert(id1.__get() == id+1);
+ assert(id1.__get() == id+1);
+ assert(id2.__get() == id+2);
+ assert(id2.__get() == id+2);
+ assert(id2.__get() == id+2);
+
+ return 0;
+}
diff --git a/libcxx/test/libcxx-03/localization/locales/use_facet.abort.pass.cpp b/libcxx/test/libcxx-03/localization/locales/use_facet.abort.pass.cpp
new file mode 100644
index 0000000000000..9b4755a819cb9
--- /dev/null
+++ b/libcxx/test/libcxx-03/localization/locales/use_facet.abort.pass.cpp
@@ -0,0 +1,39 @@
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// <locale>
+
+// template <class Facet> const Facet& use_facet(const locale& loc);
+
+// REQUIRES: no-exceptions
+
+// Make sure we abort() when we pass a facet not associated to the locale to
+// use_facet() and exceptions are disabled.
+
+#include <csignal>
+#include <cstdlib>
+#include <locale>
+
+#include "test_macros.h"
+
+
+struct my_facet : public std::locale::facet {
+ static std::locale::id id;
+};
+
+std::locale::id my_facet::id;
+
+void exit_success(int) {
+ std::_Exit(EXIT_SUCCESS);
+}
+
+int main(int, char**) {
+ std::signal(SIGABRT, exit_success);
+ std::use_facet<my_facet>(std::locale());
+ return EXIT_FAILURE;
+}
diff --git a/libcxx/test/libcxx-03/memory/allocation_guard.pass.cpp b/libcxx/test/libcxx-03/memory/allocation_guard.pass.cpp
new file mode 100644
index 0000000000000..20c05b381ef0e
--- /dev/null
+++ b/libcxx/test/libcxx-03/memory/allocation_guard.pass.cpp
@@ -0,0 +1,194 @@
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+//
+
+// <memory>
+
+// To allow checking that self-move works correctly.
+// ADDITIONAL_COMPILE_FLAGS: -Wno-self-move
+
+// XFAIL: FROZEN-CXX03-HEADERS-FIXME
+
+// template<class _Alloc>
+// struct __allocation_guard;
+
+#include <__memory/allocation_guard.h>
+#include <cassert>
+#include <type_traits>
+#include <utility>
+
+#include "test_allocator.h"
+
+using A = test_allocator<int>;
+
+// A trimmed-down version of `test_allocator` that is copy-assignable (in general allocators don't have to support copy
+// assignment).
+template <class T>
+struct AssignableAllocator {
+ using size_type = unsigned;
+ using difference_type = int;
+ using value_type = T;
+ using pointer = value_type*;
+ using const_pointer = const value_type*;
+ using reference = typename std::add_lvalue_reference<value_type>::type;
+ using const_reference = typename std::add_lvalue_reference<const value_type>::type;
+
+ template <class U>
+ struct rebind {
+ using other = test_allocator<U>;
+ };
+
+ test_allocator_statistics* stats_ = nullptr;
+
+ explicit AssignableAllocator(test_allocator_statistics& stats) : stats_(&stats) {
+ ++stats_->count;
+ }
+
+ TEST_CONSTEXPR_CXX14 AssignableAllocator(const AssignableAllocator& rhs) TEST_NOEXCEPT
+ : stats_(rhs.stats_) {
+ if (stats_ != nullptr) {
+ ++stats_->count;
+ ++stats_->copied;
+ }
+ }
+
+ TEST_CONSTEXPR_CXX14 AssignableAllocator& operator=(const AssignableAllocator& rhs) TEST_NOEXCEPT {
+ stats_ = rhs.stats_;
+ if (stats_ != nullptr) {
+ ++stats_->count;
+ ++stats_->copied;
+ }
+
+ return *this;
+ }
+
+ TEST_CONSTEXPR_CXX14 pointer allocate(size_type n, const void* = nullptr) {
+ if (stats_ != nullptr) {
+ ++stats_->alloc_count;
+ }
+ return std::allocator<value_type>().allocate(n);
+ }
+
+ TEST_CONSTEXPR_CXX14 void deallocate(pointer p, size_type s) {
+ if (stats_ != nullptr) {
+ --stats_->alloc_count;
+ }
+ std::allocator<value_type>().deallocate(p, s);
+ }
+
+ TEST_CONSTEXPR size_type max_size() const TEST_NOEXCEPT { return UINT_MAX / sizeof(T); }
+
+ template <class U>
+ TEST_CONSTEXPR_CXX20 void construct(pointer p, U&& val) {
+ if (stats_ != nullptr)
+ ++stats_->construct_count;
+#if TEST_STD_VER > 17
+ std::construct_at(std::to_address(p), std::forward<U>(val));
+#else
+ ::new (static_cast<void*>(p)) T(std::forward<U>(val));
+#endif
+ }
+
+ TEST_CONSTEXPR_CXX14 void destroy(pointer p) {
+ if (stats_ != nullptr) {
+ ++stats_->destroy_count;
+ }
+ p->~T();
+ }
+};
+
+// Move-only.
+static_assert(!std::is_copy_constructible<std::__allocation_guard<A> >::value, "");
+static_assert(std::is_move_constructible<std::__allocation_guard<A> >::value, "");
+static_assert(!std::is_copy_assignable<std::__allocation_guard<A> >::value, "");
+static_assert(std::is_move_assignable<std::__allocation_guard<A> >::value, "");
+
+int main(int, char**) {
+ const int size = 42;
+
+ { // The constructor allocates using the given allocator.
+ test_allocator_statistics stats;
+ std::__allocation_guard<A> guard(A(&stats), size);
+ assert(stats.alloc_count == 1);
+ assert(guard.__get() != nullptr);
+ }
+
+ { // The destructor deallocates using the given allocator.
+ test_allocator_statistics stats;
+ {
+ std::__allocation_guard<A> guard(A(&stats), size);
+ assert(stats.alloc_count == 1);
+ }
+ assert(stats.alloc_count == 0);
+ }
+
+ { // `__release_ptr` prevents deallocation.
+ test_allocator_statistics stats;
+ A alloc(&stats);
+ int* ptr = nullptr;
+ {
+ std::__allocation_guard<A> guard(alloc, size);
+ assert(stats.alloc_count == 1);
+ ptr = guard.__release_ptr();
+ }
+ assert(stats.alloc_count == 1);
+ alloc.deallocate(ptr, size);
+ }
+
+ { // Using the move constructor doesn't lead to double deletion.
+ test_allocator_statistics stats;
+ {
+ std::__allocation_guard<A> guard1(A(&stats), size);
+ assert(stats.alloc_count == 1);
+ auto* ptr1 = guard1.__get();
+
+ std::__allocation_guard<A> guard2 = std::move(guard1);
+ assert(stats.alloc_count == 1);
+ assert(guard1.__get() == nullptr);
+ assert(guard2.__get() == ptr1);
+ }
+ assert(stats.alloc_count == 0);
+ }
+
+ { // Using the move assignment operator doesn't lead to double deletion.
+ using A2 = AssignableAllocator<int>;
+
+ test_allocator_statistics stats;
+ {
+ std::__allocation_guard<A2> guard1(A2(stats), size);
+ assert(stats.alloc_count == 1);
+ std::__allocation_guard<A2> guard2(A2(stats), size);
+ assert(stats.alloc_count == 2);
+ auto* ptr1 = guard1.__get();
+
+ guard2 = std::move(guard1);
+ assert(stats.alloc_count == 1);
+ assert(guard1.__get() == nullptr);
+ assert(guard2.__get() == ptr1);
+ }
+ assert(stats.alloc_count == 0);
+ }
+
+ { // Self-assignment is a no-op.
+ using A2 = AssignableAllocator<int>;
+
+ test_allocator_statistics stats;
+ {
+ std::__allocation_guard<A2> guard(A2(stats), size);
+ assert(stats.alloc_count == 1);
+ auto* ptr = guard.__get();
+
+ guard = std::move(guard);
+ assert(stats.alloc_count == 1);
+ assert(guard.__get() == ptr);
+ }
+ assert(stats.alloc_count == 0);
+ }
+
+ return 0;
+}
diff --git a/libcxx/test/libcxx-03/memory/allocator_void.trivial.compile.pass.cpp b/libcxx/test/libcxx-03/memory/allocator_void.trivial.compile.pass.cpp
new file mode 100644
index 0000000000000..b7dfc190e8e91
--- /dev/null
+++ b/libcxx/test/libcxx-03/memory/allocator_void.trivial.compile.pass.cpp
@@ -0,0 +1,26 @@
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// Make sure that std::allocator<void> is trivial. This was the case before C++20
+// with the std::allocator<void> explicit specialization, and this test makes sure
+// that we maintain that property across all standards.
+//
+// This is important since triviality has implications on how the type is passed
+// as a function argument in the ABI.
+
+#include <memory>
+#include <type_traits>
+
+typedef std::allocator<void> A1;
+struct A2 : std::allocator<void> { };
+
+static_assert(std::is_trivially_default_constructible<A1>::value, "");
+static_assert(std::is_trivially_copyable<A1>::value, "");
+
+static_assert(std::is_trivially_default_constructible<A2>::value, "");
+static_assert(std::is_trivially_copyable<A2>::value, "");
diff --git a/libcxx/test/libcxx-03/memory/allocator_volatile.verify.cpp b/libcxx/test/libcxx-03/memory/allocator_volatile.verify.cpp
new file mode 100644
index 0000000000000..53fdc08e7a024
--- /dev/null
+++ b/libcxx/test/libcxx-03/memory/allocator_volatile.verify.cpp
@@ -0,0 +1,14 @@
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// http://wg21.link/LWG2447 gives implementors freedom to reject const or volatile types in `std::allocator`.
+
+#include <memory>
+
+std::allocator<const int> A1; // expected-error@*:* {{std::allocator does not support const types}}
+std::allocator<volatile int> A2; // expected-error@*:* {{std::allocator does not support volatile types}}
diff --git a/libcxx/test/libcxx-03/memory/is_allocator.pass.cpp b/libcxx/test/libcxx-03/memory/is_allocator.pass.cpp
new file mode 100644
index 0000000000000..cf11d077bf086
--- /dev/null
+++ b/libcxx/test/libcxx-03/memory/is_allocator.pass.cpp
@@ -0,0 +1,43 @@
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+//
+
+// <memory>
+// UNSUPPORTED: c++03, c++11, c++14
+
+// template<typename _Alloc>
+// struct __is_allocator;
+
+// Is either true_type or false_type depending on if A is an allocator.
+
+#include <memory>
+#include <string>
+
+#include "test_macros.h"
+#include "min_allocator.h"
+#include "test_allocator.h"
+
+template <typename T>
+void test_allocators()
+{
+ static_assert(!std::__is_allocator<T>::value, "" );
+ static_assert( std::__is_allocator<std::allocator<T>>::value, "" );
+ static_assert( std::__is_allocator<test_allocator<T>>::value, "" );
+ static_assert( std::__is_allocator<min_allocator<T>>::value, "" );
+}
+
+
+int main(int, char**)
+{
+ // test_allocators<void>();
+ test_allocators<char>();
+ test_allocators<int>();
+ test_allocators<std::string>();
+
+ return 0;
+}
diff --git a/libcxx/test/libcxx-03/memory/swap_allocator.pass.cpp b/libcxx/test/libcxx-03/memory/swap_allocator.pass.cpp
new file mode 100644
index 0000000000000..f70f8134d1dda
--- /dev/null
+++ b/libcxx/test/libcxx-03/memory/swap_allocator.pass.cpp
@@ -0,0 +1,83 @@
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+//
+
+// XFAIL: FROZEN-CXX03-HEADERS-FIXME
+
+// <memory>
+
+// template <typename _Alloc>
+// void __swap_allocator(_Alloc& __a1, _Alloc& __a2);
+
+#include <__memory/swap_allocator.h>
+#include <cassert>
+#include <memory>
+#include <utility>
+
+#include "test_macros.h"
+
+template <bool Propagate, bool Noexcept>
+struct Alloc {
+ int i = 0;
+ Alloc() = default;
+ Alloc(int set_i) : i(set_i) {}
+
+ using value_type = int;
+ using propagate_on_container_swap = std::integral_constant<bool, Propagate>;
+
+ friend void swap(Alloc& a1, Alloc& a2) TEST_NOEXCEPT_COND(Noexcept) {
+ std::swap(a1.i, a2.i);
+ }
+
+};
+
+using PropagatingAlloc = Alloc</*Propagate=*/true, /*Noexcept=*/true>;
+static_assert(std::allocator_traits<PropagatingAlloc>::propagate_on_container_swap::value, "");
+
+using NonPropagatingAlloc = Alloc</*Propagate=*/false, /*Noexcept=*/true>;
+static_assert(!std::allocator_traits<NonPropagatingAlloc>::propagate_on_container_swap::value, "");
+
+using NoexceptSwapAlloc = Alloc</*Propagate=*/true, /*Noexcept=*/true>;
+using ThrowingSwapAlloc = Alloc</*Propagate=*/true, /*Noexcept=*/false>;
+
+int main(int, char**) {
+ {
+ PropagatingAlloc a1(1), a2(42);
+ std::__swap_allocator(a1, a2);
+ assert(a1.i == 42);
+ assert(a2.i == 1);
+ }
+
+ {
+ NonPropagatingAlloc a1(1), a2(42);
+ std::__swap_allocator(a1, a2);
+ assert(a1.i == 1);
+ assert(a2.i == 42);
+ }
+
+#if TEST_STD_VER >= 11
+ {
+ NoexceptSwapAlloc noexcept_alloc;
+ static_assert(noexcept(std::__swap_allocator(noexcept_alloc, noexcept_alloc)), "");
+ }
+
+#if TEST_STD_VER > 11
+ { // From C++14, `__swap_allocator` is unconditionally noexcept.
+ ThrowingSwapAlloc throwing_alloc;
+ static_assert(noexcept(std::__swap_allocator(throwing_alloc, throwing_alloc)), "");
+ }
+#else
+ { // Until C++14, `__swap_allocator` is only noexcept if the underlying `swap` function is `noexcept`.
+ ThrowingSwapAlloc throwing_alloc;
+ static_assert(!noexcept(std::__swap_allocator(throwing_alloc, throwing_alloc)), "");
+ }
+#endif // TEST_STD_VER > 11
+#endif // TEST_STD_VER >= 11
+
+ return 0;
+}
diff --git a/libcxx/test/libcxx-03/memory/trivial_abi/unique_ptr_arg.pass.cpp b/libcxx/test/libcxx-03/memory/trivial_abi/unique_ptr_arg.pass.cpp
new file mode 100644
index 0000000000000..8a7367bf29749
--- /dev/null
+++ b/libcxx/test/libcxx-03/memory/trivial_abi/unique_ptr_arg.pass.cpp
@@ -0,0 +1,52 @@
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// <memory>
+
+// Test unique_ptr<T> with trivial_abi as parameter type.
+
+// ADDITIONAL_COMPILE_FLAGS: -Wno-macro-redefined -D_LIBCPP_ABI_ENABLE_UNIQUE_PTR_TRIVIAL_ABI
+
+// XFAIL: gcc
+
+#include <memory>
+#include <cassert>
+
+__attribute__((noinline)) void call_something() { asm volatile(""); }
+
+struct Node {
+ int* shared_val;
+
+ explicit Node(int* ptr) : shared_val(ptr) {}
+ ~Node() { ++(*shared_val); }
+};
+
+__attribute__((noinline)) bool get_val(std::unique_ptr<Node> /*unused*/) {
+ call_something();
+ return true;
+}
+
+__attribute__((noinline)) void expect_1(int* shared, bool /*unused*/) {
+ assert(*shared == 1);
+}
+
+int main(int, char**) {
+ int shared = 0;
+
+ // Without trivial-abi, the unique_ptr is deleted at the end of this
+ // statement; expect_1 will see shared == 0 because it's not incremented (in
+ // ~Node()) until expect_1 returns.
+ //
+ // With trivial-abi, expect_1 will see shared == 1 because shared_val is
+ // incremented before get_val returns.
+ expect_1(&shared, get_val(std::unique_ptr<Node>(new Node(&shared))));
+
+ // Check that the shared-value is still 1.
+ expect_1(&shared, true);
+ return 0;
+}
diff --git a/libcxx/test/libcxx-03/memory/trivial_abi/unique_ptr_destruction_order.pass.cpp b/libcxx/test/libcxx-03/memory/trivial_abi/unique_ptr_destruction_order.pass.cpp
new file mode 100644
index 0000000000000..8752ba5a01d6e
--- /dev/null
+++ b/libcxx/test/libcxx-03/memory/trivial_abi/unique_ptr_destruction_order.pass.cpp
@@ -0,0 +1,68 @@
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// <memory>
+
+// Test arguments destruction order involving unique_ptr<T> with trivial_abi.
+
+// ADDITIONAL_COMPILE_FLAGS: -Wno-macro-redefined -D_LIBCPP_ABI_ENABLE_UNIQUE_PTR_TRIVIAL_ABI
+
+// XFAIL: gcc
+
+#include <memory>
+#include <cassert>
+
+#include "test_macros.h"
+
+__attribute__((noinline)) void call_something() { asm volatile(""); }
+
+struct Base {
+ char* shared_buff;
+ int* cur_idx;
+ const char id;
+
+ explicit Base(char* buf, int* idx, char ch)
+ : shared_buff(buf), cur_idx(idx), id(ch) {}
+ Base(const Base& other) = default;
+ Base& operator=(const Base&) = delete;
+ ~Base() { shared_buff[(*cur_idx)++] = id; }
+};
+
+struct A : Base {
+ explicit A(char* buf, int* idx) : Base(buf, idx, 'A') {}
+};
+
+struct B : Base {
+ explicit B(char* buf, int* idx) : Base(buf, idx, 'B') {}
+};
+
+struct C : Base {
+ explicit C(char* buf, int* idx) : Base(buf, idx, 'C') {}
+};
+
+__attribute__((noinline)) void func(A /*unused*/, std::unique_ptr<B> /*unused*/,
+ C /*unused*/) {
+ call_something();
+}
+
+int main(int, char**) {
+ char shared_buf[3] = {'0', '0', '0'};
+ int cur_idx = 0;
+
+ func(A(shared_buf, &cur_idx), std::unique_ptr<B>(new B(shared_buf, &cur_idx)),
+ C(shared_buf, &cur_idx));
+
+#if defined(TEST_ABI_MICROSOFT)
+ // On Microsoft ABI, the dtor order is always A,B,C (because callee-destroyed)
+ assert(shared_buf[0] == 'A' && shared_buf[1] == 'B' && shared_buf[2] == 'C');
+#else
+ // With trivial_abi, the std::unique_ptr<B> arg is always destructed first.
+ assert(shared_buf[0] == 'B');
+#endif
+ return 0;
+}
diff --git a/libcxx/test/libcxx-03/memory/trivial_abi/unique_ptr_ret.pass.cpp b/libcxx/test/libcxx-03/memory/trivial_abi/unique_ptr_ret.pass.cpp
new file mode 100644
index 0000000000000..65e9069e07a15
--- /dev/null
+++ b/libcxx/test/libcxx-03/memory/trivial_abi/unique_ptr_ret.pass.cpp
@@ -0,0 +1,59 @@
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// <memory>
+
+// Test unique_ptr<T> with trivial_abi as return-type.
+
+// ADDITIONAL_COMPILE_FLAGS: -Wno-macro-redefined -D_LIBCPP_ABI_ENABLE_UNIQUE_PTR_TRIVIAL_ABI
+
+// XFAIL: gcc
+
+#include <memory>
+#include <cassert>
+
+__attribute__((noinline)) void call_something() { asm volatile(""); }
+
+struct Node {
+ explicit Node() {}
+ Node(const Node&) = default;
+ Node& operator=(const Node&) = default;
+ ~Node() {}
+};
+
+__attribute__((noinline)) std::unique_ptr<Node> make_val(void** local_addr) {
+ call_something();
+
+ auto ret = std::unique_ptr<Node>(new Node);
+
+ // Capture the local address of ret.
+ *local_addr = &ret;
+
+ return ret;
+}
+
+int main(int, char**) {
+ void* local_addr = nullptr;
+ auto ret = make_val(&local_addr);
+ assert(local_addr != nullptr);
+
+ // Without trivial_abi, &ret == local_addr because the return value
+ // is allocated here in main's stackframe.
+ //
+ // With trivial_abi, local_addr is the address of a local variable in
+ // make_val, and hence different from &ret.
+#if !defined(__i386__) && !defined(_WIN32) && !defined(_AIX)
+ // On X86, structs are never returned in registers.
+ // On AIX, structs are never returned in registers.
+ // Thus, unique_ptr will be passed indirectly even if it is trivial.
+ // On Windows, structs with a destructor are always returned indirectly.
+ assert((void*)&ret != local_addr);
+#endif
+
+ return 0;
+}
diff --git a/libcxx/test/libcxx-03/memory/trivial_abi/weak_ptr_ret.pass.cpp b/libcxx/test/libcxx-03/memory/trivial_abi/weak_ptr_ret.pass.cpp
new file mode 100644
index 0000000000000..0b1a434ee45b5
--- /dev/null
+++ b/libcxx/test/libcxx-03/memory/trivial_abi/weak_ptr_ret.pass.cpp
@@ -0,0 +1,62 @@
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// <memory>
+
+// Test weak_ptr<T> with trivial_abi as return-type.
+
+// ADDITIONAL_COMPILE_FLAGS: -Wno-macro-redefined -D_LIBCPP_ABI_ENABLE_SHARED_PTR_TRIVIAL_ABI
+
+// XFAIL: gcc
+
+#include <memory>
+#include <cassert>
+
+__attribute__((noinline)) void call_something() { asm volatile(""); }
+
+struct Node {
+ explicit Node() {}
+ Node(const Node&) = default;
+ Node& operator=(const Node&) = default;
+ ~Node() {}
+};
+
+__attribute__((noinline)) std::weak_ptr<Node>
+make_val(std::shared_ptr<Node>& sptr, void** local_addr) {
+ call_something();
+
+ std::weak_ptr<Node> ret;
+ ret = sptr;
+
+ // Capture the local address of ret.
+ *local_addr = &ret;
+
+ return ret;
+}
+
+int main(int, char**) {
+ void* local_addr = nullptr;
+ auto sptr = std::make_shared<Node>();
+ std::weak_ptr<Node> ret = make_val(sptr, &local_addr);
+ assert(local_addr != nullptr);
+
+ // Without trivial_abi, &ret == local_addr because the return value
+ // is allocated here in main's stackframe.
+ //
+ // With trivial_abi, local_addr is the address of a local variable in
+ // make_val, and hence different from &ret.
+#if !defined(__i386__) && !defined(__arm__) && !defined(_WIN32) && !defined(_AIX)
+ // On X86, structs are never returned in registers.
+ // On AIX, structs are never returned in registers.
+ // On ARM32, structs larger than 4 bytes cannot be returned in registers.
+ // On Windows, structs with a destructor are always returned indirectly.
+ // Thus, weak_ptr will be passed indirectly even if it is trivial.
+ assert((void*)&ret != local_addr);
+#endif
+ return 0;
+}
diff --git a/libcxx/test/libcxx-03/memory/uninitialized_allocator_copy.pass.cpp b/libcxx/test/libcxx-03/memory/uninitialized_allocator_copy.pass.cpp
new file mode 100644
index 0000000000000..679ee86844687
--- /dev/null
+++ b/libcxx/test/libcxx-03/memory/uninitialized_allocator_copy.pass.cpp
@@ -0,0 +1,67 @@
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: no-exceptions
+
+// ensure that __uninitialized_allocator_copy calls the proper construct and destruct functions
+
+#include <algorithm>
+#include <iterator>
+#include <memory>
+
+#include "test_allocator.h"
+
+template <class T>
+class construct_counting_allocator {
+public:
+ using value_type = T;
+
+ int* constructed_count_;
+ int* max_constructed_count_;
+
+ construct_counting_allocator(int* constructed_count, int* max_constructed_count)
+ : constructed_count_(constructed_count), max_constructed_count_(max_constructed_count) {}
+
+ template <class... Args>
+ void construct(T* ptr, Args&&... args) {
+ ::new (static_cast<void*>(ptr)) T(args...);
+ ++*constructed_count_;
+ *max_constructed_count_ = std::max(*max_constructed_count_, *constructed_count_);
+ }
+
+ void destroy(T* ptr) {
+ --*constructed_count_;
+ ptr->~T();
+ }
+};
+
+int throw_if_zero = 15;
+
+struct ThrowSometimes {
+ ThrowSometimes() = default;
+ ThrowSometimes(const ThrowSometimes&) {
+ if (--throw_if_zero == 0)
+ throw 1;
+ }
+};
+
+int main(int, char**) {
+ int constructed_count = 0;
+ int max_constructed_count = 0;
+ construct_counting_allocator<ThrowSometimes> alloc(&constructed_count, &max_constructed_count);
+ ThrowSometimes in[20];
+ TEST_ALIGNAS_TYPE(ThrowSometimes) char out[sizeof(ThrowSometimes) * 20];
+ try {
+ std::__uninitialized_allocator_copy(
+ alloc, std::begin(in), std::end(in), reinterpret_cast<ThrowSometimes*>(std::begin(out)));
+ } catch (...) {
+ }
+
+ assert(constructed_count == 0);
+ assert(max_constructed_count == 14);
+}
diff --git a/libcxx/test/libcxx-03/minimal_cxx11_configuration.pass.cpp b/libcxx/test/libcxx-03/minimal_cxx11_configuration.pass.cpp
new file mode 100644
index 0000000000000..e0811e02f5c13
--- /dev/null
+++ b/libcxx/test/libcxx-03/minimal_cxx11_configuration.pass.cpp
@@ -0,0 +1,130 @@
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// Test the set of C++11 features that Clang provides as an extension in C++03 mode.
+// The language features we expect are:
+//
+// 1. rvalue references (and perfect forwarding)
+// 2. variadic templates
+// 3. alias templates
+// 4. defaulted and deleted functions.
+// 5. default values for non-type template parameters.
+//
+// Some features we don't get and can't be used in extended C++03 mode:
+//
+// 1. noexcept and constexpr
+// 2. Two closing '>' without a space.
+
+#include <type_traits>
+#include <cassert>
+
+// Equals delete and default are allowed in minimal C++03 mode.
+namespace test_eq_delete_and_default {
+void t1() = delete;
+struct T2 {
+ T2() = default;
+ T2(T2 const&) = delete;
+};
+}
+
+namespace alias_templates {
+template <class T>
+using X = T;
+static_assert((std::is_same<X<int>, int>::value), "");
+}
+
+namespace variadics_templates {
+template <class ...Args>
+int t1(Args...) {
+ return sizeof...(Args);
+}
+void test() {
+ assert(t1() == 0);
+ assert(t1(42) == 1);
+ assert(t1(1, 2, 3) == 3);
+}
+}
+
+namespace rvalue_references_move_semantics {
+struct T {
+ T() : moved(0) {}
+ T(T const& other) : moved(other.moved) {}
+ T(T&& other) : moved(other.moved) { ++moved; other.moved = -1; }
+ int moved;
+};
+void f(T o, int expect_moved) { assert(o.moved == expect_moved); }
+void test() {
+ {
+ T t;
+ assert(t.moved == 0);
+ T t2(static_cast<T&&>(t));
+ assert(t2.moved == 1);
+ assert(t.moved == -1);
+ }
+ {
+ T t;
+ f(t, 0);
+ f(static_cast<T&&>(t), 1);
+ }
+}
+}
+
+namespace rvalue_references_perfect_forwarding {
+template <class Expect, class T>
+void f(T&&) {
+ static_assert((std::is_same<Expect, T&&>::value), "");
+}
+void test() {
+ int x = 42;
+ f<int&>(x);
+ f<int&&>(42);
+ f<int&&>(static_cast<int&&>(x));
+}
+}
+
+namespace default_values_for_nttp {
+template <int I = 42>
+void f() { assert(I == 42); }
+void test() {
+ f();
+}
+}
+
+namespace reference_qualified_functions {
+struct T {
+ T() : lvalue_called(0), rvalue_called(0) {}
+ void foo() const & { lvalue_called++; }
+ void foo() && { rvalue_called++; }
+ mutable int lvalue_called;
+ int rvalue_called;
+};
+
+void test() {
+ {
+ T t;
+ t.foo();
+ assert(t.lvalue_called == 1);
+ assert(t.rvalue_called == 0);
+ }
+ {
+ T t;
+ static_cast<T&&>(t).foo();
+ assert(t.lvalue_called == 0);
+ assert(t.rvalue_called == 1);
+ }
+}
+}
+
+int main(int, char**) {
+ variadics_templates::test();
+ rvalue_references_move_semantics::test();
+ rvalue_references_perfect_forwarding::test();
+ default_values_for_nttp::test();
+ reference_qualified_functions::test();
+ return 0;
+}
diff --git a/libcxx/test/libcxx-03/module_std.gen.py b/libcxx/test/libcxx-03/module_std.gen.py
new file mode 100644
index 0000000000000..fc23985caf30d
--- /dev/null
+++ b/libcxx/test/libcxx-03/module_std.gen.py
@@ -0,0 +1,38 @@
+# ===----------------------------------------------------------------------===##
+#
+# Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+# See https://llvm.org/LICENSE.txt for license information.
+# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+#
+# ===----------------------------------------------------------------------===##
+
+# Test that all named declarations with external linkage match the
+# exported declarations in their associated module partition.
+# Then it tests the sum of the exported declarations in the module
+# partitions matches the export of the std module.
+
+# Note the test of the std module requires all partitions to be tested
+# first. Since lit tests have no dependencies, this means the test needs
+# to be one monolitic test. Since the test doesn't take very long it's
+# not a huge issue.
+
+# RUN: %{python} %s %{libcxx-dir}/utils
+
+import sys
+
+sys.path.append(sys.argv[1])
+from libcxx.test.modules import module_test_generator
+
+generator = module_test_generator(
+ "%t",
+ "%{module-dir}",
+ "%{clang-tidy}",
+ "%{test-tools-dir}/clang_tidy_checks/libcxx-tidy.plugin",
+ "%{cxx}",
+ "%{flags} %{compile_flags}",
+ "std",
+)
+
+
+print("//--- module_std.sh.cpp")
+generator.write_test("std")
diff --git a/libcxx/test/libcxx-03/module_std_compat.gen.py b/libcxx/test/libcxx-03/module_std_compat.gen.py
new file mode 100644
index 0000000000000..000aa29986122
--- /dev/null
+++ b/libcxx/test/libcxx-03/module_std_compat.gen.py
@@ -0,0 +1,42 @@
+# ===----------------------------------------------------------------------===##
+#
+# Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+# See https://llvm.org/LICENSE.txt for license information.
+# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+#
+# ===----------------------------------------------------------------------===##
+
+# Test that all named declarations with external linkage match the
+# exported declarations in their associated module partition.
+# Then it tests the sum of the exported declarations in the module
+# partitions matches the export of the std.compat module.
+
+# Note the test of the std.compat module requires all partitions to be tested
+# first. Since lit tests have no dependencies, this means the test needs
+# to be one monolitic test. Since the test doesn't take very long it's
+# not a huge issue.
+
+# RUN: %{python} %s %{libcxx-dir}/utils
+
+import sys
+
+sys.path.append(sys.argv[1])
+from libcxx.header_information import module_c_headers
+from libcxx.test.modules import module_test_generator
+
+generator = module_test_generator(
+ "%t",
+ "%{module-dir}",
+ "%{clang-tidy}",
+ "%{test-tools-dir}/clang_tidy_checks/libcxx-tidy.plugin",
+ "%{cxx}",
+ "%{flags} %{compile_flags}",
+ "std.compat",
+)
+
+
+print("//--- module_std_compat.sh.cpp")
+generator.write_test(
+ "std.compat",
+ module_c_headers,
+)
diff --git a/libcxx/test/libcxx-03/no_assert_include.gen.py b/libcxx/test/libcxx-03/no_assert_include.gen.py
new file mode 100644
index 0000000000000..e0dbc3d815f31
--- /dev/null
+++ b/libcxx/test/libcxx-03/no_assert_include.gen.py
@@ -0,0 +1,39 @@
+# ===----------------------------------------------------------------------===##
+#
+# Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+# See https://llvm.org/LICENSE.txt for license information.
+# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+#
+# ===----------------------------------------------------------------------===##
+
+# Ensure that none of the standard C++ headers implicitly include cassert or
+# assert.h (because assert() is implemented as a macro).
+
+# RUN: %{python} %s %{libcxx-dir}/utils
+
+import sys
+
+sys.path.append(sys.argv[1])
+from libcxx.header_information import (
+ lit_header_restrictions,
+ lit_header_undeprecations,
+ public_headers,
+)
+
+for header in public_headers:
+ if header == "cassert":
+ continue
+
+ print(
+ f"""\
+//--- {header}.compile.pass.cpp
+{lit_header_restrictions.get(header, '')}
+{lit_header_undeprecations.get(header, '')}
+
+#include <{header}>
+
+#ifdef assert
+# error "Do not include cassert or assert.h in standard header files"
+#endif
+"""
+ )
diff --git a/libcxx/test/libcxx-03/numerics/bit.ops.pass.cpp b/libcxx/test/libcxx-03/numerics/bit.ops.pass.cpp
new file mode 100644
index 0000000000000..1bf9d3890f45f
--- /dev/null
+++ b/libcxx/test/libcxx-03/numerics/bit.ops.pass.cpp
@@ -0,0 +1,45 @@
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// Test the __XXXX routines in the <bit> header.
+// These are not supposed to be exhaustive tests, just sanity checks.
+
+// XFAIL: FROZEN-CXX03-HEADERS-FIXME
+
+#include <__bit/bit_log2.h>
+#include <__bit/countl.h>
+#include <__bit/rotate.h>
+#include <cassert>
+
+#include "test_macros.h"
+
+TEST_CONSTEXPR_CXX14 bool test() {
+ const unsigned v = 0x12345678;
+
+ ASSERT_SAME_TYPE(unsigned, decltype(std::__rotr(v, 3)));
+ ASSERT_SAME_TYPE(int, decltype(std::__countl_zero(v)));
+
+ assert(std::__rotr(v, 3) == 0x02468acfU);
+ assert(std::__countl_zero(v) == 3);
+
+#if TEST_STD_VER > 17
+ ASSERT_SAME_TYPE(unsigned, decltype(std::__bit_log2(v)));
+ assert(std::__bit_log2(v) == 28);
+#endif
+
+ return true;
+}
+
+int main(int, char**) {
+ test();
+#if TEST_STD_VER > 11
+ static_assert(test(), "");
+#endif
+
+ return 0;
+}
diff --git a/libcxx/test/libcxx-03/numerics/c.math/fdelayed-template-parsing.pass.cpp b/libcxx/test/libcxx-03/numerics/c.math/fdelayed-template-parsing.pass.cpp
new file mode 100644
index 0000000000000..a366e8ea40d6b
--- /dev/null
+++ b/libcxx/test/libcxx-03/numerics/c.math/fdelayed-template-parsing.pass.cpp
@@ -0,0 +1,28 @@
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// Test that cmath builds with -fdelayed-template-parsing.
+// This is a regression test for an issue introduced in ae22f0b24231,
+// where Clang's limited support for -fdelayed-template-parsing would
+// choke on <cmath>.
+
+// REQUIRES: fdelayed-template-parsing
+// ADDITIONAL_COMPILE_FLAGS: -fdelayed-template-parsing
+
+#include <cmath>
+#include <cassert>
+
+int main(int, char**) {
+ assert(std::isfinite(1.0));
+ assert(!std::isinf(1.0));
+ assert(!std::isnan(1.0));
+
+ return 0;
+}
+
+using namespace std; // on purpose
diff --git a/libcxx/test/libcxx-03/numerics/clamp_to_integral.pass.cpp b/libcxx/test/libcxx-03/numerics/clamp_to_integral.pass.cpp
new file mode 100644
index 0000000000000..68d55afa1f280
--- /dev/null
+++ b/libcxx/test/libcxx-03/numerics/clamp_to_integral.pass.cpp
@@ -0,0 +1,94 @@
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// __clamp_to_integral<IntT>(RealT)
+
+// Test the conversion function that truncates floating point types to the
+// closest representable value for the specified integer type, or
+// numeric_limits<IntT>::max()/min() if the value isn't representable.
+
+// XFAIL: FROZEN-CXX03-HEADERS-FIXME
+
+#include <__random/clamp_to_integral.h>
+#include <cassert>
+#include <cmath>
+#include <limits>
+
+template <class IntT>
+void test() {
+ typedef std::numeric_limits<IntT> Lim;
+ const bool MaxIsRepresentable = sizeof(IntT) < 8;
+ const bool IsSigned = std::is_signed<IntT>::value;
+ struct TestCase {
+ double Input;
+ IntT Expect;
+ bool IsRepresentable;
+ } TestCases[] = {
+ {0, 0, true},
+ {1, 1, true},
+ {IsSigned ? static_cast<IntT>(-1) : 0,
+ IsSigned ? static_cast<IntT>(-1) : 0, true},
+ {Lim::lowest(), Lim::lowest(), true},
+ {static_cast<double>(Lim::max()), Lim::max(), MaxIsRepresentable},
+ {static_cast<double>(Lim::max()) + 1, Lim::max(), false},
+ {static_cast<double>(Lim::max()) + 1024, Lim::max(), false},
+ {nextafter(static_cast<double>(Lim::max()), INFINITY), Lim::max(), false},
+ };
+ for (TestCase TC : TestCases) {
+ auto res = std::__clamp_to_integral<IntT>(TC.Input);
+ assert(res == TC.Expect);
+ if (TC.IsRepresentable) {
+ auto other = static_cast<IntT>(std::trunc(TC.Input));
+ assert(res == other);
+ } else
+ assert(res == Lim::min() || res == Lim::max());
+ }
+}
+
+template <class IntT>
+void test_float() {
+ typedef std::numeric_limits<IntT> Lim;
+ const bool MaxIsRepresentable = sizeof(IntT) < 4;
+ ((void)MaxIsRepresentable);
+ const bool IsSigned = std::is_signed<IntT>::value;
+ struct TestCase {
+ float Input;
+ IntT Expect;
+ bool IsRepresentable;
+ } TestCases[] = {
+ {0, 0, true},
+ {1, 1, true},
+ {IsSigned ? static_cast<IntT>(-1) : 0,
+ IsSigned ? static_cast<IntT>(-1) : 0, true},
+ {Lim::lowest(), Lim::lowest(), true},
+ {static_cast<float>(Lim::max()), Lim::max(), MaxIsRepresentable },
+ {nextafter(static_cast<float>(Lim::max()), INFINITY), Lim::max(), false},
+ };
+ for (TestCase TC : TestCases) {
+ auto res = std::__clamp_to_integral<IntT>(TC.Input);
+ assert(res == TC.Expect);
+ if (TC.IsRepresentable) {
+ auto other = static_cast<IntT>(std::trunc(TC.Input));
+ assert(res == other);
+ } else
+ assert(res == Lim::min() || res == Lim::max());
+ }
+}
+
+int main(int, char**) {
+ test<short>();
+ test<unsigned short>();
+ test<int>();
+ test<unsigned>();
+ test<long long>();
+ test<unsigned long long>();
+ test_float<short>();
+ test_float<int>();
+ test_float<long long>();
+ return 0;
+}
diff --git a/libcxx/test/libcxx-03/numerics/complex.number/__sqr.pass.cpp b/libcxx/test/libcxx-03/numerics/complex.number/__sqr.pass.cpp
new file mode 100644
index 0000000000000..97f4a2419483c
--- /dev/null
+++ b/libcxx/test/libcxx-03/numerics/complex.number/__sqr.pass.cpp
@@ -0,0 +1,84 @@
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// <complex>
+
+// template<class T>
+// complex<T>
+// __sqr(const complex<T>& x);
+
+#include <complex>
+#include <cassert>
+
+#include "test_macros.h"
+
+template <class T>
+void
+test()
+{
+ const T tolerance = std::is_same<T, float>::value ? 1.e-6 : 1.e-14;
+
+ typedef std::complex<T> cplx;
+ struct test_case
+ {
+ cplx value;
+ cplx expected;
+ };
+
+ const test_case cases[] = {
+ {cplx( 0, 0), cplx( 0, 0)},
+ {cplx( 1, 0), cplx( 1, 0)},
+ {cplx( 2, 0), cplx( 4, 0)},
+ {cplx(-1, 0), cplx( 1, 0)},
+ {cplx( 0, 1), cplx(-1, 0)},
+ {cplx( 0, 2), cplx(-4, 0)},
+ {cplx( 0, -1), cplx(-1, 0)},
+ {cplx( 1, 1), cplx( 0, 2)},
+ {cplx( 1, -1), cplx( 0, -2)},
+ {cplx(-1, -1), cplx( 0, 2)},
+ {cplx(0.5, 0), cplx(0.25, 0)},
+ };
+
+ const unsigned num_cases = sizeof(cases) / sizeof(test_case);
+ for (unsigned i = 0; i < num_cases; ++i)
+ {
+ const test_case& test = cases[i];
+ const std::complex<T> actual = std::__sqr(test.value);
+ assert(std::abs(actual.real() - test.expected.real()) < tolerance);
+ assert(std::abs(actual.imag() - test.expected.imag()) < tolerance);
+ }
+
+ const cplx nan1 = std::__sqr(cplx(NAN, 0));
+ assert(std::isnan(nan1.real()));
+ assert(std::isnan(nan1.imag()));
+
+ const cplx nan2 = std::__sqr(cplx(0, NAN));
+ assert(std::isnan(nan2.real()));
+ assert(std::isnan(nan2.imag()));
+
+ const cplx nan3 = std::__sqr(cplx(NAN, NAN));
+ assert(std::isnan(nan3.real()));
+ assert(std::isnan(nan3.imag()));
+
+ const cplx inf1 = std::__sqr(cplx(INFINITY, 0));
+ assert(std::isinf(inf1.real()));
+ assert(inf1.real() > 0);
+
+ const cplx inf2 = std::__sqr(cplx(0, INFINITY));
+ assert(std::isinf(inf2.real()));
+ assert(inf2.real() < 0);
+}
+
+int main(int, char**)
+{
+ test<float>();
+ test<double>();
+ test<long double>();
+
+ return 0;
+}
diff --git a/libcxx/test/libcxx-03/numerics/complex.number/cmplx.over.pow.pass.cpp b/libcxx/test/libcxx-03/numerics/complex.number/cmplx.over.pow.pass.cpp
new file mode 100644
index 0000000000000..d87e259cefe39
--- /dev/null
+++ b/libcxx/test/libcxx-03/numerics/complex.number/cmplx.over.pow.pass.cpp
@@ -0,0 +1,86 @@
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// <complex>
+
+// XFAIL: FROZEN-CXX03-HEADERS-FIXME
+
+// template<class T, class U> complex<__promote_t<T, U>> pow(const complex<T>&, const U&);
+// template<class T, class U> complex<__promote_t<T, U>> pow(const complex<T>&, const complex<U>&);
+// template<class T, class U> complex<__promote_t<T, U>> pow(const T&, const complex<U>&);
+
+// Test that these additional overloads are free from catching std::complex<non-floating-point>,
+// which is expected by several 3rd party libraries, see https://github.com/llvm/llvm-project/issues/109858.
+//
+// Note that we reserve the right to break this in the future if we have a reason to, but for the time being,
+// make sure we don't break this property unintentionally.
+#include <cassert>
+#include <cmath>
+#include <complex>
+#include <type_traits>
+
+#include "test_macros.h"
+
+namespace usr {
+struct usr_tag {};
+
+template <class T, class U>
+typename std::enable_if<(std::is_same<T, usr_tag>::value && std::is_floating_point<U>::value) ||
+ (std::is_floating_point<T>::value && std::is_same<U, usr_tag>::value),
+ int>::type
+pow(const T&, const std::complex<U>&) {
+ return std::is_same<T, usr_tag>::value ? 0 : 1;
+}
+
+template <class T, class U>
+typename std::enable_if<(std::is_same<T, usr_tag>::value && std::is_floating_point<U>::value) ||
+ (std::is_floating_point<T>::value && std::is_same<U, usr_tag>::value),
+ int>::type
+pow(const std::complex<T>&, const U&) {
+ return std::is_same<U, usr_tag>::value ? 2 : 3;
+}
+
+template <class T, class U>
+typename std::enable_if<(std::is_same<T, usr_tag>::value && std::is_floating_point<U>::value) ||
+ (std::is_floating_point<T>::value && std::is_same<U, usr_tag>::value),
+ int>::type
+pow(const std::complex<T>&, const std::complex<U>&) {
+ return std::is_same<T, usr_tag>::value ? 4 : 5;
+}
+} // namespace usr
+
+int main(int, char**) {
+ using std::pow;
+ using usr::pow;
+
+ usr::usr_tag tag;
+ const std::complex<usr::usr_tag> ctag;
+
+ assert(pow(tag, std::complex<float>(1.0f)) == 0);
+ assert(pow(std::complex<float>(1.0f), tag) == 2);
+ assert(pow(tag, std::complex<double>(1.0)) == 0);
+ assert(pow(std::complex<double>(1.0), tag) == 2);
+ assert(pow(tag, std::complex<long double>(1.0l)) == 0);
+ assert(pow(std::complex<long double>(1.0l), tag) == 2);
+
+ assert(pow(1.0f, ctag) == 1);
+ assert(pow(ctag, 1.0f) == 3);
+ assert(pow(1.0, ctag) == 1);
+ assert(pow(ctag, 1.0) == 3);
+ assert(pow(1.0l, ctag) == 1);
+ assert(pow(ctag, 1.0l) == 3);
+
+ assert(pow(ctag, std::complex<float>(1.0f)) == 4);
+ assert(pow(std::complex<float>(1.0f), ctag) == 5);
+ assert(pow(ctag, std::complex<double>(1.0)) == 4);
+ assert(pow(std::complex<double>(1.0), ctag) == 5);
+ assert(pow(ctag, std::complex<long double>(1.0l)) == 4);
+ assert(pow(std::complex<long double>(1.0l), ctag) == 5);
+
+ return 0;
+}
diff --git a/libcxx/test/libcxx-03/numerics/numarray/class.gslice.array/get.pass.cpp b/libcxx/test/libcxx-03/numerics/numarray/class.gslice.array/get.pass.cpp
new file mode 100644
index 0000000000000..2a1842f69fd2d
--- /dev/null
+++ b/libcxx/test/libcxx-03/numerics/numarray/class.gslice.array/get.pass.cpp
@@ -0,0 +1,52 @@
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// <valarray>
+
+// template<class T> class gslice_array;
+
+// T __get(size_t i);
+
+#include <valarray>
+#include <cassert>
+
+#include "test_macros.h"
+
+int main(int, char**) {
+ unsigned input[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
+ const unsigned N = sizeof(input) / sizeof(input[0]);
+
+ std::valarray<unsigned> array(input, N);
+
+ {
+ std::gslice_array<unsigned> result =
+ array[std::gslice(0, std::valarray<std::size_t>(N, 1), std::valarray<std::size_t>(1, 1))];
+ for (unsigned i = 0; i < N; ++i)
+ assert(result.__get(i) == i);
+ }
+
+ {
+ std::valarray<std::size_t> sizes(2);
+ sizes[0] = 2;
+ sizes[1] = 3;
+
+ std::valarray<std::size_t> strides(2);
+ strides[0] = 6;
+ strides[1] = 1;
+
+ std::gslice_array<unsigned> result = array[std::gslice(1, sizes, strides)];
+ assert(result.__get(0) == input[1 + 0 * 6 + 0 * 1]);
+ assert(result.__get(1) == input[1 + 0 * 6 + 1 * 1]);
+ assert(result.__get(2) == input[1 + 0 * 6 + 2 * 1]);
+
+ assert(result.__get(3) == input[1 + 1 * 6 + 0 * 1]);
+ assert(result.__get(4) == input[1 + 1 * 6 + 1 * 1]);
+ assert(result.__get(5) == input[1 + 1 * 6 + 2 * 1]);
+ }
+ return 0;
+}
diff --git a/libcxx/test/libcxx-03/numerics/numarray/class.indirect.array/get.pass.cpp b/libcxx/test/libcxx-03/numerics/numarray/class.indirect.array/get.pass.cpp
new file mode 100644
index 0000000000000..3c50c740bcaba
--- /dev/null
+++ b/libcxx/test/libcxx-03/numerics/numarray/class.indirect.array/get.pass.cpp
@@ -0,0 +1,44 @@
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// <valarray>
+
+// template<class T> class indirect_array;
+
+// T __get(size_t i);
+
+#include <valarray>
+#include <cassert>
+
+#include "test_macros.h"
+
+int main(int, char**) {
+ unsigned input[] = {0, 1, 2, 3, 4};
+ const unsigned N = sizeof(input) / sizeof(input[0]);
+
+ std::valarray<unsigned> array(input, N);
+
+ {
+ std::indirect_array<unsigned> result = array[std::valarray<std::size_t>(std::size_t(0), std::size_t(N))];
+ for (unsigned i = 0; i < N; ++i)
+ assert(result.__get(i) == 0);
+ }
+
+ {
+ std::valarray<std::size_t> indirect(std::size_t(0), std::size_t(3));
+ indirect[0] = 4;
+ indirect[1] = 1;
+ indirect[2] = 3;
+ std::indirect_array<unsigned> result = array[indirect];
+ assert(result.__get(0) == 4);
+ assert(result.__get(1) == 1);
+ assert(result.__get(2) == 3);
+ }
+
+ return 0;
+}
diff --git a/libcxx/test/libcxx-03/numerics/numarray/class.mask.array/get.pass.cpp b/libcxx/test/libcxx-03/numerics/numarray/class.mask.array/get.pass.cpp
new file mode 100644
index 0000000000000..e34c38289222a
--- /dev/null
+++ b/libcxx/test/libcxx-03/numerics/numarray/class.mask.array/get.pass.cpp
@@ -0,0 +1,51 @@
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// <valarray>
+
+// template<class T> class mask_array;
+
+// T __get(size_t i);
+
+#include <valarray>
+#include <cassert>
+
+#include "test_macros.h"
+
+int main(int, char**) {
+ unsigned input[] = {0, 1, 2, 3, 4};
+ const unsigned N = sizeof(input) / sizeof(input[0]);
+
+ std::valarray<unsigned> array(input, N);
+
+ {
+ std::mask_array<unsigned> result = array[std::valarray<bool>(true, N)];
+ for (unsigned i = 0; i < N; ++i)
+ assert(result.__get(i) == i);
+ }
+
+ {
+ std::valarray<bool> mask(false, N);
+ mask[1] = true;
+ mask[3] = true;
+ std::mask_array<unsigned> result = array[mask];
+ assert(result.__get(0) == 1);
+ assert(result.__get(1) == 3);
+ }
+
+ {
+ std::valarray<bool> mask(false, N);
+ mask[0] = true;
+ mask[4] = true;
+ std::mask_array<unsigned> result = array[mask];
+ assert(result.__get(0) == 0);
+ assert(result.__get(1) == 4);
+ }
+
+ return 0;
+}
diff --git a/libcxx/test/libcxx-03/numerics/numarray/class.slice.array/get.pass.cpp b/libcxx/test/libcxx-03/numerics/numarray/class.slice.array/get.pass.cpp
new file mode 100644
index 0000000000000..26871f310bae2
--- /dev/null
+++ b/libcxx/test/libcxx-03/numerics/numarray/class.slice.array/get.pass.cpp
@@ -0,0 +1,46 @@
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// <valarray>
+
+// template<class T> class slice_array;
+
+// T __get(size_t i);
+
+#include <valarray>
+#include <cassert>
+
+#include "test_macros.h"
+
+int main(int, char**) {
+ unsigned input[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
+ const unsigned N = sizeof(input) / sizeof(input[0]);
+
+ std::valarray<unsigned> array(input, N);
+
+ {
+ std::slice_array<unsigned> result = array[std::slice(0, N, 1)];
+ for (unsigned i = 0; i < N; ++i)
+ assert(result.__get(i) == i);
+ }
+
+ {
+ std::slice_array<unsigned> result = array[std::slice(3, 2, 2)];
+ assert(result.__get(0) == 3);
+ assert(result.__get(1) == 5);
+ }
+
+ {
+ std::slice_array<unsigned> result = array[std::slice(1, 3, 4)];
+ assert(result.__get(0) == 1);
+ assert(result.__get(1) == 5);
+ assert(result.__get(2) == 9);
+ }
+
+ return 0;
+}
diff --git a/libcxx/test/libcxx-03/numerics/rand/rand.device/has-no-random-device.verify.cpp b/libcxx/test/libcxx-03/numerics/rand/rand.device/has-no-random-device.verify.cpp
new file mode 100644
index 0000000000000..03d592774e572
--- /dev/null
+++ b/libcxx/test/libcxx-03/numerics/rand/rand.device/has-no-random-device.verify.cpp
@@ -0,0 +1,18 @@
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// Make sure that std::random_device is not available in namespace std:: when
+// libc++ is built without support for random device.
+
+// REQUIRES: no-random-device
+
+#include <random>
+
+void f() {
+ std::random_device d; // expected-error {{no type named 'random_device' in namespace 'std'}}
+}
diff --git a/libcxx/test/libcxx-03/numerics/rand/rand.req.urng/valid_int_type.verify.cpp b/libcxx/test/libcxx-03/numerics/rand/rand.req.urng/valid_int_type.verify.cpp
new file mode 100644
index 0000000000000..eada7422bea4e
--- /dev/null
+++ b/libcxx/test/libcxx-03/numerics/rand/rand.req.urng/valid_int_type.verify.cpp
@@ -0,0 +1,51 @@
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// <random>
+
+#include <random>
+
+void test()
+{
+ {
+ std::binomial_distribution<bool> baddist; //expected-error@*:* {{IntType must be a supported integer type}}
+ std::binomial_distribution<int> okdist;
+ (void)baddist;
+ (void)okdist;
+ }
+ {
+ std::discrete_distribution<bool> baddist; //expected-error@*:* {{IntType must be a supported integer type}}
+ std::discrete_distribution<int> okdist;
+ (void)baddist;
+ (void)okdist;
+ }
+ {
+ std::geometric_distribution<bool> baddist; //expected-error@*:* {{IntType must be a supported integer type}}
+ std::geometric_distribution<int> okdist;
+ (void)baddist;
+ (void)okdist;
+ }
+ {
+ std::negative_binomial_distribution<bool> baddist; //expected-error@*:* {{IntType must be a supported integer type}}
+ std::negative_binomial_distribution<int> okdist;
+ (void)baddist;
+ (void)okdist;
+ }
+ {
+ std::poisson_distribution<bool> baddist; //expected-error@*:* {{IntType must be a supported integer type}}
+ std::poisson_distribution<int> okdist;
+ (void)baddist;
+ (void)okdist;
+ }
+ {
+ std::uniform_int_distribution<bool> baddist; //expected-error@*:* {{IntType must be a supported integer type}}
+ std::uniform_int_distribution<int> okdist;
+ (void)baddist;
+ (void)okdist;
+ }
+}
diff --git a/libcxx/test/libcxx-03/numerics/rand/rand.req.urng/valid_real_type.verify.cpp b/libcxx/test/libcxx-03/numerics/rand/rand.req.urng/valid_real_type.verify.cpp
new file mode 100644
index 0000000000000..6c6a109227df9
--- /dev/null
+++ b/libcxx/test/libcxx-03/numerics/rand/rand.req.urng/valid_real_type.verify.cpp
@@ -0,0 +1,109 @@
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// <random>
+
+#include <random>
+
+void test() {
+ {
+ std::uniform_real_distribution<int>
+ baddist; //expected-error@*:* {{RealType must be a supported floating-point type}}
+ std::uniform_real_distribution<double> okdist;
+ (void)baddist;
+ (void)okdist;
+ }
+ {
+ std::exponential_distribution<int>
+ baddist; // expected-error@*:* {{RealType must be a supported floating-point type}}
+ std::exponential_distribution<double> okdist;
+ (void)baddist;
+ (void)okdist;
+ }
+
+ {
+ std::gamma_distribution<int> baddist; // expected-error@*:* {{RealType must be a supported floating-point type}}
+ std::gamma_distribution<double> okdist;
+ (void)baddist;
+ (void)okdist;
+ }
+
+ {
+ std::weibull_distribution<int> baddist; // expected-error@*:* {{RealType must be a supported floating-point type}}
+ std::weibull_distribution<double> okdist;
+ (void)baddist;
+ (void)okdist;
+ }
+
+ {
+ std::extreme_value_distribution<int>
+ baddist; // expected-error@*:* {{RealType must be a supported floating-point type}}
+ std::extreme_value_distribution<double> okdist;
+ (void)baddist;
+ (void)okdist;
+ }
+
+ {
+ std::normal_distribution<int> baddist; // expected-error@*:* {{RealType must be a supported floating-point type}}
+ std::normal_distribution<double> okdist;
+ (void)baddist;
+ (void)okdist;
+ }
+
+ {
+ std::lognormal_distribution<int> baddist; // expected-error@*:* {{RealType must be a supported floating-point type}}
+ std::lognormal_distribution<double> okdist;
+ (void)baddist;
+ (void)okdist;
+ }
+
+ {
+ std::chi_squared_distribution<int>
+ baddist; // expected-error@*:* {{RealType must be a supported floating-point type}}
+ std::chi_squared_distribution<double> okdist;
+ (void)baddist;
+ (void)okdist;
+ }
+
+ {
+ std::cauchy_distribution<int> baddist; // expected-error@*:* {{RealType must be a supported floating-point type}}
+ std::cauchy_distribution<double> okdist;
+ (void)baddist;
+ (void)okdist;
+ }
+
+ {
+ std::fisher_f_distribution<int> baddist; // expected-error@*:* {{RealType must be a supported floating-point type}}
+ std::fisher_f_distribution<double> okdist;
+ (void)baddist;
+ (void)okdist;
+ }
+
+ {
+ std::student_t_distribution<int> baddist; // expected-error@*:* {{RealType must be a supported floating-point type}}
+ std::student_t_distribution<double> okdist;
+ (void)baddist;
+ (void)okdist;
+ }
+
+ {
+ std::piecewise_constant_distribution<int>
+ baddist; // expected-error@*:* {{RealType must be a supported floating-point type}}
+ std::piecewise_constant_distribution<double> okdist;
+ (void)baddist;
+ (void)okdist;
+ }
+
+ {
+ std::piecewise_linear_distribution<int>
+ baddist; // expected-error@*:* {{RealType must be a supported floating-point type}}
+ std::piecewise_linear_distribution<double> okdist;
+ (void)baddist;
+ (void)okdist;
+ }
+}
diff --git a/libcxx/test/libcxx-03/odr_signature.exceptions.sh.cpp b/libcxx/test/libcxx-03/odr_signature.exceptions.sh.cpp
new file mode 100644
index 0000000000000..6bf60b5e82d3c
--- /dev/null
+++ b/libcxx/test/libcxx-03/odr_signature.exceptions.sh.cpp
@@ -0,0 +1,46 @@
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// TODO: Investigate
+// XFAIL: msvc
+
+// Test that we encode whether exceptions are supported in an ABI tag to avoid
+// ODR violations when linking TUs that have different values for it.
+
+// RUN: %{cxx} %s %{flags} %{compile_flags} -c -DTU1 -fno-exceptions -o %t.tu1.o
+// RUN: %{cxx} %s %{flags} %{compile_flags} -c -DTU2 -fexceptions -o %t.tu2.o
+// RUN: %{cxx} %s %{flags} %{compile_flags} -c -DMAIN -o %t.main.o
+// RUN: %{cxx} %t.tu1.o %t.tu2.o %t.main.o %{flags} %{link_flags} -o %t.exe
+// RUN: %{exec} %t.exe
+
+// -fno-exceptions
+#ifdef TU1
+# include <__config>
+_LIBCPP_HIDE_FROM_ABI inline int f() { return 1; }
+int tu1() { return f(); }
+#endif // TU1
+
+// -fexceptions
+#ifdef TU2
+# include <__config>
+_LIBCPP_HIDE_FROM_ABI inline int f() { return 2; }
+int tu2() { return f(); }
+#endif // TU2
+
+#ifdef MAIN
+# include <cassert>
+
+int tu1();
+int tu2();
+
+int main(int, char**) {
+ assert(tu1() == 1);
+ assert(tu2() == 2);
+ return 0;
+}
+#endif // MAIN
diff --git a/libcxx/test/libcxx-03/odr_signature.hardening.sh.cpp b/libcxx/test/libcxx-03/odr_signature.hardening.sh.cpp
new file mode 100644
index 0000000000000..0dc280bf28182
--- /dev/null
+++ b/libcxx/test/libcxx-03/odr_signature.hardening.sh.cpp
@@ -0,0 +1,67 @@
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// TODO: Investigate
+// XFAIL: msvc
+
+// Test that we encode the hardening mode in an ABI tag to avoid ODR violations
+// when linking TUs that have different values for it.
+
+// Note that GCC doesn't support `-Wno-macro-redefined`.
+// RUN: %{cxx} %s %{flags} %{compile_flags} -c -DTU1 -U_LIBCPP_HARDENING_MODE -D_LIBCPP_HARDENING_MODE=_LIBCPP_HARDENING_MODE_FAST -o %t.tu1.o
+// RUN: %{cxx} %s %{flags} %{compile_flags} -c -DTU2 -U_LIBCPP_HARDENING_MODE -D_LIBCPP_HARDENING_MODE=_LIBCPP_HARDENING_MODE_EXTENSIVE -o %t.tu2.o
+// RUN: %{cxx} %s %{flags} %{compile_flags} -c -DTU3 -U_LIBCPP_HARDENING_MODE -D_LIBCPP_HARDENING_MODE=_LIBCPP_HARDENING_MODE_DEBUG -o %t.tu3.o
+// RUN: %{cxx} %s %{flags} %{compile_flags} -c -DTU4 -U_LIBCPP_HARDENING_MODE -D_LIBCPP_HARDENING_MODE=_LIBCPP_HARDENING_MODE_NONE -o %t.tu4.o
+// RUN: %{cxx} %s %{flags} %{compile_flags} -c -DMAIN -o %t.main.o
+// RUN: %{cxx} %t.tu1.o %t.tu2.o %t.tu3.o %t.tu4.o %t.main.o %{flags} %{link_flags} -o %t.exe
+// RUN: %{exec} %t.exe
+
+// fast hardening mode
+#ifdef TU1
+# include <__config>
+_LIBCPP_HIDE_FROM_ABI inline int f() { return 1; }
+int tu1() { return f(); }
+#endif // TU1
+
+// extensive hardening mode
+#ifdef TU2
+# include <__config>
+_LIBCPP_HIDE_FROM_ABI inline int f() { return 2; }
+int tu2() { return f(); }
+#endif // TU2
+
+// debug hardening mode
+#ifdef TU3
+# include <__config>
+_LIBCPP_HIDE_FROM_ABI inline int f() { return 3; }
+int tu3() { return f(); }
+#endif // TU3
+
+// No hardening
+#ifdef TU4
+# include <__config>
+_LIBCPP_HIDE_FROM_ABI inline int f() { return 4; }
+int tu4() { return f(); }
+#endif // TU4
+
+#ifdef MAIN
+# include <cassert>
+
+int tu1();
+int tu2();
+int tu3();
+int tu4();
+
+int main(int, char**) {
+ assert(tu1() == 1);
+ assert(tu2() == 2);
+ assert(tu3() == 3);
+ assert(tu4() == 4);
+ return 0;
+}
+#endif // MAIN
diff --git a/libcxx/test/libcxx-03/strings/basic.string/sizeof.compile.pass.cpp b/libcxx/test/libcxx-03/strings/basic.string/sizeof.compile.pass.cpp
new file mode 100644
index 0000000000000..31f1a94c73216
--- /dev/null
+++ b/libcxx/test/libcxx-03/strings/basic.string/sizeof.compile.pass.cpp
@@ -0,0 +1,145 @@
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// Ensure that we never change the size or alignment of `basic_string`
+
+#include <cstdint>
+#include <iterator>
+#include <string>
+
+#include "test_macros.h"
+#include "min_allocator.h"
+#include "test_allocator.h"
+
+template <class T>
+class small_pointer {
+public:
+ using value_type = T;
+ using difference_type = std::int16_t;
+ using pointer = small_pointer;
+ using reference = T&;
+ using iterator_category = std::random_access_iterator_tag;
+
+private:
+ std::uint16_t offset;
+};
+
+template <class T>
+class small_iter_allocator {
+public:
+ using value_type = T;
+ using pointer = small_pointer<T>;
+ using size_type = std::int16_t;
+ using difference_type = std::int16_t;
+
+ small_iter_allocator() TEST_NOEXCEPT {}
+
+ template <class U>
+ small_iter_allocator(small_iter_allocator<U>) TEST_NOEXCEPT {}
+
+ T* allocate(std::size_t n);
+ void deallocate(T* p, std::size_t);
+
+ friend bool operator==(small_iter_allocator, small_iter_allocator) { return true; }
+ friend bool operator!=(small_iter_allocator, small_iter_allocator) { return false; }
+};
+
+template <class CharT>
+using min_string = std::basic_string<CharT, std::char_traits<CharT>, min_allocator<CharT> >;
+
+template <class CharT>
+using test_string = std::basic_string<CharT, std::char_traits<CharT>, test_allocator<CharT> >;
+
+template <class CharT>
+using small_string = std::basic_string<CharT, std::char_traits<CharT>, small_iter_allocator<CharT> >;
+
+#if __SIZE_WIDTH__ == 64
+
+static_assert(sizeof(std::string) == 24, "");
+static_assert(sizeof(min_string<char>) == 24, "");
+static_assert(sizeof(test_string<char>) == 32, "");
+static_assert(sizeof(small_string<char>) == 6, "");
+
+# ifndef TEST_HAS_NO_WIDE_CHARACTERS
+# if __WCHAR_WIDTH__ == 32
+static_assert(sizeof(std::wstring) == 24, "");
+static_assert(sizeof(min_string<wchar_t>) == 24, "");
+static_assert(sizeof(test_string<wchar_t>) == 32, "");
+static_assert(sizeof(small_string<wchar_t>) == 12, "");
+# elif __WCHAR_WIDTH__ == 16
+static_assert(sizeof(std::wstring) == 24, "");
+static_assert(sizeof(min_string<wchar_t>) == 24, "");
+static_assert(sizeof(test_string<wchar_t>) == 32, "");
+static_assert(sizeof(small_string<wchar_t>) == 6, "");
+# else
+# error "Unexpected wchar_t width"
+# endif
+# endif
+
+# ifndef TEST_HAS_NO_CHAR8_T
+static_assert(sizeof(std::u8string) == 24, "");
+static_assert(sizeof(min_string<char8_t>) == 24, "");
+static_assert(sizeof(test_string<char8_t>) == 32, "");
+static_assert(sizeof(small_string<char8_t>) == 6, "");
+# endif
+
+# ifndef TEST_HAS_NO_UNICODE_CHARS
+static_assert(sizeof(std::u16string) == 24, "");
+static_assert(sizeof(std::u32string) == 24, "");
+static_assert(sizeof(min_string<char16_t>) == 24, "");
+static_assert(sizeof(min_string<char32_t>) == 24, "");
+static_assert(sizeof(test_string<char16_t>) == 32, "");
+static_assert(sizeof(test_string<char32_t>) == 32, "");
+static_assert(sizeof(small_string<char16_t>) == 6, "");
+static_assert(sizeof(small_string<char32_t>) == 12, "");
+# endif
+
+#elif __SIZE_WIDTH__ == 32
+
+static_assert(sizeof(std::string) == 12, "");
+static_assert(sizeof(min_string<char>) == 12, "");
+static_assert(sizeof(test_string<char>) == 24, "");
+static_assert(sizeof(small_string<char>) == 6, "");
+
+# ifndef TEST_HAS_NO_WIDE_CHARACTERS
+# if __WCHAR_WIDTH__ == 32
+static_assert(sizeof(std::wstring) == 12, "");
+static_assert(sizeof(min_string<wchar_t>) == 12, "");
+static_assert(sizeof(test_string<wchar_t>) == 24, "");
+static_assert(sizeof(small_string<wchar_t>) == 12, "");
+# elif __WCHAR_WIDTH__ == 16
+static_assert(sizeof(std::wstring) == 12, "");
+static_assert(sizeof(min_string<wchar_t>) == 12, "");
+static_assert(sizeof(test_string<wchar_t>) == 24, "");
+static_assert(sizeof(small_string<wchar_t>) == 6, "");
+# else
+# error "Unexpected wchar_t width"
+# endif
+# endif
+
+# ifndef TEST_HAS_NO_CHAR8_T
+static_assert(sizeof(std::u8string) == 12, "");
+static_assert(sizeof(min_string<char8_t>) == 12, "");
+static_assert(sizeof(test_string<char8_t>) == 24, "");
+static_assert(sizeof(small_string<char>) == 6, "");
+# endif
+
+# ifndef TEST_HAS_NO_UNICODE_CHARS
+static_assert(sizeof(std::u16string) == 12, "");
+static_assert(sizeof(std::u32string) == 12, "");
+static_assert(sizeof(min_string<char16_t>) == 12, "");
+static_assert(sizeof(min_string<char32_t>) == 12, "");
+static_assert(sizeof(test_string<char16_t>) == 24, "");
+static_assert(sizeof(test_string<char32_t>) == 24, "");
+static_assert(sizeof(small_string<char16_t>) == 6, "");
+static_assert(sizeof(small_string<char32_t>) == 12, "");
+# endif
+
+#else
+# error "std::size_t has an unexpected size"
+#endif
diff --git a/libcxx/test/libcxx-03/strings/basic.string/string.capacity/PR53170.pass.cpp b/libcxx/test/libcxx-03/strings/basic.string/string.capacity/PR53170.pass.cpp
new file mode 100644
index 0000000000000..e7b775068c54b
--- /dev/null
+++ b/libcxx/test/libcxx-03/strings/basic.string/string.capacity/PR53170.pass.cpp
@@ -0,0 +1,84 @@
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// <string>
+
+// void reserve(); // Deprecated in C++20.
+// void reserve(size_type);
+
+// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DISABLE_DEPRECATION_WARNINGS -D_LIBCPP_ENABLE_CXX26_REMOVED_STRING_RESERVE
+
+// This test ensures that libc++ implements https://wg21.link/P0966R1 (reserve never shrinks)
+// even before C++20. This is required in order to avoid ODR violations because basic_string::reserve(size)
+// is compiled into the shared library. Hence, it needs to have the same definition in all Standard modes.
+//
+// However, note that reserve() does shrink, and it does so in all Standard modes.
+//
+// Reported as https://llvm.org/PR53170.
+
+// reserve(n) used to shrink the string until https://llvm.org/D117332 was shipped in LLVM 14.
+// XFAIL: using-built-library-before-llvm-14
+
+#include <string>
+#include <stdexcept>
+#include <cassert>
+
+#include "test_macros.h"
+#include "min_allocator.h"
+
+template <class S>
+TEST_CONSTEXPR_CXX20 bool test() {
+ // Test that a call to reserve() does shrink the string.
+ if (!TEST_IS_CONSTANT_EVALUATED) {
+ S s(1000, 'a');
+ typename S::size_type old_cap = s.capacity();
+ s.resize(20);
+ assert(s.capacity() == old_cap);
+
+ s.reserve();
+ assert(s.capacity() < old_cap);
+ }
+
+ // Test that a call to reserve(smaller-than-capacity) never shrinks the string.
+ {
+ S s(1000, 'a');
+ typename S::size_type old_cap = s.capacity();
+ s.resize(20);
+ assert(s.capacity() == old_cap);
+
+ s.reserve(10);
+ assert(s.capacity() == old_cap);
+ }
+
+ // In particular, test that reserve(0) does NOT shrink the string.
+ {
+ S s(1000, 'a');
+ typename S::size_type old_cap = s.capacity();
+ s.resize(20);
+ assert(s.capacity() == old_cap);
+
+ s.reserve(0);
+ assert(s.capacity() == old_cap);
+ }
+
+ return true;
+}
+
+int main(int, char**) {
+ test<std::string>();
+
+#if TEST_STD_VER >= 11
+ test<std::basic_string<char, std::char_traits<char>, min_allocator<char> > >();
+#endif
+
+#if TEST_STD_VER > 17
+ static_assert(test<std::string>());
+#endif
+
+ return 0;
+}
diff --git a/libcxx/test/libcxx-03/strings/basic.string/string.capacity/allocation_size.pass.cpp b/libcxx/test/libcxx-03/strings/basic.string/string.capacity/allocation_size.pass.cpp
new file mode 100644
index 0000000000000..77da29225957b
--- /dev/null
+++ b/libcxx/test/libcxx-03/strings/basic.string/string.capacity/allocation_size.pass.cpp
@@ -0,0 +1,37 @@
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// <string>
+
+#include <algorithm>
+#include <cassert>
+#include <cstddef>
+#include <string>
+
+#include "test_macros.h"
+
+// alignment of the string heap buffer is hardcoded to 8
+const std::size_t alignment = 8;
+
+int main(int, char**) {
+ std::string input_string;
+ input_string.resize(64, 'a');
+
+ // Call a constructor which selects its size using __recommend.
+ std::string test_string(input_string.data());
+ const std::size_t expected_align8_size = 71;
+
+ // Demonstrate the lesser capacity/allocation size when the alignment requirement is 8.
+ if (alignment == 8) {
+ assert(test_string.capacity() == expected_align8_size);
+ } else {
+ assert(test_string.capacity() == expected_align8_size + 8);
+ }
+
+ return 0;
+}
diff --git a/libcxx/test/libcxx-03/strings/basic.string/string.capacity/max_size.pass.cpp b/libcxx/test/libcxx-03/strings/basic.string/string.capacity/max_size.pass.cpp
new file mode 100644
index 0000000000000..7b3f81e21d8a8
--- /dev/null
+++ b/libcxx/test/libcxx-03/strings/basic.string/string.capacity/max_size.pass.cpp
@@ -0,0 +1,122 @@
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// XFAIL: FROZEN-CXX03-HEADERS-FIXME
+
+// <string>
+
+// This test ensures that the correct max_size() is returned depending on the platform.
+
+#include <algorithm>
+#include <cassert>
+#include <cstddef>
+#include <string>
+
+#include "test_macros.h"
+
+// alignment of the string heap buffer is hardcoded to 8
+static const std::size_t alignment = 8;
+
+template <class = int>
+TEST_CONSTEXPR_CXX20 void full_size() {
+ std::string str;
+ assert(str.max_size() == std::numeric_limits<std::size_t>::max() - alignment - 1);
+
+#ifndef TEST_HAS_NO_CHAR8_T
+ std::u8string u8str;
+ assert(u8str.max_size() == std::numeric_limits<std::size_t>::max() - alignment - 1);
+#endif
+
+#ifndef TEST_HAS_NO_WIDE_CHARACTERS
+ std::wstring wstr;
+ assert(wstr.max_size() ==
+ ((std::numeric_limits<std::size_t>::max() / sizeof(wchar_t) - alignment) & ~std::size_t(1)) - 1);
+#endif
+
+ std::u16string u16str;
+ std::u32string u32str;
+ assert(u16str.max_size() == ((std::numeric_limits<std::size_t>::max() / 2 - alignment) & ~std::size_t(1)) - 1);
+ assert(u32str.max_size() == ((std::numeric_limits<std::size_t>::max() / 4 - alignment) & ~std::size_t(1)) - 1);
+}
+
+template <class = int>
+TEST_CONSTEXPR_CXX20 void half_size() {
+ std::string str;
+ assert(str.max_size() == std::numeric_limits<std::size_t>::max() / 2 - alignment - 1);
+
+#ifndef TEST_HAS_NO_CHAR8_T
+ std::u8string u8str;
+ assert(u8str.max_size() == std::numeric_limits<std::size_t>::max() / 2 - alignment - 1);
+#endif
+
+#ifndef TEST_HAS_NO_WIDE_CHARACTERS
+ std::wstring wstr;
+ assert(wstr.max_size() ==
+ std::numeric_limits<std::size_t>::max() / std::max<size_t>(2ul, sizeof(wchar_t)) - alignment - 1);
+#endif
+
+ std::u16string u16str;
+ std::u32string u32str;
+ assert(u16str.max_size() == std::numeric_limits<std::size_t>::max() / 2 - alignment - 1);
+ assert(u32str.max_size() == std::numeric_limits<std::size_t>::max() / 4 - alignment - 1);
+}
+
+TEST_CONSTEXPR_CXX20 bool test() {
+#if _LIBCPP_ABI_VERSION == 1
+
+# if defined(__x86_64__) || defined(__i386__)
+ full_size();
+# elif defined(__APPLE__) && defined(__aarch64__)
+ half_size();
+# elif defined(__arm__) || defined(__aarch64__)
+# ifdef __BIG_ENDIAN__
+ half_size();
+# else
+ full_size();
+# endif
+# elif defined(__powerpc__) || defined(__powerpc64__)
+# ifdef __BIG_ENDIAN__
+ half_size();
+# else
+ full_size();
+# endif
+# elif defined(__sparc64__)
+ half_size();
+# elif defined(__riscv)
+ full_size();
+# elif defined(_WIN32)
+ full_size();
+# else
+# error "Your target system seems to be unsupported."
+# endif
+
+#else
+
+# if defined(__arm__) || defined(__aarch64__)
+# ifdef __BIG_ENDIAN__
+ full_size();
+# else
+ half_size();
+# endif
+# else
+ half_size();
+# endif
+
+#endif
+
+ return true;
+}
+
+int main(int, char**) {
+ test();
+#if TEST_STD_VER > 17
+ static_assert(test());
+#endif
+
+ return 0;
+}
diff --git a/libcxx/test/libcxx-03/strings/basic.string/string.cons/copy_shrunk_long.pass.cpp b/libcxx/test/libcxx-03/strings/basic.string/string.cons/copy_shrunk_long.pass.cpp
new file mode 100644
index 0000000000000..d4a0b318f36d7
--- /dev/null
+++ b/libcxx/test/libcxx-03/strings/basic.string/string.cons/copy_shrunk_long.pass.cpp
@@ -0,0 +1,45 @@
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// <string>
+
+// basic_string(const basic_string<charT,traits,Allocator>& str);
+
+#include <string>
+#include <cassert>
+
+#include "test_macros.h"
+#include "test_allocator.h"
+#include "min_allocator.h"
+
+template <class S>
+TEST_CONSTEXPR_CXX20 bool test() {
+ // Tests that a long string holding a SSO size string results in
+ // an SSO copy constructed value.
+ S s1("1234567890123456789012345678901234567890123456789012345678901234567890");
+ s1.resize(7);
+ S s2(s1);
+ LIBCPP_ASSERT(s2.__invariants());
+ assert(s2 == s1);
+ assert(s2.capacity() < sizeof(S));
+
+ return true;
+}
+
+int main(int, char**) {
+ test<std::basic_string<char, std::char_traits<char>, test_allocator<char> > >();
+#if TEST_STD_VER >= 11
+ test<std::basic_string<char, std::char_traits<char>, min_allocator<char>>>();
+#endif
+#if TEST_STD_VER > 17
+ static_assert(test<std::basic_string<char, std::char_traits<char>, test_allocator<char>>>());
+ static_assert(test<std::basic_string<char, std::char_traits<char>, min_allocator<char>>>());
+#endif
+
+ return 0;
+}
diff --git a/libcxx/test/libcxx-03/strings/basic.string/string.modifiers/resize_default_initialized.pass.cpp b/libcxx/test/libcxx-03/strings/basic.string/string.modifiers/resize_default_initialized.pass.cpp
new file mode 100644
index 0000000000000..8e6e07d659c1a
--- /dev/null
+++ b/libcxx/test/libcxx-03/strings/basic.string/string.modifiers/resize_default_initialized.pass.cpp
@@ -0,0 +1,75 @@
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// <string>
+
+// __resize_default_init(size_type)
+
+#include <string>
+#include <cassert>
+
+#include "test_macros.h"
+
+TEST_CONSTEXPR_CXX20 void write_c_str(char* buf, int size) {
+ for (int i = 0; i < size; ++i) {
+ buf[i] = 'a';
+ }
+ buf[size] = '\0';
+}
+
+template <class S>
+TEST_CONSTEXPR_CXX20 void test_buffer_usage() {
+ {
+ unsigned buff_size = 125;
+ unsigned used_size = buff_size - 16;
+ S s;
+ s.__resize_default_init(buff_size);
+ write_c_str(&s[0], used_size);
+ assert(s.size() == buff_size);
+ assert(std::char_traits<char>().length(s.data()) == used_size);
+ s.__resize_default_init(used_size);
+ assert(s.size() == used_size);
+ assert(s.data()[used_size] == '\0');
+ for (unsigned i = 0; i < used_size; ++i) {
+ assert(s[i] == 'a');
+ }
+ }
+}
+
+template <class S>
+TEST_CONSTEXPR_CXX20 void test_basic() {
+ {
+ S s;
+ s.__resize_default_init(3);
+ assert(s.size() == 3);
+ assert(s.data()[3] == '\0');
+ for (int i = 0; i < 3; ++i)
+ s[i] = 'a' + i;
+ s.__resize_default_init(1);
+ assert(s[0] == 'a');
+ assert(s.data()[1] == '\0');
+ assert(s.size() == 1);
+ }
+}
+
+template <class S>
+TEST_CONSTEXPR_CXX20 bool test() {
+ test_basic<S>();
+ test_buffer_usage<S>();
+
+ return true;
+}
+
+int main(int, char**) {
+ test<std::string>();
+#if TEST_STD_VER > 17
+ static_assert(test<std::string>());
+#endif
+
+ return 0;
+}
diff --git a/libcxx/test/libcxx-03/strings/c.strings/constexpr_memmove.pass.cpp b/libcxx/test/libcxx-03/strings/c.strings/constexpr_memmove.pass.cpp
new file mode 100644
index 0000000000000..2009cbe28a91f
--- /dev/null
+++ b/libcxx/test/libcxx-03/strings/c.strings/constexpr_memmove.pass.cpp
@@ -0,0 +1,157 @@
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// _Tp* __constexpr_memmove(_Tp* __dest, _Up* __src, __element_count __n);
+//
+// General tests for __constexpr_memmove.
+//
+// In particular, we try to ensure that __constexpr_memmove behaves like
+// __builtin_memmove as closely as possible. This means that it produces the
+// same effect, but also that it has the same type requirements.
+//
+// __builtin_memmove only requires that the types are TriviallyCopyable
+// (which is interestingly different from both is_trivially_XXX_constructible
+// and is_trivially_XXX_assignable), so we use some funky types to test these
+// corner cases.
+
+// XFAIL: FROZEN-CXX03-HEADERS-FIXME
+
+#include <__string/constexpr_c_functions.h>
+#include <cassert>
+#include <cstdint>
+#include <type_traits>
+
+#include "test_macros.h"
+
+// The following types are all TriviallyCopyable, but they are not all
+// trivially_{copy,move}_{constructible,assignable}. TriviallyCopyable
+// guarantees that the type is *at least* one of the four, but no more
+// than that.
+struct CopyConstructible {
+ CopyConstructible() = default;
+ int value = 0;
+
+ CopyConstructible(const CopyConstructible&) = default;
+ CopyConstructible(CopyConstructible&&) = delete;
+ CopyConstructible& operator=(const CopyConstructible&) = delete;
+ CopyConstructible& operator=(CopyConstructible&&) = delete;
+};
+
+struct MoveConstructible {
+ MoveConstructible() = default;
+ int value = 0;
+
+ MoveConstructible(const MoveConstructible&) = delete;
+ MoveConstructible(MoveConstructible&&) = default;
+ MoveConstructible& operator=(const MoveConstructible&) = delete;
+ MoveConstructible& operator=(MoveConstructible&&) = delete;
+};
+
+struct CopyAssignable {
+ CopyAssignable() = default;
+ int value = 0;
+
+ CopyAssignable(const CopyAssignable&) = delete;
+ CopyAssignable(CopyAssignable&&) = delete;
+ CopyAssignable& operator=(const CopyAssignable&) = default;
+ CopyAssignable& operator=(CopyAssignable&&) = delete;
+};
+
+struct MoveAssignable {
+ MoveAssignable() = default;
+ int value = 0;
+
+ MoveAssignable(const MoveAssignable&) = delete;
+ MoveAssignable(MoveAssignable&&) = delete;
+ MoveAssignable& operator=(const MoveAssignable&) = delete;
+ MoveAssignable& operator=(MoveAssignable&&) = default;
+};
+
+template <class Source, class Dest>
+TEST_CONSTEXPR_CXX14 void test_user_defined_types() {
+ static_assert(std::is_trivially_copyable<Source>::value, "test the test");
+ static_assert(std::is_trivially_copyable<Dest>::value, "test the test");
+
+ // Note that we can't just initialize with an initializer list since some of the types we use here
+ // are not copy-constructible, which is required in pre-C++20 Standards for that syntax to work.
+ Source src[3];
+ src[0].value = 1;
+ src[1].value = 2;
+ src[2].value = 3;
+ Dest dst[3];
+ dst[0].value = 111;
+ dst[1].value = 111;
+ dst[2].value = 111;
+
+ Dest* result = std::__constexpr_memmove(dst, src, std::__element_count(3));
+ assert(result == dst);
+ assert(dst[0].value == 1);
+ assert(dst[1].value == 2);
+ assert(dst[2].value == 3);
+}
+
+template <class Source, class Dest>
+TEST_CONSTEXPR_CXX14 void test_builtin_types() {
+ Source src[3] = {1, 2, 3};
+ Dest dst[3] = {111, 111, 111};
+
+ Dest* result = std::__constexpr_memmove(dst, src, std::__element_count(3));
+ assert(result == dst);
+ assert(dst[0] == 1);
+ assert(dst[1] == 2);
+ assert(dst[2] == 3);
+}
+
+template <class SourcePtr, class DestPtr, class ObjectType>
+TEST_CONSTEXPR_CXX14 void test_pointer_types() {
+ ObjectType objs[3] = {1, 2, 3};
+
+ SourcePtr src[3] = {objs + 0, objs + 1, objs + 2};
+ DestPtr dst[3] = {nullptr, nullptr, nullptr};
+
+ DestPtr* result = std::__constexpr_memmove(dst, src, std::__element_count(3));
+ assert(result == dst);
+ assert(dst[0] == objs + 0);
+ assert(dst[1] == objs + 1);
+ assert(dst[2] == objs + 2);
+}
+
+TEST_CONSTEXPR_CXX14 bool test() {
+ test_user_defined_types<CopyConstructible, CopyConstructible>();
+ test_user_defined_types<MoveConstructible, MoveConstructible>();
+ test_user_defined_types<CopyAssignable, CopyAssignable>();
+ test_user_defined_types<MoveAssignable, MoveAssignable>();
+
+ test_builtin_types<char, char>();
+ test_builtin_types<short, short>();
+ test_builtin_types<int, int>();
+ test_builtin_types<long, long>();
+ test_builtin_types<long long, long long>();
+
+ // Cross-type
+ test_builtin_types<std::int16_t, std::uint16_t>();
+ test_builtin_types<std::int16_t, char16_t>();
+ test_builtin_types<std::int32_t, std::uint32_t>();
+ test_builtin_types<std::int32_t, char32_t>();
+
+ test_pointer_types<char*, char*, char>();
+ test_pointer_types<int*, int*, int>();
+ test_pointer_types<long*, long*, long>();
+ test_pointer_types<void*, void*, int>();
+ test_pointer_types<int* const, int*, int>();
+
+ return true;
+}
+
+int main(int, char**) {
+ test();
+#if TEST_STD_VER >= 14
+ static_assert(test(), "");
+#endif
+ return 0;
+}
diff --git a/libcxx/test/libcxx-03/strings/string.view/string.view.iterators/assert.iterator-indexing.pass.cpp b/libcxx/test/libcxx-03/strings/string.view/string.view.iterators/assert.iterator-indexing.pass.cpp
new file mode 100644
index 0000000000000..5043a88cbc3da
--- /dev/null
+++ b/libcxx/test/libcxx-03/strings/string.view/string.view.iterators/assert.iterator-indexing.pass.cpp
@@ -0,0 +1,158 @@
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// Make sure that std::string_view's iterators check for OOB accesses when the debug mode is enabled.
+
+// REQUIRES: has-unix-headers, libcpp-has-abi-bounded-iterators
+// UNSUPPORTED: libcpp-hardening-mode=none
+
+#include <iterator>
+#include <string_view>
+
+#include "check_assertion.h"
+
+template <typename Iter>
+void test_iterator(Iter begin, Iter end, bool reverse) {
+ ptrdiff_t distance = std::distance(begin, end);
+
+ // Dereferencing an iterator at the end.
+ {
+ TEST_LIBCPP_ASSERT_FAILURE(
+ *end,
+ reverse ? "__bounded_iter::operator--: Attempt to rewind an iterator past the start"
+ : "__bounded_iter::operator*: Attempt to dereference an iterator at the end");
+#if _LIBCPP_STD_VER >= 20
+ // In C++20 mode, std::reverse_iterator implements operator->, but not operator*, with
+ // std::prev instead of operator--. std::prev ultimately calls operator+
+ TEST_LIBCPP_ASSERT_FAILURE(
+ end.operator->(),
+ reverse ? "__bounded_iter::operator+=: Attempt to rewind an iterator past the start"
+ : "__bounded_iter::operator->: Attempt to dereference an iterator at the end");
+#else
+ TEST_LIBCPP_ASSERT_FAILURE(
+ end.operator->(),
+ reverse ? "__bounded_iter::operator--: Attempt to rewind an iterator past the start"
+ : "__bounded_iter::operator->: Attempt to dereference an iterator at the end");
+#endif
+ }
+
+ // Incrementing an iterator past the end.
+ {
+ [[maybe_unused]] const char* msg =
+ reverse ? "__bounded_iter::operator--: Attempt to rewind an iterator past the start"
+ : "__bounded_iter::operator++: Attempt to advance an iterator past the end";
+ auto it = end;
+ TEST_LIBCPP_ASSERT_FAILURE(it++, msg);
+ it = end;
+ TEST_LIBCPP_ASSERT_FAILURE(++it, msg);
+ }
+
+ // Decrementing an iterator past the start.
+ {
+ [[maybe_unused]] const char* msg =
+ reverse ? "__bounded_iter::operator++: Attempt to advance an iterator past the end"
+ : "__bounded_iter::operator--: Attempt to rewind an iterator past the start";
+ auto it = begin;
+ TEST_LIBCPP_ASSERT_FAILURE(it--, msg);
+ it = begin;
+ TEST_LIBCPP_ASSERT_FAILURE(--it, msg);
+ }
+
+ // Advancing past the end with operator+= and operator+.
+ {
+ [[maybe_unused]] const char* msg =
+ reverse ? "__bounded_iter::operator-=: Attempt to rewind an iterator past the start"
+ : "__bounded_iter::operator+=: Attempt to advance an iterator past the end";
+ auto it = end;
+ TEST_LIBCPP_ASSERT_FAILURE(it += 1, msg);
+ TEST_LIBCPP_ASSERT_FAILURE(end + 1, msg);
+ it = begin;
+ TEST_LIBCPP_ASSERT_FAILURE(it += (distance + 1), msg);
+ TEST_LIBCPP_ASSERT_FAILURE(begin + (distance + 1), msg);
+ }
+
+ // Advancing past the end with operator-= and operator-.
+ {
+ [[maybe_unused]] const char* msg =
+ reverse ? "__bounded_iter::operator+=: Attempt to rewind an iterator past the start"
+ : "__bounded_iter::operator-=: Attempt to advance an iterator past the end";
+ auto it = end;
+ TEST_LIBCPP_ASSERT_FAILURE(it -= (-1), msg);
+ TEST_LIBCPP_ASSERT_FAILURE(end - (-1), msg);
+ it = begin;
+ TEST_LIBCPP_ASSERT_FAILURE(it -= (-distance - 1), msg);
+ TEST_LIBCPP_ASSERT_FAILURE(begin - (-distance - 1), msg);
+ }
+
+ // Rewinding past the start with operator+= and operator+.
+ {
+ [[maybe_unused]] const char* msg =
+ reverse ? "__bounded_iter::operator-=: Attempt to advance an iterator past the end"
+ : "__bounded_iter::operator+=: Attempt to rewind an iterator past the start";
+ auto it = begin;
+ TEST_LIBCPP_ASSERT_FAILURE(it += (-1), msg);
+ TEST_LIBCPP_ASSERT_FAILURE(begin + (-1), msg);
+ it = end;
+ TEST_LIBCPP_ASSERT_FAILURE(it += (-distance - 1), msg);
+ TEST_LIBCPP_ASSERT_FAILURE(end + (-distance - 1), msg);
+ }
+
+ // Rewinding past the start with operator-= and operator-.
+ {
+ [[maybe_unused]] const char* msg =
+ reverse ? "__bounded_iter::operator+=: Attempt to advance an iterator past the end"
+ : "__bounded_iter::operator-=: Attempt to rewind an iterator past the start";
+ auto it = begin;
+ TEST_LIBCPP_ASSERT_FAILURE(it -= 1, msg);
+ TEST_LIBCPP_ASSERT_FAILURE(begin - 1, msg);
+ it = end;
+ TEST_LIBCPP_ASSERT_FAILURE(it -= (distance + 1), msg);
+ TEST_LIBCPP_ASSERT_FAILURE(end - (distance + 1), msg);
+ }
+
+ // Out-of-bounds operator[].
+ {
+ [[maybe_unused]] const char* end_msg =
+ reverse ? "__bounded_iter::operator--: Attempt to rewind an iterator past the start"
+ : "__bounded_iter::operator[]: Attempt to index an iterator at or past the end";
+ [[maybe_unused]] const char* past_end_msg =
+ reverse ? "__bounded_iter::operator-=: Attempt to rewind an iterator past the start"
+ : "__bounded_iter::operator[]: Attempt to index an iterator at or past the end";
+ [[maybe_unused]] const char* past_start_msg =
+ reverse ? "__bounded_iter::operator-=: Attempt to advance an iterator past the end"
+ : "__bounded_iter::operator[]: Attempt to index an iterator past the start";
+ TEST_LIBCPP_ASSERT_FAILURE(begin[distance], end_msg);
+ TEST_LIBCPP_ASSERT_FAILURE(begin[distance + 1], past_end_msg);
+ TEST_LIBCPP_ASSERT_FAILURE(begin[-1], past_start_msg);
+ TEST_LIBCPP_ASSERT_FAILURE(begin[-99], past_start_msg);
+
+ auto it = begin + 1;
+ TEST_LIBCPP_ASSERT_FAILURE(it[distance - 1], end_msg);
+ TEST_LIBCPP_ASSERT_FAILURE(it[distance], past_end_msg);
+ TEST_LIBCPP_ASSERT_FAILURE(it[-2], past_start_msg);
+ TEST_LIBCPP_ASSERT_FAILURE(it[-99], past_start_msg);
+ }
+}
+
+int main(int, char**) {
+ std::string_view const str("hello world");
+
+ // string_view::iterator
+ test_iterator(str.begin(), str.end(), /*reverse=*/false);
+
+ // string_view::const_iterator
+ test_iterator(str.cbegin(), str.cend(), /*reverse=*/false);
+
+ // string_view::reverse_iterator
+ test_iterator(str.rbegin(), str.rend(), /*reverse=*/true);
+
+ // string_view::const_reverse_iterator
+ test_iterator(str.crbegin(), str.crend(), /*reverse=*/true);
+
+ return 0;
+}
diff --git a/libcxx/test/libcxx-03/system_reserved_names.gen.py b/libcxx/test/libcxx-03/system_reserved_names.gen.py
new file mode 100644
index 0000000000000..a4f2928eda332
--- /dev/null
+++ b/libcxx/test/libcxx-03/system_reserved_names.gen.py
@@ -0,0 +1,206 @@
+# ===----------------------------------------------------------------------===##
+#
+# Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+# See https://llvm.org/LICENSE.txt for license information.
+# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+#
+# ===----------------------------------------------------------------------===##
+
+# Test that headers are not tripped up by the surrounding code defining various
+# alphabetic macros. Also ensure that we don't swallow the definition of user
+# provided macros (in other words, ensure that we push/pop correctly everywhere).
+
+# RUN: %{python} %s %{libcxx-dir}/utils
+# END.
+
+import sys
+
+sys.path.append(sys.argv[1])
+from libcxx.header_information import (
+ lit_header_restrictions,
+ lit_header_undeprecations,
+ public_headers,
+)
+
+for header in public_headers:
+ print(
+ f"""\
+//--- {header}.compile.pass.cpp
+{lit_header_restrictions.get(header, '')}
+{lit_header_undeprecations.get(header, '')}
+
+// UNSUPPORTED: FROZEN-CXX03-HEADERS-FIXME
+
+// This is required to detect the platform we're building for below.
+#include <__config>
+
+#define SYSTEM_RESERVED_NAME This name should not be used in libc++
+
+// libc++ does not use single-letter names as a matter of principle.
+// But Windows' own <wchar.h>, <math.h>, and <exception> use many of these
+// (at least C,E,F,I,M,N,P,S,X,Y,Z) as uglified function parameter names,
+// so don't define these on Windows.
+//
+#ifndef _WIN32
+#define _A SYSTEM_RESERVED_NAME
+#define _B SYSTEM_RESERVED_NAME
+#define _C SYSTEM_RESERVED_NAME
+#define _D SYSTEM_RESERVED_NAME
+#define _E SYSTEM_RESERVED_NAME
+#define _F SYSTEM_RESERVED_NAME
+#define _G SYSTEM_RESERVED_NAME
+#define _H SYSTEM_RESERVED_NAME
+#define _I SYSTEM_RESERVED_NAME
+#define _J SYSTEM_RESERVED_NAME
+#define _K SYSTEM_RESERVED_NAME
+#define _L SYSTEM_RESERVED_NAME
+#define _M SYSTEM_RESERVED_NAME
+#define _N SYSTEM_RESERVED_NAME
+#define _O SYSTEM_RESERVED_NAME
+#define _P SYSTEM_RESERVED_NAME
+#define _Q SYSTEM_RESERVED_NAME
+#define _R SYSTEM_RESERVED_NAME
+#define _S SYSTEM_RESERVED_NAME
+#define _T SYSTEM_RESERVED_NAME
+#define _U SYSTEM_RESERVED_NAME
+#define _V SYSTEM_RESERVED_NAME
+#define _W SYSTEM_RESERVED_NAME
+#define _X SYSTEM_RESERVED_NAME
+#define _Y SYSTEM_RESERVED_NAME
+#define _Z SYSTEM_RESERVED_NAME
+#endif
+
+// FreeBSD's <sys/types.h> uses _M
+//
+#ifdef __FreeBSD__
+# undef _M
+#endif
+
+// Test that libc++ doesn't use names that collide with FreeBSD system macros.
+// newlib and picolibc also define these macros
+#if !defined(__FreeBSD__) && !defined(_NEWLIB_VERSION)
+# define __null_sentinel SYSTEM_RESERVED_NAME
+# define __generic SYSTEM_RESERVED_NAME
+#endif
+
+// tchar.h defines these macros on Windows
+#ifndef _WIN32
+# define _UI SYSTEM_RESERVED_NAME
+# define _PUC SYSTEM_RESERVED_NAME
+# define _CPUC SYSTEM_RESERVED_NAME
+# define _PC SYSTEM_RESERVED_NAME
+# define _CRPC SYSTEM_RESERVED_NAME
+# define _CPC SYSTEM_RESERVED_NAME
+#endif
+
+// yvals.h on MINGW defines this macro
+#ifndef _WIN32
+# define _C2 SYSTEM_RESERVED_NAME
+#endif
+
+// Test that libc++ doesn't use names that collide with Win32 API macros.
+// Obviously we can only define these on non-Windows platforms.
+#ifndef _WIN32
+# define __allocator SYSTEM_RESERVED_NAME
+# define __bound SYSTEM_RESERVED_NAME
+# define __deallocate SYSTEM_RESERVED_NAME
+# define __deref SYSTEM_RESERVED_NAME
+# define __format_string SYSTEM_RESERVED_NAME
+# define __full SYSTEM_RESERVED_NAME
+# define __in SYSTEM_RESERVED_NAME
+# define __inout SYSTEM_RESERVED_NAME
+# define __nz SYSTEM_RESERVED_NAME
+# define __out SYSTEM_RESERVED_NAME
+# define __part SYSTEM_RESERVED_NAME
+# define __post SYSTEM_RESERVED_NAME
+# define __pre SYSTEM_RESERVED_NAME
+#endif
+
+// Newlib & picolibc use __input as a parameter name of a64l & l64a
+#ifndef _NEWLIB_VERSION
+# define __input SYSTEM_RESERVED_NAME
+#endif
+#define __output SYSTEM_RESERVED_NAME
+
+#define __acquire SYSTEM_RESERVED_NAME
+#define __release SYSTEM_RESERVED_NAME
+
+// Android and FreeBSD use this for __attribute__((__unused__))
+#if !defined(__FreeBSD__) && !defined(__ANDROID__)
+#define __unused SYSTEM_RESERVED_NAME
+#endif
+
+// These names are not reserved, so the user can macro-define them.
+// These are intended to find improperly _Uglified template parameters.
+#define A SYSTEM_RESERVED_NAME
+#define Arg SYSTEM_RESERVED_NAME
+#define Args SYSTEM_RESERVED_NAME
+#define As SYSTEM_RESERVED_NAME
+#define B SYSTEM_RESERVED_NAME
+#define Bs SYSTEM_RESERVED_NAME
+#define C SYSTEM_RESERVED_NAME
+#define Cp SYSTEM_RESERVED_NAME
+#define Cs SYSTEM_RESERVED_NAME
+// Windows setjmp.h contains a struct member named 'D' on ARM/AArch64.
+#ifndef _WIN32
+# define D SYSTEM_RESERVED_NAME
+#endif
+#define Dp SYSTEM_RESERVED_NAME
+#define Ds SYSTEM_RESERVED_NAME
+#define E SYSTEM_RESERVED_NAME
+#define Ep SYSTEM_RESERVED_NAME
+#define Es SYSTEM_RESERVED_NAME
+#define N SYSTEM_RESERVED_NAME
+#define Np SYSTEM_RESERVED_NAME
+#define Ns SYSTEM_RESERVED_NAME
+#define R SYSTEM_RESERVED_NAME
+#define Rp SYSTEM_RESERVED_NAME
+#define Rs SYSTEM_RESERVED_NAME
+#define T SYSTEM_RESERVED_NAME
+#define Tp SYSTEM_RESERVED_NAME
+#define Ts SYSTEM_RESERVED_NAME
+#define Type SYSTEM_RESERVED_NAME
+#define Types SYSTEM_RESERVED_NAME
+#define U SYSTEM_RESERVED_NAME
+#define Up SYSTEM_RESERVED_NAME
+#define Us SYSTEM_RESERVED_NAME
+#define V SYSTEM_RESERVED_NAME
+#define Vp SYSTEM_RESERVED_NAME
+#define Vs SYSTEM_RESERVED_NAME
+#define X SYSTEM_RESERVED_NAME
+#define Xp SYSTEM_RESERVED_NAME
+#define Xs SYSTEM_RESERVED_NAME
+
+// The classic Windows min/max macros
+#define min SYSTEM_RESERVED_NAME
+#define max SYSTEM_RESERVED_NAME
+
+// Test to make sure curses has no conflicting macros with the standard library
+#define move SYSTEM_RESERVED_NAME
+#define erase SYSTEM_RESERVED_NAME
+#define refresh SYSTEM_RESERVED_NAME
+
+// Dinkumware libc ctype.h uses these definitions
+#define _XA SYSTEM_RESERVED_NAME
+#define _XS SYSTEM_RESERVED_NAME
+#define _BB SYSTEM_RESERVED_NAME
+#define _CN SYSTEM_RESERVED_NAME
+#define _DI SYSTEM_RESERVED_NAME
+#define _LO SYSTEM_RESERVED_NAME
+#define _PU SYSTEM_RESERVED_NAME
+#define _SP SYSTEM_RESERVED_NAME
+#define _UP SYSTEM_RESERVED_NAME
+#define _XD SYSTEM_RESERVED_NAME
+
+#include <{header}>
+
+// Make sure we don't swallow the definition of the macros we push/pop
+#define STRINGIFY_IMPL(x) #x
+#define STRINGIFY(x) STRINGIFY_IMPL(x)
+static_assert(__builtin_strcmp(STRINGIFY(min), STRINGIFY(SYSTEM_RESERVED_NAME)) == 0, "");
+static_assert(__builtin_strcmp(STRINGIFY(max), STRINGIFY(SYSTEM_RESERVED_NAME)) == 0, "");
+static_assert(__builtin_strcmp(STRINGIFY(move), STRINGIFY(SYSTEM_RESERVED_NAME)) == 0, "");
+static_assert(__builtin_strcmp(STRINGIFY(erase), STRINGIFY(SYSTEM_RESERVED_NAME)) == 0, "");
+static_assert(__builtin_strcmp(STRINGIFY(refresh), STRINGIFY(SYSTEM_RESERVED_NAME)) == 0, "");
+"""
+ )
diff --git a/libcxx/test/libcxx-03/thread/thread.condition/thread.condition.condvar/native_handle.pass.cpp b/libcxx/test/libcxx-03/thread/thread.condition/thread.condition.condvar/native_handle.pass.cpp
new file mode 100644
index 0000000000000..13d1bfcb88126
--- /dev/null
+++ b/libcxx/test/libcxx-03/thread/thread.condition/thread.condition.condvar/native_handle.pass.cpp
@@ -0,0 +1,36 @@
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+//
+// UNSUPPORTED: no-threads, libcpp-has-thread-api-external
+
+// XFAIL: windows
+
+// <condition_variable>
+
+// class condition_variable;
+
+// typedef pthread_cond_t* native_handle_type;
+// native_handle_type native_handle();
+
+#include <cassert>
+#include <condition_variable>
+#include <pthread.h>
+#include <type_traits>
+
+#include "test_macros.h"
+
+int main(int, char**)
+{
+ static_assert((std::is_same<std::condition_variable::native_handle_type,
+ pthread_cond_t*>::value), "");
+ std::condition_variable cv;
+ std::condition_variable::native_handle_type h = cv.native_handle();
+ assert(h != nullptr);
+
+ return 0;
+}
diff --git a/libcxx/test/libcxx-03/thread/thread.mutex/thread.mutex.requirements/thread.mutex.requirements.mutex/thread.mutex.class/native_handle.pass.cpp b/libcxx/test/libcxx-03/thread/thread.mutex/thread.mutex.requirements/thread.mutex.requirements.mutex/thread.mutex.class/native_handle.pass.cpp
new file mode 100644
index 0000000000000..3de6635f13be2
--- /dev/null
+++ b/libcxx/test/libcxx-03/thread/thread.mutex/thread.mutex.requirements/thread.mutex.requirements.mutex/thread.mutex.class/native_handle.pass.cpp
@@ -0,0 +1,32 @@
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+//
+// UNSUPPORTED: no-threads, libcpp-has-thread-api-external
+
+// XFAIL: windows
+
+// <mutex>
+
+// class mutex;
+
+// typedef pthread_mutex_t* native_handle_type;
+// native_handle_type native_handle();
+
+#include <mutex>
+#include <cassert>
+
+#include "test_macros.h"
+
+int main(int, char**)
+{
+ std::mutex m;
+ pthread_mutex_t* h = m.native_handle();
+ assert(h);
+
+ return 0;
+}
diff --git a/libcxx/test/libcxx-03/thread/thread.mutex/thread.mutex.requirements/thread.mutex.requirements.mutex/thread.mutex.recursive/native_handle.pass.cpp b/libcxx/test/libcxx-03/thread/thread.mutex/thread.mutex.requirements/thread.mutex.requirements.mutex/thread.mutex.recursive/native_handle.pass.cpp
new file mode 100644
index 0000000000000..d76b3d71d36e3
--- /dev/null
+++ b/libcxx/test/libcxx-03/thread/thread.mutex/thread.mutex.requirements/thread.mutex.requirements.mutex/thread.mutex.recursive/native_handle.pass.cpp
@@ -0,0 +1,32 @@
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+//
+// UNSUPPORTED: no-threads, libcpp-has-thread-api-external
+
+// XFAIL: windows
+
+// <mutex>
+
+// class recursive_mutex;
+
+// typedef pthread_mutex_t* native_handle_type;
+// native_handle_type native_handle();
+
+#include <mutex>
+#include <cassert>
+
+#include "test_macros.h"
+
+int main(int, char**)
+{
+ std::recursive_mutex m;
+ pthread_mutex_t* h = m.native_handle();
+ assert(h);
+
+ return 0;
+}
diff --git a/libcxx/test/libcxx-03/thread/thread.mutex/thread_safety_lock_guard.pass.cpp b/libcxx/test/libcxx-03/thread/thread.mutex/thread_safety_lock_guard.pass.cpp
new file mode 100644
index 0000000000000..1c1f36459c837
--- /dev/null
+++ b/libcxx/test/libcxx-03/thread/thread.mutex/thread_safety_lock_guard.pass.cpp
@@ -0,0 +1,40 @@
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// On Windows Clang bugs out when both __declspec and __attribute__ are present,
+// the processing goes awry preventing the definition of the types.
+// XFAIL: msvc
+
+// UNSUPPORTED: no-threads
+// REQUIRES: thread-safety
+
+// <mutex>
+
+// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_ENABLE_THREAD_SAFETY_ANNOTATIONS
+
+#include <mutex>
+
+#include "test_macros.h"
+
+std::mutex m;
+int foo __attribute__((guarded_by(m)));
+
+static void scoped() {
+#if TEST_STD_VER >= 17
+ std::scoped_lock<std::mutex> lock(m);
+ foo++;
+#endif
+}
+
+int main(int, char**) {
+ scoped();
+ std::lock_guard<std::mutex> lock(m);
+ foo++;
+
+ return 0;
+}
diff --git a/libcxx/test/libcxx-03/thread/thread.mutex/thread_safety_lock_unlock.pass.cpp b/libcxx/test/libcxx-03/thread/thread.mutex/thread_safety_lock_unlock.pass.cpp
new file mode 100644
index 0000000000000..ddfe3269fdfa7
--- /dev/null
+++ b/libcxx/test/libcxx-03/thread/thread.mutex/thread_safety_lock_unlock.pass.cpp
@@ -0,0 +1,33 @@
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// On Windows Clang bugs out when both __declspec and __attribute__ are present,
+// the processing goes awry preventing the definition of the types.
+// XFAIL: msvc
+
+// UNSUPPORTED: no-threads
+// REQUIRES: thread-safety
+
+// <mutex>
+
+// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_ENABLE_THREAD_SAFETY_ANNOTATIONS
+
+#include <mutex>
+
+#include "test_macros.h"
+
+std::mutex m;
+int foo __attribute__((guarded_by(m)));
+
+int main(int, char**) {
+ m.lock();
+ foo++;
+ m.unlock();
+
+ return 0;
+}
diff --git a/libcxx/test/libcxx-03/thread/thread.mutex/thread_safety_missing_unlock.verify.cpp b/libcxx/test/libcxx-03/thread/thread.mutex/thread_safety_missing_unlock.verify.cpp
new file mode 100644
index 0000000000000..bab686e7b4ca2
--- /dev/null
+++ b/libcxx/test/libcxx-03/thread/thread.mutex/thread_safety_missing_unlock.verify.cpp
@@ -0,0 +1,26 @@
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// On Windows Clang bugs out when both __declspec and __attribute__ are present,
+// the processing goes awry preventing the definition of the types.
+// XFAIL: msvc
+
+// UNSUPPORTED: no-threads
+// REQUIRES: thread-safety
+
+// <mutex>
+
+// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_ENABLE_THREAD_SAFETY_ANNOTATIONS
+
+#include <mutex>
+
+std::mutex m;
+
+void f() {
+ m.lock();
+} // expected-error {{mutex 'm' is still held at the end of function}}
diff --git a/libcxx/test/libcxx-03/thread/thread.mutex/thread_safety_requires_capability.pass.cpp b/libcxx/test/libcxx-03/thread/thread.mutex/thread_safety_requires_capability.pass.cpp
new file mode 100644
index 0000000000000..81ce3b25a8394
--- /dev/null
+++ b/libcxx/test/libcxx-03/thread/thread.mutex/thread_safety_requires_capability.pass.cpp
@@ -0,0 +1,37 @@
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// On Windows Clang bugs out when both __declspec and __attribute__ are present,
+// the processing goes awry preventing the definition of the types.
+// XFAIL: msvc
+
+// UNSUPPORTED: no-threads
+// REQUIRES: thread-safety
+
+// <mutex>
+
+// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_ENABLE_THREAD_SAFETY_ANNOTATIONS
+
+#include <mutex>
+
+#include "test_macros.h"
+
+std::mutex m;
+int foo __attribute__((guarded_by(m)));
+
+void increment() __attribute__((requires_capability(m))) {
+ foo++;
+}
+
+int main(int, char**) {
+ m.lock();
+ increment();
+ m.unlock();
+
+ return 0;
+}
diff --git a/libcxx/test/libcxx-03/thread/thread.threads/thread.thread.class/thread.thread.member/native_handle.pass.cpp b/libcxx/test/libcxx-03/thread/thread.threads/thread.thread.class/thread.thread.member/native_handle.pass.cpp
new file mode 100644
index 0000000000000..96ec3332519bc
--- /dev/null
+++ b/libcxx/test/libcxx-03/thread/thread.threads/thread.thread.class/thread.thread.member/native_handle.pass.cpp
@@ -0,0 +1,59 @@
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+//
+// UNSUPPORTED: no-threads, libcpp-has-thread-api-external
+
+// XFAIL: windows
+
+// <thread>
+
+// class thread
+
+// native_handle_type native_handle();
+
+#include <thread>
+#include <new>
+#include <cstdlib>
+#include <cassert>
+
+#include "test_macros.h"
+
+class G
+{
+ int alive_;
+public:
+ static int n_alive;
+ static bool op_run;
+
+ G() : alive_(1) {++n_alive;}
+ G(const G& g) : alive_(g.alive_) {++n_alive;}
+ ~G() {alive_ = 0; --n_alive;}
+
+ void operator()()
+ {
+ assert(alive_ == 1);
+ assert(n_alive >= 1);
+ op_run = true;
+ }
+};
+
+int G::n_alive = 0;
+bool G::op_run = false;
+
+int main(int, char**)
+{
+ {
+ G g;
+ std::thread t0(g);
+ pthread_t pid = t0.native_handle();
+ assert(pid != 0);
+ t0.join();
+ }
+
+ return 0;
+}
diff --git a/libcxx/test/libcxx-03/thread/thread.threads/thread.thread.class/types.pass.cpp b/libcxx/test/libcxx-03/thread/thread.threads/thread.thread.class/types.pass.cpp
new file mode 100644
index 0000000000000..bb60647ef05d8
--- /dev/null
+++ b/libcxx/test/libcxx-03/thread/thread.threads/thread.thread.class/types.pass.cpp
@@ -0,0 +1,31 @@
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+//
+// UNSUPPORTED: no-threads, libcpp-has-thread-api-external
+// REQUIRES: libcpp-has-thread-api-pthread
+
+// <thread>
+
+// class thread
+// {
+// public:
+// typedef pthread_t native_handle_type;
+// ...
+// };
+
+#include <thread>
+#include <type_traits>
+
+#include "test_macros.h"
+
+int main(int, char**)
+{
+ static_assert((std::is_same<std::thread::native_handle_type, pthread_t>::value), "");
+
+ return 0;
+}
diff --git a/libcxx/test/libcxx-03/thread/thread.threads/thread.thread.this/sleep_for.pass.cpp b/libcxx/test/libcxx-03/thread/thread.threads/thread.thread.this/sleep_for.pass.cpp
new file mode 100644
index 0000000000000..e64a873fa095f
--- /dev/null
+++ b/libcxx/test/libcxx-03/thread/thread.threads/thread.thread.this/sleep_for.pass.cpp
@@ -0,0 +1,35 @@
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: no-threads
+
+// ALLOW_RETRIES: 3
+
+// <thread>
+
+// template <class Rep, class Period>
+// void sleep_for(const chrono::duration<Rep, Period>& rel_time);
+
+#include <thread>
+#include <cassert>
+#include <chrono>
+
+int main(int, char**)
+{
+ typedef std::chrono::system_clock Clock;
+ typedef Clock::time_point time_point;
+ std::chrono::milliseconds ms(500);
+ time_point t0 = Clock::now();
+ std::this_thread::sleep_for(ms);
+ time_point t1 = Clock::now();
+ // NOTE: Operating systems are (by default) best effort and therefore we may
+ // have slept longer, perhaps much longer than we requested.
+ assert(t1 - t0 >= ms);
+
+ return 0;
+}
diff --git a/libcxx/test/libcxx-03/thread/thread.threads/thread.thread.this/sleep_for.signals.pass.cpp b/libcxx/test/libcxx-03/thread/thread.threads/thread.thread.this/sleep_for.signals.pass.cpp
new file mode 100644
index 0000000000000..1dba5d8a40976
--- /dev/null
+++ b/libcxx/test/libcxx-03/thread/thread.threads/thread.thread.this/sleep_for.signals.pass.cpp
@@ -0,0 +1,67 @@
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: no-threads
+
+// This test uses the POSIX header <sys/time.h> which Windows doesn't provide
+// UNSUPPORTED: windows
+
+// ALLOW_RETRIES: 3
+
+// <thread>
+
+// template <class Rep, class Period>
+// void sleep_for(const chrono::duration<Rep, Period>& rel_time);
+
+// This test ensures that we sleep for the right amount of time even when
+// we get interrupted by a signal, as fixed in 58a0a70fb2f1.
+
+#include <thread>
+#include <cassert>
+#include <chrono>
+#include <cstring> // for std::memset
+
+#include <signal.h>
+#include <sys/time.h>
+
+#include "test_macros.h"
+
+void sig_action(int) {}
+
+int main(int, char**)
+{
+ int ec;
+ struct sigaction action;
+ action.sa_handler = &sig_action;
+ sigemptyset(&action.sa_mask);
+ action.sa_flags = 0;
+
+ ec = sigaction(SIGALRM, &action, nullptr);
+ assert(!ec);
+
+ struct itimerval it;
+ std::memset(&it, 0, sizeof(itimerval));
+ it.it_value.tv_sec = 0;
+ it.it_value.tv_usec = 250000;
+ // This will result in a SIGALRM getting fired resulting in the nanosleep
+ // inside sleep_for getting EINTR.
+ ec = setitimer(ITIMER_REAL, &it, nullptr);
+ assert(!ec);
+
+ typedef std::chrono::system_clock Clock;
+ typedef Clock::time_point time_point;
+ std::chrono::milliseconds ms(500);
+ time_point t0 = Clock::now();
+ std::this_thread::sleep_for(ms);
+ time_point t1 = Clock::now();
+ // NOTE: Operating systems are (by default) best effort and therefore we may
+ // have slept longer, perhaps much longer than we requested.
+ assert(t1 - t0 >= ms);
+
+ return 0;
+}
diff --git a/libcxx/test/libcxx-03/transitive_includes.gen.py b/libcxx/test/libcxx-03/transitive_includes.gen.py
new file mode 100644
index 0000000000000..6f99240436632
--- /dev/null
+++ b/libcxx/test/libcxx-03/transitive_includes.gen.py
@@ -0,0 +1,102 @@
+# ===----------------------------------------------------------------------===##
+#
+# Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+# See https://llvm.org/LICENSE.txt for license information.
+# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+#
+# ===----------------------------------------------------------------------===##
+
+# Test that we don't remove transitive includes of public C++ headers in the library accidentally.
+# When we remove a transitive public include, clients tend to break because they don't always
+# properly include what they use. Note that we don't check which system (C) headers are
+# included transitively, because that is too unstable across platforms, and hence difficult
+# to test for.
+#
+# This is not meant to block libc++ from removing unused transitive includes
+# forever, however we do try to group removals for a couple of releases
+# to avoid breaking users at every release.
+
+# RUN: %{python} %s %{libcxx-dir}/utils
+
+# block Lit from interpreting a RUN/XFAIL/etc inside the generation script
+# END.
+
+import sys
+sys.path.append(sys.argv[1])
+from libcxx.header_information import lit_header_restrictions, public_headers
+
+import re
+
+# To re-generate the list of expected headers, temporarily set this to True, and run this test.
+# Note that this needs to be done for all supported language versions of libc++:
+# for std in c++03 c++11 c++14 c++17 c++20 c++23 c++26; do <build>/bin/llvm-lit --param std=$std libcxx/test/libcxx/transitive_includes.gen.py; done
+regenerate_expected_results = False
+
+if regenerate_expected_results:
+ print(
+ f"""\
+//--- generate-transitive-includes.sh.cpp
+// RUN: mkdir %t
+"""
+ )
+
+ all_traces = []
+ for header in sorted(public_headers):
+ if header.is_C_compatibility() or header.is_internal():
+ continue
+
+ normalized_header = re.sub("/", "_", str(header))
+ print(
+ f"""\
+// RUN: echo "#include <{header}>" | %{{cxx}} -xc++ - %{{flags}} %{{compile_flags}} --trace-includes -fshow-skipped-includes --preprocess > /dev/null 2> %t/trace-includes.{normalized_header}.txt
+"""
+ )
+ all_traces.append(f"%t/trace-includes.{normalized_header}.txt")
+
+ print(
+ f"""\
+// RUN: %{{python}} %{{libcxx-dir}}/test/libcxx/transitive_includes/to_csv.py {' '.join(all_traces)} > %{{libcxx-dir}}/test/libcxx/transitive_includes/%{{cxx_std}}.csv
+"""
+ )
+
+else:
+ for header in public_headers:
+ if header.is_C_compatibility() or header.is_internal():
+ continue
+
+ # Escape slashes for the awk command below
+ escaped_header = str(header).replace("/", "\\/")
+
+ print(
+ f"""\
+//--- {header}.sh.cpp
+{lit_header_restrictions.get(header, '')}
+
+// TODO: Fix this test to make it work with localization or wide characters disabled
+// UNSUPPORTED: no-localization, no-wide-characters, no-threads, no-filesystem, libcpp-has-no-experimental-tzdb
+
+// When built with modules, this test doesn't work because --trace-includes doesn't
+// report the stack of includes correctly.
+// UNSUPPORTED: clang-modules-build
+
+// This test uses --trace-includes, which is not supported by GCC.
+// UNSUPPORTED: gcc
+
+// This test is not supported when we remove the transitive includes provided for backwards
+// compatibility. When we bulk-remove them, we'll adjust the includes that are expected by
+// this test instead.
+// UNSUPPORTED: transitive-includes-disabled
+
+// TODO: Figure out why <stdatomic.h> doesn't work on FreeBSD
+// UNSUPPORTED: LIBCXX-FREEBSD-FIXME
+
+// UNSUPPORTED: FROZEN-CXX03-HEADERS-FIXME
+
+// RUN: mkdir %t
+// RUN: %{{cxx}} %s %{{flags}} %{{compile_flags}} --trace-includes -fshow-skipped-includes --preprocess > /dev/null 2> %t/trace-includes.txt
+// RUN: %{{python}} %{{libcxx-dir}}/test/libcxx/transitive_includes/to_csv.py %t/trace-includes.txt > %t/actual_transitive_includes.csv
+// RUN: cat %{{libcxx-dir}}/test/libcxx/transitive_includes/%{{cxx_std}}.csv | awk '/^{escaped_header} / {{ print }}' > %t/expected_transitive_includes.csv
+// RUN: diff -w %t/expected_transitive_includes.csv %t/actual_transitive_includes.csv
+#include <{header}>
+"""
+ )
diff --git a/libcxx/test/libcxx-03/transitive_includes/cxx03.csv b/libcxx/test/libcxx-03/transitive_includes/cxx03.csv
new file mode 100644
index 0000000000000..c0031543e47bc
--- /dev/null
+++ b/libcxx/test/libcxx-03/transitive_includes/cxx03.csv
@@ -0,0 +1,2568 @@
+algorithm atomic
+algorithm bit
+algorithm cctype
+algorithm climits
+algorithm cmath
+algorithm compare
+algorithm concepts
+algorithm cstddef
+algorithm cstdint
+algorithm cstdio
+algorithm cstdlib
+algorithm cstring
+algorithm ctime
+algorithm cwchar
+algorithm cwctype
+algorithm exception
+algorithm initializer_list
+algorithm iosfwd
+algorithm iterator
+algorithm limits
+algorithm memory
+algorithm new
+algorithm optional
+algorithm ratio
+algorithm stdexcept
+algorithm tuple
+algorithm type_traits
+algorithm typeinfo
+algorithm utility
+algorithm variant
+algorithm version
+any algorithm
+any array
+any atomic
+any bit
+any cctype
+any cerrno
+any chrono
+any climits
+any clocale
+any cmath
+any compare
+any concepts
+any cstdarg
+any cstddef
+any cstdint
+any cstdio
+any cstdlib
+any cstring
+any ctime
+any cwchar
+any cwctype
+any exception
+any forward_list
+any functional
+any initializer_list
+any ios
+any iosfwd
+any iterator
+any limits
+any locale
+any memory
+any mutex
+any new
+any optional
+any ratio
+any stdexcept
+any streambuf
+any string
+any string_view
+any system_error
+any tuple
+any type_traits
+any typeinfo
+any unordered_map
+any utility
+any variant
+any vector
+any version
+array algorithm
+array atomic
+array bit
+array cctype
+array climits
+array cmath
+array compare
+array concepts
+array cstddef
+array cstdint
+array cstdio
+array cstdlib
+array cstring
+array ctime
+array cwchar
+array cwctype
+array exception
+array initializer_list
+array iosfwd
+array iterator
+array limits
+array memory
+array new
+array optional
+array ratio
+array stdexcept
+array tuple
+array type_traits
+array typeinfo
+array utility
+array variant
+array version
+atomic climits
+atomic cmath
+atomic compare
+atomic cstddef
+atomic cstdint
+atomic cstdlib
+atomic cstring
+atomic ctime
+atomic limits
+atomic ratio
+atomic type_traits
+atomic version
+barrier atomic
+barrier climits
+barrier cmath
+barrier compare
+barrier concepts
+barrier cstddef
+barrier cstdint
+barrier cstdlib
+barrier cstring
+barrier ctime
+barrier exception
+barrier initializer_list
+barrier iosfwd
+barrier iterator
+barrier limits
+barrier memory
+barrier new
+barrier ratio
+barrier stdexcept
+barrier tuple
+barrier type_traits
+barrier typeinfo
+barrier utility
+barrier variant
+barrier version
+bit cstdint
+bit cstdlib
+bit iosfwd
+bit limits
+bit type_traits
+bit version
+bitset algorithm
+bitset atomic
+bitset bit
+bitset cctype
+bitset climits
+bitset cmath
+bitset compare
+bitset concepts
+bitset cstddef
+bitset cstdint
+bitset cstdio
+bitset cstdlib
+bitset cstring
+bitset ctime
+bitset cwchar
+bitset cwctype
+bitset exception
+bitset initializer_list
+bitset iosfwd
+bitset iterator
+bitset limits
+bitset memory
+bitset new
+bitset optional
+bitset ratio
+bitset stdexcept
+bitset string
+bitset string_view
+bitset tuple
+bitset type_traits
+bitset typeinfo
+bitset utility
+bitset variant
+bitset version
+ccomplex algorithm
+ccomplex array
+ccomplex atomic
+ccomplex bit
+ccomplex bitset
+ccomplex cctype
+ccomplex cerrno
+ccomplex climits
+ccomplex clocale
+ccomplex cmath
+ccomplex compare
+ccomplex complex
+ccomplex concepts
+ccomplex cstdarg
+ccomplex cstddef
+ccomplex cstdint
+ccomplex cstdio
+ccomplex cstdlib
+ccomplex cstring
+ccomplex ctime
+ccomplex cwchar
+ccomplex cwctype
+ccomplex deque
+ccomplex exception
+ccomplex format
+ccomplex functional
+ccomplex initializer_list
+ccomplex ios
+ccomplex iosfwd
+ccomplex istream
+ccomplex iterator
+ccomplex limits
+ccomplex locale
+ccomplex memory
+ccomplex mutex
+ccomplex new
+ccomplex optional
+ccomplex ostream
+ccomplex print
+ccomplex queue
+ccomplex ratio
+ccomplex sstream
+ccomplex stack
+ccomplex stdexcept
+ccomplex streambuf
+ccomplex string
+ccomplex string_view
+ccomplex system_error
+ccomplex tuple
+ccomplex type_traits
+ccomplex typeinfo
+ccomplex unordered_map
+ccomplex utility
+ccomplex variant
+ccomplex vector
+ccomplex version
+charconv cmath
+charconv concepts
+charconv cstddef
+charconv cstdint
+charconv cstdlib
+charconv cstring
+charconv iosfwd
+charconv limits
+charconv new
+charconv type_traits
+charconv version
+chrono algorithm
+chrono array
+chrono atomic
+chrono bit
+chrono cctype
+chrono cerrno
+chrono climits
+chrono clocale
+chrono cmath
+chrono compare
+chrono concepts
+chrono cstdarg
+chrono cstddef
+chrono cstdint
+chrono cstdio
+chrono cstdlib
+chrono cstring
+chrono ctime
+chrono cwchar
+chrono cwctype
+chrono exception
+chrono forward_list
+chrono functional
+chrono initializer_list
+chrono ios
+chrono iosfwd
+chrono iterator
+chrono limits
+chrono locale
+chrono memory
+chrono mutex
+chrono new
+chrono optional
+chrono ratio
+chrono stdexcept
+chrono streambuf
+chrono string
+chrono string_view
+chrono system_error
+chrono tuple
+chrono type_traits
+chrono typeinfo
+chrono unordered_map
+chrono utility
+chrono variant
+chrono vector
+chrono version
+cinttypes cstdint
+cmath cstdint
+cmath limits
+cmath type_traits
+cmath version
+codecvt algorithm
+codecvt atomic
+codecvt bit
+codecvt cctype
+codecvt cerrno
+codecvt climits
+codecvt clocale
+codecvt cmath
+codecvt compare
+codecvt concepts
+codecvt cstddef
+codecvt cstdint
+codecvt cstdio
+codecvt cstdlib
+codecvt cstring
+codecvt ctime
+codecvt cwchar
+codecvt cwctype
+codecvt exception
+codecvt initializer_list
+codecvt iosfwd
+codecvt iterator
+codecvt limits
+codecvt memory
+codecvt mutex
+codecvt new
+codecvt optional
+codecvt ratio
+codecvt stdexcept
+codecvt string
+codecvt string_view
+codecvt system_error
+codecvt tuple
+codecvt type_traits
+codecvt typeinfo
+codecvt utility
+codecvt variant
+codecvt version
+compare cmath
+compare cstddef
+compare cstdint
+compare limits
+compare type_traits
+compare version
+complex algorithm
+complex array
+complex atomic
+complex bit
+complex bitset
+complex cctype
+complex cerrno
+complex climits
+complex clocale
+complex cmath
+complex compare
+complex concepts
+complex cstdarg
+complex cstddef
+complex cstdint
+complex cstdio
+complex cstdlib
+complex cstring
+complex ctime
+complex cwchar
+complex cwctype
+complex deque
+complex exception
+complex format
+complex functional
+complex initializer_list
+complex ios
+complex iosfwd
+complex istream
+complex iterator
+complex limits
+complex locale
+complex memory
+complex mutex
+complex new
+complex optional
+complex ostream
+complex print
+complex queue
+complex ratio
+complex sstream
+complex stack
+complex stdexcept
+complex streambuf
+complex string
+complex string_view
+complex system_error
+complex tuple
+complex type_traits
+complex typeinfo
+complex unordered_map
+complex utility
+complex variant
+complex vector
+complex version
+concepts cstddef
+concepts cstdint
+concepts type_traits
+concepts version
+condition_variable algorithm
+condition_variable atomic
+condition_variable bit
+condition_variable cctype
+condition_variable cerrno
+condition_variable climits
+condition_variable cmath
+condition_variable compare
+condition_variable concepts
+condition_variable cstddef
+condition_variable cstdint
+condition_variable cstdio
+condition_variable cstdlib
+condition_variable cstring
+condition_variable ctime
+condition_variable cwchar
+condition_variable cwctype
+condition_variable exception
+condition_variable initializer_list
+condition_variable iosfwd
+condition_variable iterator
+condition_variable limits
+condition_variable memory
+condition_variable new
+condition_variable optional
+condition_variable ratio
+condition_variable stdexcept
+condition_variable string
+condition_variable string_view
+condition_variable system_error
+condition_variable tuple
+condition_variable type_traits
+condition_variable typeinfo
+condition_variable utility
+condition_variable variant
+condition_variable version
+coroutine cmath
+coroutine compare
+coroutine cstddef
+coroutine cstdint
+coroutine iosfwd
+coroutine limits
+coroutine type_traits
+coroutine version
+cstddef version
+ctgmath algorithm
+ctgmath array
+ctgmath atomic
+ctgmath bit
+ctgmath bitset
+ctgmath cctype
+ctgmath cerrno
+ctgmath climits
+ctgmath clocale
+ctgmath cmath
+ctgmath compare
+ctgmath complex
+ctgmath concepts
+ctgmath cstdarg
+ctgmath cstddef
+ctgmath cstdint
+ctgmath cstdio
+ctgmath cstdlib
+ctgmath cstring
+ctgmath ctime
+ctgmath cwchar
+ctgmath cwctype
+ctgmath deque
+ctgmath exception
+ctgmath format
+ctgmath functional
+ctgmath initializer_list
+ctgmath ios
+ctgmath iosfwd
+ctgmath istream
+ctgmath iterator
+ctgmath limits
+ctgmath locale
+ctgmath memory
+ctgmath mutex
+ctgmath new
+ctgmath optional
+ctgmath ostream
+ctgmath print
+ctgmath queue
+ctgmath ratio
+ctgmath sstream
+ctgmath stack
+ctgmath stdexcept
+ctgmath streambuf
+ctgmath string
+ctgmath string_view
+ctgmath system_error
+ctgmath tuple
+ctgmath type_traits
+ctgmath typeinfo
+ctgmath unordered_map
+ctgmath utility
+ctgmath variant
+ctgmath vector
+ctgmath version
+cwchar cctype
+cwchar cstddef
+cwchar cwctype
+cwchar version
+cwctype cctype
+deque algorithm
+deque array
+deque atomic
+deque bit
+deque cctype
+deque cerrno
+deque climits
+deque clocale
+deque cmath
+deque compare
+deque concepts
+deque cstdarg
+deque cstddef
+deque cstdint
+deque cstdio
+deque cstdlib
+deque cstring
+deque ctime
+deque cwchar
+deque cwctype
+deque exception
+deque functional
+deque initializer_list
+deque ios
+deque iosfwd
+deque iterator
+deque limits
+deque locale
+deque memory
+deque mutex
+deque new
+deque optional
+deque ratio
+deque stdexcept
+deque streambuf
+deque string
+deque string_view
+deque system_error
+deque tuple
+deque type_traits
+deque typeinfo
+deque unordered_map
+deque utility
+deque variant
+deque vector
+deque version
+exception cstddef
+exception cstdint
+exception cstdlib
+exception new
+exception type_traits
+exception typeinfo
+exception version
+execution cstddef
+execution version
+expected version
+experimental/iterator algorithm
+experimental/iterator atomic
+experimental/iterator bit
+experimental/iterator bitset
+experimental/iterator cctype
+experimental/iterator cerrno
+experimental/iterator climits
+experimental/iterator clocale
+experimental/iterator cmath
+experimental/iterator compare
+experimental/iterator concepts
+experimental/iterator cstdarg
+experimental/iterator cstddef
+experimental/iterator cstdint
+experimental/iterator cstdio
+experimental/iterator cstdlib
+experimental/iterator cstring
+experimental/iterator ctime
+experimental/iterator cwchar
+experimental/iterator cwctype
+experimental/iterator exception
+experimental/iterator initializer_list
+experimental/iterator ios
+experimental/iterator iosfwd
+experimental/iterator iterator
+experimental/iterator limits
+experimental/iterator locale
+experimental/iterator memory
+experimental/iterator mutex
+experimental/iterator new
+experimental/iterator optional
+experimental/iterator ratio
+experimental/iterator stdexcept
+experimental/iterator streambuf
+experimental/iterator string
+experimental/iterator string_view
+experimental/iterator system_error
+experimental/iterator tuple
+experimental/iterator type_traits
+experimental/iterator typeinfo
+experimental/iterator utility
+experimental/iterator variant
+experimental/iterator version
+experimental/memory cstddef
+experimental/memory cstdint
+experimental/memory cstring
+experimental/memory limits
+experimental/memory type_traits
+experimental/memory version
+experimental/propagate_const cstddef
+experimental/propagate_const cstdint
+experimental/propagate_const type_traits
+experimental/propagate_const version
+experimental/simd cstddef
+experimental/simd cstdint
+experimental/simd limits
+experimental/simd type_traits
+experimental/simd version
+experimental/utility cmath
+experimental/utility compare
+experimental/utility cstddef
+experimental/utility cstdint
+experimental/utility cstdlib
+experimental/utility initializer_list
+experimental/utility iosfwd
+experimental/utility limits
+experimental/utility type_traits
+experimental/utility utility
+experimental/utility version
+filesystem algorithm
+filesystem atomic
+filesystem bit
+filesystem cctype
+filesystem cerrno
+filesystem climits
+filesystem cmath
+filesystem compare
+filesystem concepts
+filesystem cstddef
+filesystem cstdint
+filesystem cstdio
+filesystem cstdlib
+filesystem cstring
+filesystem ctime
+filesystem cwchar
+filesystem cwctype
+filesystem exception
+filesystem initializer_list
+filesystem iosfwd
+filesystem iterator
+filesystem limits
+filesystem memory
+filesystem new
+filesystem optional
+filesystem ratio
+filesystem stdexcept
+filesystem string
+filesystem string_view
+filesystem system_error
+filesystem tuple
+filesystem type_traits
+filesystem typeinfo
+filesystem utility
+filesystem variant
+filesystem version
+flat_map cmath
+flat_map compare
+flat_map cstddef
+flat_map cstdint
+flat_map initializer_list
+flat_map limits
+flat_map type_traits
+flat_map version
+flat_set cmath
+flat_set compare
+flat_set cstddef
+flat_set cstdint
+flat_set initializer_list
+flat_set limits
+flat_set type_traits
+flat_set version
+format algorithm
+format array
+format atomic
+format bit
+format cctype
+format cerrno
+format climits
+format clocale
+format cmath
+format compare
+format concepts
+format cstdarg
+format cstddef
+format cstdint
+format cstdio
+format cstdlib
+format cstring
+format ctime
+format cwchar
+format cwctype
+format deque
+format exception
+format functional
+format initializer_list
+format ios
+format iosfwd
+format iterator
+format limits
+format locale
+format memory
+format mutex
+format new
+format optional
+format queue
+format ratio
+format stack
+format stdexcept
+format streambuf
+format string
+format string_view
+format system_error
+format tuple
+format type_traits
+format typeinfo
+format unordered_map
+format utility
+format variant
+format vector
+format version
+forward_list algorithm
+forward_list array
+forward_list atomic
+forward_list bit
+forward_list cctype
+forward_list cerrno
+forward_list climits
+forward_list clocale
+forward_list cmath
+forward_list compare
+forward_list concepts
+forward_list cstdarg
+forward_list cstddef
+forward_list cstdint
+forward_list cstdio
+forward_list cstdlib
+forward_list cstring
+forward_list ctime
+forward_list cwchar
+forward_list cwctype
+forward_list exception
+forward_list functional
+forward_list initializer_list
+forward_list ios
+forward_list iosfwd
+forward_list iterator
+forward_list limits
+forward_list locale
+forward_list memory
+forward_list mutex
+forward_list new
+forward_list optional
+forward_list ratio
+forward_list stdexcept
+forward_list streambuf
+forward_list string
+forward_list string_view
+forward_list system_error
+forward_list tuple
+forward_list type_traits
+forward_list typeinfo
+forward_list unordered_map
+forward_list utility
+forward_list variant
+forward_list vector
+forward_list version
+fstream algorithm
+fstream array
+fstream atomic
+fstream bit
+fstream bitset
+fstream cctype
+fstream cerrno
+fstream climits
+fstream clocale
+fstream cmath
+fstream compare
+fstream concepts
+fstream cstdarg
+fstream cstddef
+fstream cstdint
+fstream cstdio
+fstream cstdlib
+fstream cstring
+fstream ctime
+fstream cwchar
+fstream cwctype
+fstream deque
+fstream exception
+fstream filesystem
+fstream format
+fstream functional
+fstream initializer_list
+fstream iomanip
+fstream ios
+fstream iosfwd
+fstream istream
+fstream iterator
+fstream limits
+fstream locale
+fstream memory
+fstream mutex
+fstream new
+fstream optional
+fstream ostream
+fstream print
+fstream queue
+fstream ratio
+fstream stack
+fstream stdexcept
+fstream streambuf
+fstream string
+fstream string_view
+fstream system_error
+fstream tuple
+fstream type_traits
+fstream typeinfo
+fstream unordered_map
+fstream utility
+fstream variant
+fstream vector
+fstream version
+functional algorithm
+functional array
+functional atomic
+functional bit
+functional cctype
+functional cerrno
+functional climits
+functional clocale
+functional cmath
+functional compare
+functional concepts
+functional cstdarg
+functional cstddef
+functional cstdint
+functional cstdio
+functional cstdlib
+functional cstring
+functional ctime
+functional cwchar
+functional cwctype
+functional exception
+functional initializer_list
+functional ios
+functional iosfwd
+functional iterator
+functional limits
+functional locale
+functional memory
+functional mutex
+functional new
+functional optional
+functional ratio
+functional stdexcept
+functional streambuf
+functional string
+functional string_view
+functional system_error
+functional tuple
+functional type_traits
+functional typeinfo
+functional unordered_map
+functional utility
+functional variant
+functional vector
+functional version
+future algorithm
+future array
+future atomic
+future bit
+future bitset
+future cctype
+future cerrno
+future chrono
+future climits
+future clocale
+future cmath
+future compare
+future concepts
+future cstdarg
+future cstddef
+future cstdint
+future cstdio
+future cstdlib
+future cstring
+future ctime
+future cwchar
+future cwctype
+future deque
+future exception
+future format
+future forward_list
+future functional
+future initializer_list
+future ios
+future iosfwd
+future istream
+future iterator
+future limits
+future locale
+future memory
+future mutex
+future new
+future optional
+future ostream
+future print
+future queue
+future ratio
+future sstream
+future stack
+future stdexcept
+future streambuf
+future string
+future string_view
+future system_error
+future thread
+future tuple
+future type_traits
+future typeinfo
+future unordered_map
+future utility
+future variant
+future vector
+future version
+initializer_list cstddef
+initializer_list version
+iomanip algorithm
+iomanip array
+iomanip atomic
+iomanip bit
+iomanip bitset
+iomanip cctype
+iomanip cerrno
+iomanip climits
+iomanip clocale
+iomanip cmath
+iomanip compare
+iomanip concepts
+iomanip cstdarg
+iomanip cstddef
+iomanip cstdint
+iomanip cstdio
+iomanip cstdlib
+iomanip cstring
+iomanip ctime
+iomanip cwchar
+iomanip cwctype
+iomanip deque
+iomanip exception
+iomanip format
+iomanip functional
+iomanip initializer_list
+iomanip ios
+iomanip iosfwd
+iomanip istream
+iomanip iterator
+iomanip limits
+iomanip locale
+iomanip memory
+iomanip mutex
+iomanip new
+iomanip optional
+iomanip ostream
+iomanip print
+iomanip queue
+iomanip ratio
+iomanip stack
+iomanip stdexcept
+iomanip streambuf
+iomanip string
+iomanip string_view
+iomanip system_error
+iomanip tuple
+iomanip type_traits
+iomanip typeinfo
+iomanip unordered_map
+iomanip utility
+iomanip variant
+iomanip vector
+iomanip version
+ios algorithm
+ios atomic
+ios bit
+ios cctype
+ios cerrno
+ios climits
+ios clocale
+ios cmath
+ios compare
+ios concepts
+ios cstddef
+ios cstdint
+ios cstdio
+ios cstdlib
+ios cstring
+ios ctime
+ios cwchar
+ios cwctype
+ios exception
+ios initializer_list
+ios iosfwd
+ios iterator
+ios limits
+ios memory
+ios mutex
+ios new
+ios optional
+ios ratio
+ios stdexcept
+ios string
+ios string_view
+ios system_error
+ios tuple
+ios type_traits
+ios typeinfo
+ios utility
+ios variant
+ios version
+iosfwd version
+iostream algorithm
+iostream array
+iostream atomic
+iostream bit
+iostream bitset
+iostream cctype
+iostream cerrno
+iostream climits
+iostream clocale
+iostream cmath
+iostream compare
+iostream concepts
+iostream cstdarg
+iostream cstddef
+iostream cstdint
+iostream cstdio
+iostream cstdlib
+iostream cstring
+iostream ctime
+iostream cwchar
+iostream cwctype
+iostream deque
+iostream exception
+iostream format
+iostream functional
+iostream initializer_list
+iostream ios
+iostream iosfwd
+iostream istream
+iostream iterator
+iostream limits
+iostream locale
+iostream memory
+iostream mutex
+iostream new
+iostream optional
+iostream ostream
+iostream print
+iostream queue
+iostream ratio
+iostream stack
+iostream stdexcept
+iostream streambuf
+iostream string
+iostream string_view
+iostream system_error
+iostream tuple
+iostream type_traits
+iostream typeinfo
+iostream unordered_map
+iostream utility
+iostream variant
+iostream vector
+iostream version
+istream algorithm
+istream array
+istream atomic
+istream bit
+istream bitset
+istream cctype
+istream cerrno
+istream climits
+istream clocale
+istream cmath
+istream compare
+istream concepts
+istream cstdarg
+istream cstddef
+istream cstdint
+istream cstdio
+istream cstdlib
+istream cstring
+istream ctime
+istream cwchar
+istream cwctype
+istream deque
+istream exception
+istream format
+istream functional
+istream initializer_list
+istream ios
+istream iosfwd
+istream iterator
+istream limits
+istream locale
+istream memory
+istream mutex
+istream new
+istream optional
+istream ostream
+istream print
+istream queue
+istream ratio
+istream stack
+istream stdexcept
+istream streambuf
+istream string
+istream string_view
+istream system_error
+istream tuple
+istream type_traits
+istream typeinfo
+istream unordered_map
+istream utility
+istream variant
+istream vector
+istream version
+iterator cctype
+iterator cmath
+iterator compare
+iterator concepts
+iterator cstddef
+iterator cstdint
+iterator cstdio
+iterator cstdlib
+iterator cstring
+iterator cwchar
+iterator cwctype
+iterator exception
+iterator initializer_list
+iterator iosfwd
+iterator limits
+iterator new
+iterator tuple
+iterator type_traits
+iterator typeinfo
+iterator utility
+iterator variant
+iterator version
+latch atomic
+latch climits
+latch cmath
+latch compare
+latch cstddef
+latch cstdint
+latch cstdlib
+latch cstring
+latch ctime
+latch limits
+latch ratio
+latch type_traits
+latch version
+limits cstdint
+limits type_traits
+limits version
+list algorithm
+list array
+list atomic
+list bit
+list cctype
+list cerrno
+list climits
+list clocale
+list cmath
+list compare
+list concepts
+list cstdarg
+list cstddef
+list cstdint
+list cstdio
+list cstdlib
+list cstring
+list ctime
+list cwchar
+list cwctype
+list exception
+list functional
+list initializer_list
+list ios
+list iosfwd
+list iterator
+list limits
+list locale
+list memory
+list mutex
+list new
+list optional
+list ratio
+list stdexcept
+list streambuf
+list string
+list string_view
+list system_error
+list tuple
+list type_traits
+list typeinfo
+list unordered_map
+list utility
+list variant
+list vector
+list version
+locale algorithm
+locale atomic
+locale bit
+locale cctype
+locale cerrno
+locale climits
+locale clocale
+locale cmath
+locale compare
+locale concepts
+locale cstdarg
+locale cstddef
+locale cstdint
+locale cstdio
+locale cstdlib
+locale cstring
+locale ctime
+locale cwchar
+locale cwctype
+locale exception
+locale initializer_list
+locale ios
+locale iosfwd
+locale iterator
+locale limits
+locale memory
+locale mutex
+locale new
+locale optional
+locale ratio
+locale stdexcept
+locale streambuf
+locale string
+locale string_view
+locale system_error
+locale tuple
+locale type_traits
+locale typeinfo
+locale utility
+locale variant
+locale version
+map algorithm
+map array
+map atomic
+map bit
+map cctype
+map cerrno
+map climits
+map clocale
+map cmath
+map compare
+map concepts
+map cstdarg
+map cstddef
+map cstdint
+map cstdio
+map cstdlib
+map cstring
+map ctime
+map cwchar
+map cwctype
+map exception
+map functional
+map initializer_list
+map ios
+map iosfwd
+map iterator
+map limits
+map locale
+map memory
+map mutex
+map new
+map optional
+map ratio
+map stdexcept
+map streambuf
+map string
+map string_view
+map system_error
+map tuple
+map type_traits
+map typeinfo
+map unordered_map
+map utility
+map variant
+map vector
+map version
+mdspan version
+memory atomic
+memory cctype
+memory climits
+memory cmath
+memory compare
+memory concepts
+memory cstddef
+memory cstdint
+memory cstdio
+memory cstdlib
+memory cstring
+memory ctime
+memory cwchar
+memory cwctype
+memory exception
+memory initializer_list
+memory iosfwd
+memory iterator
+memory limits
+memory new
+memory ratio
+memory stdexcept
+memory tuple
+memory type_traits
+memory typeinfo
+memory utility
+memory variant
+memory version
+memory_resource cstddef
+memory_resource cstdint
+memory_resource cstdlib
+memory_resource exception
+memory_resource iosfwd
+memory_resource new
+memory_resource stdexcept
+memory_resource type_traits
+memory_resource typeinfo
+memory_resource version
+mutex algorithm
+mutex atomic
+mutex bit
+mutex cctype
+mutex cerrno
+mutex climits
+mutex cmath
+mutex compare
+mutex concepts
+mutex cstddef
+mutex cstdint
+mutex cstdio
+mutex cstdlib
+mutex cstring
+mutex ctime
+mutex cwchar
+mutex cwctype
+mutex exception
+mutex initializer_list
+mutex iosfwd
+mutex iterator
+mutex limits
+mutex memory
+mutex new
+mutex optional
+mutex ratio
+mutex stdexcept
+mutex string
+mutex string_view
+mutex system_error
+mutex tuple
+mutex type_traits
+mutex typeinfo
+mutex utility
+mutex variant
+mutex version
+new cstddef
+new cstdint
+new cstdlib
+new type_traits
+new version
+numbers concepts
+numbers cstddef
+numbers cstdint
+numbers type_traits
+numbers version
+numeric algorithm
+numeric array
+numeric atomic
+numeric bit
+numeric cctype
+numeric cerrno
+numeric climits
+numeric clocale
+numeric cmath
+numeric compare
+numeric concepts
+numeric cstdarg
+numeric cstddef
+numeric cstdint
+numeric cstdio
+numeric cstdlib
+numeric cstring
+numeric ctime
+numeric cwchar
+numeric cwctype
+numeric exception
+numeric execution
+numeric functional
+numeric initializer_list
+numeric ios
+numeric iosfwd
+numeric iterator
+numeric limits
+numeric locale
+numeric memory
+numeric mutex
+numeric new
+numeric optional
+numeric ratio
+numeric stdexcept
+numeric streambuf
+numeric string
+numeric string_view
+numeric system_error
+numeric tuple
+numeric type_traits
+numeric typeinfo
+numeric unordered_map
+numeric utility
+numeric variant
+numeric vector
+numeric version
+optional atomic
+optional cctype
+optional climits
+optional cmath
+optional compare
+optional concepts
+optional cstddef
+optional cstdint
+optional cstdio
+optional cstdlib
+optional cstring
+optional ctime
+optional cwchar
+optional cwctype
+optional exception
+optional initializer_list
+optional iosfwd
+optional iterator
+optional limits
+optional memory
+optional new
+optional ratio
+optional stdexcept
+optional tuple
+optional type_traits
+optional typeinfo
+optional utility
+optional variant
+optional version
+ostream algorithm
+ostream array
+ostream atomic
+ostream bit
+ostream bitset
+ostream cctype
+ostream cerrno
+ostream climits
+ostream clocale
+ostream cmath
+ostream compare
+ostream concepts
+ostream cstdarg
+ostream cstddef
+ostream cstdint
+ostream cstdio
+ostream cstdlib
+ostream cstring
+ostream ctime
+ostream cwchar
+ostream cwctype
+ostream deque
+ostream exception
+ostream format
+ostream functional
+ostream initializer_list
+ostream ios
+ostream iosfwd
+ostream iterator
+ostream limits
+ostream locale
+ostream memory
+ostream mutex
+ostream new
+ostream optional
+ostream print
+ostream queue
+ostream ratio
+ostream stack
+ostream stdexcept
+ostream streambuf
+ostream string
+ostream string_view
+ostream system_error
+ostream tuple
+ostream type_traits
+ostream typeinfo
+ostream unordered_map
+ostream utility
+ostream variant
+ostream vector
+ostream version
+print algorithm
+print array
+print atomic
+print bit
+print cctype
+print cerrno
+print climits
+print clocale
+print cmath
+print compare
+print concepts
+print cstdarg
+print cstddef
+print cstdint
+print cstdio
+print cstdlib
+print cstring
+print ctime
+print cwchar
+print cwctype
+print deque
+print exception
+print format
+print functional
+print initializer_list
+print ios
+print iosfwd
+print iterator
+print limits
+print locale
+print memory
+print mutex
+print new
+print optional
+print queue
+print ratio
+print stack
+print stdexcept
+print streambuf
+print string
+print string_view
+print system_error
+print tuple
+print type_traits
+print typeinfo
+print unordered_map
+print utility
+print variant
+print vector
+print version
+queue algorithm
+queue array
+queue atomic
+queue bit
+queue cctype
+queue cerrno
+queue climits
+queue clocale
+queue cmath
+queue compare
+queue concepts
+queue cstdarg
+queue cstddef
+queue cstdint
+queue cstdio
+queue cstdlib
+queue cstring
+queue ctime
+queue cwchar
+queue cwctype
+queue deque
+queue exception
+queue functional
+queue initializer_list
+queue ios
+queue iosfwd
+queue iterator
+queue limits
+queue locale
+queue memory
+queue mutex
+queue new
+queue optional
+queue ratio
+queue stdexcept
+queue streambuf
+queue string
+queue string_view
+queue system_error
+queue tuple
+queue type_traits
+queue typeinfo
+queue unordered_map
+queue utility
+queue variant
+queue vector
+queue version
+random algorithm
+random array
+random atomic
+random bit
+random cctype
+random cerrno
+random climits
+random clocale
+random cmath
+random compare
+random concepts
+random cstdarg
+random cstddef
+random cstdint
+random cstdio
+random cstdlib
+random cstring
+random ctime
+random cwchar
+random cwctype
+random exception
+random execution
+random functional
+random initializer_list
+random ios
+random iosfwd
+random iterator
+random limits
+random locale
+random memory
+random mutex
+random new
+random numeric
+random optional
+random ratio
+random stdexcept
+random streambuf
+random string
+random string_view
+random system_error
+random tuple
+random type_traits
+random typeinfo
+random unordered_map
+random utility
+random variant
+random vector
+random version
+ranges cctype
+ranges cmath
+ranges compare
+ranges concepts
+ranges cstddef
+ranges cstdint
+ranges cstdio
+ranges cstdlib
+ranges cstring
+ranges cwchar
+ranges cwctype
+ranges exception
+ranges initializer_list
+ranges iosfwd
+ranges iterator
+ranges limits
+ranges new
+ranges tuple
+ranges type_traits
+ranges typeinfo
+ranges utility
+ranges variant
+ranges version
+ratio climits
+ratio cstdint
+ratio type_traits
+ratio version
+regex algorithm
+regex array
+regex atomic
+regex bit
+regex cctype
+regex cerrno
+regex climits
+regex clocale
+regex cmath
+regex compare
+regex concepts
+regex cstdarg
+regex cstddef
+regex cstdint
+regex cstdio
+regex cstdlib
+regex cstring
+regex ctime
+regex cwchar
+regex cwctype
+regex deque
+regex exception
+regex functional
+regex initializer_list
+regex ios
+regex iosfwd
+regex iterator
+regex limits
+regex locale
+regex memory
+regex mutex
+regex new
+regex optional
+regex ratio
+regex stdexcept
+regex streambuf
+regex string
+regex string_view
+regex system_error
+regex tuple
+regex type_traits
+regex typeinfo
+regex unordered_map
+regex utility
+regex variant
+regex vector
+regex version
+scoped_allocator atomic
+scoped_allocator cctype
+scoped_allocator climits
+scoped_allocator cmath
+scoped_allocator compare
+scoped_allocator concepts
+scoped_allocator cstddef
+scoped_allocator cstdint
+scoped_allocator cstdio
+scoped_allocator cstdlib
+scoped_allocator cstring
+scoped_allocator ctime
+scoped_allocator cwchar
+scoped_allocator cwctype
+scoped_allocator exception
+scoped_allocator initializer_list
+scoped_allocator iosfwd
+scoped_allocator iterator
+scoped_allocator limits
+scoped_allocator memory
+scoped_allocator new
+scoped_allocator ratio
+scoped_allocator stdexcept
+scoped_allocator tuple
+scoped_allocator type_traits
+scoped_allocator typeinfo
+scoped_allocator utility
+scoped_allocator variant
+scoped_allocator version
+semaphore atomic
+semaphore climits
+semaphore cmath
+semaphore compare
+semaphore cstddef
+semaphore cstdint
+semaphore cstdlib
+semaphore cstring
+semaphore ctime
+semaphore limits
+semaphore ratio
+semaphore type_traits
+semaphore version
+set algorithm
+set array
+set atomic
+set bit
+set cctype
+set cerrno
+set climits
+set clocale
+set cmath
+set compare
+set concepts
+set cstdarg
+set cstddef
+set cstdint
+set cstdio
+set cstdlib
+set cstring
+set ctime
+set cwchar
+set cwctype
+set exception
+set functional
+set initializer_list
+set ios
+set iosfwd
+set iterator
+set limits
+set locale
+set memory
+set mutex
+set new
+set optional
+set ratio
+set stdexcept
+set streambuf
+set string
+set string_view
+set system_error
+set tuple
+set type_traits
+set typeinfo
+set unordered_map
+set utility
+set variant
+set vector
+set version
+shared_mutex algorithm
+shared_mutex atomic
+shared_mutex bit
+shared_mutex cctype
+shared_mutex cerrno
+shared_mutex climits
+shared_mutex cmath
+shared_mutex compare
+shared_mutex concepts
+shared_mutex cstddef
+shared_mutex cstdint
+shared_mutex cstdio
+shared_mutex cstdlib
+shared_mutex cstring
+shared_mutex ctime
+shared_mutex cwchar
+shared_mutex cwctype
+shared_mutex exception
+shared_mutex initializer_list
+shared_mutex iosfwd
+shared_mutex iterator
+shared_mutex limits
+shared_mutex memory
+shared_mutex new
+shared_mutex optional
+shared_mutex ratio
+shared_mutex stdexcept
+shared_mutex string
+shared_mutex string_view
+shared_mutex system_error
+shared_mutex tuple
+shared_mutex type_traits
+shared_mutex typeinfo
+shared_mutex utility
+shared_mutex variant
+shared_mutex version
+source_location cstdint
+source_location version
+span algorithm
+span array
+span atomic
+span bit
+span cctype
+span cerrno
+span climits
+span clocale
+span cmath
+span compare
+span concepts
+span cstdarg
+span cstddef
+span cstdint
+span cstdio
+span cstdlib
+span cstring
+span ctime
+span cwchar
+span cwctype
+span exception
+span functional
+span initializer_list
+span ios
+span iosfwd
+span iterator
+span limits
+span locale
+span memory
+span mutex
+span new
+span optional
+span ratio
+span stdexcept
+span streambuf
+span string
+span string_view
+span system_error
+span tuple
+span type_traits
+span typeinfo
+span unordered_map
+span utility
+span variant
+span vector
+span version
+sstream algorithm
+sstream array
+sstream atomic
+sstream bit
+sstream bitset
+sstream cctype
+sstream cerrno
+sstream climits
+sstream clocale
+sstream cmath
+sstream compare
+sstream concepts
+sstream cstdarg
+sstream cstddef
+sstream cstdint
+sstream cstdio
+sstream cstdlib
+sstream cstring
+sstream ctime
+sstream cwchar
+sstream cwctype
+sstream deque
+sstream exception
+sstream format
+sstream functional
+sstream initializer_list
+sstream ios
+sstream iosfwd
+sstream istream
+sstream iterator
+sstream limits
+sstream locale
+sstream memory
+sstream mutex
+sstream new
+sstream optional
+sstream ostream
+sstream print
+sstream queue
+sstream ratio
+sstream stack
+sstream stdexcept
+sstream streambuf
+sstream string
+sstream string_view
+sstream system_error
+sstream tuple
+sstream type_traits
+sstream typeinfo
+sstream unordered_map
+sstream utility
+sstream variant
+sstream vector
+sstream version
+stack algorithm
+stack array
+stack atomic
+stack bit
+stack cctype
+stack cerrno
+stack climits
+stack clocale
+stack cmath
+stack compare
+stack concepts
+stack cstdarg
+stack cstddef
+stack cstdint
+stack cstdio
+stack cstdlib
+stack cstring
+stack ctime
+stack cwchar
+stack cwctype
+stack deque
+stack exception
+stack functional
+stack initializer_list
+stack ios
+stack iosfwd
+stack iterator
+stack limits
+stack locale
+stack memory
+stack mutex
+stack new
+stack optional
+stack ratio
+stack stdexcept
+stack streambuf
+stack string
+stack string_view
+stack system_error
+stack tuple
+stack type_traits
+stack typeinfo
+stack unordered_map
+stack utility
+stack variant
+stack vector
+stack version
+stdexcept cstddef
+stdexcept cstdint
+stdexcept cstdlib
+stdexcept exception
+stdexcept iosfwd
+stdexcept new
+stdexcept type_traits
+stdexcept typeinfo
+stdexcept version
+stop_token iosfwd
+stop_token version
+streambuf algorithm
+streambuf atomic
+streambuf bit
+streambuf cctype
+streambuf cerrno
+streambuf climits
+streambuf clocale
+streambuf cmath
+streambuf compare
+streambuf concepts
+streambuf cstddef
+streambuf cstdint
+streambuf cstdio
+streambuf cstdlib
+streambuf cstring
+streambuf ctime
+streambuf cwchar
+streambuf cwctype
+streambuf exception
+streambuf initializer_list
+streambuf ios
+streambuf iosfwd
+streambuf iterator
+streambuf limits
+streambuf memory
+streambuf mutex
+streambuf new
+streambuf optional
+streambuf ratio
+streambuf stdexcept
+streambuf string
+streambuf string_view
+streambuf system_error
+streambuf tuple
+streambuf type_traits
+streambuf typeinfo
+streambuf utility
+streambuf variant
+streambuf version
+string algorithm
+string atomic
+string bit
+string cctype
+string climits
+string cmath
+string compare
+string concepts
+string cstddef
+string cstdint
+string cstdio
+string cstdlib
+string cstring
+string ctime
+string cwchar
+string cwctype
+string exception
+string initializer_list
+string iosfwd
+string iterator
+string limits
+string memory
+string new
+string optional
+string ratio
+string stdexcept
+string string_view
+string tuple
+string type_traits
+string typeinfo
+string utility
+string variant
+string version
+string_view algorithm
+string_view atomic
+string_view bit
+string_view cctype
+string_view climits
+string_view cmath
+string_view compare
+string_view concepts
+string_view cstddef
+string_view cstdint
+string_view cstdio
+string_view cstdlib
+string_view cstring
+string_view ctime
+string_view cwchar
+string_view cwctype
+string_view exception
+string_view initializer_list
+string_view iosfwd
+string_view iterator
+string_view limits
+string_view memory
+string_view new
+string_view optional
+string_view ratio
+string_view stdexcept
+string_view tuple
+string_view type_traits
+string_view typeinfo
+string_view utility
+string_view variant
+string_view version
+strstream algorithm
+strstream array
+strstream atomic
+strstream bit
+strstream bitset
+strstream cctype
+strstream cerrno
+strstream climits
+strstream clocale
+strstream cmath
+strstream compare
+strstream concepts
+strstream cstdarg
+strstream cstddef
+strstream cstdint
+strstream cstdio
+strstream cstdlib
+strstream cstring
+strstream ctime
+strstream cwchar
+strstream cwctype
+strstream deque
+strstream exception
+strstream format
+strstream functional
+strstream initializer_list
+strstream ios
+strstream iosfwd
+strstream istream
+strstream iterator
+strstream limits
+strstream locale
+strstream memory
+strstream mutex
+strstream new
+strstream optional
+strstream ostream
+strstream print
+strstream queue
+strstream ratio
+strstream stack
+strstream stdexcept
+strstream streambuf
+strstream string
+strstream string_view
+strstream system_error
+strstream tuple
+strstream type_traits
+strstream typeinfo
+strstream unordered_map
+strstream utility
+strstream variant
+strstream vector
+strstream version
+syncstream algorithm
+syncstream array
+syncstream atomic
+syncstream bit
+syncstream bitset
+syncstream cctype
+syncstream cerrno
+syncstream climits
+syncstream clocale
+syncstream cmath
+syncstream compare
+syncstream concepts
+syncstream cstdarg
+syncstream cstddef
+syncstream cstdint
+syncstream cstdio
+syncstream cstdlib
+syncstream cstring
+syncstream ctime
+syncstream cwchar
+syncstream cwctype
+syncstream deque
+syncstream exception
+syncstream format
+syncstream functional
+syncstream initializer_list
+syncstream ios
+syncstream iosfwd
+syncstream iterator
+syncstream limits
+syncstream locale
+syncstream map
+syncstream memory
+syncstream mutex
+syncstream new
+syncstream optional
+syncstream ostream
+syncstream print
+syncstream queue
+syncstream ratio
+syncstream shared_mutex
+syncstream stack
+syncstream stdexcept
+syncstream streambuf
+syncstream string
+syncstream string_view
+syncstream system_error
+syncstream tuple
+syncstream type_traits
+syncstream typeinfo
+syncstream unordered_map
+syncstream utility
+syncstream variant
+syncstream vector
+syncstream version
+system_error algorithm
+system_error atomic
+system_error bit
+system_error cctype
+system_error cerrno
+system_error climits
+system_error cmath
+system_error compare
+system_error concepts
+system_error cstddef
+system_error cstdint
+system_error cstdio
+system_error cstdlib
+system_error cstring
+system_error ctime
+system_error cwchar
+system_error cwctype
+system_error exception
+system_error initializer_list
+system_error iosfwd
+system_error iterator
+system_error limits
+system_error memory
+system_error new
+system_error optional
+system_error ratio
+system_error stdexcept
+system_error string
+system_error string_view
+system_error tuple
+system_error type_traits
+system_error typeinfo
+system_error utility
+system_error variant
+system_error version
+thread algorithm
+thread array
+thread atomic
+thread bit
+thread bitset
+thread cctype
+thread cerrno
+thread chrono
+thread climits
+thread clocale
+thread cmath
+thread compare
+thread concepts
+thread cstdarg
+thread cstddef
+thread cstdint
+thread cstdio
+thread cstdlib
+thread cstring
+thread ctime
+thread cwchar
+thread cwctype
+thread deque
+thread exception
+thread format
+thread forward_list
+thread functional
+thread initializer_list
+thread ios
+thread iosfwd
+thread istream
+thread iterator
+thread limits
+thread locale
+thread memory
+thread mutex
+thread new
+thread optional
+thread ostream
+thread print
+thread queue
+thread ratio
+thread sstream
+thread stack
+thread stdexcept
+thread streambuf
+thread string
+thread string_view
+thread system_error
+thread tuple
+thread type_traits
+thread typeinfo
+thread unordered_map
+thread utility
+thread variant
+thread vector
+thread version
+tuple cmath
+tuple compare
+tuple cstddef
+tuple cstdint
+tuple cstdlib
+tuple exception
+tuple initializer_list
+tuple iosfwd
+tuple limits
+tuple new
+tuple type_traits
+tuple typeinfo
+tuple utility
+tuple version
+type_traits cstdint
+type_traits version
+typeindex cmath
+typeindex compare
+typeindex cstddef
+typeindex cstdint
+typeindex cstdlib
+typeindex initializer_list
+typeindex iosfwd
+typeindex limits
+typeindex new
+typeindex type_traits
+typeindex typeinfo
+typeindex utility
+typeindex version
+typeinfo cstddef
+typeinfo cstdint
+typeinfo cstdlib
+typeinfo type_traits
+typeinfo version
+unordered_map algorithm
+unordered_map atomic
+unordered_map bit
+unordered_map cctype
+unordered_map climits
+unordered_map cmath
+unordered_map compare
+unordered_map concepts
+unordered_map cstddef
+unordered_map cstdint
+unordered_map cstdio
+unordered_map cstdlib
+unordered_map cstring
+unordered_map ctime
+unordered_map cwchar
+unordered_map cwctype
+unordered_map exception
+unordered_map initializer_list
+unordered_map iosfwd
+unordered_map iterator
+unordered_map limits
+unordered_map memory
+unordered_map new
+unordered_map optional
+unordered_map ratio
+unordered_map stdexcept
+unordered_map tuple
+unordered_map type_traits
+unordered_map typeinfo
+unordered_map utility
+unordered_map variant
+unordered_map version
+unordered_set algorithm
+unordered_set array
+unordered_set atomic
+unordered_set bit
+unordered_set cctype
+unordered_set cerrno
+unordered_set climits
+unordered_set clocale
+unordered_set cmath
+unordered_set compare
+unordered_set concepts
+unordered_set cstdarg
+unordered_set cstddef
+unordered_set cstdint
+unordered_set cstdio
+unordered_set cstdlib
+unordered_set cstring
+unordered_set ctime
+unordered_set cwchar
+unordered_set cwctype
+unordered_set exception
+unordered_set functional
+unordered_set initializer_list
+unordered_set ios
+unordered_set iosfwd
+unordered_set iterator
+unordered_set limits
+unordered_set locale
+unordered_set memory
+unordered_set mutex
+unordered_set new
+unordered_set optional
+unordered_set ratio
+unordered_set stdexcept
+unordered_set streambuf
+unordered_set string
+unordered_set string_view
+unordered_set system_error
+unordered_set tuple
+unordered_set type_traits
+unordered_set typeinfo
+unordered_set unordered_map
+unordered_set utility
+unordered_set variant
+unordered_set vector
+unordered_set version
+utility cmath
+utility compare
+utility cstddef
+utility cstdint
+utility cstdlib
+utility initializer_list
+utility iosfwd
+utility limits
+utility type_traits
+utility version
+valarray algorithm
+valarray array
+valarray atomic
+valarray bit
+valarray cctype
+valarray cerrno
+valarray climits
+valarray clocale
+valarray cmath
+valarray compare
+valarray concepts
+valarray cstdarg
+valarray cstddef
+valarray cstdint
+valarray cstdio
+valarray cstdlib
+valarray cstring
+valarray ctime
+valarray cwchar
+valarray cwctype
+valarray exception
+valarray functional
+valarray initializer_list
+valarray ios
+valarray iosfwd
+valarray iterator
+valarray limits
+valarray locale
+valarray memory
+valarray mutex
+valarray new
+valarray optional
+valarray ratio
+valarray stdexcept
+valarray streambuf
+valarray string
+valarray string_view
+valarray system_error
+valarray tuple
+valarray type_traits
+valarray typeinfo
+valarray unordered_map
+valarray utility
+valarray variant
+valarray vector
+valarray version
+variant cmath
+variant compare
+variant cstddef
+variant cstdint
+variant cstdlib
+variant cstring
+variant exception
+variant initializer_list
+variant iosfwd
+variant limits
+variant new
+variant tuple
+variant type_traits
+variant typeinfo
+variant utility
+variant version
+vector algorithm
+vector array
+vector atomic
+vector bit
+vector cctype
+vector cerrno
+vector climits
+vector clocale
+vector cmath
+vector compare
+vector concepts
+vector cstdarg
+vector cstddef
+vector cstdint
+vector cstdio
+vector cstdlib
+vector cstring
+vector ctime
+vector cwchar
+vector cwctype
+vector exception
+vector initializer_list
+vector ios
+vector iosfwd
+vector iterator
+vector limits
+vector locale
+vector memory
+vector mutex
+vector new
+vector optional
+vector ratio
+vector stdexcept
+vector streambuf
+vector string
+vector string_view
+vector system_error
+vector tuple
+vector type_traits
+vector typeinfo
+vector utility
+vector variant
+vector version
diff --git a/libcxx/test/libcxx-03/transitive_includes/cxx11.csv b/libcxx/test/libcxx-03/transitive_includes/cxx11.csv
new file mode 100644
index 0000000000000..c0031543e47bc
--- /dev/null
+++ b/libcxx/test/libcxx-03/transitive_includes/cxx11.csv
@@ -0,0 +1,2568 @@
+algorithm atomic
+algorithm bit
+algorithm cctype
+algorithm climits
+algorithm cmath
+algorithm compare
+algorithm concepts
+algorithm cstddef
+algorithm cstdint
+algorithm cstdio
+algorithm cstdlib
+algorithm cstring
+algorithm ctime
+algorithm cwchar
+algorithm cwctype
+algorithm exception
+algorithm initializer_list
+algorithm iosfwd
+algorithm iterator
+algorithm limits
+algorithm memory
+algorithm new
+algorithm optional
+algorithm ratio
+algorithm stdexcept
+algorithm tuple
+algorithm type_traits
+algorithm typeinfo
+algorithm utility
+algorithm variant
+algorithm version
+any algorithm
+any array
+any atomic
+any bit
+any cctype
+any cerrno
+any chrono
+any climits
+any clocale
+any cmath
+any compare
+any concepts
+any cstdarg
+any cstddef
+any cstdint
+any cstdio
+any cstdlib
+any cstring
+any ctime
+any cwchar
+any cwctype
+any exception
+any forward_list
+any functional
+any initializer_list
+any ios
+any iosfwd
+any iterator
+any limits
+any locale
+any memory
+any mutex
+any new
+any optional
+any ratio
+any stdexcept
+any streambuf
+any string
+any string_view
+any system_error
+any tuple
+any type_traits
+any typeinfo
+any unordered_map
+any utility
+any variant
+any vector
+any version
+array algorithm
+array atomic
+array bit
+array cctype
+array climits
+array cmath
+array compare
+array concepts
+array cstddef
+array cstdint
+array cstdio
+array cstdlib
+array cstring
+array ctime
+array cwchar
+array cwctype
+array exception
+array initializer_list
+array iosfwd
+array iterator
+array limits
+array memory
+array new
+array optional
+array ratio
+array stdexcept
+array tuple
+array type_traits
+array typeinfo
+array utility
+array variant
+array version
+atomic climits
+atomic cmath
+atomic compare
+atomic cstddef
+atomic cstdint
+atomic cstdlib
+atomic cstring
+atomic ctime
+atomic limits
+atomic ratio
+atomic type_traits
+atomic version
+barrier atomic
+barrier climits
+barrier cmath
+barrier compare
+barrier concepts
+barrier cstddef
+barrier cstdint
+barrier cstdlib
+barrier cstring
+barrier ctime
+barrier exception
+barrier initializer_list
+barrier iosfwd
+barrier iterator
+barrier limits
+barrier memory
+barrier new
+barrier ratio
+barrier stdexcept
+barrier tuple
+barrier type_traits
+barrier typeinfo
+barrier utility
+barrier variant
+barrier version
+bit cstdint
+bit cstdlib
+bit iosfwd
+bit limits
+bit type_traits
+bit version
+bitset algorithm
+bitset atomic
+bitset bit
+bitset cctype
+bitset climits
+bitset cmath
+bitset compare
+bitset concepts
+bitset cstddef
+bitset cstdint
+bitset cstdio
+bitset cstdlib
+bitset cstring
+bitset ctime
+bitset cwchar
+bitset cwctype
+bitset exception
+bitset initializer_list
+bitset iosfwd
+bitset iterator
+bitset limits
+bitset memory
+bitset new
+bitset optional
+bitset ratio
+bitset stdexcept
+bitset string
+bitset string_view
+bitset tuple
+bitset type_traits
+bitset typeinfo
+bitset utility
+bitset variant
+bitset version
+ccomplex algorithm
+ccomplex array
+ccomplex atomic
+ccomplex bit
+ccomplex bitset
+ccomplex cctype
+ccomplex cerrno
+ccomplex climits
+ccomplex clocale
+ccomplex cmath
+ccomplex compare
+ccomplex complex
+ccomplex concepts
+ccomplex cstdarg
+ccomplex cstddef
+ccomplex cstdint
+ccomplex cstdio
+ccomplex cstdlib
+ccomplex cstring
+ccomplex ctime
+ccomplex cwchar
+ccomplex cwctype
+ccomplex deque
+ccomplex exception
+ccomplex format
+ccomplex functional
+ccomplex initializer_list
+ccomplex ios
+ccomplex iosfwd
+ccomplex istream
+ccomplex iterator
+ccomplex limits
+ccomplex locale
+ccomplex memory
+ccomplex mutex
+ccomplex new
+ccomplex optional
+ccomplex ostream
+ccomplex print
+ccomplex queue
+ccomplex ratio
+ccomplex sstream
+ccomplex stack
+ccomplex stdexcept
+ccomplex streambuf
+ccomplex string
+ccomplex string_view
+ccomplex system_error
+ccomplex tuple
+ccomplex type_traits
+ccomplex typeinfo
+ccomplex unordered_map
+ccomplex utility
+ccomplex variant
+ccomplex vector
+ccomplex version
+charconv cmath
+charconv concepts
+charconv cstddef
+charconv cstdint
+charconv cstdlib
+charconv cstring
+charconv iosfwd
+charconv limits
+charconv new
+charconv type_traits
+charconv version
+chrono algorithm
+chrono array
+chrono atomic
+chrono bit
+chrono cctype
+chrono cerrno
+chrono climits
+chrono clocale
+chrono cmath
+chrono compare
+chrono concepts
+chrono cstdarg
+chrono cstddef
+chrono cstdint
+chrono cstdio
+chrono cstdlib
+chrono cstring
+chrono ctime
+chrono cwchar
+chrono cwctype
+chrono exception
+chrono forward_list
+chrono functional
+chrono initializer_list
+chrono ios
+chrono iosfwd
+chrono iterator
+chrono limits
+chrono locale
+chrono memory
+chrono mutex
+chrono new
+chrono optional
+chrono ratio
+chrono stdexcept
+chrono streambuf
+chrono string
+chrono string_view
+chrono system_error
+chrono tuple
+chrono type_traits
+chrono typeinfo
+chrono unordered_map
+chrono utility
+chrono variant
+chrono vector
+chrono version
+cinttypes cstdint
+cmath cstdint
+cmath limits
+cmath type_traits
+cmath version
+codecvt algorithm
+codecvt atomic
+codecvt bit
+codecvt cctype
+codecvt cerrno
+codecvt climits
+codecvt clocale
+codecvt cmath
+codecvt compare
+codecvt concepts
+codecvt cstddef
+codecvt cstdint
+codecvt cstdio
+codecvt cstdlib
+codecvt cstring
+codecvt ctime
+codecvt cwchar
+codecvt cwctype
+codecvt exception
+codecvt initializer_list
+codecvt iosfwd
+codecvt iterator
+codecvt limits
+codecvt memory
+codecvt mutex
+codecvt new
+codecvt optional
+codecvt ratio
+codecvt stdexcept
+codecvt string
+codecvt string_view
+codecvt system_error
+codecvt tuple
+codecvt type_traits
+codecvt typeinfo
+codecvt utility
+codecvt variant
+codecvt version
+compare cmath
+compare cstddef
+compare cstdint
+compare limits
+compare type_traits
+compare version
+complex algorithm
+complex array
+complex atomic
+complex bit
+complex bitset
+complex cctype
+complex cerrno
+complex climits
+complex clocale
+complex cmath
+complex compare
+complex concepts
+complex cstdarg
+complex cstddef
+complex cstdint
+complex cstdio
+complex cstdlib
+complex cstring
+complex ctime
+complex cwchar
+complex cwctype
+complex deque
+complex exception
+complex format
+complex functional
+complex initializer_list
+complex ios
+complex iosfwd
+complex istream
+complex iterator
+complex limits
+complex locale
+complex memory
+complex mutex
+complex new
+complex optional
+complex ostream
+complex print
+complex queue
+complex ratio
+complex sstream
+complex stack
+complex stdexcept
+complex streambuf
+complex string
+complex string_view
+complex system_error
+complex tuple
+complex type_traits
+complex typeinfo
+complex unordered_map
+complex utility
+complex variant
+complex vector
+complex version
+concepts cstddef
+concepts cstdint
+concepts type_traits
+concepts version
+condition_variable algorithm
+condition_variable atomic
+condition_variable bit
+condition_variable cctype
+condition_variable cerrno
+condition_variable climits
+condition_variable cmath
+condition_variable compare
+condition_variable concepts
+condition_variable cstddef
+condition_variable cstdint
+condition_variable cstdio
+condition_variable cstdlib
+condition_variable cstring
+condition_variable ctime
+condition_variable cwchar
+condition_variable cwctype
+condition_variable exception
+condition_variable initializer_list
+condition_variable iosfwd
+condition_variable iterator
+condition_variable limits
+condition_variable memory
+condition_variable new
+condition_variable optional
+condition_variable ratio
+condition_variable stdexcept
+condition_variable string
+condition_variable string_view
+condition_variable system_error
+condition_variable tuple
+condition_variable type_traits
+condition_variable typeinfo
+condition_variable utility
+condition_variable variant
+condition_variable version
+coroutine cmath
+coroutine compare
+coroutine cstddef
+coroutine cstdint
+coroutine iosfwd
+coroutine limits
+coroutine type_traits
+coroutine version
+cstddef version
+ctgmath algorithm
+ctgmath array
+ctgmath atomic
+ctgmath bit
+ctgmath bitset
+ctgmath cctype
+ctgmath cerrno
+ctgmath climits
+ctgmath clocale
+ctgmath cmath
+ctgmath compare
+ctgmath complex
+ctgmath concepts
+ctgmath cstdarg
+ctgmath cstddef
+ctgmath cstdint
+ctgmath cstdio
+ctgmath cstdlib
+ctgmath cstring
+ctgmath ctime
+ctgmath cwchar
+ctgmath cwctype
+ctgmath deque
+ctgmath exception
+ctgmath format
+ctgmath functional
+ctgmath initializer_list
+ctgmath ios
+ctgmath iosfwd
+ctgmath istream
+ctgmath iterator
+ctgmath limits
+ctgmath locale
+ctgmath memory
+ctgmath mutex
+ctgmath new
+ctgmath optional
+ctgmath ostream
+ctgmath print
+ctgmath queue
+ctgmath ratio
+ctgmath sstream
+ctgmath stack
+ctgmath stdexcept
+ctgmath streambuf
+ctgmath string
+ctgmath string_view
+ctgmath system_error
+ctgmath tuple
+ctgmath type_traits
+ctgmath typeinfo
+ctgmath unordered_map
+ctgmath utility
+ctgmath variant
+ctgmath vector
+ctgmath version
+cwchar cctype
+cwchar cstddef
+cwchar cwctype
+cwchar version
+cwctype cctype
+deque algorithm
+deque array
+deque atomic
+deque bit
+deque cctype
+deque cerrno
+deque climits
+deque clocale
+deque cmath
+deque compare
+deque concepts
+deque cstdarg
+deque cstddef
+deque cstdint
+deque cstdio
+deque cstdlib
+deque cstring
+deque ctime
+deque cwchar
+deque cwctype
+deque exception
+deque functional
+deque initializer_list
+deque ios
+deque iosfwd
+deque iterator
+deque limits
+deque locale
+deque memory
+deque mutex
+deque new
+deque optional
+deque ratio
+deque stdexcept
+deque streambuf
+deque string
+deque string_view
+deque system_error
+deque tuple
+deque type_traits
+deque typeinfo
+deque unordered_map
+deque utility
+deque variant
+deque vector
+deque version
+exception cstddef
+exception cstdint
+exception cstdlib
+exception new
+exception type_traits
+exception typeinfo
+exception version
+execution cstddef
+execution version
+expected version
+experimental/iterator algorithm
+experimental/iterator atomic
+experimental/iterator bit
+experimental/iterator bitset
+experimental/iterator cctype
+experimental/iterator cerrno
+experimental/iterator climits
+experimental/iterator clocale
+experimental/iterator cmath
+experimental/iterator compare
+experimental/iterator concepts
+experimental/iterator cstdarg
+experimental/iterator cstddef
+experimental/iterator cstdint
+experimental/iterator cstdio
+experimental/iterator cstdlib
+experimental/iterator cstring
+experimental/iterator ctime
+experimental/iterator cwchar
+experimental/iterator cwctype
+experimental/iterator exception
+experimental/iterator initializer_list
+experimental/iterator ios
+experimental/iterator iosfwd
+experimental/iterator iterator
+experimental/iterator limits
+experimental/iterator locale
+experimental/iterator memory
+experimental/iterator mutex
+experimental/iterator new
+experimental/iterator optional
+experimental/iterator ratio
+experimental/iterator stdexcept
+experimental/iterator streambuf
+experimental/iterator string
+experimental/iterator string_view
+experimental/iterator system_error
+experimental/iterator tuple
+experimental/iterator type_traits
+experimental/iterator typeinfo
+experimental/iterator utility
+experimental/iterator variant
+experimental/iterator version
+experimental/memory cstddef
+experimental/memory cstdint
+experimental/memory cstring
+experimental/memory limits
+experimental/memory type_traits
+experimental/memory version
+experimental/propagate_const cstddef
+experimental/propagate_const cstdint
+experimental/propagate_const type_traits
+experimental/propagate_const version
+experimental/simd cstddef
+experimental/simd cstdint
+experimental/simd limits
+experimental/simd type_traits
+experimental/simd version
+experimental/utility cmath
+experimental/utility compare
+experimental/utility cstddef
+experimental/utility cstdint
+experimental/utility cstdlib
+experimental/utility initializer_list
+experimental/utility iosfwd
+experimental/utility limits
+experimental/utility type_traits
+experimental/utility utility
+experimental/utility version
+filesystem algorithm
+filesystem atomic
+filesystem bit
+filesystem cctype
+filesystem cerrno
+filesystem climits
+filesystem cmath
+filesystem compare
+filesystem concepts
+filesystem cstddef
+filesystem cstdint
+filesystem cstdio
+filesystem cstdlib
+filesystem cstring
+filesystem ctime
+filesystem cwchar
+filesystem cwctype
+filesystem exception
+filesystem initializer_list
+filesystem iosfwd
+filesystem iterator
+filesystem limits
+filesystem memory
+filesystem new
+filesystem optional
+filesystem ratio
+filesystem stdexcept
+filesystem string
+filesystem string_view
+filesystem system_error
+filesystem tuple
+filesystem type_traits
+filesystem typeinfo
+filesystem utility
+filesystem variant
+filesystem version
+flat_map cmath
+flat_map compare
+flat_map cstddef
+flat_map cstdint
+flat_map initializer_list
+flat_map limits
+flat_map type_traits
+flat_map version
+flat_set cmath
+flat_set compare
+flat_set cstddef
+flat_set cstdint
+flat_set initializer_list
+flat_set limits
+flat_set type_traits
+flat_set version
+format algorithm
+format array
+format atomic
+format bit
+format cctype
+format cerrno
+format climits
+format clocale
+format cmath
+format compare
+format concepts
+format cstdarg
+format cstddef
+format cstdint
+format cstdio
+format cstdlib
+format cstring
+format ctime
+format cwchar
+format cwctype
+format deque
+format exception
+format functional
+format initializer_list
+format ios
+format iosfwd
+format iterator
+format limits
+format locale
+format memory
+format mutex
+format new
+format optional
+format queue
+format ratio
+format stack
+format stdexcept
+format streambuf
+format string
+format string_view
+format system_error
+format tuple
+format type_traits
+format typeinfo
+format unordered_map
+format utility
+format variant
+format vector
+format version
+forward_list algorithm
+forward_list array
+forward_list atomic
+forward_list bit
+forward_list cctype
+forward_list cerrno
+forward_list climits
+forward_list clocale
+forward_list cmath
+forward_list compare
+forward_list concepts
+forward_list cstdarg
+forward_list cstddef
+forward_list cstdint
+forward_list cstdio
+forward_list cstdlib
+forward_list cstring
+forward_list ctime
+forward_list cwchar
+forward_list cwctype
+forward_list exception
+forward_list functional
+forward_list initializer_list
+forward_list ios
+forward_list iosfwd
+forward_list iterator
+forward_list limits
+forward_list locale
+forward_list memory
+forward_list mutex
+forward_list new
+forward_list optional
+forward_list ratio
+forward_list stdexcept
+forward_list streambuf
+forward_list string
+forward_list string_view
+forward_list system_error
+forward_list tuple
+forward_list type_traits
+forward_list typeinfo
+forward_list unordered_map
+forward_list utility
+forward_list variant
+forward_list vector
+forward_list version
+fstream algorithm
+fstream array
+fstream atomic
+fstream bit
+fstream bitset
+fstream cctype
+fstream cerrno
+fstream climits
+fstream clocale
+fstream cmath
+fstream compare
+fstream concepts
+fstream cstdarg
+fstream cstddef
+fstream cstdint
+fstream cstdio
+fstream cstdlib
+fstream cstring
+fstream ctime
+fstream cwchar
+fstream cwctype
+fstream deque
+fstream exception
+fstream filesystem
+fstream format
+fstream functional
+fstream initializer_list
+fstream iomanip
+fstream ios
+fstream iosfwd
+fstream istream
+fstream iterator
+fstream limits
+fstream locale
+fstream memory
+fstream mutex
+fstream new
+fstream optional
+fstream ostream
+fstream print
+fstream queue
+fstream ratio
+fstream stack
+fstream stdexcept
+fstream streambuf
+fstream string
+fstream string_view
+fstream system_error
+fstream tuple
+fstream type_traits
+fstream typeinfo
+fstream unordered_map
+fstream utility
+fstream variant
+fstream vector
+fstream version
+functional algorithm
+functional array
+functional atomic
+functional bit
+functional cctype
+functional cerrno
+functional climits
+functional clocale
+functional cmath
+functional compare
+functional concepts
+functional cstdarg
+functional cstddef
+functional cstdint
+functional cstdio
+functional cstdlib
+functional cstring
+functional ctime
+functional cwchar
+functional cwctype
+functional exception
+functional initializer_list
+functional ios
+functional iosfwd
+functional iterator
+functional limits
+functional locale
+functional memory
+functional mutex
+functional new
+functional optional
+functional ratio
+functional stdexcept
+functional streambuf
+functional string
+functional string_view
+functional system_error
+functional tuple
+functional type_traits
+functional typeinfo
+functional unordered_map
+functional utility
+functional variant
+functional vector
+functional version
+future algorithm
+future array
+future atomic
+future bit
+future bitset
+future cctype
+future cerrno
+future chrono
+future climits
+future clocale
+future cmath
+future compare
+future concepts
+future cstdarg
+future cstddef
+future cstdint
+future cstdio
+future cstdlib
+future cstring
+future ctime
+future cwchar
+future cwctype
+future deque
+future exception
+future format
+future forward_list
+future functional
+future initializer_list
+future ios
+future iosfwd
+future istream
+future iterator
+future limits
+future locale
+future memory
+future mutex
+future new
+future optional
+future ostream
+future print
+future queue
+future ratio
+future sstream
+future stack
+future stdexcept
+future streambuf
+future string
+future string_view
+future system_error
+future thread
+future tuple
+future type_traits
+future typeinfo
+future unordered_map
+future utility
+future variant
+future vector
+future version
+initializer_list cstddef
+initializer_list version
+iomanip algorithm
+iomanip array
+iomanip atomic
+iomanip bit
+iomanip bitset
+iomanip cctype
+iomanip cerrno
+iomanip climits
+iomanip clocale
+iomanip cmath
+iomanip compare
+iomanip concepts
+iomanip cstdarg
+iomanip cstddef
+iomanip cstdint
+iomanip cstdio
+iomanip cstdlib
+iomanip cstring
+iomanip ctime
+iomanip cwchar
+iomanip cwctype
+iomanip deque
+iomanip exception
+iomanip format
+iomanip functional
+iomanip initializer_list
+iomanip ios
+iomanip iosfwd
+iomanip istream
+iomanip iterator
+iomanip limits
+iomanip locale
+iomanip memory
+iomanip mutex
+iomanip new
+iomanip optional
+iomanip ostream
+iomanip print
+iomanip queue
+iomanip ratio
+iomanip stack
+iomanip stdexcept
+iomanip streambuf
+iomanip string
+iomanip string_view
+iomanip system_error
+iomanip tuple
+iomanip type_traits
+iomanip typeinfo
+iomanip unordered_map
+iomanip utility
+iomanip variant
+iomanip vector
+iomanip version
+ios algorithm
+ios atomic
+ios bit
+ios cctype
+ios cerrno
+ios climits
+ios clocale
+ios cmath
+ios compare
+ios concepts
+ios cstddef
+ios cstdint
+ios cstdio
+ios cstdlib
+ios cstring
+ios ctime
+ios cwchar
+ios cwctype
+ios exception
+ios initializer_list
+ios iosfwd
+ios iterator
+ios limits
+ios memory
+ios mutex
+ios new
+ios optional
+ios ratio
+ios stdexcept
+ios string
+ios string_view
+ios system_error
+ios tuple
+ios type_traits
+ios typeinfo
+ios utility
+ios variant
+ios version
+iosfwd version
+iostream algorithm
+iostream array
+iostream atomic
+iostream bit
+iostream bitset
+iostream cctype
+iostream cerrno
+iostream climits
+iostream clocale
+iostream cmath
+iostream compare
+iostream concepts
+iostream cstdarg
+iostream cstddef
+iostream cstdint
+iostream cstdio
+iostream cstdlib
+iostream cstring
+iostream ctime
+iostream cwchar
+iostream cwctype
+iostream deque
+iostream exception
+iostream format
+iostream functional
+iostream initializer_list
+iostream ios
+iostream iosfwd
+iostream istream
+iostream iterator
+iostream limits
+iostream locale
+iostream memory
+iostream mutex
+iostream new
+iostream optional
+iostream ostream
+iostream print
+iostream queue
+iostream ratio
+iostream stack
+iostream stdexcept
+iostream streambuf
+iostream string
+iostream string_view
+iostream system_error
+iostream tuple
+iostream type_traits
+iostream typeinfo
+iostream unordered_map
+iostream utility
+iostream variant
+iostream vector
+iostream version
+istream algorithm
+istream array
+istream atomic
+istream bit
+istream bitset
+istream cctype
+istream cerrno
+istream climits
+istream clocale
+istream cmath
+istream compare
+istream concepts
+istream cstdarg
+istream cstddef
+istream cstdint
+istream cstdio
+istream cstdlib
+istream cstring
+istream ctime
+istream cwchar
+istream cwctype
+istream deque
+istream exception
+istream format
+istream functional
+istream initializer_list
+istream ios
+istream iosfwd
+istream iterator
+istream limits
+istream locale
+istream memory
+istream mutex
+istream new
+istream optional
+istream ostream
+istream print
+istream queue
+istream ratio
+istream stack
+istream stdexcept
+istream streambuf
+istream string
+istream string_view
+istream system_error
+istream tuple
+istream type_traits
+istream typeinfo
+istream unordered_map
+istream utility
+istream variant
+istream vector
+istream version
+iterator cctype
+iterator cmath
+iterator compare
+iterator concepts
+iterator cstddef
+iterator cstdint
+iterator cstdio
+iterator cstdlib
+iterator cstring
+iterator cwchar
+iterator cwctype
+iterator exception
+iterator initializer_list
+iterator iosfwd
+iterator limits
+iterator new
+iterator tuple
+iterator type_traits
+iterator typeinfo
+iterator utility
+iterator variant
+iterator version
+latch atomic
+latch climits
+latch cmath
+latch compare
+latch cstddef
+latch cstdint
+latch cstdlib
+latch cstring
+latch ctime
+latch limits
+latch ratio
+latch type_traits
+latch version
+limits cstdint
+limits type_traits
+limits version
+list algorithm
+list array
+list atomic
+list bit
+list cctype
+list cerrno
+list climits
+list clocale
+list cmath
+list compare
+list concepts
+list cstdarg
+list cstddef
+list cstdint
+list cstdio
+list cstdlib
+list cstring
+list ctime
+list cwchar
+list cwctype
+list exception
+list functional
+list initializer_list
+list ios
+list iosfwd
+list iterator
+list limits
+list locale
+list memory
+list mutex
+list new
+list optional
+list ratio
+list stdexcept
+list streambuf
+list string
+list string_view
+list system_error
+list tuple
+list type_traits
+list typeinfo
+list unordered_map
+list utility
+list variant
+list vector
+list version
+locale algorithm
+locale atomic
+locale bit
+locale cctype
+locale cerrno
+locale climits
+locale clocale
+locale cmath
+locale compare
+locale concepts
+locale cstdarg
+locale cstddef
+locale cstdint
+locale cstdio
+locale cstdlib
+locale cstring
+locale ctime
+locale cwchar
+locale cwctype
+locale exception
+locale initializer_list
+locale ios
+locale iosfwd
+locale iterator
+locale limits
+locale memory
+locale mutex
+locale new
+locale optional
+locale ratio
+locale stdexcept
+locale streambuf
+locale string
+locale string_view
+locale system_error
+locale tuple
+locale type_traits
+locale typeinfo
+locale utility
+locale variant
+locale version
+map algorithm
+map array
+map atomic
+map bit
+map cctype
+map cerrno
+map climits
+map clocale
+map cmath
+map compare
+map concepts
+map cstdarg
+map cstddef
+map cstdint
+map cstdio
+map cstdlib
+map cstring
+map ctime
+map cwchar
+map cwctype
+map exception
+map functional
+map initializer_list
+map ios
+map iosfwd
+map iterator
+map limits
+map locale
+map memory
+map mutex
+map new
+map optional
+map ratio
+map stdexcept
+map streambuf
+map string
+map string_view
+map system_error
+map tuple
+map type_traits
+map typeinfo
+map unordered_map
+map utility
+map variant
+map vector
+map version
+mdspan version
+memory atomic
+memory cctype
+memory climits
+memory cmath
+memory compare
+memory concepts
+memory cstddef
+memory cstdint
+memory cstdio
+memory cstdlib
+memory cstring
+memory ctime
+memory cwchar
+memory cwctype
+memory exception
+memory initializer_list
+memory iosfwd
+memory iterator
+memory limits
+memory new
+memory ratio
+memory stdexcept
+memory tuple
+memory type_traits
+memory typeinfo
+memory utility
+memory variant
+memory version
+memory_resource cstddef
+memory_resource cstdint
+memory_resource cstdlib
+memory_resource exception
+memory_resource iosfwd
+memory_resource new
+memory_resource stdexcept
+memory_resource type_traits
+memory_resource typeinfo
+memory_resource version
+mutex algorithm
+mutex atomic
+mutex bit
+mutex cctype
+mutex cerrno
+mutex climits
+mutex cmath
+mutex compare
+mutex concepts
+mutex cstddef
+mutex cstdint
+mutex cstdio
+mutex cstdlib
+mutex cstring
+mutex ctime
+mutex cwchar
+mutex cwctype
+mutex exception
+mutex initializer_list
+mutex iosfwd
+mutex iterator
+mutex limits
+mutex memory
+mutex new
+mutex optional
+mutex ratio
+mutex stdexcept
+mutex string
+mutex string_view
+mutex system_error
+mutex tuple
+mutex type_traits
+mutex typeinfo
+mutex utility
+mutex variant
+mutex version
+new cstddef
+new cstdint
+new cstdlib
+new type_traits
+new version
+numbers concepts
+numbers cstddef
+numbers cstdint
+numbers type_traits
+numbers version
+numeric algorithm
+numeric array
+numeric atomic
+numeric bit
+numeric cctype
+numeric cerrno
+numeric climits
+numeric clocale
+numeric cmath
+numeric compare
+numeric concepts
+numeric cstdarg
+numeric cstddef
+numeric cstdint
+numeric cstdio
+numeric cstdlib
+numeric cstring
+numeric ctime
+numeric cwchar
+numeric cwctype
+numeric exception
+numeric execution
+numeric functional
+numeric initializer_list
+numeric ios
+numeric iosfwd
+numeric iterator
+numeric limits
+numeric locale
+numeric memory
+numeric mutex
+numeric new
+numeric optional
+numeric ratio
+numeric stdexcept
+numeric streambuf
+numeric string
+numeric string_view
+numeric system_error
+numeric tuple
+numeric type_traits
+numeric typeinfo
+numeric unordered_map
+numeric utility
+numeric variant
+numeric vector
+numeric version
+optional atomic
+optional cctype
+optional climits
+optional cmath
+optional compare
+optional concepts
+optional cstddef
+optional cstdint
+optional cstdio
+optional cstdlib
+optional cstring
+optional ctime
+optional cwchar
+optional cwctype
+optional exception
+optional initializer_list
+optional iosfwd
+optional iterator
+optional limits
+optional memory
+optional new
+optional ratio
+optional stdexcept
+optional tuple
+optional type_traits
+optional typeinfo
+optional utility
+optional variant
+optional version
+ostream algorithm
+ostream array
+ostream atomic
+ostream bit
+ostream bitset
+ostream cctype
+ostream cerrno
+ostream climits
+ostream clocale
+ostream cmath
+ostream compare
+ostream concepts
+ostream cstdarg
+ostream cstddef
+ostream cstdint
+ostream cstdio
+ostream cstdlib
+ostream cstring
+ostream ctime
+ostream cwchar
+ostream cwctype
+ostream deque
+ostream exception
+ostream format
+ostream functional
+ostream initializer_list
+ostream ios
+ostream iosfwd
+ostream iterator
+ostream limits
+ostream locale
+ostream memory
+ostream mutex
+ostream new
+ostream optional
+ostream print
+ostream queue
+ostream ratio
+ostream stack
+ostream stdexcept
+ostream streambuf
+ostream string
+ostream string_view
+ostream system_error
+ostream tuple
+ostream type_traits
+ostream typeinfo
+ostream unordered_map
+ostream utility
+ostream variant
+ostream vector
+ostream version
+print algorithm
+print array
+print atomic
+print bit
+print cctype
+print cerrno
+print climits
+print clocale
+print cmath
+print compare
+print concepts
+print cstdarg
+print cstddef
+print cstdint
+print cstdio
+print cstdlib
+print cstring
+print ctime
+print cwchar
+print cwctype
+print deque
+print exception
+print format
+print functional
+print initializer_list
+print ios
+print iosfwd
+print iterator
+print limits
+print locale
+print memory
+print mutex
+print new
+print optional
+print queue
+print ratio
+print stack
+print stdexcept
+print streambuf
+print string
+print string_view
+print system_error
+print tuple
+print type_traits
+print typeinfo
+print unordered_map
+print utility
+print variant
+print vector
+print version
+queue algorithm
+queue array
+queue atomic
+queue bit
+queue cctype
+queue cerrno
+queue climits
+queue clocale
+queue cmath
+queue compare
+queue concepts
+queue cstdarg
+queue cstddef
+queue cstdint
+queue cstdio
+queue cstdlib
+queue cstring
+queue ctime
+queue cwchar
+queue cwctype
+queue deque
+queue exception
+queue functional
+queue initializer_list
+queue ios
+queue iosfwd
+queue iterator
+queue limits
+queue locale
+queue memory
+queue mutex
+queue new
+queue optional
+queue ratio
+queue stdexcept
+queue streambuf
+queue string
+queue string_view
+queue system_error
+queue tuple
+queue type_traits
+queue typeinfo
+queue unordered_map
+queue utility
+queue variant
+queue vector
+queue version
+random algorithm
+random array
+random atomic
+random bit
+random cctype
+random cerrno
+random climits
+random clocale
+random cmath
+random compare
+random concepts
+random cstdarg
+random cstddef
+random cstdint
+random cstdio
+random cstdlib
+random cstring
+random ctime
+random cwchar
+random cwctype
+random exception
+random execution
+random functional
+random initializer_list
+random ios
+random iosfwd
+random iterator
+random limits
+random locale
+random memory
+random mutex
+random new
+random numeric
+random optional
+random ratio
+random stdexcept
+random streambuf
+random string
+random string_view
+random system_error
+random tuple
+random type_traits
+random typeinfo
+random unordered_map
+random utility
+random variant
+random vector
+random version
+ranges cctype
+ranges cmath
+ranges compare
+ranges concepts
+ranges cstddef
+ranges cstdint
+ranges cstdio
+ranges cstdlib
+ranges cstring
+ranges cwchar
+ranges cwctype
+ranges exception
+ranges initializer_list
+ranges iosfwd
+ranges iterator
+ranges limits
+ranges new
+ranges tuple
+ranges type_traits
+ranges typeinfo
+ranges utility
+ranges variant
+ranges version
+ratio climits
+ratio cstdint
+ratio type_traits
+ratio version
+regex algorithm
+regex array
+regex atomic
+regex bit
+regex cctype
+regex cerrno
+regex climits
+regex clocale
+regex cmath
+regex compare
+regex concepts
+regex cstdarg
+regex cstddef
+regex cstdint
+regex cstdio
+regex cstdlib
+regex cstring
+regex ctime
+regex cwchar
+regex cwctype
+regex deque
+regex exception
+regex functional
+regex initializer_list
+regex ios
+regex iosfwd
+regex iterator
+regex limits
+regex locale
+regex memory
+regex mutex
+regex new
+regex optional
+regex ratio
+regex stdexcept
+regex streambuf
+regex string
+regex string_view
+regex system_error
+regex tuple
+regex type_traits
+regex typeinfo
+regex unordered_map
+regex utility
+regex variant
+regex vector
+regex version
+scoped_allocator atomic
+scoped_allocator cctype
+scoped_allocator climits
+scoped_allocator cmath
+scoped_allocator compare
+scoped_allocator concepts
+scoped_allocator cstddef
+scoped_allocator cstdint
+scoped_allocator cstdio
+scoped_allocator cstdlib
+scoped_allocator cstring
+scoped_allocator ctime
+scoped_allocator cwchar
+scoped_allocator cwctype
+scoped_allocator exception
+scoped_allocator initializer_list
+scoped_allocator iosfwd
+scoped_allocator iterator
+scoped_allocator limits
+scoped_allocator memory
+scoped_allocator new
+scoped_allocator ratio
+scoped_allocator stdexcept
+scoped_allocator tuple
+scoped_allocator type_traits
+scoped_allocator typeinfo
+scoped_allocator utility
+scoped_allocator variant
+scoped_allocator version
+semaphore atomic
+semaphore climits
+semaphore cmath
+semaphore compare
+semaphore cstddef
+semaphore cstdint
+semaphore cstdlib
+semaphore cstring
+semaphore ctime
+semaphore limits
+semaphore ratio
+semaphore type_traits
+semaphore version
+set algorithm
+set array
+set atomic
+set bit
+set cctype
+set cerrno
+set climits
+set clocale
+set cmath
+set compare
+set concepts
+set cstdarg
+set cstddef
+set cstdint
+set cstdio
+set cstdlib
+set cstring
+set ctime
+set cwchar
+set cwctype
+set exception
+set functional
+set initializer_list
+set ios
+set iosfwd
+set iterator
+set limits
+set locale
+set memory
+set mutex
+set new
+set optional
+set ratio
+set stdexcept
+set streambuf
+set string
+set string_view
+set system_error
+set tuple
+set type_traits
+set typeinfo
+set unordered_map
+set utility
+set variant
+set vector
+set version
+shared_mutex algorithm
+shared_mutex atomic
+shared_mutex bit
+shared_mutex cctype
+shared_mutex cerrno
+shared_mutex climits
+shared_mutex cmath
+shared_mutex compare
+shared_mutex concepts
+shared_mutex cstddef
+shared_mutex cstdint
+shared_mutex cstdio
+shared_mutex cstdlib
+shared_mutex cstring
+shared_mutex ctime
+shared_mutex cwchar
+shared_mutex cwctype
+shared_mutex exception
+shared_mutex initializer_list
+shared_mutex iosfwd
+shared_mutex iterator
+shared_mutex limits
+shared_mutex memory
+shared_mutex new
+shared_mutex optional
+shared_mutex ratio
+shared_mutex stdexcept
+shared_mutex string
+shared_mutex string_view
+shared_mutex system_error
+shared_mutex tuple
+shared_mutex type_traits
+shared_mutex typeinfo
+shared_mutex utility
+shared_mutex variant
+shared_mutex version
+source_location cstdint
+source_location version
+span algorithm
+span array
+span atomic
+span bit
+span cctype
+span cerrno
+span climits
+span clocale
+span cmath
+span compare
+span concepts
+span cstdarg
+span cstddef
+span cstdint
+span cstdio
+span cstdlib
+span cstring
+span ctime
+span cwchar
+span cwctype
+span exception
+span functional
+span initializer_list
+span ios
+span iosfwd
+span iterator
+span limits
+span locale
+span memory
+span mutex
+span new
+span optional
+span ratio
+span stdexcept
+span streambuf
+span string
+span string_view
+span system_error
+span tuple
+span type_traits
+span typeinfo
+span unordered_map
+span utility
+span variant
+span vector
+span version
+sstream algorithm
+sstream array
+sstream atomic
+sstream bit
+sstream bitset
+sstream cctype
+sstream cerrno
+sstream climits
+sstream clocale
+sstream cmath
+sstream compare
+sstream concepts
+sstream cstdarg
+sstream cstddef
+sstream cstdint
+sstream cstdio
+sstream cstdlib
+sstream cstring
+sstream ctime
+sstream cwchar
+sstream cwctype
+sstream deque
+sstream exception
+sstream format
+sstream functional
+sstream initializer_list
+sstream ios
+sstream iosfwd
+sstream istream
+sstream iterator
+sstream limits
+sstream locale
+sstream memory
+sstream mutex
+sstream new
+sstream optional
+sstream ostream
+sstream print
+sstream queue
+sstream ratio
+sstream stack
+sstream stdexcept
+sstream streambuf
+sstream string
+sstream string_view
+sstream system_error
+sstream tuple
+sstream type_traits
+sstream typeinfo
+sstream unordered_map
+sstream utility
+sstream variant
+sstream vector
+sstream version
+stack algorithm
+stack array
+stack atomic
+stack bit
+stack cctype
+stack cerrno
+stack climits
+stack clocale
+stack cmath
+stack compare
+stack concepts
+stack cstdarg
+stack cstddef
+stack cstdint
+stack cstdio
+stack cstdlib
+stack cstring
+stack ctime
+stack cwchar
+stack cwctype
+stack deque
+stack exception
+stack functional
+stack initializer_list
+stack ios
+stack iosfwd
+stack iterator
+stack limits
+stack locale
+stack memory
+stack mutex
+stack new
+stack optional
+stack ratio
+stack stdexcept
+stack streambuf
+stack string
+stack string_view
+stack system_error
+stack tuple
+stack type_traits
+stack typeinfo
+stack unordered_map
+stack utility
+stack variant
+stack vector
+stack version
+stdexcept cstddef
+stdexcept cstdint
+stdexcept cstdlib
+stdexcept exception
+stdexcept iosfwd
+stdexcept new
+stdexcept type_traits
+stdexcept typeinfo
+stdexcept version
+stop_token iosfwd
+stop_token version
+streambuf algorithm
+streambuf atomic
+streambuf bit
+streambuf cctype
+streambuf cerrno
+streambuf climits
+streambuf clocale
+streambuf cmath
+streambuf compare
+streambuf concepts
+streambuf cstddef
+streambuf cstdint
+streambuf cstdio
+streambuf cstdlib
+streambuf cstring
+streambuf ctime
+streambuf cwchar
+streambuf cwctype
+streambuf exception
+streambuf initializer_list
+streambuf ios
+streambuf iosfwd
+streambuf iterator
+streambuf limits
+streambuf memory
+streambuf mutex
+streambuf new
+streambuf optional
+streambuf ratio
+streambuf stdexcept
+streambuf string
+streambuf string_view
+streambuf system_error
+streambuf tuple
+streambuf type_traits
+streambuf typeinfo
+streambuf utility
+streambuf variant
+streambuf version
+string algorithm
+string atomic
+string bit
+string cctype
+string climits
+string cmath
+string compare
+string concepts
+string cstddef
+string cstdint
+string cstdio
+string cstdlib
+string cstring
+string ctime
+string cwchar
+string cwctype
+string exception
+string initializer_list
+string iosfwd
+string iterator
+string limits
+string memory
+string new
+string optional
+string ratio
+string stdexcept
+string string_view
+string tuple
+string type_traits
+string typeinfo
+string utility
+string variant
+string version
+string_view algorithm
+string_view atomic
+string_view bit
+string_view cctype
+string_view climits
+string_view cmath
+string_view compare
+string_view concepts
+string_view cstddef
+string_view cstdint
+string_view cstdio
+string_view cstdlib
+string_view cstring
+string_view ctime
+string_view cwchar
+string_view cwctype
+string_view exception
+string_view initializer_list
+string_view iosfwd
+string_view iterator
+string_view limits
+string_view memory
+string_view new
+string_view optional
+string_view ratio
+string_view stdexcept
+string_view tuple
+string_view type_traits
+string_view typeinfo
+string_view utility
+string_view variant
+string_view version
+strstream algorithm
+strstream array
+strstream atomic
+strstream bit
+strstream bitset
+strstream cctype
+strstream cerrno
+strstream climits
+strstream clocale
+strstream cmath
+strstream compare
+strstream concepts
+strstream cstdarg
+strstream cstddef
+strstream cstdint
+strstream cstdio
+strstream cstdlib
+strstream cstring
+strstream ctime
+strstream cwchar
+strstream cwctype
+strstream deque
+strstream exception
+strstream format
+strstream functional
+strstream initializer_list
+strstream ios
+strstream iosfwd
+strstream istream
+strstream iterator
+strstream limits
+strstream locale
+strstream memory
+strstream mutex
+strstream new
+strstream optional
+strstream ostream
+strstream print
+strstream queue
+strstream ratio
+strstream stack
+strstream stdexcept
+strstream streambuf
+strstream string
+strstream string_view
+strstream system_error
+strstream tuple
+strstream type_traits
+strstream typeinfo
+strstream unordered_map
+strstream utility
+strstream variant
+strstream vector
+strstream version
+syncstream algorithm
+syncstream array
+syncstream atomic
+syncstream bit
+syncstream bitset
+syncstream cctype
+syncstream cerrno
+syncstream climits
+syncstream clocale
+syncstream cmath
+syncstream compare
+syncstream concepts
+syncstream cstdarg
+syncstream cstddef
+syncstream cstdint
+syncstream cstdio
+syncstream cstdlib
+syncstream cstring
+syncstream ctime
+syncstream cwchar
+syncstream cwctype
+syncstream deque
+syncstream exception
+syncstream format
+syncstream functional
+syncstream initializer_list
+syncstream ios
+syncstream iosfwd
+syncstream iterator
+syncstream limits
+syncstream locale
+syncstream map
+syncstream memory
+syncstream mutex
+syncstream new
+syncstream optional
+syncstream ostream
+syncstream print
+syncstream queue
+syncstream ratio
+syncstream shared_mutex
+syncstream stack
+syncstream stdexcept
+syncstream streambuf
+syncstream string
+syncstream string_view
+syncstream system_error
+syncstream tuple
+syncstream type_traits
+syncstream typeinfo
+syncstream unordered_map
+syncstream utility
+syncstream variant
+syncstream vector
+syncstream version
+system_error algorithm
+system_error atomic
+system_error bit
+system_error cctype
+system_error cerrno
+system_error climits
+system_error cmath
+system_error compare
+system_error concepts
+system_error cstddef
+system_error cstdint
+system_error cstdio
+system_error cstdlib
+system_error cstring
+system_error ctime
+system_error cwchar
+system_error cwctype
+system_error exception
+system_error initializer_list
+system_error iosfwd
+system_error iterator
+system_error limits
+system_error memory
+system_error new
+system_error optional
+system_error ratio
+system_error stdexcept
+system_error string
+system_error string_view
+system_error tuple
+system_error type_traits
+system_error typeinfo
+system_error utility
+system_error variant
+system_error version
+thread algorithm
+thread array
+thread atomic
+thread bit
+thread bitset
+thread cctype
+thread cerrno
+thread chrono
+thread climits
+thread clocale
+thread cmath
+thread compare
+thread concepts
+thread cstdarg
+thread cstddef
+thread cstdint
+thread cstdio
+thread cstdlib
+thread cstring
+thread ctime
+thread cwchar
+thread cwctype
+thread deque
+thread exception
+thread format
+thread forward_list
+thread functional
+thread initializer_list
+thread ios
+thread iosfwd
+thread istream
+thread iterator
+thread limits
+thread locale
+thread memory
+thread mutex
+thread new
+thread optional
+thread ostream
+thread print
+thread queue
+thread ratio
+thread sstream
+thread stack
+thread stdexcept
+thread streambuf
+thread string
+thread string_view
+thread system_error
+thread tuple
+thread type_traits
+thread typeinfo
+thread unordered_map
+thread utility
+thread variant
+thread vector
+thread version
+tuple cmath
+tuple compare
+tuple cstddef
+tuple cstdint
+tuple cstdlib
+tuple exception
+tuple initializer_list
+tuple iosfwd
+tuple limits
+tuple new
+tuple type_traits
+tuple typeinfo
+tuple utility
+tuple version
+type_traits cstdint
+type_traits version
+typeindex cmath
+typeindex compare
+typeindex cstddef
+typeindex cstdint
+typeindex cstdlib
+typeindex initializer_list
+typeindex iosfwd
+typeindex limits
+typeindex new
+typeindex type_traits
+typeindex typeinfo
+typeindex utility
+typeindex version
+typeinfo cstddef
+typeinfo cstdint
+typeinfo cstdlib
+typeinfo type_traits
+typeinfo version
+unordered_map algorithm
+unordered_map atomic
+unordered_map bit
+unordered_map cctype
+unordered_map climits
+unordered_map cmath
+unordered_map compare
+unordered_map concepts
+unordered_map cstddef
+unordered_map cstdint
+unordered_map cstdio
+unordered_map cstdlib
+unordered_map cstring
+unordered_map ctime
+unordered_map cwchar
+unordered_map cwctype
+unordered_map exception
+unordered_map initializer_list
+unordered_map iosfwd
+unordered_map iterator
+unordered_map limits
+unordered_map memory
+unordered_map new
+unordered_map optional
+unordered_map ratio
+unordered_map stdexcept
+unordered_map tuple
+unordered_map type_traits
+unordered_map typeinfo
+unordered_map utility
+unordered_map variant
+unordered_map version
+unordered_set algorithm
+unordered_set array
+unordered_set atomic
+unordered_set bit
+unordered_set cctype
+unordered_set cerrno
+unordered_set climits
+unordered_set clocale
+unordered_set cmath
+unordered_set compare
+unordered_set concepts
+unordered_set cstdarg
+unordered_set cstddef
+unordered_set cstdint
+unordered_set cstdio
+unordered_set cstdlib
+unordered_set cstring
+unordered_set ctime
+unordered_set cwchar
+unordered_set cwctype
+unordered_set exception
+unordered_set functional
+unordered_set initializer_list
+unordered_set ios
+unordered_set iosfwd
+unordered_set iterator
+unordered_set limits
+unordered_set locale
+unordered_set memory
+unordered_set mutex
+unordered_set new
+unordered_set optional
+unordered_set ratio
+unordered_set stdexcept
+unordered_set streambuf
+unordered_set string
+unordered_set string_view
+unordered_set system_error
+unordered_set tuple
+unordered_set type_traits
+unordered_set typeinfo
+unordered_set unordered_map
+unordered_set utility
+unordered_set variant
+unordered_set vector
+unordered_set version
+utility cmath
+utility compare
+utility cstddef
+utility cstdint
+utility cstdlib
+utility initializer_list
+utility iosfwd
+utility limits
+utility type_traits
+utility version
+valarray algorithm
+valarray array
+valarray atomic
+valarray bit
+valarray cctype
+valarray cerrno
+valarray climits
+valarray clocale
+valarray cmath
+valarray compare
+valarray concepts
+valarray cstdarg
+valarray cstddef
+valarray cstdint
+valarray cstdio
+valarray cstdlib
+valarray cstring
+valarray ctime
+valarray cwchar
+valarray cwctype
+valarray exception
+valarray functional
+valarray initializer_list
+valarray ios
+valarray iosfwd
+valarray iterator
+valarray limits
+valarray locale
+valarray memory
+valarray mutex
+valarray new
+valarray optional
+valarray ratio
+valarray stdexcept
+valarray streambuf
+valarray string
+valarray string_view
+valarray system_error
+valarray tuple
+valarray type_traits
+valarray typeinfo
+valarray unordered_map
+valarray utility
+valarray variant
+valarray vector
+valarray version
+variant cmath
+variant compare
+variant cstddef
+variant cstdint
+variant cstdlib
+variant cstring
+variant exception
+variant initializer_list
+variant iosfwd
+variant limits
+variant new
+variant tuple
+variant type_traits
+variant typeinfo
+variant utility
+variant version
+vector algorithm
+vector array
+vector atomic
+vector bit
+vector cctype
+vector cerrno
+vector climits
+vector clocale
+vector cmath
+vector compare
+vector concepts
+vector cstdarg
+vector cstddef
+vector cstdint
+vector cstdio
+vector cstdlib
+vector cstring
+vector ctime
+vector cwchar
+vector cwctype
+vector exception
+vector initializer_list
+vector ios
+vector iosfwd
+vector iterator
+vector limits
+vector locale
+vector memory
+vector mutex
+vector new
+vector optional
+vector ratio
+vector stdexcept
+vector streambuf
+vector string
+vector string_view
+vector system_error
+vector tuple
+vector type_traits
+vector typeinfo
+vector utility
+vector variant
+vector version
diff --git a/libcxx/test/libcxx-03/transitive_includes/cxx14.csv b/libcxx/test/libcxx-03/transitive_includes/cxx14.csv
new file mode 100644
index 0000000000000..c2eb5b44e8d7a
--- /dev/null
+++ b/libcxx/test/libcxx-03/transitive_includes/cxx14.csv
@@ -0,0 +1,2619 @@
+algorithm atomic
+algorithm bit
+algorithm cctype
+algorithm climits
+algorithm cmath
+algorithm compare
+algorithm concepts
+algorithm cstddef
+algorithm cstdint
+algorithm cstdio
+algorithm cstdlib
+algorithm cstring
+algorithm ctime
+algorithm cwchar
+algorithm cwctype
+algorithm exception
+algorithm execution
+algorithm initializer_list
+algorithm iosfwd
+algorithm iterator
+algorithm limits
+algorithm memory
+algorithm new
+algorithm optional
+algorithm ratio
+algorithm stdexcept
+algorithm tuple
+algorithm type_traits
+algorithm typeinfo
+algorithm utility
+algorithm variant
+algorithm version
+any algorithm
+any array
+any atomic
+any bit
+any cctype
+any cerrno
+any chrono
+any climits
+any clocale
+any cmath
+any compare
+any concepts
+any cstdarg
+any cstddef
+any cstdint
+any cstdio
+any cstdlib
+any cstring
+any ctime
+any cwchar
+any cwctype
+any exception
+any execution
+any forward_list
+any functional
+any initializer_list
+any ios
+any iosfwd
+any iterator
+any limits
+any locale
+any memory
+any mutex
+any new
+any optional
+any ratio
+any stdexcept
+any streambuf
+any string
+any string_view
+any system_error
+any tuple
+any type_traits
+any typeinfo
+any unordered_map
+any utility
+any variant
+any vector
+any version
+array algorithm
+array atomic
+array bit
+array cctype
+array climits
+array cmath
+array compare
+array concepts
+array cstddef
+array cstdint
+array cstdio
+array cstdlib
+array cstring
+array ctime
+array cwchar
+array cwctype
+array exception
+array execution
+array initializer_list
+array iosfwd
+array iterator
+array limits
+array memory
+array new
+array optional
+array ratio
+array stdexcept
+array tuple
+array type_traits
+array typeinfo
+array utility
+array variant
+array version
+atomic climits
+atomic cmath
+atomic compare
+atomic cstddef
+atomic cstdint
+atomic cstdlib
+atomic cstring
+atomic ctime
+atomic limits
+atomic ratio
+atomic type_traits
+atomic version
+barrier atomic
+barrier climits
+barrier cmath
+barrier compare
+barrier concepts
+barrier cstddef
+barrier cstdint
+barrier cstdlib
+barrier cstring
+barrier ctime
+barrier exception
+barrier initializer_list
+barrier iosfwd
+barrier iterator
+barrier limits
+barrier memory
+barrier new
+barrier ratio
+barrier stdexcept
+barrier tuple
+barrier type_traits
+barrier typeinfo
+barrier utility
+barrier variant
+barrier version
+bit cstdint
+bit cstdlib
+bit iosfwd
+bit limits
+bit type_traits
+bit version
+bitset algorithm
+bitset atomic
+bitset bit
+bitset cctype
+bitset climits
+bitset cmath
+bitset compare
+bitset concepts
+bitset cstddef
+bitset cstdint
+bitset cstdio
+bitset cstdlib
+bitset cstring
+bitset ctime
+bitset cwchar
+bitset cwctype
+bitset exception
+bitset execution
+bitset initializer_list
+bitset iosfwd
+bitset iterator
+bitset limits
+bitset memory
+bitset new
+bitset optional
+bitset ratio
+bitset stdexcept
+bitset string
+bitset string_view
+bitset tuple
+bitset type_traits
+bitset typeinfo
+bitset utility
+bitset variant
+bitset version
+ccomplex algorithm
+ccomplex array
+ccomplex atomic
+ccomplex bit
+ccomplex bitset
+ccomplex cctype
+ccomplex cerrno
+ccomplex climits
+ccomplex clocale
+ccomplex cmath
+ccomplex compare
+ccomplex complex
+ccomplex concepts
+ccomplex cstdarg
+ccomplex cstddef
+ccomplex cstdint
+ccomplex cstdio
+ccomplex cstdlib
+ccomplex cstring
+ccomplex ctime
+ccomplex cwchar
+ccomplex cwctype
+ccomplex deque
+ccomplex exception
+ccomplex execution
+ccomplex format
+ccomplex functional
+ccomplex initializer_list
+ccomplex ios
+ccomplex iosfwd
+ccomplex istream
+ccomplex iterator
+ccomplex limits
+ccomplex locale
+ccomplex memory
+ccomplex mutex
+ccomplex new
+ccomplex optional
+ccomplex ostream
+ccomplex print
+ccomplex queue
+ccomplex ratio
+ccomplex sstream
+ccomplex stack
+ccomplex stdexcept
+ccomplex streambuf
+ccomplex string
+ccomplex string_view
+ccomplex system_error
+ccomplex tuple
+ccomplex type_traits
+ccomplex typeinfo
+ccomplex unordered_map
+ccomplex utility
+ccomplex variant
+ccomplex vector
+ccomplex version
+charconv cmath
+charconv concepts
+charconv cstddef
+charconv cstdint
+charconv cstdlib
+charconv cstring
+charconv iosfwd
+charconv limits
+charconv new
+charconv type_traits
+charconv version
+chrono algorithm
+chrono array
+chrono atomic
+chrono bit
+chrono cctype
+chrono cerrno
+chrono climits
+chrono clocale
+chrono cmath
+chrono compare
+chrono concepts
+chrono cstdarg
+chrono cstddef
+chrono cstdint
+chrono cstdio
+chrono cstdlib
+chrono cstring
+chrono ctime
+chrono cwchar
+chrono cwctype
+chrono exception
+chrono execution
+chrono forward_list
+chrono functional
+chrono initializer_list
+chrono ios
+chrono iosfwd
+chrono iterator
+chrono limits
+chrono locale
+chrono memory
+chrono mutex
+chrono new
+chrono optional
+chrono ratio
+chrono stdexcept
+chrono streambuf
+chrono string
+chrono string_view
+chrono system_error
+chrono tuple
+chrono type_traits
+chrono typeinfo
+chrono unordered_map
+chrono utility
+chrono variant
+chrono vector
+chrono version
+cinttypes cstdint
+cmath cstdint
+cmath limits
+cmath type_traits
+cmath version
+codecvt algorithm
+codecvt atomic
+codecvt bit
+codecvt cctype
+codecvt cerrno
+codecvt climits
+codecvt clocale
+codecvt cmath
+codecvt compare
+codecvt concepts
+codecvt cstddef
+codecvt cstdint
+codecvt cstdio
+codecvt cstdlib
+codecvt cstring
+codecvt ctime
+codecvt cwchar
+codecvt cwctype
+codecvt exception
+codecvt execution
+codecvt initializer_list
+codecvt iosfwd
+codecvt iterator
+codecvt limits
+codecvt memory
+codecvt mutex
+codecvt new
+codecvt optional
+codecvt ratio
+codecvt stdexcept
+codecvt string
+codecvt string_view
+codecvt system_error
+codecvt tuple
+codecvt type_traits
+codecvt typeinfo
+codecvt utility
+codecvt variant
+codecvt version
+compare cmath
+compare cstddef
+compare cstdint
+compare limits
+compare type_traits
+compare version
+complex algorithm
+complex array
+complex atomic
+complex bit
+complex bitset
+complex cctype
+complex cerrno
+complex climits
+complex clocale
+complex cmath
+complex compare
+complex concepts
+complex cstdarg
+complex cstddef
+complex cstdint
+complex cstdio
+complex cstdlib
+complex cstring
+complex ctime
+complex cwchar
+complex cwctype
+complex deque
+complex exception
+complex execution
+complex format
+complex functional
+complex initializer_list
+complex ios
+complex iosfwd
+complex istream
+complex iterator
+complex limits
+complex locale
+complex memory
+complex mutex
+complex new
+complex optional
+complex ostream
+complex print
+complex queue
+complex ratio
+complex sstream
+complex stack
+complex stdexcept
+complex streambuf
+complex string
+complex string_view
+complex system_error
+complex tuple
+complex type_traits
+complex typeinfo
+complex unordered_map
+complex utility
+complex variant
+complex vector
+complex version
+concepts cstddef
+concepts cstdint
+concepts type_traits
+concepts version
+condition_variable algorithm
+condition_variable atomic
+condition_variable bit
+condition_variable cctype
+condition_variable cerrno
+condition_variable climits
+condition_variable cmath
+condition_variable compare
+condition_variable concepts
+condition_variable cstddef
+condition_variable cstdint
+condition_variable cstdio
+condition_variable cstdlib
+condition_variable cstring
+condition_variable ctime
+condition_variable cwchar
+condition_variable cwctype
+condition_variable exception
+condition_variable execution
+condition_variable initializer_list
+condition_variable iosfwd
+condition_variable iterator
+condition_variable limits
+condition_variable memory
+condition_variable new
+condition_variable optional
+condition_variable ratio
+condition_variable stdexcept
+condition_variable string
+condition_variable string_view
+condition_variable system_error
+condition_variable tuple
+condition_variable type_traits
+condition_variable typeinfo
+condition_variable utility
+condition_variable variant
+condition_variable version
+coroutine cmath
+coroutine compare
+coroutine cstddef
+coroutine cstdint
+coroutine iosfwd
+coroutine limits
+coroutine type_traits
+coroutine version
+cstddef version
+ctgmath algorithm
+ctgmath array
+ctgmath atomic
+ctgmath bit
+ctgmath bitset
+ctgmath cctype
+ctgmath cerrno
+ctgmath climits
+ctgmath clocale
+ctgmath cmath
+ctgmath compare
+ctgmath complex
+ctgmath concepts
+ctgmath cstdarg
+ctgmath cstddef
+ctgmath cstdint
+ctgmath cstdio
+ctgmath cstdlib
+ctgmath cstring
+ctgmath ctime
+ctgmath cwchar
+ctgmath cwctype
+ctgmath deque
+ctgmath exception
+ctgmath execution
+ctgmath format
+ctgmath functional
+ctgmath initializer_list
+ctgmath ios
+ctgmath iosfwd
+ctgmath istream
+ctgmath iterator
+ctgmath limits
+ctgmath locale
+ctgmath memory
+ctgmath mutex
+ctgmath new
+ctgmath optional
+ctgmath ostream
+ctgmath print
+ctgmath queue
+ctgmath ratio
+ctgmath sstream
+ctgmath stack
+ctgmath stdexcept
+ctgmath streambuf
+ctgmath string
+ctgmath string_view
+ctgmath system_error
+ctgmath tuple
+ctgmath type_traits
+ctgmath typeinfo
+ctgmath unordered_map
+ctgmath utility
+ctgmath variant
+ctgmath vector
+ctgmath version
+cwchar cctype
+cwchar cstddef
+cwchar cwctype
+cwchar version
+cwctype cctype
+deque algorithm
+deque array
+deque atomic
+deque bit
+deque cctype
+deque cerrno
+deque climits
+deque clocale
+deque cmath
+deque compare
+deque concepts
+deque cstdarg
+deque cstddef
+deque cstdint
+deque cstdio
+deque cstdlib
+deque cstring
+deque ctime
+deque cwchar
+deque cwctype
+deque exception
+deque execution
+deque functional
+deque initializer_list
+deque ios
+deque iosfwd
+deque iterator
+deque limits
+deque locale
+deque memory
+deque mutex
+deque new
+deque optional
+deque ratio
+deque stdexcept
+deque streambuf
+deque string
+deque string_view
+deque system_error
+deque tuple
+deque type_traits
+deque typeinfo
+deque unordered_map
+deque utility
+deque variant
+deque vector
+deque version
+exception cstddef
+exception cstdint
+exception cstdlib
+exception new
+exception type_traits
+exception typeinfo
+exception version
+execution cstddef
+execution version
+expected version
+experimental/iterator algorithm
+experimental/iterator atomic
+experimental/iterator bit
+experimental/iterator bitset
+experimental/iterator cctype
+experimental/iterator cerrno
+experimental/iterator climits
+experimental/iterator clocale
+experimental/iterator cmath
+experimental/iterator compare
+experimental/iterator concepts
+experimental/iterator cstdarg
+experimental/iterator cstddef
+experimental/iterator cstdint
+experimental/iterator cstdio
+experimental/iterator cstdlib
+experimental/iterator cstring
+experimental/iterator ctime
+experimental/iterator cwchar
+experimental/iterator cwctype
+experimental/iterator exception
+experimental/iterator execution
+experimental/iterator initializer_list
+experimental/iterator ios
+experimental/iterator iosfwd
+experimental/iterator iterator
+experimental/iterator limits
+experimental/iterator locale
+experimental/iterator memory
+experimental/iterator mutex
+experimental/iterator new
+experimental/iterator optional
+experimental/iterator ratio
+experimental/iterator stdexcept
+experimental/iterator streambuf
+experimental/iterator string
+experimental/iterator string_view
+experimental/iterator system_error
+experimental/iterator tuple
+experimental/iterator type_traits
+experimental/iterator typeinfo
+experimental/iterator utility
+experimental/iterator variant
+experimental/iterator version
+experimental/memory cstddef
+experimental/memory cstdint
+experimental/memory cstring
+experimental/memory limits
+experimental/memory type_traits
+experimental/memory version
+experimental/propagate_const cstddef
+experimental/propagate_const cstdint
+experimental/propagate_const type_traits
+experimental/propagate_const version
+experimental/simd cstddef
+experimental/simd cstdint
+experimental/simd limits
+experimental/simd type_traits
+experimental/simd version
+experimental/type_traits cstddef
+experimental/type_traits cstdint
+experimental/type_traits initializer_list
+experimental/type_traits type_traits
+experimental/type_traits version
+experimental/utility cmath
+experimental/utility compare
+experimental/utility cstddef
+experimental/utility cstdint
+experimental/utility cstdlib
+experimental/utility initializer_list
+experimental/utility iosfwd
+experimental/utility limits
+experimental/utility type_traits
+experimental/utility utility
+experimental/utility version
+filesystem algorithm
+filesystem atomic
+filesystem bit
+filesystem cctype
+filesystem cerrno
+filesystem climits
+filesystem cmath
+filesystem compare
+filesystem concepts
+filesystem cstddef
+filesystem cstdint
+filesystem cstdio
+filesystem cstdlib
+filesystem cstring
+filesystem ctime
+filesystem cwchar
+filesystem cwctype
+filesystem exception
+filesystem execution
+filesystem initializer_list
+filesystem iosfwd
+filesystem iterator
+filesystem limits
+filesystem memory
+filesystem new
+filesystem optional
+filesystem ratio
+filesystem stdexcept
+filesystem string
+filesystem string_view
+filesystem system_error
+filesystem tuple
+filesystem type_traits
+filesystem typeinfo
+filesystem utility
+filesystem variant
+filesystem version
+flat_map cmath
+flat_map compare
+flat_map cstddef
+flat_map cstdint
+flat_map initializer_list
+flat_map limits
+flat_map type_traits
+flat_map version
+flat_set cmath
+flat_set compare
+flat_set cstddef
+flat_set cstdint
+flat_set initializer_list
+flat_set limits
+flat_set type_traits
+flat_set version
+format algorithm
+format array
+format atomic
+format bit
+format cctype
+format cerrno
+format climits
+format clocale
+format cmath
+format compare
+format concepts
+format cstdarg
+format cstddef
+format cstdint
+format cstdio
+format cstdlib
+format cstring
+format ctime
+format cwchar
+format cwctype
+format deque
+format exception
+format execution
+format functional
+format initializer_list
+format ios
+format iosfwd
+format iterator
+format limits
+format locale
+format memory
+format mutex
+format new
+format optional
+format queue
+format ratio
+format stack
+format stdexcept
+format streambuf
+format string
+format string_view
+format system_error
+format tuple
+format type_traits
+format typeinfo
+format unordered_map
+format utility
+format variant
+format vector
+format version
+forward_list algorithm
+forward_list array
+forward_list atomic
+forward_list bit
+forward_list cctype
+forward_list cerrno
+forward_list climits
+forward_list clocale
+forward_list cmath
+forward_list compare
+forward_list concepts
+forward_list cstdarg
+forward_list cstddef
+forward_list cstdint
+forward_list cstdio
+forward_list cstdlib
+forward_list cstring
+forward_list ctime
+forward_list cwchar
+forward_list cwctype
+forward_list exception
+forward_list execution
+forward_list functional
+forward_list initializer_list
+forward_list ios
+forward_list iosfwd
+forward_list iterator
+forward_list limits
+forward_list locale
+forward_list memory
+forward_list mutex
+forward_list new
+forward_list optional
+forward_list ratio
+forward_list stdexcept
+forward_list streambuf
+forward_list string
+forward_list string_view
+forward_list system_error
+forward_list tuple
+forward_list type_traits
+forward_list typeinfo
+forward_list unordered_map
+forward_list utility
+forward_list variant
+forward_list vector
+forward_list version
+fstream algorithm
+fstream array
+fstream atomic
+fstream bit
+fstream bitset
+fstream cctype
+fstream cerrno
+fstream climits
+fstream clocale
+fstream cmath
+fstream compare
+fstream concepts
+fstream cstdarg
+fstream cstddef
+fstream cstdint
+fstream cstdio
+fstream cstdlib
+fstream cstring
+fstream ctime
+fstream cwchar
+fstream cwctype
+fstream deque
+fstream exception
+fstream execution
+fstream filesystem
+fstream format
+fstream functional
+fstream initializer_list
+fstream iomanip
+fstream ios
+fstream iosfwd
+fstream istream
+fstream iterator
+fstream limits
+fstream locale
+fstream memory
+fstream mutex
+fstream new
+fstream optional
+fstream ostream
+fstream print
+fstream queue
+fstream ratio
+fstream stack
+fstream stdexcept
+fstream streambuf
+fstream string
+fstream string_view
+fstream system_error
+fstream tuple
+fstream type_traits
+fstream typeinfo
+fstream unordered_map
+fstream utility
+fstream variant
+fstream vector
+fstream version
+functional algorithm
+functional array
+functional atomic
+functional bit
+functional cctype
+functional cerrno
+functional climits
+functional clocale
+functional cmath
+functional compare
+functional concepts
+functional cstdarg
+functional cstddef
+functional cstdint
+functional cstdio
+functional cstdlib
+functional cstring
+functional ctime
+functional cwchar
+functional cwctype
+functional exception
+functional execution
+functional initializer_list
+functional ios
+functional iosfwd
+functional iterator
+functional limits
+functional locale
+functional memory
+functional mutex
+functional new
+functional optional
+functional ratio
+functional stdexcept
+functional streambuf
+functional string
+functional string_view
+functional system_error
+functional tuple
+functional type_traits
+functional typeinfo
+functional unordered_map
+functional utility
+functional variant
+functional vector
+functional version
+future algorithm
+future array
+future atomic
+future bit
+future bitset
+future cctype
+future cerrno
+future chrono
+future climits
+future clocale
+future cmath
+future compare
+future concepts
+future cstdarg
+future cstddef
+future cstdint
+future cstdio
+future cstdlib
+future cstring
+future ctime
+future cwchar
+future cwctype
+future deque
+future exception
+future execution
+future format
+future forward_list
+future functional
+future initializer_list
+future ios
+future iosfwd
+future istream
+future iterator
+future limits
+future locale
+future memory
+future mutex
+future new
+future optional
+future ostream
+future print
+future queue
+future ratio
+future sstream
+future stack
+future stdexcept
+future streambuf
+future string
+future string_view
+future system_error
+future thread
+future tuple
+future type_traits
+future typeinfo
+future unordered_map
+future utility
+future variant
+future vector
+future version
+initializer_list cstddef
+initializer_list version
+iomanip algorithm
+iomanip array
+iomanip atomic
+iomanip bit
+iomanip bitset
+iomanip cctype
+iomanip cerrno
+iomanip climits
+iomanip clocale
+iomanip cmath
+iomanip compare
+iomanip concepts
+iomanip cstdarg
+iomanip cstddef
+iomanip cstdint
+iomanip cstdio
+iomanip cstdlib
+iomanip cstring
+iomanip ctime
+iomanip cwchar
+iomanip cwctype
+iomanip deque
+iomanip exception
+iomanip execution
+iomanip format
+iomanip functional
+iomanip initializer_list
+iomanip ios
+iomanip iosfwd
+iomanip istream
+iomanip iterator
+iomanip limits
+iomanip locale
+iomanip memory
+iomanip mutex
+iomanip new
+iomanip optional
+iomanip ostream
+iomanip print
+iomanip queue
+iomanip ratio
+iomanip stack
+iomanip stdexcept
+iomanip streambuf
+iomanip string
+iomanip string_view
+iomanip system_error
+iomanip tuple
+iomanip type_traits
+iomanip typeinfo
+iomanip unordered_map
+iomanip utility
+iomanip variant
+iomanip vector
+iomanip version
+ios algorithm
+ios atomic
+ios bit
+ios cctype
+ios cerrno
+ios climits
+ios clocale
+ios cmath
+ios compare
+ios concepts
+ios cstddef
+ios cstdint
+ios cstdio
+ios cstdlib
+ios cstring
+ios ctime
+ios cwchar
+ios cwctype
+ios exception
+ios execution
+ios initializer_list
+ios iosfwd
+ios iterator
+ios limits
+ios memory
+ios mutex
+ios new
+ios optional
+ios ratio
+ios stdexcept
+ios string
+ios string_view
+ios system_error
+ios tuple
+ios type_traits
+ios typeinfo
+ios utility
+ios variant
+ios version
+iosfwd version
+iostream algorithm
+iostream array
+iostream atomic
+iostream bit
+iostream bitset
+iostream cctype
+iostream cerrno
+iostream climits
+iostream clocale
+iostream cmath
+iostream compare
+iostream concepts
+iostream cstdarg
+iostream cstddef
+iostream cstdint
+iostream cstdio
+iostream cstdlib
+iostream cstring
+iostream ctime
+iostream cwchar
+iostream cwctype
+iostream deque
+iostream exception
+iostream execution
+iostream format
+iostream functional
+iostream initializer_list
+iostream ios
+iostream iosfwd
+iostream istream
+iostream iterator
+iostream limits
+iostream locale
+iostream memory
+iostream mutex
+iostream new
+iostream optional
+iostream ostream
+iostream print
+iostream queue
+iostream ratio
+iostream stack
+iostream stdexcept
+iostream streambuf
+iostream string
+iostream string_view
+iostream system_error
+iostream tuple
+iostream type_traits
+iostream typeinfo
+iostream unordered_map
+iostream utility
+iostream variant
+iostream vector
+iostream version
+istream algorithm
+istream array
+istream atomic
+istream bit
+istream bitset
+istream cctype
+istream cerrno
+istream climits
+istream clocale
+istream cmath
+istream compare
+istream concepts
+istream cstdarg
+istream cstddef
+istream cstdint
+istream cstdio
+istream cstdlib
+istream cstring
+istream ctime
+istream cwchar
+istream cwctype
+istream deque
+istream exception
+istream execution
+istream format
+istream functional
+istream initializer_list
+istream ios
+istream iosfwd
+istream iterator
+istream limits
+istream locale
+istream memory
+istream mutex
+istream new
+istream optional
+istream ostream
+istream print
+istream queue
+istream ratio
+istream stack
+istream stdexcept
+istream streambuf
+istream string
+istream string_view
+istream system_error
+istream tuple
+istream type_traits
+istream typeinfo
+istream unordered_map
+istream utility
+istream variant
+istream vector
+istream version
+iterator cctype
+iterator cmath
+iterator compare
+iterator concepts
+iterator cstddef
+iterator cstdint
+iterator cstdio
+iterator cstdlib
+iterator cstring
+iterator cwchar
+iterator cwctype
+iterator exception
+iterator initializer_list
+iterator iosfwd
+iterator limits
+iterator new
+iterator tuple
+iterator type_traits
+iterator typeinfo
+iterator utility
+iterator variant
+iterator version
+latch atomic
+latch climits
+latch cmath
+latch compare
+latch cstddef
+latch cstdint
+latch cstdlib
+latch cstring
+latch ctime
+latch limits
+latch ratio
+latch type_traits
+latch version
+limits cstdint
+limits type_traits
+limits version
+list algorithm
+list array
+list atomic
+list bit
+list cctype
+list cerrno
+list climits
+list clocale
+list cmath
+list compare
+list concepts
+list cstdarg
+list cstddef
+list cstdint
+list cstdio
+list cstdlib
+list cstring
+list ctime
+list cwchar
+list cwctype
+list exception
+list execution
+list functional
+list initializer_list
+list ios
+list iosfwd
+list iterator
+list limits
+list locale
+list memory
+list mutex
+list new
+list optional
+list ratio
+list stdexcept
+list streambuf
+list string
+list string_view
+list system_error
+list tuple
+list type_traits
+list typeinfo
+list unordered_map
+list utility
+list variant
+list vector
+list version
+locale algorithm
+locale atomic
+locale bit
+locale cctype
+locale cerrno
+locale climits
+locale clocale
+locale cmath
+locale compare
+locale concepts
+locale cstdarg
+locale cstddef
+locale cstdint
+locale cstdio
+locale cstdlib
+locale cstring
+locale ctime
+locale cwchar
+locale cwctype
+locale exception
+locale execution
+locale initializer_list
+locale ios
+locale iosfwd
+locale iterator
+locale limits
+locale memory
+locale mutex
+locale new
+locale optional
+locale ratio
+locale stdexcept
+locale streambuf
+locale string
+locale string_view
+locale system_error
+locale tuple
+locale type_traits
+locale typeinfo
+locale utility
+locale variant
+locale version
+map algorithm
+map array
+map atomic
+map bit
+map cctype
+map cerrno
+map climits
+map clocale
+map cmath
+map compare
+map concepts
+map cstdarg
+map cstddef
+map cstdint
+map cstdio
+map cstdlib
+map cstring
+map ctime
+map cwchar
+map cwctype
+map exception
+map execution
+map functional
+map initializer_list
+map ios
+map iosfwd
+map iterator
+map limits
+map locale
+map memory
+map mutex
+map new
+map optional
+map ratio
+map stdexcept
+map streambuf
+map string
+map string_view
+map system_error
+map tuple
+map type_traits
+map typeinfo
+map unordered_map
+map utility
+map variant
+map vector
+map version
+mdspan version
+memory atomic
+memory cctype
+memory climits
+memory cmath
+memory compare
+memory concepts
+memory cstddef
+memory cstdint
+memory cstdio
+memory cstdlib
+memory cstring
+memory ctime
+memory cwchar
+memory cwctype
+memory exception
+memory initializer_list
+memory iosfwd
+memory iterator
+memory limits
+memory new
+memory ratio
+memory stdexcept
+memory tuple
+memory type_traits
+memory typeinfo
+memory utility
+memory variant
+memory version
+memory_resource cstddef
+memory_resource cstdint
+memory_resource cstdlib
+memory_resource exception
+memory_resource iosfwd
+memory_resource new
+memory_resource stdexcept
+memory_resource type_traits
+memory_resource typeinfo
+memory_resource version
+mutex algorithm
+mutex atomic
+mutex bit
+mutex cctype
+mutex cerrno
+mutex climits
+mutex cmath
+mutex compare
+mutex concepts
+mutex cstddef
+mutex cstdint
+mutex cstdio
+mutex cstdlib
+mutex cstring
+mutex ctime
+mutex cwchar
+mutex cwctype
+mutex exception
+mutex execution
+mutex initializer_list
+mutex iosfwd
+mutex iterator
+mutex limits
+mutex memory
+mutex new
+mutex optional
+mutex ratio
+mutex stdexcept
+mutex string
+mutex string_view
+mutex system_error
+mutex tuple
+mutex type_traits
+mutex typeinfo
+mutex utility
+mutex variant
+mutex version
+new cstddef
+new cstdint
+new cstdlib
+new type_traits
+new version
+numbers concepts
+numbers cstddef
+numbers cstdint
+numbers type_traits
+numbers version
+numeric algorithm
+numeric array
+numeric atomic
+numeric bit
+numeric cctype
+numeric cerrno
+numeric climits
+numeric clocale
+numeric cmath
+numeric compare
+numeric concepts
+numeric cstdarg
+numeric cstddef
+numeric cstdint
+numeric cstdio
+numeric cstdlib
+numeric cstring
+numeric ctime
+numeric cwchar
+numeric cwctype
+numeric exception
+numeric execution
+numeric functional
+numeric initializer_list
+numeric ios
+numeric iosfwd
+numeric iterator
+numeric limits
+numeric locale
+numeric memory
+numeric mutex
+numeric new
+numeric optional
+numeric ratio
+numeric stdexcept
+numeric streambuf
+numeric string
+numeric string_view
+numeric system_error
+numeric tuple
+numeric type_traits
+numeric typeinfo
+numeric unordered_map
+numeric utility
+numeric variant
+numeric vector
+numeric version
+optional atomic
+optional cctype
+optional climits
+optional cmath
+optional compare
+optional concepts
+optional cstddef
+optional cstdint
+optional cstdio
+optional cstdlib
+optional cstring
+optional ctime
+optional cwchar
+optional cwctype
+optional exception
+optional initializer_list
+optional iosfwd
+optional iterator
+optional limits
+optional memory
+optional new
+optional ratio
+optional stdexcept
+optional tuple
+optional type_traits
+optional typeinfo
+optional utility
+optional variant
+optional version
+ostream algorithm
+ostream array
+ostream atomic
+ostream bit
+ostream bitset
+ostream cctype
+ostream cerrno
+ostream climits
+ostream clocale
+ostream cmath
+ostream compare
+ostream concepts
+ostream cstdarg
+ostream cstddef
+ostream cstdint
+ostream cstdio
+ostream cstdlib
+ostream cstring
+ostream ctime
+ostream cwchar
+ostream cwctype
+ostream deque
+ostream exception
+ostream execution
+ostream format
+ostream functional
+ostream initializer_list
+ostream ios
+ostream iosfwd
+ostream iterator
+ostream limits
+ostream locale
+ostream memory
+ostream mutex
+ostream new
+ostream optional
+ostream print
+ostream queue
+ostream ratio
+ostream stack
+ostream stdexcept
+ostream streambuf
+ostream string
+ostream string_view
+ostream system_error
+ostream tuple
+ostream type_traits
+ostream typeinfo
+ostream unordered_map
+ostream utility
+ostream variant
+ostream vector
+ostream version
+print algorithm
+print array
+print atomic
+print bit
+print cctype
+print cerrno
+print climits
+print clocale
+print cmath
+print compare
+print concepts
+print cstdarg
+print cstddef
+print cstdint
+print cstdio
+print cstdlib
+print cstring
+print ctime
+print cwchar
+print cwctype
+print deque
+print exception
+print execution
+print format
+print functional
+print initializer_list
+print ios
+print iosfwd
+print iterator
+print limits
+print locale
+print memory
+print mutex
+print new
+print optional
+print queue
+print ratio
+print stack
+print stdexcept
+print streambuf
+print string
+print string_view
+print system_error
+print tuple
+print type_traits
+print typeinfo
+print unordered_map
+print utility
+print variant
+print vector
+print version
+queue algorithm
+queue array
+queue atomic
+queue bit
+queue cctype
+queue cerrno
+queue climits
+queue clocale
+queue cmath
+queue compare
+queue concepts
+queue cstdarg
+queue cstddef
+queue cstdint
+queue cstdio
+queue cstdlib
+queue cstring
+queue ctime
+queue cwchar
+queue cwctype
+queue deque
+queue exception
+queue execution
+queue functional
+queue initializer_list
+queue ios
+queue iosfwd
+queue iterator
+queue limits
+queue locale
+queue memory
+queue mutex
+queue new
+queue optional
+queue ratio
+queue stdexcept
+queue streambuf
+queue string
+queue string_view
+queue system_error
+queue tuple
+queue type_traits
+queue typeinfo
+queue unordered_map
+queue utility
+queue variant
+queue vector
+queue version
+random algorithm
+random array
+random atomic
+random bit
+random cctype
+random cerrno
+random climits
+random clocale
+random cmath
+random compare
+random concepts
+random cstdarg
+random cstddef
+random cstdint
+random cstdio
+random cstdlib
+random cstring
+random ctime
+random cwchar
+random cwctype
+random exception
+random execution
+random functional
+random initializer_list
+random ios
+random iosfwd
+random iterator
+random limits
+random locale
+random memory
+random mutex
+random new
+random numeric
+random optional
+random ratio
+random stdexcept
+random streambuf
+random string
+random string_view
+random system_error
+random tuple
+random type_traits
+random typeinfo
+random unordered_map
+random utility
+random variant
+random vector
+random version
+ranges cctype
+ranges cmath
+ranges compare
+ranges concepts
+ranges cstddef
+ranges cstdint
+ranges cstdio
+ranges cstdlib
+ranges cstring
+ranges cwchar
+ranges cwctype
+ranges exception
+ranges initializer_list
+ranges iosfwd
+ranges iterator
+ranges limits
+ranges new
+ranges tuple
+ranges type_traits
+ranges typeinfo
+ranges utility
+ranges variant
+ranges version
+ratio climits
+ratio cstdint
+ratio type_traits
+ratio version
+regex algorithm
+regex array
+regex atomic
+regex bit
+regex cctype
+regex cerrno
+regex climits
+regex clocale
+regex cmath
+regex compare
+regex concepts
+regex cstdarg
+regex cstddef
+regex cstdint
+regex cstdio
+regex cstdlib
+regex cstring
+regex ctime
+regex cwchar
+regex cwctype
+regex deque
+regex exception
+regex execution
+regex functional
+regex initializer_list
+regex ios
+regex iosfwd
+regex iterator
+regex limits
+regex locale
+regex memory
+regex mutex
+regex new
+regex optional
+regex ratio
+regex stdexcept
+regex streambuf
+regex string
+regex string_view
+regex system_error
+regex tuple
+regex type_traits
+regex typeinfo
+regex unordered_map
+regex utility
+regex variant
+regex vector
+regex version
+scoped_allocator atomic
+scoped_allocator cctype
+scoped_allocator climits
+scoped_allocator cmath
+scoped_allocator compare
+scoped_allocator concepts
+scoped_allocator cstddef
+scoped_allocator cstdint
+scoped_allocator cstdio
+scoped_allocator cstdlib
+scoped_allocator cstring
+scoped_allocator ctime
+scoped_allocator cwchar
+scoped_allocator cwctype
+scoped_allocator exception
+scoped_allocator initializer_list
+scoped_allocator iosfwd
+scoped_allocator iterator
+scoped_allocator limits
+scoped_allocator memory
+scoped_allocator new
+scoped_allocator ratio
+scoped_allocator stdexcept
+scoped_allocator tuple
+scoped_allocator type_traits
+scoped_allocator typeinfo
+scoped_allocator utility
+scoped_allocator variant
+scoped_allocator version
+semaphore atomic
+semaphore climits
+semaphore cmath
+semaphore compare
+semaphore cstddef
+semaphore cstdint
+semaphore cstdlib
+semaphore cstring
+semaphore ctime
+semaphore limits
+semaphore ratio
+semaphore type_traits
+semaphore version
+set algorithm
+set array
+set atomic
+set bit
+set cctype
+set cerrno
+set climits
+set clocale
+set cmath
+set compare
+set concepts
+set cstdarg
+set cstddef
+set cstdint
+set cstdio
+set cstdlib
+set cstring
+set ctime
+set cwchar
+set cwctype
+set exception
+set execution
+set functional
+set initializer_list
+set ios
+set iosfwd
+set iterator
+set limits
+set locale
+set memory
+set mutex
+set new
+set optional
+set ratio
+set stdexcept
+set streambuf
+set string
+set string_view
+set system_error
+set tuple
+set type_traits
+set typeinfo
+set unordered_map
+set utility
+set variant
+set vector
+set version
+shared_mutex algorithm
+shared_mutex atomic
+shared_mutex bit
+shared_mutex cctype
+shared_mutex cerrno
+shared_mutex climits
+shared_mutex cmath
+shared_mutex compare
+shared_mutex concepts
+shared_mutex cstddef
+shared_mutex cstdint
+shared_mutex cstdio
+shared_mutex cstdlib
+shared_mutex cstring
+shared_mutex ctime
+shared_mutex cwchar
+shared_mutex cwctype
+shared_mutex exception
+shared_mutex execution
+shared_mutex initializer_list
+shared_mutex iosfwd
+shared_mutex iterator
+shared_mutex limits
+shared_mutex memory
+shared_mutex new
+shared_mutex optional
+shared_mutex ratio
+shared_mutex stdexcept
+shared_mutex string
+shared_mutex string_view
+shared_mutex system_error
+shared_mutex tuple
+shared_mutex type_traits
+shared_mutex typeinfo
+shared_mutex utility
+shared_mutex variant
+shared_mutex version
+source_location cstdint
+source_location version
+span algorithm
+span array
+span atomic
+span bit
+span cctype
+span cerrno
+span climits
+span clocale
+span cmath
+span compare
+span concepts
+span cstdarg
+span cstddef
+span cstdint
+span cstdio
+span cstdlib
+span cstring
+span ctime
+span cwchar
+span cwctype
+span exception
+span execution
+span functional
+span initializer_list
+span ios
+span iosfwd
+span iterator
+span limits
+span locale
+span memory
+span mutex
+span new
+span optional
+span ratio
+span stdexcept
+span streambuf
+span string
+span string_view
+span system_error
+span tuple
+span type_traits
+span typeinfo
+span unordered_map
+span utility
+span variant
+span vector
+span version
+sstream algorithm
+sstream array
+sstream atomic
+sstream bit
+sstream bitset
+sstream cctype
+sstream cerrno
+sstream climits
+sstream clocale
+sstream cmath
+sstream compare
+sstream concepts
+sstream cstdarg
+sstream cstddef
+sstream cstdint
+sstream cstdio
+sstream cstdlib
+sstream cstring
+sstream ctime
+sstream cwchar
+sstream cwctype
+sstream deque
+sstream exception
+sstream execution
+sstream format
+sstream functional
+sstream initializer_list
+sstream ios
+sstream iosfwd
+sstream istream
+sstream iterator
+sstream limits
+sstream locale
+sstream memory
+sstream mutex
+sstream new
+sstream optional
+sstream ostream
+sstream print
+sstream queue
+sstream ratio
+sstream stack
+sstream stdexcept
+sstream streambuf
+sstream string
+sstream string_view
+sstream system_error
+sstream tuple
+sstream type_traits
+sstream typeinfo
+sstream unordered_map
+sstream utility
+sstream variant
+sstream vector
+sstream version
+stack algorithm
+stack array
+stack atomic
+stack bit
+stack cctype
+stack cerrno
+stack climits
+stack clocale
+stack cmath
+stack compare
+stack concepts
+stack cstdarg
+stack cstddef
+stack cstdint
+stack cstdio
+stack cstdlib
+stack cstring
+stack ctime
+stack cwchar
+stack cwctype
+stack deque
+stack exception
+stack execution
+stack functional
+stack initializer_list
+stack ios
+stack iosfwd
+stack iterator
+stack limits
+stack locale
+stack memory
+stack mutex
+stack new
+stack optional
+stack ratio
+stack stdexcept
+stack streambuf
+stack string
+stack string_view
+stack system_error
+stack tuple
+stack type_traits
+stack typeinfo
+stack unordered_map
+stack utility
+stack variant
+stack vector
+stack version
+stdexcept cstddef
+stdexcept cstdint
+stdexcept cstdlib
+stdexcept exception
+stdexcept iosfwd
+stdexcept new
+stdexcept type_traits
+stdexcept typeinfo
+stdexcept version
+stop_token iosfwd
+stop_token version
+streambuf algorithm
+streambuf atomic
+streambuf bit
+streambuf cctype
+streambuf cerrno
+streambuf climits
+streambuf clocale
+streambuf cmath
+streambuf compare
+streambuf concepts
+streambuf cstddef
+streambuf cstdint
+streambuf cstdio
+streambuf cstdlib
+streambuf cstring
+streambuf ctime
+streambuf cwchar
+streambuf cwctype
+streambuf exception
+streambuf execution
+streambuf initializer_list
+streambuf ios
+streambuf iosfwd
+streambuf iterator
+streambuf limits
+streambuf memory
+streambuf mutex
+streambuf new
+streambuf optional
+streambuf ratio
+streambuf stdexcept
+streambuf string
+streambuf string_view
+streambuf system_error
+streambuf tuple
+streambuf type_traits
+streambuf typeinfo
+streambuf utility
+streambuf variant
+streambuf version
+string algorithm
+string atomic
+string bit
+string cctype
+string climits
+string cmath
+string compare
+string concepts
+string cstddef
+string cstdint
+string cstdio
+string cstdlib
+string cstring
+string ctime
+string cwchar
+string cwctype
+string exception
+string execution
+string initializer_list
+string iosfwd
+string iterator
+string limits
+string memory
+string new
+string optional
+string ratio
+string stdexcept
+string string_view
+string tuple
+string type_traits
+string typeinfo
+string utility
+string variant
+string version
+string_view algorithm
+string_view atomic
+string_view bit
+string_view cctype
+string_view climits
+string_view cmath
+string_view compare
+string_view concepts
+string_view cstddef
+string_view cstdint
+string_view cstdio
+string_view cstdlib
+string_view cstring
+string_view ctime
+string_view cwchar
+string_view cwctype
+string_view exception
+string_view execution
+string_view initializer_list
+string_view iosfwd
+string_view iterator
+string_view limits
+string_view memory
+string_view new
+string_view optional
+string_view ratio
+string_view stdexcept
+string_view tuple
+string_view type_traits
+string_view typeinfo
+string_view utility
+string_view variant
+string_view version
+strstream algorithm
+strstream array
+strstream atomic
+strstream bit
+strstream bitset
+strstream cctype
+strstream cerrno
+strstream climits
+strstream clocale
+strstream cmath
+strstream compare
+strstream concepts
+strstream cstdarg
+strstream cstddef
+strstream cstdint
+strstream cstdio
+strstream cstdlib
+strstream cstring
+strstream ctime
+strstream cwchar
+strstream cwctype
+strstream deque
+strstream exception
+strstream execution
+strstream format
+strstream functional
+strstream initializer_list
+strstream ios
+strstream iosfwd
+strstream istream
+strstream iterator
+strstream limits
+strstream locale
+strstream memory
+strstream mutex
+strstream new
+strstream optional
+strstream ostream
+strstream print
+strstream queue
+strstream ratio
+strstream stack
+strstream stdexcept
+strstream streambuf
+strstream string
+strstream string_view
+strstream system_error
+strstream tuple
+strstream type_traits
+strstream typeinfo
+strstream unordered_map
+strstream utility
+strstream variant
+strstream vector
+strstream version
+syncstream algorithm
+syncstream array
+syncstream atomic
+syncstream bit
+syncstream bitset
+syncstream cctype
+syncstream cerrno
+syncstream climits
+syncstream clocale
+syncstream cmath
+syncstream compare
+syncstream concepts
+syncstream cstdarg
+syncstream cstddef
+syncstream cstdint
+syncstream cstdio
+syncstream cstdlib
+syncstream cstring
+syncstream ctime
+syncstream cwchar
+syncstream cwctype
+syncstream deque
+syncstream exception
+syncstream execution
+syncstream format
+syncstream functional
+syncstream initializer_list
+syncstream ios
+syncstream iosfwd
+syncstream iterator
+syncstream limits
+syncstream locale
+syncstream map
+syncstream memory
+syncstream mutex
+syncstream new
+syncstream optional
+syncstream ostream
+syncstream print
+syncstream queue
+syncstream ratio
+syncstream shared_mutex
+syncstream stack
+syncstream stdexcept
+syncstream streambuf
+syncstream string
+syncstream string_view
+syncstream system_error
+syncstream tuple
+syncstream type_traits
+syncstream typeinfo
+syncstream unordered_map
+syncstream utility
+syncstream variant
+syncstream vector
+syncstream version
+system_error algorithm
+system_error atomic
+system_error bit
+system_error cctype
+system_error cerrno
+system_error climits
+system_error cmath
+system_error compare
+system_error concepts
+system_error cstddef
+system_error cstdint
+system_error cstdio
+system_error cstdlib
+system_error cstring
+system_error ctime
+system_error cwchar
+system_error cwctype
+system_error exception
+system_error execution
+system_error initializer_list
+system_error iosfwd
+system_error iterator
+system_error limits
+system_error memory
+system_error new
+system_error optional
+system_error ratio
+system_error stdexcept
+system_error string
+system_error string_view
+system_error tuple
+system_error type_traits
+system_error typeinfo
+system_error utility
+system_error variant
+system_error version
+thread algorithm
+thread array
+thread atomic
+thread bit
+thread bitset
+thread cctype
+thread cerrno
+thread chrono
+thread climits
+thread clocale
+thread cmath
+thread compare
+thread concepts
+thread cstdarg
+thread cstddef
+thread cstdint
+thread cstdio
+thread cstdlib
+thread cstring
+thread ctime
+thread cwchar
+thread cwctype
+thread deque
+thread exception
+thread execution
+thread format
+thread forward_list
+thread functional
+thread initializer_list
+thread ios
+thread iosfwd
+thread istream
+thread iterator
+thread limits
+thread locale
+thread memory
+thread mutex
+thread new
+thread optional
+thread ostream
+thread print
+thread queue
+thread ratio
+thread sstream
+thread stack
+thread stdexcept
+thread streambuf
+thread string
+thread string_view
+thread system_error
+thread tuple
+thread type_traits
+thread typeinfo
+thread unordered_map
+thread utility
+thread variant
+thread vector
+thread version
+tuple cmath
+tuple compare
+tuple cstddef
+tuple cstdint
+tuple cstdlib
+tuple exception
+tuple initializer_list
+tuple iosfwd
+tuple limits
+tuple new
+tuple type_traits
+tuple typeinfo
+tuple utility
+tuple version
+type_traits cstdint
+type_traits version
+typeindex cmath
+typeindex compare
+typeindex cstddef
+typeindex cstdint
+typeindex cstdlib
+typeindex initializer_list
+typeindex iosfwd
+typeindex limits
+typeindex new
+typeindex type_traits
+typeindex typeinfo
+typeindex utility
+typeindex version
+typeinfo cstddef
+typeinfo cstdint
+typeinfo cstdlib
+typeinfo type_traits
+typeinfo version
+unordered_map algorithm
+unordered_map atomic
+unordered_map bit
+unordered_map cctype
+unordered_map climits
+unordered_map cmath
+unordered_map compare
+unordered_map concepts
+unordered_map cstddef
+unordered_map cstdint
+unordered_map cstdio
+unordered_map cstdlib
+unordered_map cstring
+unordered_map ctime
+unordered_map cwchar
+unordered_map cwctype
+unordered_map exception
+unordered_map execution
+unordered_map initializer_list
+unordered_map iosfwd
+unordered_map iterator
+unordered_map limits
+unordered_map memory
+unordered_map new
+unordered_map optional
+unordered_map ratio
+unordered_map stdexcept
+unordered_map tuple
+unordered_map type_traits
+unordered_map typeinfo
+unordered_map utility
+unordered_map variant
+unordered_map version
+unordered_set algorithm
+unordered_set array
+unordered_set atomic
+unordered_set bit
+unordered_set cctype
+unordered_set cerrno
+unordered_set climits
+unordered_set clocale
+unordered_set cmath
+unordered_set compare
+unordered_set concepts
+unordered_set cstdarg
+unordered_set cstddef
+unordered_set cstdint
+unordered_set cstdio
+unordered_set cstdlib
+unordered_set cstring
+unordered_set ctime
+unordered_set cwchar
+unordered_set cwctype
+unordered_set exception
+unordered_set execution
+unordered_set functional
+unordered_set initializer_list
+unordered_set ios
+unordered_set iosfwd
+unordered_set iterator
+unordered_set limits
+unordered_set locale
+unordered_set memory
+unordered_set mutex
+unordered_set new
+unordered_set optional
+unordered_set ratio
+unordered_set stdexcept
+unordered_set streambuf
+unordered_set string
+unordered_set string_view
+unordered_set system_error
+unordered_set tuple
+unordered_set type_traits
+unordered_set typeinfo
+unordered_set unordered_map
+unordered_set utility
+unordered_set variant
+unordered_set vector
+unordered_set version
+utility cmath
+utility compare
+utility cstddef
+utility cstdint
+utility cstdlib
+utility initializer_list
+utility iosfwd
+utility limits
+utility type_traits
+utility version
+valarray algorithm
+valarray array
+valarray atomic
+valarray bit
+valarray cctype
+valarray cerrno
+valarray climits
+valarray clocale
+valarray cmath
+valarray compare
+valarray concepts
+valarray cstdarg
+valarray cstddef
+valarray cstdint
+valarray cstdio
+valarray cstdlib
+valarray cstring
+valarray ctime
+valarray cwchar
+valarray cwctype
+valarray exception
+valarray execution
+valarray functional
+valarray initializer_list
+valarray ios
+valarray iosfwd
+valarray iterator
+valarray limits
+valarray locale
+valarray memory
+valarray mutex
+valarray new
+valarray optional
+valarray ratio
+valarray stdexcept
+valarray streambuf
+valarray string
+valarray string_view
+valarray system_error
+valarray tuple
+valarray type_traits
+valarray typeinfo
+valarray unordered_map
+valarray utility
+valarray variant
+valarray vector
+valarray version
+variant cmath
+variant compare
+variant cstddef
+variant cstdint
+variant cstdlib
+variant cstring
+variant exception
+variant initializer_list
+variant iosfwd
+variant limits
+variant new
+variant tuple
+variant type_traits
+variant typeinfo
+variant utility
+variant version
+vector algorithm
+vector array
+vector atomic
+vector bit
+vector cctype
+vector cerrno
+vector climits
+vector clocale
+vector cmath
+vector compare
+vector concepts
+vector cstdarg
+vector cstddef
+vector cstdint
+vector cstdio
+vector cstdlib
+vector cstring
+vector ctime
+vector cwchar
+vector cwctype
+vector exception
+vector execution
+vector initializer_list
+vector ios
+vector iosfwd
+vector iterator
+vector limits
+vector locale
+vector memory
+vector mutex
+vector new
+vector optional
+vector ratio
+vector stdexcept
+vector streambuf
+vector string
+vector string_view
+vector system_error
+vector tuple
+vector type_traits
+vector typeinfo
+vector utility
+vector variant
+vector version
diff --git a/libcxx/test/libcxx-03/transitive_includes/cxx17.csv b/libcxx/test/libcxx-03/transitive_includes/cxx17.csv
new file mode 100644
index 0000000000000..332cb62f35b5f
--- /dev/null
+++ b/libcxx/test/libcxx-03/transitive_includes/cxx17.csv
@@ -0,0 +1,2621 @@
+algorithm atomic
+algorithm bit
+algorithm cctype
+algorithm climits
+algorithm cmath
+algorithm compare
+algorithm concepts
+algorithm cstddef
+algorithm cstdint
+algorithm cstdio
+algorithm cstdlib
+algorithm cstring
+algorithm ctime
+algorithm cwchar
+algorithm cwctype
+algorithm exception
+algorithm initializer_list
+algorithm iosfwd
+algorithm iterator
+algorithm limits
+algorithm memory
+algorithm new
+algorithm optional
+algorithm ratio
+algorithm stdexcept
+algorithm tuple
+algorithm type_traits
+algorithm typeinfo
+algorithm utility
+algorithm variant
+algorithm version
+any algorithm
+any array
+any atomic
+any bit
+any cctype
+any cerrno
+any chrono
+any climits
+any clocale
+any cmath
+any compare
+any concepts
+any cstdarg
+any cstddef
+any cstdint
+any cstdio
+any cstdlib
+any cstring
+any ctime
+any cwchar
+any cwctype
+any exception
+any forward_list
+any functional
+any initializer_list
+any ios
+any iosfwd
+any iterator
+any limits
+any locale
+any memory
+any mutex
+any new
+any optional
+any ratio
+any stdexcept
+any streambuf
+any string
+any string_view
+any system_error
+any tuple
+any type_traits
+any typeinfo
+any unordered_map
+any utility
+any variant
+any vector
+any version
+array algorithm
+array atomic
+array bit
+array cctype
+array climits
+array cmath
+array compare
+array concepts
+array cstddef
+array cstdint
+array cstdio
+array cstdlib
+array cstring
+array ctime
+array cwchar
+array cwctype
+array exception
+array initializer_list
+array iosfwd
+array iterator
+array limits
+array memory
+array new
+array optional
+array ratio
+array stdexcept
+array tuple
+array type_traits
+array typeinfo
+array utility
+array variant
+array version
+atomic climits
+atomic cmath
+atomic compare
+atomic cstddef
+atomic cstdint
+atomic cstdlib
+atomic cstring
+atomic ctime
+atomic limits
+atomic ratio
+atomic type_traits
+atomic version
+barrier atomic
+barrier climits
+barrier cmath
+barrier compare
+barrier concepts
+barrier cstddef
+barrier cstdint
+barrier cstdlib
+barrier cstring
+barrier ctime
+barrier exception
+barrier initializer_list
+barrier iosfwd
+barrier iterator
+barrier limits
+barrier memory
+barrier new
+barrier ratio
+barrier stdexcept
+barrier tuple
+barrier type_traits
+barrier typeinfo
+barrier utility
+barrier variant
+barrier version
+bit cstdint
+bit cstdlib
+bit iosfwd
+bit limits
+bit type_traits
+bit version
+bitset algorithm
+bitset atomic
+bitset bit
+bitset cctype
+bitset climits
+bitset cmath
+bitset compare
+bitset concepts
+bitset cstddef
+bitset cstdint
+bitset cstdio
+bitset cstdlib
+bitset cstring
+bitset ctime
+bitset cwchar
+bitset cwctype
+bitset exception
+bitset initializer_list
+bitset iosfwd
+bitset iterator
+bitset limits
+bitset memory
+bitset new
+bitset optional
+bitset ratio
+bitset stdexcept
+bitset string
+bitset string_view
+bitset tuple
+bitset type_traits
+bitset typeinfo
+bitset utility
+bitset variant
+bitset version
+ccomplex algorithm
+ccomplex array
+ccomplex atomic
+ccomplex bit
+ccomplex bitset
+ccomplex cctype
+ccomplex cerrno
+ccomplex climits
+ccomplex clocale
+ccomplex cmath
+ccomplex compare
+ccomplex complex
+ccomplex concepts
+ccomplex cstdarg
+ccomplex cstddef
+ccomplex cstdint
+ccomplex cstdio
+ccomplex cstdlib
+ccomplex cstring
+ccomplex ctime
+ccomplex cwchar
+ccomplex cwctype
+ccomplex deque
+ccomplex exception
+ccomplex format
+ccomplex functional
+ccomplex initializer_list
+ccomplex ios
+ccomplex iosfwd
+ccomplex istream
+ccomplex iterator
+ccomplex limits
+ccomplex locale
+ccomplex memory
+ccomplex mutex
+ccomplex new
+ccomplex optional
+ccomplex ostream
+ccomplex print
+ccomplex queue
+ccomplex ratio
+ccomplex sstream
+ccomplex stack
+ccomplex stdexcept
+ccomplex streambuf
+ccomplex string
+ccomplex string_view
+ccomplex system_error
+ccomplex tuple
+ccomplex type_traits
+ccomplex typeinfo
+ccomplex unordered_map
+ccomplex utility
+ccomplex variant
+ccomplex vector
+ccomplex version
+charconv cerrno
+charconv cmath
+charconv concepts
+charconv cstddef
+charconv cstdint
+charconv cstdlib
+charconv cstring
+charconv initializer_list
+charconv iosfwd
+charconv limits
+charconv new
+charconv type_traits
+charconv version
+chrono algorithm
+chrono array
+chrono atomic
+chrono bit
+chrono cctype
+chrono cerrno
+chrono climits
+chrono clocale
+chrono cmath
+chrono compare
+chrono concepts
+chrono cstdarg
+chrono cstddef
+chrono cstdint
+chrono cstdio
+chrono cstdlib
+chrono cstring
+chrono ctime
+chrono cwchar
+chrono cwctype
+chrono exception
+chrono forward_list
+chrono functional
+chrono initializer_list
+chrono ios
+chrono iosfwd
+chrono iterator
+chrono limits
+chrono locale
+chrono memory
+chrono mutex
+chrono new
+chrono optional
+chrono ratio
+chrono stdexcept
+chrono streambuf
+chrono string
+chrono string_view
+chrono system_error
+chrono tuple
+chrono type_traits
+chrono typeinfo
+chrono unordered_map
+chrono utility
+chrono variant
+chrono vector
+chrono version
+cinttypes cstdint
+cmath cstdint
+cmath limits
+cmath type_traits
+cmath version
+codecvt algorithm
+codecvt atomic
+codecvt bit
+codecvt cctype
+codecvt cerrno
+codecvt climits
+codecvt clocale
+codecvt cmath
+codecvt compare
+codecvt concepts
+codecvt cstddef
+codecvt cstdint
+codecvt cstdio
+codecvt cstdlib
+codecvt cstring
+codecvt ctime
+codecvt cwchar
+codecvt cwctype
+codecvt exception
+codecvt initializer_list
+codecvt iosfwd
+codecvt iterator
+codecvt limits
+codecvt memory
+codecvt mutex
+codecvt new
+codecvt optional
+codecvt ratio
+codecvt stdexcept
+codecvt string
+codecvt string_view
+codecvt system_error
+codecvt tuple
+codecvt type_traits
+codecvt typeinfo
+codecvt utility
+codecvt variant
+codecvt version
+compare cmath
+compare cstddef
+compare cstdint
+compare limits
+compare type_traits
+compare version
+complex algorithm
+complex array
+complex atomic
+complex bit
+complex bitset
+complex cctype
+complex cerrno
+complex climits
+complex clocale
+complex cmath
+complex compare
+complex concepts
+complex cstdarg
+complex cstddef
+complex cstdint
+complex cstdio
+complex cstdlib
+complex cstring
+complex ctime
+complex cwchar
+complex cwctype
+complex deque
+complex exception
+complex format
+complex functional
+complex initializer_list
+complex ios
+complex iosfwd
+complex istream
+complex iterator
+complex limits
+complex locale
+complex memory
+complex mutex
+complex new
+complex optional
+complex ostream
+complex print
+complex queue
+complex ratio
+complex sstream
+complex stack
+complex stdexcept
+complex streambuf
+complex string
+complex string_view
+complex system_error
+complex tuple
+complex type_traits
+complex typeinfo
+complex unordered_map
+complex utility
+complex variant
+complex vector
+complex version
+concepts cstddef
+concepts cstdint
+concepts type_traits
+concepts version
+condition_variable algorithm
+condition_variable atomic
+condition_variable bit
+condition_variable cctype
+condition_variable cerrno
+condition_variable climits
+condition_variable cmath
+condition_variable compare
+condition_variable concepts
+condition_variable cstddef
+condition_variable cstdint
+condition_variable cstdio
+condition_variable cstdlib
+condition_variable cstring
+condition_variable ctime
+condition_variable cwchar
+condition_variable cwctype
+condition_variable exception
+condition_variable initializer_list
+condition_variable iosfwd
+condition_variable iterator
+condition_variable limits
+condition_variable memory
+condition_variable new
+condition_variable optional
+condition_variable ratio
+condition_variable stdexcept
+condition_variable string
+condition_variable string_view
+condition_variable system_error
+condition_variable tuple
+condition_variable type_traits
+condition_variable typeinfo
+condition_variable utility
+condition_variable variant
+condition_variable version
+coroutine cmath
+coroutine compare
+coroutine cstddef
+coroutine cstdint
+coroutine iosfwd
+coroutine limits
+coroutine type_traits
+coroutine version
+cstddef version
+ctgmath algorithm
+ctgmath array
+ctgmath atomic
+ctgmath bit
+ctgmath bitset
+ctgmath cctype
+ctgmath cerrno
+ctgmath climits
+ctgmath clocale
+ctgmath cmath
+ctgmath compare
+ctgmath complex
+ctgmath concepts
+ctgmath cstdarg
+ctgmath cstddef
+ctgmath cstdint
+ctgmath cstdio
+ctgmath cstdlib
+ctgmath cstring
+ctgmath ctime
+ctgmath cwchar
+ctgmath cwctype
+ctgmath deque
+ctgmath exception
+ctgmath format
+ctgmath functional
+ctgmath initializer_list
+ctgmath ios
+ctgmath iosfwd
+ctgmath istream
+ctgmath iterator
+ctgmath limits
+ctgmath locale
+ctgmath memory
+ctgmath mutex
+ctgmath new
+ctgmath optional
+ctgmath ostream
+ctgmath print
+ctgmath queue
+ctgmath ratio
+ctgmath sstream
+ctgmath stack
+ctgmath stdexcept
+ctgmath streambuf
+ctgmath string
+ctgmath string_view
+ctgmath system_error
+ctgmath tuple
+ctgmath type_traits
+ctgmath typeinfo
+ctgmath unordered_map
+ctgmath utility
+ctgmath variant
+ctgmath vector
+ctgmath version
+cwchar cctype
+cwchar cstddef
+cwchar cwctype
+cwchar version
+cwctype cctype
+deque algorithm
+deque array
+deque atomic
+deque bit
+deque cctype
+deque cerrno
+deque climits
+deque clocale
+deque cmath
+deque compare
+deque concepts
+deque cstdarg
+deque cstddef
+deque cstdint
+deque cstdio
+deque cstdlib
+deque cstring
+deque ctime
+deque cwchar
+deque cwctype
+deque exception
+deque functional
+deque initializer_list
+deque ios
+deque iosfwd
+deque iterator
+deque limits
+deque locale
+deque memory
+deque mutex
+deque new
+deque optional
+deque ratio
+deque stdexcept
+deque streambuf
+deque string
+deque string_view
+deque system_error
+deque tuple
+deque type_traits
+deque typeinfo
+deque unordered_map
+deque utility
+deque variant
+deque vector
+deque version
+exception cstddef
+exception cstdint
+exception cstdlib
+exception new
+exception type_traits
+exception typeinfo
+exception version
+execution cstddef
+execution version
+expected version
+experimental/iterator algorithm
+experimental/iterator atomic
+experimental/iterator bit
+experimental/iterator bitset
+experimental/iterator cctype
+experimental/iterator cerrno
+experimental/iterator climits
+experimental/iterator clocale
+experimental/iterator cmath
+experimental/iterator compare
+experimental/iterator concepts
+experimental/iterator cstdarg
+experimental/iterator cstddef
+experimental/iterator cstdint
+experimental/iterator cstdio
+experimental/iterator cstdlib
+experimental/iterator cstring
+experimental/iterator ctime
+experimental/iterator cwchar
+experimental/iterator cwctype
+experimental/iterator exception
+experimental/iterator initializer_list
+experimental/iterator ios
+experimental/iterator iosfwd
+experimental/iterator iterator
+experimental/iterator limits
+experimental/iterator locale
+experimental/iterator memory
+experimental/iterator mutex
+experimental/iterator new
+experimental/iterator optional
+experimental/iterator ratio
+experimental/iterator stdexcept
+experimental/iterator streambuf
+experimental/iterator string
+experimental/iterator string_view
+experimental/iterator system_error
+experimental/iterator tuple
+experimental/iterator type_traits
+experimental/iterator typeinfo
+experimental/iterator utility
+experimental/iterator variant
+experimental/iterator version
+experimental/memory cstddef
+experimental/memory cstdint
+experimental/memory cstring
+experimental/memory limits
+experimental/memory type_traits
+experimental/memory version
+experimental/propagate_const cstddef
+experimental/propagate_const cstdint
+experimental/propagate_const type_traits
+experimental/propagate_const version
+experimental/simd cstddef
+experimental/simd cstdint
+experimental/simd limits
+experimental/simd type_traits
+experimental/simd version
+experimental/type_traits cstddef
+experimental/type_traits cstdint
+experimental/type_traits initializer_list
+experimental/type_traits type_traits
+experimental/type_traits version
+experimental/utility cmath
+experimental/utility compare
+experimental/utility cstddef
+experimental/utility cstdint
+experimental/utility cstdlib
+experimental/utility initializer_list
+experimental/utility iosfwd
+experimental/utility limits
+experimental/utility type_traits
+experimental/utility utility
+experimental/utility version
+filesystem algorithm
+filesystem array
+filesystem atomic
+filesystem bit
+filesystem bitset
+filesystem cctype
+filesystem cerrno
+filesystem climits
+filesystem clocale
+filesystem cmath
+filesystem compare
+filesystem concepts
+filesystem cstdarg
+filesystem cstddef
+filesystem cstdint
+filesystem cstdio
+filesystem cstdlib
+filesystem cstring
+filesystem ctime
+filesystem cwchar
+filesystem cwctype
+filesystem deque
+filesystem exception
+filesystem format
+filesystem functional
+filesystem initializer_list
+filesystem iomanip
+filesystem ios
+filesystem iosfwd
+filesystem istream
+filesystem iterator
+filesystem limits
+filesystem locale
+filesystem memory
+filesystem mutex
+filesystem new
+filesystem optional
+filesystem ostream
+filesystem print
+filesystem queue
+filesystem ratio
+filesystem stack
+filesystem stdexcept
+filesystem streambuf
+filesystem string
+filesystem string_view
+filesystem system_error
+filesystem tuple
+filesystem type_traits
+filesystem typeinfo
+filesystem unordered_map
+filesystem utility
+filesystem variant
+filesystem vector
+filesystem version
+flat_map cmath
+flat_map compare
+flat_map cstddef
+flat_map cstdint
+flat_map initializer_list
+flat_map limits
+flat_map type_traits
+flat_map version
+flat_set cmath
+flat_set compare
+flat_set cstddef
+flat_set cstdint
+flat_set initializer_list
+flat_set limits
+flat_set type_traits
+flat_set version
+format algorithm
+format array
+format atomic
+format bit
+format cctype
+format cerrno
+format climits
+format clocale
+format cmath
+format compare
+format concepts
+format cstdarg
+format cstddef
+format cstdint
+format cstdio
+format cstdlib
+format cstring
+format ctime
+format cwchar
+format cwctype
+format deque
+format exception
+format functional
+format initializer_list
+format ios
+format iosfwd
+format iterator
+format limits
+format locale
+format memory
+format mutex
+format new
+format optional
+format queue
+format ratio
+format stack
+format stdexcept
+format streambuf
+format string
+format string_view
+format system_error
+format tuple
+format type_traits
+format typeinfo
+format unordered_map
+format utility
+format variant
+format vector
+format version
+forward_list algorithm
+forward_list array
+forward_list atomic
+forward_list bit
+forward_list cctype
+forward_list cerrno
+forward_list climits
+forward_list clocale
+forward_list cmath
+forward_list compare
+forward_list concepts
+forward_list cstdarg
+forward_list cstddef
+forward_list cstdint
+forward_list cstdio
+forward_list cstdlib
+forward_list cstring
+forward_list ctime
+forward_list cwchar
+forward_list cwctype
+forward_list exception
+forward_list functional
+forward_list initializer_list
+forward_list ios
+forward_list iosfwd
+forward_list iterator
+forward_list limits
+forward_list locale
+forward_list memory
+forward_list mutex
+forward_list new
+forward_list optional
+forward_list ratio
+forward_list stdexcept
+forward_list streambuf
+forward_list string
+forward_list string_view
+forward_list system_error
+forward_list tuple
+forward_list type_traits
+forward_list typeinfo
+forward_list unordered_map
+forward_list utility
+forward_list variant
+forward_list vector
+forward_list version
+fstream algorithm
+fstream array
+fstream atomic
+fstream bit
+fstream bitset
+fstream cctype
+fstream cerrno
+fstream climits
+fstream clocale
+fstream cmath
+fstream compare
+fstream concepts
+fstream cstdarg
+fstream cstddef
+fstream cstdint
+fstream cstdio
+fstream cstdlib
+fstream cstring
+fstream ctime
+fstream cwchar
+fstream cwctype
+fstream deque
+fstream exception
+fstream filesystem
+fstream format
+fstream functional
+fstream initializer_list
+fstream iomanip
+fstream ios
+fstream iosfwd
+fstream istream
+fstream iterator
+fstream limits
+fstream locale
+fstream memory
+fstream mutex
+fstream new
+fstream optional
+fstream ostream
+fstream print
+fstream queue
+fstream ratio
+fstream stack
+fstream stdexcept
+fstream streambuf
+fstream string
+fstream string_view
+fstream system_error
+fstream tuple
+fstream type_traits
+fstream typeinfo
+fstream unordered_map
+fstream utility
+fstream variant
+fstream vector
+fstream version
+functional algorithm
+functional array
+functional atomic
+functional bit
+functional cctype
+functional cerrno
+functional climits
+functional clocale
+functional cmath
+functional compare
+functional concepts
+functional cstdarg
+functional cstddef
+functional cstdint
+functional cstdio
+functional cstdlib
+functional cstring
+functional ctime
+functional cwchar
+functional cwctype
+functional exception
+functional initializer_list
+functional ios
+functional iosfwd
+functional iterator
+functional limits
+functional locale
+functional memory
+functional mutex
+functional new
+functional optional
+functional ratio
+functional stdexcept
+functional streambuf
+functional string
+functional string_view
+functional system_error
+functional tuple
+functional type_traits
+functional typeinfo
+functional unordered_map
+functional utility
+functional variant
+functional vector
+functional version
+future algorithm
+future array
+future atomic
+future bit
+future bitset
+future cctype
+future cerrno
+future chrono
+future climits
+future clocale
+future cmath
+future compare
+future concepts
+future cstdarg
+future cstddef
+future cstdint
+future cstdio
+future cstdlib
+future cstring
+future ctime
+future cwchar
+future cwctype
+future deque
+future exception
+future format
+future forward_list
+future functional
+future initializer_list
+future ios
+future iosfwd
+future istream
+future iterator
+future limits
+future locale
+future memory
+future mutex
+future new
+future optional
+future ostream
+future print
+future queue
+future ratio
+future sstream
+future stack
+future stdexcept
+future streambuf
+future string
+future string_view
+future system_error
+future thread
+future tuple
+future type_traits
+future typeinfo
+future unordered_map
+future utility
+future variant
+future vector
+future version
+initializer_list cstddef
+initializer_list version
+iomanip algorithm
+iomanip array
+iomanip atomic
+iomanip bit
+iomanip bitset
+iomanip cctype
+iomanip cerrno
+iomanip climits
+iomanip clocale
+iomanip cmath
+iomanip compare
+iomanip concepts
+iomanip cstdarg
+iomanip cstddef
+iomanip cstdint
+iomanip cstdio
+iomanip cstdlib
+iomanip cstring
+iomanip ctime
+iomanip cwchar
+iomanip cwctype
+iomanip deque
+iomanip exception
+iomanip format
+iomanip functional
+iomanip initializer_list
+iomanip ios
+iomanip iosfwd
+iomanip istream
+iomanip iterator
+iomanip limits
+iomanip locale
+iomanip memory
+iomanip mutex
+iomanip new
+iomanip optional
+iomanip ostream
+iomanip print
+iomanip queue
+iomanip ratio
+iomanip stack
+iomanip stdexcept
+iomanip streambuf
+iomanip string
+iomanip string_view
+iomanip system_error
+iomanip tuple
+iomanip type_traits
+iomanip typeinfo
+iomanip unordered_map
+iomanip utility
+iomanip variant
+iomanip vector
+iomanip version
+ios algorithm
+ios atomic
+ios bit
+ios cctype
+ios cerrno
+ios climits
+ios clocale
+ios cmath
+ios compare
+ios concepts
+ios cstddef
+ios cstdint
+ios cstdio
+ios cstdlib
+ios cstring
+ios ctime
+ios cwchar
+ios cwctype
+ios exception
+ios initializer_list
+ios iosfwd
+ios iterator
+ios limits
+ios memory
+ios mutex
+ios new
+ios optional
+ios ratio
+ios stdexcept
+ios string
+ios string_view
+ios system_error
+ios tuple
+ios type_traits
+ios typeinfo
+ios utility
+ios variant
+ios version
+iosfwd version
+iostream algorithm
+iostream array
+iostream atomic
+iostream bit
+iostream bitset
+iostream cctype
+iostream cerrno
+iostream climits
+iostream clocale
+iostream cmath
+iostream compare
+iostream concepts
+iostream cstdarg
+iostream cstddef
+iostream cstdint
+iostream cstdio
+iostream cstdlib
+iostream cstring
+iostream ctime
+iostream cwchar
+iostream cwctype
+iostream deque
+iostream exception
+iostream format
+iostream functional
+iostream initializer_list
+iostream ios
+iostream iosfwd
+iostream istream
+iostream iterator
+iostream limits
+iostream locale
+iostream memory
+iostream mutex
+iostream new
+iostream optional
+iostream ostream
+iostream print
+iostream queue
+iostream ratio
+iostream stack
+iostream stdexcept
+iostream streambuf
+iostream string
+iostream string_view
+iostream system_error
+iostream tuple
+iostream type_traits
+iostream typeinfo
+iostream unordered_map
+iostream utility
+iostream variant
+iostream vector
+iostream version
+istream algorithm
+istream array
+istream atomic
+istream bit
+istream bitset
+istream cctype
+istream cerrno
+istream climits
+istream clocale
+istream cmath
+istream compare
+istream concepts
+istream cstdarg
+istream cstddef
+istream cstdint
+istream cstdio
+istream cstdlib
+istream cstring
+istream ctime
+istream cwchar
+istream cwctype
+istream deque
+istream exception
+istream format
+istream functional
+istream initializer_list
+istream ios
+istream iosfwd
+istream iterator
+istream limits
+istream locale
+istream memory
+istream mutex
+istream new
+istream optional
+istream ostream
+istream print
+istream queue
+istream ratio
+istream stack
+istream stdexcept
+istream streambuf
+istream string
+istream string_view
+istream system_error
+istream tuple
+istream type_traits
+istream typeinfo
+istream unordered_map
+istream utility
+istream variant
+istream vector
+istream version
+iterator cctype
+iterator cmath
+iterator compare
+iterator concepts
+iterator cstddef
+iterator cstdint
+iterator cstdio
+iterator cstdlib
+iterator cstring
+iterator cwchar
+iterator cwctype
+iterator exception
+iterator initializer_list
+iterator iosfwd
+iterator limits
+iterator new
+iterator tuple
+iterator type_traits
+iterator typeinfo
+iterator utility
+iterator variant
+iterator version
+latch atomic
+latch climits
+latch cmath
+latch compare
+latch cstddef
+latch cstdint
+latch cstdlib
+latch cstring
+latch ctime
+latch limits
+latch ratio
+latch type_traits
+latch version
+limits cstdint
+limits type_traits
+limits version
+list algorithm
+list array
+list atomic
+list bit
+list cctype
+list cerrno
+list climits
+list clocale
+list cmath
+list compare
+list concepts
+list cstdarg
+list cstddef
+list cstdint
+list cstdio
+list cstdlib
+list cstring
+list ctime
+list cwchar
+list cwctype
+list exception
+list functional
+list initializer_list
+list ios
+list iosfwd
+list iterator
+list limits
+list locale
+list memory
+list mutex
+list new
+list optional
+list ratio
+list stdexcept
+list streambuf
+list string
+list string_view
+list system_error
+list tuple
+list type_traits
+list typeinfo
+list unordered_map
+list utility
+list variant
+list vector
+list version
+locale algorithm
+locale atomic
+locale bit
+locale cctype
+locale cerrno
+locale climits
+locale clocale
+locale cmath
+locale compare
+locale concepts
+locale cstdarg
+locale cstddef
+locale cstdint
+locale cstdio
+locale cstdlib
+locale cstring
+locale ctime
+locale cwchar
+locale cwctype
+locale exception
+locale initializer_list
+locale ios
+locale iosfwd
+locale iterator
+locale limits
+locale memory
+locale mutex
+locale new
+locale optional
+locale ratio
+locale stdexcept
+locale streambuf
+locale string
+locale string_view
+locale system_error
+locale tuple
+locale type_traits
+locale typeinfo
+locale utility
+locale variant
+locale version
+map algorithm
+map array
+map atomic
+map bit
+map cctype
+map cerrno
+map climits
+map clocale
+map cmath
+map compare
+map concepts
+map cstdarg
+map cstddef
+map cstdint
+map cstdio
+map cstdlib
+map cstring
+map ctime
+map cwchar
+map cwctype
+map exception
+map functional
+map initializer_list
+map ios
+map iosfwd
+map iterator
+map limits
+map locale
+map memory
+map mutex
+map new
+map optional
+map ratio
+map stdexcept
+map streambuf
+map string
+map string_view
+map system_error
+map tuple
+map type_traits
+map typeinfo
+map unordered_map
+map utility
+map variant
+map vector
+map version
+mdspan version
+memory atomic
+memory cctype
+memory climits
+memory cmath
+memory compare
+memory concepts
+memory cstddef
+memory cstdint
+memory cstdio
+memory cstdlib
+memory cstring
+memory ctime
+memory cwchar
+memory cwctype
+memory exception
+memory initializer_list
+memory iosfwd
+memory iterator
+memory limits
+memory new
+memory ratio
+memory stdexcept
+memory tuple
+memory type_traits
+memory typeinfo
+memory utility
+memory variant
+memory version
+memory_resource algorithm
+memory_resource atomic
+memory_resource bit
+memory_resource cctype
+memory_resource cerrno
+memory_resource climits
+memory_resource cmath
+memory_resource compare
+memory_resource concepts
+memory_resource cstddef
+memory_resource cstdint
+memory_resource cstdio
+memory_resource cstdlib
+memory_resource cstring
+memory_resource ctime
+memory_resource cwchar
+memory_resource cwctype
+memory_resource exception
+memory_resource initializer_list
+memory_resource iosfwd
+memory_resource iterator
+memory_resource limits
+memory_resource memory
+memory_resource mutex
+memory_resource new
+memory_resource optional
+memory_resource ratio
+memory_resource stdexcept
+memory_resource string
+memory_resource string_view
+memory_resource system_error
+memory_resource tuple
+memory_resource type_traits
+memory_resource typeinfo
+memory_resource utility
+memory_resource variant
+memory_resource version
+mutex algorithm
+mutex atomic
+mutex bit
+mutex cctype
+mutex cerrno
+mutex climits
+mutex cmath
+mutex compare
+mutex concepts
+mutex cstddef
+mutex cstdint
+mutex cstdio
+mutex cstdlib
+mutex cstring
+mutex ctime
+mutex cwchar
+mutex cwctype
+mutex exception
+mutex initializer_list
+mutex iosfwd
+mutex iterator
+mutex limits
+mutex memory
+mutex new
+mutex optional
+mutex ratio
+mutex stdexcept
+mutex string
+mutex string_view
+mutex system_error
+mutex tuple
+mutex type_traits
+mutex typeinfo
+mutex utility
+mutex variant
+mutex version
+new cstddef
+new cstdint
+new cstdlib
+new type_traits
+new version
+numbers concepts
+numbers cstddef
+numbers cstdint
+numbers type_traits
+numbers version
+numeric algorithm
+numeric array
+numeric atomic
+numeric bit
+numeric cctype
+numeric cerrno
+numeric climits
+numeric clocale
+numeric cmath
+numeric compare
+numeric concepts
+numeric cstdarg
+numeric cstddef
+numeric cstdint
+numeric cstdio
+numeric cstdlib
+numeric cstring
+numeric ctime
+numeric cwchar
+numeric cwctype
+numeric exception
+numeric execution
+numeric functional
+numeric initializer_list
+numeric ios
+numeric iosfwd
+numeric iterator
+numeric limits
+numeric locale
+numeric memory
+numeric mutex
+numeric new
+numeric optional
+numeric ratio
+numeric stdexcept
+numeric streambuf
+numeric string
+numeric string_view
+numeric system_error
+numeric tuple
+numeric type_traits
+numeric typeinfo
+numeric unordered_map
+numeric utility
+numeric variant
+numeric vector
+numeric version
+optional atomic
+optional cctype
+optional climits
+optional cmath
+optional compare
+optional concepts
+optional cstddef
+optional cstdint
+optional cstdio
+optional cstdlib
+optional cstring
+optional ctime
+optional cwchar
+optional cwctype
+optional exception
+optional initializer_list
+optional iosfwd
+optional iterator
+optional limits
+optional memory
+optional new
+optional ratio
+optional stdexcept
+optional tuple
+optional type_traits
+optional typeinfo
+optional utility
+optional variant
+optional version
+ostream algorithm
+ostream array
+ostream atomic
+ostream bit
+ostream bitset
+ostream cctype
+ostream cerrno
+ostream climits
+ostream clocale
+ostream cmath
+ostream compare
+ostream concepts
+ostream cstdarg
+ostream cstddef
+ostream cstdint
+ostream cstdio
+ostream cstdlib
+ostream cstring
+ostream ctime
+ostream cwchar
+ostream cwctype
+ostream deque
+ostream exception
+ostream format
+ostream functional
+ostream initializer_list
+ostream ios
+ostream iosfwd
+ostream iterator
+ostream limits
+ostream locale
+ostream memory
+ostream mutex
+ostream new
+ostream optional
+ostream print
+ostream queue
+ostream ratio
+ostream stack
+ostream stdexcept
+ostream streambuf
+ostream string
+ostream string_view
+ostream system_error
+ostream tuple
+ostream type_traits
+ostream typeinfo
+ostream unordered_map
+ostream utility
+ostream variant
+ostream vector
+ostream version
+print algorithm
+print array
+print atomic
+print bit
+print cctype
+print cerrno
+print climits
+print clocale
+print cmath
+print compare
+print concepts
+print cstdarg
+print cstddef
+print cstdint
+print cstdio
+print cstdlib
+print cstring
+print ctime
+print cwchar
+print cwctype
+print deque
+print exception
+print format
+print functional
+print initializer_list
+print ios
+print iosfwd
+print iterator
+print limits
+print locale
+print memory
+print mutex
+print new
+print optional
+print queue
+print ratio
+print stack
+print stdexcept
+print streambuf
+print string
+print string_view
+print system_error
+print tuple
+print type_traits
+print typeinfo
+print unordered_map
+print utility
+print variant
+print vector
+print version
+queue algorithm
+queue array
+queue atomic
+queue bit
+queue cctype
+queue cerrno
+queue climits
+queue clocale
+queue cmath
+queue compare
+queue concepts
+queue cstdarg
+queue cstddef
+queue cstdint
+queue cstdio
+queue cstdlib
+queue cstring
+queue ctime
+queue cwchar
+queue cwctype
+queue deque
+queue exception
+queue functional
+queue initializer_list
+queue ios
+queue iosfwd
+queue iterator
+queue limits
+queue locale
+queue memory
+queue mutex
+queue new
+queue optional
+queue ratio
+queue stdexcept
+queue streambuf
+queue string
+queue string_view
+queue system_error
+queue tuple
+queue type_traits
+queue typeinfo
+queue unordered_map
+queue utility
+queue variant
+queue vector
+queue version
+random algorithm
+random array
+random atomic
+random bit
+random cctype
+random cerrno
+random climits
+random clocale
+random cmath
+random compare
+random concepts
+random cstdarg
+random cstddef
+random cstdint
+random cstdio
+random cstdlib
+random cstring
+random ctime
+random cwchar
+random cwctype
+random exception
+random execution
+random functional
+random initializer_list
+random ios
+random iosfwd
+random iterator
+random limits
+random locale
+random memory
+random mutex
+random new
+random numeric
+random optional
+random ratio
+random stdexcept
+random streambuf
+random string
+random string_view
+random system_error
+random tuple
+random type_traits
+random typeinfo
+random unordered_map
+random utility
+random variant
+random vector
+random version
+ranges cctype
+ranges cmath
+ranges compare
+ranges concepts
+ranges cstddef
+ranges cstdint
+ranges cstdio
+ranges cstdlib
+ranges cstring
+ranges cwchar
+ranges cwctype
+ranges exception
+ranges initializer_list
+ranges iosfwd
+ranges iterator
+ranges limits
+ranges new
+ranges tuple
+ranges type_traits
+ranges typeinfo
+ranges utility
+ranges variant
+ranges version
+ratio climits
+ratio cstdint
+ratio type_traits
+ratio version
+regex algorithm
+regex array
+regex atomic
+regex bit
+regex cctype
+regex cerrno
+regex climits
+regex clocale
+regex cmath
+regex compare
+regex concepts
+regex cstdarg
+regex cstddef
+regex cstdint
+regex cstdio
+regex cstdlib
+regex cstring
+regex ctime
+regex cwchar
+regex cwctype
+regex deque
+regex exception
+regex functional
+regex initializer_list
+regex ios
+regex iosfwd
+regex iterator
+regex limits
+regex locale
+regex memory
+regex mutex
+regex new
+regex optional
+regex ratio
+regex stdexcept
+regex streambuf
+regex string
+regex string_view
+regex system_error
+regex tuple
+regex type_traits
+regex typeinfo
+regex unordered_map
+regex utility
+regex variant
+regex vector
+regex version
+scoped_allocator atomic
+scoped_allocator cctype
+scoped_allocator climits
+scoped_allocator cmath
+scoped_allocator compare
+scoped_allocator concepts
+scoped_allocator cstddef
+scoped_allocator cstdint
+scoped_allocator cstdio
+scoped_allocator cstdlib
+scoped_allocator cstring
+scoped_allocator ctime
+scoped_allocator cwchar
+scoped_allocator cwctype
+scoped_allocator exception
+scoped_allocator initializer_list
+scoped_allocator iosfwd
+scoped_allocator iterator
+scoped_allocator limits
+scoped_allocator memory
+scoped_allocator new
+scoped_allocator ratio
+scoped_allocator stdexcept
+scoped_allocator tuple
+scoped_allocator type_traits
+scoped_allocator typeinfo
+scoped_allocator utility
+scoped_allocator variant
+scoped_allocator version
+semaphore atomic
+semaphore climits
+semaphore cmath
+semaphore compare
+semaphore cstddef
+semaphore cstdint
+semaphore cstdlib
+semaphore cstring
+semaphore ctime
+semaphore limits
+semaphore ratio
+semaphore type_traits
+semaphore version
+set algorithm
+set array
+set atomic
+set bit
+set cctype
+set cerrno
+set climits
+set clocale
+set cmath
+set compare
+set concepts
+set cstdarg
+set cstddef
+set cstdint
+set cstdio
+set cstdlib
+set cstring
+set ctime
+set cwchar
+set cwctype
+set exception
+set functional
+set initializer_list
+set ios
+set iosfwd
+set iterator
+set limits
+set locale
+set memory
+set mutex
+set new
+set optional
+set ratio
+set stdexcept
+set streambuf
+set string
+set string_view
+set system_error
+set tuple
+set type_traits
+set typeinfo
+set unordered_map
+set utility
+set variant
+set vector
+set version
+shared_mutex algorithm
+shared_mutex atomic
+shared_mutex bit
+shared_mutex cctype
+shared_mutex cerrno
+shared_mutex climits
+shared_mutex cmath
+shared_mutex compare
+shared_mutex concepts
+shared_mutex cstddef
+shared_mutex cstdint
+shared_mutex cstdio
+shared_mutex cstdlib
+shared_mutex cstring
+shared_mutex ctime
+shared_mutex cwchar
+shared_mutex cwctype
+shared_mutex exception
+shared_mutex initializer_list
+shared_mutex iosfwd
+shared_mutex iterator
+shared_mutex limits
+shared_mutex memory
+shared_mutex new
+shared_mutex optional
+shared_mutex ratio
+shared_mutex stdexcept
+shared_mutex string
+shared_mutex string_view
+shared_mutex system_error
+shared_mutex tuple
+shared_mutex type_traits
+shared_mutex typeinfo
+shared_mutex utility
+shared_mutex variant
+shared_mutex version
+source_location cstdint
+source_location version
+span algorithm
+span array
+span atomic
+span bit
+span cctype
+span cerrno
+span climits
+span clocale
+span cmath
+span compare
+span concepts
+span cstdarg
+span cstddef
+span cstdint
+span cstdio
+span cstdlib
+span cstring
+span ctime
+span cwchar
+span cwctype
+span exception
+span functional
+span initializer_list
+span ios
+span iosfwd
+span iterator
+span limits
+span locale
+span memory
+span mutex
+span new
+span optional
+span ratio
+span stdexcept
+span streambuf
+span string
+span string_view
+span system_error
+span tuple
+span type_traits
+span typeinfo
+span unordered_map
+span utility
+span variant
+span vector
+span version
+sstream algorithm
+sstream array
+sstream atomic
+sstream bit
+sstream bitset
+sstream cctype
+sstream cerrno
+sstream climits
+sstream clocale
+sstream cmath
+sstream compare
+sstream concepts
+sstream cstdarg
+sstream cstddef
+sstream cstdint
+sstream cstdio
+sstream cstdlib
+sstream cstring
+sstream ctime
+sstream cwchar
+sstream cwctype
+sstream deque
+sstream exception
+sstream format
+sstream functional
+sstream initializer_list
+sstream ios
+sstream iosfwd
+sstream istream
+sstream iterator
+sstream limits
+sstream locale
+sstream memory
+sstream mutex
+sstream new
+sstream optional
+sstream ostream
+sstream print
+sstream queue
+sstream ratio
+sstream stack
+sstream stdexcept
+sstream streambuf
+sstream string
+sstream string_view
+sstream system_error
+sstream tuple
+sstream type_traits
+sstream typeinfo
+sstream unordered_map
+sstream utility
+sstream variant
+sstream vector
+sstream version
+stack algorithm
+stack array
+stack atomic
+stack bit
+stack cctype
+stack cerrno
+stack climits
+stack clocale
+stack cmath
+stack compare
+stack concepts
+stack cstdarg
+stack cstddef
+stack cstdint
+stack cstdio
+stack cstdlib
+stack cstring
+stack ctime
+stack cwchar
+stack cwctype
+stack deque
+stack exception
+stack functional
+stack initializer_list
+stack ios
+stack iosfwd
+stack iterator
+stack limits
+stack locale
+stack memory
+stack mutex
+stack new
+stack optional
+stack ratio
+stack stdexcept
+stack streambuf
+stack string
+stack string_view
+stack system_error
+stack tuple
+stack type_traits
+stack typeinfo
+stack unordered_map
+stack utility
+stack variant
+stack vector
+stack version
+stdexcept cstddef
+stdexcept cstdint
+stdexcept cstdlib
+stdexcept exception
+stdexcept iosfwd
+stdexcept new
+stdexcept type_traits
+stdexcept typeinfo
+stdexcept version
+stop_token iosfwd
+stop_token version
+streambuf algorithm
+streambuf atomic
+streambuf bit
+streambuf cctype
+streambuf cerrno
+streambuf climits
+streambuf clocale
+streambuf cmath
+streambuf compare
+streambuf concepts
+streambuf cstddef
+streambuf cstdint
+streambuf cstdio
+streambuf cstdlib
+streambuf cstring
+streambuf ctime
+streambuf cwchar
+streambuf cwctype
+streambuf exception
+streambuf initializer_list
+streambuf ios
+streambuf iosfwd
+streambuf iterator
+streambuf limits
+streambuf memory
+streambuf mutex
+streambuf new
+streambuf optional
+streambuf ratio
+streambuf stdexcept
+streambuf string
+streambuf string_view
+streambuf system_error
+streambuf tuple
+streambuf type_traits
+streambuf typeinfo
+streambuf utility
+streambuf variant
+streambuf version
+string algorithm
+string atomic
+string bit
+string cctype
+string climits
+string cmath
+string compare
+string concepts
+string cstddef
+string cstdint
+string cstdio
+string cstdlib
+string cstring
+string ctime
+string cwchar
+string cwctype
+string exception
+string initializer_list
+string iosfwd
+string iterator
+string limits
+string memory
+string new
+string optional
+string ratio
+string stdexcept
+string string_view
+string tuple
+string type_traits
+string typeinfo
+string utility
+string variant
+string version
+string_view algorithm
+string_view atomic
+string_view bit
+string_view cctype
+string_view climits
+string_view cmath
+string_view compare
+string_view concepts
+string_view cstddef
+string_view cstdint
+string_view cstdio
+string_view cstdlib
+string_view cstring
+string_view ctime
+string_view cwchar
+string_view cwctype
+string_view exception
+string_view initializer_list
+string_view iosfwd
+string_view iterator
+string_view limits
+string_view memory
+string_view new
+string_view optional
+string_view ratio
+string_view stdexcept
+string_view tuple
+string_view type_traits
+string_view typeinfo
+string_view utility
+string_view variant
+string_view version
+strstream algorithm
+strstream array
+strstream atomic
+strstream bit
+strstream bitset
+strstream cctype
+strstream cerrno
+strstream climits
+strstream clocale
+strstream cmath
+strstream compare
+strstream concepts
+strstream cstdarg
+strstream cstddef
+strstream cstdint
+strstream cstdio
+strstream cstdlib
+strstream cstring
+strstream ctime
+strstream cwchar
+strstream cwctype
+strstream deque
+strstream exception
+strstream format
+strstream functional
+strstream initializer_list
+strstream ios
+strstream iosfwd
+strstream istream
+strstream iterator
+strstream limits
+strstream locale
+strstream memory
+strstream mutex
+strstream new
+strstream optional
+strstream ostream
+strstream print
+strstream queue
+strstream ratio
+strstream stack
+strstream stdexcept
+strstream streambuf
+strstream string
+strstream string_view
+strstream system_error
+strstream tuple
+strstream type_traits
+strstream typeinfo
+strstream unordered_map
+strstream utility
+strstream variant
+strstream vector
+strstream version
+syncstream algorithm
+syncstream array
+syncstream atomic
+syncstream bit
+syncstream bitset
+syncstream cctype
+syncstream cerrno
+syncstream climits
+syncstream clocale
+syncstream cmath
+syncstream compare
+syncstream concepts
+syncstream cstdarg
+syncstream cstddef
+syncstream cstdint
+syncstream cstdio
+syncstream cstdlib
+syncstream cstring
+syncstream ctime
+syncstream cwchar
+syncstream cwctype
+syncstream deque
+syncstream exception
+syncstream format
+syncstream functional
+syncstream initializer_list
+syncstream ios
+syncstream iosfwd
+syncstream iterator
+syncstream limits
+syncstream locale
+syncstream map
+syncstream memory
+syncstream mutex
+syncstream new
+syncstream optional
+syncstream ostream
+syncstream print
+syncstream queue
+syncstream ratio
+syncstream shared_mutex
+syncstream stack
+syncstream stdexcept
+syncstream streambuf
+syncstream string
+syncstream string_view
+syncstream system_error
+syncstream tuple
+syncstream type_traits
+syncstream typeinfo
+syncstream unordered_map
+syncstream utility
+syncstream variant
+syncstream vector
+syncstream version
+system_error algorithm
+system_error atomic
+system_error bit
+system_error cctype
+system_error cerrno
+system_error climits
+system_error cmath
+system_error compare
+system_error concepts
+system_error cstddef
+system_error cstdint
+system_error cstdio
+system_error cstdlib
+system_error cstring
+system_error ctime
+system_error cwchar
+system_error cwctype
+system_error exception
+system_error initializer_list
+system_error iosfwd
+system_error iterator
+system_error limits
+system_error memory
+system_error new
+system_error optional
+system_error ratio
+system_error stdexcept
+system_error string
+system_error string_view
+system_error tuple
+system_error type_traits
+system_error typeinfo
+system_error utility
+system_error variant
+system_error version
+thread algorithm
+thread array
+thread atomic
+thread bit
+thread bitset
+thread cctype
+thread cerrno
+thread chrono
+thread climits
+thread clocale
+thread cmath
+thread compare
+thread concepts
+thread cstdarg
+thread cstddef
+thread cstdint
+thread cstdio
+thread cstdlib
+thread cstring
+thread ctime
+thread cwchar
+thread cwctype
+thread deque
+thread exception
+thread format
+thread forward_list
+thread functional
+thread initializer_list
+thread ios
+thread iosfwd
+thread istream
+thread iterator
+thread limits
+thread locale
+thread memory
+thread mutex
+thread new
+thread optional
+thread ostream
+thread print
+thread queue
+thread ratio
+thread sstream
+thread stack
+thread stdexcept
+thread streambuf
+thread string
+thread string_view
+thread system_error
+thread tuple
+thread type_traits
+thread typeinfo
+thread unordered_map
+thread utility
+thread variant
+thread vector
+thread version
+tuple cmath
+tuple compare
+tuple cstddef
+tuple cstdint
+tuple cstdlib
+tuple exception
+tuple initializer_list
+tuple iosfwd
+tuple limits
+tuple new
+tuple type_traits
+tuple typeinfo
+tuple utility
+tuple version
+type_traits cstdint
+type_traits version
+typeindex cmath
+typeindex compare
+typeindex cstddef
+typeindex cstdint
+typeindex cstdlib
+typeindex initializer_list
+typeindex iosfwd
+typeindex limits
+typeindex new
+typeindex type_traits
+typeindex typeinfo
+typeindex utility
+typeindex version
+typeinfo cstddef
+typeinfo cstdint
+typeinfo cstdlib
+typeinfo type_traits
+typeinfo version
+unordered_map algorithm
+unordered_map atomic
+unordered_map bit
+unordered_map cctype
+unordered_map climits
+unordered_map cmath
+unordered_map compare
+unordered_map concepts
+unordered_map cstddef
+unordered_map cstdint
+unordered_map cstdio
+unordered_map cstdlib
+unordered_map cstring
+unordered_map ctime
+unordered_map cwchar
+unordered_map cwctype
+unordered_map exception
+unordered_map initializer_list
+unordered_map iosfwd
+unordered_map iterator
+unordered_map limits
+unordered_map memory
+unordered_map new
+unordered_map optional
+unordered_map ratio
+unordered_map stdexcept
+unordered_map tuple
+unordered_map type_traits
+unordered_map typeinfo
+unordered_map utility
+unordered_map variant
+unordered_map version
+unordered_set algorithm
+unordered_set array
+unordered_set atomic
+unordered_set bit
+unordered_set cctype
+unordered_set cerrno
+unordered_set climits
+unordered_set clocale
+unordered_set cmath
+unordered_set compare
+unordered_set concepts
+unordered_set cstdarg
+unordered_set cstddef
+unordered_set cstdint
+unordered_set cstdio
+unordered_set cstdlib
+unordered_set cstring
+unordered_set ctime
+unordered_set cwchar
+unordered_set cwctype
+unordered_set exception
+unordered_set functional
+unordered_set initializer_list
+unordered_set ios
+unordered_set iosfwd
+unordered_set iterator
+unordered_set limits
+unordered_set locale
+unordered_set memory
+unordered_set mutex
+unordered_set new
+unordered_set optional
+unordered_set ratio
+unordered_set stdexcept
+unordered_set streambuf
+unordered_set string
+unordered_set string_view
+unordered_set system_error
+unordered_set tuple
+unordered_set type_traits
+unordered_set typeinfo
+unordered_set unordered_map
+unordered_set utility
+unordered_set variant
+unordered_set vector
+unordered_set version
+utility cmath
+utility compare
+utility cstddef
+utility cstdint
+utility cstdlib
+utility initializer_list
+utility iosfwd
+utility limits
+utility type_traits
+utility version
+valarray algorithm
+valarray array
+valarray atomic
+valarray bit
+valarray cctype
+valarray cerrno
+valarray climits
+valarray clocale
+valarray cmath
+valarray compare
+valarray concepts
+valarray cstdarg
+valarray cstddef
+valarray cstdint
+valarray cstdio
+valarray cstdlib
+valarray cstring
+valarray ctime
+valarray cwchar
+valarray cwctype
+valarray exception
+valarray functional
+valarray initializer_list
+valarray ios
+valarray iosfwd
+valarray iterator
+valarray limits
+valarray locale
+valarray memory
+valarray mutex
+valarray new
+valarray optional
+valarray ratio
+valarray stdexcept
+valarray streambuf
+valarray string
+valarray string_view
+valarray system_error
+valarray tuple
+valarray type_traits
+valarray typeinfo
+valarray unordered_map
+valarray utility
+valarray variant
+valarray vector
+valarray version
+variant cmath
+variant compare
+variant cstddef
+variant cstdint
+variant cstdlib
+variant cstring
+variant exception
+variant initializer_list
+variant iosfwd
+variant limits
+variant new
+variant tuple
+variant type_traits
+variant typeinfo
+variant utility
+variant version
+vector algorithm
+vector array
+vector atomic
+vector bit
+vector cctype
+vector cerrno
+vector climits
+vector clocale
+vector cmath
+vector compare
+vector concepts
+vector cstdarg
+vector cstddef
+vector cstdint
+vector cstdio
+vector cstdlib
+vector cstring
+vector ctime
+vector cwchar
+vector cwctype
+vector exception
+vector initializer_list
+vector ios
+vector iosfwd
+vector iterator
+vector limits
+vector locale
+vector memory
+vector mutex
+vector new
+vector optional
+vector ratio
+vector stdexcept
+vector streambuf
+vector string
+vector string_view
+vector system_error
+vector tuple
+vector type_traits
+vector typeinfo
+vector utility
+vector variant
+vector version
diff --git a/libcxx/test/libcxx-03/transitive_includes/cxx20.csv b/libcxx/test/libcxx-03/transitive_includes/cxx20.csv
new file mode 100644
index 0000000000000..55c79acff5a8f
--- /dev/null
+++ b/libcxx/test/libcxx-03/transitive_includes/cxx20.csv
@@ -0,0 +1,2649 @@
+algorithm atomic
+algorithm bit
+algorithm cctype
+algorithm climits
+algorithm cmath
+algorithm compare
+algorithm concepts
+algorithm cstddef
+algorithm cstdint
+algorithm cstdio
+algorithm cstdlib
+algorithm cstring
+algorithm ctime
+algorithm cwchar
+algorithm cwctype
+algorithm exception
+algorithm initializer_list
+algorithm iosfwd
+algorithm iterator
+algorithm limits
+algorithm memory
+algorithm new
+algorithm optional
+algorithm ratio
+algorithm stdexcept
+algorithm tuple
+algorithm type_traits
+algorithm typeinfo
+algorithm utility
+algorithm variant
+algorithm version
+any atomic
+any cctype
+any climits
+any cmath
+any compare
+any concepts
+any cstddef
+any cstdint
+any cstdio
+any cstdlib
+any cstring
+any ctime
+any cwchar
+any cwctype
+any exception
+any initializer_list
+any iosfwd
+any iterator
+any limits
+any memory
+any new
+any ratio
+any stdexcept
+any tuple
+any type_traits
+any typeinfo
+any utility
+any variant
+any version
+array algorithm
+array atomic
+array bit
+array cctype
+array climits
+array cmath
+array compare
+array concepts
+array cstddef
+array cstdint
+array cstdio
+array cstdlib
+array cstring
+array ctime
+array cwchar
+array cwctype
+array exception
+array initializer_list
+array iosfwd
+array iterator
+array limits
+array memory
+array new
+array optional
+array ratio
+array stdexcept
+array tuple
+array type_traits
+array typeinfo
+array utility
+array variant
+array version
+atomic climits
+atomic cmath
+atomic compare
+atomic cstddef
+atomic cstdint
+atomic cstdlib
+atomic cstring
+atomic ctime
+atomic limits
+atomic ratio
+atomic type_traits
+atomic version
+barrier atomic
+barrier cctype
+barrier climits
+barrier cmath
+barrier compare
+barrier concepts
+barrier cstddef
+barrier cstdint
+barrier cstdio
+barrier cstdlib
+barrier cstring
+barrier ctime
+barrier cwchar
+barrier cwctype
+barrier exception
+barrier initializer_list
+barrier iosfwd
+barrier iterator
+barrier limits
+barrier memory
+barrier new
+barrier ratio
+barrier stdexcept
+barrier tuple
+barrier type_traits
+barrier typeinfo
+barrier utility
+barrier variant
+barrier version
+bit cstdint
+bit cstdlib
+bit iosfwd
+bit limits
+bit type_traits
+bit version
+bitset algorithm
+bitset atomic
+bitset bit
+bitset cctype
+bitset climits
+bitset cmath
+bitset compare
+bitset concepts
+bitset cstddef
+bitset cstdint
+bitset cstdio
+bitset cstdlib
+bitset cstring
+bitset ctime
+bitset cwchar
+bitset cwctype
+bitset exception
+bitset initializer_list
+bitset iosfwd
+bitset iterator
+bitset limits
+bitset memory
+bitset new
+bitset optional
+bitset ratio
+bitset stdexcept
+bitset string
+bitset string_view
+bitset tuple
+bitset type_traits
+bitset typeinfo
+bitset utility
+bitset variant
+bitset version
+ccomplex algorithm
+ccomplex array
+ccomplex atomic
+ccomplex bit
+ccomplex bitset
+ccomplex cctype
+ccomplex cerrno
+ccomplex climits
+ccomplex clocale
+ccomplex cmath
+ccomplex compare
+ccomplex complex
+ccomplex concepts
+ccomplex cstdarg
+ccomplex cstddef
+ccomplex cstdint
+ccomplex cstdio
+ccomplex cstdlib
+ccomplex cstring
+ccomplex ctime
+ccomplex cwchar
+ccomplex cwctype
+ccomplex deque
+ccomplex exception
+ccomplex format
+ccomplex functional
+ccomplex initializer_list
+ccomplex ios
+ccomplex iosfwd
+ccomplex istream
+ccomplex iterator
+ccomplex limits
+ccomplex locale
+ccomplex memory
+ccomplex mutex
+ccomplex new
+ccomplex optional
+ccomplex ostream
+ccomplex print
+ccomplex queue
+ccomplex ratio
+ccomplex sstream
+ccomplex stack
+ccomplex stdexcept
+ccomplex streambuf
+ccomplex string
+ccomplex string_view
+ccomplex system_error
+ccomplex tuple
+ccomplex type_traits
+ccomplex typeinfo
+ccomplex unordered_map
+ccomplex utility
+ccomplex variant
+ccomplex vector
+ccomplex version
+charconv cerrno
+charconv cmath
+charconv concepts
+charconv cstddef
+charconv cstdint
+charconv cstdlib
+charconv cstring
+charconv initializer_list
+charconv iosfwd
+charconv limits
+charconv new
+charconv type_traits
+charconv version
+chrono algorithm
+chrono array
+chrono atomic
+chrono bit
+chrono bitset
+chrono cctype
+chrono cerrno
+chrono charconv
+chrono climits
+chrono clocale
+chrono cmath
+chrono compare
+chrono concepts
+chrono cstdarg
+chrono cstddef
+chrono cstdint
+chrono cstdio
+chrono cstdlib
+chrono cstring
+chrono ctime
+chrono cwchar
+chrono cwctype
+chrono deque
+chrono exception
+chrono format
+chrono forward_list
+chrono functional
+chrono initializer_list
+chrono ios
+chrono iosfwd
+chrono istream
+chrono iterator
+chrono limits
+chrono locale
+chrono memory
+chrono mutex
+chrono new
+chrono optional
+chrono ostream
+chrono print
+chrono queue
+chrono ratio
+chrono sstream
+chrono stack
+chrono stdexcept
+chrono streambuf
+chrono string
+chrono string_view
+chrono system_error
+chrono tuple
+chrono type_traits
+chrono typeinfo
+chrono unordered_map
+chrono utility
+chrono variant
+chrono vector
+chrono version
+cinttypes cstdint
+cmath cstdint
+cmath limits
+cmath type_traits
+cmath version
+codecvt algorithm
+codecvt atomic
+codecvt bit
+codecvt cctype
+codecvt cerrno
+codecvt climits
+codecvt clocale
+codecvt cmath
+codecvt compare
+codecvt concepts
+codecvt cstddef
+codecvt cstdint
+codecvt cstdio
+codecvt cstdlib
+codecvt cstring
+codecvt ctime
+codecvt cwchar
+codecvt cwctype
+codecvt exception
+codecvt initializer_list
+codecvt iosfwd
+codecvt iterator
+codecvt limits
+codecvt memory
+codecvt mutex
+codecvt new
+codecvt optional
+codecvt ratio
+codecvt stdexcept
+codecvt string
+codecvt string_view
+codecvt system_error
+codecvt tuple
+codecvt type_traits
+codecvt typeinfo
+codecvt utility
+codecvt variant
+codecvt version
+compare cmath
+compare cstddef
+compare cstdint
+compare limits
+compare type_traits
+compare version
+complex algorithm
+complex array
+complex atomic
+complex bit
+complex bitset
+complex cctype
+complex cerrno
+complex climits
+complex clocale
+complex cmath
+complex compare
+complex concepts
+complex cstdarg
+complex cstddef
+complex cstdint
+complex cstdio
+complex cstdlib
+complex cstring
+complex ctime
+complex cwchar
+complex cwctype
+complex deque
+complex exception
+complex format
+complex functional
+complex initializer_list
+complex ios
+complex iosfwd
+complex istream
+complex iterator
+complex limits
+complex locale
+complex memory
+complex mutex
+complex new
+complex optional
+complex ostream
+complex print
+complex queue
+complex ratio
+complex sstream
+complex stack
+complex stdexcept
+complex streambuf
+complex string
+complex string_view
+complex system_error
+complex tuple
+complex type_traits
+complex typeinfo
+complex unordered_map
+complex utility
+complex variant
+complex vector
+complex version
+concepts cstddef
+concepts cstdint
+concepts type_traits
+concepts version
+condition_variable algorithm
+condition_variable atomic
+condition_variable bit
+condition_variable cctype
+condition_variable cerrno
+condition_variable climits
+condition_variable cmath
+condition_variable compare
+condition_variable concepts
+condition_variable cstddef
+condition_variable cstdint
+condition_variable cstdio
+condition_variable cstdlib
+condition_variable cstring
+condition_variable ctime
+condition_variable cwchar
+condition_variable cwctype
+condition_variable exception
+condition_variable initializer_list
+condition_variable iosfwd
+condition_variable iterator
+condition_variable limits
+condition_variable memory
+condition_variable new
+condition_variable optional
+condition_variable ratio
+condition_variable stdexcept
+condition_variable string
+condition_variable string_view
+condition_variable system_error
+condition_variable tuple
+condition_variable type_traits
+condition_variable typeinfo
+condition_variable utility
+condition_variable variant
+condition_variable version
+coroutine cmath
+coroutine compare
+coroutine cstddef
+coroutine cstdint
+coroutine cstring
+coroutine iosfwd
+coroutine limits
+coroutine type_traits
+coroutine version
+cstddef version
+ctgmath algorithm
+ctgmath array
+ctgmath atomic
+ctgmath bit
+ctgmath bitset
+ctgmath cctype
+ctgmath cerrno
+ctgmath climits
+ctgmath clocale
+ctgmath cmath
+ctgmath compare
+ctgmath complex
+ctgmath concepts
+ctgmath cstdarg
+ctgmath cstddef
+ctgmath cstdint
+ctgmath cstdio
+ctgmath cstdlib
+ctgmath cstring
+ctgmath ctime
+ctgmath cwchar
+ctgmath cwctype
+ctgmath deque
+ctgmath exception
+ctgmath format
+ctgmath functional
+ctgmath initializer_list
+ctgmath ios
+ctgmath iosfwd
+ctgmath istream
+ctgmath iterator
+ctgmath limits
+ctgmath locale
+ctgmath memory
+ctgmath mutex
+ctgmath new
+ctgmath optional
+ctgmath ostream
+ctgmath print
+ctgmath queue
+ctgmath ratio
+ctgmath sstream
+ctgmath stack
+ctgmath stdexcept
+ctgmath streambuf
+ctgmath string
+ctgmath string_view
+ctgmath system_error
+ctgmath tuple
+ctgmath type_traits
+ctgmath typeinfo
+ctgmath unordered_map
+ctgmath utility
+ctgmath variant
+ctgmath vector
+ctgmath version
+cwchar cctype
+cwchar cstddef
+cwchar cwctype
+cwchar version
+cwctype cctype
+deque algorithm
+deque array
+deque atomic
+deque bit
+deque cctype
+deque cerrno
+deque climits
+deque clocale
+deque cmath
+deque compare
+deque concepts
+deque cstdarg
+deque cstddef
+deque cstdint
+deque cstdio
+deque cstdlib
+deque cstring
+deque ctime
+deque cwchar
+deque cwctype
+deque exception
+deque functional
+deque initializer_list
+deque ios
+deque iosfwd
+deque iterator
+deque limits
+deque locale
+deque memory
+deque mutex
+deque new
+deque optional
+deque ratio
+deque stdexcept
+deque streambuf
+deque string
+deque string_view
+deque system_error
+deque tuple
+deque type_traits
+deque typeinfo
+deque unordered_map
+deque utility
+deque variant
+deque vector
+deque version
+exception cstddef
+exception cstdint
+exception cstdlib
+exception new
+exception type_traits
+exception typeinfo
+exception version
+execution cstddef
+execution version
+expected version
+experimental/iterator algorithm
+experimental/iterator atomic
+experimental/iterator bit
+experimental/iterator bitset
+experimental/iterator cctype
+experimental/iterator cerrno
+experimental/iterator climits
+experimental/iterator clocale
+experimental/iterator cmath
+experimental/iterator compare
+experimental/iterator concepts
+experimental/iterator cstdarg
+experimental/iterator cstddef
+experimental/iterator cstdint
+experimental/iterator cstdio
+experimental/iterator cstdlib
+experimental/iterator cstring
+experimental/iterator ctime
+experimental/iterator cwchar
+experimental/iterator cwctype
+experimental/iterator exception
+experimental/iterator initializer_list
+experimental/iterator ios
+experimental/iterator iosfwd
+experimental/iterator iterator
+experimental/iterator limits
+experimental/iterator locale
+experimental/iterator memory
+experimental/iterator mutex
+experimental/iterator new
+experimental/iterator optional
+experimental/iterator ratio
+experimental/iterator stdexcept
+experimental/iterator streambuf
+experimental/iterator string
+experimental/iterator string_view
+experimental/iterator system_error
+experimental/iterator tuple
+experimental/iterator type_traits
+experimental/iterator typeinfo
+experimental/iterator utility
+experimental/iterator variant
+experimental/iterator version
+experimental/memory cstddef
+experimental/memory cstdint
+experimental/memory cstring
+experimental/memory limits
+experimental/memory type_traits
+experimental/memory version
+experimental/propagate_const cstddef
+experimental/propagate_const cstdint
+experimental/propagate_const type_traits
+experimental/propagate_const version
+experimental/simd cstddef
+experimental/simd cstdint
+experimental/simd limits
+experimental/simd type_traits
+experimental/simd version
+experimental/type_traits cstddef
+experimental/type_traits cstdint
+experimental/type_traits initializer_list
+experimental/type_traits type_traits
+experimental/type_traits version
+experimental/utility cmath
+experimental/utility compare
+experimental/utility cstddef
+experimental/utility cstdint
+experimental/utility cstdlib
+experimental/utility initializer_list
+experimental/utility iosfwd
+experimental/utility limits
+experimental/utility type_traits
+experimental/utility utility
+experimental/utility version
+filesystem algorithm
+filesystem array
+filesystem atomic
+filesystem bit
+filesystem bitset
+filesystem cctype
+filesystem cerrno
+filesystem climits
+filesystem clocale
+filesystem cmath
+filesystem compare
+filesystem concepts
+filesystem cstdarg
+filesystem cstddef
+filesystem cstdint
+filesystem cstdio
+filesystem cstdlib
+filesystem cstring
+filesystem ctime
+filesystem cwchar
+filesystem cwctype
+filesystem deque
+filesystem exception
+filesystem format
+filesystem functional
+filesystem initializer_list
+filesystem iomanip
+filesystem ios
+filesystem iosfwd
+filesystem istream
+filesystem iterator
+filesystem limits
+filesystem locale
+filesystem memory
+filesystem mutex
+filesystem new
+filesystem optional
+filesystem ostream
+filesystem print
+filesystem queue
+filesystem ratio
+filesystem stack
+filesystem stdexcept
+filesystem streambuf
+filesystem string
+filesystem string_view
+filesystem system_error
+filesystem tuple
+filesystem type_traits
+filesystem typeinfo
+filesystem unordered_map
+filesystem utility
+filesystem variant
+filesystem vector
+filesystem version
+flat_map cmath
+flat_map compare
+flat_map cstddef
+flat_map cstdint
+flat_map initializer_list
+flat_map limits
+flat_map type_traits
+flat_map version
+flat_set cmath
+flat_set compare
+flat_set cstddef
+flat_set cstdint
+flat_set initializer_list
+flat_set limits
+flat_set type_traits
+flat_set version
+format algorithm
+format array
+format atomic
+format bit
+format cctype
+format cerrno
+format climits
+format clocale
+format cmath
+format compare
+format concepts
+format cstdarg
+format cstddef
+format cstdint
+format cstdio
+format cstdlib
+format cstring
+format ctime
+format cwchar
+format cwctype
+format deque
+format exception
+format functional
+format initializer_list
+format ios
+format iosfwd
+format iterator
+format limits
+format locale
+format memory
+format mutex
+format new
+format optional
+format queue
+format ratio
+format stack
+format stdexcept
+format streambuf
+format string
+format string_view
+format system_error
+format tuple
+format type_traits
+format typeinfo
+format unordered_map
+format utility
+format variant
+format vector
+format version
+forward_list algorithm
+forward_list array
+forward_list atomic
+forward_list bit
+forward_list cctype
+forward_list cerrno
+forward_list climits
+forward_list clocale
+forward_list cmath
+forward_list compare
+forward_list concepts
+forward_list cstdarg
+forward_list cstddef
+forward_list cstdint
+forward_list cstdio
+forward_list cstdlib
+forward_list cstring
+forward_list ctime
+forward_list cwchar
+forward_list cwctype
+forward_list exception
+forward_list functional
+forward_list initializer_list
+forward_list ios
+forward_list iosfwd
+forward_list iterator
+forward_list limits
+forward_list locale
+forward_list memory
+forward_list mutex
+forward_list new
+forward_list optional
+forward_list ratio
+forward_list stdexcept
+forward_list streambuf
+forward_list string
+forward_list string_view
+forward_list system_error
+forward_list tuple
+forward_list type_traits
+forward_list typeinfo
+forward_list unordered_map
+forward_list utility
+forward_list variant
+forward_list vector
+forward_list version
+fstream algorithm
+fstream array
+fstream atomic
+fstream bit
+fstream bitset
+fstream cctype
+fstream cerrno
+fstream climits
+fstream clocale
+fstream cmath
+fstream compare
+fstream concepts
+fstream cstdarg
+fstream cstddef
+fstream cstdint
+fstream cstdio
+fstream cstdlib
+fstream cstring
+fstream ctime
+fstream cwchar
+fstream cwctype
+fstream deque
+fstream exception
+fstream filesystem
+fstream format
+fstream functional
+fstream initializer_list
+fstream iomanip
+fstream ios
+fstream iosfwd
+fstream istream
+fstream iterator
+fstream limits
+fstream locale
+fstream memory
+fstream mutex
+fstream new
+fstream optional
+fstream ostream
+fstream print
+fstream queue
+fstream ratio
+fstream stack
+fstream stdexcept
+fstream streambuf
+fstream string
+fstream string_view
+fstream system_error
+fstream tuple
+fstream type_traits
+fstream typeinfo
+fstream unordered_map
+fstream utility
+fstream variant
+fstream vector
+fstream version
+functional algorithm
+functional array
+functional atomic
+functional bit
+functional cctype
+functional cerrno
+functional climits
+functional clocale
+functional cmath
+functional compare
+functional concepts
+functional cstdarg
+functional cstddef
+functional cstdint
+functional cstdio
+functional cstdlib
+functional cstring
+functional ctime
+functional cwchar
+functional cwctype
+functional exception
+functional initializer_list
+functional ios
+functional iosfwd
+functional iterator
+functional limits
+functional locale
+functional memory
+functional mutex
+functional new
+functional optional
+functional ratio
+functional stdexcept
+functional streambuf
+functional string
+functional string_view
+functional system_error
+functional tuple
+functional type_traits
+functional typeinfo
+functional unordered_map
+functional utility
+functional variant
+functional vector
+functional version
+future algorithm
+future array
+future atomic
+future bit
+future bitset
+future cctype
+future cerrno
+future climits
+future clocale
+future cmath
+future compare
+future concepts
+future cstdarg
+future cstddef
+future cstdint
+future cstdio
+future cstdlib
+future cstring
+future ctime
+future cwchar
+future cwctype
+future deque
+future exception
+future format
+future functional
+future initializer_list
+future ios
+future iosfwd
+future istream
+future iterator
+future limits
+future locale
+future memory
+future mutex
+future new
+future optional
+future ostream
+future print
+future queue
+future ratio
+future sstream
+future stack
+future stdexcept
+future streambuf
+future string
+future string_view
+future system_error
+future thread
+future tuple
+future type_traits
+future typeinfo
+future unordered_map
+future utility
+future variant
+future vector
+future version
+initializer_list cstddef
+initializer_list version
+iomanip algorithm
+iomanip array
+iomanip atomic
+iomanip bit
+iomanip bitset
+iomanip cctype
+iomanip cerrno
+iomanip climits
+iomanip clocale
+iomanip cmath
+iomanip compare
+iomanip concepts
+iomanip cstdarg
+iomanip cstddef
+iomanip cstdint
+iomanip cstdio
+iomanip cstdlib
+iomanip cstring
+iomanip ctime
+iomanip cwchar
+iomanip cwctype
+iomanip deque
+iomanip exception
+iomanip format
+iomanip functional
+iomanip initializer_list
+iomanip ios
+iomanip iosfwd
+iomanip istream
+iomanip iterator
+iomanip limits
+iomanip locale
+iomanip memory
+iomanip mutex
+iomanip new
+iomanip optional
+iomanip ostream
+iomanip print
+iomanip queue
+iomanip ratio
+iomanip stack
+iomanip stdexcept
+iomanip streambuf
+iomanip string
+iomanip string_view
+iomanip system_error
+iomanip tuple
+iomanip type_traits
+iomanip typeinfo
+iomanip unordered_map
+iomanip utility
+iomanip variant
+iomanip vector
+iomanip version
+ios algorithm
+ios atomic
+ios bit
+ios cctype
+ios cerrno
+ios climits
+ios clocale
+ios cmath
+ios compare
+ios concepts
+ios cstddef
+ios cstdint
+ios cstdio
+ios cstdlib
+ios cstring
+ios ctime
+ios cwchar
+ios cwctype
+ios exception
+ios initializer_list
+ios iosfwd
+ios iterator
+ios limits
+ios memory
+ios mutex
+ios new
+ios optional
+ios ratio
+ios stdexcept
+ios string
+ios string_view
+ios system_error
+ios tuple
+ios type_traits
+ios typeinfo
+ios utility
+ios variant
+ios version
+iosfwd version
+iostream algorithm
+iostream array
+iostream atomic
+iostream bit
+iostream bitset
+iostream cctype
+iostream cerrno
+iostream climits
+iostream clocale
+iostream cmath
+iostream compare
+iostream concepts
+iostream cstdarg
+iostream cstddef
+iostream cstdint
+iostream cstdio
+iostream cstdlib
+iostream cstring
+iostream ctime
+iostream cwchar
+iostream cwctype
+iostream deque
+iostream exception
+iostream format
+iostream functional
+iostream initializer_list
+iostream ios
+iostream iosfwd
+iostream istream
+iostream iterator
+iostream limits
+iostream locale
+iostream memory
+iostream mutex
+iostream new
+iostream optional
+iostream ostream
+iostream print
+iostream queue
+iostream ratio
+iostream stack
+iostream stdexcept
+iostream streambuf
+iostream string
+iostream string_view
+iostream system_error
+iostream tuple
+iostream type_traits
+iostream typeinfo
+iostream unordered_map
+iostream utility
+iostream variant
+iostream vector
+iostream version
+istream algorithm
+istream array
+istream atomic
+istream bit
+istream bitset
+istream cctype
+istream cerrno
+istream climits
+istream clocale
+istream cmath
+istream compare
+istream concepts
+istream cstdarg
+istream cstddef
+istream cstdint
+istream cstdio
+istream cstdlib
+istream cstring
+istream ctime
+istream cwchar
+istream cwctype
+istream deque
+istream exception
+istream format
+istream functional
+istream initializer_list
+istream ios
+istream iosfwd
+istream iterator
+istream limits
+istream locale
+istream memory
+istream mutex
+istream new
+istream optional
+istream ostream
+istream print
+istream queue
+istream ratio
+istream stack
+istream stdexcept
+istream streambuf
+istream string
+istream string_view
+istream system_error
+istream tuple
+istream type_traits
+istream typeinfo
+istream unordered_map
+istream utility
+istream variant
+istream vector
+istream version
+iterator cctype
+iterator cmath
+iterator compare
+iterator concepts
+iterator cstddef
+iterator cstdint
+iterator cstdio
+iterator cstdlib
+iterator cstring
+iterator cwchar
+iterator cwctype
+iterator exception
+iterator initializer_list
+iterator iosfwd
+iterator limits
+iterator new
+iterator tuple
+iterator type_traits
+iterator typeinfo
+iterator utility
+iterator variant
+iterator version
+latch atomic
+latch climits
+latch cmath
+latch compare
+latch cstddef
+latch cstdint
+latch cstdlib
+latch cstring
+latch ctime
+latch limits
+latch ratio
+latch type_traits
+latch version
+limits cstdint
+limits type_traits
+limits version
+list algorithm
+list array
+list atomic
+list bit
+list cctype
+list cerrno
+list climits
+list clocale
+list cmath
+list compare
+list concepts
+list cstdarg
+list cstddef
+list cstdint
+list cstdio
+list cstdlib
+list cstring
+list ctime
+list cwchar
+list cwctype
+list exception
+list functional
+list initializer_list
+list ios
+list iosfwd
+list iterator
+list limits
+list locale
+list memory
+list mutex
+list new
+list optional
+list ratio
+list stdexcept
+list streambuf
+list string
+list string_view
+list system_error
+list tuple
+list type_traits
+list typeinfo
+list unordered_map
+list utility
+list variant
+list vector
+list version
+locale algorithm
+locale atomic
+locale bit
+locale cctype
+locale cerrno
+locale climits
+locale clocale
+locale cmath
+locale compare
+locale concepts
+locale cstdarg
+locale cstddef
+locale cstdint
+locale cstdio
+locale cstdlib
+locale cstring
+locale ctime
+locale cwchar
+locale cwctype
+locale exception
+locale initializer_list
+locale ios
+locale iosfwd
+locale iterator
+locale limits
+locale memory
+locale mutex
+locale new
+locale optional
+locale ratio
+locale stdexcept
+locale streambuf
+locale string
+locale string_view
+locale system_error
+locale tuple
+locale type_traits
+locale typeinfo
+locale utility
+locale variant
+locale version
+map algorithm
+map array
+map atomic
+map bit
+map cctype
+map cerrno
+map climits
+map clocale
+map cmath
+map compare
+map concepts
+map cstdarg
+map cstddef
+map cstdint
+map cstdio
+map cstdlib
+map cstring
+map ctime
+map cwchar
+map cwctype
+map exception
+map functional
+map initializer_list
+map ios
+map iosfwd
+map iterator
+map limits
+map locale
+map memory
+map mutex
+map new
+map optional
+map ratio
+map stdexcept
+map streambuf
+map string
+map string_view
+map system_error
+map tuple
+map type_traits
+map typeinfo
+map unordered_map
+map utility
+map variant
+map vector
+map version
+mdspan version
+memory atomic
+memory cctype
+memory climits
+memory cmath
+memory compare
+memory concepts
+memory cstddef
+memory cstdint
+memory cstdio
+memory cstdlib
+memory cstring
+memory ctime
+memory cwchar
+memory cwctype
+memory exception
+memory initializer_list
+memory iosfwd
+memory iterator
+memory limits
+memory new
+memory ratio
+memory stdexcept
+memory tuple
+memory type_traits
+memory typeinfo
+memory utility
+memory variant
+memory version
+memory_resource algorithm
+memory_resource atomic
+memory_resource bit
+memory_resource cctype
+memory_resource cerrno
+memory_resource climits
+memory_resource cmath
+memory_resource compare
+memory_resource concepts
+memory_resource cstddef
+memory_resource cstdint
+memory_resource cstdio
+memory_resource cstdlib
+memory_resource cstring
+memory_resource ctime
+memory_resource cwchar
+memory_resource cwctype
+memory_resource exception
+memory_resource initializer_list
+memory_resource iosfwd
+memory_resource iterator
+memory_resource limits
+memory_resource memory
+memory_resource mutex
+memory_resource new
+memory_resource optional
+memory_resource ratio
+memory_resource stdexcept
+memory_resource string
+memory_resource string_view
+memory_resource system_error
+memory_resource tuple
+memory_resource type_traits
+memory_resource typeinfo
+memory_resource utility
+memory_resource variant
+memory_resource version
+mutex algorithm
+mutex atomic
+mutex bit
+mutex cctype
+mutex cerrno
+mutex climits
+mutex cmath
+mutex compare
+mutex concepts
+mutex cstddef
+mutex cstdint
+mutex cstdio
+mutex cstdlib
+mutex cstring
+mutex ctime
+mutex cwchar
+mutex cwctype
+mutex exception
+mutex initializer_list
+mutex iosfwd
+mutex iterator
+mutex limits
+mutex memory
+mutex new
+mutex optional
+mutex ratio
+mutex stdexcept
+mutex string
+mutex string_view
+mutex system_error
+mutex tuple
+mutex type_traits
+mutex typeinfo
+mutex utility
+mutex variant
+mutex version
+new cstddef
+new cstdint
+new cstdlib
+new type_traits
+new version
+numbers concepts
+numbers cstddef
+numbers cstdint
+numbers type_traits
+numbers version
+numeric algorithm
+numeric array
+numeric atomic
+numeric bit
+numeric cctype
+numeric cerrno
+numeric climits
+numeric clocale
+numeric cmath
+numeric compare
+numeric concepts
+numeric cstdarg
+numeric cstddef
+numeric cstdint
+numeric cstdio
+numeric cstdlib
+numeric cstring
+numeric ctime
+numeric cwchar
+numeric cwctype
+numeric exception
+numeric execution
+numeric functional
+numeric initializer_list
+numeric ios
+numeric iosfwd
+numeric iterator
+numeric limits
+numeric locale
+numeric memory
+numeric mutex
+numeric new
+numeric optional
+numeric ratio
+numeric stdexcept
+numeric streambuf
+numeric string
+numeric string_view
+numeric system_error
+numeric tuple
+numeric type_traits
+numeric typeinfo
+numeric unordered_map
+numeric utility
+numeric variant
+numeric vector
+numeric version
+optional atomic
+optional cctype
+optional climits
+optional cmath
+optional compare
+optional concepts
+optional cstddef
+optional cstdint
+optional cstdio
+optional cstdlib
+optional cstring
+optional ctime
+optional cwchar
+optional cwctype
+optional exception
+optional initializer_list
+optional iosfwd
+optional iterator
+optional limits
+optional memory
+optional new
+optional ratio
+optional stdexcept
+optional tuple
+optional type_traits
+optional typeinfo
+optional utility
+optional variant
+optional version
+ostream algorithm
+ostream array
+ostream atomic
+ostream bit
+ostream bitset
+ostream cctype
+ostream cerrno
+ostream climits
+ostream clocale
+ostream cmath
+ostream compare
+ostream concepts
+ostream cstdarg
+ostream cstddef
+ostream cstdint
+ostream cstdio
+ostream cstdlib
+ostream cstring
+ostream ctime
+ostream cwchar
+ostream cwctype
+ostream deque
+ostream exception
+ostream format
+ostream functional
+ostream initializer_list
+ostream ios
+ostream iosfwd
+ostream iterator
+ostream limits
+ostream locale
+ostream memory
+ostream mutex
+ostream new
+ostream optional
+ostream print
+ostream queue
+ostream ratio
+ostream stack
+ostream stdexcept
+ostream streambuf
+ostream string
+ostream string_view
+ostream system_error
+ostream tuple
+ostream type_traits
+ostream typeinfo
+ostream unordered_map
+ostream utility
+ostream variant
+ostream vector
+ostream version
+print algorithm
+print array
+print atomic
+print bit
+print cctype
+print cerrno
+print climits
+print clocale
+print cmath
+print compare
+print concepts
+print cstdarg
+print cstddef
+print cstdint
+print cstdio
+print cstdlib
+print cstring
+print ctime
+print cwchar
+print cwctype
+print deque
+print exception
+print format
+print functional
+print initializer_list
+print ios
+print iosfwd
+print iterator
+print limits
+print locale
+print memory
+print mutex
+print new
+print optional
+print queue
+print ratio
+print stack
+print stdexcept
+print streambuf
+print string
+print string_view
+print system_error
+print tuple
+print type_traits
+print typeinfo
+print unordered_map
+print utility
+print variant
+print vector
+print version
+queue algorithm
+queue array
+queue atomic
+queue bit
+queue cctype
+queue cerrno
+queue climits
+queue clocale
+queue cmath
+queue compare
+queue concepts
+queue cstdarg
+queue cstddef
+queue cstdint
+queue cstdio
+queue cstdlib
+queue cstring
+queue ctime
+queue cwchar
+queue cwctype
+queue deque
+queue exception
+queue functional
+queue initializer_list
+queue ios
+queue iosfwd
+queue iterator
+queue limits
+queue locale
+queue memory
+queue mutex
+queue new
+queue optional
+queue ratio
+queue stdexcept
+queue streambuf
+queue string
+queue string_view
+queue system_error
+queue tuple
+queue type_traits
+queue typeinfo
+queue unordered_map
+queue utility
+queue variant
+queue vector
+queue version
+random algorithm
+random array
+random atomic
+random bit
+random cctype
+random cerrno
+random climits
+random clocale
+random cmath
+random compare
+random concepts
+random cstdarg
+random cstddef
+random cstdint
+random cstdio
+random cstdlib
+random cstring
+random ctime
+random cwchar
+random cwctype
+random exception
+random execution
+random functional
+random initializer_list
+random ios
+random iosfwd
+random iterator
+random limits
+random locale
+random memory
+random mutex
+random new
+random numeric
+random optional
+random ratio
+random stdexcept
+random streambuf
+random string
+random string_view
+random system_error
+random tuple
+random type_traits
+random typeinfo
+random unordered_map
+random utility
+random variant
+random vector
+random version
+ranges algorithm
+ranges array
+ranges atomic
+ranges bit
+ranges cctype
+ranges cerrno
+ranges climits
+ranges clocale
+ranges cmath
+ranges compare
+ranges concepts
+ranges cstdarg
+ranges cstddef
+ranges cstdint
+ranges cstdio
+ranges cstdlib
+ranges cstring
+ranges ctime
+ranges cwchar
+ranges cwctype
+ranges exception
+ranges functional
+ranges initializer_list
+ranges ios
+ranges iosfwd
+ranges iterator
+ranges limits
+ranges locale
+ranges memory
+ranges mutex
+ranges new
+ranges optional
+ranges ratio
+ranges span
+ranges stdexcept
+ranges streambuf
+ranges string
+ranges string_view
+ranges system_error
+ranges tuple
+ranges type_traits
+ranges typeinfo
+ranges unordered_map
+ranges utility
+ranges variant
+ranges vector
+ranges version
+ratio climits
+ratio cstdint
+ratio type_traits
+ratio version
+regex algorithm
+regex array
+regex atomic
+regex bit
+regex cctype
+regex cerrno
+regex climits
+regex clocale
+regex cmath
+regex compare
+regex concepts
+regex cstdarg
+regex cstddef
+regex cstdint
+regex cstdio
+regex cstdlib
+regex cstring
+regex ctime
+regex cwchar
+regex cwctype
+regex deque
+regex exception
+regex functional
+regex initializer_list
+regex ios
+regex iosfwd
+regex iterator
+regex limits
+regex locale
+regex memory
+regex mutex
+regex new
+regex optional
+regex ratio
+regex stdexcept
+regex streambuf
+regex string
+regex string_view
+regex system_error
+regex tuple
+regex type_traits
+regex typeinfo
+regex unordered_map
+regex utility
+regex variant
+regex vector
+regex version
+scoped_allocator atomic
+scoped_allocator cctype
+scoped_allocator climits
+scoped_allocator cmath
+scoped_allocator compare
+scoped_allocator concepts
+scoped_allocator cstddef
+scoped_allocator cstdint
+scoped_allocator cstdio
+scoped_allocator cstdlib
+scoped_allocator cstring
+scoped_allocator ctime
+scoped_allocator cwchar
+scoped_allocator cwctype
+scoped_allocator exception
+scoped_allocator initializer_list
+scoped_allocator iosfwd
+scoped_allocator iterator
+scoped_allocator limits
+scoped_allocator memory
+scoped_allocator new
+scoped_allocator ratio
+scoped_allocator stdexcept
+scoped_allocator tuple
+scoped_allocator type_traits
+scoped_allocator typeinfo
+scoped_allocator utility
+scoped_allocator variant
+scoped_allocator version
+semaphore atomic
+semaphore climits
+semaphore cmath
+semaphore compare
+semaphore cstddef
+semaphore cstdint
+semaphore cstdlib
+semaphore cstring
+semaphore ctime
+semaphore limits
+semaphore ratio
+semaphore type_traits
+semaphore version
+set algorithm
+set array
+set atomic
+set bit
+set cctype
+set cerrno
+set climits
+set clocale
+set cmath
+set compare
+set concepts
+set cstdarg
+set cstddef
+set cstdint
+set cstdio
+set cstdlib
+set cstring
+set ctime
+set cwchar
+set cwctype
+set exception
+set functional
+set initializer_list
+set ios
+set iosfwd
+set iterator
+set limits
+set locale
+set memory
+set mutex
+set new
+set optional
+set ratio
+set stdexcept
+set streambuf
+set string
+set string_view
+set system_error
+set tuple
+set type_traits
+set typeinfo
+set unordered_map
+set utility
+set variant
+set vector
+set version
+shared_mutex algorithm
+shared_mutex atomic
+shared_mutex bit
+shared_mutex cctype
+shared_mutex cerrno
+shared_mutex climits
+shared_mutex cmath
+shared_mutex compare
+shared_mutex concepts
+shared_mutex cstddef
+shared_mutex cstdint
+shared_mutex cstdio
+shared_mutex cstdlib
+shared_mutex cstring
+shared_mutex ctime
+shared_mutex cwchar
+shared_mutex cwctype
+shared_mutex exception
+shared_mutex initializer_list
+shared_mutex iosfwd
+shared_mutex iterator
+shared_mutex limits
+shared_mutex memory
+shared_mutex new
+shared_mutex optional
+shared_mutex ratio
+shared_mutex stdexcept
+shared_mutex string
+shared_mutex string_view
+shared_mutex system_error
+shared_mutex tuple
+shared_mutex type_traits
+shared_mutex typeinfo
+shared_mutex utility
+shared_mutex variant
+shared_mutex version
+source_location cstdint
+source_location version
+span algorithm
+span array
+span atomic
+span bit
+span cctype
+span cerrno
+span climits
+span clocale
+span cmath
+span compare
+span concepts
+span cstdarg
+span cstddef
+span cstdint
+span cstdio
+span cstdlib
+span cstring
+span ctime
+span cwchar
+span cwctype
+span exception
+span functional
+span initializer_list
+span ios
+span iosfwd
+span iterator
+span limits
+span locale
+span memory
+span mutex
+span new
+span optional
+span ratio
+span stdexcept
+span streambuf
+span string
+span string_view
+span system_error
+span tuple
+span type_traits
+span typeinfo
+span unordered_map
+span utility
+span variant
+span vector
+span version
+sstream algorithm
+sstream array
+sstream atomic
+sstream bit
+sstream bitset
+sstream cctype
+sstream cerrno
+sstream climits
+sstream clocale
+sstream cmath
+sstream compare
+sstream concepts
+sstream cstdarg
+sstream cstddef
+sstream cstdint
+sstream cstdio
+sstream cstdlib
+sstream cstring
+sstream ctime
+sstream cwchar
+sstream cwctype
+sstream deque
+sstream exception
+sstream format
+sstream functional
+sstream initializer_list
+sstream ios
+sstream iosfwd
+sstream istream
+sstream iterator
+sstream limits
+sstream locale
+sstream memory
+sstream mutex
+sstream new
+sstream optional
+sstream ostream
+sstream print
+sstream queue
+sstream ratio
+sstream stack
+sstream stdexcept
+sstream streambuf
+sstream string
+sstream string_view
+sstream system_error
+sstream tuple
+sstream type_traits
+sstream typeinfo
+sstream unordered_map
+sstream utility
+sstream variant
+sstream vector
+sstream version
+stack algorithm
+stack array
+stack atomic
+stack bit
+stack cctype
+stack cerrno
+stack climits
+stack clocale
+stack cmath
+stack compare
+stack concepts
+stack cstdarg
+stack cstddef
+stack cstdint
+stack cstdio
+stack cstdlib
+stack cstring
+stack ctime
+stack cwchar
+stack cwctype
+stack deque
+stack exception
+stack functional
+stack initializer_list
+stack ios
+stack iosfwd
+stack iterator
+stack limits
+stack locale
+stack memory
+stack mutex
+stack new
+stack optional
+stack ratio
+stack stdexcept
+stack streambuf
+stack string
+stack string_view
+stack system_error
+stack tuple
+stack type_traits
+stack typeinfo
+stack unordered_map
+stack utility
+stack variant
+stack vector
+stack version
+stdexcept cstddef
+stdexcept cstdint
+stdexcept cstdlib
+stdexcept exception
+stdexcept iosfwd
+stdexcept new
+stdexcept type_traits
+stdexcept typeinfo
+stdexcept version
+stop_token atomic
+stop_token climits
+stop_token cmath
+stop_token compare
+stop_token cstddef
+stop_token cstdint
+stop_token cstdlib
+stop_token cstring
+stop_token ctime
+stop_token iosfwd
+stop_token limits
+stop_token ratio
+stop_token type_traits
+stop_token version
+streambuf algorithm
+streambuf atomic
+streambuf bit
+streambuf cctype
+streambuf cerrno
+streambuf climits
+streambuf clocale
+streambuf cmath
+streambuf compare
+streambuf concepts
+streambuf cstddef
+streambuf cstdint
+streambuf cstdio
+streambuf cstdlib
+streambuf cstring
+streambuf ctime
+streambuf cwchar
+streambuf cwctype
+streambuf exception
+streambuf initializer_list
+streambuf ios
+streambuf iosfwd
+streambuf iterator
+streambuf limits
+streambuf memory
+streambuf mutex
+streambuf new
+streambuf optional
+streambuf ratio
+streambuf stdexcept
+streambuf string
+streambuf string_view
+streambuf system_error
+streambuf tuple
+streambuf type_traits
+streambuf typeinfo
+streambuf utility
+streambuf variant
+streambuf version
+string algorithm
+string atomic
+string bit
+string cctype
+string climits
+string cmath
+string compare
+string concepts
+string cstddef
+string cstdint
+string cstdio
+string cstdlib
+string cstring
+string ctime
+string cwchar
+string cwctype
+string exception
+string initializer_list
+string iosfwd
+string iterator
+string limits
+string memory
+string new
+string optional
+string ratio
+string stdexcept
+string string_view
+string tuple
+string type_traits
+string typeinfo
+string utility
+string variant
+string version
+string_view algorithm
+string_view atomic
+string_view bit
+string_view cctype
+string_view climits
+string_view cmath
+string_view compare
+string_view concepts
+string_view cstddef
+string_view cstdint
+string_view cstdio
+string_view cstdlib
+string_view cstring
+string_view ctime
+string_view cwchar
+string_view cwctype
+string_view exception
+string_view initializer_list
+string_view iosfwd
+string_view iterator
+string_view limits
+string_view memory
+string_view new
+string_view optional
+string_view ratio
+string_view stdexcept
+string_view tuple
+string_view type_traits
+string_view typeinfo
+string_view utility
+string_view variant
+string_view version
+strstream algorithm
+strstream array
+strstream atomic
+strstream bit
+strstream bitset
+strstream cctype
+strstream cerrno
+strstream climits
+strstream clocale
+strstream cmath
+strstream compare
+strstream concepts
+strstream cstdarg
+strstream cstddef
+strstream cstdint
+strstream cstdio
+strstream cstdlib
+strstream cstring
+strstream ctime
+strstream cwchar
+strstream cwctype
+strstream deque
+strstream exception
+strstream format
+strstream functional
+strstream initializer_list
+strstream ios
+strstream iosfwd
+strstream istream
+strstream iterator
+strstream limits
+strstream locale
+strstream memory
+strstream mutex
+strstream new
+strstream optional
+strstream ostream
+strstream print
+strstream queue
+strstream ratio
+strstream stack
+strstream stdexcept
+strstream streambuf
+strstream string
+strstream string_view
+strstream system_error
+strstream tuple
+strstream type_traits
+strstream typeinfo
+strstream unordered_map
+strstream utility
+strstream variant
+strstream vector
+strstream version
+syncstream algorithm
+syncstream array
+syncstream atomic
+syncstream bit
+syncstream bitset
+syncstream cctype
+syncstream cerrno
+syncstream climits
+syncstream clocale
+syncstream cmath
+syncstream compare
+syncstream concepts
+syncstream cstdarg
+syncstream cstddef
+syncstream cstdint
+syncstream cstdio
+syncstream cstdlib
+syncstream cstring
+syncstream ctime
+syncstream cwchar
+syncstream cwctype
+syncstream deque
+syncstream exception
+syncstream format
+syncstream functional
+syncstream initializer_list
+syncstream ios
+syncstream iosfwd
+syncstream iterator
+syncstream limits
+syncstream locale
+syncstream map
+syncstream memory
+syncstream mutex
+syncstream new
+syncstream optional
+syncstream ostream
+syncstream print
+syncstream queue
+syncstream ratio
+syncstream shared_mutex
+syncstream stack
+syncstream stdexcept
+syncstream streambuf
+syncstream string
+syncstream string_view
+syncstream system_error
+syncstream tuple
+syncstream type_traits
+syncstream typeinfo
+syncstream unordered_map
+syncstream utility
+syncstream variant
+syncstream vector
+syncstream version
+system_error algorithm
+system_error atomic
+system_error bit
+system_error cctype
+system_error cerrno
+system_error climits
+system_error cmath
+system_error compare
+system_error concepts
+system_error cstddef
+system_error cstdint
+system_error cstdio
+system_error cstdlib
+system_error cstring
+system_error ctime
+system_error cwchar
+system_error cwctype
+system_error exception
+system_error initializer_list
+system_error iosfwd
+system_error iterator
+system_error limits
+system_error memory
+system_error new
+system_error optional
+system_error ratio
+system_error stdexcept
+system_error string
+system_error string_view
+system_error tuple
+system_error type_traits
+system_error typeinfo
+system_error utility
+system_error variant
+system_error version
+thread algorithm
+thread array
+thread atomic
+thread bit
+thread bitset
+thread cctype
+thread cerrno
+thread climits
+thread clocale
+thread cmath
+thread compare
+thread concepts
+thread cstdarg
+thread cstddef
+thread cstdint
+thread cstdio
+thread cstdlib
+thread cstring
+thread ctime
+thread cwchar
+thread cwctype
+thread deque
+thread exception
+thread format
+thread functional
+thread initializer_list
+thread ios
+thread iosfwd
+thread istream
+thread iterator
+thread limits
+thread locale
+thread memory
+thread mutex
+thread new
+thread optional
+thread ostream
+thread print
+thread queue
+thread ratio
+thread sstream
+thread stack
+thread stdexcept
+thread streambuf
+thread string
+thread string_view
+thread system_error
+thread tuple
+thread type_traits
+thread typeinfo
+thread unordered_map
+thread utility
+thread variant
+thread vector
+thread version
+tuple cmath
+tuple compare
+tuple cstddef
+tuple cstdint
+tuple cstdlib
+tuple exception
+tuple initializer_list
+tuple iosfwd
+tuple limits
+tuple new
+tuple type_traits
+tuple typeinfo
+tuple utility
+tuple version
+type_traits cstdint
+type_traits version
+typeindex cmath
+typeindex compare
+typeindex cstddef
+typeindex cstdint
+typeindex cstdlib
+typeindex initializer_list
+typeindex iosfwd
+typeindex limits
+typeindex new
+typeindex type_traits
+typeindex typeinfo
+typeindex utility
+typeindex version
+typeinfo cstddef
+typeinfo cstdint
+typeinfo cstdlib
+typeinfo type_traits
+typeinfo version
+unordered_map algorithm
+unordered_map atomic
+unordered_map bit
+unordered_map cctype
+unordered_map climits
+unordered_map cmath
+unordered_map compare
+unordered_map concepts
+unordered_map cstddef
+unordered_map cstdint
+unordered_map cstdio
+unordered_map cstdlib
+unordered_map cstring
+unordered_map ctime
+unordered_map cwchar
+unordered_map cwctype
+unordered_map exception
+unordered_map initializer_list
+unordered_map iosfwd
+unordered_map iterator
+unordered_map limits
+unordered_map memory
+unordered_map new
+unordered_map optional
+unordered_map ratio
+unordered_map stdexcept
+unordered_map tuple
+unordered_map type_traits
+unordered_map typeinfo
+unordered_map utility
+unordered_map variant
+unordered_map version
+unordered_set algorithm
+unordered_set array
+unordered_set atomic
+unordered_set bit
+unordered_set cctype
+unordered_set cerrno
+unordered_set climits
+unordered_set clocale
+unordered_set cmath
+unordered_set compare
+unordered_set concepts
+unordered_set cstdarg
+unordered_set cstddef
+unordered_set cstdint
+unordered_set cstdio
+unordered_set cstdlib
+unordered_set cstring
+unordered_set ctime
+unordered_set cwchar
+unordered_set cwctype
+unordered_set exception
+unordered_set functional
+unordered_set initializer_list
+unordered_set ios
+unordered_set iosfwd
+unordered_set iterator
+unordered_set limits
+unordered_set locale
+unordered_set memory
+unordered_set mutex
+unordered_set new
+unordered_set optional
+unordered_set ratio
+unordered_set stdexcept
+unordered_set streambuf
+unordered_set string
+unordered_set string_view
+unordered_set system_error
+unordered_set tuple
+unordered_set type_traits
+unordered_set typeinfo
+unordered_set unordered_map
+unordered_set utility
+unordered_set variant
+unordered_set vector
+unordered_set version
+utility cmath
+utility compare
+utility cstddef
+utility cstdint
+utility cstdlib
+utility initializer_list
+utility iosfwd
+utility limits
+utility type_traits
+utility version
+valarray algorithm
+valarray array
+valarray atomic
+valarray bit
+valarray cctype
+valarray cerrno
+valarray climits
+valarray clocale
+valarray cmath
+valarray compare
+valarray concepts
+valarray cstdarg
+valarray cstddef
+valarray cstdint
+valarray cstdio
+valarray cstdlib
+valarray cstring
+valarray ctime
+valarray cwchar
+valarray cwctype
+valarray exception
+valarray functional
+valarray initializer_list
+valarray ios
+valarray iosfwd
+valarray iterator
+valarray limits
+valarray locale
+valarray memory
+valarray mutex
+valarray new
+valarray optional
+valarray ratio
+valarray stdexcept
+valarray streambuf
+valarray string
+valarray string_view
+valarray system_error
+valarray tuple
+valarray type_traits
+valarray typeinfo
+valarray unordered_map
+valarray utility
+valarray variant
+valarray vector
+valarray version
+variant cmath
+variant compare
+variant cstddef
+variant cstdint
+variant cstdlib
+variant cstring
+variant exception
+variant initializer_list
+variant iosfwd
+variant limits
+variant new
+variant tuple
+variant type_traits
+variant typeinfo
+variant utility
+variant version
+vector algorithm
+vector array
+vector atomic
+vector bit
+vector cctype
+vector cerrno
+vector climits
+vector clocale
+vector cmath
+vector compare
+vector concepts
+vector cstdarg
+vector cstddef
+vector cstdint
+vector cstdio
+vector cstdlib
+vector cstring
+vector ctime
+vector cwchar
+vector cwctype
+vector exception
+vector initializer_list
+vector ios
+vector iosfwd
+vector iterator
+vector limits
+vector locale
+vector memory
+vector mutex
+vector new
+vector optional
+vector ratio
+vector stdexcept
+vector streambuf
+vector string
+vector string_view
+vector system_error
+vector tuple
+vector type_traits
+vector typeinfo
+vector utility
+vector variant
+vector version
diff --git a/libcxx/test/libcxx-03/transitive_includes/cxx23.csv b/libcxx/test/libcxx-03/transitive_includes/cxx23.csv
new file mode 100644
index 0000000000000..cb23c7a98de1b
--- /dev/null
+++ b/libcxx/test/libcxx-03/transitive_includes/cxx23.csv
@@ -0,0 +1,1166 @@
+algorithm cctype
+algorithm climits
+algorithm compare
+algorithm cstdint
+algorithm cstring
+algorithm ctime
+algorithm cwchar
+algorithm cwctype
+algorithm initializer_list
+algorithm iosfwd
+algorithm limits
+algorithm optional
+algorithm ratio
+algorithm tuple
+algorithm version
+any cstdint
+any cstring
+any initializer_list
+any limits
+any typeinfo
+any version
+array cctype
+array compare
+array cstdint
+array cwchar
+array cwctype
+array initializer_list
+array limits
+array stdexcept
+array version
+atomic climits
+atomic cstdint
+atomic cstring
+atomic ctime
+atomic limits
+atomic ratio
+atomic version
+barrier climits
+barrier cstdint
+barrier cstring
+barrier ctime
+barrier limits
+barrier ratio
+barrier version
+bit cstdint
+bit limits
+bit version
+bitset cctype
+bitset climits
+bitset compare
+bitset cstdint
+bitset cstdio
+bitset cstring
+bitset cwchar
+bitset cwctype
+bitset initializer_list
+bitset iosfwd
+bitset limits
+bitset stdexcept
+bitset string
+bitset string_view
+bitset tuple
+bitset version
+ccomplex bitset
+ccomplex cctype
+ccomplex cerrno
+ccomplex climits
+ccomplex clocale
+ccomplex cmath
+ccomplex compare
+ccomplex complex
+ccomplex cstddef
+ccomplex cstdint
+ccomplex cstdio
+ccomplex cstdlib
+ccomplex cstring
+ccomplex ctime
+ccomplex cwchar
+ccomplex cwctype
+ccomplex initializer_list
+ccomplex ios
+ccomplex iosfwd
+ccomplex istream
+ccomplex limits
+ccomplex locale
+ccomplex ratio
+ccomplex sstream
+ccomplex stdexcept
+ccomplex streambuf
+ccomplex string
+ccomplex string_view
+ccomplex tuple
+ccomplex typeinfo
+ccomplex version
+charconv cerrno
+charconv cstdint
+charconv initializer_list
+charconv limits
+charconv version
+chrono array
+chrono bitset
+chrono cctype
+chrono cerrno
+chrono climits
+chrono clocale
+chrono cmath
+chrono compare
+chrono cstddef
+chrono cstdint
+chrono cstdio
+chrono cstdlib
+chrono cstring
+chrono ctime
+chrono cwchar
+chrono cwctype
+chrono format
+chrono forward_list
+chrono initializer_list
+chrono ios
+chrono iosfwd
+chrono istream
+chrono limits
+chrono locale
+chrono optional
+chrono ratio
+chrono sstream
+chrono stdexcept
+chrono streambuf
+chrono string
+chrono string_view
+chrono tuple
+chrono typeinfo
+chrono version
+cinttypes cstdint
+cmath limits
+cmath version
+codecvt cctype
+codecvt climits
+codecvt clocale
+codecvt compare
+codecvt cstddef
+codecvt cstdint
+codecvt cstdio
+codecvt cstdlib
+codecvt cstring
+codecvt cwchar
+codecvt cwctype
+codecvt initializer_list
+codecvt iosfwd
+codecvt limits
+codecvt stdexcept
+codecvt string
+codecvt string_view
+codecvt tuple
+codecvt typeinfo
+codecvt version
+compare cstdint
+compare limits
+compare version
+complex bitset
+complex cctype
+complex cerrno
+complex climits
+complex clocale
+complex cmath
+complex compare
+complex cstddef
+complex cstdint
+complex cstdio
+complex cstdlib
+complex cstring
+complex ctime
+complex cwchar
+complex cwctype
+complex initializer_list
+complex ios
+complex iosfwd
+complex istream
+complex limits
+complex locale
+complex ratio
+complex sstream
+complex stdexcept
+complex streambuf
+complex string
+complex string_view
+complex tuple
+complex typeinfo
+complex version
+concepts version
+condition_variable atomic
+condition_variable cerrno
+condition_variable climits
+condition_variable cstdint
+condition_variable cstring
+condition_variable ctime
+condition_variable initializer_list
+condition_variable limits
+condition_variable ratio
+condition_variable typeinfo
+condition_variable version
+coroutine compare
+coroutine cstdint
+coroutine cstring
+coroutine limits
+coroutine version
+cstddef version
+ctgmath bitset
+ctgmath cctype
+ctgmath cerrno
+ctgmath climits
+ctgmath clocale
+ctgmath cmath
+ctgmath compare
+ctgmath complex
+ctgmath cstddef
+ctgmath cstdint
+ctgmath cstdio
+ctgmath cstdlib
+ctgmath cstring
+ctgmath ctime
+ctgmath cwchar
+ctgmath cwctype
+ctgmath initializer_list
+ctgmath ios
+ctgmath iosfwd
+ctgmath istream
+ctgmath limits
+ctgmath locale
+ctgmath ratio
+ctgmath sstream
+ctgmath stdexcept
+ctgmath streambuf
+ctgmath string
+ctgmath string_view
+ctgmath tuple
+ctgmath typeinfo
+ctgmath version
+cwchar cctype
+cwchar cwctype
+cwctype cctype
+deque cctype
+deque compare
+deque cstdint
+deque cstring
+deque cwchar
+deque cwctype
+deque initializer_list
+deque limits
+deque stdexcept
+deque tuple
+deque version
+exception cstdint
+exception cstdlib
+exception typeinfo
+exception version
+execution version
+expected cstdint
+expected initializer_list
+expected version
+experimental/iterator bitset
+experimental/iterator cctype
+experimental/iterator cerrno
+experimental/iterator climits
+experimental/iterator clocale
+experimental/iterator compare
+experimental/iterator concepts
+experimental/iterator cstddef
+experimental/iterator cstdint
+experimental/iterator cstdio
+experimental/iterator cstdlib
+experimental/iterator cstring
+experimental/iterator ctime
+experimental/iterator cwchar
+experimental/iterator cwctype
+experimental/iterator initializer_list
+experimental/iterator ios
+experimental/iterator iosfwd
+experimental/iterator iterator
+experimental/iterator limits
+experimental/iterator locale
+experimental/iterator ratio
+experimental/iterator stdexcept
+experimental/iterator streambuf
+experimental/iterator string
+experimental/iterator string_view
+experimental/iterator tuple
+experimental/iterator typeinfo
+experimental/iterator variant
+experimental/iterator version
+experimental/memory cstdint
+experimental/memory cstring
+experimental/memory version
+experimental/propagate_const version
+experimental/simd cstdint
+experimental/simd limits
+experimental/simd version
+experimental/type_traits cstdint
+experimental/type_traits initializer_list
+experimental/type_traits type_traits
+experimental/type_traits version
+experimental/utility compare
+experimental/utility cstdint
+experimental/utility initializer_list
+experimental/utility limits
+experimental/utility utility
+experimental/utility version
+filesystem cctype
+filesystem cerrno
+filesystem climits
+filesystem clocale
+filesystem compare
+filesystem cstddef
+filesystem cstdint
+filesystem cstdio
+filesystem cstdlib
+filesystem cstring
+filesystem ctime
+filesystem cwchar
+filesystem cwctype
+filesystem initializer_list
+filesystem iomanip
+filesystem ios
+filesystem iosfwd
+filesystem limits
+filesystem locale
+filesystem ratio
+filesystem stdexcept
+filesystem streambuf
+filesystem string
+filesystem string_view
+filesystem tuple
+filesystem typeinfo
+filesystem version
+flat_map cctype
+flat_map climits
+flat_map compare
+flat_map cstdint
+flat_map cstring
+flat_map cwchar
+flat_map cwctype
+flat_map initializer_list
+flat_map limits
+flat_map optional
+flat_map stdexcept
+flat_map tuple
+flat_map version
+flat_set cctype
+flat_set climits
+flat_set compare
+flat_set cstdint
+flat_set cstring
+flat_set cwchar
+flat_set cwctype
+flat_set initializer_list
+flat_set limits
+flat_set optional
+flat_set stdexcept
+flat_set tuple
+flat_set version
+format array
+format cctype
+format cerrno
+format climits
+format clocale
+format cmath
+format compare
+format cstddef
+format cstdint
+format cstdio
+format cstdlib
+format cstring
+format cwchar
+format cwctype
+format initializer_list
+format iosfwd
+format limits
+format optional
+format stdexcept
+format string
+format string_view
+format tuple
+format typeinfo
+format version
+forward_list cctype
+forward_list compare
+forward_list cstdint
+forward_list cwchar
+forward_list cwctype
+forward_list initializer_list
+forward_list limits
+forward_list tuple
+forward_list version
+fstream bitset
+fstream cctype
+fstream cerrno
+fstream climits
+fstream clocale
+fstream compare
+fstream cstddef
+fstream cstdint
+fstream cstdio
+fstream cstdlib
+fstream cstring
+fstream ctime
+fstream cwchar
+fstream cwctype
+fstream filesystem
+fstream initializer_list
+fstream iomanip
+fstream ios
+fstream iosfwd
+fstream istream
+fstream limits
+fstream locale
+fstream ratio
+fstream stdexcept
+fstream streambuf
+fstream string
+fstream string_view
+fstream tuple
+fstream typeinfo
+fstream version
+functional array
+functional cctype
+functional compare
+functional cstdint
+functional cstring
+functional cwchar
+functional cwctype
+functional initializer_list
+functional limits
+functional optional
+functional stdexcept
+functional tuple
+functional typeinfo
+functional unordered_map
+functional version
+future bitset
+future cctype
+future cerrno
+future climits
+future clocale
+future compare
+future cstddef
+future cstdint
+future cstdio
+future cstdlib
+future cstring
+future ctime
+future cwchar
+future cwctype
+future initializer_list
+future ios
+future iosfwd
+future istream
+future limits
+future locale
+future ratio
+future sstream
+future stdexcept
+future streambuf
+future string
+future string_view
+future tuple
+future typeinfo
+future version
+initializer_list version
+iomanip cctype
+iomanip cerrno
+iomanip climits
+iomanip clocale
+iomanip compare
+iomanip cstddef
+iomanip cstdint
+iomanip cstdio
+iomanip cstdlib
+iomanip cstring
+iomanip ctime
+iomanip cwchar
+iomanip cwctype
+iomanip initializer_list
+iomanip ios
+iomanip iosfwd
+iomanip limits
+iomanip locale
+iomanip ratio
+iomanip stdexcept
+iomanip streambuf
+iomanip string
+iomanip string_view
+iomanip tuple
+iomanip typeinfo
+iomanip version
+ios cctype
+ios cerrno
+ios climits
+ios clocale
+ios compare
+ios cstddef
+ios cstdint
+ios cstdio
+ios cstdlib
+ios cstring
+ios ctime
+ios cwchar
+ios cwctype
+ios initializer_list
+ios iosfwd
+ios limits
+ios ratio
+ios stdexcept
+ios string
+ios string_view
+ios tuple
+ios typeinfo
+ios version
+iosfwd version
+iostream array
+iostream bitset
+iostream cctype
+iostream cerrno
+iostream climits
+iostream clocale
+iostream cmath
+iostream compare
+iostream cstddef
+iostream cstdint
+iostream cstdio
+iostream cstdlib
+iostream cstring
+iostream ctime
+iostream cwchar
+iostream cwctype
+iostream format
+iostream initializer_list
+iostream ios
+iostream iosfwd
+iostream istream
+iostream limits
+iostream locale
+iostream optional
+iostream ostream
+iostream print
+iostream ratio
+iostream stdexcept
+iostream streambuf
+iostream string
+iostream string_view
+iostream tuple
+iostream typeinfo
+iostream version
+istream bitset
+istream cctype
+istream cerrno
+istream climits
+istream clocale
+istream compare
+istream cstddef
+istream cstdint
+istream cstdio
+istream cstdlib
+istream cstring
+istream ctime
+istream cwchar
+istream cwctype
+istream initializer_list
+istream ios
+istream iosfwd
+istream limits
+istream locale
+istream ratio
+istream stdexcept
+istream streambuf
+istream string
+istream string_view
+istream tuple
+istream typeinfo
+istream version
+iterator cctype
+iterator compare
+iterator concepts
+iterator cstdint
+iterator cstdio
+iterator cstring
+iterator cwchar
+iterator cwctype
+iterator initializer_list
+iterator iosfwd
+iterator limits
+iterator variant
+iterator version
+latch climits
+latch cstdint
+latch cstring
+latch ctime
+latch limits
+latch ratio
+latch version
+limits version
+list cctype
+list compare
+list cstdint
+list cstring
+list cwchar
+list cwctype
+list initializer_list
+list limits
+list tuple
+list version
+locale cctype
+locale cerrno
+locale climits
+locale clocale
+locale compare
+locale cstddef
+locale cstdint
+locale cstdio
+locale cstdlib
+locale cstring
+locale ctime
+locale cwchar
+locale cwctype
+locale initializer_list
+locale ios
+locale iosfwd
+locale limits
+locale ratio
+locale stdexcept
+locale streambuf
+locale string
+locale string_view
+locale tuple
+locale typeinfo
+locale version
+map cctype
+map compare
+map cstdint
+map cstring
+map cwchar
+map cwctype
+map initializer_list
+map limits
+map optional
+map stdexcept
+map tuple
+map version
+mdspan array
+mdspan cctype
+mdspan compare
+mdspan concepts
+mdspan cstdint
+mdspan cwchar
+mdspan cwctype
+mdspan initializer_list
+mdspan limits
+mdspan span
+mdspan stdexcept
+mdspan version
+memory compare
+memory cstdint
+memory cstring
+memory initializer_list
+memory limits
+memory tuple
+memory typeinfo
+memory version
+memory_resource cerrno
+memory_resource climits
+memory_resource compare
+memory_resource cstdint
+memory_resource ctime
+memory_resource limits
+memory_resource ratio
+memory_resource tuple
+memory_resource version
+mutex cerrno
+mutex climits
+mutex compare
+mutex cstdint
+mutex ctime
+mutex limits
+mutex ratio
+mutex tuple
+mutex typeinfo
+mutex version
+new version
+numbers version
+numeric climits
+numeric compare
+numeric cstdint
+numeric cstring
+numeric ctime
+numeric initializer_list
+numeric limits
+numeric optional
+numeric ratio
+numeric tuple
+numeric version
+optional compare
+optional cstdint
+optional cstring
+optional initializer_list
+optional limits
+optional version
+ostream array
+ostream bitset
+ostream cctype
+ostream cerrno
+ostream climits
+ostream clocale
+ostream cmath
+ostream compare
+ostream cstddef
+ostream cstdint
+ostream cstdio
+ostream cstdlib
+ostream cstring
+ostream ctime
+ostream cwchar
+ostream cwctype
+ostream format
+ostream initializer_list
+ostream ios
+ostream iosfwd
+ostream limits
+ostream locale
+ostream optional
+ostream print
+ostream ratio
+ostream stdexcept
+ostream streambuf
+ostream string
+ostream string_view
+ostream tuple
+ostream typeinfo
+ostream version
+print array
+print cctype
+print cerrno
+print climits
+print clocale
+print cmath
+print compare
+print cstddef
+print cstdint
+print cstdio
+print cstdlib
+print cstring
+print cwchar
+print cwctype
+print format
+print initializer_list
+print iosfwd
+print limits
+print optional
+print stdexcept
+print string
+print string_view
+print tuple
+print typeinfo
+print version
+queue array
+queue cctype
+queue cerrno
+queue climits
+queue clocale
+queue compare
+queue cstddef
+queue cstdint
+queue cstdio
+queue cstdlib
+queue cstring
+queue cwchar
+queue cwctype
+queue deque
+queue initializer_list
+queue iosfwd
+queue limits
+queue stdexcept
+queue string
+queue string_view
+queue tuple
+queue typeinfo
+queue vector
+queue version
+random cctype
+random climits
+random cmath
+random compare
+random cstdint
+random cstdio
+random cstring
+random ctime
+random cwchar
+random cwctype
+random initializer_list
+random iosfwd
+random limits
+random numeric
+random optional
+random ratio
+random stdexcept
+random string
+random string_view
+random tuple
+random version
+ranges cctype
+ranges compare
+ranges concepts
+ranges cstdint
+ranges cstdio
+ranges cstring
+ranges cwchar
+ranges cwctype
+ranges initializer_list
+ranges iosfwd
+ranges iterator
+ranges limits
+ranges optional
+ranges span
+ranges stdexcept
+ranges tuple
+ranges variant
+ranges version
+ratio climits
+ratio cstdint
+ratio version
+regex array
+regex cctype
+regex cerrno
+regex climits
+regex clocale
+regex compare
+regex cstddef
+regex cstdint
+regex cstdio
+regex cstdlib
+regex cstring
+regex cwchar
+regex cwctype
+regex deque
+regex initializer_list
+regex iosfwd
+regex limits
+regex stdexcept
+regex string
+regex string_view
+regex tuple
+regex typeinfo
+regex vector
+regex version
+scoped_allocator compare
+scoped_allocator cstdint
+scoped_allocator limits
+scoped_allocator tuple
+scoped_allocator version
+semaphore climits
+semaphore cstdint
+semaphore cstring
+semaphore ctime
+semaphore limits
+semaphore ratio
+semaphore version
+set cctype
+set compare
+set cstdint
+set cstring
+set cwchar
+set cwctype
+set initializer_list
+set limits
+set optional
+set tuple
+set version
+shared_mutex cerrno
+shared_mutex climits
+shared_mutex cstdint
+shared_mutex ctime
+shared_mutex limits
+shared_mutex ratio
+shared_mutex version
+source_location cstdint
+source_location version
+span initializer_list
+span limits
+span stdexcept
+span version
+sstream bitset
+sstream cctype
+sstream cerrno
+sstream climits
+sstream clocale
+sstream compare
+sstream cstddef
+sstream cstdint
+sstream cstdio
+sstream cstdlib
+sstream cstring
+sstream ctime
+sstream cwchar
+sstream cwctype
+sstream initializer_list
+sstream ios
+sstream iosfwd
+sstream istream
+sstream limits
+sstream locale
+sstream ratio
+sstream stdexcept
+sstream streambuf
+sstream string
+sstream string_view
+sstream tuple
+sstream typeinfo
+sstream version
+stack cctype
+stack compare
+stack cstdint
+stack cstring
+stack cwchar
+stack cwctype
+stack deque
+stack initializer_list
+stack limits
+stack stdexcept
+stack tuple
+stack version
+stop_token atomic
+stop_token climits
+stop_token cstdint
+stop_token cstring
+stop_token ctime
+stop_token limits
+stop_token ratio
+stop_token version
+streambuf cctype
+streambuf cerrno
+streambuf climits
+streambuf clocale
+streambuf compare
+streambuf cstddef
+streambuf cstdint
+streambuf cstdio
+streambuf cstdlib
+streambuf cstring
+streambuf ctime
+streambuf cwchar
+streambuf cwctype
+streambuf initializer_list
+streambuf ios
+streambuf iosfwd
+streambuf limits
+streambuf ratio
+streambuf stdexcept
+streambuf string
+streambuf string_view
+streambuf tuple
+streambuf typeinfo
+streambuf version
+string cctype
+string climits
+string compare
+string cstdint
+string cstdio
+string cstring
+string cwchar
+string cwctype
+string initializer_list
+string iosfwd
+string limits
+string stdexcept
+string string_view
+string tuple
+string version
+string_view cctype
+string_view compare
+string_view cstdint
+string_view cstdio
+string_view cstring
+string_view cwchar
+string_view cwctype
+string_view initializer_list
+string_view iosfwd
+string_view limits
+string_view stdexcept
+string_view version
+strstream bitset
+strstream cctype
+strstream cerrno
+strstream climits
+strstream clocale
+strstream compare
+strstream cstddef
+strstream cstdint
+strstream cstdio
+strstream cstdlib
+strstream cstring
+strstream ctime
+strstream cwchar
+strstream cwctype
+strstream initializer_list
+strstream ios
+strstream iosfwd
+strstream istream
+strstream limits
+strstream locale
+strstream ratio
+strstream stdexcept
+strstream streambuf
+strstream string
+strstream string_view
+strstream tuple
+strstream typeinfo
+strstream version
+syncstream array
+syncstream bitset
+syncstream cctype
+syncstream cerrno
+syncstream climits
+syncstream clocale
+syncstream cmath
+syncstream compare
+syncstream cstddef
+syncstream cstdint
+syncstream cstdio
+syncstream cstdlib
+syncstream cstring
+syncstream ctime
+syncstream cwchar
+syncstream cwctype
+syncstream format
+syncstream initializer_list
+syncstream ios
+syncstream iosfwd
+syncstream limits
+syncstream locale
+syncstream map
+syncstream optional
+syncstream ostream
+syncstream print
+syncstream ratio
+syncstream shared_mutex
+syncstream stdexcept
+syncstream streambuf
+syncstream string
+syncstream string_view
+syncstream tuple
+syncstream typeinfo
+syncstream version
+system_error cctype
+system_error cerrno
+system_error climits
+system_error compare
+system_error cstdint
+system_error cstdio
+system_error cstring
+system_error cwchar
+system_error cwctype
+system_error initializer_list
+system_error iosfwd
+system_error limits
+system_error stdexcept
+system_error string
+system_error string_view
+system_error tuple
+system_error version
+thread array
+thread atomic
+thread bitset
+thread cctype
+thread cerrno
+thread climits
+thread clocale
+thread compare
+thread cstddef
+thread cstdint
+thread cstdio
+thread cstdlib
+thread cstring
+thread ctime
+thread cwchar
+thread cwctype
+thread initializer_list
+thread ios
+thread iosfwd
+thread istream
+thread limits
+thread locale
+thread ratio
+thread sstream
+thread stdexcept
+thread streambuf
+thread string
+thread string_view
+thread tuple
+thread typeinfo
+thread version
+tuple compare
+tuple cstdint
+tuple limits
+tuple version
+type_traits cstdint
+type_traits version
+typeindex compare
+typeindex cstdint
+typeindex limits
+typeindex typeinfo
+typeindex version
+typeinfo cstdint
+typeinfo version
+unordered_map compare
+unordered_map cstdint
+unordered_map cstring
+unordered_map initializer_list
+unordered_map limits
+unordered_map optional
+unordered_map stdexcept
+unordered_map tuple
+unordered_map version
+unordered_set compare
+unordered_set cstdint
+unordered_set cstring
+unordered_set initializer_list
+unordered_set limits
+unordered_set optional
+unordered_set tuple
+unordered_set version
+utility compare
+utility cstdint
+utility initializer_list
+utility limits
+utility version
+valarray cmath
+valarray cstdint
+valarray initializer_list
+valarray limits
+valarray version
+variant compare
+variant cstdint
+variant cstring
+variant initializer_list
+variant limits
+variant version
+vector array
+vector cctype
+vector cerrno
+vector climits
+vector clocale
+vector compare
+vector cstddef
+vector cstdint
+vector cstdio
+vector cstdlib
+vector cstring
+vector cwchar
+vector cwctype
+vector initializer_list
+vector iosfwd
+vector limits
+vector stdexcept
+vector string
+vector string_view
+vector tuple
+vector typeinfo
+vector version
diff --git a/libcxx/test/libcxx-03/transitive_includes/cxx26.csv b/libcxx/test/libcxx-03/transitive_includes/cxx26.csv
new file mode 100644
index 0000000000000..ce8f0261f2b27
--- /dev/null
+++ b/libcxx/test/libcxx-03/transitive_includes/cxx26.csv
@@ -0,0 +1,1167 @@
+algorithm cctype
+algorithm climits
+algorithm compare
+algorithm cstdint
+algorithm cstring
+algorithm ctime
+algorithm cwchar
+algorithm cwctype
+algorithm initializer_list
+algorithm iosfwd
+algorithm limits
+algorithm optional
+algorithm ratio
+algorithm tuple
+algorithm version
+any cstdint
+any cstring
+any initializer_list
+any limits
+any typeinfo
+any version
+array cctype
+array compare
+array cstdint
+array cwchar
+array cwctype
+array initializer_list
+array limits
+array stdexcept
+array version
+atomic climits
+atomic cstdint
+atomic cstring
+atomic ctime
+atomic limits
+atomic ratio
+atomic version
+barrier climits
+barrier cstdint
+barrier cstring
+barrier ctime
+barrier limits
+barrier ratio
+barrier version
+bit cstdint
+bit limits
+bit version
+bitset cctype
+bitset climits
+bitset compare
+bitset cstdint
+bitset cstdio
+bitset cstring
+bitset cwchar
+bitset cwctype
+bitset initializer_list
+bitset iosfwd
+bitset limits
+bitset stdexcept
+bitset string
+bitset string_view
+bitset tuple
+bitset version
+ccomplex bitset
+ccomplex cctype
+ccomplex cerrno
+ccomplex climits
+ccomplex clocale
+ccomplex cmath
+ccomplex compare
+ccomplex complex
+ccomplex cstddef
+ccomplex cstdint
+ccomplex cstdio
+ccomplex cstdlib
+ccomplex cstring
+ccomplex ctime
+ccomplex cwchar
+ccomplex cwctype
+ccomplex initializer_list
+ccomplex ios
+ccomplex iosfwd
+ccomplex istream
+ccomplex limits
+ccomplex locale
+ccomplex ratio
+ccomplex sstream
+ccomplex stdexcept
+ccomplex streambuf
+ccomplex string
+ccomplex string_view
+ccomplex tuple
+ccomplex typeinfo
+ccomplex version
+charconv cerrno
+charconv cstdint
+charconv initializer_list
+charconv limits
+charconv version
+chrono array
+chrono bitset
+chrono cctype
+chrono cerrno
+chrono climits
+chrono clocale
+chrono cmath
+chrono compare
+chrono cstddef
+chrono cstdint
+chrono cstdio
+chrono cstdlib
+chrono cstring
+chrono ctime
+chrono cwchar
+chrono cwctype
+chrono format
+chrono forward_list
+chrono initializer_list
+chrono ios
+chrono iosfwd
+chrono istream
+chrono limits
+chrono locale
+chrono optional
+chrono ratio
+chrono sstream
+chrono stdexcept
+chrono streambuf
+chrono string
+chrono string_view
+chrono tuple
+chrono typeinfo
+chrono version
+cinttypes cstdint
+cmath limits
+cmath version
+codecvt cctype
+codecvt climits
+codecvt clocale
+codecvt compare
+codecvt cstddef
+codecvt cstdint
+codecvt cstdio
+codecvt cstdlib
+codecvt cstring
+codecvt cwchar
+codecvt cwctype
+codecvt initializer_list
+codecvt iosfwd
+codecvt limits
+codecvt stdexcept
+codecvt string
+codecvt string_view
+codecvt tuple
+codecvt typeinfo
+codecvt version
+compare cstdint
+compare limits
+compare version
+complex bitset
+complex cctype
+complex cerrno
+complex climits
+complex clocale
+complex cmath
+complex compare
+complex cstddef
+complex cstdint
+complex cstdio
+complex cstdlib
+complex cstring
+complex ctime
+complex cwchar
+complex cwctype
+complex initializer_list
+complex ios
+complex iosfwd
+complex istream
+complex limits
+complex locale
+complex ratio
+complex sstream
+complex stdexcept
+complex streambuf
+complex string
+complex string_view
+complex tuple
+complex typeinfo
+complex version
+concepts version
+condition_variable atomic
+condition_variable cerrno
+condition_variable climits
+condition_variable cstdint
+condition_variable cstring
+condition_variable ctime
+condition_variable initializer_list
+condition_variable limits
+condition_variable ratio
+condition_variable typeinfo
+condition_variable version
+coroutine compare
+coroutine cstdint
+coroutine cstring
+coroutine limits
+coroutine version
+cstddef version
+ctgmath bitset
+ctgmath cctype
+ctgmath cerrno
+ctgmath climits
+ctgmath clocale
+ctgmath cmath
+ctgmath compare
+ctgmath complex
+ctgmath cstddef
+ctgmath cstdint
+ctgmath cstdio
+ctgmath cstdlib
+ctgmath cstring
+ctgmath ctime
+ctgmath cwchar
+ctgmath cwctype
+ctgmath initializer_list
+ctgmath ios
+ctgmath iosfwd
+ctgmath istream
+ctgmath limits
+ctgmath locale
+ctgmath ratio
+ctgmath sstream
+ctgmath stdexcept
+ctgmath streambuf
+ctgmath string
+ctgmath string_view
+ctgmath tuple
+ctgmath typeinfo
+ctgmath version
+cwchar cctype
+cwchar cwctype
+cwctype cctype
+deque cctype
+deque compare
+deque cstdint
+deque cstring
+deque cwchar
+deque cwctype
+deque initializer_list
+deque limits
+deque stdexcept
+deque tuple
+deque version
+exception cstdint
+exception cstdlib
+exception typeinfo
+exception version
+execution version
+expected cstdint
+expected initializer_list
+expected version
+experimental/iterator bitset
+experimental/iterator cctype
+experimental/iterator cerrno
+experimental/iterator climits
+experimental/iterator clocale
+experimental/iterator compare
+experimental/iterator concepts
+experimental/iterator cstddef
+experimental/iterator cstdint
+experimental/iterator cstdio
+experimental/iterator cstdlib
+experimental/iterator cstring
+experimental/iterator ctime
+experimental/iterator cwchar
+experimental/iterator cwctype
+experimental/iterator initializer_list
+experimental/iterator ios
+experimental/iterator iosfwd
+experimental/iterator iterator
+experimental/iterator limits
+experimental/iterator locale
+experimental/iterator ratio
+experimental/iterator stdexcept
+experimental/iterator streambuf
+experimental/iterator string
+experimental/iterator string_view
+experimental/iterator tuple
+experimental/iterator typeinfo
+experimental/iterator variant
+experimental/iterator version
+experimental/memory cstdint
+experimental/memory cstring
+experimental/memory version
+experimental/propagate_const version
+experimental/simd cstdint
+experimental/simd limits
+experimental/simd version
+experimental/type_traits cstdint
+experimental/type_traits initializer_list
+experimental/type_traits type_traits
+experimental/type_traits version
+experimental/utility compare
+experimental/utility cstdint
+experimental/utility cstring
+experimental/utility initializer_list
+experimental/utility limits
+experimental/utility utility
+experimental/utility version
+filesystem cctype
+filesystem cerrno
+filesystem climits
+filesystem clocale
+filesystem compare
+filesystem cstddef
+filesystem cstdint
+filesystem cstdio
+filesystem cstdlib
+filesystem cstring
+filesystem ctime
+filesystem cwchar
+filesystem cwctype
+filesystem initializer_list
+filesystem iomanip
+filesystem ios
+filesystem iosfwd
+filesystem limits
+filesystem locale
+filesystem ratio
+filesystem stdexcept
+filesystem streambuf
+filesystem string
+filesystem string_view
+filesystem tuple
+filesystem typeinfo
+filesystem version
+flat_map cctype
+flat_map climits
+flat_map compare
+flat_map cstdint
+flat_map cstring
+flat_map cwchar
+flat_map cwctype
+flat_map initializer_list
+flat_map limits
+flat_map optional
+flat_map stdexcept
+flat_map tuple
+flat_map version
+flat_set cctype
+flat_set climits
+flat_set compare
+flat_set cstdint
+flat_set cstring
+flat_set cwchar
+flat_set cwctype
+flat_set initializer_list
+flat_set limits
+flat_set optional
+flat_set stdexcept
+flat_set tuple
+flat_set version
+format array
+format cctype
+format cerrno
+format climits
+format clocale
+format cmath
+format compare
+format cstddef
+format cstdint
+format cstdio
+format cstdlib
+format cstring
+format cwchar
+format cwctype
+format initializer_list
+format iosfwd
+format limits
+format optional
+format stdexcept
+format string
+format string_view
+format tuple
+format typeinfo
+format version
+forward_list cctype
+forward_list compare
+forward_list cstdint
+forward_list cwchar
+forward_list cwctype
+forward_list initializer_list
+forward_list limits
+forward_list tuple
+forward_list version
+fstream bitset
+fstream cctype
+fstream cerrno
+fstream climits
+fstream clocale
+fstream compare
+fstream cstddef
+fstream cstdint
+fstream cstdio
+fstream cstdlib
+fstream cstring
+fstream ctime
+fstream cwchar
+fstream cwctype
+fstream initializer_list
+fstream iomanip
+fstream ios
+fstream iosfwd
+fstream istream
+fstream limits
+fstream locale
+fstream ratio
+fstream stdexcept
+fstream streambuf
+fstream string
+fstream string_view
+fstream tuple
+fstream typeinfo
+fstream version
+functional array
+functional cctype
+functional compare
+functional cstdint
+functional cstring
+functional cwchar
+functional cwctype
+functional initializer_list
+functional limits
+functional optional
+functional stdexcept
+functional tuple
+functional typeinfo
+functional unordered_map
+functional version
+future bitset
+future cctype
+future cerrno
+future climits
+future clocale
+future compare
+future cstddef
+future cstdint
+future cstdio
+future cstdlib
+future cstring
+future ctime
+future cwchar
+future cwctype
+future initializer_list
+future ios
+future iosfwd
+future istream
+future limits
+future locale
+future ratio
+future sstream
+future stdexcept
+future streambuf
+future string
+future string_view
+future tuple
+future typeinfo
+future version
+initializer_list version
+iomanip cctype
+iomanip cerrno
+iomanip climits
+iomanip clocale
+iomanip compare
+iomanip cstddef
+iomanip cstdint
+iomanip cstdio
+iomanip cstdlib
+iomanip cstring
+iomanip ctime
+iomanip cwchar
+iomanip cwctype
+iomanip initializer_list
+iomanip ios
+iomanip iosfwd
+iomanip limits
+iomanip locale
+iomanip ratio
+iomanip stdexcept
+iomanip streambuf
+iomanip string
+iomanip string_view
+iomanip tuple
+iomanip typeinfo
+iomanip version
+ios cctype
+ios cerrno
+ios climits
+ios clocale
+ios compare
+ios cstddef
+ios cstdint
+ios cstdio
+ios cstdlib
+ios cstring
+ios ctime
+ios cwchar
+ios cwctype
+ios initializer_list
+ios iosfwd
+ios limits
+ios ratio
+ios stdexcept
+ios string
+ios string_view
+ios tuple
+ios typeinfo
+ios version
+iosfwd version
+iostream array
+iostream bitset
+iostream cctype
+iostream cerrno
+iostream climits
+iostream clocale
+iostream cmath
+iostream compare
+iostream cstddef
+iostream cstdint
+iostream cstdio
+iostream cstdlib
+iostream cstring
+iostream ctime
+iostream cwchar
+iostream cwctype
+iostream format
+iostream initializer_list
+iostream ios
+iostream iosfwd
+iostream istream
+iostream limits
+iostream locale
+iostream optional
+iostream ostream
+iostream print
+iostream ratio
+iostream stdexcept
+iostream streambuf
+iostream string
+iostream string_view
+iostream tuple
+iostream typeinfo
+iostream version
+istream bitset
+istream cctype
+istream cerrno
+istream climits
+istream clocale
+istream compare
+istream cstddef
+istream cstdint
+istream cstdio
+istream cstdlib
+istream cstring
+istream ctime
+istream cwchar
+istream cwctype
+istream initializer_list
+istream ios
+istream iosfwd
+istream limits
+istream locale
+istream ratio
+istream stdexcept
+istream streambuf
+istream string
+istream string_view
+istream tuple
+istream typeinfo
+istream version
+iterator cctype
+iterator compare
+iterator concepts
+iterator cstdint
+iterator cstdio
+iterator cstring
+iterator cwchar
+iterator cwctype
+iterator initializer_list
+iterator iosfwd
+iterator limits
+iterator variant
+iterator version
+latch climits
+latch cstdint
+latch cstring
+latch ctime
+latch limits
+latch ratio
+latch version
+limits version
+list cctype
+list compare
+list cstdint
+list cstring
+list cwchar
+list cwctype
+list initializer_list
+list limits
+list tuple
+list version
+locale cctype
+locale cerrno
+locale climits
+locale clocale
+locale compare
+locale cstddef
+locale cstdint
+locale cstdio
+locale cstdlib
+locale cstring
+locale ctime
+locale cwchar
+locale cwctype
+locale initializer_list
+locale ios
+locale iosfwd
+locale limits
+locale ratio
+locale stdexcept
+locale streambuf
+locale string
+locale string_view
+locale tuple
+locale typeinfo
+locale version
+map cctype
+map compare
+map cstdint
+map cstring
+map cwchar
+map cwctype
+map initializer_list
+map limits
+map optional
+map stdexcept
+map tuple
+map version
+mdspan array
+mdspan cctype
+mdspan compare
+mdspan concepts
+mdspan cstdint
+mdspan cwchar
+mdspan cwctype
+mdspan initializer_list
+mdspan limits
+mdspan span
+mdspan stdexcept
+mdspan version
+memory compare
+memory cstdint
+memory cstring
+memory initializer_list
+memory limits
+memory tuple
+memory typeinfo
+memory version
+memory_resource cerrno
+memory_resource climits
+memory_resource compare
+memory_resource cstdint
+memory_resource ctime
+memory_resource limits
+memory_resource ratio
+memory_resource tuple
+memory_resource version
+mutex cerrno
+mutex climits
+mutex compare
+mutex cstdint
+mutex ctime
+mutex limits
+mutex ratio
+mutex tuple
+mutex typeinfo
+mutex version
+new version
+numbers version
+numeric climits
+numeric compare
+numeric cstdint
+numeric cstring
+numeric ctime
+numeric initializer_list
+numeric limits
+numeric optional
+numeric ratio
+numeric tuple
+numeric version
+optional compare
+optional cstdint
+optional cstring
+optional initializer_list
+optional limits
+optional version
+ostream array
+ostream bitset
+ostream cctype
+ostream cerrno
+ostream climits
+ostream clocale
+ostream cmath
+ostream compare
+ostream cstddef
+ostream cstdint
+ostream cstdio
+ostream cstdlib
+ostream cstring
+ostream ctime
+ostream cwchar
+ostream cwctype
+ostream format
+ostream initializer_list
+ostream ios
+ostream iosfwd
+ostream limits
+ostream locale
+ostream optional
+ostream print
+ostream ratio
+ostream stdexcept
+ostream streambuf
+ostream string
+ostream string_view
+ostream tuple
+ostream typeinfo
+ostream version
+print array
+print cctype
+print cerrno
+print climits
+print clocale
+print cmath
+print compare
+print cstddef
+print cstdint
+print cstdio
+print cstdlib
+print cstring
+print cwchar
+print cwctype
+print format
+print initializer_list
+print iosfwd
+print limits
+print optional
+print stdexcept
+print string
+print string_view
+print tuple
+print typeinfo
+print version
+queue array
+queue cctype
+queue cerrno
+queue climits
+queue clocale
+queue compare
+queue cstddef
+queue cstdint
+queue cstdio
+queue cstdlib
+queue cstring
+queue cwchar
+queue cwctype
+queue deque
+queue initializer_list
+queue iosfwd
+queue limits
+queue stdexcept
+queue string
+queue string_view
+queue tuple
+queue typeinfo
+queue vector
+queue version
+random cctype
+random climits
+random cmath
+random compare
+random cstdint
+random cstdio
+random cstring
+random ctime
+random cwchar
+random cwctype
+random initializer_list
+random iosfwd
+random limits
+random numeric
+random optional
+random ratio
+random stdexcept
+random string
+random string_view
+random tuple
+random version
+ranges cctype
+ranges compare
+ranges concepts
+ranges cstdint
+ranges cstdio
+ranges cstring
+ranges cwchar
+ranges cwctype
+ranges initializer_list
+ranges iosfwd
+ranges iterator
+ranges limits
+ranges optional
+ranges span
+ranges stdexcept
+ranges tuple
+ranges variant
+ranges version
+ratio climits
+ratio cstdint
+ratio version
+regex array
+regex cctype
+regex cerrno
+regex climits
+regex clocale
+regex compare
+regex cstddef
+regex cstdint
+regex cstdio
+regex cstdlib
+regex cstring
+regex cwchar
+regex cwctype
+regex deque
+regex initializer_list
+regex iosfwd
+regex limits
+regex stdexcept
+regex string
+regex string_view
+regex tuple
+regex typeinfo
+regex vector
+regex version
+scoped_allocator compare
+scoped_allocator cstdint
+scoped_allocator limits
+scoped_allocator tuple
+scoped_allocator version
+semaphore climits
+semaphore cstdint
+semaphore cstring
+semaphore ctime
+semaphore limits
+semaphore ratio
+semaphore version
+set cctype
+set compare
+set cstdint
+set cstring
+set cwchar
+set cwctype
+set initializer_list
+set limits
+set optional
+set tuple
+set version
+shared_mutex cerrno
+shared_mutex climits
+shared_mutex cstdint
+shared_mutex ctime
+shared_mutex limits
+shared_mutex ratio
+shared_mutex version
+source_location cstdint
+source_location version
+span initializer_list
+span limits
+span stdexcept
+span version
+sstream bitset
+sstream cctype
+sstream cerrno
+sstream climits
+sstream clocale
+sstream compare
+sstream cstddef
+sstream cstdint
+sstream cstdio
+sstream cstdlib
+sstream cstring
+sstream ctime
+sstream cwchar
+sstream cwctype
+sstream initializer_list
+sstream ios
+sstream iosfwd
+sstream istream
+sstream limits
+sstream locale
+sstream ratio
+sstream stdexcept
+sstream streambuf
+sstream string
+sstream string_view
+sstream tuple
+sstream typeinfo
+sstream version
+stack cctype
+stack compare
+stack cstdint
+stack cstring
+stack cwchar
+stack cwctype
+stack deque
+stack initializer_list
+stack limits
+stack stdexcept
+stack tuple
+stack version
+stop_token atomic
+stop_token climits
+stop_token cstdint
+stop_token cstring
+stop_token ctime
+stop_token limits
+stop_token ratio
+stop_token version
+streambuf cctype
+streambuf cerrno
+streambuf climits
+streambuf clocale
+streambuf compare
+streambuf cstddef
+streambuf cstdint
+streambuf cstdio
+streambuf cstdlib
+streambuf cstring
+streambuf ctime
+streambuf cwchar
+streambuf cwctype
+streambuf initializer_list
+streambuf ios
+streambuf iosfwd
+streambuf limits
+streambuf ratio
+streambuf stdexcept
+streambuf string
+streambuf string_view
+streambuf tuple
+streambuf typeinfo
+streambuf version
+string cctype
+string climits
+string compare
+string cstdint
+string cstdio
+string cstring
+string cwchar
+string cwctype
+string initializer_list
+string iosfwd
+string limits
+string stdexcept
+string string_view
+string tuple
+string version
+string_view cctype
+string_view compare
+string_view cstdint
+string_view cstdio
+string_view cstring
+string_view cwchar
+string_view cwctype
+string_view initializer_list
+string_view iosfwd
+string_view limits
+string_view stdexcept
+string_view version
+strstream bitset
+strstream cctype
+strstream cerrno
+strstream climits
+strstream clocale
+strstream compare
+strstream cstddef
+strstream cstdint
+strstream cstdio
+strstream cstdlib
+strstream cstring
+strstream ctime
+strstream cwchar
+strstream cwctype
+strstream initializer_list
+strstream ios
+strstream iosfwd
+strstream istream
+strstream limits
+strstream locale
+strstream ratio
+strstream stdexcept
+strstream streambuf
+strstream string
+strstream string_view
+strstream tuple
+strstream typeinfo
+strstream version
+syncstream array
+syncstream bitset
+syncstream cctype
+syncstream cerrno
+syncstream climits
+syncstream clocale
+syncstream cmath
+syncstream compare
+syncstream cstddef
+syncstream cstdint
+syncstream cstdio
+syncstream cstdlib
+syncstream cstring
+syncstream ctime
+syncstream cwchar
+syncstream cwctype
+syncstream format
+syncstream initializer_list
+syncstream ios
+syncstream iosfwd
+syncstream limits
+syncstream locale
+syncstream map
+syncstream optional
+syncstream ostream
+syncstream print
+syncstream ratio
+syncstream shared_mutex
+syncstream stdexcept
+syncstream streambuf
+syncstream string
+syncstream string_view
+syncstream tuple
+syncstream typeinfo
+syncstream version
+system_error cctype
+system_error cerrno
+system_error climits
+system_error compare
+system_error cstdint
+system_error cstdio
+system_error cstring
+system_error cwchar
+system_error cwctype
+system_error initializer_list
+system_error iosfwd
+system_error limits
+system_error stdexcept
+system_error string
+system_error string_view
+system_error tuple
+system_error version
+thread array
+thread atomic
+thread bitset
+thread cctype
+thread cerrno
+thread climits
+thread clocale
+thread compare
+thread cstddef
+thread cstdint
+thread cstdio
+thread cstdlib
+thread cstring
+thread ctime
+thread cwchar
+thread cwctype
+thread initializer_list
+thread ios
+thread iosfwd
+thread istream
+thread limits
+thread locale
+thread ratio
+thread sstream
+thread stdexcept
+thread streambuf
+thread string
+thread string_view
+thread tuple
+thread typeinfo
+thread version
+tuple compare
+tuple cstdint
+tuple limits
+tuple version
+type_traits cstdint
+type_traits version
+typeindex compare
+typeindex cstdint
+typeindex limits
+typeindex typeinfo
+typeindex version
+typeinfo cstdint
+typeinfo version
+unordered_map compare
+unordered_map cstdint
+unordered_map cstring
+unordered_map initializer_list
+unordered_map limits
+unordered_map optional
+unordered_map stdexcept
+unordered_map tuple
+unordered_map version
+unordered_set compare
+unordered_set cstdint
+unordered_set cstring
+unordered_set initializer_list
+unordered_set limits
+unordered_set optional
+unordered_set tuple
+unordered_set version
+utility compare
+utility cstdint
+utility cstring
+utility initializer_list
+utility limits
+utility version
+valarray cmath
+valarray cstdint
+valarray initializer_list
+valarray limits
+valarray version
+variant compare
+variant cstdint
+variant cstring
+variant initializer_list
+variant limits
+variant version
+vector array
+vector cctype
+vector cerrno
+vector climits
+vector clocale
+vector compare
+vector cstddef
+vector cstdint
+vector cstdio
+vector cstdlib
+vector cstring
+vector cwchar
+vector cwctype
+vector initializer_list
+vector iosfwd
+vector limits
+vector stdexcept
+vector string
+vector string_view
+vector tuple
+vector typeinfo
+vector version
diff --git a/libcxx/test/libcxx-03/transitive_includes/to_csv.py b/libcxx/test/libcxx-03/transitive_includes/to_csv.py
new file mode 100755
index 0000000000000..69d94deedf6f5
--- /dev/null
+++ b/libcxx/test/libcxx-03/transitive_includes/to_csv.py
@@ -0,0 +1,120 @@
+#!/usr/bin/env python
+# ===----------------------------------------------------------------------===##
+#
+# Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+# See https://llvm.org/LICENSE.txt for license information.
+# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+#
+# ===----------------------------------------------------------------------===##
+
+from typing import List, Tuple, Optional
+import argparse
+import io
+import itertools
+import os
+import pathlib
+import re
+import sys
+
+libcxx_root = os.path.dirname(os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))))
+sys.path.append(os.path.join(libcxx_root, "utils"))
+from libcxx.header_information import Header
+
+def parse_line(line: str) -> Tuple[int, str]:
+ """
+ Parse a single line of --trace-includes output.
+
+ Returns the inclusion level and the raw file name being included.
+ """
+ match = re.match(r"(\.+) (.+)", line)
+ if not match:
+ raise ArgumentError(f"Line {line} contains invalid data.")
+
+ # The number of periods in front of the header name is the nesting level of
+ # that header.
+ return (len(match.group(1)), match.group(2))
+
+def make_cxx_v1_relative(header: str) -> Optional[str]:
+ """
+ Returns the path of the header as relative to <whatever>/c++/v1, or None if the path
+ doesn't contain c++/v1.
+
+ We use that heuristic to figure out which headers are libc++ headers.
+ """
+ # On Windows, the path separators can either be forward slash or backslash.
+ # If it is a backslash, Clang prints it escaped as two consecutive
+ # backslashes, and they need to be escaped in the RE. (Use a raw string for
+ # the pattern to avoid needing another level of escaping on the Python string
+ # literal level.)
+ pathsep = r"(?:/|\\\\)"
+ CXX_V1_REGEX = r"^.*c\+\+" + pathsep + r"v[0-9]+" + pathsep + r"(.+)$"
+ match = re.match(CXX_V1_REGEX, header)
+ if not match:
+ return None
+ else:
+ return match.group(1)
+
+def parse_file(file: io.TextIOBase) -> List[Tuple[Header, Header]]:
+ """
+ Parse a file containing --trace-includes output to generate a list of the
+ transitive includes contained in it.
+ """
+ result = []
+ includer = None
+ for line in file.readlines():
+ (level, header) = parse_line(line)
+ relative = make_cxx_v1_relative(header)
+
+ # Not a libc++ header
+ if relative is None:
+ continue
+
+ # If we're at the first level, remember this header as being the one who includes other headers.
+ # There's usually exactly one, except if the compiler is passed a file with `-include`.
+ if level == 1:
+ includer = Header(relative)
+ continue
+
+ # Otherwise, take note that this header is being included by the top-level includer.
+ else:
+ assert includer is not None
+ result.append((includer, Header(relative)))
+ return result
+
+def print_csv(includes: List[Tuple[Header, Header]]) -> None:
+ """
+ Print the transitive includes as space-delimited CSV.
+
+ This function only prints public libc++ headers that are not C compatibility headers.
+ """
+ # Sort and group by includer
+ by_includer = lambda t: t[0]
+ includes = itertools.groupby(sorted(includes, key=by_includer), key=by_includer)
+
+ for (includer, includees) in includes:
+ includees = map(lambda t: t[1], includees)
+ for h in sorted(set(includees)):
+ if h.is_public() and not h.is_C_compatibility():
+ print(f"{includer} {h}")
+
+def main(argv):
+ parser = argparse.ArgumentParser(
+ description="""
+ Given a list of headers produced by --trace-includes, produce a list of libc++ headers in that output.
+
+ Note that -fshow-skipped-includes must also be passed to the compiler in order to get sufficient
+ information for this script to run.
+
+ The output of this script is provided in space-delimited CSV format where each line contains:
+
+ <header performing inclusion> <header being included>
+ """)
+ parser.add_argument("inputs", type=argparse.FileType("r"), nargs='+', default=None,
+ help="One or more files containing the result of --trace-includes")
+ args = parser.parse_args(argv)
+
+ includes = [line for file in args.inputs for line in parse_file(file)]
+ print_csv(includes)
+
+if __name__ == "__main__":
+ main(sys.argv[1:])
diff --git a/libcxx/test/libcxx-03/type_traits/convert_to_integral.pass.cpp b/libcxx/test/libcxx-03/type_traits/convert_to_integral.pass.cpp
new file mode 100644
index 0000000000000..f1036b3929f06
--- /dev/null
+++ b/libcxx/test/libcxx-03/type_traits/convert_to_integral.pass.cpp
@@ -0,0 +1,123 @@
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+//
+// TODO: Make this test pass for all standards.
+// XFAIL: c++03
+
+// <type_traits>
+
+// __convert_to_integral(Tp)
+
+// Test that the __convert_to_integral functions properly converts Tp to the
+// correct type and value for integral, enum and user defined types.
+
+#include "test_macros.h"
+
+TEST_CLANG_DIAGNOSTIC_IGNORED("-Wprivate-header")
+#include <__utility/convert_to_integral.h>
+#include <limits>
+#include <type_traits>
+#include <cstdint>
+#include <cassert>
+
+#include "user_defined_integral.h"
+
+template <class T>
+struct EnumType
+{
+ enum type : T {E_zero, E_one};
+};
+
+
+template <class From, class To>
+void check_integral_types()
+{
+ typedef std::numeric_limits<From> Limits;
+ const From max = Limits::max();
+ const From min = Limits::min();
+ {
+ auto ret = std::__convert_to_integral((From)max);
+ assert(ret == max);
+ ret = std::__convert_to_integral((From)min);
+ assert(ret == min);
+ static_assert(std::is_same<decltype(ret), To>::value, "");
+ }
+ {
+ UserDefinedIntegral<From> f(max);
+ auto ret = std::__convert_to_integral(f);
+ assert(ret == max);
+ f.value = min;
+ ret = std::__convert_to_integral(f);
+ assert(ret == min);
+ static_assert(std::is_same<decltype(ret), To>::value, "");
+ }
+ {
+ typedef typename EnumType<From>::type Enum;
+ Enum e(static_cast<Enum>(max));
+ auto ret = std::__convert_to_integral(e);
+ assert(ret == max);
+ e = static_cast<Enum>(min);
+ ret = std::__convert_to_integral(min);
+ assert(ret == min);
+ static_assert(std::is_same<decltype(ret), To>::value, "");
+ }
+}
+
+
+template <class From, class To>
+void check_enum_types()
+{
+ auto ret = std::__convert_to_integral((From)1);
+ assert(ret == 1);
+ static_assert(std::is_same<decltype(ret), To>::value, "");
+}
+
+
+enum enum1 { zero = 0, one = 1 };
+enum enum2 : unsigned long {
+ value = std::numeric_limits<unsigned long>::max()
+};
+
+int main(int, char**)
+{
+ check_integral_types<bool, int>();
+ check_integral_types<char, int>();
+ check_integral_types<signed char, int>();
+ check_integral_types<unsigned char, int>();
+#ifndef TEST_HAS_NO_WIDE_CHARACTERS
+ check_integral_types<wchar_t, decltype(((wchar_t)1) + 1)>();
+#endif
+ check_integral_types<char16_t, int>();
+ // On some platforms, unsigned int and long are the same size. These
+ // platforms have a choice of making std::uint32_t an int or a long. However
+ // char32_t must promote to an unsigned int on these platforms [conv.prom].
+ // Use the following logic to make the test work on such platforms.
+ // (sizeof(std::uint32_t) == sizeof(unsigned int)) ? unsigned int : std::uint32_t;
+ typedef std::conditional<sizeof(std::uint32_t) == sizeof(unsigned int),
+ unsigned int, std::uint32_t>::type char_integral;
+ check_integral_types<char32_t, char_integral>();
+ check_integral_types<short, int>();
+ check_integral_types<unsigned short, int>();
+ check_integral_types<int, int>();
+ check_integral_types<unsigned, unsigned>();
+ check_integral_types<long, long>();
+ check_integral_types<unsigned long, unsigned long>();
+ check_integral_types<long long, long long>();
+ check_integral_types<unsigned long long, unsigned long long>();
+#ifndef TEST_HAS_NO_INT128
+ check_integral_types<__int128_t, __int128_t>();
+ check_integral_types<__uint128_t, __uint128_t>();
+#endif
+ // TODO(ericwf): Not standard
+ typedef std::underlying_type<enum1>::type Enum1UT;
+ check_enum_types<enum1, decltype(((Enum1UT)1) + 1)>();
+ typedef std::underlying_type<enum2>::type Enum2UT;
+ check_enum_types<enum2, decltype(((Enum2UT)1) + 1)>();
+
+ return 0;
+}
diff --git a/libcxx/test/libcxx-03/type_traits/datasizeof.compile.pass.cpp b/libcxx/test/libcxx-03/type_traits/datasizeof.compile.pass.cpp
new file mode 100644
index 0000000000000..67a4dccb0f5fe
--- /dev/null
+++ b/libcxx/test/libcxx-03/type_traits/datasizeof.compile.pass.cpp
@@ -0,0 +1,62 @@
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// XFAIL: FROZEN-CXX03-HEADERS-FIXME
+
+#include <__type_traits/datasizeof.h>
+#include <cstdint>
+#include <type_traits>
+
+static_assert(std::__datasizeof_v<std::int8_t> == 1, "");
+static_assert(std::__datasizeof_v<std::int16_t> == 2, "");
+static_assert(std::__datasizeof_v<std::int32_t> == 4, "");
+static_assert(std::__datasizeof_v<std::int64_t> == 8, "");
+
+struct NonStandardLayout {
+ virtual ~NonStandardLayout();
+};
+
+static_assert(!std::is_standard_layout<NonStandardLayout>::value, "");
+static_assert(std::__datasizeof_v<NonStandardLayout> == sizeof(void*), "");
+
+struct Empty {};
+
+static_assert(std::__datasizeof_v<Empty> == 0, "");
+
+struct FinalEmpty final {};
+
+static_assert(std::__datasizeof_v<FinalEmpty> == 0, "");
+
+struct OneBytePadding final {
+ OneBytePadding() {}
+
+ std::int16_t a;
+ std::int8_t b;
+};
+
+#if defined(_WIN32) && !defined(__MINGW32__)
+static_assert(std::__datasizeof_v<OneBytePadding> == 4, "");
+#else
+static_assert(std::__datasizeof_v<OneBytePadding> == 3, "");
+#endif
+
+struct InBetweenPadding {
+ InBetweenPadding() {}
+
+ std::int32_t a;
+ std::int8_t b;
+ std::int16_t c;
+};
+
+static_assert(std::__datasizeof_v<InBetweenPadding> == 8, "");
+
+struct NoDataButNoPadding {
+ OneBytePadding v;
+};
+
+static_assert(std::__datasizeof_v<NoDataButNoPadding> == 4, "");
diff --git a/libcxx/test/libcxx-03/type_traits/desugars_to.compile.pass.cpp b/libcxx/test/libcxx-03/type_traits/desugars_to.compile.pass.cpp
new file mode 100644
index 0000000000000..4ed6d15ee9e95
--- /dev/null
+++ b/libcxx/test/libcxx-03/type_traits/desugars_to.compile.pass.cpp
@@ -0,0 +1,42 @@
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: FROZEN-CXX03-HEADERS-FIXME
+
+// This test requires variable templates
+// UNSUPPORTED: gcc && c++11
+
+#include <__type_traits/desugars_to.h>
+
+struct Tag {};
+struct Operation {};
+
+namespace std {
+template <>
+bool const __desugars_to_v<Tag, Operation> = true;
+}
+
+void tests() {
+ // Make sure that __desugars_to is false by default
+ {
+ struct Foo {};
+ static_assert(!std::__desugars_to_v<Tag, Foo>, "");
+ }
+
+ // Make sure that __desugars_to bypasses const and ref qualifiers on the operation
+ {
+ static_assert(std::__desugars_to_v<Tag, Operation>, ""); // no quals
+ static_assert(std::__desugars_to_v<Tag, Operation const>, "");
+
+ static_assert(std::__desugars_to_v<Tag, Operation&>, "");
+ static_assert(std::__desugars_to_v<Tag, Operation const&>, "");
+
+ static_assert(std::__desugars_to_v<Tag, Operation&&>, "");
+ static_assert(std::__desugars_to_v<Tag, Operation const&&>, "");
+ }
+}
diff --git a/libcxx/test/libcxx-03/type_traits/is_callable.compile.pass.cpp b/libcxx/test/libcxx-03/type_traits/is_callable.compile.pass.cpp
new file mode 100644
index 0000000000000..d7bd701aa706a
--- /dev/null
+++ b/libcxx/test/libcxx-03/type_traits/is_callable.compile.pass.cpp
@@ -0,0 +1,31 @@
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#include <__type_traits/is_callable.h>
+
+struct Functor {
+ void operator()();
+};
+
+int func();
+
+struct NotFunctor {
+ bool compare();
+};
+
+struct ArgumentFunctor {
+ bool operator()(int, int);
+};
+
+static_assert(std::__is_callable<Functor>::value, "");
+static_assert(std::__is_callable<decltype(func)>::value, "");
+static_assert(!std::__is_callable<NotFunctor>::value, "");
+static_assert(!std::__is_callable<NotFunctor,
+ decltype(&NotFunctor::compare)>::value, "");
+static_assert(std::__is_callable<ArgumentFunctor, int, int>::value, "");
+static_assert(!std::__is_callable<ArgumentFunctor, int>::value, "");
diff --git a/libcxx/test/libcxx-03/type_traits/is_constant_evaluated.pass.cpp b/libcxx/test/libcxx-03/type_traits/is_constant_evaluated.pass.cpp
new file mode 100644
index 0000000000000..a538c52a534e7
--- /dev/null
+++ b/libcxx/test/libcxx-03/type_traits/is_constant_evaluated.pass.cpp
@@ -0,0 +1,36 @@
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+//
+
+// <type_traits>
+
+// __libcpp_is_constant_evaluated()
+
+// returns false when there's no constant evaluation support from the compiler.
+// as well as when called not in a constexpr context
+
+// XFAIL: FROZEN-CXX03-HEADERS-FIXME
+
+#include <__type_traits/is_constant_evaluated.h>
+#include <cassert>
+
+#include "test_macros.h"
+
+int main (int, char**) {
+ ASSERT_SAME_TYPE(decltype(std::__libcpp_is_constant_evaluated()), bool);
+ ASSERT_NOEXCEPT(std::__libcpp_is_constant_evaluated());
+
+#if !defined(_LIBCPP_CXX03_LANG)
+ static_assert(std::__libcpp_is_constant_evaluated(), "");
+#endif
+
+ bool p = std::__libcpp_is_constant_evaluated();
+ assert(!p);
+
+ return 0;
+ }
diff --git a/libcxx/test/libcxx-03/type_traits/is_replaceable.compile.pass.cpp b/libcxx/test/libcxx-03/type_traits/is_replaceable.compile.pass.cpp
new file mode 100644
index 0000000000000..7735538cccae4
--- /dev/null
+++ b/libcxx/test/libcxx-03/type_traits/is_replaceable.compile.pass.cpp
@@ -0,0 +1,313 @@
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// XFAIL: FROZEN-CXX03-HEADERS-FIXME
+
+#include <__type_traits/is_replaceable.h>
+#include <array>
+#include <deque>
+#include <exception>
+#include <expected>
+#include <memory>
+#include <optional>
+#include <string>
+#include <tuple>
+#include <type_traits>
+#include <variant>
+#include <vector>
+
+#include "constexpr_char_traits.h"
+#include "test_allocator.h"
+#include "test_macros.h"
+
+#ifndef TEST_HAS_NO_LOCALIZATION
+# include <locale>
+#endif
+
+template <class T>
+struct NonPropagatingStatefulMoveAssignAlloc : std::allocator<T> {
+ using propagate_on_container_move_assignment = std::false_type;
+ using is_always_equal = std::false_type;
+ template <class U>
+ struct rebind {
+ using other = NonPropagatingStatefulMoveAssignAlloc<U>;
+ };
+};
+
+template <class T>
+struct NonPropagatingStatefulCopyAssignAlloc : std::allocator<T> {
+ using propagate_on_container_copy_assignment = std::false_type;
+ using is_always_equal = std::false_type;
+ template <class U>
+ struct rebind {
+ using other = NonPropagatingStatefulCopyAssignAlloc<U>;
+ };
+};
+
+template <class T>
+struct NonPropagatingStatelessMoveAssignAlloc : std::allocator<T> {
+ using propagate_on_container_move_assignment = std::false_type;
+ using is_always_equal = std::true_type;
+ template <class U>
+ struct rebind {
+ using other = NonPropagatingStatelessMoveAssignAlloc<U>;
+ };
+};
+
+template <class T>
+struct NonPropagatingStatelessCopyAssignAlloc : std::allocator<T> {
+ using propagate_on_container_copy_assignment = std::false_type;
+ using is_always_equal = std::true_type;
+ template <class U>
+ struct rebind {
+ using other = NonPropagatingStatelessCopyAssignAlloc<U>;
+ };
+};
+
+template <class T>
+struct NonReplaceableStatelessAlloc : std::allocator<T> {
+ // Ensure that we don't consider an allocator that is a member of a container to be
+ // replaceable if it's not replaceable, even if it always compares equal and always propagates.
+ using propagate_on_container_move_assignment = std::true_type;
+ using propagate_on_container_copy_assignment = std::true_type;
+ using is_always_equal = std::true_type;
+ NonReplaceableStatelessAlloc() = default;
+ NonReplaceableStatelessAlloc(NonReplaceableStatelessAlloc const&) {}
+ NonReplaceableStatelessAlloc(NonReplaceableStatelessAlloc&&) = default;
+ template <class U>
+ struct rebind {
+ using other = NonReplaceableStatelessAlloc<U>;
+ };
+};
+static_assert(!std::__is_replaceable<NonReplaceableStatelessAlloc<int> >::value, "");
+
+static_assert(!std::__is_replaceable<test_allocator<char> >::value, ""); // we use that property below
+
+struct Empty {};
+static_assert(std::__is_replaceable<char>::value, "");
+static_assert(std::__is_replaceable<int>::value, "");
+static_assert(std::__is_replaceable<double>::value, "");
+static_assert(std::__is_replaceable<Empty>::value, "");
+
+struct TriviallyCopyable {
+ char c;
+ int i;
+ Empty s;
+};
+static_assert(std::__is_replaceable<TriviallyCopyable>::value, "");
+
+struct NotTriviallyCopyable {
+ NotTriviallyCopyable(const NotTriviallyCopyable&);
+ ~NotTriviallyCopyable();
+};
+static_assert(!std::__is_replaceable<NotTriviallyCopyable>::value, "");
+
+struct MoveOnlyTriviallyCopyable {
+ MoveOnlyTriviallyCopyable(const MoveOnlyTriviallyCopyable&) = delete;
+ MoveOnlyTriviallyCopyable& operator=(const MoveOnlyTriviallyCopyable&) = delete;
+ MoveOnlyTriviallyCopyable(MoveOnlyTriviallyCopyable&&) = default;
+ MoveOnlyTriviallyCopyable& operator=(MoveOnlyTriviallyCopyable&&) = default;
+};
+static_assert(std::__is_replaceable<MoveOnlyTriviallyCopyable>::value, "");
+
+struct CustomCopyAssignment {
+ CustomCopyAssignment(const CustomCopyAssignment&) = default;
+ CustomCopyAssignment(CustomCopyAssignment&&) = default;
+ CustomCopyAssignment& operator=(const CustomCopyAssignment&);
+ CustomCopyAssignment& operator=(CustomCopyAssignment&&) = default;
+};
+static_assert(!std::__is_replaceable<CustomCopyAssignment>::value, "");
+
+struct CustomMoveAssignment {
+ CustomMoveAssignment(const CustomMoveAssignment&) = default;
+ CustomMoveAssignment(CustomMoveAssignment&&) = default;
+ CustomMoveAssignment& operator=(const CustomMoveAssignment&) = default;
+ CustomMoveAssignment& operator=(CustomMoveAssignment&&);
+};
+static_assert(!std::__is_replaceable<CustomMoveAssignment>::value, "");
+
+// library-internal types
+// ----------------------
+
+// __split_buffer
+static_assert(std::__is_replaceable<std::__split_buffer<int> >::value, "");
+static_assert(std::__is_replaceable<std::__split_buffer<NotTriviallyCopyable> >::value, "");
+static_assert(!std::__is_replaceable<std::__split_buffer<int, NonPropagatingStatefulCopyAssignAlloc<int> > >::value,
+ "");
+static_assert(!std::__is_replaceable<std::__split_buffer<int, NonPropagatingStatefulMoveAssignAlloc<int> > >::value,
+ "");
+static_assert(std::__is_replaceable<std::__split_buffer<int, NonPropagatingStatelessCopyAssignAlloc<int> > >::value,
+ "");
+static_assert(std::__is_replaceable<std::__split_buffer<int, NonPropagatingStatelessMoveAssignAlloc<int> > >::value,
+ "");
+
+// standard library types
+// ----------------------
+
+// array
+static_assert(std::__is_replaceable<std::array<int, 0> >::value, "");
+static_assert(std::__is_replaceable<std::array<NotTriviallyCopyable, 0> >::value, "");
+static_assert(std::__is_replaceable<std::array<std::unique_ptr<int>, 0> >::value, "");
+
+static_assert(std::__is_replaceable<std::array<int, 1> >::value, "");
+static_assert(!std::__is_replaceable<std::array<NotTriviallyCopyable, 1> >::value, "");
+static_assert(std::__is_replaceable<std::array<std::unique_ptr<int>, 1> >::value, "");
+
+// basic_string
+struct MyChar {
+ char c;
+};
+template <class T>
+struct NotReplaceableCharTraits : constexpr_char_traits<T> {
+ NotReplaceableCharTraits(const NotReplaceableCharTraits&);
+ NotReplaceableCharTraits& operator=(const NotReplaceableCharTraits&);
+ ~NotReplaceableCharTraits();
+};
+
+static_assert(std::__is_replaceable<std::basic_string<char, std::char_traits<char>, std::allocator<char> > >::value,
+ "");
+static_assert(
+ std::__is_replaceable<std::basic_string<char, NotReplaceableCharTraits<char>, std::allocator<char> > >::value, "");
+static_assert(
+ std::__is_replaceable<std::basic_string<MyChar, constexpr_char_traits<MyChar>, std::allocator<MyChar> > >::value,
+ "");
+static_assert(!std::__is_replaceable<std::basic_string<char, std::char_traits<char>, test_allocator<char> > >::value,
+ "");
+static_assert(!std::__is_replaceable<
+ std::basic_string<char, std::char_traits<char>, NonReplaceableStatelessAlloc<char> > >::value,
+ "");
+static_assert(std::__is_replaceable<
+ std::basic_string<MyChar, NotReplaceableCharTraits<MyChar>, std::allocator<MyChar> > >::value,
+ "");
+static_assert(
+ !std::__is_replaceable<
+ std::basic_string<char, std::char_traits<char>, NonPropagatingStatefulCopyAssignAlloc<char> > >::value,
+ "");
+static_assert(
+ !std::__is_replaceable<
+ std::basic_string<char, std::char_traits<char>, NonPropagatingStatefulMoveAssignAlloc<char> > >::value,
+ "");
+static_assert(
+ std::__is_replaceable<
+ std::basic_string<char, std::char_traits<char>, NonPropagatingStatelessCopyAssignAlloc<char> > >::value,
+ "");
+static_assert(
+ std::__is_replaceable<
+ std::basic_string<char, std::char_traits<char>, NonPropagatingStatelessMoveAssignAlloc<char> > >::value,
+ "");
+
+// deque
+static_assert(std::__is_replaceable<std::deque<int> >::value, "");
+static_assert(std::__is_replaceable<std::deque<NotTriviallyCopyable> >::value, "");
+static_assert(!std::__is_replaceable<std::deque<int, test_allocator<int> > >::value, "");
+static_assert(!std::__is_replaceable<std::deque<int, NonReplaceableStatelessAlloc<int> > >::value, "");
+static_assert(!std::__is_replaceable<std::deque<int, NonPropagatingStatefulCopyAssignAlloc<int> > >::value, "");
+static_assert(!std::__is_replaceable<std::deque<int, NonPropagatingStatefulMoveAssignAlloc<int> > >::value, "");
+static_assert(std::__is_replaceable<std::deque<int, NonPropagatingStatelessCopyAssignAlloc<int> > >::value, "");
+static_assert(std::__is_replaceable<std::deque<int, NonPropagatingStatelessMoveAssignAlloc<int> > >::value, "");
+
+// exception_ptr
+#ifndef _LIBCPP_ABI_MICROSOFT
+static_assert(std::__is_replaceable<std::exception_ptr>::value, "");
+#endif
+
+// expected
+#if TEST_STD_VER >= 23
+static_assert(std::__is_replaceable<std::expected<int, int> >::value);
+static_assert(!std::__is_replaceable<std::expected<CustomCopyAssignment, int>>::value);
+static_assert(!std::__is_replaceable<std::expected<int, CustomCopyAssignment>>::value);
+static_assert(!std::__is_replaceable<std::expected<CustomCopyAssignment, CustomCopyAssignment>>::value);
+#endif
+
+// locale
+#ifndef TEST_HAS_NO_LOCALIZATION
+static_assert(std::__is_replaceable<std::locale>::value, "");
+#endif
+
+// optional
+#if TEST_STD_VER >= 17
+static_assert(std::__is_replaceable<std::optional<int>>::value, "");
+static_assert(!std::__is_replaceable<std::optional<CustomCopyAssignment>>::value, "");
+#endif
+
+// pair
+static_assert(std::__is_replaceable<std::pair<int, int> >::value, "");
+static_assert(!std::__is_replaceable<std::pair<CustomCopyAssignment, int> >::value, "");
+static_assert(!std::__is_replaceable<std::pair<int, CustomCopyAssignment> >::value, "");
+static_assert(!std::__is_replaceable<std::pair<CustomCopyAssignment, CustomCopyAssignment> >::value, "");
+
+// shared_ptr
+static_assert(std::__is_replaceable<std::shared_ptr<int> >::value, "");
+
+// tuple
+#if TEST_STD_VER >= 11
+static_assert(std::__is_replaceable<std::tuple<> >::value, "");
+
+static_assert(std::__is_replaceable<std::tuple<int> >::value, "");
+static_assert(!std::__is_replaceable<std::tuple<CustomCopyAssignment> >::value, "");
+
+static_assert(std::__is_replaceable<std::tuple<int, int> >::value, "");
+static_assert(!std::__is_replaceable<std::tuple<CustomCopyAssignment, int> >::value, "");
+static_assert(!std::__is_replaceable<std::tuple<int, CustomCopyAssignment> >::value, "");
+static_assert(!std::__is_replaceable<std::tuple<CustomCopyAssignment, CustomCopyAssignment> >::value, "");
+#endif // TEST_STD_VER >= 11
+
+// unique_ptr
+struct NonReplaceableDeleter {
+ NonReplaceableDeleter(const NonReplaceableDeleter&);
+ NonReplaceableDeleter& operator=(const NonReplaceableDeleter&);
+ ~NonReplaceableDeleter();
+
+ template <class T>
+ void operator()(T*);
+};
+
+struct NonReplaceablePointer {
+ struct pointer {
+ pointer(const pointer&);
+ pointer& operator=(const pointer&);
+ ~pointer();
+ };
+
+ template <class T>
+ void operator()(T*);
+};
+
+static_assert(std::__is_replaceable<std::unique_ptr<int> >::value, "");
+static_assert(std::__is_replaceable<std::unique_ptr<CustomCopyAssignment> >::value, "");
+static_assert(std::__is_replaceable<std::unique_ptr<int[]> >::value, "");
+static_assert(!std::__is_replaceable<std::unique_ptr<int, NonReplaceableDeleter> >::value, "");
+static_assert(!std::__is_replaceable<std::unique_ptr<int[], NonReplaceableDeleter> >::value, "");
+static_assert(!std::__is_replaceable<std::unique_ptr<int, NonReplaceablePointer> >::value, "");
+static_assert(!std::__is_replaceable<std::unique_ptr<int[], NonReplaceablePointer> >::value, "");
+
+// variant
+#if TEST_STD_VER >= 17
+static_assert(std::__is_replaceable<std::variant<int> >::value, "");
+static_assert(!std::__is_replaceable<std::variant<CustomCopyAssignment> >::value, "");
+
+static_assert(std::__is_replaceable<std::variant<int, int> >::value, "");
+static_assert(!std::__is_replaceable<std::variant<CustomCopyAssignment, int> >::value, "");
+static_assert(!std::__is_replaceable<std::variant<int, CustomCopyAssignment> >::value, "");
+static_assert(!std::__is_replaceable<std::variant<CustomCopyAssignment, CustomCopyAssignment> >::value, "");
+#endif // TEST_STD_VER >= 17
+
+// vector
+static_assert(std::__is_replaceable<std::vector<int> >::value, "");
+static_assert(std::__is_replaceable<std::vector<CustomCopyAssignment> >::value, "");
+static_assert(!std::__is_replaceable<std::vector<int, test_allocator<int> > >::value, "");
+static_assert(!std::__is_replaceable<std::vector<int, NonReplaceableStatelessAlloc<int> > >::value, "");
+static_assert(!std::__is_replaceable<std::vector<int, NonPropagatingStatefulCopyAssignAlloc<int> > >::value, "");
+static_assert(!std::__is_replaceable<std::vector<int, NonPropagatingStatefulMoveAssignAlloc<int> > >::value, "");
+static_assert(std::__is_replaceable<std::vector<int, NonPropagatingStatelessCopyAssignAlloc<int> > >::value, "");
+static_assert(std::__is_replaceable<std::vector<int, NonPropagatingStatelessMoveAssignAlloc<int> > >::value, "");
+
+// weak_ptr
+static_assert(std::__is_replaceable<std::weak_ptr<CustomCopyAssignment> >::value, "");
+
+// TODO: Mark all the replaceable STL types as such
diff --git a/libcxx/test/libcxx-03/type_traits/is_trivially_comparable.compile.pass.cpp b/libcxx/test/libcxx-03/type_traits/is_trivially_comparable.compile.pass.cpp
new file mode 100644
index 0000000000000..e9b53080fcd6d
--- /dev/null
+++ b/libcxx/test/libcxx-03/type_traits/is_trivially_comparable.compile.pass.cpp
@@ -0,0 +1,67 @@
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// XFAIL: FROZEN-CXX03-HEADERS-FIXME
+
+#include <__type_traits/conditional.h>
+#include <__type_traits/is_equality_comparable.h>
+#include <__type_traits/is_signed.h>
+#include <cstdint>
+
+enum Enum : int {};
+enum class EnumClass : int {};
+
+static_assert(std::__libcpp_is_trivially_equality_comparable<int, int>::value, "");
+static_assert(std::__libcpp_is_trivially_equality_comparable<const int, int>::value, "");
+static_assert(std::__libcpp_is_trivially_equality_comparable<int, const int>::value, "");
+
+static_assert(std::__libcpp_is_trivially_equality_comparable<unsigned int, unsigned int>::value, "");
+static_assert(std::__libcpp_is_trivially_equality_comparable<const unsigned int, unsigned int>::value, "");
+static_assert(!std::__libcpp_is_trivially_equality_comparable<unsigned int, int>::value, "");
+
+static_assert(!std::__libcpp_is_trivially_equality_comparable<std::int32_t, std::int64_t>::value, "");
+static_assert(!std::__libcpp_is_trivially_equality_comparable<std::int64_t, std::int32_t>::value, "");
+
+static_assert(std::__libcpp_is_trivially_equality_comparable<int*, int*>::value, "");
+static_assert(std::__libcpp_is_trivially_equality_comparable<int*, void*>::value, "");
+static_assert(!std::__libcpp_is_trivially_equality_comparable<int*, long*>::value, "");
+
+static_assert(!std::__libcpp_is_trivially_equality_comparable<Enum, int>::value, "");
+static_assert(!std::__libcpp_is_trivially_equality_comparable<EnumClass, int>::value, "");
+
+static_assert(!std::__libcpp_is_trivially_equality_comparable<float, int>::value, "");
+static_assert(!std::__libcpp_is_trivially_equality_comparable<double, long long>::value, "");
+
+static_assert(!std::__libcpp_is_trivially_equality_comparable<float, int>::value, "");
+
+static_assert(!std::__libcpp_is_trivially_equality_comparable<float, float>::value, "");
+static_assert(!std::__libcpp_is_trivially_equality_comparable<double, double>::value, "");
+static_assert(!std::__libcpp_is_trivially_equality_comparable<long double, long double>::value, "");
+
+static_assert(std::__libcpp_is_trivially_equality_comparable<
+ char,
+ typename std::conditional<std::is_signed<char>::value, signed char, unsigned char>::type>::value,
+ "");
+static_assert(std::__libcpp_is_trivially_equality_comparable<char16_t, std::uint_least16_t>::value, "");
+
+struct S {
+ char c;
+};
+
+struct S2 {
+ char c;
+};
+
+struct VirtualBase : virtual S {};
+struct NonVirtualBase : S, S2 {};
+
+static_assert(!std::__libcpp_is_trivially_equality_comparable<S*, VirtualBase*>::value, "");
+static_assert(!std::__libcpp_is_trivially_equality_comparable<S2*, VirtualBase*>::value, "");
+
+// This is trivially_equality_comparable, but we can't detect it currently
+static_assert(!std::__libcpp_is_trivially_equality_comparable<S*, NonVirtualBase*>::value, "");
diff --git a/libcxx/test/libcxx-03/type_traits/is_trivially_relocatable.compile.pass.cpp b/libcxx/test/libcxx-03/type_traits/is_trivially_relocatable.compile.pass.cpp
new file mode 100644
index 0000000000000..8066925f2900a
--- /dev/null
+++ b/libcxx/test/libcxx-03/type_traits/is_trivially_relocatable.compile.pass.cpp
@@ -0,0 +1,243 @@
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// XFAIL: FROZEN-CXX03-HEADERS-FIXME
+
+#include <__type_traits/is_trivially_relocatable.h>
+#include <array>
+#include <deque>
+#include <exception>
+#include <expected>
+#include <memory>
+#include <optional>
+#include <string>
+#include <tuple>
+#include <variant>
+#include <vector>
+
+#include "constexpr_char_traits.h"
+#include "test_allocator.h"
+#include "test_macros.h"
+
+#ifndef TEST_HAS_NO_LOCALIZATION
+# include <locale>
+#endif
+
+static_assert(std::__libcpp_is_trivially_relocatable<char>::value, "");
+static_assert(std::__libcpp_is_trivially_relocatable<int>::value, "");
+static_assert(std::__libcpp_is_trivially_relocatable<double>::value, "");
+
+struct Empty {};
+static_assert(std::__libcpp_is_trivially_relocatable<Empty>::value, "");
+
+struct TriviallyCopyable {
+ char c;
+ int i;
+ Empty s;
+};
+static_assert(std::__libcpp_is_trivially_relocatable<TriviallyCopyable>::value, "");
+
+struct NotTriviallyCopyable {
+ NotTriviallyCopyable(const NotTriviallyCopyable&);
+ ~NotTriviallyCopyable();
+};
+static_assert(!std::__libcpp_is_trivially_relocatable<NotTriviallyCopyable>::value, "");
+
+struct MoveOnlyTriviallyCopyable {
+ MoveOnlyTriviallyCopyable(const MoveOnlyTriviallyCopyable&) = delete;
+ MoveOnlyTriviallyCopyable& operator=(const MoveOnlyTriviallyCopyable&) = delete;
+ MoveOnlyTriviallyCopyable(MoveOnlyTriviallyCopyable&&) = default;
+ MoveOnlyTriviallyCopyable& operator=(MoveOnlyTriviallyCopyable&&) = default;
+};
+static_assert(std::__libcpp_is_trivially_relocatable<MoveOnlyTriviallyCopyable>::value, "");
+
+struct NonTrivialMoveConstructor {
+ NonTrivialMoveConstructor(NonTrivialMoveConstructor&&);
+};
+static_assert(!std::__libcpp_is_trivially_relocatable<NonTrivialMoveConstructor>::value, "");
+
+struct NonTrivialDestructor {
+ ~NonTrivialDestructor() {}
+};
+static_assert(!std::__libcpp_is_trivially_relocatable<NonTrivialDestructor>::value, "");
+
+// library-internal types
+// ----------------------
+
+// __split_buffer
+static_assert(std::__libcpp_is_trivially_relocatable<std::__split_buffer<int> >::value, "");
+static_assert(std::__libcpp_is_trivially_relocatable<std::__split_buffer<NotTriviallyCopyable> >::value, "");
+static_assert(!std::__libcpp_is_trivially_relocatable<std::__split_buffer<int, test_allocator<int> > >::value, "");
+
+// standard library types
+// ----------------------
+
+// array
+static_assert(std::__libcpp_is_trivially_relocatable<std::array<int, 0> >::value, "");
+static_assert(std::__libcpp_is_trivially_relocatable<std::array<NotTriviallyCopyable, 0> >::value, "");
+static_assert(std::__libcpp_is_trivially_relocatable<std::array<std::unique_ptr<int>, 0> >::value, "");
+
+static_assert(std::__libcpp_is_trivially_relocatable<std::array<int, 1> >::value, "");
+static_assert(!std::__libcpp_is_trivially_relocatable<std::array<NotTriviallyCopyable, 1> >::value, "");
+static_assert(std::__libcpp_is_trivially_relocatable<std::array<std::unique_ptr<int>, 1> >::value, "");
+
+// basic_string
+#if !__has_feature(address_sanitizer) || !_LIBCPP_INSTRUMENTED_WITH_ASAN
+struct MyChar {
+ char c;
+};
+template <class T>
+struct NotTriviallyRelocatableCharTraits : constexpr_char_traits<T> {
+ NotTriviallyRelocatableCharTraits(const NotTriviallyRelocatableCharTraits&);
+ NotTriviallyRelocatableCharTraits& operator=(const NotTriviallyRelocatableCharTraits&);
+ ~NotTriviallyRelocatableCharTraits();
+};
+
+static_assert(std::__libcpp_is_trivially_relocatable<
+ std::basic_string<char, std::char_traits<char>, std::allocator<char> > >::value,
+ "");
+static_assert(std::__libcpp_is_trivially_relocatable<
+ std::basic_string<char, NotTriviallyRelocatableCharTraits<char>, std::allocator<char> > >::value,
+ "");
+static_assert(std::__libcpp_is_trivially_relocatable<
+ std::basic_string<MyChar, constexpr_char_traits<MyChar>, std::allocator<MyChar> > >::value,
+ "");
+static_assert(
+ std::__libcpp_is_trivially_relocatable<
+ std::basic_string<MyChar, NotTriviallyRelocatableCharTraits<MyChar>, std::allocator<MyChar> > >::value,
+ "");
+static_assert(!std::__libcpp_is_trivially_relocatable<
+ std::basic_string<char, std::char_traits<char>, test_allocator<char> > >::value,
+ "");
+static_assert(
+ !std::__libcpp_is_trivially_relocatable<
+ std::basic_string<MyChar, NotTriviallyRelocatableCharTraits<MyChar>, test_allocator<MyChar> > >::value,
+ "");
+#endif
+
+// deque
+static_assert(std::__libcpp_is_trivially_relocatable<std::deque<int> >::value, "");
+static_assert(std::__libcpp_is_trivially_relocatable<std::deque<NotTriviallyCopyable> >::value, "");
+static_assert(!std::__libcpp_is_trivially_relocatable<std::deque<int, test_allocator<int> > >::value, "");
+
+// exception_ptr
+#ifndef _LIBCPP_ABI_MICROSOFT // FIXME: Is this also the case on windows?
+static_assert(std::__libcpp_is_trivially_relocatable<std::exception_ptr>::value, "");
+#endif
+
+// expected
+#if TEST_STD_VER >= 23
+static_assert(std::__libcpp_is_trivially_relocatable<std::expected<int, int> >::value);
+static_assert(std::__libcpp_is_trivially_relocatable<std::expected<std::unique_ptr<int>, int>>::value);
+static_assert(std::__libcpp_is_trivially_relocatable<std::expected<int, std::unique_ptr<int>>>::value);
+static_assert(std::__libcpp_is_trivially_relocatable<std::expected<std::unique_ptr<int>, std::unique_ptr<int>>>::value);
+
+static_assert(!std::__libcpp_is_trivially_relocatable<std::expected<int, NotTriviallyCopyable>>::value);
+static_assert(!std::__libcpp_is_trivially_relocatable<std::expected<NotTriviallyCopyable, int>>::value);
+static_assert(
+ !std::__libcpp_is_trivially_relocatable<std::expected<NotTriviallyCopyable, NotTriviallyCopyable>>::value);
+#endif
+
+// locale
+#ifndef TEST_HAS_NO_LOCALIZATION
+static_assert(std::__libcpp_is_trivially_relocatable<std::locale>::value, "");
+#endif
+
+// optional
+#if TEST_STD_VER >= 17
+static_assert(std::__libcpp_is_trivially_relocatable<std::optional<int>>::value, "");
+static_assert(!std::__libcpp_is_trivially_relocatable<std::optional<NotTriviallyCopyable>>::value, "");
+static_assert(std::__libcpp_is_trivially_relocatable<std::optional<std::unique_ptr<int>>>::value, "");
+#endif // TEST_STD_VER >= 17
+
+// pair
+static_assert(std::__libcpp_is_trivially_relocatable<std::pair<int, int> >::value, "");
+static_assert(!std::__libcpp_is_trivially_relocatable<std::pair<NotTriviallyCopyable, int> >::value, "");
+static_assert(!std::__libcpp_is_trivially_relocatable<std::pair<int, NotTriviallyCopyable> >::value, "");
+static_assert(!std::__libcpp_is_trivially_relocatable<std::pair<NotTriviallyCopyable, NotTriviallyCopyable> >::value,
+ "");
+static_assert(std::__libcpp_is_trivially_relocatable<std::pair<std::unique_ptr<int>, std::unique_ptr<int> > >::value,
+ "");
+
+// shared_ptr
+static_assert(std::__libcpp_is_trivially_relocatable<std::shared_ptr<NotTriviallyCopyable> >::value, "");
+
+// tuple
+#if TEST_STD_VER >= 11
+static_assert(std::__libcpp_is_trivially_relocatable<std::tuple<> >::value, "");
+
+static_assert(std::__libcpp_is_trivially_relocatable<std::tuple<int> >::value, "");
+static_assert(!std::__libcpp_is_trivially_relocatable<std::tuple<NotTriviallyCopyable> >::value, "");
+static_assert(std::__libcpp_is_trivially_relocatable<std::tuple<std::unique_ptr<int> > >::value, "");
+
+static_assert(std::__libcpp_is_trivially_relocatable<std::tuple<int, int> >::value, "");
+static_assert(!std::__libcpp_is_trivially_relocatable<std::tuple<NotTriviallyCopyable, int> >::value, "");
+static_assert(!std::__libcpp_is_trivially_relocatable<std::tuple<int, NotTriviallyCopyable> >::value, "");
+static_assert(!std::__libcpp_is_trivially_relocatable<std::tuple<NotTriviallyCopyable, NotTriviallyCopyable> >::value,
+ "");
+static_assert(std::__libcpp_is_trivially_relocatable<std::tuple<std::unique_ptr<int>, std::unique_ptr<int> > >::value,
+ "");
+#endif // TEST_STD_VER >= 11
+
+// unique_ptr
+struct NotTriviallyRelocatableDeleter {
+ NotTriviallyRelocatableDeleter(const NotTriviallyRelocatableDeleter&);
+ NotTriviallyRelocatableDeleter& operator=(const NotTriviallyRelocatableDeleter&);
+ ~NotTriviallyRelocatableDeleter();
+
+ template <class T>
+ void operator()(T*);
+};
+
+struct NotTriviallyRelocatablePointer {
+ struct pointer {
+ pointer(const pointer&);
+ pointer& operator=(const pointer&);
+ ~pointer();
+ };
+
+ template <class T>
+ void operator()(T*);
+};
+
+static_assert(std::__libcpp_is_trivially_relocatable<std::unique_ptr<int> >::value, "");
+static_assert(std::__libcpp_is_trivially_relocatable<std::unique_ptr<NotTriviallyCopyable> >::value, "");
+static_assert(std::__libcpp_is_trivially_relocatable<std::unique_ptr<int[]> >::value, "");
+static_assert(!std::__libcpp_is_trivially_relocatable<std::unique_ptr<int, NotTriviallyRelocatableDeleter> >::value,
+ "");
+static_assert(!std::__libcpp_is_trivially_relocatable<std::unique_ptr<int[], NotTriviallyRelocatableDeleter> >::value,
+ "");
+static_assert(!std::__libcpp_is_trivially_relocatable<std::unique_ptr<int, NotTriviallyRelocatablePointer> >::value,
+ "");
+static_assert(!std::__libcpp_is_trivially_relocatable<std::unique_ptr<int[], NotTriviallyRelocatablePointer> >::value,
+ "");
+
+// variant
+#if TEST_STD_VER >= 17
+static_assert(std::__libcpp_is_trivially_relocatable<std::variant<int> >::value, "");
+static_assert(!std::__libcpp_is_trivially_relocatable<std::variant<NotTriviallyCopyable> >::value, "");
+static_assert(std::__libcpp_is_trivially_relocatable<std::variant<std::unique_ptr<int> > >::value, "");
+
+static_assert(std::__libcpp_is_trivially_relocatable<std::variant<int, int> >::value, "");
+static_assert(!std::__libcpp_is_trivially_relocatable<std::variant<NotTriviallyCopyable, int> >::value, "");
+static_assert(!std::__libcpp_is_trivially_relocatable<std::variant<int, NotTriviallyCopyable> >::value, "");
+static_assert(!std::__libcpp_is_trivially_relocatable<std::variant<NotTriviallyCopyable, NotTriviallyCopyable> >::value,
+ "");
+static_assert(std::__libcpp_is_trivially_relocatable<std::variant<std::unique_ptr<int>, std::unique_ptr<int> > >::value,
+ "");
+#endif // TEST_STD_VER >= 17
+
+// vector
+static_assert(std::__libcpp_is_trivially_relocatable<std::vector<int> >::value, "");
+static_assert(std::__libcpp_is_trivially_relocatable<std::vector<NotTriviallyCopyable> >::value, "");
+static_assert(!std::__libcpp_is_trivially_relocatable<std::vector<int, test_allocator<int> > >::value, "");
+
+// weak_ptr
+static_assert(std::__libcpp_is_trivially_relocatable<std::weak_ptr<NotTriviallyCopyable> >::value, "");
+
+// TODO: Mark all the trivially relocatable STL types as such
diff --git a/libcxx/test/libcxx-03/utilities/exception_guard.odr.sh.cpp b/libcxx/test/libcxx-03/utilities/exception_guard.odr.sh.cpp
new file mode 100644
index 0000000000000..fb51a4bf4ed27
--- /dev/null
+++ b/libcxx/test/libcxx-03/utilities/exception_guard.odr.sh.cpp
@@ -0,0 +1,45 @@
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// This test relies on `typeid` and thus requires `-frtti`.
+// UNSUPPORTED: no-rtti
+
+// XFAIL: FROZEN-CXX03-HEADERS-FIXME
+
+// Make sure that we don't get ODR violations with __exception_guard when
+// linking together TUs compiled with different values of -f[no-]exceptions.
+
+// RUN: %{cxx} %s %{flags} %{compile_flags} -c -o %t.except.o -O1 -fexceptions
+// RUN: %{cxx} %s %{flags} %{compile_flags} -c -o %t.noexcept.o -O1 -fno-exceptions
+// RUN: %{cxx} %{flags} %{link_flags} -o %t.exe %t.except.o %t.noexcept.o
+// RUN: %{run}
+
+#include <__utility/exception_guard.h>
+#include <cassert>
+#include <cstring>
+#include <typeinfo>
+
+struct Rollback {
+ void operator()() {}
+};
+
+#if defined(__cpp_exceptions) && __cpp_exceptions >= 199711L
+
+const char* func();
+
+int main(int, char**) {
+ assert(std::strcmp(typeid(std::__exception_guard<Rollback>).name(), func()) != 0);
+
+ return 0;
+}
+
+#else
+
+const char* func() { return typeid(std::__exception_guard<Rollback>).name(); }
+
+#endif
diff --git a/libcxx/test/libcxx-03/utilities/function.objects/func.require/bullet_1_2_3.pass.cpp b/libcxx/test/libcxx-03/utilities/function.objects/func.require/bullet_1_2_3.pass.cpp
new file mode 100644
index 0000000000000..48460d1488fd7
--- /dev/null
+++ b/libcxx/test/libcxx-03/utilities/function.objects/func.require/bullet_1_2_3.pass.cpp
@@ -0,0 +1,405 @@
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// <functional>
+
+// INVOKE (f, t1, t2, ..., tN)
+
+//------------------------------------------------------------------------------
+// TESTING INVOKE(f, t1, t2, ..., tN)
+// - Bullet 1 -- (t1.*f)(t2, ..., tN)
+// - Bullet 2 -- (t1.get().*f)(t2, ..., tN) // t1 is a reference_wrapper
+// - Bullet 3 -- ((*t1).*f)(t2, ..., tN)
+//
+// Overview:
+// Bullets 1, 2 and 3 handle the case where 'f' is a pointer to member function.
+// Bullet 1 only handles the cases where t1 is an object of type T or a
+// type derived from 'T'. Bullet 2 handles the case where 't1' is a reference
+// wrapper and bullet 3 handles all other cases.
+//
+// Concerns:
+// 1) cv-qualified member function signatures are accepted.
+// 2) reference qualified member function signatures are accepted.
+// 3) member functions with varargs at the end are accepted.
+// 4) The arguments are perfect forwarded to the member function call.
+// 5) Classes that are publicly derived from 'T' are accepted as the call object
+// 6) All types that dereference to T or a type derived from T can be used
+// as the call object.
+// 7) Pointers to T or a type derived from T can be used as the call object.
+// 8) Reference return types are properly deduced.
+// 9) reference_wrappers are properly handled and unwrapped.
+//
+//
+// Plan:
+// 1) Create a class that contains a set, 'S', of non-static functions.
+// 'S' should include functions that cover every single combination
+// of qualifiers and varargs for arities of 0, 1 and 2 (C-1,2,3).
+// The argument types used in the functions should be non-copyable (C-4).
+// The functions should return 'MethodID::setUncheckedCall()'.
+//
+// 2) Create a set of supported call object, 'Objs', of different types
+// and behaviors. (C-5,6,7)
+//
+// 3) Attempt to call each function, 'f', in 'S' with each call object, 'c',
+// in 'Objs'. After every attempted call to 'f' check that 'f' was
+// actually called using 'MethodID::checkCalled(<return-value>)'
+//
+// 3b) If 'f' is reference qualified call 'f' with the properly qualified
+// call object. Otherwise call 'f' with lvalue call objects.
+//
+// 3a) If 'f' is const, volatile, or cv qualified then call it with call
+// objects that are equally or less cv-qualified.
+
+#include <functional>
+#include <cassert>
+#include <type_traits>
+#include <utility>
+
+#include "test_macros.h"
+#include "invoke_helpers.h"
+
+//==============================================================================
+// MemFun03 - C++03 compatible set of test member functions.
+struct MemFun03 {
+ typedef void*& R;
+#define F(...) \
+ R f(__VA_ARGS__) { return MethodID<R(MemFun03::*)(__VA_ARGS__)>::setUncheckedCall(); } \
+ R f(__VA_ARGS__) const { return MethodID<R(MemFun03::*)(__VA_ARGS__) const>::setUncheckedCall(); } \
+ R f(__VA_ARGS__) volatile { return MethodID<R(MemFun03::*)(__VA_ARGS__) volatile>::setUncheckedCall(); } \
+ R f(__VA_ARGS__) const volatile { return MethodID<R(MemFun03::*)(__VA_ARGS__) const volatile>::setUncheckedCall(); }
+#
+ F()
+ F(...)
+ F(ArgType&)
+ F(ArgType&, ...)
+ F(ArgType&, ArgType&)
+ F(ArgType&, ArgType&, ...)
+ F(ArgType&, ArgType&, ArgType&)
+ F(ArgType&, ArgType&, ArgType&, ...)
+#undef F
+public:
+ MemFun03() {}
+private:
+ MemFun03(MemFun03 const&);
+ MemFun03& operator=(MemFun03 const&);
+};
+
+
+#if TEST_STD_VER >= 11
+
+//==============================================================================
+// MemFun11 - C++11 reference qualified test member functions.
+struct MemFun11 {
+ typedef void*& R;
+ typedef MemFun11 C;
+#define F(...) \
+ R f(__VA_ARGS__) & { return MethodID<R(C::*)(__VA_ARGS__) &>::setUncheckedCall(); } \
+ R f(__VA_ARGS__) const & { return MethodID<R(C::*)(__VA_ARGS__) const &>::setUncheckedCall(); } \
+ R f(__VA_ARGS__) volatile & { return MethodID<R(C::*)(__VA_ARGS__) volatile &>::setUncheckedCall(); } \
+ R f(__VA_ARGS__) const volatile & { return MethodID<R(C::*)(__VA_ARGS__) const volatile &>::setUncheckedCall(); } \
+ R f(__VA_ARGS__) && { return MethodID<R(C::*)(__VA_ARGS__) &&>::setUncheckedCall(); } \
+ R f(__VA_ARGS__) const && { return MethodID<R(C::*)(__VA_ARGS__) const &&>::setUncheckedCall(); } \
+ R f(__VA_ARGS__) volatile && { return MethodID<R(C::*)(__VA_ARGS__) volatile &&>::setUncheckedCall(); } \
+ R f(__VA_ARGS__) const volatile && { return MethodID<R(C::*)(__VA_ARGS__) const volatile &&>::setUncheckedCall(); }
+#
+ F()
+ F(...)
+ F(ArgType&&)
+ F(ArgType&&, ...)
+ F(ArgType&&, ArgType&&)
+ F(ArgType&&, ArgType&&, ...)
+ F(ArgType&&, ArgType&&, ArgType&&)
+ F(ArgType&&, ArgType&&, ArgType&&, ...)
+#undef F
+public:
+ MemFun11() {}
+private:
+ MemFun11(MemFun11 const&);
+ MemFun11& operator=(MemFun11 const&);
+};
+
+#endif // TEST_STD_VER >= 11
+
+
+
+//==============================================================================
+// TestCase - A test case for a single member function.
+// ClassType - The type of the class being tested.
+// CallSig - The function signature of the method being tested.
+// Arity - the arity of 'CallSig'
+// CV - the cv qualifiers of 'CallSig' represented as a type tag.
+// RValue - The method is RValue qualified.
+// ArgRValue - Call the method with RValue arguments.
+template <class ClassType, class CallSig, int Arity, class CV,
+ bool RValue = false, bool ArgRValue = false>
+struct TestCaseImp {
+public:
+
+ static void run() { TestCaseImp().doTest(); }
+
+private:
+ //==========================================================================
+ // TEST DISPATCH
+ void doTest() {
+ // (Plan-2) Create test call objects.
+ typedef ClassType T;
+ typedef DerivedFromType<T> D;
+ T obj;
+ T* obj_ptr = &obj;
+ D der;
+ D* der_ptr = &der;
+ DerefToType<T> dref;
+ DerefPropType<T> dref2;
+ std::reference_wrapper<T> rref(obj);
+ std::reference_wrapper<D> drref(der);
+
+ // (Plan-3) Dispatch based on the CV tags.
+ CV tag;
+ Bool<!RValue> NotRValue;
+ runTestDispatch(tag, obj);
+ runTestDispatch(tag, der);
+ runTestDispatch(tag, dref2);
+ runTestDispatchIf(NotRValue, tag, dref);
+ runTestDispatchIf(NotRValue, tag, obj_ptr);
+ runTestDispatchIf(NotRValue, tag, der_ptr);
+#if TEST_STD_VER >= 11
+ runTestDispatchIf(NotRValue, tag, rref);
+ runTestDispatchIf(NotRValue, tag, drref);
+#endif
+ }
+
+ template <class QT, class Tp>
+ void runTestDispatchIf(Bool<true>, QT q, Tp& v) {
+ runTestDispatch(q, v);
+ }
+
+ template <class QT, class Tp>
+ void runTestDispatchIf(Bool<false>, QT, Tp&) {
+ }
+
+ template <class Tp>
+ void runTestDispatch(Q_None, Tp& v) {
+ runTest(v);
+ }
+
+ template <class Tp>
+ void runTestDispatch(Q_Const, Tp& v) {
+ runTest(v);
+ runTest(makeConst(v));
+ }
+
+ template <class Tp>
+ void runTestDispatch(Q_Volatile, Tp& v) {
+ runTest(v);
+ runTest(makeVolatile(v));
+
+ }
+
+ template <class Tp>
+ void runTestDispatch(Q_CV, Tp& v) {
+ runTest(v);
+ runTest(makeConst(v));
+ runTest(makeVolatile(v));
+ runTest(makeCV(v));
+ }
+
+ template <class T>
+ void runTest(const std::reference_wrapper<T>& obj) {
+ typedef Caster<Q_None, RValue> SCast;
+ typedef Caster<Q_None, ArgRValue> ACast;
+ typedef CallSig (ClassType::*MemPtr);
+ // Delegate test to logic in invoke_helpers.h
+ BasicTest<MethodID<MemPtr>, Arity, SCast, ACast> b;
+ b.runTest( (MemPtr)&ClassType::f, obj);
+ }
+
+ template <class T>
+ void runTest(T* obj) {
+ typedef Caster<Q_None, RValue> SCast;
+ typedef Caster<Q_None, ArgRValue> ACast;
+ typedef CallSig (ClassType::*MemPtr);
+ // Delegate test to logic in invoke_helpers.h
+ BasicTest<MethodID<MemPtr>, Arity, SCast, ACast> b;
+ b.runTest( (MemPtr)&ClassType::f, obj);
+ }
+
+ template <class Obj>
+ void runTest(Obj& obj) {
+ typedef Caster<Q_None, RValue> SCast;
+ typedef Caster<Q_None, ArgRValue> ACast;
+ typedef CallSig (ClassType::*MemPtr);
+ // Delegate test to logic in invoke_helpers.h
+ BasicTest<MethodID<MemPtr>, Arity, SCast, ACast> b;
+ b.runTest( (MemPtr)&ClassType::f, obj);
+ }
+};
+
+template <class Sig, int Arity, class CV>
+struct TestCase : public TestCaseImp<MemFun03, Sig, Arity, CV> {};
+
+#if TEST_STD_VER >= 11
+template <class Sig, int Arity, class CV, bool RValue = false>
+struct TestCase11 : public TestCaseImp<MemFun11, Sig, Arity, CV, RValue, true> {};
+
+template <class Type>
+struct ReferenceWrapper {
+ using type = Type;
+ Type* ptr;
+
+ static void fun(Type&) noexcept;
+ static void fun(Type&&) = delete;
+
+ template <class Type2,
+ class = typename std::enable_if<!std::__is_same_uncvref<Type2, ReferenceWrapper>::value>::type>
+ constexpr ReferenceWrapper(Type2&& t) noexcept : ptr(&t) {}
+
+ constexpr Type& get() const noexcept { return *ptr; }
+ constexpr operator Type&() const noexcept { return *ptr; }
+
+ template <class... _ArgTypes>
+ constexpr std::__invoke_result_t<Type&, _ArgTypes...> operator()(_ArgTypes&&... __args) const {
+ return std::__invoke(get(), std::forward<_ArgTypes>(__args)...);
+ }
+};
+
+template <class Tp>
+struct DerivedFromRefWrap : public ReferenceWrapper<Tp> {
+ constexpr DerivedFromRefWrap(Tp& tp) : ReferenceWrapper<Tp>(tp) {}
+};
+
+TEST_CONSTEXPR_CXX14 bool test_derived_from_ref_wrap() {
+ int x = 42;
+ ReferenceWrapper<int> r(x);
+ DerivedFromRefWrap<int> d(x);
+ auto get_fn = &ReferenceWrapper<int>::get;
+ auto& ret = std::__invoke(get_fn, r);
+ assert(&ret == &x);
+ auto& ret2 = std::__invoke(get_fn, d);
+ assert(&ret2 == &x);
+
+ return true;
+}
+
+TEST_CONSTEXPR_CXX20 bool test_reference_wrapper_reference_wrapper() {
+ int x = 42;
+ auto get_fn = &std::reference_wrapper<int>::get;
+ std::reference_wrapper<int> r(x);
+ std::reference_wrapper<std::reference_wrapper<int>> r2(r);
+ auto& ret3 = std::__invoke(get_fn, r2);
+ assert(&ret3 == &x);
+
+ return true;
+}
+#endif
+
+int main(int, char**) {
+ typedef void*& R;
+ typedef ArgType A;
+ TestCase<R(), 0, Q_None>::run();
+ TestCase<R() const, 0, Q_Const>::run();
+ TestCase<R() volatile, 0, Q_Volatile>::run();
+ TestCase<R() const volatile, 0, Q_CV>::run();
+ TestCase<R(...), 0, Q_None>::run();
+ TestCase<R(...) const, 0, Q_Const>::run();
+ TestCase<R(...) volatile, 0, Q_Volatile>::run();
+ TestCase<R(...) const volatile, 0, Q_CV>::run();
+ TestCase<R(A&), 1, Q_None>::run();
+ TestCase<R(A&) const, 1, Q_Const>::run();
+ TestCase<R(A&) volatile, 1, Q_Volatile>::run();
+ TestCase<R(A&) const volatile, 1, Q_CV>::run();
+ TestCase<R(A&, ...), 1, Q_None>::run();
+ TestCase<R(A&, ...) const, 1, Q_Const>::run();
+ TestCase<R(A&, ...) volatile, 1, Q_Volatile>::run();
+ TestCase<R(A&, ...) const volatile, 1, Q_CV>::run();
+ TestCase<R(A&, A&), 2, Q_None>::run();
+ TestCase<R(A&, A&) const, 2, Q_Const>::run();
+ TestCase<R(A&, A&) volatile, 2, Q_Volatile>::run();
+ TestCase<R(A&, A&) const volatile, 2, Q_CV>::run();
+ TestCase<R(A&, A&, ...), 2, Q_None>::run();
+ TestCase<R(A&, A&, ...) const, 2, Q_Const>::run();
+ TestCase<R(A&, A&, ...) volatile, 2, Q_Volatile>::run();
+ TestCase<R(A&, A&, ...) const volatile, 2, Q_CV>::run();
+ TestCase<R(A&, A&, A&), 3, Q_None>::run();
+ TestCase<R(A&, A&, A&) const, 3, Q_Const>::run();
+ TestCase<R(A&, A&, A&) volatile, 3, Q_Volatile>::run();
+ TestCase<R(A&, A&, A&) const volatile, 3, Q_CV>::run();
+ TestCase<R(A&, A&, A&, ...), 3, Q_None>::run();
+ TestCase<R(A&, A&, A&, ...) const, 3, Q_Const>::run();
+ TestCase<R(A&, A&, A&, ...) volatile, 3, Q_Volatile>::run();
+ TestCase<R(A&, A&, A&, ...) const volatile, 3, Q_CV>::run();
+
+#if TEST_STD_VER >= 11
+ TestCase11<R() &, 0, Q_None>::run();
+ TestCase11<R() const &, 0, Q_Const>::run();
+ TestCase11<R() volatile &, 0, Q_Volatile>::run();
+ TestCase11<R() const volatile &, 0, Q_CV>::run();
+ TestCase11<R(...) &, 0, Q_None>::run();
+ TestCase11<R(...) const &, 0, Q_Const>::run();
+ TestCase11<R(...) volatile &, 0, Q_Volatile>::run();
+ TestCase11<R(...) const volatile &, 0, Q_CV>::run();
+ TestCase11<R(A&&) &, 1, Q_None>::run();
+ TestCase11<R(A&&) const &, 1, Q_Const>::run();
+ TestCase11<R(A&&) volatile &, 1, Q_Volatile>::run();
+ TestCase11<R(A&&) const volatile &, 1, Q_CV>::run();
+ TestCase11<R(A&&, ...) &, 1, Q_None>::run();
+ TestCase11<R(A&&, ...) const &, 1, Q_Const>::run();
+ TestCase11<R(A&&, ...) volatile &, 1, Q_Volatile>::run();
+ TestCase11<R(A&&, ...) const volatile &, 1, Q_CV>::run();
+ TestCase11<R(A&&, A&&) &, 2, Q_None>::run();
+ TestCase11<R(A&&, A&&) const &, 2, Q_Const>::run();
+ TestCase11<R(A&&, A&&) volatile &, 2, Q_Volatile>::run();
+ TestCase11<R(A&&, A&&) const volatile &, 2, Q_CV>::run();
+ TestCase11<R(A&&, A&&, ...) &, 2, Q_None>::run();
+ TestCase11<R(A&&, A&&, ...) const &, 2, Q_Const>::run();
+ TestCase11<R(A&&, A&&, ...) volatile &, 2, Q_Volatile>::run();
+ TestCase11<R(A&&, A&&, ...) const volatile &, 2, Q_CV>::run();
+ TestCase11<R() &&, 0, Q_None, /* RValue */ true>::run();
+ TestCase11<R() const &&, 0, Q_Const, /* RValue */ true>::run();
+ TestCase11<R() volatile &&, 0, Q_Volatile, /* RValue */ true>::run();
+ TestCase11<R() const volatile &&, 0, Q_CV, /* RValue */ true>::run();
+ TestCase11<R(...) &&, 0, Q_None, /* RValue */ true>::run();
+ TestCase11<R(...) const &&, 0, Q_Const, /* RValue */ true>::run();
+ TestCase11<R(...) volatile &&, 0, Q_Volatile, /* RValue */ true>::run();
+ TestCase11<R(...) const volatile &&, 0, Q_CV, /* RValue */ true>::run();
+ TestCase11<R(A&&) &&, 1, Q_None, /* RValue */ true>::run();
+ TestCase11<R(A&&) const &&, 1, Q_Const, /* RValue */ true>::run();
+ TestCase11<R(A&&) volatile &&, 1, Q_Volatile, /* RValue */ true>::run();
+ TestCase11<R(A&&) const volatile &&, 1, Q_CV, /* RValue */ true>::run();
+ TestCase11<R(A&&, ...) &&, 1, Q_None, /* RValue */ true>::run();
+ TestCase11<R(A&&, ...) const &&, 1, Q_Const, /* RValue */ true>::run();
+ TestCase11<R(A&&, ...) volatile &&, 1, Q_Volatile, /* RValue */ true>::run();
+ TestCase11<R(A&&, ...) const volatile &&, 1, Q_CV, /* RValue */ true>::run();
+ TestCase11<R(A&&, A&&) &&, 2, Q_None, /* RValue */ true>::run();
+ TestCase11<R(A&&, A&&) const &&, 2, Q_Const, /* RValue */ true>::run();
+ TestCase11<R(A&&, A&&) volatile &&, 2, Q_Volatile, /* RValue */ true>::run();
+ TestCase11<R(A&&, A&&) const volatile &&, 2, Q_CV, /* RValue */ true>::run();
+ TestCase11<R(A&&, A&&, ...) &&, 2, Q_None, /* RValue */ true>::run();
+ TestCase11<R(A&&, A&&, ...) const &&, 2, Q_Const, /* RValue */ true>::run();
+ TestCase11<R(A&&, A&&, ...) volatile &&, 2, Q_Volatile, /* RValue */ true>::run();
+ TestCase11<R(A&&, A&&, ...) const volatile &&, 2, Q_CV, /* RValue */ true>::run();
+ TestCase11<R(A&&, A&&, A&&) &&, 3, Q_None, /* RValue */ true>::run();
+ TestCase11<R(A&&, A&&, A&&) const &&, 3, Q_Const, /* RValue */ true>::run();
+ TestCase11<R(A&&, A&&, A&&) volatile &&, 3, Q_Volatile, /* RValue */ true>::run();
+ TestCase11<R(A&&, A&&, A&&) const volatile &&, 3, Q_CV, /* RValue */ true>::run();
+ TestCase11<R(A&&, A&&, A&&, ...) &&, 3, Q_None, /* RValue */ true>::run();
+ TestCase11<R(A&&, A&&, A&&, ...) const &&, 3, Q_Const, /* RValue */ true>::run();
+ TestCase11<R(A&&, A&&, A&&, ...) volatile &&, 3, Q_Volatile, /* RValue */ true>::run();
+ TestCase11<R(A&&, A&&, A&&, ...) const volatile &&, 3, Q_CV, /* RValue */ true>::run();
+
+ test_derived_from_ref_wrap();
+ test_reference_wrapper_reference_wrapper();
+#if TEST_STD_VER > 11
+ static_assert(test_derived_from_ref_wrap(), "");
+#endif
+#if TEST_STD_VER > 17
+ static_assert(test_reference_wrapper_reference_wrapper(), "");
+#endif
+#endif // TEST_STD_VER >= 11
+
+ return 0;
+}
diff --git a/libcxx/test/libcxx-03/utilities/function.objects/func.require/bullet_4_5_6.pass.cpp b/libcxx/test/libcxx-03/utilities/function.objects/func.require/bullet_4_5_6.pass.cpp
new file mode 100644
index 0000000000000..0df59290824bb
--- /dev/null
+++ b/libcxx/test/libcxx-03/utilities/function.objects/func.require/bullet_4_5_6.pass.cpp
@@ -0,0 +1,210 @@
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// FIXME(EricWF): Make this test pass in C++03 with Clang once the transition
+// has gotten far enough that __invoke works.
+// XFAIL: c++03
+
+// <functional>
+
+// INVOKE (f, t1, t2, ..., tN)
+
+//------------------------------------------------------------------------------
+// TESTING INVOKE(f, t1, t2, ..., tN)
+// - Bullet 4 -- t1.*f
+// - Bullet 5 -- t1.get().*f // t1 is a reference wrapper.
+// - Bullet 6 -- (*t1).*f
+//
+// Overview:
+// Bullets 4, 5 and 6 handle the case where 'f' is a pointer to member object.
+// Bullet 4 only handles the cases where t1 is an object of type T or a
+// type derived from 'T'. Bullet 5 handles cases where 't1' is a reference_wrapper
+// and bullet 6 handles all other cases.
+//
+// Concerns:
+// 1) The return type is always an lvalue reference.
+// 2) The return type is not less cv-qualified that the object that contains it.
+// 3) The return type is not less cv-qualified than object type.
+// 4) The call object is perfectly forwarded.
+// 5) Classes that are publicly derived from 'T' are accepted as the call object
+// 6) All types that dereference to T or a type derived from T can be used
+// as the call object.
+// 7) Pointers to T or a type derived from T can be used as the call object.
+// 8) reference_wrapper's are properly unwrapped before invoking the function.
+
+#include <functional>
+#include <cassert>
+#include <type_traits>
+#include <utility>
+
+#include "test_macros.h"
+#include "invoke_helpers.h"
+
+template <class Tp>
+struct TestMemberObject {
+ TestMemberObject() : object() {}
+ Tp object;
+private:
+ TestMemberObject(TestMemberObject const&);
+ TestMemberObject& operator=(TestMemberObject const&);
+};
+
+template <class ObjectType>
+struct TestCase {
+ public:
+
+ static void run() { TestCase().doTest(); }
+
+private:
+ typedef TestMemberObject<ObjectType> TestType;
+
+ //==========================================================================
+ // TEST DISPATCH
+ void doTest() {
+ typedef DerivedFromType<TestType> Derived;
+ TestType obj;
+ TestType* obj_ptr = &obj;
+ Derived der;
+ Derived* der_ptr = &der;
+ DerefToType<TestType> dref;
+ DerefPropType<TestType> dref2;
+ std::reference_wrapper<TestType> rref(obj);
+ std::reference_wrapper<Derived> drref(der);
+
+ {
+ typedef ObjectType (TestType::*MemPtr);
+ typedef ObjectType E;
+ MemPtr M = &TestType::object;
+ runTestDispatch<E>(M, obj, &obj.object);
+ runTestDispatch<E>(M, der, &der.object);
+ runTestDispatch<E>(M, dref2, &dref2.object.object);
+ runTestPropCVDispatch<E>(M, obj_ptr, &obj_ptr->object);
+ runTestPropCVDispatch<E>(M, der_ptr, &der_ptr->object);
+#if TEST_STD_VER >= 11
+ runTestPropCVDispatch<E>(M, rref, &(rref.get().object));
+ runTestPropCVDispatch<E>(M, drref, &(drref.get().object));
+#endif
+ runTestNoPropDispatch<E>(M, dref, &dref.object.object);
+ }
+ {
+ typedef ObjectType const (TestType::*CMemPtr);
+ typedef ObjectType const E;
+ CMemPtr M = &TestType::object;
+ runTestDispatch<E>(M, obj, &obj.object);
+ runTestDispatch<E>(M, der, &der.object);
+ runTestDispatch<E>(M, dref2, &dref2.object.object);
+ runTestPropCVDispatch<E>(M, obj_ptr, &obj_ptr->object);
+ runTestPropCVDispatch<E>(M, der_ptr, &der_ptr->object);
+#if TEST_STD_VER >= 11
+ runTestPropCVDispatch<E>(M, rref, &(rref.get().object));
+ runTestPropCVDispatch<E>(M, drref, &(drref.get().object));
+#endif
+ runTestNoPropDispatch<E>(M, dref, &dref.object.object);
+ }
+ {
+ typedef ObjectType volatile (TestType::*VMemPtr);
+ typedef ObjectType volatile E;
+ VMemPtr M = &TestType::object;
+ runTestDispatch<E>(M, obj, &obj.object);
+ runTestDispatch<E>(M, der, &der.object);
+ runTestDispatch<E>(M, dref2, &dref2.object.object);
+ runTestPropCVDispatch<E>(M, obj_ptr, &obj_ptr->object);
+ runTestPropCVDispatch<E>(M, der_ptr, &der_ptr->object);
+#if TEST_STD_VER >= 11
+ runTestPropCVDispatch<E>(M, rref, &(rref.get().object));
+ runTestPropCVDispatch<E>(M, drref, &(drref.get().object));
+#endif
+ runTestNoPropDispatch<E>(M, dref, &dref.object.object);
+ }
+ {
+ typedef ObjectType const volatile (TestType::*CVMemPtr);
+ typedef ObjectType const volatile E;
+ CVMemPtr M = &TestType::object;
+ runTestDispatch<E>(M, obj, &obj.object);
+ runTestDispatch<E>(M, der, &der.object);
+ runTestDispatch<E>(M, dref2, &dref2.object.object);
+ runTestPropCVDispatch<E>(M, obj_ptr, &obj_ptr->object);
+ runTestPropCVDispatch<E>(M, der_ptr, &der_ptr->object);
+#if TEST_STD_VER >= 11
+ runTestPropCVDispatch<E>(M, rref, &(rref.get().object));
+ runTestPropCVDispatch<E>(M, drref, &(drref.get().object));
+#endif
+ runTestNoPropDispatch<E>(M, dref, &dref.object.object);
+ }
+ }
+
+ template <class Expect, class Fn, class T>
+ void runTestDispatch(Fn M, T& obj, ObjectType* expect) {
+ runTest<Expect &> (M, C_<T&>(obj), expect);
+ runTest<Expect const&> (M, C_<T const&>(obj), expect);
+ runTest<Expect volatile&> (M, C_<T volatile&>(obj), expect);
+ runTest<Expect const volatile&>(M, C_<T const volatile&>(obj), expect);
+#if TEST_STD_VER >= 11
+ runTest<Expect&&> (M, C_<T&&>(obj), expect);
+ runTest<Expect const&&> (M, C_<T const&&>(obj), expect);
+ runTest<Expect volatile&&> (M, C_<T volatile&&>(obj), expect);
+ runTest<Expect const volatile&&>(M, C_<T const volatile&&>(obj), expect);
+#endif
+ }
+
+ template <class Expect, class Fn, class T>
+ void runTestPropCVDispatch(Fn M, T& obj, ObjectType* expect) {
+ runTest<Expect &> (M, obj, expect);
+ runTest<Expect const&> (M, makeConst(obj), expect);
+ runTest<Expect volatile&> (M, makeVolatile(obj), expect);
+ runTest<Expect const volatile&>(M, makeCV(obj), expect);
+ }
+
+ template <class Expect, class Fn, class T>
+ void runTestNoPropDispatch(Fn M, T& obj, ObjectType* expect) {
+ runTest<Expect&>(M, C_<T &>(obj), expect);
+ runTest<Expect&>(M, C_<T const&>(obj), expect);
+ runTest<Expect&>(M, C_<T volatile&>(obj), expect);
+ runTest<Expect&>(M, C_<T const volatile&>(obj), expect);
+#if TEST_STD_VER >= 11
+ runTest<Expect&>(M, C_<T&&>(obj), expect);
+ runTest<Expect&>(M, C_<T const&&>(obj), expect);
+ runTest<Expect&>(M, C_<T volatile&&>(obj), expect);
+ runTest<Expect&>(M, C_<T const volatile&&>(obj), expect);
+#endif
+ }
+
+ template <class Expect, class Fn, class T>
+ void runTest(Fn M, const T& obj, ObjectType* expect) {
+ static_assert((std::is_same<
+ decltype(std::__invoke(M, obj)), Expect
+ >::value), "");
+ Expect e = std::__invoke(M, obj);
+ assert(&e == expect);
+ }
+
+ template <class Expect, class Fn, class T>
+#if TEST_STD_VER >= 11
+ void runTest(Fn M, T&& obj, ObjectType* expect) {
+#else
+ void runTest(Fn M, T& obj, ObjectType* expect ) {
+#endif
+ {
+ static_assert((std::is_same<
+ decltype(std::__invoke(M, std::forward<T>(obj))), Expect
+ >::value), "");
+ Expect e = std::__invoke(M, std::forward<T>(obj));
+ assert(&e == expect);
+ }
+ }
+};
+
+int main(int, char**) {
+ TestCase<ArgType>::run();
+ TestCase<ArgType const>::run();
+ TestCase<ArgType volatile>::run();
+ TestCase<ArgType const volatile>::run();
+ TestCase<ArgType*>::run();
+
+ return 0;
+}
diff --git a/libcxx/test/libcxx-03/utilities/function.objects/func.require/bullet_7.pass.cpp b/libcxx/test/libcxx-03/utilities/function.objects/func.require/bullet_7.pass.cpp
new file mode 100644
index 0000000000000..fb789fa0a86cc
--- /dev/null
+++ b/libcxx/test/libcxx-03/utilities/function.objects/func.require/bullet_7.pass.cpp
@@ -0,0 +1,328 @@
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// <functional>
+
+// INVOKE (f, t1, t2, ..., tN)
+
+//------------------------------------------------------------------------------
+// TESTING INVOKE(f, t1, t2, ..., tN)
+// - Bullet 7 -- f(t2, ..., tN)
+//
+// Overview:
+// Bullet 7 handles the cases where the first argument is not a member
+// function.
+//
+// Concerns:
+// 1) Different types of callable objects are supported. Including
+// 1a) Free Function pointers and references.
+// 1b) Classes which provide a call operator
+// 1c) lambdas
+// 2) The callable objects are perfect forwarded.
+// 3) The arguments are perfect forwarded.
+// 4) Signatures which include varargs are supported.
+// 5) In C++03 3 extra arguments should be allowed.
+//
+// Plan:
+// 1) Define a set of free functions, 'SF', and class types with call
+// operators, 'SC', that address concerns 4 and 5. The free functions should
+// return 'FunctionID::setUncheckedCall()' and the call operators should
+// return 'MethodID::setUncheckedCall()'.
+//
+// 2) For each function 'f' in 'SF' and 'SC' attempt to call 'f'
+// using the correct number of arguments and cv-ref qualifiers. Check that
+// 'f' has been called using 'FunctionID::checkCall()' if 'f' is a free
+// function and 'MethodID::checkCall()' otherwise.
+
+
+
+#include <functional>
+#include <type_traits>
+#include <cassert>
+
+#include "test_macros.h"
+#include "invoke_helpers.h"
+
+
+//==============================================================================
+// freeFunction03 - A C++03 free function.
+void*& freeFunction03() {
+ return FunctionPtrID<void*&(), freeFunction03>::setUncheckedCall();
+}
+
+void*& freeFunction03(...) {
+ return FunctionPtrID<void*&(...), freeFunction03>::setUncheckedCall();
+}
+
+template <class A0>
+void*& freeFunction03(A0&) {
+ return FunctionPtrID<void*&(A0&), freeFunction03>::setUncheckedCall();
+}
+
+
+template <class A0>
+void*& freeFunction03(A0&, ...) {
+ return FunctionPtrID<void*&(A0&, ...), freeFunction03>::setUncheckedCall();
+}
+
+template <class A0, class A1>
+void*& freeFunction03(A0&, A1&) {
+ return FunctionPtrID<void*&(A0&, A1&), freeFunction03>::setUncheckedCall();
+}
+
+
+template <class A0, class A1>
+void*& freeFunction03(A0&, A1&, ...) {
+ return FunctionPtrID<void*&(A0&, A1&, ...), freeFunction03>::setUncheckedCall();
+}
+
+template <class A0, class A1, class A2>
+void*& freeFunction03(A0&, A1&, A2&) {
+ return FunctionPtrID<void*&(A0&, A1&, A2&), freeFunction03>::setUncheckedCall();
+}
+
+template <class A0, class A1, class A2>
+void*& freeFunction03(A0&, A1&, A2&, ...) {
+ return FunctionPtrID<void*&(A0&, A1&, A2&, ...), freeFunction03>::setUncheckedCall();
+}
+
+//==============================================================================
+// Functor03 - C++03 compatible functor object
+struct Functor03 {
+ typedef void*& R;
+ typedef Functor03 C;
+#define F(Args, ...) \
+ __VA_ARGS__ R operator() Args { return MethodID<R(C::*) Args>::setUncheckedCall(); } \
+ __VA_ARGS__ R operator() Args const { return MethodID<R(C::*) Args const>::setUncheckedCall(); } \
+ __VA_ARGS__ R operator() Args volatile { return MethodID<R(C::*) Args volatile>::setUncheckedCall(); } \
+ __VA_ARGS__ R operator() Args const volatile { return MethodID<R(C::*) Args const volatile>::setUncheckedCall(); }
+#
+ F(())
+ F((A0&), template <class A0>)
+ F((A0&, A1&), template <class A0, class A1>)
+ F((A0&, A1&, A2&), template <class A0, class A1, class A2>)
+#undef F
+public:
+ Functor03() {}
+private:
+ Functor03(Functor03 const&);
+ Functor03& operator=(Functor03 const&);
+};
+
+
+#if TEST_STD_VER >= 11
+
+//==============================================================================
+// freeFunction11 - A C++11 free function.
+template <class ...Args>
+void*& freeFunction11(Args&&...) {
+ return FunctionPtrID<void*&(Args&&...), freeFunction11>::setUncheckedCall();
+}
+
+template <class ...Args>
+void*& freeFunction11(Args&&...,...) {
+ return FunctionPtrID<void*&(Args&&...,...), freeFunction11>::setUncheckedCall();
+}
+
+//==============================================================================
+// Functor11 - C++11 reference qualified test member functions.
+struct Functor11 {
+ typedef void*& R;
+ typedef Functor11 C;
+
+#define F(CV) \
+ template <class ...Args> \
+ R operator()(Args&&...) CV { return MethodID<R(C::*)(Args&&...) CV>::setUncheckedCall(); }
+#
+ F(&)
+ F(const &)
+ F(volatile &)
+ F(const volatile &)
+ F(&&)
+ F(const &&)
+ F(volatile &&)
+ F(const volatile &&)
+#undef F
+public:
+ Functor11() {}
+private:
+ Functor11(Functor11 const&);
+ Functor11& operator=(Functor11 const&);
+};
+
+#endif // TEST_STD_VER >= 11
+
+
+//==============================================================================
+// TestCaseFunctorImp - A test case for an operator() class method.
+// ClassType - The type of the call object.
+// CallSig - The function signature of the call operator being tested.
+// Arity - the arity of 'CallSig'
+// ObjCaster - Transformation function applied to call object.
+// ArgCaster - Transformation function applied to the extra arguments.
+template <class ClassType, class CallSig, int Arity,
+ class ObjCaster, class ArgCaster = LValueCaster>
+struct TestCaseFunctorImp {
+public:
+ static void run() {
+ typedef MethodID<CallSig ClassType::*> MID;
+ BasicTest<MID, Arity, ObjCaster, ArgCaster> t;
+ typedef ClassType T;
+ typedef DerivedFromType<T> D;
+ T obj;
+ D der;
+ t.runTest(obj);
+ t.runTest(der);
+ }
+};
+
+//==============================================================================
+// TestCaseFreeFunction - A test case for a free function.
+// CallSig - The function signature of the free function being tested.
+// FnPtr - The function being tested.
+// Arity - the arity of 'CallSig'
+// ArgCaster - Transformation function to be applied to the extra arguments.
+template <class CallSig, CallSig* FnPtr, int Arity, class ArgCaster>
+struct TestCaseFreeFunction {
+public:
+ static void run() {
+ typedef FunctionPtrID<CallSig, FnPtr> FID;
+ BasicTest<FID, Arity, LValueCaster, ArgCaster> t;
+
+ DerefToType<CallSig*> deref_to(FnPtr);
+ DerefToType<CallSig&> deref_to_ref(*FnPtr);
+
+ t.runTest(FnPtr);
+ t.runTest(*FnPtr);
+ t.runTest(deref_to);
+ t.runTest(deref_to_ref);
+ }
+};
+
+//==============================================================================
+// runTest Helpers
+//==============================================================================
+#if TEST_STD_VER >= 11
+template <class Sig, int Arity, class ArgCaster>
+void runFunctionTestCase11() {
+ TestCaseFreeFunction<Sig, freeFunction11, Arity, ArgCaster>();
+}
+#endif
+
+template <class Sig, int Arity, class ArgCaster>
+void runFunctionTestCase() {
+ TestCaseFreeFunction<Sig, freeFunction03, Arity, ArgCaster>();
+#if TEST_STD_VER >= 11
+ runFunctionTestCase11<Sig, Arity, ArgCaster>();
+#endif
+}
+
+template <class Sig, int Arity, class ObjCaster, class ArgCaster>
+void runFunctorTestCase() {
+ TestCaseFunctorImp<Functor03, Sig, Arity, ObjCaster, ArgCaster>::run();
+}
+
+template <class Sig, int Arity, class ObjCaster>
+void runFunctorTestCase() {
+ TestCaseFunctorImp<Functor03, Sig, Arity, ObjCaster>::run();
+}
+
+#if TEST_STD_VER >= 11
+// runTestCase - Run a test case for C++11 class functor types
+template <class Sig, int Arity, class ObjCaster, class ArgCaster = LValueCaster>
+void runFunctorTestCase11() {
+ TestCaseFunctorImp<Functor11, Sig, Arity, ObjCaster, ArgCaster>::run();
+}
+#endif
+
+// runTestCase - Run a test case for both function and functor types.
+template <class Sig, int Arity, class ArgCaster>
+void runTestCase() {
+ runFunctionTestCase<Sig, Arity, ArgCaster>();
+ runFunctorTestCase <Sig, Arity, LValueCaster, ArgCaster>();
+};
+
+int main(int, char**) {
+ typedef void*& R;
+ typedef ArgType A;
+ typedef A const CA;
+
+ runTestCase< R(), 0, LValueCaster >();
+ runTestCase< R(A&), 1, LValueCaster >();
+ runTestCase< R(A&, A&), 2, LValueCaster >();
+ runTestCase< R(A&, A&, A&), 3, LValueCaster >();
+ runTestCase< R(CA&), 1, ConstCaster >();
+ runTestCase< R(CA&, CA&), 2, ConstCaster >();
+ runTestCase< R(CA&, CA&, CA&), 3, ConstCaster >();
+
+ runFunctionTestCase<R(...), 0, LValueCaster >();
+ runFunctionTestCase<R(A&, ...), 1, LValueCaster >();
+ runFunctionTestCase<R(A&, A&, ...), 2, LValueCaster >();
+ runFunctionTestCase<R(A&, A&, A&, ...), 3, LValueCaster >();
+
+#if TEST_STD_VER >= 11
+ runFunctionTestCase11<R(A&&), 1, MoveCaster >();
+ runFunctionTestCase11<R(A&&, ...), 1, MoveCaster >();
+#endif
+
+ runFunctorTestCase<R(), 0, LValueCaster >();
+ runFunctorTestCase<R() const, 0, ConstCaster >();
+ runFunctorTestCase<R() volatile, 0, VolatileCaster >();
+ runFunctorTestCase<R() const volatile, 0, CVCaster >();
+ runFunctorTestCase<R(A&), 1, LValueCaster >();
+ runFunctorTestCase<R(A&) const, 1, ConstCaster >();
+ runFunctorTestCase<R(A&) volatile, 1, VolatileCaster >();
+ runFunctorTestCase<R(A&) const volatile, 1, CVCaster >();
+ runFunctorTestCase<R(A&, A&), 2, LValueCaster >();
+ runFunctorTestCase<R(A&, A&) const, 2, ConstCaster >();
+ runFunctorTestCase<R(A&, A&) volatile, 2, VolatileCaster >();
+ runFunctorTestCase<R(A&, A&) const volatile, 2, CVCaster >();
+ runFunctorTestCase<R(A&, A&, A&), 3, LValueCaster >();
+ runFunctorTestCase<R(A&, A&, A&) const, 3, ConstCaster >();
+ runFunctorTestCase<R(A&, A&, A&) volatile, 3, VolatileCaster >();
+ runFunctorTestCase<R(A&, A&, A&) const volatile, 3, CVCaster >();
+ {
+ typedef ConstCaster CC;
+ runFunctorTestCase<R(CA&), 1, LValueCaster, CC>();
+ runFunctorTestCase<R(CA&) const, 1, ConstCaster, CC>();
+ runFunctorTestCase<R(CA&) volatile, 1, VolatileCaster, CC>();
+ runFunctorTestCase<R(CA&) const volatile, 1, CVCaster, CC>();
+ runFunctorTestCase<R(CA&, CA&), 2, LValueCaster, CC>();
+ runFunctorTestCase<R(CA&, CA&) const, 2, ConstCaster, CC>();
+ runFunctorTestCase<R(CA&, CA&) volatile, 2, VolatileCaster, CC>();
+ runFunctorTestCase<R(CA&, CA&) const volatile, 2, CVCaster, CC>();
+ runFunctorTestCase<R(CA&, CA&, CA&), 3, LValueCaster, CC>();
+ runFunctorTestCase<R(CA&, CA&, CA&) const, 3, ConstCaster, CC>();
+ runFunctorTestCase<R(CA&, CA&, CA&) volatile, 3, VolatileCaster, CC>();
+ runFunctorTestCase<R(CA&, CA&, CA&) const volatile, 3, CVCaster, CC>();
+ }
+
+#if TEST_STD_VER >= 11
+ runFunctorTestCase11<R() &, 0, LValueCaster >();
+ runFunctorTestCase11<R() const &, 0, ConstCaster >();
+ runFunctorTestCase11<R() volatile &, 0, VolatileCaster >();
+ runFunctorTestCase11<R() const volatile &, 0, CVCaster >();
+ runFunctorTestCase11<R() &&, 0, MoveCaster >();
+ runFunctorTestCase11<R() const &&, 0, MoveConstCaster >();
+ runFunctorTestCase11<R() volatile &&, 0, MoveVolatileCaster >();
+ runFunctorTestCase11<R() const volatile &&, 0, MoveCVCaster >();
+ {
+ typedef MoveCaster MC;
+ runFunctorTestCase11<R(A&&) &, 1, LValueCaster, MC>();
+ runFunctorTestCase11<R(A&&) const &, 1, ConstCaster, MC>();
+ runFunctorTestCase11<R(A&&) volatile &, 1, VolatileCaster, MC>();
+ runFunctorTestCase11<R(A&&) const volatile &, 1, CVCaster, MC>();
+ runFunctorTestCase11<R(A&&) &&, 1, MoveCaster, MC>();
+ runFunctorTestCase11<R(A&&) const &&, 1, MoveConstCaster, MC>();
+ runFunctorTestCase11<R(A&&) volatile &&, 1, MoveVolatileCaster, MC>();
+ runFunctorTestCase11<R(A&&) const volatile &&, 1, MoveCVCaster, MC>();
+ }
+#endif
+
+ return 0;
+}
diff --git a/libcxx/test/libcxx-03/utilities/function.objects/func.require/invoke.pass.cpp b/libcxx/test/libcxx-03/utilities/function.objects/func.require/invoke.pass.cpp
new file mode 100644
index 0000000000000..e534553a87f04
--- /dev/null
+++ b/libcxx/test/libcxx-03/utilities/function.objects/func.require/invoke.pass.cpp
@@ -0,0 +1,46 @@
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// [func.require]
+
+#include <type_traits>
+#include <functional>
+
+#include "test_macros.h"
+
+template <typename T, int N>
+struct Array
+{
+ typedef T type[N];
+};
+
+struct Type
+{
+ Array<char, 1>::type& f1();
+ Array<char, 2>::type& f2() const;
+#if TEST_STD_VER >= 11
+ Array<char, 1>::type& g1() &;
+ Array<char, 2>::type& g2() const &;
+ Array<char, 3>::type& g3() &&;
+ Array<char, 4>::type& g4() const &&;
+#endif
+};
+
+int main(int, char**)
+{
+ static_assert(sizeof(std::__invoke(&Type::f1, std::declval<Type >())) == 1, "");
+ static_assert(sizeof(std::__invoke(&Type::f2, std::declval<Type const >())) == 2, "");
+#if TEST_STD_VER >= 11
+ static_assert(sizeof(std::__invoke(&Type::g1, std::declval<Type &>())) == 1, "");
+ static_assert(sizeof(std::__invoke(&Type::g2, std::declval<Type const &>())) == 2, "");
+ static_assert(sizeof(std::__invoke(&Type::g3, std::declval<Type &&>())) == 3, "");
+ static_assert(sizeof(std::__invoke(&Type::g4, std::declval<Type const&&>())) == 4, "");
+#endif
+
+ return 0;
+}
diff --git a/libcxx/test/libcxx-03/utilities/function.objects/func.require/invoke_helpers.h b/libcxx/test/libcxx-03/utilities/function.objects/func.require/invoke_helpers.h
new file mode 100644
index 0000000000000..f6f418b51c489
--- /dev/null
+++ b/libcxx/test/libcxx-03/utilities/function.objects/func.require/invoke_helpers.h
@@ -0,0 +1,375 @@
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef INVOKE_HELPERS_H
+#define INVOKE_HELPERS_H
+
+#include <type_traits>
+#include <cassert>
+#include <functional>
+
+#include "test_macros.h"
+
+template <int I>
+struct Int : public std::integral_constant<int, I> {};
+
+template <bool P>
+struct Bool : public std::integral_constant<bool, P> {};
+
+struct Q_None {
+ template <class T>
+ struct apply { typedef T type; };
+};
+
+struct Q_Const {
+ template <class T>
+ struct apply { typedef T const type; };
+};
+
+struct Q_Volatile {
+ template <class T>
+ struct apply { typedef T volatile type; };
+};
+
+struct Q_CV {
+ template <class T>
+ struct apply { typedef T const volatile type; };
+};
+
+// Caster - A functor object that performs cv-qualifier and value category
+// conversions.
+// QualTag - A metafunction type that applies cv-qualifiers to its argument.
+// RValue - True if the resulting object should be an RValue reference.
+// False otherwise.
+template <class QualTag, bool RValue = false>
+struct Caster {
+ template <class T>
+ struct apply {
+ typedef typename std::remove_reference<T>::type RawType;
+ typedef typename QualTag::template apply<RawType>::type CVType;
+#if TEST_STD_VER >= 11
+ typedef typename std::conditional<RValue,
+ CVType&&, CVType&
+ >::type type;
+#else
+ typedef CVType& type;
+#endif
+ };
+
+ template <class T>
+ typename apply<T>::type
+ operator()(T& obj) const {
+ typedef typename apply<T>::type OutType;
+ return static_cast<OutType>(obj);
+ }
+};
+
+typedef Caster<Q_None> LValueCaster;
+typedef Caster<Q_Const> ConstCaster;
+typedef Caster<Q_Volatile> VolatileCaster;
+typedef Caster<Q_CV> CVCaster;
+typedef Caster<Q_None, true> MoveCaster;
+typedef Caster<Q_Const, true> MoveConstCaster;
+typedef Caster<Q_Volatile, true> MoveVolatileCaster;
+typedef Caster<Q_CV, true> MoveCVCaster;
+
+
+template <class Tp>
+Tp const& makeConst(Tp& ref) { return ref; }
+
+template <class Tp>
+Tp const* makeConst(Tp* ptr) { return ptr; }
+
+template <class Tp>
+std::reference_wrapper<const Tp> makeConst(std::reference_wrapper<Tp>& ref) {
+ return std::reference_wrapper<const Tp>(ref.get());
+}
+
+template <class Tp>
+Tp volatile& makeVolatile(Tp& ref) { return ref; }
+
+template <class Tp>
+Tp volatile* makeVolatile(Tp* ptr) { return ptr; }
+
+template <class Tp>
+std::reference_wrapper<volatile Tp> makeVolatile(std::reference_wrapper<Tp>& ref) {
+ return std::reference_wrapper<volatile Tp>(ref.get());
+}
+
+template <class Tp>
+Tp const volatile& makeCV(Tp& ref) { return ref; }
+
+template <class Tp>
+Tp const volatile* makeCV(Tp* ptr) { return ptr; }
+
+template <class Tp>
+std::reference_wrapper<const volatile Tp> makeCV(std::reference_wrapper<Tp>& ref) {
+ return std::reference_wrapper<const volatile Tp>(ref.get());
+}
+
+// A shorter name for 'static_cast'
+template <class QualType, class Tp>
+QualType C_(Tp& v) { return static_cast<QualType>(v); };
+
+//==============================================================================
+// ArgType - A non-copyable type intended to be used as a dummy argument type
+// to test functions.
+struct ArgType {
+ int value;
+ explicit ArgType(int val = 0) : value(val) {}
+private:
+ ArgType(ArgType const&);
+ ArgType& operator=(ArgType const&);
+};
+
+//==============================================================================
+// DerivedFromBase - A type that derives from its template argument 'Base'
+template <class Base>
+struct DerivedFromType : public Base {
+ DerivedFromType() : Base() {}
+ template <class Tp>
+ explicit DerivedFromType(Tp const& t) : Base(t) {}
+};
+
+//==============================================================================
+// DerefToType - A type that dereferences to its template argument 'To'.
+// The cv-ref qualifiers of the 'DerefToType' object do not propagate
+// to the resulting 'To' object.
+template <class To>
+struct DerefToType {
+ To object;
+
+ DerefToType() {}
+
+ template <class Up>
+ explicit DerefToType(Up const& val) : object(val) {}
+
+ To& operator*() const volatile { return const_cast<To&>(object); }
+};
+
+//==============================================================================
+// DerefPropToType - A type that dereferences to its template argument 'To'.
+// The cv-ref qualifiers of the 'DerefPropToType' object propagate
+// to the resulting 'To' object.
+template <class To>
+struct DerefPropType {
+ To object;
+
+ DerefPropType() {}
+
+ template <class Up>
+ explicit DerefPropType(Up const& val) : object(val) {}
+
+#if TEST_STD_VER < 11
+ To& operator*() { return object; }
+ To const& operator*() const { return object; }
+ To volatile& operator*() volatile { return object; }
+ To const volatile& operator*() const volatile { return object; }
+#else
+ To& operator*() & { return object; }
+ To const& operator*() const & { return object; }
+ To volatile& operator*() volatile & { return object; }
+ To const volatile& operator*() const volatile & { return object; }
+ To&& operator*() && { return static_cast<To &&>(object); }
+ To const&& operator*() const && { return static_cast<To const&&>(object); }
+ To volatile&& operator*() volatile && { return static_cast<To volatile&&>(object); }
+ To const volatile&& operator*() const volatile && { return static_cast<To const volatile&&>(object); }
+#endif
+};
+
+//==============================================================================
+// MethodID - A type that uniquely identifies a member function for a class.
+// This type is used to communicate between the member functions being tested
+// and the tests invoking them.
+// - Test methods should call 'setUncheckedCall()' whenever they are invoked.
+// - Tests consume the unchecked call using checkCall(<return-value>)` to assert
+// that the method has been called and that the return value of `__invoke`
+// matches what the method actually returned.
+template <class T>
+struct MethodID {
+ typedef void* IDType;
+
+ static int dummy; // A dummy memory location.
+ static void* id; // The "ID" is the value of this pointer.
+ static bool unchecked_call; // Has a call happened that has not been checked.
+
+ static void*& setUncheckedCall() {
+ assert(unchecked_call == false);
+ unchecked_call = true;
+ return id;
+ }
+
+ static bool checkCalled(void*& return_value) {
+ bool old = unchecked_call;
+ unchecked_call = false;
+ return old && id == return_value && &id == &return_value;
+ }
+};
+
+template <class T> int MethodID<T>::dummy = 0;
+template <class T> void* MethodID<T>::id = (void*)&MethodID<T>::dummy;
+template <class T> bool MethodID<T>::unchecked_call = false;
+
+
+//==============================================================================
+// FunctionPtrID - Like MethodID but for free function pointers.
+template <class T, T*>
+struct FunctionPtrID {
+ static int dummy; // A dummy memory location.
+ static void* id; // The "ID" is the value of this pointer.
+ static bool unchecked_call; // Has a call happened that has not been checked.
+
+ static void*& setUncheckedCall() {
+ assert(unchecked_call == false);
+ unchecked_call = true;
+ return id;
+ }
+
+ static bool checkCalled(void*& return_value) {
+ bool old = unchecked_call;
+ unchecked_call = false;
+ return old && id == return_value && &id == &return_value;
+ }
+};
+
+template <class T, T* Ptr> int FunctionPtrID<T, Ptr>::dummy = 0;
+template <class T, T* Ptr> void* FunctionPtrID<T, Ptr>::id = (void*)&FunctionPtrID<T, Ptr>::dummy;
+template <class T, T* Ptr> bool FunctionPtrID<T, Ptr>::unchecked_call = false;
+
+//==============================================================================
+// BasicTest - The basic test structure for everything except
+// member object pointers.
+// ID - The "Function Identifier" type used either MethodID or FunctionPtrID.
+// Arity - The Arity of the call signature.
+// ObjectCaster - The object transformation functor type.
+// ArgCaster - The extra argument transformation functor type.
+template <class ID, int Arity, class ObjectCaster = LValueCaster,
+ class ArgCaster = LValueCaster>
+struct BasicTest {
+ template <class ObjectT>
+ void runTest(ObjectT& object) {
+ Int<Arity> A;
+ runTestImp(A, object);
+ }
+
+ template <class MethodPtr, class ObjectT>
+ void runTest(MethodPtr ptr, ObjectT& object) {
+ Int<Arity> A;
+ runTestImp(A, ptr, object);
+ }
+
+private:
+ typedef void*& CallRet;
+ ObjectCaster object_cast;
+ ArgCaster arg_cast;
+ ArgType a0, a1, a2;
+
+ //==========================================================================
+ // BULLET 1, 2 AND 3 TEST METHODS
+ //==========================================================================
+ template <class MethodPtr, class ObjectT>
+ void runTestImp(Int<0>, MethodPtr ptr, ObjectT& object) {
+ {
+ static_assert((std::is_same<
+ decltype(std::__invoke(ptr, object_cast(object)))
+ , CallRet>::value), "");
+ assert(ID::unchecked_call == false);
+ CallRet ret = std::__invoke(ptr, object_cast(object));
+ assert(ID::checkCalled(ret));
+ }
+ }
+
+ template <class MethodPtr, class ObjectT>
+ void runTestImp(Int<1>, MethodPtr ptr, ObjectT& object) {
+ {
+ static_assert((std::is_same<
+ decltype(std::__invoke(ptr, object_cast(object), arg_cast(a0)))
+ , CallRet>::value), "");
+ assert(ID::unchecked_call == false);
+ CallRet ret = std::__invoke(ptr, object_cast(object), arg_cast(a0));
+ assert(ID::checkCalled(ret));
+ }
+ }
+
+ template <class MethodPtr, class ObjectT>
+ void runTestImp(Int<2>, MethodPtr ptr, ObjectT& object) {
+ {
+ static_assert((std::is_same<
+ decltype(std::__invoke(ptr, object_cast(object), arg_cast(a0), arg_cast(a1)))
+ , CallRet>::value), "");
+ assert(ID::unchecked_call == false);
+ CallRet ret = std::__invoke(ptr, object_cast(object), arg_cast(a0), arg_cast(a1));
+ assert(ID::checkCalled(ret));
+ }
+ }
+
+ template <class MethodPtr, class ObjectT>
+ void runTestImp(Int<3>, MethodPtr ptr, ObjectT& object) {
+ {
+ static_assert((std::is_same<
+ decltype(std::__invoke(ptr, object_cast(object), arg_cast(a0), arg_cast(a1), arg_cast(a2)))
+ , CallRet>::value), "");
+ assert(ID::unchecked_call == false);
+ CallRet ret = std::__invoke(ptr, object_cast(object), arg_cast(a0), arg_cast(a1), arg_cast(a2));
+ assert(ID::checkCalled(ret));
+ }
+ }
+
+ //==========================================================================
+ // BULLET 7 TEST METHODS
+ //==========================================================================
+ template <class ObjectT>
+ void runTestImp(Int<0>, ObjectT& object) {
+ {
+ static_assert((std::is_same<
+ decltype(std::__invoke(object_cast(object)))
+ , CallRet>::value), "");
+ assert(ID::unchecked_call == false);
+ CallRet ret = std::__invoke(object_cast(object));
+ assert(ID::checkCalled(ret));
+ }
+ }
+
+ template <class ObjectT>
+ void runTestImp(Int<1>, ObjectT& object) {
+ {
+ static_assert((std::is_same<
+ decltype(std::__invoke(object_cast(object), arg_cast(a0)))
+ , CallRet>::value), "");
+ assert(ID::unchecked_call == false);
+ CallRet ret = std::__invoke(object_cast(object), arg_cast(a0));
+ assert(ID::checkCalled(ret));
+ }
+ }
+
+ template <class ObjectT>
+ void runTestImp(Int<2>, ObjectT& object) {
+ {
+ static_assert((std::is_same<
+ decltype(std::__invoke(object_cast(object), arg_cast(a0), arg_cast(a1)))
+ , CallRet>::value), "");
+ assert(ID::unchecked_call == false);
+ CallRet ret = std::__invoke(object_cast(object), arg_cast(a0), arg_cast(a1));
+ assert(ID::checkCalled(ret));
+ }
+ }
+
+ template <class ObjectT>
+ void runTestImp(Int<3>, ObjectT& object) {
+ {
+ static_assert((std::is_same<
+ decltype(std::__invoke(object_cast(object), arg_cast(a0), arg_cast(a1), arg_cast(a2)))
+ , CallRet>::value), "");
+ assert(ID::unchecked_call == false);
+ CallRet ret = std::__invoke(object_cast(object), arg_cast(a0), arg_cast(a1), arg_cast(a2));
+ assert(ID::checkCalled(ret));
+ }
+ }
+};
+
+#endif // INVOKE_HELPERS_H
diff --git a/libcxx/test/libcxx-03/utilities/function.objects/refwrap/binary.pass.cpp b/libcxx/test/libcxx-03/utilities/function.objects/refwrap/binary.pass.cpp
new file mode 100644
index 0000000000000..f14359f54a4fb
--- /dev/null
+++ b/libcxx/test/libcxx-03/utilities/function.objects/refwrap/binary.pass.cpp
@@ -0,0 +1,87 @@
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// REQUIRES: c++03 || c++11 || c++14
+
+// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DISABLE_DEPRECATION_WARNINGS
+
+// <functional>
+
+// reference_wrapper
+
+// check for deriving from binary_function
+
+#include <functional>
+#include <type_traits>
+
+#include "test_macros.h"
+
+class functor1
+ : public std::unary_function<int, char>
+{
+};
+
+class functor2
+ : public std::binary_function<char, int, double>
+{
+};
+
+class functor3
+ : public std::unary_function<int, int>,
+ public std::binary_function<char, int, double>
+{
+public:
+ typedef float result_type;
+};
+
+class functor4
+ : public std::unary_function<int, int>,
+ public std::binary_function<char, int, double>
+{
+public:
+};
+
+struct C
+{
+ typedef int argument_type;
+ typedef int result_type;
+};
+
+int main(int, char**)
+{
+ static_assert((!std::is_base_of<std::binary_function<int, char, int>,
+ std::reference_wrapper<functor1> >::value), "");
+ static_assert((std::is_base_of<std::binary_function<char, int, double>,
+ std::reference_wrapper<functor2> >::value), "");
+ static_assert((std::is_base_of<std::binary_function<char, int, double>,
+ std::reference_wrapper<functor3> >::value), "");
+ static_assert((std::is_base_of<std::binary_function<char, int, double>,
+ std::reference_wrapper<functor4> >::value), "");
+ static_assert((!std::is_base_of<std::binary_function<int, int, int>,
+ std::reference_wrapper<C> >::value), "");
+ static_assert((!std::is_base_of<std::binary_function<int, int, float>,
+ std::reference_wrapper<float ()> >::value), "");
+ static_assert((!std::is_base_of<std::binary_function<int, int, float>,
+ std::reference_wrapper<float (int)> >::value), "");
+ static_assert((std::is_base_of<std::binary_function<int, int, float>,
+ std::reference_wrapper<float (int, int)> >::value), "");
+ static_assert((!std::is_base_of<std::binary_function<int, int, float>,
+ std::reference_wrapper<float(*)()> >::value), "");
+ static_assert((!std::is_base_of<std::binary_function<int, int, float>,
+ std::reference_wrapper<float(*)(int)> >::value), "");
+ static_assert((std::is_base_of<std::binary_function<int, int, float>,
+ std::reference_wrapper<float(*)(int, int)> >::value), "");
+ static_assert((!std::is_base_of<std::binary_function<C*, int, float>,
+ std::reference_wrapper<float(C::*)()> >::value), "");
+ static_assert((std::is_base_of<std::binary_function<C*, int, float>,
+ std::reference_wrapper<float(C::*)(int)> >::value), "");
+ static_assert((std::is_base_of<std::binary_function<const volatile C*, int, float>,
+ std::reference_wrapper<float(C::*)(int) const volatile> >::value), "");
+
+ return 0;
+}
diff --git a/libcxx/test/libcxx-03/utilities/function.objects/refwrap/desugars_to.compile.pass.cpp b/libcxx/test/libcxx-03/utilities/function.objects/refwrap/desugars_to.compile.pass.cpp
new file mode 100644
index 0000000000000..1ce88feeadf28
--- /dev/null
+++ b/libcxx/test/libcxx-03/utilities/function.objects/refwrap/desugars_to.compile.pass.cpp
@@ -0,0 +1,36 @@
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: FROZEN-CXX03-HEADERS-FIXME
+
+// This test requires variable templates
+// UNSUPPORTED: gcc && c++11
+
+// <functional>
+
+// reference_wrapper
+
+// Ensure that std::reference_wrapper does not inhibit optimizations based on the
+// std::__desugars_to internal helper.
+
+#include <functional>
+#include <__type_traits/desugars_to.h>
+
+struct Operation {};
+struct Tag {};
+
+namespace std {
+template <>
+bool const __desugars_to_v<Tag, Operation> = true;
+}
+
+static_assert(std::__desugars_to_v<Tag, Operation>, "something is wrong with the test");
+
+// make sure we pass through reference_wrapper
+static_assert(std::__desugars_to_v<Tag, std::reference_wrapper<Operation> >, "");
+static_assert(std::__desugars_to_v<Tag, std::reference_wrapper<Operation const> >, "");
diff --git a/libcxx/test/libcxx-03/utilities/function.objects/refwrap/layout.binary.compile.pass.cpp b/libcxx/test/libcxx-03/utilities/function.objects/refwrap/layout.binary.compile.pass.cpp
new file mode 100644
index 0000000000000..023ed8ddbfa37
--- /dev/null
+++ b/libcxx/test/libcxx-03/utilities/function.objects/refwrap/layout.binary.compile.pass.cpp
@@ -0,0 +1,21 @@
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: msvc
+
+// ensure that binary_function always has the same ABI
+
+#include <functional>
+
+struct S1 : std::less<int>, std::greater<int> {};
+
+static_assert(sizeof(S1) == 2, "");
+
+struct S2 : std::less<int> { char c; };
+
+static_assert(sizeof(S2) == 1, "");
diff --git a/libcxx/test/libcxx-03/utilities/function.objects/refwrap/unary.pass.cpp b/libcxx/test/libcxx-03/utilities/function.objects/refwrap/unary.pass.cpp
new file mode 100644
index 0000000000000..4d7ab16ec366f
--- /dev/null
+++ b/libcxx/test/libcxx-03/utilities/function.objects/refwrap/unary.pass.cpp
@@ -0,0 +1,85 @@
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// REQUIRES: c++03 || c++11 || c++14
+
+// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DISABLE_DEPRECATION_WARNINGS
+
+// <functional>
+
+// reference_wrapper
+
+// check for deriving from unary_function
+
+#include <functional>
+#include <type_traits>
+
+#include "test_macros.h"
+
+class functor1
+ : public std::unary_function<int, char>
+{
+};
+
+class functor2
+ : public std::binary_function<char, int, double>
+{
+};
+
+class functor3
+ : public std::unary_function<int, int>,
+ public std::binary_function<char, int, double>
+{
+public:
+ typedef float result_type;
+};
+
+class functor4
+ : public std::unary_function<int, int>,
+ public std::binary_function<char, int, double>
+{
+public:
+};
+
+struct C
+{
+ typedef int argument_type;
+ typedef int result_type;
+};
+
+int main(int, char**)
+{
+ static_assert((std::is_base_of<std::unary_function<int, char>,
+ std::reference_wrapper<functor1> >::value), "");
+ static_assert((!std::is_base_of<std::unary_function<char, int>,
+ std::reference_wrapper<functor2> >::value), "");
+ static_assert((std::is_base_of<std::unary_function<int, int>,
+ std::reference_wrapper<functor3> >::value), "");
+ static_assert((std::is_base_of<std::unary_function<int, int>,
+ std::reference_wrapper<functor4> >::value), "");
+ static_assert((!std::is_base_of<std::unary_function<int, int>,
+ std::reference_wrapper<C> >::value), "");
+ static_assert((!std::is_base_of<std::unary_function<int, float>,
+ std::reference_wrapper<float(*)()> >::value), "");
+ static_assert((std::is_base_of<std::unary_function<int, float>,
+ std::reference_wrapper<float (int)> >::value), "");
+ static_assert((!std::is_base_of<std::unary_function<int, float>,
+ std::reference_wrapper<float (int, int)> >::value), "");
+ static_assert((std::is_base_of<std::unary_function<int, float>,
+ std::reference_wrapper<float(*)(int)> >::value), "");
+ static_assert((!std::is_base_of<std::unary_function<int, float>,
+ std::reference_wrapper<float(*)(int, int)> >::value), "");
+ static_assert((std::is_base_of<std::unary_function<C*, float>,
+ std::reference_wrapper<float(C::*)()> >::value), "");
+ static_assert((std::is_base_of<std::unary_function<const volatile C*, float>,
+ std::reference_wrapper<float(C::*)() const volatile> >::value), "");
+ static_assert((!std::is_base_of<std::unary_function<C*, float>,
+ std::reference_wrapper<float(C::*)(int)> >::value), "");
+
+ return 0;
+}
diff --git a/libcxx/test/libcxx-03/utilities/function.objects/unord.hash/murmur2_or_cityhash_ubsan_unsigned_overflow_ignored.pass.cpp b/libcxx/test/libcxx-03/utilities/function.objects/unord.hash/murmur2_or_cityhash_ubsan_unsigned_overflow_ignored.pass.cpp
new file mode 100644
index 0000000000000..11f0724f990c8
--- /dev/null
+++ b/libcxx/test/libcxx-03/utilities/function.objects/unord.hash/murmur2_or_cityhash_ubsan_unsigned_overflow_ignored.pass.cpp
@@ -0,0 +1,43 @@
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// Test that UBSAN doesn't generate unsigned integer overflow diagnostics
+// from within the hashing internals.
+
+#include <cstdint>
+#include <functional>
+#include <limits>
+#include <string>
+#include <utility>
+
+#include "test_macros.h"
+
+typedef std::__murmur2_or_cityhash<std::uint32_t> Hash32;
+typedef std::__murmur2_or_cityhash<std::uint64_t> Hash64;
+
+void test(const void* key, int len) {
+ for (int i=1; i <= len; ++i) {
+ Hash32 h1;
+ Hash64 h2;
+ DoNotOptimize(h1(key, i));
+ DoNotOptimize(h2(key, i));
+ }
+}
+
+int main(int, char**) {
+ const std::string TestCases[] = {
+ "abcdaoeuaoeclaoeoaeuaoeuaousaotehu]+}sthoasuthaoesutahoesutaohesutaoeusaoetuhasoetuhaoseutaoseuthaoesutaohes",
+ "00000000000000000000000000000000000000000000000000000000000000000000000",
+ "1237546895+54+4554985416849484213464984765465464654564565645645646546456546546"
+ };
+ const std::size_t NumCases = sizeof(TestCases)/sizeof(TestCases[0]);
+ for (std::size_t i=0; i < NumCases; ++i)
+ test(TestCases[i].data(), TestCases[i].length());
+
+ return 0;
+}
diff --git a/libcxx/test/libcxx-03/utilities/is_pointer_in_range.pass.cpp b/libcxx/test/libcxx-03/utilities/is_pointer_in_range.pass.cpp
new file mode 100644
index 0000000000000..b0a27c79287d4
--- /dev/null
+++ b/libcxx/test/libcxx-03/utilities/is_pointer_in_range.pass.cpp
@@ -0,0 +1,58 @@
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// XFAIL: FROZEN-CXX03-HEADERS-FIXME
+
+#include <__utility/is_pointer_in_range.h>
+#include <cassert>
+
+#include "test_macros.h"
+
+template <class T, class U>
+TEST_CONSTEXPR_CXX14 void test_cv_quals() {
+ T i = 0;
+ U j = 0;
+ assert(!std::__is_pointer_in_range(&i, &i, &i));
+ assert(std::__is_pointer_in_range(&i, &i + 1, &i));
+ assert(!std::__is_pointer_in_range(&i, &i + 1, &j));
+
+#if TEST_STD_VER >= 20
+ {
+ T* arr1 = new int[4]{1, 2, 3, 4};
+ U* arr2 = new int[4]{5, 6, 7, 8};
+
+ assert(!std::__is_pointer_in_range(arr1, arr1 + 4, arr2));
+ assert(std::__is_pointer_in_range(arr1, arr1 + 4, arr1 + 3));
+ assert(!std::__is_pointer_in_range(arr1, arr1, arr1 + 3));
+
+ delete[] arr1;
+ delete[] arr2;
+ }
+#endif
+}
+
+TEST_CONSTEXPR_CXX14 bool test() {
+ test_cv_quals<int, int>();
+ test_cv_quals<const int, int>();
+ test_cv_quals<int, const int>();
+ test_cv_quals<const int, const int>();
+ test_cv_quals<volatile int, int>();
+ test_cv_quals<int, volatile int>();
+ test_cv_quals<volatile int, volatile int>();
+
+ return true;
+}
+
+int main(int, char**) {
+ test();
+#if TEST_STD_VER >= 14
+ static_assert(test(), "");
+#endif
+
+ return 0;
+}
diff --git a/libcxx/test/libcxx-03/utilities/is_valid_range.pass.cpp b/libcxx/test/libcxx-03/utilities/is_valid_range.pass.cpp
new file mode 100644
index 0000000000000..cb800aee5674b
--- /dev/null
+++ b/libcxx/test/libcxx-03/utilities/is_valid_range.pass.cpp
@@ -0,0 +1,70 @@
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// XFAIL: FROZEN-CXX03-HEADERS-FIXME
+
+#include <__utility/is_valid_range.h>
+#include <cassert>
+
+#include "test_macros.h"
+
+template <class T, class TQualified>
+TEST_CONSTEXPR_CXX14 void check_type() {
+ {
+ // We need to ensure that the addresses of i and j are ordered as &i < &j for
+ // the test below to work portably, so we define them in a struct.
+ struct {
+ T i = 0;
+ T j = 0;
+ } storage;
+ assert(std::__is_valid_range(static_cast<TQualified*>(&storage.i), static_cast<TQualified*>(&storage.i)));
+ assert(std::__is_valid_range(static_cast<TQualified*>(&storage.i), static_cast<TQualified*>(&storage.i + 1)));
+
+ assert(!std::__is_valid_range(static_cast<TQualified*>(&storage.j), static_cast<TQualified*>(&storage.i)));
+ assert(!std::__is_valid_range(static_cast<TQualified*>(&storage.i + 1), static_cast<TQualified*>(&storage.i)));
+
+ // We detect this as being a valid range even though it is not really valid.
+ assert(std::__is_valid_range(static_cast<TQualified*>(&storage.i), static_cast<TQualified*>(&storage.j)));
+ }
+
+ {
+ T arr[3] = {1, 2, 3};
+ assert(std::__is_valid_range(static_cast<TQualified*>(&arr[0]), static_cast<TQualified*>(&arr[0])));
+ assert(std::__is_valid_range(static_cast<TQualified*>(&arr[0]), static_cast<TQualified*>(&arr[1])));
+ assert(std::__is_valid_range(static_cast<TQualified*>(&arr[0]), static_cast<TQualified*>(&arr[2])));
+
+ assert(!std::__is_valid_range(static_cast<TQualified*>(&arr[1]), static_cast<TQualified*>(&arr[0])));
+ assert(!std::__is_valid_range(static_cast<TQualified*>(&arr[2]), static_cast<TQualified*>(&arr[0])));
+ }
+
+#if TEST_STD_VER >= 20
+ {
+ T* arr = new int[4]{1, 2, 3, 4};
+ assert(std::__is_valid_range(static_cast<TQualified*>(arr), static_cast<TQualified*>(arr + 4)));
+ delete[] arr;
+ }
+#endif
+}
+
+TEST_CONSTEXPR_CXX14 bool test() {
+ check_type<int, int>();
+ check_type<int, int const>();
+ check_type<int, int volatile>();
+ check_type<int, int const volatile>();
+
+ return true;
+}
+
+int main(int, char**) {
+ test();
+#if TEST_STD_VER >= 14
+ static_assert(test(), "");
+#endif
+
+ return 0;
+}
diff --git a/libcxx/test/libcxx-03/utilities/memory/pointer.conversion/to_address.pass.cpp b/libcxx/test/libcxx-03/utilities/memory/pointer.conversion/to_address.pass.cpp
new file mode 100644
index 0000000000000..60ef98ae905d0
--- /dev/null
+++ b/libcxx/test/libcxx-03/utilities/memory/pointer.conversion/to_address.pass.cpp
@@ -0,0 +1,159 @@
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// <memory>
+
+// template <class T> constexpr T* __to_address(T* p) noexcept;
+// template <class Ptr> constexpr auto __to_address(const Ptr& p) noexcept;
+
+#include <memory>
+#include <cassert>
+#include <utility>
+
+#include "test_macros.h"
+
+struct Irrelevant;
+
+struct P1 {
+ using element_type = Irrelevant;
+ TEST_CONSTEXPR explicit P1(int *p) : p_(p) { }
+ TEST_CONSTEXPR int *operator->() const { return p_; }
+ int *p_;
+};
+
+struct P2 {
+ using element_type = Irrelevant;
+ TEST_CONSTEXPR explicit P2(int *p) : p_(p) { }
+ TEST_CONSTEXPR P1 operator->() const { return p_; }
+ P1 p_;
+};
+
+struct P3 {
+ TEST_CONSTEXPR explicit P3(int *p) : p_(p) { }
+ int *p_;
+};
+
+template<>
+struct std::pointer_traits<P3> {
+ static TEST_CONSTEXPR int *to_address(const P3& p) { return p.p_; }
+};
+
+struct P4 {
+ TEST_CONSTEXPR explicit P4(int *p) : p_(p) { }
+ int *operator->() const; // should never be called
+ int *p_;
+};
+
+template<>
+struct std::pointer_traits<P4> {
+ static TEST_CONSTEXPR int *to_address(const P4& p) { return p.p_; }
+};
+
+struct P5 {
+ using element_type = Irrelevant;
+ int const* const& operator->() const;
+};
+
+struct P6 {};
+
+template<>
+struct std::pointer_traits<P6> {
+ static int const* const& to_address(const P6&);
+};
+
+// Taken from a build breakage caused in Clang
+namespace P7 {
+ template<typename T> struct CanProxy;
+ template<typename T>
+ struct CanQual {
+ CanProxy<T> operator->() const { return CanProxy<T>(); }
+ };
+ template<typename T>
+ struct CanProxy {
+ const CanProxy<T> *operator->() const { return nullptr; }
+ };
+} // namespace P7
+
+namespace P8 {
+ template<class T>
+ struct FancyPtrA {
+ using element_type = Irrelevant;
+ T *p_;
+ TEST_CONSTEXPR FancyPtrA(T *p) : p_(p) {}
+ T& operator*() const;
+ TEST_CONSTEXPR T *operator->() const { return p_; }
+ };
+ template<class T>
+ struct FancyPtrB {
+ T *p_;
+ TEST_CONSTEXPR FancyPtrB(T *p) : p_(p) {}
+ T& operator*() const;
+ };
+} // namespace P8
+
+template<class T>
+struct std::pointer_traits<P8::FancyPtrB<T> > {
+ static TEST_CONSTEXPR T *to_address(const P8::FancyPtrB<T>& p) { return p.p_; }
+};
+
+struct Incomplete;
+template<class T> struct Holder { T t; };
+
+
+TEST_CONSTEXPR_CXX14 bool test() {
+ int i = 0;
+ ASSERT_NOEXCEPT(std::__to_address(&i));
+ assert(std::__to_address(&i) == &i);
+ P1 p1(&i);
+ ASSERT_NOEXCEPT(std::__to_address(p1));
+ assert(std::__to_address(p1) == &i);
+ P2 p2(&i);
+ ASSERT_NOEXCEPT(std::__to_address(p2));
+ assert(std::__to_address(p2) == &i);
+ P3 p3(&i);
+ ASSERT_NOEXCEPT(std::__to_address(p3));
+ assert(std::__to_address(p3) == &i);
+ P4 p4(&i);
+ ASSERT_NOEXCEPT(std::__to_address(p4));
+ assert(std::__to_address(p4) == &i);
+
+ ASSERT_SAME_TYPE(decltype(std::__to_address(std::declval<int const*>())), int const*);
+ ASSERT_SAME_TYPE(decltype(std::__to_address(std::declval<P5>())), int const*);
+ ASSERT_SAME_TYPE(decltype(std::__to_address(std::declval<P6>())), int const*);
+
+ P7::CanQual<int>* p7 = nullptr;
+ assert(std::__to_address(p7) == nullptr);
+ ASSERT_SAME_TYPE(decltype(std::__to_address(p7)), P7::CanQual<int>*);
+
+ Holder<Incomplete> *p8_nil = nullptr; // for C++03 compatibility
+ P8::FancyPtrA<Holder<Incomplete> > p8a = p8_nil;
+ assert(std::__to_address(p8a) == p8_nil);
+ ASSERT_SAME_TYPE(decltype(std::__to_address(p8a)), decltype(p8_nil));
+
+ P8::FancyPtrB<Holder<Incomplete> > p8b = p8_nil;
+ assert(std::__to_address(p8b) == p8_nil);
+ ASSERT_SAME_TYPE(decltype(std::__to_address(p8b)), decltype(p8_nil));
+
+ int p9[2] = {};
+ assert(std::__to_address(p9) == p9);
+ ASSERT_SAME_TYPE(decltype(std::__to_address(p9)), int*);
+
+ const int p10[2] = {};
+ assert(std::__to_address(p10) == p10);
+ ASSERT_SAME_TYPE(decltype(std::__to_address(p10)), const int*);
+
+ return true;
+}
+
+int main(int, char**) {
+ test();
+#if TEST_STD_VER >= 14
+ static_assert(test(), "");
+#endif
+ return 0;
+}
diff --git a/libcxx/test/libcxx-03/utilities/memory/pointer.conversion/to_address_on_funcptr.verify.cpp b/libcxx/test/libcxx-03/utilities/memory/pointer.conversion/to_address_on_funcptr.verify.cpp
new file mode 100644
index 0000000000000..02b1676055e7b
--- /dev/null
+++ b/libcxx/test/libcxx-03/utilities/memory/pointer.conversion/to_address_on_funcptr.verify.cpp
@@ -0,0 +1,20 @@
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// <memory>
+
+// template <class T> constexpr T* __to_address(T* p) noexcept;
+// Mandates: T is not a function type.
+
+#include <memory>
+
+int (*pf)();
+
+void test() {
+ (void)std::__to_address(pf); // expected-error@*:* {{is a function type}}
+}
diff --git a/libcxx/test/libcxx-03/utilities/memory/pointer.conversion/to_address_on_function.verify.cpp b/libcxx/test/libcxx-03/utilities/memory/pointer.conversion/to_address_on_function.verify.cpp
new file mode 100644
index 0000000000000..b8825a181d37a
--- /dev/null
+++ b/libcxx/test/libcxx-03/utilities/memory/pointer.conversion/to_address_on_function.verify.cpp
@@ -0,0 +1,20 @@
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// <memory>
+
+// template <class T> constexpr T* __to_address(T* p) noexcept;
+// Mandates: T is not a function type.
+
+#include <memory>
+
+int f();
+
+void test() {
+ (void)std::__to_address(f); // expected-error@*:* {{is a function type}}
+}
diff --git a/libcxx/test/libcxx-03/utilities/memory/pointer.conversion/to_address_std_iterators.pass.cpp b/libcxx/test/libcxx-03/utilities/memory/pointer.conversion/to_address_std_iterators.pass.cpp
new file mode 100644
index 0000000000000..5eed12d19c072
--- /dev/null
+++ b/libcxx/test/libcxx-03/utilities/memory/pointer.conversion/to_address_std_iterators.pass.cpp
@@ -0,0 +1,56 @@
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// <memory>
+
+// template <class T> constexpr T* __to_address(T* p) noexcept;
+// template <class Ptr> constexpr auto __to_address(const Ptr& p) noexcept;
+
+#include <memory>
+
+#include <array>
+#include <cassert>
+#include <span>
+#include <string>
+#include <string_view>
+#include <valarray>
+#include <vector>
+#include "test_macros.h"
+
+template<class C>
+void test_container_iterators(C c)
+{
+ const C& cc = c;
+ assert(std::__to_address(c.begin()) == c.data());
+ assert(std::__to_address(c.end()) == c.data() + c.size());
+ assert(std::__to_address(cc.begin()) == cc.data());
+ assert(std::__to_address(cc.end()) == cc.data() + cc.size());
+}
+
+void test_valarray_iterators()
+{
+ std::valarray<int> v(100);
+ int *p = std::__to_address(std::begin(v));
+ int *q = std::__to_address(std::end(v));
+ assert(q - p == 100);
+}
+
+int main(int, char**) {
+ test_container_iterators(std::array<int, 3>());
+ test_container_iterators(std::vector<int>(3));
+ test_container_iterators(std::string("abc"));
+#if TEST_STD_VER >= 17
+ test_container_iterators(std::string_view("abc"));
+#endif
+#if TEST_STD_VER >= 20
+ test_container_iterators(std::span<const char>("abc"));
+#endif
+ test_valarray_iterators();
+
+ return 0;
+}
diff --git a/libcxx/test/libcxx-03/utilities/memory/util.smartptr/race_condition.pass.cpp b/libcxx/test/libcxx-03/utilities/memory/util.smartptr/race_condition.pass.cpp
new file mode 100644
index 0000000000000..cbecd2d1dc7ab
--- /dev/null
+++ b/libcxx/test/libcxx-03/utilities/memory/util.smartptr/race_condition.pass.cpp
@@ -0,0 +1,99 @@
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+//
+// UNSUPPORTED: no-threads
+//
+// <memory>
+//
+// class shared_ptr
+//
+// This test attempts to create a race condition surrounding use_count()
+// with the hope that TSAN will diagnose it.
+
+#include <memory>
+#include <atomic>
+#include <thread>
+#include <cassert>
+
+#include "make_test_thread.h"
+#include "test_macros.h"
+
+typedef std::shared_ptr<int> Ptr;
+typedef std::weak_ptr<int> WeakPtr;
+
+std::atomic_bool Start;
+std::atomic_bool KeepRunning;
+
+struct TestRunner {
+ TestRunner(Ptr xx) : x(xx) {}
+ void operator()() {
+ while (Start == false) {}
+ while (KeepRunning) {
+ // loop to prevent always checking the atomic.
+ for (int i=0; i < 100000; ++i) {
+ Ptr x2 = x; // increment shared count
+ WeakPtr x3 = x; // increment weak count
+ Ptr x4 = x3.lock(); // increment shared count via lock
+ WeakPtr x5 = x3; // increment weak count
+ }
+ }
+ }
+ Ptr x;
+};
+
+void run_test(Ptr p) {
+ Start = false;
+ KeepRunning = true;
+ assert(p.use_count() == 2);
+ TestRunner r(p);
+ assert(p.use_count() == 3);
+ std::thread t1 = support::make_test_thread(r); // Start the test thread.
+ assert(p.use_count() == 4);
+ Start = true;
+ // Run until we witness 25 use count changes via both
+ // shared and weak pointer methods.
+ WeakPtr w = p;
+ int shared_changes_count = 0;
+ int weak_changes_count = 0;
+ while (shared_changes_count < 25 && weak_changes_count < 25) {
+ // check use_count on the shared_ptr
+ int last = p.use_count();
+ int new_val = p.use_count();
+ assert(last >= 4);
+ assert(new_val >= 4);
+ if (last != new_val) ++shared_changes_count;
+ // Check use_count on the weak_ptr
+ last = w.use_count();
+ new_val = w.use_count();
+ assert(last >= 4);
+ assert(new_val >= 4);
+ if (last != new_val) ++weak_changes_count;
+ }
+ // kill the test thread.
+ KeepRunning = false;
+ t1.join();
+ assert(p.use_count() == 3);
+}
+
+int main(int, char**) {
+ {
+ // Test with out-of-place shared_count.
+ Ptr p(new int(42));
+ run_test(p);
+ assert(p.use_count() == 1);
+ }
+ {
+ // Test with in-place shared_count.
+ int val = 42;
+ Ptr p = std::make_shared<int>(val);
+ run_test(p);
+ assert(p.use_count() == 1);
+ }
+
+ return 0;
+}
diff --git a/libcxx/test/libcxx-03/utilities/meta/is_referenceable.compile.pass.cpp b/libcxx/test/libcxx-03/utilities/meta/is_referenceable.compile.pass.cpp
new file mode 100644
index 0000000000000..0991de69b5baf
--- /dev/null
+++ b/libcxx/test/libcxx-03/utilities/meta/is_referenceable.compile.pass.cpp
@@ -0,0 +1,192 @@
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+//
+
+// __is_referenceable_v<Tp>
+//
+// [defns.referenceable] defines "a referenceable type" as:
+// An object type, a function type that does not have cv-qualifiers
+// or a ref-qualifier, or a reference type.
+//
+
+// XFAIL: FROZEN-CXX03-HEADERS-FIXME
+
+#include <type_traits>
+#include <cassert>
+
+#include "test_macros.h"
+
+struct Foo {};
+
+static_assert((!std::__is_referenceable_v<void>), "");
+static_assert((std::__is_referenceable_v<int>), "");
+static_assert((std::__is_referenceable_v<int[3]>), "");
+static_assert((std::__is_referenceable_v<int[]>), "");
+static_assert((std::__is_referenceable_v<int&>), "");
+static_assert((std::__is_referenceable_v<const int&>), "");
+static_assert((std::__is_referenceable_v<int*>), "");
+static_assert((std::__is_referenceable_v<const int*>), "");
+static_assert((std::__is_referenceable_v<Foo>), "");
+static_assert((std::__is_referenceable_v<const Foo>), "");
+static_assert((std::__is_referenceable_v<Foo&>), "");
+static_assert((std::__is_referenceable_v<const Foo&>), "");
+#if TEST_STD_VER >= 11
+static_assert((std::__is_referenceable_v<Foo&&>), "");
+static_assert((std::__is_referenceable_v<const Foo&&>), "");
+#endif
+
+static_assert((std::__is_referenceable_v<int __attribute__((__vector_size__(8)))>), "");
+static_assert((std::__is_referenceable_v<const int __attribute__((__vector_size__(8)))>), "");
+static_assert((std::__is_referenceable_v<float __attribute__((__vector_size__(16)))>), "");
+static_assert((std::__is_referenceable_v<const float __attribute__((__vector_size__(16)))>), "");
+
+// Functions without cv-qualifiers are referenceable
+static_assert((std::__is_referenceable_v<void()>), "");
+#if TEST_STD_VER >= 11
+static_assert((!std::__is_referenceable_v<void() const>), "");
+static_assert((!std::__is_referenceable_v<void() &>), "");
+static_assert((!std::__is_referenceable_v<void() const&>), "");
+static_assert((!std::__is_referenceable_v<void() &&>), "");
+static_assert((!std::__is_referenceable_v<void() const&&>), "");
+#endif
+
+static_assert((std::__is_referenceable_v<void(int)>), "");
+#if TEST_STD_VER >= 11
+static_assert((!std::__is_referenceable_v<void(int) const>), "");
+static_assert((!std::__is_referenceable_v<void(int) &>), "");
+static_assert((!std::__is_referenceable_v<void(int) const&>), "");
+static_assert((!std::__is_referenceable_v<void(int) &&>), "");
+static_assert((!std::__is_referenceable_v<void(int) const&&>), "");
+#endif
+
+static_assert((std::__is_referenceable_v<void(int, float)>), "");
+#if TEST_STD_VER >= 11
+static_assert((!std::__is_referenceable_v<void(int, float) const>), "");
+static_assert((!std::__is_referenceable_v<void(int, float) &>), "");
+static_assert((!std::__is_referenceable_v<void(int, float) const&>), "");
+static_assert((!std::__is_referenceable_v<void(int, float) &&>), "");
+static_assert((!std::__is_referenceable_v<void(int, float) const&&>), "");
+#endif
+
+static_assert((std::__is_referenceable_v<void(int, float, Foo&)>), "");
+#if TEST_STD_VER >= 11
+static_assert((!std::__is_referenceable_v<void(int, float, Foo&) const>), "");
+static_assert((!std::__is_referenceable_v<void(int, float, Foo&) &>), "");
+static_assert((!std::__is_referenceable_v<void(int, float, Foo&) const&>), "");
+static_assert((!std::__is_referenceable_v<void(int, float, Foo&) &&>), "");
+static_assert((!std::__is_referenceable_v<void(int, float, Foo&) const&&>), "");
+#endif
+
+static_assert((std::__is_referenceable_v<void(...)>), "");
+#if TEST_STD_VER >= 11
+static_assert((!std::__is_referenceable_v<void(...) const>), "");
+static_assert((!std::__is_referenceable_v<void(...) &>), "");
+static_assert((!std::__is_referenceable_v<void(...) const&>), "");
+static_assert((!std::__is_referenceable_v<void(...) &&>), "");
+static_assert((!std::__is_referenceable_v<void(...) const&&>), "");
+#endif
+
+static_assert((std::__is_referenceable_v<void(int, ...)>), "");
+#if TEST_STD_VER >= 11
+static_assert((!std::__is_referenceable_v<void(int, ...) const>), "");
+static_assert((!std::__is_referenceable_v<void(int, ...) &>), "");
+static_assert((!std::__is_referenceable_v<void(int, ...) const&>), "");
+static_assert((!std::__is_referenceable_v<void(int, ...) &&>), "");
+static_assert((!std::__is_referenceable_v<void(int, ...) const&&>), "");
+#endif
+
+static_assert((std::__is_referenceable_v<void(int, float, ...)>), "");
+#if TEST_STD_VER >= 11
+static_assert((!std::__is_referenceable_v<void(int, float, ...) const>), "");
+static_assert((!std::__is_referenceable_v<void(int, float, ...) &>), "");
+static_assert((!std::__is_referenceable_v<void(int, float, ...) const&>), "");
+static_assert((!std::__is_referenceable_v<void(int, float, ...) &&>), "");
+static_assert((!std::__is_referenceable_v<void(int, float, ...) const&&>), "");
+#endif
+
+static_assert((std::__is_referenceable_v<void(int, float, Foo&, ...)>), "");
+#if TEST_STD_VER >= 11
+static_assert((!std::__is_referenceable_v<void(int, float, Foo&, ...) const>), "");
+static_assert((!std::__is_referenceable_v<void(int, float, Foo&, ...) &>), "");
+static_assert((!std::__is_referenceable_v<void(int, float, Foo&, ...) const&>), "");
+static_assert((!std::__is_referenceable_v<void(int, float, Foo&, ...) &&>), "");
+static_assert((!std::__is_referenceable_v<void(int, float, Foo&, ...) const&&>), "");
+#endif
+
+// member functions with or without cv-qualifiers are referenceable
+static_assert((std::__is_referenceable_v<void (Foo::*)()>), "");
+static_assert((std::__is_referenceable_v<void (Foo::*)() const>), "");
+#if TEST_STD_VER >= 11
+static_assert((std::__is_referenceable_v<void (Foo::*)() &>), "");
+static_assert((std::__is_referenceable_v<void (Foo::*)() const&>), "");
+static_assert((std::__is_referenceable_v<void (Foo::*)() &&>), "");
+static_assert((std::__is_referenceable_v<void (Foo::*)() const&&>), "");
+#endif
+
+static_assert((std::__is_referenceable_v<void (Foo::*)(int)>), "");
+static_assert((std::__is_referenceable_v<void (Foo::*)(int) const>), "");
+#if TEST_STD_VER >= 11
+static_assert((std::__is_referenceable_v<void (Foo::*)(int) &>), "");
+static_assert((std::__is_referenceable_v<void (Foo::*)(int) const&>), "");
+static_assert((std::__is_referenceable_v<void (Foo::*)(int) &&>), "");
+static_assert((std::__is_referenceable_v<void (Foo::*)(int) const&&>), "");
+#endif
+
+static_assert((std::__is_referenceable_v<void (Foo::*)(int, float)>), "");
+static_assert((std::__is_referenceable_v<void (Foo::*)(int, float) const>), "");
+#if TEST_STD_VER >= 11
+static_assert((std::__is_referenceable_v<void (Foo::*)(int, float) &>), "");
+static_assert((std::__is_referenceable_v<void (Foo::*)(int, float) const&>), "");
+static_assert((std::__is_referenceable_v<void (Foo::*)(int, float) &&>), "");
+static_assert((std::__is_referenceable_v<void (Foo::*)(int, float) const&&>), "");
+#endif
+
+static_assert((std::__is_referenceable_v<void (Foo::*)(int, float, Foo&)>), "");
+static_assert((std::__is_referenceable_v<void (Foo::*)(int, float, Foo&) const>), "");
+#if TEST_STD_VER >= 11
+static_assert((std::__is_referenceable_v<void (Foo::*)(int, float, Foo&) &>), "");
+static_assert((std::__is_referenceable_v<void (Foo::*)(int, float, Foo&) const&>), "");
+static_assert((std::__is_referenceable_v<void (Foo::*)(int, float, Foo&) &&>), "");
+static_assert((std::__is_referenceable_v<void (Foo::*)(int, float, Foo&) const&&>), "");
+#endif
+
+static_assert((std::__is_referenceable_v<void (Foo::*)(...)>), "");
+static_assert((std::__is_referenceable_v<void (Foo::*)(...) const>), "");
+#if TEST_STD_VER >= 11
+static_assert((std::__is_referenceable_v<void (Foo::*)(...) &>), "");
+static_assert((std::__is_referenceable_v<void (Foo::*)(...) const&>), "");
+static_assert((std::__is_referenceable_v<void (Foo::*)(...) &&>), "");
+static_assert((std::__is_referenceable_v<void (Foo::*)(...) const&&>), "");
+#endif
+
+static_assert((std::__is_referenceable_v<void (Foo::*)(int, ...)>), "");
+static_assert((std::__is_referenceable_v<void (Foo::*)(int, ...) const>), "");
+#if TEST_STD_VER >= 11
+static_assert((std::__is_referenceable_v<void (Foo::*)(int, ...) &>), "");
+static_assert((std::__is_referenceable_v<void (Foo::*)(int, ...) const&>), "");
+static_assert((std::__is_referenceable_v<void (Foo::*)(int, ...) &&>), "");
+static_assert((std::__is_referenceable_v<void (Foo::*)(int, ...) const&&>), "");
+#endif
+
+static_assert((std::__is_referenceable_v<void (Foo::*)(int, float, ...)>), "");
+static_assert((std::__is_referenceable_v<void (Foo::*)(int, float, ...) const>), "");
+#if TEST_STD_VER >= 11
+static_assert((std::__is_referenceable_v<void (Foo::*)(int, float, ...) &>), "");
+static_assert((std::__is_referenceable_v<void (Foo::*)(int, float, ...) const&>), "");
+static_assert((std::__is_referenceable_v<void (Foo::*)(int, float, ...) &&>), "");
+static_assert((std::__is_referenceable_v<void (Foo::*)(int, float, ...) const&&>), "");
+#endif
+
+static_assert((std::__is_referenceable_v<void (Foo::*)(int, float, Foo&, ...)>), "");
+static_assert((std::__is_referenceable_v<void (Foo::*)(int, float, Foo&, ...) const>), "");
+#if TEST_STD_VER >= 11
+static_assert((std::__is_referenceable_v<void (Foo::*)(int, float, Foo&, ...) &>), "");
+static_assert((std::__is_referenceable_v<void (Foo::*)(int, float, Foo&, ...) const&>), "");
+static_assert((std::__is_referenceable_v<void (Foo::*)(int, float, Foo&, ...) &&>), "");
+static_assert((std::__is_referenceable_v<void (Foo::*)(int, float, Foo&, ...) const&&>), "");
+#endif
diff --git a/libcxx/test/libcxx-03/utilities/meta/meta_base.pass.cpp b/libcxx/test/libcxx-03/utilities/meta/meta_base.pass.cpp
new file mode 100644
index 0000000000000..66c25b1d75638
--- /dev/null
+++ b/libcxx/test/libcxx-03/utilities/meta/meta_base.pass.cpp
@@ -0,0 +1,92 @@
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+//
+
+// XFAIL: FROZEN-CXX03-HEADERS-FIXME
+
+#include "test_macros.h"
+
+TEST_CLANG_DIAGNOSTIC_IGNORED("-Wprivate-header")
+#include <__type_traits/conjunction.h>
+#include <__type_traits/disjunction.h>
+#include <__type_traits/is_valid_expansion.h>
+#include <__type_traits/negation.h>
+#include <cassert>
+#include <type_traits>
+#include <utility>
+
+struct Bomb;
+template <int N, class T = Bomb >
+struct BOOM {
+ using Explode = typename T::BOOMBOOM;
+};
+
+using True = std::true_type;
+using False = std::false_type;
+
+void test_if() {
+ ASSERT_SAME_TYPE(std::_If<true, int, long>, int);
+ ASSERT_SAME_TYPE(std::_If<false, int, long>, long);
+}
+
+void test_and() {
+ static_assert(std::_And<True>::value, "");
+ static_assert(!std::_And<False>::value, "");
+ static_assert(std::_And<True, True>::value, "");
+ static_assert(!std::_And<False, BOOM<1> >::value, "");
+ static_assert(!std::_And<True, True, True, False, BOOM<2> >::value, "");
+}
+
+void test_or() {
+ static_assert(std::_Or<True>::value, "");
+ static_assert(!std::_Or<False>::value, "");
+ static_assert(std::_Or<False, True>::value, "");
+ static_assert(std::_Or<True, std::_Not<BOOM<3> > >::value, "");
+ static_assert(!std::_Or<False, False>::value, "");
+ static_assert(std::_Or<True, BOOM<1> >::value, "");
+ static_assert(std::_Or<False, False, False, False, True, BOOM<2> >::value, "");
+}
+
+void test_combined() {
+ static_assert(std::_And<True, std::_Or<False, True, BOOM<4> > >::value, "");
+ static_assert(std::_And<True, std::_Or<False, True, BOOM<4> > >::value, "");
+ static_assert(std::_Not<std::_And<True, False, BOOM<5> > >::value, "");
+}
+
+struct MemberTest {
+ static int foo;
+ using type = long;
+
+ void func(int);
+};
+struct Empty {};
+struct MemberTest2 {
+ using foo = int;
+};
+template <class T>
+using HasFooData = decltype(T::foo);
+template <class T>
+using HasFooType = typename T::foo;
+
+template <class T, class U>
+using FuncCallable = decltype(std::declval<T>().func(std::declval<U>()));
+template <class T>
+using BadCheck = typename T::DOES_NOT_EXIST;
+
+void test_is_valid_trait() {
+ static_assert(std::_IsValidExpansion<HasFooData, MemberTest>::value, "");
+ static_assert(!std::_IsValidExpansion<HasFooType, MemberTest>::value, "");
+ static_assert(!std::_IsValidExpansion<HasFooData, MemberTest2>::value, "");
+ static_assert(std::_IsValidExpansion<HasFooType, MemberTest2>::value, "");
+ static_assert(std::_IsValidExpansion<FuncCallable, MemberTest, int>::value, "");
+ static_assert(!std::_IsValidExpansion<FuncCallable, MemberTest, void*>::value, "");
+}
+
+int main(int, char**) {
+ return 0;
+}
diff --git a/libcxx/test/libcxx-03/utilities/meta/stress_tests/stress_test_is_same.sh.cpp b/libcxx/test/libcxx-03/utilities/meta/stress_tests/stress_test_is_same.sh.cpp
new file mode 100644
index 0000000000000..cfd8adb52d854
--- /dev/null
+++ b/libcxx/test/libcxx-03/utilities/meta/stress_tests/stress_test_is_same.sh.cpp
@@ -0,0 +1,55 @@
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+//
+// This is a dummy feature that prevents this test from running by default.
+// REQUIRES: template-cost-testing
+
+// The table below compares the compile time and object size for each of the
+// variants listed in the RUN script.
+//
+// Impl Compile Time Object Size
+// -------------------------------------------
+// std::_IsSame: 689.634 ms 356 K
+// std::is_same: 8,129.180 ms 560 K
+//
+// RUN: %{cxx} %{flags} %{compile_flags} -c %s -o %S/orig.o -ggdb -ggnu-pubnames -ftemplate-depth=5000 -ftime-trace -std=c++17
+// RUN: %{cxx} %{flags} %{compile_flags} -c %s -o %S/new.o -ggdb -ggnu-pubnames -ftemplate-depth=5000 -ftime-trace -std=c++17 -DTEST_NEW
+
+#include <type_traits>
+#include <cassert>
+
+#include "test_macros.h"
+#include "template_cost_testing.h"
+
+template <int N> struct Arg { enum { value = 1 }; };
+
+#ifdef TEST_NEW
+#define IS_SAME std::_IsSame
+#else
+#define IS_SAME std::is_same
+#endif
+
+#define TEST_CASE_NOP() IS_SAME < Arg< __COUNTER__ >, Arg < __COUNTER__ > >::value,
+#define TEST_CASE_TYPE() IS_SAME < Arg< __COUNTER__ >, Arg < __COUNTER__ > >,
+
+int sink(...);
+
+int x = sink(
+ REPEAT_10000(TEST_CASE_NOP)
+ REPEAT_10000(TEST_CASE_NOP) 42
+);
+
+void Foo( REPEAT_1000(TEST_CASE_TYPE) int) { }
+
+static_assert(__COUNTER__ > 10000, "");
+
+void escape() {
+
+sink(&x);
+sink(&Foo);
+}
diff --git a/libcxx/test/libcxx-03/utilities/meta/stress_tests/stress_test_metafunctions.sh.cpp b/libcxx/test/libcxx-03/utilities/meta/stress_tests/stress_test_metafunctions.sh.cpp
new file mode 100644
index 0000000000000..4815ce37b0883
--- /dev/null
+++ b/libcxx/test/libcxx-03/utilities/meta/stress_tests/stress_test_metafunctions.sh.cpp
@@ -0,0 +1,65 @@
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+//
+// This is a dummy feature that prevents this test from running by default.
+// REQUIRES: template-cost-testing
+
+// The table below compares the compile time and object size for each of the
+// variants listed in the RUN script.
+//
+// Impl Compile Time Object Size
+// -------------------------------------------
+// _And: 3,498.639 ms 158 M
+// __lazy_and: 10,138.982 ms 334 M
+// __and_: 14,181.851 ms 648 M
+//
+
+// RUN: %{cxx} %{flags} %{compile_flags} -c %s -o %S/new.o -ggdb -ggnu-pubnames -ftemplate-depth=5000 -ftime-trace -std=c++17
+// RUN: %{cxx} %{flags} %{compile_flags} -c %s -o %S/lazy.o -ggdb -ggnu-pubnames -ftemplate-depth=5000 -ftime-trace -std=c++17 -DTEST_LAZY_AND
+// RUN: %{cxx} %{flags} %{compile_flags} -c %s -o %S/std.o -ggdb -ggnu-pubnames -ftemplate-depth=5000 -ftime-trace -std=c++17 -DTEST_STD_AND
+
+#include <type_traits>
+#include <cassert>
+
+#include "test_macros.h"
+#include "template_cost_testing.h"
+using std::true_type;
+using std::false_type;
+
+#define FALSE_T() std::false_type,
+#define TRUE_T() std::true_type,
+
+#ifdef TEST_LAZY_AND
+#define TEST_AND std::__lazy_and
+#define TEST_OR std::__lazy_or
+#elif defined(TEST_STD_AND)
+#define TEST_AND std::__and_
+#define TEST_OR std::__or_
+#else
+#define TEST_AND std::_And
+#define TEST_OR std::_Or
+#endif
+
+void sink(...);
+
+void Foo1(TEST_AND < REPEAT_1000(TRUE_T) true_type > t1) { sink(&t1); }
+void Foo2(TEST_AND < REPEAT_1000(TRUE_T) REPEAT_1000(TRUE_T) true_type > t2) { sink(&t2); }
+void Foo3(TEST_AND < REPEAT_1000(TRUE_T) true_type, false_type > t3) { sink(&t3); }
+void Foo4(TEST_AND < REPEAT_1000(TRUE_T) REPEAT_1000(TRUE_T) true_type, false_type > t4) { sink(&t4); }
+void Foo5(TEST_AND < false_type, REPEAT_1000(TRUE_T) true_type > t5) { sink(&t5); }
+void Foo6(TEST_AND < false_type, REPEAT_1000(TRUE_T) REPEAT_1000(TRUE_T) true_type > t6) { sink(&t6); }
+
+void escape() {
+
+sink(&Foo1);
+sink(&Foo2);
+sink(&Foo3);
+sink(&Foo4);
+sink(&Foo5);
+sink(&Foo6);
+}
diff --git a/libcxx/test/libcxx-03/utilities/meta/stress_tests/stress_test_variant_overloads_impl.sh.cpp b/libcxx/test/libcxx-03/utilities/meta/stress_tests/stress_test_variant_overloads_impl.sh.cpp
new file mode 100644
index 0000000000000..b0512325d4c2c
--- /dev/null
+++ b/libcxx/test/libcxx-03/utilities/meta/stress_tests/stress_test_variant_overloads_impl.sh.cpp
@@ -0,0 +1,119 @@
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+//
+// This is a dummy feature that prevents this test from running by default.
+// REQUIRES: template-cost-testing
+
+// Test the cost of the mechanism used to create an overload set used by variant
+// to determine which alternative to construct.
+
+// The table below compares the compile time and object size for each of the
+// variants listed in the RUN script.
+//
+// Impl Compile Time Object Size
+// -----------------------------------------------------
+// flat: 959 ms 792 KiB
+// recursive: 23,444 ms 23,000 KiB
+// -----------------------------------------------------
+// variant_old: 16,894 ms 17,000 KiB
+// variant_new: 1,105 ms 828 KiB
+
+
+// RUN: %{cxx} %{flags} %{compile_flags} -std=c++17 -c %s \
+// RUN: -ggdb -ggnu-pubnames -ftemplate-depth=5000 -ftime-trace -g \
+// RUN: -DTEST_NS=flat_impl -o %S/flat.o
+// RUN: %{cxx} %{flags} %{compile_flags} -std=c++17 -c %s \
+// RUN: -ggdb -ggnu-pubnames -ftemplate-depth=5000 -ftime-trace -g \
+// RUN: -DTEST_NS=rec_impl -o %S/rec.o
+// RUN: %{cxx} %{flags} %{compile_flags} -std=c++17 -c %s \
+// RUN: -ggdb -ggnu-pubnames -ftemplate-depth=5000 -ftime-trace -g \
+// RUN: -DTEST_NS=variant_impl -o %S/variant.o
+
+#include <type_traits>
+#include <tuple>
+#include <cassert>
+#include <variant>
+
+#include "test_macros.h"
+#include "template_cost_testing.h"
+
+template <std::size_t Idx>
+struct TestType {};
+
+template <class T>
+struct ID {
+ using type = T;
+};
+
+namespace flat_impl {
+
+struct OverloadBase { void operator()() const; };
+
+template <class Tp, std::size_t Idx>
+struct Overload {
+ auto operator()(Tp, Tp) const -> ID<Tp>;
+};
+
+template <class ...Bases>
+struct AllOverloads : OverloadBase, Bases... {};
+
+template <class IdxSeq>
+struct MakeOverloads;
+
+template <std::size_t ..._Idx>
+struct MakeOverloads<std::__tuple_indices<_Idx...> > {
+ template <class ...Types>
+ using Apply = AllOverloads<Overload<Types, _Idx>...>;
+};
+
+template <class ...Types>
+using Overloads = typename MakeOverloads<
+ std::__make_indices_imp<sizeof...(Types), 0> >::template Apply<Types...>;
+
+} // namespace flat_impl
+
+
+namespace rec_impl {
+
+template <class... Types> struct Overload;
+
+template <>
+struct Overload<> { void operator()() const; };
+
+template <class Tp, class... Types>
+struct Overload<Tp, Types...> : Overload<Types...> {
+ using Overload<Types...>::operator();
+ auto operator()(Tp, Tp) const -> ID<Tp>;
+};
+
+template <class... Types>
+using Overloads = Overload<Types...>;
+
+} // namespace rec_impl
+
+namespace variant_impl {
+ template <class ...Types>
+ using Overloads = std::__variant_detail::_MakeOverloads<Types...>;
+ } // namespace variant_impl
+
+#ifndef TEST_NS
+#error TEST_NS must be defined
+#endif
+
+#define TEST_TYPE() TestType< __COUNTER__ >,
+using T1 = TEST_NS::Overloads<REPEAT_1000(TEST_TYPE) TestType<1>, TestType<1>, int>;
+static_assert(__COUNTER__ >= 1000, "");
+
+void fn1(T1 x) { DoNotOptimize(&x); }
+void fn2(typename std::invoke_result_t<T1, int, int>::type x) { DoNotOptimize(&x); }
+
+int main(int, char**) {
+ DoNotOptimize(&fn1);
+ DoNotOptimize(&fn2);
+ return 0;
+}
diff --git a/libcxx/test/libcxx-03/utilities/no_destroy.pass.cpp b/libcxx/test/libcxx-03/utilities/no_destroy.pass.cpp
new file mode 100644
index 0000000000000..8693bb17089dc
--- /dev/null
+++ b/libcxx/test/libcxx-03/utilities/no_destroy.pass.cpp
@@ -0,0 +1,33 @@
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// XFAIL: FROZEN-CXX03-HEADERS-FIXME
+
+#include <__utility/no_destroy.h>
+#include <cassert>
+
+#include "test_macros.h"
+
+#if TEST_STD_VER > 17
+// Test constexpr-constructibility.
+constinit std::__no_destroy<int> nd_int_const(std::__uninitialized_tag{});
+#endif
+
+struct DestroyLast {
+ ~DestroyLast() { assert(*ptr == 5); }
+
+ int* ptr;
+} last;
+
+static std::__no_destroy<int> nd_int(5);
+
+int main(int, char**) {
+ last.ptr = &nd_int.__get();
+
+ return 0;
+}
diff --git a/libcxx/test/libcxx-03/utilities/template.bitset/includes.pass.cpp b/libcxx/test/libcxx-03/utilities/template.bitset/includes.pass.cpp
new file mode 100644
index 0000000000000..ae8464ac946a9
--- /dev/null
+++ b/libcxx/test/libcxx-03/utilities/template.bitset/includes.pass.cpp
@@ -0,0 +1,33 @@
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// test that <bitset> includes <string>, <stdexcept> and <iosfwd>
+
+// XFAIL: FROZEN-CXX03-HEADERS-FIXME
+
+#include <bitset>
+
+#include "test_macros.h"
+
+#ifndef _LIBCPP_STRING
+#error <string> has not been included
+#endif
+
+#ifndef _LIBCPP_STDEXCEPT
+#error <stdexcept> has not been included
+#endif
+
+#ifndef _LIBCPP_IOSFWD
+#error <iosfwd> has not been included
+#endif
+
+int main(int, char**)
+{
+
+ return 0;
+}
diff --git a/libcxx/test/libcxx-03/utilities/utility/pairs/pairs.pair/abi.non_trivial_copy_move.pass.cpp b/libcxx/test/libcxx-03/utilities/utility/pairs/pairs.pair/abi.non_trivial_copy_move.pass.cpp
new file mode 100644
index 0000000000000..1f5dae1232e37
--- /dev/null
+++ b/libcxx/test/libcxx-03/utilities/utility/pairs/pairs.pair/abi.non_trivial_copy_move.pass.cpp
@@ -0,0 +1,154 @@
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// The test suite needs to define the ABI macros on the command line when
+// modules are enabled.
+// UNSUPPORTED: clang-modules-build
+
+// <utility>
+
+// template <class T1, class T2> struct pair
+
+// Test that we provide the non-trivial copy operations when _LIBCPP_DEPRECATED_ABI_DISABLE_PAIR_TRIVIAL_COPY_CTOR
+// is specified.
+// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DEPRECATED_ABI_DISABLE_PAIR_TRIVIAL_COPY_CTOR
+// ADDITIONAL_COMPILE_FLAGS: -Wno-macro-redefined -Wno-invalid-offsetof
+
+#include <utility>
+#include <type_traits>
+#include <cstdlib>
+#include <cstddef>
+#include <cassert>
+
+#include "test_macros.h"
+
+template <class T>
+struct HasNonTrivialABI : std::integral_constant<bool,
+ !std::is_trivially_destructible<T>::value
+ || (std::is_copy_constructible<T>::value && !std::is_trivially_copy_constructible<T>::value)
+#if TEST_STD_VER >= 11
+ || (std::is_move_constructible<T>::value && !std::is_trivially_move_constructible<T>::value)
+#endif
+> {};
+
+#if TEST_STD_VER >= 11
+struct NonTrivialDtor {
+ NonTrivialDtor(NonTrivialDtor const&) = default;
+ ~NonTrivialDtor();
+};
+NonTrivialDtor::~NonTrivialDtor() {}
+static_assert(HasNonTrivialABI<NonTrivialDtor>::value, "");
+
+struct NonTrivialCopy {
+ NonTrivialCopy(NonTrivialCopy const&);
+};
+NonTrivialCopy::NonTrivialCopy(NonTrivialCopy const&) {}
+static_assert(HasNonTrivialABI<NonTrivialCopy>::value, "");
+
+struct NonTrivialMove {
+ NonTrivialMove(NonTrivialMove const&) = default;
+ NonTrivialMove(NonTrivialMove&&);
+};
+NonTrivialMove::NonTrivialMove(NonTrivialMove&&) {}
+static_assert(HasNonTrivialABI<NonTrivialMove>::value, "");
+
+struct DeletedCopy {
+ DeletedCopy(DeletedCopy const&) = delete;
+ DeletedCopy(DeletedCopy&&) = default;
+};
+static_assert(!HasNonTrivialABI<DeletedCopy>::value, "");
+
+struct TrivialMove {
+ TrivialMove(TrivialMove &&) = default;
+};
+static_assert(!HasNonTrivialABI<TrivialMove>::value, "");
+
+struct Trivial {
+ Trivial(Trivial const&) = default;
+};
+static_assert(!HasNonTrivialABI<Trivial>::value, "");
+#endif
+
+
+void test_trivial()
+{
+ {
+ typedef std::pair<int, short> P;
+ static_assert(std::is_copy_constructible<P>::value, "");
+ static_assert(HasNonTrivialABI<P>::value, "");
+ }
+#if TEST_STD_VER >= 11
+ {
+ typedef std::pair<int, short> P;
+ static_assert(std::is_move_constructible<P>::value, "");
+ static_assert(HasNonTrivialABI<P>::value, "");
+ }
+ {
+ using P = std::pair<NonTrivialDtor, int>;
+ static_assert(!std::is_trivially_destructible<P>::value, "");
+ static_assert(std::is_copy_constructible<P>::value, "");
+ static_assert(!std::is_trivially_copy_constructible<P>::value, "");
+ static_assert(std::is_move_constructible<P>::value, "");
+ static_assert(!std::is_trivially_move_constructible<P>::value, "");
+ static_assert(HasNonTrivialABI<P>::value, "");
+ }
+ {
+ using P = std::pair<NonTrivialCopy, int>;
+ static_assert(std::is_copy_constructible<P>::value, "");
+ static_assert(!std::is_trivially_copy_constructible<P>::value, "");
+ static_assert(std::is_move_constructible<P>::value, "");
+ static_assert(!std::is_trivially_move_constructible<P>::value, "");
+ static_assert(HasNonTrivialABI<P>::value, "");
+ }
+ {
+ using P = std::pair<NonTrivialMove, int>;
+ static_assert(std::is_copy_constructible<P>::value, "");
+ static_assert(!std::is_trivially_copy_constructible<P>::value, "");
+ static_assert(std::is_move_constructible<P>::value, "");
+ static_assert(!std::is_trivially_move_constructible<P>::value, "");
+ static_assert(HasNonTrivialABI<P>::value, "");
+ }
+ {
+ using P = std::pair<DeletedCopy, int>;
+ static_assert(!std::is_copy_constructible<P>::value, "");
+ static_assert(!std::is_trivially_copy_constructible<P>::value, "");
+ static_assert(std::is_move_constructible<P>::value, "");
+ static_assert(!std::is_trivially_move_constructible<P>::value, "");
+ static_assert(HasNonTrivialABI<P>::value, "");
+ }
+ {
+ using P = std::pair<Trivial, int>;
+ static_assert(std::is_copy_constructible<P>::value, "");
+ static_assert(!std::is_trivially_copy_constructible<P>::value, "");
+ static_assert(std::is_move_constructible<P>::value, "");
+ static_assert(!std::is_trivially_move_constructible<P>::value, "");
+ static_assert(HasNonTrivialABI<P>::value, "");
+ }
+ {
+ using P = std::pair<TrivialMove, int>;
+ static_assert(!std::is_copy_constructible<P>::value, "");
+ static_assert(!std::is_trivially_copy_constructible<P>::value, "");
+ static_assert(std::is_move_constructible<P>::value, "");
+ static_assert(!std::is_trivially_move_constructible<P>::value, "");
+ static_assert(HasNonTrivialABI<P>::value, "");
+ }
+#endif
+}
+
+void test_layout() {
+ typedef std::pair<std::pair<char, char>, char> PairT;
+ static_assert(sizeof(PairT) == 3, "");
+ static_assert(TEST_ALIGNOF(PairT) == TEST_ALIGNOF(char), "");
+ static_assert(offsetof(PairT, first) == 0, "");
+}
+
+int main(int, char**) {
+ test_trivial();
+ test_layout();
+ return 0;
+}
diff --git a/libcxx/test/libcxx-03/utilities/utility/pairs/pairs.pair/abi.trivial_copy_move.pass.cpp b/libcxx/test/libcxx-03/utilities/utility/pairs/pairs.pair/abi.trivial_copy_move.pass.cpp
new file mode 100644
index 0000000000000..3ec60c08b8eab
--- /dev/null
+++ b/libcxx/test/libcxx-03/utilities/utility/pairs/pairs.pair/abi.trivial_copy_move.pass.cpp
@@ -0,0 +1,182 @@
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// <utility>
+
+// template <class T1, class T2> struct pair
+
+// Test that we properly provide the trivial copy operations by default.
+
+// FreeBSD still provides the old ABI for std::pair.
+// XFAIL: freebsd
+// ADDITIONAL_COMPILE_FLAGS: -Wno-invalid-offsetof
+
+#include <utility>
+#include <type_traits>
+#include <cstdlib>
+#include <cstddef>
+#include <cassert>
+
+#include "test_macros.h"
+
+template <class T>
+struct HasTrivialABI : std::integral_constant<bool,
+ std::is_trivially_destructible<T>::value
+ && (!std::is_copy_constructible<T>::value || std::is_trivially_copy_constructible<T>::value)
+#if TEST_STD_VER >= 11
+ && (!std::is_move_constructible<T>::value || std::is_trivially_move_constructible<T>::value)
+#endif
+> {};
+
+#if TEST_STD_VER >= 11
+struct NonTrivialDtor {
+ NonTrivialDtor(NonTrivialDtor const&) = default;
+ ~NonTrivialDtor();
+};
+NonTrivialDtor::~NonTrivialDtor() {}
+static_assert(!HasTrivialABI<NonTrivialDtor>::value, "");
+
+struct NonTrivialCopy {
+ NonTrivialCopy(NonTrivialCopy const&);
+};
+NonTrivialCopy::NonTrivialCopy(NonTrivialCopy const&) {}
+static_assert(!HasTrivialABI<NonTrivialCopy>::value, "");
+
+struct NonTrivialMove {
+ NonTrivialMove(NonTrivialMove const&) = default;
+ NonTrivialMove(NonTrivialMove&&);
+};
+NonTrivialMove::NonTrivialMove(NonTrivialMove&&) {}
+static_assert(!HasTrivialABI<NonTrivialMove>::value, "");
+
+struct DeletedCopy {
+ DeletedCopy(DeletedCopy const&) = delete;
+ DeletedCopy(DeletedCopy&&) = default;
+};
+static_assert(HasTrivialABI<DeletedCopy>::value, "");
+
+struct TrivialMove {
+ TrivialMove(TrivialMove &&) = default;
+};
+static_assert(HasTrivialABI<TrivialMove>::value, "");
+
+struct Trivial {
+ Trivial(Trivial const&) = default;
+};
+static_assert(HasTrivialABI<Trivial>::value, "");
+#endif
+
+struct TrivialNoAssignment {
+ int arr[4];
+ TrivialNoAssignment& operator=(const TrivialNoAssignment&) = delete;
+};
+
+struct TrivialNoConstruction {
+ int arr[4];
+ TrivialNoConstruction() = default;
+ TrivialNoConstruction(const TrivialNoConstruction&) = delete;
+ TrivialNoConstruction& operator=(const TrivialNoConstruction&) = default;
+};
+
+void test_trivial()
+{
+ {
+ typedef std::pair<int, short> P;
+ static_assert(std::is_copy_constructible<P>::value, "");
+ static_assert(HasTrivialABI<P>::value, "");
+ }
+#if TEST_STD_VER >= 11
+ {
+ typedef std::pair<int, short> P;
+ static_assert(std::is_move_constructible<P>::value, "");
+ static_assert(HasTrivialABI<P>::value, "");
+ }
+ {
+ using P = std::pair<NonTrivialDtor, int>;
+ static_assert(!std::is_trivially_destructible<P>::value, "");
+ static_assert(std::is_copy_constructible<P>::value, "");
+ static_assert(!std::is_trivially_copy_constructible<P>::value, "");
+ static_assert(std::is_move_constructible<P>::value, "");
+ static_assert(!std::is_trivially_move_constructible<P>::value, "");
+ static_assert(!HasTrivialABI<P>::value, "");
+ }
+ {
+ using P = std::pair<NonTrivialCopy, int>;
+ static_assert(std::is_copy_constructible<P>::value, "");
+ static_assert(!std::is_trivially_copy_constructible<P>::value, "");
+ static_assert(std::is_move_constructible<P>::value, "");
+ static_assert(!std::is_trivially_move_constructible<P>::value, "");
+ static_assert(!HasTrivialABI<P>::value, "");
+ }
+ {
+ using P = std::pair<NonTrivialMove, int>;
+ static_assert(std::is_copy_constructible<P>::value, "");
+ static_assert(std::is_trivially_copy_constructible<P>::value, "");
+ static_assert(std::is_move_constructible<P>::value, "");
+ static_assert(!std::is_trivially_move_constructible<P>::value, "");
+ static_assert(!HasTrivialABI<P>::value, "");
+ }
+ {
+ using P = std::pair<DeletedCopy, int>;
+ static_assert(!std::is_copy_constructible<P>::value, "");
+ static_assert(!std::is_trivially_copy_constructible<P>::value, "");
+ static_assert(std::is_move_constructible<P>::value, "");
+ static_assert(std::is_trivially_move_constructible<P>::value, "");
+ static_assert(HasTrivialABI<P>::value, "");
+ }
+ {
+ using P = std::pair<Trivial, int>;
+ static_assert(std::is_copy_constructible<P>::value, "");
+ static_assert(std::is_trivially_copy_constructible<P>::value, "");
+ static_assert(std::is_move_constructible<P>::value, "");
+ static_assert(std::is_trivially_move_constructible<P>::value, "");
+ static_assert(HasTrivialABI<P>::value, "");
+ }
+ {
+ using P = std::pair<TrivialMove, int>;
+ static_assert(!std::is_copy_constructible<P>::value, "");
+ static_assert(!std::is_trivially_copy_constructible<P>::value, "");
+ static_assert(std::is_move_constructible<P>::value, "");
+ static_assert(std::is_trivially_move_constructible<P>::value, "");
+ static_assert(HasTrivialABI<P>::value, "");
+ }
+#endif
+ {
+ using P = std::pair<TrivialNoAssignment, int>;
+ static_assert(std::is_trivially_copy_constructible<P>::value, "");
+ static_assert(std::is_trivially_move_constructible<P>::value, "");
+#if TEST_STD_VER >= 11 // This is https://llvm.org/PR90605
+ static_assert(!std::is_trivially_copy_assignable<P>::value, "");
+ static_assert(!std::is_trivially_move_assignable<P>::value, "");
+#endif // TEST_STD_VER >= 11
+ static_assert(std::is_trivially_destructible<P>::value, "");
+ }
+ {
+ using P = std::pair<TrivialNoConstruction, int>;
+#if TEST_STD_VER >= 11
+ static_assert(!std::is_trivially_copy_constructible<P>::value, "");
+ static_assert(!std::is_trivially_move_constructible<P>::value, "");
+#endif // TEST_STD_VER >= 11
+ static_assert(!std::is_trivially_copy_assignable<P>::value, "");
+ static_assert(!std::is_trivially_move_assignable<P>::value, "");
+ static_assert(std::is_trivially_destructible<P>::value, "");
+ }
+}
+
+void test_layout() {
+ typedef std::pair<std::pair<char, char>, char> PairT;
+ static_assert(sizeof(PairT) == 3, "");
+ static_assert(TEST_ALIGNOF(PairT) == TEST_ALIGNOF(char), "");
+ static_assert(offsetof(PairT, first) == 0, "");
+}
+
+int main(int, char**) {
+ test_trivial();
+ test_layout();
+ return 0;
+}
diff --git a/libcxx/test/libcxx-03/utilities/utility/pairs/pairs.pair/abi.trivially_copyable.compile.pass.cpp b/libcxx/test/libcxx-03/utilities/utility/pairs/pairs.pair/abi.trivially_copyable.compile.pass.cpp
new file mode 100644
index 0000000000000..1132b3e5def18
--- /dev/null
+++ b/libcxx/test/libcxx-03/utilities/utility/pairs/pairs.pair/abi.trivially_copyable.compile.pass.cpp
@@ -0,0 +1,68 @@
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+//
+// This test pins down the ABI of std::pair with respect to being "trivially copyable".
+//
+
+// This test doesn't work when the deprecated ABI to turn off pair triviality is enabled.
+// See libcxx/test/libcxx/utilities/utility/pairs/pairs.pair/abi.non_trivial_copy_move.pass.cpp instead.
+// UNSUPPORTED: libcpp-deprecated-abi-disable-pair-trivial-copy-ctor
+
+#include <type_traits>
+#include <utility>
+
+#include "test_macros.h"
+
+struct trivially_copyable {
+ int arr[4];
+};
+
+struct trivially_copyable_no_copy_assignment {
+ int arr[4];
+ trivially_copyable_no_copy_assignment& operator=(const trivially_copyable_no_copy_assignment&) = delete;
+};
+static_assert(std::is_trivially_copyable<trivially_copyable_no_copy_assignment>::value, "");
+
+struct trivially_copyable_no_move_assignment {
+ int arr[4];
+ trivially_copyable_no_move_assignment& operator=(const trivially_copyable_no_move_assignment&) = delete;
+};
+static_assert(std::is_trivially_copyable<trivially_copyable_no_move_assignment>::value, "");
+
+struct trivially_copyable_no_construction {
+ int arr[4];
+ trivially_copyable_no_construction() = default;
+ trivially_copyable_no_construction(const trivially_copyable_no_construction&) = delete;
+ trivially_copyable_no_construction& operator=(const trivially_copyable_no_construction&) = default;
+};
+static_assert(std::is_trivially_copyable<trivially_copyable_no_construction>::value, "");
+
+static_assert(!std::is_trivially_copyable<std::pair<int&, int> >::value, "");
+static_assert(!std::is_trivially_copyable<std::pair<int, int&> >::value, "");
+static_assert(!std::is_trivially_copyable<std::pair<int&, int&> >::value, "");
+
+static_assert(!std::is_trivially_copyable<std::pair<int, int> >::value, "");
+static_assert(!std::is_trivially_copyable<std::pair<int, char> >::value, "");
+static_assert(!std::is_trivially_copyable<std::pair<char, int> >::value, "");
+static_assert(!std::is_trivially_copyable<std::pair<std::pair<char, char>, int> >::value, "");
+static_assert(!std::is_trivially_copyable<std::pair<trivially_copyable, int> >::value, "");
+#if TEST_STD_VER == 03 // Known ABI difference
+static_assert(!std::is_trivially_copyable<std::pair<trivially_copyable_no_copy_assignment, int> >::value, "");
+static_assert(!std::is_trivially_copyable<std::pair<trivially_copyable_no_move_assignment, int> >::value, "");
+#else
+static_assert(std::is_trivially_copyable<std::pair<trivially_copyable_no_copy_assignment, int> >::value, "");
+static_assert(std::is_trivially_copyable<std::pair<trivially_copyable_no_move_assignment, int> >::value, "");
+#endif
+static_assert(!std::is_trivially_copyable<std::pair<trivially_copyable_no_construction, int> >::value, "");
+
+static_assert(std::is_trivially_copy_constructible<std::pair<int, int> >::value, "");
+static_assert(std::is_trivially_move_constructible<std::pair<int, int> >::value, "");
+static_assert(!std::is_trivially_copy_assignable<std::pair<int, int> >::value, "");
+static_assert(!std::is_trivially_move_assignable<std::pair<int, int> >::value, "");
+static_assert(std::is_trivially_destructible<std::pair<int, int> >::value, "");
diff --git a/libcxx/test/libcxx-03/utilities/utility/pairs/pairs.pair/pair.incomplete.compile.pass.cpp b/libcxx/test/libcxx-03/utilities/utility/pairs/pairs.pair/pair.incomplete.compile.pass.cpp
new file mode 100644
index 0000000000000..16ee000cd90fa
--- /dev/null
+++ b/libcxx/test/libcxx-03/utilities/utility/pairs/pairs.pair/pair.incomplete.compile.pass.cpp
@@ -0,0 +1,22 @@
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// Check that instantiating pair doesn't look up type traits "too early", before
+// the contained types have been completed.
+//
+// This is a regression test, to prevent a reoccurrance of the issue introduced
+// in 5e1de27f680591a870d78e9952b23f76aed7f456.
+
+#include <utility>
+#include <vector>
+
+struct Test {
+ std::vector<std::pair<int, Test> > v;
+};
+
+std::pair<int, Test> p;
diff --git a/libcxx/test/libcxx-03/utilities/utility/pairs/pairs.pair/pair.tuple_element.verify.cpp b/libcxx/test/libcxx-03/utilities/utility/pairs/pairs.pair/pair.tuple_element.verify.cpp
new file mode 100644
index 0000000000000..7d10d8b23cee1
--- /dev/null
+++ b/libcxx/test/libcxx-03/utilities/utility/pairs/pairs.pair/pair.tuple_element.verify.cpp
@@ -0,0 +1,21 @@
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// <utility>
+
+// template <class T1, class T2> struct pair
+
+// tuple_element<I, pair<T1, T2> >::type
+
+#include <utility>
+
+void f() {
+ typedef std::pair<int, double> P;
+ std::tuple_element<2, P>::type foo; // expected-note {{requested here}}
+ // expected-error-re@*:* {{static assertion failed{{( due to requirement '2U[L]{0,2} < 2')?}}{{.*}}Index out of bounds in std::tuple_element<std::pair<T1, T2>>}}
+}
diff --git a/libcxx/test/libcxx-03/utilities/utility/private_constructor_tag.compile.pass.cpp b/libcxx/test/libcxx-03/utilities/utility/private_constructor_tag.compile.pass.cpp
new file mode 100644
index 0000000000000..1644819a02f7f
--- /dev/null
+++ b/libcxx/test/libcxx-03/utilities/utility/private_constructor_tag.compile.pass.cpp
@@ -0,0 +1,22 @@
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// XFAIL: FROZEN-CXX03-HEADERS-FIXME
+
+// struct __private_constructor_tag{};
+
+// The private constructor tag is intended to be a trivial type that can easily
+// be used to mark a constructor exposition-only.
+//
+// Tests whether the type is trivial.
+
+#include <__utility/private_constructor_tag.h>
+#include <type_traits>
+
+static_assert(std::is_trivially_copyable<std::__private_constructor_tag>::value, "");
+static_assert(std::is_trivially_default_constructible<std::__private_constructor_tag>::value, "");
diff --git a/libcxx/test/libcxx-03/vendor/apple/availability-with-pedantic-errors.compile.pass.cpp b/libcxx/test/libcxx-03/vendor/apple/availability-with-pedantic-errors.compile.pass.cpp
new file mode 100644
index 0000000000000..118e4e687e115
--- /dev/null
+++ b/libcxx/test/libcxx-03/vendor/apple/availability-with-pedantic-errors.compile.pass.cpp
@@ -0,0 +1,22 @@
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// REQUIRES: stdlib=apple-libc++
+
+// Test that using -pedantic-errors doesn't turn off availability annotations.
+// This used to be the case because we used __has_extension(...) to enable the
+// availability annotations, and -pedantic-errors changes the behavior of
+// __has_extension(...) in an incompatible way.
+
+// ADDITIONAL_COMPILE_FLAGS: -pedantic-errors
+
+#include <__config>
+
+#if !_LIBCPP_HAS_VENDOR_AVAILABILITY_ANNOTATIONS
+# error Availability annotations should be enabled on Apple platforms in the system configuration!
+#endif
diff --git a/libcxx/test/libcxx-03/vendor/apple/disable-availability.sh.cpp b/libcxx/test/libcxx-03/vendor/apple/disable-availability.sh.cpp
new file mode 100644
index 0000000000000..474b3f83c6044
--- /dev/null
+++ b/libcxx/test/libcxx-03/vendor/apple/disable-availability.sh.cpp
@@ -0,0 +1,49 @@
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// REQUIRES: stdlib=apple-libc++
+
+// This test is dependent on the code generated by the compiler, and it doesn't
+// work properly with older AppleClangs.
+// UNSUPPORTED: apple-clang-15
+
+// This test ensures that we retain a way to disable availability markup on Apple platforms
+// in order to work around Clang bug https://github.com/llvm/llvm-project/issues/134151.
+//
+// Once that bug has been fixed or once we've made changes to libc++'s use of availability
+// that render that workaround unnecessary, the macro and this test can be removed.
+//
+// The test works by creating a final linked image that refers to a function marked with
+// both an availability attribute and with _LIBCPP_HIDE_FROM_ABI. We then check that this
+// generates a weak reference to the function -- without the bug, we'd expect a strong
+// reference or no reference at all instead.
+
+// First, test the test. Make sure that we do (incorrectly) produce a weak definition when we
+// don't define _LIBCPP_DISABLE_AVAILABILITY. Otherwise, something may have changed in libc++
+// and this test might not work anymore.
+// RUN: %{cxx} %s %{flags} %{compile_flags} %{link_flags} -fvisibility=hidden -fvisibility-inlines-hidden -shared -o %t.1.dylib
+// RUN: nm -m %t.1.dylib | c++filt | grep value > %t.1.symbols
+// RUN: grep weak %t.1.symbols
+
+// Now, make sure that 'weak' goes away when we define _LIBCPP_DISABLE_AVAILABILITY.
+// In fact, all references to the function might go away, so we just check that we don't emit
+// any weak reference.
+// RUN: %{cxx} %s %{flags} %{compile_flags} %{link_flags} -fvisibility=hidden -fvisibility-inlines-hidden -D_LIBCPP_DISABLE_AVAILABILITY -shared -o %t.2.dylib
+// RUN: nm -m %t.2.dylib | c++filt | grep value > %t.2.symbols
+// RUN: not grep weak %t.2.symbols
+
+#include <version>
+
+template <class T>
+struct optional {
+ T val_;
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_INTRODUCED_IN_LLVM_11_ATTRIBUTE T value() const { return val_; }
+};
+
+using PMF = int (optional<int>::*)() const;
+PMF f() { return &optional<int>::value; }
diff --git a/libcxx/test/libcxx-03/vendor/apple/system-install-properties.sh.cpp b/libcxx/test/libcxx-03/vendor/apple/system-install-properties.sh.cpp
new file mode 100644
index 0000000000000..eeae4fc0a3c00
--- /dev/null
+++ b/libcxx/test/libcxx-03/vendor/apple/system-install-properties.sh.cpp
@@ -0,0 +1,46 @@
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// REQUIRES: stdlib=apple-libc++
+
+// This file checks various properties of the installation of libc++ when built as
+// a system library on Apple platforms.
+
+// Make sure we install the libc++ headers in the right location.
+//
+// RUN: stat "%{include-dir}/__config"
+
+// Make sure we install libc++.1.dylib and libc++experimental.a in the right location.
+//
+// RUN: stat "%{lib-dir}/libc++.1.dylib"
+// RUN: stat "%{lib-dir}/libc++experimental.a"
+
+// Make sure we install a symlink from libc++.dylib to libc++.1.dylib.
+//
+// RUN: stat "%{lib-dir}/libc++.dylib"
+// RUN: readlink "%{lib-dir}/libc++.dylib" | grep "libc++.1.dylib"
+
+// Make sure the install_name is /usr/lib.
+//
+// In particular, make sure we don't use any @rpath in the load commands. When building as
+// a system library, it is important to hardcode the installation paths in the dylib, because
+// various tools like dyld and ld64 will treat us specially if they recognize us as being a
+// system library.
+//
+// RUN: otool -L "%{lib-dir}/libc++.1.dylib" | grep '/usr/lib/libc++.1.dylib'
+// RUN: otool -l "%{lib-dir}/libc++.1.dylib" | grep -vE "LC_RPATH|@loader_path|@rpath"
+
+// Make sure the compatibility_version of libc++ is 1.0.0.
+// Failure to respect this can result in applications not being able to find libc++
+// when they are loaded by dyld, if the compatibility version was bumped.
+//
+// RUN: otool -L "%{lib-dir}/libc++.1.dylib" | grep "libc++.1.dylib" | grep "compatibility version 1.0.0"
+
+// Make sure we use the libdispatch backend for the PSTL.
+//
+// RUN: grep "%{include-dir}/__config_site" -e '#define _LIBCPP_PSTL_BACKEND_LIBDISPATCH'
diff --git a/libcxx/test/libcxx-03/vendor/clang-cl/static-lib-exports.sh.cpp b/libcxx/test/libcxx-03/vendor/clang-cl/static-lib-exports.sh.cpp
new file mode 100644
index 0000000000000..7ed14921b1067
--- /dev/null
+++ b/libcxx/test/libcxx-03/vendor/clang-cl/static-lib-exports.sh.cpp
@@ -0,0 +1,16 @@
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// REQUIRES: msvc
+
+// This file checks that the built static libraries don't contain dllexport
+// directives in clang-cl builds.
+
+// RUN: llvm-readobj --coff-directives "%{lib-dir}/libc++.lib" | not grep -i "export:" > /dev/null
+
+// RUN: llvm-readobj --coff-directives "%{lib-dir}/libc++experimental.lib" | not grep -i "export:" > /dev/null
diff --git a/libcxx/test/libcxx-03/vendor/ibm/bad_function_call.pass.cpp b/libcxx/test/libcxx-03/vendor/ibm/bad_function_call.pass.cpp
new file mode 100644
index 0000000000000..3714e4037a2dc
--- /dev/null
+++ b/libcxx/test/libcxx-03/vendor/ibm/bad_function_call.pass.cpp
@@ -0,0 +1,45 @@
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// REQUIRES: target={{.+}}-aix{{.*}}
+// ADDITIONAL_COMPILE_FLAGS: -fvisibility-inlines-hidden
+
+// When there is a weak hidden symbol in user code and a strong definition
+// in the library, we test that the linker relies on the library version,
+// as the default weak resolution semantics don't favour weak local definitions
+// for XCOFF. This creates a conflict on std::bad_function_call, which is used
+// by the std::function template instantiated in main.
+#include <functional>
+#include "test_macros.h"
+#include "assert.h"
+
+void foo() {}
+
+void test_call() {
+ std::function<void()> r(foo);
+ r();
+}
+
+void test_throw() {
+#ifndef TEST_HAS_NO_EXCEPTIONS
+ std::function<int()> f;
+ try {
+ f();
+ assert(false);
+ } catch (const std::bad_function_call&) {
+ return;
+ }
+ assert(false);
+#endif // TEST_HAS_NO_EXCEPTIONS
+}
+
+int main(int, char**) {
+ test_call();
+ test_throw();
+ return 0;
+}
diff --git a/libcxx/test/libcxx-03/vendor/mingw/static-lib-exports.sh.cpp b/libcxx/test/libcxx-03/vendor/mingw/static-lib-exports.sh.cpp
new file mode 100644
index 0000000000000..e20269f91e485
--- /dev/null
+++ b/libcxx/test/libcxx-03/vendor/mingw/static-lib-exports.sh.cpp
@@ -0,0 +1,16 @@
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// REQUIRES: target={{.+}}-windows-gnu
+
+// This file checks that the built static libraries don't contain dllexport
+// directives in MinGW builds.
+
+// RUN: llvm-readobj --coff-directives "%{lib-dir}/libc++.a" | not grep -i "export:" > /dev/null
+
+// RUN: llvm-readobj --coff-directives "%{lib-dir}/libc++experimental.a" | not grep -i "export:" > /dev/null
diff --git a/libcxx/test/libcxx-03/xopen_source.gen.py b/libcxx/test/libcxx-03/xopen_source.gen.py
new file mode 100644
index 0000000000000..d4a3651181ca7
--- /dev/null
+++ b/libcxx/test/libcxx-03/xopen_source.gen.py
@@ -0,0 +1,56 @@
+# ===----------------------------------------------------------------------===##
+#
+# Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+# See https://llvm.org/LICENSE.txt for license information.
+# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+#
+# ===----------------------------------------------------------------------===##
+
+# Make sure that libc++ headers work when defining _XOPEN_SOURCE=500.
+# We may not want to guarantee this forever, but since this works today and
+# it's something that users rely on, it makes sense to put a test on it.
+#
+# https://github.com/llvm/llvm-project/issues/117630
+
+# RUN: %{python} %s %{libcxx-dir}/utils
+# END.
+
+import sys
+
+sys.path.append(sys.argv[1])
+from libcxx.header_information import (
+ lit_header_restrictions,
+ lit_header_undeprecations,
+ public_headers,
+)
+
+for header in public_headers:
+ for version in (500, 600, 700):
+ # TODO: <fstream> currently uses ::fseeko unguarded, which fails with _XOPEN_SOURCE=500.
+ if header == "fstream" and version == 500:
+ continue
+
+ print(
+ f"""\
+//--- {header}.xopen_source_{version}.compile.pass.cpp
+
+// Some parts of the code like <fstream> use non-standard functions in their implementation,
+// and these functions are not provided when _XOPEN_SOURCE is set to older values. This
+// breaks when building with modules even when we don't use the offending headers directly.
+// UNSUPPORTED: clang-modules-build
+
+// The AIX localization support uses some functions as part of their headers that require a
+// recent value of _XOPEN_SOURCE.
+// UNSUPPORTED: LIBCXX-AIX-FIXME
+
+// This test fails on FreeBSD for an unknown reason.
+// UNSUPPORTED: LIBCXX-FREEBSD-FIXME
+
+{lit_header_restrictions.get(header, '')}
+{lit_header_undeprecations.get(header, '')}
+
+// ADDITIONAL_COMPILE_FLAGS: -D_XOPEN_SOURCE={version}
+
+#include <{header}>
+"""
+ )
diff --git a/libcxx/test/libcxx/lit.local.cfg b/libcxx/test/libcxx/lit.local.cfg
new file mode 100644
index 0000000000000..95847cd72ee30
--- /dev/null
+++ b/libcxx/test/libcxx/lit.local.cfg
@@ -0,0 +1,4 @@
+
+# disable libcxx tests when running against the frozen headers. We have separate tests for C++03.
+if "FROZEN-CXX03-HEADERS-FIXME" in config.available_features:
+ config.unsupported = True
More information about the libcxx-commits
mailing list