summaryrefslogtreecommitdiff
path: root/libcxx
diff options
context:
space:
mode:
Diffstat (limited to 'libcxx')
-rw-r--r--libcxx/.clang-tidy2
-rw-r--r--libcxx/CMakeLists.txt4
-rw-r--r--libcxx/benchmarks/algorithms/pstl.stable_sort.bench.cpp1
-rw-r--r--libcxx/cmake/caches/Apple.cmake3
-rw-r--r--libcxx/cmake/caches/Generic-msan.cmake2
-rw-r--r--libcxx/docs/FeatureTestMacroTable.rst4
-rw-r--r--libcxx/docs/ReleaseNotes/19.rst10
-rw-r--r--libcxx/docs/Status/Cxx20Papers.csv2
-rw-r--r--libcxx/docs/Status/Cxx23Papers.csv2
-rw-r--r--libcxx/docs/Status/ParallelismProjects.csv1
-rw-r--r--libcxx/include/CMakeLists.txt10
-rw-r--r--libcxx/include/__algorithm/comp_ref_type.h6
-rw-r--r--libcxx/include/__algorithm/make_projected.h8
-rw-r--r--libcxx/include/__algorithm/pstl.h1159
-rw-r--r--libcxx/include/__algorithm/pstl_frontend_dispatch.h44
-rw-r--r--libcxx/include/__algorithm/simd_utils.h6
-rw-r--r--libcxx/include/__atomic/atomic_base.h7
-rw-r--r--libcxx/include/__atomic/atomic_init.h8
-rw-r--r--libcxx/include/__atomic/atomic_sync.h18
-rw-r--r--libcxx/include/__atomic/memory_order.h2
-rw-r--r--libcxx/include/__bit_reference19
-rw-r--r--libcxx/include/__charconv/chars_format.h9
-rw-r--r--libcxx/include/__chrono/duration.h12
-rw-r--r--libcxx/include/__chrono/exception.h135
-rw-r--r--libcxx/include/__chrono/ostream.h2
-rw-r--r--libcxx/include/__chrono/time_point.h31
-rw-r--r--libcxx/include/__chrono/time_zone.h77
-rw-r--r--libcxx/include/__chrono/zoned_time.h55
-rw-r--r--libcxx/include/__config12
-rw-r--r--libcxx/include/__config_site.in1
-rw-r--r--libcxx/include/__configuration/abi.h2
-rw-r--r--libcxx/include/__configuration/availability.h18
-rw-r--r--libcxx/include/__exception/exception_ptr.h12
-rw-r--r--libcxx/include/__expected/expected.h10
-rw-r--r--libcxx/include/__format/escaped_output_table.h2
-rw-r--r--libcxx/include/__format/formatter_output.h20
-rw-r--r--libcxx/include/__format/parser_std_format_spec.h4
-rw-r--r--libcxx/include/__format/width_estimation_table.h2
-rw-r--r--libcxx/include/__functional/bind.h8
-rw-r--r--libcxx/include/__functional/bind_back.h2
-rw-r--r--libcxx/include/__functional/bind_front.h5
-rw-r--r--libcxx/include/__functional/function.h12
-rw-r--r--libcxx/include/__functional/mem_fn.h4
-rw-r--r--libcxx/include/__functional/mem_fun_ref.h4
-rw-r--r--libcxx/include/__functional/operations.h73
-rw-r--r--libcxx/include/__functional/pointer_to_binary_function.h4
-rw-r--r--libcxx/include/__functional/pointer_to_unary_function.h4
-rw-r--r--libcxx/include/__functional/reference_wrapper.h2
-rw-r--r--libcxx/include/__functional/unary_negate.h4
-rw-r--r--libcxx/include/__hash_table31
-rw-r--r--libcxx/include/__iterator/access.h4
-rw-r--r--libcxx/include/__iterator/bounded_iter.h4
-rw-r--r--libcxx/include/__iterator/cpp17_iterator_concepts.h2
-rw-r--r--libcxx/include/__iterator/data.h4
-rw-r--r--libcxx/include/__iterator/iter_swap.h2
-rw-r--r--libcxx/include/__iterator/move_iterator.h4
-rw-r--r--libcxx/include/__iterator/reverse_iterator.h11
-rw-r--r--libcxx/include/__iterator/size.h8
-rw-r--r--libcxx/include/__iterator/wrap_iter.h4
-rw-r--r--libcxx/include/__locale3
-rw-r--r--libcxx/include/__locale_dir/locale_base_api/locale_guard.h5
-rw-r--r--libcxx/include/__math/exponential_functions.h2
-rw-r--r--libcxx/include/__math/fdim.h2
-rw-r--r--libcxx/include/__math/fma.h6
-rw-r--r--libcxx/include/__math/hypot.h2
-rw-r--r--libcxx/include/__math/inverse_trigonometric_functions.h2
-rw-r--r--libcxx/include/__math/min_max.h4
-rw-r--r--libcxx/include/__math/modulo.h2
-rw-r--r--libcxx/include/__math/remainder.h4
-rw-r--r--libcxx/include/__math/rounding_functions.h2
-rw-r--r--libcxx/include/__mdspan/extents.h13
-rw-r--r--libcxx/include/__mdspan/layout_left.h2
-rw-r--r--libcxx/include/__mdspan/layout_right.h2
-rw-r--r--libcxx/include/__mdspan/layout_stride.h2
-rw-r--r--libcxx/include/__mdspan/mdspan.h4
-rw-r--r--libcxx/include/__memory/allocate_at_least.h6
-rw-r--r--libcxx/include/__memory/allocator.h28
-rw-r--r--libcxx/include/__memory/allocator_traits.h9
-rw-r--r--libcxx/include/__memory/compressed_pair.h4
-rw-r--r--libcxx/include/__memory/pointer_traits.h18
-rw-r--r--libcxx/include/__memory/shared_ptr.h43
-rw-r--r--libcxx/include/__memory/swap_allocator.h4
-rw-r--r--libcxx/include/__memory/unique_ptr.h14
-rw-r--r--libcxx/include/__mutex/lock_guard.h1
-rw-r--r--libcxx/include/__numeric/gcd_lcm.h32
-rw-r--r--libcxx/include/__numeric/pstl.h211
-rw-r--r--libcxx/include/__ostream/basic_ostream.h6
-rw-r--r--libcxx/include/__pstl/backend.h (renamed from libcxx/include/__pstl/configuration.h)16
-rw-r--r--libcxx/include/__pstl/backend_fwd.h301
-rw-r--r--libcxx/include/__pstl/backends/default.h503
-rw-r--r--libcxx/include/__pstl/backends/libdispatch.h74
-rw-r--r--libcxx/include/__pstl/backends/serial.h187
-rw-r--r--libcxx/include/__pstl/backends/std_thread.h77
-rw-r--r--libcxx/include/__pstl/configuration_fwd.h245
-rw-r--r--libcxx/include/__pstl/cpu_algos/any_of.h56
-rw-r--r--libcxx/include/__pstl/cpu_algos/fill.h51
-rw-r--r--libcxx/include/__pstl/cpu_algos/find_if.h74
-rw-r--r--libcxx/include/__pstl/cpu_algos/for_each.h53
-rw-r--r--libcxx/include/__pstl/cpu_algos/merge.h103
-rw-r--r--libcxx/include/__pstl/cpu_algos/stable_sort.h37
-rw-r--r--libcxx/include/__pstl/cpu_algos/transform.h194
-rw-r--r--libcxx/include/__pstl/cpu_algos/transform_reduce.h202
-rw-r--r--libcxx/include/__pstl/dispatch.h66
-rw-r--r--libcxx/include/__pstl/handle_exception.h57
-rw-r--r--libcxx/include/__random/discard_block_engine.h4
-rw-r--r--libcxx/include/__ranges/access.h5
-rw-r--r--libcxx/include/__ranges/all.h5
-rw-r--r--libcxx/include/__ranges/common_view.h10
-rw-r--r--libcxx/include/__ranges/counted.h5
-rw-r--r--libcxx/include/__ranges/data.h5
-rw-r--r--libcxx/include/__ranges/drop_view.h12
-rw-r--r--libcxx/include/__ranges/iota_view.h5
-rw-r--r--libcxx/include/__ranges/lazy_split_view.h4
-rw-r--r--libcxx/include/__ranges/ref_view.h2
-rw-r--r--libcxx/include/__ranges/rend.h5
-rw-r--r--libcxx/include/__ranges/reverse_view.h5
-rw-r--r--libcxx/include/__ranges/subrange.h11
-rw-r--r--libcxx/include/__split_buffer19
-rw-r--r--libcxx/include/__string/char_traits.h12
-rw-r--r--libcxx/include/__thread/thread.h7
-rw-r--r--libcxx/include/__tree27
-rw-r--r--libcxx/include/__tuple/sfinae_helpers.h4
-rw-r--r--libcxx/include/__tuple/tuple_size.h2
-rw-r--r--libcxx/include/__type_traits/has_unique_object_representation.h8
-rw-r--r--libcxx/include/__type_traits/invoke.h4
-rw-r--r--libcxx/include/__type_traits/is_literal_type.h4
-rw-r--r--libcxx/include/__type_traits/is_nothrow_destructible.h25
-rw-r--r--libcxx/include/__type_traits/is_swappable.h100
-rw-r--r--libcxx/include/__utility/exception_guard.h4
-rw-r--r--libcxx/include/__utility/forward_like.h4
-rw-r--r--libcxx/include/__utility/is_pointer_in_range.h8
-rw-r--r--libcxx/include/__utility/pair.h79
-rw-r--r--libcxx/include/__utility/swap.h4
-rw-r--r--libcxx/include/__verbose_abort2
-rw-r--r--libcxx/include/any6
-rw-r--r--libcxx/include/array12
-rw-r--r--libcxx/include/barrier8
-rw-r--r--libcxx/include/chrono22
-rw-r--r--libcxx/include/cmath14
-rw-r--r--libcxx/include/codecvt4
-rw-r--r--libcxx/include/coroutine8
-rw-r--r--libcxx/include/deque43
-rw-r--r--libcxx/include/experimental/__simd/reference.h41
-rw-r--r--libcxx/include/experimental/propagate_const114
-rw-r--r--libcxx/include/experimental/simd1
-rw-r--r--libcxx/include/experimental/type_traits6
-rw-r--r--libcxx/include/forward_list42
-rw-r--r--libcxx/include/fstream8
-rw-r--r--libcxx/include/future13
-rw-r--r--libcxx/include/ios2
-rw-r--r--libcxx/include/iosfwd6
-rw-r--r--libcxx/include/istream2
-rw-r--r--libcxx/include/limits72
-rw-r--r--libcxx/include/list37
-rw-r--r--libcxx/include/locale32
-rw-r--r--libcxx/include/map63
-rw-r--r--libcxx/include/module.modulemap63
-rw-r--r--libcxx/include/mutex4
-rw-r--r--libcxx/include/new19
-rw-r--r--libcxx/include/optional15
-rw-r--r--libcxx/include/print8
-rw-r--r--libcxx/include/queue34
-rw-r--r--libcxx/include/regex45
-rw-r--r--libcxx/include/scoped_allocator2
-rw-r--r--libcxx/include/set44
-rw-r--r--libcxx/include/shared_mutex4
-rw-r--r--libcxx/include/span16
-rw-r--r--libcxx/include/stack32
-rw-r--r--libcxx/include/streambuf2
-rw-r--r--libcxx/include/string142
-rw-r--r--libcxx/include/string_view31
-rw-r--r--libcxx/include/strstream28
-rw-r--r--libcxx/include/tuple151
-rw-r--r--libcxx/include/unordered_map63
-rw-r--r--libcxx/include/unordered_set27
-rw-r--r--libcxx/include/valarray156
-rw-r--r--libcxx/include/variant24
-rw-r--r--libcxx/include/vector38
-rw-r--r--libcxx/include/version5
-rw-r--r--libcxx/lib/abi/CHANGELOG.TXT2
-rw-r--r--libcxx/lib/abi/powerpc-ibm-aix.libcxxabi.v1.stable.exceptions.nonew.abilist3
-rw-r--r--libcxx/lib/abi/powerpc64-ibm-aix.libcxxabi.v1.stable.exceptions.nonew.abilist3
-rw-r--r--libcxx/lib/abi/x86_64-unknown-freebsd.libcxxabi.v1.stable.exceptions.nonew.abilist3
-rw-r--r--libcxx/lib/abi/x86_64-unknown-linux-gnu.libcxxabi.v1.stable.exceptions.nonew.abilist3
-rw-r--r--libcxx/lib/abi/x86_64-unknown-linux-gnu.libcxxabi.v1.stable.noexceptions.nonew.abilist3
-rw-r--r--libcxx/modules/CMakeLists.txt.in2
-rw-r--r--libcxx/modules/std/chrono.inc13
-rw-r--r--libcxx/src/CMakeLists.txt3
-rw-r--r--libcxx/src/atomic.cpp17
-rw-r--r--libcxx/src/barrier.cpp22
-rw-r--r--libcxx/src/chrono_exception.cpp (renamed from libcxx/test/libcxx/containers/sequences/vector/const_value_type.pass.cpp)21
-rw-r--r--libcxx/src/filesystem/operations.cpp36
-rw-r--r--libcxx/src/filesystem/path.cpp28
-rw-r--r--libcxx/src/filesystem/path_parser.h28
-rw-r--r--libcxx/src/locale.cpp4
-rw-r--r--libcxx/test/CMakeLists.txt25
-rw-r--r--libcxx/test/configs/apple-libc++-backdeployment.cfg.in1
-rw-r--r--libcxx/test/configs/apple-libc++-shared.cfg.in35
-rw-r--r--libcxx/test/configs/llvm-libc++-shared-clangcl.cfg.in18
-rw-r--r--libcxx/test/configs/llvm-libc++-shared-no-vcruntime-clangcl.cfg.in18
-rw-r--r--libcxx/test/configs/llvm-libc++-static-clangcl.cfg.in18
-rw-r--r--libcxx/test/libcxx/algorithms/pstl.iterator-requirements.verify.cpp1
-rw-r--r--libcxx/test/libcxx/algorithms/pstl.robust_against_customization_points_not_working.pass.cpp405
-rw-r--r--libcxx/test/libcxx/atomics/atomics.syn/wait.pass.cpp6
-rw-r--r--libcxx/test/libcxx/containers/sequences/vector/const_T.compile.pass.cpp18
-rw-r--r--libcxx/test/libcxx/diagnostics/chrono.nodiscard.verify.cpp9
-rw-r--r--libcxx/test/libcxx/diagnostics/memory.nodiscard.verify.cpp12
-rw-r--r--libcxx/test/libcxx/input.output/iostream.format/output.streams/ostream.formatted/ostream.formatted.print/vprint_unicode.pass.cpp6
-rw-r--r--libcxx/test/libcxx/input.output/iostream.format/print.fun/transcoding.pass.cpp1
-rw-r--r--libcxx/test/libcxx/input.output/iostream.format/print.fun/vprint_unicode_posix.pass.cpp1
-rw-r--r--libcxx/test/libcxx/input.output/iostream.format/print.fun/vprint_unicode_windows.pass.cpp1
-rw-r--r--libcxx/test/libcxx/input.output/iostreams.base/ios.base/ios.base.cons/dtor.uninitialized.pass.cpp2
-rw-r--r--libcxx/test/libcxx/language.support/cxa_deleted_virtual.pass.cpp2
-rw-r--r--libcxx/test/libcxx/memory/allocator_void.trivial.compile.pass.cpp10
-rw-r--r--libcxx/test/libcxx/memory/allocator_volatile.verify.cpp6
-rw-r--r--libcxx/test/libcxx/strings/basic.string/string.capacity/PR53170.pass.cpp2
-rw-r--r--libcxx/test/libcxx/strings/basic.string/string.capacity/allocation_size.pass.cpp2
-rw-r--r--libcxx/test/libcxx/thread/thread.condition/PR30202_notify_from_pthread_created_thread.pass.cpp2
-rw-r--r--libcxx/test/libcxx/thread/thread.threads/thread.thread.this/sleep_for.pass.cpp2
-rw-r--r--libcxx/test/libcxx/thread/thread.threads/thread.thread.this/sleep_for.signals.pass.cpp2
-rw-r--r--libcxx/test/libcxx/time/time.zone/time.zone.exception/time.zone.exception.ambig/assert.ctor.pass.cpp53
-rw-r--r--libcxx/test/libcxx/time/time.zone/time.zone.exception/time.zone.exception.nonexist/assert.ctor.pass.cpp53
-rw-r--r--libcxx/test/libcxx/time/time.zone/time.zone.timezone/choose.pass.cpp37
-rw-r--r--libcxx/test/libcxx/time/time.zone/time.zone.timezone/time.zone.members/assert.to_local.pass.cpp40
-rw-r--r--libcxx/test/libcxx/time/time.zone/time.zone.timezone/time.zone.members/assert.to_sys.pass.cpp39
-rw-r--r--libcxx/test/libcxx/time/time.zone/time.zone.timezone/time.zone.members/assert.to_sys_choose.pass.cpp41
-rw-r--r--libcxx/test/libcxx/transitive_includes/cxx03.csv4
-rw-r--r--libcxx/test/libcxx/transitive_includes/cxx11.csv4
-rw-r--r--libcxx/test/libcxx/transitive_includes/cxx14.csv4
-rw-r--r--libcxx/test/libcxx/transitive_includes/cxx17.csv7
-rw-r--r--libcxx/test/libcxx/transitive_includes/cxx20.csv13
-rw-r--r--libcxx/test/libcxx/transitive_includes/cxx23.csv21
-rw-r--r--libcxx/test/libcxx/transitive_includes/cxx26.csv44
-rw-r--r--libcxx/test/libcxx/type_traits/is_trivially_relocatable.compile.pass.cpp119
-rw-r--r--libcxx/test/libcxx/utilities/format/format.functions/ascii.pass.cpp3
-rw-r--r--libcxx/test/libcxx/utilities/format/format.functions/escaped_output.ascii.pass.cpp3
-rw-r--r--libcxx/test/libcxx/utilities/format/format.string/format.string.std/extended_grapheme_cluster.pass.cpp1
-rw-r--r--libcxx/test/libcxx/utilities/utility/pairs/pairs.pair/abi.non_trivial_copy_move.pass.cpp (renamed from libcxx/test/libcxx/utilities/utility/pairs/pairs.pair/non_trivial_copy_move_ABI.pass.cpp)0
-rw-r--r--libcxx/test/libcxx/utilities/utility/pairs/pairs.pair/abi.trivial_copy_move.pass.cpp (renamed from libcxx/test/libcxx/utilities/utility/pairs/pairs.pair/trivial_copy_move_ABI.pass.cpp)31
-rw-r--r--libcxx/test/libcxx/utilities/utility/pairs/pairs.pair/abi.trivially_copyable.compile.pass.cpp68
-rw-r--r--libcxx/test/lit.cfg.py3
-rw-r--r--libcxx/test/std/concepts/concepts.lang/concept.default.init/default_initializable.compile.pass.cpp6
-rw-r--r--libcxx/test/std/containers/sequences/array/array.overview/nttp.equivalence.compile.pass.cpp70
-rw-r--r--libcxx/test/std/containers/sequences/array/array.overview/nttp.verify.cpp81
-rw-r--r--libcxx/test/std/containers/views/mdspan/extents/ctad.pass.cpp13
-rw-r--r--libcxx/test/std/depr/depr.c.headers/stdlib_h.aligned_alloc.compile.pass.cpp2
-rw-r--r--libcxx/test/std/diagnostics/syserr/syserr.errcat/syserr.errcat.objects/generic_category.pass.cpp2
-rw-r--r--libcxx/test/std/diagnostics/syserr/syserr.errcat/syserr.errcat.objects/system_category.pass.cpp2
-rw-r--r--libcxx/test/std/experimental/simd/simd.reference/reference_swap.pass.cpp74
-rw-r--r--libcxx/test/std/input.output/filesystems/class.directory_entry/directory_entry.mods/refresh.pass.cpp2
-rw-r--r--libcxx/test/std/input.output/filesystems/class.directory_entry/directory_entry.obs/file_size.pass.cpp2
-rw-r--r--libcxx/test/std/input.output/filesystems/class.directory_entry/directory_entry.obs/hard_link_count.pass.cpp2
-rw-r--r--libcxx/test/std/input.output/filesystems/class.directory_entry/directory_entry.obs/last_write_time.pass.cpp2
-rw-r--r--libcxx/test/std/input.output/filesystems/fs.op.funcs/fs.op.copy_file/copy_file.pass.cpp2
-rw-r--r--libcxx/test/std/input.output/filesystems/fs.op.funcs/fs.op.create_directories/create_directories.pass.cpp2
-rw-r--r--libcxx/test/std/input.output/filesystems/fs.op.funcs/fs.op.create_directory/create_directory.pass.cpp2
-rw-r--r--libcxx/test/std/input.output/filesystems/fs.op.funcs/fs.op.create_directory/create_directory_with_attributes.pass.cpp2
-rw-r--r--libcxx/test/std/input.output/filesystems/fs.op.funcs/fs.op.file_size/file_size.pass.cpp2
-rw-r--r--libcxx/test/std/input.output/filesystems/fs.op.funcs/fs.op.last_write_time/last_write_time.pass.cpp2
-rw-r--r--libcxx/test/std/input.output/filesystems/fs.op.funcs/fs.op.remove_all/toctou.pass.cpp6
-rw-r--r--libcxx/test/std/input.output/filesystems/fs.op.funcs/fs.op.weakly_canonical/weakly_canonical.pass.cpp20
-rw-r--r--libcxx/test/std/input.output/iostream.format/input.streams/istream.formatted/istream.formatted.arithmetic/bool.pass.cpp2
-rw-r--r--libcxx/test/std/input.output/iostream.format/input.streams/istream.formatted/istream.formatted.arithmetic/double.pass.cpp2
-rw-r--r--libcxx/test/std/input.output/iostream.format/input.streams/istream.formatted/istream.formatted.arithmetic/float.pass.cpp2
-rw-r--r--libcxx/test/std/input.output/iostream.format/input.streams/istream.formatted/istream.formatted.arithmetic/int.pass.cpp2
-rw-r--r--libcxx/test/std/input.output/iostream.format/input.streams/istream.formatted/istream.formatted.arithmetic/long.pass.cpp2
-rw-r--r--libcxx/test/std/input.output/iostream.format/input.streams/istream.formatted/istream.formatted.arithmetic/long_double.pass.cpp2
-rw-r--r--libcxx/test/std/input.output/iostream.format/input.streams/istream.formatted/istream.formatted.arithmetic/long_long.pass.cpp2
-rw-r--r--libcxx/test/std/input.output/iostream.format/input.streams/istream.formatted/istream.formatted.arithmetic/pointer.pass.cpp2
-rw-r--r--libcxx/test/std/input.output/iostream.format/input.streams/istream.formatted/istream.formatted.arithmetic/short.pass.cpp2
-rw-r--r--libcxx/test/std/input.output/iostream.format/input.streams/istream.formatted/istream.formatted.arithmetic/unsigned_int.pass.cpp2
-rw-r--r--libcxx/test/std/input.output/iostream.format/input.streams/istream.formatted/istream.formatted.arithmetic/unsigned_long.pass.cpp2
-rw-r--r--libcxx/test/std/input.output/iostream.format/input.streams/istream.formatted/istream.formatted.arithmetic/unsigned_long_long.pass.cpp2
-rw-r--r--libcxx/test/std/input.output/iostream.format/input.streams/istream.formatted/istream.formatted.arithmetic/unsigned_short.pass.cpp2
-rw-r--r--libcxx/test/std/input.output/iostream.format/input.streams/istream.formatted/istream_extractors/streambuf.pass.cpp2
-rw-r--r--libcxx/test/std/input.output/iostream.format/input.streams/istream.unformatted/get.pass.cpp2
-rw-r--r--libcxx/test/std/input.output/iostream.format/input.streams/istream.unformatted/get_chart.pass.cpp2
-rw-r--r--libcxx/test/std/input.output/iostream.format/input.streams/istream.unformatted/get_pointer_size.pass.cpp2
-rw-r--r--libcxx/test/std/input.output/iostream.format/input.streams/istream.unformatted/get_pointer_size_chart.pass.cpp2
-rw-r--r--libcxx/test/std/input.output/iostream.format/input.streams/istream.unformatted/get_streambuf.pass.cpp2
-rw-r--r--libcxx/test/std/input.output/iostream.format/input.streams/istream.unformatted/get_streambuf_chart.pass.cpp2
-rw-r--r--libcxx/test/std/input.output/iostream.format/input.streams/istream.unformatted/getline_pointer_size.pass.cpp2
-rw-r--r--libcxx/test/std/input.output/iostream.format/input.streams/istream.unformatted/getline_pointer_size_chart.pass.cpp2
-rw-r--r--libcxx/test/std/input.output/iostream.format/input.streams/istream.unformatted/ignore.pass.cpp2
-rw-r--r--libcxx/test/std/input.output/iostream.format/input.streams/istream.unformatted/peek.pass.cpp2
-rw-r--r--libcxx/test/std/input.output/iostream.format/input.streams/istream.unformatted/read.pass.cpp2
-rw-r--r--libcxx/test/std/input.output/iostream.format/input.streams/istream.unformatted/seekg_off.pass.cpp2
-rw-r--r--libcxx/test/std/input.output/iostream.format/input.streams/istream.unformatted/sync.pass.cpp3
-rw-r--r--libcxx/test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.formatted.print/locale-specific_form.pass.cpp2
-rw-r--r--libcxx/test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.formatted.print/vprint_unicode.pass.cpp1
-rw-r--r--libcxx/test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.arithmetic/minmax_showbase.pass.cpp2
-rw-r--r--libcxx/test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.arithmetic/minus1.pass.cpp2
-rw-r--r--libcxx/test/std/input.output/iostream.format/print.fun/no_file_description.pass.cpp2
-rw-r--r--libcxx/test/std/input.output/iostream.format/print.fun/vprint_unicode.sh.cpp1
-rw-r--r--libcxx/test/std/input.output/iostreams.base/ios.base/ios.types/ios_Init/ios_Init.multiple.pass.cpp2
-rw-r--r--libcxx/test/std/language.support/support.dynamic/new.delete/new.delete.array/sized_delete_array_fsizeddeallocation.pass.cpp2
-rw-r--r--libcxx/test/std/language.support/support.dynamic/new.delete/new.delete.single/sized_delete_fsizeddeallocation.pass.cpp2
-rw-r--r--libcxx/test/std/language.support/support.exception/uncaught/uncaught_exceptions.pass.cpp4
-rw-r--r--libcxx/test/std/language.support/support.limits/support.limits.general/compare.version.compile.pass.cpp50
-rw-r--r--libcxx/test/std/language.support/support.limits/support.limits.general/version.version.compile.pass.cpp81
-rw-r--r--libcxx/test/std/language.support/support.runtime/cstdlib.aligned_alloc.compile.pass.cpp2
-rw-r--r--libcxx/test/std/language.support/support.runtime/ctime.timespec.compile.pass.cpp2
-rw-r--r--libcxx/test/std/localization/codecvt_unicode.pass.cpp2
-rw-r--r--libcxx/test/std/localization/locale.categories/category.ctype/facet.ctype.special/facet.ctype.char.statics/table_size.pass.cpp4
-rw-r--r--libcxx/test/std/localization/locale.categories/category.monetary/locale.money.get/locale.money.get.members/get_long_double_fr_FR.pass.cpp267
-rw-r--r--libcxx/test/std/localization/locale.categories/category.monetary/locale.money.get/locale.money.get.members/get_long_double_zh_CN.pass.cpp238
-rw-r--r--libcxx/test/std/localization/locale.categories/category.monetary/locale.money.put/locale.money.put.members/put_long_double_fr_FR.pass.cpp37
-rw-r--r--libcxx/test/std/localization/locale.categories/category.monetary/locale.money.put/locale.money.put.members/put_long_double_zh_CN.pass.cpp61
-rw-r--r--libcxx/test/std/localization/locale.categories/category.numeric/locale.num.get/facet.num.get.members/get_double.pass.cpp5
-rw-r--r--libcxx/test/std/localization/locale.categories/category.numeric/locale.num.get/facet.num.get.members/get_float.pass.cpp5
-rw-r--r--libcxx/test/std/localization/locale.categories/category.numeric/locale.num.get/facet.num.get.members/get_long.pass.cpp2
-rw-r--r--libcxx/test/std/localization/locale.categories/category.numeric/locale.num.get/facet.num.get.members/get_long_double.pass.cpp5
-rw-r--r--libcxx/test/std/localization/locales/locale/locale.cons/name_construction.pass.cpp2
-rw-r--r--libcxx/test/std/numerics/numeric.ops/numeric.ops.lcm/lcm.pass.cpp27
-rw-r--r--libcxx/test/std/numerics/rand/rand.device/ctor.pass.cpp4
-rw-r--r--libcxx/test/std/ranges/range.factories/range.iota.view/assert.ctor.value.bound.pass.cpp26
-rw-r--r--libcxx/test/std/strings/basic.string/string.capacity/max_size.pass.cpp2
-rw-r--r--libcxx/test/std/strings/basic.string/string.capacity/over_max_size.pass.cpp4
-rw-r--r--libcxx/test/std/strings/basic.string/string.capacity/reserve_size.pass.cpp2
-rw-r--r--libcxx/test/std/thread/futures/futures.async/async_race.38682.pass.cpp2
-rw-r--r--libcxx/test/std/thread/futures/futures.future_error/what.pass.cpp2
-rw-r--r--libcxx/test/std/thread/thread.condition/notify_all_at_thread_exit_lwg3343.pass.cpp4
-rw-r--r--libcxx/test/std/thread/thread.mutex/thread.mutex.requirements/thread.sharedtimedmutex.requirements/thread.sharedtimedmutex.class/default.pass.cpp6
-rw-r--r--libcxx/test/std/thread/thread.mutex/thread.mutex.requirements/thread.timedmutex.requirements/thread.timedmutex.class/default.pass.cpp6
-rw-r--r--libcxx/test/std/thread/thread.mutex/thread.mutex.requirements/thread.timedmutex.requirements/thread.timedmutex.recursive/default.pass.cpp6
-rw-r--r--libcxx/test/std/time/time.zone/time.zone.exception/time.zone.exception.ambig/ctor.pass.cpp171
-rw-r--r--libcxx/test/std/time/time.zone/time.zone.exception/time.zone.exception.ambig/types.pass.cpp50
-rw-r--r--libcxx/test/std/time/time.zone/time.zone.exception/time.zone.exception.nonexist/ctor.pass.cpp172
-rw-r--r--libcxx/test/std/time/time.zone/time.zone.exception/time.zone.exception.nonexist/types.pass.cpp50
-rw-r--r--libcxx/test/std/time/time.zone/time.zone.timezone/time.zone.members/get_info.local_time.pass.cpp4
-rw-r--r--libcxx/test/std/time/time.zone/time.zone.timezone/time.zone.members/sys_info.zdump.pass.cpp1
-rw-r--r--libcxx/test/std/time/time.zone/time.zone.timezone/time.zone.members/to_local.pass.cpp68
-rw-r--r--libcxx/test/std/time/time.zone/time.zone.timezone/time.zone.members/to_sys.pass.cpp237
-rw-r--r--libcxx/test/std/time/time.zone/time.zone.timezone/time.zone.members/to_sys_choose.pass.cpp147
-rw-r--r--libcxx/test/std/time/time.zone/time.zone.zonedtraits/const_time_zone_default_zone.pass.cpp36
-rw-r--r--libcxx/test/std/time/time.zone/time.zone.zonedtraits/const_time_zone_locate_zone.pass.cpp45
-rw-r--r--libcxx/test/std/time/time.zone/time.zone.zonedtraits/types.compile.pass.cpp33
-rw-r--r--libcxx/test/std/utilities/expected/expected.expected/ctor/ctor.copy.pass.cpp20
-rw-r--r--libcxx/test/std/utilities/format/format.formatter/format.formatter.spec/formatter.char.fsigned-char.pass.cpp8
-rw-r--r--libcxx/test/std/utilities/format/format.formatter/format.formatter.spec/formatter.char.funsigned-char.pass.cpp6
-rw-r--r--libcxx/test/std/utilities/memory/default.allocator/allocator.ctor.pass.cpp4
-rw-r--r--libcxx/test/std/utilities/memory/default.allocator/allocator.dtor.pass.cpp6
-rw-r--r--libcxx/test/std/utilities/memory/default.allocator/allocator.members/allocate.constexpr.size.verify.cpp1
-rw-r--r--libcxx/test/std/utilities/memory/default.allocator/allocator.members/allocate.size.pass.cpp1
-rw-r--r--libcxx/test/std/utilities/memory/default.allocator/allocator_types.deprecated_in_cxx17.verify.cpp7
-rw-r--r--libcxx/test/std/utilities/memory/default.allocator/allocator_types.deprecated_in_cxx23.verify.cpp2
-rw-r--r--libcxx/test/std/utilities/memory/default.allocator/allocator_types.pass.cpp3
-rw-r--r--libcxx/test/std/utilities/memory/default.allocator/allocator_types.removed_in_cxx20.verify.cpp2
-rw-r--r--libcxx/test/std/utilities/memory/default.allocator/allocator_types.removed_in_cxx26.verify.cpp2
-rw-r--r--libcxx/test/std/utilities/memory/specialized.algorithms/specialized.construct/construct_at.pass.cpp4
-rw-r--r--libcxx/test/std/utilities/memory/temporary.buffer/overaligned.pass.cpp2
-rw-r--r--libcxx/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/pointer.pass.cpp6
-rw-r--r--libcxx/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/pointer_deleter.pass.cpp25
-rw-r--r--libcxx/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/pointer_deleter_allocator.pass.cpp10
-rw-r--r--libcxx/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/types.h18
-rw-r--r--libcxx/test/std/utilities/meta/meta.unary/meta.unary.prop/has_unique_object_representations.compile.pass.cpp106
-rw-r--r--libcxx/test/std/utilities/meta/meta.unary/meta.unary.prop/has_unique_object_representations.pass.cpp108
-rw-r--r--libcxx/test/std/utilities/meta/meta.unary/meta.unary.prop/is_nothrow_destructible.pass.cpp7
-rw-r--r--libcxx/test/std/utilities/meta/meta.unary/meta.unary.prop/is_swappable_include_order.pass.cpp27
-rw-r--r--libcxx/test/std/utilities/utility/pairs/pairs.pair/nttp.equivalence.compile.pass.cpp74
-rw-r--r--libcxx/test/std/utilities/utility/pairs/pairs.pair/nttp.verify.cpp97
-rw-r--r--libcxx/test/support/nasty_containers.h20
-rw-r--r--libcxx/test/support/poisoned_hash_helper.h2
-rw-r--r--libcxx/utils/ci/Dockerfile1
-rwxr-xr-xlibcxx/utils/ci/apple-install-libcxx.sh6
-rw-r--r--libcxx/utils/ci/buildkite-pipeline.yml4
-rw-r--r--libcxx/utils/ci/docker-compose.yml2
-rwxr-xr-xlibcxx/utils/ci/run-buildbot11
-rwxr-xr-xlibcxx/utils/generate_escaped_output_table.py2
-rwxr-xr-xlibcxx/utils/generate_feature_test_macro_components.py9
-rw-r--r--libcxx/utils/generate_width_estimation_table.py2
-rw-r--r--libcxx/utils/libcxx/test/dsl.py4
-rw-r--r--libcxx/utils/libcxx/test/features.py171
-rw-r--r--libcxx/utils/libcxx/test/params.py13
374 files changed, 6494 insertions, 4469 deletions
diff --git a/libcxx/.clang-tidy b/libcxx/.clang-tidy
index d0b4cced9ffc..f986e2100ca6 100644
--- a/libcxx/.clang-tidy
+++ b/libcxx/.clang-tidy
@@ -17,6 +17,7 @@ Checks: >
modernize-redundant-void-arg,
modernize-use-nullptr,
modernize-use-override,
+ modernize-use-equals-delete,
readability-duplicate-include,
readability-identifier-naming,
@@ -72,7 +73,6 @@ CheckOptions:
# modernize-use-bool-literals,
# modernize-use-default-member-init,
# modernize-use-equals-default,
-# modernize-use-equals-delete,
# portability-restrict-system-includes,
# readability-function-cognitive-complexity,
# readability-implicit-bool-conversion,
diff --git a/libcxx/CMakeLists.txt b/libcxx/CMakeLists.txt
index 4b927017f8c2..e098bd574eec 100644
--- a/libcxx/CMakeLists.txt
+++ b/libcxx/CMakeLists.txt
@@ -553,6 +553,10 @@ function(cxx_add_basic_build_flags target)
target_add_compile_flags_if_supported(${target} PRIVATE -fvisibility=hidden)
endif()
+ # Build with -fsized-deallocation, which is default in recent versions of Clang.
+ # TODO(LLVM 21): This can be dropped once we only support Clang >= 19.
+ target_add_compile_flags_if_supported(${target} PRIVATE -fsized-deallocation)
+
# Let the library headers know they are currently being used to build the
# library.
target_compile_definitions(${target} PRIVATE -D_LIBCPP_BUILDING_LIBRARY)
diff --git a/libcxx/benchmarks/algorithms/pstl.stable_sort.bench.cpp b/libcxx/benchmarks/algorithms/pstl.stable_sort.bench.cpp
index 9357b870bece..72541f70640f 100644
--- a/libcxx/benchmarks/algorithms/pstl.stable_sort.bench.cpp
+++ b/libcxx/benchmarks/algorithms/pstl.stable_sort.bench.cpp
@@ -7,6 +7,7 @@
//===----------------------------------------------------------------------===//
#include <algorithm>
+#include <execution>
#include "common.h"
diff --git a/libcxx/cmake/caches/Apple.cmake b/libcxx/cmake/caches/Apple.cmake
index 8768653e620a..1038f1aed54e 100644
--- a/libcxx/cmake/caches/Apple.cmake
+++ b/libcxx/cmake/caches/Apple.cmake
@@ -15,6 +15,3 @@ set(LIBCXXABI_HERMETIC_STATIC_LIBRARY ON CACHE BOOL "")
set(LIBCXXABI_ENABLE_ASSERTIONS OFF CACHE BOOL "")
set(LIBCXXABI_ENABLE_FORGIVING_DYNAMIC_CAST ON CACHE BOOL "")
set(LIBCXXABI_USE_LLVM_UNWINDER OFF CACHE BOOL "") # libunwind is built separately
-
-set(LIBCXX_TEST_CONFIG "apple-libc++-shared.cfg.in" CACHE STRING "")
-set(LIBCXXABI_TEST_CONFIG "apple-libc++abi-shared.cfg.in" CACHE STRING "")
diff --git a/libcxx/cmake/caches/Generic-msan.cmake b/libcxx/cmake/caches/Generic-msan.cmake
index 9e50255fe4ff..a8fbd285a9ad 100644
--- a/libcxx/cmake/caches/Generic-msan.cmake
+++ b/libcxx/cmake/caches/Generic-msan.cmake
@@ -1,2 +1,4 @@
set(LLVM_USE_SANITIZER "MemoryWithOrigins" CACHE STRING "")
+set(LIBCXX_TEST_PARAMS "long_tests=False" CACHE STRING "") # MSAN is really slow and tests can sometimes timeout otherwise
+set(LIBCXXABI_TEST_PARAMS "${LIBCXX_TEST_PARAMS}" CACHE STRING "")
set(LIBCXXABI_USE_LLVM_UNWINDER OFF CACHE BOOL "") # MSAN is compiled against the system unwinder, which leads to false positives
diff --git a/libcxx/docs/FeatureTestMacroTable.rst b/libcxx/docs/FeatureTestMacroTable.rst
index 0297068785e8..72f624fa746b 100644
--- a/libcxx/docs/FeatureTestMacroTable.rst
+++ b/libcxx/docs/FeatureTestMacroTable.rst
@@ -290,7 +290,7 @@ Status
---------------------------------------------------------- -----------------
``__cpp_lib_syncbuf`` ``201803L``
---------------------------------------------------------- -----------------
- ``__cpp_lib_three_way_comparison`` *unimplemented*
+ ``__cpp_lib_three_way_comparison`` ``201711L``
---------------------------------------------------------- -----------------
``__cpp_lib_to_address`` ``201711L``
---------------------------------------------------------- -----------------
@@ -340,6 +340,8 @@ Status
---------------------------------------------------------- -----------------
``__cpp_lib_mdspan`` ``202207L``
---------------------------------------------------------- -----------------
+ ``__cpp_lib_modules`` ``202207L``
+ ---------------------------------------------------------- -----------------
``__cpp_lib_move_only_function`` *unimplemented*
---------------------------------------------------------- -----------------
``__cpp_lib_optional`` ``202110L``
diff --git a/libcxx/docs/ReleaseNotes/19.rst b/libcxx/docs/ReleaseNotes/19.rst
index 6ab4cafd2bb7..d30021b7eb23 100644
--- a/libcxx/docs/ReleaseNotes/19.rst
+++ b/libcxx/docs/ReleaseNotes/19.rst
@@ -58,6 +58,7 @@ Improvements and New Features
-----------------------------
- The performance of growing ``std::vector`` has been improved for trivially relocatable types.
+- A lot of types are considered trivially relocatable now, including ``vector`` and ``string``.
- The performance of ``ranges::fill`` and ``ranges::fill_n`` has been improved for ``vector<bool>::iterator``\s,
resulting in a performance increase of up to 1400x.
- The ``std::mismatch`` algorithm has been optimized for integral types, which can lead up to 40x performance
@@ -120,6 +121,15 @@ Deprecations and Removals
- The ``_LIBCPP_DISABLE_ADDITIONAL_DIAGNOSTICS`` macro has been removed and is not honored anymore. Additional
warnings provided by libc++ as a matter of QoI will now be provided unconditionally.
+- libc++ no longer supports ``std::allocator<const T>`` and containers of ``const``-qualified element type, such
+ as ``std::vector<const T>`` and ``std::list<const T>``. This used to be supported as an undocumented extension.
+ If you were using ``std::vector<const T>``, replace it with ``std::vector<T>`` instead. The
+ ``_LIBCPP_ENABLE_REMOVED_ALLOCATOR_CONST`` macro can be defined to temporarily re-enable this extension as
+ folks transition their code. This macro will be honored for one released and ignored starting in LLVM 20.
+ To assist with the clean-up process, consider running your code through Clang Tidy, with
+ `std-allocator-const <https://clang.llvm.org/extra/clang-tidy/checks/portability/std-allocator-const.html>`
+ enabled.
+
Upcoming Deprecations and Removals
----------------------------------
diff --git a/libcxx/docs/Status/Cxx20Papers.csv b/libcxx/docs/Status/Cxx20Papers.csv
index 462c7eff55d5..34fc5586f74d 100644
--- a/libcxx/docs/Status/Cxx20Papers.csv
+++ b/libcxx/docs/Status/Cxx20Papers.csv
@@ -78,7 +78,7 @@
"`P1236R1 <https://wg21.link/P1236R1>`__","CWG","Alternative Wording for P0907R4 Signed Integers are Two's Complement","San Diego","* *",""
"`P1248R1 <https://wg21.link/P1248R1>`__","LWG","Remove CommonReference requirement from StrictWeakOrdering (a.k.a Fixing Relations)","San Diego","|Complete|","13.0"
"`P1285R0 <https://wg21.link/P1285R0>`__","LWG","Improving Completeness Requirements for Type Traits","San Diego","* *",""
-"`P1353R0 <https://wg21.link/P1353R0>`__","CWG","Missing feature test macros","San Diego","* *",""
+"`P1353R0 <https://wg21.link/P1353R0>`__","CWG","Missing feature test macros","San Diego","|In Progress|",""
"","","","","","",""
"`P0339R6 <https://wg21.link/P0339R6>`__","LWG","polymorphic_allocator<> as a vocabulary type","Kona","|Complete|","16.0"
"`P0340R3 <https://wg21.link/P0340R3>`__","LWG","Making std::underlying_type SFINAE-friendly","Kona","|Complete|","9.0"
diff --git a/libcxx/docs/Status/Cxx23Papers.csv b/libcxx/docs/Status/Cxx23Papers.csv
index 01387a404f5d..36d7f78285aa 100644
--- a/libcxx/docs/Status/Cxx23Papers.csv
+++ b/libcxx/docs/Status/Cxx23Papers.csv
@@ -75,7 +75,7 @@
"`P2445R1 <https://wg21.link/P2445R1>`__","LWG","``forward_like``","July 2022","|Complete|","16.0"
"`P2446R2 <https://wg21.link/P2446R2>`__","LWG","``views::as_rvalue``","July 2022","|Complete|","16.0","|ranges|"
"`P2460R2 <https://wg21.link/P2460R2>`__","LWG","Relax requirements on ``wchar_t`` to match existing practices","July 2022","",""
-"`P2465R3 <https://wg21.link/P2465R3>`__","LWG","Standard Library Modules ``std`` and ``std.compat``","July 2022","",""
+"`P2465R3 <https://wg21.link/P2465R3>`__","LWG","Standard Library Modules ``std`` and ``std.compat``","July 2022","|Complete|","19.0",""
"`P2467R1 <https://wg21.link/P2467R1>`__","LWG","Support exclusive mode for ``fstreams``","July 2022","|Complete|","18.0",""
"`P2474R2 <https://wg21.link/P2474R2>`__","LWG","``views::repeat``","July 2022","|Complete|","17.0","|ranges|"
"`P2494R2 <https://wg21.link/P2494R2>`__","LWG","Relaxing range adaptors to allow for move only types","July 2022","|Complete|","17.0","|ranges|"
diff --git a/libcxx/docs/Status/ParallelismProjects.csv b/libcxx/docs/Status/ParallelismProjects.csv
index 2ddac1e52f02..06087e3d870f 100644
--- a/libcxx/docs/Status/ParallelismProjects.csv
+++ b/libcxx/docs/Status/ParallelismProjects.csv
@@ -16,6 +16,7 @@ Section,Description,Dependencies,Assignee,Complete
| `[parallel.simd.whereexpr] <https://wg21.link/N4808>`_, "Where expression class templates", None, Yin Zhang, |In Progress|
| `[parallel.simd.reference] <https://wg21.link/N4808>`_, "`Element references operator value_type() <https://github.com/llvm/llvm-project/pull/68960>`_", None, Yin Zhang, |Complete|
| `[parallel.simd.reference] <https://wg21.link/N4808>`_, "`Element references operator= <https://github.com/llvm/llvm-project/pull/70020>`_", None, Yin Zhang, |Complete|
+| `[parallel.simd.reference] <https://wg21.link/N4808>`_, "`Element references swap functions <https://github.com/llvm/llvm-project/pull/86478>`_", None, Yin Zhang, |Complete|
| `[parallel.simd.class] <https://wg21.link/N4808>`_, "`Class template simd declaration and alias <https://reviews.llvm.org/D144362>`_", [parallel.simd.abi], Yin Zhang, |Complete|
| `[parallel.simd.class] <https://wg21.link/N4808>`_, "`simd<>::size() <https://reviews.llvm.org/D144363>`_", [parallel.simd.traits] simd_size[_v], Yin Zhang, |Complete|
| `[parallel.simd.class] <https://wg21.link/N4808>`_, "`simd default constructor <https://github.com/llvm/llvm-project/pull/70424>`_", None, Yin Zhang, |Complete|
diff --git a/libcxx/include/CMakeLists.txt b/libcxx/include/CMakeLists.txt
index cfe1f44777bc..8d0ffd6ed725 100644
--- a/libcxx/include/CMakeLists.txt
+++ b/libcxx/include/CMakeLists.txt
@@ -73,7 +73,6 @@ set(files
__algorithm/pop_heap.h
__algorithm/prev_permutation.h
__algorithm/pstl.h
- __algorithm/pstl_frontend_dispatch.h
__algorithm/push_heap.h
__algorithm/ranges_adjacent_find.h
__algorithm/ranges_all_of.h
@@ -250,6 +249,7 @@ set(files
__chrono/convert_to_tm.h
__chrono/day.h
__chrono/duration.h
+ __chrono/exception.h
__chrono/file_clock.h
__chrono/formatter.h
__chrono/hh_mm_ss.h
@@ -276,6 +276,7 @@ set(files
__chrono/year_month.h
__chrono/year_month_day.h
__chrono/year_month_weekday.h
+ __chrono/zoned_time.h
__compare/common_comparison_category.h
__compare/compare_partial_order_fallback.h
__compare/compare_strong_order_fallback.h
@@ -574,11 +575,12 @@ set(files
__numeric/transform_reduce.h
__ostream/basic_ostream.h
__ostream/print.h
+ __pstl/backend.h
+ __pstl/backend_fwd.h
+ __pstl/backends/default.h
__pstl/backends/libdispatch.h
__pstl/backends/serial.h
__pstl/backends/std_thread.h
- __pstl/configuration.h
- __pstl/configuration_fwd.h
__pstl/cpu_algos/any_of.h
__pstl/cpu_algos/cpu_traits.h
__pstl/cpu_algos/fill.h
@@ -588,6 +590,8 @@ set(files
__pstl/cpu_algos/stable_sort.h
__pstl/cpu_algos/transform.h
__pstl/cpu_algos/transform_reduce.h
+ __pstl/dispatch.h
+ __pstl/handle_exception.h
__random/bernoulli_distribution.h
__random/binomial_distribution.h
__random/cauchy_distribution.h
diff --git a/libcxx/include/__algorithm/comp_ref_type.h b/libcxx/include/__algorithm/comp_ref_type.h
index aa9350c38caa..c367fbb91ac2 100644
--- a/libcxx/include/__algorithm/comp_ref_type.h
+++ b/libcxx/include/__algorithm/comp_ref_type.h
@@ -41,9 +41,9 @@ struct __debug_less {
}
template <class _LHS, class _RHS>
- _LIBCPP_CONSTEXPR_SINCE_CXX14 inline _LIBCPP_HIDE_FROM_ABI decltype((void)std::declval<_Compare&>()(
- std::declval<_LHS&>(), std::declval<_RHS&>()))
- __do_compare_assert(int, _LHS& __l, _RHS& __r) {
+ _LIBCPP_CONSTEXPR_SINCE_CXX14 inline
+ _LIBCPP_HIDE_FROM_ABI decltype((void)std::declval<_Compare&>()(std::declval<_LHS&>(), std::declval<_RHS&>()))
+ __do_compare_assert(int, _LHS& __l, _RHS& __r) {
_LIBCPP_ASSERT_SEMANTIC_REQUIREMENT(!__comp_(__l, __r), "Comparator does not induce a strict weak ordering");
(void)__l;
(void)__r;
diff --git a/libcxx/include/__algorithm/make_projected.h b/libcxx/include/__algorithm/make_projected.h
index bb7bc7e8c0b5..5245e523f3df 100644
--- a/libcxx/include/__algorithm/make_projected.h
+++ b/libcxx/include/__algorithm/make_projected.h
@@ -36,8 +36,8 @@ struct _ProjectedPred {
: __pred(__pred_arg), __proj(__proj_arg) {}
template <class _Tp>
- typename __invoke_of<_Pred&, decltype(std::__invoke(std::declval<_Proj&>(), std::declval<_Tp>())) >::
- type _LIBCPP_CONSTEXPR _LIBCPP_HIDE_FROM_ABI
+ typename __invoke_of<_Pred&, decltype(std::__invoke(std::declval<_Proj&>(), std::declval<_Tp>()))>::type
+ _LIBCPP_CONSTEXPR _LIBCPP_HIDE_FROM_ABI
operator()(_Tp&& __v) const {
return std::__invoke(__pred, std::__invoke(__proj, std::forward<_Tp>(__v)));
}
@@ -45,8 +45,8 @@ struct _ProjectedPred {
template <class _T1, class _T2>
typename __invoke_of<_Pred&,
decltype(std::__invoke(std::declval<_Proj&>(), std::declval<_T1>())),
- decltype(std::__invoke(std::declval<_Proj&>(),
- std::declval<_T2>())) >::type _LIBCPP_CONSTEXPR _LIBCPP_HIDE_FROM_ABI
+ decltype(std::__invoke(std::declval<_Proj&>(), std::declval<_T2>()))>::type _LIBCPP_CONSTEXPR
+ _LIBCPP_HIDE_FROM_ABI
operator()(_T1&& __lhs, _T2&& __rhs) const {
return std::__invoke(
__pred, std::__invoke(__proj, std::forward<_T1>(__lhs)), std::__invoke(__proj, std::forward<_T2>(__rhs)));
diff --git a/libcxx/include/__algorithm/pstl.h b/libcxx/include/__algorithm/pstl.h
index 68b4e3e77ec6..0bb052b3f97c 100644
--- a/libcxx/include/__algorithm/pstl.h
+++ b/libcxx/include/__algorithm/pstl.h
@@ -9,30 +9,7 @@
#ifndef _LIBCPP___ALGORITHM_PSTL_H
#define _LIBCPP___ALGORITHM_PSTL_H
-#include <__algorithm/copy_n.h>
-#include <__algorithm/count.h>
-#include <__algorithm/equal.h>
-#include <__algorithm/fill_n.h>
-#include <__algorithm/for_each.h>
-#include <__algorithm/for_each_n.h>
-#include <__algorithm/pstl_frontend_dispatch.h>
-#include <__atomic/atomic.h>
#include <__config>
-#include <__functional/identity.h>
-#include <__functional/operations.h>
-#include <__iterator/concepts.h>
-#include <__iterator/cpp17_iterator_concepts.h>
-#include <__iterator/iterator_traits.h>
-#include <__numeric/pstl.h>
-#include <__pstl/configuration.h>
-#include <__type_traits/enable_if.h>
-#include <__type_traits/is_constant_evaluated.h>
-#include <__type_traits/is_execution_policy.h>
-#include <__type_traits/is_trivially_copyable.h>
-#include <__type_traits/remove_cvref.h>
-#include <__utility/empty.h>
-#include <__utility/move.h>
-#include <optional>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
# pragma GCC system_header
@@ -43,55 +20,19 @@ _LIBCPP_PUSH_MACROS
#if !defined(_LIBCPP_HAS_NO_INCOMPLETE_PSTL) && _LIBCPP_STD_VER >= 17
-_LIBCPP_BEGIN_NAMESPACE_STD
-
-template <class _ExecutionPolicy,
- class _ForwardIterator,
- class _Predicate,
- class _RawPolicy = __remove_cvref_t<_ExecutionPolicy>,
- enable_if_t<is_execution_policy_v<_RawPolicy>, int> = 0>
-[[nodiscard]] _LIBCPP_HIDE_FROM_ABI optional<__remove_cvref_t<_ForwardIterator>>
-__find_if(_ExecutionPolicy&&, _ForwardIterator&& __first, _ForwardIterator&& __last, _Predicate&& __pred) noexcept {
- using _Backend = typename __select_backend<_RawPolicy>::type;
- return std::__pstl_find_if<_RawPolicy>(_Backend{}, std::move(__first), std::move(__last), std::move(__pred));
-}
-
-template <class _ExecutionPolicy,
- class _ForwardIterator,
- class _Predicate,
- class _RawPolicy = __remove_cvref_t<_ExecutionPolicy>,
- enable_if_t<is_execution_policy_v<_RawPolicy>, int> = 0>
-_LIBCPP_HIDE_FROM_ABI _ForwardIterator
-find_if(_ExecutionPolicy&& __policy, _ForwardIterator __first, _ForwardIterator __last, _Predicate __pred) {
- _LIBCPP_REQUIRE_CPP17_FORWARD_ITERATOR(_ForwardIterator, "find_if requires ForwardIterators");
- auto __res = std::__find_if(__policy, std::move(__first), std::move(__last), std::move(__pred));
- if (!__res)
- std::__throw_bad_alloc();
- return *std::move(__res);
-}
+# include <__functional/operations.h>
+# include <__iterator/cpp17_iterator_concepts.h>
+# include <__iterator/iterator_traits.h>
+# include <__pstl/backend.h>
+# include <__pstl/dispatch.h>
+# include <__pstl/handle_exception.h>
+# include <__type_traits/enable_if.h>
+# include <__type_traits/is_execution_policy.h>
+# include <__type_traits/remove_cvref.h>
+# include <__utility/forward.h>
+# include <__utility/move.h>
-template <class>
-void __pstl_any_of(); // declaration needed for the frontend dispatch below
-
-template <class _ExecutionPolicy,
- class _ForwardIterator,
- class _Predicate,
- class _RawPolicy = __remove_cvref_t<_ExecutionPolicy>,
- enable_if_t<is_execution_policy_v<_RawPolicy>, int> = 0>
-[[nodiscard]] _LIBCPP_HIDE_FROM_ABI optional<bool> __any_of(
- _ExecutionPolicy&& __policy, _ForwardIterator&& __first, _ForwardIterator&& __last, _Predicate&& __pred) noexcept {
- return std::__pstl_frontend_dispatch(
- _LIBCPP_PSTL_CUSTOMIZATION_POINT(__pstl_any_of, _RawPolicy),
- [&](_ForwardIterator __g_first, _ForwardIterator __g_last, _Predicate __g_pred) -> optional<bool> {
- auto __res = std::__find_if(__policy, __g_first, __g_last, __g_pred);
- if (!__res)
- return nullopt;
- return *__res != __g_last;
- },
- std::move(__first),
- std::move(__last),
- std::move(__pred));
-}
+_LIBCPP_BEGIN_NAMESPACE_STD
template <class _ExecutionPolicy,
class _ForwardIterator,
@@ -101,35 +42,9 @@ template <class _ExecutionPolicy,
[[nodiscard]] _LIBCPP_HIDE_FROM_ABI bool
any_of(_ExecutionPolicy&& __policy, _ForwardIterator __first, _ForwardIterator __last, _Predicate __pred) {
_LIBCPP_REQUIRE_CPP17_FORWARD_ITERATOR(_ForwardIterator, "any_of requires a ForwardIterator");
- auto __res = std::__any_of(__policy, std::move(__first), std::move(__last), std::move(__pred));
- if (!__res)
- std::__throw_bad_alloc();
- return *std::move(__res);
-}
-
-template <class>
-void __pstl_all_of(); // declaration needed for the frontend dispatch below
-
-template <class _ExecutionPolicy,
- class _ForwardIterator,
- class _Pred,
- class _RawPolicy = __remove_cvref_t<_ExecutionPolicy>,
- enable_if_t<is_execution_policy_v<_RawPolicy>, int> = 0>
-[[nodiscard]] _LIBCPP_HIDE_FROM_ABI optional<bool>
-__all_of(_ExecutionPolicy&& __policy, _ForwardIterator&& __first, _ForwardIterator&& __last, _Pred&& __pred) noexcept {
- return std::__pstl_frontend_dispatch(
- _LIBCPP_PSTL_CUSTOMIZATION_POINT(__pstl_all_of, _RawPolicy),
- [&](_ForwardIterator __g_first, _ForwardIterator __g_last, _Pred __g_pred) -> optional<bool> {
- auto __res = std::__any_of(__policy, __g_first, __g_last, [&](__iter_reference<_ForwardIterator> __value) {
- return !__g_pred(__value);
- });
- if (!__res)
- return nullopt;
- return !*__res;
- },
- std::move(__first),
- std::move(__last),
- std::move(__pred));
+ using _Implementation = __pstl::__dispatch<__pstl::__any_of, __pstl::__current_configuration, _RawPolicy>;
+ return __pstl::__handle_exception<_Implementation>(
+ std::forward<_ExecutionPolicy>(__policy), std::move(__first), std::move(__last), std::move(__pred));
}
template <class _ExecutionPolicy,
@@ -140,33 +55,9 @@ template <class _ExecutionPolicy,
[[nodiscard]] _LIBCPP_HIDE_FROM_ABI bool
all_of(_ExecutionPolicy&& __policy, _ForwardIterator __first, _ForwardIterator __last, _Pred __pred) {
_LIBCPP_REQUIRE_CPP17_FORWARD_ITERATOR(_ForwardIterator, "all_of requires a ForwardIterator");
- auto __res = std::__all_of(__policy, std::move(__first), std::move(__last), std::move(__pred));
- if (!__res)
- std::__throw_bad_alloc();
- return *std::move(__res);
-}
-
-template <class>
-void __pstl_none_of(); // declaration needed for the frontend dispatch below
-
-template <class _ExecutionPolicy,
- class _ForwardIterator,
- class _Pred,
- class _RawPolicy = __remove_cvref_t<_ExecutionPolicy>,
- enable_if_t<is_execution_policy_v<_RawPolicy>, int> = 0>
-[[nodiscard]] _LIBCPP_HIDE_FROM_ABI optional<bool>
-__none_of(_ExecutionPolicy&& __policy, _ForwardIterator&& __first, _ForwardIterator&& __last, _Pred&& __pred) noexcept {
- return std::__pstl_frontend_dispatch(
- _LIBCPP_PSTL_CUSTOMIZATION_POINT(__pstl_none_of, _RawPolicy),
- [&](_ForwardIterator __g_first, _ForwardIterator __g_last, _Pred __g_pred) -> optional<bool> {
- auto __res = std::__any_of(__policy, __g_first, __g_last, __g_pred);
- if (!__res)
- return nullopt;
- return !*__res;
- },
- std::move(__first),
- std::move(__last),
- std::move(__pred));
+ using _Implementation = __pstl::__dispatch<__pstl::__all_of, __pstl::__current_configuration, _RawPolicy>;
+ return __pstl::__handle_exception<_Implementation>(
+ std::forward<_ExecutionPolicy>(__policy), std::move(__first), std::move(__last), std::move(__pred));
}
template <class _ExecutionPolicy,
@@ -177,142 +68,9 @@ template <class _ExecutionPolicy,
[[nodiscard]] _LIBCPP_HIDE_FROM_ABI bool
none_of(_ExecutionPolicy&& __policy, _ForwardIterator __first, _ForwardIterator __last, _Pred __pred) {
_LIBCPP_REQUIRE_CPP17_FORWARD_ITERATOR(_ForwardIterator, "none_of requires a ForwardIterator");
- auto __res = std::__none_of(__policy, std::move(__first), std::move(__last), std::move(__pred));
- if (!__res)
- std::__throw_bad_alloc();
- return *std::move(__res);
-}
-
-template <class _ExecutionPolicy,
- class _ForwardIterator,
- class _ForwardOutIterator,
- class _UnaryOperation,
- class _RawPolicy = __remove_cvref_t<_ExecutionPolicy>,
- enable_if_t<is_execution_policy_v<_RawPolicy>, int> = 0>
-[[nodiscard]] _LIBCPP_HIDE_FROM_ABI optional<__remove_cvref_t<_ForwardOutIterator>>
-__transform(_ExecutionPolicy&&,
- _ForwardIterator&& __first,
- _ForwardIterator&& __last,
- _ForwardOutIterator&& __result,
- _UnaryOperation&& __op) noexcept {
- using _Backend = typename __select_backend<_RawPolicy>::type;
- return std::__pstl_transform<_RawPolicy>(
- _Backend{}, std::move(__first), std::move(__last), std::move(__result), std::move(__op));
-}
-
-template <class _ExecutionPolicy,
- class _ForwardIterator,
- class _ForwardOutIterator,
- class _UnaryOperation,
- class _RawPolicy = __remove_cvref_t<_ExecutionPolicy>,
- enable_if_t<is_execution_policy_v<_RawPolicy>, int> = 0>
-_LIBCPP_HIDE_FROM_ABI _ForwardOutIterator transform(
- _ExecutionPolicy&& __policy,
- _ForwardIterator __first,
- _ForwardIterator __last,
- _ForwardOutIterator __result,
- _UnaryOperation __op) {
- _LIBCPP_REQUIRE_CPP17_FORWARD_ITERATOR(_ForwardIterator, "transform requires ForwardIterators");
- _LIBCPP_REQUIRE_CPP17_FORWARD_ITERATOR(_ForwardOutIterator, "transform requires an OutputIterator");
- _LIBCPP_REQUIRE_CPP17_OUTPUT_ITERATOR(
- _ForwardOutIterator, decltype(__op(*__first)), "transform requires an OutputIterator");
- auto __res = std::__transform(__policy, std::move(__first), std::move(__last), std::move(__result), std::move(__op));
- if (!__res)
- std::__throw_bad_alloc();
- return *std::move(__res);
-}
-
-template <class _ExecutionPolicy,
- class _ForwardIterator1,
- class _ForwardIterator2,
- class _ForwardOutIterator,
- class _BinaryOperation,
- class _RawPolicy = __remove_cvref_t<_ExecutionPolicy>,
- enable_if_t<is_execution_policy_v<_RawPolicy>, int> = 0>
-_LIBCPP_HIDE_FROM_ABI optional<__remove_cvref_t<_ForwardOutIterator>>
-__transform(_ExecutionPolicy&&,
- _ForwardIterator1&& __first1,
- _ForwardIterator1&& __last1,
- _ForwardIterator2&& __first2,
- _ForwardOutIterator&& __result,
- _BinaryOperation&& __op) noexcept {
- using _Backend = typename __select_backend<_RawPolicy>::type;
- return std::__pstl_transform<_RawPolicy>(
- _Backend{}, std::move(__first1), std::move(__last1), std::move(__first2), std::move(__result), std::move(__op));
-}
-
-template <class _ExecutionPolicy,
- class _ForwardIterator1,
- class _ForwardIterator2,
- class _ForwardOutIterator,
- class _BinaryOperation,
- class _RawPolicy = __remove_cvref_t<_ExecutionPolicy>,
- enable_if_t<is_execution_policy_v<_RawPolicy>, int> = 0>
-_LIBCPP_HIDE_FROM_ABI _ForwardOutIterator transform(
- _ExecutionPolicy&& __policy,
- _ForwardIterator1 __first1,
- _ForwardIterator1 __last1,
- _ForwardIterator2 __first2,
- _ForwardOutIterator __result,
- _BinaryOperation __op) {
- _LIBCPP_REQUIRE_CPP17_FORWARD_ITERATOR(_ForwardIterator1, "transform requires ForwardIterators");
- _LIBCPP_REQUIRE_CPP17_FORWARD_ITERATOR(_ForwardIterator2, "transform requires ForwardIterators");
- _LIBCPP_REQUIRE_CPP17_FORWARD_ITERATOR(_ForwardOutIterator, "transform requires an OutputIterator");
- _LIBCPP_REQUIRE_CPP17_OUTPUT_ITERATOR(
- _ForwardOutIterator, decltype(__op(*__first1, *__first2)), "transform requires an OutputIterator");
- auto __res = std::__transform(
- __policy, std::move(__first1), std::move(__last1), std::move(__first2), std::move(__result), std::move(__op));
- if (!__res)
- std::__throw_bad_alloc();
- return *std::move(__res);
-}
-
-template <class _ExecutionPolicy,
- class _ForwardIterator,
- class _Function,
- class _RawPolicy = __remove_cvref_t<_ExecutionPolicy>,
- enable_if_t<is_execution_policy_v<_RawPolicy>, int> = 0>
-[[nodiscard]] _LIBCPP_HIDE_FROM_ABI optional<__empty>
-__for_each(_ExecutionPolicy&&, _ForwardIterator&& __first, _ForwardIterator&& __last, _Function&& __func) noexcept {
- using _Backend = typename __select_backend<_RawPolicy>::type;
- return std::__pstl_for_each<_RawPolicy>(_Backend{}, std::move(__first), std::move(__last), std::move(__func));
-}
-
-template <class _ExecutionPolicy,
- class _ForwardIterator,
- class _Function,
- class _RawPolicy = __remove_cvref_t<_ExecutionPolicy>,
- enable_if_t<is_execution_policy_v<_RawPolicy>, int> = 0>
-_LIBCPP_HIDE_FROM_ABI void
-for_each(_ExecutionPolicy&& __policy, _ForwardIterator __first, _ForwardIterator __last, _Function __func) {
- _LIBCPP_REQUIRE_CPP17_FORWARD_ITERATOR(_ForwardIterator, "for_each requires ForwardIterators");
- if (!std::__for_each(__policy, std::move(__first), std::move(__last), std::move(__func)))
- std::__throw_bad_alloc();
-}
-
-// TODO: Use the std::copy/move shenanigans to forward to std::memmove
-
-template <class>
-void __pstl_copy();
-
-template <class _ExecutionPolicy,
- class _ForwardIterator,
- class _ForwardOutIterator,
- class _RawPolicy = __remove_cvref_t<_ExecutionPolicy>,
- enable_if_t<is_execution_policy_v<_RawPolicy>, int> = 0>
-[[nodiscard]] _LIBCPP_HIDE_FROM_ABI optional<_ForwardOutIterator>
-__copy(_ExecutionPolicy&& __policy,
- _ForwardIterator&& __first,
- _ForwardIterator&& __last,
- _ForwardOutIterator&& __result) noexcept {
- return std::__pstl_frontend_dispatch(
- _LIBCPP_PSTL_CUSTOMIZATION_POINT(__pstl_copy, _RawPolicy),
- [&__policy](_ForwardIterator __g_first, _ForwardIterator __g_last, _ForwardOutIterator __g_result) {
- return std::__transform(__policy, __g_first, __g_last, __g_result, __identity());
- },
- std::move(__first),
- std::move(__last),
- std::move(__result));
+ using _Implementation = __pstl::__dispatch<__pstl::__none_of, __pstl::__current_configuration, _RawPolicy>;
+ return __pstl::__handle_exception<_Implementation>(
+ std::forward<_ExecutionPolicy>(__policy), std::move(__first), std::move(__last), std::move(__pred));
}
template <class _ExecutionPolicy,
@@ -328,37 +86,9 @@ copy(_ExecutionPolicy&& __policy, _ForwardIterator __first, _ForwardIterator __l
_ForwardOutIterator, "copy(first, last, result) requires result to be a ForwardIterator");
_LIBCPP_REQUIRE_CPP17_OUTPUT_ITERATOR(
_ForwardOutIterator, decltype(*__first), "copy(first, last, result) requires result to be an OutputIterator");
- auto __res = std::__copy(__policy, std::move(__first), std::move(__last), std::move(__result));
- if (!__res)
- std::__throw_bad_alloc();
- return *std::move(__res);
-}
-
-template <class>
-void __pstl_copy_n();
-
-template <class _ExecutionPolicy,
- class _ForwardIterator,
- class _ForwardOutIterator,
- class _Size,
- class _RawPolicy = __remove_cvref_t<_ExecutionPolicy>,
- enable_if_t<is_execution_policy_v<_RawPolicy>, int> = 0>
-[[nodiscard]] _LIBCPP_HIDE_FROM_ABI optional<_ForwardOutIterator> __copy_n(
- _ExecutionPolicy&& __policy, _ForwardIterator&& __first, _Size&& __n, _ForwardOutIterator&& __result) noexcept {
- return std::__pstl_frontend_dispatch(
- _LIBCPP_PSTL_CUSTOMIZATION_POINT(__pstl_copy_n, _RawPolicy),
- [&__policy](
- _ForwardIterator __g_first, _Size __g_n, _ForwardOutIterator __g_result) -> optional<_ForwardIterator> {
- if constexpr (__has_random_access_iterator_category_or_concept<_ForwardIterator>::value) {
- return std::__copy(__policy, std::move(__g_first), std::move(__g_first + __g_n), std::move(__g_result));
- } else {
- (void)__policy;
- return std::copy_n(__g_first, __g_n, __g_result);
- }
- },
- std::move(__first),
- std::move(__n),
- std::move(__result));
+ using _Implementation = __pstl::__dispatch<__pstl::__copy, __pstl::__current_configuration, _RawPolicy>;
+ return __pstl::__handle_exception<_Implementation>(
+ std::forward<_ExecutionPolicy>(__policy), std::move(__first), std::move(__last), std::move(__result));
}
template <class _ExecutionPolicy,
@@ -375,37 +105,9 @@ copy_n(_ExecutionPolicy&& __policy, _ForwardIterator __first, _Size __n, _Forwar
_ForwardOutIterator, "copy_n(first, n, result) requires result to be a ForwardIterator");
_LIBCPP_REQUIRE_CPP17_OUTPUT_ITERATOR(
_ForwardOutIterator, decltype(*__first), "copy_n(first, n, result) requires result to be an OutputIterator");
- auto __res = std::__copy_n(__policy, std::move(__first), std::move(__n), std::move(__result));
- if (!__res)
- std::__throw_bad_alloc();
- return *std::move(__res);
-}
-
-template <class>
-void __pstl_count_if(); // declaration needed for the frontend dispatch below
-
-template <class _ExecutionPolicy,
- class _ForwardIterator,
- class _Predicate,
- class _RawPolicy = __remove_cvref_t<_ExecutionPolicy>,
- enable_if_t<is_execution_policy_v<_RawPolicy>, int> = 0>
-[[nodiscard]] _LIBCPP_HIDE_FROM_ABI optional<__iter_diff_t<_ForwardIterator>> __count_if(
- _ExecutionPolicy&& __policy, _ForwardIterator&& __first, _ForwardIterator&& __last, _Predicate&& __pred) noexcept {
- using __diff_t = __iter_diff_t<_ForwardIterator>;
- return std::__pstl_frontend_dispatch(
- _LIBCPP_PSTL_CUSTOMIZATION_POINT(__pstl_count_if, _RawPolicy),
- [&](_ForwardIterator __g_first, _ForwardIterator __g_last, _Predicate __g_pred) -> optional<__diff_t> {
- return std::__transform_reduce(
- __policy,
- std::move(__g_first),
- std::move(__g_last),
- __diff_t(),
- std::plus{},
- [&](__iter_reference<_ForwardIterator> __element) -> bool { return __g_pred(__element); });
- },
- std::move(__first),
- std::move(__last),
- std::move(__pred));
+ using _Implementation = __pstl::__dispatch<__pstl::__copy_n, __pstl::__current_configuration, _RawPolicy>;
+ return __pstl::__handle_exception<_Implementation>(
+ std::forward<_ExecutionPolicy>(__policy), std::move(__first), std::move(__n), std::move(__result));
}
template <class _ExecutionPolicy,
@@ -417,33 +119,9 @@ _LIBCPP_HIDE_FROM_ABI __iter_diff_t<_ForwardIterator>
count_if(_ExecutionPolicy&& __policy, _ForwardIterator __first, _ForwardIterator __last, _Predicate __pred) {
_LIBCPP_REQUIRE_CPP17_FORWARD_ITERATOR(
_ForwardIterator, "count_if(first, last, pred) requires [first, last) to be ForwardIterators");
- auto __res = std::__count_if(__policy, std::move(__first), std::move(__last), std::move(__pred));
- if (!__res)
- std::__throw_bad_alloc();
- return *std::move(__res);
-}
-
-template <class>
-void __pstl_count(); // declaration needed for the frontend dispatch below
-
-template <class _ExecutionPolicy,
- class _ForwardIterator,
- class _Tp,
- class _RawPolicy = __remove_cvref_t<_ExecutionPolicy>,
- enable_if_t<is_execution_policy_v<_RawPolicy>, int> = 0>
-[[nodiscard]] _LIBCPP_HIDE_FROM_ABI optional<__iter_diff_t<_ForwardIterator>> __count(
- _ExecutionPolicy&& __policy, _ForwardIterator&& __first, _ForwardIterator&& __last, const _Tp& __value) noexcept {
- return std::__pstl_frontend_dispatch(
- _LIBCPP_PSTL_CUSTOMIZATION_POINT(__pstl_count, _RawPolicy),
- [&](_ForwardIterator __g_first, _ForwardIterator __g_last, const _Tp& __g_value)
- -> optional<__iter_diff_t<_ForwardIterator>> {
- return std::count_if(__policy, __g_first, __g_last, [&](__iter_reference<_ForwardIterator> __v) {
- return __v == __g_value;
- });
- },
- std::forward<_ForwardIterator>(__first),
- std::forward<_ForwardIterator>(__last),
- __value);
+ using _Implementation = __pstl::__dispatch<__pstl::__count_if, __pstl::__current_configuration, _RawPolicy>;
+ return __pstl::__handle_exception<_Implementation>(
+ std::forward<_ExecutionPolicy>(__policy), std::move(__first), std::move(__last), std::move(__pred));
}
template <class _ExecutionPolicy,
@@ -455,44 +133,9 @@ _LIBCPP_HIDE_FROM_ABI __iter_diff_t<_ForwardIterator>
count(_ExecutionPolicy&& __policy, _ForwardIterator __first, _ForwardIterator __last, const _Tp& __value) {
_LIBCPP_REQUIRE_CPP17_FORWARD_ITERATOR(
_ForwardIterator, "count(first, last, val) requires [first, last) to be ForwardIterators");
- auto __res = std::__count(__policy, std::move(__first), std::move(__last), __value);
- if (!__res)
- std::__throw_bad_alloc();
- return *__res;
-}
-
-template <class>
-void __pstl_equal();
-
-template <class _ExecutionPolicy,
- class _ForwardIterator1,
- class _ForwardIterator2,
- class _Pred,
- class _RawPolicy = __remove_cvref_t<_ExecutionPolicy>,
- enable_if_t<is_execution_policy_v<_RawPolicy>, int> = 0>
-[[nodiscard]] _LIBCPP_HIDE_FROM_ABI optional<bool>
-__equal(_ExecutionPolicy&& __policy,
- _ForwardIterator1&& __first1,
- _ForwardIterator1&& __last1,
- _ForwardIterator2&& __first2,
- _Pred&& __pred) noexcept {
- return std::__pstl_frontend_dispatch(
- _LIBCPP_PSTL_CUSTOMIZATION_POINT(__pstl_equal, _RawPolicy),
- [&__policy](
- _ForwardIterator1 __g_first1, _ForwardIterator1 __g_last1, _ForwardIterator2 __g_first2, _Pred __g_pred) {
- return std::__transform_reduce(
- __policy,
- std::move(__g_first1),
- std::move(__g_last1),
- std::move(__g_first2),
- true,
- std::logical_and{},
- std::move(__g_pred));
- },
- std::move(__first1),
- std::move(__last1),
- std::move(__first2),
- std::move(__pred));
+ using _Implementation = __pstl::__dispatch<__pstl::__count, __pstl::__current_configuration, _RawPolicy>;
+ return __pstl::__handle_exception<_Implementation>(
+ std::forward<_ExecutionPolicy>(__policy), std::move(__first), std::move(__last), __value);
}
template <class _ExecutionPolicy,
@@ -509,67 +152,31 @@ equal(_ExecutionPolicy&& __policy,
_Pred __pred) {
_LIBCPP_REQUIRE_CPP17_FORWARD_ITERATOR(_ForwardIterator1, "equal requires ForwardIterators");
_LIBCPP_REQUIRE_CPP17_FORWARD_ITERATOR(_ForwardIterator2, "equal requires ForwardIterators");
- auto __res = std::__equal(__policy, std::move(__first1), std::move(__last1), std::move(__first2), std::move(__pred));
- if (!__res)
- std::__throw_bad_alloc();
- return *__res;
+ using _Implementation = __pstl::__dispatch<__pstl::__equal_3leg, __pstl::__current_configuration, _RawPolicy>;
+ return __pstl::__handle_exception<_Implementation>(
+ std::forward<_ExecutionPolicy>(__policy),
+ std::move(__first1),
+ std::move(__last1),
+ std::move(__first2),
+ std::move(__pred));
}
template <class _ExecutionPolicy,
class _ForwardIterator1,
class _ForwardIterator2,
- enable_if_t<is_execution_policy_v<__remove_cvref_t<_ExecutionPolicy>>, int> = 0>
+ class _RawPolicy = __remove_cvref_t<_ExecutionPolicy>,
+ enable_if_t<is_execution_policy_v<_RawPolicy>, int> = 0>
_LIBCPP_HIDE_FROM_ABI bool
equal(_ExecutionPolicy&& __policy, _ForwardIterator1 __first1, _ForwardIterator1 __last1, _ForwardIterator2 __first2) {
_LIBCPP_REQUIRE_CPP17_FORWARD_ITERATOR(_ForwardIterator1, "equal requires ForwardIterators");
_LIBCPP_REQUIRE_CPP17_FORWARD_ITERATOR(_ForwardIterator2, "equal requires ForwardIterators");
- auto __res = std::__equal(__policy, std::move(__first1), std::move(__last1), std::move(__first2), std::equal_to{});
- if (!__res)
- std::__throw_bad_alloc();
- return *__res;
-}
-
-template <class _ExecutionPolicy,
- class _ForwardIterator1,
- class _ForwardIterator2,
- class _Pred,
- class _RawPolicy = __remove_cvref_t<_ExecutionPolicy>,
- enable_if_t<is_execution_policy_v<_RawPolicy>, int> = 0>
-[[nodiscard]] _LIBCPP_HIDE_FROM_ABI optional<bool>
-__equal(_ExecutionPolicy&& __policy,
- _ForwardIterator1&& __first1,
- _ForwardIterator1&& __last1,
- _ForwardIterator2&& __first2,
- _ForwardIterator2&& __last2,
- _Pred&& __pred) noexcept {
- return std::__pstl_frontend_dispatch(
- _LIBCPP_PSTL_CUSTOMIZATION_POINT(__pstl_equal, _RawPolicy),
- [&__policy](_ForwardIterator1 __g_first1,
- _ForwardIterator1 __g_last1,
- _ForwardIterator2 __g_first2,
- _ForwardIterator2 __g_last2,
- _Pred __g_pred) -> optional<bool> {
- if constexpr (__has_random_access_iterator_category<_ForwardIterator1>::value &&
- __has_random_access_iterator_category<_ForwardIterator2>::value) {
- if (__g_last1 - __g_first1 != __g_last2 - __g_first2)
- return false;
- return std::__equal(
- __policy, std::move(__g_first1), std::move(__g_last1), std::move(__g_first2), std::move(__g_pred));
- } else {
- (void)__policy; // Avoid unused lambda capture warning
- return std::equal(
- std::move(__g_first1),
- std::move(__g_last1),
- std::move(__g_first2),
- std::move(__g_last2),
- std::move(__g_pred));
- }
- },
+ using _Implementation = __pstl::__dispatch<__pstl::__equal_3leg, __pstl::__current_configuration, _RawPolicy>;
+ return __pstl::__handle_exception<_Implementation>(
+ std::forward<_ExecutionPolicy>(__policy),
std::move(__first1),
std::move(__last1),
std::move(__first2),
- std::move(__last2),
- std::move(__pred));
+ equal_to{});
}
template <class _ExecutionPolicy,
@@ -587,17 +194,21 @@ equal(_ExecutionPolicy&& __policy,
_Pred __pred) {
_LIBCPP_REQUIRE_CPP17_FORWARD_ITERATOR(_ForwardIterator1, "equal requires ForwardIterators");
_LIBCPP_REQUIRE_CPP17_FORWARD_ITERATOR(_ForwardIterator2, "equal requires ForwardIterators");
- auto __res = std::__equal(
- __policy, std::move(__first1), std::move(__last1), std::move(__first2), std::move(__last2), std::move(__pred));
- if (!__res)
- std::__throw_bad_alloc();
- return *__res;
+ using _Implementation = __pstl::__dispatch<__pstl::__equal, __pstl::__current_configuration, _RawPolicy>;
+ return __pstl::__handle_exception<_Implementation>(
+ std::forward<_ExecutionPolicy>(__policy),
+ std::move(__first1),
+ std::move(__last1),
+ std::move(__first2),
+ std::move(__last2),
+ std::move(__pred));
}
template <class _ExecutionPolicy,
class _ForwardIterator1,
class _ForwardIterator2,
- enable_if_t<is_execution_policy_v<__remove_cvref_t<_ExecutionPolicy>>, int> = 0>
+ class _RawPolicy = __remove_cvref_t<_ExecutionPolicy>,
+ enable_if_t<is_execution_policy_v<_RawPolicy>, int> = 0>
_LIBCPP_HIDE_FROM_ABI bool
equal(_ExecutionPolicy&& __policy,
_ForwardIterator1 __first1,
@@ -606,33 +217,14 @@ equal(_ExecutionPolicy&& __policy,
_ForwardIterator2 __last2) {
_LIBCPP_REQUIRE_CPP17_FORWARD_ITERATOR(_ForwardIterator1, "equal requires ForwardIterators");
_LIBCPP_REQUIRE_CPP17_FORWARD_ITERATOR(_ForwardIterator2, "equal requires ForwardIterators");
- auto __res = std::__equal(
- __policy, std::move(__first1), std::move(__last1), std::move(__first2), std::move(__last2), std::equal_to{});
- if (!__res)
- std::__throw_bad_alloc();
- return *__res;
-}
-
-template <class>
-void __pstl_fill(); // declaration needed for the frontend dispatch below
-
-template <class _ExecutionPolicy,
- class _ForwardIterator,
- class _Tp,
- class _RawPolicy = __remove_cvref_t<_ExecutionPolicy>,
- enable_if_t<is_execution_policy_v<_RawPolicy>, int> = 0>
-_LIBCPP_HIDE_FROM_ABI optional<__empty> __fill(
- _ExecutionPolicy&& __policy, _ForwardIterator&& __first, _ForwardIterator&& __last, const _Tp& __value) noexcept {
- return std::__pstl_frontend_dispatch(
- _LIBCPP_PSTL_CUSTOMIZATION_POINT(__pstl_fill, _RawPolicy),
- [&](_ForwardIterator __g_first, _ForwardIterator __g_last, const _Tp& __g_value) {
- return std::__for_each(__policy, __g_first, __g_last, [&](__iter_reference<_ForwardIterator> __element) {
- __element = __g_value;
- });
- },
- std::forward<_ForwardIterator>(__first),
- std::forward<_ForwardIterator>(__last),
- __value);
+ using _Implementation = __pstl::__dispatch<__pstl::__equal, __pstl::__current_configuration, _RawPolicy>;
+ return __pstl::__handle_exception<_Implementation>(
+ std::forward<_ExecutionPolicy>(__policy),
+ std::move(__first1),
+ std::move(__last1),
+ std::move(__first2),
+ std::move(__last2),
+ equal_to{});
}
template <class _ExecutionPolicy,
@@ -643,70 +235,36 @@ template <class _ExecutionPolicy,
_LIBCPP_HIDE_FROM_ABI void
fill(_ExecutionPolicy&& __policy, _ForwardIterator __first, _ForwardIterator __last, const _Tp& __value) {
_LIBCPP_REQUIRE_CPP17_FORWARD_ITERATOR(_ForwardIterator, "fill requires ForwardIterators");
- if (!std::__fill(__policy, std::move(__first), std::move(__last), __value))
- std::__throw_bad_alloc();
+ using _Implementation = __pstl::__dispatch<__pstl::__fill, __pstl::__current_configuration, _RawPolicy>;
+ __pstl::__handle_exception<_Implementation>(
+ std::forward<_ExecutionPolicy>(__policy), std::move(__first), std::move(__last), __value);
}
-template <class>
-void __pstl_fill_n(); // declaration needed for the frontend dispatch below
-
template <class _ExecutionPolicy,
class _ForwardIterator,
- class _SizeT,
- class _Tp,
- class _RawPolicy = __remove_cvref_t<_ExecutionPolicy>,
- enable_if_t<is_execution_policy_v<_RawPolicy>, int> = 0>
-[[nodiscard]] _LIBCPP_HIDE_FROM_ABI optional<__empty>
-__fill_n(_ExecutionPolicy&& __policy, _ForwardIterator&& __first, _SizeT&& __n, const _Tp& __value) noexcept {
- return std::__pstl_frontend_dispatch(
- _LIBCPP_PSTL_CUSTOMIZATION_POINT(__pstl_fill_n, _RawPolicy),
- [&](_ForwardIterator __g_first, _SizeT __g_n, const _Tp& __g_value) {
- if constexpr (__has_random_access_iterator_category_or_concept<_ForwardIterator>::value)
- std::fill(__policy, __g_first, __g_first + __g_n, __g_value);
- else
- std::fill_n(__g_first, __g_n, __g_value);
- return optional<__empty>{__empty{}};
- },
- std::move(__first),
- std::move(__n),
- __value);
-}
-
-template <class _ExecutionPolicy,
- class _ForwardIterator,
- class _SizeT,
+ class _Size,
class _Tp,
class _RawPolicy = __remove_cvref_t<_ExecutionPolicy>,
enable_if_t<is_execution_policy_v<_RawPolicy>, int> = 0>
_LIBCPP_HIDE_FROM_ABI void
-fill_n(_ExecutionPolicy&& __policy, _ForwardIterator __first, _SizeT __n, const _Tp& __value) {
- _LIBCPP_REQUIRE_CPP17_FORWARD_ITERATOR(_ForwardIterator, "fill_n requires ForwardIterators");
- if (!std::__fill_n(__policy, std::move(__first), std::move(__n), __value))
- std::__throw_bad_alloc();
+fill_n(_ExecutionPolicy&& __policy, _ForwardIterator __first, _Size __n, const _Tp& __value) {
+ _LIBCPP_REQUIRE_CPP17_FORWARD_ITERATOR(_ForwardIterator, "fill_n requires a ForwardIterator");
+ using _Implementation = __pstl::__dispatch<__pstl::__fill_n, __pstl::__current_configuration, _RawPolicy>;
+ __pstl::__handle_exception<_Implementation>(
+ std::forward<_ExecutionPolicy>(__policy), std::move(__first), std::move(__n), __value);
}
-template <class>
-void __pstl_find_if_not();
-
template <class _ExecutionPolicy,
class _ForwardIterator,
class _Predicate,
class _RawPolicy = __remove_cvref_t<_ExecutionPolicy>,
enable_if_t<is_execution_policy_v<_RawPolicy>, int> = 0>
-[[nodiscard]] _LIBCPP_HIDE_FROM_ABI optional<__remove_cvref_t<_ForwardIterator>> __find_if_not(
- _ExecutionPolicy&& __policy, _ForwardIterator&& __first, _ForwardIterator&& __last, _Predicate&& __pred) noexcept {
- return std::__pstl_frontend_dispatch(
- _LIBCPP_PSTL_CUSTOMIZATION_POINT(__pstl_find_if_not, _RawPolicy),
- [&](_ForwardIterator&& __g_first, _ForwardIterator&& __g_last, _Predicate&& __g_pred)
- -> optional<__remove_cvref_t<_ForwardIterator>> {
- return std::__find_if(
- __policy, __g_first, __g_last, [&](__iter_reference<__remove_cvref_t<_ForwardIterator>> __value) {
- return !__g_pred(__value);
- });
- },
- std::forward<_ForwardIterator>(__first),
- std::forward<_ForwardIterator>(__last),
- std::forward<_Predicate>(__pred));
+_LIBCPP_HIDE_FROM_ABI _ForwardIterator
+find_if(_ExecutionPolicy&& __policy, _ForwardIterator __first, _ForwardIterator __last, _Predicate __pred) {
+ _LIBCPP_REQUIRE_CPP17_FORWARD_ITERATOR(_ForwardIterator, "find_if requires ForwardIterators");
+ using _Implementation = __pstl::__dispatch<__pstl::__find_if, __pstl::__current_configuration, _RawPolicy>;
+ return __pstl::__handle_exception<_Implementation>(
+ std::forward<_ExecutionPolicy>(__policy), std::move(__first), std::move(__last), std::move(__pred));
}
template <class _ExecutionPolicy,
@@ -717,33 +275,9 @@ template <class _ExecutionPolicy,
_LIBCPP_HIDE_FROM_ABI _ForwardIterator
find_if_not(_ExecutionPolicy&& __policy, _ForwardIterator __first, _ForwardIterator __last, _Predicate __pred) {
_LIBCPP_REQUIRE_CPP17_FORWARD_ITERATOR(_ForwardIterator, "find_if_not requires ForwardIterators");
- auto __res = std::__find_if_not(__policy, std::move(__first), std::move(__last), std::move(__pred));
- if (!__res)
- std::__throw_bad_alloc();
- return *std::move(__res);
-}
-
-template <class>
-void __pstl_find();
-
-template <class _ExecutionPolicy,
- class _ForwardIterator,
- class _Tp,
- class _RawPolicy = __remove_cvref_t<_ExecutionPolicy>,
- enable_if_t<is_execution_policy_v<_RawPolicy>, int> = 0>
-[[nodiscard]] _LIBCPP_HIDE_FROM_ABI optional<__remove_cvref_t<_ForwardIterator>> __find(
- _ExecutionPolicy&& __policy, _ForwardIterator&& __first, _ForwardIterator&& __last, const _Tp& __value) noexcept {
- return std::__pstl_frontend_dispatch(
- _LIBCPP_PSTL_CUSTOMIZATION_POINT(__pstl_find, _RawPolicy),
- [&](_ForwardIterator __g_first, _ForwardIterator __g_last, const _Tp& __g_value) -> optional<_ForwardIterator> {
- return std::find_if(
- __policy, __g_first, __g_last, [&](__iter_reference<__remove_cvref_t<_ForwardIterator>> __element) {
- return __element == __g_value;
- });
- },
- std::forward<_ForwardIterator>(__first),
- std::forward<_ForwardIterator>(__last),
- __value);
+ using _Implementation = __pstl::__dispatch<__pstl::__find_if_not, __pstl::__current_configuration, _RawPolicy>;
+ return __pstl::__handle_exception<_Implementation>(
+ std::forward<_ExecutionPolicy>(__policy), std::move(__first), std::move(__last), std::move(__pred));
}
template <class _ExecutionPolicy,
@@ -754,37 +288,22 @@ template <class _ExecutionPolicy,
_LIBCPP_HIDE_FROM_ABI _ForwardIterator
find(_ExecutionPolicy&& __policy, _ForwardIterator __first, _ForwardIterator __last, const _Tp& __value) {
_LIBCPP_REQUIRE_CPP17_FORWARD_ITERATOR(_ForwardIterator, "find requires ForwardIterators");
- auto __res = std::__find(__policy, std::move(__first), std::move(__last), __value);
- if (!__res)
- std::__throw_bad_alloc();
- return *std::move(__res);
+ using _Implementation = __pstl::__dispatch<__pstl::__find, __pstl::__current_configuration, _RawPolicy>;
+ return __pstl::__handle_exception<_Implementation>(
+ std::forward<_ExecutionPolicy>(__policy), std::move(__first), std::move(__last), __value);
}
-template <class>
-void __pstl_for_each_n(); // declaration needed for the frontend dispatch below
-
template <class _ExecutionPolicy,
class _ForwardIterator,
- class _Size,
class _Function,
class _RawPolicy = __remove_cvref_t<_ExecutionPolicy>,
enable_if_t<is_execution_policy_v<_RawPolicy>, int> = 0>
-[[nodiscard]] _LIBCPP_HIDE_FROM_ABI optional<__empty>
-__for_each_n(_ExecutionPolicy&& __policy, _ForwardIterator&& __first, _Size&& __size, _Function&& __func) noexcept {
- return std::__pstl_frontend_dispatch(
- _LIBCPP_PSTL_CUSTOMIZATION_POINT(__pstl_for_each_n, _RawPolicy),
- [&](_ForwardIterator __g_first, _Size __g_size, _Function __g_func) -> optional<__empty> {
- if constexpr (__has_random_access_iterator_category_or_concept<_ForwardIterator>::value) {
- std::for_each(__policy, std::move(__g_first), __g_first + __g_size, std::move(__g_func));
- return __empty{};
- } else {
- std::for_each_n(std::move(__g_first), __g_size, std::move(__g_func));
- return __empty{};
- }
- },
- std::move(__first),
- std::move(__size),
- std::move(__func));
+_LIBCPP_HIDE_FROM_ABI void
+for_each(_ExecutionPolicy&& __policy, _ForwardIterator __first, _ForwardIterator __last, _Function __func) {
+ _LIBCPP_REQUIRE_CPP17_FORWARD_ITERATOR(_ForwardIterator, "for_each requires ForwardIterators");
+ using _Implementation = __pstl::__dispatch<__pstl::__for_each, __pstl::__current_configuration, _RawPolicy>;
+ __pstl::__handle_exception<_Implementation>(
+ std::forward<_ExecutionPolicy>(__policy), std::move(__first), std::move(__last), std::move(__func));
}
template <class _ExecutionPolicy,
@@ -796,32 +315,9 @@ template <class _ExecutionPolicy,
_LIBCPP_HIDE_FROM_ABI void
for_each_n(_ExecutionPolicy&& __policy, _ForwardIterator __first, _Size __size, _Function __func) {
_LIBCPP_REQUIRE_CPP17_FORWARD_ITERATOR(_ForwardIterator, "for_each_n requires a ForwardIterator");
- auto __res = std::__for_each_n(__policy, std::move(__first), std::move(__size), std::move(__func));
- if (!__res)
- std::__throw_bad_alloc();
-}
-
-template <class>
-void __pstl_generate();
-
-template <class _ExecutionPolicy,
- class _ForwardIterator,
- class _Generator,
- class _RawPolicy = __remove_cvref_t<_ExecutionPolicy>,
- enable_if_t<is_execution_policy_v<_RawPolicy>, int> = 0>
-[[nodiscard]] _LIBCPP_HIDE_FROM_ABI optional<__empty> __generate(
- _ExecutionPolicy&& __policy, _ForwardIterator&& __first, _ForwardIterator&& __last, _Generator&& __gen) noexcept {
- return std::__pstl_frontend_dispatch(
- _LIBCPP_PSTL_CUSTOMIZATION_POINT(__pstl_generate, _RawPolicy),
- [&__policy](_ForwardIterator __g_first, _ForwardIterator __g_last, _Generator __g_gen) {
- return std::__for_each(
- __policy, std::move(__g_first), std::move(__g_last), [&](__iter_reference<_ForwardIterator> __element) {
- __element = __g_gen();
- });
- },
- std::move(__first),
- std::move(__last),
- std::move(__gen));
+ using _Implementation = __pstl::__dispatch<__pstl::__for_each_n, __pstl::__current_configuration, _RawPolicy>;
+ __pstl::__handle_exception<_Implementation>(
+ std::forward<_ExecutionPolicy>(__policy), std::move(__first), std::move(__size), std::move(__func));
}
template <class _ExecutionPolicy,
@@ -832,32 +328,9 @@ template <class _ExecutionPolicy,
_LIBCPP_HIDE_FROM_ABI void
generate(_ExecutionPolicy&& __policy, _ForwardIterator __first, _ForwardIterator __last, _Generator __gen) {
_LIBCPP_REQUIRE_CPP17_FORWARD_ITERATOR(_ForwardIterator, "generate requires ForwardIterators");
- if (!std::__generate(__policy, std::move(__first), std::move(__last), std::move(__gen)))
- std::__throw_bad_alloc();
-}
-
-template <class>
-void __pstl_generate_n();
-
-template <class _ExecutionPolicy,
- class _ForwardIterator,
- class _Size,
- class _Generator,
- class _RawPolicy = __remove_cvref_t<_ExecutionPolicy>,
- enable_if_t<is_execution_policy_v<_RawPolicy>, int> = 0>
-[[nodiscard]] _LIBCPP_HIDE_FROM_ABI optional<__empty>
-__generate_n(_ExecutionPolicy&& __policy, _ForwardIterator&& __first, _Size&& __n, _Generator&& __gen) noexcept {
- return std::__pstl_frontend_dispatch(
- _LIBCPP_PSTL_CUSTOMIZATION_POINT(__pstl_generate_n, _RawPolicy),
- [&__policy](_ForwardIterator __g_first, _Size __g_n, _Generator __g_gen) {
- return std::__for_each_n(
- __policy, std::move(__g_first), std::move(__g_n), [&](__iter_reference<_ForwardIterator> __element) {
- __element = __g_gen();
- });
- },
- std::move(__first),
- __n,
- std::move(__gen));
+ using _Implementation = __pstl::__dispatch<__pstl::__generate, __pstl::__current_configuration, _RawPolicy>;
+ __pstl::__handle_exception<_Implementation>(
+ std::forward<_ExecutionPolicy>(__policy), std::move(__first), std::move(__last), std::move(__gen));
}
template <class _ExecutionPolicy,
@@ -869,32 +342,9 @@ template <class _ExecutionPolicy,
_LIBCPP_HIDE_FROM_ABI void
generate_n(_ExecutionPolicy&& __policy, _ForwardIterator __first, _Size __n, _Generator __gen) {
_LIBCPP_REQUIRE_CPP17_FORWARD_ITERATOR(_ForwardIterator, "generate_n requires a ForwardIterator");
- if (!std::__generate_n(__policy, std::move(__first), std::move(__n), std::move(__gen)))
- std::__throw_bad_alloc();
-}
-
-template <class>
-void __pstl_is_partitioned();
-
-template <class _ExecutionPolicy,
- class _ForwardIterator,
- class _Predicate,
- class _RawPolicy = __remove_cvref_t<_ExecutionPolicy>,
- enable_if_t<is_execution_policy_v<_RawPolicy>, int> = 0>
-[[nodiscard]] _LIBCPP_HIDE_FROM_ABI optional<bool> __is_partitioned(
- _ExecutionPolicy&& __policy, _ForwardIterator&& __first, _ForwardIterator&& __last, _Predicate&& __pred) noexcept {
- return std::__pstl_frontend_dispatch(
- _LIBCPP_PSTL_CUSTOMIZATION_POINT(__pstl_is_partitioned, _RawPolicy),
- [&__policy](_ForwardIterator __g_first, _ForwardIterator __g_last, _Predicate __g_pred) {
- __g_first = std::find_if_not(__policy, __g_first, __g_last, __g_pred);
- if (__g_first == __g_last)
- return true;
- ++__g_first;
- return std::none_of(__policy, __g_first, __g_last, __g_pred);
- },
- std::move(__first),
- std::move(__last),
- std::move(__pred));
+ using _Implementation = __pstl::__dispatch<__pstl::__generate_n, __pstl::__current_configuration, _RawPolicy>;
+ __pstl::__handle_exception<_Implementation>(
+ std::forward<_ExecutionPolicy>(__policy), std::move(__first), std::move(__n), std::move(__gen));
}
template <class _ExecutionPolicy,
@@ -905,10 +355,9 @@ template <class _ExecutionPolicy,
_LIBCPP_NODISCARD _LIBCPP_HIDE_FROM_ABI bool
is_partitioned(_ExecutionPolicy&& __policy, _ForwardIterator __first, _ForwardIterator __last, _Predicate __pred) {
_LIBCPP_REQUIRE_CPP17_FORWARD_ITERATOR(_ForwardIterator, "is_partitioned requires ForwardIterators");
- auto __res = std::__is_partitioned(__policy, std::move(__first), std::move(__last), std::move(__pred));
- if (!__res)
- std::__throw_bad_alloc();
- return *std::move(__res);
+ using _Implementation = __pstl::__dispatch<__pstl::__is_partitioned, __pstl::__current_configuration, _RawPolicy>;
+ return __pstl::__handle_exception<_Implementation>(
+ std::forward<_ExecutionPolicy>(__policy), std::move(__first), std::move(__last), std::move(__pred));
}
template <class _ExecutionPolicy,
@@ -918,32 +367,6 @@ template <class _ExecutionPolicy,
class _Comp,
class _RawPolicy = __remove_cvref_t<_ExecutionPolicy>,
enable_if_t<is_execution_policy_v<_RawPolicy>, int> = 0>
-[[nodiscard]] _LIBCPP_HIDE_FROM_ABI optional<_ForwardOutIterator>
-__merge(_ExecutionPolicy&&,
- _ForwardIterator1&& __first1,
- _ForwardIterator1&& __last1,
- _ForwardIterator2&& __first2,
- _ForwardIterator2&& __last2,
- _ForwardOutIterator&& __result,
- _Comp&& __comp) noexcept {
- using _Backend = typename __select_backend<_RawPolicy>::type;
- return std::__pstl_merge<_RawPolicy>(
- _Backend{},
- std::forward<_ForwardIterator1>(__first1),
- std::forward<_ForwardIterator1>(__last1),
- std::forward<_ForwardIterator2>(__first2),
- std::forward<_ForwardIterator2>(__last2),
- std::forward<_ForwardOutIterator>(__result),
- std::forward<_Comp>(__comp));
-}
-
-template <class _ExecutionPolicy,
- class _ForwardIterator1,
- class _ForwardIterator2,
- class _ForwardOutIterator,
- class _Comp = std::less<>,
- class _RawPolicy = __remove_cvref_t<_ExecutionPolicy>,
- enable_if_t<is_execution_policy_v<_RawPolicy>, int> = 0>
_LIBCPP_HIDE_FROM_ABI _ForwardOutIterator
merge(_ExecutionPolicy&& __policy,
_ForwardIterator1 __first1,
@@ -951,50 +374,48 @@ merge(_ExecutionPolicy&& __policy,
_ForwardIterator2 __first2,
_ForwardIterator2 __last2,
_ForwardOutIterator __result,
- _Comp __comp = {}) {
+ _Comp __comp) {
_LIBCPP_REQUIRE_CPP17_FORWARD_ITERATOR(_ForwardIterator1, "merge requires ForwardIterators");
_LIBCPP_REQUIRE_CPP17_FORWARD_ITERATOR(_ForwardIterator2, "merge requires ForwardIterators");
_LIBCPP_REQUIRE_CPP17_OUTPUT_ITERATOR(_ForwardOutIterator, decltype(*__first1), "merge requires an OutputIterator");
_LIBCPP_REQUIRE_CPP17_OUTPUT_ITERATOR(_ForwardOutIterator, decltype(*__first2), "merge requires an OutputIterator");
- auto __res = std::__merge(
- __policy,
+ using _Implementation = __pstl::__dispatch<__pstl::__merge, __pstl::__current_configuration, _RawPolicy>;
+ return __pstl::__handle_exception<_Implementation>(
+ std::forward<_ExecutionPolicy>(__policy),
std::move(__first1),
std::move(__last1),
std::move(__first2),
std::move(__last2),
std::move(__result),
std::move(__comp));
- if (!__res)
- std::__throw_bad_alloc();
- return *std::move(__res);
}
-// TODO: Use the std::copy/move shenanigans to forward to std::memmove
-// Investigate whether we want to still forward to std::transform(policy)
-// in that case for the execution::par part, or whether we actually want
-// to run everything serially in that case.
-
-template <class>
-void __pstl_move();
-
template <class _ExecutionPolicy,
- class _ForwardIterator,
+ class _ForwardIterator1,
+ class _ForwardIterator2,
class _ForwardOutIterator,
class _RawPolicy = __remove_cvref_t<_ExecutionPolicy>,
enable_if_t<is_execution_policy_v<_RawPolicy>, int> = 0>
-[[nodiscard]] _LIBCPP_HIDE_FROM_ABI optional<_ForwardOutIterator>
-__move(_ExecutionPolicy&& __policy,
- _ForwardIterator&& __first,
- _ForwardIterator&& __last,
- _ForwardOutIterator&& __result) noexcept {
- return std::__pstl_frontend_dispatch(
- _LIBCPP_PSTL_CUSTOMIZATION_POINT(__pstl_move, _RawPolicy),
- [&__policy](_ForwardIterator __g_first, _ForwardIterator __g_last, _ForwardOutIterator __g_result) {
- return std::__transform(__policy, __g_first, __g_last, __g_result, [](auto&& __v) { return std::move(__v); });
- },
- std::move(__first),
- std::move(__last),
- std::move(__result));
+_LIBCPP_HIDE_FROM_ABI _ForwardOutIterator
+merge(_ExecutionPolicy&& __policy,
+ _ForwardIterator1 __first1,
+ _ForwardIterator1 __last1,
+ _ForwardIterator2 __first2,
+ _ForwardIterator2 __last2,
+ _ForwardOutIterator __result) {
+ _LIBCPP_REQUIRE_CPP17_FORWARD_ITERATOR(_ForwardIterator1, "merge requires ForwardIterators");
+ _LIBCPP_REQUIRE_CPP17_FORWARD_ITERATOR(_ForwardIterator2, "merge requires ForwardIterators");
+ _LIBCPP_REQUIRE_CPP17_OUTPUT_ITERATOR(_ForwardOutIterator, decltype(*__first1), "merge requires an OutputIterator");
+ _LIBCPP_REQUIRE_CPP17_OUTPUT_ITERATOR(_ForwardOutIterator, decltype(*__first2), "merge requires an OutputIterator");
+ using _Implementation = __pstl::__dispatch<__pstl::__merge, __pstl::__current_configuration, _RawPolicy>;
+ return __pstl::__handle_exception<_Implementation>(
+ std::forward<_ExecutionPolicy>(__policy),
+ std::move(__first1),
+ std::move(__last1),
+ std::move(__first2),
+ std::move(__last2),
+ std::move(__result),
+ less{});
}
template <class _ExecutionPolicy,
@@ -1008,41 +429,9 @@ move(_ExecutionPolicy&& __policy, _ForwardIterator __first, _ForwardIterator __l
_LIBCPP_REQUIRE_CPP17_FORWARD_ITERATOR(_ForwardOutIterator, "move requires an OutputIterator");
_LIBCPP_REQUIRE_CPP17_OUTPUT_ITERATOR(
_ForwardOutIterator, decltype(std::move(*__first)), "move requires an OutputIterator");
- auto __res = std::__move(__policy, std::move(__first), std::move(__last), std::move(__result));
- if (!__res)
- std::__throw_bad_alloc();
- return *__res;
-}
-
-template <class>
-void __pstl_replace_if();
-
-template <class _ExecutionPolicy,
- class _ForwardIterator,
- class _Pred,
- class _Tp,
- class _RawPolicy = __remove_cvref_t<_ExecutionPolicy>,
- enable_if_t<is_execution_policy_v<_RawPolicy>, int> = 0>
-[[nodiscard]] _LIBCPP_HIDE_FROM_ABI optional<__empty>
-__replace_if(_ExecutionPolicy&& __policy,
- _ForwardIterator&& __first,
- _ForwardIterator&& __last,
- _Pred&& __pred,
- const _Tp& __new_value) noexcept {
- return std::__pstl_frontend_dispatch(
- _LIBCPP_PSTL_CUSTOMIZATION_POINT(__pstl_replace_if, _RawPolicy),
- [&__policy](
- _ForwardIterator&& __g_first, _ForwardIterator&& __g_last, _Pred&& __g_pred, const _Tp& __g_new_value) {
- std::for_each(__policy, __g_first, __g_last, [&](__iter_reference<_ForwardIterator> __element) {
- if (__g_pred(__element))
- __element = __g_new_value;
- });
- return optional<__empty>{__empty{}};
- },
- std::move(__first),
- std::move(__last),
- std::move(__pred),
- __new_value);
+ using _Implementation = __pstl::__dispatch<__pstl::__move, __pstl::__current_configuration, _RawPolicy>;
+ return __pstl::__handle_exception<_Implementation>(
+ std::forward<_ExecutionPolicy>(__policy), std::move(__first), std::move(__last), std::move(__result));
}
template <class _ExecutionPolicy,
@@ -1058,40 +447,9 @@ replace_if(_ExecutionPolicy&& __policy,
_Pred __pred,
const _Tp& __new_value) {
_LIBCPP_REQUIRE_CPP17_FORWARD_ITERATOR(_ForwardIterator, "replace_if requires ForwardIterators");
- auto __res = std::__replace_if(__policy, std::move(__first), std::move(__last), std::move(__pred), __new_value);
- if (!__res)
- std::__throw_bad_alloc();
-}
-
-template <class>
-void __pstl_replace();
-
-template <class _ExecutionPolicy,
- class _ForwardIterator,
- class _Tp,
- class _RawPolicy = __remove_cvref_t<_ExecutionPolicy>,
- enable_if_t<is_execution_policy_v<_RawPolicy>, int> = 0>
-[[nodiscard]] _LIBCPP_HIDE_FROM_ABI optional<__empty>
-__replace(_ExecutionPolicy&& __policy,
- _ForwardIterator&& __first,
- _ForwardIterator&& __last,
- const _Tp& __old_value,
- const _Tp& __new_value) noexcept {
- return std::__pstl_frontend_dispatch(
- _LIBCPP_PSTL_CUSTOMIZATION_POINT(__pstl_replace, _RawPolicy),
- [&__policy](
- _ForwardIterator __g_first, _ForwardIterator __g_last, const _Tp& __g_old_value, const _Tp& __g_new_value) {
- return std::__replace_if(
- __policy,
- std::move(__g_first),
- std::move(__g_last),
- [&](__iter_reference<_ForwardIterator> __element) { return __element == __g_old_value; },
- __g_new_value);
- },
- std::forward<_ForwardIterator>(__first),
- std::forward<_ForwardIterator>(__last),
- __old_value,
- __new_value);
+ using _Implementation = __pstl::__dispatch<__pstl::__replace_if, __pstl::__current_configuration, _RawPolicy>;
+ __pstl::__handle_exception<_Implementation>(
+ std::forward<_ExecutionPolicy>(__policy), std::move(__first), std::move(__last), std::move(__pred), __new_value);
}
template <class _ExecutionPolicy,
@@ -1106,46 +464,9 @@ replace(_ExecutionPolicy&& __policy,
const _Tp& __old_value,
const _Tp& __new_value) {
_LIBCPP_REQUIRE_CPP17_FORWARD_ITERATOR(_ForwardIterator, "replace requires ForwardIterators");
- if (!std::__replace(__policy, std::move(__first), std::move(__last), __old_value, __new_value))
- std::__throw_bad_alloc();
-}
-
-template <class>
-void __pstl_replace_copy_if();
-
-template <class _ExecutionPolicy,
- class _ForwardIterator,
- class _ForwardOutIterator,
- class _Pred,
- class _Tp,
- class _RawPolicy = __remove_cvref_t<_ExecutionPolicy>,
- enable_if_t<is_execution_policy_v<_RawPolicy>, int> = 0>
-[[nodiscard]] _LIBCPP_HIDE_FROM_ABI optional<__empty> __replace_copy_if(
- _ExecutionPolicy&& __policy,
- _ForwardIterator&& __first,
- _ForwardIterator&& __last,
- _ForwardOutIterator&& __result,
- _Pred&& __pred,
- const _Tp& __new_value) noexcept {
- return std::__pstl_frontend_dispatch(
- _LIBCPP_PSTL_CUSTOMIZATION_POINT(__pstl_replace_copy_if, _RawPolicy),
- [&__policy](_ForwardIterator __g_first,
- _ForwardIterator __g_last,
- _ForwardOutIterator __g_result,
- _Pred __g_pred,
- const _Tp& __g_new_value) -> optional<__empty> {
- if (!std::__transform(
- __policy, __g_first, __g_last, __g_result, [&](__iter_reference<_ForwardIterator> __element) {
- return __g_pred(__element) ? __g_new_value : __element;
- }))
- return nullopt;
- return __empty{};
- },
- std::move(__first),
- std::move(__last),
- std::move(__result),
- std::move(__pred),
- __new_value);
+ using _Implementation = __pstl::__dispatch<__pstl::__replace, __pstl::__current_configuration, _RawPolicy>;
+ __pstl::__handle_exception<_Implementation>(
+ std::forward<_ExecutionPolicy>(__policy), std::move(__first), std::move(__last), __old_value, __new_value);
}
template <class _ExecutionPolicy,
@@ -1167,46 +488,13 @@ _LIBCPP_HIDE_FROM_ABI void replace_copy_if(
_LIBCPP_REQUIRE_CPP17_OUTPUT_ITERATOR(
_ForwardOutIterator, decltype(*__first), "replace_copy_if requires an OutputIterator");
_LIBCPP_REQUIRE_CPP17_OUTPUT_ITERATOR(_ForwardOutIterator, const _Tp&, "replace_copy requires an OutputIterator");
- if (!std::__replace_copy_if(
- __policy, std::move(__first), std::move(__last), std::move(__result), std::move(__pred), __new_value))
- std::__throw_bad_alloc();
-}
-
-template <class>
-void __pstl_replace_copy();
-
-template <class _ExecutionPolicy,
- class _ForwardIterator,
- class _ForwardOutIterator,
- class _Tp,
- class _RawPolicy = __remove_cvref_t<_ExecutionPolicy>,
- enable_if_t<is_execution_policy_v<_RawPolicy>, int> = 0>
-[[nodiscard]] _LIBCPP_HIDE_FROM_ABI optional<__empty> __replace_copy(
- _ExecutionPolicy&& __policy,
- _ForwardIterator&& __first,
- _ForwardIterator&& __last,
- _ForwardOutIterator&& __result,
- const _Tp& __old_value,
- const _Tp& __new_value) noexcept {
- return std::__pstl_frontend_dispatch(
- _LIBCPP_PSTL_CUSTOMIZATION_POINT(__pstl_replace_copy, _RawPolicy),
- [&__policy](_ForwardIterator __g_first,
- _ForwardIterator __g_last,
- _ForwardOutIterator __g_result,
- const _Tp& __g_old_value,
- const _Tp& __g_new_value) {
- return std::__replace_copy_if(
- __policy,
- std::move(__g_first),
- std::move(__g_last),
- std::move(__g_result),
- [&](__iter_reference<_ForwardIterator> __element) { return __element == __g_old_value; },
- __g_new_value);
- },
+ using _Implementation = __pstl::__dispatch<__pstl::__replace_copy_if, __pstl::__current_configuration, _RawPolicy>;
+ __pstl::__handle_exception<_Implementation>(
+ std::forward<_ExecutionPolicy>(__policy),
std::move(__first),
std::move(__last),
std::move(__result),
- __old_value,
+ std::move(__pred),
__new_value);
}
@@ -1228,41 +516,14 @@ _LIBCPP_HIDE_FROM_ABI void replace_copy(
_LIBCPP_REQUIRE_CPP17_OUTPUT_ITERATOR(
_ForwardOutIterator, decltype(*__first), "replace_copy requires an OutputIterator");
_LIBCPP_REQUIRE_CPP17_OUTPUT_ITERATOR(_ForwardOutIterator, const _Tp&, "replace_copy requires an OutputIterator");
- if (!std::__replace_copy(
- __policy, std::move(__first), std::move(__last), std::move(__result), __old_value, __new_value))
- std::__throw_bad_alloc();
-}
-
-template <class>
-void __pstl_rotate_copy();
-
-template <class _ExecutionPolicy,
- class _ForwardIterator,
- class _ForwardOutIterator,
- class _RawPolicy = __remove_cvref_t<_ExecutionPolicy>,
- enable_if_t<is_execution_policy_v<_RawPolicy>, int> = 0>
-[[nodiscard]] _LIBCPP_HIDE_FROM_ABI optional<_ForwardOutIterator>
-__rotate_copy(_ExecutionPolicy&& __policy,
- _ForwardIterator&& __first,
- _ForwardIterator&& __middle,
- _ForwardIterator&& __last,
- _ForwardOutIterator&& __result) noexcept {
- return std::__pstl_frontend_dispatch(
- _LIBCPP_PSTL_CUSTOMIZATION_POINT(__pstl_rotate_copy, _RawPolicy),
- [&__policy](_ForwardIterator __g_first,
- _ForwardIterator __g_middle,
- _ForwardIterator __g_last,
- _ForwardOutIterator __g_result) -> optional<_ForwardOutIterator> {
- auto __result_mid =
- std::__copy(__policy, _ForwardIterator(__g_middle), std::move(__g_last), std::move(__g_result));
- if (!__result_mid)
- return nullopt;
- return std::__copy(__policy, std::move(__g_first), std::move(__g_middle), *std::move(__result_mid));
- },
+ using _Implementation = __pstl::__dispatch<__pstl::__replace_copy, __pstl::__current_configuration, _RawPolicy>;
+ __pstl::__handle_exception<_Implementation>(
+ std::forward<_ExecutionPolicy>(__policy),
std::move(__first),
- std::move(__middle),
std::move(__last),
- std::move(__result));
+ std::move(__result),
+ __old_value,
+ __new_value);
}
template <class _ExecutionPolicy,
@@ -1280,81 +541,117 @@ _LIBCPP_HIDE_FROM_ABI _ForwardOutIterator rotate_copy(
_LIBCPP_REQUIRE_CPP17_FORWARD_ITERATOR(_ForwardOutIterator, "rotate_copy requires ForwardIterators");
_LIBCPP_REQUIRE_CPP17_OUTPUT_ITERATOR(
_ForwardOutIterator, decltype(*__first), "rotate_copy requires an OutputIterator");
- auto __res =
- std::__rotate_copy(__policy, std::move(__first), std::move(__middle), std::move(__last), std::move(__result));
- if (!__res)
- std::__throw_bad_alloc();
- return *__res;
+ using _Implementation = __pstl::__dispatch<__pstl::__rotate_copy, __pstl::__current_configuration, _RawPolicy>;
+ return __pstl::__handle_exception<_Implementation>(
+ std::forward<_ExecutionPolicy>(__policy),
+ std::move(__first),
+ std::move(__middle),
+ std::move(__last),
+ std::move(__result));
}
template <class _ExecutionPolicy,
class _RandomAccessIterator,
- class _Comp = less<>,
+ class _Comp,
class _RawPolicy = __remove_cvref_t<_ExecutionPolicy>,
enable_if_t<is_execution_policy_v<_RawPolicy>, int> = 0>
-[[nodiscard]] _LIBCPP_HIDE_FROM_ABI optional<__empty> __stable_sort(
- _ExecutionPolicy&&, _RandomAccessIterator&& __first, _RandomAccessIterator&& __last, _Comp&& __comp = {}) noexcept {
- using _Backend = typename __select_backend<_RawPolicy>::type;
- return std::__pstl_stable_sort<_RawPolicy>(_Backend{}, std::move(__first), std::move(__last), std::move(__comp));
+_LIBCPP_HIDE_FROM_ABI void
+sort(_ExecutionPolicy&& __policy, _RandomAccessIterator __first, _RandomAccessIterator __last, _Comp __comp) {
+ _LIBCPP_REQUIRE_CPP17_RANDOM_ACCESS_ITERATOR(_RandomAccessIterator, "sort requires RandomAccessIterators");
+ using _Implementation = __pstl::__dispatch<__pstl::__sort, __pstl::__current_configuration, _RawPolicy>;
+ __pstl::__handle_exception<_Implementation>(
+ std::forward<_ExecutionPolicy>(__policy), std::move(__first), std::move(__last), std::move(__comp));
}
template <class _ExecutionPolicy,
class _RandomAccessIterator,
- class _Comp = less<>,
class _RawPolicy = __remove_cvref_t<_ExecutionPolicy>,
enable_if_t<is_execution_policy_v<_RawPolicy>, int> = 0>
-_LIBCPP_HIDE_FROM_ABI void stable_sort(
- _ExecutionPolicy&& __policy, _RandomAccessIterator __first, _RandomAccessIterator __last, _Comp __comp = {}) {
- _LIBCPP_REQUIRE_CPP17_RANDOM_ACCESS_ITERATOR(_RandomAccessIterator, "stable_sort requires RandomAccessIterators");
- if (!std::__stable_sort(__policy, std::move(__first), std::move(__last), std::move(__comp)))
- std::__throw_bad_alloc();
+_LIBCPP_HIDE_FROM_ABI void
+sort(_ExecutionPolicy&& __policy, _RandomAccessIterator __first, _RandomAccessIterator __last) {
+ _LIBCPP_REQUIRE_CPP17_RANDOM_ACCESS_ITERATOR(_RandomAccessIterator, "sort requires RandomAccessIterators");
+ using _Implementation = __pstl::__dispatch<__pstl::__sort, __pstl::__current_configuration, _RawPolicy>;
+ __pstl::__handle_exception<_Implementation>(
+ std::forward<_ExecutionPolicy>(__policy), std::move(__first), std::move(__last), less{});
}
-template <class>
-void __pstl_sort();
-
template <class _ExecutionPolicy,
class _RandomAccessIterator,
class _Comp,
class _RawPolicy = __remove_cvref_t<_ExecutionPolicy>,
enable_if_t<is_execution_policy_v<_RawPolicy>, int> = 0>
-[[nodiscard]] _LIBCPP_HIDE_FROM_ABI optional<__empty>
-__sort(_ExecutionPolicy&& __policy,
- _RandomAccessIterator&& __first,
- _RandomAccessIterator&& __last,
- _Comp&& __comp) noexcept {
- return std::__pstl_frontend_dispatch(
- _LIBCPP_PSTL_CUSTOMIZATION_POINT(__pstl_sort, _RawPolicy),
- [&__policy](_RandomAccessIterator __g_first, _RandomAccessIterator __g_last, _Comp __g_comp) {
- std::stable_sort(__policy, std::move(__g_first), std::move(__g_last), std::move(__g_comp));
- return optional<__empty>{__empty{}};
- },
- std::forward<_RandomAccessIterator>(__first),
- std::forward<_RandomAccessIterator>(__last),
- std::forward<_Comp>(__comp));
+_LIBCPP_HIDE_FROM_ABI void
+stable_sort(_ExecutionPolicy&& __policy, _RandomAccessIterator __first, _RandomAccessIterator __last, _Comp __comp) {
+ _LIBCPP_REQUIRE_CPP17_RANDOM_ACCESS_ITERATOR(_RandomAccessIterator, "stable_sort requires RandomAccessIterators");
+ using _Implementation = __pstl::__dispatch<__pstl::__stable_sort, __pstl::__current_configuration, _RawPolicy>;
+ __pstl::__handle_exception<_Implementation>(
+ std::forward<_ExecutionPolicy>(__policy), std::move(__first), std::move(__last), std::move(__comp));
}
template <class _ExecutionPolicy,
class _RandomAccessIterator,
- class _Comp,
class _RawPolicy = __remove_cvref_t<_ExecutionPolicy>,
enable_if_t<is_execution_policy_v<_RawPolicy>, int> = 0>
_LIBCPP_HIDE_FROM_ABI void
-sort(_ExecutionPolicy&& __policy, _RandomAccessIterator __first, _RandomAccessIterator __last, _Comp __comp) {
- _LIBCPP_REQUIRE_CPP17_RANDOM_ACCESS_ITERATOR(_RandomAccessIterator, "sort requires RandomAccessIterators");
- if (!std::__sort(__policy, std::move(__first), std::move(__last), std::move(__comp)))
- std::__throw_bad_alloc();
+stable_sort(_ExecutionPolicy&& __policy, _RandomAccessIterator __first, _RandomAccessIterator __last) {
+ _LIBCPP_REQUIRE_CPP17_RANDOM_ACCESS_ITERATOR(_RandomAccessIterator, "stable_sort requires RandomAccessIterators");
+ using _Implementation = __pstl::__dispatch<__pstl::__stable_sort, __pstl::__current_configuration, _RawPolicy>;
+ __pstl::__handle_exception<_Implementation>(
+ std::forward<_ExecutionPolicy>(__policy), std::move(__first), std::move(__last), less{});
}
template <class _ExecutionPolicy,
- class _RandomAccessIterator,
+ class _ForwardIterator,
+ class _ForwardOutIterator,
+ class _UnaryOperation,
class _RawPolicy = __remove_cvref_t<_ExecutionPolicy>,
enable_if_t<is_execution_policy_v<_RawPolicy>, int> = 0>
-_LIBCPP_HIDE_FROM_ABI void
-sort(_ExecutionPolicy&& __policy, _RandomAccessIterator __first, _RandomAccessIterator __last) {
- _LIBCPP_REQUIRE_CPP17_RANDOM_ACCESS_ITERATOR(_RandomAccessIterator, "sort requires RandomAccessIterators");
- if (!std::__sort(__policy, std::move(__first), std::move(__last), less{}))
- std::__throw_bad_alloc();
+_LIBCPP_HIDE_FROM_ABI _ForwardOutIterator transform(
+ _ExecutionPolicy&& __policy,
+ _ForwardIterator __first,
+ _ForwardIterator __last,
+ _ForwardOutIterator __result,
+ _UnaryOperation __op) {
+ _LIBCPP_REQUIRE_CPP17_FORWARD_ITERATOR(_ForwardIterator, "transform requires ForwardIterators");
+ _LIBCPP_REQUIRE_CPP17_FORWARD_ITERATOR(_ForwardOutIterator, "transform requires an OutputIterator");
+ _LIBCPP_REQUIRE_CPP17_OUTPUT_ITERATOR(
+ _ForwardOutIterator, decltype(__op(*__first)), "transform requires an OutputIterator");
+ using _Implementation = __pstl::__dispatch<__pstl::__transform, __pstl::__current_configuration, _RawPolicy>;
+ return __pstl::__handle_exception<_Implementation>(
+ std::forward<_ExecutionPolicy>(__policy),
+ std::move(__first),
+ std::move(__last),
+ std::move(__result),
+ std::move(__op));
+}
+
+template <class _ExecutionPolicy,
+ class _ForwardIterator1,
+ class _ForwardIterator2,
+ class _ForwardOutIterator,
+ class _BinaryOperation,
+ class _RawPolicy = __remove_cvref_t<_ExecutionPolicy>,
+ enable_if_t<is_execution_policy_v<_RawPolicy>, int> = 0>
+_LIBCPP_HIDE_FROM_ABI _ForwardOutIterator transform(
+ _ExecutionPolicy&& __policy,
+ _ForwardIterator1 __first1,
+ _ForwardIterator1 __last1,
+ _ForwardIterator2 __first2,
+ _ForwardOutIterator __result,
+ _BinaryOperation __op) {
+ _LIBCPP_REQUIRE_CPP17_FORWARD_ITERATOR(_ForwardIterator1, "transform requires ForwardIterators");
+ _LIBCPP_REQUIRE_CPP17_FORWARD_ITERATOR(_ForwardIterator2, "transform requires ForwardIterators");
+ _LIBCPP_REQUIRE_CPP17_FORWARD_ITERATOR(_ForwardOutIterator, "transform requires an OutputIterator");
+ _LIBCPP_REQUIRE_CPP17_OUTPUT_ITERATOR(
+ _ForwardOutIterator, decltype(__op(*__first1, *__first2)), "transform requires an OutputIterator");
+ using _Implementation = __pstl::__dispatch<__pstl::__transform_binary, __pstl::__current_configuration, _RawPolicy>;
+ return __pstl::__handle_exception<_Implementation>(
+ std::forward<_ExecutionPolicy>(__policy),
+ std::move(__first1),
+ std::move(__last1),
+ std::move(__first2),
+ std::move(__result),
+ std::move(__op));
}
_LIBCPP_END_NAMESPACE_STD
diff --git a/libcxx/include/__algorithm/pstl_frontend_dispatch.h b/libcxx/include/__algorithm/pstl_frontend_dispatch.h
deleted file mode 100644
index 6fa110749115..000000000000
--- a/libcxx/include/__algorithm/pstl_frontend_dispatch.h
+++ /dev/null
@@ -1,44 +0,0 @@
-//===----------------------------------------------------------------------===//
-//
-// Part of the LLVM Project, under the Apache 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___ALGORITHM_PSTL_FRONTEND_DISPATCH
-#define _LIBCPP___ALGORITHM_PSTL_FRONTEND_DISPATCH
-
-#include <__config>
-#include <__type_traits/is_callable.h>
-#include <__utility/forward.h>
-
-#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-# pragma GCC system_header
-#endif
-
-#if _LIBCPP_STD_VER >= 17
-
-_LIBCPP_BEGIN_NAMESPACE_STD
-
-# define _LIBCPP_PSTL_CUSTOMIZATION_POINT(name, policy) \
- [](auto&&... __args) -> decltype(std::name<policy>( \
- typename __select_backend<policy>::type{}, std::forward<decltype(__args)>(__args)...)) { \
- return std::name<policy>(typename __select_backend<policy>::type{}, std::forward<decltype(__args)>(__args)...); \
- }
-
-template <class _SpecializedImpl, class _GenericImpl, class... _Args>
-_LIBCPP_HIDE_FROM_ABI decltype(auto)
-__pstl_frontend_dispatch(_SpecializedImpl __specialized_impl, _GenericImpl __generic_impl, _Args&&... __args) {
- if constexpr (__is_callable<_SpecializedImpl, _Args...>::value) {
- return __specialized_impl(std::forward<_Args>(__args)...);
- } else {
- return __generic_impl(std::forward<_Args>(__args)...);
- }
-}
-
-_LIBCPP_END_NAMESPACE_STD
-
-#endif // _LIBCPP_STD_VER >= 17
-
-#endif // _LIBCPP___ALGORITHM_PSTL_FRONTEND_DISPATCH
diff --git a/libcxx/include/__algorithm/simd_utils.h b/libcxx/include/__algorithm/simd_utils.h
index aa4336a2214c..549197be8018 100644
--- a/libcxx/include/__algorithm/simd_utils.h
+++ b/libcxx/include/__algorithm/simd_utils.h
@@ -11,6 +11,7 @@
#include <__algorithm/min.h>
#include <__bit/bit_cast.h>
+#include <__bit/countl.h>
#include <__bit/countr.h>
#include <__config>
#include <__type_traits/is_arithmetic.h>
@@ -126,8 +127,13 @@ _LIBCPP_NODISCARD _LIBCPP_HIDE_FROM_ABI size_t __find_first_set(__simd_vector<_T
// This has MSan disabled du to https://github.com/llvm/llvm-project/issues/85876
auto __impl = [&]<class _MaskT>(_MaskT) _LIBCPP_NO_SANITIZE("memory") noexcept {
+# if defined(_LIBCPP_BIG_ENDIAN)
+ return std::min<size_t>(
+ _Np, std::__countl_zero(__builtin_bit_cast(_MaskT, __builtin_convertvector(__vec, __mask_vec))));
+# else
return std::min<size_t>(
_Np, std::__countr_zero(__builtin_bit_cast(_MaskT, __builtin_convertvector(__vec, __mask_vec))));
+# endif
};
if constexpr (sizeof(__mask_vec) == sizeof(uint8_t)) {
diff --git a/libcxx/include/__atomic/atomic_base.h b/libcxx/include/__atomic/atomic_base.h
index d7a5b99b5469..7e26434c9c3a 100644
--- a/libcxx/include/__atomic/atomic_base.h
+++ b/libcxx/include/__atomic/atomic_base.h
@@ -33,7 +33,7 @@ struct __atomic_base // false
mutable __cxx_atomic_impl<_Tp> __a_;
#if _LIBCPP_STD_VER >= 17
- static _LIBCPP_CONSTEXPR bool is_always_lock_free = __libcpp_is_always_lock_free<__cxx_atomic_impl<_Tp> >::__value;
+ static constexpr bool is_always_lock_free = __libcpp_is_always_lock_free<__cxx_atomic_impl<_Tp> >::__value;
#endif
_LIBCPP_HIDE_FROM_ABI bool is_lock_free() const volatile _NOEXCEPT {
@@ -129,11 +129,6 @@ struct __atomic_base // false
__atomic_base(const __atomic_base&) = delete;
};
-#if _LIBCPP_STD_VER >= 17
-template <class _Tp, bool __b>
-_LIBCPP_CONSTEXPR bool __atomic_base<_Tp, __b>::is_always_lock_free;
-#endif
-
// atomic<Integral>
template <class _Tp>
diff --git a/libcxx/include/__atomic/atomic_init.h b/libcxx/include/__atomic/atomic_init.h
index 8ef5958bfeda..8e86ba31b4ac 100644
--- a/libcxx/include/__atomic/atomic_init.h
+++ b/libcxx/include/__atomic/atomic_init.h
@@ -15,12 +15,10 @@
# pragma GCC system_header
#endif
-#define ATOMIC_FLAG_INIT \
- { false }
-#define ATOMIC_VAR_INIT(__v) \
- { __v }
+#define ATOMIC_FLAG_INIT {false}
+#define ATOMIC_VAR_INIT(__v) {__v}
-#if _LIBCPP_STD_VER >= 20 && !defined(_LIBCPP_DISABLE_DEPRECATION_WARNINGS)
+#if _LIBCPP_STD_VER >= 20 && defined(_LIBCPP_COMPILER_CLANG_BASED) && !defined(_LIBCPP_DISABLE_DEPRECATION_WARNINGS)
# pragma clang deprecated(ATOMIC_VAR_INIT)
#endif
diff --git a/libcxx/include/__atomic/atomic_sync.h b/libcxx/include/__atomic/atomic_sync.h
index 1de5037329f8..aaf81f58731a 100644
--- a/libcxx/include/__atomic/atomic_sync.h
+++ b/libcxx/include/__atomic/atomic_sync.h
@@ -71,19 +71,21 @@ struct __atomic_wait_poll_impl {
#ifndef _LIBCPP_HAS_NO_THREADS
-_LIBCPP_AVAILABILITY_SYNC _LIBCPP_EXPORTED_FROM_ABI void __cxx_atomic_notify_one(void const volatile*);
-_LIBCPP_AVAILABILITY_SYNC _LIBCPP_EXPORTED_FROM_ABI void __cxx_atomic_notify_all(void const volatile*);
-_LIBCPP_AVAILABILITY_SYNC _LIBCPP_EXPORTED_FROM_ABI __cxx_contention_t __libcpp_atomic_monitor(void const volatile*);
-_LIBCPP_AVAILABILITY_SYNC _LIBCPP_EXPORTED_FROM_ABI void __libcpp_atomic_wait(void const volatile*, __cxx_contention_t);
+_LIBCPP_AVAILABILITY_SYNC _LIBCPP_EXPORTED_FROM_ABI void __cxx_atomic_notify_one(void const volatile*) _NOEXCEPT;
+_LIBCPP_AVAILABILITY_SYNC _LIBCPP_EXPORTED_FROM_ABI void __cxx_atomic_notify_all(void const volatile*) _NOEXCEPT;
+_LIBCPP_AVAILABILITY_SYNC _LIBCPP_EXPORTED_FROM_ABI __cxx_contention_t
+__libcpp_atomic_monitor(void const volatile*) _NOEXCEPT;
+_LIBCPP_AVAILABILITY_SYNC _LIBCPP_EXPORTED_FROM_ABI void
+__libcpp_atomic_wait(void const volatile*, __cxx_contention_t) _NOEXCEPT;
_LIBCPP_AVAILABILITY_SYNC _LIBCPP_EXPORTED_FROM_ABI void
-__cxx_atomic_notify_one(__cxx_atomic_contention_t const volatile*);
+__cxx_atomic_notify_one(__cxx_atomic_contention_t const volatile*) _NOEXCEPT;
_LIBCPP_AVAILABILITY_SYNC _LIBCPP_EXPORTED_FROM_ABI void
-__cxx_atomic_notify_all(__cxx_atomic_contention_t const volatile*);
+__cxx_atomic_notify_all(__cxx_atomic_contention_t const volatile*) _NOEXCEPT;
_LIBCPP_AVAILABILITY_SYNC _LIBCPP_EXPORTED_FROM_ABI __cxx_contention_t
-__libcpp_atomic_monitor(__cxx_atomic_contention_t const volatile*);
+__libcpp_atomic_monitor(__cxx_atomic_contention_t const volatile*) _NOEXCEPT;
_LIBCPP_AVAILABILITY_SYNC _LIBCPP_EXPORTED_FROM_ABI void
-__libcpp_atomic_wait(__cxx_atomic_contention_t const volatile*, __cxx_contention_t);
+__libcpp_atomic_wait(__cxx_atomic_contention_t const volatile*, __cxx_contention_t) _NOEXCEPT;
template <class _AtomicWaitable, class _Poll>
struct __atomic_wait_backoff_impl {
diff --git a/libcxx/include/__atomic/memory_order.h b/libcxx/include/__atomic/memory_order.h
index 16fd1867698f..294121d1c4e7 100644
--- a/libcxx/include/__atomic/memory_order.h
+++ b/libcxx/include/__atomic/memory_order.h
@@ -37,7 +37,7 @@ enum class memory_order : __memory_order_underlying_t {
seq_cst = __mo_seq_cst
};
-static_assert((is_same<underlying_type<memory_order>::type, __memory_order_underlying_t>::value),
+static_assert(is_same<underlying_type<memory_order>::type, __memory_order_underlying_t>::value,
"unexpected underlying type for std::memory_order");
inline constexpr auto memory_order_relaxed = memory_order::relaxed;
diff --git a/libcxx/include/__bit_reference b/libcxx/include/__bit_reference
index 9579b9eaf70b..606069d98be7 100644
--- a/libcxx/include/__bit_reference
+++ b/libcxx/include/__bit_reference
@@ -95,8 +95,8 @@ public:
}
private:
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 explicit __bit_reference(
- __storage_pointer __s, __storage_type __m) _NOEXCEPT
+ _LIBCPP_HIDE_FROM_ABI
+ _LIBCPP_CONSTEXPR_SINCE_CXX20 explicit __bit_reference(__storage_pointer __s, __storage_type __m) _NOEXCEPT
: __seg_(__s),
__mask_(__m) {}
};
@@ -149,6 +149,7 @@ public:
using __container = typename _Cp::__self;
_LIBCPP_HIDE_FROM_ABI __bit_const_reference(const __bit_const_reference&) = default;
+ __bit_const_reference& operator=(const __bit_const_reference&) = delete;
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 __bit_const_reference(const __bit_reference<_Cp>& __x) _NOEXCEPT
: __seg_(__x.__seg_),
@@ -163,12 +164,10 @@ public:
}
private:
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR explicit __bit_const_reference(
- __storage_pointer __s, __storage_type __m) _NOEXCEPT
+ _LIBCPP_HIDE_FROM_ABI
+ _LIBCPP_CONSTEXPR explicit __bit_const_reference(__storage_pointer __s, __storage_type __m) _NOEXCEPT
: __seg_(__s),
__mask_(__m) {}
-
- __bit_const_reference& operator=(const __bit_const_reference&) = delete;
};
// copy
@@ -940,8 +939,8 @@ public:
}
private:
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 explicit __bit_iterator(
- __storage_pointer __s, unsigned __ctz) _NOEXCEPT
+ _LIBCPP_HIDE_FROM_ABI
+ _LIBCPP_CONSTEXPR_SINCE_CXX20 explicit __bit_iterator(__storage_pointer __s, unsigned __ctz) _NOEXCEPT
: __seg_(__s),
__ctz_(__ctz) {}
@@ -1000,8 +999,8 @@ private:
_LIBCPP_CONSTEXPR_SINCE_CXX20 friend __bit_iterator<_Dp, _IC>
__find_bool(__bit_iterator<_Dp, _IC>, typename _Dp::size_type);
template <bool _ToCount, class _Dp, bool _IC>
- friend typename __bit_iterator<_Dp, _IC>::difference_type _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
- __count_bool(__bit_iterator<_Dp, _IC>, typename _Dp::size_type);
+ friend typename __bit_iterator<_Dp, _IC>::difference_type _LIBCPP_HIDE_FROM_ABI
+ _LIBCPP_CONSTEXPR_SINCE_CXX20 __count_bool(__bit_iterator<_Dp, _IC>, typename _Dp::size_type);
};
_LIBCPP_END_NAMESPACE_STD
diff --git a/libcxx/include/__charconv/chars_format.h b/libcxx/include/__charconv/chars_format.h
index 95faa29010dd..c76cebd5d184 100644
--- a/libcxx/include/__charconv/chars_format.h
+++ b/libcxx/include/__charconv/chars_format.h
@@ -39,20 +39,17 @@ inline _LIBCPP_HIDE_FROM_ABI constexpr chars_format operator^(chars_format __x,
return chars_format(std::__to_underlying(__x) ^ std::__to_underlying(__y));
}
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 chars_format&
-operator&=(chars_format& __x, chars_format __y) {
+inline _LIBCPP_HIDE_FROM_ABI constexpr chars_format& operator&=(chars_format& __x, chars_format __y) {
__x = __x & __y;
return __x;
}
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 chars_format&
-operator|=(chars_format& __x, chars_format __y) {
+inline _LIBCPP_HIDE_FROM_ABI constexpr chars_format& operator|=(chars_format& __x, chars_format __y) {
__x = __x | __y;
return __x;
}
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 chars_format&
-operator^=(chars_format& __x, chars_format __y) {
+inline _LIBCPP_HIDE_FROM_ABI constexpr chars_format& operator^=(chars_format& __x, chars_format __y) {
__x = __x ^ __y;
return __x;
}
diff --git a/libcxx/include/__chrono/duration.h b/libcxx/include/__chrono/duration.h
index 1e81420244b1..1e36d7342836 100644
--- a/libcxx/include/__chrono/duration.h
+++ b/libcxx/include/__chrono/duration.h
@@ -391,8 +391,8 @@ operator<=>(const duration<_Rep1, _Period1>& __lhs, const duration<_Rep2, _Perio
template <class _Rep1, class _Period1, class _Rep2, class _Period2>
inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR
- typename common_type<duration<_Rep1, _Period1>, duration<_Rep2, _Period2> >::type
- operator+(const duration<_Rep1, _Period1>& __lhs, const duration<_Rep2, _Period2>& __rhs) {
+typename common_type<duration<_Rep1, _Period1>, duration<_Rep2, _Period2> >::type
+operator+(const duration<_Rep1, _Period1>& __lhs, const duration<_Rep2, _Period2>& __rhs) {
typedef typename common_type<duration<_Rep1, _Period1>, duration<_Rep2, _Period2> >::type _Cd;
return _Cd(_Cd(__lhs).count() + _Cd(__rhs).count());
}
@@ -401,8 +401,8 @@ inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR
template <class _Rep1, class _Period1, class _Rep2, class _Period2>
inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR
- typename common_type<duration<_Rep1, _Period1>, duration<_Rep2, _Period2> >::type
- operator-(const duration<_Rep1, _Period1>& __lhs, const duration<_Rep2, _Period2>& __rhs) {
+typename common_type<duration<_Rep1, _Period1>, duration<_Rep2, _Period2> >::type
+operator-(const duration<_Rep1, _Period1>& __lhs, const duration<_Rep2, _Period2>& __rhs) {
typedef typename common_type<duration<_Rep1, _Period1>, duration<_Rep2, _Period2> >::type _Cd;
return _Cd(_Cd(__lhs).count() - _Cd(__rhs).count());
}
@@ -468,8 +468,8 @@ operator%(const duration<_Rep1, _Period>& __d, const _Rep2& __s) {
template <class _Rep1, class _Period1, class _Rep2, class _Period2>
inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR
- typename common_type<duration<_Rep1, _Period1>, duration<_Rep2, _Period2> >::type
- operator%(const duration<_Rep1, _Period1>& __lhs, const duration<_Rep2, _Period2>& __rhs) {
+typename common_type<duration<_Rep1, _Period1>, duration<_Rep2, _Period2> >::type
+operator%(const duration<_Rep1, _Period1>& __lhs, const duration<_Rep2, _Period2>& __rhs) {
typedef typename common_type<_Rep1, _Rep2>::type _Cr;
typedef typename common_type<duration<_Rep1, _Period1>, duration<_Rep2, _Period2> >::type _Cd;
return _Cd(static_cast<_Cr>(_Cd(__lhs).count()) % static_cast<_Cr>(_Cd(__rhs).count()));
diff --git a/libcxx/include/__chrono/exception.h b/libcxx/include/__chrono/exception.h
new file mode 100644
index 000000000000..266f8fac4417
--- /dev/null
+++ b/libcxx/include/__chrono/exception.h
@@ -0,0 +1,135 @@
+// -*- 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
+//
+//===----------------------------------------------------------------------===//
+
+// For information see https://libcxx.llvm.org/DesignDocs/TimeZone.html
+
+#ifndef _LIBCPP___CHRONO_EXCEPTION_H
+#define _LIBCPP___CHRONO_EXCEPTION_H
+
+#include <version>
+// Enable the contents of the header only when libc++ was built with experimental features enabled.
+#if !defined(_LIBCPP_HAS_NO_EXPERIMENTAL_TZDB)
+
+# include <__chrono/calendar.h>
+# include <__chrono/local_info.h>
+# include <__chrono/time_point.h>
+# include <__config>
+# include <__configuration/availability.h>
+# include <__verbose_abort>
+# include <format>
+# include <stdexcept>
+# include <string>
+
+# if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
+# pragma GCC system_header
+# endif
+
+_LIBCPP_BEGIN_NAMESPACE_STD
+
+# if _LIBCPP_STD_VER >= 20
+
+namespace chrono {
+
+class nonexistent_local_time : public runtime_error {
+public:
+ template <class _Duration>
+ _LIBCPP_HIDE_FROM_ABI nonexistent_local_time(const local_time<_Duration>& __time, const local_info& __info)
+ : runtime_error{__create_message(__time, __info)} {
+ // [time.zone.exception.nonexist]/2
+ // Preconditions: i.result == local_info::nonexistent is true.
+ // The value of __info.result is not used.
+ _LIBCPP_ASSERT_PEDANTIC(__info.result == local_info::nonexistent,
+ "creating an nonexistent_local_time from a local_info that is not non-existent");
+ }
+
+ _LIBCPP_HIDE_FROM_ABI nonexistent_local_time(const nonexistent_local_time&) = default;
+ _LIBCPP_HIDE_FROM_ABI nonexistent_local_time& operator=(const nonexistent_local_time&) = default;
+
+ _LIBCPP_AVAILABILITY_TZDB _LIBCPP_EXPORTED_FROM_ABI ~nonexistent_local_time() override; // exported as key function
+
+private:
+ template <class _Duration>
+ _LIBCPP_HIDE_FROM_ABI string __create_message(const local_time<_Duration>& __time, const local_info& __info) {
+ return std::format(
+ R"({} is in a gap between
+{} {} and
+{} {} which are both equivalent to
+{} UTC)",
+ __time,
+ local_seconds{__info.first.end.time_since_epoch()} + __info.first.offset,
+ __info.first.abbrev,
+ local_seconds{__info.second.begin.time_since_epoch()} + __info.second.offset,
+ __info.second.abbrev,
+ __info.first.end);
+ }
+};
+
+template <class _Duration>
+_LIBCPP_NORETURN _LIBCPP_AVAILABILITY_TZDB _LIBCPP_HIDE_FROM_ABI void __throw_nonexistent_local_time(
+ [[maybe_unused]] const local_time<_Duration>& __time, [[maybe_unused]] const local_info& __info) {
+# ifndef _LIBCPP_HAS_NO_EXCEPTIONS
+ throw nonexistent_local_time(__time, __info);
+# else
+ _LIBCPP_VERBOSE_ABORT("nonexistent_local_time was thrown in -fno-exceptions mode");
+# endif
+}
+
+class ambiguous_local_time : public runtime_error {
+public:
+ template <class _Duration>
+ _LIBCPP_HIDE_FROM_ABI ambiguous_local_time(const local_time<_Duration>& __time, const local_info& __info)
+ : runtime_error{__create_message(__time, __info)} {
+ // [time.zone.exception.ambig]/2
+ // Preconditions: i.result == local_info::ambiguous is true.
+ // The value of __info.result is not used.
+ _LIBCPP_ASSERT_PEDANTIC(__info.result == local_info::ambiguous,
+ "creating an ambiguous_local_time from a local_info that is not ambiguous");
+ }
+
+ _LIBCPP_HIDE_FROM_ABI ambiguous_local_time(const ambiguous_local_time&) = default;
+ _LIBCPP_HIDE_FROM_ABI ambiguous_local_time& operator=(const ambiguous_local_time&) = default;
+
+ _LIBCPP_AVAILABILITY_TZDB _LIBCPP_EXPORTED_FROM_ABI ~ambiguous_local_time() override; // exported as key function
+
+private:
+ template <class _Duration>
+ _LIBCPP_HIDE_FROM_ABI string __create_message(const local_time<_Duration>& __time, const local_info& __info) {
+ return std::format(
+ // There are two spaces after the full-stop; this has been verified
+ // in the sources of the Standard.
+ R"({0} is ambiguous. It could be
+{0} {1} == {2} UTC or
+{0} {3} == {4} UTC)",
+ __time,
+ __info.first.abbrev,
+ __time - __info.first.offset,
+ __info.second.abbrev,
+ __time - __info.second.offset);
+ }
+};
+
+template <class _Duration>
+_LIBCPP_NORETURN _LIBCPP_AVAILABILITY_TZDB _LIBCPP_HIDE_FROM_ABI void __throw_ambiguous_local_time(
+ [[maybe_unused]] const local_time<_Duration>& __time, [[maybe_unused]] const local_info& __info) {
+# ifndef _LIBCPP_HAS_NO_EXCEPTIONS
+ throw ambiguous_local_time(__time, __info);
+# else
+ _LIBCPP_VERBOSE_ABORT("ambiguous_local_time was thrown in -fno-exceptions mode");
+# endif
+}
+
+} // namespace chrono
+
+# endif // _LIBCPP_STD_VER >= 20
+
+_LIBCPP_END_NAMESPACE_STD
+
+#endif // !defined(_LIBCPP_HAS_NO_EXPERIMENTAL_TZDB)
+
+#endif // _LIBCPP___CHRONO_EXCEPTION_H
diff --git a/libcxx/include/__chrono/ostream.h b/libcxx/include/__chrono/ostream.h
index ecf07a320c8b..bb0341bc3ec6 100644
--- a/libcxx/include/__chrono/ostream.h
+++ b/libcxx/include/__chrono/ostream.h
@@ -30,7 +30,7 @@
#include <__concepts/same_as.h>
#include <__config>
#include <__format/format_functions.h>
-#include <ostream>
+#include <__fwd/ostream.h>
#include <ratio>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
diff --git a/libcxx/include/__chrono/time_point.h b/libcxx/include/__chrono/time_point.h
index e65253ddb98e..aaf0b098f280 100644
--- a/libcxx/include/__chrono/time_point.h
+++ b/libcxx/include/__chrono/time_point.h
@@ -78,7 +78,7 @@ public:
template <class _Clock, class _Duration1, class _Duration2>
struct _LIBCPP_TEMPLATE_VIS
- common_type<chrono::time_point<_Clock, _Duration1>, chrono::time_point<_Clock, _Duration2> > {
+common_type<chrono::time_point<_Clock, _Duration1>, chrono::time_point<_Clock, _Duration2> > {
typedef chrono::time_point<_Clock, typename common_type<_Duration1, _Duration2>::type> type;
};
@@ -92,25 +92,22 @@ time_point_cast(const time_point<_Clock, _Duration>& __t) {
#if _LIBCPP_STD_VER >= 17
template <class _ToDuration, class _Clock, class _Duration, enable_if_t<__is_duration<_ToDuration>::value, int> = 0>
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR time_point<_Clock, _ToDuration>
-floor(const time_point<_Clock, _Duration>& __t) {
+inline _LIBCPP_HIDE_FROM_ABI constexpr time_point<_Clock, _ToDuration> floor(const time_point<_Clock, _Duration>& __t) {
return time_point<_Clock, _ToDuration>{chrono::floor<_ToDuration>(__t.time_since_epoch())};
}
template <class _ToDuration, class _Clock, class _Duration, enable_if_t<__is_duration<_ToDuration>::value, int> = 0>
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR time_point<_Clock, _ToDuration>
-ceil(const time_point<_Clock, _Duration>& __t) {
+inline _LIBCPP_HIDE_FROM_ABI constexpr time_point<_Clock, _ToDuration> ceil(const time_point<_Clock, _Duration>& __t) {
return time_point<_Clock, _ToDuration>{chrono::ceil<_ToDuration>(__t.time_since_epoch())};
}
template <class _ToDuration, class _Clock, class _Duration, enable_if_t<__is_duration<_ToDuration>::value, int> = 0>
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR time_point<_Clock, _ToDuration>
-round(const time_point<_Clock, _Duration>& __t) {
+inline _LIBCPP_HIDE_FROM_ABI constexpr time_point<_Clock, _ToDuration> round(const time_point<_Clock, _Duration>& __t) {
return time_point<_Clock, _ToDuration>{chrono::round<_ToDuration>(__t.time_since_epoch())};
}
template <class _Rep, class _Period, enable_if_t<numeric_limits<_Rep>::is_signed, int> = 0>
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR duration<_Rep, _Period> abs(duration<_Rep, _Period> __d) {
+inline _LIBCPP_HIDE_FROM_ABI constexpr duration<_Rep, _Period> abs(duration<_Rep, _Period> __d) {
return __d >= __d.zero() ? +__d : -__d;
}
#endif // _LIBCPP_STD_VER >= 17
@@ -180,9 +177,9 @@ operator<=>(const time_point<_Clock, _Duration1>& __lhs, const time_point<_Clock
// time_point operator+(time_point x, duration y);
template <class _Clock, class _Duration1, class _Rep2, class _Period2>
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14
- time_point<_Clock, typename common_type<_Duration1, duration<_Rep2, _Period2> >::type>
- operator+(const time_point<_Clock, _Duration1>& __lhs, const duration<_Rep2, _Period2>& __rhs) {
+inline _LIBCPP_HIDE_FROM_ABI
+_LIBCPP_CONSTEXPR_SINCE_CXX14 time_point<_Clock, typename common_type<_Duration1, duration<_Rep2, _Period2> >::type>
+operator+(const time_point<_Clock, _Duration1>& __lhs, const duration<_Rep2, _Period2>& __rhs) {
typedef time_point<_Clock, typename common_type<_Duration1, duration<_Rep2, _Period2> >::type> _Tr;
return _Tr(__lhs.time_since_epoch() + __rhs);
}
@@ -190,18 +187,18 @@ inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14
// time_point operator+(duration x, time_point y);
template <class _Rep1, class _Period1, class _Clock, class _Duration2>
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14
- time_point<_Clock, typename common_type<duration<_Rep1, _Period1>, _Duration2>::type>
- operator+(const duration<_Rep1, _Period1>& __lhs, const time_point<_Clock, _Duration2>& __rhs) {
+inline _LIBCPP_HIDE_FROM_ABI
+_LIBCPP_CONSTEXPR_SINCE_CXX14 time_point<_Clock, typename common_type<duration<_Rep1, _Period1>, _Duration2>::type>
+operator+(const duration<_Rep1, _Period1>& __lhs, const time_point<_Clock, _Duration2>& __rhs) {
return __rhs + __lhs;
}
// time_point operator-(time_point x, duration y);
template <class _Clock, class _Duration1, class _Rep2, class _Period2>
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14
- time_point<_Clock, typename common_type<_Duration1, duration<_Rep2, _Period2> >::type>
- operator-(const time_point<_Clock, _Duration1>& __lhs, const duration<_Rep2, _Period2>& __rhs) {
+inline _LIBCPP_HIDE_FROM_ABI
+_LIBCPP_CONSTEXPR_SINCE_CXX14 time_point<_Clock, typename common_type<_Duration1, duration<_Rep2, _Period2> >::type>
+operator-(const time_point<_Clock, _Duration1>& __lhs, const duration<_Rep2, _Period2>& __rhs) {
typedef time_point<_Clock, typename common_type<_Duration1, duration<_Rep2, _Period2> >::type> _Ret;
return _Ret(__lhs.time_since_epoch() - __rhs);
}
diff --git a/libcxx/include/__chrono/time_zone.h b/libcxx/include/__chrono/time_zone.h
index e28c9189c381..de11dac1eef0 100644
--- a/libcxx/include/__chrono/time_zone.h
+++ b/libcxx/include/__chrono/time_zone.h
@@ -18,12 +18,14 @@
# include <__chrono/calendar.h>
# include <__chrono/duration.h>
+# include <__chrono/exception.h>
# include <__chrono/local_info.h>
# include <__chrono/sys_info.h>
# include <__chrono/system_clock.h>
# include <__compare/strong_order.h>
# include <__config>
# include <__memory/unique_ptr.h>
+# include <__type_traits/common_type.h>
# include <string_view>
# if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
@@ -40,6 +42,8 @@ _LIBCPP_BEGIN_NAMESPACE_STD
namespace chrono {
+enum class choose { earliest, latest };
+
class _LIBCPP_AVAILABILITY_TZDB time_zone {
_LIBCPP_HIDE_FROM_ABI time_zone() = default;
@@ -70,6 +74,79 @@ public:
return __get_info(chrono::time_point_cast<seconds>(__time));
}
+ // We don't apply nodiscard here since this function throws on many inputs,
+ // so it could be used as a validation.
+ template <class _Duration>
+ _LIBCPP_HIDE_FROM_ABI sys_time<common_type_t<_Duration, seconds>> to_sys(const local_time<_Duration>& __time) const {
+ local_info __info = get_info(__time);
+ switch (__info.result) {
+ case local_info::unique:
+ return sys_time<common_type_t<_Duration, seconds>>{__time.time_since_epoch() - __info.first.offset};
+
+ case local_info::nonexistent:
+ chrono::__throw_nonexistent_local_time(__time, __info);
+
+ case local_info::ambiguous:
+ chrono::__throw_ambiguous_local_time(__time, __info);
+ }
+
+ // TODO TZDB The Standard does not specify anything in these cases.
+ _LIBCPP_ASSERT_ARGUMENT_WITHIN_DOMAIN(
+ __info.result != -1, "cannot convert the local time; it would be before the minimum system clock value");
+ _LIBCPP_ASSERT_ARGUMENT_WITHIN_DOMAIN(
+ __info.result != -2, "cannot convert the local time; it would be after the maximum system clock value");
+
+ return {};
+ }
+
+ template <class _Duration>
+ [[nodiscard]] _LIBCPP_HIDE_FROM_ABI sys_time<common_type_t<_Duration, seconds>>
+ to_sys(const local_time<_Duration>& __time, choose __z) const {
+ local_info __info = get_info(__time);
+ switch (__info.result) {
+ case local_info::unique:
+ case local_info::nonexistent: // first and second are the same
+ return sys_time<common_type_t<_Duration, seconds>>{__time.time_since_epoch() - __info.first.offset};
+
+ case local_info::ambiguous:
+ switch (__z) {
+ case choose::earliest:
+ return sys_time<common_type_t<_Duration, seconds>>{__time.time_since_epoch() - __info.first.offset};
+
+ case choose::latest:
+ return sys_time<common_type_t<_Duration, seconds>>{__time.time_since_epoch() - __info.second.offset};
+
+ // Note a value out of bounds is not specified.
+ }
+ }
+
+ // TODO TZDB The standard does not specify anything in these cases.
+ _LIBCPP_ASSERT_ARGUMENT_WITHIN_DOMAIN(
+ __info.result != -1, "cannot convert the local time; it would be before the minimum system clock value");
+ _LIBCPP_ASSERT_ARGUMENT_WITHIN_DOMAIN(
+ __info.result != -2, "cannot convert the local time; it would be after the maximum system clock value");
+
+ return {};
+ }
+
+ template <class _Duration>
+ [[nodiscard]] _LIBCPP_HIDE_FROM_ABI local_time<common_type_t<_Duration, seconds>>
+ to_local(const sys_time<_Duration>& __time) const {
+ using _Dp = common_type_t<_Duration, seconds>;
+
+ sys_info __info = get_info(__time);
+
+ _LIBCPP_ASSERT_ARGUMENT_WITHIN_DOMAIN(
+ __info.offset >= chrono::seconds{0} || __time.time_since_epoch() >= _Dp::min() - __info.offset,
+ "cannot convert the system time; it would be before the minimum local clock value");
+
+ _LIBCPP_ASSERT_ARGUMENT_WITHIN_DOMAIN(
+ __info.offset <= chrono::seconds{0} || __time.time_since_epoch() <= _Dp::max() - __info.offset,
+ "cannot convert the system time; it would be after the maximum local clock value");
+
+ return local_time<_Dp>{__time.time_since_epoch() + __info.offset};
+ }
+
[[nodiscard]] _LIBCPP_HIDE_FROM_ABI const __impl& __implementation() const noexcept { return *__impl_; }
private:
diff --git a/libcxx/include/__chrono/zoned_time.h b/libcxx/include/__chrono/zoned_time.h
new file mode 100644
index 000000000000..c6084426ad72
--- /dev/null
+++ b/libcxx/include/__chrono/zoned_time.h
@@ -0,0 +1,55 @@
+// -*- 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
+//
+//===----------------------------------------------------------------------===//
+
+// For information see https://libcxx.llvm.org/DesignDocs/TimeZone.html
+
+#ifndef _LIBCPP___CHRONO_ZONED_TIME_H
+#define _LIBCPP___CHRONO_ZONED_TIME_H
+
+#include <version>
+// Enable the contents of the header only when libc++ was built with experimental features enabled.
+#if !defined(_LIBCPP_HAS_NO_EXPERIMENTAL_TZDB)
+
+# include <__chrono/time_zone.h>
+# include <__chrono/tzdb_list.h>
+# include <__config>
+# include <__fwd/string_view.h>
+
+# if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
+# pragma GCC system_header
+# endif
+
+_LIBCPP_BEGIN_NAMESPACE_STD
+
+# if _LIBCPP_STD_VER >= 20 && !defined(_LIBCPP_HAS_NO_TIME_ZONE_DATABASE) && !defined(_LIBCPP_HAS_NO_FILESYSTEM) && \
+ !defined(_LIBCPP_HAS_NO_LOCALIZATION)
+
+namespace chrono {
+
+template <class>
+struct zoned_traits {};
+
+template <>
+struct zoned_traits<const time_zone*> {
+ [[nodiscard]] _LIBCPP_HIDE_FROM_ABI static const time_zone* default_zone() { return chrono::locate_zone("UTC"); }
+ [[nodiscard]] _LIBCPP_HIDE_FROM_ABI static const time_zone* locate_zone(string_view __name) {
+ return chrono::locate_zone(__name);
+ }
+};
+
+} // namespace chrono
+
+# endif // _LIBCPP_STD_VER >= 20 && !defined(_LIBCPP_HAS_NO_TIME_ZONE_DATABASE) && !defined(_LIBCPP_HAS_NO_FILESYSTEM)
+ // && !defined(_LIBCPP_HAS_NO_LOCALIZATION)
+
+_LIBCPP_END_NAMESPACE_STD
+
+#endif // !defined(_LIBCPP_HAS_NO_EXPERIMENTAL_TZDB)
+
+#endif // _LIBCPP___CHRONO_ZONED_TIME_H
diff --git a/libcxx/include/__config b/libcxx/include/__config
index aac8c70c74a3..dfb14fd6a380 100644
--- a/libcxx/include/__config
+++ b/libcxx/include/__config
@@ -566,7 +566,7 @@ typedef __char32_t char32_t;
# ifndef _LIBCPP_NO_ABI_TAG
# define _LIBCPP_HIDE_FROM_ABI \
_LIBCPP_HIDDEN _LIBCPP_EXCLUDE_FROM_EXPLICIT_INSTANTIATION \
- __attribute__((__abi_tag__(_LIBCPP_TOSTRING(_LIBCPP_ODR_SIGNATURE))))
+ __attribute__((__abi_tag__(_LIBCPP_TOSTRING(_LIBCPP_ODR_SIGNATURE))))
# else
# define _LIBCPP_HIDE_FROM_ABI _LIBCPP_HIDDEN _LIBCPP_EXCLUDE_FROM_EXPLICIT_INSTANTIATION
# endif
@@ -583,11 +583,11 @@ typedef __char32_t char32_t;
# endif
// TODO: Remove this workaround once we drop support for Clang 16
-#if __has_warning("-Wc++23-extensions")
-# define _LIBCPP_CLANG_DIAGNOSTIC_IGNORED_CXX23_EXTENSION _LIBCPP_CLANG_DIAGNOSTIC_IGNORED("-Wc++23-extensions")
-#else
-# define _LIBCPP_CLANG_DIAGNOSTIC_IGNORED_CXX23_EXTENSION _LIBCPP_CLANG_DIAGNOSTIC_IGNORED("-Wc++2b-extensions")
-#endif
+# if __has_warning("-Wc++23-extensions")
+# define _LIBCPP_CLANG_DIAGNOSTIC_IGNORED_CXX23_EXTENSION _LIBCPP_CLANG_DIAGNOSTIC_IGNORED("-Wc++23-extensions")
+# else
+# define _LIBCPP_CLANG_DIAGNOSTIC_IGNORED_CXX23_EXTENSION _LIBCPP_CLANG_DIAGNOSTIC_IGNORED("-Wc++2b-extensions")
+# endif
// Clang modules take a significant compile time hit when pushing and popping diagnostics.
// Since all the headers are marked as system headers in the modulemap, we can simply disable this
diff --git a/libcxx/include/__config_site.in b/libcxx/include/__config_site.in
index 89a14609ee3f..67022146c908 100644
--- a/libcxx/include/__config_site.in
+++ b/libcxx/include/__config_site.in
@@ -26,6 +26,7 @@
#cmakedefine _LIBCPP_HAS_NO_FILESYSTEM
#cmakedefine _LIBCPP_HAS_NO_RANDOM_DEVICE
#cmakedefine _LIBCPP_HAS_NO_LOCALIZATION
+#cmakedefine _LIBCPP_HAS_NO_UNICODE
#cmakedefine _LIBCPP_HAS_NO_WIDE_CHARACTERS
#cmakedefine _LIBCPP_HAS_NO_STD_MODULES
#cmakedefine _LIBCPP_HAS_NO_TIME_ZONE_DATABASE
diff --git a/libcxx/include/__configuration/abi.h b/libcxx/include/__configuration/abi.h
index 73375fa47d07..513da6e3b81b 100644
--- a/libcxx/include/__configuration/abi.h
+++ b/libcxx/include/__configuration/abi.h
@@ -90,7 +90,7 @@
# define _LIBCPP_ABI_USE_WRAP_ITER_IN_STD_ARRAY
# define _LIBCPP_ABI_USE_WRAP_ITER_IN_STD_STRING_VIEW
// Dont' add an inline namespace for `std::filesystem`
-# define _LIBCPP_ABI_NO_FILESYSTEM_INLINE_NAMESPACE
+# define _LIBCPP_ABI_NO_FILESYSTEM_INLINE_NAMESPACE
#elif _LIBCPP_ABI_VERSION == 1
# if !(defined(_LIBCPP_OBJECT_FORMAT_COFF) || defined(_LIBCPP_OBJECT_FORMAT_XCOFF))
// Enable compiling copies of now inline methods into the dylib to support
diff --git a/libcxx/include/__configuration/availability.h b/libcxx/include/__configuration/availability.h
index 1115431115ec..7e6e18b22d93 100644
--- a/libcxx/include/__configuration/availability.h
+++ b/libcxx/include/__configuration/availability.h
@@ -95,8 +95,8 @@
# define _LIBCPP_INTRODUCED_IN_LLVM_9_ATTRIBUTE_PUSH /* nothing */
# define _LIBCPP_INTRODUCED_IN_LLVM_9_ATTRIBUTE_POP /* nothing */
-# define _LIBCPP_INTRODUCED_IN_LLVM_10 1
-# define _LIBCPP_INTRODUCED_IN_LLVM_10_ATTRIBUTE /* nothing */
+# define _LIBCPP_INTRODUCED_IN_LLVM_11 1
+# define _LIBCPP_INTRODUCED_IN_LLVM_11_ATTRIBUTE /* nothing */
# define _LIBCPP_INTRODUCED_IN_LLVM_12 1
# define _LIBCPP_INTRODUCED_IN_LLVM_12_ATTRIBUTE /* nothing */
@@ -159,22 +159,22 @@
# define _LIBCPP_INTRODUCED_IN_LLVM_9_ATTRIBUTE_POP /* nothing */
# endif
-// LLVM 10
+// LLVM 11
// clang-format off
# if (defined(__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ < 110000) || \
(defined(__ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__ < 140000) || \
(defined(__ENVIRONMENT_TV_OS_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_TV_OS_VERSION_MIN_REQUIRED__ < 140000) || \
(defined(__ENVIRONMENT_WATCH_OS_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_WATCH_OS_VERSION_MIN_REQUIRED__ < 70000)
// clang-format on
-# define _LIBCPP_INTRODUCED_IN_LLVM_10 0
-# define _LIBCPP_INTRODUCED_IN_LLVM_10_ATTRIBUTE \
+# define _LIBCPP_INTRODUCED_IN_LLVM_11 0
+# define _LIBCPP_INTRODUCED_IN_LLVM_11_ATTRIBUTE \
__attribute__((availability(macos, strict, introduced = 11.0))) \
__attribute__((availability(ios, strict, introduced = 14.0))) \
__attribute__((availability(tvos, strict, introduced = 14.0))) \
__attribute__((availability(watchos, strict, introduced = 7.0)))
# else
-# define _LIBCPP_INTRODUCED_IN_LLVM_10 1
-# define _LIBCPP_INTRODUCED_IN_LLVM_10_ATTRIBUTE /* nothing */
+# define _LIBCPP_INTRODUCED_IN_LLVM_11 1
+# define _LIBCPP_INTRODUCED_IN_LLVM_11_ATTRIBUTE /* nothing */
# endif
// LLVM 12
@@ -290,8 +290,8 @@
// which requires shared library support for various operations
// (see libcxx/src/atomic.cpp). This includes <barier>, <latch>,
// <semaphore>, and notification functions on std::atomic.
-#define _LIBCPP_AVAILABILITY_HAS_SYNC _LIBCPP_INTRODUCED_IN_LLVM_10
-#define _LIBCPP_AVAILABILITY_SYNC _LIBCPP_INTRODUCED_IN_LLVM_10_ATTRIBUTE
+#define _LIBCPP_AVAILABILITY_HAS_SYNC _LIBCPP_INTRODUCED_IN_LLVM_11
+#define _LIBCPP_AVAILABILITY_SYNC _LIBCPP_INTRODUCED_IN_LLVM_11_ATTRIBUTE
// Enable additional explicit instantiations of iostreams components. This
// reduces the number of weak definitions generated in programs that use
diff --git a/libcxx/include/__exception/exception_ptr.h b/libcxx/include/__exception/exception_ptr.h
index 0a8337fa39de..beadd9212abd 100644
--- a/libcxx/include/__exception/exception_ptr.h
+++ b/libcxx/include/__exception/exception_ptr.h
@@ -66,6 +66,9 @@ class _LIBCPP_EXPORTED_FROM_ABI exception_ptr {
friend _LIBCPP_HIDE_FROM_ABI exception_ptr make_exception_ptr(_Ep) _NOEXCEPT;
public:
+ // exception_ptr is basically a COW string.
+ using __trivially_relocatable = exception_ptr;
+
_LIBCPP_HIDE_FROM_ABI exception_ptr() _NOEXCEPT : __ptr_() {}
_LIBCPP_HIDE_FROM_ABI exception_ptr(nullptr_t) _NOEXCEPT : __ptr_() {}
@@ -96,15 +99,16 @@ _LIBCPP_HIDE_FROM_ABI exception_ptr make_exception_ptr(_Ep __e) _NOEXCEPT {
void* __ex = __cxxabiv1::__cxa_allocate_exception(sizeof(_Ep));
# ifdef __wasm__
// In Wasm, a destructor returns its argument
- (void)__cxxabiv1::__cxa_init_primary_exception(__ex, const_cast<std::type_info*>(&typeid(_Ep)), [](void* __p) -> void* {
+ (void)__cxxabiv1::__cxa_init_primary_exception(
+ __ex, const_cast<std::type_info*>(&typeid(_Ep)), [](void* __p) -> void* {
# else
(void)__cxxabiv1::__cxa_init_primary_exception(__ex, const_cast<std::type_info*>(&typeid(_Ep)), [](void* __p) {
# endif
- std::__destroy_at(static_cast<_Ep2*>(__p));
+ std::__destroy_at(static_cast<_Ep2*>(__p));
# ifdef __wasm__
- return __p;
+ return __p;
# endif
- });
+ });
try {
::new (__ex) _Ep2(__e);
diff --git a/libcxx/include/__expected/expected.h b/libcxx/include/__expected/expected.h
index d7adaac7567b..f618b20603e6 100644
--- a/libcxx/include/__expected/expected.h
+++ b/libcxx/include/__expected/expected.h
@@ -31,6 +31,7 @@
#include <__type_traits/is_swappable.h>
#include <__type_traits/is_trivially_constructible.h>
#include <__type_traits/is_trivially_destructible.h>
+#include <__type_traits/is_trivially_relocatable.h>
#include <__type_traits/is_void.h>
#include <__type_traits/lazy.h>
#include <__type_traits/negation.h>
@@ -463,6 +464,11 @@ public:
using error_type = _Err;
using unexpected_type = unexpected<_Err>;
+ using __trivially_relocatable =
+ __conditional_t<__libcpp_is_trivially_relocatable<_Tp>::value && __libcpp_is_trivially_relocatable<_Err>::value,
+ expected,
+ void>;
+
template <class _Up>
using rebind = expected<_Up, error_type>;
@@ -501,7 +507,9 @@ private:
_And< is_constructible<_Tp, _UfQual>,
is_constructible<_Err, _OtherErrQual>,
_If<_Not<is_same<remove_cv_t<_Tp>, bool>>::value,
- _And< _Not<is_constructible<_Tp, expected<_Up, _OtherErr>&>>,
+ _And<
+ _Not<_And<is_same<_Tp, _Up>, is_same<_Err, _OtherErr>>>, // use the copy constructor instead, see #92676
+ _Not<is_constructible<_Tp, expected<_Up, _OtherErr>&>>,
_Not<is_constructible<_Tp, expected<_Up, _OtherErr>>>,
_Not<is_constructible<_Tp, const expected<_Up, _OtherErr>&>>,
_Not<is_constructible<_Tp, const expected<_Up, _OtherErr>>>,
diff --git a/libcxx/include/__format/escaped_output_table.h b/libcxx/include/__format/escaped_output_table.h
index 6aa91c89defa..f7be2dc61f21 100644
--- a/libcxx/include/__format/escaped_output_table.h
+++ b/libcxx/include/__format/escaped_output_table.h
@@ -833,7 +833,7 @@ _LIBCPP_HIDE_FROM_ABI inline constexpr uint32_t __entries[711] = {
/// more details.
///
-/// \pre The code point is a valid Unicode code point.
+/// \\pre The code point is a valid Unicode code point.
[[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr bool __needs_escape(const char32_t __code_point) noexcept {
// The entries in the gap at the end.
diff --git a/libcxx/include/__format/formatter_output.h b/libcxx/include/__format/formatter_output.h
index d5038eb158b0..1498f64c4aef 100644
--- a/libcxx/include/__format/formatter_output.h
+++ b/libcxx/include/__format/formatter_output.h
@@ -100,8 +100,8 @@ __padding_size(size_t __size, size_t __width, __format_spec::__alignment __align
///
/// This uses a "mass output function" of __format::__output_buffer when possible.
template <__fmt_char_type _CharT, __fmt_char_type _OutCharT = _CharT>
-_LIBCPP_HIDE_FROM_ABI auto __copy(basic_string_view<_CharT> __str, output_iterator<const _OutCharT&> auto __out_it)
- -> decltype(__out_it) {
+_LIBCPP_HIDE_FROM_ABI auto
+__copy(basic_string_view<_CharT> __str, output_iterator<const _OutCharT&> auto __out_it) -> decltype(__out_it) {
if constexpr (std::same_as<decltype(__out_it), std::back_insert_iterator<__format::__output_buffer<_OutCharT>>>) {
__out_it.__get_container()->__copy(__str);
return __out_it;
@@ -116,16 +116,16 @@ _LIBCPP_HIDE_FROM_ABI auto __copy(basic_string_view<_CharT> __str, output_iterat
template <contiguous_iterator _Iterator,
__fmt_char_type _CharT = typename iterator_traits<_Iterator>::value_type,
__fmt_char_type _OutCharT = _CharT>
-_LIBCPP_HIDE_FROM_ABI auto __copy(_Iterator __first, _Iterator __last, output_iterator<const _OutCharT&> auto __out_it)
- -> decltype(__out_it) {
+_LIBCPP_HIDE_FROM_ABI auto
+__copy(_Iterator __first, _Iterator __last, output_iterator<const _OutCharT&> auto __out_it) -> decltype(__out_it) {
return __formatter::__copy(basic_string_view{__first, __last}, std::move(__out_it));
}
template <contiguous_iterator _Iterator,
__fmt_char_type _CharT = typename iterator_traits<_Iterator>::value_type,
__fmt_char_type _OutCharT = _CharT>
-_LIBCPP_HIDE_FROM_ABI auto __copy(_Iterator __first, size_t __n, output_iterator<const _OutCharT&> auto __out_it)
- -> decltype(__out_it) {
+_LIBCPP_HIDE_FROM_ABI auto
+__copy(_Iterator __first, size_t __n, output_iterator<const _OutCharT&> auto __out_it) -> decltype(__out_it) {
return __formatter::__copy(basic_string_view{std::to_address(__first), __n}, std::move(__out_it));
}
@@ -136,9 +136,11 @@ template <contiguous_iterator _Iterator,
__fmt_char_type _CharT = typename iterator_traits<_Iterator>::value_type,
__fmt_char_type _OutCharT = _CharT,
class _UnaryOperation>
-_LIBCPP_HIDE_FROM_ABI auto __transform(
- _Iterator __first, _Iterator __last, output_iterator<const _OutCharT&> auto __out_it, _UnaryOperation __operation)
- -> decltype(__out_it) {
+_LIBCPP_HIDE_FROM_ABI auto
+__transform(_Iterator __first,
+ _Iterator __last,
+ output_iterator<const _OutCharT&> auto __out_it,
+ _UnaryOperation __operation) -> decltype(__out_it) {
if constexpr (std::same_as<decltype(__out_it), std::back_insert_iterator<__format::__output_buffer<_OutCharT>>>) {
__out_it.__get_container()->__transform(__first, __last, std::move(__operation));
return __out_it;
diff --git a/libcxx/include/__format/parser_std_format_spec.h b/libcxx/include/__format/parser_std_format_spec.h
index 9818f37b518e..150bdde89f3b 100644
--- a/libcxx/include/__format/parser_std_format_spec.h
+++ b/libcxx/include/__format/parser_std_format_spec.h
@@ -1155,8 +1155,8 @@ __estimate_column_width(basic_string_view<_CharT> __str, size_t __maximum, __col
// When Unicode isn't supported assume ASCII and every code unit is one code
// point. In ASCII the estimated column width is always one. Thus there's no
// need for rounding.
- size_t __width_ = std::min(__str.size(), __maximum);
- return {__width_, __str.begin() + __width_};
+ size_t __width = std::min(__str.size(), __maximum);
+ return {__width, __str.begin() + __width};
}
# endif // !defined(_LIBCPP_HAS_NO_UNICODE)
diff --git a/libcxx/include/__format/width_estimation_table.h b/libcxx/include/__format/width_estimation_table.h
index c9a9f6719c61..11f61dea18d6 100644
--- a/libcxx/include/__format/width_estimation_table.h
+++ b/libcxx/include/__format/width_estimation_table.h
@@ -237,7 +237,7 @@ inline constexpr uint32_t __table_upper_bound = 0x0003fffd;
/// Returns the estimated width of a Unicode code point.
///
-/// \pre The code point is a valid Unicode code point.
+/// \\pre The code point is a valid Unicode code point.
[[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr int __estimated_width(const char32_t __code_point) noexcept {
// Since __table_upper_bound contains the unshifted range do the
// comparison without shifting.
diff --git a/libcxx/include/__functional/bind.h b/libcxx/include/__functional/bind.h
index 385dabaee424..b4f46441da50 100644
--- a/libcxx/include/__functional/bind.h
+++ b/libcxx/include/__functional/bind.h
@@ -105,8 +105,8 @@ struct __mu_return2<true, _Ti, _Uj> {
template <class _Ti, class _Uj, __enable_if_t<0 < is_placeholder<_Ti>::value, int> = 0>
inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
- typename __mu_return2<0 < is_placeholder<_Ti>::value, _Ti, _Uj>::type
- __mu(_Ti&, _Uj& __uj) {
+typename __mu_return2<0 < is_placeholder<_Ti>::value, _Ti, _Uj>::type
+__mu(_Ti&, _Uj& __uj) {
const size_t __indx = is_placeholder<_Ti>::value - 1;
return std::forward<typename tuple_element<__indx, _Uj>::type>(std::get<__indx>(__uj));
}
@@ -225,8 +225,8 @@ public:
template <class... _Args>
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
- typename __bind_return<const _Fd, const _Td, tuple<_Args&&...> >::type
- operator()(_Args&&... __args) const {
+ typename __bind_return<const _Fd, const _Td, tuple<_Args&&...> >::type
+ operator()(_Args&&... __args) const {
return std::__apply_functor(__f_, __bound_args_, __indices(), tuple<_Args&&...>(std::forward<_Args>(__args)...));
}
};
diff --git a/libcxx/include/__functional/bind_back.h b/libcxx/include/__functional/bind_back.h
index 3c42d4769e8a..e44768d2283c 100644
--- a/libcxx/include/__functional/bind_back.h
+++ b/libcxx/include/__functional/bind_back.h
@@ -52,7 +52,7 @@ struct __bind_back_t : __perfect_forward<__bind_back_op<tuple_size_v<_BoundArgs>
template <class _Fn, class... _Args>
requires is_constructible_v<decay_t<_Fn>, _Fn> && is_move_constructible_v<decay_t<_Fn>> &&
- (is_constructible_v<decay_t<_Args>, _Args> && ...) && (is_move_constructible_v<decay_t<_Args>> && ...)
+ (is_constructible_v<decay_t<_Args>, _Args> && ...) && (is_move_constructible_v<decay_t<_Args>> && ...)
_LIBCPP_HIDE_FROM_ABI constexpr auto __bind_back(_Fn&& __f, _Args&&... __args) noexcept(
noexcept(__bind_back_t<decay_t<_Fn>, tuple<decay_t<_Args>...>>(
std::forward<_Fn>(__f), std::forward_as_tuple(std::forward<_Args>(__args)...))))
diff --git a/libcxx/include/__functional/bind_front.h b/libcxx/include/__functional/bind_front.h
index 11d0bac3f839..87ef3affe80b 100644
--- a/libcxx/include/__functional/bind_front.h
+++ b/libcxx/include/__functional/bind_front.h
@@ -29,9 +29,8 @@ _LIBCPP_BEGIN_NAMESPACE_STD
struct __bind_front_op {
template <class... _Args>
- _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Args&&... __args) const
- noexcept(noexcept(std::invoke(std::forward<_Args>(__args)...)))
- -> decltype(std::invoke(std::forward<_Args>(__args)...)) {
+ _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Args&&... __args) const noexcept(
+ noexcept(std::invoke(std::forward<_Args>(__args)...))) -> decltype(std::invoke(std::forward<_Args>(__args)...)) {
return std::invoke(std::forward<_Args>(__args)...);
}
};
diff --git a/libcxx/include/__functional/function.h b/libcxx/include/__functional/function.h
index 244e55be3403..c7b98035e34b 100644
--- a/libcxx/include/__functional/function.h
+++ b/libcxx/include/__functional/function.h
@@ -232,10 +232,10 @@ class _LIBCPP_TEMPLATE_VIS __base;
template <class _Rp, class... _ArgTypes>
class __base<_Rp(_ArgTypes...)> {
- __base(const __base&);
- __base& operator=(const __base&);
-
public:
+ __base(const __base&) = delete;
+ __base& operator=(const __base&) = delete;
+
_LIBCPP_HIDE_FROM_ABI __base() {}
_LIBCPP_HIDE_FROM_ABI_VIRTUAL virtual ~__base() {}
virtual __base* __clone() const = 0;
@@ -516,7 +516,7 @@ struct __policy {
}
_LIBCPP_HIDE_FROM_ABI static const __policy* __create_empty() {
- static const _LIBCPP_CONSTEXPR __policy __policy = {
+ static constexpr __policy __policy = {
nullptr,
nullptr,
true,
@@ -543,7 +543,7 @@ private:
template <typename _Fun>
_LIBCPP_HIDE_FROM_ABI static const __policy* __choose_policy(/* is_small = */ false_type) {
- static const _LIBCPP_CONSTEXPR __policy __policy = {
+ static constexpr __policy __policy = {
&__large_clone<_Fun>,
&__large_destroy<_Fun>,
false,
@@ -558,7 +558,7 @@ private:
template <typename _Fun>
_LIBCPP_HIDE_FROM_ABI static const __policy* __choose_policy(/* is_small = */ true_type) {
- static const _LIBCPP_CONSTEXPR __policy __policy = {
+ static constexpr __policy __policy = {
nullptr,
nullptr,
false,
diff --git a/libcxx/include/__functional/mem_fn.h b/libcxx/include/__functional/mem_fn.h
index 349a6ce3a757..ee07a71774f9 100644
--- a/libcxx/include/__functional/mem_fn.h
+++ b/libcxx/include/__functional/mem_fn.h
@@ -38,8 +38,8 @@ public:
template <class... _ArgTypes>
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
- typename __invoke_return<type, _ArgTypes...>::type
- operator()(_ArgTypes&&... __args) const {
+ typename __invoke_return<type, _ArgTypes...>::type
+ operator()(_ArgTypes&&... __args) const {
return std::__invoke(__f_, std::forward<_ArgTypes>(__args)...);
}
};
diff --git a/libcxx/include/__functional/mem_fun_ref.h b/libcxx/include/__functional/mem_fun_ref.h
index fe43c4656092..c344420b0299 100644
--- a/libcxx/include/__functional/mem_fun_ref.h
+++ b/libcxx/include/__functional/mem_fun_ref.h
@@ -89,8 +89,8 @@ public:
};
template <class _Sp, class _Tp, class _Ap>
-class _LIBCPP_TEMPLATE_VIS _LIBCPP_DEPRECATED_IN_CXX11 const_mem_fun1_t
- : public __binary_function<const _Tp*, _Ap, _Sp> {
+class _LIBCPP_TEMPLATE_VIS
+_LIBCPP_DEPRECATED_IN_CXX11 const_mem_fun1_t : public __binary_function<const _Tp*, _Ap, _Sp> {
_Sp (_Tp::*__p_)(_Ap) const;
public:
diff --git a/libcxx/include/__functional/operations.h b/libcxx/include/__functional/operations.h
index 240f127e5425..0a6320f19de3 100644
--- a/libcxx/include/__functional/operations.h
+++ b/libcxx/include/__functional/operations.h
@@ -50,8 +50,8 @@ template <>
struct _LIBCPP_TEMPLATE_VIS plus<void> {
template <class _T1, class _T2>
_LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI auto operator()(_T1&& __t, _T2&& __u) const
- noexcept(noexcept(std::forward<_T1>(__t) + std::forward<_T2>(__u)))
- -> decltype(std::forward<_T1>(__t) + std::forward<_T2>(__u)) {
+ noexcept(noexcept(std::forward<_T1>(__t) + std::forward<_T2>(__u))) //
+ -> decltype(std::forward<_T1>(__t) + std::forward<_T2>(__u)) {
return std::forward<_T1>(__t) + std::forward<_T2>(__u);
}
typedef void is_transparent;
@@ -76,8 +76,8 @@ template <>
struct _LIBCPP_TEMPLATE_VIS minus<void> {
template <class _T1, class _T2>
_LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI auto operator()(_T1&& __t, _T2&& __u) const
- noexcept(noexcept(std::forward<_T1>(__t) - std::forward<_T2>(__u)))
- -> decltype(std::forward<_T1>(__t) - std::forward<_T2>(__u)) {
+ noexcept(noexcept(std::forward<_T1>(__t) - std::forward<_T2>(__u))) //
+ -> decltype(std::forward<_T1>(__t) - std::forward<_T2>(__u)) {
return std::forward<_T1>(__t) - std::forward<_T2>(__u);
}
typedef void is_transparent;
@@ -102,8 +102,8 @@ template <>
struct _LIBCPP_TEMPLATE_VIS multiplies<void> {
template <class _T1, class _T2>
_LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI auto operator()(_T1&& __t, _T2&& __u) const
- noexcept(noexcept(std::forward<_T1>(__t) * std::forward<_T2>(__u)))
- -> decltype(std::forward<_T1>(__t) * std::forward<_T2>(__u)) {
+ noexcept(noexcept(std::forward<_T1>(__t) * std::forward<_T2>(__u))) //
+ -> decltype(std::forward<_T1>(__t) * std::forward<_T2>(__u)) {
return std::forward<_T1>(__t) * std::forward<_T2>(__u);
}
typedef void is_transparent;
@@ -128,8 +128,8 @@ template <>
struct _LIBCPP_TEMPLATE_VIS divides<void> {
template <class _T1, class _T2>
_LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI auto operator()(_T1&& __t, _T2&& __u) const
- noexcept(noexcept(std::forward<_T1>(__t) / std::forward<_T2>(__u)))
- -> decltype(std::forward<_T1>(__t) / std::forward<_T2>(__u)) {
+ noexcept(noexcept(std::forward<_T1>(__t) / std::forward<_T2>(__u))) //
+ -> decltype(std::forward<_T1>(__t) / std::forward<_T2>(__u)) {
return std::forward<_T1>(__t) / std::forward<_T2>(__u);
}
typedef void is_transparent;
@@ -154,8 +154,8 @@ template <>
struct _LIBCPP_TEMPLATE_VIS modulus<void> {
template <class _T1, class _T2>
_LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI auto operator()(_T1&& __t, _T2&& __u) const
- noexcept(noexcept(std::forward<_T1>(__t) % std::forward<_T2>(__u)))
- -> decltype(std::forward<_T1>(__t) % std::forward<_T2>(__u)) {
+ noexcept(noexcept(std::forward<_T1>(__t) % std::forward<_T2>(__u))) //
+ -> decltype(std::forward<_T1>(__t) % std::forward<_T2>(__u)) {
return std::forward<_T1>(__t) % std::forward<_T2>(__u);
}
typedef void is_transparent;
@@ -178,7 +178,8 @@ template <>
struct _LIBCPP_TEMPLATE_VIS negate<void> {
template <class _Tp>
_LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI auto operator()(_Tp&& __x) const
- noexcept(noexcept(-std::forward<_Tp>(__x))) -> decltype(-std::forward<_Tp>(__x)) {
+ noexcept(noexcept(-std::forward<_Tp>(__x))) //
+ -> decltype(-std::forward<_Tp>(__x)) {
return -std::forward<_Tp>(__x);
}
typedef void is_transparent;
@@ -205,8 +206,8 @@ template <>
struct _LIBCPP_TEMPLATE_VIS bit_and<void> {
template <class _T1, class _T2>
_LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI auto operator()(_T1&& __t, _T2&& __u) const
- noexcept(noexcept(std::forward<_T1>(__t) & std::forward<_T2>(__u)))
- -> decltype(std::forward<_T1>(__t) & std::forward<_T2>(__u)) {
+ noexcept(noexcept(std::forward<_T1>(__t) &
+ std::forward<_T2>(__u))) -> decltype(std::forward<_T1>(__t) & std::forward<_T2>(__u)) {
return std::forward<_T1>(__t) & std::forward<_T2>(__u);
}
typedef void is_transparent;
@@ -224,7 +225,8 @@ template <>
struct _LIBCPP_TEMPLATE_VIS bit_not<void> {
template <class _Tp>
_LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI auto operator()(_Tp&& __x) const
- noexcept(noexcept(~std::forward<_Tp>(__x))) -> decltype(~std::forward<_Tp>(__x)) {
+ noexcept(noexcept(~std::forward<_Tp>(__x))) //
+ -> decltype(~std::forward<_Tp>(__x)) {
return ~std::forward<_Tp>(__x);
}
typedef void is_transparent;
@@ -249,8 +251,8 @@ template <>
struct _LIBCPP_TEMPLATE_VIS bit_or<void> {
template <class _T1, class _T2>
_LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI auto operator()(_T1&& __t, _T2&& __u) const
- noexcept(noexcept(std::forward<_T1>(__t) | std::forward<_T2>(__u)))
- -> decltype(std::forward<_T1>(__t) | std::forward<_T2>(__u)) {
+ noexcept(noexcept(std::forward<_T1>(__t) | std::forward<_T2>(__u))) //
+ -> decltype(std::forward<_T1>(__t) | std::forward<_T2>(__u)) {
return std::forward<_T1>(__t) | std::forward<_T2>(__u);
}
typedef void is_transparent;
@@ -275,8 +277,8 @@ template <>
struct _LIBCPP_TEMPLATE_VIS bit_xor<void> {
template <class _T1, class _T2>
_LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI auto operator()(_T1&& __t, _T2&& __u) const
- noexcept(noexcept(std::forward<_T1>(__t) ^ std::forward<_T2>(__u)))
- -> decltype(std::forward<_T1>(__t) ^ std::forward<_T2>(__u)) {
+ noexcept(noexcept(std::forward<_T1>(__t) ^ std::forward<_T2>(__u))) //
+ -> decltype(std::forward<_T1>(__t) ^ std::forward<_T2>(__u)) {
return std::forward<_T1>(__t) ^ std::forward<_T2>(__u);
}
typedef void is_transparent;
@@ -303,8 +305,8 @@ template <>
struct _LIBCPP_TEMPLATE_VIS equal_to<void> {
template <class _T1, class _T2>
_LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI auto operator()(_T1&& __t, _T2&& __u) const
- noexcept(noexcept(std::forward<_T1>(__t) == std::forward<_T2>(__u)))
- -> decltype(std::forward<_T1>(__t) == std::forward<_T2>(__u)) {
+ noexcept(noexcept(std::forward<_T1>(__t) == std::forward<_T2>(__u))) //
+ -> decltype(std::forward<_T1>(__t) == std::forward<_T2>(__u)) {
return std::forward<_T1>(__t) == std::forward<_T2>(__u);
}
typedef void is_transparent;
@@ -338,8 +340,8 @@ template <>
struct _LIBCPP_TEMPLATE_VIS not_equal_to<void> {
template <class _T1, class _T2>
_LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI auto operator()(_T1&& __t, _T2&& __u) const
- noexcept(noexcept(std::forward<_T1>(__t) != std::forward<_T2>(__u)))
- -> decltype(std::forward<_T1>(__t) != std::forward<_T2>(__u)) {
+ noexcept(noexcept(std::forward<_T1>(__t) != std::forward<_T2>(__u))) //
+ -> decltype(std::forward<_T1>(__t) != std::forward<_T2>(__u)) {
return std::forward<_T1>(__t) != std::forward<_T2>(__u);
}
typedef void is_transparent;
@@ -367,8 +369,8 @@ template <>
struct _LIBCPP_TEMPLATE_VIS less<void> {
template <class _T1, class _T2>
_LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI auto operator()(_T1&& __t, _T2&& __u) const
- noexcept(noexcept(std::forward<_T1>(__t) < std::forward<_T2>(__u)))
- -> decltype(std::forward<_T1>(__t) < std::forward<_T2>(__u)) {
+ noexcept(noexcept(std::forward<_T1>(__t) < std::forward<_T2>(__u))) //
+ -> decltype(std::forward<_T1>(__t) < std::forward<_T2>(__u)) {
return std::forward<_T1>(__t) < std::forward<_T2>(__u);
}
typedef void is_transparent;
@@ -396,8 +398,8 @@ template <>
struct _LIBCPP_TEMPLATE_VIS less_equal<void> {
template <class _T1, class _T2>
_LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI auto operator()(_T1&& __t, _T2&& __u) const
- noexcept(noexcept(std::forward<_T1>(__t) <= std::forward<_T2>(__u)))
- -> decltype(std::forward<_T1>(__t) <= std::forward<_T2>(__u)) {
+ noexcept(noexcept(std::forward<_T1>(__t) <= std::forward<_T2>(__u))) //
+ -> decltype(std::forward<_T1>(__t) <= std::forward<_T2>(__u)) {
return std::forward<_T1>(__t) <= std::forward<_T2>(__u);
}
typedef void is_transparent;
@@ -422,8 +424,8 @@ template <>
struct _LIBCPP_TEMPLATE_VIS greater_equal<void> {
template <class _T1, class _T2>
_LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI auto operator()(_T1&& __t, _T2&& __u) const
- noexcept(noexcept(std::forward<_T1>(__t) >= std::forward<_T2>(__u)))
- -> decltype(std::forward<_T1>(__t) >= std::forward<_T2>(__u)) {
+ noexcept(noexcept(std::forward<_T1>(__t) >=
+ std::forward<_T2>(__u))) -> decltype(std::forward<_T1>(__t) >= std::forward<_T2>(__u)) {
return std::forward<_T1>(__t) >= std::forward<_T2>(__u);
}
typedef void is_transparent;
@@ -448,8 +450,8 @@ template <>
struct _LIBCPP_TEMPLATE_VIS greater<void> {
template <class _T1, class _T2>
_LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI auto operator()(_T1&& __t, _T2&& __u) const
- noexcept(noexcept(std::forward<_T1>(__t) > std::forward<_T2>(__u)))
- -> decltype(std::forward<_T1>(__t) > std::forward<_T2>(__u)) {
+ noexcept(noexcept(std::forward<_T1>(__t) > std::forward<_T2>(__u))) //
+ -> decltype(std::forward<_T1>(__t) > std::forward<_T2>(__u)) {
return std::forward<_T1>(__t) > std::forward<_T2>(__u);
}
typedef void is_transparent;
@@ -476,8 +478,8 @@ template <>
struct _LIBCPP_TEMPLATE_VIS logical_and<void> {
template <class _T1, class _T2>
_LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI auto operator()(_T1&& __t, _T2&& __u) const
- noexcept(noexcept(std::forward<_T1>(__t) && std::forward<_T2>(__u)))
- -> decltype(std::forward<_T1>(__t) && std::forward<_T2>(__u)) {
+ noexcept(noexcept(std::forward<_T1>(__t) && std::forward<_T2>(__u))) //
+ -> decltype(std::forward<_T1>(__t) && std::forward<_T2>(__u)) {
return std::forward<_T1>(__t) && std::forward<_T2>(__u);
}
typedef void is_transparent;
@@ -500,7 +502,8 @@ template <>
struct _LIBCPP_TEMPLATE_VIS logical_not<void> {
template <class _Tp>
_LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI auto operator()(_Tp&& __x) const
- noexcept(noexcept(!std::forward<_Tp>(__x))) -> decltype(!std::forward<_Tp>(__x)) {
+ noexcept(noexcept(!std::forward<_Tp>(__x))) //
+ -> decltype(!std::forward<_Tp>(__x)) {
return !std::forward<_Tp>(__x);
}
typedef void is_transparent;
@@ -525,8 +528,8 @@ template <>
struct _LIBCPP_TEMPLATE_VIS logical_or<void> {
template <class _T1, class _T2>
_LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI auto operator()(_T1&& __t, _T2&& __u) const
- noexcept(noexcept(std::forward<_T1>(__t) || std::forward<_T2>(__u)))
- -> decltype(std::forward<_T1>(__t) || std::forward<_T2>(__u)) {
+ noexcept(noexcept(std::forward<_T1>(__t) || std::forward<_T2>(__u))) //
+ -> decltype(std::forward<_T1>(__t) || std::forward<_T2>(__u)) {
return std::forward<_T1>(__t) || std::forward<_T2>(__u);
}
typedef void is_transparent;
diff --git a/libcxx/include/__functional/pointer_to_binary_function.h b/libcxx/include/__functional/pointer_to_binary_function.h
index 51a7c3fe0fc0..e345250dcdd8 100644
--- a/libcxx/include/__functional/pointer_to_binary_function.h
+++ b/libcxx/include/__functional/pointer_to_binary_function.h
@@ -22,8 +22,8 @@ _LIBCPP_BEGIN_NAMESPACE_STD
#if _LIBCPP_STD_VER <= 14 || defined(_LIBCPP_ENABLE_CXX17_REMOVED_BINDERS)
template <class _Arg1, class _Arg2, class _Result>
-class _LIBCPP_TEMPLATE_VIS _LIBCPP_DEPRECATED_IN_CXX11 pointer_to_binary_function
- : public __binary_function<_Arg1, _Arg2, _Result> {
+class _LIBCPP_TEMPLATE_VIS
+_LIBCPP_DEPRECATED_IN_CXX11 pointer_to_binary_function : public __binary_function<_Arg1, _Arg2, _Result> {
_Result (*__f_)(_Arg1, _Arg2);
public:
diff --git a/libcxx/include/__functional/pointer_to_unary_function.h b/libcxx/include/__functional/pointer_to_unary_function.h
index 0338e7671789..3a5d153d3617 100644
--- a/libcxx/include/__functional/pointer_to_unary_function.h
+++ b/libcxx/include/__functional/pointer_to_unary_function.h
@@ -22,8 +22,8 @@ _LIBCPP_BEGIN_NAMESPACE_STD
#if _LIBCPP_STD_VER <= 14 || defined(_LIBCPP_ENABLE_CXX17_REMOVED_BINDERS)
template <class _Arg, class _Result>
-class _LIBCPP_TEMPLATE_VIS _LIBCPP_DEPRECATED_IN_CXX11 pointer_to_unary_function
- : public __unary_function<_Arg, _Result> {
+class _LIBCPP_TEMPLATE_VIS
+_LIBCPP_DEPRECATED_IN_CXX11 pointer_to_unary_function : public __unary_function<_Arg, _Result> {
_Result (*__f_)(_Arg);
public:
diff --git a/libcxx/include/__functional/reference_wrapper.h b/libcxx/include/__functional/reference_wrapper.h
index ab5d7c7cee11..3570e2673c80 100644
--- a/libcxx/include/__functional/reference_wrapper.h
+++ b/libcxx/include/__functional/reference_wrapper.h
@@ -39,7 +39,7 @@ private:
type* __f_;
static void __fun(_Tp&) _NOEXCEPT;
- static void __fun(_Tp&&) = delete;
+ static void __fun(_Tp&&) = delete; // NOLINT(modernize-use-equals-delete) ; This is llvm.org/PR54276
public:
template <class _Up,
diff --git a/libcxx/include/__functional/unary_negate.h b/libcxx/include/__functional/unary_negate.h
index d130b7d728a2..5bd487a97bcb 100644
--- a/libcxx/include/__functional/unary_negate.h
+++ b/libcxx/include/__functional/unary_negate.h
@@ -22,8 +22,8 @@ _LIBCPP_BEGIN_NAMESPACE_STD
#if _LIBCPP_STD_VER <= 17 || defined(_LIBCPP_ENABLE_CXX20_REMOVED_NEGATORS)
template <class _Predicate>
-class _LIBCPP_TEMPLATE_VIS _LIBCPP_DEPRECATED_IN_CXX17 unary_negate
- : public __unary_function<typename _Predicate::argument_type, bool> {
+class _LIBCPP_TEMPLATE_VIS
+_LIBCPP_DEPRECATED_IN_CXX17 unary_negate : public __unary_function<typename _Predicate::argument_type, bool> {
_Predicate __pred_;
public:
diff --git a/libcxx/include/__hash_table b/libcxx/include/__hash_table
index a705117d0173..025758528573 100644
--- a/libcxx/include/__hash_table
+++ b/libcxx/include/__hash_table
@@ -240,9 +240,9 @@ public:
private:
static_assert(!is_const<__node_type>::value, "_NodePtr should never be a pointer to const");
- static_assert((is_same<typename pointer_traits<_VoidPtr>::element_type, void>::value),
+ static_assert(is_same<typename pointer_traits<_VoidPtr>::element_type, void>::value,
"_VoidPtr does not point to unqualified void type");
- static_assert((is_same<__rebind_pointer_t<_VoidPtr, __node_type>, _NodePtr>::value),
+ static_assert(is_same<__rebind_pointer_t<_VoidPtr, __node_type>, _NodePtr>::value,
"_VoidPtr does not rebind to _NodePtr.");
};
@@ -700,11 +700,11 @@ private:
// check for sane allocator pointer rebinding semantics. Rebinding the
// allocator for a new pointer type should be exactly the same as rebinding
// the pointer using 'pointer_traits'.
- static_assert((is_same<__node_pointer, typename __node_traits::pointer>::value),
+ static_assert(is_same<__node_pointer, typename __node_traits::pointer>::value,
"Allocator does not rebind pointers in a sane manner.");
typedef __rebind_alloc<__node_traits, __first_node> __node_base_allocator;
typedef allocator_traits<__node_base_allocator> __node_base_traits;
- static_assert((is_same<__node_base_pointer, typename __node_base_traits::pointer>::value),
+ static_assert(is_same<__node_base_pointer, typename __node_base_traits::pointer>::value,
"Allocator does not rebind pointers in a sane manner.");
private:
@@ -928,13 +928,12 @@ public:
_LIBCPP_HIDE_FROM_ABI void swap(__hash_table& __u)
#if _LIBCPP_STD_VER <= 11
- _NOEXCEPT_(__is_nothrow_swappable<hasher>::value&& __is_nothrow_swappable<key_equal>::value &&
+ _NOEXCEPT_(__is_nothrow_swappable_v<hasher>&& __is_nothrow_swappable_v<key_equal> &&
(!allocator_traits<__pointer_allocator>::propagate_on_container_swap::value ||
- __is_nothrow_swappable<__pointer_allocator>::value) &&
- (!__node_traits::propagate_on_container_swap::value ||
- __is_nothrow_swappable<__node_allocator>::value));
+ __is_nothrow_swappable_v<__pointer_allocator>) &&
+ (!__node_traits::propagate_on_container_swap::value || __is_nothrow_swappable_v<__node_allocator>));
#else
- _NOEXCEPT_(__is_nothrow_swappable<hasher>::value&& __is_nothrow_swappable<key_equal>::value);
+ _NOEXCEPT_(__is_nothrow_swappable_v<hasher>&& __is_nothrow_swappable_v<key_equal>);
#endif
_LIBCPP_HIDE_FROM_ABI size_type max_bucket_count() const _NOEXCEPT { return max_size(); }
@@ -1101,8 +1100,8 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::__hash_table(__hash_table&& __u, const
template <class _Tp, class _Hash, class _Equal, class _Alloc>
__hash_table<_Tp, _Hash, _Equal, _Alloc>::~__hash_table() {
#if defined(_LIBCPP_CXX03_LANG)
- static_assert((is_copy_constructible<key_equal>::value), "Predicate must be copy-constructible.");
- static_assert((is_copy_constructible<hasher>::value), "Hasher must be copy-constructible.");
+ static_assert(is_copy_constructible<key_equal>::value, "Predicate must be copy-constructible.");
+ static_assert(is_copy_constructible<hasher>::value, "Hasher must be copy-constructible.");
#endif
__deallocate_node(__p1_.first().__next_);
@@ -1228,7 +1227,7 @@ template <class _InputIterator>
void __hash_table<_Tp, _Hash, _Equal, _Alloc>::__assign_unique(_InputIterator __first, _InputIterator __last) {
typedef iterator_traits<_InputIterator> _ITraits;
typedef typename _ITraits::value_type _ItValueType;
- static_assert((is_same<_ItValueType, __container_value_type>::value),
+ static_assert(is_same<_ItValueType, __container_value_type>::value,
"__assign_unique may only be called with the containers value type");
if (bucket_count() != 0) {
@@ -1985,12 +1984,12 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::__equal_range_multi(const _Key& __k) c
template <class _Tp, class _Hash, class _Equal, class _Alloc>
void __hash_table<_Tp, _Hash, _Equal, _Alloc>::swap(__hash_table& __u)
#if _LIBCPP_STD_VER <= 11
- _NOEXCEPT_(__is_nothrow_swappable<hasher>::value&& __is_nothrow_swappable<key_equal>::value &&
+ _NOEXCEPT_(__is_nothrow_swappable_v<hasher>&& __is_nothrow_swappable_v<key_equal> &&
(!allocator_traits<__pointer_allocator>::propagate_on_container_swap::value ||
- __is_nothrow_swappable<__pointer_allocator>::value) &&
- (!__node_traits::propagate_on_container_swap::value || __is_nothrow_swappable<__node_allocator>::value))
+ __is_nothrow_swappable_v<__pointer_allocator>) &&
+ (!__node_traits::propagate_on_container_swap::value || __is_nothrow_swappable_v<__node_allocator>))
#else
- _NOEXCEPT_(__is_nothrow_swappable<hasher>::value&& __is_nothrow_swappable<key_equal>::value)
+ _NOEXCEPT_(__is_nothrow_swappable_v<hasher>&& __is_nothrow_swappable_v<key_equal>)
#endif
{
_LIBCPP_ASSERT_COMPATIBLE_ALLOCATOR(
diff --git a/libcxx/include/__iterator/access.h b/libcxx/include/__iterator/access.h
index 5c6090eeb40c..acc4f60bf697 100644
--- a/libcxx/include/__iterator/access.h
+++ b/libcxx/include/__iterator/access.h
@@ -54,8 +54,8 @@ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 auto end(const _Cp& __c) ->
# if _LIBCPP_STD_VER >= 14
template <class _Cp>
-_LIBCPP_HIDE_FROM_ABI constexpr auto cbegin(const _Cp& __c) noexcept(noexcept(std::begin(__c)))
- -> decltype(std::begin(__c)) {
+_LIBCPP_HIDE_FROM_ABI constexpr auto
+cbegin(const _Cp& __c) noexcept(noexcept(std::begin(__c))) -> decltype(std::begin(__c)) {
return std::begin(__c);
}
diff --git a/libcxx/include/__iterator/bounded_iter.h b/libcxx/include/__iterator/bounded_iter.h
index a1a941ffbaaf..a8f66f4a0126 100644
--- a/libcxx/include/__iterator/bounded_iter.h
+++ b/libcxx/include/__iterator/bounded_iter.h
@@ -84,8 +84,8 @@ private:
//
// Since it is non-standard for iterators to have this constructor, __bounded_iter must
// be created via `std::__make_bounded_iter`.
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 explicit __bounded_iter(
- _Iterator __current, _Iterator __begin, _Iterator __end)
+ _LIBCPP_HIDE_FROM_ABI
+ _LIBCPP_CONSTEXPR_SINCE_CXX14 explicit __bounded_iter(_Iterator __current, _Iterator __begin, _Iterator __end)
: __current_(__current), __begin_(__begin), __end_(__end) {
_LIBCPP_ASSERT_INTERNAL(
__begin <= __current, "__bounded_iter(current, begin, end): current and begin are inconsistent");
diff --git a/libcxx/include/__iterator/cpp17_iterator_concepts.h b/libcxx/include/__iterator/cpp17_iterator_concepts.h
index 9d5a392582da..ba3536b68609 100644
--- a/libcxx/include/__iterator/cpp17_iterator_concepts.h
+++ b/libcxx/include/__iterator/cpp17_iterator_concepts.h
@@ -68,7 +68,7 @@ concept __cpp17_default_constructible = is_default_constructible_v<_Tp>;
template <class _Iter>
concept __cpp17_iterator =
__cpp17_copy_constructible<_Iter> && __cpp17_copy_assignable<_Iter> && __cpp17_destructible<_Iter> &&
- (is_signed_v<__iter_diff_t<_Iter>> || is_void_v<__iter_diff_t<_Iter>>)&&requires(_Iter __iter) {
+ (is_signed_v<__iter_diff_t<_Iter>> || is_void_v<__iter_diff_t<_Iter>>) && requires(_Iter __iter) {
{ *__iter };
{ ++__iter } -> same_as<_Iter&>;
};
diff --git a/libcxx/include/__iterator/data.h b/libcxx/include/__iterator/data.h
index 398673906101..b7c1603652b0 100644
--- a/libcxx/include/__iterator/data.h
+++ b/libcxx/include/__iterator/data.h
@@ -23,12 +23,12 @@ _LIBCPP_BEGIN_NAMESPACE_STD
#if _LIBCPP_STD_VER >= 17
template <class _Cont>
-constexpr _LIBCPP_HIDE_FROM_ABI auto data(_Cont& __c) _NOEXCEPT_(noexcept(__c.data())) -> decltype(__c.data()) {
+constexpr _LIBCPP_HIDE_FROM_ABI auto data(_Cont& __c) noexcept(noexcept(__c.data())) -> decltype(__c.data()) {
return __c.data();
}
template <class _Cont>
-constexpr _LIBCPP_HIDE_FROM_ABI auto data(const _Cont& __c) _NOEXCEPT_(noexcept(__c.data())) -> decltype(__c.data()) {
+constexpr _LIBCPP_HIDE_FROM_ABI auto data(const _Cont& __c) noexcept(noexcept(__c.data())) -> decltype(__c.data()) {
return __c.data();
}
diff --git a/libcxx/include/__iterator/iter_swap.h b/libcxx/include/__iterator/iter_swap.h
index 52c3f095e7fb..01ab1b97d650 100644
--- a/libcxx/include/__iterator/iter_swap.h
+++ b/libcxx/include/__iterator/iter_swap.h
@@ -42,7 +42,7 @@ void iter_swap(_I1, _I2) = delete;
template <class _T1, class _T2>
concept __unqualified_iter_swap =
- (__class_or_enum<remove_cvref_t<_T1>> || __class_or_enum<remove_cvref_t<_T2>>)&&requires(_T1&& __x, _T2&& __y) {
+ (__class_or_enum<remove_cvref_t<_T1>> || __class_or_enum<remove_cvref_t<_T2>>) && requires(_T1&& __x, _T2&& __y) {
// NOLINTNEXTLINE(libcpp-robust-against-adl) iter_swap ADL calls should only be made through ranges::iter_swap
iter_swap(std::forward<_T1>(__x), std::forward<_T2>(__y));
};
diff --git a/libcxx/include/__iterator/move_iterator.h b/libcxx/include/__iterator/move_iterator.h
index 6382c947060b..c266022159a1 100644
--- a/libcxx/include/__iterator/move_iterator.h
+++ b/libcxx/include/__iterator/move_iterator.h
@@ -292,8 +292,8 @@ operator>=(const move_iterator<_Iter1>& __x, const move_iterator<_Iter2>& __y) {
#if _LIBCPP_STD_VER >= 20
template <class _Iter1, three_way_comparable_with<_Iter1> _Iter2>
inline _LIBCPP_HIDE_FROM_ABI constexpr auto
-operator<=>(const move_iterator<_Iter1>& __x, const move_iterator<_Iter2>& __y)
- -> compare_three_way_result_t<_Iter1, _Iter2> {
+operator<=>(const move_iterator<_Iter1>& __x,
+ const move_iterator<_Iter2>& __y) -> compare_three_way_result_t<_Iter1, _Iter2> {
return __x.base() <=> __y.base();
}
#endif // _LIBCPP_STD_VER >= 20
diff --git a/libcxx/include/__iterator/reverse_iterator.h b/libcxx/include/__iterator/reverse_iterator.h
index 2ae146193485..50c0f21eaa28 100644
--- a/libcxx/include/__iterator/reverse_iterator.h
+++ b/libcxx/include/__iterator/reverse_iterator.h
@@ -184,7 +184,7 @@ public:
#if _LIBCPP_STD_VER >= 20
_LIBCPP_HIDE_FROM_ABI friend constexpr iter_rvalue_reference_t<_Iter> iter_move(const reverse_iterator& __i) noexcept(
- is_nothrow_copy_constructible_v<_Iter>&& noexcept(ranges::iter_move(--std::declval<_Iter&>()))) {
+ is_nothrow_copy_constructible_v<_Iter> && noexcept(ranges::iter_move(--std::declval<_Iter&>()))) {
auto __tmp = __i.base();
return ranges::iter_move(--__tmp);
}
@@ -192,9 +192,8 @@ public:
template <indirectly_swappable<_Iter> _Iter2>
_LIBCPP_HIDE_FROM_ABI friend constexpr void
iter_swap(const reverse_iterator& __x, const reverse_iterator<_Iter2>& __y) noexcept(
- is_nothrow_copy_constructible_v<_Iter> &&
- is_nothrow_copy_constructible_v<_Iter2>&& noexcept(
- ranges::iter_swap(--std::declval<_Iter&>(), --std::declval<_Iter2&>()))) {
+ is_nothrow_copy_constructible_v<_Iter> && is_nothrow_copy_constructible_v<_Iter2> &&
+ noexcept(ranges::iter_swap(--std::declval<_Iter&>(), --std::declval<_Iter2&>()))) {
auto __xtmp = __x.base();
auto __ytmp = __y.base();
ranges::iter_swap(--__xtmp, --__ytmp);
@@ -285,8 +284,8 @@ operator<=>(const reverse_iterator<_Iter1>& __x, const reverse_iterator<_Iter2>&
#ifndef _LIBCPP_CXX03_LANG
template <class _Iter1, class _Iter2>
inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 auto
-operator-(const reverse_iterator<_Iter1>& __x, const reverse_iterator<_Iter2>& __y)
- -> decltype(__y.base() - __x.base()) {
+operator-(const reverse_iterator<_Iter1>& __x,
+ const reverse_iterator<_Iter2>& __y) -> decltype(__y.base() - __x.base()) {
return __y.base() - __x.base();
}
#else
diff --git a/libcxx/include/__iterator/size.h b/libcxx/include/__iterator/size.h
index eac3ccf522c3..876e6963f77d 100644
--- a/libcxx/include/__iterator/size.h
+++ b/libcxx/include/__iterator/size.h
@@ -24,7 +24,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD
#if _LIBCPP_STD_VER >= 17
template <class _Cont>
-_LIBCPP_HIDE_FROM_ABI constexpr auto size(const _Cont& __c) _NOEXCEPT_(noexcept(__c.size())) -> decltype(__c.size()) {
+_LIBCPP_HIDE_FROM_ABI constexpr auto size(const _Cont& __c) noexcept(noexcept(__c.size())) -> decltype(__c.size()) {
return __c.size();
}
@@ -35,9 +35,9 @@ _LIBCPP_HIDE_FROM_ABI constexpr size_t size(const _Tp (&)[_Sz]) noexcept {
# if _LIBCPP_STD_VER >= 20
template <class _Cont>
-_LIBCPP_HIDE_FROM_ABI constexpr auto ssize(const _Cont& __c)
- _NOEXCEPT_(noexcept(static_cast<common_type_t<ptrdiff_t, make_signed_t<decltype(__c.size())>>>(__c.size())))
- -> common_type_t<ptrdiff_t, make_signed_t<decltype(__c.size())>> {
+_LIBCPP_HIDE_FROM_ABI constexpr auto
+ssize(const _Cont& __c) noexcept(noexcept(static_cast<common_type_t<ptrdiff_t, make_signed_t<decltype(__c.size())>>>(
+ __c.size()))) -> common_type_t<ptrdiff_t, make_signed_t<decltype(__c.size())>> {
return static_cast<common_type_t<ptrdiff_t, make_signed_t<decltype(__c.size())>>>(__c.size());
}
diff --git a/libcxx/include/__iterator/wrap_iter.h b/libcxx/include/__iterator/wrap_iter.h
index 3124826189ad..252d13b26c9e 100644
--- a/libcxx/include/__iterator/wrap_iter.h
+++ b/libcxx/include/__iterator/wrap_iter.h
@@ -186,8 +186,8 @@ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14
operator-(const __wrap_iter<_Iter1>& __x,
const __wrap_iter<_Iter2>& __y) _NOEXCEPT->decltype(__x.base() - __y.base())
#else
- typename __wrap_iter<_Iter1>::difference_type
- operator-(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter2>& __y) _NOEXCEPT
+typename __wrap_iter<_Iter1>::difference_type
+operator-(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter2>& __y) _NOEXCEPT
#endif // C++03
{
return __x.base() - __y.base();
diff --git a/libcxx/include/__locale b/libcxx/include/__locale
index 1e97c7594c8b..4b382764b446 100644
--- a/libcxx/include/__locale
+++ b/libcxx/include/__locale
@@ -49,6 +49,9 @@ _LIBCPP_HIDE_FROM_ABI const _Facet& use_facet(const locale&);
class _LIBCPP_EXPORTED_FROM_ABI locale {
public:
+ // locale is essentially a shared_ptr that doesn't support weak_ptrs and never got a move constructor.
+ using __trivially_relocatable = locale;
+
// types:
class _LIBCPP_EXPORTED_FROM_ABI facet;
class _LIBCPP_EXPORTED_FROM_ABI id;
diff --git a/libcxx/include/__locale_dir/locale_base_api/locale_guard.h b/libcxx/include/__locale_dir/locale_base_api/locale_guard.h
index b7e3be756e71..2baacb51cd06 100644
--- a/libcxx/include/__locale_dir/locale_base_api/locale_guard.h
+++ b/libcxx/include/__locale_dir/locale_base_api/locale_guard.h
@@ -30,9 +30,8 @@ struct __libcpp_locale_guard {
locale_t __old_loc_;
-private:
- __libcpp_locale_guard(__libcpp_locale_guard const&);
- __libcpp_locale_guard& operator=(__libcpp_locale_guard const&);
+ __libcpp_locale_guard(__libcpp_locale_guard const&) = delete;
+ __libcpp_locale_guard& operator=(__libcpp_locale_guard const&) = delete;
};
#elif defined(_LIBCPP_MSVCRT_LIKE)
struct __libcpp_locale_guard {
diff --git a/libcxx/include/__math/exponential_functions.h b/libcxx/include/__math/exponential_functions.h
index f8d611b9e486..109c3349970f 100644
--- a/libcxx/include/__math/exponential_functions.h
+++ b/libcxx/include/__math/exponential_functions.h
@@ -160,7 +160,7 @@ inline _LIBCPP_HIDE_FROM_ABI long double pow(long double __x, long double __y) _
template <class _A1, class _A2, __enable_if_t<is_arithmetic<_A1>::value && is_arithmetic<_A2>::value, int> = 0>
inline _LIBCPP_HIDE_FROM_ABI typename __promote<_A1, _A2>::type pow(_A1 __x, _A2 __y) _NOEXCEPT {
using __result_type = typename __promote<_A1, _A2>::type;
- static_assert((!(_IsSame<_A1, __result_type>::value && _IsSame<_A2, __result_type>::value)), "");
+ static_assert(!(_IsSame<_A1, __result_type>::value && _IsSame<_A2, __result_type>::value), "");
return __math::pow((__result_type)__x, (__result_type)__y);
}
diff --git a/libcxx/include/__math/fdim.h b/libcxx/include/__math/fdim.h
index 6f90809302d7..dc1b4ecc07dc 100644
--- a/libcxx/include/__math/fdim.h
+++ b/libcxx/include/__math/fdim.h
@@ -37,7 +37,7 @@ inline _LIBCPP_HIDE_FROM_ABI long double fdim(long double __x, long double __y)
template <class _A1, class _A2, __enable_if_t<is_arithmetic<_A1>::value && is_arithmetic<_A2>::value, int> = 0>
inline _LIBCPP_HIDE_FROM_ABI typename __promote<_A1, _A2>::type fdim(_A1 __x, _A2 __y) _NOEXCEPT {
using __result_type = typename __promote<_A1, _A2>::type;
- static_assert((!(_IsSame<_A1, __result_type>::value && _IsSame<_A2, __result_type>::value)), "");
+ static_assert(!(_IsSame<_A1, __result_type>::value && _IsSame<_A2, __result_type>::value), "");
return __math::fdim((__result_type)__x, (__result_type)__y);
}
diff --git a/libcxx/include/__math/fma.h b/libcxx/include/__math/fma.h
index 9e14f72dcaa0..6ba7a5a2d26d 100644
--- a/libcxx/include/__math/fma.h
+++ b/libcxx/include/__math/fma.h
@@ -42,9 +42,9 @@ template <class _A1,
__enable_if_t<is_arithmetic<_A1>::value && is_arithmetic<_A2>::value && is_arithmetic<_A3>::value, int> = 0>
inline _LIBCPP_HIDE_FROM_ABI typename __promote<_A1, _A2, _A3>::type fma(_A1 __x, _A2 __y, _A3 __z) _NOEXCEPT {
using __result_type = typename __promote<_A1, _A2, _A3>::type;
- static_assert((!(_IsSame<_A1, __result_type>::value && _IsSame<_A2, __result_type>::value &&
- _IsSame<_A3, __result_type>::value)),
- "");
+ static_assert(
+ !(_IsSame<_A1, __result_type>::value && _IsSame<_A2, __result_type>::value && _IsSame<_A3, __result_type>::value),
+ "");
return __builtin_fma((__result_type)__x, (__result_type)__y, (__result_type)__z);
}
diff --git a/libcxx/include/__math/hypot.h b/libcxx/include/__math/hypot.h
index 8e2c0f5b6b6d..1bf193a9ab7e 100644
--- a/libcxx/include/__math/hypot.h
+++ b/libcxx/include/__math/hypot.h
@@ -37,7 +37,7 @@ inline _LIBCPP_HIDE_FROM_ABI long double hypot(long double __x, long double __y)
template <class _A1, class _A2, __enable_if_t<is_arithmetic<_A1>::value && is_arithmetic<_A2>::value, int> = 0>
inline _LIBCPP_HIDE_FROM_ABI typename __promote<_A1, _A2>::type hypot(_A1 __x, _A2 __y) _NOEXCEPT {
using __result_type = typename __promote<_A1, _A2>::type;
- static_assert((!(_IsSame<_A1, __result_type>::value && _IsSame<_A2, __result_type>::value)), "");
+ static_assert(!(_IsSame<_A1, __result_type>::value && _IsSame<_A2, __result_type>::value), "");
return __math::hypot((__result_type)__x, (__result_type)__y);
}
diff --git a/libcxx/include/__math/inverse_trigonometric_functions.h b/libcxx/include/__math/inverse_trigonometric_functions.h
index 30b1440b0b11..cd98b46a6aab 100644
--- a/libcxx/include/__math/inverse_trigonometric_functions.h
+++ b/libcxx/include/__math/inverse_trigonometric_functions.h
@@ -88,7 +88,7 @@ inline _LIBCPP_HIDE_FROM_ABI long double atan2(long double __y, long double __x)
template <class _A1, class _A2, __enable_if_t<is_arithmetic<_A1>::value && is_arithmetic<_A2>::value, int> = 0>
inline _LIBCPP_HIDE_FROM_ABI typename __promote<_A1, _A2>::type atan2(_A1 __y, _A2 __x) _NOEXCEPT {
using __result_type = typename __promote<_A1, _A2>::type;
- static_assert((!(_IsSame<_A1, __result_type>::value && _IsSame<_A2, __result_type>::value)), "");
+ static_assert(!(_IsSame<_A1, __result_type>::value && _IsSame<_A2, __result_type>::value), "");
return __math::atan2((__result_type)__y, (__result_type)__x);
}
diff --git a/libcxx/include/__math/min_max.h b/libcxx/include/__math/min_max.h
index c2c4f6b64560..27997b44910a 100644
--- a/libcxx/include/__math/min_max.h
+++ b/libcxx/include/__math/min_max.h
@@ -41,7 +41,7 @@ _LIBCPP_NODISCARD inline _LIBCPP_HIDE_FROM_ABI long double fmax(long double __x,
template <class _A1, class _A2, __enable_if_t<is_arithmetic<_A1>::value && is_arithmetic<_A2>::value, int> = 0>
_LIBCPP_NODISCARD inline _LIBCPP_HIDE_FROM_ABI typename __promote<_A1, _A2>::type fmax(_A1 __x, _A2 __y) _NOEXCEPT {
using __result_type = typename __promote<_A1, _A2>::type;
- static_assert((!(_IsSame<_A1, __result_type>::value && _IsSame<_A2, __result_type>::value)), "");
+ static_assert(!(_IsSame<_A1, __result_type>::value && _IsSame<_A2, __result_type>::value), "");
return __math::fmax((__result_type)__x, (__result_type)__y);
}
@@ -63,7 +63,7 @@ _LIBCPP_NODISCARD inline _LIBCPP_HIDE_FROM_ABI long double fmin(long double __x,
template <class _A1, class _A2, __enable_if_t<is_arithmetic<_A1>::value && is_arithmetic<_A2>::value, int> = 0>
_LIBCPP_NODISCARD inline _LIBCPP_HIDE_FROM_ABI typename __promote<_A1, _A2>::type fmin(_A1 __x, _A2 __y) _NOEXCEPT {
using __result_type = typename __promote<_A1, _A2>::type;
- static_assert((!(_IsSame<_A1, __result_type>::value && _IsSame<_A2, __result_type>::value)), "");
+ static_assert(!(_IsSame<_A1, __result_type>::value && _IsSame<_A2, __result_type>::value), "");
return __math::fmin((__result_type)__x, (__result_type)__y);
}
diff --git a/libcxx/include/__math/modulo.h b/libcxx/include/__math/modulo.h
index f6cdb956cf88..c8ea506f37d7 100644
--- a/libcxx/include/__math/modulo.h
+++ b/libcxx/include/__math/modulo.h
@@ -39,7 +39,7 @@ inline _LIBCPP_HIDE_FROM_ABI long double fmod(long double __x, long double __y)
template <class _A1, class _A2, __enable_if_t<is_arithmetic<_A1>::value && is_arithmetic<_A2>::value, int> = 0>
inline _LIBCPP_HIDE_FROM_ABI typename __promote<_A1, _A2>::type fmod(_A1 __x, _A2 __y) _NOEXCEPT {
using __result_type = typename __promote<_A1, _A2>::type;
- static_assert((!(_IsSame<_A1, __result_type>::value && _IsSame<_A2, __result_type>::value)), "");
+ static_assert(!(_IsSame<_A1, __result_type>::value && _IsSame<_A2, __result_type>::value), "");
return __math::fmod((__result_type)__x, (__result_type)__y);
}
diff --git a/libcxx/include/__math/remainder.h b/libcxx/include/__math/remainder.h
index 025fb53aaa20..0fbf0b8ef97b 100644
--- a/libcxx/include/__math/remainder.h
+++ b/libcxx/include/__math/remainder.h
@@ -40,7 +40,7 @@ inline _LIBCPP_HIDE_FROM_ABI long double remainder(long double __x, long double
template <class _A1, class _A2, __enable_if_t<is_arithmetic<_A1>::value && is_arithmetic<_A2>::value, int> = 0>
inline _LIBCPP_HIDE_FROM_ABI typename __promote<_A1, _A2>::type remainder(_A1 __x, _A2 __y) _NOEXCEPT {
using __result_type = typename __promote<_A1, _A2>::type;
- static_assert((!(_IsSame<_A1, __result_type>::value && _IsSame<_A2, __result_type>::value)), "");
+ static_assert(!(_IsSame<_A1, __result_type>::value && _IsSame<_A2, __result_type>::value), "");
return __math::remainder((__result_type)__x, (__result_type)__y);
}
@@ -62,7 +62,7 @@ inline _LIBCPP_HIDE_FROM_ABI long double remquo(long double __x, long double __y
template <class _A1, class _A2, __enable_if_t<is_arithmetic<_A1>::value && is_arithmetic<_A2>::value, int> = 0>
inline _LIBCPP_HIDE_FROM_ABI typename __promote<_A1, _A2>::type remquo(_A1 __x, _A2 __y, int* __z) _NOEXCEPT {
using __result_type = typename __promote<_A1, _A2>::type;
- static_assert((!(_IsSame<_A1, __result_type>::value && _IsSame<_A2, __result_type>::value)), "");
+ static_assert(!(_IsSame<_A1, __result_type>::value && _IsSame<_A2, __result_type>::value), "");
return __math::remquo((__result_type)__x, (__result_type)__y, __z);
}
diff --git a/libcxx/include/__math/rounding_functions.h b/libcxx/include/__math/rounding_functions.h
index 33e6cbc37d60..f7246ba7fed0 100644
--- a/libcxx/include/__math/rounding_functions.h
+++ b/libcxx/include/__math/rounding_functions.h
@@ -160,7 +160,7 @@ inline _LIBCPP_HIDE_FROM_ABI long double nextafter(long double __x, long double
template <class _A1, class _A2, __enable_if_t<is_arithmetic<_A1>::value && is_arithmetic<_A2>::value, int> = 0>
inline _LIBCPP_HIDE_FROM_ABI typename __promote<_A1, _A2>::type nextafter(_A1 __x, _A2 __y) _NOEXCEPT {
using __result_type = typename __promote<_A1, _A2>::type;
- static_assert((!(_IsSame<_A1, __result_type>::value && _IsSame<_A2, __result_type>::value)), "");
+ static_assert(!(_IsSame<_A1, __result_type>::value && _IsSame<_A2, __result_type>::value), "");
return __math::nextafter((__result_type)__x, (__result_type)__y);
}
diff --git a/libcxx/include/__mdspan/extents.h b/libcxx/include/__mdspan/extents.h
index 16fac1354961..fea0decd8c6a 100644
--- a/libcxx/include/__mdspan/extents.h
+++ b/libcxx/include/__mdspan/extents.h
@@ -165,7 +165,7 @@ public:
template <class... _DynVals>
requires(sizeof...(_DynVals) != __size_dynamic_)
_LIBCPP_HIDE_FROM_ABI constexpr __maybe_static_array(_DynVals... __vals) {
- static_assert((sizeof...(_DynVals) == __size_), "Invalid number of values.");
+ static_assert(sizeof...(_DynVals) == __size_, "Invalid number of values.");
_TDynamic __values[__size_] = {static_cast<_TDynamic>(__vals)...};
for (size_t __i = 0; __i < __size_; __i++) {
_TStatic __static_val = _StaticValues::__get(__i);
@@ -185,7 +185,7 @@ public:
template <class _Tp, size_t _Size>
requires(_Size != __size_dynamic_)
_LIBCPP_HIDE_FROM_ABI constexpr __maybe_static_array(const span<_Tp, _Size>& __vals) {
- static_assert((_Size == __size_) || (__size_ == dynamic_extent));
+ static_assert(_Size == __size_ || __size_ == dynamic_extent);
for (size_t __i = 0; __i < __size_; __i++) {
_TStatic __static_val = _StaticValues::__get(__i);
if (__static_val == _DynTag) {
@@ -455,8 +455,15 @@ template <class _IndexType, size_t _Rank>
using dextents = typename __mdspan_detail::__make_dextents<_IndexType, _Rank>::type;
// Deduction guide for extents
+# if _LIBCPP_STD_VER >= 26
template <class... _IndexTypes>
-extents(_IndexTypes...) -> extents<size_t, size_t(((void)sizeof(_IndexTypes), dynamic_extent))...>;
+ requires(is_convertible_v<_IndexTypes, size_t> && ...)
+explicit extents(_IndexTypes...) -> extents<size_t, __maybe_static_ext<_IndexTypes>...>;
+# else
+template <class... _IndexTypes>
+ requires(is_convertible_v<_IndexTypes, size_t> && ...)
+explicit extents(_IndexTypes...) -> extents<size_t, size_t(((void)sizeof(_IndexTypes), dynamic_extent))...>;
+# endif
namespace __mdspan_detail {
diff --git a/libcxx/include/__mdspan/layout_left.h b/libcxx/include/__mdspan/layout_left.h
index fd644fa0c532..d058cbccffd9 100644
--- a/libcxx/include/__mdspan/layout_left.h
+++ b/libcxx/include/__mdspan/layout_left.h
@@ -67,7 +67,7 @@ private:
return true;
}
- static_assert((extents_type::rank_dynamic() > 0) || __required_span_size_is_representable(extents_type()),
+ static_assert(extents_type::rank_dynamic() > 0 || __required_span_size_is_representable(extents_type()),
"layout_left::mapping product of static extents must be representable as index_type.");
public:
diff --git a/libcxx/include/__mdspan/layout_right.h b/libcxx/include/__mdspan/layout_right.h
index 8e64d07dd523..6842e9dc37fd 100644
--- a/libcxx/include/__mdspan/layout_right.h
+++ b/libcxx/include/__mdspan/layout_right.h
@@ -66,7 +66,7 @@ private:
return true;
}
- static_assert((extents_type::rank_dynamic() > 0) || __required_span_size_is_representable(extents_type()),
+ static_assert(extents_type::rank_dynamic() > 0 || __required_span_size_is_representable(extents_type()),
"layout_right::mapping product of static extents must be representable as index_type.");
public:
diff --git a/libcxx/include/__mdspan/layout_stride.h b/libcxx/include/__mdspan/layout_stride.h
index 77934bfa11d9..86148ac849ec 100644
--- a/libcxx/include/__mdspan/layout_stride.h
+++ b/libcxx/include/__mdspan/layout_stride.h
@@ -149,7 +149,7 @@ private:
}
}
- static_assert((extents_type::rank_dynamic() > 0) || __required_span_size_is_representable(extents_type()),
+ static_assert(extents_type::rank_dynamic() > 0 || __required_span_size_is_representable(extents_type()),
"layout_stride::mapping product of static extents must be representable as index_type.");
public:
diff --git a/libcxx/include/__mdspan/mdspan.h b/libcxx/include/__mdspan/mdspan.h
index 09665af316e7..1ff4fd4ba4a8 100644
--- a/libcxx/include/__mdspan/mdspan.h
+++ b/libcxx/include/__mdspan/mdspan.h
@@ -274,8 +274,8 @@ explicit mdspan(_ElementType*,
# else
template <class _ElementType, class... _OtherIndexTypes>
requires((is_convertible_v<_OtherIndexTypes, size_t> && ...) && (sizeof...(_OtherIndexTypes) > 0))
-explicit mdspan(_ElementType*, _OtherIndexTypes...)
- -> mdspan<_ElementType, dextents<size_t, sizeof...(_OtherIndexTypes)>>;
+explicit mdspan(_ElementType*,
+ _OtherIndexTypes...) -> mdspan<_ElementType, dextents<size_t, sizeof...(_OtherIndexTypes)>>;
# endif
template <class _Pointer>
diff --git a/libcxx/include/__memory/allocate_at_least.h b/libcxx/include/__memory/allocate_at_least.h
index b2e5dd3ff98a..df73d9a2e94a 100644
--- a/libcxx/include/__memory/allocate_at_least.h
+++ b/libcxx/include/__memory/allocate_at_least.h
@@ -35,9 +35,9 @@ struct __allocation_result {
};
template <class _Alloc>
-_LIBCPP_NODISCARD _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR
- __allocation_result<typename allocator_traits<_Alloc>::pointer>
- __allocate_at_least(_Alloc& __alloc, size_t __n) {
+_LIBCPP_NODISCARD _LIBCPP_HIDE_FROM_ABI
+_LIBCPP_CONSTEXPR __allocation_result<typename allocator_traits<_Alloc>::pointer>
+__allocate_at_least(_Alloc& __alloc, size_t __n) {
return {__alloc.allocate(__n), __n};
}
diff --git a/libcxx/include/__memory/allocator.h b/libcxx/include/__memory/allocator.h
index 215d3832f9ef..2d8624e771bc 100644
--- a/libcxx/include/__memory/allocator.h
+++ b/libcxx/include/__memory/allocator.h
@@ -14,6 +14,7 @@
#include <__memory/addressof.h>
#include <__memory/allocate_at_least.h>
#include <__memory/allocator_traits.h>
+#include <__type_traits/is_const.h>
#include <__type_traits/is_constant_evaluated.h>
#include <__type_traits/is_same.h>
#include <__type_traits/is_void.h>
@@ -36,8 +37,6 @@ class allocator;
// Specializing allocator<void> is deprecated, but not using it.
template <>
class _LIBCPP_TEMPLATE_VIS allocator<void> {
-# if _LIBCPP_STD_VER <= 17
-
public:
_LIBCPP_DEPRECATED_IN_CXX17 typedef void* pointer;
_LIBCPP_DEPRECATED_IN_CXX17 typedef const void* const_pointer;
@@ -47,13 +46,12 @@ public:
struct _LIBCPP_DEPRECATED_IN_CXX17 rebind {
typedef allocator<_Up> other;
};
-# endif
};
+// TODO(LLVM 20): Remove the escape hatch
+# ifdef _LIBCPP_ENABLE_REMOVED_ALLOCATOR_CONST
template <>
class _LIBCPP_TEMPLATE_VIS allocator<const void> {
-# if _LIBCPP_STD_VER <= 17
-
public:
_LIBCPP_DEPRECATED_IN_CXX17 typedef const void* pointer;
_LIBCPP_DEPRECATED_IN_CXX17 typedef const void* const_pointer;
@@ -63,9 +61,9 @@ public:
struct _LIBCPP_DEPRECATED_IN_CXX17 rebind {
typedef allocator<_Up> other;
};
-# endif
};
-#endif
+# endif // _LIBCPP_ENABLE_REMOVED_ALLOCATOR_CONST
+#endif // _LIBCPP_STD_VER <= 17
// This class provides a non-trivial default constructor to the class that derives from it
// if the condition is satisfied.
@@ -94,6 +92,7 @@ struct __non_trivial_if<true, _Unique> {
template <class _Tp>
class _LIBCPP_TEMPLATE_VIS allocator : private __non_trivial_if<!is_void<_Tp>::value, allocator<_Tp> > {
+ static_assert(!is_const<_Tp>::value, "std::allocator does not support const types");
static_assert(!is_volatile<_Tp>::value, "std::allocator does not support volatile types");
public:
@@ -170,6 +169,8 @@ public:
#endif
};
+// TODO(LLVM 20): Remove the escape hatch
+#ifdef _LIBCPP_ENABLE_REMOVED_ALLOCATOR_CONST
template <class _Tp>
class _LIBCPP_TEMPLATE_VIS allocator<const _Tp>
: private __non_trivial_if<!is_void<_Tp>::value, allocator<const _Tp> > {
@@ -180,9 +181,9 @@ public:
typedef ptrdiff_t difference_type;
typedef const _Tp value_type;
typedef true_type propagate_on_container_move_assignment;
-#if _LIBCPP_STD_VER <= 23 || defined(_LIBCPP_ENABLE_CXX26_REMOVED_ALLOCATOR_MEMBERS)
+# if _LIBCPP_STD_VER <= 23 || defined(_LIBCPP_ENABLE_CXX26_REMOVED_ALLOCATOR_MEMBERS)
_LIBCPP_DEPRECATED_IN_CXX23 typedef true_type is_always_equal;
-#endif
+# endif
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 allocator() _NOEXCEPT = default;
@@ -199,11 +200,11 @@ public:
}
}
-#if _LIBCPP_STD_VER >= 23
+# if _LIBCPP_STD_VER >= 23
[[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr allocation_result<const _Tp*> allocate_at_least(size_t __n) {
return {allocate(__n), __n};
}
-#endif
+# endif
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void deallocate(const _Tp* __p, size_t __n) {
if (__libcpp_is_constant_evaluated()) {
@@ -214,7 +215,7 @@ public:
}
// C++20 Removed members
-#if _LIBCPP_STD_VER <= 17
+# if _LIBCPP_STD_VER <= 17
_LIBCPP_DEPRECATED_IN_CXX17 typedef const _Tp* pointer;
_LIBCPP_DEPRECATED_IN_CXX17 typedef const _Tp* const_pointer;
_LIBCPP_DEPRECATED_IN_CXX17 typedef const _Tp& reference;
@@ -243,8 +244,9 @@ public:
}
_LIBCPP_DEPRECATED_IN_CXX17 _LIBCPP_HIDE_FROM_ABI void destroy(pointer __p) { __p->~_Tp(); }
-#endif
+# endif
};
+#endif // _LIBCPP_ENABLE_REMOVED_ALLOCATOR_CONST
template <class _Tp, class _Up>
inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 bool
diff --git a/libcxx/include/__memory/allocator_traits.h b/libcxx/include/__memory/allocator_traits.h
index 47fe132d15cb..ac564f0e6fa0 100644
--- a/libcxx/include/__memory/allocator_traits.h
+++ b/libcxx/include/__memory/allocator_traits.h
@@ -16,6 +16,7 @@
#include <__type_traits/enable_if.h>
#include <__type_traits/is_constructible.h>
#include <__type_traits/is_empty.h>
+#include <__type_traits/is_same.h>
#include <__type_traits/make_unsigned.h>
#include <__type_traits/remove_reference.h>
#include <__type_traits/void_t.h>
@@ -372,6 +373,14 @@ template <class _Traits, class _Tp>
using __rebind_alloc = typename _Traits::template rebind_alloc<_Tp>::other;
#endif
+template <class _Alloc>
+struct __check_valid_allocator : true_type {
+ using _Traits = std::allocator_traits<_Alloc>;
+ static_assert(is_same<_Alloc, __rebind_alloc<_Traits, typename _Traits::value_type> >::value,
+ "[allocator.requirements] states that rebinding an allocator to the same type should result in the "
+ "original allocator");
+};
+
// __is_default_allocator
template <class _Tp>
struct __is_default_allocator : false_type {};
diff --git a/libcxx/include/__memory/compressed_pair.h b/libcxx/include/__memory/compressed_pair.h
index 328849d7cc12..40e5cfc35fb0 100644
--- a/libcxx/include/__memory/compressed_pair.h
+++ b/libcxx/include/__memory/compressed_pair.h
@@ -150,7 +150,7 @@ public:
}
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 void swap(__compressed_pair& __x)
- _NOEXCEPT_(__is_nothrow_swappable<_T1>::value&& __is_nothrow_swappable<_T2>::value) {
+ _NOEXCEPT_(__is_nothrow_swappable_v<_T1>&& __is_nothrow_swappable_v<_T2>) {
using std::swap;
swap(first(), __x.first());
swap(second(), __x.second());
@@ -160,7 +160,7 @@ public:
template <class _T1, class _T2>
inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 void
swap(__compressed_pair<_T1, _T2>& __x, __compressed_pair<_T1, _T2>& __y)
- _NOEXCEPT_(__is_nothrow_swappable<_T1>::value&& __is_nothrow_swappable<_T2>::value) {
+ _NOEXCEPT_(__is_nothrow_swappable_v<_T1>&& __is_nothrow_swappable_v<_T2>) {
__x.swap(__y);
}
diff --git a/libcxx/include/__memory/pointer_traits.h b/libcxx/include/__memory/pointer_traits.h
index 1082e378537e..fcd2c3edd9f6 100644
--- a/libcxx/include/__memory/pointer_traits.h
+++ b/libcxx/include/__memory/pointer_traits.h
@@ -202,16 +202,16 @@ struct _IsFancyPointer {
// enable_if is needed here to avoid instantiating checks for fancy pointers on raw pointers
template <class _Pointer, __enable_if_t< _And<is_class<_Pointer>, _IsFancyPointer<_Pointer> >::value, int> = 0>
-_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR
- __decay_t<decltype(__to_address_helper<_Pointer>::__call(std::declval<const _Pointer&>()))>
- __to_address(const _Pointer& __p) _NOEXCEPT {
+_LIBCPP_HIDE_FROM_ABI
+_LIBCPP_CONSTEXPR __decay_t<decltype(__to_address_helper<_Pointer>::__call(std::declval<const _Pointer&>()))>
+__to_address(const _Pointer& __p) _NOEXCEPT {
return __to_address_helper<_Pointer>::__call(__p);
}
template <class _Pointer, class>
struct __to_address_helper {
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR static decltype(std::__to_address(
- std::declval<const _Pointer&>().operator->()))
+ _LIBCPP_HIDE_FROM_ABI
+ _LIBCPP_CONSTEXPR static decltype(std::__to_address(std::declval<const _Pointer&>().operator->()))
__call(const _Pointer& __p) _NOEXCEPT {
return std::__to_address(__p.operator->());
}
@@ -220,8 +220,8 @@ struct __to_address_helper {
template <class _Pointer>
struct __to_address_helper<_Pointer,
decltype((void)pointer_traits<_Pointer>::to_address(std::declval<const _Pointer&>()))> {
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR static decltype(pointer_traits<_Pointer>::to_address(
- std::declval<const _Pointer&>()))
+ _LIBCPP_HIDE_FROM_ABI
+ _LIBCPP_CONSTEXPR static decltype(pointer_traits<_Pointer>::to_address(std::declval<const _Pointer&>()))
__call(const _Pointer& __p) _NOEXCEPT {
return pointer_traits<_Pointer>::to_address(__p);
}
@@ -234,8 +234,8 @@ inline _LIBCPP_HIDE_FROM_ABI constexpr auto to_address(_Tp* __p) noexcept {
}
template <class _Pointer>
-inline _LIBCPP_HIDE_FROM_ABI constexpr auto to_address(const _Pointer& __p) noexcept
- -> decltype(std::__to_address(__p)) {
+inline _LIBCPP_HIDE_FROM_ABI constexpr auto
+to_address(const _Pointer& __p) noexcept -> decltype(std::__to_address(__p)) {
return std::__to_address(__p);
}
#endif
diff --git a/libcxx/include/__memory/shared_ptr.h b/libcxx/include/__memory/shared_ptr.h
index 00db96185be7..d487e4fbe3a9 100644
--- a/libcxx/include/__memory/shared_ptr.h
+++ b/libcxx/include/__memory/shared_ptr.h
@@ -259,7 +259,7 @@ struct __shared_ptr_emplace : __shared_weak_count {
class _Allocator = _Alloc,
__enable_if_t<!is_same<typename _Allocator::value_type, __for_overwrite_tag>::value, int> = 0>
_LIBCPP_HIDE_FROM_ABI explicit __shared_ptr_emplace(_Alloc __a, _Args&&... __args) : __storage_(std::move(__a)) {
- using _TpAlloc = typename __allocator_traits_rebind<_Alloc, _Tp>::type;
+ using _TpAlloc = typename __allocator_traits_rebind<_Alloc, __remove_cv_t<_Tp> >::type;
_TpAlloc __tmp(*__get_alloc());
allocator_traits<_TpAlloc>::construct(__tmp, __get_elem(), std::forward<_Args>(__args)...);
}
@@ -278,7 +278,7 @@ private:
template <class _Allocator = _Alloc,
__enable_if_t<!is_same<typename _Allocator::value_type, __for_overwrite_tag>::value, int> = 0>
_LIBCPP_HIDE_FROM_ABI void __on_zero_shared_impl() _NOEXCEPT {
- using _TpAlloc = typename __allocator_traits_rebind<_Allocator, _Tp>::type;
+ using _TpAlloc = typename __allocator_traits_rebind<_Allocator, __remove_cv_t<_Tp> >::type;
_TpAlloc __tmp(*__get_alloc());
allocator_traits<_TpAlloc>::destroy(__tmp, __get_elem());
}
@@ -403,7 +403,7 @@ struct __shared_ptr_deleter_ctor_reqs {
__well_formed_deleter<_Dp, _Yp*>::value;
};
-template <class _Dp, class _Tp>
+template <class _Dp>
using __shared_ptr_nullptr_deleter_ctor_reqs = _And<is_move_constructible<_Dp>, __well_formed_deleter<_Dp, nullptr_t> >;
#if defined(_LIBCPP_ABI_ENABLE_SHARED_PTR_TRIVIAL_ABI)
@@ -414,6 +414,8 @@ using __shared_ptr_nullptr_deleter_ctor_reqs = _And<is_move_constructible<_Dp>,
template <class _Tp>
class _LIBCPP_SHARED_PTR_TRIVIAL_ABI _LIBCPP_TEMPLATE_VIS shared_ptr {
+ struct __nullptr_sfinae_tag {};
+
public:
#if _LIBCPP_STD_VER >= 17
typedef weak_ptr<_Tp> weak_type;
@@ -422,6 +424,10 @@ public:
typedef _Tp element_type;
#endif
+ // A shared_ptr contains only two raw pointers which point to the heap and move constructing already doesn't require
+ // any bookkeeping, so it's always trivially relocatable.
+ using __trivially_relocatable = shared_ptr;
+
private:
element_type* __ptr_;
__shared_weak_count* __cntrl_;
@@ -501,8 +507,12 @@ public:
#endif // _LIBCPP_HAS_NO_EXCEPTIONS
}
- template <class _Dp, __enable_if_t<__shared_ptr_nullptr_deleter_ctor_reqs<_Dp, _Tp>::value, int> = 0 >
- _LIBCPP_HIDE_FROM_ABI shared_ptr(nullptr_t __p, _Dp __d) : __ptr_(nullptr) {
+ template <class _Dp>
+ _LIBCPP_HIDE_FROM_ABI shared_ptr(
+ nullptr_t __p,
+ _Dp __d,
+ __enable_if_t<__shared_ptr_nullptr_deleter_ctor_reqs<_Dp>::value, __nullptr_sfinae_tag> = __nullptr_sfinae_tag())
+ : __ptr_(nullptr) {
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
try {
#endif // _LIBCPP_HAS_NO_EXCEPTIONS
@@ -521,8 +531,13 @@ public:
#endif // _LIBCPP_HAS_NO_EXCEPTIONS
}
- template <class _Dp, class _Alloc, __enable_if_t<__shared_ptr_nullptr_deleter_ctor_reqs<_Dp, _Tp>::value, int> = 0 >
- _LIBCPP_HIDE_FROM_ABI shared_ptr(nullptr_t __p, _Dp __d, _Alloc __a) : __ptr_(nullptr) {
+ template <class _Dp, class _Alloc>
+ _LIBCPP_HIDE_FROM_ABI shared_ptr(
+ nullptr_t __p,
+ _Dp __d,
+ _Alloc __a,
+ __enable_if_t<__shared_ptr_nullptr_deleter_ctor_reqs<_Dp>::value, __nullptr_sfinae_tag> = __nullptr_sfinae_tag())
+ : __ptr_(nullptr) {
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
try {
#endif // _LIBCPP_HAS_NO_EXCEPTIONS
@@ -597,8 +612,8 @@ public:
#if _LIBCPP_STD_VER <= 14 || defined(_LIBCPP_ENABLE_CXX17_REMOVED_AUTO_PTR)
template <class _Yp, __enable_if_t<is_convertible<_Yp*, element_type*>::value, int> = 0>
_LIBCPP_HIDE_FROM_ABI shared_ptr(auto_ptr<_Yp>&& __r) : __ptr_(__r.get()) {
- typedef __shared_ptr_pointer<_Yp*, default_delete<_Yp>, allocator<_Yp> > _CntrlBlk;
- __cntrl_ = new _CntrlBlk(__r.get(), default_delete<_Yp>(), allocator<_Yp>());
+ typedef __shared_ptr_pointer<_Yp*, default_delete<_Yp>, allocator<__remove_cv_t<_Yp> > > _CntrlBlk;
+ __cntrl_ = new _CntrlBlk(__r.get(), default_delete<_Yp>(), allocator<__remove_cv_t<_Yp> >());
__enable_weak_this(__r.get(), __r.get());
__r.release();
}
@@ -775,7 +790,7 @@ public:
private:
template <class _Yp, bool = is_function<_Yp>::value>
struct __shared_ptr_default_allocator {
- typedef allocator<_Yp> type;
+ typedef allocator<__remove_cv_t<_Yp> > type;
};
template <class _Yp>
@@ -833,7 +848,7 @@ _LIBCPP_HIDE_FROM_ABI shared_ptr<_Tp> allocate_shared(const _Alloc& __a, _Args&&
template <class _Tp, class... _Args, __enable_if_t<!is_array<_Tp>::value, int> = 0>
_LIBCPP_HIDE_FROM_ABI shared_ptr<_Tp> make_shared(_Args&&... __args) {
- return std::allocate_shared<_Tp>(allocator<_Tp>(), std::forward<_Args>(__args)...);
+ return std::allocate_shared<_Tp>(allocator<__remove_cv_t<_Tp> >(), std::forward<_Args>(__args)...);
}
#if _LIBCPP_STD_VER >= 20
@@ -847,7 +862,7 @@ _LIBCPP_HIDE_FROM_ABI shared_ptr<_Tp> allocate_shared_for_overwrite(const _Alloc
template <class _Tp, __enable_if_t<!is_array<_Tp>::value, int> = 0>
_LIBCPP_HIDE_FROM_ABI shared_ptr<_Tp> make_shared_for_overwrite() {
- return std::allocate_shared_for_overwrite<_Tp>(allocator<_Tp>());
+ return std::allocate_shared_for_overwrite<_Tp>(allocator<__remove_cv_t<_Tp>>());
}
#endif // _LIBCPP_STD_VER >= 20
@@ -1304,6 +1319,10 @@ public:
typedef _Tp element_type;
#endif
+ // A weak_ptr contains only two raw pointers which point to the heap and move constructing already doesn't require
+ // any bookkeeping, so it's always trivially relocatable.
+ using __trivially_relocatable = weak_ptr;
+
private:
element_type* __ptr_;
__shared_weak_count* __cntrl_;
diff --git a/libcxx/include/__memory/swap_allocator.h b/libcxx/include/__memory/swap_allocator.h
index f2c509056391..b17e082a43c9 100644
--- a/libcxx/include/__memory/swap_allocator.h
+++ b/libcxx/include/__memory/swap_allocator.h
@@ -26,7 +26,7 @@ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 void __swap_allocator(_Alloc
#if _LIBCPP_STD_VER >= 14
_NOEXCEPT
#else
- _NOEXCEPT_(__is_nothrow_swappable<_Alloc>::value)
+ _NOEXCEPT_(__is_nothrow_swappable_v<_Alloc>)
#endif
{
using std::swap;
@@ -42,7 +42,7 @@ inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 void __swap_allocator
#if _LIBCPP_STD_VER >= 14
_NOEXCEPT
#else
- _NOEXCEPT_(__is_nothrow_swappable<_Alloc>::value)
+ _NOEXCEPT_(__is_nothrow_swappable_v<_Alloc>)
#endif
{
std::__swap_allocator(
diff --git a/libcxx/include/__memory/unique_ptr.h b/libcxx/include/__memory/unique_ptr.h
index 46d9405e3159..9519e4283868 100644
--- a/libcxx/include/__memory/unique_ptr.h
+++ b/libcxx/include/__memory/unique_ptr.h
@@ -183,8 +183,8 @@ public:
: __ptr_(__value_init_tag(), __value_init_tag()) {}
template <bool _Dummy = true, class = _EnableIfDeleterDefaultConstructible<_Dummy> >
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 explicit unique_ptr(pointer __p) _NOEXCEPT
- : __ptr_(__p, __value_init_tag()) {}
+ _LIBCPP_HIDE_FROM_ABI
+ _LIBCPP_CONSTEXPR_SINCE_CXX23 explicit unique_ptr(pointer __p) _NOEXCEPT : __ptr_(__p, __value_init_tag()) {}
template <bool _Dummy = true, class = _EnableIfDeleterConstructible<_LValRefType<_Dummy> > >
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 unique_ptr(pointer __p, _LValRefType<_Dummy> __d) _NOEXCEPT
@@ -359,8 +359,8 @@ public:
bool _Dummy = true,
class = _EnableIfDeleterDefaultConstructible<_Dummy>,
class = _EnableIfPointerConvertible<_Pp> >
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 explicit unique_ptr(_Pp __p) _NOEXCEPT
- : __ptr_(__p, __value_init_tag()) {}
+ _LIBCPP_HIDE_FROM_ABI
+ _LIBCPP_CONSTEXPR_SINCE_CXX23 explicit unique_ptr(_Pp __p) _NOEXCEPT : __ptr_(__p, __value_init_tag()) {}
template <class _Pp,
bool _Dummy = true,
@@ -471,7 +471,7 @@ public:
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 void swap(unique_ptr& __u) _NOEXCEPT { __ptr_.swap(__u.__ptr_); }
};
-template <class _Tp, class _Dp, __enable_if_t<__is_swappable<_Dp>::value, int> = 0>
+template <class _Tp, class _Dp, __enable_if_t<__is_swappable_v<_Dp>, int> = 0>
inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 void
swap(unique_ptr<_Tp, _Dp>& __x, unique_ptr<_Tp, _Dp>& __y) _NOEXCEPT {
__x.swap(__y);
@@ -517,8 +517,8 @@ inline _LIBCPP_HIDE_FROM_ABI bool operator>=(const unique_ptr<_T1, _D1>& __x, co
template <class _T1, class _D1, class _T2, class _D2>
requires three_way_comparable_with<typename unique_ptr<_T1, _D1>::pointer, typename unique_ptr<_T2, _D2>::pointer>
_LIBCPP_HIDE_FROM_ABI
- compare_three_way_result_t<typename unique_ptr<_T1, _D1>::pointer, typename unique_ptr<_T2, _D2>::pointer>
- operator<=>(const unique_ptr<_T1, _D1>& __x, const unique_ptr<_T2, _D2>& __y) {
+compare_three_way_result_t<typename unique_ptr<_T1, _D1>::pointer, typename unique_ptr<_T2, _D2>::pointer>
+operator<=>(const unique_ptr<_T1, _D1>& __x, const unique_ptr<_T2, _D2>& __y) {
return compare_three_way()(__x.get(), __y.get());
}
#endif
diff --git a/libcxx/include/__mutex/lock_guard.h b/libcxx/include/__mutex/lock_guard.h
index 739d1683b317..8340b9bbd445 100644
--- a/libcxx/include/__mutex/lock_guard.h
+++ b/libcxx/include/__mutex/lock_guard.h
@@ -40,7 +40,6 @@ public:
: __m_(__m) {}
_LIBCPP_HIDE_FROM_ABI ~lock_guard() _LIBCPP_THREAD_SAFETY_ANNOTATION(release_capability()) { __m_.unlock(); }
-private:
lock_guard(lock_guard const&) = delete;
lock_guard& operator=(lock_guard const&) = delete;
};
diff --git a/libcxx/include/__numeric/gcd_lcm.h b/libcxx/include/__numeric/gcd_lcm.h
index 5d735a51a47e..9be6cf8516b1 100644
--- a/libcxx/include/__numeric/gcd_lcm.h
+++ b/libcxx/include/__numeric/gcd_lcm.h
@@ -37,7 +37,7 @@ struct __ct_abs;
template <typename _Result, typename _Source>
struct __ct_abs<_Result, _Source, true> {
- _LIBCPP_CONSTEXPR _LIBCPP_HIDE_FROM_ABI _Result operator()(_Source __t) const noexcept {
+ constexpr _LIBCPP_HIDE_FROM_ABI _Result operator()(_Source __t) const noexcept {
if (__t >= 0)
return __t;
if (__t == numeric_limits<_Source>::min())
@@ -48,12 +48,12 @@ struct __ct_abs<_Result, _Source, true> {
template <typename _Result, typename _Source>
struct __ct_abs<_Result, _Source, false> {
- _LIBCPP_CONSTEXPR _LIBCPP_HIDE_FROM_ABI _Result operator()(_Source __t) const noexcept { return __t; }
+ constexpr _LIBCPP_HIDE_FROM_ABI _Result operator()(_Source __t) const noexcept { return __t; }
};
template <class _Tp>
-_LIBCPP_CONSTEXPR _LIBCPP_HIDDEN _Tp __gcd(_Tp __a, _Tp __b) {
- static_assert((!is_signed<_Tp>::value), "");
+constexpr _LIBCPP_HIDDEN _Tp __gcd(_Tp __a, _Tp __b) {
+ static_assert(!is_signed<_Tp>::value, "");
// From: https://lemire.me/blog/2013/12/26/fastest-way-to-compute-the-greatest-common-divisor
//
@@ -96,10 +96,10 @@ _LIBCPP_CONSTEXPR _LIBCPP_HIDDEN _Tp __gcd(_Tp __a, _Tp __b) {
}
template <class _Tp, class _Up>
-_LIBCPP_CONSTEXPR _LIBCPP_HIDE_FROM_ABI common_type_t<_Tp, _Up> gcd(_Tp __m, _Up __n) {
- static_assert((is_integral<_Tp>::value && is_integral<_Up>::value), "Arguments to gcd must be integer types");
- static_assert((!is_same<__remove_cv_t<_Tp>, bool>::value), "First argument to gcd cannot be bool");
- static_assert((!is_same<__remove_cv_t<_Up>, bool>::value), "Second argument to gcd cannot be bool");
+constexpr _LIBCPP_HIDE_FROM_ABI common_type_t<_Tp, _Up> gcd(_Tp __m, _Up __n) {
+ static_assert(is_integral<_Tp>::value && is_integral<_Up>::value, "Arguments to gcd must be integer types");
+ static_assert(!is_same<__remove_cv_t<_Tp>, bool>::value, "First argument to gcd cannot be bool");
+ static_assert(!is_same<__remove_cv_t<_Up>, bool>::value, "Second argument to gcd cannot be bool");
using _Rp = common_type_t<_Tp, _Up>;
using _Wp = make_unsigned_t<_Rp>;
return static_cast<_Rp>(
@@ -107,21 +107,23 @@ _LIBCPP_CONSTEXPR _LIBCPP_HIDE_FROM_ABI common_type_t<_Tp, _Up> gcd(_Tp __m, _Up
}
template <class _Tp, class _Up>
-_LIBCPP_CONSTEXPR _LIBCPP_HIDE_FROM_ABI common_type_t<_Tp, _Up> lcm(_Tp __m, _Up __n) {
- static_assert((is_integral<_Tp>::value && is_integral<_Up>::value), "Arguments to lcm must be integer types");
- static_assert((!is_same<__remove_cv_t<_Tp>, bool>::value), "First argument to lcm cannot be bool");
- static_assert((!is_same<__remove_cv_t<_Up>, bool>::value), "Second argument to lcm cannot be bool");
+constexpr _LIBCPP_HIDE_FROM_ABI common_type_t<_Tp, _Up> lcm(_Tp __m, _Up __n) {
+ static_assert(is_integral<_Tp>::value && is_integral<_Up>::value, "Arguments to lcm must be integer types");
+ static_assert(!is_same<__remove_cv_t<_Tp>, bool>::value, "First argument to lcm cannot be bool");
+ static_assert(!is_same<__remove_cv_t<_Up>, bool>::value, "Second argument to lcm cannot be bool");
if (__m == 0 || __n == 0)
return 0;
using _Rp = common_type_t<_Tp, _Up>;
_Rp __val1 = __ct_abs<_Rp, _Tp>()(__m) / std::gcd(__m, __n);
_Rp __val2 = __ct_abs<_Rp, _Up>()(__n);
- _LIBCPP_ASSERT_ARGUMENT_WITHIN_DOMAIN((numeric_limits<_Rp>::max() / __val1 > __val2), "Overflow in lcm");
- return __val1 * __val2;
+ _Rp __res;
+ [[maybe_unused]] bool __overflow = __builtin_mul_overflow(__val1, __val2, &__res);
+ _LIBCPP_ASSERT_ARGUMENT_WITHIN_DOMAIN(!__overflow, "Overflow in lcm");
+ return __res;
}
-#endif // _LIBCPP_STD_VER
+#endif // _LIBCPP_STD_VER >= 17
_LIBCPP_END_NAMESPACE_STD
diff --git a/libcxx/include/__numeric/pstl.h b/libcxx/include/__numeric/pstl.h
index 05559b4d3f3c..7557686a3663 100644
--- a/libcxx/include/__numeric/pstl.h
+++ b/libcxx/include/__numeric/pstl.h
@@ -9,17 +9,7 @@
#ifndef _LIBCPP___NUMERIC_PSTL_H
#define _LIBCPP___NUMERIC_PSTL_H
-#include <__algorithm/pstl_frontend_dispatch.h>
#include <__config>
-#include <__functional/identity.h>
-#include <__functional/operations.h>
-#include <__iterator/cpp17_iterator_concepts.h>
-#include <__iterator/iterator_traits.h>
-#include <__numeric/transform_reduce.h>
-#include <__pstl/configuration.h>
-#include <__type_traits/is_execution_policy.h>
-#include <__utility/move.h>
-#include <optional>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
# pragma GCC system_header
@@ -30,33 +20,66 @@ _LIBCPP_PUSH_MACROS
#if !defined(_LIBCPP_HAS_NO_INCOMPLETE_PSTL) && _LIBCPP_STD_VER >= 17
+# include <__functional/identity.h>
+# include <__functional/operations.h>
+# include <__iterator/cpp17_iterator_concepts.h>
+# include <__iterator/iterator_traits.h>
+# include <__pstl/backend.h>
+# include <__pstl/dispatch.h>
+# include <__pstl/handle_exception.h>
+# include <__type_traits/enable_if.h>
+# include <__type_traits/is_execution_policy.h>
+# include <__type_traits/remove_cvref.h>
+# include <__utility/forward.h>
+# include <__utility/move.h>
+
_LIBCPP_BEGIN_NAMESPACE_STD
template <class _ExecutionPolicy,
- class _ForwardIterator1,
- class _ForwardIterator2,
+ class _ForwardIterator,
class _Tp,
- class _BinaryOperation1,
- class _BinaryOperation2,
+ class _BinaryOperation,
class _RawPolicy = __remove_cvref_t<_ExecutionPolicy>,
enable_if_t<is_execution_policy_v<_RawPolicy>, int> = 0>
-_LIBCPP_HIDE_FROM_ABI optional<_Tp> __transform_reduce(
- _ExecutionPolicy&&,
- _ForwardIterator1&& __first1,
- _ForwardIterator1&& __last1,
- _ForwardIterator2&& __first2,
- _Tp&& __init,
- _BinaryOperation1&& __reduce,
- _BinaryOperation2&& __transform) noexcept {
- using _Backend = typename __select_backend<_RawPolicy>::type;
- return std::__pstl_transform_reduce<_RawPolicy>(
- _Backend{},
- std::move(__first1),
- std::move(__last1),
- std::move(__first2),
+_LIBCPP_HIDE_FROM_ABI _Tp reduce(
+ _ExecutionPolicy&& __policy, _ForwardIterator __first, _ForwardIterator __last, _Tp __init, _BinaryOperation __op) {
+ _LIBCPP_REQUIRE_CPP17_FORWARD_ITERATOR(_ForwardIterator, "reduce requires ForwardIterators");
+ using _Implementation = __pstl::__dispatch<__pstl::__reduce, __pstl::__current_configuration, _RawPolicy>;
+ return __pstl::__handle_exception<_Implementation>(
+ std::forward<_ExecutionPolicy>(__policy),
+ std::move(__first),
+ std::move(__last),
std::move(__init),
- std::move(__reduce),
- std::move(__transform));
+ std::move(__op));
+}
+
+template <class _ExecutionPolicy,
+ class _ForwardIterator,
+ class _Tp,
+ class _RawPolicy = __remove_cvref_t<_ExecutionPolicy>,
+ enable_if_t<is_execution_policy_v<_RawPolicy>, int> = 0>
+_LIBCPP_HIDE_FROM_ABI _Tp
+reduce(_ExecutionPolicy&& __policy, _ForwardIterator __first, _ForwardIterator __last, _Tp __init) {
+ _LIBCPP_REQUIRE_CPP17_FORWARD_ITERATOR(_ForwardIterator, "reduce requires ForwardIterators");
+ using _Implementation = __pstl::__dispatch<__pstl::__reduce, __pstl::__current_configuration, _RawPolicy>;
+ return __pstl::__handle_exception<_Implementation>(
+ std::forward<_ExecutionPolicy>(__policy), std::move(__first), std::move(__last), std::move(__init), plus{});
+}
+
+template <class _ExecutionPolicy,
+ class _ForwardIterator,
+ class _RawPolicy = __remove_cvref_t<_ExecutionPolicy>,
+ enable_if_t<is_execution_policy_v<_RawPolicy>, int> = 0>
+_LIBCPP_HIDE_FROM_ABI __iter_value_type<_ForwardIterator>
+reduce(_ExecutionPolicy&& __policy, _ForwardIterator __first, _ForwardIterator __last) {
+ _LIBCPP_REQUIRE_CPP17_FORWARD_ITERATOR(_ForwardIterator, "reduce requires ForwardIterators");
+ using _Implementation = __pstl::__dispatch<__pstl::__reduce, __pstl::__current_configuration, _RawPolicy>;
+ return __pstl::__handle_exception<_Implementation>(
+ std::forward<_ExecutionPolicy>(__policy),
+ std::move(__first),
+ std::move(__last),
+ __iter_value_type<_ForwardIterator>(),
+ plus{});
}
template <class _ExecutionPolicy,
@@ -77,18 +100,16 @@ _LIBCPP_HIDE_FROM_ABI _Tp transform_reduce(
_BinaryOperation2 __transform) {
_LIBCPP_REQUIRE_CPP17_FORWARD_ITERATOR(_ForwardIterator1, "transform_reduce requires ForwardIterators");
_LIBCPP_REQUIRE_CPP17_FORWARD_ITERATOR(_ForwardIterator2, "transform_reduce requires ForwardIterators");
- auto __res = std::__transform_reduce(
- __policy,
+ using _Implementation =
+ __pstl::__dispatch<__pstl::__transform_reduce_binary, __pstl::__current_configuration, _RawPolicy>;
+ return __pstl::__handle_exception<_Implementation>(
+ std::forward<_ExecutionPolicy>(__policy),
std::move(__first1),
std::move(__last1),
std::move(__first2),
std::move(__init),
std::move(__reduce),
std::move(__transform));
-
- if (!__res)
- std::__throw_bad_alloc();
- return *std::move(__res);
}
// This overload doesn't get a customization point because it's trivial to detect (through e.g.
@@ -97,7 +118,8 @@ template <class _ExecutionPolicy,
class _ForwardIterator1,
class _ForwardIterator2,
class _Tp,
- enable_if_t<is_execution_policy_v<__remove_cvref_t<_ExecutionPolicy>>, int> = 0>
+ class _RawPolicy = __remove_cvref_t<_ExecutionPolicy>,
+ enable_if_t<is_execution_policy_v<_RawPolicy>, int> = 0>
_LIBCPP_HIDE_FROM_ABI _Tp transform_reduce(
_ExecutionPolicy&& __policy,
_ForwardIterator1 __first1,
@@ -106,31 +128,16 @@ _LIBCPP_HIDE_FROM_ABI _Tp transform_reduce(
_Tp __init) {
_LIBCPP_REQUIRE_CPP17_FORWARD_ITERATOR(_ForwardIterator1, "transform_reduce requires ForwardIterators");
_LIBCPP_REQUIRE_CPP17_FORWARD_ITERATOR(_ForwardIterator2, "transform_reduce requires ForwardIterators");
- return std::transform_reduce(__policy, __first1, __last1, __first2, __init, plus{}, multiplies{});
-}
-
-template <class _ExecutionPolicy,
- class _ForwardIterator,
- class _Tp,
- class _BinaryOperation,
- class _UnaryOperation,
- class _RawPolicy = __remove_cvref_t<_ExecutionPolicy>,
- enable_if_t<is_execution_policy_v<_RawPolicy>, int> = 0>
-[[nodiscard]] _LIBCPP_HIDE_FROM_ABI optional<__remove_cvref_t<_Tp>> __transform_reduce(
- _ExecutionPolicy&&,
- _ForwardIterator&& __first,
- _ForwardIterator&& __last,
- _Tp&& __init,
- _BinaryOperation&& __reduce,
- _UnaryOperation&& __transform) noexcept {
- using _Backend = typename __select_backend<_RawPolicy>::type;
- return std::__pstl_transform_reduce<_RawPolicy>(
- _Backend{},
- std::move(__first),
- std::move(__last),
+ using _Implementation =
+ __pstl::__dispatch<__pstl::__transform_reduce_binary, __pstl::__current_configuration, _RawPolicy>;
+ return __pstl::__handle_exception<_Implementation>(
+ std::forward<_ExecutionPolicy>(__policy),
+ std::move(__first1),
+ std::move(__last1),
+ std::move(__first2),
std::move(__init),
- std::move(__reduce),
- std::move(__transform));
+ plus{},
+ multiplies{});
}
template <class _ExecutionPolicy,
@@ -148,86 +155,14 @@ _LIBCPP_HIDE_FROM_ABI _Tp transform_reduce(
_BinaryOperation __reduce,
_UnaryOperation __transform) {
_LIBCPP_REQUIRE_CPP17_FORWARD_ITERATOR(_ForwardIterator, "transform_reduce requires ForwardIterators");
- auto __res = std::__transform_reduce(
- __policy, std::move(__first), std::move(__last), std::move(__init), std::move(__reduce), std::move(__transform));
- if (!__res)
- std::__throw_bad_alloc();
- return *std::move(__res);
-}
-
-template <class>
-void __pstl_reduce();
-
-template <class _ExecutionPolicy,
- class _ForwardIterator,
- class _Tp,
- class _BinaryOperation = plus<>,
- class _RawPolicy = __remove_cvref_t<_ExecutionPolicy>,
- enable_if_t<is_execution_policy_v<_RawPolicy>, int> = 0>
-[[nodiscard]] _LIBCPP_HIDE_FROM_ABI optional<_Tp>
-__reduce(_ExecutionPolicy&& __policy,
- _ForwardIterator&& __first,
- _ForwardIterator&& __last,
- _Tp&& __init,
- _BinaryOperation&& __op = {}) noexcept {
- return std::__pstl_frontend_dispatch(
- _LIBCPP_PSTL_CUSTOMIZATION_POINT(__pstl_reduce, _RawPolicy),
- [&__policy](_ForwardIterator __g_first, _ForwardIterator __g_last, _Tp __g_init, _BinaryOperation __g_op) {
- return std::__transform_reduce(
- __policy, std::move(__g_first), std::move(__g_last), std::move(__g_init), std::move(__g_op), __identity{});
- },
+ using _Implementation = __pstl::__dispatch<__pstl::__transform_reduce, __pstl::__current_configuration, _RawPolicy>;
+ return __pstl::__handle_exception<_Implementation>(
+ std::forward<_ExecutionPolicy>(__policy),
std::move(__first),
std::move(__last),
std::move(__init),
- std::move(__op));
-}
-
-template <class _ExecutionPolicy,
- class _ForwardIterator,
- class _Tp,
- class _BinaryOperation = plus<>,
- class _RawPolicy = __remove_cvref_t<_ExecutionPolicy>,
- enable_if_t<is_execution_policy_v<_RawPolicy>, int> = 0>
-_LIBCPP_HIDE_FROM_ABI _Tp
-reduce(_ExecutionPolicy&& __policy,
- _ForwardIterator __first,
- _ForwardIterator __last,
- _Tp __init,
- _BinaryOperation __op = {}) {
- _LIBCPP_REQUIRE_CPP17_FORWARD_ITERATOR(_ForwardIterator, "reduce requires ForwardIterators");
- auto __res = std::__reduce(__policy, std::move(__first), std::move(__last), std::move(__init), std::move(__op));
- if (!__res)
- std::__throw_bad_alloc();
- return *std::move(__res);
-}
-
-template <class _ExecutionPolicy,
- class _ForwardIterator,
- class _RawPolicy = __remove_cvref_t<_ExecutionPolicy>,
- enable_if_t<is_execution_policy_v<_RawPolicy>, int> = 0>
-[[nodiscard]] _LIBCPP_HIDE_FROM_ABI optional<__iter_value_type<_ForwardIterator>>
-__reduce(_ExecutionPolicy&& __policy, _ForwardIterator&& __first, _ForwardIterator&& __last) noexcept {
- return std::__pstl_frontend_dispatch(
- _LIBCPP_PSTL_CUSTOMIZATION_POINT(__pstl_reduce, _RawPolicy),
- [&__policy](_ForwardIterator __g_first, _ForwardIterator __g_last) {
- return std::__reduce(
- __policy, std::move(__g_first), std::move(__g_last), __iter_value_type<_ForwardIterator>());
- },
- std::move(__first),
- std::move(__last));
-}
-
-template <class _ExecutionPolicy,
- class _ForwardIterator,
- class _RawPolicy = __remove_cvref_t<_ExecutionPolicy>,
- enable_if_t<is_execution_policy_v<_RawPolicy>, int> = 0>
-_LIBCPP_HIDE_FROM_ABI __iter_value_type<_ForwardIterator>
-reduce(_ExecutionPolicy&& __policy, _ForwardIterator __first, _ForwardIterator __last) {
- _LIBCPP_REQUIRE_CPP17_FORWARD_ITERATOR(_ForwardIterator, "reduce requires ForwardIterators");
- auto __res = std::__reduce(__policy, std::move(__first), std::move(__last));
- if (!__res)
- std::__throw_bad_alloc();
- return *std::move(__res);
+ std::move(__reduce),
+ std::move(__transform));
}
_LIBCPP_END_NAMESPACE_STD
diff --git a/libcxx/include/__ostream/basic_ostream.h b/libcxx/include/__ostream/basic_ostream.h
index 697192bfb46b..178359d68156 100644
--- a/libcxx/include/__ostream/basic_ostream.h
+++ b/libcxx/include/__ostream/basic_ostream.h
@@ -52,6 +52,9 @@ public:
}
~basic_ostream() override;
+ basic_ostream(const basic_ostream& __rhs) = delete;
+ basic_ostream& operator=(const basic_ostream& __rhs) = delete;
+
protected:
inline _LIBCPP_HIDE_FROM_ABI basic_ostream(basic_ostream&& __rhs);
@@ -62,9 +65,6 @@ protected:
basic_ios<char_type, traits_type>::swap(__rhs);
}
- basic_ostream(const basic_ostream& __rhs) = delete;
- basic_ostream& operator=(const basic_ostream& __rhs) = delete;
-
public:
// 27.7.2.4 Prefix/suffix:
class _LIBCPP_TEMPLATE_VIS sentry;
diff --git a/libcxx/include/__pstl/configuration.h b/libcxx/include/__pstl/backend.h
index d32bd21df1f9..86d9f28c77fa 100644
--- a/libcxx/include/__pstl/configuration.h
+++ b/libcxx/include/__pstl/backend.h
@@ -6,22 +6,30 @@
//
//===----------------------------------------------------------------------===//
-#ifndef _LIBCPP___PSTL_CONFIGURATION_H
-#define _LIBCPP___PSTL_CONFIGURATION_H
+#ifndef _LIBCPP___PSTL_BACKEND_H
+#define _LIBCPP___PSTL_BACKEND_H
#include <__config>
-#include <__pstl/configuration_fwd.h>
+#include <__pstl/backend_fwd.h>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
# pragma GCC system_header
#endif
+_LIBCPP_PUSH_MACROS
+#include <__undef_macros>
+
#if defined(_LIBCPP_PSTL_BACKEND_SERIAL)
+# include <__pstl/backends/default.h>
# include <__pstl/backends/serial.h>
#elif defined(_LIBCPP_PSTL_BACKEND_STD_THREAD)
+# include <__pstl/backends/default.h>
# include <__pstl/backends/std_thread.h>
#elif defined(_LIBCPP_PSTL_BACKEND_LIBDISPATCH)
+# include <__pstl/backends/default.h>
# include <__pstl/backends/libdispatch.h>
#endif
-#endif // _LIBCPP___PSTL_CONFIGURATION_H
+_LIBCPP_POP_MACROS
+
+#endif // _LIBCPP___PSTL_BACKEND_H
diff --git a/libcxx/include/__pstl/backend_fwd.h b/libcxx/include/__pstl/backend_fwd.h
new file mode 100644
index 000000000000..32c5da576fb3
--- /dev/null
+++ b/libcxx/include/__pstl/backend_fwd.h
@@ -0,0 +1,301 @@
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache 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___PSTL_BACKEND_FWD_H
+#define _LIBCPP___PSTL_BACKEND_FWD_H
+
+#include <__config>
+
+#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
+# pragma GCC system_header
+#endif
+
+_LIBCPP_PUSH_MACROS
+#include <__undef_macros>
+
+//
+// This header declares available PSTL backends and the functions that must be implemented in order for the
+// PSTL algorithms to be provided.
+//
+// Backends often do not implement the full set of functions themselves -- a configuration of the PSTL is
+// usually a set of backends "stacked" together which each implement some algorithms under some execution
+// policies. It is only necessary for the "stack" of backends to implement all algorithms under all execution
+// policies, but a single backend is not required to implement everything on its own.
+//
+// The signatures used by each backend function are documented below.
+//
+// Exception handling
+// ==================
+//
+// PSTL backends are expected to report errors (i.e. failure to allocate) by returning a disengaged `optional` from
+// their implementation. Exceptions shouldn't be used to report an internal failure-to-allocate, since all exceptions
+// are turned into a program termination at the front-end level. When a backend returns a disengaged `optional` to the
+// frontend, the frontend will turn that into a call to `std::__throw_bad_alloc();` to report the internal failure to
+// the user.
+//
+
+_LIBCPP_BEGIN_NAMESPACE_STD
+namespace __pstl {
+
+template <class... _Backends>
+struct __backend_configuration;
+
+struct __default_backend_tag;
+struct __libdispatch_backend_tag;
+struct __serial_backend_tag;
+struct __std_thread_backend_tag;
+
+#if defined(_LIBCPP_PSTL_BACKEND_SERIAL)
+using __current_configuration = __backend_configuration<__serial_backend_tag, __default_backend_tag>;
+#elif defined(_LIBCPP_PSTL_BACKEND_STD_THREAD)
+using __current_configuration = __backend_configuration<__std_thread_backend_tag, __default_backend_tag>;
+#elif defined(_LIBCPP_PSTL_BACKEND_LIBDISPATCH)
+using __current_configuration = __backend_configuration<__libdispatch_backend_tag, __default_backend_tag>;
+#else
+
+// ...New vendors can add parallel backends here...
+
+# error "Invalid PSTL backend configuration"
+#endif
+
+template <class _Backend, class _ExecutionPolicy>
+struct __find_if;
+// template <class _Policy, class _ForwardIterator, class _Predicate>
+// optional<_ForwardIterator>
+// operator()(_Policy&&, _ForwardIterator __first, _ForwardIterator __last, _Predicate __pred) const noexcept;
+
+template <class _Backend, class _ExecutionPolicy>
+struct __find_if_not;
+// template <class _Policy, class _ForwardIterator, class _Predicate>
+// optional<_ForwardIterator>
+// operator()(_Policy&&, _ForwardIterator __first, _ForwardIterator __last, _Predicate __pred) const noexcept;
+
+template <class _Backend, class _ExecutionPolicy>
+struct __find;
+// template <class _Policy, class _ForwardIterator, class _Tp>
+// optional<_ForwardIterator>
+// operator()(_Policy&&, _ForwardIterator __first, _ForwardIterator __last, const _Tp& __value) const noexcept;
+
+template <class _Backend, class _ExecutionPolicy>
+struct __any_of;
+// template <class _Policy, class _ForwardIterator, class _Predicate>
+// optional<bool>
+// operator()(_Policy&&, _ForwardIterator __first, _ForwardIterator __last, _Predicate __pred) const noexcept;
+
+template <class _Backend, class _ExecutionPolicy>
+struct __all_of;
+// template <class _Policy, class _ForwardIterator, class _Predicate>
+// optional<bool>
+// operator()(_Policy&&, _ForwardIterator __first, _ForwardIterator __last, _Predicate __pred) const noexcept;
+
+template <class _Backend, class _ExecutionPolicy>
+struct __none_of;
+// template <class _Policy, class _ForwardIterator, class _Predicate>
+// optional<bool>
+// operator()(_Policy&&, _ForwardIterator __first, _ForwardIterator __last, _Predicate __pred) const noexcept;
+
+template <class _Backend, class _ExecutionPolicy>
+struct __is_partitioned;
+// template <class _Policy, class _ForwardIterator, class _Predicate>
+// optional<bool>
+// operator()(_Policy&&, _ForwardIterator __first, _ForwardIterator __last, _Predicate __pred) const noexcept;
+
+template <class _Backend, class _ExecutionPolicy>
+struct __for_each;
+// template <class _Policy, class _ForwardIterator, class _Function>
+// optional<__empty>
+// operator()(_Policy&&, _ForwardIterator __first, _ForwardIterator __last, _Function __func) const noexcept;
+
+template <class _Backend, class _ExecutionPolicy>
+struct __for_each_n;
+// template <class _Policy, class _ForwardIterator, class _Size, class _Function>
+// optional<__empty>
+// operator()(_Policy&&, _ForwardIterator __first, _Size __size, _Function __func) const noexcept;
+
+template <class _Backend, class _ExecutionPolicy>
+struct __fill;
+// template <class _Policy, class _ForwardIterator, class _Tp>
+// optional<__empty>
+// operator()(_Policy&&, _ForwardIterator __first, _ForwardIterator __last, _Tp const& __value) const noexcept;
+
+template <class _Backend, class _ExecutionPolicy>
+struct __fill_n;
+// template <class _Policy, class _ForwardIterator, class _Size, class _Tp>
+// optional<__empty>
+// operator()(_Policy&&, _ForwardIterator __first, _Size __n, _Tp const& __value) const noexcept;
+
+template <class _Backend, class _ExecutionPolicy>
+struct __replace;
+// template <class _Policy, class _ForwardIterator, class _Tp>
+// optional<__empty>
+// operator()(_Policy&&, _ForwardIterator __first, _ForwardIterator __last,
+// _Tp const& __old, _Tp const& __new) const noexcept;
+
+template <class _Backend, class _ExecutionPolicy>
+struct __replace_if;
+// template <class _Policy, class _ForwardIterator, class _Predicate, class _Tp>
+// optional<__empty>
+// operator()(_Policy&&, _ForwardIterator __first, _ForwardIterator __last,
+// _Predicate __pred, _Tp const& __new_value) const noexcept;
+
+template <class _Backend, class _ExecutionPolicy>
+struct __generate;
+// template <class _Policy, class _ForwardIterator, class _Generator>
+// optional<__empty>
+// operator()(_Policy&&, _ForwardIterator __first, _ForwardIterator __last, _Generator __gen) const noexcept;
+
+template <class _Backend, class _ExecutionPolicy>
+struct __generate_n;
+// template <class _Policy, class _ForwardIterator, class _Size, class _Generator>
+// optional<__empty>
+// operator()(_Policy&&, _ForwardIterator __first, _Size __n, _Generator __gen) const noexcept;
+
+template <class _Backend, class _ExecutionPolicy>
+struct __merge;
+// template <class _Policy, class _ForwardIterator1, class _ForwardIterator2, class _ForwardOutIterator, class _Comp>
+// optional<_ForwardOutIterator>
+// operator()(_Policy&&, _ForwardIterator1 __first1, _ForwardIterator1 __last1,
+// _ForwardIterator2 __first2, _ForwardIterator2 __last2,
+// _ForwardOutIterator __result, _Comp __comp) const noexcept;
+
+template <class _Backend, class _ExecutionPolicy>
+struct __stable_sort;
+// template <class _Policy, class _RandomAccessIterator, class _Comp>
+// optional<__empty>
+// operator()(_Policy&&, _RandomAccessIterator __first, _RandomAccessIterator __last, _Comp __comp) const noexcept;
+
+template <class _Backend, class _ExecutionPolicy>
+struct __sort;
+// template <class _Policy, class _RandomAccessIterator, class _Comp>
+// optional<__empty>
+// operator()(_Policy&&, _RandomAccessIterator __first, _RandomAccessIterator __last, _Comp __comp) const noexcept;
+
+template <class _Backend, class _ExecutionPolicy>
+struct __transform;
+// template <class _Policy, class _ForwardIterator, class _ForwardOutIterator, class _UnaryOperation>
+// optional<_ForwardOutIterator>
+// operator()(_Policy&&, _ForwardIterator __first, _ForwardIterator __last,
+// _ForwardOutIterator __result,
+// _UnaryOperation __op) const noexcept;
+
+template <class _Backend, class _ExecutionPolicy>
+struct __transform_binary;
+// template <class _Policy, class _ForwardIterator1, class _ForwardIterator2,
+// class _ForwardOutIterator,
+// class _BinaryOperation>
+// optional<_ForwardOutIterator>
+// operator()(_Policy&&, _ForwardIterator1 __first1, _ForwardIterator1 __last1,
+// _ForwardIterator2 __first2,
+// _ForwardOutIterator __result,
+// _BinaryOperation __op) const noexcept;
+
+template <class _Backend, class _ExecutionPolicy>
+struct __replace_copy_if;
+// template <class _Policy, class _ForwardIterator, class _ForwardOutIterator, class _Predicate, class _Tp>
+// optional<__empty>
+// operator()(_Policy&&, _ForwardIterator __first, _ForwardIterator __last,
+// _ForwardOutIterator __out_it,
+// _Predicate __pred,
+// _Tp const& __new_value) const noexcept;
+
+template <class _Backend, class _ExecutionPolicy>
+struct __replace_copy;
+// template <class _Policy, class _ForwardIterator, class _ForwardOutIterator, class _Tp>
+// optional<__empty>
+// operator()(_Policy&&, _ForwardIterator __first, _ForwardIterator __last,
+// _ForwardOutIterator __out_it,
+// _Tp const& __old_value,
+// _Tp const& __new_value) const noexcept;
+
+template <class _Backend, class _ExecutionPolicy>
+struct __move;
+// template <class _Policy, class _ForwardIterator, class _ForwardOutIterator>
+// optional<_ForwardOutIterator>
+// operator()(_Policy&&, _ForwardIterator __first, _ForwardIterator __last,
+// _ForwardOutIterator __out_it) const noexcept;
+
+template <class _Backend, class _ExecutionPolicy>
+struct __copy;
+// template <class _Policy, class _ForwardIterator, class _ForwardOutIterator>
+// optional<_ForwardOutIterator>
+// operator()(_Policy&&, _ForwardIterator __first, _ForwardIterator __last,
+// _ForwardOutIterator __out_it) const noexcept;
+
+template <class _Backend, class _ExecutionPolicy>
+struct __copy_n;
+// template <class _Policy, class _ForwardIterator, class _Size, class _ForwardOutIterator>
+// optional<_ForwardOutIterator>
+// operator()(_Policy&&, _ForwardIterator __first, _Size __n, _ForwardOutIterator __out_it) const noexcept;
+
+template <class _Backend, class _ExecutionPolicy>
+struct __rotate_copy;
+// template <class _Policy, class _ForwardIterator, class _ForwardOutIterator>
+// optional<_ForwardOutIterator>
+// operator()(_Policy&&, _ForwardIterator __first, _ForwardIterator __middle, _ForwardIterator __last,
+// _ForwardOutIterator __out_it) const noexcept;
+
+template <class _Backend, class _ExecutionPolicy>
+struct __transform_reduce;
+// template <class _Policy, class _ForwardIterator, class _Tp, class _BinaryOperation, class _UnaryOperation>
+// optional<_Tp>
+// operator()(_Policy&&, _ForwardIterator __first, _ForwardIterator __last,
+// _Tp __init,
+// _BinaryOperation __reduce,
+// _UnaryOperation __transform) const noexcept;
+
+template <class _Backend, class _ExecutionPolicy>
+struct __transform_reduce_binary;
+// template <class _Policy, class _ForwardIterator1, class _ForwardIterator2,
+// class _Tp, class _BinaryOperation1, class _BinaryOperation2>
+// optional<_Tp> operator()(_Policy&&, _ForwardIterator1 __first1, _ForwardIterator1 __last1,
+// _ForwardIterator2 __first2,
+// _Tp __init,
+// _BinaryOperation1 __reduce,
+// _BinaryOperation2 __transform) const noexcept;
+
+template <class _Backend, class _ExecutionPolicy>
+struct __count_if;
+// template <class _Policy, class _ForwardIterator, class _Predicate>
+// optional<__iter_diff_t<_ForwardIterator>>
+// operator()(_Policy&&, _ForwardIterator __first, _ForwardIterator __last, _Predicate __pred) const noexcept;
+
+template <class _Backend, class _ExecutionPolicy>
+struct __count;
+// template <class _Policy, class _ForwardIterator, class _Tp>
+// optional<__iter_diff_t<_ForwardIterator>>
+// operator()(_Policy&&, _ForwardIterator __first, _ForwardIterator __last, _Tp const& __value) const noexcept;
+
+template <class _Backend, class _ExecutionPolicy>
+struct __equal_3leg;
+// template <class _Policy, class _ForwardIterator1, class _ForwardIterator2, class _Predicate>
+// optional<bool>
+// operator()(_Policy&&, _ForwardIterator1 __first1, _ForwardIterator1 __last1,
+// _ForwardIterator2 __first2,
+// _Predicate __pred) const noexcept;
+
+template <class _Backend, class _ExecutionPolicy>
+struct __equal;
+// template <class _Policy, class _ForwardIterator1, class _ForwardIterator2, class _Predicate>
+// optional<bool>
+// operator()(_Policy&&, _ForwardIterator1 __first1, _ForwardIterator1 __last1,
+// _ForwardIterator2 __first2, _ForwardIterator2 __last2,
+// _Predicate __pred) const noexcept;
+
+template <class _Backend, class _ExecutionPolicy>
+struct __reduce;
+// template <class _Policy, class _ForwardIterator, class _Tp, class _BinaryOperation>
+// optional<_Tp>
+// operator()(_Policy&&, _ForwardIterator __first, _ForwardIterator __last,
+// _Tp __init, _BinaryOperation __op) const noexcept;
+
+} // namespace __pstl
+_LIBCPP_END_NAMESPACE_STD
+
+_LIBCPP_POP_MACROS
+
+#endif // _LIBCPP___PSTL_BACKEND_FWD_H
diff --git a/libcxx/include/__pstl/backends/default.h b/libcxx/include/__pstl/backends/default.h
new file mode 100644
index 000000000000..61a128805f85
--- /dev/null
+++ b/libcxx/include/__pstl/backends/default.h
@@ -0,0 +1,503 @@
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache 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___PSTL_BACKENDS_DEFAULT_H
+#define _LIBCPP___PSTL_BACKENDS_DEFAULT_H
+
+#include <__algorithm/copy_n.h>
+#include <__algorithm/equal.h>
+#include <__algorithm/fill_n.h>
+#include <__algorithm/for_each_n.h>
+#include <__config>
+#include <__functional/identity.h>
+#include <__functional/not_fn.h>
+#include <__functional/operations.h>
+#include <__iterator/concepts.h>
+#include <__iterator/iterator_traits.h>
+#include <__pstl/backend_fwd.h>
+#include <__pstl/dispatch.h>
+#include <__utility/empty.h>
+#include <__utility/forward.h>
+#include <__utility/move.h>
+#include <optional>
+
+#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
+# pragma GCC system_header
+#endif
+
+_LIBCPP_PUSH_MACROS
+#include <__undef_macros>
+
+_LIBCPP_BEGIN_NAMESPACE_STD
+namespace __pstl {
+
+//
+// This file provides an incomplete PSTL backend that implements all of the PSTL algorithms
+// based on a smaller set of basis operations.
+//
+// It is intended as a building block for other PSTL backends that implement some operations more
+// efficiently but may not want to define the full set of PSTL algorithms.
+//
+// This backend implements all the PSTL algorithms based on the following basis operations:
+//
+// find_if family
+// --------------
+// - find
+// - find_if_not
+// - any_of
+// - all_of
+// - none_of
+// - is_partitioned
+//
+// for_each family
+// ---------------
+// - for_each_n
+// - fill
+// - fill_n
+// - replace
+// - replace_if
+// - generate
+// - generate_n
+//
+// merge family
+// ------------
+// No other algorithms based on merge
+//
+// stable_sort family
+// ------------------
+// - sort
+//
+// transform_reduce and transform_reduce_binary family
+// ---------------------------------------------------
+// - count_if
+// - count
+// - equal(3 legs)
+// - equal
+// - reduce
+//
+// transform and transform_binary family
+// -------------------------------------
+// - replace_copy_if
+// - replace_copy
+// - move
+// - copy
+// - copy_n
+// - rotate_copy
+//
+
+//////////////////////////////////////////////////////////////
+// find_if family
+//////////////////////////////////////////////////////////////
+template <class _ExecutionPolicy>
+struct __find<__default_backend_tag, _ExecutionPolicy> {
+ template <class _Policy, class _ForwardIterator, class _Tp>
+ [[nodiscard]] _LIBCPP_HIDE_FROM_ABI optional<_ForwardIterator>
+ operator()(_Policy&& __policy, _ForwardIterator __first, _ForwardIterator __last, const _Tp& __value) const noexcept {
+ using _FindIf = __dispatch<__find_if, __current_configuration, _ExecutionPolicy>;
+ return _FindIf()(
+ __policy, std::move(__first), std::move(__last), [&](__iter_reference<_ForwardIterator> __element) {
+ return __element == __value;
+ });
+ }
+};
+
+template <class _ExecutionPolicy>
+struct __find_if_not<__default_backend_tag, _ExecutionPolicy> {
+ template <class _Policy, class _ForwardIterator, class _Pred>
+ [[nodiscard]] _LIBCPP_HIDE_FROM_ABI optional<_ForwardIterator>
+ operator()(_Policy&& __policy, _ForwardIterator __first, _ForwardIterator __last, _Pred&& __pred) const noexcept {
+ using _FindIf = __dispatch<__find_if, __current_configuration, _ExecutionPolicy>;
+ return _FindIf()(__policy, __first, __last, std::not_fn(std::forward<_Pred>(__pred)));
+ }
+};
+
+template <class _ExecutionPolicy>
+struct __any_of<__default_backend_tag, _ExecutionPolicy> {
+ template <class _Policy, class _ForwardIterator, class _Pred>
+ [[nodiscard]] _LIBCPP_HIDE_FROM_ABI optional<bool>
+ operator()(_Policy&& __policy, _ForwardIterator __first, _ForwardIterator __last, _Pred&& __pred) const noexcept {
+ using _FindIf = __dispatch<__find_if, __current_configuration, _ExecutionPolicy>;
+ auto __res = _FindIf()(__policy, __first, __last, std::forward<_Pred>(__pred));
+ if (!__res)
+ return nullopt;
+ return *__res != __last;
+ }
+};
+
+template <class _ExecutionPolicy>
+struct __all_of<__default_backend_tag, _ExecutionPolicy> {
+ template <class _Policy, class _ForwardIterator, class _Pred>
+ [[nodiscard]] _LIBCPP_HIDE_FROM_ABI optional<bool>
+ operator()(_Policy&& __policy, _ForwardIterator __first, _ForwardIterator __last, _Pred&& __pred) const noexcept {
+ using _AnyOf = __dispatch<__any_of, __current_configuration, _ExecutionPolicy>;
+ auto __res = _AnyOf()(__policy, __first, __last, [&](__iter_reference<_ForwardIterator> __value) {
+ return !__pred(__value);
+ });
+ if (!__res)
+ return nullopt;
+ return !*__res;
+ }
+};
+
+template <class _ExecutionPolicy>
+struct __none_of<__default_backend_tag, _ExecutionPolicy> {
+ template <class _Policy, class _ForwardIterator, class _Pred>
+ [[nodiscard]] _LIBCPP_HIDE_FROM_ABI optional<bool>
+ operator()(_Policy&& __policy, _ForwardIterator __first, _ForwardIterator __last, _Pred&& __pred) const noexcept {
+ using _AnyOf = __dispatch<__any_of, __current_configuration, _ExecutionPolicy>;
+ auto __res = _AnyOf()(__policy, __first, __last, std::forward<_Pred>(__pred));
+ if (!__res)
+ return nullopt;
+ return !*__res;
+ }
+};
+
+template <class _ExecutionPolicy>
+struct __is_partitioned<__default_backend_tag, _ExecutionPolicy> {
+ template <class _Policy, class _ForwardIterator, class _Pred>
+ [[nodiscard]] _LIBCPP_HIDE_FROM_ABI optional<bool>
+ operator()(_Policy&& __policy, _ForwardIterator __first, _ForwardIterator __last, _Pred&& __pred) const noexcept {
+ using _FindIfNot = __dispatch<__find_if_not, __current_configuration, _ExecutionPolicy>;
+ auto __maybe_first = _FindIfNot()(__policy, std::move(__first), std::move(__last), __pred);
+ if (__maybe_first == nullopt)
+ return nullopt;
+
+ __first = *__maybe_first;
+ if (__first == __last)
+ return true;
+ ++__first;
+ using _NoneOf = __dispatch<__none_of, __current_configuration, _ExecutionPolicy>;
+ return _NoneOf()(__policy, std::move(__first), std::move(__last), __pred);
+ }
+};
+
+//////////////////////////////////////////////////////////////
+// for_each family
+//////////////////////////////////////////////////////////////
+template <class _ExecutionPolicy>
+struct __for_each_n<__default_backend_tag, _ExecutionPolicy> {
+ template <class _Policy, class _ForwardIterator, class _Size, class _Function>
+ [[nodiscard]] _LIBCPP_HIDE_FROM_ABI optional<__empty>
+ operator()(_Policy&& __policy, _ForwardIterator __first, _Size __size, _Function __func) const noexcept {
+ if constexpr (__has_random_access_iterator_category_or_concept<_ForwardIterator>::value) {
+ using _ForEach = __dispatch<__for_each, __current_configuration, _ExecutionPolicy>;
+ _ForwardIterator __last = __first + __size;
+ return _ForEach()(__policy, std::move(__first), std::move(__last), std::move(__func));
+ } else {
+ // Otherwise, use the serial algorithm to avoid doing two passes over the input
+ std::for_each_n(std::move(__first), __size, std::move(__func));
+ return __empty{};
+ }
+ }
+};
+
+template <class _ExecutionPolicy>
+struct __fill<__default_backend_tag, _ExecutionPolicy> {
+ template <class _Policy, class _ForwardIterator, class _Tp>
+ [[nodiscard]] _LIBCPP_HIDE_FROM_ABI optional<__empty>
+ operator()(_Policy&& __policy, _ForwardIterator __first, _ForwardIterator __last, _Tp const& __value) const noexcept {
+ using _ForEach = __dispatch<__for_each, __current_configuration, _ExecutionPolicy>;
+ using _Ref = __iter_reference<_ForwardIterator>;
+ return _ForEach()(__policy, std::move(__first), std::move(__last), [&](_Ref __element) { __element = __value; });
+ }
+};
+
+template <class _ExecutionPolicy>
+struct __fill_n<__default_backend_tag, _ExecutionPolicy> {
+ template <class _Policy, class _ForwardIterator, class _Size, class _Tp>
+ [[nodiscard]] _LIBCPP_HIDE_FROM_ABI optional<__empty>
+ operator()(_Policy&& __policy, _ForwardIterator __first, _Size __n, _Tp const& __value) const noexcept {
+ if constexpr (__has_random_access_iterator_category_or_concept<_ForwardIterator>::value) {
+ using _Fill = __dispatch<__fill, __current_configuration, _ExecutionPolicy>;
+ _ForwardIterator __last = __first + __n;
+ return _Fill()(__policy, std::move(__first), std::move(__last), __value);
+ } else {
+ // Otherwise, use the serial algorithm to avoid doing two passes over the input
+ std::fill_n(std::move(__first), __n, __value);
+ return optional<__empty>{__empty{}};
+ }
+ }
+};
+
+template <class _ExecutionPolicy>
+struct __replace<__default_backend_tag, _ExecutionPolicy> {
+ template <class _Policy, class _ForwardIterator, class _Tp>
+ [[nodiscard]] _LIBCPP_HIDE_FROM_ABI optional<__empty>
+ operator()(_Policy&& __policy, _ForwardIterator __first, _ForwardIterator __last, _Tp const& __old, _Tp const& __new)
+ const noexcept {
+ using _ReplaceIf = __dispatch<__replace_if, __current_configuration, _ExecutionPolicy>;
+ using _Ref = __iter_reference<_ForwardIterator>;
+ return _ReplaceIf()(
+ __policy, std::move(__first), std::move(__last), [&](_Ref __element) { return __element == __old; }, __new);
+ }
+};
+
+template <class _ExecutionPolicy>
+struct __replace_if<__default_backend_tag, _ExecutionPolicy> {
+ template <class _Policy, class _ForwardIterator, class _Pred, class _Tp>
+ [[nodiscard]] _LIBCPP_HIDE_FROM_ABI optional<__empty> operator()(
+ _Policy&& __policy, _ForwardIterator __first, _ForwardIterator __last, _Pred&& __pred, _Tp const& __new_value)
+ const noexcept {
+ using _ForEach = __dispatch<__for_each, __current_configuration, _ExecutionPolicy>;
+ using _Ref = __iter_reference<_ForwardIterator>;
+ return _ForEach()(__policy, std::move(__first), std::move(__last), [&](_Ref __element) {
+ if (__pred(__element))
+ __element = __new_value;
+ });
+ }
+};
+
+template <class _ExecutionPolicy>
+struct __generate<__default_backend_tag, _ExecutionPolicy> {
+ template <class _Policy, class _ForwardIterator, class _Generator>
+ [[nodiscard]] _LIBCPP_HIDE_FROM_ABI optional<__empty>
+ operator()(_Policy&& __policy, _ForwardIterator __first, _ForwardIterator __last, _Generator&& __gen) const noexcept {
+ using _ForEach = __dispatch<__for_each, __current_configuration, _ExecutionPolicy>;
+ using _Ref = __iter_reference<_ForwardIterator>;
+ return _ForEach()(__policy, std::move(__first), std::move(__last), [&](_Ref __element) { __element = __gen(); });
+ }
+};
+
+template <class _ExecutionPolicy>
+struct __generate_n<__default_backend_tag, _ExecutionPolicy> {
+ template <class _Policy, class _ForwardIterator, class _Size, class _Generator>
+ [[nodiscard]] _LIBCPP_HIDE_FROM_ABI optional<__empty>
+ operator()(_Policy&& __policy, _ForwardIterator __first, _Size __n, _Generator&& __gen) const noexcept {
+ using _ForEachN = __dispatch<__for_each_n, __current_configuration, _ExecutionPolicy>;
+ using _Ref = __iter_reference<_ForwardIterator>;
+ return _ForEachN()(__policy, std::move(__first), __n, [&](_Ref __element) { __element = __gen(); });
+ }
+};
+
+//////////////////////////////////////////////////////////////
+// stable_sort family
+//////////////////////////////////////////////////////////////
+template <class _ExecutionPolicy>
+struct __sort<__default_backend_tag, _ExecutionPolicy> {
+ template <class _Policy, class _RandomAccessIterator, class _Comp>
+ _LIBCPP_HIDE_FROM_ABI optional<__empty> operator()(
+ _Policy&& __policy, _RandomAccessIterator __first, _RandomAccessIterator __last, _Comp&& __comp) const noexcept {
+ using _StableSort = __dispatch<__stable_sort, __current_configuration, _ExecutionPolicy>;
+ return _StableSort()(__policy, std::move(__first), std::move(__last), std::forward<_Comp>(__comp));
+ }
+};
+
+//////////////////////////////////////////////////////////////
+// transform_reduce family
+//////////////////////////////////////////////////////////////
+template <class _ExecutionPolicy>
+struct __count_if<__default_backend_tag, _ExecutionPolicy> {
+ template <class _Policy, class _ForwardIterator, class _Predicate>
+ [[nodiscard]] _LIBCPP_HIDE_FROM_ABI optional<__iter_diff_t<_ForwardIterator>> operator()(
+ _Policy&& __policy, _ForwardIterator __first, _ForwardIterator __last, _Predicate&& __pred) const noexcept {
+ using _TransformReduce = __dispatch<__transform_reduce, __current_configuration, _ExecutionPolicy>;
+ using _DiffT = __iter_diff_t<_ForwardIterator>;
+ using _Ref = __iter_reference<_ForwardIterator>;
+ return _TransformReduce()(
+ __policy, std::move(__first), std::move(__last), _DiffT{}, std::plus{}, [&](_Ref __element) -> _DiffT {
+ return __pred(__element) ? _DiffT(1) : _DiffT(0);
+ });
+ }
+};
+
+template <class _ExecutionPolicy>
+struct __count<__default_backend_tag, _ExecutionPolicy> {
+ template <class _Policy, class _ForwardIterator, class _Tp>
+ [[nodiscard]] _LIBCPP_HIDE_FROM_ABI optional<__iter_diff_t<_ForwardIterator>>
+ operator()(_Policy&& __policy, _ForwardIterator __first, _ForwardIterator __last, _Tp const& __value) const noexcept {
+ using _CountIf = __dispatch<__count_if, __current_configuration, _ExecutionPolicy>;
+ using _Ref = __iter_reference<_ForwardIterator>;
+ return _CountIf()(__policy, std::move(__first), std::move(__last), [&](_Ref __element) -> bool {
+ return __element == __value;
+ });
+ }
+};
+
+template <class _ExecutionPolicy>
+struct __equal_3leg<__default_backend_tag, _ExecutionPolicy> {
+ template <class _Policy, class _ForwardIterator1, class _ForwardIterator2, class _Predicate>
+ [[nodiscard]] _LIBCPP_HIDE_FROM_ABI optional<bool>
+ operator()(_Policy&& __policy,
+ _ForwardIterator1 __first1,
+ _ForwardIterator1 __last1,
+ _ForwardIterator2 __first2,
+ _Predicate&& __pred) const noexcept {
+ using _TransformReduce = __dispatch<__transform_reduce_binary, __current_configuration, _ExecutionPolicy>;
+ return _TransformReduce()(
+ __policy,
+ std::move(__first1),
+ std::move(__last1),
+ std::move(__first2),
+ true,
+ std::logical_and{},
+ std::forward<_Predicate>(__pred));
+ }
+};
+
+template <class _ExecutionPolicy>
+struct __equal<__default_backend_tag, _ExecutionPolicy> {
+ template <class _Policy, class _ForwardIterator1, class _ForwardIterator2, class _Predicate>
+ [[nodiscard]] _LIBCPP_HIDE_FROM_ABI optional<bool>
+ operator()(_Policy&& __policy,
+ _ForwardIterator1 __first1,
+ _ForwardIterator1 __last1,
+ _ForwardIterator2 __first2,
+ _ForwardIterator2 __last2,
+ _Predicate&& __pred) const noexcept {
+ if constexpr (__has_random_access_iterator_category<_ForwardIterator1>::value &&
+ __has_random_access_iterator_category<_ForwardIterator2>::value) {
+ if (__last1 - __first1 != __last2 - __first2)
+ return false;
+ // Fall back to the 3 legged algorithm
+ using _Equal3Leg = __dispatch<__equal_3leg, __current_configuration, _ExecutionPolicy>;
+ return _Equal3Leg()(
+ __policy, std::move(__first1), std::move(__last1), std::move(__first2), std::forward<_Predicate>(__pred));
+ } else {
+ // If we don't have random access, fall back to the serial algorithm cause we can't do much
+ return std::equal(
+ std::move(__first1),
+ std::move(__last1),
+ std::move(__first2),
+ std::move(__last2),
+ std::forward<_Predicate>(__pred));
+ }
+ }
+};
+
+template <class _ExecutionPolicy>
+struct __reduce<__default_backend_tag, _ExecutionPolicy> {
+ template <class _Policy, class _ForwardIterator, class _Tp, class _BinaryOperation>
+ [[nodiscard]] _LIBCPP_HIDE_FROM_ABI optional<_Tp>
+ operator()(_Policy&& __policy, _ForwardIterator __first, _ForwardIterator __last, _Tp __init, _BinaryOperation&& __op)
+ const noexcept {
+ using _TransformReduce = __dispatch<__transform_reduce, __current_configuration, _ExecutionPolicy>;
+ return _TransformReduce()(
+ __policy,
+ std::move(__first),
+ std::move(__last),
+ std::move(__init),
+ std::forward<_BinaryOperation>(__op),
+ __identity{});
+ }
+};
+
+//////////////////////////////////////////////////////////////
+// transform family
+//////////////////////////////////////////////////////////////
+template <class _ExecutionPolicy>
+struct __replace_copy_if<__default_backend_tag, _ExecutionPolicy> {
+ template <class _Policy, class _ForwardIterator, class _ForwardOutIterator, class _Pred, class _Tp>
+ [[nodiscard]] _LIBCPP_HIDE_FROM_ABI optional<__empty>
+ operator()(_Policy&& __policy,
+ _ForwardIterator __first,
+ _ForwardIterator __last,
+ _ForwardOutIterator __out_it,
+ _Pred&& __pred,
+ _Tp const& __new_value) const noexcept {
+ using _Transform = __dispatch<__transform, __current_configuration, _ExecutionPolicy>;
+ using _Ref = __iter_reference<_ForwardIterator>;
+ auto __res =
+ _Transform()(__policy, std::move(__first), std::move(__last), std::move(__out_it), [&](_Ref __element) {
+ return __pred(__element) ? __new_value : __element;
+ });
+ if (__res == nullopt)
+ return nullopt;
+ return __empty{};
+ }
+};
+
+template <class _ExecutionPolicy>
+struct __replace_copy<__default_backend_tag, _ExecutionPolicy> {
+ template <class _Policy, class _ForwardIterator, class _ForwardOutIterator, class _Tp>
+ [[nodiscard]] _LIBCPP_HIDE_FROM_ABI optional<__empty>
+ operator()(_Policy&& __policy,
+ _ForwardIterator __first,
+ _ForwardIterator __last,
+ _ForwardOutIterator __out_it,
+ _Tp const& __old_value,
+ _Tp const& __new_value) const noexcept {
+ using _ReplaceCopyIf = __dispatch<__replace_copy_if, __current_configuration, _ExecutionPolicy>;
+ using _Ref = __iter_reference<_ForwardIterator>;
+ return _ReplaceCopyIf()(
+ __policy,
+ std::move(__first),
+ std::move(__last),
+ std::move(__out_it),
+ [&](_Ref __element) { return __element == __old_value; },
+ __new_value);
+ }
+};
+
+// TODO: Use the std::copy/move shenanigans to forward to std::memmove
+// Investigate whether we want to still forward to std::transform(policy)
+// in that case for the execution::par part, or whether we actually want
+// to run everything serially in that case.
+template <class _ExecutionPolicy>
+struct __move<__default_backend_tag, _ExecutionPolicy> {
+ template <class _Policy, class _ForwardIterator, class _ForwardOutIterator>
+ [[nodiscard]] _LIBCPP_HIDE_FROM_ABI optional<_ForwardOutIterator>
+ operator()(_Policy&& __policy, _ForwardIterator __first, _ForwardIterator __last, _ForwardOutIterator __out_it)
+ const noexcept {
+ using _Transform = __dispatch<__transform, __current_configuration, _ExecutionPolicy>;
+ return _Transform()(__policy, std::move(__first), std::move(__last), std::move(__out_it), [&](auto&& __element) {
+ return std::move(__element);
+ });
+ }
+};
+
+// TODO: Use the std::copy/move shenanigans to forward to std::memmove
+template <class _ExecutionPolicy>
+struct __copy<__default_backend_tag, _ExecutionPolicy> {
+ template <class _Policy, class _ForwardIterator, class _ForwardOutIterator>
+ [[nodiscard]] _LIBCPP_HIDE_FROM_ABI optional<_ForwardOutIterator>
+ operator()(_Policy&& __policy, _ForwardIterator __first, _ForwardIterator __last, _ForwardOutIterator __out_it)
+ const noexcept {
+ using _Transform = __dispatch<__transform, __current_configuration, _ExecutionPolicy>;
+ return _Transform()(__policy, std::move(__first), std::move(__last), std::move(__out_it), __identity());
+ }
+};
+
+template <class _ExecutionPolicy>
+struct __copy_n<__default_backend_tag, _ExecutionPolicy> {
+ template <class _Policy, class _ForwardIterator, class _Size, class _ForwardOutIterator>
+ [[nodiscard]] _LIBCPP_HIDE_FROM_ABI optional<_ForwardOutIterator>
+ operator()(_Policy&& __policy, _ForwardIterator __first, _Size __n, _ForwardOutIterator __out_it) const noexcept {
+ if constexpr (__has_random_access_iterator_category_or_concept<_ForwardIterator>::value) {
+ using _Copy = __dispatch<__copy, __current_configuration, _ExecutionPolicy>;
+ _ForwardIterator __last = __first + __n;
+ return _Copy()(__policy, std::move(__first), std::move(__last), std::move(__out_it));
+ } else {
+ // Otherwise, use the serial algorithm to avoid doing two passes over the input
+ return std::copy_n(std::move(__first), __n, std::move(__out_it));
+ }
+ }
+};
+
+template <class _ExecutionPolicy>
+struct __rotate_copy<__default_backend_tag, _ExecutionPolicy> {
+ template <class _Policy, class _ForwardIterator, class _ForwardOutIterator>
+ [[nodiscard]] _LIBCPP_HIDE_FROM_ABI optional<_ForwardOutIterator>
+ operator()(_Policy&& __policy,
+ _ForwardIterator __first,
+ _ForwardIterator __middle,
+ _ForwardIterator __last,
+ _ForwardOutIterator __out_it) const noexcept {
+ using _Copy = __dispatch<__copy, __current_configuration, _ExecutionPolicy>;
+ auto __result_mid = _Copy()(__policy, __middle, std::move(__last), std::move(__out_it));
+ if (__result_mid == nullopt)
+ return nullopt;
+ return _Copy()(__policy, std::move(__first), std::move(__middle), *std::move(__result_mid));
+ }
+};
+
+} // namespace __pstl
+_LIBCPP_END_NAMESPACE_STD
+
+_LIBCPP_POP_MACROS
+
+#endif // _LIBCPP___PSTL_BACKENDS_DEFAULT_H
diff --git a/libcxx/include/__pstl/backends/libdispatch.h b/libcxx/include/__pstl/backends/libdispatch.h
index af1da80dc133..a0c3ad980ed1 100644
--- a/libcxx/include/__pstl/backends/libdispatch.h
+++ b/libcxx/include/__pstl/backends/libdispatch.h
@@ -23,8 +23,16 @@
#include <__memory/construct_at.h>
#include <__memory/unique_ptr.h>
#include <__numeric/reduce.h>
-#include <__pstl/configuration_fwd.h>
+#include <__pstl/backend_fwd.h>
+#include <__pstl/cpu_algos/any_of.h>
#include <__pstl/cpu_algos/cpu_traits.h>
+#include <__pstl/cpu_algos/fill.h>
+#include <__pstl/cpu_algos/find_if.h>
+#include <__pstl/cpu_algos/for_each.h>
+#include <__pstl/cpu_algos/merge.h>
+#include <__pstl/cpu_algos/stable_sort.h>
+#include <__pstl/cpu_algos/transform.h>
+#include <__pstl/cpu_algos/transform_reduce.h>
#include <__utility/empty.h>
#include <__utility/exception_guard.h>
#include <__utility/move.h>
@@ -36,8 +44,6 @@
_LIBCPP_PUSH_MACROS
#include <__undef_macros>
-#if !defined(_LIBCPP_HAS_NO_INCOMPLETE_PSTL) && _LIBCPP_STD_VER >= 17
-
_LIBCPP_BEGIN_NAMESPACE_STD
namespace __pstl {
@@ -134,15 +140,15 @@ struct __cpu_traits<__libdispatch_backend_tag> {
unique_ptr<__merge_range_t[], decltype(__destroy)> __ranges(
[&]() -> __merge_range_t* {
-# ifndef _LIBCPP_HAS_NO_EXCEPTIONS
+#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
try {
-# endif
+#endif
return std::allocator<__merge_range_t>().allocate(__n_ranges);
-# ifndef _LIBCPP_HAS_NO_EXCEPTIONS
+#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
} catch (const std::bad_alloc&) {
return nullptr;
}
-# endif
+#endif
}(),
__destroy);
@@ -341,21 +347,51 @@ struct __cpu_traits<__libdispatch_backend_tag> {
static constexpr size_t __lane_size = 64;
};
+// Mandatory implementations of the computational basis
+template <class _ExecutionPolicy>
+struct __find_if<__libdispatch_backend_tag, _ExecutionPolicy>
+ : __cpu_parallel_find_if<__libdispatch_backend_tag, _ExecutionPolicy> {};
+
+template <class _ExecutionPolicy>
+struct __for_each<__libdispatch_backend_tag, _ExecutionPolicy>
+ : __cpu_parallel_for_each<__libdispatch_backend_tag, _ExecutionPolicy> {};
+
+template <class _ExecutionPolicy>
+struct __merge<__libdispatch_backend_tag, _ExecutionPolicy>
+ : __cpu_parallel_merge<__libdispatch_backend_tag, _ExecutionPolicy> {};
+
+template <class _ExecutionPolicy>
+struct __stable_sort<__libdispatch_backend_tag, _ExecutionPolicy>
+ : __cpu_parallel_stable_sort<__libdispatch_backend_tag, _ExecutionPolicy> {};
+
+template <class _ExecutionPolicy>
+struct __transform<__libdispatch_backend_tag, _ExecutionPolicy>
+ : __cpu_parallel_transform<__libdispatch_backend_tag, _ExecutionPolicy> {};
+
+template <class _ExecutionPolicy>
+struct __transform_binary<__libdispatch_backend_tag, _ExecutionPolicy>
+ : __cpu_parallel_transform_binary<__libdispatch_backend_tag, _ExecutionPolicy> {};
+
+template <class _ExecutionPolicy>
+struct __transform_reduce<__libdispatch_backend_tag, _ExecutionPolicy>
+ : __cpu_parallel_transform_reduce<__libdispatch_backend_tag, _ExecutionPolicy> {};
+
+template <class _ExecutionPolicy>
+struct __transform_reduce_binary<__libdispatch_backend_tag, _ExecutionPolicy>
+ : __cpu_parallel_transform_reduce_binary<__libdispatch_backend_tag, _ExecutionPolicy> {};
+
+// Not mandatory, but better optimized
+template <class _ExecutionPolicy>
+struct __any_of<__libdispatch_backend_tag, _ExecutionPolicy>
+ : __cpu_parallel_any_of<__libdispatch_backend_tag, _ExecutionPolicy> {};
+
+template <class _ExecutionPolicy>
+struct __fill<__libdispatch_backend_tag, _ExecutionPolicy>
+ : __cpu_parallel_fill<__libdispatch_backend_tag, _ExecutionPolicy> {};
+
} // namespace __pstl
_LIBCPP_END_NAMESPACE_STD
-#endif // !defined(_LIBCPP_HAS_NO_INCOMPLETE_PSTL) && _LIBCPP_STD_VER >= 17
-
_LIBCPP_POP_MACROS
-// Implement PSTL algorithms based on the __cpu_traits specialized above
-#include <__pstl/cpu_algos/any_of.h>
-#include <__pstl/cpu_algos/fill.h>
-#include <__pstl/cpu_algos/find_if.h>
-#include <__pstl/cpu_algos/for_each.h>
-#include <__pstl/cpu_algos/merge.h>
-#include <__pstl/cpu_algos/stable_sort.h>
-#include <__pstl/cpu_algos/transform.h>
-#include <__pstl/cpu_algos/transform_reduce.h>
-
#endif // _LIBCPP___PSTL_BACKENDS_LIBDISPATCH_H
diff --git a/libcxx/include/__pstl/backends/serial.h b/libcxx/include/__pstl/backends/serial.h
index 6e343313bea3..5f24499899bd 100644
--- a/libcxx/include/__pstl/backends/serial.h
+++ b/libcxx/include/__pstl/backends/serial.h
@@ -10,68 +10,167 @@
#ifndef _LIBCPP___PSTL_BACKENDS_SERIAL_H
#define _LIBCPP___PSTL_BACKENDS_SERIAL_H
+#include <__algorithm/find_if.h>
+#include <__algorithm/for_each.h>
+#include <__algorithm/merge.h>
+#include <__algorithm/stable_sort.h>
+#include <__algorithm/transform.h>
#include <__config>
-#include <__pstl/configuration_fwd.h>
-#include <__pstl/cpu_algos/cpu_traits.h>
+#include <__numeric/transform_reduce.h>
+#include <__pstl/backend_fwd.h>
#include <__utility/empty.h>
+#include <__utility/forward.h>
#include <__utility/move.h>
-#include <cstddef>
#include <optional>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
# pragma GCC system_header
#endif
-#if !defined(_LIBCPP_HAS_NO_INCOMPLETE_PSTL) && _LIBCPP_STD_VER >= 17
-
_LIBCPP_PUSH_MACROS
-# include <__undef_macros>
+#include <__undef_macros>
_LIBCPP_BEGIN_NAMESPACE_STD
namespace __pstl {
-template <>
-struct __cpu_traits<__serial_backend_tag> {
- template <class _RandomAccessIterator, class _Fp>
- _LIBCPP_HIDE_FROM_ABI static optional<__empty>
- __for_each(_RandomAccessIterator __first, _RandomAccessIterator __last, _Fp __f) {
- __f(__first, __last);
+//
+// This partial PSTL backend runs everything serially.
+//
+// TODO: Right now, the serial backend must be used with another backend
+// like the "default backend" because it doesn't implement all the
+// necessary PSTL operations. It would be better to dispatch all
+// algorithms to their serial counterpart directly, since this can
+// often be more efficient than the "default backend"'s implementation
+// if we end up running serially anyways.
+//
+
+template <class _ExecutionPolicy>
+struct __find_if<__serial_backend_tag, _ExecutionPolicy> {
+ template <class _Policy, class _ForwardIterator, class _Pred>
+ _LIBCPP_HIDE_FROM_ABI optional<_ForwardIterator>
+ operator()(_Policy&&, _ForwardIterator __first, _ForwardIterator __last, _Pred&& __pred) const noexcept {
+ return std::find_if(std::move(__first), std::move(__last), std::forward<_Pred>(__pred));
+ }
+};
+
+template <class _ExecutionPolicy>
+struct __for_each<__serial_backend_tag, _ExecutionPolicy> {
+ template <class _Policy, class _ForwardIterator, class _Function>
+ _LIBCPP_HIDE_FROM_ABI optional<__empty>
+ operator()(_Policy&&, _ForwardIterator __first, _ForwardIterator __last, _Function&& __func) const noexcept {
+ std::for_each(std::move(__first), std::move(__last), std::forward<_Function>(__func));
return __empty{};
}
+};
- template <class _Index, class _UnaryOp, class _Tp, class _BinaryOp, class _Reduce>
- _LIBCPP_HIDE_FROM_ABI static optional<_Tp>
- __transform_reduce(_Index __first, _Index __last, _UnaryOp, _Tp __init, _BinaryOp, _Reduce __reduce) {
- return __reduce(std::move(__first), std::move(__last), std::move(__init));
+template <class _ExecutionPolicy>
+struct __merge<__serial_backend_tag, _ExecutionPolicy> {
+ template <class _Policy, class _ForwardIterator1, class _ForwardIterator2, class _ForwardOutIterator, class _Comp>
+ _LIBCPP_HIDE_FROM_ABI optional<_ForwardOutIterator> operator()(
+ _Policy&&,
+ _ForwardIterator1 __first1,
+ _ForwardIterator1 __last1,
+ _ForwardIterator2 __first2,
+ _ForwardIterator2 __last2,
+ _ForwardOutIterator __outit,
+ _Comp&& __comp) const noexcept {
+ return std::merge(
+ std::move(__first1),
+ std::move(__last1),
+ std::move(__first2),
+ std::move(__last2),
+ std::move(__outit),
+ std::forward<_Comp>(__comp));
}
+};
- template <class _RandomAccessIterator, class _Compare, class _LeafSort>
- _LIBCPP_HIDE_FROM_ABI static optional<__empty>
- __stable_sort(_RandomAccessIterator __first, _RandomAccessIterator __last, _Compare __comp, _LeafSort __leaf_sort) {
- __leaf_sort(__first, __last, __comp);
+template <class _ExecutionPolicy>
+struct __stable_sort<__serial_backend_tag, _ExecutionPolicy> {
+ template <class _Policy, class _RandomAccessIterator, class _Comp>
+ _LIBCPP_HIDE_FROM_ABI optional<__empty>
+ operator()(_Policy&&, _RandomAccessIterator __first, _RandomAccessIterator __last, _Comp&& __comp) const noexcept {
+ std::stable_sort(std::move(__first), std::move(__last), std::forward<_Comp>(__comp));
return __empty{};
}
+};
- _LIBCPP_HIDE_FROM_ABI static void __cancel_execution() {}
-
- template <class _RandomAccessIterator1,
- class _RandomAccessIterator2,
- class _RandomAccessIterator3,
- class _Compare,
- class _LeafMerge>
- _LIBCPP_HIDE_FROM_ABI static optional<__empty>
- __merge(_RandomAccessIterator1 __first1,
- _RandomAccessIterator1 __last1,
- _RandomAccessIterator2 __first2,
- _RandomAccessIterator2 __last2,
- _RandomAccessIterator3 __outit,
- _Compare __comp,
- _LeafMerge __leaf_merge) {
- __leaf_merge(__first1, __last1, __first2, __last2, __outit, __comp);
- return __empty{};
+template <class _ExecutionPolicy>
+struct __transform<__serial_backend_tag, _ExecutionPolicy> {
+ template <class _Policy, class _ForwardIterator, class _ForwardOutIterator, class _UnaryOperation>
+ _LIBCPP_HIDE_FROM_ABI optional<_ForwardOutIterator> operator()(
+ _Policy&&, _ForwardIterator __first, _ForwardIterator __last, _ForwardOutIterator __outit, _UnaryOperation&& __op)
+ const noexcept {
+ return std::transform(
+ std::move(__first), std::move(__last), std::move(__outit), std::forward<_UnaryOperation>(__op));
+ }
+};
+
+template <class _ExecutionPolicy>
+struct __transform_binary<__serial_backend_tag, _ExecutionPolicy> {
+ template <class _Policy,
+ class _ForwardIterator1,
+ class _ForwardIterator2,
+ class _ForwardOutIterator,
+ class _BinaryOperation>
+ _LIBCPP_HIDE_FROM_ABI optional<_ForwardOutIterator>
+ operator()(_Policy&&,
+ _ForwardIterator1 __first1,
+ _ForwardIterator1 __last1,
+ _ForwardIterator2 __first2,
+ _ForwardOutIterator __outit,
+ _BinaryOperation&& __op) const noexcept {
+ return std::transform(
+ std::move(__first1),
+ std::move(__last1),
+ std::move(__first2),
+ std::move(__outit),
+ std::forward<_BinaryOperation>(__op));
+ }
+};
+
+template <class _ExecutionPolicy>
+struct __transform_reduce<__serial_backend_tag, _ExecutionPolicy> {
+ template <class _Policy, class _ForwardIterator, class _Tp, class _BinaryOperation, class _UnaryOperation>
+ _LIBCPP_HIDE_FROM_ABI optional<_Tp>
+ operator()(_Policy&&,
+ _ForwardIterator __first,
+ _ForwardIterator __last,
+ _Tp __init,
+ _BinaryOperation&& __reduce,
+ _UnaryOperation&& __transform) const noexcept {
+ return std::transform_reduce(
+ std::move(__first),
+ std::move(__last),
+ std::move(__init),
+ std::forward<_BinaryOperation>(__reduce),
+ std::forward<_UnaryOperation>(__transform));
}
+};
- static constexpr size_t __lane_size = 64;
+template <class _ExecutionPolicy>
+struct __transform_reduce_binary<__serial_backend_tag, _ExecutionPolicy> {
+ template <class _Policy,
+ class _ForwardIterator1,
+ class _ForwardIterator2,
+ class _Tp,
+ class _BinaryOperation1,
+ class _BinaryOperation2>
+ _LIBCPP_HIDE_FROM_ABI optional<_Tp> operator()(
+ _Policy&&,
+ _ForwardIterator1 __first1,
+ _ForwardIterator1 __last1,
+ _ForwardIterator2 __first2,
+ _Tp __init,
+ _BinaryOperation1&& __reduce,
+ _BinaryOperation2&& __transform) const noexcept {
+ return std::transform_reduce(
+ std::move(__first1),
+ std::move(__last1),
+ std::move(__first2),
+ std::move(__init),
+ std::forward<_BinaryOperation1>(__reduce),
+ std::forward<_BinaryOperation2>(__transform));
+ }
};
} // namespace __pstl
@@ -79,16 +178,4 @@ _LIBCPP_END_NAMESPACE_STD
_LIBCPP_POP_MACROS
-#endif // !defined(_LIBCPP_HAS_NO_INCOMPLETE_PSTL) && && _LIBCPP_STD_VER >= 17
-
-// Implement PSTL algorithms based on the __cpu_traits specialized above
-#include <__pstl/cpu_algos/any_of.h>
-#include <__pstl/cpu_algos/fill.h>
-#include <__pstl/cpu_algos/find_if.h>
-#include <__pstl/cpu_algos/for_each.h>
-#include <__pstl/cpu_algos/merge.h>
-#include <__pstl/cpu_algos/stable_sort.h>
-#include <__pstl/cpu_algos/transform.h>
-#include <__pstl/cpu_algos/transform_reduce.h>
-
#endif // _LIBCPP___PSTL_BACKENDS_SERIAL_H
diff --git a/libcxx/include/__pstl/backends/std_thread.h b/libcxx/include/__pstl/backends/std_thread.h
index e58f4859e6c9..49570bd30b08 100644
--- a/libcxx/include/__pstl/backends/std_thread.h
+++ b/libcxx/include/__pstl/backends/std_thread.h
@@ -9,10 +9,17 @@
#ifndef _LIBCPP___PSTL_BACKENDS_STD_THREAD_H
#define _LIBCPP___PSTL_BACKENDS_STD_THREAD_H
-#include <__assert>
#include <__config>
-#include <__pstl/configuration_fwd.h>
+#include <__pstl/backend_fwd.h>
+#include <__pstl/cpu_algos/any_of.h>
#include <__pstl/cpu_algos/cpu_traits.h>
+#include <__pstl/cpu_algos/fill.h>
+#include <__pstl/cpu_algos/find_if.h>
+#include <__pstl/cpu_algos/for_each.h>
+#include <__pstl/cpu_algos/merge.h>
+#include <__pstl/cpu_algos/stable_sort.h>
+#include <__pstl/cpu_algos/transform.h>
+#include <__pstl/cpu_algos/transform_reduce.h>
#include <__utility/empty.h>
#include <__utility/move.h>
#include <cstddef>
@@ -25,14 +32,16 @@
_LIBCPP_PUSH_MACROS
#include <__undef_macros>
-#if !defined(_LIBCPP_HAS_NO_INCOMPLETE_PSTL) && _LIBCPP_STD_VER >= 17
-
-// This backend implementation is for testing purposes only and not meant for production use. This will be replaced
-// by a proper implementation once the PSTL implementation is somewhat stable.
-
_LIBCPP_BEGIN_NAMESPACE_STD
namespace __pstl {
+//
+// This partial backend implementation is for testing purposes only and not meant for production use. This will be
+// replaced by a proper implementation once the PSTL implementation is somewhat stable.
+//
+// This is intended to be used on top of the "default backend".
+//
+
template <>
struct __cpu_traits<__std_thread_backend_tag> {
template <class _RandomAccessIterator, class _Fp>
@@ -77,21 +86,51 @@ struct __cpu_traits<__std_thread_backend_tag> {
static constexpr size_t __lane_size = 64;
};
+// Mandatory implementations of the computational basis
+template <class _ExecutionPolicy>
+struct __find_if<__std_thread_backend_tag, _ExecutionPolicy>
+ : __cpu_parallel_find_if<__std_thread_backend_tag, _ExecutionPolicy> {};
+
+template <class _ExecutionPolicy>
+struct __for_each<__std_thread_backend_tag, _ExecutionPolicy>
+ : __cpu_parallel_for_each<__std_thread_backend_tag, _ExecutionPolicy> {};
+
+template <class _ExecutionPolicy>
+struct __merge<__std_thread_backend_tag, _ExecutionPolicy>
+ : __cpu_parallel_merge<__std_thread_backend_tag, _ExecutionPolicy> {};
+
+template <class _ExecutionPolicy>
+struct __stable_sort<__std_thread_backend_tag, _ExecutionPolicy>
+ : __cpu_parallel_stable_sort<__std_thread_backend_tag, _ExecutionPolicy> {};
+
+template <class _ExecutionPolicy>
+struct __transform<__std_thread_backend_tag, _ExecutionPolicy>
+ : __cpu_parallel_transform<__std_thread_backend_tag, _ExecutionPolicy> {};
+
+template <class _ExecutionPolicy>
+struct __transform_binary<__std_thread_backend_tag, _ExecutionPolicy>
+ : __cpu_parallel_transform_binary<__std_thread_backend_tag, _ExecutionPolicy> {};
+
+template <class _ExecutionPolicy>
+struct __transform_reduce<__std_thread_backend_tag, _ExecutionPolicy>
+ : __cpu_parallel_transform_reduce<__std_thread_backend_tag, _ExecutionPolicy> {};
+
+template <class _ExecutionPolicy>
+struct __transform_reduce_binary<__std_thread_backend_tag, _ExecutionPolicy>
+ : __cpu_parallel_transform_reduce_binary<__std_thread_backend_tag, _ExecutionPolicy> {};
+
+// Not mandatory, but better optimized
+template <class _ExecutionPolicy>
+struct __any_of<__std_thread_backend_tag, _ExecutionPolicy>
+ : __cpu_parallel_any_of<__std_thread_backend_tag, _ExecutionPolicy> {};
+
+template <class _ExecutionPolicy>
+struct __fill<__std_thread_backend_tag, _ExecutionPolicy>
+ : __cpu_parallel_fill<__std_thread_backend_tag, _ExecutionPolicy> {};
+
} // namespace __pstl
_LIBCPP_END_NAMESPACE_STD
-#endif // !defined(_LIBCPP_HAS_NO_INCOMPLETE_PSTL) && && _LIBCPP_STD_VER >= 17
-
_LIBCPP_POP_MACROS
-// Implement PSTL algorithms based on the __cpu_traits specialized above
-#include <__pstl/cpu_algos/any_of.h>
-#include <__pstl/cpu_algos/fill.h>
-#include <__pstl/cpu_algos/find_if.h>
-#include <__pstl/cpu_algos/for_each.h>
-#include <__pstl/cpu_algos/merge.h>
-#include <__pstl/cpu_algos/stable_sort.h>
-#include <__pstl/cpu_algos/transform.h>
-#include <__pstl/cpu_algos/transform_reduce.h>
-
#endif // _LIBCPP___PSTL_BACKENDS_STD_THREAD_H
diff --git a/libcxx/include/__pstl/configuration_fwd.h b/libcxx/include/__pstl/configuration_fwd.h
deleted file mode 100644
index 995fcfce847c..000000000000
--- a/libcxx/include/__pstl/configuration_fwd.h
+++ /dev/null
@@ -1,245 +0,0 @@
-//===----------------------------------------------------------------------===//
-//
-// Part of the LLVM Project, under the Apache 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___PSTL_CONFIGURATION_FWD_H
-#define _LIBCPP___PSTL_CONFIGURATION_FWD_H
-
-#include <__config>
-#include <execution>
-
-#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-# pragma GCC system_header
-#endif
-
-#if !defined(_LIBCPP_HAS_NO_INCOMPLETE_PSTL) && _LIBCPP_STD_VER >= 17
-
-_LIBCPP_BEGIN_NAMESPACE_STD
-
-/*
-TODO: Documentation of how backends work
-
-A PSTL parallel backend is a tag type to which the following functions are associated, at minimum:
-
- template <class _ExecutionPolicy, class _Iterator, class _Func>
- optional<__empty> __pstl_for_each(_Backend, _ExecutionPolicy&&, _Iterator __first, _Iterator __last, _Func __f);
-
- template <class _ExecutionPolicy, class _Iterator, class _Predicate>
- optional<_Iterator> __pstl_find_if(_Backend, _Iterator __first, _Iterator __last, _Predicate __pred);
-
- template <class _ExecutionPolicy, class _RandomAccessIterator, class _Comp>
- optional<__empty>
- __pstl_stable_sort(_Backend, _RandomAccessIterator __first, _RandomAccessIterator __last, _Comp __comp);
-
- template <class _ExecutionPolicy,
- class _ForwardIterator1,
- class _ForwardIterator2,
- class _ForwardOutIterator,
- class _Comp>
- optional<_ForwardOutIterator> __pstl_merge(_Backend,
- _ForwardIterator1 __first1,
- _ForwardIterator1 __last1,
- _ForwardIterator2 __first2,
- _ForwardIterator2 __last2,
- _ForwardOutIterator __result,
- _Comp __comp);
-
- template <class _ExecutionPolicy, class _InIterator, class _OutIterator, class _UnaryOperation>
- optional<_OutIterator>
- __pstl_transform(_Backend, _InIterator __first, _InIterator __last, _OutIterator __result, _UnaryOperation __op);
-
- template <class _ExecutionPolicy, class _InIterator1, class _InIterator2, class _OutIterator, class _BinaryOperation>
- optional<_OutIterator> __pstl_transform(_InIterator1 __first1,
- _InIterator2 __first2,
- _InIterator1 __last1,
- _OutIterator __result,
- _BinaryOperation __op);
-
- template <class _ExecutionPolicy,
- class _Iterator1,
- class _Iterator2,
- class _Tp,
- class _BinaryOperation1,
- class _BinaryOperation2>
- optional<_Tp> __pstl_transform_reduce(_Backend,
- _Iterator1 __first1,
- _Iterator1 __last1,
- _Iterator2 __first2,
- _Iterator2 __last2,
- _Tp __init,
- _BinaryOperation1 __reduce,
- _BinaryOperation2 __transform);
-
- template <class _ExecutionPolicy, class _Iterator, class _Tp, class _BinaryOperation, class _UnaryOperation>
- optional<_Tp> __pstl_transform_reduce(_Backend,
- _Iterator __first,
- _Iterator __last,
- _Tp __init,
- _BinaryOperation __reduce,
- _UnaryOperation __transform);
-
-// TODO: Complete this list
-
-The following functions are optional but can be provided. If provided, they are used by the corresponding
-algorithms, otherwise they are implemented in terms of other algorithms. If none of the optional algorithms are
-implemented, all the algorithms will eventually forward to the basis algorithms listed above:
-
- template <class _ExecutionPolicy, class _Iterator, class _Size, class _Func>
- optional<__empty> __pstl_for_each_n(_Backend, _Iterator __first, _Size __n, _Func __f);
-
- template <class _ExecutionPolicy, class _Iterator, class _Predicate>
- optional<bool> __pstl_any_of(_Backend, _Iterator __first, _iterator __last, _Predicate __pred);
-
- template <class _ExecutionPolicy, class _Iterator, class _Predicate>
- optional<bool> __pstl_all_of(_Backend, _Iterator __first, _iterator __last, _Predicate __pred);
-
- template <class _ExecutionPolicy, class _Iterator, class _Predicate>
- optional<bool> __pstl_none_of(_Backend, _Iterator __first, _iterator __last, _Predicate __pred);
-
- template <class _ExecutionPolicy, class _Iterator, class _Tp>
- optional<_Iterator> __pstl_find(_Backend, _Iterator __first, _Iterator __last, const _Tp& __value);
-
- template <class _ExecutionPolicy, class _Iterator, class _Predicate>
- optional<_Iterator> __pstl_find_if_not(_Backend, _Iterator __first, _Iterator __last, _Predicate __pred);
-
- template <class _ExecutionPolicy, class _Iterator, class _Tp>
- optional<__empty> __pstl_fill(_Backend, _Iterator __first, _Iterator __last, const _Tp& __value);
-
- template <class _ExecutionPolicy, class _Iterator, class _SizeT, class _Tp>
- optional<__empty> __pstl_fill_n(_Backend, _Iterator __first, _SizeT __n, const _Tp& __value);
-
- template <class _ExecutionPolicy, class _Iterator, class _Generator>
- optional<__empty> __pstl_generate(_Backend, _Iterator __first, _Iterator __last, _Generator __gen);
-
- template <class _ExecutionPolicy, class _Iterator, class _Predicate>
- optional<__empty> __pstl_is_partitioned(_Backend, _Iterator __first, _Iterator __last, _Predicate __pred);
-
- template <class _ExecutionPolicy, class _Iterator, class _Size, class _Generator>
- optional<__empty> __pstl_generator_n(_Backend, _Iterator __first, _Size __n, _Generator __gen);
-
- template <class _ExecutionPolicy, class _terator1, class _Iterator2, class _OutIterator, class _Comp>
- optional<_OutIterator> __pstl_merge(_Backend,
- _Iterator1 __first1,
- _Iterator1 __last1,
- _Iterator2 __first2,
- _Iterator2 __last2,
- _OutIterator __result,
- _Comp __comp);
-
- template <class _ExecutionPolicy, class _Iterator, class _OutIterator>
- optional<_OutIterator> __pstl_move(_Backend, _Iterator __first, _Iterator __last, _OutIterator __result);
-
- template <class _ExecutionPolicy, class _Iterator, class _Tp, class _BinaryOperation>
- optional<_Tp> __pstl_reduce(_Backend, _Iterator __first, _Iterator __last, _Tp __init, _BinaryOperation __op);
-
- temlate <class _ExecutionPolicy, class _Iterator>
- optional<__iter_value_type<_Iterator>> __pstl_reduce(_Backend, _Iterator __first, _Iterator __last);
-
- template <class _ExecutionPolicy, class _Iterator, class _Tp>
- optional<__iter_diff_t<_Iterator>> __pstl_count(_Backend, _Iterator __first, _Iterator __last, const _Tp& __value);
-
- template <class _ExecutionPolicy, class _Iterator, class _Predicate>
- optional<__iter_diff_t<_Iterator>> __pstl_count_if(_Backend, _Iterator __first, _Iterator __last, _Predicate __pred);
-
- template <class _ExecutionPolicy, class _Iterator, class _Tp>
- optional<__empty>
- __pstl_replace(_Backend, _Iterator __first, _Iterator __last, const _Tp& __old_value, const _Tp& __new_value);
-
- template <class _ExecutionPolicy, class _Iterator, class _Pred, class _Tp>
- optional<__empty>
- __pstl_replace_if(_Backend, _Iterator __first, _Iterator __last, _Pred __pred, const _Tp& __new_value);
-
- template <class _ExecutionPolicy, class _Iterator, class _OutIterator, class _Tp>
- optional<__empty> __pstl_replace_copy(_Backend,
- _Iterator __first,
- _Iterator __last,
- _OutIterator __result,
- const _Tp& __old_value,
- const _Tp& __new_value);
-
- template <class _ExecutionPolicy, class _Iterator, class _OutIterator, class _Pred, class _Tp>
- optional<__empty> __pstl_replace_copy_if(_Backend,
- _Iterator __first,
- _Iterator __last,
- _OutIterator __result,
- _Pred __pred,
- const _Tp& __new_value);
-
- template <class _ExecutionPolicy, class _Iterator, class _OutIterator>
- optional<_Iterator> __pstl_rotate_copy(
- _Backend, _Iterator __first, _Iterator __middle, _Iterator __last, _OutIterator __result);
-
- template <class _ExecutionPolicy, class _Iterator, class _Comp>
- optional<__empty> __pstl_sort(_Backend, _Iterator __first, _Iterator __last, _Comp __comp);
-
- template <class _ExecutionPolicy, class _Iterator1, class _Iterator2, class _Comp>
- optional<bool> __pstl_equal(_Backend, _Iterator1 first1, _Iterator1 last1, _Iterator2 first2, _Comp __comp);
-
-// TODO: Complete this list
-
-Exception handling
-==================
-
-PSTL backends are expected to report errors (i.e. failure to allocate) by returning a disengaged `optional` from their
-implementation. Exceptions shouldn't be used to report an internal failure-to-allocate, since all exceptions are turned
-into a program termination at the front-end level. When a backend returns a disengaged `optional` to the frontend, the
-frontend will turn that into a call to `std::__throw_bad_alloc();` to report the internal failure to the user.
-*/
-
-namespace __pstl {
-struct __libdispatch_backend_tag {};
-struct __serial_backend_tag {};
-struct __std_thread_backend_tag {};
-} // namespace __pstl
-
-# if defined(_LIBCPP_PSTL_BACKEND_SERIAL)
-using __cpu_backend_tag = __pstl::__serial_backend_tag;
-# elif defined(_LIBCPP_PSTL_BACKEND_STD_THREAD)
-using __cpu_backend_tag = __pstl::__std_thread_backend_tag;
-# elif defined(_LIBCPP_PSTL_BACKEND_LIBDISPATCH)
-using __cpu_backend_tag = __pstl::__libdispatch_backend_tag;
-# endif
-
-template <class _ExecutionPolicy>
-struct __select_backend;
-
-template <>
-struct __select_backend<std::execution::sequenced_policy> {
- using type = __cpu_backend_tag;
-};
-
-# if _LIBCPP_STD_VER >= 20
-template <>
-struct __select_backend<std::execution::unsequenced_policy> {
- using type = __cpu_backend_tag;
-};
-# endif
-
-# if defined(_LIBCPP_PSTL_BACKEND_SERIAL) || defined(_LIBCPP_PSTL_BACKEND_STD_THREAD) || \
- defined(_LIBCPP_PSTL_BACKEND_LIBDISPATCH)
-template <>
-struct __select_backend<std::execution::parallel_policy> {
- using type = __cpu_backend_tag;
-};
-
-template <>
-struct __select_backend<std::execution::parallel_unsequenced_policy> {
- using type = __cpu_backend_tag;
-};
-
-# else
-
-// ...New vendors can add parallel backends here...
-
-# error "Invalid choice of a PSTL parallel backend"
-# endif
-
-_LIBCPP_END_NAMESPACE_STD
-
-#endif // !defined(_LIBCPP_HAS_NO_INCOMPLETE_PSTL) && _LIBCPP_STD_VER >= 17
-
-#endif // _LIBCPP___PSTL_CONFIGURATION_FWD_H
diff --git a/libcxx/include/__pstl/cpu_algos/any_of.h b/libcxx/include/__pstl/cpu_algos/any_of.h
index 01b9d214310a..b33c787a29db 100644
--- a/libcxx/include/__pstl/cpu_algos/any_of.h
+++ b/libcxx/include/__pstl/cpu_algos/any_of.h
@@ -10,13 +10,12 @@
#define _LIBCPP___PSTL_CPU_ALGOS_ANY_OF_H
#include <__algorithm/any_of.h>
-#include <__algorithm/find_if.h>
+#include <__assert>
#include <__atomic/atomic.h>
#include <__atomic/memory_order.h>
#include <__config>
-#include <__functional/operations.h>
#include <__iterator/concepts.h>
-#include <__pstl/configuration_fwd.h>
+#include <__pstl/backend_fwd.h>
#include <__pstl/cpu_algos/cpu_traits.h>
#include <__type_traits/is_execution_policy.h>
#include <__utility/move.h>
@@ -24,20 +23,19 @@
#include <cstdint>
#include <optional>
-#if !defined(_LIBCPP_HAS_NO_INCOMPLETE_PSTL) && _LIBCPP_STD_VER >= 17
-
_LIBCPP_PUSH_MACROS
-# include <__undef_macros>
+#include <__undef_macros>
_LIBCPP_BEGIN_NAMESPACE_STD
+namespace __pstl {
template <class _Backend, class _Index, class _Brick>
_LIBCPP_HIDE_FROM_ABI optional<bool> __parallel_or(_Index __first, _Index __last, _Brick __f) {
std::atomic<bool> __found(false);
- auto __ret = __pstl::__cpu_traits<_Backend>::__for_each(__first, __last, [__f, &__found](_Index __i, _Index __j) {
+ auto __ret = __cpu_traits<_Backend>::__for_each(__first, __last, [__f, &__found](_Index __i, _Index __j) {
if (!__found.load(std::memory_order_relaxed) && __f(__i, __j)) {
__found.store(true, std::memory_order_relaxed);
- __pstl::__cpu_traits<_Backend>::__cancel_execution();
+ __cpu_traits<_Backend>::__cancel_execution();
}
});
if (!__ret)
@@ -70,30 +68,32 @@ _LIBCPP_HIDE_FROM_ABI bool __simd_or(_Index __first, _DifferenceType __n, _Pred
return false;
}
-template <class _ExecutionPolicy, class _ForwardIterator, class _Predicate>
-_LIBCPP_HIDE_FROM_ABI optional<bool>
-__pstl_any_of(__cpu_backend_tag, _ForwardIterator __first, _ForwardIterator __last, _Predicate __pred) {
- if constexpr (__is_parallel_execution_policy_v<_ExecutionPolicy> &&
- __has_random_access_iterator_category_or_concept<_ForwardIterator>::value) {
- return std::__parallel_or<__cpu_backend_tag>(
- __first, __last, [&__pred](_ForwardIterator __brick_first, _ForwardIterator __brick_last) {
- auto __res = std::__pstl_any_of<__remove_parallel_policy_t<_ExecutionPolicy>>(
- __cpu_backend_tag{}, __brick_first, __brick_last, __pred);
- _LIBCPP_ASSERT_INTERNAL(__res, "unseq/seq should never try to allocate!");
- return *std::move(__res);
- });
- } else if constexpr (__is_unsequenced_execution_policy_v<_ExecutionPolicy> &&
- __has_random_access_iterator_category_or_concept<_ForwardIterator>::value) {
- return std::__simd_or(__first, __last - __first, __pred);
- } else {
- return std::any_of(__first, __last, __pred);
+template <class _Backend, class _RawExecutionPolicy>
+struct __cpu_parallel_any_of {
+ template <class _Policy, class _ForwardIterator, class _Predicate>
+ _LIBCPP_HIDE_FROM_ABI optional<bool>
+ operator()(_Policy&& __policy, _ForwardIterator __first, _ForwardIterator __last, _Predicate __pred) const noexcept {
+ if constexpr (__is_parallel_execution_policy_v<_RawExecutionPolicy> &&
+ __has_random_access_iterator_category_or_concept<_ForwardIterator>::value) {
+ return __pstl::__parallel_or<_Backend>(
+ __first, __last, [&__policy, &__pred](_ForwardIterator __brick_first, _ForwardIterator __brick_last) {
+ using _AnyOfUnseq = __pstl::__any_of<_Backend, __remove_parallel_policy_t<_RawExecutionPolicy>>;
+ auto __res = _AnyOfUnseq()(std::__remove_parallel_policy(__policy), __brick_first, __brick_last, __pred);
+ _LIBCPP_ASSERT_INTERNAL(__res, "unseq/seq should never try to allocate!");
+ return *std::move(__res);
+ });
+ } else if constexpr (__is_unsequenced_execution_policy_v<_RawExecutionPolicy> &&
+ __has_random_access_iterator_category_or_concept<_ForwardIterator>::value) {
+ return __pstl::__simd_or(__first, __last - __first, __pred);
+ } else {
+ return std::any_of(__first, __last, __pred);
+ }
}
-}
+};
+} // namespace __pstl
_LIBCPP_END_NAMESPACE_STD
_LIBCPP_POP_MACROS
-#endif // !defined(_LIBCPP_HAS_NO_INCOMPLETE_PSTL) && _LIBCPP_STD_VER >= 17
-
#endif // _LIBCPP___PSTL_CPU_ALGOS_ANY_OF_H
diff --git a/libcxx/include/__pstl/cpu_algos/fill.h b/libcxx/include/__pstl/cpu_algos/fill.h
index 66fb751eb7a2..4e6d29b30cc6 100644
--- a/libcxx/include/__pstl/cpu_algos/fill.h
+++ b/libcxx/include/__pstl/cpu_algos/fill.h
@@ -10,9 +10,10 @@
#define _LIBCPP___PSTL_CPU_ALGOS_FILL_H
#include <__algorithm/fill.h>
+#include <__assert>
#include <__config>
#include <__iterator/concepts.h>
-#include <__pstl/configuration_fwd.h>
+#include <__pstl/backend_fwd.h>
#include <__pstl/cpu_algos/cpu_traits.h>
#include <__type_traits/is_execution_policy.h>
#include <__utility/empty.h>
@@ -22,9 +23,8 @@
# pragma GCC system_header
#endif
-#if !defined(_LIBCPP_HAS_NO_INCOMPLETE_PSTL) && _LIBCPP_STD_VER >= 17
-
_LIBCPP_BEGIN_NAMESPACE_STD
+namespace __pstl {
template <class _Index, class _DifferenceType, class _Tp>
_LIBCPP_HIDE_FROM_ABI _Index __simd_fill_n(_Index __first, _DifferenceType __n, const _Tp& __value) noexcept {
@@ -35,29 +35,32 @@ _LIBCPP_HIDE_FROM_ABI _Index __simd_fill_n(_Index __first, _DifferenceType __n,
return __first + __n;
}
-template <class _ExecutionPolicy, class _ForwardIterator, class _Tp>
-_LIBCPP_HIDE_FROM_ABI optional<__empty>
-__pstl_fill(__cpu_backend_tag, _ForwardIterator __first, _ForwardIterator __last, const _Tp& __value) {
- if constexpr (__is_parallel_execution_policy_v<_ExecutionPolicy> &&
- __has_random_access_iterator_category_or_concept<_ForwardIterator>::value) {
- return __pstl::__cpu_traits<__cpu_backend_tag>::__for_each(
- __first, __last, [&__value](_ForwardIterator __brick_first, _ForwardIterator __brick_last) {
- [[maybe_unused]] auto __res = std::__pstl_fill<__remove_parallel_policy_t<_ExecutionPolicy>>(
- __cpu_backend_tag{}, __brick_first, __brick_last, __value);
- _LIBCPP_ASSERT_INTERNAL(__res, "unseq/seq should never try to allocate!");
- });
- } else if constexpr (__is_unsequenced_execution_policy_v<_ExecutionPolicy> &&
- __has_random_access_iterator_category_or_concept<_ForwardIterator>::value) {
- std::__simd_fill_n(__first, __last - __first, __value);
- return __empty{};
- } else {
- std::fill(__first, __last, __value);
- return __empty{};
+template <class _Backend, class _RawExecutionPolicy>
+struct __cpu_parallel_fill {
+ template <class _Policy, class _ForwardIterator, class _Tp>
+ _LIBCPP_HIDE_FROM_ABI optional<__empty>
+ operator()(_Policy&& __policy, _ForwardIterator __first, _ForwardIterator __last, const _Tp& __value) const noexcept {
+ if constexpr (__is_parallel_execution_policy_v<_RawExecutionPolicy> &&
+ __has_random_access_iterator_category_or_concept<_ForwardIterator>::value) {
+ return __cpu_traits<_Backend>::__for_each(
+ __first, __last, [&__policy, &__value](_ForwardIterator __brick_first, _ForwardIterator __brick_last) {
+ using _FillUnseq = __pstl::__fill<_Backend, __remove_parallel_policy_t<_RawExecutionPolicy>>;
+ [[maybe_unused]] auto __res =
+ _FillUnseq()(std::__remove_parallel_policy(__policy), __brick_first, __brick_last, __value);
+ _LIBCPP_ASSERT_INTERNAL(__res, "unseq/seq should never try to allocate!");
+ });
+ } else if constexpr (__is_unsequenced_execution_policy_v<_RawExecutionPolicy> &&
+ __has_random_access_iterator_category_or_concept<_ForwardIterator>::value) {
+ __pstl::__simd_fill_n(__first, __last - __first, __value);
+ return __empty{};
+ } else {
+ std::fill(__first, __last, __value);
+ return __empty{};
+ }
}
-}
+};
+} // namespace __pstl
_LIBCPP_END_NAMESPACE_STD
-#endif // !defined(_LIBCPP_HAS_NO_INCOMPLETE_PSTL) && _LIBCPP_STD_VER >= 17
-
#endif // _LIBCPP___PSTL_CPU_ALGOS_FILL_H
diff --git a/libcxx/include/__pstl/cpu_algos/find_if.h b/libcxx/include/__pstl/cpu_algos/find_if.h
index c99ec01bff48..12b2e88971df 100644
--- a/libcxx/include/__pstl/cpu_algos/find_if.h
+++ b/libcxx/include/__pstl/cpu_algos/find_if.h
@@ -10,12 +10,13 @@
#define _LIBCPP___PSTL_CPU_ALGOS_FIND_IF_H
#include <__algorithm/find_if.h>
+#include <__assert>
#include <__atomic/atomic.h>
#include <__config>
#include <__functional/operations.h>
#include <__iterator/concepts.h>
#include <__iterator/iterator_traits.h>
-#include <__pstl/configuration_fwd.h>
+#include <__pstl/backend_fwd.h>
#include <__pstl/cpu_algos/cpu_traits.h>
#include <__type_traits/is_execution_policy.h>
#include <__utility/move.h>
@@ -27,12 +28,11 @@
# pragma GCC system_header
#endif
-#if !defined(_LIBCPP_HAS_NO_INCOMPLETE_PSTL) && _LIBCPP_STD_VER >= 17
-
_LIBCPP_PUSH_MACROS
-# include <__undef_macros>
+#include <__undef_macros>
_LIBCPP_BEGIN_NAMESPACE_STD
+namespace __pstl {
template <class _Backend, class _Index, class _Brick, class _Compare>
_LIBCPP_HIDE_FROM_ABI optional<_Index>
@@ -42,8 +42,8 @@ __parallel_find(_Index __first, _Index __last, _Brick __f, _Compare __comp, bool
_DifferenceType __initial_dist = __b_first ? __n : -1;
std::atomic<_DifferenceType> __extremum(__initial_dist);
// TODO: find out what is better here: parallel_for or parallel_reduce
- auto __res = __pstl::__cpu_traits<_Backend>::__for_each(
- __first, __last, [__comp, __f, __first, &__extremum](_Index __i, _Index __j) {
+ auto __res =
+ __cpu_traits<_Backend>::__for_each(__first, __last, [__comp, __f, __first, &__extremum](_Index __i, _Index __j) {
// See "Reducing Contention Through Priority Updates", PPoPP '13, for discussion of
// why using a shared variable scales fairly well in this situation.
if (__comp(__i - __first, __extremum)) {
@@ -66,8 +66,8 @@ template <class _Backend, class _Index, class _DifferenceType, class _Compare>
_LIBCPP_HIDE_FROM_ABI _Index
__simd_first(_Index __first, _DifferenceType __begin, _DifferenceType __end, _Compare __comp) noexcept {
// Experiments show good block sizes like this
- const _DifferenceType __block_size = 8;
- alignas(__pstl::__cpu_traits<_Backend>::__lane_size) _DifferenceType __lane[__block_size] = {0};
+ const _DifferenceType __block_size = 8;
+ alignas(__cpu_traits<_Backend>::__lane_size) _DifferenceType __lane[__block_size] = {0};
while (__end - __begin >= __block_size) {
_DifferenceType __found = 0;
_PSTL_PRAGMA_SIMD_REDUCTION(| : __found) for (_DifferenceType __i = __begin; __i < __begin + __block_size; ++__i) {
@@ -98,38 +98,40 @@ __simd_first(_Index __first, _DifferenceType __begin, _DifferenceType __end, _Co
return __first + __end;
}
-template <class _ExecutionPolicy, class _ForwardIterator, class _Predicate>
-_LIBCPP_HIDE_FROM_ABI optional<_ForwardIterator>
-__pstl_find_if(__cpu_backend_tag, _ForwardIterator __first, _ForwardIterator __last, _Predicate __pred) {
- if constexpr (__is_parallel_execution_policy_v<_ExecutionPolicy> &&
- __has_random_access_iterator_category_or_concept<_ForwardIterator>::value) {
- return std::__parallel_find<__cpu_backend_tag>(
- __first,
- __last,
- [&__pred](_ForwardIterator __brick_first, _ForwardIterator __brick_last) {
- auto __res = std::__pstl_find_if<__remove_parallel_policy_t<_ExecutionPolicy>>(
- __cpu_backend_tag{}, __brick_first, __brick_last, __pred);
- _LIBCPP_ASSERT_INTERNAL(__res, "unseq/seq should never try to allocate!");
- return *std::move(__res);
- },
- less<>{},
- true);
- } else if constexpr (__is_unsequenced_execution_policy_v<_ExecutionPolicy> &&
- __has_random_access_iterator_category_or_concept<_ForwardIterator>::value) {
- using __diff_t = __iter_diff_t<_ForwardIterator>;
- return std::__simd_first<__cpu_backend_tag>(
- __first, __diff_t(0), __last - __first, [&__pred](_ForwardIterator __iter, __diff_t __i) {
- return __pred(__iter[__i]);
- });
- } else {
- return std::find_if(__first, __last, __pred);
+template <class _Backend, class _RawExecutionPolicy>
+struct __cpu_parallel_find_if {
+ template <class _Policy, class _ForwardIterator, class _Predicate>
+ _LIBCPP_HIDE_FROM_ABI optional<_ForwardIterator>
+ operator()(_Policy&& __policy, _ForwardIterator __first, _ForwardIterator __last, _Predicate __pred) const noexcept {
+ if constexpr (__is_parallel_execution_policy_v<_RawExecutionPolicy> &&
+ __has_random_access_iterator_category_or_concept<_ForwardIterator>::value) {
+ return __pstl::__parallel_find<_Backend>(
+ __first,
+ __last,
+ [&__policy, &__pred](_ForwardIterator __brick_first, _ForwardIterator __brick_last) {
+ using _FindIfUnseq = __pstl::__find_if<_Backend, __remove_parallel_policy_t<_RawExecutionPolicy>>;
+ auto __res = _FindIfUnseq()(std::__remove_parallel_policy(__policy), __brick_first, __brick_last, __pred);
+ _LIBCPP_ASSERT_INTERNAL(__res, "unseq/seq should never try to allocate!");
+ return *std::move(__res);
+ },
+ less<>{},
+ true);
+ } else if constexpr (__is_unsequenced_execution_policy_v<_RawExecutionPolicy> &&
+ __has_random_access_iterator_category_or_concept<_ForwardIterator>::value) {
+ using __diff_t = __iter_diff_t<_ForwardIterator>;
+ return __pstl::__simd_first<_Backend>(
+ __first, __diff_t(0), __last - __first, [&__pred](_ForwardIterator __iter, __diff_t __i) {
+ return __pred(__iter[__i]);
+ });
+ } else {
+ return std::find_if(__first, __last, __pred);
+ }
}
-}
+};
+} // namespace __pstl
_LIBCPP_END_NAMESPACE_STD
_LIBCPP_POP_MACROS
-#endif // !defined(_LIBCPP_HAS_NO_INCOMPLETE_PSTL) && _LIBCPP_STD_VER >= 17
-
#endif // _LIBCPP___PSTL_CPU_ALGOS_FIND_IF_H
diff --git a/libcxx/include/__pstl/cpu_algos/for_each.h b/libcxx/include/__pstl/cpu_algos/for_each.h
index cd7ce022469b..d4d7862135ff 100644
--- a/libcxx/include/__pstl/cpu_algos/for_each.h
+++ b/libcxx/include/__pstl/cpu_algos/for_each.h
@@ -10,9 +10,10 @@
#define _LIBCPP___PSTL_CPU_ALGOS_FOR_EACH_H
#include <__algorithm/for_each.h>
+#include <__assert>
#include <__config>
#include <__iterator/concepts.h>
-#include <__pstl/configuration_fwd.h>
+#include <__pstl/backend_fwd.h>
#include <__pstl/cpu_algos/cpu_traits.h>
#include <__type_traits/is_execution_policy.h>
#include <__utility/empty.h>
@@ -22,12 +23,11 @@
# pragma GCC system_header
#endif
-#if !defined(_LIBCPP_HAS_NO_INCOMPLETE_PSTL) && _LIBCPP_STD_VER >= 17
-
_LIBCPP_BEGIN_NAMESPACE_STD
+namespace __pstl {
template <class _Iterator, class _DifferenceType, class _Function>
-_LIBCPP_HIDE_FROM_ABI _Iterator __simd_walk(_Iterator __first, _DifferenceType __n, _Function __f) noexcept {
+_LIBCPP_HIDE_FROM_ABI _Iterator __simd_for_each(_Iterator __first, _DifferenceType __n, _Function __f) noexcept {
_PSTL_PRAGMA_SIMD
for (_DifferenceType __i = 0; __i < __n; ++__i)
__f(__first[__i]);
@@ -35,29 +35,32 @@ _LIBCPP_HIDE_FROM_ABI _Iterator __simd_walk(_Iterator __first, _DifferenceType _
return __first + __n;
}
-template <class _ExecutionPolicy, class _ForwardIterator, class _Functor>
-_LIBCPP_HIDE_FROM_ABI optional<__empty>
-__pstl_for_each(__cpu_backend_tag, _ForwardIterator __first, _ForwardIterator __last, _Functor __func) {
- if constexpr (__is_parallel_execution_policy_v<_ExecutionPolicy> &&
- __has_random_access_iterator_category_or_concept<_ForwardIterator>::value) {
- return __pstl::__cpu_traits<__cpu_backend_tag>::__for_each(
- __first, __last, [__func](_ForwardIterator __brick_first, _ForwardIterator __brick_last) {
- [[maybe_unused]] auto __res = std::__pstl_for_each<__remove_parallel_policy_t<_ExecutionPolicy>>(
- __cpu_backend_tag{}, __brick_first, __brick_last, __func);
- _LIBCPP_ASSERT_INTERNAL(__res, "unseq/seq should never try to allocate!");
- });
- } else if constexpr (__is_unsequenced_execution_policy_v<_ExecutionPolicy> &&
- __has_random_access_iterator_category_or_concept<_ForwardIterator>::value) {
- std::__simd_walk(__first, __last - __first, __func);
- return __empty{};
- } else {
- std::for_each(__first, __last, __func);
- return __empty{};
+template <class _Backend, class _RawExecutionPolicy>
+struct __cpu_parallel_for_each {
+ template <class _Policy, class _ForwardIterator, class _Function>
+ _LIBCPP_HIDE_FROM_ABI optional<__empty>
+ operator()(_Policy&& __policy, _ForwardIterator __first, _ForwardIterator __last, _Function __func) const noexcept {
+ if constexpr (__is_parallel_execution_policy_v<_RawExecutionPolicy> &&
+ __has_random_access_iterator_category_or_concept<_ForwardIterator>::value) {
+ return __cpu_traits<_Backend>::__for_each(
+ __first, __last, [&__policy, __func](_ForwardIterator __brick_first, _ForwardIterator __brick_last) {
+ using _ForEachUnseq = __pstl::__for_each<_Backend, __remove_parallel_policy_t<_RawExecutionPolicy>>;
+ [[maybe_unused]] auto __res =
+ _ForEachUnseq()(std::__remove_parallel_policy(__policy), __brick_first, __brick_last, __func);
+ _LIBCPP_ASSERT_INTERNAL(__res, "unseq/seq should never try to allocate!");
+ });
+ } else if constexpr (__is_unsequenced_execution_policy_v<_RawExecutionPolicy> &&
+ __has_random_access_iterator_category_or_concept<_ForwardIterator>::value) {
+ __pstl::__simd_for_each(__first, __last - __first, __func);
+ return __empty{};
+ } else {
+ std::for_each(__first, __last, __func);
+ return __empty{};
+ }
}
-}
+};
+} // namespace __pstl
_LIBCPP_END_NAMESPACE_STD
-#endif // !defined(_LIBCPP_HAS_NO_INCOMPLETE_PSTL) && _LIBCPP_STD_VER >= 17
-
#endif // _LIBCPP___PSTL_CPU_ALGOS_FOR_EACH_H
diff --git a/libcxx/include/__pstl/cpu_algos/merge.h b/libcxx/include/__pstl/cpu_algos/merge.h
index b857fc1fb7a5..dfa4cbf69b14 100644
--- a/libcxx/include/__pstl/cpu_algos/merge.h
+++ b/libcxx/include/__pstl/cpu_algos/merge.h
@@ -10,9 +10,10 @@
#define _LIBCPP___PSTL_CPU_ALGOS_MERGE_H
#include <__algorithm/merge.h>
+#include <__assert>
#include <__config>
#include <__iterator/concepts.h>
-#include <__pstl/configuration_fwd.h>
+#include <__pstl/backend_fwd.h>
#include <__pstl/cpu_algos/cpu_traits.h>
#include <__type_traits/is_execution_policy.h>
#include <__utility/move.h>
@@ -22,65 +23,63 @@
# pragma GCC system_header
#endif
-#if !defined(_LIBCPP_HAS_NO_INCOMPLETE_PSTL) && _LIBCPP_STD_VER >= 17
-
_LIBCPP_PUSH_MACROS
-# include <__undef_macros>
+#include <__undef_macros>
_LIBCPP_BEGIN_NAMESPACE_STD
+namespace __pstl {
-template <class _ExecutionPolicy,
- class _ForwardIterator1,
- class _ForwardIterator2,
- class _ForwardOutIterator,
- class _Comp>
-_LIBCPP_HIDE_FROM_ABI optional<_ForwardOutIterator> __pstl_merge(
- __cpu_backend_tag,
- _ForwardIterator1 __first1,
- _ForwardIterator1 __last1,
- _ForwardIterator2 __first2,
- _ForwardIterator2 __last2,
- _ForwardOutIterator __result,
- _Comp __comp) {
- if constexpr (__is_parallel_execution_policy_v<_ExecutionPolicy> &&
- __has_random_access_iterator_category_or_concept<_ForwardIterator1>::value &&
- __has_random_access_iterator_category_or_concept<_ForwardIterator2>::value &&
- __has_random_access_iterator_category_or_concept<_ForwardOutIterator>::value) {
- auto __res = __pstl::__cpu_traits<__cpu_backend_tag>::__merge(
- __first1,
- __last1,
- __first2,
- __last2,
- __result,
- __comp,
- [](_ForwardIterator1 __g_first1,
- _ForwardIterator1 __g_last1,
- _ForwardIterator2 __g_first2,
- _ForwardIterator2 __g_last2,
- _ForwardOutIterator __g_result,
- _Comp __g_comp) {
- [[maybe_unused]] auto __g_res = std::__pstl_merge<__remove_parallel_policy_t<_ExecutionPolicy>>(
- __cpu_backend_tag{},
- std::move(__g_first1),
- std::move(__g_last1),
- std::move(__g_first2),
- std::move(__g_last2),
- std::move(__g_result),
- std::move(__g_comp));
- _LIBCPP_ASSERT_INTERNAL(__g_res, "unsed/sed should never try to allocate!");
- });
- if (!__res)
- return nullopt;
- return __result + (__last1 - __first1) + (__last2 - __first2);
- } else {
- return std::merge(__first1, __last1, __first2, __last2, __result, __comp);
+template <class _Backend, class _RawExecutionPolicy>
+struct __cpu_parallel_merge {
+ template <class _Policy, class _ForwardIterator1, class _ForwardIterator2, class _ForwardOutIterator, class _Comp>
+ _LIBCPP_HIDE_FROM_ABI optional<_ForwardOutIterator> operator()(
+ _Policy&& __policy,
+ _ForwardIterator1 __first1,
+ _ForwardIterator1 __last1,
+ _ForwardIterator2 __first2,
+ _ForwardIterator2 __last2,
+ _ForwardOutIterator __result,
+ _Comp __comp) const noexcept {
+ if constexpr (__is_parallel_execution_policy_v<_RawExecutionPolicy> &&
+ __has_random_access_iterator_category_or_concept<_ForwardIterator1>::value &&
+ __has_random_access_iterator_category_or_concept<_ForwardIterator2>::value &&
+ __has_random_access_iterator_category_or_concept<_ForwardOutIterator>::value) {
+ auto __res = __cpu_traits<_Backend>::__merge(
+ __first1,
+ __last1,
+ __first2,
+ __last2,
+ __result,
+ __comp,
+ [&__policy](_ForwardIterator1 __g_first1,
+ _ForwardIterator1 __g_last1,
+ _ForwardIterator2 __g_first2,
+ _ForwardIterator2 __g_last2,
+ _ForwardOutIterator __g_result,
+ _Comp __g_comp) {
+ using _MergeUnseq = __pstl::__merge<_Backend, __remove_parallel_policy_t<_RawExecutionPolicy>>;
+ [[maybe_unused]] auto __g_res = _MergeUnseq()(
+ std::__remove_parallel_policy(__policy),
+ std::move(__g_first1),
+ std::move(__g_last1),
+ std::move(__g_first2),
+ std::move(__g_last2),
+ std::move(__g_result),
+ std::move(__g_comp));
+ _LIBCPP_ASSERT_INTERNAL(__g_res, "unsed/sed should never try to allocate!");
+ });
+ if (!__res)
+ return nullopt;
+ return __result + (__last1 - __first1) + (__last2 - __first2);
+ } else {
+ return std::merge(__first1, __last1, __first2, __last2, __result, __comp);
+ }
}
-}
+};
+} // namespace __pstl
_LIBCPP_END_NAMESPACE_STD
_LIBCPP_POP_MACROS
-#endif // !defined(_LIBCPP_HAS_NO_INCOMPLETE_PSTL) && _LIBCPP_STD_VER >= 17
-
#endif // _LIBCPP___PSTL_CPU_ALGOS_MERGE_H
diff --git a/libcxx/include/__pstl/cpu_algos/stable_sort.h b/libcxx/include/__pstl/cpu_algos/stable_sort.h
index 18effb2108a2..8e64f3e537c0 100644
--- a/libcxx/include/__pstl/cpu_algos/stable_sort.h
+++ b/libcxx/include/__pstl/cpu_algos/stable_sort.h
@@ -11,7 +11,7 @@
#include <__algorithm/stable_sort.h>
#include <__config>
-#include <__pstl/configuration_fwd.h>
+#include <__pstl/backend_fwd.h>
#include <__pstl/cpu_algos/cpu_traits.h>
#include <__type_traits/is_execution_policy.h>
#include <__utility/empty.h>
@@ -21,26 +21,27 @@
# pragma GCC system_header
#endif
-#if !defined(_LIBCPP_HAS_NO_INCOMPLETE_PSTL) && _LIBCPP_STD_VER >= 17
-
_LIBCPP_BEGIN_NAMESPACE_STD
-
-template <class _ExecutionPolicy, class _RandomAccessIterator, class _Comp>
-_LIBCPP_HIDE_FROM_ABI optional<__empty>
-__pstl_stable_sort(__cpu_backend_tag, _RandomAccessIterator __first, _RandomAccessIterator __last, _Comp __comp) {
- if constexpr (__is_parallel_execution_policy_v<_ExecutionPolicy>) {
- return __pstl::__cpu_traits<__cpu_backend_tag>::__stable_sort(
- __first, __last, __comp, [](_RandomAccessIterator __g_first, _RandomAccessIterator __g_last, _Comp __g_comp) {
- std::stable_sort(__g_first, __g_last, __g_comp);
- });
- } else {
- std::stable_sort(__first, __last, __comp);
- return __empty{};
+namespace __pstl {
+
+template <class _Backend, class _RawExecutionPolicy>
+struct __cpu_parallel_stable_sort {
+ template <class _Policy, class _RandomAccessIterator, class _Comp>
+ _LIBCPP_HIDE_FROM_ABI optional<__empty>
+ operator()(_Policy&&, _RandomAccessIterator __first, _RandomAccessIterator __last, _Comp __comp) const noexcept {
+ if constexpr (__is_parallel_execution_policy_v<_RawExecutionPolicy>) {
+ return __cpu_traits<_Backend>::__stable_sort(
+ __first, __last, __comp, [](_RandomAccessIterator __g_first, _RandomAccessIterator __g_last, _Comp __g_comp) {
+ std::stable_sort(__g_first, __g_last, __g_comp);
+ });
+ } else {
+ std::stable_sort(__first, __last, __comp);
+ return __empty{};
+ }
}
-}
+};
+} // namespace __pstl
_LIBCPP_END_NAMESPACE_STD
-#endif // !defined(_LIBCPP_HAS_NO_INCOMPLETE_PSTL) && _LIBCPP_STD_VER >= 17
-
#endif // _LIBCPP___PSTL_CPU_ALGOS_STABLE_SORT_H
diff --git a/libcxx/include/__pstl/cpu_algos/transform.h b/libcxx/include/__pstl/cpu_algos/transform.h
index 70853dc9af24..27ce8e27b242 100644
--- a/libcxx/include/__pstl/cpu_algos/transform.h
+++ b/libcxx/include/__pstl/cpu_algos/transform.h
@@ -10,130 +10,144 @@
#define _LIBCPP___PSTL_CPU_ALGOS_TRANSFORM_H
#include <__algorithm/transform.h>
+#include <__assert>
#include <__config>
#include <__iterator/concepts.h>
#include <__iterator/iterator_traits.h>
-#include <__pstl/configuration_fwd.h>
+#include <__pstl/backend_fwd.h>
#include <__pstl/cpu_algos/cpu_traits.h>
-#include <__type_traits/enable_if.h>
#include <__type_traits/is_execution_policy.h>
-#include <__type_traits/remove_cvref.h>
+#include <__utility/move.h>
#include <optional>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
# pragma GCC system_header
#endif
-#if !defined(_LIBCPP_HAS_NO_INCOMPLETE_PSTL) && _LIBCPP_STD_VER >= 17
-
_LIBCPP_PUSH_MACROS
-# include <__undef_macros>
+#include <__undef_macros>
_LIBCPP_BEGIN_NAMESPACE_STD
+namespace __pstl {
template <class _Iterator1, class _DifferenceType, class _Iterator2, class _Function>
_LIBCPP_HIDE_FROM_ABI _Iterator2
-__simd_walk(_Iterator1 __first1, _DifferenceType __n, _Iterator2 __first2, _Function __f) noexcept {
+__simd_transform(_Iterator1 __first1, _DifferenceType __n, _Iterator2 __first2, _Function __f) noexcept {
_PSTL_PRAGMA_SIMD
for (_DifferenceType __i = 0; __i < __n; ++__i)
__f(__first1[__i], __first2[__i]);
return __first2 + __n;
}
-template <class _ExecutionPolicy, class _ForwardIterator, class _ForwardOutIterator, class _UnaryOperation>
-_LIBCPP_HIDE_FROM_ABI optional<_ForwardOutIterator> __pstl_transform(
- __cpu_backend_tag,
- _ForwardIterator __first,
- _ForwardIterator __last,
- _ForwardOutIterator __result,
- _UnaryOperation __op) {
- if constexpr (__is_parallel_execution_policy_v<_ExecutionPolicy> &&
- __has_random_access_iterator_category_or_concept<_ForwardIterator>::value &&
- __has_random_access_iterator_category_or_concept<_ForwardOutIterator>::value) {
- __pstl::__cpu_traits<__cpu_backend_tag>::__for_each(
- __first, __last, [__op, __first, __result](_ForwardIterator __brick_first, _ForwardIterator __brick_last) {
- auto __res = std::__pstl_transform<__remove_parallel_policy_t<_ExecutionPolicy>>(
- __cpu_backend_tag{}, __brick_first, __brick_last, __result + (__brick_first - __first), __op);
- _LIBCPP_ASSERT_INTERNAL(__res, "unseq/seq should never try to allocate!");
- return *std::move(__res);
- });
- return __result + (__last - __first);
- } else if constexpr (__is_unsequenced_execution_policy_v<_ExecutionPolicy> &&
- __has_random_access_iterator_category_or_concept<_ForwardIterator>::value &&
- __has_random_access_iterator_category_or_concept<_ForwardOutIterator>::value) {
- return std::__simd_walk(
- __first,
- __last - __first,
- __result,
- [&](__iter_reference<_ForwardIterator> __in_value, __iter_reference<_ForwardOutIterator> __out_value) {
- __out_value = __op(__in_value);
- });
- } else {
- return std::transform(__first, __last, __result, __op);
- }
-}
-
template <class _Iterator1, class _DifferenceType, class _Iterator2, class _Iterator3, class _Function>
-_LIBCPP_HIDE_FROM_ABI _Iterator3 __simd_walk(
+_LIBCPP_HIDE_FROM_ABI _Iterator3 __simd_transform(
_Iterator1 __first1, _DifferenceType __n, _Iterator2 __first2, _Iterator3 __first3, _Function __f) noexcept {
_PSTL_PRAGMA_SIMD
for (_DifferenceType __i = 0; __i < __n; ++__i)
__f(__first1[__i], __first2[__i], __first3[__i]);
return __first3 + __n;
}
-template <class _ExecutionPolicy,
- class _ForwardIterator1,
- class _ForwardIterator2,
- class _ForwardOutIterator,
- class _BinaryOperation,
- enable_if_t<is_execution_policy_v<__remove_cvref_t<_ExecutionPolicy>>, int> = 0>
-_LIBCPP_HIDE_FROM_ABI optional<_ForwardOutIterator> __pstl_transform(
- __cpu_backend_tag,
- _ForwardIterator1 __first1,
- _ForwardIterator1 __last1,
- _ForwardIterator2 __first2,
- _ForwardOutIterator __result,
- _BinaryOperation __op) {
- if constexpr (__is_parallel_execution_policy_v<_ExecutionPolicy> &&
- __has_random_access_iterator_category_or_concept<_ForwardIterator1>::value &&
- __has_random_access_iterator_category_or_concept<_ForwardIterator2>::value &&
- __has_random_access_iterator_category_or_concept<_ForwardOutIterator>::value) {
- auto __res = __pstl::__cpu_traits<__cpu_backend_tag>::__for_each(
- __first1,
- __last1,
- [__op, __first1, __first2, __result](_ForwardIterator1 __brick_first, _ForwardIterator1 __brick_last) {
- return std::__pstl_transform<__remove_parallel_policy_t<_ExecutionPolicy>>(
- __cpu_backend_tag{},
- __brick_first,
- __brick_last,
- __first2 + (__brick_first - __first1),
- __result + (__brick_first - __first1),
- __op);
- });
- if (!__res)
- return nullopt;
- return __result + (__last1 - __first1);
- } else if constexpr (__is_unsequenced_execution_policy_v<_ExecutionPolicy> &&
- __has_random_access_iterator_category_or_concept<_ForwardIterator1>::value &&
- __has_random_access_iterator_category_or_concept<_ForwardIterator2>::value &&
- __has_random_access_iterator_category_or_concept<_ForwardOutIterator>::value) {
- return std::__simd_walk(
- __first1,
- __last1 - __first1,
- __first2,
- __result,
- [&](__iter_reference<_ForwardIterator1> __in1,
- __iter_reference<_ForwardIterator2> __in2,
- __iter_reference<_ForwardOutIterator> __out_value) { __out_value = __op(__in1, __in2); });
- } else {
- return std::transform(__first1, __last1, __first2, __result, __op);
+
+template <class _Backend, class _RawExecutionPolicy>
+struct __cpu_parallel_transform {
+ template <class _Policy, class _ForwardIterator, class _ForwardOutIterator, class _UnaryOperation>
+ _LIBCPP_HIDE_FROM_ABI optional<_ForwardOutIterator>
+ operator()(_Policy&& __policy,
+ _ForwardIterator __first,
+ _ForwardIterator __last,
+ _ForwardOutIterator __result,
+ _UnaryOperation __op) const noexcept {
+ if constexpr (__is_parallel_execution_policy_v<_RawExecutionPolicy> &&
+ __has_random_access_iterator_category_or_concept<_ForwardIterator>::value &&
+ __has_random_access_iterator_category_or_concept<_ForwardOutIterator>::value) {
+ __cpu_traits<_Backend>::__for_each(
+ __first,
+ __last,
+ [&__policy, __op, __first, __result](_ForwardIterator __brick_first, _ForwardIterator __brick_last) {
+ using _TransformUnseq = __pstl::__transform<_Backend, __remove_parallel_policy_t<_RawExecutionPolicy>>;
+ auto __res = _TransformUnseq()(
+ std::__remove_parallel_policy(__policy),
+ __brick_first,
+ __brick_last,
+ __result + (__brick_first - __first),
+ __op);
+ _LIBCPP_ASSERT_INTERNAL(__res, "unseq/seq should never try to allocate!");
+ return *std::move(__res);
+ });
+ return __result + (__last - __first);
+ } else if constexpr (__is_unsequenced_execution_policy_v<_RawExecutionPolicy> &&
+ __has_random_access_iterator_category_or_concept<_ForwardIterator>::value &&
+ __has_random_access_iterator_category_or_concept<_ForwardOutIterator>::value) {
+ return __pstl::__simd_transform(
+ __first,
+ __last - __first,
+ __result,
+ [&](__iter_reference<_ForwardIterator> __in_value, __iter_reference<_ForwardOutIterator> __out_value) {
+ __out_value = __op(__in_value);
+ });
+ } else {
+ return std::transform(__first, __last, __result, __op);
+ }
}
-}
+};
+
+template <class _Backend, class _RawExecutionPolicy>
+struct __cpu_parallel_transform_binary {
+ template <class _Policy,
+ class _ForwardIterator1,
+ class _ForwardIterator2,
+ class _ForwardOutIterator,
+ class _BinaryOperation>
+ _LIBCPP_HIDE_FROM_ABI optional<_ForwardOutIterator>
+ operator()(_Policy&& __policy,
+ _ForwardIterator1 __first1,
+ _ForwardIterator1 __last1,
+ _ForwardIterator2 __first2,
+ _ForwardOutIterator __result,
+ _BinaryOperation __op) const noexcept {
+ if constexpr (__is_parallel_execution_policy_v<_RawExecutionPolicy> &&
+ __has_random_access_iterator_category_or_concept<_ForwardIterator1>::value &&
+ __has_random_access_iterator_category_or_concept<_ForwardIterator2>::value &&
+ __has_random_access_iterator_category_or_concept<_ForwardOutIterator>::value) {
+ auto __res = __cpu_traits<_Backend>::__for_each(
+ __first1,
+ __last1,
+ [&__policy, __op, __first1, __first2, __result](
+ _ForwardIterator1 __brick_first, _ForwardIterator1 __brick_last) {
+ using _TransformBinaryUnseq =
+ __pstl::__transform_binary<_Backend, __remove_parallel_policy_t<_RawExecutionPolicy>>;
+ return _TransformBinaryUnseq()(
+ std::__remove_parallel_policy(__policy),
+ __brick_first,
+ __brick_last,
+ __first2 + (__brick_first - __first1),
+ __result + (__brick_first - __first1),
+ __op);
+ });
+ if (!__res)
+ return nullopt;
+ return __result + (__last1 - __first1);
+ } else if constexpr (__is_unsequenced_execution_policy_v<_RawExecutionPolicy> &&
+ __has_random_access_iterator_category_or_concept<_ForwardIterator1>::value &&
+ __has_random_access_iterator_category_or_concept<_ForwardIterator2>::value &&
+ __has_random_access_iterator_category_or_concept<_ForwardOutIterator>::value) {
+ return __pstl::__simd_transform(
+ __first1,
+ __last1 - __first1,
+ __first2,
+ __result,
+ [&](__iter_reference<_ForwardIterator1> __in1,
+ __iter_reference<_ForwardIterator2> __in2,
+ __iter_reference<_ForwardOutIterator> __out_value) { __out_value = __op(__in1, __in2); });
+ } else {
+ return std::transform(__first1, __last1, __first2, __result, __op);
+ }
+ }
+};
+} // namespace __pstl
_LIBCPP_END_NAMESPACE_STD
_LIBCPP_POP_MACROS
-#endif // !defined(_LIBCPP_HAS_NO_INCOMPLETE_PSTL) && _LIBCPP_STD_VER >= 17
-
#endif // _LIBCPP___PSTL_CPU_ALGOS_TRANSFORM_H
diff --git a/libcxx/include/__pstl/cpu_algos/transform_reduce.h b/libcxx/include/__pstl/cpu_algos/transform_reduce.h
index a85ee9fb773a..36ac1a9072a8 100644
--- a/libcxx/include/__pstl/cpu_algos/transform_reduce.h
+++ b/libcxx/include/__pstl/cpu_algos/transform_reduce.h
@@ -9,16 +9,18 @@
#ifndef _LIBCPP___PSTL_CPU_ALGOS_TRANSFORM_REDUCE_H
#define _LIBCPP___PSTL_CPU_ALGOS_TRANSFORM_REDUCE_H
+#include <__assert>
#include <__config>
#include <__iterator/concepts.h>
#include <__iterator/iterator_traits.h>
#include <__numeric/transform_reduce.h>
-#include <__pstl/configuration_fwd.h>
+#include <__pstl/backend_fwd.h>
#include <__pstl/cpu_algos/cpu_traits.h>
#include <__type_traits/desugars_to.h>
#include <__type_traits/is_arithmetic.h>
#include <__type_traits/is_execution_policy.h>
#include <__utility/move.h>
+#include <cstddef>
#include <new>
#include <optional>
@@ -29,9 +31,8 @@
_LIBCPP_PUSH_MACROS
#include <__undef_macros>
-#if !defined(_LIBCPP_HAS_NO_INCOMPLETE_PSTL) && _LIBCPP_STD_VER >= 17
-
_LIBCPP_BEGIN_NAMESPACE_STD
+namespace __pstl {
template <typename _Backend,
typename _DifferenceType,
@@ -61,7 +62,7 @@ template <typename _Backend,
int> = 0>
_LIBCPP_HIDE_FROM_ABI _Tp
__simd_transform_reduce(_Size __n, _Tp __init, _BinaryOperation __binary_op, _UnaryOperation __f) noexcept {
- constexpr size_t __lane_size = __pstl::__cpu_traits<_Backend>::__lane_size;
+ constexpr size_t __lane_size = __cpu_traits<_Backend>::__lane_size;
const _Size __block_size = __lane_size / sizeof(_Tp);
if (__n > 2 * __block_size && __block_size > 1) {
alignas(__lane_size) char __lane_buffer[__lane_size];
@@ -103,104 +104,113 @@ __simd_transform_reduce(_Size __n, _Tp __init, _BinaryOperation __binary_op, _Un
return __init;
}
-template <class _ExecutionPolicy,
- class _ForwardIterator1,
- class _ForwardIterator2,
- class _Tp,
- class _BinaryOperation1,
- class _BinaryOperation2>
-_LIBCPP_HIDE_FROM_ABI optional<_Tp> __pstl_transform_reduce(
- __cpu_backend_tag,
- _ForwardIterator1 __first1,
- _ForwardIterator1 __last1,
- _ForwardIterator2 __first2,
- _Tp __init,
- _BinaryOperation1 __reduce,
- _BinaryOperation2 __transform) {
- if constexpr (__is_parallel_execution_policy_v<_ExecutionPolicy> &&
- __has_random_access_iterator_category_or_concept<_ForwardIterator1>::value &&
- __has_random_access_iterator_category_or_concept<_ForwardIterator2>::value) {
- return __pstl::__cpu_traits<__cpu_backend_tag>::__transform_reduce(
- __first1,
- std::move(__last1),
- [__first1, __first2, __transform](_ForwardIterator1 __iter) {
- return __transform(*__iter, *(__first2 + (__iter - __first1)));
- },
- std::move(__init),
- std::move(__reduce),
- [__first1, __first2, __reduce, __transform](
- _ForwardIterator1 __brick_first, _ForwardIterator1 __brick_last, _Tp __brick_init) {
- return *std::__pstl_transform_reduce<__remove_parallel_policy_t<_ExecutionPolicy>>(
- __cpu_backend_tag{},
- __brick_first,
- std::move(__brick_last),
- __first2 + (__brick_first - __first1),
- std::move(__brick_init),
- std::move(__reduce),
- std::move(__transform));
- });
- } else if constexpr (__is_unsequenced_execution_policy_v<_ExecutionPolicy> &&
- __has_random_access_iterator_category_or_concept<_ForwardIterator1>::value &&
- __has_random_access_iterator_category_or_concept<_ForwardIterator2>::value) {
- return std::__simd_transform_reduce<__cpu_backend_tag>(
- __last1 - __first1, std::move(__init), std::move(__reduce), [&](__iter_diff_t<_ForwardIterator1> __i) {
- return __transform(__first1[__i], __first2[__i]);
- });
- } else {
- return std::transform_reduce(
- std::move(__first1),
- std::move(__last1),
- std::move(__first2),
- std::move(__init),
- std::move(__reduce),
- std::move(__transform));
+template <class _Backend, class _RawExecutionPolicy>
+struct __cpu_parallel_transform_reduce_binary {
+ template <class _Policy,
+ class _ForwardIterator1,
+ class _ForwardIterator2,
+ class _Tp,
+ class _BinaryOperation1,
+ class _BinaryOperation2>
+ _LIBCPP_HIDE_FROM_ABI optional<_Tp> operator()(
+ _Policy&& __policy,
+ _ForwardIterator1 __first1,
+ _ForwardIterator1 __last1,
+ _ForwardIterator2 __first2,
+ _Tp __init,
+ _BinaryOperation1 __reduce,
+ _BinaryOperation2 __transform) const noexcept {
+ if constexpr (__is_parallel_execution_policy_v<_RawExecutionPolicy> &&
+ __has_random_access_iterator_category_or_concept<_ForwardIterator1>::value &&
+ __has_random_access_iterator_category_or_concept<_ForwardIterator2>::value) {
+ return __cpu_traits<_Backend>::__transform_reduce(
+ __first1,
+ std::move(__last1),
+ [__first1, __first2, __transform](_ForwardIterator1 __iter) {
+ return __transform(*__iter, *(__first2 + (__iter - __first1)));
+ },
+ std::move(__init),
+ std::move(__reduce),
+ [&__policy, __first1, __first2, __reduce, __transform](
+ _ForwardIterator1 __brick_first, _ForwardIterator1 __brick_last, _Tp __brick_init) {
+ using _TransformReduceBinaryUnseq =
+ __pstl::__transform_reduce_binary<_Backend, __remove_parallel_policy_t<_RawExecutionPolicy>>;
+ return *_TransformReduceBinaryUnseq()(
+ std::__remove_parallel_policy(__policy),
+ __brick_first,
+ std::move(__brick_last),
+ __first2 + (__brick_first - __first1),
+ std::move(__brick_init),
+ std::move(__reduce),
+ std::move(__transform));
+ });
+ } else if constexpr (__is_unsequenced_execution_policy_v<_RawExecutionPolicy> &&
+ __has_random_access_iterator_category_or_concept<_ForwardIterator1>::value &&
+ __has_random_access_iterator_category_or_concept<_ForwardIterator2>::value) {
+ return __pstl::__simd_transform_reduce<_Backend>(
+ __last1 - __first1, std::move(__init), std::move(__reduce), [&](__iter_diff_t<_ForwardIterator1> __i) {
+ return __transform(__first1[__i], __first2[__i]);
+ });
+ } else {
+ return std::transform_reduce(
+ std::move(__first1),
+ std::move(__last1),
+ std::move(__first2),
+ std::move(__init),
+ std::move(__reduce),
+ std::move(__transform));
+ }
}
-}
+};
-template <class _ExecutionPolicy, class _ForwardIterator, class _Tp, class _BinaryOperation, class _UnaryOperation>
-_LIBCPP_HIDE_FROM_ABI optional<_Tp> __pstl_transform_reduce(
- __cpu_backend_tag,
- _ForwardIterator __first,
- _ForwardIterator __last,
- _Tp __init,
- _BinaryOperation __reduce,
- _UnaryOperation __transform) {
- if constexpr (__is_parallel_execution_policy_v<_ExecutionPolicy> &&
- __has_random_access_iterator_category_or_concept<_ForwardIterator>::value) {
- return __pstl::__cpu_traits<__cpu_backend_tag>::__transform_reduce(
- std::move(__first),
- std::move(__last),
- [__transform](_ForwardIterator __iter) { return __transform(*__iter); },
- std::move(__init),
- __reduce,
- [__transform, __reduce](auto __brick_first, auto __brick_last, _Tp __brick_init) {
- auto __res = std::__pstl_transform_reduce<__remove_parallel_policy_t<_ExecutionPolicy>>(
- __cpu_backend_tag{},
- std::move(__brick_first),
- std::move(__brick_last),
- std::move(__brick_init),
- std::move(__reduce),
- std::move(__transform));
- _LIBCPP_ASSERT_INTERNAL(__res, "unseq/seq should never try to allocate!");
- return *std::move(__res);
- });
- } else if constexpr (__is_unsequenced_execution_policy_v<_ExecutionPolicy> &&
- __has_random_access_iterator_category_or_concept<_ForwardIterator>::value) {
- return std::__simd_transform_reduce<__cpu_backend_tag>(
- __last - __first,
- std::move(__init),
- std::move(__reduce),
- [=, &__transform](__iter_diff_t<_ForwardIterator> __i) { return __transform(__first[__i]); });
- } else {
- return std::transform_reduce(
- std::move(__first), std::move(__last), std::move(__init), std::move(__reduce), std::move(__transform));
+template <class _Backend, class _RawExecutionPolicy>
+struct __cpu_parallel_transform_reduce {
+ template <class _Policy, class _ForwardIterator, class _Tp, class _BinaryOperation, class _UnaryOperation>
+ _LIBCPP_HIDE_FROM_ABI optional<_Tp>
+ operator()(_Policy&& __policy,
+ _ForwardIterator __first,
+ _ForwardIterator __last,
+ _Tp __init,
+ _BinaryOperation __reduce,
+ _UnaryOperation __transform) const noexcept {
+ if constexpr (__is_parallel_execution_policy_v<_RawExecutionPolicy> &&
+ __has_random_access_iterator_category_or_concept<_ForwardIterator>::value) {
+ return __cpu_traits<_Backend>::__transform_reduce(
+ std::move(__first),
+ std::move(__last),
+ [__transform](_ForwardIterator __iter) { return __transform(*__iter); },
+ std::move(__init),
+ __reduce,
+ [&__policy, __transform, __reduce](auto __brick_first, auto __brick_last, _Tp __brick_init) {
+ using _TransformReduceUnseq =
+ __pstl::__transform_reduce<_Backend, __remove_parallel_policy_t<_RawExecutionPolicy>>;
+ auto __res = _TransformReduceUnseq()(
+ std::__remove_parallel_policy(__policy),
+ std::move(__brick_first),
+ std::move(__brick_last),
+ std::move(__brick_init),
+ std::move(__reduce),
+ std::move(__transform));
+ _LIBCPP_ASSERT_INTERNAL(__res, "unseq/seq should never try to allocate!");
+ return *std::move(__res);
+ });
+ } else if constexpr (__is_unsequenced_execution_policy_v<_RawExecutionPolicy> &&
+ __has_random_access_iterator_category_or_concept<_ForwardIterator>::value) {
+ return __pstl::__simd_transform_reduce<_Backend>(
+ __last - __first,
+ std::move(__init),
+ std::move(__reduce),
+ [=, &__transform](__iter_diff_t<_ForwardIterator> __i) { return __transform(__first[__i]); });
+ } else {
+ return std::transform_reduce(
+ std::move(__first), std::move(__last), std::move(__init), std::move(__reduce), std::move(__transform));
+ }
}
-}
+};
+} // namespace __pstl
_LIBCPP_END_NAMESPACE_STD
-#endif // !defined(_LIBCPP_HAS_NO_INCOMPLETE_PSTL) && _LIBCPP_STD_VER >= 17
-
_LIBCPP_POP_MACROS
#endif // _LIBCPP___PSTL_CPU_ALGOS_TRANSFORM_REDUCE_H
diff --git a/libcxx/include/__pstl/dispatch.h b/libcxx/include/__pstl/dispatch.h
new file mode 100644
index 000000000000..5e903f7524fe
--- /dev/null
+++ b/libcxx/include/__pstl/dispatch.h
@@ -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
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef _LIBCPP___PSTL_DISPATCH_H
+#define _LIBCPP___PSTL_DISPATCH_H
+
+#include <__config>
+#include <__pstl/backend_fwd.h>
+#include <__type_traits/conditional.h>
+#include <__type_traits/enable_if.h>
+#include <__type_traits/integral_constant.h>
+#include <__type_traits/type_identity.h>
+
+#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
+# pragma GCC system_header
+#endif
+
+_LIBCPP_PUSH_MACROS
+#include <__undef_macros>
+
+_LIBCPP_BEGIN_NAMESPACE_STD
+namespace __pstl {
+
+template <template <class, class> class _Algorithm, class _Backend, class _ExecutionPolicy, class = void>
+constexpr bool __is_implemented_v = false;
+
+template <template <class, class> class _Algorithm, class _Backend, class _ExecutionPolicy>
+constexpr bool __is_implemented_v<_Algorithm,
+ _Backend,
+ _ExecutionPolicy,
+ __enable_if_t<sizeof(_Algorithm<_Backend, _ExecutionPolicy>)>> = true;
+
+// Helpful to provide better error messages. This will show the algorithm and the execution policy
+// in the compiler diagnostic.
+template <template <class, class> class _Algorithm, class _ExecutionPolicy>
+constexpr bool __cant_find_backend_for = false;
+
+template <template <class, class> class _Algorithm, class _BackendConfiguration, class _ExecutionPolicy>
+struct __find_first_implemented;
+
+template <template <class, class> class _Algorithm, class _ExecutionPolicy>
+struct __find_first_implemented<_Algorithm, __backend_configuration<>, _ExecutionPolicy> {
+ static_assert(__cant_find_backend_for<_Algorithm, _ExecutionPolicy>,
+ "Could not find a PSTL backend for the given algorithm and execution policy");
+};
+
+template <template <class, class> class _Algorithm, class _B1, class... _Bn, class _ExecutionPolicy>
+struct __find_first_implemented<_Algorithm, __backend_configuration<_B1, _Bn...>, _ExecutionPolicy>
+ : _If<__is_implemented_v<_Algorithm, _B1, _ExecutionPolicy>,
+ __type_identity<_Algorithm<_B1, _ExecutionPolicy>>,
+ __find_first_implemented<_Algorithm, __backend_configuration<_Bn...>, _ExecutionPolicy> > {};
+
+template <template <class, class> class _Algorithm, class _BackendConfiguration, class _ExecutionPolicy>
+using __dispatch = typename __find_first_implemented<_Algorithm, _BackendConfiguration, _ExecutionPolicy>::type;
+
+} // namespace __pstl
+_LIBCPP_END_NAMESPACE_STD
+
+_LIBCPP_POP_MACROS
+
+#endif // _LIBCPP___PSTL_DISPATCH_H
diff --git a/libcxx/include/__pstl/handle_exception.h b/libcxx/include/__pstl/handle_exception.h
new file mode 100644
index 000000000000..d6270958c3a7
--- /dev/null
+++ b/libcxx/include/__pstl/handle_exception.h
@@ -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
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef _LIBCPP___PSTL_HANDLE_EXCEPTION_H
+#define _LIBCPP___PSTL_HANDLE_EXCEPTION_H
+
+#include <__config>
+#include <__utility/forward.h>
+#include <__utility/move.h>
+#include <new> // __throw_bad_alloc
+#include <optional>
+
+#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
+# pragma GCC system_header
+#endif
+
+_LIBCPP_PUSH_MACROS
+#include <__undef_macros>
+
+_LIBCPP_BEGIN_NAMESPACE_STD
+namespace __pstl {
+
+template <class _BackendFunction, class... _Args>
+_LIBCPP_HIDE_FROM_ABI auto __handle_exception_impl(_Args&&... __args) noexcept {
+ return _BackendFunction{}(std::forward<_Args>(__args)...);
+}
+
+// This function is used to call a backend PSTL algorithm from a frontend algorithm.
+//
+// All PSTL backend algorithms return an optional denoting whether there was an
+// "infrastructure"-level failure (aka failure to allocate). This function takes
+// care of unwrapping that and throwing `bad_alloc()` in case there was a problem
+// in the underlying implementation.
+//
+// We must also be careful not to call any user code that could throw an exception
+// (such as moving or copying iterators) in here since that should terminate the
+// program, which is why we delegate to a noexcept helper below.
+template <class _BackendFunction, class... _Args>
+_LIBCPP_HIDE_FROM_ABI auto __handle_exception(_Args&&... __args) {
+ auto __result = __pstl::__handle_exception_impl<_BackendFunction>(std::forward<_Args>(__args)...);
+ if (__result == nullopt)
+ std::__throw_bad_alloc();
+ else
+ return std::move(*__result);
+}
+
+} // namespace __pstl
+_LIBCPP_END_NAMESPACE_STD
+
+_LIBCPP_POP_MACROS
+
+#endif // _LIBCPP___PSTL_HANDLE_EXCEPTION_H
diff --git a/libcxx/include/__random/discard_block_engine.h b/libcxx/include/__random/discard_block_engine.h
index 9279fb66f694..07f599067279 100644
--- a/libcxx/include/__random/discard_block_engine.h
+++ b/libcxx/include/__random/discard_block_engine.h
@@ -50,8 +50,8 @@ public:
static const result_type _Min = _Engine::_Min;
static const result_type _Max = _Engine::_Max;
#else
- static _LIBCPP_CONSTEXPR const result_type _Min = _Engine::min();
- static _LIBCPP_CONSTEXPR const result_type _Max = _Engine::max();
+ static constexpr result_type _Min = _Engine::min();
+ static constexpr result_type _Max = _Engine::max();
#endif
_LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR result_type min() { return _Engine::min(); }
diff --git a/libcxx/include/__ranges/access.h b/libcxx/include/__ranges/access.h
index 3db4f11b40f2..c0a40c5e1017 100644
--- a/libcxx/include/__ranges/access.h
+++ b/libcxx/include/__ranges/access.h
@@ -191,9 +191,8 @@ struct __fn {
template <class _Tp>
requires is_rvalue_reference_v<_Tp&&>
- [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Tp&& __t) const
- noexcept(noexcept(ranges::end(static_cast<const _Tp&&>(__t))))
- -> decltype(ranges::end(static_cast<const _Tp&&>(__t))) {
+ [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Tp&& __t) const noexcept(
+ noexcept(ranges::end(static_cast<const _Tp&&>(__t)))) -> decltype(ranges::end(static_cast<const _Tp&&>(__t))) {
return ranges::end(static_cast<const _Tp&&>(__t));
}
};
diff --git a/libcxx/include/__ranges/all.h b/libcxx/include/__ranges/all.h
index b735bdc7166c..023cee6caa9a 100644
--- a/libcxx/include/__ranges/all.h
+++ b/libcxx/include/__ranges/all.h
@@ -39,9 +39,8 @@ namespace __all {
struct __fn : __range_adaptor_closure<__fn> {
template <class _Tp>
requires ranges::view<decay_t<_Tp>>
- [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Tp&& __t) const
- noexcept(noexcept(_LIBCPP_AUTO_CAST(std::forward<_Tp>(__t))))
- -> decltype(_LIBCPP_AUTO_CAST(std::forward<_Tp>(__t))) {
+ [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Tp&& __t) const noexcept(
+ noexcept(_LIBCPP_AUTO_CAST(std::forward<_Tp>(__t)))) -> decltype(_LIBCPP_AUTO_CAST(std::forward<_Tp>(__t))) {
return _LIBCPP_AUTO_CAST(std::forward<_Tp>(__t));
}
diff --git a/libcxx/include/__ranges/common_view.h b/libcxx/include/__ranges/common_view.h
index 4b5b04c9894b..133236dd1d78 100644
--- a/libcxx/include/__ranges/common_view.h
+++ b/libcxx/include/__ranges/common_view.h
@@ -114,16 +114,14 @@ namespace __common {
struct __fn : __range_adaptor_closure<__fn> {
template <class _Range>
requires common_range<_Range>
- [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Range&& __range) const
- noexcept(noexcept(views::all(std::forward<_Range>(__range))))
- -> decltype(views::all(std::forward<_Range>(__range))) {
+ [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Range&& __range) const noexcept(
+ noexcept(views::all(std::forward<_Range>(__range)))) -> decltype(views::all(std::forward<_Range>(__range))) {
return views::all(std::forward<_Range>(__range));
}
template <class _Range>
- [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Range&& __range) const
- noexcept(noexcept(common_view{std::forward<_Range>(__range)}))
- -> decltype(common_view{std::forward<_Range>(__range)}) {
+ [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Range&& __range) const noexcept(noexcept(common_view{
+ std::forward<_Range>(__range)})) -> decltype(common_view{std::forward<_Range>(__range)}) {
return common_view{std::forward<_Range>(__range)};
}
};
diff --git a/libcxx/include/__ranges/counted.h b/libcxx/include/__ranges/counted.h
index 83d76f8fd210..e365deca4e63 100644
--- a/libcxx/include/__ranges/counted.h
+++ b/libcxx/include/__ranges/counted.h
@@ -51,9 +51,8 @@ struct __fn {
}
template <random_access_iterator _It>
- _LIBCPP_HIDE_FROM_ABI static constexpr auto
- __go(_It __it, iter_difference_t<_It> __count) noexcept(noexcept(subrange(__it, __it + __count)))
- -> decltype(subrange(__it, __it + __count)) {
+ _LIBCPP_HIDE_FROM_ABI static constexpr auto __go(_It __it, iter_difference_t<_It> __count) noexcept(
+ noexcept(subrange(__it, __it + __count))) -> decltype(subrange(__it, __it + __count)) {
return subrange(__it, __it + __count);
}
diff --git a/libcxx/include/__ranges/data.h b/libcxx/include/__ranges/data.h
index 131f6cdad8f2..50db3cffeeed 100644
--- a/libcxx/include/__ranges/data.h
+++ b/libcxx/include/__ranges/data.h
@@ -83,9 +83,8 @@ struct __fn {
template <class _Tp>
requires is_rvalue_reference_v<_Tp&&>
- [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Tp&& __t) const
- noexcept(noexcept(ranges::data(static_cast<const _Tp&&>(__t))))
- -> decltype(ranges::data(static_cast<const _Tp&&>(__t))) {
+ [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Tp&& __t) const noexcept(
+ noexcept(ranges::data(static_cast<const _Tp&&>(__t)))) -> decltype(ranges::data(static_cast<const _Tp&&>(__t))) {
return ranges::data(static_cast<const _Tp&&>(__t));
}
};
diff --git a/libcxx/include/__ranges/drop_view.h b/libcxx/include/__ranges/drop_view.h
index fbfbca4db621..853e22a402ca 100644
--- a/libcxx/include/__ranges/drop_view.h
+++ b/libcxx/include/__ranges/drop_view.h
@@ -289,14 +289,14 @@ struct __fn {
template <class _Range, convertible_to<range_difference_t<_Range>> _Np, class _RawRange = remove_cvref_t<_Range>>
// Note: without specifically excluding the other cases, GCC sees this overload as ambiguous with the other
// overloads.
- requires(
- !(__is_empty_view<_RawRange> ||
+ requires(!(__is_empty_view<_RawRange> ||
# if _LIBCPP_STD_VER >= 23
- __is_repeat_specialization<_RawRange> ||
+ __is_repeat_specialization<_RawRange> ||
# endif
- (__is_subrange_specialization_with_store_size<_RawRange> && sized_range<_RawRange> &&
- random_access_range<_RawRange>) ||
- (__is_passthrough_specialization<_RawRange> && sized_range<_RawRange> && random_access_range<_RawRange>)))
+ (__is_subrange_specialization_with_store_size<_RawRange> && sized_range<_RawRange> &&
+ random_access_range<_RawRange>) ||
+ (__is_passthrough_specialization<_RawRange> && sized_range<_RawRange> &&
+ random_access_range<_RawRange>)))
[[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Range&& __range, _Np&& __n) const
noexcept(noexcept(drop_view(std::forward<_Range>(__range), std::forward<_Np>(__n))))
-> decltype(drop_view(std::forward<_Range>(__range), std::forward<_Np>(__n))) {
diff --git a/libcxx/include/__ranges/iota_view.h b/libcxx/include/__ranges/iota_view.h
index 9e6f724241cc..c0f5ed936a66 100644
--- a/libcxx/include/__ranges/iota_view.h
+++ b/libcxx/include/__ranges/iota_view.h
@@ -22,7 +22,6 @@
#include <__concepts/semiregular.h>
#include <__concepts/totally_ordered.h>
#include <__config>
-#include <__functional/ranges_operations.h>
#include <__iterator/concepts.h>
#include <__iterator/incrementable_traits.h>
#include <__iterator/iterator_traits.h>
@@ -313,8 +312,8 @@ public:
: __value_(std::move(__value)), __bound_sentinel_(std::move(__bound_sentinel)) {
// Validate the precondition if possible.
if constexpr (totally_ordered_with<_Start, _BoundSentinel>) {
- _LIBCPP_ASSERT_UNCATEGORIZED(
- ranges::less_equal()(__value_, __bound_sentinel_), "Precondition violated: value is greater than bound.");
+ _LIBCPP_ASSERT_VALID_INPUT_RANGE(
+ bool(__value_ <= __bound_sentinel_), "iota_view: bound must be reachable from value");
}
}
diff --git a/libcxx/include/__ranges/lazy_split_view.h b/libcxx/include/__ranges/lazy_split_view.h
index 6aedfdabffe3..db031fe5f8b4 100644
--- a/libcxx/include/__ranges/lazy_split_view.h
+++ b/libcxx/include/__ranges/lazy_split_view.h
@@ -403,8 +403,8 @@ template <class _Range, class _Pattern>
lazy_split_view(_Range&&, _Pattern&&) -> lazy_split_view<views::all_t<_Range>, views::all_t<_Pattern>>;
template <input_range _Range>
-lazy_split_view(_Range&&, range_value_t<_Range>)
- -> lazy_split_view<views::all_t<_Range>, single_view<range_value_t<_Range>>>;
+lazy_split_view(_Range&&,
+ range_value_t<_Range>) -> lazy_split_view<views::all_t<_Range>, single_view<range_value_t<_Range>>>;
namespace views {
namespace __lazy_split_view {
diff --git a/libcxx/include/__ranges/ref_view.h b/libcxx/include/__ranges/ref_view.h
index 6213332a542a..5329d778dd30 100644
--- a/libcxx/include/__ranges/ref_view.h
+++ b/libcxx/include/__ranges/ref_view.h
@@ -43,7 +43,7 @@ class ref_view : public view_interface<ref_view<_Range>> {
_Range* __range_;
static void __fun(_Range&);
- static void __fun(_Range&&) = delete;
+ static void __fun(_Range&&) = delete; // NOLINT(modernize-use-equals-delete) ; This is llvm.org/PR54276
public:
template <class _Tp>
diff --git a/libcxx/include/__ranges/rend.h b/libcxx/include/__ranges/rend.h
index 5edbc4e3160c..02b4c5999a7e 100644
--- a/libcxx/include/__ranges/rend.h
+++ b/libcxx/include/__ranges/rend.h
@@ -104,9 +104,8 @@ struct __fn {
template <class _Tp>
requires is_rvalue_reference_v<_Tp&&>
- [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Tp&& __t) const
- noexcept(noexcept(ranges::rend(static_cast<const _Tp&&>(__t))))
- -> decltype(ranges::rend(static_cast<const _Tp&&>(__t))) {
+ [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Tp&& __t) const noexcept(
+ noexcept(ranges::rend(static_cast<const _Tp&&>(__t)))) -> decltype(ranges::rend(static_cast<const _Tp&&>(__t))) {
return ranges::rend(static_cast<const _Tp&&>(__t));
}
};
diff --git a/libcxx/include/__ranges/reverse_view.h b/libcxx/include/__ranges/reverse_view.h
index ddbe8908414f..796f5be22328 100644
--- a/libcxx/include/__ranges/reverse_view.h
+++ b/libcxx/include/__ranges/reverse_view.h
@@ -181,9 +181,8 @@ struct __fn : __range_adaptor_closure<__fn> {
template <class _Range>
requires(!__is_reverse_view<remove_cvref_t<_Range>> && !__is_sized_reverse_subrange<remove_cvref_t<_Range>> &&
!__is_unsized_reverse_subrange<remove_cvref_t<_Range>>)
- [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Range&& __range) const
- noexcept(noexcept(reverse_view{std::forward<_Range>(__range)}))
- -> decltype(reverse_view{std::forward<_Range>(__range)}) {
+ [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Range&& __range) const noexcept(noexcept(reverse_view{
+ std::forward<_Range>(__range)})) -> decltype(reverse_view{std::forward<_Range>(__range)}) {
return reverse_view{std::forward<_Range>(__range)};
}
};
diff --git a/libcxx/include/__ranges/subrange.h b/libcxx/include/__ranges/subrange.h
index 051bc3113901..aba584ef9335 100644
--- a/libcxx/include/__ranges/subrange.h
+++ b/libcxx/include/__ranges/subrange.h
@@ -200,12 +200,11 @@ template <input_or_output_iterator _Iter, sentinel_for<_Iter> _Sent>
subrange(_Iter, _Sent, make_unsigned_t<iter_difference_t<_Iter>>) -> subrange<_Iter, _Sent, subrange_kind::sized>;
template <borrowed_range _Range>
-subrange(_Range&&)
- -> subrange<iterator_t<_Range>,
- sentinel_t<_Range>,
- (sized_range<_Range> || sized_sentinel_for<sentinel_t<_Range>, iterator_t<_Range>>)
- ? subrange_kind::sized
- : subrange_kind::unsized>;
+subrange(_Range&&) -> subrange<iterator_t<_Range>,
+ sentinel_t<_Range>,
+ (sized_range<_Range> || sized_sentinel_for<sentinel_t<_Range>, iterator_t<_Range>>)
+ ? subrange_kind::sized
+ : subrange_kind::unsized>;
template <borrowed_range _Range>
subrange(_Range&&, make_unsigned_t<range_difference_t<_Range>>)
diff --git a/libcxx/include/__split_buffer b/libcxx/include/__split_buffer
index c68349e0979c..bab724d1b896 100644
--- a/libcxx/include/__split_buffer
+++ b/libcxx/include/__split_buffer
@@ -24,12 +24,14 @@
#include <__memory/pointer_traits.h>
#include <__memory/swap_allocator.h>
#include <__type_traits/add_lvalue_reference.h>
+#include <__type_traits/conditional.h>
#include <__type_traits/enable_if.h>
#include <__type_traits/integral_constant.h>
#include <__type_traits/is_nothrow_assignable.h>
#include <__type_traits/is_nothrow_constructible.h>
#include <__type_traits/is_swappable.h>
#include <__type_traits/is_trivially_destructible.h>
+#include <__type_traits/is_trivially_relocatable.h>
#include <__type_traits/remove_reference.h>
#include <__utility/forward.h>
#include <__utility/move.h>
@@ -64,6 +66,15 @@ public:
using iterator = pointer;
using const_iterator = const_pointer;
+ // A __split_buffer contains the following members which may be trivially relocatable:
+ // - pointer: may be trivially relocatable, so it's checked
+ // - allocator_type: may be trivially relocatable, so it's checked
+ // __split_buffer doesn't have any self-references, so it's trivially relocatable if its members are.
+ using __trivially_relocatable = __conditional_t<
+ __libcpp_is_trivially_relocatable<pointer>::value && __libcpp_is_trivially_relocatable<allocator_type>::value,
+ __split_buffer,
+ void>;
+
pointer __first_;
pointer __begin_;
pointer __end_;
@@ -187,7 +198,7 @@ public:
_LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI void __destruct_at_end(pointer __new_last, true_type) _NOEXCEPT;
_LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI void swap(__split_buffer& __x)
- _NOEXCEPT_(!__alloc_traits::propagate_on_container_swap::value || __is_nothrow_swappable<__alloc_rr>::value);
+ _NOEXCEPT_(!__alloc_traits::propagate_on_container_swap::value || __is_nothrow_swappable_v<__alloc_rr>);
_LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI bool __invariants() const;
@@ -200,8 +211,8 @@ private:
_LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI void __move_assign_alloc(__split_buffer&, false_type) _NOEXCEPT {}
struct _ConstructTransaction {
- _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI explicit _ConstructTransaction(
- pointer* __p, size_type __n) _NOEXCEPT
+ _LIBCPP_CONSTEXPR_SINCE_CXX20
+ _LIBCPP_HIDE_FROM_ABI explicit _ConstructTransaction(pointer* __p, size_type __n) _NOEXCEPT
: __pos_(*__p),
__end_(*__p + __n),
__dest_(__p) {}
@@ -409,7 +420,7 @@ __split_buffer<_Tp, _Allocator>::operator=(__split_buffer&& __c)
template <class _Tp, class _Allocator>
_LIBCPP_CONSTEXPR_SINCE_CXX20 void __split_buffer<_Tp, _Allocator>::swap(__split_buffer& __x)
- _NOEXCEPT_(!__alloc_traits::propagate_on_container_swap::value || __is_nothrow_swappable<__alloc_rr>::value) {
+ _NOEXCEPT_(!__alloc_traits::propagate_on_container_swap::value || __is_nothrow_swappable_v<__alloc_rr>) {
std::swap(__first_, __x.__first_);
std::swap(__begin_, __x.__begin_);
std::swap(__end_, __x.__end_);
diff --git a/libcxx/include/__string/char_traits.h b/libcxx/include/__string/char_traits.h
index 9d347b188ee1..40821f86465b 100644
--- a/libcxx/include/__string/char_traits.h
+++ b/libcxx/include/__string/char_traits.h
@@ -270,26 +270,26 @@ struct _LIBCPP_TEMPLATE_VIS char_traits<char8_t> {
static inline _LIBCPP_HIDE_FROM_ABI constexpr bool lt(char_type __c1, char_type __c2) noexcept { return __c1 < __c2; }
static _LIBCPP_HIDE_FROM_ABI constexpr int
- compare(const char_type* __s1, const char_type* __s2, size_t __n) _NOEXCEPT {
+ compare(const char_type* __s1, const char_type* __s2, size_t __n) noexcept {
return std::__constexpr_memcmp(__s1, __s2, __element_count(__n));
}
- static _LIBCPP_HIDE_FROM_ABI constexpr size_t length(const char_type* __str) _NOEXCEPT {
+ static _LIBCPP_HIDE_FROM_ABI constexpr size_t length(const char_type* __str) noexcept {
return std::__constexpr_strlen(__str);
}
_LIBCPP_HIDE_FROM_ABI static constexpr const char_type*
- find(const char_type* __s, size_t __n, const char_type& __a) _NOEXCEPT {
+ find(const char_type* __s, size_t __n, const char_type& __a) noexcept {
return std::__constexpr_memchr(__s, __a, __n);
}
static _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 char_type*
- move(char_type* __s1, const char_type* __s2, size_t __n) _NOEXCEPT {
+ move(char_type* __s1, const char_type* __s2, size_t __n) noexcept {
return std::__constexpr_memmove(__s1, __s2, __element_count(__n));
}
static _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 char_type*
- copy(char_type* __s1, const char_type* __s2, size_t __n) _NOEXCEPT {
+ copy(char_type* __s1, const char_type* __s2, size_t __n) noexcept {
_LIBCPP_ASSERT_NON_OVERLAPPING_RANGES(!std::__is_pointer_in_range(__s1, __s1 + __n, __s2),
"char_traits::copy: source and destination ranges overlap");
std::__constexpr_memmove(__s1, __s2, __element_count(__n));
@@ -297,7 +297,7 @@ struct _LIBCPP_TEMPLATE_VIS char_traits<char8_t> {
}
static _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 char_type*
- assign(char_type* __s, size_t __n, char_type __a) _NOEXCEPT {
+ assign(char_type* __s, size_t __n, char_type __a) noexcept {
std::fill_n(__s, __n, __a);
return __s;
}
diff --git a/libcxx/include/__thread/thread.h b/libcxx/include/__thread/thread.h
index 8db1e28ec7bf..d2254a695f5e 100644
--- a/libcxx/include/__thread/thread.h
+++ b/libcxx/include/__thread/thread.h
@@ -65,18 +65,17 @@ class __thread_specific_ptr {
// Only __thread_local_data() may construct a __thread_specific_ptr
// and only with _Tp == __thread_struct.
- static_assert((is_same<_Tp, __thread_struct>::value), "");
+ static_assert(is_same<_Tp, __thread_struct>::value, "");
__thread_specific_ptr();
friend _LIBCPP_EXPORTED_FROM_ABI __thread_specific_ptr<__thread_struct>& __thread_local_data();
- __thread_specific_ptr(const __thread_specific_ptr&);
- __thread_specific_ptr& operator=(const __thread_specific_ptr&);
-
_LIBCPP_HIDDEN static void _LIBCPP_TLS_DESTRUCTOR_CC __at_thread_exit(void*);
public:
typedef _Tp* pointer;
+ __thread_specific_ptr(const __thread_specific_ptr&) = delete;
+ __thread_specific_ptr& operator=(const __thread_specific_ptr&) = delete;
~__thread_specific_ptr();
_LIBCPP_HIDE_FROM_ABI pointer get() const { return static_cast<_Tp*>(__libcpp_tls_get(__key_)); }
diff --git a/libcxx/include/__tree b/libcxx/include/__tree
index 5a0d8f42a69c..1990fa602d39 100644
--- a/libcxx/include/__tree
+++ b/libcxx/include/__tree
@@ -574,7 +574,7 @@ struct __tree_node_base_types {
#endif
private:
- static_assert((is_same<typename pointer_traits<_VoidPtr>::element_type, void>::value),
+ static_assert(is_same<typename pointer_traits<_VoidPtr>::element_type, void>::value,
"_VoidPtr does not point to unqualified void type");
};
@@ -614,7 +614,7 @@ public:
private:
static_assert(!is_const<__node_type>::value, "_NodePtr should never be a pointer to const");
- static_assert((is_same<__rebind_pointer_t<_VoidPtr, __node_type>, _NodePtr>::value),
+ static_assert(is_same<__rebind_pointer_t<_VoidPtr, __node_type>, _NodePtr>::value,
"_VoidPtr does not rebind to _NodePtr.");
};
@@ -651,7 +651,6 @@ public:
_LIBCPP_HIDE_FROM_ABI void __set_parent(pointer __p) { __parent_ = static_cast<__parent_pointer>(__p); }
-private:
~__tree_node_base() = delete;
__tree_node_base(__tree_node_base const&) = delete;
__tree_node_base& operator=(__tree_node_base const&) = delete;
@@ -666,7 +665,6 @@ public:
_LIBCPP_HIDE_FROM_ABI _Tp& __get_value() { return __value_; }
-private:
~__tree_node() = delete;
__tree_node(__tree_node const&) = delete;
__tree_node& operator=(__tree_node const&) = delete;
@@ -925,11 +923,11 @@ private:
// check for sane allocator pointer rebinding semantics. Rebinding the
// allocator for a new pointer type should be exactly the same as rebinding
// the pointer using 'pointer_traits'.
- static_assert((is_same<__node_pointer, typename __node_traits::pointer>::value),
+ static_assert(is_same<__node_pointer, typename __node_traits::pointer>::value,
"Allocator does not rebind pointers in a sane manner.");
typedef __rebind_alloc<__node_traits, __node_base> __node_base_allocator;
typedef allocator_traits<__node_base_allocator> __node_base_traits;
- static_assert((is_same<__node_base_pointer, typename __node_base_traits::pointer>::value),
+ static_assert(is_same<__node_base_pointer, typename __node_base_traits::pointer>::value,
"Allocator does not rebind pointers in a sane manner.");
private:
@@ -1006,11 +1004,10 @@ public:
_LIBCPP_HIDE_FROM_ABI void swap(__tree& __t)
#if _LIBCPP_STD_VER <= 11
- _NOEXCEPT_(__is_nothrow_swappable<value_compare>::value &&
- (!__node_traits::propagate_on_container_swap::value ||
- __is_nothrow_swappable<__node_allocator>::value));
+ _NOEXCEPT_(__is_nothrow_swappable_v<value_compare> &&
+ (!__node_traits::propagate_on_container_swap::value || __is_nothrow_swappable_v<__node_allocator>));
#else
- _NOEXCEPT_(__is_nothrow_swappable<value_compare>::value);
+ _NOEXCEPT_(__is_nothrow_swappable_v<value_compare>);
#endif
template <class _Key, class... _Args>
@@ -1401,7 +1398,7 @@ template <class _ForwardIterator>
void __tree<_Tp, _Compare, _Allocator>::__assign_unique(_ForwardIterator __first, _ForwardIterator __last) {
typedef iterator_traits<_ForwardIterator> _ITraits;
typedef typename _ITraits::value_type _ItValueType;
- static_assert((is_same<_ItValueType, __container_value_type>::value),
+ static_assert(is_same<_ItValueType, __container_value_type>::value,
"__assign_unique may only be called with the containers value type");
static_assert(
__has_forward_iterator_category<_ForwardIterator>::value, "__assign_unique requires a forward iterator");
@@ -1531,7 +1528,7 @@ __tree<_Tp, _Compare, _Allocator>& __tree<_Tp, _Compare, _Allocator>::operator=(
template <class _Tp, class _Compare, class _Allocator>
__tree<_Tp, _Compare, _Allocator>::~__tree() {
- static_assert((is_copy_constructible<value_compare>::value), "Comparator must be copy-constructible.");
+ static_assert(is_copy_constructible<value_compare>::value, "Comparator must be copy-constructible.");
destroy(__root());
}
@@ -1549,10 +1546,10 @@ void __tree<_Tp, _Compare, _Allocator>::destroy(__node_pointer __nd) _NOEXCEPT {
template <class _Tp, class _Compare, class _Allocator>
void __tree<_Tp, _Compare, _Allocator>::swap(__tree& __t)
#if _LIBCPP_STD_VER <= 11
- _NOEXCEPT_(__is_nothrow_swappable<value_compare>::value &&
- (!__node_traits::propagate_on_container_swap::value || __is_nothrow_swappable<__node_allocator>::value))
+ _NOEXCEPT_(__is_nothrow_swappable_v<value_compare> &&
+ (!__node_traits::propagate_on_container_swap::value || __is_nothrow_swappable_v<__node_allocator>))
#else
- _NOEXCEPT_(__is_nothrow_swappable<value_compare>::value)
+ _NOEXCEPT_(__is_nothrow_swappable_v<value_compare>)
#endif
{
using std::swap;
diff --git a/libcxx/include/__tuple/sfinae_helpers.h b/libcxx/include/__tuple/sfinae_helpers.h
index 35a57ff77659..c7145e0b011a 100644
--- a/libcxx/include/__tuple/sfinae_helpers.h
+++ b/libcxx/include/__tuple/sfinae_helpers.h
@@ -35,8 +35,8 @@ _LIBCPP_BEGIN_NAMESPACE_STD
struct __tuple_sfinae_base {
template <template <class, class...> class _Trait, class... _LArgs, class... _RArgs>
- static auto __do_test(__tuple_types<_LArgs...>, __tuple_types<_RArgs...>)
- -> __all<__enable_if_t<_Trait<_LArgs, _RArgs>::value, bool>{true}...>;
+ static auto __do_test(__tuple_types<_LArgs...>,
+ __tuple_types<_RArgs...>) -> __all<__enable_if_t<_Trait<_LArgs, _RArgs>::value, bool>{true}...>;
template <template <class...> class>
static auto __do_test(...) -> false_type;
diff --git a/libcxx/include/__tuple/tuple_size.h b/libcxx/include/__tuple/tuple_size.h
index 668be13a5c84..18a17fd4d587 100644
--- a/libcxx/include/__tuple/tuple_size.h
+++ b/libcxx/include/__tuple/tuple_size.h
@@ -43,7 +43,7 @@ struct _LIBCPP_TEMPLATE_VIS tuple_size<__enable_if_tuple_size_imp< volatile _Tp,
template <class _Tp>
struct _LIBCPP_TEMPLATE_VIS
- tuple_size<__enable_if_tuple_size_imp<const volatile _Tp, integral_constant<size_t, sizeof(tuple_size<_Tp>)>>>
+tuple_size<__enable_if_tuple_size_imp<const volatile _Tp, integral_constant<size_t, sizeof(tuple_size<_Tp>)>>>
: public integral_constant<size_t, tuple_size<_Tp>::value> {};
#else
diff --git a/libcxx/include/__type_traits/has_unique_object_representation.h b/libcxx/include/__type_traits/has_unique_object_representation.h
index 1aa044990032..98c440c16bf2 100644
--- a/libcxx/include/__type_traits/has_unique_object_representation.h
+++ b/libcxx/include/__type_traits/has_unique_object_representation.h
@@ -11,6 +11,7 @@
#include <__config>
#include <__type_traits/integral_constant.h>
+#include <__type_traits/remove_all_extents.h>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
# pragma GCC system_header
@@ -22,7 +23,12 @@ _LIBCPP_BEGIN_NAMESPACE_STD
template <class _Tp>
struct _LIBCPP_TEMPLATE_VIS has_unique_object_representations
- : public integral_constant<bool, __has_unique_object_representations(_Tp)> {};
+ // TODO: We work around a Clang and GCC bug in __has_unique_object_representations by using remove_all_extents
+ // even though it should not be necessary. This was reported to the compilers:
+ // - Clang: https://github.com/llvm/llvm-project/issues/95311
+ // - GCC: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115476
+ // remove_all_extents_t can be removed once all the compilers we support have fixed this bug.
+ : public integral_constant<bool, __has_unique_object_representations(remove_all_extents_t<_Tp>)> {};
template <class _Tp>
inline constexpr bool has_unique_object_representations_v = __has_unique_object_representations(_Tp);
diff --git a/libcxx/include/__type_traits/invoke.h b/libcxx/include/__type_traits/invoke.h
index 44ef2a83b9cc..a0281f5b2006 100644
--- a/libcxx/include/__type_traits/invoke.h
+++ b/libcxx/include/__type_traits/invoke.h
@@ -163,8 +163,8 @@ struct __invokable_r {
using _Result = decltype(__try_call<_Fp, _Args...>(0));
using type = __conditional_t<_IsNotSame<_Result, __nat>::value,
- __conditional_t<is_void<_Ret>::value, true_type, __is_core_convertible<_Result, _Ret> >,
- false_type>;
+ __conditional_t<is_void<_Ret>::value, true_type, __is_core_convertible<_Result, _Ret> >,
+ false_type>;
static const bool value = type::value;
};
template <class _Fp, class... _Args>
diff --git a/libcxx/include/__type_traits/is_literal_type.h b/libcxx/include/__type_traits/is_literal_type.h
index 81da34572c75..10e23bceffbd 100644
--- a/libcxx/include/__type_traits/is_literal_type.h
+++ b/libcxx/include/__type_traits/is_literal_type.h
@@ -20,8 +20,8 @@ _LIBCPP_BEGIN_NAMESPACE_STD
#if _LIBCPP_STD_VER <= 17 || defined(_LIBCPP_ENABLE_CXX20_REMOVED_TYPE_TRAITS)
template <class _Tp>
-struct _LIBCPP_TEMPLATE_VIS _LIBCPP_DEPRECATED_IN_CXX17 is_literal_type
- : public integral_constant<bool, __is_literal_type(_Tp)> {};
+struct _LIBCPP_TEMPLATE_VIS
+_LIBCPP_DEPRECATED_IN_CXX17 is_literal_type : public integral_constant<bool, __is_literal_type(_Tp)> {};
# if _LIBCPP_STD_VER >= 17
template <class _Tp>
diff --git a/libcxx/include/__type_traits/is_nothrow_destructible.h b/libcxx/include/__type_traits/is_nothrow_destructible.h
index 370ba27ecd1f..c2d5ca87232a 100644
--- a/libcxx/include/__type_traits/is_nothrow_destructible.h
+++ b/libcxx/include/__type_traits/is_nothrow_destructible.h
@@ -12,9 +12,6 @@
#include <__config>
#include <__type_traits/integral_constant.h>
#include <__type_traits/is_destructible.h>
-#include <__type_traits/is_reference.h>
-#include <__type_traits/is_scalar.h>
-#include <__type_traits/remove_all_extents.h>
#include <__utility/declval.h>
#include <cstddef>
@@ -24,7 +21,12 @@
_LIBCPP_BEGIN_NAMESPACE_STD
-#if !defined(_LIBCPP_CXX03_LANG)
+#if __has_builtin(__is_nothrow_destructible)
+
+template <class _Tp>
+struct _LIBCPP_TEMPLATE_VIS is_nothrow_destructible : integral_constant<bool, __is_nothrow_destructible(_Tp)> {};
+
+#else
template <bool, class _Tp>
struct __libcpp_is_nothrow_destructible;
@@ -49,20 +51,7 @@ struct _LIBCPP_TEMPLATE_VIS is_nothrow_destructible<_Tp&> : public true_type {};
template <class _Tp>
struct _LIBCPP_TEMPLATE_VIS is_nothrow_destructible<_Tp&&> : public true_type {};
-#else
-
-template <class _Tp>
-struct __libcpp_nothrow_destructor : public integral_constant<bool, is_scalar<_Tp>::value || is_reference<_Tp>::value> {
-};
-
-template <class _Tp>
-struct _LIBCPP_TEMPLATE_VIS is_nothrow_destructible : public __libcpp_nothrow_destructor<__remove_all_extents_t<_Tp> > {
-};
-
-template <class _Tp>
-struct _LIBCPP_TEMPLATE_VIS is_nothrow_destructible<_Tp[]> : public false_type {};
-
-#endif
+#endif // __has_builtin(__is_nothrow_destructible)
#if _LIBCPP_STD_VER >= 17
template <class _Tp>
diff --git a/libcxx/include/__type_traits/is_swappable.h b/libcxx/include/__type_traits/is_swappable.h
index 06b59e5c25d0..0b817e650993 100644
--- a/libcxx/include/__type_traits/is_swappable.h
+++ b/libcxx/include/__type_traits/is_swappable.h
@@ -11,16 +11,12 @@
#include <__config>
#include <__type_traits/add_lvalue_reference.h>
-#include <__type_traits/conditional.h>
#include <__type_traits/enable_if.h>
#include <__type_traits/is_assignable.h>
#include <__type_traits/is_constructible.h>
#include <__type_traits/is_nothrow_assignable.h>
#include <__type_traits/is_nothrow_constructible.h>
-#include <__type_traits/is_referenceable.h>
-#include <__type_traits/is_same.h>
-#include <__type_traits/is_void.h>
-#include <__type_traits/nat.h>
+#include <__type_traits/void_t.h>
#include <__utility/declval.h>
#include <cstddef>
@@ -30,10 +26,17 @@
_LIBCPP_BEGIN_NAMESPACE_STD
+template <class _Tp, class _Up, class = void>
+inline const bool __is_swappable_with_v = false;
+
template <class _Tp>
-struct __is_swappable;
+inline const bool __is_swappable_v = __is_swappable_with_v<_Tp&, _Tp&>;
+
+template <class _Tp, class _Up, bool = __is_swappable_with_v<_Tp, _Up> >
+inline const bool __is_nothrow_swappable_with_v = false;
+
template <class _Tp>
-struct __is_nothrow_swappable;
+inline const bool __is_nothrow_swappable_v = __is_nothrow_swappable_with_v<_Tp&, _Tp&>;
#ifndef _LIBCPP_CXX03_LANG
template <class _Tp>
@@ -47,85 +50,52 @@ template <class _Tp>
inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 __swap_result_t<_Tp> swap(_Tp& __x, _Tp& __y)
_NOEXCEPT_(is_nothrow_move_constructible<_Tp>::value&& is_nothrow_move_assignable<_Tp>::value);
-template <class _Tp, size_t _Np, __enable_if_t<__is_swappable<_Tp>::value, int> = 0>
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void swap(_Tp (&__a)[_Np], _Tp (&__b)[_Np])
- _NOEXCEPT_(__is_nothrow_swappable<_Tp>::value);
+template <class _Tp, size_t _Np, __enable_if_t<__is_swappable_v<_Tp>, int> = 0>
+inline _LIBCPP_HIDE_FROM_ABI
+_LIBCPP_CONSTEXPR_SINCE_CXX20 void swap(_Tp (&__a)[_Np], _Tp (&__b)[_Np]) _NOEXCEPT_(__is_nothrow_swappable_v<_Tp>);
-namespace __detail {
// ALL generic swap overloads MUST already have a declaration available at this point.
-template <class _Tp, class _Up = _Tp, bool _NotVoid = !is_void<_Tp>::value && !is_void<_Up>::value>
-struct __swappable_with {
- template <class _LHS, class _RHS>
- static decltype(swap(std::declval<_LHS>(), std::declval<_RHS>())) __test_swap(int);
- template <class, class>
- static __nat __test_swap(long);
-
- // Extra parens are needed for the C++03 definition of decltype.
- typedef decltype((__test_swap<_Tp, _Up>(0))) __swap1;
- typedef decltype((__test_swap<_Up, _Tp>(0))) __swap2;
-
- static const bool value = _IsNotSame<__swap1, __nat>::value && _IsNotSame<__swap2, __nat>::value;
-};
+template <class _Tp, class _Up>
+inline const bool __is_swappable_with_v<_Tp,
+ _Up,
+ __void_t<decltype(swap(std::declval<_Tp>(), std::declval<_Up>())),
+ decltype(swap(std::declval<_Up>(), std::declval<_Tp>()))> > = true;
+#ifndef _LIBCPP_CXX03_LANG // C++03 doesn't have noexcept, so things are never nothrow swappable
template <class _Tp, class _Up>
-struct __swappable_with<_Tp, _Up, false> : false_type {};
-
-template <class _Tp, class _Up = _Tp, bool _Swappable = __swappable_with<_Tp, _Up>::value>
-struct __nothrow_swappable_with {
- static const bool value =
-#ifndef _LIBCPP_HAS_NO_NOEXCEPT
- noexcept(swap(std::declval<_Tp>(), std::declval<_Up>()))&& noexcept(
- swap(std::declval<_Up>(), std::declval<_Tp>()));
-#else
- false;
+inline const bool __is_nothrow_swappable_with_v<_Tp, _Up, true> =
+ noexcept(swap(std::declval<_Tp>(), std::declval<_Up>())) &&
+ noexcept(swap(std::declval<_Up>(), std::declval<_Tp>()));
#endif
-};
-template <class _Tp, class _Up>
-struct __nothrow_swappable_with<_Tp, _Up, false> : false_type {};
+#if _LIBCPP_STD_VER >= 17
-} // namespace __detail
+template <class _Tp, class _Up>
+inline constexpr bool is_swappable_with_v = __is_swappable_with_v<_Tp, _Up>;
-template <class _Tp>
-struct __is_swappable : public integral_constant<bool, __detail::__swappable_with<_Tp&>::value> {};
+template <class _Tp, class _Up>
+struct _LIBCPP_TEMPLATE_VIS is_swappable_with : bool_constant<is_swappable_with_v<_Tp, _Up>> {};
template <class _Tp>
-struct __is_nothrow_swappable : public integral_constant<bool, __detail::__nothrow_swappable_with<_Tp&>::value> {};
-
-#if _LIBCPP_STD_VER >= 17
-
-template <class _Tp, class _Up>
-struct _LIBCPP_TEMPLATE_VIS is_swappable_with
- : public integral_constant<bool, __detail::__swappable_with<_Tp, _Up>::value> {};
+inline constexpr bool is_swappable_v =
+ is_swappable_with_v<__add_lvalue_reference_t<_Tp>, __add_lvalue_reference_t<_Tp>>;
template <class _Tp>
-struct _LIBCPP_TEMPLATE_VIS is_swappable
- : public __conditional_t<__libcpp_is_referenceable<_Tp>::value,
- is_swappable_with<__add_lvalue_reference_t<_Tp>, __add_lvalue_reference_t<_Tp> >,
- false_type> {};
+struct _LIBCPP_TEMPLATE_VIS is_swappable : bool_constant<is_swappable_v<_Tp>> {};
template <class _Tp, class _Up>
-struct _LIBCPP_TEMPLATE_VIS is_nothrow_swappable_with
- : public integral_constant<bool, __detail::__nothrow_swappable_with<_Tp, _Up>::value> {};
-
-template <class _Tp>
-struct _LIBCPP_TEMPLATE_VIS is_nothrow_swappable
- : public __conditional_t<__libcpp_is_referenceable<_Tp>::value,
- is_nothrow_swappable_with<__add_lvalue_reference_t<_Tp>, __add_lvalue_reference_t<_Tp> >,
- false_type> {};
+inline constexpr bool is_nothrow_swappable_with_v = __is_nothrow_swappable_with_v<_Tp, _Up>;
template <class _Tp, class _Up>
-inline constexpr bool is_swappable_with_v = is_swappable_with<_Tp, _Up>::value;
+struct _LIBCPP_TEMPLATE_VIS is_nothrow_swappable_with : bool_constant<is_nothrow_swappable_with_v<_Tp, _Up>> {};
template <class _Tp>
-inline constexpr bool is_swappable_v = is_swappable<_Tp>::value;
-
-template <class _Tp, class _Up>
-inline constexpr bool is_nothrow_swappable_with_v = is_nothrow_swappable_with<_Tp, _Up>::value;
+inline constexpr bool is_nothrow_swappable_v =
+ is_nothrow_swappable_with_v<__add_lvalue_reference_t<_Tp>, __add_lvalue_reference_t<_Tp>>;
template <class _Tp>
-inline constexpr bool is_nothrow_swappable_v = is_nothrow_swappable<_Tp>::value;
+struct _LIBCPP_TEMPLATE_VIS is_nothrow_swappable : bool_constant<is_nothrow_swappable_v<_Tp>> {};
#endif // _LIBCPP_STD_VER >= 17
diff --git a/libcxx/include/__utility/exception_guard.h b/libcxx/include/__utility/exception_guard.h
index 93290be40e71..9f732ca265c8 100644
--- a/libcxx/include/__utility/exception_guard.h
+++ b/libcxx/include/__utility/exception_guard.h
@@ -96,8 +96,8 @@ _LIBCPP_CTAD_SUPPORTED_FOR_TYPE(__exception_guard_exceptions);
template <class _Rollback>
struct __exception_guard_noexceptions {
__exception_guard_noexceptions() = delete;
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
- _LIBCPP_NODEBUG explicit __exception_guard_noexceptions(_Rollback) {}
+ _LIBCPP_HIDE_FROM_ABI
+ _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_NODEBUG explicit __exception_guard_noexceptions(_Rollback) {}
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_NODEBUG
__exception_guard_noexceptions(__exception_guard_noexceptions&& __other)
diff --git a/libcxx/include/__utility/forward_like.h b/libcxx/include/__utility/forward_like.h
index ce11b640fc42..0206ce23a566 100644
--- a/libcxx/include/__utility/forward_like.h
+++ b/libcxx/include/__utility/forward_like.h
@@ -34,8 +34,8 @@ template <class _Ap, class _Bp>
using _ForwardLike = _OverrideRef<_Ap&&, _CopyConst<remove_reference_t<_Ap>, remove_reference_t<_Bp>>>;
template <class _Tp, class _Up>
-[[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto forward_like(_LIBCPP_LIFETIMEBOUND _Up&& __ux) noexcept
- -> _ForwardLike<_Tp, _Up> {
+[[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto
+forward_like(_LIBCPP_LIFETIMEBOUND _Up&& __ux) noexcept -> _ForwardLike<_Tp, _Up> {
return static_cast<_ForwardLike<_Tp, _Up>>(__ux);
}
diff --git a/libcxx/include/__utility/is_pointer_in_range.h b/libcxx/include/__utility/is_pointer_in_range.h
index 9eee8bf811c6..4130b4ac7070 100644
--- a/libcxx/include/__utility/is_pointer_in_range.h
+++ b/libcxx/include/__utility/is_pointer_in_range.h
@@ -33,8 +33,8 @@ struct __is_less_than_comparable<_Tp, _Up, __void_t<decltype(std::declval<_Tp>()
};
template <class _Tp, class _Up, __enable_if_t<__is_less_than_comparable<const _Tp*, const _Up*>::value, int> = 0>
-_LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI _LIBCPP_NO_SANITIZE("address") bool __is_pointer_in_range(
- const _Tp* __begin, const _Tp* __end, const _Up* __ptr) {
+_LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI _LIBCPP_NO_SANITIZE("address") bool
+__is_pointer_in_range(const _Tp* __begin, const _Tp* __end, const _Up* __ptr) {
_LIBCPP_ASSERT_VALID_INPUT_RANGE(std::__is_valid_range(__begin, __end), "[__begin, __end) is not a valid range");
if (__libcpp_is_constant_evaluated()) {
@@ -48,8 +48,8 @@ _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI _LIBCPP_NO_SANITIZE("address
}
template <class _Tp, class _Up, __enable_if_t<!__is_less_than_comparable<const _Tp*, const _Up*>::value, int> = 0>
-_LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI _LIBCPP_NO_SANITIZE("address") bool __is_pointer_in_range(
- const _Tp* __begin, const _Tp* __end, const _Up* __ptr) {
+_LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI _LIBCPP_NO_SANITIZE("address") bool
+__is_pointer_in_range(const _Tp* __begin, const _Tp* __end, const _Up* __ptr) {
if (__libcpp_is_constant_evaluated())
return false;
diff --git a/libcxx/include/__utility/pair.h b/libcxx/include/__utility/pair.h
index 3ffab2f7fe4f..1b0d9241886f 100644
--- a/libcxx/include/__utility/pair.h
+++ b/libcxx/include/__utility/pair.h
@@ -16,8 +16,6 @@
#include <__fwd/array.h>
#include <__fwd/pair.h>
#include <__fwd/tuple.h>
-#include <__tuple/sfinae_helpers.h>
-#include <__tuple/tuple_element.h>
#include <__tuple/tuple_indices.h>
#include <__tuple/tuple_like_no_subrange.h>
#include <__tuple/tuple_size.h>
@@ -34,6 +32,7 @@
#include <__type_traits/is_nothrow_constructible.h>
#include <__type_traits/is_same.h>
#include <__type_traits/is_swappable.h>
+#include <__type_traits/is_trivially_relocatable.h>
#include <__type_traits/nat.h>
#include <__type_traits/remove_cvref.h>
#include <__type_traits/unwrap_ref.h>
@@ -71,6 +70,11 @@ struct _LIBCPP_TEMPLATE_VIS pair
_T1 first;
_T2 second;
+ using __trivially_relocatable =
+ __conditional_t<__libcpp_is_trivially_relocatable<_T1>::value && __libcpp_is_trivially_relocatable<_T2>::value,
+ pair,
+ void>;
+
_LIBCPP_HIDE_FROM_ABI pair(pair const&) = default;
_LIBCPP_HIDE_FROM_ABI pair(pair&&) = default;
@@ -124,21 +128,17 @@ struct _LIBCPP_TEMPLATE_VIS pair
}
};
- template <bool _MaybeEnable>
- using _CheckArgsDep _LIBCPP_NODEBUG =
- typename conditional< _MaybeEnable, _CheckArgs, __check_tuple_constructor_fail>::type;
-
- template <bool _Dummy = true, __enable_if_t<_CheckArgsDep<_Dummy>::__enable_default(), int> = 0>
- explicit(!_CheckArgsDep<_Dummy>::__enable_implicit_default()) _LIBCPP_HIDE_FROM_ABI
- _LIBCPP_CONSTEXPR pair() _NOEXCEPT_(
- is_nothrow_default_constructible<first_type>::value&& is_nothrow_default_constructible<second_type>::value)
+ template <bool _Dummy = true, __enable_if_t<_Dummy && _CheckArgs::__enable_default(), int> = 0>
+ explicit(!_CheckArgs::__enable_implicit_default()) _LIBCPP_HIDE_FROM_ABI constexpr pair() noexcept(
+ is_nothrow_default_constructible<first_type>::value && is_nothrow_default_constructible<second_type>::value)
: first(), second() {}
- template <bool _Dummy = true,
- __enable_if_t<_CheckArgsDep<_Dummy>::template __is_pair_constructible<_T1 const&, _T2 const&>(), int> = 0>
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 explicit(
- !_CheckArgsDep<_Dummy>::template __is_implicit<_T1 const&, _T2 const&>()) pair(_T1 const& __t1, _T2 const& __t2)
- _NOEXCEPT_(is_nothrow_copy_constructible<first_type>::value&& is_nothrow_copy_constructible<second_type>::value)
+ template <bool _Dummy = true,
+ __enable_if_t<_Dummy && _CheckArgs::template __is_pair_constructible<_T1 const&, _T2 const&>(), int> = 0>
+ _LIBCPP_HIDE_FROM_ABI
+ _LIBCPP_CONSTEXPR_SINCE_CXX14 explicit(!_CheckArgs::template __is_implicit<_T1 const&, _T2 const&>())
+ pair(_T1 const& __t1, _T2 const& __t2) noexcept(is_nothrow_copy_constructible<first_type>::value &&
+ is_nothrow_copy_constructible<second_type>::value)
: first(__t1), second(__t2) {}
template <
@@ -150,10 +150,9 @@ struct _LIBCPP_TEMPLATE_VIS pair
class _U2,
# endif
__enable_if_t<_CheckArgs::template __is_pair_constructible<_U1, _U2>(), int> = 0 >
- _LIBCPP_HIDE_FROM_ABI
- _LIBCPP_CONSTEXPR_SINCE_CXX14 explicit(!_CheckArgs::template __is_implicit<_U1, _U2>()) pair(_U1&& __u1, _U2&& __u2)
- _NOEXCEPT_((is_nothrow_constructible<first_type, _U1>::value &&
- is_nothrow_constructible<second_type, _U2>::value))
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 explicit(!_CheckArgs::template __is_implicit<_U1, _U2>())
+ pair(_U1&& __u1, _U2&& __u2) noexcept(is_nothrow_constructible<first_type, _U1>::value &&
+ is_nothrow_constructible<second_type, _U2>::value)
: first(std::forward<_U1>(__u1)), second(std::forward<_U2>(__u2)) {
}
@@ -170,16 +169,14 @@ struct _LIBCPP_TEMPLATE_VIS pair
__enable_if_t<_CheckArgs::template __is_pair_constructible<_U1 const&, _U2 const&>(), int> = 0>
_LIBCPP_HIDE_FROM_ABI
_LIBCPP_CONSTEXPR_SINCE_CXX14 explicit(!_CheckArgs::template __is_implicit<_U1 const&, _U2 const&>())
- pair(pair<_U1, _U2> const& __p)
- _NOEXCEPT_((is_nothrow_constructible<first_type, _U1 const&>::value &&
- is_nothrow_constructible<second_type, _U2 const&>::value))
+ pair(pair<_U1, _U2> const& __p) noexcept(is_nothrow_constructible<first_type, _U1 const&>::value &&
+ is_nothrow_constructible<second_type, _U2 const&>::value)
: first(__p.first), second(__p.second) {}
template <class _U1, class _U2, __enable_if_t<_CheckArgs::template __is_pair_constructible<_U1, _U2>(), int> = 0>
- _LIBCPP_HIDE_FROM_ABI
- _LIBCPP_CONSTEXPR_SINCE_CXX14 explicit(!_CheckArgs::template __is_implicit<_U1, _U2>()) pair(pair<_U1, _U2>&& __p)
- _NOEXCEPT_((is_nothrow_constructible<first_type, _U1&&>::value &&
- is_nothrow_constructible<second_type, _U2&&>::value))
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 explicit(!_CheckArgs::template __is_implicit<_U1, _U2>())
+ pair(pair<_U1, _U2>&& __p) noexcept(is_nothrow_constructible<first_type, _U1&&>::value &&
+ is_nothrow_constructible<second_type, _U2&&>::value)
: first(std::forward<_U1>(__p.first)), second(std::forward<_U2>(__p.second)) {}
# if _LIBCPP_STD_VER >= 23
@@ -213,8 +210,8 @@ struct _LIBCPP_TEMPLATE_VIS pair
template <class... _Args1, class... _Args2>
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
- pair(piecewise_construct_t __pc, tuple<_Args1...> __first_args, tuple<_Args2...> __second_args) _NOEXCEPT_(
- is_nothrow_constructible<first_type, _Args1...>::value&& is_nothrow_constructible<second_type, _Args2...>::value)
+ pair(piecewise_construct_t __pc, tuple<_Args1...> __first_args, tuple<_Args2...> __second_args) noexcept(
+ is_nothrow_constructible<first_type, _Args1...>::value && is_nothrow_constructible<second_type, _Args2...>::value)
: pair(__pc,
__first_args,
__second_args,
@@ -222,19 +219,19 @@ struct _LIBCPP_TEMPLATE_VIS pair
typename __make_tuple_indices<sizeof...(_Args2) >::type()) {}
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 pair&
- operator=(__conditional_t< is_copy_assignable<first_type>::value && is_copy_assignable<second_type>::value,
- pair,
- __nat> const& __p)
- _NOEXCEPT_(is_nothrow_copy_assignable<first_type>::value&& is_nothrow_copy_assignable<second_type>::value) {
+ operator=(__conditional_t<is_copy_assignable<first_type>::value && is_copy_assignable<second_type>::value,
+ pair,
+ __nat> const& __p) noexcept(is_nothrow_copy_assignable<first_type>::value &&
+ is_nothrow_copy_assignable<second_type>::value) {
first = __p.first;
second = __p.second;
return *this;
}
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 pair& operator=(
- __conditional_t< is_move_assignable<first_type>::value && is_move_assignable<second_type>::value, pair, __nat>&&
- __p)
- _NOEXCEPT_(is_nothrow_move_assignable<first_type>::value&& is_nothrow_move_assignable<second_type>::value) {
+ __conditional_t<is_move_assignable<first_type>::value && is_move_assignable<second_type>::value, pair, __nat>&&
+ __p) noexcept(is_nothrow_move_assignable<first_type>::value &&
+ is_nothrow_move_assignable<second_type>::value) {
first = std::forward<first_type>(__p.first);
second = std::forward<second_type>(__p.second);
return *this;
@@ -261,6 +258,7 @@ struct _LIBCPP_TEMPLATE_VIS pair
}
# if _LIBCPP_STD_VER >= 23
+ template <class = void>
_LIBCPP_HIDE_FROM_ABI constexpr const pair& operator=(pair const& __p) const
noexcept(is_nothrow_copy_assignable_v<const first_type> && is_nothrow_copy_assignable_v<const second_type>)
requires(is_copy_assignable_v<const first_type> && is_copy_assignable_v<const second_type>)
@@ -270,6 +268,7 @@ struct _LIBCPP_TEMPLATE_VIS pair
return *this;
}
+ template <class = void>
_LIBCPP_HIDE_FROM_ABI constexpr const pair& operator=(pair&& __p) const
noexcept(is_nothrow_assignable_v<const first_type&, first_type> &&
is_nothrow_assignable_v<const second_type&, second_type>)
@@ -409,7 +408,7 @@ struct _LIBCPP_TEMPLATE_VIS pair
#endif // _LIBCPP_CXX03_LANG
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void swap(pair& __p)
- _NOEXCEPT_(__is_nothrow_swappable<first_type>::value&& __is_nothrow_swappable<second_type>::value) {
+ _NOEXCEPT_(__is_nothrow_swappable_v<first_type>&& __is_nothrow_swappable_v<second_type>) {
using std::swap;
swap(first, __p.first);
swap(second, __p.second);
@@ -417,7 +416,7 @@ struct _LIBCPP_TEMPLATE_VIS pair
#if _LIBCPP_STD_VER >= 23
_LIBCPP_HIDE_FROM_ABI constexpr void swap(const pair& __p) const
- noexcept(__is_nothrow_swappable<const first_type>::value && __is_nothrow_swappable<const second_type>::value) {
+ noexcept(__is_nothrow_swappable_v<const first_type> && __is_nothrow_swappable_v<const second_type>) {
using std::swap;
swap(first, __p.first);
swap(second, __p.second);
@@ -513,15 +512,15 @@ struct common_type<pair<_T1, _T2>, pair<_U1, _U2>> {
};
#endif // _LIBCPP_STD_VER >= 23
-template <class _T1, class _T2, __enable_if_t<__is_swappable<_T1>::value && __is_swappable<_T2>::value, int> = 0>
+template <class _T1, class _T2, __enable_if_t<__is_swappable_v<_T1> && __is_swappable_v<_T2>, int> = 0>
inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void swap(pair<_T1, _T2>& __x, pair<_T1, _T2>& __y)
- _NOEXCEPT_(__is_nothrow_swappable<_T1>::value&& __is_nothrow_swappable<_T2>::value) {
+ _NOEXCEPT_(__is_nothrow_swappable_v<_T1>&& __is_nothrow_swappable_v<_T2>) {
__x.swap(__y);
}
#if _LIBCPP_STD_VER >= 23
template <class _T1, class _T2>
- requires(__is_swappable<const _T1>::value && __is_swappable<const _T2>::value)
+ requires(__is_swappable_v<const _T1> && __is_swappable_v<const _T2>)
_LIBCPP_HIDE_FROM_ABI constexpr void
swap(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y) noexcept(noexcept(__x.swap(__y))) {
__x.swap(__y);
diff --git a/libcxx/include/__utility/swap.h b/libcxx/include/__utility/swap.h
index d678d2cba7dc..ab88b8e0a0b5 100644
--- a/libcxx/include/__utility/swap.h
+++ b/libcxx/include/__utility/swap.h
@@ -44,9 +44,9 @@ inline _LIBCPP_HIDE_FROM_ABI __swap_result_t<_Tp> _LIBCPP_CONSTEXPR_SINCE_CXX20
__y = std::move(__t);
}
-template <class _Tp, size_t _Np, __enable_if_t<__is_swappable<_Tp>::value, int> >
+template <class _Tp, size_t _Np, __enable_if_t<__is_swappable_v<_Tp>, int> >
inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void swap(_Tp (&__a)[_Np], _Tp (&__b)[_Np])
- _NOEXCEPT_(__is_nothrow_swappable<_Tp>::value) {
+ _NOEXCEPT_(__is_nothrow_swappable_v<_Tp>) {
for (size_t __i = 0; __i != _Np; ++__i) {
swap(__a[__i], __b[__i]);
}
diff --git a/libcxx/include/__verbose_abort b/libcxx/include/__verbose_abort
index 1e2265a6bf75..195ce65b721f 100644
--- a/libcxx/include/__verbose_abort
+++ b/libcxx/include/__verbose_abort
@@ -21,7 +21,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD
// This function should never be called directly from the code -- it should only be called through
// the _LIBCPP_VERBOSE_ABORT macro.
_LIBCPP_NORETURN _LIBCPP_AVAILABILITY_VERBOSE_ABORT _LIBCPP_OVERRIDABLE_FUNC_VIS
- _LIBCPP_ATTRIBUTE_FORMAT(__printf__, 1, 2) void __libcpp_verbose_abort(const char* __format, ...);
+_LIBCPP_ATTRIBUTE_FORMAT(__printf__, 1, 2) void __libcpp_verbose_abort(const char* __format, ...);
// _LIBCPP_VERBOSE_ABORT(format, args...)
//
diff --git a/libcxx/include/any b/libcxx/include/any
index 0e66890593c3..5def14dc87e6 100644
--- a/libcxx/include/any
+++ b/libcxx/include/any
@@ -205,7 +205,7 @@ public:
template < class _ValueType,
class _Tp = decay_t<_ValueType>,
class = enable_if_t< !is_same<_Tp, any>::value && !__is_inplace_type<_ValueType>::value &&
- is_copy_constructible<_Tp>::value> >
+ is_copy_constructible<_Tp>::value> >
_LIBCPP_HIDE_FROM_ABI any(_ValueType&& __value);
template <class _ValueType,
@@ -219,7 +219,7 @@ public:
class... _Args,
class _Tp = decay_t<_ValueType>,
class = enable_if_t< is_constructible<_Tp, initializer_list<_Up>&, _Args...>::value &&
- is_copy_constructible<_Tp>::value> >
+ is_copy_constructible<_Tp>::value> >
_LIBCPP_HIDE_FROM_ABI explicit any(in_place_type_t<_ValueType>, initializer_list<_Up>, _Args&&... __args);
_LIBCPP_HIDE_FROM_ABI ~any() { this->reset(); }
@@ -251,7 +251,7 @@ public:
class... _Args,
class _Tp = decay_t<_ValueType>,
class = enable_if_t< is_constructible<_Tp, initializer_list<_Up>&, _Args...>::value &&
- is_copy_constructible<_Tp>::value> >
+ is_copy_constructible<_Tp>::value> >
_LIBCPP_HIDE_FROM_ABI _Tp& emplace(initializer_list<_Up>, _Args&&...);
// 6.3.3 any modifiers
diff --git a/libcxx/include/array b/libcxx/include/array
index 6ea094deec32..accfe15533e9 100644
--- a/libcxx/include/array
+++ b/libcxx/include/array
@@ -130,6 +130,7 @@ template <size_t I, class T, size_t N> const T&& get(const array<T, N>&&) noexce
#include <__type_traits/is_nothrow_constructible.h>
#include <__type_traits/is_same.h>
#include <__type_traits/is_swappable.h>
+#include <__type_traits/is_trivially_relocatable.h>
#include <__type_traits/remove_cv.h>
#include <__utility/empty.h>
#include <__utility/integer_sequence.h>
@@ -166,6 +167,8 @@ _LIBCPP_BEGIN_NAMESPACE_STD
template <class _Tp, size_t _Size>
struct _LIBCPP_TEMPLATE_VIS array {
+ using __trivially_relocatable = __conditional_t<__libcpp_is_trivially_relocatable<_Tp>::value, array, void>;
+
// types:
using __self = array;
using value_type = _Tp;
@@ -192,8 +195,7 @@ struct _LIBCPP_TEMPLATE_VIS array {
std::fill_n(data(), _Size, __u);
}
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void swap(array& __a)
- _NOEXCEPT_(__is_nothrow_swappable<_Tp>::value) {
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void swap(array& __a) _NOEXCEPT_(__is_nothrow_swappable_v<_Tp>) {
std::swap_ranges(data(), data() + _Size, __a.data());
}
@@ -230,9 +232,7 @@ struct _LIBCPP_TEMPLATE_VIS array {
// capacity:
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR size_type size() const _NOEXCEPT { return _Size; }
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR size_type max_size() const _NOEXCEPT { return _Size; }
- _LIBCPP_NODISCARD _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR bool empty() const _NOEXCEPT {
- return _Size == 0;
- }
+ _LIBCPP_NODISCARD _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR bool empty() const _NOEXCEPT { return _Size == 0; }
// element access:
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 reference operator[](size_type __n) _NOEXCEPT {
@@ -428,7 +428,7 @@ operator<=>(const array<_Tp, _Size>& __x, const array<_Tp, _Size>& __y) {
#endif // _LIBCPP_STD_VER <= 17
-template <class _Tp, size_t _Size, __enable_if_t<_Size == 0 || __is_swappable<_Tp>::value, int> = 0>
+template <class _Tp, size_t _Size, __enable_if_t<_Size == 0 || __is_swappable_v<_Tp>, int> = 0>
inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void swap(array<_Tp, _Size>& __x, array<_Tp, _Size>& __y)
_NOEXCEPT_(noexcept(__x.swap(__y))) {
__x.swap(__y);
diff --git a/libcxx/include/barrier b/libcxx/include/barrier
index bce67bb5d342..12608e17d8f6 100644
--- a/libcxx/include/barrier
+++ b/libcxx/include/barrier
@@ -102,10 +102,10 @@ _LIBCPP_AVAILABILITY_SYNC _LIBCPP_EXPORTED_FROM_ABI __barrier_algorithm_base*
__construct_barrier_algorithm_base(ptrdiff_t& __expected);
_LIBCPP_AVAILABILITY_SYNC _LIBCPP_EXPORTED_FROM_ABI bool
-__arrive_barrier_algorithm_base(__barrier_algorithm_base* __barrier, __barrier_phase_t __old_phase);
+__arrive_barrier_algorithm_base(__barrier_algorithm_base* __barrier, __barrier_phase_t __old_phase) noexcept;
_LIBCPP_AVAILABILITY_SYNC _LIBCPP_EXPORTED_FROM_ABI void
-__destroy_barrier_algorithm_base(__barrier_algorithm_base* __barrier);
+__destroy_barrier_algorithm_base(__barrier_algorithm_base* __barrier) noexcept;
template <class _CompletionF>
class __barrier_base {
@@ -264,8 +264,8 @@ public:
static _LIBCPP_HIDE_FROM_ABI constexpr ptrdiff_t max() noexcept { return __barrier_base<_CompletionF>::max(); }
- _LIBCPP_AVAILABILITY_SYNC _LIBCPP_HIDE_FROM_ABI explicit barrier(
- ptrdiff_t __count, _CompletionF __completion = _CompletionF())
+ _LIBCPP_AVAILABILITY_SYNC
+ _LIBCPP_HIDE_FROM_ABI explicit barrier(ptrdiff_t __count, _CompletionF __completion = _CompletionF())
: __b_(__count, std::move(__completion)) {
_LIBCPP_ASSERT_ARGUMENT_WITHIN_DOMAIN(
__count >= 0,
diff --git a/libcxx/include/chrono b/libcxx/include/chrono
index 4d8398af1a10..c66771ffbad1 100644
--- a/libcxx/include/chrono
+++ b/libcxx/include/chrono
@@ -724,6 +724,10 @@ const time_zone* current_zone()
const tzdb& reload_tzdb(); // C++20
string remote_version(); // C++20
+// [time.zone.exception], exception classes
+class nonexistent_local_time; // C++20
+class ambiguous_local_time; // C++20
+
// [time.zone.info], information classes
struct sys_info { // C++20
sys_seconds begin;
@@ -766,10 +770,25 @@ class time_zone {
template<class Duration>
local_info get_info(const local_time<Duration>& tp) const;
+
+ template<class Duration>
+ sys_time<common_type_t<Duration, seconds>>
+ to_sys(const local_time<Duration>& tp) const;
+
+ template<class Duration>
+ sys_time<common_type_t<Duration, seconds>>
+ to_sys(const local_time<Duration>& tp, choose z) const;
+
+ template<class Duration>
+ local_time<common_type_t<Duration, seconds>>
+ to_local(const sys_time<Duration>& tp) const;
};
bool operator==(const time_zone& x, const time_zone& y) noexcept; // C++20
strong_ordering operator<=>(const time_zone& x, const time_zone& y) noexcept; // C++20
+// [time.zone.zonedtraits], class template zoned_traits
+template<class T> struct zoned_traits; // C++20
+
// [time.zone.leap], leap second support
class leap_second { // C++20
public:
@@ -915,6 +934,7 @@ constexpr chrono::year operator ""y(unsigned lo
#if _LIBCPP_STD_VER >= 20
# include <__chrono/calendar.h>
# include <__chrono/day.h>
+# include <__chrono/exception.h>
# include <__chrono/hh_mm_ss.h>
# include <__chrono/literals.h>
# include <__chrono/local_info.h>
@@ -942,6 +962,7 @@ constexpr chrono::year operator ""y(unsigned lo
# include <__chrono/time_zone_link.h>
# include <__chrono/tzdb.h>
# include <__chrono/tzdb_list.h>
+# include <__chrono/zoned_time.h>
# endif
#endif
@@ -976,6 +997,7 @@ constexpr chrono::year operator ""y(unsigned lo
#if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER == 20
# include <charconv>
# include <locale>
+# include <ostream>
#endif
#endif // _LIBCPP_CHRONO
diff --git a/libcxx/include/cmath b/libcxx/include/cmath
index dd194bbb5589..6d3e26aa36a3 100644
--- a/libcxx/include/cmath
+++ b/libcxx/include/cmath
@@ -557,13 +557,13 @@ inline _LIBCPP_HIDE_FROM_ABI long double hypot(long double __x, long double __y,
template <class _A1, class _A2, class _A3>
inline _LIBCPP_HIDE_FROM_ABI
- typename enable_if_t< is_arithmetic<_A1>::value && is_arithmetic<_A2>::value && is_arithmetic<_A3>::value,
- __promote<_A1, _A2, _A3> >::type
- hypot(_A1 __lcpp_x, _A2 __lcpp_y, _A3 __lcpp_z) _NOEXCEPT {
+typename enable_if_t< is_arithmetic<_A1>::value && is_arithmetic<_A2>::value && is_arithmetic<_A3>::value,
+ __promote<_A1, _A2, _A3> >::type
+hypot(_A1 __lcpp_x, _A2 __lcpp_y, _A3 __lcpp_z) _NOEXCEPT {
typedef typename __promote<_A1, _A2, _A3>::type __result_type;
- static_assert((!(is_same<_A1, __result_type>::value && is_same<_A2, __result_type>::value &&
- is_same<_A3, __result_type>::value)),
- "");
+ static_assert(
+ !(is_same<_A1, __result_type>::value && is_same<_A2, __result_type>::value && is_same<_A3, __result_type>::value),
+ "");
return std::hypot((__result_type)__lcpp_x, (__result_type)__lcpp_y, (__result_type)__lcpp_z);
}
#endif
@@ -629,7 +629,7 @@ template <class _A1,
_LIBCPP_CONSTEXPR inline _LIBCPP_HIDE_FROM_ABI typename __promote<_A1, _A2>::type
__constexpr_copysign(_A1 __x, _A2 __y) _NOEXCEPT {
typedef typename std::__promote<_A1, _A2>::type __result_type;
- static_assert((!(std::_IsSame<_A1, __result_type>::value && std::_IsSame<_A2, __result_type>::value)), "");
+ static_assert(!(std::_IsSame<_A1, __result_type>::value && std::_IsSame<_A2, __result_type>::value), "");
return __builtin_copysign((__result_type)__x, (__result_type)__y);
}
diff --git a/libcxx/include/codecvt b/libcxx/include/codecvt
index b7182ff47155..65cd752d6946 100644
--- a/libcxx/include/codecvt
+++ b/libcxx/include/codecvt
@@ -433,8 +433,8 @@ protected:
_LIBCPP_SUPPRESS_DEPRECATED_PUSH
template <class _Elem, unsigned long _Maxcode = 0x10ffff, codecvt_mode _Mode = (codecvt_mode)0>
-class _LIBCPP_TEMPLATE_VIS _LIBCPP_DEPRECATED_IN_CXX17 codecvt_utf16
- : public __codecvt_utf16<_Elem, _Mode & little_endian> {
+class _LIBCPP_TEMPLATE_VIS
+_LIBCPP_DEPRECATED_IN_CXX17 codecvt_utf16 : public __codecvt_utf16<_Elem, _Mode & little_endian> {
public:
_LIBCPP_HIDE_FROM_ABI explicit codecvt_utf16(size_t __refs = 0)
: __codecvt_utf16<_Elem, _Mode & little_endian>(__refs, _Maxcode, _Mode) {}
diff --git a/libcxx/include/coroutine b/libcxx/include/coroutine
index d1a44e2e12dd..ee54388ad5aa 100644
--- a/libcxx/include/coroutine
+++ b/libcxx/include/coroutine
@@ -41,10 +41,10 @@ struct suspend_always;
#include <__config>
#if _LIBCPP_STD_VER >= 20
-#include <__coroutine/coroutine_handle.h>
-#include <__coroutine/coroutine_traits.h>
-#include <__coroutine/noop_coroutine_handle.h>
-#include <__coroutine/trivial_awaitables.h>
+# include <__coroutine/coroutine_handle.h>
+# include <__coroutine/coroutine_traits.h>
+# include <__coroutine/noop_coroutine_handle.h>
+# include <__coroutine/trivial_awaitables.h>
#endif // _LIBCPP_STD_VER >= 20
#include <version>
diff --git a/libcxx/include/deque b/libcxx/include/deque
index 8ffd8193b74e..aee4764859dd 100644
--- a/libcxx/include/deque
+++ b/libcxx/include/deque
@@ -214,6 +214,7 @@ template <class T, class Allocator, class Predicate>
#include <__type_traits/is_allocator.h>
#include <__type_traits/is_convertible.h>
#include <__type_traits/is_same.h>
+#include <__type_traits/is_swappable.h>
#include <__type_traits/type_identity.h>
#include <__utility/forward.h>
#include <__utility/move.h>
@@ -448,11 +449,11 @@ public:
using value_type = _Tp;
- static_assert((is_same<typename _Allocator::value_type, value_type>::value),
- "Allocator::value_type must be same type as value_type");
-
using allocator_type = _Allocator;
using __alloc_traits = allocator_traits<allocator_type>;
+ static_assert(__check_valid_allocator<allocator_type>::value, "");
+ static_assert(is_same<typename allocator_type::value_type, value_type>::value,
+ "Allocator::value_type must be same type as value_type");
using size_type = typename __alloc_traits::size_type;
using difference_type = typename __alloc_traits::difference_type;
@@ -477,9 +478,16 @@ public:
using reverse_iterator = std::reverse_iterator<iterator>;
using const_reverse_iterator = std::reverse_iterator<const_iterator>;
- static_assert(is_same<allocator_type, __rebind_alloc<__alloc_traits, value_type> >::value,
- "[allocator.requirements] states that rebinding an allocator to the same type should result in the "
- "original allocator");
+ // A deque contains the following members which may be trivially relocatable:
+ // - __map: is a `__split_buffer`, see `__split_buffer` for more information on when it is trivially relocatable
+ // - size_type: is always trivially relocatable, since it is required to be an integral type
+ // - allocator_type: may not be trivially relocatable, so it's checked
+ // None of these are referencing the `deque` itself, so if all of them are trivially relocatable, `deque` is too.
+ using __trivially_relocatable = __conditional_t<
+ __libcpp_is_trivially_relocatable<__map>::value && __libcpp_is_trivially_relocatable<allocator_type>::value,
+ deque,
+ void>;
+
static_assert(is_nothrow_default_constructible<allocator_type>::value ==
is_nothrow_default_constructible<__pointer_allocator>::value,
"rebinding an allocator should not change exception guarantees");
@@ -621,11 +629,11 @@ public:
return *this;
}
- _LIBCPP_HIDE_FROM_ABI deque(deque&& __c) _NOEXCEPT_(is_nothrow_move_constructible<allocator_type>::value);
+ _LIBCPP_HIDE_FROM_ABI deque(deque&& __c) noexcept(is_nothrow_move_constructible<allocator_type>::value);
_LIBCPP_HIDE_FROM_ABI deque(deque&& __c, const __type_identity_t<allocator_type>& __a);
- _LIBCPP_HIDE_FROM_ABI deque& operator=(deque&& __c)
- _NOEXCEPT_(__alloc_traits::propagate_on_container_move_assignment::value&&
- is_nothrow_move_assignable<allocator_type>::value);
+ _LIBCPP_HIDE_FROM_ABI deque&
+ operator=(deque&& __c) noexcept(__alloc_traits::propagate_on_container_move_assignment::value &&
+ is_nothrow_move_assignable<allocator_type>::value);
_LIBCPP_HIDE_FROM_ABI void assign(initializer_list<value_type> __il) { assign(__il.begin(), __il.end()); }
#endif // _LIBCPP_CXX03_LANG
@@ -794,7 +802,7 @@ public:
#if _LIBCPP_STD_VER >= 14
_NOEXCEPT;
#else
- _NOEXCEPT_(!__alloc_traits::propagate_on_container_swap::value || __is_nothrow_swappable<allocator_type>::value);
+ _NOEXCEPT_(!__alloc_traits::propagate_on_container_swap::value || __is_nothrow_swappable_v<allocator_type>);
#endif
_LIBCPP_HIDE_FROM_ABI void clear() _NOEXCEPT;
@@ -1298,7 +1306,7 @@ deque<_Tp, _Allocator>::deque(initializer_list<value_type> __il, const allocator
}
template <class _Tp, class _Allocator>
-inline deque<_Tp, _Allocator>::deque(deque&& __c) _NOEXCEPT_(is_nothrow_move_constructible<allocator_type>::value)
+inline deque<_Tp, _Allocator>::deque(deque&& __c) noexcept(is_nothrow_move_constructible<allocator_type>::value)
: __map_(std::move(__c.__map_)), __start_(std::move(__c.__start_)), __size_(std::move(__c.__size_)) {
__c.__start_ = 0;
__c.__size() = 0;
@@ -1322,8 +1330,9 @@ inline deque<_Tp, _Allocator>::deque(deque&& __c, const __type_identity_t<alloca
}
template <class _Tp, class _Allocator>
-inline deque<_Tp, _Allocator>& deque<_Tp, _Allocator>::operator=(deque&& __c) _NOEXCEPT_(
- __alloc_traits::propagate_on_container_move_assignment::value&& is_nothrow_move_assignable<allocator_type>::value) {
+inline deque<_Tp, _Allocator>& deque<_Tp, _Allocator>::operator=(deque&& __c) noexcept(
+ __alloc_traits::propagate_on_container_move_assignment::value &&
+ is_nothrow_move_assignable<allocator_type>::value) {
__move_assign(__c, integral_constant<bool, __alloc_traits::propagate_on_container_move_assignment::value>());
return *this;
}
@@ -1338,8 +1347,8 @@ void deque<_Tp, _Allocator>::__move_assign(deque& __c, false_type) {
}
template <class _Tp, class _Allocator>
-void deque<_Tp, _Allocator>::__move_assign(deque& __c, true_type)
- _NOEXCEPT_(is_nothrow_move_assignable<allocator_type>::value) {
+void deque<_Tp, _Allocator>::__move_assign(deque& __c,
+ true_type) noexcept(is_nothrow_move_assignable<allocator_type>::value) {
clear();
shrink_to_fit();
__move_assign(__c);
@@ -2452,7 +2461,7 @@ inline void deque<_Tp, _Allocator>::swap(deque& __c)
#if _LIBCPP_STD_VER >= 14
_NOEXCEPT
#else
- _NOEXCEPT_(!__alloc_traits::propagate_on_container_swap::value || __is_nothrow_swappable<allocator_type>::value)
+ _NOEXCEPT_(!__alloc_traits::propagate_on_container_swap::value || __is_nothrow_swappable_v<allocator_type>)
#endif
{
__map_.swap(__c.__map_);
diff --git a/libcxx/include/experimental/__simd/reference.h b/libcxx/include/experimental/__simd/reference.h
index 7efbba96ec71..af61dbcc2fe9 100644
--- a/libcxx/include/experimental/__simd/reference.h
+++ b/libcxx/include/experimental/__simd/reference.h
@@ -13,10 +13,14 @@
#include <__type_traits/is_assignable.h>
#include <__type_traits/is_same.h>
#include <__utility/forward.h>
+#include <__utility/move.h>
#include <cstddef>
#include <experimental/__config>
#include <experimental/__simd/utility.h>
+_LIBCPP_PUSH_MACROS
+#include <__undef_macros>
+
#if _LIBCPP_STD_VER >= 17 && defined(_LIBCPP_ENABLE_EXPERIMENTAL)
_LIBCPP_BEGIN_NAMESPACE_EXPERIMENTAL
@@ -55,10 +59,47 @@ public:
__set(static_cast<value_type>(std::forward<_Up>(__v)));
return {__s_, __idx_};
}
+
+ // Note: This approach might not fully align with the specification,
+ // which might be a wording defect. (https://wg21.link/N4808 section 9.6.3)
+ template <class _Tp1, class _Storage1, class _Vp1>
+ friend void
+ swap(__simd_reference<_Tp1, _Storage1, _Vp1>&& __a, __simd_reference<_Tp1, _Storage1, _Vp1>&& __b) noexcept;
+
+ template <class _Tp1, class _Storage1, class _Vp1>
+ friend void swap(_Vp1& __a, __simd_reference<_Tp1, _Storage1, _Vp1>&& __b) noexcept;
+
+ template <class _Tp1, class _Storage1, class _Vp1>
+ friend void swap(__simd_reference<_Tp1, _Storage1, _Vp1>&& __a, _Vp1& __b) noexcept;
};
+template <class _Tp, class _Storage, class _Vp>
+_LIBCPP_HIDE_FROM_ABI void
+swap(__simd_reference<_Tp, _Storage, _Vp>&& __a, __simd_reference<_Tp, _Storage, _Vp>&& __b) noexcept {
+ _Vp __tmp(std::move(__a));
+ std::move(__a) = std::move(__b);
+ std::move(__b) = std::move(__tmp);
+}
+
+template <class _Tp, class _Storage, class _Vp>
+_LIBCPP_HIDE_FROM_ABI void swap(_Vp& __a, __simd_reference<_Tp, _Storage, _Vp>&& __b) noexcept {
+ _Vp __tmp(std::move(__a));
+ __a = std::move(__b);
+ std::move(__b) = std::move(__tmp);
+}
+
+template <class _Tp, class _Storage, class _Vp>
+_LIBCPP_HIDE_FROM_ABI void swap(__simd_reference<_Tp, _Storage, _Vp>&& __a, _Vp& __b) noexcept {
+ _Vp __tmp(std::move(__a));
+ std::move(__a) = std::move(__b);
+ __b = std::move(__tmp);
+}
+
} // namespace parallelism_v2
_LIBCPP_END_NAMESPACE_EXPERIMENTAL
#endif // _LIBCPP_STD_VER >= 17 && defined(_LIBCPP_ENABLE_EXPERIMENTAL)
+
+_LIBCPP_POP_MACROS
+
#endif // _LIBCPP_EXPERIMENTAL___SIMD_REFERENCE_H
diff --git a/libcxx/include/experimental/propagate_const b/libcxx/include/experimental/propagate_const
index 43648015fe80..d7a695d83889 100644
--- a/libcxx/include/experimental/propagate_const
+++ b/libcxx/include/experimental/propagate_const
@@ -145,10 +145,10 @@ template <class _Tp>
class propagate_const;
template <class _Up>
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR const _Up& get_underlying(const propagate_const<_Up>& __pu) _NOEXCEPT;
+inline _LIBCPP_HIDE_FROM_ABI constexpr const _Up& get_underlying(const propagate_const<_Up>& __pu) _NOEXCEPT;
template <class _Up>
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR _Up& get_underlying(propagate_const<_Up>& __pu) _NOEXCEPT;
+inline _LIBCPP_HIDE_FROM_ABI constexpr _Up& get_underlying(propagate_const<_Up>& __pu) _NOEXCEPT;
template <class _Tp>
class propagate_const {
@@ -164,22 +164,22 @@ public:
private:
template <class _Up>
- static _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR element_type* __get_pointer(_Up* __u) {
+ static _LIBCPP_HIDE_FROM_ABI constexpr element_type* __get_pointer(_Up* __u) {
return __u;
}
template <class _Up>
- static _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR element_type* __get_pointer(_Up& __u) {
+ static _LIBCPP_HIDE_FROM_ABI constexpr element_type* __get_pointer(_Up& __u) {
return __get_pointer(__u.get());
}
template <class _Up>
- static _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR const element_type* __get_pointer(const _Up* __u) {
+ static _LIBCPP_HIDE_FROM_ABI constexpr const element_type* __get_pointer(const _Up* __u) {
return __u;
}
template <class _Up>
- static _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR const element_type* __get_pointer(const _Up& __u) {
+ static _LIBCPP_HIDE_FROM_ABI constexpr const element_type* __get_pointer(const _Up& __u) {
return __get_pointer(__u.get());
}
@@ -193,215 +193,207 @@ private:
public:
template <class _Up>
- friend _LIBCPP_CONSTEXPR const _Up&
- experimental::fundamentals_v2::get_underlying(const propagate_const<_Up>& __pu) _NOEXCEPT;
+ friend constexpr const _Up& experimental::fundamentals_v2::get_underlying(const propagate_const<_Up>& __pu) _NOEXCEPT;
template <class _Up>
- friend _LIBCPP_CONSTEXPR _Up& experimental::fundamentals_v2::get_underlying(propagate_const<_Up>& __pu) _NOEXCEPT;
+ friend constexpr _Up& experimental::fundamentals_v2::get_underlying(propagate_const<_Up>& __pu) _NOEXCEPT;
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR propagate_const() = default;
+ _LIBCPP_HIDE_FROM_ABI constexpr propagate_const() = default;
propagate_const(const propagate_const&) = delete;
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR propagate_const(propagate_const&&) = default;
+ _LIBCPP_HIDE_FROM_ABI constexpr propagate_const(propagate_const&&) = default;
template <class _Up,
enable_if_t<!is_convertible<_Up, _Tp>::value && is_constructible<_Tp, _Up&&>::value, bool> = true>
- explicit _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR propagate_const(propagate_const<_Up>&& __pu)
+ explicit _LIBCPP_HIDE_FROM_ABI constexpr propagate_const(propagate_const<_Up>&& __pu)
: __t_(std::move(experimental::get_underlying(__pu))) {}
template <class _Up,
enable_if_t<is_convertible<_Up&&, _Tp>::value && is_constructible<_Tp, _Up&&>::value, bool> = false>
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR propagate_const(propagate_const<_Up>&& __pu)
+ _LIBCPP_HIDE_FROM_ABI constexpr propagate_const(propagate_const<_Up>&& __pu)
: __t_(std::move(experimental::get_underlying(__pu))) {}
template <class _Up,
enable_if_t<!is_convertible<_Up&&, _Tp>::value && is_constructible<_Tp, _Up&&>::value &&
!__is_propagate_const<decay_t<_Up>>::value,
bool> = true>
- explicit _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR propagate_const(_Up&& __u) : __t_(std::forward<_Up>(__u)) {}
+ explicit _LIBCPP_HIDE_FROM_ABI constexpr propagate_const(_Up&& __u) : __t_(std::forward<_Up>(__u)) {}
template <class _Up,
enable_if_t<is_convertible<_Up&&, _Tp>::value && is_constructible<_Tp, _Up&&>::value &&
!__is_propagate_const<decay_t<_Up>>::value,
bool> = false>
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR propagate_const(_Up&& __u) : __t_(std::forward<_Up>(__u)) {}
+ _LIBCPP_HIDE_FROM_ABI constexpr propagate_const(_Up&& __u) : __t_(std::forward<_Up>(__u)) {}
propagate_const& operator=(const propagate_const&) = delete;
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR propagate_const& operator=(propagate_const&&) = default;
+ _LIBCPP_HIDE_FROM_ABI constexpr propagate_const& operator=(propagate_const&&) = default;
template <class _Up>
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR propagate_const& operator=(propagate_const<_Up>&& __pu) {
+ _LIBCPP_HIDE_FROM_ABI constexpr propagate_const& operator=(propagate_const<_Up>&& __pu) {
__t_ = std::move(experimental::get_underlying(__pu));
return *this;
}
template <class _Up, class _Vp = enable_if_t<!__is_propagate_const<decay_t<_Up>>::value>>
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR propagate_const& operator=(_Up&& __u) {
+ _LIBCPP_HIDE_FROM_ABI constexpr propagate_const& operator=(_Up&& __u) {
__t_ = std::forward<_Up>(__u);
return *this;
}
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR const element_type* get() const { return __get_pointer(__t_); }
+ _LIBCPP_HIDE_FROM_ABI constexpr const element_type* get() const { return __get_pointer(__t_); }
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR element_type* get() { return __get_pointer(__t_); }
+ _LIBCPP_HIDE_FROM_ABI constexpr element_type* get() { return __get_pointer(__t_); }
- _LIBCPP_HIDE_FROM_ABI explicit _LIBCPP_CONSTEXPR operator bool() const { return get() != nullptr; }
+ _LIBCPP_HIDE_FROM_ABI explicit constexpr operator bool() const { return get() != nullptr; }
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR const element_type* operator->() const { return get(); }
+ _LIBCPP_HIDE_FROM_ABI constexpr const element_type* operator->() const { return get(); }
template <class _Dummy = _Tp, class _Up = enable_if_t<is_convertible< const _Dummy, const element_type*>::value>>
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR operator const element_type*() const {
+ _LIBCPP_HIDE_FROM_ABI constexpr operator const element_type*() const {
return get();
}
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR const element_type& operator*() const { return *get(); }
+ _LIBCPP_HIDE_FROM_ABI constexpr const element_type& operator*() const { return *get(); }
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR element_type* operator->() { return get(); }
+ _LIBCPP_HIDE_FROM_ABI constexpr element_type* operator->() { return get(); }
template <class _Dummy = _Tp, class _Up = enable_if_t< is_convertible<_Dummy, element_type*>::value>>
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR operator element_type*() {
+ _LIBCPP_HIDE_FROM_ABI constexpr operator element_type*() {
return get();
}
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR element_type& operator*() { return *get(); }
+ _LIBCPP_HIDE_FROM_ABI constexpr element_type& operator*() { return *get(); }
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR void swap(propagate_const& __pt)
- _NOEXCEPT_(__is_nothrow_swappable<_Tp>::value) {
+ _LIBCPP_HIDE_FROM_ABI constexpr void swap(propagate_const& __pt) noexcept(__is_nothrow_swappable_v<_Tp>) {
using std::swap;
swap(__t_, __pt.__t_);
}
};
template <class _Tp>
-_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR bool operator==(const propagate_const<_Tp>& __pt, nullptr_t) {
+_LIBCPP_HIDE_FROM_ABI constexpr bool operator==(const propagate_const<_Tp>& __pt, nullptr_t) {
return experimental::get_underlying(__pt) == nullptr;
}
template <class _Tp>
-_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR bool operator==(nullptr_t, const propagate_const<_Tp>& __pt) {
+_LIBCPP_HIDE_FROM_ABI constexpr bool operator==(nullptr_t, const propagate_const<_Tp>& __pt) {
return nullptr == experimental::get_underlying(__pt);
}
template <class _Tp>
-_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR bool operator!=(const propagate_const<_Tp>& __pt, nullptr_t) {
+_LIBCPP_HIDE_FROM_ABI constexpr bool operator!=(const propagate_const<_Tp>& __pt, nullptr_t) {
return experimental::get_underlying(__pt) != nullptr;
}
template <class _Tp>
-_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR bool operator!=(nullptr_t, const propagate_const<_Tp>& __pt) {
+_LIBCPP_HIDE_FROM_ABI constexpr bool operator!=(nullptr_t, const propagate_const<_Tp>& __pt) {
return nullptr != experimental::get_underlying(__pt);
}
template <class _Tp, class _Up>
-_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR bool
-operator==(const propagate_const<_Tp>& __pt, const propagate_const<_Up>& __pu) {
+_LIBCPP_HIDE_FROM_ABI constexpr bool operator==(const propagate_const<_Tp>& __pt, const propagate_const<_Up>& __pu) {
return experimental::get_underlying(__pt) == experimental::get_underlying(__pu);
}
template <class _Tp, class _Up>
-_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR bool
-operator!=(const propagate_const<_Tp>& __pt, const propagate_const<_Up>& __pu) {
+_LIBCPP_HIDE_FROM_ABI constexpr bool operator!=(const propagate_const<_Tp>& __pt, const propagate_const<_Up>& __pu) {
return experimental::get_underlying(__pt) != experimental::get_underlying(__pu);
}
template <class _Tp, class _Up>
-_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR bool
-operator<(const propagate_const<_Tp>& __pt, const propagate_const<_Up>& __pu) {
+_LIBCPP_HIDE_FROM_ABI constexpr bool operator<(const propagate_const<_Tp>& __pt, const propagate_const<_Up>& __pu) {
return experimental::get_underlying(__pt) < experimental::get_underlying(__pu);
}
template <class _Tp, class _Up>
-_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR bool
-operator>(const propagate_const<_Tp>& __pt, const propagate_const<_Up>& __pu) {
+_LIBCPP_HIDE_FROM_ABI constexpr bool operator>(const propagate_const<_Tp>& __pt, const propagate_const<_Up>& __pu) {
return experimental::get_underlying(__pt) > experimental::get_underlying(__pu);
}
template <class _Tp, class _Up>
-_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR bool
-operator<=(const propagate_const<_Tp>& __pt, const propagate_const<_Up>& __pu) {
+_LIBCPP_HIDE_FROM_ABI constexpr bool operator<=(const propagate_const<_Tp>& __pt, const propagate_const<_Up>& __pu) {
return experimental::get_underlying(__pt) <= experimental::get_underlying(__pu);
}
template <class _Tp, class _Up>
-_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR bool
-operator>=(const propagate_const<_Tp>& __pt, const propagate_const<_Up>& __pu) {
+_LIBCPP_HIDE_FROM_ABI constexpr bool operator>=(const propagate_const<_Tp>& __pt, const propagate_const<_Up>& __pu) {
return experimental::get_underlying(__pt) >= experimental::get_underlying(__pu);
}
template <class _Tp, class _Up>
-_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR bool operator==(const propagate_const<_Tp>& __pt, const _Up& __u) {
+_LIBCPP_HIDE_FROM_ABI constexpr bool operator==(const propagate_const<_Tp>& __pt, const _Up& __u) {
return experimental::get_underlying(__pt) == __u;
}
template <class _Tp, class _Up>
-_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR bool operator!=(const propagate_const<_Tp>& __pt, const _Up& __u) {
+_LIBCPP_HIDE_FROM_ABI constexpr bool operator!=(const propagate_const<_Tp>& __pt, const _Up& __u) {
return experimental::get_underlying(__pt) != __u;
}
template <class _Tp, class _Up>
-_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR bool operator<(const propagate_const<_Tp>& __pt, const _Up& __u) {
+_LIBCPP_HIDE_FROM_ABI constexpr bool operator<(const propagate_const<_Tp>& __pt, const _Up& __u) {
return experimental::get_underlying(__pt) < __u;
}
template <class _Tp, class _Up>
-_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR bool operator>(const propagate_const<_Tp>& __pt, const _Up& __u) {
+_LIBCPP_HIDE_FROM_ABI constexpr bool operator>(const propagate_const<_Tp>& __pt, const _Up& __u) {
return experimental::get_underlying(__pt) > __u;
}
template <class _Tp, class _Up>
-_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR bool operator<=(const propagate_const<_Tp>& __pt, const _Up& __u) {
+_LIBCPP_HIDE_FROM_ABI constexpr bool operator<=(const propagate_const<_Tp>& __pt, const _Up& __u) {
return experimental::get_underlying(__pt) <= __u;
}
template <class _Tp, class _Up>
-_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR bool operator>=(const propagate_const<_Tp>& __pt, const _Up& __u) {
+_LIBCPP_HIDE_FROM_ABI constexpr bool operator>=(const propagate_const<_Tp>& __pt, const _Up& __u) {
return experimental::get_underlying(__pt) >= __u;
}
template <class _Tp, class _Up>
-_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR bool operator==(const _Tp& __t, const propagate_const<_Up>& __pu) {
+_LIBCPP_HIDE_FROM_ABI constexpr bool operator==(const _Tp& __t, const propagate_const<_Up>& __pu) {
return __t == experimental::get_underlying(__pu);
}
template <class _Tp, class _Up>
-_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR bool operator!=(const _Tp& __t, const propagate_const<_Up>& __pu) {
+_LIBCPP_HIDE_FROM_ABI constexpr bool operator!=(const _Tp& __t, const propagate_const<_Up>& __pu) {
return __t != experimental::get_underlying(__pu);
}
template <class _Tp, class _Up>
-_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR bool operator<(const _Tp& __t, const propagate_const<_Up>& __pu) {
+_LIBCPP_HIDE_FROM_ABI constexpr bool operator<(const _Tp& __t, const propagate_const<_Up>& __pu) {
return __t < experimental::get_underlying(__pu);
}
template <class _Tp, class _Up>
-_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR bool operator>(const _Tp& __t, const propagate_const<_Up>& __pu) {
+_LIBCPP_HIDE_FROM_ABI constexpr bool operator>(const _Tp& __t, const propagate_const<_Up>& __pu) {
return __t > experimental::get_underlying(__pu);
}
template <class _Tp, class _Up>
-_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR bool operator<=(const _Tp& __t, const propagate_const<_Up>& __pu) {
+_LIBCPP_HIDE_FROM_ABI constexpr bool operator<=(const _Tp& __t, const propagate_const<_Up>& __pu) {
return __t <= experimental::get_underlying(__pu);
}
template <class _Tp, class _Up>
-_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR bool operator>=(const _Tp& __t, const propagate_const<_Up>& __pu) {
+_LIBCPP_HIDE_FROM_ABI constexpr bool operator>=(const _Tp& __t, const propagate_const<_Up>& __pu) {
return __t >= experimental::get_underlying(__pu);
}
template <class _Tp>
-_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR void swap(propagate_const<_Tp>& __pc1, propagate_const<_Tp>& __pc2)
- _NOEXCEPT_(__is_nothrow_swappable<_Tp>::value) {
+_LIBCPP_HIDE_FROM_ABI constexpr void
+swap(propagate_const<_Tp>& __pc1, propagate_const<_Tp>& __pc2) noexcept(__is_nothrow_swappable_v<_Tp>) {
__pc1.swap(__pc2);
}
template <class _Tp>
-_LIBCPP_CONSTEXPR const _Tp& get_underlying(const propagate_const<_Tp>& __pt) _NOEXCEPT {
+constexpr const _Tp& get_underlying(const propagate_const<_Tp>& __pt) _NOEXCEPT {
return __pt.__t_;
}
template <class _Tp>
-_LIBCPP_CONSTEXPR _Tp& get_underlying(propagate_const<_Tp>& __pt) _NOEXCEPT {
+constexpr _Tp& get_underlying(propagate_const<_Tp>& __pt) _NOEXCEPT {
return __pt.__t_;
}
diff --git a/libcxx/include/experimental/simd b/libcxx/include/experimental/simd
index fad6431d13a1..484543b81daf 100644
--- a/libcxx/include/experimental/simd
+++ b/libcxx/include/experimental/simd
@@ -78,6 +78,7 @@ inline namespace parallelism_v2 {
#include <experimental/__config>
#include <experimental/__simd/aligned_tag.h>
#include <experimental/__simd/declaration.h>
+#include <experimental/__simd/reference.h>
#include <experimental/__simd/scalar.h>
#include <experimental/__simd/simd.h>
#include <experimental/__simd/simd_mask.h>
diff --git a/libcxx/include/experimental/type_traits b/libcxx/include/experimental/type_traits
index 37be434f8edd..31b041bc94c4 100644
--- a/libcxx/include/experimental/type_traits
+++ b/libcxx/include/experimental/type_traits
@@ -129,7 +129,7 @@ using is_detected = typename _DETECTOR<nonesuch, void, _Op, _Args...>::value_t;
template <template <class...> class _Op, class... _Args>
using detected_t = typename _DETECTOR<nonesuch, void, _Op, _Args...>::type;
template <template <class...> class _Op, class... _Args>
-_LIBCPP_CONSTEXPR bool is_detected_v = is_detected<_Op, _Args...>::value;
+constexpr bool is_detected_v = is_detected<_Op, _Args...>::value;
template <class _Default, template <class...> class _Op, class... _Args>
using detected_or = _DETECTOR<_Default, void, _Op, _Args...>;
@@ -139,12 +139,12 @@ using detected_or_t = typename detected_or<_Default, _Op, _Args...>::type;
template <class _Expected, template <class...> class _Op, class... _Args>
using is_detected_exact = is_same<_Expected, detected_t<_Op, _Args...>>;
template <class _Expected, template <class...> class _Op, class... _Args>
-_LIBCPP_CONSTEXPR bool is_detected_exact_v = is_detected_exact<_Expected, _Op, _Args...>::value;
+constexpr bool is_detected_exact_v = is_detected_exact<_Expected, _Op, _Args...>::value;
template <class _To, template <class...> class _Op, class... _Args>
using is_detected_convertible = is_convertible<detected_t<_Op, _Args...>, _To>;
template <class _To, template <class...> class _Op, class... _Args>
-_LIBCPP_CONSTEXPR bool is_detected_convertible_v = is_detected_convertible<_To, _Op, _Args...>::value;
+constexpr bool is_detected_convertible_v = is_detected_convertible<_To, _Op, _Args...>::value;
_LIBCPP_END_NAMESPACE_LFTS
diff --git a/libcxx/include/forward_list b/libcxx/include/forward_list
index 363931e3f238..3731d3f6cf6d 100644
--- a/libcxx/include/forward_list
+++ b/libcxx/include/forward_list
@@ -407,7 +407,7 @@ public:
template <class _NodeConstPtr>
class _LIBCPP_TEMPLATE_VIS __forward_list_const_iterator {
- static_assert((!is_const<typename pointer_traits<_NodeConstPtr>::element_type>::value), "");
+ static_assert(!is_const<typename pointer_traits<_NodeConstPtr>::element_type>::value, "");
typedef _NodeConstPtr _NodePtr;
typedef __forward_node_traits<_NodePtr> __traits;
@@ -510,19 +510,17 @@ protected:
: __before_begin_(__begin_node(), __node_allocator(__a)) {}
_LIBCPP_HIDE_FROM_ABI explicit __forward_list_base(const __node_allocator& __a)
: __before_begin_(__begin_node(), __a) {}
-#ifndef _LIBCPP_CXX03_LANG
public:
- _LIBCPP_HIDE_FROM_ABI __forward_list_base(__forward_list_base&& __x)
- _NOEXCEPT_(is_nothrow_move_constructible<__node_allocator>::value);
+#ifndef _LIBCPP_CXX03_LANG
+ _LIBCPP_HIDE_FROM_ABI
+ __forward_list_base(__forward_list_base&& __x) noexcept(is_nothrow_move_constructible<__node_allocator>::value);
_LIBCPP_HIDE_FROM_ABI __forward_list_base(__forward_list_base&& __x, const allocator_type& __a);
#endif // _LIBCPP_CXX03_LANG
-private:
- __forward_list_base(const __forward_list_base&);
- __forward_list_base& operator=(const __forward_list_base&);
+ __forward_list_base(const __forward_list_base&) = delete;
+ __forward_list_base& operator=(const __forward_list_base&) = delete;
-public:
_LIBCPP_HIDE_FROM_ABI ~__forward_list_base();
protected:
@@ -567,7 +565,7 @@ public:
#if _LIBCPP_STD_VER >= 14
_NOEXCEPT;
#else
- _NOEXCEPT_(!__node_traits::propagate_on_container_swap::value || __is_nothrow_swappable<__node_allocator>::value);
+ _NOEXCEPT_(!__node_traits::propagate_on_container_swap::value || __is_nothrow_swappable_v<__node_allocator>);
#endif
protected:
@@ -591,8 +589,8 @@ private:
#ifndef _LIBCPP_CXX03_LANG
template <class _Tp, class _Alloc>
-inline __forward_list_base<_Tp, _Alloc>::__forward_list_base(__forward_list_base&& __x)
- _NOEXCEPT_(is_nothrow_move_constructible<__node_allocator>::value)
+inline __forward_list_base<_Tp, _Alloc>::__forward_list_base(__forward_list_base&& __x) noexcept(
+ is_nothrow_move_constructible<__node_allocator>::value)
: __before_begin_(std::move(__x.__before_begin_)) {
__x.__before_begin()->__next_ = nullptr;
}
@@ -618,7 +616,7 @@ inline void __forward_list_base<_Tp, _Alloc>::swap(__forward_list_base& __x)
#if _LIBCPP_STD_VER >= 14
_NOEXCEPT
#else
- _NOEXCEPT_(!__node_traits::propagate_on_container_swap::value || __is_nothrow_swappable<__node_allocator>::value)
+ _NOEXCEPT_(!__node_traits::propagate_on_container_swap::value || __is_nothrow_swappable_v<__node_allocator>)
#endif
{
std::__swap_allocator(
@@ -650,16 +648,13 @@ public:
typedef _Tp value_type;
typedef _Alloc allocator_type;
+ static_assert(__check_valid_allocator<allocator_type>::value, "");
+
static_assert(is_same<value_type, typename allocator_type::value_type>::value,
"Allocator::value_type must be same type as value_type");
- static_assert(is_same<allocator_type, __rebind_alloc<allocator_traits<allocator_type>, value_type> >::value,
- "[allocator.requirements] states that rebinding an allocator to the same type should result in the "
- "original allocator");
-
- static_assert((!is_same<allocator_type, __node_allocator>::value),
- "internal allocator type must differ from user-specified "
- "type; otherwise overload resolution breaks");
+ static_assert(!is_same<allocator_type, __node_allocator>::value,
+ "internal allocator type must differ from user-specified type; otherwise overload resolution breaks");
typedef value_type& reference;
typedef const value_type& const_reference;
@@ -710,15 +705,16 @@ public:
_LIBCPP_HIDE_FROM_ABI forward_list& operator=(const forward_list& __x);
#ifndef _LIBCPP_CXX03_LANG
- _LIBCPP_HIDE_FROM_ABI forward_list(forward_list&& __x) _NOEXCEPT_(is_nothrow_move_constructible<base>::value)
+ _LIBCPP_HIDE_FROM_ABI forward_list(forward_list&& __x) noexcept(is_nothrow_move_constructible<base>::value)
: base(std::move(__x)) {}
_LIBCPP_HIDE_FROM_ABI forward_list(forward_list&& __x, const __type_identity_t<allocator_type>& __a);
_LIBCPP_HIDE_FROM_ABI forward_list(initializer_list<value_type> __il);
_LIBCPP_HIDE_FROM_ABI forward_list(initializer_list<value_type> __il, const allocator_type& __a);
- _LIBCPP_HIDE_FROM_ABI forward_list& operator=(forward_list&& __x) _NOEXCEPT_(
- __node_traits::propagate_on_container_move_assignment::value&& is_nothrow_move_assignable<allocator_type>::value);
+ _LIBCPP_HIDE_FROM_ABI forward_list& operator=(forward_list&& __x) noexcept(
+ __node_traits::propagate_on_container_move_assignment::value &&
+ is_nothrow_move_assignable<allocator_type>::value);
_LIBCPP_HIDE_FROM_ABI forward_list& operator=(initializer_list<value_type> __il);
@@ -821,7 +817,7 @@ public:
#if _LIBCPP_STD_VER >= 14
_NOEXCEPT
#else
- _NOEXCEPT_(!__node_traits::propagate_on_container_swap::value || __is_nothrow_swappable<__node_allocator>::value)
+ _NOEXCEPT_(!__node_traits::propagate_on_container_swap::value || __is_nothrow_swappable_v<__node_allocator>)
#endif
{
base::swap(__x);
diff --git a/libcxx/include/fstream b/libcxx/include/fstream
index 18f4dd3eed0b..ab5ebf8e2c3d 100644
--- a/libcxx/include/fstream
+++ b/libcxx/include/fstream
@@ -1103,8 +1103,8 @@ public:
_LIBCPP_HIDE_FROM_ABI explicit basic_ifstream(const string& __s, ios_base::openmode __mode = ios_base::in);
# if _LIBCPP_STD_VER >= 17
template <class _Tp, class = enable_if_t<is_same_v<_Tp, filesystem::path>>>
- _LIBCPP_AVAILABILITY_FILESYSTEM_LIBRARY _LIBCPP_HIDE_FROM_ABI explicit basic_ifstream(
- const _Tp& __p, ios_base::openmode __mode = ios_base::in)
+ _LIBCPP_AVAILABILITY_FILESYSTEM_LIBRARY
+ _LIBCPP_HIDE_FROM_ABI explicit basic_ifstream(const _Tp& __p, ios_base::openmode __mode = ios_base::in)
: basic_ifstream(__p.c_str(), __mode) {}
# endif // _LIBCPP_STD_VER >= 17
_LIBCPP_HIDE_FROM_ABI basic_ifstream(basic_ifstream&& __rhs);
@@ -1258,8 +1258,8 @@ public:
# if _LIBCPP_STD_VER >= 17
template <class _Tp, class = enable_if_t<is_same_v<_Tp, filesystem::path>>>
- _LIBCPP_AVAILABILITY_FILESYSTEM_LIBRARY _LIBCPP_HIDE_FROM_ABI explicit basic_ofstream(
- const _Tp& __p, ios_base::openmode __mode = ios_base::out)
+ _LIBCPP_AVAILABILITY_FILESYSTEM_LIBRARY
+ _LIBCPP_HIDE_FROM_ABI explicit basic_ofstream(const _Tp& __p, ios_base::openmode __mode = ios_base::out)
: basic_ofstream(__p.c_str(), __mode) {}
# endif // _LIBCPP_STD_VER >= 17
diff --git a/libcxx/include/future b/libcxx/include/future
index 7fa349eb8e84..dea73dc6389b 100644
--- a/libcxx/include/future
+++ b/libcxx/include/future
@@ -426,19 +426,19 @@ _LIBCPP_DECLARE_STRONG_ENUM_EPILOG(launch)
typedef underlying_type<launch>::type __launch_underlying_type;
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR launch operator&(launch __x, launch __y) {
+inline _LIBCPP_HIDE_FROM_ABI constexpr launch operator&(launch __x, launch __y) {
return static_cast<launch>(static_cast<__launch_underlying_type>(__x) & static_cast<__launch_underlying_type>(__y));
}
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR launch operator|(launch __x, launch __y) {
+inline _LIBCPP_HIDE_FROM_ABI constexpr launch operator|(launch __x, launch __y) {
return static_cast<launch>(static_cast<__launch_underlying_type>(__x) | static_cast<__launch_underlying_type>(__y));
}
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR launch operator^(launch __x, launch __y) {
+inline _LIBCPP_HIDE_FROM_ABI constexpr launch operator^(launch __x, launch __y) {
return static_cast<launch>(static_cast<__launch_underlying_type>(__x) ^ static_cast<__launch_underlying_type>(__y));
}
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR launch operator~(launch __x) {
+inline _LIBCPP_HIDE_FROM_ABI constexpr launch operator~(launch __x) {
return static_cast<launch>(~static_cast<__launch_underlying_type>(__x) & 3);
}
@@ -1384,11 +1384,10 @@ class __packaged_task_base;
template <class _Rp, class... _ArgTypes>
class __packaged_task_base<_Rp(_ArgTypes...)> {
- __packaged_task_base(const __packaged_task_base&);
- __packaged_task_base& operator=(const __packaged_task_base&);
-
public:
_LIBCPP_HIDE_FROM_ABI __packaged_task_base() {}
+ __packaged_task_base(const __packaged_task_base&) = delete;
+ __packaged_task_base& operator=(const __packaged_task_base&) = delete;
_LIBCPP_HIDE_FROM_ABI_VIRTUAL
virtual ~__packaged_task_base() {}
virtual void __move_to(__packaged_task_base*) _NOEXCEPT = 0;
diff --git a/libcxx/include/ios b/libcxx/include/ios
index 00c1d5c2d4bc..a653af005a18 100644
--- a/libcxx/include/ios
+++ b/libcxx/include/ios
@@ -532,7 +532,7 @@ public:
typedef typename traits_type::pos_type pos_type;
typedef typename traits_type::off_type off_type;
- static_assert((is_same<_CharT, typename traits_type::char_type>::value),
+ static_assert(is_same<_CharT, typename traits_type::char_type>::value,
"traits_type::char_type must be the same type as CharT");
#ifdef _LIBCPP_CXX03_LANG
diff --git a/libcxx/include/iosfwd b/libcxx/include/iosfwd
index 2481667dd972..051c73995e98 100644
--- a/libcxx/include/iosfwd
+++ b/libcxx/include/iosfwd
@@ -169,10 +169,10 @@ class __save_flags {
fmtflags __fmtflags_;
_CharT __fill_;
- __save_flags(const __save_flags&);
- __save_flags& operator=(const __save_flags&);
-
public:
+ __save_flags(const __save_flags&) = delete;
+ __save_flags& operator=(const __save_flags&) = delete;
+
_LIBCPP_HIDE_FROM_ABI explicit __save_flags(__stream_type& __stream)
: __stream_(__stream), __fmtflags_(__stream.flags()), __fill_(__stream.fill()) {}
_LIBCPP_HIDE_FROM_ABI ~__save_flags() {
diff --git a/libcxx/include/istream b/libcxx/include/istream
index 21269c8a8b40..d2b577a9ad9e 100644
--- a/libcxx/include/istream
+++ b/libcxx/include/istream
@@ -216,10 +216,10 @@ protected:
basic_ios<char_type, traits_type>::swap(__rhs);
}
+public:
basic_istream(const basic_istream& __rhs) = delete;
basic_istream& operator=(const basic_istream& __rhs) = delete;
-public:
// 27.7.1.1.3 Prefix/suffix:
class _LIBCPP_TEMPLATE_VIS sentry;
diff --git a/libcxx/include/limits b/libcxx/include/limits
index 668daf5fc7e6..d55c7cd75f34 100644
--- a/libcxx/include/limits
+++ b/libcxx/include/limits
@@ -314,10 +314,18 @@ protected:
static _LIBCPP_CONSTEXPR const bool has_signaling_NaN = true;
static _LIBCPP_DEPRECATED_IN_CXX23 _LIBCPP_CONSTEXPR const float_denorm_style has_denorm = denorm_present;
static _LIBCPP_DEPRECATED_IN_CXX23 _LIBCPP_CONSTEXPR const bool has_denorm_loss = false;
- _LIBCPP_NODISCARD _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type infinity() _NOEXCEPT { return __builtin_huge_valf(); }
- _LIBCPP_NODISCARD _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type quiet_NaN() _NOEXCEPT { return __builtin_nanf(""); }
- _LIBCPP_NODISCARD _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type signaling_NaN() _NOEXCEPT { return __builtin_nansf(""); }
- _LIBCPP_NODISCARD _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type denorm_min() _NOEXCEPT { return __FLT_DENORM_MIN__; }
+ _LIBCPP_NODISCARD _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type infinity() _NOEXCEPT {
+ return __builtin_huge_valf();
+ }
+ _LIBCPP_NODISCARD _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type quiet_NaN() _NOEXCEPT {
+ return __builtin_nanf("");
+ }
+ _LIBCPP_NODISCARD _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type signaling_NaN() _NOEXCEPT {
+ return __builtin_nansf("");
+ }
+ _LIBCPP_NODISCARD _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type denorm_min() _NOEXCEPT {
+ return __FLT_DENORM_MIN__;
+ }
static _LIBCPP_CONSTEXPR const bool is_iec559 = true;
static _LIBCPP_CONSTEXPR const bool is_bounded = true;
@@ -363,10 +371,18 @@ protected:
static _LIBCPP_CONSTEXPR const bool has_signaling_NaN = true;
static _LIBCPP_DEPRECATED_IN_CXX23 _LIBCPP_CONSTEXPR const float_denorm_style has_denorm = denorm_present;
static _LIBCPP_DEPRECATED_IN_CXX23 _LIBCPP_CONSTEXPR const bool has_denorm_loss = false;
- _LIBCPP_NODISCARD _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type infinity() _NOEXCEPT { return __builtin_huge_val(); }
- _LIBCPP_NODISCARD _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type quiet_NaN() _NOEXCEPT { return __builtin_nan(""); }
- _LIBCPP_NODISCARD _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type signaling_NaN() _NOEXCEPT { return __builtin_nans(""); }
- _LIBCPP_NODISCARD _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type denorm_min() _NOEXCEPT { return __DBL_DENORM_MIN__; }
+ _LIBCPP_NODISCARD _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type infinity() _NOEXCEPT {
+ return __builtin_huge_val();
+ }
+ _LIBCPP_NODISCARD _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type quiet_NaN() _NOEXCEPT {
+ return __builtin_nan("");
+ }
+ _LIBCPP_NODISCARD _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type signaling_NaN() _NOEXCEPT {
+ return __builtin_nans("");
+ }
+ _LIBCPP_NODISCARD _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type denorm_min() _NOEXCEPT {
+ return __DBL_DENORM_MIN__;
+ }
static _LIBCPP_CONSTEXPR const bool is_iec559 = true;
static _LIBCPP_CONSTEXPR const bool is_bounded = true;
@@ -412,10 +428,18 @@ protected:
static _LIBCPP_CONSTEXPR const bool has_signaling_NaN = true;
static _LIBCPP_DEPRECATED_IN_CXX23 _LIBCPP_CONSTEXPR const float_denorm_style has_denorm = denorm_present;
static _LIBCPP_DEPRECATED_IN_CXX23 _LIBCPP_CONSTEXPR const bool has_denorm_loss = false;
- _LIBCPP_NODISCARD _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type infinity() _NOEXCEPT { return __builtin_huge_vall(); }
- _LIBCPP_NODISCARD _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type quiet_NaN() _NOEXCEPT { return __builtin_nanl(""); }
- _LIBCPP_NODISCARD _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type signaling_NaN() _NOEXCEPT { return __builtin_nansl(""); }
- _LIBCPP_NODISCARD _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type denorm_min() _NOEXCEPT { return __LDBL_DENORM_MIN__; }
+ _LIBCPP_NODISCARD _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type infinity() _NOEXCEPT {
+ return __builtin_huge_vall();
+ }
+ _LIBCPP_NODISCARD _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type quiet_NaN() _NOEXCEPT {
+ return __builtin_nanl("");
+ }
+ _LIBCPP_NODISCARD _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type signaling_NaN() _NOEXCEPT {
+ return __builtin_nansl("");
+ }
+ _LIBCPP_NODISCARD _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type denorm_min() _NOEXCEPT {
+ return __LDBL_DENORM_MIN__;
+ }
#if defined(__powerpc__) && defined(__LONG_DOUBLE_IBM128__)
static _LIBCPP_CONSTEXPR const bool is_iec559 = false;
@@ -452,8 +476,12 @@ public:
static _LIBCPP_CONSTEXPR const bool is_integer = __base::is_integer;
static _LIBCPP_CONSTEXPR const bool is_exact = __base::is_exact;
static _LIBCPP_CONSTEXPR const int radix = __base::radix;
- _LIBCPP_NODISCARD _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type epsilon() _NOEXCEPT { return __base::epsilon(); }
- _LIBCPP_NODISCARD _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type round_error() _NOEXCEPT { return __base::round_error(); }
+ _LIBCPP_NODISCARD _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type epsilon() _NOEXCEPT {
+ return __base::epsilon();
+ }
+ _LIBCPP_NODISCARD _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type round_error() _NOEXCEPT {
+ return __base::round_error();
+ }
static _LIBCPP_CONSTEXPR const int min_exponent = __base::min_exponent;
static _LIBCPP_CONSTEXPR const int min_exponent10 = __base::min_exponent10;
@@ -467,10 +495,18 @@ public:
static _LIBCPP_DEPRECATED_IN_CXX23 _LIBCPP_CONSTEXPR const float_denorm_style has_denorm = __base::has_denorm;
static _LIBCPP_DEPRECATED_IN_CXX23 _LIBCPP_CONSTEXPR const bool has_denorm_loss = __base::has_denorm_loss;
_LIBCPP_SUPPRESS_DEPRECATED_POP
- _LIBCPP_NODISCARD _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type infinity() _NOEXCEPT { return __base::infinity(); }
- _LIBCPP_NODISCARD _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type quiet_NaN() _NOEXCEPT { return __base::quiet_NaN(); }
- _LIBCPP_NODISCARD _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type signaling_NaN() _NOEXCEPT { return __base::signaling_NaN(); }
- _LIBCPP_NODISCARD _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type denorm_min() _NOEXCEPT { return __base::denorm_min(); }
+ _LIBCPP_NODISCARD _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type infinity() _NOEXCEPT {
+ return __base::infinity();
+ }
+ _LIBCPP_NODISCARD _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type quiet_NaN() _NOEXCEPT {
+ return __base::quiet_NaN();
+ }
+ _LIBCPP_NODISCARD _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type signaling_NaN() _NOEXCEPT {
+ return __base::signaling_NaN();
+ }
+ _LIBCPP_NODISCARD _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type denorm_min() _NOEXCEPT {
+ return __base::denorm_min();
+ }
static _LIBCPP_CONSTEXPR const bool is_iec559 = __base::is_iec559;
static _LIBCPP_CONSTEXPR const bool is_bounded = __base::is_bounded;
diff --git a/libcxx/include/list b/libcxx/include/list
index 87f15e144ac8..1678559a841d 100644
--- a/libcxx/include/list
+++ b/libcxx/include/list
@@ -465,10 +465,10 @@ public:
template <class _Tp, class _Alloc>
class __list_imp {
- __list_imp(const __list_imp&);
- __list_imp& operator=(const __list_imp&);
-
public:
+ __list_imp(const __list_imp&) = delete;
+ __list_imp& operator=(const __list_imp&) = delete;
+
typedef _Alloc allocator_type;
typedef allocator_traits<allocator_type> __alloc_traits;
typedef typename __alloc_traits::size_type size_type;
@@ -493,9 +493,8 @@ protected:
typedef __rebind_alloc<__alloc_traits, __node_base> __node_base_allocator;
typedef typename allocator_traits<__node_base_allocator>::pointer __node_base_pointer;
- static_assert((!is_same<allocator_type, __node_allocator>::value),
- "internal allocator type must differ from user-specified "
- "type; otherwise overload resolution breaks");
+ static_assert(!is_same<allocator_type, __node_allocator>::value,
+ "internal allocator type must differ from user-specified type; otherwise overload resolution breaks");
__node_base __end_;
__compressed_pair<size_type, __node_allocator> __size_alloc_;
@@ -533,7 +532,7 @@ protected:
#if _LIBCPP_STD_VER >= 14
_NOEXCEPT;
#else
- _NOEXCEPT_(!__alloc_traits::propagate_on_container_swap::value || __is_nothrow_swappable<allocator_type>::value);
+ _NOEXCEPT_(!__alloc_traits::propagate_on_container_swap::value || __is_nothrow_swappable_v<allocator_type>);
#endif
_LIBCPP_HIDE_FROM_ABI void __copy_assign_alloc(const __list_imp& __c) {
@@ -639,7 +638,7 @@ void __list_imp<_Tp, _Alloc>::swap(__list_imp& __c)
#if _LIBCPP_STD_VER >= 14
_NOEXCEPT
#else
- _NOEXCEPT_(!__alloc_traits::propagate_on_container_swap::value || __is_nothrow_swappable<allocator_type>::value)
+ _NOEXCEPT_(!__alloc_traits::propagate_on_container_swap::value || __is_nothrow_swappable_v<allocator_type>)
#endif
{
_LIBCPP_ASSERT_COMPATIBLE_ALLOCATOR(
@@ -674,7 +673,8 @@ class _LIBCPP_TEMPLATE_VIS list : private __list_imp<_Tp, _Alloc> {
public:
typedef _Tp value_type;
typedef _Alloc allocator_type;
- static_assert((is_same<value_type, typename allocator_type::value_type>::value),
+ static_assert(__check_valid_allocator<allocator_type>::value);
+ static_assert(is_same<value_type, typename allocator_type::value_type>::value,
"Allocator::value_type must be same type as value_type");
typedef value_type& reference;
typedef const value_type& const_reference;
@@ -692,10 +692,6 @@ public:
typedef void __remove_return_type;
#endif
- static_assert(is_same<allocator_type, __rebind_alloc<allocator_traits<allocator_type>, value_type> >::value,
- "[allocator.requirements] states that rebinding an allocator to the same type should result in the "
- "original allocator");
-
_LIBCPP_HIDE_FROM_ABI list() _NOEXCEPT_(is_nothrow_default_constructible<__node_allocator>::value) {}
_LIBCPP_HIDE_FROM_ABI explicit list(const allocator_type& __a) : base(__a) {}
_LIBCPP_HIDE_FROM_ABI explicit list(size_type __n);
@@ -861,8 +857,7 @@ public:
#if _LIBCPP_STD_VER >= 14
_NOEXCEPT
#else
- _NOEXCEPT_(!__node_alloc_traits::propagate_on_container_swap::value ||
- __is_nothrow_swappable<__node_allocator>::value)
+ _NOEXCEPT_(!__node_alloc_traits::propagate_on_container_swap::value || __is_nothrow_swappable_v<__node_allocator>)
#endif
{
base::swap(__c);
@@ -1054,7 +1049,7 @@ list<_Tp, _Alloc>::list(initializer_list<value_type> __il) {
}
template <class _Tp, class _Alloc>
-inline list<_Tp, _Alloc>::list(list&& __c) _NOEXCEPT_(is_nothrow_move_constructible<__node_allocator>::value)
+inline list<_Tp, _Alloc>::list(list&& __c) noexcept(is_nothrow_move_constructible<__node_allocator>::value)
: base(std::move(__c.__node_alloc())) {
splice(end(), __c);
}
@@ -1070,9 +1065,9 @@ inline list<_Tp, _Alloc>::list(list&& __c, const __type_identity_t<allocator_typ
}
template <class _Tp, class _Alloc>
-inline list<_Tp, _Alloc>& list<_Tp, _Alloc>::operator=(list&& __c)
- _NOEXCEPT_(__node_alloc_traits::propagate_on_container_move_assignment::value&&
- is_nothrow_move_assignable<__node_allocator>::value) {
+inline list<_Tp, _Alloc>& list<_Tp, _Alloc>::operator=(list&& __c) noexcept(
+ __node_alloc_traits::propagate_on_container_move_assignment::value &&
+ is_nothrow_move_assignable<__node_allocator>::value) {
__move_assign(__c, integral_constant<bool, __node_alloc_traits::propagate_on_container_move_assignment::value>());
return *this;
}
@@ -1087,8 +1082,8 @@ void list<_Tp, _Alloc>::__move_assign(list& __c, false_type) {
}
template <class _Tp, class _Alloc>
-void list<_Tp, _Alloc>::__move_assign(list& __c, true_type)
- _NOEXCEPT_(is_nothrow_move_assignable<__node_allocator>::value) {
+void list<_Tp, _Alloc>::__move_assign(list& __c,
+ true_type) noexcept(is_nothrow_move_assignable<__node_allocator>::value) {
clear();
base::__move_assign_alloc(__c);
splice(end(), __c);
diff --git a/libcxx/include/locale b/libcxx/include/locale
index c25861ff6698..19e81e110b69 100644
--- a/libcxx/include/locale
+++ b/libcxx/include/locale
@@ -3148,25 +3148,25 @@ private:
state_type __cvtstate_;
size_t __cvtcount_;
- wstring_convert(const wstring_convert& __wc);
- wstring_convert& operator=(const wstring_convert& __wc);
-
public:
-#ifndef _LIBCPP_CXX03_LANG
+# ifndef _LIBCPP_CXX03_LANG
_LIBCPP_HIDE_FROM_ABI wstring_convert() : wstring_convert(new _Codecvt) {}
_LIBCPP_HIDE_FROM_ABI explicit wstring_convert(_Codecvt* __pcvt);
-#else
+# else
_LIBCPP_HIDE_FROM_ABI _LIBCPP_EXPLICIT_SINCE_CXX14 wstring_convert(_Codecvt* __pcvt = new _Codecvt);
-#endif
+# endif
_LIBCPP_HIDE_FROM_ABI wstring_convert(_Codecvt* __pcvt, state_type __state);
_LIBCPP_EXPLICIT_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI
wstring_convert(const byte_string& __byte_err, const wide_string& __wide_err = wide_string());
-#ifndef _LIBCPP_CXX03_LANG
+# ifndef _LIBCPP_CXX03_LANG
_LIBCPP_HIDE_FROM_ABI wstring_convert(wstring_convert&& __wc);
-#endif
+# endif
_LIBCPP_HIDE_FROM_ABI ~wstring_convert();
+ wstring_convert(const wstring_convert& __wc) = delete;
+ wstring_convert& operator=(const wstring_convert& __wc) = delete;
+
_LIBCPP_HIDE_FROM_ABI wide_string from_bytes(char __byte) { return from_bytes(&__byte, &__byte + 1); }
_LIBCPP_HIDE_FROM_ABI wide_string from_bytes(const char* __ptr) {
return from_bytes(__ptr, __ptr + char_traits<char>::length(__ptr));
@@ -3206,7 +3206,7 @@ wstring_convert<_Codecvt, _Elem, _WideAlloc, _ByteAlloc>::wstring_convert(
__cvtptr_ = new _Codecvt;
}
-#ifndef _LIBCPP_CXX03_LANG
+# ifndef _LIBCPP_CXX03_LANG
template <class _Codecvt, class _Elem, class _WideAlloc, class _ByteAlloc>
inline wstring_convert<_Codecvt, _Elem, _WideAlloc, _ByteAlloc>::wstring_convert(wstring_convert&& __wc)
@@ -3218,7 +3218,7 @@ inline wstring_convert<_Codecvt, _Elem, _WideAlloc, _ByteAlloc>::wstring_convert
__wc.__cvtptr_ = nullptr;
}
-#endif // _LIBCPP_CXX03_LANG
+# endif // _LIBCPP_CXX03_LANG
_LIBCPP_SUPPRESS_DEPRECATED_PUSH
template <class _Codecvt, class _Elem, class _WideAlloc, class _ByteAlloc>
@@ -3371,18 +3371,15 @@ private:
bool __owns_ib_;
bool __always_noconv_;
- wbuffer_convert(const wbuffer_convert&);
- wbuffer_convert& operator=(const wbuffer_convert&);
-
public:
-#ifndef _LIBCPP_CXX03_LANG
+# ifndef _LIBCPP_CXX03_LANG
_LIBCPP_HIDE_FROM_ABI wbuffer_convert() : wbuffer_convert(nullptr) {}
explicit _LIBCPP_HIDE_FROM_ABI
wbuffer_convert(streambuf* __bytebuf, _Codecvt* __pcvt = new _Codecvt, state_type __state = state_type());
-#else
+# else
_LIBCPP_EXPLICIT_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI
wbuffer_convert(streambuf* __bytebuf = nullptr, _Codecvt* __pcvt = new _Codecvt, state_type __state = state_type());
-#endif
+# endif
_LIBCPP_HIDE_FROM_ABI ~wbuffer_convert();
@@ -3393,6 +3390,9 @@ public:
return __r;
}
+ wbuffer_convert(const wbuffer_convert&) = delete;
+ wbuffer_convert& operator=(const wbuffer_convert&) = delete;
+
_LIBCPP_HIDE_FROM_ABI state_type state() const { return __st_; }
protected:
diff --git a/libcxx/include/map b/libcxx/include/map
index 7efa715e84aa..4b2f3fc71cbf 100644
--- a/libcxx/include/map
+++ b/libcxx/include/map
@@ -641,7 +641,7 @@ public:
_LIBCPP_HIDE_FROM_ABI bool operator()(const _Key& __x, const _CP& __y) const {
return static_cast<const _Compare&>(*this)(__x, __y.__get_value().first);
}
- _LIBCPP_HIDE_FROM_ABI void swap(__map_value_compare& __y) _NOEXCEPT_(__is_nothrow_swappable<_Compare>::value) {
+ _LIBCPP_HIDE_FROM_ABI void swap(__map_value_compare& __y) _NOEXCEPT_(__is_nothrow_swappable_v<_Compare>) {
using std::swap;
swap(static_cast<_Compare&>(*this), static_cast<_Compare&>(__y));
}
@@ -679,7 +679,7 @@ public:
_LIBCPP_HIDE_FROM_ABI bool operator()(const _Key& __x, const _CP& __y) const {
return __comp_(__x, __y.__get_value().first);
}
- void swap(__map_value_compare& __y) _NOEXCEPT_(__is_nothrow_swappable<_Compare>::value) {
+ void swap(__map_value_compare& __y) _NOEXCEPT_(__is_nothrow_swappable_v<_Compare>) {
using std::swap;
swap(__comp_, __y.__comp_);
}
@@ -715,8 +715,6 @@ public:
private:
allocator_type& __na_;
- __map_node_destructor& operator=(const __map_node_destructor&);
-
public:
bool __first_constructed;
bool __second_constructed;
@@ -735,6 +733,8 @@ public:
}
#endif // _LIBCPP_CXX03_LANG
+ __map_node_destructor& operator=(const __map_node_destructor&) = delete;
+
_LIBCPP_HIDE_FROM_ABI void operator()(pointer __p) _NOEXCEPT {
if (__second_constructed)
__alloc_traits::destroy(__na_, std::addressof(__p->__value_.__get_value().second));
@@ -808,7 +808,6 @@ public:
return *this;
}
-private:
__value_type() = delete;
~__value_type() = delete;
__value_type(const __value_type&) = delete;
@@ -830,11 +829,10 @@ public:
_LIBCPP_HIDE_FROM_ABI value_type& __get_value() { return __cc_; }
_LIBCPP_HIDE_FROM_ABI const value_type& __get_value() const { return __cc_; }
-private:
- __value_type();
- __value_type(__value_type const&);
- __value_type& operator=(__value_type const&);
- ~__value_type();
+ __value_type() = delete;
+ __value_type(__value_type const&) = delete;
+ __value_type& operator=(__value_type const&) = delete;
+ ~__value_type() = delete;
};
#endif // _LIBCPP_CXX03_LANG
@@ -974,7 +972,7 @@ public:
typedef value_type& reference;
typedef const value_type& const_reference;
- static_assert((is_same<typename allocator_type::value_type, value_type>::value),
+ static_assert(is_same<typename allocator_type::value_type, value_type>::value,
"Allocator::value_type must be same type as value_type");
class _LIBCPP_TEMPLATE_VIS value_compare : public __binary_function<value_type, value_type, bool> {
@@ -999,9 +997,7 @@ private:
typedef typename __base::__node_traits __node_traits;
typedef allocator_traits<allocator_type> __alloc_traits;
- static_assert(is_same<allocator_type, __rebind_alloc<__alloc_traits, value_type> >::value,
- "[allocator.requirements] states that rebinding an allocator to the same type should result in the "
- "original allocator");
+ static_assert(__check_valid_allocator<allocator_type>::value, "");
__base __tree_;
@@ -1092,12 +1088,12 @@ public:
#ifndef _LIBCPP_CXX03_LANG
- _LIBCPP_HIDE_FROM_ABI map(map&& __m) _NOEXCEPT_(is_nothrow_move_constructible<__base>::value)
+ _LIBCPP_HIDE_FROM_ABI map(map&& __m) noexcept(is_nothrow_move_constructible<__base>::value)
: __tree_(std::move(__m.__tree_)) {}
_LIBCPP_HIDE_FROM_ABI map(map&& __m, const allocator_type& __a);
- _LIBCPP_HIDE_FROM_ABI map& operator=(map&& __m) _NOEXCEPT_(is_nothrow_move_assignable<__base>::value) {
+ _LIBCPP_HIDE_FROM_ABI map& operator=(map&& __m) noexcept(is_nothrow_move_assignable<__base>::value) {
__tree_ = std::move(__m.__tree_);
return *this;
}
@@ -1359,9 +1355,7 @@ public:
}
#endif
- _LIBCPP_HIDE_FROM_ABI void swap(map& __m) _NOEXCEPT_(__is_nothrow_swappable<__base>::value) {
- __tree_.swap(__m.__tree_);
- }
+ _LIBCPP_HIDE_FROM_ABI void swap(map& __m) _NOEXCEPT_(__is_nothrow_swappable_v<__base>) { __tree_.swap(__m.__tree_); }
_LIBCPP_HIDE_FROM_ABI iterator find(const key_type& __k) { return __tree_.find(__k); }
_LIBCPP_HIDE_FROM_ABI const_iterator find(const key_type& __k) const { return __tree_.find(__k); }
@@ -1477,8 +1471,9 @@ template <class _Key,
class _Allocator = allocator<pair<const _Key, _Tp>>,
class = enable_if_t<!__is_allocator<_Compare>::value, void>,
class = enable_if_t<__is_allocator<_Allocator>::value, void>>
-map(initializer_list<pair<_Key, _Tp>>, _Compare = _Compare(), _Allocator = _Allocator())
- -> map<remove_const_t<_Key>, _Tp, _Compare, _Allocator>;
+map(initializer_list<pair<_Key, _Tp>>,
+ _Compare = _Compare(),
+ _Allocator = _Allocator()) -> map<remove_const_t<_Key>, _Tp, _Compare, _Allocator>;
template <class _InputIterator,
class _Allocator,
@@ -1497,8 +1492,8 @@ map(from_range_t, _Range&&, _Allocator)
# endif
template <class _Key, class _Tp, class _Allocator, class = enable_if_t<__is_allocator<_Allocator>::value, void>>
-map(initializer_list<pair<_Key, _Tp>>, _Allocator)
- -> map<remove_const_t<_Key>, _Tp, less<remove_const_t<_Key>>, _Allocator>;
+map(initializer_list<pair<_Key, _Tp>>,
+ _Allocator) -> map<remove_const_t<_Key>, _Tp, less<remove_const_t<_Key>>, _Allocator>;
#endif
#ifndef _LIBCPP_CXX03_LANG
@@ -1659,7 +1654,8 @@ public:
typedef value_type& reference;
typedef const value_type& const_reference;
- static_assert((is_same<typename allocator_type::value_type, value_type>::value),
+ static_assert(__check_valid_allocator<allocator_type>::value, "");
+ static_assert(is_same<typename allocator_type::value_type, value_type>::value,
"Allocator::value_type must be same type as value_type");
class _LIBCPP_TEMPLATE_VIS value_compare : public __binary_function<value_type, value_type, bool> {
@@ -1684,10 +1680,6 @@ private:
typedef typename __base::__node_traits __node_traits;
typedef allocator_traits<allocator_type> __alloc_traits;
- static_assert(is_same<allocator_type, __rebind_alloc<__alloc_traits, value_type> >::value,
- "[allocator.requirements] states that rebinding an allocator to the same type should result in the "
- "original allocator");
-
__base __tree_;
public:
@@ -1780,12 +1772,12 @@ public:
#ifndef _LIBCPP_CXX03_LANG
- _LIBCPP_HIDE_FROM_ABI multimap(multimap&& __m) _NOEXCEPT_(is_nothrow_move_constructible<__base>::value)
+ _LIBCPP_HIDE_FROM_ABI multimap(multimap&& __m) noexcept(is_nothrow_move_constructible<__base>::value)
: __tree_(std::move(__m.__tree_)) {}
_LIBCPP_HIDE_FROM_ABI multimap(multimap&& __m, const allocator_type& __a);
- _LIBCPP_HIDE_FROM_ABI multimap& operator=(multimap&& __m) _NOEXCEPT_(is_nothrow_move_assignable<__base>::value) {
+ _LIBCPP_HIDE_FROM_ABI multimap& operator=(multimap&& __m) noexcept(is_nothrow_move_assignable<__base>::value) {
__tree_ = std::move(__m.__tree_);
return *this;
}
@@ -1951,7 +1943,7 @@ public:
_LIBCPP_HIDE_FROM_ABI void clear() _NOEXCEPT { __tree_.clear(); }
- _LIBCPP_HIDE_FROM_ABI void swap(multimap& __m) _NOEXCEPT_(__is_nothrow_swappable<__base>::value) {
+ _LIBCPP_HIDE_FROM_ABI void swap(multimap& __m) _NOEXCEPT_(__is_nothrow_swappable_v<__base>) {
__tree_.swap(__m.__tree_);
}
@@ -2063,8 +2055,9 @@ template <class _Key,
class _Allocator = allocator<pair<const _Key, _Tp>>,
class = enable_if_t<!__is_allocator<_Compare>::value, void>,
class = enable_if_t<__is_allocator<_Allocator>::value, void>>
-multimap(initializer_list<pair<_Key, _Tp>>, _Compare = _Compare(), _Allocator = _Allocator())
- -> multimap<remove_const_t<_Key>, _Tp, _Compare, _Allocator>;
+multimap(initializer_list<pair<_Key, _Tp>>,
+ _Compare = _Compare(),
+ _Allocator = _Allocator()) -> multimap<remove_const_t<_Key>, _Tp, _Compare, _Allocator>;
template <class _InputIterator,
class _Allocator,
@@ -2083,8 +2076,8 @@ multimap(from_range_t, _Range&&, _Allocator)
# endif
template <class _Key, class _Tp, class _Allocator, class = enable_if_t<__is_allocator<_Allocator>::value, void>>
-multimap(initializer_list<pair<_Key, _Tp>>, _Allocator)
- -> multimap<remove_const_t<_Key>, _Tp, less<remove_const_t<_Key>>, _Allocator>;
+multimap(initializer_list<pair<_Key, _Tp>>,
+ _Allocator) -> multimap<remove_const_t<_Key>, _Tp, less<remove_const_t<_Key>>, _Allocator>;
#endif
#ifndef _LIBCPP_CXX03_LANG
diff --git a/libcxx/include/module.modulemap b/libcxx/include/module.modulemap
index 48391b2a1209..9ffccf66ff09 100644
--- a/libcxx/include/module.modulemap
+++ b/libcxx/include/module.modulemap
@@ -719,10 +719,6 @@ module std_private_algorithm_pstl [system
header "__algorithm/pstl.h"
export *
}
-module std_private_algorithm_pstl_frontend_dispatch [system] {
- header "__algorithm/pstl_frontend_dispatch.h"
- export std_private_utility_forward
-}
module std_private_algorithm_push_heap [system] { header "__algorithm/push_heap.h" }
module std_private_algorithm_ranges_adjacent_find [system] { header "__algorithm/ranges_adjacent_find.h" }
module std_private_algorithm_ranges_all_of [system] { header "__algorithm/ranges_all_of.h" }
@@ -1101,6 +1097,7 @@ module std_private_chrono_duration [system] {
header "__chrono/duration.h"
export std_private_type_traits_is_convertible
}
+module std_private_chrono_exception [system] { header "__chrono/exception.h" }
module std_private_chrono_file_clock [system] { header "__chrono/file_clock.h" }
module std_private_chrono_formatter [system] {
header "__chrono/formatter.h"
@@ -1113,7 +1110,10 @@ module std_private_chrono_high_resolution_clock [system] {
}
module std_private_chrono_leap_second [system] { header "__chrono/leap_second.h" }
module std_private_chrono_literals [system] { header "__chrono/literals.h" }
-module std_private_chrono_local_info [system] { header "__chrono/local_info.h" }
+module std_private_chrono_local_info [system] {
+ header "__chrono/local_info.h"
+ export std_private_chrono_sys_info
+}
module std_private_chrono_month [system] { header "__chrono/month.h" }
module std_private_chrono_month_weekday [system] { header "__chrono/month_weekday.h" }
module std_private_chrono_monthday [system] { header "__chrono/monthday.h" }
@@ -1155,6 +1155,7 @@ module std_private_chrono_year [system] { header "__chrono/yea
module std_private_chrono_year_month [system] { header "__chrono/year_month.h" }
module std_private_chrono_year_month_day [system] { header "__chrono/year_month_day.h" }
module std_private_chrono_year_month_weekday [system] { header "__chrono/year_month_weekday.h" }
+module std_private_chrono_zoned_time [system] { header "__chrono/zoned_time.h" }
module std_private_compare_common_comparison_category [system] { header "__compare/common_comparison_category.h" }
module std_private_compare_compare_partial_order_fallback [system] { header "__compare/compare_partial_order_fallback.h" }
@@ -1354,7 +1355,10 @@ module std_private_functional_invoke [system] {
module std_private_functional_is_transparent [system] { header "__functional/is_transparent.h" }
module std_private_functional_mem_fn [system] { header "__functional/mem_fn.h" }
module std_private_functional_mem_fun_ref [system] { header "__functional/mem_fun_ref.h" }
-module std_private_functional_not_fn [system] { header "__functional/not_fn.h" }
+module std_private_functional_not_fn [system] {
+ header "__functional/not_fn.h"
+ export std_private_functional_perfect_forward
+}
module std_private_functional_operations [system] { header "__functional/operations.h" }
module std_private_functional_perfect_forward [system] {
header "__functional/perfect_forward.h"
@@ -1580,26 +1584,41 @@ module std_private_numeric_transform_exclusive_scan [system] { header "__numeric
module std_private_numeric_transform_inclusive_scan [system] { header "__numeric/transform_inclusive_scan.h" }
module std_private_numeric_transform_reduce [system] { header "__numeric/transform_reduce.h" }
-module std_private_pstl_backends_libdispatch [system] { header "__pstl/backends/libdispatch.h" }
-module std_private_pstl_backends_serial [system] { header "__pstl/backends/serial.h" }
-module std_private_pstl_backends_std_thread [system] { header "__pstl/backends/std_thread.h" }
-module std_private_pstl_cpu_algos_any_of [system] { textual header "__pstl/cpu_algos/any_of.h" }
-module std_private_pstl_cpu_algos_cpu_traits [system] { header "__pstl/cpu_algos/cpu_traits.h" }
-module std_private_pstl_cpu_algos_fill [system] { textual header "__pstl/cpu_algos/fill.h" }
-module std_private_pstl_cpu_algos_find_if [system] { textual header "__pstl/cpu_algos/find_if.h" }
-module std_private_pstl_cpu_algos_for_each [system] { textual header "__pstl/cpu_algos/for_each.h" }
-module std_private_pstl_cpu_algos_merge [system] { textual header "__pstl/cpu_algos/merge.h" }
-module std_private_pstl_cpu_algos_stable_sort [system] { textual header "__pstl/cpu_algos/stable_sort.h" }
-module std_private_pstl_cpu_algos_transform [system] { textual header "__pstl/cpu_algos/transform.h" }
-module std_private_pstl_cpu_algos_transform_reduce [system] { textual header "__pstl/cpu_algos/transform_reduce.h" }
-module std_private_pstl_configuration_fwd [system] {
- header "__pstl/configuration_fwd.h"
+module std_private_pstl_backend [system] {
+ header "__pstl/backend.h"
+ export *
+}
+module std_private_pstl_backend_fwd [system] {
+ header "__pstl/backend_fwd.h"
export *
}
-module std_private_pstl_configuration [system] {
- header "__pstl/configuration.h"
+module std_private_pstl_backends_default [system] {
+ header "__pstl/backends/default.h"
export *
}
+module std_private_pstl_backends_libdispatch [system] {
+ header "__pstl/backends/libdispatch.h"
+ export *
+}
+module std_private_pstl_backends_serial [system] {
+ header "__pstl/backends/serial.h"
+ export *
+}
+module std_private_pstl_backends_std_thread [system] {
+ header "__pstl/backends/std_thread.h"
+ export *
+}
+module std_private_pstl_cpu_algos_any_of [system] { header "__pstl/cpu_algos/any_of.h" }
+module std_private_pstl_cpu_algos_cpu_traits [system] { header "__pstl/cpu_algos/cpu_traits.h" }
+module std_private_pstl_cpu_algos_fill [system] { header "__pstl/cpu_algos/fill.h" }
+module std_private_pstl_cpu_algos_find_if [system] { header "__pstl/cpu_algos/find_if.h" }
+module std_private_pstl_cpu_algos_for_each [system] { header "__pstl/cpu_algos/for_each.h" }
+module std_private_pstl_cpu_algos_merge [system] { header "__pstl/cpu_algos/merge.h" }
+module std_private_pstl_cpu_algos_stable_sort [system] { header "__pstl/cpu_algos/stable_sort.h" }
+module std_private_pstl_cpu_algos_transform [system] { header "__pstl/cpu_algos/transform.h" }
+module std_private_pstl_cpu_algos_transform_reduce [system] { header "__pstl/cpu_algos/transform_reduce.h" }
+module std_private_pstl_dispatch [system] { header "__pstl/dispatch.h" }
+module std_private_pstl_handle_exception [system] { header "__pstl/handle_exception.h" }
module std_private_queue_fwd [system] { header "__fwd/queue.h" }
diff --git a/libcxx/include/mutex b/libcxx/include/mutex
index 0d2b5914bc4f..02c52dd72f02 100644
--- a/libcxx/include/mutex
+++ b/libcxx/include/mutex
@@ -445,8 +445,8 @@ private:
mutex_type& __m_;
public:
- [[nodiscard]] _LIBCPP_HIDE_FROM_ABI explicit scoped_lock(mutex_type& __m)
- _LIBCPP_THREAD_SAFETY_ANNOTATION(acquire_capability(__m))
+ [[nodiscard]]
+ _LIBCPP_HIDE_FROM_ABI explicit scoped_lock(mutex_type& __m) _LIBCPP_THREAD_SAFETY_ANNOTATION(acquire_capability(__m))
: __m_(__m) {
__m_.lock();
}
diff --git a/libcxx/include/new b/libcxx/include/new
index 3089954b860d..214dbc398530 100644
--- a/libcxx/include/new
+++ b/libcxx/include/new
@@ -204,8 +204,8 @@ inline constexpr destroying_delete_t destroying_delete{};
#if !defined(_LIBCPP_ABI_VCRUNTIME)
_LIBCPP_NODISCARD _LIBCPP_OVERRIDABLE_FUNC_VIS void* operator new(std::size_t __sz) _THROW_BAD_ALLOC;
-_LIBCPP_NODISCARD _LIBCPP_OVERRIDABLE_FUNC_VIS void*
-operator new(std::size_t __sz, const std::nothrow_t&) _NOEXCEPT _LIBCPP_NOALIAS;
+_LIBCPP_NODISCARD _LIBCPP_OVERRIDABLE_FUNC_VIS void* operator new(std::size_t __sz, const std::nothrow_t&) _NOEXCEPT
+ _LIBCPP_NOALIAS;
_LIBCPP_OVERRIDABLE_FUNC_VIS void operator delete(void* __p) _NOEXCEPT;
_LIBCPP_OVERRIDABLE_FUNC_VIS void operator delete(void* __p, const std::nothrow_t&) _NOEXCEPT;
# ifndef _LIBCPP_HAS_NO_LIBRARY_SIZED_DEALLOCATION
@@ -213,8 +213,8 @@ _LIBCPP_OVERRIDABLE_FUNC_VIS void operator delete(void* __p, std::size_t __sz) _
# endif
_LIBCPP_NODISCARD _LIBCPP_OVERRIDABLE_FUNC_VIS void* operator new[](std::size_t __sz) _THROW_BAD_ALLOC;
-_LIBCPP_NODISCARD _LIBCPP_OVERRIDABLE_FUNC_VIS void*
-operator new[](std::size_t __sz, const std::nothrow_t&) _NOEXCEPT _LIBCPP_NOALIAS;
+_LIBCPP_NODISCARD _LIBCPP_OVERRIDABLE_FUNC_VIS void* operator new[](std::size_t __sz, const std::nothrow_t&) _NOEXCEPT
+ _LIBCPP_NOALIAS;
_LIBCPP_OVERRIDABLE_FUNC_VIS void operator delete[](void* __p) _NOEXCEPT;
_LIBCPP_OVERRIDABLE_FUNC_VIS void operator delete[](void* __p, const std::nothrow_t&) _NOEXCEPT;
# ifndef _LIBCPP_HAS_NO_LIBRARY_SIZED_DEALLOCATION
@@ -222,8 +222,7 @@ _LIBCPP_OVERRIDABLE_FUNC_VIS void operator delete[](void* __p, std::size_t __sz)
# endif
# ifndef _LIBCPP_HAS_NO_LIBRARY_ALIGNED_ALLOCATION
-_LIBCPP_NODISCARD _LIBCPP_OVERRIDABLE_FUNC_VIS void*
-operator new(std::size_t __sz, std::align_val_t) _THROW_BAD_ALLOC;
+_LIBCPP_NODISCARD _LIBCPP_OVERRIDABLE_FUNC_VIS void* operator new(std::size_t __sz, std::align_val_t) _THROW_BAD_ALLOC;
_LIBCPP_NODISCARD _LIBCPP_OVERRIDABLE_FUNC_VIS void*
operator new(std::size_t __sz, std::align_val_t, const std::nothrow_t&) _NOEXCEPT _LIBCPP_NOALIAS;
_LIBCPP_OVERRIDABLE_FUNC_VIS void operator delete(void* __p, std::align_val_t) _NOEXCEPT;
@@ -243,12 +242,8 @@ _LIBCPP_OVERRIDABLE_FUNC_VIS void operator delete[](void* __p, std::size_t __sz,
# endif
# endif
-_LIBCPP_NODISCARD inline _LIBCPP_HIDE_FROM_ABI void* operator new(std::size_t, void* __p) _NOEXCEPT {
- return __p;
-}
-_LIBCPP_NODISCARD inline _LIBCPP_HIDE_FROM_ABI void* operator new[](std::size_t, void* __p) _NOEXCEPT {
- return __p;
-}
+_LIBCPP_NODISCARD inline _LIBCPP_HIDE_FROM_ABI void* operator new(std::size_t, void* __p) _NOEXCEPT { return __p; }
+_LIBCPP_NODISCARD inline _LIBCPP_HIDE_FROM_ABI void* operator new[](std::size_t, void* __p) _NOEXCEPT { return __p; }
inline _LIBCPP_HIDE_FROM_ABI void operator delete(void*, void*) _NOEXCEPT {}
inline _LIBCPP_HIDE_FROM_ABI void operator delete[](void*, void*) _NOEXCEPT {}
diff --git a/libcxx/include/optional b/libcxx/include/optional
index 622e150f7a9f..e550745c17c0 100644
--- a/libcxx/include/optional
+++ b/libcxx/include/optional
@@ -209,6 +209,7 @@ namespace std {
#include <__type_traits/is_trivially_assignable.h>
#include <__type_traits/is_trivially_constructible.h>
#include <__type_traits/is_trivially_destructible.h>
+#include <__type_traits/is_trivially_relocatable.h>
#include <__type_traits/negation.h>
#include <__type_traits/remove_const.h>
#include <__type_traits/remove_cvref.h>
@@ -580,6 +581,8 @@ class _LIBCPP_DECLSPEC_EMPTY_BASES optional
public:
using value_type = _Tp;
+ using __trivially_relocatable = conditional_t<__libcpp_is_trivially_relocatable<_Tp>::value, optional, void>;
+
private:
// Disable the reference extension using this static assert.
static_assert(!is_same_v<__remove_cvref_t<value_type>, in_place_t>,
@@ -721,9 +724,9 @@ public:
template <
class _Up = value_type,
class = enable_if_t< _And< _IsNotSame<__remove_cvref_t<_Up>, optional>,
- _Or< _IsNotSame<__remove_cvref_t<_Up>, value_type>, _Not<is_scalar<value_type>> >,
- is_constructible<value_type, _Up>,
- is_assignable<value_type&, _Up> >::value> >
+ _Or< _IsNotSame<__remove_cvref_t<_Up>, value_type>, _Not<is_scalar<value_type>> >,
+ is_constructible<value_type, _Up>,
+ is_assignable<value_type&, _Up> >::value> >
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 optional& operator=(_Up&& __v) {
if (this->has_value())
this->__get() = std::forward<_Up>(__v);
@@ -1239,9 +1242,9 @@ operator<=>(const optional<_Tp>& __x, const _Up& __v) {
# endif // _LIBCPP_STD_VER >= 20
template <class _Tp>
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
- enable_if_t< is_move_constructible_v<_Tp> && is_swappable_v<_Tp>, void >
- swap(optional<_Tp>& __x, optional<_Tp>& __y) noexcept(noexcept(__x.swap(__y))) {
+inline _LIBCPP_HIDE_FROM_ABI
+_LIBCPP_CONSTEXPR_SINCE_CXX20 enable_if_t< is_move_constructible_v<_Tp> && is_swappable_v<_Tp>, void >
+swap(optional<_Tp>& __x, optional<_Tp>& __y) noexcept(noexcept(__x.swap(__y))) {
__x.swap(__y);
}
diff --git a/libcxx/include/print b/libcxx/include/print
index 5bdaa559af72..1a579daff270 100644
--- a/libcxx/include/print
+++ b/libcxx/include/print
@@ -358,10 +358,14 @@ _LIBCPP_HIDE_FROM_ABI void println(FILE* __stream, format_string<_Args...> __fmt
}
template <class = void> // TODO PRINT template or availability markup fires too eagerly (http://llvm.org/PR61563).
-_LIBCPP_HIDE_FROM_ABI inline void println(FILE* __stream) { std::print(__stream, "\n"); }
+_LIBCPP_HIDE_FROM_ABI inline void println(FILE* __stream) {
+ std::print(__stream, "\n");
+}
template <class = void> // TODO PRINT template or availability markup fires too eagerly (http://llvm.org/PR61563).
-_LIBCPP_HIDE_FROM_ABI inline void println() { println(stdout); }
+_LIBCPP_HIDE_FROM_ABI inline void println() {
+ println(stdout);
+}
template <class... _Args>
_LIBCPP_HIDE_FROM_ABI void println(format_string<_Args...> __fmt, _Args&&... __args) {
diff --git a/libcxx/include/queue b/libcxx/include/queue
index 8d6f6c667b93..9508de9f9eff 100644
--- a/libcxx/include/queue
+++ b/libcxx/include/queue
@@ -303,7 +303,7 @@ public:
typedef typename container_type::reference reference;
typedef typename container_type::const_reference const_reference;
typedef typename container_type::size_type size_type;
- static_assert((is_same<_Tp, value_type>::value), "");
+ static_assert(is_same<_Tp, value_type>::value, "");
protected:
container_type c;
@@ -341,10 +341,10 @@ public:
}
#ifndef _LIBCPP_CXX03_LANG
- _LIBCPP_HIDE_FROM_ABI queue(queue&& __q) _NOEXCEPT_(is_nothrow_move_constructible<container_type>::value)
+ _LIBCPP_HIDE_FROM_ABI queue(queue&& __q) noexcept(is_nothrow_move_constructible<container_type>::value)
: c(std::move(__q.c)) {}
- _LIBCPP_HIDE_FROM_ABI queue& operator=(queue&& __q) _NOEXCEPT_(is_nothrow_move_assignable<container_type>::value) {
+ _LIBCPP_HIDE_FROM_ABI queue& operator=(queue&& __q) noexcept(is_nothrow_move_assignable<container_type>::value) {
c = std::move(__q.c);
return *this;
}
@@ -398,20 +398,20 @@ public:
template <class... _Args>
_LIBCPP_HIDE_FROM_ABI
# if _LIBCPP_STD_VER >= 17
- decltype(auto)
- emplace(_Args&&... __args) {
+ decltype(auto)
+ emplace(_Args&&... __args) {
return c.emplace_back(std::forward<_Args>(__args)...);
}
# else
- void
- emplace(_Args&&... __args) {
+ void
+ emplace(_Args&&... __args) {
c.emplace_back(std::forward<_Args>(__args)...);
}
# endif
#endif // _LIBCPP_CXX03_LANG
_LIBCPP_HIDE_FROM_ABI void pop() { c.pop_front(); }
- _LIBCPP_HIDE_FROM_ABI void swap(queue& __q) _NOEXCEPT_(__is_nothrow_swappable<container_type>::value) {
+ _LIBCPP_HIDE_FROM_ABI void swap(queue& __q) _NOEXCEPT_(__is_nothrow_swappable_v<container_type>) {
using std::swap;
swap(c, __q.c);
}
@@ -500,7 +500,7 @@ operator<=>(const queue<_Tp, _Container>& __x, const queue<_Tp, _Container>& __y
#endif
-template <class _Tp, class _Container, __enable_if_t<__is_swappable<_Container>::value, int> = 0>
+template <class _Tp, class _Container, __enable_if_t<__is_swappable_v<_Container>, int> = 0>
inline _LIBCPP_HIDE_FROM_ABI void swap(queue<_Tp, _Container>& __x, queue<_Tp, _Container>& __y)
_NOEXCEPT_(_NOEXCEPT_(__x.swap(__y))) {
__x.swap(__y);
@@ -519,7 +519,7 @@ public:
typedef typename container_type::reference reference;
typedef typename container_type::const_reference const_reference;
typedef typename container_type::size_type size_type;
- static_assert((is_same<_Tp, value_type>::value), "");
+ static_assert(is_same<_Tp, value_type>::value, "");
protected:
container_type c;
@@ -539,12 +539,12 @@ public:
}
#ifndef _LIBCPP_CXX03_LANG
- _LIBCPP_HIDE_FROM_ABI priority_queue(priority_queue&& __q) _NOEXCEPT_(
- is_nothrow_move_constructible<container_type>::value&& is_nothrow_move_constructible<value_compare>::value)
+ _LIBCPP_HIDE_FROM_ABI priority_queue(priority_queue&& __q) noexcept(
+ is_nothrow_move_constructible<container_type>::value && is_nothrow_move_constructible<value_compare>::value)
: c(std::move(__q.c)), comp(std::move(__q.comp)) {}
- _LIBCPP_HIDE_FROM_ABI priority_queue& operator=(priority_queue&& __q)
- _NOEXCEPT_(is_nothrow_move_assignable<container_type>::value&& is_nothrow_move_assignable<value_compare>::value) {
+ _LIBCPP_HIDE_FROM_ABI priority_queue& operator=(priority_queue&& __q) noexcept(
+ is_nothrow_move_assignable<container_type>::value && is_nothrow_move_assignable<value_compare>::value) {
c = std::move(__q.c);
comp = std::move(__q.comp);
return *this;
@@ -676,7 +676,7 @@ public:
_LIBCPP_HIDE_FROM_ABI void pop();
_LIBCPP_HIDE_FROM_ABI void swap(priority_queue& __q)
- _NOEXCEPT_(__is_nothrow_swappable<container_type>::value&& __is_nothrow_swappable<value_compare>::value);
+ _NOEXCEPT_(__is_nothrow_swappable_v<container_type>&& __is_nothrow_swappable_v<value_compare>);
_LIBCPP_NODISCARD _LIBCPP_HIDE_FROM_ABI const _Container& __get_container() const { return c; }
};
@@ -922,7 +922,7 @@ inline void priority_queue<_Tp, _Container, _Compare>::pop() {
template <class _Tp, class _Container, class _Compare>
inline void priority_queue<_Tp, _Container, _Compare>::swap(priority_queue& __q)
- _NOEXCEPT_(__is_nothrow_swappable<container_type>::value&& __is_nothrow_swappable<value_compare>::value) {
+ _NOEXCEPT_(__is_nothrow_swappable_v<container_type>&& __is_nothrow_swappable_v<value_compare>) {
using std::swap;
swap(c, __q.c);
swap(comp, __q.comp);
@@ -931,7 +931,7 @@ inline void priority_queue<_Tp, _Container, _Compare>::swap(priority_queue& __q)
template <class _Tp,
class _Container,
class _Compare,
- __enable_if_t<__is_swappable<_Container>::value && __is_swappable<_Compare>::value, int> = 0>
+ __enable_if_t<__is_swappable_v<_Container> && __is_swappable_v<_Compare>, int> = 0>
inline _LIBCPP_HIDE_FROM_ABI void
swap(priority_queue<_Tp, _Container, _Compare>& __x, priority_queue<_Tp, _Container, _Compare>& __y)
_NOEXCEPT_(_NOEXCEPT_(__x.swap(__y))) {
diff --git a/libcxx/include/regex b/libcxx/include/regex
index 46968357d397..b81413512132 100644
--- a/libcxx/include/regex
+++ b/libcxx/include/regex
@@ -1345,13 +1345,12 @@ struct __state {
template <class _CharT>
class __node {
- __node(const __node&);
- __node& operator=(const __node&);
-
public:
typedef std::__state<_CharT> __state;
_LIBCPP_HIDE_FROM_ABI __node() {}
+ __node(const __node&) = delete;
+ __node& operator=(const __node&) = delete;
_LIBCPP_HIDE_FROM_ABI_VIRTUAL
virtual ~__node() {}
@@ -1952,14 +1951,14 @@ class __match_char : public __owns_one_state<_CharT> {
_CharT __c_;
- __match_char(const __match_char&);
- __match_char& operator=(const __match_char&);
-
public:
typedef std::__state<_CharT> __state;
_LIBCPP_HIDE_FROM_ABI __match_char(_CharT __c, __node<_CharT>* __s) : base(__s), __c_(__c) {}
+ __match_char(const __match_char&) = delete;
+ __match_char& operator=(const __match_char&) = delete;
+
_LIBCPP_HIDE_FROM_ABI_VIRTUAL virtual void __exec(__state&) const;
};
@@ -1984,15 +1983,15 @@ class __match_char_icase : public __owns_one_state<_CharT> {
_Traits __traits_;
_CharT __c_;
- __match_char_icase(const __match_char_icase&);
- __match_char_icase& operator=(const __match_char_icase&);
-
public:
typedef std::__state<_CharT> __state;
_LIBCPP_HIDE_FROM_ABI __match_char_icase(const _Traits& __traits, _CharT __c, __node<_CharT>* __s)
: base(__s), __traits_(__traits), __c_(__traits.translate_nocase(__c)) {}
+ __match_char_icase(const __match_char_icase&) = delete;
+ __match_char_icase& operator=(const __match_char_icase&) = delete;
+
_LIBCPP_HIDE_FROM_ABI_VIRTUAL virtual void __exec(__state&) const;
};
@@ -2017,15 +2016,15 @@ class __match_char_collate : public __owns_one_state<_CharT> {
_Traits __traits_;
_CharT __c_;
- __match_char_collate(const __match_char_collate&);
- __match_char_collate& operator=(const __match_char_collate&);
-
public:
typedef std::__state<_CharT> __state;
_LIBCPP_HIDE_FROM_ABI __match_char_collate(const _Traits& __traits, _CharT __c, __node<_CharT>* __s)
: base(__s), __traits_(__traits), __c_(__traits.translate(__c)) {}
+ __match_char_collate(const __match_char_collate&) = delete;
+ __match_char_collate& operator=(const __match_char_collate&) = delete;
+
_LIBCPP_HIDE_FROM_ABI_VIRTUAL virtual void __exec(__state&) const;
};
@@ -2061,9 +2060,6 @@ class __bracket_expression : public __owns_one_state<_CharT> {
bool __collate_;
bool __might_have_digraph_;
- __bracket_expression(const __bracket_expression&);
- __bracket_expression& operator=(const __bracket_expression&);
-
public:
typedef std::__state<_CharT> __state;
@@ -2078,6 +2074,9 @@ public:
__collate_(__collate),
__might_have_digraph_(__traits_.getloc().name() != "C") {}
+ __bracket_expression(const __bracket_expression&) = delete;
+ __bracket_expression& operator=(const __bracket_expression&) = delete;
+
_LIBCPP_HIDE_FROM_ABI_VIRTUAL virtual void __exec(__state&) const;
_LIBCPP_HIDE_FROM_ABI bool __negated() const { return __negate_; }
@@ -2699,9 +2698,6 @@ class __lookahead : public __owns_one_state<_CharT> {
unsigned __mexp_;
bool __invert_;
- __lookahead(const __lookahead&);
- __lookahead& operator=(const __lookahead&);
-
public:
typedef std::__state<_CharT> __state;
@@ -2709,6 +2705,9 @@ public:
__lookahead(const basic_regex<_CharT, _Traits>& __exp, bool __invert, __node<_CharT>* __s, unsigned __mexp)
: base(__s), __exp_(__exp), __mexp_(__mexp), __invert_(__invert) {}
+ __lookahead(const __lookahead&) = delete;
+ __lookahead& operator=(const __lookahead&) = delete;
+
_LIBCPP_HIDE_FROM_ABI_VIRTUAL virtual void __exec(__state&) const;
};
@@ -4214,11 +4213,7 @@ public:
_LIBCPP_HIDE_FROM_ABI int compare(const string_type& __s) const { return str().compare(__s); }
_LIBCPP_HIDE_FROM_ABI int compare(const value_type* __s) const { return str().compare(__s); }
- _LIBCPP_HIDE_FROM_ABI void swap(sub_match& __s)
-#ifndef _LIBCPP_CXX03_LANG
- _NOEXCEPT(__is_nothrow_swappable<_BidirectionalIterator>::value)
-#endif // _LIBCPP_CXX03_LANG
- {
+ _LIBCPP_HIDE_FROM_ABI void swap(sub_match& __s) _NOEXCEPT_(__is_nothrow_swappable_v<_BidirectionalIterator>) {
this->pair<_BidirectionalIterator, _BidirectionalIterator>::swap(__s);
std::swap(matched, __s.matched);
}
@@ -5439,8 +5434,8 @@ regex_iterator<_BidirectionalIterator, _CharT, _Traits>::operator++() {
// equal to the previous value of `match[0].second`... It is unspecified how the implementation makes these
// adjustments." The adjustment is necessary if we incremented `__start` above (the branch that deals with
// zero-length matches).
- auto& __prefix = __match_.__prefix_;
- __prefix.first = __prefix_start;
+ auto& __prefix = __match_.__prefix_;
+ __prefix.first = __prefix_start;
__prefix.matched = __prefix.first != __prefix.second;
}
diff --git a/libcxx/include/scoped_allocator b/libcxx/include/scoped_allocator
index ef3a4f9044be..a49ff465b1d5 100644
--- a/libcxx/include/scoped_allocator
+++ b/libcxx/include/scoped_allocator
@@ -313,7 +313,7 @@ false_type __has_outer_allocator_test(const volatile _Alloc& __a);
template <class _Alloc>
struct __has_outer_allocator
- : public common_type< decltype(std::__has_outer_allocator_test(std::declval<_Alloc&>())) >::type {};
+ : public common_type< decltype(std::__has_outer_allocator_test(std::declval<_Alloc&>()))>::type {};
template <class _Alloc, bool = __has_outer_allocator<_Alloc>::value>
struct __outermost {
diff --git a/libcxx/include/set b/libcxx/include/set
index ab3a4363499a..9a2eb12d0a25 100644
--- a/libcxx/include/set
+++ b/libcxx/include/set
@@ -571,16 +571,14 @@ public:
typedef value_type& reference;
typedef const value_type& const_reference;
- static_assert((is_same<typename allocator_type::value_type, value_type>::value),
+ static_assert(is_same<typename allocator_type::value_type, value_type>::value,
"Allocator::value_type must be same type as value_type");
private:
typedef __tree<value_type, value_compare, allocator_type> __base;
typedef allocator_traits<allocator_type> __alloc_traits;
- static_assert(is_same<allocator_type, __rebind_alloc<__alloc_traits, value_type> >::value,
- "[allocator.requirements] states that rebinding an allocator to the same type should result in the "
- "original allocator");
+ static_assert(__check_valid_allocator<allocator_type>::value, "");
__base __tree_;
@@ -659,7 +657,7 @@ public:
}
#ifndef _LIBCPP_CXX03_LANG
- _LIBCPP_HIDE_FROM_ABI set(set&& __s) _NOEXCEPT_(is_nothrow_move_constructible<__base>::value)
+ _LIBCPP_HIDE_FROM_ABI set(set&& __s) noexcept(is_nothrow_move_constructible<__base>::value)
: __tree_(std::move(__s.__tree_)) {}
#endif // _LIBCPP_CXX03_LANG
@@ -692,7 +690,7 @@ public:
return *this;
}
- _LIBCPP_HIDE_FROM_ABI set& operator=(set&& __s) _NOEXCEPT_(is_nothrow_move_assignable<__base>::value) {
+ _LIBCPP_HIDE_FROM_ABI set& operator=(set&& __s) noexcept(is_nothrow_move_assignable<__base>::value) {
__tree_ = std::move(__s.__tree_);
return *this;
}
@@ -812,9 +810,7 @@ public:
}
#endif
- _LIBCPP_HIDE_FROM_ABI void swap(set& __s) _NOEXCEPT_(__is_nothrow_swappable<__base>::value) {
- __tree_.swap(__s.__tree_);
- }
+ _LIBCPP_HIDE_FROM_ABI void swap(set& __s) _NOEXCEPT_(__is_nothrow_swappable_v<__base>) { __tree_.swap(__s.__tree_); }
_LIBCPP_HIDE_FROM_ABI allocator_type get_allocator() const _NOEXCEPT { return __tree_.__alloc(); }
_LIBCPP_HIDE_FROM_ABI key_compare key_comp() const { return __tree_.value_comp(); }
@@ -926,13 +922,15 @@ template <class _InputIterator,
class _Allocator,
class = enable_if_t<__has_input_iterator_category<_InputIterator>::value, void>,
class = enable_if_t<__is_allocator<_Allocator>::value, void>>
-set(_InputIterator, _InputIterator, _Allocator)
- -> set<__iter_value_type<_InputIterator>, less<__iter_value_type<_InputIterator>>, _Allocator>;
+set(_InputIterator,
+ _InputIterator,
+ _Allocator) -> set<__iter_value_type<_InputIterator>, less<__iter_value_type<_InputIterator>>, _Allocator>;
# if _LIBCPP_STD_VER >= 23
template <ranges::input_range _Range, class _Allocator, class = enable_if_t<__is_allocator<_Allocator>::value, void>>
-set(from_range_t, _Range&&, _Allocator)
- -> set<ranges::range_value_t<_Range>, less<ranges::range_value_t<_Range>>, _Allocator>;
+set(from_range_t,
+ _Range&&,
+ _Allocator) -> set<ranges::range_value_t<_Range>, less<ranges::range_value_t<_Range>>, _Allocator>;
# endif
template <class _Key, class _Allocator, class = enable_if_t<__is_allocator<_Allocator>::value, void>>
@@ -1028,16 +1026,14 @@ public:
typedef value_type& reference;
typedef const value_type& const_reference;
- static_assert((is_same<typename allocator_type::value_type, value_type>::value),
+ static_assert(is_same<typename allocator_type::value_type, value_type>::value,
"Allocator::value_type must be same type as value_type");
private:
typedef __tree<value_type, value_compare, allocator_type> __base;
typedef allocator_traits<allocator_type> __alloc_traits;
- static_assert(is_same<allocator_type, __rebind_alloc<__alloc_traits, value_type> >::value,
- "[allocator.requirements] states that rebinding an allocator to the same type should result in the "
- "original allocator");
+ static_assert(__check_valid_allocator<allocator_type>::value, "");
__base __tree_;
@@ -1119,7 +1115,7 @@ public:
}
#ifndef _LIBCPP_CXX03_LANG
- _LIBCPP_HIDE_FROM_ABI multiset(multiset&& __s) _NOEXCEPT_(is_nothrow_move_constructible<__base>::value)
+ _LIBCPP_HIDE_FROM_ABI multiset(multiset&& __s) noexcept(is_nothrow_move_constructible<__base>::value)
: __tree_(std::move(__s.__tree_)) {}
_LIBCPP_HIDE_FROM_ABI multiset(multiset&& __s, const allocator_type& __a);
@@ -1270,7 +1266,7 @@ public:
}
#endif
- _LIBCPP_HIDE_FROM_ABI void swap(multiset& __s) _NOEXCEPT_(__is_nothrow_swappable<__base>::value) {
+ _LIBCPP_HIDE_FROM_ABI void swap(multiset& __s) _NOEXCEPT_(__is_nothrow_swappable_v<__base>) {
__tree_.swap(__s.__tree_);
}
@@ -1378,8 +1374,9 @@ template <class _Key,
class _Allocator = allocator<_Key>,
class = enable_if_t<__is_allocator<_Allocator>::value, void>,
class = enable_if_t<!__is_allocator<_Compare>::value, void>>
-multiset(initializer_list<_Key>, _Compare = _Compare(), _Allocator = _Allocator())
- -> multiset<_Key, _Compare, _Allocator>;
+multiset(initializer_list<_Key>,
+ _Compare = _Compare(),
+ _Allocator = _Allocator()) -> multiset<_Key, _Compare, _Allocator>;
template <class _InputIterator,
class _Allocator,
@@ -1390,8 +1387,9 @@ multiset(_InputIterator, _InputIterator, _Allocator)
# if _LIBCPP_STD_VER >= 23
template <ranges::input_range _Range, class _Allocator, class = enable_if_t<__is_allocator<_Allocator>::value, void>>
-multiset(from_range_t, _Range&&, _Allocator)
- -> multiset<ranges::range_value_t<_Range>, less<ranges::range_value_t<_Range>>, _Allocator>;
+multiset(from_range_t,
+ _Range&&,
+ _Allocator) -> multiset<ranges::range_value_t<_Range>, less<ranges::range_value_t<_Range>>, _Allocator>;
# endif
template <class _Key, class _Allocator, class = enable_if_t<__is_allocator<_Allocator>::value, void>>
diff --git a/libcxx/include/shared_mutex b/libcxx/include/shared_mutex
index 9cc391db6fc5..397ac290d9b2 100644
--- a/libcxx/include/shared_mutex
+++ b/libcxx/include/shared_mutex
@@ -220,8 +220,8 @@ public:
};
# endif
-class _LIBCPP_EXPORTED_FROM_ABI _LIBCPP_THREAD_SAFETY_ANNOTATION(__capability__("shared_timed_mutex"))
- shared_timed_mutex {
+class _LIBCPP_EXPORTED_FROM_ABI
+_LIBCPP_THREAD_SAFETY_ANNOTATION(__capability__("shared_timed_mutex")) shared_timed_mutex {
__shared_mutex_base __base_;
public:
diff --git a/libcxx/include/span b/libcxx/include/span
index 11006b74fbb5..60d76d830f0f 100644
--- a/libcxx/include/span
+++ b/libcxx/include/span
@@ -206,12 +206,12 @@ struct __is_std_span<span<_Tp, _Sz>> : true_type {};
template <class _Range, class _ElementType>
concept __span_compatible_range =
- ranges::contiguous_range<_Range> && //
- ranges::sized_range<_Range> && //
- (ranges::borrowed_range<_Range> || is_const_v<_ElementType>)&& //
- !__is_std_span<remove_cvref_t<_Range>>::value && //
- !__is_std_array<remove_cvref_t<_Range>>::value && //
- !is_array_v<remove_cvref_t<_Range>> && //
+ ranges::contiguous_range<_Range> && //
+ ranges::sized_range<_Range> && //
+ (ranges::borrowed_range<_Range> || is_const_v<_ElementType>) && //
+ !__is_std_span<remove_cvref_t<_Range>>::value && //
+ !__is_std_array<remove_cvref_t<_Range>>::value && //
+ !is_array_v<remove_cvref_t<_Range>> && //
is_convertible_v<remove_reference_t<ranges::range_reference_t<_Range>> (*)[], _ElementType (*)[]>;
template <class _From, class _To>
@@ -326,8 +326,8 @@ public:
}
template <size_t _Offset, size_t _Count = dynamic_extent>
- _LIBCPP_HIDE_FROM_ABI constexpr auto subspan() const noexcept
- -> span<element_type, _Count != dynamic_extent ? _Count : _Extent - _Offset> {
+ _LIBCPP_HIDE_FROM_ABI constexpr auto
+ subspan() const noexcept -> span<element_type, _Count != dynamic_extent ? _Count : _Extent - _Offset> {
static_assert(_Offset <= _Extent, "span<T, N>::subspan<Offset, Count>(): Offset out of range");
static_assert(_Count == dynamic_extent || _Count <= _Extent - _Offset,
"span<T, N>::subspan<Offset, Count>(): Offset + Count out of range");
diff --git a/libcxx/include/stack b/libcxx/include/stack
index e45bfba5587e..90f8933cca30 100644
--- a/libcxx/include/stack
+++ b/libcxx/include/stack
@@ -157,7 +157,7 @@ public:
typedef typename container_type::reference reference;
typedef typename container_type::const_reference const_reference;
typedef typename container_type::size_type size_type;
- static_assert((is_same<_Tp, value_type>::value), "");
+ static_assert(is_same<_Tp, value_type>::value, "");
protected:
container_type c;
@@ -173,10 +173,10 @@ public:
}
#ifndef _LIBCPP_CXX03_LANG
- _LIBCPP_HIDE_FROM_ABI stack(stack&& __q) _NOEXCEPT_(is_nothrow_move_constructible<container_type>::value)
+ _LIBCPP_HIDE_FROM_ABI stack(stack&& __q) noexcept(is_nothrow_move_constructible<container_type>::value)
: c(std::move(__q.c)) {}
- _LIBCPP_HIDE_FROM_ABI stack& operator=(stack&& __q) _NOEXCEPT_(is_nothrow_move_assignable<container_type>::value) {
+ _LIBCPP_HIDE_FROM_ABI stack& operator=(stack&& __q) noexcept(is_nothrow_move_assignable<container_type>::value) {
c = std::move(__q.c);
return *this;
}
@@ -219,7 +219,7 @@ public:
template <class _InputIterator,
class _Alloc,
__enable_if_t<__has_input_iterator_category<_InputIterator>::value, int> = 0,
- __enable_if_t<uses_allocator<container_type, _Alloc>::value, int> = 0>
+ __enable_if_t<uses_allocator<container_type, _Alloc>::value, int> = 0>
_LIBCPP_HIDE_FROM_ABI stack(_InputIterator __first, _InputIterator __last, const _Alloc& __alloc)
: c(__first, __last, __alloc) {}
@@ -254,13 +254,13 @@ public:
template <class... _Args>
_LIBCPP_HIDE_FROM_ABI
# if _LIBCPP_STD_VER >= 17
- decltype(auto)
- emplace(_Args&&... __args) {
+ decltype(auto)
+ emplace(_Args&&... __args) {
return c.emplace_back(std::forward<_Args>(__args)...);
}
# else
- void
- emplace(_Args&&... __args) {
+ void
+ emplace(_Args&&... __args) {
c.emplace_back(std::forward<_Args>(__args)...);
}
# endif
@@ -268,7 +268,7 @@ public:
_LIBCPP_HIDE_FROM_ABI void pop() { c.pop_back(); }
- _LIBCPP_HIDE_FROM_ABI void swap(stack& __s) _NOEXCEPT_(__is_nothrow_swappable<container_type>::value) {
+ _LIBCPP_HIDE_FROM_ABI void swap(stack& __s) _NOEXCEPT_(__is_nothrow_swappable_v<container_type>) {
using std::swap;
swap(c, __s.c);
}
@@ -303,13 +303,15 @@ stack(from_range_t, _Range&&) -> stack<ranges::range_value_t<_Range>>;
template <class _InputIterator,
class _Alloc,
__enable_if_t<__has_input_iterator_category<_InputIterator>::value, int> = 0,
- __enable_if_t<__is_allocator<_Alloc>::value, int> = 0>
-stack(_InputIterator, _InputIterator, _Alloc)
- -> stack<__iter_value_type<_InputIterator>, deque<__iter_value_type<_InputIterator>, _Alloc>>;
+ __enable_if_t<__is_allocator<_Alloc>::value, int> = 0>
+stack(_InputIterator,
+ _InputIterator,
+ _Alloc) -> stack<__iter_value_type<_InputIterator>, deque<__iter_value_type<_InputIterator>, _Alloc>>;
template <ranges::input_range _Range, class _Alloc, __enable_if_t<__is_allocator<_Alloc>::value, int> = 0>
-stack(from_range_t, _Range&&, _Alloc)
- -> stack<ranges::range_value_t<_Range>, deque<ranges::range_value_t<_Range>, _Alloc>>;
+stack(from_range_t,
+ _Range&&,
+ _Alloc) -> stack<ranges::range_value_t<_Range>, deque<ranges::range_value_t<_Range>, _Alloc>>;
#endif
@@ -354,7 +356,7 @@ operator<=>(const stack<_Tp, _Container>& __x, const stack<_Tp, _Container>& __y
#endif
-template <class _Tp, class _Container, __enable_if_t<__is_swappable<_Container>::value, int> = 0>
+template <class _Tp, class _Container, __enable_if_t<__is_swappable_v<_Container>, int> = 0>
inline _LIBCPP_HIDE_FROM_ABI void swap(stack<_Tp, _Container>& __x, stack<_Tp, _Container>& __y)
_NOEXCEPT_(_NOEXCEPT_(__x.swap(__y))) {
__x.swap(__y);
diff --git a/libcxx/include/streambuf b/libcxx/include/streambuf
index a5b4ab9520ae..5a3c17ef7c99 100644
--- a/libcxx/include/streambuf
+++ b/libcxx/include/streambuf
@@ -137,7 +137,7 @@ public:
typedef typename traits_type::pos_type pos_type;
typedef typename traits_type::off_type off_type;
- static_assert((is_same<_CharT, typename traits_type::char_type>::value),
+ static_assert(is_same<_CharT, typename traits_type::char_type>::value,
"traits_type::char_type must be the same type as CharT");
virtual ~basic_streambuf();
diff --git a/libcxx/include/string b/libcxx/include/string
index 1db803e822d7..9a52ab6aef41 100644
--- a/libcxx/include/string
+++ b/libcxx/include/string
@@ -750,41 +750,37 @@ public:
void>;
#endif
#if !defined(_LIBCPP_HAS_NO_ASAN) && defined(_LIBCPP_INSTRUMENTED_WITH_ASAN)
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
- pointer __asan_volatile_wrapper(pointer const &__ptr) const {
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 pointer __asan_volatile_wrapper(pointer const& __ptr) const {
if (__libcpp_is_constant_evaluated())
return __ptr;
pointer volatile __copy_ptr = __ptr;
- return const_cast<pointer &>(__copy_ptr);
+ return const_cast<pointer&>(__copy_ptr);
}
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
- const_pointer __asan_volatile_wrapper(const_pointer const &__ptr) const {
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 const_pointer
+ __asan_volatile_wrapper(const_pointer const& __ptr) const {
if (__libcpp_is_constant_evaluated())
return __ptr;
const_pointer volatile __copy_ptr = __ptr;
- return const_cast<const_pointer &>(__copy_ptr);
+ return const_cast<const_pointer&>(__copy_ptr);
}
-#define _LIBCPP_ASAN_VOLATILE_WRAPPER(PTR) __asan_volatile_wrapper(PTR)
+# define _LIBCPP_ASAN_VOLATILE_WRAPPER(PTR) __asan_volatile_wrapper(PTR)
#else
-#define _LIBCPP_ASAN_VOLATILE_WRAPPER(PTR) PTR
+# define _LIBCPP_ASAN_VOLATILE_WRAPPER(PTR) PTR
#endif
- static_assert((!is_array<value_type>::value), "Character type of basic_string must not be an array");
- static_assert((is_standard_layout<value_type>::value), "Character type of basic_string must be standard-layout");
- static_assert((is_trivial<value_type>::value), "Character type of basic_string must be trivial");
- static_assert((is_same<_CharT, typename traits_type::char_type>::value),
+ static_assert(!is_array<value_type>::value, "Character type of basic_string must not be an array");
+ static_assert(is_standard_layout<value_type>::value, "Character type of basic_string must be standard-layout");
+ static_assert(is_trivial<value_type>::value, "Character type of basic_string must be trivial");
+ static_assert(is_same<_CharT, typename traits_type::char_type>::value,
"traits_type::char_type must be the same type as CharT");
- static_assert((is_same<typename allocator_type::value_type, value_type>::value),
+ static_assert(is_same<typename allocator_type::value_type, value_type>::value,
"Allocator::value_type must be same type as value_type");
-
- static_assert(is_same<allocator_type, __rebind_alloc<__alloc_traits, value_type> >::value,
- "[allocator.requirements] states that rebinding an allocator to the same type should result in the "
- "original allocator");
+ static_assert(__check_valid_allocator<allocator_type>::value, "");
// TODO: Implement iterator bounds checking without requiring the global database.
typedef __wrap_iter<pointer> iterator;
@@ -868,23 +864,9 @@ private:
static_assert(sizeof(__short) == (sizeof(value_type) * (__min_cap + 1)), "__short has an unexpected size.");
- union __ulx {
- __long __lx;
- __short __lxx;
- };
-
- enum { __n_words = sizeof(__ulx) / sizeof(size_type) };
-
- struct __raw {
- size_type __words[__n_words];
- };
-
- struct __rep {
- union {
- __short __s;
- __long __l;
- __raw __r;
- };
+ union __rep {
+ __short __s;
+ __long __l;
};
__compressed_pair<__rep, allocator_type> __r_;
@@ -1108,8 +1090,8 @@ public:
__enable_if_t<__can_be_converted_to_string_view<_CharT, _Traits, _Tp>::value &&
!__is_same_uncvref<_Tp, basic_string>::value,
int> = 0>
- _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS _LIBCPP_CONSTEXPR_SINCE_CXX20 explicit basic_string(
- const _Tp& __t, const allocator_type& __a)
+ _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS
+ _LIBCPP_CONSTEXPR_SINCE_CXX20 explicit basic_string(const _Tp& __t, const allocator_type& __a)
: __r_(__default_init_tag(), __a) {
__self_view __sv = __t;
__init(__sv.data(), __sv.size());
@@ -1176,8 +1158,8 @@ public:
}
#ifndef _LIBCPP_CXX03_LANG
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string& operator=(basic_string&& __str)
- _NOEXCEPT_(__noexcept_move_assign_container<_Allocator, __alloc_traits>::value) {
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string&
+ operator=(basic_string&& __str) noexcept(__noexcept_move_assign_container<_Allocator, __alloc_traits>::value) {
__move_assign(__str, integral_constant<bool, __alloc_traits::propagate_on_container_move_assignment::value>());
return *this;
}
@@ -1341,8 +1323,8 @@ public:
int> = 0>
_LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS _LIBCPP_CONSTEXPR_SINCE_CXX20
- basic_string&
- append(const _Tp& __t, size_type __pos, size_type __n = npos);
+ basic_string&
+ append(const _Tp& __t, size_type __pos, size_type __n = npos);
_LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string& append(const value_type* __s, size_type __n);
_LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string& append(const value_type* __s);
@@ -1433,8 +1415,8 @@ public:
return *this = __str;
}
#ifndef _LIBCPP_CXX03_LANG
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string& assign(basic_string&& __str)
- _NOEXCEPT_(__noexcept_move_assign_container<_Allocator, __alloc_traits>::value) {
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string&
+ assign(basic_string&& __str) noexcept(__noexcept_move_assign_container<_Allocator, __alloc_traits>::value) {
*this = std::move(__str);
return *this;
}
@@ -1643,7 +1625,7 @@ public:
#if _LIBCPP_STD_VER >= 14
_NOEXCEPT;
#else
- _NOEXCEPT_(!__alloc_traits::propagate_on_container_swap::value || __is_nothrow_swappable<allocator_type>::value);
+ _NOEXCEPT_(!__alloc_traits::propagate_on_container_swap::value || __is_nothrow_swappable_v<allocator_type>);
#endif
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 const value_type* c_str() const _NOEXCEPT { return data(); }
@@ -1924,10 +1906,12 @@ private:
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 const_pointer __get_long_pointer() const _NOEXCEPT {
return _LIBCPP_ASAN_VOLATILE_WRAPPER(__r_.first().__l.__data_);
}
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_STRING_INTERNAL_MEMORY_ACCESS pointer __get_short_pointer() _NOEXCEPT {
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_STRING_INTERNAL_MEMORY_ACCESS pointer
+ __get_short_pointer() _NOEXCEPT {
return _LIBCPP_ASAN_VOLATILE_WRAPPER(pointer_traits<pointer>::pointer_to(__r_.first().__s.__data_[0]));
}
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_STRING_INTERNAL_MEMORY_ACCESS const_pointer __get_short_pointer() const _NOEXCEPT {
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_STRING_INTERNAL_MEMORY_ACCESS const_pointer
+ __get_short_pointer() const _NOEXCEPT {
return _LIBCPP_ASAN_VOLATILE_WRAPPER(pointer_traits<const_pointer>::pointer_to(__r_.first().__s.__data_[0]));
}
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 pointer __get_pointer() _NOEXCEPT {
@@ -2023,15 +2007,15 @@ private:
_LIBCPP_CONSTEXPR_SINCE_CXX20
#if _LIBCPP_ABI_VERSION >= 2 // We want to use the function in the dylib in ABIv1
- _LIBCPP_HIDE_FROM_ABI
+ _LIBCPP_HIDE_FROM_ABI
#endif
- _LIBCPP_DEPRECATED_("use __grow_by_without_replace") void __grow_by(
- size_type __old_cap,
- size_type __delta_cap,
- size_type __old_sz,
- size_type __n_copy,
- size_type __n_del,
- size_type __n_add = 0);
+ _LIBCPP_DEPRECATED_("use __grow_by_without_replace") void __grow_by(
+ size_type __old_cap,
+ size_type __delta_cap,
+ size_type __old_sz,
+ size_type __n_copy,
+ size_type __n_del,
+ size_type __n_add = 0);
_LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI void __grow_by_without_replace(
size_type __old_cap,
size_type __delta_cap,
@@ -2094,14 +2078,14 @@ private:
__copy_assign_alloc(const basic_string&, false_type) _NOEXCEPT {}
#ifndef _LIBCPP_CXX03_LANG
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void __move_assign(basic_string& __str, false_type)
- _NOEXCEPT_(__alloc_traits::is_always_equal::value);
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void
+ __move_assign(basic_string& __str, false_type) noexcept(__alloc_traits::is_always_equal::value);
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_STRING_INTERNAL_MEMORY_ACCESS void
__move_assign(basic_string& __str, true_type)
# if _LIBCPP_STD_VER >= 17
- _NOEXCEPT;
+ noexcept;
# else
- _NOEXCEPT_(is_nothrow_move_assignable<allocator_type>::value);
+ noexcept(is_nothrow_move_assignable<allocator_type>::value);
# endif
#endif
@@ -2197,8 +2181,8 @@ template <class _CharT,
class _Traits,
class _Allocator = allocator<_CharT>,
class = enable_if_t<__is_allocator<_Allocator>::value> >
-explicit basic_string(basic_string_view<_CharT, _Traits>, const _Allocator& = _Allocator())
- -> basic_string<_CharT, _Traits, _Allocator>;
+explicit basic_string(basic_string_view<_CharT, _Traits>,
+ const _Allocator& = _Allocator()) -> basic_string<_CharT, _Traits, _Allocator>;
template <class _CharT,
class _Traits,
@@ -2433,15 +2417,15 @@ _LIBCPP_CONSTEXPR_SINCE_CXX20 void basic_string<_CharT, _Traits, _Allocator>::__
template <class _CharT, class _Traits, class _Allocator>
void _LIBCPP_CONSTEXPR_SINCE_CXX20
#if _LIBCPP_ABI_VERSION >= 2 // We want to use the function in the dylib in ABIv1
- _LIBCPP_HIDE_FROM_ABI
+_LIBCPP_HIDE_FROM_ABI
#endif
- _LIBCPP_DEPRECATED_("use __grow_by_without_replace") basic_string<_CharT, _Traits, _Allocator>::__grow_by(
- size_type __old_cap,
- size_type __delta_cap,
- size_type __old_sz,
- size_type __n_copy,
- size_type __n_del,
- size_type __n_add) {
+_LIBCPP_DEPRECATED_("use __grow_by_without_replace") basic_string<_CharT, _Traits, _Allocator>::__grow_by(
+ size_type __old_cap,
+ size_type __delta_cap,
+ size_type __old_sz,
+ size_type __n_copy,
+ size_type __n_del,
+ size_type __n_add) {
size_type __ms = max_size();
if (__delta_cap > __ms - __old_cap)
__throw_length_error();
@@ -2592,9 +2576,8 @@ basic_string<_CharT, _Traits, _Allocator>::operator=(const basic_string& __str)
#ifndef _LIBCPP_CXX03_LANG
template <class _CharT, class _Traits, class _Allocator>
-inline _LIBCPP_CONSTEXPR_SINCE_CXX20 void
-basic_string<_CharT, _Traits, _Allocator>::__move_assign(basic_string& __str, false_type)
- _NOEXCEPT_(__alloc_traits::is_always_equal::value) {
+inline _LIBCPP_CONSTEXPR_SINCE_CXX20 void basic_string<_CharT, _Traits, _Allocator>::__move_assign(
+ basic_string& __str, false_type) noexcept(__alloc_traits::is_always_equal::value) {
if (__alloc() != __str.__alloc())
assign(__str);
else
@@ -2605,9 +2588,9 @@ template <class _CharT, class _Traits, class _Allocator>
inline _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_STRING_INTERNAL_MEMORY_ACCESS void
basic_string<_CharT, _Traits, _Allocator>::__move_assign(basic_string& __str, true_type)
# if _LIBCPP_STD_VER >= 17
- _NOEXCEPT
+ noexcept
# else
- _NOEXCEPT_(is_nothrow_move_assignable<allocator_type>::value)
+ noexcept(is_nothrow_move_assignable<allocator_type>::value)
# endif
{
__annotate_delete();
@@ -3350,7 +3333,7 @@ inline _LIBCPP_CONSTEXPR_SINCE_CXX20 void basic_string<_CharT, _Traits, _Allocat
#if _LIBCPP_STD_VER >= 14
_NOEXCEPT
#else
- _NOEXCEPT_(!__alloc_traits::propagate_on_container_swap::value || __is_nothrow_swappable<allocator_type>::value)
+ _NOEXCEPT_(!__alloc_traits::propagate_on_container_swap::value || __is_nothrow_swappable_v<allocator_type>)
#endif
{
_LIBCPP_ASSERT_COMPATIBLE_ALLOCATOR(
@@ -3746,17 +3729,10 @@ template <class _Allocator>
inline _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI bool
operator==(const basic_string<char, char_traits<char>, _Allocator>& __lhs,
const basic_string<char, char_traits<char>, _Allocator>& __rhs) _NOEXCEPT {
- size_t __lhs_sz = __lhs.size();
- if (__lhs_sz != __rhs.size())
+ size_t __sz = __lhs.size();
+ if (__sz != __rhs.size())
return false;
- const char* __lp = __lhs.data();
- const char* __rp = __rhs.data();
- if (__lhs.__is_long())
- return char_traits<char>::compare(__lp, __rp, __lhs_sz) == 0;
- for (; __lhs_sz != 0; --__lhs_sz, ++__lp, ++__rp)
- if (*__lp != *__rp)
- return false;
- return true;
+ return char_traits<char>::compare(__lhs.data(), __rhs.data(), __sz) == 0;
}
#if _LIBCPP_STD_VER <= 17
diff --git a/libcxx/include/string_view b/libcxx/include/string_view
index 5c4bec742baf..b2a4db4e7519 100644
--- a/libcxx/include/string_view
+++ b/libcxx/include/string_view
@@ -293,10 +293,10 @@ public:
using difference_type = ptrdiff_t;
static _LIBCPP_CONSTEXPR const size_type npos = -1; // size_type(-1);
- static_assert((!is_array<value_type>::value), "Character type of basic_string_view must not be an array");
- static_assert((is_standard_layout<value_type>::value), "Character type of basic_string_view must be standard-layout");
- static_assert((is_trivial<value_type>::value), "Character type of basic_string_view must be trivial");
- static_assert((is_same<_CharT, typename traits_type::char_type>::value),
+ static_assert(!is_array<value_type>::value, "Character type of basic_string_view must not be an array");
+ static_assert(is_standard_layout<value_type>::value, "Character type of basic_string_view must be standard-layout");
+ static_assert(is_trivial<value_type>::value, "Character type of basic_string_view must be trivial");
+ static_assert(is_same<_CharT, typename traits_type::char_type>::value,
"traits_type::char_type must be the same type as CharT");
// [string.view.cons], construct/copy
@@ -394,9 +394,7 @@ public:
return numeric_limits<size_type>::max() / sizeof(value_type);
}
- _LIBCPP_NODISCARD _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR bool empty() const _NOEXCEPT {
- return __size_ == 0;
- }
+ _LIBCPP_NODISCARD _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR bool empty() const _NOEXCEPT { return __size_ == 0; }
// [string.view.access], element access
_LIBCPP_CONSTEXPR _LIBCPP_HIDE_FROM_ABI const_reference operator[](size_type __pos) const _NOEXCEPT {
@@ -904,32 +902,31 @@ struct hash<basic_string_view<wchar_t, char_traits<wchar_t> > > : __string_view_
#if _LIBCPP_STD_VER >= 14
inline namespace literals {
inline namespace string_view_literals {
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR basic_string_view<char>
-operator""sv(const char* __str, size_t __len) _NOEXCEPT {
+inline _LIBCPP_HIDE_FROM_ABI constexpr basic_string_view<char> operator""sv(const char* __str, size_t __len) noexcept {
return basic_string_view<char>(__str, __len);
}
# ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR basic_string_view<wchar_t>
-operator""sv(const wchar_t* __str, size_t __len) _NOEXCEPT {
+inline _LIBCPP_HIDE_FROM_ABI constexpr basic_string_view<wchar_t>
+operator""sv(const wchar_t* __str, size_t __len) noexcept {
return basic_string_view<wchar_t>(__str, __len);
}
# endif
# ifndef _LIBCPP_HAS_NO_CHAR8_T
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR basic_string_view<char8_t>
-operator""sv(const char8_t* __str, size_t __len) _NOEXCEPT {
+inline _LIBCPP_HIDE_FROM_ABI constexpr basic_string_view<char8_t>
+operator""sv(const char8_t* __str, size_t __len) noexcept {
return basic_string_view<char8_t>(__str, __len);
}
# endif
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR basic_string_view<char16_t>
-operator""sv(const char16_t* __str, size_t __len) _NOEXCEPT {
+inline _LIBCPP_HIDE_FROM_ABI constexpr basic_string_view<char16_t>
+operator""sv(const char16_t* __str, size_t __len) noexcept {
return basic_string_view<char16_t>(__str, __len);
}
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR basic_string_view<char32_t>
-operator""sv(const char32_t* __str, size_t __len) _NOEXCEPT {
+inline _LIBCPP_HIDE_FROM_ABI constexpr basic_string_view<char32_t>
+operator""sv(const char32_t* __str, size_t __len) noexcept {
return basic_string_view<char32_t>(__str, __len);
}
} // namespace string_view_literals
diff --git a/libcxx/include/strstream b/libcxx/include/strstream
index c8df6eb0da03..9ff4024a7c7e 100644
--- a/libcxx/include/strstream
+++ b/libcxx/include/strstream
@@ -141,18 +141,18 @@ private:
#if _LIBCPP_STD_VER < 26 || defined(_LIBCPP_ENABLE_CXX26_REMOVED_STRSTREAM) || defined(_LIBCPP_BUILDING_LIBRARY)
_LIBCPP_PUSH_MACROS
-#include <__undef_macros>
+# include <__undef_macros>
_LIBCPP_BEGIN_NAMESPACE_STD
class _LIBCPP_DEPRECATED _LIBCPP_EXPORTED_FROM_ABI strstreambuf : public streambuf {
public:
-#ifndef _LIBCPP_CXX03_LANG
+# ifndef _LIBCPP_CXX03_LANG
_LIBCPP_HIDE_FROM_ABI strstreambuf() : strstreambuf(0) {}
explicit strstreambuf(streamsize __alsize);
-#else
+# else
explicit strstreambuf(streamsize __alsize = 0);
-#endif
+# endif
strstreambuf(void* (*__palloc)(size_t), void (*__pfree)(void*));
strstreambuf(char* __gnext, streamsize __n, char* __pbeg = nullptr);
strstreambuf(const char* __gnext, streamsize __n);
@@ -162,10 +162,10 @@ public:
strstreambuf(unsigned char* __gnext, streamsize __n, unsigned char* __pbeg = nullptr);
strstreambuf(const unsigned char* __gnext, streamsize __n);
-#ifndef _LIBCPP_CXX03_LANG
+# ifndef _LIBCPP_CXX03_LANG
_LIBCPP_HIDE_FROM_ABI strstreambuf(strstreambuf&& __rhs);
_LIBCPP_HIDE_FROM_ABI strstreambuf& operator=(strstreambuf&& __rhs);
-#endif // _LIBCPP_CXX03_LANG
+# endif // _LIBCPP_CXX03_LANG
~strstreambuf() override;
@@ -199,7 +199,7 @@ private:
void __init(char* __gnext, streamsize __n, char* __pbeg);
};
-#ifndef _LIBCPP_CXX03_LANG
+# ifndef _LIBCPP_CXX03_LANG
inline _LIBCPP_HIDE_FROM_ABI strstreambuf::strstreambuf(strstreambuf&& __rhs)
: streambuf(__rhs),
@@ -228,7 +228,7 @@ inline _LIBCPP_HIDE_FROM_ABI strstreambuf& strstreambuf::operator=(strstreambuf&
return *this;
}
-#endif // _LIBCPP_CXX03_LANG
+# endif // _LIBCPP_CXX03_LANG
class _LIBCPP_DEPRECATED _LIBCPP_EXPORTED_FROM_ABI istrstream : public istream {
public:
@@ -237,7 +237,7 @@ public:
_LIBCPP_HIDE_FROM_ABI istrstream(const char* __s, streamsize __n) : istream(&__sb_), __sb_(__s, __n) {}
_LIBCPP_HIDE_FROM_ABI istrstream(char* __s, streamsize __n) : istream(&__sb_), __sb_(__s, __n) {}
-#ifndef _LIBCPP_CXX03_LANG
+# ifndef _LIBCPP_CXX03_LANG
_LIBCPP_HIDE_FROM_ABI istrstream(istrstream&& __rhs) // extension
: istream(std::move(static_cast<istream&>(__rhs))), __sb_(std::move(__rhs.__sb_)) {
istream::set_rdbuf(&__sb_);
@@ -248,7 +248,7 @@ public:
istream::operator=(std::move(__rhs));
return *this;
}
-#endif // _LIBCPP_CXX03_LANG
+# endif // _LIBCPP_CXX03_LANG
~istrstream() override;
@@ -270,7 +270,7 @@ public:
_LIBCPP_HIDE_FROM_ABI ostrstream(char* __s, int __n, ios_base::openmode __mode = ios_base::out)
: ostream(&__sb_), __sb_(__s, __n, __s + (__mode & ios::app ? std::strlen(__s) : 0)) {}
-#ifndef _LIBCPP_CXX03_LANG
+# ifndef _LIBCPP_CXX03_LANG
_LIBCPP_HIDE_FROM_ABI ostrstream(ostrstream&& __rhs) // extension
: ostream(std::move(static_cast<ostream&>(__rhs))), __sb_(std::move(__rhs.__sb_)) {
ostream::set_rdbuf(&__sb_);
@@ -281,7 +281,7 @@ public:
ostream::operator=(std::move(__rhs));
return *this;
}
-#endif // _LIBCPP_CXX03_LANG
+# endif // _LIBCPP_CXX03_LANG
~ostrstream() override;
@@ -312,7 +312,7 @@ public:
_LIBCPP_HIDE_FROM_ABI strstream(char* __s, int __n, ios_base::openmode __mode = ios_base::in | ios_base::out)
: iostream(&__sb_), __sb_(__s, __n, __s + (__mode & ios::app ? std::strlen(__s) : 0)) {}
-#ifndef _LIBCPP_CXX03_LANG
+# ifndef _LIBCPP_CXX03_LANG
_LIBCPP_HIDE_FROM_ABI strstream(strstream&& __rhs) // extension
: iostream(std::move(static_cast<iostream&>(__rhs))), __sb_(std::move(__rhs.__sb_)) {
iostream::set_rdbuf(&__sb_);
@@ -323,7 +323,7 @@ public:
iostream::operator=(std::move(__rhs));
return *this;
}
-#endif // _LIBCPP_CXX03_LANG
+# endif // _LIBCPP_CXX03_LANG
~strstream() override;
diff --git a/libcxx/include/tuple b/libcxx/include/tuple
index e7b43af7d13c..26652ffe81e9 100644
--- a/libcxx/include/tuple
+++ b/libcxx/include/tuple
@@ -240,6 +240,7 @@ template <class... Types>
#include <__type_traits/is_reference.h>
#include <__type_traits/is_same.h>
#include <__type_traits/is_swappable.h>
+#include <__type_traits/is_trivially_relocatable.h>
#include <__type_traits/lazy.h>
#include <__type_traits/maybe_const.h>
#include <__type_traits/nat.h>
@@ -278,15 +279,14 @@ class __tuple_leaf;
template <size_t _Ip, class _Hp, bool _Ep>
inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 void
-swap(__tuple_leaf<_Ip, _Hp, _Ep>& __x, __tuple_leaf<_Ip, _Hp, _Ep>& __y)
- _NOEXCEPT_(__is_nothrow_swappable<_Hp>::value) {
+swap(__tuple_leaf<_Ip, _Hp, _Ep>& __x, __tuple_leaf<_Ip, _Hp, _Ep>& __y) noexcept(__is_nothrow_swappable_v<_Hp>) {
swap(__x.get(), __y.get());
}
template <size_t _Ip, class _Hp, bool _Ep>
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 void
-swap(const __tuple_leaf<_Ip, _Hp, _Ep>& __x, const __tuple_leaf<_Ip, _Hp, _Ep>& __y)
- _NOEXCEPT_(__is_nothrow_swappable<const _Hp>::value) {
+swap(const __tuple_leaf<_Ip, _Hp, _Ep>& __x,
+ const __tuple_leaf<_Ip, _Hp, _Ep>& __y) noexcept(__is_nothrow_swappable_v<const _Hp>) {
swap(__x.get(), __y.get());
}
@@ -303,10 +303,10 @@ class __tuple_leaf {
# endif
}
+public:
_LIBCPP_CONSTEXPR_SINCE_CXX14 __tuple_leaf& operator=(const __tuple_leaf&) = delete;
-public:
- _LIBCPP_HIDE_FROM_ABI constexpr __tuple_leaf() _NOEXCEPT_(is_nothrow_default_constructible<_Hp>::value) : __value_() {
+ _LIBCPP_HIDE_FROM_ABI constexpr __tuple_leaf() noexcept(is_nothrow_default_constructible<_Hp>::value) : __value_() {
static_assert(!is_reference<_Hp>::value, "Attempted to default construct a reference element in a tuple");
}
@@ -326,34 +326,34 @@ public:
static_assert(!is_reference<_Hp>::value, "Attempted to default construct a reference element in a tuple");
}
- template <class _Tp,
- __enable_if_t<_And<_IsNotSame<__remove_cvref_t<_Tp>, __tuple_leaf>, is_constructible<_Hp, _Tp> >::value,
- int> = 0>
+ template <
+ class _Tp,
+ __enable_if_t<_And<_IsNotSame<__remove_cvref_t<_Tp>, __tuple_leaf>, is_constructible<_Hp, _Tp> >::value, int> = 0>
_LIBCPP_HIDE_FROM_ABI
- _LIBCPP_CONSTEXPR_SINCE_CXX14 explicit __tuple_leaf(_Tp&& __t) _NOEXCEPT_(is_nothrow_constructible<_Hp, _Tp>::value)
+ _LIBCPP_CONSTEXPR_SINCE_CXX14 explicit __tuple_leaf(_Tp&& __t) noexcept(is_nothrow_constructible<_Hp, _Tp>::value)
: __value_(std::forward<_Tp>(__t)) {
static_assert(__can_bind_reference<_Tp&&>(),
"Attempted construction of reference element binds to a temporary whose lifetime has ended");
}
template <class _Tp, class _Alloc>
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 explicit __tuple_leaf(
- integral_constant<int, 0>, const _Alloc&, _Tp&& __t)
+ _LIBCPP_HIDE_FROM_ABI
+ _LIBCPP_CONSTEXPR_SINCE_CXX14 explicit __tuple_leaf(integral_constant<int, 0>, const _Alloc&, _Tp&& __t)
: __value_(std::forward<_Tp>(__t)) {
static_assert(__can_bind_reference<_Tp&&>(),
"Attempted construction of reference element binds to a temporary whose lifetime has ended");
}
template <class _Tp, class _Alloc>
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 explicit __tuple_leaf(
- integral_constant<int, 1>, const _Alloc& __a, _Tp&& __t)
+ _LIBCPP_HIDE_FROM_ABI
+ _LIBCPP_CONSTEXPR_SINCE_CXX14 explicit __tuple_leaf(integral_constant<int, 1>, const _Alloc& __a, _Tp&& __t)
: __value_(allocator_arg_t(), __a, std::forward<_Tp>(__t)) {
static_assert(!is_reference<_Hp>::value, "Attempted to uses-allocator construct a reference element in a tuple");
}
template <class _Tp, class _Alloc>
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 explicit __tuple_leaf(
- integral_constant<int, 2>, const _Alloc& __a, _Tp&& __t)
+ _LIBCPP_HIDE_FROM_ABI
+ _LIBCPP_CONSTEXPR_SINCE_CXX14 explicit __tuple_leaf(integral_constant<int, 2>, const _Alloc& __a, _Tp&& __t)
: __value_(std::forward<_Tp>(__t), __a) {
static_assert(!is_reference<_Hp>::value, "Attempted to uses-allocator construct a reference element in a tuple");
}
@@ -361,14 +361,14 @@ public:
_LIBCPP_HIDE_FROM_ABI __tuple_leaf(const __tuple_leaf& __t) = default;
_LIBCPP_HIDE_FROM_ABI __tuple_leaf(__tuple_leaf&& __t) = default;
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 int swap(__tuple_leaf& __t)
- _NOEXCEPT_(__is_nothrow_swappable<__tuple_leaf>::value) {
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 int
+ swap(__tuple_leaf& __t) noexcept(__is_nothrow_swappable_v<__tuple_leaf>) {
std::swap(*this, __t);
return 0;
}
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 int swap(const __tuple_leaf& __t) const
- _NOEXCEPT_(__is_nothrow_swappable<const __tuple_leaf>::value) {
+ noexcept(__is_nothrow_swappable_v<const __tuple_leaf>) {
std::swap(*this, __t);
return 0;
}
@@ -379,10 +379,10 @@ public:
template <size_t _Ip, class _Hp>
class __tuple_leaf<_Ip, _Hp, true> : private _Hp {
+public:
_LIBCPP_CONSTEXPR_SINCE_CXX14 __tuple_leaf& operator=(const __tuple_leaf&) = delete;
-public:
- _LIBCPP_HIDE_FROM_ABI constexpr __tuple_leaf() _NOEXCEPT_(is_nothrow_default_constructible<_Hp>::value) {}
+ _LIBCPP_HIDE_FROM_ABI constexpr __tuple_leaf() noexcept(is_nothrow_default_constructible<_Hp>::value) {}
template <class _Alloc>
_LIBCPP_HIDE_FROM_ABI constexpr __tuple_leaf(integral_constant<int, 0>, const _Alloc&) {}
@@ -398,7 +398,7 @@ public:
__enable_if_t< _And< _IsNotSame<__remove_cvref_t<_Tp>, __tuple_leaf>, is_constructible<_Hp, _Tp> >::value,
int> = 0>
_LIBCPP_HIDE_FROM_ABI
- _LIBCPP_CONSTEXPR_SINCE_CXX14 explicit __tuple_leaf(_Tp&& __t) _NOEXCEPT_(is_nothrow_constructible<_Hp, _Tp>::value)
+ _LIBCPP_CONSTEXPR_SINCE_CXX14 explicit __tuple_leaf(_Tp&& __t) noexcept(is_nothrow_constructible<_Hp, _Tp>::value)
: _Hp(std::forward<_Tp>(__t)) {}
template <class _Tp, class _Alloc>
@@ -416,14 +416,14 @@ public:
__tuple_leaf(__tuple_leaf const&) = default;
__tuple_leaf(__tuple_leaf&&) = default;
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 int swap(__tuple_leaf& __t)
- _NOEXCEPT_(__is_nothrow_swappable<__tuple_leaf>::value) {
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 int
+ swap(__tuple_leaf& __t) noexcept(__is_nothrow_swappable_v<__tuple_leaf>) {
std::swap(*this, __t);
return 0;
}
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 int swap(const __tuple_leaf& __rhs) const
- _NOEXCEPT_(__is_nothrow_swappable<const __tuple_leaf>::value) {
+ noexcept(__is_nothrow_swappable_v<const __tuple_leaf>) {
std::swap(*this, __rhs);
return 0;
}
@@ -451,14 +451,17 @@ struct __tuple_impl;
template <size_t... _Indx, class... _Tp>
struct _LIBCPP_DECLSPEC_EMPTY_BASES __tuple_impl<__tuple_indices<_Indx...>, _Tp...>
: public __tuple_leaf<_Indx, _Tp>... {
- _LIBCPP_HIDE_FROM_ABI constexpr __tuple_impl()
- _NOEXCEPT_(__all<is_nothrow_default_constructible<_Tp>::value...>::value) {}
+ _LIBCPP_HIDE_FROM_ABI constexpr __tuple_impl() noexcept(
+ __all<is_nothrow_default_constructible<_Tp>::value...>::value) {}
template <size_t... _Uf, class... _Tf, size_t... _Ul, class... _Tl, class... _Up>
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 explicit __tuple_impl(
- __tuple_indices<_Uf...>, __tuple_types<_Tf...>, __tuple_indices<_Ul...>, __tuple_types<_Tl...>, _Up&&... __u)
- _NOEXCEPT_(__all<is_nothrow_constructible<_Tf, _Up>::value...>::value&&
- __all<is_nothrow_default_constructible<_Tl>::value...>::value)
+ __tuple_indices<_Uf...>,
+ __tuple_types<_Tf...>,
+ __tuple_indices<_Ul...>,
+ __tuple_types<_Tl...>,
+ _Up&&... __u) noexcept(__all<is_nothrow_constructible<_Tf, _Up>::value...>::value &&
+ __all<is_nothrow_default_constructible<_Tl>::value...>::value)
: __tuple_leaf<_Uf, _Tf>(std::forward<_Up>(__u))..., __tuple_leaf<_Ul, _Tl>()... {}
template <class _Alloc, size_t... _Uf, class... _Tf, size_t... _Ul, class... _Tl, class... _Up>
@@ -474,7 +477,7 @@ struct _LIBCPP_DECLSPEC_EMPTY_BASES __tuple_impl<__tuple_indices<_Indx...>, _Tp.
__tuple_leaf<_Ul, _Tl>(__uses_alloc_ctor<_Tl, _Alloc>(), __a)... {}
template <class _Tuple, __enable_if_t<__tuple_constructible<_Tuple, tuple<_Tp...> >::value, int> = 0>
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 __tuple_impl(_Tuple&& __t) _NOEXCEPT_(
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 __tuple_impl(_Tuple&& __t) noexcept(
(__all<is_nothrow_constructible<
_Tp,
typename tuple_element<_Indx, typename __make_tuple_types<_Tuple>::type>::type>::value...>::value))
@@ -495,13 +498,13 @@ struct _LIBCPP_DECLSPEC_EMPTY_BASES __tuple_impl<__tuple_indices<_Indx...>, _Tp.
__tuple_impl(const __tuple_impl&) = default;
__tuple_impl(__tuple_impl&&) = default;
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 void swap(__tuple_impl& __t)
- _NOEXCEPT_(__all<__is_nothrow_swappable<_Tp>::value...>::value) {
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 void
+ swap(__tuple_impl& __t) noexcept(__all<__is_nothrow_swappable_v<_Tp>...>::value) {
std::__swallow(__tuple_leaf<_Indx, _Tp>::swap(static_cast<__tuple_leaf<_Indx, _Tp>&>(__t))...);
}
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 void swap(const __tuple_impl& __t) const
- _NOEXCEPT_(__all<__is_nothrow_swappable<const _Tp>::value...>::value) {
+ noexcept(__all<__is_nothrow_swappable_v<const _Tp>...>::value) {
std::__swallow(__tuple_leaf<_Indx, _Tp>::swap(static_cast<const __tuple_leaf<_Indx, _Tp>&>(__t))...);
}
};
@@ -537,14 +540,16 @@ class _LIBCPP_TEMPLATE_VIS tuple {
get(const tuple<_Up...>&&) _NOEXCEPT;
public:
+ using __trivially_relocatable = __conditional_t<_And<__libcpp_is_trivially_relocatable<_Tp>...>::value, tuple, void>;
+
// [tuple.cnstr]
// tuple() constructors (including allocator_arg_t variants)
template <template <class...> class _IsImpDefault = __is_implicitly_default_constructible,
template <class...> class _IsDefault = is_default_constructible,
__enable_if_t< _And< _IsDefault<_Tp>... >::value, int> = 0>
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR explicit(_Not<_Lazy<_And, _IsImpDefault<_Tp>...> >::value) tuple()
- _NOEXCEPT_(_And<is_nothrow_default_constructible<_Tp>...>::value) {}
+ _LIBCPP_HIDE_FROM_ABI constexpr explicit(_Not<_Lazy<_And, _IsImpDefault<_Tp>...> >::value)
+ tuple() noexcept(_And<is_nothrow_default_constructible<_Tp>...>::value) {}
template <class _Alloc,
template <class...> class _IsImpDefault = __is_implicitly_default_constructible,
@@ -562,9 +567,9 @@ public:
// tuple(const T&...) constructors (including allocator_arg_t variants)
template <template <class...> class _And = _And,
__enable_if_t< _And< _BoolConstant<sizeof...(_Tp) >= 1>, is_copy_constructible<_Tp>... >::value, int> = 0>
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 explicit(
- _Not<_Lazy<_And, is_convertible<const _Tp&, _Tp>...> >::value) tuple(const _Tp&... __t)
- _NOEXCEPT_(_And<is_nothrow_copy_constructible<_Tp>...>::value)
+ _LIBCPP_HIDE_FROM_ABI
+ _LIBCPP_CONSTEXPR_SINCE_CXX14 explicit(_Not<_Lazy<_And, is_convertible<const _Tp&, _Tp>...> >::value)
+ tuple(const _Tp&... __t) noexcept(_And<is_nothrow_copy_constructible<_Tp>...>::value)
: __base_(typename __make_tuple_indices<sizeof...(_Tp)>::type(),
typename __make_tuple_types<tuple, sizeof...(_Tp)>::type(),
typename __make_tuple_indices<0>::type(),
@@ -574,8 +579,8 @@ public:
template <class _Alloc,
template <class...> class _And = _And,
__enable_if_t< _And< _BoolConstant<sizeof...(_Tp) >= 1>, is_copy_constructible<_Tp>... >::value, int> = 0>
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 explicit(
- _Not<_Lazy<_And, is_convertible<const _Tp&, _Tp>...> >::value)
+ _LIBCPP_HIDE_FROM_ABI
+ _LIBCPP_CONSTEXPR_SINCE_CXX20 explicit(_Not<_Lazy<_And, is_convertible<const _Tp&, _Tp>...> >::value)
tuple(allocator_arg_t, const _Alloc& __a, const _Tp&... __t)
: __base_(allocator_arg_t(),
__a,
@@ -601,7 +606,7 @@ public:
__enable_if_t< _And< _BoolConstant<sizeof...(_Up) == sizeof...(_Tp)>, _EnableUTypesCtor<_Up...> >::value,
int> = 0>
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 explicit(_Not<_Lazy<_And, is_convertible<_Up, _Tp>...> >::value)
- tuple(_Up&&... __u) _NOEXCEPT_(_And<is_nothrow_constructible<_Tp, _Up>...>::value)
+ tuple(_Up&&... __u) noexcept(_And<is_nothrow_constructible<_Tp, _Up>...>::value)
: __base_(typename __make_tuple_indices<sizeof...(_Up)>::type(),
typename __make_tuple_types<tuple, sizeof...(_Up)>::type(),
typename __make_tuple_indices<sizeof...(_Tp), sizeof...(_Up)>::type(),
@@ -666,16 +671,16 @@ public:
_Not<is_constructible<_Tp, _OtherTuple> >... > > > {};
template <class... _Up, __enable_if_t< _And< _EnableCtorFromUTypesTuple<const tuple<_Up...>&> >::value, int> = 0>
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 explicit(
- _Not<_Lazy<_And, is_convertible<const _Up&, _Tp>...> >::value) tuple(const tuple<_Up...>& __t)
- _NOEXCEPT_(_And<is_nothrow_constructible<_Tp, const _Up&>...>::value)
+ _LIBCPP_HIDE_FROM_ABI
+ _LIBCPP_CONSTEXPR_SINCE_CXX14 explicit(_Not<_Lazy<_And, is_convertible<const _Up&, _Tp>...> >::value)
+ tuple(const tuple<_Up...>& __t) noexcept(_And<is_nothrow_constructible<_Tp, const _Up&>...>::value)
: __base_(__t) {}
template <class... _Up,
class _Alloc,
__enable_if_t< _And< _EnableCtorFromUTypesTuple<const tuple<_Up...>&> >::value, int> = 0>
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 explicit(
- _Not<_Lazy<_And, is_convertible<const _Up&, _Tp>...> >::value)
+ _LIBCPP_HIDE_FROM_ABI
+ _LIBCPP_CONSTEXPR_SINCE_CXX20 explicit(_Not<_Lazy<_And, is_convertible<const _Up&, _Tp>...> >::value)
tuple(allocator_arg_t, const _Alloc& __a, const tuple<_Up...>& __t)
: __base_(allocator_arg_t(), __a, __t) {}
@@ -695,7 +700,7 @@ public:
// tuple(tuple<U...>&&) constructors (including allocator_arg_t variants)
template <class... _Up, __enable_if_t< _And< _EnableCtorFromUTypesTuple<tuple<_Up...>&&> >::value, int> = 0>
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 explicit(_Not<_Lazy<_And, is_convertible<_Up, _Tp>...> >::value)
- tuple(tuple<_Up...>&& __t) _NOEXCEPT_(_And<is_nothrow_constructible<_Tp, _Up>...>::value)
+ tuple(tuple<_Up...>&& __t) noexcept(_And<is_nothrow_constructible<_Tp, _Up>...>::value)
: __base_(std::move(__t)) {}
template <class _Alloc,
@@ -750,9 +755,9 @@ public:
class _Up2,
template <class...> class _And = _And,
__enable_if_t< _And< _EnableCtorFromPair<const pair<_Up1, _Up2>&> >::value, int> = 0>
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 explicit(
- _Not<_BothImplicitlyConvertible<const pair<_Up1, _Up2>&> >::value) tuple(const pair<_Up1, _Up2>& __p)
- _NOEXCEPT_(_NothrowConstructibleFromPair<const pair<_Up1, _Up2>&>::value)
+ _LIBCPP_HIDE_FROM_ABI
+ _LIBCPP_CONSTEXPR_SINCE_CXX14 explicit(_Not<_BothImplicitlyConvertible<const pair<_Up1, _Up2>&> >::value)
+ tuple(const pair<_Up1, _Up2>& __p) noexcept(_NothrowConstructibleFromPair<const pair<_Up1, _Up2>&>::value)
: __base_(__p) {}
template <class _Alloc,
@@ -760,8 +765,8 @@ public:
class _Up2,
template <class...> class _And = _And,
__enable_if_t< _And< _EnableCtorFromPair<const pair<_Up1, _Up2>&> >::value, int> = 0>
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 explicit(
- _Not<_BothImplicitlyConvertible<const pair<_Up1, _Up2>&> >::value)
+ _LIBCPP_HIDE_FROM_ABI
+ _LIBCPP_CONSTEXPR_SINCE_CXX20 explicit(_Not<_BothImplicitlyConvertible<const pair<_Up1, _Up2>&> >::value)
tuple(allocator_arg_t, const _Alloc& __a, const pair<_Up1, _Up2>& __p)
: __base_(allocator_arg_t(), __a, __p) {}
@@ -788,9 +793,9 @@ public:
class _Up2,
template <class...> class _And = _And,
__enable_if_t< _And< _EnableCtorFromPair<pair<_Up1, _Up2>&&> >::value, int> = 0>
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 explicit(
- _Not<_BothImplicitlyConvertible<pair<_Up1, _Up2>&&> >::value) tuple(pair<_Up1, _Up2>&& __p)
- _NOEXCEPT_(_NothrowConstructibleFromPair<pair<_Up1, _Up2>&&>::value)
+ _LIBCPP_HIDE_FROM_ABI
+ _LIBCPP_CONSTEXPR_SINCE_CXX14 explicit(_Not<_BothImplicitlyConvertible<pair<_Up1, _Up2>&&> >::value)
+ tuple(pair<_Up1, _Up2>&& __p) noexcept(_NothrowConstructibleFromPair<pair<_Up1, _Up2>&&>::value)
: __base_(std::move(__p)) {}
template <class _Alloc,
@@ -798,8 +803,8 @@ public:
class _Up2,
template <class...> class _And = _And,
__enable_if_t< _And< _EnableCtorFromPair<pair<_Up1, _Up2>&&> >::value, int> = 0>
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 explicit(
- _Not<_BothImplicitlyConvertible<pair<_Up1, _Up2>&&> >::value)
+ _LIBCPP_HIDE_FROM_ABI
+ _LIBCPP_CONSTEXPR_SINCE_CXX20 explicit(_Not<_BothImplicitlyConvertible<pair<_Up1, _Up2>&&> >::value)
tuple(allocator_arg_t, const _Alloc& __a, pair<_Up1, _Up2>&& __p)
: __base_(allocator_arg_t(), __a, std::move(__p)) {}
@@ -823,7 +828,7 @@ public:
// [tuple.assign]
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 tuple&
operator=(_If<_And<is_copy_assignable<_Tp>...>::value, tuple, __nat> const& __tuple)
- _NOEXCEPT_(_And<is_nothrow_copy_assignable<_Tp>...>::value) {
+ noexcept(_And<is_nothrow_copy_assignable<_Tp>...>::value) {
std::__memberwise_copy_assign(*this, __tuple, typename __make_tuple_indices<sizeof...(_Tp)>::type());
return *this;
}
@@ -847,7 +852,7 @@ public:
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 tuple&
operator=(_If<_And<is_move_assignable<_Tp>...>::value, tuple, __nat>&& __tuple)
- _NOEXCEPT_(_And<is_nothrow_move_assignable<_Tp>...>::value) {
+ noexcept(_And<is_nothrow_move_assignable<_Tp>...>::value) {
std::__memberwise_forward_assign(
*this, std::move(__tuple), __tuple_types<_Tp...>(), typename __make_tuple_indices<sizeof...(_Tp)>::type());
return *this;
@@ -858,7 +863,7 @@ public:
__enable_if_t< _And< _BoolConstant<sizeof...(_Tp) == sizeof...(_Up)>, is_assignable<_Tp&, _Up const&>... >::value,
int> = 0>
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 tuple& operator=(tuple<_Up...> const& __tuple)
- _NOEXCEPT_(_And<is_nothrow_assignable<_Tp&, _Up const&>...>::value) {
+ noexcept(_And<is_nothrow_assignable<_Tp&, _Up const&>...>::value) {
std::__memberwise_copy_assign(*this, __tuple, typename __make_tuple_indices<sizeof...(_Tp)>::type());
return *this;
}
@@ -867,7 +872,7 @@ public:
__enable_if_t< _And< _BoolConstant<sizeof...(_Tp) == sizeof...(_Up)>, is_assignable<_Tp&, _Up>... >::value,
int> = 0>
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 tuple& operator=(tuple<_Up...>&& __tuple)
- _NOEXCEPT_(_And<is_nothrow_assignable<_Tp&, _Up>...>::value) {
+ noexcept(_And<is_nothrow_assignable<_Tp&, _Up>...>::value) {
std::__memberwise_forward_assign(
*this, std::move(__tuple), __tuple_types<_Up...>(), typename __make_tuple_indices<sizeof...(_Tp)>::type());
return *this;
@@ -932,7 +937,7 @@ public:
class _Up2,
__enable_if_t< _EnableAssignFromPair<false, pair<_Up1, _Up2> const&>::value, int> = 0>
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 tuple& operator=(pair<_Up1, _Up2> const& __pair)
- _NOEXCEPT_(_NothrowAssignFromPair<false, pair<_Up1, _Up2> const&>::value) {
+ noexcept(_NothrowAssignFromPair<false, pair<_Up1, _Up2> const&>::value) {
std::get<0>(*this) = __pair.first;
std::get<1>(*this) = __pair.second;
return *this;
@@ -940,7 +945,7 @@ public:
template <class _Up1, class _Up2, __enable_if_t< _EnableAssignFromPair<false, pair<_Up1, _Up2>&&>::value, int> = 0>
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 tuple& operator=(pair<_Up1, _Up2>&& __pair)
- _NOEXCEPT_(_NothrowAssignFromPair<false, pair<_Up1, _Up2>&&>::value) {
+ noexcept(_NothrowAssignFromPair<false, pair<_Up1, _Up2>&&>::value) {
std::get<0>(*this) = std::forward<_Up1>(__pair.first);
std::get<1>(*this) = std::forward<_Up2>(__pair.second);
return *this;
@@ -952,7 +957,7 @@ public:
size_t _Np,
__enable_if_t< _And< _BoolConstant<_Np == sizeof...(_Tp)>, is_assignable<_Tp&, _Up const&>... >::value, int> = 0>
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 tuple& operator=(array<_Up, _Np> const& __array)
- _NOEXCEPT_(_And<is_nothrow_assignable<_Tp&, _Up const&>...>::value) {
+ noexcept(_And<is_nothrow_assignable<_Tp&, _Up const&>...>::value) {
std::__memberwise_copy_assign(*this, __array, typename __make_tuple_indices<sizeof...(_Tp)>::type());
return *this;
}
@@ -963,7 +968,7 @@ public:
class = void,
__enable_if_t< _And< _BoolConstant<_Np == sizeof...(_Tp)>, is_assignable<_Tp&, _Up>... >::value, int> = 0>
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 tuple& operator=(array<_Up, _Np>&& __array)
- _NOEXCEPT_(_And<is_nothrow_assignable<_Tp&, _Up>...>::value) {
+ noexcept(_And<is_nothrow_assignable<_Tp&, _Up>...>::value) {
std::__memberwise_forward_assign(
*this,
std::move(__array),
@@ -974,7 +979,7 @@ public:
// [tuple.swap]
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void swap(tuple& __t)
- _NOEXCEPT_(__all<__is_nothrow_swappable<_Tp>::value...>::value) {
+ noexcept(__all<__is_nothrow_swappable_v<_Tp>...>::value) {
__base_.swap(__t.__base_);
}
@@ -1031,9 +1036,9 @@ template <class _Alloc, class... _Tp>
tuple(allocator_arg_t, _Alloc, tuple<_Tp...>) -> tuple<_Tp...>;
# endif
-template <class... _Tp, __enable_if_t<__all<__is_swappable<_Tp>::value...>::value, int> = 0>
+template <class... _Tp, __enable_if_t<__all<__is_swappable_v<_Tp>...>::value, int> = 0>
inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void swap(tuple<_Tp...>& __t, tuple<_Tp...>& __u)
- _NOEXCEPT_(__all<__is_nothrow_swappable<_Tp>::value...>::value) {
+ noexcept(__all<__is_nothrow_swappable_v<_Tp>...>::value) {
__t.swap(__u);
}
@@ -1312,8 +1317,8 @@ template <class... _Types, size_t... _I0, size_t... _J0>
struct __tuple_cat<tuple<_Types...>, __tuple_indices<_I0...>, __tuple_indices<_J0...> > {
template <class _Tuple0>
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14
- typename __tuple_cat_return_ref<tuple<_Types...>&&, _Tuple0&&>::type
- operator()(tuple<_Types...> __t, _Tuple0&& __t0) {
+ typename __tuple_cat_return_ref<tuple<_Types...>&&, _Tuple0&&>::type
+ operator()(tuple<_Types...> __t, _Tuple0&& __t0) {
(void)__t; // avoid unused parameter warning on GCC when _I0 is empty
return std::forward_as_tuple(
std::forward<_Types>(std::get<_I0>(__t))..., std::get<_J0>(std::forward<_Tuple0>(__t0))...);
@@ -1321,8 +1326,8 @@ struct __tuple_cat<tuple<_Types...>, __tuple_indices<_I0...>, __tuple_indices<_J
template <class _Tuple0, class _Tuple1, class... _Tuples>
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14
- typename __tuple_cat_return_ref<tuple<_Types...>&&, _Tuple0&&, _Tuple1&&, _Tuples&&...>::type
- operator()(tuple<_Types...> __t, _Tuple0&& __t0, _Tuple1&& __t1, _Tuples&&... __tpls) {
+ typename __tuple_cat_return_ref<tuple<_Types...>&&, _Tuple0&&, _Tuple1&&, _Tuples&&...>::type
+ operator()(tuple<_Types...> __t, _Tuple0&& __t0, _Tuple1&& __t1, _Tuples&&... __tpls) {
(void)__t; // avoid unused parameter warning on GCC when _I0 is empty
typedef _LIBCPP_NODEBUG __libcpp_remove_reference_t<_Tuple0> _T0;
typedef _LIBCPP_NODEBUG __libcpp_remove_reference_t<_Tuple1> _T1;
diff --git a/libcxx/include/unordered_map b/libcxx/include/unordered_map
index 2e25b0f05069..7c31c4fce26b 100644
--- a/libcxx/include/unordered_map
+++ b/libcxx/include/unordered_map
@@ -650,7 +650,7 @@ public:
return static_cast<const _Hash&>(*this)(__x);
}
#endif
- _LIBCPP_HIDE_FROM_ABI void swap(__unordered_map_hasher& __y) _NOEXCEPT_(__is_nothrow_swappable<_Hash>::value) {
+ _LIBCPP_HIDE_FROM_ABI void swap(__unordered_map_hasher& __y) _NOEXCEPT_(__is_nothrow_swappable_v<_Hash>) {
using std::swap;
swap(static_cast<_Hash&>(*this), static_cast<_Hash&>(__y));
}
@@ -674,7 +674,7 @@ public:
return __hash_(__x);
}
#endif
- _LIBCPP_HIDE_FROM_ABI void swap(__unordered_map_hasher& __y) _NOEXCEPT_(__is_nothrow_swappable<_Hash>::value) {
+ _LIBCPP_HIDE_FROM_ABI void swap(__unordered_map_hasher& __y) _NOEXCEPT_(__is_nothrow_swappable_v<_Hash>) {
using std::swap;
swap(__hash_, __y.__hash_);
}
@@ -725,7 +725,7 @@ public:
return static_cast<const _Pred&>(*this)(__x, __y);
}
#endif
- _LIBCPP_HIDE_FROM_ABI void swap(__unordered_map_equal& __y) _NOEXCEPT_(__is_nothrow_swappable<_Pred>::value) {
+ _LIBCPP_HIDE_FROM_ABI void swap(__unordered_map_equal& __y) _NOEXCEPT_(__is_nothrow_swappable_v<_Pred>) {
using std::swap;
swap(static_cast<_Pred&>(*this), static_cast<_Pred&>(__y));
}
@@ -768,7 +768,7 @@ public:
return __pred_(__x, __y);
}
#endif
- _LIBCPP_HIDE_FROM_ABI void swap(__unordered_map_equal& __y) _NOEXCEPT_(__is_nothrow_swappable<_Pred>::value) {
+ _LIBCPP_HIDE_FROM_ABI void swap(__unordered_map_equal& __y) _NOEXCEPT_(__is_nothrow_swappable_v<_Pred>) {
using std::swap;
swap(__pred_, __y.__pred_);
}
@@ -792,12 +792,12 @@ public:
private:
allocator_type& __na_;
- __hash_map_node_destructor& operator=(const __hash_map_node_destructor&);
-
public:
bool __first_constructed;
bool __second_constructed;
+ __hash_map_node_destructor& operator=(const __hash_map_node_destructor&) = delete;
+
_LIBCPP_HIDE_FROM_ABI explicit __hash_map_node_destructor(allocator_type& __na) _NOEXCEPT
: __na_(__na),
__first_constructed(false),
@@ -882,7 +882,6 @@ public:
return *this;
}
-private:
__hash_value_type(const __hash_value_type& __v) = delete;
__hash_value_type(__hash_value_type&& __v) = delete;
template <class... _Args>
@@ -906,8 +905,7 @@ public:
_LIBCPP_HIDE_FROM_ABI value_type& __get_value() { return __cc_; }
_LIBCPP_HIDE_FROM_ABI const value_type& __get_value() const { return __cc_; }
-private:
- ~__hash_value_type();
+ ~__hash_value_type() = delete;
};
#endif
@@ -1036,7 +1034,7 @@ public:
typedef pair<const key_type, mapped_type> value_type;
typedef value_type& reference;
typedef const value_type& const_reference;
- static_assert((is_same<value_type, typename allocator_type::value_type>::value),
+ static_assert(is_same<value_type, typename allocator_type::value_type>::value,
"Allocator::value_type must be same type as value_type");
private:
@@ -1059,12 +1057,10 @@ private:
typedef unique_ptr<__node, _Dp> __node_holder;
typedef allocator_traits<allocator_type> __alloc_traits;
- static_assert(is_same<allocator_type, __rebind_alloc<__alloc_traits, value_type> >::value,
- "[allocator.requirements] states that rebinding an allocator to the same type should result in the "
- "original allocator");
+ static_assert(__check_valid_allocator<allocator_type>::value, "");
- static_assert((is_same<typename __table::__container_value_type, value_type>::value), "");
- static_assert((is_same<typename __table::__node_value_type, __value_type>::value), "");
+ static_assert(is_same<typename __table::__container_value_type, value_type>::value, "");
+ static_assert(is_same<typename __table::__node_value_type, __value_type>::value, "");
public:
typedef typename __alloc_traits::pointer pointer;
@@ -1373,7 +1369,7 @@ public:
}
#endif
- _LIBCPP_HIDE_FROM_ABI void swap(unordered_map& __u) _NOEXCEPT_(__is_nothrow_swappable<__table>::value) {
+ _LIBCPP_HIDE_FROM_ABI void swap(unordered_map& __u) _NOEXCEPT_(__is_nothrow_swappable_v<__table>) {
__table_.swap(__u.__table_);
}
@@ -1417,13 +1413,11 @@ public:
return __table_.__equal_range_unique(__k);
}
#if _LIBCPP_STD_VER >= 20
- template <class _K2,
- enable_if_t<__is_transparent_v<hasher, _K2> && __is_transparent_v<key_equal, _K2>>* = nullptr>
+ template <class _K2, enable_if_t<__is_transparent_v<hasher, _K2> && __is_transparent_v<key_equal, _K2>>* = nullptr>
_LIBCPP_HIDE_FROM_ABI pair<iterator, iterator> equal_range(const _K2& __k) {
return __table_.__equal_range_unique(__k);
}
- template <class _K2,
- enable_if_t<__is_transparent_v<hasher, _K2> && __is_transparent_v<key_equal, _K2>>* = nullptr>
+ template <class _K2, enable_if_t<__is_transparent_v<hasher, _K2> && __is_transparent_v<key_equal, _K2>>* = nullptr>
_LIBCPP_HIDE_FROM_ABI pair<const_iterator, const_iterator> equal_range(const _K2& __k) const {
return __table_.__equal_range_unique(__k);
}
@@ -1843,7 +1837,8 @@ public:
typedef pair<const key_type, mapped_type> value_type;
typedef value_type& reference;
typedef const value_type& const_reference;
- static_assert((is_same<value_type, typename allocator_type::value_type>::value),
+ static_assert(__check_valid_allocator<allocator_type>::value, "");
+ static_assert(is_same<value_type, typename allocator_type::value_type>::value,
"Allocator::value_type must be same type as value_type");
private:
@@ -1863,13 +1858,9 @@ private:
typedef __hash_map_node_destructor<__node_allocator> _Dp;
typedef unique_ptr<__node, _Dp> __node_holder;
typedef allocator_traits<allocator_type> __alloc_traits;
- static_assert((is_same<typename __node_traits::size_type, typename __alloc_traits::size_type>::value),
+ static_assert(is_same<typename __node_traits::size_type, typename __alloc_traits::size_type>::value,
"Allocator uses different size_type for different types");
- static_assert(is_same<allocator_type, __rebind_alloc<__alloc_traits, value_type> >::value,
- "[allocator.requirements] states that rebinding an allocator to the same type should result in the "
- "original allocator");
-
public:
typedef typename __alloc_traits::pointer pointer;
typedef typename __alloc_traits::const_pointer const_pointer;
@@ -2120,7 +2111,7 @@ public:
}
#endif
- _LIBCPP_HIDE_FROM_ABI void swap(unordered_multimap& __u) _NOEXCEPT_(__is_nothrow_swappable<__table>::value) {
+ _LIBCPP_HIDE_FROM_ABI void swap(unordered_multimap& __u) _NOEXCEPT_(__is_nothrow_swappable_v<__table>) {
__table_.swap(__u.__table_);
}
@@ -2164,13 +2155,11 @@ public:
return __table_.__equal_range_multi(__k);
}
#if _LIBCPP_STD_VER >= 20
- template <class _K2,
- enable_if_t<__is_transparent_v<hasher, _K2> && __is_transparent_v<key_equal, _K2>>* = nullptr>
+ template <class _K2, enable_if_t<__is_transparent_v<hasher, _K2> && __is_transparent_v<key_equal, _K2>>* = nullptr>
_LIBCPP_HIDE_FROM_ABI pair<iterator, iterator> equal_range(const _K2& __k) {
return __table_.__equal_range_multi(__k);
}
- template <class _K2,
- enable_if_t<__is_transparent_v<hasher, _K2> && __is_transparent_v<key_equal, _K2>>* = nullptr>
+ template <class _K2, enable_if_t<__is_transparent_v<hasher, _K2> && __is_transparent_v<key_equal, _K2>>* = nullptr>
_LIBCPP_HIDE_FROM_ABI pair<const_iterator, const_iterator> equal_range(const _K2& __k) const {
return __table_.__equal_range_multi(__k);
}
@@ -2245,12 +2234,12 @@ template <class _Key,
class = enable_if_t<!is_integral<_Hash>::value>,
class = enable_if_t<!__is_allocator<_Pred>::value>,
class = enable_if_t<__is_allocator<_Allocator>::value>>
-unordered_multimap(initializer_list<pair<_Key, _Tp>>,
- typename allocator_traits<_Allocator>::size_type = 0,
- _Hash = _Hash(),
- _Pred = _Pred(),
- _Allocator = _Allocator())
- -> unordered_multimap<remove_const_t<_Key>, _Tp, _Hash, _Pred, _Allocator>;
+unordered_multimap(
+ initializer_list<pair<_Key, _Tp>>,
+ typename allocator_traits<_Allocator>::size_type = 0,
+ _Hash = _Hash(),
+ _Pred = _Pred(),
+ _Allocator = _Allocator()) -> unordered_multimap<remove_const_t<_Key>, _Tp, _Hash, _Pred, _Allocator>;
template <class _InputIterator,
class _Allocator,
diff --git a/libcxx/include/unordered_set b/libcxx/include/unordered_set
index c966cc8eb4df..3297294a893f 100644
--- a/libcxx/include/unordered_set
+++ b/libcxx/include/unordered_set
@@ -588,13 +588,10 @@ public:
typedef __type_identity_t<_Alloc> allocator_type;
typedef value_type& reference;
typedef const value_type& const_reference;
- static_assert((is_same<value_type, typename allocator_type::value_type>::value),
+ static_assert(__check_valid_allocator<allocator_type>::value, "");
+ static_assert(is_same<value_type, typename allocator_type::value_type>::value,
"Allocator::value_type must be same type as value_type");
- static_assert(is_same<allocator_type, __rebind_alloc<allocator_traits<allocator_type>, value_type> >::value,
- "[allocator.requirements] states that rebinding an allocator to the same type should result in the "
- "original allocator");
-
private:
typedef __hash_table<value_type, hasher, key_equal, allocator_type> __table;
@@ -828,7 +825,7 @@ public:
}
#endif
- _LIBCPP_HIDE_FROM_ABI void swap(unordered_set& __u) _NOEXCEPT_(__is_nothrow_swappable<__table>::value) {
+ _LIBCPP_HIDE_FROM_ABI void swap(unordered_set& __u) _NOEXCEPT_(__is_nothrow_swappable_v<__table>) {
__table_.swap(__u.__table_);
}
@@ -928,13 +925,13 @@ template <ranges::input_range _Range,
class = enable_if_t<!is_integral<_Hash>::value>,
class = enable_if_t<!__is_allocator<_Pred>::value>,
class = enable_if_t<__is_allocator<_Allocator>::value>>
-unordered_set(from_range_t,
- _Range&&,
- typename allocator_traits<_Allocator>::size_type = 0,
- _Hash = _Hash(),
- _Pred = _Pred(),
- _Allocator = _Allocator())
- -> unordered_set<ranges::range_value_t<_Range>, _Hash, _Pred, _Allocator>; // C++23
+unordered_set(
+ from_range_t,
+ _Range&&,
+ typename allocator_traits<_Allocator>::size_type = 0,
+ _Hash = _Hash(),
+ _Pred = _Pred(),
+ _Allocator = _Allocator()) -> unordered_set<ranges::range_value_t<_Range>, _Hash, _Pred, _Allocator>; // C++23
# endif
template <class _Tp,
@@ -1186,7 +1183,7 @@ public:
typedef __type_identity_t<_Alloc> allocator_type;
typedef value_type& reference;
typedef const value_type& const_reference;
- static_assert((is_same<value_type, typename allocator_type::value_type>::value),
+ static_assert(is_same<value_type, typename allocator_type::value_type>::value,
"Allocator::value_type must be same type as value_type");
private:
@@ -1425,7 +1422,7 @@ public:
}
_LIBCPP_HIDE_FROM_ABI void clear() _NOEXCEPT { __table_.clear(); }
- _LIBCPP_HIDE_FROM_ABI void swap(unordered_multiset& __u) _NOEXCEPT_(__is_nothrow_swappable<__table>::value) {
+ _LIBCPP_HIDE_FROM_ABI void swap(unordered_multiset& __u) _NOEXCEPT_(__is_nothrow_swappable_v<__table>) {
__table_.swap(__u.__table_);
}
diff --git a/libcxx/include/valarray b/libcxx/include/valarray
index 3d45925a25be..44341eb2ba6c 100644
--- a/libcxx/include/valarray
+++ b/libcxx/include/valarray
@@ -2667,8 +2667,8 @@ operator*(const _Expr1& __x, const _Expr2& __y) {
template <class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> = 0>
inline _LIBCPP_HIDE_FROM_ABI
- __val_expr<_BinaryOp<multiplies<typename _Expr::value_type>, _Expr, __scalar_expr<typename _Expr::value_type> > >
- operator*(const _Expr& __x, const typename _Expr::value_type& __y) {
+__val_expr<_BinaryOp<multiplies<typename _Expr::value_type>, _Expr, __scalar_expr<typename _Expr::value_type> > >
+operator*(const _Expr& __x, const typename _Expr::value_type& __y) {
typedef typename _Expr::value_type value_type;
typedef _BinaryOp<multiplies<value_type>, _Expr, __scalar_expr<value_type> > _Op;
return __val_expr<_Op>(_Op(multiplies<value_type>(), __x, __scalar_expr<value_type>(__y, __x.size())));
@@ -2676,8 +2676,8 @@ inline _LIBCPP_HIDE_FROM_ABI
template <class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> = 0>
inline _LIBCPP_HIDE_FROM_ABI
- __val_expr<_BinaryOp<multiplies<typename _Expr::value_type>, __scalar_expr<typename _Expr::value_type>, _Expr> >
- operator*(const typename _Expr::value_type& __x, const _Expr& __y) {
+__val_expr<_BinaryOp<multiplies<typename _Expr::value_type>, __scalar_expr<typename _Expr::value_type>, _Expr> >
+operator*(const typename _Expr::value_type& __x, const _Expr& __y) {
typedef typename _Expr::value_type value_type;
typedef _BinaryOp<multiplies<value_type>, __scalar_expr<value_type>, _Expr> _Op;
return __val_expr<_Op>(_Op(multiplies<value_type>(), __scalar_expr<value_type>(__x, __y.size()), __y));
@@ -2695,8 +2695,8 @@ operator/(const _Expr1& __x, const _Expr2& __y) {
template <class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> = 0>
inline _LIBCPP_HIDE_FROM_ABI
- __val_expr<_BinaryOp<divides<typename _Expr::value_type>, _Expr, __scalar_expr<typename _Expr::value_type> > >
- operator/(const _Expr& __x, const typename _Expr::value_type& __y) {
+__val_expr<_BinaryOp<divides<typename _Expr::value_type>, _Expr, __scalar_expr<typename _Expr::value_type> > >
+operator/(const _Expr& __x, const typename _Expr::value_type& __y) {
typedef typename _Expr::value_type value_type;
typedef _BinaryOp<divides<value_type>, _Expr, __scalar_expr<value_type> > _Op;
return __val_expr<_Op>(_Op(divides<value_type>(), __x, __scalar_expr<value_type>(__y, __x.size())));
@@ -2704,8 +2704,8 @@ inline _LIBCPP_HIDE_FROM_ABI
template <class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> = 0>
inline _LIBCPP_HIDE_FROM_ABI
- __val_expr<_BinaryOp<divides<typename _Expr::value_type>, __scalar_expr<typename _Expr::value_type>, _Expr> >
- operator/(const typename _Expr::value_type& __x, const _Expr& __y) {
+__val_expr<_BinaryOp<divides<typename _Expr::value_type>, __scalar_expr<typename _Expr::value_type>, _Expr> >
+operator/(const typename _Expr::value_type& __x, const _Expr& __y) {
typedef typename _Expr::value_type value_type;
typedef _BinaryOp<divides<value_type>, __scalar_expr<value_type>, _Expr> _Op;
return __val_expr<_Op>(_Op(divides<value_type>(), __scalar_expr<value_type>(__x, __y.size()), __y));
@@ -2723,8 +2723,8 @@ operator%(const _Expr1& __x, const _Expr2& __y) {
template <class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> = 0>
inline _LIBCPP_HIDE_FROM_ABI
- __val_expr<_BinaryOp<modulus<typename _Expr::value_type>, _Expr, __scalar_expr<typename _Expr::value_type> > >
- operator%(const _Expr& __x, const typename _Expr::value_type& __y) {
+__val_expr<_BinaryOp<modulus<typename _Expr::value_type>, _Expr, __scalar_expr<typename _Expr::value_type> > >
+operator%(const _Expr& __x, const typename _Expr::value_type& __y) {
typedef typename _Expr::value_type value_type;
typedef _BinaryOp<modulus<value_type>, _Expr, __scalar_expr<value_type> > _Op;
return __val_expr<_Op>(_Op(modulus<value_type>(), __x, __scalar_expr<value_type>(__y, __x.size())));
@@ -2732,8 +2732,8 @@ inline _LIBCPP_HIDE_FROM_ABI
template <class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> = 0>
inline _LIBCPP_HIDE_FROM_ABI
- __val_expr<_BinaryOp<modulus<typename _Expr::value_type>, __scalar_expr<typename _Expr::value_type>, _Expr> >
- operator%(const typename _Expr::value_type& __x, const _Expr& __y) {
+__val_expr<_BinaryOp<modulus<typename _Expr::value_type>, __scalar_expr<typename _Expr::value_type>, _Expr> >
+operator%(const typename _Expr::value_type& __x, const _Expr& __y) {
typedef typename _Expr::value_type value_type;
typedef _BinaryOp<modulus<value_type>, __scalar_expr<value_type>, _Expr> _Op;
return __val_expr<_Op>(_Op(modulus<value_type>(), __scalar_expr<value_type>(__x, __y.size()), __y));
@@ -2751,8 +2751,8 @@ operator+(const _Expr1& __x, const _Expr2& __y) {
template <class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> = 0>
inline _LIBCPP_HIDE_FROM_ABI
- __val_expr<_BinaryOp<plus<typename _Expr::value_type>, _Expr, __scalar_expr<typename _Expr::value_type> > >
- operator+(const _Expr& __x, const typename _Expr::value_type& __y) {
+__val_expr<_BinaryOp<plus<typename _Expr::value_type>, _Expr, __scalar_expr<typename _Expr::value_type> > >
+operator+(const _Expr& __x, const typename _Expr::value_type& __y) {
typedef typename _Expr::value_type value_type;
typedef _BinaryOp<plus<value_type>, _Expr, __scalar_expr<value_type> > _Op;
return __val_expr<_Op>(_Op(plus<value_type>(), __x, __scalar_expr<value_type>(__y, __x.size())));
@@ -2760,8 +2760,8 @@ inline _LIBCPP_HIDE_FROM_ABI
template <class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> = 0>
inline _LIBCPP_HIDE_FROM_ABI
- __val_expr<_BinaryOp<plus<typename _Expr::value_type>, __scalar_expr<typename _Expr::value_type>, _Expr> >
- operator+(const typename _Expr::value_type& __x, const _Expr& __y) {
+__val_expr<_BinaryOp<plus<typename _Expr::value_type>, __scalar_expr<typename _Expr::value_type>, _Expr> >
+operator+(const typename _Expr::value_type& __x, const _Expr& __y) {
typedef typename _Expr::value_type value_type;
typedef _BinaryOp<plus<value_type>, __scalar_expr<value_type>, _Expr> _Op;
return __val_expr<_Op>(_Op(plus<value_type>(), __scalar_expr<value_type>(__x, __y.size()), __y));
@@ -2779,8 +2779,8 @@ operator-(const _Expr1& __x, const _Expr2& __y) {
template <class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> = 0>
inline _LIBCPP_HIDE_FROM_ABI
- __val_expr<_BinaryOp<minus<typename _Expr::value_type>, _Expr, __scalar_expr<typename _Expr::value_type> > >
- operator-(const _Expr& __x, const typename _Expr::value_type& __y) {
+__val_expr<_BinaryOp<minus<typename _Expr::value_type>, _Expr, __scalar_expr<typename _Expr::value_type> > >
+operator-(const _Expr& __x, const typename _Expr::value_type& __y) {
typedef typename _Expr::value_type value_type;
typedef _BinaryOp<minus<value_type>, _Expr, __scalar_expr<value_type> > _Op;
return __val_expr<_Op>(_Op(minus<value_type>(), __x, __scalar_expr<value_type>(__y, __x.size())));
@@ -2788,8 +2788,8 @@ inline _LIBCPP_HIDE_FROM_ABI
template <class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> = 0>
inline _LIBCPP_HIDE_FROM_ABI
- __val_expr<_BinaryOp<minus<typename _Expr::value_type>, __scalar_expr<typename _Expr::value_type>, _Expr> >
- operator-(const typename _Expr::value_type& __x, const _Expr& __y) {
+__val_expr<_BinaryOp<minus<typename _Expr::value_type>, __scalar_expr<typename _Expr::value_type>, _Expr> >
+operator-(const typename _Expr::value_type& __x, const _Expr& __y) {
typedef typename _Expr::value_type value_type;
typedef _BinaryOp<minus<value_type>, __scalar_expr<value_type>, _Expr> _Op;
return __val_expr<_Op>(_Op(minus<value_type>(), __scalar_expr<value_type>(__x, __y.size()), __y));
@@ -2807,8 +2807,8 @@ operator^(const _Expr1& __x, const _Expr2& __y) {
template <class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> = 0>
inline _LIBCPP_HIDE_FROM_ABI
- __val_expr<_BinaryOp<bit_xor<typename _Expr::value_type>, _Expr, __scalar_expr<typename _Expr::value_type> > >
- operator^(const _Expr& __x, const typename _Expr::value_type& __y) {
+__val_expr<_BinaryOp<bit_xor<typename _Expr::value_type>, _Expr, __scalar_expr<typename _Expr::value_type> > >
+operator^(const _Expr& __x, const typename _Expr::value_type& __y) {
typedef typename _Expr::value_type value_type;
typedef _BinaryOp<bit_xor<value_type>, _Expr, __scalar_expr<value_type> > _Op;
return __val_expr<_Op>(_Op(bit_xor<value_type>(), __x, __scalar_expr<value_type>(__y, __x.size())));
@@ -2816,8 +2816,8 @@ inline _LIBCPP_HIDE_FROM_ABI
template <class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> = 0>
inline _LIBCPP_HIDE_FROM_ABI
- __val_expr<_BinaryOp<bit_xor<typename _Expr::value_type>, __scalar_expr<typename _Expr::value_type>, _Expr> >
- operator^(const typename _Expr::value_type& __x, const _Expr& __y) {
+__val_expr<_BinaryOp<bit_xor<typename _Expr::value_type>, __scalar_expr<typename _Expr::value_type>, _Expr> >
+operator^(const typename _Expr::value_type& __x, const _Expr& __y) {
typedef typename _Expr::value_type value_type;
typedef _BinaryOp<bit_xor<value_type>, __scalar_expr<value_type>, _Expr> _Op;
return __val_expr<_Op>(_Op(bit_xor<value_type>(), __scalar_expr<value_type>(__x, __y.size()), __y));
@@ -2835,8 +2835,8 @@ operator&(const _Expr1& __x, const _Expr2& __y) {
template <class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> = 0>
inline _LIBCPP_HIDE_FROM_ABI
- __val_expr<_BinaryOp<bit_and<typename _Expr::value_type>, _Expr, __scalar_expr<typename _Expr::value_type> > >
- operator&(const _Expr& __x, const typename _Expr::value_type& __y) {
+__val_expr<_BinaryOp<bit_and<typename _Expr::value_type>, _Expr, __scalar_expr<typename _Expr::value_type> > >
+operator&(const _Expr& __x, const typename _Expr::value_type& __y) {
typedef typename _Expr::value_type value_type;
typedef _BinaryOp<bit_and<value_type>, _Expr, __scalar_expr<value_type> > _Op;
return __val_expr<_Op>(_Op(bit_and<value_type>(), __x, __scalar_expr<value_type>(__y, __x.size())));
@@ -2844,8 +2844,8 @@ inline _LIBCPP_HIDE_FROM_ABI
template <class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> = 0>
inline _LIBCPP_HIDE_FROM_ABI
- __val_expr<_BinaryOp<bit_and<typename _Expr::value_type>, __scalar_expr<typename _Expr::value_type>, _Expr> >
- operator&(const typename _Expr::value_type& __x, const _Expr& __y) {
+__val_expr<_BinaryOp<bit_and<typename _Expr::value_type>, __scalar_expr<typename _Expr::value_type>, _Expr> >
+operator&(const typename _Expr::value_type& __x, const _Expr& __y) {
typedef typename _Expr::value_type value_type;
typedef _BinaryOp<bit_and<value_type>, __scalar_expr<value_type>, _Expr> _Op;
return __val_expr<_Op>(_Op(bit_and<value_type>(), __scalar_expr<value_type>(__x, __y.size()), __y));
@@ -2863,8 +2863,8 @@ operator|(const _Expr1& __x, const _Expr2& __y) {
template <class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> = 0>
inline _LIBCPP_HIDE_FROM_ABI
- __val_expr<_BinaryOp<bit_or<typename _Expr::value_type>, _Expr, __scalar_expr<typename _Expr::value_type> > >
- operator|(const _Expr& __x, const typename _Expr::value_type& __y) {
+__val_expr<_BinaryOp<bit_or<typename _Expr::value_type>, _Expr, __scalar_expr<typename _Expr::value_type> > >
+operator|(const _Expr& __x, const typename _Expr::value_type& __y) {
typedef typename _Expr::value_type value_type;
typedef _BinaryOp<bit_or<value_type>, _Expr, __scalar_expr<value_type> > _Op;
return __val_expr<_Op>(_Op(bit_or<value_type>(), __x, __scalar_expr<value_type>(__y, __x.size())));
@@ -2872,8 +2872,8 @@ inline _LIBCPP_HIDE_FROM_ABI
template <class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> = 0>
inline _LIBCPP_HIDE_FROM_ABI
- __val_expr<_BinaryOp<bit_or<typename _Expr::value_type>, __scalar_expr<typename _Expr::value_type>, _Expr> >
- operator|(const typename _Expr::value_type& __x, const _Expr& __y) {
+__val_expr<_BinaryOp<bit_or<typename _Expr::value_type>, __scalar_expr<typename _Expr::value_type>, _Expr> >
+operator|(const typename _Expr::value_type& __x, const _Expr& __y) {
typedef typename _Expr::value_type value_type;
typedef _BinaryOp<bit_or<value_type>, __scalar_expr<value_type>, _Expr> _Op;
return __val_expr<_Op>(_Op(bit_or<value_type>(), __scalar_expr<value_type>(__x, __y.size()), __y));
@@ -2890,8 +2890,8 @@ operator<<(const _Expr1& __x, const _Expr2& __y) {
}
template <class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> = 0>
-inline _LIBCPP_HIDE_FROM_ABI __val_expr<
- _BinaryOp<__bit_shift_left<typename _Expr::value_type>, _Expr, __scalar_expr<typename _Expr::value_type> > >
+inline _LIBCPP_HIDE_FROM_ABI
+__val_expr< _BinaryOp<__bit_shift_left<typename _Expr::value_type>, _Expr, __scalar_expr<typename _Expr::value_type> > >
operator<<(const _Expr& __x, const typename _Expr::value_type& __y) {
typedef typename _Expr::value_type value_type;
typedef _BinaryOp<__bit_shift_left<value_type>, _Expr, __scalar_expr<value_type> > _Op;
@@ -2899,8 +2899,8 @@ operator<<(const _Expr& __x, const typename _Expr::value_type& __y) {
}
template <class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> = 0>
-inline _LIBCPP_HIDE_FROM_ABI __val_expr<
- _BinaryOp<__bit_shift_left<typename _Expr::value_type>, __scalar_expr<typename _Expr::value_type>, _Expr> >
+inline _LIBCPP_HIDE_FROM_ABI
+__val_expr< _BinaryOp<__bit_shift_left<typename _Expr::value_type>, __scalar_expr<typename _Expr::value_type>, _Expr> >
operator<<(const typename _Expr::value_type& __x, const _Expr& __y) {
typedef typename _Expr::value_type value_type;
typedef _BinaryOp<__bit_shift_left<value_type>, __scalar_expr<value_type>, _Expr> _Op;
@@ -2927,8 +2927,8 @@ operator>>(const _Expr& __x, const typename _Expr::value_type& __y) {
}
template <class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> = 0>
-inline _LIBCPP_HIDE_FROM_ABI __val_expr<
- _BinaryOp<__bit_shift_right<typename _Expr::value_type>, __scalar_expr<typename _Expr::value_type>, _Expr> >
+inline _LIBCPP_HIDE_FROM_ABI
+__val_expr< _BinaryOp<__bit_shift_right<typename _Expr::value_type>, __scalar_expr<typename _Expr::value_type>, _Expr> >
operator>>(const typename _Expr::value_type& __x, const _Expr& __y) {
typedef typename _Expr::value_type value_type;
typedef _BinaryOp<__bit_shift_right<value_type>, __scalar_expr<value_type>, _Expr> _Op;
@@ -2947,8 +2947,8 @@ operator&&(const _Expr1& __x, const _Expr2& __y) {
template <class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> = 0>
inline _LIBCPP_HIDE_FROM_ABI
- __val_expr<_BinaryOp<logical_and<typename _Expr::value_type>, _Expr, __scalar_expr<typename _Expr::value_type> > >
- operator&&(const _Expr& __x, const typename _Expr::value_type& __y) {
+__val_expr<_BinaryOp<logical_and<typename _Expr::value_type>, _Expr, __scalar_expr<typename _Expr::value_type> > >
+operator&&(const _Expr& __x, const typename _Expr::value_type& __y) {
typedef typename _Expr::value_type value_type;
typedef _BinaryOp<logical_and<value_type>, _Expr, __scalar_expr<value_type> > _Op;
return __val_expr<_Op>(_Op(logical_and<value_type>(), __x, __scalar_expr<value_type>(__y, __x.size())));
@@ -2956,8 +2956,8 @@ inline _LIBCPP_HIDE_FROM_ABI
template <class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> = 0>
inline _LIBCPP_HIDE_FROM_ABI
- __val_expr<_BinaryOp<logical_and<typename _Expr::value_type>, __scalar_expr<typename _Expr::value_type>, _Expr> >
- operator&&(const typename _Expr::value_type& __x, const _Expr& __y) {
+__val_expr<_BinaryOp<logical_and<typename _Expr::value_type>, __scalar_expr<typename _Expr::value_type>, _Expr> >
+operator&&(const typename _Expr::value_type& __x, const _Expr& __y) {
typedef typename _Expr::value_type value_type;
typedef _BinaryOp<logical_and<value_type>, __scalar_expr<value_type>, _Expr> _Op;
return __val_expr<_Op>(_Op(logical_and<value_type>(), __scalar_expr<value_type>(__x, __y.size()), __y));
@@ -2975,8 +2975,8 @@ operator||(const _Expr1& __x, const _Expr2& __y) {
template <class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> = 0>
inline _LIBCPP_HIDE_FROM_ABI
- __val_expr<_BinaryOp<logical_or<typename _Expr::value_type>, _Expr, __scalar_expr<typename _Expr::value_type> > >
- operator||(const _Expr& __x, const typename _Expr::value_type& __y) {
+__val_expr<_BinaryOp<logical_or<typename _Expr::value_type>, _Expr, __scalar_expr<typename _Expr::value_type> > >
+operator||(const _Expr& __x, const typename _Expr::value_type& __y) {
typedef typename _Expr::value_type value_type;
typedef _BinaryOp<logical_or<value_type>, _Expr, __scalar_expr<value_type> > _Op;
return __val_expr<_Op>(_Op(logical_or<value_type>(), __x, __scalar_expr<value_type>(__y, __x.size())));
@@ -2984,8 +2984,8 @@ inline _LIBCPP_HIDE_FROM_ABI
template <class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> = 0>
inline _LIBCPP_HIDE_FROM_ABI
- __val_expr<_BinaryOp<logical_or<typename _Expr::value_type>, __scalar_expr<typename _Expr::value_type>, _Expr> >
- operator||(const typename _Expr::value_type& __x, const _Expr& __y) {
+__val_expr<_BinaryOp<logical_or<typename _Expr::value_type>, __scalar_expr<typename _Expr::value_type>, _Expr> >
+operator||(const typename _Expr::value_type& __x, const _Expr& __y) {
typedef typename _Expr::value_type value_type;
typedef _BinaryOp<logical_or<value_type>, __scalar_expr<value_type>, _Expr> _Op;
return __val_expr<_Op>(_Op(logical_or<value_type>(), __scalar_expr<value_type>(__x, __y.size()), __y));
@@ -3003,8 +3003,8 @@ operator==(const _Expr1& __x, const _Expr2& __y) {
template <class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> = 0>
inline _LIBCPP_HIDE_FROM_ABI
- __val_expr<_BinaryOp<equal_to<typename _Expr::value_type>, _Expr, __scalar_expr<typename _Expr::value_type> > >
- operator==(const _Expr& __x, const typename _Expr::value_type& __y) {
+__val_expr<_BinaryOp<equal_to<typename _Expr::value_type>, _Expr, __scalar_expr<typename _Expr::value_type> > >
+operator==(const _Expr& __x, const typename _Expr::value_type& __y) {
typedef typename _Expr::value_type value_type;
typedef _BinaryOp<equal_to<value_type>, _Expr, __scalar_expr<value_type> > _Op;
return __val_expr<_Op>(_Op(equal_to<value_type>(), __x, __scalar_expr<value_type>(__y, __x.size())));
@@ -3012,8 +3012,8 @@ inline _LIBCPP_HIDE_FROM_ABI
template <class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> = 0>
inline _LIBCPP_HIDE_FROM_ABI
- __val_expr<_BinaryOp<equal_to<typename _Expr::value_type>, __scalar_expr<typename _Expr::value_type>, _Expr> >
- operator==(const typename _Expr::value_type& __x, const _Expr& __y) {
+__val_expr<_BinaryOp<equal_to<typename _Expr::value_type>, __scalar_expr<typename _Expr::value_type>, _Expr> >
+operator==(const typename _Expr::value_type& __x, const _Expr& __y) {
typedef typename _Expr::value_type value_type;
typedef _BinaryOp<equal_to<value_type>, __scalar_expr<value_type>, _Expr> _Op;
return __val_expr<_Op>(_Op(equal_to<value_type>(), __scalar_expr<value_type>(__x, __y.size()), __y));
@@ -3031,8 +3031,8 @@ operator!=(const _Expr1& __x, const _Expr2& __y) {
template <class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> = 0>
inline _LIBCPP_HIDE_FROM_ABI
- __val_expr<_BinaryOp<not_equal_to<typename _Expr::value_type>, _Expr, __scalar_expr<typename _Expr::value_type> > >
- operator!=(const _Expr& __x, const typename _Expr::value_type& __y) {
+__val_expr<_BinaryOp<not_equal_to<typename _Expr::value_type>, _Expr, __scalar_expr<typename _Expr::value_type> > >
+operator!=(const _Expr& __x, const typename _Expr::value_type& __y) {
typedef typename _Expr::value_type value_type;
typedef _BinaryOp<not_equal_to<value_type>, _Expr, __scalar_expr<value_type> > _Op;
return __val_expr<_Op>(_Op(not_equal_to<value_type>(), __x, __scalar_expr<value_type>(__y, __x.size())));
@@ -3040,8 +3040,8 @@ inline _LIBCPP_HIDE_FROM_ABI
template <class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> = 0>
inline _LIBCPP_HIDE_FROM_ABI
- __val_expr<_BinaryOp<not_equal_to<typename _Expr::value_type>, __scalar_expr<typename _Expr::value_type>, _Expr> >
- operator!=(const typename _Expr::value_type& __x, const _Expr& __y) {
+__val_expr<_BinaryOp<not_equal_to<typename _Expr::value_type>, __scalar_expr<typename _Expr::value_type>, _Expr> >
+operator!=(const typename _Expr::value_type& __x, const _Expr& __y) {
typedef typename _Expr::value_type value_type;
typedef _BinaryOp<not_equal_to<value_type>, __scalar_expr<value_type>, _Expr> _Op;
return __val_expr<_Op>(_Op(not_equal_to<value_type>(), __scalar_expr<value_type>(__x, __y.size()), __y));
@@ -3059,8 +3059,8 @@ operator<(const _Expr1& __x, const _Expr2& __y) {
template <class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> = 0>
inline _LIBCPP_HIDE_FROM_ABI
- __val_expr<_BinaryOp<less<typename _Expr::value_type>, _Expr, __scalar_expr<typename _Expr::value_type> > >
- operator<(const _Expr& __x, const typename _Expr::value_type& __y) {
+__val_expr<_BinaryOp<less<typename _Expr::value_type>, _Expr, __scalar_expr<typename _Expr::value_type> > >
+operator<(const _Expr& __x, const typename _Expr::value_type& __y) {
typedef typename _Expr::value_type value_type;
typedef _BinaryOp<less<value_type>, _Expr, __scalar_expr<value_type> > _Op;
return __val_expr<_Op>(_Op(less<value_type>(), __x, __scalar_expr<value_type>(__y, __x.size())));
@@ -3068,8 +3068,8 @@ inline _LIBCPP_HIDE_FROM_ABI
template <class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> = 0>
inline _LIBCPP_HIDE_FROM_ABI
- __val_expr<_BinaryOp<less<typename _Expr::value_type>, __scalar_expr<typename _Expr::value_type>, _Expr> >
- operator<(const typename _Expr::value_type& __x, const _Expr& __y) {
+__val_expr<_BinaryOp<less<typename _Expr::value_type>, __scalar_expr<typename _Expr::value_type>, _Expr> >
+operator<(const typename _Expr::value_type& __x, const _Expr& __y) {
typedef typename _Expr::value_type value_type;
typedef _BinaryOp<less<value_type>, __scalar_expr<value_type>, _Expr> _Op;
return __val_expr<_Op>(_Op(less<value_type>(), __scalar_expr<value_type>(__x, __y.size()), __y));
@@ -3087,8 +3087,8 @@ operator>(const _Expr1& __x, const _Expr2& __y) {
template <class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> = 0>
inline _LIBCPP_HIDE_FROM_ABI
- __val_expr<_BinaryOp<greater<typename _Expr::value_type>, _Expr, __scalar_expr<typename _Expr::value_type> > >
- operator>(const _Expr& __x, const typename _Expr::value_type& __y) {
+__val_expr<_BinaryOp<greater<typename _Expr::value_type>, _Expr, __scalar_expr<typename _Expr::value_type> > >
+operator>(const _Expr& __x, const typename _Expr::value_type& __y) {
typedef typename _Expr::value_type value_type;
typedef _BinaryOp<greater<value_type>, _Expr, __scalar_expr<value_type> > _Op;
return __val_expr<_Op>(_Op(greater<value_type>(), __x, __scalar_expr<value_type>(__y, __x.size())));
@@ -3096,8 +3096,8 @@ inline _LIBCPP_HIDE_FROM_ABI
template <class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> = 0>
inline _LIBCPP_HIDE_FROM_ABI
- __val_expr<_BinaryOp<greater<typename _Expr::value_type>, __scalar_expr<typename _Expr::value_type>, _Expr> >
- operator>(const typename _Expr::value_type& __x, const _Expr& __y) {
+__val_expr<_BinaryOp<greater<typename _Expr::value_type>, __scalar_expr<typename _Expr::value_type>, _Expr> >
+operator>(const typename _Expr::value_type& __x, const _Expr& __y) {
typedef typename _Expr::value_type value_type;
typedef _BinaryOp<greater<value_type>, __scalar_expr<value_type>, _Expr> _Op;
return __val_expr<_Op>(_Op(greater<value_type>(), __scalar_expr<value_type>(__x, __y.size()), __y));
@@ -3115,8 +3115,8 @@ operator<=(const _Expr1& __x, const _Expr2& __y) {
template <class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> = 0>
inline _LIBCPP_HIDE_FROM_ABI
- __val_expr<_BinaryOp<less_equal<typename _Expr::value_type>, _Expr, __scalar_expr<typename _Expr::value_type> > >
- operator<=(const _Expr& __x, const typename _Expr::value_type& __y) {
+__val_expr<_BinaryOp<less_equal<typename _Expr::value_type>, _Expr, __scalar_expr<typename _Expr::value_type> > >
+operator<=(const _Expr& __x, const typename _Expr::value_type& __y) {
typedef typename _Expr::value_type value_type;
typedef _BinaryOp<less_equal<value_type>, _Expr, __scalar_expr<value_type> > _Op;
return __val_expr<_Op>(_Op(less_equal<value_type>(), __x, __scalar_expr<value_type>(__y, __x.size())));
@@ -3124,8 +3124,8 @@ inline _LIBCPP_HIDE_FROM_ABI
template <class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> = 0>
inline _LIBCPP_HIDE_FROM_ABI
- __val_expr<_BinaryOp<less_equal<typename _Expr::value_type>, __scalar_expr<typename _Expr::value_type>, _Expr> >
- operator<=(const typename _Expr::value_type& __x, const _Expr& __y) {
+__val_expr<_BinaryOp<less_equal<typename _Expr::value_type>, __scalar_expr<typename _Expr::value_type>, _Expr> >
+operator<=(const typename _Expr::value_type& __x, const _Expr& __y) {
typedef typename _Expr::value_type value_type;
typedef _BinaryOp<less_equal<value_type>, __scalar_expr<value_type>, _Expr> _Op;
return __val_expr<_Op>(_Op(less_equal<value_type>(), __scalar_expr<value_type>(__x, __y.size()), __y));
@@ -3143,8 +3143,8 @@ operator>=(const _Expr1& __x, const _Expr2& __y) {
template <class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> = 0>
inline _LIBCPP_HIDE_FROM_ABI
- __val_expr<_BinaryOp<greater_equal<typename _Expr::value_type>, _Expr, __scalar_expr<typename _Expr::value_type> > >
- operator>=(const _Expr& __x, const typename _Expr::value_type& __y) {
+__val_expr<_BinaryOp<greater_equal<typename _Expr::value_type>, _Expr, __scalar_expr<typename _Expr::value_type> > >
+operator>=(const _Expr& __x, const typename _Expr::value_type& __y) {
typedef typename _Expr::value_type value_type;
typedef _BinaryOp<greater_equal<value_type>, _Expr, __scalar_expr<value_type> > _Op;
return __val_expr<_Op>(_Op(greater_equal<value_type>(), __x, __scalar_expr<value_type>(__y, __x.size())));
@@ -3152,8 +3152,8 @@ inline _LIBCPP_HIDE_FROM_ABI
template <class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> = 0>
inline _LIBCPP_HIDE_FROM_ABI
- __val_expr<_BinaryOp<greater_equal<typename _Expr::value_type>, __scalar_expr<typename _Expr::value_type>, _Expr> >
- operator>=(const typename _Expr::value_type& __x, const _Expr& __y) {
+__val_expr<_BinaryOp<greater_equal<typename _Expr::value_type>, __scalar_expr<typename _Expr::value_type>, _Expr> >
+operator>=(const typename _Expr::value_type& __x, const _Expr& __y) {
typedef typename _Expr::value_type value_type;
typedef _BinaryOp<greater_equal<value_type>, __scalar_expr<value_type>, _Expr> _Op;
return __val_expr<_Op>(_Op(greater_equal<value_type>(), __scalar_expr<value_type>(__x, __y.size()), __y));
@@ -3203,8 +3203,8 @@ atan2(const _Expr1& __x, const _Expr2& __y) {
template <class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> = 0>
inline _LIBCPP_HIDE_FROM_ABI
- __val_expr<_BinaryOp<__atan2_expr<typename _Expr::value_type>, _Expr, __scalar_expr<typename _Expr::value_type> > >
- atan2(const _Expr& __x, const typename _Expr::value_type& __y) {
+__val_expr<_BinaryOp<__atan2_expr<typename _Expr::value_type>, _Expr, __scalar_expr<typename _Expr::value_type> > >
+atan2(const _Expr& __x, const typename _Expr::value_type& __y) {
typedef typename _Expr::value_type value_type;
typedef _BinaryOp<__atan2_expr<value_type>, _Expr, __scalar_expr<value_type> > _Op;
return __val_expr<_Op>(_Op(__atan2_expr<value_type>(), __x, __scalar_expr<value_type>(__y, __x.size())));
@@ -3212,8 +3212,8 @@ inline _LIBCPP_HIDE_FROM_ABI
template <class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> = 0>
inline _LIBCPP_HIDE_FROM_ABI
- __val_expr<_BinaryOp<__atan2_expr<typename _Expr::value_type>, __scalar_expr<typename _Expr::value_type>, _Expr> >
- atan2(const typename _Expr::value_type& __x, const _Expr& __y) {
+__val_expr<_BinaryOp<__atan2_expr<typename _Expr::value_type>, __scalar_expr<typename _Expr::value_type>, _Expr> >
+atan2(const typename _Expr::value_type& __x, const _Expr& __y) {
typedef typename _Expr::value_type value_type;
typedef _BinaryOp<__atan2_expr<value_type>, __scalar_expr<value_type>, _Expr> _Op;
return __val_expr<_Op>(_Op(__atan2_expr<value_type>(), __scalar_expr<value_type>(__x, __y.size()), __y));
@@ -3271,8 +3271,8 @@ pow(const _Expr1& __x, const _Expr2& __y) {
template <class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> = 0>
inline _LIBCPP_HIDE_FROM_ABI
- __val_expr<_BinaryOp<__pow_expr<typename _Expr::value_type>, _Expr, __scalar_expr<typename _Expr::value_type> > >
- pow(const _Expr& __x, const typename _Expr::value_type& __y) {
+__val_expr<_BinaryOp<__pow_expr<typename _Expr::value_type>, _Expr, __scalar_expr<typename _Expr::value_type> > >
+pow(const _Expr& __x, const typename _Expr::value_type& __y) {
typedef typename _Expr::value_type value_type;
typedef _BinaryOp<__pow_expr<value_type>, _Expr, __scalar_expr<value_type> > _Op;
return __val_expr<_Op>(_Op(__pow_expr<value_type>(), __x, __scalar_expr<value_type>(__y, __x.size())));
@@ -3280,8 +3280,8 @@ inline _LIBCPP_HIDE_FROM_ABI
template <class _Expr, __enable_if_t<__is_val_expr<_Expr>::value, int> = 0>
inline _LIBCPP_HIDE_FROM_ABI
- __val_expr<_BinaryOp<__pow_expr<typename _Expr::value_type>, __scalar_expr<typename _Expr::value_type>, _Expr> >
- pow(const typename _Expr::value_type& __x, const _Expr& __y) {
+__val_expr<_BinaryOp<__pow_expr<typename _Expr::value_type>, __scalar_expr<typename _Expr::value_type>, _Expr> >
+pow(const typename _Expr::value_type& __x, const _Expr& __y) {
typedef typename _Expr::value_type value_type;
typedef _BinaryOp<__pow_expr<value_type>, __scalar_expr<value_type>, _Expr> _Op;
return __val_expr<_Op>(_Op(__pow_expr<value_type>(), __scalar_expr<value_type>(__x, __y.size()), __y));
diff --git a/libcxx/include/variant b/libcxx/include/variant
index 7ebd0534b164..5f2d03b7227b 100644
--- a/libcxx/include/variant
+++ b/libcxx/include/variant
@@ -241,6 +241,7 @@ namespace std {
#include <__type_traits/is_trivially_assignable.h>
#include <__type_traits/is_trivially_constructible.h>
#include <__type_traits/is_trivially_destructible.h>
+#include <__type_traits/is_trivially_relocatable.h>
#include <__type_traits/is_void.h>
#include <__type_traits/remove_const.h>
#include <__type_traits/remove_cvref.h>
@@ -1180,6 +1181,9 @@ class _LIBCPP_TEMPLATE_VIS _LIBCPP_DECLSPEC_EMPTY_BASES variant
using __first_type = variant_alternative_t<0, variant>;
public:
+ using __trivially_relocatable =
+ conditional_t<_And<__libcpp_is_trivially_relocatable<_Types>...>::value, variant, void>;
+
template <bool _Dummy = true,
enable_if_t<__dependent_type<is_default_constructible<__first_type>, _Dummy>::value, int> = 0>
_LIBCPP_HIDE_FROM_ABI constexpr variant() noexcept(is_nothrow_default_constructible_v<__first_type>)
@@ -1354,8 +1358,8 @@ _LIBCPP_HIDE_FROM_ABI _LIBCPP_AVAILABILITY_THROW_BAD_VARIANT_ACCESS constexpr au
template <size_t _Ip, class... _Types>
_LIBCPP_HIDE_FROM_ABI
- _LIBCPP_AVAILABILITY_THROW_BAD_VARIANT_ACCESS constexpr variant_alternative_t<_Ip, variant<_Types...>>&
- get(variant<_Types...>& __v) {
+_LIBCPP_AVAILABILITY_THROW_BAD_VARIANT_ACCESS constexpr variant_alternative_t<_Ip, variant<_Types...>>&
+get(variant<_Types...>& __v) {
static_assert(_Ip < sizeof...(_Types));
static_assert(!is_void_v<variant_alternative_t<_Ip, variant<_Types...>>>);
return std::__generic_get<_Ip>(__v);
@@ -1363,8 +1367,8 @@ _LIBCPP_HIDE_FROM_ABI
template <size_t _Ip, class... _Types>
_LIBCPP_HIDE_FROM_ABI
- _LIBCPP_AVAILABILITY_THROW_BAD_VARIANT_ACCESS constexpr variant_alternative_t<_Ip, variant<_Types...>>&&
- get(variant<_Types...>&& __v) {
+_LIBCPP_AVAILABILITY_THROW_BAD_VARIANT_ACCESS constexpr variant_alternative_t<_Ip, variant<_Types...>>&&
+get(variant<_Types...>&& __v) {
static_assert(_Ip < sizeof...(_Types));
static_assert(!is_void_v<variant_alternative_t<_Ip, variant<_Types...>>>);
return std::__generic_get<_Ip>(std::move(__v));
@@ -1372,8 +1376,8 @@ _LIBCPP_HIDE_FROM_ABI
template <size_t _Ip, class... _Types>
_LIBCPP_HIDE_FROM_ABI
- _LIBCPP_AVAILABILITY_THROW_BAD_VARIANT_ACCESS constexpr const variant_alternative_t<_Ip, variant<_Types...>>&
- get(const variant<_Types...>& __v) {
+_LIBCPP_AVAILABILITY_THROW_BAD_VARIANT_ACCESS constexpr const variant_alternative_t<_Ip, variant<_Types...>>&
+get(const variant<_Types...>& __v) {
static_assert(_Ip < sizeof...(_Types));
static_assert(!is_void_v<variant_alternative_t<_Ip, variant<_Types...>>>);
return std::__generic_get<_Ip>(__v);
@@ -1381,8 +1385,8 @@ _LIBCPP_HIDE_FROM_ABI
template <size_t _Ip, class... _Types>
_LIBCPP_HIDE_FROM_ABI
- _LIBCPP_AVAILABILITY_THROW_BAD_VARIANT_ACCESS constexpr const variant_alternative_t<_Ip, variant<_Types...>>&&
- get(const variant<_Types...>&& __v) {
+_LIBCPP_AVAILABILITY_THROW_BAD_VARIANT_ACCESS constexpr const variant_alternative_t<_Ip, variant<_Types...>>&&
+get(const variant<_Types...>&& __v) {
static_assert(_Ip < sizeof...(_Types));
static_assert(!is_void_v<variant_alternative_t<_Ip, variant<_Types...>>>);
return std::__generic_get<_Ip>(std::move(__v));
@@ -1584,8 +1588,8 @@ visit(_Visitor&& __visitor, _Vs&&... __vs) {
template <class... _Types>
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 auto
-swap(variant<_Types...>& __lhs, variant<_Types...>& __rhs) noexcept(noexcept(__lhs.swap(__rhs)))
- -> decltype(__lhs.swap(__rhs)) {
+swap(variant<_Types...>& __lhs,
+ variant<_Types...>& __rhs) noexcept(noexcept(__lhs.swap(__rhs))) -> decltype(__lhs.swap(__rhs)) {
return __lhs.swap(__rhs);
}
diff --git a/libcxx/include/vector b/libcxx/include/vector
index cbfc2cefa1fd..299ad8c9b23f 100644
--- a/libcxx/include/vector
+++ b/libcxx/include/vector
@@ -406,13 +406,19 @@ public:
typedef std::reverse_iterator<iterator> reverse_iterator;
typedef std::reverse_iterator<const_iterator> const_reverse_iterator;
- static_assert((is_same<typename allocator_type::value_type, value_type>::value),
+ // A vector containers the following members which may be trivially relocatable:
+ // - pointer: may be trivially relocatable, so it's checked
+ // - allocator_type: may be trivially relocatable, so it's checked
+ // vector doesn't contain any self-references, so it's trivially relocatable if its members are.
+ using __trivially_relocatable = __conditional_t<
+ __libcpp_is_trivially_relocatable<pointer>::value && __libcpp_is_trivially_relocatable<allocator_type>::value,
+ vector,
+ void>;
+
+ static_assert(__check_valid_allocator<allocator_type>::value, "");
+ static_assert(is_same<typename allocator_type::value_type, value_type>::value,
"Allocator::value_type must be same type as value_type");
- static_assert(is_same<allocator_type, __rebind_alloc<__alloc_traits, value_type> >::value,
- "[allocator.requirements] states that rebinding an allocator to the same type should result in the "
- "original allocator");
-
_LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI vector()
_NOEXCEPT_(is_nothrow_default_constructible<allocator_type>::value) {}
_LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI explicit vector(const allocator_type& __a)
@@ -667,11 +673,11 @@ public:
template <class... _Args>
_LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI
#if _LIBCPP_STD_VER >= 17
- reference
- emplace_back(_Args&&... __args);
+ reference
+ emplace_back(_Args&&... __args);
#else
- void
- emplace_back(_Args&&... __args);
+ void
+ emplace_back(_Args&&... __args);
#endif
#if _LIBCPP_STD_VER >= 23
@@ -743,7 +749,7 @@ public:
#if _LIBCPP_STD_VER >= 14
_NOEXCEPT;
#else
- _NOEXCEPT_(!__alloc_traits::propagate_on_container_swap::value || __is_nothrow_swappable<allocator_type>::value);
+ _NOEXCEPT_(!__alloc_traits::propagate_on_container_swap::value || __is_nothrow_swappable_v<allocator_type>);
#endif
_LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI bool __invariants() const;
@@ -896,6 +902,7 @@ private:
__v_.__annotate_increase(__n);
#endif
}
+
_LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI ~_ConstructTransaction() {
__v_.__end_ = __pos_;
#ifndef _LIBCPP_HAS_NO_ASAN
@@ -909,7 +916,6 @@ private:
pointer __pos_;
const_pointer const __new_end_;
- private:
_ConstructTransaction(_ConstructTransaction const&) = delete;
_ConstructTransaction& operator=(_ConstructTransaction const&) = delete;
};
@@ -1767,7 +1773,7 @@ _LIBCPP_CONSTEXPR_SINCE_CXX20 void vector<_Tp, _Allocator>::swap(vector& __x)
#if _LIBCPP_STD_VER >= 14
_NOEXCEPT
#else
- _NOEXCEPT_(!__alloc_traits::propagate_on_container_swap::value || __is_nothrow_swappable<allocator_type>::value)
+ _NOEXCEPT_(!__alloc_traits::propagate_on_container_swap::value || __is_nothrow_swappable_v<allocator_type>)
#endif
{
_LIBCPP_ASSERT_COMPATIBLE_ALLOCATOR(
@@ -2108,7 +2114,7 @@ public:
#if _LIBCPP_STD_VER >= 14
_NOEXCEPT;
#else
- _NOEXCEPT_(!__alloc_traits::propagate_on_container_swap::value || __is_nothrow_swappable<allocator_type>::value);
+ _NOEXCEPT_(!__alloc_traits::propagate_on_container_swap::value || __is_nothrow_swappable_v<allocator_type>);
#endif
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 static void swap(reference __x, reference __y) _NOEXCEPT {
std::swap(__x, __y);
@@ -2770,7 +2776,7 @@ _LIBCPP_CONSTEXPR_SINCE_CXX20 void vector<bool, _Allocator>::swap(vector& __x)
#if _LIBCPP_STD_VER >= 14
_NOEXCEPT
#else
- _NOEXCEPT_(!__alloc_traits::propagate_on_container_swap::value || __is_nothrow_swappable<allocator_type>::value)
+ _NOEXCEPT_(!__alloc_traits::propagate_on_container_swap::value || __is_nothrow_swappable_v<allocator_type>)
#endif
{
std::swap(this->__begin_, __x.__begin_);
@@ -2974,7 +2980,9 @@ _LIBCPP_POP_MACROS
# include <concepts>
# include <cstdlib>
# include <iosfwd>
-# include <locale>
+# if !defined(_LIBCPP_HAS_NO_LOCALIZATION)
+# include <locale>
+# endif
# include <tuple>
# include <type_traits>
# include <typeinfo>
diff --git a/libcxx/include/version b/libcxx/include/version
index d433e1b1c9ce..cac6eaa3b6e8 100644
--- a/libcxx/include/version
+++ b/libcxx/include/version
@@ -229,7 +229,7 @@ __cpp_lib_string_view 201803L <string> <string
__cpp_lib_submdspan 202306L <mdspan>
__cpp_lib_syncbuf 201803L <syncstream>
__cpp_lib_text_encoding 202306L <text_encoding>
-__cpp_lib_three_way_comparison 201907L <compare>
+__cpp_lib_three_way_comparison 201711L <compare>
__cpp_lib_to_address 201711L <memory>
__cpp_lib_to_array 201907L <array>
__cpp_lib_to_chars 202306L <charconv>
@@ -437,7 +437,7 @@ __cpp_lib_void_t 201411L <type_traits>
# if !defined(_LIBCPP_HAS_NO_EXPERIMENTAL_SYNCSTREAM)
# define __cpp_lib_syncbuf 201803L
# endif
-// # define __cpp_lib_three_way_comparison 201907L
+# define __cpp_lib_three_way_comparison 201711L
# define __cpp_lib_to_address 201711L
# define __cpp_lib_to_array 201907L
# define __cpp_lib_type_identity 201806L
@@ -465,6 +465,7 @@ __cpp_lib_void_t 201411L <type_traits>
# define __cpp_lib_ios_noreplace 202207L
# define __cpp_lib_is_scoped_enum 202011L
# define __cpp_lib_mdspan 202207L
+# define __cpp_lib_modules 202207L
// # define __cpp_lib_move_only_function 202110L
# undef __cpp_lib_optional
# define __cpp_lib_optional 202110L
diff --git a/libcxx/lib/abi/CHANGELOG.TXT b/libcxx/lib/abi/CHANGELOG.TXT
index 7a8d5052a083..32526f1786c6 100644
--- a/libcxx/lib/abi/CHANGELOG.TXT
+++ b/libcxx/lib/abi/CHANGELOG.TXT
@@ -577,7 +577,7 @@ Version 12.0
Symbol added: ___cxa_free_dependent_exception
------------
-Version 10.0
+Version 11.0
------------
* 54fa9ecd3088 - [libc++] Implementation of C++20's P1135R6 for libcxx
diff --git a/libcxx/lib/abi/powerpc-ibm-aix.libcxxabi.v1.stable.exceptions.nonew.abilist b/libcxx/lib/abi/powerpc-ibm-aix.libcxxabi.v1.stable.exceptions.nonew.abilist
index 7e223e665288..033d9f9987fa 100644
--- a/libcxx/lib/abi/powerpc-ibm-aix.libcxxabi.v1.stable.exceptions.nonew.abilist
+++ b/libcxx/lib/abi/powerpc-ibm-aix.libcxxabi.v1.stable.exceptions.nonew.abilist
@@ -2022,7 +2022,8 @@
{'import_export': 'wIMP', 'is_defined': False, 'name': '_ZdaPv', 'storage_mapping_class': 'DS', 'type': 'FUNC'}
{'import_export': 'wIMP', 'is_defined': False, 'name': '_ZdaPvSt11align_val_t', 'storage_mapping_class': 'DS', 'type': 'FUNC'}
{'import_export': 'wIMP', 'is_defined': False, 'name': '_ZdlPv', 'storage_mapping_class': 'DS', 'type': 'FUNC'}
-{'import_export': 'wIMP', 'is_defined': False, 'name': '_ZdlPvSt11align_val_t', 'storage_mapping_class': 'DS', 'type': 'FUNC'}
+{'import_export': 'wIMP', 'is_defined': False, 'name': '_ZdlPvm', 'storage_mapping_class': 'DS', 'type': 'FUNC'}
+{'import_export': 'wIMP', 'is_defined': False, 'name': '_ZdlPvmSt11align_val_t', 'storage_mapping_class': 'DS', 'type': 'FUNC'}
{'import_export': 'wIMP', 'is_defined': False, 'name': '_Znam', 'storage_mapping_class': 'DS', 'type': 'FUNC'}
{'import_export': 'wIMP', 'is_defined': False, 'name': '_ZnamSt11align_val_t', 'storage_mapping_class': 'DS', 'type': 'FUNC'}
{'import_export': 'wIMP', 'is_defined': False, 'name': '_Znwm', 'storage_mapping_class': 'DS', 'type': 'FUNC'}
diff --git a/libcxx/lib/abi/powerpc64-ibm-aix.libcxxabi.v1.stable.exceptions.nonew.abilist b/libcxx/lib/abi/powerpc64-ibm-aix.libcxxabi.v1.stable.exceptions.nonew.abilist
index 407d0456757a..332d8abeb03e 100644
--- a/libcxx/lib/abi/powerpc64-ibm-aix.libcxxabi.v1.stable.exceptions.nonew.abilist
+++ b/libcxx/lib/abi/powerpc64-ibm-aix.libcxxabi.v1.stable.exceptions.nonew.abilist
@@ -2022,7 +2022,8 @@
{'import_export': 'wIMP', 'is_defined': False, 'name': '_ZdaPv', 'storage_mapping_class': 'DS', 'type': 'FUNC'}
{'import_export': 'wIMP', 'is_defined': False, 'name': '_ZdaPvSt11align_val_t', 'storage_mapping_class': 'DS', 'type': 'FUNC'}
{'import_export': 'wIMP', 'is_defined': False, 'name': '_ZdlPv', 'storage_mapping_class': 'DS', 'type': 'FUNC'}
-{'import_export': 'wIMP', 'is_defined': False, 'name': '_ZdlPvSt11align_val_t', 'storage_mapping_class': 'DS', 'type': 'FUNC'}
+{'import_export': 'wIMP', 'is_defined': False, 'name': '_ZdlPvm', 'storage_mapping_class': 'DS', 'type': 'FUNC'}
+{'import_export': 'wIMP', 'is_defined': False, 'name': '_ZdlPvmSt11align_val_t', 'storage_mapping_class': 'DS', 'type': 'FUNC'}
{'import_export': 'wIMP', 'is_defined': False, 'name': '_Znam', 'storage_mapping_class': 'DS', 'type': 'FUNC'}
{'import_export': 'wIMP', 'is_defined': False, 'name': '_ZnamSt11align_val_t', 'storage_mapping_class': 'DS', 'type': 'FUNC'}
{'import_export': 'wIMP', 'is_defined': False, 'name': '_Znwm', 'storage_mapping_class': 'DS', 'type': 'FUNC'}
diff --git a/libcxx/lib/abi/x86_64-unknown-freebsd.libcxxabi.v1.stable.exceptions.nonew.abilist b/libcxx/lib/abi/x86_64-unknown-freebsd.libcxxabi.v1.stable.exceptions.nonew.abilist
index 4022339562b3..3458b333dd6a 100644
--- a/libcxx/lib/abi/x86_64-unknown-freebsd.libcxxabi.v1.stable.exceptions.nonew.abilist
+++ b/libcxx/lib/abi/x86_64-unknown-freebsd.libcxxabi.v1.stable.exceptions.nonew.abilist
@@ -39,7 +39,8 @@
{'is_defined': False, 'name': '_ZdaPv', 'type': 'FUNC'}
{'is_defined': False, 'name': '_ZdaPvSt11align_val_t', 'type': 'FUNC'}
{'is_defined': False, 'name': '_ZdlPv', 'type': 'FUNC'}
-{'is_defined': False, 'name': '_ZdlPvSt11align_val_t', 'type': 'FUNC'}
+{'is_defined': False, 'name': '_ZdlPvm', 'type': 'FUNC'}
+{'is_defined': False, 'name': '_ZdlPvmSt11align_val_t', 'type': 'FUNC'}
{'is_defined': False, 'name': '_Znam', 'type': 'FUNC'}
{'is_defined': False, 'name': '_ZnamSt11align_val_t', 'type': 'FUNC'}
{'is_defined': False, 'name': '_Znwm', 'type': 'FUNC'}
diff --git a/libcxx/lib/abi/x86_64-unknown-linux-gnu.libcxxabi.v1.stable.exceptions.nonew.abilist b/libcxx/lib/abi/x86_64-unknown-linux-gnu.libcxxabi.v1.stable.exceptions.nonew.abilist
index 574c4504c59b..bdf90ba25c7f 100644
--- a/libcxx/lib/abi/x86_64-unknown-linux-gnu.libcxxabi.v1.stable.exceptions.nonew.abilist
+++ b/libcxx/lib/abi/x86_64-unknown-linux-gnu.libcxxabi.v1.stable.exceptions.nonew.abilist
@@ -39,7 +39,8 @@
{'is_defined': False, 'name': '_ZdaPv', 'type': 'FUNC'}
{'is_defined': False, 'name': '_ZdaPvSt11align_val_t', 'type': 'FUNC'}
{'is_defined': False, 'name': '_ZdlPv', 'type': 'FUNC'}
-{'is_defined': False, 'name': '_ZdlPvSt11align_val_t', 'type': 'FUNC'}
+{'is_defined': False, 'name': '_ZdlPvm', 'type': 'FUNC'}
+{'is_defined': False, 'name': '_ZdlPvmSt11align_val_t', 'type': 'FUNC'}
{'is_defined': False, 'name': '_Znam', 'type': 'FUNC'}
{'is_defined': False, 'name': '_ZnamSt11align_val_t', 'type': 'FUNC'}
{'is_defined': False, 'name': '_Znwm', 'type': 'FUNC'}
diff --git a/libcxx/lib/abi/x86_64-unknown-linux-gnu.libcxxabi.v1.stable.noexceptions.nonew.abilist b/libcxx/lib/abi/x86_64-unknown-linux-gnu.libcxxabi.v1.stable.noexceptions.nonew.abilist
index 665546699e8d..ac3cc129c04b 100644
--- a/libcxx/lib/abi/x86_64-unknown-linux-gnu.libcxxabi.v1.stable.noexceptions.nonew.abilist
+++ b/libcxx/lib/abi/x86_64-unknown-linux-gnu.libcxxabi.v1.stable.noexceptions.nonew.abilist
@@ -18,7 +18,8 @@
{'is_defined': False, 'name': '_ZdaPv', 'type': 'FUNC'}
{'is_defined': False, 'name': '_ZdaPvSt11align_val_t', 'type': 'FUNC'}
{'is_defined': False, 'name': '_ZdlPv', 'type': 'FUNC'}
-{'is_defined': False, 'name': '_ZdlPvSt11align_val_t', 'type': 'FUNC'}
+{'is_defined': False, 'name': '_ZdlPvm', 'type': 'FUNC'}
+{'is_defined': False, 'name': '_ZdlPvmSt11align_val_t', 'type': 'FUNC'}
{'is_defined': False, 'name': '_Znam', 'type': 'FUNC'}
{'is_defined': False, 'name': '_ZnamSt11align_val_t', 'type': 'FUNC'}
{'is_defined': False, 'name': '_Znwm', 'type': 'FUNC'}
diff --git a/libcxx/modules/CMakeLists.txt.in b/libcxx/modules/CMakeLists.txt.in
index c35f6fecb1fd..9fef16e9cefd 100644
--- a/libcxx/modules/CMakeLists.txt.in
+++ b/libcxx/modules/CMakeLists.txt.in
@@ -41,7 +41,7 @@ target_sources(std
std.cppm
)
-target_include_directories(std SYSTEM PRIVATE @LIBCXX_CONFIGURED_INCLUDE_DIRS@)
+target_include_directories(std SYSTEM PUBLIC @LIBCXX_CONFIGURED_INCLUDE_DIRS@)
if (NOT @LIBCXX_ENABLE_EXCEPTIONS@)
target_compile_options(std PUBLIC -fno-exceptions)
diff --git a/libcxx/modules/std/chrono.inc b/libcxx/modules/std/chrono.inc
index 813322a1797f..87e32afbe4bd 100644
--- a/libcxx/modules/std/chrono.inc
+++ b/libcxx/modules/std/chrono.inc
@@ -209,13 +209,12 @@ export namespace std {
using std::chrono::reload_tzdb;
using std::chrono::remote_version;
-# if 0
+# endif // !defined(_LIBCPP_HAS_NO_TIME_ZONE_DATABASE) && !defined(_LIBCPP_HAS_NO_FILESYSTEM) &&
+ // !defined(_LIBCPP_HAS_NO_LOCALIZATION)
+
// [time.zone.exception], exception classes
using std::chrono::ambiguous_local_time;
using std::chrono::nonexistent_local_time;
-# endif // if 0
-# endif // !defined(_LIBCPP_HAS_NO_TIME_ZONE_DATABASE) && !defined(_LIBCPP_HAS_NO_FILESYSTEM) &&
- // !defined(_LIBCPP_HAS_NO_LOCALIZATION)
// [time.zone.info], information classes
using std::chrono::local_info;
@@ -224,18 +223,14 @@ export namespace std {
# if !defined(_LIBCPP_HAS_NO_TIME_ZONE_DATABASE) && !defined(_LIBCPP_HAS_NO_FILESYSTEM) && \
!defined(_LIBCPP_HAS_NO_LOCALIZATION)
-# if 0
// [time.zone.timezone], class time_zone
using std::chrono::choose;
-# endif // if 0
-
using std::chrono::time_zone;
-# if 0
-
// [time.zone.zonedtraits], class template zoned_traits
using std::chrono::zoned_traits;
+# if 0
// [time.zone.zonedtime], class template zoned_time
using std::chrono::zoned_time;
diff --git a/libcxx/src/CMakeLists.txt b/libcxx/src/CMakeLists.txt
index 65e6ce2c4da4..9e6c70335a79 100644
--- a/libcxx/src/CMakeLists.txt
+++ b/libcxx/src/CMakeLists.txt
@@ -340,6 +340,9 @@ if (LIBCXX_ENABLE_LOCALIZATION AND LIBCXX_ENABLE_FILESYSTEM AND LIBCXX_ENABLE_TI
include/tzdb/types_private.h
include/tzdb/tzdb_list_private.h
include/tzdb/tzdb_private.h
+ # TODO TZDB The exception could be moved in chrono once the TZDB library
+ # is no longer experimental.
+ chrono_exception.cpp
time_zone.cpp
tzdb.cpp
tzdb_list.cpp
diff --git a/libcxx/src/atomic.cpp b/libcxx/src/atomic.cpp
index 7142f38c9609..ae062155661e 100644
--- a/libcxx/src/atomic.cpp
+++ b/libcxx/src/atomic.cpp
@@ -169,17 +169,18 @@ static void __libcpp_atomic_notify(void const volatile* __location) {
&__entry->__platform_state,
false /* when laundering, we can't handle notify_one */);
}
-_LIBCPP_EXPORTED_FROM_ABI void __cxx_atomic_notify_one(void const volatile* __location) {
+_LIBCPP_EXPORTED_FROM_ABI void __cxx_atomic_notify_one(void const volatile* __location) noexcept {
__libcpp_atomic_notify(__location);
}
-_LIBCPP_EXPORTED_FROM_ABI void __cxx_atomic_notify_all(void const volatile* __location) {
+_LIBCPP_EXPORTED_FROM_ABI void __cxx_atomic_notify_all(void const volatile* __location) noexcept {
__libcpp_atomic_notify(__location);
}
-_LIBCPP_EXPORTED_FROM_ABI __cxx_contention_t __libcpp_atomic_monitor(void const volatile* __location) {
+_LIBCPP_EXPORTED_FROM_ABI __cxx_contention_t __libcpp_atomic_monitor(void const volatile* __location) noexcept {
auto const __entry = __libcpp_contention_state(__location);
return __libcpp_contention_monitor_for_wait(&__entry->__contention_state, &__entry->__platform_state);
}
-_LIBCPP_EXPORTED_FROM_ABI void __libcpp_atomic_wait(void const volatile* __location, __cxx_contention_t __old_value) {
+_LIBCPP_EXPORTED_FROM_ABI void
+__libcpp_atomic_wait(void const volatile* __location, __cxx_contention_t __old_value) noexcept {
auto const __entry = __libcpp_contention_state(__location);
__libcpp_contention_wait(&__entry->__contention_state, &__entry->__platform_state, __old_value);
}
@@ -187,19 +188,19 @@ _LIBCPP_EXPORTED_FROM_ABI void __libcpp_atomic_wait(void const volatile* __locat
/* When the incoming atomic happens to be the platform wait size, we still need to use the
table for the contention detection, but we can use the atomic directly for the wait. */
-_LIBCPP_EXPORTED_FROM_ABI void __cxx_atomic_notify_one(__cxx_atomic_contention_t const volatile* __location) {
+_LIBCPP_EXPORTED_FROM_ABI void __cxx_atomic_notify_one(__cxx_atomic_contention_t const volatile* __location) noexcept {
__libcpp_contention_notify(&__libcpp_contention_state(__location)->__contention_state, __location, true);
}
-_LIBCPP_EXPORTED_FROM_ABI void __cxx_atomic_notify_all(__cxx_atomic_contention_t const volatile* __location) {
+_LIBCPP_EXPORTED_FROM_ABI void __cxx_atomic_notify_all(__cxx_atomic_contention_t const volatile* __location) noexcept {
__libcpp_contention_notify(&__libcpp_contention_state(__location)->__contention_state, __location, false);
}
// This function is never used, but still exported for ABI compatibility.
_LIBCPP_EXPORTED_FROM_ABI __cxx_contention_t
-__libcpp_atomic_monitor(__cxx_atomic_contention_t const volatile* __location) {
+__libcpp_atomic_monitor(__cxx_atomic_contention_t const volatile* __location) noexcept {
return __libcpp_contention_monitor_for_wait(&__libcpp_contention_state(__location)->__contention_state, __location);
}
_LIBCPP_EXPORTED_FROM_ABI void
-__libcpp_atomic_wait(__cxx_atomic_contention_t const volatile* __location, __cxx_contention_t __old_value) {
+__libcpp_atomic_wait(__cxx_atomic_contention_t const volatile* __location, __cxx_contention_t __old_value) noexcept {
__libcpp_contention_wait(&__libcpp_contention_state(__location)->__contention_state, __location, __old_value);
}
diff --git a/libcxx/src/barrier.cpp b/libcxx/src/barrier.cpp
index baa26101cd57..69601bfeec05 100644
--- a/libcxx/src/barrier.cpp
+++ b/libcxx/src/barrier.cpp
@@ -21,17 +21,17 @@ public:
} __tickets[64];
};
- ptrdiff_t& __expected;
- unique_ptr<__state_t[]> __state;
+ ptrdiff_t& __expected_;
+ unique_ptr<__state_t[]> __state_;
- _LIBCPP_HIDDEN __barrier_algorithm_base(ptrdiff_t& __expected) : __expected(__expected) {
+ _LIBCPP_HIDDEN __barrier_algorithm_base(ptrdiff_t& __expected) : __expected_(__expected) {
size_t const __count = (__expected + 1) >> 1;
- __state = unique_ptr<__state_t[]>(new __state_t[__count]);
+ __state_ = unique_ptr<__state_t[]>(new __state_t[__count]);
}
_LIBCPP_HIDDEN bool __arrive(__barrier_phase_t __old_phase) {
__barrier_phase_t const __half_step = __old_phase + 1, __full_step = __old_phase + 2;
- size_t __current_expected = __expected,
- __current = hash<thread::id>()(this_thread::get_id()) % ((__expected + 1) >> 1);
+ size_t __current_expected = __expected_,
+ __current = hash<thread::id>()(this_thread::get_id()) % ((__expected_ + 1) >> 1);
for (int __round = 0;; ++__round) {
if (__current_expected <= 1)
return true;
@@ -41,14 +41,14 @@ public:
__current = 0;
__barrier_phase_t expect = __old_phase;
if (__current == __last_node && (__current_expected & 1)) {
- if (__state[__current].__tickets[__round].__phase.compare_exchange_strong(
+ if (__state_[__current].__tickets[__round].__phase.compare_exchange_strong(
expect, __full_step, memory_order_acq_rel))
break; // I'm 1 in 1, go to next __round
- } else if (__state[__current].__tickets[__round].__phase.compare_exchange_strong(
+ } else if (__state_[__current].__tickets[__round].__phase.compare_exchange_strong(
expect, __half_step, memory_order_acq_rel)) {
return false; // I'm 1 in 2, done with arrival
} else if (expect == __half_step) {
- if (__state[__current].__tickets[__round].__phase.compare_exchange_strong(
+ if (__state_[__current].__tickets[__round].__phase.compare_exchange_strong(
expect, __full_step, memory_order_acq_rel))
break; // I'm 2 in 2, go to next __round
}
@@ -63,10 +63,10 @@ _LIBCPP_EXPORTED_FROM_ABI __barrier_algorithm_base* __construct_barrier_algorith
return new __barrier_algorithm_base(__expected);
}
_LIBCPP_EXPORTED_FROM_ABI bool
-__arrive_barrier_algorithm_base(__barrier_algorithm_base* __barrier, __barrier_phase_t __old_phase) {
+__arrive_barrier_algorithm_base(__barrier_algorithm_base* __barrier, __barrier_phase_t __old_phase) noexcept {
return __barrier->__arrive(__old_phase);
}
-_LIBCPP_EXPORTED_FROM_ABI void __destroy_barrier_algorithm_base(__barrier_algorithm_base* __barrier) {
+_LIBCPP_EXPORTED_FROM_ABI void __destroy_barrier_algorithm_base(__barrier_algorithm_base* __barrier) noexcept {
delete __barrier;
}
diff --git a/libcxx/test/libcxx/containers/sequences/vector/const_value_type.pass.cpp b/libcxx/src/chrono_exception.cpp
index 1ad505a76d3f..bea2ad110310 100644
--- a/libcxx/test/libcxx/containers/sequences/vector/const_value_type.pass.cpp
+++ b/libcxx/src/chrono_exception.cpp
@@ -6,20 +6,17 @@
//
//===----------------------------------------------------------------------===//
-// UNSUPPORTED: c++03
+#include <chrono>
-// <vector>
+_LIBCPP_BEGIN_NAMESPACE_STD
-// vector<const int> v; // an extension
+namespace chrono {
-#include <vector>
-#include <type_traits>
+_LIBCPP_AVAILABILITY_TZDB
+_LIBCPP_EXPORTED_FROM_ABI nonexistent_local_time::~nonexistent_local_time() = default; // key function
+_LIBCPP_AVAILABILITY_TZDB
+_LIBCPP_EXPORTED_FROM_ABI ambiguous_local_time::~ambiguous_local_time() = default; // key function
-#include "test_macros.h"
+} // namespace chrono
-int main(int, char**)
-{
- std::vector<const int> v = {1, 2, 3};
-
- return 0;
-}
+_LIBCPP_END_NAMESPACE_STD
diff --git a/libcxx/src/filesystem/operations.cpp b/libcxx/src/filesystem/operations.cpp
index 62bb248d5eca..a83c1ae15a4a 100644
--- a/libcxx/src/filesystem/operations.cpp
+++ b/libcxx/src/filesystem/operations.cpp
@@ -109,26 +109,23 @@ void __copy(const path& from, const path& to, copy_options options, error_code*
const bool sym_status2 = bool(options & copy_options::copy_symlinks);
error_code m_ec1;
- StatT f_st = {};
+ StatT f_st;
const file_status f =
sym_status || sym_status2 ? detail::posix_lstat(from, f_st, &m_ec1) : detail::posix_stat(from, f_st, &m_ec1);
if (m_ec1)
return err.report(m_ec1);
- StatT t_st = {};
+ StatT t_st;
const file_status t = sym_status ? detail::posix_lstat(to, t_st, &m_ec1) : detail::posix_stat(to, t_st, &m_ec1);
if (not status_known(t))
return err.report(m_ec1);
if (!exists(f) || is_other(f) || is_other(t) || (is_directory(f) && is_regular_file(t)) ||
- detail::stat_equivalent(f_st, t_st)) {
+ (exists(t) && detail::stat_equivalent(f_st, t_st))) {
return err.report(errc::function_not_supported);
}
- if (ec)
- ec->clear();
-
if (is_symlink(f)) {
if (bool(copy_options::skip_symlinks & options)) {
// do nothing
@@ -166,15 +163,15 @@ void __copy(const path& from, const path& to, copy_options options, error_code*
return;
}
error_code m_ec2;
- for (; it != directory_iterator(); it.increment(m_ec2)) {
- if (m_ec2) {
- return err.report(m_ec2);
- }
+ for (; !m_ec2 && it != directory_iterator(); it.increment(m_ec2)) {
__copy(it->path(), to / it->path().filename(), options | copy_options::__in_recursive_copy, ec);
if (ec && *ec) {
return;
}
}
+ if (m_ec2) {
+ return err.report(m_ec2);
+ }
}
}
@@ -936,23 +933,28 @@ path __weakly_canonical(const path& p, error_code* ec) {
--PP;
vector<string_view_t> DNEParts;
- while (PP.State != PathParser::PS_BeforeBegin) {
+ error_code m_ec;
+ while (PP.State_ != PathParser::PS_BeforeBegin) {
tmp.assign(createView(p.native().data(), &PP.RawEntry.back()));
- error_code m_ec;
file_status st = __status(tmp, &m_ec);
if (!status_known(st)) {
return err.report(m_ec);
} else if (exists(st)) {
- result = __canonical(tmp, ec);
+ result = __canonical(tmp, &m_ec);
+ if (m_ec) {
+ return err.report(m_ec);
+ }
break;
}
DNEParts.push_back(*PP);
--PP;
}
- if (PP.State == PathParser::PS_BeforeBegin)
- result = __canonical("", ec);
- if (ec)
- ec->clear();
+ if (PP.State_ == PathParser::PS_BeforeBegin) {
+ result = __canonical("", &m_ec);
+ if (m_ec) {
+ return err.report(m_ec);
+ }
+ }
if (DNEParts.empty())
return result;
for (auto It = DNEParts.rbegin(); It != DNEParts.rend(); ++It)
diff --git a/libcxx/src/filesystem/path.cpp b/libcxx/src/filesystem/path.cpp
index c89346aa510c..b2019521377e 100644
--- a/libcxx/src/filesystem/path.cpp
+++ b/libcxx/src/filesystem/path.cpp
@@ -45,23 +45,23 @@ path& path::replace_extension(path const& replacement) {
string_view_t path::__root_name() const {
auto PP = PathParser::CreateBegin(__pn_);
- if (PP.State == PathParser::PS_InRootName)
+ if (PP.State_ == PathParser::PS_InRootName)
return *PP;
return {};
}
string_view_t path::__root_directory() const {
auto PP = PathParser::CreateBegin(__pn_);
- if (PP.State == PathParser::PS_InRootName)
+ if (PP.State_ == PathParser::PS_InRootName)
++PP;
- if (PP.State == PathParser::PS_InRootDir)
+ if (PP.State_ == PathParser::PS_InRootDir)
return *PP;
return {};
}
string_view_t path::__root_path_raw() const {
auto PP = PathParser::CreateBegin(__pn_);
- if (PP.State == PathParser::PS_InRootName) {
+ if (PP.State_ == PathParser::PS_InRootName) {
auto NextCh = PP.peek();
if (NextCh && isSeparator(*NextCh)) {
++PP;
@@ -69,24 +69,24 @@ string_view_t path::__root_path_raw() const {
}
return PP.RawEntry;
}
- if (PP.State == PathParser::PS_InRootDir)
+ if (PP.State_ == PathParser::PS_InRootDir)
return *PP;
return {};
}
static bool ConsumeRootName(PathParser* PP) {
static_assert(PathParser::PS_BeforeBegin == 1 && PathParser::PS_InRootName == 2, "Values for enums are incorrect");
- while (PP->State <= PathParser::PS_InRootName)
+ while (PP->State_ <= PathParser::PS_InRootName)
++(*PP);
- return PP->State == PathParser::PS_AtEnd;
+ return PP->State_ == PathParser::PS_AtEnd;
}
static bool ConsumeRootDir(PathParser* PP) {
static_assert(PathParser::PS_BeforeBegin == 1 && PathParser::PS_InRootName == 2 && PathParser::PS_InRootDir == 3,
"Values for enums are incorrect");
- while (PP->State <= PathParser::PS_InRootDir)
+ while (PP->State_ <= PathParser::PS_InRootDir)
++(*PP);
- return PP->State == PathParser::PS_AtEnd;
+ return PP->State_ == PathParser::PS_AtEnd;
}
string_view_t path::__relative_path() const {
@@ -248,7 +248,7 @@ path path::lexically_relative(const path& base) const {
auto PP = PathParser::CreateBegin(__pn_);
auto PPBase = PathParser::CreateBegin(base.__pn_);
auto CheckIterMismatchAtBase = [&]() {
- return PP.State != PPBase.State && (PP.inRootPath() || PPBase.inRootPath());
+ return PP.State_ != PPBase.State_ && (PP.inRootPath() || PPBase.inRootPath());
};
if (PP.inRootName() && PPBase.inRootName()) {
if (*PP != *PPBase)
@@ -267,7 +267,7 @@ path path::lexically_relative(const path& base) const {
// Find the first mismatching element
auto PP = PathParser::CreateBegin(__pn_);
auto PPBase = PathParser::CreateBegin(base.__pn_);
- while (PP && PPBase && PP.State == PPBase.State && *PP == *PPBase) {
+ while (PP && PPBase && PP.State_ == PPBase.State_ && *PP == *PPBase) {
++PP;
++PPBase;
}
@@ -380,7 +380,7 @@ path::iterator path::begin() const {
auto PP = PathParser::CreateBegin(__pn_);
iterator it;
it.__path_ptr_ = this;
- it.__state_ = static_cast<path::iterator::_ParserState>(PP.State);
+ it.__state_ = static_cast<path::iterator::_ParserState>(PP.State_);
it.__entry_ = PP.RawEntry;
it.__stashed_elem_.__assign_view(*PP);
return it;
@@ -396,7 +396,7 @@ path::iterator path::end() const {
path::iterator& path::iterator::__increment() {
PathParser PP(__path_ptr_->native(), __entry_, __state_);
++PP;
- __state_ = static_cast<_ParserState>(PP.State);
+ __state_ = static_cast<_ParserState>(PP.State_);
__entry_ = PP.RawEntry;
__stashed_elem_.__assign_view(*PP);
return *this;
@@ -405,7 +405,7 @@ path::iterator& path::iterator::__increment() {
path::iterator& path::iterator::__decrement() {
PathParser PP(__path_ptr_->native(), __entry_, __state_);
--PP;
- __state_ = static_cast<_ParserState>(PP.State);
+ __state_ = static_cast<_ParserState>(PP.State_);
__entry_ = PP.RawEntry;
__stashed_elem_.__assign_view(*PP);
return *this;
diff --git a/libcxx/src/filesystem/path_parser.h b/libcxx/src/filesystem/path_parser.h
index 28a8f240e3bd..06623696452d 100644
--- a/libcxx/src/filesystem/path_parser.h
+++ b/libcxx/src/filesystem/path_parser.h
@@ -50,14 +50,14 @@ struct PathParser {
const string_view_t Path;
string_view_t RawEntry;
- ParserState State;
+ ParserState State_;
private:
- PathParser(string_view_t P, ParserState State) noexcept : Path(P), State(State) {}
+ PathParser(string_view_t P, ParserState State) noexcept : Path(P), State_(State) {}
public:
PathParser(string_view_t P, string_view_t E, unsigned char S)
- : Path(P), RawEntry(E), State(static_cast<ParserState>(S)) {
+ : Path(P), RawEntry(E), State_(static_cast<ParserState>(S)) {
// S cannot be '0' or PS_BeforeBegin.
}
@@ -84,7 +84,7 @@ public:
if (Start == End)
return makeState(PS_AtEnd);
- switch (State) {
+ switch (State_) {
case PS_BeforeBegin: {
PosPtr TkEnd = consumeRootName(Start, End);
if (TkEnd)
@@ -125,7 +125,7 @@ public:
if (RStart == REnd) // we're decrementing the begin
return makeState(PS_BeforeBegin);
- switch (State) {
+ switch (State_) {
case PS_AtEnd: {
// Try to consume a trailing separator or root directory first.
if (PosPtr SepEnd = consumeAllSeparators(RStart, REnd)) {
@@ -169,7 +169,7 @@ public:
/// \brief Return a view with the "preferred representation" of the current
/// element. For example trailing separators are represented as a '.'
string_view_t operator*() const noexcept {
- switch (State) {
+ switch (State_) {
case PS_BeforeBegin:
case PS_AtEnd:
return PATHSTR("");
@@ -187,7 +187,7 @@ public:
__libcpp_unreachable();
}
- explicit operator bool() const noexcept { return State != PS_BeforeBegin && State != PS_AtEnd; }
+ explicit operator bool() const noexcept { return State_ != PS_BeforeBegin && State_ != PS_AtEnd; }
PathParser& operator++() noexcept {
increment();
@@ -199,21 +199,21 @@ public:
return *this;
}
- bool atEnd() const noexcept { return State == PS_AtEnd; }
+ bool atEnd() const noexcept { return State_ == PS_AtEnd; }
- bool inRootDir() const noexcept { return State == PS_InRootDir; }
+ bool inRootDir() const noexcept { return State_ == PS_InRootDir; }
- bool inRootName() const noexcept { return State == PS_InRootName; }
+ bool inRootName() const noexcept { return State_ == PS_InRootName; }
bool inRootPath() const noexcept { return inRootName() || inRootDir(); }
private:
void makeState(ParserState NewState, PosPtr Start, PosPtr End) noexcept {
- State = NewState;
+ State_ = NewState;
RawEntry = string_view_t(Start, End - Start);
}
void makeState(ParserState NewState) noexcept {
- State = NewState;
+ State_ = NewState;
RawEntry = {};
}
@@ -224,7 +224,7 @@ private:
/// \brief Return a pointer to the first character after the currently
/// lexed element.
PosPtr getNextTokenStartPos() const noexcept {
- switch (State) {
+ switch (State_) {
case PS_BeforeBegin:
return Path.data();
case PS_InRootName:
@@ -241,7 +241,7 @@ private:
/// \brief Return a pointer to the first character in the currently lexed
/// element.
PosPtr getCurrentTokenStartPos() const noexcept {
- switch (State) {
+ switch (State_) {
case PS_BeforeBegin:
case PS_InRootName:
return &Path.front();
diff --git a/libcxx/src/locale.cpp b/libcxx/src/locale.cpp
index c5ab6de5d657..4efdc63c0966 100644
--- a/libcxx/src/locale.cpp
+++ b/libcxx/src/locale.cpp
@@ -557,9 +557,9 @@ locale::locale(const locale& other, const locale& one, category c)
string locale::name() const { return __locale_->name(); }
-void locale::__install_ctor(const locale& other, facet* f, long id) {
+void locale::__install_ctor(const locale& other, facet* f, long facet_id) {
if (f)
- __locale_ = new __imp(*other.__locale_, f, id);
+ __locale_ = new __imp(*other.__locale_, f, facet_id);
else
__locale_ = other.__locale_;
__locale_->acquire();
diff --git a/libcxx/test/CMakeLists.txt b/libcxx/test/CMakeLists.txt
index 3c54a4edccff..cdd1c2d90fbc 100644
--- a/libcxx/test/CMakeLists.txt
+++ b/libcxx/test/CMakeLists.txt
@@ -34,31 +34,6 @@ endif()
serialize_lit_params_list(SERIALIZED_LIT_PARAMS LIBCXX_TEST_PARAMS)
-if (MSVC)
- # Shared code for initializing some parameters used by all
- # llvm-libc++-*-clangcl.cfg.in test configs.
- set(dbg_include "")
-
- if (NOT CMAKE_MSVC_RUNTIME_LIBRARY OR CMAKE_MSVC_RUNTIME_LIBRARY MATCHES "DLL$")
- set(fms_runtime_lib "dll")
- set(cxx_lib "msvcprt")
- else()
- set(fms_runtime_lib "static")
- set(cxx_lib "libcpmt")
- endif()
-
- if ((NOT CMAKE_MSVC_RUNTIME_LIBRARY AND uppercase_CMAKE_BUILD_TYPE STREQUAL "DEBUG")
- OR (CMAKE_MSVC_RUNTIME_LIBRARY MATCHES "Debug"))
- set(dbg_include " -include set_windows_crt_report_mode.h")
- set(fms_runtime_lib "${fms_runtime_lib}_dbg")
- set(cxx_lib "${cxx_lib}d")
- endif()
-
- serialize_lit_string_param(SERIALIZED_LIT_PARAMS dbg_include "${dbg_include}")
- serialize_lit_string_param(SERIALIZED_LIT_PARAMS fms_runtime_lib "${fms_runtime_lib}")
- serialize_lit_string_param(SERIALIZED_LIT_PARAMS cxx_lib "${cxx_lib}")
-endif()
-
if (LIBCXX_INCLUDE_TESTS)
include(AddLLVM) # for configure_lit_site_cfg and add_lit_testsuite
diff --git a/libcxx/test/configs/apple-libc++-backdeployment.cfg.in b/libcxx/test/configs/apple-libc++-backdeployment.cfg.in
index 42594461f10e..9843c4a9ad70 100644
--- a/libcxx/test/configs/apple-libc++-backdeployment.cfg.in
+++ b/libcxx/test/configs/apple-libc++-backdeployment.cfg.in
@@ -55,6 +55,7 @@ config.substitutions.append(('%{exec}',
))
config.stdlib = 'apple-libc++'
+config.using_system_stdlib = True
libcxx.test.config.configure(
libcxx.test.params.DEFAULT_PARAMETERS + BACKDEPLOYMENT_PARAMETERS,
diff --git a/libcxx/test/configs/apple-libc++-shared.cfg.in b/libcxx/test/configs/apple-libc++-shared.cfg.in
deleted file mode 100644
index 2d0aee3ae905..000000000000
--- a/libcxx/test/configs/apple-libc++-shared.cfg.in
+++ /dev/null
@@ -1,35 +0,0 @@
-# Testing configuration for Apple's system libc++.
-#
-# This configuration differs from a normal LLVM shared library configuration in
-# that we must use DYLD_LIBRARY_PATH to run the tests against the just-built library,
-# since Apple's libc++ has an absolute install_name.
-#
-# We also don't use a per-target include directory layout, so we have only one
-# include directory for the libc++ headers.
-
-lit_config.load_config(config, '@CMAKE_CURRENT_BINARY_DIR@/cmake-bridge.cfg')
-
-config.substitutions.append(('%{flags}',
- '-isysroot {}'.format('@CMAKE_OSX_SYSROOT@') if '@CMAKE_OSX_SYSROOT@' else ''
-))
-config.substitutions.append(('%{compile_flags}',
- '-nostdinc++ -I %{include-dir} -I %{libcxx-dir}/test/support'
-))
-config.substitutions.append(('%{link_flags}',
- '-nostdlib++ -L %{lib-dir} -lc++'
-))
-config.substitutions.append(('%{exec}',
- '%{executor} --execdir %T --env DYLD_LIBRARY_PATH=%{lib-dir} -- '
-))
-
-config.stdlib = 'apple-libc++'
-
-import os, site
-site.addsitedir(os.path.join('@LIBCXX_SOURCE_DIR@', 'utils'))
-import libcxx.test.params, libcxx.test.config
-libcxx.test.config.configure(
- libcxx.test.params.DEFAULT_PARAMETERS,
- libcxx.test.features.DEFAULT_FEATURES,
- config,
- lit_config
-)
diff --git a/libcxx/test/configs/llvm-libc++-shared-clangcl.cfg.in b/libcxx/test/configs/llvm-libc++-shared-clangcl.cfg.in
index 163123fffb75..cffe895f653e 100644
--- a/libcxx/test/configs/llvm-libc++-shared-clangcl.cfg.in
+++ b/libcxx/test/configs/llvm-libc++-shared-clangcl.cfg.in
@@ -3,12 +3,26 @@
lit_config.load_config(config, '@CMAKE_CURRENT_BINARY_DIR@/cmake-bridge.cfg')
+dbg_include = ''
+runtime_library = '@CMAKE_MSVC_RUNTIME_LIBRARY@'
+if runtime_library == '' or runtime_library.endswith('DLL'):
+ fms_runtime_lib = 'dll'
+ cxx_lib = 'msvcprt'
+else:
+ fms_runtime_lib = 'static'
+ cxx_lib = 'libcpmt'
+
+if '@CMAKE_BUILD_TYPE@'.upper() == 'DEBUG':
+ dbg_include = ' -D_DEBUG -include set_windows_crt_report_mode.h'
+ fms_runtime_lib += '_dbg'
+ cxx_lib += 'd'
+
config.substitutions.append(('%{flags}', '--driver-mode=g++'))
config.substitutions.append(('%{compile_flags}',
- '-fms-runtime-lib=' + config.fms_runtime_lib + ' -nostdinc++ -I %{target-include-dir} -I %{include-dir} -I %{libcxx-dir}/test/support -D_CRT_SECURE_NO_WARNINGS -D_CRT_NONSTDC_NO_WARNINGS -D_CRT_STDIO_ISO_WIDE_SPECIFIERS -DNOMINMAX' + config.dbg_include
+ '-fms-runtime-lib=' + fms_runtime_lib + ' -nostdinc++ -I %{target-include-dir} -I %{include-dir} -I %{libcxx-dir}/test/support -D_CRT_SECURE_NO_WARNINGS -D_CRT_NONSTDC_NO_WARNINGS -D_CRT_STDIO_ISO_WIDE_SPECIFIERS -DNOMINMAX' + dbg_include
))
config.substitutions.append(('%{link_flags}',
- '-nostdlib -L %{lib-dir} -lc++ -l' + config.cxx_lib
+ '-nostdlib -L %{lib-dir} -lc++ -l' + cxx_lib
))
config.substitutions.append(('%{exec}',
'%{executor} --execdir %T --prepend_env PATH=%{lib-dir} -- '
diff --git a/libcxx/test/configs/llvm-libc++-shared-no-vcruntime-clangcl.cfg.in b/libcxx/test/configs/llvm-libc++-shared-no-vcruntime-clangcl.cfg.in
index a8ad920897e6..80c7c0ee669a 100644
--- a/libcxx/test/configs/llvm-libc++-shared-no-vcruntime-clangcl.cfg.in
+++ b/libcxx/test/configs/llvm-libc++-shared-no-vcruntime-clangcl.cfg.in
@@ -4,12 +4,26 @@
lit_config.load_config(config, '@CMAKE_CURRENT_BINARY_DIR@/cmake-bridge.cfg')
+dbg_include = ''
+runtime_library = '@CMAKE_MSVC_RUNTIME_LIBRARY@'
+if runtime_library == '' or runtime_library.endswith('DLL'):
+ fms_runtime_lib = 'dll'
+ cxx_lib = 'msvcprt'
+else:
+ fms_runtime_lib = 'static'
+ cxx_lib = 'libcpmt'
+
+if '@CMAKE_BUILD_TYPE@'.upper() == 'DEBUG':
+ dbg_include = ' -D_DEBUG -include set_windows_crt_report_mode.h'
+ fms_runtime_lib += '_dbg'
+ cxx_lib += 'd'
+
config.substitutions.append(('%{flags}', '--driver-mode=g++'))
config.substitutions.append(('%{compile_flags}',
- '-fms-runtime-lib=' + config.fms_runtime_lib + ' -nostdinc++ -I %{include-dir} -I %{target-include-dir} -I %{libcxx-dir}/test/support -D_CRT_SECURE_NO_WARNINGS -D_CRT_NONSTDC_NO_WARNINGS -D_CRT_STDIO_ISO_WIDE_SPECIFIERS -DNOMINMAX -D_HAS_EXCEPTIONS=0' + config.dbg_include
+ '-fms-runtime-lib=' + fms_runtime_lib + ' -nostdinc++ -I %{include-dir} -I %{target-include-dir} -I %{libcxx-dir}/test/support -D_CRT_SECURE_NO_WARNINGS -D_CRT_NONSTDC_NO_WARNINGS -D_CRT_STDIO_ISO_WIDE_SPECIFIERS -DNOMINMAX -D_HAS_EXCEPTIONS=0' + dbg_include
))
config.substitutions.append(('%{link_flags}',
- '-nostdlib -L %{lib-dir} -lc++ -l' + config.cxx_lib
+ '-nostdlib -L %{lib-dir} -lc++ -l' + cxx_lib
))
config.substitutions.append(('%{exec}',
'%{executor} --execdir %T --prepend_env PATH=%{lib-dir} -- '
diff --git a/libcxx/test/configs/llvm-libc++-static-clangcl.cfg.in b/libcxx/test/configs/llvm-libc++-static-clangcl.cfg.in
index 58ca3f27c713..4b6b3fcf2d9c 100644
--- a/libcxx/test/configs/llvm-libc++-static-clangcl.cfg.in
+++ b/libcxx/test/configs/llvm-libc++-static-clangcl.cfg.in
@@ -3,12 +3,26 @@
lit_config.load_config(config, '@CMAKE_CURRENT_BINARY_DIR@/cmake-bridge.cfg')
+dbg_include = ''
+runtime_library = '@CMAKE_MSVC_RUNTIME_LIBRARY@'
+if runtime_library == '' or runtime_library.endswith('DLL'):
+ fms_runtime_lib = 'dll'
+ cxx_lib = 'msvcprt'
+else:
+ fms_runtime_lib = 'static'
+ cxx_lib = 'libcpmt'
+
+if '@CMAKE_BUILD_TYPE@'.upper() == 'DEBUG':
+ dbg_include = ' -D_DEBUG -include set_windows_crt_report_mode.h'
+ fms_runtime_lib += '_dbg'
+ cxx_lib += 'd'
+
config.substitutions.append(('%{flags}', '--driver-mode=g++'))
config.substitutions.append(('%{compile_flags}',
- '-fms-runtime-lib=' + config.fms_runtime_lib + ' -nostdinc++ -I %{target-include-dir} -I %{include-dir} -I %{libcxx-dir}/test/support -D_CRT_SECURE_NO_WARNINGS -D_CRT_NONSTDC_NO_WARNINGS -D_CRT_STDIO_ISO_WIDE_SPECIFIERS -DNOMINMAX' + config.dbg_include
+ '-fms-runtime-lib=' + fms_runtime_lib + ' -nostdinc++ -I %{target-include-dir} -I %{include-dir} -I %{libcxx-dir}/test/support -D_CRT_SECURE_NO_WARNINGS -D_CRT_NONSTDC_NO_WARNINGS -D_CRT_STDIO_ISO_WIDE_SPECIFIERS -DNOMINMAX' + dbg_include
))
config.substitutions.append(('%{link_flags}',
- '-nostdlib -L %{lib-dir} -llibc++ -l' + config.cxx_lib
+ '-nostdlib -L %{lib-dir} -llibc++ -l' + cxx_lib
))
config.substitutions.append(('%{exec}',
'%{executor} --execdir %T -- '
diff --git a/libcxx/test/libcxx/algorithms/pstl.iterator-requirements.verify.cpp b/libcxx/test/libcxx/algorithms/pstl.iterator-requirements.verify.cpp
index 98e3509752e1..e5bd7e764c59 100644
--- a/libcxx/test/libcxx/algorithms/pstl.iterator-requirements.verify.cpp
+++ b/libcxx/test/libcxx/algorithms/pstl.iterator-requirements.verify.cpp
@@ -26,6 +26,7 @@
#include <algorithm>
#include <cstddef>
+#include <execution>
#include <numeric>
#include "test_iterators.h"
diff --git a/libcxx/test/libcxx/algorithms/pstl.robust_against_customization_points_not_working.pass.cpp b/libcxx/test/libcxx/algorithms/pstl.robust_against_customization_points_not_working.pass.cpp
deleted file mode 100644
index 09258f7c9eb5..000000000000
--- a/libcxx/test/libcxx/algorithms/pstl.robust_against_customization_points_not_working.pass.cpp
+++ /dev/null
@@ -1,405 +0,0 @@
-//===----------------------------------------------------------------------===//
-//
-// Part of the LLVM Project, under the Apache 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
-// UNSUPPORTED: libcpp-has-no-incomplete-pstl
-
-// Having a customization point outside the module doesn't work, so this test is inherently module-hostile.
-// UNSUPPORTED: clang-modules-build
-
-// Make sure that the customization points get called properly when overloaded
-
-#include <__config>
-#include <__iterator/iterator_traits.h>
-#include <__iterator/readable_traits.h>
-#include <__utility/empty.h>
-#include <cassert>
-#include <optional>
-
-struct TestPolicy {};
-struct TestBackend {};
-
-_LIBCPP_BEGIN_NAMESPACE_STD
-
-bool pstl_any_of_called = false;
-
-template <class, class ForwardIterator, class Pred>
-optional<bool> __pstl_any_of(TestBackend, ForwardIterator, ForwardIterator, Pred) {
- assert(!pstl_any_of_called);
- pstl_any_of_called = true;
- return true;
-}
-
-bool pstl_all_of_called = false;
-
-template <class, class ForwardIterator, class Pred>
-optional<bool> __pstl_all_of(TestBackend, ForwardIterator, ForwardIterator, Pred) {
- assert(!pstl_all_of_called);
- pstl_all_of_called = true;
- return true;
-}
-
-bool pstl_copy_called = false;
-
-template <class, class ForwardIterator, class ForwardOutIterator>
-optional<ForwardOutIterator> __pstl_copy(TestBackend, ForwardIterator, ForwardIterator, ForwardOutIterator res) {
- assert(!pstl_copy_called);
- pstl_copy_called = true;
- return res;
-}
-
-bool pstl_copy_n_called = false;
-
-template <class, class ForwardIterator, class Size, class ForwardOutIterator>
-optional<ForwardOutIterator> __pstl_copy_n(TestBackend, ForwardIterator, Size, ForwardOutIterator res) {
- assert(!pstl_copy_n_called);
- pstl_copy_n_called = true;
- return res;
-}
-
-bool pstl_count_called = false;
-
-template <class, class ForwardIterator, class T>
-optional<typename std::iterator_traits<ForwardIterator>::difference_type>
-__pstl_count(TestBackend, ForwardIterator, ForwardIterator, const T&) {
- assert(!pstl_count_called);
- pstl_count_called = true;
- return 0;
-}
-
-bool pstl_count_if_called = false;
-
-template <class, class ForwardIterator, class Pred>
-optional<typename std::iterator_traits<ForwardIterator>::difference_type>
-__pstl_count_if(TestBackend, ForwardIterator, ForwardIterator, Pred) {
- assert(!pstl_count_if_called);
- pstl_count_if_called = true;
- return 0;
-}
-
-bool pstl_generate_called = false;
-
-template <class, class ForwardIterator, class Gen>
-optional<__empty> __pstl_generate(TestBackend, ForwardIterator, ForwardIterator, Gen) {
- assert(!pstl_generate_called);
- pstl_generate_called = true;
- return __empty{};
-}
-
-bool pstl_generate_n_called = false;
-
-template <class, class ForwardIterator, class Size, class Gen>
-optional<__empty> __pstl_generate_n(TestBackend, Size, ForwardIterator, Gen) {
- assert(!pstl_generate_n_called);
- pstl_generate_n_called = true;
- return __empty{};
-}
-
-bool pstl_none_of_called = false;
-
-template <class, class ForwardIterator, class Pred>
-optional<bool> __pstl_none_of(TestBackend, ForwardIterator, ForwardIterator, Pred) {
- assert(!pstl_none_of_called);
- pstl_none_of_called = true;
- return true;
-}
-
-bool pstl_find_called = false;
-
-template <class, class ForwardIterator, class Pred>
-optional<ForwardIterator> __pstl_find(TestBackend, ForwardIterator first, ForwardIterator, Pred) {
- assert(!pstl_find_called);
- pstl_find_called = true;
- return first;
-}
-
-bool pstl_find_if_called = false;
-
-template <class, class ForwardIterator, class Pred>
-optional<ForwardIterator> __pstl_find_if(TestBackend, ForwardIterator first, ForwardIterator, Pred) {
- assert(!pstl_find_if_called);
- pstl_find_if_called = true;
- return first;
-}
-
-bool pstl_find_if_not_called = false;
-
-template <class, class ForwardIterator, class Pred>
-optional<ForwardIterator> __pstl_find_if_not(TestBackend, ForwardIterator first, ForwardIterator, Pred) {
- assert(!pstl_find_if_not_called);
- pstl_find_if_not_called = true;
- return first;
-}
-
-bool pstl_for_each_called = false;
-
-template <class, class ForwardIterator, class Size, class Func>
-optional<__empty> __pstl_for_each(TestBackend, ForwardIterator, Size, Func) {
- assert(!pstl_for_each_called);
- pstl_for_each_called = true;
- return __empty{};
-}
-
-bool pstl_for_each_n_called = false;
-
-template <class, class ForwardIterator, class Size, class Func>
-optional<__empty> __pstl_for_each_n(TestBackend, ForwardIterator, Size, Func) {
- assert(!pstl_for_each_n_called);
- pstl_for_each_n_called = true;
- return __empty{};
-}
-
-bool pstl_fill_called = false;
-
-template <class, class ForwardIterator, class Size, class Func>
-optional<__empty> __pstl_fill(TestBackend, ForwardIterator, Size, Func) {
- assert(!pstl_fill_called);
- pstl_fill_called = true;
- return __empty{};
-}
-
-bool pstl_fill_n_called = false;
-
-template <class, class ForwardIterator, class Size, class Func>
-optional<__empty> __pstl_fill_n(TestBackend, ForwardIterator, Size, Func) {
- assert(!pstl_fill_n_called);
- pstl_fill_n_called = true;
- return __empty{};
-}
-
-bool pstl_move_called = false;
-
-template <class, class ForwardIterator, class Size, class Func>
-ForwardIterator __pstl_move(TestBackend, ForwardIterator, Size, Func) {
- assert(!pstl_move_called);
- pstl_move_called = true;
- return 0;
-}
-
-bool pstl_is_partitioned_called = false;
-
-template <class, class ForwardIterator, class Func>
-optional<bool> __pstl_is_partitioned(TestBackend, ForwardIterator, ForwardIterator, Func) {
- assert(!pstl_is_partitioned_called);
- pstl_is_partitioned_called = true;
- return true;
-}
-
-bool pstl_replace_called = false;
-
-template <class, class ForwardIterator, class T>
-optional<__empty> __pstl_replace(TestBackend, ForwardIterator, ForwardIterator, const T&, const T&) {
- assert(!pstl_replace_called);
- pstl_replace_called = true;
- return __empty{};
-}
-
-bool pstl_replace_if_called = false;
-
-template <class, class ForwardIterator, class T, class Func>
-optional<__empty> __pstl_replace_if(TestBackend, ForwardIterator, ForwardIterator, Func, const T&) {
- assert(!pstl_replace_if_called);
- pstl_replace_if_called = true;
- return __empty{};
-}
-
-bool pstl_replace_copy_called = false;
-
-template <class, class ForwardIterator, class ForwardOutIterator, class T>
-optional<__empty>
-__pstl_replace_copy(TestBackend, ForwardIterator, ForwardIterator, ForwardOutIterator, const T&, const T&) {
- assert(!pstl_replace_copy_called);
- pstl_replace_copy_called = true;
- return __empty{};
-}
-
-bool pstl_replace_copy_if_called = false;
-
-template <class, class ForwardIterator, class ForwardOutIterator, class T, class Func>
-optional<__empty>
-__pstl_replace_copy_if(TestBackend, ForwardIterator, ForwardIterator, ForwardOutIterator, Func, const T&) {
- assert(!pstl_replace_copy_if_called);
- pstl_replace_copy_if_called = true;
- return __empty{};
-}
-
-bool pstl_rotate_copy_called = false;
-
-template <class, class ForwardIterator, class ForwardOutIterator>
-optional<ForwardOutIterator>
-__pstl_rotate_copy(TestBackend, ForwardIterator, ForwardIterator, ForwardIterator, ForwardOutIterator res) {
- assert(!pstl_rotate_copy_called);
- pstl_rotate_copy_called = true;
- return res;
-}
-
-bool pstl_unary_transform_called = false;
-
-template <class, class ForwardIterator, class ForwardOutIterator, class UnaryOperation>
-optional<ForwardOutIterator>
-__pstl_transform(TestBackend, ForwardIterator, ForwardIterator, ForwardOutIterator res, UnaryOperation) {
- assert(!pstl_unary_transform_called);
- pstl_unary_transform_called = true;
- return res;
-}
-
-bool pstl_binary_transform_called = false;
-
-template <class, class ForwardIterator1, class ForwardIterator2, class ForwardOutIterator, class BinaryOperation>
-optional<ForwardOutIterator> __pstl_transform(
- TestBackend, ForwardIterator1, ForwardIterator1, ForwardIterator2, ForwardOutIterator res, BinaryOperation) {
- assert(!pstl_binary_transform_called);
- pstl_binary_transform_called = true;
- return res;
-}
-
-bool pstl_reduce_with_init_called = false;
-
-template <class, class ForwardIterator, class T, class BinaryOperation>
-optional<T> __pstl_reduce(TestBackend, ForwardIterator, ForwardIterator, T v, BinaryOperation) {
- assert(!pstl_reduce_with_init_called);
- pstl_reduce_with_init_called = true;
- return v;
-}
-
-bool pstl_reduce_without_init_called = false;
-
-template <class, class ForwardIterator>
-optional<typename std::iterator_traits<ForwardIterator>::value_type>
-__pstl_reduce(TestBackend, ForwardIterator first, ForwardIterator) {
- assert(!pstl_reduce_without_init_called);
- pstl_reduce_without_init_called = true;
- return *first;
-}
-
-bool pstl_sort_called = false;
-
-template <class, class RandomAccessIterator, class Comp>
-optional<__empty> __pstl_sort(TestBackend, RandomAccessIterator, RandomAccessIterator, Comp) {
- assert(!pstl_sort_called);
- pstl_sort_called = true;
- return __empty{};
-}
-
-bool pstl_stable_sort_called = false;
-
-template <class, class RandomAccessIterator, class Comp>
-optional<__empty> __pstl_stable_sort(TestBackend, RandomAccessIterator, RandomAccessIterator, Comp) {
- assert(!pstl_stable_sort_called);
- pstl_stable_sort_called = true;
- return __empty{};
-}
-
-bool pstl_unary_transform_reduce_called = false;
-
-template <class, class ForwardIterator, class T, class UnaryOperation, class BinaryOperation>
-T __pstl_transform_reduce(TestBackend, ForwardIterator, ForwardIterator, T v, UnaryOperation, BinaryOperation) {
- assert(!pstl_unary_transform_reduce_called);
- pstl_unary_transform_reduce_called = true;
- return v;
-}
-
-bool pstl_binary_transform_reduce_called = false;
-
-template <class,
- class ForwardIterator1,
- class ForwardIterator2,
- class T,
- class BinaryOperation1,
- class BinaryOperation2>
-typename std::iterator_traits<ForwardIterator1>::value_type __pstl_transform_reduce(
- TestBackend, ForwardIterator1, ForwardIterator1, ForwardIterator2, T v, BinaryOperation1, BinaryOperation2) {
- assert(!pstl_binary_transform_reduce_called);
- pstl_binary_transform_reduce_called = true;
- return v;
-}
-
-_LIBCPP_END_NAMESPACE_STD
-
-#include <algorithm>
-#include <cassert>
-#include <iterator>
-#include <numeric>
-
-template <>
-inline constexpr bool std::is_execution_policy_v<TestPolicy> = true;
-
-template <>
-struct std::__select_backend<TestPolicy> {
- using type = TestBackend;
-};
-
-int main(int, char**) {
- int a[] = {1, 2};
- auto pred = [](auto&&...) { return true; };
-
- (void)std::any_of(TestPolicy{}, std::begin(a), std::end(a), pred);
- assert(std::pstl_any_of_called);
- (void)std::all_of(TestPolicy{}, std::begin(a), std::end(a), pred);
- assert(std::pstl_all_of_called);
- (void)std::none_of(TestPolicy{}, std::begin(a), std::end(a), pred);
- assert(std::pstl_none_of_called);
- std::copy(TestPolicy{}, std::begin(a), std::end(a), std::begin(a));
- assert(std::pstl_copy_called);
- std::copy_n(TestPolicy{}, std::begin(a), 1, std::begin(a));
- assert(std::pstl_copy_n_called);
- (void)std::count(TestPolicy{}, std::begin(a), std::end(a), 0);
- assert(std::pstl_count_called);
- (void)std::count_if(TestPolicy{}, std::begin(a), std::end(a), pred);
- assert(std::pstl_count_if_called);
- (void)std::fill(TestPolicy{}, std::begin(a), std::end(a), 0);
- assert(std::pstl_fill_called);
- (void)std::fill_n(TestPolicy{}, std::begin(a), std::size(a), 0);
- assert(std::pstl_fill_n_called);
- (void)std::find(TestPolicy{}, std::begin(a), std::end(a), 0);
- assert(std::pstl_find_called);
- (void)std::find_if(TestPolicy{}, std::begin(a), std::end(a), pred);
- assert(std::pstl_find_if_called);
- (void)std::find_if_not(TestPolicy{}, std::begin(a), std::end(a), pred);
- assert(std::pstl_find_if_not_called);
- (void)std::for_each(TestPolicy{}, std::begin(a), std::end(a), pred);
- assert(std::pstl_for_each_called);
- (void)std::for_each_n(TestPolicy{}, std::begin(a), std::size(a), pred);
- assert(std::pstl_for_each_n_called);
- (void)std::generate(TestPolicy{}, std::begin(a), std::end(a), pred);
- assert(std::pstl_generate_called);
- (void)std::generate_n(TestPolicy{}, std::begin(a), std::size(a), pred);
- assert(std::pstl_generate_n_called);
- (void)std::is_partitioned(TestPolicy{}, std::begin(a), std::end(a), pred);
- assert(std::pstl_is_partitioned_called);
- (void)std::move(TestPolicy{}, std::begin(a), std::end(a), std::begin(a));
- assert(std::pstl_move_called);
- (void)std::replace(TestPolicy{}, std::begin(a), std::end(a), 0, 0);
- assert(std::pstl_replace_called);
- (void)std::replace_if(TestPolicy{}, std::begin(a), std::end(a), pred, 0);
- assert(std::pstl_replace_if_called);
- (void)std::replace_copy(TestPolicy{}, std::begin(a), std::end(a), std::begin(a), 0, 0);
- assert(std::pstl_replace_copy_called);
- (void)std::replace_copy_if(TestPolicy{}, std::begin(a), std::end(a), std::begin(a), pred, 0);
- assert(std::pstl_replace_copy_if_called);
- (void)std::transform(TestPolicy{}, std::begin(a), std::end(a), std::begin(a), pred);
- assert(std::pstl_unary_transform_called);
- (void)std::transform(TestPolicy{}, std::begin(a), std::end(a), std::begin(a), std::begin(a), pred);
- assert(std::pstl_unary_transform_called);
- (void)std::reduce(TestPolicy{}, std::begin(a), std::end(a), 0, pred);
- assert(std::pstl_reduce_with_init_called);
- (void)std::reduce(TestPolicy{}, std::begin(a), std::end(a));
- assert(std::pstl_reduce_without_init_called);
- (void)std::rotate_copy(TestPolicy{}, std::begin(a), std::begin(a), std::end(a), std::begin(a));
- assert(std::pstl_rotate_copy_called);
- (void)std::sort(TestPolicy{}, std::begin(a), std::end(a));
- assert(std::pstl_sort_called);
- (void)std::stable_sort(TestPolicy{}, std::begin(a), std::end(a));
- assert(std::pstl_stable_sort_called);
- (void)std::transform_reduce(TestPolicy{}, std::begin(a), std::end(a), 0, pred, pred);
- assert(std::pstl_unary_transform_reduce_called);
- (void)std::transform_reduce(TestPolicy{}, std::begin(a), std::end(a), std::begin(a), 0, pred, pred);
- assert(std::pstl_binary_transform_reduce_called);
-
- return 0;
-}
diff --git a/libcxx/test/libcxx/atomics/atomics.syn/wait.pass.cpp b/libcxx/test/libcxx/atomics/atomics.syn/wait.pass.cpp
index f29dc6eb463f..6ae1c0997aad 100644
--- a/libcxx/test/libcxx/atomics/atomics.syn/wait.pass.cpp
+++ b/libcxx/test/libcxx/atomics/atomics.syn/wait.pass.cpp
@@ -5,10 +5,14 @@
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
+
// UNSUPPORTED: c++03, c++11, c++14, c++17
// UNSUPPORTED: no-threads
-// This bug was first fixed in LLVM 19
+
+// This bug was first fixed in LLVM 19. This can't be XFAIL because
+// the test is a no-op (and would XPASS) on some targets.
// UNSUPPORTED: using-built-library-before-llvm-19
+
// XFAIL: availability-synchronization_library-missing
#include <atomic>
diff --git a/libcxx/test/libcxx/containers/sequences/vector/const_T.compile.pass.cpp b/libcxx/test/libcxx/containers/sequences/vector/const_T.compile.pass.cpp
deleted file mode 100644
index 62fff96ac5ab..000000000000
--- a/libcxx/test/libcxx/containers/sequences/vector/const_T.compile.pass.cpp
+++ /dev/null
@@ -1,18 +0,0 @@
-//===----------------------------------------------------------------------===//
-//
-// Part of the LLVM Project, under the Apache 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 `vector<const T>` works
-
-#include <vector>
-
-void test() {
- std::vector<const int> v;
- v.emplace_back(1);
- v.push_back(1);
- v.resize(3);
-}
diff --git a/libcxx/test/libcxx/diagnostics/chrono.nodiscard.verify.cpp b/libcxx/test/libcxx/diagnostics/chrono.nodiscard.verify.cpp
index fea1e4417cc1..6fed41bdb43e 100644
--- a/libcxx/test/libcxx/diagnostics/chrono.nodiscard.verify.cpp
+++ b/libcxx/test/libcxx/diagnostics/chrono.nodiscard.verify.cpp
@@ -49,9 +49,12 @@ void test() {
{
std::chrono::sys_seconds s{};
std::chrono::local_seconds l{};
+ std::chrono::choose z = std::chrono::choose::earliest;
tz.name(); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
tz.get_info(s); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
tz.get_info(l); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
+ tz.to_sys(l); // not nodiscard
+ tz.to_sys(l, z); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
operator==(tz, tz); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
operator<=>(tz, tz); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
}
@@ -69,4 +72,10 @@ void test() {
leap.date(); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
leap.value(); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
}
+
+ {
+ using t = std::chrono::zoned_traits<const std::chrono::time_zone*>;
+ t::default_zone(); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
+ t::locate_zone(""); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
+ }
}
diff --git a/libcxx/test/libcxx/diagnostics/memory.nodiscard.verify.cpp b/libcxx/test/libcxx/diagnostics/memory.nodiscard.verify.cpp
index 210d269c9fa2..646569e3d573 100644
--- a/libcxx/test/libcxx/diagnostics/memory.nodiscard.verify.cpp
+++ b/libcxx/test/libcxx/diagnostics/memory.nodiscard.verify.cpp
@@ -39,15 +39,3 @@ void test_allocator() {
allocator.allocate_at_least(1); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
#endif
}
-
-void test_const_allocator() {
- std::allocator<const int> allocator;
- allocator.allocate(1); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
-
-#if TEST_STD_VER <= 17
- allocator.allocate(1, nullptr); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
-#endif
-#if TEST_STD_VER >= 23
- allocator.allocate_at_least(1); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
-#endif
-}
diff --git a/libcxx/test/libcxx/input.output/iostream.format/output.streams/ostream.formatted/ostream.formatted.print/vprint_unicode.pass.cpp b/libcxx/test/libcxx/input.output/iostream.format/output.streams/ostream.formatted/ostream.formatted.print/vprint_unicode.pass.cpp
index 5438d31bca33..9c801f5e044c 100644
--- a/libcxx/test/libcxx/input.output/iostream.format/output.streams/ostream.formatted/ostream.formatted.print/vprint_unicode.pass.cpp
+++ b/libcxx/test/libcxx/input.output/iostream.format/output.streams/ostream.formatted/ostream.formatted.print/vprint_unicode.pass.cpp
@@ -7,10 +7,16 @@
// UNSUPPORTED: c++03, c++11, c++14, c++17, c++20
// UNSUPPORTED: no-filesystem, no-rtti
+// UNSUPPORTED: libcpp-has-no-unicode
// UNSUPPORTED: GCC-ALWAYS_INLINE-FIXME
// XFAIL: availability-fp_to_chars-missing
+// When std::print is unavailable, we don't rely on an implementation of
+// std::__is_terminal and we always assume a non-unicode and non-terminal
+// output.
+// XFAIL: availability-print-missing
+
// Clang modules do not work with the definiton of _LIBCPP_TESTING_PRINT_IS_TERMINAL
// XFAIL: clang-modules-build
// <ostream>
diff --git a/libcxx/test/libcxx/input.output/iostream.format/print.fun/transcoding.pass.cpp b/libcxx/test/libcxx/input.output/iostream.format/print.fun/transcoding.pass.cpp
index 168fa40a243c..ab524899e28a 100644
--- a/libcxx/test/libcxx/input.output/iostream.format/print.fun/transcoding.pass.cpp
+++ b/libcxx/test/libcxx/input.output/iostream.format/print.fun/transcoding.pass.cpp
@@ -7,6 +7,7 @@
// UNSUPPORTED: c++03, c++11, c++14, c++17, c++20
// UNSUPPORTED: no-filesystem
+// UNSUPPORTED: libcpp-has-no-unicode
// UNSUPPORTED: GCC-ALWAYS_INLINE-FIXME
// ADDITIONAL_COMPILE_FLAGS(has-fconstexpr-steps): -fconstexpr-steps=2000000
diff --git a/libcxx/test/libcxx/input.output/iostream.format/print.fun/vprint_unicode_posix.pass.cpp b/libcxx/test/libcxx/input.output/iostream.format/print.fun/vprint_unicode_posix.pass.cpp
index 9a50770d97db..fd570c2c7661 100644
--- a/libcxx/test/libcxx/input.output/iostream.format/print.fun/vprint_unicode_posix.pass.cpp
+++ b/libcxx/test/libcxx/input.output/iostream.format/print.fun/vprint_unicode_posix.pass.cpp
@@ -7,6 +7,7 @@
// UNSUPPORTED: c++03, c++11, c++14, c++17, c++20
// UNSUPPORTED: no-filesystem
+// UNSUPPORTED: libcpp-has-no-unicode
// UNSUPPORTED: GCC-ALWAYS_INLINE-FIXME
// XFAIL: availability-fp_to_chars-missing
diff --git a/libcxx/test/libcxx/input.output/iostream.format/print.fun/vprint_unicode_windows.pass.cpp b/libcxx/test/libcxx/input.output/iostream.format/print.fun/vprint_unicode_windows.pass.cpp
index 2dd76052c2c9..7d17662da28f 100644
--- a/libcxx/test/libcxx/input.output/iostream.format/print.fun/vprint_unicode_windows.pass.cpp
+++ b/libcxx/test/libcxx/input.output/iostream.format/print.fun/vprint_unicode_windows.pass.cpp
@@ -8,6 +8,7 @@
// UNSUPPORTED: c++03, c++11, c++14, c++17, c++20
// UNSUPPORTED: no-filesystem
// UNSUPPORTED: no-wide-characters
+// UNSUPPORTED: libcpp-has-no-unicode
// UNSUPPORTED: GCC-ALWAYS_INLINE-FIXME
// Clang modules do not work with the definiton of _LIBCPP_TESTING_PRINT_WRITE_TO_WINDOWS_CONSOLE_FUNCTION
diff --git a/libcxx/test/libcxx/input.output/iostreams.base/ios.base/ios.base.cons/dtor.uninitialized.pass.cpp b/libcxx/test/libcxx/input.output/iostreams.base/ios.base/ios.base.cons/dtor.uninitialized.pass.cpp
index ea42203d0544..e5d48a35f4fd 100644
--- a/libcxx/test/libcxx/input.output/iostreams.base/ios.base/ios.base.cons/dtor.uninitialized.pass.cpp
+++ b/libcxx/test/libcxx/input.output/iostreams.base/ios.base/ios.base.cons/dtor.uninitialized.pass.cpp
@@ -10,7 +10,7 @@
// The fix for issue 57964 requires an updated dylib due to explicit
// instantiations. That means Apple backdeployment targets remain broken.
-// UNSUPPORTED: using-built-library-before-llvm-19
+// XFAIL: using-built-library-before-llvm-19
// <ios>
diff --git a/libcxx/test/libcxx/language.support/cxa_deleted_virtual.pass.cpp b/libcxx/test/libcxx/language.support/cxa_deleted_virtual.pass.cpp
index 723cd9f33b26..883e176b2626 100644
--- a/libcxx/test/libcxx/language.support/cxa_deleted_virtual.pass.cpp
+++ b/libcxx/test/libcxx/language.support/cxa_deleted_virtual.pass.cpp
@@ -11,7 +11,7 @@
// Test exporting the symbol: "__cxa_deleted_virtual" in macosx
// But don't expect the symbol to be exported in previous versions.
//
-// XFAIL: stdlib=apple-libc++ && target={{.+}}-apple-macosx10.{{9|10|11|12|13}}
+// XFAIL: stdlib=system && target={{.+}}-apple-macosx10.{{13|14}}
struct S { virtual void f() = delete; virtual ~S() {} };
int main(int, char**) {
diff --git a/libcxx/test/libcxx/memory/allocator_void.trivial.compile.pass.cpp b/libcxx/test/libcxx/memory/allocator_void.trivial.compile.pass.cpp
index f9d67c065de8..69a4b8943caa 100644
--- a/libcxx/test/libcxx/memory/allocator_void.trivial.compile.pass.cpp
+++ b/libcxx/test/libcxx/memory/allocator_void.trivial.compile.pass.cpp
@@ -17,18 +17,10 @@
#include <type_traits>
typedef std::allocator<void> A1;
-typedef std::allocator<void const> A2;
-struct A3 : std::allocator<void> { };
-struct A4 : std::allocator<void const> { };
+struct A2 : std::allocator<void> { };
static_assert(std::is_trivially_default_constructible<A1>::value, "");
static_assert(std::is_trivial<A1>::value, "");
static_assert(std::is_trivially_default_constructible<A2>::value, "");
static_assert(std::is_trivial<A2>::value, "");
-
-static_assert(std::is_trivially_default_constructible<A3>::value, "");
-static_assert(std::is_trivial<A3>::value, "");
-
-static_assert(std::is_trivially_default_constructible<A4>::value, "");
-static_assert(std::is_trivial<A4>::value, "");
diff --git a/libcxx/test/libcxx/memory/allocator_volatile.verify.cpp b/libcxx/test/libcxx/memory/allocator_volatile.verify.cpp
index 6fa7fe1b1aed..53fdc08e7a02 100644
--- a/libcxx/test/libcxx/memory/allocator_volatile.verify.cpp
+++ b/libcxx/test/libcxx/memory/allocator_volatile.verify.cpp
@@ -6,9 +6,9 @@
//
//===----------------------------------------------------------------------===//
-// http://wg21.link/LWG2447 gives implementors freedom to reject volatile types in `std::allocator`.
+// http://wg21.link/LWG2447 gives implementors freedom to reject const or volatile types in `std::allocator`.
#include <memory>
-std::allocator<volatile int> A1; // expected-error@*:* {{std::allocator does not support volatile types}}
-std::allocator<const volatile int> A2; // expected-error@*:* {{std::allocator does not support volatile types}}
+std::allocator<const int> A1; // expected-error@*:* {{std::allocator does not support const types}}
+std::allocator<volatile int> A2; // expected-error@*:* {{std::allocator does not support volatile types}}
diff --git a/libcxx/test/libcxx/strings/basic.string/string.capacity/PR53170.pass.cpp b/libcxx/test/libcxx/strings/basic.string/string.capacity/PR53170.pass.cpp
index 8415214efa8b..2b46d4bc2fb0 100644
--- a/libcxx/test/libcxx/strings/basic.string/string.capacity/PR53170.pass.cpp
+++ b/libcxx/test/libcxx/strings/basic.string/string.capacity/PR53170.pass.cpp
@@ -22,7 +22,7 @@
// Reported as https://llvm.org/PR53170.
// reserve(n) used to shrink the string until https://llvm.org/D117332 was shipped.
-// XFAIL: stdlib=apple-libc++ && target={{.+}}-apple-macosx{{10.9|10.10|10.11|10.12|10.13|10.14|10.15|11.0|12.0}}
+// XFAIL: stdlib=system && target={{.+}}-apple-macosx{{10.9|10.10|10.11|10.12|10.13|10.14|10.15|11.0|12.0}}
#include <string>
#include <stdexcept>
diff --git a/libcxx/test/libcxx/strings/basic.string/string.capacity/allocation_size.pass.cpp b/libcxx/test/libcxx/strings/basic.string/string.capacity/allocation_size.pass.cpp
index 1110e3d3ec56..750e7b165723 100644
--- a/libcxx/test/libcxx/strings/basic.string/string.capacity/allocation_size.pass.cpp
+++ b/libcxx/test/libcxx/strings/basic.string/string.capacity/allocation_size.pass.cpp
@@ -6,7 +6,7 @@
//
//===----------------------------------------------------------------------===//
-// XFAIL: stdlib=apple-libc++ && target={{.+}}-apple-macosx{{10.13|10.15|11.0}}
+// XFAIL: stdlib=system && target={{.+}}-apple-macosx{{10.13|10.14|10.15|11.0}}
// <string>
diff --git a/libcxx/test/libcxx/thread/thread.condition/PR30202_notify_from_pthread_created_thread.pass.cpp b/libcxx/test/libcxx/thread/thread.condition/PR30202_notify_from_pthread_created_thread.pass.cpp
index b1a3f86e8643..b7652b074bde 100644
--- a/libcxx/test/libcxx/thread/thread.condition/PR30202_notify_from_pthread_created_thread.pass.cpp
+++ b/libcxx/test/libcxx/thread/thread.condition/PR30202_notify_from_pthread_created_thread.pass.cpp
@@ -14,7 +14,7 @@
// UNSUPPORTED: c++03
// PR30202 was fixed starting in macosx10.13.
-// XFAIL: stdlib=apple-libc++ && target={{.+}}-apple-macosx10.{{9|10|11|12}}
+// XFAIL: stdlib=system && target={{.+}}-apple-macosx10.{{9|10|11|12}}
// <condition_variable>
diff --git a/libcxx/test/libcxx/thread/thread.threads/thread.thread.this/sleep_for.pass.cpp b/libcxx/test/libcxx/thread/thread.threads/thread.thread.this/sleep_for.pass.cpp
index 47741d0851e8..6f08dde2f313 100644
--- a/libcxx/test/libcxx/thread/thread.threads/thread.thread.this/sleep_for.pass.cpp
+++ b/libcxx/test/libcxx/thread/thread.threads/thread.thread.this/sleep_for.pass.cpp
@@ -11,7 +11,7 @@
// Until 58a0a70fb2f1, this_thread::sleep_for could sometimes get interrupted
// by signals and this test would fail spuriously. Disable the test on the
// corresponding system libraries.
-// XFAIL: stdlib=apple-libc++ && target={{.+}}-apple-macosx10.{{9|10|11}}
+// XFAIL: stdlib=system && target={{.+}}-apple-macosx10.{{9|10|11}}
// ALLOW_RETRIES: 3
diff --git a/libcxx/test/libcxx/thread/thread.threads/thread.thread.this/sleep_for.signals.pass.cpp b/libcxx/test/libcxx/thread/thread.threads/thread.thread.this/sleep_for.signals.pass.cpp
index ad62e0c11328..12376695fac3 100644
--- a/libcxx/test/libcxx/thread/thread.threads/thread.thread.this/sleep_for.signals.pass.cpp
+++ b/libcxx/test/libcxx/thread/thread.threads/thread.thread.this/sleep_for.signals.pass.cpp
@@ -14,7 +14,7 @@
// Until 58a0a70fb2f1, this_thread::sleep_for misbehaves when interrupted by
// a signal, as tested here. Disable the test on the corresponding system
// libraries.
-// XFAIL: stdlib=apple-libc++ && target={{.+}}-apple-macosx10.{{9|10|11}}
+// XFAIL: stdlib=system && target={{.+}}-apple-macosx10.{{9|10|11}}
// ALLOW_RETRIES: 3
diff --git a/libcxx/test/libcxx/time/time.zone/time.zone.exception/time.zone.exception.ambig/assert.ctor.pass.cpp b/libcxx/test/libcxx/time/time.zone/time.zone.exception/time.zone.exception.ambig/assert.ctor.pass.cpp
new file mode 100644
index 000000000000..73e6bf2846f0
--- /dev/null
+++ b/libcxx/test/libcxx/time/time.zone/time.zone.exception/time.zone.exception.ambig/assert.ctor.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
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++03, c++11, c++14, c++17
+
+// REQUIRES: has-unix-headers
+// REQUIRES: libcpp-hardening-mode={{extensive|debug}}
+// XFAIL: libcpp-hardening-mode=debug && availability-verbose_abort-missing
+
+// XFAIL: libcpp-has-no-experimental-tzdb
+
+// <chrono>
+
+// class ambiguous_local_time
+//
+// template<class Duration>
+// ambiguous_local_time(const local_time<Duration>& tp, const local_info& i);
+
+#include <chrono>
+
+#include "check_assertion.h"
+
+// [time.zone.exception.ambig]/2
+// Preconditions: i.result == local_info::ambiguous is true.
+int main(int, char**) {
+ TEST_LIBCPP_ASSERT_FAILURE(
+ (std::chrono::ambiguous_local_time{
+ std::chrono::local_seconds{},
+ std::chrono::local_info{-1, // this is not one of the "named" result values
+ std::chrono::sys_info{},
+ std::chrono::sys_info{}}}),
+ "creating an ambiguous_local_time from a local_info that is not ambiguous");
+
+ TEST_LIBCPP_ASSERT_FAILURE(
+ (std::chrono::ambiguous_local_time{
+ std::chrono::local_seconds{},
+ std::chrono::local_info{std::chrono::local_info::unique, std::chrono::sys_info{}, std::chrono::sys_info{}}}),
+ "creating an ambiguous_local_time from a local_info that is not ambiguous");
+
+ TEST_LIBCPP_ASSERT_FAILURE(
+ (std::chrono::ambiguous_local_time{
+ std::chrono::local_seconds{},
+ std::chrono::local_info{
+ std::chrono::local_info::nonexistent, std::chrono::sys_info{}, std::chrono::sys_info{}}}),
+ "creating an ambiguous_local_time from a local_info that is not ambiguous");
+
+ return 0;
+}
diff --git a/libcxx/test/libcxx/time/time.zone/time.zone.exception/time.zone.exception.nonexist/assert.ctor.pass.cpp b/libcxx/test/libcxx/time/time.zone/time.zone.exception/time.zone.exception.nonexist/assert.ctor.pass.cpp
new file mode 100644
index 000000000000..fdd9f79958f9
--- /dev/null
+++ b/libcxx/test/libcxx/time/time.zone/time.zone.exception/time.zone.exception.nonexist/assert.ctor.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
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++03, c++11, c++14, c++17
+
+// REQUIRES: has-unix-headers
+// REQUIRES: libcpp-hardening-mode={{extensive|debug}}
+// XFAIL: libcpp-hardening-mode=debug && availability-verbose_abort-missing
+
+// XFAIL: libcpp-has-no-experimental-tzdb
+
+// <chrono>
+
+// class nonexistent_local_time
+//
+// template<class Duration>
+// nonexistent_local_time(const local_time<Duration>& tp, const local_info& i);
+
+#include <chrono>
+
+#include "check_assertion.h"
+
+// [time.zone.exception.nonexist]/2
+// Preconditions: i.result == local_info::nonexistent is true.
+int main(int, char**) {
+ TEST_LIBCPP_ASSERT_FAILURE(
+ (std::chrono::nonexistent_local_time{
+ std::chrono::local_seconds{},
+ std::chrono::local_info{-1, // this is not one of the "named" result values
+ std::chrono::sys_info{},
+ std::chrono::sys_info{}}}),
+ "creating an nonexistent_local_time from a local_info that is not non-existent");
+
+ TEST_LIBCPP_ASSERT_FAILURE(
+ (std::chrono::nonexistent_local_time{
+ std::chrono::local_seconds{},
+ std::chrono::local_info{std::chrono::local_info::unique, std::chrono::sys_info{}, std::chrono::sys_info{}}}),
+ "creating an nonexistent_local_time from a local_info that is not non-existent");
+
+ TEST_LIBCPP_ASSERT_FAILURE(
+ (std::chrono::nonexistent_local_time{
+ std::chrono::local_seconds{},
+ std::chrono::local_info{
+ std::chrono::local_info::ambiguous, std::chrono::sys_info{}, std::chrono::sys_info{}}}),
+ "creating an nonexistent_local_time from a local_info that is not non-existent");
+
+ return 0;
+}
diff --git a/libcxx/test/libcxx/time/time.zone/time.zone.timezone/choose.pass.cpp b/libcxx/test/libcxx/time/time.zone/time.zone.timezone/choose.pass.cpp
new file mode 100644
index 000000000000..23ef9c848096
--- /dev/null
+++ b/libcxx/test/libcxx/time/time.zone/time.zone.timezone/choose.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
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++03, c++11, c++14, c++17
+// UNSUPPORTED: no-filesystem, no-localization, no-tzdb
+
+// XFAIL: libcpp-has-no-experimental-tzdb
+// XFAIL: availability-tzdb-missing
+
+// <chrono>
+
+// enum class choose;
+
+#include <chrono>
+#include <type_traits>
+#include <cassert>
+
+#include "test_macros.h"
+
+int main(int, char**) {
+ using E = std::chrono::choose;
+ static_assert(std::is_enum_v<E>);
+
+ // Check that E is a scoped enum by checking for conversions.
+ using UT = std::underlying_type_t<E>;
+ static_assert(!std::is_convertible_v<E, UT>);
+
+ [[maybe_unused]] const E& early = E::earliest;
+ [[maybe_unused]] const E& late = E::latest;
+
+ return 0;
+}
diff --git a/libcxx/test/libcxx/time/time.zone/time.zone.timezone/time.zone.members/assert.to_local.pass.cpp b/libcxx/test/libcxx/time/time.zone/time.zone.timezone/time.zone.members/assert.to_local.pass.cpp
new file mode 100644
index 000000000000..d9ca1c80751c
--- /dev/null
+++ b/libcxx/test/libcxx/time/time.zone/time.zone.timezone/time.zone.members/assert.to_local.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
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++03, c++11, c++14, c++17
+
+// REQUIRES: has-unix-headers
+// REQUIRES: libcpp-hardening-mode={{extensive|debug}}
+// XFAIL: libcpp-hardening-mode=debug && availability-verbose_abort-missing
+
+// XFAIL: libcpp-has-no-experimental-tzdb
+// XFAIL: availability-tzdb-missing
+
+// <chrono>
+
+// template <class _Duration>
+// local_time<common_type_t<Duration, seconds>>
+// to_local(const sys_time<Duration>& tp) const;
+
+#include <chrono>
+
+#include "check_assertion.h"
+
+// Tests values that cannot be converted. To make sure the test is does not depend on changes
+// in the database it uses a time zone with a fixed offset.
+int main(int, char**) {
+ TEST_LIBCPP_ASSERT_FAILURE(std::chrono::locate_zone("Etc/GMT+1")->to_local(std::chrono::sys_seconds::min()),
+ "cannot convert the system time; it would be before the minimum local clock value");
+
+ // TODO TZDB look why std::chrono::sys_seconds::max() fails
+ TEST_LIBCPP_ASSERT_FAILURE(
+ std::chrono::locate_zone("Etc/GMT-1")->to_local(std::chrono::sys_seconds::max() - std::chrono::seconds(1)),
+ "cannot convert the system time; it would be after the maximum local clock value");
+
+ return 0;
+}
diff --git a/libcxx/test/libcxx/time/time.zone/time.zone.timezone/time.zone.members/assert.to_sys.pass.cpp b/libcxx/test/libcxx/time/time.zone/time.zone.timezone/time.zone.members/assert.to_sys.pass.cpp
new file mode 100644
index 000000000000..3a2ff0008867
--- /dev/null
+++ b/libcxx/test/libcxx/time/time.zone/time.zone.timezone/time.zone.members/assert.to_sys.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
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++03, c++11, c++14, c++17
+
+// REQUIRES: has-unix-headers
+// REQUIRES: libcpp-hardening-mode={{extensive|debug}}
+// XFAIL: libcpp-hardening-mode=debug && availability-verbose_abort-missing
+
+// XFAIL: libcpp-has-no-experimental-tzdb
+
+// <chrono>
+
+// template <class _Duration>
+// sys_time<common_type_t<Duration, seconds>>
+// to_sys(const local_time<Duration>& tp) const;
+
+#include <chrono>
+
+#include "check_assertion.h"
+
+// Tests values that cannot be converted. To make sure the test is does not depend on changes
+// in the database it uses a time zone with a fixed offset.
+int main(int, char**) {
+ TEST_LIBCPP_ASSERT_FAILURE(std::chrono::locate_zone("Etc/GMT-1")->to_sys(std::chrono::local_seconds::min()),
+ "cannot convert the local time; it would be before the minimum system clock value");
+
+ // TODO TZDB look why std::chrono::local_seconds::max() fails
+ TEST_LIBCPP_ASSERT_FAILURE(
+ std::chrono::locate_zone("Etc/GMT+1")->to_sys(std::chrono::local_seconds::max() - std::chrono::seconds(1)),
+ "cannot convert the local time; it would be after the maximum system clock value");
+
+ return 0;
+}
diff --git a/libcxx/test/libcxx/time/time.zone/time.zone.timezone/time.zone.members/assert.to_sys_choose.pass.cpp b/libcxx/test/libcxx/time/time.zone/time.zone.timezone/time.zone.members/assert.to_sys_choose.pass.cpp
new file mode 100644
index 000000000000..65429345ae79
--- /dev/null
+++ b/libcxx/test/libcxx/time/time.zone/time.zone.timezone/time.zone.members/assert.to_sys_choose.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
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++03, c++11, c++14, c++17
+
+// REQUIRES: has-unix-headers
+// REQUIRES: libcpp-hardening-mode={{extensive|debug}}
+// XFAIL: libcpp-hardening-mode=debug && availability-verbose_abort-missing
+
+// XFAIL: libcpp-has-no-experimental-tzdb
+
+// <chrono>
+
+// template <class _Duration>
+// sys_time<common_type_t<Duration, seconds>>
+// to_sys(const local_time<Duration>& tp, choose z) const;
+
+#include <chrono>
+
+#include "check_assertion.h"
+
+// Tests values that cannot be converted. To make sure the test is does not depend on changes
+// in the database it uses a time zone with a fixed offset.
+int main(int, char**) {
+ TEST_LIBCPP_ASSERT_FAILURE(
+ std::chrono::locate_zone("Etc/GMT-1")->to_sys(std::chrono::local_seconds::min(), std::chrono::choose::earliest),
+ "cannot convert the local time; it would be before the minimum system clock value");
+
+ // TODO TZDB look why std::chrono::local_seconds::max() fails
+ TEST_LIBCPP_ASSERT_FAILURE(
+ std::chrono::locate_zone("Etc/GMT+1")
+ ->to_sys(std::chrono::local_seconds::max() - std::chrono::seconds(1), std::chrono::choose::latest),
+ "cannot convert the local time; it would be after the maximum system clock value");
+
+ return 0;
+}
diff --git a/libcxx/test/libcxx/transitive_includes/cxx03.csv b/libcxx/test/libcxx/transitive_includes/cxx03.csv
index 92601fab5b77..c720a0c9a05e 100644
--- a/libcxx/test/libcxx/transitive_includes/cxx03.csv
+++ b/libcxx/test/libcxx/transitive_includes/cxx03.csv
@@ -187,9 +187,6 @@ condition_variable type_traits
condition_variable typeinfo
condition_variable version
coroutine compare
-coroutine cstddef
-coroutine cstdint
-coroutine cstring
coroutine iosfwd
coroutine limits
coroutine type_traits
@@ -906,6 +903,7 @@ thread type_traits
thread version
tuple compare
tuple cstddef
+tuple cstdint
tuple exception
tuple iosfwd
tuple new
diff --git a/libcxx/test/libcxx/transitive_includes/cxx11.csv b/libcxx/test/libcxx/transitive_includes/cxx11.csv
index c05eb42deb9a..b00436a1be7f 100644
--- a/libcxx/test/libcxx/transitive_includes/cxx11.csv
+++ b/libcxx/test/libcxx/transitive_includes/cxx11.csv
@@ -188,9 +188,6 @@ condition_variable type_traits
condition_variable typeinfo
condition_variable version
coroutine compare
-coroutine cstddef
-coroutine cstdint
-coroutine cstring
coroutine iosfwd
coroutine limits
coroutine type_traits
@@ -913,6 +910,7 @@ thread type_traits
thread version
tuple compare
tuple cstddef
+tuple cstdint
tuple exception
tuple iosfwd
tuple new
diff --git a/libcxx/test/libcxx/transitive_includes/cxx14.csv b/libcxx/test/libcxx/transitive_includes/cxx14.csv
index 09252b7b7d2d..4b8c12929de0 100644
--- a/libcxx/test/libcxx/transitive_includes/cxx14.csv
+++ b/libcxx/test/libcxx/transitive_includes/cxx14.csv
@@ -189,9 +189,6 @@ condition_variable type_traits
condition_variable typeinfo
condition_variable version
coroutine compare
-coroutine cstddef
-coroutine cstdint
-coroutine cstring
coroutine iosfwd
coroutine limits
coroutine type_traits
@@ -916,6 +913,7 @@ thread type_traits
thread version
tuple compare
tuple cstddef
+tuple cstdint
tuple exception
tuple iosfwd
tuple new
diff --git a/libcxx/test/libcxx/transitive_includes/cxx17.csv b/libcxx/test/libcxx/transitive_includes/cxx17.csv
index 09252b7b7d2d..a51a7e2de1d3 100644
--- a/libcxx/test/libcxx/transitive_includes/cxx17.csv
+++ b/libcxx/test/libcxx/transitive_includes/cxx17.csv
@@ -7,7 +7,6 @@ algorithm cstdint
algorithm cstdlib
algorithm cstring
algorithm cwchar
-algorithm execution
algorithm initializer_list
algorithm iosfwd
algorithm iterator
@@ -16,6 +15,7 @@ algorithm memory
algorithm new
algorithm optional
algorithm stdexcept
+algorithm tuple
algorithm type_traits
algorithm utility
algorithm version
@@ -189,9 +189,6 @@ condition_variable type_traits
condition_variable typeinfo
condition_variable version
coroutine compare
-coroutine cstddef
-coroutine cstdint
-coroutine cstring
coroutine iosfwd
coroutine limits
coroutine type_traits
@@ -583,6 +580,7 @@ numeric iterator
numeric limits
numeric new
numeric optional
+numeric tuple
numeric type_traits
numeric version
optional atomic
@@ -916,6 +914,7 @@ thread type_traits
thread version
tuple compare
tuple cstddef
+tuple cstdint
tuple exception
tuple iosfwd
tuple new
diff --git a/libcxx/test/libcxx/transitive_includes/cxx20.csv b/libcxx/test/libcxx/transitive_includes/cxx20.csv
index ce4ccc3d1161..5280d75cbf2e 100644
--- a/libcxx/test/libcxx/transitive_includes/cxx20.csv
+++ b/libcxx/test/libcxx/transitive_includes/cxx20.csv
@@ -7,7 +7,6 @@ algorithm cstdint
algorithm cstdlib
algorithm cstring
algorithm cwchar
-algorithm execution
algorithm initializer_list
algorithm iosfwd
algorithm iterator
@@ -16,6 +15,7 @@ algorithm memory
algorithm new
algorithm optional
algorithm stdexcept
+algorithm tuple
algorithm type_traits
algorithm utility
algorithm version
@@ -111,26 +111,19 @@ charconv limits
charconv new
charconv type_traits
charconv version
-chrono array
chrono bit
-chrono cctype
-chrono cerrno
chrono charconv
-chrono clocale
chrono cmath
chrono compare
chrono concepts
chrono cstddef
chrono cstdint
-chrono cstdlib
chrono cstring
chrono ctime
-chrono cwchar
+chrono format
chrono forward_list
chrono limits
chrono locale
-chrono new
-chrono optional
chrono ostream
chrono ratio
chrono sstream
@@ -594,6 +587,7 @@ numeric iterator
numeric limits
numeric new
numeric optional
+numeric tuple
numeric type_traits
numeric version
optional atomic
@@ -926,6 +920,7 @@ thread type_traits
thread version
tuple compare
tuple cstddef
+tuple cstdint
tuple exception
tuple iosfwd
tuple new
diff --git a/libcxx/test/libcxx/transitive_includes/cxx23.csv b/libcxx/test/libcxx/transitive_includes/cxx23.csv
index 62d931c0eeba..4cad0fdf31bd 100644
--- a/libcxx/test/libcxx/transitive_includes/cxx23.csv
+++ b/libcxx/test/libcxx/transitive_includes/cxx23.csv
@@ -4,13 +4,13 @@ algorithm cstdint
algorithm cstring
algorithm ctime
algorithm cwchar
-algorithm execution
algorithm initializer_list
algorithm iosfwd
algorithm limits
algorithm new
algorithm optional
algorithm ratio
+algorithm tuple
algorithm version
any cstddef
any cstdint
@@ -67,30 +67,19 @@ charconv initializer_list
charconv limits
charconv new
charconv version
-chrono array
-chrono cctype
-chrono cerrno
-chrono clocale
chrono cmath
chrono compare
chrono cstddef
chrono cstdint
-chrono cstdlib
-chrono cstring
chrono ctime
-chrono cwchar
+chrono format
chrono forward_list
chrono limits
-chrono new
-chrono optional
-chrono ostream
chrono ratio
chrono sstream
chrono stdexcept
chrono string
chrono string_view
-chrono tuple
-chrono typeinfo
chrono vector
chrono version
cinttypes cstdint
@@ -161,6 +150,7 @@ exception typeinfo
exception version
execution version
expected cstddef
+expected cstdint
expected initializer_list
expected new
expected version
@@ -401,12 +391,12 @@ numeric cstddef
numeric cstdint
numeric cstring
numeric ctime
-numeric execution
numeric initializer_list
numeric limits
numeric new
numeric optional
numeric ratio
+numeric tuple
numeric version
optional compare
optional cstddef
@@ -494,6 +484,7 @@ regex typeinfo
regex vector
regex version
scoped_allocator cstddef
+scoped_allocator cstdint
scoped_allocator limits
scoped_allocator new
scoped_allocator tuple
@@ -650,6 +641,7 @@ thread typeinfo
thread version
tuple compare
tuple cstddef
+tuple cstdint
tuple version
type_traits cstddef
type_traits cstdint
@@ -684,6 +676,7 @@ unordered_set tuple
unordered_set version
utility compare
utility cstddef
+utility cstdint
utility initializer_list
utility limits
utility version
diff --git a/libcxx/test/libcxx/transitive_includes/cxx26.csv b/libcxx/test/libcxx/transitive_includes/cxx26.csv
index f68249aeec78..4cad0fdf31bd 100644
--- a/libcxx/test/libcxx/transitive_includes/cxx26.csv
+++ b/libcxx/test/libcxx/transitive_includes/cxx26.csv
@@ -4,13 +4,13 @@ algorithm cstdint
algorithm cstring
algorithm ctime
algorithm cwchar
-algorithm execution
algorithm initializer_list
algorithm iosfwd
algorithm limits
algorithm new
algorithm optional
algorithm ratio
+algorithm tuple
algorithm version
any cstddef
any cstdint
@@ -67,30 +67,19 @@ charconv initializer_list
charconv limits
charconv new
charconv version
-chrono array
-chrono cctype
-chrono cerrno
-chrono clocale
chrono cmath
chrono compare
chrono cstddef
chrono cstdint
-chrono cstdlib
-chrono cstring
chrono ctime
-chrono cwchar
+chrono format
chrono forward_list
chrono limits
-chrono new
-chrono optional
-chrono ostream
chrono ratio
chrono sstream
chrono stdexcept
chrono string
chrono string_view
-chrono tuple
-chrono typeinfo
chrono vector
chrono version
cinttypes cstdint
@@ -161,6 +150,7 @@ exception typeinfo
exception version
execution version
expected cstddef
+expected cstdint
expected initializer_list
expected new
expected version
@@ -176,29 +166,6 @@ experimental/simd limits
experimental/type_traits initializer_list
experimental/type_traits type_traits
experimental/utility utility
-experimental/vector experimental/memory_resource
-experimental/vector vector
-ext/hash_map algorithm
-ext/hash_map cmath
-ext/hash_map cstddef
-ext/hash_map cstdint
-ext/hash_map cstring
-ext/hash_map functional
-ext/hash_map initializer_list
-ext/hash_map limits
-ext/hash_map new
-ext/hash_map stdexcept
-ext/hash_map string
-ext/hash_set algorithm
-ext/hash_set cmath
-ext/hash_set cstddef
-ext/hash_set cstdint
-ext/hash_set cstring
-ext/hash_set functional
-ext/hash_set initializer_list
-ext/hash_set limits
-ext/hash_set new
-ext/hash_set string
filesystem compare
filesystem cstddef
filesystem cstdint
@@ -424,12 +391,12 @@ numeric cstddef
numeric cstdint
numeric cstring
numeric ctime
-numeric execution
numeric initializer_list
numeric limits
numeric new
numeric optional
numeric ratio
+numeric tuple
numeric version
optional compare
optional cstddef
@@ -517,6 +484,7 @@ regex typeinfo
regex vector
regex version
scoped_allocator cstddef
+scoped_allocator cstdint
scoped_allocator limits
scoped_allocator new
scoped_allocator tuple
@@ -673,6 +641,7 @@ thread typeinfo
thread version
tuple compare
tuple cstddef
+tuple cstdint
tuple version
type_traits cstddef
type_traits cstdint
@@ -707,6 +676,7 @@ unordered_set tuple
unordered_set version
utility compare
utility cstddef
+utility cstdint
utility initializer_list
utility limits
utility version
diff --git a/libcxx/test/libcxx/type_traits/is_trivially_relocatable.compile.pass.cpp b/libcxx/test/libcxx/type_traits/is_trivially_relocatable.compile.pass.cpp
index 4d1a8ad9e229..64d2c54e7dd8 100644
--- a/libcxx/test/libcxx/type_traits/is_trivially_relocatable.compile.pass.cpp
+++ b/libcxx/test/libcxx/type_traits/is_trivially_relocatable.compile.pass.cpp
@@ -7,11 +7,24 @@
//===----------------------------------------------------------------------===//
#include <__type_traits/is_trivially_relocatable.h>
+#include <array>
+#include <deque>
+#include <exception>
+#include <expected>
#include <memory>
+#include <optional>
#include <string>
+#include <tuple>
+#include <variant>
+#include <vector>
#include "constexpr_char_traits.h"
#include "test_allocator.h"
+#include "test_macros.h"
+
+#ifndef TEST_HAS_NO_LOCALIZATION
+# include <locale>
+#endif
static_assert(std::__libcpp_is_trivially_relocatable<char>::value, "");
static_assert(std::__libcpp_is_trivially_relocatable<int>::value, "");
@@ -44,9 +57,27 @@ static_assert(std::__libcpp_is_trivially_relocatable<MoveOnlyTriviallyCopyable>:
#else
static_assert(!std::__libcpp_is_trivially_relocatable<MoveOnlyTriviallyCopyable>::value, "");
#endif
+
+// library-internal types
+// ----------------------
+
+// __split_buffer
+static_assert(std::__libcpp_is_trivially_relocatable<std::__split_buffer<int> >::value, "");
+static_assert(std::__libcpp_is_trivially_relocatable<std::__split_buffer<NotTriviallyCopyable> >::value, "");
+static_assert(!std::__libcpp_is_trivially_relocatable<std::__split_buffer<int, test_allocator<int> > >::value, "");
+
// standard library types
// ----------------------
+// array
+static_assert(std::__libcpp_is_trivially_relocatable<std::array<int, 0> >::value, "");
+static_assert(std::__libcpp_is_trivially_relocatable<std::array<NotTriviallyCopyable, 0> >::value, "");
+static_assert(std::__libcpp_is_trivially_relocatable<std::array<std::unique_ptr<int>, 0> >::value, "");
+
+static_assert(std::__libcpp_is_trivially_relocatable<std::array<int, 1> >::value, "");
+static_assert(!std::__libcpp_is_trivially_relocatable<std::array<NotTriviallyCopyable, 1> >::value, "");
+static_assert(std::__libcpp_is_trivially_relocatable<std::array<std::unique_ptr<int>, 1> >::value, "");
+
// basic_string
#if defined(_LIBCPP_HAS_NO_ASAN) || !defined(_LIBCPP_INSTRUMENTED_WITH_ASAN)
struct MyChar {
@@ -80,6 +111,71 @@ static_assert(
std::basic_string<MyChar, NotTriviallyRelocatableCharTraits<MyChar>, test_allocator<MyChar> > >::value,
"");
#endif
+
+// deque
+static_assert(std::__libcpp_is_trivially_relocatable<std::deque<int> >::value, "");
+static_assert(std::__libcpp_is_trivially_relocatable<std::deque<NotTriviallyCopyable> >::value, "");
+static_assert(!std::__libcpp_is_trivially_relocatable<std::deque<int, test_allocator<int> > >::value, "");
+
+// exception_ptr
+#ifndef _LIBCPP_ABI_MICROSOFT // FIXME: Is this also the case on windows?
+static_assert(std::__libcpp_is_trivially_relocatable<std::exception_ptr>::value, "");
+#endif
+
+// expected
+#if TEST_STD_VER >= 23
+static_assert(std::__libcpp_is_trivially_relocatable<std::expected<int, int> >::value);
+static_assert(std::__libcpp_is_trivially_relocatable<std::expected<std::unique_ptr<int>, int>>::value);
+static_assert(std::__libcpp_is_trivially_relocatable<std::expected<int, std::unique_ptr<int>>>::value);
+static_assert(std::__libcpp_is_trivially_relocatable<std::expected<std::unique_ptr<int>, std::unique_ptr<int>>>::value);
+
+static_assert(!std::__libcpp_is_trivially_relocatable<std::expected<int, NotTriviallyCopyable>>::value);
+static_assert(!std::__libcpp_is_trivially_relocatable<std::expected<NotTriviallyCopyable, int>>::value);
+static_assert(
+ !std::__libcpp_is_trivially_relocatable<std::expected<NotTriviallyCopyable, NotTriviallyCopyable>>::value);
+#endif
+
+// locale
+#ifndef TEST_HAS_NO_LOCALIZATION
+static_assert(std::__libcpp_is_trivially_relocatable<std::locale>::value, "");
+#endif
+
+// optional
+#if TEST_STD_VER >= 17
+static_assert(std::__libcpp_is_trivially_relocatable<std::optional<int>>::value, "");
+static_assert(!std::__libcpp_is_trivially_relocatable<std::optional<NotTriviallyCopyable>>::value, "");
+static_assert(std::__libcpp_is_trivially_relocatable<std::optional<std::unique_ptr<int>>>::value, "");
+#endif // TEST_STD_VER >= 17
+
+// pair
+static_assert(std::__libcpp_is_trivially_relocatable<std::pair<int, int> >::value, "");
+static_assert(!std::__libcpp_is_trivially_relocatable<std::pair<NotTriviallyCopyable, int> >::value, "");
+static_assert(!std::__libcpp_is_trivially_relocatable<std::pair<int, NotTriviallyCopyable> >::value, "");
+static_assert(!std::__libcpp_is_trivially_relocatable<std::pair<NotTriviallyCopyable, NotTriviallyCopyable> >::value,
+ "");
+static_assert(std::__libcpp_is_trivially_relocatable<std::pair<std::unique_ptr<int>, std::unique_ptr<int> > >::value,
+ "");
+
+// shared_ptr
+static_assert(std::__libcpp_is_trivially_relocatable<std::shared_ptr<NotTriviallyCopyable> >::value, "");
+
+// tuple
+#if TEST_STD_VER >= 11
+static_assert(std::__libcpp_is_trivially_relocatable<std::tuple<> >::value, "");
+
+static_assert(std::__libcpp_is_trivially_relocatable<std::tuple<int> >::value, "");
+static_assert(!std::__libcpp_is_trivially_relocatable<std::tuple<NotTriviallyCopyable> >::value, "");
+static_assert(std::__libcpp_is_trivially_relocatable<std::tuple<std::unique_ptr<int> > >::value, "");
+
+static_assert(std::__libcpp_is_trivially_relocatable<std::tuple<int, int> >::value, "");
+static_assert(!std::__libcpp_is_trivially_relocatable<std::tuple<NotTriviallyCopyable, int> >::value, "");
+static_assert(!std::__libcpp_is_trivially_relocatable<std::tuple<int, NotTriviallyCopyable> >::value, "");
+static_assert(!std::__libcpp_is_trivially_relocatable<std::tuple<NotTriviallyCopyable, NotTriviallyCopyable> >::value,
+ "");
+static_assert(std::__libcpp_is_trivially_relocatable<std::tuple<std::unique_ptr<int>, std::unique_ptr<int> > >::value,
+ "");
+#endif // TEST_STD_VER >= 11
+
// unique_ptr
struct NotTriviallyRelocatableDeleter {
NotTriviallyRelocatableDeleter(const NotTriviallyRelocatableDeleter&);
@@ -113,4 +209,27 @@ static_assert(!std::__libcpp_is_trivially_relocatable<std::unique_ptr<int, NotTr
static_assert(!std::__libcpp_is_trivially_relocatable<std::unique_ptr<int[], NotTriviallyRelocatablePointer> >::value,
"");
+// variant
+#if TEST_STD_VER >= 17
+static_assert(std::__libcpp_is_trivially_relocatable<std::variant<int> >::value, "");
+static_assert(!std::__libcpp_is_trivially_relocatable<std::variant<NotTriviallyCopyable> >::value, "");
+static_assert(std::__libcpp_is_trivially_relocatable<std::variant<std::unique_ptr<int> > >::value, "");
+
+static_assert(std::__libcpp_is_trivially_relocatable<std::variant<int, int> >::value, "");
+static_assert(!std::__libcpp_is_trivially_relocatable<std::variant<NotTriviallyCopyable, int> >::value, "");
+static_assert(!std::__libcpp_is_trivially_relocatable<std::variant<int, NotTriviallyCopyable> >::value, "");
+static_assert(!std::__libcpp_is_trivially_relocatable<std::variant<NotTriviallyCopyable, NotTriviallyCopyable> >::value,
+ "");
+static_assert(std::__libcpp_is_trivially_relocatable<std::variant<std::unique_ptr<int>, std::unique_ptr<int> > >::value,
+ "");
+#endif // TEST_STD_VER >= 17
+
+// vector
+static_assert(std::__libcpp_is_trivially_relocatable<std::vector<int> >::value, "");
+static_assert(std::__libcpp_is_trivially_relocatable<std::vector<NotTriviallyCopyable> >::value, "");
+static_assert(!std::__libcpp_is_trivially_relocatable<std::vector<int, test_allocator<int> > >::value, "");
+
+// weak_ptr
+static_assert(std::__libcpp_is_trivially_relocatable<std::weak_ptr<NotTriviallyCopyable> >::value, "");
+
// TODO: Mark all the trivially relocatable STL types as such
diff --git a/libcxx/test/libcxx/utilities/format/format.functions/ascii.pass.cpp b/libcxx/test/libcxx/utilities/format/format.functions/ascii.pass.cpp
index d4a55dd20ce9..dd6b36eb1315 100644
--- a/libcxx/test/libcxx/utilities/format/format.functions/ascii.pass.cpp
+++ b/libcxx/test/libcxx/utilities/format/format.functions/ascii.pass.cpp
@@ -8,8 +8,7 @@
// UNSUPPORTED: c++03, c++11, c++14, c++17
// UNSUPPORTED: GCC-ALWAYS_INLINE-FIXME
-// Force unicode to be disabled.
-// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_HAS_NO_UNICODE
+// REQUIRES: libcpp-has-no-unicode
// TODO FMT This test should not require std::to_chars(floating-point)
// XFAIL: availability-fp_to_chars-missing
diff --git a/libcxx/test/libcxx/utilities/format/format.functions/escaped_output.ascii.pass.cpp b/libcxx/test/libcxx/utilities/format/format.functions/escaped_output.ascii.pass.cpp
index 32352774a08f..d43d4de04b84 100644
--- a/libcxx/test/libcxx/utilities/format/format.functions/escaped_output.ascii.pass.cpp
+++ b/libcxx/test/libcxx/utilities/format/format.functions/escaped_output.ascii.pass.cpp
@@ -11,8 +11,7 @@
// TODO FMT This test should not require std::to_chars(floating-point)
// XFAIL: availability-fp_to_chars-missing
-// Force unicode to be disabled.
-// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_HAS_NO_UNICODE
+// REQUIRES: libcpp-has-no-unicode
// <format>
diff --git a/libcxx/test/libcxx/utilities/format/format.string/format.string.std/extended_grapheme_cluster.pass.cpp b/libcxx/test/libcxx/utilities/format/format.string/format.string.std/extended_grapheme_cluster.pass.cpp
index c1fdd1f2098d..f69a995dc178 100644
--- a/libcxx/test/libcxx/utilities/format/format.string/format.string.std/extended_grapheme_cluster.pass.cpp
+++ b/libcxx/test/libcxx/utilities/format/format.string/format.string.std/extended_grapheme_cluster.pass.cpp
@@ -6,6 +6,7 @@
//===----------------------------------------------------------------------===//
// UNSUPPORTED: c++03, c++11, c++14, c++17
+// UNSUPPORTED: libcpp-has-no-unicode
// UNSUPPORTED: GCC-ALWAYS_INLINE-FIXME
// <format>
diff --git a/libcxx/test/libcxx/utilities/utility/pairs/pairs.pair/non_trivial_copy_move_ABI.pass.cpp b/libcxx/test/libcxx/utilities/utility/pairs/pairs.pair/abi.non_trivial_copy_move.pass.cpp
index 1f5dae1232e3..1f5dae1232e3 100644
--- a/libcxx/test/libcxx/utilities/utility/pairs/pairs.pair/non_trivial_copy_move_ABI.pass.cpp
+++ b/libcxx/test/libcxx/utilities/utility/pairs/pairs.pair/abi.non_trivial_copy_move.pass.cpp
diff --git a/libcxx/test/libcxx/utilities/utility/pairs/pairs.pair/trivial_copy_move_ABI.pass.cpp b/libcxx/test/libcxx/utilities/utility/pairs/pairs.pair/abi.trivial_copy_move.pass.cpp
index fe098a7af7e8..3ec60c08b8ea 100644
--- a/libcxx/test/libcxx/utilities/utility/pairs/pairs.pair/trivial_copy_move_ABI.pass.cpp
+++ b/libcxx/test/libcxx/utilities/utility/pairs/pairs.pair/abi.trivial_copy_move.pass.cpp
@@ -71,6 +71,17 @@ struct Trivial {
static_assert(HasTrivialABI<Trivial>::value, "");
#endif
+struct TrivialNoAssignment {
+ int arr[4];
+ TrivialNoAssignment& operator=(const TrivialNoAssignment&) = delete;
+};
+
+struct TrivialNoConstruction {
+ int arr[4];
+ TrivialNoConstruction() = default;
+ TrivialNoConstruction(const TrivialNoConstruction&) = delete;
+ TrivialNoConstruction& operator=(const TrivialNoConstruction&) = default;
+};
void test_trivial()
{
@@ -135,6 +146,26 @@ void test_trivial()
static_assert(HasTrivialABI<P>::value, "");
}
#endif
+ {
+ using P = std::pair<TrivialNoAssignment, int>;
+ static_assert(std::is_trivially_copy_constructible<P>::value, "");
+ static_assert(std::is_trivially_move_constructible<P>::value, "");
+#if TEST_STD_VER >= 11 // This is https://llvm.org/PR90605
+ static_assert(!std::is_trivially_copy_assignable<P>::value, "");
+ static_assert(!std::is_trivially_move_assignable<P>::value, "");
+#endif // TEST_STD_VER >= 11
+ static_assert(std::is_trivially_destructible<P>::value, "");
+ }
+ {
+ using P = std::pair<TrivialNoConstruction, int>;
+#if TEST_STD_VER >= 11
+ static_assert(!std::is_trivially_copy_constructible<P>::value, "");
+ static_assert(!std::is_trivially_move_constructible<P>::value, "");
+#endif // TEST_STD_VER >= 11
+ static_assert(!std::is_trivially_copy_assignable<P>::value, "");
+ static_assert(!std::is_trivially_move_assignable<P>::value, "");
+ static_assert(std::is_trivially_destructible<P>::value, "");
+ }
}
void test_layout() {
diff --git a/libcxx/test/libcxx/utilities/utility/pairs/pairs.pair/abi.trivially_copyable.compile.pass.cpp b/libcxx/test/libcxx/utilities/utility/pairs/pairs.pair/abi.trivially_copyable.compile.pass.cpp
new file mode 100644
index 000000000000..1132b3e5def1
--- /dev/null
+++ b/libcxx/test/libcxx/utilities/utility/pairs/pairs.pair/abi.trivially_copyable.compile.pass.cpp
@@ -0,0 +1,68 @@
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+//
+// This test pins down the ABI of std::pair with respect to being "trivially copyable".
+//
+
+// This test doesn't work when the deprecated ABI to turn off pair triviality is enabled.
+// See libcxx/test/libcxx/utilities/utility/pairs/pairs.pair/abi.non_trivial_copy_move.pass.cpp instead.
+// UNSUPPORTED: libcpp-deprecated-abi-disable-pair-trivial-copy-ctor
+
+#include <type_traits>
+#include <utility>
+
+#include "test_macros.h"
+
+struct trivially_copyable {
+ int arr[4];
+};
+
+struct trivially_copyable_no_copy_assignment {
+ int arr[4];
+ trivially_copyable_no_copy_assignment& operator=(const trivially_copyable_no_copy_assignment&) = delete;
+};
+static_assert(std::is_trivially_copyable<trivially_copyable_no_copy_assignment>::value, "");
+
+struct trivially_copyable_no_move_assignment {
+ int arr[4];
+ trivially_copyable_no_move_assignment& operator=(const trivially_copyable_no_move_assignment&) = delete;
+};
+static_assert(std::is_trivially_copyable<trivially_copyable_no_move_assignment>::value, "");
+
+struct trivially_copyable_no_construction {
+ int arr[4];
+ trivially_copyable_no_construction() = default;
+ trivially_copyable_no_construction(const trivially_copyable_no_construction&) = delete;
+ trivially_copyable_no_construction& operator=(const trivially_copyable_no_construction&) = default;
+};
+static_assert(std::is_trivially_copyable<trivially_copyable_no_construction>::value, "");
+
+static_assert(!std::is_trivially_copyable<std::pair<int&, int> >::value, "");
+static_assert(!std::is_trivially_copyable<std::pair<int, int&> >::value, "");
+static_assert(!std::is_trivially_copyable<std::pair<int&, int&> >::value, "");
+
+static_assert(!std::is_trivially_copyable<std::pair<int, int> >::value, "");
+static_assert(!std::is_trivially_copyable<std::pair<int, char> >::value, "");
+static_assert(!std::is_trivially_copyable<std::pair<char, int> >::value, "");
+static_assert(!std::is_trivially_copyable<std::pair<std::pair<char, char>, int> >::value, "");
+static_assert(!std::is_trivially_copyable<std::pair<trivially_copyable, int> >::value, "");
+#if TEST_STD_VER == 03 // Known ABI difference
+static_assert(!std::is_trivially_copyable<std::pair<trivially_copyable_no_copy_assignment, int> >::value, "");
+static_assert(!std::is_trivially_copyable<std::pair<trivially_copyable_no_move_assignment, int> >::value, "");
+#else
+static_assert(std::is_trivially_copyable<std::pair<trivially_copyable_no_copy_assignment, int> >::value, "");
+static_assert(std::is_trivially_copyable<std::pair<trivially_copyable_no_move_assignment, int> >::value, "");
+#endif
+static_assert(!std::is_trivially_copyable<std::pair<trivially_copyable_no_construction, int> >::value, "");
+
+static_assert(std::is_trivially_copy_constructible<std::pair<int, int> >::value, "");
+static_assert(std::is_trivially_move_constructible<std::pair<int, int> >::value, "");
+static_assert(!std::is_trivially_copy_assignable<std::pair<int, int> >::value, "");
+static_assert(!std::is_trivially_move_assignable<std::pair<int, int> >::value, "");
+static_assert(std::is_trivially_destructible<std::pair<int, int> >::value, "");
diff --git a/libcxx/test/lit.cfg.py b/libcxx/test/lit.cfg.py
index ea4a9a75b4fd..bb0552687747 100644
--- a/libcxx/test/lit.cfg.py
+++ b/libcxx/test/lit.cfg.py
@@ -7,5 +7,6 @@
lit_config.fatal(
"You seem to be running Lit directly -- you should be running Lit through "
"<build>/bin/llvm-lit, which will ensure that the right Lit configuration "
- "file is used."
+ "file is used. See https://libcxx.llvm.org/TestingLibcxx.html#usage for "
+ "how to run the libc++ tests."
)
diff --git a/libcxx/test/std/concepts/concepts.lang/concept.default.init/default_initializable.compile.pass.cpp b/libcxx/test/std/concepts/concepts.lang/concept.default.init/default_initializable.compile.pass.cpp
index ee1405f1f889..6a31fb90e4da 100644
--- a/libcxx/test/std/concepts/concepts.lang/concept.default.init/default_initializable.compile.pass.cpp
+++ b/libcxx/test/std/concepts/concepts.lang/concept.default.init/default_initializable.compile.pass.cpp
@@ -205,9 +205,6 @@ void test()
test_not_const<std::array< volatile int, 1>>();
test_false <std::array<const volatile int, 1>>();
test_true <std::deque< int>>();
-#ifdef _LIBCPP_VERSION
- test_true <std::deque<const int>>();
-#endif // _LIBCPP_VERSION
test_true <std::forward_list<int>>();
test_true <std::list<int>>();
test_true <std::vector<int>>();
@@ -226,9 +223,6 @@ void test()
// Container adaptors
test_true <std::stack< int>>();
-#ifdef _LIBCPP_VERSION
- test_true <std::stack<const int>>();
-#endif // _LIBCPP_VERSION
test_true <std::queue<int>>();
test_true <std::priority_queue<int>>();
diff --git a/libcxx/test/std/containers/sequences/array/array.overview/nttp.equivalence.compile.pass.cpp b/libcxx/test/std/containers/sequences/array/array.overview/nttp.equivalence.compile.pass.cpp
new file mode 100644
index 000000000000..29e10fd40bd3
--- /dev/null
+++ b/libcxx/test/std/containers/sequences/array/array.overview/nttp.equivalence.compile.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
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++03, c++11, c++14, c++17
+
+// <array>
+
+// LWG-3382 NTTP for pair and array:
+// Two values a1 and a2 of type array<T, N> are template-argument-equivalent if and only if each pair of corresponding
+// elements in a1 and a2 are template-argument-equivalent.
+
+#include <array>
+
+#include <type_traits>
+
+namespace test_full_type {
+template <class T, std::size_t S, std::array<T, S> A>
+struct test : std::false_type {};
+
+template <>
+struct test<int, 3, std::array<int, 3>{1, 2, 3}> : std::true_type {};
+
+static_assert(!test<int*, 4, std::array<int*, 4>{}>::value);
+static_assert(!test<int*, 3, std::array<int*, 3>{}>::value);
+static_assert(!test<int, 3, std::array<int, 3>{}>::value);
+static_assert(!test<int, 3, std::array<int, 3>{1}>::value);
+static_assert(!test<int, 3, std::array<int, 3>{1, 2}>::value);
+static_assert(!test<long, 3, std::array<long, 3>{1, 2, 3}>::value);
+static_assert(!test<unsigned int, 3, std::array<unsigned int, 3>{1, 2, 3}>::value);
+static_assert(test<int, 3, std::array<int, 3>{1, 2, 3}>::value);
+} // namespace test_full_type
+
+namespace test_ctad {
+template <std::array A>
+struct test : std::false_type {};
+
+template <>
+struct test<std::array<int, 3>{4, 5, 6}> : std::true_type {};
+
+static_assert(!test<std::array<int*, 4>{}>::value);
+static_assert(!test<std::array<int*, 3>{}>::value);
+static_assert(!test<std::array<int, 3>{}>::value);
+static_assert(!test<std::array<int, 3>{4}>::value);
+static_assert(!test<std::array<int, 3>{4, 5}>::value);
+static_assert(!test<std::array<long, 3>{4, 5, 6}>::value);
+static_assert(!test<std::array<unsigned int, 3>{4, 5, 6}>::value);
+static_assert(test<std::array<int, 3>{4, 5, 6}>::value);
+} // namespace test_ctad
+
+namespace test_auto {
+template <auto A>
+struct test : std::false_type {};
+
+template <>
+struct test<std::array<int, 3>{7, 8, 9}> : std::true_type {};
+
+static_assert(!test<std::array<int*, 4>{}>::value);
+static_assert(!test<std::array<int*, 3>{}>::value);
+static_assert(!test<std::array<int, 3>{}>::value);
+static_assert(!test<std::array<int, 3>{7}>::value);
+static_assert(!test<std::array<int, 3>{7, 8}>::value);
+static_assert(!test<std::array<long, 3>{7, 8, 9}>::value);
+static_assert(!test<std::array<unsigned int, 3>{7, 8, 9}>::value);
+static_assert(test<std::array<int, 3>{7, 8, 9}>::value);
+} // namespace test_auto
diff --git a/libcxx/test/std/containers/sequences/array/array.overview/nttp.verify.cpp b/libcxx/test/std/containers/sequences/array/array.overview/nttp.verify.cpp
new file mode 100644
index 000000000000..3eb8e2596f85
--- /dev/null
+++ b/libcxx/test/std/containers/sequences/array/array.overview/nttp.verify.cpp
@@ -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
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++03, c++11, c++14, c++17
+
+// <array>
+
+// LWG-3382 NTTP for pair and array:
+// array<T, N> is a structural type ([temp.param]) if T is a structural type.
+
+#include <array>
+
+#include <cstddef>
+#include <string>
+
+struct LiteralBase {};
+struct LiteralNSDM {};
+
+struct LiteralType : LiteralBase {
+ LiteralNSDM nsdm;
+};
+
+struct NotALiteral {
+ NotALiteral() {}
+};
+
+int i;
+NotALiteral not_a_literal;
+
+namespace test_full_type {
+template <class T, std::size_t S, std::array<T, S> A>
+struct test {};
+
+using A = test<int, 2, std::array{2, 3}>;
+using B = test<LiteralType, 0, std::array<LiteralType, 0>{}>;
+using C = test<int*, 1, std::array<int*, 1>{&i}>;
+using D = test<NotALiteral*, 1, std::array<NotALiteral*, 1>{&not_a_literal}>;
+
+using E = test<NotALiteral, 1, std::array<NotALiteral, 1>{}>;
+// expected-error-re@*:* {{non-type template parameter has non-literal type 'std::array<NotALiteral, 1U{{L{0,2}.*}}>'}}
+
+using F = test<std::string, 2, std::array<std::string, 2>{}>;
+// expected-error-re@*:* {{type 'std::array<{{(std::)?}}string, 2U{{L{0,2}.*}}>' {{(\(aka 'array<basic_string<char>, 2UL{0,2}>'\) )?}}of non-type template parameter is not a structural type}}
+} // namespace test_full_type
+
+namespace test_ctad {
+template <std::array A>
+struct test {};
+
+using A = test<std::array{2, 3}>;
+using B = test<std::array<LiteralType, 0>{}>;
+using C = test<std::array<int*, 1>{&i}>;
+using D = test<std::array<NotALiteral*, 1>{&not_a_literal}>;
+
+using E = test<std::array<NotALiteral, 1>{}>;
+// expected-error@-1 {{non-type template parameter has non-literal type 'std::array<NotALiteral, 1>'}}
+
+using F = test<std::array<std::string, 2>{}>;
+// expected-error@-1 {{type 'std::array<string, 2>' (aka 'std::array<std::string, 2>') of non-type template parameter is not a structural type}}
+} // namespace test_ctad
+
+namespace test_auto {
+template <auto A>
+struct test {};
+
+using A = test<std::array{2, 3}>;
+using B = test<std::array<LiteralType, 0>{}>;
+using C = test<std::array<int*, 1>{&i}>;
+using D = test<std::array<NotALiteral*, 1>{&not_a_literal}>;
+
+using E = test<std::array<NotALiteral, 1>{}>;
+// expected-error@-1 {{non-type template parameter has non-literal type 'std::array<NotALiteral, 1>'}}
+
+using F = test<std::array<std::string, 2>{}>;
+// expected-error@-1 {{type 'std::array<std::string, 2>' (aka 'array<basic_string<char>, 2>') of non-type template parameter is not a structural type}}
+} // namespace test_auto
diff --git a/libcxx/test/std/containers/views/mdspan/extents/ctad.pass.cpp b/libcxx/test/std/containers/views/mdspan/extents/ctad.pass.cpp
index 3f99d8a3b47a..9144bb6812e3 100644
--- a/libcxx/test/std/containers/views/mdspan/extents/ctad.pass.cpp
+++ b/libcxx/test/std/containers/views/mdspan/extents/ctad.pass.cpp
@@ -13,10 +13,12 @@
// explicit extents(Integrals...) -> see below;
// Constraints: (is_convertible_v<Integrals, size_t> && ...) is true.
//
-// Remarks: The deduced type is dextents<size_t, sizeof...(Integrals)>.
+// Remarks: The deduced type is dextents<size_t, sizeof...(Integrals)>. // until C++26
+// Remarks: The deduced type is extents<size_t, maybe-static-ext<Integrals>...>. // since C++26
#include <mdspan>
#include <cassert>
+#include <type_traits>
#include "../ConvertibleToIntegral.h"
#include "test_macros.h"
@@ -43,6 +45,15 @@ constexpr bool test() {
test(std::extents(1, 2u, 3, 4, 5, 6, 7, 8, 9),
std::extents<std::size_t, D, D, D, D, D, D, D, D, D>(1, 2u, 3, 4, 5, 6, 7, 8, 9));
test(std::extents(NoDefaultCtorIndex{1}, NoDefaultCtorIndex{2}), std::extents<std::size_t, D, D>(1, 2));
+
+#if _LIBCPP_STD_VER >= 26
+ // P3029R1: deduction from `integral_constant`
+ test(std::extents(std::integral_constant<size_t, 5>{}), std::extents<std::size_t, 5>());
+ test(std::extents(std::integral_constant<size_t, 5>{}, 6), std::extents<std::size_t, 5, std::dynamic_extent>(6));
+ test(std::extents(std::integral_constant<size_t, 5>{}, 6, std::integral_constant<size_t, 7>{}),
+ std::extents<std::size_t, 5, std::dynamic_extent, 7>(6));
+#endif
+
return true;
}
diff --git a/libcxx/test/std/depr/depr.c.headers/stdlib_h.aligned_alloc.compile.pass.cpp b/libcxx/test/std/depr/depr.c.headers/stdlib_h.aligned_alloc.compile.pass.cpp
index c0409307a8f4..7ddf03fff4f4 100644
--- a/libcxx/test/std/depr/depr.c.headers/stdlib_h.aligned_alloc.compile.pass.cpp
+++ b/libcxx/test/std/depr/depr.c.headers/stdlib_h.aligned_alloc.compile.pass.cpp
@@ -13,7 +13,7 @@
// ::aligned_alloc is provided by the C library, but it's marked as unavailable
// until macOS 10.15
-// XFAIL: stdlib=apple-libc++ && target={{.+}}-apple-macosx10.{{9|10|11|12|13|14}}
+// XFAIL: stdlib=system && target={{.+}}-apple-macosx10.{{9|10|11|12|13|14}}
// ::aligned_alloc is not implemented on Windows
// XFAIL: target={{.+}}-windows-{{.+}}
diff --git a/libcxx/test/std/diagnostics/syserr/syserr.errcat/syserr.errcat.objects/generic_category.pass.cpp b/libcxx/test/std/diagnostics/syserr/syserr.errcat/syserr.errcat.objects/generic_category.pass.cpp
index 7283fdc769d8..35c2726fda2a 100644
--- a/libcxx/test/std/diagnostics/syserr/syserr.errcat/syserr.errcat.objects/generic_category.pass.cpp
+++ b/libcxx/test/std/diagnostics/syserr/syserr.errcat/syserr.errcat.objects/generic_category.pass.cpp
@@ -6,7 +6,7 @@
//
//===----------------------------------------------------------------------===//
-// XFAIL: stdlib=apple-libc++ && target={{.+}}-apple-macosx10.{{9|10|11|12}}
+// XFAIL: stdlib=system && target={{.+}}-apple-macosx10.{{9|10|11|12}}
// <system_error>
diff --git a/libcxx/test/std/diagnostics/syserr/syserr.errcat/syserr.errcat.objects/system_category.pass.cpp b/libcxx/test/std/diagnostics/syserr/syserr.errcat/syserr.errcat.objects/system_category.pass.cpp
index 02a1baf59998..0f622289248b 100644
--- a/libcxx/test/std/diagnostics/syserr/syserr.errcat/syserr.errcat.objects/system_category.pass.cpp
+++ b/libcxx/test/std/diagnostics/syserr/syserr.errcat/syserr.errcat.objects/system_category.pass.cpp
@@ -12,7 +12,7 @@
// const error_category& system_category();
-// XFAIL: stdlib=apple-libc++ && target={{.+}}-apple-macosx10.{{9|10|11|12}}
+// XFAIL: stdlib=system && target={{.+}}-apple-macosx10.{{9|10|11|12}}
#include <system_error>
#include <cassert>
diff --git a/libcxx/test/std/experimental/simd/simd.reference/reference_swap.pass.cpp b/libcxx/test/std/experimental/simd/simd.reference/reference_swap.pass.cpp
new file mode 100644
index 000000000000..fa1c3106970a
--- /dev/null
+++ b/libcxx/test/std/experimental/simd/simd.reference/reference_swap.pass.cpp
@@ -0,0 +1,74 @@
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache 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
+
+// <experimental/simd>
+//
+// Note: To ensure the swap functions can be called directly in the std::experimental namespace,
+// the implementation approach might not fully align with the specification.
+//
+// [simd.reference]
+// friend void swap(reference&& a, reference&& b) noexcept;
+// friend void swap(value_type& a, reference&& b) noexcept;
+// friend void swap(reference&& a, value_type& b) noexcept;
+
+#include "../test_utils.h"
+#include <experimental/simd>
+
+namespace ex = std::experimental::parallelism_v2;
+
+template <class T, std::size_t>
+struct CheckSimdRefSwap {
+ template <class SimdAbi>
+ void operator()() {
+ ex::simd<T, SimdAbi> origin_simd_1(1);
+ ex::simd<T, SimdAbi> origin_simd_2(2);
+ T value = 3;
+
+ static_assert(noexcept(ex::swap(std::move(origin_simd_1[0]), std::move(origin_simd_2[0]))));
+ ex::swap(std::move(origin_simd_1[0]), std::move(origin_simd_2[0]));
+ assert((origin_simd_1[0] == 2) && (origin_simd_2[0] == 1));
+
+ static_assert(noexcept(ex::swap(std::move(origin_simd_1[0]), value)));
+ ex::swap(std::move(origin_simd_1[0]), value);
+ assert((origin_simd_1[0] == 3) && (value == 2));
+
+ static_assert(noexcept(ex::swap(value, std::move(origin_simd_2[0]))));
+ ex::swap(value, std::move(origin_simd_2[0]));
+ assert((value == 1) && (origin_simd_2[0] == 2));
+ }
+};
+
+template <class T, std::size_t>
+struct CheckMaskRefSwap {
+ template <class SimdAbi>
+ void operator()() {
+ ex::simd_mask<T, SimdAbi> origin_mask_1(true);
+ ex::simd_mask<T, SimdAbi> origin_mask_2(false);
+ bool value = true;
+
+ static_assert(noexcept(ex::swap(std::move(origin_mask_1[0]), std::move(origin_mask_2[0]))));
+ ex::swap(std::move(origin_mask_1[0]), std::move(origin_mask_2[0]));
+ assert((origin_mask_1[0] == false) && (origin_mask_2[0] == true));
+
+ static_assert(noexcept(ex::swap(std::move(origin_mask_1[0]), value)));
+ ex::swap(std::move(origin_mask_1[0]), value);
+ assert((origin_mask_1[0] == true) && (value == false));
+
+ static_assert(noexcept(ex::swap(value, std::move(origin_mask_2[0]))));
+ ex::swap(value, std::move(origin_mask_2[0]));
+ assert((value == true) && (origin_mask_2[0] == false));
+ }
+};
+
+int main(int, char**) {
+ test_all_simd_abi<CheckSimdRefSwap>();
+ test_all_simd_abi<CheckMaskRefSwap>();
+ return 0;
+}
diff --git a/libcxx/test/std/input.output/filesystems/class.directory_entry/directory_entry.mods/refresh.pass.cpp b/libcxx/test/std/input.output/filesystems/class.directory_entry/directory_entry.mods/refresh.pass.cpp
index 4f5002e068c1..f2d5e7dd0e56 100644
--- a/libcxx/test/std/input.output/filesystems/class.directory_entry/directory_entry.mods/refresh.pass.cpp
+++ b/libcxx/test/std/input.output/filesystems/class.directory_entry/directory_entry.mods/refresh.pass.cpp
@@ -11,7 +11,7 @@
// The string reported on errors changed, which makes those tests fail when run
// against already-released libc++'s.
-// XFAIL: stdlib=apple-libc++ && target={{.+}}-apple-macosx{{10.15|11.0}}
+// XFAIL: stdlib=system && target={{.+}}-apple-macosx{{10.15|11.0}}
// <filesystem>
diff --git a/libcxx/test/std/input.output/filesystems/class.directory_entry/directory_entry.obs/file_size.pass.cpp b/libcxx/test/std/input.output/filesystems/class.directory_entry/directory_entry.obs/file_size.pass.cpp
index e1407858f66a..11295855d3ca 100644
--- a/libcxx/test/std/input.output/filesystems/class.directory_entry/directory_entry.obs/file_size.pass.cpp
+++ b/libcxx/test/std/input.output/filesystems/class.directory_entry/directory_entry.obs/file_size.pass.cpp
@@ -11,7 +11,7 @@
// The string reported on errors changed, which makes those tests fail when run
// against already-released libc++'s.
-// XFAIL: stdlib=apple-libc++ && target={{.+}}-apple-macosx{{10.15|11.0}}
+// XFAIL: stdlib=system && target={{.+}}-apple-macosx{{10.15|11.0}}
// Starting in Android N (API 24), SELinux policy prevents the shell user from
// creating a FIFO file.
diff --git a/libcxx/test/std/input.output/filesystems/class.directory_entry/directory_entry.obs/hard_link_count.pass.cpp b/libcxx/test/std/input.output/filesystems/class.directory_entry/directory_entry.obs/hard_link_count.pass.cpp
index 514bbb27c2c4..f40b06e106e1 100644
--- a/libcxx/test/std/input.output/filesystems/class.directory_entry/directory_entry.obs/hard_link_count.pass.cpp
+++ b/libcxx/test/std/input.output/filesystems/class.directory_entry/directory_entry.obs/hard_link_count.pass.cpp
@@ -11,7 +11,7 @@
// The string reported on errors changed, which makes those tests fail when run
// against already-released libc++'s.
-// XFAIL: stdlib=apple-libc++ && target={{.+}}-apple-macosx{{10.15|11.0}}
+// XFAIL: stdlib=system && target={{.+}}-apple-macosx{{10.15|11.0}}
// Starting in Android N (API 24), SELinux policy prevents the shell user from
// creating a hard link.
diff --git a/libcxx/test/std/input.output/filesystems/class.directory_entry/directory_entry.obs/last_write_time.pass.cpp b/libcxx/test/std/input.output/filesystems/class.directory_entry/directory_entry.obs/last_write_time.pass.cpp
index 41e2ee668f52..72039bb06921 100644
--- a/libcxx/test/std/input.output/filesystems/class.directory_entry/directory_entry.obs/last_write_time.pass.cpp
+++ b/libcxx/test/std/input.output/filesystems/class.directory_entry/directory_entry.obs/last_write_time.pass.cpp
@@ -11,7 +11,7 @@
// The string reported on errors changed, which makes those tests fail when run
// against already-released libc++'s.
-// XFAIL: stdlib=apple-libc++ && target={{.+}}-apple-macosx{{10.15|11.0}}
+// XFAIL: stdlib=system && target={{.+}}-apple-macosx{{10.15|11.0}}
// <filesystem>
diff --git a/libcxx/test/std/input.output/filesystems/fs.op.funcs/fs.op.copy_file/copy_file.pass.cpp b/libcxx/test/std/input.output/filesystems/fs.op.funcs/fs.op.copy_file/copy_file.pass.cpp
index e81beed4f2ad..3209e16d0061 100644
--- a/libcxx/test/std/input.output/filesystems/fs.op.funcs/fs.op.copy_file/copy_file.pass.cpp
+++ b/libcxx/test/std/input.output/filesystems/fs.op.funcs/fs.op.copy_file/copy_file.pass.cpp
@@ -12,7 +12,7 @@
// The string reported on errors changed, which makes those tests fail when run
// against already-released libc++'s.
-// XFAIL: stdlib=apple-libc++ && target={{.+}}-apple-macosx{{10.15|11.0}}
+// XFAIL: stdlib=system && target={{.+}}-apple-macosx{{10.15|11.0}}
// Starting in Android N (API 24), SELinux policy prevents the shell user from
// creating a FIFO file.
diff --git a/libcxx/test/std/input.output/filesystems/fs.op.funcs/fs.op.create_directories/create_directories.pass.cpp b/libcxx/test/std/input.output/filesystems/fs.op.funcs/fs.op.create_directories/create_directories.pass.cpp
index 9955e08710c5..3658a24b72b2 100644
--- a/libcxx/test/std/input.output/filesystems/fs.op.funcs/fs.op.create_directories/create_directories.pass.cpp
+++ b/libcxx/test/std/input.output/filesystems/fs.op.funcs/fs.op.create_directories/create_directories.pass.cpp
@@ -12,7 +12,7 @@
// UNSUPPORTED: availability-filesystem-missing
// This test requires the dylib support introduced in D92769.
-// XFAIL: stdlib=apple-libc++ && target={{.+}}-apple-macosx{{10.15|11.0}}
+// XFAIL: stdlib=system && target={{.+}}-apple-macosx{{10.15|11.0}}
// <filesystem>
diff --git a/libcxx/test/std/input.output/filesystems/fs.op.funcs/fs.op.create_directory/create_directory.pass.cpp b/libcxx/test/std/input.output/filesystems/fs.op.funcs/fs.op.create_directory/create_directory.pass.cpp
index 21f283cae86d..cdedf0d46126 100644
--- a/libcxx/test/std/input.output/filesystems/fs.op.funcs/fs.op.create_directory/create_directory.pass.cpp
+++ b/libcxx/test/std/input.output/filesystems/fs.op.funcs/fs.op.create_directory/create_directory.pass.cpp
@@ -12,7 +12,7 @@
// UNSUPPORTED: availability-filesystem-missing
// This test requires the dylib support introduced in http://llvm.org/D92769.
-// XFAIL: stdlib=apple-libc++ && target={{.+}}-apple-macosx{{10.15|11.0}}
+// XFAIL: stdlib=system && target={{.+}}-apple-macosx{{10.15|11.0}}
// <filesystem>
diff --git a/libcxx/test/std/input.output/filesystems/fs.op.funcs/fs.op.create_directory/create_directory_with_attributes.pass.cpp b/libcxx/test/std/input.output/filesystems/fs.op.funcs/fs.op.create_directory/create_directory_with_attributes.pass.cpp
index a0ec52643e8c..dee6690997fb 100644
--- a/libcxx/test/std/input.output/filesystems/fs.op.funcs/fs.op.create_directory/create_directory_with_attributes.pass.cpp
+++ b/libcxx/test/std/input.output/filesystems/fs.op.funcs/fs.op.create_directory/create_directory_with_attributes.pass.cpp
@@ -12,7 +12,7 @@
// UNSUPPORTED: availability-filesystem-missing
// This test requires the dylib support introduced in http://llvm.org/D92769.
-// XFAIL: stdlib=apple-libc++ && target={{.+}}-apple-macosx{{10.15|11.0}}
+// XFAIL: stdlib=system && target={{.+}}-apple-macosx{{10.15|11.0}}
// <filesystem>
diff --git a/libcxx/test/std/input.output/filesystems/fs.op.funcs/fs.op.file_size/file_size.pass.cpp b/libcxx/test/std/input.output/filesystems/fs.op.funcs/fs.op.file_size/file_size.pass.cpp
index 99d303bc4244..648598bb1012 100644
--- a/libcxx/test/std/input.output/filesystems/fs.op.funcs/fs.op.file_size/file_size.pass.cpp
+++ b/libcxx/test/std/input.output/filesystems/fs.op.funcs/fs.op.file_size/file_size.pass.cpp
@@ -13,7 +13,7 @@
// The string reported on errors changed, which makes those tests fail when run
// against already-released libc++'s.
-// XFAIL: stdlib=apple-libc++ && target={{.+}}-apple-macosx{{10.15|11.0}}
+// XFAIL: stdlib=system && target={{.+}}-apple-macosx{{10.15|11.0}}
// <filesystem>
diff --git a/libcxx/test/std/input.output/filesystems/fs.op.funcs/fs.op.last_write_time/last_write_time.pass.cpp b/libcxx/test/std/input.output/filesystems/fs.op.funcs/fs.op.last_write_time/last_write_time.pass.cpp
index d43bc5eea512..459224d41953 100644
--- a/libcxx/test/std/input.output/filesystems/fs.op.funcs/fs.op.last_write_time/last_write_time.pass.cpp
+++ b/libcxx/test/std/input.output/filesystems/fs.op.funcs/fs.op.last_write_time/last_write_time.pass.cpp
@@ -13,7 +13,7 @@
// The string reported on errors changed, which makes those tests fail when run
// against already-released libc++'s.
-// XFAIL: stdlib=apple-libc++ && target={{.+}}-apple-macosx{{10.15|11.0}}
+// XFAIL: stdlib=system && target={{.+}}-apple-macosx{{10.15|11.0}}
// <filesystem>
diff --git a/libcxx/test/std/input.output/filesystems/fs.op.funcs/fs.op.remove_all/toctou.pass.cpp b/libcxx/test/std/input.output/filesystems/fs.op.funcs/fs.op.remove_all/toctou.pass.cpp
index 5248ba24b403..5335f8070ffa 100644
--- a/libcxx/test/std/input.output/filesystems/fs.op.funcs/fs.op.remove_all/toctou.pass.cpp
+++ b/libcxx/test/std/input.output/filesystems/fs.op.funcs/fs.op.remove_all/toctou.pass.cpp
@@ -31,9 +31,9 @@
// This test requires a dylib containing the fix shipped in https://reviews.llvm.org/D118134.
// We use UNSUPPORTED instead of XFAIL because the test might not fail reliably.
-// UNSUPPORTED: stdlib=apple-libc++ && target={{.+}}-apple-macosx10.{{9|10|11|12|13|14|15}}
-// UNSUPPORTED: stdlib=apple-libc++ && target={{.+}}-apple-macosx11.0
-// UNSUPPORTED: stdlib=apple-libc++ && target={{.+}}-apple-macosx12.{{0|1|2}}
+// UNSUPPORTED: stdlib=system && target={{.+}}-apple-macosx10.{{9|10|11|12|13|14|15}}
+// UNSUPPORTED: stdlib=system && target={{.+}}-apple-macosx11.0
+// UNSUPPORTED: stdlib=system && target={{.+}}-apple-macosx12.{{0|1|2}}
// Windows doesn't support the necessary APIs to mitigate this issue.
// XFAIL: target={{.+}}-windows-{{.+}}
diff --git a/libcxx/test/std/input.output/filesystems/fs.op.funcs/fs.op.weakly_canonical/weakly_canonical.pass.cpp b/libcxx/test/std/input.output/filesystems/fs.op.funcs/fs.op.weakly_canonical/weakly_canonical.pass.cpp
index 053bddcad9b4..59bb3c78667b 100644
--- a/libcxx/test/std/input.output/filesystems/fs.op.funcs/fs.op.weakly_canonical/weakly_canonical.pass.cpp
+++ b/libcxx/test/std/input.output/filesystems/fs.op.funcs/fs.op.weakly_canonical/weakly_canonical.pass.cpp
@@ -74,11 +74,23 @@ int main(int, char**) {
fs::path p = TC.input;
fs::path expect = TC.expect;
expect.make_preferred();
- const fs::path output = fs::weakly_canonical(p);
- TEST_REQUIRE(PathEq(output, expect),
- TEST_WRITE_CONCATENATED(
- "Input: ", TC.input.string(), "\nExpected: ", expect.string(), "\nOutput: ", output.string()));
+ {
+ const fs::path output = fs::weakly_canonical(p);
+ TEST_REQUIRE(PathEq(output, expect),
+ TEST_WRITE_CONCATENATED(
+ "Input: ", TC.input.string(), "\nExpected: ", expect.string(), "\nOutput: ", output.string()));
+ }
+
+ // Test the error_code variant
+ {
+ std::error_code ec;
+ const fs::path output_c = fs::weakly_canonical(p, ec);
+
+ TEST_REQUIRE(PathEq(output_c, expect),
+ TEST_WRITE_CONCATENATED(
+ "Input: ", TC.input.string(), "\nExpected: ", expect.string(), "\nOutput: ", output_c.string()));
+ }
}
return 0;
}
diff --git a/libcxx/test/std/input.output/iostream.format/input.streams/istream.formatted/istream.formatted.arithmetic/bool.pass.cpp b/libcxx/test/std/input.output/iostream.format/input.streams/istream.formatted/istream.formatted.arithmetic/bool.pass.cpp
index c7d7a4e1f83d..4e915d340b31 100644
--- a/libcxx/test/std/input.output/iostream.format/input.streams/istream.formatted/istream.formatted.arithmetic/bool.pass.cpp
+++ b/libcxx/test/std/input.output/iostream.format/input.streams/istream.formatted/istream.formatted.arithmetic/bool.pass.cpp
@@ -6,7 +6,7 @@
//
//===----------------------------------------------------------------------===//
-// XFAIL: stdlib=apple-libc++ && target={{.+}}-apple-macosx10.{{9|10|11|12|13|14}}
+// XFAIL: stdlib=system && target={{.+}}-apple-macosx10.{{9|10|11|12|13|14}}
// <istream>
diff --git a/libcxx/test/std/input.output/iostream.format/input.streams/istream.formatted/istream.formatted.arithmetic/double.pass.cpp b/libcxx/test/std/input.output/iostream.format/input.streams/istream.formatted/istream.formatted.arithmetic/double.pass.cpp
index 7bb793082ee9..c7f2476cf82f 100644
--- a/libcxx/test/std/input.output/iostream.format/input.streams/istream.formatted/istream.formatted.arithmetic/double.pass.cpp
+++ b/libcxx/test/std/input.output/iostream.format/input.streams/istream.formatted/istream.formatted.arithmetic/double.pass.cpp
@@ -6,7 +6,7 @@
//
//===----------------------------------------------------------------------===//
-// XFAIL: stdlib=apple-libc++ && target={{.+}}-apple-macosx10.{{9|10|11|12|13|14}}
+// XFAIL: stdlib=system && target={{.+}}-apple-macosx10.{{9|10|11|12|13|14}}
// <istream>
diff --git a/libcxx/test/std/input.output/iostream.format/input.streams/istream.formatted/istream.formatted.arithmetic/float.pass.cpp b/libcxx/test/std/input.output/iostream.format/input.streams/istream.formatted/istream.formatted.arithmetic/float.pass.cpp
index cf4070a569a8..1acc771a6af1 100644
--- a/libcxx/test/std/input.output/iostream.format/input.streams/istream.formatted/istream.formatted.arithmetic/float.pass.cpp
+++ b/libcxx/test/std/input.output/iostream.format/input.streams/istream.formatted/istream.formatted.arithmetic/float.pass.cpp
@@ -6,7 +6,7 @@
//
//===----------------------------------------------------------------------===//
-// XFAIL: stdlib=apple-libc++ && target={{.+}}-apple-macosx10.{{9|10|11|12|13|14}}
+// XFAIL: stdlib=system && target={{.+}}-apple-macosx10.{{9|10|11|12|13|14}}
// <istream>
diff --git a/libcxx/test/std/input.output/iostream.format/input.streams/istream.formatted/istream.formatted.arithmetic/int.pass.cpp b/libcxx/test/std/input.output/iostream.format/input.streams/istream.formatted/istream.formatted.arithmetic/int.pass.cpp
index 6bfd64abd41f..dfd26975840e 100644
--- a/libcxx/test/std/input.output/iostream.format/input.streams/istream.formatted/istream.formatted.arithmetic/int.pass.cpp
+++ b/libcxx/test/std/input.output/iostream.format/input.streams/istream.formatted/istream.formatted.arithmetic/int.pass.cpp
@@ -6,7 +6,7 @@
//
//===----------------------------------------------------------------------===//
-// XFAIL: stdlib=apple-libc++ && target={{.+}}-apple-macosx10.{{9|10|11|12|13|14}}
+// XFAIL: stdlib=system && target={{.+}}-apple-macosx10.{{9|10|11|12|13|14}}
// <istream>
diff --git a/libcxx/test/std/input.output/iostream.format/input.streams/istream.formatted/istream.formatted.arithmetic/long.pass.cpp b/libcxx/test/std/input.output/iostream.format/input.streams/istream.formatted/istream.formatted.arithmetic/long.pass.cpp
index 8eca4d429910..440afad4afb1 100644
--- a/libcxx/test/std/input.output/iostream.format/input.streams/istream.formatted/istream.formatted.arithmetic/long.pass.cpp
+++ b/libcxx/test/std/input.output/iostream.format/input.streams/istream.formatted/istream.formatted.arithmetic/long.pass.cpp
@@ -6,7 +6,7 @@
//
//===----------------------------------------------------------------------===//
-// XFAIL: stdlib=apple-libc++ && target={{.+}}-apple-macosx10.{{9|10|11|12|13|14}}
+// XFAIL: stdlib=system && target={{.+}}-apple-macosx10.{{9|10|11|12|13|14}}
// <istream>
diff --git a/libcxx/test/std/input.output/iostream.format/input.streams/istream.formatted/istream.formatted.arithmetic/long_double.pass.cpp b/libcxx/test/std/input.output/iostream.format/input.streams/istream.formatted/istream.formatted.arithmetic/long_double.pass.cpp
index f290efecb495..49a2c3d5eb66 100644
--- a/libcxx/test/std/input.output/iostream.format/input.streams/istream.formatted/istream.formatted.arithmetic/long_double.pass.cpp
+++ b/libcxx/test/std/input.output/iostream.format/input.streams/istream.formatted/istream.formatted.arithmetic/long_double.pass.cpp
@@ -6,7 +6,7 @@
//
//===----------------------------------------------------------------------===//
-// XFAIL: stdlib=apple-libc++ && target={{.+}}-apple-macosx10.{{9|10|11|12|13|14}}
+// XFAIL: stdlib=system && target={{.+}}-apple-macosx10.{{9|10|11|12|13|14}}
// <istream>
diff --git a/libcxx/test/std/input.output/iostream.format/input.streams/istream.formatted/istream.formatted.arithmetic/long_long.pass.cpp b/libcxx/test/std/input.output/iostream.format/input.streams/istream.formatted/istream.formatted.arithmetic/long_long.pass.cpp
index 04fa1eaff6b3..1f2aee746c87 100644
--- a/libcxx/test/std/input.output/iostream.format/input.streams/istream.formatted/istream.formatted.arithmetic/long_long.pass.cpp
+++ b/libcxx/test/std/input.output/iostream.format/input.streams/istream.formatted/istream.formatted.arithmetic/long_long.pass.cpp
@@ -6,7 +6,7 @@
//
//===----------------------------------------------------------------------===//
-// XFAIL: stdlib=apple-libc++ && target={{.+}}-apple-macosx10.{{9|10|11|12|13|14}}
+// XFAIL: stdlib=system && target={{.+}}-apple-macosx10.{{9|10|11|12|13|14}}
// <istream>
diff --git a/libcxx/test/std/input.output/iostream.format/input.streams/istream.formatted/istream.formatted.arithmetic/pointer.pass.cpp b/libcxx/test/std/input.output/iostream.format/input.streams/istream.formatted/istream.formatted.arithmetic/pointer.pass.cpp
index ee388e9dc6b1..df467c98f793 100644
--- a/libcxx/test/std/input.output/iostream.format/input.streams/istream.formatted/istream.formatted.arithmetic/pointer.pass.cpp
+++ b/libcxx/test/std/input.output/iostream.format/input.streams/istream.formatted/istream.formatted.arithmetic/pointer.pass.cpp
@@ -6,7 +6,7 @@
//
//===----------------------------------------------------------------------===//
-// XFAIL: stdlib=apple-libc++ && target={{.+}}-apple-macosx10.{{9|10|11|12|13|14}}
+// XFAIL: stdlib=system && target={{.+}}-apple-macosx10.{{9|10|11|12|13|14}}
// <istream>
diff --git a/libcxx/test/std/input.output/iostream.format/input.streams/istream.formatted/istream.formatted.arithmetic/short.pass.cpp b/libcxx/test/std/input.output/iostream.format/input.streams/istream.formatted/istream.formatted.arithmetic/short.pass.cpp
index 965e029ed657..3530cd9adfa2 100644
--- a/libcxx/test/std/input.output/iostream.format/input.streams/istream.formatted/istream.formatted.arithmetic/short.pass.cpp
+++ b/libcxx/test/std/input.output/iostream.format/input.streams/istream.formatted/istream.formatted.arithmetic/short.pass.cpp
@@ -6,7 +6,7 @@
//
//===----------------------------------------------------------------------===//
-// XFAIL: stdlib=apple-libc++ && target={{.+}}-apple-macosx10.{{9|10|11|12|13|14}}
+// XFAIL: stdlib=system && target={{.+}}-apple-macosx10.{{9|10|11|12|13|14}}
// <istream>
diff --git a/libcxx/test/std/input.output/iostream.format/input.streams/istream.formatted/istream.formatted.arithmetic/unsigned_int.pass.cpp b/libcxx/test/std/input.output/iostream.format/input.streams/istream.formatted/istream.formatted.arithmetic/unsigned_int.pass.cpp
index f15a352f2ecc..3240b482b813 100644
--- a/libcxx/test/std/input.output/iostream.format/input.streams/istream.formatted/istream.formatted.arithmetic/unsigned_int.pass.cpp
+++ b/libcxx/test/std/input.output/iostream.format/input.streams/istream.formatted/istream.formatted.arithmetic/unsigned_int.pass.cpp
@@ -6,7 +6,7 @@
//
//===----------------------------------------------------------------------===//
-// XFAIL: stdlib=apple-libc++ && target={{.+}}-apple-macosx10.{{9|10|11|12|13|14}}
+// XFAIL: stdlib=system && target={{.+}}-apple-macosx10.{{9|10|11|12|13|14}}
// <istream>
diff --git a/libcxx/test/std/input.output/iostream.format/input.streams/istream.formatted/istream.formatted.arithmetic/unsigned_long.pass.cpp b/libcxx/test/std/input.output/iostream.format/input.streams/istream.formatted/istream.formatted.arithmetic/unsigned_long.pass.cpp
index 7c26e475aacc..ba6dc22cacb4 100644
--- a/libcxx/test/std/input.output/iostream.format/input.streams/istream.formatted/istream.formatted.arithmetic/unsigned_long.pass.cpp
+++ b/libcxx/test/std/input.output/iostream.format/input.streams/istream.formatted/istream.formatted.arithmetic/unsigned_long.pass.cpp
@@ -6,7 +6,7 @@
//
//===----------------------------------------------------------------------===//
-// XFAIL: stdlib=apple-libc++ && target={{.+}}-apple-macosx10.{{9|10|11|12|13|14}}
+// XFAIL: stdlib=system && target={{.+}}-apple-macosx10.{{9|10|11|12|13|14}}
// <istream>
diff --git a/libcxx/test/std/input.output/iostream.format/input.streams/istream.formatted/istream.formatted.arithmetic/unsigned_long_long.pass.cpp b/libcxx/test/std/input.output/iostream.format/input.streams/istream.formatted/istream.formatted.arithmetic/unsigned_long_long.pass.cpp
index d9af9213e43d..453d17ed31c5 100644
--- a/libcxx/test/std/input.output/iostream.format/input.streams/istream.formatted/istream.formatted.arithmetic/unsigned_long_long.pass.cpp
+++ b/libcxx/test/std/input.output/iostream.format/input.streams/istream.formatted/istream.formatted.arithmetic/unsigned_long_long.pass.cpp
@@ -6,7 +6,7 @@
//
//===----------------------------------------------------------------------===//
-// XFAIL: stdlib=apple-libc++ && target={{.+}}-apple-macosx10.{{9|10|11|12|13|14}}
+// XFAIL: stdlib=system && target={{.+}}-apple-macosx10.{{9|10|11|12|13|14}}
// <istream>
diff --git a/libcxx/test/std/input.output/iostream.format/input.streams/istream.formatted/istream.formatted.arithmetic/unsigned_short.pass.cpp b/libcxx/test/std/input.output/iostream.format/input.streams/istream.formatted/istream.formatted.arithmetic/unsigned_short.pass.cpp
index de5a989a52d7..70075760c57b 100644
--- a/libcxx/test/std/input.output/iostream.format/input.streams/istream.formatted/istream.formatted.arithmetic/unsigned_short.pass.cpp
+++ b/libcxx/test/std/input.output/iostream.format/input.streams/istream.formatted/istream.formatted.arithmetic/unsigned_short.pass.cpp
@@ -6,7 +6,7 @@
//
//===----------------------------------------------------------------------===//
-// XFAIL: stdlib=apple-libc++ && target={{.+}}-apple-macosx10.{{9|10|11|12|13|14}}
+// XFAIL: stdlib=system && target={{.+}}-apple-macosx10.{{9|10|11|12|13|14}}
// <istream>
diff --git a/libcxx/test/std/input.output/iostream.format/input.streams/istream.formatted/istream_extractors/streambuf.pass.cpp b/libcxx/test/std/input.output/iostream.format/input.streams/istream.formatted/istream_extractors/streambuf.pass.cpp
index 35cb70e1e50e..66a60c15ac06 100644
--- a/libcxx/test/std/input.output/iostream.format/input.streams/istream.formatted/istream_extractors/streambuf.pass.cpp
+++ b/libcxx/test/std/input.output/iostream.format/input.streams/istream.formatted/istream_extractors/streambuf.pass.cpp
@@ -6,7 +6,7 @@
//
//===----------------------------------------------------------------------===//
-// XFAIL: stdlib=apple-libc++ && target={{.+}}-apple-macosx10.{{9|10|11|12|13|14}}
+// XFAIL: stdlib=system && target={{.+}}-apple-macosx10.{{9|10|11|12|13|14}}
// <istream>
diff --git a/libcxx/test/std/input.output/iostream.format/input.streams/istream.unformatted/get.pass.cpp b/libcxx/test/std/input.output/iostream.format/input.streams/istream.unformatted/get.pass.cpp
index 13ac4028a0af..068b70818aa1 100644
--- a/libcxx/test/std/input.output/iostream.format/input.streams/istream.unformatted/get.pass.cpp
+++ b/libcxx/test/std/input.output/iostream.format/input.streams/istream.unformatted/get.pass.cpp
@@ -6,7 +6,7 @@
//
//===----------------------------------------------------------------------===//
-// XFAIL: stdlib=apple-libc++ && target={{.+}}-apple-macosx10.{{9|10|11|12|13|14}}
+// XFAIL: stdlib=system && target={{.+}}-apple-macosx10.{{9|10|11|12|13|14}}
// <istream>
diff --git a/libcxx/test/std/input.output/iostream.format/input.streams/istream.unformatted/get_chart.pass.cpp b/libcxx/test/std/input.output/iostream.format/input.streams/istream.unformatted/get_chart.pass.cpp
index fe15b3678f0e..dce6ba770b4e 100644
--- a/libcxx/test/std/input.output/iostream.format/input.streams/istream.unformatted/get_chart.pass.cpp
+++ b/libcxx/test/std/input.output/iostream.format/input.streams/istream.unformatted/get_chart.pass.cpp
@@ -6,7 +6,7 @@
//
//===----------------------------------------------------------------------===//
-// XFAIL: stdlib=apple-libc++ && target={{.+}}-apple-macosx10.{{9|10|11|12|13|14}}
+// XFAIL: stdlib=system && target={{.+}}-apple-macosx10.{{9|10|11|12|13|14}}
// <istream>
diff --git a/libcxx/test/std/input.output/iostream.format/input.streams/istream.unformatted/get_pointer_size.pass.cpp b/libcxx/test/std/input.output/iostream.format/input.streams/istream.unformatted/get_pointer_size.pass.cpp
index 8ae08ba4b99d..ab8d1f7e7d61 100644
--- a/libcxx/test/std/input.output/iostream.format/input.streams/istream.unformatted/get_pointer_size.pass.cpp
+++ b/libcxx/test/std/input.output/iostream.format/input.streams/istream.unformatted/get_pointer_size.pass.cpp
@@ -8,7 +8,7 @@
// In macosx10.9 to macosx10.14, streams are provided in the dylib AND they
// have a bug in how they handle null-termination in case of errors (see D40677).
-// XFAIL: stdlib=apple-libc++ && target={{.+}}-apple-macosx10.{{9|10|11|12|13|14}}
+// XFAIL: stdlib=system && target={{.+}}-apple-macosx10.{{9|10|11|12|13|14}}
// <istream>
diff --git a/libcxx/test/std/input.output/iostream.format/input.streams/istream.unformatted/get_pointer_size_chart.pass.cpp b/libcxx/test/std/input.output/iostream.format/input.streams/istream.unformatted/get_pointer_size_chart.pass.cpp
index f310172b7a8c..54873944af6a 100644
--- a/libcxx/test/std/input.output/iostream.format/input.streams/istream.unformatted/get_pointer_size_chart.pass.cpp
+++ b/libcxx/test/std/input.output/iostream.format/input.streams/istream.unformatted/get_pointer_size_chart.pass.cpp
@@ -8,7 +8,7 @@
// In macosx10.9 to macosx10.14, streams are provided in the dylib AND they
// have a bug in how they handle null-termination in case of errors (see D40677).
-// XFAIL: stdlib=apple-libc++ && target={{.+}}-apple-macosx10.{{9|10|11|12|13|14}}
+// XFAIL: stdlib=system && target={{.+}}-apple-macosx10.{{9|10|11|12|13|14}}
// <istream>
diff --git a/libcxx/test/std/input.output/iostream.format/input.streams/istream.unformatted/get_streambuf.pass.cpp b/libcxx/test/std/input.output/iostream.format/input.streams/istream.unformatted/get_streambuf.pass.cpp
index 331e38caefe4..7290236a9058 100644
--- a/libcxx/test/std/input.output/iostream.format/input.streams/istream.unformatted/get_streambuf.pass.cpp
+++ b/libcxx/test/std/input.output/iostream.format/input.streams/istream.unformatted/get_streambuf.pass.cpp
@@ -6,7 +6,7 @@
//
//===----------------------------------------------------------------------===//
-// XFAIL: stdlib=apple-libc++ && target={{.+}}-apple-macosx10.{{9|10|11|12|13|14}}
+// XFAIL: stdlib=system && target={{.+}}-apple-macosx10.{{9|10|11|12|13|14}}
// <istream>
diff --git a/libcxx/test/std/input.output/iostream.format/input.streams/istream.unformatted/get_streambuf_chart.pass.cpp b/libcxx/test/std/input.output/iostream.format/input.streams/istream.unformatted/get_streambuf_chart.pass.cpp
index 50ec7ea54bf0..3d8cbf59e329 100644
--- a/libcxx/test/std/input.output/iostream.format/input.streams/istream.unformatted/get_streambuf_chart.pass.cpp
+++ b/libcxx/test/std/input.output/iostream.format/input.streams/istream.unformatted/get_streambuf_chart.pass.cpp
@@ -6,7 +6,7 @@
//
//===----------------------------------------------------------------------===//
-// XFAIL: stdlib=apple-libc++ && target={{.+}}-apple-macosx10.{{9|10|11|12|13|14}}
+// XFAIL: stdlib=system && target={{.+}}-apple-macosx10.{{9|10|11|12|13|14}}
// <istream>
diff --git a/libcxx/test/std/input.output/iostream.format/input.streams/istream.unformatted/getline_pointer_size.pass.cpp b/libcxx/test/std/input.output/iostream.format/input.streams/istream.unformatted/getline_pointer_size.pass.cpp
index 8d131da65813..6518469d8aa4 100644
--- a/libcxx/test/std/input.output/iostream.format/input.streams/istream.unformatted/getline_pointer_size.pass.cpp
+++ b/libcxx/test/std/input.output/iostream.format/input.streams/istream.unformatted/getline_pointer_size.pass.cpp
@@ -8,7 +8,7 @@
// In macosx10.9 to macosx10.14, streams are provided in the dylib AND they
// have a bug in how they handle null-termination in case of errors (see D40677).
-// XFAIL: stdlib=apple-libc++ && target={{.+}}-apple-macosx10.{{9|10|11|12|13|14}}
+// XFAIL: stdlib=system && target={{.+}}-apple-macosx10.{{9|10|11|12|13|14}}
// <istream>
diff --git a/libcxx/test/std/input.output/iostream.format/input.streams/istream.unformatted/getline_pointer_size_chart.pass.cpp b/libcxx/test/std/input.output/iostream.format/input.streams/istream.unformatted/getline_pointer_size_chart.pass.cpp
index b85478d5ed57..86fd5a656733 100644
--- a/libcxx/test/std/input.output/iostream.format/input.streams/istream.unformatted/getline_pointer_size_chart.pass.cpp
+++ b/libcxx/test/std/input.output/iostream.format/input.streams/istream.unformatted/getline_pointer_size_chart.pass.cpp
@@ -8,7 +8,7 @@
// In macosx10.9 to macosx10.14, streams are provided in the dylib AND they
// have a bug in how they handle null-termination in case of errors (see D40677).
-// XFAIL: stdlib=apple-libc++ && target={{.+}}-apple-macosx10.{{9|10|11|12|13|14}}
+// XFAIL: stdlib=system && target={{.+}}-apple-macosx10.{{9|10|11|12|13|14}}
// <istream>
diff --git a/libcxx/test/std/input.output/iostream.format/input.streams/istream.unformatted/ignore.pass.cpp b/libcxx/test/std/input.output/iostream.format/input.streams/istream.unformatted/ignore.pass.cpp
index e313ddc5b97c..0a853672cebe 100644
--- a/libcxx/test/std/input.output/iostream.format/input.streams/istream.unformatted/ignore.pass.cpp
+++ b/libcxx/test/std/input.output/iostream.format/input.streams/istream.unformatted/ignore.pass.cpp
@@ -6,7 +6,7 @@
//
//===----------------------------------------------------------------------===//
-// XFAIL: stdlib=apple-libc++ && target={{.+}}-apple-macosx10.{{9|10|11|12|13|14}}
+// XFAIL: stdlib=system && target={{.+}}-apple-macosx10.{{9|10|11|12|13|14}}
// <istream>
diff --git a/libcxx/test/std/input.output/iostream.format/input.streams/istream.unformatted/peek.pass.cpp b/libcxx/test/std/input.output/iostream.format/input.streams/istream.unformatted/peek.pass.cpp
index 29ccb2cb43fe..45eab0ce28e4 100644
--- a/libcxx/test/std/input.output/iostream.format/input.streams/istream.unformatted/peek.pass.cpp
+++ b/libcxx/test/std/input.output/iostream.format/input.streams/istream.unformatted/peek.pass.cpp
@@ -6,7 +6,7 @@
//
//===----------------------------------------------------------------------===//
-// XFAIL: stdlib=apple-libc++ && target={{.+}}-apple-macosx10.{{9|10|11|12|13|14}}
+// XFAIL: stdlib=system && target={{.+}}-apple-macosx10.{{9|10|11|12|13|14}}
// <istream>
diff --git a/libcxx/test/std/input.output/iostream.format/input.streams/istream.unformatted/read.pass.cpp b/libcxx/test/std/input.output/iostream.format/input.streams/istream.unformatted/read.pass.cpp
index a00842dd3e0d..ba884e0a67b8 100644
--- a/libcxx/test/std/input.output/iostream.format/input.streams/istream.unformatted/read.pass.cpp
+++ b/libcxx/test/std/input.output/iostream.format/input.streams/istream.unformatted/read.pass.cpp
@@ -6,7 +6,7 @@
//
//===----------------------------------------------------------------------===//
-// XFAIL: stdlib=apple-libc++ && target={{.+}}-apple-macosx10.{{9|10|11|12|13|14}}
+// XFAIL: stdlib=system && target={{.+}}-apple-macosx10.{{9|10|11|12|13|14}}
// <istream>
diff --git a/libcxx/test/std/input.output/iostream.format/input.streams/istream.unformatted/seekg_off.pass.cpp b/libcxx/test/std/input.output/iostream.format/input.streams/istream.unformatted/seekg_off.pass.cpp
index 8b43c31e9f2b..5af9bda9c6f3 100644
--- a/libcxx/test/std/input.output/iostream.format/input.streams/istream.unformatted/seekg_off.pass.cpp
+++ b/libcxx/test/std/input.output/iostream.format/input.streams/istream.unformatted/seekg_off.pass.cpp
@@ -6,7 +6,7 @@
//
//===----------------------------------------------------------------------===//
-// XFAIL: stdlib=apple-libc++ && target={{.+}}-apple-macosx10.{{9|10|11}}
+// XFAIL: stdlib=system && target={{.+}}-apple-macosx10.{{9|10|11}}
// <istream>
diff --git a/libcxx/test/std/input.output/iostream.format/input.streams/istream.unformatted/sync.pass.cpp b/libcxx/test/std/input.output/iostream.format/input.streams/istream.unformatted/sync.pass.cpp
index 4fa58c0abfba..3608b99dea97 100644
--- a/libcxx/test/std/input.output/iostream.format/input.streams/istream.unformatted/sync.pass.cpp
+++ b/libcxx/test/std/input.output/iostream.format/input.streams/istream.unformatted/sync.pass.cpp
@@ -13,8 +13,7 @@
// The fix for bug 51497 and bug 51499 require and updated dylib due to
// explicit instantiations. That means Apple backdeployment targets remain
// broken.
-// TODO(#82107) Enable XFAIL.
-// UNSUPPORTED: using-built-library-before-llvm-19
+// XFAIL: using-built-library-before-llvm-19
#include <istream>
#include <cassert>
diff --git a/libcxx/test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.formatted.print/locale-specific_form.pass.cpp b/libcxx/test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.formatted.print/locale-specific_form.pass.cpp
index 2e19e38e2ed0..57023b73c474 100644
--- a/libcxx/test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.formatted.print/locale-specific_form.pass.cpp
+++ b/libcxx/test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.formatted.print/locale-specific_form.pass.cpp
@@ -66,6 +66,7 @@ test(std::stringstream& stream, std::string expected, test_format_string<char, A
"\nFormat string ", fmt.get(), "\nExpected output ", expected, "\nActual output ", out, '\n'));
}
// *** vprint_unicode ***
+#ifndef TEST_HAS_NO_UNICODE
{
stream.str("");
@@ -75,6 +76,7 @@ test(std::stringstream& stream, std::string expected, test_format_string<char, A
TEST_WRITE_CONCATENATED(
"\nFormat string ", fmt.get(), "\nExpected output ", expected, "\nActual output ", out, '\n'));
}
+#endif // TEST_HAS_NO_UNICODE
// *** vprint_nonunicode ***
{
stream.str("");
diff --git a/libcxx/test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.formatted.print/vprint_unicode.pass.cpp b/libcxx/test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.formatted.print/vprint_unicode.pass.cpp
index b04a745b348f..b4d6b3529cec 100644
--- a/libcxx/test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.formatted.print/vprint_unicode.pass.cpp
+++ b/libcxx/test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.formatted.print/vprint_unicode.pass.cpp
@@ -6,6 +6,7 @@
//===----------------------------------------------------------------------===//
// UNSUPPORTED: c++03, c++11, c++14, c++17, c++20
+// UNSUPPORTED: libcpp-has-no-unicode
// UNSUPPORTED: GCC-ALWAYS_INLINE-FIXME
// TODO PRINT Investigate see https://reviews.llvm.org/D156585
diff --git a/libcxx/test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.arithmetic/minmax_showbase.pass.cpp b/libcxx/test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.arithmetic/minmax_showbase.pass.cpp
index a5b19c4e44cf..bef2b071c843 100644
--- a/libcxx/test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.arithmetic/minmax_showbase.pass.cpp
+++ b/libcxx/test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.arithmetic/minmax_showbase.pass.cpp
@@ -25,7 +25,7 @@
// This test exposes a regression that was not fixed yet in the libc++
// shipped with macOS 10.12, 10.13 and 10.14. See D32670 for details.
-// XFAIL: stdlib=apple-libc++ && target={{.+}}-apple-macosx10.{{12|13|14}}
+// XFAIL: stdlib=system && target={{.+}}-apple-macosx10.{{12|13|14}}
#include <cassert>
#include <cstdint>
diff --git a/libcxx/test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.arithmetic/minus1.pass.cpp b/libcxx/test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.arithmetic/minus1.pass.cpp
index 207fc42e3cd4..34c143ac1449 100644
--- a/libcxx/test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.arithmetic/minus1.pass.cpp
+++ b/libcxx/test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.arithmetic/minus1.pass.cpp
@@ -6,7 +6,7 @@
//
//===----------------------------------------------------------------------===//
-// XFAIL: stdlib=apple-libc++ && target={{.+}}-apple-macosx10.12
+// XFAIL: stdlib=system && target={{.+}}-apple-macosx10.12
// <ostream>
diff --git a/libcxx/test/std/input.output/iostream.format/print.fun/no_file_description.pass.cpp b/libcxx/test/std/input.output/iostream.format/print.fun/no_file_description.pass.cpp
index ffa48c5e745d..70e0c11c5e6c 100644
--- a/libcxx/test/std/input.output/iostream.format/print.fun/no_file_description.pass.cpp
+++ b/libcxx/test/std/input.output/iostream.format/print.fun/no_file_description.pass.cpp
@@ -80,6 +80,7 @@ static void test_println_blank_line() {
}
static void test_vprint_unicode() {
+#ifdef TEST_HAS_NO_UNICODE
std::array<char, 100> buffer{0};
FILE* file = fmemopen(buffer.data(), buffer.size(), "wb");
@@ -92,6 +93,7 @@ static void test_vprint_unicode() {
assert(pos > 0);
assert(std::string_view(buffer.data(), pos) == "hello world!");
+#endif // TEST_HAS_NO_UNICODE
}
static void test_vprint_nonunicode() {
diff --git a/libcxx/test/std/input.output/iostream.format/print.fun/vprint_unicode.sh.cpp b/libcxx/test/std/input.output/iostream.format/print.fun/vprint_unicode.sh.cpp
index 198e71b55d9b..e32a794b96dd 100644
--- a/libcxx/test/std/input.output/iostream.format/print.fun/vprint_unicode.sh.cpp
+++ b/libcxx/test/std/input.output/iostream.format/print.fun/vprint_unicode.sh.cpp
@@ -7,6 +7,7 @@
// UNSUPPORTED: c++03, c++11, c++14, c++17, c++20
// UNSUPPORTED: no-filesystem
+// UNSUPPORTED: libcpp-has-no-unicode
// UNSUPPORTED: GCC-ALWAYS_INLINE-FIXME
// XFAIL: availability-fp_to_chars-missing
diff --git a/libcxx/test/std/input.output/iostreams.base/ios.base/ios.types/ios_Init/ios_Init.multiple.pass.cpp b/libcxx/test/std/input.output/iostreams.base/ios.base/ios.types/ios_Init/ios_Init.multiple.pass.cpp
index f842f28e1fa4..1d8fecf34529 100644
--- a/libcxx/test/std/input.output/iostreams.base/ios.base/ios.types/ios_Init/ios_Init.multiple.pass.cpp
+++ b/libcxx/test/std/input.output/iostreams.base/ios.base/ios.types/ios_Init/ios_Init.multiple.pass.cpp
@@ -16,7 +16,7 @@
// The dylibs shipped on macOS so far do not contain the fix for PR43300, so
// this test fails.
-// XFAIL: stdlib=apple-libc++ && target={{.+}}-apple-macosx10.{{9|10|11|12|13|14}}
+// XFAIL: stdlib=system && target={{.+}}-apple-macosx10.{{9|10|11|12|13|14}}
int main(int, char**)
{
diff --git a/libcxx/test/std/language.support/support.dynamic/new.delete/new.delete.array/sized_delete_array_fsizeddeallocation.pass.cpp b/libcxx/test/std/language.support/support.dynamic/new.delete/new.delete.array/sized_delete_array_fsizeddeallocation.pass.cpp
index 7fb92938eeea..563f8bb2c8f3 100644
--- a/libcxx/test/std/language.support/support.dynamic/new.delete/new.delete.array/sized_delete_array_fsizeddeallocation.pass.cpp
+++ b/libcxx/test/std/language.support/support.dynamic/new.delete/new.delete.array/sized_delete_array_fsizeddeallocation.pass.cpp
@@ -12,7 +12,7 @@
// when sized deallocation is not supported, e.g., prior to C++14.
// UNSUPPORTED: sanitizer-new-delete
-// XFAIL: stdlib=apple-libc++ && target={{.+}}-apple-macosx10.{{9|10|11}}
+// XFAIL: stdlib=system && target={{.+}}-apple-macosx10.{{9|10|11}}
// REQUIRES: -fsized-deallocation
// ADDITIONAL_COMPILE_FLAGS: -fsized-deallocation
diff --git a/libcxx/test/std/language.support/support.dynamic/new.delete/new.delete.single/sized_delete_fsizeddeallocation.pass.cpp b/libcxx/test/std/language.support/support.dynamic/new.delete/new.delete.single/sized_delete_fsizeddeallocation.pass.cpp
index df8b96447262..d9d8e038784a 100644
--- a/libcxx/test/std/language.support/support.dynamic/new.delete/new.delete.single/sized_delete_fsizeddeallocation.pass.cpp
+++ b/libcxx/test/std/language.support/support.dynamic/new.delete/new.delete.single/sized_delete_fsizeddeallocation.pass.cpp
@@ -12,7 +12,7 @@
// when sized deallocation is not supported, e.g., prior to C++14.
// UNSUPPORTED: sanitizer-new-delete
-// XFAIL: stdlib=apple-libc++ && target={{.+}}-apple-macosx10.{{9|10|11}}
+// XFAIL: stdlib=system && target={{.+}}-apple-macosx10.{{9|10|11}}
// REQUIRES: -fsized-deallocation
// ADDITIONAL_COMPILE_FLAGS: -fsized-deallocation -O3
diff --git a/libcxx/test/std/language.support/support.exception/uncaught/uncaught_exceptions.pass.cpp b/libcxx/test/std/language.support/support.exception/uncaught/uncaught_exceptions.pass.cpp
index 1d8b6b1560e8..e8a36a92e43e 100644
--- a/libcxx/test/std/language.support/support.exception/uncaught/uncaught_exceptions.pass.cpp
+++ b/libcxx/test/std/language.support/support.exception/uncaught/uncaught_exceptions.pass.cpp
@@ -9,11 +9,11 @@
// UNSUPPORTED: no-exceptions
// std::uncaught_exceptions() was introduced in the dylib on Mac OS 10.12
-// XFAIL: stdlib=apple-libc++ && target={{.+}}-apple-macosx10.{{9|10|11}}
+// XFAIL: stdlib=system && target={{.+}}-apple-macosx10.{{9|10|11}}
// However, std::uncaught_exceptions() gives the wrong answer in Mac OS 10.12
// and 10.13, where it only gives 0 or 1. This was fixed later.
-// XFAIL: stdlib=apple-libc++ && target={{.+}}-apple-macosx10.{{12|13}}
+// XFAIL: stdlib=system && target={{.+}}-apple-macosx10.{{12|13}}
// test uncaught_exceptions
diff --git a/libcxx/test/std/language.support/support.limits/support.limits.general/compare.version.compile.pass.cpp b/libcxx/test/std/language.support/support.limits/support.limits.general/compare.version.compile.pass.cpp
index f521c53250b6..aac00f20c7b4 100644
--- a/libcxx/test/std/language.support/support.limits/support.limits.general/compare.version.compile.pass.cpp
+++ b/libcxx/test/std/language.support/support.limits/support.limits.general/compare.version.compile.pass.cpp
@@ -16,7 +16,7 @@
// Test the feature test macros defined by <compare>
/* Constant Value
- __cpp_lib_three_way_comparison 201907L [C++20]
+ __cpp_lib_three_way_comparison 201711L [C++20]
*/
#include <compare>
@@ -42,47 +42,29 @@
#elif TEST_STD_VER == 20
-# if !defined(_LIBCPP_VERSION)
-# ifndef __cpp_lib_three_way_comparison
-# error "__cpp_lib_three_way_comparison should be defined in c++20"
-# endif
-# if __cpp_lib_three_way_comparison != 201907L
-# error "__cpp_lib_three_way_comparison should have the value 201907L in c++20"
-# endif
-# else // _LIBCPP_VERSION
-# ifdef __cpp_lib_three_way_comparison
-# error "__cpp_lib_three_way_comparison should not be defined because it is unimplemented in libc++!"
-# endif
+# ifndef __cpp_lib_three_way_comparison
+# error "__cpp_lib_three_way_comparison should be defined in c++20"
+# endif
+# if __cpp_lib_three_way_comparison != 201711L
+# error "__cpp_lib_three_way_comparison should have the value 201711L in c++20"
# endif
#elif TEST_STD_VER == 23
-# if !defined(_LIBCPP_VERSION)
-# ifndef __cpp_lib_three_way_comparison
-# error "__cpp_lib_three_way_comparison should be defined in c++23"
-# endif
-# if __cpp_lib_three_way_comparison != 201907L
-# error "__cpp_lib_three_way_comparison should have the value 201907L in c++23"
-# endif
-# else // _LIBCPP_VERSION
-# ifdef __cpp_lib_three_way_comparison
-# error "__cpp_lib_three_way_comparison should not be defined because it is unimplemented in libc++!"
-# endif
+# ifndef __cpp_lib_three_way_comparison
+# error "__cpp_lib_three_way_comparison should be defined in c++23"
+# endif
+# if __cpp_lib_three_way_comparison != 201711L
+# error "__cpp_lib_three_way_comparison should have the value 201711L in c++23"
# endif
#elif TEST_STD_VER > 23
-# if !defined(_LIBCPP_VERSION)
-# ifndef __cpp_lib_three_way_comparison
-# error "__cpp_lib_three_way_comparison should be defined in c++26"
-# endif
-# if __cpp_lib_three_way_comparison != 201907L
-# error "__cpp_lib_three_way_comparison should have the value 201907L in c++26"
-# endif
-# else // _LIBCPP_VERSION
-# ifdef __cpp_lib_three_way_comparison
-# error "__cpp_lib_three_way_comparison should not be defined because it is unimplemented in libc++!"
-# endif
+# ifndef __cpp_lib_three_way_comparison
+# error "__cpp_lib_three_way_comparison should be defined in c++26"
+# endif
+# if __cpp_lib_three_way_comparison != 201711L
+# error "__cpp_lib_three_way_comparison should have the value 201711L in c++26"
# endif
#endif // TEST_STD_VER > 23
diff --git a/libcxx/test/std/language.support/support.limits/support.limits.general/version.version.compile.pass.cpp b/libcxx/test/std/language.support/support.limits/support.limits.general/version.version.compile.pass.cpp
index c1e1f9f340af..32ed30e21cbb 100644
--- a/libcxx/test/std/language.support/support.limits/support.limits.general/version.version.compile.pass.cpp
+++ b/libcxx/test/std/language.support/support.limits/support.limits.general/version.version.compile.pass.cpp
@@ -145,6 +145,7 @@
__cpp_lib_math_special_functions 201603L [C++17]
__cpp_lib_mdspan 202207L [C++23]
__cpp_lib_memory_resource 201603L [C++17]
+ __cpp_lib_modules 202207L [C++23]
__cpp_lib_move_iterator_concept 202207L [C++20]
__cpp_lib_move_only_function 202110L [C++23]
__cpp_lib_node_extract 201606L [C++17]
@@ -211,7 +212,7 @@
__cpp_lib_submdspan 202306L [C++26]
__cpp_lib_syncbuf 201803L [C++20]
__cpp_lib_text_encoding 202306L [C++26]
- __cpp_lib_three_way_comparison 201907L [C++20]
+ __cpp_lib_three_way_comparison 201711L [C++20]
__cpp_lib_to_address 201711L [C++20]
__cpp_lib_to_array 201907L [C++20]
__cpp_lib_to_chars 201611L [C++17]
@@ -740,6 +741,10 @@
# error "__cpp_lib_memory_resource should not be defined before c++17"
# endif
+# ifdef __cpp_lib_modules
+# error "__cpp_lib_modules should not be defined before c++23"
+# endif
+
# ifdef __cpp_lib_move_iterator_concept
# error "__cpp_lib_move_iterator_concept should not be defined before c++20"
# endif
@@ -1596,6 +1601,10 @@
# error "__cpp_lib_memory_resource should not be defined before c++17"
# endif
+# ifdef __cpp_lib_modules
+# error "__cpp_lib_modules should not be defined before c++23"
+# endif
+
# ifdef __cpp_lib_move_iterator_concept
# error "__cpp_lib_move_iterator_concept should not be defined before c++20"
# endif
@@ -2614,6 +2623,10 @@
# endif
# endif
+# ifdef __cpp_lib_modules
+# error "__cpp_lib_modules should not be defined before c++23"
+# endif
+
# ifdef __cpp_lib_move_iterator_concept
# error "__cpp_lib_move_iterator_concept should not be defined before c++20"
# endif
@@ -3917,6 +3930,10 @@
# endif
# endif
+# ifdef __cpp_lib_modules
+# error "__cpp_lib_modules should not be defined before c++23"
+# endif
+
# ifndef __cpp_lib_move_iterator_concept
# error "__cpp_lib_move_iterator_concept should be defined in c++20"
# endif
@@ -4309,17 +4326,11 @@
# error "__cpp_lib_text_encoding should not be defined before c++26"
# endif
-# if !defined(_LIBCPP_VERSION)
-# ifndef __cpp_lib_three_way_comparison
-# error "__cpp_lib_three_way_comparison should be defined in c++20"
-# endif
-# if __cpp_lib_three_way_comparison != 201907L
-# error "__cpp_lib_three_way_comparison should have the value 201907L in c++20"
-# endif
-# else // _LIBCPP_VERSION
-# ifdef __cpp_lib_three_way_comparison
-# error "__cpp_lib_three_way_comparison should not be defined because it is unimplemented in libc++!"
-# endif
+# ifndef __cpp_lib_three_way_comparison
+# error "__cpp_lib_three_way_comparison should be defined in c++20"
+# endif
+# if __cpp_lib_three_way_comparison != 201711L
+# error "__cpp_lib_three_way_comparison should have the value 201711L in c++20"
# endif
# ifndef __cpp_lib_to_address
@@ -5373,6 +5384,13 @@
# endif
# endif
+# ifndef __cpp_lib_modules
+# error "__cpp_lib_modules should be defined in c++23"
+# endif
+# if __cpp_lib_modules != 202207L
+# error "__cpp_lib_modules should have the value 202207L in c++23"
+# endif
+
# ifndef __cpp_lib_move_iterator_concept
# error "__cpp_lib_move_iterator_concept should be defined in c++23"
# endif
@@ -5894,17 +5912,11 @@
# error "__cpp_lib_text_encoding should not be defined before c++26"
# endif
-# if !defined(_LIBCPP_VERSION)
-# ifndef __cpp_lib_three_way_comparison
-# error "__cpp_lib_three_way_comparison should be defined in c++23"
-# endif
-# if __cpp_lib_three_way_comparison != 201907L
-# error "__cpp_lib_three_way_comparison should have the value 201907L in c++23"
-# endif
-# else // _LIBCPP_VERSION
-# ifdef __cpp_lib_three_way_comparison
-# error "__cpp_lib_three_way_comparison should not be defined because it is unimplemented in libc++!"
-# endif
+# ifndef __cpp_lib_three_way_comparison
+# error "__cpp_lib_three_way_comparison should be defined in c++23"
+# endif
+# if __cpp_lib_three_way_comparison != 201711L
+# error "__cpp_lib_three_way_comparison should have the value 201711L in c++23"
# endif
# ifndef __cpp_lib_to_address
@@ -7165,6 +7177,13 @@
# endif
# endif
+# ifndef __cpp_lib_modules
+# error "__cpp_lib_modules should be defined in c++26"
+# endif
+# if __cpp_lib_modules != 202207L
+# error "__cpp_lib_modules should have the value 202207L in c++26"
+# endif
+
# ifndef __cpp_lib_move_iterator_concept
# error "__cpp_lib_move_iterator_concept should be defined in c++26"
# endif
@@ -7749,17 +7768,11 @@
# endif
# endif
-# if !defined(_LIBCPP_VERSION)
-# ifndef __cpp_lib_three_way_comparison
-# error "__cpp_lib_three_way_comparison should be defined in c++26"
-# endif
-# if __cpp_lib_three_way_comparison != 201907L
-# error "__cpp_lib_three_way_comparison should have the value 201907L in c++26"
-# endif
-# else // _LIBCPP_VERSION
-# ifdef __cpp_lib_three_way_comparison
-# error "__cpp_lib_three_way_comparison should not be defined because it is unimplemented in libc++!"
-# endif
+# ifndef __cpp_lib_three_way_comparison
+# error "__cpp_lib_three_way_comparison should be defined in c++26"
+# endif
+# if __cpp_lib_three_way_comparison != 201711L
+# error "__cpp_lib_three_way_comparison should have the value 201711L in c++26"
# endif
# ifndef __cpp_lib_to_address
diff --git a/libcxx/test/std/language.support/support.runtime/cstdlib.aligned_alloc.compile.pass.cpp b/libcxx/test/std/language.support/support.runtime/cstdlib.aligned_alloc.compile.pass.cpp
index 1c3c546f415b..da04d9f2dc0f 100644
--- a/libcxx/test/std/language.support/support.runtime/cstdlib.aligned_alloc.compile.pass.cpp
+++ b/libcxx/test/std/language.support/support.runtime/cstdlib.aligned_alloc.compile.pass.cpp
@@ -13,7 +13,7 @@
// ::aligned_alloc is provided by the C library, but it's marked as unavailable
// until macOS 10.15
-// XFAIL: stdlib=apple-libc++ && target={{.+}}-apple-macosx10.{{9|10|11|12|13|14}}
+// XFAIL: stdlib=system && target={{.+}}-apple-macosx10.{{9|10|11|12|13|14}}
// ::aligned_alloc is not implemented on Windows
// XFAIL: target={{.+}}-windows-{{.+}}
diff --git a/libcxx/test/std/language.support/support.runtime/ctime.timespec.compile.pass.cpp b/libcxx/test/std/language.support/support.runtime/ctime.timespec.compile.pass.cpp
index 12b1c3888132..87957afc4206 100644
--- a/libcxx/test/std/language.support/support.runtime/ctime.timespec.compile.pass.cpp
+++ b/libcxx/test/std/language.support/support.runtime/ctime.timespec.compile.pass.cpp
@@ -16,7 +16,7 @@
// ::timespec_get is provided by the C library, but it's marked as
// unavailable until macOS 10.15
-// XFAIL: stdlib=apple-libc++ && target={{.+}}-apple-macosx10.{{9|10|11|12|13|14}}
+// XFAIL: stdlib=system && target={{.+}}-apple-macosx10.{{9|10|11|12|13|14}}
// ::timespec_get is available starting with Android Q (API 29)
// XFAIL: target={{.+}}-android{{(eabi)?(21|22|23|24|25|26|27|28)}}
diff --git a/libcxx/test/std/localization/codecvt_unicode.pass.cpp b/libcxx/test/std/localization/codecvt_unicode.pass.cpp
index 08ecc16ef431..a434a22ff96b 100644
--- a/libcxx/test/std/localization/codecvt_unicode.pass.cpp
+++ b/libcxx/test/std/localization/codecvt_unicode.pass.cpp
@@ -7,7 +7,7 @@
//===----------------------------------------------------------------------===//
// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DISABLE_DEPRECATION_WARNINGS -D_LIBCPP_ENABLE_CXX26_REMOVED_CODECVT
-// XFAIL: stdlib=apple-libc++ && target={{.+}}-apple-macosx{{10.9|10.10|10.11|10.12|10.13|10.14|10.15|11.0|12.0|13.0}}
+// XFAIL: stdlib=system && target={{.+}}-apple-macosx{{10.9|10.10|10.11|10.12|10.13|10.14|10.15|11.0|12.0|13.0}}
#include <algorithm>
#include <cassert>
diff --git a/libcxx/test/std/localization/locale.categories/category.ctype/facet.ctype.special/facet.ctype.char.statics/table_size.pass.cpp b/libcxx/test/std/localization/locale.categories/category.ctype/facet.ctype.special/facet.ctype.char.statics/table_size.pass.cpp
index bbfbe5d5d02e..05536053825b 100644
--- a/libcxx/test/std/localization/locale.categories/category.ctype/facet.ctype.special/facet.ctype.char.statics/table_size.pass.cpp
+++ b/libcxx/test/std/localization/locale.categories/category.ctype/facet.ctype.special/facet.ctype.char.statics/table_size.pass.cpp
@@ -14,8 +14,8 @@
// Before https://llvm.org/D110647, the shared library did not contain
// std::ctype<char>::table_size, so this test fails with a link error.
-// XFAIL: stdlib=apple-libc++ && target={{.+}}-apple-macosx10.{{9|10|11|12|13|14|15}}
-// XFAIL: stdlib=apple-libc++ && target={{.+}}-apple-macosx{{11.0|12.0|13.0}}
+// XFAIL: stdlib=system && target={{.+}}-apple-macosx10.{{9|10|11|12|13|14|15}}
+// XFAIL: stdlib=system && target={{.+}}-apple-macosx{{11.0|12.0|13.0}}
#include <locale>
#include <cassert>
diff --git a/libcxx/test/std/localization/locale.categories/category.monetary/locale.money.get/locale.money.get.members/get_long_double_fr_FR.pass.cpp b/libcxx/test/std/localization/locale.categories/category.monetary/locale.money.get/locale.money.get.members/get_long_double_fr_FR.pass.cpp
index 3effa80e7d6f..bbb67d694970 100644
--- a/libcxx/test/std/localization/locale.categories/category.monetary/locale.money.get/locale.money.get.members/get_long_double_fr_FR.pass.cpp
+++ b/libcxx/test/std/localization/locale.categories/category.monetary/locale.money.get/locale.money.get.members/get_long_double_fr_FR.pass.cpp
@@ -11,8 +11,6 @@
// NetBSD does not support LC_MONETARY at the moment
// XFAIL: netbsd
-// XFAIL: LIBCXX-AIX-FIXME
-
// REQUIRES: locale.fr_FR.UTF-8
// <locale>
@@ -32,6 +30,13 @@
#include "platform_support.h" // locale name macros
#include "test_macros.h"
+#ifdef _AIX
+// the AIX libc expects U202F as LC_MONETARY thousands_sep
+# define THOUSANDS_SEP L"\u202F"
+#else
+# define THOUSANDS_SEP L" "
+#endif
+
typedef std::money_get<char, cpp17_input_iterator<const char*> > Fn;
class my_facet
@@ -432,26 +437,24 @@ int main(int, char**)
assert(ex == -1);
}
{ // positive
- std::wstring v = convert_thousands_sep(L"1 234 567,89 ");
- typedef cpp17_input_iterator<const wchar_t*> I;
- long double ex;
- std::ios_base::iostate err = std::ios_base::goodbit;
- I iter = f.get(I(v.data()), I(v.data() + v.size()),
- false, ios, err, ex);
- assert(base(iter) == v.data() + v.size());
- assert(err == std::ios_base::eofbit);
- assert(ex == 123456789);
+ std::wstring v = convert_thousands_sep(L"1" THOUSANDS_SEP "234" THOUSANDS_SEP "567,89 ");
+ typedef cpp17_input_iterator<const wchar_t*> I;
+ long double ex;
+ std::ios_base::iostate err = std::ios_base::goodbit;
+ I iter = f.get(I(v.data()), I(v.data() + v.size()), false, ios, err, ex);
+ assert(base(iter) == v.data() + v.size());
+ assert(err == std::ios_base::eofbit);
+ assert(ex == 123456789);
}
{ // negative
- std::wstring v = convert_thousands_sep(L"-1 234 567,89");
- typedef cpp17_input_iterator<const wchar_t*> I;
- long double ex;
- std::ios_base::iostate err = std::ios_base::goodbit;
- I iter = f.get(I(v.data()), I(v.data() + v.size()),
- false, ios, err, ex);
- assert(base(iter) == v.data() + v.size());
- assert(err == std::ios_base::eofbit);
- assert(ex == -123456789);
+ std::wstring v = convert_thousands_sep(L"-1" THOUSANDS_SEP "234" THOUSANDS_SEP "567,89");
+ typedef cpp17_input_iterator<const wchar_t*> I;
+ long double ex;
+ std::ios_base::iostate err = std::ios_base::goodbit;
+ I iter = f.get(I(v.data()), I(v.data() + v.size()), false, ios, err, ex);
+ assert(base(iter) == v.data() + v.size());
+ assert(err == std::ios_base::eofbit);
+ assert(ex == -123456789);
}
{ // negative
std::wstring v = L"-1234567,89";
@@ -512,64 +515,59 @@ int main(int, char**)
assert(ex == -1);
}
{ // positive, showbase
- std::wstring v = convert_thousands_sep(L"1 234 567,89 \u20ac"); // EURO SIGN
- typedef cpp17_input_iterator<const wchar_t*> I;
- long double ex;
- std::ios_base::iostate err = std::ios_base::goodbit;
- I iter = f.get(I(v.data()), I(v.data() + v.size()),
- false, ios, err, ex);
- assert(base(iter) == v.data() + v.size());
- assert(err == std::ios_base::eofbit);
- assert(ex == 123456789);
+ std::wstring v = convert_thousands_sep(L"1" THOUSANDS_SEP "234" THOUSANDS_SEP "567,89 \u20ac"); // EURO SIGN
+ typedef cpp17_input_iterator<const wchar_t*> I;
+ long double ex;
+ std::ios_base::iostate err = std::ios_base::goodbit;
+ I iter = f.get(I(v.data()), I(v.data() + v.size()), false, ios, err, ex);
+ assert(base(iter) == v.data() + v.size());
+ assert(err == std::ios_base::eofbit);
+ assert(ex == 123456789);
}
{ // positive, showbase
- std::wstring v = convert_thousands_sep(L"1 234 567,89 \u20ac"); // EURO SIGN
- std::showbase(ios);
- typedef cpp17_input_iterator<const wchar_t*> I;
- long double ex;
- std::ios_base::iostate err = std::ios_base::goodbit;
- I iter = f.get(I(v.data()), I(v.data() + v.size()),
- false, ios, err, ex);
- assert(base(iter) == v.data() + v.size());
- assert(err == std::ios_base::eofbit);
- assert(ex == 123456789);
- std::noshowbase(ios);
+ std::wstring v = convert_thousands_sep(L"1" THOUSANDS_SEP "234" THOUSANDS_SEP "567,89 \u20ac"); // EURO SIGN
+ std::showbase(ios);
+ typedef cpp17_input_iterator<const wchar_t*> I;
+ long double ex;
+ std::ios_base::iostate err = std::ios_base::goodbit;
+ I iter = f.get(I(v.data()), I(v.data() + v.size()), false, ios, err, ex);
+ assert(base(iter) == v.data() + v.size());
+ assert(err == std::ios_base::eofbit);
+ assert(ex == 123456789);
+ std::noshowbase(ios);
}
{ // negative, showbase
- std::wstring v = convert_thousands_sep(L"-1 234 567,89 \u20ac"); // EURO SIGN
- std::showbase(ios);
- typedef cpp17_input_iterator<const wchar_t*> I;
- long double ex;
- std::ios_base::iostate err = std::ios_base::goodbit;
- I iter = f.get(I(v.data()), I(v.data() + v.size()),
- false, ios, err, ex);
- assert(base(iter) == v.data() + v.size());
- assert(err == std::ios_base::eofbit);
- assert(ex == -123456789);
- std::noshowbase(ios);
+ std::wstring v = convert_thousands_sep(L"-1" THOUSANDS_SEP "234" THOUSANDS_SEP "567,89 \u20ac"); // EURO SIGN
+ std::showbase(ios);
+ typedef cpp17_input_iterator<const wchar_t*> I;
+ long double ex;
+ std::ios_base::iostate err = std::ios_base::goodbit;
+ I iter = f.get(I(v.data()), I(v.data() + v.size()), false, ios, err, ex);
+ assert(base(iter) == v.data() + v.size());
+ assert(err == std::ios_base::eofbit);
+ assert(ex == -123456789);
+ std::noshowbase(ios);
}
{ // negative, showbase
- std::wstring v = convert_thousands_sep(L"1 234 567,89 EUR -");
- std::showbase(ios);
- typedef cpp17_input_iterator<const wchar_t*> I;
- long double ex;
- std::ios_base::iostate err = std::ios_base::goodbit;
- I iter = f.get(I(v.data()), I(v.data() + v.size()),
- false, ios, err, ex);
- assert(base(iter) == v.data() + 13);
- assert(err == std::ios_base::failbit);
- std::noshowbase(ios);
+ std::wstring v = convert_thousands_sep(L"1" THOUSANDS_SEP "234" THOUSANDS_SEP "567,89 EUR -");
+ std::showbase(ios);
+ typedef cpp17_input_iterator<const wchar_t*> I;
+ long double ex;
+ std::ios_base::iostate err = std::ios_base::goodbit;
+ I iter = f.get(I(v.data()), I(v.data() + v.size()), false, ios, err, ex);
+ assert(base(iter) == v.data() + 13);
+ assert(err == std::ios_base::failbit);
+ std::noshowbase(ios);
}
{ // negative, showbase
- std::wstring v = convert_thousands_sep(L"1 234 567,89 EUR -");
- typedef cpp17_input_iterator<const wchar_t*> I;
- long double ex;
- std::ios_base::iostate err = std::ios_base::goodbit;
- I iter = f.get(I(v.data()), I(v.data() + v.size()),
- false, ios, err, ex);
- assert(base(iter) == v.data() + 13);
- assert(err == std::ios_base::goodbit);
- assert(ex == 123456789);
+ std::wstring v = convert_thousands_sep(L"1" THOUSANDS_SEP "234" THOUSANDS_SEP "567,89 EUR -");
+ typedef cpp17_input_iterator<const wchar_t*> I;
+ long double ex;
+ std::ios_base::iostate err = std::ios_base::goodbit;
+ I iter = f.get(I(v.data()), I(v.data() + v.size()), false, ios, err, ex);
+ assert(base(iter) == v.data() + 13);
+ assert(err == std::ios_base::goodbit);
+ assert(ex == 123456789);
}
}
{
@@ -598,26 +596,24 @@ int main(int, char**)
assert(ex == -1);
}
{ // positive
- std::wstring v = convert_thousands_sep(L"1 234 567,89 ");
- typedef cpp17_input_iterator<const wchar_t*> I;
- long double ex;
- std::ios_base::iostate err = std::ios_base::goodbit;
- I iter = f.get(I(v.data()), I(v.data() + v.size()),
- true, ios, err, ex);
- assert(base(iter) == v.data() + v.size());
- assert(err == std::ios_base::eofbit);
- assert(ex == 123456789);
+ std::wstring v = convert_thousands_sep(L"1" THOUSANDS_SEP "234" THOUSANDS_SEP "567,89 ");
+ typedef cpp17_input_iterator<const wchar_t*> I;
+ long double ex;
+ std::ios_base::iostate err = std::ios_base::goodbit;
+ I iter = f.get(I(v.data()), I(v.data() + v.size()), true, ios, err, ex);
+ assert(base(iter) == v.data() + v.size());
+ assert(err == std::ios_base::eofbit);
+ assert(ex == 123456789);
}
{ // negative
- std::wstring v = convert_thousands_sep(L"-1 234 567,89");
- typedef cpp17_input_iterator<const wchar_t*> I;
- long double ex;
- std::ios_base::iostate err = std::ios_base::goodbit;
- I iter = f.get(I(v.data()), I(v.data() + v.size()),
- true, ios, err, ex);
- assert(base(iter) == v.data() + v.size());
- assert(err == std::ios_base::eofbit);
- assert(ex == -123456789);
+ std::wstring v = convert_thousands_sep(L"-1" THOUSANDS_SEP "234" THOUSANDS_SEP "567,89");
+ typedef cpp17_input_iterator<const wchar_t*> I;
+ long double ex;
+ std::ios_base::iostate err = std::ios_base::goodbit;
+ I iter = f.get(I(v.data()), I(v.data() + v.size()), true, ios, err, ex);
+ assert(base(iter) == v.data() + v.size());
+ assert(err == std::ios_base::eofbit);
+ assert(ex == -123456789);
}
{ // negative
std::wstring v = L"-1234567,89";
@@ -678,64 +674,59 @@ int main(int, char**)
assert(ex == -1);
}
{ // positive, showbase
- std::wstring v = convert_thousands_sep(L"1 234 567,89 EUR");
- typedef cpp17_input_iterator<const wchar_t*> I;
- long double ex;
- std::ios_base::iostate err = std::ios_base::goodbit;
- I iter = f.get(I(v.data()), I(v.data() + v.size()),
- true, ios, err, ex);
- assert(base(iter) == v.data() + v.size());
- assert(err == std::ios_base::eofbit);
- assert(ex == 123456789);
+ std::wstring v = convert_thousands_sep(L"1" THOUSANDS_SEP "234" THOUSANDS_SEP "567,89 EUR");
+ typedef cpp17_input_iterator<const wchar_t*> I;
+ long double ex;
+ std::ios_base::iostate err = std::ios_base::goodbit;
+ I iter = f.get(I(v.data()), I(v.data() + v.size()), true, ios, err, ex);
+ assert(base(iter) == v.data() + v.size());
+ assert(err == std::ios_base::eofbit);
+ assert(ex == 123456789);
}
{ // positive, showbase
- std::wstring v = convert_thousands_sep(L"1 234 567,89 EUR");
- std::showbase(ios);
- typedef cpp17_input_iterator<const wchar_t*> I;
- long double ex;
- std::ios_base::iostate err = std::ios_base::goodbit;
- I iter = f.get(I(v.data()), I(v.data() + v.size()),
- true, ios, err, ex);
- assert(base(iter) == v.data() + v.size());
- assert(err == std::ios_base::eofbit);
- assert(ex == 123456789);
- std::noshowbase(ios);
+ std::wstring v = convert_thousands_sep(L"1" THOUSANDS_SEP "234" THOUSANDS_SEP "567,89 EUR");
+ std::showbase(ios);
+ typedef cpp17_input_iterator<const wchar_t*> I;
+ long double ex;
+ std::ios_base::iostate err = std::ios_base::goodbit;
+ I iter = f.get(I(v.data()), I(v.data() + v.size()), true, ios, err, ex);
+ assert(base(iter) == v.data() + v.size());
+ assert(err == std::ios_base::eofbit);
+ assert(ex == 123456789);
+ std::noshowbase(ios);
}
{ // negative, showbase
- std::wstring v = convert_thousands_sep(L"-1 234 567,89 EUR");
- std::showbase(ios);
- typedef cpp17_input_iterator<const wchar_t*> I;
- long double ex;
- std::ios_base::iostate err = std::ios_base::goodbit;
- I iter = f.get(I(v.data()), I(v.data() + v.size()),
- true, ios, err, ex);
- assert(base(iter) == v.data() + v.size());
- assert(err == std::ios_base::eofbit);
- assert(ex == -123456789);
- std::noshowbase(ios);
+ std::wstring v = convert_thousands_sep(L"-1" THOUSANDS_SEP "234" THOUSANDS_SEP "567,89 EUR");
+ std::showbase(ios);
+ typedef cpp17_input_iterator<const wchar_t*> I;
+ long double ex;
+ std::ios_base::iostate err = std::ios_base::goodbit;
+ I iter = f.get(I(v.data()), I(v.data() + v.size()), true, ios, err, ex);
+ assert(base(iter) == v.data() + v.size());
+ assert(err == std::ios_base::eofbit);
+ assert(ex == -123456789);
+ std::noshowbase(ios);
}
{ // negative, showbase
- std::wstring v = convert_thousands_sep(L"1 234 567,89 Eu-");
- std::showbase(ios);
- typedef cpp17_input_iterator<const wchar_t*> I;
- long double ex;
- std::ios_base::iostate err = std::ios_base::goodbit;
- I iter = f.get(I(v.data()), I(v.data() + v.size()),
- true, ios, err, ex);
- assert(base(iter) == v.data() + 14);
- assert(err == std::ios_base::failbit);
- std::noshowbase(ios);
+ std::wstring v = convert_thousands_sep(L"1" THOUSANDS_SEP "234" THOUSANDS_SEP "567,89 Eu-");
+ std::showbase(ios);
+ typedef cpp17_input_iterator<const wchar_t*> I;
+ long double ex;
+ std::ios_base::iostate err = std::ios_base::goodbit;
+ I iter = f.get(I(v.data()), I(v.data() + v.size()), true, ios, err, ex);
+ assert(base(iter) == v.data() + 14);
+ assert(err == std::ios_base::failbit);
+ std::noshowbase(ios);
}
{ // negative, showbase
- std::wstring v = convert_thousands_sep(L"1 234 567,89 Eu-");
- typedef cpp17_input_iterator<const wchar_t*> I;
- long double ex;
- std::ios_base::iostate err = std::ios_base::goodbit;
- I iter = f.get(I(v.data()), I(v.data() + v.size()),
- true, ios, err, ex);
- assert(base(iter) == v.data() + 13);
- assert(err == std::ios_base::goodbit);
- assert(ex == 123456789);
+ std::wstring v = convert_thousands_sep(L"1" THOUSANDS_SEP "234" THOUSANDS_SEP "567,89 Eu-");
+ typedef cpp17_input_iterator<const wchar_t*> I;
+ long double ex;
+ std::ios_base::iostate err = std::ios_base::goodbit;
+ I iter = f.get(I(v.data()), I(v.data() + v.size()), true, ios, err, ex);
+ assert(base(iter) == v.data() + 13);
+ assert(err == std::ios_base::goodbit);
+ assert(ex == 123456789);
}
}
#endif // TEST_HAS_NO_WIDE_CHARACTERS
diff --git a/libcxx/test/std/localization/locale.categories/category.monetary/locale.money.get/locale.money.get.members/get_long_double_zh_CN.pass.cpp b/libcxx/test/std/localization/locale.categories/category.monetary/locale.money.get/locale.money.get.members/get_long_double_zh_CN.pass.cpp
index 4cdb25728af7..05c09b26969f 100644
--- a/libcxx/test/std/localization/locale.categories/category.monetary/locale.money.get/locale.money.get.members/get_long_double_zh_CN.pass.cpp
+++ b/libcxx/test/std/localization/locale.categories/category.monetary/locale.money.get/locale.money.get.members/get_long_double_zh_CN.pass.cpp
@@ -9,7 +9,6 @@
// NetBSD does not support LC_MONETARY at the moment
// XFAIL: netbsd
-// XFAIL: LIBCXX-AIX-FIXME
// XFAIL: LIBCXX-FREEBSD-FIXME
// REQUIRES: locale.zh_CN.UTF-8
@@ -156,28 +155,34 @@ int main(int, char**)
std::noshowbase(ios);
}
{ // negative one, showbase
- std::string v = currency_symbol + "-0.01";
- typedef cpp17_input_iterator<const char*> I;
- long double ex;
- std::ios_base::iostate err = std::ios_base::goodbit;
- I iter = f.get(I(v.data()), I(v.data() + v.size()),
- false, ios, err, ex);
- assert(base(iter) == v.data() + v.size());
- assert(err == std::ios_base::eofbit);
- assert(ex == -1);
+#ifdef _AIX
+ std::string v = "-" + currency_symbol + "0.01";
+#else
+ std::string v = currency_symbol + "-0.01";
+#endif
+ typedef cpp17_input_iterator<const char*> I;
+ long double ex;
+ std::ios_base::iostate err = std::ios_base::goodbit;
+ I iter = f.get(I(v.data()), I(v.data() + v.size()), false, ios, err, ex);
+ assert(base(iter) == v.data() + v.size());
+ assert(err == std::ios_base::eofbit);
+ assert(ex == -1);
}
{ // negative one, showbase
- std::string v = currency_symbol + "-0.01";
- std::showbase(ios);
- typedef cpp17_input_iterator<const char*> I;
- long double ex;
- std::ios_base::iostate err = std::ios_base::goodbit;
- I iter = f.get(I(v.data()), I(v.data() + v.size()),
- false, ios, err, ex);
- assert(base(iter) == v.data() + v.size());
- assert(err == std::ios_base::eofbit);
- assert(ex == -1);
- std::noshowbase(ios);
+#ifdef _AIX
+ std::string v = "-" + currency_symbol + "0.01";
+#else
+ std::string v = currency_symbol + "-0.01";
+#endif
+ std::showbase(ios);
+ typedef cpp17_input_iterator<const char*> I;
+ long double ex;
+ std::ios_base::iostate err = std::ios_base::goodbit;
+ I iter = f.get(I(v.data()), I(v.data() + v.size()), false, ios, err, ex);
+ assert(base(iter) == v.data() + v.size());
+ assert(err == std::ios_base::eofbit);
+ assert(ex == -1);
+ std::noshowbase(ios);
}
{ // positive, showbase
std::string v = currency_symbol + "1,234,567.89";
@@ -204,17 +209,20 @@ int main(int, char**)
std::noshowbase(ios);
}
{ // negative, showbase
- std::string v = currency_symbol + "-1,234,567.89";
- std::showbase(ios);
- typedef cpp17_input_iterator<const char*> I;
- long double ex;
- std::ios_base::iostate err = std::ios_base::goodbit;
- I iter = f.get(I(v.data()), I(v.data() + v.size()),
- false, ios, err, ex);
- assert(base(iter) == v.data() + v.size());
- assert(err == std::ios_base::eofbit);
- assert(ex == -123456789);
- std::noshowbase(ios);
+#ifdef _AIX
+ std::string v = "-" + currency_symbol + "1,234,567.89";
+#else
+ std::string v = currency_symbol + "-1,234,567.89";
+#endif
+ std::showbase(ios);
+ typedef cpp17_input_iterator<const char*> I;
+ long double ex;
+ std::ios_base::iostate err = std::ios_base::goodbit;
+ I iter = f.get(I(v.data()), I(v.data() + v.size()), false, ios, err, ex);
+ assert(base(iter) == v.data() + v.size());
+ assert(err == std::ios_base::eofbit);
+ assert(ex == -123456789);
+ std::noshowbase(ios);
}
{ // negative, showbase
std::string v = "CNY -1,234,567.89";
@@ -322,8 +330,8 @@ int main(int, char**)
std::noshowbase(ios);
}
{ // negative one, showbase
-#ifdef TEST_HAS_GLIBC
- std::string v = "-" + currency_name + "0.01";
+#if defined(TEST_HAS_GLIBC) || defined(_AIX)
+ std::string v = "-" + currency_name + "0.01";
#else
std::string v = currency_name + "-0.01";
#endif
@@ -337,8 +345,8 @@ int main(int, char**)
assert(ex == -1);
}
{ // negative one, showbase
-#ifdef TEST_HAS_GLIBC
- std::string v = "-" + currency_name + "0.01";
+#if defined(TEST_HAS_GLIBC) || defined(_AIX)
+ std::string v = "-" + currency_name + "0.01";
#else
std::string v = currency_name + "-0.01";
#endif
@@ -378,8 +386,8 @@ int main(int, char**)
std::noshowbase(ios);
}
{ // negative, showbase
-#ifdef TEST_HAS_GLIBC
- std::string v = "-" + currency_name + "1,234,567.89";
+#if defined(TEST_HAS_GLIBC) || defined(_AIX)
+ std::string v = "-" + currency_name + "1,234,567.89";
#else
std::string v = currency_name + "-1,234,567.89";
#endif
@@ -507,28 +515,34 @@ int main(int, char**)
std::noshowbase(ios);
}
{ // negative one, showbase
- std::wstring v = w_currency_symbol + L"-0.01";
- typedef cpp17_input_iterator<const wchar_t*> I;
- long double ex;
- std::ios_base::iostate err = std::ios_base::goodbit;
- I iter = f.get(I(v.data()), I(v.data() + v.size()),
- false, ios, err, ex);
- assert(base(iter) == v.data() + v.size());
- assert(err == std::ios_base::eofbit);
- assert(ex == -1);
+# ifdef _AIX
+ std::wstring v = L"-" + w_currency_symbol + L"0.01";
+# else
+ std::wstring v = w_currency_symbol + L"-0.01";
+# endif
+ typedef cpp17_input_iterator<const wchar_t*> I;
+ long double ex;
+ std::ios_base::iostate err = std::ios_base::goodbit;
+ I iter = f.get(I(v.data()), I(v.data() + v.size()), false, ios, err, ex);
+ assert(base(iter) == v.data() + v.size());
+ assert(err == std::ios_base::eofbit);
+ assert(ex == -1);
}
{ // negative one, showbase
- std::wstring v = w_currency_symbol + L"-0.01";
- std::showbase(ios);
- typedef cpp17_input_iterator<const wchar_t*> I;
- long double ex;
- std::ios_base::iostate err = std::ios_base::goodbit;
- I iter = f.get(I(v.data()), I(v.data() + v.size()),
- false, ios, err, ex);
- assert(base(iter) == v.data() + v.size());
- assert(err == std::ios_base::eofbit);
- assert(ex == -1);
- std::noshowbase(ios);
+# ifdef _AIX
+ std::wstring v = L"-" + w_currency_symbol + L"0.01";
+# else
+ std::wstring v = w_currency_symbol + L"-0.01";
+# endif
+ std::showbase(ios);
+ typedef cpp17_input_iterator<const wchar_t*> I;
+ long double ex;
+ std::ios_base::iostate err = std::ios_base::goodbit;
+ I iter = f.get(I(v.data()), I(v.data() + v.size()), false, ios, err, ex);
+ assert(base(iter) == v.data() + v.size());
+ assert(err == std::ios_base::eofbit);
+ assert(ex == -1);
+ std::noshowbase(ios);
}
{ // positive, showbase
std::wstring v = w_currency_symbol + L"1,234,567.89";
@@ -555,17 +569,20 @@ int main(int, char**)
std::noshowbase(ios);
}
{ // negative, showbase
- std::wstring v = w_currency_symbol + L"-1,234,567.89";
- std::showbase(ios);
- typedef cpp17_input_iterator<const wchar_t*> I;
- long double ex;
- std::ios_base::iostate err = std::ios_base::goodbit;
- I iter = f.get(I(v.data()), I(v.data() + v.size()),
- false, ios, err, ex);
- assert(base(iter) == v.data() + v.size());
- assert(err == std::ios_base::eofbit);
- assert(ex == -123456789);
- std::noshowbase(ios);
+# ifdef _AIX
+ std::wstring v = L"-" + w_currency_symbol + L"1,234,567.89";
+# else
+ std::wstring v = w_currency_symbol + L"-1,234,567.89";
+# endif
+ std::showbase(ios);
+ typedef cpp17_input_iterator<const wchar_t*> I;
+ long double ex;
+ std::ios_base::iostate err = std::ios_base::goodbit;
+ I iter = f.get(I(v.data()), I(v.data() + v.size()), false, ios, err, ex);
+ assert(base(iter) == v.data() + v.size());
+ assert(err == std::ios_base::eofbit);
+ assert(ex == -123456789);
+ std::noshowbase(ios);
}
{ // negative, showbase
std::wstring v = L"CNY -1,234,567.89";
@@ -673,36 +690,34 @@ int main(int, char**)
std::noshowbase(ios);
}
{ // negative one, showbase
-#ifdef TEST_HAS_GLIBC
- std::wstring v = L"-" + w_currency_name + L"0.01";
-#else
- std::wstring v = w_currency_name + L"-0.01";
-#endif
- typedef cpp17_input_iterator<const wchar_t*> I;
- long double ex;
- std::ios_base::iostate err = std::ios_base::goodbit;
- I iter = f.get(I(v.data()), I(v.data() + v.size()),
- true, ios, err, ex);
- assert(base(iter) == v.data() + v.size());
- assert(err == std::ios_base::eofbit);
- assert(ex == -1);
+# if defined(TEST_HAS_GLIBC) || defined(_AIX)
+ std::wstring v = L"-" + w_currency_name + L"0.01";
+# else
+ std::wstring v = w_currency_name + L"-0.01";
+# endif
+ typedef cpp17_input_iterator<const wchar_t*> I;
+ long double ex;
+ std::ios_base::iostate err = std::ios_base::goodbit;
+ I iter = f.get(I(v.data()), I(v.data() + v.size()), true, ios, err, ex);
+ assert(base(iter) == v.data() + v.size());
+ assert(err == std::ios_base::eofbit);
+ assert(ex == -1);
}
{ // negative one, showbase
-#ifdef TEST_HAS_GLIBC
- std::wstring v = L"-" + w_currency_name + L"0.01";
-#else
- std::wstring v = w_currency_name + L"-0.01";
-#endif
- std::showbase(ios);
- typedef cpp17_input_iterator<const wchar_t*> I;
- long double ex;
- std::ios_base::iostate err = std::ios_base::goodbit;
- I iter = f.get(I(v.data()), I(v.data() + v.size()),
- true, ios, err, ex);
- assert(base(iter) == v.data() + v.size());
- assert(err == std::ios_base::eofbit);
- assert(ex == -1);
- std::noshowbase(ios);
+# if defined(TEST_HAS_GLIBC) || defined(_AIX)
+ std::wstring v = L"-" + w_currency_name + L"0.01";
+# else
+ std::wstring v = w_currency_name + L"-0.01";
+# endif
+ std::showbase(ios);
+ typedef cpp17_input_iterator<const wchar_t*> I;
+ long double ex;
+ std::ios_base::iostate err = std::ios_base::goodbit;
+ I iter = f.get(I(v.data()), I(v.data() + v.size()), true, ios, err, ex);
+ assert(base(iter) == v.data() + v.size());
+ assert(err == std::ios_base::eofbit);
+ assert(ex == -1);
+ std::noshowbase(ios);
}
{ // positive, showbase
std::wstring v = w_currency_name + L"1,234,567.89";
@@ -729,21 +744,20 @@ int main(int, char**)
std::noshowbase(ios);
}
{ // negative, showbase
-#ifdef TEST_HAS_GLIBC
- std::wstring v = L"-" + w_currency_name + L"1,234,567.89";
-#else
- std::wstring v = w_currency_name + L"-1,234,567.89";
-#endif
- std::showbase(ios);
- typedef cpp17_input_iterator<const wchar_t*> I;
- long double ex;
- std::ios_base::iostate err = std::ios_base::goodbit;
- I iter = f.get(I(v.data()), I(v.data() + v.size()),
- true, ios, err, ex);
- assert(base(iter) == v.data() + v.size());
- assert(err == std::ios_base::eofbit);
- assert(ex == -123456789);
- std::noshowbase(ios);
+# if defined(TEST_HAS_GLIBC) || defined(_AIX)
+ std::wstring v = L"-" + w_currency_name + L"1,234,567.89";
+# else
+ std::wstring v = w_currency_name + L"-1,234,567.89";
+# endif
+ std::showbase(ios);
+ typedef cpp17_input_iterator<const wchar_t*> I;
+ long double ex;
+ std::ios_base::iostate err = std::ios_base::goodbit;
+ I iter = f.get(I(v.data()), I(v.data() + v.size()), true, ios, err, ex);
+ assert(base(iter) == v.data() + v.size());
+ assert(err == std::ios_base::eofbit);
+ assert(ex == -123456789);
+ std::noshowbase(ios);
}
{ // negative, showbase
std::wstring v = w_currency_symbol + L"-1,234,567.89";
diff --git a/libcxx/test/std/localization/locale.categories/category.monetary/locale.money.put/locale.money.put.members/put_long_double_fr_FR.pass.cpp b/libcxx/test/std/localization/locale.categories/category.monetary/locale.money.put/locale.money.put.members/put_long_double_fr_FR.pass.cpp
index 05b4ee474944..47a48deb3368 100644
--- a/libcxx/test/std/localization/locale.categories/category.monetary/locale.money.put/locale.money.put.members/put_long_double_fr_FR.pass.cpp
+++ b/libcxx/test/std/localization/locale.categories/category.monetary/locale.money.put/locale.money.put.members/put_long_double_fr_FR.pass.cpp
@@ -11,8 +11,6 @@
// NetBSD does not support LC_MONETARY at the moment
// XFAIL: netbsd
-// XFAIL: LIBCXX-AIX-FIXME
-
// REQUIRES: locale.fr_FR.UTF-8
// <locale>
@@ -32,6 +30,13 @@
#include "platform_support.h" // locale name macros
#include "test_macros.h"
+#ifdef _AIX
+// the AIX libc expects U202F as LC_MONETARY thousands_sep
+# define THOUSANDS_SEP L"\u202F"
+#else
+# define THOUSANDS_SEP L" "
+#endif
+
typedef std::money_put<char, cpp17_output_iterator<char*> > Fn;
class my_facet
@@ -291,14 +296,14 @@ int main(int, char**)
wchar_t str[100];
cpp17_output_iterator<wchar_t*> iter = f.put(cpp17_output_iterator<wchar_t*>(str), false, ios, '*', v);
std::wstring ex(str, base(iter));
- assert(ex == convert_thousands_sep(L"1 234 567,89"));
+ assert(ex == convert_thousands_sep(L"1" THOUSANDS_SEP "234" THOUSANDS_SEP "567,89"));
}
{ // negative
long double v = -123456789;
wchar_t str[100];
cpp17_output_iterator<wchar_t*> iter = f.put(cpp17_output_iterator<wchar_t*>(str), false, ios, '*', v);
std::wstring ex(str, base(iter));
- assert(ex == convert_thousands_sep(L"-1 234 567,89"));
+ assert(ex == convert_thousands_sep(L"-1" THOUSANDS_SEP "234" THOUSANDS_SEP "567,89"));
}
{ // zero, showbase
long double v = 0;
@@ -322,7 +327,7 @@ int main(int, char**)
wchar_t str[100];
cpp17_output_iterator<wchar_t*> iter = f.put(cpp17_output_iterator<wchar_t*>(str), false, ios, '*', v);
std::wstring ex(str, base(iter));
- assert(ex == convert_thousands_sep(L"1 234 567,89 \u20ac"));
+ assert(ex == convert_thousands_sep(L"1" THOUSANDS_SEP "234" THOUSANDS_SEP "567,89 \u20ac"));
}
{ // negative, showbase
long double v = -123456789;
@@ -330,7 +335,7 @@ int main(int, char**)
wchar_t str[100];
cpp17_output_iterator<wchar_t*> iter = f.put(cpp17_output_iterator<wchar_t*>(str), false, ios, '*', v);
std::wstring ex(str, base(iter));
- assert(ex == convert_thousands_sep(L"-1 234 567,89 \u20ac"));
+ assert(ex == convert_thousands_sep(L"-1" THOUSANDS_SEP "234" THOUSANDS_SEP "567,89 \u20ac"));
}
{ // negative, showbase, left
long double v = -123456789;
@@ -340,7 +345,7 @@ int main(int, char**)
wchar_t str[100];
cpp17_output_iterator<wchar_t*> iter = f.put(cpp17_output_iterator<wchar_t*>(str), false, ios, ' ', v);
std::wstring ex(str, base(iter));
- assert(ex == convert_thousands_sep(L"-1 234 567,89 \u20ac "));
+ assert(ex == convert_thousands_sep(L"-1" THOUSANDS_SEP "234" THOUSANDS_SEP "567,89 \u20ac "));
assert(ios.width() == 0);
}
{ // negative, showbase, internal
@@ -351,7 +356,7 @@ int main(int, char**)
wchar_t str[100];
cpp17_output_iterator<wchar_t*> iter = f.put(cpp17_output_iterator<wchar_t*>(str), false, ios, ' ', v);
std::wstring ex(str, base(iter));
- assert(ex == convert_thousands_sep(L"-1 234 567,89 \u20ac"));
+ assert(ex == convert_thousands_sep(L"-1" THOUSANDS_SEP "234" THOUSANDS_SEP "567,89 \u20ac"));
assert(ios.width() == 0);
}
{ // negative, showbase, right
@@ -362,7 +367,7 @@ int main(int, char**)
wchar_t str[100];
cpp17_output_iterator<wchar_t*> iter = f.put(cpp17_output_iterator<wchar_t*>(str), false, ios, ' ', v);
std::wstring ex(str, base(iter));
- assert(ex == convert_thousands_sep(L" -1 234 567,89 \u20ac"));
+ assert(ex == convert_thousands_sep(L" -1" THOUSANDS_SEP "234" THOUSANDS_SEP "567,89 \u20ac"));
assert(ios.width() == 0);
}
@@ -388,14 +393,14 @@ int main(int, char**)
wchar_t str[100];
cpp17_output_iterator<wchar_t*> iter = f.put(cpp17_output_iterator<wchar_t*>(str), true, ios, '*', v);
std::wstring ex(str, base(iter));
- assert(ex == convert_thousands_sep(L"1 234 567,89"));
+ assert(ex == convert_thousands_sep(L"1" THOUSANDS_SEP "234" THOUSANDS_SEP "567,89"));
}
{ // negative
long double v = -123456789;
wchar_t str[100];
cpp17_output_iterator<wchar_t*> iter = f.put(cpp17_output_iterator<wchar_t*>(str), true, ios, '*', v);
std::wstring ex(str, base(iter));
- assert(ex == convert_thousands_sep(L"-1 234 567,89"));
+ assert(ex == convert_thousands_sep(L"-1" THOUSANDS_SEP "234" THOUSANDS_SEP "567,89"));
}
{ // zero, showbase
long double v = 0;
@@ -419,7 +424,7 @@ int main(int, char**)
wchar_t str[100];
cpp17_output_iterator<wchar_t*> iter = f.put(cpp17_output_iterator<wchar_t*>(str), true, ios, '*', v);
std::wstring ex(str, base(iter));
- assert(ex == convert_thousands_sep(L"1 234 567,89 EUR"));
+ assert(ex == convert_thousands_sep(L"1" THOUSANDS_SEP "234" THOUSANDS_SEP "567,89 EUR"));
}
{ // negative, showbase
long double v = -123456789;
@@ -427,7 +432,7 @@ int main(int, char**)
wchar_t str[100];
cpp17_output_iterator<wchar_t*> iter = f.put(cpp17_output_iterator<wchar_t*>(str), true, ios, '*', v);
std::wstring ex(str, base(iter));
- assert(ex == convert_thousands_sep(L"-1 234 567,89 EUR"));
+ assert(ex == convert_thousands_sep(L"-1" THOUSANDS_SEP "234" THOUSANDS_SEP "567,89 EUR"));
}
{ // negative, showbase, left
long double v = -123456789;
@@ -437,7 +442,7 @@ int main(int, char**)
wchar_t str[100];
cpp17_output_iterator<wchar_t*> iter = f.put(cpp17_output_iterator<wchar_t*>(str), true, ios, ' ', v);
std::wstring ex(str, base(iter));
- assert(ex == convert_thousands_sep(L"-1 234 567,89 EUR "));
+ assert(ex == convert_thousands_sep(L"-1" THOUSANDS_SEP "234" THOUSANDS_SEP "567,89 EUR "));
assert(ios.width() == 0);
}
{ // negative, showbase, internal
@@ -448,7 +453,7 @@ int main(int, char**)
wchar_t str[100];
cpp17_output_iterator<wchar_t*> iter = f.put(cpp17_output_iterator<wchar_t*>(str), true, ios, ' ', v);
std::wstring ex(str, base(iter));
- assert(ex == convert_thousands_sep(L"-1 234 567,89 EUR"));
+ assert(ex == convert_thousands_sep(L"-1" THOUSANDS_SEP "234" THOUSANDS_SEP "567,89 EUR"));
assert(ios.width() == 0);
}
{ // negative, showbase, right
@@ -459,7 +464,7 @@ int main(int, char**)
wchar_t str[100];
cpp17_output_iterator<wchar_t*> iter = f.put(cpp17_output_iterator<wchar_t*>(str), true, ios, ' ', v);
std::wstring ex(str, base(iter));
- assert(ex == convert_thousands_sep(L" -1 234 567,89 EUR"));
+ assert(ex == convert_thousands_sep(L" -1" THOUSANDS_SEP "234" THOUSANDS_SEP "567,89 EUR"));
assert(ios.width() == 0);
}
}
diff --git a/libcxx/test/std/localization/locale.categories/category.monetary/locale.money.put/locale.money.put.members/put_long_double_zh_CN.pass.cpp b/libcxx/test/std/localization/locale.categories/category.monetary/locale.money.put/locale.money.put.members/put_long_double_zh_CN.pass.cpp
index 1aba05992a96..4d581032d564 100644
--- a/libcxx/test/std/localization/locale.categories/category.monetary/locale.money.put/locale.money.put.members/put_long_double_zh_CN.pass.cpp
+++ b/libcxx/test/std/localization/locale.categories/category.monetary/locale.money.put/locale.money.put.members/put_long_double_zh_CN.pass.cpp
@@ -9,7 +9,6 @@
// NetBSD does not support LC_MONETARY at the moment
// XFAIL: netbsd
-// XFAIL: LIBCXX-AIX-FIXME
// XFAIL: LIBCXX-FREEBSD-FIXME
// REQUIRES: locale.zh_CN.UTF-8
@@ -120,7 +119,11 @@ int main(int, char**)
char str[100];
cpp17_output_iterator<char*> iter = f.put(cpp17_output_iterator<char*>(str), false, ios, '*', v);
std::string ex(str, base(iter));
+#ifdef _AIX
+ assert(ex == "-" + currency_symbol + "0.01");
+#else
assert(ex == currency_symbol + "-0.01");
+#endif
}
{ // positive, showbase
long double v = 123456789;
@@ -136,7 +139,11 @@ int main(int, char**)
char str[100];
cpp17_output_iterator<char*> iter = f.put(cpp17_output_iterator<char*>(str), false, ios, '*', v);
std::string ex(str, base(iter));
+#ifdef _AIX
+ assert(ex == "-" + currency_symbol + "1,234,567.89");
+#else
assert(ex == currency_symbol + "-1,234,567.89");
+#endif
}
{ // negative, showbase, left
long double v = -123456789;
@@ -146,7 +153,11 @@ int main(int, char**)
char str[100];
cpp17_output_iterator<char*> iter = f.put(cpp17_output_iterator<char*>(str), false, ios, ' ', v);
std::string ex(str, base(iter));
+#ifdef _AIX
+ assert(ex == "-" + currency_symbol + "1,234,567.89" + currency_symbol_padding);
+#else
assert(ex == currency_symbol + "-1,234,567.89" + currency_symbol_padding);
+#endif
assert(ios.width() == 0);
}
{ // negative, showbase, internal
@@ -157,7 +168,11 @@ int main(int, char**)
char str[100];
cpp17_output_iterator<char*> iter = f.put(cpp17_output_iterator<char*>(str), false, ios, ' ', v);
std::string ex(str, base(iter));
+#ifdef _AIX
+ assert(ex == "-" + currency_symbol + currency_symbol_padding + "1,234,567.89");
+#else
assert(ex == currency_symbol + "-" + currency_symbol_padding + "1,234,567.89");
+#endif
assert(ios.width() == 0);
}
{ // negative, showbase, right
@@ -168,7 +183,11 @@ int main(int, char**)
char str[100];
cpp17_output_iterator<char*> iter = f.put(cpp17_output_iterator<char*>(str), false, ios, ' ', v);
std::string ex(str, base(iter));
+#ifdef _AIX
+ assert(ex == currency_symbol_padding + "-" + currency_symbol + "1,234,567.89");
+#else
assert(ex == currency_symbol_padding + currency_symbol + "-1,234,567.89");
+#endif
assert(ios.width() == 0);
}
@@ -217,7 +236,7 @@ int main(int, char**)
char str[100];
cpp17_output_iterator<char*> iter = f.put(cpp17_output_iterator<char*>(str), true, ios, '*', v);
std::string ex(str, base(iter));
-#ifdef TEST_HAS_GLIBC
+#if defined(TEST_HAS_GLIBC) || defined(_AIX)
assert(ex == "-" + currency_name + "0.01");
#else
assert(ex == currency_name + "-0.01");
@@ -237,7 +256,7 @@ int main(int, char**)
char str[100];
cpp17_output_iterator<char*> iter = f.put(cpp17_output_iterator<char*>(str), true, ios, '*', v);
std::string ex(str, base(iter));
-#ifdef TEST_HAS_GLIBC
+#if defined(TEST_HAS_GLIBC) || defined(_AIX)
assert(ex == "-" + currency_name + "1,234,567.89");
#else
assert(ex == currency_name + "-1,234,567.89");
@@ -251,7 +270,7 @@ int main(int, char**)
char str[100];
cpp17_output_iterator<char*> iter = f.put(cpp17_output_iterator<char*>(str), true, ios, ' ', v);
std::string ex(str, base(iter));
-#ifdef TEST_HAS_GLIBC
+#if defined(TEST_HAS_GLIBC) || defined(_AIX)
assert(ex == "-" + currency_name + "1,234,567.89" + currency_name_padding);
#else
assert(ex == currency_name + "-1,234,567.89" + currency_name_padding);
@@ -266,7 +285,7 @@ int main(int, char**)
char str[100];
cpp17_output_iterator<char*> iter = f.put(cpp17_output_iterator<char*>(str), true, ios, ' ', v);
std::string ex(str, base(iter));
-#ifdef TEST_HAS_GLIBC
+#if defined(TEST_HAS_GLIBC) || defined(_AIX)
assert(ex == "-" + currency_name + currency_name_padding + "1,234,567.89");
#else
assert(ex == currency_name + "-" + currency_name_padding + "1,234,567.89");
@@ -281,7 +300,7 @@ int main(int, char**)
char str[100];
cpp17_output_iterator<char*> iter = f.put(cpp17_output_iterator<char*>(str), true, ios, ' ', v);
std::string ex(str, base(iter));
-#ifdef TEST_HAS_GLIBC
+#if defined(TEST_HAS_GLIBC) || defined(_AIX)
assert(ex == currency_name_padding + "-" + currency_name + "1,234,567.89");
#else
assert(ex == currency_name_padding + currency_name + "-1,234,567.89");
@@ -344,7 +363,11 @@ int main(int, char**)
wchar_t str[100];
cpp17_output_iterator<wchar_t*> iter = f.put(cpp17_output_iterator<wchar_t*>(str), false, ios, '*', v);
std::wstring ex(str, base(iter));
+# ifdef _AIX
+ assert(ex == L"-" + currency_symbol + L"0.01");
+# else
assert(ex == currency_symbol + L"-0.01");
+# endif
}
{ // positive, showbase
long double v = 123456789;
@@ -360,7 +383,11 @@ int main(int, char**)
wchar_t str[100];
cpp17_output_iterator<wchar_t*> iter = f.put(cpp17_output_iterator<wchar_t*>(str), false, ios, '*', v);
std::wstring ex(str, base(iter));
+# ifdef _AIX
+ assert(ex == L"-" + currency_symbol + L"1,234,567.89");
+# else
assert(ex == currency_symbol + L"-1,234,567.89");
+# endif
}
{ // negative, showbase, left
long double v = -123456789;
@@ -370,7 +397,11 @@ int main(int, char**)
wchar_t str[100];
cpp17_output_iterator<wchar_t*> iter = f.put(cpp17_output_iterator<wchar_t*>(str), false, ios, ' ', v);
std::wstring ex(str, base(iter));
+# ifdef _AIX
+ assert(ex == L"-" + currency_symbol + L"1,234,567.89 ");
+# else
assert(ex == currency_symbol + L"-1,234,567.89 ");
+# endif
assert(ios.width() == 0);
}
{ // negative, showbase, internal
@@ -381,7 +412,11 @@ int main(int, char**)
wchar_t str[100];
cpp17_output_iterator<wchar_t*> iter = f.put(cpp17_output_iterator<wchar_t*>(str), false, ios, ' ', v);
std::wstring ex(str, base(iter));
+# ifdef _AIX
+ assert(ex == L"-" + currency_symbol + L" 1,234,567.89");
+# else
assert(ex == currency_symbol + L"- 1,234,567.89");
+# endif
assert(ios.width() == 0);
}
{ // negative, showbase, right
@@ -392,7 +427,11 @@ int main(int, char**)
wchar_t str[100];
cpp17_output_iterator<wchar_t*> iter = f.put(cpp17_output_iterator<wchar_t*>(str), false, ios, ' ', v);
std::wstring ex(str, base(iter));
+# ifdef _AIX
+ assert(ex == L" -" + currency_symbol + L"1,234,567.89");
+# else
assert(ex == L" " + currency_symbol + L"-1,234,567.89");
+# endif
assert(ios.width() == 0);
}
@@ -441,7 +480,7 @@ int main(int, char**)
wchar_t str[100];
cpp17_output_iterator<wchar_t*> iter = f.put(cpp17_output_iterator<wchar_t*>(str), true, ios, '*', v);
std::wstring ex(str, base(iter));
-#ifdef TEST_HAS_GLIBC
+# if defined(TEST_HAS_GLIBC) || defined(_AIX)
assert(ex == L"-" + currency_name + L"0.01");
#else
assert(ex == currency_name + L"-0.01");
@@ -461,7 +500,7 @@ int main(int, char**)
wchar_t str[100];
cpp17_output_iterator<wchar_t*> iter = f.put(cpp17_output_iterator<wchar_t*>(str), true, ios, '*', v);
std::wstring ex(str, base(iter));
-#ifdef TEST_HAS_GLIBC
+# if defined(TEST_HAS_GLIBC) || defined(_AIX)
assert(ex == L"-" + currency_name + L"1,234,567.89");
#else
assert(ex == currency_name + L"-1,234,567.89");
@@ -475,7 +514,7 @@ int main(int, char**)
wchar_t str[100];
cpp17_output_iterator<wchar_t*> iter = f.put(cpp17_output_iterator<wchar_t*>(str), true, ios, ' ', v);
std::wstring ex(str, base(iter));
-#ifdef TEST_HAS_GLIBC
+# if defined(TEST_HAS_GLIBC) || defined(_AIX)
assert(ex == L"-" + currency_name + L"1,234,567.89" + currency_name_padding);
#else
assert(ex == currency_name + L"-1,234,567.89" + currency_name_padding);
@@ -490,7 +529,7 @@ int main(int, char**)
wchar_t str[100];
cpp17_output_iterator<wchar_t*> iter = f.put(cpp17_output_iterator<wchar_t*>(str), true, ios, ' ', v);
std::wstring ex(str, base(iter));
-#ifdef TEST_HAS_GLIBC
+# if defined(TEST_HAS_GLIBC) || defined(_AIX)
assert(ex == L"-" + currency_name + currency_name_padding + L"1,234,567.89");
#else
assert(ex == currency_name + L"-" + currency_name_padding + L"1,234,567.89");
@@ -505,7 +544,7 @@ int main(int, char**)
wchar_t str[100];
cpp17_output_iterator<wchar_t*> iter = f.put(cpp17_output_iterator<wchar_t*>(str), true, ios, ' ', v);
std::wstring ex(str, base(iter));
-#ifdef TEST_HAS_GLIBC
+# if defined(TEST_HAS_GLIBC) || defined(_AIX)
assert(ex == currency_name_padding + L"-" + currency_name + L"1,234,567.89");
#else
assert(ex == currency_name_padding + currency_name + L"-1,234,567.89");
diff --git a/libcxx/test/std/localization/locale.categories/category.numeric/locale.num.get/facet.num.get.members/get_double.pass.cpp b/libcxx/test/std/localization/locale.categories/category.numeric/locale.num.get/facet.num.get.members/get_double.pass.cpp
index e093737986c1..1708e94b682c 100644
--- a/libcxx/test/std/localization/locale.categories/category.numeric/locale.num.get/facet.num.get.members/get_double.pass.cpp
+++ b/libcxx/test/std/localization/locale.categories/category.numeric/locale.num.get/facet.num.get.members/get_double.pass.cpp
@@ -6,11 +6,6 @@
//
//===----------------------------------------------------------------------===//
-// The fix for LWG2381 (https://github.com/llvm/llvm-project/pull/77948) changed
-// behavior of FP parsing, while Apple back-deployment targets remain broken due
-// to the dylib.
-// UNSUPPORTED: using-built-library-before-llvm-19
-
// <locale>
// class num_get<charT, InputIterator>
diff --git a/libcxx/test/std/localization/locale.categories/category.numeric/locale.num.get/facet.num.get.members/get_float.pass.cpp b/libcxx/test/std/localization/locale.categories/category.numeric/locale.num.get/facet.num.get.members/get_float.pass.cpp
index bc6cec45d89a..8268b5419eb3 100644
--- a/libcxx/test/std/localization/locale.categories/category.numeric/locale.num.get/facet.num.get.members/get_float.pass.cpp
+++ b/libcxx/test/std/localization/locale.categories/category.numeric/locale.num.get/facet.num.get.members/get_float.pass.cpp
@@ -6,11 +6,6 @@
//
//===----------------------------------------------------------------------===//
-// The fix for LWG2381 (https://github.com/llvm/llvm-project/pull/77948) changed
-// behavior of FP parsing, while Apple back-deployment targets remain broken due
-// to the dylib.
-// UNSUPPORTED: using-built-library-before-llvm-19
-
// <locale>
// class num_get<charT, InputIterator>
diff --git a/libcxx/test/std/localization/locale.categories/category.numeric/locale.num.get/facet.num.get.members/get_long.pass.cpp b/libcxx/test/std/localization/locale.categories/category.numeric/locale.num.get/facet.num.get.members/get_long.pass.cpp
index a18084867b2f..68c8789f92f2 100644
--- a/libcxx/test/std/localization/locale.categories/category.numeric/locale.num.get/facet.num.get.members/get_long.pass.cpp
+++ b/libcxx/test/std/localization/locale.categories/category.numeric/locale.num.get/facet.num.get.members/get_long.pass.cpp
@@ -15,7 +15,7 @@
// This test exercises the fix for PR28704, which isn't in the dylib for
// some systems.
-// XFAIL: stdlib=apple-libc++ && target={{.+}}-apple-macosx10.{{9|10|11|12|13|14}}
+// XFAIL: stdlib=system && target={{.+}}-apple-macosx10.{{9|10|11|12|13|14}}
#include <locale>
#include <ios>
diff --git a/libcxx/test/std/localization/locale.categories/category.numeric/locale.num.get/facet.num.get.members/get_long_double.pass.cpp b/libcxx/test/std/localization/locale.categories/category.numeric/locale.num.get/facet.num.get.members/get_long_double.pass.cpp
index f455981e8978..f3569ed6e5d8 100644
--- a/libcxx/test/std/localization/locale.categories/category.numeric/locale.num.get/facet.num.get.members/get_long_double.pass.cpp
+++ b/libcxx/test/std/localization/locale.categories/category.numeric/locale.num.get/facet.num.get.members/get_long_double.pass.cpp
@@ -6,11 +6,6 @@
//
//===----------------------------------------------------------------------===//
-// The fix for LWG2381 (https://github.com/llvm/llvm-project/pull/77948) changed
-// behavior of FP parsing, while Apple back-deployment targets remain broken due
-// to the dylib.
-// UNSUPPORTED: using-built-library-before-llvm-19
-
// <locale>
// class num_get<charT, InputIterator>
diff --git a/libcxx/test/std/localization/locales/locale/locale.cons/name_construction.pass.cpp b/libcxx/test/std/localization/locales/locale/locale.cons/name_construction.pass.cpp
index 471c66989f22..d7be7e0f95a5 100644
--- a/libcxx/test/std/localization/locales/locale/locale.cons/name_construction.pass.cpp
+++ b/libcxx/test/std/localization/locales/locale/locale.cons/name_construction.pass.cpp
@@ -18,7 +18,7 @@
// This test exercises the fix for locale name construction (D119441), which
// isn't in the dylib for some systems.
-// XFAIL: stdlib=apple-libc++ && target={{.+}}-apple-macosx{{10.9|10.10|10.11|10.12|10.13|10.14|10.15|11.0|12.0}}
+// XFAIL: stdlib=system && target={{.+}}-apple-macosx{{10.9|10.10|10.11|10.12|10.13|10.14|10.15|11.0|12.0}}
#include <locale>
#include <cassert>
diff --git a/libcxx/test/std/numerics/numeric.ops/numeric.ops.lcm/lcm.pass.cpp b/libcxx/test/std/numerics/numeric.ops/numeric.ops.lcm/lcm.pass.cpp
index 16bfbbef41c4..edd6d9fef0d7 100644
--- a/libcxx/test/std/numerics/numeric.ops/numeric.ops.lcm/lcm.pass.cpp
+++ b/libcxx/test/std/numerics/numeric.ops/numeric.ops.lcm/lcm.pass.cpp
@@ -16,6 +16,7 @@
#include <cassert>
#include <climits>
#include <cstdint>
+#include <limits>
#include <type_traits>
#include "test_macros.h"
@@ -89,6 +90,13 @@ constexpr bool do_test(int = 0)
return accumulate;
}
+template <class T>
+constexpr bool test_limits() {
+ assert(std::lcm(std::numeric_limits<T>::max() - 1, std::numeric_limits<T>::max() - 1) == std::numeric_limits<T>::max() - 1);
+ assert(std::lcm(std::numeric_limits<T>::max(), std::numeric_limits<T>::max()) == std::numeric_limits<T>::max());
+ return true;
+}
+
int main(int argc, char**)
{
int non_cce = argc; // a value that can't possibly be constexpr
@@ -141,5 +149,22 @@ int main(int argc, char**)
assert(res1 == 1324997410816LL);
}
- return 0;
+ // https://github.com/llvm/llvm-project/issues/96196
+ {
+ assert(test_limits<unsigned int>());
+ assert(test_limits<std::uint32_t>());
+ assert(test_limits<std::uint64_t>());
+ assert(test_limits<int>());
+ assert(test_limits<std::int32_t>());
+ assert(test_limits<std::int64_t>());
+
+ static_assert(test_limits<unsigned int>(), "");
+ static_assert(test_limits<std::uint32_t>(), "");
+ static_assert(test_limits<std::uint64_t>(), "");
+ static_assert(test_limits<int>(), "");
+ static_assert(test_limits<std::int32_t>(), "");
+ static_assert(test_limits<std::int64_t>(), "");
+ }
+
+ return 0;
}
diff --git a/libcxx/test/std/numerics/rand/rand.device/ctor.pass.cpp b/libcxx/test/std/numerics/rand/rand.device/ctor.pass.cpp
index 796ab41716dd..a9583be73af0 100644
--- a/libcxx/test/std/numerics/rand/rand.device/ctor.pass.cpp
+++ b/libcxx/test/std/numerics/rand/rand.device/ctor.pass.cpp
@@ -7,11 +7,11 @@
//===----------------------------------------------------------------------===//
// See https://llvm.org/PR20183
-// XFAIL: stdlib=apple-libc++ && target={{.+}}-apple-macosx10.{{9|10|11}}
+// XFAIL: stdlib=system && target={{.+}}-apple-macosx10.{{9|10|11}}
// The behavior of std::random_device changed on Apple platforms with
// https://llvm.org/D116045.
-// XFAIL: stdlib=apple-libc++ && target={{.+}}-apple-macosx{{10.9|10.10|10.11|10.12|10.13|10.14|10.15|11.0|12.0}}
+// XFAIL: stdlib=system && target={{.+}}-apple-macosx{{10.9|10.10|10.11|10.12|10.13|10.14|10.15|11.0|12.0}}
// UNSUPPORTED: no-random-device
diff --git a/libcxx/test/std/ranges/range.factories/range.iota.view/assert.ctor.value.bound.pass.cpp b/libcxx/test/std/ranges/range.factories/range.iota.view/assert.ctor.value.bound.pass.cpp
new file mode 100644
index 000000000000..da21a32bf829
--- /dev/null
+++ b/libcxx/test/std/ranges/range.factories/range.iota.view/assert.ctor.value.bound.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
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++03, c++11, c++14, c++17
+
+// REQUIRES: has-unix-headers
+// UNSUPPORTED: libcpp-hardening-mode=none
+// XFAIL: libcpp-hardening-mode=debug && availability-verbose_abort-missing
+
+// Test the precondition check in iota_view(value, bound) that `bound` is reachable from `value`.
+
+#include <ranges>
+
+#include "check_assertion.h"
+
+int main(int, char**) {
+ { TEST_LIBCPP_ASSERT_FAILURE(std::ranges::iota_view(5, 0), "iota_view: bound must be reachable from value"); }
+ { TEST_LIBCPP_ASSERT_FAILURE(std::ranges::iota_view(10, 5), "iota_view: bound must be reachable from value"); }
+
+ return 0;
+}
diff --git a/libcxx/test/std/strings/basic.string/string.capacity/max_size.pass.cpp b/libcxx/test/std/strings/basic.string/string.capacity/max_size.pass.cpp
index 32ce1c8bf617..e5e04c27a8e5 100644
--- a/libcxx/test/std/strings/basic.string/string.capacity/max_size.pass.cpp
+++ b/libcxx/test/std/strings/basic.string/string.capacity/max_size.pass.cpp
@@ -11,7 +11,7 @@
// After changing the alignment of the allocated pointer from 16 to 8, the exception thrown is no longer `bad_alloc`
// but instead length_error on systems using new headers but older dylibs.
//
-// XFAIL: stdlib=apple-libc++ && target={{.+}}-apple-macosx{{10.13|10.15|11.0}}
+// XFAIL: using-built-library-before-llvm-18
// <string>
diff --git a/libcxx/test/std/strings/basic.string/string.capacity/over_max_size.pass.cpp b/libcxx/test/std/strings/basic.string/string.capacity/over_max_size.pass.cpp
index 0b459f962568..eb8e003b5197 100644
--- a/libcxx/test/std/strings/basic.string/string.capacity/over_max_size.pass.cpp
+++ b/libcxx/test/std/strings/basic.string/string.capacity/over_max_size.pass.cpp
@@ -7,12 +7,12 @@
//===----------------------------------------------------------------------===//
// UNSUPPORTED: no-exceptions
-// XFAIL: stdlib=apple-libc++ && target={{.+}}-apple-macosx10.{{9|10|11}}
+// XFAIL: stdlib=system && target={{.+}}-apple-macosx10.{{9|10|11}}
// Prior to http://llvm.org/D123580, there was a bug with how the max_size()
// was calculated. That was inlined into some functions in the dylib, which leads
// to failures when running this test against an older system dylib.
-// XFAIL: stdlib=apple-libc++ && target=arm64-apple-macosx{{11.0|12.0}}
+// XFAIL: stdlib=system && target=arm64-apple-macosx{{11.0|12.0}}
// <string>
diff --git a/libcxx/test/std/strings/basic.string/string.capacity/reserve_size.pass.cpp b/libcxx/test/std/strings/basic.string/string.capacity/reserve_size.pass.cpp
index 30c171680a23..f466dbd05e74 100644
--- a/libcxx/test/std/strings/basic.string/string.capacity/reserve_size.pass.cpp
+++ b/libcxx/test/std/strings/basic.string/string.capacity/reserve_size.pass.cpp
@@ -12,7 +12,7 @@
// This test relies on https://llvm.org/PR45368 being fixed, which isn't in
// older Apple dylibs
-// XFAIL: stdlib=apple-libc++ && target={{.+}}-apple-macosx{{10.9|10.10|10.11|10.12|10.13|10.14|10.15|11.0}}
+// XFAIL: stdlib=system && target={{.+}}-apple-macosx{{10.9|10.10|10.11|10.12|10.13|10.14|10.15|11.0}}
#include <string>
#include <stdexcept>
diff --git a/libcxx/test/std/thread/futures/futures.async/async_race.38682.pass.cpp b/libcxx/test/std/thread/futures/futures.async/async_race.38682.pass.cpp
index 310aac599a38..64ff0e76ff2d 100644
--- a/libcxx/test/std/thread/futures/futures.async/async_race.38682.pass.cpp
+++ b/libcxx/test/std/thread/futures/futures.async/async_race.38682.pass.cpp
@@ -11,7 +11,7 @@
// There's currently no release of OS X whose dylib contains the patch for
// PR38682. Since the fix for future<void> is in the dylib, this test may fail.
-// UNSUPPORTED: stdlib=apple-libc++ && target={{.+}}-apple-macosx10.{{9|10|11|12|13|14}}
+// UNSUPPORTED: stdlib=system && target={{.+}}-apple-macosx10.{{9|10|11|12|13|14}}
// This test is designed to cause and allow TSAN to detect a race condition
// in std::async, as reported in https://llvm.org/PR38682.
diff --git a/libcxx/test/std/thread/futures/futures.future_error/what.pass.cpp b/libcxx/test/std/thread/futures/futures.future_error/what.pass.cpp
index 2e971a940c50..05781c24e45b 100644
--- a/libcxx/test/std/thread/futures/futures.future_error/what.pass.cpp
+++ b/libcxx/test/std/thread/futures/futures.future_error/what.pass.cpp
@@ -11,7 +11,7 @@
// LWG 2056 changed the values of future_errc, so if we're using new headers
// with an old library we'll get incorrect messages.
//
-// XFAIL: stdlib=apple-libc++ && target={{.+}}-apple-macosx10.{{9|10|11}}
+// XFAIL: stdlib=system && target={{.+}}-apple-macosx10.{{9|10|11}}
// VC Runtime's std::exception::what() method is not marked as noexcept, so
// this fails.
diff --git a/libcxx/test/std/thread/thread.condition/notify_all_at_thread_exit_lwg3343.pass.cpp b/libcxx/test/std/thread/thread.condition/notify_all_at_thread_exit_lwg3343.pass.cpp
index 4c8ba829ce68..c1c1ab0ef4e8 100644
--- a/libcxx/test/std/thread/thread.condition/notify_all_at_thread_exit_lwg3343.pass.cpp
+++ b/libcxx/test/std/thread/thread.condition/notify_all_at_thread_exit_lwg3343.pass.cpp
@@ -14,8 +14,8 @@
// The fix of LWG3343 is done in the dylib. That means Apple backdeployment
// targets remain broken. Due to the nature of the test, testing on a broken
// system does not guarantee that the test fails, so the test can't use XFAIL.
-// UNSUPPORTED: stdlib=apple-libc++ && target={{.+}}-apple-macosx10.{{.+}}
-// UNSUPPORTED: stdlib=apple-libc++ && target={{.+}}-apple-macosx11.{{.+}}
+// UNSUPPORTED: stdlib=system && target={{.+}}-apple-macosx10.{{.+}}
+// UNSUPPORTED: stdlib=system && target={{.+}}-apple-macosx11.{{.+}}
// This is a regression test for LWG3343.
//
diff --git a/libcxx/test/std/thread/thread.mutex/thread.mutex.requirements/thread.sharedtimedmutex.requirements/thread.sharedtimedmutex.class/default.pass.cpp b/libcxx/test/std/thread/thread.mutex/thread.mutex.requirements/thread.sharedtimedmutex.requirements/thread.sharedtimedmutex.class/default.pass.cpp
index b278419df6ee..7a8d096994ff 100644
--- a/libcxx/test/std/thread/thread.mutex/thread.mutex.requirements/thread.sharedtimedmutex.requirements/thread.sharedtimedmutex.class/default.pass.cpp
+++ b/libcxx/test/std/thread/thread.mutex/thread.mutex.requirements/thread.sharedtimedmutex.requirements/thread.sharedtimedmutex.class/default.pass.cpp
@@ -19,9 +19,9 @@
#include "test_macros.h"
-int main(int, char**)
-{
- std::shared_timed_mutex m;
+int main(int, char**) {
+ std::shared_timed_mutex m;
+ (void)m;
return 0;
}
diff --git a/libcxx/test/std/thread/thread.mutex/thread.mutex.requirements/thread.timedmutex.requirements/thread.timedmutex.class/default.pass.cpp b/libcxx/test/std/thread/thread.mutex/thread.mutex.requirements/thread.timedmutex.requirements/thread.timedmutex.class/default.pass.cpp
index d13a0ad435ae..c7f207372ac4 100644
--- a/libcxx/test/std/thread/thread.mutex/thread.mutex.requirements/thread.timedmutex.requirements/thread.timedmutex.class/default.pass.cpp
+++ b/libcxx/test/std/thread/thread.mutex/thread.mutex.requirements/thread.timedmutex.requirements/thread.timedmutex.class/default.pass.cpp
@@ -18,9 +18,9 @@
#include "test_macros.h"
-int main(int, char**)
-{
- std::timed_mutex m;
+int main(int, char**) {
+ std::timed_mutex m;
+ (void)m;
return 0;
}
diff --git a/libcxx/test/std/thread/thread.mutex/thread.mutex.requirements/thread.timedmutex.requirements/thread.timedmutex.recursive/default.pass.cpp b/libcxx/test/std/thread/thread.mutex/thread.mutex.requirements/thread.timedmutex.requirements/thread.timedmutex.recursive/default.pass.cpp
index 73e2e7a3a5ab..3096e031855a 100644
--- a/libcxx/test/std/thread/thread.mutex/thread.mutex.requirements/thread.timedmutex.requirements/thread.timedmutex.recursive/default.pass.cpp
+++ b/libcxx/test/std/thread/thread.mutex/thread.mutex.requirements/thread.timedmutex.requirements/thread.timedmutex.recursive/default.pass.cpp
@@ -18,9 +18,9 @@
#include "test_macros.h"
-int main(int, char**)
-{
- std::recursive_timed_mutex m;
+int main(int, char**) {
+ std::recursive_timed_mutex m;
+ (void)m;
return 0;
}
diff --git a/libcxx/test/std/time/time.zone/time.zone.exception/time.zone.exception.ambig/ctor.pass.cpp b/libcxx/test/std/time/time.zone/time.zone.exception/time.zone.exception.ambig/ctor.pass.cpp
new file mode 100644
index 000000000000..a0b141631f83
--- /dev/null
+++ b/libcxx/test/std/time/time.zone/time.zone.exception/time.zone.exception.ambig/ctor.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
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++03, c++11, c++14, c++17
+// UNSUPPORTED: no-filesystem, no-localization, no-tzdb
+
+// XFAIL: libcpp-has-no-experimental-tzdb
+// XFAIL: availability-tzdb-missing
+
+// <chrono>
+
+// class ambiguous_local_time
+//
+// template<class Duration>
+// ambiguous_local_time(const local_time<Duration>& tp, const local_info& i);
+
+#include <chrono>
+#include <string_view>
+
+#include "assert_macros.h"
+#include "concat_macros.h"
+
+template <class Duration>
+static void
+test(const std::chrono::local_time<Duration>& tp, const std::chrono::local_info& i, std::string_view expected) {
+ std::chrono::ambiguous_local_time exception{tp, i};
+ std::string_view result = exception.what();
+ TEST_REQUIRE(result == expected,
+ TEST_WRITE_CONCATENATED("Expected output\n", expected, "\n\nActual output\n", result, '\n'));
+}
+
+// The constructor constructs the runtime_error base class with a specific
+// message. This implicitly tests what() too, since that is inherited from
+// runtime_error there is no separate test for what().
+int main(int, char**) {
+ using namespace std::literals::chrono_literals;
+
+ // There is no requirement on the ordering of PREV and NEXT so an "invalid"
+ // overlap is allowed. All tests with negative dates use the same order as
+ // positive tests.
+
+ test(std::chrono::local_time<std::chrono::nanoseconds>{-1ns},
+ std::chrono::local_info{
+ std::chrono::local_info::ambiguous,
+ std::chrono::sys_info{
+ std::chrono::sys_days{std::chrono::January / 1 / 1970},
+ std::chrono::sys_days{std::chrono::March / 1 / 1970},
+ 1h,
+ 60min,
+ "PREV"},
+
+ std::chrono::sys_info{
+ std::chrono::sys_days{std::chrono::September / 1 / 1969},
+ std::chrono::sys_days{std::chrono::December / 31 / 1969} + 23h,
+ 0s,
+ 0min,
+ "NEXT"}
+
+ },
+ R"(1969-12-31 23:59:59.999999999 is ambiguous. It could be
+1969-12-31 23:59:59.999999999 PREV == 1969-12-31 22:59:59.999999999 UTC or
+1969-12-31 23:59:59.999999999 NEXT == 1969-12-31 23:59:59.999999999 UTC)");
+
+ test(std::chrono::local_time<std::chrono::microseconds>{0us},
+ std::chrono::local_info{
+ std::chrono::local_info::ambiguous,
+ std::chrono::sys_info{
+ std::chrono::sys_days{std::chrono::January / 1 / 1970},
+ std::chrono::sys_days{std::chrono::March / 1 / 1970},
+ 1h,
+ 60min,
+ "PREV"},
+
+ std::chrono::sys_info{
+ std::chrono::sys_days{std::chrono::September / 1 / 1969},
+ std::chrono::sys_days{std::chrono::December / 31 / 1969} + 23h,
+ 0s,
+ 0min,
+ "NEXT"}},
+ R"(1970-01-01 00:00:00.000000 is ambiguous. It could be
+1970-01-01 00:00:00.000000 PREV == 1969-12-31 23:00:00.000000 UTC or
+1970-01-01 00:00:00.000000 NEXT == 1970-01-01 00:00:00.000000 UTC)");
+
+ test(std::chrono::local_time<std::chrono::milliseconds>{1ms},
+ std::chrono::local_info{
+ std::chrono::local_info::ambiguous,
+ std::chrono::sys_info{
+ std::chrono::sys_days{std::chrono::January / 1 / 1970},
+ std::chrono::sys_days{std::chrono::March / 1 / 1970},
+ 1h,
+ 60min,
+ "PREV"},
+
+ std::chrono::sys_info{
+ std::chrono::sys_days{std::chrono::September / 1 / 1969},
+ std::chrono::sys_days{std::chrono::December / 31 / 1969} + 23h,
+ 0s,
+ 0min,
+ "NEXT"}},
+ R"(1970-01-01 00:00:00.001 is ambiguous. It could be
+1970-01-01 00:00:00.001 PREV == 1969-12-31 23:00:00.001 UTC or
+1970-01-01 00:00:00.001 NEXT == 1970-01-01 00:00:00.001 UTC)");
+
+ test(std::chrono::local_seconds{(std::chrono::sys_days{std::chrono::January / 1 / -21970}).time_since_epoch()},
+ std::chrono::local_info{
+ std::chrono::local_info::ambiguous,
+ std::chrono::sys_info{
+ std::chrono::sys_days{std::chrono::September / 1 / -21969},
+ std::chrono::sys_days{std::chrono::December / 31 / -21969},
+ 0s,
+ 0min,
+ "PREV"},
+ std::chrono::sys_info{
+ std::chrono::sys_days{std::chrono::January / 1 / -21970},
+ std::chrono::sys_days{std::chrono::March / 1 / -21970} + 23h,
+ 1h,
+ 60min,
+ "NEXT"}},
+ R"(-21970-01-01 00:00:00 is ambiguous. It could be
+-21970-01-01 00:00:00 PREV == -21970-01-01 00:00:00 UTC or
+-21970-01-01 00:00:00 NEXT == -21971-12-31 23:00:00 UTC)");
+
+ test(
+ std::chrono::local_time<std::chrono::days>{
+ (std::chrono::sys_days{std::chrono::January / 1 / 21970}).time_since_epoch()},
+ std::chrono::local_info{
+ std::chrono::local_info::ambiguous,
+ std::chrono::sys_info{
+ std::chrono::sys_days{std::chrono::September / 1 / 21969},
+ std::chrono::sys_days{std::chrono::December / 31 / 21969},
+ 0s,
+ 0min,
+ "PREV"},
+ std::chrono::sys_info{
+ std::chrono::sys_days{std::chrono::January / 1 / 21970},
+ std::chrono::sys_days{std::chrono::March / 1 / 21970} + 23h,
+ 1h,
+ 60min,
+ "NEXT"}},
+ R"(21970-01-01 is ambiguous. It could be
+21970-01-01 PREV == 21970-01-01 00:00:00 UTC or
+21970-01-01 NEXT == 21969-12-31 23:00:00 UTC)");
+
+ test(std::chrono::local_time<std::chrono::weeks>{},
+ std::chrono::local_info{
+ std::chrono::local_info::ambiguous,
+ std::chrono::sys_info{
+ std::chrono::sys_days{std::chrono::September / 1 / 1969},
+ std::chrono::sys_days{std::chrono::December / 31 / 1969},
+ 0s,
+ 0min,
+ "PREV"},
+ std::chrono::sys_info{
+ std::chrono::sys_days{std::chrono::January / 1 / 1970},
+ std::chrono::sys_days{std::chrono::March / 1 / 1970} + 23h,
+ 1h,
+ 60min,
+ "NEXT"}},
+ R"(1970-01-01 is ambiguous. It could be
+1970-01-01 PREV == 1970-01-01 00:00:00 UTC or
+1970-01-01 NEXT == 1969-12-31 23:00:00 UTC)");
+
+ // Note months and years can not be streamed.
+
+ return 0;
+}
diff --git a/libcxx/test/std/time/time.zone/time.zone.exception/time.zone.exception.ambig/types.pass.cpp b/libcxx/test/std/time/time.zone/time.zone.exception/time.zone.exception.ambig/types.pass.cpp
new file mode 100644
index 000000000000..be54aedbbba6
--- /dev/null
+++ b/libcxx/test/std/time/time.zone/time.zone.exception/time.zone.exception.ambig/types.pass.cpp
@@ -0,0 +1,50 @@
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache 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, c++17
+// UNSUPPORTED: no-filesystem, no-localization, no-tzdb
+// ADDITIONAL_COMPILE_FLAGS(clang): -Wno-deprecated
+// ADDITIONAL_COMPILE_FLAGS(gcc): -Wno-deprecated-copy-dtor
+
+// XFAIL: libcpp-has-no-experimental-tzdb
+// XFAIL: availability-tzdb-missing
+
+// <chrono>
+
+// class ambiguous_local_time : public runtime_error {
+// public:
+// template<class Duration>
+// ambiguous_local_time(const local_time<Duration>& tp, const local_info& i);
+// };
+
+#include <chrono>
+#include <stdexcept>
+#include <type_traits>
+
+// Basic properties
+static_assert(std::is_base_of_v<std::runtime_error, std::chrono::ambiguous_local_time>);
+static_assert(!std::is_default_constructible_v<std::chrono::ambiguous_local_time>);
+static_assert(std::is_destructible_v<std::chrono::ambiguous_local_time>);
+static_assert(std::is_copy_constructible_v<std::chrono::ambiguous_local_time>);
+static_assert(std::is_move_constructible_v<std::chrono::ambiguous_local_time>);
+static_assert(std::is_copy_assignable_v<std::chrono::ambiguous_local_time>);
+static_assert(std::is_move_assignable_v<std::chrono::ambiguous_local_time>);
+
+int main(int, char**) {
+ std::chrono::ambiguous_local_time e{
+ std::chrono::local_seconds{}, std::chrono::local_info{std::chrono::local_info::ambiguous, {}, {}}};
+
+ std::chrono::ambiguous_local_time copy = e;
+ copy = e;
+
+ std::chrono::ambiguous_local_time move = std::move(e);
+ e = move;
+ move = std::move(e);
+
+ return 0;
+}
diff --git a/libcxx/test/std/time/time.zone/time.zone.exception/time.zone.exception.nonexist/ctor.pass.cpp b/libcxx/test/std/time/time.zone/time.zone.exception/time.zone.exception.nonexist/ctor.pass.cpp
new file mode 100644
index 000000000000..ca03d832a7a9
--- /dev/null
+++ b/libcxx/test/std/time/time.zone/time.zone.exception/time.zone.exception.nonexist/ctor.pass.cpp
@@ -0,0 +1,172 @@
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache 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, c++17
+// UNSUPPORTED: no-filesystem, no-localization, no-tzdb
+
+// XFAIL: libcpp-has-no-experimental-tzdb
+// XFAIL: availability-tzdb-missing
+
+// <chrono>
+
+// class nonexistent_local_time
+//
+// template<class Duration>
+// nonexistent_local_time(const local_time<Duration>& tp, const local_info& i);
+
+#include <chrono>
+#include <string_view>
+
+#include "assert_macros.h"
+#include "concat_macros.h"
+
+template <class Duration>
+static void
+test(const std::chrono::local_time<Duration>& tp, const std::chrono::local_info& i, std::string_view expected) {
+ std::chrono::nonexistent_local_time exception{tp, i};
+ std::string_view result = exception.what();
+ TEST_REQUIRE(result == expected,
+ TEST_WRITE_CONCATENATED("Expected output\n", expected, "\n\nActual output\n", result, '\n'));
+}
+
+// The constructor constructs the runtime_error base class with a specific
+// message. This implicitly tests what() too, since that is inherited from
+// runtime_error there is no separate test for what().
+int main(int, char**) {
+ using namespace std::literals::chrono_literals;
+
+ // There is no requirement on the ordering of PREV and NEXT so an "invalid"
+ // gap is allowed. All tests with negative dates use the same order as
+ // positive tests.
+
+ test(std::chrono::local_time<std::chrono::nanoseconds>{-1ns},
+ std::chrono::local_info{
+ std::chrono::local_info::nonexistent,
+ std::chrono::sys_info{
+ std::chrono::sys_days{std::chrono::September / 1 / 1969},
+ std::chrono::sys_days{std::chrono::December / 31 / 1969} + 23h,
+ 0s,
+ 0min,
+ "PREV"},
+ std::chrono::sys_info{
+ std::chrono::sys_days{std::chrono::January / 1 / 1970},
+ std::chrono::sys_days{std::chrono::March / 1 / 1970},
+ 1h,
+ 60min,
+ "NEXT"}},
+ R"(1969-12-31 23:59:59.999999999 is in a gap between
+1969-12-31 23:00:00 PREV and
+1970-01-01 01:00:00 NEXT which are both equivalent to
+1969-12-31 23:00:00 UTC)");
+
+ test(std::chrono::local_time<std::chrono::microseconds>{0us},
+ std::chrono::local_info{
+ std::chrono::local_info::nonexistent,
+ std::chrono::sys_info{
+ std::chrono::sys_days{std::chrono::September / 1 / 1969},
+ std::chrono::sys_days{std::chrono::December / 31 / 1969} + 23h,
+ 0s,
+ 0min,
+ "PREV"},
+ std::chrono::sys_info{
+ std::chrono::sys_days{std::chrono::January / 1 / 1970},
+ std::chrono::sys_days{std::chrono::March / 1 / 1970},
+ 1h,
+ 60min,
+ "NEXT"}},
+ R"(1970-01-01 00:00:00.000000 is in a gap between
+1969-12-31 23:00:00 PREV and
+1970-01-01 01:00:00 NEXT which are both equivalent to
+1969-12-31 23:00:00 UTC)");
+
+ test(std::chrono::local_time<std::chrono::milliseconds>{1ms},
+ std::chrono::local_info{
+ std::chrono::local_info::nonexistent,
+ std::chrono::sys_info{
+ std::chrono::sys_days{std::chrono::September / 1 / 1969},
+ std::chrono::sys_days{std::chrono::December / 31 / 1969} + 23h,
+ 0s,
+ 0min,
+ "PREV"},
+ std::chrono::sys_info{
+ std::chrono::sys_days{std::chrono::January / 1 / 1970},
+ std::chrono::sys_days{std::chrono::March / 1 / 1970},
+ 1h,
+ 60min,
+ "NEXT"}},
+ R"(1970-01-01 00:00:00.001 is in a gap between
+1969-12-31 23:00:00 PREV and
+1970-01-01 01:00:00 NEXT which are both equivalent to
+1969-12-31 23:00:00 UTC)");
+
+ test(std::chrono::local_seconds{(std::chrono::sys_days{std::chrono::January / 1 / -21970}).time_since_epoch()},
+ std::chrono::local_info{
+ std::chrono::local_info::nonexistent,
+ std::chrono::sys_info{
+ std::chrono::sys_days{std::chrono::September / 1 / -21969},
+ std::chrono::sys_days{std::chrono::December / 31 / -21969} + 23h,
+ 0s,
+ 0min,
+ "PREV"},
+ std::chrono::sys_info{
+ std::chrono::sys_days{std::chrono::January / 1 / -21970},
+ std::chrono::sys_days{std::chrono::March / 1 / -21970},
+ 1h,
+ 60min,
+ "NEXT"}},
+ R"(-21970-01-01 00:00:00 is in a gap between
+-21969-12-31 23:00:00 PREV and
+-21970-01-01 01:00:00 NEXT which are both equivalent to
+-21969-12-31 23:00:00 UTC)");
+
+ test(
+ std::chrono::local_time<std::chrono::days>{
+ (std::chrono::sys_days{std::chrono::January / 1 / 21970}).time_since_epoch()},
+ std::chrono::local_info{
+ std::chrono::local_info::nonexistent,
+ std::chrono::sys_info{
+ std::chrono::sys_days{std::chrono::September / 1 / 21969},
+ std::chrono::sys_days{std::chrono::December / 31 / 21969} + 23h,
+ 0s,
+ 0min,
+ "PREV"},
+ std::chrono::sys_info{
+ std::chrono::sys_days{std::chrono::January / 1 / 21970},
+ std::chrono::sys_days{std::chrono::March / 1 / 21970},
+ 1h,
+ 60min,
+ "NEXT"}},
+ R"(21970-01-01 is in a gap between
+21969-12-31 23:00:00 PREV and
+21970-01-01 01:00:00 NEXT which are both equivalent to
+21969-12-31 23:00:00 UTC)");
+
+ test(std::chrono::local_time<std::chrono::weeks>{},
+ std::chrono::local_info{
+ std::chrono::local_info::nonexistent,
+ std::chrono::sys_info{
+ std::chrono::sys_days{std::chrono::September / 1 / 1969},
+ std::chrono::sys_days{std::chrono::December / 31 / 1969} + 23h,
+ 0s,
+ 0min,
+ "PREV"},
+ std::chrono::sys_info{
+ std::chrono::sys_days{std::chrono::January / 1 / 1970},
+ std::chrono::sys_days{std::chrono::March / 1 / 1970},
+ 1h,
+ 60min,
+ "NEXT"}},
+ R"(1970-01-01 is in a gap between
+1969-12-31 23:00:00 PREV and
+1970-01-01 01:00:00 NEXT which are both equivalent to
+1969-12-31 23:00:00 UTC)");
+
+ // Note months and years can not be streamed.
+
+ return 0;
+}
diff --git a/libcxx/test/std/time/time.zone/time.zone.exception/time.zone.exception.nonexist/types.pass.cpp b/libcxx/test/std/time/time.zone/time.zone.exception/time.zone.exception.nonexist/types.pass.cpp
new file mode 100644
index 000000000000..85ebfab679e0
--- /dev/null
+++ b/libcxx/test/std/time/time.zone/time.zone.exception/time.zone.exception.nonexist/types.pass.cpp
@@ -0,0 +1,50 @@
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache 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, c++17
+// UNSUPPORTED: no-filesystem, no-localization, no-tzdb
+// ADDITIONAL_COMPILE_FLAGS(clang): -Wno-deprecated
+// ADDITIONAL_COMPILE_FLAGS(gcc): -Wno-deprecated-copy-dtor
+
+// XFAIL: libcpp-has-no-experimental-tzdb
+// XFAIL: availability-tzdb-missing
+
+// <chrono>
+
+// class nonexistent_local_time : public runtime_error {
+// public:
+// template<class Duration>
+// nonexistent_local_time(const local_time<Duration>& tp, const local_info& i);
+// };
+
+#include <chrono>
+#include <stdexcept>
+#include <type_traits>
+
+// Basic properties
+static_assert(std::is_base_of_v<std::runtime_error, std::chrono::nonexistent_local_time>);
+static_assert(!std::is_default_constructible_v<std::chrono::nonexistent_local_time>);
+static_assert(std::is_destructible_v<std::chrono::nonexistent_local_time>);
+static_assert(std::is_copy_constructible_v<std::chrono::nonexistent_local_time>);
+static_assert(std::is_move_constructible_v<std::chrono::nonexistent_local_time>);
+static_assert(std::is_copy_assignable_v<std::chrono::nonexistent_local_time>);
+static_assert(std::is_move_assignable_v<std::chrono::nonexistent_local_time>);
+
+int main(int, char**) {
+ std::chrono::nonexistent_local_time e{
+ std::chrono::local_seconds{}, std::chrono::local_info{std::chrono::local_info::nonexistent, {}, {}}};
+
+ std::chrono::nonexistent_local_time copy = e;
+ copy = e;
+
+ std::chrono::nonexistent_local_time move = std::move(e);
+ e = move;
+ move = std::move(e);
+
+ return 0;
+}
diff --git a/libcxx/test/std/time/time.zone/time.zone.timezone/time.zone.members/get_info.local_time.pass.cpp b/libcxx/test/std/time/time.zone/time.zone.timezone/time.zone.members/get_info.local_time.pass.cpp
index 6dc15974c448..76dd8bc746fc 100644
--- a/libcxx/test/std/time/time.zone/time.zone.timezone/time.zone.members/get_info.local_time.pass.cpp
+++ b/libcxx/test/std/time/time.zone/time.zone.timezone/time.zone.members/get_info.local_time.pass.cpp
@@ -8,10 +8,14 @@
// UNSUPPORTED: c++03, c++11, c++14, c++17
// UNSUPPORTED: no-filesystem, no-localization, no-tzdb
+// REQUIRES: long_tests
// XFAIL: libcpp-has-no-experimental-tzdb
// XFAIL: availability-tzdb-missing
+// TODO TZDB Investigate why this fails.
+// UNSUPPORTED: target={{.*}}
+
// <chrono>
// class time_zone;
diff --git a/libcxx/test/std/time/time.zone/time.zone.timezone/time.zone.members/sys_info.zdump.pass.cpp b/libcxx/test/std/time/time.zone/time.zone.timezone/time.zone.members/sys_info.zdump.pass.cpp
index 50b7bdb568d4..207f8e4df454 100644
--- a/libcxx/test/std/time/time.zone/time.zone.timezone/time.zone.members/sys_info.zdump.pass.cpp
+++ b/libcxx/test/std/time/time.zone/time.zone.timezone/time.zone.members/sys_info.zdump.pass.cpp
@@ -8,6 +8,7 @@
// UNSUPPORTED: c++03, c++11, c++14, c++17
// UNSUPPORTED: no-filesystem, no-localization, no-tzdb, has-no-zdump
+// REQUIRES: long_tests
// XFAIL: libcpp-has-no-experimental-tzdb
// XFAIL: availability-tzdb-missing
diff --git a/libcxx/test/std/time/time.zone/time.zone.timezone/time.zone.members/to_local.pass.cpp b/libcxx/test/std/time/time.zone/time.zone.timezone/time.zone.members/to_local.pass.cpp
new file mode 100644
index 000000000000..28d61455710c
--- /dev/null
+++ b/libcxx/test/std/time/time.zone/time.zone.timezone/time.zone.members/to_local.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
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++03, c++11, c++14, c++17
+// UNSUPPORTED: no-filesystem, no-localization, no-tzdb
+
+// XFAIL: libcpp-has-no-experimental-tzdb
+// XFAIL: availability-tzdb-missing
+
+// <chrono>
+
+// class time_zone;
+
+// template <class _Duration>
+// local_time<common_type_t<Duration, seconds>>
+// to_local(const sys_time<Duration>& tp) const;
+
+#include <chrono>
+#include <format>
+#include <cassert>
+#include <string_view>
+
+#include "test_macros.h"
+#include "assert_macros.h"
+#include "concat_macros.h"
+
+int main(int, char**) {
+ // To make sure the test does not depend on changes in the database it uses a
+ // time zone with a fixed offset.
+ using namespace std::literals::chrono_literals;
+
+ const std::chrono::time_zone* tz = std::chrono::locate_zone("Etc/GMT+1");
+
+ assert(tz->to_local(std::chrono::sys_time<std::chrono::nanoseconds>{-1ns}) ==
+ std::chrono::local_time<std::chrono::nanoseconds>{-1ns - 1h});
+
+ assert(tz->to_local(std::chrono::sys_time<std::chrono::microseconds>{0us}) ==
+ std::chrono::local_time<std::chrono::microseconds>{0us - 1h});
+
+ assert(tz->to_local(
+ std::chrono::sys_time<std::chrono::seconds>{std::chrono::sys_days{std::chrono::January / 1 / -21970}}) ==
+ std::chrono::local_time<std::chrono::seconds>{
+ (std::chrono::sys_days{std::chrono::January / 1 / -21970}).time_since_epoch() - 1h});
+
+ assert(
+ tz->to_local(std::chrono::sys_time<std::chrono::days>{std::chrono::sys_days{std::chrono::January / 1 / 21970}}) ==
+ std::chrono::local_time<std::chrono::seconds>{
+ (std::chrono::sys_days{std::chrono::January / 1 / 21970}).time_since_epoch() - 1h});
+
+ assert(tz->to_local(std::chrono::sys_time<std::chrono::weeks>{}) ==
+ std::chrono::local_time<std::chrono::seconds>{
+ (std::chrono::sys_days{std::chrono::January / 1 / 1970}).time_since_epoch() - 1h});
+
+ assert(tz->to_local(std::chrono::sys_time<std::chrono::months>{}) ==
+ std::chrono::local_time<std::chrono::seconds>{
+ (std::chrono::sys_days{std::chrono::January / 1 / 1970}).time_since_epoch() - 1h});
+
+ assert(tz->to_local(std::chrono::sys_time<std::chrono::years>{}) ==
+ std::chrono::local_time<std::chrono::seconds>{
+ (std::chrono::sys_days{std::chrono::January / 1 / 1970}).time_since_epoch() - 1h});
+
+ return 0;
+}
diff --git a/libcxx/test/std/time/time.zone/time.zone.timezone/time.zone.members/to_sys.pass.cpp b/libcxx/test/std/time/time.zone/time.zone.timezone/time.zone.members/to_sys.pass.cpp
new file mode 100644
index 000000000000..874c3d52e460
--- /dev/null
+++ b/libcxx/test/std/time/time.zone/time.zone.timezone/time.zone.members/to_sys.pass.cpp
@@ -0,0 +1,237 @@
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache 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, c++17
+// UNSUPPORTED: no-filesystem, no-localization, no-tzdb
+
+// XFAIL: libcpp-has-no-experimental-tzdb
+// XFAIL: availability-tzdb-missing
+
+// <chrono>
+
+// class time_zone;
+
+// template <class _Duration>
+// sys_time<common_type_t<Duration, seconds>>
+// to_sys(const local_time<Duration>& tp) const;
+
+#include <chrono>
+#include <format>
+#include <cassert>
+#include <string_view>
+
+#include "test_macros.h"
+#include "assert_macros.h"
+#include "concat_macros.h"
+
+// Tests unique conversions. To make sure the test is does not depend on changes
+// in the database it uses a time zone with a fixed offset.
+static void test_unique() {
+ using namespace std::literals::chrono_literals;
+
+ const std::chrono::time_zone* tz = std::chrono::locate_zone("Etc/GMT+1");
+
+ assert(tz->to_sys(std::chrono::local_time<std::chrono::nanoseconds>{-1ns}) ==
+ std::chrono::sys_time<std::chrono::nanoseconds>{-1ns + 1h});
+
+ assert(tz->to_sys(std::chrono::local_time<std::chrono::microseconds>{0us}) ==
+ std::chrono::sys_time<std::chrono::microseconds>{1h});
+
+ assert(tz->to_sys(std::chrono::local_time<std::chrono::seconds>{
+ (std::chrono::sys_days{std::chrono::January / 1 / -21970}).time_since_epoch()}) ==
+ std::chrono::sys_time<std::chrono::seconds>{
+ (std::chrono::sys_days{std::chrono::January / 1 / -21970}).time_since_epoch() + 1h});
+
+ // sys_time<common_type_t<Duration, seconds>> is seconds for the larger types
+ assert(tz->to_sys(std::chrono::local_time<std::chrono::days>{
+ (std::chrono::sys_days{std::chrono::January / 1 / 21970}).time_since_epoch()}) ==
+ std::chrono::sys_time<std::chrono::seconds>{
+ (std::chrono::sys_days{std::chrono::January / 1 / 21970}).time_since_epoch() + 1h});
+
+ assert(tz->to_sys(std::chrono::local_time<std::chrono::weeks>{}) ==
+ std::chrono::sys_time<std::chrono::seconds>{
+ (std::chrono::sys_days{std::chrono::January / 1 / 1970}).time_since_epoch() + 1h});
+
+ // Note months and years can not be streamed; thus the function cannot be
+ // instantiated for these types. (Even when there is no exception thrown.)
+}
+
+// Tests non-existant conversions.
+static void test_nonexistent() {
+#ifndef TEST_HAS_NO_EXCEPTIONS
+ using namespace std::literals::chrono_literals;
+
+ const std::chrono::time_zone* tz = std::chrono::locate_zone("Europe/Berlin");
+
+ // Z Europe/Berlin 0:53:28 - LMT 1893 Ap
+ // ...
+ // 1 DE CE%sT 1980
+ // 1 E CE%sT
+ //
+ // ...
+ // R E 1981 ma - Mar lastSu 1u 1 S
+ // R E 1996 ma - O lastSu 1u 0 -
+
+ // Pick an historic date where it's well known what the time zone rules were.
+ // This makes it unlikely updates to the database change these rules.
+ std::chrono::local_time<std::chrono::seconds> time{
+ (std::chrono::sys_days{std::chrono::March / 30 / 1986} + 2h + 30min).time_since_epoch()};
+
+ // Validates whether the database did not change.
+ std::chrono::local_info info = tz->get_info(time);
+ assert(info.result == std::chrono::local_info::nonexistent);
+
+ TEST_VALIDATE_EXCEPTION(
+ std::chrono::nonexistent_local_time,
+ [&]([[maybe_unused]] const std::chrono::nonexistent_local_time& e) {
+ std::string_view what =
+ R"(1986-03-30 02:30:00.000000000 is in a gap between
+1986-03-30 02:00:00 CET and
+1986-03-30 03:00:00 CEST which are both equivalent to
+1986-03-30 01:00:00 UTC)";
+ TEST_LIBCPP_REQUIRE(
+ e.what() == what,
+ TEST_WRITE_CONCATENATED("Expected exception\n", what, "\n\nActual exception\n", e.what(), '\n'));
+ },
+ tz->to_sys(time + 0ns));
+
+ TEST_VALIDATE_EXCEPTION(
+ std::chrono::nonexistent_local_time,
+ [&]([[maybe_unused]] const std::chrono::nonexistent_local_time& e) {
+ std::string_view what =
+ R"(1986-03-30 02:30:00.000000 is in a gap between
+1986-03-30 02:00:00 CET and
+1986-03-30 03:00:00 CEST which are both equivalent to
+1986-03-30 01:00:00 UTC)";
+ TEST_LIBCPP_REQUIRE(
+ e.what() == what,
+ TEST_WRITE_CONCATENATED("Expected exception\n", what, "\n\nActual exception\n", e.what(), '\n'));
+ },
+ tz->to_sys(time + 0us));
+
+ TEST_VALIDATE_EXCEPTION(
+ std::chrono::nonexistent_local_time,
+ [&]([[maybe_unused]] const std::chrono::nonexistent_local_time& e) {
+ std::string_view what =
+ R"(1986-03-30 02:30:00.000 is in a gap between
+1986-03-30 02:00:00 CET and
+1986-03-30 03:00:00 CEST which are both equivalent to
+1986-03-30 01:00:00 UTC)";
+ TEST_LIBCPP_REQUIRE(
+ e.what() == what,
+ TEST_WRITE_CONCATENATED("Expected exception\n", what, "\n\nActual exception\n", e.what(), '\n'));
+ },
+ tz->to_sys(time + 0ms));
+
+ TEST_VALIDATE_EXCEPTION(
+ std::chrono::nonexistent_local_time,
+ [&]([[maybe_unused]] const std::chrono::nonexistent_local_time& e) {
+ std::string_view what =
+ R"(1986-03-30 02:30:00 is in a gap between
+1986-03-30 02:00:00 CET and
+1986-03-30 03:00:00 CEST which are both equivalent to
+1986-03-30 01:00:00 UTC)";
+ TEST_LIBCPP_REQUIRE(
+ e.what() == what,
+ TEST_WRITE_CONCATENATED("Expected exception\n", what, "\n\nActual exception\n", e.what(), '\n'));
+ },
+ tz->to_sys(time + 0s));
+
+#endif // TEST_HAS_NO_EXCEPTIONS
+}
+
+// Tests ambiguous conversions.
+static void test_ambiguous() {
+#ifndef TEST_HAS_NO_EXCEPTIONS
+ using namespace std::literals::chrono_literals;
+
+ const std::chrono::time_zone* tz = std::chrono::locate_zone("Europe/Berlin");
+
+ // Z Europe/Berlin 0:53:28 - LMT 1893 Ap
+ // ...
+ // 1 DE CE%sT 1980
+ // 1 E CE%sT
+ //
+ // ...
+ // R E 1981 ma - Mar lastSu 1u 1 S
+ // R E 1996 ma - O lastSu 1u 0 -
+
+ // Pick an historic date where it's well known what the time zone rules were.
+ // This makes it unlikely updates to the database change these rules.
+ std::chrono::local_time<std::chrono::seconds> time{
+ (std::chrono::sys_days{std::chrono::September / 28 / 1986} + 2h + 30min).time_since_epoch()};
+
+ // Validates whether the database did not change.
+ std::chrono::local_info info = tz->get_info(time);
+ assert(info.result == std::chrono::local_info::ambiguous);
+
+ TEST_VALIDATE_EXCEPTION(
+ std::chrono::ambiguous_local_time,
+ [&]([[maybe_unused]] const std::chrono::ambiguous_local_time& e) {
+ std::string_view what =
+ R"(1986-09-28 02:30:00.000000000 is ambiguous. It could be
+1986-09-28 02:30:00.000000000 CEST == 1986-09-28 00:30:00.000000000 UTC or
+1986-09-28 02:30:00.000000000 CET == 1986-09-28 01:30:00.000000000 UTC)";
+ TEST_LIBCPP_REQUIRE(
+ e.what() == what,
+ TEST_WRITE_CONCATENATED("Expected exception\n", what, "\n\nActual exception\n", e.what(), '\n'));
+ },
+ tz->to_sys(time + 0ns));
+
+ TEST_VALIDATE_EXCEPTION(
+ std::chrono::ambiguous_local_time,
+ [&]([[maybe_unused]] const std::chrono::ambiguous_local_time& e) {
+ std::string_view what =
+ R"(1986-09-28 02:30:00.000000 is ambiguous. It could be
+1986-09-28 02:30:00.000000 CEST == 1986-09-28 00:30:00.000000 UTC or
+1986-09-28 02:30:00.000000 CET == 1986-09-28 01:30:00.000000 UTC)";
+ TEST_LIBCPP_REQUIRE(
+ e.what() == what,
+ TEST_WRITE_CONCATENATED("Expected exception\n", what, "\n\nActual exception\n", e.what(), '\n'));
+ },
+ tz->to_sys(time + 0us));
+
+ TEST_VALIDATE_EXCEPTION(
+ std::chrono::ambiguous_local_time,
+ [&]([[maybe_unused]] const std::chrono::ambiguous_local_time& e) {
+ std::string_view what =
+ R"(1986-09-28 02:30:00.000 is ambiguous. It could be
+1986-09-28 02:30:00.000 CEST == 1986-09-28 00:30:00.000 UTC or
+1986-09-28 02:30:00.000 CET == 1986-09-28 01:30:00.000 UTC)";
+ TEST_LIBCPP_REQUIRE(
+ e.what() == what,
+ TEST_WRITE_CONCATENATED("Expected exception\n", what, "\n\nActual exception\n", e.what(), '\n'));
+ },
+ tz->to_sys(time + 0ms));
+
+ TEST_VALIDATE_EXCEPTION(
+ std::chrono::ambiguous_local_time,
+ [&]([[maybe_unused]] const std::chrono::ambiguous_local_time& e) {
+ std::string_view what =
+ R"(1986-09-28 02:30:00 is ambiguous. It could be
+1986-09-28 02:30:00 CEST == 1986-09-28 00:30:00 UTC or
+1986-09-28 02:30:00 CET == 1986-09-28 01:30:00 UTC)";
+ TEST_LIBCPP_REQUIRE(
+ e.what() == what,
+ TEST_WRITE_CONCATENATED("Expected exception\n", what, "\n\nActual exception\n", e.what(), '\n'));
+ },
+ tz->to_sys(time + 0s));
+
+#endif // TEST_HAS_NO_EXCEPTIONS
+}
+
+// This test does the basic validations of this function. The library function
+// uses `local_info get_info(const local_time<Duration>& tp)` as implementation
+// detail. The get_info function does extensive testing of the data.
+int main(int, char**) {
+ test_unique();
+ test_nonexistent();
+ test_ambiguous();
+
+ return 0;
+}
diff --git a/libcxx/test/std/time/time.zone/time.zone.timezone/time.zone.members/to_sys_choose.pass.cpp b/libcxx/test/std/time/time.zone/time.zone.timezone/time.zone.members/to_sys_choose.pass.cpp
new file mode 100644
index 000000000000..bad4ef352e9b
--- /dev/null
+++ b/libcxx/test/std/time/time.zone/time.zone.timezone/time.zone.members/to_sys_choose.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
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++03, c++11, c++14, c++17
+// UNSUPPORTED: no-filesystem, no-localization, no-tzdb
+
+// XFAIL: libcpp-has-no-experimental-tzdb
+// XFAIL: availability-tzdb-missing
+
+// <chrono>
+
+// class time_zone;
+
+// template <class _Duration>
+// sys_time<common_type_t<Duration, seconds>>
+// to_sys(const local_time<Duration>& tp, choose z) const;
+
+#include <chrono>
+#include <format>
+#include <cassert>
+#include <string_view>
+
+#include "test_macros.h"
+
+// Tests unique conversions. To make sure the test is does not depend on changes
+// in the database it uses a time zone with a fixed offset.
+static void test_unique() {
+ using namespace std::literals::chrono_literals;
+
+ const std::chrono::time_zone* tz = std::chrono::locate_zone("Etc/GMT+1");
+
+ assert(tz->to_sys(std::chrono::local_time<std::chrono::nanoseconds>{-1ns}, std::chrono::choose::earliest) ==
+ std::chrono::sys_time<std::chrono::nanoseconds>{-1ns + 1h});
+
+ assert(tz->to_sys(std::chrono::local_time<std::chrono::microseconds>{0us}, std::chrono::choose::latest) ==
+ std::chrono::sys_time<std::chrono::microseconds>{1h});
+
+ assert(tz->to_sys(
+ std::chrono::local_time<std::chrono::seconds>{
+ (std::chrono::sys_days{std::chrono::January / 1 / -21970}).time_since_epoch()},
+ std::chrono::choose::earliest) ==
+ std::chrono::sys_time<std::chrono::seconds>{
+ (std::chrono::sys_days{std::chrono::January / 1 / -21970}).time_since_epoch() + 1h});
+
+ // sys_time<common_type_t<Duration, seconds>> is seconds for the larger types
+ assert(tz->to_sys(
+ std::chrono::local_time<std::chrono::days>{
+ (std::chrono::sys_days{std::chrono::January / 1 / 21970}).time_since_epoch()},
+ std::chrono::choose::latest) ==
+ std::chrono::sys_time<std::chrono::seconds>{
+ (std::chrono::sys_days{std::chrono::January / 1 / 21970}).time_since_epoch() + 1h});
+
+ assert(tz->to_sys(std::chrono::local_time<std::chrono::weeks>{}, std::chrono::choose::earliest) ==
+ std::chrono::sys_time<std::chrono::seconds>{
+ (std::chrono::sys_days{std::chrono::January / 1 / 1970}).time_since_epoch() + 1h});
+
+ // Note months and years cannot be streamed; however these functions don't
+ // throw an exception and thus can be used.
+ assert(tz->to_sys(std::chrono::local_time<std::chrono::months>{}, std::chrono::choose::latest) ==
+ std::chrono::sys_time<std::chrono::seconds>{
+ (std::chrono::sys_days{std::chrono::January / 1 / 1970}).time_since_epoch() + 1h});
+
+ assert(tz->to_sys(std::chrono::local_time<std::chrono::years>{}, std::chrono::choose::earliest) ==
+ std::chrono::sys_time<std::chrono::seconds>{
+ (std::chrono::sys_days{std::chrono::January / 1 / 1970}).time_since_epoch() + 1h});
+}
+
+// Tests non-existant conversions.
+static void test_nonexistent() {
+ using namespace std::literals::chrono_literals;
+
+ const std::chrono::time_zone* tz = std::chrono::locate_zone("Europe/Berlin");
+
+ // Z Europe/Berlin 0:53:28 - LMT 1893 Ap
+ // ...
+ // 1 DE CE%sT 1980
+ // 1 E CE%sT
+ //
+ // ...
+ // R E 1981 ma - Mar lastSu 1u 1 S
+ // R E 1996 ma - O lastSu 1u 0 -
+
+ // Pick an historic date where it's well known what the time zone rules were.
+ // This makes it unlikely updates to the database change these rules.
+ std::chrono::local_time<std::chrono::seconds> time{
+ (std::chrono::sys_days{std::chrono::March / 30 / 1986} + 2h + 30min).time_since_epoch()};
+
+ std::chrono::sys_seconds expected{time.time_since_epoch() - 1h};
+
+ // Validates whether the database did not change.
+ std::chrono::local_info info = tz->get_info(time);
+ assert(info.result == std::chrono::local_info::nonexistent);
+
+ assert(tz->to_sys(time + 0ns, std::chrono::choose::earliest) == expected);
+ assert(tz->to_sys(time + 0us, std::chrono::choose::latest) == expected);
+ assert(tz->to_sys(time + 0ms, std::chrono::choose::earliest) == expected);
+ assert(tz->to_sys(time + 0s, std::chrono::choose::latest) == expected);
+}
+
+// Tests ambiguous conversions.
+static void test_ambiguous() {
+ using namespace std::literals::chrono_literals;
+
+ const std::chrono::time_zone* tz = std::chrono::locate_zone("Europe/Berlin");
+
+ // Z Europe/Berlin 0:53:28 - LMT 1893 Ap
+ // ...
+ // 1 DE CE%sT 1980
+ // 1 E CE%sT
+ //
+ // ...
+ // R E 1981 ma - Mar lastSu 1u 1 S
+ // R E 1996 ma - O lastSu 1u 0 -
+
+ // Pick an historic date where it's well known what the time zone rules were.
+ // This makes it unlikely updates to the database change these rules.
+ std::chrono::local_time<std::chrono::seconds> time{
+ (std::chrono::sys_days{std::chrono::September / 28 / 1986} + 2h + 30min).time_since_epoch()};
+
+ std::chrono::sys_seconds earlier{time.time_since_epoch() - 2h};
+ std::chrono::sys_seconds later{time.time_since_epoch() - 1h};
+
+ // Validates whether the database did not change.
+ std::chrono::local_info info = tz->get_info(time);
+ assert(info.result == std::chrono::local_info::ambiguous);
+
+ assert(tz->to_sys(time + 0ns, std::chrono::choose::earliest) == earlier);
+ assert(tz->to_sys(time + 0us, std::chrono::choose::latest) == later);
+ assert(tz->to_sys(time + 0ms, std::chrono::choose::earliest) == earlier);
+ assert(tz->to_sys(time + 0s, std::chrono::choose::latest) == later);
+}
+
+// This test does the basic validations of this function. The library function
+// uses `local_info get_info(const local_time<Duration>& tp)` as implementation
+// detail. The get_info function does extensive testing of the data.
+int main(int, char**) {
+ test_unique();
+ test_nonexistent();
+ test_ambiguous();
+
+ return 0;
+}
diff --git a/libcxx/test/std/time/time.zone/time.zone.zonedtraits/const_time_zone_default_zone.pass.cpp b/libcxx/test/std/time/time.zone/time.zone.zonedtraits/const_time_zone_default_zone.pass.cpp
new file mode 100644
index 000000000000..c6527094bb62
--- /dev/null
+++ b/libcxx/test/std/time/time.zone/time.zone.zonedtraits/const_time_zone_default_zone.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: c++03, c++11, c++14, c++17
+// UNSUPPORTED: no-filesystem, no-localization, no-tzdb
+
+// XFAIL: libcpp-has-no-experimental-tzdb
+// XFAIL: availability-tzdb-missing
+
+// <chrono>
+
+// template<> struct zoned_traits<const time_zone*>;
+
+// static const time_zone* default_zone();
+
+#include <chrono>
+#include <cassert>
+
+int main(int, char**) {
+ std::same_as<const std::chrono::time_zone*> decltype(auto) tz =
+ std::chrono::zoned_traits<const std::chrono::time_zone*>::default_zone();
+ assert(tz);
+
+ // The time zone "UTC" can be a link, this means tz->name() can be something
+ // differently. For example, "Etc/UTC". Instead validate whether same time
+ // zone is returned by comparing the addresses.
+ const std::chrono::time_zone* expected = std::chrono::locate_zone("UTC");
+ assert(tz == expected);
+
+ return 0;
+}
diff --git a/libcxx/test/std/time/time.zone/time.zone.zonedtraits/const_time_zone_locate_zone.pass.cpp b/libcxx/test/std/time/time.zone/time.zone.zonedtraits/const_time_zone_locate_zone.pass.cpp
new file mode 100644
index 000000000000..1c8184455f23
--- /dev/null
+++ b/libcxx/test/std/time/time.zone/time.zone.zonedtraits/const_time_zone_locate_zone.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
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++03, c++11, c++14, c++17
+// UNSUPPORTED: no-filesystem, no-localization, no-tzdb
+
+// XFAIL: libcpp-has-no-experimental-tzdb
+// XFAIL: availability-tzdb-missing
+
+// <chrono>
+
+// template<> struct zoned_traits<const time_zone*>;
+
+// static const time_zone* locate_zone(string_view name);
+
+#include <chrono>
+#include <cassert>
+#include <concepts>
+
+#include "assert_macros.h"
+
+static void test(std::string_view name) {
+ std::same_as<const std::chrono::time_zone*> decltype(auto) tz =
+ std::chrono::zoned_traits<const std::chrono::time_zone*>::locate_zone(name);
+
+ const std::chrono::time_zone* expected = std::chrono::locate_zone(name);
+ assert(tz == expected);
+}
+
+int main(int, char**) {
+ test("UTC");
+ test("Europe/Berlin");
+ test("Asia/Hong_Kong");
+
+ TEST_THROWS_TYPE(std::runtime_error,
+ TEST_IGNORE_NODISCARD std::chrono::zoned_traits<const std::chrono::time_zone*>::locate_zone(
+ "there_is_no_time_zone_with_this_name"));
+
+ return 0;
+}
diff --git a/libcxx/test/std/time/time.zone/time.zone.zonedtraits/types.compile.pass.cpp b/libcxx/test/std/time/time.zone/time.zone.zonedtraits/types.compile.pass.cpp
new file mode 100644
index 000000000000..6e3410795c82
--- /dev/null
+++ b/libcxx/test/std/time/time.zone/time.zone.zonedtraits/types.compile.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
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++03, c++11, c++14, c++17
+// UNSUPPORTED: no-filesystem, no-localization, no-tzdb
+
+// XFAIL: libcpp-has-no-experimental-tzdb
+// XFAIL: availability-tzdb-missing
+
+// <chrono>
+
+// template<class T> struct zoned_traits {};
+//
+// A specialization for const time_zone* is provided by the implementation:
+// template<> struct zoned_traits<const time_zone*> { ... }
+
+#include <chrono>
+#include <type_traits>
+
+// This test test whether non-specialized versions exhibit the expected
+// behavior. (Note these specializations are not really useful.)
+static_assert(std::is_trivial_v<std::chrono::zoned_traits<int>>);
+static_assert(std::is_trivial_v<std::chrono::zoned_traits<float>>);
+static_assert(std::is_trivial_v<std::chrono::zoned_traits<void*>>);
+
+struct foo {};
+static_assert(std::is_empty_v<std::chrono::zoned_traits<foo>>);
+static_assert(std::is_trivial_v<std::chrono::zoned_traits<foo>>);
diff --git a/libcxx/test/std/utilities/expected/expected.expected/ctor/ctor.copy.pass.cpp b/libcxx/test/std/utilities/expected/expected.expected/ctor/ctor.copy.pass.cpp
index 581df51207da..ba9831750c84 100644
--- a/libcxx/test/std/utilities/expected/expected.expected/ctor/ctor.copy.pass.cpp
+++ b/libcxx/test/std/utilities/expected/expected.expected/ctor/ctor.copy.pass.cpp
@@ -62,6 +62,16 @@ static_assert(!std::is_trivially_copy_constructible_v<std::expected<CopyableNonT
static_assert(!std::is_trivially_copy_constructible_v<std::expected<int, CopyableNonTrivial>>);
static_assert(!std::is_trivially_copy_constructible_v<std::expected<CopyableNonTrivial, CopyableNonTrivial>>);
+struct Any {
+ constexpr Any() = default;
+ constexpr Any(const Any&) = default;
+ constexpr Any& operator=(const Any&) = default;
+
+ template <class T>
+ requires(!std::is_same_v<Any, std::decay_t<T>> && std::is_copy_constructible_v<std::decay_t<T>>)
+ constexpr Any(T&&) {}
+};
+
constexpr bool test() {
// copy the value non-trivial
{
@@ -109,6 +119,16 @@ constexpr bool test() {
assert(!e2.has_value());
}
+ {
+ // TODO(LLVM 20): Remove once we drop support for Clang 17
+#if defined(TEST_CLANG_VER) && TEST_CLANG_VER >= 1800
+ // https://github.com/llvm/llvm-project/issues/92676
+ std::expected<Any, int> e1;
+ auto e2 = e1;
+ assert(e2.has_value());
+#endif
+ }
+
return true;
}
diff --git a/libcxx/test/std/utilities/format/format.formatter/format.formatter.spec/formatter.char.fsigned-char.pass.cpp b/libcxx/test/std/utilities/format/format.formatter/format.formatter.spec/formatter.char.fsigned-char.pass.cpp
index d0da8d69f3f9..f3d587e11f25 100644
--- a/libcxx/test/std/utilities/format/format.formatter/format.formatter.spec/formatter.char.fsigned-char.pass.cpp
+++ b/libcxx/test/std/utilities/format/format.formatter/format.formatter.spec/formatter.char.fsigned-char.pass.cpp
@@ -71,17 +71,19 @@ void test() {
#if TEST_STD_VER > 20
test(STR(R"('\u{0}')"), STR("?}"), '\x00');
test(STR("'a'"), STR("?}"), 'a');
+# ifndef TEST_HAS_NO_UNICODE
if constexpr (std::same_as<CharT, char>) {
test(STR(R"('\x{80}')"), STR("?}"), '\x80');
test(STR(R"('\x{ff}')"), STR("?}"), '\xff');
}
-# ifndef TEST_HAS_NO_WIDE_CHARACTERS
+# ifndef TEST_HAS_NO_WIDE_CHARACTERS
else {
test(STR(R"('\u{80}')"), STR("?}"), '\x80');
test(STR("'\u00ff'"), STR("?}"), '\xff');
}
-# endif // TEST_HAS_NO_WIDE_CHARACTERS
-#endif // TEST_STD_VER > 20
+# endif // TEST_HAS_NO_WIDE_CHARACTERS
+# endif // TEST_HAS_NO_UNICODE
+#endif // TEST_STD_VER > 20
test(STR("10000000"), STR("b}"), char(-128));
test(STR("11111111"), STR("b}"), char(-1));
diff --git a/libcxx/test/std/utilities/format/format.formatter/format.formatter.spec/formatter.char.funsigned-char.pass.cpp b/libcxx/test/std/utilities/format/format.formatter/format.formatter.spec/formatter.char.funsigned-char.pass.cpp
index 9c31ecad85ea..a7577c1bd934 100644
--- a/libcxx/test/std/utilities/format/format.formatter/format.formatter.spec/formatter.char.funsigned-char.pass.cpp
+++ b/libcxx/test/std/utilities/format/format.formatter/format.formatter.spec/formatter.char.funsigned-char.pass.cpp
@@ -71,16 +71,18 @@ void test() {
#if TEST_STD_VER > 20
test(STR(R"('\u{0}')"), STR("?}"), '\x00');
test(STR("'a'"), STR("?}"), 'a');
+# ifndef TEST_HAS_NO_UNICODE
if constexpr (std::same_as<CharT, char>) {
test(STR(R"('\x{80}')"), STR("?}"), '\x80');
test(STR(R"('\x{ff}')"), STR("?}"), '\xff');
}
-# ifndef TEST_HAS_NO_WIDE_CHARACTERS
+# ifndef TEST_HAS_NO_WIDE_CHARACTERS
else {
test(STR(R"('\u{80}')"), STR("?}"), '\x80');
test(STR("'\u00ff'"), STR("?}"), '\xff');
}
-# endif // TEST_HAS_NO_WIDE_CHARACTERS
+# endif // TEST_HAS_NO_WIDE_CHARACTERS
+# endif // TEST_HAS_NO_UNICODE
#endif // TEST_STD_VER > 20
test(STR("10000000"), STR("b}"), char(128));
diff --git a/libcxx/test/std/utilities/memory/default.allocator/allocator.ctor.pass.cpp b/libcxx/test/std/utilities/memory/default.allocator/allocator.ctor.pass.cpp
index 6e6ff1f2d134..a278bc41ef76 100644
--- a/libcxx/test/std/utilities/memory/default.allocator/allocator.ctor.pass.cpp
+++ b/libcxx/test/std/utilities/memory/default.allocator/allocator.ctor.pass.cpp
@@ -37,12 +37,12 @@ TEST_CONSTEXPR_CXX20 bool test() {
int main(int, char**) {
test<char>();
- test<char const>();
+ test<int>();
test<void>();
#if TEST_STD_VER > 17
static_assert(test<char>());
- static_assert(test<char const>());
+ static_assert(test<int>());
static_assert(test<void>());
#endif
return 0;
diff --git a/libcxx/test/std/utilities/memory/default.allocator/allocator.dtor.pass.cpp b/libcxx/test/std/utilities/memory/default.allocator/allocator.dtor.pass.cpp
index a095ca102491..69c6595c9864 100644
--- a/libcxx/test/std/utilities/memory/default.allocator/allocator.dtor.pass.cpp
+++ b/libcxx/test/std/utilities/memory/default.allocator/allocator.dtor.pass.cpp
@@ -26,15 +26,9 @@ int main(int, char**)
{
test<int>();
test<void>();
-#ifdef _LIBCPP_VERSION // extension
- test<int const>();
-#endif // _LIBCPP_VERSION
static_assert(test<int>());
static_assert(test<void>());
-#ifdef _LIBCPP_VERSION // extension
- static_assert(test<int const>());
-#endif // _LIBCPP_VERSION
return 0;
}
diff --git a/libcxx/test/std/utilities/memory/default.allocator/allocator.members/allocate.constexpr.size.verify.cpp b/libcxx/test/std/utilities/memory/default.allocator/allocator.members/allocate.constexpr.size.verify.cpp
index fbbb334fea0f..34a89e8be859 100644
--- a/libcxx/test/std/utilities/memory/default.allocator/allocator.members/allocate.constexpr.size.verify.cpp
+++ b/libcxx/test/std/utilities/memory/default.allocator/allocator.members/allocate.constexpr.size.verify.cpp
@@ -34,5 +34,4 @@ constexpr bool test()
void f() {
static_assert(test<double>()); // expected-error {{static assertion expression is not an integral constant expression}}
- LIBCPP_STATIC_ASSERT(test<const double>()); // expected-error {{static assertion expression is not an integral constant expression}}
}
diff --git a/libcxx/test/std/utilities/memory/default.allocator/allocator.members/allocate.size.pass.cpp b/libcxx/test/std/utilities/memory/default.allocator/allocator.members/allocate.size.pass.cpp
index 1913a0e0dcc8..2b11bd7f48dd 100644
--- a/libcxx/test/std/utilities/memory/default.allocator/allocator.members/allocate.size.pass.cpp
+++ b/libcxx/test/std/utilities/memory/default.allocator/allocator.members/allocate.size.pass.cpp
@@ -45,7 +45,6 @@ void test()
int main(int, char**)
{
test<double>();
- LIBCPP_ONLY(test<const double>());
return 0;
}
diff --git a/libcxx/test/std/utilities/memory/default.allocator/allocator_types.deprecated_in_cxx17.verify.cpp b/libcxx/test/std/utilities/memory/default.allocator/allocator_types.deprecated_in_cxx17.verify.cpp
index 917492929ecc..96ae6427188c 100644
--- a/libcxx/test/std/utilities/memory/default.allocator/allocator_types.deprecated_in_cxx17.verify.cpp
+++ b/libcxx/test/std/utilities/memory/default.allocator/allocator_types.deprecated_in_cxx17.verify.cpp
@@ -36,13 +36,6 @@ void f() {
typedef std::allocator<char>::rebind<int>::other Rebind; // expected-warning {{'rebind<int>' is deprecated}}
}
{
- typedef std::allocator<char const>::pointer Pointer; // expected-warning {{'pointer' is deprecated}}
- typedef std::allocator<char const>::const_pointer ConstPointer; // expected-warning {{'const_pointer' is deprecated}}
- typedef std::allocator<char const>::reference Reference; // expected-warning {{'reference' is deprecated}}
- typedef std::allocator<char const>::const_reference ConstReference; // expected-warning {{'const_reference' is deprecated}}
- typedef std::allocator<char const>::rebind<int>::other Rebind; // expected-warning {{'rebind<int>' is deprecated}}
- }
- {
typedef std::allocator<void>::pointer Pointer; // expected-warning {{'pointer' is deprecated}}
typedef std::allocator<void>::const_pointer ConstPointer; // expected-warning {{'const_pointer' is deprecated}}
// reference and const_reference are not provided by std::allocator<void>
diff --git a/libcxx/test/std/utilities/memory/default.allocator/allocator_types.deprecated_in_cxx23.verify.cpp b/libcxx/test/std/utilities/memory/default.allocator/allocator_types.deprecated_in_cxx23.verify.cpp
index ad431f94732e..0a27cc712ed6 100644
--- a/libcxx/test/std/utilities/memory/default.allocator/allocator_types.deprecated_in_cxx23.verify.cpp
+++ b/libcxx/test/std/utilities/memory/default.allocator/allocator_types.deprecated_in_cxx23.verify.cpp
@@ -25,7 +25,7 @@ void test() {
typedef std::allocator<char>::is_always_equal IAE; // expected-warning {{'is_always_equal' is deprecated}}
}
{
- typedef std::allocator<const char>::is_always_equal IAE; // expected-warning {{'is_always_equal' is deprecated}}
+ typedef std::allocator<int>::is_always_equal IAE; // expected-warning {{'is_always_equal' is deprecated}}
}
{
typedef std::allocator<void>::is_always_equal IAE; // expected-warning {{'is_always_equal' is deprecated}}
diff --git a/libcxx/test/std/utilities/memory/default.allocator/allocator_types.pass.cpp b/libcxx/test/std/utilities/memory/default.allocator/allocator_types.pass.cpp
index 7085a1d3fc60..581bdced36a0 100644
--- a/libcxx/test/std/utilities/memory/default.allocator/allocator_types.pass.cpp
+++ b/libcxx/test/std/utilities/memory/default.allocator/allocator_types.pass.cpp
@@ -61,8 +61,5 @@ void test() {
int main(int, char**) {
test<char>();
-#ifdef _LIBCPP_VERSION
- test<char const>(); // extension
-#endif
return 0;
}
diff --git a/libcxx/test/std/utilities/memory/default.allocator/allocator_types.removed_in_cxx20.verify.cpp b/libcxx/test/std/utilities/memory/default.allocator/allocator_types.removed_in_cxx20.verify.cpp
index 2fb7a60c9a88..e8c48439b9f4 100644
--- a/libcxx/test/std/utilities/memory/default.allocator/allocator_types.removed_in_cxx20.verify.cpp
+++ b/libcxx/test/std/utilities/memory/default.allocator/allocator_types.removed_in_cxx20.verify.cpp
@@ -39,6 +39,6 @@ void check()
void f() {
check<char>();
- check<char const>();
+ check<int>();
check<void>();
}
diff --git a/libcxx/test/std/utilities/memory/default.allocator/allocator_types.removed_in_cxx26.verify.cpp b/libcxx/test/std/utilities/memory/default.allocator/allocator_types.removed_in_cxx26.verify.cpp
index 72cc21402327..07332ec37bc3 100644
--- a/libcxx/test/std/utilities/memory/default.allocator/allocator_types.removed_in_cxx26.verify.cpp
+++ b/libcxx/test/std/utilities/memory/default.allocator/allocator_types.removed_in_cxx26.verify.cpp
@@ -29,6 +29,6 @@ void check() {
void test() {
check<char>();
- check<char const>();
+ check<int>();
check<void>();
}
diff --git a/libcxx/test/std/utilities/memory/specialized.algorithms/specialized.construct/construct_at.pass.cpp b/libcxx/test/std/utilities/memory/specialized.algorithms/specialized.construct/construct_at.pass.cpp
index 47d4bba51be6..334517861e7b 100644
--- a/libcxx/test/std/utilities/memory/specialized.algorithms/specialized.construct/construct_at.pass.cpp
+++ b/libcxx/test/std/utilities/memory/specialized.algorithms/specialized.construct/construct_at.pass.cpp
@@ -81,7 +81,7 @@ constexpr bool test()
}
{
- std::allocator<Counted const> a;
+ std::allocator<Counted> a;
Counted const* p = a.allocate(2);
int count = 0;
std::construct_at(p, count);
@@ -92,7 +92,7 @@ constexpr bool test()
assert(count == 1);
p->~Counted();
assert(count == 0);
- a.deallocate(p, 2);
+ a.deallocate(const_cast<Counted*>(p), 2);
}
return true;
diff --git a/libcxx/test/std/utilities/memory/temporary.buffer/overaligned.pass.cpp b/libcxx/test/std/utilities/memory/temporary.buffer/overaligned.pass.cpp
index c928ba24f1bf..59cddd406374 100644
--- a/libcxx/test/std/utilities/memory/temporary.buffer/overaligned.pass.cpp
+++ b/libcxx/test/std/utilities/memory/temporary.buffer/overaligned.pass.cpp
@@ -11,7 +11,7 @@
// Aligned allocations are not supported on macOS < 10.13
// Note: use 'unsupported' instead of 'xfail' to ensure
// we won't pass prior to c++17.
-// XFAIL: stdlib=apple-libc++ && target={{.+}}-apple-macosx10.{{9|10|11|12}}
+// XFAIL: stdlib=system && target={{.+}}-apple-macosx10.{{9|10|11|12}}
// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DISABLE_DEPRECATION_WARNINGS
diff --git a/libcxx/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/pointer.pass.cpp b/libcxx/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/pointer.pass.cpp
index 87b0cbde14a3..37ce087ca7ba 100644
--- a/libcxx/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/pointer.pass.cpp
+++ b/libcxx/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/pointer.pass.cpp
@@ -27,12 +27,12 @@ struct A
int A::count = 0;
-struct Derived : A {};
+struct derived : A {};
// https://llvm.org/PR60258
// Invalid constructor SFINAE for std::shared_ptr's array ctors
static_assert( std::is_constructible<std::shared_ptr<int>, int*>::value, "");
-static_assert( std::is_constructible<std::shared_ptr<A>, Derived*>::value, "");
+static_assert( std::is_constructible<std::shared_ptr<A>, derived*>::value, "");
static_assert(!std::is_constructible<std::shared_ptr<A>, int*>::value, "");
#if TEST_STD_VER >= 17
@@ -99,7 +99,7 @@ int main(int, char**)
{
assert(A::count == 0);
- std::shared_ptr<A> pA(new Derived);
+ std::shared_ptr<A> pA(new derived);
assert(pA.use_count() == 1);
assert(A::count == 1);
}
diff --git a/libcxx/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/pointer_deleter.pass.cpp b/libcxx/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/pointer_deleter.pass.cpp
index 562acf56d96f..e8c6316d53df 100644
--- a/libcxx/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/pointer_deleter.pass.cpp
+++ b/libcxx/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/pointer_deleter.pass.cpp
@@ -36,7 +36,7 @@ int A::count = 0;
// Invalid constructor SFINAE for std::shared_ptr's array ctors
static_assert( std::is_constructible<std::shared_ptr<int>, int*, test_deleter<int> >::value, "");
static_assert(!std::is_constructible<std::shared_ptr<int>, int*, bad_deleter>::value, "");
-static_assert( std::is_constructible<std::shared_ptr<Base>, Derived*, test_deleter<Base> >::value, "");
+static_assert( std::is_constructible<std::shared_ptr<base>, derived*, test_deleter<base> >::value, "");
static_assert(!std::is_constructible<std::shared_ptr<A>, int*, test_deleter<A> >::value, "");
#if TEST_STD_VER >= 17
@@ -104,17 +104,36 @@ int main(int, char**)
// Make sure that we can construct a shared_ptr where the element type and pointer type
// aren't "convertible" but are "compatible".
- static_assert(!std::is_constructible<std::shared_ptr<Derived[4]>, Base[4], test_deleter<Derived[4]> >::value, "");
+ static_assert(!std::is_constructible<std::shared_ptr<derived[4]>, base[4], test_deleter<derived[4]> >::value, "");
}
#if TEST_STD_VER >= 11
{
- MoveDeleter<int> d(0);
+ move_deleter<int> d(0);
std::shared_ptr<int> p0(new int, std::move(d));
std::shared_ptr<int> p1(nullptr, std::move(d));
}
#endif // TEST_STD_VER >= 11
+#if TEST_STD_VER >= 14
+ {
+ // LWG 4110
+ auto deleter = [](auto pointer) { delete pointer; };
+ std::shared_ptr<int> p(new int, deleter);
+ }
+
+ {
+ std::shared_ptr<int> p(NULL, [](auto){});
+ }
+#endif
+
+#if TEST_STD_VER >= 17
+ {
+ // See https://github.com/llvm/llvm-project/pull/93071#issuecomment-2166047398
+ std::shared_ptr<char[]> a(new char[10], std::default_delete<char[]>());
+ }
+#endif
+
test_function_type();
return 0;
}
diff --git a/libcxx/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/pointer_deleter_allocator.pass.cpp b/libcxx/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/pointer_deleter_allocator.pass.cpp
index 9dffbcdd59a7..074ef44a1f76 100644
--- a/libcxx/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/pointer_deleter_allocator.pass.cpp
+++ b/libcxx/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/pointer_deleter_allocator.pass.cpp
@@ -35,7 +35,7 @@ int A::count = 0;
// Invalid constructor SFINAE for std::shared_ptr's array ctors
static_assert( std::is_constructible<std::shared_ptr<int>, int*, test_deleter<int>, test_allocator<int> >::value, "");
static_assert(!std::is_constructible<std::shared_ptr<int>, int*, bad_deleter, test_allocator<int> >::value, "");
-static_assert( std::is_constructible<std::shared_ptr<Base>, Derived*, test_deleter<Base>, test_allocator<Base> >::value, "");
+static_assert( std::is_constructible<std::shared_ptr<base>, derived*, test_deleter<base>, test_allocator<base> >::value, "");
static_assert(!std::is_constructible<std::shared_ptr<A>, int*, test_deleter<A>, test_allocator<A> >::value, "");
#if TEST_STD_VER >= 17
@@ -143,7 +143,7 @@ int main(int, char**)
assert(test_deleter<A>::dealloc_count == 1);
{
- MoveDeleter<int> d(0);
+ move_deleter<int> d(0);
std::shared_ptr<int> p2(new int, std::move(d), std::allocator<int>());
std::shared_ptr<int> p3(nullptr, std::move(d), std::allocator<int>());
}
@@ -160,9 +160,9 @@ int main(int, char**)
// Make sure that we can construct a shared_ptr where the element type and pointer type
// aren't "convertible" but are "compatible".
- static_assert(!std::is_constructible<std::shared_ptr<Derived[4]>,
- Base[4], test_deleter<Derived[4]>,
- test_allocator<Derived[4]> >::value, "");
+ static_assert(!std::is_constructible<std::shared_ptr<derived[4]>,
+ base[4], test_deleter<derived[4]>,
+ test_allocator<derived[4]> >::value, "");
}
return 0;
diff --git a/libcxx/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/types.h b/libcxx/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/types.h
index 5bfb3d70febe..32b92b04f248 100644
--- a/libcxx/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/types.h
+++ b/libcxx/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/types.h
@@ -11,10 +11,10 @@
#include <type_traits>
-struct bad_ty {};
+struct bad_type {};
struct bad_deleter {
- void operator()(bad_ty) {}
+ void operator()(bad_type) {}
};
struct no_move_deleter {
@@ -30,18 +30,18 @@ struct no_nullptr_deleter {
void operator()(std::nullptr_t) const = delete;
};
-struct Base {};
-struct Derived : Base {};
+struct base {};
+struct derived : base {};
template <class T>
-class MoveDeleter {
- MoveDeleter();
- MoveDeleter(MoveDeleter const&);
+class move_deleter {
+ move_deleter();
+ move_deleter(move_deleter const&);
public:
- MoveDeleter(MoveDeleter&&) {}
+ move_deleter(move_deleter&&) {}
- explicit MoveDeleter(int) {}
+ explicit move_deleter(int) {}
void operator()(T* ptr) { delete ptr; }
};
diff --git a/libcxx/test/std/utilities/meta/meta.unary/meta.unary.prop/has_unique_object_representations.compile.pass.cpp b/libcxx/test/std/utilities/meta/meta.unary/meta.unary.prop/has_unique_object_representations.compile.pass.cpp
new file mode 100644
index 000000000000..bd7da40daf2b
--- /dev/null
+++ b/libcxx/test/std/utilities/meta/meta.unary/meta.unary.prop/has_unique_object_representations.compile.pass.cpp
@@ -0,0 +1,106 @@
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache 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
+
+// type_traits
+
+// has_unique_object_representations
+
+#include <type_traits>
+
+template <bool ExpectedValue, class T>
+void test() {
+ static_assert(std::has_unique_object_representations<T>::value == ExpectedValue);
+ static_assert(std::has_unique_object_representations<const T>::value == ExpectedValue);
+ static_assert(std::has_unique_object_representations<volatile T>::value == ExpectedValue);
+ static_assert(std::has_unique_object_representations<const volatile T>::value == ExpectedValue);
+
+ static_assert(std::has_unique_object_representations_v<T> == ExpectedValue);
+ static_assert(std::has_unique_object_representations_v<const T> == ExpectedValue);
+ static_assert(std::has_unique_object_representations_v<volatile T> == ExpectedValue);
+ static_assert(std::has_unique_object_representations_v<const volatile T> == ExpectedValue);
+}
+
+class Empty {};
+
+union EmptyUnion {};
+
+struct NonEmptyUnion {
+ int x;
+ unsigned y;
+};
+
+struct ZeroWidthBitfield {
+ int : 0;
+};
+
+class Virtual {
+ virtual ~Virtual();
+};
+
+class Abstract {
+ virtual ~Abstract() = 0;
+};
+
+struct UnsignedInt {
+ unsigned foo;
+};
+
+struct WithoutPadding {
+ int x;
+ int y;
+};
+
+struct WithPadding {
+ char bar;
+ int foo;
+};
+
+template <int>
+class NTTP_ClassType_WithoutPadding {
+ int x;
+};
+
+void test() {
+ test<false, void>();
+ test<false, Empty>();
+ test<false, EmptyUnion>();
+ test<false, Virtual>();
+ test<false, ZeroWidthBitfield>();
+ test<false, Abstract>();
+ test<false, WithPadding>();
+ test<false, WithPadding[]>();
+ test<false, WithPadding[][3]>();
+
+ // I would also expect that there are systems where they do not.
+ // I would expect all three of these to have unique representations.
+ // test<false, int&>();
+ // test<false, int *>();
+ // test<false, double>();
+
+ test<true, unsigned>();
+ test<true, UnsignedInt>();
+ test<true, WithoutPadding>();
+ test<true, NonEmptyUnion>();
+ test<true, char[3]>();
+ test<true, char[3][4]>();
+ test<true, char[3][4][5]>();
+ test<true, char[]>();
+ test<true, char[][2]>();
+ test<true, char[][2][3]>();
+
+ // Important test case for https://github.com/llvm/llvm-project/issues/95311.
+ // Note that the order is important here, we want to instantiate the array
+ // variants before the non-array ones, otherwise we don't trigger the bug.
+ {
+ test<true, NTTP_ClassType_WithoutPadding<0>[]>();
+ test<true, NTTP_ClassType_WithoutPadding<0>[][3]>();
+ test<true, NTTP_ClassType_WithoutPadding<0>>();
+ }
+}
diff --git a/libcxx/test/std/utilities/meta/meta.unary/meta.unary.prop/has_unique_object_representations.pass.cpp b/libcxx/test/std/utilities/meta/meta.unary/meta.unary.prop/has_unique_object_representations.pass.cpp
deleted file mode 100644
index b8b84bb90882..000000000000
--- a/libcxx/test/std/utilities/meta/meta.unary/meta.unary.prop/has_unique_object_representations.pass.cpp
+++ /dev/null
@@ -1,108 +0,0 @@
-//===----------------------------------------------------------------------===//
-//
-// Part of the LLVM Project, under the Apache 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
-
-// type_traits
-
-// has_unique_object_representations
-
-#include <type_traits>
-
-#include "test_macros.h"
-
-template <class T>
-void test_has_unique_object_representations()
-{
- static_assert( std::has_unique_object_representations<T>::value, "");
- static_assert( std::has_unique_object_representations<const T>::value, "");
- static_assert( std::has_unique_object_representations<volatile T>::value, "");
- static_assert( std::has_unique_object_representations<const volatile T>::value, "");
-
- static_assert( std::has_unique_object_representations_v<T>, "");
- static_assert( std::has_unique_object_representations_v<const T>, "");
- static_assert( std::has_unique_object_representations_v<volatile T>, "");
- static_assert( std::has_unique_object_representations_v<const volatile T>, "");
-}
-
-template <class T>
-void test_has_not_has_unique_object_representations()
-{
- static_assert(!std::has_unique_object_representations<T>::value, "");
- static_assert(!std::has_unique_object_representations<const T>::value, "");
- static_assert(!std::has_unique_object_representations<volatile T>::value, "");
- static_assert(!std::has_unique_object_representations<const volatile T>::value, "");
-
- static_assert(!std::has_unique_object_representations_v<T>, "");
- static_assert(!std::has_unique_object_representations_v<const T>, "");
- static_assert(!std::has_unique_object_representations_v<volatile T>, "");
- static_assert(!std::has_unique_object_representations_v<const volatile T>, "");
-}
-
-class Empty
-{
-};
-
-class NotEmpty
-{
- virtual ~NotEmpty();
-};
-
-union EmptyUnion {};
-struct NonEmptyUnion {int x; unsigned y;};
-
-struct bit_zero
-{
- int : 0;
-};
-
-class Abstract
-{
- virtual ~Abstract() = 0;
-};
-
-struct A
-{
- ~A();
- unsigned foo;
-};
-
-struct B
-{
- char bar;
- int foo;
-};
-
-
-int main(int, char**)
-{
- test_has_not_has_unique_object_representations<void>();
- test_has_not_has_unique_object_representations<Empty>();
- test_has_not_has_unique_object_representations<EmptyUnion>();
- test_has_not_has_unique_object_representations<NotEmpty>();
- test_has_not_has_unique_object_representations<bit_zero>();
- test_has_not_has_unique_object_representations<Abstract>();
- test_has_not_has_unique_object_representations<B>();
-
-// I would expect all three of these to have unique representations.
-// I would also expect that there are systems where they do not.
-// test_has_not_has_unique_object_representations<int&>();
-// test_has_not_has_unique_object_representations<int *>();
-// test_has_not_has_unique_object_representations<double>();
-
-
- test_has_unique_object_representations<unsigned>();
- test_has_unique_object_representations<NonEmptyUnion>();
- test_has_unique_object_representations<char[3]>();
- test_has_unique_object_representations<char[3][4]>();
- test_has_unique_object_representations<char[3][4][5]>();
- test_has_unique_object_representations<char[]>();
-
-
- return 0;
-}
diff --git a/libcxx/test/std/utilities/meta/meta.unary/meta.unary.prop/is_nothrow_destructible.pass.cpp b/libcxx/test/std/utilities/meta/meta.unary/meta.unary.prop/is_nothrow_destructible.pass.cpp
index 60d55620f32a..742c9e9288de 100644
--- a/libcxx/test/std/utilities/meta/meta.unary/meta.unary.prop/is_nothrow_destructible.pass.cpp
+++ b/libcxx/test/std/utilities/meta/meta.unary/meta.unary.prop/is_nothrow_destructible.pass.cpp
@@ -56,6 +56,10 @@ struct PurePublicDestructor { public: virtual ~PurePublicDestruc
struct PureProtectedDestructor { protected: virtual ~PureProtectedDestructor() = 0; };
struct PurePrivateDestructor { private: virtual ~PurePrivateDestructor() = 0; };
+struct ExplicitlyNoThrowDestructor {
+ ~ExplicitlyNoThrowDestructor() TEST_NOEXCEPT {}
+};
+
class Empty
{
};
@@ -92,11 +96,12 @@ int main(int, char**)
test_is_nothrow_destructible<PublicDestructor>();
test_is_nothrow_destructible<VirtualPublicDestructor>();
test_is_nothrow_destructible<PurePublicDestructor>();
+#endif
+ test_is_nothrow_destructible<ExplicitlyNoThrowDestructor>();
test_is_nothrow_destructible<bit_zero>();
test_is_nothrow_destructible<Abstract>();
test_is_nothrow_destructible<Empty>();
test_is_nothrow_destructible<Union>();
-#endif
// requires access control
test_is_not_nothrow_destructible<ProtectedDestructor>();
test_is_not_nothrow_destructible<PrivateDestructor>();
diff --git a/libcxx/test/std/utilities/meta/meta.unary/meta.unary.prop/is_swappable_include_order.pass.cpp b/libcxx/test/std/utilities/meta/meta.unary/meta.unary.prop/is_swappable_include_order.pass.cpp
index 5931e7ce7f30..1f1709bca93c 100644
--- a/libcxx/test/std/utilities/meta/meta.unary/meta.unary.prop/is_swappable_include_order.pass.cpp
+++ b/libcxx/test/std/utilities/meta/meta.unary/meta.unary.prop/is_swappable_include_order.pass.cpp
@@ -23,22 +23,21 @@
#include "test_macros.h"
-int main(int, char**)
-{
- // Use a builtin type so we don't get ADL lookup.
- typedef double T[17][29];
- {
- LIBCPP_STATIC_ASSERT(std::__is_swappable<T>::value, "");
+int main(int, char**) {
+ // Use a builtin type so we don't get ADL lookup.
+ typedef double T[17][29];
+ {
+ LIBCPP_STATIC_ASSERT(std::__is_swappable_v<T>, "");
#if TEST_STD_VER > 14
- static_assert(std::is_swappable_v<T>, "");
+ static_assert(std::is_swappable_v<T>, "");
#endif
- }
- {
- T t1 = {};
- T t2 = {};
- std::iter_swap(t1, t2);
- std::swap_ranges(t1, t1 + 17, t2);
- }
+ }
+ {
+ T t1 = {};
+ T t2 = {};
+ std::iter_swap(t1, t2);
+ std::swap_ranges(t1, t1 + 17, t2);
+ }
return 0;
}
diff --git a/libcxx/test/std/utilities/utility/pairs/pairs.pair/nttp.equivalence.compile.pass.cpp b/libcxx/test/std/utilities/utility/pairs/pairs.pair/nttp.equivalence.compile.pass.cpp
new file mode 100644
index 000000000000..db45a56feb88
--- /dev/null
+++ b/libcxx/test/std/utilities/utility/pairs/pairs.pair/nttp.equivalence.compile.pass.cpp
@@ -0,0 +1,74 @@
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache 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, c++17
+// UNSUPPORTED: clang-17
+
+// <utility>
+
+// LWG-3382 NTTP for pair and array:
+// Two values p1 and p2 of type pair<T, U> are template-argument-equivalent ([temp.type]) if and only if
+// p1.first and p2.first are template-argument-equivalent and p1.second and p2.second are template-argument-equivalent.
+
+#include <utility>
+
+#include <type_traits>
+
+int i = 0;
+int j = 1;
+
+namespace test_full_type {
+template <class T, class U, std::pair<T, U> P>
+struct test : std::false_type {};
+
+template <>
+struct test<int&, int, std::pair<int&, int>{i, 5}> : std::true_type {};
+
+static_assert(!test<int*, int*, std::pair<int*, int*>{}>::value);
+static_assert(!test<int*, int, std::pair<int*, int>{}>::value);
+static_assert(!test<int&, int*, std::pair<int&, int*>{i, nullptr}>::value);
+static_assert(!test<int&, int, std::pair<int&, int>{j, 0}>::value);
+static_assert(!test<int&, int, std::pair<int&, int>{j, 5}>::value);
+static_assert(!test<int&, int, std::pair<int&, int>{i, 0}>::value);
+static_assert(!test<int&, unsigned int, std::pair<int&, unsigned int>{j, 0}>::value);
+static_assert(test<int&, int, std::pair<int&, int>{i, 5}>::value);
+} // namespace test_full_type
+
+namespace test_ctad {
+template <std::pair P>
+struct test : std::false_type {};
+
+template <>
+struct test<std::pair<int&, int>{i, 10}> : std::true_type {};
+
+static_assert(!test<std::pair<int*, int*>{}>::value);
+static_assert(!test<std::pair<int*, int>{}>::value);
+static_assert(!test<std::pair<int&, int*>{i, nullptr}>::value);
+static_assert(!test<std::pair<int&, int>{j, 0}>::value);
+static_assert(!test<std::pair<int&, int>{j, 10}>::value);
+static_assert(!test<std::pair<int&, int>{i, 0}>::value);
+static_assert(!test<std::pair<int&, unsigned int>{j, 0}>::value);
+static_assert(test<std::pair<int&, int>{i, 10}>::value);
+} // namespace test_ctad
+
+namespace test_auto {
+template <auto P>
+struct test : std::false_type {};
+
+template <>
+struct test<std::pair<int&, int>{i, 15}> : std::true_type {};
+
+static_assert(!test<std::pair<int*, int*>{}>::value);
+static_assert(!test<std::pair<int*, int>{}>::value);
+static_assert(!test<std::pair<int&, int*>{i, nullptr}>::value);
+static_assert(!test<std::pair<int&, int>{j, 0}>::value);
+static_assert(!test<std::pair<int&, int>{j, 15}>::value);
+static_assert(!test<std::pair<int&, int>{i, 0}>::value);
+static_assert(!test<std::pair<int&, unsigned int>{j, 0}>::value);
+static_assert(test<std::pair<int&, int>{i, 15}>::value);
+} // namespace test_auto
diff --git a/libcxx/test/std/utilities/utility/pairs/pairs.pair/nttp.verify.cpp b/libcxx/test/std/utilities/utility/pairs/pairs.pair/nttp.verify.cpp
new file mode 100644
index 000000000000..ac081495a620
--- /dev/null
+++ b/libcxx/test/std/utilities/utility/pairs/pairs.pair/nttp.verify.cpp
@@ -0,0 +1,97 @@
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache 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, c++17
+// UNSUPPORTED: clang-17
+
+// <utility>
+
+// LWG-3382 NTTP for pair and array:
+// pair<T, U> is a structural type ([temp.param]) if T and U are both structural types.
+
+#include <utility>
+
+#include <functional>
+#include <string>
+
+struct LiteralBase {};
+struct LiteralNSDM {};
+
+struct LiteralType : LiteralBase {
+ LiteralNSDM nsdm;
+};
+
+struct NotALiteral {
+ NotALiteral() {}
+};
+
+int i;
+NotALiteral not_a_literal;
+
+namespace test_full_type {
+template <class T, class U, std::pair<T, U> P>
+struct test {};
+
+using A = test<int, int, std::pair{0, 1}>;
+using B = test<int&, int&, std::make_pair(std::ref(i), std::ref(i))>;
+using C = test<const int&, const int&, std::make_pair(std::cref(i), std::cref(i))>;
+using D = test<LiteralType, LiteralType, std::pair<LiteralType, LiteralType>{}>;
+using E = test<int*, int*, std::pair<int*, int*>{&i, &i}>;
+using F = test<NotALiteral&, NotALiteral&, std::make_pair(std::ref(not_a_literal), std::ref(not_a_literal))>;
+
+using G = test<int&&, int&&, std::pair<int&&, int&&>{std::move(i), std::move(i)}>;
+// expected-error@*:* {{type 'std::pair<int &&, int &&>' of non-type template parameter is not a structural type}}
+
+using H = test<NotALiteral, NotALiteral, std::pair<NotALiteral, NotALiteral>{}>;
+// expected-error@*:* {{non-type template parameter has non-literal type 'std::pair<NotALiteral, NotALiteral>'}}
+
+using I = test<std::string, std::string, std::pair<std::string, std::string>{}>;
+// expected-error-re@*:* {{type 'std::pair<{{(std::)?}}string, {{(std::)?}}string>' {{(\(aka 'pair<basic_string<char>, basic_string<char>>'\) )?}}of non-type template parameter is not a structural type}}
+} // namespace test_full_type
+
+namespace test_ctad {
+template <std::pair P>
+struct test {};
+
+using A = test<std::pair{2, 3}>;
+using B = test<std::make_pair(std::ref(i), std::ref(i))>;
+using C = test<std::make_pair(std::cref(i), std::cref(i))>;
+using D = test<std::pair<LiteralType, LiteralType>{}>;
+using E = test<std::pair<int*, int*>{&i, &i}>;
+using F = test<std::make_pair(std::ref(not_a_literal), std::ref(not_a_literal))>;
+
+using G = test<std::pair<int&&, int&&>{std::move(i), std::move(i)}>;
+// expected-error@-1 {{type 'std::pair<int &&, int &&>' of non-type template parameter is not a structural type}}
+
+using H = test<std::pair<NotALiteral, NotALiteral>{}>;
+// expected-error@-1 {{non-type template parameter has non-literal type 'std::pair<NotALiteral, NotALiteral>'}}
+
+using I = test<std::pair<std::string, std::string>{}>;
+// expected-error@-1 {{type 'std::pair<string, string>' (aka 'std::pair<std::string, std::string>') of non-type template parameter is not a structural type}}
+} // namespace test_ctad
+
+namespace test_auto {
+template <auto P>
+struct test {};
+
+using A = test<std::pair{4, 5}>;
+using B = test<std::make_pair(std::ref(i), std::ref(i))>;
+using C = test<std::make_pair(std::cref(i), std::cref(i))>;
+using D = test<std::pair<LiteralType, LiteralType>{}>;
+using E = test<std::pair<int*, int*>{&i, &i}>;
+using F = test<std::make_pair(std::ref(not_a_literal), std::ref(not_a_literal))>;
+
+using G = test<std::pair<int&&, int&&>{std::move(i), std::move(i)}>;
+// expected-error@-1 {{type 'std::pair<int &&, int &&>' of non-type template parameter is not a structural type}}
+
+using H = test<std::pair<NotALiteral, NotALiteral>{}>;
+// expected-error@-1 {{non-type template parameter has non-literal type 'std::pair<NotALiteral, NotALiteral>'}}
+
+using I = test<std::pair<std::string, std::string>{}>;
+// expected-error@-1 {{type 'std::pair<std::string, std::string>' (aka 'pair<basic_string<char>, basic_string<char>>') of non-type template parameter is not a structural type}}
+} // namespace test_auto
diff --git a/libcxx/test/support/nasty_containers.h b/libcxx/test/support/nasty_containers.h
index 91e3af2e805b..34027f0127ea 100644
--- a/libcxx/test/support/nasty_containers.h
+++ b/libcxx/test/support/nasty_containers.h
@@ -123,13 +123,15 @@ public:
void resize(size_type sz) { v_.resize(sz); }
void resize(size_type sz, const value_type& c) { v_.resize(sz, c); }
- void swap(nasty_vector &nv)
+ void swap(nasty_vector& nv)
#if TEST_STD_VER > 14
- noexcept(std::is_nothrow_swappable<nested_container>::value)
+ noexcept(std::is_nothrow_swappable<nested_container>::value)
#elif defined(_LIBCPP_VERSION)
- TEST_NOEXCEPT_COND(std::__is_nothrow_swappable<nested_container>::value)
+ TEST_NOEXCEPT_COND(std::__is_nothrow_swappable_v<nested_container>)
#endif
- { v_.swap(nv.v_); }
+ {
+ v_.swap(nv.v_);
+ }
nasty_vector *operator &() { assert(false); return nullptr; } // nasty
const nasty_vector *operator &() const { assert(false); return nullptr; } // nasty
@@ -252,13 +254,15 @@ public:
void resize(size_type n) { l_.resize(n); }
void resize(size_type n, const value_type& c) { l_.resize(n, c); }
- void swap(nasty_list &nl)
+ void swap(nasty_list& nl)
#if TEST_STD_VER > 14
- noexcept(std::is_nothrow_swappable<nested_container>::value)
+ noexcept(std::is_nothrow_swappable<nested_container>::value)
#elif defined(_LIBCPP_VERSION)
- TEST_NOEXCEPT_COND(std::__is_nothrow_swappable<nested_container>::value)
+ TEST_NOEXCEPT_COND(std::__is_nothrow_swappable_v<nested_container>)
#endif
- { l_.swap(nl.l_); }
+ {
+ l_.swap(nl.l_);
+ }
void clear() TEST_NOEXCEPT { l_.clear(); }
diff --git a/libcxx/test/support/poisoned_hash_helper.h b/libcxx/test/support/poisoned_hash_helper.h
index 000b08cd37be..a073350c1470 100644
--- a/libcxx/test/support/poisoned_hash_helper.h
+++ b/libcxx/test/support/poisoned_hash_helper.h
@@ -145,7 +145,7 @@ TEST_CONSTEXPR_CXX20 void test_hash_enabled(InputKey const& key) {
#if TEST_STD_VER > 14
static_assert(std::is_swappable<Hash>::value, "");
#elif defined(_LIBCPP_VERSION)
- static_assert(std::__is_swappable<Hash>::value, "");
+ static_assert(std::__is_swappable_v<Hash>, "");
#endif
// Hashable requirements
diff --git a/libcxx/utils/ci/Dockerfile b/libcxx/utils/ci/Dockerfile
index 54dd0f118688..f9e89c80435f 100644
--- a/libcxx/utils/ci/Dockerfile
+++ b/libcxx/utils/ci/Dockerfile
@@ -92,6 +92,7 @@ RUN sudo apt-get update \
python3 \
python3-dev \
python3-distutils \
+ python3-packaging \
python3-psutil \
software-properties-common \
swig4.0 \
diff --git a/libcxx/utils/ci/apple-install-libcxx.sh b/libcxx/utils/ci/apple-install-libcxx.sh
index 15504f58a0f4..ddefabe77264 100755
--- a/libcxx/utils/ci/apple-install-libcxx.sh
+++ b/libcxx/utils/ci/apple-install-libcxx.sh
@@ -127,9 +127,9 @@ for arch in ${architectures}; do
-DCMAKE_OSX_ARCHITECTURES="${arch}" \
-DLIBCXXABI_LIBRARY_VERSION="${version}" \
-DLIBCXX_LIBRARY_VERSION="${version}" \
- -DLIBCXX_TEST_PARAMS="target_triple=${target}" \
- -DLIBCXXABI_TEST_PARAMS="target_triple=${target}" \
- -DLIBUNWIND_TEST_PARAMS="target_triple=${target}"
+ -DLIBCXX_TEST_PARAMS="target_triple=${target};stdlib=apple-libc++" \
+ -DLIBCXXABI_TEST_PARAMS="target_triple=${target};stdlib=apple-libc++" \
+ -DLIBUNWIND_TEST_PARAMS="target_triple=${target};stdlib=apple-libc++"
if [ "$headers_only" = true ]; then
xcrun cmake --build "${build_dir}/${arch}" --target install-cxx-headers install-cxxabi-headers -- -v
diff --git a/libcxx/utils/ci/buildkite-pipeline.yml b/libcxx/utils/ci/buildkite-pipeline.yml
index 4bacdec8f8d6..71d211bfc287 100644
--- a/libcxx/utils/ci/buildkite-pipeline.yml
+++ b/libcxx/utils/ci/buildkite-pipeline.yml
@@ -89,8 +89,8 @@ steps:
<<: *common
# Build with the configuration we use to generate libc++.dylib on Apple platforms
- - label: Apple system
- command: libcxx/utils/ci/run-buildbot apple-system
+ - label: Apple system configuration
+ command: libcxx/utils/ci/run-buildbot apple-configuration
agents:
queue: libcxx-builders
os: macos
diff --git a/libcxx/utils/ci/docker-compose.yml b/libcxx/utils/ci/docker-compose.yml
index 63aa43990b29..28140038725d 100644
--- a/libcxx/utils/ci/docker-compose.yml
+++ b/libcxx/utils/ci/docker-compose.yml
@@ -21,7 +21,7 @@ services:
dockerfile: Dockerfile
target: actions-builder
args:
- BASE_IMAGE: ghcr.io/actions/actions-runner:2.316.1
+ BASE_IMAGE: ghcr.io/actions/actions-runner:2.317.0
<<: *compiler_versions
android-buildkite-builder:
image: ghcr.io/libcxx/android-buildkite-builder:${TAG:-latest}
diff --git a/libcxx/utils/ci/run-buildbot b/libcxx/utils/ci/run-buildbot
index e40c2b635ef9..f1c20b9d7219 100755
--- a/libcxx/utils/ci/run-buildbot
+++ b/libcxx/utils/ci/run-buildbot
@@ -514,7 +514,7 @@ generic-optimized-speed)
generate-cmake -C "${MONOREPO_ROOT}/libcxx/cmake/caches/Generic-optimized-speed.cmake"
check-runtimes
;;
-apple-system)
+apple-configuration)
clean
arch="$(uname -m)"
@@ -703,22 +703,13 @@ clang-cl-static-crt)
;;
mingw-dll)
clean
- # Explicitly specify the compiler with a triple prefix. The CI
- # environment has got two installations of Clang; the default one
- # defaults to MSVC mode, while there's an installation of llvm-mingw
- # further back in PATH. By calling the compiler with an explicit
- # triple prefix, we use the one that is bundled with a mingw sysroot.
generate-cmake \
- -DCMAKE_C_COMPILER=x86_64-w64-mingw32-clang \
- -DCMAKE_CXX_COMPILER=x86_64-w64-mingw32-clang++ \
-C "${MONOREPO_ROOT}/libcxx/cmake/caches/MinGW.cmake"
check-runtimes
;;
mingw-static)
clean
generate-cmake \
- -DCMAKE_C_COMPILER=x86_64-w64-mingw32-clang \
- -DCMAKE_CXX_COMPILER=x86_64-w64-mingw32-clang++ \
-C "${MONOREPO_ROOT}/libcxx/cmake/caches/MinGW.cmake" \
-DLIBCXX_ENABLE_SHARED=OFF \
-DLIBUNWIND_ENABLE_SHARED=OFF
diff --git a/libcxx/utils/generate_escaped_output_table.py b/libcxx/utils/generate_escaped_output_table.py
index c0b21f7731f6..9dcecaa5575c 100755
--- a/libcxx/utils/generate_escaped_output_table.py
+++ b/libcxx/utils/generate_escaped_output_table.py
@@ -84,7 +84,7 @@ def compactPropertyRanges(input: list[PropertyRange]) -> list[PropertyRange]:
return result
-DATA_ARRAY_TEMPLATE = """
+DATA_ARRAY_TEMPLATE = r"""
/// The entries of the characters to escape in format's debug string.
///
/// Contains the entries for [format.string.escaped]/2.2.1.2.1
diff --git a/libcxx/utils/generate_feature_test_macro_components.py b/libcxx/utils/generate_feature_test_macro_components.py
index 490ecefc9752..fe5bab05195a 100755
--- a/libcxx/utils/generate_feature_test_macro_components.py
+++ b/libcxx/utils/generate_feature_test_macro_components.py
@@ -859,6 +859,11 @@ feature_test_macros = [
"libcxx_guard": "_LIBCPP_AVAILABILITY_HAS_PMR",
},
{
+ "name": "__cpp_lib_modules",
+ "values": {"c++23": 202207},
+ "headers": [],
+ },
+ {
"name": "__cpp_lib_move_iterator_concept",
"values": {"c++20": 202207},
"headers": ["iterator"],
@@ -1246,9 +1251,9 @@ feature_test_macros = [
},
{
"name": "__cpp_lib_three_way_comparison",
- "values": {"c++20": 201907},
+ "values": {"c++20": 201711},
+ # {"c++20": 201907} # P1614R2 The Mothership has Landed (see P1902R1 Missing feature-test macros 2017-2019)
"headers": ["compare"],
- "unimplemented": True,
},
{
"name": "__cpp_lib_to_address",
diff --git a/libcxx/utils/generate_width_estimation_table.py b/libcxx/utils/generate_width_estimation_table.py
index 2fe51490449d..f4cce1071d1f 100644
--- a/libcxx/utils/generate_width_estimation_table.py
+++ b/libcxx/utils/generate_width_estimation_table.py
@@ -99,7 +99,7 @@ def compactPropertyRanges(input: list[PropertyRange]) -> list[PropertyRange]:
return result
-DATA_ARRAY_TEMPLATE = """
+DATA_ARRAY_TEMPLATE = r"""
/// The entries of the characters with an estimated width of 2.
///
/// Contains the entries for [format.string.std]/12
diff --git a/libcxx/utils/libcxx/test/dsl.py b/libcxx/utils/libcxx/test/dsl.py
index 7ac66d449b1c..624a00d7e8ed 100644
--- a/libcxx/utils/libcxx/test/dsl.py
+++ b/libcxx/utils/libcxx/test/dsl.py
@@ -308,8 +308,8 @@ def compilerMacros(config, flags=""):
with open(test.getSourcePath(), "w") as sourceFile:
sourceFile.write(
"""
- #if __has_include(<__config_site>)
- # include <__config_site>
+ #if __has_include(<__config>)
+ # include <__config>
#endif
"""
)
diff --git a/libcxx/utils/libcxx/test/features.py b/libcxx/utils/libcxx/test/features.py
index 7a9631a56e4b..f93d9ef70e65 100644
--- a/libcxx/utils/libcxx/test/features.py
+++ b/libcxx/utils/libcxx/test/features.py
@@ -335,10 +335,10 @@ DEFAULT_FEATURES = [
]
# Deduce and add the test features that that are implied by the #defines in
-# the <__config_site> header.
+# the <__config> header.
#
# For each macro of the form `_LIBCPP_XXX_YYY_ZZZ` defined below that
-# is defined after including <__config_site>, add a Lit feature called
+# is defined after including <__config>, add a Lit feature called
# `libcpp-xxx-yyy-zzz`. When a macro is defined to a specific value
# (e.g. `_LIBCPP_ABI_VERSION=2`), the feature is `libcpp-xxx-yyy-zzz=<value>`.
#
@@ -352,12 +352,14 @@ macros = {
"_LIBCPP_NO_VCRUNTIME": "libcpp-no-vcruntime",
"_LIBCPP_ABI_VERSION": "libcpp-abi-version",
"_LIBCPP_ABI_BOUNDED_ITERATORS": "libcpp-has-abi-bounded-iterators",
+ "_LIBCPP_DEPRECATED_ABI_DISABLE_PAIR_TRIVIAL_COPY_CTOR": "libcpp-deprecated-abi-disable-pair-trivial-copy-ctor",
"_LIBCPP_HAS_NO_FILESYSTEM": "no-filesystem",
"_LIBCPP_HAS_NO_RANDOM_DEVICE": "no-random-device",
"_LIBCPP_HAS_NO_LOCALIZATION": "no-localization",
"_LIBCPP_HAS_NO_WIDE_CHARACTERS": "no-wide-characters",
"_LIBCPP_HAS_NO_TIME_ZONE_DATABASE": "no-tzdb",
"_LIBCPP_HAS_NO_UNICODE": "libcpp-has-no-unicode",
+ "_LIBCPP_HAS_NO_VENDOR_AVAILABILITY_ANNOTATIONS": "libcpp-has-no-availability-markup",
"_LIBCPP_PSTL_BACKEND_LIBDISPATCH": "libcpp-pstl-backend-libdispatch",
}
for macro, feature in macros.items():
@@ -579,107 +581,140 @@ DEFAULT_FEATURES += [
)
]
-# Define features for back-deployment testing.
-#
-# These features can be used to XFAIL tests that fail when deployed on (or compiled
-# for) an older system. For example, if a test exhibits a bug in the libc on a
-# particular system version, or if it uses a symbol that is not available on an
-# older version of the dylib, it can be marked as XFAIL with these features.
-#
-# It is sometimes useful to check that a test fails specifically when compiled for a
-# given deployment target. For example, this is the case when testing availability
-# markup, where we want to make sure that using the annotated facility on a deployment
-# target that doesn't support it will fail at compile time, not at runtime. This can
-# be achieved by creating a `.verify.cpp` test that checks for the right errors, and
-# mark that test as requiring `stdlib=<vendor>-libc++ && target=<target>`.
-#
-# Since it is not always known which deployment target to pick there are
-# short-hands based on the LLVM version like using-built-library-before-llvm-xx.
-# These short-hands make it easy for libc++ developers to select the proper
-# version the feature will be available in and allows vendors to set the proper
-# target information.
+# Helpers to define correspondances between LLVM versions and vendor system versions.
+# Those are used for backdeployment features below, do not use directly in tests.
DEFAULT_FEATURES += [
- # Backdeployment short-hands
Feature(
- name="using-built-library-before-llvm-11",
+ name="_target-before-llvm-11",
when=lambda cfg: BooleanExpression.evaluate(
- "stdlib=apple-libc++ && target={{.+}}-apple-macosx{{(10.9|10.10|10.11|10.12|10.13|10.14|10.15|11.0)(.0)?}}",
+ "target={{.+}}-apple-macosx{{(10.13|10.14|10.15)(.0)?}}",
cfg.available_features,
),
),
Feature(
- name="using-built-library-before-llvm-12",
+ name="_target-before-llvm-12",
when=lambda cfg: BooleanExpression.evaluate(
- "using-built-library-before-llvm-11 || (stdlib=apple-libc++ && target={{.+}}-apple-macosx12.{{(0|1|2)}}.0)",
+ "_target-before-llvm-11 || target={{.+}}-apple-macosx{{(11(.\d+)?|12.[0-2])(.0)?}}",
cfg.available_features,
),
),
-
Feature(
- name="using-built-library-before-llvm-13",
+ name="_target-before-llvm-13",
when=lambda cfg: BooleanExpression.evaluate(
- "using-built-library-before-llvm-12 || (stdlib=apple-libc++ && target={{.+}}-apple-macosx{{((12.(3|4|5|6|7))|(13.(0|1|2|3)))}}.0)",
+ "_target-before-llvm-12 || target={{.+}}-apple-macosx{{(12.[3-7]|13.[0-3])(.0)?}}",
cfg.available_features,
),
),
-
Feature(
- name="using-built-library-before-llvm-14",
+ name="_target-before-llvm-14",
when=lambda cfg: BooleanExpression.evaluate(
- "using-built-library-before-llvm-13",
+ "_target-before-llvm-13",
cfg.available_features,
),
),
-
Feature(
- name="using-built-library-before-llvm-15",
+ name="_target-before-llvm-15",
when=lambda cfg: BooleanExpression.evaluate(
- "using-built-library-before-llvm-14 || (stdlib=apple-libc++ && target={{.+}}-apple-macosx13.{{(4|5|6)}}.0)",
+ "_target-before-llvm-14 || target={{.+}}-apple-macosx{{13.[4-6](.0)?}}",
cfg.available_features,
),
),
-
Feature(
- name="using-built-library-before-llvm-16",
+ name="_target-before-llvm-16",
when=lambda cfg: BooleanExpression.evaluate(
- "using-built-library-before-llvm-15 || (stdlib=apple-libc++ && target={{.+}}-apple-macosx14.{{(0|1|2|3)}}.0)",
+ "_target-before-llvm-15 || target={{.+}}-apple-macosx{{12.[0-3](.0)?}}",
cfg.available_features,
),
),
-
Feature(
- name="using-built-library-before-llvm-17",
+ name="_target-before-llvm-17",
when=lambda cfg: BooleanExpression.evaluate(
- "using-built-library-before-llvm-16",
+ "_target-before-llvm-16",
cfg.available_features,
),
),
-
+ # For now, no released version of macOS contains LLVM 18
+ # TODO(ldionne) Please provide the correct value.
Feature(
- name="using-built-library-before-llvm-18",
+ name="_target-before-llvm-18",
when=lambda cfg: BooleanExpression.evaluate(
- # For now, no released version of macOS contains LLVM 18
- # TODO(ldionne) Please provide the correct value.
- "using-built-library-before-llvm-17 || stdlib=apple-libc++ && target={{.+}}-apple-macosx{{.+}}",
+ "_target-before-llvm-17 || target={{.+}}-apple-macosx{{.+}}",
cfg.available_features,
),
),
-
+ # For now, no released version of macOS contains LLVM 19
+ # TODO(ldionne) Please provide the correct value.
Feature(
- name="using-built-library-before-llvm-19",
+ name="_target-before-llvm-19",
when=lambda cfg: BooleanExpression.evaluate(
- # For now, no released version of macOS contains LLVM 19
- # TODO(ldionne) Please provide the correct value.
- "using-built-library-before-llvm-18 || stdlib=apple-libc++ && target={{.+}}-apple-macosx{{.+}}",
+ "_target-before-llvm-18 || target={{.+}}-apple-macosx{{.+}}",
cfg.available_features,
),
),
+]
- # Tests that require std::to_chars(floating-point) in the built library
+# Define features for back-deployment testing.
+#
+# These features can be used to XFAIL tests that fail when deployed on (or compiled
+# for) an older system. For example, if a test exhibits a bug in the libc++ on a
+# particular system version, or if it uses a symbol that is not available on an
+# older version of the dylib, it can be marked as XFAIL with these features.
+#
+# We have two families of Lit features:
+#
+# The first one is `using-built-library-before-llvm-XYZ`. These features encode the
+# fact that the test suite is being *run* against a version of the shared/static library
+# that predates LLVM version XYZ. This is useful to represent the use case of compiling
+# a program against the latest libc++ but then deploying it and running it on an older
+# system with an older version of the (usually shared) library.
+#
+# This feature is built up using the target triple passed to the compiler and the
+# `stdlib=system` Lit feature, which encodes that we're running against the same library
+# as described by the target triple.
+#
+# The second set of features is `availability-<FEATURE>-missing`. This family of Lit
+# features encodes the presence of availability markup in the libc++ headers. This is
+# useful to check that a test fails specifically when compiled for a given deployment
+# target, such as when testing availability markup where we want to make sure that
+# using the annotated facility on a deployment target that doesn't support it will fail
+# at compile time. This can be achieved by creating a `.verify.cpp` test that checks for
+# the right errors and marking the test as `REQUIRES: availability-<FEATURE>-missing`.
+#
+# This feature is built up using the presence of availability markup detected inside
+# __config, the flavor of the library being tested and the target triple passed to the
+# compiler.
+#
+# Note that both families of Lit features are similar but different in important ways.
+# For example, tests for availability markup should be expected to produce diagnostics
+# regardless of whether we're running against a system library, as long as we're using
+# a libc++ flavor that enables availability markup. Similarly, a test could fail when
+# run against the system library of an older version of FreeBSD, even though FreeBSD
+# doesn't provide availability markup at the time of writing this.
+for version in ("11", "12", "13", "14", "15", "16", "17", "18", "19"):
+ DEFAULT_FEATURES.append(
+ Feature(
+ name="using-built-library-before-llvm-{}".format(version),
+ when=lambda cfg: BooleanExpression.evaluate(
+ "stdlib=system && _target-before-llvm-{}".format(version),
+ cfg.available_features,
+ ),
+ )
+ )
+
+DEFAULT_FEATURES += [
+ # Tests that require std::filesystem support in the built library
Feature(
- name="availability-fp_to_chars-missing",
+ name="availability-filesystem-missing",
when=lambda cfg: BooleanExpression.evaluate(
- "using-built-library-before-llvm-13",
+ "!libcpp-has-no-availability-markup && (stdlib=apple-libc++ && target={{.+}}-apple-macosx10.{{(13|14)(.0)?}})",
+ cfg.available_features,
+ ),
+ ),
+ # Tests that require the C++20 synchronization library (P1135R6 implemented by https://llvm.org/D68480) in the built library
+ Feature(
+ name="availability-synchronization_library-missing",
+ when=lambda cfg: BooleanExpression.evaluate(
+ "!libcpp-has-no-availability-markup && (stdlib=apple-libc++ && _target-before-llvm-11)",
cfg.available_features,
),
),
@@ -687,7 +722,7 @@ DEFAULT_FEATURES += [
Feature(
name="availability-char8_t_support-missing",
when=lambda cfg: BooleanExpression.evaluate(
- "using-built-library-before-llvm-11",
+ "!libcpp-has-no-availability-markup && (stdlib=apple-libc++ && _target-before-llvm-12)",
cfg.available_features,
),
),
@@ -695,7 +730,7 @@ DEFAULT_FEATURES += [
Feature(
name="availability-verbose_abort-missing",
when=lambda cfg: BooleanExpression.evaluate(
- "using-built-library-before-llvm-13",
+ "!libcpp-has-no-availability-markup && (stdlib=apple-libc++ && _target-before-llvm-13)",
cfg.available_features,
),
),
@@ -703,23 +738,23 @@ DEFAULT_FEATURES += [
Feature(
name="availability-pmr-missing",
when=lambda cfg: BooleanExpression.evaluate(
- "using-built-library-before-llvm-13",
+ "!libcpp-has-no-availability-markup && (stdlib=apple-libc++ && _target-before-llvm-13)",
cfg.available_features,
),
),
- # Tests that require std::filesystem support in the built library
+ # Tests that require std::to_chars(floating-point) in the built library
Feature(
- name="availability-filesystem-missing",
+ name="availability-fp_to_chars-missing",
when=lambda cfg: BooleanExpression.evaluate(
- "stdlib=apple-libc++ && target={{.+}}-apple-macosx10.{{(13|14)(.0)?}}",
+ "!libcpp-has-no-availability-markup && (stdlib=apple-libc++ && _target-before-llvm-14)",
cfg.available_features,
),
),
- # Tests that require the C++20 synchronization library (P1135R6 implemented by https://llvm.org/D68480) in the built library
+ # Tests that require support for <print> and std::print in <ostream> in the built library.
Feature(
- name="availability-synchronization_library-missing",
+ name="availability-print-missing",
when=lambda cfg: BooleanExpression.evaluate(
- "stdlib=apple-libc++ && target={{.+}}-apple-macosx10.{{(13|14|15)(.0)?}}",
+ "!libcpp-has-no-availability-markup && (stdlib=apple-libc++ && _target-before-llvm-18)",
cfg.available_features,
),
),
@@ -727,15 +762,7 @@ DEFAULT_FEATURES += [
Feature(
name="availability-tzdb-missing",
when=lambda cfg: BooleanExpression.evaluate(
- "using-built-library-before-llvm-19",
- cfg.available_features,
- ),
- ),
- # Tests that require support for <print> and std::print in <ostream> in the built library.
- Feature(
- name="availability-print-missing",
- when=lambda cfg: BooleanExpression.evaluate(
- "using-built-library-before-llvm-18",
+ "!libcpp-has-no-availability-markup && (stdlib=apple-libc++ && _target-before-llvm-19)",
cfg.available_features,
),
),
diff --git a/libcxx/utils/libcxx/test/params.py b/libcxx/utils/libcxx/test/params.py
index 4c8590a2135d..ea841acf3a3d 100644
--- a/libcxx/utils/libcxx/test/params.py
+++ b/libcxx/utils/libcxx/test/params.py
@@ -265,6 +265,19 @@ DEFAULT_PARAMETERS = [
),
),
Parameter(
+ name="using_system_stdlib",
+ choices=[True, False],
+ type=bool,
+ default=False,
+ help="""Whether the Standard Library being tested is the one that shipped with the system by default.
+
+ This is different from the 'stdlib' parameter, which describes the flavor of libc++ being
+ tested. 'using_system_stdlib' describes whether the target system passed with 'target_triple'
+ also corresponds to the version of the library being tested.
+ """,
+ actions=lambda is_system: [AddFeature("stdlib=system")] if is_system else [],
+ ),
+ Parameter(
name="enable_warnings",
choices=[True, False],
type=bool,