From e657e64b576ec740d3ac7b51a2eee96116236c74 Mon Sep 17 00:00:00 2001 From: Nikolas Klauser 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 + .../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 + .../associative/map/at.abort.pass.cpp | 33 + .../associative/map/at.const.abort.pass.cpp | 33 + .../reference_comparator_abi.compile.pass.cpp | 57 + .../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.set/abi.compile.pass.cpp | 139 + .../container_traits.compile.pass.cpp | 165 + .../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 + .../deque/segmented_iterator.compile.pass.cpp | 12 + .../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/invalid_allocator.verify.cpp | 29 + .../unord/key_value_traits.pass.cpp | 60 + .../containers/unord/next_prime.pass.cpp | 51 + .../auto.ptr/auto_ptr.cxx1z.pass.cpp | 31 + .../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 + .../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 + libcxx/test/libcxx-03/lint/lint_headers.sh.py | 63 + libcxx/test/libcxx-03/lit.local.cfg | 7 + .../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 + 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 + .../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 + .../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 + 223 files changed, 34382 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.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/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/reference_comparator_abi.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.set/abi.compile.pass.cpp create mode 100644 libcxx/test/libcxx-03/containers/container_traits.compile.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/segmented_iterator.compile.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/invalid_allocator.verify.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.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/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_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/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/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/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 +// +//===----------------------------------------------------------------------===// + +// + +// template +// void +// random_shuffle(RandomAccessIterator first, RandomAccessIterator last); +// +// template +// 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 , 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 +#include +#include + +#include "test_macros.h" + +struct gen +{ + std::ptrdiff_t operator()(std::ptrdiff_t n) + { + return n-1; + } +}; + + +int main(int, char**) +{ + std::vector 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 +#include +#include +#include + +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::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 +// +//===----------------------------------------------------------------------===// + +// + +// __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 +#include +#include + +#include "test_macros.h" +#include "user_defined_integral.h" + +namespace { + +template +TEST_CONSTEXPR bool test(IntType max_v = IntType(std::numeric_limits::max())) { + return std::__half_positive(max_v) == max_v / 2; +} + +} // namespace + +int main(int, char**) +{ + { + assert(test()); + assert(test()); + assert(test()); + assert((test, int>())); + assert(test()); +#if !defined(TEST_HAS_NO_INT128) + assert(test<__int128_t>()); +#endif // !defined(TEST_HAS_NO_INT128) + } + +#if TEST_STD_VER >= 11 + { + static_assert(test(), ""); + static_assert(test(), ""); + static_assert(test(), ""); + static_assert(test(), ""); +#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 +// +//===----------------------------------------------------------------------===// + +// + +// REQUIRES: libcpp-pstl-backend-libdispatch + +// __chunk_partitions __partition_chunks(ptrdiff_t); + +#include <__pstl/backends/libdispatch.h> +#include +#include + +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 +// +//===----------------------------------------------------------------------===// + +// + +#include +#include +#include +#include +#include +#include +#include +#include + +#include "test_macros.h" + +template +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 +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 +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 +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 +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 +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 +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 +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 +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(&copies)); + assert(copies == 0); +#if TEST_STD_VER >= 11 + (void)std::all_of(first, last, UnaryTrue(&copies)); + assert(copies == 0); + (void)std::any_of(first, last, UnaryTrue(&copies)); + assert(copies == 0); +#endif + (void)std::binary_search(first, last, value, Less(&copies)); + assert(copies == 0); +#if TEST_STD_VER > 17 + (void)std::clamp(value, value, value, Less(&copies)); + assert(copies == 0); +#endif + (void)std::count_if(first, last, UnaryTrue(&copies)); + assert(copies == 0); + (void)std::copy_if(first, last, first2, UnaryTrue(&copies)); + assert(copies == 0); + (void)std::equal(first, last, first2, Equal(&copies)); + assert(copies == 0); +#if TEST_STD_VER > 11 + (void)std::equal(first, last, first2, last2, Equal(&copies)); + assert(copies == 0); +#endif + (void)std::equal_range(first, last, value, Less(&copies)); + assert(copies == 0); + (void)std::find_end(first, last, first2, mid2, Equal(&copies)); + assert(copies == 0); + (void)std::find_first_of(first, last, first2, last2, Equal(&copies)); + assert(copies == 0); + (void)std::find_if(first, last, UnaryTrue(&copies)); + assert(copies == 0); + (void)std::find_if_not(first, last, UnaryTrue(&copies)); + assert(copies == 0); + (void)std::for_each(first, last, UnaryVoid(&copies)); + assert(copies == 1); + copies = 0; +#if TEST_STD_VER > 14 + (void)std::for_each_n(first, count, UnaryVoid(&copies)); + assert(copies == 0); +#endif + (void)std::generate(first, last, NullaryValue(&copies)); + assert(copies == 0); + (void)std::generate_n(first, count, NullaryValue(&copies)); + assert(copies == 0); + (void)std::includes(first, last, first2, last2, Less(&copies)); + assert(copies == 0); + (void)std::is_heap(first, last, Less(&copies)); + assert(copies == 0); + (void)std::is_heap_until(first, last, Less(&copies)); + assert(copies == 0); + (void)std::is_partitioned(first, last, UnaryTrue(&copies)); + assert(copies == 0); + (void)std::is_permutation(first, last, first2, Equal(&copies)); + assert(copies == 0); +#if TEST_STD_VER > 11 + (void)std::is_permutation(first, last, first2, last2, Equal(&copies)); + assert(copies == 0); +#endif + (void)std::is_sorted(first, last, Less(&copies)); + assert(copies == 0); + (void)std::is_sorted_until(first, last, Less(&copies)); + assert(copies == 0); + if (!TEST_IS_CONSTANT_EVALUATED) { + (void)std::inplace_merge(first, mid, last, Less(&copies)); + assert(copies == 0); + } + (void)std::lexicographical_compare(first, last, first2, last2, Less(&copies)); + assert(copies == 0); +#if TEST_STD_VER > 17 + (void)std::lexicographical_compare_three_way(first, last, first2, last2, ThreeWay(&copies)); + assert(copies == 0); +#endif + (void)std::lower_bound(first, last, value, Less(&copies)); + assert(copies == 0); + (void)std::make_heap(first, last, Less(&copies)); + assert(copies == 0); + (void)std::max(value, value, Less(&copies)); + assert(copies == 0); +#if TEST_STD_VER >= 11 + (void)std::max({value, value}, Less(&copies)); + assert(copies == 0); +#endif + (void)std::max_element(first, last, Less(&copies)); + assert(copies == 0); + (void)std::merge(first, mid, mid, last, first2, Less(&copies)); + assert(copies == 0); + (void)std::min(value, value, Less(&copies)); + assert(copies == 0); +#if TEST_STD_VER >= 11 + (void)std::min({value, value}, Less(&copies)); + assert(copies == 0); +#endif + (void)std::min_element(first, last, Less(&copies)); + assert(copies == 0); + (void)std::minmax(value, value, Less(&copies)); + assert(copies == 0); +#if TEST_STD_VER >= 11 + (void)std::minmax({value, value}, Less(&copies)); + assert(copies == 0); +#endif + (void)std::minmax_element(first, last, Less(&copies)); + assert(copies == 0); + (void)std::mismatch(first, last, first2, Equal(&copies)); + assert(copies == 0); +#if TEST_STD_VER > 11 + (void)std::mismatch(first, last, first2, last2, Equal(&copies)); + assert(copies == 0); +#endif + (void)std::next_permutation(first, last, Less(&copies)); + assert(copies == 0); +#if TEST_STD_VER >= 11 + (void)std::none_of(first, last, UnaryTrue(&copies)); + assert(copies == 0); +#endif + (void)std::nth_element(first, mid, last, Less(&copies)); + assert(copies == 0); + (void)std::partial_sort(first, mid, last, Less(&copies)); + assert(copies == 0); + (void)std::partial_sort_copy(first, last, first2, mid2, Less(&copies)); + assert(copies == 0); + (void)std::partition(first, last, UnaryTrue(&copies)); + assert(copies == 0); + (void)std::partition_copy(first, last, first2, last2, UnaryTrue(&copies)); + assert(copies == 0); + (void)std::partition_point(first, last, UnaryTrue(&copies)); + assert(copies == 0); + (void)std::pop_heap(first, last, Less(&copies)); + assert(copies == 0); + (void)std::prev_permutation(first, last, Less(&copies)); + assert(copies == 0); + (void)std::push_heap(first, last, Less(&copies)); + assert(copies == 0); + (void)std::remove_copy_if(first, last, first2, UnaryTrue(&copies)); + assert(copies == 0); + (void)std::remove_if(first, last, UnaryTrue(&copies)); + assert(copies == 0); + (void)std::replace_copy_if(first, last, first2, UnaryTrue(&copies), value); + assert(copies == 0); + (void)std::replace_if(first, last, UnaryTrue(&copies), value); + assert(copies == 0); + (void)std::search(first, last, first2, mid2, Equal(&copies)); + assert(copies == 0); + (void)std::search_n(first, last, count, value, Equal(&copies)); + assert(copies == 0); + (void)std::set_difference(first, mid, mid, last, first2, Less(&copies)); + assert(copies == 0); + (void)std::set_intersection(first, mid, mid, last, first2, Less(&copies)); + assert(copies == 0); + (void)std::set_symmetric_difference(first, mid, mid, last, first2, Less(&copies)); + assert(copies == 0); + (void)std::set_union(first, mid, mid, last, first2, Less(&copies)); + assert(copies == 0); + (void)std::sort(first, first + 3, Less(&copies)); + assert(copies == 0); + (void)std::sort(first, first + 4, Less(&copies)); + assert(copies == 0); + (void)std::sort(first, first + 5, Less(&copies)); + assert(copies == 0); + (void)std::sort(first, last, Less(&copies)); + assert(copies == 0); + (void)std::sort_heap(first, last, Less(&copies)); + assert(copies == 0); + if (!TEST_IS_CONSTANT_EVALUATED) { + (void)std::stable_partition(first, last, UnaryTrue(&copies)); + assert(copies == 0); + } + if (!TEST_IS_CONSTANT_EVALUATED) { + (void)std::stable_sort(first, last, Less(&copies)); + assert(copies == 0); + } + (void)std::transform(first, last, first2, UnaryTransform(&copies)); + assert(copies == 0); + (void)std::transform(first, mid, mid, first2, BinaryTransform(&copies)); + assert(copies == 0); + (void)std::unique(first, last, Equal(&copies)); + assert(copies == 0); + (void)std::unique_copy(first, last, first2, Equal(&copies)); + assert(copies == 0); + (void)std::upper_bound(first, last, value, Less(&copies)); + assert(copies == 0); + + return true; +} + +bool test_segmented_iterator() { + int copies = 0; + std::deque dq(10); + (void)std::for_each(dq.begin(), dq.end(), UnaryVoid(&copies)); + assert(copies == 1); + copies = 0; + +#if TEST_STD_VER >= 20 + std::vector> vecs(3, std::vector(10)); + auto v = std::views::join(vecs); + (void)std::for_each(v.begin(), v.end(), UnaryVoid(&copies)); + assert(copies == 1); + copies = 0; +#endif + + return true; +} + +int main(int, char**) { + all_the_algorithms(); + all_the_algorithms(); + assert(test_segmented_iterator()); +#if TEST_STD_VER > 17 + static_assert(all_the_algorithms()); + static_assert(all_the_algorithms()); +#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 +#include +#include +#include + +#include "test_macros.h" + +template +struct IteratorAdaptorBase { + using OutTraits = std::iterator_traits; + 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(*this); } + const Sub& sub() const { return static_cast(*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(*this); } + Sub& operator--() { return static_cast(*this); } + Sub operator++(int) { return static_cast(*this); } + Sub operator--(int) { return static_cast(*this); } + + Sub& operator+=(difference_type) { return static_cast(*this); } + Sub& operator-=(difference_type) { return static_cast(*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 +struct Cpp20HostileIterator + : IteratorAdaptorBase, 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 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>(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 +#include +#include +#include + +#include "test_macros.h" + +template +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 first(array); + Iterator middle(array + 3); + Iterator 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 + +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 + +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 +#include + +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 + +// 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 + +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 + +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.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 +#include + +#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::type, + std::underlying_type::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 after +// has been included. Before C++23, this otherwise leads to obscure errors +// because may try to redefine things defined by . + +// 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 +#include + +// expected-error@*:* {{ is incompatible with 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 + +// + +// template +// T* atomic_fetch_add(volatile atomic* obj, ptrdiff_t op) +// template +// T* atomic_fetch_add(atomic* obj, ptrdiff_t op); + +#include + +void void_pointer() { + { + volatile std::atomic obj; + // expected-error@*:* {{incomplete type 'void' where a complete type is required}} + std::atomic_fetch_add(&obj, 0); + } + { + std::atomic 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 obj; + // expected-error@*:* {{incomplete type 'Incomplete' where a complete type is required}} + std::atomic_fetch_add(&obj, 0); + } + { + std::atomic obj; + // expected-error@*:* {{incomplete type 'Incomplete' where a complete type is required}} + std::atomic_fetch_add(&obj, 0); + } +} + +void function_pointer() { + { + volatile std::atomic fun; + // expected-error-re@*:* {{static assertion failed due to requirement '!is_function::value'{{.*}}Pointer to function isn't allowed}} + std::atomic_fetch_add(&fun, 0); + } + { + std::atomic fun; + // expected-error-re@*:* {{static assertion failed due to requirement '!is_function::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 fun; + // expected-error@*:* {{no matching function for call to 'atomic_fetch_add'}} + std::atomic_fetch_add(&fun, 0); + } + { + std::atomic 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 + +// + +// template +// T* +// atomic_fetch_add_explicit(volatile atomic* obj, ptrdiff_t op, +// memory_order m); +// template +// T* +// atomic_fetch_add_explicit(atomic* obj, ptrdiff_t op, memory_order m); + +#include + +void void_pointer() { + { + volatile std::atomic 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 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 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 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 fun; + // expected-error-re@*:* {{static assertion failed due to requirement '!is_function::value'{{.*}}Pointer to function isn't allowed}} + std::atomic_fetch_add_explicit(&fun, 0, std::memory_order_relaxed); + } + { + std::atomic fun; + // expected-error-re@*:* {{static assertion failed due to requirement '!is_function::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 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 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 + +// + +// template +// T* atomic_fetch_sub(volatile atomic* obj, ptrdiff_t op) +// template +// T* atomic_fetch_sub(atomic* obj, ptrdiff_t op); + +#include + +void void_pointer() { + { + volatile std::atomic obj; + // expected-error@*:* {{incomplete type 'void' where a complete type is required}} + std::atomic_fetch_sub(&obj, 0); + } + { + std::atomic 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 obj; + // expected-error@*:* {{incomplete type 'Incomplete' where a complete type is required}} + std::atomic_fetch_sub(&obj, 0); + } + { + std::atomic obj; + // expected-error@*:* {{incomplete type 'Incomplete' where a complete type is required}} + std::atomic_fetch_sub(&obj, 0); + } +} + +void function_pointer() { + { + volatile std::atomic fun; + // expected-error-re@*:* {{static assertion failed due to requirement '!is_function::value'{{.*}}Pointer to function isn't allowed}} + std::atomic_fetch_sub(&fun, 0); + } + { + std::atomic fun; + // expected-error-re@*:* {{static assertion failed due to requirement '!is_function::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 fun; + // expected-error@*:* {{no matching function for call to 'atomic_fetch_sub'}} + std::atomic_fetch_sub(&fun, 0); + } + { + std::atomic 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 + +// + +// template +// T* +// atomic_fetch_sub_explicit(volatile atomic* obj, ptrdiff_t op, +// memory_order m); +// template +// T* +// atomic_fetch_sub_explicit(atomic* obj, ptrdiff_t op, memory_order m); + +#include + +void void_pointer() { + { + volatile std::atomic 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 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 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 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 fun; + // expected-error-re@*:* {{static assertion failed due to requirement '!is_function::value'{{.*}}Pointer to function isn't allowed}} + std::atomic_fetch_sub_explicit(&fun, 0, std::memory_order_relaxed); + } + { + std::atomic fun; + // expected-error-re@*:* {{static assertion failed due to requirement '!is_function::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 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 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 + +// + +// Test that invalid memory order arguments are diagnosed where possible. + +#include + +void f() { + std::atomic x(42); + volatile std::atomic& 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 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 is not C++ friendly, so including +// doesn't work at all if we don't use the provided by libc++ in C++23 and above. +// XFAIL: (c++11 || c++14 || c++17 || c++20) && gcc + +#include + +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 DOES NOT redirect to 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. +// +// For example, redeclarations can become invalid depending on whether they +// have been declared with in scope or not. + +// REQUIRES: c++03 || c++11 || c++14 || c++17 || c++20 + +// On GCC, the compiler-provided is not C++ friendly, so including +// doesn't work at all if we don't use the provided by libc++ in C++23 and above. +// XFAIL: (c++11 || c++14 || c++17 || c++20) && gcc + +#include +#include +#include + +static_assert(!std::is_same<_Atomic(int), std::atomic >::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/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 +// +//===----------------------------------------------------------------------===// + +// + +// 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 +#include +#include + +#include "test_macros.h" + +void exit_success(int) { std::_Exit(EXIT_SUCCESS); } + +int main(int, char**) { + std::signal(SIGABRT, exit_success); + std::map 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 +// +//===----------------------------------------------------------------------===// + +// + +// 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 +#include +#include + +#include "test_macros.h" + +void exit_success(int) { std::_Exit(EXIT_SUCCESS); } + +int main(int, char**) { + std::signal(SIGABRT, exit_success); + std::map const map; + map.at(1); + return EXIT_FAILURE; +} 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 +#include + +#include "test_macros.h" + +struct TEST_ALIGNAS(16) Cmp { + bool operator()(int, int) const; +}; + +template +struct Set { + char b; + std::set s; +}; + +template +struct Multiset { + char b; + std::multiset s; +}; + +template +struct Map { + char b; + std::map s; +}; + +template +struct Multimap { + char b; + std::multimap s; +}; + +static_assert(sizeof(Set) == sizeof(Set), ""); +static_assert(sizeof(Multiset) == sizeof(Multiset), ""); + +static_assert(sizeof(Map) == sizeof(Map), ""); +static_assert(sizeof(Multimap) == sizeof(Multimap), ""); 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 +// void +// __tree_balance_after_insert(_NodePtr __root, _NodePtr __x) + +// XFAIL: FROZEN-CXX03-HEADERS-FIXME + +#include <__tree> +#include + +#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 +#include +#include + +#include "test_macros.h" +#include "min_allocator.h" + +void testKeyValueTrait() { + { + typedef int Tp; + typedef std::__tree_key_value_types Traits; + static_assert((std::is_same::value), ""); + static_assert((std::is_same::value), ""); + static_assert(Traits::__is_map == false, ""); + } + { + typedef std::pair Tp; + typedef std::__tree_key_value_types Traits; + static_assert((std::is_same::value), ""); + static_assert((std::is_same::value), ""); + static_assert(Traits::__is_map == false, ""); + } + { + typedef std::pair Tp; + typedef std::__tree_key_value_types Traits; + static_assert((std::is_same::value), ""); + static_assert((std::is_same::value), ""); + static_assert(Traits::__is_map == false, ""); + } + { + typedef std::__value_type Tp; + typedef std::__tree_key_value_types Traits; + static_assert((std::is_same::value), ""); + static_assert((std::is_same::value), ""); + static_assert((std::is_same >::value), ""); + static_assert((std::is_same >::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 +// void +// __tree_left_rotate(_NodePtr __x); + +// XFAIL: FROZEN-CXX03-HEADERS-FIXME + +#include <__tree> +#include + +#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 +// void +// __tree_remove(_NodePtr __root, _NodePtr __z) + +// XFAIL: FROZEN-CXX03-HEADERS-FIXME + +#include <__tree> +#include + +#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 +// void +// __tree_right_rotate(_NodePtr __x); + +// XFAIL: FROZEN-CXX03-HEADERS-FIXME + +#include <__tree> +#include + +#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 +#include + +#include "min_allocator.h" +#include "test_allocator.h" +#include "test_macros.h" + +template +class small_pointer { + std::uint16_t offset; +}; + +template +class small_iter_allocator { +public: + using value_type = T; + using pointer = small_pointer; + using size_type = std::uint16_t; + using difference_type = std::int16_t; + + small_iter_allocator() TEST_NOEXCEPT {} + + template + small_iter_allocator(small_iter_allocator) 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 final_small_iter_allocator final { +public: + using value_type = T; + using pointer = small_pointer; + using size_type = std::uint16_t; + using difference_type = std::int16_t; + + final_small_iter_allocator() TEST_NOEXCEPT {} + + template + final_small_iter_allocator(final_small_iter_allocator) 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 +using unordered_map_alloc = std::unordered_map, std::equal_to, Alloc>; + +#if __SIZE_WIDTH__ == 64 + +static_assert(sizeof(unordered_map_alloc > >) == 40, ""); +static_assert(sizeof(unordered_map_alloc > >) == 40, ""); +static_assert(sizeof(unordered_map_alloc > >) == 64, ""); +static_assert(sizeof(unordered_map_alloc > >) == 12, ""); +static_assert(sizeof(unordered_map_alloc > >) == 16, ""); + +static_assert(sizeof(unordered_map_alloc > >) == 40, ""); +static_assert(sizeof(unordered_map_alloc > >) == 40, ""); +static_assert(sizeof(unordered_map_alloc > >) == 64, ""); +static_assert(sizeof(unordered_map_alloc > >) == 12, ""); +static_assert(sizeof(unordered_map_alloc > >) == 16, ""); + +static_assert(TEST_ALIGNOF(unordered_map_alloc > >) == 8, ""); +static_assert(TEST_ALIGNOF(unordered_map_alloc > >) == 8, ""); +static_assert(TEST_ALIGNOF(unordered_map_alloc > >) == 8, ""); +static_assert(TEST_ALIGNOF(unordered_map_alloc > >) == 4, ""); +static_assert(TEST_ALIGNOF(unordered_map_alloc > >) == 4, ""); + +static_assert(TEST_ALIGNOF(unordered_map_alloc > >) == 8, ""); +static_assert(TEST_ALIGNOF(unordered_map_alloc > >) == 8, ""); +static_assert(TEST_ALIGNOF(unordered_map_alloc > >) == 8, ""); +static_assert(TEST_ALIGNOF(unordered_map_alloc > >) == 4, ""); +static_assert(TEST_ALIGNOF(unordered_map_alloc > >) == 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) == 64, ""); +static_assert(TEST_ALIGNOF(std::unordered_map) == 32, ""); + +#elif __SIZE_WIDTH__ == 32 + +static_assert(sizeof(unordered_map_alloc > >) == 20, ""); +static_assert(sizeof(unordered_map_alloc > >) == 20, ""); +static_assert(sizeof(unordered_map_alloc > >) == 44, ""); +static_assert(sizeof(unordered_map_alloc > >) == 12, ""); +static_assert(sizeof(unordered_map_alloc > >) == 16, ""); + +static_assert(sizeof(unordered_map_alloc > >) == 20, ""); +static_assert(sizeof(unordered_map_alloc > >) == 20, ""); +static_assert(sizeof(unordered_map_alloc > >) == 44, ""); +static_assert(sizeof(unordered_map_alloc > >) == 12, ""); +static_assert(sizeof(unordered_map_alloc > >) == 16, ""); + +static_assert(TEST_ALIGNOF(unordered_map_alloc > >) == 4, ""); +static_assert(TEST_ALIGNOF(unordered_map_alloc > >) == 4, ""); +static_assert(TEST_ALIGNOF(unordered_map_alloc > >) == 4, ""); +static_assert(TEST_ALIGNOF(unordered_map_alloc > >) == 4, ""); +static_assert(TEST_ALIGNOF(unordered_map_alloc > >) == 4, ""); + +static_assert(TEST_ALIGNOF(unordered_map_alloc > >) == 4, ""); +static_assert(TEST_ALIGNOF(unordered_map_alloc > >) == 4, ""); +static_assert(TEST_ALIGNOF(unordered_map_alloc > >) == 4, ""); +static_assert(TEST_ALIGNOF(unordered_map_alloc > >) == 4, ""); +static_assert(TEST_ALIGNOF(unordered_map_alloc > >) == 4, + ""); + +struct TEST_ALIGNAS(32) AlignedHash {}; +struct UnalignedEqualTo {}; + +static_assert(sizeof(std::unordered_map) == 64); +static_assert(TEST_ALIGNOF(std::unordered_map) == 32); + +#else +# error std::size_t has an unexpected size +#endif 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 +#include + +#include "min_allocator.h" +#include "test_allocator.h" +#include "test_macros.h" + +template +class small_pointer { + std::uint16_t offset; +}; + +template +class small_iter_allocator { +public: + using value_type = T; + using pointer = small_pointer; + using size_type = std::uint16_t; + using difference_type = std::int16_t; + + small_iter_allocator() TEST_NOEXCEPT {} + + template + small_iter_allocator(small_iter_allocator) 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 final_small_iter_allocator final { +public: + using value_type = T; + using pointer = small_pointer; + using size_type = std::uint16_t; + using difference_type = std::int16_t; + + final_small_iter_allocator() TEST_NOEXCEPT {} + + template + final_small_iter_allocator(final_small_iter_allocator) 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 +using unordered_set_alloc = std::unordered_set, std::equal_to, Alloc>; + +#if __SIZE_WIDTH__ == 64 + +static_assert(sizeof(unordered_set_alloc >) == 40, ""); +static_assert(sizeof(unordered_set_alloc >) == 40, ""); +static_assert(sizeof(unordered_set_alloc >) == 64, ""); +static_assert(sizeof(unordered_set_alloc >) == 12, ""); +static_assert(sizeof(unordered_set_alloc >) == 16, ""); + +static_assert(sizeof(unordered_set_alloc >) == 40, ""); +static_assert(sizeof(unordered_set_alloc >) == 40, ""); +static_assert(sizeof(unordered_set_alloc >) == 64, ""); +static_assert(sizeof(unordered_set_alloc >) == 12, ""); +static_assert(sizeof(unordered_set_alloc >) == 16, ""); + +static_assert(TEST_ALIGNOF(unordered_set_alloc >) == 8, ""); +static_assert(TEST_ALIGNOF(unordered_set_alloc >) == 8, ""); +static_assert(TEST_ALIGNOF(unordered_set_alloc >) == 8, ""); +static_assert(TEST_ALIGNOF(unordered_set_alloc >) == 4, ""); +static_assert(TEST_ALIGNOF(unordered_set_alloc >) == 4, ""); + +static_assert(TEST_ALIGNOF(unordered_set_alloc >) == 8, ""); +static_assert(TEST_ALIGNOF(unordered_set_alloc >) == 8, ""); +static_assert(TEST_ALIGNOF(unordered_set_alloc >) == 8, ""); +static_assert(TEST_ALIGNOF(unordered_set_alloc >) == 4, ""); +static_assert(TEST_ALIGNOF(unordered_set_alloc >) == 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) == 64, ""); +static_assert(TEST_ALIGNOF(std::unordered_set) == 32, ""); + +#elif __SIZE_WIDTH__ == 32 + +static_assert(sizeof(unordered_set_alloc >) == 20, ""); +static_assert(sizeof(unordered_set_alloc >) == 20, ""); +static_assert(sizeof(unordered_set_alloc >) == 44, ""); +static_assert(sizeof(unordered_set_alloc >) == 12, ""); +static_assert(sizeof(unordered_set_alloc >) == 16, ""); + +static_assert(sizeof(unordered_set_alloc >) == 20, ""); +static_assert(sizeof(unordered_set_alloc >) == 20, ""); +static_assert(sizeof(unordered_set_alloc >) == 44, ""); +static_assert(sizeof(unordered_set_alloc >) == 12, ""); +static_assert(sizeof(unordered_set_alloc >) == 16, ""); + +static_assert(TEST_ALIGNOF(unordered_set_alloc >) == 4, ""); +static_assert(TEST_ALIGNOF(unordered_set_alloc >) == 4, ""); +static_assert(TEST_ALIGNOF(unordered_set_alloc >) == 4, ""); +static_assert(TEST_ALIGNOF(unordered_set_alloc >) == 4, ""); +static_assert(TEST_ALIGNOF(unordered_set_alloc >) == 4, ""); + +static_assert(TEST_ALIGNOF(unordered_set_alloc >) == 4, ""); +static_assert(TEST_ALIGNOF(unordered_set_alloc >) == 4, ""); +static_assert(TEST_ALIGNOF(unordered_set_alloc >) == 4, ""); +static_assert(TEST_ALIGNOF(unordered_set_alloc >) == 4, ""); +static_assert(TEST_ALIGNOF(unordered_set_alloc >) == 4, ""); + +struct TEST_ALIGNAS(32) AlignedHash {}; +struct UnalignedEqualTo {}; + +static_assert(sizeof(std::unordered_set) == 64); +static_assert(TEST_ALIGNOF(std::unordered_set) == 32); + +#else +# error std::size_t has an unexpected size +#endif 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 +#include +#include +#include +#include +#include +#include +#include + +#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 + std::size_t operator()(const T&) const TEST_NOEXCEPT_COND(false); +}; + +struct NoThrowHash { + template + std::size_t operator()(const T&) const TEST_NOEXCEPT; +}; + +template +void check() { + static_assert( + std::__container_traits::__emplacement_has_strong_exception_safety_guarantee == Expected, ""); +} + +void test() { + check >(); + check > >(); + check >(); + check >(); + check >(); + + check >(); + check > >(); + check >(); + check >(); + check >(); + + check >(); + check > >(); + check >(); + check >(); + check >(); + + check >(); + check > >(); + check >(); + check >(); + check >(); + + check >(); + check, test_allocator > >(); + check >(); + check >(); + check >(); + + check >(); + check, test_allocator > >(); + check >(); + check >(); + check >(); + + check >(); + check, test_allocator > >(); + check >(); + check >(); + check >(); + + check >(); + check, test_allocator > >(); + check >(); + check >(); + check >(); + +#if TEST_STD_VER < 11 + check >(); + check, std::less, test_allocator > >(); + check >(); + check >(); + check >(); + + check >(); + check, std::less, test_allocator > >(); + check >(); + check >(); + check >(); + + check >(); + check, std::less, test_allocator > >(); + check >(); + check >(); + check >(); + + check >(); + check, std::less, test_allocator > >(); + check >(); + check >(); + check >(); +#else + check >(); + check, std::less, test_allocator > >(); + check >(); + check >(); + check >(); + + check >(); + check, std::less, test_allocator > >(); + check >(); + check >(); + check >(); + + check >(); + check, std::less, test_allocator > >(); + check >(); + check >(); + check >(); + + check >(); + check, std::less, test_allocator > >(); + check >(); + check >(); + check >(); +#endif +} 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 is trivially copyable whenever T is trivially copyable. +// This is not technically mandated by the Standard, but libc++ has been providing +// this property. + +#include +#include + +struct Empty {}; + +struct TrivialCopy { + int i; + double j; +}; + +struct NonTrivialCopy { + NonTrivialCopy(NonTrivialCopy const&) {} + NonTrivialCopy& operator=(NonTrivialCopy const&) { return *this; } +}; + +template +void check_trivially_copyable() { + static_assert(std::is_trivially_copyable >::value, ""); + static_assert(std::is_trivially_copyable >::value, ""); + static_assert(std::is_trivially_copyable >::value, ""); + static_assert(std::is_trivially_copyable >::value, ""); +} + +int main(int, char**) { + check_trivially_copyable(); + check_trivially_copyable(); + check_trivially_copyable(); + check_trivially_copyable(); + check_trivially_copyable(); + check_trivially_copyable(); + + // Check that std::array is still trivially copyable when T is not + static_assert(std::is_trivially_copyable >::value, ""); + static_assert(!std::is_trivially_copyable >::value, ""); + static_assert(!std::is_trivially_copyable >::value, ""); + static_assert(!std::is_trivially_copyable >::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 +#include + +#include "min_allocator.h" +#include "test_allocator.h" +#include "test_macros.h" + +template +class small_pointer { + std::uint16_t offset; +}; + +template +class small_iter_allocator { +public: + using value_type = T; + using pointer = small_pointer; + using size_type = std::uint16_t; + using difference_type = std::int16_t; + + small_iter_allocator() TEST_NOEXCEPT {} + + template + small_iter_allocator(small_iter_allocator) 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 final_small_iter_allocator final { +public: + using value_type = T; + using pointer = small_pointer; + using size_type = std::uint16_t; + using difference_type = std::int16_t; + + final_small_iter_allocator() TEST_NOEXCEPT {} + + template + final_small_iter_allocator(final_small_iter_allocator) 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) == 48, ""); +static_assert(sizeof(std::deque >) == 48, ""); +static_assert(sizeof(std::deque >) == 80, ""); +static_assert(sizeof(std::deque >) == 12, ""); +static_assert(sizeof(std::deque >) == 16, ""); + +static_assert(sizeof(std::deque) == 48, ""); +static_assert(sizeof(std::deque >) == 48, ""); +static_assert(sizeof(std::deque >) == 80, ""); +static_assert(sizeof(std::deque >) == 12, ""); +static_assert(sizeof(std::deque >) == 16, ""); + +static_assert(TEST_ALIGNOF(std::deque) == 8, ""); +static_assert(TEST_ALIGNOF(std::deque >) == 8, ""); +static_assert(TEST_ALIGNOF(std::deque >) == 8, ""); +static_assert(TEST_ALIGNOF(std::deque >) == 2, ""); +static_assert(TEST_ALIGNOF(std::deque >) == 2, ""); + +static_assert(TEST_ALIGNOF(std::deque) == 8, ""); +static_assert(TEST_ALIGNOF(std::deque >) == 8, ""); +static_assert(TEST_ALIGNOF(std::deque >) == 8, ""); +static_assert(TEST_ALIGNOF(std::deque >) == 2, ""); +static_assert(TEST_ALIGNOF(std::deque >) == 2, ""); + +#elif __SIZE_WIDTH__ == 32 + +static_assert(sizeof(std::deque) == 24, ""); +static_assert(sizeof(std::deque >) == 24, ""); +static_assert(sizeof(std::deque >) == 48, ""); +static_assert(sizeof(std::deque >) == 12, ""); +static_assert(sizeof(std::deque >) == 16, ""); + +static_assert(sizeof(std::deque) == 24, ""); +static_assert(sizeof(std::deque >) == 24, ""); +static_assert(sizeof(std::deque >) == 48, ""); +static_assert(sizeof(std::deque >) == 12, ""); +static_assert(sizeof(std::deque >) == 16, ""); + +static_assert(TEST_ALIGNOF(std::deque) == 4, ""); +static_assert(TEST_ALIGNOF(std::deque >) == 4, ""); +static_assert(TEST_ALIGNOF(std::deque >) == 4, ""); +static_assert(TEST_ALIGNOF(std::deque >) == 2, ""); +static_assert(TEST_ALIGNOF(std::deque >) == 2, ""); + +static_assert(TEST_ALIGNOF(std::deque) == 4, ""); +static_assert(TEST_ALIGNOF(std::deque >) == 4, ""); +static_assert(TEST_ALIGNOF(std::deque >) == 4, ""); +static_assert(TEST_ALIGNOF(std::deque >) == 2, ""); +static_assert(TEST_ALIGNOF(std::deque >) == 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 + +// + +// reference operator[](size_type n); + +#include "asan_testing.h" +#include +#include +#include + +#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 MyInputIter; + // Should not trigger ASan. + std::deque 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 > 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 > 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 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 +// +//===----------------------------------------------------------------------===// + +// + +// 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 +#include +#include "check_assertion.h" + +void test1() { + std::deque 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 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/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 + +using DequeIterator = typename std::deque::iterator; +static_assert(std::__is_segmented_iterator::value, ""); 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 +#include + +#include "min_allocator.h" +#include "test_allocator.h" +#include "test_macros.h" + +template +class small_pointer { + std::uint16_t offset; +}; + +template +class small_iter_allocator { +public: + using value_type = T; + using pointer = small_pointer; + using size_type = std::int16_t; + using difference_type = std::int16_t; + + small_iter_allocator() TEST_NOEXCEPT {} + + template + small_iter_allocator(small_iter_allocator) 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) == 24, ""); +static_assert(sizeof(std::list >) == 24, ""); +static_assert(sizeof(std::list >) == 40, ""); +static_assert(sizeof(std::list >) == 6, ""); + +static_assert(sizeof(std::list) == 24, ""); +static_assert(sizeof(std::list >) == 24, ""); +static_assert(sizeof(std::list >) == 40, ""); +static_assert(sizeof(std::list >) == 6, ""); + +static_assert(TEST_ALIGNOF(std::list) == 8, ""); +static_assert(TEST_ALIGNOF(std::list >) == 8, ""); +static_assert(TEST_ALIGNOF(std::list >) == 8, ""); +static_assert(TEST_ALIGNOF(std::list >) == 2, ""); + +static_assert(TEST_ALIGNOF(std::list) == 8, ""); +static_assert(TEST_ALIGNOF(std::list >) == 8, ""); +static_assert(TEST_ALIGNOF(std::list >) == 8, ""); +static_assert(TEST_ALIGNOF(std::list >) == 2, ""); + +#elif __SIZE_WIDTH__ == 32 + +static_assert(sizeof(std::list) == 12, ""); +static_assert(sizeof(std::list >) == 12, ""); +static_assert(sizeof(std::list >) == 24, ""); +static_assert(sizeof(std::list >) == 6, ""); + +static_assert(sizeof(std::list) == 12, ""); +static_assert(sizeof(std::list >) == 12, ""); +static_assert(sizeof(std::list >) == 24, ""); +static_assert(sizeof(std::list >) == 6, ""); + +static_assert(TEST_ALIGNOF(std::list) == 4, ""); +static_assert(TEST_ALIGNOF(std::list >) == 4, ""); +static_assert(TEST_ALIGNOF(std::list >) == 4, ""); +static_assert(TEST_ALIGNOF(std::list >) == 2, ""); + +static_assert(TEST_ALIGNOF(std::list) == 4, ""); +static_assert(TEST_ALIGNOF(std::list >) == 4, ""); +static_assert(TEST_ALIGNOF(std::list >) == 4, ""); +static_assert(TEST_ALIGNOF(std::list >) == 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 +#include + +#include "min_allocator.h" +#include "test_allocator.h" +#include "test_macros.h" + +template +class small_pointer { + std::uint16_t offset; +}; + +template +class small_iter_allocator { +public: + using value_type = T; + using pointer = small_pointer; + using size_type = std::int16_t; + using difference_type = std::int16_t; + + small_iter_allocator() TEST_NOEXCEPT {} + + template + small_iter_allocator(small_iter_allocator) 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) == 24, ""); +static_assert(sizeof(std::vector >) == 24, ""); +static_assert(sizeof(std::vector >) == 40, ""); +static_assert(sizeof(std::vector >) == 6, ""); + +static_assert(TEST_ALIGNOF(std::vector) == 8, ""); +static_assert(TEST_ALIGNOF(std::vector >) == 8, ""); +static_assert(TEST_ALIGNOF(std::vector >) == 8, ""); +static_assert(TEST_ALIGNOF(std::vector >) == 2, ""); + +#elif __SIZE_WIDTH__ == 32 + +static_assert(sizeof(std::vector) == 12, ""); +static_assert(sizeof(std::vector >) == 12, ""); +static_assert(sizeof(std::vector >) == 24, ""); +static_assert(sizeof(std::vector >) == 6, ""); + +static_assert(TEST_ALIGNOF(std::vector) == 4, ""); +static_assert(TEST_ALIGNOF(std::vector >) == 4, ""); +static_assert(TEST_ALIGNOF(std::vector >) == 4, ""); +static_assert(TEST_ALIGNOF(std::vector >) == 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 +#include + +#include "min_allocator.h" +#include "test_allocator.h" +#include "test_macros.h" + +template +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 small_iter_allocator { +public: + using value_type = T; + using pointer = small_pointer; + using size_type = std::int16_t; + using difference_type = std::int16_t; + + small_iter_allocator() TEST_NOEXCEPT {} + + template + small_iter_allocator(small_iter_allocator) 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) == 24, ""); +static_assert(sizeof(std::vector >) == 24, ""); +static_assert(sizeof(std::vector >) == 40, ""); +static_assert(sizeof(std::vector >) == 6, ""); + +static_assert(sizeof(std::vector) == 24, ""); +static_assert(sizeof(std::vector >) == 24, ""); +static_assert(sizeof(std::vector >) == 40, ""); +static_assert(sizeof(std::vector >) == 6, ""); + +static_assert(TEST_ALIGNOF(std::vector) == 8, ""); +static_assert(TEST_ALIGNOF(std::vector >) == 8, ""); +static_assert(TEST_ALIGNOF(std::vector >) == 8, ""); +static_assert(TEST_ALIGNOF(std::vector >) == 2, ""); + +static_assert(TEST_ALIGNOF(std::vector) == 8, ""); +static_assert(TEST_ALIGNOF(std::vector >) == 8, ""); +static_assert(TEST_ALIGNOF(std::vector >) == 8, ""); +static_assert(TEST_ALIGNOF(std::vector >) == 2, ""); + +#elif __SIZE_WIDTH__ == 32 + +static_assert(sizeof(std::vector) == 12, ""); +static_assert(sizeof(std::vector >) == 12, ""); +static_assert(sizeof(std::vector >) == 24, ""); +static_assert(sizeof(std::vector >) == 6, ""); + +static_assert(sizeof(std::vector) == 12, ""); +static_assert(sizeof(std::vector >) == 12, ""); +static_assert(sizeof(std::vector >) == 24, ""); +static_assert(sizeof(std::vector >) == 6, ""); + +static_assert(TEST_ALIGNOF(std::vector) == 4, ""); +static_assert(TEST_ALIGNOF(std::vector >) == 4, ""); +static_assert(TEST_ALIGNOF(std::vector >) == 4, ""); +static_assert(TEST_ALIGNOF(std::vector >) == 2, ""); + +static_assert(TEST_ALIGNOF(std::vector) == 4, ""); +static_assert(TEST_ALIGNOF(std::vector >) == 4, ""); +static_assert(TEST_ALIGNOF(std::vector >) == 4, ""); +static_assert(TEST_ALIGNOF(std::vector >) == 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 + +// + +// reference operator[](size_type n); + +#include +#include +#include + +#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 MyInputIter; + std::vector> 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 MyInputIter; + std::vector> 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 MyInputIter; + // Sould not trigger ASan. + std::vector 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 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 +#include + +#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 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 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 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 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 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 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 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 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 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 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/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 + +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 + v; //expected-error-re@*:* {{static assertion failed {{.*}}This allocator has to implement rebind}} +} 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 +#include +#include + +#include "test_macros.h" +#include "min_allocator.h" + +void testKeyValueTrait() { + { + typedef int Tp; + typedef std::__hash_key_value_types Traits; + static_assert((std::is_same::value), ""); + static_assert((std::is_same::value), ""); + static_assert((std::is_same::value), ""); + static_assert(Traits::__is_map == false, ""); + } + { + typedef std::pair Tp; + typedef std::__hash_key_value_types Traits; + static_assert((std::is_same::value), ""); + static_assert((std::is_same::value), ""); + static_assert((std::is_same::value), ""); + static_assert(Traits::__is_map == false, ""); + } + { + typedef std::pair Tp; + typedef std::__hash_key_value_types Traits; + static_assert((std::is_same::value), ""); + static_assert((std::is_same::value), ""); + static_assert((std::is_same::value), ""); + static_assert(Traits::__is_map == false, ""); + } + { + typedef std::__hash_value_type Tp; + typedef std::__hash_key_value_types Traits; + static_assert((std::is_same::value), ""); + static_assert((std::is_same::value), ""); + static_assert((std::is_same::value), ""); + static_assert((std::is_same >::value), ""); + static_assert((std::is_same >::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 +#include + +#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 +// +//===----------------------------------------------------------------------===// + +// + +// template +// 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 , 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 +#include + +#include "test_macros.h" + +int main(int, char**) +{ + std::auto_ptr p; + + return 0; +} 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 +// +//===----------------------------------------------------------------------===// + +// + +// 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 +#include + +#include "test_macros.h" + +template +void test_address() { + T* tp = new T(); + const T* ctp = tp; + const std::allocator a; + assert(a.address(*tp) == tp); + assert(a.address(*ctp) == tp); + delete tp; +} + +struct A { + void operator&() const {} +}; + +int main(int, char**) { + test_address(); + test_address(); + + 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 +// +//===----------------------------------------------------------------------===// + +// + +// 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 +#include +#include // 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::value; +#endif + +static const std::size_t OverAligned = MaxAligned * 2; + +template +struct TEST_ALIGNAS(Align) AlignedType { + char data; + static int constructed; + AlignedType() { ++constructed; } + AlignedType(AlignedType const&) { ++constructed; } + ~AlignedType() { --constructed; } +}; +template +int AlignedType::constructed = 0; + +template +void test_aligned() { + typedef AlignedType T; + T::constructed = 0; + globalMemCounter.reset(); + std::allocator 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(); + test_aligned(); + test_aligned(); + + 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 +// +//===----------------------------------------------------------------------===// + +// + +// allocator: +// template void construct(pointer p, Args&&... args); + +// In C++20, parts of std::allocator 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 +#include + +#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; + 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 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 +// +//===----------------------------------------------------------------------===// + +// + +// 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 +#include +#include +#include + +#include "test_macros.h" + +int new_called = 0; + +int main(int, char**) { + const std::allocator a; + std::size_t M = a.max_size(); + assert(M > 0xFFFF && M <= (std::numeric_limits::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 +// +//===----------------------------------------------------------------------===// + +// + +// Check that the following types are provided regardless of the Standard when +// we request them from libc++. + +// template +// 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::type reference; +// typedef typename add_lvalue_reference::type const_reference; +// +// template struct rebind {typedef allocator 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 +#include +#include + +template +void test() { + static_assert((std::is_same::size_type, std::size_t>::value), ""); + static_assert((std::is_same::difference_type, std::ptrdiff_t>::value), ""); + static_assert((std::is_same::pointer, T*>::value), ""); + static_assert((std::is_same::const_pointer, const T*>::value), ""); + static_assert((std::is_same::reference, T&>::value), ""); + static_assert((std::is_same::const_reference, const T&>::value), ""); + static_assert( + (std::is_same::template rebind::other, std::allocator >::value), ""); +} + +int main(int, char**) { + test(); + 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 +// +//===----------------------------------------------------------------------===// + +// + + +// 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 , then they will be restored. + +// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_ENABLE_CXX17_REMOVED_BINDERS +// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DISABLE_DEPRECATION_WARNINGS + +#include +#include +#include + +#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 PUF; + typedef std::pointer_to_binary_function PBF; + + static_assert( + (std::is_same(identity)))>::value), + ""); + static_assert( + (std::is_same(sum)))>::value), + ""); + + assert((std::ptr_fun(identity)(4) == 4)); + assert((std::ptr_fun(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 MFR; + typedef std::const_mem_fun_ref_t CMFR; + + static_assert( + (std::is_same::value), ""); + static_assert((std::is_same::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 +#include +#include + +#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 +#include +#include + +#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 +#include +#include + +#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 +#include +#include + +#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 + +#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. + +// + +// Test the feature test macros defined by + +// clang-format off + +#include +#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. + +// + +// Test the feature test macros defined by + +// clang-format off + +#include +#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 + +// + +// Test the feature test macros defined by + +// clang-format off + +#include +#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. + +// + +// Test the feature test macros defined by + +// clang-format off + +#if !defined(_WIN32) && __has_include() +# include +#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. + +// + +// Test the feature test macros defined by + +// clang-format off + +#include +#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. + +// + +// Test the feature test macros defined by + +// clang-format off + +#include +#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. + +// + +// Test the feature test macros defined by + +// clang-format off + +#include +#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/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 +// +//===----------------------------------------------------------------------===// + +// + +// template> +// class basic_filebuf; +// +// The char type of the stream and the char_type of the traits have to match + +// UNSUPPORTED: no-wide-characters + +#include + +std::basic_filebuf > 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 +// +//===----------------------------------------------------------------------===// + +// + +// template > +// class basic_fstream + +// close(); + +// Inspired by PR#38052 - std::fstream still good after closing and updating content + +#include +#include +#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 +// +//===----------------------------------------------------------------------===// + +// + +// template > +// 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 +#include +#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 +// +//===----------------------------------------------------------------------===// + +// + +// template > +// 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 +#include +#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 +// +//===----------------------------------------------------------------------===// + +// + +// template > +// 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 +#include + +#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 +// +//===----------------------------------------------------------------------===// + +// + +// template > +// 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 +#include + +#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 +// +//===----------------------------------------------------------------------===// + +// + +// template > +// 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 +#include +#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 +// +//===----------------------------------------------------------------------===// + +// + +// template > +// 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 +#include +#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 +// +//===----------------------------------------------------------------------===// + +// + +// template > +// class basic_fstream + +// The char type of the stream and the char_type of the traits have to match + +// UNSUPPORTED: no-wide-characters + +#include + +std::basic_fstream > 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 +// +//===----------------------------------------------------------------------===// + +// + +// template > +// class basic_istream; + +// The char type of the stream and the char_type of the traits have to match + +// UNSUPPORTED: no-wide-characters + +#include +#include + +struct test_istream + : public std::basic_istream > {}; + +// 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 +// +//===----------------------------------------------------------------------===// + +// + +// template > +// class basic_ostream; + +// The char type of the stream and the char_type of the traits have to match + +// UNSUPPORTED: no-wide-characters + +#include +#include + +struct test_ostream + : public std::basic_ostream > {}; + +// 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 + +// + +// 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 + +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 +// +//===----------------------------------------------------------------------===// + +// + +// template 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 +#include +#include +#include + +#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 +// +//===----------------------------------------------------------------------===// + +// + +// 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 +#include + +#include "test_macros.h" +#include "min_allocator.h" + +template +struct test_buf : public std::basic_stringbuf { + typedef std::basic_streambuf 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(which) {} + + explicit test_buf(const std::basic_string& s) : std::basic_stringbuf(s) {} +#if TEST_STD_VER >= 20 + explicit test_buf(const std::allocator& a) : std::basic_stringbuf(a) {} + test_buf(std::ios_base::openmode which, const std::allocator& a) : std::basic_stringbuf(which, a) {} + explicit test_buf(std::basic_string&& s) + : std::basic_stringbuf(std::forward>(s)) {} + + test_buf(const std::basic_string, min_allocator>& s, + const std::allocator& a) + : std::basic_stringbuf(s, a) {} + test_buf(const std::basic_string, min_allocator>& s, + std::ios_base::openmode which, + const std::allocator& a) + : std::basic_stringbuf(s, which, a) {} + test_buf(const std::basic_string, min_allocator>& s) + : std::basic_stringbuf(s) {} +#endif // TEST_STD_VER >= 20 + +#if TEST_STD_VER >= 26 + test_buf(std::basic_string_view s) : std::basic_stringbuf(s) {} + test_buf(std::basic_string_view s, const std::allocator& a) : std::basic_stringbuf(s, a) {} + test_buf(std::basic_string_view s, std::ios_base::openmode which, const std::allocator& a) + : std::basic_stringbuf(s, which, a) {} +#endif // TEST_STD_VER >= 26 +}; + +template +static void test() { + std::size_t size = std::basic_string().capacity(); // SSO buffer size. + { + test_buf b; + assert(b.pbase() != nullptr); + assert(b.pptr() == b.pbase()); + assert(b.epptr() == b.pbase() + size); + } + { + test_buf b(std::ios_base::out); + assert(b.pbase() != nullptr); + assert(b.pptr() == b.pbase()); + assert(b.epptr() == b.pbase() + size); + } + { + std::basic_string s; + s.reserve(1024); + test_buf 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 b = test_buf(std::allocator()); + assert(b.pbase() != nullptr); + assert(b.pptr() == b.pbase()); + assert(b.epptr() == b.pbase() + size); + } + { + test_buf b = test_buf(std::ios_base::out, std::allocator()); + assert(b.pbase() != nullptr); + assert(b.pptr() == b.pbase()); + assert(b.epptr() == b.pbase() + size); + } + { + std::basic_string s; + s.reserve(1024); + std::size_t capacity = s.capacity(); + test_buf b = test_buf(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, min_allocator> s; + s.reserve(1024); + test_buf b = test_buf(s, std::allocator()); + assert(b.pbase() != nullptr); + assert(b.pptr() == b.pbase()); + assert(b.epptr() == b.pbase() + size); // copy so uses size + } + { + std::basic_string, min_allocator> s; + s.reserve(1024); + test_buf b = test_buf(s, std::ios_base::out, std::allocator()); + assert(b.pbase() != nullptr); + assert(b.pptr() == b.pbase()); + assert(b.epptr() == b.pbase() + size); // copy so uses size + } + { + std::basic_string, min_allocator> s; + s.reserve(1024); + test_buf b = test_buf(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 s; + test_buf b = test_buf(s); + assert(b.pbase() != nullptr); + assert(b.pptr() == b.pbase()); + assert(b.epptr() == b.pbase() + size); + } + { + std::basic_string_view s; + test_buf b = test_buf(s, std::allocator()); + assert(b.pbase() != nullptr); + assert(b.pptr() == b.pbase()); + assert(b.epptr() == b.pbase() + size); + } + { + std::basic_string_view s; + test_buf b = test_buf(s, std::ios_base::out, std::allocator()); + 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(); +#ifndef TEST_HAS_NO_WIDE_CHARACTERS + test(); +#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 +// +//===----------------------------------------------------------------------===// + +// + +// template, +// class Allocator = allocator> +// class basic_stringbuf; +// +// The char type of the stream and the char_type of the traits have to match + +// UNSUPPORTED: no-wide-characters + +#include + +std::basic_stringbuf > 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 + +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 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 +// struct __bounded_iter; +// +// Arithmetic operators + +// XFAIL: FROZEN-CXX03-HEADERS-FIXME + +#include <__iterator/bounded_iter.h> +#include + +#include "test_iterators.h" +#include "test_macros.h" + +template +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 = std::__make_bounded_iter(Iter(b), Iter(b), Iter(e)); + std::__bounded_iter& result = ++iter; + assert(&result == &iter); + assert(*iter == 41); + } + // it++ + { + std::__bounded_iter iter = std::__make_bounded_iter(Iter(b), Iter(b), Iter(e)); + std::__bounded_iter result = iter++; + assert(*result == 40); + assert(*iter == 41); + } + // --it + { + std::__bounded_iter iter = std::__make_bounded_iter(Iter(b + 3), Iter(b), Iter(e)); + std::__bounded_iter& result = --iter; + assert(&result == &iter); + assert(*iter == 42); + } + // it-- + { + std::__bounded_iter iter = std::__make_bounded_iter(Iter(b + 3), Iter(b), Iter(e)); + std::__bounded_iter result = iter--; + assert(*result == 43); + assert(*iter == 42); + } + // it += n + { + std::__bounded_iter iter = std::__make_bounded_iter(Iter(b), Iter(b), Iter(e)); + std::__bounded_iter& result = (iter += 3); + assert(&result == &iter); + assert(*iter == 43); + } + // it + n + { + std::__bounded_iter iter = std::__make_bounded_iter(Iter(b), Iter(b), Iter(e)); + std::__bounded_iter result = iter + 3; + assert(*iter == 40); + assert(*result == 43); + } + // n + it + { + std::__bounded_iter iter = std::__make_bounded_iter(Iter(b), Iter(b), Iter(e)); + std::__bounded_iter result = 3 + iter; + assert(*iter == 40); + assert(*result == 43); + } + // it -= n + { + std::__bounded_iter iter = std::__make_bounded_iter(Iter(b + 3), Iter(b), Iter(e)); + std::__bounded_iter& result = (iter -= 3); + assert(&result == &iter); + assert(*iter == 40); + } + // it - n + { + std::__bounded_iter iter = std::__make_bounded_iter(Iter(b + 3), Iter(b), Iter(e)); + std::__bounded_iter result = iter - 3; + assert(*iter == 43); + assert(*result == 40); + } + // it - it + { + std::__bounded_iter iter1 = std::__make_bounded_iter(Iter(b), Iter(b), Iter(e)); + std::__bounded_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(); +#if TEST_STD_VER > 11 + static_assert(tests(), ""); +#endif + +#if TEST_STD_VER > 17 + tests >(); + static_assert(tests >(), ""); +#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 +// struct __bounded_iter; +// +// Comparison operators + +// XFAIL: FROZEN-CXX03-HEADERS-FIXME + +#include +#include <__iterator/bounded_iter.h> + +#include "test_iterators.h" +#include "test_macros.h" + +template +TEST_CONSTEXPR_CXX14 bool tests() { + int array[] = {0, 1, 2, 3, 4}; + int* b = array + 0; + int* e = array + 5; + std::__bounded_iter const iter1 = std::__make_bounded_iter(Iter(b), Iter(b), Iter(e)); + std::__bounded_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 decltype(auto) r1 = iter1 <=> iter2; + assert(r1 == std::strong_ordering::less); +#endif + + return true; +} + +int main(int, char**) { + tests(); +#if TEST_STD_VER > 11 + static_assert(tests(), ""); +#endif + +#if TEST_STD_VER > 17 + tests>(); + static_assert(tests>()); + + tests>(); + static_assert(tests>()); +#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 +// struct __bounded_iter; +// +// std::pointer_traits specialization + +// XFAIL: FROZEN-CXX03-HEADERS-FIXME + +#include <__iterator/bounded_iter.h> +#include +#include +#include +#include + +#include "test_iterators.h" +#include "test_macros.h" + +template +TEST_CONSTEXPR_CXX14 bool tests() { + using BoundedIter = std::__bounded_iter; + using PointerTraits = std::pointer_traits; + using BasePointerTraits = std::pointer_traits; + static_assert(std::is_same::value, ""); + static_assert(std::is_same::value, ""); + static_assert(std::is_same::value, ""); + + { + int array[] = {0, 1, 2, 3, 4}; + int* b = array + 0; + int* e = array + 5; + std::__bounded_iter const iter1 = std::__make_bounded_iter(Iter(b), Iter(b), Iter(e)); + std::__bounded_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(); +#if TEST_STD_VER > 11 + static_assert(tests(), ""); +#endif + +#if TEST_STD_VER > 17 + tests >(); + static_assert(tests >(), ""); +#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 +// struct __bounded_iter; +// +// Nested types + +// XFAIL: FROZEN-CXX03-HEADERS-FIXME + +#include <__iterator/bounded_iter.h> +#include +#include +#include + +#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; +static_assert(std::is_same::value, ""); +static_assert(std::is_same::value, ""); +static_assert(std::is_same::value, ""); +static_assert(std::is_same::value, ""); +static_assert(std::is_same::value, ""); +static_assert(std::is_same::value, ""); +#endif + + +using BoundedIter2 = std::__bounded_iter; +static_assert(std::is_same::value, ""); +static_assert(std::is_same::value, ""); +static_assert(std::is_same::value, ""); +static_assert(std::is_same::value, ""); +static_assert(std::is_same::value, ""); +#if TEST_STD_VER > 17 +static_assert(std::is_same::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 +// +//===----------------------------------------------------------------------===// +// + +// + +// __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 +#include +#include +#include + +#include "test_macros.h" + +struct Base {}; +struct Derived : Base {}; + +template ::iterator>::value> +struct test_array_helper : std::true_type { + typedef typename std::array::iterator BaseIter; + typedef typename std::array::iterator DerivedIter; + typedef typename std::array::const_iterator BaseConstIter; + typedef typename std::array::const_iterator DerivedConstIter; + + static_assert(!std::is_convertible::value, ""); + static_assert(!std::is_convertible::value, ""); + static_assert(!std::is_convertible::value, ""); + static_assert(!std::is_constructible::value, ""); + static_assert(!std::is_constructible::value, ""); + static_assert(!std::is_constructible::value, ""); +}; + +template +struct test_array_helper : std::true_type {}; + +static_assert(test_array_helper::value, ""); + +static_assert(!std::is_convertible::iterator, std::vector::iterator>::value, ""); +static_assert(!std::is_convertible::iterator, std::vector::const_iterator>::value, ""); +static_assert(!std::is_convertible::const_iterator, std::vector::const_iterator>::value, ""); +static_assert(!std::is_constructible::iterator, std::vector::iterator>::value, ""); +static_assert(!std::is_constructible::const_iterator, std::vector::iterator>::value, ""); +static_assert(!std::is_constructible::const_iterator, std::vector::const_iterator>::value, + ""); + +#if TEST_STD_VER >= 20 +static_assert(!std::is_convertible_v::iterator, std::span::iterator>); +static_assert(!std::is_convertible_v::iterator, std::span::iterator>); +static_assert(!std::is_convertible_v::iterator, std::span::iterator>); +static_assert(!std::is_constructible_v::iterator, std::span::iterator>); +static_assert(!std::is_constructible_v::iterator, std::span::iterator>); +static_assert(!std::is_constructible_v::iterator, std::span::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 +// +//===----------------------------------------------------------------------===// +// + +// + +// __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. +// + +#include +#include +#include +#include +#include +#include + +#include "test_macros.h" +#include "test_iterators.h" + +#if TEST_STD_VER >= 17 +#include +#endif + +#if TEST_STD_VER >= 20 +#include +#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::iterator { + using element_type = int; +}; +static_assert(std::__has_random_access_iterator_category::value, ""); +static_assert(!std::__libcpp_is_contiguous_iterator::value, ""); + +#if TEST_STD_VER >= 20 +struct fake2_deque_iterator : std::deque::iterator { + using iterator_concept = std::contiguous_iterator_tag; + using element_type = int; +}; +static_assert(std::__has_random_access_iterator_category::value, ""); +static_assert(std::__libcpp_is_contiguous_iterator::value, ""); +#endif + +int main(int, char**) +{ +// basic tests + static_assert(( std::__libcpp_is_contiguous_iterator::value), ""); + static_assert(( std::__libcpp_is_contiguous_iterator::value), ""); + static_assert(( std::__libcpp_is_contiguous_iterator::value), ""); + static_assert(( std::__libcpp_is_contiguous_iterator::value), ""); + static_assert(( std::__libcpp_is_contiguous_iterator::value), ""); + + static_assert((!std::__libcpp_is_contiguous_iterator::value), ""); + static_assert((!std::__libcpp_is_contiguous_iterator::value), ""); +#if TEST_STD_VER >= 20 + static_assert(( std::__libcpp_is_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 >::value), ""); + static_assert((!std::__libcpp_is_contiguous_iterator >::value), ""); + static_assert((!std::__libcpp_is_contiguous_iterator >::value), ""); + static_assert((!std::__libcpp_is_contiguous_iterator >::value), ""); + static_assert((!std::__libcpp_is_contiguous_iterator >::value), ""); +#if TEST_STD_VER >= 20 + static_assert((!std::__libcpp_is_contiguous_iterator >::value), ""); +#endif + + static_assert((!std::__libcpp_is_contiguous_iterator >::value), ""); + static_assert((!std::__libcpp_is_contiguous_iterator >::value), ""); + static_assert((!std::__libcpp_is_contiguous_iterator >::value), ""); + static_assert((!std::__libcpp_is_contiguous_iterator >::value), ""); + static_assert((!std::__libcpp_is_contiguous_iterator >::value), ""); +#if TEST_STD_VER >= 20 + static_assert((!std::__libcpp_is_contiguous_iterator >::value), ""); +#endif + + static_assert(( std::__libcpp_is_contiguous_iterator >::value), ""); + static_assert(( std::__libcpp_is_contiguous_iterator >::value), ""); + static_assert(( std::__libcpp_is_contiguous_iterator >::value), ""); + + static_assert(( std::__libcpp_is_contiguous_iterator >::value), ""); + static_assert(( std::__libcpp_is_contiguous_iterator > >::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 >::value), ""); + static_assert(( std::__libcpp_is_contiguous_iterator > >::value), ""); + +#if TEST_STD_VER >= 20 + static_assert(( std::__libcpp_is_contiguous_iterator >::value), ""); + static_assert(( std::__libcpp_is_contiguous_iterator > >::value), ""); +#endif + +// iterators in the libc++ test suite + static_assert((!std::__libcpp_is_contiguous_iterator >::value), ""); + static_assert((!std::__libcpp_is_contiguous_iterator >::value), ""); + static_assert((!std::__libcpp_is_contiguous_iterator >::value), ""); + static_assert((!std::__libcpp_is_contiguous_iterator >::value), ""); + static_assert((!std::__libcpp_is_contiguous_iterator >::value), ""); +#if TEST_STD_VER >= 20 + static_assert(( std::__libcpp_is_contiguous_iterator >::value), ""); +#endif + static_assert((!std::__libcpp_is_contiguous_iterator >::value), ""); + static_assert((!std::__libcpp_is_contiguous_iterator >::value), ""); + +// +// iterators from libc++'s containers +// + +// vector + static_assert(( std::__libcpp_is_contiguous_iterator::iterator> ::value), ""); + static_assert(( std::__libcpp_is_contiguous_iterator::const_iterator> ::value), ""); + static_assert((!std::__libcpp_is_contiguous_iterator::reverse_iterator> ::value), ""); + static_assert((!std::__libcpp_is_contiguous_iterator::const_reverse_iterator> ::value), ""); + static_assert(( std::__libcpp_is_contiguous_iterator::iterator> >::value), ""); + +// string + static_assert(( std::__libcpp_is_contiguous_iterator ::value), ""); + static_assert(( std::__libcpp_is_contiguous_iterator ::value), ""); + static_assert((!std::__libcpp_is_contiguous_iterator ::value), ""); + static_assert((!std::__libcpp_is_contiguous_iterator::value), ""); +#ifndef TEST_HAS_NO_WIDE_CHARACTERS + static_assert(( std::__libcpp_is_contiguous_iterator ::value), ""); + static_assert(( std::__libcpp_is_contiguous_iterator ::value), ""); + static_assert((!std::__libcpp_is_contiguous_iterator ::value), ""); + static_assert((!std::__libcpp_is_contiguous_iterator::value), ""); +#endif + +// deque is random-access but not contiguous + static_assert((!std::__libcpp_is_contiguous_iterator::iterator> ::value), ""); + static_assert((!std::__libcpp_is_contiguous_iterator::const_iterator> ::value), ""); + static_assert((!std::__libcpp_is_contiguous_iterator::reverse_iterator> ::value), ""); + static_assert((!std::__libcpp_is_contiguous_iterator::const_reverse_iterator> ::value), ""); + +// vector is random-access but not contiguous + static_assert((!std::__libcpp_is_contiguous_iterator::iterator> ::value), ""); + static_assert((!std::__libcpp_is_contiguous_iterator::const_iterator> ::value), ""); + static_assert((!std::__libcpp_is_contiguous_iterator::reverse_iterator> ::value), ""); + static_assert((!std::__libcpp_is_contiguous_iterator::const_reverse_iterator> ::value), ""); + +#if TEST_STD_VER >= 11 + static_assert(( std::__libcpp_is_contiguous_iterator::iterator> ::value), ""); + static_assert(( std::__libcpp_is_contiguous_iterator::const_iterator>::value), ""); +#endif + +#if TEST_STD_VER >= 17 + static_assert(( std::__libcpp_is_contiguous_iterator ::value), ""); + static_assert(( std::__libcpp_is_contiguous_iterator::value), ""); +#endif + +#if TEST_STD_VER >= 20 + static_assert(( std::__libcpp_is_contiguous_iterator::iterator> ::value), ""); + static_assert((!std::__libcpp_is_contiguous_iterator::reverse_iterator>::value), ""); + static_assert(( std::__libcpp_is_contiguous_iterator::iterator> ::value), ""); + static_assert((!std::__libcpp_is_contiguous_iterator::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 +// +//===----------------------------------------------------------------------===// +// + +// + +// __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 +#include +#include + +// expected-error-re@*:* {{static assertion failed due to requirement {{.*}}Only contiguous iterators can be adapted by __bounded_iter.}} +std::__bounded_iter::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::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 +#include "test_iterators.h" + +void test() { + int arr[] = {1, 2}; + cpp17_input_iterator 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 +// +//===----------------------------------------------------------------------===// + +// + +// back_insert_iterator + +// _Container* __get_container(); // constexpr in C++20 + +#include +#include + +#include "test_macros.h" +#include "nasty_containers.h" +#include "test_constexpr_container.h" + +template +TEST_CONSTEXPR_CXX20 bool test(C c) { + const std::back_insert_iterator i(c); + assert(i.__get_container() == std::addressof(c)); + return true; +} + +int main(int, char**) { + test(std::vector()); + test(nasty_vector()); +#if TEST_STD_VER >= 20 + test(ConstexprFixedCapacityDeque()); + static_assert(test(ConstexprFixedCapacityDeque())); +#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 +// +//===----------------------------------------------------------------------===// + +// + +// class ostreambuf_iterator + +// bool failed() const throw(); +// +// Extension: constructing from NULL is UB; we just make it a failed iterator + +#include +#include + +#include "test_macros.h" + +int main(int, char**) +{ + { + std::ostreambuf_iterator i(nullptr); + assert(i.failed()); + } +#ifndef TEST_HAS_NO_WIDE_CHARACTERS + { + std::ostreambuf_iterator 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 +#include +#include +#include + +#include "test_iterators.h" +#include "test_macros.h" + +template +using UnwrapT = decltype(std::__unwrap_iter(std::declval())); + +template +using rev_iter = std::reverse_iterator; + +template +using rev_rev_iter = rev_iter >; + +static_assert(std::is_same, int*>::value, ""); +static_assert(std::is_same >, int*>::value, ""); +static_assert(std::is_same >, std::reverse_iterator >::value, ""); +static_assert(std::is_same >, int*>::value, ""); +static_assert(std::is_same > >, int*>::value, ""); +static_assert(std::is_same > > >, rev_iter > >::value, ""); + +static_assert(std::is_same >, random_access_iterator >::value, ""); +static_assert(std::is_same > >, rev_iter > >::value, ""); +static_assert(std::is_same > >, random_access_iterator >::value, ""); +static_assert(std::is_same > > >, rev_iter > >::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(rev_iter(str.begin()))) == str.data()); + assert(std::__unwrap_iter(rev_rev_iter(rev_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 + +// + +// [support.c.headers.other]/1 +// ... except for the functions described in [sf.cmath], the +// std::lerp function overloads ([c.math.lerp]) ... + +#include + +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 +#include +#include + +#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(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(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(static_cast(p), under_align_val); + assert(stats.expect_plain()); + } + stats.reset(); + +#if defined(NO_SIZE) && defined(NO_ALIGN) + { + std::__libcpp_deallocate(static_cast(p), std::__element_count(with_size_val), over_align_val); + assert(stats.expect_plain()); + } + stats.reset(); +#elif defined(NO_SIZE) + { + std::__libcpp_deallocate(static_cast(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(static_cast(p), std::__element_count(with_size_val), over_align_val); + assert(stats.expect_size(with_size_val)); + } + stats.reset(); +#else + { + std::__libcpp_deallocate(static_cast(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(static_cast(p), over_align_val); + assert(stats.expect_align(over_align_val)); + } + stats.reset(); + { + std::__libcpp_deallocate(static_cast(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 + +#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 +#include +#include + +extern std::vector 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 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 +#include +#include + +extern std::vector 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 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 +#include "test_macros.h" + +template +void test() { + static_assert(_LIBCPP_ALIGNOF(T) == std::alignment_of::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(); + test(); + test(); + test(); + 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_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..2f2ebec949209 --- /dev/null +++ b/libcxx/test/libcxx-03/lit.local.cfg @@ -0,0 +1,7 @@ +# The tests in this directory need to run Python +import shlex +import sys + +# 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 +// +//===----------------------------------------------------------------------===// + +// + +// 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 +// _ForwardIterator +// __scan_keyword(_InputIterator& __b, _InputIterator __e, +// _ForwardIterator __kb, _ForwardIterator __ke, +// const _Ctype& __ct, ios_base::iostate& __err, +// bool __case_sensitive = true); + +#include +#include + +#include "test_macros.h" + +int main(int, char**) +{ + const std::ctype& ct = std::use_facet >(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 +// +//===----------------------------------------------------------------------===// + +// + +// 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 +#include +#include + +#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 +// +//===----------------------------------------------------------------------===// + +// + +// 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 +#include +#include + +#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 +// +//===----------------------------------------------------------------------===// + +// + +// 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 +#include + +#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 +// +//===----------------------------------------------------------------------===// + +// + +// This test verifies that the construction of locale::__imp does not allocate +// for facets, as it uses __sso_allocator. It would fail if new +// facets have been added (using install()) but N hasn't been adjusted to +// account for them. + +#include + +#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 +// +//===----------------------------------------------------------------------===// + +// + +// class locale::id +// { +// public: +// id(); +// void operator=(const id&) = delete; +// id(const id&) = delete; +// }; + +// This test isn't portable + +#include +#include + +#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 +// +//===----------------------------------------------------------------------===// + +// + +// template 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 +#include +#include + +#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(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 +// +//===----------------------------------------------------------------------===// +// + +// + +// To allow checking that self-move works correctly. +// ADDITIONAL_COMPILE_FLAGS: -Wno-self-move + +// XFAIL: FROZEN-CXX03-HEADERS-FIXME + +// template +// struct __allocation_guard; + +#include <__memory/allocation_guard.h> +#include +#include +#include + +#include "test_allocator.h" + +using A = test_allocator; + +// A trimmed-down version of `test_allocator` that is copy-assignable (in general allocators don't have to support copy +// assignment). +template +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::type; + using const_reference = typename std::add_lvalue_reference::type; + + template + struct rebind { + using other = test_allocator; + }; + + 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().allocate(n); + } + + TEST_CONSTEXPR_CXX14 void deallocate(pointer p, size_type s) { + if (stats_ != nullptr) { + --stats_->alloc_count; + } + std::allocator().deallocate(p, s); + } + + TEST_CONSTEXPR size_type max_size() const TEST_NOEXCEPT { return UINT_MAX / sizeof(T); } + + template + 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(val)); +#else + ::new (static_cast(p)) T(std::forward(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 >::value, ""); +static_assert(std::is_move_constructible >::value, ""); +static_assert(!std::is_copy_assignable >::value, ""); +static_assert(std::is_move_assignable >::value, ""); + +int main(int, char**) { + const int size = 42; + + { // The constructor allocates using the given allocator. + test_allocator_statistics stats; + std::__allocation_guard 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 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 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 guard1(A(&stats), size); + assert(stats.alloc_count == 1); + auto* ptr1 = guard1.__get(); + + std::__allocation_guard 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; + + test_allocator_statistics stats; + { + std::__allocation_guard guard1(A2(stats), size); + assert(stats.alloc_count == 1); + std::__allocation_guard 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; + + test_allocator_statistics stats; + { + std::__allocation_guard 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 is trivial. This was the case before C++20 +// with the std::allocator 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 +#include + +typedef std::allocator A1; +struct A2 : std::allocator { }; + +static_assert(std::is_trivially_default_constructible::value, ""); +static_assert(std::is_trivially_copyable::value, ""); + +static_assert(std::is_trivially_default_constructible::value, ""); +static_assert(std::is_trivially_copyable::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 + +std::allocator A1; // expected-error@*:* {{std::allocator does not support const types}} +std::allocator 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 +// +//===----------------------------------------------------------------------===// +// + +// +// UNSUPPORTED: c++03, c++11, c++14 + +// template +// struct __is_allocator; + +// Is either true_type or false_type depending on if A is an allocator. + +#include +#include + +#include "test_macros.h" +#include "min_allocator.h" +#include "test_allocator.h" + +template +void test_allocators() +{ + static_assert(!std::__is_allocator::value, "" ); + static_assert( std::__is_allocator>::value, "" ); + static_assert( std::__is_allocator>::value, "" ); + static_assert( std::__is_allocator>::value, "" ); +} + + +int main(int, char**) +{ + // test_allocators(); + test_allocators(); + test_allocators(); + test_allocators(); + + 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 + +// + +// template +// void __swap_allocator(_Alloc& __a1, _Alloc& __a2); + +#include <__memory/swap_allocator.h> +#include +#include +#include + +#include "test_macros.h" + +template +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; + + friend void swap(Alloc& a1, Alloc& a2) TEST_NOEXCEPT_COND(Noexcept) { + std::swap(a1.i, a2.i); + } + +}; + +using PropagatingAlloc = Alloc; +static_assert(std::allocator_traits::propagate_on_container_swap::value, ""); + +using NonPropagatingAlloc = Alloc; +static_assert(!std::allocator_traits::propagate_on_container_swap::value, ""); + +using NoexceptSwapAlloc = Alloc; +using ThrowingSwapAlloc = Alloc; + +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 +// +//===----------------------------------------------------------------------===// + +// + +// Test unique_ptr with trivial_abi as parameter type. + +// ADDITIONAL_COMPILE_FLAGS: -Wno-macro-redefined -D_LIBCPP_ABI_ENABLE_UNIQUE_PTR_TRIVIAL_ABI + +// XFAIL: gcc + +#include +#include + +__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 /*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(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 +// +//===----------------------------------------------------------------------===// + +// + +// Test arguments destruction order involving unique_ptr with trivial_abi. + +// ADDITIONAL_COMPILE_FLAGS: -Wno-macro-redefined -D_LIBCPP_ABI_ENABLE_UNIQUE_PTR_TRIVIAL_ABI + +// XFAIL: gcc + +#include +#include + +#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 /*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(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 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 +// +//===----------------------------------------------------------------------===// + +// + +// Test unique_ptr with trivial_abi as return-type. + +// ADDITIONAL_COMPILE_FLAGS: -Wno-macro-redefined -D_LIBCPP_ABI_ENABLE_UNIQUE_PTR_TRIVIAL_ABI + +// XFAIL: gcc + +#include +#include + +__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 make_val(void** local_addr) { + call_something(); + + auto ret = std::unique_ptr(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 +// +//===----------------------------------------------------------------------===// + +// + +// Test weak_ptr with trivial_abi as return-type. + +// ADDITIONAL_COMPILE_FLAGS: -Wno-macro-redefined -D_LIBCPP_ABI_ENABLE_SHARED_PTR_TRIVIAL_ABI + +// XFAIL: gcc + +#include +#include + +__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 +make_val(std::shared_ptr& sptr, void** local_addr) { + call_something(); + + std::weak_ptr 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(); + std::weak_ptr 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 +#include +#include + +#include "test_allocator.h" + +template +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 + void construct(T* ptr, Args&&... args) { + ::new (static_cast(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 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(std::begin(out))); + } catch (...) { + } + + assert(constructed_count == 0); + assert(max_constructed_count == 14); +} 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 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 + +#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/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(RealT) + +// Test the conversion function that truncates floating point types to the +// closest representable value for the specified integer type, or +// numeric_limits::max()/min() if the value isn't representable. + +// XFAIL: FROZEN-CXX03-HEADERS-FIXME + +#include <__random/clamp_to_integral.h> +#include +#include +#include + +template +void test() { + typedef std::numeric_limits Lim; + const bool MaxIsRepresentable = sizeof(IntT) < 8; + const bool IsSigned = std::is_signed::value; + struct TestCase { + double Input; + IntT Expect; + bool IsRepresentable; + } TestCases[] = { + {0, 0, true}, + {1, 1, true}, + {IsSigned ? static_cast(-1) : 0, + IsSigned ? static_cast(-1) : 0, true}, + {Lim::lowest(), Lim::lowest(), true}, + {static_cast(Lim::max()), Lim::max(), MaxIsRepresentable}, + {static_cast(Lim::max()) + 1, Lim::max(), false}, + {static_cast(Lim::max()) + 1024, Lim::max(), false}, + {nextafter(static_cast(Lim::max()), INFINITY), Lim::max(), false}, + }; + for (TestCase TC : TestCases) { + auto res = std::__clamp_to_integral(TC.Input); + assert(res == TC.Expect); + if (TC.IsRepresentable) { + auto other = static_cast(std::trunc(TC.Input)); + assert(res == other); + } else + assert(res == Lim::min() || res == Lim::max()); + } +} + +template +void test_float() { + typedef std::numeric_limits Lim; + const bool MaxIsRepresentable = sizeof(IntT) < 4; + ((void)MaxIsRepresentable); + const bool IsSigned = std::is_signed::value; + struct TestCase { + float Input; + IntT Expect; + bool IsRepresentable; + } TestCases[] = { + {0, 0, true}, + {1, 1, true}, + {IsSigned ? static_cast(-1) : 0, + IsSigned ? static_cast(-1) : 0, true}, + {Lim::lowest(), Lim::lowest(), true}, + {static_cast(Lim::max()), Lim::max(), MaxIsRepresentable }, + {nextafter(static_cast(Lim::max()), INFINITY), Lim::max(), false}, + }; + for (TestCase TC : TestCases) { + auto res = std::__clamp_to_integral(TC.Input); + assert(res == TC.Expect); + if (TC.IsRepresentable) { + auto other = static_cast(std::trunc(TC.Input)); + assert(res == other); + } else + assert(res == Lim::min() || res == Lim::max()); + } +} + +int main(int, char**) { + test(); + test(); + test(); + test(); + test(); + test(); + test_float(); + test_float(); + test_float(); + 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 +// +//===----------------------------------------------------------------------===// + +// + +// template +// complex +// __sqr(const complex& x); + +#include +#include + +#include "test_macros.h" + +template +void +test() +{ + const T tolerance = std::is_same::value ? 1.e-6 : 1.e-14; + + typedef std::complex 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 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(); + test(); + test(); + + 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 +// +//===----------------------------------------------------------------------===// + +// + +// XFAIL: FROZEN-CXX03-HEADERS-FIXME + +// template complex<__promote_t> pow(const complex&, const U&); +// template complex<__promote_t> pow(const complex&, const complex&); +// template complex<__promote_t> pow(const T&, const complex&); + +// Test that these additional overloads are free from catching std::complex, +// 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 +#include +#include +#include + +#include "test_macros.h" + +namespace usr { +struct usr_tag {}; + +template +typename std::enable_if<(std::is_same::value && std::is_floating_point::value) || + (std::is_floating_point::value && std::is_same::value), + int>::type +pow(const T&, const std::complex&) { + return std::is_same::value ? 0 : 1; +} + +template +typename std::enable_if<(std::is_same::value && std::is_floating_point::value) || + (std::is_floating_point::value && std::is_same::value), + int>::type +pow(const std::complex&, const U&) { + return std::is_same::value ? 2 : 3; +} + +template +typename std::enable_if<(std::is_same::value && std::is_floating_point::value) || + (std::is_floating_point::value && std::is_same::value), + int>::type +pow(const std::complex&, const std::complex&) { + return std::is_same::value ? 4 : 5; +} +} // namespace usr + +int main(int, char**) { + using std::pow; + using usr::pow; + + usr::usr_tag tag; + const std::complex ctag; + + assert(pow(tag, std::complex(1.0f)) == 0); + assert(pow(std::complex(1.0f), tag) == 2); + assert(pow(tag, std::complex(1.0)) == 0); + assert(pow(std::complex(1.0), tag) == 2); + assert(pow(tag, std::complex(1.0l)) == 0); + assert(pow(std::complex(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(1.0f)) == 4); + assert(pow(std::complex(1.0f), ctag) == 5); + assert(pow(ctag, std::complex(1.0)) == 4); + assert(pow(std::complex(1.0), ctag) == 5); + assert(pow(ctag, std::complex(1.0l)) == 4); + assert(pow(std::complex(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 +// +//===----------------------------------------------------------------------===// + +// + +// template class gslice_array; + +// T __get(size_t i); + +#include +#include + +#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 array(input, N); + + { + std::gslice_array result = + array[std::gslice(0, std::valarray(N, 1), std::valarray(1, 1))]; + for (unsigned i = 0; i < N; ++i) + assert(result.__get(i) == i); + } + + { + std::valarray sizes(2); + sizes[0] = 2; + sizes[1] = 3; + + std::valarray strides(2); + strides[0] = 6; + strides[1] = 1; + + std::gslice_array 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 +// +//===----------------------------------------------------------------------===// + +// + +// template class indirect_array; + +// T __get(size_t i); + +#include +#include + +#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 array(input, N); + + { + std::indirect_array result = array[std::valarray(std::size_t(0), std::size_t(N))]; + for (unsigned i = 0; i < N; ++i) + assert(result.__get(i) == 0); + } + + { + std::valarray indirect(std::size_t(0), std::size_t(3)); + indirect[0] = 4; + indirect[1] = 1; + indirect[2] = 3; + std::indirect_array 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 +// +//===----------------------------------------------------------------------===// + +// + +// template class mask_array; + +// T __get(size_t i); + +#include +#include + +#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 array(input, N); + + { + std::mask_array result = array[std::valarray(true, N)]; + for (unsigned i = 0; i < N; ++i) + assert(result.__get(i) == i); + } + + { + std::valarray mask(false, N); + mask[1] = true; + mask[3] = true; + std::mask_array result = array[mask]; + assert(result.__get(0) == 1); + assert(result.__get(1) == 3); + } + + { + std::valarray mask(false, N); + mask[0] = true; + mask[4] = true; + std::mask_array 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 +// +//===----------------------------------------------------------------------===// + +// + +// template class slice_array; + +// T __get(size_t i); + +#include +#include + +#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 array(input, N); + + { + std::slice_array result = array[std::slice(0, N, 1)]; + for (unsigned i = 0; i < N; ++i) + assert(result.__get(i) == i); + } + + { + std::slice_array result = array[std::slice(3, 2, 2)]; + assert(result.__get(0) == 3); + assert(result.__get(1) == 5); + } + + { + std::slice_array 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 + +void f() { + std::random_device d; // expected-error {{no type named 'random_device' in namespace 'std'}} +} 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 + +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 + +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 +#include +#include + +#include "test_macros.h" +#include "min_allocator.h" +#include "test_allocator.h" + +template +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 small_iter_allocator { +public: + using value_type = T; + using pointer = small_pointer; + using size_type = std::int16_t; + using difference_type = std::int16_t; + + small_iter_allocator() TEST_NOEXCEPT {} + + template + small_iter_allocator(small_iter_allocator) 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 +using min_string = std::basic_string, min_allocator >; + +template +using test_string = std::basic_string, test_allocator >; + +template +using small_string = std::basic_string, small_iter_allocator >; + +#if __SIZE_WIDTH__ == 64 + +static_assert(sizeof(std::string) == 24, ""); +static_assert(sizeof(min_string) == 24, ""); +static_assert(sizeof(test_string) == 32, ""); +static_assert(sizeof(small_string) == 6, ""); + +# ifndef TEST_HAS_NO_WIDE_CHARACTERS +# if __WCHAR_WIDTH__ == 32 +static_assert(sizeof(std::wstring) == 24, ""); +static_assert(sizeof(min_string) == 24, ""); +static_assert(sizeof(test_string) == 32, ""); +static_assert(sizeof(small_string) == 12, ""); +# elif __WCHAR_WIDTH__ == 16 +static_assert(sizeof(std::wstring) == 24, ""); +static_assert(sizeof(min_string) == 24, ""); +static_assert(sizeof(test_string) == 32, ""); +static_assert(sizeof(small_string) == 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) == 24, ""); +static_assert(sizeof(test_string) == 32, ""); +static_assert(sizeof(small_string) == 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) == 24, ""); +static_assert(sizeof(min_string) == 24, ""); +static_assert(sizeof(test_string) == 32, ""); +static_assert(sizeof(test_string) == 32, ""); +static_assert(sizeof(small_string) == 6, ""); +static_assert(sizeof(small_string) == 12, ""); +# endif + +#elif __SIZE_WIDTH__ == 32 + +static_assert(sizeof(std::string) == 12, ""); +static_assert(sizeof(min_string) == 12, ""); +static_assert(sizeof(test_string) == 24, ""); +static_assert(sizeof(small_string) == 6, ""); + +# ifndef TEST_HAS_NO_WIDE_CHARACTERS +# if __WCHAR_WIDTH__ == 32 +static_assert(sizeof(std::wstring) == 12, ""); +static_assert(sizeof(min_string) == 12, ""); +static_assert(sizeof(test_string) == 24, ""); +static_assert(sizeof(small_string) == 12, ""); +# elif __WCHAR_WIDTH__ == 16 +static_assert(sizeof(std::wstring) == 12, ""); +static_assert(sizeof(min_string) == 12, ""); +static_assert(sizeof(test_string) == 24, ""); +static_assert(sizeof(small_string) == 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) == 12, ""); +static_assert(sizeof(test_string) == 24, ""); +static_assert(sizeof(small_string) == 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) == 12, ""); +static_assert(sizeof(min_string) == 12, ""); +static_assert(sizeof(test_string) == 24, ""); +static_assert(sizeof(test_string) == 24, ""); +static_assert(sizeof(small_string) == 6, ""); +static_assert(sizeof(small_string) == 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 +// +//===----------------------------------------------------------------------===// + +// + +// 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 +#include +#include + +#include "test_macros.h" +#include "min_allocator.h" + +template +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(); + +#if TEST_STD_VER >= 11 + test, min_allocator > >(); +#endif + +#if TEST_STD_VER > 17 + static_assert(test()); +#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 +// +//===----------------------------------------------------------------------===// + +// + +#include +#include +#include +#include + +#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 + +// + +// This test ensures that the correct max_size() is returned depending on the platform. + +#include +#include +#include +#include + +#include "test_macros.h" + +// alignment of the string heap buffer is hardcoded to 8 +static const std::size_t alignment = 8; + +template +TEST_CONSTEXPR_CXX20 void full_size() { + std::string str; + assert(str.max_size() == std::numeric_limits::max() - alignment - 1); + +#ifndef TEST_HAS_NO_CHAR8_T + std::u8string u8str; + assert(u8str.max_size() == std::numeric_limits::max() - alignment - 1); +#endif + +#ifndef TEST_HAS_NO_WIDE_CHARACTERS + std::wstring wstr; + assert(wstr.max_size() == + ((std::numeric_limits::max() / sizeof(wchar_t) - alignment) & ~std::size_t(1)) - 1); +#endif + + std::u16string u16str; + std::u32string u32str; + assert(u16str.max_size() == ((std::numeric_limits::max() / 2 - alignment) & ~std::size_t(1)) - 1); + assert(u32str.max_size() == ((std::numeric_limits::max() / 4 - alignment) & ~std::size_t(1)) - 1); +} + +template +TEST_CONSTEXPR_CXX20 void half_size() { + std::string str; + assert(str.max_size() == std::numeric_limits::max() / 2 - alignment - 1); + +#ifndef TEST_HAS_NO_CHAR8_T + std::u8string u8str; + assert(u8str.max_size() == std::numeric_limits::max() / 2 - alignment - 1); +#endif + +#ifndef TEST_HAS_NO_WIDE_CHARACTERS + std::wstring wstr; + assert(wstr.max_size() == + std::numeric_limits::max() / std::max(2ul, sizeof(wchar_t)) - alignment - 1); +#endif + + std::u16string u16str; + std::u32string u32str; + assert(u16str.max_size() == std::numeric_limits::max() / 2 - alignment - 1); + assert(u32str.max_size() == std::numeric_limits::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 +// +//===----------------------------------------------------------------------===// + +// + +// basic_string(const basic_string& str); + +#include +#include + +#include "test_macros.h" +#include "test_allocator.h" +#include "min_allocator.h" + +template +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, test_allocator > >(); +#if TEST_STD_VER >= 11 + test, min_allocator>>(); +#endif +#if TEST_STD_VER > 17 + static_assert(test, test_allocator>>()); + static_assert(test, min_allocator>>()); +#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 +// +//===----------------------------------------------------------------------===// + +// + +// __resize_default_init(size_type) + +#include +#include + +#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 +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().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 +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 +TEST_CONSTEXPR_CXX20 bool test() { + test_basic(); + test_buffer_usage(); + + 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/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 +#include +#include + +#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 +TEST_CONSTEXPR_CXX14 void test_user_defined_types() { + static_assert(std::is_trivially_copyable::value, "test the test"); + static_assert(std::is_trivially_copyable::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 +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 +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(); + test_user_defined_types(); + test_user_defined_types(); + test_user_defined_types(); + + test_builtin_types(); + test_builtin_types(); + test_builtin_types(); + test_builtin_types(); + test_builtin_types(); + + // Cross-type + test_builtin_types(); + test_builtin_types(); + test_builtin_types(); + test_builtin_types(); + + test_pointer_types(); + test_pointer_types(); + test_pointer_types(); + test_pointer_types(); + test_pointer_types(); + + 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 +#include + +#include "check_assertion.h" + +template +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 , , and 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 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 + +// + +// class condition_variable; + +// typedef pthread_cond_t* native_handle_type; +// native_handle_type native_handle(); + +#include +#include +#include +#include + +#include "test_macros.h" + +int main(int, char**) +{ + static_assert((std::is_same::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 + +// + +// class mutex; + +// typedef pthread_mutex_t* native_handle_type; +// native_handle_type native_handle(); + +#include +#include + +#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 + +// + +// class recursive_mutex; + +// typedef pthread_mutex_t* native_handle_type; +// native_handle_type native_handle(); + +#include +#include + +#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 + +// + +// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_ENABLE_THREAD_SAFETY_ANNOTATIONS + +#include + +#include "test_macros.h" + +std::mutex m; +int foo __attribute__((guarded_by(m))); + +static void scoped() { +#if TEST_STD_VER >= 17 + std::scoped_lock lock(m); + foo++; +#endif +} + +int main(int, char**) { + scoped(); + std::lock_guard 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 + +// + +// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_ENABLE_THREAD_SAFETY_ANNOTATIONS + +#include + +#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 + +// + +// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_ENABLE_THREAD_SAFETY_ANNOTATIONS + +#include + +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 + +// + +// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_ENABLE_THREAD_SAFETY_ANNOTATIONS + +#include + +#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 + +// + +// class thread + +// native_handle_type native_handle(); + +#include +#include +#include +#include + +#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 + +// + +// class thread +// { +// public: +// typedef pthread_t native_handle_type; +// ... +// }; + +#include +#include + +#include "test_macros.h" + +int main(int, char**) +{ + static_assert((std::is_same::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 + +// + +// template +// void sleep_for(const chrono::duration& rel_time); + +#include +#include +#include + +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 which Windows doesn't provide +// UNSUPPORTED: windows + +// ALLOW_RETRIES: 3 + +// + +// template +// void sleep_for(const chrono::duration& 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 +#include +#include +#include // for std::memset + +#include +#include + +#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 /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 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 /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: + +
+ """) + 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 + +// + +// __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 +#include +#include +#include + +#include "user_defined_integral.h" + +template +struct EnumType +{ + enum type : T {E_zero, E_one}; +}; + + +template +void check_integral_types() +{ + typedef std::numeric_limits 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::value, ""); + } + { + UserDefinedIntegral 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::value, ""); + } + { + typedef typename EnumType::type Enum; + Enum e(static_cast(max)); + auto ret = std::__convert_to_integral(e); + assert(ret == max); + e = static_cast(min); + ret = std::__convert_to_integral(min); + assert(ret == min); + static_assert(std::is_same::value, ""); + } +} + + +template +void check_enum_types() +{ + auto ret = std::__convert_to_integral((From)1); + assert(ret == 1); + static_assert(std::is_same::value, ""); +} + + +enum enum1 { zero = 0, one = 1 }; +enum enum2 : unsigned long { + value = std::numeric_limits::max() +}; + +int main(int, char**) +{ + check_integral_types(); + check_integral_types(); + check_integral_types(); + check_integral_types(); +#ifndef TEST_HAS_NO_WIDE_CHARACTERS + check_integral_types(); +#endif + check_integral_types(); + // 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::type char_integral; + check_integral_types(); + check_integral_types(); + check_integral_types(); + check_integral_types(); + check_integral_types(); + check_integral_types(); + check_integral_types(); + check_integral_types(); + check_integral_types(); +#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::type Enum1UT; + check_enum_types(); + typedef std::underlying_type::type Enum2UT; + check_enum_types(); + + 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 +#include + +static_assert(std::__datasizeof_v == 1, ""); +static_assert(std::__datasizeof_v == 2, ""); +static_assert(std::__datasizeof_v == 4, ""); +static_assert(std::__datasizeof_v == 8, ""); + +struct NonStandardLayout { + virtual ~NonStandardLayout(); +}; + +static_assert(!std::is_standard_layout::value, ""); +static_assert(std::__datasizeof_v == sizeof(void*), ""); + +struct Empty {}; + +static_assert(std::__datasizeof_v == 0, ""); + +struct FinalEmpty final {}; + +static_assert(std::__datasizeof_v == 0, ""); + +struct OneBytePadding final { + OneBytePadding() {} + + std::int16_t a; + std::int8_t b; +}; + +#if defined(_WIN32) && !defined(__MINGW32__) +static_assert(std::__datasizeof_v == 4, ""); +#else +static_assert(std::__datasizeof_v == 3, ""); +#endif + +struct InBetweenPadding { + InBetweenPadding() {} + + std::int32_t a; + std::int8_t b; + std::int16_t c; +}; + +static_assert(std::__datasizeof_v == 8, ""); + +struct NoDataButNoPadding { + OneBytePadding v; +}; + +static_assert(std::__datasizeof_v == 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 = true; +} + +void tests() { + // Make sure that __desugars_to is false by default + { + struct Foo {}; + static_assert(!std::__desugars_to_v, ""); + } + + // Make sure that __desugars_to bypasses const and ref qualifiers on the operation + { + static_assert(std::__desugars_to_v, ""); // no quals + static_assert(std::__desugars_to_v, ""); + + static_assert(std::__desugars_to_v, ""); + static_assert(std::__desugars_to_v, ""); + + static_assert(std::__desugars_to_v, ""); + static_assert(std::__desugars_to_v, ""); + } +} 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::value, ""); +static_assert(std::__is_callable::value, ""); +static_assert(!std::__is_callable::value, ""); +static_assert(!std::__is_callable::value, ""); +static_assert(std::__is_callable::value, ""); +static_assert(!std::__is_callable::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 +// +//===----------------------------------------------------------------------===// +// + +// + +// __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 + +#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 +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "constexpr_char_traits.h" +#include "test_allocator.h" +#include "test_macros.h" + +#ifndef TEST_HAS_NO_LOCALIZATION +# include +#endif + +template +struct NonPropagatingStatefulMoveAssignAlloc : std::allocator { + using propagate_on_container_move_assignment = std::false_type; + using is_always_equal = std::false_type; + template + struct rebind { + using other = NonPropagatingStatefulMoveAssignAlloc; + }; +}; + +template +struct NonPropagatingStatefulCopyAssignAlloc : std::allocator { + using propagate_on_container_copy_assignment = std::false_type; + using is_always_equal = std::false_type; + template + struct rebind { + using other = NonPropagatingStatefulCopyAssignAlloc; + }; +}; + +template +struct NonPropagatingStatelessMoveAssignAlloc : std::allocator { + using propagate_on_container_move_assignment = std::false_type; + using is_always_equal = std::true_type; + template + struct rebind { + using other = NonPropagatingStatelessMoveAssignAlloc; + }; +}; + +template +struct NonPropagatingStatelessCopyAssignAlloc : std::allocator { + using propagate_on_container_copy_assignment = std::false_type; + using is_always_equal = std::true_type; + template + struct rebind { + using other = NonPropagatingStatelessCopyAssignAlloc; + }; +}; + +template +struct NonReplaceableStatelessAlloc : std::allocator { + // 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 + struct rebind { + using other = NonReplaceableStatelessAlloc; + }; +}; +static_assert(!std::__is_replaceable >::value, ""); + +static_assert(!std::__is_replaceable >::value, ""); // we use that property below + +struct Empty {}; +static_assert(std::__is_replaceable::value, ""); +static_assert(std::__is_replaceable::value, ""); +static_assert(std::__is_replaceable::value, ""); +static_assert(std::__is_replaceable::value, ""); + +struct TriviallyCopyable { + char c; + int i; + Empty s; +}; +static_assert(std::__is_replaceable::value, ""); + +struct NotTriviallyCopyable { + NotTriviallyCopyable(const NotTriviallyCopyable&); + ~NotTriviallyCopyable(); +}; +static_assert(!std::__is_replaceable::value, ""); + +struct MoveOnlyTriviallyCopyable { + MoveOnlyTriviallyCopyable(const MoveOnlyTriviallyCopyable&) = delete; + MoveOnlyTriviallyCopyable& operator=(const MoveOnlyTriviallyCopyable&) = delete; + MoveOnlyTriviallyCopyable(MoveOnlyTriviallyCopyable&&) = default; + MoveOnlyTriviallyCopyable& operator=(MoveOnlyTriviallyCopyable&&) = default; +}; +static_assert(std::__is_replaceable::value, ""); + +struct CustomCopyAssignment { + CustomCopyAssignment(const CustomCopyAssignment&) = default; + CustomCopyAssignment(CustomCopyAssignment&&) = default; + CustomCopyAssignment& operator=(const CustomCopyAssignment&); + CustomCopyAssignment& operator=(CustomCopyAssignment&&) = default; +}; +static_assert(!std::__is_replaceable::value, ""); + +struct CustomMoveAssignment { + CustomMoveAssignment(const CustomMoveAssignment&) = default; + CustomMoveAssignment(CustomMoveAssignment&&) = default; + CustomMoveAssignment& operator=(const CustomMoveAssignment&) = default; + CustomMoveAssignment& operator=(CustomMoveAssignment&&); +}; +static_assert(!std::__is_replaceable::value, ""); + +// library-internal types +// ---------------------- + +// __split_buffer +static_assert(std::__is_replaceable >::value, ""); +static_assert(std::__is_replaceable >::value, ""); +static_assert(!std::__is_replaceable > >::value, + ""); +static_assert(!std::__is_replaceable > >::value, + ""); +static_assert(std::__is_replaceable > >::value, + ""); +static_assert(std::__is_replaceable > >::value, + ""); + +// standard library types +// ---------------------- + +// array +static_assert(std::__is_replaceable >::value, ""); +static_assert(std::__is_replaceable >::value, ""); +static_assert(std::__is_replaceable, 0> >::value, ""); + +static_assert(std::__is_replaceable >::value, ""); +static_assert(!std::__is_replaceable >::value, ""); +static_assert(std::__is_replaceable, 1> >::value, ""); + +// basic_string +struct MyChar { + char c; +}; +template +struct NotReplaceableCharTraits : constexpr_char_traits { + NotReplaceableCharTraits(const NotReplaceableCharTraits&); + NotReplaceableCharTraits& operator=(const NotReplaceableCharTraits&); + ~NotReplaceableCharTraits(); +}; + +static_assert(std::__is_replaceable, std::allocator > >::value, + ""); +static_assert( + std::__is_replaceable, std::allocator > >::value, ""); +static_assert( + std::__is_replaceable, std::allocator > >::value, + ""); +static_assert(!std::__is_replaceable, test_allocator > >::value, + ""); +static_assert(!std::__is_replaceable< + std::basic_string, NonReplaceableStatelessAlloc > >::value, + ""); +static_assert(std::__is_replaceable< + std::basic_string, std::allocator > >::value, + ""); +static_assert( + !std::__is_replaceable< + std::basic_string, NonPropagatingStatefulCopyAssignAlloc > >::value, + ""); +static_assert( + !std::__is_replaceable< + std::basic_string, NonPropagatingStatefulMoveAssignAlloc > >::value, + ""); +static_assert( + std::__is_replaceable< + std::basic_string, NonPropagatingStatelessCopyAssignAlloc > >::value, + ""); +static_assert( + std::__is_replaceable< + std::basic_string, NonPropagatingStatelessMoveAssignAlloc > >::value, + ""); + +// deque +static_assert(std::__is_replaceable >::value, ""); +static_assert(std::__is_replaceable >::value, ""); +static_assert(!std::__is_replaceable > >::value, ""); +static_assert(!std::__is_replaceable > >::value, ""); +static_assert(!std::__is_replaceable > >::value, ""); +static_assert(!std::__is_replaceable > >::value, ""); +static_assert(std::__is_replaceable > >::value, ""); +static_assert(std::__is_replaceable > >::value, ""); + +// exception_ptr +#ifndef _LIBCPP_ABI_MICROSOFT +static_assert(std::__is_replaceable::value, ""); +#endif + +// expected +#if TEST_STD_VER >= 23 +static_assert(std::__is_replaceable >::value); +static_assert(!std::__is_replaceable>::value); +static_assert(!std::__is_replaceable>::value); +static_assert(!std::__is_replaceable>::value); +#endif + +// locale +#ifndef TEST_HAS_NO_LOCALIZATION +static_assert(std::__is_replaceable::value, ""); +#endif + +// optional +#if TEST_STD_VER >= 17 +static_assert(std::__is_replaceable>::value, ""); +static_assert(!std::__is_replaceable>::value, ""); +#endif + +// pair +static_assert(std::__is_replaceable >::value, ""); +static_assert(!std::__is_replaceable >::value, ""); +static_assert(!std::__is_replaceable >::value, ""); +static_assert(!std::__is_replaceable >::value, ""); + +// shared_ptr +static_assert(std::__is_replaceable >::value, ""); + +// tuple +#if TEST_STD_VER >= 11 +static_assert(std::__is_replaceable >::value, ""); + +static_assert(std::__is_replaceable >::value, ""); +static_assert(!std::__is_replaceable >::value, ""); + +static_assert(std::__is_replaceable >::value, ""); +static_assert(!std::__is_replaceable >::value, ""); +static_assert(!std::__is_replaceable >::value, ""); +static_assert(!std::__is_replaceable >::value, ""); +#endif // TEST_STD_VER >= 11 + +// unique_ptr +struct NonReplaceableDeleter { + NonReplaceableDeleter(const NonReplaceableDeleter&); + NonReplaceableDeleter& operator=(const NonReplaceableDeleter&); + ~NonReplaceableDeleter(); + + template + void operator()(T*); +}; + +struct NonReplaceablePointer { + struct pointer { + pointer(const pointer&); + pointer& operator=(const pointer&); + ~pointer(); + }; + + template + void operator()(T*); +}; + +static_assert(std::__is_replaceable >::value, ""); +static_assert(std::__is_replaceable >::value, ""); +static_assert(std::__is_replaceable >::value, ""); +static_assert(!std::__is_replaceable >::value, ""); +static_assert(!std::__is_replaceable >::value, ""); +static_assert(!std::__is_replaceable >::value, ""); +static_assert(!std::__is_replaceable >::value, ""); + +// variant +#if TEST_STD_VER >= 17 +static_assert(std::__is_replaceable >::value, ""); +static_assert(!std::__is_replaceable >::value, ""); + +static_assert(std::__is_replaceable >::value, ""); +static_assert(!std::__is_replaceable >::value, ""); +static_assert(!std::__is_replaceable >::value, ""); +static_assert(!std::__is_replaceable >::value, ""); +#endif // TEST_STD_VER >= 17 + +// vector +static_assert(std::__is_replaceable >::value, ""); +static_assert(std::__is_replaceable >::value, ""); +static_assert(!std::__is_replaceable > >::value, ""); +static_assert(!std::__is_replaceable > >::value, ""); +static_assert(!std::__is_replaceable > >::value, ""); +static_assert(!std::__is_replaceable > >::value, ""); +static_assert(std::__is_replaceable > >::value, ""); +static_assert(std::__is_replaceable > >::value, ""); + +// weak_ptr +static_assert(std::__is_replaceable >::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 + +enum Enum : int {}; +enum class EnumClass : int {}; + +static_assert(std::__libcpp_is_trivially_equality_comparable::value, ""); +static_assert(std::__libcpp_is_trivially_equality_comparable::value, ""); +static_assert(std::__libcpp_is_trivially_equality_comparable::value, ""); + +static_assert(std::__libcpp_is_trivially_equality_comparable::value, ""); +static_assert(std::__libcpp_is_trivially_equality_comparable::value, ""); +static_assert(!std::__libcpp_is_trivially_equality_comparable::value, ""); + +static_assert(!std::__libcpp_is_trivially_equality_comparable::value, ""); +static_assert(!std::__libcpp_is_trivially_equality_comparable::value, ""); + +static_assert(std::__libcpp_is_trivially_equality_comparable::value, ""); +static_assert(std::__libcpp_is_trivially_equality_comparable::value, ""); +static_assert(!std::__libcpp_is_trivially_equality_comparable::value, ""); + +static_assert(!std::__libcpp_is_trivially_equality_comparable::value, ""); +static_assert(!std::__libcpp_is_trivially_equality_comparable::value, ""); + +static_assert(!std::__libcpp_is_trivially_equality_comparable::value, ""); +static_assert(!std::__libcpp_is_trivially_equality_comparable::value, ""); + +static_assert(!std::__libcpp_is_trivially_equality_comparable::value, ""); + +static_assert(!std::__libcpp_is_trivially_equality_comparable::value, ""); +static_assert(!std::__libcpp_is_trivially_equality_comparable::value, ""); +static_assert(!std::__libcpp_is_trivially_equality_comparable::value, ""); + +static_assert(std::__libcpp_is_trivially_equality_comparable< + char, + typename std::conditional::value, signed char, unsigned char>::type>::value, + ""); +static_assert(std::__libcpp_is_trivially_equality_comparable::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::value, ""); +static_assert(!std::__libcpp_is_trivially_equality_comparable::value, ""); + +// This is trivially_equality_comparable, but we can't detect it currently +static_assert(!std::__libcpp_is_trivially_equality_comparable::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 +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "constexpr_char_traits.h" +#include "test_allocator.h" +#include "test_macros.h" + +#ifndef TEST_HAS_NO_LOCALIZATION +# include +#endif + +static_assert(std::__libcpp_is_trivially_relocatable::value, ""); +static_assert(std::__libcpp_is_trivially_relocatable::value, ""); +static_assert(std::__libcpp_is_trivially_relocatable::value, ""); + +struct Empty {}; +static_assert(std::__libcpp_is_trivially_relocatable::value, ""); + +struct TriviallyCopyable { + char c; + int i; + Empty s; +}; +static_assert(std::__libcpp_is_trivially_relocatable::value, ""); + +struct NotTriviallyCopyable { + NotTriviallyCopyable(const NotTriviallyCopyable&); + ~NotTriviallyCopyable(); +}; +static_assert(!std::__libcpp_is_trivially_relocatable::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::value, ""); + +struct NonTrivialMoveConstructor { + NonTrivialMoveConstructor(NonTrivialMoveConstructor&&); +}; +static_assert(!std::__libcpp_is_trivially_relocatable::value, ""); + +struct NonTrivialDestructor { + ~NonTrivialDestructor() {} +}; +static_assert(!std::__libcpp_is_trivially_relocatable::value, ""); + +// library-internal types +// ---------------------- + +// __split_buffer +static_assert(std::__libcpp_is_trivially_relocatable >::value, ""); +static_assert(std::__libcpp_is_trivially_relocatable >::value, ""); +static_assert(!std::__libcpp_is_trivially_relocatable > >::value, ""); + +// standard library types +// ---------------------- + +// array +static_assert(std::__libcpp_is_trivially_relocatable >::value, ""); +static_assert(std::__libcpp_is_trivially_relocatable >::value, ""); +static_assert(std::__libcpp_is_trivially_relocatable, 0> >::value, ""); + +static_assert(std::__libcpp_is_trivially_relocatable >::value, ""); +static_assert(!std::__libcpp_is_trivially_relocatable >::value, ""); +static_assert(std::__libcpp_is_trivially_relocatable, 1> >::value, ""); + +// basic_string +#if !__has_feature(address_sanitizer) || !_LIBCPP_INSTRUMENTED_WITH_ASAN +struct MyChar { + char c; +}; +template +struct NotTriviallyRelocatableCharTraits : constexpr_char_traits { + NotTriviallyRelocatableCharTraits(const NotTriviallyRelocatableCharTraits&); + NotTriviallyRelocatableCharTraits& operator=(const NotTriviallyRelocatableCharTraits&); + ~NotTriviallyRelocatableCharTraits(); +}; + +static_assert(std::__libcpp_is_trivially_relocatable< + std::basic_string, std::allocator > >::value, + ""); +static_assert(std::__libcpp_is_trivially_relocatable< + std::basic_string, std::allocator > >::value, + ""); +static_assert(std::__libcpp_is_trivially_relocatable< + std::basic_string, std::allocator > >::value, + ""); +static_assert( + std::__libcpp_is_trivially_relocatable< + std::basic_string, std::allocator > >::value, + ""); +static_assert(!std::__libcpp_is_trivially_relocatable< + std::basic_string, test_allocator > >::value, + ""); +static_assert( + !std::__libcpp_is_trivially_relocatable< + std::basic_string, test_allocator > >::value, + ""); +#endif + +// deque +static_assert(std::__libcpp_is_trivially_relocatable >::value, ""); +static_assert(std::__libcpp_is_trivially_relocatable >::value, ""); +static_assert(!std::__libcpp_is_trivially_relocatable > >::value, ""); + +// exception_ptr +#ifndef _LIBCPP_ABI_MICROSOFT // FIXME: Is this also the case on windows? +static_assert(std::__libcpp_is_trivially_relocatable::value, ""); +#endif + +// expected +#if TEST_STD_VER >= 23 +static_assert(std::__libcpp_is_trivially_relocatable >::value); +static_assert(std::__libcpp_is_trivially_relocatable, int>>::value); +static_assert(std::__libcpp_is_trivially_relocatable>>::value); +static_assert(std::__libcpp_is_trivially_relocatable, std::unique_ptr>>::value); + +static_assert(!std::__libcpp_is_trivially_relocatable>::value); +static_assert(!std::__libcpp_is_trivially_relocatable>::value); +static_assert( + !std::__libcpp_is_trivially_relocatable>::value); +#endif + +// locale +#ifndef TEST_HAS_NO_LOCALIZATION +static_assert(std::__libcpp_is_trivially_relocatable::value, ""); +#endif + +// optional +#if TEST_STD_VER >= 17 +static_assert(std::__libcpp_is_trivially_relocatable>::value, ""); +static_assert(!std::__libcpp_is_trivially_relocatable>::value, ""); +static_assert(std::__libcpp_is_trivially_relocatable>>::value, ""); +#endif // TEST_STD_VER >= 17 + +// pair +static_assert(std::__libcpp_is_trivially_relocatable >::value, ""); +static_assert(!std::__libcpp_is_trivially_relocatable >::value, ""); +static_assert(!std::__libcpp_is_trivially_relocatable >::value, ""); +static_assert(!std::__libcpp_is_trivially_relocatable >::value, + ""); +static_assert(std::__libcpp_is_trivially_relocatable, std::unique_ptr > >::value, + ""); + +// shared_ptr +static_assert(std::__libcpp_is_trivially_relocatable >::value, ""); + +// tuple +#if TEST_STD_VER >= 11 +static_assert(std::__libcpp_is_trivially_relocatable >::value, ""); + +static_assert(std::__libcpp_is_trivially_relocatable >::value, ""); +static_assert(!std::__libcpp_is_trivially_relocatable >::value, ""); +static_assert(std::__libcpp_is_trivially_relocatable > >::value, ""); + +static_assert(std::__libcpp_is_trivially_relocatable >::value, ""); +static_assert(!std::__libcpp_is_trivially_relocatable >::value, ""); +static_assert(!std::__libcpp_is_trivially_relocatable >::value, ""); +static_assert(!std::__libcpp_is_trivially_relocatable >::value, + ""); +static_assert(std::__libcpp_is_trivially_relocatable, std::unique_ptr > >::value, + ""); +#endif // TEST_STD_VER >= 11 + +// unique_ptr +struct NotTriviallyRelocatableDeleter { + NotTriviallyRelocatableDeleter(const NotTriviallyRelocatableDeleter&); + NotTriviallyRelocatableDeleter& operator=(const NotTriviallyRelocatableDeleter&); + ~NotTriviallyRelocatableDeleter(); + + template + void operator()(T*); +}; + +struct NotTriviallyRelocatablePointer { + struct pointer { + pointer(const pointer&); + pointer& operator=(const pointer&); + ~pointer(); + }; + + template + void operator()(T*); +}; + +static_assert(std::__libcpp_is_trivially_relocatable >::value, ""); +static_assert(std::__libcpp_is_trivially_relocatable >::value, ""); +static_assert(std::__libcpp_is_trivially_relocatable >::value, ""); +static_assert(!std::__libcpp_is_trivially_relocatable >::value, + ""); +static_assert(!std::__libcpp_is_trivially_relocatable >::value, + ""); +static_assert(!std::__libcpp_is_trivially_relocatable >::value, + ""); +static_assert(!std::__libcpp_is_trivially_relocatable >::value, + ""); + +// variant +#if TEST_STD_VER >= 17 +static_assert(std::__libcpp_is_trivially_relocatable >::value, ""); +static_assert(!std::__libcpp_is_trivially_relocatable >::value, ""); +static_assert(std::__libcpp_is_trivially_relocatable > >::value, ""); + +static_assert(std::__libcpp_is_trivially_relocatable >::value, ""); +static_assert(!std::__libcpp_is_trivially_relocatable >::value, ""); +static_assert(!std::__libcpp_is_trivially_relocatable >::value, ""); +static_assert(!std::__libcpp_is_trivially_relocatable >::value, + ""); +static_assert(std::__libcpp_is_trivially_relocatable, std::unique_ptr > >::value, + ""); +#endif // TEST_STD_VER >= 17 + +// vector +static_assert(std::__libcpp_is_trivially_relocatable >::value, ""); +static_assert(std::__libcpp_is_trivially_relocatable >::value, ""); +static_assert(!std::__libcpp_is_trivially_relocatable > >::value, ""); + +// weak_ptr +static_assert(std::__libcpp_is_trivially_relocatable >::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 +#include +#include + +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).name(), func()) != 0); + + return 0; +} + +#else + +const char* func() { return typeid(std::__exception_guard).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 +// +//===----------------------------------------------------------------------===// + +// + +// 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()' +// +// 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 +#include +#include +#include + +#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::setUncheckedCall(); } \ + R f(__VA_ARGS__) const { return MethodID::setUncheckedCall(); } \ + R f(__VA_ARGS__) volatile { return MethodID::setUncheckedCall(); } \ + R f(__VA_ARGS__) const volatile { return MethodID::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::setUncheckedCall(); } \ + R f(__VA_ARGS__) const & { return MethodID::setUncheckedCall(); } \ + R f(__VA_ARGS__) volatile & { return MethodID::setUncheckedCall(); } \ + R f(__VA_ARGS__) const volatile & { return MethodID::setUncheckedCall(); } \ + R f(__VA_ARGS__) && { return MethodID::setUncheckedCall(); } \ + R f(__VA_ARGS__) const && { return MethodID::setUncheckedCall(); } \ + R f(__VA_ARGS__) volatile && { return MethodID::setUncheckedCall(); } \ + R f(__VA_ARGS__) const volatile && { return MethodID::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 +struct TestCaseImp { +public: + + static void run() { TestCaseImp().doTest(); } + +private: + //========================================================================== + // TEST DISPATCH + void doTest() { + // (Plan-2) Create test call objects. + typedef ClassType T; + typedef DerivedFromType D; + T obj; + T* obj_ptr = &obj; + D der; + D* der_ptr = &der; + DerefToType dref; + DerefPropType dref2; + std::reference_wrapper rref(obj); + std::reference_wrapper drref(der); + + // (Plan-3) Dispatch based on the CV tags. + CV tag; + Bool 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 + void runTestDispatchIf(Bool, QT q, Tp& v) { + runTestDispatch(q, v); + } + + template + void runTestDispatchIf(Bool, QT, Tp&) { + } + + template + void runTestDispatch(Q_None, Tp& v) { + runTest(v); + } + + template + void runTestDispatch(Q_Const, Tp& v) { + runTest(v); + runTest(makeConst(v)); + } + + template + void runTestDispatch(Q_Volatile, Tp& v) { + runTest(v); + runTest(makeVolatile(v)); + + } + + template + void runTestDispatch(Q_CV, Tp& v) { + runTest(v); + runTest(makeConst(v)); + runTest(makeVolatile(v)); + runTest(makeCV(v)); + } + + template + void runTest(const std::reference_wrapper& obj) { + typedef Caster SCast; + typedef Caster ACast; + typedef CallSig (ClassType::*MemPtr); + // Delegate test to logic in invoke_helpers.h + BasicTest, Arity, SCast, ACast> b; + b.runTest( (MemPtr)&ClassType::f, obj); + } + + template + void runTest(T* obj) { + typedef Caster SCast; + typedef Caster ACast; + typedef CallSig (ClassType::*MemPtr); + // Delegate test to logic in invoke_helpers.h + BasicTest, Arity, SCast, ACast> b; + b.runTest( (MemPtr)&ClassType::f, obj); + } + + template + void runTest(Obj& obj) { + typedef Caster SCast; + typedef Caster ACast; + typedef CallSig (ClassType::*MemPtr); + // Delegate test to logic in invoke_helpers.h + BasicTest, Arity, SCast, ACast> b; + b.runTest( (MemPtr)&ClassType::f, obj); + } +}; + +template +struct TestCase : public TestCaseImp {}; + +#if TEST_STD_VER >= 11 +template +struct TestCase11 : public TestCaseImp {}; + +template +struct ReferenceWrapper { + using type = Type; + Type* ptr; + + static void fun(Type&) noexcept; + static void fun(Type&&) = delete; + + template ::value>::type> + constexpr ReferenceWrapper(Type2&& t) noexcept : ptr(&t) {} + + constexpr Type& get() const noexcept { return *ptr; } + constexpr operator Type&() const noexcept { return *ptr; } + + template + constexpr std::__invoke_result_t operator()(_ArgTypes&&... __args) const { + return std::__invoke(get(), std::forward<_ArgTypes>(__args)...); + } +}; + +template +struct DerivedFromRefWrap : public ReferenceWrapper { + constexpr DerivedFromRefWrap(Tp& tp) : ReferenceWrapper(tp) {} +}; + +TEST_CONSTEXPR_CXX14 bool test_derived_from_ref_wrap() { + int x = 42; + ReferenceWrapper r(x); + DerivedFromRefWrap d(x); + auto get_fn = &ReferenceWrapper::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::get; + std::reference_wrapper r(x); + std::reference_wrapper> 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::run(); + TestCase::run(); + TestCase::run(); + TestCase::run(); + TestCase::run(); + TestCase::run(); + TestCase::run(); + TestCase::run(); + TestCase::run(); + TestCase::run(); + TestCase::run(); + TestCase::run(); + TestCase::run(); + TestCase::run(); + TestCase::run(); + TestCase::run(); + TestCase::run(); + TestCase::run(); + TestCase::run(); + TestCase::run(); + TestCase::run(); + TestCase::run(); + TestCase::run(); + TestCase::run(); + TestCase::run(); + TestCase::run(); + TestCase::run(); + TestCase::run(); + TestCase::run(); + TestCase::run(); + TestCase::run(); + TestCase::run(); + +#if TEST_STD_VER >= 11 + TestCase11::run(); + TestCase11::run(); + TestCase11::run(); + TestCase11::run(); + TestCase11::run(); + TestCase11::run(); + TestCase11::run(); + TestCase11::run(); + TestCase11::run(); + TestCase11::run(); + TestCase11::run(); + TestCase11::run(); + TestCase11::run(); + TestCase11::run(); + TestCase11::run(); + TestCase11::run(); + TestCase11::run(); + TestCase11::run(); + TestCase11::run(); + TestCase11::run(); + TestCase11::run(); + TestCase11::run(); + TestCase11::run(); + TestCase11::run(); + TestCase11::run(); + TestCase11::run(); + TestCase11::run(); + TestCase11::run(); + TestCase11::run(); + TestCase11::run(); + TestCase11::run(); + TestCase11::run(); + TestCase11::run(); + TestCase11::run(); + TestCase11::run(); + TestCase11::run(); + TestCase11::run(); + TestCase11::run(); + TestCase11::run(); + TestCase11::run(); + TestCase11::run(); + TestCase11::run(); + TestCase11::run(); + TestCase11::run(); + TestCase11::run(); + TestCase11::run(); + TestCase11::run(); + TestCase11::run(); + TestCase11::run(); + TestCase11::run(); + TestCase11::run(); + TestCase11::run(); + TestCase11::run(); + TestCase11::run(); + TestCase11::run(); + TestCase11::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 + +// + +// 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 +#include +#include +#include + +#include "test_macros.h" +#include "invoke_helpers.h" + +template +struct TestMemberObject { + TestMemberObject() : object() {} + Tp object; +private: + TestMemberObject(TestMemberObject const&); + TestMemberObject& operator=(TestMemberObject const&); +}; + +template +struct TestCase { + public: + + static void run() { TestCase().doTest(); } + +private: + typedef TestMemberObject TestType; + + //========================================================================== + // TEST DISPATCH + void doTest() { + typedef DerivedFromType Derived; + TestType obj; + TestType* obj_ptr = &obj; + Derived der; + Derived* der_ptr = &der; + DerefToType dref; + DerefPropType dref2; + std::reference_wrapper rref(obj); + std::reference_wrapper drref(der); + + { + typedef ObjectType (TestType::*MemPtr); + typedef ObjectType E; + MemPtr M = &TestType::object; + runTestDispatch(M, obj, &obj.object); + runTestDispatch(M, der, &der.object); + runTestDispatch(M, dref2, &dref2.object.object); + runTestPropCVDispatch(M, obj_ptr, &obj_ptr->object); + runTestPropCVDispatch(M, der_ptr, &der_ptr->object); +#if TEST_STD_VER >= 11 + runTestPropCVDispatch(M, rref, &(rref.get().object)); + runTestPropCVDispatch(M, drref, &(drref.get().object)); +#endif + runTestNoPropDispatch(M, dref, &dref.object.object); + } + { + typedef ObjectType const (TestType::*CMemPtr); + typedef ObjectType const E; + CMemPtr M = &TestType::object; + runTestDispatch(M, obj, &obj.object); + runTestDispatch(M, der, &der.object); + runTestDispatch(M, dref2, &dref2.object.object); + runTestPropCVDispatch(M, obj_ptr, &obj_ptr->object); + runTestPropCVDispatch(M, der_ptr, &der_ptr->object); +#if TEST_STD_VER >= 11 + runTestPropCVDispatch(M, rref, &(rref.get().object)); + runTestPropCVDispatch(M, drref, &(drref.get().object)); +#endif + runTestNoPropDispatch(M, dref, &dref.object.object); + } + { + typedef ObjectType volatile (TestType::*VMemPtr); + typedef ObjectType volatile E; + VMemPtr M = &TestType::object; + runTestDispatch(M, obj, &obj.object); + runTestDispatch(M, der, &der.object); + runTestDispatch(M, dref2, &dref2.object.object); + runTestPropCVDispatch(M, obj_ptr, &obj_ptr->object); + runTestPropCVDispatch(M, der_ptr, &der_ptr->object); +#if TEST_STD_VER >= 11 + runTestPropCVDispatch(M, rref, &(rref.get().object)); + runTestPropCVDispatch(M, drref, &(drref.get().object)); +#endif + runTestNoPropDispatch(M, dref, &dref.object.object); + } + { + typedef ObjectType const volatile (TestType::*CVMemPtr); + typedef ObjectType const volatile E; + CVMemPtr M = &TestType::object; + runTestDispatch(M, obj, &obj.object); + runTestDispatch(M, der, &der.object); + runTestDispatch(M, dref2, &dref2.object.object); + runTestPropCVDispatch(M, obj_ptr, &obj_ptr->object); + runTestPropCVDispatch(M, der_ptr, &der_ptr->object); +#if TEST_STD_VER >= 11 + runTestPropCVDispatch(M, rref, &(rref.get().object)); + runTestPropCVDispatch(M, drref, &(drref.get().object)); +#endif + runTestNoPropDispatch(M, dref, &dref.object.object); + } + } + + template + void runTestDispatch(Fn M, T& obj, ObjectType* expect) { + runTest (M, C_(obj), expect); + runTest (M, C_(obj), expect); + runTest (M, C_(obj), expect); + runTest(M, C_(obj), expect); +#if TEST_STD_VER >= 11 + runTest (M, C_(obj), expect); + runTest (M, C_(obj), expect); + runTest (M, C_(obj), expect); + runTest(M, C_(obj), expect); +#endif + } + + template + void runTestPropCVDispatch(Fn M, T& obj, ObjectType* expect) { + runTest (M, obj, expect); + runTest (M, makeConst(obj), expect); + runTest (M, makeVolatile(obj), expect); + runTest(M, makeCV(obj), expect); + } + + template + void runTestNoPropDispatch(Fn M, T& obj, ObjectType* expect) { + runTest(M, C_(obj), expect); + runTest(M, C_(obj), expect); + runTest(M, C_(obj), expect); + runTest(M, C_(obj), expect); +#if TEST_STD_VER >= 11 + runTest(M, C_(obj), expect); + runTest(M, C_(obj), expect); + runTest(M, C_(obj), expect); + runTest(M, C_(obj), expect); +#endif + } + + template + 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 +#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(obj))), Expect + >::value), ""); + Expect e = std::__invoke(M, std::forward(obj)); + assert(&e == expect); + } + } +}; + +int main(int, char**) { + TestCase::run(); + TestCase::run(); + TestCase::run(); + TestCase::run(); + TestCase::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 +// +//===----------------------------------------------------------------------===// + +// + +// 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 +#include +#include + +#include "test_macros.h" +#include "invoke_helpers.h" + + +//============================================================================== +// freeFunction03 - A C++03 free function. +void*& freeFunction03() { + return FunctionPtrID::setUncheckedCall(); +} + +void*& freeFunction03(...) { + return FunctionPtrID::setUncheckedCall(); +} + +template +void*& freeFunction03(A0&) { + return FunctionPtrID::setUncheckedCall(); +} + + +template +void*& freeFunction03(A0&, ...) { + return FunctionPtrID::setUncheckedCall(); +} + +template +void*& freeFunction03(A0&, A1&) { + return FunctionPtrID::setUncheckedCall(); +} + + +template +void*& freeFunction03(A0&, A1&, ...) { + return FunctionPtrID::setUncheckedCall(); +} + +template +void*& freeFunction03(A0&, A1&, A2&) { + return FunctionPtrID::setUncheckedCall(); +} + +template +void*& freeFunction03(A0&, A1&, A2&, ...) { + return FunctionPtrID::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::setUncheckedCall(); } \ + __VA_ARGS__ R operator() Args const { return MethodID::setUncheckedCall(); } \ + __VA_ARGS__ R operator() Args volatile { return MethodID::setUncheckedCall(); } \ + __VA_ARGS__ R operator() Args const volatile { return MethodID::setUncheckedCall(); } +# + F(()) + F((A0&), template ) + F((A0&, A1&), template ) + F((A0&, A1&, A2&), template ) +#undef F +public: + Functor03() {} +private: + Functor03(Functor03 const&); + Functor03& operator=(Functor03 const&); +}; + + +#if TEST_STD_VER >= 11 + +//============================================================================== +// freeFunction11 - A C++11 free function. +template +void*& freeFunction11(Args&&...) { + return FunctionPtrID::setUncheckedCall(); +} + +template +void*& freeFunction11(Args&&...,...) { + return FunctionPtrID::setUncheckedCall(); +} + +//============================================================================== +// Functor11 - C++11 reference qualified test member functions. +struct Functor11 { + typedef void*& R; + typedef Functor11 C; + +#define F(CV) \ + template \ + R operator()(Args&&...) CV { return MethodID::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 +struct TestCaseFunctorImp { +public: + static void run() { + typedef MethodID MID; + BasicTest t; + typedef ClassType T; + typedef DerivedFromType 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 +struct TestCaseFreeFunction { +public: + static void run() { + typedef FunctionPtrID FID; + BasicTest t; + + DerefToType deref_to(FnPtr); + DerefToType 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 +void runFunctionTestCase11() { + TestCaseFreeFunction(); +} +#endif + +template +void runFunctionTestCase() { + TestCaseFreeFunction(); +#if TEST_STD_VER >= 11 + runFunctionTestCase11(); +#endif +} + +template +void runFunctorTestCase() { + TestCaseFunctorImp::run(); +} + +template +void runFunctorTestCase() { + TestCaseFunctorImp::run(); +} + +#if TEST_STD_VER >= 11 +// runTestCase - Run a test case for C++11 class functor types +template +void runFunctorTestCase11() { + TestCaseFunctorImp::run(); +} +#endif + +// runTestCase - Run a test case for both function and functor types. +template +void runTestCase() { + runFunctionTestCase(); + runFunctorTestCase (); +}; + +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(); + runFunctionTestCase(); + runFunctionTestCase(); + runFunctionTestCase(); + +#if TEST_STD_VER >= 11 + runFunctionTestCase11(); + runFunctionTestCase11(); +#endif + + runFunctorTestCase(); + runFunctorTestCase(); + runFunctorTestCase(); + runFunctorTestCase(); + runFunctorTestCase(); + runFunctorTestCase(); + runFunctorTestCase(); + runFunctorTestCase(); + runFunctorTestCase(); + runFunctorTestCase(); + runFunctorTestCase(); + runFunctorTestCase(); + runFunctorTestCase(); + runFunctorTestCase(); + runFunctorTestCase(); + runFunctorTestCase(); + { + typedef ConstCaster CC; + runFunctorTestCase(); + runFunctorTestCase(); + runFunctorTestCase(); + runFunctorTestCase(); + runFunctorTestCase(); + runFunctorTestCase(); + runFunctorTestCase(); + runFunctorTestCase(); + runFunctorTestCase(); + runFunctorTestCase(); + runFunctorTestCase(); + runFunctorTestCase(); + } + +#if TEST_STD_VER >= 11 + runFunctorTestCase11(); + runFunctorTestCase11(); + runFunctorTestCase11(); + runFunctorTestCase11(); + runFunctorTestCase11(); + runFunctorTestCase11(); + runFunctorTestCase11(); + runFunctorTestCase11(); + { + typedef MoveCaster MC; + runFunctorTestCase11(); + runFunctorTestCase11(); + runFunctorTestCase11(); + runFunctorTestCase11(); + runFunctorTestCase11(); + runFunctorTestCase11(); + runFunctorTestCase11(); + runFunctorTestCase11(); + } +#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 +#include + +#include "test_macros.h" + +template +struct Array +{ + typedef T type[N]; +}; + +struct Type +{ + Array::type& f1(); + Array::type& f2() const; +#if TEST_STD_VER >= 11 + Array::type& g1() &; + Array::type& g2() const &; + Array::type& g3() &&; + Array::type& g4() const &&; +#endif +}; + +int main(int, char**) +{ + static_assert(sizeof(std::__invoke(&Type::f1, std::declval())) == 1, ""); + static_assert(sizeof(std::__invoke(&Type::f2, std::declval())) == 2, ""); +#if TEST_STD_VER >= 11 + static_assert(sizeof(std::__invoke(&Type::g1, std::declval())) == 1, ""); + static_assert(sizeof(std::__invoke(&Type::g2, std::declval())) == 2, ""); + static_assert(sizeof(std::__invoke(&Type::g3, std::declval())) == 3, ""); + static_assert(sizeof(std::__invoke(&Type::g4, std::declval())) == 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 +#include +#include + +#include "test_macros.h" + +template +struct Int : public std::integral_constant {}; + +template +struct Bool : public std::integral_constant {}; + +struct Q_None { + template + struct apply { typedef T type; }; +}; + +struct Q_Const { + template + struct apply { typedef T const type; }; +}; + +struct Q_Volatile { + template + struct apply { typedef T volatile type; }; +}; + +struct Q_CV { + template + 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 +struct Caster { + template + struct apply { + typedef typename std::remove_reference::type RawType; + typedef typename QualTag::template apply::type CVType; +#if TEST_STD_VER >= 11 + typedef typename std::conditional::type type; +#else + typedef CVType& type; +#endif + }; + + template + typename apply::type + operator()(T& obj) const { + typedef typename apply::type OutType; + return static_cast(obj); + } +}; + +typedef Caster LValueCaster; +typedef Caster ConstCaster; +typedef Caster VolatileCaster; +typedef Caster CVCaster; +typedef Caster MoveCaster; +typedef Caster MoveConstCaster; +typedef Caster MoveVolatileCaster; +typedef Caster MoveCVCaster; + + +template +Tp const& makeConst(Tp& ref) { return ref; } + +template +Tp const* makeConst(Tp* ptr) { return ptr; } + +template +std::reference_wrapper makeConst(std::reference_wrapper& ref) { + return std::reference_wrapper(ref.get()); +} + +template +Tp volatile& makeVolatile(Tp& ref) { return ref; } + +template +Tp volatile* makeVolatile(Tp* ptr) { return ptr; } + +template +std::reference_wrapper makeVolatile(std::reference_wrapper& ref) { + return std::reference_wrapper(ref.get()); +} + +template +Tp const volatile& makeCV(Tp& ref) { return ref; } + +template +Tp const volatile* makeCV(Tp* ptr) { return ptr; } + +template +std::reference_wrapper makeCV(std::reference_wrapper& ref) { + return std::reference_wrapper(ref.get()); +} + +// A shorter name for 'static_cast' +template +QualType C_(Tp& v) { return static_cast(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 +struct DerivedFromType : public Base { + DerivedFromType() : Base() {} + template + 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 +struct DerefToType { + To object; + + DerefToType() {} + + template + explicit DerefToType(Up const& val) : object(val) {} + + To& operator*() const volatile { return const_cast(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 +struct DerefPropType { + To object; + + DerefPropType() {} + + template + 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(object); } + To const&& operator*() const && { return static_cast(object); } + To volatile&& operator*() volatile && { return static_cast(object); } + To const volatile&& operator*() const volatile && { return static_cast(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()` to assert +// that the method has been called and that the return value of `__invoke` +// matches what the method actually returned. +template +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 int MethodID::dummy = 0; +template void* MethodID::id = (void*)&MethodID::dummy; +template bool MethodID::unchecked_call = false; + + +//============================================================================== +// FunctionPtrID - Like MethodID but for free function pointers. +template +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 int FunctionPtrID::dummy = 0; +template void* FunctionPtrID::id = (void*)&FunctionPtrID::dummy; +template bool FunctionPtrID::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 +struct BasicTest { + template + void runTest(ObjectT& object) { + Int A; + runTestImp(A, object); + } + + template + void runTest(MethodPtr ptr, ObjectT& object) { + Int 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 + 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 + 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 + 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 + 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 + 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 + 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 + 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 + 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 + +// + +// reference_wrapper + +// check for deriving from binary_function + +#include +#include + +#include "test_macros.h" + +class functor1 + : public std::unary_function +{ +}; + +class functor2 + : public std::binary_function +{ +}; + +class functor3 + : public std::unary_function, + public std::binary_function +{ +public: + typedef float result_type; +}; + +class functor4 + : public std::unary_function, + public std::binary_function +{ +public: +}; + +struct C +{ + typedef int argument_type; + typedef int result_type; +}; + +int main(int, char**) +{ + static_assert((!std::is_base_of, + std::reference_wrapper >::value), ""); + static_assert((std::is_base_of, + std::reference_wrapper >::value), ""); + static_assert((std::is_base_of, + std::reference_wrapper >::value), ""); + static_assert((std::is_base_of, + std::reference_wrapper >::value), ""); + static_assert((!std::is_base_of, + std::reference_wrapper >::value), ""); + static_assert((!std::is_base_of, + std::reference_wrapper >::value), ""); + static_assert((!std::is_base_of, + std::reference_wrapper >::value), ""); + static_assert((std::is_base_of, + std::reference_wrapper >::value), ""); + static_assert((!std::is_base_of, + std::reference_wrapper >::value), ""); + static_assert((!std::is_base_of, + std::reference_wrapper >::value), ""); + static_assert((std::is_base_of, + std::reference_wrapper >::value), ""); + static_assert((!std::is_base_of, + std::reference_wrapper >::value), ""); + static_assert((std::is_base_of, + std::reference_wrapper >::value), ""); + static_assert((std::is_base_of, + std::reference_wrapper >::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 + +// + +// reference_wrapper + +// Ensure that std::reference_wrapper does not inhibit optimizations based on the +// std::__desugars_to internal helper. + +#include +#include <__type_traits/desugars_to.h> + +struct Operation {}; +struct Tag {}; + +namespace std { +template <> +bool const __desugars_to_v = true; +} + +static_assert(std::__desugars_to_v, "something is wrong with the test"); + +// make sure we pass through reference_wrapper +static_assert(std::__desugars_to_v >, ""); +static_assert(std::__desugars_to_v >, ""); 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 + +struct S1 : std::less, std::greater {}; + +static_assert(sizeof(S1) == 2, ""); + +struct S2 : std::less { 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 + +// + +// reference_wrapper + +// check for deriving from unary_function + +#include +#include + +#include "test_macros.h" + +class functor1 + : public std::unary_function +{ +}; + +class functor2 + : public std::binary_function +{ +}; + +class functor3 + : public std::unary_function, + public std::binary_function +{ +public: + typedef float result_type; +}; + +class functor4 + : public std::unary_function, + public std::binary_function +{ +public: +}; + +struct C +{ + typedef int argument_type; + typedef int result_type; +}; + +int main(int, char**) +{ + static_assert((std::is_base_of, + std::reference_wrapper >::value), ""); + static_assert((!std::is_base_of, + std::reference_wrapper >::value), ""); + static_assert((std::is_base_of, + std::reference_wrapper >::value), ""); + static_assert((std::is_base_of, + std::reference_wrapper >::value), ""); + static_assert((!std::is_base_of, + std::reference_wrapper >::value), ""); + static_assert((!std::is_base_of, + std::reference_wrapper >::value), ""); + static_assert((std::is_base_of, + std::reference_wrapper >::value), ""); + static_assert((!std::is_base_of, + std::reference_wrapper >::value), ""); + static_assert((std::is_base_of, + std::reference_wrapper >::value), ""); + static_assert((!std::is_base_of, + std::reference_wrapper >::value), ""); + static_assert((std::is_base_of, + std::reference_wrapper >::value), ""); + static_assert((std::is_base_of, + std::reference_wrapper >::value), ""); + static_assert((!std::is_base_of, + std::reference_wrapper >::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 +#include +#include +#include +#include + +#include "test_macros.h" + +typedef std::__murmur2_or_cityhash Hash32; +typedef std::__murmur2_or_cityhash 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 + +#include "test_macros.h" + +template +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(); + test_cv_quals(); + test_cv_quals(); + test_cv_quals(); + test_cv_quals(); + test_cv_quals(); + test_cv_quals(); + + 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 + +#include "test_macros.h" + +template +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(&storage.i), static_cast(&storage.i))); + assert(std::__is_valid_range(static_cast(&storage.i), static_cast(&storage.i + 1))); + + assert(!std::__is_valid_range(static_cast(&storage.j), static_cast(&storage.i))); + assert(!std::__is_valid_range(static_cast(&storage.i + 1), static_cast(&storage.i))); + + // We detect this as being a valid range even though it is not really valid. + assert(std::__is_valid_range(static_cast(&storage.i), static_cast(&storage.j))); + } + + { + T arr[3] = {1, 2, 3}; + assert(std::__is_valid_range(static_cast(&arr[0]), static_cast(&arr[0]))); + assert(std::__is_valid_range(static_cast(&arr[0]), static_cast(&arr[1]))); + assert(std::__is_valid_range(static_cast(&arr[0]), static_cast(&arr[2]))); + + assert(!std::__is_valid_range(static_cast(&arr[1]), static_cast(&arr[0]))); + assert(!std::__is_valid_range(static_cast(&arr[2]), static_cast(&arr[0]))); + } + +#if TEST_STD_VER >= 20 + { + T* arr = new int[4]{1, 2, 3, 4}; + assert(std::__is_valid_range(static_cast(arr), static_cast(arr + 4))); + delete[] arr; + } +#endif +} + +TEST_CONSTEXPR_CXX14 bool test() { + check_type(); + check_type(); + check_type(); + check_type(); + + 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 +// +//===----------------------------------------------------------------------===// + +// + +// template constexpr T* __to_address(T* p) noexcept; +// template constexpr auto __to_address(const Ptr& p) noexcept; + +#include +#include +#include + +#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 { + 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 { + 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 { + static int const* const& to_address(const P6&); +}; + +// Taken from a build breakage caused in Clang +namespace P7 { + template struct CanProxy; + template + struct CanQual { + CanProxy operator->() const { return CanProxy(); } + }; + template + struct CanProxy { + const CanProxy *operator->() const { return nullptr; } + }; +} // namespace P7 + +namespace P8 { + template + 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 + struct FancyPtrB { + T *p_; + TEST_CONSTEXPR FancyPtrB(T *p) : p_(p) {} + T& operator*() const; + }; +} // namespace P8 + +template +struct std::pointer_traits > { + static TEST_CONSTEXPR T *to_address(const P8::FancyPtrB& p) { return p.p_; } +}; + +struct Incomplete; +template 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*); + ASSERT_SAME_TYPE(decltype(std::__to_address(std::declval())), int const*); + ASSERT_SAME_TYPE(decltype(std::__to_address(std::declval())), int const*); + + P7::CanQual* p7 = nullptr; + assert(std::__to_address(p7) == nullptr); + ASSERT_SAME_TYPE(decltype(std::__to_address(p7)), P7::CanQual*); + + Holder *p8_nil = nullptr; // for C++03 compatibility + P8::FancyPtrA > p8a = p8_nil; + assert(std::__to_address(p8a) == p8_nil); + ASSERT_SAME_TYPE(decltype(std::__to_address(p8a)), decltype(p8_nil)); + + P8::FancyPtrB > 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 +// +//===----------------------------------------------------------------------===// + +// + +// template constexpr T* __to_address(T* p) noexcept; +// Mandates: T is not a function type. + +#include + +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 +// +//===----------------------------------------------------------------------===// + +// + +// template constexpr T* __to_address(T* p) noexcept; +// Mandates: T is not a function type. + +#include + +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 +// +//===----------------------------------------------------------------------===// + +// + +// template constexpr T* __to_address(T* p) noexcept; +// template constexpr auto __to_address(const Ptr& p) noexcept; + +#include + +#include +#include +#include +#include +#include +#include +#include +#include "test_macros.h" + +template +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 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()); + test_container_iterators(std::vector(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("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 +// +// +// +// class shared_ptr +// +// This test attempts to create a race condition surrounding use_count() +// with the hope that TSAN will diagnose it. + +#include +#include +#include +#include + +#include "make_test_thread.h" +#include "test_macros.h" + +typedef std::shared_ptr Ptr; +typedef std::weak_ptr 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(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 +// +// [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 +#include + +#include "test_macros.h" + +struct Foo {}; + +static_assert((!std::__is_referenceable_v), ""); +static_assert((std::__is_referenceable_v), ""); +static_assert((std::__is_referenceable_v), ""); +static_assert((std::__is_referenceable_v), ""); +static_assert((std::__is_referenceable_v), ""); +static_assert((std::__is_referenceable_v), ""); +static_assert((std::__is_referenceable_v), ""); +static_assert((std::__is_referenceable_v), ""); +static_assert((std::__is_referenceable_v), ""); +static_assert((std::__is_referenceable_v), ""); +static_assert((std::__is_referenceable_v), ""); +static_assert((std::__is_referenceable_v), ""); +#if TEST_STD_VER >= 11 +static_assert((std::__is_referenceable_v), ""); +static_assert((std::__is_referenceable_v), ""); +#endif + +static_assert((std::__is_referenceable_v), ""); +static_assert((std::__is_referenceable_v), ""); +static_assert((std::__is_referenceable_v), ""); +static_assert((std::__is_referenceable_v), ""); + +// Functions without cv-qualifiers are referenceable +static_assert((std::__is_referenceable_v), ""); +#if TEST_STD_VER >= 11 +static_assert((!std::__is_referenceable_v), ""); +static_assert((!std::__is_referenceable_v), ""); +static_assert((!std::__is_referenceable_v), ""); +static_assert((!std::__is_referenceable_v), ""); +static_assert((!std::__is_referenceable_v), ""); +#endif + +static_assert((std::__is_referenceable_v), ""); +#if TEST_STD_VER >= 11 +static_assert((!std::__is_referenceable_v), ""); +static_assert((!std::__is_referenceable_v), ""); +static_assert((!std::__is_referenceable_v), ""); +static_assert((!std::__is_referenceable_v), ""); +static_assert((!std::__is_referenceable_v), ""); +#endif + +static_assert((std::__is_referenceable_v), ""); +#if TEST_STD_VER >= 11 +static_assert((!std::__is_referenceable_v), ""); +static_assert((!std::__is_referenceable_v), ""); +static_assert((!std::__is_referenceable_v), ""); +static_assert((!std::__is_referenceable_v), ""); +static_assert((!std::__is_referenceable_v), ""); +#endif + +static_assert((std::__is_referenceable_v), ""); +#if TEST_STD_VER >= 11 +static_assert((!std::__is_referenceable_v), ""); +static_assert((!std::__is_referenceable_v), ""); +static_assert((!std::__is_referenceable_v), ""); +static_assert((!std::__is_referenceable_v), ""); +static_assert((!std::__is_referenceable_v), ""); +#endif + +static_assert((std::__is_referenceable_v), ""); +#if TEST_STD_VER >= 11 +static_assert((!std::__is_referenceable_v), ""); +static_assert((!std::__is_referenceable_v), ""); +static_assert((!std::__is_referenceable_v), ""); +static_assert((!std::__is_referenceable_v), ""); +static_assert((!std::__is_referenceable_v), ""); +#endif + +static_assert((std::__is_referenceable_v), ""); +#if TEST_STD_VER >= 11 +static_assert((!std::__is_referenceable_v), ""); +static_assert((!std::__is_referenceable_v), ""); +static_assert((!std::__is_referenceable_v), ""); +static_assert((!std::__is_referenceable_v), ""); +static_assert((!std::__is_referenceable_v), ""); +#endif + +static_assert((std::__is_referenceable_v), ""); +#if TEST_STD_VER >= 11 +static_assert((!std::__is_referenceable_v), ""); +static_assert((!std::__is_referenceable_v), ""); +static_assert((!std::__is_referenceable_v), ""); +static_assert((!std::__is_referenceable_v), ""); +static_assert((!std::__is_referenceable_v), ""); +#endif + +static_assert((std::__is_referenceable_v), ""); +#if TEST_STD_VER >= 11 +static_assert((!std::__is_referenceable_v), ""); +static_assert((!std::__is_referenceable_v), ""); +static_assert((!std::__is_referenceable_v), ""); +static_assert((!std::__is_referenceable_v), ""); +static_assert((!std::__is_referenceable_v), ""); +#endif + +// member functions with or without cv-qualifiers are referenceable +static_assert((std::__is_referenceable_v), ""); +static_assert((std::__is_referenceable_v), ""); +#if TEST_STD_VER >= 11 +static_assert((std::__is_referenceable_v), ""); +static_assert((std::__is_referenceable_v), ""); +static_assert((std::__is_referenceable_v), ""); +static_assert((std::__is_referenceable_v), ""); +#endif + +static_assert((std::__is_referenceable_v), ""); +static_assert((std::__is_referenceable_v), ""); +#if TEST_STD_VER >= 11 +static_assert((std::__is_referenceable_v), ""); +static_assert((std::__is_referenceable_v), ""); +static_assert((std::__is_referenceable_v), ""); +static_assert((std::__is_referenceable_v), ""); +#endif + +static_assert((std::__is_referenceable_v), ""); +static_assert((std::__is_referenceable_v), ""); +#if TEST_STD_VER >= 11 +static_assert((std::__is_referenceable_v), ""); +static_assert((std::__is_referenceable_v), ""); +static_assert((std::__is_referenceable_v), ""); +static_assert((std::__is_referenceable_v), ""); +#endif + +static_assert((std::__is_referenceable_v), ""); +static_assert((std::__is_referenceable_v), ""); +#if TEST_STD_VER >= 11 +static_assert((std::__is_referenceable_v), ""); +static_assert((std::__is_referenceable_v), ""); +static_assert((std::__is_referenceable_v), ""); +static_assert((std::__is_referenceable_v), ""); +#endif + +static_assert((std::__is_referenceable_v), ""); +static_assert((std::__is_referenceable_v), ""); +#if TEST_STD_VER >= 11 +static_assert((std::__is_referenceable_v), ""); +static_assert((std::__is_referenceable_v), ""); +static_assert((std::__is_referenceable_v), ""); +static_assert((std::__is_referenceable_v), ""); +#endif + +static_assert((std::__is_referenceable_v), ""); +static_assert((std::__is_referenceable_v), ""); +#if TEST_STD_VER >= 11 +static_assert((std::__is_referenceable_v), ""); +static_assert((std::__is_referenceable_v), ""); +static_assert((std::__is_referenceable_v), ""); +static_assert((std::__is_referenceable_v), ""); +#endif + +static_assert((std::__is_referenceable_v), ""); +static_assert((std::__is_referenceable_v), ""); +#if TEST_STD_VER >= 11 +static_assert((std::__is_referenceable_v), ""); +static_assert((std::__is_referenceable_v), ""); +static_assert((std::__is_referenceable_v), ""); +static_assert((std::__is_referenceable_v), ""); +#endif + +static_assert((std::__is_referenceable_v), ""); +static_assert((std::__is_referenceable_v), ""); +#if TEST_STD_VER >= 11 +static_assert((std::__is_referenceable_v), ""); +static_assert((std::__is_referenceable_v), ""); +static_assert((std::__is_referenceable_v), ""); +static_assert((std::__is_referenceable_v), ""); +#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 +#include +#include + +struct Bomb; +template +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, int); + ASSERT_SAME_TYPE(std::_If, long); +} + +void test_and() { + static_assert(std::_And::value, ""); + static_assert(!std::_And::value, ""); + static_assert(std::_And::value, ""); + static_assert(!std::_And >::value, ""); + static_assert(!std::_And >::value, ""); +} + +void test_or() { + static_assert(std::_Or::value, ""); + static_assert(!std::_Or::value, ""); + static_assert(std::_Or::value, ""); + static_assert(std::_Or > >::value, ""); + static_assert(!std::_Or::value, ""); + static_assert(std::_Or >::value, ""); + static_assert(std::_Or >::value, ""); +} + +void test_combined() { + static_assert(std::_And > >::value, ""); + static_assert(std::_And > >::value, ""); + static_assert(std::_Not > >::value, ""); +} + +struct MemberTest { + static int foo; + using type = long; + + void func(int); +}; +struct Empty {}; +struct MemberTest2 { + using foo = int; +}; +template +using HasFooData = decltype(T::foo); +template +using HasFooType = typename T::foo; + +template +using FuncCallable = decltype(std::declval().func(std::declval())); +template +using BadCheck = typename T::DOES_NOT_EXIST; + +void test_is_valid_trait() { + static_assert(std::_IsValidExpansion::value, ""); + static_assert(!std::_IsValidExpansion::value, ""); + static_assert(!std::_IsValidExpansion::value, ""); + static_assert(std::_IsValidExpansion::value, ""); + static_assert(std::_IsValidExpansion::value, ""); + static_assert(!std::_IsValidExpansion::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 +#include + +#include "test_macros.h" +#include "template_cost_testing.h" + +template 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 +#include + +#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 +#include +#include +#include + +#include "test_macros.h" +#include "template_cost_testing.h" + +template +struct TestType {}; + +template +struct ID { + using type = T; +}; + +namespace flat_impl { + +struct OverloadBase { void operator()() const; }; + +template +struct Overload { + auto operator()(Tp, Tp) const -> ID; +}; + +template +struct AllOverloads : OverloadBase, Bases... {}; + +template +struct MakeOverloads; + +template +struct MakeOverloads > { + template + using Apply = AllOverloads...>; +}; + +template +using Overloads = typename MakeOverloads< + std::__make_indices_imp >::template Apply; + +} // namespace flat_impl + + +namespace rec_impl { + +template struct Overload; + +template <> +struct Overload<> { void operator()() const; }; + +template +struct Overload : Overload { + using Overload::operator(); + auto operator()(Tp, Tp) const -> ID; +}; + +template +using Overloads = Overload; + +} // namespace rec_impl + +namespace variant_impl { + template + using Overloads = std::__variant_detail::_MakeOverloads; + } // namespace variant_impl + +#ifndef TEST_NS +#error TEST_NS must be defined +#endif + +#define TEST_TYPE() TestType< __COUNTER__ >, +using T1 = TEST_NS::Overloads, TestType<1>, int>; +static_assert(__COUNTER__ >= 1000, ""); + +void fn1(T1 x) { DoNotOptimize(&x); } +void fn2(typename std::invoke_result_t::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 + +#include "test_macros.h" + +#if TEST_STD_VER > 17 +// Test constexpr-constructibility. +constinit std::__no_destroy nd_int_const(std::__uninitialized_tag{}); +#endif + +struct DestroyLast { + ~DestroyLast() { assert(*ptr == 5); } + + int* ptr; +} last; + +static std::__no_destroy 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 includes , and + +// XFAIL: FROZEN-CXX03-HEADERS-FIXME + +#include + +#include "test_macros.h" + +#ifndef _LIBCPP_STRING +#error has not been included +#endif + +#ifndef _LIBCPP_STDEXCEPT +#error has not been included +#endif + +#ifndef _LIBCPP_IOSFWD +#error 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 + +// + +// template 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 +#include +#include +#include +#include + +#include "test_macros.h" + +template +struct HasNonTrivialABI : std::integral_constant::value + || (std::is_copy_constructible::value && !std::is_trivially_copy_constructible::value) +#if TEST_STD_VER >= 11 + || (std::is_move_constructible::value && !std::is_trivially_move_constructible::value) +#endif +> {}; + +#if TEST_STD_VER >= 11 +struct NonTrivialDtor { + NonTrivialDtor(NonTrivialDtor const&) = default; + ~NonTrivialDtor(); +}; +NonTrivialDtor::~NonTrivialDtor() {} +static_assert(HasNonTrivialABI::value, ""); + +struct NonTrivialCopy { + NonTrivialCopy(NonTrivialCopy const&); +}; +NonTrivialCopy::NonTrivialCopy(NonTrivialCopy const&) {} +static_assert(HasNonTrivialABI::value, ""); + +struct NonTrivialMove { + NonTrivialMove(NonTrivialMove const&) = default; + NonTrivialMove(NonTrivialMove&&); +}; +NonTrivialMove::NonTrivialMove(NonTrivialMove&&) {} +static_assert(HasNonTrivialABI::value, ""); + +struct DeletedCopy { + DeletedCopy(DeletedCopy const&) = delete; + DeletedCopy(DeletedCopy&&) = default; +}; +static_assert(!HasNonTrivialABI::value, ""); + +struct TrivialMove { + TrivialMove(TrivialMove &&) = default; +}; +static_assert(!HasNonTrivialABI::value, ""); + +struct Trivial { + Trivial(Trivial const&) = default; +}; +static_assert(!HasNonTrivialABI::value, ""); +#endif + + +void test_trivial() +{ + { + typedef std::pair P; + static_assert(std::is_copy_constructible

::value, ""); + static_assert(HasNonTrivialABI

::value, ""); + } +#if TEST_STD_VER >= 11 + { + typedef std::pair P; + static_assert(std::is_move_constructible

::value, ""); + static_assert(HasNonTrivialABI

::value, ""); + } + { + using P = std::pair; + static_assert(!std::is_trivially_destructible

::value, ""); + static_assert(std::is_copy_constructible

::value, ""); + static_assert(!std::is_trivially_copy_constructible

::value, ""); + static_assert(std::is_move_constructible

::value, ""); + static_assert(!std::is_trivially_move_constructible

::value, ""); + static_assert(HasNonTrivialABI

::value, ""); + } + { + using P = std::pair; + static_assert(std::is_copy_constructible

::value, ""); + static_assert(!std::is_trivially_copy_constructible

::value, ""); + static_assert(std::is_move_constructible

::value, ""); + static_assert(!std::is_trivially_move_constructible

::value, ""); + static_assert(HasNonTrivialABI

::value, ""); + } + { + using P = std::pair; + static_assert(std::is_copy_constructible

::value, ""); + static_assert(!std::is_trivially_copy_constructible

::value, ""); + static_assert(std::is_move_constructible

::value, ""); + static_assert(!std::is_trivially_move_constructible

::value, ""); + static_assert(HasNonTrivialABI

::value, ""); + } + { + using P = std::pair; + static_assert(!std::is_copy_constructible

::value, ""); + static_assert(!std::is_trivially_copy_constructible

::value, ""); + static_assert(std::is_move_constructible

::value, ""); + static_assert(!std::is_trivially_move_constructible

::value, ""); + static_assert(HasNonTrivialABI

::value, ""); + } + { + using P = std::pair; + static_assert(std::is_copy_constructible

::value, ""); + static_assert(!std::is_trivially_copy_constructible

::value, ""); + static_assert(std::is_move_constructible

::value, ""); + static_assert(!std::is_trivially_move_constructible

::value, ""); + static_assert(HasNonTrivialABI

::value, ""); + } + { + using P = std::pair; + static_assert(!std::is_copy_constructible

::value, ""); + static_assert(!std::is_trivially_copy_constructible

::value, ""); + static_assert(std::is_move_constructible

::value, ""); + static_assert(!std::is_trivially_move_constructible

::value, ""); + static_assert(HasNonTrivialABI

::value, ""); + } +#endif +} + +void test_layout() { + typedef std::pair, 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 +// +//===----------------------------------------------------------------------===// + +// + +// template 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 +#include +#include +#include +#include + +#include "test_macros.h" + +template +struct HasTrivialABI : std::integral_constant::value + && (!std::is_copy_constructible::value || std::is_trivially_copy_constructible::value) +#if TEST_STD_VER >= 11 + && (!std::is_move_constructible::value || std::is_trivially_move_constructible::value) +#endif +> {}; + +#if TEST_STD_VER >= 11 +struct NonTrivialDtor { + NonTrivialDtor(NonTrivialDtor const&) = default; + ~NonTrivialDtor(); +}; +NonTrivialDtor::~NonTrivialDtor() {} +static_assert(!HasTrivialABI::value, ""); + +struct NonTrivialCopy { + NonTrivialCopy(NonTrivialCopy const&); +}; +NonTrivialCopy::NonTrivialCopy(NonTrivialCopy const&) {} +static_assert(!HasTrivialABI::value, ""); + +struct NonTrivialMove { + NonTrivialMove(NonTrivialMove const&) = default; + NonTrivialMove(NonTrivialMove&&); +}; +NonTrivialMove::NonTrivialMove(NonTrivialMove&&) {} +static_assert(!HasTrivialABI::value, ""); + +struct DeletedCopy { + DeletedCopy(DeletedCopy const&) = delete; + DeletedCopy(DeletedCopy&&) = default; +}; +static_assert(HasTrivialABI::value, ""); + +struct TrivialMove { + TrivialMove(TrivialMove &&) = default; +}; +static_assert(HasTrivialABI::value, ""); + +struct Trivial { + Trivial(Trivial const&) = default; +}; +static_assert(HasTrivialABI::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 P; + static_assert(std::is_copy_constructible

::value, ""); + static_assert(HasTrivialABI

::value, ""); + } +#if TEST_STD_VER >= 11 + { + typedef std::pair P; + static_assert(std::is_move_constructible

::value, ""); + static_assert(HasTrivialABI

::value, ""); + } + { + using P = std::pair; + static_assert(!std::is_trivially_destructible

::value, ""); + static_assert(std::is_copy_constructible

::value, ""); + static_assert(!std::is_trivially_copy_constructible

::value, ""); + static_assert(std::is_move_constructible

::value, ""); + static_assert(!std::is_trivially_move_constructible

::value, ""); + static_assert(!HasTrivialABI

::value, ""); + } + { + using P = std::pair; + static_assert(std::is_copy_constructible

::value, ""); + static_assert(!std::is_trivially_copy_constructible

::value, ""); + static_assert(std::is_move_constructible

::value, ""); + static_assert(!std::is_trivially_move_constructible

::value, ""); + static_assert(!HasTrivialABI

::value, ""); + } + { + using P = std::pair; + static_assert(std::is_copy_constructible

::value, ""); + static_assert(std::is_trivially_copy_constructible

::value, ""); + static_assert(std::is_move_constructible

::value, ""); + static_assert(!std::is_trivially_move_constructible

::value, ""); + static_assert(!HasTrivialABI

::value, ""); + } + { + using P = std::pair; + static_assert(!std::is_copy_constructible

::value, ""); + static_assert(!std::is_trivially_copy_constructible

::value, ""); + static_assert(std::is_move_constructible

::value, ""); + static_assert(std::is_trivially_move_constructible

::value, ""); + static_assert(HasTrivialABI

::value, ""); + } + { + using P = std::pair; + static_assert(std::is_copy_constructible

::value, ""); + static_assert(std::is_trivially_copy_constructible

::value, ""); + static_assert(std::is_move_constructible

::value, ""); + static_assert(std::is_trivially_move_constructible

::value, ""); + static_assert(HasTrivialABI

::value, ""); + } + { + using P = std::pair; + static_assert(!std::is_copy_constructible

::value, ""); + static_assert(!std::is_trivially_copy_constructible

::value, ""); + static_assert(std::is_move_constructible

::value, ""); + static_assert(std::is_trivially_move_constructible

::value, ""); + static_assert(HasTrivialABI

::value, ""); + } +#endif + { + using P = std::pair; + static_assert(std::is_trivially_copy_constructible

::value, ""); + static_assert(std::is_trivially_move_constructible

::value, ""); +#if TEST_STD_VER >= 11 // This is https://llvm.org/PR90605 + static_assert(!std::is_trivially_copy_assignable

::value, ""); + static_assert(!std::is_trivially_move_assignable

::value, ""); +#endif // TEST_STD_VER >= 11 + static_assert(std::is_trivially_destructible

::value, ""); + } + { + using P = std::pair; +#if TEST_STD_VER >= 11 + static_assert(!std::is_trivially_copy_constructible

::value, ""); + static_assert(!std::is_trivially_move_constructible

::value, ""); +#endif // TEST_STD_VER >= 11 + static_assert(!std::is_trivially_copy_assignable

::value, ""); + static_assert(!std::is_trivially_move_assignable

::value, ""); + static_assert(std::is_trivially_destructible

::value, ""); + } +} + +void test_layout() { + typedef std::pair, 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 +#include + +#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::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::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::value, ""); + +static_assert(!std::is_trivially_copyable >::value, ""); +static_assert(!std::is_trivially_copyable >::value, ""); +static_assert(!std::is_trivially_copyable >::value, ""); + +static_assert(!std::is_trivially_copyable >::value, ""); +static_assert(!std::is_trivially_copyable >::value, ""); +static_assert(!std::is_trivially_copyable >::value, ""); +static_assert(!std::is_trivially_copyable, int> >::value, ""); +static_assert(!std::is_trivially_copyable >::value, ""); +#if TEST_STD_VER == 03 // Known ABI difference +static_assert(!std::is_trivially_copyable >::value, ""); +static_assert(!std::is_trivially_copyable >::value, ""); +#else +static_assert(std::is_trivially_copyable >::value, ""); +static_assert(std::is_trivially_copyable >::value, ""); +#endif +static_assert(!std::is_trivially_copyable >::value, ""); + +static_assert(std::is_trivially_copy_constructible >::value, ""); +static_assert(std::is_trivially_move_constructible >::value, ""); +static_assert(!std::is_trivially_copy_assignable >::value, ""); +static_assert(!std::is_trivially_move_assignable >::value, ""); +static_assert(std::is_trivially_destructible >::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 +#include + +struct Test { + std::vector > v; +}; + +std::pair 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 +// +//===----------------------------------------------------------------------===// + +// + +// template struct pair + +// tuple_element >::type + +#include + +void f() { + typedef std::pair 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>}} +} 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 + +static_assert(std::is_trivially_copyable::value, ""); +static_assert(std::is_trivially_default_constructible::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 + +template +struct optional { + T val_; + _LIBCPP_HIDE_FROM_ABI _LIBCPP_INTRODUCED_IN_LLVM_11_ATTRIBUTE T value() const { return val_; } +}; + +using PMF = int (optional::*)() const; +PMF f() { return &optional::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 +#include "test_macros.h" +#include "assert.h" + +void foo() {} + +void test_call() { + std::function r(foo); + r(); +} + +void test_throw() { +#ifndef TEST_HAS_NO_EXCEPTIONS + std::function 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: 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 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