aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/CMakeLists.txt13
-rw-r--r--test/libcxx/algorithms/alg.modifying.operations/alg.random.shuffle/random_shuffle.cxx1z.pass.cpp4
-rw-r--r--test/libcxx/algorithms/alg.modifying.operations/alg.random.shuffle/random_shuffle.depr_in_cxx14.fail.cpp50
-rw-r--r--test/libcxx/algorithms/debug_less.pass.cpp51
-rw-r--r--test/libcxx/algorithms/half_positive.pass.cpp56
-rw-r--r--test/libcxx/containers/associative/non_const_comparator.fail.cpp3
-rw-r--r--test/libcxx/containers/sequences/deque/pop_back_empty.pass.cpp (renamed from test/libcxx/type_traits/is_floating_point.pass.cpp)26
-rw-r--r--test/libcxx/containers/sequences/vector/db_back.pass.cpp3
-rw-r--r--test/libcxx/containers/sequences/vector/db_cback.pass.cpp3
-rw-r--r--test/libcxx/containers/sequences/vector/db_cfront.pass.cpp3
-rw-r--r--test/libcxx/containers/sequences/vector/db_cindex.pass.cpp3
-rw-r--r--test/libcxx/containers/sequences/vector/db_front.pass.cpp3
-rw-r--r--test/libcxx/containers/sequences/vector/db_index.pass.cpp3
-rw-r--r--test/libcxx/containers/sequences/vector/db_iterators_2.pass.cpp3
-rw-r--r--test/libcxx/containers/sequences/vector/db_iterators_3.pass.cpp3
-rw-r--r--test/libcxx/containers/sequences/vector/db_iterators_4.pass.cpp3
-rw-r--r--test/libcxx/containers/sequences/vector/db_iterators_5.pass.cpp3
-rw-r--r--test/libcxx/containers/sequences/vector/db_iterators_6.pass.cpp3
-rw-r--r--test/libcxx/containers/sequences/vector/db_iterators_7.pass.cpp3
-rw-r--r--test/libcxx/containers/sequences/vector/db_iterators_8.pass.cpp3
-rw-r--r--test/libcxx/containers/sequences/vector/pop_back_empty.pass.cpp26
-rw-r--r--test/libcxx/containers/sequences/vector/vector.cons/construct_iter_iter.pass.cpp54
-rw-r--r--test/libcxx/containers/sequences/vector/vector.cons/construct_iter_iter_alloc.pass.cpp57
-rw-r--r--test/libcxx/containers/unord/non_const_comparator.fail.cpp8
-rw-r--r--test/libcxx/containers/unord/unord.map/db_iterators_7.pass.cpp3
-rw-r--r--test/libcxx/containers/unord/unord.map/db_iterators_8.pass.cpp3
-rw-r--r--test/libcxx/containers/unord/unord.map/db_local_iterators_7.pass.cpp3
-rw-r--r--test/libcxx/containers/unord/unord.map/db_local_iterators_8.pass.cpp3
-rw-r--r--test/libcxx/depr/depr.auto.ptr/auto.ptr/auto_ptr.depr_in_cxx11.fail.cpp39
-rw-r--r--test/libcxx/depr/depr.function.objects/adaptors.depr_in_cxx11.fail.cpp59
-rw-r--r--test/libcxx/depr/depr.function.objects/depr.adaptors.cxx1z.pass.cpp22
-rw-r--r--test/libcxx/diagnostics/enable_nodiscard.fail.cpp33
-rw-r--r--test/libcxx/diagnostics/enable_nodiscard_disable_after_cxx17.fail.cpp33
-rw-r--r--test/libcxx/diagnostics/enable_nodiscard_disable_nodiscard_ext.fail.cpp31
-rw-r--r--test/libcxx/diagnostics/nodiscard.pass.cpp15
-rw-r--r--test/libcxx/diagnostics/nodiscard_aftercxx17.fail.cpp (renamed from test/libcxx/diagnostics/nodiscard.fail.cpp)1
-rw-r--r--test/libcxx/diagnostics/nodiscard_aftercxx17.pass.cpp (renamed from test/libcxx/experimental/containers/sequences/dynarray/dynarray.traits/default.pass.cpp)21
-rw-r--r--test/libcxx/diagnostics/nodiscard_extensions.fail.cpp35
-rw-r--r--test/libcxx/diagnostics/nodiscard_extensions.pass.cpp29
-rw-r--r--test/libcxx/double_include.sh.cpp2
-rw-r--r--test/libcxx/experimental/containers/sequences/dynarray/dynarray.cons/alloc.pass.cpp83
-rw-r--r--test/libcxx/experimental/containers/sequences/dynarray/dynarray.cons/default.pass.cpp102
-rw-r--r--test/libcxx/experimental/containers/sequences/dynarray/dynarray.cons/default_throws_bad_alloc.pass.cpp35
-rw-r--r--test/libcxx/experimental/containers/sequences/dynarray/dynarray.data/default.pass.cpp69
-rw-r--r--test/libcxx/experimental/containers/sequences/dynarray/dynarray.mutate/default.pass.cpp47
-rw-r--r--test/libcxx/experimental/containers/sequences/dynarray/dynarray.overview/at.pass.cpp94
-rw-r--r--test/libcxx/experimental/containers/sequences/dynarray/dynarray.overview/begin_end.pass.cpp110
-rw-r--r--test/libcxx/experimental/containers/sequences/dynarray/dynarray.overview/capacity.pass.cpp56
-rw-r--r--test/libcxx/experimental/containers/sequences/dynarray/dynarray.overview/front_back.pass.cpp74
-rw-r--r--test/libcxx/experimental/containers/sequences/dynarray/dynarray.overview/indexing.pass.cpp76
-rw-r--r--test/libcxx/experimental/containers/sequences/dynarray/dynarray.zero/default.pass.cpp48
-rw-r--r--test/libcxx/experimental/containers/sequences/dynarray/lit.local.cfg3
-rw-r--r--test/libcxx/experimental/diagnostics/syserr/use_header_warning.fail.cpp18
-rw-r--r--test/libcxx/experimental/diagnostics/syserr/version.pass.cpp21
-rw-r--r--test/libcxx/experimental/memory/memory.polymorphic.allocator.class/memory.polymorphic.allocator.mem/construct_piecewise_pair.pass.cpp7
-rw-r--r--test/libcxx/experimental/memory/memory.resource.adaptor/memory.resource.adaptor.mem/db_deallocate.pass.cpp2
-rw-r--r--test/libcxx/experimental/numerics/numeric.ops/use_header_warning.fail.cpp18
-rw-r--r--test/libcxx/experimental/numerics/numeric.ops/version.pass.cpp21
-rw-r--r--test/libcxx/experimental/strings/string.view/use_header_warning.fail.cpp18
-rw-r--r--test/libcxx/experimental/strings/string.view/version.pass.cpp21
-rw-r--r--test/libcxx/experimental/utilities/any/use_header_warning.fail.cpp18
-rw-r--r--test/libcxx/experimental/utilities/any/version.pass.cpp21
-rw-r--r--test/libcxx/experimental/utilities/optional/use_header_warning.fail.cpp18
-rw-r--r--test/libcxx/experimental/utilities/optional/version.pass.cpp21
-rw-r--r--test/libcxx/experimental/utilities/ratio/use_header_warning.fail.cpp18
-rw-r--r--test/libcxx/experimental/utilities/ratio/version.pass.cpp21
-rw-r--r--test/libcxx/experimental/utilities/time/use_header_warning.fail.cpp18
-rw-r--r--test/libcxx/experimental/utilities/time/version.pass.cpp21
-rw-r--r--test/libcxx/experimental/utilities/tuple/use_header_warning.fail.cpp18
-rw-r--r--test/libcxx/experimental/utilities/tuple/version.pass.cpp21
-rw-r--r--test/libcxx/input.output/file.streams/fstreams/fstream.close.pass.cpp35
-rw-r--r--test/libcxx/language.support/cxa_deleted_virtual.pass.cpp1
-rw-r--r--test/libcxx/language.support/has_c11_features.pass.cpp3
-rw-r--r--test/libcxx/language.support/support.dynamic/libcpp_deallocate.sh.cpp260
-rw-r--r--test/libcxx/language.support/support.dynamic/new_faligned_allocation.sh.cpp8
-rw-r--r--test/libcxx/libcpp_alignof.pass.cpp37
-rw-r--r--test/libcxx/memory/aligned_allocation_macro.pass.cpp (renamed from test/libcxx/language.support/support.dynamic/alloc.errors/new.badlength/bad_array_length.pass.cpp)32
-rw-r--r--test/libcxx/min_max_macros.sh.cpp4
-rw-r--r--test/libcxx/strings/basic.string/string.modifiers/erase_iter_db1.pass.cpp3
-rw-r--r--test/libcxx/strings/basic.string/string.modifiers/erase_iter_db2.pass.cpp3
-rw-r--r--test/libcxx/strings/basic.string/string.modifiers/erase_iter_iter_db1.pass.cpp3
-rw-r--r--test/libcxx/strings/basic.string/string.modifiers/erase_iter_iter_db2.pass.cpp3
-rw-r--r--test/libcxx/strings/basic.string/string.modifiers/erase_iter_iter_db3.pass.cpp3
-rw-r--r--test/libcxx/strings/basic.string/string.modifiers/erase_iter_iter_db4.pass.cpp3
-rw-r--r--test/libcxx/strings/basic.string/string.modifiers/resize_default_initialized.pass.cpp63
-rw-r--r--test/libcxx/thread/thread.mutex/thread_safety_lock_guard.pass.cpp10
-rw-r--r--test/libcxx/thread/thread.threads/thread.thread.this/sleep_for.pass.cpp1
-rw-r--r--test/libcxx/utilities/optional/optional.object/triviality.abi.pass.cpp (renamed from test/std/utilities/optional/optional.object/special_member_gen.pass.cpp)32
-rw-r--r--test/libcxx/utilities/utility/pairs/pairs.pair/U_V.pass.cpp54
-rw-r--r--test/libcxx/utilities/utility/pairs/pairs.pair/const_first_const_second.pass.cpp62
-rw-r--r--test/libcxx/utilities/utility/pairs/pairs.pair/const_pair_U_V.pass.cpp64
-rw-r--r--test/libcxx/utilities/utility/pairs/pairs.pair/default.pass.cpp36
-rw-r--r--test/libcxx/utilities/utility/pairs/pairs.pair/non_trivial_copy_move_ABI.pass.cpp15
-rw-r--r--test/libcxx/utilities/utility/pairs/pairs.pair/pair.tuple_element.fail.cpp2
-rw-r--r--test/libcxx/utilities/utility/pairs/pairs.pair/piecewise.pass.cpp38
-rw-r--r--test/libcxx/utilities/utility/pairs/pairs.pair/rv_pair_U_V.pass.cpp63
-rw-r--r--test/libcxx/utilities/utility/pairs/pairs.pair/trivial_copy_move_ABI.pass.cpp15
-rw-r--r--test/libcxx/utilities/variant/variant.variant/variant.helper/variant_alternative.fail.cpp2
-rw-r--r--test/libcxx/utilities/variant/variant.variant/variant_size.pass.cpp3
-rw-r--r--test/std/algorithms/alg.modifying.operations/alg.random.sample/sample.fail.cpp2
-rw-r--r--test/std/algorithms/alg.nonmodifying/alg.find.end/find_end_pred.pass.cpp1
-rw-r--r--test/std/algorithms/alg.nonmodifying/alg.is_permutation/is_permutation_pred.pass.cpp20
-rw-r--r--test/std/algorithms/alg.sorting/alg.min.max/requires_forward_iterator.fail.cpp37
-rw-r--r--test/std/atomics/atomics.lockfree/isalwayslockfree.pass.cpp4
-rw-r--r--test/std/containers/Emplaceable.h2
-rw-r--r--test/std/containers/associative/map/map.access/at.pass.cpp3
-rw-r--r--test/std/containers/associative/map/map.access/index_key.pass.cpp1
-rw-r--r--test/std/containers/associative/map/map.access/index_rv_key.pass.cpp1
-rw-r--r--test/std/containers/associative/map/map.access/max_size.pass.cpp22
-rw-r--r--test/std/containers/associative/map/map.erasure/erase_if.pass.cpp79
-rw-r--r--test/std/containers/associative/map/map.modifiers/clear.pass.cpp5
-rw-r--r--test/std/containers/associative/map/map.modifiers/merge.pass.cpp150
-rw-r--r--test/std/containers/associative/multimap/max_size.pass.cpp22
-rw-r--r--test/std/containers/associative/multimap/multimap.erasure/erase_if.pass.cpp89
-rw-r--r--test/std/containers/associative/multimap/multimap.modifiers/clear.pass.cpp5
-rw-r--r--test/std/containers/associative/multimap/multimap.modifiers/merge.pass.cpp150
-rw-r--r--test/std/containers/associative/multiset/clear.pass.cpp5
-rw-r--r--test/std/containers/associative/multiset/insert_emplace_allocator_requirements.pass.cpp (renamed from test/std/containers/associative/multiset/insert_allocator_requirements.pass.cpp)1
-rw-r--r--test/std/containers/associative/multiset/max_size.pass.cpp8
-rw-r--r--test/std/containers/associative/multiset/merge.pass.cpp149
-rw-r--r--test/std/containers/associative/multiset/multiset.erasure/erase_if.pass.cpp78
-rw-r--r--test/std/containers/associative/set/clear.pass.cpp5
-rw-r--r--test/std/containers/associative/set/max_size.pass.cpp8
-rw-r--r--test/std/containers/associative/set/merge.pass.cpp149
-rw-r--r--test/std/containers/associative/set/set.erasure/erase_if.pass.cpp67
-rw-r--r--test/std/containers/container.adaptors/queue/queue.defn/emplace.pass.cpp2
-rw-r--r--test/std/containers/container.adaptors/stack/stack.defn/emplace.pass.cpp2
-rw-r--r--test/std/containers/container.node/node_handle.pass.cpp4
-rw-r--r--test/std/containers/map_allocator_requirement_test_templates.h8
-rw-r--r--test/std/containers/sequences/array/array.data/data.pass.cpp18
-rw-r--r--test/std/containers/sequences/array/array.data/data_const.pass.cpp12
-rw-r--r--test/std/containers/sequences/array/array.tuple/get.fail.cpp2
-rw-r--r--test/std/containers/sequences/array/array.tuple/tuple_element.fail.cpp2
-rw-r--r--test/std/containers/sequences/array/begin.pass.cpp16
-rw-r--r--test/std/containers/sequences/array/compare.pass.cpp33
-rw-r--r--test/std/containers/sequences/array/size_and_alignment.pass.cpp2
-rw-r--r--test/std/containers/sequences/deque/deque.capacity/max_size.pass.cpp8
-rw-r--r--test/std/containers/sequences/deque/deque.erasure/erase.pass.cpp78
-rw-r--r--test/std/containers/sequences/deque/deque.erasure/erase_if.pass.cpp78
-rw-r--r--test/std/containers/sequences/deque/deque.modifiers/clear.pass.cpp67
-rw-r--r--test/std/containers/sequences/deque/deque.modifiers/erase_iter.pass.cpp32
-rw-r--r--test/std/containers/sequences/deque/deque.modifiers/erase_iter_iter.pass.cpp32
-rw-r--r--test/std/containers/sequences/forwardlist/forwardlist.erasure/erase.pass.cpp78
-rw-r--r--test/std/containers/sequences/forwardlist/forwardlist.erasure/erase_if.pass.cpp78
-rw-r--r--test/std/containers/sequences/forwardlist/forwardlist.modifiers/clear.pass.cpp7
-rw-r--r--test/std/containers/sequences/forwardlist/forwardlist.modifiers/resize_size_value.pass.cpp1
-rw-r--r--test/std/containers/sequences/forwardlist/max_size.pass.cpp8
-rw-r--r--test/std/containers/sequences/list/list.capacity/max_size.pass.cpp8
-rw-r--r--test/std/containers/sequences/list/list.cons/input_iterator.pass.cpp4
-rw-r--r--test/std/containers/sequences/list/list.erasure/erase.pass.cpp78
-rw-r--r--test/std/containers/sequences/list/list.erasure/erase_if.pass.cpp78
-rw-r--r--test/std/containers/sequences/list/list.modifiers/clear.pass.cpp5
-rw-r--r--test/std/containers/sequences/list/list.ops/merge.pass.cpp11
-rw-r--r--test/std/containers/sequences/list/list.ops/merge_comp.pass.cpp10
-rw-r--r--test/std/containers/sequences/vector.bool/construct_default.pass.cpp17
-rw-r--r--test/std/containers/sequences/vector.bool/default_noexcept.pass.cpp6
-rw-r--r--test/std/containers/sequences/vector.bool/move.pass.cpp12
-rw-r--r--test/std/containers/sequences/vector/vector.capacity/max_size.pass.cpp8
-rw-r--r--test/std/containers/sequences/vector/vector.cons/construct_iter_iter.pass.cpp33
-rw-r--r--test/std/containers/sequences/vector/vector.cons/construct_iter_iter_alloc.pass.cpp2
-rw-r--r--test/std/containers/sequences/vector/vector.cons/default_noexcept.pass.cpp4
-rw-r--r--test/std/containers/sequences/vector/vector.cons/move.pass.cpp1
-rw-r--r--test/std/containers/sequences/vector/vector.erasure/erase.pass.cpp78
-rw-r--r--test/std/containers/sequences/vector/vector.erasure/erase_if.pass.cpp78
-rw-r--r--test/std/containers/sequences/vector/vector.modifiers/clear.pass.cpp5
-rw-r--r--test/std/containers/sequences/vector/vector.modifiers/insert_iter_iter_iter.pass.cpp56
-rw-r--r--test/std/containers/set_allocator_requirement_test_templates.h49
-rw-r--r--test/std/containers/unord/unord.map/compare.pass.cpp3
-rw-r--r--test/std/containers/unord/unord.map/erase_if.pass.cpp80
-rw-r--r--test/std/containers/unord/unord.map/max_size.pass.cpp8
-rw-r--r--test/std/containers/unord/unord.map/unord.map.cnstr/assign_copy.pass.cpp2
-rw-r--r--test/std/containers/unord/unord.map/unord.map.cnstr/assign_init.pass.cpp1
-rw-r--r--test/std/containers/unord/unord.map/unord.map.cnstr/assign_move.pass.cpp1
-rw-r--r--test/std/containers/unord/unord.map/unord.map.cnstr/init.pass.cpp1
-rw-r--r--test/std/containers/unord/unord.map/unord.map.cnstr/range.pass.cpp1
-rw-r--r--test/std/containers/unord/unord.map/unord.map.elem/at.pass.cpp5
-rw-r--r--test/std/containers/unord/unord.map/unord.map.elem/index.pass.cpp1
-rw-r--r--test/std/containers/unord/unord.map/unord.map.modifiers/clear.pass.cpp5
-rw-r--r--test/std/containers/unord/unord.map/unord.map.modifiers/merge.pass.cpp157
-rw-r--r--test/std/containers/unord/unord.multimap/equal_range_const.pass.cpp39
-rw-r--r--test/std/containers/unord/unord.multimap/equal_range_non_const.pass.cpp39
-rw-r--r--test/std/containers/unord/unord.multimap/erase_if.pass.cpp90
-rw-r--r--test/std/containers/unord/unord.multimap/local_iterators.pass.cpp273
-rw-r--r--test/std/containers/unord/unord.multimap/max_size.pass.cpp8
-rw-r--r--test/std/containers/unord/unord.multimap/rehash.pass.cpp36
-rw-r--r--test/std/containers/unord/unord.multimap/reserve.pass.cpp23
-rw-r--r--test/std/containers/unord/unord.multimap/swap_member.pass.cpp121
-rw-r--r--test/std/containers/unord/unord.multimap/unord.multimap.cnstr/assign_copy.pass.cpp2
-rw-r--r--test/std/containers/unord/unord.multimap/unord.multimap.cnstr/assign_init.pass.cpp1
-rw-r--r--test/std/containers/unord/unord.multimap/unord.multimap.cnstr/assign_move.pass.cpp1
-rw-r--r--test/std/containers/unord/unord.multimap/unord.multimap.cnstr/init.pass.cpp1
-rw-r--r--test/std/containers/unord/unord.multimap/unord.multimap.cnstr/range.pass.cpp1
-rw-r--r--test/std/containers/unord/unord.multimap/unord.multimap.modifiers/clear.pass.cpp5
-rw-r--r--test/std/containers/unord/unord.multimap/unord.multimap.modifiers/merge.pass.cpp157
-rw-r--r--test/std/containers/unord/unord.multiset/clear.pass.cpp5
-rw-r--r--test/std/containers/unord/unord.multiset/erase_if.pass.cpp91
-rw-r--r--test/std/containers/unord/unord.multiset/erase_range.pass.cpp1
-rw-r--r--test/std/containers/unord/unord.multiset/insert_emplace_allocator_requirements.pass.cpp (renamed from test/std/containers/unord/unord.multiset/insert_allocator_requirements.pass.cpp)1
-rw-r--r--test/std/containers/unord/unord.multiset/max_size.pass.cpp8
-rw-r--r--test/std/containers/unord/unord.multiset/merge.pass.cpp154
-rw-r--r--test/std/containers/unord/unord.multiset/unord.multiset.cnstr/assign_copy.pass.cpp2
-rw-r--r--test/std/containers/unord/unord.multiset/unord.multiset.cnstr/assign_init.pass.cpp1
-rw-r--r--test/std/containers/unord/unord.multiset/unord.multiset.cnstr/assign_move.pass.cpp1
-rw-r--r--test/std/containers/unord/unord.multiset/unord.multiset.cnstr/init.pass.cpp1
-rw-r--r--test/std/containers/unord/unord.multiset/unord.multiset.cnstr/range.pass.cpp1
-rw-r--r--test/std/containers/unord/unord.set/clear.pass.cpp5
-rw-r--r--test/std/containers/unord/unord.set/erase_if.pass.cpp81
-rw-r--r--test/std/containers/unord/unord.set/erase_range.pass.cpp1
-rw-r--r--test/std/containers/unord/unord.set/max_size.pass.cpp8
-rw-r--r--test/std/containers/unord/unord.set/merge.pass.cpp154
-rw-r--r--test/std/containers/unord/unord.set/unord.set.cnstr/assign_copy.pass.cpp2
-rw-r--r--test/std/containers/unord/unord.set/unord.set.cnstr/assign_init.pass.cpp1
-rw-r--r--test/std/containers/unord/unord.set/unord.set.cnstr/assign_move.pass.cpp1
-rw-r--r--test/std/containers/unord/unord.set/unord.set.cnstr/init.pass.cpp1
-rw-r--r--test/std/containers/unord/unord.set/unord.set.cnstr/range.pass.cpp1
-rw-r--r--test/std/containers/views/span.comparison/op.eq.pass.cpp168
-rw-r--r--test/std/containers/views/span.comparison/op.ge.pass.cpp153
-rw-r--r--test/std/containers/views/span.comparison/op.gt.pass.cpp154
-rw-r--r--test/std/containers/views/span.comparison/op.le.pass.cpp153
-rw-r--r--test/std/containers/views/span.comparison/op.lt.pass.cpp154
-rw-r--r--test/std/containers/views/span.comparison/op.ne.pass.cpp168
-rw-r--r--test/std/containers/views/span.cons/array.fail.cpp8
-rw-r--r--test/std/containers/views/span.cons/array.pass.cpp2
-rw-r--r--test/std/containers/views/span.cons/assign.pass.cpp14
-rw-r--r--test/std/containers/views/span.cons/container.fail.cpp4
-rw-r--r--test/std/containers/views/span.cons/container.pass.cpp2
-rw-r--r--test/std/containers/views/span.cons/copy.pass.cpp4
-rw-r--r--test/std/containers/views/span.cons/deduct.pass.cpp12
-rw-r--r--test/std/containers/views/span.cons/default.fail.cpp6
-rw-r--r--test/std/containers/views/span.cons/default.pass.cpp2
-rw-r--r--test/std/containers/views/span.cons/ptr_len.fail.cpp6
-rw-r--r--test/std/containers/views/span.cons/ptr_len.pass.cpp4
-rw-r--r--test/std/containers/views/span.cons/ptr_ptr.fail.cpp6
-rw-r--r--test/std/containers/views/span.cons/ptr_ptr.pass.cpp4
-rw-r--r--test/std/containers/views/span.cons/span.fail.cpp4
-rw-r--r--test/std/containers/views/span.cons/span.pass.cpp2
-rw-r--r--test/std/containers/views/span.cons/stdarray.pass.cpp4
-rw-r--r--test/std/containers/views/span.elem/data.pass.cpp2
-rw-r--r--test/std/containers/views/span.elem/op_idx.pass.cpp6
-rw-r--r--test/std/containers/views/span.iterators/begin.pass.cpp2
-rw-r--r--test/std/containers/views/span.iterators/end.pass.cpp8
-rw-r--r--test/std/containers/views/span.iterators/rbegin.pass.cpp2
-rw-r--r--test/std/containers/views/span.iterators/rend.pass.cpp2
-rw-r--r--test/std/containers/views/span.objectrep/as_bytes.pass.cpp4
-rw-r--r--test/std/containers/views/span.objectrep/as_writeable_bytes.fail.cpp2
-rw-r--r--test/std/containers/views/span.objectrep/as_writeable_bytes.pass.cpp4
-rw-r--r--test/std/containers/views/span.obs/empty.pass.cpp4
-rw-r--r--test/std/containers/views/span.obs/size.pass.cpp2
-rw-r--r--test/std/containers/views/span.obs/size_bytes.pass.cpp2
-rw-r--r--test/std/containers/views/span.sub/first.pass.cpp6
-rw-r--r--test/std/containers/views/span.sub/last.pass.cpp6
-rw-r--r--test/std/containers/views/span.sub/subspan.pass.cpp2
-rw-r--r--test/std/containers/views/types.pass.cpp8
-rw-r--r--test/std/depr/depr.c.headers/float_h.pass.cpp8
-rw-r--r--test/std/depr/depr.c.headers/math_h.pass.cpp39
-rw-r--r--test/std/depr/depr.c.headers/stdlib_h.pass.cpp4
-rw-r--r--test/std/depr/depr.c.headers/uchar_h.pass.cpp1
-rw-r--r--test/std/depr/depr.lib.binders/depr.lib.bind.1st/bind1st.depr_in_cxx11.fail.cpp31
-rw-r--r--test/std/depr/depr.lib.binders/depr.lib.bind.2nd/bind2nd.depr_in_cxx11.fail.cpp31
-rw-r--r--test/std/depr/depr.lib.binders/depr.lib.binder.1st/binder1st.depr_in_cxx11.fail.cpp31
-rw-r--r--test/std/depr/depr.lib.binders/depr.lib.binder.2nd/binder2nd.depr_in_cxx11.fail.cpp31
-rw-r--r--test/std/depr/depr.str.strstreams/depr.strstreambuf/depr.strstreambuf.members/overflow.pass.cpp8
-rw-r--r--test/std/experimental/simd/simd.access/default.pass.cpp2
-rw-r--r--test/std/input.output/filesystems/class.directory_iterator/directory_iterator.members/increment.pass.cpp1
-rw-r--r--test/std/input.output/filesystems/class.directory_iterator/directory_iterator.nonmembers/begin_end.pass.cpp1
-rw-r--r--test/std/input.output/filesystems/class.path/path.member/path.compare.pass.cpp55
-rw-r--r--test/std/input.output/filesystems/class.path/path.member/path.gen/lexically_relative_and_proximate.pass.cpp4
-rw-r--r--test/std/input.output/filesystems/class.path/path.nonmember/append_op.fail.cpp27
-rw-r--r--test/std/input.output/filesystems/class.path/path.nonmember/append_op.pass.cpp4
-rw-r--r--test/std/input.output/filesystems/class.path/path.nonmember/comparison_ops.fail.cpp33
-rw-r--r--test/std/input.output/filesystems/class.rec.dir.itr/rec.dir.itr.members/increment.pass.cpp1
-rw-r--r--test/std/input.output/filesystems/class.rec.dir.itr/rec.dir.itr.nonmembers/begin_end.pass.cpp1
-rw-r--r--test/std/input.output/filesystems/fs.op.funcs/fs.op.last_write_time/last_write_time.pass.cpp21
-rw-r--r--test/std/input.output/filesystems/fs.op.funcs/fs.op.permissions/permissions.pass.cpp2
-rw-r--r--test/std/input.output/filesystems/fs.op.funcs/fs.op.proximate/proximate.pass.cpp6
-rw-r--r--test/std/input.output/filesystems/fs.op.funcs/fs.op.relative/relative.pass.cpp126
-rw-r--r--test/std/input.output/iostream.format/ext.manip/get_money.pass.cpp1
-rw-r--r--test/std/input.output/iostream.format/ext.manip/get_time.pass.cpp1
-rw-r--r--test/std/input.output/iostream.format/ext.manip/put_money.pass.cpp1
-rw-r--r--test/std/input.output/iostream.format/ext.manip/put_time.pass.cpp1
-rw-r--r--test/std/input.output/iostream.format/input.streams/istream.formatted/istream.formatted.arithmetic/int.pass.cpp1
-rw-r--r--test/std/input.output/iostream.format/input.streams/istream.formatted/istream.formatted.arithmetic/short.pass.cpp1
-rw-r--r--test/std/input.output/iostream.format/input.streams/istream.formatted/istream_extractors/signed_char_pointer.pass.cpp22
-rw-r--r--test/std/input.output/iostream.format/input.streams/istream.formatted/istream_extractors/unsigned_char_pointer.pass.cpp22
-rw-r--r--test/std/input.output/iostream.format/input.streams/istream.formatted/istream_extractors/wchar_t_pointer.pass.cpp33
-rw-r--r--test/std/input.output/iostream.format/input.streams/istream.rvalue/rvalue.pass.cpp2
-rw-r--r--test/std/input.output/iostream.format/input.streams/istream.unformatted/get.pass.cpp2
-rw-r--r--test/std/input.output/iostream.format/input.streams/istream.unformatted/get_chart.pass.cpp2
-rw-r--r--test/std/input.output/iostream.format/input.streams/istream.unformatted/get_pointer_size.pass.cpp5
-rw-r--r--test/std/input.output/iostream.format/input.streams/istream.unformatted/get_pointer_size_chart.pass.cpp5
-rw-r--r--test/std/input.output/iostream.format/input.streams/istream.unformatted/getline_pointer_size.pass.cpp5
-rw-r--r--test/std/input.output/iostream.format/input.streams/istream.unformatted/getline_pointer_size_chart.pass.cpp5
-rw-r--r--test/std/input.output/iostream.format/input.streams/istream.unformatted/ignore_0xff.pass.cpp3
-rw-r--r--test/std/input.output/iostream.format/input.streams/istream.unformatted/read.pass.cpp2
-rw-r--r--test/std/input.output/iostream.format/input.streams/istream.unformatted/readsome.pass.cpp3
-rw-r--r--test/std/input.output/iostream.format/input.streams/istream.unformatted/seekg.pass.cpp3
-rw-r--r--test/std/input.output/iostream.format/input.streams/istream.unformatted/seekg_off.pass.cpp3
-rw-r--r--test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.arithmetic/minmax_showbase.pass.cpp8
-rw-r--r--test/std/input.output/iostream.format/std.manip/resetiosflags.pass.cpp2
-rw-r--r--test/std/input.output/iostream.format/std.manip/setbase.pass.cpp2
-rw-r--r--test/std/input.output/iostream.format/std.manip/setfill.pass.cpp1
-rw-r--r--test/std/input.output/iostream.format/std.manip/setiosflags.pass.cpp2
-rw-r--r--test/std/input.output/iostream.format/std.manip/setprecision.pass.cpp2
-rw-r--r--test/std/input.output/iostream.format/std.manip/setw.pass.cpp2
-rw-r--r--test/std/input.output/iostreams.base/ios/basic.ios.members/narrow.pass.cpp6
-rw-r--r--test/std/iterators/iterator.primitives/iterator.traits/empty.fail.cpp122
-rw-r--r--test/std/iterators/iterator.primitives/iterator.traits/iterator.pass.cpp1
-rw-r--r--test/std/language.support/cmp/cmp.partialord/partialord.pass.cpp2
-rw-r--r--test/std/language.support/cmp/cmp.strongord/strongord.pass.cpp2
-rw-r--r--test/std/language.support/cmp/cmp.weakord/weakord.pass.cpp2
-rw-r--r--test/std/language.support/support.dynamic/new.delete/new.delete.array/delete_align_val_t_replace.pass.cpp29
-rw-r--r--test/std/language.support/support.dynamic/new.delete/new.delete.array/new_align_val_t.pass.cpp24
-rw-r--r--test/std/language.support/support.dynamic/new.delete/new.delete.array/new_align_val_t_nothrow.pass.cpp25
-rw-r--r--test/std/language.support/support.dynamic/new.delete/new.delete.array/new_align_val_t_nothrow_replace.pass.cpp25
-rw-r--r--test/std/language.support/support.dynamic/new.delete/new.delete.array/new_size.sh.cpp (renamed from test/std/language.support/support.dynamic/new.delete/new.delete.array/new_size.fail.cpp)7
-rw-r--r--test/std/language.support/support.dynamic/new.delete/new.delete.array/new_size_align.sh.cpp26
-rw-r--r--test/std/language.support/support.dynamic/new.delete/new.delete.array/new_size_align_nothrow.sh.cpp (renamed from test/std/language.support/support.dynamic/new.delete/new.delete.array/new_size_align_nothrow.fail.cpp)7
-rw-r--r--test/std/language.support/support.dynamic/new.delete/new.delete.array/new_size_nothrow.sh.cpp (renamed from test/std/language.support/support.dynamic/new.delete/new.delete.array/new_size_nothrow.fail.cpp)7
-rw-r--r--test/std/language.support/support.dynamic/new.delete/new.delete.array/sized_delete_array_fsizeddeallocation.sh.cpp12
-rw-r--r--test/std/language.support/support.dynamic/new.delete/new.delete.single/delete_align_val_t_replace.pass.cpp29
-rw-r--r--test/std/language.support/support.dynamic/new.delete/new.delete.single/new_align_val_t.pass.cpp25
-rw-r--r--test/std/language.support/support.dynamic/new.delete/new.delete.single/new_align_val_t_nothrow.pass.cpp25
-rw-r--r--test/std/language.support/support.dynamic/new.delete/new.delete.single/new_align_val_t_nothrow_replace.pass.cpp25
-rw-r--r--test/std/language.support/support.dynamic/new.delete/new.delete.single/new_size_align.sh.cpp (renamed from test/std/language.support/support.dynamic/new.delete/new.delete.array/new_size_align.fail.cpp)9
-rw-r--r--test/std/language.support/support.dynamic/new.delete/new.delete.single/new_size_align_nothrow.sh.cpp (renamed from test/std/language.support/support.dynamic/new.delete/new.delete.single/new_size_align_nothrow.fail.cpp)7
-rw-r--r--test/std/language.support/support.dynamic/new.delete/new.delete.single/sized_delete_fsizeddeallocation.sh.cpp12
-rw-r--r--test/std/language.support/support.dynamic/ptr.launder/launder.types.fail.cpp2
-rw-r--r--test/std/language.support/support.exception/uncaught/uncaught_exceptions.pass.cpp10
-rw-r--r--test/std/language.support/support.limits/c.limits/cfloat.pass.cpp8
-rw-r--r--test/std/language.support/support.limits/limits/numeric.limits.members/const_data_members.pass.cpp10
-rw-r--r--test/std/language.support/support.limits/limits/numeric.limits.members/denorm_min.pass.cpp5
-rw-r--r--test/std/language.support/support.limits/limits/numeric.limits.members/digits.pass.cpp5
-rw-r--r--test/std/language.support/support.limits/limits/numeric.limits.members/digits10.pass.cpp5
-rw-r--r--test/std/language.support/support.limits/limits/numeric.limits.members/epsilon.pass.cpp5
-rw-r--r--test/std/language.support/support.limits/limits/numeric.limits.members/has_denorm.pass.cpp5
-rw-r--r--test/std/language.support/support.limits/limits/numeric.limits.members/has_denorm_loss.pass.cpp5
-rw-r--r--test/std/language.support/support.limits/limits/numeric.limits.members/has_infinity.pass.cpp5
-rw-r--r--test/std/language.support/support.limits/limits/numeric.limits.members/has_quiet_NaN.pass.cpp5
-rw-r--r--test/std/language.support/support.limits/limits/numeric.limits.members/has_signaling_NaN.pass.cpp5
-rw-r--r--test/std/language.support/support.limits/limits/numeric.limits.members/infinity.pass.cpp5
-rw-r--r--test/std/language.support/support.limits/limits/numeric.limits.members/is_bounded.pass.cpp5
-rw-r--r--test/std/language.support/support.limits/limits/numeric.limits.members/is_exact.pass.cpp5
-rw-r--r--test/std/language.support/support.limits/limits/numeric.limits.members/is_iec559.pass.cpp5
-rw-r--r--test/std/language.support/support.limits/limits/numeric.limits.members/is_integer.pass.cpp5
-rw-r--r--test/std/language.support/support.limits/limits/numeric.limits.members/is_modulo.pass.cpp5
-rw-r--r--test/std/language.support/support.limits/limits/numeric.limits.members/is_signed.pass.cpp5
-rw-r--r--test/std/language.support/support.limits/limits/numeric.limits.members/lowest.pass.cpp5
-rw-r--r--test/std/language.support/support.limits/limits/numeric.limits.members/max.pass.cpp5
-rw-r--r--test/std/language.support/support.limits/limits/numeric.limits.members/max_digits10.pass.cpp5
-rw-r--r--test/std/language.support/support.limits/limits/numeric.limits.members/max_exponent.pass.cpp5
-rw-r--r--test/std/language.support/support.limits/limits/numeric.limits.members/max_exponent10.pass.cpp5
-rw-r--r--test/std/language.support/support.limits/limits/numeric.limits.members/min.pass.cpp5
-rw-r--r--test/std/language.support/support.limits/limits/numeric.limits.members/min_exponent.pass.cpp5
-rw-r--r--test/std/language.support/support.limits/limits/numeric.limits.members/min_exponent10.pass.cpp5
-rw-r--r--test/std/language.support/support.limits/limits/numeric.limits.members/quiet_NaN.pass.cpp5
-rw-r--r--test/std/language.support/support.limits/limits/numeric.limits.members/radix.pass.cpp5
-rw-r--r--test/std/language.support/support.limits/limits/numeric.limits.members/round_error.pass.cpp5
-rw-r--r--test/std/language.support/support.limits/limits/numeric.limits.members/round_style.pass.cpp5
-rw-r--r--test/std/language.support/support.limits/limits/numeric.limits.members/signaling_NaN.pass.cpp5
-rw-r--r--test/std/language.support/support.limits/limits/numeric.limits.members/tinyness_before.pass.cpp5
-rw-r--r--test/std/language.support/support.limits/limits/numeric.limits.members/traps.pass.cpp5
-rw-r--r--test/std/language.support/support.limits/support.limits.general/algorithm.version.pass.cpp192
-rw-r--r--test/std/language.support/support.limits/support.limits.general/any.version.pass.cpp56
-rw-r--r--test/std/language.support/support.limits/support.limits.general/array.version.pass.cpp105
-rw-r--r--test/std/language.support/support.limits/support.limits.general/atomic.version.pass.cpp122
-rw-r--r--test/std/language.support/support.limits/support.limits.general/bit.version.pass.cpp59
-rw-r--r--test/std/language.support/support.limits/support.limits.general/charconv.pass.cpp32
-rw-r--r--test/std/language.support/support.limits/support.limits.general/chrono.version.pass.cpp82
-rw-r--r--test/std/language.support/support.limits/support.limits.general/cmath.version.pass.cpp91
-rw-r--r--test/std/language.support/support.limits/support.limits.general/compare.version.pass.cpp59
-rw-r--r--test/std/language.support/support.limits/support.limits.general/complex.version.pass.cpp59
-rw-r--r--test/std/language.support/support.limits/support.limits.general/concepts.version.pass.cpp34
-rw-r--r--test/std/language.support/support.limits/support.limits.general/cstddef.version.pass.cpp56
-rw-r--r--test/std/language.support/support.limits/support.limits.general/deque.version.pass.cpp99
-rw-r--r--test/std/language.support/support.limits/support.limits.general/exception.version.pass.cpp56
-rw-r--r--test/std/language.support/support.limits/support.limits.general/execution.version.pass.cpp34
-rw-r--r--test/std/language.support/support.limits/support.limits.general/filesystem.version.pass.cpp82
-rw-r--r--test/std/language.support/support.limits/support.limits.general/forward_list.version.pass.cpp148
-rw-r--r--test/std/language.support/support.limits/support.limits.general/functional.version.pass.cpp245
-rwxr-xr-xtest/std/language.support/support.limits/support.limits.general/generate_feature_test_macro_components.py977
-rw-r--r--test/std/language.support/support.limits/support.limits.general/iomanip.version.pass.cpp59
-rw-r--r--test/std/language.support/support.limits/support.limits.general/istream.version.pass.cpp59
-rw-r--r--test/std/language.support/support.limits/support.limits.general/iterator.version.pass.cpp183
-rw-r--r--test/std/language.support/support.limits/support.limits.general/limits.version.pass.cpp59
-rw-r--r--test/std/language.support/support.limits/support.limits.general/list.version.pass.cpp148
-rw-r--r--test/std/language.support/support.limits/support.limits.general/locale.version.pass.cpp59
-rw-r--r--test/std/language.support/support.limits/support.limits.general/map.version.pass.cpp171
-rw-r--r--test/std/language.support/support.limits/support.limits.general/memory.version.pass.cpp247
-rw-r--r--test/std/language.support/support.limits/support.limits.general/memory_resource.version.pass.cpp34
-rw-r--r--test/std/language.support/support.limits/support.limits.general/mutex.version.pass.cpp56
-rw-r--r--test/std/language.support/support.limits/support.limits.general/new.version.pass.cpp105
-rw-r--r--test/std/language.support/support.limits/support.limits.general/numeric.version.pass.cpp91
-rw-r--r--test/std/language.support/support.limits/support.limits.general/optional.version.pass.cpp56
-rw-r--r--test/std/language.support/support.limits/support.limits.general/ostream.version.pass.cpp59
-rw-r--r--test/std/language.support/support.limits/support.limits.general/regex.version.pass.cpp56
-rw-r--r--test/std/language.support/support.limits/support.limits.general/scoped_allocator.version.pass.cpp56
-rw-r--r--test/std/language.support/support.limits/support.limits.general/set.version.pass.cpp148
-rw-r--r--test/std/language.support/support.limits/support.limits.general/shared_mutex.version.pass.cpp114
-rw-r--r--test/std/language.support/support.limits/support.limits.general/string.version.pass.cpp174
-rw-r--r--test/std/language.support/support.limits/support.limits.general/string_view.version.pass.cpp108
-rw-r--r--test/std/language.support/support.limits/support.limits.general/tuple.version.pass.cpp157
-rw-r--r--test/std/language.support/support.limits/support.limits.general/type_traits.version.pass.cpp397
-rw-r--r--test/std/language.support/support.limits/support.limits.general/unordered_map.version.pass.cpp171
-rw-r--r--test/std/language.support/support.limits/support.limits.general/unordered_set.version.pass.cpp148
-rw-r--r--test/std/language.support/support.limits/support.limits.general/utility.version.pass.cpp195
-rw-r--r--test/std/language.support/support.limits/support.limits.general/variant.version.pass.cpp56
-rw-r--r--test/std/language.support/support.limits/support.limits.general/vector.version.pass.cpp122
-rw-r--r--test/std/language.support/support.limits/support.limits.general/version.version.pass.cpp2178
-rw-r--r--test/std/language.support/support.runtime/cstdlib.pass.cpp6
-rw-r--r--test/std/language.support/support.runtime/ctime.pass.cpp2
-rw-r--r--test/std/language.support/support.start.term/quick_exit.pass.cpp2
-rw-r--r--test/std/language.support/support.start.term/quick_exit_check1.fail.cpp1
-rw-r--r--test/std/language.support/support.start.term/quick_exit_check2.fail.cpp2
-rw-r--r--test/std/localization/locale.categories/category.collate/locale.collate.byname/transform.pass.cpp3
-rw-r--r--test/std/localization/locale.categories/category.ctype/locale.codecvt/locale.codecvt.members/wchar_t_out.pass.cpp1
-rw-r--r--test/std/localization/locale.categories/category.monetary/locale.money.get/locale.money.get.members/get_long_double_fr_FR.pass.cpp3
-rw-r--r--test/std/localization/locale.categories/category.monetary/locale.money.get/locale.money.get.members/get_long_double_ru_RU.pass.cpp3
-rw-r--r--test/std/localization/locale.categories/category.monetary/locale.money.get/locale.money.get.members/get_long_double_zh_CN.pass.cpp3
-rw-r--r--test/std/localization/locale.categories/category.monetary/locale.money.put/locale.money.put.members/put_long_double_fr_FR.pass.cpp3
-rw-r--r--test/std/localization/locale.categories/category.monetary/locale.money.put/locale.money.put.members/put_long_double_ru_RU.pass.cpp3
-rw-r--r--test/std/localization/locale.categories/category.monetary/locale.money.put/locale.money.put.members/put_long_double_zh_CN.pass.cpp3
-rw-r--r--test/std/localization/locale.categories/category.monetary/locale.moneypunct.byname/curr_symbol.pass.cpp3
-rw-r--r--test/std/localization/locale.categories/category.monetary/locale.moneypunct.byname/grouping.pass.cpp3
-rw-r--r--test/std/localization/locale.categories/category.monetary/locale.moneypunct.byname/neg_format.pass.cpp3
-rw-r--r--test/std/localization/locale.categories/category.monetary/locale.moneypunct.byname/pos_format.pass.cpp3
-rw-r--r--test/std/localization/locale.categories/category.monetary/locale.moneypunct.byname/thousands_sep.pass.cpp3
-rw-r--r--test/std/localization/locale.categories/category.numeric/locale.num.get/facet.num.get.members/get_long.pass.cpp10
-rw-r--r--test/std/localization/locale.categories/category.numeric/locale.num.get/facet.num.get.members/test_min_max.pass.cpp2
-rw-r--r--test/std/localization/locale.categories/category.numeric/locale.num.get/facet.num.get.members/test_neg_one.pass.cpp3
-rw-r--r--test/std/localization/locale.categories/category.time/locale.time.get.byname/get_date.pass.cpp3
-rw-r--r--test/std/localization/locale.categories/category.time/locale.time.get.byname/get_date_wide.pass.cpp3
-rw-r--r--test/std/localization/locale.categories/category.time/locale.time.get.byname/get_one.pass.cpp3
-rw-r--r--test/std/localization/locale.categories/category.time/locale.time.get.byname/get_one_wide.pass.cpp3
-rw-r--r--test/std/localization/locale.categories/category.time/locale.time.put.byname/put1.pass.cpp3
-rw-r--r--test/std/localization/locale.categories/facet.numpunct/locale.numpunct.byname/grouping.pass.cpp3
-rw-r--r--test/std/localization/locale.categories/facet.numpunct/locale.numpunct.byname/thousands_sep.pass.cpp3
-rw-r--r--test/std/localization/locales/locale/locale.cons/char_pointer.pass.cpp3
-rw-r--r--test/std/localization/locales/locale/locale.cons/locale_char_pointer_cat.pass.cpp4
-rw-r--r--test/std/localization/locales/locale/locale.cons/locale_locale_cat.pass.cpp4
-rw-r--r--test/std/localization/locales/locale/locale.cons/locale_string_cat.pass.cpp4
-rw-r--r--test/std/numerics/c.math/cmath.pass.cpp3
-rw-r--r--test/std/numerics/complex.number/complex.ops/stream_input.pass.cpp2
-rw-r--r--test/std/numerics/rand/rand.eng/rand.eng.mers/ctor_sseq_all_zero.pass.cpp81
-rw-r--r--test/std/numerics/rand/rand.util/rand.util.canonical/generate_canonical.pass.cpp28
-rw-r--r--test/std/re/re.alg/re.alg.match/basic.pass.cpp3
-rw-r--r--test/std/re/re.alg/re.alg.match/ecma.pass.cpp3
-rw-r--r--test/std/re/re.alg/re.alg.match/extended.pass.cpp3
-rw-r--r--test/std/re/re.alg/re.alg.match/inverted_character_classes.pass.cpp44
-rw-r--r--test/std/re/re.alg/re.alg.match/parse_curly_brackets.pass.cpp3
-rw-r--r--test/std/re/re.alg/re.alg.search/awk.pass.cpp3
-rw-r--r--test/std/re/re.alg/re.alg.search/basic.pass.cpp3
-rw-r--r--test/std/re/re.alg/re.alg.search/ecma.pass.cpp3
-rw-r--r--test/std/re/re.alg/re.alg.search/extended.pass.cpp3
-rw-r--r--test/std/re/re.alg/re.alg.search/invert_neg_word_search.pass.cpp2
-rw-r--r--test/std/re/re.grammar/excessive_brace_count.pass.cpp2
-rw-r--r--test/std/re/re.results/re.results.const/copy.pass.cpp41
-rw-r--r--test/std/re/re.results/re.results.const/copy_assign.pass.cpp50
-rw-r--r--test/std/re/re.results/re.results.const/move.pass.cpp48
-rw-r--r--test/std/re/re.results/re.results.const/move_assign.pass.cpp51
-rw-r--r--test/std/re/re.traits/lookup_collatename.pass.cpp3
-rw-r--r--test/std/re/re.traits/transform.pass.cpp3
-rw-r--r--test/std/re/re.traits/transform_primary.pass.cpp3
-rw-r--r--test/std/re/re.traits/translate_nocase.pass.cpp8
-rw-r--r--test/std/strings/basic.string.hash/enabled_hashes.pass.cpp3
-rw-r--r--test/std/strings/basic.string.hash/strings.pass.cpp3
-rw-r--r--test/std/strings/basic.string.literals/literal.pass.cpp42
-rw-r--r--test/std/strings/basic.string/string.capacity/over_max_size.pass.cpp1
-rw-r--r--test/std/strings/basic.string/string.capacity/reserve.pass.cpp9
-rw-r--r--test/std/strings/basic.string/string.cons/string_view_deduction.pass.cpp12
-rw-r--r--test/std/strings/basic.string/string.cons/string_view_size_size_deduction.fail.cpp2
-rw-r--r--test/std/strings/basic.string/string.cons/string_view_size_size_deduction.pass.cpp14
-rw-r--r--test/std/strings/basic.string/string.iterators/iterators.pass.cpp14
-rw-r--r--test/std/strings/c.strings/cctype.pass.cpp49
-rw-r--r--test/std/strings/c.strings/cstring.pass.cpp57
-rw-r--r--test/std/strings/c.strings/cuchar.pass.cpp2
-rw-r--r--test/std/strings/c.strings/cwchar.pass.cpp131
-rw-r--r--test/std/strings/c.strings/cwctype.pass.cpp43
-rw-r--r--test/std/strings/char.traits/char.traits.specializations/char.traits.specializations.char8_t/assign2.pass.cpp39
-rw-r--r--test/std/strings/char.traits/char.traits.specializations/char.traits.specializations.char8_t/assign3.pass.cpp30
-rw-r--r--test/std/strings/char.traits/char.traits.specializations/char.traits.specializations.char8_t/compare.pass.cpp58
-rw-r--r--test/std/strings/char.traits/char.traits.specializations/char.traits.specializations.char8_t/copy.pass.cpp32
-rw-r--r--test/std/strings/char.traits/char.traits.specializations/char.traits.specializations.char8_t/eof.pass.cpp26
-rw-r--r--test/std/strings/char.traits/char.traits.specializations/char.traits.specializations.char8_t/eq.pass.cpp28
-rw-r--r--test/std/strings/char.traits/char.traits.specializations/char.traits.specializations.char8_t/eq_int_type.pass.cpp31
-rw-r--r--test/std/strings/char.traits/char.traits.specializations/char.traits.specializations.char8_t/find.pass.cpp46
-rw-r--r--test/std/strings/char.traits/char.traits.specializations/char.traits.specializations.char8_t/length.pass.cpp41
-rw-r--r--test/std/strings/char.traits/char.traits.specializations/char.traits.specializations.char8_t/lt.pass.cpp28
-rw-r--r--test/std/strings/char.traits/char.traits.specializations/char.traits.specializations.char8_t/move.pass.cpp36
-rw-r--r--test/std/strings/char.traits/char.traits.specializations/char.traits.specializations.char8_t/not_eof.pass.cpp31
-rw-r--r--test/std/strings/char.traits/char.traits.specializations/char.traits.specializations.char8_t/to_char_type.pass.cpp29
-rw-r--r--test/std/strings/char.traits/char.traits.specializations/char.traits.specializations.char8_t/to_int_type.pass.cpp29
-rw-r--r--test/std/strings/char.traits/char.traits.specializations/char.traits.specializations.char8_t/types.pass.cpp34
-rw-r--r--test/std/strings/string.classes/typedefs.pass.cpp10
-rw-r--r--test/std/strings/string.conversions/stod.pass.cpp1
-rw-r--r--test/std/strings/string.conversions/stof.pass.cpp1
-rw-r--r--test/std/strings/string.conversions/stoi.pass.cpp1
-rw-r--r--test/std/strings/string.conversions/stol.pass.cpp1
-rw-r--r--test/std/strings/string.conversions/stoll.pass.cpp1
-rw-r--r--test/std/strings/string.conversions/stoul.pass.cpp1
-rw-r--r--test/std/strings/string.conversions/stoull.pass.cpp1
-rw-r--r--test/std/strings/string.conversions/to_string.pass.cpp1
-rw-r--r--test/std/strings/string.conversions/to_wstring.pass.cpp1
-rw-r--r--test/std/strings/string.view/string.view.capacity/capacity.pass.cpp23
-rw-r--r--test/std/strings/string.view/string.view.cons/assign.pass.cpp22
-rw-r--r--test/std/strings/string.view/string.view.cons/default.pass.cpp16
-rw-r--r--test/std/strings/string.view/string.view.cons/from_string.pass.cpp6
-rw-r--r--test/std/strings/string.view/string.view.hash/enabled_hashes.pass.cpp3
-rw-r--r--test/std/strings/string.view/string.view.hash/string_view.pass.cpp3
-rw-r--r--test/std/strings/string.view/string.view.iterators/begin.pass.cpp15
-rw-r--r--test/std/strings/string.view/string.view.iterators/end.pass.cpp15
-rw-r--r--test/std/strings/string.view/string.view.iterators/rbegin.pass.cpp15
-rw-r--r--test/std/strings/string.view/string.view.iterators/rend.pass.cpp15
-rw-r--r--test/std/strings/string.view/string.view.ops/compare.pointer_size.pass.cpp1
-rw-r--r--test/std/strings/string.view/string.view.ops/compare.size_size_sv.pass.cpp1
-rw-r--r--test/std/strings/string.view/string.view.ops/compare.size_size_sv_pointer_size.pass.cpp1
-rw-r--r--test/std/strings/string.view/string.view.ops/compare.size_size_sv_size_size.pass.cpp1
-rw-r--r--test/std/strings/string.view/string.view.ops/copy.pass.cpp1
-rw-r--r--test/std/strings/string.view/string_view.literals/literal.pass.cpp42
-rw-r--r--test/std/strings/string.view/types.pass.cpp3
-rw-r--r--test/std/strings/strings.erasure/erase.pass.cpp76
-rw-r--r--test/std/strings/strings.erasure/erase_if.pass.cpp76
-rw-r--r--test/std/thread/futures/futures.async/async_race.38682.pass.cpp69
-rw-r--r--test/std/thread/futures/futures.shared_future/wait_until.pass.cpp2
-rw-r--r--test/std/thread/thread.condition/thread.condition.condvar/wait_for.pass.cpp2
-rw-r--r--test/std/thread/thread.condition/thread.condition.condvarany/notify_one.pass.cpp2
-rw-r--r--test/std/thread/thread.mutex/thread.lock/thread.lock.guard/adopt_lock.pass.cpp2
-rw-r--r--test/std/thread/thread.mutex/thread.lock/thread.lock.guard/mutex.pass.cpp2
-rw-r--r--test/std/thread/thread.mutex/thread.lock/thread.lock.shared/thread.lock.shared.cons/mutex_try_to_lock.pass.cpp2
-rw-r--r--test/std/thread/thread.mutex/thread.lock/thread.lock.unique/thread.lock.unique.cons/mutex.pass.cpp2
-rw-r--r--test/std/thread/thread.mutex/thread.lock/thread.lock.unique/thread.lock.unique.locking/lock.pass.cpp2
-rw-r--r--test/std/thread/thread.threads/thread.thread.class/thread.thread.constr/F.pass.cpp14
-rw-r--r--test/std/thread/thread.threads/thread.thread.this/sleep_until.pass.cpp1
-rw-r--r--test/std/utilities/any/any.class/any.assign/copy.pass.cpp13
-rw-r--r--test/std/utilities/any/any.class/any.assign/move.pass.cpp13
-rw-r--r--test/std/utilities/any/any.class/any.assign/value.pass.cpp15
-rw-r--r--test/std/utilities/any/any.class/any.cons/copy.pass.cpp13
-rw-r--r--test/std/utilities/any/any.class/any.cons/in_place_type.pass.cpp13
-rw-r--r--test/std/utilities/any/any.class/any.cons/move.pass.cpp13
-rw-r--r--test/std/utilities/any/any.class/any.cons/value.pass.cpp13
-rw-r--r--test/std/utilities/any/any.class/any.modifiers/emplace.pass.cpp13
-rw-r--r--test/std/utilities/any/any.class/any.modifiers/reset.pass.cpp13
-rw-r--r--test/std/utilities/any/any.class/any.modifiers/swap.pass.cpp13
-rw-r--r--test/std/utilities/any/any.nonmembers/any.cast/any_cast_pointer.pass.cpp13
-rw-r--r--test/std/utilities/any/any.nonmembers/any.cast/any_cast_reference.pass.cpp13
-rw-r--r--test/std/utilities/any/any.nonmembers/any.cast/any_cast_request_invalid_value_category.fail.cpp4
-rw-r--r--test/std/utilities/any/any.nonmembers/any.cast/const_correctness.fail.cpp4
-rw-r--r--test/std/utilities/any/any.nonmembers/any.cast/not_copy_constructible.fail.cpp4
-rw-r--r--test/std/utilities/any/any.nonmembers/make_any.pass.cpp13
-rw-r--r--test/std/utilities/any/any.nonmembers/swap.pass.cpp13
-rw-r--r--test/std/utilities/charconv/charconv.from.chars/integral.pass.cpp13
-rw-r--r--test/std/utilities/charconv/charconv.to.chars/integral.pass.cpp13
-rw-r--r--test/std/utilities/function.objects/bind/func.bind/func.bind.bind/nested.pass.cpp3
-rw-r--r--test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/copy_move.pass.cpp14
-rw-r--r--test/std/utilities/function.objects/negators/binary_negate.depr_in_cxx17.fail.cpp35
-rw-r--r--test/std/utilities/function.objects/negators/not1.depr_in_cxx17.fail.cpp33
-rw-r--r--test/std/utilities/function.objects/negators/not2.depr_in_cxx17.fail.cpp34
-rw-r--r--test/std/utilities/function.objects/negators/unary_negate.depr_in_cxx17.fail.cpp34
-rw-r--r--test/std/utilities/function.objects/refwrap/type_properties.pass.cpp9
-rw-r--r--test/std/utilities/function.objects/refwrap/unwrap_ref_decay.pass.cpp58
-rw-r--r--test/std/utilities/function.objects/refwrap/unwrap_reference.pass.cpp51
-rw-r--r--test/std/utilities/memory/allocator.traits/allocator.traits.members/destroy.pass.cpp2
-rw-r--r--test/std/utilities/memory/allocator.traits/allocator.traits.members/max_size.pass.cpp1
-rw-r--r--test/std/utilities/memory/default.allocator/allocator.members/allocate.pass.cpp1
-rw-r--r--test/std/utilities/memory/pointer.traits/pointer.traits.functions/pointer_to.pass.cpp1
-rw-r--r--test/std/utilities/memory/pointer.traits/pointer_to.pass.cpp18
-rw-r--r--test/std/utilities/memory/storage.iterator/raw_storage_iterator.base.pass.cpp8
-rw-r--r--test/std/utilities/memory/storage.iterator/raw_storage_iterator.pass.cpp7
-rw-r--r--test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.create/allocate_shared.pass.cpp8
-rw-r--r--test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.create/make_shared.pass.cpp9
-rw-r--r--test/std/utilities/meta/meta.trans/meta.trans.other/aligned_storage.pass.cpp9
-rw-r--r--test/std/utilities/meta/meta.trans/meta.trans.other/type_identity.pass.cpp40
-rw-r--r--test/std/utilities/meta/meta.type.synop/endian.pass.cpp1
-rw-r--r--test/std/utilities/meta/meta.unary.prop.query/alignment_of.pass.cpp8
-rw-r--r--test/std/utilities/meta/meta.unary/meta.unary.cat/is_integral.pass.cpp3
-rw-r--r--test/std/utilities/meta/meta.unary/meta.unary.prop/is_nothrow_default_constructible.pass.cpp11
-rw-r--r--test/std/utilities/optional/optional.bad_optional_access/default.pass.cpp13
-rw-r--r--test/std/utilities/optional/optional.bad_optional_access/derive.pass.cpp8
-rw-r--r--test/std/utilities/optional/optional.object/optional.object.assign/copy.pass.cpp6
-rw-r--r--test/std/utilities/optional/optional.object/optional.object.assign/move.pass.cpp38
-rw-r--r--test/std/utilities/optional/optional.object/optional.object.ctor/U.pass.cpp13
-rw-r--r--test/std/utilities/optional/optional.object/optional.object.ctor/const_T.pass.cpp13
-rw-r--r--test/std/utilities/optional/optional.object/optional.object.ctor/copy.fail.cpp36
-rw-r--r--test/std/utilities/optional/optional.object/optional.object.ctor/copy.pass.cpp6
-rw-r--r--test/std/utilities/optional/optional.object/optional.object.ctor/move.pass.cpp13
-rw-r--r--test/std/utilities/optional/optional.object/optional.object.ctor/rvalue_T.pass.cpp13
-rw-r--r--test/std/utilities/optional/optional.object/optional.object.observe/value.pass.cpp13
-rw-r--r--test/std/utilities/optional/optional.object/optional.object.observe/value_const.pass.cpp13
-rw-r--r--test/std/utilities/optional/optional.object/optional.object.observe/value_const_rvalue.pass.cpp13
-rw-r--r--test/std/utilities/optional/optional.object/optional.object.observe/value_rvalue.pass.cpp13
-rw-r--r--test/std/utilities/optional/optional.object/special_members.pass.cpp63
-rw-r--r--test/std/utilities/optional/optional.object/triviality.pass.cpp97
-rw-r--r--test/std/utilities/optional/optional.specalg/make_optional.pass.cpp8
-rw-r--r--test/std/utilities/template.bitset/bitset.members/flip_one.pass.cpp1
-rw-r--r--test/std/utilities/template.bitset/bitset.members/reset_one.pass.cpp1
-rw-r--r--test/std/utilities/template.bitset/bitset.members/set_one.pass.cpp1
-rw-r--r--test/std/utilities/template.bitset/bitset.members/test.pass.cpp1
-rw-r--r--test/std/utilities/template.bitset/includes.pass.cpp11
-rw-r--r--test/std/utilities/time/date.time/ctime.pass.cpp6
-rw-r--r--test/std/utilities/time/days.pass.cpp28
-rw-r--r--test/std/utilities/time/months.pass.cpp29
-rw-r--r--test/std/utilities/time/time.cal/euclidian.h39
-rw-r--r--test/std/utilities/time/time.cal/nothing_to_do.pass.cpp (renamed from test/libcxx/experimental/containers/sequences/dynarray/nothing_to_do.pass.cpp)0
-rw-r--r--test/std/utilities/time/time.cal/time.cal.day/time.cal.day.members/ctor.pass.cpp46
-rw-r--r--test/std/utilities/time/time.cal/time.cal.day/time.cal.day.members/decrement.pass.cpp52
-rw-r--r--test/std/utilities/time/time.cal/time.cal.day/time.cal.day.members/increment.pass.cpp52
-rw-r--r--test/std/utilities/time/time.cal/time.cal.day/time.cal.day.members/ok.pass.cpp37
-rw-r--r--test/std/utilities/time/time.cal/time.cal.day/time.cal.day.members/plus_minus_equal.pass.cpp57
-rw-r--r--test/std/utilities/time/time.cal/time.cal.day/time.cal.day.nonmembers/comparisons.pass.cpp44
-rw-r--r--test/std/utilities/time/time.cal/time.cal.day/time.cal.day.nonmembers/literals.fail.cpp28
-rw-r--r--test/std/utilities/time/time.cal/time.cal.day/time.cal.day.nonmembers/literals.pass.cpp47
-rw-r--r--test/std/utilities/time/time.cal/time.cal.day/time.cal.day.nonmembers/minus.pass.cpp58
-rw-r--r--test/std/utilities/time/time.cal/time.cal.day/time.cal.day.nonmembers/plus.pass.cpp59
-rw-r--r--test/std/utilities/time/time.cal/time.cal.day/time.cal.day.nonmembers/streaming.pass.cpp56
-rw-r--r--test/std/utilities/time/time.cal/time.cal.day/types.pass.cpp26
-rw-r--r--test/std/utilities/time/time.cal/time.cal.last/types.pass.cpp33
-rw-r--r--test/std/utilities/time/time.cal/time.cal.md/time.cal.md.members/ctor.pass.cpp47
-rw-r--r--test/std/utilities/time/time.cal/time.cal.md/time.cal.md.members/day.pass.cpp38
-rw-r--r--test/std/utilities/time/time.cal/time.cal.md/time.cal.md.members/month.pass.cpp39
-rw-r--r--test/std/utilities/time/time.cal/time.cal.md/time.cal.md.members/ok.pass.cpp55
-rw-r--r--test/std/utilities/time/time.cal/time.cal.md/time.cal.md.nonmembers/comparisons.pass.cpp70
-rw-r--r--test/std/utilities/time/time.cal/time.cal.md/time.cal.md.nonmembers/streaming.pass.cpp41
-rw-r--r--test/std/utilities/time/time.cal/time.cal.md/types.pass.cpp26
-rw-r--r--test/std/utilities/time/time.cal/time.cal.mdlast/comparisons.pass.cpp43
-rw-r--r--test/std/utilities/time/time.cal/time.cal.mdlast/ctor.pass.cpp41
-rw-r--r--test/std/utilities/time/time.cal/time.cal.mdlast/month.pass.cpp38
-rw-r--r--test/std/utilities/time/time.cal/time.cal.mdlast/ok.pass.cpp46
-rw-r--r--test/std/utilities/time/time.cal/time.cal.mdlast/streaming.pass.cpp34
-rw-r--r--test/std/utilities/time/time.cal/time.cal.mdlast/types.pass.cpp (renamed from test/std/language.support/support.dynamic/new.delete/new.delete.single/new_size_align.fail.cpp)20
-rw-r--r--test/std/utilities/time/time.cal/time.cal.month/time.cal.month.members/ctor.pass.cpp46
-rw-r--r--test/std/utilities/time/time.cal/time.cal.month/time.cal.month.members/decrement.pass.cpp53
-rw-r--r--test/std/utilities/time/time.cal/time.cal.month/time.cal.month.members/increment.pass.cpp52
-rw-r--r--test/std/utilities/time/time.cal/time.cal.month/time.cal.month.members/ok.pass.cpp38
-rw-r--r--test/std/utilities/time/time.cal/time.cal.month/time.cal.month.members/plus_minus_equal.pass.cpp67
-rw-r--r--test/std/utilities/time/time.cal/time.cal.month/time.cal.month.nonmembers/comparisons.pass.cpp47
-rw-r--r--test/std/utilities/time/time.cal/time.cal.month/time.cal.month.nonmembers/literals.pass.cpp87
-rw-r--r--test/std/utilities/time/time.cal/time.cal.month/time.cal.month.nonmembers/minus.pass.cpp72
-rw-r--r--test/std/utilities/time/time.cal/time.cal.month/time.cal.month.nonmembers/plus.pass.cpp72
-rw-r--r--test/std/utilities/time/time.cal/time.cal.month/time.cal.month.nonmembers/streaming.pass.cpp53
-rw-r--r--test/std/utilities/time/time.cal/time.cal.month/types.pass.cpp26
-rw-r--r--test/std/utilities/time/time.cal/time.cal.mwd/time.cal.mwd.members/ctor.pass.cpp46
-rw-r--r--test/std/utilities/time/time.cal/time.cal.mwd/time.cal.mwd.members/month.pass.cpp42
-rw-r--r--test/std/utilities/time/time.cal/time.cal.mwd/time.cal.mwd.members/ok.pass.cpp51
-rw-r--r--test/std/utilities/time/time.cal/time.cal.mwd/time.cal.mwd.members/weekday_indexed.pass.cpp43
-rw-r--r--test/std/utilities/time/time.cal/time.cal.mwd/time.cal.mwd.nonmembers/comparisons.pass.cpp86
-rw-r--r--test/std/utilities/time/time.cal/time.cal.mwd/time.cal.mwd.nonmembers/streaming.pass.cpp36
-rw-r--r--test/std/utilities/time/time.cal/time.cal.mwd/types.pass.cpp26
-rw-r--r--test/std/utilities/time/time.cal/time.cal.mwdlast/time.cal.mwdlast.members/ctor.pass.cpp60
-rw-r--r--test/std/utilities/time/time.cal/time.cal.mwdlast/time.cal.mwdlast.members/month.pass.cpp42
-rw-r--r--test/std/utilities/time/time.cal/time.cal.mwdlast/time.cal.mwdlast.members/ok.pass.cpp52
-rw-r--r--test/std/utilities/time/time.cal/time.cal.mwdlast/time.cal.mwdlast.members/weekday_last.pass.cpp44
-rw-r--r--test/std/utilities/time/time.cal/time.cal.mwdlast/time.cal.mwdlast.nonmembers/comparisons.pass.cpp73
-rw-r--r--test/std/utilities/time/time.cal/time.cal.mwdlast/time.cal.mwdlast.nonmembers/streaming.pass.cpp37
-rw-r--r--test/std/utilities/time/time.cal/time.cal.mwdlast/types.pass.cpp27
-rw-r--r--test/std/utilities/time/time.cal/time.cal.operators/month_day.pass.cpp108
-rw-r--r--test/std/utilities/time/time.cal/time.cal.operators/month_day_last.pass.cpp107
-rw-r--r--test/std/utilities/time/time.cal/time.cal.operators/month_weekday.pass.cpp115
-rw-r--r--test/std/utilities/time/time.cal/time.cal.operators/month_weekday_last.pass.cpp107
-rw-r--r--test/std/utilities/time/time.cal/time.cal.operators/year_month.pass.cpp68
-rw-r--r--test/std/utilities/time/time.cal/time.cal.operators/year_month_day.pass.cpp191
-rw-r--r--test/std/utilities/time/time.cal/time.cal.operators/year_month_day_last.pass.cpp125
-rw-r--r--test/std/utilities/time/time.cal/time.cal.operators/year_month_weekday.pass.cpp145
-rw-r--r--test/std/utilities/time/time.cal/time.cal.operators/year_month_weekday_last.pass.cpp153
-rw-r--r--test/std/utilities/time/time.cal/time.cal.wdidx/time.cal.wdidx.members/ctor.pass.cpp61
-rw-r--r--test/std/utilities/time/time.cal/time.cal.wdidx/time.cal.wdidx.members/index.pass.cpp38
-rw-r--r--test/std/utilities/time/time.cal/time.cal.wdidx/time.cal.wdidx.members/ok.pass.cpp49
-rw-r--r--test/std/utilities/time/time.cal/time.cal.wdidx/time.cal.wdidx.members/weekday.pass.cpp39
-rw-r--r--test/std/utilities/time/time.cal/time.cal.wdidx/time.cal.wdidx.nonmembers/comparisons.pass.cpp48
-rw-r--r--test/std/utilities/time/time.cal/time.cal.wdidx/time.cal.wdidx.nonmembers/streaming.pass.cpp36
-rw-r--r--test/std/utilities/time/time.cal/time.cal.wdidx/types.pass.cpp26
-rw-r--r--test/std/utilities/time/time.cal/time.cal.wdlast/time.cal.wdlast.members/ctor.pass.cpp47
-rw-r--r--test/std/utilities/time/time.cal/time.cal.wdlast/time.cal.wdlast.members/ok.pass.cpp37
-rw-r--r--test/std/utilities/time/time.cal/time.cal.wdlast/time.cal.wdlast.members/weekday.pass.cpp33
-rw-r--r--test/std/utilities/time/time.cal/time.cal.wdlast/time.cal.wdlast.nonmembers/comparisons.pass.cpp43
-rw-r--r--test/std/utilities/time/time.cal/time.cal.wdlast/time.cal.wdlast.nonmembers/streaming.pass.cpp34
-rw-r--r--test/std/utilities/time/time.cal/time.cal.wdlast/types.pass.cpp26
-rw-r--r--test/std/utilities/time/time.cal/time.cal.weekday/time.cal.weekday.members/ctor.local_days.pass.cpp73
-rw-r--r--test/std/utilities/time/time.cal/time.cal.weekday/time.cal.weekday.members/ctor.pass.cpp51
-rw-r--r--test/std/utilities/time/time.cal/time.cal.weekday/time.cal.weekday.members/ctor.sys_days.pass.cpp73
-rw-r--r--test/std/utilities/time/time.cal/time.cal.weekday/time.cal.weekday.members/decrement.pass.cpp53
-rw-r--r--test/std/utilities/time/time.cal/time.cal.weekday/time.cal.weekday.members/increment.pass.cpp53
-rw-r--r--test/std/utilities/time/time.cal/time.cal.weekday/time.cal.weekday.members/ok.pass.cpp38
-rw-r--r--test/std/utilities/time/time.cal/time.cal.weekday/time.cal.weekday.members/operator[].pass.cpp59
-rw-r--r--test/std/utilities/time/time.cal/time.cal.weekday/time.cal.weekday.members/plus_minus_equal.pass.cpp63
-rw-r--r--test/std/utilities/time/time.cal/time.cal.weekday/time.cal.weekday.nonmembers/comparisons.pass.cpp42
-rw-r--r--test/std/utilities/time/time.cal/time.cal.weekday/time.cal.weekday.nonmembers/literals.pass.cpp62
-rw-r--r--test/std/utilities/time/time.cal/time.cal.weekday/time.cal.weekday.nonmembers/minus.pass.cpp76
-rw-r--r--test/std/utilities/time/time.cal/time.cal.weekday/time.cal.weekday.nonmembers/plus.pass.cpp70
-rw-r--r--test/std/utilities/time/time.cal/time.cal.weekday/time.cal.weekday.nonmembers/streaming.pass.cpp56
-rw-r--r--test/std/utilities/time/time.cal/time.cal.weekday/types.pass.cpp26
-rw-r--r--test/std/utilities/time/time.cal/time.cal.year/time.cal.year.members/ctor.pass.cpp46
-rw-r--r--test/std/utilities/time/time.cal/time.cal.year/time.cal.year.members/decrement.pass.cpp52
-rw-r--r--test/std/utilities/time/time.cal/time.cal.year/time.cal.year.members/increment.pass.cpp52
-rw-r--r--test/std/utilities/time/time.cal/time.cal.year/time.cal.year.members/is_leap.pass.cpp53
-rw-r--r--test/std/utilities/time/time.cal/time.cal.year/time.cal.year.members/ok.pass.cpp53
-rw-r--r--test/std/utilities/time/time.cal/time.cal.year/time.cal.year.members/plus_minus.pass.cpp50
-rw-r--r--test/std/utilities/time/time.cal/time.cal.year/time.cal.year.members/plus_minus_equal.pass.cpp57
-rw-r--r--test/std/utilities/time/time.cal/time.cal.year/time.cal.year.nonmembers/comparisons.pass.cpp47
-rw-r--r--test/std/utilities/time/time.cal/time.cal.year/time.cal.year.nonmembers/literals.fail.cpp28
-rw-r--r--test/std/utilities/time/time.cal/time.cal.year/time.cal.year.nonmembers/literals.pass.cpp44
-rw-r--r--test/std/utilities/time/time.cal/time.cal.year/time.cal.year.nonmembers/minus.pass.cpp62
-rw-r--r--test/std/utilities/time/time.cal/time.cal.year/time.cal.year.nonmembers/plus.pass.cpp59
-rw-r--r--test/std/utilities/time/time.cal/time.cal.year/time.cal.year.nonmembers/streaming.pass.cpp55
-rw-r--r--test/std/utilities/time/time.cal/time.cal.year/types.pass.cpp26
-rw-r--r--test/std/utilities/time/time.cal/time.cal.ym/time.cal.ym.members/ctor.pass.cpp52
-rw-r--r--test/std/utilities/time/time.cal/time.cal.ym/time.cal.ym.members/month.pass.cpp39
-rw-r--r--test/std/utilities/time/time.cal/time.cal.ym/time.cal.ym.members/ok.pass.cpp50
-rw-r--r--test/std/utilities/time/time.cal/time.cal.ym/time.cal.ym.members/plus_minus_equal_month.pass.cpp64
-rw-r--r--test/std/utilities/time/time.cal/time.cal.ym/time.cal.ym.members/plus_minus_equal_year.pass.cpp65
-rw-r--r--test/std/utilities/time/time.cal/time.cal.ym/time.cal.ym.members/year.pass.cpp39
-rw-r--r--test/std/utilities/time/time.cal/time.cal.ym/time.cal.ym.nonmembers/comparisons.pass.cpp69
-rw-r--r--test/std/utilities/time/time.cal/time.cal.ym/time.cal.ym.nonmembers/minus.pass.cpp90
-rw-r--r--test/std/utilities/time/time.cal/time.cal.ym/time.cal.ym.nonmembers/plus.pass.cpp106
-rw-r--r--test/std/utilities/time/time.cal/time.cal.ym/time.cal.ym.nonmembers/streaming.pass.cpp57
-rw-r--r--test/std/utilities/time/time.cal/time.cal.ym/types.pass.cpp26
-rw-r--r--test/std/utilities/time/time.cal/time.cal.ymd/time.cal.ymd.members/ctor.local_days.pass.cpp85
-rw-r--r--test/std/utilities/time/time.cal/time.cal.ymd/time.cal.ymd.members/ctor.pass.cpp56
-rw-r--r--test/std/utilities/time/time.cal/time.cal.ymd/time.cal.ymd.members/ctor.sys_days.pass.cpp84
-rw-r--r--test/std/utilities/time/time.cal/time.cal.ymd/time.cal.ymd.members/ctor.year_month_day_last.pass.cpp80
-rw-r--r--test/std/utilities/time/time.cal/time.cal.ymd/time.cal.ymd.members/day.pass.cpp40
-rw-r--r--test/std/utilities/time/time.cal/time.cal.ymd/time.cal.ymd.members/month.pass.cpp40
-rw-r--r--test/std/utilities/time/time.cal/time.cal.ymd/time.cal.ymd.members/ok.pass.cpp96
-rw-r--r--test/std/utilities/time/time.cal/time.cal.ymd/time.cal.ymd.members/op.local_days.pass.cpp94
-rw-r--r--test/std/utilities/time/time.cal/time.cal.ymd/time.cal.ymd.members/op.sys_days.pass.cpp94
-rw-r--r--test/std/utilities/time/time.cal/time.cal.ymd/time.cal.ymd.members/plus_minus_equal_month.pass.cpp70
-rw-r--r--test/std/utilities/time/time.cal/time.cal.ymd/time.cal.ymd.members/plus_minus_equal_year.pass.cpp70
-rw-r--r--test/std/utilities/time/time.cal/time.cal.ymd/time.cal.ymd.members/year.pass.cpp40
-rw-r--r--test/std/utilities/time/time.cal/time.cal.ymd/time.cal.ymd.nonmembers/comparisons.pass.cpp118
-rw-r--r--test/std/utilities/time/time.cal/time.cal.ymd/time.cal.ymd.nonmembers/minus.pass.cpp60
-rw-r--r--test/std/utilities/time/time.cal/time.cal.ymd/time.cal.ymd.nonmembers/plus.pass.cpp112
-rw-r--r--test/std/utilities/time/time.cal/time.cal.ymd/time.cal.ymd.nonmembers/streaming.pass.cpp58
-rw-r--r--test/std/utilities/time/time.cal/time.cal.ymd/types.pass.cpp26
-rw-r--r--test/std/utilities/time/time.cal/time.cal.ymdlast/time.cal.ymdlast.members/ctor.pass.cpp53
-rw-r--r--test/std/utilities/time/time.cal/time.cal.ymdlast/time.cal.ymdlast.members/day.pass.cpp51
-rw-r--r--test/std/utilities/time/time.cal/time.cal.ymdlast/time.cal.ymdlast.members/month.pass.cpp38
-rw-r--r--test/std/utilities/time/time.cal/time.cal.ymdlast/time.cal.ymdlast.members/month_day_last.pass.cpp38
-rw-r--r--test/std/utilities/time/time.cal/time.cal.ymdlast/time.cal.ymdlast.members/ok.pass.cpp52
-rw-r--r--test/std/utilities/time/time.cal/time.cal.ymdlast/time.cal.ymdlast.members/op_local_days.pass.cpp61
-rw-r--r--test/std/utilities/time/time.cal/time.cal.ymdlast/time.cal.ymdlast.members/op_sys_days.pass.cpp61
-rw-r--r--test/std/utilities/time/time.cal/time.cal.ymdlast/time.cal.ymdlast.members/plus_minus_equal_month.pass.cpp66
-rw-r--r--test/std/utilities/time/time.cal/time.cal.ymdlast/time.cal.ymdlast.members/plus_minus_equal_year.pass.cpp65
-rw-r--r--test/std/utilities/time/time.cal/time.cal.ymdlast/time.cal.ymdlast.members/year.pass.cpp38
-rw-r--r--test/std/utilities/time/time.cal/time.cal.ymdlast/time.cal.ymdlast.nonmembers/comparisons.pass.cpp87
-rw-r--r--test/std/utilities/time/time.cal/time.cal.ymdlast/time.cal.ymdlast.nonmembers/minus.pass.cpp91
-rw-r--r--test/std/utilities/time/time.cal/time.cal.ymdlast/time.cal.ymdlast.nonmembers/plus.pass.cpp122
-rw-r--r--test/std/utilities/time/time.cal/time.cal.ymdlast/time.cal.ymdlast.nonmembers/streaming.pass.cpp37
-rw-r--r--test/std/utilities/time/time.cal/time.cal.ymwd/time.cal.ymwd.members/ctor.local_days.pass.cpp95
-rw-r--r--test/std/utilities/time/time.cal/time.cal.ymwd/time.cal.ymwd.members/ctor.pass.cpp64
-rw-r--r--test/std/utilities/time/time.cal/time.cal.ymwd/time.cal.ymwd.members/ctor.sys_days.pass.cpp94
-rw-r--r--test/std/utilities/time/time.cal/time.cal.ymwd/time.cal.ymwd.members/index.pass.cpp41
-rw-r--r--test/std/utilities/time/time.cal/time.cal.ymwd/time.cal.ymwd.members/month.pass.cpp40
-rw-r--r--test/std/utilities/time/time.cal/time.cal.ymwd/time.cal.ymwd.members/ok.pass.cpp75
-rw-r--r--test/std/utilities/time/time.cal/time.cal.ymwd/time.cal.ymwd.members/op.local_days.pass.cpp74
-rw-r--r--test/std/utilities/time/time.cal/time.cal.ymwd/time.cal.ymwd.members/op.sys_days.pass.cpp74
-rw-r--r--test/std/utilities/time/time.cal/time.cal.ymwd/time.cal.ymwd.members/plus_minus_equal_month.pass.cpp80
-rw-r--r--test/std/utilities/time/time.cal/time.cal.ymwd/time.cal.ymwd.members/plus_minus_equal_year.pass.cpp80
-rw-r--r--test/std/utilities/time/time.cal/time.cal.ymwd/time.cal.ymwd.members/weekday.pass.cpp41
-rw-r--r--test/std/utilities/time/time.cal/time.cal.ymwd/time.cal.ymwd.members/weekday_indexed.pass.cpp45
-rw-r--r--test/std/utilities/time/time.cal/time.cal.ymwd/time.cal.ymwd.members/year.pass.cpp40
-rw-r--r--test/std/utilities/time/time.cal/time.cal.ymwd/time.cal.ymwd.nonmembers/comparisons.pass.cpp113
-rw-r--r--test/std/utilities/time/time.cal/time.cal.ymwd/time.cal.ymwd.nonmembers/minus.pass.cpp100
-rw-r--r--test/std/utilities/time/time.cal/time.cal.ymwd/time.cal.ymwd.nonmembers/plus.pass.cpp120
-rw-r--r--test/std/utilities/time/time.cal/time.cal.ymwd/time.cal.ymwd.nonmembers/streaming.pass.cpp57
-rw-r--r--test/std/utilities/time/time.cal/time.cal.ymwd/types.pass.cpp26
-rw-r--r--test/std/utilities/time/time.cal/time.cal.ymwdlast/time.cal.ymwdlast.members/ctor.pass.cpp52
-rw-r--r--test/std/utilities/time/time.cal/time.cal.ymwdlast/time.cal.ymwdlast.members/month.pass.cpp41
-rw-r--r--test/std/utilities/time/time.cal/time.cal.ymwdlast/time.cal.ymwdlast.members/ok.pass.cpp73
-rw-r--r--test/std/utilities/time/time.cal/time.cal.ymwdlast/time.cal.ymwdlast.members/op_local_days.pass.cpp61
-rw-r--r--test/std/utilities/time/time.cal/time.cal.ymwdlast/time.cal.ymwdlast.members/op_sys_days.pass.cpp69
-rw-r--r--test/std/utilities/time/time.cal/time.cal.ymwdlast/time.cal.ymwdlast.members/plus_minus_equal_month.pass.cpp75
-rw-r--r--test/std/utilities/time/time.cal/time.cal.ymwdlast/time.cal.ymwdlast.members/plus_minus_equal_year.pass.cpp76
-rw-r--r--test/std/utilities/time/time.cal/time.cal.ymwdlast/time.cal.ymwdlast.members/weekday.pass.cpp41
-rw-r--r--test/std/utilities/time/time.cal/time.cal.ymwdlast/time.cal.ymwdlast.members/year.pass.cpp41
-rw-r--r--test/std/utilities/time/time.cal/time.cal.ymwdlast/time.cal.ymwdlast.nonmembers/comparisons.pass.cpp114
-rw-r--r--test/std/utilities/time/time.cal/time.cal.ymwdlast/time.cal.ymwdlast.nonmembers/minus.pass.cpp93
-rw-r--r--test/std/utilities/time/time.cal/time.cal.ymwdlast/time.cal.ymwdlast.nonmembers/plus.pass.cpp116
-rw-r--r--test/std/utilities/time/time.cal/time.cal.ymwdlast/time.cal.ymwdlast.nonmembers/streaming.pass.cpp38
-rw-r--r--test/std/utilities/time/time.cal/time.cal.ymwdlast/types.pass.cpp26
-rw-r--r--test/std/utilities/time/time.clock/time.clock.file/consistency.pass.cpp35
-rw-r--r--test/std/utilities/time/time.clock/time.clock.file/file_time.pass.cpp29
-rw-r--r--test/std/utilities/time/time.clock/time.clock.file/now.pass.cpp35
-rw-r--r--test/std/utilities/time/time.clock/time.clock.file/rep_signed.pass.cpp29
-rw-r--r--test/std/utilities/time/time.clock/time.clock.hires/consistency.pass.cpp7
-rw-r--r--test/std/utilities/time/time.clock/time.clock.steady/consistency.pass.cpp7
-rw-r--r--test/std/utilities/time/time.clock/time.clock.system/consistency.pass.cpp7
-rw-r--r--test/std/utilities/time/time.clock/time.clock.system/local_time.types.pass.cpp65
-rw-r--r--test/std/utilities/time/time.clock/time.clock.system/sys.time.types.pass.cpp64
-rw-r--r--test/std/utilities/time/time.duration/time.duration.literals/literals.pass.cpp3
-rw-r--r--test/std/utilities/time/time.duration/time.duration.literals/literals1.pass.cpp25
-rw-r--r--test/std/utilities/time/time.duration/time.duration.nonmember/op_divide_duration.pass.cpp3
-rw-r--r--test/std/utilities/time/time.duration/time.duration.special/max.pass.cpp6
-rw-r--r--test/std/utilities/time/time.duration/time.duration.special/min.pass.cpp6
-rw-r--r--test/std/utilities/time/time.duration/time.duration.special/zero.pass.cpp6
-rw-r--r--test/std/utilities/time/time.point/time.point.arithmetic/op_+=.pass.cpp20
-rw-r--r--test/std/utilities/time/time.point/time.point.arithmetic/op_-=.pass.cpp20
-rw-r--r--test/std/utilities/time/time.point/time.point.special/max.pass.cpp8
-rw-r--r--test/std/utilities/time/time.point/time.point.special/min.pass.cpp8
-rw-r--r--test/std/utilities/time/time.traits/time.traits.duration_values/max.pass.cpp11
-rw-r--r--test/std/utilities/time/time.traits/time.traits.duration_values/min.pass.cpp11
-rw-r--r--test/std/utilities/time/time.traits/time.traits.duration_values/zero.pass.cpp9
-rw-r--r--test/std/utilities/time/weeks.pass.cpp28
-rw-r--r--test/std/utilities/time/years.pass.cpp28
-rw-r--r--test/std/utilities/tuple/tuple.tuple/TupleFunction.pass.cpp3
-rw-r--r--test/std/utilities/tuple/tuple.tuple/tuple.assign/move.pass.cpp1
-rw-r--r--test/std/utilities/tuple/tuple.tuple/tuple.cnstr/PR20855_tuple_ref_binding_diagnostics.pass.cpp1
-rw-r--r--test/std/utilities/tuple/tuple.tuple/tuple.helper/tuple_size_incomplete.fail.cpp8
-rw-r--r--test/std/utilities/tuple/tuple.tuple/tuple.helper/tuple_size_incomplete.pass.cpp4
-rw-r--r--test/std/utilities/tuple/tuple.tuple/tuple.helper/tuple_size_structured_bindings.pass.cpp4
-rw-r--r--test/std/utilities/type.index/type.index.hash/hash.pass.cpp1
-rw-r--r--test/std/utilities/utility/pairs/pairs.pair/piecewise.pass.cpp5
-rw-r--r--test/std/utilities/variant/variant.bad_variant_access/bad_variant_access.pass.cpp14
-rw-r--r--test/std/utilities/variant/variant.get/get_index.pass.cpp13
-rw-r--r--test/std/utilities/variant/variant.get/get_type.pass.cpp13
-rw-r--r--test/std/utilities/variant/variant.relops/relops.pass.cpp107
-rw-r--r--test/std/utilities/variant/variant.relops/relops_bool_conv.fail.cpp88
-rw-r--r--test/std/utilities/variant/variant.variant/variant.assign/T.pass.cpp13
-rw-r--r--test/std/utilities/variant/variant.variant/variant.assign/copy.pass.cpp45
-rw-r--r--test/std/utilities/variant/variant.variant/variant.assign/move.pass.cpp46
-rw-r--r--test/std/utilities/variant/variant.variant/variant.ctor/T.pass.cpp8
-rw-r--r--test/std/utilities/variant/variant.variant/variant.ctor/copy.pass.cpp41
-rw-r--r--test/std/utilities/variant/variant.variant/variant.ctor/default.pass.cpp26
-rw-r--r--test/std/utilities/variant/variant.variant/variant.ctor/in_place_index_args.pass.cpp13
-rw-r--r--test/std/utilities/variant/variant.variant/variant.ctor/in_place_index_init_list_args.pass.cpp8
-rw-r--r--test/std/utilities/variant/variant.variant/variant.ctor/in_place_type_args.pass.cpp13
-rw-r--r--test/std/utilities/variant/variant.variant/variant.ctor/in_place_type_init_list_args.pass.cpp8
-rw-r--r--test/std/utilities/variant/variant.variant/variant.ctor/move.pass.cpp41
-rw-r--r--test/std/utilities/variant/variant.variant/variant.mod/emplace_index_args.pass.cpp13
-rw-r--r--test/std/utilities/variant/variant.variant/variant.mod/emplace_index_init_list_args.pass.cpp13
-rw-r--r--test/std/utilities/variant/variant.variant/variant.mod/emplace_type_args.pass.cpp13
-rw-r--r--test/std/utilities/variant/variant.variant/variant.mod/emplace_type_init_list_args.pass.cpp13
-rw-r--r--test/std/utilities/variant/variant.variant/variant.status/index.pass.cpp16
-rw-r--r--test/std/utilities/variant/variant.variant/variant.status/valueless_by_exception.pass.cpp16
-rw-r--r--test/std/utilities/variant/variant.variant/variant.swap/swap.pass.cpp13
-rw-r--r--test/std/utilities/variant/variant.visit/visit.pass.cpp13
-rw-r--r--test/support/any_helpers.h3
-rw-r--r--test/support/archetypes.hpp15
-rw-r--r--test/support/archetypes.ipp86
-rw-r--r--test/support/counting_predicates.hpp11
-rw-r--r--test/support/filesystem_dynamic_test_helper.py13
-rw-r--r--test/support/filesystem_test_helper.hpp46
-rw-r--r--test/support/min_allocator.h54
-rw-r--r--test/support/nasty_macros.hpp7
-rw-r--r--test/support/poisoned_hash_helper.hpp2
-rw-r--r--test/support/test_comparisons.h80
-rw-r--r--test/support/test_macros.h59
-rw-r--r--test/support/truncate_fp.h23
-rw-r--r--test/support/unique_ptr_test_helper.h1
846 files changed, 28407 insertions, 3328 deletions
diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt
index f8442460a2fe3..9435744d3c811 100644
--- a/test/CMakeLists.txt
+++ b/test/CMakeLists.txt
@@ -55,17 +55,8 @@ set(LIBCXX_EXECUTOR "None" CACHE STRING
set(AUTO_GEN_COMMENT "## Autogenerated by libcxx configuration.\n# Do not edit!")
-set(LIBCXX_TEST_DEPS "")
-
-if (LIBCXX_ENABLE_EXPERIMENTAL_LIBRARY)
- list(APPEND LIBCXX_TEST_DEPS cxx_experimental)
-endif()
-if (LIBCXX_ENABLE_FILESYSTEM)
- list(APPEND LIBCXX_TEST_DEPS cxx_filesystem)
-endif()
-
-if (LIBCXX_BUILD_EXTERNAL_THREAD_LIBRARY)
- list(APPEND LIBCXX_TEST_DEPS cxx_external_threads)
+if (NOT DEFINED LIBCXX_TEST_DEPS)
+ message(FATAL_ERROR "Expected LIBCXX_TEST_DEPS to be defined")
endif()
if (LIBCXX_INCLUDE_TESTS)
diff --git a/test/libcxx/algorithms/alg.modifying.operations/alg.random.shuffle/random_shuffle.cxx1z.pass.cpp b/test/libcxx/algorithms/alg.modifying.operations/alg.random.shuffle/random_shuffle.cxx1z.pass.cpp
index 28a9281b49c2a..58ce689981cac 100644
--- a/test/libcxx/algorithms/alg.modifying.operations/alg.random.shuffle/random_shuffle.cxx1z.pass.cpp
+++ b/test/libcxx/algorithms/alg.modifying.operations/alg.random.shuffle/random_shuffle.cxx1z.pass.cpp
@@ -7,7 +7,7 @@
//
//===----------------------------------------------------------------------===//
-// <memory>
+// <algorithm>
// template <class RandomAccessIterator>
// void
@@ -23,6 +23,8 @@
// However, for backwards compatibility, if _LIBCPP_ENABLE_CXX17_REMOVED_RANDOM_SHUFFLE
// is defined before including <algorithm>, then random_shuffle will be restored.
+// REQUIRES: verify-support
+
// MODULES_DEFINES: _LIBCPP_ENABLE_CXX17_REMOVED_RANDOM_SHUFFLE
#define _LIBCPP_ENABLE_CXX17_REMOVED_RANDOM_SHUFFLE
diff --git a/test/libcxx/algorithms/alg.modifying.operations/alg.random.shuffle/random_shuffle.depr_in_cxx14.fail.cpp b/test/libcxx/algorithms/alg.modifying.operations/alg.random.shuffle/random_shuffle.depr_in_cxx14.fail.cpp
new file mode 100644
index 0000000000000..608f4f86c31f9
--- /dev/null
+++ b/test/libcxx/algorithms/alg.modifying.operations/alg.random.shuffle/random_shuffle.depr_in_cxx14.fail.cpp
@@ -0,0 +1,50 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <algorithm>
+
+// template <class RandomAccessIterator>
+// void
+// random_shuffle(RandomAccessIterator first, RandomAccessIterator last);
+//
+// template <class RandomAccessIterator, class RandomNumberGenerator>
+// void
+// random_shuffle(RandomAccessIterator first, RandomAccessIterator last,
+// RandomNumberGenerator& rand);
+
+// UNSUPPORTED: clang-4.0
+// UNSUPPORTED: c++98, c++03, c++11
+// REQUIRES: verify-support
+
+// MODULES_DEFINES: _LIBCPP_ENABLE_DEPRECATION_WARNINGS
+// MODULES_DEFINES: _LIBCPP_ENABLE_CXX17_REMOVED_RANDOM_SHUFFLE
+#define _LIBCPP_ENABLE_DEPRECATION_WARNINGS
+#define _LIBCPP_ENABLE_CXX17_REMOVED_RANDOM_SHUFFLE
+
+#include <algorithm>
+#include <cstddef>
+
+#include "test_macros.h"
+
+struct gen
+{
+ std::ptrdiff_t operator()(std::ptrdiff_t n)
+ {
+ return n-1;
+ }
+};
+
+
+int main()
+{
+ int v[1] = {1};
+ std::random_shuffle(&v[0], &v[1]); // expected-error{{'random_shuffle<int *>' is deprecated}}
+ gen r;
+ std::random_shuffle(&v[0], &v[1], r); // expected-error{{'random_shuffle<int *, gen &>' is deprecated}}
+}
diff --git a/test/libcxx/algorithms/debug_less.pass.cpp b/test/libcxx/algorithms/debug_less.pass.cpp
index e030f64e5dd9d..302c5a8376c8d 100644
--- a/test/libcxx/algorithms/debug_less.pass.cpp
+++ b/test/libcxx/algorithms/debug_less.pass.cpp
@@ -161,7 +161,58 @@ void test_failing() {
}
}
+template <int>
+struct Tag {
+ explicit Tag(int v) : value(v) {}
+ int value;
+};
+
+template <class = void>
+struct FooImp {
+ explicit FooImp(int x) : x_(x) {}
+ int x_;
+};
+
+template <class T>
+inline bool operator<(FooImp<T> const& x, Tag<0> y) {
+ return x.x_ < y.value;
+}
+
+template <class T>
+inline bool operator<(Tag<0>, FooImp<T> const&) {
+ static_assert(sizeof(FooImp<T>) != sizeof(FooImp<T>), "should not be instantiated");
+}
+
+template <class T>
+inline bool operator<(Tag<1> x, FooImp<T> const& y) {
+ return x.value < y.x_;
+}
+
+template <class T>
+inline bool operator<(FooImp<T> const&, Tag<1>) {
+ static_assert(sizeof(FooImp<T>) != sizeof(FooImp<T>), "should not be instantiated");
+}
+
+typedef FooImp<> Foo;
+
+// Test that we don't attempt to call the comparator with the arguments reversed
+// for upper_bound and lower_bound since the comparator or type is not required
+// to support it, nor does it require the range to have a strict weak ordering.
+// See llvm.org/PR39458
+void test_upper_and_lower_bound() {
+ Foo table[] = {Foo(1), Foo(2), Foo(3), Foo(4), Foo(5)};
+ {
+ Foo* iter = std::lower_bound(std::begin(table), std::end(table), Tag<0>(3));
+ assert(iter == (table + 2));
+ }
+ {
+ Foo* iter = std::upper_bound(std::begin(table), std::end(table), Tag<1>(3));
+ assert(iter == (table + 3));
+ }
+}
+
int main() {
test_passing();
test_failing();
+ test_upper_and_lower_bound();
}
diff --git a/test/libcxx/algorithms/half_positive.pass.cpp b/test/libcxx/algorithms/half_positive.pass.cpp
new file mode 100644
index 0000000000000..7dcfc2c92c946
--- /dev/null
+++ b/test/libcxx/algorithms/half_positive.pass.cpp
@@ -0,0 +1,56 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <algorithm>
+
+// __half_positive divides an integer number by 2 as unsigned number for known types.
+// It can be an important optimization for lower bound, for example.
+
+#include <algorithm>
+#include <cassert>
+#include <limits>
+#include <type_traits>
+
+#include "test_macros.h"
+#include "user_defined_integral.hpp"
+
+namespace {
+
+template <class IntType, class UnderlyingType = IntType>
+TEST_CONSTEXPR bool test(IntType max_v = IntType(std::numeric_limits<UnderlyingType>::max())) {
+ return std::__half_positive(max_v) == max_v / 2;
+}
+
+} // namespace
+
+int main()
+{
+ {
+ assert(test<char>());
+ assert(test<int>());
+ assert(test<long>());
+ assert((test<UserDefinedIntegral<int>, int>()));
+ assert(test<size_t>());
+#if !defined(_LIBCPP_HAS_NO_INT128)
+ assert(test<__int128_t>());
+#endif // !defined(_LIBCPP_HAS_NO_INT128)
+ }
+
+#if TEST_STD_VER >= 11
+ {
+ static_assert(test<char>(), "");
+ static_assert(test<int>(), "");
+ static_assert(test<long>(), "");
+ static_assert(test<size_t>(), "");
+#if !defined(_LIBCPP_HAS_NO_INT128)
+ static_assert(test<__int128_t>(), "");
+#endif // !defined(_LIBCPP_HAS_NO_INT128)
+ }
+#endif // TEST_STD_VER >= 11
+}
diff --git a/test/libcxx/containers/associative/non_const_comparator.fail.cpp b/test/libcxx/containers/associative/non_const_comparator.fail.cpp
index ea0d9ac09328e..ddd7960893997 100644
--- a/test/libcxx/containers/associative/non_const_comparator.fail.cpp
+++ b/test/libcxx/containers/associative/non_const_comparator.fail.cpp
@@ -27,7 +27,8 @@ int main() {
static_assert(!std::__invokable<BadCompare const&, int const&, int const&>::value, "");
static_assert(std::__invokable<BadCompare&, int const&, int const&>::value, "");
- // expected-warning@__tree:* 4 {{the specified comparator type does not provide a const call operator}}
+ // expected-warning@set:* 2 {{the specified comparator type does not provide a const call operator}}
+ // expected-warning@map:* 2 {{the specified comparator type does not provide a const call operator}}
{
using C = std::set<int, BadCompare>;
C s;
diff --git a/test/libcxx/type_traits/is_floating_point.pass.cpp b/test/libcxx/containers/sequences/deque/pop_back_empty.pass.cpp
index 98452fad384ba..e4f5d0b01197b 100644
--- a/test/libcxx/type_traits/is_floating_point.pass.cpp
+++ b/test/libcxx/containers/sequences/deque/pop_back_empty.pass.cpp
@@ -6,19 +6,21 @@
// Source Licenses. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
-//
-// <type_traits>
-//
-// Test that is_floating_point<T>::value is true when T=__fp16 or T=_Float16.
-#include <type_traits>
+// <deque>
+
+// pop_back() more than the number of elements in a deque
+
+#define _LIBCPP_ASSERT(x, m) ((x) ? (void)0 : std::exit(0))
+
+#include <cstdlib>
+#include <deque>
+
int main() {
-#ifdef __clang__
- static_assert(std::is_floating_point<__fp16>::value, "");
-#endif
-#ifdef __FLT16_MANT_DIG__
- static_assert(std::is_floating_point<_Float16>::value, "");
-#endif
- return 0;
+ std::deque<int> q;
+ q.push_back(0);
+ q.pop_back();
+ q.pop_back();
+ std::exit(1);
}
diff --git a/test/libcxx/containers/sequences/vector/db_back.pass.cpp b/test/libcxx/containers/sequences/vector/db_back.pass.cpp
index 05f3d07712eb5..d66ffeb67af04 100644
--- a/test/libcxx/containers/sequences/vector/db_back.pass.cpp
+++ b/test/libcxx/containers/sequences/vector/db_back.pass.cpp
@@ -21,6 +21,7 @@
#include <exception>
#include <cstdlib>
+#include "test_macros.h"
#include "min_allocator.h"
int main()
@@ -34,7 +35,7 @@ int main()
assert(c.back() == 0);
assert(false);
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef int T;
typedef std::vector<T, min_allocator<T>> C;
diff --git a/test/libcxx/containers/sequences/vector/db_cback.pass.cpp b/test/libcxx/containers/sequences/vector/db_cback.pass.cpp
index 5eb1a353e8b04..9ad0fb92969f2 100644
--- a/test/libcxx/containers/sequences/vector/db_cback.pass.cpp
+++ b/test/libcxx/containers/sequences/vector/db_cback.pass.cpp
@@ -21,6 +21,7 @@
#include <exception>
#include <cstdlib>
+#include "test_macros.h"
#include "min_allocator.h"
int main()
@@ -32,7 +33,7 @@ int main()
assert(c.back() == 0);
assert(false);
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef int T;
typedef std::vector<T, min_allocator<T>> C;
diff --git a/test/libcxx/containers/sequences/vector/db_cfront.pass.cpp b/test/libcxx/containers/sequences/vector/db_cfront.pass.cpp
index 5e54da1d444e9..58f57a500dd9a 100644
--- a/test/libcxx/containers/sequences/vector/db_cfront.pass.cpp
+++ b/test/libcxx/containers/sequences/vector/db_cfront.pass.cpp
@@ -21,6 +21,7 @@
#include <exception>
#include <cstdlib>
+#include "test_macros.h"
#include "min_allocator.h"
int main()
@@ -32,7 +33,7 @@ int main()
assert(c.front() == 0);
assert(false);
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef int T;
typedef std::vector<T, min_allocator<T>> C;
diff --git a/test/libcxx/containers/sequences/vector/db_cindex.pass.cpp b/test/libcxx/containers/sequences/vector/db_cindex.pass.cpp
index 133aa56528245..9a54b6cb98420 100644
--- a/test/libcxx/containers/sequences/vector/db_cindex.pass.cpp
+++ b/test/libcxx/containers/sequences/vector/db_cindex.pass.cpp
@@ -21,6 +21,7 @@
#include <exception>
#include <cstdlib>
+#include "test_macros.h"
#include "min_allocator.h"
int main()
@@ -33,7 +34,7 @@ int main()
assert(c[1] == 0);
assert(false);
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef int T;
typedef std::vector<T, min_allocator<T>> C;
diff --git a/test/libcxx/containers/sequences/vector/db_front.pass.cpp b/test/libcxx/containers/sequences/vector/db_front.pass.cpp
index 388058fb31593..0acb7df0c4d9e 100644
--- a/test/libcxx/containers/sequences/vector/db_front.pass.cpp
+++ b/test/libcxx/containers/sequences/vector/db_front.pass.cpp
@@ -21,6 +21,7 @@
#include <exception>
#include <cstdlib>
+#include "test_macros.h"
#include "min_allocator.h"
int main()
@@ -34,7 +35,7 @@ int main()
assert(c.front() == 0);
assert(false);
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef int T;
typedef std::vector<T, min_allocator<T>> C;
diff --git a/test/libcxx/containers/sequences/vector/db_index.pass.cpp b/test/libcxx/containers/sequences/vector/db_index.pass.cpp
index 1daf076da67c1..75ae095f2b1c1 100644
--- a/test/libcxx/containers/sequences/vector/db_index.pass.cpp
+++ b/test/libcxx/containers/sequences/vector/db_index.pass.cpp
@@ -21,6 +21,7 @@
#include <exception>
#include <cstdlib>
+#include "test_macros.h"
#include "min_allocator.h"
int main()
@@ -34,7 +35,7 @@ int main()
assert(c[0] == 0);
assert(false);
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef int T;
typedef std::vector<T, min_allocator<T>> C;
diff --git a/test/libcxx/containers/sequences/vector/db_iterators_2.pass.cpp b/test/libcxx/containers/sequences/vector/db_iterators_2.pass.cpp
index 2d43843067b75..d5e8c86109b7c 100644
--- a/test/libcxx/containers/sequences/vector/db_iterators_2.pass.cpp
+++ b/test/libcxx/containers/sequences/vector/db_iterators_2.pass.cpp
@@ -21,6 +21,7 @@
#include <exception>
#include <cstdlib>
+#include "test_macros.h"
#include "min_allocator.h"
int main()
@@ -33,7 +34,7 @@ int main()
bool b = c1.begin() < c2.begin();
assert(false);
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef int T;
typedef std::vector<T, min_allocator<T>> C;
diff --git a/test/libcxx/containers/sequences/vector/db_iterators_3.pass.cpp b/test/libcxx/containers/sequences/vector/db_iterators_3.pass.cpp
index 051d66c33394d..96a75204a7bd6 100644
--- a/test/libcxx/containers/sequences/vector/db_iterators_3.pass.cpp
+++ b/test/libcxx/containers/sequences/vector/db_iterators_3.pass.cpp
@@ -21,6 +21,7 @@
#include <exception>
#include <cstdlib>
+#include "test_macros.h"
#include "min_allocator.h"
int main()
@@ -33,7 +34,7 @@ int main()
int i = c1.begin() - c2.begin();
assert(false);
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef int T;
typedef std::vector<T, min_allocator<T>> C;
diff --git a/test/libcxx/containers/sequences/vector/db_iterators_4.pass.cpp b/test/libcxx/containers/sequences/vector/db_iterators_4.pass.cpp
index 4c2aa628de143..311a517cfc015 100644
--- a/test/libcxx/containers/sequences/vector/db_iterators_4.pass.cpp
+++ b/test/libcxx/containers/sequences/vector/db_iterators_4.pass.cpp
@@ -21,6 +21,7 @@
#include <exception>
#include <cstdlib>
+#include "test_macros.h"
#include "min_allocator.h"
int main()
@@ -34,7 +35,7 @@ int main()
assert(i[1] == 0);
assert(false);
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef int T;
typedef std::vector<T, min_allocator<T>> C;
diff --git a/test/libcxx/containers/sequences/vector/db_iterators_5.pass.cpp b/test/libcxx/containers/sequences/vector/db_iterators_5.pass.cpp
index 1b1090499c276..6df3fd459c187 100644
--- a/test/libcxx/containers/sequences/vector/db_iterators_5.pass.cpp
+++ b/test/libcxx/containers/sequences/vector/db_iterators_5.pass.cpp
@@ -21,6 +21,7 @@
#include <exception>
#include <cstdlib>
+#include "test_macros.h"
#include "min_allocator.h"
int main()
@@ -36,7 +37,7 @@ int main()
i += 2;
assert(false);
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef int T;
typedef std::vector<T, min_allocator<T>> C;
diff --git a/test/libcxx/containers/sequences/vector/db_iterators_6.pass.cpp b/test/libcxx/containers/sequences/vector/db_iterators_6.pass.cpp
index 424bc939b1366..0785dd96444ca 100644
--- a/test/libcxx/containers/sequences/vector/db_iterators_6.pass.cpp
+++ b/test/libcxx/containers/sequences/vector/db_iterators_6.pass.cpp
@@ -21,6 +21,7 @@
#include <exception>
#include <cstdlib>
+#include "test_macros.h"
#include "min_allocator.h"
int main()
@@ -35,7 +36,7 @@ int main()
--i;
assert(false);
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef int T;
typedef std::vector<T, min_allocator<T>> C;
diff --git a/test/libcxx/containers/sequences/vector/db_iterators_7.pass.cpp b/test/libcxx/containers/sequences/vector/db_iterators_7.pass.cpp
index 72cdb10cbc855..11ba9f864b0c9 100644
--- a/test/libcxx/containers/sequences/vector/db_iterators_7.pass.cpp
+++ b/test/libcxx/containers/sequences/vector/db_iterators_7.pass.cpp
@@ -21,6 +21,7 @@
#include <exception>
#include <cstdlib>
+#include "test_macros.h"
#include "min_allocator.h"
int main()
@@ -35,7 +36,7 @@ int main()
++i;
assert(false);
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef int T;
typedef std::vector<T, min_allocator<T>> C;
diff --git a/test/libcxx/containers/sequences/vector/db_iterators_8.pass.cpp b/test/libcxx/containers/sequences/vector/db_iterators_8.pass.cpp
index 7b898533197c6..0434ad5f15098 100644
--- a/test/libcxx/containers/sequences/vector/db_iterators_8.pass.cpp
+++ b/test/libcxx/containers/sequences/vector/db_iterators_8.pass.cpp
@@ -21,6 +21,7 @@
#include <exception>
#include <cstdlib>
+#include "test_macros.h"
#include "min_allocator.h"
int main()
@@ -33,7 +34,7 @@ int main()
T j = *i;
assert(false);
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef int T;
typedef std::vector<T, min_allocator<T>> C;
diff --git a/test/libcxx/containers/sequences/vector/pop_back_empty.pass.cpp b/test/libcxx/containers/sequences/vector/pop_back_empty.pass.cpp
new file mode 100644
index 0000000000000..388dfa4e1a833
--- /dev/null
+++ b/test/libcxx/containers/sequences/vector/pop_back_empty.pass.cpp
@@ -0,0 +1,26 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <vector>
+
+// pop_back() more than the number of elements in a vector
+
+#define _LIBCPP_ASSERT(x, m) ((x) ? (void)0 : std::exit(0))
+
+#include <cstdlib>
+#include <vector>
+
+
+int main() {
+ std::vector<int> v;
+ v.push_back(0);
+ v.pop_back();
+ v.pop_back();
+ std::exit(1);
+}
diff --git a/test/libcxx/containers/sequences/vector/vector.cons/construct_iter_iter.pass.cpp b/test/libcxx/containers/sequences/vector/vector.cons/construct_iter_iter.pass.cpp
new file mode 100644
index 0000000000000..998d0b74eddff
--- /dev/null
+++ b/test/libcxx/containers/sequences/vector/vector.cons/construct_iter_iter.pass.cpp
@@ -0,0 +1,54 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <vector>
+
+// template <class InputIter> vector(InputIter first, InputIter last);
+
+#include <vector>
+#include <cassert>
+
+#include "min_allocator.h"
+
+void test_ctor_under_alloc() {
+ int arr1[] = {42};
+ int arr2[] = {1, 101, 42};
+ {
+ typedef std::vector<int, cpp03_allocator<int> > C;
+ typedef C::allocator_type Alloc;
+ {
+ Alloc::construct_called = false;
+ C v(arr1, arr1 + 1);
+ assert(Alloc::construct_called);
+ }
+ {
+ Alloc::construct_called = false;
+ C v(arr2, arr2 + 3);
+ assert(Alloc::construct_called);
+ }
+ }
+ {
+ typedef std::vector<int, cpp03_overload_allocator<int> > C;
+ typedef C::allocator_type Alloc;
+ {
+ Alloc::construct_called = false;
+ C v(arr1, arr1 + 1);
+ assert(Alloc::construct_called);
+ }
+ {
+ Alloc::construct_called = false;
+ C v(arr2, arr2 + 3);
+ assert(Alloc::construct_called);
+ }
+ }
+}
+
+int main() {
+ test_ctor_under_alloc();
+}
diff --git a/test/libcxx/containers/sequences/vector/vector.cons/construct_iter_iter_alloc.pass.cpp b/test/libcxx/containers/sequences/vector/vector.cons/construct_iter_iter_alloc.pass.cpp
new file mode 100644
index 0000000000000..c4950fbe637d6
--- /dev/null
+++ b/test/libcxx/containers/sequences/vector/vector.cons/construct_iter_iter_alloc.pass.cpp
@@ -0,0 +1,57 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <vector>
+
+// template <class InputIter> vector(InputIter first, InputIter last,
+// const allocator_type& a);
+
+#include <vector>
+#include <cassert>
+
+#include "min_allocator.h"
+
+void test_ctor_under_alloc() {
+ int arr1[] = {42};
+ int arr2[] = {1, 101, 42};
+ {
+ typedef std::vector<int, cpp03_allocator<int> > C;
+ typedef C::allocator_type Alloc;
+ Alloc a;
+ {
+ Alloc::construct_called = false;
+ C v(arr1, arr1 + 1, a);
+ assert(Alloc::construct_called);
+ }
+ {
+ Alloc::construct_called = false;
+ C v(arr2, arr2 + 3, a);
+ assert(Alloc::construct_called);
+ }
+ }
+ {
+ typedef std::vector<int, cpp03_overload_allocator<int> > C;
+ typedef C::allocator_type Alloc;
+ Alloc a;
+ {
+ Alloc::construct_called = false;
+ C v(arr1, arr1 + 1, a);
+ assert(Alloc::construct_called);
+ }
+ {
+ Alloc::construct_called = false;
+ C v(arr2, arr2 + 3, a);
+ assert(Alloc::construct_called);
+ }
+ }
+}
+
+int main() {
+ test_ctor_under_alloc();
+}
diff --git a/test/libcxx/containers/unord/non_const_comparator.fail.cpp b/test/libcxx/containers/unord/non_const_comparator.fail.cpp
index 8adc67589ef88..f428ab9aca6db 100644
--- a/test/libcxx/containers/unord/non_const_comparator.fail.cpp
+++ b/test/libcxx/containers/unord/non_const_comparator.fail.cpp
@@ -11,7 +11,7 @@
// REQUIRES: diagnose-if-support, verify-support
// Test that libc++ generates a warning diagnostic when the container is
-// provided a non-const callable comparator.
+// provided a non-const callable comparator or a non-const hasher.
#include <unordered_set>
#include <unordered_map>
@@ -34,8 +34,10 @@ int main() {
static_assert(!std::__invokable<BadEqual const&, int const&, int const&>::value, "");
static_assert(std::__invokable<BadEqual&, int const&, int const&>::value, "");
- // expected-warning@__hash_table:* 4 {{the specified comparator type does not provide a const call operator}}
- // expected-warning@__hash_table:* 4 {{the specified hash functor does not provide a const call operator}}
+ // expected-warning@unordered_set:* 2 {{the specified comparator type does not provide a const call operator}}
+ // expected-warning@unordered_map:* 2 {{the specified comparator type does not provide a const call operator}}
+ // expected-warning@unordered_set:* 2 {{the specified hash functor does not provide a const call operator}}
+ // expected-warning@unordered_map:* 2 {{the specified hash functor does not provide a const call operator}}
{
using C = std::unordered_set<int, BadHash, BadEqual>;
diff --git a/test/libcxx/containers/unord/unord.map/db_iterators_7.pass.cpp b/test/libcxx/containers/unord/unord.map/db_iterators_7.pass.cpp
index b8db0a35ffc3e..664cb7e86b959 100644
--- a/test/libcxx/containers/unord/unord.map/db_iterators_7.pass.cpp
+++ b/test/libcxx/containers/unord/unord.map/db_iterators_7.pass.cpp
@@ -22,6 +22,7 @@
#include <exception>
#include <cstdlib>
+#include "test_macros.h"
#include "min_allocator.h"
int main()
@@ -36,7 +37,7 @@ int main()
++i;
assert(false);
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::unordered_map<int, std::string, std::hash<int>, std::equal_to<int>,
min_allocator<std::pair<const int, std::string>>> C;
diff --git a/test/libcxx/containers/unord/unord.map/db_iterators_8.pass.cpp b/test/libcxx/containers/unord/unord.map/db_iterators_8.pass.cpp
index c923dd77862e6..621d7f343e085 100644
--- a/test/libcxx/containers/unord/unord.map/db_iterators_8.pass.cpp
+++ b/test/libcxx/containers/unord/unord.map/db_iterators_8.pass.cpp
@@ -22,6 +22,7 @@
#include <exception>
#include <cstdlib>
+#include "test_macros.h"
#include "min_allocator.h"
int main()
@@ -34,7 +35,7 @@ int main()
C::value_type j = *i;
assert(false);
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::unordered_map<int, std::string, std::hash<int>, std::equal_to<int>,
min_allocator<std::pair<const int, std::string>>> C;
diff --git a/test/libcxx/containers/unord/unord.map/db_local_iterators_7.pass.cpp b/test/libcxx/containers/unord/unord.map/db_local_iterators_7.pass.cpp
index fa1886bfff189..19794e04769d9 100644
--- a/test/libcxx/containers/unord/unord.map/db_local_iterators_7.pass.cpp
+++ b/test/libcxx/containers/unord/unord.map/db_local_iterators_7.pass.cpp
@@ -22,6 +22,7 @@
#include <exception>
#include <cstdlib>
+#include "test_macros.h"
#include "min_allocator.h"
int main()
@@ -34,7 +35,7 @@ int main()
++i;
assert(false);
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::unordered_map<int, std::string, std::hash<int>, std::equal_to<int>,
min_allocator<std::pair<const int, std::string>>> C;
diff --git a/test/libcxx/containers/unord/unord.map/db_local_iterators_8.pass.cpp b/test/libcxx/containers/unord/unord.map/db_local_iterators_8.pass.cpp
index 4b071cad7b473..1567caf9be9ef 100644
--- a/test/libcxx/containers/unord/unord.map/db_local_iterators_8.pass.cpp
+++ b/test/libcxx/containers/unord/unord.map/db_local_iterators_8.pass.cpp
@@ -22,6 +22,7 @@
#include <exception>
#include <cstdlib>
+#include "test_macros.h"
#include "min_allocator.h"
int main()
@@ -33,7 +34,7 @@ int main()
C::value_type j = *i;
assert(false);
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::unordered_map<int, std::string, std::hash<int>, std::equal_to<int>,
min_allocator<std::pair<const int, std::string>>> C;
diff --git a/test/libcxx/depr/depr.auto.ptr/auto.ptr/auto_ptr.depr_in_cxx11.fail.cpp b/test/libcxx/depr/depr.auto.ptr/auto.ptr/auto_ptr.depr_in_cxx11.fail.cpp
new file mode 100644
index 0000000000000..3ad9ae8d6f683
--- /dev/null
+++ b/test/libcxx/depr/depr.auto.ptr/auto.ptr/auto_ptr.depr_in_cxx11.fail.cpp
@@ -0,0 +1,39 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <memory>
+//
+// template <class X>
+// class auto_ptr;
+//
+// class auto_ptr<void>;
+//
+// template <class X>
+// class auto_ptr_ref;
+//
+// Deprecated in C++11
+
+// UNSUPPORTED: clang-4.0
+// UNSUPPORTED: c++98, c++03
+// REQUIRES: verify-support
+
+// MODULES_DEFINES: _LIBCPP_ENABLE_DEPRECATION_WARNINGS
+// MODULES_DEFINES: _LIBCPP_ENABLE_CXX17_REMOVED_AUTO_PTR
+#define _LIBCPP_ENABLE_DEPRECATION_WARNINGS
+#define _LIBCPP_ENABLE_CXX17_REMOVED_AUTO_PTR
+
+#include <memory>
+#include "test_macros.h"
+
+int main()
+{
+ typedef std::auto_ptr<int> AP; // expected-error{{'auto_ptr<int>' is deprecated}}
+ typedef std::auto_ptr<void> APV; // expected-error{{'auto_ptr<void>' is deprecated}}
+ typedef std::auto_ptr_ref<int> APR; // expected-error{{'auto_ptr_ref<int>' is deprecated}}
+}
diff --git a/test/libcxx/depr/depr.function.objects/adaptors.depr_in_cxx11.fail.cpp b/test/libcxx/depr/depr.function.objects/adaptors.depr_in_cxx11.fail.cpp
new file mode 100644
index 0000000000000..88c1e21d6bb61
--- /dev/null
+++ b/test/libcxx/depr/depr.function.objects/adaptors.depr_in_cxx11.fail.cpp
@@ -0,0 +1,59 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <functional>
+
+// UNSUPPORTED: clang-4.0
+// UNSUPPORTED: c++98, c++03
+// REQUIRES: verify-support
+
+// MODULES_DEFINES: _LIBCPP_ENABLE_DEPRECATION_WARNINGS
+// MODULES_DEFINES: _LIBCPP_ENABLE_CXX17_REMOVED_BINDERS
+#define _LIBCPP_ENABLE_DEPRECATION_WARNINGS
+#define _LIBCPP_ENABLE_CXX17_REMOVED_BINDERS
+
+#include <functional>
+#include <cassert>
+#include "test_macros.h"
+
+int identity(int v) { return v; }
+int sum(int a, int b) { return a + b; }
+
+struct Foo {
+ int const_zero() const { return 0; }
+ int const_identity(int v) const { return v; }
+ int zero() { return 0; }
+ int identity(int v) { return v; }
+};
+
+int main()
+{
+ typedef std::pointer_to_unary_function<int, int> PUF; // expected-error{{'pointer_to_unary_function<int, int>' is deprecated}}
+ typedef std::pointer_to_binary_function<int, int, int> PBF; // expected-error{{'pointer_to_binary_function<int, int, int>' is deprecated}}
+ std::ptr_fun<int, int>(identity); // expected-error{{'ptr_fun<int, int>' is deprecated}}
+ std::ptr_fun<int, int, int>(sum); // expected-error{{'ptr_fun<int, int, int>' is deprecated}}
+
+ typedef std::mem_fun_t<int, Foo> MFT0; // expected-error{{'mem_fun_t<int, Foo>' is deprecated}}
+ typedef std::mem_fun1_t<int, Foo, int> MFT1; // expected-error{{'mem_fun1_t<int, Foo, int>' is deprecated}}
+ typedef std::const_mem_fun_t<int, Foo> CMFT0; // expected-error{{'const_mem_fun_t<int, Foo>' is deprecated}}
+ typedef std::const_mem_fun1_t<int, Foo, int> CMFT1; // expected-error{{'const_mem_fun1_t<int, Foo, int>' is deprecated}}
+ std::mem_fun<int, Foo>(&Foo::zero); // expected-error{{'mem_fun<int, Foo>' is deprecated}}
+ std::mem_fun<int, Foo, int>(&Foo::identity); // expected-error{{'mem_fun<int, Foo, int>' is deprecated}}
+ std::mem_fun<int, Foo>(&Foo::const_zero); // expected-error{{'mem_fun<int, Foo>' is deprecated}}
+ std::mem_fun<int, Foo, int>(&Foo::const_identity); // expected-error{{'mem_fun<int, Foo, int>' is deprecated}}
+
+ typedef std::mem_fun_ref_t<int, Foo> MFR0; // expected-error{{'mem_fun_ref_t<int, Foo>' is deprecated}}
+ typedef std::mem_fun1_ref_t<int, Foo, int> MFR1; // expected-error{{'mem_fun1_ref_t<int, Foo, int>' is deprecated}}
+ typedef std::const_mem_fun_ref_t<int, Foo> CMFR0; // expected-error{{'const_mem_fun_ref_t<int, Foo>' is deprecated}}
+ typedef std::const_mem_fun1_ref_t<int, Foo, int> CMFR1; // expected-error{{'const_mem_fun1_ref_t<int, Foo, int>' is deprecated}}
+ std::mem_fun_ref<int, Foo>(&Foo::zero); // expected-error{{'mem_fun_ref<int, Foo>' is deprecated}}
+ std::mem_fun_ref<int, Foo, int>(&Foo::identity); // expected-error{{'mem_fun_ref<int, Foo, int>' is deprecated}}
+ std::mem_fun_ref<int, Foo>(&Foo::const_zero); // expected-error{{'mem_fun_ref<int, Foo>' is deprecated}}
+ std::mem_fun_ref<int, Foo, int>(&Foo::const_identity); // expected-error{{'mem_fun_ref<int, Foo, int>' is deprecated}}
+}
diff --git a/test/libcxx/depr/depr.function.objects/depr.adaptors.cxx1z.pass.cpp b/test/libcxx/depr/depr.function.objects/depr.adaptors.cxx1z.pass.cpp
index 1847dac2ed00d..beb5608006122 100644
--- a/test/libcxx/depr/depr.function.objects/depr.adaptors.cxx1z.pass.cpp
+++ b/test/libcxx/depr/depr.function.objects/depr.adaptors.cxx1z.pass.cpp
@@ -24,15 +24,25 @@ int identity(int v) { return v; }
int sum(int a, int b) { return a + b; }
struct Foo {
- int zero() const { return 0; }
- int identity(int v) const { return v; }
- int sum(int a, int b) const { return a + b; }
+ int zero() { return 0; }
+ int zero_const() const { return 1; }
+
+ int identity(int v) const { return v; }
+ int sum(int a, int b) const { return a + b; }
};
int main()
{
typedef std::pointer_to_unary_function<int, int> PUF;
typedef std::pointer_to_binary_function<int, int, int> PBF;
+
+ static_assert(
+ (std::is_same<PUF, decltype((std::ptr_fun<int, int>(identity)))>::value),
+ "");
+ static_assert(
+ (std::is_same<PBF, decltype((std::ptr_fun<int, int, int>(sum)))>::value),
+ "");
+
assert((std::ptr_fun<int, int>(identity)(4) == 4));
assert((std::ptr_fun<int, int, int>(sum)(4, 5) == 9));
@@ -43,6 +53,12 @@ int main()
typedef std::mem_fun_ref_t<int, Foo> MFR;
typedef std::const_mem_fun_ref_t<int, Foo> CMFR;
+ static_assert(
+ (std::is_same<MFR, decltype((std::mem_fun_ref(&Foo::zero)))>::value), "");
+ static_assert((std::is_same<CMFR, decltype((std::mem_fun_ref(
+ &Foo::zero_const)))>::value),
+ "");
+
assert((std::mem_fun_ref(&Foo::zero)(f) == 0));
assert((std::mem_fun_ref(&Foo::identity)(f, 5) == 5));
}
diff --git a/test/libcxx/diagnostics/enable_nodiscard.fail.cpp b/test/libcxx/diagnostics/enable_nodiscard.fail.cpp
new file mode 100644
index 0000000000000..e1ef17672ccb9
--- /dev/null
+++ b/test/libcxx/diagnostics/enable_nodiscard.fail.cpp
@@ -0,0 +1,33 @@
+// -*- C++ -*-
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// Test that _LIBCPP_NODISCARD_EXT and _LIBCPP_NODISCARD_AFTER_CXX17 are defined
+// to the appropriate warning-generating attribute when _LIBCPP_ENABLE_NODISCARD
+// is explicitly provided.
+
+// UNSUPPORTED: c++98, c++03
+
+// GCC 7 is the first version to introduce [[nodiscard]]
+// UNSUPPORTED: gcc-4.9, gcc-5, gcc-6
+
+// MODULES_DEFINES: _LIBCPP_ENABLE_NODISCARD
+#define _LIBCPP_ENABLE_NODISCARD
+
+#include <__config>
+
+_LIBCPP_NODISCARD_EXT int foo() { return 42; }
+_LIBCPP_NODISCARD_AFTER_CXX17 int bar() { return 42; }
+
+int main() {
+ foo(); // expected-error-re {{ignoring return value of function declared with {{'nodiscard'|warn_unused_result}} attribute}}
+ bar(); // expected-error-re {{ignoring return value of function declared with {{'nodiscard'|warn_unused_result}} attribute}}
+ (void)foo(); // OK. void casts disable the diagnostic.
+ (void)bar();
+}
diff --git a/test/libcxx/diagnostics/enable_nodiscard_disable_after_cxx17.fail.cpp b/test/libcxx/diagnostics/enable_nodiscard_disable_after_cxx17.fail.cpp
new file mode 100644
index 0000000000000..2c7d899ff5a04
--- /dev/null
+++ b/test/libcxx/diagnostics/enable_nodiscard_disable_after_cxx17.fail.cpp
@@ -0,0 +1,33 @@
+// -*- C++ -*-
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++98, c++03
+
+// GCC 7 is the first version to introduce [[nodiscard]]
+// UNSUPPORTED: gcc-4.9, gcc-5, gcc-6
+
+// Test that _LIBCPP_DISABLE_NODISCARD_EXT only disables _LIBCPP_NODISCARD_EXT
+// and not _LIBCPP_NODISCARD_AFTER_CXX17.
+
+// MODULES_DEFINES: _LIBCPP_ENABLE_NODISCARD
+// MODULES_DEFINES: _LIBCPP_DISABLE_NODISCARD_AFTER_CXX17
+#define _LIBCPP_ENABLE_NODISCARD
+#define _LIBCPP_DISABLE_NODISCARD_AFTER_CXX17
+#include <__config>
+
+
+_LIBCPP_NODISCARD_EXT int foo() { return 42; }
+_LIBCPP_NODISCARD_AFTER_CXX17 int bar() { return 42; }
+
+int main() {
+ foo(); // expected-error-re {{ignoring return value of function declared with {{'nodiscard'|warn_unused_result}} attribute}}
+ bar(); // OK.
+ (void)foo(); // OK.
+}
diff --git a/test/libcxx/diagnostics/enable_nodiscard_disable_nodiscard_ext.fail.cpp b/test/libcxx/diagnostics/enable_nodiscard_disable_nodiscard_ext.fail.cpp
new file mode 100644
index 0000000000000..c7d080d8425ce
--- /dev/null
+++ b/test/libcxx/diagnostics/enable_nodiscard_disable_nodiscard_ext.fail.cpp
@@ -0,0 +1,31 @@
+// -*- C++ -*-
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++98, c++03
+
+// GCC 7 is the first version to introduce [[nodiscard]]
+// UNSUPPORTED: gcc-4.9, gcc-5, gcc-6
+
+
+// MODULES_DEFINES: _LIBCPP_ENABLE_NODISCARD
+// MODULES_DEFINES: _LIBCPP_DISABLE_NODISCARD_EXT
+#define _LIBCPP_ENABLE_NODISCARD
+#define _LIBCPP_DISABLE_NODISCARD_EXT
+#include <__config>
+
+
+_LIBCPP_NODISCARD_EXT int foo() { return 42; }
+_LIBCPP_NODISCARD_AFTER_CXX17 int bar() { return 42; }
+
+int main() {
+ bar(); // expected-error-re {{ignoring return value of function declared with {{'nodiscard'|warn_unused_result}} attribute}}
+ foo(); // OK.
+ (void)bar(); // OK.
+}
diff --git a/test/libcxx/diagnostics/nodiscard.pass.cpp b/test/libcxx/diagnostics/nodiscard.pass.cpp
index d308248cff228..de920d459ed66 100644
--- a/test/libcxx/diagnostics/nodiscard.pass.cpp
+++ b/test/libcxx/diagnostics/nodiscard.pass.cpp
@@ -8,18 +8,13 @@
//
//===----------------------------------------------------------------------===//
-// Test that _LIBCPP_NODISCARD_AFTER_CXX17 works
-// #define _LIBCPP_NODISCARD_AFTER_CXX17 [[nodiscard]]
+// Test that _LIBCPP_NODISCARD_EXT is not defined to [[nodiscard]] unless
+// explicitly enabled by _LIBCPP_ENABLE_NODISCARD
-// UNSUPPORTED: c++98, c++03, c++11, c++14
-
-// MODULES_DEFINES: _LIBCPP_DISABLE_NODISCARD_AFTER_CXX17
-#define _LIBCPP_DISABLE_NODISCARD_AFTER_CXX17
#include <__config>
-_LIBCPP_NODISCARD_AFTER_CXX17 int foo() { return 6; }
+_LIBCPP_NODISCARD_EXT int foo() { return 42; }
-int main ()
-{
- foo(); // no error here!
+int main() {
+ foo(); // OK.
}
diff --git a/test/libcxx/diagnostics/nodiscard.fail.cpp b/test/libcxx/diagnostics/nodiscard_aftercxx17.fail.cpp
index 903a24a72805a..47e560feb962f 100644
--- a/test/libcxx/diagnostics/nodiscard.fail.cpp
+++ b/test/libcxx/diagnostics/nodiscard_aftercxx17.fail.cpp
@@ -12,7 +12,6 @@
// #define _LIBCPP_NODISCARD_AFTER_CXX17 [[nodiscard]]
// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
-// UNSUPPORTED: clang-3.3, clang-3.4, clang-3.5, clang-3.6, clang-3.7, clang-3.8
#include <__config>
diff --git a/test/libcxx/experimental/containers/sequences/dynarray/dynarray.traits/default.pass.cpp b/test/libcxx/diagnostics/nodiscard_aftercxx17.pass.cpp
index 48da6d885773f..4db8181723e14 100644
--- a/test/libcxx/experimental/containers/sequences/dynarray/dynarray.traits/default.pass.cpp
+++ b/test/libcxx/diagnostics/nodiscard_aftercxx17.pass.cpp
@@ -1,3 +1,4 @@
+// -*- C++ -*-
//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
@@ -7,22 +8,16 @@
//
//===----------------------------------------------------------------------===//
-// UNSUPPORTED: c++98, c++03, c++11
-// dynarray.data
-
-// template <class Type, class Alloc>
-// struct uses_allocator<dynarray<Type>, Alloc> : true_type { };
-
+// Test that _LIBCPP_NODISCARD_AFTER_CXX17 is disabled whenever
+// _LIBCPP_DISABLE_NODISCARD_AFTER_CXX17 is defined by the user.
+// MODULES_DEFINES: _LIBCPP_DISABLE_NODISCARD_AFTER_CXX17
+#define _LIBCPP_DISABLE_NODISCARD_AFTER_CXX17
#include <__config>
-#include <experimental/dynarray>
-#include "test_allocator.h"
+_LIBCPP_NODISCARD_AFTER_CXX17 int foo() { return 6; }
-using std::experimental::dynarray;
-
-int main()
+int main ()
{
- static_assert ( std::uses_allocator<dynarray<int>, test_allocator<int>>::value, "" );
+ foo(); // no error here!
}
-
diff --git a/test/libcxx/diagnostics/nodiscard_extensions.fail.cpp b/test/libcxx/diagnostics/nodiscard_extensions.fail.cpp
new file mode 100644
index 0000000000000..d1e0a8af5c8a6
--- /dev/null
+++ b/test/libcxx/diagnostics/nodiscard_extensions.fail.cpp
@@ -0,0 +1,35 @@
+// -*- C++ -*-
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++98, c++03
+
+// GCC versions prior to 7.0 don't provide the required [[nodiscard]] attribute.
+// UNSUPPORTED: gcc-4, gcc-5, gcc-6
+
+// Test that entities declared [[nodiscard]] as at extension by libc++, are
+// only actually declared such when _LIBCPP_ENABLE_NODISCARD is specified.
+
+// All entities to which libc++ applies [[nodiscard]] as an extension should
+// be tested here and in nodiscard_extensions.pass.cpp. They should also
+// be listed in `UsingLibcxx.rst` in the documentation for the extension.
+
+// MODULES_DEFINES: _LIBCPP_ENABLE_NODISCARD
+#define _LIBCPP_ENABLE_NODISCARD
+
+#include <memory>
+
+#include "test_macros.h"
+
+int main() {
+ {
+ // expected-error-re@+1 {{ignoring return value of function declared with {{'nodiscard'|warn_unused_result}} attribute}}
+ std::get_temporary_buffer<int>(1);
+ }
+}
diff --git a/test/libcxx/diagnostics/nodiscard_extensions.pass.cpp b/test/libcxx/diagnostics/nodiscard_extensions.pass.cpp
new file mode 100644
index 0000000000000..9a09a43bae1cd
--- /dev/null
+++ b/test/libcxx/diagnostics/nodiscard_extensions.pass.cpp
@@ -0,0 +1,29 @@
+// -*- C++ -*-
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// Test that entities declared [[nodiscard]] as at extension by libc++, are
+// only actually declared such when _LIBCPP_ENABLE_NODISCARD is specified.
+
+// This test intentionally leaks memory, so it is unsupported under ASAN.
+// UNSUPPORTED: asan
+
+// All entities to which libc++ applies [[nodiscard]] as an extension should
+// be tested here and in nodiscard_extensions.fail.cpp. They should also
+// be listed in `UsingLibcxx.rst` in the documentation for the extension.
+
+#include <memory>
+
+#include "test_macros.h"
+
+int main() {
+ {
+ std::get_temporary_buffer<int>(1); // intentional memory leak.
+ }
+}
diff --git a/test/libcxx/double_include.sh.cpp b/test/libcxx/double_include.sh.cpp
index 8d08db4fd1055..5a0f2ba72dc00 100644
--- a/test/libcxx/double_include.sh.cpp
+++ b/test/libcxx/double_include.sh.cpp
@@ -27,6 +27,7 @@
#ifndef _LIBCPP_HAS_NO_THREADS
#include <atomic>
#endif
+#include <bit>
#include <bitset>
#include <cassert>
#include <ccomplex>
@@ -144,7 +145,6 @@
#include <experimental/coroutine>
#endif
#include <experimental/deque>
-#include <experimental/dynarray>
#include <experimental/filesystem>
#include <experimental/forward_list>
#include <experimental/functional>
diff --git a/test/libcxx/experimental/containers/sequences/dynarray/dynarray.cons/alloc.pass.cpp b/test/libcxx/experimental/containers/sequences/dynarray/dynarray.cons/alloc.pass.cpp
deleted file mode 100644
index c6a83cc61bdcb..0000000000000
--- a/test/libcxx/experimental/containers/sequences/dynarray/dynarray.cons/alloc.pass.cpp
+++ /dev/null
@@ -1,83 +0,0 @@
-//===----------------------------------------------------------------------===//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file is dual licensed under the MIT and the University of Illinois Open
-// Source Licenses. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-
-// UNSUPPORTED: c++98, c++03, c++11
-// dynarray.cons
-
-// template <class Alloc>
-// dynarray(size_type c, const Alloc& alloc);
-// template <class Alloc>
-// dynarray(size_type c, const T& v, const Alloc& alloc);
-// template <class Alloc>
-// dynarray(const dynarray& d, const Alloc& alloc);
-// template <class Alloc>
-// dynarray(initializer_list<T>, const Alloc& alloc);
-
-// ~dynarray();
-
-
-#include <__config>
-
-#include <experimental/dynarray>
-#include <cassert>
-
-#include <algorithm>
-#include <complex>
-#include <string>
-#include "test_allocator.h"
-
-using std::experimental::dynarray;
-
-template <class T, class Allocator>
-void check_allocator ( const dynarray<T> &dyn, const Allocator &alloc ) {
- for ( int i = 0; i < dyn.size (); ++i )
- assert ( dyn[i].get_allocator() == alloc );
-}
-
-template <class T, class Allocator>
-void test ( const std::initializer_list<T> &vals, const Allocator &alloc ) {
- typedef dynarray<T> dynA;
-
- dynA d1 ( vals, alloc );
- assert ( d1.size () == vals.size() );
- assert ( std::equal ( vals.begin (), vals.end (), d1.begin (), d1.end ()));
- check_allocator ( d1, alloc );
- }
-
-
-template <class T, class Allocator>
-void test ( const T &val, const Allocator &alloc1, const Allocator &alloc2 ) {
- typedef dynarray<T> dynA;
-
- dynA d1 ( 4, alloc1 );
- assert ( d1.size () == 4 );
- assert ( std::all_of ( d1.begin (), d1.end (), []( const T &item ){ return item == T(); } ));
- check_allocator ( d1, alloc1 );
-
- dynA d2 ( 7, val, alloc1 );
- assert ( d2.size () == 7 );
- assert ( std::all_of ( d2.begin (), d2.end (), [&val]( const T &item ){ return item == val; } ));
- check_allocator ( d2, alloc1 );
-
- dynA d3 ( d2, alloc2 );
- assert ( d3.size () == 7 );
- assert ( std::all_of ( d3.begin (), d3.end (), [&val]( const T &item ){ return item == val; } ));
- check_allocator ( d3, alloc2 );
- }
-
-int main()
-{
-// This test is waiting on the resolution of LWG issue #2235
-// typedef test_allocator<char> Alloc;
-// typedef std::basic_string<char, std::char_traits<char>, Alloc> nstr;
-//
-// test ( nstr("fourteen"), Alloc(3), Alloc(4) );
-// test ( { nstr("1"), nstr("1"), nstr("2"), nstr("3"), nstr("5"), nstr("8")}, Alloc(6));
-}
-
diff --git a/test/libcxx/experimental/containers/sequences/dynarray/dynarray.cons/default.pass.cpp b/test/libcxx/experimental/containers/sequences/dynarray/dynarray.cons/default.pass.cpp
deleted file mode 100644
index db7484d468dad..0000000000000
--- a/test/libcxx/experimental/containers/sequences/dynarray/dynarray.cons/default.pass.cpp
+++ /dev/null
@@ -1,102 +0,0 @@
-//===----------------------------------------------------------------------===//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file is dual licensed under the MIT and the University of Illinois Open
-// Source Licenses. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-
-// UNSUPPORTED: c++98, c++03, c++11
-// XFAIL: availability=macosx10.12
-// XFAIL: availability=macosx10.11
-// XFAIL: availability=macosx10.10
-// XFAIL: availability=macosx10.9
-// XFAIL: availability=macosx10.8
-// XFAIL: availability=macosx10.7
-
-// dynarray.cons
-
-// explicit dynarray(size_type c);
-// dynarray(size_type c, const T& v);
-// dynarray(initializer_list<T>);
-// dynarray(const dynarray& d);
-
-// ~dynarray();
-
-
-#include <experimental/dynarray>
-#include <cassert>
-
-#include <algorithm>
-#include <complex>
-#include <limits>
-#include <new>
-#include <string>
-
-#include "test_macros.h"
-
-
-using std::experimental::dynarray;
-
-template <class T>
-void testInitList( const std::initializer_list<T> &vals ) {
- typedef dynarray<T> dynA;
-
- dynA d1 ( vals );
- assert ( d1.size () == vals.size() );
- assert ( std::equal ( vals.begin (), vals.end (), d1.begin (), d1.end ()));
- }
-
-
-template <class T>
-void test ( const T &val, bool DefaultValueIsIndeterminate = false) {
- typedef dynarray<T> dynA;
-
- dynA d1 ( 4 );
- assert ( d1.size () == 4 );
- if (!DefaultValueIsIndeterminate) {
- assert ( std::all_of ( d1.begin (), d1.end (), []( const T &item ){ return item == T(); } ));
- }
-
- dynA d2 ( 7, val );
- assert ( d2.size () == 7 );
- assert ( std::all_of ( d2.begin (), d2.end (), [&val]( const T &item ){ return item == val; } ));
-
- dynA d3 ( d2 );
- assert ( d3.size () == 7 );
- assert ( std::all_of ( d3.begin (), d3.end (), [&val]( const T &item ){ return item == val; } ));
- }
-
-#ifndef TEST_HAS_NO_EXCEPTIONS
-void test_bad_length () {
- try { dynarray<int> ( std::numeric_limits<size_t>::max() / sizeof ( int ) + 1 ); }
- catch ( std::bad_array_length & ) { return ; }
- catch (...) { assert(false); }
- assert ( false );
-}
-#endif
-
-
-int main()
-{
- test<int> ( 14, /* DefaultValueIsIndeterminate */ true ); // ints don't get default initialized
- test<long> ( 0, true);
- test<double> ( 14.0, true );
- test<std::complex<double>> ( std::complex<double> ( 14, 0 ));
- test<std::string> ( "fourteen" );
-
- testInitList( { 1, 1, 2, 3, 5, 8 } );
- testInitList( { 1., 1., 2., 3., 5., 8. } );
- testInitList( { std::string("1"), std::string("1"), std::string("2"), std::string("3"),
- std::string("5"), std::string("8")} );
-
-// Make sure we don't pick up the Allocator version here
- dynarray<long> d1 ( 20, 3 );
- assert ( d1.size() == 20 );
- assert ( std::all_of ( d1.begin (), d1.end (), []( long item ){ return item == 3L; } ));
-
-#ifndef TEST_HAS_NO_EXCEPTIONS
- test_bad_length ();
-#endif
-}
diff --git a/test/libcxx/experimental/containers/sequences/dynarray/dynarray.cons/default_throws_bad_alloc.pass.cpp b/test/libcxx/experimental/containers/sequences/dynarray/dynarray.cons/default_throws_bad_alloc.pass.cpp
deleted file mode 100644
index 4009841355f9f..0000000000000
--- a/test/libcxx/experimental/containers/sequences/dynarray/dynarray.cons/default_throws_bad_alloc.pass.cpp
+++ /dev/null
@@ -1,35 +0,0 @@
-//===----------------------------------------------------------------------===//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file is dual licensed under the MIT and the University of Illinois Open
-// Source Licenses. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-
-// UNSUPPORTED: libcpp-no-exceptions
-// XFAIL: availability
-// dynarray.cons
-
-// explicit dynarray(size_type c);
-
-// UNSUPPORTED: c++98, c++03, c++11
-
-// The sanitizers replace new/delete with versions that do not throw bad_alloc.
-// UNSUPPORTED: sanitizer-new-delete
-
-
-#include <experimental/dynarray>
-#include <limits>
-#include <new>
-#include <cassert>
-
-
-using std::experimental::dynarray;
-
-int main() {
- try { dynarray<int>((std::numeric_limits<size_t>::max() / sizeof(int)) - 1); }
- catch (std::bad_alloc &) { return 0; }
- catch (...) { assert(false); }
- assert(false);
-}
diff --git a/test/libcxx/experimental/containers/sequences/dynarray/dynarray.data/default.pass.cpp b/test/libcxx/experimental/containers/sequences/dynarray/dynarray.data/default.pass.cpp
deleted file mode 100644
index 5c745e0d1eaf1..0000000000000
--- a/test/libcxx/experimental/containers/sequences/dynarray/dynarray.data/default.pass.cpp
+++ /dev/null
@@ -1,69 +0,0 @@
-//===----------------------------------------------------------------------===//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file is dual licensed under the MIT and the University of Illinois Open
-// Source Licenses. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-
-// UNSUPPORTED: c++98, c++03, c++11
-// XFAIL: availability
-
-// dynarray.data
-
-// T* data() noexcept;
-// const T* data() const noexcept;
-
-
-#include <experimental/dynarray>
-#include <cassert>
-
-#include <algorithm>
-#include <complex>
-#include <string>
-
-using std::experimental::dynarray;
-
-template <class T>
-void dyn_test_const(const dynarray<T> &dyn, bool CheckEquals = true) {
- const T *data = dyn.data ();
- assert ( data != NULL );
- if (CheckEquals) {
- assert ( std::equal ( dyn.begin(), dyn.end(), data ));
- }
-}
-
-template <class T>
-void dyn_test( dynarray<T> &dyn, bool CheckEquals = true) {
- T *data = dyn.data ();
- assert ( data != NULL );
- if (CheckEquals) {
- assert ( std::equal ( dyn.begin(), dyn.end(), data ));
- }
-}
-
-
-
-template <class T>
-void test(const T &val, bool DefaultValueIsIndeterminate = false) {
- typedef dynarray<T> dynA;
-
- const bool CheckDefaultValues = !DefaultValueIsIndeterminate;
-
- dynA d1(4);
- dyn_test(d1, CheckDefaultValues);
- dyn_test_const(d1, CheckDefaultValues);
-
- dynA d2 (7, val);
- dyn_test ( d2 );
- dyn_test_const ( d2 );
-}
-
-int main()
-{
- test<int>(14, /* DefaultValueIsIndeterminate */ true);
- test<double>(14.0, true);
- test<std::complex<double>> ( std::complex<double> ( 14, 0 ));
- test<std::string> ( "fourteen" );
-}
diff --git a/test/libcxx/experimental/containers/sequences/dynarray/dynarray.mutate/default.pass.cpp b/test/libcxx/experimental/containers/sequences/dynarray/dynarray.mutate/default.pass.cpp
deleted file mode 100644
index 1ed51538f6faa..0000000000000
--- a/test/libcxx/experimental/containers/sequences/dynarray/dynarray.mutate/default.pass.cpp
+++ /dev/null
@@ -1,47 +0,0 @@
-//===----------------------------------------------------------------------===//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file is dual licensed under the MIT and the University of Illinois Open
-// Source Licenses. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-
-// UNSUPPORTED: c++98, c++03, c++11
-// XFAIL: availability
-
-// dynarray.data
-
-// void fill(const T& v);
-// const T* data() const noexcept;
-
-
-#include <__config>
-
-#include <experimental/dynarray>
-#include <cassert>
-
-#include <algorithm>
-#include <complex>
-#include <string>
-
-using std::experimental::dynarray;
-
-template <class T>
-void test ( const T &val ) {
- typedef dynarray<T> dynA;
-
- dynA d1 ( 4 );
- d1.fill ( val );
- assert ( std::all_of ( d1.begin (), d1.end (),
- [&val]( const T &item ){ return item == val; } ));
- }
-
-int main()
-{
- test<int> ( 14 );
- test<double> ( 14.0 );
- test<std::complex<double>> ( std::complex<double> ( 14, 0 ));
- test<std::string> ( "fourteen" );
-}
-
diff --git a/test/libcxx/experimental/containers/sequences/dynarray/dynarray.overview/at.pass.cpp b/test/libcxx/experimental/containers/sequences/dynarray/dynarray.overview/at.pass.cpp
deleted file mode 100644
index 473313f39fc47..0000000000000
--- a/test/libcxx/experimental/containers/sequences/dynarray/dynarray.overview/at.pass.cpp
+++ /dev/null
@@ -1,94 +0,0 @@
-//===----------------------------------------------------------------------===//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file is dual licensed under the MIT and the University of Illinois Open
-// Source Licenses. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-
-// UNSUPPORTED: c++98, c++03, c++11
-// UNSUPPORTED: libcpp-no-exceptions
-// XFAIL: availability
-
-// dynarray.overview
-
-// const_reference at(size_type n) const;
-// reference at(size_type n);
-
-#include <__config>
-
-#include <experimental/dynarray>
-#include <cassert>
-
-#include <algorithm>
-#include <complex>
-#include <string>
-
-using std::experimental::dynarray;
-
-template <class T>
-void dyn_at_fail ( dynarray<T> &dyn, size_t sz ) {
- try { dyn.at (sz); }
- catch (const std::out_of_range &) { return; }
- assert ( false );
- }
-
-template <class T>
-void dyn_at_fail_const ( const dynarray<T> &dyn, size_t sz ) {
- try { dyn.at (sz); }
- catch (const std::out_of_range &) { return; }
- assert ( false );
- }
-
-
-template <class T>
-void dyn_test_const ( const dynarray<T> &dyn, const std::initializer_list<T> &vals ) {
- const T *data = dyn.data ();
- auto it = vals.begin ();
- for ( size_t i = 0; i < dyn.size(); ++i, ++it ) {
- assert ( data + i == &dyn.at(i));
- assert ( *it == dyn.at(i));
- }
-
- dyn_at_fail_const ( dyn, dyn.size ());
- dyn_at_fail_const ( dyn, 2*dyn.size ());
- dyn_at_fail_const ( dyn, size_t (-1));
- }
-
-template <class T>
-void dyn_test ( dynarray<T> &dyn, const std::initializer_list<T> &vals ) {
- T *data = dyn.data ();
- auto it = vals.begin ();
- for ( size_t i = 0; i < dyn.size(); ++i, ++it ) {
- assert ( data + i == &dyn.at(i));
- assert ( *it == dyn.at(i));
- }
-
- dyn_at_fail ( dyn, dyn.size ());
- dyn_at_fail ( dyn, 2*dyn.size ());
- dyn_at_fail ( dyn, size_t (-1));
- }
-
-
-template <class T>
-void test ( std::initializer_list<T> vals ) {
- typedef dynarray<T> dynA;
-
- dynA d1 ( vals );
- dyn_test ( d1, vals );
- dyn_test_const ( d1, vals );
- }
-
-int main()
-{
- test ( { 1, 1, 2, 3, 5, 8 } );
- test ( { 1., 1., 2., 3., 5., 8. } );
- test ( { std::string("1"), std::string("1"), std::string("2"), std::string("3"),
- std::string("5"), std::string("8")} );
-
- test<int> ( {} );
- test<std::complex<double>> ( {} );
- test<std::string> ( {} );
-}
-
diff --git a/test/libcxx/experimental/containers/sequences/dynarray/dynarray.overview/begin_end.pass.cpp b/test/libcxx/experimental/containers/sequences/dynarray/dynarray.overview/begin_end.pass.cpp
deleted file mode 100644
index f0aa1e3ff6911..0000000000000
--- a/test/libcxx/experimental/containers/sequences/dynarray/dynarray.overview/begin_end.pass.cpp
+++ /dev/null
@@ -1,110 +0,0 @@
-//===----------------------------------------------------------------------===//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file is dual licensed under the MIT and the University of Illinois Open
-// Source Licenses. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-
-// UNSUPPORTED: c++98, c++03, c++11
-// XFAIL: availability
-
-// dynarray.overview
-
-
-// iterator begin() noexcept;
-// const_iterator begin() const noexcept;
-// const_iterator cbegin() const noexcept;
-// iterator end() noexcept;
-// const_iterator end() const noexcept;
-// const_iterator cend() const noexcept;
-//
-// reverse_iterator rbegin() noexcept;
-// const_reverse_iterator rbegin() const noexcept;
-// const_reverse_iterator crbegin() const noexcept;
-// reverse_iterator rend() noexcept;
-// const_reverse_iterator rend() const noexcept;
-// const_reverse_iterator crend() const noexcept;
-
-
-#include <__config>
-
-#include <experimental/dynarray>
-#include <cstddef>
-#include <cassert>
-
-#include <algorithm>
-#include <complex>
-#include <string>
-
-using std::experimental::dynarray;
-
-template <class T>
-void dyn_test_const ( const dynarray<T> &dyn ) {
- const T *data = dyn.data ();
- assert ( data == &*dyn.begin ());
- assert ( data == &*dyn.cbegin ());
-
- assert ( data + dyn.size() - 1 == &*dyn.rbegin ());
- assert ( data + dyn.size() - 1 == &*dyn.crbegin ());
-
- std::ptrdiff_t ds = static_cast<std::ptrdiff_t>(dyn.size());
- assert (ds == std::distance ( dyn.begin(), dyn.end()));
- assert (ds == std::distance ( dyn.cbegin(), dyn.cend()));
- assert (ds == std::distance ( dyn.rbegin(), dyn.rend()));
- assert (ds == std::distance ( dyn.crbegin(), dyn.crend()));
-
- assert ( dyn.begin () == dyn.cbegin ());
- assert ( &*dyn.begin () == &*dyn.cbegin ());
- assert ( dyn.rbegin () == dyn.crbegin ());
- assert ( &*dyn.rbegin () == &*dyn.crbegin ());
- assert ( dyn.end () == dyn.cend ());
- assert ( dyn.rend () == dyn.crend ());
- }
-
-template <class T>
-void dyn_test ( dynarray<T> &dyn ) {
- T *data = dyn.data ();
- assert ( data == &*dyn.begin ());
- assert ( data == &*dyn.cbegin ());
-
- assert ( data + dyn.size() - 1 == &*dyn.rbegin ());
- assert ( data + dyn.size() - 1 == &*dyn.crbegin ());
-
- std::ptrdiff_t ds = static_cast<std::ptrdiff_t>(dyn.size());
- assert (ds == std::distance ( dyn.begin(), dyn.end()));
- assert (ds == std::distance ( dyn.cbegin(), dyn.cend()));
- assert (ds == std::distance ( dyn.rbegin(), dyn.rend()));
- assert (ds == std::distance ( dyn.crbegin(), dyn.crend()));
-
- assert ( dyn.begin () == dyn.cbegin ());
- assert ( &*dyn.begin () == &*dyn.cbegin ());
- assert ( dyn.rbegin () == dyn.crbegin ());
- assert ( &*dyn.rbegin () == &*dyn.crbegin ());
- assert ( dyn.end () == dyn.cend ());
- assert ( dyn.rend () == dyn.crend ());
- }
-
-
-template <class T>
-void test ( const T &val ) {
- typedef dynarray<T> dynA;
-
- dynA d1 ( 4 );
- dyn_test ( d1 );
- dyn_test_const ( d1 );
-
- dynA d2 ( 7, val );
- dyn_test ( d2 );
- dyn_test_const ( d2 );
- }
-
-int main()
-{
- test<int> ( 14 );
- test<double> ( 14.0 );
- test<std::complex<double>> ( std::complex<double> ( 14, 0 ));
- test<std::string> ( "fourteen" );
-}
-
diff --git a/test/libcxx/experimental/containers/sequences/dynarray/dynarray.overview/capacity.pass.cpp b/test/libcxx/experimental/containers/sequences/dynarray/dynarray.overview/capacity.pass.cpp
deleted file mode 100644
index a5484296fa21b..0000000000000
--- a/test/libcxx/experimental/containers/sequences/dynarray/dynarray.overview/capacity.pass.cpp
+++ /dev/null
@@ -1,56 +0,0 @@
-//===----------------------------------------------------------------------===//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file is dual licensed under the MIT and the University of Illinois Open
-// Source Licenses. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-
-// UNSUPPORTED: c++98, c++03, c++11
-// XFAIL: availability
-
-// dynarray.overview
-
-// size_type size() const noexcept;
-// size_type max_size() const noexcept;
-// bool empty() const noexcept;
-
-#include <__config>
-
-#include <experimental/dynarray>
-#include <cassert>
-
-#include <algorithm>
-#include <complex>
-#include <string>
-
-using std::experimental::dynarray;
-
-template <class T>
-void dyn_test ( const dynarray<T> &dyn, size_t sz ) {
- assert ( dyn.size () == sz );
- assert ( dyn.max_size () == sz );
- assert ( dyn.empty () == ( sz == 0 ));
- }
-
-template <class T>
-void test ( std::initializer_list<T> vals ) {
- typedef dynarray<T> dynA;
-
- dynA d1 ( vals );
- dyn_test ( d1, vals.size ());
- }
-
-int main()
-{
- test ( { 1, 1, 2, 3, 5, 8 } );
- test ( { 1., 1., 2., 3., 5., 8. } );
- test ( { std::string("1"), std::string("1"), std::string("2"), std::string("3"),
- std::string("5"), std::string("8")} );
-
- test<int> ( {} );
- test<std::complex<double>> ( {} );
- test<std::string> ( {} );
-}
-
diff --git a/test/libcxx/experimental/containers/sequences/dynarray/dynarray.overview/front_back.pass.cpp b/test/libcxx/experimental/containers/sequences/dynarray/dynarray.overview/front_back.pass.cpp
deleted file mode 100644
index 0ba27cf925f77..0000000000000
--- a/test/libcxx/experimental/containers/sequences/dynarray/dynarray.overview/front_back.pass.cpp
+++ /dev/null
@@ -1,74 +0,0 @@
-//===----------------------------------------------------------------------===//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file is dual licensed under the MIT and the University of Illinois Open
-// Source Licenses. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-
-// UNSUPPORTED: c++98, c++03, c++11
-// XFAIL: availability
-
-// dynarray.overview
-
-// reference front();
-// const_reference front() const;
-// reference back();
-// const_reference back() const;
-
-
-#include <experimental/dynarray>
-#include <cassert>
-
-#include <algorithm>
-#include <complex>
-#include <string>
-
-using std::experimental::dynarray;
-
-template <class T>
-void dyn_test_const ( const dynarray<T> &dyn, bool CheckValues = true ) {
- const T *data = dyn.data ();
- assert(data == &dyn.front());
- assert((data + dyn.size() - 1) == &dyn.back());
- if (CheckValues) {
- assert ( *data == dyn.front ());
- assert ( *(data + dyn.size() - 1 ) == dyn.back ());
- }
-}
-
-template <class T>
-void dyn_test ( dynarray<T> &dyn, bool CheckValues = true ) {
- T *data = dyn.data ();
- assert(data == &dyn.front());
- assert((data + dyn.size() - 1) == &dyn.back());
- if (CheckValues) {
- assert ( *data == dyn.front ());
- assert ( *(data + dyn.size() - 1 ) == dyn.back ());
- }
-}
-
-
-template <class T>
-void test ( const T &val, bool DefaultValueIsIndeterminate = false) {
- typedef dynarray<T> dynA;
-
- const bool CheckDefaultValues = ! DefaultValueIsIndeterminate;
-
- dynA d1 ( 4 );
- dyn_test ( d1, CheckDefaultValues );
- dyn_test_const ( d1, CheckDefaultValues );
-
- dynA d2 ( 7, val );
- dyn_test ( d2 );
- dyn_test_const ( d2 );
-}
-
-int main()
-{
- test<int> ( 14, /* DefaultValueIsIndeterminate */ true);
- test<double> ( 14.0, true );
- test<std::complex<double>> ( std::complex<double> ( 14, 0 ));
- test<std::string> ( "fourteen" );
-}
diff --git a/test/libcxx/experimental/containers/sequences/dynarray/dynarray.overview/indexing.pass.cpp b/test/libcxx/experimental/containers/sequences/dynarray/dynarray.overview/indexing.pass.cpp
deleted file mode 100644
index 4306d1e9c1b67..0000000000000
--- a/test/libcxx/experimental/containers/sequences/dynarray/dynarray.overview/indexing.pass.cpp
+++ /dev/null
@@ -1,76 +0,0 @@
-//===----------------------------------------------------------------------===//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file is dual licensed under the MIT and the University of Illinois Open
-// Source Licenses. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-
-// UNSUPPORTED: c++98, c++03, c++11
-
-// XFAIL: availability=macosx10.12
-// XFAIL: availability=macosx10.11
-// XFAIL: availability=macosx10.10
-// XFAIL: availability=macosx10.9
-// XFAIL: availability=macosx10.8
-// XFAIL: availability=macosx10.7
-
-// dynarray.overview
-
-// const_reference at(size_type n) const;
-// reference at(size_type n);
-
-#include <__config>
-
-#include <experimental/dynarray>
-#include <cassert>
-
-#include <algorithm>
-#include <complex>
-#include <string>
-
-using std::experimental::dynarray;
-
-template <class T>
-void dyn_test_const ( const dynarray<T> &dyn, const std::initializer_list<T> &vals ) {
- const T *data = dyn.data ();
- auto it = vals.begin ();
- for ( size_t i = 0; i < dyn.size(); ++i, ++it ) {
- assert ( data + i == &dyn[i]);
- assert ( *it == dyn[i]);
- }
- }
-
-template <class T>
-void dyn_test ( dynarray<T> &dyn, const std::initializer_list<T> &vals ) {
- T *data = dyn.data ();
- auto it = vals.begin ();
- for ( size_t i = 0; i < dyn.size(); ++i, ++it ) {
- assert ( data + i == &dyn[i]);
- assert ( *it == dyn[i]);
- }
- }
-
-
-template <class T>
-void test ( std::initializer_list<T> vals ) {
- typedef dynarray<T> dynA;
-
- dynA d1 ( vals );
- dyn_test ( d1, vals );
- dyn_test_const ( d1, vals );
- }
-
-int main()
-{
- test ( { 1, 1, 2, 3, 5, 8 } );
- test ( { 1., 1., 2., 3., 5., 8. } );
- test ( { std::string("1"), std::string("1"), std::string("2"), std::string("3"),
- std::string("5"), std::string("8")} );
-
- test<int> ( {} );
- test<std::complex<double>> ( {} );
- test<std::string> ( {} );
-}
-
diff --git a/test/libcxx/experimental/containers/sequences/dynarray/dynarray.zero/default.pass.cpp b/test/libcxx/experimental/containers/sequences/dynarray/dynarray.zero/default.pass.cpp
deleted file mode 100644
index ab49600350600..0000000000000
--- a/test/libcxx/experimental/containers/sequences/dynarray/dynarray.zero/default.pass.cpp
+++ /dev/null
@@ -1,48 +0,0 @@
-//===----------------------------------------------------------------------===//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file is dual licensed under the MIT and the University of Illinois Open
-// Source Licenses. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-
-// UNSUPPORTED: c++98, c++03, c++11
-// XFAIL: availability
-// dynarray.zero
-
-// dynarray shall provide support for the special case of construction with a size of zero.
-// In the case that the size is zero, begin() == end() == unique value.
-// The return value of data() is unspecified.
-// The effect of calling front() or back() for a zero-sized dynarray is undefined.
-
-
-
-#include <__config>
-
-#include <experimental/dynarray>
-#include <cassert>
-
-#include <algorithm>
-#include <complex>
-#include <string>
-
-using std::experimental::dynarray;
-
-template <class T>
-void test ( ) {
- typedef dynarray<T> dynA;
-
- dynA d1 ( 0 );
- assert ( d1.size() == 0 );
- assert ( d1.begin() == d1.end ());
- }
-
-int main()
-{
- test<int> ();
- test<double> ();
- test<std::complex<double>> ();
- test<std::string> ();
-}
-
diff --git a/test/libcxx/experimental/containers/sequences/dynarray/lit.local.cfg b/test/libcxx/experimental/containers/sequences/dynarray/lit.local.cfg
deleted file mode 100644
index 93553b5130e39..0000000000000
--- a/test/libcxx/experimental/containers/sequences/dynarray/lit.local.cfg
+++ /dev/null
@@ -1,3 +0,0 @@
-if ('availability' in config.available_features
- and not 'libcpp-no-exceptions' in config.available_features):
- config.unsupported = True
diff --git a/test/libcxx/experimental/diagnostics/syserr/use_header_warning.fail.cpp b/test/libcxx/experimental/diagnostics/syserr/use_header_warning.fail.cpp
new file mode 100644
index 0000000000000..074a9c58c6140
--- /dev/null
+++ b/test/libcxx/experimental/diagnostics/syserr/use_header_warning.fail.cpp
@@ -0,0 +1,18 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// REQUIRES: verify-support
+
+// <experimental/system_error>
+
+#include <experimental/system_error>
+
+// expected-error@experimental/system_error:* {{"<experimental/system_error> has been removed. Use <system_error> instead."}}
+
+int main() {}
diff --git a/test/libcxx/experimental/diagnostics/syserr/version.pass.cpp b/test/libcxx/experimental/diagnostics/syserr/version.pass.cpp
new file mode 100644
index 0000000000000..c4fb9593a9ee2
--- /dev/null
+++ b/test/libcxx/experimental/diagnostics/syserr/version.pass.cpp
@@ -0,0 +1,21 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <experimental/system_error>
+
+#ifdef __GNUC__
+#pragma GCC diagnostic ignored "-W#warnings"
+#endif
+#include <experimental/system_error>
+
+#ifndef _LIBCPP_VERSION
+#error _LIBCPP_VERSION not defined
+#endif
+
+int main() {}
diff --git a/test/libcxx/experimental/memory/memory.polymorphic.allocator.class/memory.polymorphic.allocator.mem/construct_piecewise_pair.pass.cpp b/test/libcxx/experimental/memory/memory.polymorphic.allocator.class/memory.polymorphic.allocator.mem/construct_piecewise_pair.pass.cpp
index 40bacbcbad590..b2150fcd2716b 100644
--- a/test/libcxx/experimental/memory/memory.polymorphic.allocator.class/memory.polymorphic.allocator.mem/construct_piecewise_pair.pass.cpp
+++ b/test/libcxx/experimental/memory/memory.polymorphic.allocator.class/memory.polymorphic.allocator.mem/construct_piecewise_pair.pass.cpp
@@ -106,14 +106,10 @@ struct CountCopiesAllocV2 {
int main()
{
- using PMR = ex::memory_resource*;
- using PMA = ex::polymorphic_allocator<char>;
-
{
using T = CountCopies;
using U = CountCopiesAllocV1;
using P = std::pair<T, U>;
- using TH = TestHarness<P>;
std::tuple<T> t1;
std::tuple<U> t2;
@@ -129,7 +125,6 @@ int main()
using T = CountCopiesAllocV1;
using U = CountCopiesAllocV2;
using P = std::pair<T, U>;
- using TH = TestHarness<P>;
std::tuple<T> t1;
std::tuple<U> t2;
@@ -146,7 +141,6 @@ int main()
using T = CountCopiesAllocV2;
using U = CountCopiesAllocV1;
using P = std::pair<T, U>;
- using TH = TestHarness<P>;
std::tuple<T> t1;
std::tuple<U> t2;
@@ -163,7 +157,6 @@ int main()
using T = CountCopiesAllocV2;
using U = CountCopies;
using P = std::pair<T, U>;
- using TH = TestHarness<P>;
std::tuple<T> t1;
std::tuple<U> t2;
diff --git a/test/libcxx/experimental/memory/memory.resource.adaptor/memory.resource.adaptor.mem/db_deallocate.pass.cpp b/test/libcxx/experimental/memory/memory.resource.adaptor/memory.resource.adaptor.mem/db_deallocate.pass.cpp
index ccb9b710e5dcd..ffcedf0bf5319 100644
--- a/test/libcxx/experimental/memory/memory.resource.adaptor/memory.resource.adaptor.mem/db_deallocate.pass.cpp
+++ b/test/libcxx/experimental/memory/memory.resource.adaptor/memory.resource.adaptor.mem/db_deallocate.pass.cpp
@@ -30,7 +30,7 @@ namespace ex = std::experimental::pmr;
int main()
{
using Alloc = NullAllocator<char>;
- using R = ex::resource_adaptor<Alloc>;
+
AllocController P;
ex::resource_adaptor<Alloc> r(Alloc{P});
ex::memory_resource & m1 = r;
diff --git a/test/libcxx/experimental/numerics/numeric.ops/use_header_warning.fail.cpp b/test/libcxx/experimental/numerics/numeric.ops/use_header_warning.fail.cpp
new file mode 100644
index 0000000000000..32fd0527d482b
--- /dev/null
+++ b/test/libcxx/experimental/numerics/numeric.ops/use_header_warning.fail.cpp
@@ -0,0 +1,18 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// REQUIRES: verify-support
+
+// <experimental/numeric>
+
+#include <experimental/numeric>
+
+// expected-error@experimental/numeric:* {{"<experimental/numeric> has been removed. Use <numeric> instead."}}
+
+int main() {}
diff --git a/test/libcxx/experimental/numerics/numeric.ops/version.pass.cpp b/test/libcxx/experimental/numerics/numeric.ops/version.pass.cpp
new file mode 100644
index 0000000000000..37ac584a7cd4d
--- /dev/null
+++ b/test/libcxx/experimental/numerics/numeric.ops/version.pass.cpp
@@ -0,0 +1,21 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <experimental/numeric>
+
+#ifdef __GNUC__
+#pragma GCC diagnostic ignored "-W#warnings"
+#endif
+#include <experimental/numeric>
+
+#ifndef _LIBCPP_VERSION
+#error _LIBCPP_VERSION not defined
+#endif
+
+int main() {}
diff --git a/test/libcxx/experimental/strings/string.view/use_header_warning.fail.cpp b/test/libcxx/experimental/strings/string.view/use_header_warning.fail.cpp
new file mode 100644
index 0000000000000..64f73742099bb
--- /dev/null
+++ b/test/libcxx/experimental/strings/string.view/use_header_warning.fail.cpp
@@ -0,0 +1,18 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// REQUIRES: verify-support
+
+// <experimental/string_view>
+
+#include <experimental/string_view>
+
+// expected-error@experimental/string_view:* {{"<experimental/string_view> has been removed. Use <string_view> instead."}}
+
+int main() {}
diff --git a/test/libcxx/experimental/strings/string.view/version.pass.cpp b/test/libcxx/experimental/strings/string.view/version.pass.cpp
new file mode 100644
index 0000000000000..417982e36696f
--- /dev/null
+++ b/test/libcxx/experimental/strings/string.view/version.pass.cpp
@@ -0,0 +1,21 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <experimental/string_view>
+
+#ifdef __GNUC__
+#pragma GCC diagnostic ignored "-W#warnings"
+#endif
+#include <experimental/string_view>
+
+#ifndef _LIBCPP_VERSION
+#error _LIBCPP_VERSION not defined
+#endif
+
+int main() {}
diff --git a/test/libcxx/experimental/utilities/any/use_header_warning.fail.cpp b/test/libcxx/experimental/utilities/any/use_header_warning.fail.cpp
new file mode 100644
index 0000000000000..0bcda7056b4d0
--- /dev/null
+++ b/test/libcxx/experimental/utilities/any/use_header_warning.fail.cpp
@@ -0,0 +1,18 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// REQUIRES: verify-support
+
+// <experimental/any>
+
+#include <experimental/any>
+
+// expected-error@experimental/any:* {{"<experimental/any> has been removed. Use <any> instead."}}
+
+int main() {}
diff --git a/test/libcxx/experimental/utilities/any/version.pass.cpp b/test/libcxx/experimental/utilities/any/version.pass.cpp
new file mode 100644
index 0000000000000..bc37d8b4dbfa5
--- /dev/null
+++ b/test/libcxx/experimental/utilities/any/version.pass.cpp
@@ -0,0 +1,21 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <experimental/any>
+
+#ifdef __GNUC__
+#pragma GCC diagnostic ignored "-W#warnings"
+#endif
+#include <experimental/any>
+
+#ifndef _LIBCPP_VERSION
+#error _LIBCPP_VERSION not defined
+#endif
+
+int main() {}
diff --git a/test/libcxx/experimental/utilities/optional/use_header_warning.fail.cpp b/test/libcxx/experimental/utilities/optional/use_header_warning.fail.cpp
new file mode 100644
index 0000000000000..1711d2f03742a
--- /dev/null
+++ b/test/libcxx/experimental/utilities/optional/use_header_warning.fail.cpp
@@ -0,0 +1,18 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// REQUIRES: verify-support
+
+// <experimental/optional>
+
+#include <experimental/optional>
+
+// expected-error@experimental/optional:* {{"<experimental/optional> has been removed. Use <optional> instead."}}
+
+int main() {}
diff --git a/test/libcxx/experimental/utilities/optional/version.pass.cpp b/test/libcxx/experimental/utilities/optional/version.pass.cpp
new file mode 100644
index 0000000000000..ef011bbe4506e
--- /dev/null
+++ b/test/libcxx/experimental/utilities/optional/version.pass.cpp
@@ -0,0 +1,21 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <experimental/optional>
+
+#ifdef __GNUC__
+#pragma GCC diagnostic ignored "-W#warnings"
+#endif
+#include <experimental/optional>
+
+#ifndef _LIBCPP_VERSION
+#error _LIBCPP_VERSION not defined
+#endif
+
+int main() {}
diff --git a/test/libcxx/experimental/utilities/ratio/use_header_warning.fail.cpp b/test/libcxx/experimental/utilities/ratio/use_header_warning.fail.cpp
new file mode 100644
index 0000000000000..d9a01337a9367
--- /dev/null
+++ b/test/libcxx/experimental/utilities/ratio/use_header_warning.fail.cpp
@@ -0,0 +1,18 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// REQUIRES: verify-support
+
+// <experimental/ratio>
+
+#include <experimental/ratio>
+
+// expected-error@experimental/ratio:* {{"<experimental/ratio> has been removed. Use <ratio> instead."}}
+
+int main() {}
diff --git a/test/libcxx/experimental/utilities/ratio/version.pass.cpp b/test/libcxx/experimental/utilities/ratio/version.pass.cpp
new file mode 100644
index 0000000000000..8ebb347a44ba2
--- /dev/null
+++ b/test/libcxx/experimental/utilities/ratio/version.pass.cpp
@@ -0,0 +1,21 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <experimental/ratio>
+
+#ifdef __GNUC__
+#pragma GCC diagnostic ignored "-W#warnings"
+#endif
+#include <experimental/ratio>
+
+#ifndef _LIBCPP_VERSION
+#error _LIBCPP_VERSION not defined
+#endif
+
+int main() {}
diff --git a/test/libcxx/experimental/utilities/time/use_header_warning.fail.cpp b/test/libcxx/experimental/utilities/time/use_header_warning.fail.cpp
new file mode 100644
index 0000000000000..9f3d679fc2ab5
--- /dev/null
+++ b/test/libcxx/experimental/utilities/time/use_header_warning.fail.cpp
@@ -0,0 +1,18 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// REQUIRES: verify-support
+
+// <experimental/chrono>
+
+#include <experimental/chrono>
+
+// expected-error@experimental/chrono:* {{"<experimental/chrono> has been removed. Use <chrono> instead."}}
+
+int main() {}
diff --git a/test/libcxx/experimental/utilities/time/version.pass.cpp b/test/libcxx/experimental/utilities/time/version.pass.cpp
new file mode 100644
index 0000000000000..5544a3f0e14b5
--- /dev/null
+++ b/test/libcxx/experimental/utilities/time/version.pass.cpp
@@ -0,0 +1,21 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <experimental/chrono>
+
+#ifdef __GNUC__
+#pragma GCC diagnostic ignored "-W#warnings"
+#endif
+#include <experimental/chrono>
+
+#ifndef _LIBCPP_VERSION
+#error _LIBCPP_VERSION not defined
+#endif
+
+int main() {}
diff --git a/test/libcxx/experimental/utilities/tuple/use_header_warning.fail.cpp b/test/libcxx/experimental/utilities/tuple/use_header_warning.fail.cpp
new file mode 100644
index 0000000000000..520e9fbb42f09
--- /dev/null
+++ b/test/libcxx/experimental/utilities/tuple/use_header_warning.fail.cpp
@@ -0,0 +1,18 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// REQUIRES: verify-support
+
+// <experimental/tuple>
+
+#include <experimental/tuple>
+
+// expected-error@experimental/tuple:* {{"<experimental/tuple> has been removed. Use <tuple> instead."}}
+
+int main() {}
diff --git a/test/libcxx/experimental/utilities/tuple/version.pass.cpp b/test/libcxx/experimental/utilities/tuple/version.pass.cpp
new file mode 100644
index 0000000000000..c7c9e572856d1
--- /dev/null
+++ b/test/libcxx/experimental/utilities/tuple/version.pass.cpp
@@ -0,0 +1,21 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <experimental/tuple>
+
+#ifdef __GNUC__
+#pragma GCC diagnostic ignored "-W#warnings"
+#endif
+#include <experimental/tuple>
+
+#ifndef _LIBCPP_VERSION
+#error _LIBCPP_VERSION not defined
+#endif
+
+int main() {}
diff --git a/test/libcxx/input.output/file.streams/fstreams/fstream.close.pass.cpp b/test/libcxx/input.output/file.streams/fstreams/fstream.close.pass.cpp
new file mode 100644
index 0000000000000..0f8defcbd97d8
--- /dev/null
+++ b/test/libcxx/input.output/file.streams/fstreams/fstream.close.pass.cpp
@@ -0,0 +1,35 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+// <fstream>
+
+// template <class charT, class traits = char_traits<charT> >
+// class basic_fstream
+
+// close();
+
+// Inspired by PR#38052 - std::fstream still good after closing and updating content
+
+#include <fstream>
+#include <cassert>
+#include "platform_support.h"
+
+int main()
+{
+ std::string temp = get_temp_file_name();
+
+ std::fstream ofs(temp, std::ios::out | std::ios::trunc);
+ ofs << "Hello, World!\n";
+ assert( ofs.good());
+ ofs.close();
+ assert( ofs.good());
+ ofs << "Hello, World!\n";
+ assert(!ofs.good());
+
+ std::remove(temp.c_str());
+}
diff --git a/test/libcxx/language.support/cxa_deleted_virtual.pass.cpp b/test/libcxx/language.support/cxa_deleted_virtual.pass.cpp
index ddef5d00e5da4..7e3130cf9fa98 100644
--- a/test/libcxx/language.support/cxa_deleted_virtual.pass.cpp
+++ b/test/libcxx/language.support/cxa_deleted_virtual.pass.cpp
@@ -12,6 +12,7 @@
// Test exporting the symbol: "__cxa_deleted_virtual" in macosx
// But don't expect the symbol to be exported in previous versions.
//
+// XFAIL: with_system_cxx_lib=macosx10.14
// XFAIL: with_system_cxx_lib=macosx10.13
// XFAIL: with_system_cxx_lib=macosx10.12
// XFAIL: with_system_cxx_lib=macosx10.11
diff --git a/test/libcxx/language.support/has_c11_features.pass.cpp b/test/libcxx/language.support/has_c11_features.pass.cpp
index cdccc00e21b4f..4edec534eb98b 100644
--- a/test/libcxx/language.support/has_c11_features.pass.cpp
+++ b/test/libcxx/language.support/has_c11_features.pass.cpp
@@ -14,6 +14,9 @@
// _LIBCPP_HAS_C11_FEATURES - which is defined in <__config>
// They should always be the same
+#include <__config>
+#include "test_macros.h"
+
#ifdef TEST_HAS_C11_FEATURES
# ifndef _LIBCPP_HAS_C11_FEATURES
# error "TEST_HAS_C11_FEATURES is defined, but _LIBCPP_HAS_C11_FEATURES is not"
diff --git a/test/libcxx/language.support/support.dynamic/libcpp_deallocate.sh.cpp b/test/libcxx/language.support/support.dynamic/libcpp_deallocate.sh.cpp
new file mode 100644
index 0000000000000..f62e82d8e594a
--- /dev/null
+++ b/test/libcxx/language.support/support.dynamic/libcpp_deallocate.sh.cpp
@@ -0,0 +1,260 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// test libc++'s implementation of align_val_t, and the relevant new/delete
+// overloads in all dialects when -faligned-allocation is present.
+
+// Libc++ defers to the underlying MSVC library to provide the new/delete
+// definitions, which does not yet provide aligned allocation
+// XFAIL: LIBCXX-WINDOWS-FIXME
+
+// The dylibs shipped before macosx10.14 do not contain the aligned allocation
+// functions, so trying to force using those with -faligned-allocation results
+// in a link error.
+// XFAIL: with_system_cxx_lib=macosx10.13
+// XFAIL: with_system_cxx_lib=macosx10.12
+// XFAIL: with_system_cxx_lib=macosx10.11
+// XFAIL: with_system_cxx_lib=macosx10.10
+// XFAIL: with_system_cxx_lib=macosx10.9
+// XFAIL: with_system_cxx_lib=macosx10.8
+// XFAIL: with_system_cxx_lib=macosx10.7
+
+// The test will fail on deployment targets that do not support sized deallocation.
+// XFAIL: availability=macosx10.11
+// XFAIL: availability=macosx10.10
+// XFAIL: availability=macosx10.9
+// XFAIL: availability=macosx10.8
+// XFAIL: availability=macosx10.7
+
+// XFAIL: sanitizer-new-delete, ubsan
+
+// GCC doesn't support the aligned-allocation flags.
+// XFAIL: gcc
+
+// RUN: %build -faligned-allocation -fsized-deallocation
+// RUN: %run
+// RUN: %build -faligned-allocation -fno-sized-deallocation -DNO_SIZE
+// RUN: %run
+// RUN: %build -fno-aligned-allocation -fsized-deallocation -DNO_ALIGN
+// RUN: %run
+// RUN: %build -fno-aligned-allocation -fno-sized-deallocation -DNO_ALIGN -DNO_SIZE
+// RUN: %run
+
+#include <new>
+#include <typeinfo>
+#include <string>
+#include <cassert>
+
+#include "test_macros.h"
+
+struct alloc_stats {
+ alloc_stats() { reset(); }
+
+ int aligned_sized_called;
+ int aligned_called;
+ int sized_called;
+ int plain_called;
+ int last_size;
+ int last_align;
+
+ void reset() {
+ aligned_sized_called = aligned_called = sized_called = plain_called = 0;
+ last_align = last_size = -1;
+ }
+
+ bool expect_plain() const {
+ assert(aligned_sized_called == 0);
+ assert(aligned_called == 0);
+ assert(sized_called == 0);
+ assert(last_size == -1);
+ assert(last_align == -1);
+ return plain_called == 1;
+ }
+
+ bool expect_size(int n) const {
+ assert(plain_called == 0);
+ assert(aligned_sized_called == 0);
+ assert(aligned_called == 0);
+ assert(last_size == n);
+ assert(last_align == -1);
+ return sized_called == 1;
+ }
+
+ bool expect_align(int a) const {
+ assert(plain_called == 0);
+ assert(aligned_sized_called == 0);
+ assert(sized_called == 0);
+ assert(last_size == -1);
+ assert(last_align == a);
+ return aligned_called == 1;
+ }
+
+ bool expect_size_align(int n, int a) const {
+ assert(plain_called == 0);
+ assert(sized_called == 0);
+ assert(aligned_called == 0);
+ assert(last_size == n);
+ assert(last_align == a);
+ return aligned_sized_called == 1;
+ }
+};
+alloc_stats stats;
+
+void operator delete(void* p)TEST_NOEXCEPT {
+ ::free(p);
+ stats.plain_called++;
+ stats.last_size = stats.last_align = -1;
+}
+
+#ifndef NO_SIZE
+void operator delete(void* p, size_t n)TEST_NOEXCEPT {
+ ::free(p);
+ stats.sized_called++;
+ stats.last_size = n;
+ stats.last_align = -1;
+}
+#endif
+
+#ifndef NO_ALIGN
+void operator delete(void* p, std::align_val_t a)TEST_NOEXCEPT {
+ ::free(p);
+ stats.aligned_called++;
+ stats.last_align = static_cast<int>(a);
+ stats.last_size = -1;
+}
+
+void operator delete(void* p, size_t n, std::align_val_t a)TEST_NOEXCEPT {
+ ::free(p);
+ stats.aligned_sized_called++;
+ stats.last_align = static_cast<int>(a);
+ stats.last_size = n;
+}
+#endif
+
+void test_libcpp_dealloc() {
+ void* p = nullptr;
+ size_t over_align_val = TEST_ALIGNOF(std::max_align_t) * 2;
+ size_t under_align_val = TEST_ALIGNOF(int);
+ size_t with_size_val = 2;
+
+ {
+ std::__libcpp_deallocate_unsized(p, under_align_val);
+ assert(stats.expect_plain());
+ }
+ stats.reset();
+
+#if defined(NO_SIZE) && defined(NO_ALIGN)
+ {
+ std::__libcpp_deallocate(p, with_size_val, over_align_val);
+ assert(stats.expect_plain());
+ }
+ stats.reset();
+#elif defined(NO_SIZE)
+ {
+ std::__libcpp_deallocate(p, with_size_val, over_align_val);
+ assert(stats.expect_align(over_align_val));
+ }
+ stats.reset();
+#elif defined(NO_ALIGN)
+ {
+ std::__libcpp_deallocate(p, with_size_val, over_align_val);
+ assert(stats.expect_size(with_size_val));
+ }
+ stats.reset();
+#else
+ {
+ std::__libcpp_deallocate(p, with_size_val, over_align_val);
+ assert(stats.expect_size_align(with_size_val, over_align_val));
+ }
+ stats.reset();
+ {
+ std::__libcpp_deallocate_unsized(p, over_align_val);
+ assert(stats.expect_align(over_align_val));
+ }
+ stats.reset();
+ {
+ std::__libcpp_deallocate(p, with_size_val, under_align_val);
+ assert(stats.expect_size(with_size_val));
+ }
+ stats.reset();
+#endif
+}
+
+struct TEST_ALIGNAS(128) AlignedType {
+ AlignedType() : elem(0) {}
+ TEST_ALIGNAS(128) char elem;
+};
+
+void test_allocator_and_new_match() {
+ stats.reset();
+#if defined(NO_SIZE) && defined(NO_ALIGN)
+ {
+ int* x = new int(42);
+ delete x;
+ assert(stats.expect_plain());
+ }
+ stats.reset();
+ {
+ AlignedType* a = new AlignedType();
+ delete a;
+ assert(stats.expect_plain());
+ }
+ stats.reset();
+#elif defined(NO_SIZE)
+ stats.reset();
+#if TEST_STD_VER >= 11
+ {
+ int* x = new int(42);
+ delete x;
+ assert(stats.expect_plain());
+ }
+#endif
+ stats.reset();
+ {
+ AlignedType* a = new AlignedType();
+ delete a;
+ assert(stats.expect_align(TEST_ALIGNOF(AlignedType)));
+ }
+ stats.reset();
+#elif defined(NO_ALIGN)
+ stats.reset();
+ {
+ int* x = new int(42);
+ delete x;
+ assert(stats.expect_size(sizeof(int)));
+ }
+ stats.reset();
+ {
+ AlignedType* a = new AlignedType();
+ delete a;
+ assert(stats.expect_size(sizeof(AlignedType)));
+ }
+ stats.reset();
+#else
+ stats.reset();
+ {
+ int* x = new int(42);
+ delete x;
+ assert(stats.expect_size(sizeof(int)));
+ }
+ stats.reset();
+ {
+ AlignedType* a = new AlignedType();
+ delete a;
+ assert(stats.expect_size_align(sizeof(AlignedType),
+ TEST_ALIGNOF(AlignedType)));
+ }
+ stats.reset();
+#endif
+}
+
+int main() {
+ test_libcpp_dealloc();
+ test_allocator_and_new_match();
+}
diff --git a/test/libcxx/language.support/support.dynamic/new_faligned_allocation.sh.cpp b/test/libcxx/language.support/support.dynamic/new_faligned_allocation.sh.cpp
index 388fbebbd7b04..d7b4cca63aa1d 100644
--- a/test/libcxx/language.support/support.dynamic/new_faligned_allocation.sh.cpp
+++ b/test/libcxx/language.support/support.dynamic/new_faligned_allocation.sh.cpp
@@ -7,7 +7,7 @@
//
//===----------------------------------------------------------------------===//
-// test libc++'s implementation of align_val_t, and the relevent new/delete
+// test libc++'s implementation of align_val_t, and the relevant new/delete
// overloads in all dialects when -faligned-allocation is present.
// Libc++ defers to the underlying MSVC library to provide the new/delete
@@ -16,12 +16,16 @@
// REQUIRES: -faligned-allocation
+// The dylibs shipped before macosx10.14 do not contain the aligned allocation
+// functions, so trying to force using those with -faligned-allocation results
+// in a link error.
+// XFAIL: with_system_cxx_lib=macosx10.13
// XFAIL: with_system_cxx_lib=macosx10.12
// XFAIL: with_system_cxx_lib=macosx10.11
// XFAIL: with_system_cxx_lib=macosx10.10
// XFAIL: with_system_cxx_lib=macosx10.9
-// XFAIL: with_system_cxx_lib=macosx10.7
// XFAIL: with_system_cxx_lib=macosx10.8
+// XFAIL: with_system_cxx_lib=macosx10.7
// RUN: %build -faligned-allocation
// RUN: %run
diff --git a/test/libcxx/libcpp_alignof.pass.cpp b/test/libcxx/libcpp_alignof.pass.cpp
new file mode 100644
index 0000000000000..ba0df807e82dd
--- /dev/null
+++ b/test/libcxx/libcpp_alignof.pass.cpp
@@ -0,0 +1,37 @@
+// -*- C++ -*-
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// Test that _LIBCPP_ALIGNOF acts the same as the C++11 keyword `alignof`, and
+// not as the GNU extension `__alignof`. The former returns the minimal required
+// alignment for a type, whereas the latter returns the preferred alignment.
+//
+// See llvm.org/PR39713
+
+#include <type_traits>
+#include "test_macros.h"
+
+template <class T>
+void test() {
+ static_assert(_LIBCPP_ALIGNOF(T) == std::alignment_of<T>::value, "");
+ static_assert(_LIBCPP_ALIGNOF(T) == TEST_ALIGNOF(T), "");
+#if TEST_STD_VER >= 11
+ static_assert(_LIBCPP_ALIGNOF(T) == alignof(T), "");
+#endif
+#ifdef TEST_COMPILER_CLANG
+ static_assert(_LIBCPP_ALIGNOF(T) == _Alignof(T), "");
+#endif
+}
+
+int main() {
+ test<int>();
+ test<long long>();
+ test<double>();
+ test<long double>();
+}
diff --git a/test/libcxx/language.support/support.dynamic/alloc.errors/new.badlength/bad_array_length.pass.cpp b/test/libcxx/memory/aligned_allocation_macro.pass.cpp
index c37d234331484..368076dee3ad8 100644
--- a/test/libcxx/language.support/support.dynamic/alloc.errors/new.badlength/bad_array_length.pass.cpp
+++ b/test/libcxx/memory/aligned_allocation_macro.pass.cpp
@@ -7,31 +7,25 @@
//
//===----------------------------------------------------------------------===//
-// UNSUPPORTED: c++98, c++03, c++11
-// XFAIL: availability
+// UNSUPPORTED: c++98, c++03, c++11, c++14
+// AppleClang <= 10 enables aligned allocation regardless of the deployment
+// target, so this test would fail.
+// UNSUPPORTED: apple-clang-9, apple-clang-10
+
+// XFAIL: availability=macosx10.13
// XFAIL: availability=macosx10.12
// XFAIL: availability=macosx10.11
// XFAIL: availability=macosx10.10
// XFAIL: availability=macosx10.9
-// XFAIL: availability=macosx10.7
// XFAIL: availability=macosx10.8
-
-// test bad_array_length
+// XFAIL: availability=macosx10.7
#include <new>
-#include <type_traits>
-#include <cassert>
-int main()
-{
- static_assert((std::is_base_of<std::bad_alloc, std::bad_array_length>::value),
- "std::is_base_of<std::bad_alloc, std::bad_array_length>::value");
- static_assert(std::is_polymorphic<std::bad_array_length>::value,
- "std::is_polymorphic<std::bad_array_length>::value");
- std::bad_array_length b;
- std::bad_array_length b2 = b;
- b2 = b;
- const char* w = b2.what();
- assert(w);
-}
+
+#ifdef _LIBCPP_HAS_NO_ALIGNED_ALLOCATION
+# error "libc++ should have aligned allocation in C++17 and up when targeting a platform that supports it"
+#endif
+
+int main() { }
diff --git a/test/libcxx/min_max_macros.sh.cpp b/test/libcxx/min_max_macros.sh.cpp
index 087aa3645a50e..7b9202d952fb7 100644
--- a/test/libcxx/min_max_macros.sh.cpp
+++ b/test/libcxx/min_max_macros.sh.cpp
@@ -46,6 +46,8 @@ TEST_MACROS();
TEST_MACROS();
#include <cfloat>
TEST_MACROS();
+#include <charconv>
+TEST_MACROS();
#include <chrono>
TEST_MACROS();
#include <cinttypes>
@@ -239,8 +241,6 @@ TEST_MACROS();
TEST_MACROS();
#include <experimental/deque>
TEST_MACROS();
-#include <experimental/dynarray>
-TEST_MACROS();
#include <experimental/filesystem>
TEST_MACROS();
#include <experimental/forward_list>
diff --git a/test/libcxx/strings/basic.string/string.modifiers/erase_iter_db1.pass.cpp b/test/libcxx/strings/basic.string/string.modifiers/erase_iter_db1.pass.cpp
index 6c2929d7f1d3a..09a6aa8a6343b 100644
--- a/test/libcxx/strings/basic.string/string.modifiers/erase_iter_db1.pass.cpp
+++ b/test/libcxx/strings/basic.string/string.modifiers/erase_iter_db1.pass.cpp
@@ -20,6 +20,7 @@
#include <cstdlib>
#include <exception>
+#include "test_macros.h"
#include "min_allocator.h"
int main()
@@ -30,7 +31,7 @@ int main()
l1.erase(i);
assert(false);
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::basic_string<char, std::char_traits<char>, min_allocator<char>> S;
S l1("123");
diff --git a/test/libcxx/strings/basic.string/string.modifiers/erase_iter_db2.pass.cpp b/test/libcxx/strings/basic.string/string.modifiers/erase_iter_db2.pass.cpp
index d20fcd4623b7d..1ff02932bd98a 100644
--- a/test/libcxx/strings/basic.string/string.modifiers/erase_iter_db2.pass.cpp
+++ b/test/libcxx/strings/basic.string/string.modifiers/erase_iter_db2.pass.cpp
@@ -20,6 +20,7 @@
#include <cstdlib>
#include <exception>
+#include "test_macros.h"
#include "min_allocator.h"
int main()
@@ -31,7 +32,7 @@ int main()
l1.erase(i);
assert(false);
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::basic_string<char, std::char_traits<char>, min_allocator<char>> S;
S l1("123");
diff --git a/test/libcxx/strings/basic.string/string.modifiers/erase_iter_iter_db1.pass.cpp b/test/libcxx/strings/basic.string/string.modifiers/erase_iter_iter_db1.pass.cpp
index 5015241ad63ea..46fa5bf434dd2 100644
--- a/test/libcxx/strings/basic.string/string.modifiers/erase_iter_iter_db1.pass.cpp
+++ b/test/libcxx/strings/basic.string/string.modifiers/erase_iter_iter_db1.pass.cpp
@@ -20,6 +20,7 @@
#include <exception>
#include <cstdlib>
+#include "test_macros.h"
#include "min_allocator.h"
int main()
@@ -30,7 +31,7 @@ int main()
std::string::iterator i = l1.erase(l2.cbegin(), l1.cbegin()+1);
assert(false);
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::basic_string<char, std::char_traits<char>, min_allocator<char>> S;
S l1("123");
diff --git a/test/libcxx/strings/basic.string/string.modifiers/erase_iter_iter_db2.pass.cpp b/test/libcxx/strings/basic.string/string.modifiers/erase_iter_iter_db2.pass.cpp
index 6a23bf88ca5c0..3ccbfad70a6b4 100644
--- a/test/libcxx/strings/basic.string/string.modifiers/erase_iter_iter_db2.pass.cpp
+++ b/test/libcxx/strings/basic.string/string.modifiers/erase_iter_iter_db2.pass.cpp
@@ -20,6 +20,7 @@
#include <exception>
#include <cstdlib>
+#include "test_macros.h"
#include "min_allocator.h"
int main()
@@ -30,7 +31,7 @@ int main()
std::string::iterator i = l1.erase(l1.cbegin(), l2.cbegin()+1);
assert(false);
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::basic_string<char, std::char_traits<char>, min_allocator<char>> S;
S l1("123");
diff --git a/test/libcxx/strings/basic.string/string.modifiers/erase_iter_iter_db3.pass.cpp b/test/libcxx/strings/basic.string/string.modifiers/erase_iter_iter_db3.pass.cpp
index a8443818aea5b..e493dfea9e059 100644
--- a/test/libcxx/strings/basic.string/string.modifiers/erase_iter_iter_db3.pass.cpp
+++ b/test/libcxx/strings/basic.string/string.modifiers/erase_iter_iter_db3.pass.cpp
@@ -20,6 +20,7 @@
#include <exception>
#include <cstdlib>
+#include "test_macros.h"
#include "min_allocator.h"
int main()
@@ -30,7 +31,7 @@ int main()
std::string::iterator i = l1.erase(l2.cbegin(), l2.cbegin()+1);
assert(false);
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::basic_string<char, std::char_traits<char>, min_allocator<char>> S;
S l1("123");
diff --git a/test/libcxx/strings/basic.string/string.modifiers/erase_iter_iter_db4.pass.cpp b/test/libcxx/strings/basic.string/string.modifiers/erase_iter_iter_db4.pass.cpp
index 0549e816b44c8..918cffe733fd0 100644
--- a/test/libcxx/strings/basic.string/string.modifiers/erase_iter_iter_db4.pass.cpp
+++ b/test/libcxx/strings/basic.string/string.modifiers/erase_iter_iter_db4.pass.cpp
@@ -20,6 +20,7 @@
#include <exception>
#include <cstdlib>
+#include "test_macros.h"
#include "min_allocator.h"
int main()
@@ -29,7 +30,7 @@ int main()
std::string::iterator i = l1.erase(l1.cbegin()+1, l1.cbegin());
assert(false);
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef std::basic_string<char, std::char_traits<char>, min_allocator<char>> S;
S l1("123");
diff --git a/test/libcxx/strings/basic.string/string.modifiers/resize_default_initialized.pass.cpp b/test/libcxx/strings/basic.string/string.modifiers/resize_default_initialized.pass.cpp
new file mode 100644
index 0000000000000..a3fa585e44ff5
--- /dev/null
+++ b/test/libcxx/strings/basic.string/string.modifiers/resize_default_initialized.pass.cpp
@@ -0,0 +1,63 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <string>
+
+// __resize_default_init(size_type)
+
+#include <string>
+#include <cassert>
+
+#include "test_macros.h"
+
+void write_c_str(char *buf, int size) {
+ for (int i=0; i < size; ++i) {
+ buf[i] = 'a';
+ }
+ buf[size] = '\0';
+}
+
+void test_buffer_usage()
+{
+ {
+ unsigned buff_size = 125;
+ unsigned used_size = buff_size - 16;
+ std::string s;
+ s.__resize_default_init(buff_size);
+ write_c_str(&s[0], used_size);
+ assert(s.size() == buff_size);
+ assert(strlen(s.data()) == used_size);
+ s.__resize_default_init(used_size);
+ assert(s.size() == used_size);
+ assert(s.data()[used_size] == '\0');
+ for (unsigned i=0; i < used_size; ++i) {
+ assert(s[i] == 'a');
+ }
+ }
+}
+
+void test_basic() {
+ {
+ std::string s;
+ s.__resize_default_init(3);
+ assert(s.size() == 3);
+ assert(s.data()[3] == '\0');
+ for (int i=0; i < 3; ++i)
+ s[i] = 'a' + i;
+ s.__resize_default_init(1);
+ assert(s[0] == 'a');
+ assert(s.data()[1] == '\0');
+ assert(s.size() == 1);
+ }
+}
+
+int main() {
+ test_basic();
+ test_buffer_usage();
+}
diff --git a/test/libcxx/thread/thread.mutex/thread_safety_lock_guard.pass.cpp b/test/libcxx/thread/thread.mutex/thread_safety_lock_guard.pass.cpp
index 6024d9978433a..74a4657196e47 100644
--- a/test/libcxx/thread/thread.mutex/thread_safety_lock_guard.pass.cpp
+++ b/test/libcxx/thread/thread.mutex/thread_safety_lock_guard.pass.cpp
@@ -21,10 +21,20 @@
#include <mutex>
+#include "test_macros.h"
+
std::mutex m;
int foo __attribute__((guarded_by(m)));
+static void scoped() {
+#if TEST_STD_VER >= 17
+ std::scoped_lock<std::mutex> lock(m);
+ foo++;
+#endif
+}
+
int main() {
+ scoped();
std::lock_guard<std::mutex> lock(m);
foo++;
}
diff --git a/test/libcxx/thread/thread.threads/thread.thread.this/sleep_for.pass.cpp b/test/libcxx/thread/thread.threads/thread.thread.this/sleep_for.pass.cpp
index b46c2cdec6cb8..3c0571bf9c223 100644
--- a/test/libcxx/thread/thread.threads/thread.thread.this/sleep_for.pass.cpp
+++ b/test/libcxx/thread/thread.threads/thread.thread.this/sleep_for.pass.cpp
@@ -57,7 +57,6 @@ int main()
typedef std::chrono::system_clock Clock;
typedef Clock::time_point time_point;
- typedef Clock::duration duration;
std::chrono::milliseconds ms(500);
time_point t0 = Clock::now();
std::this_thread::sleep_for(ms);
diff --git a/test/std/utilities/optional/optional.object/special_member_gen.pass.cpp b/test/libcxx/utilities/optional/optional.object/triviality.abi.pass.cpp
index 0b9b6e717c3a1..cdfb027364bed 100644
--- a/test/std/utilities/optional/optional.object/special_member_gen.pass.cpp
+++ b/test/libcxx/utilities/optional/optional.object/triviality.abi.pass.cpp
@@ -8,8 +8,18 @@
//===----------------------------------------------------------------------===//
// UNSUPPORTED: c++98, c++03, c++11, c++14
+
// <optional>
+// This test asserts the triviality of special member functions of optional<T>
+// whenever T has these special member functions trivial. The goal of this test
+// is to make sure that we do not change the triviality of those, since that
+// constitues an ABI break (small enough optionals would be passed by registers).
+//
+// constexpr optional(const optional& rhs);
+// constexpr optional(optional&& rhs) noexcept(see below);
+// constexpr optional<T>& operator=(const optional& rhs);
+// constexpr optional<T>& operator=(optional&& rhs) noexcept(see below);
#include <optional>
#include <type_traits>
@@ -21,41 +31,27 @@ template <class T>
struct SpecialMemberTest {
using O = std::optional<T>;
- static_assert(std::is_default_constructible_v<O>,
- "optional is always default constructible.");
- static_assert(std::is_copy_constructible_v<O> == std::is_copy_constructible_v<T>,
- "optional<T> is copy constructible if and only if T is copy constructible.");
- static_assert(std::is_move_constructible_v<O> ==
- (std::is_copy_constructible_v<T> || std::is_move_constructible_v<T>),
- "optional<T> is move constructible if and only if T is copy or move constructible.");
- static_assert(std::is_copy_assignable_v<O> ==
- (std::is_copy_constructible_v<T> && std::is_copy_assignable_v<T>),
- "optional<T> is copy assignable if and only if T is both copy "
- "constructible and copy assignable.");
- static_assert(std::is_move_assignable_v<O> ==
- ((std::is_move_constructible_v<T> && std::is_move_assignable_v<T>) ||
- (std::is_copy_constructible_v<T> && std::is_copy_assignable_v<T>)),
- "optional<T> is move assignable if and only if T is both move constructible and "
- "move assignable, or both copy constructible and copy assignable.");
-
- // The following tests are for not-yet-standardized behavior (P0602):
static_assert(std::is_trivially_destructible_v<O> ==
std::is_trivially_destructible_v<T>,
"optional<T> is trivially destructible if and only if T is.");
+
static_assert(std::is_trivially_copy_constructible_v<O> ==
std::is_trivially_copy_constructible_v<T>,
"optional<T> is trivially copy constructible if and only if T is.");
+
static_assert(std::is_trivially_move_constructible_v<O> ==
std::is_trivially_move_constructible_v<T> ||
(!std::is_move_constructible_v<T> && std::is_trivially_copy_constructible_v<T>),
"optional<T> is trivially move constructible if T is trivially move constructible, "
"or if T is trivially copy constructible and is not move constructible.");
+
static_assert(std::is_trivially_copy_assignable_v<O> ==
(std::is_trivially_destructible_v<T> &&
std::is_trivially_copy_constructible_v<T> &&
std::is_trivially_copy_assignable_v<T>),
"optional<T> is trivially copy assignable if and only if T is trivially destructible, "
"trivially copy constructible, and trivially copy assignable.");
+
static_assert(std::is_trivially_move_assignable_v<O> ==
(std::is_trivially_destructible_v<T> &&
((std::is_trivially_move_constructible_v<T> && std::is_trivially_move_assignable_v<T>) ||
diff --git a/test/libcxx/utilities/utility/pairs/pairs.pair/U_V.pass.cpp b/test/libcxx/utilities/utility/pairs/pairs.pair/U_V.pass.cpp
new file mode 100644
index 0000000000000..6a3e613e9dcba
--- /dev/null
+++ b/test/libcxx/utilities/utility/pairs/pairs.pair/U_V.pass.cpp
@@ -0,0 +1,54 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++98, c++03
+
+// <utility>
+
+// template <class T1, class T2> struct pair
+
+// template<class U, class V> pair(U&& x, V&& y);
+
+#include <utility>
+
+
+struct ExplicitT {
+ constexpr explicit ExplicitT(int x) : value(x) {}
+ int value;
+};
+
+struct ImplicitT {
+ constexpr ImplicitT(int x) : value(x) {}
+ int value;
+};
+
+struct ExplicitNothrowT {
+ explicit ExplicitNothrowT(int x) noexcept : value(x) {}
+ int value;
+};
+
+struct ImplicitNothrowT {
+ ImplicitNothrowT(int x) noexcept : value(x) {}
+ int value;
+};
+
+int main() {
+ { // explicit noexcept test
+ static_assert(!std::is_nothrow_constructible<std::pair<ExplicitT, ExplicitT>, int, int>::value, "");
+ static_assert(!std::is_nothrow_constructible<std::pair<ExplicitNothrowT, ExplicitT>, int, int>::value, "");
+ static_assert(!std::is_nothrow_constructible<std::pair<ExplicitT, ExplicitNothrowT>, int, int>::value, "");
+ static_assert( std::is_nothrow_constructible<std::pair<ExplicitNothrowT, ExplicitNothrowT>, int, int>::value, "");
+ }
+ { // implicit noexcept test
+ static_assert(!std::is_nothrow_constructible<std::pair<ImplicitT, ImplicitT>, int, int>::value, "");
+ static_assert(!std::is_nothrow_constructible<std::pair<ImplicitNothrowT, ImplicitT>, int, int>::value, "");
+ static_assert(!std::is_nothrow_constructible<std::pair<ImplicitT, ImplicitNothrowT>, int, int>::value, "");
+ static_assert( std::is_nothrow_constructible<std::pair<ImplicitNothrowT, ImplicitNothrowT>, int, int>::value, "");
+ }
+}
diff --git a/test/libcxx/utilities/utility/pairs/pairs.pair/const_first_const_second.pass.cpp b/test/libcxx/utilities/utility/pairs/pairs.pair/const_first_const_second.pass.cpp
new file mode 100644
index 0000000000000..6a2401223755b
--- /dev/null
+++ b/test/libcxx/utilities/utility/pairs/pairs.pair/const_first_const_second.pass.cpp
@@ -0,0 +1,62 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++98, c++03
+
+// <utility>
+
+// template <class T1, class T2> struct pair
+
+// pair(const T1& x, const T2& y);
+
+#include <utility>
+
+
+struct ExplicitT {
+ constexpr explicit ExplicitT(int x) : value(x) {}
+ constexpr explicit ExplicitT(ExplicitT const& o) : value(o.value) {}
+ int value;
+};
+
+struct ImplicitT {
+ constexpr ImplicitT(int x) : value(x) {}
+ constexpr ImplicitT(ImplicitT const& o) : value(o.value) {}
+ int value;
+};
+
+struct ExplicitNothrowT {
+ explicit ExplicitNothrowT(ExplicitNothrowT const&) noexcept {}
+};
+
+struct ImplicitNothrowT {
+ ImplicitNothrowT(ImplicitNothrowT const&) noexcept {}
+};
+
+int main() {
+ { // explicit noexcept test
+ static_assert(!std::is_nothrow_constructible<std::pair<ExplicitT, ExplicitT>,
+ ExplicitT const&, ExplicitT const&>::value, "");
+ static_assert(!std::is_nothrow_constructible<std::pair<ExplicitNothrowT, ExplicitT>,
+ ExplicitNothrowT const&, ExplicitT const&>::value, "");
+ static_assert(!std::is_nothrow_constructible<std::pair<ExplicitT, ExplicitNothrowT>,
+ ExplicitT const&, ExplicitNothrowT const&>::value, "");
+ static_assert( std::is_nothrow_constructible<std::pair<ExplicitNothrowT, ExplicitNothrowT>,
+ ExplicitNothrowT const&, ExplicitNothrowT const&>::value, "");
+ }
+ { // implicit noexcept test
+ static_assert(!std::is_nothrow_constructible<std::pair<ImplicitT, ImplicitT>,
+ ImplicitT const&, ImplicitT const&>::value, "");
+ static_assert(!std::is_nothrow_constructible<std::pair<ImplicitNothrowT, ImplicitT>,
+ ImplicitNothrowT const&, ImplicitT const&>::value, "");
+ static_assert(!std::is_nothrow_constructible<std::pair<ImplicitT, ImplicitNothrowT>,
+ ImplicitT const&, ImplicitNothrowT const&>::value, "");
+ static_assert( std::is_nothrow_constructible<std::pair<ImplicitNothrowT, ImplicitNothrowT>,
+ ImplicitNothrowT const&, ImplicitNothrowT const&>::value, "");
+ }
+}
diff --git a/test/libcxx/utilities/utility/pairs/pairs.pair/const_pair_U_V.pass.cpp b/test/libcxx/utilities/utility/pairs/pairs.pair/const_pair_U_V.pass.cpp
new file mode 100644
index 0000000000000..edb3bbf64afb0
--- /dev/null
+++ b/test/libcxx/utilities/utility/pairs/pairs.pair/const_pair_U_V.pass.cpp
@@ -0,0 +1,64 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++98, c++03
+
+// <utility>
+
+// template <class T1, class T2> struct pair
+
+// template <class U, class V> EXPLICIT constexpr pair(const pair<U, V>& p);
+
+#include <utility>
+
+
+struct ExplicitT {
+ constexpr explicit ExplicitT(int x) : value(x) {}
+ constexpr explicit ExplicitT(ExplicitT const& o) : value(o.value) {}
+ int value;
+};
+
+struct ImplicitT {
+ constexpr ImplicitT(int x) : value(x) {}
+ constexpr ImplicitT(ImplicitT const& o) : value(o.value) {}
+ int value;
+};
+
+struct ExplicitNothrowT {
+ explicit ExplicitNothrowT(int x) noexcept : value(x) {}
+ int value;
+};
+
+struct ImplicitNothrowT {
+ ImplicitNothrowT(int x) noexcept : value(x) {}
+ int value;
+};
+
+int main() {
+ { // explicit noexcept test
+ static_assert(!std::is_nothrow_constructible<std::pair<ExplicitT, ExplicitT>,
+ std::pair<int, int> const&>::value, "");
+ static_assert(!std::is_nothrow_constructible<std::pair<ExplicitNothrowT, ExplicitT>,
+ std::pair<int, int> const&>::value, "");
+ static_assert(!std::is_nothrow_constructible<std::pair<ExplicitT, ExplicitNothrowT>,
+ std::pair<int, int> const&>::value, "");
+ static_assert( std::is_nothrow_constructible<std::pair<ExplicitNothrowT, ExplicitNothrowT>,
+ std::pair<int, int> const&>::value, "");
+ }
+ { // implicit noexcept test
+ static_assert(!std::is_nothrow_constructible<std::pair<ImplicitT, ImplicitT>,
+ std::pair<int, int> const&>::value, "");
+ static_assert(!std::is_nothrow_constructible<std::pair<ImplicitNothrowT, ImplicitT>,
+ std::pair<int, int> const&>::value, "");
+ static_assert(!std::is_nothrow_constructible<std::pair<ImplicitT, ImplicitNothrowT>,
+ std::pair<int, int> const&>::value, "");
+ static_assert( std::is_nothrow_constructible<std::pair<ImplicitNothrowT, ImplicitNothrowT>,
+ std::pair<int, int> const&>::value, "");
+ }
+}
diff --git a/test/libcxx/utilities/utility/pairs/pairs.pair/default.pass.cpp b/test/libcxx/utilities/utility/pairs/pairs.pair/default.pass.cpp
new file mode 100644
index 0000000000000..2dbf5511dd160
--- /dev/null
+++ b/test/libcxx/utilities/utility/pairs/pairs.pair/default.pass.cpp
@@ -0,0 +1,36 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++98, c++03
+
+// <utility>
+
+// template <class T1, class T2> struct pair
+
+// constexpr pair();
+
+#include <utility>
+#include <type_traits>
+
+
+struct ThrowingDefault {
+ ThrowingDefault() { }
+};
+
+struct NonThrowingDefault {
+ NonThrowingDefault() noexcept { }
+};
+
+int main() {
+
+ static_assert(!std::is_nothrow_default_constructible<std::pair<ThrowingDefault, ThrowingDefault>>::value, "");
+ static_assert(!std::is_nothrow_default_constructible<std::pair<NonThrowingDefault, ThrowingDefault>>::value, "");
+ static_assert(!std::is_nothrow_default_constructible<std::pair<ThrowingDefault, NonThrowingDefault>>::value, "");
+ static_assert( std::is_nothrow_default_constructible<std::pair<NonThrowingDefault, NonThrowingDefault>>::value, "");
+}
diff --git a/test/libcxx/utilities/utility/pairs/pairs.pair/non_trivial_copy_move_ABI.pass.cpp b/test/libcxx/utilities/utility/pairs/pairs.pair/non_trivial_copy_move_ABI.pass.cpp
index 8b5969d5198c0..58ea6ecde9923 100644
--- a/test/libcxx/utilities/utility/pairs/pairs.pair/non_trivial_copy_move_ABI.pass.cpp
+++ b/test/libcxx/utilities/utility/pairs/pairs.pair/non_trivial_copy_move_ABI.pass.cpp
@@ -30,6 +30,7 @@
#include <utility>
#include <type_traits>
#include <cstdlib>
+#include <cstddef>
#include <cassert>
#include "test_macros.h"
@@ -86,7 +87,7 @@ static_assert(!HasNonTrivialABI<Trivial>::value, "");
#endif
-int main()
+void test_trivial()
{
{
typedef std::pair<int, short> P;
@@ -150,3 +151,15 @@ int main()
}
#endif
}
+
+void test_layout() {
+ typedef std::pair<std::pair<char, char>, char> PairT;
+ static_assert(sizeof(PairT) == 3, "");
+ static_assert(TEST_ALIGNOF(PairT) == TEST_ALIGNOF(char), "");
+ static_assert(offsetof(PairT, first) == 0, "");
+}
+
+int main() {
+ test_trivial();
+ test_layout();
+}
diff --git a/test/libcxx/utilities/utility/pairs/pairs.pair/pair.tuple_element.fail.cpp b/test/libcxx/utilities/utility/pairs/pairs.pair/pair.tuple_element.fail.cpp
index 2a92240a63d22..8bfeeea5d2a6c 100644
--- a/test/libcxx/utilities/utility/pairs/pairs.pair/pair.tuple_element.fail.cpp
+++ b/test/libcxx/utilities/utility/pairs/pairs.pair/pair.tuple_element.fail.cpp
@@ -20,6 +20,6 @@ int main()
{
typedef std::pair<int, double> P;
std::tuple_element<2, P>::type foo; // expected-note {{requested here}}
- // expected-error@utility:* {{static_assert failed "Index out of bounds in std::tuple_element<std::pair<T1, T2>>"}}
+ // expected-error-re@utility:* {{static_assert failed{{( due to requirement '2U[L]{0,2} < 2')?}} "Index out of bounds in std::tuple_element<std::pair<T1, T2>>"}}
}
}
diff --git a/test/libcxx/utilities/utility/pairs/pairs.pair/piecewise.pass.cpp b/test/libcxx/utilities/utility/pairs/pairs.pair/piecewise.pass.cpp
new file mode 100644
index 0000000000000..81dad3bc2ffa1
--- /dev/null
+++ b/test/libcxx/utilities/utility/pairs/pairs.pair/piecewise.pass.cpp
@@ -0,0 +1,38 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++98, c++03
+
+// <utility>
+
+// template <class T1, class T2> struct pair
+
+// template <class... Args1, class... Args2>
+// pair(piecewise_construct_t, tuple<Args1...> first_args,
+// tuple<Args2...> second_args);
+
+#include <tuple>
+#include <type_traits>
+#include <utility>
+
+#include "archetypes.hpp"
+
+
+int main() {
+ using NonThrowingConvert = NonThrowingTypes::ConvertingType;
+ using ThrowingConvert = NonTrivialTypes::ConvertingType;
+ static_assert(!std::is_nothrow_constructible<std::pair<ThrowingConvert, ThrowingConvert>,
+ std::piecewise_construct_t, std::tuple<int, int>, std::tuple<long, long>>::value, "");
+ static_assert(!std::is_nothrow_constructible<std::pair<NonThrowingConvert, ThrowingConvert>,
+ std::piecewise_construct_t, std::tuple<int, int>, std::tuple<long, long>>::value, "");
+ static_assert(!std::is_nothrow_constructible<std::pair<ThrowingConvert, NonThrowingConvert>,
+ std::piecewise_construct_t, std::tuple<int, int>, std::tuple<long, long>>::value, "");
+ static_assert( std::is_nothrow_constructible<std::pair<NonThrowingConvert, NonThrowingConvert>,
+ std::piecewise_construct_t, std::tuple<int, int>, std::tuple<long, long>>::value, "");
+}
diff --git a/test/libcxx/utilities/utility/pairs/pairs.pair/rv_pair_U_V.pass.cpp b/test/libcxx/utilities/utility/pairs/pairs.pair/rv_pair_U_V.pass.cpp
new file mode 100644
index 0000000000000..5d8d36262f17c
--- /dev/null
+++ b/test/libcxx/utilities/utility/pairs/pairs.pair/rv_pair_U_V.pass.cpp
@@ -0,0 +1,63 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++98, c++03
+
+// <utility>
+
+// template <class T1, class T2> struct pair
+
+// template <class U, class V> pair(pair<U, V>&& p);
+
+#include <type_traits>
+#include <utility>
+
+
+struct ExplicitT {
+ constexpr explicit ExplicitT(int x) : value(x) {}
+ int value;
+};
+
+struct ImplicitT {
+ constexpr ImplicitT(int x) : value(x) {}
+ int value;
+};
+
+struct ExplicitNothrowT {
+ explicit ExplicitNothrowT(int x) noexcept : value(x) {}
+ int value;
+};
+
+struct ImplicitNothrowT {
+ ImplicitNothrowT(int x) noexcept : value(x) {}
+ int value;
+};
+
+int main() {
+ { // explicit noexcept test
+ static_assert(!std::is_nothrow_constructible<std::pair<ExplicitT, ExplicitT>,
+ std::pair<int, int>&&>::value, "");
+ static_assert(!std::is_nothrow_constructible<std::pair<ExplicitNothrowT, ExplicitT>,
+ std::pair<int, int>&&>::value, "");
+ static_assert(!std::is_nothrow_constructible<std::pair<ExplicitT, ExplicitNothrowT>,
+ std::pair<int, int>&&>::value, "");
+ static_assert( std::is_nothrow_constructible<std::pair<ExplicitNothrowT, ExplicitNothrowT>,
+ std::pair<int, int>&&>::value, "");
+ }
+ { // implicit noexcept test
+ static_assert(!std::is_nothrow_constructible<std::pair<ImplicitT, ImplicitT>,
+ std::pair<int, int>&&>::value, "");
+ static_assert(!std::is_nothrow_constructible<std::pair<ImplicitNothrowT, ImplicitT>,
+ std::pair<int, int>&&>::value, "");
+ static_assert(!std::is_nothrow_constructible<std::pair<ImplicitT, ImplicitNothrowT>,
+ std::pair<int, int>&&>::value, "");
+ static_assert( std::is_nothrow_constructible<std::pair<ImplicitNothrowT, ImplicitNothrowT>,
+ std::pair<int, int>&&>::value, "");
+ }
+}
diff --git a/test/libcxx/utilities/utility/pairs/pairs.pair/trivial_copy_move_ABI.pass.cpp b/test/libcxx/utilities/utility/pairs/pairs.pair/trivial_copy_move_ABI.pass.cpp
index ec9cc7ec3e020..7346233887798 100644
--- a/test/libcxx/utilities/utility/pairs/pairs.pair/trivial_copy_move_ABI.pass.cpp
+++ b/test/libcxx/utilities/utility/pairs/pairs.pair/trivial_copy_move_ABI.pass.cpp
@@ -25,6 +25,7 @@
#include <utility>
#include <type_traits>
#include <cstdlib>
+#include <cstddef>
#include <cassert>
#include "test_macros.h"
@@ -81,7 +82,7 @@ static_assert(HasTrivialABI<Trivial>::value, "");
#endif
-int main()
+void test_trivial()
{
{
typedef std::pair<int, short> P;
@@ -145,3 +146,15 @@ int main()
}
#endif
}
+
+void test_layout() {
+ typedef std::pair<std::pair<char, char>, char> PairT;
+ static_assert(sizeof(PairT) == 3, "");
+ static_assert(TEST_ALIGNOF(PairT) == TEST_ALIGNOF(char), "");
+ static_assert(offsetof(PairT, first) == 0, "");
+}
+
+int main() {
+ test_trivial();
+ test_layout();
+}
diff --git a/test/libcxx/utilities/variant/variant.variant/variant.helper/variant_alternative.fail.cpp b/test/libcxx/utilities/variant/variant.variant/variant.helper/variant_alternative.fail.cpp
index f39a445b98afd..c4522682c4b88 100644
--- a/test/libcxx/utilities/variant/variant.variant/variant.helper/variant_alternative.fail.cpp
+++ b/test/libcxx/utilities/variant/variant.variant/variant.helper/variant_alternative.fail.cpp
@@ -31,6 +31,6 @@ int main()
{
typedef std::variant<int, double> T;
std::variant_alternative<2, T>::type foo; // expected-note {{requested here}}
- // expected-error@variant:* {{static_assert failed "Index out of bounds in std::variant_alternative<>"}}
+ // expected-error-re@variant:* {{static_assert failed{{( due to requirement '2U[L]{0,2} < sizeof...\(_Types\)')?}} "Index out of bounds in std::variant_alternative<>"}}
}
}
diff --git a/test/libcxx/utilities/variant/variant.variant/variant_size.pass.cpp b/test/libcxx/utilities/variant/variant.variant/variant_size.pass.cpp
index a836ef5169ef1..c309aaaaea180 100644
--- a/test/libcxx/utilities/variant/variant.variant/variant_size.pass.cpp
+++ b/test/libcxx/utilities/variant/variant.variant/variant_size.pass.cpp
@@ -24,7 +24,8 @@ struct make_variant_imp;
template <size_t ...Indices>
struct make_variant_imp<std::integer_sequence<size_t, Indices...>> {
- using type = std::variant<decltype((Indices, char(0)))...>;
+ template <size_t> using AlwaysChar = char;
+ using type = std::variant<AlwaysChar<Indices>...>;
};
template <size_t N>
diff --git a/test/std/algorithms/alg.modifying.operations/alg.random.sample/sample.fail.cpp b/test/std/algorithms/alg.modifying.operations/alg.random.sample/sample.fail.cpp
index d769ad850c317..3d37d052ccc90 100644
--- a/test/std/algorithms/alg.modifying.operations/alg.random.sample/sample.fail.cpp
+++ b/test/std/algorithms/alg.modifying.operations/alg.random.sample/sample.fail.cpp
@@ -34,7 +34,7 @@ template <class PopulationIterator, class SampleIterator> void test() {
}
int main() {
- // expected-error@algorithm:* {{static_assert failed "SampleIterator must meet the requirements of RandomAccessIterator"}}
+ // expected-error-re@algorithm:* {{static_assert failed{{( due to requirement '.*')?}} "SampleIterator must meet the requirements of RandomAccessIterator"}}
// expected-error@algorithm:* 2 {{does not provide a subscript operator}}
// expected-error@algorithm:* {{invalid operands}}
test<input_iterator<int *>, output_iterator<int *> >();
diff --git a/test/std/algorithms/alg.nonmodifying/alg.find.end/find_end_pred.pass.cpp b/test/std/algorithms/alg.nonmodifying/alg.find.end/find_end_pred.pass.cpp
index 76ac991653eb3..ac3b95fbe2a79 100644
--- a/test/std/algorithms/alg.nonmodifying/alg.find.end/find_end_pred.pass.cpp
+++ b/test/std/algorithms/alg.nonmodifying/alg.find.end/find_end_pred.pass.cpp
@@ -16,6 +16,7 @@
// find_end(Iter1 first1, Iter1 last1, Iter2 first2, Iter2 last2, Pred pred);
#include <algorithm>
+#include <functional>
#include <cassert>
#include "test_macros.h"
diff --git a/test/std/algorithms/alg.nonmodifying/alg.is_permutation/is_permutation_pred.pass.cpp b/test/std/algorithms/alg.nonmodifying/alg.is_permutation/is_permutation_pred.pass.cpp
index 12bd938d2968e..cbf87c6c2a891 100644
--- a/test/std/algorithms/alg.nonmodifying/alg.is_permutation/is_permutation_pred.pass.cpp
+++ b/test/std/algorithms/alg.nonmodifying/alg.is_permutation/is_permutation_pred.pass.cpp
@@ -44,6 +44,18 @@ constexpr bool test_constexpr() {
}
#endif
+
+struct S {
+ S(int i) : i_(i) {}
+ bool operator==(const S& other) = delete;
+ int i_;
+};
+
+struct eq {
+ bool operator()(const S& a, const S&b) { return a.i_ == b.i_; }
+};
+
+
int main()
{
{
@@ -739,14 +751,6 @@ int main()
#endif
}
{
- struct S {
- S(int i) : i_(i) {}
- bool operator==(const S& other) = delete;
- int i_;
- };
- struct eq {
- bool operator()(const S& a, const S&b) { return a.i_ == b.i_; }
- };
const S a[] = {S(0), S(1)};
const S b[] = {S(1), S(0)};
const unsigned sa = sizeof(a)/sizeof(a[0]);
diff --git a/test/std/algorithms/alg.sorting/alg.min.max/requires_forward_iterator.fail.cpp b/test/std/algorithms/alg.sorting/alg.min.max/requires_forward_iterator.fail.cpp
new file mode 100644
index 0000000000000..a1069dee7aefe
--- /dev/null
+++ b/test/std/algorithms/alg.sorting/alg.min.max/requires_forward_iterator.fail.cpp
@@ -0,0 +1,37 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <algorithm>
+
+// template<ForwardIterator Iter>
+// max_element(Iter first, Iter last);
+
+#include <algorithm>
+#include <cassert>
+
+#include "test_iterators.h"
+
+int main() {
+ int arr[] = {1, 2, 3};
+ const int *b = std::begin(arr), *e = std::end(arr);
+ typedef input_iterator<const int*> Iter;
+ {
+ // expected-error@algorithm:* {{"std::min_element requires a ForwardIterator"}}
+ std::min_element(Iter(b), Iter(e));
+ }
+ {
+ // expected-error@algorithm:* {{"std::max_element requires a ForwardIterator"}}
+ std::max_element(Iter(b), Iter(e));
+ }
+ {
+ // expected-error@algorithm:* {{"std::minmax_element requires a ForwardIterator"}}
+ std::minmax_element(Iter(b), Iter(e));
+ }
+
+}
diff --git a/test/std/atomics/atomics.lockfree/isalwayslockfree.pass.cpp b/test/std/atomics/atomics.lockfree/isalwayslockfree.pass.cpp
index 7a8d4c1f4a69d..43436e65a90ad 100644
--- a/test/std/atomics/atomics.lockfree/isalwayslockfree.pass.cpp
+++ b/test/std/atomics/atomics.lockfree/isalwayslockfree.pass.cpp
@@ -59,7 +59,7 @@ void checkLongLongTypes() {
static_assert((0 != ATOMIC_LLONG_LOCK_FREE) == ExpectLockFree, "");
}
-int main()
+void run()
{
// structs and unions can't be defined in the template invocation.
// Work around this with a typedef.
@@ -134,3 +134,5 @@ int main()
static_assert(std::atomic<void*>::is_always_lock_free == (2 == ATOMIC_POINTER_LOCK_FREE));
static_assert(std::atomic<std::nullptr_t>::is_always_lock_free == (2 == ATOMIC_POINTER_LOCK_FREE));
}
+
+int main() { run(); }
diff --git a/test/std/containers/Emplaceable.h b/test/std/containers/Emplaceable.h
index 331a81ff311f8..04b1f85435845 100644
--- a/test/std/containers/Emplaceable.h
+++ b/test/std/containers/Emplaceable.h
@@ -10,7 +10,7 @@
#ifndef EMPLACEABLE_H
#define EMPLACEABLE_H
-#include <utility>
+#include <functional>
#include "test_macros.h"
#if TEST_STD_VER >= 11
diff --git a/test/std/containers/associative/map/map.access/at.pass.cpp b/test/std/containers/associative/map/map.access/at.pass.cpp
index 5822706fbfb33..76eda046c0df3 100644
--- a/test/std/containers/associative/map/map.access/at.pass.cpp
+++ b/test/std/containers/associative/map/map.access/at.pass.cpp
@@ -14,8 +14,9 @@
// mapped_type& at(const key_type& k);
// const mapped_type& at(const key_type& k) const;
-#include <map>
#include <cassert>
+#include <map>
+#include <stdexcept>
#include "min_allocator.h"
#include "test_macros.h"
diff --git a/test/std/containers/associative/map/map.access/index_key.pass.cpp b/test/std/containers/associative/map/map.access/index_key.pass.cpp
index 3b1c21fd5da44..5f3d109d1ef77 100644
--- a/test/std/containers/associative/map/map.access/index_key.pass.cpp
+++ b/test/std/containers/associative/map/map.access/index_key.pass.cpp
@@ -84,7 +84,6 @@ int main()
using Container = TCT::map<>;
using Key = Container::key_type;
using MappedType = Container::mapped_type;
- using ValueTp = Container::value_type;
ConstructController* cc = getConstructController();
cc->reset();
{
diff --git a/test/std/containers/associative/map/map.access/index_rv_key.pass.cpp b/test/std/containers/associative/map/map.access/index_rv_key.pass.cpp
index e5580bca3955d..bc91475c26b76 100644
--- a/test/std/containers/associative/map/map.access/index_rv_key.pass.cpp
+++ b/test/std/containers/associative/map/map.access/index_rv_key.pass.cpp
@@ -61,7 +61,6 @@ int main()
using Container = TCT::map<>;
using Key = Container::key_type;
using MappedType = Container::mapped_type;
- using ValueTp = Container::value_type;
ConstructController* cc = getConstructController();
cc->reset();
{
diff --git a/test/std/containers/associative/map/map.access/max_size.pass.cpp b/test/std/containers/associative/map/map.access/max_size.pass.cpp
index 82a817a1f4ae3..9df3b074e40fe 100644
--- a/test/std/containers/associative/map/map.access/max_size.pass.cpp
+++ b/test/std/containers/associative/map/map.access/max_size.pass.cpp
@@ -34,18 +34,18 @@ int main()
{
typedef limited_allocator<KV, (size_t)-1> A;
typedef std::map<int, int, std::less<int>, A> C;
- const C::difference_type max_dist =
- std::numeric_limits<C::difference_type>::max();
+ const C::size_type max_dist =
+ static_cast<C::size_type>(std::numeric_limits<C::difference_type>::max());
C c;
assert(c.max_size() <= max_dist);
LIBCPP_ASSERT(c.max_size() == max_dist);
- }
- {
- typedef std::map<char, int> C;
- const C::difference_type max_dist =
- std::numeric_limits<C::difference_type>::max();
- C c;
- assert(c.max_size() <= max_dist);
- assert(c.max_size() <= alloc_max_size(c.get_allocator()));
- }
+ }
+ {
+ typedef std::map<char, int> C;
+ const C::size_type max_dist =
+ static_cast<C::size_type>(std::numeric_limits<C::difference_type>::max());
+ C c;
+ assert(c.max_size() <= max_dist);
+ assert(c.max_size() <= alloc_max_size(c.get_allocator()));
+ }
}
diff --git a/test/std/containers/associative/map/map.erasure/erase_if.pass.cpp b/test/std/containers/associative/map/map.erasure/erase_if.pass.cpp
new file mode 100644
index 0000000000000..f8cbc15d1645f
--- /dev/null
+++ b/test/std/containers/associative/map/map.erasure/erase_if.pass.cpp
@@ -0,0 +1,79 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
+
+// <map>
+
+// template <class Key, class T, class Compare, class Allocator, class Predicate>
+// void erase_if(map<Key, T, Compare, Allocator>& c, Predicate pred);
+
+#include <map>
+
+#include "test_macros.h"
+#include "test_allocator.h"
+#include "min_allocator.h"
+
+using Init = std::initializer_list<int>;
+template <typename M>
+M make (Init vals)
+{
+ M ret;
+ for (int v : vals)
+ ret[v] = v + 10;
+ return ret;
+}
+
+template <typename M, typename Pred>
+void
+test0(Init vals, Pred p, Init expected)
+{
+ M s = make<M> (vals);
+ ASSERT_SAME_TYPE(void, decltype(std::erase_if(s, p)));
+ std::erase_if(s, p);
+ assert(s == make<M>(expected));
+}
+
+template <typename S>
+void test()
+{
+ auto is1 = [](auto v) { return v.first == 1;};
+ auto is2 = [](auto v) { return v.first == 2;};
+ auto is3 = [](auto v) { return v.first == 3;};
+ auto is4 = [](auto v) { return v.first == 4;};
+ auto True = [](auto) { return true; };
+ auto False = [](auto) { return false; };
+
+ test0<S>({}, is1, {});
+
+ test0<S>({1}, is1, {});
+ test0<S>({1}, is2, {1});
+
+ test0<S>({1,2}, is1, {2});
+ test0<S>({1,2}, is2, {1});
+ test0<S>({1,2}, is3, {1,2});
+
+ test0<S>({1,2,3}, is1, {2,3});
+ test0<S>({1,2,3}, is2, {1,3});
+ test0<S>({1,2,3}, is3, {1,2});
+ test0<S>({1,2,3}, is4, {1,2,3});
+
+ test0<S>({1,2,3}, True, {});
+ test0<S>({1,2,3}, False, {1,2,3});
+}
+
+int main()
+{
+ test<std::map<int, int>>();
+ test<std::map<int, int, std::less<int>, min_allocator<std::pair<const int, int>>>> ();
+ test<std::map<int, int, std::less<int>, test_allocator<std::pair<const int, int>>>> ();
+
+ test<std::map<long, short>>();
+ test<std::map<short, double>>();
+}
+
diff --git a/test/std/containers/associative/map/map.modifiers/clear.pass.cpp b/test/std/containers/associative/map/map.modifiers/clear.pass.cpp
index 1f36a6f10cb0b..ab4642fa88e68 100644
--- a/test/std/containers/associative/map/map.modifiers/clear.pass.cpp
+++ b/test/std/containers/associative/map/map.modifiers/clear.pass.cpp
@@ -11,11 +11,12 @@
// class map
-// void clear();
+// void clear() noexcept;
#include <map>
#include <cassert>
+#include "test_macros.h"
#include "min_allocator.h"
int main()
@@ -36,6 +37,7 @@ int main()
};
M m(ar, ar + sizeof(ar)/sizeof(ar[0]));
assert(m.size() == 8);
+ ASSERT_NOEXCEPT(m.clear());
m.clear();
assert(m.size() == 0);
}
@@ -56,6 +58,7 @@ int main()
};
M m(ar, ar + sizeof(ar)/sizeof(ar[0]));
assert(m.size() == 8);
+ ASSERT_NOEXCEPT(m.clear());
m.clear();
assert(m.size() == 0);
}
diff --git a/test/std/containers/associative/map/map.modifiers/merge.pass.cpp b/test/std/containers/associative/map/map.modifiers/merge.pass.cpp
new file mode 100644
index 0000000000000..bb75e1d602938
--- /dev/null
+++ b/test/std/containers/associative/map/map.modifiers/merge.pass.cpp
@@ -0,0 +1,150 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++98, c++03, c++11, c++14
+
+// <map>
+
+// class map
+
+// template <class C2>
+// void merge(map<key_type, value_type, C2, allocator_type>& source);
+// template <class C2>
+// void merge(map<key_type, value_type, C2, allocator_type>&& source);
+// template <class C2>
+// void merge(multimap<key_type, value_type, C2, allocator_type>& source);
+// template <class C2>
+// void merge(multimap<key_type, value_type, C2, allocator_type>&& source);
+
+#include <map>
+#include <cassert>
+#include "test_macros.h"
+#include "Counter.h"
+
+template <class Map>
+bool map_equal(const Map& map, Map other)
+{
+ return map == other;
+}
+
+#ifndef TEST_HAS_NO_EXCEPTIONS
+struct throw_comparator
+{
+ bool& should_throw_;
+
+ throw_comparator(bool& should_throw) : should_throw_(should_throw) {}
+
+ template <class T>
+ bool operator()(const T& lhs, const T& rhs) const
+ {
+ if (should_throw_)
+ throw 0;
+ return lhs < rhs;
+ }
+};
+#endif
+
+int main()
+{
+ {
+ std::map<int, int> src{{1, 0}, {3, 0}, {5, 0}};
+ std::map<int, int> dst{{2, 0}, {4, 0}, {5, 0}};
+ dst.merge(src);
+ assert(map_equal(src, {{5,0}}));
+ assert(map_equal(dst, {{1, 0}, {2, 0}, {3, 0}, {4, 0}, {5, 0}}));
+ }
+
+#ifndef TEST_HAS_NO_EXCEPTIONS
+ {
+ bool do_throw = false;
+ typedef std::map<Counter<int>, int, throw_comparator> map_type;
+ map_type src({{1, 0}, {3, 0}, {5, 0}}, throw_comparator(do_throw));
+ map_type dst({{2, 0}, {4, 0}, {5, 0}}, throw_comparator(do_throw));
+
+ assert(Counter_base::gConstructed == 6);
+
+ do_throw = true;
+ try
+ {
+ dst.merge(src);
+ }
+ catch (int)
+ {
+ do_throw = false;
+ }
+ assert(!do_throw);
+ assert(map_equal(src, map_type({{1, 0}, {3, 0}, {5, 0}}, throw_comparator(do_throw))));
+ assert(map_equal(dst, map_type({{2, 0}, {4, 0}, {5, 0}}, throw_comparator(do_throw))));
+ }
+#endif
+ assert(Counter_base::gConstructed == 0);
+ struct comparator
+ {
+ comparator() = default;
+
+ bool operator()(const Counter<int>& lhs, const Counter<int>& rhs) const
+ {
+ return lhs < rhs;
+ }
+ };
+ {
+ typedef std::map<Counter<int>, int, std::less<Counter<int>>> first_map_type;
+ typedef std::map<Counter<int>, int, comparator> second_map_type;
+ typedef std::multimap<Counter<int>, int, comparator> third_map_type;
+
+ {
+ first_map_type first{{1, 0}, {2, 0}, {3, 0}};
+ second_map_type second{{2, 0}, {3, 0}, {4, 0}};
+ third_map_type third{{1, 0}, {3, 0}};
+
+ assert(Counter_base::gConstructed == 8);
+
+ first.merge(second);
+ first.merge(third);
+
+ assert(map_equal(first, {{1, 0}, {2, 0}, {3, 0}, {4, 0}}));
+ assert(map_equal(second, {{2, 0}, {3, 0}}));
+ assert(map_equal(third, {{1, 0}, {3, 0}}));
+
+ assert(Counter_base::gConstructed == 8);
+ }
+ assert(Counter_base::gConstructed == 0);
+ {
+ first_map_type first{{1, 0}, {2, 0}, {3, 0}};
+ second_map_type second{{2, 0}, {3, 0}, {4, 0}};
+ third_map_type third{{1, 0}, {3, 0}};
+
+ assert(Counter_base::gConstructed == 8);
+
+ first.merge(std::move(second));
+ first.merge(std::move(third));
+
+ assert(map_equal(first, {{1, 0}, {2, 0}, {3, 0}, {4, 0}}));
+ assert(map_equal(second, {{2, 0}, {3, 0}}));
+ assert(map_equal(third, {{1, 0}, {3, 0}}));
+
+ assert(Counter_base::gConstructed == 8);
+ }
+ assert(Counter_base::gConstructed == 0);
+ }
+ assert(Counter_base::gConstructed == 0);
+ {
+ std::map<int, int> first;
+ {
+ std::map<int, int> second;
+ first.merge(second);
+ first.merge(std::move(second));
+ }
+ {
+ std::multimap<int, int> second;
+ first.merge(second);
+ first.merge(std::move(second));
+ }
+ }
+}
diff --git a/test/std/containers/associative/multimap/max_size.pass.cpp b/test/std/containers/associative/multimap/max_size.pass.cpp
index 8d5ec1148a222..c836a182356f3 100644
--- a/test/std/containers/associative/multimap/max_size.pass.cpp
+++ b/test/std/containers/associative/multimap/max_size.pass.cpp
@@ -34,18 +34,18 @@ int main()
{
typedef limited_allocator<KV, (size_t)-1> A;
typedef std::multimap<int, int, std::less<int>, A> C;
- const C::difference_type max_dist =
- std::numeric_limits<C::difference_type>::max();
+ const C::size_type max_dist =
+ static_cast<C::size_type>(std::numeric_limits<C::difference_type>::max());
C c;
assert(c.max_size() <= max_dist);
LIBCPP_ASSERT(c.max_size() == max_dist);
- }
- {
- typedef std::multimap<char, int> C;
- const C::difference_type max_dist =
- std::numeric_limits<C::difference_type>::max();
- C c;
- assert(c.max_size() <= max_dist);
- assert(c.max_size() <= alloc_max_size(c.get_allocator()));
- }
+ }
+ {
+ typedef std::multimap<char, int> C;
+ const C::size_type max_dist =
+ static_cast<C::size_type>(std::numeric_limits<C::difference_type>::max());
+ C c;
+ assert(c.max_size() <= max_dist);
+ assert(c.max_size() <= alloc_max_size(c.get_allocator()));
+ }
}
diff --git a/test/std/containers/associative/multimap/multimap.erasure/erase_if.pass.cpp b/test/std/containers/associative/multimap/multimap.erasure/erase_if.pass.cpp
new file mode 100644
index 0000000000000..8e786fdc94761
--- /dev/null
+++ b/test/std/containers/associative/multimap/multimap.erasure/erase_if.pass.cpp
@@ -0,0 +1,89 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
+
+// <map>
+
+// template <class Key, class T, class Compare, class Allocator, class Predicate>
+// void erase_if(multimap<Key, T, Compare, Allocator>& c, Predicate pred);
+
+#include <map>
+
+#include "test_macros.h"
+#include "test_allocator.h"
+#include "min_allocator.h"
+
+using Init = std::initializer_list<int>;
+template <typename M>
+M make (Init vals)
+{
+ M ret;
+ for (int v : vals)
+ ret.insert(typename M::value_type(v, v + 10));
+ return ret;
+}
+
+template <typename M, typename Pred>
+void
+test0(Init vals, Pred p, Init expected)
+{
+ M s = make<M> (vals);
+ ASSERT_SAME_TYPE(void, decltype(std::erase_if(s, p)));
+ std::erase_if(s, p);
+ assert(s == make<M>(expected));
+}
+
+template <typename S>
+void test()
+{
+ auto is1 = [](auto v) { return v.first == 1;};
+ auto is2 = [](auto v) { return v.first == 2;};
+ auto is3 = [](auto v) { return v.first == 3;};
+ auto is4 = [](auto v) { return v.first == 4;};
+ auto True = [](auto) { return true; };
+ auto False = [](auto) { return false; };
+
+ test0<S>({}, is1, {});
+
+ test0<S>({1}, is1, {});
+ test0<S>({1}, is2, {1});
+
+ test0<S>({1,2}, is1, {2});
+ test0<S>({1,2}, is2, {1});
+ test0<S>({1,2}, is3, {1,2});
+ test0<S>({1,1}, is1, {});
+ test0<S>({1,1}, is3, {1,1});
+
+ test0<S>({1,2,3}, is1, {2,3});
+ test0<S>({1,2,3}, is2, {1,3});
+ test0<S>({1,2,3}, is3, {1,2});
+ test0<S>({1,2,3}, is4, {1,2,3});
+
+ test0<S>({1,1,1}, is1, {});
+ test0<S>({1,1,1}, is2, {1,1,1});
+ test0<S>({1,1,2}, is1, {2});
+ test0<S>({1,1,2}, is2, {1,1});
+ test0<S>({1,1,2}, is3, {1,1,2});
+ test0<S>({1,2,2}, is1, {2,2});
+ test0<S>({1,2,2}, is2, {1});
+ test0<S>({1,2,2}, is3, {1,2,2});
+
+ test0<S>({1,2,3}, True, {});
+ test0<S>({1,2,3}, False, {1,2,3});
+}
+
+int main()
+{
+ test<std::multimap<int, int>>();
+ test<std::multimap<int, int, std::less<int>, min_allocator<std::pair<const int, int>>>> ();
+ test<std::multimap<int, int, std::less<int>, test_allocator<std::pair<const int, int>>>> ();
+
+ test<std::multimap<long, short>>();
+ test<std::multimap<short, double>>();
+}
diff --git a/test/std/containers/associative/multimap/multimap.modifiers/clear.pass.cpp b/test/std/containers/associative/multimap/multimap.modifiers/clear.pass.cpp
index 321f4d0bd000c..546a406fe1bf6 100644
--- a/test/std/containers/associative/multimap/multimap.modifiers/clear.pass.cpp
+++ b/test/std/containers/associative/multimap/multimap.modifiers/clear.pass.cpp
@@ -11,11 +11,12 @@
// class multimap
-// void clear();
+// void clear() noexcept;
#include <map>
#include <cassert>
+#include "test_macros.h"
#include "min_allocator.h"
int main()
@@ -36,6 +37,7 @@ int main()
};
M m(ar, ar + sizeof(ar)/sizeof(ar[0]));
assert(m.size() == 8);
+ ASSERT_NOEXCEPT(m.clear());
m.clear();
assert(m.size() == 0);
}
@@ -56,6 +58,7 @@ int main()
};
M m(ar, ar + sizeof(ar)/sizeof(ar[0]));
assert(m.size() == 8);
+ ASSERT_NOEXCEPT(m.clear());
m.clear();
assert(m.size() == 0);
}
diff --git a/test/std/containers/associative/multimap/multimap.modifiers/merge.pass.cpp b/test/std/containers/associative/multimap/multimap.modifiers/merge.pass.cpp
new file mode 100644
index 0000000000000..f0e38c255b8e2
--- /dev/null
+++ b/test/std/containers/associative/multimap/multimap.modifiers/merge.pass.cpp
@@ -0,0 +1,150 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++98, c++03, c++11, c++14
+
+// <map>
+
+// class multimap
+
+// template <class C2>
+// void merge(map<key_type, value_type, C2, allocator_type>& source);
+// template <class C2>
+// void merge(map<key_type, value_type, C2, allocator_type>&& source);
+// template <class C2>
+// void merge(multimap<key_type, value_type, C2, allocator_type>& source);
+// template <class C2>
+// void merge(multimap<key_type, value_type, C2, allocator_type>&& source);
+
+#include <map>
+#include <cassert>
+#include "test_macros.h"
+#include "Counter.h"
+
+template <class Map>
+bool map_equal(const Map& map, Map other)
+{
+ return map == other;
+}
+
+#ifndef TEST_HAS_NO_EXCEPTIONS
+struct throw_comparator
+{
+ bool& should_throw_;
+
+ throw_comparator(bool& should_throw) : should_throw_(should_throw) {}
+
+ template <class T>
+ bool operator()(const T& lhs, const T& rhs) const
+ {
+ if (should_throw_)
+ throw 0;
+ return lhs < rhs;
+ }
+};
+#endif
+
+int main()
+{
+ {
+ std::multimap<int, int> src{{1, 0}, {3, 0}, {5, 0}};
+ std::multimap<int, int> dst{{2, 0}, {4, 0}, {5, 0}};
+ dst.merge(src);
+ assert(map_equal(src, {}));
+ assert(map_equal(dst, {{1, 0}, {2, 0}, {3, 0}, {4, 0}, {5, 0}, {5, 0}}));
+ }
+
+#ifndef TEST_HAS_NO_EXCEPTIONS
+ {
+ bool do_throw = false;
+ typedef std::multimap<Counter<int>, int, throw_comparator> map_type;
+ map_type src({{1, 0}, {3, 0}, {5, 0}}, throw_comparator(do_throw));
+ map_type dst({{2, 0}, {4, 0}, {5, 0}}, throw_comparator(do_throw));
+
+ assert(Counter_base::gConstructed == 6);
+
+ do_throw = true;
+ try
+ {
+ dst.merge(src);
+ }
+ catch (int)
+ {
+ do_throw = false;
+ }
+ assert(!do_throw);
+ assert(map_equal(src, map_type({{1, 0}, {3, 0}, {5, 0}}, throw_comparator(do_throw))));
+ assert(map_equal(dst, map_type({{2, 0}, {4, 0}, {5, 0}}, throw_comparator(do_throw))));
+ }
+#endif
+ assert(Counter_base::gConstructed == 0);
+ struct comparator
+ {
+ comparator() = default;
+
+ bool operator()(const Counter<int>& lhs, const Counter<int>& rhs) const
+ {
+ return lhs < rhs;
+ }
+ };
+ {
+ typedef std::multimap<Counter<int>, int, std::less<Counter<int>>> first_map_type;
+ typedef std::multimap<Counter<int>, int, comparator> second_map_type;
+ typedef std::map<Counter<int>, int, comparator> third_map_type;
+
+ {
+ first_map_type first{{1, 0}, {2, 0}, {3, 0}};
+ second_map_type second{{2, 0}, {3, 0}, {4, 0}};
+ third_map_type third{{1, 0}, {3, 0}};
+
+ assert(Counter_base::gConstructed == 8);
+
+ first.merge(second);
+ first.merge(third);
+
+ assert(map_equal(first, {{1, 0}, {1, 0}, {2, 0}, {2, 0}, {3, 0}, {3, 0}, {3, 0}, {4, 0}}));
+ assert(map_equal(second, {}));
+ assert(map_equal(third, {}));
+
+ assert(Counter_base::gConstructed == 8);
+ }
+ assert(Counter_base::gConstructed == 0);
+ {
+ first_map_type first{{1, 0}, {2, 0}, {3, 0}};
+ second_map_type second{{2, 0}, {3, 0}, {4, 0}};
+ third_map_type third{{1, 0}, {3, 0}};
+
+ assert(Counter_base::gConstructed == 8);
+
+ first.merge(std::move(second));
+ first.merge(std::move(third));
+
+ assert(map_equal(first, {{1, 0}, {1, 0}, {2, 0}, {2, 0}, {3, 0}, {3, 0}, {3, 0}, {4, 0}}));
+ assert(map_equal(second, {}));
+ assert(map_equal(third, {}));
+
+ assert(Counter_base::gConstructed == 8);
+ }
+ assert(Counter_base::gConstructed == 0);
+ }
+ assert(Counter_base::gConstructed == 0);
+ {
+ std::multimap<int, int> first;
+ {
+ std::multimap<int, int> second;
+ first.merge(second);
+ first.merge(std::move(second));
+ }
+ {
+ std::multimap<int, int> second;
+ first.merge(second);
+ first.merge(std::move(second));
+ }
+ }
+}
diff --git a/test/std/containers/associative/multiset/clear.pass.cpp b/test/std/containers/associative/multiset/clear.pass.cpp
index f762ef7d35044..59ee02ece1d20 100644
--- a/test/std/containers/associative/multiset/clear.pass.cpp
+++ b/test/std/containers/associative/multiset/clear.pass.cpp
@@ -11,11 +11,12 @@
// class multiset
-// void clear();
+// void clear() noexcept;
#include <set>
#include <cassert>
+#include "test_macros.h"
#include "min_allocator.h"
int main()
@@ -36,6 +37,7 @@ int main()
};
M m(ar, ar + sizeof(ar)/sizeof(ar[0]));
assert(m.size() == 8);
+ ASSERT_NOEXCEPT(m.clear());
m.clear();
assert(m.size() == 0);
}
@@ -56,6 +58,7 @@ int main()
};
M m(ar, ar + sizeof(ar)/sizeof(ar[0]));
assert(m.size() == 8);
+ ASSERT_NOEXCEPT(m.clear());
m.clear();
assert(m.size() == 0);
}
diff --git a/test/std/containers/associative/multiset/insert_allocator_requirements.pass.cpp b/test/std/containers/associative/multiset/insert_emplace_allocator_requirements.pass.cpp
index a280d10d5ab21..4bd2c88f8a357 100644
--- a/test/std/containers/associative/multiset/insert_allocator_requirements.pass.cpp
+++ b/test/std/containers/associative/multiset/insert_emplace_allocator_requirements.pass.cpp
@@ -23,4 +23,5 @@
int main()
{
testMultisetInsert<TCT::multiset<> >();
+ testMultisetEmplace<TCT::multiset<> >();
}
diff --git a/test/std/containers/associative/multiset/max_size.pass.cpp b/test/std/containers/associative/multiset/max_size.pass.cpp
index 8ca34ba827393..8c5b15e39c11a 100644
--- a/test/std/containers/associative/multiset/max_size.pass.cpp
+++ b/test/std/containers/associative/multiset/max_size.pass.cpp
@@ -33,16 +33,16 @@ int main()
{
typedef limited_allocator<int, (size_t)-1> A;
typedef std::multiset<int, std::less<int>, A> C;
- const C::difference_type max_dist =
- std::numeric_limits<C::difference_type>::max();
+ const C::size_type max_dist =
+ static_cast<C::size_type>(std::numeric_limits<C::difference_type>::max());
C c;
assert(c.max_size() <= max_dist);
LIBCPP_ASSERT(c.max_size() == max_dist);
}
{
typedef std::multiset<char> C;
- const C::difference_type max_dist =
- std::numeric_limits<C::difference_type>::max();
+ const C::size_type max_dist =
+ static_cast<C::size_type>(std::numeric_limits<C::difference_type>::max());
C c;
assert(c.max_size() <= max_dist);
assert(c.max_size() <= alloc_max_size(c.get_allocator()));
diff --git a/test/std/containers/associative/multiset/merge.pass.cpp b/test/std/containers/associative/multiset/merge.pass.cpp
new file mode 100644
index 0000000000000..8ab992889e41e
--- /dev/null
+++ b/test/std/containers/associative/multiset/merge.pass.cpp
@@ -0,0 +1,149 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++98, c++03, c++11, c++14
+
+// <set>
+
+// class multiset
+
+// template <class C2>
+// void merge(set<Key, C2, Allocator>& source);
+// template <class C2>
+// void merge(set<Key, C2, Allocator>&& source);
+// template <class C2>
+// void merge(multiset<Key, C2, Allocator>& source);
+// template <class C2>
+// void merge(multiset<Key, C2, Allocator>&& source);
+
+#include <set>
+#include <cassert>
+#include "test_macros.h"
+#include "Counter.h"
+
+template <class Set>
+bool set_equal(const Set& set, Set other)
+{
+ return set == other;
+}
+
+#ifndef TEST_HAS_NO_EXCEPTIONS
+struct throw_comparator
+{
+ bool& should_throw_;
+
+ throw_comparator(bool& should_throw) : should_throw_(should_throw) {}
+
+ template <class T>
+ bool operator()(const T& lhs, const T& rhs) const
+ {
+ if (should_throw_)
+ throw 0;
+ return lhs < rhs;
+ }
+};
+#endif
+
+int main()
+{
+ {
+ std::multiset<int> src{1, 3, 5};
+ std::multiset<int> dst{2, 4, 5};
+ dst.merge(src);
+ assert(set_equal(src, {}));
+ assert(set_equal(dst, {1, 2, 3, 4, 5, 5}));
+ }
+
+#ifndef TEST_HAS_NO_EXCEPTIONS
+ {
+ bool do_throw = false;
+ typedef std::multiset<Counter<int>, throw_comparator> set_type;
+ set_type src({1, 3, 5}, throw_comparator(do_throw));
+ set_type dst({2, 4, 5}, throw_comparator(do_throw));
+
+ assert(Counter_base::gConstructed == 6);
+
+ do_throw = true;
+ try
+ {
+ dst.merge(src);
+ }
+ catch (int)
+ {
+ do_throw = false;
+ }
+ assert(!do_throw);
+ assert(set_equal(src, set_type({1, 3, 5}, throw_comparator(do_throw))));
+ assert(set_equal(dst, set_type({2, 4, 5}, throw_comparator(do_throw))));
+ }
+#endif
+ assert(Counter_base::gConstructed == 0);
+ struct comparator
+ {
+ comparator() = default;
+
+ bool operator()(const Counter<int>& lhs, const Counter<int>& rhs) const
+ {
+ return lhs < rhs;
+ }
+ };
+ {
+ typedef std::multiset<Counter<int>, std::less<Counter<int>>> first_set_type;
+ typedef std::multiset<Counter<int>, comparator> second_set_type;
+ typedef std::set<Counter<int>, comparator> third_set_type;
+
+ {
+ first_set_type first{1, 2, 3};
+ second_set_type second{2, 3, 4};
+ third_set_type third{1, 3};
+
+ assert(Counter_base::gConstructed == 8);
+
+ first.merge(second);
+ first.merge(third);
+
+ assert(set_equal(first, {1, 1, 2, 2, 3, 3, 3, 4}));
+ assert(set_equal(second, {}));
+ assert(set_equal(third, {}));
+
+ assert(Counter_base::gConstructed == 8);
+ }
+ assert(Counter_base::gConstructed == 0);
+ {
+ first_set_type first{1, 2, 3};
+ second_set_type second{2, 3, 4};
+ third_set_type third{1, 3};
+
+ assert(Counter_base::gConstructed == 8);
+
+ first.merge(std::move(second));
+ first.merge(std::move(third));
+
+ assert(set_equal(first, {1, 1, 2, 2, 3, 3, 3, 4}));
+ assert(set_equal(second, {}));
+ assert(set_equal(third, {}));
+
+ assert(Counter_base::gConstructed == 8);
+ }
+ assert(Counter_base::gConstructed == 0);
+ }
+ {
+ std::multiset<int> first;
+ {
+ std::multiset<int> second;
+ first.merge(second);
+ first.merge(std::move(second));
+ }
+ {
+ std::set<int> second;
+ first.merge(second);
+ first.merge(std::move(second));
+ }
+ }
+}
diff --git a/test/std/containers/associative/multiset/multiset.erasure/erase_if.pass.cpp b/test/std/containers/associative/multiset/multiset.erasure/erase_if.pass.cpp
new file mode 100644
index 0000000000000..3c619bb687f4d
--- /dev/null
+++ b/test/std/containers/associative/multiset/multiset.erasure/erase_if.pass.cpp
@@ -0,0 +1,78 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
+
+// <set>
+
+// template <class T, class Compare, class Allocator, class Predicate>
+// void erase_if(multiset<T, Compare, Allocator>& c, Predicate pred);
+
+#include <set>
+
+#include "test_macros.h"
+#include "test_allocator.h"
+#include "min_allocator.h"
+
+template <class S, class Pred>
+void
+test0(S s, Pred p, S expected)
+{
+ ASSERT_SAME_TYPE(void, decltype(std::erase_if(s, p)));
+ std::erase_if(s, p);
+ assert(s == expected);
+}
+
+template <typename S>
+void test()
+{
+ auto is1 = [](auto v) { return v == 1;};
+ auto is2 = [](auto v) { return v == 2;};
+ auto is3 = [](auto v) { return v == 3;};
+ auto is4 = [](auto v) { return v == 4;};
+ auto True = [](auto) { return true; };
+ auto False = [](auto) { return false; };
+
+ test0(S(), is1, S());
+
+ test0(S({1}), is1, S());
+ test0(S({1}), is2, S({1}));
+
+ test0(S({1,2}), is1, S({2}));
+ test0(S({1,2}), is2, S({1}));
+ test0(S({1,2}), is3, S({1,2}));
+ test0(S({1,1}), is1, S());
+ test0(S({1,1}), is3, S({1,1}));
+
+ test0(S({1,2,3}), is1, S({2,3}));
+ test0(S({1,2,3}), is2, S({1,3}));
+ test0(S({1,2,3}), is3, S({1,2}));
+ test0(S({1,2,3}), is4, S({1,2,3}));
+
+ test0(S({1,1,1}), is1, S());
+ test0(S({1,1,1}), is2, S({1,1,1}));
+ test0(S({1,1,2}), is1, S({2}));
+ test0(S({1,1,2}), is2, S({1,1}));
+ test0(S({1,1,2}), is3, S({1,1,2}));
+ test0(S({1,2,2}), is1, S({2,2}));
+ test0(S({1,2,2}), is2, S({1}));
+ test0(S({1,2,2}), is3, S({1,2,2}));
+
+ test0(S({1,2,3}), True, S());
+ test0(S({1,2,3}), False, S({1,2,3}));
+}
+
+int main()
+{
+ test<std::multiset<int>>();
+ test<std::multiset<int, std::less<int>, min_allocator<int>>> ();
+ test<std::multiset<int, std::less<int>, test_allocator<int>>> ();
+
+ test<std::multiset<long>>();
+ test<std::multiset<double>>();
+}
diff --git a/test/std/containers/associative/set/clear.pass.cpp b/test/std/containers/associative/set/clear.pass.cpp
index 7a5bf4b14a71a..1be3ed2b88773 100644
--- a/test/std/containers/associative/set/clear.pass.cpp
+++ b/test/std/containers/associative/set/clear.pass.cpp
@@ -11,11 +11,12 @@
// class set
-// void clear();
+// void clear() noexcept;
#include <set>
#include <cassert>
+#include "test_macros.h"
#include "min_allocator.h"
int main()
@@ -36,6 +37,7 @@ int main()
};
M m(ar, ar + sizeof(ar)/sizeof(ar[0]));
assert(m.size() == 8);
+ ASSERT_NOEXCEPT(m.clear());
m.clear();
assert(m.size() == 0);
}
@@ -56,6 +58,7 @@ int main()
};
M m(ar, ar + sizeof(ar)/sizeof(ar[0]));
assert(m.size() == 8);
+ ASSERT_NOEXCEPT(m.clear());
m.clear();
assert(m.size() == 0);
}
diff --git a/test/std/containers/associative/set/max_size.pass.cpp b/test/std/containers/associative/set/max_size.pass.cpp
index c894eb51b1ee6..8be84046e1ac4 100644
--- a/test/std/containers/associative/set/max_size.pass.cpp
+++ b/test/std/containers/associative/set/max_size.pass.cpp
@@ -33,16 +33,16 @@ int main()
{
typedef limited_allocator<int, (size_t)-1> A;
typedef std::set<int, std::less<int>, A> C;
- const C::difference_type max_dist =
- std::numeric_limits<C::difference_type>::max();
+ const C::size_type max_dist =
+ static_cast<C::size_type>(std::numeric_limits<C::difference_type>::max());
C c;
assert(c.max_size() <= max_dist);
LIBCPP_ASSERT(c.max_size() == max_dist);
}
{
typedef std::set<char> C;
- const C::difference_type max_dist =
- std::numeric_limits<C::difference_type>::max();
+ const C::size_type max_dist =
+ static_cast<C::size_type>(std::numeric_limits<C::difference_type>::max());
C c;
assert(c.max_size() <= max_dist);
assert(c.max_size() <= alloc_max_size(c.get_allocator()));
diff --git a/test/std/containers/associative/set/merge.pass.cpp b/test/std/containers/associative/set/merge.pass.cpp
new file mode 100644
index 0000000000000..bbae22c77ea53
--- /dev/null
+++ b/test/std/containers/associative/set/merge.pass.cpp
@@ -0,0 +1,149 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++98, c++03, c++11, c++14
+
+// <set>
+
+// class set
+
+// template <class C2>
+// void merge(set<key_type, C2, allocator_type>& source);
+// template <class C2>
+// void merge(set<key_type, C2, allocator_type>&& source);
+// template <class C2>
+// void merge(multiset<key_type, C2, allocator_type>& source);
+// template <class C2>
+// void merge(multiset<key_type, C2, allocator_type>&& source);
+
+#include <set>
+#include <cassert>
+#include "test_macros.h"
+#include "Counter.h"
+
+template <class Set>
+bool set_equal(const Set& set, Set other)
+{
+ return set == other;
+}
+
+#ifndef TEST_HAS_NO_EXCEPTIONS
+struct throw_comparator
+{
+ bool& should_throw_;
+
+ throw_comparator(bool& should_throw) : should_throw_(should_throw) {}
+
+ template <class T>
+ bool operator()(const T& lhs, const T& rhs) const
+ {
+ if (should_throw_)
+ throw 0;
+ return lhs < rhs;
+ }
+};
+#endif
+
+int main()
+{
+ {
+ std::set<int> src{1, 3, 5};
+ std::set<int> dst{2, 4, 5};
+ dst.merge(src);
+ assert(set_equal(src, {5}));
+ assert(set_equal(dst, {1, 2, 3, 4, 5}));
+ }
+
+#ifndef TEST_HAS_NO_EXCEPTIONS
+ {
+ bool do_throw = false;
+ typedef std::set<Counter<int>, throw_comparator> set_type;
+ set_type src({1, 3, 5}, throw_comparator(do_throw));
+ set_type dst({2, 4, 5}, throw_comparator(do_throw));
+
+ assert(Counter_base::gConstructed == 6);
+
+ do_throw = true;
+ try
+ {
+ dst.merge(src);
+ }
+ catch (int)
+ {
+ do_throw = false;
+ }
+ assert(!do_throw);
+ assert(set_equal(src, set_type({1, 3, 5}, throw_comparator(do_throw))));
+ assert(set_equal(dst, set_type({2, 4, 5}, throw_comparator(do_throw))));
+ }
+#endif
+ assert(Counter_base::gConstructed == 0);
+ struct comparator
+ {
+ comparator() = default;
+
+ bool operator()(const Counter<int>& lhs, const Counter<int>& rhs) const
+ {
+ return lhs < rhs;
+ }
+ };
+ {
+ typedef std::set<Counter<int>, std::less<Counter<int>>> first_set_type;
+ typedef std::set<Counter<int>, comparator> second_set_type;
+ typedef std::multiset<Counter<int>, comparator> third_set_type;
+
+ {
+ first_set_type first{1, 2, 3};
+ second_set_type second{2, 3, 4};
+ third_set_type third{1, 3};
+
+ assert(Counter_base::gConstructed == 8);
+
+ first.merge(second);
+ first.merge(third);
+
+ assert(set_equal(first, {1, 2, 3, 4}));
+ assert(set_equal(second, {2, 3}));
+ assert(set_equal(third, {1, 3}));
+
+ assert(Counter_base::gConstructed == 8);
+ }
+ assert(Counter_base::gConstructed == 0);
+ {
+ first_set_type first{1, 2, 3};
+ second_set_type second{2, 3, 4};
+ third_set_type third{1, 3};
+
+ assert(Counter_base::gConstructed == 8);
+
+ first.merge(std::move(second));
+ first.merge(std::move(third));
+
+ assert(set_equal(first, {1, 2, 3, 4}));
+ assert(set_equal(second, {2, 3}));
+ assert(set_equal(third, {1, 3}));
+
+ assert(Counter_base::gConstructed == 8);
+ }
+ assert(Counter_base::gConstructed == 0);
+ }
+ {
+ std::set<int> first;
+ {
+ std::set<int> second;
+ first.merge(second);
+ first.merge(std::move(second));
+ }
+ {
+ std::multiset<int> second;
+ first.merge(second);
+ first.merge(std::move(second));
+ }
+ }
+}
diff --git a/test/std/containers/associative/set/set.erasure/erase_if.pass.cpp b/test/std/containers/associative/set/set.erasure/erase_if.pass.cpp
new file mode 100644
index 0000000000000..a55a38c2d5683
--- /dev/null
+++ b/test/std/containers/associative/set/set.erasure/erase_if.pass.cpp
@@ -0,0 +1,67 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
+
+// <set>
+
+// template <class T, class Compare, class Allocator, class Predicate>
+// void erase_if(set<T, Compare, Allocator>& c, Predicate pred);
+
+#include <set>
+
+#include "test_macros.h"
+#include "test_allocator.h"
+#include "min_allocator.h"
+
+template <class S, class Pred>
+void
+test0(S s, Pred p, S expected)
+{
+ ASSERT_SAME_TYPE(void, decltype(std::erase_if(s, p)));
+ std::erase_if(s, p);
+ assert(s == expected);
+}
+
+template <typename S>
+void test()
+{
+ auto is1 = [](auto v) { return v == 1;};
+ auto is2 = [](auto v) { return v == 2;};
+ auto is3 = [](auto v) { return v == 3;};
+ auto is4 = [](auto v) { return v == 4;};
+ auto True = [](auto) { return true; };
+ auto False = [](auto) { return false; };
+
+ test0(S(), is1, S());
+
+ test0(S({1}), is1, S());
+ test0(S({1}), is2, S({1}));
+
+ test0(S({1,2}), is1, S({2}));
+ test0(S({1,2}), is2, S({1}));
+ test0(S({1,2}), is3, S({1,2}));
+
+ test0(S({1,2,3}), is1, S({2,3}));
+ test0(S({1,2,3}), is2, S({1,3}));
+ test0(S({1,2,3}), is3, S({1,2}));
+ test0(S({1,2,3}), is4, S({1,2,3}));
+
+ test0(S({1,2,3}), True, S());
+ test0(S({1,2,3}), False, S({1,2,3}));
+}
+
+int main()
+{
+ test<std::set<int>>();
+ test<std::set<int, std::less<int>, min_allocator<int>>> ();
+ test<std::set<int, std::less<int>, test_allocator<int>>> ();
+
+ test<std::set<long>>();
+ test<std::set<double>>();
+}
diff --git a/test/std/containers/container.adaptors/queue/queue.defn/emplace.pass.cpp b/test/std/containers/container.adaptors/queue/queue.defn/emplace.pass.cpp
index ead9ad0bcdf82..25f6bc76e1aa8 100644
--- a/test/std/containers/container.adaptors/queue/queue.defn/emplace.pass.cpp
+++ b/test/std/containers/container.adaptors/queue/queue.defn/emplace.pass.cpp
@@ -43,9 +43,9 @@ int main()
test_return_type<std::queue<int> > ();
test_return_type<std::queue<int, std::list<int> > > ();
- typedef Emplaceable T;
std::queue<Emplaceable> q;
#if TEST_STD_VER > 14
+ typedef Emplaceable T;
T& r1 = q.emplace(1, 2.5);
assert(&r1 == &q.back());
T& r2 = q.emplace(2, 3.5);
diff --git a/test/std/containers/container.adaptors/stack/stack.defn/emplace.pass.cpp b/test/std/containers/container.adaptors/stack/stack.defn/emplace.pass.cpp
index bb6ff8f91670b..6830cb716283f 100644
--- a/test/std/containers/container.adaptors/stack/stack.defn/emplace.pass.cpp
+++ b/test/std/containers/container.adaptors/stack/stack.defn/emplace.pass.cpp
@@ -42,9 +42,9 @@ int main()
test_return_type<std::stack<int> > ();
test_return_type<std::stack<int, std::vector<int> > > ();
- typedef Emplaceable T;
std::stack<Emplaceable> q;
#if TEST_STD_VER > 14
+ typedef Emplaceable T;
T& r1 = q.emplace(1, 2.5);
assert(&r1 == &q.top());
T& r2 = q.emplace(2, 3.5);
diff --git a/test/std/containers/container.node/node_handle.pass.cpp b/test/std/containers/container.node/node_handle.pass.cpp
index 6314ec1fb771a..1c815a4682dd6 100644
--- a/test/std/containers/container.node/node_handle.pass.cpp
+++ b/test/std/containers/container.node/node_handle.pass.cpp
@@ -121,10 +121,12 @@ void test_node_handle_operations_multi()
assert(nt2.empty());
}
+template <class> void test_typedef() {}
+
template <class Container>
void test_insert_return_type()
{
- using irt_type = typename Container::insert_return_type;
+ test_typedef<typename Container::insert_return_type>();
}
int main()
diff --git a/test/std/containers/map_allocator_requirement_test_templates.h b/test/std/containers/map_allocator_requirement_test_templates.h
index 2ae3a2e3c87a4..374970d48d186 100644
--- a/test/std/containers/map_allocator_requirement_test_templates.h
+++ b/test/std/containers/map_allocator_requirement_test_templates.h
@@ -33,10 +33,6 @@ template <class Container>
void testMapInsert()
{
typedef typename Container::value_type ValueTp;
- typedef typename Container::key_type Key;
- typedef typename Container::mapped_type Mapped;
- typedef Container C;
- typedef std::pair<typename C::iterator, bool> R;
ConstructController* cc = getConstructController();
cc->reset();
{
@@ -297,8 +293,6 @@ void testMapEmplace()
typedef typename Container::key_type Key;
typedef typename Container::mapped_type Mapped;
typedef typename std::pair<Key, Mapped> NonConstKeyPair;
- typedef Container C;
- typedef std::pair<typename C::iterator, bool> R;
ConstructController* cc = getConstructController();
cc->reset();
{
@@ -630,7 +624,6 @@ template <class Container>
void testMultimapInsert()
{
typedef typename Container::value_type ValueTp;
- typedef Container C;
ConstructController* cc = getConstructController();
cc->reset();
{
@@ -704,7 +697,6 @@ template <class Container>
void testMultimapInsertHint()
{
typedef typename Container::value_type ValueTp;
- typedef Container C;
ConstructController* cc = getConstructController();
cc->reset();
{
diff --git a/test/std/containers/sequences/array/array.data/data.pass.cpp b/test/std/containers/sequences/array/array.data/data.pass.cpp
index 714894308f00a..ba2c571ebacf0 100644
--- a/test/std/containers/sequences/array/array.data/data.pass.cpp
+++ b/test/std/containers/sequences/array/array.data/data.pass.cpp
@@ -13,12 +13,19 @@
#include <array>
#include <cassert>
+#include <cstddef> // for std::max_align_t
+
#include "test_macros.h"
// std::array is explicitly allowed to be initialized with A a = { init-list };.
// Disable the missing braces warning for this reason.
#include "disable_missing_braces_warning.h"
+struct NoDefault {
+ NoDefault(int) {}
+};
+
+
int main()
{
{
@@ -35,7 +42,7 @@ int main()
typedef std::array<T, 0> C;
C c = {};
T* p = c.data();
- assert(p != nullptr);
+ LIBCPP_ASSERT(p != nullptr);
}
{
typedef double T;
@@ -43,25 +50,22 @@ int main()
C c = {{}};
const T* p = c.data();
static_assert((std::is_same<decltype(c.data()), const T*>::value), "");
- assert(p != nullptr);
+ LIBCPP_ASSERT(p != nullptr);
}
{
typedef std::max_align_t T;
typedef std::array<T, 0> C;
const C c = {};
const T* p = c.data();
- assert(p != nullptr);
+ LIBCPP_ASSERT(p != nullptr);
std::uintptr_t pint = reinterpret_cast<std::uintptr_t>(p);
assert(pint % TEST_ALIGNOF(std::max_align_t) == 0);
}
{
- struct NoDefault {
- NoDefault(int) {}
- };
typedef NoDefault T;
typedef std::array<T, 0> C;
C c = {};
T* p = c.data();
- assert(p != nullptr);
+ LIBCPP_ASSERT(p != nullptr);
}
}
diff --git a/test/std/containers/sequences/array/array.data/data_const.pass.cpp b/test/std/containers/sequences/array/array.data/data_const.pass.cpp
index b99bf6af8627e..f46352564973f 100644
--- a/test/std/containers/sequences/array/array.data/data_const.pass.cpp
+++ b/test/std/containers/sequences/array/array.data/data_const.pass.cpp
@@ -13,6 +13,7 @@
#include <array>
#include <cassert>
+#include <cstddef> // for std::max_align_t
#include "test_macros.h"
@@ -20,6 +21,10 @@
// Disable the missing braces warning for this reason.
#include "disable_missing_braces_warning.h"
+struct NoDefault {
+ NoDefault(int) {}
+};
+
int main()
{
{
@@ -39,21 +44,18 @@ int main()
(void)p; // to placate scan-build
}
{
- struct NoDefault {
- NoDefault(int) {}
- };
typedef NoDefault T;
typedef std::array<T, 0> C;
const C c = {};
const T* p = c.data();
- assert(p != nullptr);
+ LIBCPP_ASSERT(p != nullptr);
}
{
typedef std::max_align_t T;
typedef std::array<T, 0> C;
const C c = {};
const T* p = c.data();
- assert(p != nullptr);
+ LIBCPP_ASSERT(p != nullptr);
std::uintptr_t pint = reinterpret_cast<std::uintptr_t>(p);
assert(pint % TEST_ALIGNOF(std::max_align_t) == 0);
}
diff --git a/test/std/containers/sequences/array/array.tuple/get.fail.cpp b/test/std/containers/sequences/array/array.tuple/get.fail.cpp
index 45e1d2b46b0f3..a7e56fccef019 100644
--- a/test/std/containers/sequences/array/array.tuple/get.fail.cpp
+++ b/test/std/containers/sequences/array/array.tuple/get.fail.cpp
@@ -31,6 +31,6 @@ int main()
typedef std::array<T, 3> C;
C c = {1, 2, 3.5};
std::get<3>(c) = 5.5; // expected-note {{requested here}}
- // expected-error@array:* {{static_assert failed "Index out of bounds in std::get<> (std::array)"}}
+ // expected-error-re@array:* {{static_assert failed{{( due to requirement '3U[L]{0,2} < 3U[L]{0,2}')?}} "Index out of bounds in std::get<> (std::array)"}}
}
}
diff --git a/test/std/containers/sequences/array/array.tuple/tuple_element.fail.cpp b/test/std/containers/sequences/array/array.tuple/tuple_element.fail.cpp
index c9fe695f9cbd2..2139fc1ad486d 100644
--- a/test/std/containers/sequences/array/array.tuple/tuple_element.fail.cpp
+++ b/test/std/containers/sequences/array/array.tuple/tuple_element.fail.cpp
@@ -30,6 +30,6 @@ int main()
typedef double T;
typedef std::array<T, 3> C;
std::tuple_element<3, C> foo; // expected-note {{requested here}}
- // expected-error@array:* {{static_assert failed "Index out of bounds in std::tuple_element<> (std::array)"}}
+ // expected-error-re@array:* {{static_assert failed{{( due to requirement '3U[L]{0,2} < 3U[L]{0,2}')?}} "Index out of bounds in std::tuple_element<> (std::array)"}}
}
}
diff --git a/test/std/containers/sequences/array/begin.pass.cpp b/test/std/containers/sequences/array/begin.pass.cpp
index 282a947fefeca..37c6b5eecde24 100644
--- a/test/std/containers/sequences/array/begin.pass.cpp
+++ b/test/std/containers/sequences/array/begin.pass.cpp
@@ -14,10 +14,16 @@
#include <array>
#include <cassert>
+#include "test_macros.h"
+
// std::array is explicitly allowed to be initialized with A a = { init-list };.
// Disable the missing braces warning for this reason.
#include "disable_missing_braces_warning.h"
+struct NoDefault {
+ NoDefault(int) {}
+};
+
int main()
{
@@ -33,12 +39,14 @@ int main()
assert(c[0] == 5.5);
}
{
- struct NoDefault {
- NoDefault(int) {}
- };
typedef NoDefault T;
typedef std::array<T, 0> C;
C c = {};
- assert(c.begin() == c.end());
+ C::iterator ib, ie;
+ ib = c.begin();
+ ie = c.end();
+ assert(ib == ie);
+ LIBCPP_ASSERT(ib != nullptr);
+ LIBCPP_ASSERT(ie != nullptr);
}
}
diff --git a/test/std/containers/sequences/array/compare.pass.cpp b/test/std/containers/sequences/array/compare.pass.cpp
index c8bcf75a0934a..5d2bdc50f2617 100644
--- a/test/std/containers/sequences/array/compare.pass.cpp
+++ b/test/std/containers/sequences/array/compare.pass.cpp
@@ -9,6 +9,7 @@
// <array>
+// These are all constexpr in C++20
// bool operator==(array<T, N> const&, array<T, N> const&);
// bool operator!=(array<T, N> const&, array<T, N> const&);
// bool operator<(array<T, N> const&, array<T, N> const&);
@@ -22,24 +23,12 @@
#include <cassert>
#include "test_macros.h"
+#include "test_comparisons.h"
// std::array is explicitly allowed to be initialized with A a = { init-list };.
// Disable the missing braces warning for this reason.
#include "disable_missing_braces_warning.h"
-template <class Array>
-void test_compare(const Array& LHS, const Array& RHS) {
- typedef std::vector<typename Array::value_type> Vector;
- const Vector LHSV(LHS.begin(), LHS.end());
- const Vector RHSV(RHS.begin(), RHS.end());
- assert((LHS == RHS) == (LHSV == RHSV));
- assert((LHS != RHS) == (LHSV != RHSV));
- assert((LHS < RHS) == (LHSV < RHSV));
- assert((LHS <= RHS) == (LHSV <= RHSV));
- assert((LHS > RHS) == (LHSV > RHSV));
- assert((LHS >= RHS) == (LHSV >= RHSV));
-}
-
int main()
{
{
@@ -49,15 +38,25 @@ int main()
C c2 = {1, 2, 3};
C c3 = {3, 2, 1};
C c4 = {1, 2, 1};
- test_compare(c1, c2);
- test_compare(c1, c3);
- test_compare(c1, c4);
+ assert(testComparisons6(c1, c2, true, false));
+ assert(testComparisons6(c1, c3, false, true));
+ assert(testComparisons6(c1, c4, false, false));
}
{
typedef int T;
typedef std::array<T, 0> C;
C c1 = {};
C c2 = {};
- test_compare(c1, c2);
+ assert(testComparisons6(c1, c2, true, false));
+ }
+
+#if TEST_STD_VER > 17
+ {
+ constexpr std::array<int, 3> a1 = {1, 2, 3};
+ constexpr std::array<int, 3> a2 = {2, 3, 4};
+ static_assert(testComparisons6(a1, a1, true, false), "");
+ static_assert(testComparisons6(a1, a2, false, true), "");
+ static_assert(testComparisons6(a2, a1, false, false), "");
}
+#endif
}
diff --git a/test/std/containers/sequences/array/size_and_alignment.pass.cpp b/test/std/containers/sequences/array/size_and_alignment.pass.cpp
index 966d063fe17a6..d73182bd5cace 100644
--- a/test/std/containers/sequences/array/size_and_alignment.pass.cpp
+++ b/test/std/containers/sequences/array/size_and_alignment.pass.cpp
@@ -58,8 +58,6 @@ struct TEST_ALIGNAS(TEST_ALIGNOF(std::max_align_t) * 2) TestType2 {
char data[1000];
};
-//static_assert(sizeof(void*) == 4, "");
-
int main() {
test_type<char>();
test_type<int>();
diff --git a/test/std/containers/sequences/deque/deque.capacity/max_size.pass.cpp b/test/std/containers/sequences/deque/deque.capacity/max_size.pass.cpp
index 11ce9d2f6899c..2365d4e11b024 100644
--- a/test/std/containers/sequences/deque/deque.capacity/max_size.pass.cpp
+++ b/test/std/containers/sequences/deque/deque.capacity/max_size.pass.cpp
@@ -30,16 +30,16 @@ int main() {
{
typedef limited_allocator<int, (size_t)-1> A;
typedef std::deque<int, A> C;
- const C::difference_type max_dist =
- std::numeric_limits<C::difference_type>::max();
+ const C::size_type max_dist =
+ static_cast<C::size_type>(std::numeric_limits<C::difference_type>::max());
C c;
assert(c.max_size() <= max_dist);
LIBCPP_ASSERT(c.max_size() == max_dist);
}
{
typedef std::deque<char> C;
- const C::difference_type max_dist =
- std::numeric_limits<C::difference_type>::max();
+ const C::size_type max_dist =
+ static_cast<C::size_type>(std::numeric_limits<C::difference_type>::max());
C c;
assert(c.max_size() <= max_dist);
assert(c.max_size() <= alloc_max_size(c.get_allocator()));
diff --git a/test/std/containers/sequences/deque/deque.erasure/erase.pass.cpp b/test/std/containers/sequences/deque/deque.erasure/erase.pass.cpp
new file mode 100644
index 0000000000000..9a8c698a5ffb9
--- /dev/null
+++ b/test/std/containers/sequences/deque/deque.erasure/erase.pass.cpp
@@ -0,0 +1,78 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
+
+// <deque>
+
+// template <class T, class Allocator, class U>
+// void erase(deque<T, Allocator>& c, const U& value);
+
+
+#include <deque>
+#include <optional>
+
+#include "test_macros.h"
+#include "test_allocator.h"
+#include "min_allocator.h"
+
+template <class S, class U>
+void
+test0(S s, U val, S expected)
+{
+ ASSERT_SAME_TYPE(void, decltype(std::erase(s, val)));
+ std::erase(s, val);
+ assert(s == expected);
+}
+
+template <class S>
+void test()
+{
+
+ test0(S(), 1, S());
+
+ test0(S({1}), 1, S());
+ test0(S({1}), 2, S({1}));
+
+ test0(S({1,2}), 1, S({2}));
+ test0(S({1,2}), 2, S({1}));
+ test0(S({1,2}), 3, S({1,2}));
+ test0(S({1,1}), 1, S());
+ test0(S({1,1}), 3, S({1,1}));
+
+ test0(S({1,2,3}), 1, S({2,3}));
+ test0(S({1,2,3}), 2, S({1,3}));
+ test0(S({1,2,3}), 3, S({1,2}));
+ test0(S({1,2,3}), 4, S({1,2,3}));
+
+ test0(S({1,1,1}), 1, S());
+ test0(S({1,1,1}), 2, S({1,1,1}));
+ test0(S({1,1,2}), 1, S({2}));
+ test0(S({1,1,2}), 2, S({1,1}));
+ test0(S({1,1,2}), 3, S({1,1,2}));
+ test0(S({1,2,2}), 1, S({2,2}));
+ test0(S({1,2,2}), 2, S({1}));
+ test0(S({1,2,2}), 3, S({1,2,2}));
+
+// Test cross-type erasure
+ using opt = std::optional<typename S::value_type>;
+ test0(S({1,2,1}), opt(), S({1,2,1}));
+ test0(S({1,2,1}), opt(1), S({2}));
+ test0(S({1,2,1}), opt(2), S({1,1}));
+ test0(S({1,2,1}), opt(3), S({1,2,1}));
+}
+
+int main()
+{
+ test<std::deque<int>>();
+ test<std::deque<int, min_allocator<int>>> ();
+ test<std::deque<int, test_allocator<int>>> ();
+
+ test<std::deque<long>>();
+ test<std::deque<double>>();
+}
diff --git a/test/std/containers/sequences/deque/deque.erasure/erase_if.pass.cpp b/test/std/containers/sequences/deque/deque.erasure/erase_if.pass.cpp
new file mode 100644
index 0000000000000..a090eb6947d00
--- /dev/null
+++ b/test/std/containers/sequences/deque/deque.erasure/erase_if.pass.cpp
@@ -0,0 +1,78 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
+
+// <deque>
+
+// template <class T, class Allocator, class Predicate>
+// void erase_if(deque<T, Allocator>& c, Predicate pred);
+
+#include <deque>
+
+#include "test_macros.h"
+#include "test_allocator.h"
+#include "min_allocator.h"
+
+template <class S, class Pred>
+void
+test0(S s, Pred p, S expected)
+{
+ ASSERT_SAME_TYPE(void, decltype(std::erase_if(s, p)));
+ std::erase_if(s, p);
+ assert(s == expected);
+}
+
+template <typename S>
+void test()
+{
+ auto is1 = [](auto v) { return v == 1;};
+ auto is2 = [](auto v) { return v == 2;};
+ auto is3 = [](auto v) { return v == 3;};
+ auto is4 = [](auto v) { return v == 4;};
+ auto True = [](auto) { return true; };
+ auto False = [](auto) { return false; };
+
+ test0(S(), is1, S());
+
+ test0(S({1}), is1, S());
+ test0(S({1}), is2, S({1}));
+
+ test0(S({1,2}), is1, S({2}));
+ test0(S({1,2}), is2, S({1}));
+ test0(S({1,2}), is3, S({1,2}));
+ test0(S({1,1}), is1, S());
+ test0(S({1,1}), is3, S({1,1}));
+
+ test0(S({1,2,3}), is1, S({2,3}));
+ test0(S({1,2,3}), is2, S({1,3}));
+ test0(S({1,2,3}), is3, S({1,2}));
+ test0(S({1,2,3}), is4, S({1,2,3}));
+
+ test0(S({1,1,1}), is1, S());
+ test0(S({1,1,1}), is2, S({1,1,1}));
+ test0(S({1,1,2}), is1, S({2}));
+ test0(S({1,1,2}), is2, S({1,1}));
+ test0(S({1,1,2}), is3, S({1,1,2}));
+ test0(S({1,2,2}), is1, S({2,2}));
+ test0(S({1,2,2}), is2, S({1}));
+ test0(S({1,2,2}), is3, S({1,2,2}));
+
+ test0(S({1,2,3}), True, S());
+ test0(S({1,2,3}), False, S({1,2,3}));
+}
+
+int main()
+{
+ test<std::deque<int>>();
+ test<std::deque<int, min_allocator<int>>> ();
+ test<std::deque<int, test_allocator<int>>> ();
+
+ test<std::deque<long>>();
+ test<std::deque<double>>();
+}
diff --git a/test/std/containers/sequences/deque/deque.modifiers/clear.pass.cpp b/test/std/containers/sequences/deque/deque.modifiers/clear.pass.cpp
new file mode 100644
index 0000000000000..943b6e8e11cae
--- /dev/null
+++ b/test/std/containers/sequences/deque/deque.modifiers/clear.pass.cpp
@@ -0,0 +1,67 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <deque>
+
+// void clear() noexcept;
+
+#include <deque>
+#include <cassert>
+
+#include "test_macros.h"
+#include "../../../NotConstructible.h"
+#include "min_allocator.h"
+
+int main()
+{
+ {
+ typedef NotConstructible T;
+ typedef std::deque<T> C;
+ C c;
+ ASSERT_NOEXCEPT(c.clear());
+ c.clear();
+ assert(distance(c.begin(), c.end()) == 0);
+ }
+ {
+ typedef int T;
+ typedef std::deque<T> C;
+ const T t[] = {0, 1, 2, 3, 4};
+ C c(std::begin(t), std::end(t));
+
+ ASSERT_NOEXCEPT(c.clear());
+ c.clear();
+ assert(distance(c.begin(), c.end()) == 0);
+
+ c.clear();
+ assert(distance(c.begin(), c.end()) == 0);
+ }
+#if TEST_STD_VER >= 11
+ {
+ typedef NotConstructible T;
+ typedef std::deque<T, min_allocator<T>> C;
+ C c;
+ ASSERT_NOEXCEPT(c.clear());
+ c.clear();
+ assert(distance(c.begin(), c.end()) == 0);
+ }
+ {
+ typedef int T;
+ typedef std::deque<T, min_allocator<T>> C;
+ const T t[] = {0, 1, 2, 3, 4};
+ C c(std::begin(t), std::end(t));
+
+ ASSERT_NOEXCEPT(c.clear());
+ c.clear();
+ assert(distance(c.begin(), c.end()) == 0);
+
+ c.clear();
+ assert(distance(c.begin(), c.end()) == 0);
+ }
+#endif
+}
diff --git a/test/std/containers/sequences/deque/deque.modifiers/erase_iter.pass.cpp b/test/std/containers/sequences/deque/deque.modifiers/erase_iter.pass.cpp
index def032c2705ac..3ed17ab3f78c9 100644
--- a/test/std/containers/sequences/deque/deque.modifiers/erase_iter.pass.cpp
+++ b/test/std/containers/sequences/deque/deque.modifiers/erase_iter.pass.cpp
@@ -18,6 +18,23 @@
#include <cstddef>
#include "min_allocator.h"
+#include "test_macros.h"
+
+#ifndef TEST_HAS_NO_EXCEPTIONS
+struct Throws {
+ Throws() : v_(0) {}
+ Throws(int v) : v_(v) {}
+ Throws(const Throws &rhs) : v_(rhs.v_) { if (sThrows) throw 1; }
+ Throws( Throws &&rhs) : v_(rhs.v_) { if (sThrows) throw 1; }
+ Throws& operator=(const Throws &rhs) { v_ = rhs.v_; return *this; }
+ Throws& operator=( Throws &&rhs) { v_ = rhs.v_; return *this; }
+ int v_;
+
+ static bool sThrows;
+ };
+
+bool Throws::sThrows = false;
+#endif
template <class C>
C
@@ -90,4 +107,19 @@ int main()
testN<std::deque<int, min_allocator<int>> >(rng[i], rng[j]);
}
#endif
+
+#ifndef TEST_HAS_NO_EXCEPTIONS
+// Test for LWG2953:
+// Throws: Nothing unless an exception is thrown by the assignment operator of T.
+// (which includes move assignment)
+ {
+ Throws arr[] = {1, 2, 3};
+ std::deque<Throws> v(arr, arr+3);
+ Throws::sThrows = true;
+ v.erase(v.begin());
+ v.erase(--v.end());
+ v.erase(v.begin());
+ assert(v.size() == 0);
+ }
+#endif
}
diff --git a/test/std/containers/sequences/deque/deque.modifiers/erase_iter_iter.pass.cpp b/test/std/containers/sequences/deque/deque.modifiers/erase_iter_iter.pass.cpp
index 338c66d81f97a..6556ced1a65a6 100644
--- a/test/std/containers/sequences/deque/deque.modifiers/erase_iter_iter.pass.cpp
+++ b/test/std/containers/sequences/deque/deque.modifiers/erase_iter_iter.pass.cpp
@@ -20,6 +20,24 @@
#include <cstddef>
#include "min_allocator.h"
+#include "test_macros.h"
+
+#ifndef TEST_HAS_NO_EXCEPTIONS
+struct Throws {
+ Throws() : v_(0) {}
+ Throws(int v) : v_(v) {}
+ Throws(const Throws &rhs) : v_(rhs.v_) { if (sThrows) throw 1; }
+ Throws( Throws &&rhs) : v_(rhs.v_) { if (sThrows) throw 1; }
+ Throws& operator=(const Throws &rhs) { v_ = rhs.v_; return *this; }
+ Throws& operator=( Throws &&rhs) { v_ = rhs.v_; return *this; }
+ int v_;
+
+ static bool sThrows;
+ };
+
+bool Throws::sThrows = false;
+#endif
+
template <class C>
C
@@ -96,4 +114,18 @@ int main()
testN<std::deque<int, min_allocator<int>> >(rng[i], rng[j]);
}
#endif
+#ifndef TEST_HAS_NO_EXCEPTIONS
+// Test for LWG2953:
+// Throws: Nothing unless an exception is thrown by the assignment operator of T.
+// (which includes move assignment)
+ {
+ Throws arr[] = {1, 2, 3};
+ std::deque<Throws> v(arr, arr+3);
+ Throws::sThrows = true;
+ v.erase(v.begin(), --v.end());
+ assert(v.size() == 1);
+ v.erase(v.begin(), v.end());
+ assert(v.size() == 0);
+ }
+#endif
}
diff --git a/test/std/containers/sequences/forwardlist/forwardlist.erasure/erase.pass.cpp b/test/std/containers/sequences/forwardlist/forwardlist.erasure/erase.pass.cpp
new file mode 100644
index 0000000000000..0163b8607cb28
--- /dev/null
+++ b/test/std/containers/sequences/forwardlist/forwardlist.erasure/erase.pass.cpp
@@ -0,0 +1,78 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
+
+// <forward_list>
+
+// template <class T, class Allocator, class U>
+// void erase(forward_list<T, Allocator>& c, const U& value);
+
+
+#include <forward_list>
+#include <optional>
+
+#include "test_macros.h"
+#include "test_allocator.h"
+#include "min_allocator.h"
+
+template <class S, class U>
+void
+test0(S s, U val, S expected)
+{
+ ASSERT_SAME_TYPE(void, decltype(std::erase(s, val)));
+ std::erase(s, val);
+ assert(s == expected);
+}
+
+template <class S>
+void test()
+{
+
+ test0(S(), 1, S());
+
+ test0(S({1}), 1, S());
+ test0(S({1}), 2, S({1}));
+
+ test0(S({1,2}), 1, S({2}));
+ test0(S({1,2}), 2, S({1}));
+ test0(S({1,2}), 3, S({1,2}));
+ test0(S({1,1}), 1, S());
+ test0(S({1,1}), 3, S({1,1}));
+
+ test0(S({1,2,3}), 1, S({2,3}));
+ test0(S({1,2,3}), 2, S({1,3}));
+ test0(S({1,2,3}), 3, S({1,2}));
+ test0(S({1,2,3}), 4, S({1,2,3}));
+
+ test0(S({1,1,1}), 1, S());
+ test0(S({1,1,1}), 2, S({1,1,1}));
+ test0(S({1,1,2}), 1, S({2}));
+ test0(S({1,1,2}), 2, S({1,1}));
+ test0(S({1,1,2}), 3, S({1,1,2}));
+ test0(S({1,2,2}), 1, S({2,2}));
+ test0(S({1,2,2}), 2, S({1}));
+ test0(S({1,2,2}), 3, S({1,2,2}));
+
+// Test cross-type erasure
+ using opt = std::optional<typename S::value_type>;
+ test0(S({1,2,1}), opt(), S({1,2,1}));
+ test0(S({1,2,1}), opt(1), S({2}));
+ test0(S({1,2,1}), opt(2), S({1,1}));
+ test0(S({1,2,1}), opt(3), S({1,2,1}));
+}
+
+int main()
+{
+ test<std::forward_list<int>>();
+ test<std::forward_list<int, min_allocator<int>>> ();
+ test<std::forward_list<int, test_allocator<int>>> ();
+
+ test<std::forward_list<long>>();
+ test<std::forward_list<double>>();
+}
diff --git a/test/std/containers/sequences/forwardlist/forwardlist.erasure/erase_if.pass.cpp b/test/std/containers/sequences/forwardlist/forwardlist.erasure/erase_if.pass.cpp
new file mode 100644
index 0000000000000..69685d2d35f24
--- /dev/null
+++ b/test/std/containers/sequences/forwardlist/forwardlist.erasure/erase_if.pass.cpp
@@ -0,0 +1,78 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
+
+// <forward_list>
+
+// template <class T, class Allocator, class Predicate>
+// void erase_if(forward_list<T, Allocator>& c, Predicate pred);
+
+#include <forward_list>
+
+#include "test_macros.h"
+#include "test_allocator.h"
+#include "min_allocator.h"
+
+template <class S, class Pred>
+void
+test0(S s, Pred p, S expected)
+{
+ ASSERT_SAME_TYPE(void, decltype(std::erase_if(s, p)));
+ std::erase_if(s, p);
+ assert(s == expected);
+}
+
+template <typename S>
+void test()
+{
+ auto is1 = [](auto v) { return v == 1;};
+ auto is2 = [](auto v) { return v == 2;};
+ auto is3 = [](auto v) { return v == 3;};
+ auto is4 = [](auto v) { return v == 4;};
+ auto True = [](auto) { return true; };
+ auto False = [](auto) { return false; };
+
+ test0(S(), is1, S());
+
+ test0(S({1}), is1, S());
+ test0(S({1}), is2, S({1}));
+
+ test0(S({1,2}), is1, S({2}));
+ test0(S({1,2}), is2, S({1}));
+ test0(S({1,2}), is3, S({1,2}));
+ test0(S({1,1}), is1, S());
+ test0(S({1,1}), is3, S({1,1}));
+
+ test0(S({1,2,3}), is1, S({2,3}));
+ test0(S({1,2,3}), is2, S({1,3}));
+ test0(S({1,2,3}), is3, S({1,2}));
+ test0(S({1,2,3}), is4, S({1,2,3}));
+
+ test0(S({1,1,1}), is1, S());
+ test0(S({1,1,1}), is2, S({1,1,1}));
+ test0(S({1,1,2}), is1, S({2}));
+ test0(S({1,1,2}), is2, S({1,1}));
+ test0(S({1,1,2}), is3, S({1,1,2}));
+ test0(S({1,2,2}), is1, S({2,2}));
+ test0(S({1,2,2}), is2, S({1}));
+ test0(S({1,2,2}), is3, S({1,2,2}));
+
+ test0(S({1,2,3}), True, S());
+ test0(S({1,2,3}), False, S({1,2,3}));
+}
+
+int main()
+{
+ test<std::forward_list<int>>();
+ test<std::forward_list<int, min_allocator<int>>> ();
+ test<std::forward_list<int, test_allocator<int>>> ();
+
+ test<std::forward_list<long>>();
+ test<std::forward_list<double>>();
+}
diff --git a/test/std/containers/sequences/forwardlist/forwardlist.modifiers/clear.pass.cpp b/test/std/containers/sequences/forwardlist/forwardlist.modifiers/clear.pass.cpp
index 0e625ac76a02c..6cdf8d57ace35 100644
--- a/test/std/containers/sequences/forwardlist/forwardlist.modifiers/clear.pass.cpp
+++ b/test/std/containers/sequences/forwardlist/forwardlist.modifiers/clear.pass.cpp
@@ -9,11 +9,12 @@
// <forward_list>
-// void clear();
+// void clear() noexcept;
#include <forward_list>
#include <cassert>
+#include "test_macros.h"
#include "../../../NotConstructible.h"
#include "min_allocator.h"
@@ -23,6 +24,7 @@ int main()
typedef NotConstructible T;
typedef std::forward_list<T> C;
C c;
+ ASSERT_NOEXCEPT(c.clear());
c.clear();
assert(distance(c.begin(), c.end()) == 0);
}
@@ -32,6 +34,7 @@ int main()
const T t[] = {0, 1, 2, 3, 4};
C c(std::begin(t), std::end(t));
+ ASSERT_NOEXCEPT(c.clear());
c.clear();
assert(distance(c.begin(), c.end()) == 0);
@@ -43,6 +46,7 @@ int main()
typedef NotConstructible T;
typedef std::forward_list<T, min_allocator<T>> C;
C c;
+ ASSERT_NOEXCEPT(c.clear());
c.clear();
assert(distance(c.begin(), c.end()) == 0);
}
@@ -52,6 +56,7 @@ int main()
const T t[] = {0, 1, 2, 3, 4};
C c(std::begin(t), std::end(t));
+ ASSERT_NOEXCEPT(c.clear());
c.clear();
assert(distance(c.begin(), c.end()) == 0);
diff --git a/test/std/containers/sequences/forwardlist/forwardlist.modifiers/resize_size_value.pass.cpp b/test/std/containers/sequences/forwardlist/forwardlist.modifiers/resize_size_value.pass.cpp
index 356e0d657c351..297e2725a158b 100644
--- a/test/std/containers/sequences/forwardlist/forwardlist.modifiers/resize_size_value.pass.cpp
+++ b/test/std/containers/sequences/forwardlist/forwardlist.modifiers/resize_size_value.pass.cpp
@@ -88,7 +88,6 @@ int main()
{
// Test that the allocator's construct method is being used to
// construct the new elements and that it's called exactly N times.
- typedef int T;
typedef std::forward_list<int, ContainerTestAllocator<int, int>> Container;
ConstructController* cc = getConstructController();
cc->reset();
diff --git a/test/std/containers/sequences/forwardlist/max_size.pass.cpp b/test/std/containers/sequences/forwardlist/max_size.pass.cpp
index 916d12a9f67c9..dc35ac5f5da5d 100644
--- a/test/std/containers/sequences/forwardlist/max_size.pass.cpp
+++ b/test/std/containers/sequences/forwardlist/max_size.pass.cpp
@@ -31,16 +31,16 @@ int main()
{
typedef limited_allocator<int, (size_t)-1> A;
typedef std::forward_list<int, A> C;
- const C::difference_type max_dist =
- std::numeric_limits<C::difference_type>::max();
+ const C::size_type max_dist =
+ static_cast<C::size_type>(std::numeric_limits<C::difference_type>::max());
C c;
assert(c.max_size() <= max_dist);
LIBCPP_ASSERT(c.max_size() == max_dist);
}
{
typedef std::forward_list<char> C;
- const C::difference_type max_dist =
- std::numeric_limits<C::difference_type>::max();
+ const C::size_type max_dist =
+ static_cast<C::size_type>(std::numeric_limits<C::difference_type>::max());
C c;
assert(c.max_size() <= max_dist);
assert(c.max_size() <= alloc_max_size(c.get_allocator()));
diff --git a/test/std/containers/sequences/list/list.capacity/max_size.pass.cpp b/test/std/containers/sequences/list/list.capacity/max_size.pass.cpp
index bd1b65e63d705..e8a48a2db747f 100644
--- a/test/std/containers/sequences/list/list.capacity/max_size.pass.cpp
+++ b/test/std/containers/sequences/list/list.capacity/max_size.pass.cpp
@@ -30,16 +30,16 @@ int main() {
{
typedef limited_allocator<int, (size_t)-1> A;
typedef std::list<int, A> C;
- const C::difference_type max_dist =
- std::numeric_limits<C::difference_type>::max();
+ const C::size_type max_dist =
+ static_cast<C::size_type>(std::numeric_limits<C::difference_type>::max());
C c;
assert(c.max_size() <= max_dist);
LIBCPP_ASSERT(c.max_size() == max_dist);
}
{
typedef std::list<char> C;
- const C::difference_type max_dist =
- std::numeric_limits<C::difference_type>::max();
+ const C::size_type max_dist =
+ static_cast<C::size_type>(std::numeric_limits<C::difference_type>::max());
C c;
assert(c.max_size() <= max_dist);
assert(c.max_size() <= alloc_max_size(c.get_allocator()));
diff --git a/test/std/containers/sequences/list/list.cons/input_iterator.pass.cpp b/test/std/containers/sequences/list/list.cons/input_iterator.pass.cpp
index 3cdcc73627b87..d2c7fa023eb84 100644
--- a/test/std/containers/sequences/list/list.cons/input_iterator.pass.cpp
+++ b/test/std/containers/sequences/list/list.cons/input_iterator.pass.cpp
@@ -183,7 +183,6 @@ void test_ctor_under_alloc() {
int arr2[] = {1, 101, 42};
{
using C = TCT::list<>;
- using T = typename C::value_type;
using It = forward_iterator<int*>;
{
ExpectConstructGuard<int&> G(1);
@@ -196,7 +195,6 @@ void test_ctor_under_alloc() {
}
{
using C = TCT::list<>;
- using T = typename C::value_type;
using It = input_iterator<int*>;
{
ExpectConstructGuard<int&> G(1);
@@ -216,7 +214,6 @@ void test_ctor_under_alloc_with_alloc() {
int arr2[] = {1, 101, 42};
{
using C = TCT::list<>;
- using T = typename C::value_type;
using It = forward_iterator<int*>;
using Alloc = typename C::allocator_type;
Alloc a;
@@ -231,7 +228,6 @@ void test_ctor_under_alloc_with_alloc() {
}
{
using C = TCT::list<>;
- using T = typename C::value_type;
using It = input_iterator<int*>;
using Alloc = typename C::allocator_type;
Alloc a;
diff --git a/test/std/containers/sequences/list/list.erasure/erase.pass.cpp b/test/std/containers/sequences/list/list.erasure/erase.pass.cpp
new file mode 100644
index 0000000000000..a9f65c0537eb3
--- /dev/null
+++ b/test/std/containers/sequences/list/list.erasure/erase.pass.cpp
@@ -0,0 +1,78 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
+
+// <list>
+
+// template <class T, class Allocator, class U>
+// void erase(list<T, Allocator>& c, const U& value);
+
+
+#include <list>
+#include <optional>
+
+#include "test_macros.h"
+#include "test_allocator.h"
+#include "min_allocator.h"
+
+template <class S, class U>
+void
+test0(S s, U val, S expected)
+{
+ ASSERT_SAME_TYPE(void, decltype(std::erase(s, val)));
+ std::erase(s, val);
+ assert(s == expected);
+}
+
+template <class S>
+void test()
+{
+
+ test0(S(), 1, S());
+
+ test0(S({1}), 1, S());
+ test0(S({1}), 2, S({1}));
+
+ test0(S({1,2}), 1, S({2}));
+ test0(S({1,2}), 2, S({1}));
+ test0(S({1,2}), 3, S({1,2}));
+ test0(S({1,1}), 1, S());
+ test0(S({1,1}), 3, S({1,1}));
+
+ test0(S({1,2,3}), 1, S({2,3}));
+ test0(S({1,2,3}), 2, S({1,3}));
+ test0(S({1,2,3}), 3, S({1,2}));
+ test0(S({1,2,3}), 4, S({1,2,3}));
+
+ test0(S({1,1,1}), 1, S());
+ test0(S({1,1,1}), 2, S({1,1,1}));
+ test0(S({1,1,2}), 1, S({2}));
+ test0(S({1,1,2}), 2, S({1,1}));
+ test0(S({1,1,2}), 3, S({1,1,2}));
+ test0(S({1,2,2}), 1, S({2,2}));
+ test0(S({1,2,2}), 2, S({1}));
+ test0(S({1,2,2}), 3, S({1,2,2}));
+
+// Test cross-type erasure
+ using opt = std::optional<typename S::value_type>;
+ test0(S({1,2,1}), opt(), S({1,2,1}));
+ test0(S({1,2,1}), opt(1), S({2}));
+ test0(S({1,2,1}), opt(2), S({1,1}));
+ test0(S({1,2,1}), opt(3), S({1,2,1}));
+}
+
+int main()
+{
+ test<std::list<int>>();
+ test<std::list<int, min_allocator<int>>> ();
+ test<std::list<int, test_allocator<int>>> ();
+
+ test<std::list<long>>();
+ test<std::list<double>>();
+}
diff --git a/test/std/containers/sequences/list/list.erasure/erase_if.pass.cpp b/test/std/containers/sequences/list/list.erasure/erase_if.pass.cpp
new file mode 100644
index 0000000000000..99b1c6530f962
--- /dev/null
+++ b/test/std/containers/sequences/list/list.erasure/erase_if.pass.cpp
@@ -0,0 +1,78 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
+
+// <list>
+
+// template <class T, class Allocator, class Predicate>
+// void erase_if(list<T, Allocator>& c, Predicate pred);
+
+#include <list>
+
+#include "test_macros.h"
+#include "test_allocator.h"
+#include "min_allocator.h"
+
+template <class S, class Pred>
+void
+test0(S s, Pred p, S expected)
+{
+ ASSERT_SAME_TYPE(void, decltype(std::erase_if(s, p)));
+ std::erase_if(s, p);
+ assert(s == expected);
+}
+
+template <typename S>
+void test()
+{
+ auto is1 = [](auto v) { return v == 1;};
+ auto is2 = [](auto v) { return v == 2;};
+ auto is3 = [](auto v) { return v == 3;};
+ auto is4 = [](auto v) { return v == 4;};
+ auto True = [](auto) { return true; };
+ auto False = [](auto) { return false; };
+
+ test0(S(), is1, S());
+
+ test0(S({1}), is1, S());
+ test0(S({1}), is2, S({1}));
+
+ test0(S({1,2}), is1, S({2}));
+ test0(S({1,2}), is2, S({1}));
+ test0(S({1,2}), is3, S({1,2}));
+ test0(S({1,1}), is1, S());
+ test0(S({1,1}), is3, S({1,1}));
+
+ test0(S({1,2,3}), is1, S({2,3}));
+ test0(S({1,2,3}), is2, S({1,3}));
+ test0(S({1,2,3}), is3, S({1,2}));
+ test0(S({1,2,3}), is4, S({1,2,3}));
+
+ test0(S({1,1,1}), is1, S());
+ test0(S({1,1,1}), is2, S({1,1,1}));
+ test0(S({1,1,2}), is1, S({2}));
+ test0(S({1,1,2}), is2, S({1,1}));
+ test0(S({1,1,2}), is3, S({1,1,2}));
+ test0(S({1,2,2}), is1, S({2,2}));
+ test0(S({1,2,2}), is2, S({1}));
+ test0(S({1,2,2}), is3, S({1,2,2}));
+
+ test0(S({1,2,3}), True, S());
+ test0(S({1,2,3}), False, S({1,2,3}));
+}
+
+int main()
+{
+ test<std::list<int>>();
+ test<std::list<int, min_allocator<int>>> ();
+ test<std::list<int, test_allocator<int>>> ();
+
+ test<std::list<long>>();
+ test<std::list<double>>();
+}
diff --git a/test/std/containers/sequences/list/list.modifiers/clear.pass.cpp b/test/std/containers/sequences/list/list.modifiers/clear.pass.cpp
index 5d8c41fa19764..1d7cb80eb65b8 100644
--- a/test/std/containers/sequences/list/list.modifiers/clear.pass.cpp
+++ b/test/std/containers/sequences/list/list.modifiers/clear.pass.cpp
@@ -9,11 +9,12 @@
// <list>
-// void clear();
+// void clear() noexcept;
#include <list>
#include <cassert>
+#include "test_macros.h"
#include "min_allocator.h"
int main()
@@ -21,6 +22,7 @@ int main()
{
int a[] = {1, 2, 3};
std::list<int> c(a, a+3);
+ ASSERT_NOEXCEPT(c.clear());
c.clear();
assert(c.empty());
}
@@ -28,6 +30,7 @@ int main()
{
int a[] = {1, 2, 3};
std::list<int, min_allocator<int>> c(a, a+3);
+ ASSERT_NOEXCEPT(c.clear());
c.clear();
assert(c.empty());
}
diff --git a/test/std/containers/sequences/list/list.ops/merge.pass.cpp b/test/std/containers/sequences/list/list.ops/merge.pass.cpp
index 7c1287706f351..af4b02ce35b12 100644
--- a/test/std/containers/sequences/list/list.ops/merge.pass.cpp
+++ b/test/std/containers/sequences/list/list.ops/merge.pass.cpp
@@ -10,6 +10,7 @@
// <list>
// void merge(list& x);
+// If (&addressof(x) == this) does nothing; otherwise ...
#include <list>
#include <cassert>
@@ -26,7 +27,16 @@ int main()
std::list<int> c2(a2, a2+sizeof(a2)/sizeof(a2[0]));
c1.merge(c2);
assert(c1 == std::list<int>(a3, a3+sizeof(a3)/sizeof(a3[0])));
+ assert(c2.empty());
}
+
+ {
+ int a1[] = {1, 3, 7, 9, 10};
+ std::list<int> c1(a1, a1+sizeof(a1)/sizeof(a1[0]));
+ c1.merge(c1);
+ assert((c1 == std::list<int>(a1, a1+sizeof(a1)/sizeof(a1[0]))));
+ }
+
#if TEST_STD_VER >= 11
{
int a1[] = {1, 3, 7, 9, 10};
@@ -36,6 +46,7 @@ int main()
std::list<int, min_allocator<int>> c2(a2, a2+sizeof(a2)/sizeof(a2[0]));
c1.merge(c2);
assert((c1 == std::list<int, min_allocator<int>>(a3, a3+sizeof(a3)/sizeof(a3[0]))));
+ assert(c2.empty());
}
#endif
}
diff --git a/test/std/containers/sequences/list/list.ops/merge_comp.pass.cpp b/test/std/containers/sequences/list/list.ops/merge_comp.pass.cpp
index 838ff22b3a53b..20ddbef620537 100644
--- a/test/std/containers/sequences/list/list.ops/merge_comp.pass.cpp
+++ b/test/std/containers/sequences/list/list.ops/merge_comp.pass.cpp
@@ -10,6 +10,7 @@
// <list>
// template <class Compare> void merge(list& x, Compare comp);
+// If (&addressof(x) == this) does nothing; otherwise ...
#include <list>
#include <functional>
@@ -27,7 +28,15 @@ int main()
std::list<int> c2(a2, a2+sizeof(a2)/sizeof(a2[0]));
c1.merge(c2, std::greater<int>());
assert(c1 == std::list<int>(a3, a3+sizeof(a3)/sizeof(a3[0])));
+ assert(c2.empty());
}
+ {
+ int a1[] = {10, 9, 7, 3, 1};
+ std::list<int> c1(a1, a1+sizeof(a1)/sizeof(a1[0]));
+ c1.merge(c1, std::greater<int>());
+ assert((c1 == std::list<int>(a1, a1+sizeof(a1)/sizeof(a1[0]))));
+ }
+
#if TEST_STD_VER >= 11
{
int a1[] = {10, 9, 7, 3, 1};
@@ -37,6 +46,7 @@ int main()
std::list<int, min_allocator<int>> c2(a2, a2+sizeof(a2)/sizeof(a2[0]));
c1.merge(c2, std::greater<int>());
assert((c1 == std::list<int, min_allocator<int>>(a3, a3+sizeof(a3)/sizeof(a3[0]))));
+ assert(c2.empty());
}
#endif
}
diff --git a/test/std/containers/sequences/vector.bool/construct_default.pass.cpp b/test/std/containers/sequences/vector.bool/construct_default.pass.cpp
index 0f51c219ee49a..80bfce1ad9a44 100644
--- a/test/std/containers/sequences/vector.bool/construct_default.pass.cpp
+++ b/test/std/containers/sequences/vector.bool/construct_default.pass.cpp
@@ -7,10 +7,15 @@
//
//===----------------------------------------------------------------------===//
-// <vector>
// vector<bool>
-// vector(const Alloc& = Alloc());
+// vector();
+// vector(const Alloc&);
+
+// This tests a conforming extension
+// For vector<>, this was added to the standard by N4258,
+// but vector<bool> was not changed.
+
#include <vector>
#include <cassert>
@@ -24,9 +29,9 @@ void
test0()
{
#if TEST_STD_VER > 14
- static_assert((noexcept(C{})), "" );
+ LIBCPP_STATIC_ASSERT((noexcept(C{})), "" );
#elif TEST_STD_VER >= 11
- static_assert((noexcept(C()) == noexcept(typename C::allocator_type())), "" );
+ LIBCPP_STATIC_ASSERT((noexcept(C()) == noexcept(typename C::allocator_type())), "" );
#endif
C c;
LIBCPP_ASSERT(c.__invariants());
@@ -45,9 +50,9 @@ void
test1(const typename C::allocator_type& a)
{
#if TEST_STD_VER > 14
- static_assert((noexcept(C{typename C::allocator_type{}})), "" );
+ LIBCPP_STATIC_ASSERT((noexcept(C{typename C::allocator_type{}})), "" );
#elif TEST_STD_VER >= 11
- static_assert((noexcept(C(typename C::allocator_type())) == std::is_nothrow_copy_constructible<typename C::allocator_type>::value), "" );
+ LIBCPP_STATIC_ASSERT((noexcept(C(typename C::allocator_type())) == std::is_nothrow_copy_constructible<typename C::allocator_type>::value), "" );
#endif
C c(a);
LIBCPP_ASSERT(c.__invariants());
diff --git a/test/std/containers/sequences/vector.bool/default_noexcept.pass.cpp b/test/std/containers/sequences/vector.bool/default_noexcept.pass.cpp
index 4e71df37421eb..e2d94e225674a 100644
--- a/test/std/containers/sequences/vector.bool/default_noexcept.pass.cpp
+++ b/test/std/containers/sequences/vector.bool/default_noexcept.pass.cpp
@@ -6,6 +6,7 @@
// Source Licenses. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
+// UNSUPPORTED: c++98, c++03
// <vector>
@@ -13,8 +14,9 @@
// noexcept(is_nothrow_default_constructible<allocator_type>::value);
// This tests a conforming extension
+// For vector<>, this was added to the standard by N4258,
+// but vector<bool> was not changed.
-// UNSUPPORTED: c++98, c++03
#include <vector>
#include <cassert>
@@ -40,7 +42,6 @@ int main()
typedef std::vector<bool, test_allocator<bool>> C;
static_assert(std::is_nothrow_default_constructible<C>::value, "");
}
-#endif // _LIBCPP_VERSION
{
typedef std::vector<bool, other_allocator<bool>> C;
static_assert(!std::is_nothrow_default_constructible<C>::value, "");
@@ -49,4 +50,5 @@ int main()
typedef std::vector<bool, some_alloc<bool>> C;
static_assert(!std::is_nothrow_default_constructible<C>::value, "");
}
+#endif // _LIBCPP_VERSION
}
diff --git a/test/std/containers/sequences/vector.bool/move.pass.cpp b/test/std/containers/sequences/vector.bool/move.pass.cpp
index ab2b7ce6d3164..b3663c759a871 100644
--- a/test/std/containers/sequences/vector.bool/move.pass.cpp
+++ b/test/std/containers/sequences/vector.bool/move.pass.cpp
@@ -26,8 +26,8 @@ int main()
std::vector<bool, test_allocator<bool> > lo(test_allocator<bool>(5));
for (int i = 1; i <= 3; ++i)
{
- l.push_back(i);
- lo.push_back(i);
+ l.push_back(true);
+ lo.push_back(true);
}
std::vector<bool, test_allocator<bool> > l2 = std::move(l);
assert(l2 == lo);
@@ -39,8 +39,8 @@ int main()
std::vector<bool, other_allocator<bool> > lo(other_allocator<bool>(5));
for (int i = 1; i <= 3; ++i)
{
- l.push_back(i);
- lo.push_back(i);
+ l.push_back(true);
+ lo.push_back(true);
}
std::vector<bool, other_allocator<bool> > l2 = std::move(l);
assert(l2 == lo);
@@ -52,8 +52,8 @@ int main()
std::vector<bool, min_allocator<bool> > lo(min_allocator<bool>{});
for (int i = 1; i <= 3; ++i)
{
- l.push_back(i);
- lo.push_back(i);
+ l.push_back(true);
+ lo.push_back(true);
}
std::vector<bool, min_allocator<bool> > l2 = std::move(l);
assert(l2 == lo);
diff --git a/test/std/containers/sequences/vector/vector.capacity/max_size.pass.cpp b/test/std/containers/sequences/vector/vector.capacity/max_size.pass.cpp
index 5f7a6268d55c3..3ab5cc6a890b9 100644
--- a/test/std/containers/sequences/vector/vector.capacity/max_size.pass.cpp
+++ b/test/std/containers/sequences/vector/vector.capacity/max_size.pass.cpp
@@ -31,16 +31,16 @@ int main() {
{
typedef limited_allocator<int, (size_t)-1> A;
typedef std::vector<int, A> C;
- const C::difference_type max_dist =
- std::numeric_limits<C::difference_type>::max();
+ const C::size_type max_dist =
+ static_cast<C::size_type>(std::numeric_limits<C::difference_type>::max());
C c;
assert(c.max_size() <= max_dist);
LIBCPP_ASSERT(c.max_size() == max_dist);
}
{
typedef std::vector<char> C;
- const C::difference_type max_dist =
- std::numeric_limits<C::difference_type>::max();
+ const C::size_type max_dist =
+ static_cast<C::size_type>(std::numeric_limits<C::difference_type>::max());
C c;
assert(c.max_size() <= max_dist);
assert(c.max_size() <= alloc_max_size(c.get_allocator()));
diff --git a/test/std/containers/sequences/vector/vector.cons/construct_iter_iter.pass.cpp b/test/std/containers/sequences/vector/vector.cons/construct_iter_iter.pass.cpp
index 88613efe7a2bd..60fe2899ac20a 100644
--- a/test/std/containers/sequences/vector/vector.cons/construct_iter_iter.pass.cpp
+++ b/test/std/containers/sequences/vector/vector.cons/construct_iter_iter.pass.cpp
@@ -121,7 +121,6 @@ void test_ctor_under_alloc() {
int arr2[] = {1, 101, 42};
{
using C = TCT::vector<>;
- using T = typename C::value_type;
using It = forward_iterator<int*>;
{
ExpectConstructGuard<int&> G(1);
@@ -134,7 +133,6 @@ void test_ctor_under_alloc() {
}
{
using C = TCT::vector<>;
- using T = typename C::value_type;
using It = input_iterator<int*>;
{
ExpectConstructGuard<int&> G(1);
@@ -148,9 +146,40 @@ void test_ctor_under_alloc() {
#endif
}
+// Initialize a vector with a different value type.
+void test_ctor_with_different_value_type() {
+ {
+ // Make sure initialization is performed with each element value, not with
+ // a memory blob.
+ float array[3] = {0.0f, 1.0f, 2.0f};
+ std::vector<int> v(array, array + 3);
+ assert(v[0] == 0);
+ assert(v[1] == 1);
+ assert(v[2] == 2);
+ }
+ struct X { int x; };
+ struct Y { int y; };
+ struct Z : X, Y { int z; };
+ {
+ Z z;
+ Z *array[1] = { &z };
+ // Though the types Z* and Y* are very similar, initialization still cannot
+ // be done with `memcpy`.
+ std::vector<Y*> v(array, array + 1);
+ assert(v[0] == &z);
+ }
+ {
+ // Though the types are different, initialization can be done with `memcpy`.
+ int32_t array[1] = { -1 };
+ std::vector<uint32_t> v(array, array + 1);
+ assert(v[0] == 4294967295);
+ }
+}
+
int main() {
basic_test_cases();
emplaceable_concept_tests(); // See PR34898
test_ctor_under_alloc();
+ test_ctor_with_different_value_type();
}
diff --git a/test/std/containers/sequences/vector/vector.cons/construct_iter_iter_alloc.pass.cpp b/test/std/containers/sequences/vector/vector.cons/construct_iter_iter_alloc.pass.cpp
index 71743b31d44c7..15498ba4135c4 100644
--- a/test/std/containers/sequences/vector/vector.cons/construct_iter_iter_alloc.pass.cpp
+++ b/test/std/containers/sequences/vector/vector.cons/construct_iter_iter_alloc.pass.cpp
@@ -134,7 +134,6 @@ void test_ctor_under_alloc() {
int arr2[] = {1, 101, 42};
{
using C = TCT::vector<>;
- using T = typename C::value_type;
using It = forward_iterator<int*>;
using Alloc = typename C::allocator_type;
Alloc a;
@@ -149,7 +148,6 @@ void test_ctor_under_alloc() {
}
{
using C = TCT::vector<>;
- using T = typename C::value_type;
using It = input_iterator<int*>;
using Alloc = typename C::allocator_type;
Alloc a;
diff --git a/test/std/containers/sequences/vector/vector.cons/default_noexcept.pass.cpp b/test/std/containers/sequences/vector/vector.cons/default_noexcept.pass.cpp
index b244f75f21d4f..f8c932a02d63b 100644
--- a/test/std/containers/sequences/vector/vector.cons/default_noexcept.pass.cpp
+++ b/test/std/containers/sequences/vector/vector.cons/default_noexcept.pass.cpp
@@ -6,15 +6,15 @@
// Source Licenses. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
+// UNSUPPORTED: c++98, c++03
// <vector>
// vector()
// noexcept(is_nothrow_default_constructible<allocator_type>::value);
-// This tests a conforming extension
+// This *was* a conforming extension, but it was adopted in N4258.
-// UNSUPPORTED: c++98, c++03
#include <vector>
#include <cassert>
diff --git a/test/std/containers/sequences/vector/vector.cons/move.pass.cpp b/test/std/containers/sequences/vector/vector.cons/move.pass.cpp
index 6938aa679eba9..330bcda8b10eb 100644
--- a/test/std/containers/sequences/vector/vector.cons/move.pass.cpp
+++ b/test/std/containers/sequences/vector/vector.cons/move.pass.cpp
@@ -21,7 +21,6 @@
#include "test_allocator.h"
#include "min_allocator.h"
#include "asan_testing.h"
-#include "verbose_assert.h"
int main()
{
diff --git a/test/std/containers/sequences/vector/vector.erasure/erase.pass.cpp b/test/std/containers/sequences/vector/vector.erasure/erase.pass.cpp
new file mode 100644
index 0000000000000..e88252f1d9201
--- /dev/null
+++ b/test/std/containers/sequences/vector/vector.erasure/erase.pass.cpp
@@ -0,0 +1,78 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
+
+// <vector>
+
+// template <class T, class Allocator, class U>
+// void erase(vector<T, Allocator>& c, const U& value);
+
+
+#include <vector>
+#include <optional>
+
+#include "test_macros.h"
+#include "test_allocator.h"
+#include "min_allocator.h"
+
+template <class S, class U>
+void
+test0(S s, U val, S expected)
+{
+ ASSERT_SAME_TYPE(void, decltype(std::erase(s, val)));
+ std::erase(s, val);
+ assert(s == expected);
+}
+
+template <class S>
+void test()
+{
+
+ test0(S(), 1, S());
+
+ test0(S({1}), 1, S());
+ test0(S({1}), 2, S({1}));
+
+ test0(S({1,2}), 1, S({2}));
+ test0(S({1,2}), 2, S({1}));
+ test0(S({1,2}), 3, S({1,2}));
+ test0(S({1,1}), 1, S());
+ test0(S({1,1}), 3, S({1,1}));
+
+ test0(S({1,2,3}), 1, S({2,3}));
+ test0(S({1,2,3}), 2, S({1,3}));
+ test0(S({1,2,3}), 3, S({1,2}));
+ test0(S({1,2,3}), 4, S({1,2,3}));
+
+ test0(S({1,1,1}), 1, S());
+ test0(S({1,1,1}), 2, S({1,1,1}));
+ test0(S({1,1,2}), 1, S({2}));
+ test0(S({1,1,2}), 2, S({1,1}));
+ test0(S({1,1,2}), 3, S({1,1,2}));
+ test0(S({1,2,2}), 1, S({2,2}));
+ test0(S({1,2,2}), 2, S({1}));
+ test0(S({1,2,2}), 3, S({1,2,2}));
+
+// Test cross-type erasure
+ using opt = std::optional<typename S::value_type>;
+ test0(S({1,2,1}), opt(), S({1,2,1}));
+ test0(S({1,2,1}), opt(1), S({2}));
+ test0(S({1,2,1}), opt(2), S({1,1}));
+ test0(S({1,2,1}), opt(3), S({1,2,1}));
+}
+
+int main()
+{
+ test<std::vector<int>>();
+ test<std::vector<int, min_allocator<int>>> ();
+ test<std::vector<int, test_allocator<int>>> ();
+
+ test<std::vector<long>>();
+ test<std::vector<double>>();
+}
diff --git a/test/std/containers/sequences/vector/vector.erasure/erase_if.pass.cpp b/test/std/containers/sequences/vector/vector.erasure/erase_if.pass.cpp
new file mode 100644
index 0000000000000..8025a34071f5b
--- /dev/null
+++ b/test/std/containers/sequences/vector/vector.erasure/erase_if.pass.cpp
@@ -0,0 +1,78 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
+
+// <vector>
+
+// template <class T, class Allocator, class Predicate>
+// void erase_if(vector<T, Allocator>& c, Predicate pred);
+
+#include <vector>
+
+#include "test_macros.h"
+#include "test_allocator.h"
+#include "min_allocator.h"
+
+template <class S, class Pred>
+void
+test0(S s, Pred p, S expected)
+{
+ ASSERT_SAME_TYPE(void, decltype(std::erase_if(s, p)));
+ std::erase_if(s, p);
+ assert(s == expected);
+}
+
+template <typename S>
+void test()
+{
+ auto is1 = [](auto v) { return v == 1;};
+ auto is2 = [](auto v) { return v == 2;};
+ auto is3 = [](auto v) { return v == 3;};
+ auto is4 = [](auto v) { return v == 4;};
+ auto True = [](auto) { return true; };
+ auto False = [](auto) { return false; };
+
+ test0(S(), is1, S());
+
+ test0(S({1}), is1, S());
+ test0(S({1}), is2, S({1}));
+
+ test0(S({1,2}), is1, S({2}));
+ test0(S({1,2}), is2, S({1}));
+ test0(S({1,2}), is3, S({1,2}));
+ test0(S({1,1}), is1, S());
+ test0(S({1,1}), is3, S({1,1}));
+
+ test0(S({1,2,3}), is1, S({2,3}));
+ test0(S({1,2,3}), is2, S({1,3}));
+ test0(S({1,2,3}), is3, S({1,2}));
+ test0(S({1,2,3}), is4, S({1,2,3}));
+
+ test0(S({1,1,1}), is1, S());
+ test0(S({1,1,1}), is2, S({1,1,1}));
+ test0(S({1,1,2}), is1, S({2}));
+ test0(S({1,1,2}), is2, S({1,1}));
+ test0(S({1,1,2}), is3, S({1,1,2}));
+ test0(S({1,2,2}), is1, S({2,2}));
+ test0(S({1,2,2}), is2, S({1}));
+ test0(S({1,2,2}), is3, S({1,2,2}));
+
+ test0(S({1,2,3}), True, S());
+ test0(S({1,2,3}), False, S({1,2,3}));
+}
+
+int main()
+{
+ test<std::vector<int>>();
+ test<std::vector<int, min_allocator<int>>> ();
+ test<std::vector<int, test_allocator<int>>> ();
+
+ test<std::vector<long>>();
+ test<std::vector<double>>();
+}
diff --git a/test/std/containers/sequences/vector/vector.modifiers/clear.pass.cpp b/test/std/containers/sequences/vector/vector.modifiers/clear.pass.cpp
index 5f053eb8565a7..5357ba4cb2841 100644
--- a/test/std/containers/sequences/vector/vector.modifiers/clear.pass.cpp
+++ b/test/std/containers/sequences/vector/vector.modifiers/clear.pass.cpp
@@ -9,11 +9,12 @@
// <vector>
-// void clear();
+// void clear() noexcept;
#include <vector>
#include <cassert>
+#include "test_macros.h"
#include "min_allocator.h"
#include "asan_testing.h"
@@ -22,6 +23,7 @@ int main()
{
int a[] = {1, 2, 3};
std::vector<int> c(a, a+3);
+ ASSERT_NOEXCEPT(c.clear());
c.clear();
assert(c.empty());
LIBCPP_ASSERT(c.__invariants());
@@ -31,6 +33,7 @@ int main()
{
int a[] = {1, 2, 3};
std::vector<int, min_allocator<int>> c(a, a+3);
+ ASSERT_NOEXCEPT(c.clear());
c.clear();
assert(c.empty());
LIBCPP_ASSERT(c.__invariants());
diff --git a/test/std/containers/sequences/vector/vector.modifiers/insert_iter_iter_iter.pass.cpp b/test/std/containers/sequences/vector/vector.modifiers/insert_iter_iter_iter.pass.cpp
index 258b9d9f75172..b54a96d0beda9 100644
--- a/test/std/containers/sequences/vector/vector.modifiers/insert_iter_iter_iter.pass.cpp
+++ b/test/std/containers/sequences/vector/vector.modifiers/insert_iter_iter_iter.pass.cpp
@@ -25,11 +25,12 @@
int main()
{
{
- std::vector<int> v(100);
+ typedef std::vector<int> V;
+ V v(100);
int a[] = {1, 2, 3, 4, 5};
const int N = sizeof(a)/sizeof(a[0]);
- std::vector<int>::iterator i = v.insert(v.cbegin() + 10, input_iterator<const int*>(a),
- input_iterator<const int*>(a+N));
+ V::iterator i = v.insert(v.cbegin() + 10, input_iterator<const int*>(a),
+ input_iterator<const int*>(a+N));
assert(v.size() == 100 + N);
assert(is_contiguous_container_asan_correct(v));
assert(i == v.begin() + 10);
@@ -42,11 +43,12 @@ int main()
assert(v[j] == 0);
}
{
- std::vector<int> v(100);
+ typedef std::vector<int> V;
+ V v(100);
int a[] = {1, 2, 3, 4, 5};
const int N = sizeof(a)/sizeof(a[0]);
- std::vector<int>::iterator i = v.insert(v.cbegin() + 10, forward_iterator<const int*>(a),
- forward_iterator<const int*>(a+N));
+ V::iterator i = v.insert(v.cbegin() + 10, forward_iterator<const int*>(a),
+ forward_iterator<const int*>(a+N));
assert(v.size() == 100 + N);
assert(is_contiguous_container_asan_correct(v));
assert(i == v.begin() + 10);
@@ -59,13 +61,14 @@ int main()
assert(v[j] == 0);
}
{
- std::vector<int> v(100);
+ typedef std::vector<int> V;
+ V v(100);
while(v.size() < v.capacity()) v.push_back(0); // force reallocation
size_t sz = v.size();
int a[] = {1, 2, 3, 4, 5};
const unsigned N = sizeof(a)/sizeof(a[0]);
- std::vector<int>::iterator i = v.insert(v.cbegin() + 10, forward_iterator<const int*>(a),
- forward_iterator<const int*>(a+N));
+ V::iterator i = v.insert(v.cbegin() + 10, forward_iterator<const int*>(a),
+ forward_iterator<const int*>(a+N));
assert(v.size() == sz + N);
assert(i == v.begin() + 10);
std::size_t j;
@@ -77,13 +80,14 @@ int main()
assert(v[j] == 0);
}
{
- std::vector<int> v(100);
+ typedef std::vector<int> V;
+ V v(100);
v.reserve(128); // force no reallocation
size_t sz = v.size();
int a[] = {1, 2, 3, 4, 5};
const unsigned N = sizeof(a)/sizeof(a[0]);
- std::vector<int>::iterator i = v.insert(v.cbegin() + 10, forward_iterator<const int*>(a),
- forward_iterator<const int*>(a+N));
+ V::iterator i = v.insert(v.cbegin() + 10, forward_iterator<const int*>(a),
+ forward_iterator<const int*>(a+N));
assert(v.size() == sz + N);
assert(i == v.begin() + 10);
std::size_t j;
@@ -95,11 +99,12 @@ int main()
assert(v[j] == 0);
}
{
- std::vector<int, limited_allocator<int, 308> > v(100);
+ typedef std::vector<int, limited_allocator<int, 308> > V;
+ V v(100);
int a[] = {1, 2, 3, 4, 5};
const int N = sizeof(a)/sizeof(a[0]);
- std::vector<int>::iterator i = v.insert(v.cbegin() + 10, input_iterator<const int*>(a),
- input_iterator<const int*>(a+N));
+ V::iterator i = v.insert(v.cbegin() + 10, input_iterator<const int*>(a),
+ input_iterator<const int*>(a+N));
assert(v.size() == 100 + N);
assert(is_contiguous_container_asan_correct(v));
assert(i == v.begin() + 10);
@@ -112,11 +117,12 @@ int main()
assert(v[j] == 0);
}
{
- std::vector<int, limited_allocator<int, 300> > v(100);
+ typedef std::vector<int, limited_allocator<int, 300> > V;
+ V v(100);
int a[] = {1, 2, 3, 4, 5};
const int N = sizeof(a)/sizeof(a[0]);
- std::vector<int>::iterator i = v.insert(v.cbegin() + 10, forward_iterator<const int*>(a),
- forward_iterator<const int*>(a+N));
+ V::iterator i = v.insert(v.cbegin() + 10, forward_iterator<const int*>(a),
+ forward_iterator<const int*>(a+N));
assert(v.size() == 100 + N);
assert(is_contiguous_container_asan_correct(v));
assert(i == v.begin() + 10);
@@ -130,11 +136,12 @@ int main()
}
#if TEST_STD_VER >= 11
{
- std::vector<int, min_allocator<int>> v(100);
+ typedef std::vector<int, min_allocator<int> > V;
+ V v(100);
int a[] = {1, 2, 3, 4, 5};
const int N = sizeof(a)/sizeof(a[0]);
- std::vector<int, min_allocator<int>>::iterator i = v.insert(v.cbegin() + 10, input_iterator<const int*>(a),
- input_iterator<const int*>(a+N));
+ V::iterator i = v.insert(v.cbegin() + 10, input_iterator<const int*>(a),
+ input_iterator<const int*>(a+N));
assert(v.size() == 100 + N);
assert(is_contiguous_container_asan_correct(v));
assert(i == v.begin() + 10);
@@ -147,11 +154,12 @@ int main()
assert(v[j] == 0);
}
{
- std::vector<int, min_allocator<int>> v(100);
+ typedef std::vector<int, min_allocator<int> > V;
+ V v(100);
int a[] = {1, 2, 3, 4, 5};
const int N = sizeof(a)/sizeof(a[0]);
- std::vector<int, min_allocator<int>>::iterator i = v.insert(v.cbegin() + 10, forward_iterator<const int*>(a),
- forward_iterator<const int*>(a+N));
+ V::iterator i = v.insert(v.cbegin() + 10, forward_iterator<const int*>(a),
+ forward_iterator<const int*>(a+N));
assert(v.size() == 100 + N);
assert(is_contiguous_container_asan_correct(v));
assert(i == v.begin() + 10);
diff --git a/test/std/containers/set_allocator_requirement_test_templates.h b/test/std/containers/set_allocator_requirement_test_templates.h
index 2e3346f47e2d2..517c36d8e9580 100644
--- a/test/std/containers/set_allocator_requirement_test_templates.h
+++ b/test/std/containers/set_allocator_requirement_test_templates.h
@@ -32,8 +32,6 @@ template <class Container>
void testSetInsert()
{
typedef typename Container::value_type ValueTp;
- typedef Container C;
- typedef std::pair<typename C::iterator, bool> R;
ConstructController* cc = getConstructController();
cc->reset();
{
@@ -146,8 +144,6 @@ template <class Container>
void testSetEmplace()
{
typedef typename Container::value_type ValueTp;
- typedef Container C;
- typedef std::pair<typename C::iterator, bool> R;
ConstructController* cc = getConstructController();
cc->reset();
{
@@ -209,7 +205,6 @@ template <class Container>
void testSetEmplaceHint()
{
typedef typename Container::value_type ValueTp;
-
typedef Container C;
typedef typename C::iterator It;
ConstructController* cc = getConstructController();
@@ -289,7 +284,6 @@ template <class Container>
void testMultisetInsert()
{
typedef typename Container::value_type ValueTp;
- typedef Container C;
ConstructController* cc = getConstructController();
cc->reset();
{
@@ -344,11 +338,52 @@ void testMultisetInsert()
{
CHECKPOINT("Testing C::insert(Iter, Iter) for *Iter = value_type&");
Container c;
- ValueTp ValueList[] = { ValueTp(1), ValueTp(2) , ValueTp(3) };
+ ValueTp ValueList[] = { ValueTp(1), ValueTp(2) , ValueTp(1) };
cc->expect<ValueTp&>(3);
c.insert(std::begin(ValueList), std::end(ValueList));
assert(!cc->unchecked());
}
}
+
+template <class Container>
+void testMultisetEmplace()
+{
+ typedef typename Container::value_type ValueTp;
+ ConstructController* cc = getConstructController();
+ cc->reset();
+ {
+ CHECKPOINT("Testing C::emplace(const value_type&)");
+ Container c;
+ const ValueTp v(42);
+ cc->expect<const ValueTp&>();
+ c.emplace(v);
+ assert(!cc->unchecked());
+ }
+ {
+ CHECKPOINT("Testing C::emplace(value_type&)");
+ Container c;
+ ValueTp v(42);
+ cc->expect<ValueTp&>();
+ c.emplace(v);
+ assert(!cc->unchecked());
+ }
+ {
+ CHECKPOINT("Testing C::emplace(value_type&&)");
+ Container c;
+ ValueTp v(42);
+ cc->expect<ValueTp&&>();
+ c.emplace(std::move(v));
+ assert(!cc->unchecked());
+ }
+ {
+ CHECKPOINT("Testing C::emplace(const value_type&&)");
+ Container c;
+ const ValueTp v(42);
+ cc->expect<const ValueTp&&>();
+ c.emplace(std::move(v));
+ assert(!cc->unchecked());
+ }
+}
+
#endif
diff --git a/test/std/containers/unord/unord.map/compare.pass.cpp b/test/std/containers/unord/unord.map/compare.pass.cpp
index cffc1dbd42c12..2761bf17764a5 100644
--- a/test/std/containers/unord/unord.map/compare.pass.cpp
+++ b/test/std/containers/unord/unord.map/compare.pass.cpp
@@ -33,8 +33,7 @@ namespace std
};
}
-int
-main()
+int main()
{
typedef std::unordered_map<Key, int> MapT;
typedef MapT::iterator Iter;
diff --git a/test/std/containers/unord/unord.map/erase_if.pass.cpp b/test/std/containers/unord/unord.map/erase_if.pass.cpp
new file mode 100644
index 0000000000000..f6a580c2160dc
--- /dev/null
+++ b/test/std/containers/unord/unord.map/erase_if.pass.cpp
@@ -0,0 +1,80 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
+
+// <unordered_map>
+
+// template <class Key, class T, class Hash, class Pred, class Allocator, class Predicate>
+// void erase_if(unordered_map<Key, T, Hash, Pred, Allocator>& c, Predicate pred);
+
+#include <unordered_map>
+
+#include "test_macros.h"
+#include "test_allocator.h"
+#include "min_allocator.h"
+
+using Init = std::initializer_list<int>;
+template <typename M>
+M make (Init vals)
+{
+ M ret;
+ for (int v : vals)
+ ret[v] = v + 10;
+ return ret;
+}
+
+template <typename M, typename Pred>
+void
+test0(Init vals, Pred p, Init expected)
+{
+ M s = make<M> (vals);
+ ASSERT_SAME_TYPE(void, decltype(std::erase_if(s, p)));
+ std::erase_if(s, p);
+ M e = make<M>(expected);
+ assert((std::is_permutation(s.begin(), s.end(), e.begin(), e.end())));
+}
+
+template <typename S>
+void test()
+{
+ auto is1 = [](auto v) { return v.first == 1;};
+ auto is2 = [](auto v) { return v.first == 2;};
+ auto is3 = [](auto v) { return v.first == 3;};
+ auto is4 = [](auto v) { return v.first == 4;};
+ auto True = [](auto) { return true; };
+ auto False = [](auto) { return false; };
+
+ test0<S>({}, is1, {});
+
+ test0<S>({1}, is1, {});
+ test0<S>({1}, is2, {1});
+
+ test0<S>({1,2}, is1, {2});
+ test0<S>({1,2}, is2, {1});
+ test0<S>({1,2}, is3, {1,2});
+
+ test0<S>({1,2,3}, is1, {2,3});
+ test0<S>({1,2,3}, is2, {1,3});
+ test0<S>({1,2,3}, is3, {1,2});
+ test0<S>({1,2,3}, is4, {1,2,3});
+
+ test0<S>({1,2,3}, True, {});
+ test0<S>({1,2,3}, False, {1,2,3});
+}
+
+int main()
+{
+ test<std::unordered_map<int, int>>();
+ test<std::unordered_map<int, int, std::hash<int>, std::equal_to<int>, min_allocator<std::pair<const int, int>>>> ();
+ test<std::unordered_map<int, int, std::hash<int>, std::equal_to<int>, test_allocator<std::pair<const int, int>>>> ();
+
+ test<std::unordered_map<long, short>>();
+ test<std::unordered_map<short, double>>();
+}
+
diff --git a/test/std/containers/unord/unord.map/max_size.pass.cpp b/test/std/containers/unord/unord.map/max_size.pass.cpp
index 152741981461d..d01b526836e79 100644
--- a/test/std/containers/unord/unord.map/max_size.pass.cpp
+++ b/test/std/containers/unord/unord.map/max_size.pass.cpp
@@ -36,16 +36,16 @@ int main()
typedef limited_allocator<KV, (size_t)-1> A;
typedef std::unordered_map<int, int, std::hash<int>, std::equal_to<int>, A>
C;
- const C::difference_type max_dist =
- std::numeric_limits<C::difference_type>::max();
+ const C::size_type max_dist =
+ static_cast<C::size_type>(std::numeric_limits<C::difference_type>::max());
C c;
assert(c.max_size() <= max_dist);
LIBCPP_ASSERT(c.max_size() == max_dist);
}
{
typedef std::unordered_map<char, int> C;
- const C::difference_type max_dist =
- std::numeric_limits<C::difference_type>::max();
+ const C::size_type max_dist =
+ static_cast<C::size_type>(std::numeric_limits<C::difference_type>::max());
C c;
assert(c.max_size() <= max_dist);
assert(c.max_size() <= alloc_max_size(c.get_allocator()));
diff --git a/test/std/containers/unord/unord.map/unord.map.cnstr/assign_copy.pass.cpp b/test/std/containers/unord/unord.map/unord.map.cnstr/assign_copy.pass.cpp
index b793f09343555..c6b92744e3131 100644
--- a/test/std/containers/unord/unord.map/unord.map.cnstr/assign_copy.pass.cpp
+++ b/test/std/containers/unord/unord.map/unord.map.cnstr/assign_copy.pass.cpp
@@ -15,10 +15,12 @@
// unordered_map& operator=(const unordered_map& u);
+#include <algorithm>
#include <unordered_map>
#include <string>
#include <cassert>
#include <cfloat>
+#include <cmath>
#include <cstddef>
#include "test_macros.h"
diff --git a/test/std/containers/unord/unord.map/unord.map.cnstr/assign_init.pass.cpp b/test/std/containers/unord/unord.map/unord.map.cnstr/assign_init.pass.cpp
index 9fca1f1059281..6bfb7bc181e4c 100644
--- a/test/std/containers/unord/unord.map/unord.map.cnstr/assign_init.pass.cpp
+++ b/test/std/containers/unord/unord.map/unord.map.cnstr/assign_init.pass.cpp
@@ -21,6 +21,7 @@
#include <string>
#include <cassert>
#include <cfloat>
+#include <cmath>
#include <cstddef>
#include "../../../test_compare.h"
diff --git a/test/std/containers/unord/unord.map/unord.map.cnstr/assign_move.pass.cpp b/test/std/containers/unord/unord.map/unord.map.cnstr/assign_move.pass.cpp
index 0d08fae0c3bca..af98b923d3b76 100644
--- a/test/std/containers/unord/unord.map/unord.map.cnstr/assign_move.pass.cpp
+++ b/test/std/containers/unord/unord.map/unord.map.cnstr/assign_move.pass.cpp
@@ -21,6 +21,7 @@
#include <string>
#include <cassert>
#include <cfloat>
+#include <cmath>
#include <cstddef>
#include "test_macros.h"
diff --git a/test/std/containers/unord/unord.map/unord.map.cnstr/init.pass.cpp b/test/std/containers/unord/unord.map/unord.map.cnstr/init.pass.cpp
index b06e4db1303a3..1979dd326df4b 100644
--- a/test/std/containers/unord/unord.map/unord.map.cnstr/init.pass.cpp
+++ b/test/std/containers/unord/unord.map/unord.map.cnstr/init.pass.cpp
@@ -21,6 +21,7 @@
#include <string>
#include <cassert>
#include <cfloat>
+#include <cmath>
#include <cstddef>
#include "test_macros.h"
diff --git a/test/std/containers/unord/unord.map/unord.map.cnstr/range.pass.cpp b/test/std/containers/unord/unord.map/unord.map.cnstr/range.pass.cpp
index 3dbcf4d15823d..94c4bca9b8692 100644
--- a/test/std/containers/unord/unord.map/unord.map.cnstr/range.pass.cpp
+++ b/test/std/containers/unord/unord.map/unord.map.cnstr/range.pass.cpp
@@ -20,6 +20,7 @@
#include <string>
#include <cassert>
#include <cfloat>
+#include <cmath>
#include <cstddef>
#include "test_macros.h"
diff --git a/test/std/containers/unord/unord.map/unord.map.elem/at.pass.cpp b/test/std/containers/unord/unord.map/unord.map.elem/at.pass.cpp
index e526b654a1979..a17c49d595de8 100644
--- a/test/std/containers/unord/unord.map/unord.map.elem/at.pass.cpp
+++ b/test/std/containers/unord/unord.map/unord.map.elem/at.pass.cpp
@@ -16,9 +16,10 @@
// mapped_type& at(const key_type& k);
// const mapped_type& at(const key_type& k) const;
-#include <unordered_map>
-#include <string>
#include <cassert>
+#include <stdexcept>
+#include <string>
+#include <unordered_map>
#include "MoveOnly.h"
#include "min_allocator.h"
diff --git a/test/std/containers/unord/unord.map/unord.map.elem/index.pass.cpp b/test/std/containers/unord/unord.map/unord.map.elem/index.pass.cpp
index 7bc59447a5e6b..f7f3a22d5c15b 100644
--- a/test/std/containers/unord/unord.map/unord.map.elem/index.pass.cpp
+++ b/test/std/containers/unord/unord.map/unord.map.elem/index.pass.cpp
@@ -119,7 +119,6 @@ int main()
using Container = TCT::unordered_map<>;
using Key = Container::key_type;
using MappedType = Container::mapped_type;
- using ValueTp = Container::value_type;
ConstructController* cc = getConstructController();
cc->reset();
{
diff --git a/test/std/containers/unord/unord.map/unord.map.modifiers/clear.pass.cpp b/test/std/containers/unord/unord.map/unord.map.modifiers/clear.pass.cpp
index 106423ebfbe92..9212a5e3def32 100644
--- a/test/std/containers/unord/unord.map/unord.map.modifiers/clear.pass.cpp
+++ b/test/std/containers/unord/unord.map/unord.map.modifiers/clear.pass.cpp
@@ -13,12 +13,13 @@
// class Alloc = allocator<pair<const Key, T>>>
// class unordered_map
-// void clear()
+// void clear() noexcept;
#include <unordered_map>
#include <string>
#include <cassert>
+#include "test_macros.h"
#include "min_allocator.h"
int main()
@@ -36,6 +37,7 @@ int main()
P(2, "four"),
};
C c(a, a + sizeof(a)/sizeof(a[0]));
+ ASSERT_NOEXCEPT(c.clear());
c.clear();
assert(c.size() == 0);
}
@@ -54,6 +56,7 @@ int main()
P(2, "four"),
};
C c(a, a + sizeof(a)/sizeof(a[0]));
+ ASSERT_NOEXCEPT(c.clear());
c.clear();
assert(c.size() == 0);
}
diff --git a/test/std/containers/unord/unord.map/unord.map.modifiers/merge.pass.cpp b/test/std/containers/unord/unord.map/unord.map.modifiers/merge.pass.cpp
new file mode 100644
index 0000000000000..2d5e1843fd2f5
--- /dev/null
+++ b/test/std/containers/unord/unord.map/unord.map.modifiers/merge.pass.cpp
@@ -0,0 +1,157 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++98, c++03, c++11, c++14
+
+// <unordered_map>
+
+// class unordered_map
+
+// template <class H2, class P2>
+// void merge(unordered_map<key_type, value_type, H2, P2, allocator_type>& source);
+// template <class H2, class P2>
+// void merge(unordered_map<key_type, value_type, H2, P2, allocator_type>&& source);
+// template <class H2, class P2>
+// void merge(unordered_multimap<key_type, value_type, H2, P2, allocator_type>& source);
+// template <class H2, class P2>
+// void merge(unordered_multimap<key_type, value_type, H2, P2, allocator_type>&& source);
+
+#include <unordered_map>
+#include <cassert>
+#include "test_macros.h"
+#include "Counter.h"
+
+template <class Map>
+bool map_equal(const Map& map, Map other)
+{
+ return map == other;
+}
+
+#ifndef TEST_HAS_NO_EXCEPTIONS
+template <class T>
+struct throw_hasher
+{
+ bool& should_throw_;
+
+ throw_hasher(bool& should_throw) : should_throw_(should_throw) {}
+
+ size_t operator()(const T& p) const
+ {
+ if (should_throw_)
+ throw 0;
+ return std::hash<T>()(p);
+ }
+};
+#endif
+
+int main()
+{
+ {
+ std::unordered_map<int, int> src{{1, 0}, {3, 0}, {5, 0}};
+ std::unordered_map<int, int> dst{{2, 0}, {4, 0}, {5, 0}};
+ dst.merge(src);
+ assert(map_equal(src, {{5,0}}));
+ assert(map_equal(dst, {{1, 0}, {2, 0}, {3, 0}, {4, 0}, {5, 0}}));
+ }
+
+#ifndef TEST_HAS_NO_EXCEPTIONS
+ {
+ bool do_throw = false;
+ typedef std::unordered_map<Counter<int>, int, throw_hasher<Counter<int>>> map_type;
+ map_type src({{1, 0}, {3, 0}, {5, 0}}, 0, throw_hasher<Counter<int>>(do_throw));
+ map_type dst({{2, 0}, {4, 0}, {5, 0}}, 0, throw_hasher<Counter<int>>(do_throw));
+
+ assert(Counter_base::gConstructed == 6);
+
+ do_throw = true;
+ try
+ {
+ dst.merge(src);
+ }
+ catch (int)
+ {
+ do_throw = false;
+ }
+ assert(!do_throw);
+ assert(map_equal(src, map_type({{1, 0}, {3, 0}, {5, 0}}, 0, throw_hasher<Counter<int>>(do_throw))));
+ assert(map_equal(dst, map_type({{2, 0}, {4, 0}, {5, 0}}, 0, throw_hasher<Counter<int>>(do_throw))));
+ }
+#endif
+ assert(Counter_base::gConstructed == 0);
+ struct equal
+ {
+ equal() = default;
+
+ bool operator()(const Counter<int>& lhs, const Counter<int>& rhs) const
+ {
+ return lhs == rhs;
+ }
+ };
+ struct hasher
+ {
+ hasher() = default;
+ size_t operator()(const Counter<int>& p) const
+ {
+ return std::hash<Counter<int>>()(p);
+ }
+ };
+ {
+ typedef std::unordered_map<Counter<int>, int, std::hash<Counter<int>>, std::equal_to<Counter<int>>> first_map_type;
+ typedef std::unordered_map<Counter<int>, int, hasher, equal> second_map_type;
+ typedef std::unordered_multimap<Counter<int>, int, hasher, equal> third_map_type;
+
+ {
+ first_map_type first{{1, 0}, {2, 0}, {3, 0}};
+ second_map_type second{{2, 0}, {3, 0}, {4, 0}};
+ third_map_type third{{1, 0}, {3, 0}};
+
+ assert(Counter_base::gConstructed == 8);
+
+ first.merge(second);
+ first.merge(third);
+
+ assert(map_equal(first, {{1, 0}, {2, 0}, {3, 0}, {4, 0}}));
+ assert(map_equal(second, {{2, 0}, {3, 0}}));
+ assert(map_equal(third, {{1, 0}, {3, 0}}));
+
+ assert(Counter_base::gConstructed == 8);
+ }
+ assert(Counter_base::gConstructed == 0);
+ {
+ first_map_type first{{1, 0}, {2, 0}, {3, 0}};
+ second_map_type second{{2, 0}, {3, 0}, {4, 0}};
+ third_map_type third{{1, 0}, {3, 0}};
+
+ assert(Counter_base::gConstructed == 8);
+
+ first.merge(std::move(second));
+ first.merge(std::move(third));
+
+ assert(map_equal(first, {{1, 0}, {2, 0}, {3, 0}, {4, 0}}));
+ assert(map_equal(second, {{2, 0}, {3, 0}}));
+ assert(map_equal(third, {{1, 0}, {3, 0}}));
+
+ assert(Counter_base::gConstructed == 8);
+ }
+ assert(Counter_base::gConstructed == 0);
+ }
+ {
+ std::unordered_map<int, int> first;
+ {
+ std::unordered_map<int, int> second;
+ first.merge(second);
+ first.merge(std::move(second));
+ }
+ {
+ std::unordered_multimap<int, int> second;
+ first.merge(second);
+ first.merge(std::move(second));
+ }
+ }
+}
diff --git a/test/std/containers/unord/unord.multimap/equal_range_const.pass.cpp b/test/std/containers/unord/unord.multimap/equal_range_const.pass.cpp
index 382ed7c9831d1..65c9f8c12134b 100644
--- a/test/std/containers/unord/unord.multimap/equal_range_const.pass.cpp
+++ b/test/std/containers/unord/unord.multimap/equal_range_const.pass.cpp
@@ -17,6 +17,7 @@
#include <unordered_map>
#include <string>
+#include <set>
#include <cassert>
#include "min_allocator.h"
@@ -48,14 +49,17 @@ int main()
r = c.equal_range(5);
assert(std::distance(r.first, r.second) == 0);
r = c.equal_range(50);
- assert(r.first->first == 50);
- assert(r.first->second == "fifty");
- ++r.first;
- assert(r.first->first == 50);
- assert(r.first->second == "fiftyA");
- ++r.first;
- assert(r.first->first == 50);
- assert(r.first->second == "fiftyB");
+ std::set<std::string> s;
+ s.insert("fifty");
+ s.insert("fiftyA");
+ s.insert("fiftyB");
+ for ( int i = 0; i < 3; ++i )
+ {
+ assert(r.first->first == 50);
+ assert(s.find(r.first->second) != s.end());
+ s.erase(s.find(r.first->second));
+ ++r.first;
+ }
}
#if TEST_STD_VER >= 11
{
@@ -84,14 +88,17 @@ int main()
r = c.equal_range(5);
assert(std::distance(r.first, r.second) == 0);
r = c.equal_range(50);
- assert(r.first->first == 50);
- assert(r.first->second == "fifty");
- ++r.first;
- assert(r.first->first == 50);
- assert(r.first->second == "fiftyA");
- ++r.first;
- assert(r.first->first == 50);
- assert(r.first->second == "fiftyB");
+ std::set<std::string> s;
+ s.insert("fifty");
+ s.insert("fiftyA");
+ s.insert("fiftyB");
+ for ( int i = 0; i < 3; ++i )
+ {
+ assert(r.first->first == 50);
+ assert(s.find(r.first->second) != s.end());
+ s.erase(s.find(r.first->second));
+ ++r.first;
+ }
}
#endif
}
diff --git a/test/std/containers/unord/unord.multimap/equal_range_non_const.pass.cpp b/test/std/containers/unord/unord.multimap/equal_range_non_const.pass.cpp
index 17eb14e442626..10fafee8028f4 100644
--- a/test/std/containers/unord/unord.multimap/equal_range_non_const.pass.cpp
+++ b/test/std/containers/unord/unord.multimap/equal_range_non_const.pass.cpp
@@ -17,6 +17,7 @@
#include <unordered_map>
#include <string>
+#include <set>
#include <cassert>
#include "min_allocator.h"
@@ -48,14 +49,17 @@ int main()
r = c.equal_range(5);
assert(std::distance(r.first, r.second) == 0);
r = c.equal_range(50);
- assert(r.first->first == 50);
- assert(r.first->second == "fifty");
- ++r.first;
- assert(r.first->first == 50);
- assert(r.first->second == "fiftyA");
- ++r.first;
- assert(r.first->first == 50);
- assert(r.first->second == "fiftyB");
+ std::set<std::string> s;
+ s.insert("fifty");
+ s.insert("fiftyA");
+ s.insert("fiftyB");
+ for ( int i = 0; i < 3; ++i )
+ {
+ assert(r.first->first == 50);
+ assert(s.find(r.first->second) != s.end());
+ s.erase(s.find(r.first->second));
+ ++r.first;
+ }
}
#if TEST_STD_VER >= 11
{
@@ -84,14 +88,17 @@ int main()
r = c.equal_range(5);
assert(std::distance(r.first, r.second) == 0);
r = c.equal_range(50);
- assert(r.first->first == 50);
- assert(r.first->second == "fifty");
- ++r.first;
- assert(r.first->first == 50);
- assert(r.first->second == "fiftyA");
- ++r.first;
- assert(r.first->first == 50);
- assert(r.first->second == "fiftyB");
+ std::set<std::string> s;
+ s.insert("fifty");
+ s.insert("fiftyA");
+ s.insert("fiftyB");
+ for ( int i = 0; i < 3; ++i )
+ {
+ assert(r.first->first == 50);
+ assert(s.find(r.first->second) != s.end());
+ s.erase(s.find(r.first->second));
+ ++r.first;
+ }
}
#endif
}
diff --git a/test/std/containers/unord/unord.multimap/erase_if.pass.cpp b/test/std/containers/unord/unord.multimap/erase_if.pass.cpp
new file mode 100644
index 0000000000000..dc613269a3535
--- /dev/null
+++ b/test/std/containers/unord/unord.multimap/erase_if.pass.cpp
@@ -0,0 +1,90 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
+
+// <unordered_map>
+
+// template <class Key, class T, class Hash, class Pred, class Allocator, class Predicate>
+// void erase_if(unordered_multimap<Key, T, Hash, Pred, Allocator>& c, Predicate pred);
+
+#include <unordered_map>
+
+#include "test_macros.h"
+#include "test_allocator.h"
+#include "min_allocator.h"
+
+using Init = std::initializer_list<int>;
+template <typename M>
+M make (Init vals)
+{
+ M ret;
+ for (int v : vals)
+ ret.insert(typename M::value_type(v, v + 10));
+ return ret;
+}
+
+template <typename M, typename Pred>
+void
+test0(Init vals, Pred p, Init expected)
+{
+ M s = make<M> (vals);
+ ASSERT_SAME_TYPE(void, decltype(std::erase_if(s, p)));
+ std::erase_if(s, p);
+ M e = make<M>(expected);
+ assert((std::is_permutation(s.begin(), s.end(), e.begin(), e.end())));
+}
+
+template <typename S>
+void test()
+{
+ auto is1 = [](auto v) { return v.first == 1;};
+ auto is2 = [](auto v) { return v.first == 2;};
+ auto is3 = [](auto v) { return v.first == 3;};
+ auto is4 = [](auto v) { return v.first == 4;};
+ auto True = [](auto) { return true; };
+ auto False = [](auto) { return false; };
+
+ test0<S>({}, is1, {});
+
+ test0<S>({1}, is1, {});
+ test0<S>({1}, is2, {1});
+
+ test0<S>({1,2}, is1, {2});
+ test0<S>({1,2}, is2, {1});
+ test0<S>({1,2}, is3, {1,2});
+ test0<S>({1,1}, is1, {});
+ test0<S>({1,1}, is3, {1,1});
+
+ test0<S>({1,2,3}, is1, {2,3});
+ test0<S>({1,2,3}, is2, {1,3});
+ test0<S>({1,2,3}, is3, {1,2});
+ test0<S>({1,2,3}, is4, {1,2,3});
+
+ test0<S>({1,1,1}, is1, {});
+ test0<S>({1,1,1}, is2, {1,1,1});
+ test0<S>({1,1,2}, is1, {2});
+ test0<S>({1,1,2}, is2, {1,1});
+ test0<S>({1,1,2}, is3, {1,1,2});
+ test0<S>({1,2,2}, is1, {2,2});
+ test0<S>({1,2,2}, is2, {1});
+ test0<S>({1,2,2}, is3, {1,2,2});
+
+ test0<S>({1,2,3}, True, {});
+ test0<S>({1,2,3}, False, {1,2,3});
+}
+
+int main()
+{
+ test<std::unordered_multimap<int, int>>();
+ test<std::unordered_multimap<int, int, std::hash<int>, std::equal_to<int>, min_allocator<std::pair<const int, int>>>> ();
+ test<std::unordered_multimap<int, int, std::hash<int>, std::equal_to<int>, test_allocator<std::pair<const int, int>>>> ();
+
+ test<std::unordered_multimap<long, short>>();
+ test<std::unordered_multimap<short, double>>();
+}
diff --git a/test/std/containers/unord/unord.multimap/local_iterators.pass.cpp b/test/std/containers/unord/unord.multimap/local_iterators.pass.cpp
index 504fe54de830d..2976d2c3c8c11 100644
--- a/test/std/containers/unord/unord.multimap/local_iterators.pass.cpp
+++ b/test/std/containers/unord/unord.multimap/local_iterators.pass.cpp
@@ -22,6 +22,7 @@
#include <unordered_map>
#include <string>
+#include <set>
#include <cassert>
#include "min_allocator.h"
@@ -52,21 +53,35 @@ int main()
i = c.begin(b);
j = c.end(b);
assert(std::distance(i, j) == 2);
- assert(i->first == 1);
- assert(i->second == "one");
- ++i;
- assert(i->first == 1);
- assert(i->second == "four");
+ {
+ std::set<std::string> s;
+ s.insert("one");
+ s.insert("four");
+ for ( int n = 0; n < 2; ++n )
+ {
+ assert(i->first == 1);
+ assert(s.find(i->second) != s.end());
+ s.erase(s.find(i->second));
+ ++i;
+ }
+ }
b = c.bucket(2);
i = c.begin(b);
j = c.end(b);
assert(std::distance(i, j) == 2);
- assert(i->first == 2);
- assert(i->second == "two");
- ++i;
- assert(i->first == 2);
- assert(i->second == "four");
+ {
+ std::set<std::string> s;
+ s.insert("two");
+ s.insert("four");
+ for ( int n = 0; n < 2; ++n )
+ {
+ assert(i->first == 2);
+ assert(s.find(i->second) != s.end());
+ s.erase(s.find(i->second));
+ ++i;
+ }
+ }
b = c.bucket(3);
i = c.begin(b);
@@ -116,21 +131,35 @@ int main()
i = c.begin(b);
j = c.end(b);
assert(std::distance(i, j) == 2);
- assert(i->first == 1);
- assert(i->second == "one");
- ++i;
- assert(i->first == 1);
- assert(i->second == "four");
+ {
+ std::set<std::string> s;
+ s.insert("one");
+ s.insert("four");
+ for ( int n = 0; n < 2; ++n )
+ {
+ assert(i->first == 1);
+ assert(s.find(i->second) != s.end());
+ s.erase(s.find(i->second));
+ ++i;
+ }
+ }
b = c.bucket(2);
i = c.begin(b);
j = c.end(b);
assert(std::distance(i, j) == 2);
- assert(i->first == 2);
- assert(i->second == "two");
- ++i;
- assert(i->first == 2);
- assert(i->second == "four");
+ {
+ std::set<std::string> s;
+ s.insert("two");
+ s.insert("four");
+ for ( int n = 0; n < 2; ++n )
+ {
+ assert(i->first == 2);
+ assert(s.find(i->second) != s.end());
+ s.erase(s.find(i->second));
+ ++i;
+ }
+ }
b = c.bucket(3);
i = c.begin(b);
@@ -180,21 +209,35 @@ int main()
i = c.cbegin(b);
j = c.cend(b);
assert(std::distance(i, j) == 2);
- assert(i->first == 1);
- assert(i->second == "one");
- ++i;
- assert(i->first == 1);
- assert(i->second == "four");
+ {
+ std::set<std::string> s;
+ s.insert("one");
+ s.insert("four");
+ for ( int n = 0; n < 2; ++n )
+ {
+ assert(i->first == 1);
+ assert(s.find(i->second) != s.end());
+ s.erase(s.find(i->second));
+ ++i;
+ }
+ }
b = c.bucket(2);
i = c.cbegin(b);
j = c.cend(b);
assert(std::distance(i, j) == 2);
- assert(i->first == 2);
- assert(i->second == "two");
- ++i;
- assert(i->first == 2);
- assert(i->second == "four");
+ {
+ std::set<std::string> s;
+ s.insert("two");
+ s.insert("four");
+ for ( int n = 0; n < 2; ++n )
+ {
+ assert(i->first == 2);
+ assert(s.find(i->second) != s.end());
+ s.erase(s.find(i->second));
+ ++i;
+ }
+ }
b = c.bucket(3);
i = c.cbegin(b);
@@ -244,21 +287,35 @@ int main()
i = c.cbegin(b);
j = c.cend(b);
assert(std::distance(i, j) == 2);
- assert(i->first == 1);
- assert(i->second == "one");
- ++i;
- assert(i->first == 1);
- assert(i->second == "four");
+ {
+ std::set<std::string> s;
+ s.insert("one");
+ s.insert("four");
+ for ( int n = 0; n < 2; ++n )
+ {
+ assert(i->first == 1);
+ assert(s.find(i->second) != s.end());
+ s.erase(s.find(i->second));
+ ++i;
+ }
+ }
b = c.bucket(2);
i = c.cbegin(b);
j = c.cend(b);
assert(std::distance(i, j) == 2);
- assert(i->first == 2);
- assert(i->second == "two");
- ++i;
- assert(i->first == 2);
- assert(i->second == "four");
+ {
+ std::set<std::string> s;
+ s.insert("two");
+ s.insert("four");
+ for ( int n = 0; n < 2; ++n )
+ {
+ assert(i->first == 2);
+ assert(s.find(i->second) != s.end());
+ s.erase(s.find(i->second));
+ ++i;
+ }
+ }
b = c.bucket(3);
i = c.cbegin(b);
@@ -310,21 +367,35 @@ int main()
i = c.begin(b);
j = c.end(b);
assert(std::distance(i, j) == 2);
- assert(i->first == 1);
- assert(i->second == "one");
- ++i;
- assert(i->first == 1);
- assert(i->second == "four");
+ {
+ std::set<std::string> s;
+ s.insert("one");
+ s.insert("four");
+ for ( int n = 0; n < 2; ++n )
+ {
+ assert(i->first == 1);
+ assert(s.find(i->second) != s.end());
+ s.erase(s.find(i->second));
+ ++i;
+ }
+ }
b = c.bucket(2);
i = c.begin(b);
j = c.end(b);
assert(std::distance(i, j) == 2);
- assert(i->first == 2);
- assert(i->second == "two");
- ++i;
- assert(i->first == 2);
- assert(i->second == "four");
+ {
+ std::set<std::string> s;
+ s.insert("two");
+ s.insert("four");
+ for ( int n = 0; n < 2; ++n )
+ {
+ assert(i->first == 2);
+ assert(s.find(i->second) != s.end());
+ s.erase(s.find(i->second));
+ ++i;
+ }
+ }
b = c.bucket(3);
i = c.begin(b);
@@ -375,21 +446,35 @@ int main()
i = c.begin(b);
j = c.end(b);
assert(std::distance(i, j) == 2);
- assert(i->first == 1);
- assert(i->second == "one");
- ++i;
- assert(i->first == 1);
- assert(i->second == "four");
+ {
+ std::set<std::string> s;
+ s.insert("one");
+ s.insert("four");
+ for ( int n = 0; n < 2; ++n )
+ {
+ assert(i->first == 1);
+ assert(s.find(i->second) != s.end());
+ s.erase(s.find(i->second));
+ ++i;
+ }
+ }
b = c.bucket(2);
i = c.begin(b);
j = c.end(b);
assert(std::distance(i, j) == 2);
- assert(i->first == 2);
- assert(i->second == "two");
- ++i;
- assert(i->first == 2);
- assert(i->second == "four");
+ {
+ std::set<std::string> s;
+ s.insert("two");
+ s.insert("four");
+ for ( int n = 0; n < 2; ++n )
+ {
+ assert(i->first == 2);
+ assert(s.find(i->second) != s.end());
+ s.erase(s.find(i->second));
+ ++i;
+ }
+ }
b = c.bucket(3);
i = c.begin(b);
@@ -440,21 +525,35 @@ int main()
i = c.cbegin(b);
j = c.cend(b);
assert(std::distance(i, j) == 2);
- assert(i->first == 1);
- assert(i->second == "one");
- ++i;
- assert(i->first == 1);
- assert(i->second == "four");
+ {
+ std::set<std::string> s;
+ s.insert("one");
+ s.insert("four");
+ for ( int n = 0; n < 2; ++n )
+ {
+ assert(i->first == 1);
+ assert(s.find(i->second) != s.end());
+ s.erase(s.find(i->second));
+ ++i;
+ }
+ }
b = c.bucket(2);
i = c.cbegin(b);
j = c.cend(b);
assert(std::distance(i, j) == 2);
- assert(i->first == 2);
- assert(i->second == "two");
- ++i;
- assert(i->first == 2);
- assert(i->second == "four");
+ {
+ std::set<std::string> s;
+ s.insert("two");
+ s.insert("four");
+ for ( int n = 0; n < 2; ++n )
+ {
+ assert(i->first == 2);
+ assert(s.find(i->second) != s.end());
+ s.erase(s.find(i->second));
+ ++i;
+ }
+ }
b = c.bucket(3);
i = c.cbegin(b);
@@ -505,21 +604,35 @@ int main()
i = c.cbegin(b);
j = c.cend(b);
assert(std::distance(i, j) == 2);
- assert(i->first == 1);
- assert(i->second == "one");
- ++i;
- assert(i->first == 1);
- assert(i->second == "four");
+ {
+ std::set<std::string> s;
+ s.insert("one");
+ s.insert("four");
+ for ( int n = 0; n < 2; ++n )
+ {
+ assert(i->first == 1);
+ assert(s.find(i->second) != s.end());
+ s.erase(s.find(i->second));
+ ++i;
+ }
+ }
b = c.bucket(2);
i = c.cbegin(b);
j = c.cend(b);
assert(std::distance(i, j) == 2);
- assert(i->first == 2);
- assert(i->second == "two");
- ++i;
- assert(i->first == 2);
- assert(i->second == "four");
+ {
+ std::set<std::string> s;
+ s.insert("two");
+ s.insert("four");
+ for ( int n = 0; n < 2; ++n )
+ {
+ assert(i->first == 2);
+ assert(s.find(i->second) != s.end());
+ s.erase(s.find(i->second));
+ ++i;
+ }
+ }
b = c.bucket(3);
i = c.cbegin(b);
diff --git a/test/std/containers/unord/unord.multimap/max_size.pass.cpp b/test/std/containers/unord/unord.multimap/max_size.pass.cpp
index 5b58bac385a43..228575c2eff80 100644
--- a/test/std/containers/unord/unord.multimap/max_size.pass.cpp
+++ b/test/std/containers/unord/unord.multimap/max_size.pass.cpp
@@ -38,16 +38,16 @@ int main()
typedef std::unordered_multimap<int, int, std::hash<int>,
std::equal_to<int>, A>
C;
- const C::difference_type max_dist =
- std::numeric_limits<C::difference_type>::max();
+ const C::size_type max_dist =
+ static_cast<C::size_type>(std::numeric_limits<C::difference_type>::max());
C c;
assert(c.max_size() <= max_dist);
LIBCPP_ASSERT(c.max_size() == max_dist);
}
{
typedef std::unordered_multimap<char, int> C;
- const C::difference_type max_dist =
- std::numeric_limits<C::difference_type>::max();
+ const C::size_type max_dist =
+ static_cast<C::size_type>(std::numeric_limits<C::difference_type>::max());
C c;
assert(c.max_size() <= max_dist);
assert(c.max_size() <= alloc_max_size(c.get_allocator()));
diff --git a/test/std/containers/unord/unord.multimap/rehash.pass.cpp b/test/std/containers/unord/unord.multimap/rehash.pass.cpp
index 22202ccb612af..e8394d7f752d4 100644
--- a/test/std/containers/unord/unord.multimap/rehash.pass.cpp
+++ b/test/std/containers/unord/unord.multimap/rehash.pass.cpp
@@ -17,6 +17,7 @@
#include <unordered_map>
#include <string>
+#include <set>
#include <cassert>
#include <cfloat>
#include <cmath>
@@ -39,20 +40,33 @@ void test(const C& c)
Eq eq = c.equal_range(1);
assert(std::distance(eq.first, eq.second) == 2);
typename C::const_iterator i = eq.first;
- assert(i->first == 1);
- assert(i->second == "one");
- ++i;
- assert(i->first == 1);
- assert(i->second == "four");
+ {
+ std::set<std::string> s;
+ s.insert("one");
+ s.insert("four");
+ for ( int n = 0; n < 2; ++n )
+ {
+ assert(i->first == 1);
+ assert(s.find(i->second) != s.end());
+ s.erase(s.find(i->second));
+ ++i;
+ }
+ }
eq = c.equal_range(2);
assert(std::distance(eq.first, eq.second) == 2);
i = eq.first;
- assert(i->first == 2);
- assert(i->second == "two");
- ++i;
- assert(i->first == 2);
- assert(i->second == "four");
-
+ {
+ std::set<std::string> s;
+ s.insert("two");
+ s.insert("four");
+ for ( int n = 0; n < 2; ++n )
+ {
+ assert(i->first == 2);
+ assert(s.find(i->second) != s.end());
+ s.erase(s.find(i->second));
+ ++i;
+ }
+ }
eq = c.equal_range(3);
assert(std::distance(eq.first, eq.second) == 1);
i = eq.first;
diff --git a/test/std/containers/unord/unord.multimap/reserve.pass.cpp b/test/std/containers/unord/unord.multimap/reserve.pass.cpp
index d86c69c88f25e..0033377741d7c 100644
--- a/test/std/containers/unord/unord.multimap/reserve.pass.cpp
+++ b/test/std/containers/unord/unord.multimap/reserve.pass.cpp
@@ -13,10 +13,11 @@
// class Alloc = allocator<pair<const Key, T>>>
// class unordered_multimap
-// void rehash(size_type n);
+// void reserve(size_type n);
#include <unordered_map>
#include <string>
+#include <set>
#include <cassert>
#include "test_macros.h"
@@ -26,10 +27,22 @@ template <class C>
void test(const C& c)
{
assert(c.size() == 6);
- assert(c.find(1)->second == "one");
- assert(next(c.find(1))->second == "four");
- assert(c.find(2)->second == "two");
- assert(next(c.find(2))->second == "four");
+ {
+ std::set<std::string> s;
+ s.insert("one");
+ s.insert("four");
+ assert(s.find(c.find(1)->second) != s.end());
+ s.erase(s.find(c.find(1)->second));
+ assert(s.find(next(c.find(1))->second) != s.end());
+ }
+ {
+ std::set<std::string> s;
+ s.insert("two");
+ s.insert("four");
+ assert(s.find(c.find(2)->second) != s.end());
+ s.erase(s.find(c.find(2)->second));
+ assert(s.find(next(c.find(2))->second) != s.end());
+ }
assert(c.find(3)->second == "three");
assert(c.find(4)->second == "four");
}
diff --git a/test/std/containers/unord/unord.multimap/swap_member.pass.cpp b/test/std/containers/unord/unord.multimap/swap_member.pass.cpp
index 8c5ddab054e57..3f0259794ffba 100644
--- a/test/std/containers/unord/unord.multimap/swap_member.pass.cpp
+++ b/test/std/containers/unord/unord.multimap/swap_member.pass.cpp
@@ -17,6 +17,7 @@
#include <unordered_map>
#include <string>
+#include <set>
#include <cassert>
#include <cstddef>
@@ -136,10 +137,22 @@ int main()
assert(c2.bucket_count() >= 6);
assert(c2.size() == 6);
- assert(c2.find(1)->second == "one");
- assert(next(c2.find(1))->second == "four");
- assert(c2.find(2)->second == "two");
- assert(next(c2.find(2))->second == "four");
+ {
+ std::set<std::string> s;
+ s.insert("one");
+ s.insert("four");
+ assert(s.find(c2.find(1)->second) != s.end());
+ s.erase(s.find(c2.find(1)->second));
+ assert(s.find(next(c2.find(1))->second) != s.end());
+ }
+ {
+ std::set<std::string> s;
+ s.insert("two");
+ s.insert("four");
+ assert(s.find(c2.find(2)->second) != s.end());
+ s.erase(s.find(c2.find(2)->second));
+ assert(s.find(next(c2.find(2))->second) != s.end());
+ }
assert(c2.find(3)->second == "three");
assert(c2.find(4)->second == "four");
assert(c2.hash_function() == Hash(1));
@@ -199,10 +212,22 @@ int main()
assert(c2.bucket_count() >= 6);
assert(c2.size() == 6);
- assert(c2.find(1)->second == "one");
- assert(next(c2.find(1))->second == "four");
- assert(c2.find(2)->second == "two");
- assert(next(c2.find(2))->second == "four");
+ {
+ std::set<std::string> s;
+ s.insert("one");
+ s.insert("four");
+ assert(s.find(c2.find(1)->second) != s.end());
+ s.erase(s.find(c2.find(1)->second));
+ assert(s.find(next(c2.find(1))->second) != s.end());
+ }
+ {
+ std::set<std::string> s;
+ s.insert("two");
+ s.insert("four");
+ assert(s.find(c2.find(2)->second) != s.end());
+ s.erase(s.find(c2.find(2)->second));
+ assert(s.find(next(c2.find(2))->second) != s.end());
+ }
assert(c2.find(3)->second == "three");
assert(c2.find(4)->second == "four");
assert(c2.hash_function() == Hash(1));
@@ -320,10 +345,22 @@ int main()
assert(c2.bucket_count() >= 6);
assert(c2.size() == 6);
- assert(c2.find(1)->second == "one");
- assert(next(c2.find(1))->second == "four");
- assert(c2.find(2)->second == "two");
- assert(next(c2.find(2))->second == "four");
+ {
+ std::set<std::string> s;
+ s.insert("one");
+ s.insert("four");
+ assert(s.find(c2.find(1)->second) != s.end());
+ s.erase(s.find(c2.find(1)->second));
+ assert(s.find(next(c2.find(1))->second) != s.end());
+ }
+ {
+ std::set<std::string> s;
+ s.insert("two");
+ s.insert("four");
+ assert(s.find(c2.find(2)->second) != s.end());
+ s.erase(s.find(c2.find(2)->second));
+ assert(s.find(next(c2.find(2))->second) != s.end());
+ }
assert(c2.find(3)->second == "three");
assert(c2.find(4)->second == "four");
assert(c2.hash_function() == Hash(1));
@@ -383,10 +420,22 @@ int main()
assert(c2.bucket_count() >= 6);
assert(c2.size() == 6);
- assert(c2.find(1)->second == "one");
- assert(next(c2.find(1))->second == "four");
- assert(c2.find(2)->second == "two");
- assert(next(c2.find(2))->second == "four");
+ {
+ std::set<std::string> s;
+ s.insert("one");
+ s.insert("four");
+ assert(s.find(c2.find(1)->second) != s.end());
+ s.erase(s.find(c2.find(1)->second));
+ assert(s.find(next(c2.find(1))->second) != s.end());
+ }
+ {
+ std::set<std::string> s;
+ s.insert("two");
+ s.insert("four");
+ assert(s.find(c2.find(2)->second) != s.end());
+ s.erase(s.find(c2.find(2)->second));
+ assert(s.find(next(c2.find(2))->second) != s.end());
+ }
assert(c2.find(3)->second == "three");
assert(c2.find(4)->second == "four");
assert(c2.hash_function() == Hash(1));
@@ -504,10 +553,22 @@ int main()
assert(c2.bucket_count() >= 6);
assert(c2.size() == 6);
- assert(c2.find(1)->second == "one");
- assert(next(c2.find(1))->second == "four");
- assert(c2.find(2)->second == "two");
- assert(next(c2.find(2))->second == "four");
+ {
+ std::set<std::string> s;
+ s.insert("one");
+ s.insert("four");
+ assert(s.find(c2.find(1)->second) != s.end());
+ s.erase(s.find(c2.find(1)->second));
+ assert(s.find(next(c2.find(1))->second) != s.end());
+ }
+ {
+ std::set<std::string> s;
+ s.insert("two");
+ s.insert("four");
+ assert(s.find(c2.find(2)->second) != s.end());
+ s.erase(s.find(c2.find(2)->second));
+ assert(s.find(next(c2.find(2))->second) != s.end());
+ }
assert(c2.find(3)->second == "three");
assert(c2.find(4)->second == "four");
assert(c2.hash_function() == Hash(1));
@@ -567,10 +628,22 @@ int main()
assert(c2.bucket_count() >= 6);
assert(c2.size() == 6);
- assert(c2.find(1)->second == "one");
- assert(next(c2.find(1))->second == "four");
- assert(c2.find(2)->second == "two");
- assert(next(c2.find(2))->second == "four");
+ {
+ std::set<std::string> s;
+ s.insert("one");
+ s.insert("four");
+ assert(s.find(c2.find(1)->second) != s.end());
+ s.erase(s.find(c2.find(1)->second));
+ assert(s.find(next(c2.find(1))->second) != s.end());
+ }
+ {
+ std::set<std::string> s;
+ s.insert("two");
+ s.insert("four");
+ assert(s.find(c2.find(2)->second) != s.end());
+ s.erase(s.find(c2.find(2)->second));
+ assert(s.find(next(c2.find(2))->second) != s.end());
+ }
assert(c2.find(3)->second == "three");
assert(c2.find(4)->second == "four");
assert(c2.hash_function() == Hash(1));
diff --git a/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/assign_copy.pass.cpp b/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/assign_copy.pass.cpp
index 62e756cda3b17..d5729e350dc34 100644
--- a/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/assign_copy.pass.cpp
+++ b/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/assign_copy.pass.cpp
@@ -19,6 +19,8 @@
#include <string>
#include <cassert>
#include <cfloat>
+#include <cmath>
+#include <algorithm>
#include <cstddef>
#include "test_macros.h"
diff --git a/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/assign_init.pass.cpp b/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/assign_init.pass.cpp
index cefbf45965507..f06ed700fb460 100644
--- a/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/assign_init.pass.cpp
+++ b/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/assign_init.pass.cpp
@@ -21,6 +21,7 @@
#include <string>
#include <cassert>
#include <cfloat>
+#include <cmath>
#include <cstddef>
#include "../../../test_compare.h"
diff --git a/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/assign_move.pass.cpp b/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/assign_move.pass.cpp
index 9bd55ac92e899..11a1759bbc452 100644
--- a/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/assign_move.pass.cpp
+++ b/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/assign_move.pass.cpp
@@ -21,6 +21,7 @@
#include <string>
#include <cassert>
#include <cfloat>
+#include <cmath>
#include <cstddef>
#include "test_macros.h"
diff --git a/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/init.pass.cpp b/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/init.pass.cpp
index 1a222cef1509c..b3519fd5056de 100644
--- a/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/init.pass.cpp
+++ b/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/init.pass.cpp
@@ -21,6 +21,7 @@
#include <string>
#include <cassert>
#include <cfloat>
+#include <cmath>
#include <cstddef>
#include "test_macros.h"
diff --git a/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/range.pass.cpp b/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/range.pass.cpp
index 11465edae3e5f..7baf11f52c041 100644
--- a/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/range.pass.cpp
+++ b/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/range.pass.cpp
@@ -20,6 +20,7 @@
#include <string>
#include <cassert>
#include <cfloat>
+#include <cmath>
#include <cstddef>
#include "test_macros.h"
diff --git a/test/std/containers/unord/unord.multimap/unord.multimap.modifiers/clear.pass.cpp b/test/std/containers/unord/unord.multimap/unord.multimap.modifiers/clear.pass.cpp
index 891d44911eb05..15c78208a6160 100644
--- a/test/std/containers/unord/unord.multimap/unord.multimap.modifiers/clear.pass.cpp
+++ b/test/std/containers/unord/unord.multimap/unord.multimap.modifiers/clear.pass.cpp
@@ -13,12 +13,13 @@
// class Alloc = allocator<pair<const Key, T>>>
// class unordered_multimap
-// void clear()
+// void clear() noexcept;
#include <unordered_map>
#include <string>
#include <cassert>
+#include "test_macros.h"
#include "min_allocator.h"
int main()
@@ -36,6 +37,7 @@ int main()
P(2, "four"),
};
C c(a, a + sizeof(a)/sizeof(a[0]));
+ ASSERT_NOEXCEPT(c.clear());
c.clear();
assert(c.size() == 0);
}
@@ -54,6 +56,7 @@ int main()
P(2, "four"),
};
C c(a, a + sizeof(a)/sizeof(a[0]));
+ ASSERT_NOEXCEPT(c.clear());
c.clear();
assert(c.size() == 0);
}
diff --git a/test/std/containers/unord/unord.multimap/unord.multimap.modifiers/merge.pass.cpp b/test/std/containers/unord/unord.multimap/unord.multimap.modifiers/merge.pass.cpp
new file mode 100644
index 0000000000000..b7f61ca5adc20
--- /dev/null
+++ b/test/std/containers/unord/unord.multimap/unord.multimap.modifiers/merge.pass.cpp
@@ -0,0 +1,157 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++98, c++03, c++11, c++14
+
+// <unordered_map>
+
+// class unordered_multimap
+
+// template <class H2, class P2>
+// void merge(unordered_map<key_type, value_type, H2, P2, allocator_type>& source);
+// template <class H2, class P2>
+// void merge(unordered_map<key_type, value_type, H2, P2, allocator_type>&& source);
+// template <class H2, class P2>
+// void merge(unordered_multimap<key_type, value_type, H2, P2, allocator_type>& source);
+// template <class H2, class P2>
+// void merge(unordered_multimap<key_type, value_type, H2, P2, allocator_type>&& source);
+
+#include <unordered_map>
+#include <cassert>
+#include "test_macros.h"
+#include "Counter.h"
+
+template <class Map>
+bool map_equal(const Map& map, Map other)
+{
+ return map == other;
+}
+
+#ifndef TEST_HAS_NO_EXCEPTIONS
+template <class T>
+struct throw_hasher
+{
+ bool& should_throw_;
+
+ throw_hasher(bool& should_throw) : should_throw_(should_throw) {}
+
+ size_t operator()(const T& p) const
+ {
+ if (should_throw_)
+ throw 0;
+ return std::hash<T>()(p);
+ }
+};
+#endif
+
+int main()
+{
+ {
+ std::unordered_multimap<int, int> src{{1, 0}, {3, 0}, {5, 0}};
+ std::unordered_multimap<int, int> dst{{2, 0}, {4, 0}, {5, 0}};
+ dst.merge(src);
+ assert(map_equal(src, {}));
+ assert(map_equal(dst, {{1, 0}, {2, 0}, {3, 0}, {4, 0}, {5, 0}, {5, 0}}));
+ }
+
+#ifndef TEST_HAS_NO_EXCEPTIONS
+ {
+ bool do_throw = false;
+ typedef std::unordered_multimap<Counter<int>, int, throw_hasher<Counter<int>>> map_type;
+ map_type src({{1, 0}, {3, 0}, {5, 0}}, 0, throw_hasher<Counter<int>>(do_throw));
+ map_type dst({{2, 0}, {4, 0}, {5, 0}}, 0, throw_hasher<Counter<int>>(do_throw));
+
+ assert(Counter_base::gConstructed == 6);
+
+ do_throw = true;
+ try
+ {
+ dst.merge(src);
+ }
+ catch (int)
+ {
+ do_throw = false;
+ }
+ assert(!do_throw);
+ assert(map_equal(src, map_type({{1, 0}, {3, 0}, {5, 0}}, 0, throw_hasher<Counter<int>>(do_throw))));
+ assert(map_equal(dst, map_type({{2, 0}, {4, 0}, {5, 0}}, 0, throw_hasher<Counter<int>>(do_throw))));
+ }
+#endif
+ assert(Counter_base::gConstructed == 0);
+ struct equal
+ {
+ equal() = default;
+
+ bool operator()(const Counter<int>& lhs, const Counter<int>& rhs) const
+ {
+ return lhs == rhs;
+ }
+ };
+ struct hasher
+ {
+ hasher() = default;
+ size_t operator()(const Counter<int>& p) const
+ {
+ return std::hash<Counter<int>>()(p);
+ }
+ };
+ {
+ typedef std::unordered_multimap<Counter<int>, int, std::hash<Counter<int>>, std::equal_to<Counter<int>>> first_map_type;
+ typedef std::unordered_multimap<Counter<int>, int, hasher, equal> second_map_type;
+ typedef std::unordered_map<Counter<int>, int, hasher, equal> third_map_type;
+
+ {
+ first_map_type first{{1, 0}, {2, 0}, {3, 0}};
+ second_map_type second{{2, 0}, {3, 0}, {4, 0}};
+ third_map_type third{{1, 0}, {3, 0}};
+
+ assert(Counter_base::gConstructed == 8);
+
+ first.merge(second);
+ first.merge(third);
+
+ assert(map_equal(first, {{1, 0}, {2, 0}, {3, 0}, {4, 0}, {2, 0}, {3, 0}, {1, 0}, {3, 0}}));
+ assert(map_equal(second, {}));
+ assert(map_equal(third, {}));
+
+ assert(Counter_base::gConstructed == 8);
+ }
+ assert(Counter_base::gConstructed == 0);
+ {
+ first_map_type first{{1, 0}, {2, 0}, {3, 0}};
+ second_map_type second{{2, 0}, {3, 0}, {4, 0}};
+ third_map_type third{{1, 0}, {3, 0}};
+
+ assert(Counter_base::gConstructed == 8);
+
+ first.merge(std::move(second));
+ first.merge(std::move(third));
+
+ assert(map_equal(first, {{1, 0}, {2, 0}, {3, 0}, {4, 0}, {2, 0}, {3, 0}, {1, 0}, {3, 0}}));
+ assert(map_equal(second, {}));
+ assert(map_equal(third, {}));
+
+ assert(Counter_base::gConstructed == 8);
+ }
+ assert(Counter_base::gConstructed == 0);
+ }
+ {
+ std::unordered_multimap<int, int> first;
+ {
+ std::unordered_multimap<int, int> second;
+ first.merge(second);
+ first.merge(std::move(second));
+ }
+ {
+ std::unordered_map<int, int> second;
+ first.merge(second);
+ first.merge(std::move(second));
+ }
+ }
+}
diff --git a/test/std/containers/unord/unord.multiset/clear.pass.cpp b/test/std/containers/unord/unord.multiset/clear.pass.cpp
index 57dbb8b1faaa1..b699d0624ddd5 100644
--- a/test/std/containers/unord/unord.multiset/clear.pass.cpp
+++ b/test/std/containers/unord/unord.multiset/clear.pass.cpp
@@ -13,11 +13,12 @@
// class Alloc = allocator<Value>>
// class unordered_multiset
-// void clear()
+// void clear() noexcept;
#include <unordered_set>
#include <cassert>
+#include "test_macros.h"
#include "min_allocator.h"
int main()
@@ -35,6 +36,7 @@ int main()
P(2)
};
C c(a, a + sizeof(a)/sizeof(a[0]));
+ ASSERT_NOEXCEPT(c.clear());
c.clear();
assert(c.size() == 0);
}
@@ -53,6 +55,7 @@ int main()
P(2)
};
C c(a, a + sizeof(a)/sizeof(a[0]));
+ ASSERT_NOEXCEPT(c.clear());
c.clear();
assert(c.size() == 0);
}
diff --git a/test/std/containers/unord/unord.multiset/erase_if.pass.cpp b/test/std/containers/unord/unord.multiset/erase_if.pass.cpp
new file mode 100644
index 0000000000000..7a9d93d432f75
--- /dev/null
+++ b/test/std/containers/unord/unord.multiset/erase_if.pass.cpp
@@ -0,0 +1,91 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
+
+// <set>
+
+// template <class T, class Hash, class Compare, class Allocator, class Predicate>
+// void erase_if(unordered_multiset<T, Hash, Compare, Allocator>& c, Predicate pred);
+
+#include <unordered_set>
+
+#include "test_macros.h"
+#include "test_allocator.h"
+#include "min_allocator.h"
+
+using Init = std::initializer_list<int>;
+
+template <typename M>
+M make (Init vals)
+{
+ M ret;
+ for (int v : vals)
+ ret.insert(v);
+ return ret;
+}
+
+template <typename M, typename Pred>
+void
+test0(Init vals, Pred p, Init expected)
+{
+ M s = make<M> (vals);
+ ASSERT_SAME_TYPE(void, decltype(std::erase_if(s, p)));
+ std::erase_if(s, p);
+ M e = make<M>(expected);
+ assert((std::is_permutation(s.begin(), s.end(), e.begin(), e.end())));
+}
+
+template <typename S>
+void test()
+{
+ auto is1 = [](auto v) { return v == 1;};
+ auto is2 = [](auto v) { return v == 2;};
+ auto is3 = [](auto v) { return v == 3;};
+ auto is4 = [](auto v) { return v == 4;};
+ auto True = [](auto) { return true; };
+ auto False = [](auto) { return false; };
+
+ test0<S>({}, is1, {});
+
+ test0<S>({1}, is1, {});
+ test0<S>({1}, is2, {1});
+
+ test0<S>({1,2}, is1, {2});
+ test0<S>({1,2}, is2, {1});
+ test0<S>({1,2}, is3, {1,2});
+ test0<S>({1,1}, is1, {});
+ test0<S>({1,1}, is3, {1,1});
+
+ test0<S>({1,2,3}, is1, {2,3});
+ test0<S>({1,2,3}, is2, {1,3});
+ test0<S>({1,2,3}, is3, {1,2});
+ test0<S>({1,2,3}, is4, {1,2,3});
+
+ test0<S>({1,1,1}, is1, {});
+ test0<S>({1,1,1}, is2, {1,1,1});
+ test0<S>({1,1,2}, is1, {2});
+ test0<S>({1,1,2}, is2, {1,1});
+ test0<S>({1,1,2}, is3, {1,1,2});
+ test0<S>({1,2,2}, is1, {2,2});
+ test0<S>({1,2,2}, is2, {1});
+ test0<S>({1,2,2}, is3, {1,2,2});
+
+ test0<S>({1,2,3}, True, {});
+ test0<S>({1,2,3}, False, {1,2,3});
+}
+
+int main()
+{
+ test<std::unordered_multiset<int>>();
+ test<std::unordered_multiset<int, std::hash<int>, std::equal_to<int>, min_allocator<int>>> ();
+ test<std::unordered_multiset<int, std::hash<int>, std::equal_to<int>, test_allocator<int>>> ();
+
+ test<std::unordered_multiset<long>>();
+ test<std::unordered_multiset<double>>();
+}
diff --git a/test/std/containers/unord/unord.multiset/erase_range.pass.cpp b/test/std/containers/unord/unord.multiset/erase_range.pass.cpp
index a4f703df85066..14eb7c477fd90 100644
--- a/test/std/containers/unord/unord.multiset/erase_range.pass.cpp
+++ b/test/std/containers/unord/unord.multiset/erase_range.pass.cpp
@@ -17,6 +17,7 @@
#include <unordered_set>
#include <cassert>
+#include <iterator>
#include "min_allocator.h"
diff --git a/test/std/containers/unord/unord.multiset/insert_allocator_requirements.pass.cpp b/test/std/containers/unord/unord.multiset/insert_emplace_allocator_requirements.pass.cpp
index ad7bc043a5b32..4b6e2f769720b 100644
--- a/test/std/containers/unord/unord.multiset/insert_allocator_requirements.pass.cpp
+++ b/test/std/containers/unord/unord.multiset/insert_emplace_allocator_requirements.pass.cpp
@@ -22,4 +22,5 @@
int main()
{
testMultisetInsert<TCT::unordered_multiset<> >();
+ testMultisetEmplace<TCT::unordered_multiset<> >();
}
diff --git a/test/std/containers/unord/unord.multiset/max_size.pass.cpp b/test/std/containers/unord/unord.multiset/max_size.pass.cpp
index eac4db8b0a915..e76624e5cd5f5 100644
--- a/test/std/containers/unord/unord.multiset/max_size.pass.cpp
+++ b/test/std/containers/unord/unord.multiset/max_size.pass.cpp
@@ -37,16 +37,16 @@ int main()
typedef std::unordered_multiset<int, std::hash<int>, std::equal_to<int>,
A>
C;
- const C::difference_type max_dist =
- std::numeric_limits<C::difference_type>::max();
+ const C::size_type max_dist =
+ static_cast<C::size_type>(std::numeric_limits<C::difference_type>::max());
C c;
assert(c.max_size() <= max_dist);
LIBCPP_ASSERT(c.max_size() == max_dist);
}
{
typedef std::unordered_multiset<char> C;
- const C::difference_type max_dist =
- std::numeric_limits<C::difference_type>::max();
+ const C::size_type max_dist =
+ static_cast<C::size_type>(std::numeric_limits<C::difference_type>::max());
C c;
assert(c.max_size() <= max_dist);
assert(c.max_size() <= alloc_max_size(c.get_allocator()));
diff --git a/test/std/containers/unord/unord.multiset/merge.pass.cpp b/test/std/containers/unord/unord.multiset/merge.pass.cpp
new file mode 100644
index 0000000000000..7913f95643622
--- /dev/null
+++ b/test/std/containers/unord/unord.multiset/merge.pass.cpp
@@ -0,0 +1,154 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++98, c++03, c++11, c++14
+
+// <unordered_set>
+
+// class unordered_multiset
+
+// template <class H2, class P2>
+// void merge(unordered_set<key_type, H2, P2, allocator_type>& source);
+// template <class H2, class P2>
+// void merge(unordered_set<key_type, H2, P2, allocator_type>&& source);
+// template <class H2, class P2>
+// void merge(unordered_multiset<key_type, H2, P2, allocator_type>& source);
+// template <class H2, class P2>
+// void merge(unordered_multiset<key_type, H2, P2, allocator_type>&& source);
+
+#include <unordered_set>
+#include <cassert>
+#include "test_macros.h"
+#include "Counter.h"
+
+template <class Set>
+bool set_equal(const Set& set, Set other)
+{
+ return set == other;
+}
+
+#ifndef TEST_HAS_NO_EXCEPTIONS
+template <class T>
+struct throw_hasher
+{
+ bool& should_throw_;
+
+ throw_hasher(bool& should_throw) : should_throw_(should_throw) {}
+
+ size_t operator()(const T& p) const
+ {
+ if (should_throw_)
+ throw 0;
+ return std::hash<T>()(p);
+ }
+};
+#endif
+
+int main()
+{
+ {
+ std::unordered_multiset<int> src{1, 3, 5};
+ std::unordered_multiset<int> dst{2, 4, 5};
+ dst.merge(src);
+ assert(set_equal(src, {}));
+ assert(set_equal(dst, {1, 2, 3, 4, 5, 5}));
+ }
+
+#ifndef TEST_HAS_NO_EXCEPTIONS
+ {
+ bool do_throw = false;
+ typedef std::unordered_multiset<Counter<int>, throw_hasher<Counter<int>>> set_type;
+ set_type src({1, 3, 5}, 0, throw_hasher<Counter<int>>(do_throw));
+ set_type dst({2, 4, 5}, 0, throw_hasher<Counter<int>>(do_throw));
+
+ assert(Counter_base::gConstructed == 6);
+
+ do_throw = true;
+ try
+ {
+ dst.merge(src);
+ }
+ catch (int)
+ {
+ do_throw = false;
+ }
+ assert(!do_throw);
+ assert(set_equal(src, set_type({1, 3, 5}, 0, throw_hasher<Counter<int>>(do_throw))));
+ assert(set_equal(dst, set_type({2, 4, 5}, 0, throw_hasher<Counter<int>>(do_throw))));
+ }
+#endif
+ assert(Counter_base::gConstructed == 0);
+ struct equal
+ {
+ equal() = default;
+
+ bool operator()(const Counter<int>& lhs, const Counter<int>& rhs) const
+ {
+ return lhs == rhs;
+ }
+ };
+ struct hasher
+ {
+ hasher() = default;
+ size_t operator()(const Counter<int>& p) const { return std::hash<Counter<int>>()(p); }
+ };
+ {
+ typedef std::unordered_multiset<Counter<int>, std::hash<Counter<int>>, std::equal_to<Counter<int>>> first_set_type;
+ typedef std::unordered_multiset<Counter<int>, hasher, equal> second_set_type;
+ typedef std::unordered_set<Counter<int>, hasher, equal> third_set_type;
+
+ {
+ first_set_type first{1, 2, 3};
+ second_set_type second{2, 3, 4};
+ third_set_type third{1, 3};
+
+ assert(Counter_base::gConstructed == 8);
+
+ first.merge(second);
+ first.merge(third);
+
+ assert(set_equal(first, {1, 2, 3, 4, 2, 3, 1, 3}));
+ assert(set_equal(second, {}));
+ assert(set_equal(third, {}));
+
+ assert(Counter_base::gConstructed == 8);
+ }
+ assert(Counter_base::gConstructed == 0);
+ {
+ first_set_type first{1, 2, 3};
+ second_set_type second{2, 3, 4};
+ third_set_type third{1, 3};
+
+ assert(Counter_base::gConstructed == 8);
+
+ first.merge(std::move(second));
+ first.merge(std::move(third));
+
+ assert(set_equal(first, {1, 2, 3, 4, 2, 3, 1, 3}));
+ assert(set_equal(second, {}));
+ assert(set_equal(third, {}));
+
+ assert(Counter_base::gConstructed == 8);
+ }
+ assert(Counter_base::gConstructed == 0);
+ }
+ {
+ std::unordered_multiset<int> first;
+ {
+ std::unordered_multiset<int> second;
+ first.merge(second);
+ first.merge(std::move(second));
+ }
+ {
+ std::unordered_set<int> second;
+ first.merge(second);
+ first.merge(std::move(second));
+ }
+ }
+}
diff --git a/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/assign_copy.pass.cpp b/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/assign_copy.pass.cpp
index b7557c437181f..e1794c0d89551 100644
--- a/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/assign_copy.pass.cpp
+++ b/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/assign_copy.pass.cpp
@@ -16,8 +16,10 @@
// unordered_multiset& operator=(const unordered_multiset& u);
#include <unordered_set>
+#include <algorithm>
#include <cassert>
#include <cfloat>
+#include <cmath>
#include <cstddef>
#include "test_macros.h"
diff --git a/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/assign_init.pass.cpp b/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/assign_init.pass.cpp
index ce664034d1e1a..5ab0209ce6460 100644
--- a/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/assign_init.pass.cpp
+++ b/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/assign_init.pass.cpp
@@ -20,6 +20,7 @@
#include <unordered_set>
#include <cassert>
#include <cfloat>
+#include <cmath>
#include <cstddef>
#include "../../../test_compare.h"
diff --git a/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/assign_move.pass.cpp b/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/assign_move.pass.cpp
index dfcb63e6e0ebf..17ac618fabc5e 100644
--- a/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/assign_move.pass.cpp
+++ b/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/assign_move.pass.cpp
@@ -20,6 +20,7 @@
#include <unordered_set>
#include <cassert>
#include <cfloat>
+#include <cmath>
#include <cstddef>
#include "test_macros.h"
diff --git a/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/init.pass.cpp b/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/init.pass.cpp
index df49abe077ca4..d98b9a7d03996 100644
--- a/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/init.pass.cpp
+++ b/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/init.pass.cpp
@@ -20,6 +20,7 @@
#include <unordered_set>
#include <cassert>
#include <cfloat>
+#include <cmath>
#include <cstddef>
#include "test_macros.h"
diff --git a/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/range.pass.cpp b/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/range.pass.cpp
index a2ee746791d3b..fd3b76316f49b 100644
--- a/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/range.pass.cpp
+++ b/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/range.pass.cpp
@@ -19,6 +19,7 @@
#include <unordered_set>
#include <cassert>
#include <cfloat>
+#include <cmath>
#include <cstddef>
#include "test_macros.h"
diff --git a/test/std/containers/unord/unord.set/clear.pass.cpp b/test/std/containers/unord/unord.set/clear.pass.cpp
index 8ebf748eb8dac..2f22391297c45 100644
--- a/test/std/containers/unord/unord.set/clear.pass.cpp
+++ b/test/std/containers/unord/unord.set/clear.pass.cpp
@@ -13,11 +13,12 @@
// class Alloc = allocator<Value>>
// class unordered_set
-// void clear()
+// void clear() noexcept;
#include <unordered_set>
#include <cassert>
+#include "test_macros.h"
#include "min_allocator.h"
int main()
@@ -35,6 +36,7 @@ int main()
P(2)
};
C c(a, a + sizeof(a)/sizeof(a[0]));
+ ASSERT_NOEXCEPT(c.clear());
c.clear();
assert(c.size() == 0);
}
@@ -52,6 +54,7 @@ int main()
P(2)
};
C c(a, a + sizeof(a)/sizeof(a[0]));
+ ASSERT_NOEXCEPT(c.clear());
c.clear();
assert(c.size() == 0);
}
diff --git a/test/std/containers/unord/unord.set/erase_if.pass.cpp b/test/std/containers/unord/unord.set/erase_if.pass.cpp
new file mode 100644
index 0000000000000..e060fda1fe8cb
--- /dev/null
+++ b/test/std/containers/unord/unord.set/erase_if.pass.cpp
@@ -0,0 +1,81 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
+
+// <unordered_set>
+
+// template <class T, class Hash, class Compare, class Allocator, class Predicate>
+// void erase_if(unorderd_set<T, Hash, Compare, Allocator>& c, Predicate pred);
+
+#include <unordered_set>
+
+#include "test_macros.h"
+#include "test_allocator.h"
+#include "min_allocator.h"
+
+using Init = std::initializer_list<int>;
+
+template <typename M>
+M make (Init vals)
+{
+ M ret;
+ for (int v : vals)
+ ret.insert(v);
+ return ret;
+}
+
+template <typename M, typename Pred>
+void
+test0(Init vals, Pred p, Init expected)
+{
+ M s = make<M> (vals);
+ ASSERT_SAME_TYPE(void, decltype(std::erase_if(s, p)));
+ std::erase_if(s, p);
+ M e = make<M>(expected);
+ assert((std::is_permutation(s.begin(), s.end(), e.begin(), e.end())));
+}
+
+
+template <typename S>
+void test()
+{
+ auto is1 = [](auto v) { return v == 1;};
+ auto is2 = [](auto v) { return v == 2;};
+ auto is3 = [](auto v) { return v == 3;};
+ auto is4 = [](auto v) { return v == 4;};
+ auto True = [](auto) { return true; };
+ auto False = [](auto) { return false; };
+
+ test0<S>({}, is1, {});
+
+ test0<S>({1}, is1, {});
+ test0<S>({1}, is2, {1});
+
+ test0<S>({1,2}, is1, {2});
+ test0<S>({1,2}, is2, {1});
+ test0<S>({1,2}, is3, {1,2});
+
+ test0<S>({1,2,3}, is1, {2,3});
+ test0<S>({1,2,3}, is2, {1,3});
+ test0<S>({1,2,3}, is3, {1,2});
+ test0<S>({1,2,3}, is4, {1,2,3});
+
+ test0<S>({1,2,3}, True, {});
+ test0<S>({1,2,3}, False, {1,2,3});
+}
+
+int main()
+{
+ test<std::unordered_set<int>>();
+ test<std::unordered_set<int, std::hash<int>, std::equal_to<int>, min_allocator<int>>> ();
+ test<std::unordered_set<int, std::hash<int>, std::equal_to<int>, test_allocator<int>>> ();
+
+ test<std::unordered_set<long>>();
+ test<std::unordered_set<double>>();
+}
diff --git a/test/std/containers/unord/unord.set/erase_range.pass.cpp b/test/std/containers/unord/unord.set/erase_range.pass.cpp
index 4e49a86ef836a..ca8250c1e5949 100644
--- a/test/std/containers/unord/unord.set/erase_range.pass.cpp
+++ b/test/std/containers/unord/unord.set/erase_range.pass.cpp
@@ -16,6 +16,7 @@
// iterator erase(const_iterator first, const_iterator last)
#include <unordered_set>
+#include <algorithm>
#include <cassert>
#include "min_allocator.h"
diff --git a/test/std/containers/unord/unord.set/max_size.pass.cpp b/test/std/containers/unord/unord.set/max_size.pass.cpp
index 1b902660d48f7..eb695ae97281b 100644
--- a/test/std/containers/unord/unord.set/max_size.pass.cpp
+++ b/test/std/containers/unord/unord.set/max_size.pass.cpp
@@ -33,16 +33,16 @@ int main()
{
typedef limited_allocator<int, (size_t)-1> A;
typedef std::unordered_set<int, std::hash<int>, std::equal_to<int>, A> C;
- const C::difference_type max_dist =
- std::numeric_limits<C::difference_type>::max();
+ const C::size_type max_dist =
+ static_cast<C::size_type>(std::numeric_limits<C::difference_type>::max());
C c;
assert(c.max_size() <= max_dist);
LIBCPP_ASSERT(c.max_size() == max_dist);
}
{
typedef std::unordered_set<char> C;
- const C::difference_type max_dist =
- std::numeric_limits<C::difference_type>::max();
+ const C::size_type max_dist =
+ static_cast<C::size_type>(std::numeric_limits<C::difference_type>::max());
C c;
assert(c.max_size() <= max_dist);
assert(c.max_size() <= alloc_max_size(c.get_allocator()));
diff --git a/test/std/containers/unord/unord.set/merge.pass.cpp b/test/std/containers/unord/unord.set/merge.pass.cpp
new file mode 100644
index 0000000000000..519d7f1385497
--- /dev/null
+++ b/test/std/containers/unord/unord.set/merge.pass.cpp
@@ -0,0 +1,154 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++98, c++03, c++11, c++14
+
+// <unordered_set>
+
+// class unordered_set
+
+// template <class H2, class P2>
+// void merge(unordered_set<key_type, H2, P2, allocator_type>& source);
+// template <class H2, class P2>
+// void merge(unordered_set<key_type, H2, P2, allocator_type>&& source);
+// template <class H2, class P2>
+// void merge(unordered_multiset<key_type, H2, P2, allocator_type>& source);
+// template <class H2, class P2>
+// void merge(unordered_multiset<key_type, H2, P2, allocator_type>&& source);
+
+#include <unordered_set>
+#include <cassert>
+#include "test_macros.h"
+#include "Counter.h"
+
+template <class Set>
+bool set_equal(const Set& set, Set other)
+{
+ return set == other;
+}
+
+#ifndef TEST_HAS_NO_EXCEPTIONS
+template <class T>
+struct throw_hasher
+{
+ bool& should_throw_;
+
+ throw_hasher(bool& should_throw) : should_throw_(should_throw) {}
+
+ size_t operator()(const T& p) const
+ {
+ if (should_throw_)
+ throw 0;
+ return std::hash<T>()(p);
+ }
+};
+#endif
+
+int main()
+{
+ {
+ std::unordered_set<int> src{1, 3, 5};
+ std::unordered_set<int> dst{2, 4, 5};
+ dst.merge(src);
+ assert(set_equal(src, {5}));
+ assert(set_equal(dst, {1, 2, 3, 4, 5}));
+ }
+
+#ifndef TEST_HAS_NO_EXCEPTIONS
+ {
+ bool do_throw = false;
+ typedef std::unordered_set<Counter<int>, throw_hasher<Counter<int>>> set_type;
+ set_type src({1, 3, 5}, 0, throw_hasher<Counter<int>>(do_throw));
+ set_type dst({2, 4, 5}, 0, throw_hasher<Counter<int>>(do_throw));
+
+ assert(Counter_base::gConstructed == 6);
+
+ do_throw = true;
+ try
+ {
+ dst.merge(src);
+ }
+ catch (int)
+ {
+ do_throw = false;
+ }
+ assert(!do_throw);
+ assert(set_equal(src, set_type({1, 3, 5}, 0, throw_hasher<Counter<int>>(do_throw))));
+ assert(set_equal(dst, set_type({2, 4, 5}, 0, throw_hasher<Counter<int>>(do_throw))));
+ }
+#endif
+ assert(Counter_base::gConstructed == 0);
+ struct equal
+ {
+ equal() = default;
+
+ bool operator()(const Counter<int>& lhs, const Counter<int>& rhs) const
+ {
+ return lhs == rhs;
+ }
+ };
+ struct hasher
+ {
+ hasher() = default;
+ size_t operator()(const Counter<int>& p) const { return std::hash<Counter<int>>()(p); }
+ };
+ {
+ typedef std::unordered_set<Counter<int>, std::hash<Counter<int>>, std::equal_to<Counter<int>>> first_set_type;
+ typedef std::unordered_set<Counter<int>, hasher, equal> second_set_type;
+ typedef std::unordered_multiset<Counter<int>, hasher, equal> third_set_type;
+
+ {
+ first_set_type first{1, 2, 3};
+ second_set_type second{2, 3, 4};
+ third_set_type third{1, 3};
+
+ assert(Counter_base::gConstructed == 8);
+
+ first.merge(second);
+ first.merge(third);
+
+ assert(set_equal(first, {1, 2, 3, 4}));
+ assert(set_equal(second, {2, 3}));
+ assert(set_equal(third, {1, 3}));
+
+ assert(Counter_base::gConstructed == 8);
+ }
+ assert(Counter_base::gConstructed == 0);
+ {
+ first_set_type first{1, 2, 3};
+ second_set_type second{2, 3, 4};
+ third_set_type third{1, 3};
+
+ assert(Counter_base::gConstructed == 8);
+
+ first.merge(std::move(second));
+ first.merge(std::move(third));
+
+ assert(set_equal(first, {1, 2, 3, 4}));
+ assert(set_equal(second, {2, 3}));
+ assert(set_equal(third, {1, 3}));
+
+ assert(Counter_base::gConstructed == 8);
+ }
+ assert(Counter_base::gConstructed == 0);
+ }
+ {
+ std::unordered_set<int> first;
+ {
+ std::unordered_set<int> second;
+ first.merge(second);
+ first.merge(std::move(second));
+ }
+ {
+ std::unordered_multiset<int> second;
+ first.merge(second);
+ first.merge(std::move(second));
+ }
+ }
+}
diff --git a/test/std/containers/unord/unord.set/unord.set.cnstr/assign_copy.pass.cpp b/test/std/containers/unord/unord.set/unord.set.cnstr/assign_copy.pass.cpp
index 0859d8edc85e9..cf473a930fb47 100644
--- a/test/std/containers/unord/unord.set/unord.set.cnstr/assign_copy.pass.cpp
+++ b/test/std/containers/unord/unord.set/unord.set.cnstr/assign_copy.pass.cpp
@@ -16,8 +16,10 @@
// unordered_set& operator=(const unordered_set& u);
#include <unordered_set>
+#include <algorithm>
#include <cassert>
#include <cfloat>
+#include <cmath>
#include <cstddef>
#include "test_macros.h"
diff --git a/test/std/containers/unord/unord.set/unord.set.cnstr/assign_init.pass.cpp b/test/std/containers/unord/unord.set/unord.set.cnstr/assign_init.pass.cpp
index 4f7ccfec652eb..4e0f68c716700 100644
--- a/test/std/containers/unord/unord.set/unord.set.cnstr/assign_init.pass.cpp
+++ b/test/std/containers/unord/unord.set/unord.set.cnstr/assign_init.pass.cpp
@@ -20,6 +20,7 @@
#include <unordered_set>
#include <cassert>
#include <cfloat>
+#include <cmath>
#include <cstddef>
#include "../../../test_compare.h"
diff --git a/test/std/containers/unord/unord.set/unord.set.cnstr/assign_move.pass.cpp b/test/std/containers/unord/unord.set/unord.set.cnstr/assign_move.pass.cpp
index bc3658243995e..f89c45caf7878 100644
--- a/test/std/containers/unord/unord.set/unord.set.cnstr/assign_move.pass.cpp
+++ b/test/std/containers/unord/unord.set/unord.set.cnstr/assign_move.pass.cpp
@@ -20,6 +20,7 @@
#include <unordered_set>
#include <cassert>
#include <cfloat>
+#include <cmath>
#include <cstddef>
#include "test_macros.h"
diff --git a/test/std/containers/unord/unord.set/unord.set.cnstr/init.pass.cpp b/test/std/containers/unord/unord.set/unord.set.cnstr/init.pass.cpp
index 7ba340bf9c3e7..ff46e08f48f7f 100644
--- a/test/std/containers/unord/unord.set/unord.set.cnstr/init.pass.cpp
+++ b/test/std/containers/unord/unord.set/unord.set.cnstr/init.pass.cpp
@@ -20,6 +20,7 @@
#include <unordered_set>
#include <cassert>
#include <cfloat>
+#include <cmath>
#include <cstddef>
#include "test_macros.h"
diff --git a/test/std/containers/unord/unord.set/unord.set.cnstr/range.pass.cpp b/test/std/containers/unord/unord.set/unord.set.cnstr/range.pass.cpp
index 5bcc288aacbde..b6ad0e2a189b6 100644
--- a/test/std/containers/unord/unord.set/unord.set.cnstr/range.pass.cpp
+++ b/test/std/containers/unord/unord.set/unord.set.cnstr/range.pass.cpp
@@ -19,6 +19,7 @@
#include <unordered_set>
#include <cassert>
#include <cfloat>
+#include <cmath>
#include <cstddef>
#include "test_macros.h"
diff --git a/test/std/containers/views/span.comparison/op.eq.pass.cpp b/test/std/containers/views/span.comparison/op.eq.pass.cpp
deleted file mode 100644
index 963054580466a..0000000000000
--- a/test/std/containers/views/span.comparison/op.eq.pass.cpp
+++ /dev/null
@@ -1,168 +0,0 @@
-// -*- C++ -*-
-//===------------------------------ span ---------------------------------===//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file is dual licensed under the MIT and the University of Illinois Open
-// Source Licenses. See LICENSE.TXT for details.
-//
-//===---------------------------------------------------------------------===//
-// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
-
-// <span>
-
-// template<class T, ptrdiff_t X, class U, ptrdiff_t Y>
-// constexpr bool operator==(span<T, X> l, span<U, Y> r);
-//
-//
-// Effects: Equivalent to: return equal(l.begin(), l.end(), r.begin(), r.end());
-//
-
-#include <span>
-#include <cassert>
-
-#include "test_macros.h"
-
-struct A{};
-bool operator==(A, A) {return true;}
-
-constexpr int iArr1[] = { 0, 1, 2, 1, 2, 5, 6, 7, 8, 9};
- int iArr2[] = { 0, 1, 2, 1, 2, 5, 6, 7, 8, 9};
-constexpr float fArr1[] = {0., 1., 2., 1., 2., 5., 6., 7., 8., 9.};
- float fArr2[] = {0., 1., 2., 1., 2., 5., 6., 7., 8., 9.};
-
-
-int main () {
-
- constexpr std::span<const int> csp0d{};
- constexpr std::span<const int> csp1d{iArr1, 10};
- constexpr std::span<const int> csp2d{iArr1 + 3, 2};
- constexpr std::span<const int> csp3d{iArr1 + 1, 2};
- constexpr std::span<const int> csp4d{iArr1 + 6, 2};
-
- constexpr std::span<const int, 0> csp0s{};
- constexpr std::span<const int, 10> csp1s{iArr1, 10};
- constexpr std::span<const int, 2> csp2s{iArr1 + 3, 2};
- constexpr std::span<const int, 2> csp3s{iArr1 + 1, 2};
- constexpr std::span<const int, 2> csp4s{iArr1 + 6, 2};
-
- static_assert( (csp0d == csp0d), "");
- static_assert( (csp0s == csp0s), "");
- static_assert( (csp0s == csp0d), "");
- static_assert( (csp0d == csp0s), "");
-
- static_assert(!(csp0d == csp1d), "");
- static_assert(!(csp0s == csp1s), "");
- static_assert(!(csp0s == csp1d), "");
- static_assert(!(csp0d == csp1s), "");
-
- static_assert( (csp1d == csp1s), "");
- static_assert( (csp1s == csp1d), "");
-
- static_assert( (csp2d == csp3d), "");
- static_assert( (csp2s == csp3s), "");
- static_assert( (csp2d == csp3s), "");
- static_assert( (csp2s == csp3d), "");
-
- static_assert( (csp2d == csp3d), "");
- static_assert( (csp2s == csp3s), "");
- static_assert( (csp2d == csp3s), "");
- static_assert( (csp2s == csp3d), "");
-
- static_assert(!(csp2d == csp4d), "");
- static_assert(!(csp2s == csp4s), "");
- static_assert(!(csp2d == csp4s), "");
- static_assert(!(csp2s == csp4d), "");
-
- static_assert(!(csp4d == csp2d), "");
- static_assert(!(csp4s == csp2s), "");
- static_assert(!(csp4d == csp2s), "");
- static_assert(!(csp4s == csp2d), "");
-
- std::span<int> sp0d{};
- std::span<int> sp1d{iArr2, 10};
- std::span<int> sp2d{iArr2 + 3, 2};
- std::span<int> sp3d{iArr2 + 1, 2};
- std::span<int> sp4d{iArr2 + 6, 2};
-
- std::span<int, 0> sp0s{};
- std::span<int, 10> sp1s{iArr2, 10};
- std::span<int, 2> sp2s{iArr2 + 3, 2};
- std::span<int, 2> sp3s{iArr2 + 1, 2};
- std::span<int, 2> sp4s{iArr2 + 6, 2};
-
- assert( (sp0d == sp0d));
- assert( (sp0s == sp0s));
- assert( (sp0s == sp0d));
- assert( (sp0d == sp0s));
-
- assert(!(sp0d == sp1d));
- assert(!(sp0s == sp1s));
- assert(!(sp0s == sp1d));
- assert(!(sp0d == sp1s));
-
- assert( (sp1d == sp1s));
- assert( (sp1s == sp1d));
-
- assert( (sp2d == sp3d));
- assert( (sp2s == sp3s));
- assert( (sp2d == sp3s));
- assert( (sp2s == sp3d));
-
- assert( (sp2d == sp3d));
- assert( (sp2s == sp3s));
- assert( (sp2d == sp3s));
- assert( (sp2s == sp3d));
-
- assert(!(sp2d == sp4d));
- assert(!(sp2s == sp4s));
- assert(!(sp2d == sp4s));
- assert(!(sp2s == sp4d));
-
- assert(!(sp4d == sp2d));
- assert(!(sp4s == sp2s));
- assert(!(sp4d == sp2s));
- assert(!(sp4s == sp2d));
-
-// cross type comparisons
- assert( (csp0d == sp0d));
- assert( (csp0s == sp0s));
- assert( (csp0s == sp0d));
- assert( (csp0d == sp0s));
-
- assert(!(csp0d == sp1d));
- assert(!(csp0s == sp1s));
- assert(!(csp0s == sp1d));
- assert(!(csp0d == sp1s));
-
- assert( (csp1d == sp1s));
- assert( (csp1s == sp1d));
-
- assert( (csp2d == sp3d));
- assert( (csp2s == sp3s));
- assert( (csp2d == sp3s));
- assert( (csp2s == sp3d));
-
- assert( (csp2d == sp3d));
- assert( (csp2s == sp3s));
- assert( (csp2d == sp3s));
- assert( (csp2s == sp3d));
-
- assert(!(csp2d == sp4d));
- assert(!(csp2s == sp4s));
- assert(!(csp2d == sp4s));
- assert(!(csp2s == sp4d));
-
- assert(!(csp4d == sp2d));
- assert(!(csp4s == sp2s));
- assert(!(csp4d == sp2s));
- assert(!(csp4s == sp2d));
-
-// More cross-type comparisons (int vs float)
- static_assert(std::span<const float>{fArr1} == std::span<const int>{iArr1}, "");
- static_assert(std::span<const int>{iArr1} == std::span<const float>{fArr1}, "");
- assert(std::span<float>{fArr2} == std::span<int>{iArr2});
- assert(std::span<int>{iArr2} == std::span<float>{fArr2});
-
- static_assert(!(std::span<const int>{iArr1, 9} == std::span<const float>{fArr1, 8}), "");
-} \ No newline at end of file
diff --git a/test/std/containers/views/span.comparison/op.ge.pass.cpp b/test/std/containers/views/span.comparison/op.ge.pass.cpp
deleted file mode 100644
index 8ec1b9a590eba..0000000000000
--- a/test/std/containers/views/span.comparison/op.ge.pass.cpp
+++ /dev/null
@@ -1,153 +0,0 @@
-// -*- C++ -*-
-//===------------------------------ span ---------------------------------===//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file is dual licensed under the MIT and the University of Illinois Open
-// Source Licenses. See LICENSE.TXT for details.
-//
-//===---------------------------------------------------------------------===//
-// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
-
-// <span>
-
-// template<class T, ptrdiff_t X, class U, ptrdiff_t Y>
-// constexpr bool operator>=(span<T, X> l, span<U, Y> r);
-//
-//
-// Effects: Equivalent to: return !(l < r);
-//
-
-#include <span>
-#include <cassert>
-
-#include "test_macros.h"
-
-struct A{};
-bool operator==(A, A) {return true;}
-
-constexpr int iArr1[] = { 0, 1, 2, 1, 2, 5, 6, 7, 8, 9};
- int iArr2[] = { 0, 1, 2, 1, 2, 5, 6, 7, 8, 9};
-constexpr float fArr1[] = {0., 1., 2., 1., 2., 5., 6., 7., 8., 9.};
- float fArr2[] = {0., 1., 2., 1., 2., 5., 6., 7., 8., 9.};
-
-
-int main () {
-
- constexpr std::span<const int> csp0d{};
- constexpr std::span<const int> csp1d{iArr1, 10};
- constexpr std::span<const int> csp2d{iArr1 + 3, 2};
- constexpr std::span<const int> csp3d{iArr1 + 1, 2};
- constexpr std::span<const int> csp4d{iArr1 + 6, 2};
-
- constexpr std::span<const int, 0> csp0s{};
- constexpr std::span<const int, 10> csp1s{iArr1, 10};
- constexpr std::span<const int, 2> csp2s{iArr1 + 3, 2};
- constexpr std::span<const int, 2> csp3s{iArr1 + 1, 2};
- constexpr std::span<const int, 2> csp4s{iArr1 + 6, 2};
-
- static_assert( (csp0d >= csp0d), "");
- static_assert( (csp0s >= csp0s), "");
- static_assert( (csp0s >= csp0d), "");
- static_assert( (csp0d >= csp0s), "");
-
- static_assert(!(csp0d >= csp1d), "");
- static_assert(!(csp0s >= csp1s), "");
- static_assert(!(csp0s >= csp1d), "");
- static_assert(!(csp0d >= csp1s), "");
-
- static_assert( (csp1d >= csp1s), "");
- static_assert( (csp1s >= csp1d), "");
-
- static_assert( (csp2d >= csp3d), "");
- static_assert( (csp2s >= csp3s), "");
- static_assert( (csp2d >= csp3s), "");
- static_assert( (csp2s >= csp3d), "");
-
- static_assert(!(csp2d >= csp4d), "");
- static_assert(!(csp2s >= csp4s), "");
- static_assert(!(csp2d >= csp4s), "");
- static_assert(!(csp2s >= csp4d), "");
-
- static_assert( (csp4d >= csp2d), "");
- static_assert( (csp4s >= csp2s), "");
- static_assert( (csp4d >= csp2s), "");
- static_assert( (csp4s >= csp2d), "");
-
- std::span<int> sp0d{};
- std::span<int> sp1d{iArr2, 10};
- std::span<int> sp2d{iArr2 + 3, 2};
- std::span<int> sp3d{iArr2 + 1, 2};
- std::span<int> sp4d{iArr2 + 6, 2};
-
- std::span<int, 0> sp0s{};
- std::span<int, 10> sp1s{iArr2, 10};
- std::span<int, 2> sp2s{iArr2 + 3, 2};
- std::span<int, 2> sp3s{iArr2 + 1, 2};
- std::span<int, 2> sp4s{iArr2 + 6, 2};
-
- assert( (sp0d >= sp0d));
- assert( (sp0s >= sp0s));
- assert( (sp0s >= sp0d));
- assert( (sp0d >= sp0s));
-
- assert(!(sp0d >= sp1d));
- assert(!(sp0s >= sp1s));
- assert(!(sp0s >= sp1d));
- assert(!(sp0d >= sp1s));
-
- assert( (sp1d >= sp1s));
- assert( (sp1s >= sp1d));
-
- assert( (sp2d >= sp3d));
- assert( (sp2s >= sp3s));
- assert( (sp2d >= sp3s));
- assert( (sp2s >= sp3d));
-
- assert(!(sp2d >= sp4d));
- assert(!(sp2s >= sp4s));
- assert(!(sp2d >= sp4s));
- assert(!(sp2s >= sp4d));
-
- assert( (sp4d > sp2d));
- assert( (sp4s > sp2s));
- assert( (sp4d > sp2s));
- assert( (sp4s > sp2d));
-
-// cross type comparisons
- assert( (csp0d >= sp0d));
- assert( (csp0s >= sp0s));
- assert( (csp0s >= sp0d));
- assert( (csp0d >= sp0s));
-
- assert(!(csp0d >= sp1d));
- assert(!(csp0s >= sp1s));
- assert(!(csp0s >= sp1d));
- assert(!(csp0d >= sp1s));
-
- assert( (csp1d >= sp1s));
- assert( (csp1s >= sp1d));
-
- assert( (csp2d >= sp3d));
- assert( (csp2s >= sp3s));
- assert( (csp2d >= sp3s));
- assert( (csp2s >= sp3d));
-
- assert(!(csp2d >= sp4d));
- assert(!(csp2s >= sp4s));
- assert(!(csp2d >= sp4s));
- assert(!(csp2s >= sp4d));
-
- assert( (csp4d > sp2d));
- assert( (csp4s > sp2s));
- assert( (csp4d > sp2s));
- assert( (csp4s > sp2d));
-
-// More cross-type comparisons (int vs float)
- static_assert(!(std::span<const float>{fArr1, 8} >= std::span<const int>{iArr1, 9}), "");
- static_assert(!(std::span<const int>{iArr1, 8} >= std::span<const float>{fArr1, 9}), "");
- assert( (std::span<float>{fArr2} >= std::span<int>{iArr2}));
- assert( (std::span<int>{iArr2} >= std::span<float>{fArr2}));
-
- static_assert( (std::span<const int>{iArr1, 9} >= std::span<const float>{fArr1, 8}), "");
-}
diff --git a/test/std/containers/views/span.comparison/op.gt.pass.cpp b/test/std/containers/views/span.comparison/op.gt.pass.cpp
deleted file mode 100644
index 345a291a62b32..0000000000000
--- a/test/std/containers/views/span.comparison/op.gt.pass.cpp
+++ /dev/null
@@ -1,154 +0,0 @@
-// -*- C++ -*-
-//===------------------------------ span ---------------------------------===//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file is dual licensed under the MIT and the University of Illinois Open
-// Source Licenses. See LICENSE.TXT for details.
-//
-//===---------------------------------------------------------------------===//
-// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
-
-// <span>
-
-// template<class T, ptrdiff_t X, class U, ptrdiff_t Y>
-// constexpr bool operator>(span<T, X> l, span<U, Y> r);
-//
-//
-// Effects: Equivalent to: return (r < l);
-//
-
-#include <span>
-#include <cassert>
-
-#include "test_macros.h"
-
-struct A{};
-bool operator==(A, A) {return true;}
-
-constexpr int iArr1[] = { 0, 1, 2, 1, 2, 5, 6, 7, 8, 9};
- int iArr2[] = { 0, 1, 2, 1, 2, 5, 6, 7, 8, 9};
-constexpr float fArr1[] = {0., 1., 2., 1., 2., 5., 6., 7., 8., 9.};
- float fArr2[] = {0., 1., 2., 1., 2., 5., 6., 7., 8., 9.};
-
-
-int main () {
-
- constexpr std::span<const int> csp0d{};
- constexpr std::span<const int> csp1d{iArr1, 10};
- constexpr std::span<const int> csp2d{iArr1 + 3, 2};
- constexpr std::span<const int> csp3d{iArr1 + 1, 2};
- constexpr std::span<const int> csp4d{iArr1 + 6, 2};
-
- constexpr std::span<const int, 0> csp0s{};
- constexpr std::span<const int, 10> csp1s{iArr1, 10};
- constexpr std::span<const int, 2> csp2s{iArr1 + 3, 2};
- constexpr std::span<const int, 2> csp3s{iArr1 + 1, 2};
- constexpr std::span<const int, 2> csp4s{iArr1 + 6, 2};
-
- static_assert(!(csp0d > csp0d), "");
- static_assert(!(csp0s > csp0s), "");
- static_assert(!(csp0s > csp0d), "");
- static_assert(!(csp0d > csp0s), "");
-
- static_assert(!(csp0d > csp1d), "");
- static_assert(!(csp0s > csp1s), "");
- static_assert(!(csp0s > csp1d), "");
- static_assert(!(csp0d > csp1s), "");
-
- static_assert(!(csp1d > csp1s), "");
- static_assert(!(csp1s > csp1d), "");
-
- static_assert(!(csp2d > csp3d), "");
- static_assert(!(csp2s > csp3s), "");
- static_assert(!(csp2d > csp3s), "");
- static_assert(!(csp2s > csp3d), "");
-
- static_assert(!(csp2d > csp4d), "");
- static_assert(!(csp2s > csp4s), "");
- static_assert(!(csp2d > csp4s), "");
- static_assert(!(csp2s > csp4d), "");
-
- static_assert( (csp4d > csp2d), "");
- static_assert( (csp4s > csp2s), "");
- static_assert( (csp4d > csp2s), "");
- static_assert( (csp4s > csp2d), "");
-
- std::span<int> sp0d{};
- std::span<int> sp1d{iArr2, 10};
- std::span<int> sp2d{iArr2 + 3, 2};
- std::span<int> sp3d{iArr2 + 1, 2};
- std::span<int> sp4d{iArr2 + 6, 2};
-
- std::span<int, 0> sp0s{};
- std::span<int, 10> sp1s{iArr2, 10};
- std::span<int, 2> sp2s{iArr2 + 3, 2};
- std::span<int, 2> sp3s{iArr2 + 1, 2};
- std::span<int, 2> sp4s{iArr2 + 6, 2};
-
- assert(!(sp0d > sp0d));
- assert(!(sp0s > sp0s));
- assert(!(sp0s > sp0d));
- assert(!(sp0d > sp0s));
-
- assert(!(sp0d > sp1d));
- assert(!(sp0s > sp1s));
- assert(!(sp0s > sp1d));
- assert(!(sp0d > sp1s));
-
- assert(!(sp1d > sp1s));
- assert(!(sp1s > sp1d));
-
- assert(!(sp2d > sp3d));
- assert(!(sp2s > sp3s));
- assert(!(sp2d > sp3s));
- assert(!(sp2s > sp3d));
-
- assert(!(sp2d > sp4d));
- assert(!(sp2s > sp4s));
- assert(!(sp2d > sp4s));
- assert(!(sp2s > sp4d));
-
- assert( (sp4d > sp2d));
- assert( (sp4s > sp2s));
- assert( (sp4d > sp2s));
- assert( (sp4s > sp2d));
-
-// cross type comparisons
- assert(!(csp0d > sp0d));
- assert(!(csp0s > sp0s));
- assert(!(csp0s > sp0d));
- assert(!(csp0d > sp0s));
-
- assert(!(csp0d > sp1d));
- assert(!(csp0s > sp1s));
- assert(!(csp0s > sp1d));
- assert(!(csp0d > sp1s));
-
- assert(!(csp1d > sp1s));
- assert(!(csp1s > sp1d));
-
- assert(!(csp2d > sp3d));
- assert(!(csp2s > sp3s));
- assert(!(csp2d > sp3s));
- assert(!(csp2s > sp3d));
-
- assert(!(csp2d > sp4d));
- assert(!(csp2s > sp4s));
- assert(!(csp2d > sp4s));
- assert(!(csp2s > sp4d));
-
- assert( (csp4d > sp2d));
- assert( (csp4s > sp2s));
- assert( (csp4d > sp2s));
- assert( (csp4s > sp2d));
-
-
-// More cross-type comparisons (int vs float)
- static_assert(!(std::span<const float>{fArr1, 8} > std::span<const int>{iArr1, 9}), "");
- static_assert(!(std::span<const int>{iArr1, 8} > std::span<const float>{fArr1, 9}), "");
- assert(!(std::span<float>{fArr2} > std::span<int>{iArr2}));
- assert(!(std::span<int>{iArr2} > std::span<float>{fArr2}));
-
- static_assert( (std::span<const int>{iArr1, 9} > std::span<const float>{fArr1, 8}), "");
-} \ No newline at end of file
diff --git a/test/std/containers/views/span.comparison/op.le.pass.cpp b/test/std/containers/views/span.comparison/op.le.pass.cpp
deleted file mode 100644
index f2fbc86090829..0000000000000
--- a/test/std/containers/views/span.comparison/op.le.pass.cpp
+++ /dev/null
@@ -1,153 +0,0 @@
-// -*- C++ -*-
-//===------------------------------ span ---------------------------------===//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file is dual licensed under the MIT and the University of Illinois Open
-// Source Licenses. See LICENSE.TXT for details.
-//
-//===---------------------------------------------------------------------===//
-// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
-
-// <span>
-
-// template<class T, ptrdiff_t X, class U, ptrdiff_t Y>
-// constexpr bool operator<=(span<T, X> l, span<U, Y> r);
-//
-//
-// Effects: Equivalent to: return !(r < l);
-//
-
-#include <span>
-#include <cassert>
-
-#include "test_macros.h"
-
-struct A{};
-bool operator==(A, A) {return true;}
-
-constexpr int iArr1[] = { 0, 1, 2, 1, 2, 5, 6, 7, 8, 9};
- int iArr2[] = { 0, 1, 2, 1, 2, 5, 6, 7, 8, 9};
-constexpr float fArr1[] = {0., 1., 2., 1., 2., 5., 6., 7., 8., 9.};
- float fArr2[] = {0., 1., 2., 1., 2., 5., 6., 7., 8., 9.};
-
-
-int main () {
-
- constexpr std::span<const int> csp0d{};
- constexpr std::span<const int> csp1d{iArr1, 10};
- constexpr std::span<const int> csp2d{iArr1 + 3, 2};
- constexpr std::span<const int> csp3d{iArr1 + 1, 2};
- constexpr std::span<const int> csp4d{iArr1 + 6, 2};
-
- constexpr std::span<const int, 0> csp0s{};
- constexpr std::span<const int, 10> csp1s{iArr1, 10};
- constexpr std::span<const int, 2> csp2s{iArr1 + 3, 2};
- constexpr std::span<const int, 2> csp3s{iArr1 + 1, 2};
- constexpr std::span<const int, 2> csp4s{iArr1 + 6, 2};
-
- static_assert( (csp0d <= csp0d), "");
- static_assert( (csp0s <= csp0s), "");
- static_assert( (csp0s <= csp0d), "");
- static_assert( (csp0d <= csp0s), "");
-
- static_assert( (csp0d <= csp1d), "");
- static_assert( (csp0s <= csp1s), "");
- static_assert( (csp0s <= csp1d), "");
- static_assert( (csp0d <= csp1s), "");
-
- static_assert( (csp1d <= csp1s), "");
- static_assert( (csp1s <= csp1d), "");
-
- static_assert( (csp2d <= csp3d), "");
- static_assert( (csp2s <= csp3s), "");
- static_assert( (csp2d <= csp3s), "");
- static_assert( (csp2s <= csp3d), "");
-
- static_assert( (csp2d <= csp4d), "");
- static_assert( (csp2s <= csp4s), "");
- static_assert( (csp2d <= csp4s), "");
- static_assert( (csp2s <= csp4d), "");
-
- static_assert(!(csp4d <= csp2d), "");
- static_assert(!(csp4s <= csp2s), "");
- static_assert(!(csp4d <= csp2s), "");
- static_assert(!(csp4s <= csp2d), "");
-
- std::span<int> sp0d{};
- std::span<int> sp1d{iArr2, 10};
- std::span<int> sp2d{iArr2 + 3, 2};
- std::span<int> sp3d{iArr2 + 1, 2};
- std::span<int> sp4d{iArr2 + 6, 2};
-
- std::span<int, 0> sp0s{};
- std::span<int, 10> sp1s{iArr2, 10};
- std::span<int, 2> sp2s{iArr2 + 3, 2};
- std::span<int, 2> sp3s{iArr2 + 1, 2};
- std::span<int, 2> sp4s{iArr2 + 6, 2};
-
- assert( (sp0d <= sp0d));
- assert( (sp0s <= sp0s));
- assert( (sp0s <= sp0d));
- assert( (sp0d <= sp0s));
-
- assert( (sp0d <= sp1d));
- assert( (sp0s <= sp1s));
- assert( (sp0s <= sp1d));
- assert( (sp0d <= sp1s));
-
- assert( (sp1d <= sp1s));
- assert( (sp1s <= sp1d));
-
- assert( (sp2d <= sp3d));
- assert( (sp2s <= sp3s));
- assert( (sp2d <= sp3s));
- assert( (sp2s <= sp3d));
-
- assert( (sp2d <= sp4d));
- assert( (sp2s <= sp4s));
- assert( (sp2d <= sp4s));
- assert( (sp2s <= sp4d));
-
- assert(!(sp4d <= sp2d));
- assert(!(sp4s <= sp2s));
- assert(!(sp4d <= sp2s));
- assert(!(sp4s <= sp2d));
-
-// cross type comparisons
- assert( (csp0d <= sp0d));
- assert( (csp0s <= sp0s));
- assert( (csp0s <= sp0d));
- assert( (csp0d <= sp0s));
-
- assert( (csp0d <= sp1d));
- assert( (csp0s <= sp1s));
- assert( (csp0s <= sp1d));
- assert( (csp0d <= sp1s));
-
- assert( (csp1d <= sp1s));
- assert( (csp1s <= sp1d));
-
- assert( (csp2d <= sp3d));
- assert( (csp2s <= sp3s));
- assert( (csp2d <= sp3s));
- assert( (csp2s <= sp3d));
-
- assert( (csp2d <= sp4d));
- assert( (csp2s <= sp4s));
- assert( (csp2d <= sp4s));
- assert( (csp2s <= sp4d));
-
- assert(!(csp4d <= sp2d));
- assert(!(csp4s <= sp2s));
- assert(!(csp4d <= sp2s));
- assert(!(csp4s <= sp2d));
-
-// More cross-type comparisons (int vs float)
- static_assert(std::span<const float>{fArr1, 8} <= std::span<const int>{iArr1, 9}, "");
- static_assert(std::span<const int>{iArr1, 8} <= std::span<const float>{fArr1, 9}, "");
- assert( (std::span<float>{fArr2} <= std::span<int>{iArr2}));
- assert( (std::span<int>{iArr2} <= std::span<float>{fArr2}));
-
- static_assert(!(std::span<const int>{iArr1, 9} <= std::span<const float>{fArr1, 8}), "");
-} \ No newline at end of file
diff --git a/test/std/containers/views/span.comparison/op.lt.pass.cpp b/test/std/containers/views/span.comparison/op.lt.pass.cpp
deleted file mode 100644
index 1a7de292e9011..0000000000000
--- a/test/std/containers/views/span.comparison/op.lt.pass.cpp
+++ /dev/null
@@ -1,154 +0,0 @@
-// -*- C++ -*-
-//===------------------------------ span ---------------------------------===//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file is dual licensed under the MIT and the University of Illinois Open
-// Source Licenses. See LICENSE.TXT for details.
-//
-//===---------------------------------------------------------------------===//
-// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
-
-// <span>
-
-// template<class T, ptrdiff_t X, class U, ptrdiff_t Y>
-// constexpr bool operator<(span<T, X> l, span<U, Y> r);
-//
-//
-// Effects: Equivalent to:
-// return lexicographical_compare(l.begin(), l.end(), r.begin(), r.end());
-//
-
-#include <span>
-#include <cassert>
-
-#include "test_macros.h"
-
-struct A{};
-bool operator==(A, A) {return true;}
-
-constexpr int iArr1[] = { 0, 1, 2, 1, 2, 5, 6, 7, 8, 9};
- int iArr2[] = { 0, 1, 2, 1, 2, 5, 6, 7, 8, 9};
-constexpr float fArr1[] = {0., 1., 2., 1., 2., 5., 6., 7., 8., 9.};
- float fArr2[] = {0., 1., 2., 1., 2., 5., 6., 7., 8., 9.};
-
-
-int main () {
-
- constexpr std::span<const int> csp0d{};
- constexpr std::span<const int> csp1d{iArr1, 10};
- constexpr std::span<const int> csp2d{iArr1 + 3, 2};
- constexpr std::span<const int> csp3d{iArr1 + 1, 2};
- constexpr std::span<const int> csp4d{iArr1 + 6, 2};
-
- constexpr std::span<const int, 0> csp0s{};
- constexpr std::span<const int, 10> csp1s{iArr1, 10};
- constexpr std::span<const int, 2> csp2s{iArr1 + 3, 2};
- constexpr std::span<const int, 2> csp3s{iArr1 + 1, 2};
- constexpr std::span<const int, 2> csp4s{iArr1 + 6, 2};
-
- static_assert(!(csp0d < csp0d), "");
- static_assert(!(csp0s < csp0s), "");
- static_assert(!(csp0s < csp0d), "");
- static_assert(!(csp0d < csp0s), "");
-
- static_assert( (csp0d < csp1d), "");
- static_assert( (csp0s < csp1s), "");
- static_assert( (csp0s < csp1d), "");
- static_assert( (csp0d < csp1s), "");
-
- static_assert(!(csp1d < csp1s), "");
- static_assert(!(csp1s < csp1d), "");
-
- static_assert(!(csp2d < csp3d), "");
- static_assert(!(csp2s < csp3s), "");
- static_assert(!(csp2d < csp3s), "");
- static_assert(!(csp2s < csp3d), "");
-
- static_assert( (csp2d < csp4d), "");
- static_assert( (csp2s < csp4s), "");
- static_assert( (csp2d < csp4s), "");
- static_assert( (csp2s < csp4d), "");
-
- static_assert(!(csp4d < csp2d), "");
- static_assert(!(csp4s < csp2s), "");
- static_assert(!(csp4d < csp2s), "");
- static_assert(!(csp4s < csp2d), "");
-
- std::span<int> sp0d{};
- std::span<int> sp1d{iArr2, 10};
- std::span<int> sp2d{iArr2 + 3, 2};
- std::span<int> sp3d{iArr2 + 1, 2};
- std::span<int> sp4d{iArr2 + 6, 2};
-
- std::span<int, 0> sp0s{};
- std::span<int, 10> sp1s{iArr2, 10};
- std::span<int, 2> sp2s{iArr2 + 3, 2};
- std::span<int, 2> sp3s{iArr2 + 1, 2};
- std::span<int, 2> sp4s{iArr2 + 6, 2};
-
- assert(!(sp0d < sp0d));
- assert(!(sp0s < sp0s));
- assert(!(sp0s < sp0d));
- assert(!(sp0d < sp0s));
-
- assert( (sp0d < sp1d));
- assert( (sp0s < sp1s));
- assert( (sp0s < sp1d));
- assert( (sp0d < sp1s));
-
- assert(!(sp1d < sp1s));
- assert(!(sp1s < sp1d));
-
- assert(!(sp2d < sp3d));
- assert(!(sp2s < sp3s));
- assert(!(sp2d < sp3s));
- assert(!(sp2s < sp3d));
-
- assert( (sp2d < sp4d));
- assert( (sp2s < sp4s));
- assert( (sp2d < sp4s));
- assert( (sp2s < sp4d));
-
- assert(!(sp4d < sp2d));
- assert(!(sp4s < sp2s));
- assert(!(sp4d < sp2s));
- assert(!(sp4s < sp2d));
-
-// cross type comparisons
- assert(!(csp0d < sp0d));
- assert(!(csp0s < sp0s));
- assert(!(csp0s < sp0d));
- assert(!(csp0d < sp0s));
-
- assert( (csp0d < sp1d));
- assert( (csp0s < sp1s));
- assert( (csp0s < sp1d));
- assert( (csp0d < sp1s));
-
- assert(!(csp1d < sp1s));
- assert(!(csp1s < sp1d));
-
- assert(!(csp2d < sp3d));
- assert(!(csp2s < sp3s));
- assert(!(csp2d < sp3s));
- assert(!(csp2s < sp3d));
-
- assert( (csp2d < sp4d));
- assert( (csp2s < sp4s));
- assert( (csp2d < sp4s));
- assert( (csp2s < sp4d));
-
- assert(!(csp4d < sp2d));
- assert(!(csp4s < sp2s));
- assert(!(csp4d < sp2s));
- assert(!(csp4s < sp2d));
-
-// More cross-type comparisons (int vs float)
- static_assert(std::span<const float>{fArr1, 8} < std::span<const int>{iArr1, 9}, "");
- static_assert(std::span<const int>{iArr1, 8} < std::span<const float>{fArr1, 9}, "");
- assert(!(std::span<float>{fArr2} < std::span<int>{iArr2}));
- assert(!(std::span<int>{iArr2} < std::span<float>{fArr2}));
-
- static_assert(!(std::span<const int>{iArr1, 9} < std::span<const float>{fArr1, 8}), "");
-} \ No newline at end of file
diff --git a/test/std/containers/views/span.comparison/op.ne.pass.cpp b/test/std/containers/views/span.comparison/op.ne.pass.cpp
deleted file mode 100644
index ecf05b3174912..0000000000000
--- a/test/std/containers/views/span.comparison/op.ne.pass.cpp
+++ /dev/null
@@ -1,168 +0,0 @@
-// -*- C++ -*-
-//===------------------------------ span ---------------------------------===//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file is dual licensed under the MIT and the University of Illinois Open
-// Source Licenses. See LICENSE.TXT for details.
-//
-//===---------------------------------------------------------------------===//
-// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
-
-// <span>
-
-// template<class T, ptrdiff_t X, class U, ptrdiff_t Y>
-// constexpr bool operator!=(span<T, X> l, span<U, Y> r);
-//
-//
-// Effects: Equivalent to: return !(l == r);
-//
-
-#include <span>
-#include <cassert>
-
-#include "test_macros.h"
-
-struct A{};
-bool operator==(A, A) {return true;}
-
-constexpr int iArr1[] = { 0, 1, 2, 1, 2, 5, 6, 7, 8, 9};
- int iArr2[] = { 0, 1, 2, 1, 2, 5, 6, 7, 8, 9};
-constexpr float fArr1[] = {0., 1., 2., 1., 2., 5., 6., 7., 8., 9.};
- float fArr2[] = {0., 1., 2., 1., 2., 5., 6., 7., 8., 9.};
-
-
-int main () {
-
- constexpr std::span<const int> csp0d{};
- constexpr std::span<const int> csp1d{iArr1, 10};
- constexpr std::span<const int> csp2d{iArr1 + 3, 2};
- constexpr std::span<const int> csp3d{iArr1 + 1, 2};
- constexpr std::span<const int> csp4d{iArr1 + 6, 2};
-
- constexpr std::span<const int, 0> csp0s{};
- constexpr std::span<const int, 10> csp1s{iArr1, 10};
- constexpr std::span<const int, 2> csp2s{iArr1 + 3, 2};
- constexpr std::span<const int, 2> csp3s{iArr1 + 1, 2};
- constexpr std::span<const int, 2> csp4s{iArr1 + 6, 2};
-
- static_assert(!(csp0d != csp0d), "");
- static_assert(!(csp0s != csp0s), "");
- static_assert(!(csp0s != csp0d), "");
- static_assert(!(csp0d != csp0s), "");
-
- static_assert( (csp0d != csp1d), "");
- static_assert( (csp0s != csp1s), "");
- static_assert( (csp0s != csp1d), "");
- static_assert( (csp0d != csp1s), "");
-
- static_assert(!(csp1d != csp1s), "");
- static_assert(!(csp1s != csp1d), "");
-
- static_assert(!(csp2d != csp3d), "");
- static_assert(!(csp2s != csp3s), "");
- static_assert(!(csp2d != csp3s), "");
- static_assert(!(csp2s != csp3d), "");
-
- static_assert(!(csp2d != csp3d), "");
- static_assert(!(csp2s != csp3s), "");
- static_assert(!(csp2d != csp3s), "");
- static_assert(!(csp2s != csp3d), "");
-
- static_assert( (csp2d != csp4d), "");
- static_assert( (csp2s != csp4s), "");
- static_assert( (csp2d != csp4s), "");
- static_assert( (csp2s != csp4d), "");
-
- static_assert( (csp4d != csp2d), "");
- static_assert( (csp4s != csp2s), "");
- static_assert( (csp4d != csp2s), "");
- static_assert( (csp4s != csp2d), "");
-
- std::span<int> sp0d{};
- std::span<int> sp1d{iArr2, 10};
- std::span<int> sp2d{iArr2 + 3, 2};
- std::span<int> sp3d{iArr2 + 1, 2};
- std::span<int> sp4d{iArr2 + 6, 2};
-
- std::span<int, 0> sp0s{};
- std::span<int, 10> sp1s{iArr2, 10};
- std::span<int, 2> sp2s{iArr2 + 3, 2};
- std::span<int, 2> sp3s{iArr2 + 1, 2};
- std::span<int, 2> sp4s{iArr2 + 6, 2};
-
- assert(!(sp0d != sp0d));
- assert(!(sp0s != sp0s));
- assert(!(sp0s != sp0d));
- assert(!(sp0d != sp0s));
-
- assert( (sp0d != sp1d));
- assert( (sp0s != sp1s));
- assert( (sp0s != sp1d));
- assert( (sp0d != sp1s));
-
- assert(!(sp1d != sp1s));
- assert(!(sp1s != sp1d));
-
- assert(!(sp2d != sp3d));
- assert(!(sp2s != sp3s));
- assert(!(sp2d != sp3s));
- assert(!(sp2s != sp3d));
-
- assert(!(sp2d != sp3d));
- assert(!(sp2s != sp3s));
- assert(!(sp2d != sp3s));
- assert(!(sp2s != sp3d));
-
- assert( (sp2d != sp4d));
- assert( (sp2s != sp4s));
- assert( (sp2d != sp4s));
- assert( (sp2s != sp4d));
-
- assert( (sp4d != sp2d));
- assert( (sp4s != sp2s));
- assert( (sp4d != sp2s));
- assert( (sp4s != sp2d));
-
-// cross type comparisons
- assert(!(csp0d != sp0d));
- assert(!(csp0s != sp0s));
- assert(!(csp0s != sp0d));
- assert(!(csp0d != sp0s));
-
- assert( (csp0d != sp1d));
- assert( (csp0s != sp1s));
- assert( (csp0s != sp1d));
- assert( (csp0d != sp1s));
-
- assert(!(csp1d != sp1s));
- assert(!(csp1s != sp1d));
-
- assert(!(csp2d != sp3d));
- assert(!(csp2s != sp3s));
- assert(!(csp2d != sp3s));
- assert(!(csp2s != sp3d));
-
- assert(!(csp2d != sp3d));
- assert(!(csp2s != sp3s));
- assert(!(csp2d != sp3s));
- assert(!(csp2s != sp3d));
-
- assert( (csp2d != sp4d));
- assert( (csp2s != sp4s));
- assert( (csp2d != sp4s));
- assert( (csp2s != sp4d));
-
- assert( (csp4d != sp2d));
- assert( (csp4s != sp2s));
- assert( (csp4d != sp2s));
- assert( (csp4s != sp2d));
-
-// More cross-type comparisons (int vs float)
- static_assert(!(std::span<const float>{fArr1} != std::span<const int>{iArr1}), "");
- static_assert(!(std::span<const int>{iArr1} != std::span<const float>{fArr1}), "");
- assert(!(std::span<float>{fArr2} != std::span<int>{iArr2}));
- assert(!(std::span<int>{iArr2} != std::span<float>{fArr2}));
-
- static_assert( (std::span<const int>{iArr1, 9} != std::span<const float>{fArr1, 8}), "");
-} \ No newline at end of file
diff --git a/test/std/containers/views/span.cons/array.fail.cpp b/test/std/containers/views/span.cons/array.fail.cpp
index 7ef49fc470891..e1e5deea534a3 100644
--- a/test/std/containers/views/span.cons/array.fail.cpp
+++ b/test/std/containers/views/span.cons/array.fail.cpp
@@ -7,7 +7,7 @@
// Source Licenses. See LICENSE.TXT for details.
//
//===---------------------------------------------------------------------===//
-// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
+// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
// <span>
@@ -16,7 +16,7 @@
// template<size_t N>
// constexpr span(array<value_type, N>& arr) noexcept;
// template<size_t N>
-// constexpr span(const array<value_type, N>& arr) noexcept;
+// constexpr span(const array<value_type, N>& arr) noexcept;
//
// Remarks: These constructors shall not participate in overload resolution unless:
// — extent == dynamic_extent || N == extent is true, and
@@ -41,13 +41,13 @@ int main ()
{
std::span<int, 2> s1(arr); // expected-error {{no matching constructor for initialization of 'std::span<int, 2>'}}
}
-
+
// Type wrong
{
std::span<float> s1(arr); // expected-error {{no matching constructor for initialization of 'std::span<float>'}}
std::span<float, 3> s2(arr); // expected-error {{no matching constructor for initialization of 'std::span<float, 3>'}}
}
-
+
// CV wrong (dynamically sized)
{
std::span< int> s1{ carr}; // expected-error {{no matching constructor for initialization of 'std::span<int>'}}
diff --git a/test/std/containers/views/span.cons/array.pass.cpp b/test/std/containers/views/span.cons/array.pass.cpp
index 80a0f07f62522..72a86654e1bfe 100644
--- a/test/std/containers/views/span.cons/array.pass.cpp
+++ b/test/std/containers/views/span.cons/array.pass.cpp
@@ -7,7 +7,7 @@
// Source Licenses. See LICENSE.TXT for details.
//
//===---------------------------------------------------------------------===//
-// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
+// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
// <span>
diff --git a/test/std/containers/views/span.cons/assign.pass.cpp b/test/std/containers/views/span.cons/assign.pass.cpp
index b5bd7ae00dfcb..cb210046122f4 100644
--- a/test/std/containers/views/span.cons/assign.pass.cpp
+++ b/test/std/containers/views/span.cons/assign.pass.cpp
@@ -7,7 +7,7 @@
// Source Licenses. See LICENSE.TXT for details.
//
//===---------------------------------------------------------------------===//
-// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
+// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
// <span>
@@ -71,7 +71,7 @@ int main ()
};
static_assert(std::size(spans) == 13, "" );
-
+
// No for loops in constexpr land :-(
static_assert(doAssign(spans[0], spans[0]), "");
static_assert(doAssign(spans[0], spans[1]), "");
@@ -194,7 +194,7 @@ int main ()
{carr2 + 1, 2},
{carr3, 2}
};
-
+
static_assert(std::size(spans) == 6, "" );
// No for loops in constexpr land :-(
@@ -240,7 +240,7 @@ int main ()
{arr, arr + 3},
{arr + 1, arr + 3} // same size as s2
};
-
+
for (size_t i = 0; i < std::size(spans); ++i)
for (size_t j = i; j < std::size(spans); ++j)
assert((doAssign(spans[i], spans[j])));
@@ -253,7 +253,7 @@ int main ()
{arr + 1, arr + 3},
{arr + 2, arr + 4}
};
-
+
for (size_t i = 0; i < std::size(spans); ++i)
for (size_t j = i; j < std::size(spans); ++j)
assert((doAssign(spans[i], spans[j])));
@@ -273,7 +273,7 @@ int main ()
{strs + 2, strs + 3},
{strs + 3, strs + 3}
};
-
+
for (size_t i = 0; i < std::size(spans); ++i)
for (size_t j = i; j < std::size(spans); ++j)
assert((doAssign(spans[i], spans[j])));
@@ -285,7 +285,7 @@ int main ()
{strs + 1, strs + 2},
{strs + 2, strs + 3}
};
-
+
for (size_t i = 0; i < std::size(spans); ++i)
for (size_t j = i; j < std::size(spans); ++j)
assert((doAssign(spans[i], spans[j])));
diff --git a/test/std/containers/views/span.cons/container.fail.cpp b/test/std/containers/views/span.cons/container.fail.cpp
index ecd7fcb91b835..c8f6830fbc5d1 100644
--- a/test/std/containers/views/span.cons/container.fail.cpp
+++ b/test/std/containers/views/span.cons/container.fail.cpp
@@ -7,7 +7,7 @@
// Source Licenses. See LICENSE.TXT for details.
//
//===---------------------------------------------------------------------===//
-// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
+// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
// <span>
@@ -89,7 +89,7 @@ int main ()
// Not the same type
{
std::span<float> s1{IsAContainer<int>()}; // expected-error {{no matching constructor for initialization of 'std::span<float>'}}
- std::span<float, 0> s2{IsAContainer<int>()}; // expected-error {{no matching constructor for initialization of 'std::span<float, 0>'}}
+ std::span<float, 0> s2{IsAContainer<int>()}; // expected-error {{no matching constructor for initialization of 'std::span<float, 0>'}}
}
// CV wrong (dynamically sized)
diff --git a/test/std/containers/views/span.cons/container.pass.cpp b/test/std/containers/views/span.cons/container.pass.cpp
index 478a3dac5db7c..401f41e075689 100644
--- a/test/std/containers/views/span.cons/container.pass.cpp
+++ b/test/std/containers/views/span.cons/container.pass.cpp
@@ -7,7 +7,7 @@
// Source Licenses. See LICENSE.TXT for details.
//
//===---------------------------------------------------------------------===//
-// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
+// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
// <span>
diff --git a/test/std/containers/views/span.cons/copy.pass.cpp b/test/std/containers/views/span.cons/copy.pass.cpp
index 2cfffbbd4496e..c123acb6a166f 100644
--- a/test/std/containers/views/span.cons/copy.pass.cpp
+++ b/test/std/containers/views/span.cons/copy.pass.cpp
@@ -7,7 +7,7 @@
// Source Licenses. See LICENSE.TXT for details.
//
//===---------------------------------------------------------------------===//
-// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
+// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
// <span>
@@ -46,7 +46,7 @@ void testCV ()
int main ()
{
constexpr int carr[] = {1,2,3};
-
+
static_assert(doCopy(std::span< int> ()), "");
static_assert(doCopy(std::span< int,0>()), "");
static_assert(doCopy(std::span<const int> (&carr[0], 1)), "");
diff --git a/test/std/containers/views/span.cons/deduct.pass.cpp b/test/std/containers/views/span.cons/deduct.pass.cpp
index e72c09149f036..098215c839518 100644
--- a/test/std/containers/views/span.cons/deduct.pass.cpp
+++ b/test/std/containers/views/span.cons/deduct.pass.cpp
@@ -7,22 +7,22 @@
// Source Licenses. See LICENSE.TXT for details.
//
//===---------------------------------------------------------------------===//
-// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
+// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
// <span>
// template<class T, size_t N>
// span(T (&)[N]) -> span<T, N>;
-//
+//
// template<class T, size_t N>
// span(array<T, N>&) -> span<T, N>;
-//
+//
// template<class T, size_t N>
// span(const array<T, N>&) -> span<const T, N>;
-//
+//
// template<class Container>
// span(Container&) -> span<typename Container::value_type>;
-//
+//
// template<class Container>
// span(const Container&) -> span<const typename Container::value_type>;
@@ -66,7 +66,7 @@ int main ()
ASSERT_SAME_TYPE(S, std::span<const long, 5>);
assert((std::equal(std::begin(arr), std::end(arr), s.begin(), s.end())));
}
-
+
{
std::string str{"ABCDE"};
std::span s{str};
diff --git a/test/std/containers/views/span.cons/default.fail.cpp b/test/std/containers/views/span.cons/default.fail.cpp
index d1fefe5b38cae..813939f39ca8b 100644
--- a/test/std/containers/views/span.cons/default.fail.cpp
+++ b/test/std/containers/views/span.cons/default.fail.cpp
@@ -7,7 +7,7 @@
// Source Licenses. See LICENSE.TXT for details.
//
//===---------------------------------------------------------------------===//
-// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
+// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
// <span>
@@ -25,8 +25,8 @@
int main ()
{
- std::span<int, 2> s; // expected-error@span:* {{static_assert failed "Can't default construct a statically sized span with size > 0"}}
-
+ std::span<int, 2> s; // expected-error-re@span:* {{static_assert failed{{( due to requirement '2[LL]{0,2} == 0')?}} "Can't default construct a statically sized span with size > 0"}}
+
// TODO: This is what I want:
// eXpected-error {{no matching constructor for initialization of 'std::span<int, 2>'}}
}
diff --git a/test/std/containers/views/span.cons/default.pass.cpp b/test/std/containers/views/span.cons/default.pass.cpp
index f7e496696e991..b7d01c9e203f4 100644
--- a/test/std/containers/views/span.cons/default.pass.cpp
+++ b/test/std/containers/views/span.cons/default.pass.cpp
@@ -7,7 +7,7 @@
// Source Licenses. See LICENSE.TXT for details.
//
//===---------------------------------------------------------------------===//
-// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
+// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
// <span>
diff --git a/test/std/containers/views/span.cons/ptr_len.fail.cpp b/test/std/containers/views/span.cons/ptr_len.fail.cpp
index db24e3d26884e..9ab87f5414b94 100644
--- a/test/std/containers/views/span.cons/ptr_len.fail.cpp
+++ b/test/std/containers/views/span.cons/ptr_len.fail.cpp
@@ -7,12 +7,12 @@
// Source Licenses. See LICENSE.TXT for details.
//
//===---------------------------------------------------------------------===//
-// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
+// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
// <span>
// constexpr span(pointer ptr, index_type count);
-// Requires: [ptr, ptr + count) shall be a valid range.
+// Requires: [ptr, ptr + count) shall be a valid range.
// If extent is not equal to dynamic_extent, then count shall be equal to extent.
//
@@ -38,7 +38,7 @@ int main ()
std::span<float> s1(arr, 3); // expected-error {{no matching constructor for initialization of 'std::span<float>'}}
std::span<float, 3> s2(arr, 3); // expected-error {{no matching constructor for initialization of 'std::span<float, 3>'}}
}
-
+
// CV wrong (dynamically sized)
{
std::span< int> s1{ carr, 3}; // expected-error {{no matching constructor for initialization of 'std::span<int>'}}
diff --git a/test/std/containers/views/span.cons/ptr_len.pass.cpp b/test/std/containers/views/span.cons/ptr_len.pass.cpp
index 7302759bcc641..c4e9545e9d972 100644
--- a/test/std/containers/views/span.cons/ptr_len.pass.cpp
+++ b/test/std/containers/views/span.cons/ptr_len.pass.cpp
@@ -7,12 +7,12 @@
// Source Licenses. See LICENSE.TXT for details.
//
//===---------------------------------------------------------------------===//
-// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
+// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
// <span>
// constexpr span(pointer ptr, index_type count);
-// Requires: [ptr, ptr + count) shall be a valid range.
+// Requires: [ptr, ptr + count) shall be a valid range.
// If extent is not equal to dynamic_extent, then count shall be equal to extent.
//
diff --git a/test/std/containers/views/span.cons/ptr_ptr.fail.cpp b/test/std/containers/views/span.cons/ptr_ptr.fail.cpp
index a55f0592a082f..bd4dbab8fca96 100644
--- a/test/std/containers/views/span.cons/ptr_ptr.fail.cpp
+++ b/test/std/containers/views/span.cons/ptr_ptr.fail.cpp
@@ -7,12 +7,12 @@
// Source Licenses. See LICENSE.TXT for details.
//
//===---------------------------------------------------------------------===//
-// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
+// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
// <span>
// constexpr span(pointer first, pointer last);
-// Requires: [first, last) shall be a valid range.
+// Requires: [first, last) shall be a valid range.
// If extent is not equal to dynamic_extent, then last - first shall be equal to extent.
//
@@ -38,7 +38,7 @@ int main ()
std::span<float> s1(arr, arr + 3); // expected-error {{no matching constructor for initialization of 'std::span<float>'}}
std::span<float, 3> s2(arr, arr + 3); // expected-error {{no matching constructor for initialization of 'std::span<float, 3>'}}
}
-
+
// CV wrong (dynamically sized)
{
std::span< int> s1{ carr, carr + 3}; // expected-error {{no matching constructor for initialization of 'std::span<int>'}}
diff --git a/test/std/containers/views/span.cons/ptr_ptr.pass.cpp b/test/std/containers/views/span.cons/ptr_ptr.pass.cpp
index afb525e73687f..c2bceec48a82a 100644
--- a/test/std/containers/views/span.cons/ptr_ptr.pass.cpp
+++ b/test/std/containers/views/span.cons/ptr_ptr.pass.cpp
@@ -7,12 +7,12 @@
// Source Licenses. See LICENSE.TXT for details.
//
//===---------------------------------------------------------------------===//
-// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
+// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
// <span>
// constexpr span(pointer first, pointer last);
-// Requires: [first, last) shall be a valid range.
+// Requires: [first, last) shall be a valid range.
// If extent is not equal to dynamic_extent, then last - first shall be equal to extent.
//
diff --git a/test/std/containers/views/span.cons/span.fail.cpp b/test/std/containers/views/span.cons/span.fail.cpp
index 1fa71551b4932..69e879e2ea8a9 100644
--- a/test/std/containers/views/span.cons/span.fail.cpp
+++ b/test/std/containers/views/span.cons/span.fail.cpp
@@ -7,7 +7,7 @@
// Source Licenses. See LICENSE.TXT for details.
//
//===---------------------------------------------------------------------===//
-// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
+// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
// <span>
@@ -99,6 +99,6 @@ int main ()
std::span<float> s2{sp0}; // expected-error {{no matching constructor for initialization of 'std::span<float>'}}
std::span<float, 0> s3{sp}; // expected-error {{no matching constructor for initialization of 'std::span<float, 0>'}}
std::span<float, 0> s4{sp0}; // expected-error {{no matching constructor for initialization of 'std::span<float, 0>'}}
-
+
checkCV();
}
diff --git a/test/std/containers/views/span.cons/span.pass.cpp b/test/std/containers/views/span.cons/span.pass.cpp
index b2024ce123cd8..5fdbab22755a6 100644
--- a/test/std/containers/views/span.cons/span.pass.cpp
+++ b/test/std/containers/views/span.cons/span.pass.cpp
@@ -7,7 +7,7 @@
// Source Licenses. See LICENSE.TXT for details.
//
//===---------------------------------------------------------------------===//
-// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
+// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
// <span>
diff --git a/test/std/containers/views/span.cons/stdarray.pass.cpp b/test/std/containers/views/span.cons/stdarray.pass.cpp
index 1832ac2ba4976..27623a4c9f74d 100644
--- a/test/std/containers/views/span.cons/stdarray.pass.cpp
+++ b/test/std/containers/views/span.cons/stdarray.pass.cpp
@@ -7,14 +7,14 @@
// Source Licenses. See LICENSE.TXT for details.
//
//===---------------------------------------------------------------------===//
-// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
+// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
// <span>
// template<size_t N>
// constexpr span(array<value_type, N>& arr) noexcept;
// template<size_t N>
-// constexpr span(const array<value_type, N>& arr) noexcept;
+// constexpr span(const array<value_type, N>& arr) noexcept;
//
// Remarks: These constructors shall not participate in overload resolution unless:
// — extent == dynamic_extent || N == extent is true, and
diff --git a/test/std/containers/views/span.elem/data.pass.cpp b/test/std/containers/views/span.elem/data.pass.cpp
index 3bc6fbbe57683..ceb2eca17861d 100644
--- a/test/std/containers/views/span.elem/data.pass.cpp
+++ b/test/std/containers/views/span.elem/data.pass.cpp
@@ -7,7 +7,7 @@
// Source Licenses. See LICENSE.TXT for details.
//
//===---------------------------------------------------------------------===//
-// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
+// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
// <span>
diff --git a/test/std/containers/views/span.elem/op_idx.pass.cpp b/test/std/containers/views/span.elem/op_idx.pass.cpp
index a88f4410427a2..801eca4286668 100644
--- a/test/std/containers/views/span.elem/op_idx.pass.cpp
+++ b/test/std/containers/views/span.elem/op_idx.pass.cpp
@@ -7,7 +7,7 @@
// Source Licenses. See LICENSE.TXT for details.
//
//===---------------------------------------------------------------------===//
-// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
+// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
// <span>
@@ -28,7 +28,7 @@ constexpr bool testConstexprSpan(Span sp, ptrdiff_t idx)
{
_LIBCPP_ASSERT(noexcept(sp[idx]), "");
_LIBCPP_ASSERT(noexcept(sp(idx)), "");
-
+
typename Span::reference r1 = sp[idx];
typename Span::reference r2 = sp(idx);
typename Span::reference r3 = *(sp.data() + idx);
@@ -41,7 +41,7 @@ void testRuntimeSpan(Span sp, ptrdiff_t idx)
{
_LIBCPP_ASSERT(noexcept(sp[idx]), "");
_LIBCPP_ASSERT(noexcept(sp(idx)), "");
-
+
typename Span::reference r1 = sp[idx];
typename Span::reference r2 = sp(idx);
typename Span::reference r3 = *(sp.data() + idx);
diff --git a/test/std/containers/views/span.iterators/begin.pass.cpp b/test/std/containers/views/span.iterators/begin.pass.cpp
index c8b9900bc151b..cd8d70958f99c 100644
--- a/test/std/containers/views/span.iterators/begin.pass.cpp
+++ b/test/std/containers/views/span.iterators/begin.pass.cpp
@@ -6,7 +6,7 @@
// Source Licenses. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
-// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
+// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
// <span>
diff --git a/test/std/containers/views/span.iterators/end.pass.cpp b/test/std/containers/views/span.iterators/end.pass.cpp
index 2b64b0f4b5413..54ff8ebf7903b 100644
--- a/test/std/containers/views/span.iterators/end.pass.cpp
+++ b/test/std/containers/views/span.iterators/end.pass.cpp
@@ -6,7 +6,7 @@
// Source Licenses. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
-// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
+// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
// <span>
@@ -32,8 +32,11 @@ constexpr bool testConstexprSpan(Span s)
}
else
{
+ typename Span::const_pointer last = &*(s.cbegin() + s.size() - 1);
ret = ret && ( e != s.begin());
ret = ret && (ce != s.cbegin());
+ ret = ret && (&*( e-1) == last);
+ ret = ret && (&*(ce-1) == last);
}
ret = ret && (( e - s.begin()) == s.size());
@@ -55,8 +58,11 @@ void testRuntimeSpan(Span s)
}
else
{
+ typename Span::const_pointer last = &*(s.cbegin() + s.size() - 1);
assert( e != s.begin());
assert(ce != s.cbegin());
+ assert( &*( e-1) == last);
+ assert( &*(ce-1) == last);
}
assert(( e - s.begin()) == s.size());
diff --git a/test/std/containers/views/span.iterators/rbegin.pass.cpp b/test/std/containers/views/span.iterators/rbegin.pass.cpp
index c0776c00a81bb..258908d6c57fa 100644
--- a/test/std/containers/views/span.iterators/rbegin.pass.cpp
+++ b/test/std/containers/views/span.iterators/rbegin.pass.cpp
@@ -6,7 +6,7 @@
// Source Licenses. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
-// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
+// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
// <span>
diff --git a/test/std/containers/views/span.iterators/rend.pass.cpp b/test/std/containers/views/span.iterators/rend.pass.cpp
index abcead445e1dd..367ea88669e69 100644
--- a/test/std/containers/views/span.iterators/rend.pass.cpp
+++ b/test/std/containers/views/span.iterators/rend.pass.cpp
@@ -6,7 +6,7 @@
// Source Licenses. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
-// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
+// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
// <span>
diff --git a/test/std/containers/views/span.objectrep/as_bytes.pass.cpp b/test/std/containers/views/span.objectrep/as_bytes.pass.cpp
index b081b95c373ed..e4a240f8da8c4 100644
--- a/test/std/containers/views/span.objectrep/as_bytes.pass.cpp
+++ b/test/std/containers/views/span.objectrep/as_bytes.pass.cpp
@@ -7,7 +7,7 @@
// Source Licenses. See LICENSE.TXT for details.
//
//===---------------------------------------------------------------------===//
-// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
+// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
// <span>
@@ -38,7 +38,7 @@ void testRuntimeSpan(Span sp)
assert(spBytes.extent == std::dynamic_extent);
else
assert(spBytes.extent == static_cast<std::ptrdiff_t>(sizeof(typename Span::element_type)) * sp.extent);
-
+
assert((void *) spBytes.data() == (void *) sp.data());
assert(spBytes.size() == sp.size_bytes());
}
diff --git a/test/std/containers/views/span.objectrep/as_writeable_bytes.fail.cpp b/test/std/containers/views/span.objectrep/as_writeable_bytes.fail.cpp
index 28a4c45d2477b..63d79c923ce45 100644
--- a/test/std/containers/views/span.objectrep/as_writeable_bytes.fail.cpp
+++ b/test/std/containers/views/span.objectrep/as_writeable_bytes.fail.cpp
@@ -7,7 +7,7 @@
// Source Licenses. See LICENSE.TXT for details.
//
//===---------------------------------------------------------------------===//
-// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
+// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
// <span>
diff --git a/test/std/containers/views/span.objectrep/as_writeable_bytes.pass.cpp b/test/std/containers/views/span.objectrep/as_writeable_bytes.pass.cpp
index 24e3fb2734993..54216c2979f63 100644
--- a/test/std/containers/views/span.objectrep/as_writeable_bytes.pass.cpp
+++ b/test/std/containers/views/span.objectrep/as_writeable_bytes.pass.cpp
@@ -7,7 +7,7 @@
// Source Licenses. See LICENSE.TXT for details.
//
//===---------------------------------------------------------------------===//
-// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
+// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
// <span>
@@ -38,7 +38,7 @@ void testRuntimeSpan(Span sp)
assert(spBytes.extent == std::dynamic_extent);
else
assert(spBytes.extent == static_cast<std::ptrdiff_t>(sizeof(typename Span::element_type)) * sp.extent);
-
+
assert(static_cast<void*>(spBytes.data()) == static_cast<void*>(sp.data()));
assert(spBytes.size() == sp.size_bytes());
}
diff --git a/test/std/containers/views/span.obs/empty.pass.cpp b/test/std/containers/views/span.obs/empty.pass.cpp
index a48c0d02494bb..23e55bb76c6bc 100644
--- a/test/std/containers/views/span.obs/empty.pass.cpp
+++ b/test/std/containers/views/span.obs/empty.pass.cpp
@@ -7,7 +7,7 @@
// Source Licenses. See LICENSE.TXT for details.
//
//===---------------------------------------------------------------------===//
-// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
+// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
// <span>
@@ -48,7 +48,7 @@ int main ()
static_assert(!std::span<const int>(iArr1, 3).empty(), "");
static_assert(!std::span<const int>(iArr1, 4).empty(), "");
static_assert(!std::span<const int>(iArr1, 5).empty(), "");
-
+
assert( (std::span<int>().empty() ));
assert( (std::span<long>().empty() ));
assert( (std::span<double>().empty() ));
diff --git a/test/std/containers/views/span.obs/size.pass.cpp b/test/std/containers/views/span.obs/size.pass.cpp
index c33fd3f6c61ba..16f1b6a7ef73d 100644
--- a/test/std/containers/views/span.obs/size.pass.cpp
+++ b/test/std/containers/views/span.obs/size.pass.cpp
@@ -7,7 +7,7 @@
// Source Licenses. See LICENSE.TXT for details.
//
//===---------------------------------------------------------------------===//
-// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
+// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
// <span>
diff --git a/test/std/containers/views/span.obs/size_bytes.pass.cpp b/test/std/containers/views/span.obs/size_bytes.pass.cpp
index 1ee75d9fcb798..3b6c5b0e22652 100644
--- a/test/std/containers/views/span.obs/size_bytes.pass.cpp
+++ b/test/std/containers/views/span.obs/size_bytes.pass.cpp
@@ -7,7 +7,7 @@
// Source Licenses. See LICENSE.TXT for details.
//
//===---------------------------------------------------------------------===//
-// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
+// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
// <span>
diff --git a/test/std/containers/views/span.sub/first.pass.cpp b/test/std/containers/views/span.sub/first.pass.cpp
index 3bfdab9f8a55a..e745fd77df7e8 100644
--- a/test/std/containers/views/span.sub/first.pass.cpp
+++ b/test/std/containers/views/span.sub/first.pass.cpp
@@ -7,7 +7,7 @@
// Source Licenses. See LICENSE.TXT for details.
//
//===---------------------------------------------------------------------===//
-// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
+// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
// <span>
@@ -114,7 +114,7 @@ int main ()
{
using Sp = std::span<std::string>;
testConstexprSpan<Sp, 0>(Sp{});
-
+
testRuntimeSpan<Sp, 0>(Sp{sarr});
testRuntimeSpan<Sp, 1>(Sp{sarr});
testRuntimeSpan<Sp, 2>(Sp{sarr});
@@ -125,7 +125,7 @@ int main ()
{
using Sp = std::span<std::string, 5>;
-
+
testRuntimeSpan<Sp, 0>(Sp{sarr});
testRuntimeSpan<Sp, 1>(Sp{sarr});
testRuntimeSpan<Sp, 2>(Sp{sarr});
diff --git a/test/std/containers/views/span.sub/last.pass.cpp b/test/std/containers/views/span.sub/last.pass.cpp
index 4e378fe549edb..94d41430b354d 100644
--- a/test/std/containers/views/span.sub/last.pass.cpp
+++ b/test/std/containers/views/span.sub/last.pass.cpp
@@ -7,7 +7,7 @@
// Source Licenses. See LICENSE.TXT for details.
//
//===---------------------------------------------------------------------===//
-// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
+// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
// <span>
@@ -114,7 +114,7 @@ int main ()
{
using Sp = std::span<std::string>;
testConstexprSpan<Sp, 0>(Sp{});
-
+
testRuntimeSpan<Sp, 0>(Sp{sarr});
testRuntimeSpan<Sp, 1>(Sp{sarr});
testRuntimeSpan<Sp, 2>(Sp{sarr});
@@ -125,7 +125,7 @@ int main ()
{
using Sp = std::span<std::string, 5>;
-
+
testRuntimeSpan<Sp, 0>(Sp{sarr});
testRuntimeSpan<Sp, 1>(Sp{sarr});
testRuntimeSpan<Sp, 2>(Sp{sarr});
diff --git a/test/std/containers/views/span.sub/subspan.pass.cpp b/test/std/containers/views/span.sub/subspan.pass.cpp
index 79cdc7bcaf1af..012fc2b5fb443 100644
--- a/test/std/containers/views/span.sub/subspan.pass.cpp
+++ b/test/std/containers/views/span.sub/subspan.pass.cpp
@@ -7,7 +7,7 @@
// Source Licenses. See LICENSE.TXT for details.
//
//===---------------------------------------------------------------------===//
-// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
+// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
// <span>
diff --git a/test/std/containers/views/types.pass.cpp b/test/std/containers/views/types.pass.cpp
index 082abeb774ea2..c519fbf768af4 100644
--- a/test/std/containers/views/types.pass.cpp
+++ b/test/std/containers/views/types.pass.cpp
@@ -7,7 +7,7 @@
// Source Licenses. See LICENSE.TXT for details.
//
//===---------------------------------------------------------------------===//
-// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
+// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
// <span>
@@ -25,9 +25,9 @@
// using const_iterator = implementation-defined;
// using reverse_iterator = std::reverse_iterator<iterator>;
// using const_reverse_iterator = std::reverse_iterator<const_iterator>;
-//
+//
// static constexpr index_type extent = Extent;
-//
+//
#include <span>
#include <cassert>
@@ -71,7 +71,7 @@ void testSpan()
ASSERT_SAME_TYPE(typename S::difference_type, std::ptrdiff_t);
ASSERT_SAME_TYPE(typename S::pointer, ElementType *);
ASSERT_SAME_TYPE(typename S::reference, ElementType &);
-
+
static_assert(S::extent == Size); // check that it exists
testIterator<S, typename S::iterator>();
diff --git a/test/std/depr/depr.c.headers/float_h.pass.cpp b/test/std/depr/depr.c.headers/float_h.pass.cpp
index 3001c215cd19a..84e89c4dbb848 100644
--- a/test/std/depr/depr.c.headers/float_h.pass.cpp
+++ b/test/std/depr/depr.c.headers/float_h.pass.cpp
@@ -11,6 +11,8 @@
#include <float.h>
+#include "test_macros.h"
+
#ifndef FLT_ROUNDS
#error FLT_ROUNDS not defined
#endif
@@ -23,7 +25,7 @@
#error FLT_RADIX not defined
#endif
-#if TEST_STD_VER > 14 && defined(TEST_HAS_C11_FEATURES)
+#if TEST_STD_VER > 14 && defined(TEST_HAS_C11_FEATURES) && 0
#ifndef FLT_HAS_SUBNORM
#error FLT_HAS_SUBNORM not defined
#endif
@@ -53,7 +55,7 @@
#error DECIMAL_DIG not defined
#endif
-#if TEST_STD_VER > 14 && defined(TEST_HAS_C11_FEATURES)
+#if TEST_STD_VER > 14 && defined(TEST_HAS_C11_FEATURES) && 0
#ifndef FLT_DECIMAL_DIG
#error FLT_DECIMAL_DIG not defined
#endif
@@ -163,7 +165,7 @@
#error LDBL_MIN not defined
#endif
-#if TEST_STD_VER > 14 && defined(TEST_HAS_C11_FEATURES)
+#if TEST_STD_VER > 14 && defined(TEST_HAS_C11_FEATURES) && 0
#ifndef FLT_TRUE_MIN
#error FLT_TRUE_MIN not defined
#endif
diff --git a/test/std/depr/depr.c.headers/math_h.pass.cpp b/test/std/depr/depr.c.headers/math_h.pass.cpp
index 7e1b2d110642e..e8341a07f80ac 100644
--- a/test/std/depr/depr.c.headers/math_h.pass.cpp
+++ b/test/std/depr/depr.c.headers/math_h.pass.cpp
@@ -14,6 +14,7 @@
#include <cassert>
#include "hexfloat.h"
+#include "truncate_fp.h"
// convertible to int/float/double/etc
template <class T, int N=0>
@@ -807,23 +808,31 @@ void test_atanh()
assert(atanh(0) == 0);
}
-void test_cbrt()
-{
- static_assert((std::is_same<decltype(cbrt((float)0)), float>::value), "");
- static_assert((std::is_same<decltype(cbrt((bool)0)), double>::value), "");
- static_assert((std::is_same<decltype(cbrt((unsigned short)0)), double>::value), "");
- static_assert((std::is_same<decltype(cbrt((int)0)), double>::value), "");
- static_assert((std::is_same<decltype(cbrt((unsigned int)0)), double>::value), "");
- static_assert((std::is_same<decltype(cbrt((long)0)), double>::value), "");
- static_assert((std::is_same<decltype(cbrt((unsigned long)0)), double>::value), "");
- static_assert((std::is_same<decltype(cbrt((long long)0)), double>::value), "");
- static_assert((std::is_same<decltype(cbrt((unsigned long long)0)), double>::value), "");
- static_assert((std::is_same<decltype(cbrt((double)0)), double>::value), "");
- static_assert((std::is_same<decltype(cbrt((long double)0)), long double>::value), "");
+void test_cbrt() {
+ static_assert((std::is_same<decltype(cbrt((float) 0)), float>::value), "");
+ static_assert((std::is_same<decltype(cbrt((bool) 0)), double>::value), "");
+ static_assert((std::is_same<decltype(cbrt((unsigned short) 0)),
+ double>::value), "");
+ static_assert((std::is_same<decltype(cbrt((int) 0)), double>::value), "");
+ static_assert((std::is_same<decltype(cbrt((unsigned int) 0)),
+ double>::value), "");
+ static_assert((std::is_same<decltype(cbrt((long) 0)), double>::value), "");
+ static_assert((std::is_same<decltype(cbrt((unsigned long) 0)),
+ double>::value), "");
+ static_assert((std::is_same<decltype(cbrt((long long) 0)), double>::value),
+ "");
+ static_assert((std::is_same<decltype(cbrt((unsigned long long) 0)),
+ double>::value), "");
+ static_assert((std::is_same<decltype(cbrt((double) 0)), double>::value),
+ "");
+ static_assert((std::is_same<decltype(cbrt((long double) 0)),
+ long double>::value), "");
static_assert((std::is_same<decltype(cbrtf(0)), float>::value), "");
static_assert((std::is_same<decltype(cbrtl(0)), long double>::value), "");
- static_assert((std::is_same<decltype(cbrt(Ambiguous())), Ambiguous>::value), "");
- assert(cbrt(1) == 1);
+ static_assert((std::is_same<decltype(cbrt(Ambiguous())), Ambiguous>::value),
+ "");
+ assert(truncate_fp(cbrt(1)) == 1);
+
}
void test_copysign()
diff --git a/test/std/depr/depr.c.headers/stdlib_h.pass.cpp b/test/std/depr/depr.c.headers/stdlib_h.pass.cpp
index 07ffa0b75513c..cc566d069f7f5 100644
--- a/test/std/depr/depr.c.headers/stdlib_h.pass.cpp
+++ b/test/std/depr/depr.c.headers/stdlib_h.pass.cpp
@@ -87,11 +87,9 @@ int main()
static_assert((std::is_same<decltype(srand(0)), void>::value), "");
// Microsoft does not implement aligned_alloc in their C library
-#ifndef TEST_COMPILER_C1XX
-#if TEST_STD_VER > 14 && defined(TEST_HAS_C11_FEATURES)
+#if TEST_STD_VER > 14 && defined(TEST_HAS_C11_FEATURES) && !defined(_WIN32)
static_assert((std::is_same<decltype(aligned_alloc(0,0)), void*>::value), "");
#endif
-#endif
static_assert((std::is_same<decltype(calloc(0,0)), void*>::value), "");
static_assert((std::is_same<decltype(free(0)), void>::value), "");
diff --git a/test/std/depr/depr.c.headers/uchar_h.pass.cpp b/test/std/depr/depr.c.headers/uchar_h.pass.cpp
index f121698455990..be4ea0dae727e 100644
--- a/test/std/depr/depr.c.headers/uchar_h.pass.cpp
+++ b/test/std/depr/depr.c.headers/uchar_h.pass.cpp
@@ -10,6 +10,7 @@
// XFAIL: suse-linux-enterprise-server-11
// XFAIL: apple-darwin
// XFAIL: newlib
+// XFAIL: netbsd
// <uchar.h>
diff --git a/test/std/depr/depr.lib.binders/depr.lib.bind.1st/bind1st.depr_in_cxx11.fail.cpp b/test/std/depr/depr.lib.binders/depr.lib.bind.1st/bind1st.depr_in_cxx11.fail.cpp
new file mode 100644
index 0000000000000..652f53181a319
--- /dev/null
+++ b/test/std/depr/depr.lib.binders/depr.lib.bind.1st/bind1st.depr_in_cxx11.fail.cpp
@@ -0,0 +1,31 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <functional>
+//
+// bind1st
+
+// UNSUPPORTED: clang-4.0
+// UNSUPPORTED: c++98, c++03
+// REQUIRES: verify-support
+
+// MODULES_DEFINES: _LIBCPP_ENABLE_DEPRECATION_WARNINGS
+// MODULES_DEFINES: _LIBCPP_ENABLE_CXX17_REMOVED_BINDERS
+#define _LIBCPP_ENABLE_DEPRECATION_WARNINGS
+#define _LIBCPP_ENABLE_CXX17_REMOVED_BINDERS
+
+#include <functional>
+
+#include "../test_func.h"
+#include "test_macros.h"
+
+int main()
+{
+ std::bind1st(test_func(1), 5); // expected-error{{'bind1st<test_func, int>' is deprecated}}
+}
diff --git a/test/std/depr/depr.lib.binders/depr.lib.bind.2nd/bind2nd.depr_in_cxx11.fail.cpp b/test/std/depr/depr.lib.binders/depr.lib.bind.2nd/bind2nd.depr_in_cxx11.fail.cpp
new file mode 100644
index 0000000000000..95cf150cc9fe5
--- /dev/null
+++ b/test/std/depr/depr.lib.binders/depr.lib.bind.2nd/bind2nd.depr_in_cxx11.fail.cpp
@@ -0,0 +1,31 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <functional>
+//
+// bind2nd
+
+// UNSUPPORTED: clang-4.0
+// UNSUPPORTED: c++98, c++03
+// REQUIRES: verify-support
+
+// MODULES_DEFINES: _LIBCPP_ENABLE_DEPRECATION_WARNINGS
+// MODULES_DEFINES: _LIBCPP_ENABLE_CXX17_REMOVED_BINDERS
+#define _LIBCPP_ENABLE_DEPRECATION_WARNINGS
+#define _LIBCPP_ENABLE_CXX17_REMOVED_BINDERS
+
+#include <functional>
+
+#include "../test_func.h"
+#include "test_macros.h"
+
+int main()
+{
+ std::bind2nd(test_func(1), 5); // expected-error{{'bind2nd<test_func, int>' is deprecated}}
+}
diff --git a/test/std/depr/depr.lib.binders/depr.lib.binder.1st/binder1st.depr_in_cxx11.fail.cpp b/test/std/depr/depr.lib.binders/depr.lib.binder.1st/binder1st.depr_in_cxx11.fail.cpp
new file mode 100644
index 0000000000000..8f57eba4d97be
--- /dev/null
+++ b/test/std/depr/depr.lib.binders/depr.lib.binder.1st/binder1st.depr_in_cxx11.fail.cpp
@@ -0,0 +1,31 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <functional>
+//
+// binder1st
+
+// UNSUPPORTED: clang-4.0
+// UNSUPPORTED: c++98, c++03
+// REQUIRES: verify-support
+
+// MODULES_DEFINES: _LIBCPP_ENABLE_DEPRECATION_WARNINGS
+// MODULES_DEFINES: _LIBCPP_ENABLE_CXX17_REMOVED_BINDERS
+#define _LIBCPP_ENABLE_DEPRECATION_WARNINGS
+#define _LIBCPP_ENABLE_CXX17_REMOVED_BINDERS
+
+#include <functional>
+
+#include "../test_func.h"
+#include "test_macros.h"
+
+int main()
+{
+ typedef std::binder1st<test_func> B1ST; // expected-error{{'binder1st<test_func>' is deprecated}}
+}
diff --git a/test/std/depr/depr.lib.binders/depr.lib.binder.2nd/binder2nd.depr_in_cxx11.fail.cpp b/test/std/depr/depr.lib.binders/depr.lib.binder.2nd/binder2nd.depr_in_cxx11.fail.cpp
new file mode 100644
index 0000000000000..c49334fa09778
--- /dev/null
+++ b/test/std/depr/depr.lib.binders/depr.lib.binder.2nd/binder2nd.depr_in_cxx11.fail.cpp
@@ -0,0 +1,31 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <functional>
+//
+// binder2nd
+
+// UNSUPPORTED: clang-4.0
+// UNSUPPORTED: c++98, c++03
+// REQUIRES: verify-support
+
+// MODULES_DEFINES: _LIBCPP_ENABLE_DEPRECATION_WARNINGS
+// MODULES_DEFINES: _LIBCPP_ENABLE_CXX17_REMOVED_BINDERS
+#define _LIBCPP_ENABLE_DEPRECATION_WARNINGS
+#define _LIBCPP_ENABLE_CXX17_REMOVED_BINDERS
+
+#include <functional>
+
+#include "../test_func.h"
+#include "test_macros.h"
+
+int main()
+{
+ typedef std::binder2nd<test_func> B2ND; // expected-error{{'binder2nd<test_func>' is deprecated}}
+}
diff --git a/test/std/depr/depr.str.strstreams/depr.strstreambuf/depr.strstreambuf.members/overflow.pass.cpp b/test/std/depr/depr.str.strstreams/depr.strstreambuf/depr.strstreambuf.members/overflow.pass.cpp
index c829a97b4228f..652100c978b86 100644
--- a/test/std/depr/depr.str.strstreams/depr.strstreambuf/depr.strstreambuf.members/overflow.pass.cpp
+++ b/test/std/depr/depr.str.strstreams/depr.strstreambuf/depr.strstreambuf.members/overflow.pass.cpp
@@ -9,14 +9,14 @@
// <strstream>
-// There was an overflow in the dylib on older macOS versions
-// UNSUPPORTED: availability=macosx10.8
-// UNSUPPORTED: availability=macosx10.7
-
// class strstreambuf
// int overflow(int c);
+// There was an overflow in the dylib on older macOS versions
+// UNSUPPORTED: with_system_cxx_lib=macosx10.8
+// UNSUPPORTED: with_system_cxx_lib=macosx10.7
+
#include <iostream>
#include <string>
#include <strstream>
diff --git a/test/std/experimental/simd/simd.access/default.pass.cpp b/test/std/experimental/simd/simd.access/default.pass.cpp
index 6ce32cab86736..d799675a9bc75 100644
--- a/test/std/experimental/simd/simd.access/default.pass.cpp
+++ b/test/std/experimental/simd/simd.access/default.pass.cpp
@@ -165,7 +165,7 @@ void test_access() {
}
{
auto c = a;
- (void)(a[0] + (c[0] <<= a[0]));
+ (void)(a[0] + (c[0] <<= b[0]));
}
{
auto c = a;
diff --git a/test/std/input.output/filesystems/class.directory_iterator/directory_iterator.members/increment.pass.cpp b/test/std/input.output/filesystems/class.directory_iterator/directory_iterator.members/increment.pass.cpp
index 7ec814b214e28..a641e92372f61 100644
--- a/test/std/input.output/filesystems/class.directory_iterator/directory_iterator.members/increment.pass.cpp
+++ b/test/std/input.output/filesystems/class.directory_iterator/directory_iterator.members/increment.pass.cpp
@@ -32,7 +32,6 @@ TEST_SUITE(directory_iterator_increment_tests)
TEST_CASE(test_increment_signatures)
{
- using D = directory_iterator;
directory_iterator d; ((void)d);
std::error_code ec; ((void)ec);
diff --git a/test/std/input.output/filesystems/class.directory_iterator/directory_iterator.nonmembers/begin_end.pass.cpp b/test/std/input.output/filesystems/class.directory_iterator/directory_iterator.nonmembers/begin_end.pass.cpp
index 71e8e55ae0343..1aa177505e60f 100644
--- a/test/std/input.output/filesystems/class.directory_iterator/directory_iterator.nonmembers/begin_end.pass.cpp
+++ b/test/std/input.output/filesystems/class.directory_iterator/directory_iterator.nonmembers/begin_end.pass.cpp
@@ -32,7 +32,6 @@ TEST_SUITE(directory_iterator_begin_end_tests)
TEST_CASE(test_function_signatures)
{
- using D = directory_iterator;
directory_iterator d; ((void)d);
ASSERT_SAME_TYPE(decltype(begin(d)), directory_iterator);
diff --git a/test/std/input.output/filesystems/class.path/path.member/path.compare.pass.cpp b/test/std/input.output/filesystems/class.path/path.member/path.compare.pass.cpp
index 7791097dcd178..2be6122a0f8ca 100644
--- a/test/std/input.output/filesystems/class.path/path.member/path.compare.pass.cpp
+++ b/test/std/input.output/filesystems/class.path/path.member/path.compare.pass.cpp
@@ -65,6 +65,8 @@ const PathCompareTest CompareTestCases[] =
{"//foo//bar///baz////", "//foo/bar/baz/", 0}, // duplicate separators
{"///foo/bar", "/foo/bar", 0}, // "///" is not a root directory
{"/foo/bar/", "/foo/bar", 1}, // trailing separator
+ {"foo", "/foo", -1}, // if !this->has_root_directory() and p.has_root_directory(), a value less than 0.
+ {"/foo", "foo", 1}, // if this->has_root_directory() and !p.has_root_directory(), a value greater than 0.
{"//" LONGA "////" LONGB "/" LONGC "///" LONGD, "//" LONGA "/" LONGB "/" LONGC "/" LONGD, 0},
{ LONGA "/" LONGB "/" LONGC, LONGA "/" LONGB "/" LONGB, 1}
@@ -79,7 +81,7 @@ static inline int normalize_ret(int ret)
return ret < 0 ? -1 : (ret > 0 ? 1 : 0);
}
-int main()
+void test_compare_basic()
{
using namespace fs;
for (auto const & TC : CompareTestCases) {
@@ -136,3 +138,54 @@ int main()
}
}
}
+
+int CompareElements(std::vector<std::string> const& LHS, std::vector<std::string> const& RHS) {
+ bool IsLess = std::lexicographical_compare(LHS.begin(), LHS.end(), RHS.begin(), RHS.end());
+ if (IsLess)
+ return -1;
+
+ bool IsGreater = std::lexicographical_compare(RHS.begin(), RHS.end(), LHS.begin(), LHS.end());
+ if (IsGreater)
+ return 1;
+
+ return 0;
+}
+
+void test_compare_elements() {
+ struct {
+ std::vector<std::string> LHSElements;
+ std::vector<std::string> RHSElements;
+ int Expect;
+ } TestCases[] = {
+ {{"a"}, {"a"}, 0},
+ {{"a"}, {"b"}, -1},
+ {{"b"}, {"a"}, 1},
+ {{"a", "b", "c"}, {"a", "b", "c"}, 0},
+ {{"a", "b", "c"}, {"a", "b", "d"}, -1},
+ {{"a", "b", "d"}, {"a", "b", "c"}, 1},
+ {{"a", "b"}, {"a", "b", "c"}, -1},
+ {{"a", "b", "c"}, {"a", "b"}, 1},
+
+ };
+
+ auto BuildPath = [](std::vector<std::string> const& Elems) {
+ fs::path p;
+ for (auto &E : Elems)
+ p /= E;
+ return p;
+ };
+
+ for (auto &TC : TestCases) {
+ fs::path LHS = BuildPath(TC.LHSElements);
+ fs::path RHS = BuildPath(TC.RHSElements);
+ const int ExpectCmp = CompareElements(TC.LHSElements, TC.RHSElements);
+ assert(ExpectCmp == TC.Expect);
+ const int GotCmp = normalize_ret(LHS.compare(RHS));
+ assert(GotCmp == TC.Expect);
+ }
+}
+
+int main() {
+ test_compare_basic();
+ test_compare_elements();
+}
diff --git a/test/std/input.output/filesystems/class.path/path.member/path.gen/lexically_relative_and_proximate.pass.cpp b/test/std/input.output/filesystems/class.path/path.member/path.gen/lexically_relative_and_proximate.pass.cpp
index 52c577bc8a71c..f4e1d2f74dffb 100644
--- a/test/std/input.output/filesystems/class.path/path.member/path.gen/lexically_relative_and_proximate.pass.cpp
+++ b/test/std/input.output/filesystems/class.path/path.member/path.gen/lexically_relative_and_proximate.pass.cpp
@@ -40,8 +40,8 @@ int main() {
{"a", "/", ""},
{"//net", "a", ""},
{"a", "//net", ""},
- {"//net/", "//net", ""},
- {"//net", "//net/", ".."},
+ {"//net/", "//net", "."},
+ {"//net", "//net/", "."},
{"//base", "a", ""},
{"a", "a", "."},
{"a/b", "a/b", "."},
diff --git a/test/std/input.output/filesystems/class.path/path.nonmember/append_op.fail.cpp b/test/std/input.output/filesystems/class.path/path.nonmember/append_op.fail.cpp
new file mode 100644
index 0000000000000..e0b3a959c29f6
--- /dev/null
+++ b/test/std/input.output/filesystems/class.path/path.nonmember/append_op.fail.cpp
@@ -0,0 +1,27 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++98, c++03
+
+// <filesystem>
+
+#include "filesystem_include.hpp"
+
+using namespace fs;
+
+struct ConvToPath {
+ operator fs::path() const {
+ return "";
+ }
+};
+
+int main() {
+ ConvToPath LHS, RHS;
+ (void)(LHS / RHS); // expected-error {{invalid operands to binary expression}}
+} \ No newline at end of file
diff --git a/test/std/input.output/filesystems/class.path/path.nonmember/append_op.pass.cpp b/test/std/input.output/filesystems/class.path/path.nonmember/append_op.pass.cpp
index 09498bf2135ac..2a291d61da7cd 100644
--- a/test/std/input.output/filesystems/class.path/path.nonmember/append_op.pass.cpp
+++ b/test/std/input.output/filesystems/class.path/path.nonmember/append_op.pass.cpp
@@ -20,7 +20,6 @@
#include "test_macros.h"
#include "filesystem_test_helper.hpp"
-
// This is mainly tested via the member append functions.
int main()
{
@@ -29,4 +28,7 @@ int main()
path p2("def");
path p3 = p1 / p2;
assert(p3 == "abc/def");
+
+ path p4 = p1 / "def";
+ assert(p4 == "abc/def");
}
diff --git a/test/std/input.output/filesystems/class.path/path.nonmember/comparison_ops.fail.cpp b/test/std/input.output/filesystems/class.path/path.nonmember/comparison_ops.fail.cpp
new file mode 100644
index 0000000000000..00eafe532d08e
--- /dev/null
+++ b/test/std/input.output/filesystems/class.path/path.nonmember/comparison_ops.fail.cpp
@@ -0,0 +1,33 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++98, c++03
+
+// <filesystem>
+
+
+#include "filesystem_include.hpp"
+
+using namespace fs;
+
+struct ConvToPath {
+ operator fs::path() const {
+ return "";
+ }
+};
+
+int main() {
+ ConvToPath LHS, RHS;
+ (void)(LHS == RHS); // expected-error {{invalid operands to binary expression}}
+ (void)(LHS != RHS); // expected-error {{invalid operands to binary expression}}
+ (void)(LHS < RHS); // expected-error {{invalid operands to binary expression}}
+ (void)(LHS <= RHS); // expected-error {{invalid operands to binary expression}}
+ (void)(LHS > RHS); // expected-error {{invalid operands to binary expression}}
+ (void)(LHS >= RHS); // expected-error {{invalid operands to binary expression}}
+} \ No newline at end of file
diff --git a/test/std/input.output/filesystems/class.rec.dir.itr/rec.dir.itr.members/increment.pass.cpp b/test/std/input.output/filesystems/class.rec.dir.itr/rec.dir.itr.members/increment.pass.cpp
index bfc818924d18d..2d30cc3b84d29 100644
--- a/test/std/input.output/filesystems/class.rec.dir.itr/rec.dir.itr.members/increment.pass.cpp
+++ b/test/std/input.output/filesystems/class.rec.dir.itr/rec.dir.itr.members/increment.pass.cpp
@@ -31,7 +31,6 @@ TEST_SUITE(recursive_directory_iterator_increment_tests)
TEST_CASE(test_increment_signatures)
{
- using D = recursive_directory_iterator;
recursive_directory_iterator d; ((void)d);
std::error_code ec; ((void)ec);
diff --git a/test/std/input.output/filesystems/class.rec.dir.itr/rec.dir.itr.nonmembers/begin_end.pass.cpp b/test/std/input.output/filesystems/class.rec.dir.itr/rec.dir.itr.nonmembers/begin_end.pass.cpp
index 04bc2dd1d96b6..9807309f44a48 100644
--- a/test/std/input.output/filesystems/class.rec.dir.itr/rec.dir.itr.nonmembers/begin_end.pass.cpp
+++ b/test/std/input.output/filesystems/class.rec.dir.itr/rec.dir.itr.nonmembers/begin_end.pass.cpp
@@ -32,7 +32,6 @@ TEST_SUITE(recursive_directory_iterator_begin_end_tests)
TEST_CASE(test_function_signatures)
{
- using D = recursive_directory_iterator;
recursive_directory_iterator d; ((void)d);
ASSERT_SAME_TYPE(decltype(begin(d)), recursive_directory_iterator);
diff --git a/test/std/input.output/filesystems/fs.op.funcs/fs.op.last_write_time/last_write_time.pass.cpp b/test/std/input.output/filesystems/fs.op.funcs/fs.op.last_write_time/last_write_time.pass.cpp
index bc77f3f6351bc..bf0096acff19a 100644
--- a/test/std/input.output/filesystems/fs.op.funcs/fs.op.last_write_time/last_write_time.pass.cpp
+++ b/test/std/input.output/filesystems/fs.op.funcs/fs.op.last_write_time/last_write_time.pass.cpp
@@ -108,7 +108,6 @@ struct Times {
};
Times GetTimes(path const& p) {
- using Clock = file_time_type::clock;
StatT st;
if (::stat(p.c_str(), &st) == -1) {
std::error_code ec(errno, std::generic_category());
@@ -126,8 +125,7 @@ TimeSpec LastAccessTime(path const& p) { return GetTimes(p).access; }
TimeSpec LastWriteTime(path const& p) { return GetTimes(p).write; }
-std::pair<TimeSpec, TimeSpec> GetSymlinkTimes(path const& p) {
- using Clock = file_time_type::clock;
+Times GetSymlinkTimes(path const& p) {
StatT st;
if (::lstat(p.c_str(), &st) == -1) {
std::error_code ec(errno, std::generic_category());
@@ -138,7 +136,10 @@ std::pair<TimeSpec, TimeSpec> GetSymlinkTimes(path const& p) {
std::exit(EXIT_FAILURE);
#endif
}
- return {extract_atime(st), extract_mtime(st)};
+ Times res;
+ res.access = extract_atime(st);
+ res.write = extract_mtime(st);
+ return res;
}
namespace {
@@ -429,7 +430,7 @@ TEST_CASE(set_last_write_time_dynamic_env_test)
epoch_time - Minutes(3) - Sec(42) - SubSec(17);
// FreeBSD has a bug in their utimes implementation where the time is not update
// when the number of seconds is '-1'.
-#if defined(__FreeBSD__)
+#if defined(__FreeBSD__) || defined(__NetBSD__)
const file_time_type just_before_epoch_time =
epoch_time - Sec(2) - SubSec(17);
#else
@@ -502,15 +503,13 @@ TEST_CASE(last_write_time_symlink_test)
TEST_CHECK(CompareTime(LastWriteTime(file), new_time));
TEST_CHECK(CompareTime(LastAccessTime(sym), old_times.access));
- std::pair<TimeSpec, TimeSpec> sym_times = GetSymlinkTimes(sym);
- TEST_CHECK(CompareTime(sym_times.first, old_sym_times.first));
- TEST_CHECK(CompareTime(sym_times.second, old_sym_times.second));
+ Times sym_times = GetSymlinkTimes(sym);
+ TEST_CHECK(CompareTime(sym_times.write, old_sym_times.write));
}
TEST_CASE(test_write_min_time)
{
- using Clock = file_time_type::clock;
scoped_test_env env;
const path p = env.create_file("file", 42);
const file_time_type old_time = last_write_time(p);
@@ -545,10 +544,6 @@ TEST_CASE(test_write_min_time)
}
TEST_CASE(test_write_max_time) {
- using Clock = file_time_type::clock;
- using Sec = std::chrono::seconds;
- using Hours = std::chrono::hours;
-
scoped_test_env env;
const path p = env.create_file("file", 42);
const file_time_type old_time = last_write_time(p);
diff --git a/test/std/input.output/filesystems/fs.op.funcs/fs.op.permissions/permissions.pass.cpp b/test/std/input.output/filesystems/fs.op.funcs/fs.op.permissions/permissions.pass.cpp
index cbe2b2d09fb39..b5fb838dd8600 100644
--- a/test/std/input.output/filesystems/fs.op.funcs/fs.op.permissions/permissions.pass.cpp
+++ b/test/std/input.output/filesystems/fs.op.funcs/fs.op.permissions/permissions.pass.cpp
@@ -159,7 +159,7 @@ TEST_CASE(test_no_resolve_symlink_on_symlink)
{perms::owner_all, perms::group_all, perm_options::remove},
};
for (auto const& TC : cases) {
-#if defined(__APPLE__) || defined(__FreeBSD__)
+#if defined(__APPLE__) || defined(__FreeBSD__) || defined(__NetBSD__)
// On OS X symlink permissions are supported. We should get an empty
// error code and the expected permissions.
const auto expected_link_perms = TC.expected;
diff --git a/test/std/input.output/filesystems/fs.op.funcs/fs.op.proximate/proximate.pass.cpp b/test/std/input.output/filesystems/fs.op.funcs/fs.op.proximate/proximate.pass.cpp
index 5f7b30dd60b9d..ec4fc6d910109 100644
--- a/test/std/input.output/filesystems/fs.op.funcs/fs.op.proximate/proximate.pass.cpp
+++ b/test/std/input.output/filesystems/fs.op.funcs/fs.op.proximate/proximate.pass.cpp
@@ -75,12 +75,12 @@ TEST_CASE(basic_test) {
{"a", parent_cwd, "fs.op.proximate/a"},
{"/", "a", dot_dot_to_root / ".."},
{"/", "a/b", dot_dot_to_root / "../.."},
- {"/", "a/b/", dot_dot_to_root / "../../.."},
+ {"/", "a/b/", dot_dot_to_root / "../.."},
{"a", "/", relative_cwd / "a"},
{"a/b", "/", relative_cwd / "a/b"},
{"a", "/net", ".." / relative_cwd / "a"},
- {"//foo/", "//foo", "/foo/"},
- {"//foo", "//foo/", ".."},
+ {"//foo/", "//foo", "."},
+ {"//foo", "//foo/", "."},
{"//foo", "//foo", "."},
{"//foo/", "//foo/", "."},
{"//base", "a", dot_dot_to_root / "../base"},
diff --git a/test/std/input.output/filesystems/fs.op.funcs/fs.op.relative/relative.pass.cpp b/test/std/input.output/filesystems/fs.op.funcs/fs.op.relative/relative.pass.cpp
index e240c64967556..940f886f99779 100644
--- a/test/std/input.output/filesystems/fs.op.funcs/fs.op.relative/relative.pass.cpp
+++ b/test/std/input.output/filesystems/fs.op.funcs/fs.op.relative/relative.pass.cpp
@@ -16,9 +16,8 @@
// path proximate(const path& p, const path& base, error_code& ec);
#include "filesystem_include.hpp"
+#include <string>
#include <type_traits>
-#include <vector>
-#include <iostream>
#include <cassert>
#include "test_macros.h"
@@ -30,49 +29,90 @@
TEST_SUITE(filesystem_proximate_path_test_suite)
-TEST_CASE(test_signature) {
+TEST_CASE(test_signature_0) {
+ fs::path p("");
+ const fs::path output = fs::weakly_canonical(p);
+ TEST_CHECK(output == std::string(fs::current_path()));
+}
+
+TEST_CASE(test_signature_1) {
+ fs::path p(".");
+ const fs::path output = fs::weakly_canonical(p);
+ TEST_CHECK(output == std::string(fs::current_path()));
+}
+
+TEST_CASE(test_signature_2) {
+ fs::path p(StaticEnv::File);
+ const fs::path output = fs::weakly_canonical(p);
+ TEST_CHECK(output == std::string(StaticEnv::File));
+}
+
+TEST_CASE(test_signature_3) {
+ fs::path p(StaticEnv::Dir);
+ const fs::path output = fs::weakly_canonical(p);
+ TEST_CHECK(output == std::string(StaticEnv::Dir));
+}
+
+TEST_CASE(test_signature_4) {
+ fs::path p(StaticEnv::SymlinkToDir);
+ const fs::path output = fs::weakly_canonical(p);
+ TEST_CHECK(output == std::string(StaticEnv::Dir));
+}
+
+TEST_CASE(test_signature_5) {
+ fs::path p(StaticEnv::SymlinkToDir / "dir2/.");
+ const fs::path output = fs::weakly_canonical(p);
+ TEST_CHECK(output == std::string(StaticEnv::Dir / "dir2"));
+}
+
+TEST_CASE(test_signature_6) {
+ // FIXME? If the trailing separator occurs in a part of the path that exists,
+ // it is ommitted. Otherwise it is added to the end of the result.
+ fs::path p(StaticEnv::SymlinkToDir / "dir2/./");
+ const fs::path output = fs::weakly_canonical(p);
+ TEST_CHECK(output == std::string(StaticEnv::Dir / "dir2"));
+}
+
+TEST_CASE(test_signature_7) {
+ fs::path p(StaticEnv::SymlinkToDir / "dir2/DNE/./");
+ const fs::path output = fs::weakly_canonical(p);
+ TEST_CHECK(output == std::string(StaticEnv::Dir / "dir2/DNE/"));
+}
+
+TEST_CASE(test_signature_8) {
+ fs::path p(StaticEnv::SymlinkToDir / "dir2");
+ const fs::path output = fs::weakly_canonical(p);
+ TEST_CHECK(output == std::string(StaticEnv::Dir2));
+}
+
+TEST_CASE(test_signature_9) {
+ fs::path p(StaticEnv::SymlinkToDir / "dir2/../dir2/DNE/..");
+ const fs::path output = fs::weakly_canonical(p);
+ TEST_CHECK(output == std::string(StaticEnv::Dir2 / ""));
+}
+
+TEST_CASE(test_signature_10) {
+ fs::path p(StaticEnv::SymlinkToDir / "dir2/dir3/../DNE/DNE2");
+ const fs::path output = fs::weakly_canonical(p);
+ TEST_CHECK(output == std::string(StaticEnv::Dir2 / "DNE/DNE2"));
+}
+TEST_CASE(test_signature_11) {
+ fs::path p(StaticEnv::Dir / "../dir1");
+ const fs::path output = fs::weakly_canonical(p);
+ TEST_CHECK(output == std::string(StaticEnv::Dir));
}
-int main() {
- // clang-format off
- struct {
- std::string input;
- std::string expect;
- } TestCases[] = {
- {"", fs::current_path()},
- {".", fs::current_path()},
- {StaticEnv::File, StaticEnv::File},
- {StaticEnv::Dir, StaticEnv::Dir},
- {StaticEnv::SymlinkToDir, StaticEnv::Dir},
- {StaticEnv::SymlinkToDir / "dir2/.", StaticEnv::Dir / "dir2"},
- // FIXME? If the trailing separator occurs in a part of the path that exists,
- // it is ommitted. Otherwise it is added to the end of the result.
- {StaticEnv::SymlinkToDir / "dir2/./", StaticEnv::Dir / "dir2"},
- {StaticEnv::SymlinkToDir / "dir2/DNE/./", StaticEnv::Dir / "dir2/DNE/"},
- {StaticEnv::SymlinkToDir / "dir2", StaticEnv::Dir2},
- {StaticEnv::SymlinkToDir / "dir2/../dir2/DNE/..", StaticEnv::Dir2 / ""},
- {StaticEnv::SymlinkToDir / "dir2/dir3/../DNE/DNE2", StaticEnv::Dir2 / "DNE/DNE2"},
- {StaticEnv::Dir / "../dir1", StaticEnv::Dir},
- {StaticEnv::Dir / "./.", StaticEnv::Dir},
- {StaticEnv::Dir / "DNE/../foo", StaticEnv::Dir / "foo"}
- };
- // clang-format on
- int ID = 0;
- bool Failed = false;
- for (auto& TC : TestCases) {
- ++ID;
- fs::path p(TC.input);
- const fs::path output = fs::weakly_canonical(p);
- if (output != TC.expect) {
- Failed = true;
- std::cerr << "TEST CASE #" << ID << " FAILED: \n";
- std::cerr << " Input: '" << TC.input << "'\n";
- std::cerr << " Expected: '" << TC.expect << "'\n";
- std::cerr << " Output: '" << output.native() << "'";
- std::cerr << std::endl;
- }
- }
- return Failed;
+
+TEST_CASE(test_signature_12) {
+ fs::path p(StaticEnv::Dir / "./.");
+ const fs::path output = fs::weakly_canonical(p);
+ TEST_CHECK(output == std::string(StaticEnv::Dir));
+}
+
+TEST_CASE(test_signature_13) {
+ fs::path p(StaticEnv::Dir / "DNE/../foo");
+ const fs::path output = fs::weakly_canonical(p);
+ TEST_CHECK(output == std::string(StaticEnv::Dir / "foo"));
}
TEST_SUITE_END()
diff --git a/test/std/input.output/iostream.format/ext.manip/get_money.pass.cpp b/test/std/input.output/iostream.format/ext.manip/get_money.pass.cpp
index 1ea1d780c50ff..34b65f52dbd15 100644
--- a/test/std/input.output/iostream.format/ext.manip/get_money.pass.cpp
+++ b/test/std/input.output/iostream.format/ext.manip/get_money.pass.cpp
@@ -14,6 +14,7 @@
// REQUIRES: locale.en_US.UTF-8
#include <iomanip>
+#include <istream>
#include <cassert>
#include "platform_support.h" // locale name macros
diff --git a/test/std/input.output/iostream.format/ext.manip/get_time.pass.cpp b/test/std/input.output/iostream.format/ext.manip/get_time.pass.cpp
index 553c2b2eb3a08..7c653f348aef3 100644
--- a/test/std/input.output/iostream.format/ext.manip/get_time.pass.cpp
+++ b/test/std/input.output/iostream.format/ext.manip/get_time.pass.cpp
@@ -14,6 +14,7 @@
// template <class charT> T9 get_time(struct tm* tmb, const charT* fmt);
#include <iomanip>
+#include <istream>
#include <cassert>
#include "platform_support.h" // locale name macros
diff --git a/test/std/input.output/iostream.format/ext.manip/put_money.pass.cpp b/test/std/input.output/iostream.format/ext.manip/put_money.pass.cpp
index 342e33724cc79..92b6c726e755b 100644
--- a/test/std/input.output/iostream.format/ext.manip/put_money.pass.cpp
+++ b/test/std/input.output/iostream.format/ext.manip/put_money.pass.cpp
@@ -14,6 +14,7 @@
// REQUIRES: locale.en_US.UTF-8
#include <iomanip>
+#include <ostream>
#include <cassert>
#include "platform_support.h" // locale name macros
diff --git a/test/std/input.output/iostream.format/ext.manip/put_time.pass.cpp b/test/std/input.output/iostream.format/ext.manip/put_time.pass.cpp
index dae74f0401f87..915efd081b493 100644
--- a/test/std/input.output/iostream.format/ext.manip/put_time.pass.cpp
+++ b/test/std/input.output/iostream.format/ext.manip/put_time.pass.cpp
@@ -14,6 +14,7 @@
// template <class charT> T10 put_time(const struct tm* tmb, const charT* fmt);
#include <iomanip>
+#include <ostream>
#include <cassert>
#include "platform_support.h" // locale name macros
diff --git a/test/std/input.output/iostream.format/input.streams/istream.formatted/istream.formatted.arithmetic/int.pass.cpp b/test/std/input.output/iostream.format/input.streams/istream.formatted/istream.formatted.arithmetic/int.pass.cpp
index 25687db16f37e..8d1261137f84f 100644
--- a/test/std/input.output/iostream.format/input.streams/istream.formatted/istream.formatted.arithmetic/int.pass.cpp
+++ b/test/std/input.output/iostream.format/input.streams/istream.formatted/istream.formatted.arithmetic/int.pass.cpp
@@ -15,6 +15,7 @@
// operator>>(int& val);
#include <istream>
+#include <limits>
#include <cassert>
template <class CharT>
diff --git a/test/std/input.output/iostream.format/input.streams/istream.formatted/istream.formatted.arithmetic/short.pass.cpp b/test/std/input.output/iostream.format/input.streams/istream.formatted/istream.formatted.arithmetic/short.pass.cpp
index 62e44f542a649..22a760da63375 100644
--- a/test/std/input.output/iostream.format/input.streams/istream.formatted/istream.formatted.arithmetic/short.pass.cpp
+++ b/test/std/input.output/iostream.format/input.streams/istream.formatted/istream.formatted.arithmetic/short.pass.cpp
@@ -15,6 +15,7 @@
// operator>>(short& val);
#include <istream>
+#include <limits>
#include <cassert>
template <class CharT>
diff --git a/test/std/input.output/iostream.format/input.streams/istream.formatted/istream_extractors/signed_char_pointer.pass.cpp b/test/std/input.output/iostream.format/input.streams/istream.formatted/istream_extractors/signed_char_pointer.pass.cpp
index 70f1c20108fca..b815246d6c1fc 100644
--- a/test/std/input.output/iostream.format/input.streams/istream.formatted/istream_extractors/signed_char_pointer.pass.cpp
+++ b/test/std/input.output/iostream.format/input.streams/istream.formatted/istream_extractors/signed_char_pointer.pass.cpp
@@ -61,6 +61,17 @@ int main()
assert(std::string((char*)s) == "abc");
assert(is.width() == 0);
}
+#if TEST_STD_VER > 17
+ {
+ testbuf<char> sb(" abcdefghijk ");
+ std::istream is(&sb);
+ signed char s[4];
+ is >> s;
+ assert(!is.eof());
+ assert(!is.fail());
+ assert(std::string((char*)s) == "abc");
+ }
+#endif
{
testbuf<char> sb(" abcdefghijk");
std::istream is(&sb);
@@ -82,4 +93,15 @@ int main()
assert(std::string((char*)s) == "");
assert(is.width() == 0);
}
+#if TEST_STD_VER > 17
+ {
+ testbuf<char> sb(" abcdefghijk");
+ std::istream is(&sb);
+ signed char s[1];
+ is >> s;
+ assert(!is.eof());
+ assert( is.fail());
+ assert(std::string((char*)s) == "");
+ }
+#endif
}
diff --git a/test/std/input.output/iostream.format/input.streams/istream.formatted/istream_extractors/unsigned_char_pointer.pass.cpp b/test/std/input.output/iostream.format/input.streams/istream.formatted/istream_extractors/unsigned_char_pointer.pass.cpp
index 07fa5a79e8f28..1e98b7dfdbd8a 100644
--- a/test/std/input.output/iostream.format/input.streams/istream.formatted/istream_extractors/unsigned_char_pointer.pass.cpp
+++ b/test/std/input.output/iostream.format/input.streams/istream.formatted/istream_extractors/unsigned_char_pointer.pass.cpp
@@ -61,6 +61,17 @@ int main()
assert(std::string((char*)s) == "abc");
assert(is.width() == 0);
}
+#if TEST_STD_VER > 17
+ {
+ testbuf<char> sb(" abcdefghijk ");
+ std::istream is(&sb);
+ unsigned char s[4];
+ is >> s;
+ assert(!is.eof());
+ assert(!is.fail());
+ assert(std::string((char*)s) == "abc");
+ }
+#endif
{
testbuf<char> sb(" abcdefghijk");
std::istream is(&sb);
@@ -82,4 +93,15 @@ int main()
assert(std::string((char*)s) == "");
assert(is.width() == 0);
}
+#if TEST_STD_VER > 17
+ {
+ testbuf<char> sb(" abcdefghijk");
+ std::istream is(&sb);
+ unsigned char s[1];
+ is >> s;
+ assert(!is.eof());
+ assert( is.fail());
+ assert(std::string((char*)s) == "");
+ }
+#endif
}
diff --git a/test/std/input.output/iostream.format/input.streams/istream.formatted/istream_extractors/wchar_t_pointer.pass.cpp b/test/std/input.output/iostream.format/input.streams/istream.formatted/istream_extractors/wchar_t_pointer.pass.cpp
index a00c7a1dda381..82e460db927b7 100644
--- a/test/std/input.output/iostream.format/input.streams/istream.formatted/istream_extractors/wchar_t_pointer.pass.cpp
+++ b/test/std/input.output/iostream.format/input.streams/istream.formatted/istream_extractors/wchar_t_pointer.pass.cpp
@@ -50,6 +50,17 @@ int main()
assert(!is.fail());
assert(std::string(s) == "abcdefghijk");
}
+#if TEST_STD_VER > 17
+ {
+ testbuf<char> sb(" abcdefghijk ");
+ std::istream is(&sb);
+ char s[4];
+ is >> s;
+ assert(!is.eof());
+ assert(!is.fail());
+ assert(std::string(s) == "abc");
+ }
+#endif
{
testbuf<wchar_t> sb(L" abcdefghijk ");
std::wistream is(&sb);
@@ -71,6 +82,17 @@ int main()
assert(std::wstring(s) == L"abcdefghijk");
assert(is.width() == 0);
}
+#if TEST_STD_VER > 17
+ {
+ testbuf<wchar_t> sb(L" abcdefghijk");
+ std::wistream is(&sb);
+ wchar_t s[4];
+ is >> s;
+ assert(!is.eof());
+ assert(!is.fail());
+ assert(std::wstring(s) == L"abc");
+ }
+#endif
{
testbuf<char> sb(" abcdefghijk");
std::istream is(&sb);
@@ -82,4 +104,15 @@ int main()
assert(std::string(s) == "");
assert(is.width() == 0);
}
+#if TEST_STD_VER > 17
+ {
+ testbuf<char> sb(" abcdefghijk");
+ std::istream is(&sb);
+ char s[1];
+ is >> s;
+ assert(!is.eof());
+ assert( is.fail());
+ assert(std::string(s) == "");
+ }
+#endif
}
diff --git a/test/std/input.output/iostream.format/input.streams/istream.rvalue/rvalue.pass.cpp b/test/std/input.output/iostream.format/input.streams/istream.rvalue/rvalue.pass.cpp
index 77c41b09ad7bf..230a59a88ae51 100644
--- a/test/std/input.output/iostream.format/input.streams/istream.rvalue/rvalue.pass.cpp
+++ b/test/std/input.output/iostream.format/input.streams/istream.rvalue/rvalue.pass.cpp
@@ -65,7 +65,7 @@ int main()
{ // test perfect forwarding
assert(called == false);
std::istringstream ss;
- auto& out = (std::move(ss) >> A{});
+ auto&& out = (std::move(ss) >> A{});
assert(&out == &ss);
assert(called);
}
diff --git a/test/std/input.output/iostream.format/input.streams/istream.unformatted/get.pass.cpp b/test/std/input.output/iostream.format/input.streams/istream.unformatted/get.pass.cpp
index c7f16ca7e385c..0f356e26d237e 100644
--- a/test/std/input.output/iostream.format/input.streams/istream.unformatted/get.pass.cpp
+++ b/test/std/input.output/iostream.format/input.streams/istream.unformatted/get.pass.cpp
@@ -7,8 +7,6 @@
//
//===----------------------------------------------------------------------===//
-// XFAIL: with_system_cxx_lib=macosx10.7
-
// <istream>
// int_type get();
diff --git a/test/std/input.output/iostream.format/input.streams/istream.unformatted/get_chart.pass.cpp b/test/std/input.output/iostream.format/input.streams/istream.unformatted/get_chart.pass.cpp
index b3d3c69b43d30..cf06e343bcc2a 100644
--- a/test/std/input.output/iostream.format/input.streams/istream.unformatted/get_chart.pass.cpp
+++ b/test/std/input.output/iostream.format/input.streams/istream.unformatted/get_chart.pass.cpp
@@ -7,8 +7,6 @@
//
//===----------------------------------------------------------------------===//
-// XFAIL: with_system_cxx_lib=macosx10.7
-
// <istream>
// basic_istream<charT,traits>& get(char_type& c);
diff --git a/test/std/input.output/iostream.format/input.streams/istream.unformatted/get_pointer_size.pass.cpp b/test/std/input.output/iostream.format/input.streams/istream.unformatted/get_pointer_size.pass.cpp
index a45802c571dd4..83fd40befa660 100644
--- a/test/std/input.output/iostream.format/input.streams/istream.unformatted/get_pointer_size.pass.cpp
+++ b/test/std/input.output/iostream.format/input.streams/istream.unformatted/get_pointer_size.pass.cpp
@@ -7,13 +7,14 @@
//
//===----------------------------------------------------------------------===//
+// 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: with_system_cxx_lib=macosx10.14
// XFAIL: with_system_cxx_lib=macosx10.13
// XFAIL: with_system_cxx_lib=macosx10.12
// XFAIL: with_system_cxx_lib=macosx10.11
// XFAIL: with_system_cxx_lib=macosx10.10
// XFAIL: with_system_cxx_lib=macosx10.9
-// XFAIL: with_system_cxx_lib=macosx10.8
-// XFAIL: with_system_cxx_lib=macosx10.7
// <istream>
diff --git a/test/std/input.output/iostream.format/input.streams/istream.unformatted/get_pointer_size_chart.pass.cpp b/test/std/input.output/iostream.format/input.streams/istream.unformatted/get_pointer_size_chart.pass.cpp
index 437af84f9d612..8b42bae5592a7 100644
--- a/test/std/input.output/iostream.format/input.streams/istream.unformatted/get_pointer_size_chart.pass.cpp
+++ b/test/std/input.output/iostream.format/input.streams/istream.unformatted/get_pointer_size_chart.pass.cpp
@@ -7,13 +7,14 @@
//
//===----------------------------------------------------------------------===//
+// 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: with_system_cxx_lib=macosx10.14
// XFAIL: with_system_cxx_lib=macosx10.13
// XFAIL: with_system_cxx_lib=macosx10.12
// XFAIL: with_system_cxx_lib=macosx10.11
// XFAIL: with_system_cxx_lib=macosx10.10
// XFAIL: with_system_cxx_lib=macosx10.9
-// XFAIL: with_system_cxx_lib=macosx10.8
-// XFAIL: with_system_cxx_lib=macosx10.7
// <istream>
diff --git a/test/std/input.output/iostream.format/input.streams/istream.unformatted/getline_pointer_size.pass.cpp b/test/std/input.output/iostream.format/input.streams/istream.unformatted/getline_pointer_size.pass.cpp
index 7ee2c295636ba..f17aa16230334 100644
--- a/test/std/input.output/iostream.format/input.streams/istream.unformatted/getline_pointer_size.pass.cpp
+++ b/test/std/input.output/iostream.format/input.streams/istream.unformatted/getline_pointer_size.pass.cpp
@@ -7,13 +7,14 @@
//
//===----------------------------------------------------------------------===//
+// 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: with_system_cxx_lib=macosx10.14
// XFAIL: with_system_cxx_lib=macosx10.13
// XFAIL: with_system_cxx_lib=macosx10.12
// XFAIL: with_system_cxx_lib=macosx10.11
// XFAIL: with_system_cxx_lib=macosx10.10
// XFAIL: with_system_cxx_lib=macosx10.9
-// XFAIL: with_system_cxx_lib=macosx10.8
-// XFAIL: with_system_cxx_lib=macosx10.7
// <istream>
diff --git a/test/std/input.output/iostream.format/input.streams/istream.unformatted/getline_pointer_size_chart.pass.cpp b/test/std/input.output/iostream.format/input.streams/istream.unformatted/getline_pointer_size_chart.pass.cpp
index 1bce3fa5d4a5a..5c6a3c59ffc5b 100644
--- a/test/std/input.output/iostream.format/input.streams/istream.unformatted/getline_pointer_size_chart.pass.cpp
+++ b/test/std/input.output/iostream.format/input.streams/istream.unformatted/getline_pointer_size_chart.pass.cpp
@@ -7,13 +7,14 @@
//
//===----------------------------------------------------------------------===//
+// 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: with_system_cxx_lib=macosx10.14
// XFAIL: with_system_cxx_lib=macosx10.13
// XFAIL: with_system_cxx_lib=macosx10.12
// XFAIL: with_system_cxx_lib=macosx10.11
// XFAIL: with_system_cxx_lib=macosx10.10
// XFAIL: with_system_cxx_lib=macosx10.9
-// XFAIL: with_system_cxx_lib=macosx10.8
-// XFAIL: with_system_cxx_lib=macosx10.7
// <istream>
diff --git a/test/std/input.output/iostream.format/input.streams/istream.unformatted/ignore_0xff.pass.cpp b/test/std/input.output/iostream.format/input.streams/istream.unformatted/ignore_0xff.pass.cpp
index 3a37cffce3af6..3095712b9dbc2 100644
--- a/test/std/input.output/iostream.format/input.streams/istream.unformatted/ignore_0xff.pass.cpp
+++ b/test/std/input.output/iostream.format/input.streams/istream.unformatted/ignore_0xff.pass.cpp
@@ -7,9 +7,6 @@
//
//===----------------------------------------------------------------------===//
-// XFAIL: with_system_cxx_lib=macosx10.7
-// XFAIL: with_system_cxx_lib=macosx10.8
-
// <istream>
// basic_istream<charT,traits>&
diff --git a/test/std/input.output/iostream.format/input.streams/istream.unformatted/read.pass.cpp b/test/std/input.output/iostream.format/input.streams/istream.unformatted/read.pass.cpp
index ceef0d28fc6b8..20e70cfbd5cdf 100644
--- a/test/std/input.output/iostream.format/input.streams/istream.unformatted/read.pass.cpp
+++ b/test/std/input.output/iostream.format/input.streams/istream.unformatted/read.pass.cpp
@@ -7,8 +7,6 @@
//
//===----------------------------------------------------------------------===//
-// XFAIL: with_system_cxx_lib=macosx10.7
-
// <istream>
// basic_istream<charT,traits>& read(char_type* s, streamsize n);
diff --git a/test/std/input.output/iostream.format/input.streams/istream.unformatted/readsome.pass.cpp b/test/std/input.output/iostream.format/input.streams/istream.unformatted/readsome.pass.cpp
index a0a8e2f1b3b3a..01eecb5d824ba 100644
--- a/test/std/input.output/iostream.format/input.streams/istream.unformatted/readsome.pass.cpp
+++ b/test/std/input.output/iostream.format/input.streams/istream.unformatted/readsome.pass.cpp
@@ -7,9 +7,6 @@
//
//===----------------------------------------------------------------------===//
-// XFAIL: with_system_cxx_lib=macosx10.7
-// XFAIL: with_system_cxx_lib=macosx10.8
-
// <istream>
// streamsize readsome(char_type* s, streamsize n);
diff --git a/test/std/input.output/iostream.format/input.streams/istream.unformatted/seekg.pass.cpp b/test/std/input.output/iostream.format/input.streams/istream.unformatted/seekg.pass.cpp
index e370b4bfb0094..dc4e0ba0de202 100644
--- a/test/std/input.output/iostream.format/input.streams/istream.unformatted/seekg.pass.cpp
+++ b/test/std/input.output/iostream.format/input.streams/istream.unformatted/seekg.pass.cpp
@@ -7,9 +7,6 @@
//
//===----------------------------------------------------------------------===//
-// XFAIL: with_system_cxx_lib=macosx10.7
-// XFAIL: with_system_cxx_lib=macosx10.8
-
// <istream>
// basic_istream<charT,traits>& seekg(pos_type pos);
diff --git a/test/std/input.output/iostream.format/input.streams/istream.unformatted/seekg_off.pass.cpp b/test/std/input.output/iostream.format/input.streams/istream.unformatted/seekg_off.pass.cpp
index cac1e39554edb..3b7417ab23e7e 100644
--- a/test/std/input.output/iostream.format/input.streams/istream.unformatted/seekg_off.pass.cpp
+++ b/test/std/input.output/iostream.format/input.streams/istream.unformatted/seekg_off.pass.cpp
@@ -7,12 +7,9 @@
//
//===----------------------------------------------------------------------===//
-// XFAIL: with_system_cxx_lib=macosx10.12
// XFAIL: with_system_cxx_lib=macosx10.11
// XFAIL: with_system_cxx_lib=macosx10.10
// XFAIL: with_system_cxx_lib=macosx10.9
-// XFAIL: with_system_cxx_lib=macosx10.7
-// XFAIL: with_system_cxx_lib=macosx10.8
// <istream>
diff --git a/test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.arithmetic/minmax_showbase.pass.cpp b/test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.arithmetic/minmax_showbase.pass.cpp
index 956cd171a1de8..c23b3028cf411 100644
--- a/test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.arithmetic/minmax_showbase.pass.cpp
+++ b/test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.arithmetic/minmax_showbase.pass.cpp
@@ -24,6 +24,12 @@
// Testing to make sure that the max length values are correctly inserted when
// using std::showbase
+// 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: with_system_cxx_lib=macosx10.14
+// XFAIL: with_system_cxx_lib=macosx10.13
+// XFAIL: with_system_cxx_lib=macosx10.12
+
#include <cassert>
#include <cstdint>
#include <ios>
@@ -40,7 +46,7 @@ static void test(std::ios_base::fmtflags fmt, const char *expected)
assert(ss.str() == expected);
}
-int main(void)
+int main()
{
const std::ios_base::fmtflags o = std::ios_base::oct;
const std::ios_base::fmtflags d = std::ios_base::dec;
diff --git a/test/std/input.output/iostream.format/std.manip/resetiosflags.pass.cpp b/test/std/input.output/iostream.format/std.manip/resetiosflags.pass.cpp
index 6c01fc057da43..b0b3c31f7a89f 100644
--- a/test/std/input.output/iostream.format/std.manip/resetiosflags.pass.cpp
+++ b/test/std/input.output/iostream.format/std.manip/resetiosflags.pass.cpp
@@ -12,6 +12,8 @@
// T1 resetiosflags(ios_base::fmtflags mask);
#include <iomanip>
+#include <istream>
+#include <ostream>
#include <cassert>
template <class CharT>
diff --git a/test/std/input.output/iostream.format/std.manip/setbase.pass.cpp b/test/std/input.output/iostream.format/std.manip/setbase.pass.cpp
index e2776a5d1ab38..0a2fb36ec6e32 100644
--- a/test/std/input.output/iostream.format/std.manip/setbase.pass.cpp
+++ b/test/std/input.output/iostream.format/std.manip/setbase.pass.cpp
@@ -12,6 +12,8 @@
// T3 setbase(int base);
#include <iomanip>
+#include <istream>
+#include <ostream>
#include <cassert>
template <class CharT>
diff --git a/test/std/input.output/iostream.format/std.manip/setfill.pass.cpp b/test/std/input.output/iostream.format/std.manip/setfill.pass.cpp
index a4d923d70adee..e8600972d9f8b 100644
--- a/test/std/input.output/iostream.format/std.manip/setfill.pass.cpp
+++ b/test/std/input.output/iostream.format/std.manip/setfill.pass.cpp
@@ -12,6 +12,7 @@
// template<charT> T4 setfill(charT c);
#include <iomanip>
+#include <ostream>
#include <cassert>
template <class CharT>
diff --git a/test/std/input.output/iostream.format/std.manip/setiosflags.pass.cpp b/test/std/input.output/iostream.format/std.manip/setiosflags.pass.cpp
index 5aaf38444ab14..11532711a8548 100644
--- a/test/std/input.output/iostream.format/std.manip/setiosflags.pass.cpp
+++ b/test/std/input.output/iostream.format/std.manip/setiosflags.pass.cpp
@@ -12,6 +12,8 @@
// T2 setiosflags (ios_base::fmtflags mask);
#include <iomanip>
+#include <istream>
+#include <ostream>
#include <cassert>
template <class CharT>
diff --git a/test/std/input.output/iostream.format/std.manip/setprecision.pass.cpp b/test/std/input.output/iostream.format/std.manip/setprecision.pass.cpp
index 0bea4b98623b9..e04677fa346e7 100644
--- a/test/std/input.output/iostream.format/std.manip/setprecision.pass.cpp
+++ b/test/std/input.output/iostream.format/std.manip/setprecision.pass.cpp
@@ -12,6 +12,8 @@
// T5 setprecision(int n);
#include <iomanip>
+#include <istream>
+#include <ostream>
#include <cassert>
template <class CharT>
diff --git a/test/std/input.output/iostream.format/std.manip/setw.pass.cpp b/test/std/input.output/iostream.format/std.manip/setw.pass.cpp
index 9bd96984e5c98..3242bcc947d4c 100644
--- a/test/std/input.output/iostream.format/std.manip/setw.pass.cpp
+++ b/test/std/input.output/iostream.format/std.manip/setw.pass.cpp
@@ -12,6 +12,8 @@
// T6 setw(int n);
#include <iomanip>
+#include <istream>
+#include <ostream>
#include <cassert>
template <class CharT>
diff --git a/test/std/input.output/iostreams.base/ios/basic.ios.members/narrow.pass.cpp b/test/std/input.output/iostreams.base/ios/basic.ios.members/narrow.pass.cpp
index bf865e68149d4..3cdb434c4a8ca 100644
--- a/test/std/input.output/iostreams.base/ios/basic.ios.members/narrow.pass.cpp
+++ b/test/std/input.output/iostreams.base/ios/basic.ios.members/narrow.pass.cpp
@@ -18,7 +18,7 @@
int main()
{
- const std::ios ios(0);
- assert(ios.narrow('c', '*') == 'c');
- assert(ios.narrow('\xFE', '*') == '*');
+ const std::wios ios(0);
+ assert(ios.narrow(L'c', '*') == 'c');
+ assert(ios.narrow(L'\u203C', '*') == '*');
}
diff --git a/test/std/iterators/iterator.primitives/iterator.traits/empty.fail.cpp b/test/std/iterators/iterator.primitives/iterator.traits/empty.fail.cpp
new file mode 100644
index 0000000000000..0fab1aa15e83d
--- /dev/null
+++ b/test/std/iterators/iterator.primitives/iterator.traits/empty.fail.cpp
@@ -0,0 +1,122 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <iterator>
+
+// struct iterator_traits
+// {
+// };
+
+#include <iterator>
+#include "test_macros.h"
+
+struct A {};
+struct NotAnIteratorEmpty {};
+
+struct NotAnIteratorNoDifference
+{
+// typedef int difference_type;
+ typedef A value_type;
+ typedef A* pointer;
+ typedef A& reference;
+ typedef std::forward_iterator_tag iterator_category;
+};
+
+struct NotAnIteratorNoValue
+{
+ typedef int difference_type;
+// typedef A value_type;
+ typedef A* pointer;
+ typedef A& reference;
+ typedef std::forward_iterator_tag iterator_category;
+};
+
+struct NotAnIteratorNoPointer
+{
+ typedef int difference_type;
+ typedef A value_type;
+// typedef A* pointer;
+ typedef A& reference;
+ typedef std::forward_iterator_tag iterator_category;
+};
+
+struct NotAnIteratorNoReference
+{
+ typedef int difference_type;
+ typedef A value_type;
+ typedef A* pointer;
+// typedef A& reference;
+ typedef std::forward_iterator_tag iterator_category;
+};
+
+struct NotAnIteratorNoCategory
+{
+ typedef int difference_type;
+ typedef A value_type;
+ typedef A* pointer;
+ typedef A& reference;
+// typedef std::forward_iterator_tag iterator_category;
+};
+
+int main()
+{
+ {
+ typedef std::iterator_traits<NotAnIteratorEmpty> T;
+ typedef T::difference_type DT; // expected-error-re {{no type named 'difference_type' in 'std::{{.+}}::iterator_traits<{{.+}}>}}
+ typedef T::value_type VT; // expected-error-re {{no type named 'value_type' in 'std::{{.+}}::iterator_traits<{{.+}}>}}
+ typedef T::pointer PT; // expected-error-re {{no type named 'pointer' in 'std::{{.+}}::iterator_traits<{{.+}}>}}
+ typedef T::reference RT; // expected-error-re {{no type named 'reference' in 'std::{{.+}}::iterator_traits<{{.+}}>}}
+ typedef T::iterator_category CT; // expected-error-re {{no type named 'iterator_category' in 'std::{{.+}}::iterator_traits<{{.+}}>}}
+ }
+
+ {
+ typedef std::iterator_traits<NotAnIteratorNoDifference> T;
+ typedef T::difference_type DT; // expected-error-re {{no type named 'difference_type' in 'std::{{.+}}::iterator_traits<{{.+}}>}}
+ typedef T::value_type VT; // expected-error-re {{no type named 'value_type' in 'std::{{.+}}::iterator_traits<{{.+}}>}}
+ typedef T::pointer PT; // expected-error-re {{no type named 'pointer' in 'std::{{.+}}::iterator_traits<{{.+}}>}}
+ typedef T::reference RT; // expected-error-re {{no type named 'reference' in 'std::{{.+}}::iterator_traits<{{.+}}>}}
+ typedef T::iterator_category CT; // expected-error-re {{no type named 'iterator_category' in 'std::{{.+}}::iterator_traits<{{.+}}>}}
+ }
+
+ {
+ typedef std::iterator_traits<NotAnIteratorNoValue> T;
+ typedef T::difference_type DT; // expected-error-re {{no type named 'difference_type' in 'std::{{.+}}::iterator_traits<{{.+}}>}}
+ typedef T::value_type VT; // expected-error-re {{no type named 'value_type' in 'std::{{.+}}::iterator_traits<{{.+}}>}}
+ typedef T::pointer PT; // expected-error-re {{no type named 'pointer' in 'std::{{.+}}::iterator_traits<{{.+}}>}}
+ typedef T::reference RT; // expected-error-re {{no type named 'reference' in 'std::{{.+}}::iterator_traits<{{.+}}>}}
+ typedef T::iterator_category CT; // expected-error-re {{no type named 'iterator_category' in 'std::{{.+}}::iterator_traits<{{.+}}>}}
+ }
+
+ {
+ typedef std::iterator_traits<NotAnIteratorNoPointer> T;
+ typedef T::difference_type DT; // expected-error-re {{no type named 'difference_type' in 'std::{{.+}}::iterator_traits<{{.+}}>}}
+ typedef T::value_type VT; // expected-error-re {{no type named 'value_type' in 'std::{{.+}}::iterator_traits<{{.+}}>}}
+ typedef T::pointer PT; // expected-error-re {{no type named 'pointer' in 'std::{{.+}}::iterator_traits<{{.+}}>}}
+ typedef T::reference RT; // expected-error-re {{no type named 'reference' in 'std::{{.+}}::iterator_traits<{{.+}}>}}
+ typedef T::iterator_category CT; // expected-error-re {{no type named 'iterator_category' in 'std::{{.+}}::iterator_traits<{{.+}}>}}
+ }
+
+ {
+ typedef std::iterator_traits<NotAnIteratorNoReference> T;
+ typedef T::difference_type DT; // expected-error-re {{no type named 'difference_type' in 'std::{{.+}}::iterator_traits<{{.+}}>}}
+ typedef T::value_type VT; // expected-error-re {{no type named 'value_type' in 'std::{{.+}}::iterator_traits<{{.+}}>}}
+ typedef T::pointer PT; // expected-error-re {{no type named 'pointer' in 'std::{{.+}}::iterator_traits<{{.+}}>}}
+ typedef T::reference RT; // expected-error-re {{no type named 'reference' in 'std::{{.+}}::iterator_traits<{{.+}}>}}
+ typedef T::iterator_category CT; // expected-error-re {{no type named 'iterator_category' in 'std::{{.+}}::iterator_traits<{{.+}}>}}
+ }
+
+ {
+ typedef std::iterator_traits<NotAnIteratorNoCategory> T;
+ typedef T::difference_type DT; // expected-error-re {{no type named 'difference_type' in 'std::{{.+}}::iterator_traits<{{.+}}>}}
+ typedef T::value_type VT; // expected-error-re {{no type named 'value_type' in 'std::{{.+}}::iterator_traits<{{.+}}>}}
+ typedef T::pointer PT; // expected-error-re {{no type named 'pointer' in 'std::{{.+}}::iterator_traits<{{.+}}>}}
+ typedef T::reference RT; // expected-error-re {{no type named 'reference' in 'std::{{.+}}::iterator_traits<{{.+}}>}}
+ typedef T::iterator_category CT; // expected-error-re {{no type named 'iterator_category' in 'std::{{.+}}::iterator_traits<{{.+}}>}}
+ }
+}
diff --git a/test/std/iterators/iterator.primitives/iterator.traits/iterator.pass.cpp b/test/std/iterators/iterator.primitives/iterator.traits/iterator.pass.cpp
index 38f7c0b6b833c..34f430ff3ee78 100644
--- a/test/std/iterators/iterator.primitives/iterator.traits/iterator.pass.cpp
+++ b/test/std/iterators/iterator.primitives/iterator.traits/iterator.pass.cpp
@@ -39,5 +39,6 @@ int main()
static_assert((std::is_same<It::difference_type, int>::value), "");
static_assert((std::is_same<It::value_type, A>::value), "");
static_assert((std::is_same<It::pointer, A*>::value), "");
+ static_assert((std::is_same<It::reference, A&>::value), "");
static_assert((std::is_same<It::iterator_category, std::forward_iterator_tag>::value), "");
}
diff --git a/test/std/language.support/cmp/cmp.partialord/partialord.pass.cpp b/test/std/language.support/cmp/cmp.partialord/partialord.pass.cpp
index a80477151ef25..4ea823499b5e2 100644
--- a/test/std/language.support/cmp/cmp.partialord/partialord.pass.cpp
+++ b/test/std/language.support/cmp/cmp.partialord/partialord.pass.cpp
@@ -130,7 +130,7 @@ constexpr bool test_constexpr() {
};
for (auto TC : SpaceshipTestCases)
{
- std::partial_ordering Res = (0 <=> TC.Value);
+ std::partial_ordering Res = (TC.Value <=> 0);
switch (TC.Expect) {
case ER_Equiv:
assert(Res == 0);
diff --git a/test/std/language.support/cmp/cmp.strongord/strongord.pass.cpp b/test/std/language.support/cmp/cmp.strongord/strongord.pass.cpp
index 0bdd68679b441..94668ab7c47c4 100644
--- a/test/std/language.support/cmp/cmp.strongord/strongord.pass.cpp
+++ b/test/std/language.support/cmp/cmp.strongord/strongord.pass.cpp
@@ -185,7 +185,7 @@ constexpr bool test_constexpr() {
};
for (auto TC : SpaceshipTestCases)
{
- std::strong_ordering Res = (0 <=> TC.Value);
+ std::strong_ordering Res = (TC.Value <=> 0);
switch (TC.Expect) {
case ER_Equiv:
assert(Res == 0);
diff --git a/test/std/language.support/cmp/cmp.weakord/weakord.pass.cpp b/test/std/language.support/cmp/cmp.weakord/weakord.pass.cpp
index 0a52680323b2a..067f378e0bfd1 100644
--- a/test/std/language.support/cmp/cmp.weakord/weakord.pass.cpp
+++ b/test/std/language.support/cmp/cmp.weakord/weakord.pass.cpp
@@ -142,7 +142,7 @@ constexpr bool test_constexpr() {
};
for (auto TC : SpaceshipTestCases)
{
- std::weak_ordering Res = (0 <=> TC.Value);
+ std::weak_ordering Res = (TC.Value <=> 0);
switch (TC.Expect) {
case ER_Equiv:
assert(Res == 0);
diff --git a/test/std/language.support/support.dynamic/new.delete/new.delete.array/delete_align_val_t_replace.pass.cpp b/test/std/language.support/support.dynamic/new.delete/new.delete.array/delete_align_val_t_replace.pass.cpp
index 2175e29a040dc..4dd9390c4fdcf 100644
--- a/test/std/language.support/support.dynamic/new.delete/new.delete.array/delete_align_val_t_replace.pass.cpp
+++ b/test/std/language.support/support.dynamic/new.delete/new.delete.array/delete_align_val_t_replace.pass.cpp
@@ -12,17 +12,30 @@
// UNSUPPORTED: sanitizer-new-delete, c++98, c++03, c++11, c++14
// Older Clang versions do not support this
-// XFAIL: clang-3, apple-clang-7, apple-clang-8
+// UNSUPPORTED: clang-3, apple-clang-7, apple-clang-8
// None of the current GCC compilers support this.
-// XFAIL: gcc-5, gcc-6
+// UNSUPPORTED: gcc-5, gcc-6
-// XFAIL: with_system_cxx_lib=macosx10.12
-// XFAIL: with_system_cxx_lib=macosx10.11
-// XFAIL: with_system_cxx_lib=macosx10.10
-// XFAIL: with_system_cxx_lib=macosx10.9
-// XFAIL: with_system_cxx_lib=macosx10.7
-// XFAIL: with_system_cxx_lib=macosx10.8
+// Aligned allocation was not provided before macosx10.12 and as a result we
+// get availability errors when the deployment target is older than macosx10.13.
+// However, AppleClang 10 (and older) don't trigger availability errors.
+// XFAIL: !(apple-clang-9 || apple-clang-10) && availability=macosx10.12
+// XFAIL: !(apple-clang-9 || apple-clang-10) && availability=macosx10.11
+// XFAIL: !(apple-clang-9 || apple-clang-10) && availability=macosx10.10
+// XFAIL: !(apple-clang-9 || apple-clang-10) && availability=macosx10.9
+// XFAIL: !(apple-clang-9 || apple-clang-10) && availability=macosx10.8
+// XFAIL: !(apple-clang-9 || apple-clang-10) && availability=macosx10.7
+
+// On AppleClang 10 (and older), instead of getting an availability failure
+// like above, we get a link error when we link against a dylib that does
+// not export the aligned allocation functions.
+// XFAIL: (apple-clang-9 || apple-clang-10) && with_system_cxx_lib=macosx10.12
+// XFAIL: (apple-clang-9 || apple-clang-10) && with_system_cxx_lib=macosx10.11
+// XFAIL: (apple-clang-9 || apple-clang-10) && with_system_cxx_lib=macosx10.10
+// XFAIL: (apple-clang-9 || apple-clang-10) && with_system_cxx_lib=macosx10.9
+// XFAIL: (apple-clang-9 || apple-clang-10) && with_system_cxx_lib=macosx10.8
+// XFAIL: (apple-clang-9 || apple-clang-10) && with_system_cxx_lib=macosx10.7
// On Windows libc++ doesn't provide its own definitions for new/delete
// but instead depends on the ones in VCRuntime. However VCRuntime does not
diff --git a/test/std/language.support/support.dynamic/new.delete/new.delete.array/new_align_val_t.pass.cpp b/test/std/language.support/support.dynamic/new.delete/new.delete.array/new_align_val_t.pass.cpp
index 942f5e778b666..d6194b00aa025 100644
--- a/test/std/language.support/support.dynamic/new.delete/new.delete.array/new_align_val_t.pass.cpp
+++ b/test/std/language.support/support.dynamic/new.delete/new.delete.array/new_align_val_t.pass.cpp
@@ -15,13 +15,25 @@
// FIXME change this to XFAIL.
// UNSUPPORTED: no-aligned-allocation && !gcc
-// XFAIL: with_system_cxx_lib=macosx10.12
-// XFAIL: with_system_cxx_lib=macosx10.11
-// XFAIL: with_system_cxx_lib=macosx10.10
-// XFAIL: with_system_cxx_lib=macosx10.9
-// XFAIL: with_system_cxx_lib=macosx10.7
-// XFAIL: with_system_cxx_lib=macosx10.8
+// Aligned allocation was not provided before macosx10.12 and as a result we
+// get availability errors when the deployment target is older than macosx10.13.
+// However, AppleClang 10 (and older) don't trigger availability errors.
+// XFAIL: !(apple-clang-9 || apple-clang-10) && availability=macosx10.12
+// XFAIL: !(apple-clang-9 || apple-clang-10) && availability=macosx10.11
+// XFAIL: !(apple-clang-9 || apple-clang-10) && availability=macosx10.10
+// XFAIL: !(apple-clang-9 || apple-clang-10) && availability=macosx10.9
+// XFAIL: !(apple-clang-9 || apple-clang-10) && availability=macosx10.8
+// XFAIL: !(apple-clang-9 || apple-clang-10) && availability=macosx10.7
+// On AppleClang 10 (and older), instead of getting an availability failure
+// like above, we get a link error when we link against a dylib that does
+// not export the aligned allocation functions.
+// XFAIL: (apple-clang-9 || apple-clang-10) && with_system_cxx_lib=macosx10.12
+// XFAIL: (apple-clang-9 || apple-clang-10) && with_system_cxx_lib=macosx10.11
+// XFAIL: (apple-clang-9 || apple-clang-10) && with_system_cxx_lib=macosx10.10
+// XFAIL: (apple-clang-9 || apple-clang-10) && with_system_cxx_lib=macosx10.9
+// XFAIL: (apple-clang-9 || apple-clang-10) && with_system_cxx_lib=macosx10.8
+// XFAIL: (apple-clang-9 || apple-clang-10) && with_system_cxx_lib=macosx10.7
// On Windows libc++ doesn't provide its own definitions for new/delete
// but instead depends on the ones in VCRuntime. However VCRuntime does not
diff --git a/test/std/language.support/support.dynamic/new.delete/new.delete.array/new_align_val_t_nothrow.pass.cpp b/test/std/language.support/support.dynamic/new.delete/new.delete.array/new_align_val_t_nothrow.pass.cpp
index f55ad5bcc84e9..59878aefd18a2 100644
--- a/test/std/language.support/support.dynamic/new.delete/new.delete.array/new_align_val_t_nothrow.pass.cpp
+++ b/test/std/language.support/support.dynamic/new.delete/new.delete.array/new_align_val_t_nothrow.pass.cpp
@@ -15,12 +15,25 @@
// FIXME turn this into an XFAIL
// UNSUPPORTED: no-aligned-allocation && !gcc
-// XFAIL: with_system_cxx_lib=macosx10.12
-// XFAIL: with_system_cxx_lib=macosx10.11
-// XFAIL: with_system_cxx_lib=macosx10.10
-// XFAIL: with_system_cxx_lib=macosx10.9
-// XFAIL: with_system_cxx_lib=macosx10.7
-// XFAIL: with_system_cxx_lib=macosx10.8
+// Aligned allocation was not provided before macosx10.12 and as a result we
+// get availability errors when the deployment target is older than macosx10.13.
+// However, AppleClang 10 (and older) don't trigger availability errors.
+// XFAIL: !(apple-clang-9 || apple-clang-10) && availability=macosx10.12
+// XFAIL: !(apple-clang-9 || apple-clang-10) && availability=macosx10.11
+// XFAIL: !(apple-clang-9 || apple-clang-10) && availability=macosx10.10
+// XFAIL: !(apple-clang-9 || apple-clang-10) && availability=macosx10.9
+// XFAIL: !(apple-clang-9 || apple-clang-10) && availability=macosx10.8
+// XFAIL: !(apple-clang-9 || apple-clang-10) && availability=macosx10.7
+
+// On AppleClang 10 (and older), instead of getting an availability failure
+// like above, we get a link error when we link against a dylib that does
+// not export the aligned allocation functions.
+// XFAIL: (apple-clang-9 || apple-clang-10) && with_system_cxx_lib=macosx10.12
+// XFAIL: (apple-clang-9 || apple-clang-10) && with_system_cxx_lib=macosx10.11
+// XFAIL: (apple-clang-9 || apple-clang-10) && with_system_cxx_lib=macosx10.10
+// XFAIL: (apple-clang-9 || apple-clang-10) && with_system_cxx_lib=macosx10.9
+// XFAIL: (apple-clang-9 || apple-clang-10) && with_system_cxx_lib=macosx10.8
+// XFAIL: (apple-clang-9 || apple-clang-10) && with_system_cxx_lib=macosx10.7
// On Windows libc++ doesn't provide its own definitions for new/delete
// but instead depends on the ones in VCRuntime. However VCRuntime does not
diff --git a/test/std/language.support/support.dynamic/new.delete/new.delete.array/new_align_val_t_nothrow_replace.pass.cpp b/test/std/language.support/support.dynamic/new.delete/new.delete.array/new_align_val_t_nothrow_replace.pass.cpp
index e1ebf86ee176e..fc713dbf8ed83 100644
--- a/test/std/language.support/support.dynamic/new.delete/new.delete.array/new_align_val_t_nothrow_replace.pass.cpp
+++ b/test/std/language.support/support.dynamic/new.delete/new.delete.array/new_align_val_t_nothrow_replace.pass.cpp
@@ -10,12 +10,25 @@
// UNSUPPORTED: c++98, c++03, c++11, c++14
// UNSUPPORTED: sanitizer-new-delete
-// XFAIL: with_system_cxx_lib=macosx10.12
-// XFAIL: with_system_cxx_lib=macosx10.11
-// XFAIL: with_system_cxx_lib=macosx10.10
-// XFAIL: with_system_cxx_lib=macosx10.9
-// XFAIL: with_system_cxx_lib=macosx10.7
-// XFAIL: with_system_cxx_lib=macosx10.8
+// Aligned allocation was not provided before macosx10.12 and as a result we
+// get availability errors when the deployment target is older than macosx10.13.
+// However, AppleClang 10 (and older) don't trigger availability errors.
+// XFAIL: !(apple-clang-9 || apple-clang-10) && availability=macosx10.12
+// XFAIL: !(apple-clang-9 || apple-clang-10) && availability=macosx10.11
+// XFAIL: !(apple-clang-9 || apple-clang-10) && availability=macosx10.10
+// XFAIL: !(apple-clang-9 || apple-clang-10) && availability=macosx10.9
+// XFAIL: !(apple-clang-9 || apple-clang-10) && availability=macosx10.8
+// XFAIL: !(apple-clang-9 || apple-clang-10) && availability=macosx10.7
+
+// On AppleClang 10 (and older), instead of getting an availability failure
+// like above, we get a link error when we link against a dylib that does
+// not export the aligned allocation functions.
+// XFAIL: (apple-clang-9 || apple-clang-10) && with_system_cxx_lib=macosx10.12
+// XFAIL: (apple-clang-9 || apple-clang-10) && with_system_cxx_lib=macosx10.11
+// XFAIL: (apple-clang-9 || apple-clang-10) && with_system_cxx_lib=macosx10.10
+// XFAIL: (apple-clang-9 || apple-clang-10) && with_system_cxx_lib=macosx10.9
+// XFAIL: (apple-clang-9 || apple-clang-10) && with_system_cxx_lib=macosx10.8
+// XFAIL: (apple-clang-9 || apple-clang-10) && with_system_cxx_lib=macosx10.7
// XFAIL: no-aligned-allocation && !gcc
diff --git a/test/std/language.support/support.dynamic/new.delete/new.delete.array/new_size.fail.cpp b/test/std/language.support/support.dynamic/new.delete/new.delete.array/new_size.sh.cpp
index 0dfef2e56fca2..40632a1bd49b1 100644
--- a/test/std/language.support/support.dynamic/new.delete/new.delete.array/new_size.fail.cpp
+++ b/test/std/language.support/support.dynamic/new.delete/new.delete.array/new_size.sh.cpp
@@ -15,11 +15,12 @@
// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
// UNSUPPORTED: clang-3.3, clang-3.4, clang-3.5, clang-3.6, clang-3.7, clang-3.8
-#include <new>
+// REQUIRES: -faligned-allocation
+// RUN: %compile %verify -faligned-allocation
-#include "test_macros.h"
+#include <new>
int main ()
{
- ::operator new[](4); // expected-error {{ignoring return value of function declared with 'nodiscard' attribute}}
+ ::operator new[](4); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
}
diff --git a/test/std/language.support/support.dynamic/new.delete/new.delete.array/new_size_align.sh.cpp b/test/std/language.support/support.dynamic/new.delete/new.delete.array/new_size_align.sh.cpp
new file mode 100644
index 0000000000000..f7921d2f2c121
--- /dev/null
+++ b/test/std/language.support/support.dynamic/new.delete/new.delete.array/new_size_align.sh.cpp
@@ -0,0 +1,26 @@
+// -*- C++ -*-
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <new>
+
+// void* operator new[](std::size_t, std::align_val_t);
+
+// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
+// UNSUPPORTED: clang-3.3, clang-3.4, clang-3.5, clang-3.6, clang-3.7, clang-3.8
+
+// REQUIRES: -faligned-allocation
+// RUN: %compile %verify -faligned-allocation
+
+#include <new>
+
+int main ()
+{
+ ::operator new[](4, std::align_val_t{4}); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
+}
diff --git a/test/std/language.support/support.dynamic/new.delete/new.delete.array/new_size_align_nothrow.fail.cpp b/test/std/language.support/support.dynamic/new.delete/new.delete.array/new_size_align_nothrow.sh.cpp
index 99e4f76b312fa..1301487867323 100644
--- a/test/std/language.support/support.dynamic/new.delete/new.delete.array/new_size_align_nothrow.fail.cpp
+++ b/test/std/language.support/support.dynamic/new.delete/new.delete.array/new_size_align_nothrow.sh.cpp
@@ -15,11 +15,12 @@
// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
// UNSUPPORTED: clang-3.3, clang-3.4, clang-3.5, clang-3.6, clang-3.7, clang-3.8
-#include <new>
+// REQUIRES: -faligned-allocation
+// RUN: %compile %verify -faligned-allocation
-#include "test_macros.h"
+#include <new>
int main ()
{
- ::operator new[](4, std::align_val_t{4}, std::nothrow); // expected-error {{ignoring return value of function declared with 'nodiscard' attribute}}
+ ::operator new[](4, std::align_val_t{4}, std::nothrow); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
}
diff --git a/test/std/language.support/support.dynamic/new.delete/new.delete.array/new_size_nothrow.fail.cpp b/test/std/language.support/support.dynamic/new.delete/new.delete.array/new_size_nothrow.sh.cpp
index 8aae54e83fbeb..43295a7e69325 100644
--- a/test/std/language.support/support.dynamic/new.delete/new.delete.array/new_size_nothrow.fail.cpp
+++ b/test/std/language.support/support.dynamic/new.delete/new.delete.array/new_size_nothrow.sh.cpp
@@ -15,11 +15,12 @@
// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
// UNSUPPORTED: clang-3.3, clang-3.4, clang-3.5, clang-3.6, clang-3.7, clang-3.8
-#include <new>
+// REQUIRES: -faligned-allocation
+// RUN: %compile %verify -faligned-allocation
-#include "test_macros.h"
+#include <new>
int main ()
{
- ::operator new[](4, std::nothrow); // expected-error {{ignoring return value of function declared with 'nodiscard' attribute}}
+ ::operator new[](4, std::nothrow); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
}
diff --git a/test/std/language.support/support.dynamic/new.delete/new.delete.array/sized_delete_array_fsizeddeallocation.sh.cpp b/test/std/language.support/support.dynamic/new.delete/new.delete.array/sized_delete_array_fsizeddeallocation.sh.cpp
index f71cf19cc80b1..ab25a9be00860 100644
--- a/test/std/language.support/support.dynamic/new.delete/new.delete.array/sized_delete_array_fsizeddeallocation.sh.cpp
+++ b/test/std/language.support/support.dynamic/new.delete/new.delete.array/sized_delete_array_fsizeddeallocation.sh.cpp
@@ -13,15 +13,15 @@
// when sized deallocation is not supported, e.g., prior to C++14.
// UNSUPPORTED: sanitizer-new-delete
-// XFAIL: availability_markup=macosx10.11
-// XFAIL: availability_markup=macosx10.10
-// XFAIL: availability_markup=macosx10.9
-// XFAIL: availability_markup=macosx10.8
-// XFAIL: availability_markup=macosx10.7
+// XFAIL: availability=macosx10.11
+// XFAIL: availability=macosx10.10
+// XFAIL: availability=macosx10.9
+// XFAIL: availability=macosx10.8
+// XFAIL: availability=macosx10.7
// NOTE: Only clang-3.7 and GCC 5.1 and greater support -fsized-deallocation.
-// REQUIRES: fsized-deallocation
+// REQUIRES: -fsized-deallocation
// RUN: %build -fsized-deallocation
// RUN: %run
diff --git a/test/std/language.support/support.dynamic/new.delete/new.delete.single/delete_align_val_t_replace.pass.cpp b/test/std/language.support/support.dynamic/new.delete/new.delete.single/delete_align_val_t_replace.pass.cpp
index 6f1c7511243ee..19cabcce1edd9 100644
--- a/test/std/language.support/support.dynamic/new.delete/new.delete.single/delete_align_val_t_replace.pass.cpp
+++ b/test/std/language.support/support.dynamic/new.delete/new.delete.single/delete_align_val_t_replace.pass.cpp
@@ -11,17 +11,30 @@
// UNSUPPORTED: sanitizer-new-delete, c++98, c++03, c++11, c++14
// Older Clang versions do not support this
-// XFAIL: clang-3, apple-clang-7, apple-clang-8
+// UNSUPPORTED: clang-3, apple-clang-7, apple-clang-8
// None of the current GCC compilers support this.
-// XFAIL: gcc-5, gcc-6
+// UNSUPPORTED: gcc-5, gcc-6
-// XFAIL: with_system_cxx_lib=macosx10.12
-// XFAIL: with_system_cxx_lib=macosx10.11
-// XFAIL: with_system_cxx_lib=macosx10.10
-// XFAIL: with_system_cxx_lib=macosx10.9
-// XFAIL: with_system_cxx_lib=macosx10.7
-// XFAIL: with_system_cxx_lib=macosx10.8
+// Aligned allocation was not provided before macosx10.12 and as a result we
+// get availability errors when the deployment target is older than macosx10.13.
+// However, AppleClang 10 (and older) don't trigger availability errors.
+// XFAIL: !(apple-clang-9 || apple-clang-10) && availability=macosx10.12
+// XFAIL: !(apple-clang-9 || apple-clang-10) && availability=macosx10.11
+// XFAIL: !(apple-clang-9 || apple-clang-10) && availability=macosx10.10
+// XFAIL: !(apple-clang-9 || apple-clang-10) && availability=macosx10.9
+// XFAIL: !(apple-clang-9 || apple-clang-10) && availability=macosx10.8
+// XFAIL: !(apple-clang-9 || apple-clang-10) && availability=macosx10.7
+
+// On AppleClang 10 (and older), instead of getting an availability failure
+// like above, we get a link error when we link against a dylib that does
+// not export the aligned allocation functions.
+// XFAIL: (apple-clang-9 || apple-clang-10) && with_system_cxx_lib=macosx10.12
+// XFAIL: (apple-clang-9 || apple-clang-10) && with_system_cxx_lib=macosx10.11
+// XFAIL: (apple-clang-9 || apple-clang-10) && with_system_cxx_lib=macosx10.10
+// XFAIL: (apple-clang-9 || apple-clang-10) && with_system_cxx_lib=macosx10.9
+// XFAIL: (apple-clang-9 || apple-clang-10) && with_system_cxx_lib=macosx10.8
+// XFAIL: (apple-clang-9 || apple-clang-10) && with_system_cxx_lib=macosx10.7
// On Windows libc++ doesn't provide its own definitions for new/delete
// but instead depends on the ones in VCRuntime. However VCRuntime does not
diff --git a/test/std/language.support/support.dynamic/new.delete/new.delete.single/new_align_val_t.pass.cpp b/test/std/language.support/support.dynamic/new.delete/new.delete.single/new_align_val_t.pass.cpp
index fae5d3676df65..7cf1aca3b9f8e 100644
--- a/test/std/language.support/support.dynamic/new.delete/new.delete.single/new_align_val_t.pass.cpp
+++ b/test/std/language.support/support.dynamic/new.delete/new.delete.single/new_align_val_t.pass.cpp
@@ -9,12 +9,25 @@
// UNSUPPORTED: c++98, c++03, c++11, c++14
-// XFAIL: with_system_cxx_lib=macosx10.12
-// XFAIL: with_system_cxx_lib=macosx10.11
-// XFAIL: with_system_cxx_lib=macosx10.10
-// XFAIL: with_system_cxx_lib=macosx10.9
-// XFAIL: with_system_cxx_lib=macosx10.7
-// XFAIL: with_system_cxx_lib=macosx10.8
+// Aligned allocation was not provided before macosx10.12 and as a result we
+// get availability errors when the deployment target is older than macosx10.13.
+// However, AppleClang 10 (and older) don't trigger availability errors.
+// XFAIL: !(apple-clang-9 || apple-clang-10) && availability=macosx10.12
+// XFAIL: !(apple-clang-9 || apple-clang-10) && availability=macosx10.11
+// XFAIL: !(apple-clang-9 || apple-clang-10) && availability=macosx10.10
+// XFAIL: !(apple-clang-9 || apple-clang-10) && availability=macosx10.9
+// XFAIL: !(apple-clang-9 || apple-clang-10) && availability=macosx10.8
+// XFAIL: !(apple-clang-9 || apple-clang-10) && availability=macosx10.7
+
+// On AppleClang 10 (and older), instead of getting an availability failure
+// like above, we get a link error when we link against a dylib that does
+// not export the aligned allocation functions.
+// XFAIL: (apple-clang-9 || apple-clang-10) && with_system_cxx_lib=macosx10.12
+// XFAIL: (apple-clang-9 || apple-clang-10) && with_system_cxx_lib=macosx10.11
+// XFAIL: (apple-clang-9 || apple-clang-10) && with_system_cxx_lib=macosx10.10
+// XFAIL: (apple-clang-9 || apple-clang-10) && with_system_cxx_lib=macosx10.9
+// XFAIL: (apple-clang-9 || apple-clang-10) && with_system_cxx_lib=macosx10.8
+// XFAIL: (apple-clang-9 || apple-clang-10) && with_system_cxx_lib=macosx10.7
// asan and msan will not call the new handler.
// UNSUPPORTED: sanitizer-new-delete
diff --git a/test/std/language.support/support.dynamic/new.delete/new.delete.single/new_align_val_t_nothrow.pass.cpp b/test/std/language.support/support.dynamic/new.delete/new.delete.single/new_align_val_t_nothrow.pass.cpp
index f22c489943553..dd2666e00aad4 100644
--- a/test/std/language.support/support.dynamic/new.delete/new.delete.single/new_align_val_t_nothrow.pass.cpp
+++ b/test/std/language.support/support.dynamic/new.delete/new.delete.single/new_align_val_t_nothrow.pass.cpp
@@ -9,12 +9,25 @@
// UNSUPPORTED: c++98, c++03, c++11, c++14
-// XFAIL: with_system_cxx_lib=macosx10.12
-// XFAIL: with_system_cxx_lib=macosx10.11
-// XFAIL: with_system_cxx_lib=macosx10.10
-// XFAIL: with_system_cxx_lib=macosx10.9
-// XFAIL: with_system_cxx_lib=macosx10.7
-// XFAIL: with_system_cxx_lib=macosx10.8
+// Aligned allocation was not provided before macosx10.12 and as a result we
+// get availability errors when the deployment target is older than macosx10.13.
+// However, AppleClang 10 (and older) don't trigger availability errors.
+// XFAIL: !(apple-clang-9 || apple-clang-10) && availability=macosx10.12
+// XFAIL: !(apple-clang-9 || apple-clang-10) && availability=macosx10.11
+// XFAIL: !(apple-clang-9 || apple-clang-10) && availability=macosx10.10
+// XFAIL: !(apple-clang-9 || apple-clang-10) && availability=macosx10.9
+// XFAIL: !(apple-clang-9 || apple-clang-10) && availability=macosx10.8
+// XFAIL: !(apple-clang-9 || apple-clang-10) && availability=macosx10.7
+
+// On AppleClang 10 (and older), instead of getting an availability failure
+// like above, we get a link error when we link against a dylib that does
+// not export the aligned allocation functions.
+// XFAIL: (apple-clang-9 || apple-clang-10) && with_system_cxx_lib=macosx10.12
+// XFAIL: (apple-clang-9 || apple-clang-10) && with_system_cxx_lib=macosx10.11
+// XFAIL: (apple-clang-9 || apple-clang-10) && with_system_cxx_lib=macosx10.10
+// XFAIL: (apple-clang-9 || apple-clang-10) && with_system_cxx_lib=macosx10.9
+// XFAIL: (apple-clang-9 || apple-clang-10) && with_system_cxx_lib=macosx10.8
+// XFAIL: (apple-clang-9 || apple-clang-10) && with_system_cxx_lib=macosx10.7
// asan and msan will not call the new handler.
// UNSUPPORTED: sanitizer-new-delete
diff --git a/test/std/language.support/support.dynamic/new.delete/new.delete.single/new_align_val_t_nothrow_replace.pass.cpp b/test/std/language.support/support.dynamic/new.delete/new.delete.single/new_align_val_t_nothrow_replace.pass.cpp
index 565ba9b851bbf..514a2b8afc8c3 100644
--- a/test/std/language.support/support.dynamic/new.delete/new.delete.single/new_align_val_t_nothrow_replace.pass.cpp
+++ b/test/std/language.support/support.dynamic/new.delete/new.delete.single/new_align_val_t_nothrow_replace.pass.cpp
@@ -10,12 +10,25 @@
// UNSUPPORTED: c++98, c++03, c++11, c++14
// UNSUPPORTED: sanitizer-new-delete
-// XFAIL: with_system_cxx_lib=macosx10.12
-// XFAIL: with_system_cxx_lib=macosx10.11
-// XFAIL: with_system_cxx_lib=macosx10.10
-// XFAIL: with_system_cxx_lib=macosx10.9
-// XFAIL: with_system_cxx_lib=macosx10.7
-// XFAIL: with_system_cxx_lib=macosx10.8
+// Aligned allocation was not provided before macosx10.12 and as a result we
+// get availability errors when the deployment target is older than macosx10.13.
+// However, AppleClang 10 (and older) don't trigger availability errors.
+// XFAIL: !(apple-clang-9 || apple-clang-10) && availability=macosx10.12
+// XFAIL: !(apple-clang-9 || apple-clang-10) && availability=macosx10.11
+// XFAIL: !(apple-clang-9 || apple-clang-10) && availability=macosx10.10
+// XFAIL: !(apple-clang-9 || apple-clang-10) && availability=macosx10.9
+// XFAIL: !(apple-clang-9 || apple-clang-10) && availability=macosx10.8
+// XFAIL: !(apple-clang-9 || apple-clang-10) && availability=macosx10.7
+
+// On AppleClang 10 (and older), instead of getting an availability failure
+// like above, we get a link error when we link against a dylib that does
+// not export the aligned allocation functions.
+// XFAIL: (apple-clang-9 || apple-clang-10) && with_system_cxx_lib=macosx10.12
+// XFAIL: (apple-clang-9 || apple-clang-10) && with_system_cxx_lib=macosx10.11
+// XFAIL: (apple-clang-9 || apple-clang-10) && with_system_cxx_lib=macosx10.10
+// XFAIL: (apple-clang-9 || apple-clang-10) && with_system_cxx_lib=macosx10.9
+// XFAIL: (apple-clang-9 || apple-clang-10) && with_system_cxx_lib=macosx10.8
+// XFAIL: (apple-clang-9 || apple-clang-10) && with_system_cxx_lib=macosx10.7
// NOTE: gcc doesn't provide -faligned-allocation flag to test for
// XFAIL: no-aligned-allocation && !gcc
diff --git a/test/std/language.support/support.dynamic/new.delete/new.delete.array/new_size_align.fail.cpp b/test/std/language.support/support.dynamic/new.delete/new.delete.single/new_size_align.sh.cpp
index ea041aea16eef..410c6d7748daf 100644
--- a/test/std/language.support/support.dynamic/new.delete/new.delete.array/new_size_align.fail.cpp
+++ b/test/std/language.support/support.dynamic/new.delete/new.delete.single/new_size_align.sh.cpp
@@ -10,16 +10,17 @@
// <new>
-// void* operator new[](std::size_t, std::align_val_t);
+// void* operator new(std::size_t, std::align_val_t);
// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
// UNSUPPORTED: clang-3.3, clang-3.4, clang-3.5, clang-3.6, clang-3.7, clang-3.8
-#include <new>
+// REQUIRES: -faligned-allocation
+// RUN: %compile %verify -faligned-allocation
-#include "test_macros.h"
+#include <new>
int main ()
{
- ::operator new[](4, std::align_val_t{4}); // expected-error {{ignoring return value of function declared with 'nodiscard' attribute}}
+ ::operator new(4, std::align_val_t{4}); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
}
diff --git a/test/std/language.support/support.dynamic/new.delete/new.delete.single/new_size_align_nothrow.fail.cpp b/test/std/language.support/support.dynamic/new.delete/new.delete.single/new_size_align_nothrow.sh.cpp
index e987a53478b06..1fe104551e1be 100644
--- a/test/std/language.support/support.dynamic/new.delete/new.delete.single/new_size_align_nothrow.fail.cpp
+++ b/test/std/language.support/support.dynamic/new.delete/new.delete.single/new_size_align_nothrow.sh.cpp
@@ -15,11 +15,12 @@
// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
// UNSUPPORTED: clang-3.3, clang-3.4, clang-3.5, clang-3.6, clang-3.7, clang-3.8
-#include <new>
+// REQUIRES: -faligned-allocation
+// RUN: %compile %verify -faligned-allocation
-#include "test_macros.h"
+#include <new>
int main ()
{
- ::operator new(4, std::align_val_t{4}, std::nothrow); // expected-error {{ignoring return value of function declared with 'nodiscard' attribute}}
+ ::operator new(4, std::align_val_t{4}, std::nothrow); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
}
diff --git a/test/std/language.support/support.dynamic/new.delete/new.delete.single/sized_delete_fsizeddeallocation.sh.cpp b/test/std/language.support/support.dynamic/new.delete/new.delete.single/sized_delete_fsizeddeallocation.sh.cpp
index d5b610f718027..7d6f34845f7ed 100644
--- a/test/std/language.support/support.dynamic/new.delete/new.delete.single/sized_delete_fsizeddeallocation.sh.cpp
+++ b/test/std/language.support/support.dynamic/new.delete/new.delete.single/sized_delete_fsizeddeallocation.sh.cpp
@@ -13,14 +13,14 @@
// when sized deallocation is not supported, e.g., prior to C++14.
// UNSUPPORTED: sanitizer-new-delete
-// XFAIL: availability_markup=macosx10.11
-// XFAIL: availability_markup=macosx10.10
-// XFAIL: availability_markup=macosx10.9
-// XFAIL: availability_markup=macosx10.8
-// XFAIL: availability_markup=macosx10.7
+// XFAIL: availability=macosx10.11
+// XFAIL: availability=macosx10.10
+// XFAIL: availability=macosx10.9
+// XFAIL: availability=macosx10.8
+// XFAIL: availability=macosx10.7
// NOTE: Only clang-3.7 and GCC 5.1 and greater support -fsized-deallocation.
-// REQUIRES: fsized-deallocation
+// REQUIRES: -fsized-deallocation
// RUN: %build -fsized-deallocation -O3
// RUN: %run
diff --git a/test/std/language.support/support.dynamic/ptr.launder/launder.types.fail.cpp b/test/std/language.support/support.dynamic/ptr.launder/launder.types.fail.cpp
index 71f5e4588b825..034c578bbf3b1 100644
--- a/test/std/language.support/support.dynamic/ptr.launder/launder.types.fail.cpp
+++ b/test/std/language.support/support.dynamic/ptr.launder/launder.types.fail.cpp
@@ -29,6 +29,8 @@ int main ()
(void) std::launder((const void *) nullptr);
(void) std::launder(( volatile void *) nullptr);
(void) std::launder((const volatile void *) nullptr); // expected-error-re@new:* 4 {{static_assert failed{{.*}} "can't launder cv-void"}}
+ // expected-error@new:* 0-4 {{void pointer argument to '__builtin_launder' is not allowed}}
(void) std::launder(foo); // expected-error-re@new:* 1 {{static_assert failed{{.*}} "can't launder functions"}}
+ // expected-error@new:* 0-1 {{function pointer argument to '__builtin_launder' is not allowed}}
}
diff --git a/test/std/language.support/support.exception/uncaught/uncaught_exceptions.pass.cpp b/test/std/language.support/support.exception/uncaught/uncaught_exceptions.pass.cpp
index d030d12d26300..859d831a3329f 100644
--- a/test/std/language.support/support.exception/uncaught/uncaught_exceptions.pass.cpp
+++ b/test/std/language.support/support.exception/uncaught/uncaught_exceptions.pass.cpp
@@ -10,11 +10,11 @@
// UNSUPPORTED: libcpp-no-exceptions
// XFAIL: libcpp-no-exceptions
-// XFAIL: availability=macosx10.7
-// XFAIL: availability=macosx10.8
-// XFAIL: availability=macosx10.9
-// XFAIL: availability=macosx10.10
-// XFAIL: availability=macosx10.11
+// XFAIL: macosx10.7
+// XFAIL: macosx10.8
+// XFAIL: macosx10.9
+// XFAIL: macosx10.10
+// XFAIL: macosx10.11
// XFAIL: with_system_cxx_lib=macosx10.12
// XFAIL: with_system_cxx_lib=macosx10.13
diff --git a/test/std/language.support/support.limits/c.limits/cfloat.pass.cpp b/test/std/language.support/support.limits/c.limits/cfloat.pass.cpp
index 6e399d0934bf1..c1e5be91ef1f3 100644
--- a/test/std/language.support/support.limits/c.limits/cfloat.pass.cpp
+++ b/test/std/language.support/support.limits/c.limits/cfloat.pass.cpp
@@ -11,6 +11,8 @@
#include <cfloat>
+#include "test_macros.h"
+
#ifndef FLT_ROUNDS
#error FLT_ROUNDS not defined
#endif
@@ -23,7 +25,7 @@
#error FLT_RADIX not defined
#endif
-#if TEST_STD_VER > 14 && defined(TEST_HAS_C11_FEATURES)
+#if TEST_STD_VER > 14 && defined(TEST_HAS_C11_FEATURES) && 0
#ifndef FLT_HAS_SUBNORM
#error FLT_HAS_SUBNORM not defined
#endif
@@ -53,7 +55,7 @@
#error DECIMAL_DIG not defined
#endif
-#if TEST_STD_VER > 14 && defined(TEST_HAS_C11_FEATURES)
+#if TEST_STD_VER > 14 && defined(TEST_HAS_C11_FEATURES) && 0
#ifndef FLT_DECIMAL_DIG
#error FLT_DECIMAL_DIG not defined
#endif
@@ -163,7 +165,7 @@
#error LDBL_MIN not defined
#endif
-#if TEST_STD_VER > 14 && defined(TEST_HAS_C11_FEATURES)
+#if TEST_STD_VER > 14 && defined(TEST_HAS_C11_FEATURES) && 0
#ifndef FLT_TRUE_MIN
#error FLT_TRUE_MIN not defined
#endif
diff --git a/test/std/language.support/support.limits/limits/numeric.limits.members/const_data_members.pass.cpp b/test/std/language.support/support.limits/limits/numeric.limits.members/const_data_members.pass.cpp
index 6a46c370e750c..11772f67dd582 100644
--- a/test/std/language.support/support.limits/limits/numeric.limits.members/const_data_members.pass.cpp
+++ b/test/std/language.support/support.limits/limits/numeric.limits.members/const_data_members.pass.cpp
@@ -9,6 +9,8 @@
#include <limits>
+#include "test_macros.h"
+
/*
<limits>:
numeric_limits
@@ -99,6 +101,14 @@ int main()
TEST_NUMERIC_LIMITS(volatile wchar_t)
TEST_NUMERIC_LIMITS(const volatile wchar_t)
+#if TEST_STD_VER > 17 && defined(__cpp_char8_t)
+ // char8_t
+ TEST_NUMERIC_LIMITS(char8_t)
+ TEST_NUMERIC_LIMITS(const char8_t)
+ TEST_NUMERIC_LIMITS(volatile char8_t)
+ TEST_NUMERIC_LIMITS(const volatile char8_t)
+#endif
+
// char16_t
TEST_NUMERIC_LIMITS(char16_t)
TEST_NUMERIC_LIMITS(const char16_t)
diff --git a/test/std/language.support/support.limits/limits/numeric.limits.members/denorm_min.pass.cpp b/test/std/language.support/support.limits/limits/numeric.limits.members/denorm_min.pass.cpp
index 8deb28d3fd9c8..8a3ca008db09e 100644
--- a/test/std/language.support/support.limits/limits/numeric.limits.members/denorm_min.pass.cpp
+++ b/test/std/language.support/support.limits/limits/numeric.limits.members/denorm_min.pass.cpp
@@ -15,6 +15,8 @@
#include <cfloat>
#include <cassert>
+#include "test_macros.h"
+
template <class T>
void
test(T expected)
@@ -32,6 +34,9 @@ int main()
test<signed char>(0);
test<unsigned char>(0);
test<wchar_t>(0);
+#if TEST_STD_VER > 17 && defined(__cpp_char8_t)
+ test<char8_t>(0);
+#endif
#ifndef _LIBCPP_HAS_NO_UNICODE_CHARS
test<char16_t>(0);
test<char32_t>(0);
diff --git a/test/std/language.support/support.limits/limits/numeric.limits.members/digits.pass.cpp b/test/std/language.support/support.limits/limits/numeric.limits.members/digits.pass.cpp
index 2dfea084b11dd..7dec03d08613d 100644
--- a/test/std/language.support/support.limits/limits/numeric.limits.members/digits.pass.cpp
+++ b/test/std/language.support/support.limits/limits/numeric.limits.members/digits.pass.cpp
@@ -14,6 +14,8 @@
#include <limits>
#include <cfloat>
+#include "test_macros.h"
+
template <class T, int expected>
void
test()
@@ -31,6 +33,9 @@ int main()
test<signed char, 7>();
test<unsigned char, 8>();
test<wchar_t, std::numeric_limits<wchar_t>::is_signed ? sizeof(wchar_t)*8-1 : sizeof(wchar_t)*8>();
+#if TEST_STD_VER > 17 && defined(__cpp_char8_t)
+ test<char8_t, 8>();
+#endif
#ifndef _LIBCPP_HAS_NO_UNICODE_CHARS
test<char16_t, 16>();
test<char32_t, 32>();
diff --git a/test/std/language.support/support.limits/limits/numeric.limits.members/digits10.pass.cpp b/test/std/language.support/support.limits/limits/numeric.limits.members/digits10.pass.cpp
index 2c5302cd63346..017f8630af049 100644
--- a/test/std/language.support/support.limits/limits/numeric.limits.members/digits10.pass.cpp
+++ b/test/std/language.support/support.limits/limits/numeric.limits.members/digits10.pass.cpp
@@ -14,6 +14,8 @@
#include <limits>
#include <cfloat>
+#include "test_macros.h"
+
template <class T, int expected>
void
test()
@@ -35,6 +37,9 @@ int main()
test<signed char, 2>();
test<unsigned char, 2>();
test<wchar_t, 5*sizeof(wchar_t)/2-1>(); // 4 -> 9 and 2 -> 4
+#if TEST_STD_VER > 17 && defined(__cpp_char8_t)
+ test<char8_t, 2>();
+#endif
#ifndef _LIBCPP_HAS_NO_UNICODE_CHARS
test<char16_t, 4>();
test<char32_t, 9>();
diff --git a/test/std/language.support/support.limits/limits/numeric.limits.members/epsilon.pass.cpp b/test/std/language.support/support.limits/limits/numeric.limits.members/epsilon.pass.cpp
index 0cce4848187d8..b27f5c583e8b1 100644
--- a/test/std/language.support/support.limits/limits/numeric.limits.members/epsilon.pass.cpp
+++ b/test/std/language.support/support.limits/limits/numeric.limits.members/epsilon.pass.cpp
@@ -15,6 +15,8 @@
#include <cfloat>
#include <cassert>
+#include "test_macros.h"
+
template <class T>
void
test(T expected)
@@ -32,6 +34,9 @@ int main()
test<signed char>(0);
test<unsigned char>(0);
test<wchar_t>(0);
+#if TEST_STD_VER > 17 && defined(__cpp_char8_t)
+ test<char8_t>(0);
+#endif
#ifndef _LIBCPP_HAS_NO_UNICODE_CHARS
test<char16_t>(0);
test<char32_t>(0);
diff --git a/test/std/language.support/support.limits/limits/numeric.limits.members/has_denorm.pass.cpp b/test/std/language.support/support.limits/limits/numeric.limits.members/has_denorm.pass.cpp
index e61802054d189..5096ad211c412 100644
--- a/test/std/language.support/support.limits/limits/numeric.limits.members/has_denorm.pass.cpp
+++ b/test/std/language.support/support.limits/limits/numeric.limits.members/has_denorm.pass.cpp
@@ -13,6 +13,8 @@
#include <limits>
+#include "test_macros.h"
+
template <class T, std::float_denorm_style expected>
void
test()
@@ -30,6 +32,9 @@ int main()
test<signed char, std::denorm_absent>();
test<unsigned char, std::denorm_absent>();
test<wchar_t, std::denorm_absent>();
+#if TEST_STD_VER > 17 && defined(__cpp_char8_t)
+ test<char8_t, std::denorm_absent>();
+#endif
#ifndef _LIBCPP_HAS_NO_UNICODE_CHARS
test<char16_t, std::denorm_absent>();
test<char32_t, std::denorm_absent>();
diff --git a/test/std/language.support/support.limits/limits/numeric.limits.members/has_denorm_loss.pass.cpp b/test/std/language.support/support.limits/limits/numeric.limits.members/has_denorm_loss.pass.cpp
index 660ecf5036d3e..1b087f0cda4a9 100644
--- a/test/std/language.support/support.limits/limits/numeric.limits.members/has_denorm_loss.pass.cpp
+++ b/test/std/language.support/support.limits/limits/numeric.limits.members/has_denorm_loss.pass.cpp
@@ -13,6 +13,8 @@
#include <limits>
+#include "test_macros.h"
+
template <class T, bool expected>
void
test()
@@ -30,6 +32,9 @@ int main()
test<signed char, false>();
test<unsigned char, false>();
test<wchar_t, false>();
+#if TEST_STD_VER > 17 && defined(__cpp_char8_t)
+ test<char8_t, false>();
+#endif
#ifndef _LIBCPP_HAS_NO_UNICODE_CHARS
test<char16_t, false>();
test<char32_t, false>();
diff --git a/test/std/language.support/support.limits/limits/numeric.limits.members/has_infinity.pass.cpp b/test/std/language.support/support.limits/limits/numeric.limits.members/has_infinity.pass.cpp
index f8ca2059d46a8..1391f2096eff5 100644
--- a/test/std/language.support/support.limits/limits/numeric.limits.members/has_infinity.pass.cpp
+++ b/test/std/language.support/support.limits/limits/numeric.limits.members/has_infinity.pass.cpp
@@ -13,6 +13,8 @@
#include <limits>
+#include "test_macros.h"
+
template <class T, bool expected>
void
test()
@@ -30,6 +32,9 @@ int main()
test<signed char, false>();
test<unsigned char, false>();
test<wchar_t, false>();
+#if TEST_STD_VER > 17 && defined(__cpp_char8_t)
+ test<char8_t, false>();
+#endif
#ifndef _LIBCPP_HAS_NO_UNICODE_CHARS
test<char16_t, false>();
test<char32_t, false>();
diff --git a/test/std/language.support/support.limits/limits/numeric.limits.members/has_quiet_NaN.pass.cpp b/test/std/language.support/support.limits/limits/numeric.limits.members/has_quiet_NaN.pass.cpp
index 7592171695fbb..cb5736f5c5170 100644
--- a/test/std/language.support/support.limits/limits/numeric.limits.members/has_quiet_NaN.pass.cpp
+++ b/test/std/language.support/support.limits/limits/numeric.limits.members/has_quiet_NaN.pass.cpp
@@ -13,6 +13,8 @@
#include <limits>
+#include "test_macros.h"
+
template <class T, bool expected>
void
test()
@@ -30,6 +32,9 @@ int main()
test<signed char, false>();
test<unsigned char, false>();
test<wchar_t, false>();
+#if TEST_STD_VER > 17 && defined(__cpp_char8_t)
+ test<char8_t, false>();
+#endif
#ifndef _LIBCPP_HAS_NO_UNICODE_CHARS
test<char16_t, false>();
test<char32_t, false>();
diff --git a/test/std/language.support/support.limits/limits/numeric.limits.members/has_signaling_NaN.pass.cpp b/test/std/language.support/support.limits/limits/numeric.limits.members/has_signaling_NaN.pass.cpp
index d68cd5d788789..4f43a6532b7a0 100644
--- a/test/std/language.support/support.limits/limits/numeric.limits.members/has_signaling_NaN.pass.cpp
+++ b/test/std/language.support/support.limits/limits/numeric.limits.members/has_signaling_NaN.pass.cpp
@@ -13,6 +13,8 @@
#include <limits>
+#include "test_macros.h"
+
template <class T, bool expected>
void
test()
@@ -30,6 +32,9 @@ int main()
test<signed char, false>();
test<unsigned char, false>();
test<wchar_t, false>();
+#if TEST_STD_VER > 17 && defined(__cpp_char8_t)
+ test<char8_t, false>();
+#endif
#ifndef _LIBCPP_HAS_NO_UNICODE_CHARS
test<char16_t, false>();
test<char32_t, false>();
diff --git a/test/std/language.support/support.limits/limits/numeric.limits.members/infinity.pass.cpp b/test/std/language.support/support.limits/limits/numeric.limits.members/infinity.pass.cpp
index 033ecdc31af0a..241f9cc27249f 100644
--- a/test/std/language.support/support.limits/limits/numeric.limits.members/infinity.pass.cpp
+++ b/test/std/language.support/support.limits/limits/numeric.limits.members/infinity.pass.cpp
@@ -15,6 +15,8 @@
#include <cfloat>
#include <cassert>
+#include "test_macros.h"
+
template <class T>
void
test(T expected)
@@ -34,6 +36,9 @@ int main()
test<signed char>(0);
test<unsigned char>(0);
test<wchar_t>(0);
+#if TEST_STD_VER > 17 && defined(__cpp_char8_t)
+ test<char8_t>(0);
+#endif
#ifndef _LIBCPP_HAS_NO_UNICODE_CHARS
test<char16_t>(0);
test<char32_t>(0);
diff --git a/test/std/language.support/support.limits/limits/numeric.limits.members/is_bounded.pass.cpp b/test/std/language.support/support.limits/limits/numeric.limits.members/is_bounded.pass.cpp
index fa714d5d15068..e00afa900cc5e 100644
--- a/test/std/language.support/support.limits/limits/numeric.limits.members/is_bounded.pass.cpp
+++ b/test/std/language.support/support.limits/limits/numeric.limits.members/is_bounded.pass.cpp
@@ -13,6 +13,8 @@
#include <limits>
+#include "test_macros.h"
+
template <class T, bool expected>
void
test()
@@ -30,6 +32,9 @@ int main()
test<signed char, true>();
test<unsigned char, true>();
test<wchar_t, true>();
+#if TEST_STD_VER > 17 && defined(__cpp_char8_t)
+ test<char8_t, true>();
+#endif
#ifndef _LIBCPP_HAS_NO_UNICODE_CHARS
test<char16_t, true>();
test<char32_t, true>();
diff --git a/test/std/language.support/support.limits/limits/numeric.limits.members/is_exact.pass.cpp b/test/std/language.support/support.limits/limits/numeric.limits.members/is_exact.pass.cpp
index b96a0e7fc5f57..8431b733f5641 100644
--- a/test/std/language.support/support.limits/limits/numeric.limits.members/is_exact.pass.cpp
+++ b/test/std/language.support/support.limits/limits/numeric.limits.members/is_exact.pass.cpp
@@ -13,6 +13,8 @@
#include <limits>
+#include "test_macros.h"
+
template <class T, bool expected>
void
test()
@@ -30,6 +32,9 @@ int main()
test<signed char, true>();
test<unsigned char, true>();
test<wchar_t, true>();
+#if TEST_STD_VER > 17 && defined(__cpp_char8_t)
+ test<char8_t, true>();
+#endif
#ifndef _LIBCPP_HAS_NO_UNICODE_CHARS
test<char16_t, true>();
test<char32_t, true>();
diff --git a/test/std/language.support/support.limits/limits/numeric.limits.members/is_iec559.pass.cpp b/test/std/language.support/support.limits/limits/numeric.limits.members/is_iec559.pass.cpp
index 4408714c1a1db..2e9ac223a3964 100644
--- a/test/std/language.support/support.limits/limits/numeric.limits.members/is_iec559.pass.cpp
+++ b/test/std/language.support/support.limits/limits/numeric.limits.members/is_iec559.pass.cpp
@@ -13,6 +13,8 @@
#include <limits>
+#include "test_macros.h"
+
template <class T, bool expected>
void
test()
@@ -30,6 +32,9 @@ int main()
test<signed char, false>();
test<unsigned char, false>();
test<wchar_t, false>();
+#if TEST_STD_VER > 17 && defined(__cpp_char8_t)
+ test<char8_t, false>();
+#endif
#ifndef _LIBCPP_HAS_NO_UNICODE_CHARS
test<char16_t, false>();
test<char32_t, false>();
diff --git a/test/std/language.support/support.limits/limits/numeric.limits.members/is_integer.pass.cpp b/test/std/language.support/support.limits/limits/numeric.limits.members/is_integer.pass.cpp
index 79bc5867ec634..6e321d1ef24b8 100644
--- a/test/std/language.support/support.limits/limits/numeric.limits.members/is_integer.pass.cpp
+++ b/test/std/language.support/support.limits/limits/numeric.limits.members/is_integer.pass.cpp
@@ -13,6 +13,8 @@
#include <limits>
+#include "test_macros.h"
+
template <class T, bool expected>
void
test()
@@ -30,6 +32,9 @@ int main()
test<signed char, true>();
test<unsigned char, true>();
test<wchar_t, true>();
+#if TEST_STD_VER > 17 && defined(__cpp_char8_t)
+ test<char8_t, true>();
+#endif
#ifndef _LIBCPP_HAS_NO_UNICODE_CHARS
test<char16_t, true>();
test<char32_t, true>();
diff --git a/test/std/language.support/support.limits/limits/numeric.limits.members/is_modulo.pass.cpp b/test/std/language.support/support.limits/limits/numeric.limits.members/is_modulo.pass.cpp
index 6a609963d04c0..f6412a97d6e7e 100644
--- a/test/std/language.support/support.limits/limits/numeric.limits.members/is_modulo.pass.cpp
+++ b/test/std/language.support/support.limits/limits/numeric.limits.members/is_modulo.pass.cpp
@@ -13,6 +13,8 @@
#include <limits>
+#include "test_macros.h"
+
template <class T, bool expected>
void
test()
@@ -30,6 +32,9 @@ int main()
test<signed char, false>();
test<unsigned char, true>();
// test<wchar_t, false>(); // don't know
+#if TEST_STD_VER > 17 && defined(__cpp_char8_t)
+ test<char8_t, true>();
+#endif
#ifndef _LIBCPP_HAS_NO_UNICODE_CHARS
test<char16_t, true>();
test<char32_t, true>();
diff --git a/test/std/language.support/support.limits/limits/numeric.limits.members/is_signed.pass.cpp b/test/std/language.support/support.limits/limits/numeric.limits.members/is_signed.pass.cpp
index 28570fd22790e..b7a892605c369 100644
--- a/test/std/language.support/support.limits/limits/numeric.limits.members/is_signed.pass.cpp
+++ b/test/std/language.support/support.limits/limits/numeric.limits.members/is_signed.pass.cpp
@@ -13,6 +13,8 @@
#include <limits>
+#include "test_macros.h"
+
template <class T, bool expected>
void
test()
@@ -30,6 +32,9 @@ int main()
test<signed char, true>();
test<unsigned char, false>();
test<wchar_t, wchar_t(-1) < wchar_t(0)>();
+#if TEST_STD_VER > 17 && defined(__cpp_char8_t)
+ test<char8_t, false>();
+#endif
#ifndef _LIBCPP_HAS_NO_UNICODE_CHARS
test<char16_t, false>();
test<char32_t, false>();
diff --git a/test/std/language.support/support.limits/limits/numeric.limits.members/lowest.pass.cpp b/test/std/language.support/support.limits/limits/numeric.limits.members/lowest.pass.cpp
index 21090aa9c4c1f..f505f41421531 100644
--- a/test/std/language.support/support.limits/limits/numeric.limits.members/lowest.pass.cpp
+++ b/test/std/language.support/support.limits/limits/numeric.limits.members/lowest.pass.cpp
@@ -17,6 +17,8 @@
#include <cfloat>
#include <cassert>
+#include "test_macros.h"
+
template <class T>
void
test(T expected)
@@ -38,6 +40,9 @@ int main()
test<signed char>(SCHAR_MIN);
test<unsigned char>(0);
test<wchar_t>(WCHAR_MIN);
+#if TEST_STD_VER > 17 && defined(__cpp_char8_t)
+ test<char8_t>(0);
+#endif
#ifndef _LIBCPP_HAS_NO_UNICODE_CHARS
test<char16_t>(0);
test<char32_t>(0);
diff --git a/test/std/language.support/support.limits/limits/numeric.limits.members/max.pass.cpp b/test/std/language.support/support.limits/limits/numeric.limits.members/max.pass.cpp
index 7517aaa192c18..65d5150a7b60f 100644
--- a/test/std/language.support/support.limits/limits/numeric.limits.members/max.pass.cpp
+++ b/test/std/language.support/support.limits/limits/numeric.limits.members/max.pass.cpp
@@ -17,6 +17,8 @@
#include <cfloat>
#include <cassert>
+#include "test_macros.h"
+
template <class T>
void
test(T expected)
@@ -38,6 +40,9 @@ int main()
test<signed char>(SCHAR_MAX);
test<unsigned char>(UCHAR_MAX);
test<wchar_t>(WCHAR_MAX);
+#if TEST_STD_VER > 17 && defined(__cpp_char8_t)
+ test<char8_t>(UCHAR_MAX); // ??
+#endif
#ifndef _LIBCPP_HAS_NO_UNICODE_CHARS
test<char16_t>(USHRT_MAX);
test<char32_t>(UINT_MAX);
diff --git a/test/std/language.support/support.limits/limits/numeric.limits.members/max_digits10.pass.cpp b/test/std/language.support/support.limits/limits/numeric.limits.members/max_digits10.pass.cpp
index de771ebe3b424..158e2791f92ae 100644
--- a/test/std/language.support/support.limits/limits/numeric.limits.members/max_digits10.pass.cpp
+++ b/test/std/language.support/support.limits/limits/numeric.limits.members/max_digits10.pass.cpp
@@ -14,6 +14,8 @@
#include <limits>
#include <cfloat>
+#include "test_macros.h"
+
template <class T, int expected>
void
test()
@@ -31,6 +33,9 @@ int main()
test<signed char, 0>();
test<unsigned char, 0>();
test<wchar_t, 0>();
+#if TEST_STD_VER > 17 && defined(__cpp_char8_t)
+ test<char8_t, 0>();
+#endif
#ifndef _LIBCPP_HAS_NO_UNICODE_CHARS
test<char16_t, 0>();
test<char32_t, 0>();
diff --git a/test/std/language.support/support.limits/limits/numeric.limits.members/max_exponent.pass.cpp b/test/std/language.support/support.limits/limits/numeric.limits.members/max_exponent.pass.cpp
index 6b61f7ba4331c..649310938600a 100644
--- a/test/std/language.support/support.limits/limits/numeric.limits.members/max_exponent.pass.cpp
+++ b/test/std/language.support/support.limits/limits/numeric.limits.members/max_exponent.pass.cpp
@@ -14,6 +14,8 @@
#include <limits>
#include <cfloat>
+#include "test_macros.h"
+
template <class T, int expected>
void
test()
@@ -31,6 +33,9 @@ int main()
test<signed char, 0>();
test<unsigned char, 0>();
test<wchar_t, 0>();
+#if TEST_STD_VER > 17 && defined(__cpp_char8_t)
+ test<char8_t, 0>();
+#endif
#ifndef _LIBCPP_HAS_NO_UNICODE_CHARS
test<char16_t, 0>();
test<char32_t, 0>();
diff --git a/test/std/language.support/support.limits/limits/numeric.limits.members/max_exponent10.pass.cpp b/test/std/language.support/support.limits/limits/numeric.limits.members/max_exponent10.pass.cpp
index 927585e9468b1..c4c7a30a7e88f 100644
--- a/test/std/language.support/support.limits/limits/numeric.limits.members/max_exponent10.pass.cpp
+++ b/test/std/language.support/support.limits/limits/numeric.limits.members/max_exponent10.pass.cpp
@@ -14,6 +14,8 @@
#include <limits>
#include <cfloat>
+#include "test_macros.h"
+
template <class T, int expected>
void
test()
@@ -31,6 +33,9 @@ int main()
test<signed char, 0>();
test<unsigned char, 0>();
test<wchar_t, 0>();
+#if TEST_STD_VER > 17 && defined(__cpp_char8_t)
+ test<char8_t, 0>();
+#endif
#ifndef _LIBCPP_HAS_NO_UNICODE_CHARS
test<char16_t, 0>();
test<char32_t, 0>();
diff --git a/test/std/language.support/support.limits/limits/numeric.limits.members/min.pass.cpp b/test/std/language.support/support.limits/limits/numeric.limits.members/min.pass.cpp
index e72fbba10512d..a1e61fcdcaa5a 100644
--- a/test/std/language.support/support.limits/limits/numeric.limits.members/min.pass.cpp
+++ b/test/std/language.support/support.limits/limits/numeric.limits.members/min.pass.cpp
@@ -17,6 +17,8 @@
#include <cfloat>
#include <cassert>
+#include "test_macros.h"
+
template <class T>
void
test(T expected)
@@ -38,6 +40,9 @@ int main()
test<signed char>(SCHAR_MIN);
test<unsigned char>(0);
test<wchar_t>(WCHAR_MIN);
+#if TEST_STD_VER > 17 && defined(__cpp_char8_t)
+ test<char8_t>(0);
+#endif
#ifndef _LIBCPP_HAS_NO_UNICODE_CHARS
test<char16_t>(0);
test<char32_t>(0);
diff --git a/test/std/language.support/support.limits/limits/numeric.limits.members/min_exponent.pass.cpp b/test/std/language.support/support.limits/limits/numeric.limits.members/min_exponent.pass.cpp
index 245e8441499d7..930d01102700b 100644
--- a/test/std/language.support/support.limits/limits/numeric.limits.members/min_exponent.pass.cpp
+++ b/test/std/language.support/support.limits/limits/numeric.limits.members/min_exponent.pass.cpp
@@ -14,6 +14,8 @@
#include <limits>
#include <cfloat>
+#include "test_macros.h"
+
template <class T, int expected>
void
test()
@@ -31,6 +33,9 @@ int main()
test<signed char, 0>();
test<unsigned char, 0>();
test<wchar_t, 0>();
+#if TEST_STD_VER > 17 && defined(__cpp_char8_t)
+ test<char8_t, 0>();
+#endif
#ifndef _LIBCPP_HAS_NO_UNICODE_CHARS
test<char16_t, 0>();
test<char32_t, 0>();
diff --git a/test/std/language.support/support.limits/limits/numeric.limits.members/min_exponent10.pass.cpp b/test/std/language.support/support.limits/limits/numeric.limits.members/min_exponent10.pass.cpp
index b54d46fd52e8f..05891b1f6f080 100644
--- a/test/std/language.support/support.limits/limits/numeric.limits.members/min_exponent10.pass.cpp
+++ b/test/std/language.support/support.limits/limits/numeric.limits.members/min_exponent10.pass.cpp
@@ -14,6 +14,8 @@
#include <limits>
#include <cfloat>
+#include "test_macros.h"
+
template <class T, int expected>
void
test()
@@ -31,6 +33,9 @@ int main()
test<signed char, 0>();
test<unsigned char, 0>();
test<wchar_t, 0>();
+#if TEST_STD_VER > 17 && defined(__cpp_char8_t)
+ test<char8_t, 0>();
+#endif
#ifndef _LIBCPP_HAS_NO_UNICODE_CHARS
test<char16_t, 0>();
test<char32_t, 0>();
diff --git a/test/std/language.support/support.limits/limits/numeric.limits.members/quiet_NaN.pass.cpp b/test/std/language.support/support.limits/limits/numeric.limits.members/quiet_NaN.pass.cpp
index 97166f0c32096..5d5597c47bc8d 100644
--- a/test/std/language.support/support.limits/limits/numeric.limits.members/quiet_NaN.pass.cpp
+++ b/test/std/language.support/support.limits/limits/numeric.limits.members/quiet_NaN.pass.cpp
@@ -16,6 +16,8 @@
#include <type_traits>
#include <cassert>
+#include "test_macros.h"
+
template <class T>
void
test_imp(std::true_type)
@@ -51,6 +53,9 @@ int main()
test<signed char>();
test<unsigned char>();
test<wchar_t>();
+#if TEST_STD_VER > 17 && defined(__cpp_char8_t)
+ test<char8_t>();
+#endif
#ifndef _LIBCPP_HAS_NO_UNICODE_CHARS
test<char16_t>();
test<char32_t>();
diff --git a/test/std/language.support/support.limits/limits/numeric.limits.members/radix.pass.cpp b/test/std/language.support/support.limits/limits/numeric.limits.members/radix.pass.cpp
index 98a2a53d192e2..1514ae8411d8f 100644
--- a/test/std/language.support/support.limits/limits/numeric.limits.members/radix.pass.cpp
+++ b/test/std/language.support/support.limits/limits/numeric.limits.members/radix.pass.cpp
@@ -14,6 +14,8 @@
#include <limits>
#include <cfloat>
+#include "test_macros.h"
+
template <class T, int expected>
void
test()
@@ -31,6 +33,9 @@ int main()
test<signed char, 2>();
test<unsigned char, 2>();
test<wchar_t, 2>();
+#if TEST_STD_VER > 17 && defined(__cpp_char8_t)
+ test<char8_t, 2>();
+#endif
#ifndef _LIBCPP_HAS_NO_UNICODE_CHARS
test<char16_t, 2>();
test<char32_t, 2>();
diff --git a/test/std/language.support/support.limits/limits/numeric.limits.members/round_error.pass.cpp b/test/std/language.support/support.limits/limits/numeric.limits.members/round_error.pass.cpp
index 5da5c9513a86a..3c2dc5493e23f 100644
--- a/test/std/language.support/support.limits/limits/numeric.limits.members/round_error.pass.cpp
+++ b/test/std/language.support/support.limits/limits/numeric.limits.members/round_error.pass.cpp
@@ -15,6 +15,8 @@
#include <cfloat>
#include <cassert>
+#include "test_macros.h"
+
template <class T>
void
test(T expected)
@@ -32,6 +34,9 @@ int main()
test<signed char>(0);
test<unsigned char>(0);
test<wchar_t>(0);
+#if TEST_STD_VER > 17 && defined(__cpp_char8_t)
+ test<char8_t>(0);
+#endif
#ifndef _LIBCPP_HAS_NO_UNICODE_CHARS
test<char16_t>(0);
test<char32_t>(0);
diff --git a/test/std/language.support/support.limits/limits/numeric.limits.members/round_style.pass.cpp b/test/std/language.support/support.limits/limits/numeric.limits.members/round_style.pass.cpp
index 645f6f7df76a9..f1fd20035fbf9 100644
--- a/test/std/language.support/support.limits/limits/numeric.limits.members/round_style.pass.cpp
+++ b/test/std/language.support/support.limits/limits/numeric.limits.members/round_style.pass.cpp
@@ -13,6 +13,8 @@
#include <limits>
+#include "test_macros.h"
+
template <class T, std::float_round_style expected>
void
test()
@@ -30,6 +32,9 @@ int main()
test<signed char, std::round_toward_zero>();
test<unsigned char, std::round_toward_zero>();
test<wchar_t, std::round_toward_zero>();
+#if TEST_STD_VER > 17 && defined(__cpp_char8_t)
+ test<char8_t, std::round_toward_zero>();
+#endif
#ifndef _LIBCPP_HAS_NO_UNICODE_CHARS
test<char16_t, std::round_toward_zero>();
test<char32_t, std::round_toward_zero>();
diff --git a/test/std/language.support/support.limits/limits/numeric.limits.members/signaling_NaN.pass.cpp b/test/std/language.support/support.limits/limits/numeric.limits.members/signaling_NaN.pass.cpp
index d9df999ddb704..a0a6d7f844c6f 100644
--- a/test/std/language.support/support.limits/limits/numeric.limits.members/signaling_NaN.pass.cpp
+++ b/test/std/language.support/support.limits/limits/numeric.limits.members/signaling_NaN.pass.cpp
@@ -16,6 +16,8 @@
#include <type_traits>
#include <cassert>
+#include "test_macros.h"
+
template <class T>
void
test_imp(std::true_type)
@@ -51,6 +53,9 @@ int main()
test<signed char>();
test<unsigned char>();
test<wchar_t>();
+#if TEST_STD_VER > 17 && defined(__cpp_char8_t)
+ test<char8_t>();
+#endif
#ifndef _LIBCPP_HAS_NO_UNICODE_CHARS
test<char16_t>();
test<char32_t>();
diff --git a/test/std/language.support/support.limits/limits/numeric.limits.members/tinyness_before.pass.cpp b/test/std/language.support/support.limits/limits/numeric.limits.members/tinyness_before.pass.cpp
index 9e2a8431a4e0c..901eea4d05483 100644
--- a/test/std/language.support/support.limits/limits/numeric.limits.members/tinyness_before.pass.cpp
+++ b/test/std/language.support/support.limits/limits/numeric.limits.members/tinyness_before.pass.cpp
@@ -13,6 +13,8 @@
#include <limits>
+#include "test_macros.h"
+
template <class T, bool expected>
void
test()
@@ -30,6 +32,9 @@ int main()
test<signed char, false>();
test<unsigned char, false>();
test<wchar_t, false>();
+#if TEST_STD_VER > 17 && defined(__cpp_char8_t)
+ test<char8_t, false>();
+#endif
#ifndef _LIBCPP_HAS_NO_UNICODE_CHARS
test<char16_t, false>();
test<char32_t, false>();
diff --git a/test/std/language.support/support.limits/limits/numeric.limits.members/traps.pass.cpp b/test/std/language.support/support.limits/limits/numeric.limits.members/traps.pass.cpp
index 23811fada5e2b..8e407c225e38d 100644
--- a/test/std/language.support/support.limits/limits/numeric.limits.members/traps.pass.cpp
+++ b/test/std/language.support/support.limits/limits/numeric.limits.members/traps.pass.cpp
@@ -13,6 +13,8 @@
#include <limits>
+#include "test_macros.h"
+
#if defined(__i386__) || defined(__x86_64__) || defined(__pnacl__) || \
defined(__wasm__)
static const bool integral_types_trap = true;
@@ -37,6 +39,9 @@ int main()
test<signed char, integral_types_trap>();
test<unsigned char, integral_types_trap>();
test<wchar_t, integral_types_trap>();
+#if TEST_STD_VER > 17 && defined(__cpp_char8_t)
+ test<char8_t, integral_types_trap>();
+#endif
#ifndef _LIBCPP_HAS_NO_UNICODE_CHARS
test<char16_t, integral_types_trap>();
test<char32_t, integral_types_trap>();
diff --git a/test/std/language.support/support.limits/support.limits.general/algorithm.version.pass.cpp b/test/std/language.support/support.limits/support.limits.general/algorithm.version.pass.cpp
new file mode 100644
index 0000000000000..36f82c0b75edd
--- /dev/null
+++ b/test/std/language.support/support.limits/support.limits.general/algorithm.version.pass.cpp
@@ -0,0 +1,192 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+//
+// WARNING: This test was generated by generate_feature_test_macro_components.py
+// and should not be edited manually.
+
+// <algorithm>
+
+// Test the feature test macros defined by <algorithm>
+
+/* Constant Value
+ __cpp_lib_clamp 201603L [C++17]
+ __cpp_lib_constexpr_swap_algorithms 201806L [C++2a]
+ __cpp_lib_parallel_algorithm 201603L [C++17]
+ __cpp_lib_ranges 201811L [C++2a]
+ __cpp_lib_robust_nonmodifying_seq_ops 201304L [C++14]
+ __cpp_lib_sample 201603L [C++17]
+*/
+
+#include <algorithm>
+#include "test_macros.h"
+
+#if TEST_STD_VER < 14
+
+# ifdef __cpp_lib_clamp
+# error "__cpp_lib_clamp should not be defined before c++17"
+# endif
+
+# ifdef __cpp_lib_constexpr_swap_algorithms
+# error "__cpp_lib_constexpr_swap_algorithms should not be defined before c++2a"
+# endif
+
+# ifdef __cpp_lib_parallel_algorithm
+# error "__cpp_lib_parallel_algorithm should not be defined before c++17"
+# endif
+
+# ifdef __cpp_lib_ranges
+# error "__cpp_lib_ranges should not be defined before c++2a"
+# endif
+
+# ifdef __cpp_lib_robust_nonmodifying_seq_ops
+# error "__cpp_lib_robust_nonmodifying_seq_ops should not be defined before c++14"
+# endif
+
+# ifdef __cpp_lib_sample
+# error "__cpp_lib_sample should not be defined before c++17"
+# endif
+
+#elif TEST_STD_VER == 14
+
+# ifdef __cpp_lib_clamp
+# error "__cpp_lib_clamp should not be defined before c++17"
+# endif
+
+# ifdef __cpp_lib_constexpr_swap_algorithms
+# error "__cpp_lib_constexpr_swap_algorithms should not be defined before c++2a"
+# endif
+
+# ifdef __cpp_lib_parallel_algorithm
+# error "__cpp_lib_parallel_algorithm should not be defined before c++17"
+# endif
+
+# ifdef __cpp_lib_ranges
+# error "__cpp_lib_ranges should not be defined before c++2a"
+# endif
+
+# ifndef __cpp_lib_robust_nonmodifying_seq_ops
+# error "__cpp_lib_robust_nonmodifying_seq_ops should be defined in c++14"
+# endif
+# if __cpp_lib_robust_nonmodifying_seq_ops != 201304L
+# error "__cpp_lib_robust_nonmodifying_seq_ops should have the value 201304L in c++14"
+# endif
+
+# ifdef __cpp_lib_sample
+# error "__cpp_lib_sample should not be defined before c++17"
+# endif
+
+#elif TEST_STD_VER == 17
+
+# ifndef __cpp_lib_clamp
+# error "__cpp_lib_clamp should be defined in c++17"
+# endif
+# if __cpp_lib_clamp != 201603L
+# error "__cpp_lib_clamp should have the value 201603L in c++17"
+# endif
+
+# ifdef __cpp_lib_constexpr_swap_algorithms
+# error "__cpp_lib_constexpr_swap_algorithms should not be defined before c++2a"
+# endif
+
+# if !defined(_LIBCPP_VERSION)
+# ifndef __cpp_lib_parallel_algorithm
+# error "__cpp_lib_parallel_algorithm should be defined in c++17"
+# endif
+# if __cpp_lib_parallel_algorithm != 201603L
+# error "__cpp_lib_parallel_algorithm should have the value 201603L in c++17"
+# endif
+# else // _LIBCPP_VERSION
+# ifdef __cpp_lib_parallel_algorithm
+# error "__cpp_lib_parallel_algorithm should not be defined because it is unimplemented in libc++!"
+# endif
+# endif
+
+# ifdef __cpp_lib_ranges
+# error "__cpp_lib_ranges should not be defined before c++2a"
+# endif
+
+# ifndef __cpp_lib_robust_nonmodifying_seq_ops
+# error "__cpp_lib_robust_nonmodifying_seq_ops should be defined in c++17"
+# endif
+# if __cpp_lib_robust_nonmodifying_seq_ops != 201304L
+# error "__cpp_lib_robust_nonmodifying_seq_ops should have the value 201304L in c++17"
+# endif
+
+# ifndef __cpp_lib_sample
+# error "__cpp_lib_sample should be defined in c++17"
+# endif
+# if __cpp_lib_sample != 201603L
+# error "__cpp_lib_sample should have the value 201603L in c++17"
+# endif
+
+#elif TEST_STD_VER > 17
+
+# ifndef __cpp_lib_clamp
+# error "__cpp_lib_clamp should be defined in c++2a"
+# endif
+# if __cpp_lib_clamp != 201603L
+# error "__cpp_lib_clamp should have the value 201603L in c++2a"
+# endif
+
+# if !defined(_LIBCPP_VERSION)
+# ifndef __cpp_lib_constexpr_swap_algorithms
+# error "__cpp_lib_constexpr_swap_algorithms should be defined in c++2a"
+# endif
+# if __cpp_lib_constexpr_swap_algorithms != 201806L
+# error "__cpp_lib_constexpr_swap_algorithms should have the value 201806L in c++2a"
+# endif
+# else // _LIBCPP_VERSION
+# ifdef __cpp_lib_constexpr_swap_algorithms
+# error "__cpp_lib_constexpr_swap_algorithms should not be defined because it is unimplemented in libc++!"
+# endif
+# endif
+
+# if !defined(_LIBCPP_VERSION)
+# ifndef __cpp_lib_parallel_algorithm
+# error "__cpp_lib_parallel_algorithm should be defined in c++2a"
+# endif
+# if __cpp_lib_parallel_algorithm != 201603L
+# error "__cpp_lib_parallel_algorithm should have the value 201603L in c++2a"
+# endif
+# else // _LIBCPP_VERSION
+# ifdef __cpp_lib_parallel_algorithm
+# error "__cpp_lib_parallel_algorithm should not be defined because it is unimplemented in libc++!"
+# endif
+# endif
+
+# if !defined(_LIBCPP_VERSION)
+# ifndef __cpp_lib_ranges
+# error "__cpp_lib_ranges should be defined in c++2a"
+# endif
+# if __cpp_lib_ranges != 201811L
+# error "__cpp_lib_ranges should have the value 201811L in c++2a"
+# endif
+# else // _LIBCPP_VERSION
+# ifdef __cpp_lib_ranges
+# error "__cpp_lib_ranges should not be defined because it is unimplemented in libc++!"
+# endif
+# endif
+
+# ifndef __cpp_lib_robust_nonmodifying_seq_ops
+# error "__cpp_lib_robust_nonmodifying_seq_ops should be defined in c++2a"
+# endif
+# if __cpp_lib_robust_nonmodifying_seq_ops != 201304L
+# error "__cpp_lib_robust_nonmodifying_seq_ops should have the value 201304L in c++2a"
+# endif
+
+# ifndef __cpp_lib_sample
+# error "__cpp_lib_sample should be defined in c++2a"
+# endif
+# if __cpp_lib_sample != 201603L
+# error "__cpp_lib_sample should have the value 201603L in c++2a"
+# endif
+
+#endif // TEST_STD_VER > 17
+
+int main() {}
diff --git a/test/std/language.support/support.limits/support.limits.general/any.version.pass.cpp b/test/std/language.support/support.limits/support.limits.general/any.version.pass.cpp
new file mode 100644
index 0000000000000..dbd27c14b47c3
--- /dev/null
+++ b/test/std/language.support/support.limits/support.limits.general/any.version.pass.cpp
@@ -0,0 +1,56 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+//
+// WARNING: This test was generated by generate_feature_test_macro_components.py
+// and should not be edited manually.
+
+// <any>
+
+// Test the feature test macros defined by <any>
+
+/* Constant Value
+ __cpp_lib_any 201606L [C++17]
+*/
+
+#include <any>
+#include "test_macros.h"
+
+#if TEST_STD_VER < 14
+
+# ifdef __cpp_lib_any
+# error "__cpp_lib_any should not be defined before c++17"
+# endif
+
+#elif TEST_STD_VER == 14
+
+# ifdef __cpp_lib_any
+# error "__cpp_lib_any should not be defined before c++17"
+# endif
+
+#elif TEST_STD_VER == 17
+
+# ifndef __cpp_lib_any
+# error "__cpp_lib_any should be defined in c++17"
+# endif
+# if __cpp_lib_any != 201606L
+# error "__cpp_lib_any should have the value 201606L in c++17"
+# endif
+
+#elif TEST_STD_VER > 17
+
+# ifndef __cpp_lib_any
+# error "__cpp_lib_any should be defined in c++2a"
+# endif
+# if __cpp_lib_any != 201606L
+# error "__cpp_lib_any should have the value 201606L in c++2a"
+# endif
+
+#endif // TEST_STD_VER > 17
+
+int main() {}
diff --git a/test/std/language.support/support.limits/support.limits.general/array.version.pass.cpp b/test/std/language.support/support.limits/support.limits.general/array.version.pass.cpp
new file mode 100644
index 0000000000000..9d746ece92105
--- /dev/null
+++ b/test/std/language.support/support.limits/support.limits.general/array.version.pass.cpp
@@ -0,0 +1,105 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+//
+// WARNING: This test was generated by generate_feature_test_macro_components.py
+// and should not be edited manually.
+
+// <array>
+
+// Test the feature test macros defined by <array>
+
+/* Constant Value
+ __cpp_lib_array_constexpr 201603L [C++17]
+ __cpp_lib_constexpr_misc 201811L [C++2a]
+ __cpp_lib_nonmember_container_access 201411L [C++17]
+*/
+
+#include <array>
+#include "test_macros.h"
+
+#if TEST_STD_VER < 14
+
+# ifdef __cpp_lib_array_constexpr
+# error "__cpp_lib_array_constexpr should not be defined before c++17"
+# endif
+
+# ifdef __cpp_lib_constexpr_misc
+# error "__cpp_lib_constexpr_misc should not be defined before c++2a"
+# endif
+
+# ifdef __cpp_lib_nonmember_container_access
+# error "__cpp_lib_nonmember_container_access should not be defined before c++17"
+# endif
+
+#elif TEST_STD_VER == 14
+
+# ifdef __cpp_lib_array_constexpr
+# error "__cpp_lib_array_constexpr should not be defined before c++17"
+# endif
+
+# ifdef __cpp_lib_constexpr_misc
+# error "__cpp_lib_constexpr_misc should not be defined before c++2a"
+# endif
+
+# ifdef __cpp_lib_nonmember_container_access
+# error "__cpp_lib_nonmember_container_access should not be defined before c++17"
+# endif
+
+#elif TEST_STD_VER == 17
+
+# ifndef __cpp_lib_array_constexpr
+# error "__cpp_lib_array_constexpr should be defined in c++17"
+# endif
+# if __cpp_lib_array_constexpr != 201603L
+# error "__cpp_lib_array_constexpr should have the value 201603L in c++17"
+# endif
+
+# ifdef __cpp_lib_constexpr_misc
+# error "__cpp_lib_constexpr_misc should not be defined before c++2a"
+# endif
+
+# ifndef __cpp_lib_nonmember_container_access
+# error "__cpp_lib_nonmember_container_access should be defined in c++17"
+# endif
+# if __cpp_lib_nonmember_container_access != 201411L
+# error "__cpp_lib_nonmember_container_access should have the value 201411L in c++17"
+# endif
+
+#elif TEST_STD_VER > 17
+
+# ifndef __cpp_lib_array_constexpr
+# error "__cpp_lib_array_constexpr should be defined in c++2a"
+# endif
+# if __cpp_lib_array_constexpr != 201603L
+# error "__cpp_lib_array_constexpr should have the value 201603L in c++2a"
+# endif
+
+# if !defined(_LIBCPP_VERSION)
+# ifndef __cpp_lib_constexpr_misc
+# error "__cpp_lib_constexpr_misc should be defined in c++2a"
+# endif
+# if __cpp_lib_constexpr_misc != 201811L
+# error "__cpp_lib_constexpr_misc should have the value 201811L in c++2a"
+# endif
+# else // _LIBCPP_VERSION
+# ifdef __cpp_lib_constexpr_misc
+# error "__cpp_lib_constexpr_misc should not be defined because it is unimplemented in libc++!"
+# endif
+# endif
+
+# ifndef __cpp_lib_nonmember_container_access
+# error "__cpp_lib_nonmember_container_access should be defined in c++2a"
+# endif
+# if __cpp_lib_nonmember_container_access != 201411L
+# error "__cpp_lib_nonmember_container_access should have the value 201411L in c++2a"
+# endif
+
+#endif // TEST_STD_VER > 17
+
+int main() {}
diff --git a/test/std/language.support/support.limits/support.limits.general/atomic.version.pass.cpp b/test/std/language.support/support.limits/support.limits.general/atomic.version.pass.cpp
new file mode 100644
index 0000000000000..835e48d0e7d81
--- /dev/null
+++ b/test/std/language.support/support.limits/support.limits.general/atomic.version.pass.cpp
@@ -0,0 +1,122 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+//
+// WARNING: This test was generated by generate_feature_test_macro_components.py
+// and should not be edited manually.
+
+// UNSUPPORTED: libcpp-has-no-threads
+
+// <atomic>
+
+// Test the feature test macros defined by <atomic>
+
+/* Constant Value
+ __cpp_lib_atomic_is_always_lock_free 201603L [C++17]
+ __cpp_lib_atomic_ref 201806L [C++2a]
+ __cpp_lib_char8_t 201811L [C++2a]
+*/
+
+#include <atomic>
+#include "test_macros.h"
+
+#if TEST_STD_VER < 14
+
+# ifdef __cpp_lib_atomic_is_always_lock_free
+# error "__cpp_lib_atomic_is_always_lock_free should not be defined before c++17"
+# endif
+
+# ifdef __cpp_lib_atomic_ref
+# error "__cpp_lib_atomic_ref should not be defined before c++2a"
+# endif
+
+# ifdef __cpp_lib_char8_t
+# error "__cpp_lib_char8_t should not be defined before c++2a"
+# endif
+
+#elif TEST_STD_VER == 14
+
+# ifdef __cpp_lib_atomic_is_always_lock_free
+# error "__cpp_lib_atomic_is_always_lock_free should not be defined before c++17"
+# endif
+
+# ifdef __cpp_lib_atomic_ref
+# error "__cpp_lib_atomic_ref should not be defined before c++2a"
+# endif
+
+# ifdef __cpp_lib_char8_t
+# error "__cpp_lib_char8_t should not be defined before c++2a"
+# endif
+
+#elif TEST_STD_VER == 17
+
+# if !defined(_LIBCPP_HAS_NO_THREADS)
+# ifndef __cpp_lib_atomic_is_always_lock_free
+# error "__cpp_lib_atomic_is_always_lock_free should be defined in c++17"
+# endif
+# if __cpp_lib_atomic_is_always_lock_free != 201603L
+# error "__cpp_lib_atomic_is_always_lock_free should have the value 201603L in c++17"
+# endif
+# else
+# ifdef __cpp_lib_atomic_is_always_lock_free
+# error "__cpp_lib_atomic_is_always_lock_free should not be defined when !defined(_LIBCPP_HAS_NO_THREADS) is not defined!"
+# endif
+# endif
+
+# ifdef __cpp_lib_atomic_ref
+# error "__cpp_lib_atomic_ref should not be defined before c++2a"
+# endif
+
+# ifdef __cpp_lib_char8_t
+# error "__cpp_lib_char8_t should not be defined before c++2a"
+# endif
+
+#elif TEST_STD_VER > 17
+
+# if !defined(_LIBCPP_HAS_NO_THREADS)
+# ifndef __cpp_lib_atomic_is_always_lock_free
+# error "__cpp_lib_atomic_is_always_lock_free should be defined in c++2a"
+# endif
+# if __cpp_lib_atomic_is_always_lock_free != 201603L
+# error "__cpp_lib_atomic_is_always_lock_free should have the value 201603L in c++2a"
+# endif
+# else
+# ifdef __cpp_lib_atomic_is_always_lock_free
+# error "__cpp_lib_atomic_is_always_lock_free should not be defined when !defined(_LIBCPP_HAS_NO_THREADS) is not defined!"
+# endif
+# endif
+
+# if !defined(_LIBCPP_VERSION)
+# ifndef __cpp_lib_atomic_ref
+# error "__cpp_lib_atomic_ref should be defined in c++2a"
+# endif
+# if __cpp_lib_atomic_ref != 201806L
+# error "__cpp_lib_atomic_ref should have the value 201806L in c++2a"
+# endif
+# else // _LIBCPP_VERSION
+# ifdef __cpp_lib_atomic_ref
+# error "__cpp_lib_atomic_ref should not be defined because it is unimplemented in libc++!"
+# endif
+# endif
+
+# if defined(__cpp_char8_t)
+# ifndef __cpp_lib_char8_t
+# error "__cpp_lib_char8_t should be defined in c++2a"
+# endif
+# if __cpp_lib_char8_t != 201811L
+# error "__cpp_lib_char8_t should have the value 201811L in c++2a"
+# endif
+# else
+# ifdef __cpp_lib_char8_t
+# error "__cpp_lib_char8_t should not be defined when defined(__cpp_char8_t) is not defined!"
+# endif
+# endif
+
+#endif // TEST_STD_VER > 17
+
+int main() {}
diff --git a/test/std/language.support/support.limits/support.limits.general/bit.version.pass.cpp b/test/std/language.support/support.limits/support.limits.general/bit.version.pass.cpp
new file mode 100644
index 0000000000000..97d2b9246bd59
--- /dev/null
+++ b/test/std/language.support/support.limits/support.limits.general/bit.version.pass.cpp
@@ -0,0 +1,59 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+//
+// WARNING: This test was generated by generate_feature_test_macro_components.py
+// and should not be edited manually.
+
+// <bit>
+
+// Test the feature test macros defined by <bit>
+
+/* Constant Value
+ __cpp_lib_bit_cast 201806L [C++2a]
+*/
+
+#include <bit>
+#include "test_macros.h"
+
+#if TEST_STD_VER < 14
+
+# ifdef __cpp_lib_bit_cast
+# error "__cpp_lib_bit_cast should not be defined before c++2a"
+# endif
+
+#elif TEST_STD_VER == 14
+
+# ifdef __cpp_lib_bit_cast
+# error "__cpp_lib_bit_cast should not be defined before c++2a"
+# endif
+
+#elif TEST_STD_VER == 17
+
+# ifdef __cpp_lib_bit_cast
+# error "__cpp_lib_bit_cast should not be defined before c++2a"
+# endif
+
+#elif TEST_STD_VER > 17
+
+# if !defined(_LIBCPP_VERSION)
+# ifndef __cpp_lib_bit_cast
+# error "__cpp_lib_bit_cast should be defined in c++2a"
+# endif
+# if __cpp_lib_bit_cast != 201806L
+# error "__cpp_lib_bit_cast should have the value 201806L in c++2a"
+# endif
+# else // _LIBCPP_VERSION
+# ifdef __cpp_lib_bit_cast
+# error "__cpp_lib_bit_cast should not be defined because it is unimplemented in libc++!"
+# endif
+# endif
+
+#endif // TEST_STD_VER > 17
+
+int main() {}
diff --git a/test/std/language.support/support.limits/support.limits.general/charconv.pass.cpp b/test/std/language.support/support.limits/support.limits.general/charconv.pass.cpp
new file mode 100644
index 0000000000000..f1e252f8e86a8
--- /dev/null
+++ b/test/std/language.support/support.limits/support.limits.general/charconv.pass.cpp
@@ -0,0 +1,32 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+//
+// <charconv> feature macros
+
+/* Constant Value
+ __cpp_lib_to_chars 201611L
+
+*/
+
+#include <charconv>
+#include <cassert>
+#include "test_macros.h"
+
+int main()
+{
+// ensure that the macros that are supposed to be defined in <utility> are defined.
+
+/*
+#if !defined(__cpp_lib_fooby)
+# error "__cpp_lib_fooby is not defined"
+#elif __cpp_lib_fooby < 201606L
+# error "__cpp_lib_fooby has an invalid value"
+#endif
+*/
+}
diff --git a/test/std/language.support/support.limits/support.limits.general/chrono.version.pass.cpp b/test/std/language.support/support.limits/support.limits.general/chrono.version.pass.cpp
new file mode 100644
index 0000000000000..3605878c55b93
--- /dev/null
+++ b/test/std/language.support/support.limits/support.limits.general/chrono.version.pass.cpp
@@ -0,0 +1,82 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+//
+// WARNING: This test was generated by generate_feature_test_macro_components.py
+// and should not be edited manually.
+
+// <chrono>
+
+// Test the feature test macros defined by <chrono>
+
+/* Constant Value
+ __cpp_lib_chrono 201611L [C++17]
+ __cpp_lib_chrono_udls 201304L [C++14]
+*/
+
+#include <chrono>
+#include "test_macros.h"
+
+#if TEST_STD_VER < 14
+
+# ifdef __cpp_lib_chrono
+# error "__cpp_lib_chrono should not be defined before c++17"
+# endif
+
+# ifdef __cpp_lib_chrono_udls
+# error "__cpp_lib_chrono_udls should not be defined before c++14"
+# endif
+
+#elif TEST_STD_VER == 14
+
+# ifdef __cpp_lib_chrono
+# error "__cpp_lib_chrono should not be defined before c++17"
+# endif
+
+# ifndef __cpp_lib_chrono_udls
+# error "__cpp_lib_chrono_udls should be defined in c++14"
+# endif
+# if __cpp_lib_chrono_udls != 201304L
+# error "__cpp_lib_chrono_udls should have the value 201304L in c++14"
+# endif
+
+#elif TEST_STD_VER == 17
+
+# ifndef __cpp_lib_chrono
+# error "__cpp_lib_chrono should be defined in c++17"
+# endif
+# if __cpp_lib_chrono != 201611L
+# error "__cpp_lib_chrono should have the value 201611L in c++17"
+# endif
+
+# ifndef __cpp_lib_chrono_udls
+# error "__cpp_lib_chrono_udls should be defined in c++17"
+# endif
+# if __cpp_lib_chrono_udls != 201304L
+# error "__cpp_lib_chrono_udls should have the value 201304L in c++17"
+# endif
+
+#elif TEST_STD_VER > 17
+
+# ifndef __cpp_lib_chrono
+# error "__cpp_lib_chrono should be defined in c++2a"
+# endif
+# if __cpp_lib_chrono != 201611L
+# error "__cpp_lib_chrono should have the value 201611L in c++2a"
+# endif
+
+# ifndef __cpp_lib_chrono_udls
+# error "__cpp_lib_chrono_udls should be defined in c++2a"
+# endif
+# if __cpp_lib_chrono_udls != 201304L
+# error "__cpp_lib_chrono_udls should have the value 201304L in c++2a"
+# endif
+
+#endif // TEST_STD_VER > 17
+
+int main() {}
diff --git a/test/std/language.support/support.limits/support.limits.general/cmath.version.pass.cpp b/test/std/language.support/support.limits/support.limits.general/cmath.version.pass.cpp
new file mode 100644
index 0000000000000..13d6b9312d52a
--- /dev/null
+++ b/test/std/language.support/support.limits/support.limits.general/cmath.version.pass.cpp
@@ -0,0 +1,91 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+//
+// WARNING: This test was generated by generate_feature_test_macro_components.py
+// and should not be edited manually.
+
+// <cmath>
+
+// Test the feature test macros defined by <cmath>
+
+/* Constant Value
+ __cpp_lib_hypot 201603L [C++17]
+ __cpp_lib_math_special_functions 201603L [C++17]
+*/
+
+#include <cmath>
+#include "test_macros.h"
+
+#if TEST_STD_VER < 14
+
+# ifdef __cpp_lib_hypot
+# error "__cpp_lib_hypot should not be defined before c++17"
+# endif
+
+# ifdef __cpp_lib_math_special_functions
+# error "__cpp_lib_math_special_functions should not be defined before c++17"
+# endif
+
+#elif TEST_STD_VER == 14
+
+# ifdef __cpp_lib_hypot
+# error "__cpp_lib_hypot should not be defined before c++17"
+# endif
+
+# ifdef __cpp_lib_math_special_functions
+# error "__cpp_lib_math_special_functions should not be defined before c++17"
+# endif
+
+#elif TEST_STD_VER == 17
+
+# ifndef __cpp_lib_hypot
+# error "__cpp_lib_hypot should be defined in c++17"
+# endif
+# if __cpp_lib_hypot != 201603L
+# error "__cpp_lib_hypot should have the value 201603L in c++17"
+# endif
+
+# if !defined(_LIBCPP_VERSION)
+# ifndef __cpp_lib_math_special_functions
+# error "__cpp_lib_math_special_functions should be defined in c++17"
+# endif
+# if __cpp_lib_math_special_functions != 201603L
+# error "__cpp_lib_math_special_functions should have the value 201603L in c++17"
+# endif
+# else // _LIBCPP_VERSION
+# ifdef __cpp_lib_math_special_functions
+# error "__cpp_lib_math_special_functions should not be defined because it is unimplemented in libc++!"
+# endif
+# endif
+
+#elif TEST_STD_VER > 17
+
+# ifndef __cpp_lib_hypot
+# error "__cpp_lib_hypot should be defined in c++2a"
+# endif
+# if __cpp_lib_hypot != 201603L
+# error "__cpp_lib_hypot should have the value 201603L in c++2a"
+# endif
+
+# if !defined(_LIBCPP_VERSION)
+# ifndef __cpp_lib_math_special_functions
+# error "__cpp_lib_math_special_functions should be defined in c++2a"
+# endif
+# if __cpp_lib_math_special_functions != 201603L
+# error "__cpp_lib_math_special_functions should have the value 201603L in c++2a"
+# endif
+# else // _LIBCPP_VERSION
+# ifdef __cpp_lib_math_special_functions
+# error "__cpp_lib_math_special_functions should not be defined because it is unimplemented in libc++!"
+# endif
+# endif
+
+#endif // TEST_STD_VER > 17
+
+int main() {}
diff --git a/test/std/language.support/support.limits/support.limits.general/compare.version.pass.cpp b/test/std/language.support/support.limits/support.limits.general/compare.version.pass.cpp
new file mode 100644
index 0000000000000..c1dff02d24ee7
--- /dev/null
+++ b/test/std/language.support/support.limits/support.limits.general/compare.version.pass.cpp
@@ -0,0 +1,59 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+//
+// WARNING: This test was generated by generate_feature_test_macro_components.py
+// and should not be edited manually.
+
+// <compare>
+
+// Test the feature test macros defined by <compare>
+
+/* Constant Value
+ __cpp_lib_three_way_comparison 201711L [C++2a]
+*/
+
+#include <compare>
+#include "test_macros.h"
+
+#if TEST_STD_VER < 14
+
+# ifdef __cpp_lib_three_way_comparison
+# error "__cpp_lib_three_way_comparison should not be defined before c++2a"
+# endif
+
+#elif TEST_STD_VER == 14
+
+# ifdef __cpp_lib_three_way_comparison
+# error "__cpp_lib_three_way_comparison should not be defined before c++2a"
+# endif
+
+#elif TEST_STD_VER == 17
+
+# ifdef __cpp_lib_three_way_comparison
+# error "__cpp_lib_three_way_comparison should not be defined before c++2a"
+# endif
+
+#elif TEST_STD_VER > 17
+
+# if !defined(_LIBCPP_VERSION)
+# ifndef __cpp_lib_three_way_comparison
+# error "__cpp_lib_three_way_comparison should be defined in c++2a"
+# endif
+# if __cpp_lib_three_way_comparison != 201711L
+# error "__cpp_lib_three_way_comparison should have the value 201711L in c++2a"
+# 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
+# endif
+
+#endif // TEST_STD_VER > 17
+
+int main() {}
diff --git a/test/std/language.support/support.limits/support.limits.general/complex.version.pass.cpp b/test/std/language.support/support.limits/support.limits.general/complex.version.pass.cpp
new file mode 100644
index 0000000000000..170a3da8947e7
--- /dev/null
+++ b/test/std/language.support/support.limits/support.limits.general/complex.version.pass.cpp
@@ -0,0 +1,59 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+//
+// WARNING: This test was generated by generate_feature_test_macro_components.py
+// and should not be edited manually.
+
+// <complex>
+
+// Test the feature test macros defined by <complex>
+
+/* Constant Value
+ __cpp_lib_complex_udls 201309L [C++14]
+*/
+
+#include <complex>
+#include "test_macros.h"
+
+#if TEST_STD_VER < 14
+
+# ifdef __cpp_lib_complex_udls
+# error "__cpp_lib_complex_udls should not be defined before c++14"
+# endif
+
+#elif TEST_STD_VER == 14
+
+# ifndef __cpp_lib_complex_udls
+# error "__cpp_lib_complex_udls should be defined in c++14"
+# endif
+# if __cpp_lib_complex_udls != 201309L
+# error "__cpp_lib_complex_udls should have the value 201309L in c++14"
+# endif
+
+#elif TEST_STD_VER == 17
+
+# ifndef __cpp_lib_complex_udls
+# error "__cpp_lib_complex_udls should be defined in c++17"
+# endif
+# if __cpp_lib_complex_udls != 201309L
+# error "__cpp_lib_complex_udls should have the value 201309L in c++17"
+# endif
+
+#elif TEST_STD_VER > 17
+
+# ifndef __cpp_lib_complex_udls
+# error "__cpp_lib_complex_udls should be defined in c++2a"
+# endif
+# if __cpp_lib_complex_udls != 201309L
+# error "__cpp_lib_complex_udls should have the value 201309L in c++2a"
+# endif
+
+#endif // TEST_STD_VER > 17
+
+int main() {}
diff --git a/test/std/language.support/support.limits/support.limits.general/concepts.version.pass.cpp b/test/std/language.support/support.limits/support.limits.general/concepts.version.pass.cpp
new file mode 100644
index 0000000000000..b212391227aa3
--- /dev/null
+++ b/test/std/language.support/support.limits/support.limits.general/concepts.version.pass.cpp
@@ -0,0 +1,34 @@
+
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+//
+// <concepts> feature macros
+
+/* Constant Value
+ __cpp_lib_concepts 201806L
+
+*/
+
+// XFAIL
+// #include <concepts>
+#include <cassert>
+#include "test_macros.h"
+
+int main()
+{
+// ensure that the macros that are supposed to be defined in <concepts> are defined.
+
+/*
+#if !defined(__cpp_lib_fooby)
+# error "__cpp_lib_fooby is not defined"
+#elif __cpp_lib_fooby < 201606L
+# error "__cpp_lib_fooby has an invalid value"
+#endif
+*/
+}
diff --git a/test/std/language.support/support.limits/support.limits.general/cstddef.version.pass.cpp b/test/std/language.support/support.limits/support.limits.general/cstddef.version.pass.cpp
new file mode 100644
index 0000000000000..f4ebc8e10af2a
--- /dev/null
+++ b/test/std/language.support/support.limits/support.limits.general/cstddef.version.pass.cpp
@@ -0,0 +1,56 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+//
+// WARNING: This test was generated by generate_feature_test_macro_components.py
+// and should not be edited manually.
+
+// <cstddef>
+
+// Test the feature test macros defined by <cstddef>
+
+/* Constant Value
+ __cpp_lib_byte 201603L [C++17]
+*/
+
+#include <cstddef>
+#include "test_macros.h"
+
+#if TEST_STD_VER < 14
+
+# ifdef __cpp_lib_byte
+# error "__cpp_lib_byte should not be defined before c++17"
+# endif
+
+#elif TEST_STD_VER == 14
+
+# ifdef __cpp_lib_byte
+# error "__cpp_lib_byte should not be defined before c++17"
+# endif
+
+#elif TEST_STD_VER == 17
+
+# ifndef __cpp_lib_byte
+# error "__cpp_lib_byte should be defined in c++17"
+# endif
+# if __cpp_lib_byte != 201603L
+# error "__cpp_lib_byte should have the value 201603L in c++17"
+# endif
+
+#elif TEST_STD_VER > 17
+
+# ifndef __cpp_lib_byte
+# error "__cpp_lib_byte should be defined in c++2a"
+# endif
+# if __cpp_lib_byte != 201603L
+# error "__cpp_lib_byte should have the value 201603L in c++2a"
+# endif
+
+#endif // TEST_STD_VER > 17
+
+int main() {}
diff --git a/test/std/language.support/support.limits/support.limits.general/deque.version.pass.cpp b/test/std/language.support/support.limits/support.limits.general/deque.version.pass.cpp
new file mode 100644
index 0000000000000..a325d6a3a2ad7
--- /dev/null
+++ b/test/std/language.support/support.limits/support.limits.general/deque.version.pass.cpp
@@ -0,0 +1,99 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+//
+// WARNING: This test was generated by generate_feature_test_macro_components.py
+// and should not be edited manually.
+
+// <deque>
+
+// Test the feature test macros defined by <deque>
+
+/* Constant Value
+ __cpp_lib_allocator_traits_is_always_equal 201411L [C++17]
+ __cpp_lib_erase_if 201811L [C++2a]
+ __cpp_lib_nonmember_container_access 201411L [C++17]
+*/
+
+#include <deque>
+#include "test_macros.h"
+
+#if TEST_STD_VER < 14
+
+# ifdef __cpp_lib_allocator_traits_is_always_equal
+# error "__cpp_lib_allocator_traits_is_always_equal should not be defined before c++17"
+# endif
+
+# ifdef __cpp_lib_erase_if
+# error "__cpp_lib_erase_if should not be defined before c++2a"
+# endif
+
+# ifdef __cpp_lib_nonmember_container_access
+# error "__cpp_lib_nonmember_container_access should not be defined before c++17"
+# endif
+
+#elif TEST_STD_VER == 14
+
+# ifdef __cpp_lib_allocator_traits_is_always_equal
+# error "__cpp_lib_allocator_traits_is_always_equal should not be defined before c++17"
+# endif
+
+# ifdef __cpp_lib_erase_if
+# error "__cpp_lib_erase_if should not be defined before c++2a"
+# endif
+
+# ifdef __cpp_lib_nonmember_container_access
+# error "__cpp_lib_nonmember_container_access should not be defined before c++17"
+# endif
+
+#elif TEST_STD_VER == 17
+
+# ifndef __cpp_lib_allocator_traits_is_always_equal
+# error "__cpp_lib_allocator_traits_is_always_equal should be defined in c++17"
+# endif
+# if __cpp_lib_allocator_traits_is_always_equal != 201411L
+# error "__cpp_lib_allocator_traits_is_always_equal should have the value 201411L in c++17"
+# endif
+
+# ifdef __cpp_lib_erase_if
+# error "__cpp_lib_erase_if should not be defined before c++2a"
+# endif
+
+# ifndef __cpp_lib_nonmember_container_access
+# error "__cpp_lib_nonmember_container_access should be defined in c++17"
+# endif
+# if __cpp_lib_nonmember_container_access != 201411L
+# error "__cpp_lib_nonmember_container_access should have the value 201411L in c++17"
+# endif
+
+#elif TEST_STD_VER > 17
+
+# ifndef __cpp_lib_allocator_traits_is_always_equal
+# error "__cpp_lib_allocator_traits_is_always_equal should be defined in c++2a"
+# endif
+# if __cpp_lib_allocator_traits_is_always_equal != 201411L
+# error "__cpp_lib_allocator_traits_is_always_equal should have the value 201411L in c++2a"
+# endif
+
+# ifndef __cpp_lib_erase_if
+# error "__cpp_lib_erase_if should be defined in c++2a"
+# endif
+# if __cpp_lib_erase_if != 201811L
+# error "__cpp_lib_erase_if should have the value 201811L in c++2a"
+# endif
+
+# ifndef __cpp_lib_nonmember_container_access
+# error "__cpp_lib_nonmember_container_access should be defined in c++2a"
+# endif
+# if __cpp_lib_nonmember_container_access != 201411L
+# error "__cpp_lib_nonmember_container_access should have the value 201411L in c++2a"
+# endif
+
+#endif // TEST_STD_VER > 17
+
+int main() {}
diff --git a/test/std/language.support/support.limits/support.limits.general/exception.version.pass.cpp b/test/std/language.support/support.limits/support.limits.general/exception.version.pass.cpp
new file mode 100644
index 0000000000000..97ce6d330d558
--- /dev/null
+++ b/test/std/language.support/support.limits/support.limits.general/exception.version.pass.cpp
@@ -0,0 +1,56 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+//
+// WARNING: This test was generated by generate_feature_test_macro_components.py
+// and should not be edited manually.
+
+// <exception>
+
+// Test the feature test macros defined by <exception>
+
+/* Constant Value
+ __cpp_lib_uncaught_exceptions 201411L [C++17]
+*/
+
+#include <exception>
+#include "test_macros.h"
+
+#if TEST_STD_VER < 14
+
+# ifdef __cpp_lib_uncaught_exceptions
+# error "__cpp_lib_uncaught_exceptions should not be defined before c++17"
+# endif
+
+#elif TEST_STD_VER == 14
+
+# ifdef __cpp_lib_uncaught_exceptions
+# error "__cpp_lib_uncaught_exceptions should not be defined before c++17"
+# endif
+
+#elif TEST_STD_VER == 17
+
+# ifndef __cpp_lib_uncaught_exceptions
+# error "__cpp_lib_uncaught_exceptions should be defined in c++17"
+# endif
+# if __cpp_lib_uncaught_exceptions != 201411L
+# error "__cpp_lib_uncaught_exceptions should have the value 201411L in c++17"
+# endif
+
+#elif TEST_STD_VER > 17
+
+# ifndef __cpp_lib_uncaught_exceptions
+# error "__cpp_lib_uncaught_exceptions should be defined in c++2a"
+# endif
+# if __cpp_lib_uncaught_exceptions != 201411L
+# error "__cpp_lib_uncaught_exceptions should have the value 201411L in c++2a"
+# endif
+
+#endif // TEST_STD_VER > 17
+
+int main() {}
diff --git a/test/std/language.support/support.limits/support.limits.general/execution.version.pass.cpp b/test/std/language.support/support.limits/support.limits.general/execution.version.pass.cpp
new file mode 100644
index 0000000000000..2fcd44cd079ee
--- /dev/null
+++ b/test/std/language.support/support.limits/support.limits.general/execution.version.pass.cpp
@@ -0,0 +1,34 @@
+
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+//
+// <execution> feature macros
+
+/* Constant Value
+ __cpp_lib_execution 201603L
+
+*/
+
+// XFAIL
+// #include <execution>
+#include <cassert>
+#include "test_macros.h"
+
+int main()
+{
+// ensure that the macros that are supposed to be defined in <execution> are defined.
+
+/*
+#if !defined(__cpp_lib_fooby)
+# error "__cpp_lib_fooby is not defined"
+#elif __cpp_lib_fooby < 201606L
+# error "__cpp_lib_fooby has an invalid value"
+#endif
+*/
+}
diff --git a/test/std/language.support/support.limits/support.limits.general/filesystem.version.pass.cpp b/test/std/language.support/support.limits/support.limits.general/filesystem.version.pass.cpp
new file mode 100644
index 0000000000000..990e5683b4b76
--- /dev/null
+++ b/test/std/language.support/support.limits/support.limits.general/filesystem.version.pass.cpp
@@ -0,0 +1,82 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+//
+// WARNING: This test was generated by generate_feature_test_macro_components.py
+// and should not be edited manually.
+
+// <filesystem>
+
+// Test the feature test macros defined by <filesystem>
+
+/* Constant Value
+ __cpp_lib_char8_t 201811L [C++2a]
+ __cpp_lib_filesystem 201703L [C++17]
+*/
+
+#include <filesystem>
+#include "test_macros.h"
+
+#if TEST_STD_VER < 14
+
+# ifdef __cpp_lib_char8_t
+# error "__cpp_lib_char8_t should not be defined before c++2a"
+# endif
+
+# ifdef __cpp_lib_filesystem
+# error "__cpp_lib_filesystem should not be defined before c++17"
+# endif
+
+#elif TEST_STD_VER == 14
+
+# ifdef __cpp_lib_char8_t
+# error "__cpp_lib_char8_t should not be defined before c++2a"
+# endif
+
+# ifdef __cpp_lib_filesystem
+# error "__cpp_lib_filesystem should not be defined before c++17"
+# endif
+
+#elif TEST_STD_VER == 17
+
+# ifdef __cpp_lib_char8_t
+# error "__cpp_lib_char8_t should not be defined before c++2a"
+# endif
+
+# ifndef __cpp_lib_filesystem
+# error "__cpp_lib_filesystem should be defined in c++17"
+# endif
+# if __cpp_lib_filesystem != 201703L
+# error "__cpp_lib_filesystem should have the value 201703L in c++17"
+# endif
+
+#elif TEST_STD_VER > 17
+
+# if defined(__cpp_char8_t)
+# ifndef __cpp_lib_char8_t
+# error "__cpp_lib_char8_t should be defined in c++2a"
+# endif
+# if __cpp_lib_char8_t != 201811L
+# error "__cpp_lib_char8_t should have the value 201811L in c++2a"
+# endif
+# else
+# ifdef __cpp_lib_char8_t
+# error "__cpp_lib_char8_t should not be defined when defined(__cpp_char8_t) is not defined!"
+# endif
+# endif
+
+# ifndef __cpp_lib_filesystem
+# error "__cpp_lib_filesystem should be defined in c++2a"
+# endif
+# if __cpp_lib_filesystem != 201703L
+# error "__cpp_lib_filesystem should have the value 201703L in c++2a"
+# endif
+
+#endif // TEST_STD_VER > 17
+
+int main() {}
diff --git a/test/std/language.support/support.limits/support.limits.general/forward_list.version.pass.cpp b/test/std/language.support/support.limits/support.limits.general/forward_list.version.pass.cpp
new file mode 100644
index 0000000000000..5bf0213078d68
--- /dev/null
+++ b/test/std/language.support/support.limits/support.limits.general/forward_list.version.pass.cpp
@@ -0,0 +1,148 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+//
+// WARNING: This test was generated by generate_feature_test_macro_components.py
+// and should not be edited manually.
+
+// <forward_list>
+
+// Test the feature test macros defined by <forward_list>
+
+/* Constant Value
+ __cpp_lib_allocator_traits_is_always_equal 201411L [C++17]
+ __cpp_lib_erase_if 201811L [C++2a]
+ __cpp_lib_incomplete_container_elements 201505L [C++17]
+ __cpp_lib_list_remove_return_type 201806L [C++2a]
+ __cpp_lib_nonmember_container_access 201411L [C++17]
+*/
+
+#include <forward_list>
+#include "test_macros.h"
+
+#if TEST_STD_VER < 14
+
+# ifdef __cpp_lib_allocator_traits_is_always_equal
+# error "__cpp_lib_allocator_traits_is_always_equal should not be defined before c++17"
+# endif
+
+# ifdef __cpp_lib_erase_if
+# error "__cpp_lib_erase_if should not be defined before c++2a"
+# endif
+
+# ifdef __cpp_lib_incomplete_container_elements
+# error "__cpp_lib_incomplete_container_elements should not be defined before c++17"
+# endif
+
+# ifdef __cpp_lib_list_remove_return_type
+# error "__cpp_lib_list_remove_return_type should not be defined before c++2a"
+# endif
+
+# ifdef __cpp_lib_nonmember_container_access
+# error "__cpp_lib_nonmember_container_access should not be defined before c++17"
+# endif
+
+#elif TEST_STD_VER == 14
+
+# ifdef __cpp_lib_allocator_traits_is_always_equal
+# error "__cpp_lib_allocator_traits_is_always_equal should not be defined before c++17"
+# endif
+
+# ifdef __cpp_lib_erase_if
+# error "__cpp_lib_erase_if should not be defined before c++2a"
+# endif
+
+# ifdef __cpp_lib_incomplete_container_elements
+# error "__cpp_lib_incomplete_container_elements should not be defined before c++17"
+# endif
+
+# ifdef __cpp_lib_list_remove_return_type
+# error "__cpp_lib_list_remove_return_type should not be defined before c++2a"
+# endif
+
+# ifdef __cpp_lib_nonmember_container_access
+# error "__cpp_lib_nonmember_container_access should not be defined before c++17"
+# endif
+
+#elif TEST_STD_VER == 17
+
+# ifndef __cpp_lib_allocator_traits_is_always_equal
+# error "__cpp_lib_allocator_traits_is_always_equal should be defined in c++17"
+# endif
+# if __cpp_lib_allocator_traits_is_always_equal != 201411L
+# error "__cpp_lib_allocator_traits_is_always_equal should have the value 201411L in c++17"
+# endif
+
+# ifdef __cpp_lib_erase_if
+# error "__cpp_lib_erase_if should not be defined before c++2a"
+# endif
+
+# ifndef __cpp_lib_incomplete_container_elements
+# error "__cpp_lib_incomplete_container_elements should be defined in c++17"
+# endif
+# if __cpp_lib_incomplete_container_elements != 201505L
+# error "__cpp_lib_incomplete_container_elements should have the value 201505L in c++17"
+# endif
+
+# ifdef __cpp_lib_list_remove_return_type
+# error "__cpp_lib_list_remove_return_type should not be defined before c++2a"
+# endif
+
+# ifndef __cpp_lib_nonmember_container_access
+# error "__cpp_lib_nonmember_container_access should be defined in c++17"
+# endif
+# if __cpp_lib_nonmember_container_access != 201411L
+# error "__cpp_lib_nonmember_container_access should have the value 201411L in c++17"
+# endif
+
+#elif TEST_STD_VER > 17
+
+# ifndef __cpp_lib_allocator_traits_is_always_equal
+# error "__cpp_lib_allocator_traits_is_always_equal should be defined in c++2a"
+# endif
+# if __cpp_lib_allocator_traits_is_always_equal != 201411L
+# error "__cpp_lib_allocator_traits_is_always_equal should have the value 201411L in c++2a"
+# endif
+
+# ifndef __cpp_lib_erase_if
+# error "__cpp_lib_erase_if should be defined in c++2a"
+# endif
+# if __cpp_lib_erase_if != 201811L
+# error "__cpp_lib_erase_if should have the value 201811L in c++2a"
+# endif
+
+# ifndef __cpp_lib_incomplete_container_elements
+# error "__cpp_lib_incomplete_container_elements should be defined in c++2a"
+# endif
+# if __cpp_lib_incomplete_container_elements != 201505L
+# error "__cpp_lib_incomplete_container_elements should have the value 201505L in c++2a"
+# endif
+
+# if !defined(_LIBCPP_VERSION)
+# ifndef __cpp_lib_list_remove_return_type
+# error "__cpp_lib_list_remove_return_type should be defined in c++2a"
+# endif
+# if __cpp_lib_list_remove_return_type != 201806L
+# error "__cpp_lib_list_remove_return_type should have the value 201806L in c++2a"
+# endif
+# else // _LIBCPP_VERSION
+# ifdef __cpp_lib_list_remove_return_type
+# error "__cpp_lib_list_remove_return_type should not be defined because it is unimplemented in libc++!"
+# endif
+# endif
+
+# ifndef __cpp_lib_nonmember_container_access
+# error "__cpp_lib_nonmember_container_access should be defined in c++2a"
+# endif
+# if __cpp_lib_nonmember_container_access != 201411L
+# error "__cpp_lib_nonmember_container_access should have the value 201411L in c++2a"
+# endif
+
+#endif // TEST_STD_VER > 17
+
+int main() {}
diff --git a/test/std/language.support/support.limits/support.limits.general/functional.version.pass.cpp b/test/std/language.support/support.limits/support.limits.general/functional.version.pass.cpp
new file mode 100644
index 0000000000000..5ca84c1cc5a36
--- /dev/null
+++ b/test/std/language.support/support.limits/support.limits.general/functional.version.pass.cpp
@@ -0,0 +1,245 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+//
+// WARNING: This test was generated by generate_feature_test_macro_components.py
+// and should not be edited manually.
+
+// <functional>
+
+// Test the feature test macros defined by <functional>
+
+/* Constant Value
+ __cpp_lib_bind_front 201811L [C++2a]
+ __cpp_lib_boyer_moore_searcher 201603L [C++17]
+ __cpp_lib_constexpr_misc 201811L [C++2a]
+ __cpp_lib_invoke 201411L [C++17]
+ __cpp_lib_not_fn 201603L [C++17]
+ __cpp_lib_ranges 201811L [C++2a]
+ __cpp_lib_result_of_sfinae 201210L [C++14]
+ __cpp_lib_transparent_operators 201210L [C++14]
+ 201510L [C++17]
+*/
+
+#include <functional>
+#include "test_macros.h"
+
+#if TEST_STD_VER < 14
+
+# ifdef __cpp_lib_bind_front
+# error "__cpp_lib_bind_front should not be defined before c++2a"
+# endif
+
+# ifdef __cpp_lib_boyer_moore_searcher
+# error "__cpp_lib_boyer_moore_searcher should not be defined before c++17"
+# endif
+
+# ifdef __cpp_lib_constexpr_misc
+# error "__cpp_lib_constexpr_misc should not be defined before c++2a"
+# endif
+
+# ifdef __cpp_lib_invoke
+# error "__cpp_lib_invoke should not be defined before c++17"
+# endif
+
+# ifdef __cpp_lib_not_fn
+# error "__cpp_lib_not_fn should not be defined before c++17"
+# endif
+
+# ifdef __cpp_lib_ranges
+# error "__cpp_lib_ranges should not be defined before c++2a"
+# endif
+
+# ifdef __cpp_lib_result_of_sfinae
+# error "__cpp_lib_result_of_sfinae should not be defined before c++14"
+# endif
+
+# ifdef __cpp_lib_transparent_operators
+# error "__cpp_lib_transparent_operators should not be defined before c++14"
+# endif
+
+#elif TEST_STD_VER == 14
+
+# ifdef __cpp_lib_bind_front
+# error "__cpp_lib_bind_front should not be defined before c++2a"
+# endif
+
+# ifdef __cpp_lib_boyer_moore_searcher
+# error "__cpp_lib_boyer_moore_searcher should not be defined before c++17"
+# endif
+
+# ifdef __cpp_lib_constexpr_misc
+# error "__cpp_lib_constexpr_misc should not be defined before c++2a"
+# endif
+
+# ifdef __cpp_lib_invoke
+# error "__cpp_lib_invoke should not be defined before c++17"
+# endif
+
+# ifdef __cpp_lib_not_fn
+# error "__cpp_lib_not_fn should not be defined before c++17"
+# endif
+
+# ifdef __cpp_lib_ranges
+# error "__cpp_lib_ranges should not be defined before c++2a"
+# endif
+
+# ifndef __cpp_lib_result_of_sfinae
+# error "__cpp_lib_result_of_sfinae should be defined in c++14"
+# endif
+# if __cpp_lib_result_of_sfinae != 201210L
+# error "__cpp_lib_result_of_sfinae should have the value 201210L in c++14"
+# endif
+
+# ifndef __cpp_lib_transparent_operators
+# error "__cpp_lib_transparent_operators should be defined in c++14"
+# endif
+# if __cpp_lib_transparent_operators != 201210L
+# error "__cpp_lib_transparent_operators should have the value 201210L in c++14"
+# endif
+
+#elif TEST_STD_VER == 17
+
+# ifdef __cpp_lib_bind_front
+# error "__cpp_lib_bind_front should not be defined before c++2a"
+# endif
+
+# if !defined(_LIBCPP_VERSION)
+# ifndef __cpp_lib_boyer_moore_searcher
+# error "__cpp_lib_boyer_moore_searcher should be defined in c++17"
+# endif
+# if __cpp_lib_boyer_moore_searcher != 201603L
+# error "__cpp_lib_boyer_moore_searcher should have the value 201603L in c++17"
+# endif
+# else // _LIBCPP_VERSION
+# ifdef __cpp_lib_boyer_moore_searcher
+# error "__cpp_lib_boyer_moore_searcher should not be defined because it is unimplemented in libc++!"
+# endif
+# endif
+
+# ifdef __cpp_lib_constexpr_misc
+# error "__cpp_lib_constexpr_misc should not be defined before c++2a"
+# endif
+
+# ifndef __cpp_lib_invoke
+# error "__cpp_lib_invoke should be defined in c++17"
+# endif
+# if __cpp_lib_invoke != 201411L
+# error "__cpp_lib_invoke should have the value 201411L in c++17"
+# endif
+
+# ifndef __cpp_lib_not_fn
+# error "__cpp_lib_not_fn should be defined in c++17"
+# endif
+# if __cpp_lib_not_fn != 201603L
+# error "__cpp_lib_not_fn should have the value 201603L in c++17"
+# endif
+
+# ifdef __cpp_lib_ranges
+# error "__cpp_lib_ranges should not be defined before c++2a"
+# endif
+
+# ifndef __cpp_lib_result_of_sfinae
+# error "__cpp_lib_result_of_sfinae should be defined in c++17"
+# endif
+# if __cpp_lib_result_of_sfinae != 201210L
+# error "__cpp_lib_result_of_sfinae should have the value 201210L in c++17"
+# endif
+
+# ifndef __cpp_lib_transparent_operators
+# error "__cpp_lib_transparent_operators should be defined in c++17"
+# endif
+# if __cpp_lib_transparent_operators != 201510L
+# error "__cpp_lib_transparent_operators should have the value 201510L in c++17"
+# endif
+
+#elif TEST_STD_VER > 17
+
+# if !defined(_LIBCPP_VERSION)
+# ifndef __cpp_lib_bind_front
+# error "__cpp_lib_bind_front should be defined in c++2a"
+# endif
+# if __cpp_lib_bind_front != 201811L
+# error "__cpp_lib_bind_front should have the value 201811L in c++2a"
+# endif
+# else // _LIBCPP_VERSION
+# ifdef __cpp_lib_bind_front
+# error "__cpp_lib_bind_front should not be defined because it is unimplemented in libc++!"
+# endif
+# endif
+
+# if !defined(_LIBCPP_VERSION)
+# ifndef __cpp_lib_boyer_moore_searcher
+# error "__cpp_lib_boyer_moore_searcher should be defined in c++2a"
+# endif
+# if __cpp_lib_boyer_moore_searcher != 201603L
+# error "__cpp_lib_boyer_moore_searcher should have the value 201603L in c++2a"
+# endif
+# else // _LIBCPP_VERSION
+# ifdef __cpp_lib_boyer_moore_searcher
+# error "__cpp_lib_boyer_moore_searcher should not be defined because it is unimplemented in libc++!"
+# endif
+# endif
+
+# if !defined(_LIBCPP_VERSION)
+# ifndef __cpp_lib_constexpr_misc
+# error "__cpp_lib_constexpr_misc should be defined in c++2a"
+# endif
+# if __cpp_lib_constexpr_misc != 201811L
+# error "__cpp_lib_constexpr_misc should have the value 201811L in c++2a"
+# endif
+# else // _LIBCPP_VERSION
+# ifdef __cpp_lib_constexpr_misc
+# error "__cpp_lib_constexpr_misc should not be defined because it is unimplemented in libc++!"
+# endif
+# endif
+
+# ifndef __cpp_lib_invoke
+# error "__cpp_lib_invoke should be defined in c++2a"
+# endif
+# if __cpp_lib_invoke != 201411L
+# error "__cpp_lib_invoke should have the value 201411L in c++2a"
+# endif
+
+# ifndef __cpp_lib_not_fn
+# error "__cpp_lib_not_fn should be defined in c++2a"
+# endif
+# if __cpp_lib_not_fn != 201603L
+# error "__cpp_lib_not_fn should have the value 201603L in c++2a"
+# endif
+
+# if !defined(_LIBCPP_VERSION)
+# ifndef __cpp_lib_ranges
+# error "__cpp_lib_ranges should be defined in c++2a"
+# endif
+# if __cpp_lib_ranges != 201811L
+# error "__cpp_lib_ranges should have the value 201811L in c++2a"
+# endif
+# else // _LIBCPP_VERSION
+# ifdef __cpp_lib_ranges
+# error "__cpp_lib_ranges should not be defined because it is unimplemented in libc++!"
+# endif
+# endif
+
+# ifndef __cpp_lib_result_of_sfinae
+# error "__cpp_lib_result_of_sfinae should be defined in c++2a"
+# endif
+# if __cpp_lib_result_of_sfinae != 201210L
+# error "__cpp_lib_result_of_sfinae should have the value 201210L in c++2a"
+# endif
+
+# ifndef __cpp_lib_transparent_operators
+# error "__cpp_lib_transparent_operators should be defined in c++2a"
+# endif
+# if __cpp_lib_transparent_operators != 201510L
+# error "__cpp_lib_transparent_operators should have the value 201510L in c++2a"
+# endif
+
+#endif // TEST_STD_VER > 17
+
+int main() {}
diff --git a/test/std/language.support/support.limits/support.limits.general/generate_feature_test_macro_components.py b/test/std/language.support/support.limits/support.limits.general/generate_feature_test_macro_components.py
new file mode 100755
index 0000000000000..c80ebb11e679b
--- /dev/null
+++ b/test/std/language.support/support.limits/support.limits.general/generate_feature_test_macro_components.py
@@ -0,0 +1,977 @@
+#!/usr/bin/env python
+
+import os
+import tempfile
+
+def get_libcxx_paths():
+ script_path = os.path.dirname(os.path.abspath(__file__))
+ script_name = os.path.basename(__file__)
+ assert os.path.exists(script_path)
+ depth = 5
+ src_root = script_path
+ for _ in xrange(0, 5):
+ src_root = os.path.dirname(src_root)
+ include_path = os.path.join(src_root, 'include')
+ assert os.path.exists(include_path)
+ docs_path = os.path.join(src_root, 'docs')
+ assert os.path.exists(docs_path)
+ return script_path, script_name, src_root, include_path, docs_path
+
+
+script_path, script_name, source_root, include_path, docs_path = get_libcxx_paths()
+
+def has_header(h):
+ h_path = os.path.join(include_path, h)
+ return os.path.exists(h_path)
+
+def add_version_header(tc):
+ tc["headers"].append("version")
+ return tc
+
+feature_test_macros = sorted([ add_version_header(x) for x in [
+ # C++14 macros
+ {"name": "__cpp_lib_integer_sequence",
+ "values": {
+ "c++14": 201304L
+ },
+ "headers": ["utility"],
+ },
+ {"name": "__cpp_lib_exchange_function",
+ "values": {
+ "c++14": 201304L
+ },
+ "headers": ["utility"],
+ },
+ {"name": "__cpp_lib_tuples_by_type",
+ "values": {
+ "c++14": 201304L
+ },
+ "headers": ["utility", "tuple"],
+ },
+ {"name": "__cpp_lib_tuple_element_t",
+ "values": {
+ "c++14": 201402L
+ },
+ "headers": ["tuple"],
+ },
+ {"name": "__cpp_lib_make_unique",
+ "values": {
+ "c++14": 201304L
+ },
+ "headers": ["memory"],
+ },
+ {"name": "__cpp_lib_transparent_operators",
+ "values": {
+ "c++14": 201210L,
+ "c++17": 201510L,
+ },
+ "headers": ["functional"],
+ },
+ {"name": "__cpp_lib_integral_constant_callable",
+ "values": {
+ "c++14": 201304L
+ },
+ "headers": ["type_traits"],
+ },
+ {"name": "__cpp_lib_transformation_trait_aliases",
+ "values": {
+ "c++14": 201304L,
+ },
+ "headers": ["type_traits"]
+ },
+ {"name": "__cpp_lib_result_of_sfinae",
+ "values": {
+ "c++14": 201210L,
+ },
+ "headers": ["functional", "type_traits"]
+ },
+ {"name": "__cpp_lib_is_final",
+ "values": {
+ "c++14": 201402L,
+ },
+ "headers": ["type_traits"]
+ },
+ {"name": "__cpp_lib_is_null_pointer",
+ "values": {
+ "c++14": 201309L,
+ },
+ "headers": ["type_traits"]
+ },
+ {"name": "__cpp_lib_chrono_udls",
+ "values": {
+ "c++14": 201304L,
+ },
+ "headers": ["chrono"]
+ },
+ {"name": "__cpp_lib_string_udls",
+ "values": {
+ "c++14": 201304L,
+ },
+ "headers": ["string"]
+ },
+ {"name": "__cpp_lib_generic_associative_lookup",
+ "values": {
+ "c++14": 201304L,
+ },
+ "headers": ["map", "set"]
+ },
+ {"name": "__cpp_lib_null_iterators",
+ "values": {
+ "c++14": 201304L,
+ },
+ "headers": ["iterator"]
+ },
+ {"name": "__cpp_lib_make_reverse_iterator",
+ "values": {
+ "c++14": 201402L,
+ },
+ "headers": ["iterator"]
+ },
+ {"name": "__cpp_lib_robust_nonmodifying_seq_ops",
+ "values": {
+ "c++14": 201304L,
+ },
+ "headers": ["algorithm"]
+ },
+ {"name": "__cpp_lib_complex_udls",
+ "values": {
+ "c++14": 201309L,
+ },
+ "headers": ["complex"]
+ },
+ {"name": "__cpp_lib_quoted_string_io",
+ "values": {
+ "c++14": 201304L,
+ },
+ "headers": ["iomanip"]
+ },
+ {"name": "__cpp_lib_shared_timed_mutex",
+ "values": {
+ "c++14": 201402L,
+ },
+ "headers": ["shared_mutex"],
+ "depends": "!defined(_LIBCPP_HAS_NO_THREADS)",
+ "internal_depends": "!defined(_LIBCPP_HAS_NO_THREADS)",
+ },
+ # C++17 macros
+ {"name": "__cpp_lib_atomic_is_always_lock_free",
+ "values": {
+ "c++17": 201603L,
+ },
+ "headers": ["atomic"],
+ "depends": "!defined(_LIBCPP_HAS_NO_THREADS)",
+ "internal_depends": "!defined(_LIBCPP_HAS_NO_THREADS)",
+ },
+ {"name": "__cpp_lib_filesystem",
+ "values": {
+ "c++17": 201703L,
+ },
+ "headers": ["filesystem"]
+ },
+ {"name": "__cpp_lib_invoke",
+ "values": {
+ "c++17": 201411L,
+ },
+ "headers": ["functional"]
+ },
+ {"name": "__cpp_lib_void_t",
+ "values": {
+ "c++17": 201411L,
+ },
+ "headers": ["type_traits"]
+ },
+ {"name": "__cpp_lib_node_extract",
+ "values": {
+ "c++17": 201606L,
+ },
+ "headers": ["map", "set", "unordered_map", "unordered_set"]
+ },
+ {"name": "__cpp_lib_byte",
+ "values": {
+ "c++17": 201603L,
+ },
+ "headers": ["cstddef"],
+ },
+ {"name": "__cpp_lib_hardware_interference_size",
+ "values": {
+ "c++17": 201703L,
+ },
+ "headers": ["new"],
+ },
+ {"name": "__cpp_lib_launder",
+ "values": {
+ "c++17": 201606L,
+ },
+ "headers": ["new"],
+ },
+ {"name": "__cpp_lib_uncaught_exceptions",
+ "values": {
+ "c++17": 201411L,
+ },
+ "headers": ["exception"],
+ },
+ {"name": "__cpp_lib_as_const",
+ "values": {
+ "c++17": 201510L,
+ },
+ "headers": ["utility"],
+ },
+ {"name": "__cpp_lib_make_from_tuple",
+ "values": {
+ "c++17": 201606L,
+ },
+ "headers": ["tuple"],
+ },
+ {"name": "__cpp_lib_apply",
+ "values": {
+ "c++17": 201603L,
+ },
+ "headers": ["tuple"],
+ },
+ {"name": "__cpp_lib_optional",
+ "values": {
+ "c++17": 201606L,
+ },
+ "headers": ["optional"],
+ },
+ {"name": "__cpp_lib_variant",
+ "values": {
+ "c++17": 201606L,
+ },
+ "headers": ["variant"],
+ },
+ {"name": "__cpp_lib_any",
+ "values": {
+ "c++17": 201606L,
+ },
+ "headers": ["any"],
+ },
+ {"name": "__cpp_lib_addressof_constexpr",
+ "values": {
+ "c++17": 201603L,
+ },
+ "headers": ["memory"],
+ "depends": "TEST_HAS_BUILTIN(__builtin_addressof) || TEST_GCC_VER >= 700",
+ "internal_depends": "!defined(_LIBCPP_HAS_NO_BUILTIN_ADDRESSOF)",
+ },
+ {"name": "__cpp_lib_raw_memory_algorithms",
+ "values": {
+ "c++17": 201606L,
+ },
+ "headers": ["memory"],
+ },
+ {"name": "__cpp_lib_enable_shared_from_this",
+ "values": {
+ "c++17": 201603L,
+ },
+ "headers": ["memory"],
+ },
+ {"name": "__cpp_lib_shared_ptr_weak_type",
+ "values": {
+ "c++17": 201606L,
+ },
+ "headers": ["memory"],
+ },
+ {"name": "__cpp_lib_shared_ptr_arrays",
+ "values": {
+ "c++17": 201611L,
+ },
+ "headers": ["memory"],
+ "unimplemented": True,
+ },
+ {"name": "__cpp_lib_memory_resource",
+ "values": {
+ "c++17": 201603L,
+ },
+ "headers": ["memory_resource"],
+ "unimplemented": True,
+ },
+ {"name": "__cpp_lib_boyer_moore_searcher",
+ "values": {
+ "c++17": 201603L,
+ },
+ "headers": ["functional"],
+ "unimplemented": True,
+ },
+ {"name": "__cpp_lib_not_fn",
+ "values": {
+ "c++17": 201603L,
+ },
+ "headers": ["functional"],
+ },
+ {"name": "__cpp_lib_bool_constant",
+ "values": {
+ "c++17": 201505L,
+ },
+ "headers": ["type_traits"],
+ },
+ {"name": "__cpp_lib_type_trait_variable_templates",
+ "values": {
+ "c++17": 201510L,
+ },
+ "headers": ["type_traits"],
+ },
+ {"name": "__cpp_lib_logical_traits",
+ "values": {
+ "c++17": 201510L,
+ },
+ "headers": ["type_traits"],
+ },
+ {"name": "__cpp_lib_is_swappable",
+ "values": {
+ "c++17": 201603L,
+ },
+ "headers": ["type_traits"],
+ },
+ {"name": "__cpp_lib_is_invocable",
+ "values": {
+ "c++17": 201703L,
+ },
+ "headers": ["type_traits"],
+ },
+ {"name": "__cpp_lib_has_unique_object_representations",
+ "values": {
+ "c++17": 201606L,
+ },
+ "headers": ["type_traits"],
+ "depends": "TEST_HAS_BUILTIN_IDENTIFIER(__has_unique_object_representations) || TEST_GCC_VER >= 700",
+ "internal_depends": "defined(_LIBCPP_HAS_UNIQUE_OBJECT_REPRESENTATIONS)",
+ },
+ {"name": "__cpp_lib_is_aggregate",
+ "values": {
+ "c++17": 201703L,
+ },
+ "headers": ["type_traits"],
+ "depends": "TEST_HAS_BUILTIN_IDENTIFIER(__is_aggregate) || TEST_GCC_VER_NEW >= 7001",
+ "internal_depends": "!defined(_LIBCPP_HAS_NO_IS_AGGREGATE)",
+ },
+ {"name": "__cpp_lib_chrono",
+ "values": {
+ "c++17": 201611L,
+ },
+ "headers": ["chrono"],
+ },
+ {"name": "__cpp_lib_execution",
+ "values": {
+ "c++17": 201603L,
+ },
+ "headers": ["execution"],
+ "unimplemented": True
+ },
+ {"name": "__cpp_lib_parallel_algorithm",
+ "values": {
+ "c++17": 201603L,
+ },
+ "headers": ["algorithm", "numeric"],
+ "unimplemented": True,
+ },
+ {"name": "__cpp_lib_to_chars",
+ "values": {
+ "c++17": 201611L,
+ },
+ "headers": ["utility"],
+ "unimplemented": True,
+ },
+ {"name": "__cpp_lib_string_view",
+ "values": {
+ "c++17": 201606L,
+ },
+ "headers": ["string", "string_view"],
+ },
+ {"name": "__cpp_lib_allocator_traits_is_always_equal",
+ "values": {
+ "c++17": 201411L,
+ },
+ "headers": ["memory", "scoped_allocator", "string", "deque", "forward_list", "list", "vector", "map", "set", "unordered_map", "unordered_set"],
+ },
+ {"name": "__cpp_lib_incomplete_container_elements",
+ "values": {
+ "c++17": 201505L,
+ },
+ "headers": ["forward_list", "list", "vector"],
+ },
+ {"name": "__cpp_lib_map_try_emplace",
+ "values": {
+ "c++17": 201411L,
+ },
+ "headers": ["map"],
+ },
+ {"name": "__cpp_lib_unordered_map_try_emplace",
+ "values": {
+ "c++17": 201411L,
+ },
+ "headers": ["unordered_map"],
+ },
+ {"name": "__cpp_lib_array_constexpr",
+ "values": {
+ "c++17": 201603L,
+ },
+ "headers": ["iterator", "array"],
+ },
+ {"name": "__cpp_lib_nonmember_container_access",
+ "values": {
+ "c++17": 201411L,
+ },
+ "headers": ["iterator", "array", "deque", "forward_list", "list", "map", "regex",
+ "set", "string", "unordered_map", "unordered_set", "vector"],
+ },
+ {"name": "__cpp_lib_sample",
+ "values": {
+ "c++17": 201603L,
+ },
+ "headers": ["algorithm"],
+ },
+ {"name": "__cpp_lib_clamp",
+ "values": {
+ "c++17": 201603L,
+ },
+ "headers": ["algorithm"],
+ },
+ {"name": "__cpp_lib_gcd_lcm",
+ "values": {
+ "c++17": 201606L,
+ },
+ "headers": ["numeric"],
+ },
+ {"name": "__cpp_lib_hypot",
+ "values": {
+ "c++17": 201603L,
+ },
+ "headers": ["cmath"],
+ },
+ {"name": "__cpp_lib_math_special_functions",
+ "values": {
+ "c++17": 201603L,
+ },
+ "headers": ["cmath"],
+ "unimplemented": True,
+ },
+ {"name": "__cpp_lib_shared_mutex",
+ "values": {
+ "c++17": 201505L,
+ },
+ "headers": ["shared_mutex"],
+ "depends": "!defined(_LIBCPP_HAS_NO_THREADS)",
+ "internal_depends": "!defined(_LIBCPP_HAS_NO_THREADS)",
+ },
+ {"name": "__cpp_lib_scoped_lock",
+ "values": {
+ "c++17": 201703L,
+ },
+ "headers": ["mutex"],
+ },
+ # C++2a
+ {"name": "__cpp_lib_char8_t",
+ "values": {
+ "c++2a": 201811L,
+ },
+ "headers": ["atomic", "filesystem", "istream", "limits", "locale", "ostream",
+ "string", "string_view"],
+ "depends": "defined(__cpp_char8_t)",
+ "internal_depends": "!defined(_LIBCPP_NO_HAS_CHAR8_T)",
+ },
+ {"name": "__cpp_lib_erase_if",
+ "values": {
+ "c++2a": 201811L,
+ },
+ "headers": ["string", "deque", "forward_list", "list", "vector", "map",
+ "set", "unordered_map", "unordered_set"]
+ },
+ {"name": "__cpp_lib_destroying_delete",
+ "values": {
+ "c++2a": 201806L,
+ },
+ "headers": ["new"],
+ "unimplemented": True,
+ },
+ {"name": "__cpp_lib_three_way_comparison",
+ "values": {
+ "c++2a": 201711L,
+ },
+ "headers": ["compare"],
+ "unimplemented": True,
+ },
+ {"name": "__cpp_lib_concepts",
+ "values": {
+ "c++2a": 201806L,
+ },
+ "headers": ["concepts"],
+ "unimplemented": True,
+ },
+ {"name": "__cpp_lib_constexpr_swap_algorithms",
+ "values": {
+ "c++2a": 201806L,
+ },
+ "headers": ["algorithm"],
+ "unimplemented": True,
+ },
+ {"name": "__cpp_lib_constexpr_misc",
+ "values": {
+ "c++2a": 201811L,
+ },
+ "headers": ["array", "functional", "iterator", "string_view", "tuple", "utility"],
+ "unimplemented": True,
+ },
+ {"name": "__cpp_lib_bind_front",
+ "values": {
+ "c++2a": 201811L,
+ },
+ "headers": ["functional"],
+ "unimplemented": True,
+ },
+ {"name": "__cpp_lib_is_constant_evaluated",
+ "values": {
+ "c++2a": 201811L,
+ },
+ "headers": ["type_traits"],
+ "unimplemented": True,
+ },
+ {"name": "__cpp_lib_list_remove_return_type",
+ "values": {
+ "c++2a": 201806L,
+ },
+ "headers": ["forward_list", "list"],
+ "unimplemented": True,
+ },
+ {"name": "__cpp_lib_generic_unordered_lookup",
+ "values": {
+ "c++2a": 201811L,
+ },
+ "headers": ["unordered_map", "unordered_set"],
+ "unimplemented": True,
+ },
+ {"name": "__cpp_lib_ranges",
+ "values": {
+ "c++2a": 201811L,
+ },
+ "headers": ["algorithm", "functional", "iterator", "memory", "ranges"],
+ "unimplemented": True,
+ },
+ {"name": "__cpp_lib_bit_cast",
+ "values": {
+ "c++2a": 201806L,
+ },
+ "headers": ["bit"],
+ "unimplemented": True,
+ },
+ {"name": "__cpp_lib_atomic_ref",
+ "values": {
+ "c++2a": 201806L,
+ },
+ "headers": ["atomic"],
+ "unimplemented": True,
+ "depends": "!defined(_LIBCPP_HAS_NO_THREADS)",
+ "internal_depends": "!defined(_LIBCPP_HAS_NO_THREADS)",
+ },
+]], key=lambda tc: tc["name"])
+
+def get_std_dialects():
+ std_dialects = ['c++14', 'c++17', 'c++2a']
+ return list(std_dialects)
+
+def get_first_std(d):
+ for s in get_std_dialects():
+ if s in d.keys():
+ return s
+ return None
+
+def get_last_std(d):
+ rev_dialects = get_std_dialects()
+ rev_dialects.reverse()
+ for s in rev_dialects:
+ if s in d.keys():
+ return s
+ return None
+
+def get_std_before(d, std):
+ std_dialects = get_std_dialects()
+ candidates = std_dialects[0:std_dialects.index(std)]
+ candidates.reverse()
+ for cand in candidates:
+ if cand in d.keys():
+ return cand
+ return None
+
+def get_value_before(d, std):
+ new_std = get_std_before(d, std)
+ if new_std is None:
+ return None
+ return d[new_std]
+
+def get_for_std(d, std):
+ # This catches the C++11 case for which there should be no defined feature
+ # test macros.
+ std_dialects = get_std_dialects()
+ if std not in std_dialects:
+ return None
+ # Find the value for the newest C++ dialect between C++14 and std
+ std_list = list(std_dialects[0:std_dialects.index(std)+1])
+ std_list.reverse()
+ for s in std_list:
+ if s in d.keys():
+ return d[s]
+ return None
+
+
+"""
+ Functions to produce the <version> header
+"""
+
+def produce_macros_definition_for_std(std):
+ result = ""
+ indent = 56
+ for tc in feature_test_macros:
+ if std not in tc["values"]:
+ continue
+ inner_indent = 1
+ if 'depends' in tc.keys():
+ assert 'internal_depends' in tc.keys()
+ result += "# if %s\n" % tc["internal_depends"]
+ inner_indent += 2
+ if get_value_before(tc["values"], std) is not None:
+ assert 'depends' not in tc.keys()
+ result += "# undef %s\n" % tc["name"]
+ line = "#%sdefine %s" % ((" " * inner_indent), tc["name"])
+ line += " " * (indent - len(line))
+ line += "%sL" % tc["values"][std]
+ if 'unimplemented' in tc.keys():
+ line = "// " + line
+ result += line
+ result += "\n"
+ if 'depends' in tc.keys():
+ result += "# endif\n"
+ return result
+
+def chunks(l, n):
+ """Yield successive n-sized chunks from l."""
+ for i in range(0, len(l), n):
+ yield l[i:i + n]
+
+def produce_version_synopsis():
+ indent = 56
+ header_indent = 56 + len("20XXYYL ")
+ result = ""
+ def indent_to(s, val):
+ if len(s) >= val:
+ return s
+ s += " " * (val - len(s))
+ return s
+ line = indent_to("Macro name", indent) + "Value"
+ line = indent_to(line, header_indent) + "Headers"
+ result += line + "\n"
+ for tc in feature_test_macros:
+ prev_defined_std = get_last_std(tc["values"])
+ line = "{name: <{indent}}{value}L ".format(name=tc['name'], indent=indent,
+ value=tc["values"][prev_defined_std])
+ headers = list(tc["headers"])
+ headers.remove("version")
+ for chunk in chunks(headers, 3):
+ line = indent_to(line, header_indent)
+ chunk = ['<%s>' % header for header in chunk]
+ line += ' '.join(chunk)
+ result += line
+ result += "\n"
+ line = ""
+ while True:
+ prev_defined_std = get_std_before(tc["values"], prev_defined_std)
+ if prev_defined_std is None:
+ break
+ result += "%s%sL // %s\n" % (indent_to("", indent), tc["values"][prev_defined_std],
+ prev_defined_std.replace("c++", "C++"))
+ return result
+
+
+def produce_version_header():
+ template="""// -*- C++ -*-
+//===--------------------------- version ----------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef _LIBCPP_VERSIONH
+#define _LIBCPP_VERSIONH
+
+/*
+ version synopsis
+
+{synopsis}
+
+*/
+
+#include <__config>
+
+#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
+#pragma GCC system_header
+#endif
+
+#if _LIBCPP_STD_VER > 11
+{cxx14_macros}
+#endif
+
+#if _LIBCPP_STD_VER > 14
+{cxx17_macros}
+#endif
+
+#if _LIBCPP_STD_VER > 17
+{cxx2a_macros}
+#endif
+
+#endif // _LIBCPP_VERSIONH
+"""
+ return template.format(
+ synopsis=produce_version_synopsis().strip(),
+ cxx14_macros=produce_macros_definition_for_std('c++14').strip(),
+ cxx17_macros=produce_macros_definition_for_std('c++17').strip(),
+ cxx2a_macros=produce_macros_definition_for_std('c++2a').strip())
+
+"""
+ Functions to produce test files
+"""
+
+test_types = {
+ "undefined": """
+# ifdef {name}
+# error "{name} should not be defined before {std_first}"
+# endif
+""",
+
+ "depends": """
+# if {depends}
+# ifndef {name}
+# error "{name} should be defined in {std}"
+# endif
+# if {name} != {value}
+# error "{name} should have the value {value} in {std}"
+# endif
+# else
+# ifdef {name}
+# error "{name} should not be defined when {depends} is not defined!"
+# endif
+# endif
+""",
+
+ "unimplemented": """
+# if !defined(_LIBCPP_VERSION)
+# ifndef {name}
+# error "{name} should be defined in {std}"
+# endif
+# if {name} != {value}
+# error "{name} should have the value {value} in {std}"
+# endif
+# else // _LIBCPP_VERSION
+# ifdef {name}
+# error "{name} should not be defined because it is unimplemented in libc++!"
+# endif
+# endif
+""",
+
+ "defined":"""
+# ifndef {name}
+# error "{name} should be defined in {std}"
+# endif
+# if {name} != {value}
+# error "{name} should have the value {value} in {std}"
+# endif
+"""
+}
+
+def generate_std_test(test_list, std):
+ result = ""
+ for tc in test_list:
+ val = get_for_std(tc["values"], std)
+ if val is not None:
+ val = "%sL" % val
+ if val is None:
+ result += test_types["undefined"].format(name=tc["name"], std_first=get_first_std(tc["values"]))
+ elif 'unimplemented' in tc.keys():
+ result += test_types["unimplemented"].format(name=tc["name"], value=val, std=std)
+ elif "depends" in tc.keys():
+ result += test_types["depends"].format(name=tc["name"], value=val, std=std, depends=tc["depends"])
+ else:
+ result += test_types["defined"].format(name=tc["name"], value=val, std=std)
+ return result
+
+def generate_synopsis(test_list):
+ max_name_len = max([len(tc["name"]) for tc in test_list])
+ indent = max_name_len + 8
+ def mk_line(prefix, suffix):
+ return "{prefix: <{max_len}}{suffix}\n".format(prefix=prefix, suffix=suffix,
+ max_len=indent)
+ result = ""
+ result += mk_line("/* Constant", "Value")
+ for tc in test_list:
+ prefix = " %s" % tc["name"]
+ for std in [s for s in get_std_dialects() if s in tc["values"].keys()]:
+ result += mk_line(prefix, "%sL [%s]" % (tc["values"][std], std.replace("c++", "C++")))
+ prefix = ""
+ result += "*/"
+ return result
+
+def is_threading_header_unsafe_to_include(h):
+ # NOTE: "<mutex>" does not blow up when included without threads.
+ return h in ['atomic', 'shared_mutex']
+
+def produce_tests():
+ headers = set([h for tc in feature_test_macros for h in tc["headers"]])
+ for h in headers:
+ test_list = [tc for tc in feature_test_macros if h in tc["headers"]]
+ if not has_header(h):
+ for tc in test_list:
+ assert 'unimplemented' in tc.keys()
+ continue
+ test_tags = ""
+ if is_threading_header_unsafe_to_include(h):
+ test_tags += '\n// UNSUPPORTED: libcpp-has-no-threads\n'
+ test_body = \
+"""//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+//
+// WARNING: This test was generated by {script_name}
+// and should not be edited manually.
+{test_tags}
+// <{header}>
+
+// Test the feature test macros defined by <{header}>
+
+{synopsis}
+
+#include <{header}>
+#include "test_macros.h"
+
+#if TEST_STD_VER < 14
+
+{cxx11_tests}
+
+#elif TEST_STD_VER == 14
+
+{cxx14_tests}
+
+#elif TEST_STD_VER == 17
+
+{cxx17_tests}
+
+#elif TEST_STD_VER > 17
+
+{cxx2a_tests}
+
+#endif // TEST_STD_VER > 17
+
+int main() {{}}
+""".format(script_name=script_name,
+ header=h,
+ test_tags=test_tags,
+ synopsis=generate_synopsis(test_list),
+ cxx11_tests=generate_std_test(test_list, 'c++11').strip(),
+ cxx14_tests=generate_std_test(test_list, 'c++14').strip(),
+ cxx17_tests=generate_std_test(test_list, 'c++17').strip(),
+ cxx2a_tests=generate_std_test(test_list, 'c++2a').strip())
+ test_name = "{header}.version.pass.cpp".format(header=h)
+ out_path = os.path.join(script_path, test_name)
+ with open(out_path, 'w') as f:
+ f.write(test_body)
+
+"""
+ Produce documentation for the feature test macros
+"""
+
+def make_widths(grid):
+ widths = []
+ for i in range(0, len(grid[0])):
+ cell_width = 2 + max(reduce(lambda x,y: x+y, [[len(row[i])] for row in grid], []))
+ widths += [cell_width]
+ return widths
+
+def create_table(grid, indent):
+ indent_str = ' '*indent
+ col_widths = make_widths(grid)
+ num_cols = len(grid[0])
+ result = indent_str + add_divider(col_widths, 2)
+ header_flag = 2
+ for row_i in xrange(0, len(grid)):
+ row = grid[row_i]
+ result = result + indent_str + ' '.join([pad_cell(row[i], col_widths[i]) for i in range(0, len(row))]) + '\n'
+ is_cxx_header = row[0].startswith('**')
+ if row_i == len(grid) - 1:
+ header_flag = 2
+ result = result + indent_str + add_divider(col_widths, 1 if is_cxx_header else header_flag)
+ header_flag = 0
+ return result
+
+def add_divider(widths, header_flag):
+ if header_flag == 2:
+ return ' '.join(['='*w for w in widths]) + '\n'
+ if header_flag == 1:
+ return '-'.join(['-'*w for w in widths]) + '\n'
+ else:
+ return ' '.join(['-'*w for w in widths]) + '\n'
+
+def pad_cell(s, length, left_align=True):
+ padding = ((length - len(s)) * ' ')
+ return s + padding
+
+
+def get_status_table():
+ table = [["Macro Name", "Value"]]
+ for std in get_std_dialects():
+ table += [["**" + std.replace("c++", "C++ ") + "**", ""]]
+ for tc in feature_test_macros:
+ if std not in tc["values"].keys():
+ continue
+ value = "``%sL``" % tc["values"][std]
+ if 'unimplemented' in tc.keys():
+ value = '*unimplemented*'
+ table += [["``%s``" % tc["name"], value]]
+ return table
+
+def produce_docs():
+ doc_str = """.. _FeatureTestMacroTable:
+
+==========================
+Feature Test Macro Support
+==========================
+
+.. contents::
+ :local:
+
+Overview
+========
+
+This file documents the feature test macros currently supported by libc++.
+
+.. _feature-status:
+
+Status
+======
+
+.. table:: Current Status
+ :name: feature-status-table
+ :widths: auto
+
+{status_tables}
+
+""".format(status_tables=create_table(get_status_table(), 4))
+
+ table_doc_path = os.path.join(docs_path, 'FeatureTestMacroTable.rst')
+ with open(table_doc_path, 'w') as f:
+ f.write(doc_str)
+
+def main():
+ with tempfile.NamedTemporaryFile(mode='w', prefix='version.', delete=False) as tmp_file:
+ print("producing new <version> header as %s" % tmp_file.name)
+ tmp_file.write(produce_version_header())
+ produce_tests()
+ produce_docs()
+
+
+if __name__ == '__main__':
+ main()
diff --git a/test/std/language.support/support.limits/support.limits.general/iomanip.version.pass.cpp b/test/std/language.support/support.limits/support.limits.general/iomanip.version.pass.cpp
new file mode 100644
index 0000000000000..ef2e058265cc6
--- /dev/null
+++ b/test/std/language.support/support.limits/support.limits.general/iomanip.version.pass.cpp
@@ -0,0 +1,59 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+//
+// WARNING: This test was generated by generate_feature_test_macro_components.py
+// and should not be edited manually.
+
+// <iomanip>
+
+// Test the feature test macros defined by <iomanip>
+
+/* Constant Value
+ __cpp_lib_quoted_string_io 201304L [C++14]
+*/
+
+#include <iomanip>
+#include "test_macros.h"
+
+#if TEST_STD_VER < 14
+
+# ifdef __cpp_lib_quoted_string_io
+# error "__cpp_lib_quoted_string_io should not be defined before c++14"
+# endif
+
+#elif TEST_STD_VER == 14
+
+# ifndef __cpp_lib_quoted_string_io
+# error "__cpp_lib_quoted_string_io should be defined in c++14"
+# endif
+# if __cpp_lib_quoted_string_io != 201304L
+# error "__cpp_lib_quoted_string_io should have the value 201304L in c++14"
+# endif
+
+#elif TEST_STD_VER == 17
+
+# ifndef __cpp_lib_quoted_string_io
+# error "__cpp_lib_quoted_string_io should be defined in c++17"
+# endif
+# if __cpp_lib_quoted_string_io != 201304L
+# error "__cpp_lib_quoted_string_io should have the value 201304L in c++17"
+# endif
+
+#elif TEST_STD_VER > 17
+
+# ifndef __cpp_lib_quoted_string_io
+# error "__cpp_lib_quoted_string_io should be defined in c++2a"
+# endif
+# if __cpp_lib_quoted_string_io != 201304L
+# error "__cpp_lib_quoted_string_io should have the value 201304L in c++2a"
+# endif
+
+#endif // TEST_STD_VER > 17
+
+int main() {}
diff --git a/test/std/language.support/support.limits/support.limits.general/istream.version.pass.cpp b/test/std/language.support/support.limits/support.limits.general/istream.version.pass.cpp
new file mode 100644
index 0000000000000..77eec86cf7c8a
--- /dev/null
+++ b/test/std/language.support/support.limits/support.limits.general/istream.version.pass.cpp
@@ -0,0 +1,59 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+//
+// WARNING: This test was generated by generate_feature_test_macro_components.py
+// and should not be edited manually.
+
+// <istream>
+
+// Test the feature test macros defined by <istream>
+
+/* Constant Value
+ __cpp_lib_char8_t 201811L [C++2a]
+*/
+
+#include <istream>
+#include "test_macros.h"
+
+#if TEST_STD_VER < 14
+
+# ifdef __cpp_lib_char8_t
+# error "__cpp_lib_char8_t should not be defined before c++2a"
+# endif
+
+#elif TEST_STD_VER == 14
+
+# ifdef __cpp_lib_char8_t
+# error "__cpp_lib_char8_t should not be defined before c++2a"
+# endif
+
+#elif TEST_STD_VER == 17
+
+# ifdef __cpp_lib_char8_t
+# error "__cpp_lib_char8_t should not be defined before c++2a"
+# endif
+
+#elif TEST_STD_VER > 17
+
+# if defined(__cpp_char8_t)
+# ifndef __cpp_lib_char8_t
+# error "__cpp_lib_char8_t should be defined in c++2a"
+# endif
+# if __cpp_lib_char8_t != 201811L
+# error "__cpp_lib_char8_t should have the value 201811L in c++2a"
+# endif
+# else
+# ifdef __cpp_lib_char8_t
+# error "__cpp_lib_char8_t should not be defined when defined(__cpp_char8_t) is not defined!"
+# endif
+# endif
+
+#endif // TEST_STD_VER > 17
+
+int main() {}
diff --git a/test/std/language.support/support.limits/support.limits.general/iterator.version.pass.cpp b/test/std/language.support/support.limits/support.limits.general/iterator.version.pass.cpp
new file mode 100644
index 0000000000000..7312c4de7b846
--- /dev/null
+++ b/test/std/language.support/support.limits/support.limits.general/iterator.version.pass.cpp
@@ -0,0 +1,183 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+//
+// WARNING: This test was generated by generate_feature_test_macro_components.py
+// and should not be edited manually.
+
+// <iterator>
+
+// Test the feature test macros defined by <iterator>
+
+/* Constant Value
+ __cpp_lib_array_constexpr 201603L [C++17]
+ __cpp_lib_constexpr_misc 201811L [C++2a]
+ __cpp_lib_make_reverse_iterator 201402L [C++14]
+ __cpp_lib_nonmember_container_access 201411L [C++17]
+ __cpp_lib_null_iterators 201304L [C++14]
+ __cpp_lib_ranges 201811L [C++2a]
+*/
+
+#include <iterator>
+#include "test_macros.h"
+
+#if TEST_STD_VER < 14
+
+# ifdef __cpp_lib_array_constexpr
+# error "__cpp_lib_array_constexpr should not be defined before c++17"
+# endif
+
+# ifdef __cpp_lib_constexpr_misc
+# error "__cpp_lib_constexpr_misc should not be defined before c++2a"
+# endif
+
+# ifdef __cpp_lib_make_reverse_iterator
+# error "__cpp_lib_make_reverse_iterator should not be defined before c++14"
+# endif
+
+# ifdef __cpp_lib_nonmember_container_access
+# error "__cpp_lib_nonmember_container_access should not be defined before c++17"
+# endif
+
+# ifdef __cpp_lib_null_iterators
+# error "__cpp_lib_null_iterators should not be defined before c++14"
+# endif
+
+# ifdef __cpp_lib_ranges
+# error "__cpp_lib_ranges should not be defined before c++2a"
+# endif
+
+#elif TEST_STD_VER == 14
+
+# ifdef __cpp_lib_array_constexpr
+# error "__cpp_lib_array_constexpr should not be defined before c++17"
+# endif
+
+# ifdef __cpp_lib_constexpr_misc
+# error "__cpp_lib_constexpr_misc should not be defined before c++2a"
+# endif
+
+# ifndef __cpp_lib_make_reverse_iterator
+# error "__cpp_lib_make_reverse_iterator should be defined in c++14"
+# endif
+# if __cpp_lib_make_reverse_iterator != 201402L
+# error "__cpp_lib_make_reverse_iterator should have the value 201402L in c++14"
+# endif
+
+# ifdef __cpp_lib_nonmember_container_access
+# error "__cpp_lib_nonmember_container_access should not be defined before c++17"
+# endif
+
+# ifndef __cpp_lib_null_iterators
+# error "__cpp_lib_null_iterators should be defined in c++14"
+# endif
+# if __cpp_lib_null_iterators != 201304L
+# error "__cpp_lib_null_iterators should have the value 201304L in c++14"
+# endif
+
+# ifdef __cpp_lib_ranges
+# error "__cpp_lib_ranges should not be defined before c++2a"
+# endif
+
+#elif TEST_STD_VER == 17
+
+# ifndef __cpp_lib_array_constexpr
+# error "__cpp_lib_array_constexpr should be defined in c++17"
+# endif
+# if __cpp_lib_array_constexpr != 201603L
+# error "__cpp_lib_array_constexpr should have the value 201603L in c++17"
+# endif
+
+# ifdef __cpp_lib_constexpr_misc
+# error "__cpp_lib_constexpr_misc should not be defined before c++2a"
+# endif
+
+# ifndef __cpp_lib_make_reverse_iterator
+# error "__cpp_lib_make_reverse_iterator should be defined in c++17"
+# endif
+# if __cpp_lib_make_reverse_iterator != 201402L
+# error "__cpp_lib_make_reverse_iterator should have the value 201402L in c++17"
+# endif
+
+# ifndef __cpp_lib_nonmember_container_access
+# error "__cpp_lib_nonmember_container_access should be defined in c++17"
+# endif
+# if __cpp_lib_nonmember_container_access != 201411L
+# error "__cpp_lib_nonmember_container_access should have the value 201411L in c++17"
+# endif
+
+# ifndef __cpp_lib_null_iterators
+# error "__cpp_lib_null_iterators should be defined in c++17"
+# endif
+# if __cpp_lib_null_iterators != 201304L
+# error "__cpp_lib_null_iterators should have the value 201304L in c++17"
+# endif
+
+# ifdef __cpp_lib_ranges
+# error "__cpp_lib_ranges should not be defined before c++2a"
+# endif
+
+#elif TEST_STD_VER > 17
+
+# ifndef __cpp_lib_array_constexpr
+# error "__cpp_lib_array_constexpr should be defined in c++2a"
+# endif
+# if __cpp_lib_array_constexpr != 201603L
+# error "__cpp_lib_array_constexpr should have the value 201603L in c++2a"
+# endif
+
+# if !defined(_LIBCPP_VERSION)
+# ifndef __cpp_lib_constexpr_misc
+# error "__cpp_lib_constexpr_misc should be defined in c++2a"
+# endif
+# if __cpp_lib_constexpr_misc != 201811L
+# error "__cpp_lib_constexpr_misc should have the value 201811L in c++2a"
+# endif
+# else // _LIBCPP_VERSION
+# ifdef __cpp_lib_constexpr_misc
+# error "__cpp_lib_constexpr_misc should not be defined because it is unimplemented in libc++!"
+# endif
+# endif
+
+# ifndef __cpp_lib_make_reverse_iterator
+# error "__cpp_lib_make_reverse_iterator should be defined in c++2a"
+# endif
+# if __cpp_lib_make_reverse_iterator != 201402L
+# error "__cpp_lib_make_reverse_iterator should have the value 201402L in c++2a"
+# endif
+
+# ifndef __cpp_lib_nonmember_container_access
+# error "__cpp_lib_nonmember_container_access should be defined in c++2a"
+# endif
+# if __cpp_lib_nonmember_container_access != 201411L
+# error "__cpp_lib_nonmember_container_access should have the value 201411L in c++2a"
+# endif
+
+# ifndef __cpp_lib_null_iterators
+# error "__cpp_lib_null_iterators should be defined in c++2a"
+# endif
+# if __cpp_lib_null_iterators != 201304L
+# error "__cpp_lib_null_iterators should have the value 201304L in c++2a"
+# endif
+
+# if !defined(_LIBCPP_VERSION)
+# ifndef __cpp_lib_ranges
+# error "__cpp_lib_ranges should be defined in c++2a"
+# endif
+# if __cpp_lib_ranges != 201811L
+# error "__cpp_lib_ranges should have the value 201811L in c++2a"
+# endif
+# else // _LIBCPP_VERSION
+# ifdef __cpp_lib_ranges
+# error "__cpp_lib_ranges should not be defined because it is unimplemented in libc++!"
+# endif
+# endif
+
+#endif // TEST_STD_VER > 17
+
+int main() {}
diff --git a/test/std/language.support/support.limits/support.limits.general/limits.version.pass.cpp b/test/std/language.support/support.limits/support.limits.general/limits.version.pass.cpp
new file mode 100644
index 0000000000000..e63df4ff5230c
--- /dev/null
+++ b/test/std/language.support/support.limits/support.limits.general/limits.version.pass.cpp
@@ -0,0 +1,59 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+//
+// WARNING: This test was generated by generate_feature_test_macro_components.py
+// and should not be edited manually.
+
+// <limits>
+
+// Test the feature test macros defined by <limits>
+
+/* Constant Value
+ __cpp_lib_char8_t 201811L [C++2a]
+*/
+
+#include <limits>
+#include "test_macros.h"
+
+#if TEST_STD_VER < 14
+
+# ifdef __cpp_lib_char8_t
+# error "__cpp_lib_char8_t should not be defined before c++2a"
+# endif
+
+#elif TEST_STD_VER == 14
+
+# ifdef __cpp_lib_char8_t
+# error "__cpp_lib_char8_t should not be defined before c++2a"
+# endif
+
+#elif TEST_STD_VER == 17
+
+# ifdef __cpp_lib_char8_t
+# error "__cpp_lib_char8_t should not be defined before c++2a"
+# endif
+
+#elif TEST_STD_VER > 17
+
+# if defined(__cpp_char8_t)
+# ifndef __cpp_lib_char8_t
+# error "__cpp_lib_char8_t should be defined in c++2a"
+# endif
+# if __cpp_lib_char8_t != 201811L
+# error "__cpp_lib_char8_t should have the value 201811L in c++2a"
+# endif
+# else
+# ifdef __cpp_lib_char8_t
+# error "__cpp_lib_char8_t should not be defined when defined(__cpp_char8_t) is not defined!"
+# endif
+# endif
+
+#endif // TEST_STD_VER > 17
+
+int main() {}
diff --git a/test/std/language.support/support.limits/support.limits.general/list.version.pass.cpp b/test/std/language.support/support.limits/support.limits.general/list.version.pass.cpp
new file mode 100644
index 0000000000000..cf087259fc8a5
--- /dev/null
+++ b/test/std/language.support/support.limits/support.limits.general/list.version.pass.cpp
@@ -0,0 +1,148 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+//
+// WARNING: This test was generated by generate_feature_test_macro_components.py
+// and should not be edited manually.
+
+// <list>
+
+// Test the feature test macros defined by <list>
+
+/* Constant Value
+ __cpp_lib_allocator_traits_is_always_equal 201411L [C++17]
+ __cpp_lib_erase_if 201811L [C++2a]
+ __cpp_lib_incomplete_container_elements 201505L [C++17]
+ __cpp_lib_list_remove_return_type 201806L [C++2a]
+ __cpp_lib_nonmember_container_access 201411L [C++17]
+*/
+
+#include <list>
+#include "test_macros.h"
+
+#if TEST_STD_VER < 14
+
+# ifdef __cpp_lib_allocator_traits_is_always_equal
+# error "__cpp_lib_allocator_traits_is_always_equal should not be defined before c++17"
+# endif
+
+# ifdef __cpp_lib_erase_if
+# error "__cpp_lib_erase_if should not be defined before c++2a"
+# endif
+
+# ifdef __cpp_lib_incomplete_container_elements
+# error "__cpp_lib_incomplete_container_elements should not be defined before c++17"
+# endif
+
+# ifdef __cpp_lib_list_remove_return_type
+# error "__cpp_lib_list_remove_return_type should not be defined before c++2a"
+# endif
+
+# ifdef __cpp_lib_nonmember_container_access
+# error "__cpp_lib_nonmember_container_access should not be defined before c++17"
+# endif
+
+#elif TEST_STD_VER == 14
+
+# ifdef __cpp_lib_allocator_traits_is_always_equal
+# error "__cpp_lib_allocator_traits_is_always_equal should not be defined before c++17"
+# endif
+
+# ifdef __cpp_lib_erase_if
+# error "__cpp_lib_erase_if should not be defined before c++2a"
+# endif
+
+# ifdef __cpp_lib_incomplete_container_elements
+# error "__cpp_lib_incomplete_container_elements should not be defined before c++17"
+# endif
+
+# ifdef __cpp_lib_list_remove_return_type
+# error "__cpp_lib_list_remove_return_type should not be defined before c++2a"
+# endif
+
+# ifdef __cpp_lib_nonmember_container_access
+# error "__cpp_lib_nonmember_container_access should not be defined before c++17"
+# endif
+
+#elif TEST_STD_VER == 17
+
+# ifndef __cpp_lib_allocator_traits_is_always_equal
+# error "__cpp_lib_allocator_traits_is_always_equal should be defined in c++17"
+# endif
+# if __cpp_lib_allocator_traits_is_always_equal != 201411L
+# error "__cpp_lib_allocator_traits_is_always_equal should have the value 201411L in c++17"
+# endif
+
+# ifdef __cpp_lib_erase_if
+# error "__cpp_lib_erase_if should not be defined before c++2a"
+# endif
+
+# ifndef __cpp_lib_incomplete_container_elements
+# error "__cpp_lib_incomplete_container_elements should be defined in c++17"
+# endif
+# if __cpp_lib_incomplete_container_elements != 201505L
+# error "__cpp_lib_incomplete_container_elements should have the value 201505L in c++17"
+# endif
+
+# ifdef __cpp_lib_list_remove_return_type
+# error "__cpp_lib_list_remove_return_type should not be defined before c++2a"
+# endif
+
+# ifndef __cpp_lib_nonmember_container_access
+# error "__cpp_lib_nonmember_container_access should be defined in c++17"
+# endif
+# if __cpp_lib_nonmember_container_access != 201411L
+# error "__cpp_lib_nonmember_container_access should have the value 201411L in c++17"
+# endif
+
+#elif TEST_STD_VER > 17
+
+# ifndef __cpp_lib_allocator_traits_is_always_equal
+# error "__cpp_lib_allocator_traits_is_always_equal should be defined in c++2a"
+# endif
+# if __cpp_lib_allocator_traits_is_always_equal != 201411L
+# error "__cpp_lib_allocator_traits_is_always_equal should have the value 201411L in c++2a"
+# endif
+
+# ifndef __cpp_lib_erase_if
+# error "__cpp_lib_erase_if should be defined in c++2a"
+# endif
+# if __cpp_lib_erase_if != 201811L
+# error "__cpp_lib_erase_if should have the value 201811L in c++2a"
+# endif
+
+# ifndef __cpp_lib_incomplete_container_elements
+# error "__cpp_lib_incomplete_container_elements should be defined in c++2a"
+# endif
+# if __cpp_lib_incomplete_container_elements != 201505L
+# error "__cpp_lib_incomplete_container_elements should have the value 201505L in c++2a"
+# endif
+
+# if !defined(_LIBCPP_VERSION)
+# ifndef __cpp_lib_list_remove_return_type
+# error "__cpp_lib_list_remove_return_type should be defined in c++2a"
+# endif
+# if __cpp_lib_list_remove_return_type != 201806L
+# error "__cpp_lib_list_remove_return_type should have the value 201806L in c++2a"
+# endif
+# else // _LIBCPP_VERSION
+# ifdef __cpp_lib_list_remove_return_type
+# error "__cpp_lib_list_remove_return_type should not be defined because it is unimplemented in libc++!"
+# endif
+# endif
+
+# ifndef __cpp_lib_nonmember_container_access
+# error "__cpp_lib_nonmember_container_access should be defined in c++2a"
+# endif
+# if __cpp_lib_nonmember_container_access != 201411L
+# error "__cpp_lib_nonmember_container_access should have the value 201411L in c++2a"
+# endif
+
+#endif // TEST_STD_VER > 17
+
+int main() {}
diff --git a/test/std/language.support/support.limits/support.limits.general/locale.version.pass.cpp b/test/std/language.support/support.limits/support.limits.general/locale.version.pass.cpp
new file mode 100644
index 0000000000000..352d7363725ec
--- /dev/null
+++ b/test/std/language.support/support.limits/support.limits.general/locale.version.pass.cpp
@@ -0,0 +1,59 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+//
+// WARNING: This test was generated by generate_feature_test_macro_components.py
+// and should not be edited manually.
+
+// <locale>
+
+// Test the feature test macros defined by <locale>
+
+/* Constant Value
+ __cpp_lib_char8_t 201811L [C++2a]
+*/
+
+#include <locale>
+#include "test_macros.h"
+
+#if TEST_STD_VER < 14
+
+# ifdef __cpp_lib_char8_t
+# error "__cpp_lib_char8_t should not be defined before c++2a"
+# endif
+
+#elif TEST_STD_VER == 14
+
+# ifdef __cpp_lib_char8_t
+# error "__cpp_lib_char8_t should not be defined before c++2a"
+# endif
+
+#elif TEST_STD_VER == 17
+
+# ifdef __cpp_lib_char8_t
+# error "__cpp_lib_char8_t should not be defined before c++2a"
+# endif
+
+#elif TEST_STD_VER > 17
+
+# if defined(__cpp_char8_t)
+# ifndef __cpp_lib_char8_t
+# error "__cpp_lib_char8_t should be defined in c++2a"
+# endif
+# if __cpp_lib_char8_t != 201811L
+# error "__cpp_lib_char8_t should have the value 201811L in c++2a"
+# endif
+# else
+# ifdef __cpp_lib_char8_t
+# error "__cpp_lib_char8_t should not be defined when defined(__cpp_char8_t) is not defined!"
+# endif
+# endif
+
+#endif // TEST_STD_VER > 17
+
+int main() {}
diff --git a/test/std/language.support/support.limits/support.limits.general/map.version.pass.cpp b/test/std/language.support/support.limits/support.limits.general/map.version.pass.cpp
new file mode 100644
index 0000000000000..a98bc28c89cbf
--- /dev/null
+++ b/test/std/language.support/support.limits/support.limits.general/map.version.pass.cpp
@@ -0,0 +1,171 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+//
+// WARNING: This test was generated by generate_feature_test_macro_components.py
+// and should not be edited manually.
+
+// <map>
+
+// Test the feature test macros defined by <map>
+
+/* Constant Value
+ __cpp_lib_allocator_traits_is_always_equal 201411L [C++17]
+ __cpp_lib_erase_if 201811L [C++2a]
+ __cpp_lib_generic_associative_lookup 201304L [C++14]
+ __cpp_lib_map_try_emplace 201411L [C++17]
+ __cpp_lib_node_extract 201606L [C++17]
+ __cpp_lib_nonmember_container_access 201411L [C++17]
+*/
+
+#include <map>
+#include "test_macros.h"
+
+#if TEST_STD_VER < 14
+
+# ifdef __cpp_lib_allocator_traits_is_always_equal
+# error "__cpp_lib_allocator_traits_is_always_equal should not be defined before c++17"
+# endif
+
+# ifdef __cpp_lib_erase_if
+# error "__cpp_lib_erase_if should not be defined before c++2a"
+# endif
+
+# ifdef __cpp_lib_generic_associative_lookup
+# error "__cpp_lib_generic_associative_lookup should not be defined before c++14"
+# endif
+
+# ifdef __cpp_lib_map_try_emplace
+# error "__cpp_lib_map_try_emplace should not be defined before c++17"
+# endif
+
+# ifdef __cpp_lib_node_extract
+# error "__cpp_lib_node_extract should not be defined before c++17"
+# endif
+
+# ifdef __cpp_lib_nonmember_container_access
+# error "__cpp_lib_nonmember_container_access should not be defined before c++17"
+# endif
+
+#elif TEST_STD_VER == 14
+
+# ifdef __cpp_lib_allocator_traits_is_always_equal
+# error "__cpp_lib_allocator_traits_is_always_equal should not be defined before c++17"
+# endif
+
+# ifdef __cpp_lib_erase_if
+# error "__cpp_lib_erase_if should not be defined before c++2a"
+# endif
+
+# ifndef __cpp_lib_generic_associative_lookup
+# error "__cpp_lib_generic_associative_lookup should be defined in c++14"
+# endif
+# if __cpp_lib_generic_associative_lookup != 201304L
+# error "__cpp_lib_generic_associative_lookup should have the value 201304L in c++14"
+# endif
+
+# ifdef __cpp_lib_map_try_emplace
+# error "__cpp_lib_map_try_emplace should not be defined before c++17"
+# endif
+
+# ifdef __cpp_lib_node_extract
+# error "__cpp_lib_node_extract should not be defined before c++17"
+# endif
+
+# ifdef __cpp_lib_nonmember_container_access
+# error "__cpp_lib_nonmember_container_access should not be defined before c++17"
+# endif
+
+#elif TEST_STD_VER == 17
+
+# ifndef __cpp_lib_allocator_traits_is_always_equal
+# error "__cpp_lib_allocator_traits_is_always_equal should be defined in c++17"
+# endif
+# if __cpp_lib_allocator_traits_is_always_equal != 201411L
+# error "__cpp_lib_allocator_traits_is_always_equal should have the value 201411L in c++17"
+# endif
+
+# ifdef __cpp_lib_erase_if
+# error "__cpp_lib_erase_if should not be defined before c++2a"
+# endif
+
+# ifndef __cpp_lib_generic_associative_lookup
+# error "__cpp_lib_generic_associative_lookup should be defined in c++17"
+# endif
+# if __cpp_lib_generic_associative_lookup != 201304L
+# error "__cpp_lib_generic_associative_lookup should have the value 201304L in c++17"
+# endif
+
+# ifndef __cpp_lib_map_try_emplace
+# error "__cpp_lib_map_try_emplace should be defined in c++17"
+# endif
+# if __cpp_lib_map_try_emplace != 201411L
+# error "__cpp_lib_map_try_emplace should have the value 201411L in c++17"
+# endif
+
+# ifndef __cpp_lib_node_extract
+# error "__cpp_lib_node_extract should be defined in c++17"
+# endif
+# if __cpp_lib_node_extract != 201606L
+# error "__cpp_lib_node_extract should have the value 201606L in c++17"
+# endif
+
+# ifndef __cpp_lib_nonmember_container_access
+# error "__cpp_lib_nonmember_container_access should be defined in c++17"
+# endif
+# if __cpp_lib_nonmember_container_access != 201411L
+# error "__cpp_lib_nonmember_container_access should have the value 201411L in c++17"
+# endif
+
+#elif TEST_STD_VER > 17
+
+# ifndef __cpp_lib_allocator_traits_is_always_equal
+# error "__cpp_lib_allocator_traits_is_always_equal should be defined in c++2a"
+# endif
+# if __cpp_lib_allocator_traits_is_always_equal != 201411L
+# error "__cpp_lib_allocator_traits_is_always_equal should have the value 201411L in c++2a"
+# endif
+
+# ifndef __cpp_lib_erase_if
+# error "__cpp_lib_erase_if should be defined in c++2a"
+# endif
+# if __cpp_lib_erase_if != 201811L
+# error "__cpp_lib_erase_if should have the value 201811L in c++2a"
+# endif
+
+# ifndef __cpp_lib_generic_associative_lookup
+# error "__cpp_lib_generic_associative_lookup should be defined in c++2a"
+# endif
+# if __cpp_lib_generic_associative_lookup != 201304L
+# error "__cpp_lib_generic_associative_lookup should have the value 201304L in c++2a"
+# endif
+
+# ifndef __cpp_lib_map_try_emplace
+# error "__cpp_lib_map_try_emplace should be defined in c++2a"
+# endif
+# if __cpp_lib_map_try_emplace != 201411L
+# error "__cpp_lib_map_try_emplace should have the value 201411L in c++2a"
+# endif
+
+# ifndef __cpp_lib_node_extract
+# error "__cpp_lib_node_extract should be defined in c++2a"
+# endif
+# if __cpp_lib_node_extract != 201606L
+# error "__cpp_lib_node_extract should have the value 201606L in c++2a"
+# endif
+
+# ifndef __cpp_lib_nonmember_container_access
+# error "__cpp_lib_nonmember_container_access should be defined in c++2a"
+# endif
+# if __cpp_lib_nonmember_container_access != 201411L
+# error "__cpp_lib_nonmember_container_access should have the value 201411L in c++2a"
+# endif
+
+#endif // TEST_STD_VER > 17
+
+int main() {}
diff --git a/test/std/language.support/support.limits/support.limits.general/memory.version.pass.cpp b/test/std/language.support/support.limits/support.limits.general/memory.version.pass.cpp
new file mode 100644
index 0000000000000..1d8cb9005e4b8
--- /dev/null
+++ b/test/std/language.support/support.limits/support.limits.general/memory.version.pass.cpp
@@ -0,0 +1,247 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+//
+// WARNING: This test was generated by generate_feature_test_macro_components.py
+// and should not be edited manually.
+
+// <memory>
+
+// Test the feature test macros defined by <memory>
+
+/* Constant Value
+ __cpp_lib_addressof_constexpr 201603L [C++17]
+ __cpp_lib_allocator_traits_is_always_equal 201411L [C++17]
+ __cpp_lib_enable_shared_from_this 201603L [C++17]
+ __cpp_lib_make_unique 201304L [C++14]
+ __cpp_lib_ranges 201811L [C++2a]
+ __cpp_lib_raw_memory_algorithms 201606L [C++17]
+ __cpp_lib_shared_ptr_arrays 201611L [C++17]
+ __cpp_lib_shared_ptr_weak_type 201606L [C++17]
+*/
+
+#include <memory>
+#include "test_macros.h"
+
+#if TEST_STD_VER < 14
+
+# ifdef __cpp_lib_addressof_constexpr
+# error "__cpp_lib_addressof_constexpr should not be defined before c++17"
+# endif
+
+# ifdef __cpp_lib_allocator_traits_is_always_equal
+# error "__cpp_lib_allocator_traits_is_always_equal should not be defined before c++17"
+# endif
+
+# ifdef __cpp_lib_enable_shared_from_this
+# error "__cpp_lib_enable_shared_from_this should not be defined before c++17"
+# endif
+
+# ifdef __cpp_lib_make_unique
+# error "__cpp_lib_make_unique should not be defined before c++14"
+# endif
+
+# ifdef __cpp_lib_ranges
+# error "__cpp_lib_ranges should not be defined before c++2a"
+# endif
+
+# ifdef __cpp_lib_raw_memory_algorithms
+# error "__cpp_lib_raw_memory_algorithms should not be defined before c++17"
+# endif
+
+# ifdef __cpp_lib_shared_ptr_arrays
+# error "__cpp_lib_shared_ptr_arrays should not be defined before c++17"
+# endif
+
+# ifdef __cpp_lib_shared_ptr_weak_type
+# error "__cpp_lib_shared_ptr_weak_type should not be defined before c++17"
+# endif
+
+#elif TEST_STD_VER == 14
+
+# ifdef __cpp_lib_addressof_constexpr
+# error "__cpp_lib_addressof_constexpr should not be defined before c++17"
+# endif
+
+# ifdef __cpp_lib_allocator_traits_is_always_equal
+# error "__cpp_lib_allocator_traits_is_always_equal should not be defined before c++17"
+# endif
+
+# ifdef __cpp_lib_enable_shared_from_this
+# error "__cpp_lib_enable_shared_from_this should not be defined before c++17"
+# endif
+
+# ifndef __cpp_lib_make_unique
+# error "__cpp_lib_make_unique should be defined in c++14"
+# endif
+# if __cpp_lib_make_unique != 201304L
+# error "__cpp_lib_make_unique should have the value 201304L in c++14"
+# endif
+
+# ifdef __cpp_lib_ranges
+# error "__cpp_lib_ranges should not be defined before c++2a"
+# endif
+
+# ifdef __cpp_lib_raw_memory_algorithms
+# error "__cpp_lib_raw_memory_algorithms should not be defined before c++17"
+# endif
+
+# ifdef __cpp_lib_shared_ptr_arrays
+# error "__cpp_lib_shared_ptr_arrays should not be defined before c++17"
+# endif
+
+# ifdef __cpp_lib_shared_ptr_weak_type
+# error "__cpp_lib_shared_ptr_weak_type should not be defined before c++17"
+# endif
+
+#elif TEST_STD_VER == 17
+
+# if TEST_HAS_BUILTIN(__builtin_addressof) || TEST_GCC_VER >= 700
+# ifndef __cpp_lib_addressof_constexpr
+# error "__cpp_lib_addressof_constexpr should be defined in c++17"
+# endif
+# if __cpp_lib_addressof_constexpr != 201603L
+# error "__cpp_lib_addressof_constexpr should have the value 201603L in c++17"
+# endif
+# else
+# ifdef __cpp_lib_addressof_constexpr
+# error "__cpp_lib_addressof_constexpr should not be defined when TEST_HAS_BUILTIN(__builtin_addressof) || TEST_GCC_VER >= 700 is not defined!"
+# endif
+# endif
+
+# ifndef __cpp_lib_allocator_traits_is_always_equal
+# error "__cpp_lib_allocator_traits_is_always_equal should be defined in c++17"
+# endif
+# if __cpp_lib_allocator_traits_is_always_equal != 201411L
+# error "__cpp_lib_allocator_traits_is_always_equal should have the value 201411L in c++17"
+# endif
+
+# ifndef __cpp_lib_enable_shared_from_this
+# error "__cpp_lib_enable_shared_from_this should be defined in c++17"
+# endif
+# if __cpp_lib_enable_shared_from_this != 201603L
+# error "__cpp_lib_enable_shared_from_this should have the value 201603L in c++17"
+# endif
+
+# ifndef __cpp_lib_make_unique
+# error "__cpp_lib_make_unique should be defined in c++17"
+# endif
+# if __cpp_lib_make_unique != 201304L
+# error "__cpp_lib_make_unique should have the value 201304L in c++17"
+# endif
+
+# ifdef __cpp_lib_ranges
+# error "__cpp_lib_ranges should not be defined before c++2a"
+# endif
+
+# ifndef __cpp_lib_raw_memory_algorithms
+# error "__cpp_lib_raw_memory_algorithms should be defined in c++17"
+# endif
+# if __cpp_lib_raw_memory_algorithms != 201606L
+# error "__cpp_lib_raw_memory_algorithms should have the value 201606L in c++17"
+# endif
+
+# if !defined(_LIBCPP_VERSION)
+# ifndef __cpp_lib_shared_ptr_arrays
+# error "__cpp_lib_shared_ptr_arrays should be defined in c++17"
+# endif
+# if __cpp_lib_shared_ptr_arrays != 201611L
+# error "__cpp_lib_shared_ptr_arrays should have the value 201611L in c++17"
+# endif
+# else // _LIBCPP_VERSION
+# ifdef __cpp_lib_shared_ptr_arrays
+# error "__cpp_lib_shared_ptr_arrays should not be defined because it is unimplemented in libc++!"
+# endif
+# endif
+
+# ifndef __cpp_lib_shared_ptr_weak_type
+# error "__cpp_lib_shared_ptr_weak_type should be defined in c++17"
+# endif
+# if __cpp_lib_shared_ptr_weak_type != 201606L
+# error "__cpp_lib_shared_ptr_weak_type should have the value 201606L in c++17"
+# endif
+
+#elif TEST_STD_VER > 17
+
+# if TEST_HAS_BUILTIN(__builtin_addressof) || TEST_GCC_VER >= 700
+# ifndef __cpp_lib_addressof_constexpr
+# error "__cpp_lib_addressof_constexpr should be defined in c++2a"
+# endif
+# if __cpp_lib_addressof_constexpr != 201603L
+# error "__cpp_lib_addressof_constexpr should have the value 201603L in c++2a"
+# endif
+# else
+# ifdef __cpp_lib_addressof_constexpr
+# error "__cpp_lib_addressof_constexpr should not be defined when TEST_HAS_BUILTIN(__builtin_addressof) || TEST_GCC_VER >= 700 is not defined!"
+# endif
+# endif
+
+# ifndef __cpp_lib_allocator_traits_is_always_equal
+# error "__cpp_lib_allocator_traits_is_always_equal should be defined in c++2a"
+# endif
+# if __cpp_lib_allocator_traits_is_always_equal != 201411L
+# error "__cpp_lib_allocator_traits_is_always_equal should have the value 201411L in c++2a"
+# endif
+
+# ifndef __cpp_lib_enable_shared_from_this
+# error "__cpp_lib_enable_shared_from_this should be defined in c++2a"
+# endif
+# if __cpp_lib_enable_shared_from_this != 201603L
+# error "__cpp_lib_enable_shared_from_this should have the value 201603L in c++2a"
+# endif
+
+# ifndef __cpp_lib_make_unique
+# error "__cpp_lib_make_unique should be defined in c++2a"
+# endif
+# if __cpp_lib_make_unique != 201304L
+# error "__cpp_lib_make_unique should have the value 201304L in c++2a"
+# endif
+
+# if !defined(_LIBCPP_VERSION)
+# ifndef __cpp_lib_ranges
+# error "__cpp_lib_ranges should be defined in c++2a"
+# endif
+# if __cpp_lib_ranges != 201811L
+# error "__cpp_lib_ranges should have the value 201811L in c++2a"
+# endif
+# else // _LIBCPP_VERSION
+# ifdef __cpp_lib_ranges
+# error "__cpp_lib_ranges should not be defined because it is unimplemented in libc++!"
+# endif
+# endif
+
+# ifndef __cpp_lib_raw_memory_algorithms
+# error "__cpp_lib_raw_memory_algorithms should be defined in c++2a"
+# endif
+# if __cpp_lib_raw_memory_algorithms != 201606L
+# error "__cpp_lib_raw_memory_algorithms should have the value 201606L in c++2a"
+# endif
+
+# if !defined(_LIBCPP_VERSION)
+# ifndef __cpp_lib_shared_ptr_arrays
+# error "__cpp_lib_shared_ptr_arrays should be defined in c++2a"
+# endif
+# if __cpp_lib_shared_ptr_arrays != 201611L
+# error "__cpp_lib_shared_ptr_arrays should have the value 201611L in c++2a"
+# endif
+# else // _LIBCPP_VERSION
+# ifdef __cpp_lib_shared_ptr_arrays
+# error "__cpp_lib_shared_ptr_arrays should not be defined because it is unimplemented in libc++!"
+# endif
+# endif
+
+# ifndef __cpp_lib_shared_ptr_weak_type
+# error "__cpp_lib_shared_ptr_weak_type should be defined in c++2a"
+# endif
+# if __cpp_lib_shared_ptr_weak_type != 201606L
+# error "__cpp_lib_shared_ptr_weak_type should have the value 201606L in c++2a"
+# endif
+
+#endif // TEST_STD_VER > 17
+
+int main() {}
diff --git a/test/std/language.support/support.limits/support.limits.general/memory_resource.version.pass.cpp b/test/std/language.support/support.limits/support.limits.general/memory_resource.version.pass.cpp
new file mode 100644
index 0000000000000..857ece267335e
--- /dev/null
+++ b/test/std/language.support/support.limits/support.limits.general/memory_resource.version.pass.cpp
@@ -0,0 +1,34 @@
+
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+//
+// <memory_resource> feature macros
+
+/* Constant Value
+ __cpp_lib_memory_resource 201603L
+
+*/
+
+// XFAIL
+// #include <memory_resource>
+#include <cassert>
+#include "test_macros.h"
+
+int main()
+{
+// ensure that the macros that are supposed to be defined in <memory_resource> are defined.
+
+/*
+#if !defined(__cpp_lib_fooby)
+# error "__cpp_lib_fooby is not defined"
+#elif __cpp_lib_fooby < 201606L
+# error "__cpp_lib_fooby has an invalid value"
+#endif
+*/
+}
diff --git a/test/std/language.support/support.limits/support.limits.general/mutex.version.pass.cpp b/test/std/language.support/support.limits/support.limits.general/mutex.version.pass.cpp
new file mode 100644
index 0000000000000..04edd597b45e1
--- /dev/null
+++ b/test/std/language.support/support.limits/support.limits.general/mutex.version.pass.cpp
@@ -0,0 +1,56 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+//
+// WARNING: This test was generated by generate_feature_test_macro_components.py
+// and should not be edited manually.
+
+// <mutex>
+
+// Test the feature test macros defined by <mutex>
+
+/* Constant Value
+ __cpp_lib_scoped_lock 201703L [C++17]
+*/
+
+#include <mutex>
+#include "test_macros.h"
+
+#if TEST_STD_VER < 14
+
+# ifdef __cpp_lib_scoped_lock
+# error "__cpp_lib_scoped_lock should not be defined before c++17"
+# endif
+
+#elif TEST_STD_VER == 14
+
+# ifdef __cpp_lib_scoped_lock
+# error "__cpp_lib_scoped_lock should not be defined before c++17"
+# endif
+
+#elif TEST_STD_VER == 17
+
+# ifndef __cpp_lib_scoped_lock
+# error "__cpp_lib_scoped_lock should be defined in c++17"
+# endif
+# if __cpp_lib_scoped_lock != 201703L
+# error "__cpp_lib_scoped_lock should have the value 201703L in c++17"
+# endif
+
+#elif TEST_STD_VER > 17
+
+# ifndef __cpp_lib_scoped_lock
+# error "__cpp_lib_scoped_lock should be defined in c++2a"
+# endif
+# if __cpp_lib_scoped_lock != 201703L
+# error "__cpp_lib_scoped_lock should have the value 201703L in c++2a"
+# endif
+
+#endif // TEST_STD_VER > 17
+
+int main() {}
diff --git a/test/std/language.support/support.limits/support.limits.general/new.version.pass.cpp b/test/std/language.support/support.limits/support.limits.general/new.version.pass.cpp
new file mode 100644
index 0000000000000..e2dd9b774333c
--- /dev/null
+++ b/test/std/language.support/support.limits/support.limits.general/new.version.pass.cpp
@@ -0,0 +1,105 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+//
+// WARNING: This test was generated by generate_feature_test_macro_components.py
+// and should not be edited manually.
+
+// <new>
+
+// Test the feature test macros defined by <new>
+
+/* Constant Value
+ __cpp_lib_destroying_delete 201806L [C++2a]
+ __cpp_lib_hardware_interference_size 201703L [C++17]
+ __cpp_lib_launder 201606L [C++17]
+*/
+
+#include <new>
+#include "test_macros.h"
+
+#if TEST_STD_VER < 14
+
+# ifdef __cpp_lib_destroying_delete
+# error "__cpp_lib_destroying_delete should not be defined before c++2a"
+# endif
+
+# ifdef __cpp_lib_hardware_interference_size
+# error "__cpp_lib_hardware_interference_size should not be defined before c++17"
+# endif
+
+# ifdef __cpp_lib_launder
+# error "__cpp_lib_launder should not be defined before c++17"
+# endif
+
+#elif TEST_STD_VER == 14
+
+# ifdef __cpp_lib_destroying_delete
+# error "__cpp_lib_destroying_delete should not be defined before c++2a"
+# endif
+
+# ifdef __cpp_lib_hardware_interference_size
+# error "__cpp_lib_hardware_interference_size should not be defined before c++17"
+# endif
+
+# ifdef __cpp_lib_launder
+# error "__cpp_lib_launder should not be defined before c++17"
+# endif
+
+#elif TEST_STD_VER == 17
+
+# ifdef __cpp_lib_destroying_delete
+# error "__cpp_lib_destroying_delete should not be defined before c++2a"
+# endif
+
+# ifndef __cpp_lib_hardware_interference_size
+# error "__cpp_lib_hardware_interference_size should be defined in c++17"
+# endif
+# if __cpp_lib_hardware_interference_size != 201703L
+# error "__cpp_lib_hardware_interference_size should have the value 201703L in c++17"
+# endif
+
+# ifndef __cpp_lib_launder
+# error "__cpp_lib_launder should be defined in c++17"
+# endif
+# if __cpp_lib_launder != 201606L
+# error "__cpp_lib_launder should have the value 201606L in c++17"
+# endif
+
+#elif TEST_STD_VER > 17
+
+# if !defined(_LIBCPP_VERSION)
+# ifndef __cpp_lib_destroying_delete
+# error "__cpp_lib_destroying_delete should be defined in c++2a"
+# endif
+# if __cpp_lib_destroying_delete != 201806L
+# error "__cpp_lib_destroying_delete should have the value 201806L in c++2a"
+# endif
+# else // _LIBCPP_VERSION
+# ifdef __cpp_lib_destroying_delete
+# error "__cpp_lib_destroying_delete should not be defined because it is unimplemented in libc++!"
+# endif
+# endif
+
+# ifndef __cpp_lib_hardware_interference_size
+# error "__cpp_lib_hardware_interference_size should be defined in c++2a"
+# endif
+# if __cpp_lib_hardware_interference_size != 201703L
+# error "__cpp_lib_hardware_interference_size should have the value 201703L in c++2a"
+# endif
+
+# ifndef __cpp_lib_launder
+# error "__cpp_lib_launder should be defined in c++2a"
+# endif
+# if __cpp_lib_launder != 201606L
+# error "__cpp_lib_launder should have the value 201606L in c++2a"
+# endif
+
+#endif // TEST_STD_VER > 17
+
+int main() {}
diff --git a/test/std/language.support/support.limits/support.limits.general/numeric.version.pass.cpp b/test/std/language.support/support.limits/support.limits.general/numeric.version.pass.cpp
new file mode 100644
index 0000000000000..83b6207654f8b
--- /dev/null
+++ b/test/std/language.support/support.limits/support.limits.general/numeric.version.pass.cpp
@@ -0,0 +1,91 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+//
+// WARNING: This test was generated by generate_feature_test_macro_components.py
+// and should not be edited manually.
+
+// <numeric>
+
+// Test the feature test macros defined by <numeric>
+
+/* Constant Value
+ __cpp_lib_gcd_lcm 201606L [C++17]
+ __cpp_lib_parallel_algorithm 201603L [C++17]
+*/
+
+#include <numeric>
+#include "test_macros.h"
+
+#if TEST_STD_VER < 14
+
+# ifdef __cpp_lib_gcd_lcm
+# error "__cpp_lib_gcd_lcm should not be defined before c++17"
+# endif
+
+# ifdef __cpp_lib_parallel_algorithm
+# error "__cpp_lib_parallel_algorithm should not be defined before c++17"
+# endif
+
+#elif TEST_STD_VER == 14
+
+# ifdef __cpp_lib_gcd_lcm
+# error "__cpp_lib_gcd_lcm should not be defined before c++17"
+# endif
+
+# ifdef __cpp_lib_parallel_algorithm
+# error "__cpp_lib_parallel_algorithm should not be defined before c++17"
+# endif
+
+#elif TEST_STD_VER == 17
+
+# ifndef __cpp_lib_gcd_lcm
+# error "__cpp_lib_gcd_lcm should be defined in c++17"
+# endif
+# if __cpp_lib_gcd_lcm != 201606L
+# error "__cpp_lib_gcd_lcm should have the value 201606L in c++17"
+# endif
+
+# if !defined(_LIBCPP_VERSION)
+# ifndef __cpp_lib_parallel_algorithm
+# error "__cpp_lib_parallel_algorithm should be defined in c++17"
+# endif
+# if __cpp_lib_parallel_algorithm != 201603L
+# error "__cpp_lib_parallel_algorithm should have the value 201603L in c++17"
+# endif
+# else // _LIBCPP_VERSION
+# ifdef __cpp_lib_parallel_algorithm
+# error "__cpp_lib_parallel_algorithm should not be defined because it is unimplemented in libc++!"
+# endif
+# endif
+
+#elif TEST_STD_VER > 17
+
+# ifndef __cpp_lib_gcd_lcm
+# error "__cpp_lib_gcd_lcm should be defined in c++2a"
+# endif
+# if __cpp_lib_gcd_lcm != 201606L
+# error "__cpp_lib_gcd_lcm should have the value 201606L in c++2a"
+# endif
+
+# if !defined(_LIBCPP_VERSION)
+# ifndef __cpp_lib_parallel_algorithm
+# error "__cpp_lib_parallel_algorithm should be defined in c++2a"
+# endif
+# if __cpp_lib_parallel_algorithm != 201603L
+# error "__cpp_lib_parallel_algorithm should have the value 201603L in c++2a"
+# endif
+# else // _LIBCPP_VERSION
+# ifdef __cpp_lib_parallel_algorithm
+# error "__cpp_lib_parallel_algorithm should not be defined because it is unimplemented in libc++!"
+# endif
+# endif
+
+#endif // TEST_STD_VER > 17
+
+int main() {}
diff --git a/test/std/language.support/support.limits/support.limits.general/optional.version.pass.cpp b/test/std/language.support/support.limits/support.limits.general/optional.version.pass.cpp
new file mode 100644
index 0000000000000..4c9fecd211342
--- /dev/null
+++ b/test/std/language.support/support.limits/support.limits.general/optional.version.pass.cpp
@@ -0,0 +1,56 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+//
+// WARNING: This test was generated by generate_feature_test_macro_components.py
+// and should not be edited manually.
+
+// <optional>
+
+// Test the feature test macros defined by <optional>
+
+/* Constant Value
+ __cpp_lib_optional 201606L [C++17]
+*/
+
+#include <optional>
+#include "test_macros.h"
+
+#if TEST_STD_VER < 14
+
+# ifdef __cpp_lib_optional
+# error "__cpp_lib_optional should not be defined before c++17"
+# endif
+
+#elif TEST_STD_VER == 14
+
+# ifdef __cpp_lib_optional
+# error "__cpp_lib_optional should not be defined before c++17"
+# endif
+
+#elif TEST_STD_VER == 17
+
+# ifndef __cpp_lib_optional
+# error "__cpp_lib_optional should be defined in c++17"
+# endif
+# if __cpp_lib_optional != 201606L
+# error "__cpp_lib_optional should have the value 201606L in c++17"
+# endif
+
+#elif TEST_STD_VER > 17
+
+# ifndef __cpp_lib_optional
+# error "__cpp_lib_optional should be defined in c++2a"
+# endif
+# if __cpp_lib_optional != 201606L
+# error "__cpp_lib_optional should have the value 201606L in c++2a"
+# endif
+
+#endif // TEST_STD_VER > 17
+
+int main() {}
diff --git a/test/std/language.support/support.limits/support.limits.general/ostream.version.pass.cpp b/test/std/language.support/support.limits/support.limits.general/ostream.version.pass.cpp
new file mode 100644
index 0000000000000..1bcf8d55d480d
--- /dev/null
+++ b/test/std/language.support/support.limits/support.limits.general/ostream.version.pass.cpp
@@ -0,0 +1,59 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+//
+// WARNING: This test was generated by generate_feature_test_macro_components.py
+// and should not be edited manually.
+
+// <ostream>
+
+// Test the feature test macros defined by <ostream>
+
+/* Constant Value
+ __cpp_lib_char8_t 201811L [C++2a]
+*/
+
+#include <ostream>
+#include "test_macros.h"
+
+#if TEST_STD_VER < 14
+
+# ifdef __cpp_lib_char8_t
+# error "__cpp_lib_char8_t should not be defined before c++2a"
+# endif
+
+#elif TEST_STD_VER == 14
+
+# ifdef __cpp_lib_char8_t
+# error "__cpp_lib_char8_t should not be defined before c++2a"
+# endif
+
+#elif TEST_STD_VER == 17
+
+# ifdef __cpp_lib_char8_t
+# error "__cpp_lib_char8_t should not be defined before c++2a"
+# endif
+
+#elif TEST_STD_VER > 17
+
+# if defined(__cpp_char8_t)
+# ifndef __cpp_lib_char8_t
+# error "__cpp_lib_char8_t should be defined in c++2a"
+# endif
+# if __cpp_lib_char8_t != 201811L
+# error "__cpp_lib_char8_t should have the value 201811L in c++2a"
+# endif
+# else
+# ifdef __cpp_lib_char8_t
+# error "__cpp_lib_char8_t should not be defined when defined(__cpp_char8_t) is not defined!"
+# endif
+# endif
+
+#endif // TEST_STD_VER > 17
+
+int main() {}
diff --git a/test/std/language.support/support.limits/support.limits.general/regex.version.pass.cpp b/test/std/language.support/support.limits/support.limits.general/regex.version.pass.cpp
new file mode 100644
index 0000000000000..cd07ac06828e7
--- /dev/null
+++ b/test/std/language.support/support.limits/support.limits.general/regex.version.pass.cpp
@@ -0,0 +1,56 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+//
+// WARNING: This test was generated by generate_feature_test_macro_components.py
+// and should not be edited manually.
+
+// <regex>
+
+// Test the feature test macros defined by <regex>
+
+/* Constant Value
+ __cpp_lib_nonmember_container_access 201411L [C++17]
+*/
+
+#include <regex>
+#include "test_macros.h"
+
+#if TEST_STD_VER < 14
+
+# ifdef __cpp_lib_nonmember_container_access
+# error "__cpp_lib_nonmember_container_access should not be defined before c++17"
+# endif
+
+#elif TEST_STD_VER == 14
+
+# ifdef __cpp_lib_nonmember_container_access
+# error "__cpp_lib_nonmember_container_access should not be defined before c++17"
+# endif
+
+#elif TEST_STD_VER == 17
+
+# ifndef __cpp_lib_nonmember_container_access
+# error "__cpp_lib_nonmember_container_access should be defined in c++17"
+# endif
+# if __cpp_lib_nonmember_container_access != 201411L
+# error "__cpp_lib_nonmember_container_access should have the value 201411L in c++17"
+# endif
+
+#elif TEST_STD_VER > 17
+
+# ifndef __cpp_lib_nonmember_container_access
+# error "__cpp_lib_nonmember_container_access should be defined in c++2a"
+# endif
+# if __cpp_lib_nonmember_container_access != 201411L
+# error "__cpp_lib_nonmember_container_access should have the value 201411L in c++2a"
+# endif
+
+#endif // TEST_STD_VER > 17
+
+int main() {}
diff --git a/test/std/language.support/support.limits/support.limits.general/scoped_allocator.version.pass.cpp b/test/std/language.support/support.limits/support.limits.general/scoped_allocator.version.pass.cpp
new file mode 100644
index 0000000000000..4c2f35af95fcf
--- /dev/null
+++ b/test/std/language.support/support.limits/support.limits.general/scoped_allocator.version.pass.cpp
@@ -0,0 +1,56 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+//
+// WARNING: This test was generated by generate_feature_test_macro_components.py
+// and should not be edited manually.
+
+// <scoped_allocator>
+
+// Test the feature test macros defined by <scoped_allocator>
+
+/* Constant Value
+ __cpp_lib_allocator_traits_is_always_equal 201411L [C++17]
+*/
+
+#include <scoped_allocator>
+#include "test_macros.h"
+
+#if TEST_STD_VER < 14
+
+# ifdef __cpp_lib_allocator_traits_is_always_equal
+# error "__cpp_lib_allocator_traits_is_always_equal should not be defined before c++17"
+# endif
+
+#elif TEST_STD_VER == 14
+
+# ifdef __cpp_lib_allocator_traits_is_always_equal
+# error "__cpp_lib_allocator_traits_is_always_equal should not be defined before c++17"
+# endif
+
+#elif TEST_STD_VER == 17
+
+# ifndef __cpp_lib_allocator_traits_is_always_equal
+# error "__cpp_lib_allocator_traits_is_always_equal should be defined in c++17"
+# endif
+# if __cpp_lib_allocator_traits_is_always_equal != 201411L
+# error "__cpp_lib_allocator_traits_is_always_equal should have the value 201411L in c++17"
+# endif
+
+#elif TEST_STD_VER > 17
+
+# ifndef __cpp_lib_allocator_traits_is_always_equal
+# error "__cpp_lib_allocator_traits_is_always_equal should be defined in c++2a"
+# endif
+# if __cpp_lib_allocator_traits_is_always_equal != 201411L
+# error "__cpp_lib_allocator_traits_is_always_equal should have the value 201411L in c++2a"
+# endif
+
+#endif // TEST_STD_VER > 17
+
+int main() {}
diff --git a/test/std/language.support/support.limits/support.limits.general/set.version.pass.cpp b/test/std/language.support/support.limits/support.limits.general/set.version.pass.cpp
new file mode 100644
index 0000000000000..7a4cabde8538a
--- /dev/null
+++ b/test/std/language.support/support.limits/support.limits.general/set.version.pass.cpp
@@ -0,0 +1,148 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+//
+// WARNING: This test was generated by generate_feature_test_macro_components.py
+// and should not be edited manually.
+
+// <set>
+
+// Test the feature test macros defined by <set>
+
+/* Constant Value
+ __cpp_lib_allocator_traits_is_always_equal 201411L [C++17]
+ __cpp_lib_erase_if 201811L [C++2a]
+ __cpp_lib_generic_associative_lookup 201304L [C++14]
+ __cpp_lib_node_extract 201606L [C++17]
+ __cpp_lib_nonmember_container_access 201411L [C++17]
+*/
+
+#include <set>
+#include "test_macros.h"
+
+#if TEST_STD_VER < 14
+
+# ifdef __cpp_lib_allocator_traits_is_always_equal
+# error "__cpp_lib_allocator_traits_is_always_equal should not be defined before c++17"
+# endif
+
+# ifdef __cpp_lib_erase_if
+# error "__cpp_lib_erase_if should not be defined before c++2a"
+# endif
+
+# ifdef __cpp_lib_generic_associative_lookup
+# error "__cpp_lib_generic_associative_lookup should not be defined before c++14"
+# endif
+
+# ifdef __cpp_lib_node_extract
+# error "__cpp_lib_node_extract should not be defined before c++17"
+# endif
+
+# ifdef __cpp_lib_nonmember_container_access
+# error "__cpp_lib_nonmember_container_access should not be defined before c++17"
+# endif
+
+#elif TEST_STD_VER == 14
+
+# ifdef __cpp_lib_allocator_traits_is_always_equal
+# error "__cpp_lib_allocator_traits_is_always_equal should not be defined before c++17"
+# endif
+
+# ifdef __cpp_lib_erase_if
+# error "__cpp_lib_erase_if should not be defined before c++2a"
+# endif
+
+# ifndef __cpp_lib_generic_associative_lookup
+# error "__cpp_lib_generic_associative_lookup should be defined in c++14"
+# endif
+# if __cpp_lib_generic_associative_lookup != 201304L
+# error "__cpp_lib_generic_associative_lookup should have the value 201304L in c++14"
+# endif
+
+# ifdef __cpp_lib_node_extract
+# error "__cpp_lib_node_extract should not be defined before c++17"
+# endif
+
+# ifdef __cpp_lib_nonmember_container_access
+# error "__cpp_lib_nonmember_container_access should not be defined before c++17"
+# endif
+
+#elif TEST_STD_VER == 17
+
+# ifndef __cpp_lib_allocator_traits_is_always_equal
+# error "__cpp_lib_allocator_traits_is_always_equal should be defined in c++17"
+# endif
+# if __cpp_lib_allocator_traits_is_always_equal != 201411L
+# error "__cpp_lib_allocator_traits_is_always_equal should have the value 201411L in c++17"
+# endif
+
+# ifdef __cpp_lib_erase_if
+# error "__cpp_lib_erase_if should not be defined before c++2a"
+# endif
+
+# ifndef __cpp_lib_generic_associative_lookup
+# error "__cpp_lib_generic_associative_lookup should be defined in c++17"
+# endif
+# if __cpp_lib_generic_associative_lookup != 201304L
+# error "__cpp_lib_generic_associative_lookup should have the value 201304L in c++17"
+# endif
+
+# ifndef __cpp_lib_node_extract
+# error "__cpp_lib_node_extract should be defined in c++17"
+# endif
+# if __cpp_lib_node_extract != 201606L
+# error "__cpp_lib_node_extract should have the value 201606L in c++17"
+# endif
+
+# ifndef __cpp_lib_nonmember_container_access
+# error "__cpp_lib_nonmember_container_access should be defined in c++17"
+# endif
+# if __cpp_lib_nonmember_container_access != 201411L
+# error "__cpp_lib_nonmember_container_access should have the value 201411L in c++17"
+# endif
+
+#elif TEST_STD_VER > 17
+
+# ifndef __cpp_lib_allocator_traits_is_always_equal
+# error "__cpp_lib_allocator_traits_is_always_equal should be defined in c++2a"
+# endif
+# if __cpp_lib_allocator_traits_is_always_equal != 201411L
+# error "__cpp_lib_allocator_traits_is_always_equal should have the value 201411L in c++2a"
+# endif
+
+# ifndef __cpp_lib_erase_if
+# error "__cpp_lib_erase_if should be defined in c++2a"
+# endif
+# if __cpp_lib_erase_if != 201811L
+# error "__cpp_lib_erase_if should have the value 201811L in c++2a"
+# endif
+
+# ifndef __cpp_lib_generic_associative_lookup
+# error "__cpp_lib_generic_associative_lookup should be defined in c++2a"
+# endif
+# if __cpp_lib_generic_associative_lookup != 201304L
+# error "__cpp_lib_generic_associative_lookup should have the value 201304L in c++2a"
+# endif
+
+# ifndef __cpp_lib_node_extract
+# error "__cpp_lib_node_extract should be defined in c++2a"
+# endif
+# if __cpp_lib_node_extract != 201606L
+# error "__cpp_lib_node_extract should have the value 201606L in c++2a"
+# endif
+
+# ifndef __cpp_lib_nonmember_container_access
+# error "__cpp_lib_nonmember_container_access should be defined in c++2a"
+# endif
+# if __cpp_lib_nonmember_container_access != 201411L
+# error "__cpp_lib_nonmember_container_access should have the value 201411L in c++2a"
+# endif
+
+#endif // TEST_STD_VER > 17
+
+int main() {}
diff --git a/test/std/language.support/support.limits/support.limits.general/shared_mutex.version.pass.cpp b/test/std/language.support/support.limits/support.limits.general/shared_mutex.version.pass.cpp
new file mode 100644
index 0000000000000..493411ffddeca
--- /dev/null
+++ b/test/std/language.support/support.limits/support.limits.general/shared_mutex.version.pass.cpp
@@ -0,0 +1,114 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+//
+// WARNING: This test was generated by generate_feature_test_macro_components.py
+// and should not be edited manually.
+
+// UNSUPPORTED: libcpp-has-no-threads
+
+// <shared_mutex>
+
+// Test the feature test macros defined by <shared_mutex>
+
+/* Constant Value
+ __cpp_lib_shared_mutex 201505L [C++17]
+ __cpp_lib_shared_timed_mutex 201402L [C++14]
+*/
+
+#include <shared_mutex>
+#include "test_macros.h"
+
+#if TEST_STD_VER < 14
+
+# ifdef __cpp_lib_shared_mutex
+# error "__cpp_lib_shared_mutex should not be defined before c++17"
+# endif
+
+# ifdef __cpp_lib_shared_timed_mutex
+# error "__cpp_lib_shared_timed_mutex should not be defined before c++14"
+# endif
+
+#elif TEST_STD_VER == 14
+
+# ifdef __cpp_lib_shared_mutex
+# error "__cpp_lib_shared_mutex should not be defined before c++17"
+# endif
+
+# if !defined(_LIBCPP_HAS_NO_THREADS)
+# ifndef __cpp_lib_shared_timed_mutex
+# error "__cpp_lib_shared_timed_mutex should be defined in c++14"
+# endif
+# if __cpp_lib_shared_timed_mutex != 201402L
+# error "__cpp_lib_shared_timed_mutex should have the value 201402L in c++14"
+# endif
+# else
+# ifdef __cpp_lib_shared_timed_mutex
+# error "__cpp_lib_shared_timed_mutex should not be defined when !defined(_LIBCPP_HAS_NO_THREADS) is not defined!"
+# endif
+# endif
+
+#elif TEST_STD_VER == 17
+
+# if !defined(_LIBCPP_HAS_NO_THREADS)
+# ifndef __cpp_lib_shared_mutex
+# error "__cpp_lib_shared_mutex should be defined in c++17"
+# endif
+# if __cpp_lib_shared_mutex != 201505L
+# error "__cpp_lib_shared_mutex should have the value 201505L in c++17"
+# endif
+# else
+# ifdef __cpp_lib_shared_mutex
+# error "__cpp_lib_shared_mutex should not be defined when !defined(_LIBCPP_HAS_NO_THREADS) is not defined!"
+# endif
+# endif
+
+# if !defined(_LIBCPP_HAS_NO_THREADS)
+# ifndef __cpp_lib_shared_timed_mutex
+# error "__cpp_lib_shared_timed_mutex should be defined in c++17"
+# endif
+# if __cpp_lib_shared_timed_mutex != 201402L
+# error "__cpp_lib_shared_timed_mutex should have the value 201402L in c++17"
+# endif
+# else
+# ifdef __cpp_lib_shared_timed_mutex
+# error "__cpp_lib_shared_timed_mutex should not be defined when !defined(_LIBCPP_HAS_NO_THREADS) is not defined!"
+# endif
+# endif
+
+#elif TEST_STD_VER > 17
+
+# if !defined(_LIBCPP_HAS_NO_THREADS)
+# ifndef __cpp_lib_shared_mutex
+# error "__cpp_lib_shared_mutex should be defined in c++2a"
+# endif
+# if __cpp_lib_shared_mutex != 201505L
+# error "__cpp_lib_shared_mutex should have the value 201505L in c++2a"
+# endif
+# else
+# ifdef __cpp_lib_shared_mutex
+# error "__cpp_lib_shared_mutex should not be defined when !defined(_LIBCPP_HAS_NO_THREADS) is not defined!"
+# endif
+# endif
+
+# if !defined(_LIBCPP_HAS_NO_THREADS)
+# ifndef __cpp_lib_shared_timed_mutex
+# error "__cpp_lib_shared_timed_mutex should be defined in c++2a"
+# endif
+# if __cpp_lib_shared_timed_mutex != 201402L
+# error "__cpp_lib_shared_timed_mutex should have the value 201402L in c++2a"
+# endif
+# else
+# ifdef __cpp_lib_shared_timed_mutex
+# error "__cpp_lib_shared_timed_mutex should not be defined when !defined(_LIBCPP_HAS_NO_THREADS) is not defined!"
+# endif
+# endif
+
+#endif // TEST_STD_VER > 17
+
+int main() {}
diff --git a/test/std/language.support/support.limits/support.limits.general/string.version.pass.cpp b/test/std/language.support/support.limits/support.limits.general/string.version.pass.cpp
new file mode 100644
index 0000000000000..8639c468cc367
--- /dev/null
+++ b/test/std/language.support/support.limits/support.limits.general/string.version.pass.cpp
@@ -0,0 +1,174 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+//
+// WARNING: This test was generated by generate_feature_test_macro_components.py
+// and should not be edited manually.
+
+// <string>
+
+// Test the feature test macros defined by <string>
+
+/* Constant Value
+ __cpp_lib_allocator_traits_is_always_equal 201411L [C++17]
+ __cpp_lib_char8_t 201811L [C++2a]
+ __cpp_lib_erase_if 201811L [C++2a]
+ __cpp_lib_nonmember_container_access 201411L [C++17]
+ __cpp_lib_string_udls 201304L [C++14]
+ __cpp_lib_string_view 201606L [C++17]
+*/
+
+#include <string>
+#include "test_macros.h"
+
+#if TEST_STD_VER < 14
+
+# ifdef __cpp_lib_allocator_traits_is_always_equal
+# error "__cpp_lib_allocator_traits_is_always_equal should not be defined before c++17"
+# endif
+
+# ifdef __cpp_lib_char8_t
+# error "__cpp_lib_char8_t should not be defined before c++2a"
+# endif
+
+# ifdef __cpp_lib_erase_if
+# error "__cpp_lib_erase_if should not be defined before c++2a"
+# endif
+
+# ifdef __cpp_lib_nonmember_container_access
+# error "__cpp_lib_nonmember_container_access should not be defined before c++17"
+# endif
+
+# ifdef __cpp_lib_string_udls
+# error "__cpp_lib_string_udls should not be defined before c++14"
+# endif
+
+# ifdef __cpp_lib_string_view
+# error "__cpp_lib_string_view should not be defined before c++17"
+# endif
+
+#elif TEST_STD_VER == 14
+
+# ifdef __cpp_lib_allocator_traits_is_always_equal
+# error "__cpp_lib_allocator_traits_is_always_equal should not be defined before c++17"
+# endif
+
+# ifdef __cpp_lib_char8_t
+# error "__cpp_lib_char8_t should not be defined before c++2a"
+# endif
+
+# ifdef __cpp_lib_erase_if
+# error "__cpp_lib_erase_if should not be defined before c++2a"
+# endif
+
+# ifdef __cpp_lib_nonmember_container_access
+# error "__cpp_lib_nonmember_container_access should not be defined before c++17"
+# endif
+
+# ifndef __cpp_lib_string_udls
+# error "__cpp_lib_string_udls should be defined in c++14"
+# endif
+# if __cpp_lib_string_udls != 201304L
+# error "__cpp_lib_string_udls should have the value 201304L in c++14"
+# endif
+
+# ifdef __cpp_lib_string_view
+# error "__cpp_lib_string_view should not be defined before c++17"
+# endif
+
+#elif TEST_STD_VER == 17
+
+# ifndef __cpp_lib_allocator_traits_is_always_equal
+# error "__cpp_lib_allocator_traits_is_always_equal should be defined in c++17"
+# endif
+# if __cpp_lib_allocator_traits_is_always_equal != 201411L
+# error "__cpp_lib_allocator_traits_is_always_equal should have the value 201411L in c++17"
+# endif
+
+# ifdef __cpp_lib_char8_t
+# error "__cpp_lib_char8_t should not be defined before c++2a"
+# endif
+
+# ifdef __cpp_lib_erase_if
+# error "__cpp_lib_erase_if should not be defined before c++2a"
+# endif
+
+# ifndef __cpp_lib_nonmember_container_access
+# error "__cpp_lib_nonmember_container_access should be defined in c++17"
+# endif
+# if __cpp_lib_nonmember_container_access != 201411L
+# error "__cpp_lib_nonmember_container_access should have the value 201411L in c++17"
+# endif
+
+# ifndef __cpp_lib_string_udls
+# error "__cpp_lib_string_udls should be defined in c++17"
+# endif
+# if __cpp_lib_string_udls != 201304L
+# error "__cpp_lib_string_udls should have the value 201304L in c++17"
+# endif
+
+# ifndef __cpp_lib_string_view
+# error "__cpp_lib_string_view should be defined in c++17"
+# endif
+# if __cpp_lib_string_view != 201606L
+# error "__cpp_lib_string_view should have the value 201606L in c++17"
+# endif
+
+#elif TEST_STD_VER > 17
+
+# ifndef __cpp_lib_allocator_traits_is_always_equal
+# error "__cpp_lib_allocator_traits_is_always_equal should be defined in c++2a"
+# endif
+# if __cpp_lib_allocator_traits_is_always_equal != 201411L
+# error "__cpp_lib_allocator_traits_is_always_equal should have the value 201411L in c++2a"
+# endif
+
+# if defined(__cpp_char8_t)
+# ifndef __cpp_lib_char8_t
+# error "__cpp_lib_char8_t should be defined in c++2a"
+# endif
+# if __cpp_lib_char8_t != 201811L
+# error "__cpp_lib_char8_t should have the value 201811L in c++2a"
+# endif
+# else
+# ifdef __cpp_lib_char8_t
+# error "__cpp_lib_char8_t should not be defined when defined(__cpp_char8_t) is not defined!"
+# endif
+# endif
+
+# ifndef __cpp_lib_erase_if
+# error "__cpp_lib_erase_if should be defined in c++2a"
+# endif
+# if __cpp_lib_erase_if != 201811L
+# error "__cpp_lib_erase_if should have the value 201811L in c++2a"
+# endif
+
+# ifndef __cpp_lib_nonmember_container_access
+# error "__cpp_lib_nonmember_container_access should be defined in c++2a"
+# endif
+# if __cpp_lib_nonmember_container_access != 201411L
+# error "__cpp_lib_nonmember_container_access should have the value 201411L in c++2a"
+# endif
+
+# ifndef __cpp_lib_string_udls
+# error "__cpp_lib_string_udls should be defined in c++2a"
+# endif
+# if __cpp_lib_string_udls != 201304L
+# error "__cpp_lib_string_udls should have the value 201304L in c++2a"
+# endif
+
+# ifndef __cpp_lib_string_view
+# error "__cpp_lib_string_view should be defined in c++2a"
+# endif
+# if __cpp_lib_string_view != 201606L
+# error "__cpp_lib_string_view should have the value 201606L in c++2a"
+# endif
+
+#endif // TEST_STD_VER > 17
+
+int main() {}
diff --git a/test/std/language.support/support.limits/support.limits.general/string_view.version.pass.cpp b/test/std/language.support/support.limits/support.limits.general/string_view.version.pass.cpp
new file mode 100644
index 0000000000000..44e97f3af8016
--- /dev/null
+++ b/test/std/language.support/support.limits/support.limits.general/string_view.version.pass.cpp
@@ -0,0 +1,108 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+//
+// WARNING: This test was generated by generate_feature_test_macro_components.py
+// and should not be edited manually.
+
+// <string_view>
+
+// Test the feature test macros defined by <string_view>
+
+/* Constant Value
+ __cpp_lib_char8_t 201811L [C++2a]
+ __cpp_lib_constexpr_misc 201811L [C++2a]
+ __cpp_lib_string_view 201606L [C++17]
+*/
+
+#include <string_view>
+#include "test_macros.h"
+
+#if TEST_STD_VER < 14
+
+# ifdef __cpp_lib_char8_t
+# error "__cpp_lib_char8_t should not be defined before c++2a"
+# endif
+
+# ifdef __cpp_lib_constexpr_misc
+# error "__cpp_lib_constexpr_misc should not be defined before c++2a"
+# endif
+
+# ifdef __cpp_lib_string_view
+# error "__cpp_lib_string_view should not be defined before c++17"
+# endif
+
+#elif TEST_STD_VER == 14
+
+# ifdef __cpp_lib_char8_t
+# error "__cpp_lib_char8_t should not be defined before c++2a"
+# endif
+
+# ifdef __cpp_lib_constexpr_misc
+# error "__cpp_lib_constexpr_misc should not be defined before c++2a"
+# endif
+
+# ifdef __cpp_lib_string_view
+# error "__cpp_lib_string_view should not be defined before c++17"
+# endif
+
+#elif TEST_STD_VER == 17
+
+# ifdef __cpp_lib_char8_t
+# error "__cpp_lib_char8_t should not be defined before c++2a"
+# endif
+
+# ifdef __cpp_lib_constexpr_misc
+# error "__cpp_lib_constexpr_misc should not be defined before c++2a"
+# endif
+
+# ifndef __cpp_lib_string_view
+# error "__cpp_lib_string_view should be defined in c++17"
+# endif
+# if __cpp_lib_string_view != 201606L
+# error "__cpp_lib_string_view should have the value 201606L in c++17"
+# endif
+
+#elif TEST_STD_VER > 17
+
+# if defined(__cpp_char8_t)
+# ifndef __cpp_lib_char8_t
+# error "__cpp_lib_char8_t should be defined in c++2a"
+# endif
+# if __cpp_lib_char8_t != 201811L
+# error "__cpp_lib_char8_t should have the value 201811L in c++2a"
+# endif
+# else
+# ifdef __cpp_lib_char8_t
+# error "__cpp_lib_char8_t should not be defined when defined(__cpp_char8_t) is not defined!"
+# endif
+# endif
+
+# if !defined(_LIBCPP_VERSION)
+# ifndef __cpp_lib_constexpr_misc
+# error "__cpp_lib_constexpr_misc should be defined in c++2a"
+# endif
+# if __cpp_lib_constexpr_misc != 201811L
+# error "__cpp_lib_constexpr_misc should have the value 201811L in c++2a"
+# endif
+# else // _LIBCPP_VERSION
+# ifdef __cpp_lib_constexpr_misc
+# error "__cpp_lib_constexpr_misc should not be defined because it is unimplemented in libc++!"
+# endif
+# endif
+
+# ifndef __cpp_lib_string_view
+# error "__cpp_lib_string_view should be defined in c++2a"
+# endif
+# if __cpp_lib_string_view != 201606L
+# error "__cpp_lib_string_view should have the value 201606L in c++2a"
+# endif
+
+#endif // TEST_STD_VER > 17
+
+int main() {}
diff --git a/test/std/language.support/support.limits/support.limits.general/tuple.version.pass.cpp b/test/std/language.support/support.limits/support.limits.general/tuple.version.pass.cpp
new file mode 100644
index 0000000000000..6466a2f6458b2
--- /dev/null
+++ b/test/std/language.support/support.limits/support.limits.general/tuple.version.pass.cpp
@@ -0,0 +1,157 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+//
+// WARNING: This test was generated by generate_feature_test_macro_components.py
+// and should not be edited manually.
+
+// <tuple>
+
+// Test the feature test macros defined by <tuple>
+
+/* Constant Value
+ __cpp_lib_apply 201603L [C++17]
+ __cpp_lib_constexpr_misc 201811L [C++2a]
+ __cpp_lib_make_from_tuple 201606L [C++17]
+ __cpp_lib_tuple_element_t 201402L [C++14]
+ __cpp_lib_tuples_by_type 201304L [C++14]
+*/
+
+#include <tuple>
+#include "test_macros.h"
+
+#if TEST_STD_VER < 14
+
+# ifdef __cpp_lib_apply
+# error "__cpp_lib_apply should not be defined before c++17"
+# endif
+
+# ifdef __cpp_lib_constexpr_misc
+# error "__cpp_lib_constexpr_misc should not be defined before c++2a"
+# endif
+
+# ifdef __cpp_lib_make_from_tuple
+# error "__cpp_lib_make_from_tuple should not be defined before c++17"
+# endif
+
+# ifdef __cpp_lib_tuple_element_t
+# error "__cpp_lib_tuple_element_t should not be defined before c++14"
+# endif
+
+# ifdef __cpp_lib_tuples_by_type
+# error "__cpp_lib_tuples_by_type should not be defined before c++14"
+# endif
+
+#elif TEST_STD_VER == 14
+
+# ifdef __cpp_lib_apply
+# error "__cpp_lib_apply should not be defined before c++17"
+# endif
+
+# ifdef __cpp_lib_constexpr_misc
+# error "__cpp_lib_constexpr_misc should not be defined before c++2a"
+# endif
+
+# ifdef __cpp_lib_make_from_tuple
+# error "__cpp_lib_make_from_tuple should not be defined before c++17"
+# endif
+
+# ifndef __cpp_lib_tuple_element_t
+# error "__cpp_lib_tuple_element_t should be defined in c++14"
+# endif
+# if __cpp_lib_tuple_element_t != 201402L
+# error "__cpp_lib_tuple_element_t should have the value 201402L in c++14"
+# endif
+
+# ifndef __cpp_lib_tuples_by_type
+# error "__cpp_lib_tuples_by_type should be defined in c++14"
+# endif
+# if __cpp_lib_tuples_by_type != 201304L
+# error "__cpp_lib_tuples_by_type should have the value 201304L in c++14"
+# endif
+
+#elif TEST_STD_VER == 17
+
+# ifndef __cpp_lib_apply
+# error "__cpp_lib_apply should be defined in c++17"
+# endif
+# if __cpp_lib_apply != 201603L
+# error "__cpp_lib_apply should have the value 201603L in c++17"
+# endif
+
+# ifdef __cpp_lib_constexpr_misc
+# error "__cpp_lib_constexpr_misc should not be defined before c++2a"
+# endif
+
+# ifndef __cpp_lib_make_from_tuple
+# error "__cpp_lib_make_from_tuple should be defined in c++17"
+# endif
+# if __cpp_lib_make_from_tuple != 201606L
+# error "__cpp_lib_make_from_tuple should have the value 201606L in c++17"
+# endif
+
+# ifndef __cpp_lib_tuple_element_t
+# error "__cpp_lib_tuple_element_t should be defined in c++17"
+# endif
+# if __cpp_lib_tuple_element_t != 201402L
+# error "__cpp_lib_tuple_element_t should have the value 201402L in c++17"
+# endif
+
+# ifndef __cpp_lib_tuples_by_type
+# error "__cpp_lib_tuples_by_type should be defined in c++17"
+# endif
+# if __cpp_lib_tuples_by_type != 201304L
+# error "__cpp_lib_tuples_by_type should have the value 201304L in c++17"
+# endif
+
+#elif TEST_STD_VER > 17
+
+# ifndef __cpp_lib_apply
+# error "__cpp_lib_apply should be defined in c++2a"
+# endif
+# if __cpp_lib_apply != 201603L
+# error "__cpp_lib_apply should have the value 201603L in c++2a"
+# endif
+
+# if !defined(_LIBCPP_VERSION)
+# ifndef __cpp_lib_constexpr_misc
+# error "__cpp_lib_constexpr_misc should be defined in c++2a"
+# endif
+# if __cpp_lib_constexpr_misc != 201811L
+# error "__cpp_lib_constexpr_misc should have the value 201811L in c++2a"
+# endif
+# else // _LIBCPP_VERSION
+# ifdef __cpp_lib_constexpr_misc
+# error "__cpp_lib_constexpr_misc should not be defined because it is unimplemented in libc++!"
+# endif
+# endif
+
+# ifndef __cpp_lib_make_from_tuple
+# error "__cpp_lib_make_from_tuple should be defined in c++2a"
+# endif
+# if __cpp_lib_make_from_tuple != 201606L
+# error "__cpp_lib_make_from_tuple should have the value 201606L in c++2a"
+# endif
+
+# ifndef __cpp_lib_tuple_element_t
+# error "__cpp_lib_tuple_element_t should be defined in c++2a"
+# endif
+# if __cpp_lib_tuple_element_t != 201402L
+# error "__cpp_lib_tuple_element_t should have the value 201402L in c++2a"
+# endif
+
+# ifndef __cpp_lib_tuples_by_type
+# error "__cpp_lib_tuples_by_type should be defined in c++2a"
+# endif
+# if __cpp_lib_tuples_by_type != 201304L
+# error "__cpp_lib_tuples_by_type should have the value 201304L in c++2a"
+# endif
+
+#endif // TEST_STD_VER > 17
+
+int main() {}
diff --git a/test/std/language.support/support.limits/support.limits.general/type_traits.version.pass.cpp b/test/std/language.support/support.limits/support.limits.general/type_traits.version.pass.cpp
new file mode 100644
index 0000000000000..49113a3d04373
--- /dev/null
+++ b/test/std/language.support/support.limits/support.limits.general/type_traits.version.pass.cpp
@@ -0,0 +1,397 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+//
+// WARNING: This test was generated by generate_feature_test_macro_components.py
+// and should not be edited manually.
+
+// <type_traits>
+
+// Test the feature test macros defined by <type_traits>
+
+/* Constant Value
+ __cpp_lib_bool_constant 201505L [C++17]
+ __cpp_lib_has_unique_object_representations 201606L [C++17]
+ __cpp_lib_integral_constant_callable 201304L [C++14]
+ __cpp_lib_is_aggregate 201703L [C++17]
+ __cpp_lib_is_constant_evaluated 201811L [C++2a]
+ __cpp_lib_is_final 201402L [C++14]
+ __cpp_lib_is_invocable 201703L [C++17]
+ __cpp_lib_is_null_pointer 201309L [C++14]
+ __cpp_lib_is_swappable 201603L [C++17]
+ __cpp_lib_logical_traits 201510L [C++17]
+ __cpp_lib_result_of_sfinae 201210L [C++14]
+ __cpp_lib_transformation_trait_aliases 201304L [C++14]
+ __cpp_lib_type_trait_variable_templates 201510L [C++17]
+ __cpp_lib_void_t 201411L [C++17]
+*/
+
+#include <type_traits>
+#include "test_macros.h"
+
+#if TEST_STD_VER < 14
+
+# ifdef __cpp_lib_bool_constant
+# error "__cpp_lib_bool_constant should not be defined before c++17"
+# endif
+
+# ifdef __cpp_lib_has_unique_object_representations
+# error "__cpp_lib_has_unique_object_representations should not be defined before c++17"
+# endif
+
+# ifdef __cpp_lib_integral_constant_callable
+# error "__cpp_lib_integral_constant_callable should not be defined before c++14"
+# endif
+
+# ifdef __cpp_lib_is_aggregate
+# error "__cpp_lib_is_aggregate should not be defined before c++17"
+# endif
+
+# ifdef __cpp_lib_is_constant_evaluated
+# error "__cpp_lib_is_constant_evaluated should not be defined before c++2a"
+# endif
+
+# ifdef __cpp_lib_is_final
+# error "__cpp_lib_is_final should not be defined before c++14"
+# endif
+
+# ifdef __cpp_lib_is_invocable
+# error "__cpp_lib_is_invocable should not be defined before c++17"
+# endif
+
+# ifdef __cpp_lib_is_null_pointer
+# error "__cpp_lib_is_null_pointer should not be defined before c++14"
+# endif
+
+# ifdef __cpp_lib_is_swappable
+# error "__cpp_lib_is_swappable should not be defined before c++17"
+# endif
+
+# ifdef __cpp_lib_logical_traits
+# error "__cpp_lib_logical_traits should not be defined before c++17"
+# endif
+
+# ifdef __cpp_lib_result_of_sfinae
+# error "__cpp_lib_result_of_sfinae should not be defined before c++14"
+# endif
+
+# ifdef __cpp_lib_transformation_trait_aliases
+# error "__cpp_lib_transformation_trait_aliases should not be defined before c++14"
+# endif
+
+# ifdef __cpp_lib_type_trait_variable_templates
+# error "__cpp_lib_type_trait_variable_templates should not be defined before c++17"
+# endif
+
+# ifdef __cpp_lib_void_t
+# error "__cpp_lib_void_t should not be defined before c++17"
+# endif
+
+#elif TEST_STD_VER == 14
+
+# ifdef __cpp_lib_bool_constant
+# error "__cpp_lib_bool_constant should not be defined before c++17"
+# endif
+
+# ifdef __cpp_lib_has_unique_object_representations
+# error "__cpp_lib_has_unique_object_representations should not be defined before c++17"
+# endif
+
+# ifndef __cpp_lib_integral_constant_callable
+# error "__cpp_lib_integral_constant_callable should be defined in c++14"
+# endif
+# if __cpp_lib_integral_constant_callable != 201304L
+# error "__cpp_lib_integral_constant_callable should have the value 201304L in c++14"
+# endif
+
+# ifdef __cpp_lib_is_aggregate
+# error "__cpp_lib_is_aggregate should not be defined before c++17"
+# endif
+
+# ifdef __cpp_lib_is_constant_evaluated
+# error "__cpp_lib_is_constant_evaluated should not be defined before c++2a"
+# endif
+
+# ifndef __cpp_lib_is_final
+# error "__cpp_lib_is_final should be defined in c++14"
+# endif
+# if __cpp_lib_is_final != 201402L
+# error "__cpp_lib_is_final should have the value 201402L in c++14"
+# endif
+
+# ifdef __cpp_lib_is_invocable
+# error "__cpp_lib_is_invocable should not be defined before c++17"
+# endif
+
+# ifndef __cpp_lib_is_null_pointer
+# error "__cpp_lib_is_null_pointer should be defined in c++14"
+# endif
+# if __cpp_lib_is_null_pointer != 201309L
+# error "__cpp_lib_is_null_pointer should have the value 201309L in c++14"
+# endif
+
+# ifdef __cpp_lib_is_swappable
+# error "__cpp_lib_is_swappable should not be defined before c++17"
+# endif
+
+# ifdef __cpp_lib_logical_traits
+# error "__cpp_lib_logical_traits should not be defined before c++17"
+# endif
+
+# ifndef __cpp_lib_result_of_sfinae
+# error "__cpp_lib_result_of_sfinae should be defined in c++14"
+# endif
+# if __cpp_lib_result_of_sfinae != 201210L
+# error "__cpp_lib_result_of_sfinae should have the value 201210L in c++14"
+# endif
+
+# ifndef __cpp_lib_transformation_trait_aliases
+# error "__cpp_lib_transformation_trait_aliases should be defined in c++14"
+# endif
+# if __cpp_lib_transformation_trait_aliases != 201304L
+# error "__cpp_lib_transformation_trait_aliases should have the value 201304L in c++14"
+# endif
+
+# ifdef __cpp_lib_type_trait_variable_templates
+# error "__cpp_lib_type_trait_variable_templates should not be defined before c++17"
+# endif
+
+# ifdef __cpp_lib_void_t
+# error "__cpp_lib_void_t should not be defined before c++17"
+# endif
+
+#elif TEST_STD_VER == 17
+
+# ifndef __cpp_lib_bool_constant
+# error "__cpp_lib_bool_constant should be defined in c++17"
+# endif
+# if __cpp_lib_bool_constant != 201505L
+# error "__cpp_lib_bool_constant should have the value 201505L in c++17"
+# endif
+
+# if TEST_HAS_BUILTIN_IDENTIFIER(__has_unique_object_representations) || TEST_GCC_VER >= 700
+# ifndef __cpp_lib_has_unique_object_representations
+# error "__cpp_lib_has_unique_object_representations should be defined in c++17"
+# endif
+# if __cpp_lib_has_unique_object_representations != 201606L
+# error "__cpp_lib_has_unique_object_representations should have the value 201606L in c++17"
+# endif
+# else
+# ifdef __cpp_lib_has_unique_object_representations
+# error "__cpp_lib_has_unique_object_representations should not be defined when TEST_HAS_BUILTIN_IDENTIFIER(__has_unique_object_representations) || TEST_GCC_VER >= 700 is not defined!"
+# endif
+# endif
+
+# ifndef __cpp_lib_integral_constant_callable
+# error "__cpp_lib_integral_constant_callable should be defined in c++17"
+# endif
+# if __cpp_lib_integral_constant_callable != 201304L
+# error "__cpp_lib_integral_constant_callable should have the value 201304L in c++17"
+# endif
+
+# if TEST_HAS_BUILTIN_IDENTIFIER(__is_aggregate) || TEST_GCC_VER_NEW >= 7001
+# ifndef __cpp_lib_is_aggregate
+# error "__cpp_lib_is_aggregate should be defined in c++17"
+# endif
+# if __cpp_lib_is_aggregate != 201703L
+# error "__cpp_lib_is_aggregate should have the value 201703L in c++17"
+# endif
+# else
+# ifdef __cpp_lib_is_aggregate
+# error "__cpp_lib_is_aggregate should not be defined when TEST_HAS_BUILTIN_IDENTIFIER(__is_aggregate) || TEST_GCC_VER_NEW >= 7001 is not defined!"
+# endif
+# endif
+
+# ifdef __cpp_lib_is_constant_evaluated
+# error "__cpp_lib_is_constant_evaluated should not be defined before c++2a"
+# endif
+
+# ifndef __cpp_lib_is_final
+# error "__cpp_lib_is_final should be defined in c++17"
+# endif
+# if __cpp_lib_is_final != 201402L
+# error "__cpp_lib_is_final should have the value 201402L in c++17"
+# endif
+
+# ifndef __cpp_lib_is_invocable
+# error "__cpp_lib_is_invocable should be defined in c++17"
+# endif
+# if __cpp_lib_is_invocable != 201703L
+# error "__cpp_lib_is_invocable should have the value 201703L in c++17"
+# endif
+
+# ifndef __cpp_lib_is_null_pointer
+# error "__cpp_lib_is_null_pointer should be defined in c++17"
+# endif
+# if __cpp_lib_is_null_pointer != 201309L
+# error "__cpp_lib_is_null_pointer should have the value 201309L in c++17"
+# endif
+
+# ifndef __cpp_lib_is_swappable
+# error "__cpp_lib_is_swappable should be defined in c++17"
+# endif
+# if __cpp_lib_is_swappable != 201603L
+# error "__cpp_lib_is_swappable should have the value 201603L in c++17"
+# endif
+
+# ifndef __cpp_lib_logical_traits
+# error "__cpp_lib_logical_traits should be defined in c++17"
+# endif
+# if __cpp_lib_logical_traits != 201510L
+# error "__cpp_lib_logical_traits should have the value 201510L in c++17"
+# endif
+
+# ifndef __cpp_lib_result_of_sfinae
+# error "__cpp_lib_result_of_sfinae should be defined in c++17"
+# endif
+# if __cpp_lib_result_of_sfinae != 201210L
+# error "__cpp_lib_result_of_sfinae should have the value 201210L in c++17"
+# endif
+
+# ifndef __cpp_lib_transformation_trait_aliases
+# error "__cpp_lib_transformation_trait_aliases should be defined in c++17"
+# endif
+# if __cpp_lib_transformation_trait_aliases != 201304L
+# error "__cpp_lib_transformation_trait_aliases should have the value 201304L in c++17"
+# endif
+
+# ifndef __cpp_lib_type_trait_variable_templates
+# error "__cpp_lib_type_trait_variable_templates should be defined in c++17"
+# endif
+# if __cpp_lib_type_trait_variable_templates != 201510L
+# error "__cpp_lib_type_trait_variable_templates should have the value 201510L in c++17"
+# endif
+
+# ifndef __cpp_lib_void_t
+# error "__cpp_lib_void_t should be defined in c++17"
+# endif
+# if __cpp_lib_void_t != 201411L
+# error "__cpp_lib_void_t should have the value 201411L in c++17"
+# endif
+
+#elif TEST_STD_VER > 17
+
+# ifndef __cpp_lib_bool_constant
+# error "__cpp_lib_bool_constant should be defined in c++2a"
+# endif
+# if __cpp_lib_bool_constant != 201505L
+# error "__cpp_lib_bool_constant should have the value 201505L in c++2a"
+# endif
+
+# if TEST_HAS_BUILTIN_IDENTIFIER(__has_unique_object_representations) || TEST_GCC_VER >= 700
+# ifndef __cpp_lib_has_unique_object_representations
+# error "__cpp_lib_has_unique_object_representations should be defined in c++2a"
+# endif
+# if __cpp_lib_has_unique_object_representations != 201606L
+# error "__cpp_lib_has_unique_object_representations should have the value 201606L in c++2a"
+# endif
+# else
+# ifdef __cpp_lib_has_unique_object_representations
+# error "__cpp_lib_has_unique_object_representations should not be defined when TEST_HAS_BUILTIN_IDENTIFIER(__has_unique_object_representations) || TEST_GCC_VER >= 700 is not defined!"
+# endif
+# endif
+
+# ifndef __cpp_lib_integral_constant_callable
+# error "__cpp_lib_integral_constant_callable should be defined in c++2a"
+# endif
+# if __cpp_lib_integral_constant_callable != 201304L
+# error "__cpp_lib_integral_constant_callable should have the value 201304L in c++2a"
+# endif
+
+# if TEST_HAS_BUILTIN_IDENTIFIER(__is_aggregate) || TEST_GCC_VER_NEW >= 7001
+# ifndef __cpp_lib_is_aggregate
+# error "__cpp_lib_is_aggregate should be defined in c++2a"
+# endif
+# if __cpp_lib_is_aggregate != 201703L
+# error "__cpp_lib_is_aggregate should have the value 201703L in c++2a"
+# endif
+# else
+# ifdef __cpp_lib_is_aggregate
+# error "__cpp_lib_is_aggregate should not be defined when TEST_HAS_BUILTIN_IDENTIFIER(__is_aggregate) || TEST_GCC_VER_NEW >= 7001 is not defined!"
+# endif
+# endif
+
+# if !defined(_LIBCPP_VERSION)
+# ifndef __cpp_lib_is_constant_evaluated
+# error "__cpp_lib_is_constant_evaluated should be defined in c++2a"
+# endif
+# if __cpp_lib_is_constant_evaluated != 201811L
+# error "__cpp_lib_is_constant_evaluated should have the value 201811L in c++2a"
+# endif
+# else // _LIBCPP_VERSION
+# ifdef __cpp_lib_is_constant_evaluated
+# error "__cpp_lib_is_constant_evaluated should not be defined because it is unimplemented in libc++!"
+# endif
+# endif
+
+# ifndef __cpp_lib_is_final
+# error "__cpp_lib_is_final should be defined in c++2a"
+# endif
+# if __cpp_lib_is_final != 201402L
+# error "__cpp_lib_is_final should have the value 201402L in c++2a"
+# endif
+
+# ifndef __cpp_lib_is_invocable
+# error "__cpp_lib_is_invocable should be defined in c++2a"
+# endif
+# if __cpp_lib_is_invocable != 201703L
+# error "__cpp_lib_is_invocable should have the value 201703L in c++2a"
+# endif
+
+# ifndef __cpp_lib_is_null_pointer
+# error "__cpp_lib_is_null_pointer should be defined in c++2a"
+# endif
+# if __cpp_lib_is_null_pointer != 201309L
+# error "__cpp_lib_is_null_pointer should have the value 201309L in c++2a"
+# endif
+
+# ifndef __cpp_lib_is_swappable
+# error "__cpp_lib_is_swappable should be defined in c++2a"
+# endif
+# if __cpp_lib_is_swappable != 201603L
+# error "__cpp_lib_is_swappable should have the value 201603L in c++2a"
+# endif
+
+# ifndef __cpp_lib_logical_traits
+# error "__cpp_lib_logical_traits should be defined in c++2a"
+# endif
+# if __cpp_lib_logical_traits != 201510L
+# error "__cpp_lib_logical_traits should have the value 201510L in c++2a"
+# endif
+
+# ifndef __cpp_lib_result_of_sfinae
+# error "__cpp_lib_result_of_sfinae should be defined in c++2a"
+# endif
+# if __cpp_lib_result_of_sfinae != 201210L
+# error "__cpp_lib_result_of_sfinae should have the value 201210L in c++2a"
+# endif
+
+# ifndef __cpp_lib_transformation_trait_aliases
+# error "__cpp_lib_transformation_trait_aliases should be defined in c++2a"
+# endif
+# if __cpp_lib_transformation_trait_aliases != 201304L
+# error "__cpp_lib_transformation_trait_aliases should have the value 201304L in c++2a"
+# endif
+
+# ifndef __cpp_lib_type_trait_variable_templates
+# error "__cpp_lib_type_trait_variable_templates should be defined in c++2a"
+# endif
+# if __cpp_lib_type_trait_variable_templates != 201510L
+# error "__cpp_lib_type_trait_variable_templates should have the value 201510L in c++2a"
+# endif
+
+# ifndef __cpp_lib_void_t
+# error "__cpp_lib_void_t should be defined in c++2a"
+# endif
+# if __cpp_lib_void_t != 201411L
+# error "__cpp_lib_void_t should have the value 201411L in c++2a"
+# endif
+
+#endif // TEST_STD_VER > 17
+
+int main() {}
diff --git a/test/std/language.support/support.limits/support.limits.general/unordered_map.version.pass.cpp b/test/std/language.support/support.limits/support.limits.general/unordered_map.version.pass.cpp
new file mode 100644
index 0000000000000..9aa06e4db0838
--- /dev/null
+++ b/test/std/language.support/support.limits/support.limits.general/unordered_map.version.pass.cpp
@@ -0,0 +1,171 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+//
+// WARNING: This test was generated by generate_feature_test_macro_components.py
+// and should not be edited manually.
+
+// <unordered_map>
+
+// Test the feature test macros defined by <unordered_map>
+
+/* Constant Value
+ __cpp_lib_allocator_traits_is_always_equal 201411L [C++17]
+ __cpp_lib_erase_if 201811L [C++2a]
+ __cpp_lib_generic_unordered_lookup 201811L [C++2a]
+ __cpp_lib_node_extract 201606L [C++17]
+ __cpp_lib_nonmember_container_access 201411L [C++17]
+ __cpp_lib_unordered_map_try_emplace 201411L [C++17]
+*/
+
+#include <unordered_map>
+#include "test_macros.h"
+
+#if TEST_STD_VER < 14
+
+# ifdef __cpp_lib_allocator_traits_is_always_equal
+# error "__cpp_lib_allocator_traits_is_always_equal should not be defined before c++17"
+# endif
+
+# ifdef __cpp_lib_erase_if
+# error "__cpp_lib_erase_if should not be defined before c++2a"
+# endif
+
+# ifdef __cpp_lib_generic_unordered_lookup
+# error "__cpp_lib_generic_unordered_lookup should not be defined before c++2a"
+# endif
+
+# ifdef __cpp_lib_node_extract
+# error "__cpp_lib_node_extract should not be defined before c++17"
+# endif
+
+# ifdef __cpp_lib_nonmember_container_access
+# error "__cpp_lib_nonmember_container_access should not be defined before c++17"
+# endif
+
+# ifdef __cpp_lib_unordered_map_try_emplace
+# error "__cpp_lib_unordered_map_try_emplace should not be defined before c++17"
+# endif
+
+#elif TEST_STD_VER == 14
+
+# ifdef __cpp_lib_allocator_traits_is_always_equal
+# error "__cpp_lib_allocator_traits_is_always_equal should not be defined before c++17"
+# endif
+
+# ifdef __cpp_lib_erase_if
+# error "__cpp_lib_erase_if should not be defined before c++2a"
+# endif
+
+# ifdef __cpp_lib_generic_unordered_lookup
+# error "__cpp_lib_generic_unordered_lookup should not be defined before c++2a"
+# endif
+
+# ifdef __cpp_lib_node_extract
+# error "__cpp_lib_node_extract should not be defined before c++17"
+# endif
+
+# ifdef __cpp_lib_nonmember_container_access
+# error "__cpp_lib_nonmember_container_access should not be defined before c++17"
+# endif
+
+# ifdef __cpp_lib_unordered_map_try_emplace
+# error "__cpp_lib_unordered_map_try_emplace should not be defined before c++17"
+# endif
+
+#elif TEST_STD_VER == 17
+
+# ifndef __cpp_lib_allocator_traits_is_always_equal
+# error "__cpp_lib_allocator_traits_is_always_equal should be defined in c++17"
+# endif
+# if __cpp_lib_allocator_traits_is_always_equal != 201411L
+# error "__cpp_lib_allocator_traits_is_always_equal should have the value 201411L in c++17"
+# endif
+
+# ifdef __cpp_lib_erase_if
+# error "__cpp_lib_erase_if should not be defined before c++2a"
+# endif
+
+# ifdef __cpp_lib_generic_unordered_lookup
+# error "__cpp_lib_generic_unordered_lookup should not be defined before c++2a"
+# endif
+
+# ifndef __cpp_lib_node_extract
+# error "__cpp_lib_node_extract should be defined in c++17"
+# endif
+# if __cpp_lib_node_extract != 201606L
+# error "__cpp_lib_node_extract should have the value 201606L in c++17"
+# endif
+
+# ifndef __cpp_lib_nonmember_container_access
+# error "__cpp_lib_nonmember_container_access should be defined in c++17"
+# endif
+# if __cpp_lib_nonmember_container_access != 201411L
+# error "__cpp_lib_nonmember_container_access should have the value 201411L in c++17"
+# endif
+
+# ifndef __cpp_lib_unordered_map_try_emplace
+# error "__cpp_lib_unordered_map_try_emplace should be defined in c++17"
+# endif
+# if __cpp_lib_unordered_map_try_emplace != 201411L
+# error "__cpp_lib_unordered_map_try_emplace should have the value 201411L in c++17"
+# endif
+
+#elif TEST_STD_VER > 17
+
+# ifndef __cpp_lib_allocator_traits_is_always_equal
+# error "__cpp_lib_allocator_traits_is_always_equal should be defined in c++2a"
+# endif
+# if __cpp_lib_allocator_traits_is_always_equal != 201411L
+# error "__cpp_lib_allocator_traits_is_always_equal should have the value 201411L in c++2a"
+# endif
+
+# ifndef __cpp_lib_erase_if
+# error "__cpp_lib_erase_if should be defined in c++2a"
+# endif
+# if __cpp_lib_erase_if != 201811L
+# error "__cpp_lib_erase_if should have the value 201811L in c++2a"
+# endif
+
+# if !defined(_LIBCPP_VERSION)
+# ifndef __cpp_lib_generic_unordered_lookup
+# error "__cpp_lib_generic_unordered_lookup should be defined in c++2a"
+# endif
+# if __cpp_lib_generic_unordered_lookup != 201811L
+# error "__cpp_lib_generic_unordered_lookup should have the value 201811L in c++2a"
+# endif
+# else // _LIBCPP_VERSION
+# ifdef __cpp_lib_generic_unordered_lookup
+# error "__cpp_lib_generic_unordered_lookup should not be defined because it is unimplemented in libc++!"
+# endif
+# endif
+
+# ifndef __cpp_lib_node_extract
+# error "__cpp_lib_node_extract should be defined in c++2a"
+# endif
+# if __cpp_lib_node_extract != 201606L
+# error "__cpp_lib_node_extract should have the value 201606L in c++2a"
+# endif
+
+# ifndef __cpp_lib_nonmember_container_access
+# error "__cpp_lib_nonmember_container_access should be defined in c++2a"
+# endif
+# if __cpp_lib_nonmember_container_access != 201411L
+# error "__cpp_lib_nonmember_container_access should have the value 201411L in c++2a"
+# endif
+
+# ifndef __cpp_lib_unordered_map_try_emplace
+# error "__cpp_lib_unordered_map_try_emplace should be defined in c++2a"
+# endif
+# if __cpp_lib_unordered_map_try_emplace != 201411L
+# error "__cpp_lib_unordered_map_try_emplace should have the value 201411L in c++2a"
+# endif
+
+#endif // TEST_STD_VER > 17
+
+int main() {}
diff --git a/test/std/language.support/support.limits/support.limits.general/unordered_set.version.pass.cpp b/test/std/language.support/support.limits/support.limits.general/unordered_set.version.pass.cpp
new file mode 100644
index 0000000000000..3153afd254cc1
--- /dev/null
+++ b/test/std/language.support/support.limits/support.limits.general/unordered_set.version.pass.cpp
@@ -0,0 +1,148 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+//
+// WARNING: This test was generated by generate_feature_test_macro_components.py
+// and should not be edited manually.
+
+// <unordered_set>
+
+// Test the feature test macros defined by <unordered_set>
+
+/* Constant Value
+ __cpp_lib_allocator_traits_is_always_equal 201411L [C++17]
+ __cpp_lib_erase_if 201811L [C++2a]
+ __cpp_lib_generic_unordered_lookup 201811L [C++2a]
+ __cpp_lib_node_extract 201606L [C++17]
+ __cpp_lib_nonmember_container_access 201411L [C++17]
+*/
+
+#include <unordered_set>
+#include "test_macros.h"
+
+#if TEST_STD_VER < 14
+
+# ifdef __cpp_lib_allocator_traits_is_always_equal
+# error "__cpp_lib_allocator_traits_is_always_equal should not be defined before c++17"
+# endif
+
+# ifdef __cpp_lib_erase_if
+# error "__cpp_lib_erase_if should not be defined before c++2a"
+# endif
+
+# ifdef __cpp_lib_generic_unordered_lookup
+# error "__cpp_lib_generic_unordered_lookup should not be defined before c++2a"
+# endif
+
+# ifdef __cpp_lib_node_extract
+# error "__cpp_lib_node_extract should not be defined before c++17"
+# endif
+
+# ifdef __cpp_lib_nonmember_container_access
+# error "__cpp_lib_nonmember_container_access should not be defined before c++17"
+# endif
+
+#elif TEST_STD_VER == 14
+
+# ifdef __cpp_lib_allocator_traits_is_always_equal
+# error "__cpp_lib_allocator_traits_is_always_equal should not be defined before c++17"
+# endif
+
+# ifdef __cpp_lib_erase_if
+# error "__cpp_lib_erase_if should not be defined before c++2a"
+# endif
+
+# ifdef __cpp_lib_generic_unordered_lookup
+# error "__cpp_lib_generic_unordered_lookup should not be defined before c++2a"
+# endif
+
+# ifdef __cpp_lib_node_extract
+# error "__cpp_lib_node_extract should not be defined before c++17"
+# endif
+
+# ifdef __cpp_lib_nonmember_container_access
+# error "__cpp_lib_nonmember_container_access should not be defined before c++17"
+# endif
+
+#elif TEST_STD_VER == 17
+
+# ifndef __cpp_lib_allocator_traits_is_always_equal
+# error "__cpp_lib_allocator_traits_is_always_equal should be defined in c++17"
+# endif
+# if __cpp_lib_allocator_traits_is_always_equal != 201411L
+# error "__cpp_lib_allocator_traits_is_always_equal should have the value 201411L in c++17"
+# endif
+
+# ifdef __cpp_lib_erase_if
+# error "__cpp_lib_erase_if should not be defined before c++2a"
+# endif
+
+# ifdef __cpp_lib_generic_unordered_lookup
+# error "__cpp_lib_generic_unordered_lookup should not be defined before c++2a"
+# endif
+
+# ifndef __cpp_lib_node_extract
+# error "__cpp_lib_node_extract should be defined in c++17"
+# endif
+# if __cpp_lib_node_extract != 201606L
+# error "__cpp_lib_node_extract should have the value 201606L in c++17"
+# endif
+
+# ifndef __cpp_lib_nonmember_container_access
+# error "__cpp_lib_nonmember_container_access should be defined in c++17"
+# endif
+# if __cpp_lib_nonmember_container_access != 201411L
+# error "__cpp_lib_nonmember_container_access should have the value 201411L in c++17"
+# endif
+
+#elif TEST_STD_VER > 17
+
+# ifndef __cpp_lib_allocator_traits_is_always_equal
+# error "__cpp_lib_allocator_traits_is_always_equal should be defined in c++2a"
+# endif
+# if __cpp_lib_allocator_traits_is_always_equal != 201411L
+# error "__cpp_lib_allocator_traits_is_always_equal should have the value 201411L in c++2a"
+# endif
+
+# ifndef __cpp_lib_erase_if
+# error "__cpp_lib_erase_if should be defined in c++2a"
+# endif
+# if __cpp_lib_erase_if != 201811L
+# error "__cpp_lib_erase_if should have the value 201811L in c++2a"
+# endif
+
+# if !defined(_LIBCPP_VERSION)
+# ifndef __cpp_lib_generic_unordered_lookup
+# error "__cpp_lib_generic_unordered_lookup should be defined in c++2a"
+# endif
+# if __cpp_lib_generic_unordered_lookup != 201811L
+# error "__cpp_lib_generic_unordered_lookup should have the value 201811L in c++2a"
+# endif
+# else // _LIBCPP_VERSION
+# ifdef __cpp_lib_generic_unordered_lookup
+# error "__cpp_lib_generic_unordered_lookup should not be defined because it is unimplemented in libc++!"
+# endif
+# endif
+
+# ifndef __cpp_lib_node_extract
+# error "__cpp_lib_node_extract should be defined in c++2a"
+# endif
+# if __cpp_lib_node_extract != 201606L
+# error "__cpp_lib_node_extract should have the value 201606L in c++2a"
+# endif
+
+# ifndef __cpp_lib_nonmember_container_access
+# error "__cpp_lib_nonmember_container_access should be defined in c++2a"
+# endif
+# if __cpp_lib_nonmember_container_access != 201411L
+# error "__cpp_lib_nonmember_container_access should have the value 201411L in c++2a"
+# endif
+
+#endif // TEST_STD_VER > 17
+
+int main() {}
diff --git a/test/std/language.support/support.limits/support.limits.general/utility.version.pass.cpp b/test/std/language.support/support.limits/support.limits.general/utility.version.pass.cpp
new file mode 100644
index 0000000000000..94bdb824a5d31
--- /dev/null
+++ b/test/std/language.support/support.limits/support.limits.general/utility.version.pass.cpp
@@ -0,0 +1,195 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+//
+// WARNING: This test was generated by generate_feature_test_macro_components.py
+// and should not be edited manually.
+
+// <utility>
+
+// Test the feature test macros defined by <utility>
+
+/* Constant Value
+ __cpp_lib_as_const 201510L [C++17]
+ __cpp_lib_constexpr_misc 201811L [C++2a]
+ __cpp_lib_exchange_function 201304L [C++14]
+ __cpp_lib_integer_sequence 201304L [C++14]
+ __cpp_lib_to_chars 201611L [C++17]
+ __cpp_lib_tuples_by_type 201304L [C++14]
+*/
+
+#include <utility>
+#include "test_macros.h"
+
+#if TEST_STD_VER < 14
+
+# ifdef __cpp_lib_as_const
+# error "__cpp_lib_as_const should not be defined before c++17"
+# endif
+
+# ifdef __cpp_lib_constexpr_misc
+# error "__cpp_lib_constexpr_misc should not be defined before c++2a"
+# endif
+
+# ifdef __cpp_lib_exchange_function
+# error "__cpp_lib_exchange_function should not be defined before c++14"
+# endif
+
+# ifdef __cpp_lib_integer_sequence
+# error "__cpp_lib_integer_sequence should not be defined before c++14"
+# endif
+
+# ifdef __cpp_lib_to_chars
+# error "__cpp_lib_to_chars should not be defined before c++17"
+# endif
+
+# ifdef __cpp_lib_tuples_by_type
+# error "__cpp_lib_tuples_by_type should not be defined before c++14"
+# endif
+
+#elif TEST_STD_VER == 14
+
+# ifdef __cpp_lib_as_const
+# error "__cpp_lib_as_const should not be defined before c++17"
+# endif
+
+# ifdef __cpp_lib_constexpr_misc
+# error "__cpp_lib_constexpr_misc should not be defined before c++2a"
+# endif
+
+# ifndef __cpp_lib_exchange_function
+# error "__cpp_lib_exchange_function should be defined in c++14"
+# endif
+# if __cpp_lib_exchange_function != 201304L
+# error "__cpp_lib_exchange_function should have the value 201304L in c++14"
+# endif
+
+# ifndef __cpp_lib_integer_sequence
+# error "__cpp_lib_integer_sequence should be defined in c++14"
+# endif
+# if __cpp_lib_integer_sequence != 201304L
+# error "__cpp_lib_integer_sequence should have the value 201304L in c++14"
+# endif
+
+# ifdef __cpp_lib_to_chars
+# error "__cpp_lib_to_chars should not be defined before c++17"
+# endif
+
+# ifndef __cpp_lib_tuples_by_type
+# error "__cpp_lib_tuples_by_type should be defined in c++14"
+# endif
+# if __cpp_lib_tuples_by_type != 201304L
+# error "__cpp_lib_tuples_by_type should have the value 201304L in c++14"
+# endif
+
+#elif TEST_STD_VER == 17
+
+# ifndef __cpp_lib_as_const
+# error "__cpp_lib_as_const should be defined in c++17"
+# endif
+# if __cpp_lib_as_const != 201510L
+# error "__cpp_lib_as_const should have the value 201510L in c++17"
+# endif
+
+# ifdef __cpp_lib_constexpr_misc
+# error "__cpp_lib_constexpr_misc should not be defined before c++2a"
+# endif
+
+# ifndef __cpp_lib_exchange_function
+# error "__cpp_lib_exchange_function should be defined in c++17"
+# endif
+# if __cpp_lib_exchange_function != 201304L
+# error "__cpp_lib_exchange_function should have the value 201304L in c++17"
+# endif
+
+# ifndef __cpp_lib_integer_sequence
+# error "__cpp_lib_integer_sequence should be defined in c++17"
+# endif
+# if __cpp_lib_integer_sequence != 201304L
+# error "__cpp_lib_integer_sequence should have the value 201304L in c++17"
+# endif
+
+# if !defined(_LIBCPP_VERSION)
+# ifndef __cpp_lib_to_chars
+# error "__cpp_lib_to_chars should be defined in c++17"
+# endif
+# if __cpp_lib_to_chars != 201611L
+# error "__cpp_lib_to_chars should have the value 201611L in c++17"
+# endif
+# else // _LIBCPP_VERSION
+# ifdef __cpp_lib_to_chars
+# error "__cpp_lib_to_chars should not be defined because it is unimplemented in libc++!"
+# endif
+# endif
+
+# ifndef __cpp_lib_tuples_by_type
+# error "__cpp_lib_tuples_by_type should be defined in c++17"
+# endif
+# if __cpp_lib_tuples_by_type != 201304L
+# error "__cpp_lib_tuples_by_type should have the value 201304L in c++17"
+# endif
+
+#elif TEST_STD_VER > 17
+
+# ifndef __cpp_lib_as_const
+# error "__cpp_lib_as_const should be defined in c++2a"
+# endif
+# if __cpp_lib_as_const != 201510L
+# error "__cpp_lib_as_const should have the value 201510L in c++2a"
+# endif
+
+# if !defined(_LIBCPP_VERSION)
+# ifndef __cpp_lib_constexpr_misc
+# error "__cpp_lib_constexpr_misc should be defined in c++2a"
+# endif
+# if __cpp_lib_constexpr_misc != 201811L
+# error "__cpp_lib_constexpr_misc should have the value 201811L in c++2a"
+# endif
+# else // _LIBCPP_VERSION
+# ifdef __cpp_lib_constexpr_misc
+# error "__cpp_lib_constexpr_misc should not be defined because it is unimplemented in libc++!"
+# endif
+# endif
+
+# ifndef __cpp_lib_exchange_function
+# error "__cpp_lib_exchange_function should be defined in c++2a"
+# endif
+# if __cpp_lib_exchange_function != 201304L
+# error "__cpp_lib_exchange_function should have the value 201304L in c++2a"
+# endif
+
+# ifndef __cpp_lib_integer_sequence
+# error "__cpp_lib_integer_sequence should be defined in c++2a"
+# endif
+# if __cpp_lib_integer_sequence != 201304L
+# error "__cpp_lib_integer_sequence should have the value 201304L in c++2a"
+# endif
+
+# if !defined(_LIBCPP_VERSION)
+# ifndef __cpp_lib_to_chars
+# error "__cpp_lib_to_chars should be defined in c++2a"
+# endif
+# if __cpp_lib_to_chars != 201611L
+# error "__cpp_lib_to_chars should have the value 201611L in c++2a"
+# endif
+# else // _LIBCPP_VERSION
+# ifdef __cpp_lib_to_chars
+# error "__cpp_lib_to_chars should not be defined because it is unimplemented in libc++!"
+# endif
+# endif
+
+# ifndef __cpp_lib_tuples_by_type
+# error "__cpp_lib_tuples_by_type should be defined in c++2a"
+# endif
+# if __cpp_lib_tuples_by_type != 201304L
+# error "__cpp_lib_tuples_by_type should have the value 201304L in c++2a"
+# endif
+
+#endif // TEST_STD_VER > 17
+
+int main() {}
diff --git a/test/std/language.support/support.limits/support.limits.general/variant.version.pass.cpp b/test/std/language.support/support.limits/support.limits.general/variant.version.pass.cpp
new file mode 100644
index 0000000000000..d4ef3d7e0fcfa
--- /dev/null
+++ b/test/std/language.support/support.limits/support.limits.general/variant.version.pass.cpp
@@ -0,0 +1,56 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+//
+// WARNING: This test was generated by generate_feature_test_macro_components.py
+// and should not be edited manually.
+
+// <variant>
+
+// Test the feature test macros defined by <variant>
+
+/* Constant Value
+ __cpp_lib_variant 201606L [C++17]
+*/
+
+#include <variant>
+#include "test_macros.h"
+
+#if TEST_STD_VER < 14
+
+# ifdef __cpp_lib_variant
+# error "__cpp_lib_variant should not be defined before c++17"
+# endif
+
+#elif TEST_STD_VER == 14
+
+# ifdef __cpp_lib_variant
+# error "__cpp_lib_variant should not be defined before c++17"
+# endif
+
+#elif TEST_STD_VER == 17
+
+# ifndef __cpp_lib_variant
+# error "__cpp_lib_variant should be defined in c++17"
+# endif
+# if __cpp_lib_variant != 201606L
+# error "__cpp_lib_variant should have the value 201606L in c++17"
+# endif
+
+#elif TEST_STD_VER > 17
+
+# ifndef __cpp_lib_variant
+# error "__cpp_lib_variant should be defined in c++2a"
+# endif
+# if __cpp_lib_variant != 201606L
+# error "__cpp_lib_variant should have the value 201606L in c++2a"
+# endif
+
+#endif // TEST_STD_VER > 17
+
+int main() {}
diff --git a/test/std/language.support/support.limits/support.limits.general/vector.version.pass.cpp b/test/std/language.support/support.limits/support.limits.general/vector.version.pass.cpp
new file mode 100644
index 0000000000000..5cdeca06b5d08
--- /dev/null
+++ b/test/std/language.support/support.limits/support.limits.general/vector.version.pass.cpp
@@ -0,0 +1,122 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+//
+// WARNING: This test was generated by generate_feature_test_macro_components.py
+// and should not be edited manually.
+
+// <vector>
+
+// Test the feature test macros defined by <vector>
+
+/* Constant Value
+ __cpp_lib_allocator_traits_is_always_equal 201411L [C++17]
+ __cpp_lib_erase_if 201811L [C++2a]
+ __cpp_lib_incomplete_container_elements 201505L [C++17]
+ __cpp_lib_nonmember_container_access 201411L [C++17]
+*/
+
+#include <vector>
+#include "test_macros.h"
+
+#if TEST_STD_VER < 14
+
+# ifdef __cpp_lib_allocator_traits_is_always_equal
+# error "__cpp_lib_allocator_traits_is_always_equal should not be defined before c++17"
+# endif
+
+# ifdef __cpp_lib_erase_if
+# error "__cpp_lib_erase_if should not be defined before c++2a"
+# endif
+
+# ifdef __cpp_lib_incomplete_container_elements
+# error "__cpp_lib_incomplete_container_elements should not be defined before c++17"
+# endif
+
+# ifdef __cpp_lib_nonmember_container_access
+# error "__cpp_lib_nonmember_container_access should not be defined before c++17"
+# endif
+
+#elif TEST_STD_VER == 14
+
+# ifdef __cpp_lib_allocator_traits_is_always_equal
+# error "__cpp_lib_allocator_traits_is_always_equal should not be defined before c++17"
+# endif
+
+# ifdef __cpp_lib_erase_if
+# error "__cpp_lib_erase_if should not be defined before c++2a"
+# endif
+
+# ifdef __cpp_lib_incomplete_container_elements
+# error "__cpp_lib_incomplete_container_elements should not be defined before c++17"
+# endif
+
+# ifdef __cpp_lib_nonmember_container_access
+# error "__cpp_lib_nonmember_container_access should not be defined before c++17"
+# endif
+
+#elif TEST_STD_VER == 17
+
+# ifndef __cpp_lib_allocator_traits_is_always_equal
+# error "__cpp_lib_allocator_traits_is_always_equal should be defined in c++17"
+# endif
+# if __cpp_lib_allocator_traits_is_always_equal != 201411L
+# error "__cpp_lib_allocator_traits_is_always_equal should have the value 201411L in c++17"
+# endif
+
+# ifdef __cpp_lib_erase_if
+# error "__cpp_lib_erase_if should not be defined before c++2a"
+# endif
+
+# ifndef __cpp_lib_incomplete_container_elements
+# error "__cpp_lib_incomplete_container_elements should be defined in c++17"
+# endif
+# if __cpp_lib_incomplete_container_elements != 201505L
+# error "__cpp_lib_incomplete_container_elements should have the value 201505L in c++17"
+# endif
+
+# ifndef __cpp_lib_nonmember_container_access
+# error "__cpp_lib_nonmember_container_access should be defined in c++17"
+# endif
+# if __cpp_lib_nonmember_container_access != 201411L
+# error "__cpp_lib_nonmember_container_access should have the value 201411L in c++17"
+# endif
+
+#elif TEST_STD_VER > 17
+
+# ifndef __cpp_lib_allocator_traits_is_always_equal
+# error "__cpp_lib_allocator_traits_is_always_equal should be defined in c++2a"
+# endif
+# if __cpp_lib_allocator_traits_is_always_equal != 201411L
+# error "__cpp_lib_allocator_traits_is_always_equal should have the value 201411L in c++2a"
+# endif
+
+# ifndef __cpp_lib_erase_if
+# error "__cpp_lib_erase_if should be defined in c++2a"
+# endif
+# if __cpp_lib_erase_if != 201811L
+# error "__cpp_lib_erase_if should have the value 201811L in c++2a"
+# endif
+
+# ifndef __cpp_lib_incomplete_container_elements
+# error "__cpp_lib_incomplete_container_elements should be defined in c++2a"
+# endif
+# if __cpp_lib_incomplete_container_elements != 201505L
+# error "__cpp_lib_incomplete_container_elements should have the value 201505L in c++2a"
+# endif
+
+# ifndef __cpp_lib_nonmember_container_access
+# error "__cpp_lib_nonmember_container_access should be defined in c++2a"
+# endif
+# if __cpp_lib_nonmember_container_access != 201411L
+# error "__cpp_lib_nonmember_container_access should have the value 201411L in c++2a"
+# endif
+
+#endif // TEST_STD_VER > 17
+
+int main() {}
diff --git a/test/std/language.support/support.limits/support.limits.general/version.version.pass.cpp b/test/std/language.support/support.limits/support.limits.general/version.version.pass.cpp
new file mode 100644
index 0000000000000..5fa996967c0f1
--- /dev/null
+++ b/test/std/language.support/support.limits/support.limits.general/version.version.pass.cpp
@@ -0,0 +1,2178 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+//
+// WARNING: This test was generated by generate_feature_test_macro_components.py
+// and should not be edited manually.
+
+// <version>
+
+// Test the feature test macros defined by <version>
+
+/* Constant Value
+ __cpp_lib_addressof_constexpr 201603L [C++17]
+ __cpp_lib_allocator_traits_is_always_equal 201411L [C++17]
+ __cpp_lib_any 201606L [C++17]
+ __cpp_lib_apply 201603L [C++17]
+ __cpp_lib_array_constexpr 201603L [C++17]
+ __cpp_lib_as_const 201510L [C++17]
+ __cpp_lib_atomic_is_always_lock_free 201603L [C++17]
+ __cpp_lib_atomic_ref 201806L [C++2a]
+ __cpp_lib_bind_front 201811L [C++2a]
+ __cpp_lib_bit_cast 201806L [C++2a]
+ __cpp_lib_bool_constant 201505L [C++17]
+ __cpp_lib_boyer_moore_searcher 201603L [C++17]
+ __cpp_lib_byte 201603L [C++17]
+ __cpp_lib_char8_t 201811L [C++2a]
+ __cpp_lib_chrono 201611L [C++17]
+ __cpp_lib_chrono_udls 201304L [C++14]
+ __cpp_lib_clamp 201603L [C++17]
+ __cpp_lib_complex_udls 201309L [C++14]
+ __cpp_lib_concepts 201806L [C++2a]
+ __cpp_lib_constexpr_misc 201811L [C++2a]
+ __cpp_lib_constexpr_swap_algorithms 201806L [C++2a]
+ __cpp_lib_destroying_delete 201806L [C++2a]
+ __cpp_lib_enable_shared_from_this 201603L [C++17]
+ __cpp_lib_erase_if 201811L [C++2a]
+ __cpp_lib_exchange_function 201304L [C++14]
+ __cpp_lib_execution 201603L [C++17]
+ __cpp_lib_filesystem 201703L [C++17]
+ __cpp_lib_gcd_lcm 201606L [C++17]
+ __cpp_lib_generic_associative_lookup 201304L [C++14]
+ __cpp_lib_generic_unordered_lookup 201811L [C++2a]
+ __cpp_lib_hardware_interference_size 201703L [C++17]
+ __cpp_lib_has_unique_object_representations 201606L [C++17]
+ __cpp_lib_hypot 201603L [C++17]
+ __cpp_lib_incomplete_container_elements 201505L [C++17]
+ __cpp_lib_integer_sequence 201304L [C++14]
+ __cpp_lib_integral_constant_callable 201304L [C++14]
+ __cpp_lib_invoke 201411L [C++17]
+ __cpp_lib_is_aggregate 201703L [C++17]
+ __cpp_lib_is_constant_evaluated 201811L [C++2a]
+ __cpp_lib_is_final 201402L [C++14]
+ __cpp_lib_is_invocable 201703L [C++17]
+ __cpp_lib_is_null_pointer 201309L [C++14]
+ __cpp_lib_is_swappable 201603L [C++17]
+ __cpp_lib_launder 201606L [C++17]
+ __cpp_lib_list_remove_return_type 201806L [C++2a]
+ __cpp_lib_logical_traits 201510L [C++17]
+ __cpp_lib_make_from_tuple 201606L [C++17]
+ __cpp_lib_make_reverse_iterator 201402L [C++14]
+ __cpp_lib_make_unique 201304L [C++14]
+ __cpp_lib_map_try_emplace 201411L [C++17]
+ __cpp_lib_math_special_functions 201603L [C++17]
+ __cpp_lib_memory_resource 201603L [C++17]
+ __cpp_lib_node_extract 201606L [C++17]
+ __cpp_lib_nonmember_container_access 201411L [C++17]
+ __cpp_lib_not_fn 201603L [C++17]
+ __cpp_lib_null_iterators 201304L [C++14]
+ __cpp_lib_optional 201606L [C++17]
+ __cpp_lib_parallel_algorithm 201603L [C++17]
+ __cpp_lib_quoted_string_io 201304L [C++14]
+ __cpp_lib_ranges 201811L [C++2a]
+ __cpp_lib_raw_memory_algorithms 201606L [C++17]
+ __cpp_lib_result_of_sfinae 201210L [C++14]
+ __cpp_lib_robust_nonmodifying_seq_ops 201304L [C++14]
+ __cpp_lib_sample 201603L [C++17]
+ __cpp_lib_scoped_lock 201703L [C++17]
+ __cpp_lib_shared_mutex 201505L [C++17]
+ __cpp_lib_shared_ptr_arrays 201611L [C++17]
+ __cpp_lib_shared_ptr_weak_type 201606L [C++17]
+ __cpp_lib_shared_timed_mutex 201402L [C++14]
+ __cpp_lib_string_udls 201304L [C++14]
+ __cpp_lib_string_view 201606L [C++17]
+ __cpp_lib_three_way_comparison 201711L [C++2a]
+ __cpp_lib_to_chars 201611L [C++17]
+ __cpp_lib_transformation_trait_aliases 201304L [C++14]
+ __cpp_lib_transparent_operators 201210L [C++14]
+ 201510L [C++17]
+ __cpp_lib_tuple_element_t 201402L [C++14]
+ __cpp_lib_tuples_by_type 201304L [C++14]
+ __cpp_lib_type_trait_variable_templates 201510L [C++17]
+ __cpp_lib_uncaught_exceptions 201411L [C++17]
+ __cpp_lib_unordered_map_try_emplace 201411L [C++17]
+ __cpp_lib_variant 201606L [C++17]
+ __cpp_lib_void_t 201411L [C++17]
+*/
+
+#include <version>
+#include "test_macros.h"
+
+#if TEST_STD_VER < 14
+
+# ifdef __cpp_lib_addressof_constexpr
+# error "__cpp_lib_addressof_constexpr should not be defined before c++17"
+# endif
+
+# ifdef __cpp_lib_allocator_traits_is_always_equal
+# error "__cpp_lib_allocator_traits_is_always_equal should not be defined before c++17"
+# endif
+
+# ifdef __cpp_lib_any
+# error "__cpp_lib_any should not be defined before c++17"
+# endif
+
+# ifdef __cpp_lib_apply
+# error "__cpp_lib_apply should not be defined before c++17"
+# endif
+
+# ifdef __cpp_lib_array_constexpr
+# error "__cpp_lib_array_constexpr should not be defined before c++17"
+# endif
+
+# ifdef __cpp_lib_as_const
+# error "__cpp_lib_as_const should not be defined before c++17"
+# endif
+
+# ifdef __cpp_lib_atomic_is_always_lock_free
+# error "__cpp_lib_atomic_is_always_lock_free should not be defined before c++17"
+# endif
+
+# ifdef __cpp_lib_atomic_ref
+# error "__cpp_lib_atomic_ref should not be defined before c++2a"
+# endif
+
+# ifdef __cpp_lib_bind_front
+# error "__cpp_lib_bind_front should not be defined before c++2a"
+# endif
+
+# ifdef __cpp_lib_bit_cast
+# error "__cpp_lib_bit_cast should not be defined before c++2a"
+# endif
+
+# ifdef __cpp_lib_bool_constant
+# error "__cpp_lib_bool_constant should not be defined before c++17"
+# endif
+
+# ifdef __cpp_lib_boyer_moore_searcher
+# error "__cpp_lib_boyer_moore_searcher should not be defined before c++17"
+# endif
+
+# ifdef __cpp_lib_byte
+# error "__cpp_lib_byte should not be defined before c++17"
+# endif
+
+# ifdef __cpp_lib_char8_t
+# error "__cpp_lib_char8_t should not be defined before c++2a"
+# endif
+
+# ifdef __cpp_lib_chrono
+# error "__cpp_lib_chrono should not be defined before c++17"
+# endif
+
+# ifdef __cpp_lib_chrono_udls
+# error "__cpp_lib_chrono_udls should not be defined before c++14"
+# endif
+
+# ifdef __cpp_lib_clamp
+# error "__cpp_lib_clamp should not be defined before c++17"
+# endif
+
+# ifdef __cpp_lib_complex_udls
+# error "__cpp_lib_complex_udls should not be defined before c++14"
+# endif
+
+# ifdef __cpp_lib_concepts
+# error "__cpp_lib_concepts should not be defined before c++2a"
+# endif
+
+# ifdef __cpp_lib_constexpr_misc
+# error "__cpp_lib_constexpr_misc should not be defined before c++2a"
+# endif
+
+# ifdef __cpp_lib_constexpr_swap_algorithms
+# error "__cpp_lib_constexpr_swap_algorithms should not be defined before c++2a"
+# endif
+
+# ifdef __cpp_lib_destroying_delete
+# error "__cpp_lib_destroying_delete should not be defined before c++2a"
+# endif
+
+# ifdef __cpp_lib_enable_shared_from_this
+# error "__cpp_lib_enable_shared_from_this should not be defined before c++17"
+# endif
+
+# ifdef __cpp_lib_erase_if
+# error "__cpp_lib_erase_if should not be defined before c++2a"
+# endif
+
+# ifdef __cpp_lib_exchange_function
+# error "__cpp_lib_exchange_function should not be defined before c++14"
+# endif
+
+# ifdef __cpp_lib_execution
+# error "__cpp_lib_execution should not be defined before c++17"
+# endif
+
+# ifdef __cpp_lib_filesystem
+# error "__cpp_lib_filesystem should not be defined before c++17"
+# endif
+
+# ifdef __cpp_lib_gcd_lcm
+# error "__cpp_lib_gcd_lcm should not be defined before c++17"
+# endif
+
+# ifdef __cpp_lib_generic_associative_lookup
+# error "__cpp_lib_generic_associative_lookup should not be defined before c++14"
+# endif
+
+# ifdef __cpp_lib_generic_unordered_lookup
+# error "__cpp_lib_generic_unordered_lookup should not be defined before c++2a"
+# endif
+
+# ifdef __cpp_lib_hardware_interference_size
+# error "__cpp_lib_hardware_interference_size should not be defined before c++17"
+# endif
+
+# ifdef __cpp_lib_has_unique_object_representations
+# error "__cpp_lib_has_unique_object_representations should not be defined before c++17"
+# endif
+
+# ifdef __cpp_lib_hypot
+# error "__cpp_lib_hypot should not be defined before c++17"
+# endif
+
+# ifdef __cpp_lib_incomplete_container_elements
+# error "__cpp_lib_incomplete_container_elements should not be defined before c++17"
+# endif
+
+# ifdef __cpp_lib_integer_sequence
+# error "__cpp_lib_integer_sequence should not be defined before c++14"
+# endif
+
+# ifdef __cpp_lib_integral_constant_callable
+# error "__cpp_lib_integral_constant_callable should not be defined before c++14"
+# endif
+
+# ifdef __cpp_lib_invoke
+# error "__cpp_lib_invoke should not be defined before c++17"
+# endif
+
+# ifdef __cpp_lib_is_aggregate
+# error "__cpp_lib_is_aggregate should not be defined before c++17"
+# endif
+
+# ifdef __cpp_lib_is_constant_evaluated
+# error "__cpp_lib_is_constant_evaluated should not be defined before c++2a"
+# endif
+
+# ifdef __cpp_lib_is_final
+# error "__cpp_lib_is_final should not be defined before c++14"
+# endif
+
+# ifdef __cpp_lib_is_invocable
+# error "__cpp_lib_is_invocable should not be defined before c++17"
+# endif
+
+# ifdef __cpp_lib_is_null_pointer
+# error "__cpp_lib_is_null_pointer should not be defined before c++14"
+# endif
+
+# ifdef __cpp_lib_is_swappable
+# error "__cpp_lib_is_swappable should not be defined before c++17"
+# endif
+
+# ifdef __cpp_lib_launder
+# error "__cpp_lib_launder should not be defined before c++17"
+# endif
+
+# ifdef __cpp_lib_list_remove_return_type
+# error "__cpp_lib_list_remove_return_type should not be defined before c++2a"
+# endif
+
+# ifdef __cpp_lib_logical_traits
+# error "__cpp_lib_logical_traits should not be defined before c++17"
+# endif
+
+# ifdef __cpp_lib_make_from_tuple
+# error "__cpp_lib_make_from_tuple should not be defined before c++17"
+# endif
+
+# ifdef __cpp_lib_make_reverse_iterator
+# error "__cpp_lib_make_reverse_iterator should not be defined before c++14"
+# endif
+
+# ifdef __cpp_lib_make_unique
+# error "__cpp_lib_make_unique should not be defined before c++14"
+# endif
+
+# ifdef __cpp_lib_map_try_emplace
+# error "__cpp_lib_map_try_emplace should not be defined before c++17"
+# endif
+
+# ifdef __cpp_lib_math_special_functions
+# error "__cpp_lib_math_special_functions should not be defined before c++17"
+# endif
+
+# ifdef __cpp_lib_memory_resource
+# error "__cpp_lib_memory_resource should not be defined before c++17"
+# endif
+
+# ifdef __cpp_lib_node_extract
+# error "__cpp_lib_node_extract should not be defined before c++17"
+# endif
+
+# ifdef __cpp_lib_nonmember_container_access
+# error "__cpp_lib_nonmember_container_access should not be defined before c++17"
+# endif
+
+# ifdef __cpp_lib_not_fn
+# error "__cpp_lib_not_fn should not be defined before c++17"
+# endif
+
+# ifdef __cpp_lib_null_iterators
+# error "__cpp_lib_null_iterators should not be defined before c++14"
+# endif
+
+# ifdef __cpp_lib_optional
+# error "__cpp_lib_optional should not be defined before c++17"
+# endif
+
+# ifdef __cpp_lib_parallel_algorithm
+# error "__cpp_lib_parallel_algorithm should not be defined before c++17"
+# endif
+
+# ifdef __cpp_lib_quoted_string_io
+# error "__cpp_lib_quoted_string_io should not be defined before c++14"
+# endif
+
+# ifdef __cpp_lib_ranges
+# error "__cpp_lib_ranges should not be defined before c++2a"
+# endif
+
+# ifdef __cpp_lib_raw_memory_algorithms
+# error "__cpp_lib_raw_memory_algorithms should not be defined before c++17"
+# endif
+
+# ifdef __cpp_lib_result_of_sfinae
+# error "__cpp_lib_result_of_sfinae should not be defined before c++14"
+# endif
+
+# ifdef __cpp_lib_robust_nonmodifying_seq_ops
+# error "__cpp_lib_robust_nonmodifying_seq_ops should not be defined before c++14"
+# endif
+
+# ifdef __cpp_lib_sample
+# error "__cpp_lib_sample should not be defined before c++17"
+# endif
+
+# ifdef __cpp_lib_scoped_lock
+# error "__cpp_lib_scoped_lock should not be defined before c++17"
+# endif
+
+# ifdef __cpp_lib_shared_mutex
+# error "__cpp_lib_shared_mutex should not be defined before c++17"
+# endif
+
+# ifdef __cpp_lib_shared_ptr_arrays
+# error "__cpp_lib_shared_ptr_arrays should not be defined before c++17"
+# endif
+
+# ifdef __cpp_lib_shared_ptr_weak_type
+# error "__cpp_lib_shared_ptr_weak_type should not be defined before c++17"
+# endif
+
+# ifdef __cpp_lib_shared_timed_mutex
+# error "__cpp_lib_shared_timed_mutex should not be defined before c++14"
+# endif
+
+# ifdef __cpp_lib_string_udls
+# error "__cpp_lib_string_udls should not be defined before c++14"
+# endif
+
+# ifdef __cpp_lib_string_view
+# error "__cpp_lib_string_view should not be defined before c++17"
+# endif
+
+# ifdef __cpp_lib_three_way_comparison
+# error "__cpp_lib_three_way_comparison should not be defined before c++2a"
+# endif
+
+# ifdef __cpp_lib_to_chars
+# error "__cpp_lib_to_chars should not be defined before c++17"
+# endif
+
+# ifdef __cpp_lib_transformation_trait_aliases
+# error "__cpp_lib_transformation_trait_aliases should not be defined before c++14"
+# endif
+
+# ifdef __cpp_lib_transparent_operators
+# error "__cpp_lib_transparent_operators should not be defined before c++14"
+# endif
+
+# ifdef __cpp_lib_tuple_element_t
+# error "__cpp_lib_tuple_element_t should not be defined before c++14"
+# endif
+
+# ifdef __cpp_lib_tuples_by_type
+# error "__cpp_lib_tuples_by_type should not be defined before c++14"
+# endif
+
+# ifdef __cpp_lib_type_trait_variable_templates
+# error "__cpp_lib_type_trait_variable_templates should not be defined before c++17"
+# endif
+
+# ifdef __cpp_lib_uncaught_exceptions
+# error "__cpp_lib_uncaught_exceptions should not be defined before c++17"
+# endif
+
+# ifdef __cpp_lib_unordered_map_try_emplace
+# error "__cpp_lib_unordered_map_try_emplace should not be defined before c++17"
+# endif
+
+# ifdef __cpp_lib_variant
+# error "__cpp_lib_variant should not be defined before c++17"
+# endif
+
+# ifdef __cpp_lib_void_t
+# error "__cpp_lib_void_t should not be defined before c++17"
+# endif
+
+#elif TEST_STD_VER == 14
+
+# ifdef __cpp_lib_addressof_constexpr
+# error "__cpp_lib_addressof_constexpr should not be defined before c++17"
+# endif
+
+# ifdef __cpp_lib_allocator_traits_is_always_equal
+# error "__cpp_lib_allocator_traits_is_always_equal should not be defined before c++17"
+# endif
+
+# ifdef __cpp_lib_any
+# error "__cpp_lib_any should not be defined before c++17"
+# endif
+
+# ifdef __cpp_lib_apply
+# error "__cpp_lib_apply should not be defined before c++17"
+# endif
+
+# ifdef __cpp_lib_array_constexpr
+# error "__cpp_lib_array_constexpr should not be defined before c++17"
+# endif
+
+# ifdef __cpp_lib_as_const
+# error "__cpp_lib_as_const should not be defined before c++17"
+# endif
+
+# ifdef __cpp_lib_atomic_is_always_lock_free
+# error "__cpp_lib_atomic_is_always_lock_free should not be defined before c++17"
+# endif
+
+# ifdef __cpp_lib_atomic_ref
+# error "__cpp_lib_atomic_ref should not be defined before c++2a"
+# endif
+
+# ifdef __cpp_lib_bind_front
+# error "__cpp_lib_bind_front should not be defined before c++2a"
+# endif
+
+# ifdef __cpp_lib_bit_cast
+# error "__cpp_lib_bit_cast should not be defined before c++2a"
+# endif
+
+# ifdef __cpp_lib_bool_constant
+# error "__cpp_lib_bool_constant should not be defined before c++17"
+# endif
+
+# ifdef __cpp_lib_boyer_moore_searcher
+# error "__cpp_lib_boyer_moore_searcher should not be defined before c++17"
+# endif
+
+# ifdef __cpp_lib_byte
+# error "__cpp_lib_byte should not be defined before c++17"
+# endif
+
+# ifdef __cpp_lib_char8_t
+# error "__cpp_lib_char8_t should not be defined before c++2a"
+# endif
+
+# ifdef __cpp_lib_chrono
+# error "__cpp_lib_chrono should not be defined before c++17"
+# endif
+
+# ifndef __cpp_lib_chrono_udls
+# error "__cpp_lib_chrono_udls should be defined in c++14"
+# endif
+# if __cpp_lib_chrono_udls != 201304L
+# error "__cpp_lib_chrono_udls should have the value 201304L in c++14"
+# endif
+
+# ifdef __cpp_lib_clamp
+# error "__cpp_lib_clamp should not be defined before c++17"
+# endif
+
+# ifndef __cpp_lib_complex_udls
+# error "__cpp_lib_complex_udls should be defined in c++14"
+# endif
+# if __cpp_lib_complex_udls != 201309L
+# error "__cpp_lib_complex_udls should have the value 201309L in c++14"
+# endif
+
+# ifdef __cpp_lib_concepts
+# error "__cpp_lib_concepts should not be defined before c++2a"
+# endif
+
+# ifdef __cpp_lib_constexpr_misc
+# error "__cpp_lib_constexpr_misc should not be defined before c++2a"
+# endif
+
+# ifdef __cpp_lib_constexpr_swap_algorithms
+# error "__cpp_lib_constexpr_swap_algorithms should not be defined before c++2a"
+# endif
+
+# ifdef __cpp_lib_destroying_delete
+# error "__cpp_lib_destroying_delete should not be defined before c++2a"
+# endif
+
+# ifdef __cpp_lib_enable_shared_from_this
+# error "__cpp_lib_enable_shared_from_this should not be defined before c++17"
+# endif
+
+# ifdef __cpp_lib_erase_if
+# error "__cpp_lib_erase_if should not be defined before c++2a"
+# endif
+
+# ifndef __cpp_lib_exchange_function
+# error "__cpp_lib_exchange_function should be defined in c++14"
+# endif
+# if __cpp_lib_exchange_function != 201304L
+# error "__cpp_lib_exchange_function should have the value 201304L in c++14"
+# endif
+
+# ifdef __cpp_lib_execution
+# error "__cpp_lib_execution should not be defined before c++17"
+# endif
+
+# ifdef __cpp_lib_filesystem
+# error "__cpp_lib_filesystem should not be defined before c++17"
+# endif
+
+# ifdef __cpp_lib_gcd_lcm
+# error "__cpp_lib_gcd_lcm should not be defined before c++17"
+# endif
+
+# ifndef __cpp_lib_generic_associative_lookup
+# error "__cpp_lib_generic_associative_lookup should be defined in c++14"
+# endif
+# if __cpp_lib_generic_associative_lookup != 201304L
+# error "__cpp_lib_generic_associative_lookup should have the value 201304L in c++14"
+# endif
+
+# ifdef __cpp_lib_generic_unordered_lookup
+# error "__cpp_lib_generic_unordered_lookup should not be defined before c++2a"
+# endif
+
+# ifdef __cpp_lib_hardware_interference_size
+# error "__cpp_lib_hardware_interference_size should not be defined before c++17"
+# endif
+
+# ifdef __cpp_lib_has_unique_object_representations
+# error "__cpp_lib_has_unique_object_representations should not be defined before c++17"
+# endif
+
+# ifdef __cpp_lib_hypot
+# error "__cpp_lib_hypot should not be defined before c++17"
+# endif
+
+# ifdef __cpp_lib_incomplete_container_elements
+# error "__cpp_lib_incomplete_container_elements should not be defined before c++17"
+# endif
+
+# ifndef __cpp_lib_integer_sequence
+# error "__cpp_lib_integer_sequence should be defined in c++14"
+# endif
+# if __cpp_lib_integer_sequence != 201304L
+# error "__cpp_lib_integer_sequence should have the value 201304L in c++14"
+# endif
+
+# ifndef __cpp_lib_integral_constant_callable
+# error "__cpp_lib_integral_constant_callable should be defined in c++14"
+# endif
+# if __cpp_lib_integral_constant_callable != 201304L
+# error "__cpp_lib_integral_constant_callable should have the value 201304L in c++14"
+# endif
+
+# ifdef __cpp_lib_invoke
+# error "__cpp_lib_invoke should not be defined before c++17"
+# endif
+
+# ifdef __cpp_lib_is_aggregate
+# error "__cpp_lib_is_aggregate should not be defined before c++17"
+# endif
+
+# ifdef __cpp_lib_is_constant_evaluated
+# error "__cpp_lib_is_constant_evaluated should not be defined before c++2a"
+# endif
+
+# ifndef __cpp_lib_is_final
+# error "__cpp_lib_is_final should be defined in c++14"
+# endif
+# if __cpp_lib_is_final != 201402L
+# error "__cpp_lib_is_final should have the value 201402L in c++14"
+# endif
+
+# ifdef __cpp_lib_is_invocable
+# error "__cpp_lib_is_invocable should not be defined before c++17"
+# endif
+
+# ifndef __cpp_lib_is_null_pointer
+# error "__cpp_lib_is_null_pointer should be defined in c++14"
+# endif
+# if __cpp_lib_is_null_pointer != 201309L
+# error "__cpp_lib_is_null_pointer should have the value 201309L in c++14"
+# endif
+
+# ifdef __cpp_lib_is_swappable
+# error "__cpp_lib_is_swappable should not be defined before c++17"
+# endif
+
+# ifdef __cpp_lib_launder
+# error "__cpp_lib_launder should not be defined before c++17"
+# endif
+
+# ifdef __cpp_lib_list_remove_return_type
+# error "__cpp_lib_list_remove_return_type should not be defined before c++2a"
+# endif
+
+# ifdef __cpp_lib_logical_traits
+# error "__cpp_lib_logical_traits should not be defined before c++17"
+# endif
+
+# ifdef __cpp_lib_make_from_tuple
+# error "__cpp_lib_make_from_tuple should not be defined before c++17"
+# endif
+
+# ifndef __cpp_lib_make_reverse_iterator
+# error "__cpp_lib_make_reverse_iterator should be defined in c++14"
+# endif
+# if __cpp_lib_make_reverse_iterator != 201402L
+# error "__cpp_lib_make_reverse_iterator should have the value 201402L in c++14"
+# endif
+
+# ifndef __cpp_lib_make_unique
+# error "__cpp_lib_make_unique should be defined in c++14"
+# endif
+# if __cpp_lib_make_unique != 201304L
+# error "__cpp_lib_make_unique should have the value 201304L in c++14"
+# endif
+
+# ifdef __cpp_lib_map_try_emplace
+# error "__cpp_lib_map_try_emplace should not be defined before c++17"
+# endif
+
+# ifdef __cpp_lib_math_special_functions
+# error "__cpp_lib_math_special_functions should not be defined before c++17"
+# endif
+
+# ifdef __cpp_lib_memory_resource
+# error "__cpp_lib_memory_resource should not be defined before c++17"
+# endif
+
+# ifdef __cpp_lib_node_extract
+# error "__cpp_lib_node_extract should not be defined before c++17"
+# endif
+
+# ifdef __cpp_lib_nonmember_container_access
+# error "__cpp_lib_nonmember_container_access should not be defined before c++17"
+# endif
+
+# ifdef __cpp_lib_not_fn
+# error "__cpp_lib_not_fn should not be defined before c++17"
+# endif
+
+# ifndef __cpp_lib_null_iterators
+# error "__cpp_lib_null_iterators should be defined in c++14"
+# endif
+# if __cpp_lib_null_iterators != 201304L
+# error "__cpp_lib_null_iterators should have the value 201304L in c++14"
+# endif
+
+# ifdef __cpp_lib_optional
+# error "__cpp_lib_optional should not be defined before c++17"
+# endif
+
+# ifdef __cpp_lib_parallel_algorithm
+# error "__cpp_lib_parallel_algorithm should not be defined before c++17"
+# endif
+
+# ifndef __cpp_lib_quoted_string_io
+# error "__cpp_lib_quoted_string_io should be defined in c++14"
+# endif
+# if __cpp_lib_quoted_string_io != 201304L
+# error "__cpp_lib_quoted_string_io should have the value 201304L in c++14"
+# endif
+
+# ifdef __cpp_lib_ranges
+# error "__cpp_lib_ranges should not be defined before c++2a"
+# endif
+
+# ifdef __cpp_lib_raw_memory_algorithms
+# error "__cpp_lib_raw_memory_algorithms should not be defined before c++17"
+# endif
+
+# ifndef __cpp_lib_result_of_sfinae
+# error "__cpp_lib_result_of_sfinae should be defined in c++14"
+# endif
+# if __cpp_lib_result_of_sfinae != 201210L
+# error "__cpp_lib_result_of_sfinae should have the value 201210L in c++14"
+# endif
+
+# ifndef __cpp_lib_robust_nonmodifying_seq_ops
+# error "__cpp_lib_robust_nonmodifying_seq_ops should be defined in c++14"
+# endif
+# if __cpp_lib_robust_nonmodifying_seq_ops != 201304L
+# error "__cpp_lib_robust_nonmodifying_seq_ops should have the value 201304L in c++14"
+# endif
+
+# ifdef __cpp_lib_sample
+# error "__cpp_lib_sample should not be defined before c++17"
+# endif
+
+# ifdef __cpp_lib_scoped_lock
+# error "__cpp_lib_scoped_lock should not be defined before c++17"
+# endif
+
+# ifdef __cpp_lib_shared_mutex
+# error "__cpp_lib_shared_mutex should not be defined before c++17"
+# endif
+
+# ifdef __cpp_lib_shared_ptr_arrays
+# error "__cpp_lib_shared_ptr_arrays should not be defined before c++17"
+# endif
+
+# ifdef __cpp_lib_shared_ptr_weak_type
+# error "__cpp_lib_shared_ptr_weak_type should not be defined before c++17"
+# endif
+
+# if !defined(_LIBCPP_HAS_NO_THREADS)
+# ifndef __cpp_lib_shared_timed_mutex
+# error "__cpp_lib_shared_timed_mutex should be defined in c++14"
+# endif
+# if __cpp_lib_shared_timed_mutex != 201402L
+# error "__cpp_lib_shared_timed_mutex should have the value 201402L in c++14"
+# endif
+# else
+# ifdef __cpp_lib_shared_timed_mutex
+# error "__cpp_lib_shared_timed_mutex should not be defined when !defined(_LIBCPP_HAS_NO_THREADS) is not defined!"
+# endif
+# endif
+
+# ifndef __cpp_lib_string_udls
+# error "__cpp_lib_string_udls should be defined in c++14"
+# endif
+# if __cpp_lib_string_udls != 201304L
+# error "__cpp_lib_string_udls should have the value 201304L in c++14"
+# endif
+
+# ifdef __cpp_lib_string_view
+# error "__cpp_lib_string_view should not be defined before c++17"
+# endif
+
+# ifdef __cpp_lib_three_way_comparison
+# error "__cpp_lib_three_way_comparison should not be defined before c++2a"
+# endif
+
+# ifdef __cpp_lib_to_chars
+# error "__cpp_lib_to_chars should not be defined before c++17"
+# endif
+
+# ifndef __cpp_lib_transformation_trait_aliases
+# error "__cpp_lib_transformation_trait_aliases should be defined in c++14"
+# endif
+# if __cpp_lib_transformation_trait_aliases != 201304L
+# error "__cpp_lib_transformation_trait_aliases should have the value 201304L in c++14"
+# endif
+
+# ifndef __cpp_lib_transparent_operators
+# error "__cpp_lib_transparent_operators should be defined in c++14"
+# endif
+# if __cpp_lib_transparent_operators != 201210L
+# error "__cpp_lib_transparent_operators should have the value 201210L in c++14"
+# endif
+
+# ifndef __cpp_lib_tuple_element_t
+# error "__cpp_lib_tuple_element_t should be defined in c++14"
+# endif
+# if __cpp_lib_tuple_element_t != 201402L
+# error "__cpp_lib_tuple_element_t should have the value 201402L in c++14"
+# endif
+
+# ifndef __cpp_lib_tuples_by_type
+# error "__cpp_lib_tuples_by_type should be defined in c++14"
+# endif
+# if __cpp_lib_tuples_by_type != 201304L
+# error "__cpp_lib_tuples_by_type should have the value 201304L in c++14"
+# endif
+
+# ifdef __cpp_lib_type_trait_variable_templates
+# error "__cpp_lib_type_trait_variable_templates should not be defined before c++17"
+# endif
+
+# ifdef __cpp_lib_uncaught_exceptions
+# error "__cpp_lib_uncaught_exceptions should not be defined before c++17"
+# endif
+
+# ifdef __cpp_lib_unordered_map_try_emplace
+# error "__cpp_lib_unordered_map_try_emplace should not be defined before c++17"
+# endif
+
+# ifdef __cpp_lib_variant
+# error "__cpp_lib_variant should not be defined before c++17"
+# endif
+
+# ifdef __cpp_lib_void_t
+# error "__cpp_lib_void_t should not be defined before c++17"
+# endif
+
+#elif TEST_STD_VER == 17
+
+# if TEST_HAS_BUILTIN(__builtin_addressof) || TEST_GCC_VER >= 700
+# ifndef __cpp_lib_addressof_constexpr
+# error "__cpp_lib_addressof_constexpr should be defined in c++17"
+# endif
+# if __cpp_lib_addressof_constexpr != 201603L
+# error "__cpp_lib_addressof_constexpr should have the value 201603L in c++17"
+# endif
+# else
+# ifdef __cpp_lib_addressof_constexpr
+# error "__cpp_lib_addressof_constexpr should not be defined when TEST_HAS_BUILTIN(__builtin_addressof) || TEST_GCC_VER >= 700 is not defined!"
+# endif
+# endif
+
+# ifndef __cpp_lib_allocator_traits_is_always_equal
+# error "__cpp_lib_allocator_traits_is_always_equal should be defined in c++17"
+# endif
+# if __cpp_lib_allocator_traits_is_always_equal != 201411L
+# error "__cpp_lib_allocator_traits_is_always_equal should have the value 201411L in c++17"
+# endif
+
+# ifndef __cpp_lib_any
+# error "__cpp_lib_any should be defined in c++17"
+# endif
+# if __cpp_lib_any != 201606L
+# error "__cpp_lib_any should have the value 201606L in c++17"
+# endif
+
+# ifndef __cpp_lib_apply
+# error "__cpp_lib_apply should be defined in c++17"
+# endif
+# if __cpp_lib_apply != 201603L
+# error "__cpp_lib_apply should have the value 201603L in c++17"
+# endif
+
+# ifndef __cpp_lib_array_constexpr
+# error "__cpp_lib_array_constexpr should be defined in c++17"
+# endif
+# if __cpp_lib_array_constexpr != 201603L
+# error "__cpp_lib_array_constexpr should have the value 201603L in c++17"
+# endif
+
+# ifndef __cpp_lib_as_const
+# error "__cpp_lib_as_const should be defined in c++17"
+# endif
+# if __cpp_lib_as_const != 201510L
+# error "__cpp_lib_as_const should have the value 201510L in c++17"
+# endif
+
+# if !defined(_LIBCPP_HAS_NO_THREADS)
+# ifndef __cpp_lib_atomic_is_always_lock_free
+# error "__cpp_lib_atomic_is_always_lock_free should be defined in c++17"
+# endif
+# if __cpp_lib_atomic_is_always_lock_free != 201603L
+# error "__cpp_lib_atomic_is_always_lock_free should have the value 201603L in c++17"
+# endif
+# else
+# ifdef __cpp_lib_atomic_is_always_lock_free
+# error "__cpp_lib_atomic_is_always_lock_free should not be defined when !defined(_LIBCPP_HAS_NO_THREADS) is not defined!"
+# endif
+# endif
+
+# ifdef __cpp_lib_atomic_ref
+# error "__cpp_lib_atomic_ref should not be defined before c++2a"
+# endif
+
+# ifdef __cpp_lib_bind_front
+# error "__cpp_lib_bind_front should not be defined before c++2a"
+# endif
+
+# ifdef __cpp_lib_bit_cast
+# error "__cpp_lib_bit_cast should not be defined before c++2a"
+# endif
+
+# ifndef __cpp_lib_bool_constant
+# error "__cpp_lib_bool_constant should be defined in c++17"
+# endif
+# if __cpp_lib_bool_constant != 201505L
+# error "__cpp_lib_bool_constant should have the value 201505L in c++17"
+# endif
+
+# if !defined(_LIBCPP_VERSION)
+# ifndef __cpp_lib_boyer_moore_searcher
+# error "__cpp_lib_boyer_moore_searcher should be defined in c++17"
+# endif
+# if __cpp_lib_boyer_moore_searcher != 201603L
+# error "__cpp_lib_boyer_moore_searcher should have the value 201603L in c++17"
+# endif
+# else // _LIBCPP_VERSION
+# ifdef __cpp_lib_boyer_moore_searcher
+# error "__cpp_lib_boyer_moore_searcher should not be defined because it is unimplemented in libc++!"
+# endif
+# endif
+
+# ifndef __cpp_lib_byte
+# error "__cpp_lib_byte should be defined in c++17"
+# endif
+# if __cpp_lib_byte != 201603L
+# error "__cpp_lib_byte should have the value 201603L in c++17"
+# endif
+
+# ifdef __cpp_lib_char8_t
+# error "__cpp_lib_char8_t should not be defined before c++2a"
+# endif
+
+# ifndef __cpp_lib_chrono
+# error "__cpp_lib_chrono should be defined in c++17"
+# endif
+# if __cpp_lib_chrono != 201611L
+# error "__cpp_lib_chrono should have the value 201611L in c++17"
+# endif
+
+# ifndef __cpp_lib_chrono_udls
+# error "__cpp_lib_chrono_udls should be defined in c++17"
+# endif
+# if __cpp_lib_chrono_udls != 201304L
+# error "__cpp_lib_chrono_udls should have the value 201304L in c++17"
+# endif
+
+# ifndef __cpp_lib_clamp
+# error "__cpp_lib_clamp should be defined in c++17"
+# endif
+# if __cpp_lib_clamp != 201603L
+# error "__cpp_lib_clamp should have the value 201603L in c++17"
+# endif
+
+# ifndef __cpp_lib_complex_udls
+# error "__cpp_lib_complex_udls should be defined in c++17"
+# endif
+# if __cpp_lib_complex_udls != 201309L
+# error "__cpp_lib_complex_udls should have the value 201309L in c++17"
+# endif
+
+# ifdef __cpp_lib_concepts
+# error "__cpp_lib_concepts should not be defined before c++2a"
+# endif
+
+# ifdef __cpp_lib_constexpr_misc
+# error "__cpp_lib_constexpr_misc should not be defined before c++2a"
+# endif
+
+# ifdef __cpp_lib_constexpr_swap_algorithms
+# error "__cpp_lib_constexpr_swap_algorithms should not be defined before c++2a"
+# endif
+
+# ifdef __cpp_lib_destroying_delete
+# error "__cpp_lib_destroying_delete should not be defined before c++2a"
+# endif
+
+# ifndef __cpp_lib_enable_shared_from_this
+# error "__cpp_lib_enable_shared_from_this should be defined in c++17"
+# endif
+# if __cpp_lib_enable_shared_from_this != 201603L
+# error "__cpp_lib_enable_shared_from_this should have the value 201603L in c++17"
+# endif
+
+# ifdef __cpp_lib_erase_if
+# error "__cpp_lib_erase_if should not be defined before c++2a"
+# endif
+
+# ifndef __cpp_lib_exchange_function
+# error "__cpp_lib_exchange_function should be defined in c++17"
+# endif
+# if __cpp_lib_exchange_function != 201304L
+# error "__cpp_lib_exchange_function should have the value 201304L in c++17"
+# endif
+
+# if !defined(_LIBCPP_VERSION)
+# ifndef __cpp_lib_execution
+# error "__cpp_lib_execution should be defined in c++17"
+# endif
+# if __cpp_lib_execution != 201603L
+# error "__cpp_lib_execution should have the value 201603L in c++17"
+# endif
+# else // _LIBCPP_VERSION
+# ifdef __cpp_lib_execution
+# error "__cpp_lib_execution should not be defined because it is unimplemented in libc++!"
+# endif
+# endif
+
+# ifndef __cpp_lib_filesystem
+# error "__cpp_lib_filesystem should be defined in c++17"
+# endif
+# if __cpp_lib_filesystem != 201703L
+# error "__cpp_lib_filesystem should have the value 201703L in c++17"
+# endif
+
+# ifndef __cpp_lib_gcd_lcm
+# error "__cpp_lib_gcd_lcm should be defined in c++17"
+# endif
+# if __cpp_lib_gcd_lcm != 201606L
+# error "__cpp_lib_gcd_lcm should have the value 201606L in c++17"
+# endif
+
+# ifndef __cpp_lib_generic_associative_lookup
+# error "__cpp_lib_generic_associative_lookup should be defined in c++17"
+# endif
+# if __cpp_lib_generic_associative_lookup != 201304L
+# error "__cpp_lib_generic_associative_lookup should have the value 201304L in c++17"
+# endif
+
+# ifdef __cpp_lib_generic_unordered_lookup
+# error "__cpp_lib_generic_unordered_lookup should not be defined before c++2a"
+# endif
+
+# ifndef __cpp_lib_hardware_interference_size
+# error "__cpp_lib_hardware_interference_size should be defined in c++17"
+# endif
+# if __cpp_lib_hardware_interference_size != 201703L
+# error "__cpp_lib_hardware_interference_size should have the value 201703L in c++17"
+# endif
+
+# if TEST_HAS_BUILTIN_IDENTIFIER(__has_unique_object_representations) || TEST_GCC_VER >= 700
+# ifndef __cpp_lib_has_unique_object_representations
+# error "__cpp_lib_has_unique_object_representations should be defined in c++17"
+# endif
+# if __cpp_lib_has_unique_object_representations != 201606L
+# error "__cpp_lib_has_unique_object_representations should have the value 201606L in c++17"
+# endif
+# else
+# ifdef __cpp_lib_has_unique_object_representations
+# error "__cpp_lib_has_unique_object_representations should not be defined when TEST_HAS_BUILTIN_IDENTIFIER(__has_unique_object_representations) || TEST_GCC_VER >= 700 is not defined!"
+# endif
+# endif
+
+# ifndef __cpp_lib_hypot
+# error "__cpp_lib_hypot should be defined in c++17"
+# endif
+# if __cpp_lib_hypot != 201603L
+# error "__cpp_lib_hypot should have the value 201603L in c++17"
+# endif
+
+# ifndef __cpp_lib_incomplete_container_elements
+# error "__cpp_lib_incomplete_container_elements should be defined in c++17"
+# endif
+# if __cpp_lib_incomplete_container_elements != 201505L
+# error "__cpp_lib_incomplete_container_elements should have the value 201505L in c++17"
+# endif
+
+# ifndef __cpp_lib_integer_sequence
+# error "__cpp_lib_integer_sequence should be defined in c++17"
+# endif
+# if __cpp_lib_integer_sequence != 201304L
+# error "__cpp_lib_integer_sequence should have the value 201304L in c++17"
+# endif
+
+# ifndef __cpp_lib_integral_constant_callable
+# error "__cpp_lib_integral_constant_callable should be defined in c++17"
+# endif
+# if __cpp_lib_integral_constant_callable != 201304L
+# error "__cpp_lib_integral_constant_callable should have the value 201304L in c++17"
+# endif
+
+# ifndef __cpp_lib_invoke
+# error "__cpp_lib_invoke should be defined in c++17"
+# endif
+# if __cpp_lib_invoke != 201411L
+# error "__cpp_lib_invoke should have the value 201411L in c++17"
+# endif
+
+# if TEST_HAS_BUILTIN_IDENTIFIER(__is_aggregate) || TEST_GCC_VER_NEW >= 7001
+# ifndef __cpp_lib_is_aggregate
+# error "__cpp_lib_is_aggregate should be defined in c++17"
+# endif
+# if __cpp_lib_is_aggregate != 201703L
+# error "__cpp_lib_is_aggregate should have the value 201703L in c++17"
+# endif
+# else
+# ifdef __cpp_lib_is_aggregate
+# error "__cpp_lib_is_aggregate should not be defined when TEST_HAS_BUILTIN_IDENTIFIER(__is_aggregate) || TEST_GCC_VER_NEW >= 7001 is not defined!"
+# endif
+# endif
+
+# ifdef __cpp_lib_is_constant_evaluated
+# error "__cpp_lib_is_constant_evaluated should not be defined before c++2a"
+# endif
+
+# ifndef __cpp_lib_is_final
+# error "__cpp_lib_is_final should be defined in c++17"
+# endif
+# if __cpp_lib_is_final != 201402L
+# error "__cpp_lib_is_final should have the value 201402L in c++17"
+# endif
+
+# ifndef __cpp_lib_is_invocable
+# error "__cpp_lib_is_invocable should be defined in c++17"
+# endif
+# if __cpp_lib_is_invocable != 201703L
+# error "__cpp_lib_is_invocable should have the value 201703L in c++17"
+# endif
+
+# ifndef __cpp_lib_is_null_pointer
+# error "__cpp_lib_is_null_pointer should be defined in c++17"
+# endif
+# if __cpp_lib_is_null_pointer != 201309L
+# error "__cpp_lib_is_null_pointer should have the value 201309L in c++17"
+# endif
+
+# ifndef __cpp_lib_is_swappable
+# error "__cpp_lib_is_swappable should be defined in c++17"
+# endif
+# if __cpp_lib_is_swappable != 201603L
+# error "__cpp_lib_is_swappable should have the value 201603L in c++17"
+# endif
+
+# ifndef __cpp_lib_launder
+# error "__cpp_lib_launder should be defined in c++17"
+# endif
+# if __cpp_lib_launder != 201606L
+# error "__cpp_lib_launder should have the value 201606L in c++17"
+# endif
+
+# ifdef __cpp_lib_list_remove_return_type
+# error "__cpp_lib_list_remove_return_type should not be defined before c++2a"
+# endif
+
+# ifndef __cpp_lib_logical_traits
+# error "__cpp_lib_logical_traits should be defined in c++17"
+# endif
+# if __cpp_lib_logical_traits != 201510L
+# error "__cpp_lib_logical_traits should have the value 201510L in c++17"
+# endif
+
+# ifndef __cpp_lib_make_from_tuple
+# error "__cpp_lib_make_from_tuple should be defined in c++17"
+# endif
+# if __cpp_lib_make_from_tuple != 201606L
+# error "__cpp_lib_make_from_tuple should have the value 201606L in c++17"
+# endif
+
+# ifndef __cpp_lib_make_reverse_iterator
+# error "__cpp_lib_make_reverse_iterator should be defined in c++17"
+# endif
+# if __cpp_lib_make_reverse_iterator != 201402L
+# error "__cpp_lib_make_reverse_iterator should have the value 201402L in c++17"
+# endif
+
+# ifndef __cpp_lib_make_unique
+# error "__cpp_lib_make_unique should be defined in c++17"
+# endif
+# if __cpp_lib_make_unique != 201304L
+# error "__cpp_lib_make_unique should have the value 201304L in c++17"
+# endif
+
+# ifndef __cpp_lib_map_try_emplace
+# error "__cpp_lib_map_try_emplace should be defined in c++17"
+# endif
+# if __cpp_lib_map_try_emplace != 201411L
+# error "__cpp_lib_map_try_emplace should have the value 201411L in c++17"
+# endif
+
+# if !defined(_LIBCPP_VERSION)
+# ifndef __cpp_lib_math_special_functions
+# error "__cpp_lib_math_special_functions should be defined in c++17"
+# endif
+# if __cpp_lib_math_special_functions != 201603L
+# error "__cpp_lib_math_special_functions should have the value 201603L in c++17"
+# endif
+# else // _LIBCPP_VERSION
+# ifdef __cpp_lib_math_special_functions
+# error "__cpp_lib_math_special_functions should not be defined because it is unimplemented in libc++!"
+# endif
+# endif
+
+# if !defined(_LIBCPP_VERSION)
+# ifndef __cpp_lib_memory_resource
+# error "__cpp_lib_memory_resource should be defined in c++17"
+# endif
+# if __cpp_lib_memory_resource != 201603L
+# error "__cpp_lib_memory_resource should have the value 201603L in c++17"
+# endif
+# else // _LIBCPP_VERSION
+# ifdef __cpp_lib_memory_resource
+# error "__cpp_lib_memory_resource should not be defined because it is unimplemented in libc++!"
+# endif
+# endif
+
+# ifndef __cpp_lib_node_extract
+# error "__cpp_lib_node_extract should be defined in c++17"
+# endif
+# if __cpp_lib_node_extract != 201606L
+# error "__cpp_lib_node_extract should have the value 201606L in c++17"
+# endif
+
+# ifndef __cpp_lib_nonmember_container_access
+# error "__cpp_lib_nonmember_container_access should be defined in c++17"
+# endif
+# if __cpp_lib_nonmember_container_access != 201411L
+# error "__cpp_lib_nonmember_container_access should have the value 201411L in c++17"
+# endif
+
+# ifndef __cpp_lib_not_fn
+# error "__cpp_lib_not_fn should be defined in c++17"
+# endif
+# if __cpp_lib_not_fn != 201603L
+# error "__cpp_lib_not_fn should have the value 201603L in c++17"
+# endif
+
+# ifndef __cpp_lib_null_iterators
+# error "__cpp_lib_null_iterators should be defined in c++17"
+# endif
+# if __cpp_lib_null_iterators != 201304L
+# error "__cpp_lib_null_iterators should have the value 201304L in c++17"
+# endif
+
+# ifndef __cpp_lib_optional
+# error "__cpp_lib_optional should be defined in c++17"
+# endif
+# if __cpp_lib_optional != 201606L
+# error "__cpp_lib_optional should have the value 201606L in c++17"
+# endif
+
+# if !defined(_LIBCPP_VERSION)
+# ifndef __cpp_lib_parallel_algorithm
+# error "__cpp_lib_parallel_algorithm should be defined in c++17"
+# endif
+# if __cpp_lib_parallel_algorithm != 201603L
+# error "__cpp_lib_parallel_algorithm should have the value 201603L in c++17"
+# endif
+# else // _LIBCPP_VERSION
+# ifdef __cpp_lib_parallel_algorithm
+# error "__cpp_lib_parallel_algorithm should not be defined because it is unimplemented in libc++!"
+# endif
+# endif
+
+# ifndef __cpp_lib_quoted_string_io
+# error "__cpp_lib_quoted_string_io should be defined in c++17"
+# endif
+# if __cpp_lib_quoted_string_io != 201304L
+# error "__cpp_lib_quoted_string_io should have the value 201304L in c++17"
+# endif
+
+# ifdef __cpp_lib_ranges
+# error "__cpp_lib_ranges should not be defined before c++2a"
+# endif
+
+# ifndef __cpp_lib_raw_memory_algorithms
+# error "__cpp_lib_raw_memory_algorithms should be defined in c++17"
+# endif
+# if __cpp_lib_raw_memory_algorithms != 201606L
+# error "__cpp_lib_raw_memory_algorithms should have the value 201606L in c++17"
+# endif
+
+# ifndef __cpp_lib_result_of_sfinae
+# error "__cpp_lib_result_of_sfinae should be defined in c++17"
+# endif
+# if __cpp_lib_result_of_sfinae != 201210L
+# error "__cpp_lib_result_of_sfinae should have the value 201210L in c++17"
+# endif
+
+# ifndef __cpp_lib_robust_nonmodifying_seq_ops
+# error "__cpp_lib_robust_nonmodifying_seq_ops should be defined in c++17"
+# endif
+# if __cpp_lib_robust_nonmodifying_seq_ops != 201304L
+# error "__cpp_lib_robust_nonmodifying_seq_ops should have the value 201304L in c++17"
+# endif
+
+# ifndef __cpp_lib_sample
+# error "__cpp_lib_sample should be defined in c++17"
+# endif
+# if __cpp_lib_sample != 201603L
+# error "__cpp_lib_sample should have the value 201603L in c++17"
+# endif
+
+# ifndef __cpp_lib_scoped_lock
+# error "__cpp_lib_scoped_lock should be defined in c++17"
+# endif
+# if __cpp_lib_scoped_lock != 201703L
+# error "__cpp_lib_scoped_lock should have the value 201703L in c++17"
+# endif
+
+# if !defined(_LIBCPP_HAS_NO_THREADS)
+# ifndef __cpp_lib_shared_mutex
+# error "__cpp_lib_shared_mutex should be defined in c++17"
+# endif
+# if __cpp_lib_shared_mutex != 201505L
+# error "__cpp_lib_shared_mutex should have the value 201505L in c++17"
+# endif
+# else
+# ifdef __cpp_lib_shared_mutex
+# error "__cpp_lib_shared_mutex should not be defined when !defined(_LIBCPP_HAS_NO_THREADS) is not defined!"
+# endif
+# endif
+
+# if !defined(_LIBCPP_VERSION)
+# ifndef __cpp_lib_shared_ptr_arrays
+# error "__cpp_lib_shared_ptr_arrays should be defined in c++17"
+# endif
+# if __cpp_lib_shared_ptr_arrays != 201611L
+# error "__cpp_lib_shared_ptr_arrays should have the value 201611L in c++17"
+# endif
+# else // _LIBCPP_VERSION
+# ifdef __cpp_lib_shared_ptr_arrays
+# error "__cpp_lib_shared_ptr_arrays should not be defined because it is unimplemented in libc++!"
+# endif
+# endif
+
+# ifndef __cpp_lib_shared_ptr_weak_type
+# error "__cpp_lib_shared_ptr_weak_type should be defined in c++17"
+# endif
+# if __cpp_lib_shared_ptr_weak_type != 201606L
+# error "__cpp_lib_shared_ptr_weak_type should have the value 201606L in c++17"
+# endif
+
+# if !defined(_LIBCPP_HAS_NO_THREADS)
+# ifndef __cpp_lib_shared_timed_mutex
+# error "__cpp_lib_shared_timed_mutex should be defined in c++17"
+# endif
+# if __cpp_lib_shared_timed_mutex != 201402L
+# error "__cpp_lib_shared_timed_mutex should have the value 201402L in c++17"
+# endif
+# else
+# ifdef __cpp_lib_shared_timed_mutex
+# error "__cpp_lib_shared_timed_mutex should not be defined when !defined(_LIBCPP_HAS_NO_THREADS) is not defined!"
+# endif
+# endif
+
+# ifndef __cpp_lib_string_udls
+# error "__cpp_lib_string_udls should be defined in c++17"
+# endif
+# if __cpp_lib_string_udls != 201304L
+# error "__cpp_lib_string_udls should have the value 201304L in c++17"
+# endif
+
+# ifndef __cpp_lib_string_view
+# error "__cpp_lib_string_view should be defined in c++17"
+# endif
+# if __cpp_lib_string_view != 201606L
+# error "__cpp_lib_string_view should have the value 201606L in c++17"
+# endif
+
+# ifdef __cpp_lib_three_way_comparison
+# error "__cpp_lib_three_way_comparison should not be defined before c++2a"
+# endif
+
+# if !defined(_LIBCPP_VERSION)
+# ifndef __cpp_lib_to_chars
+# error "__cpp_lib_to_chars should be defined in c++17"
+# endif
+# if __cpp_lib_to_chars != 201611L
+# error "__cpp_lib_to_chars should have the value 201611L in c++17"
+# endif
+# else // _LIBCPP_VERSION
+# ifdef __cpp_lib_to_chars
+# error "__cpp_lib_to_chars should not be defined because it is unimplemented in libc++!"
+# endif
+# endif
+
+# ifndef __cpp_lib_transformation_trait_aliases
+# error "__cpp_lib_transformation_trait_aliases should be defined in c++17"
+# endif
+# if __cpp_lib_transformation_trait_aliases != 201304L
+# error "__cpp_lib_transformation_trait_aliases should have the value 201304L in c++17"
+# endif
+
+# ifndef __cpp_lib_transparent_operators
+# error "__cpp_lib_transparent_operators should be defined in c++17"
+# endif
+# if __cpp_lib_transparent_operators != 201510L
+# error "__cpp_lib_transparent_operators should have the value 201510L in c++17"
+# endif
+
+# ifndef __cpp_lib_tuple_element_t
+# error "__cpp_lib_tuple_element_t should be defined in c++17"
+# endif
+# if __cpp_lib_tuple_element_t != 201402L
+# error "__cpp_lib_tuple_element_t should have the value 201402L in c++17"
+# endif
+
+# ifndef __cpp_lib_tuples_by_type
+# error "__cpp_lib_tuples_by_type should be defined in c++17"
+# endif
+# if __cpp_lib_tuples_by_type != 201304L
+# error "__cpp_lib_tuples_by_type should have the value 201304L in c++17"
+# endif
+
+# ifndef __cpp_lib_type_trait_variable_templates
+# error "__cpp_lib_type_trait_variable_templates should be defined in c++17"
+# endif
+# if __cpp_lib_type_trait_variable_templates != 201510L
+# error "__cpp_lib_type_trait_variable_templates should have the value 201510L in c++17"
+# endif
+
+# ifndef __cpp_lib_uncaught_exceptions
+# error "__cpp_lib_uncaught_exceptions should be defined in c++17"
+# endif
+# if __cpp_lib_uncaught_exceptions != 201411L
+# error "__cpp_lib_uncaught_exceptions should have the value 201411L in c++17"
+# endif
+
+# ifndef __cpp_lib_unordered_map_try_emplace
+# error "__cpp_lib_unordered_map_try_emplace should be defined in c++17"
+# endif
+# if __cpp_lib_unordered_map_try_emplace != 201411L
+# error "__cpp_lib_unordered_map_try_emplace should have the value 201411L in c++17"
+# endif
+
+# ifndef __cpp_lib_variant
+# error "__cpp_lib_variant should be defined in c++17"
+# endif
+# if __cpp_lib_variant != 201606L
+# error "__cpp_lib_variant should have the value 201606L in c++17"
+# endif
+
+# ifndef __cpp_lib_void_t
+# error "__cpp_lib_void_t should be defined in c++17"
+# endif
+# if __cpp_lib_void_t != 201411L
+# error "__cpp_lib_void_t should have the value 201411L in c++17"
+# endif
+
+#elif TEST_STD_VER > 17
+
+# if TEST_HAS_BUILTIN(__builtin_addressof) || TEST_GCC_VER >= 700
+# ifndef __cpp_lib_addressof_constexpr
+# error "__cpp_lib_addressof_constexpr should be defined in c++2a"
+# endif
+# if __cpp_lib_addressof_constexpr != 201603L
+# error "__cpp_lib_addressof_constexpr should have the value 201603L in c++2a"
+# endif
+# else
+# ifdef __cpp_lib_addressof_constexpr
+# error "__cpp_lib_addressof_constexpr should not be defined when TEST_HAS_BUILTIN(__builtin_addressof) || TEST_GCC_VER >= 700 is not defined!"
+# endif
+# endif
+
+# ifndef __cpp_lib_allocator_traits_is_always_equal
+# error "__cpp_lib_allocator_traits_is_always_equal should be defined in c++2a"
+# endif
+# if __cpp_lib_allocator_traits_is_always_equal != 201411L
+# error "__cpp_lib_allocator_traits_is_always_equal should have the value 201411L in c++2a"
+# endif
+
+# ifndef __cpp_lib_any
+# error "__cpp_lib_any should be defined in c++2a"
+# endif
+# if __cpp_lib_any != 201606L
+# error "__cpp_lib_any should have the value 201606L in c++2a"
+# endif
+
+# ifndef __cpp_lib_apply
+# error "__cpp_lib_apply should be defined in c++2a"
+# endif
+# if __cpp_lib_apply != 201603L
+# error "__cpp_lib_apply should have the value 201603L in c++2a"
+# endif
+
+# ifndef __cpp_lib_array_constexpr
+# error "__cpp_lib_array_constexpr should be defined in c++2a"
+# endif
+# if __cpp_lib_array_constexpr != 201603L
+# error "__cpp_lib_array_constexpr should have the value 201603L in c++2a"
+# endif
+
+# ifndef __cpp_lib_as_const
+# error "__cpp_lib_as_const should be defined in c++2a"
+# endif
+# if __cpp_lib_as_const != 201510L
+# error "__cpp_lib_as_const should have the value 201510L in c++2a"
+# endif
+
+# if !defined(_LIBCPP_HAS_NO_THREADS)
+# ifndef __cpp_lib_atomic_is_always_lock_free
+# error "__cpp_lib_atomic_is_always_lock_free should be defined in c++2a"
+# endif
+# if __cpp_lib_atomic_is_always_lock_free != 201603L
+# error "__cpp_lib_atomic_is_always_lock_free should have the value 201603L in c++2a"
+# endif
+# else
+# ifdef __cpp_lib_atomic_is_always_lock_free
+# error "__cpp_lib_atomic_is_always_lock_free should not be defined when !defined(_LIBCPP_HAS_NO_THREADS) is not defined!"
+# endif
+# endif
+
+# if !defined(_LIBCPP_VERSION)
+# ifndef __cpp_lib_atomic_ref
+# error "__cpp_lib_atomic_ref should be defined in c++2a"
+# endif
+# if __cpp_lib_atomic_ref != 201806L
+# error "__cpp_lib_atomic_ref should have the value 201806L in c++2a"
+# endif
+# else // _LIBCPP_VERSION
+# ifdef __cpp_lib_atomic_ref
+# error "__cpp_lib_atomic_ref should not be defined because it is unimplemented in libc++!"
+# endif
+# endif
+
+# if !defined(_LIBCPP_VERSION)
+# ifndef __cpp_lib_bind_front
+# error "__cpp_lib_bind_front should be defined in c++2a"
+# endif
+# if __cpp_lib_bind_front != 201811L
+# error "__cpp_lib_bind_front should have the value 201811L in c++2a"
+# endif
+# else // _LIBCPP_VERSION
+# ifdef __cpp_lib_bind_front
+# error "__cpp_lib_bind_front should not be defined because it is unimplemented in libc++!"
+# endif
+# endif
+
+# if !defined(_LIBCPP_VERSION)
+# ifndef __cpp_lib_bit_cast
+# error "__cpp_lib_bit_cast should be defined in c++2a"
+# endif
+# if __cpp_lib_bit_cast != 201806L
+# error "__cpp_lib_bit_cast should have the value 201806L in c++2a"
+# endif
+# else // _LIBCPP_VERSION
+# ifdef __cpp_lib_bit_cast
+# error "__cpp_lib_bit_cast should not be defined because it is unimplemented in libc++!"
+# endif
+# endif
+
+# ifndef __cpp_lib_bool_constant
+# error "__cpp_lib_bool_constant should be defined in c++2a"
+# endif
+# if __cpp_lib_bool_constant != 201505L
+# error "__cpp_lib_bool_constant should have the value 201505L in c++2a"
+# endif
+
+# if !defined(_LIBCPP_VERSION)
+# ifndef __cpp_lib_boyer_moore_searcher
+# error "__cpp_lib_boyer_moore_searcher should be defined in c++2a"
+# endif
+# if __cpp_lib_boyer_moore_searcher != 201603L
+# error "__cpp_lib_boyer_moore_searcher should have the value 201603L in c++2a"
+# endif
+# else // _LIBCPP_VERSION
+# ifdef __cpp_lib_boyer_moore_searcher
+# error "__cpp_lib_boyer_moore_searcher should not be defined because it is unimplemented in libc++!"
+# endif
+# endif
+
+# ifndef __cpp_lib_byte
+# error "__cpp_lib_byte should be defined in c++2a"
+# endif
+# if __cpp_lib_byte != 201603L
+# error "__cpp_lib_byte should have the value 201603L in c++2a"
+# endif
+
+# if defined(__cpp_char8_t)
+# ifndef __cpp_lib_char8_t
+# error "__cpp_lib_char8_t should be defined in c++2a"
+# endif
+# if __cpp_lib_char8_t != 201811L
+# error "__cpp_lib_char8_t should have the value 201811L in c++2a"
+# endif
+# else
+# ifdef __cpp_lib_char8_t
+# error "__cpp_lib_char8_t should not be defined when defined(__cpp_char8_t) is not defined!"
+# endif
+# endif
+
+# ifndef __cpp_lib_chrono
+# error "__cpp_lib_chrono should be defined in c++2a"
+# endif
+# if __cpp_lib_chrono != 201611L
+# error "__cpp_lib_chrono should have the value 201611L in c++2a"
+# endif
+
+# ifndef __cpp_lib_chrono_udls
+# error "__cpp_lib_chrono_udls should be defined in c++2a"
+# endif
+# if __cpp_lib_chrono_udls != 201304L
+# error "__cpp_lib_chrono_udls should have the value 201304L in c++2a"
+# endif
+
+# ifndef __cpp_lib_clamp
+# error "__cpp_lib_clamp should be defined in c++2a"
+# endif
+# if __cpp_lib_clamp != 201603L
+# error "__cpp_lib_clamp should have the value 201603L in c++2a"
+# endif
+
+# ifndef __cpp_lib_complex_udls
+# error "__cpp_lib_complex_udls should be defined in c++2a"
+# endif
+# if __cpp_lib_complex_udls != 201309L
+# error "__cpp_lib_complex_udls should have the value 201309L in c++2a"
+# endif
+
+# if !defined(_LIBCPP_VERSION)
+# ifndef __cpp_lib_concepts
+# error "__cpp_lib_concepts should be defined in c++2a"
+# endif
+# if __cpp_lib_concepts != 201806L
+# error "__cpp_lib_concepts should have the value 201806L in c++2a"
+# endif
+# else // _LIBCPP_VERSION
+# ifdef __cpp_lib_concepts
+# error "__cpp_lib_concepts should not be defined because it is unimplemented in libc++!"
+# endif
+# endif
+
+# if !defined(_LIBCPP_VERSION)
+# ifndef __cpp_lib_constexpr_misc
+# error "__cpp_lib_constexpr_misc should be defined in c++2a"
+# endif
+# if __cpp_lib_constexpr_misc != 201811L
+# error "__cpp_lib_constexpr_misc should have the value 201811L in c++2a"
+# endif
+# else // _LIBCPP_VERSION
+# ifdef __cpp_lib_constexpr_misc
+# error "__cpp_lib_constexpr_misc should not be defined because it is unimplemented in libc++!"
+# endif
+# endif
+
+# if !defined(_LIBCPP_VERSION)
+# ifndef __cpp_lib_constexpr_swap_algorithms
+# error "__cpp_lib_constexpr_swap_algorithms should be defined in c++2a"
+# endif
+# if __cpp_lib_constexpr_swap_algorithms != 201806L
+# error "__cpp_lib_constexpr_swap_algorithms should have the value 201806L in c++2a"
+# endif
+# else // _LIBCPP_VERSION
+# ifdef __cpp_lib_constexpr_swap_algorithms
+# error "__cpp_lib_constexpr_swap_algorithms should not be defined because it is unimplemented in libc++!"
+# endif
+# endif
+
+# if !defined(_LIBCPP_VERSION)
+# ifndef __cpp_lib_destroying_delete
+# error "__cpp_lib_destroying_delete should be defined in c++2a"
+# endif
+# if __cpp_lib_destroying_delete != 201806L
+# error "__cpp_lib_destroying_delete should have the value 201806L in c++2a"
+# endif
+# else // _LIBCPP_VERSION
+# ifdef __cpp_lib_destroying_delete
+# error "__cpp_lib_destroying_delete should not be defined because it is unimplemented in libc++!"
+# endif
+# endif
+
+# ifndef __cpp_lib_enable_shared_from_this
+# error "__cpp_lib_enable_shared_from_this should be defined in c++2a"
+# endif
+# if __cpp_lib_enable_shared_from_this != 201603L
+# error "__cpp_lib_enable_shared_from_this should have the value 201603L in c++2a"
+# endif
+
+# ifndef __cpp_lib_erase_if
+# error "__cpp_lib_erase_if should be defined in c++2a"
+# endif
+# if __cpp_lib_erase_if != 201811L
+# error "__cpp_lib_erase_if should have the value 201811L in c++2a"
+# endif
+
+# ifndef __cpp_lib_exchange_function
+# error "__cpp_lib_exchange_function should be defined in c++2a"
+# endif
+# if __cpp_lib_exchange_function != 201304L
+# error "__cpp_lib_exchange_function should have the value 201304L in c++2a"
+# endif
+
+# if !defined(_LIBCPP_VERSION)
+# ifndef __cpp_lib_execution
+# error "__cpp_lib_execution should be defined in c++2a"
+# endif
+# if __cpp_lib_execution != 201603L
+# error "__cpp_lib_execution should have the value 201603L in c++2a"
+# endif
+# else // _LIBCPP_VERSION
+# ifdef __cpp_lib_execution
+# error "__cpp_lib_execution should not be defined because it is unimplemented in libc++!"
+# endif
+# endif
+
+# ifndef __cpp_lib_filesystem
+# error "__cpp_lib_filesystem should be defined in c++2a"
+# endif
+# if __cpp_lib_filesystem != 201703L
+# error "__cpp_lib_filesystem should have the value 201703L in c++2a"
+# endif
+
+# ifndef __cpp_lib_gcd_lcm
+# error "__cpp_lib_gcd_lcm should be defined in c++2a"
+# endif
+# if __cpp_lib_gcd_lcm != 201606L
+# error "__cpp_lib_gcd_lcm should have the value 201606L in c++2a"
+# endif
+
+# ifndef __cpp_lib_generic_associative_lookup
+# error "__cpp_lib_generic_associative_lookup should be defined in c++2a"
+# endif
+# if __cpp_lib_generic_associative_lookup != 201304L
+# error "__cpp_lib_generic_associative_lookup should have the value 201304L in c++2a"
+# endif
+
+# if !defined(_LIBCPP_VERSION)
+# ifndef __cpp_lib_generic_unordered_lookup
+# error "__cpp_lib_generic_unordered_lookup should be defined in c++2a"
+# endif
+# if __cpp_lib_generic_unordered_lookup != 201811L
+# error "__cpp_lib_generic_unordered_lookup should have the value 201811L in c++2a"
+# endif
+# else // _LIBCPP_VERSION
+# ifdef __cpp_lib_generic_unordered_lookup
+# error "__cpp_lib_generic_unordered_lookup should not be defined because it is unimplemented in libc++!"
+# endif
+# endif
+
+# ifndef __cpp_lib_hardware_interference_size
+# error "__cpp_lib_hardware_interference_size should be defined in c++2a"
+# endif
+# if __cpp_lib_hardware_interference_size != 201703L
+# error "__cpp_lib_hardware_interference_size should have the value 201703L in c++2a"
+# endif
+
+# if TEST_HAS_BUILTIN_IDENTIFIER(__has_unique_object_representations) || TEST_GCC_VER >= 700
+# ifndef __cpp_lib_has_unique_object_representations
+# error "__cpp_lib_has_unique_object_representations should be defined in c++2a"
+# endif
+# if __cpp_lib_has_unique_object_representations != 201606L
+# error "__cpp_lib_has_unique_object_representations should have the value 201606L in c++2a"
+# endif
+# else
+# ifdef __cpp_lib_has_unique_object_representations
+# error "__cpp_lib_has_unique_object_representations should not be defined when TEST_HAS_BUILTIN_IDENTIFIER(__has_unique_object_representations) || TEST_GCC_VER >= 700 is not defined!"
+# endif
+# endif
+
+# ifndef __cpp_lib_hypot
+# error "__cpp_lib_hypot should be defined in c++2a"
+# endif
+# if __cpp_lib_hypot != 201603L
+# error "__cpp_lib_hypot should have the value 201603L in c++2a"
+# endif
+
+# ifndef __cpp_lib_incomplete_container_elements
+# error "__cpp_lib_incomplete_container_elements should be defined in c++2a"
+# endif
+# if __cpp_lib_incomplete_container_elements != 201505L
+# error "__cpp_lib_incomplete_container_elements should have the value 201505L in c++2a"
+# endif
+
+# ifndef __cpp_lib_integer_sequence
+# error "__cpp_lib_integer_sequence should be defined in c++2a"
+# endif
+# if __cpp_lib_integer_sequence != 201304L
+# error "__cpp_lib_integer_sequence should have the value 201304L in c++2a"
+# endif
+
+# ifndef __cpp_lib_integral_constant_callable
+# error "__cpp_lib_integral_constant_callable should be defined in c++2a"
+# endif
+# if __cpp_lib_integral_constant_callable != 201304L
+# error "__cpp_lib_integral_constant_callable should have the value 201304L in c++2a"
+# endif
+
+# ifndef __cpp_lib_invoke
+# error "__cpp_lib_invoke should be defined in c++2a"
+# endif
+# if __cpp_lib_invoke != 201411L
+# error "__cpp_lib_invoke should have the value 201411L in c++2a"
+# endif
+
+# if TEST_HAS_BUILTIN_IDENTIFIER(__is_aggregate) || TEST_GCC_VER_NEW >= 7001
+# ifndef __cpp_lib_is_aggregate
+# error "__cpp_lib_is_aggregate should be defined in c++2a"
+# endif
+# if __cpp_lib_is_aggregate != 201703L
+# error "__cpp_lib_is_aggregate should have the value 201703L in c++2a"
+# endif
+# else
+# ifdef __cpp_lib_is_aggregate
+# error "__cpp_lib_is_aggregate should not be defined when TEST_HAS_BUILTIN_IDENTIFIER(__is_aggregate) || TEST_GCC_VER_NEW >= 7001 is not defined!"
+# endif
+# endif
+
+# if !defined(_LIBCPP_VERSION)
+# ifndef __cpp_lib_is_constant_evaluated
+# error "__cpp_lib_is_constant_evaluated should be defined in c++2a"
+# endif
+# if __cpp_lib_is_constant_evaluated != 201811L
+# error "__cpp_lib_is_constant_evaluated should have the value 201811L in c++2a"
+# endif
+# else // _LIBCPP_VERSION
+# ifdef __cpp_lib_is_constant_evaluated
+# error "__cpp_lib_is_constant_evaluated should not be defined because it is unimplemented in libc++!"
+# endif
+# endif
+
+# ifndef __cpp_lib_is_final
+# error "__cpp_lib_is_final should be defined in c++2a"
+# endif
+# if __cpp_lib_is_final != 201402L
+# error "__cpp_lib_is_final should have the value 201402L in c++2a"
+# endif
+
+# ifndef __cpp_lib_is_invocable
+# error "__cpp_lib_is_invocable should be defined in c++2a"
+# endif
+# if __cpp_lib_is_invocable != 201703L
+# error "__cpp_lib_is_invocable should have the value 201703L in c++2a"
+# endif
+
+# ifndef __cpp_lib_is_null_pointer
+# error "__cpp_lib_is_null_pointer should be defined in c++2a"
+# endif
+# if __cpp_lib_is_null_pointer != 201309L
+# error "__cpp_lib_is_null_pointer should have the value 201309L in c++2a"
+# endif
+
+# ifndef __cpp_lib_is_swappable
+# error "__cpp_lib_is_swappable should be defined in c++2a"
+# endif
+# if __cpp_lib_is_swappable != 201603L
+# error "__cpp_lib_is_swappable should have the value 201603L in c++2a"
+# endif
+
+# ifndef __cpp_lib_launder
+# error "__cpp_lib_launder should be defined in c++2a"
+# endif
+# if __cpp_lib_launder != 201606L
+# error "__cpp_lib_launder should have the value 201606L in c++2a"
+# endif
+
+# if !defined(_LIBCPP_VERSION)
+# ifndef __cpp_lib_list_remove_return_type
+# error "__cpp_lib_list_remove_return_type should be defined in c++2a"
+# endif
+# if __cpp_lib_list_remove_return_type != 201806L
+# error "__cpp_lib_list_remove_return_type should have the value 201806L in c++2a"
+# endif
+# else // _LIBCPP_VERSION
+# ifdef __cpp_lib_list_remove_return_type
+# error "__cpp_lib_list_remove_return_type should not be defined because it is unimplemented in libc++!"
+# endif
+# endif
+
+# ifndef __cpp_lib_logical_traits
+# error "__cpp_lib_logical_traits should be defined in c++2a"
+# endif
+# if __cpp_lib_logical_traits != 201510L
+# error "__cpp_lib_logical_traits should have the value 201510L in c++2a"
+# endif
+
+# ifndef __cpp_lib_make_from_tuple
+# error "__cpp_lib_make_from_tuple should be defined in c++2a"
+# endif
+# if __cpp_lib_make_from_tuple != 201606L
+# error "__cpp_lib_make_from_tuple should have the value 201606L in c++2a"
+# endif
+
+# ifndef __cpp_lib_make_reverse_iterator
+# error "__cpp_lib_make_reverse_iterator should be defined in c++2a"
+# endif
+# if __cpp_lib_make_reverse_iterator != 201402L
+# error "__cpp_lib_make_reverse_iterator should have the value 201402L in c++2a"
+# endif
+
+# ifndef __cpp_lib_make_unique
+# error "__cpp_lib_make_unique should be defined in c++2a"
+# endif
+# if __cpp_lib_make_unique != 201304L
+# error "__cpp_lib_make_unique should have the value 201304L in c++2a"
+# endif
+
+# ifndef __cpp_lib_map_try_emplace
+# error "__cpp_lib_map_try_emplace should be defined in c++2a"
+# endif
+# if __cpp_lib_map_try_emplace != 201411L
+# error "__cpp_lib_map_try_emplace should have the value 201411L in c++2a"
+# endif
+
+# if !defined(_LIBCPP_VERSION)
+# ifndef __cpp_lib_math_special_functions
+# error "__cpp_lib_math_special_functions should be defined in c++2a"
+# endif
+# if __cpp_lib_math_special_functions != 201603L
+# error "__cpp_lib_math_special_functions should have the value 201603L in c++2a"
+# endif
+# else // _LIBCPP_VERSION
+# ifdef __cpp_lib_math_special_functions
+# error "__cpp_lib_math_special_functions should not be defined because it is unimplemented in libc++!"
+# endif
+# endif
+
+# if !defined(_LIBCPP_VERSION)
+# ifndef __cpp_lib_memory_resource
+# error "__cpp_lib_memory_resource should be defined in c++2a"
+# endif
+# if __cpp_lib_memory_resource != 201603L
+# error "__cpp_lib_memory_resource should have the value 201603L in c++2a"
+# endif
+# else // _LIBCPP_VERSION
+# ifdef __cpp_lib_memory_resource
+# error "__cpp_lib_memory_resource should not be defined because it is unimplemented in libc++!"
+# endif
+# endif
+
+# ifndef __cpp_lib_node_extract
+# error "__cpp_lib_node_extract should be defined in c++2a"
+# endif
+# if __cpp_lib_node_extract != 201606L
+# error "__cpp_lib_node_extract should have the value 201606L in c++2a"
+# endif
+
+# ifndef __cpp_lib_nonmember_container_access
+# error "__cpp_lib_nonmember_container_access should be defined in c++2a"
+# endif
+# if __cpp_lib_nonmember_container_access != 201411L
+# error "__cpp_lib_nonmember_container_access should have the value 201411L in c++2a"
+# endif
+
+# ifndef __cpp_lib_not_fn
+# error "__cpp_lib_not_fn should be defined in c++2a"
+# endif
+# if __cpp_lib_not_fn != 201603L
+# error "__cpp_lib_not_fn should have the value 201603L in c++2a"
+# endif
+
+# ifndef __cpp_lib_null_iterators
+# error "__cpp_lib_null_iterators should be defined in c++2a"
+# endif
+# if __cpp_lib_null_iterators != 201304L
+# error "__cpp_lib_null_iterators should have the value 201304L in c++2a"
+# endif
+
+# ifndef __cpp_lib_optional
+# error "__cpp_lib_optional should be defined in c++2a"
+# endif
+# if __cpp_lib_optional != 201606L
+# error "__cpp_lib_optional should have the value 201606L in c++2a"
+# endif
+
+# if !defined(_LIBCPP_VERSION)
+# ifndef __cpp_lib_parallel_algorithm
+# error "__cpp_lib_parallel_algorithm should be defined in c++2a"
+# endif
+# if __cpp_lib_parallel_algorithm != 201603L
+# error "__cpp_lib_parallel_algorithm should have the value 201603L in c++2a"
+# endif
+# else // _LIBCPP_VERSION
+# ifdef __cpp_lib_parallel_algorithm
+# error "__cpp_lib_parallel_algorithm should not be defined because it is unimplemented in libc++!"
+# endif
+# endif
+
+# ifndef __cpp_lib_quoted_string_io
+# error "__cpp_lib_quoted_string_io should be defined in c++2a"
+# endif
+# if __cpp_lib_quoted_string_io != 201304L
+# error "__cpp_lib_quoted_string_io should have the value 201304L in c++2a"
+# endif
+
+# if !defined(_LIBCPP_VERSION)
+# ifndef __cpp_lib_ranges
+# error "__cpp_lib_ranges should be defined in c++2a"
+# endif
+# if __cpp_lib_ranges != 201811L
+# error "__cpp_lib_ranges should have the value 201811L in c++2a"
+# endif
+# else // _LIBCPP_VERSION
+# ifdef __cpp_lib_ranges
+# error "__cpp_lib_ranges should not be defined because it is unimplemented in libc++!"
+# endif
+# endif
+
+# ifndef __cpp_lib_raw_memory_algorithms
+# error "__cpp_lib_raw_memory_algorithms should be defined in c++2a"
+# endif
+# if __cpp_lib_raw_memory_algorithms != 201606L
+# error "__cpp_lib_raw_memory_algorithms should have the value 201606L in c++2a"
+# endif
+
+# ifndef __cpp_lib_result_of_sfinae
+# error "__cpp_lib_result_of_sfinae should be defined in c++2a"
+# endif
+# if __cpp_lib_result_of_sfinae != 201210L
+# error "__cpp_lib_result_of_sfinae should have the value 201210L in c++2a"
+# endif
+
+# ifndef __cpp_lib_robust_nonmodifying_seq_ops
+# error "__cpp_lib_robust_nonmodifying_seq_ops should be defined in c++2a"
+# endif
+# if __cpp_lib_robust_nonmodifying_seq_ops != 201304L
+# error "__cpp_lib_robust_nonmodifying_seq_ops should have the value 201304L in c++2a"
+# endif
+
+# ifndef __cpp_lib_sample
+# error "__cpp_lib_sample should be defined in c++2a"
+# endif
+# if __cpp_lib_sample != 201603L
+# error "__cpp_lib_sample should have the value 201603L in c++2a"
+# endif
+
+# ifndef __cpp_lib_scoped_lock
+# error "__cpp_lib_scoped_lock should be defined in c++2a"
+# endif
+# if __cpp_lib_scoped_lock != 201703L
+# error "__cpp_lib_scoped_lock should have the value 201703L in c++2a"
+# endif
+
+# if !defined(_LIBCPP_HAS_NO_THREADS)
+# ifndef __cpp_lib_shared_mutex
+# error "__cpp_lib_shared_mutex should be defined in c++2a"
+# endif
+# if __cpp_lib_shared_mutex != 201505L
+# error "__cpp_lib_shared_mutex should have the value 201505L in c++2a"
+# endif
+# else
+# ifdef __cpp_lib_shared_mutex
+# error "__cpp_lib_shared_mutex should not be defined when !defined(_LIBCPP_HAS_NO_THREADS) is not defined!"
+# endif
+# endif
+
+# if !defined(_LIBCPP_VERSION)
+# ifndef __cpp_lib_shared_ptr_arrays
+# error "__cpp_lib_shared_ptr_arrays should be defined in c++2a"
+# endif
+# if __cpp_lib_shared_ptr_arrays != 201611L
+# error "__cpp_lib_shared_ptr_arrays should have the value 201611L in c++2a"
+# endif
+# else // _LIBCPP_VERSION
+# ifdef __cpp_lib_shared_ptr_arrays
+# error "__cpp_lib_shared_ptr_arrays should not be defined because it is unimplemented in libc++!"
+# endif
+# endif
+
+# ifndef __cpp_lib_shared_ptr_weak_type
+# error "__cpp_lib_shared_ptr_weak_type should be defined in c++2a"
+# endif
+# if __cpp_lib_shared_ptr_weak_type != 201606L
+# error "__cpp_lib_shared_ptr_weak_type should have the value 201606L in c++2a"
+# endif
+
+# if !defined(_LIBCPP_HAS_NO_THREADS)
+# ifndef __cpp_lib_shared_timed_mutex
+# error "__cpp_lib_shared_timed_mutex should be defined in c++2a"
+# endif
+# if __cpp_lib_shared_timed_mutex != 201402L
+# error "__cpp_lib_shared_timed_mutex should have the value 201402L in c++2a"
+# endif
+# else
+# ifdef __cpp_lib_shared_timed_mutex
+# error "__cpp_lib_shared_timed_mutex should not be defined when !defined(_LIBCPP_HAS_NO_THREADS) is not defined!"
+# endif
+# endif
+
+# ifndef __cpp_lib_string_udls
+# error "__cpp_lib_string_udls should be defined in c++2a"
+# endif
+# if __cpp_lib_string_udls != 201304L
+# error "__cpp_lib_string_udls should have the value 201304L in c++2a"
+# endif
+
+# ifndef __cpp_lib_string_view
+# error "__cpp_lib_string_view should be defined in c++2a"
+# endif
+# if __cpp_lib_string_view != 201606L
+# error "__cpp_lib_string_view should have the value 201606L in c++2a"
+# endif
+
+# if !defined(_LIBCPP_VERSION)
+# ifndef __cpp_lib_three_way_comparison
+# error "__cpp_lib_three_way_comparison should be defined in c++2a"
+# endif
+# if __cpp_lib_three_way_comparison != 201711L
+# error "__cpp_lib_three_way_comparison should have the value 201711L in c++2a"
+# 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
+# endif
+
+# if !defined(_LIBCPP_VERSION)
+# ifndef __cpp_lib_to_chars
+# error "__cpp_lib_to_chars should be defined in c++2a"
+# endif
+# if __cpp_lib_to_chars != 201611L
+# error "__cpp_lib_to_chars should have the value 201611L in c++2a"
+# endif
+# else // _LIBCPP_VERSION
+# ifdef __cpp_lib_to_chars
+# error "__cpp_lib_to_chars should not be defined because it is unimplemented in libc++!"
+# endif
+# endif
+
+# ifndef __cpp_lib_transformation_trait_aliases
+# error "__cpp_lib_transformation_trait_aliases should be defined in c++2a"
+# endif
+# if __cpp_lib_transformation_trait_aliases != 201304L
+# error "__cpp_lib_transformation_trait_aliases should have the value 201304L in c++2a"
+# endif
+
+# ifndef __cpp_lib_transparent_operators
+# error "__cpp_lib_transparent_operators should be defined in c++2a"
+# endif
+# if __cpp_lib_transparent_operators != 201510L
+# error "__cpp_lib_transparent_operators should have the value 201510L in c++2a"
+# endif
+
+# ifndef __cpp_lib_tuple_element_t
+# error "__cpp_lib_tuple_element_t should be defined in c++2a"
+# endif
+# if __cpp_lib_tuple_element_t != 201402L
+# error "__cpp_lib_tuple_element_t should have the value 201402L in c++2a"
+# endif
+
+# ifndef __cpp_lib_tuples_by_type
+# error "__cpp_lib_tuples_by_type should be defined in c++2a"
+# endif
+# if __cpp_lib_tuples_by_type != 201304L
+# error "__cpp_lib_tuples_by_type should have the value 201304L in c++2a"
+# endif
+
+# ifndef __cpp_lib_type_trait_variable_templates
+# error "__cpp_lib_type_trait_variable_templates should be defined in c++2a"
+# endif
+# if __cpp_lib_type_trait_variable_templates != 201510L
+# error "__cpp_lib_type_trait_variable_templates should have the value 201510L in c++2a"
+# endif
+
+# ifndef __cpp_lib_uncaught_exceptions
+# error "__cpp_lib_uncaught_exceptions should be defined in c++2a"
+# endif
+# if __cpp_lib_uncaught_exceptions != 201411L
+# error "__cpp_lib_uncaught_exceptions should have the value 201411L in c++2a"
+# endif
+
+# ifndef __cpp_lib_unordered_map_try_emplace
+# error "__cpp_lib_unordered_map_try_emplace should be defined in c++2a"
+# endif
+# if __cpp_lib_unordered_map_try_emplace != 201411L
+# error "__cpp_lib_unordered_map_try_emplace should have the value 201411L in c++2a"
+# endif
+
+# ifndef __cpp_lib_variant
+# error "__cpp_lib_variant should be defined in c++2a"
+# endif
+# if __cpp_lib_variant != 201606L
+# error "__cpp_lib_variant should have the value 201606L in c++2a"
+# endif
+
+# ifndef __cpp_lib_void_t
+# error "__cpp_lib_void_t should be defined in c++2a"
+# endif
+# if __cpp_lib_void_t != 201411L
+# error "__cpp_lib_void_t should have the value 201411L in c++2a"
+# endif
+
+#endif // TEST_STD_VER > 17
+
+int main() {}
diff --git a/test/std/language.support/support.runtime/cstdlib.pass.cpp b/test/std/language.support/support.runtime/cstdlib.pass.cpp
index e9dda6cee4ee3..02c8c9fd8bb37 100644
--- a/test/std/language.support/support.runtime/cstdlib.pass.cpp
+++ b/test/std/language.support/support.runtime/cstdlib.pass.cpp
@@ -75,10 +75,8 @@ int main()
static_assert((std::is_same<decltype(std::srand(0)), void>::value), "");
// Microsoft does not implement aligned_alloc in their C library
-#ifndef TEST_COMPILER_C1XX
-#if TEST_STD_VER > 14 && defined(TEST_HAS_C11_FEATURES)
- static_assert((std::is_same<decltype(std::aligned_alloc(0,0)), void*>::value), "");
-#endif
+#if TEST_STD_VER > 14 && defined(TEST_HAS_C11_FEATURES) && !defined(_WIN32)
+ static_assert((std::is_same<decltype(aligned_alloc(0,0)), void*>::value), "");
#endif
static_assert((std::is_same<decltype(std::calloc(0,0)), void*>::value), "");
diff --git a/test/std/language.support/support.runtime/ctime.pass.cpp b/test/std/language.support/support.runtime/ctime.pass.cpp
index 908dc480884c4..d80bc198293ed 100644
--- a/test/std/language.support/support.runtime/ctime.pass.cpp
+++ b/test/std/language.support/support.runtime/ctime.pass.cpp
@@ -45,7 +45,7 @@ int main()
static_assert((std::is_same<decltype(std::difftime(t,t)), double>::value), "");
static_assert((std::is_same<decltype(std::mktime(&tm)), std::time_t>::value), "");
static_assert((std::is_same<decltype(std::time(&t)), std::time_t>::value), "");
-#if TEST_STD_VER > 14 && defined(TEST_HAS_C11_FEATURES)
+#if TEST_STD_VER > 14 && defined(TEST_HAS_TIMESPEC_GET)
static_assert((std::is_same<decltype(std::timespec_get(nullptr, 0)), int>::value), "");
#endif
#ifndef _LIBCPP_HAS_NO_THREAD_UNSAFE_C_FUNCTIONS
diff --git a/test/std/language.support/support.start.term/quick_exit.pass.cpp b/test/std/language.support/support.start.term/quick_exit.pass.cpp
index bcfdbb75402ed..2bf2ea790653a 100644
--- a/test/std/language.support/support.start.term/quick_exit.pass.cpp
+++ b/test/std/language.support/support.start.term/quick_exit.pass.cpp
@@ -6,7 +6,7 @@
// Source Licenses. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
-//
+// UNSUPPORTED: c++98, c++03
// test quick_exit and at_quick_exit
diff --git a/test/std/language.support/support.start.term/quick_exit_check1.fail.cpp b/test/std/language.support/support.start.term/quick_exit_check1.fail.cpp
index 8b9729379163b..f42498e3d7b99 100644
--- a/test/std/language.support/support.start.term/quick_exit_check1.fail.cpp
+++ b/test/std/language.support/support.start.term/quick_exit_check1.fail.cpp
@@ -7,6 +7,7 @@
//
//===----------------------------------------------------------------------===//
//
+// UNSUPPORTED: c++98, c++03
// test that referencing at_quick_exit when _LIBCPP_HAS_QUICK_EXIT is not defined
// results in a compile error.
diff --git a/test/std/language.support/support.start.term/quick_exit_check2.fail.cpp b/test/std/language.support/support.start.term/quick_exit_check2.fail.cpp
index 395914136820f..c49704f99aea8 100644
--- a/test/std/language.support/support.start.term/quick_exit_check2.fail.cpp
+++ b/test/std/language.support/support.start.term/quick_exit_check2.fail.cpp
@@ -6,7 +6,7 @@
// Source Licenses. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
-//
+// UNSUPPORTED: c++98, c++03
// test that referencing quick_exit when _LIBCPP_HAS_QUICK_EXIT is not defined
// results in a compile error.
diff --git a/test/std/localization/locale.categories/category.collate/locale.collate.byname/transform.pass.cpp b/test/std/localization/locale.categories/category.collate/locale.collate.byname/transform.pass.cpp
index b39e9ad74dc40..4f738076e406b 100644
--- a/test/std/localization/locale.categories/category.collate/locale.collate.byname/transform.pass.cpp
+++ b/test/std/localization/locale.categories/category.collate/locale.collate.byname/transform.pass.cpp
@@ -6,6 +6,9 @@
// Source Licenses. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
+//
+// NetBSD does not support LC_COLLATE at the moment
+// XFAIL: netbsd
// <locale>
diff --git a/test/std/localization/locale.categories/category.ctype/locale.codecvt/locale.codecvt.members/wchar_t_out.pass.cpp b/test/std/localization/locale.categories/category.ctype/locale.codecvt/locale.codecvt.members/wchar_t_out.pass.cpp
index d7bcb2908d72a..e4cabf6efa05b 100644
--- a/test/std/localization/locale.categories/category.ctype/locale.codecvt/locale.codecvt.members/wchar_t_out.pass.cpp
+++ b/test/std/localization/locale.categories/category.ctype/locale.codecvt/locale.codecvt.members/wchar_t_out.pass.cpp
@@ -20,6 +20,7 @@
#include <vector>
#include <cassert>
#include <cstddef>
+#include <cstring>
typedef std::codecvt<wchar_t, char, std::mbstate_t> F;
diff --git a/test/std/localization/locale.categories/category.monetary/locale.money.get/locale.money.get.members/get_long_double_fr_FR.pass.cpp b/test/std/localization/locale.categories/category.monetary/locale.money.get/locale.money.get.members/get_long_double_fr_FR.pass.cpp
index bebc1f27bb34b..ce046e61e028a 100644
--- a/test/std/localization/locale.categories/category.monetary/locale.money.get/locale.money.get.members/get_long_double_fr_FR.pass.cpp
+++ b/test/std/localization/locale.categories/category.monetary/locale.money.get/locale.money.get.members/get_long_double_fr_FR.pass.cpp
@@ -8,6 +8,9 @@
//===----------------------------------------------------------------------===//
//
// XFAIL: apple-darwin
+//
+// NetBSD does not support LC_MONETARY at the moment
+// XFAIL: netbsd
// REQUIRES: locale.fr_FR.UTF-8
diff --git a/test/std/localization/locale.categories/category.monetary/locale.money.get/locale.money.get.members/get_long_double_ru_RU.pass.cpp b/test/std/localization/locale.categories/category.monetary/locale.money.get/locale.money.get.members/get_long_double_ru_RU.pass.cpp
index 7776c67a6be23..5b56ab3e7e080 100644
--- a/test/std/localization/locale.categories/category.monetary/locale.money.get/locale.money.get.members/get_long_double_ru_RU.pass.cpp
+++ b/test/std/localization/locale.categories/category.monetary/locale.money.get/locale.money.get.members/get_long_double_ru_RU.pass.cpp
@@ -9,6 +9,9 @@
//
// This test is passing in an uncontrolled manner in some Apple environment.
// UNSUPPORTED: apple-darwin
+//
+// NetBSD does not support LC_MONETARY at the moment
+// XFAIL: netbsd
// Failure related to GLIBC's use of U00A0 as mon_thousands_sep
// and U002E as mon_decimal_point.
diff --git a/test/std/localization/locale.categories/category.monetary/locale.money.get/locale.money.get.members/get_long_double_zh_CN.pass.cpp b/test/std/localization/locale.categories/category.monetary/locale.money.get/locale.money.get.members/get_long_double_zh_CN.pass.cpp
index 07a33f7663b6d..4e62a1bc007c7 100644
--- a/test/std/localization/locale.categories/category.monetary/locale.money.get/locale.money.get.members/get_long_double_zh_CN.pass.cpp
+++ b/test/std/localization/locale.categories/category.monetary/locale.money.get/locale.money.get.members/get_long_double_zh_CN.pass.cpp
@@ -6,6 +6,9 @@
// Source Licenses. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
+//
+// NetBSD does not support LC_MONETARY at the moment
+// XFAIL: netbsd
// REQUIRES: locale.zh_CN.UTF-8
diff --git a/test/std/localization/locale.categories/category.monetary/locale.money.put/locale.money.put.members/put_long_double_fr_FR.pass.cpp b/test/std/localization/locale.categories/category.monetary/locale.money.put/locale.money.put.members/put_long_double_fr_FR.pass.cpp
index 2b431dc529d84..2ba29dfff601b 100644
--- a/test/std/localization/locale.categories/category.monetary/locale.money.put/locale.money.put.members/put_long_double_fr_FR.pass.cpp
+++ b/test/std/localization/locale.categories/category.monetary/locale.money.put/locale.money.put.members/put_long_double_fr_FR.pass.cpp
@@ -8,6 +8,9 @@
//===----------------------------------------------------------------------===//
//
// XFAIL: apple-darwin
+//
+// NetBSD does not support LC_MONETARY at the moment
+// XFAIL: netbsd
// REQUIRES: locale.fr_FR.UTF-8
diff --git a/test/std/localization/locale.categories/category.monetary/locale.money.put/locale.money.put.members/put_long_double_ru_RU.pass.cpp b/test/std/localization/locale.categories/category.monetary/locale.money.put/locale.money.put.members/put_long_double_ru_RU.pass.cpp
index 4d805b0f7adff..56fb850585174 100644
--- a/test/std/localization/locale.categories/category.monetary/locale.money.put/locale.money.put.members/put_long_double_ru_RU.pass.cpp
+++ b/test/std/localization/locale.categories/category.monetary/locale.money.put/locale.money.put.members/put_long_double_ru_RU.pass.cpp
@@ -9,6 +9,9 @@
//
// This test is passing in an uncontrolled manner in some Apple environment.
// UNSUPPORTED: apple-darwin
+//
+// NetBSD does not support LC_MONETARY at the moment
+// XFAIL: netbsd
// Failure related to GLIBC's use of U00A0 as mon_thousands_sep
// and U002E as mon_decimal_point.
diff --git a/test/std/localization/locale.categories/category.monetary/locale.money.put/locale.money.put.members/put_long_double_zh_CN.pass.cpp b/test/std/localization/locale.categories/category.monetary/locale.money.put/locale.money.put.members/put_long_double_zh_CN.pass.cpp
index 633e1885e711d..1036969bb38ad 100644
--- a/test/std/localization/locale.categories/category.monetary/locale.money.put/locale.money.put.members/put_long_double_zh_CN.pass.cpp
+++ b/test/std/localization/locale.categories/category.monetary/locale.money.put/locale.money.put.members/put_long_double_zh_CN.pass.cpp
@@ -6,6 +6,9 @@
// Source Licenses. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
+//
+// NetBSD does not support LC_MONETARY at the moment
+// XFAIL: netbsd
// REQUIRES: locale.zh_CN.UTF-8
diff --git a/test/std/localization/locale.categories/category.monetary/locale.moneypunct.byname/curr_symbol.pass.cpp b/test/std/localization/locale.categories/category.monetary/locale.moneypunct.byname/curr_symbol.pass.cpp
index 3a9adc4bbc1e2..c6cab19b2163c 100644
--- a/test/std/localization/locale.categories/category.monetary/locale.moneypunct.byname/curr_symbol.pass.cpp
+++ b/test/std/localization/locale.categories/category.monetary/locale.moneypunct.byname/curr_symbol.pass.cpp
@@ -8,6 +8,9 @@
//===----------------------------------------------------------------------===//
//
// XFAIL: apple-darwin
+//
+// NetBSD does not support LC_MONETARY at the moment
+// XFAIL: netbsd
// REQUIRES: locale.en_US.UTF-8
// REQUIRES: locale.fr_FR.UTF-8
diff --git a/test/std/localization/locale.categories/category.monetary/locale.moneypunct.byname/grouping.pass.cpp b/test/std/localization/locale.categories/category.monetary/locale.moneypunct.byname/grouping.pass.cpp
index b0b9da0b6949c..f050164b6c0b4 100644
--- a/test/std/localization/locale.categories/category.monetary/locale.moneypunct.byname/grouping.pass.cpp
+++ b/test/std/localization/locale.categories/category.monetary/locale.moneypunct.byname/grouping.pass.cpp
@@ -8,6 +8,9 @@
//===----------------------------------------------------------------------===//
//
// XFAIL: apple-darwin
+//
+// NetBSD does not support LC_MONETARY at the moment
+// XFAIL: netbsd
// REQUIRES: locale.en_US.UTF-8
// REQUIRES: locale.fr_FR.UTF-8
diff --git a/test/std/localization/locale.categories/category.monetary/locale.moneypunct.byname/neg_format.pass.cpp b/test/std/localization/locale.categories/category.monetary/locale.moneypunct.byname/neg_format.pass.cpp
index 3fe9faf847f41..edbaf86001840 100644
--- a/test/std/localization/locale.categories/category.monetary/locale.moneypunct.byname/neg_format.pass.cpp
+++ b/test/std/localization/locale.categories/category.monetary/locale.moneypunct.byname/neg_format.pass.cpp
@@ -8,6 +8,9 @@
//===----------------------------------------------------------------------===//
//
// XFAIL: apple-darwin
+//
+// NetBSD does not support LC_MONETARY at the moment
+// XFAIL: netbsd
// REQUIRES: locale.en_US.UTF-8
// REQUIRES: locale.fr_FR.UTF-8
diff --git a/test/std/localization/locale.categories/category.monetary/locale.moneypunct.byname/pos_format.pass.cpp b/test/std/localization/locale.categories/category.monetary/locale.moneypunct.byname/pos_format.pass.cpp
index 7038ab16e100c..f401b72d860a3 100644
--- a/test/std/localization/locale.categories/category.monetary/locale.moneypunct.byname/pos_format.pass.cpp
+++ b/test/std/localization/locale.categories/category.monetary/locale.moneypunct.byname/pos_format.pass.cpp
@@ -8,6 +8,9 @@
//===----------------------------------------------------------------------===//
//
// XFAIL: apple-darwin
+//
+// NetBSD does not support LC_MONETARY at the moment
+// XFAIL: netbsd
// REQUIRES: locale.en_US.UTF-8
// REQUIRES: locale.fr_FR.UTF-8
diff --git a/test/std/localization/locale.categories/category.monetary/locale.moneypunct.byname/thousands_sep.pass.cpp b/test/std/localization/locale.categories/category.monetary/locale.moneypunct.byname/thousands_sep.pass.cpp
index ca8abf09b8309..90fb7193e801a 100644
--- a/test/std/localization/locale.categories/category.monetary/locale.moneypunct.byname/thousands_sep.pass.cpp
+++ b/test/std/localization/locale.categories/category.monetary/locale.moneypunct.byname/thousands_sep.pass.cpp
@@ -6,6 +6,9 @@
// Source Licenses. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
+//
+// NetBSD does not support LC_MONETARY at the moment
+// XFAIL: netbsd
// REQUIRES: locale.en_US.UTF-8
// REQUIRES: locale.fr_FR.UTF-8
diff --git a/test/std/localization/locale.categories/category.numeric/locale.num.get/facet.num.get.members/get_long.pass.cpp b/test/std/localization/locale.categories/category.numeric/locale.num.get/facet.num.get.members/get_long.pass.cpp
index d900c3764a1f4..570b8306cee8c 100644
--- a/test/std/localization/locale.categories/category.numeric/locale.num.get/facet.num.get.members/get_long.pass.cpp
+++ b/test/std/localization/locale.categories/category.numeric/locale.num.get/facet.num.get.members/get_long.pass.cpp
@@ -17,6 +17,7 @@
#include <locale>
#include <ios>
#include <cassert>
+#include <limits>
#include <streambuf>
#include "test_iterators.h"
@@ -46,6 +47,7 @@ int main()
const my_facet f(1);
std::ios ios(0);
long v = -1;
+ const std::ios_base::fmtflags zf = static_cast<std::ios_base::fmtflags>(0);
{
const char str[] = "123";
assert((ios.flags() & ios.basefield) == ios.dec);
@@ -110,7 +112,7 @@ int main()
}
{
const char str[] = "123";
- ios.setf(0, ios.basefield);
+ ios.setf(zf, ios.basefield);
std::ios_base::iostate err = ios.goodbit;
input_iterator<const char*> iter =
f.get(input_iterator<const char*>(str),
@@ -122,7 +124,7 @@ int main()
}
{
const char str[] = "0x123";
- ios.setf(0, ios.basefield);
+ ios.setf(zf, ios.basefield);
std::ios_base::iostate err = ios.goodbit;
input_iterator<const char*> iter =
f.get(input_iterator<const char*>(str),
@@ -134,7 +136,7 @@ int main()
}
{
const char str[] = "0123";
- ios.setf(0, ios.basefield);
+ ios.setf(zf, ios.basefield);
std::ios_base::iostate err = ios.goodbit;
input_iterator<const char*> iter =
f.get(input_iterator<const char*>(str),
@@ -146,7 +148,7 @@ int main()
}
{
const char str[] = "2-";
- ios.setf(0, ios.basefield);
+ ios.setf(zf, ios.basefield);
std::ios_base::iostate err = ios.goodbit;
input_iterator<const char*> iter =
f.get(input_iterator<const char*>(str),
diff --git a/test/std/localization/locale.categories/category.numeric/locale.num.get/facet.num.get.members/test_min_max.pass.cpp b/test/std/localization/locale.categories/category.numeric/locale.num.get/facet.num.get.members/test_min_max.pass.cpp
index e2218fffb3968..ab02716e3470c 100644
--- a/test/std/localization/locale.categories/category.numeric/locale.num.get/facet.num.get.members/test_min_max.pass.cpp
+++ b/test/std/localization/locale.categories/category.numeric/locale.num.get/facet.num.get.members/test_min_max.pass.cpp
@@ -52,7 +52,7 @@ void check_limits()
}
}
-int main(void)
+int main()
{
check_limits<short>();
check_limits<unsigned short>();
diff --git a/test/std/localization/locale.categories/category.numeric/locale.num.get/facet.num.get.members/test_neg_one.pass.cpp b/test/std/localization/locale.categories/category.numeric/locale.num.get/facet.num.get.members/test_neg_one.pass.cpp
index bd9b3f05de7a2..bb40f31dbb147 100644
--- a/test/std/localization/locale.categories/category.numeric/locale.num.get/facet.num.get.members/test_neg_one.pass.cpp
+++ b/test/std/localization/locale.categories/category.numeric/locale.num.get/facet.num.get.members/test_neg_one.pass.cpp
@@ -14,6 +14,7 @@
// iter_type get(iter_type in, iter_type end, ios_base&,
// ios_base::iostate& err, unsigned int& v) const;
+#include <limits>
#include <locale>
#include <ios>
#include <cassert>
@@ -148,7 +149,7 @@ void test_negate() {
}
}
-int main(void)
+int main()
{
test_neg_one<long>();
test_neg_one<long long>();
diff --git a/test/std/localization/locale.categories/category.time/locale.time.get.byname/get_date.pass.cpp b/test/std/localization/locale.categories/category.time/locale.time.get.byname/get_date.pass.cpp
index af15b174bcd27..2b6ade5c09e85 100644
--- a/test/std/localization/locale.categories/category.time/locale.time.get.byname/get_date.pass.cpp
+++ b/test/std/localization/locale.categories/category.time/locale.time.get.byname/get_date.pass.cpp
@@ -6,6 +6,9 @@
// Source Licenses. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
+//
+// NetBSD does not support LC_TIME at the moment
+// XFAIL: netbsd
// REQUIRES: locale.en_US.UTF-8
// REQUIRES: locale.fr_FR.UTF-8
diff --git a/test/std/localization/locale.categories/category.time/locale.time.get.byname/get_date_wide.pass.cpp b/test/std/localization/locale.categories/category.time/locale.time.get.byname/get_date_wide.pass.cpp
index 1cd9f462e38e7..ec1e3e7c951db 100644
--- a/test/std/localization/locale.categories/category.time/locale.time.get.byname/get_date_wide.pass.cpp
+++ b/test/std/localization/locale.categories/category.time/locale.time.get.byname/get_date_wide.pass.cpp
@@ -6,6 +6,9 @@
// Source Licenses. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
+//
+// NetBSD does not support LC_TIME at the moment
+// XFAIL: netbsd
// REQUIRES: locale.en_US.UTF-8
// REQUIRES: locale.fr_FR.UTF-8
diff --git a/test/std/localization/locale.categories/category.time/locale.time.get.byname/get_one.pass.cpp b/test/std/localization/locale.categories/category.time/locale.time.get.byname/get_one.pass.cpp
index 72b63278d71d2..6cf3b6aef2561 100644
--- a/test/std/localization/locale.categories/category.time/locale.time.get.byname/get_one.pass.cpp
+++ b/test/std/localization/locale.categories/category.time/locale.time.get.byname/get_one.pass.cpp
@@ -6,6 +6,9 @@
// Source Licenses. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
+//
+// NetBSD does not support LC_TIME at the moment
+// XFAIL: netbsd
// REQUIRES: locale.en_US.UTF-8
// REQUIRES: locale.fr_FR.UTF-8
diff --git a/test/std/localization/locale.categories/category.time/locale.time.get.byname/get_one_wide.pass.cpp b/test/std/localization/locale.categories/category.time/locale.time.get.byname/get_one_wide.pass.cpp
index 4a2b3819b507f..1e7c170da7fb3 100644
--- a/test/std/localization/locale.categories/category.time/locale.time.get.byname/get_one_wide.pass.cpp
+++ b/test/std/localization/locale.categories/category.time/locale.time.get.byname/get_one_wide.pass.cpp
@@ -6,6 +6,9 @@
// Source Licenses. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
+//
+// NetBSD does not support LC_TIME at the moment
+// XFAIL: netbsd
// REQUIRES: locale.en_US.UTF-8
// REQUIRES: locale.fr_FR.UTF-8
diff --git a/test/std/localization/locale.categories/category.time/locale.time.put.byname/put1.pass.cpp b/test/std/localization/locale.categories/category.time/locale.time.put.byname/put1.pass.cpp
index 3e7538d6625b1..8e79357b5c16e 100644
--- a/test/std/localization/locale.categories/category.time/locale.time.put.byname/put1.pass.cpp
+++ b/test/std/localization/locale.categories/category.time/locale.time.put.byname/put1.pass.cpp
@@ -6,6 +6,9 @@
// Source Licenses. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
+//
+// NetBSD does not support LC_TIME at the moment
+// XFAIL: netbsd
// REQUIRES: locale.en_US.UTF-8
// REQUIRES: locale.fr_FR.UTF-8
diff --git a/test/std/localization/locale.categories/facet.numpunct/locale.numpunct.byname/grouping.pass.cpp b/test/std/localization/locale.categories/facet.numpunct/locale.numpunct.byname/grouping.pass.cpp
index f3df52a21b89b..1f2aeeabdb81e 100644
--- a/test/std/localization/locale.categories/facet.numpunct/locale.numpunct.byname/grouping.pass.cpp
+++ b/test/std/localization/locale.categories/facet.numpunct/locale.numpunct.byname/grouping.pass.cpp
@@ -6,6 +6,9 @@
// Source Licenses. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
+//
+// NetBSD does not support LC_NUMERIC at the moment
+// XFAIL: netbsd
// REQUIRES: locale.en_US.UTF-8
// REQUIRES: locale.fr_FR.UTF-8
diff --git a/test/std/localization/locale.categories/facet.numpunct/locale.numpunct.byname/thousands_sep.pass.cpp b/test/std/localization/locale.categories/facet.numpunct/locale.numpunct.byname/thousands_sep.pass.cpp
index 0dedf78c9e81f..b84f3a1c7edc2 100644
--- a/test/std/localization/locale.categories/facet.numpunct/locale.numpunct.byname/thousands_sep.pass.cpp
+++ b/test/std/localization/locale.categories/facet.numpunct/locale.numpunct.byname/thousands_sep.pass.cpp
@@ -6,6 +6,9 @@
// Source Licenses. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
+//
+// NetBSD does not support LC_NUMERIC at the moment
+// XFAIL: netbsd
// REQUIRES: locale.en_US.UTF-8
// REQUIRES: locale.fr_FR.UTF-8
diff --git a/test/std/localization/locales/locale/locale.cons/char_pointer.pass.cpp b/test/std/localization/locales/locale/locale.cons/char_pointer.pass.cpp
index aef2ea93d6675..7ba64b05186dc 100644
--- a/test/std/localization/locales/locale/locale.cons/char_pointer.pass.cpp
+++ b/test/std/localization/locales/locale/locale.cons/char_pointer.pass.cpp
@@ -6,6 +6,9 @@
// Source Licenses. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
+//
+// NetBSD does not support most of LC_* at the moment
+// XFAIL: netbsd
// REQUIRES: locale.ru_RU.UTF-8
// REQUIRES: locale.zh_CN.UTF-8
diff --git a/test/std/localization/locales/locale/locale.cons/locale_char_pointer_cat.pass.cpp b/test/std/localization/locales/locale/locale.cons/locale_char_pointer_cat.pass.cpp
index e25fe389392d9..6a79d3943d5ed 100644
--- a/test/std/localization/locales/locale/locale.cons/locale_char_pointer_cat.pass.cpp
+++ b/test/std/localization/locales/locale/locale.cons/locale_char_pointer_cat.pass.cpp
@@ -11,8 +11,8 @@
// REQUIRES: locale.ru_RU.UTF-8
// UNSUPPORTED: sanitizer-new-delete
-// XFAIL: availability_markup=macosx10.8
-// XFAIL: availability_markup=macosx10.7
+// XFAIL: availability=macosx10.8
+// XFAIL: availability=macosx10.7
// <locale>
diff --git a/test/std/localization/locales/locale/locale.cons/locale_locale_cat.pass.cpp b/test/std/localization/locales/locale/locale.cons/locale_locale_cat.pass.cpp
index 72d47a3914f3c..5bf6befed9fcd 100644
--- a/test/std/localization/locales/locale/locale.cons/locale_locale_cat.pass.cpp
+++ b/test/std/localization/locales/locale/locale.cons/locale_locale_cat.pass.cpp
@@ -11,8 +11,8 @@
// REQUIRES: locale.ru_RU.UTF-8
// UNSUPPORTED: sanitizer-new-delete
-// XFAIL: availability_markup=macosx10.8
-// XFAIL: availability_markup=macosx10.7
+// XFAIL: availability=macosx10.8
+// XFAIL: availability=macosx10.7
// <locale>
diff --git a/test/std/localization/locales/locale/locale.cons/locale_string_cat.pass.cpp b/test/std/localization/locales/locale/locale.cons/locale_string_cat.pass.cpp
index 26ddfa600ea55..946e8b53030af 100644
--- a/test/std/localization/locales/locale/locale.cons/locale_string_cat.pass.cpp
+++ b/test/std/localization/locales/locale/locale.cons/locale_string_cat.pass.cpp
@@ -11,8 +11,8 @@
// REQUIRES: locale.ru_RU.UTF-8
// UNSUPPORTED: sanitizer-new-delete
-// XFAIL: availability_markup=macosx10.8
-// XFAIL: availability_markup=macosx10.7
+// XFAIL: availability=macosx10.8
+// XFAIL: availability=macosx10.7
// <locale>
diff --git a/test/std/numerics/c.math/cmath.pass.cpp b/test/std/numerics/c.math/cmath.pass.cpp
index cc535e3743962..b02bdbe6447d8 100644
--- a/test/std/numerics/c.math/cmath.pass.cpp
+++ b/test/std/numerics/c.math/cmath.pass.cpp
@@ -16,6 +16,7 @@
#include "test_macros.h"
#include "hexfloat.h"
+#include "truncate_fp.h"
// convertible to int/float/double/etc
template <class T, int N=0>
@@ -860,7 +861,7 @@ void test_cbrt()
static_assert((std::is_same<decltype(std::cbrtf(0)), float>::value), "");
static_assert((std::is_same<decltype(std::cbrtl(0)), long double>::value), "");
static_assert((std::is_same<decltype(cbrt(Ambiguous())), Ambiguous>::value), "");
- assert(std::cbrt(1) == 1);
+ assert(truncate_fp(std::cbrt(1)) == 1);
}
void test_copysign()
diff --git a/test/std/numerics/complex.number/complex.ops/stream_input.pass.cpp b/test/std/numerics/complex.number/complex.ops/stream_input.pass.cpp
index 4d866acb8f430..24644e3077999 100644
--- a/test/std/numerics/complex.number/complex.ops/stream_input.pass.cpp
+++ b/test/std/numerics/complex.number/complex.ops/stream_input.pass.cpp
@@ -7,8 +7,6 @@
//
//===----------------------------------------------------------------------===//
-// XFAIL: with_system_cxx_lib=macosx10.7
-
// <complex>
// template<class T, class charT, class traits>
diff --git a/test/std/numerics/rand/rand.eng/rand.eng.mers/ctor_sseq_all_zero.pass.cpp b/test/std/numerics/rand/rand.eng/rand.eng.mers/ctor_sseq_all_zero.pass.cpp
new file mode 100644
index 0000000000000..4599348f4a090
--- /dev/null
+++ b/test/std/numerics/rand/rand.eng/rand.eng.mers/ctor_sseq_all_zero.pass.cpp
@@ -0,0 +1,81 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <random>
+
+// template <class UIntType, size_t w, size_t n, size_t m, size_t r,
+// UIntType a, size_t u, UIntType d, size_t s,
+// UIntType b, size_t t,
+// UIntType c, size_t l, UIntType f>
+// class mersenne_twister_engine;
+
+// template <class Sseq> explicit mersenne_twister_engine(Sseq &q);
+//
+// [ ... ] Finally, if the most significant $w-r$ bits of $X_{-n}$ are zero,
+// and if each of the other resulting $X_i$ is $0$, changes $X_{-n}$ to
+// $ 2^{w-1} $.
+
+#include <random>
+
+#include <algorithm>
+#include <cassert>
+#include <cstddef>
+#if TEST_STD_VER >= 11
+#include <initializer_list>
+#endif
+
+struct all_zero_seed_seq {
+ typedef unsigned int result_type;
+
+ all_zero_seed_seq() {}
+
+ template <typename InputIterator>
+ all_zero_seed_seq(InputIterator, InputIterator) {}
+#if TEST_STD_VER >= 11
+ all_zero_seed_seq(std::initializer_list<result_type>) {}
+#endif
+
+ template <typename RandomAccessIterator>
+ void generate(RandomAccessIterator rb, RandomAccessIterator re) {
+ std::fill(rb, re, 0u);
+ }
+
+ std::size_t size() const { return 0u; }
+ template <typename OutputIterator> void param(OutputIterator) const {}
+};
+
+template <typename result_type, std::size_t word_size>
+void test(void) {
+ const std::size_t state_size = 1u;
+ const std::size_t shift_size = 1u;
+ const std::size_t tempering_l = word_size;
+
+ all_zero_seed_seq q;
+ std::mersenne_twister_engine<result_type, word_size, state_size,
+ shift_size,
+ 0u,
+ 0x0,
+ 0u, 0x0, 0u, 0x0, 0u, 0x0,
+ tempering_l,
+ 0u>
+ e(q);
+
+ const result_type Xneg1 = result_type(1) << (word_size - 1);
+ const result_type Y = Xneg1;
+ const result_type X0 = Xneg1 ^ (Y >> 1);
+ assert(e() == X0);
+}
+
+int main() {
+ // Test for k == 1: word_size <= 32.
+ test<unsigned short, 3u>();
+
+ // Test for k == 2: (32 < word_size <= 64).
+ test<unsigned long long, 33u>();
+}
diff --git a/test/std/numerics/rand/rand.util/rand.util.canonical/generate_canonical.pass.cpp b/test/std/numerics/rand/rand.util/rand.util.canonical/generate_canonical.pass.cpp
index 7433e28e49354..df2acbe9e867a 100644
--- a/test/std/numerics/rand/rand.util/rand.util.canonical/generate_canonical.pass.cpp
+++ b/test/std/numerics/rand/rand.util/rand.util.canonical/generate_canonical.pass.cpp
@@ -15,6 +15,8 @@
#include <random>
#include <cassert>
+#include "truncate_fp.h"
+
int main()
{
{
@@ -22,35 +24,35 @@ int main()
typedef float F;
E r;
F f = std::generate_canonical<F, 0>(r);
- assert(f == (16807 - E::min()) / (E::max() - E::min() + F(1)));
+ assert(f == truncate_fp((16807 - E::min()) / (E::max() - E::min() + F(1))));
}
{
typedef std::minstd_rand0 E;
typedef float F;
E r;
F f = std::generate_canonical<F, 1>(r);
- assert(f == (16807 - E::min()) / (E::max() - E::min() + F(1)));
+ assert(f == truncate_fp((16807 - E::min()) / (E::max() - E::min() + F(1))));
}
{
typedef std::minstd_rand0 E;
typedef float F;
E r;
F f = std::generate_canonical<F, std::numeric_limits<F>::digits - 1>(r);
- assert(f == (16807 - E::min()) / (E::max() - E::min() + F(1)));
+ assert(f == truncate_fp((16807 - E::min()) / (E::max() - E::min() + F(1))));
}
{
typedef std::minstd_rand0 E;
typedef float F;
E r;
F f = std::generate_canonical<F, std::numeric_limits<F>::digits>(r);
- assert(f == (16807 - E::min()) / (E::max() - E::min() + F(1)));
+ assert(f == truncate_fp((16807 - E::min()) / (E::max() - E::min() + F(1))));
}
{
typedef std::minstd_rand0 E;
typedef float F;
E r;
F f = std::generate_canonical<F, std::numeric_limits<F>::digits + 1>(r);
- assert(f == (16807 - E::min()) / (E::max() - E::min() + F(1)));
+ assert(f == truncate_fp((16807 - E::min()) / (E::max() - E::min() + F(1))));
}
{
@@ -58,43 +60,43 @@ int main()
typedef double F;
E r;
F f = std::generate_canonical<F, 0>(r);
- assert(f == (16807 - E::min()) / (E::max() - E::min() + F(1)));
+ assert(f == truncate_fp((16807 - E::min()) / (E::max() - E::min() + F(1))));
}
{
typedef std::minstd_rand0 E;
typedef double F;
E r;
F f = std::generate_canonical<F, 1>(r);
- assert(f == (16807 - E::min()) / (E::max() - E::min() + F(1)));
+ assert(f == truncate_fp((16807 - E::min()) / (E::max() - E::min() + F(1))));
}
{
typedef std::minstd_rand0 E;
typedef double F;
E r;
F f = std::generate_canonical<F, std::numeric_limits<F>::digits - 1>(r);
- assert(f ==
+ assert(f == truncate_fp(
(16807 - E::min() +
(282475249 - E::min()) * (E::max() - E::min() + F(1))) /
- ((E::max() - E::min() + F(1)) * (E::max() - E::min() + F(1))));
+ ((E::max() - E::min() + F(1)) * (E::max() - E::min() + F(1)))));
}
{
typedef std::minstd_rand0 E;
typedef double F;
E r;
F f = std::generate_canonical<F, std::numeric_limits<F>::digits>(r);
- assert(f ==
+ assert(f == truncate_fp(
(16807 - E::min() +
(282475249 - E::min()) * (E::max() - E::min() + F(1))) /
- ((E::max() - E::min() + F(1)) * (E::max() - E::min() + F(1))));
+ ((E::max() - E::min() + F(1)) * (E::max() - E::min() + F(1)))));
}
{
typedef std::minstd_rand0 E;
typedef double F;
E r;
F f = std::generate_canonical<F, std::numeric_limits<F>::digits + 1>(r);
- assert(f ==
+ assert(f == truncate_fp(
(16807 - E::min() +
(282475249 - E::min()) * (E::max() - E::min() + F(1))) /
- ((E::max() - E::min() + F(1)) * (E::max() - E::min() + F(1))));
+ ((E::max() - E::min() + F(1)) * (E::max() - E::min() + F(1)))));
}
}
diff --git a/test/std/re/re.alg/re.alg.match/basic.pass.cpp b/test/std/re/re.alg/re.alg.match/basic.pass.cpp
index cb23cfa15d241..5140ec91762a8 100644
--- a/test/std/re/re.alg/re.alg.match/basic.pass.cpp
+++ b/test/std/re/re.alg/re.alg.match/basic.pass.cpp
@@ -6,6 +6,9 @@
// Source Licenses. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
+//
+// NetBSD does not support LC_COLLATE at the moment
+// XFAIL: netbsd
// REQUIRES: locale.cs_CZ.ISO8859-2
diff --git a/test/std/re/re.alg/re.alg.match/ecma.pass.cpp b/test/std/re/re.alg/re.alg.match/ecma.pass.cpp
index ae42b46668b06..a676e9e52bcc8 100644
--- a/test/std/re/re.alg/re.alg.match/ecma.pass.cpp
+++ b/test/std/re/re.alg/re.alg.match/ecma.pass.cpp
@@ -6,6 +6,9 @@
// Source Licenses. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
+//
+// NetBSD does not support LC_COLLATE at the moment
+// XFAIL: netbsd
// REQUIRES: locale.cs_CZ.ISO8859-2
diff --git a/test/std/re/re.alg/re.alg.match/extended.pass.cpp b/test/std/re/re.alg/re.alg.match/extended.pass.cpp
index aac03839a05dc..8aa71f75d748e 100644
--- a/test/std/re/re.alg/re.alg.match/extended.pass.cpp
+++ b/test/std/re/re.alg/re.alg.match/extended.pass.cpp
@@ -6,6 +6,9 @@
// Source Licenses. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
+//
+// NetBSD does not support LC_COLLATE at the moment
+// XFAIL: netbsd
// REQUIRES: locale.cs_CZ.ISO8859-2
diff --git a/test/std/re/re.alg/re.alg.match/inverted_character_classes.pass.cpp b/test/std/re/re.alg/re.alg.match/inverted_character_classes.pass.cpp
new file mode 100644
index 0000000000000..5a19edc1a4d62
--- /dev/null
+++ b/test/std/re/re.alg/re.alg.match/inverted_character_classes.pass.cpp
@@ -0,0 +1,44 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <regex>
+// UNSUPPORTED: c++98, c++03
+
+// Make sure that we correctly match inverted character classes.
+
+#include <cassert>
+#include <regex>
+
+
+int main() {
+ assert(std::regex_match("X", std::regex("[X]")));
+ assert(std::regex_match("X", std::regex("[XY]")));
+ assert(!std::regex_match("X", std::regex("[^X]")));
+ assert(!std::regex_match("X", std::regex("[^XY]")));
+
+ assert(std::regex_match("X", std::regex("[\\S]")));
+ assert(!std::regex_match("X", std::regex("[^\\S]")));
+
+ assert(!std::regex_match("X", std::regex("[\\s]")));
+ assert(std::regex_match("X", std::regex("[^\\s]")));
+
+ assert(std::regex_match("X", std::regex("[\\s\\S]")));
+ assert(std::regex_match("X", std::regex("[^Y\\s]")));
+ assert(!std::regex_match("X", std::regex("[^X\\s]")));
+
+ assert(std::regex_match("X", std::regex("[\\w]")));
+ assert(std::regex_match("_", std::regex("[\\w]")));
+ assert(!std::regex_match("X", std::regex("[^\\w]")));
+ assert(!std::regex_match("_", std::regex("[^\\w]")));
+
+ assert(!std::regex_match("X", std::regex("[\\W]")));
+ assert(!std::regex_match("_", std::regex("[\\W]")));
+ assert(std::regex_match("X", std::regex("[^\\W]")));
+ assert(std::regex_match("_", std::regex("[^\\W]")));
+}
diff --git a/test/std/re/re.alg/re.alg.match/parse_curly_brackets.pass.cpp b/test/std/re/re.alg/re.alg.match/parse_curly_brackets.pass.cpp
index d9c5172303fcb..59673ec882f99 100644
--- a/test/std/re/re.alg/re.alg.match/parse_curly_brackets.pass.cpp
+++ b/test/std/re/re.alg/re.alg.match/parse_curly_brackets.pass.cpp
@@ -63,8 +63,7 @@ test4()
assert((std::regex_match(target, smatch, regex)));
}
-int
-main()
+int main()
{
test1();
test2();
diff --git a/test/std/re/re.alg/re.alg.search/awk.pass.cpp b/test/std/re/re.alg/re.alg.search/awk.pass.cpp
index be0c74e9c7793..85f38ec63dac0 100644
--- a/test/std/re/re.alg/re.alg.search/awk.pass.cpp
+++ b/test/std/re/re.alg/re.alg.search/awk.pass.cpp
@@ -6,6 +6,9 @@
// Source Licenses. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
+//
+// NetBSD does not support LC_COLLATE at the moment
+// XFAIL: netbsd
// REQUIRES: locale.cs_CZ.ISO8859-2
diff --git a/test/std/re/re.alg/re.alg.search/basic.pass.cpp b/test/std/re/re.alg/re.alg.search/basic.pass.cpp
index 11982a26d0034..82f051a071d88 100644
--- a/test/std/re/re.alg/re.alg.search/basic.pass.cpp
+++ b/test/std/re/re.alg/re.alg.search/basic.pass.cpp
@@ -6,6 +6,9 @@
// Source Licenses. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
+//
+// NetBSD does not support LC_COLLATE at the moment
+// XFAIL: netbsd
// REQUIRES: locale.cs_CZ.ISO8859-2
diff --git a/test/std/re/re.alg/re.alg.search/ecma.pass.cpp b/test/std/re/re.alg/re.alg.search/ecma.pass.cpp
index c41019542a554..a8ae1f550d71c 100644
--- a/test/std/re/re.alg/re.alg.search/ecma.pass.cpp
+++ b/test/std/re/re.alg/re.alg.search/ecma.pass.cpp
@@ -6,6 +6,9 @@
// Source Licenses. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
+//
+// NetBSD does not support LC_COLLATE at the moment
+// XFAIL: netbsd
// REQUIRES: locale.cs_CZ.ISO8859-2
diff --git a/test/std/re/re.alg/re.alg.search/extended.pass.cpp b/test/std/re/re.alg/re.alg.search/extended.pass.cpp
index 4a2e6647e0792..6d95ad27502fb 100644
--- a/test/std/re/re.alg/re.alg.search/extended.pass.cpp
+++ b/test/std/re/re.alg/re.alg.search/extended.pass.cpp
@@ -6,6 +6,9 @@
// Source Licenses. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
+//
+// NetBSD does not support LC_COLLATE at the moment
+// XFAIL: netbsd
// REQUIRES: locale.cs_CZ.ISO8859-2
diff --git a/test/std/re/re.alg/re.alg.search/invert_neg_word_search.pass.cpp b/test/std/re/re.alg/re.alg.search/invert_neg_word_search.pass.cpp
index dd17d3519e3e4..dc0b98558048e 100644
--- a/test/std/re/re.alg/re.alg.search/invert_neg_word_search.pass.cpp
+++ b/test/std/re/re.alg/re.alg.search/invert_neg_word_search.pass.cpp
@@ -18,7 +18,7 @@
#include <regex>
#include <cassert>
-#include "test_macros.h"
+
// PR34310
int main()
diff --git a/test/std/re/re.grammar/excessive_brace_count.pass.cpp b/test/std/re/re.grammar/excessive_brace_count.pass.cpp
index 597182e7e0960..c4dade7dee41c 100644
--- a/test/std/re/re.grammar/excessive_brace_count.pass.cpp
+++ b/test/std/re/re.grammar/excessive_brace_count.pass.cpp
@@ -9,7 +9,7 @@
// <regex>
// UNSUPPORTED: libcpp-no-exceptions
-// UNSUPPORTED: c++03
+// UNSUPPORTED: c++98, c++03
// the "n" in `a{n}` should be within the numeric limits.
diff --git a/test/std/re/re.results/re.results.const/copy.pass.cpp b/test/std/re/re.results/re.results.const/copy.pass.cpp
new file mode 100644
index 0000000000000..ab0e388b5f438
--- /dev/null
+++ b/test/std/re/re.results/re.results.const/copy.pass.cpp
@@ -0,0 +1,41 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <regex>
+
+// class match_results<BidirectionalIterator, Allocator>
+
+// match_results(const match_results& m);
+
+#include <regex>
+#include <cassert>
+#include "test_macros.h"
+#include "test_allocator.h"
+
+template <class CharT, class Allocator>
+void
+test(const Allocator& a)
+{
+ typedef std::match_results<const CharT*, Allocator> SM;
+ SM m0(a);
+ SM m1(m0);
+
+ assert(m1.size() == m0.size());
+ assert(m1.str() == m0.str());
+ assert(m1.get_allocator() == m0.get_allocator());
+}
+
+int main()
+{
+ test<char> (std::allocator<std::sub_match<const char *> >());
+ test<wchar_t>(std::allocator<std::sub_match<const wchar_t *> >());
+
+ test<char> (test_allocator<std::sub_match<const char*> >(3));
+ test<wchar_t>(test_allocator<std::sub_match<const wchar_t*> >(3));
+}
diff --git a/test/std/re/re.results/re.results.const/copy_assign.pass.cpp b/test/std/re/re.results/re.results.const/copy_assign.pass.cpp
new file mode 100644
index 0000000000000..d390d62f04a31
--- /dev/null
+++ b/test/std/re/re.results/re.results.const/copy_assign.pass.cpp
@@ -0,0 +1,50 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <regex>
+
+// class match_results<BidirectionalIterator, Allocator>
+
+// match_results& operator=(const match_results& m);
+
+#include <regex>
+#include <cassert>
+#include "test_macros.h"
+#include "test_allocator.h"
+
+template <class CharT, class Allocator>
+void
+test(const Allocator& a)
+{
+ typedef std::match_results<const CharT*, Allocator> SM;
+ SM m0(a);
+ SM m1;
+
+ m1 = m0;
+ assert(m1.size() == m0.size());
+ assert(m1.str() == m0.str());
+ if (std::allocator_traits<Allocator>::propagate_on_container_copy_assignment::value)
+ assert(m1.get_allocator() == m0.get_allocator());
+ else
+ assert(m1.get_allocator() == Allocator());
+}
+
+int main()
+{
+ test<char> (std::allocator<std::sub_match<const char *> >());
+ test<wchar_t>(std::allocator<std::sub_match<const wchar_t *> >());
+
+// test_allocator has POCCA -> false
+ test<char> (test_allocator<std::sub_match<const char*> >(3));
+ test<wchar_t>(test_allocator<std::sub_match<const wchar_t*> >(3));
+
+// other_allocator has POCCA -> true
+ test<char> (other_allocator<std::sub_match<const char*> >(3));
+ test<wchar_t>(other_allocator<std::sub_match<const wchar_t*> >(3));
+}
diff --git a/test/std/re/re.results/re.results.const/move.pass.cpp b/test/std/re/re.results/re.results.const/move.pass.cpp
new file mode 100644
index 0000000000000..2c2233c761277
--- /dev/null
+++ b/test/std/re/re.results/re.results.const/move.pass.cpp
@@ -0,0 +1,48 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+// UNSUPPORTED: c++98, c++03
+// <regex>
+
+// class match_results<BidirectionalIterator, Allocator>
+
+// match_results(match_results&& m) noexcept;
+//
+// Additionally, the stored Allocator value is move constructed from m.get_allocator().
+
+#include <regex>
+#include <cassert>
+#include "test_macros.h"
+#include "test_allocator.h"
+
+template <class CharT, class Allocator>
+void
+test(const Allocator& a)
+{
+ typedef std::match_results<const CharT*, Allocator> SM;
+ ASSERT_NOEXCEPT(SM(std::declval<SM&&>()));
+
+ SM m0(a);
+ assert(m0.get_allocator() == a);
+
+ SM m1(std::move(m0));
+ assert(m1.size() == 0);
+ assert(m1.str() == std::basic_string<CharT>());
+ assert(m1.get_allocator() == a);
+}
+
+int main()
+{
+ test<char> (std::allocator<std::sub_match<const char *> >());
+ test<wchar_t>(std::allocator<std::sub_match<const wchar_t *> >());
+
+ test<char> (test_allocator<std::sub_match<const char*> >(3));
+ assert(test_alloc_base::moved == 1);
+ test<wchar_t>(test_allocator<std::sub_match<const wchar_t*> >(3));
+ assert(test_alloc_base::moved == 2);
+}
diff --git a/test/std/re/re.results/re.results.const/move_assign.pass.cpp b/test/std/re/re.results/re.results.const/move_assign.pass.cpp
new file mode 100644
index 0000000000000..2d2e81b172378
--- /dev/null
+++ b/test/std/re/re.results/re.results.const/move_assign.pass.cpp
@@ -0,0 +1,51 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+// UNSUPPORTED: c++03
+
+// <regex>
+
+// class match_results<BidirectionalIterator, Allocator>
+
+// match_results& operator=(match_results&& m);
+
+#include <regex>
+#include <cassert>
+#include "test_macros.h"
+#include "test_allocator.h"
+
+template <class CharT, class Allocator>
+void
+test(const Allocator& a)
+{
+ typedef std::match_results<const CharT*, Allocator> SM;
+ SM m0(a);
+ SM m1;
+
+ m1 = std::move(m0);
+ assert(m1.size() == 0);
+ assert(m1.str() == std::basic_string<CharT>());
+ if (std::allocator_traits<Allocator>::propagate_on_container_move_assignment::value)
+ assert(m1.get_allocator() == a);
+ else
+ assert(m1.get_allocator() == Allocator());
+}
+
+int main()
+{
+ test<char> (std::allocator<std::sub_match<const char *> >());
+ test<wchar_t>(std::allocator<std::sub_match<const wchar_t *> >());
+
+// test_allocator has POCMA -> false
+ test<char> (test_allocator<std::sub_match<const char*> >(3));
+ test<wchar_t>(test_allocator<std::sub_match<const wchar_t*> >(3));
+
+// other_allocator has POCMA -> true
+ test<char> (other_allocator<std::sub_match<const char*> >(3));
+ test<wchar_t>(other_allocator<std::sub_match<const wchar_t*> >(3));
+}
diff --git a/test/std/re/re.traits/lookup_collatename.pass.cpp b/test/std/re/re.traits/lookup_collatename.pass.cpp
index 3aeed7bddf755..ef5c14257ac05 100644
--- a/test/std/re/re.traits/lookup_collatename.pass.cpp
+++ b/test/std/re/re.traits/lookup_collatename.pass.cpp
@@ -6,6 +6,9 @@
// Source Licenses. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
+//
+// NetBSD does not support LC_COLLATE at the moment
+// XFAIL: netbsd
// REQUIRES: locale.cs_CZ.ISO8859-2
diff --git a/test/std/re/re.traits/transform.pass.cpp b/test/std/re/re.traits/transform.pass.cpp
index 57e6b753abefa..7563b395216fe 100644
--- a/test/std/re/re.traits/transform.pass.cpp
+++ b/test/std/re/re.traits/transform.pass.cpp
@@ -7,6 +7,9 @@
// Source Licenses. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
+//
+// NetBSD does not support LC_COLLATE at the moment
+// XFAIL: netbsd
// REQUIRES: locale.cs_CZ.ISO8859-2
diff --git a/test/std/re/re.traits/transform_primary.pass.cpp b/test/std/re/re.traits/transform_primary.pass.cpp
index 03b4f3985a609..2dd8ed247cb46 100644
--- a/test/std/re/re.traits/transform_primary.pass.cpp
+++ b/test/std/re/re.traits/transform_primary.pass.cpp
@@ -7,6 +7,9 @@
// Source Licenses. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
+//
+// NetBSD does not support LC_COLLATE at the moment
+// XFAIL: netbsd
// REQUIRES: locale.cs_CZ.ISO8859-2
diff --git a/test/std/re/re.traits/translate_nocase.pass.cpp b/test/std/re/re.traits/translate_nocase.pass.cpp
index 33d365a9ede32..601da6b862ade 100644
--- a/test/std/re/re.traits/translate_nocase.pass.cpp
+++ b/test/std/re/re.traits/translate_nocase.pass.cpp
@@ -16,12 +16,6 @@
// REQUIRES: locale.en_US.UTF-8
-// XFAIL: with_system_cxx_lib=macosx10.7
-// XFAIL: with_system_cxx_lib=macosx10.8
-
-// TODO: investigation needed
-// XFAIL: linux-gnu
-
#include <regex>
#include <cassert>
@@ -47,8 +41,6 @@ int main()
assert(t.translate_nocase('.') == '.');
assert(t.translate_nocase('a') == 'a');
assert(t.translate_nocase('1') == '1');
- assert(t.translate_nocase('\xDA') == '\xFA');
- assert(t.translate_nocase('\xFA') == '\xFA');
}
{
std::regex_traits<wchar_t> t;
diff --git a/test/std/strings/basic.string.hash/enabled_hashes.pass.cpp b/test/std/strings/basic.string.hash/enabled_hashes.pass.cpp
index 01f01218999df..e6f3d53a84e12 100644
--- a/test/std/strings/basic.string.hash/enabled_hashes.pass.cpp
+++ b/test/std/strings/basic.string.hash/enabled_hashes.pass.cpp
@@ -23,6 +23,9 @@ int main() {
{
test_hash_enabled_for_type<std::string>();
test_hash_enabled_for_type<std::wstring>();
+#if defined(__cpp_lib_char8_t) && __cpp_lib_char8_t >= 201811L
+ test_hash_enabled_for_type<std::u8string>();
+#endif
#ifndef _LIBCPP_HAS_NO_UNICODE_CHARS
test_hash_enabled_for_type<std::u16string>();
test_hash_enabled_for_type<std::u32string>();
diff --git a/test/std/strings/basic.string.hash/strings.pass.cpp b/test/std/strings/basic.string.hash/strings.pass.cpp
index d74e485752fc6..449ad8f1139b0 100644
--- a/test/std/strings/basic.string.hash/strings.pass.cpp
+++ b/test/std/strings/basic.string.hash/strings.pass.cpp
@@ -44,6 +44,9 @@ test()
int main()
{
test<std::string>();
+#if defined(__cpp_lib_char8_t) && __cpp_lib_char8_t >= 201811L
+ test<std::u8string>();
+#endif
#ifndef _LIBCPP_HAS_NO_UNICODE_CHARS
test<std::u16string>();
test<std::u32string>();
diff --git a/test/std/strings/basic.string.literals/literal.pass.cpp b/test/std/strings/basic.string.literals/literal.pass.cpp
index d121e25ba2707..cbb03ef61f11e 100644
--- a/test/std/strings/basic.string.literals/literal.pass.cpp
+++ b/test/std/strings/basic.string.literals/literal.pass.cpp
@@ -13,36 +13,46 @@
#include <string>
#include <cassert>
+#include "test_macros.h"
+
+#if defined(__cpp_lib_char8_t) && __cpp_lib_char8_t >= 201811L
+ typedef std::u8string u8string;
+#else
+ typedef std::string u8string;
+#endif
+
+
int main()
{
using namespace std::literals::string_literals;
static_assert ( std::is_same<decltype( "Hi"s), std::string>::value, "" );
- static_assert ( std::is_same<decltype( u8"Hi"s), std::string>::value, "" );
+ static_assert ( std::is_same<decltype( u8"Hi"s), u8string>::value, "" );
static_assert ( std::is_same<decltype( L"Hi"s), std::wstring>::value, "" );
static_assert ( std::is_same<decltype( u"Hi"s), std::u16string>::value, "" );
static_assert ( std::is_same<decltype( U"Hi"s), std::u32string>::value, "" );
std::string foo;
std::wstring Lfoo;
+ u8string u8foo;
std::u16string ufoo;
std::u32string Ufoo;
- foo = ""s; assert( foo.size() == 0);
- foo = u8""s; assert( foo.size() == 0);
- Lfoo = L""s; assert(Lfoo.size() == 0);
- ufoo = u""s; assert(ufoo.size() == 0);
- Ufoo = U""s; assert(Ufoo.size() == 0);
+ foo = ""s; assert( foo.size() == 0);
+ u8foo = u8""s; assert(u8foo.size() == 0);
+ Lfoo = L""s; assert( Lfoo.size() == 0);
+ ufoo = u""s; assert( ufoo.size() == 0);
+ Ufoo = U""s; assert( Ufoo.size() == 0);
- foo = " "s; assert( foo.size() == 1);
- foo = u8" "s; assert( foo.size() == 1);
- Lfoo = L" "s; assert(Lfoo.size() == 1);
- ufoo = u" "s; assert(ufoo.size() == 1);
- Ufoo = U" "s; assert(Ufoo.size() == 1);
+ foo = " "s; assert( foo.size() == 1);
+ u8foo = u8" "s; assert(u8foo.size() == 1);
+ Lfoo = L" "s; assert( Lfoo.size() == 1);
+ ufoo = u" "s; assert( ufoo.size() == 1);
+ Ufoo = U" "s; assert( Ufoo.size() == 1);
- foo = "ABC"s; assert( foo == "ABC"); assert( foo == std::string ( "ABC"));
- foo = u8"ABC"s; assert( foo == u8"ABC"); assert( foo == std::string (u8"ABC"));
- Lfoo = L"ABC"s; assert(Lfoo == L"ABC"); assert(Lfoo == std::wstring ( L"ABC"));
- ufoo = u"ABC"s; assert(ufoo == u"ABC"); assert(ufoo == std::u16string( u"ABC"));
- Ufoo = U"ABC"s; assert(Ufoo == U"ABC"); assert(Ufoo == std::u32string( U"ABC"));
+ foo = "ABC"s; assert( foo == "ABC"); assert( foo == std::string ( "ABC"));
+ u8foo = u8"ABC"s; assert(u8foo == u8"ABC"); assert(u8foo == u8string (u8"ABC"));
+ Lfoo = L"ABC"s; assert( Lfoo == L"ABC"); assert( Lfoo == std::wstring ( L"ABC"));
+ ufoo = u"ABC"s; assert( ufoo == u"ABC"); assert( ufoo == std::u16string( u"ABC"));
+ Ufoo = U"ABC"s; assert( Ufoo == U"ABC"); assert( Ufoo == std::u32string( U"ABC"));
}
diff --git a/test/std/strings/basic.string/string.capacity/over_max_size.pass.cpp b/test/std/strings/basic.string/string.capacity/over_max_size.pass.cpp
index f36f53e656db9..3dfd32aebaa70 100644
--- a/test/std/strings/basic.string/string.capacity/over_max_size.pass.cpp
+++ b/test/std/strings/basic.string/string.capacity/over_max_size.pass.cpp
@@ -20,6 +20,7 @@
#include <string>
#include <cassert>
+#include <stdexcept>
#include "min_allocator.h"
diff --git a/test/std/strings/basic.string/string.capacity/reserve.pass.cpp b/test/std/strings/basic.string/string.capacity/reserve.pass.cpp
index 7210152ea3cb1..8b9dc13db838a 100644
--- a/test/std/strings/basic.string/string.capacity/reserve.pass.cpp
+++ b/test/std/strings/basic.string/string.capacity/reserve.pass.cpp
@@ -9,7 +9,9 @@
// <string>
-// void reserve(size_type res_arg=0);
+// Split into two calls for C++20
+// void reserve();
+// void reserve(size_type res_arg);
#include <string>
#include <stdexcept>
@@ -44,6 +46,9 @@ test(S s, typename S::size_type res_arg)
assert(s == s0);
assert(s.capacity() >= res_arg);
assert(s.capacity() >= s.size());
+#if TEST_STD_VER > 17
+ assert(s.capacity() >= old_cap); // resize never shrinks as of P0966
+#endif
}
#ifndef TEST_HAS_NO_EXCEPTIONS
else
@@ -90,6 +95,7 @@ int main()
test(s, 10);
test(s, 50);
test(s, 100);
+ test(s, 1000);
test(s, S::npos);
}
}
@@ -121,6 +127,7 @@ int main()
test(s, 10);
test(s, 50);
test(s, 100);
+ test(s, 1000);
test(s, S::npos);
}
}
diff --git a/test/std/strings/basic.string/string.cons/string_view_deduction.pass.cpp b/test/std/strings/basic.string/string.cons/string_view_deduction.pass.cpp
index df1e99e0147ff..a1f3c4b51f946 100644
--- a/test/std/strings/basic.string/string.cons/string_view_deduction.pass.cpp
+++ b/test/std/strings/basic.string/string.cons/string_view_deduction.pass.cpp
@@ -72,6 +72,18 @@ int main()
assert(s1.size() == sv.size());
assert(s1.compare(0, s1.size(), sv.data(), s1.size()) == 0);
}
+#if defined(__cpp_lib_char8_t) && __cpp_lib_char8_t >= 201811L
+ {
+ std::u8string_view sv = u8"12345678901234";
+ std::basic_string s1{sv, min_allocator<char8_t>{}};
+ using S = decltype(s1); // what type did we get?
+ static_assert(std::is_same_v<S::value_type, char8_t>, "");
+ static_assert(std::is_same_v<S::traits_type, std::char_traits<char8_t>>, "");
+ static_assert(std::is_same_v<S::allocator_type, min_allocator<char8_t>>, "");
+ assert(s1.size() == sv.size());
+ assert(s1.compare(0, s1.size(), sv.data(), s1.size()) == 0);
+ }
+#endif
{
std::u16string_view sv = u"12345678901234";
std::basic_string s1{sv, min_allocator<char16_t>{}};
diff --git a/test/std/strings/basic.string/string.cons/string_view_size_size_deduction.fail.cpp b/test/std/strings/basic.string/string.cons/string_view_size_size_deduction.fail.cpp
index f79e43f6a6b09..17cb7dd167e12 100644
--- a/test/std/strings/basic.string/string.cons/string_view_size_size_deduction.fail.cpp
+++ b/test/std/strings/basic.string/string.cons/string_view_size_size_deduction.fail.cpp
@@ -25,7 +25,7 @@
// const Allocator& = Allocator())
// -> basic_string<charT, traits, Allocator>;
//
-// A size_type parameter type in a basic_string deduction guide refers to the size_type
+// A size_type parameter type in a basic_string deduction guide refers to the size_type
// member type of the type deduced by the deduction guide.
//
// The deduction guide shall not participate in overload resolution if Allocator
diff --git a/test/std/strings/basic.string/string.cons/string_view_size_size_deduction.pass.cpp b/test/std/strings/basic.string/string.cons/string_view_size_size_deduction.pass.cpp
index d9561d22b8826..fd9684e1fa999 100644
--- a/test/std/strings/basic.string/string.cons/string_view_size_size_deduction.pass.cpp
+++ b/test/std/strings/basic.string/string.cons/string_view_size_size_deduction.pass.cpp
@@ -25,7 +25,7 @@
// const Allocator& = Allocator())
// -> basic_string<charT, traits, Allocator>;
//
-// A size_type parameter type in a basic_string deduction guide refers to the size_type
+// A size_type parameter type in a basic_string deduction guide refers to the size_type
// member type of the type deduced by the deduction guide.
//
// The deduction guide shall not participate in overload resolution if Allocator
@@ -76,6 +76,18 @@ int main()
assert(s1.size() == 4);
assert(s1.compare(0, s1.size(), sv.data(), s1.size()) == 0);
}
+#if defined(__cpp_lib_char8_t) && __cpp_lib_char8_t >= 201811L
+ {
+ std::u8string_view sv = u8"12345678901234";
+ std::basic_string s1{sv, 0, 4, min_allocator<char8_t>{}};
+ using S = decltype(s1); // what type did we get?
+ static_assert(std::is_same_v<S::value_type, char8_t>, "");
+ static_assert(std::is_same_v<S::traits_type, std::char_traits<char8_t>>, "");
+ static_assert(std::is_same_v<S::allocator_type, min_allocator<char8_t>>, "");
+ assert(s1.size() == 4);
+ assert(s1.compare(0, s1.size(), sv.data(), s1.size()) == 0);
+ }
+#endif
{
std::u16string_view sv = u"12345678901234";
std::basic_string s1{sv, 0, 4, min_allocator<char16_t>{}};
diff --git a/test/std/strings/basic.string/string.iterators/iterators.pass.cpp b/test/std/strings/basic.string/string.iterators/iterators.pass.cpp
index 9466f11351023..8bc6e4fb25658 100644
--- a/test/std/strings/basic.string/string.iterators/iterators.pass.cpp
+++ b/test/std/strings/basic.string/string.iterators/iterators.pass.cpp
@@ -47,6 +47,20 @@ int main()
assert ( !(ii1 != cii ));
}
+#if defined(__cpp_lib_char8_t) && __cpp_lib_char8_t >= 201811L
+ {
+ typedef std::u8string C;
+ C::iterator ii1{}, ii2{};
+ C::iterator ii4 = ii1;
+ C::const_iterator cii{};
+ assert ( ii1 == ii2 );
+ assert ( ii1 == ii4 );
+ assert ( ii1 == cii );
+ assert ( !(ii1 != ii2 ));
+ assert ( !(ii1 != cii ));
+ }
+#endif
+
{ // N3644 testing
typedef std::u16string C;
C::iterator ii1{}, ii2{};
diff --git a/test/std/strings/c.strings/cctype.pass.cpp b/test/std/strings/c.strings/cctype.pass.cpp
index 027fbcd469d50..695c5e40d7b00 100644
--- a/test/std/strings/c.strings/cctype.pass.cpp
+++ b/test/std/strings/c.strings/cctype.pass.cpp
@@ -13,6 +13,8 @@
#include <type_traits>
#include <cassert>
+#include "test_macros.h"
+
#ifdef isalnum
#error isalnum defined
#endif
@@ -71,33 +73,34 @@
int main()
{
- static_assert((std::is_same<decltype(std::isalnum(0)), int>::value), "");
- static_assert((std::is_same<decltype(std::isalpha(0)), int>::value), "");
- static_assert((std::is_same<decltype(std::isblank(0)), int>::value), "");
- static_assert((std::is_same<decltype(std::iscntrl(0)), int>::value), "");
- static_assert((std::is_same<decltype(std::isdigit(0)), int>::value), "");
- static_assert((std::is_same<decltype(std::isgraph(0)), int>::value), "");
- static_assert((std::is_same<decltype(std::islower(0)), int>::value), "");
- static_assert((std::is_same<decltype(std::isprint(0)), int>::value), "");
- static_assert((std::is_same<decltype(std::ispunct(0)), int>::value), "");
- static_assert((std::is_same<decltype(std::isspace(0)), int>::value), "");
- static_assert((std::is_same<decltype(std::isupper(0)), int>::value), "");
- static_assert((std::is_same<decltype(std::isxdigit(0)), int>::value), "");
- static_assert((std::is_same<decltype(std::tolower(0)), int>::value), "");
- static_assert((std::is_same<decltype(std::toupper(0)), int>::value), "");
- assert(std::isalnum('a'));
- assert(std::isalpha('a'));
- assert(std::isblank(' '));
+ ASSERT_SAME_TYPE(int, decltype(std::isalnum(0)));
+ ASSERT_SAME_TYPE(int, decltype(std::isalpha(0)));
+ ASSERT_SAME_TYPE(int, decltype(std::isblank(0)));
+ ASSERT_SAME_TYPE(int, decltype(std::iscntrl(0)));
+ ASSERT_SAME_TYPE(int, decltype(std::isdigit(0)));
+ ASSERT_SAME_TYPE(int, decltype(std::isgraph(0)));
+ ASSERT_SAME_TYPE(int, decltype(std::islower(0)));
+ ASSERT_SAME_TYPE(int, decltype(std::isprint(0)));
+ ASSERT_SAME_TYPE(int, decltype(std::ispunct(0)));
+ ASSERT_SAME_TYPE(int, decltype(std::isspace(0)));
+ ASSERT_SAME_TYPE(int, decltype(std::isupper(0)));
+ ASSERT_SAME_TYPE(int, decltype(std::isxdigit(0)));
+ ASSERT_SAME_TYPE(int, decltype(std::tolower(0)));
+ ASSERT_SAME_TYPE(int, decltype(std::toupper(0)));
+
+ assert( std::isalnum('a'));
+ assert( std::isalpha('a'));
+ assert( std::isblank(' '));
assert(!std::iscntrl(' '));
assert(!std::isdigit('a'));
- assert(std::isgraph('a'));
- assert(std::islower('a'));
- assert(std::isprint('a'));
+ assert( std::isgraph('a'));
+ assert( std::islower('a'));
+ assert( std::isprint('a'));
assert(!std::ispunct('a'));
assert(!std::isspace('a'));
assert(!std::isupper('a'));
- assert(std::isxdigit('a'));
- assert(std::tolower('A') == 'a');
- assert(std::toupper('a') == 'A');
+ assert( std::isxdigit('a'));
+ assert( std::tolower('A') == 'a');
+ assert( std::toupper('a') == 'A');
}
diff --git a/test/std/strings/c.strings/cstring.pass.cpp b/test/std/strings/c.strings/cstring.pass.cpp
index 63f86d350610f..22952e0f2bc1f 100644
--- a/test/std/strings/c.strings/cstring.pass.cpp
+++ b/test/std/strings/c.strings/cstring.pass.cpp
@@ -12,6 +12,8 @@
#include <cstring>
#include <type_traits>
+#include "test_macros.h"
+
#ifndef NULL
#error NULL not defined
#endif
@@ -23,39 +25,40 @@ int main()
const void* vpc = 0;
char* cp = 0;
const char* cpc = 0;
- static_assert((std::is_same<decltype(std::memcpy(vp, vpc, s)), void*>::value), "");
- static_assert((std::is_same<decltype(std::memmove(vp, vpc, s)), void*>::value), "");
- static_assert((std::is_same<decltype(std::strcpy(cp, cpc)), char*>::value), "");
- static_assert((std::is_same<decltype(std::strncpy(cp, cpc, s)), char*>::value), "");
- static_assert((std::is_same<decltype(std::strcat(cp, cpc)), char*>::value), "");
- static_assert((std::is_same<decltype(std::strncat(cp, cpc, s)), char*>::value), "");
- static_assert((std::is_same<decltype(std::memcmp(vpc, vpc, s)), int>::value), "");
- static_assert((std::is_same<decltype(std::strcmp(cpc, cpc)), int>::value), "");
- static_assert((std::is_same<decltype(std::strncmp(cpc, cpc, s)), int>::value), "");
- static_assert((std::is_same<decltype(std::strcoll(cpc, cpc)), int>::value), "");
- static_assert((std::is_same<decltype(std::strxfrm(cp, cpc, s)), std::size_t>::value), "");
- static_assert((std::is_same<decltype(std::memchr(vp, 0, s)), void*>::value), "");
- static_assert((std::is_same<decltype(std::strchr(cp, 0)), char*>::value), "");
- static_assert((std::is_same<decltype(std::strcspn(cpc, cpc)), std::size_t>::value), "");
- static_assert((std::is_same<decltype(std::strpbrk(cp, cpc)), char*>::value), "");
- static_assert((std::is_same<decltype(std::strrchr(cp, 0)), char*>::value), "");
- static_assert((std::is_same<decltype(std::strspn(cpc, cpc)), std::size_t>::value), "");
- static_assert((std::is_same<decltype(std::strstr(cp, cpc)), char*>::value), "");
+
+ ASSERT_SAME_TYPE(void*, decltype(std::memcpy(vp, vpc, s)));
+ ASSERT_SAME_TYPE(void*, decltype(std::memmove(vp, vpc, s)));
+ ASSERT_SAME_TYPE(char*, decltype(std::strcpy(cp, cpc)));
+ ASSERT_SAME_TYPE(char*, decltype(std::strncpy(cp, cpc, s)));
+ ASSERT_SAME_TYPE(char*, decltype(std::strcat(cp, cpc)));
+ ASSERT_SAME_TYPE(char*, decltype(std::strncat(cp, cpc, s)));
+ ASSERT_SAME_TYPE(int, decltype(std::memcmp(vpc, vpc, s)));
+ ASSERT_SAME_TYPE(int, decltype(std::strcmp(cpc, cpc)));
+ ASSERT_SAME_TYPE(int, decltype(std::strncmp(cpc, cpc, s)));
+ ASSERT_SAME_TYPE(int, decltype(std::strcoll(cpc, cpc)));
+ ASSERT_SAME_TYPE(std::size_t, decltype(std::strxfrm(cp, cpc, s)));
+ ASSERT_SAME_TYPE(void*, decltype(std::memchr(vp, 0, s)));
+ ASSERT_SAME_TYPE(char*, decltype(std::strchr(cp, 0)));
+ ASSERT_SAME_TYPE(std::size_t, decltype(std::strcspn(cpc, cpc)));
+ ASSERT_SAME_TYPE(char*, decltype(std::strpbrk(cp, cpc)));
+ ASSERT_SAME_TYPE(char*, decltype(std::strrchr(cp, 0)));
+ ASSERT_SAME_TYPE(std::size_t, decltype(std::strspn(cpc, cpc)));
+ ASSERT_SAME_TYPE(char*, decltype(std::strstr(cp, cpc)));
#ifndef _LIBCPP_HAS_NO_THREAD_UNSAFE_C_FUNCTIONS
- static_assert((std::is_same<decltype(std::strtok(cp, cpc)), char*>::value), "");
+ ASSERT_SAME_TYPE(char*, decltype(std::strtok(cp, cpc)));
#endif
- static_assert((std::is_same<decltype(std::memset(vp, 0, s)), void*>::value), "");
- static_assert((std::is_same<decltype(std::strerror(0)), char*>::value), "");
- static_assert((std::is_same<decltype(std::strlen(cpc)), std::size_t>::value), "");
+ ASSERT_SAME_TYPE(void*, decltype(std::memset(vp, 0, s)));
+ ASSERT_SAME_TYPE(char*, decltype(std::strerror(0)));
+ ASSERT_SAME_TYPE(std::size_t, decltype(std::strlen(cpc)));
// These tests fail on systems whose C library doesn't provide a correct overload
// set for strchr, strpbrk, strrchr, strstr, and memchr, unless the compiler is
// a suitably recent version of Clang.
#if !defined(__APPLE__) || defined(_LIBCPP_PREFERRED_OVERLOAD)
- static_assert((std::is_same<decltype(std::memchr(vpc, 0, s)), const void*>::value), "");
- static_assert((std::is_same<decltype(std::strchr(cpc, 0)), const char*>::value), "");
- static_assert((std::is_same<decltype(std::strpbrk(cpc, cpc)), const char*>::value), "");
- static_assert((std::is_same<decltype(std::strrchr(cpc, 0)), const char*>::value), "");
- static_assert((std::is_same<decltype(std::strstr(cpc, cpc)), const char*>::value), "");
+ ASSERT_SAME_TYPE(const void*, decltype(std::memchr(vpc, 0, s)));
+ ASSERT_SAME_TYPE(const char*, decltype(std::strchr(cpc, 0)));
+ ASSERT_SAME_TYPE(const char*, decltype(std::strpbrk(cpc, cpc)));
+ ASSERT_SAME_TYPE(const char*, decltype(std::strrchr(cpc, 0)));
+ ASSERT_SAME_TYPE(const char*, decltype(std::strstr(cpc, cpc)));
#endif
}
diff --git a/test/std/strings/c.strings/cuchar.pass.cpp b/test/std/strings/c.strings/cuchar.pass.cpp
index 022c656e8a27a..f14eda511809c 100644
--- a/test/std/strings/c.strings/cuchar.pass.cpp
+++ b/test/std/strings/c.strings/cuchar.pass.cpp
@@ -13,6 +13,8 @@
#include <cuchar>
+#include "test_macros.h"
+
int main()
{
}
diff --git a/test/std/strings/c.strings/cwchar.pass.cpp b/test/std/strings/c.strings/cwchar.pass.cpp
index 2b7c3c465f6db..116da936e0f54 100644
--- a/test/std/strings/c.strings/cwchar.pass.cpp
+++ b/test/std/strings/c.strings/cwchar.pass.cpp
@@ -10,9 +10,12 @@
// <cwchar>
#include <cwchar>
+#include <ctime>
#include <cstdarg>
#include <type_traits>
+#include "test_macros.h"
+
#ifndef NULL
#error NULL not defined
#endif
@@ -50,80 +53,80 @@ int main()
((void)ns); // Prevent unused warning
((void)ws); // Prevent unused warning
- static_assert((std::is_same<decltype(std::fwprintf(fp, L"")), int>::value), "");
- static_assert((std::is_same<decltype(std::fwscanf(fp, L"")), int>::value), "");
- static_assert((std::is_same<decltype(std::swprintf(ws, s, L"")), int>::value), "");
- static_assert((std::is_same<decltype(std::swscanf(L"", L"")), int>::value), "");
- static_assert((std::is_same<decltype(std::vfwprintf(fp, L"", va)), int>::value), "");
- static_assert((std::is_same<decltype(std::vfwscanf(fp, L"", va)), int>::value), "");
- static_assert((std::is_same<decltype(std::vswprintf(ws, s, L"", va)), int>::value), "");
- static_assert((std::is_same<decltype(std::vswscanf(L"", L"", va)), int>::value), "");
- static_assert((std::is_same<decltype(std::fgetwc(fp)), std::wint_t>::value), "");
- static_assert((std::is_same<decltype(std::fgetws(ws, 0, fp)), wchar_t*>::value), "");
- static_assert((std::is_same<decltype(std::fputwc(L' ', fp)), std::wint_t>::value), "");
- static_assert((std::is_same<decltype(std::fputws(L"", fp)), int>::value), "");
- static_assert((std::is_same<decltype(std::fwide(fp, 0)), int>::value), "");
- static_assert((std::is_same<decltype(std::getwc(fp)), std::wint_t>::value), "");
- static_assert((std::is_same<decltype(std::putwc(L' ', fp)), std::wint_t>::value), "");
- static_assert((std::is_same<decltype(std::ungetwc(L' ', fp)), std::wint_t>::value), "");
- static_assert((std::is_same<decltype(std::wcstod(L"", (wchar_t**)0)), double>::value), "");
- static_assert((std::is_same<decltype(std::wcstof(L"", (wchar_t**)0)), float>::value), "");
- static_assert((std::is_same<decltype(std::wcstold(L"", (wchar_t**)0)), long double>::value), "");
- static_assert((std::is_same<decltype(std::wcstol(L"", (wchar_t**)0, 0)), long>::value), "");
- static_assert((std::is_same<decltype(std::wcstoll(L"", (wchar_t**)0, 0)), long long>::value), "");
- static_assert((std::is_same<decltype(std::wcstoul(L"", (wchar_t**)0, 0)), unsigned long>::value), "");
- static_assert((std::is_same<decltype(std::wcstoull(L"", (wchar_t**)0, 0)), unsigned long long>::value), "");
- static_assert((std::is_same<decltype(std::wcscpy(ws, L"")), wchar_t*>::value), "");
- static_assert((std::is_same<decltype(std::wcsncpy(ws, L"", s)), wchar_t*>::value), "");
- static_assert((std::is_same<decltype(std::wcscat(ws, L"")), wchar_t*>::value), "");
- static_assert((std::is_same<decltype(std::wcsncat(ws, L"", s)), wchar_t*>::value), "");
- static_assert((std::is_same<decltype(std::wcscmp(L"", L"")), int>::value), "");
- static_assert((std::is_same<decltype(std::wcscoll(L"", L"")), int>::value), "");
- static_assert((std::is_same<decltype(std::wcsncmp(L"", L"", s)), int>::value), "");
- static_assert((std::is_same<decltype(std::wcsxfrm(ws, L"", s)), std::size_t>::value), "");
- static_assert((std::is_same<decltype(std::wcschr((wchar_t*)0, L' ')), wchar_t*>::value), "");
- static_assert((std::is_same<decltype(std::wcscspn(L"", L"")), std::size_t>::value), "");
- static_assert((std::is_same<decltype(std::wcslen(L"")), std::size_t>::value), "");
- static_assert((std::is_same<decltype(std::wcspbrk((wchar_t*)0, L"")), wchar_t*>::value), "");
- static_assert((std::is_same<decltype(std::wcsrchr((wchar_t*)0, L' ')), wchar_t*>::value), "");
- static_assert((std::is_same<decltype(std::wcsspn(L"", L"")), std::size_t>::value), "");
- static_assert((std::is_same<decltype(std::wcsstr((wchar_t*)0, L"")), wchar_t*>::value), "");
- static_assert((std::is_same<decltype(std::wcstok(ws, L"", (wchar_t**)0)), wchar_t*>::value), "");
- static_assert((std::is_same<decltype(std::wmemchr((wchar_t*)0, L' ', s)), wchar_t*>::value), "");
- static_assert((std::is_same<decltype(std::wmemcmp(L"", L"", s)), int>::value), "");
- static_assert((std::is_same<decltype(std::wmemcpy(ws, L"", s)), wchar_t*>::value), "");
- static_assert((std::is_same<decltype(std::wmemmove(ws, L"", s)), wchar_t*>::value), "");
- static_assert((std::is_same<decltype(std::wmemset(ws, L' ', s)), wchar_t*>::value), "");
- static_assert((std::is_same<decltype(std::wcsftime(ws, s, L"", tm)), std::size_t>::value), "");
- static_assert((std::is_same<decltype(std::btowc(0)), wint_t>::value), "");
- static_assert((std::is_same<decltype(std::wctob(w)), int>::value), "");
- static_assert((std::is_same<decltype(std::mbsinit(&mb)), int>::value), "");
- static_assert((std::is_same<decltype(std::mbrlen("", s, &mb)), std::size_t>::value), "");
- static_assert((std::is_same<decltype(std::mbrtowc(ws, "", s, &mb)), std::size_t>::value), "");
- static_assert((std::is_same<decltype(std::wcrtomb(ns, L' ', &mb)), std::size_t>::value), "");
- static_assert((std::is_same<decltype(std::mbsrtowcs(ws, (const char**)0, s, &mb)), std::size_t>::value), "");
- static_assert((std::is_same<decltype(std::wcsrtombs(ns, (const wchar_t**)0, s, &mb)), std::size_t>::value), "");
+ ASSERT_SAME_TYPE(int, decltype(std::fwprintf(fp, L"")));
+ ASSERT_SAME_TYPE(int, decltype(std::fwscanf(fp, L"")));
+ ASSERT_SAME_TYPE(int, decltype(std::swprintf(ws, s, L"")));
+ ASSERT_SAME_TYPE(int, decltype(std::swscanf(L"", L"")));
+ ASSERT_SAME_TYPE(int, decltype(std::vfwprintf(fp, L"", va)));
+ ASSERT_SAME_TYPE(int, decltype(std::vfwscanf(fp, L"", va)));
+ ASSERT_SAME_TYPE(int, decltype(std::vswprintf(ws, s, L"", va)));
+ ASSERT_SAME_TYPE(int, decltype(std::vswscanf(L"", L"", va)));
+ ASSERT_SAME_TYPE(std::wint_t, decltype(std::fgetwc(fp)));
+ ASSERT_SAME_TYPE(wchar_t*, decltype(std::fgetws(ws, 0, fp)));
+ ASSERT_SAME_TYPE(std::wint_t, decltype(std::fputwc(L' ', fp)));
+ ASSERT_SAME_TYPE(int, decltype(std::fputws(L"", fp)));
+ ASSERT_SAME_TYPE(int, decltype(std::fwide(fp, 0)));
+ ASSERT_SAME_TYPE(std::wint_t, decltype(std::getwc(fp)));
+ ASSERT_SAME_TYPE(std::wint_t, decltype(std::putwc(L' ', fp)));
+ ASSERT_SAME_TYPE(std::wint_t, decltype(std::ungetwc(L' ', fp)));
+ ASSERT_SAME_TYPE(double, decltype(std::wcstod(L"", (wchar_t**)0)));
+ ASSERT_SAME_TYPE(float, decltype(std::wcstof(L"", (wchar_t**)0)));
+ ASSERT_SAME_TYPE(long double, decltype(std::wcstold(L"", (wchar_t**)0)));
+ ASSERT_SAME_TYPE(long, decltype(std::wcstol(L"", (wchar_t**)0, 0)));
+ ASSERT_SAME_TYPE(long long, decltype(std::wcstoll(L"", (wchar_t**)0, 0)));
+ ASSERT_SAME_TYPE(unsigned long, decltype(std::wcstoul(L"", (wchar_t**)0, 0)));
+ ASSERT_SAME_TYPE(unsigned long long, decltype(std::wcstoull(L"", (wchar_t**)0, 0)));
+ ASSERT_SAME_TYPE(wchar_t*, decltype(std::wcscpy(ws, L"")));
+ ASSERT_SAME_TYPE(wchar_t*, decltype(std::wcsncpy(ws, L"", s)));
+ ASSERT_SAME_TYPE(wchar_t*, decltype(std::wcscat(ws, L"")));
+ ASSERT_SAME_TYPE(wchar_t*, decltype(std::wcsncat(ws, L"", s)));
+ ASSERT_SAME_TYPE(int, decltype(std::wcscmp(L"", L"")));
+ ASSERT_SAME_TYPE(int, decltype(std::wcscoll(L"", L"")));
+ ASSERT_SAME_TYPE(int, decltype(std::wcsncmp(L"", L"", s)));
+ ASSERT_SAME_TYPE(std::size_t, decltype(std::wcsxfrm(ws, L"", s)));
+ ASSERT_SAME_TYPE(wchar_t*, decltype(std::wcschr((wchar_t*)0, L' ')));
+ ASSERT_SAME_TYPE(std::size_t, decltype(std::wcscspn(L"", L"")));
+ ASSERT_SAME_TYPE(std::size_t, decltype(std::wcslen(L"")));
+ ASSERT_SAME_TYPE(wchar_t*, decltype(std::wcspbrk((wchar_t*)0, L"")));
+ ASSERT_SAME_TYPE(wchar_t*, decltype(std::wcsrchr((wchar_t*)0, L' ')));
+ ASSERT_SAME_TYPE(std::size_t, decltype(std::wcsspn(L"", L"")));
+ ASSERT_SAME_TYPE(wchar_t*, decltype(std::wcsstr((wchar_t*)0, L"")));
+ ASSERT_SAME_TYPE(wchar_t*, decltype(std::wcstok(ws, L"", (wchar_t**)0)));
+ ASSERT_SAME_TYPE(wchar_t*, decltype(std::wmemchr((wchar_t*)0, L' ', s)));
+ ASSERT_SAME_TYPE(int, decltype(std::wmemcmp(L"", L"", s)));
+ ASSERT_SAME_TYPE(wchar_t*, decltype(std::wmemcpy(ws, L"", s)));
+ ASSERT_SAME_TYPE(wchar_t*, decltype(std::wmemmove(ws, L"", s)));
+ ASSERT_SAME_TYPE(wchar_t*, decltype(std::wmemset(ws, L' ', s)));
+ ASSERT_SAME_TYPE(std::size_t, decltype(std::wcsftime(ws, s, L"", tm)));
+ ASSERT_SAME_TYPE(wint_t, decltype(std::btowc(0)));
+ ASSERT_SAME_TYPE(int, decltype(std::wctob(w)));
+ ASSERT_SAME_TYPE(int, decltype(std::mbsinit(&mb)));
+ ASSERT_SAME_TYPE(std::size_t, decltype(std::mbrlen("", s, &mb)));
+ ASSERT_SAME_TYPE(std::size_t, decltype(std::mbrtowc(ws, "", s, &mb)));
+ ASSERT_SAME_TYPE(std::size_t, decltype(std::wcrtomb(ns, L' ', &mb)));
+ ASSERT_SAME_TYPE(std::size_t, decltype(std::mbsrtowcs(ws, (const char**)0, s, &mb)));
+ ASSERT_SAME_TYPE(std::size_t, decltype(std::wcsrtombs(ns, (const wchar_t**)0, s, &mb)));
// These tests fail on systems whose C library doesn't provide a correct overload
// set for wcschr, wcspbrk, wcsrchr, wcsstr, and wmemchr, unless the compiler is
// a suitably recent version of Clang.
#if !defined(__APPLE__) || defined(_LIBCPP_PREFERRED_OVERLOAD)
- static_assert((std::is_same<decltype(std::wcschr((const wchar_t*)0, L' ')), const wchar_t*>::value), "");
- static_assert((std::is_same<decltype(std::wcspbrk((const wchar_t*)0, L"")), const wchar_t*>::value), "");
- static_assert((std::is_same<decltype(std::wcsrchr((const wchar_t*)0, L' ')), const wchar_t*>::value), "");
- static_assert((std::is_same<decltype(std::wcsstr((const wchar_t*)0, L"")), const wchar_t*>::value), "");
- static_assert((std::is_same<decltype(std::wmemchr((const wchar_t*)0, L' ', s)), const wchar_t*>::value), "");
+ ASSERT_SAME_TYPE(const wchar_t*, decltype(std::wcschr((const wchar_t*)0, L' ')));
+ ASSERT_SAME_TYPE(const wchar_t*, decltype(std::wcspbrk((const wchar_t*)0, L"")));
+ ASSERT_SAME_TYPE(const wchar_t*, decltype(std::wcsrchr((const wchar_t*)0, L' ')));
+ ASSERT_SAME_TYPE(const wchar_t*, decltype(std::wcsstr((const wchar_t*)0, L"")));
+ ASSERT_SAME_TYPE(const wchar_t*, decltype(std::wmemchr((const wchar_t*)0, L' ', s)));
#endif
#ifndef _LIBCPP_HAS_NO_STDIN
- static_assert((std::is_same<decltype(std::getwchar()), std::wint_t>::value), "");
- static_assert((std::is_same<decltype(std::vwscanf(L"", va)), int>::value), "");
- static_assert((std::is_same<decltype(std::wscanf(L"")), int>::value), "");
+ ASSERT_SAME_TYPE(std::wint_t, decltype(std::getwchar()));
+ ASSERT_SAME_TYPE(int, decltype(std::vwscanf(L"", va)));
+ ASSERT_SAME_TYPE(int, decltype(std::wscanf(L"")));
#endif
#ifndef _LIBCPP_HAS_NO_STDOUT
- static_assert((std::is_same<decltype(std::putwchar(L' ')), std::wint_t>::value), "");
- static_assert((std::is_same<decltype(std::vwprintf(L"", va)), int>::value), "");
- static_assert((std::is_same<decltype(std::wprintf(L"")), int>::value), "");
+ ASSERT_SAME_TYPE(std::wint_t, decltype(std::putwchar(L' ')));
+ ASSERT_SAME_TYPE(int, decltype(std::vwprintf(L"", va)));
+ ASSERT_SAME_TYPE(int, decltype(std::wprintf(L"")));
#endif
}
diff --git a/test/std/strings/c.strings/cwctype.pass.cpp b/test/std/strings/c.strings/cwctype.pass.cpp
index 6d66415abdc15..14f730b15b751 100644
--- a/test/std/strings/c.strings/cwctype.pass.cpp
+++ b/test/std/strings/c.strings/cwctype.pass.cpp
@@ -12,6 +12,9 @@
#include <cwctype>
#include <type_traits>
+#include "test_macros.h"
+
+
#ifndef WEOF
#error WEOF not defined
#endif
@@ -91,24 +94,24 @@
int main()
{
std::wint_t w = 0;
- std::wctrans_t wctr = 0;
- std::wctype_t wct = 0;
- static_assert((std::is_same<decltype(std::iswalnum(w)), int>::value), "");
- static_assert((std::is_same<decltype(std::iswalpha(w)), int>::value), "");
- static_assert((std::is_same<decltype(std::iswblank(w)), int>::value), "");
- static_assert((std::is_same<decltype(std::iswcntrl(w)), int>::value), "");
- static_assert((std::is_same<decltype(std::iswdigit(w)), int>::value), "");
- static_assert((std::is_same<decltype(std::iswgraph(w)), int>::value), "");
- static_assert((std::is_same<decltype(std::iswlower(w)), int>::value), "");
- static_assert((std::is_same<decltype(std::iswprint(w)), int>::value), "");
- static_assert((std::is_same<decltype(std::iswpunct(w)), int>::value), "");
- static_assert((std::is_same<decltype(std::iswspace(w)), int>::value), "");
- static_assert((std::is_same<decltype(std::iswupper(w)), int>::value), "");
- static_assert((std::is_same<decltype(std::iswxdigit(w)), int>::value), "");
- static_assert((std::is_same<decltype(std::iswctype(w, wct)), int>::value), "");
- static_assert((std::is_same<decltype(std::wctype("")), std::wctype_t>::value), "");
- static_assert((std::is_same<decltype(std::towlower(w)), std::wint_t>::value), "");
- static_assert((std::is_same<decltype(std::towupper(w)), std::wint_t>::value), "");
- static_assert((std::is_same<decltype(std::towctrans(w, wctr)), std::wint_t>::value), "");
- static_assert((std::is_same<decltype(std::wctrans("")), std::wctrans_t>::value), "");
+ ASSERT_SAME_TYPE(int, decltype(std::iswalnum(w)));
+ ASSERT_SAME_TYPE(int, decltype(std::iswalpha(w)));
+ ASSERT_SAME_TYPE(int, decltype(std::iswblank(w)));
+ ASSERT_SAME_TYPE(int, decltype(std::iswcntrl(w)));
+ ASSERT_SAME_TYPE(int, decltype(std::iswdigit(w)));
+ ASSERT_SAME_TYPE(int, decltype(std::iswgraph(w)));
+ ASSERT_SAME_TYPE(int, decltype(std::iswlower(w)));
+ ASSERT_SAME_TYPE(int, decltype(std::iswprint(w)));
+ ASSERT_SAME_TYPE(int, decltype(std::iswpunct(w)));
+ ASSERT_SAME_TYPE(int, decltype(std::iswspace(w)));
+ ASSERT_SAME_TYPE(int, decltype(std::iswupper(w)));
+ ASSERT_SAME_TYPE(int, decltype(std::iswxdigit(w)));
+
+ ASSERT_SAME_TYPE(int, decltype(std::iswctype(w, std::wctype_t())));
+
+ ASSERT_SAME_TYPE(std::wctype_t, decltype(std::wctype("")));
+ ASSERT_SAME_TYPE(std::wint_t, decltype(std::towlower(w)));
+ ASSERT_SAME_TYPE(std::wint_t, decltype(std::towupper(w)));
+ ASSERT_SAME_TYPE(std::wint_t, decltype(std::towctrans(w, std::wctrans_t())));
+ ASSERT_SAME_TYPE(std::wctrans_t, decltype(std::wctrans("")));
}
diff --git a/test/std/strings/char.traits/char.traits.specializations/char.traits.specializations.char8_t/assign2.pass.cpp b/test/std/strings/char.traits/char.traits.specializations/char.traits.specializations.char8_t/assign2.pass.cpp
new file mode 100644
index 0000000000000..e293115faec63
--- /dev/null
+++ b/test/std/strings/char.traits/char.traits.specializations/char.traits.specializations.char8_t/assign2.pass.cpp
@@ -0,0 +1,39 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
+// <string>
+
+// template<> struct char_traits<char8_t>
+
+// static constexpr void assign(char_type& c1, const char_type& c2);
+
+#include <string>
+#include <cassert>
+
+#include "test_macros.h"
+
+#if defined(__cpp_lib_char8_t) && __cpp_lib_char8_t >= 201811L
+constexpr bool test_constexpr()
+{
+ char8_t c = u'1';
+ std::char_traits<char8_t>::assign(c, u'a');
+ return c == u'a';
+}
+
+int main()
+{
+ char8_t c = u8'\0';
+ std::char_traits<char8_t>::assign(c, u8'a');
+ assert(c == u8'a');
+
+ static_assert(test_constexpr(), "");
+}
+#else
+int main () {}
+#endif
diff --git a/test/std/strings/char.traits/char.traits.specializations/char.traits.specializations.char8_t/assign3.pass.cpp b/test/std/strings/char.traits/char.traits.specializations/char.traits.specializations.char8_t/assign3.pass.cpp
new file mode 100644
index 0000000000000..d1fab485c38bb
--- /dev/null
+++ b/test/std/strings/char.traits/char.traits.specializations/char.traits.specializations.char8_t/assign3.pass.cpp
@@ -0,0 +1,30 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
+
+// <string>
+
+// template<> struct char_traits<char8_t>
+
+// static char_type* assign(char_type* s, size_t n, char_type a);
+
+#include <string>
+#include <cassert>
+
+int main()
+{
+#if defined(__cpp_lib_char8_t) && __cpp_lib_char8_t >= 201811L
+ char8_t s2[3] = {0};
+ assert(std::char_traits<char8_t>::assign(s2, 3, char8_t(5)) == s2);
+ assert(s2[0] == char8_t(5));
+ assert(s2[1] == char8_t(5));
+ assert(s2[2] == char8_t(5));
+ assert(std::char_traits<char8_t>::assign(NULL, 0, char8_t(5)) == NULL);
+#endif
+}
diff --git a/test/std/strings/char.traits/char.traits.specializations/char.traits.specializations.char8_t/compare.pass.cpp b/test/std/strings/char.traits/char.traits.specializations/char.traits.specializations.char8_t/compare.pass.cpp
new file mode 100644
index 0000000000000..5ab1c9f0be083
--- /dev/null
+++ b/test/std/strings/char.traits/char.traits.specializations/char.traits.specializations.char8_t/compare.pass.cpp
@@ -0,0 +1,58 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
+
+// <string>
+
+// template<> struct char_traits<char8_t>
+
+// static constexpr int compare(const char_type* s1, const char_type* s2, size_t n);
+
+#include <string>
+#include <cassert>
+
+#include "test_macros.h"
+
+#if defined(__cpp_lib_char8_t) && __cpp_lib_char8_t >= 201811L
+constexpr bool test_constexpr()
+{
+ return std::char_traits<char8_t>::compare(u8"123", u8"223", 3) < 0
+ && std::char_traits<char8_t>::compare(u8"223", u8"123", 3) > 0
+ && std::char_traits<char8_t>::compare(u8"123", u8"123", 3) == 0;
+}
+
+
+int main()
+{
+ assert(std::char_traits<char8_t>::compare(u8"", u8"", 0) == 0);
+ assert(std::char_traits<char8_t>::compare(NULL, NULL, 0) == 0);
+
+ assert(std::char_traits<char8_t>::compare(u8"1", u8"1", 1) == 0);
+ assert(std::char_traits<char8_t>::compare(u8"1", u8"2", 1) < 0);
+ assert(std::char_traits<char8_t>::compare(u8"2", u8"1", 1) > 0);
+
+ assert(std::char_traits<char8_t>::compare(u8"12", u8"12", 2) == 0);
+ assert(std::char_traits<char8_t>::compare(u8"12", u8"13", 2) < 0);
+ assert(std::char_traits<char8_t>::compare(u8"12", u8"22", 2) < 0);
+ assert(std::char_traits<char8_t>::compare(u8"13", u8"12", 2) > 0);
+ assert(std::char_traits<char8_t>::compare(u8"22", u8"12", 2) > 0);
+
+ assert(std::char_traits<char8_t>::compare(u8"123", u8"123", 3) == 0);
+ assert(std::char_traits<char8_t>::compare(u8"123", u8"223", 3) < 0);
+ assert(std::char_traits<char8_t>::compare(u8"123", u8"133", 3) < 0);
+ assert(std::char_traits<char8_t>::compare(u8"123", u8"124", 3) < 0);
+ assert(std::char_traits<char8_t>::compare(u8"223", u8"123", 3) > 0);
+ assert(std::char_traits<char8_t>::compare(u8"133", u8"123", 3) > 0);
+ assert(std::char_traits<char8_t>::compare(u8"124", u8"123", 3) > 0);
+
+ static_assert(test_constexpr(), "" );
+}
+#else
+int main () {}
+#endif
diff --git a/test/std/strings/char.traits/char.traits.specializations/char.traits.specializations.char8_t/copy.pass.cpp b/test/std/strings/char.traits/char.traits.specializations/char.traits.specializations.char8_t/copy.pass.cpp
new file mode 100644
index 0000000000000..74d51667d5682
--- /dev/null
+++ b/test/std/strings/char.traits/char.traits.specializations/char.traits.specializations.char8_t/copy.pass.cpp
@@ -0,0 +1,32 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
+
+// <string>
+
+// template<> struct char_traits<char8_t>
+
+// static char_type* copy(char_type* s1, const char_type* s2, size_t n);
+
+#include <string>
+#include <cassert>
+
+int main()
+{
+#if defined(__cpp_lib_char8_t) && __cpp_lib_char8_t >= 201811L
+ char8_t s1[] = {1, 2, 3};
+ char8_t s2[3] = {0};
+ assert(std::char_traits<char8_t>::copy(s2, s1, 3) == s2);
+ assert(s2[0] == char8_t(1));
+ assert(s2[1] == char8_t(2));
+ assert(s2[2] == char8_t(3));
+ assert(std::char_traits<char8_t>::copy(NULL, s1, 0) == NULL);
+ assert(std::char_traits<char8_t>::copy(s1, NULL, 0) == s1);
+#endif
+}
diff --git a/test/std/strings/char.traits/char.traits.specializations/char.traits.specializations.char8_t/eof.pass.cpp b/test/std/strings/char.traits/char.traits.specializations/char.traits.specializations.char8_t/eof.pass.cpp
new file mode 100644
index 0000000000000..c48e3aedda390
--- /dev/null
+++ b/test/std/strings/char.traits/char.traits.specializations/char.traits.specializations.char8_t/eof.pass.cpp
@@ -0,0 +1,26 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
+
+// <string>
+
+// template<> struct char_traits<char8_t>
+
+// static constexpr int_type eof();
+
+#include <string>
+#include <cassert>
+
+int main()
+{
+#if defined(__cpp_lib_char8_t) && __cpp_lib_char8_t >= 201811L
+ std::char_traits<char8_t>::int_type i = std::char_traits<char8_t>::eof();
+ ((void)i); // Prevent unused warning
+#endif
+}
diff --git a/test/std/strings/char.traits/char.traits.specializations/char.traits.specializations.char8_t/eq.pass.cpp b/test/std/strings/char.traits/char.traits.specializations/char.traits.specializations.char8_t/eq.pass.cpp
new file mode 100644
index 0000000000000..2b7d793c7455a
--- /dev/null
+++ b/test/std/strings/char.traits/char.traits.specializations/char.traits.specializations.char8_t/eq.pass.cpp
@@ -0,0 +1,28 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
+
+// <string>
+
+// template<> struct char_traits<char8_t>
+
+// static constexpr bool eq(char_type c1, char_type c2);
+
+#include <string>
+#include <cassert>
+
+#include "test_macros.h"
+
+int main()
+{
+#if defined(__cpp_lib_char8_t) && __cpp_lib_char8_t >= 201811L
+ assert( std::char_traits<char8_t>::eq(u8'a', u8'a'));
+ assert(!std::char_traits<char8_t>::eq(u8'a', u8'A'));
+#endif
+}
diff --git a/test/std/strings/char.traits/char.traits.specializations/char.traits.specializations.char8_t/eq_int_type.pass.cpp b/test/std/strings/char.traits/char.traits.specializations/char.traits.specializations.char8_t/eq_int_type.pass.cpp
new file mode 100644
index 0000000000000..15e645e3a5da8
--- /dev/null
+++ b/test/std/strings/char.traits/char.traits.specializations/char.traits.specializations.char8_t/eq_int_type.pass.cpp
@@ -0,0 +1,31 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
+
+// <string>
+
+// template<> struct char_traits<char8_t>
+
+// static constexpr bool eq_int_type(int_type c1, int_type c2);
+
+#include <string>
+#include <cassert>
+
+#include "test_macros.h"
+
+int main()
+{
+#if defined(__cpp_lib_char8_t) && __cpp_lib_char8_t >= 201811L
+ assert( std::char_traits<char8_t>::eq_int_type(u8'a', u8'a'));
+ assert(!std::char_traits<char8_t>::eq_int_type(u8'a', u8'A'));
+ assert(!std::char_traits<char8_t>::eq_int_type(std::char_traits<char8_t>::eof(), u8'A'));
+ assert( std::char_traits<char8_t>::eq_int_type(std::char_traits<char8_t>::eof(),
+ std::char_traits<char8_t>::eof()));
+#endif
+}
diff --git a/test/std/strings/char.traits/char.traits.specializations/char.traits.specializations.char8_t/find.pass.cpp b/test/std/strings/char.traits/char.traits.specializations/char.traits.specializations.char8_t/find.pass.cpp
new file mode 100644
index 0000000000000..f35816659d037
--- /dev/null
+++ b/test/std/strings/char.traits/char.traits.specializations/char.traits.specializations.char8_t/find.pass.cpp
@@ -0,0 +1,46 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
+
+// <string>
+
+// template<> struct char_traits<char8_t>
+
+// static constexpr const char_type* find(const char_type* s, size_t n, const char_type& a);
+
+#include <string>
+#include <cassert>
+
+#include "test_macros.h"
+
+#if defined(__cpp_lib_char8_t) && __cpp_lib_char8_t >= 201811L
+constexpr bool test_constexpr()
+{
+ constexpr const char8_t *p = u8"123";
+ return std::char_traits<char8_t>::find(p, 3, u8'1') == p
+ && std::char_traits<char8_t>::find(p, 3, u8'2') == p + 1
+ && std::char_traits<char8_t>::find(p, 3, u8'3') == p + 2
+ && std::char_traits<char8_t>::find(p, 3, u8'4') == nullptr;
+}
+
+int main()
+{
+ char8_t s1[] = {1, 2, 3};
+ assert(std::char_traits<char8_t>::find(s1, 3, char8_t(1)) == s1);
+ assert(std::char_traits<char8_t>::find(s1, 3, char8_t(2)) == s1+1);
+ assert(std::char_traits<char8_t>::find(s1, 3, char8_t(3)) == s1+2);
+ assert(std::char_traits<char8_t>::find(s1, 3, char8_t(4)) == 0);
+ assert(std::char_traits<char8_t>::find(s1, 3, char8_t(0)) == 0);
+ assert(std::char_traits<char8_t>::find(NULL, 0, char8_t(0)) == 0);
+
+ static_assert(test_constexpr(), "" );
+}
+#else
+int main () {}
+#endif
diff --git a/test/std/strings/char.traits/char.traits.specializations/char.traits.specializations.char8_t/length.pass.cpp b/test/std/strings/char.traits/char.traits.specializations/char.traits.specializations.char8_t/length.pass.cpp
new file mode 100644
index 0000000000000..f200c2332788f
--- /dev/null
+++ b/test/std/strings/char.traits/char.traits.specializations/char.traits.specializations.char8_t/length.pass.cpp
@@ -0,0 +1,41 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
+
+// <string>
+
+// template<> struct char_traits<char8_t>
+
+// static constexpr size_t length(const char_type* s);
+
+#include <string>
+#include <cassert>
+
+#include "test_macros.h"
+
+#if defined(__cpp_lib_char8_t) && __cpp_lib_char8_t >= 201811L
+constexpr bool test_constexpr()
+{
+ return std::char_traits<char8_t>::length(u8"") == 0
+ && std::char_traits<char8_t>::length(u8"abcd") == 4;
+}
+
+int main()
+{
+ assert(std::char_traits<char8_t>::length(u8"") == 0);
+ assert(std::char_traits<char8_t>::length(u8"a") == 1);
+ assert(std::char_traits<char8_t>::length(u8"aa") == 2);
+ assert(std::char_traits<char8_t>::length(u8"aaa") == 3);
+ assert(std::char_traits<char8_t>::length(u8"aaaa") == 4);
+
+ static_assert(test_constexpr(), "");
+}
+#else
+int main() { }
+#endif
diff --git a/test/std/strings/char.traits/char.traits.specializations/char.traits.specializations.char8_t/lt.pass.cpp b/test/std/strings/char.traits/char.traits.specializations/char.traits.specializations.char8_t/lt.pass.cpp
new file mode 100644
index 0000000000000..73c703f7734f9
--- /dev/null
+++ b/test/std/strings/char.traits/char.traits.specializations/char.traits.specializations.char8_t/lt.pass.cpp
@@ -0,0 +1,28 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
+
+// <string>
+
+// template<> struct char_traits<char8_t>
+
+// static constexpr bool lt(char_type c1, char_type c2);
+
+#include <string>
+#include <cassert>
+
+#include "test_macros.h"
+
+int main()
+{
+#if defined(__cpp_lib_char8_t) && __cpp_lib_char8_t >= 201811L
+ assert(!std::char_traits<char8_t>::lt(u8'a', u8'a'));
+ assert( std::char_traits<char8_t>::lt(u8'A', u8'a'));
+#endif
+}
diff --git a/test/std/strings/char.traits/char.traits.specializations/char.traits.specializations.char8_t/move.pass.cpp b/test/std/strings/char.traits/char.traits.specializations/char.traits.specializations.char8_t/move.pass.cpp
new file mode 100644
index 0000000000000..688e559321b71
--- /dev/null
+++ b/test/std/strings/char.traits/char.traits.specializations/char.traits.specializations.char8_t/move.pass.cpp
@@ -0,0 +1,36 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
+
+// <string>
+
+// template<> struct char_traits<char8_t>
+
+// static char_type* move(char_type* s1, const char_type* s2, size_t n);
+
+#include <string>
+#include <cassert>
+
+int main()
+{
+#if defined(__cpp_lib_char8_t) && __cpp_lib_char8_t >= 201811L
+ char8_t s1[] = {1, 2, 3};
+ assert(std::char_traits<char8_t>::move(s1, s1+1, 2) == s1);
+ assert(s1[0] == char8_t(2));
+ assert(s1[1] == char8_t(3));
+ assert(s1[2] == char8_t(3));
+ s1[2] = char8_t(0);
+ assert(std::char_traits<char8_t>::move(s1+1, s1, 2) == s1+1);
+ assert(s1[0] == char8_t(2));
+ assert(s1[1] == char8_t(2));
+ assert(s1[2] == char8_t(3));
+ assert(std::char_traits<char8_t>::move(NULL, s1, 0) == NULL);
+ assert(std::char_traits<char8_t>::move(s1, NULL, 0) == s1);
+#endif
+}
diff --git a/test/std/strings/char.traits/char.traits.specializations/char.traits.specializations.char8_t/not_eof.pass.cpp b/test/std/strings/char.traits/char.traits.specializations/char.traits.specializations.char8_t/not_eof.pass.cpp
new file mode 100644
index 0000000000000..274d93f133de1
--- /dev/null
+++ b/test/std/strings/char.traits/char.traits.specializations/char.traits.specializations.char8_t/not_eof.pass.cpp
@@ -0,0 +1,31 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
+
+// <string>
+
+// template<> struct char_traits<char8_t>
+
+// static constexpr int_type not_eof(int_type c);
+
+#include <string>
+#include <cassert>
+
+#include "test_macros.h"
+
+int main()
+{
+#if defined(__cpp_lib_char8_t) && __cpp_lib_char8_t >= 201811L
+ assert(std::char_traits<char8_t>::not_eof(u8'a') == u8'a');
+ assert(std::char_traits<char8_t>::not_eof(u8'A') == u8'A');
+ assert(std::char_traits<char8_t>::not_eof(0) == 0);
+ assert(std::char_traits<char8_t>::not_eof(std::char_traits<char8_t>::eof()) !=
+ std::char_traits<char8_t>::eof());
+#endif
+}
diff --git a/test/std/strings/char.traits/char.traits.specializations/char.traits.specializations.char8_t/to_char_type.pass.cpp b/test/std/strings/char.traits/char.traits.specializations/char.traits.specializations.char8_t/to_char_type.pass.cpp
new file mode 100644
index 0000000000000..96159209feead
--- /dev/null
+++ b/test/std/strings/char.traits/char.traits.specializations/char.traits.specializations.char8_t/to_char_type.pass.cpp
@@ -0,0 +1,29 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
+
+// <string>
+
+// template<> struct char_traits<char8_t>
+
+// static constexpr char_type to_char_type(int_type c);
+
+#include <string>
+#include <cassert>
+
+#include "test_macros.h"
+
+int main()
+{
+#if defined(__cpp_lib_char8_t) && __cpp_lib_char8_t >= 201811L
+ assert(std::char_traits<char8_t>::to_char_type(u8'a') == u8'a');
+ assert(std::char_traits<char8_t>::to_char_type(u8'A') == u8'A');
+ assert(std::char_traits<char8_t>::to_char_type(0) == 0);
+#endif
+}
diff --git a/test/std/strings/char.traits/char.traits.specializations/char.traits.specializations.char8_t/to_int_type.pass.cpp b/test/std/strings/char.traits/char.traits.specializations/char.traits.specializations.char8_t/to_int_type.pass.cpp
new file mode 100644
index 0000000000000..659be36adbf42
--- /dev/null
+++ b/test/std/strings/char.traits/char.traits.specializations/char.traits.specializations.char8_t/to_int_type.pass.cpp
@@ -0,0 +1,29 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
+
+// <string>
+
+// template<> struct char_traits<char8_t>
+
+// static constexpr int_type to_int_type(char_type c);
+
+#include <string>
+#include <cassert>
+
+#include "test_macros.h"
+
+int main()
+{
+#if defined(__cpp_lib_char8_t) && __cpp_lib_char8_t >= 201811L
+ assert(std::char_traits<char8_t>::to_int_type(u8'a') == u8'a');
+ assert(std::char_traits<char8_t>::to_int_type(u8'A') == u8'A');
+ assert(std::char_traits<char8_t>::to_int_type(0) == 0);
+#endif
+}
diff --git a/test/std/strings/char.traits/char.traits.specializations/char.traits.specializations.char8_t/types.pass.cpp b/test/std/strings/char.traits/char.traits.specializations/char.traits.specializations.char8_t/types.pass.cpp
new file mode 100644
index 0000000000000..64c27ffd740e4
--- /dev/null
+++ b/test/std/strings/char.traits/char.traits.specializations/char.traits.specializations.char8_t/types.pass.cpp
@@ -0,0 +1,34 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
+
+// <string>
+
+// template<> struct char_traits<char8_t>
+
+// typedef char8_t char_type;
+// typedef unsigned int int_type;
+// typedef streamoff off_type;
+// typedef u16streampos pos_type;
+// typedef mbstate_t state_type;
+
+#include <string>
+#include <type_traits>
+#include <cstdint>
+
+int main()
+{
+#if defined(__cpp_lib_char8_t) && __cpp_lib_char8_t >= 201811L
+ static_assert((std::is_same<std::char_traits<char8_t>::char_type, char8_t>::value), "");
+ static_assert((std::is_same<std::char_traits<char8_t>::int_type, unsigned int>::value), "");
+ static_assert((std::is_same<std::char_traits<char8_t>::off_type, std::streamoff>::value), "");
+ static_assert((std::is_same<std::char_traits<char8_t>::pos_type, std::u16streampos>::value), "");
+ static_assert((std::is_same<std::char_traits<char8_t>::state_type, std::mbstate_t>::value), "");
+#endif
+}
diff --git a/test/std/strings/string.classes/typedefs.pass.cpp b/test/std/strings/string.classes/typedefs.pass.cpp
index 3aba1c3f15dd7..15d97123519de 100644
--- a/test/std/strings/string.classes/typedefs.pass.cpp
+++ b/test/std/strings/string.classes/typedefs.pass.cpp
@@ -12,18 +12,24 @@
// Test for the existence of:
// basic_string typedef names
-// typedef basic_string<char> string;
+// typedef basic_string<char> string;
// typedef basic_string<char16_t> u16string;
+// typedef basic_string<char8_t> u8string; // C++20
// typedef basic_string<char32_t> u32string;
-// typedef basic_string<wchar_t> wstring;
+// typedef basic_string<wchar_t> wstring;
#include <string>
#include <type_traits>
+#include "test_macros.h"
+
int main()
{
static_assert((std::is_same<std::string, std::basic_string<char> >::value), "");
static_assert((std::is_same<std::wstring, std::basic_string<wchar_t> >::value), "");
+#if defined(__cpp_lib_char8_t) && __cpp_lib_char8_t >= 201811L
+ static_assert((std::is_same<std::u8string, std::basic_string<char8_t> >::value), "");
+#endif
#ifndef _LIBCPP_HAS_NO_UNICODE_CHARS
static_assert((std::is_same<std::u16string, std::basic_string<char16_t> >::value), "");
static_assert((std::is_same<std::u32string, std::basic_string<char32_t> >::value), "");
diff --git a/test/std/strings/string.conversions/stod.pass.cpp b/test/std/strings/string.conversions/stod.pass.cpp
index 3d5db63e09833..8773a61840ede 100644
--- a/test/std/strings/string.conversions/stod.pass.cpp
+++ b/test/std/strings/string.conversions/stod.pass.cpp
@@ -15,6 +15,7 @@
#include <string>
#include <cmath>
#include <cassert>
+#include <stdexcept>
#include "test_macros.h"
diff --git a/test/std/strings/string.conversions/stof.pass.cpp b/test/std/strings/string.conversions/stof.pass.cpp
index a5e587236e275..7c193648799d6 100644
--- a/test/std/strings/string.conversions/stof.pass.cpp
+++ b/test/std/strings/string.conversions/stof.pass.cpp
@@ -19,6 +19,7 @@
#include <string>
#include <cmath>
#include <cassert>
+#include <stdexcept>
#include "test_macros.h"
diff --git a/test/std/strings/string.conversions/stoi.pass.cpp b/test/std/strings/string.conversions/stoi.pass.cpp
index 8852d47f00112..efc43b3aa610b 100644
--- a/test/std/strings/string.conversions/stoi.pass.cpp
+++ b/test/std/strings/string.conversions/stoi.pass.cpp
@@ -14,6 +14,7 @@
#include <string>
#include <cassert>
+#include <stdexcept>
#include "test_macros.h"
diff --git a/test/std/strings/string.conversions/stol.pass.cpp b/test/std/strings/string.conversions/stol.pass.cpp
index 5e16735dcc8f4..4815436222a7f 100644
--- a/test/std/strings/string.conversions/stol.pass.cpp
+++ b/test/std/strings/string.conversions/stol.pass.cpp
@@ -18,6 +18,7 @@
#include <string>
#include <cassert>
+#include <stdexcept>
#include "test_macros.h"
diff --git a/test/std/strings/string.conversions/stoll.pass.cpp b/test/std/strings/string.conversions/stoll.pass.cpp
index c33f9ee5e86fc..fe4c40b78132a 100644
--- a/test/std/strings/string.conversions/stoll.pass.cpp
+++ b/test/std/strings/string.conversions/stoll.pass.cpp
@@ -18,6 +18,7 @@
#include <string>
#include <cassert>
+#include <stdexcept>
#include "test_macros.h"
diff --git a/test/std/strings/string.conversions/stoul.pass.cpp b/test/std/strings/string.conversions/stoul.pass.cpp
index 523c49a29de4c..c79c949413db7 100644
--- a/test/std/strings/string.conversions/stoul.pass.cpp
+++ b/test/std/strings/string.conversions/stoul.pass.cpp
@@ -18,6 +18,7 @@
#include <string>
#include <cassert>
+#include <stdexcept>
#include "test_macros.h"
diff --git a/test/std/strings/string.conversions/stoull.pass.cpp b/test/std/strings/string.conversions/stoull.pass.cpp
index 549c8da9a358f..2ac883ec09364 100644
--- a/test/std/strings/string.conversions/stoull.pass.cpp
+++ b/test/std/strings/string.conversions/stoull.pass.cpp
@@ -18,6 +18,7 @@
#include <string>
#include <cassert>
+#include <stdexcept>
#include "test_macros.h"
diff --git a/test/std/strings/string.conversions/to_string.pass.cpp b/test/std/strings/string.conversions/to_string.pass.cpp
index 05e5e4b922a53..fdc682ce10312 100644
--- a/test/std/strings/string.conversions/to_string.pass.cpp
+++ b/test/std/strings/string.conversions/to_string.pass.cpp
@@ -19,6 +19,7 @@
// string to_string(double val);
// string to_string(long double val);
+#include <limits>
#include <string>
#include <cassert>
#include <sstream>
diff --git a/test/std/strings/string.conversions/to_wstring.pass.cpp b/test/std/strings/string.conversions/to_wstring.pass.cpp
index 281aa1a5e79bb..2208ec5a31240 100644
--- a/test/std/strings/string.conversions/to_wstring.pass.cpp
+++ b/test/std/strings/string.conversions/to_wstring.pass.cpp
@@ -19,6 +19,7 @@
// wstring to_wstring(double val);
// wstring to_wstring(long double val);
+#include <limits>
#include <string>
#include <cassert>
#include <sstream>
diff --git a/test/std/strings/string.view/string.view.capacity/capacity.pass.cpp b/test/std/strings/string.view/string.view.capacity/capacity.pass.cpp
index b21ba0422fdb4..fda67c3bfa776 100644
--- a/test/std/strings/string.view/string.view.capacity/capacity.pass.cpp
+++ b/test/std/strings/string.view/string.view.capacity/capacity.pass.cpp
@@ -64,15 +64,13 @@ void test2 ( const CharT *s, size_t len ) {
}
int main () {
- typedef std::string_view string_view;
- typedef std::u16string_view u16string_view;
- typedef std::u32string_view u32string_view;
- typedef std::wstring_view wstring_view;
-
- test1<string_view> ();
- test1<u16string_view> ();
- test1<u32string_view> ();
- test1<wstring_view> ();
+ test1<std::string_view> ();
+#if defined(__cpp_lib_char8_t) && __cpp_lib_char8_t >= 201811L
+ test1<std::u8string_view> ();
+#endif
+ test1<std::u16string_view> ();
+ test1<std::u32string_view> ();
+ test1<std::wstring_view> ();
test2 ( "ABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDE", 105 );
test2 ( "ABCDE", 5 );
@@ -84,6 +82,13 @@ int main () {
test2 ( L"a", 1 );
test2 ( L"", 0 );
+#if defined(__cpp_lib_char8_t) && __cpp_lib_char8_t >= 201811L
+ test2 ( u8"ABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDE", 105 );
+ test2 ( u8"ABCDE", 5 );
+ test2 ( u8"a", 1 );
+ test2 ( u8"", 0 );
+#endif
+
#if TEST_STD_VER >= 11
test2 ( u"ABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDE", 105 );
test2 ( u"ABCDE", 5 );
diff --git a/test/std/strings/string.view/string.view.cons/assign.pass.cpp b/test/std/strings/string.view/string.view.cons/assign.pass.cpp
index 3307aa61d99f3..bab788921b468 100644
--- a/test/std/strings/string.view/string.view.cons/assign.pass.cpp
+++ b/test/std/strings/string.view/string.view.cons/assign.pass.cpp
@@ -32,21 +32,27 @@ bool test (T sv0)
int main () {
- assert( test<std::string_view> ( "1234"));
+ assert( test<std::string_view> ( "1234"));
+#if defined(__cpp_lib_char8_t) && __cpp_lib_char8_t >= 201811L
+ assert( test<std::u8string_view> (u8"1234"));
+#endif
#if TEST_STD_VER >= 11
#ifndef _LIBCPP_HAS_NO_UNICODE_CHARS
- assert( test<std::u16string_view> (u"1234"));
- assert( test<std::u32string_view> (U"1234"));
+ assert( test<std::u16string_view> ( u"1234"));
+ assert( test<std::u32string_view> ( U"1234"));
#endif
#endif
- assert( test<std::wstring_view> (L"1234"));
+ assert( test<std::wstring_view> ( L"1234"));
#if TEST_STD_VER > 11
- static_assert( test<std::string_view> ({ "abc", 3}), "");
+ static_assert( test<std::string_view> ({ "abc", 3}), "");
+#if defined(__cpp_lib_char8_t) && __cpp_lib_char8_t >= 201811L
+ static_assert( test<std::u8string_view> ({u8"abc", 3}), "");
+#endif
#ifndef _LIBCPP_HAS_NO_UNICODE_CHARS
- static_assert( test<std::u16string_view> ({u"abc", 3}), "");
- static_assert( test<std::u32string_view> ({U"abc", 3}), "");
+ static_assert( test<std::u16string_view> ({ u"abc", 3}), "");
+ static_assert( test<std::u32string_view> ({ U"abc", 3}), "");
#endif
- static_assert( test<std::wstring_view> ({L"abc", 3}), "");
+ static_assert( test<std::wstring_view> ({ L"abc", 3}), "");
#endif
}
diff --git a/test/std/strings/string.view/string.view.cons/default.pass.cpp b/test/std/strings/string.view/string.view.cons/default.pass.cpp
index 79fadf619f251..0c94918b53d41 100644
--- a/test/std/strings/string.view/string.view.cons/default.pass.cpp
+++ b/test/std/strings/string.view/string.view.cons/default.pass.cpp
@@ -37,14 +37,12 @@ void test () {
}
int main () {
- typedef std::string_view string_view;
- typedef std::u16string_view u16string_view;
- typedef std::u32string_view u32string_view;
- typedef std::wstring_view wstring_view;
-
- test<string_view> ();
- test<u16string_view> ();
- test<u32string_view> ();
- test<wstring_view> ();
+ test<std::string_view> ();
+ test<std::u16string_view> ();
+#if defined(__cpp_lib_char8_t) && __cpp_lib_char8_t >= 201811L
+ test<std::u8string_view> ();
+#endif
+ test<std::u32string_view> ();
+ test<std::wstring_view> ();
}
diff --git a/test/std/strings/string.view/string.view.cons/from_string.pass.cpp b/test/std/strings/string.view/string.view.cons/from_string.pass.cpp
index 5fad2bfaab140..237d1221dbae4 100644
--- a/test/std/strings/string.view/string.view.cons/from_string.pass.cpp
+++ b/test/std/strings/string.view/string.view.cons/from_string.pass.cpp
@@ -42,6 +42,12 @@ int main () {
test ( std::wstring(L"") );
test ( std::wstring() );
+#if defined(__cpp_lib_char8_t) && __cpp_lib_char8_t >= 201811L
+ test ( std::u8string{u8"QBCDE"} );
+ test ( std::u8string{u8""} );
+ test ( std::u8string{} );
+#endif
+
#if TEST_STD_VER >= 11
test ( std::u16string{u"QBCDE"} );
test ( std::u16string{u""} );
diff --git a/test/std/strings/string.view/string.view.hash/enabled_hashes.pass.cpp b/test/std/strings/string.view/string.view.hash/enabled_hashes.pass.cpp
index 2e9ebcb4c037a..70515bf4847cf 100644
--- a/test/std/strings/string.view/string.view.hash/enabled_hashes.pass.cpp
+++ b/test/std/strings/string.view/string.view.hash/enabled_hashes.pass.cpp
@@ -23,6 +23,9 @@ int main() {
{
test_hash_enabled_for_type<std::string_view>();
test_hash_enabled_for_type<std::wstring_view>();
+#if defined(__cpp_lib_char8_t) && __cpp_lib_char8_t >= 201811L
+ test_hash_enabled_for_type<std::u8string_view>();
+#endif
#ifndef _LIBCPP_HAS_NO_UNICODE_CHARS
test_hash_enabled_for_type<std::u16string_view>();
test_hash_enabled_for_type<std::u32string_view>();
diff --git a/test/std/strings/string.view/string.view.hash/string_view.pass.cpp b/test/std/strings/string.view/string.view.hash/string_view.pass.cpp
index 53c3d261d882b..042e1dfabd308 100644
--- a/test/std/strings/string.view/string.view.hash/string_view.pass.cpp
+++ b/test/std/strings/string.view/string.view.hash/string_view.pass.cpp
@@ -59,6 +59,9 @@ test()
int main()
{
test<std::string_view>();
+#if defined(__cpp_lib_char8_t) && __cpp_lib_char8_t >= 201811L
+ test<std::u8string_view>();
+#endif
#ifndef _LIBCPP_HAS_NO_UNICODE_CHARS
test<std::u16string_view>();
test<std::u32string_view>();
diff --git a/test/std/strings/string.view/string.view.iterators/begin.pass.cpp b/test/std/strings/string.view/string.view.iterators/begin.pass.cpp
index b766c51682faa..339f1f8fddbe2 100644
--- a/test/std/strings/string.view/string.view.iterators/begin.pass.cpp
+++ b/test/std/strings/string.view/string.view.iterators/begin.pass.cpp
@@ -43,6 +43,9 @@ test(S s)
int main()
{
typedef std::string_view string_view;
+#if defined(__cpp_lib_char8_t) && __cpp_lib_char8_t >= 201811L
+ typedef std::u8string_view u8string_view;
+#endif
typedef std::u16string_view u16string_view;
typedef std::u32string_view u32string_view;
typedef std::wstring_view wstring_view;
@@ -53,6 +56,9 @@ int main()
test(wstring_view ());
test(string_view ( "123"));
test(wstring_view (L"123"));
+#if defined(__cpp_lib_char8_t) && __cpp_lib_char8_t >= 201811L
+ test(u8string_view{u8"123"});
+#endif
#if TEST_STD_VER >= 11
test(u16string_view{u"123"});
test(u32string_view{U"123"});
@@ -61,16 +67,25 @@ int main()
#if TEST_STD_VER > 11
{
constexpr string_view sv { "123", 3 };
+#if defined(__cpp_lib_char8_t) && __cpp_lib_char8_t >= 201811L
+ constexpr u8string_view u8sv {u8"123", 3 };
+#endif
constexpr u16string_view u16sv {u"123", 3 };
constexpr u32string_view u32sv {U"123", 3 };
constexpr wstring_view wsv {L"123", 3 };
static_assert ( *sv.begin() == sv[0], "" );
+#if defined(__cpp_lib_char8_t) && __cpp_lib_char8_t >= 201811L
+ static_assert ( *u8sv.begin() == u8sv[0], "" );
+#endif
static_assert ( *u16sv.begin() == u16sv[0], "" );
static_assert ( *u32sv.begin() == u32sv[0], "" );
static_assert ( *wsv.begin() == wsv[0], "" );
static_assert ( *sv.cbegin() == sv[0], "" );
+#if defined(__cpp_lib_char8_t) && __cpp_lib_char8_t >= 201811L
+ static_assert ( *u8sv.cbegin() == u8sv[0], "" );
+#endif
static_assert ( *u16sv.cbegin() == u16sv[0], "" );
static_assert ( *u32sv.cbegin() == u32sv[0], "" );
static_assert ( *wsv.cbegin() == wsv[0], "" );
diff --git a/test/std/strings/string.view/string.view.iterators/end.pass.cpp b/test/std/strings/string.view/string.view.iterators/end.pass.cpp
index b5759d7016125..1533b49ba066d 100644
--- a/test/std/strings/string.view/string.view.iterators/end.pass.cpp
+++ b/test/std/strings/string.view/string.view.iterators/end.pass.cpp
@@ -52,6 +52,9 @@ test(S s)
int main()
{
typedef std::string_view string_view;
+#if defined(__cpp_lib_char8_t) && __cpp_lib_char8_t >= 201811L
+ typedef std::u8string_view u8string_view;
+#endif
typedef std::u16string_view u16string_view;
typedef std::u32string_view u32string_view;
typedef std::wstring_view wstring_view;
@@ -62,6 +65,9 @@ int main()
test(wstring_view ());
test(string_view ( "123"));
test(wstring_view (L"123"));
+#if defined(__cpp_lib_char8_t) && __cpp_lib_char8_t >= 201811L
+ test(u8string_view{u8"123"});
+#endif
#if TEST_STD_VER >= 11
test(u16string_view{u"123"});
test(u32string_view{U"123"});
@@ -70,16 +76,25 @@ int main()
#if TEST_STD_VER > 11
{
constexpr string_view sv { "123", 3 };
+#if defined(__cpp_lib_char8_t) && __cpp_lib_char8_t >= 201811L
+ constexpr u8string_view u8sv {u8"123", 3 };
+#endif
constexpr u16string_view u16sv {u"123", 3 };
constexpr u32string_view u32sv {U"123", 3 };
constexpr wstring_view wsv {L"123", 3 };
static_assert ( sv.begin() != sv.end(), "" );
+#if defined(__cpp_lib_char8_t) && __cpp_lib_char8_t >= 201811L
+ static_assert ( u8sv.begin() != u8sv.end(), "" );
+#endif
static_assert ( u16sv.begin() != u16sv.end(), "" );
static_assert ( u32sv.begin() != u32sv.end(), "" );
static_assert ( wsv.begin() != wsv.end(), "" );
static_assert ( sv.begin() != sv.cend(), "" );
+#if defined(__cpp_lib_char8_t) && __cpp_lib_char8_t >= 201811L
+ static_assert ( u8sv.begin() != u8sv.cend(), "" );
+#endif
static_assert ( u16sv.begin() != u16sv.cend(), "" );
static_assert ( u32sv.begin() != u32sv.cend(), "" );
static_assert ( wsv.begin() != wsv.cend(), "" );
diff --git a/test/std/strings/string.view/string.view.iterators/rbegin.pass.cpp b/test/std/strings/string.view/string.view.iterators/rbegin.pass.cpp
index 16a4da8827398..0ec83871860f0 100644
--- a/test/std/strings/string.view/string.view.iterators/rbegin.pass.cpp
+++ b/test/std/strings/string.view/string.view.iterators/rbegin.pass.cpp
@@ -44,6 +44,9 @@ test(S s)
int main()
{
typedef std::string_view string_view;
+#if defined(__cpp_lib_char8_t) && __cpp_lib_char8_t >= 201811L
+ typedef std::u8string_view u8string_view;
+#endif
typedef std::u16string_view u16string_view;
typedef std::u32string_view u32string_view;
typedef std::wstring_view wstring_view;
@@ -54,6 +57,9 @@ int main()
test(wstring_view ());
test(string_view ( "123"));
test(wstring_view (L"123"));
+#if defined(__cpp_lib_char8_t) && __cpp_lib_char8_t >= 201811L
+ test(u8string_view{u8"123"});
+#endif
#if TEST_STD_VER >= 11
test(u16string_view{u"123"});
test(u32string_view{U"123"});
@@ -62,16 +68,25 @@ int main()
#if TEST_STD_VER > 14
{
constexpr string_view sv { "123", 3 };
+#if defined(__cpp_lib_char8_t) && __cpp_lib_char8_t >= 201811L
+ constexpr u8string_view u8sv {u8"123", 3 };
+#endif
constexpr u16string_view u16sv {u"123", 3 };
constexpr u32string_view u32sv {U"123", 3 };
constexpr wstring_view wsv {L"123", 3 };
static_assert ( *sv.rbegin() == sv[2], "" );
+#if defined(__cpp_lib_char8_t) && __cpp_lib_char8_t >= 201811L
+ static_assert ( *u8sv.rbegin() == u8sv[2], "" );
+#endif
static_assert ( *u16sv.rbegin() == u16sv[2], "" );
static_assert ( *u32sv.rbegin() == u32sv[2], "" );
static_assert ( *wsv.rbegin() == wsv[2], "" );
static_assert ( *sv.crbegin() == sv[2], "" );
+#if defined(__cpp_lib_char8_t) && __cpp_lib_char8_t >= 201811L
+ static_assert ( *u8sv.crbegin() == u8sv[2], "" );
+#endif
static_assert ( *u16sv.crbegin() == u16sv[2], "" );
static_assert ( *u32sv.crbegin() == u32sv[2], "" );
static_assert ( *wsv.crbegin() == wsv[2], "" );
diff --git a/test/std/strings/string.view/string.view.iterators/rend.pass.cpp b/test/std/strings/string.view/string.view.iterators/rend.pass.cpp
index 08f9e5a7755b2..dfcb836f16a8a 100644
--- a/test/std/strings/string.view/string.view.iterators/rend.pass.cpp
+++ b/test/std/strings/string.view/string.view.iterators/rend.pass.cpp
@@ -52,6 +52,9 @@ test(S s)
int main()
{
typedef std::string_view string_view;
+#if defined(__cpp_lib_char8_t) && __cpp_lib_char8_t >= 201811L
+ typedef std::u8string_view u8string_view;
+#endif
typedef std::u16string_view u16string_view;
typedef std::u32string_view u32string_view;
typedef std::wstring_view wstring_view;
@@ -62,6 +65,9 @@ int main()
test(wstring_view ());
test(string_view ( "123"));
test(wstring_view (L"123"));
+#if defined(__cpp_lib_char8_t) && __cpp_lib_char8_t >= 201811L
+ test(u8string_view{u8"123"});
+#endif
#if TEST_STD_VER >= 11
test(u16string_view{u"123"});
test(u32string_view{U"123"});
@@ -70,16 +76,25 @@ int main()
#if TEST_STD_VER > 14
{
constexpr string_view sv { "123", 3 };
+#if defined(__cpp_lib_char8_t) && __cpp_lib_char8_t >= 201811L
+ constexpr u8string_view u8sv {u8"123", 3 };
+#endif
constexpr u16string_view u16sv {u"123", 3 };
constexpr u32string_view u32sv {U"123", 3 };
constexpr wstring_view wsv {L"123", 3 };
static_assert ( *--sv.rend() == sv[0], "" );
+#if defined(__cpp_lib_char8_t) && __cpp_lib_char8_t >= 201811L
+ static_assert ( *--u8sv.rend() == u8sv[0], "" );
+#endif
static_assert ( *--u16sv.rend() == u16sv[0], "" );
static_assert ( *--u32sv.rend() == u32sv[0], "" );
static_assert ( *--wsv.rend() == wsv[0], "" );
static_assert ( *--sv.crend() == sv[0], "" );
+#if defined(__cpp_lib_char8_t) && __cpp_lib_char8_t >= 201811L
+ static_assert ( *--u8sv.crend() == u8sv[0], "" );
+#endif
static_assert ( *--u16sv.crend() == u16sv[0], "" );
static_assert ( *--u32sv.crend() == u32sv[0], "" );
static_assert ( *--wsv.crend() == wsv[0], "" );
diff --git a/test/std/strings/string.view/string.view.ops/compare.pointer_size.pass.cpp b/test/std/strings/string.view/string.view.ops/compare.pointer_size.pass.cpp
index 84f9ce0804431..546590326c4b0 100644
--- a/test/std/strings/string.view/string.view.ops/compare.pointer_size.pass.cpp
+++ b/test/std/strings/string.view/string.view.ops/compare.pointer_size.pass.cpp
@@ -13,6 +13,7 @@
#include <string_view>
#include <cassert>
+#include <stdexcept>
#include "test_macros.h"
#include "constexpr_char_traits.hpp"
diff --git a/test/std/strings/string.view/string.view.ops/compare.size_size_sv.pass.cpp b/test/std/strings/string.view/string.view.ops/compare.size_size_sv.pass.cpp
index 2bef7fdbac1a5..d170949c77ec6 100644
--- a/test/std/strings/string.view/string.view.ops/compare.size_size_sv.pass.cpp
+++ b/test/std/strings/string.view/string.view.ops/compare.size_size_sv.pass.cpp
@@ -13,6 +13,7 @@
#include <string_view>
#include <cassert>
+#include <stdexcept>
#include "test_macros.h"
#include "constexpr_char_traits.hpp"
diff --git a/test/std/strings/string.view/string.view.ops/compare.size_size_sv_pointer_size.pass.cpp b/test/std/strings/string.view/string.view.ops/compare.size_size_sv_pointer_size.pass.cpp
index 8256c997b1186..f1489e7df48b5 100644
--- a/test/std/strings/string.view/string.view.ops/compare.size_size_sv_pointer_size.pass.cpp
+++ b/test/std/strings/string.view/string.view.ops/compare.size_size_sv_pointer_size.pass.cpp
@@ -14,6 +14,7 @@
#include <string_view>
#include <cassert>
+#include <stdexcept>
#include "test_macros.h"
#include "constexpr_char_traits.hpp"
diff --git a/test/std/strings/string.view/string.view.ops/compare.size_size_sv_size_size.pass.cpp b/test/std/strings/string.view/string.view.ops/compare.size_size_sv_size_size.pass.cpp
index 5b47486192cd6..e93d6ddfea306 100644
--- a/test/std/strings/string.view/string.view.ops/compare.size_size_sv_size_size.pass.cpp
+++ b/test/std/strings/string.view/string.view.ops/compare.size_size_sv_size_size.pass.cpp
@@ -14,6 +14,7 @@
#include <string_view>
#include <cassert>
+#include <stdexcept>
#include "test_macros.h"
#include "constexpr_char_traits.hpp"
diff --git a/test/std/strings/string.view/string.view.ops/copy.pass.cpp b/test/std/strings/string.view/string.view.ops/copy.pass.cpp
index 41601467b812d..98e83ef5053b2 100644
--- a/test/std/strings/string.view/string.view.ops/copy.pass.cpp
+++ b/test/std/strings/string.view/string.view.ops/copy.pass.cpp
@@ -21,6 +21,7 @@
#include <string_view>
#include <algorithm>
#include <cassert>
+#include <stdexcept>
#include "test_macros.h"
diff --git a/test/std/strings/string.view/string_view.literals/literal.pass.cpp b/test/std/strings/string.view/string_view.literals/literal.pass.cpp
index 79fe355289d17..cc2202e8397b3 100644
--- a/test/std/strings/string.view/string_view.literals/literal.pass.cpp
+++ b/test/std/strings/string.view/string_view.literals/literal.pass.cpp
@@ -16,38 +16,48 @@
#include <string_view>
#include <cassert>
+#include "test_macros.h"
+
+#if defined(__cpp_lib_char8_t) && __cpp_lib_char8_t >= 201811L
+ typedef std::u8string_view u8string_view;
+#else
+ typedef std::string_view u8string_view;
+#endif
+
int main()
{
using namespace std::literals::string_view_literals;
static_assert ( std::is_same<decltype( "Hi"sv), std::string_view>::value, "" );
- static_assert ( std::is_same<decltype( u8"Hi"sv), std::string_view>::value, "" );
+ static_assert ( std::is_same<decltype( u8"Hi"sv), u8string_view>::value, "" );
static_assert ( std::is_same<decltype( L"Hi"sv), std::wstring_view>::value, "" );
static_assert ( std::is_same<decltype( u"Hi"sv), std::u16string_view>::value, "" );
static_assert ( std::is_same<decltype( U"Hi"sv), std::u32string_view>::value, "" );
std::string_view foo;
std::wstring_view Lfoo;
+ u8string_view u8foo;
std::u16string_view ufoo;
std::u32string_view Ufoo;
- foo = ""sv; assert( foo.size() == 0);
- foo = u8""sv; assert( foo.size() == 0);
- Lfoo = L""sv; assert(Lfoo.size() == 0);
- ufoo = u""sv; assert(ufoo.size() == 0);
- Ufoo = U""sv; assert(Ufoo.size() == 0);
+
+ foo = ""sv; assert( foo.size() == 0);
+ u8foo = u8""sv; assert(u8foo.size() == 0);
+ Lfoo = L""sv; assert( Lfoo.size() == 0);
+ ufoo = u""sv; assert( ufoo.size() == 0);
+ Ufoo = U""sv; assert( Ufoo.size() == 0);
- foo = " "sv; assert( foo.size() == 1);
- foo = u8" "sv; assert( foo.size() == 1);
- Lfoo = L" "sv; assert(Lfoo.size() == 1);
- ufoo = u" "sv; assert(ufoo.size() == 1);
- Ufoo = U" "sv; assert(Ufoo.size() == 1);
+ foo = " "sv; assert( foo.size() == 1);
+ u8foo = u8" "sv; assert(u8foo.size() == 1);
+ Lfoo = L" "sv; assert( Lfoo.size() == 1);
+ ufoo = u" "sv; assert( ufoo.size() == 1);
+ Ufoo = U" "sv; assert( Ufoo.size() == 1);
- foo = "ABC"sv; assert( foo == "ABC"); assert( foo == std::string_view ( "ABC"));
- foo = u8"ABC"sv; assert( foo == u8"ABC"); assert( foo == std::string_view (u8"ABC"));
- Lfoo = L"ABC"sv; assert(Lfoo == L"ABC"); assert(Lfoo == std::wstring_view ( L"ABC"));
- ufoo = u"ABC"sv; assert(ufoo == u"ABC"); assert(ufoo == std::u16string_view( u"ABC"));
- Ufoo = U"ABC"sv; assert(Ufoo == U"ABC"); assert(Ufoo == std::u32string_view( U"ABC"));
+ foo = "ABC"sv; assert( foo == "ABC"); assert( foo == std::string_view ( "ABC"));
+ u8foo = u8"ABC"sv; assert(u8foo == u8"ABC"); assert(u8foo == u8string_view (u8"ABC"));
+ Lfoo = L"ABC"sv; assert( Lfoo == L"ABC"); assert( Lfoo == std::wstring_view ( L"ABC"));
+ ufoo = u"ABC"sv; assert( ufoo == u"ABC"); assert( ufoo == std::u16string_view( u"ABC"));
+ Ufoo = U"ABC"sv; assert( Ufoo == U"ABC"); assert( Ufoo == std::u32string_view( U"ABC"));
static_assert( "ABC"sv.size() == 3, "");
static_assert(u8"ABC"sv.size() == 3, "");
diff --git a/test/std/strings/string.view/types.pass.cpp b/test/std/strings/string.view/types.pass.cpp
index 4c29959f09514..2763f7fb47ca8 100644
--- a/test/std/strings/string.view/types.pass.cpp
+++ b/test/std/strings/string.view/types.pass.cpp
@@ -72,6 +72,9 @@ int main()
{
test<std::char_traits<char> >();
test<std::char_traits<wchar_t> >();
+#if defined(__cpp_lib_char8_t) && __cpp_lib_char8_t >= 201811L
+ test<std::char_traits<char8_t> >();
+#endif
static_assert((std::is_same<std::basic_string_view<char>::traits_type,
std::char_traits<char> >::value), "");
}
diff --git a/test/std/strings/strings.erasure/erase.pass.cpp b/test/std/strings/strings.erasure/erase.pass.cpp
new file mode 100644
index 0000000000000..657a56c731569
--- /dev/null
+++ b/test/std/strings/strings.erasure/erase.pass.cpp
@@ -0,0 +1,76 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
+
+// <string>
+
+// template <class charT, class traits, class Allocator, class U>
+// void erase(basic_string<charT, traits, Allocator>& c, const U& value);
+
+
+#include <string>
+#include <optional>
+
+#include "test_macros.h"
+#include "test_allocator.h"
+#include "min_allocator.h"
+
+template <class S, class U>
+void
+test0(S s, U val, S expected)
+{
+ ASSERT_SAME_TYPE(void, decltype(std::erase(s, val)));
+ std::erase(s, val);
+ LIBCPP_ASSERT(s.__invariants());
+ assert(s == expected);
+}
+
+template <class S>
+void test()
+{
+
+ test0(S(""), 'a', S(""));
+
+ test0(S("a"), 'a', S(""));
+ test0(S("a"), 'b', S("a"));
+
+ test0(S("ab"), 'a', S("b"));
+ test0(S("ab"), 'b', S("a"));
+ test0(S("ab"), 'c', S("ab"));
+ test0(S("aa"), 'a', S(""));
+ test0(S("aa"), 'c', S("aa"));
+
+ test0(S("abc"), 'a', S("bc"));
+ test0(S("abc"), 'b', S("ac"));
+ test0(S("abc"), 'c', S("ab"));
+ test0(S("abc"), 'd', S("abc"));
+
+ test0(S("aab"), 'a', S("b"));
+ test0(S("aab"), 'b', S("aa"));
+ test0(S("aab"), 'c', S("aab"));
+ test0(S("abb"), 'a', S("bb"));
+ test0(S("abb"), 'b', S("a"));
+ test0(S("abb"), 'c', S("abb"));
+ test0(S("aaa"), 'a', S(""));
+ test0(S("aaa"), 'b', S("aaa"));
+
+// Test cross-type erasure
+ using opt = std::optional<typename S::value_type>;
+ test0(S("aba"), opt(), S("aba"));
+ test0(S("aba"), opt('a'), S("b"));
+ test0(S("aba"), opt('b'), S("aa"));
+ test0(S("aba"), opt('c'), S("aba"));
+}
+
+int main()
+{
+ test<std::string>();
+ test<std::basic_string<char, std::char_traits<char>, min_allocator<char>>> ();
+ test<std::basic_string<char, std::char_traits<char>, test_allocator<char>>> ();
+}
diff --git a/test/std/strings/strings.erasure/erase_if.pass.cpp b/test/std/strings/strings.erasure/erase_if.pass.cpp
new file mode 100644
index 0000000000000..d7014868fd35f
--- /dev/null
+++ b/test/std/strings/strings.erasure/erase_if.pass.cpp
@@ -0,0 +1,76 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
+
+// <string>
+
+// template <class charT, class traits, class Allocator, class Predicate>
+// void erase_if(basic_string<charT, traits, Allocator>& c, Predicate pred);
+
+#include <string>
+
+#include "test_macros.h"
+#include "test_allocator.h"
+#include "min_allocator.h"
+
+template <class S, class Pred>
+void
+test0(S s, Pred p, S expected)
+{
+ ASSERT_SAME_TYPE(void, decltype(std::erase_if(s, p)));
+ std::erase_if(s, p);
+ LIBCPP_ASSERT(s.__invariants());
+ assert(s == expected);
+}
+
+template <typename S>
+void test()
+{
+ auto isA = [](auto ch) { return ch == 'a';};
+ auto isB = [](auto ch) { return ch == 'b';};
+ auto isC = [](auto ch) { return ch == 'c';};
+ auto isD = [](auto ch) { return ch == 'd';};
+ auto True = [](auto) { return true; };
+ auto False = [](auto) { return false; };
+
+ test0(S(""), isA, S(""));
+
+ test0(S("a"), isA, S(""));
+ test0(S("a"), isB, S("a"));
+
+ test0(S("ab"), isA, S("b"));
+ test0(S("ab"), isB, S("a"));
+ test0(S("ab"), isC, S("ab"));
+ test0(S("aa"), isA, S(""));
+ test0(S("aa"), isC, S("aa"));
+
+ test0(S("abc"), isA, S("bc"));
+ test0(S("abc"), isB, S("ac"));
+ test0(S("abc"), isC, S("ab"));
+ test0(S("abc"), isD, S("abc"));
+
+ test0(S("aab"), isA, S("b"));
+ test0(S("aab"), isB, S("aa"));
+ test0(S("aab"), isC, S("aab"));
+ test0(S("abb"), isA, S("bb"));
+ test0(S("abb"), isB, S("a"));
+ test0(S("abb"), isC, S("abb"));
+ test0(S("aaa"), isA, S(""));
+ test0(S("aaa"), isB, S("aaa"));
+
+ test0(S("aba"), False, S("aba"));
+ test0(S("aba"), True, S(""));
+}
+
+int main()
+{
+ test<std::string>();
+ test<std::basic_string<char, std::char_traits<char>, min_allocator<char>>> ();
+ test<std::basic_string<char, std::char_traits<char>, test_allocator<char>>> ();
+}
diff --git a/test/std/thread/futures/futures.async/async_race.38682.pass.cpp b/test/std/thread/futures/futures.async/async_race.38682.pass.cpp
new file mode 100644
index 0000000000000..bc82ba849c3b8
--- /dev/null
+++ b/test/std/thread/futures/futures.async/async_race.38682.pass.cpp
@@ -0,0 +1,69 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+//
+// UNSUPPORTED: libcpp-has-no-threads
+// UNSUPPORTED: c++98, c++03
+
+// 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: with_system_cxx_lib=macosx10.14
+// UNSUPPORTED: with_system_cxx_lib=macosx10.13
+// UNSUPPORTED: with_system_cxx_lib=macosx10.12
+// UNSUPPORTED: with_system_cxx_lib=macosx10.11
+// UNSUPPORTED: with_system_cxx_lib=macosx10.10
+// UNSUPPORTED: with_system_cxx_lib=macosx10.9
+// UNSUPPORTED: with_system_cxx_lib=macosx10.8
+// UNSUPPORTED: with_system_cxx_lib=macosx10.7
+
+// This test is designed to cause and allow TSAN to detect a race condition
+// in std::async, as reported in https://bugs.llvm.org/show_bug.cgi?id=38682.
+
+#include <cassert>
+#include <functional>
+#include <future>
+#include <numeric>
+#include <vector>
+
+
+static int worker(std::vector<int> const& data) {
+ return std::accumulate(data.begin(), data.end(), 0);
+}
+
+static int& worker_ref(int& i) { return i; }
+
+static void worker_void() { }
+
+int main() {
+ // future<T>
+ {
+ std::vector<int> const v{1, 2, 3, 4, 5, 6, 7, 8, 9, 10};
+ for (int i = 0; i != 20; ++i) {
+ std::future<int> fut = std::async(std::launch::async, worker, v);
+ int answer = fut.get();
+ assert(answer == 55);
+ }
+ }
+
+ // future<T&>
+ {
+ for (int i = 0; i != 20; ++i) {
+ std::future<int&> fut = std::async(std::launch::async, worker_ref, std::ref(i));
+ int& answer = fut.get();
+ assert(answer == i);
+ }
+ }
+
+ // future<void>
+ {
+ for (int i = 0; i != 20; ++i) {
+ std::future<void> fut = std::async(std::launch::async, worker_void);
+ fut.get();
+ }
+ }
+}
diff --git a/test/std/thread/futures/futures.shared_future/wait_until.pass.cpp b/test/std/thread/futures/futures.shared_future/wait_until.pass.cpp
index 0ddbd0b08936d..4e107ca9abfb1 100644
--- a/test/std/thread/futures/futures.shared_future/wait_until.pass.cpp
+++ b/test/std/thread/futures/futures.shared_future/wait_until.pass.cpp
@@ -10,6 +10,8 @@
// UNSUPPORTED: libcpp-has-no-threads
// UNSUPPORTED: c++98, c++03
+// FLAKY_TEST.
+
// <future>
// class shared_future<R>
diff --git a/test/std/thread/thread.condition/thread.condition.condvar/wait_for.pass.cpp b/test/std/thread/thread.condition/thread.condition.condvar/wait_for.pass.cpp
index ca48eee19d276..8aa233f66b5ac 100644
--- a/test/std/thread/thread.condition/thread.condition.condvar/wait_for.pass.cpp
+++ b/test/std/thread/thread.condition/thread.condition.condvar/wait_for.pass.cpp
@@ -9,6 +9,8 @@
//
// UNSUPPORTED: libcpp-has-no-threads
+// FLAKY_TEST
+
// <condition_variable>
// class condition_variable;
diff --git a/test/std/thread/thread.condition/thread.condition.condvarany/notify_one.pass.cpp b/test/std/thread/thread.condition/thread.condition.condvarany/notify_one.pass.cpp
index 98f6c432c9770..16e6ff9f105b2 100644
--- a/test/std/thread/thread.condition/thread.condition.condvarany/notify_one.pass.cpp
+++ b/test/std/thread/thread.condition/thread.condition.condvarany/notify_one.pass.cpp
@@ -9,6 +9,8 @@
//
// UNSUPPORTED: libcpp-has-no-threads
+// FLAKY_TEST
+
// <condition_variable>
// class condition_variable_any;
diff --git a/test/std/thread/thread.mutex/thread.lock/thread.lock.guard/adopt_lock.pass.cpp b/test/std/thread/thread.mutex/thread.lock/thread.lock.guard/adopt_lock.pass.cpp
index 83271009a67e3..79c639eb6cad7 100644
--- a/test/std/thread/thread.mutex/thread.lock/thread.lock.guard/adopt_lock.pass.cpp
+++ b/test/std/thread/thread.mutex/thread.lock/thread.lock.guard/adopt_lock.pass.cpp
@@ -9,6 +9,8 @@
//
// UNSUPPORTED: libcpp-has-no-threads
+// FLAKY_TEST
+
// <mutex>
// template <class Mutex> class lock_guard;
diff --git a/test/std/thread/thread.mutex/thread.lock/thread.lock.guard/mutex.pass.cpp b/test/std/thread/thread.mutex/thread.lock/thread.lock.guard/mutex.pass.cpp
index 97f9d07c15127..4a2db39e87a96 100644
--- a/test/std/thread/thread.mutex/thread.lock/thread.lock.guard/mutex.pass.cpp
+++ b/test/std/thread/thread.mutex/thread.lock/thread.lock.guard/mutex.pass.cpp
@@ -9,6 +9,8 @@
//
// UNSUPPORTED: libcpp-has-no-threads
+// FLAKY_TEST
+
// <mutex>
// template <class Mutex> class lock_guard;
diff --git a/test/std/thread/thread.mutex/thread.lock/thread.lock.shared/thread.lock.shared.cons/mutex_try_to_lock.pass.cpp b/test/std/thread/thread.mutex/thread.lock/thread.lock.shared/thread.lock.shared.cons/mutex_try_to_lock.pass.cpp
index 7f89f0af801f2..694e311b7bfb7 100644
--- a/test/std/thread/thread.mutex/thread.lock/thread.lock.shared/thread.lock.shared.cons/mutex_try_to_lock.pass.cpp
+++ b/test/std/thread/thread.mutex/thread.lock/thread.lock.shared/thread.lock.shared.cons/mutex_try_to_lock.pass.cpp
@@ -10,6 +10,8 @@
// UNSUPPORTED: libcpp-has-no-threads
// UNSUPPORTED: c++98, c++03, c++11
+// FLAKY_TEST
+
// <shared_mutex>
// template <class Mutex> class shared_lock;
diff --git a/test/std/thread/thread.mutex/thread.lock/thread.lock.unique/thread.lock.unique.cons/mutex.pass.cpp b/test/std/thread/thread.mutex/thread.lock/thread.lock.unique/thread.lock.unique.cons/mutex.pass.cpp
index dcfdfd11a7e15..f63256373b27c 100644
--- a/test/std/thread/thread.mutex/thread.lock/thread.lock.unique/thread.lock.unique.cons/mutex.pass.cpp
+++ b/test/std/thread/thread.mutex/thread.lock/thread.lock.unique/thread.lock.unique.cons/mutex.pass.cpp
@@ -9,6 +9,8 @@
//
// UNSUPPORTED: libcpp-has-no-threads
+// FLAKY_TEST
+
// <mutex>
// template <class Mutex> class unique_lock;
diff --git a/test/std/thread/thread.mutex/thread.lock/thread.lock.unique/thread.lock.unique.locking/lock.pass.cpp b/test/std/thread/thread.mutex/thread.lock/thread.lock.unique/thread.lock.unique.locking/lock.pass.cpp
index cb5c55925eef4..ebaf3e6deb23a 100644
--- a/test/std/thread/thread.mutex/thread.lock/thread.lock.unique/thread.lock.unique.locking/lock.pass.cpp
+++ b/test/std/thread/thread.mutex/thread.lock/thread.lock.unique/thread.lock.unique.locking/lock.pass.cpp
@@ -9,6 +9,8 @@
//
// UNSUPPORTED: libcpp-has-no-threads
+// FLAKY_TEST
+
// <mutex>
// template <class Mutex> class unique_lock;
diff --git a/test/std/thread/thread.threads/thread.thread.class/thread.thread.constr/F.pass.cpp b/test/std/thread/thread.threads/thread.thread.class/thread.thread.constr/F.pass.cpp
index d419b8cc855c9..be3fc9c5d1eb1 100644
--- a/test/std/thread/thread.threads/thread.thread.class/thread.thread.constr/F.pass.cpp
+++ b/test/std/thread/thread.threads/thread.thread.class/thread.thread.constr/F.pass.cpp
@@ -157,8 +157,11 @@ int main()
{
assert(G::n_alive == 0);
assert(!G::op_run);
- std::thread t((G()));
- t.join();
+ {
+ G g;
+ std::thread t(g);
+ t.join();
+ }
assert(G::n_alive == 0);
assert(G::op_run);
}
@@ -185,8 +188,11 @@ int main()
{
assert(G::n_alive == 0);
assert(!G::op_run);
- std::thread t(G(), 5, 5.5);
- t.join();
+ {
+ G g;
+ std::thread t(g, 5, 5.5);
+ t.join();
+ }
assert(G::n_alive == 0);
assert(G::op_run);
}
diff --git a/test/std/thread/thread.threads/thread.thread.this/sleep_until.pass.cpp b/test/std/thread/thread.threads/thread.thread.this/sleep_until.pass.cpp
index 6b622029365ce..0a5a3e419d565 100644
--- a/test/std/thread/thread.threads/thread.thread.this/sleep_until.pass.cpp
+++ b/test/std/thread/thread.threads/thread.thread.this/sleep_until.pass.cpp
@@ -8,6 +8,7 @@
//===----------------------------------------------------------------------===//
//
// UNSUPPORTED: libcpp-has-no-threads
+// FLAKY_TEST.
// <thread>
diff --git a/test/std/utilities/any/any.class/any.assign/copy.pass.cpp b/test/std/utilities/any/any.class/any.assign/copy.pass.cpp
index 68de5e3d13689..c148a39de83ca 100644
--- a/test/std/utilities/any/any.class/any.assign/copy.pass.cpp
+++ b/test/std/utilities/any/any.class/any.assign/copy.pass.cpp
@@ -9,12 +9,13 @@
// UNSUPPORTED: c++98, c++03, c++11, c++14
-// XFAIL: with_system_cxx_lib=macosx10.12
-// XFAIL: with_system_cxx_lib=macosx10.11
-// XFAIL: with_system_cxx_lib=macosx10.10
-// XFAIL: with_system_cxx_lib=macosx10.9
-// XFAIL: with_system_cxx_lib=macosx10.7
-// XFAIL: with_system_cxx_lib=macosx10.8
+// XFAIL: availability=macosx10.13
+// XFAIL: availability=macosx10.12
+// XFAIL: availability=macosx10.11
+// XFAIL: availability=macosx10.10
+// XFAIL: availability=macosx10.9
+// XFAIL: availability=macosx10.7
+// XFAIL: availability=macosx10.8
// <any>
diff --git a/test/std/utilities/any/any.class/any.assign/move.pass.cpp b/test/std/utilities/any/any.class/any.assign/move.pass.cpp
index 418f200beb7ae..19289cc3968f8 100644
--- a/test/std/utilities/any/any.class/any.assign/move.pass.cpp
+++ b/test/std/utilities/any/any.class/any.assign/move.pass.cpp
@@ -9,12 +9,13 @@
// UNSUPPORTED: c++98, c++03, c++11, c++14
-// XFAIL: with_system_cxx_lib=macosx10.12
-// XFAIL: with_system_cxx_lib=macosx10.11
-// XFAIL: with_system_cxx_lib=macosx10.10
-// XFAIL: with_system_cxx_lib=macosx10.9
-// XFAIL: with_system_cxx_lib=macosx10.7
-// XFAIL: with_system_cxx_lib=macosx10.8
+// XFAIL: availability=macosx10.13
+// XFAIL: availability=macosx10.12
+// XFAIL: availability=macosx10.11
+// XFAIL: availability=macosx10.10
+// XFAIL: availability=macosx10.9
+// XFAIL: availability=macosx10.8
+// XFAIL: availability=macosx10.7
// <any>
diff --git a/test/std/utilities/any/any.class/any.assign/value.pass.cpp b/test/std/utilities/any/any.class/any.assign/value.pass.cpp
index ddedb886cc044..d2e2266046c11 100644
--- a/test/std/utilities/any/any.class/any.assign/value.pass.cpp
+++ b/test/std/utilities/any/any.class/any.assign/value.pass.cpp
@@ -9,12 +9,13 @@
// UNSUPPORTED: c++98, c++03, c++11, c++14
-// XFAIL: with_system_cxx_lib=macosx10.12
-// XFAIL: with_system_cxx_lib=macosx10.11
-// XFAIL: with_system_cxx_lib=macosx10.10
-// XFAIL: with_system_cxx_lib=macosx10.9
-// XFAIL: with_system_cxx_lib=macosx10.7
-// XFAIL: with_system_cxx_lib=macosx10.8
+// XFAIL: availability=macosx10.13
+// XFAIL: availability=macosx10.12
+// XFAIL: availability=macosx10.11
+// XFAIL: availability=macosx10.10
+// XFAIL: availability=macosx10.9
+// XFAIL: availability=macosx10.8
+// XFAIL: availability=macosx10.7
// <any>
@@ -125,7 +126,7 @@ template <class Tp, bool Move = false>
void test_assign_throws() {
#if !defined(TEST_HAS_NO_EXCEPTIONS)
auto try_throw =
- [](any& lhs, auto&& rhs) {
+ [](any& lhs, Tp& rhs) {
try {
Move ? lhs = std::move(rhs)
: lhs = rhs;
diff --git a/test/std/utilities/any/any.class/any.cons/copy.pass.cpp b/test/std/utilities/any/any.class/any.cons/copy.pass.cpp
index aceb9e6cf3d50..79cac4236496e 100644
--- a/test/std/utilities/any/any.class/any.cons/copy.pass.cpp
+++ b/test/std/utilities/any/any.class/any.cons/copy.pass.cpp
@@ -9,12 +9,13 @@
// UNSUPPORTED: c++98, c++03, c++11, c++14
-// XFAIL: with_system_cxx_lib=macosx10.12
-// XFAIL: with_system_cxx_lib=macosx10.11
-// XFAIL: with_system_cxx_lib=macosx10.10
-// XFAIL: with_system_cxx_lib=macosx10.9
-// XFAIL: with_system_cxx_lib=macosx10.7
-// XFAIL: with_system_cxx_lib=macosx10.8
+// XFAIL: availability=macosx10.13
+// XFAIL: availability=macosx10.12
+// XFAIL: availability=macosx10.11
+// XFAIL: availability=macosx10.10
+// XFAIL: availability=macosx10.9
+// XFAIL: availability=macosx10.8
+// XFAIL: availability=macosx10.7
// <any>
diff --git a/test/std/utilities/any/any.class/any.cons/in_place_type.pass.cpp b/test/std/utilities/any/any.class/any.cons/in_place_type.pass.cpp
index d01a88da5dfc9..589b3c46d13e0 100644
--- a/test/std/utilities/any/any.class/any.cons/in_place_type.pass.cpp
+++ b/test/std/utilities/any/any.class/any.cons/in_place_type.pass.cpp
@@ -9,12 +9,13 @@
// UNSUPPORTED: c++98, c++03, c++11, c++14
-// XFAIL: with_system_cxx_lib=macosx10.12
-// XFAIL: with_system_cxx_lib=macosx10.11
-// XFAIL: with_system_cxx_lib=macosx10.10
-// XFAIL: with_system_cxx_lib=macosx10.9
-// XFAIL: with_system_cxx_lib=macosx10.7
-// XFAIL: with_system_cxx_lib=macosx10.8
+// XFAIL: availability=macosx10.13
+// XFAIL: availability=macosx10.12
+// XFAIL: availability=macosx10.11
+// XFAIL: availability=macosx10.10
+// XFAIL: availability=macosx10.9
+// XFAIL: availability=macosx10.8
+// XFAIL: availability=macosx10.7
// <any>
diff --git a/test/std/utilities/any/any.class/any.cons/move.pass.cpp b/test/std/utilities/any/any.class/any.cons/move.pass.cpp
index 09e9288e0ab3e..1310b6b12298e 100644
--- a/test/std/utilities/any/any.class/any.cons/move.pass.cpp
+++ b/test/std/utilities/any/any.class/any.cons/move.pass.cpp
@@ -9,12 +9,13 @@
// UNSUPPORTED: c++98, c++03, c++11, c++14
-// XFAIL: with_system_cxx_lib=macosx10.12
-// XFAIL: with_system_cxx_lib=macosx10.11
-// XFAIL: with_system_cxx_lib=macosx10.10
-// XFAIL: with_system_cxx_lib=macosx10.9
-// XFAIL: with_system_cxx_lib=macosx10.7
-// XFAIL: with_system_cxx_lib=macosx10.8
+// XFAIL: availability=macosx10.13
+// XFAIL: availability=macosx10.12
+// XFAIL: availability=macosx10.11
+// XFAIL: availability=macosx10.10
+// XFAIL: availability=macosx10.9
+// XFAIL: availability=macosx10.8
+// XFAIL: availability=macosx10.7
// <any>
diff --git a/test/std/utilities/any/any.class/any.cons/value.pass.cpp b/test/std/utilities/any/any.class/any.cons/value.pass.cpp
index d18de0664c771..83c78923de5ee 100644
--- a/test/std/utilities/any/any.class/any.cons/value.pass.cpp
+++ b/test/std/utilities/any/any.class/any.cons/value.pass.cpp
@@ -9,12 +9,13 @@
// UNSUPPORTED: c++98, c++03, c++11, c++14
-// XFAIL: with_system_cxx_lib=macosx10.12
-// XFAIL: with_system_cxx_lib=macosx10.11
-// XFAIL: with_system_cxx_lib=macosx10.10
-// XFAIL: with_system_cxx_lib=macosx10.9
-// XFAIL: with_system_cxx_lib=macosx10.7
-// XFAIL: with_system_cxx_lib=macosx10.8
+// XFAIL: availability=macosx10.13
+// XFAIL: availability=macosx10.12
+// XFAIL: availability=macosx10.11
+// XFAIL: availability=macosx10.10
+// XFAIL: availability=macosx10.9
+// XFAIL: availability=macosx10.8
+// XFAIL: availability=macosx10.7
// <any>
diff --git a/test/std/utilities/any/any.class/any.modifiers/emplace.pass.cpp b/test/std/utilities/any/any.class/any.modifiers/emplace.pass.cpp
index 789a861ee3d6c..fdd3c8334677f 100644
--- a/test/std/utilities/any/any.class/any.modifiers/emplace.pass.cpp
+++ b/test/std/utilities/any/any.class/any.modifiers/emplace.pass.cpp
@@ -9,12 +9,13 @@
// UNSUPPORTED: c++98, c++03, c++11, c++14
-// XFAIL: with_system_cxx_lib=macosx10.12
-// XFAIL: with_system_cxx_lib=macosx10.11
-// XFAIL: with_system_cxx_lib=macosx10.10
-// XFAIL: with_system_cxx_lib=macosx10.9
-// XFAIL: with_system_cxx_lib=macosx10.7
-// XFAIL: with_system_cxx_lib=macosx10.8
+// XFAIL: availability=macosx10.13
+// XFAIL: availability=macosx10.12
+// XFAIL: availability=macosx10.11
+// XFAIL: availability=macosx10.10
+// XFAIL: availability=macosx10.9
+// XFAIL: availability=macosx10.8
+// XFAIL: availability=macosx10.7
// <any>
diff --git a/test/std/utilities/any/any.class/any.modifiers/reset.pass.cpp b/test/std/utilities/any/any.class/any.modifiers/reset.pass.cpp
index 2e781d954e68d..888e3a8703e79 100644
--- a/test/std/utilities/any/any.class/any.modifiers/reset.pass.cpp
+++ b/test/std/utilities/any/any.class/any.modifiers/reset.pass.cpp
@@ -9,12 +9,13 @@
// UNSUPPORTED: c++98, c++03, c++11, c++14
-// XFAIL: with_system_cxx_lib=macosx10.12
-// XFAIL: with_system_cxx_lib=macosx10.11
-// XFAIL: with_system_cxx_lib=macosx10.10
-// XFAIL: with_system_cxx_lib=macosx10.9
-// XFAIL: with_system_cxx_lib=macosx10.7
-// XFAIL: with_system_cxx_lib=macosx10.8
+// XFAIL: availability=macosx10.13
+// XFAIL: availability=macosx10.12
+// XFAIL: availability=macosx10.11
+// XFAIL: availability=macosx10.10
+// XFAIL: availability=macosx10.9
+// XFAIL: availability=macosx10.8
+// XFAIL: availability=macosx10.7
// <any>
diff --git a/test/std/utilities/any/any.class/any.modifiers/swap.pass.cpp b/test/std/utilities/any/any.class/any.modifiers/swap.pass.cpp
index f56a2565622f4..9b5ab5f033e97 100644
--- a/test/std/utilities/any/any.class/any.modifiers/swap.pass.cpp
+++ b/test/std/utilities/any/any.class/any.modifiers/swap.pass.cpp
@@ -9,12 +9,13 @@
// UNSUPPORTED: c++98, c++03, c++11, c++14
-// XFAIL: with_system_cxx_lib=macosx10.12
-// XFAIL: with_system_cxx_lib=macosx10.11
-// XFAIL: with_system_cxx_lib=macosx10.10
-// XFAIL: with_system_cxx_lib=macosx10.9
-// XFAIL: with_system_cxx_lib=macosx10.7
-// XFAIL: with_system_cxx_lib=macosx10.8
+// XFAIL: availability=macosx10.13
+// XFAIL: availability=macosx10.12
+// XFAIL: availability=macosx10.11
+// XFAIL: availability=macosx10.10
+// XFAIL: availability=macosx10.9
+// XFAIL: availability=macosx10.8
+// XFAIL: availability=macosx10.7
// <any>
diff --git a/test/std/utilities/any/any.nonmembers/any.cast/any_cast_pointer.pass.cpp b/test/std/utilities/any/any.nonmembers/any.cast/any_cast_pointer.pass.cpp
index a5fa93218c65b..cc118b3484804 100644
--- a/test/std/utilities/any/any.nonmembers/any.cast/any_cast_pointer.pass.cpp
+++ b/test/std/utilities/any/any.nonmembers/any.cast/any_cast_pointer.pass.cpp
@@ -9,12 +9,13 @@
// UNSUPPORTED: c++98, c++03, c++11, c++14
-// XFAIL: with_system_cxx_lib=macosx10.12
-// XFAIL: with_system_cxx_lib=macosx10.11
-// XFAIL: with_system_cxx_lib=macosx10.10
-// XFAIL: with_system_cxx_lib=macosx10.9
-// XFAIL: with_system_cxx_lib=macosx10.7
-// XFAIL: with_system_cxx_lib=macosx10.8
+// XFAIL: availability=macosx10.13
+// XFAIL: availability=macosx10.12
+// XFAIL: availability=macosx10.11
+// XFAIL: availability=macosx10.10
+// XFAIL: availability=macosx10.9
+// XFAIL: availability=macosx10.8
+// XFAIL: availability=macosx10.7
// <any>
diff --git a/test/std/utilities/any/any.nonmembers/any.cast/any_cast_reference.pass.cpp b/test/std/utilities/any/any.nonmembers/any.cast/any_cast_reference.pass.cpp
index 419fd1a40cf82..85ee8fef3c8da 100644
--- a/test/std/utilities/any/any.nonmembers/any.cast/any_cast_reference.pass.cpp
+++ b/test/std/utilities/any/any.nonmembers/any.cast/any_cast_reference.pass.cpp
@@ -9,12 +9,13 @@
// UNSUPPORTED: c++98, c++03, c++11, c++14
-// XFAIL: with_system_cxx_lib=macosx10.12
-// XFAIL: with_system_cxx_lib=macosx10.11
-// XFAIL: with_system_cxx_lib=macosx10.10
-// XFAIL: with_system_cxx_lib=macosx10.9
-// XFAIL: with_system_cxx_lib=macosx10.7
-// XFAIL: with_system_cxx_lib=macosx10.8
+// XFAIL: availability=macosx10.13
+// XFAIL: availability=macosx10.12
+// XFAIL: availability=macosx10.11
+// XFAIL: availability=macosx10.10
+// XFAIL: availability=macosx10.9
+// XFAIL: availability=macosx10.8
+// XFAIL: availability=macosx10.7
// <any>
diff --git a/test/std/utilities/any/any.nonmembers/any.cast/any_cast_request_invalid_value_category.fail.cpp b/test/std/utilities/any/any.nonmembers/any.cast/any_cast_request_invalid_value_category.fail.cpp
index 9638521260a93..0e3b6a43f89ce 100644
--- a/test/std/utilities/any/any.nonmembers/any.cast/any_cast_request_invalid_value_category.fail.cpp
+++ b/test/std/utilities/any/any.nonmembers/any.cast/any_cast_request_invalid_value_category.fail.cpp
@@ -22,6 +22,10 @@ struct TestType {};
using std::any;
using std::any_cast;
+// On platforms that do not support any_cast, an additional availability error
+// is triggered by these tests.
+// expected-error@any_cast_request_invalid_value_category.fail.cpp:* 0+ {{call to unavailable function 'any_cast': introduced in macOS 10.14}}
+
void test_const_lvalue_cast_request_non_const_lvalue()
{
const any a;
diff --git a/test/std/utilities/any/any.nonmembers/any.cast/const_correctness.fail.cpp b/test/std/utilities/any/any.nonmembers/any.cast/const_correctness.fail.cpp
index bad229dac8860..cb924499061d5 100644
--- a/test/std/utilities/any/any.nonmembers/any.cast/const_correctness.fail.cpp
+++ b/test/std/utilities/any/any.nonmembers/any.cast/const_correctness.fail.cpp
@@ -21,6 +21,10 @@
struct TestType {};
struct TestType2 {};
+// On platforms that do not support any_cast, an additional availability error
+// is triggered by these tests.
+// expected-error@const_correctness.fail.cpp:* 0+ {{call to unavailable function 'any_cast': introduced in macOS 10.14}}
+
int main()
{
using std::any;
diff --git a/test/std/utilities/any/any.nonmembers/any.cast/not_copy_constructible.fail.cpp b/test/std/utilities/any/any.nonmembers/any.cast/not_copy_constructible.fail.cpp
index 2d18cf4ba090e..e88deafce240f 100644
--- a/test/std/utilities/any/any.nonmembers/any.cast/not_copy_constructible.fail.cpp
+++ b/test/std/utilities/any/any.nonmembers/any.cast/not_copy_constructible.fail.cpp
@@ -40,6 +40,10 @@ struct no_move {
no_move(no_move const&) {}
};
+// On platforms that do not support any_cast, an additional availability error
+// is triggered by these tests.
+// expected-error@not_copy_constructible.fail.cpp:* 0+ {{call to unavailable function 'any_cast': introduced in macOS 10.14}}
+
int main() {
any a;
// expected-error-re@any:* {{static_assert failed{{.*}} "ValueType is required to be an lvalue reference or a CopyConstructible type"}}
diff --git a/test/std/utilities/any/any.nonmembers/make_any.pass.cpp b/test/std/utilities/any/any.nonmembers/make_any.pass.cpp
index 9850851fc6ed0..dad2973fbcb23 100644
--- a/test/std/utilities/any/any.nonmembers/make_any.pass.cpp
+++ b/test/std/utilities/any/any.nonmembers/make_any.pass.cpp
@@ -9,12 +9,13 @@
// UNSUPPORTED: c++98, c++03, c++11, c++14
-// XFAIL: with_system_cxx_lib=macosx10.12
-// XFAIL: with_system_cxx_lib=macosx10.11
-// XFAIL: with_system_cxx_lib=macosx10.10
-// XFAIL: with_system_cxx_lib=macosx10.9
-// XFAIL: with_system_cxx_lib=macosx10.7
-// XFAIL: with_system_cxx_lib=macosx10.8
+// XFAIL: availability=macosx10.13
+// XFAIL: availability=macosx10.12
+// XFAIL: availability=macosx10.11
+// XFAIL: availability=macosx10.10
+// XFAIL: availability=macosx10.9
+// XFAIL: availability=macosx10.8
+// XFAIL: availability=macosx10.7
// <any>
diff --git a/test/std/utilities/any/any.nonmembers/swap.pass.cpp b/test/std/utilities/any/any.nonmembers/swap.pass.cpp
index c723b6e08149f..a2a40d138a1d5 100644
--- a/test/std/utilities/any/any.nonmembers/swap.pass.cpp
+++ b/test/std/utilities/any/any.nonmembers/swap.pass.cpp
@@ -9,12 +9,13 @@
// UNSUPPORTED: c++98, c++03, c++11, c++14
-// XFAIL: with_system_cxx_lib=macosx10.12
-// XFAIL: with_system_cxx_lib=macosx10.11
-// XFAIL: with_system_cxx_lib=macosx10.10
-// XFAIL: with_system_cxx_lib=macosx10.9
-// XFAIL: with_system_cxx_lib=macosx10.7
-// XFAIL: with_system_cxx_lib=macosx10.8
+// XFAIL: availability=macosx10.13
+// XFAIL: availability=macosx10.12
+// XFAIL: availability=macosx10.11
+// XFAIL: availability=macosx10.10
+// XFAIL: availability=macosx10.9
+// XFAIL: availability=macosx10.8
+// XFAIL: availability=macosx10.7
// <any>
diff --git a/test/std/utilities/charconv/charconv.from.chars/integral.pass.cpp b/test/std/utilities/charconv/charconv.from.chars/integral.pass.cpp
index 3fc533a772fa8..7b08f3047f6c9 100644
--- a/test/std/utilities/charconv/charconv.from.chars/integral.pass.cpp
+++ b/test/std/utilities/charconv/charconv.from.chars/integral.pass.cpp
@@ -8,6 +8,16 @@
//===----------------------------------------------------------------------===//
// UNSUPPORTED: c++98, c++03, c++11
+
+// XFAIL: with_system_cxx_lib=macosx10.14
+// XFAIL: with_system_cxx_lib=macosx10.13
+// XFAIL: with_system_cxx_lib=macosx10.12
+// XFAIL: with_system_cxx_lib=macosx10.11
+// XFAIL: with_system_cxx_lib=macosx10.10
+// XFAIL: with_system_cxx_lib=macosx10.9
+// XFAIL: with_system_cxx_lib=macosx10.8
+// XFAIL: with_system_cxx_lib=macosx10.7
+
// <charconv>
// from_chars_result from_chars(const char* first, const char* last,
@@ -174,8 +184,7 @@ struct test_signed : roundtrip_test_base<T>
}
};
-int
-main()
+int main()
{
run<test_basics>(integrals);
run<test_signed>(all_signed);
diff --git a/test/std/utilities/charconv/charconv.to.chars/integral.pass.cpp b/test/std/utilities/charconv/charconv.to.chars/integral.pass.cpp
index 50ca5b1906ea4..63891b1ee8a5b 100644
--- a/test/std/utilities/charconv/charconv.to.chars/integral.pass.cpp
+++ b/test/std/utilities/charconv/charconv.to.chars/integral.pass.cpp
@@ -8,6 +8,16 @@
//===----------------------------------------------------------------------===//
// UNSUPPORTED: c++98, c++03, c++11
+
+// XFAIL: with_system_cxx_lib=macosx10.14
+// XFAIL: with_system_cxx_lib=macosx10.13
+// XFAIL: with_system_cxx_lib=macosx10.12
+// XFAIL: with_system_cxx_lib=macosx10.11
+// XFAIL: with_system_cxx_lib=macosx10.10
+// XFAIL: with_system_cxx_lib=macosx10.9
+// XFAIL: with_system_cxx_lib=macosx10.8
+// XFAIL: with_system_cxx_lib=macosx10.7
+
// <charconv>
// to_chars_result to_chars(char* first, char* last, Integral value,
@@ -72,8 +82,7 @@ struct test_signed : to_chars_test_base<T>
}
};
-int
-main()
+int main()
{
run<test_basics>(integrals);
run<test_signed>(all_signed);
diff --git a/test/std/utilities/function.objects/bind/func.bind/func.bind.bind/nested.pass.cpp b/test/std/utilities/function.objects/bind/func.bind/func.bind.bind/nested.pass.cpp
index 5b660da617a8f..ac43dd769ed68 100644
--- a/test/std/utilities/function.objects/bind/func.bind/func.bind.bind/nested.pass.cpp
+++ b/test/std/utilities/function.objects/bind/func.bind/func.bind.bind/nested.pass.cpp
@@ -42,8 +42,7 @@ struct plus_one
}
};
-int
-main()
+int main()
{
using std::placeholders::_1;
diff --git a/test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/copy_move.pass.cpp b/test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/copy_move.pass.cpp
index faf4f11573d1f..e9b399a2edd2c 100644
--- a/test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/copy_move.pass.cpp
+++ b/test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/copy_move.pass.cpp
@@ -12,7 +12,7 @@
// class function<R(ArgTypes...)>
// function(const function& f);
-// function(function&& f);
+// function(function&& f); // noexcept in C++20
#include <functional>
#include <memory>
@@ -109,6 +109,10 @@ int main()
assert(globalMemCounter.checkOutstandingNewEq(1));
assert(f.target<A>());
assert(f.target<int(*)(int)>() == 0);
+ LIBCPP_ASSERT_NOEXCEPT(std::function<int(int)>(std::move(f)));
+#if TEST_STD_VER > 17
+ ASSERT_NOEXCEPT(std::function<int(int)>(std::move(f)));
+#endif
std::function<int(int)> f2 = std::move(f);
assert(A::count == 1);
assert(globalMemCounter.checkOutstandingNewEq(1));
@@ -129,6 +133,10 @@ int main()
assert(A::count == 1);
assert(f.target<A>() == nullptr);
assert(f.target<Ref>());
+ LIBCPP_ASSERT_NOEXCEPT(std::function<int(int)>(std::move(f)));
+#if TEST_STD_VER > 17
+ ASSERT_NOEXCEPT(std::function<int(int)>(std::move(f)));
+#endif
std::function<int(int)> f2(std::move(f));
assert(A::count == 1);
assert(f2.target<A>() == nullptr);
@@ -144,6 +152,10 @@ int main()
std::function<int(int)> f(p);
assert(f.target<A>() == nullptr);
assert(f.target<Ptr>());
+ LIBCPP_ASSERT_NOEXCEPT(std::function<int(int)>(std::move(f)));
+#if TEST_STD_VER > 17
+ ASSERT_NOEXCEPT(std::function<int(int)>(std::move(f)));
+#endif
std::function<int(int)> f2(std::move(f));
assert(f2.target<A>() == nullptr);
assert(f2.target<Ptr>());
diff --git a/test/std/utilities/function.objects/negators/binary_negate.depr_in_cxx17.fail.cpp b/test/std/utilities/function.objects/negators/binary_negate.depr_in_cxx17.fail.cpp
new file mode 100644
index 0000000000000..c8247a1959174
--- /dev/null
+++ b/test/std/utilities/function.objects/negators/binary_negate.depr_in_cxx17.fail.cpp
@@ -0,0 +1,35 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <functional>
+
+// binary_negate
+// deprecated in C++17
+
+// UNSUPPORTED: clang-4.0
+// UNSUPPORTED: c++98, c++03, c++11, c++14
+// REQUIRES: verify-support
+
+// MODULES_DEFINES: _LIBCPP_ENABLE_DEPRECATION_WARNINGS
+#define _LIBCPP_ENABLE_DEPRECATION_WARNINGS
+
+#include <functional>
+
+#include "test_macros.h"
+
+struct Predicate {
+ typedef int first_argument_type;
+ typedef int second_argument_type;
+ bool operator()(first_argument_type, second_argument_type) const { return true; }
+};
+
+int main() {
+ std::binary_negate<Predicate> f((Predicate())); // expected-error{{'binary_negate<Predicate>' is deprecated}}
+ (void)f;
+}
diff --git a/test/std/utilities/function.objects/negators/not1.depr_in_cxx17.fail.cpp b/test/std/utilities/function.objects/negators/not1.depr_in_cxx17.fail.cpp
new file mode 100644
index 0000000000000..584d3ab0639fb
--- /dev/null
+++ b/test/std/utilities/function.objects/negators/not1.depr_in_cxx17.fail.cpp
@@ -0,0 +1,33 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <functional>
+
+// not1
+// deprecated in C++17
+
+// UNSUPPORTED: clang-4.0
+// UNSUPPORTED: c++98, c++03, c++11, c++14
+// REQUIRES: verify-support
+
+// MODULES_DEFINES: _LIBCPP_ENABLE_DEPRECATION_WARNINGS
+#define _LIBCPP_ENABLE_DEPRECATION_WARNINGS
+
+#include <functional>
+
+#include "test_macros.h"
+
+struct Predicate {
+ typedef int argument_type;
+ bool operator()(argument_type) const { return true; }
+};
+
+int main() {
+ std::not1(Predicate()); // expected-error{{'not1<Predicate>' is deprecated}}
+}
diff --git a/test/std/utilities/function.objects/negators/not2.depr_in_cxx17.fail.cpp b/test/std/utilities/function.objects/negators/not2.depr_in_cxx17.fail.cpp
new file mode 100644
index 0000000000000..92e3be580aff9
--- /dev/null
+++ b/test/std/utilities/function.objects/negators/not2.depr_in_cxx17.fail.cpp
@@ -0,0 +1,34 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <functional>
+
+// not2
+// deprecated in C++17
+
+// UNSUPPORTED: clang-4.0
+// UNSUPPORTED: c++98, c++03, c++11, c++14
+// REQUIRES: verify-support
+
+// MODULES_DEFINES: _LIBCPP_ENABLE_DEPRECATION_WARNINGS
+#define _LIBCPP_ENABLE_DEPRECATION_WARNINGS
+
+#include <functional>
+
+#include "test_macros.h"
+
+struct Predicate {
+ typedef int first_argument_type;
+ typedef int second_argument_type;
+ bool operator()(first_argument_type, second_argument_type) const { return true; }
+};
+
+int main() {
+ std::not2(Predicate()); // expected-error{{'not2<Predicate>' is deprecated}}
+}
diff --git a/test/std/utilities/function.objects/negators/unary_negate.depr_in_cxx17.fail.cpp b/test/std/utilities/function.objects/negators/unary_negate.depr_in_cxx17.fail.cpp
new file mode 100644
index 0000000000000..b38a7d2f1c094
--- /dev/null
+++ b/test/std/utilities/function.objects/negators/unary_negate.depr_in_cxx17.fail.cpp
@@ -0,0 +1,34 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <functional>
+
+// unary_negate
+// deprecated in C++17
+
+// UNSUPPORTED: clang-4.0
+// UNSUPPORTED: c++98, c++03, c++11, c++14
+// REQUIRES: verify-support
+
+// MODULES_DEFINES: _LIBCPP_ENABLE_DEPRECATION_WARNINGS
+#define _LIBCPP_ENABLE_DEPRECATION_WARNINGS
+
+#include <functional>
+
+#include "test_macros.h"
+
+struct Predicate {
+ typedef int argument_type;
+ bool operator()(argument_type) const { return true; }
+};
+
+int main() {
+ std::unary_negate<Predicate> f((Predicate())); // expected-error{{'unary_negate<Predicate>' is deprecated}}
+ (void)f;
+}
diff --git a/test/std/utilities/function.objects/refwrap/type_properties.pass.cpp b/test/std/utilities/function.objects/refwrap/type_properties.pass.cpp
index 261a306ca156e..27d498ec82829 100644
--- a/test/std/utilities/function.objects/refwrap/type_properties.pass.cpp
+++ b/test/std/utilities/function.objects/refwrap/type_properties.pass.cpp
@@ -11,11 +11,11 @@
// reference_wrapper
-// Test that reference wrapper meets the requirements of TriviallyCopyable,
-// CopyConstructible and CopyAssignable.
+// Test that reference wrapper meets the requirements of CopyConstructible and
+// CopyAssignable, and TriviallyCopyable (starting in C++14).
// Test fails due to use of is_trivially_* trait.
-// XFAIL: gcc-4.9
+// XFAIL: gcc-4.9 && c++14
#include <functional>
#include <type_traits>
@@ -48,8 +48,9 @@ void test()
typedef std::reference_wrapper<T> Wrap;
static_assert(std::is_copy_constructible<Wrap>::value, "");
static_assert(std::is_copy_assignable<Wrap>::value, "");
- // Extension up for standardization: See N4151.
+#if TEST_STD_VER >= 14
static_assert(std::is_trivially_copyable<Wrap>::value, "");
+#endif
}
int main()
diff --git a/test/std/utilities/function.objects/refwrap/unwrap_ref_decay.pass.cpp b/test/std/utilities/function.objects/refwrap/unwrap_ref_decay.pass.cpp
new file mode 100644
index 0000000000000..a63dc5b15f4bd
--- /dev/null
+++ b/test/std/utilities/function.objects/refwrap/unwrap_ref_decay.pass.cpp
@@ -0,0 +1,58 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <functional>
+//
+// template <class T>
+// struct unwrap_ref_decay;
+//
+// template <class T>
+// using unwrap_ref_decay_t = typename unwrap_ref_decay<T>::type;
+
+// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
+
+#include <functional>
+#include <type_traits>
+
+
+template <typename T, typename Result>
+void check() {
+ static_assert(std::is_same_v<typename std::unwrap_ref_decay<T>::type, Result>);
+ static_assert(std::is_same_v<typename std::unwrap_ref_decay<T>::type, std::unwrap_ref_decay_t<T>>);
+}
+
+struct T { };
+
+int main() {
+ check<T, T>();
+ check<T&, T>();
+ check<T const, T>();
+ check<T const&, T>();
+ check<T*, T*>();
+ check<T const*, T const*>();
+ check<T[3], T*>();
+ check<T const [3], T const*>();
+ check<T (), T (*)()>();
+ check<T (int) const, T (int) const>();
+ check<T (int) &, T (int) &>();
+ check<T (int) &&, T (int) &&>();
+
+ check<std::reference_wrapper<T>, T&>();
+ check<std::reference_wrapper<T>&, T&>();
+ check<std::reference_wrapper<T const>, T const&>();
+ check<std::reference_wrapper<T const>&, T const&>();
+ check<std::reference_wrapper<T*>, T*&>();
+ check<std::reference_wrapper<T*>&, T*&>();
+ check<std::reference_wrapper<T const*>, T const*&>();
+ check<std::reference_wrapper<T const*>&, T const*&>();
+ check<std::reference_wrapper<T[3]>, T (&)[3]>();
+ check<std::reference_wrapper<T[3]>&, T (&)[3]>();
+ check<std::reference_wrapper<T ()>, T (&)()>();
+ check<std::reference_wrapper<T ()>&, T (&)()>();
+}
diff --git a/test/std/utilities/function.objects/refwrap/unwrap_reference.pass.cpp b/test/std/utilities/function.objects/refwrap/unwrap_reference.pass.cpp
new file mode 100644
index 0000000000000..441ddf4bd568f
--- /dev/null
+++ b/test/std/utilities/function.objects/refwrap/unwrap_reference.pass.cpp
@@ -0,0 +1,51 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <functional>
+//
+// template <class T>
+// struct unwrap_reference;
+//
+// template <class T>
+// using unwrap_reference_t = typename unwrap_reference<T>::type;
+
+// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
+
+#include <functional>
+#include <type_traits>
+
+
+template <typename T, typename Expected>
+void check_equal() {
+ static_assert(std::is_same_v<typename std::unwrap_reference<T>::type, Expected>);
+ static_assert(std::is_same_v<typename std::unwrap_reference<T>::type, std::unwrap_reference_t<T>>);
+}
+
+template <typename T>
+void check() {
+ check_equal<T, T>();
+ check_equal<T&, T&>();
+ check_equal<T const, T const>();
+ check_equal<T const&, T const&>();
+
+ check_equal<std::reference_wrapper<T>, T&>();
+ check_equal<std::reference_wrapper<T const>, T const&>();
+}
+
+struct T { };
+
+int main() {
+ check<T>();
+ check<int>();
+ check<float>();
+
+ check<T*>();
+ check<int*>();
+ check<float*>();
+}
diff --git a/test/std/utilities/memory/allocator.traits/allocator.traits.members/destroy.pass.cpp b/test/std/utilities/memory/allocator.traits/allocator.traits.members/destroy.pass.cpp
index 1a812876bf0c2..1060b73434d7d 100644
--- a/test/std/utilities/memory/allocator.traits/allocator.traits.members/destroy.pass.cpp
+++ b/test/std/utilities/memory/allocator.traits/allocator.traits.members/destroy.pass.cpp
@@ -73,7 +73,7 @@ int main()
std::aligned_storage<sizeof(VT)>::type store;
std::allocator_traits<Alloc>::destroy(a, (VT*)&store);
}
-#if TEST_STD_VER >= 11
+#if defined(_LIBCPP_VERSION) || TEST_STD_VER >= 11
{
A0::count = 0;
b_destroy = 0;
diff --git a/test/std/utilities/memory/allocator.traits/allocator.traits.members/max_size.pass.cpp b/test/std/utilities/memory/allocator.traits/allocator.traits.members/max_size.pass.cpp
index 12c0d02227fad..7a2d76c6d6705 100644
--- a/test/std/utilities/memory/allocator.traits/allocator.traits.members/max_size.pass.cpp
+++ b/test/std/utilities/memory/allocator.traits/allocator.traits.members/max_size.pass.cpp
@@ -16,6 +16,7 @@
// ...
// };
+#include <limits>
#include <memory>
#include <new>
#include <type_traits>
diff --git a/test/std/utilities/memory/default.allocator/allocator.members/allocate.pass.cpp b/test/std/utilities/memory/default.allocator/allocator.members/allocate.pass.cpp
index 70c5e46965a0b..b53175376dd58 100644
--- a/test/std/utilities/memory/default.allocator/allocator.members/allocate.pass.cpp
+++ b/test/std/utilities/memory/default.allocator/allocator.members/allocate.pass.cpp
@@ -14,6 +14,7 @@
#include <memory>
#include <cassert>
+#include <cstddef> // for std::max_align_t
#include <iostream>
#include "test_macros.h"
diff --git a/test/std/utilities/memory/pointer.traits/pointer.traits.functions/pointer_to.pass.cpp b/test/std/utilities/memory/pointer.traits/pointer.traits.functions/pointer_to.pass.cpp
index a8ad936c9366f..85b15ea5b12b0 100644
--- a/test/std/utilities/memory/pointer.traits/pointer.traits.functions/pointer_to.pass.cpp
+++ b/test/std/utilities/memory/pointer.traits/pointer.traits.functions/pointer_to.pass.cpp
@@ -39,6 +39,7 @@ int main()
{
{
int i = 0;
+ static_assert((std::is_same<A<int>, decltype(std::pointer_traits<A<int> >::pointer_to(i))>::value), "");
A<int> a = std::pointer_traits<A<int> >::pointer_to(i);
assert(a.t_ == &i);
}
diff --git a/test/std/utilities/memory/pointer.traits/pointer_to.pass.cpp b/test/std/utilities/memory/pointer.traits/pointer_to.pass.cpp
index fc44d9d77a2f8..756f894296932 100644
--- a/test/std/utilities/memory/pointer.traits/pointer_to.pass.cpp
+++ b/test/std/utilities/memory/pointer.traits/pointer_to.pass.cpp
@@ -12,21 +12,33 @@
// template <class T>
// struct pointer_traits<T*>
// {
-// static pointer pointer_to(<details>);
+// static pointer pointer_to(<details>); // constexpr in C++20
// ...
// };
#include <memory>
#include <cassert>
+#include "test_macros.h"
-int main()
-{
+#if TEST_STD_VER > 17
+constexpr
+#endif
+bool check() {
{
int i = 0;
+ static_assert((std::is_same<int *, decltype(std::pointer_traits<int*>::pointer_to(i))>::value), "");
int* a = std::pointer_traits<int*>::pointer_to(i);
assert(a == &i);
}
{
(std::pointer_traits<void*>::element_type)0;
}
+ return true;
+}
+
+int main() {
+ check();
+#if TEST_STD_VER > 17
+ static_assert(check(), "");
+#endif
}
diff --git a/test/std/utilities/memory/storage.iterator/raw_storage_iterator.base.pass.cpp b/test/std/utilities/memory/storage.iterator/raw_storage_iterator.base.pass.cpp
index 62a3be80d8b60..eb66ed4ad47b9 100644
--- a/test/std/utilities/memory/storage.iterator/raw_storage_iterator.base.pass.cpp
+++ b/test/std/utilities/memory/storage.iterator/raw_storage_iterator.base.pass.cpp
@@ -15,6 +15,13 @@
#include "test_macros.h"
+#if TEST_STD_VER >= 11
+#define DELETE_FUNCTION = delete
+#else
+#define DELETE_FUNCTION
+#endif
+
+
int A_constructed = 0;
struct A
@@ -27,6 +34,7 @@ public:
~A() {--A_constructed; data_ = 0;}
bool operator==(int i) const {return data_ == i;}
+ A* operator& () DELETE_FUNCTION;
};
int main()
diff --git a/test/std/utilities/memory/storage.iterator/raw_storage_iterator.pass.cpp b/test/std/utilities/memory/storage.iterator/raw_storage_iterator.pass.cpp
index 3df8dd0eded0e..4d9d698f74208 100644
--- a/test/std/utilities/memory/storage.iterator/raw_storage_iterator.pass.cpp
+++ b/test/std/utilities/memory/storage.iterator/raw_storage_iterator.pass.cpp
@@ -16,6 +16,12 @@
#include "test_macros.h"
#include <MoveOnly.h>
+#if TEST_STD_VER >= 11
+#define DELETE_FUNCTION = delete
+#else
+#define DELETE_FUNCTION
+#endif
+
int A_constructed = 0;
struct A
@@ -28,6 +34,7 @@ public:
~A() {--A_constructed; data_ = 0;}
bool operator==(int i) const {return data_ == i;}
+ A* operator& () DELETE_FUNCTION;
};
int main()
diff --git a/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.create/allocate_shared.pass.cpp b/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.create/allocate_shared.pass.cpp
index 3e4a99e981d46..a430b5d796e20 100644
--- a/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.create/allocate_shared.pass.cpp
+++ b/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.create/allocate_shared.pass.cpp
@@ -23,6 +23,12 @@
#include "test_allocator.h"
#include "min_allocator.h"
+#if TEST_STD_VER >= 11
+#define DELETE_FUNCTION = delete
+#else
+#define DELETE_FUNCTION
+#endif
+
int new_count = 0;
struct A
@@ -37,6 +43,8 @@ struct A
int get_int() const {return int_;}
char get_char() const {return char_;}
+
+ A* operator& () DELETE_FUNCTION;
private:
int int_;
char char_;
diff --git a/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.create/make_shared.pass.cpp b/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.create/make_shared.pass.cpp
index f8f73f771356e..88e6919526f99 100644
--- a/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.create/make_shared.pass.cpp
+++ b/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.create/make_shared.pass.cpp
@@ -19,6 +19,12 @@
#include "test_macros.h"
#include "count_new.hpp"
+#if TEST_STD_VER >= 11
+#define DELETE_FUNCTION = delete
+#else
+#define DELETE_FUNCTION
+#endif
+
struct A
{
static int count;
@@ -31,6 +37,9 @@ struct A
int get_int() const {return int_;}
char get_char() const {return char_;}
+
+ A* operator& () DELETE_FUNCTION;
+
private:
int int_;
char char_;
diff --git a/test/std/utilities/meta/meta.trans/meta.trans.other/aligned_storage.pass.cpp b/test/std/utilities/meta/meta.trans/meta.trans.other/aligned_storage.pass.cpp
index d7e35a62f8f0e..012741ff6c7d9 100644
--- a/test/std/utilities/meta/meta.trans/meta.trans.other/aligned_storage.pass.cpp
+++ b/test/std/utilities/meta/meta.trans/meta.trans.other/aligned_storage.pass.cpp
@@ -254,9 +254,6 @@ int main()
// Use alignof(std::max_align_t) below to find the max alignment instead of
// hardcoding it, because it's different on different platforms.
// (For example 8 on arm and 16 on x86.)
-#if TEST_STD_VER < 11
-#define alignof __alignof__
-#endif
{
typedef std::aligned_storage<16>::type T1;
#if TEST_STD_VER > 11
@@ -264,7 +261,7 @@ int main()
#endif
static_assert(std::is_trivial<T1>::value, "");
static_assert(std::is_standard_layout<T1>::value, "");
- static_assert(std::alignment_of<T1>::value == alignof(std::max_align_t),
+ static_assert(std::alignment_of<T1>::value == TEST_ALIGNOF(std::max_align_t),
"");
static_assert(sizeof(T1) == 16, "");
}
@@ -275,9 +272,9 @@ int main()
#endif
static_assert(std::is_trivial<T1>::value, "");
static_assert(std::is_standard_layout<T1>::value, "");
- static_assert(std::alignment_of<T1>::value == alignof(std::max_align_t),
+ static_assert(std::alignment_of<T1>::value == TEST_ALIGNOF(std::max_align_t),
"");
- static_assert(sizeof(T1) == 16 + alignof(std::max_align_t), "");
+ static_assert(sizeof(T1) == 16 + TEST_ALIGNOF(std::max_align_t), "");
}
{
typedef std::aligned_storage<10>::type T1;
diff --git a/test/std/utilities/meta/meta.trans/meta.trans.other/type_identity.pass.cpp b/test/std/utilities/meta/meta.trans/meta.trans.other/type_identity.pass.cpp
new file mode 100644
index 0000000000000..079986685a135
--- /dev/null
+++ b/test/std/utilities/meta/meta.trans/meta.trans.other/type_identity.pass.cpp
@@ -0,0 +1,40 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
+
+// type_traits
+
+// type_identity
+
+#include <type_traits>
+
+#include "test_macros.h"
+
+template <class T>
+void test_type_identity()
+{
+ static_assert((std::is_same<typename std::type_identity<T>::type, T>::value), "");
+ static_assert((std::is_same< std::type_identity_t<T>, T>::value), "");
+}
+
+int main()
+{
+ test_type_identity<void>();
+ test_type_identity<int>();
+ test_type_identity<const volatile int>();
+ test_type_identity<int*>();
+ test_type_identity< int[3]>();
+ test_type_identity<const int[3]>();
+
+ test_type_identity<void (*)()>();
+ test_type_identity<int(int) const>();
+ test_type_identity<int(int) volatile>();
+ test_type_identity<int(int) &>();
+ test_type_identity<int(int) &&>();
+}
diff --git a/test/std/utilities/meta/meta.type.synop/endian.pass.cpp b/test/std/utilities/meta/meta.type.synop/endian.pass.cpp
index cf0ab2d26390e..865c477e73283 100644
--- a/test/std/utilities/meta/meta.type.synop/endian.pass.cpp
+++ b/test/std/utilities/meta/meta.type.synop/endian.pass.cpp
@@ -19,7 +19,6 @@
#include "test_macros.h"
int main() {
- typedef std::endian E;
static_assert(std::is_enum<std::endian>::value, "");
// Check that E is a scoped enum by checking for conversions.
diff --git a/test/std/utilities/meta/meta.unary.prop.query/alignment_of.pass.cpp b/test/std/utilities/meta/meta.unary.prop.query/alignment_of.pass.cpp
index 0f55db64719b8..bd02da96978d9 100644
--- a/test/std/utilities/meta/meta.unary.prop.query/alignment_of.pass.cpp
+++ b/test/std/utilities/meta/meta.unary.prop.query/alignment_of.pass.cpp
@@ -19,6 +19,9 @@
template <class T, unsigned A>
void test_alignment_of()
{
+ const unsigned AlignofResult = TEST_ALIGNOF(T);
+ static_assert( AlignofResult == A, "Golden value does not match result of alignof keyword");
+ static_assert( std::alignment_of<T>::value == AlignofResult, "");
static_assert( std::alignment_of<T>::value == A, "");
static_assert( std::alignment_of<const T>::value == A, "");
static_assert( std::alignment_of<volatile T>::value == A, "");
@@ -45,7 +48,10 @@ int main()
test_alignment_of<const int*, sizeof(intptr_t)>();
test_alignment_of<char[3], 1>();
test_alignment_of<int, 4>();
- test_alignment_of<double, 8>();
+ // The test case below is a hack. It's hard to detect what golden value
+ // we should expect. In most cases it should be 8. But in i386 builds
+ // with Clang >= 8 or GCC >= 8 the value is '4'.
+ test_alignment_of<double, TEST_ALIGNOF(double)>();
#if (defined(__ppc__) && !defined(__ppc64__))
test_alignment_of<bool, 4>(); // 32-bit PPC has four byte bool
#else
diff --git a/test/std/utilities/meta/meta.unary/meta.unary.cat/is_integral.pass.cpp b/test/std/utilities/meta/meta.unary/meta.unary.cat/is_integral.pass.cpp
index 09997626ea06d..85c2c98173d92 100644
--- a/test/std/utilities/meta/meta.unary/meta.unary.cat/is_integral.pass.cpp
+++ b/test/std/utilities/meta/meta.unary/meta.unary.cat/is_integral.pass.cpp
@@ -85,6 +85,9 @@ int main()
test_is_integral<signed char>();
test_is_integral<unsigned char>();
test_is_integral<wchar_t>();
+#if defined(__cpp_lib_char8_t) && __cpp_lib_char8_t >= 201811L
+ test_is_integral<char8_t>();
+#endif
test_is_not_integral<std::nullptr_t>();
test_is_not_integral<void>();
diff --git a/test/std/utilities/meta/meta.unary/meta.unary.prop/is_nothrow_default_constructible.pass.cpp b/test/std/utilities/meta/meta.unary/meta.unary.prop/is_nothrow_default_constructible.pass.cpp
index c89ac8944a932..9484b321c95c8 100644
--- a/test/std/utilities/meta/meta.unary/meta.unary.prop/is_nothrow_default_constructible.pass.cpp
+++ b/test/std/utilities/meta/meta.unary/meta.unary.prop/is_nothrow_default_constructible.pass.cpp
@@ -60,11 +60,22 @@ struct A
A();
};
+#if TEST_STD_VER >= 11
+struct DThrows
+{
+ DThrows() noexcept(true) {}
+ ~DThrows() noexcept(false) {}
+};
+#endif
+
int main()
{
test_has_not_nothrow_default_constructor<void>();
test_has_not_nothrow_default_constructor<int&>();
test_has_not_nothrow_default_constructor<A>();
+#if TEST_STD_VER >= 11
+ test_has_not_nothrow_default_constructor<DThrows>(); // This is LWG2116
+#endif
test_is_nothrow_default_constructible<Union>();
test_is_nothrow_default_constructible<Empty>();
diff --git a/test/std/utilities/optional/optional.bad_optional_access/default.pass.cpp b/test/std/utilities/optional/optional.bad_optional_access/default.pass.cpp
index 198eee62bbba1..8a73083487c0f 100644
--- a/test/std/utilities/optional/optional.bad_optional_access/default.pass.cpp
+++ b/test/std/utilities/optional/optional.bad_optional_access/default.pass.cpp
@@ -9,12 +9,13 @@
// UNSUPPORTED: c++98, c++03, c++11, c++14
-// XFAIL: with_system_cxx_lib=macosx10.12
-// XFAIL: with_system_cxx_lib=macosx10.11
-// XFAIL: with_system_cxx_lib=macosx10.10
-// XFAIL: with_system_cxx_lib=macosx10.9
-// XFAIL: with_system_cxx_lib=macosx10.7
-// XFAIL: with_system_cxx_lib=macosx10.8
+// XFAIL: availability=macosx10.13
+// XFAIL: availability=macosx10.12
+// XFAIL: availability=macosx10.11
+// XFAIL: availability=macosx10.10
+// XFAIL: availability=macosx10.9
+// XFAIL: availability=macosx10.7
+// XFAIL: availability=macosx10.8
// <optional>
diff --git a/test/std/utilities/optional/optional.bad_optional_access/derive.pass.cpp b/test/std/utilities/optional/optional.bad_optional_access/derive.pass.cpp
index d96f70bb7ba45..930015a7373f4 100644
--- a/test/std/utilities/optional/optional.bad_optional_access/derive.pass.cpp
+++ b/test/std/utilities/optional/optional.bad_optional_access/derive.pass.cpp
@@ -9,6 +9,14 @@
// UNSUPPORTED: c++98, c++03, c++11, c++14
+// XFAIL: availability=macosx10.13
+// XFAIL: availability=macosx10.12
+// XFAIL: availability=macosx10.11
+// XFAIL: availability=macosx10.10
+// XFAIL: availability=macosx10.9
+// XFAIL: availability=macosx10.8
+// XFAIL: availability=macosx10.7
+
// <optional>
// class bad_optional_access : public exception
diff --git a/test/std/utilities/optional/optional.object/optional.object.assign/copy.pass.cpp b/test/std/utilities/optional/optional.object/optional.object.assign/copy.pass.cpp
index 98c90aa1d4fb8..bec0f09a3e9a5 100644
--- a/test/std/utilities/optional/optional.object/optional.object.assign/copy.pass.cpp
+++ b/test/std/utilities/optional/optional.object/optional.object.assign/copy.pass.cpp
@@ -10,7 +10,7 @@
// UNSUPPORTED: c++98, c++03, c++11, c++14
// <optional>
-// optional<T>& operator=(const optional<T>& rhs);
+// optional<T>& operator=(const optional<T>& rhs); // constexpr in C++20
#include <optional>
#include <type_traits>
@@ -53,15 +53,19 @@ int main()
{
{
using O = optional<int>;
+#if TEST_STD_VER > 17
LIBCPP_STATIC_ASSERT(assign_empty(O{42}), "");
LIBCPP_STATIC_ASSERT(assign_value(O{42}), "");
+#endif
assert(assign_empty(O{42}));
assert(assign_value(O{42}));
}
{
using O = optional<TrivialTestTypes::TestType>;
+#if TEST_STD_VER > 17
LIBCPP_STATIC_ASSERT(assign_empty(O{42}), "");
LIBCPP_STATIC_ASSERT(assign_value(O{42}), "");
+#endif
assert(assign_empty(O{42}));
assert(assign_value(O{42}));
}
diff --git a/test/std/utilities/optional/optional.object/optional.object.assign/move.pass.cpp b/test/std/utilities/optional/optional.object/optional.object.assign/move.pass.cpp
index ed8b433da6933..c41674f13cf2f 100644
--- a/test/std/utilities/optional/optional.object/optional.object.assign/move.pass.cpp
+++ b/test/std/utilities/optional/optional.object/optional.object.assign/move.pass.cpp
@@ -12,11 +12,12 @@
// optional<T>& operator=(optional<T>&& rhs)
// noexcept(is_nothrow_move_assignable<T>::value &&
-// is_nothrow_move_constructible<T>::value);
+// is_nothrow_move_constructible<T>::value); // constexpr in C++20
#include <optional>
-#include <type_traits>
#include <cassert>
+#include <type_traits>
+#include <utility>
#include "test_macros.h"
#include "archetypes.hpp"
@@ -51,6 +52,21 @@ struct Y {};
bool X::throw_now = false;
int X::alive = 0;
+
+template <class Tp>
+constexpr bool assign_empty(optional<Tp>&& lhs) {
+ optional<Tp> rhs;
+ lhs = std::move(rhs);
+ return !lhs.has_value() && !rhs.has_value();
+}
+
+template <class Tp>
+constexpr bool assign_value(optional<Tp>&& lhs) {
+ optional<Tp> rhs(101);
+ lhs = std::move(rhs);
+ return lhs.has_value() && rhs.has_value() && *lhs == Tp{101};
+}
+
int main()
{
{
@@ -97,6 +113,24 @@ int main()
assert(static_cast<bool>(opt) == static_cast<bool>(opt2));
assert(*opt == *opt2);
}
+ {
+ using O = optional<int>;
+#if TEST_STD_VER > 17
+ LIBCPP_STATIC_ASSERT(assign_empty(O{42}), "");
+ LIBCPP_STATIC_ASSERT(assign_value(O{42}), "");
+#endif
+ assert(assign_empty(O{42}));
+ assert(assign_value(O{42}));
+ }
+ {
+ using O = optional<TrivialTestTypes::TestType>;
+#if TEST_STD_VER > 17
+ LIBCPP_STATIC_ASSERT(assign_empty(O{42}), "");
+ LIBCPP_STATIC_ASSERT(assign_value(O{42}), "");
+#endif
+ assert(assign_empty(O{42}));
+ assert(assign_value(O{42}));
+ }
#ifndef TEST_HAS_NO_EXCEPTIONS
{
static_assert(!std::is_nothrow_move_assignable<optional<X>>::value, "");
diff --git a/test/std/utilities/optional/optional.object/optional.object.ctor/U.pass.cpp b/test/std/utilities/optional/optional.object/optional.object.ctor/U.pass.cpp
index e4e4a979ed025..f1e9a1cfd9fad 100644
--- a/test/std/utilities/optional/optional.object/optional.object.ctor/U.pass.cpp
+++ b/test/std/utilities/optional/optional.object/optional.object.ctor/U.pass.cpp
@@ -9,12 +9,13 @@
//
// UNSUPPORTED: c++98, c++03, c++11, c++14
-// XFAIL: with_system_cxx_lib=macosx10.12
-// XFAIL: with_system_cxx_lib=macosx10.11
-// XFAIL: with_system_cxx_lib=macosx10.10
-// XFAIL: with_system_cxx_lib=macosx10.9
-// XFAIL: with_system_cxx_lib=macosx10.7
-// XFAIL: with_system_cxx_lib=macosx10.8
+// XFAIL: availability=macosx10.13
+// XFAIL: availability=macosx10.12
+// XFAIL: availability=macosx10.11
+// XFAIL: availability=macosx10.10
+// XFAIL: availability=macosx10.9
+// XFAIL: availability=macosx10.8
+// XFAIL: availability=macosx10.7
// <optional>
diff --git a/test/std/utilities/optional/optional.object/optional.object.ctor/const_T.pass.cpp b/test/std/utilities/optional/optional.object/optional.object.ctor/const_T.pass.cpp
index e9e98c0bdac6f..ee0dcfd77da41 100644
--- a/test/std/utilities/optional/optional.object/optional.object.ctor/const_T.pass.cpp
+++ b/test/std/utilities/optional/optional.object/optional.object.ctor/const_T.pass.cpp
@@ -9,12 +9,13 @@
//
// UNSUPPORTED: c++98, c++03, c++11, c++14
-// XFAIL: with_system_cxx_lib=macosx10.12
-// XFAIL: with_system_cxx_lib=macosx10.11
-// XFAIL: with_system_cxx_lib=macosx10.10
-// XFAIL: with_system_cxx_lib=macosx10.9
-// XFAIL: with_system_cxx_lib=macosx10.7
-// XFAIL: with_system_cxx_lib=macosx10.8
+// XFAIL: availability=macosx10.13
+// XFAIL: availability=macosx10.12
+// XFAIL: availability=macosx10.11
+// XFAIL: availability=macosx10.10
+// XFAIL: availability=macosx10.9
+// XFAIL: availability=macosx10.8
+// XFAIL: availability=macosx10.7
// <optional>
diff --git a/test/std/utilities/optional/optional.object/optional.object.ctor/copy.fail.cpp b/test/std/utilities/optional/optional.object/optional.object.ctor/copy.fail.cpp
deleted file mode 100644
index 77e411b2e3b5d..0000000000000
--- a/test/std/utilities/optional/optional.object/optional.object.ctor/copy.fail.cpp
+++ /dev/null
@@ -1,36 +0,0 @@
-//===----------------------------------------------------------------------===//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file is dual licensed under the MIT and the University of Illinois Open
-// Source Licenses. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-
-// UNSUPPORTED: c++98, c++03, c++11, c++14
-// <optional>
-
-// constexpr optional(const optional<T>& rhs);
-// If is_trivially_copy_constructible_v<T> is true,
-// this constructor shall be a constexpr constructor.
-
-#include <optional>
-#include <type_traits>
-#include <cassert>
-
-#include "test_macros.h"
-
-struct S {
- constexpr S() : v_(0) {}
- S(int v) : v_(v) {}
- S(const S &rhs) : v_(rhs.v_) {} // make it not trivially copyable
- int v_;
- };
-
-
-int main()
-{
- static_assert (!std::is_trivially_copy_constructible_v<S>, "" );
- constexpr std::optional<S> o1;
- constexpr std::optional<S> o2 = o1; // not constexpr
-}
diff --git a/test/std/utilities/optional/optional.object/optional.object.ctor/copy.pass.cpp b/test/std/utilities/optional/optional.object/optional.object.ctor/copy.pass.cpp
index 0f1fabd0cebbf..31e7f9fdb54d0 100644
--- a/test/std/utilities/optional/optional.object/optional.object.ctor/copy.pass.cpp
+++ b/test/std/utilities/optional/optional.object/optional.object.ctor/copy.pass.cpp
@@ -166,8 +166,8 @@ int main()
test_reference_extension();
}
{
- constexpr std::optional<int> o1{4};
- constexpr std::optional<int> o2 = o1;
- static_assert( *o2 == 4, "" );
+ constexpr std::optional<int> o1{4};
+ constexpr std::optional<int> o2 = o1;
+ static_assert( *o2 == 4, "" );
}
}
diff --git a/test/std/utilities/optional/optional.object/optional.object.ctor/move.pass.cpp b/test/std/utilities/optional/optional.object/optional.object.ctor/move.pass.cpp
index e73f3747c4350..cb084ecd92424 100644
--- a/test/std/utilities/optional/optional.object/optional.object.ctor/move.pass.cpp
+++ b/test/std/utilities/optional/optional.object/optional.object.ctor/move.pass.cpp
@@ -9,12 +9,13 @@
// UNSUPPORTED: c++98, c++03, c++11, c++14
-// XFAIL: with_system_cxx_lib=macosx10.12
-// XFAIL: with_system_cxx_lib=macosx10.11
-// XFAIL: with_system_cxx_lib=macosx10.10
-// XFAIL: with_system_cxx_lib=macosx10.9
-// XFAIL: with_system_cxx_lib=macosx10.7
-// XFAIL: with_system_cxx_lib=macosx10.8
+// XFAIL: availability=macosx10.13
+// XFAIL: availability=macosx10.12
+// XFAIL: availability=macosx10.11
+// XFAIL: availability=macosx10.10
+// XFAIL: availability=macosx10.9
+// XFAIL: availability=macosx10.8
+// XFAIL: availability=macosx10.7
// <optional>
diff --git a/test/std/utilities/optional/optional.object/optional.object.ctor/rvalue_T.pass.cpp b/test/std/utilities/optional/optional.object/optional.object.ctor/rvalue_T.pass.cpp
index 761cbee4b895a..f8a98508acb5d 100644
--- a/test/std/utilities/optional/optional.object/optional.object.ctor/rvalue_T.pass.cpp
+++ b/test/std/utilities/optional/optional.object/optional.object.ctor/rvalue_T.pass.cpp
@@ -9,12 +9,13 @@
//
// UNSUPPORTED: c++98, c++03, c++11, c++14
-// XFAIL: with_system_cxx_lib=macosx10.12
-// XFAIL: with_system_cxx_lib=macosx10.11
-// XFAIL: with_system_cxx_lib=macosx10.10
-// XFAIL: with_system_cxx_lib=macosx10.9
-// XFAIL: with_system_cxx_lib=macosx10.7
-// XFAIL: with_system_cxx_lib=macosx10.8
+// XFAIL: availability=macosx10.13
+// XFAIL: availability=macosx10.12
+// XFAIL: availability=macosx10.11
+// XFAIL: availability=macosx10.10
+// XFAIL: availability=macosx10.9
+// XFAIL: availability=macosx10.8
+// XFAIL: availability=macosx10.7
// <optional>
diff --git a/test/std/utilities/optional/optional.object/optional.object.observe/value.pass.cpp b/test/std/utilities/optional/optional.object/optional.object.observe/value.pass.cpp
index bbc70014f0997..f25bf71daf4b3 100644
--- a/test/std/utilities/optional/optional.object/optional.object.observe/value.pass.cpp
+++ b/test/std/utilities/optional/optional.object/optional.object.observe/value.pass.cpp
@@ -9,12 +9,13 @@
// UNSUPPORTED: c++98, c++03, c++11, c++14
-// XFAIL: with_system_cxx_lib=macosx10.12
-// XFAIL: with_system_cxx_lib=macosx10.11
-// XFAIL: with_system_cxx_lib=macosx10.10
-// XFAIL: with_system_cxx_lib=macosx10.9
-// XFAIL: with_system_cxx_lib=macosx10.7
-// XFAIL: with_system_cxx_lib=macosx10.8
+// XFAIL: availability=macosx10.13
+// XFAIL: availability=macosx10.12
+// XFAIL: availability=macosx10.11
+// XFAIL: availability=macosx10.10
+// XFAIL: availability=macosx10.9
+// XFAIL: availability=macosx10.8
+// XFAIL: availability=macosx10.7
// <optional>
diff --git a/test/std/utilities/optional/optional.object/optional.object.observe/value_const.pass.cpp b/test/std/utilities/optional/optional.object/optional.object.observe/value_const.pass.cpp
index c644fb9d6696d..00f934d6ae128 100644
--- a/test/std/utilities/optional/optional.object/optional.object.observe/value_const.pass.cpp
+++ b/test/std/utilities/optional/optional.object/optional.object.observe/value_const.pass.cpp
@@ -9,12 +9,13 @@
// UNSUPPORTED: c++98, c++03, c++11, c++14
-// XFAIL: with_system_cxx_lib=macosx10.12
-// XFAIL: with_system_cxx_lib=macosx10.11
-// XFAIL: with_system_cxx_lib=macosx10.10
-// XFAIL: with_system_cxx_lib=macosx10.9
-// XFAIL: with_system_cxx_lib=macosx10.7
-// XFAIL: with_system_cxx_lib=macosx10.8
+// XFAIL: availability=macosx10.13
+// XFAIL: availability=macosx10.12
+// XFAIL: availability=macosx10.11
+// XFAIL: availability=macosx10.10
+// XFAIL: availability=macosx10.9
+// XFAIL: availability=macosx10.8
+// XFAIL: availability=macosx10.7
// <optional>
diff --git a/test/std/utilities/optional/optional.object/optional.object.observe/value_const_rvalue.pass.cpp b/test/std/utilities/optional/optional.object/optional.object.observe/value_const_rvalue.pass.cpp
index 5347d3f558bb3..90e8fb4565a06 100644
--- a/test/std/utilities/optional/optional.object/optional.object.observe/value_const_rvalue.pass.cpp
+++ b/test/std/utilities/optional/optional.object/optional.object.observe/value_const_rvalue.pass.cpp
@@ -9,12 +9,13 @@
// UNSUPPORTED: c++98, c++03, c++11, c++14
-// XFAIL: with_system_cxx_lib=macosx10.12
-// XFAIL: with_system_cxx_lib=macosx10.11
-// XFAIL: with_system_cxx_lib=macosx10.10
-// XFAIL: with_system_cxx_lib=macosx10.9
-// XFAIL: with_system_cxx_lib=macosx10.7
-// XFAIL: with_system_cxx_lib=macosx10.8
+// XFAIL: availability=macosx10.13
+// XFAIL: availability=macosx10.12
+// XFAIL: availability=macosx10.11
+// XFAIL: availability=macosx10.10
+// XFAIL: availability=macosx10.9
+// XFAIL: availability=macosx10.8
+// XFAIL: availability=macosx10.7
// <optional>
diff --git a/test/std/utilities/optional/optional.object/optional.object.observe/value_rvalue.pass.cpp b/test/std/utilities/optional/optional.object/optional.object.observe/value_rvalue.pass.cpp
index 1a577e68b99e3..a63e3be8e4f6e 100644
--- a/test/std/utilities/optional/optional.object/optional.object.observe/value_rvalue.pass.cpp
+++ b/test/std/utilities/optional/optional.object/optional.object.observe/value_rvalue.pass.cpp
@@ -10,12 +10,13 @@
// UNSUPPORTED: c++98, c++03, c++11, c++14
// <optional>
-// XFAIL: with_system_cxx_lib=macosx10.12
-// XFAIL: with_system_cxx_lib=macosx10.11
-// XFAIL: with_system_cxx_lib=macosx10.10
-// XFAIL: with_system_cxx_lib=macosx10.9
-// XFAIL: with_system_cxx_lib=macosx10.7
-// XFAIL: with_system_cxx_lib=macosx10.8
+// XFAIL: availability=macosx10.13
+// XFAIL: availability=macosx10.12
+// XFAIL: availability=macosx10.11
+// XFAIL: availability=macosx10.10
+// XFAIL: availability=macosx10.9
+// XFAIL: availability=macosx10.8
+// XFAIL: availability=macosx10.7
// constexpr T& optional<T>::value() &&;
diff --git a/test/std/utilities/optional/optional.object/special_members.pass.cpp b/test/std/utilities/optional/optional.object/special_members.pass.cpp
new file mode 100644
index 0000000000000..3bc561cfea3f9
--- /dev/null
+++ b/test/std/utilities/optional/optional.object/special_members.pass.cpp
@@ -0,0 +1,63 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++98, c++03, c++11, c++14
+
+// <optional>
+
+// Make sure we properly generate special member functions for optional<T>
+// based on the properties of T itself.
+
+#include <optional>
+#include <type_traits>
+
+#include "archetypes.hpp"
+
+
+template <class T>
+struct SpecialMemberTest {
+ using O = std::optional<T>;
+
+ static_assert(std::is_default_constructible_v<O>,
+ "optional is always default constructible.");
+
+ static_assert(std::is_copy_constructible_v<O> == std::is_copy_constructible_v<T>,
+ "optional<T> is copy constructible if and only if T is copy constructible.");
+
+ static_assert(std::is_move_constructible_v<O> ==
+ (std::is_copy_constructible_v<T> || std::is_move_constructible_v<T>),
+ "optional<T> is move constructible if and only if T is copy or move constructible.");
+
+ static_assert(std::is_copy_assignable_v<O> ==
+ (std::is_copy_constructible_v<T> && std::is_copy_assignable_v<T>),
+ "optional<T> is copy assignable if and only if T is both copy "
+ "constructible and copy assignable.");
+
+ static_assert(std::is_move_assignable_v<O> ==
+ ((std::is_move_constructible_v<T> && std::is_move_assignable_v<T>) ||
+ (std::is_copy_constructible_v<T> && std::is_copy_assignable_v<T>)),
+ "optional<T> is move assignable if and only if T is both move constructible and "
+ "move assignable, or both copy constructible and copy assignable.");
+};
+
+template <class ...Args> static void sink(Args&&...) {}
+
+template <class ...TestTypes>
+struct DoTestsMetafunction {
+ DoTestsMetafunction() { sink(SpecialMemberTest<TestTypes>{}...); }
+};
+
+int main() {
+ sink(
+ ImplicitTypes::ApplyTypes<DoTestsMetafunction>{},
+ ExplicitTypes::ApplyTypes<DoTestsMetafunction>{},
+ NonLiteralTypes::ApplyTypes<DoTestsMetafunction>{},
+ NonTrivialTypes::ApplyTypes<DoTestsMetafunction>{}
+ );
+}
diff --git a/test/std/utilities/optional/optional.object/triviality.pass.cpp b/test/std/utilities/optional/optional.object/triviality.pass.cpp
new file mode 100644
index 0000000000000..c21c85aad962b
--- /dev/null
+++ b/test/std/utilities/optional/optional.object/triviality.pass.cpp
@@ -0,0 +1,97 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
+
+// <optional>
+
+// The following special member functions should propagate the triviality of
+// the element held in the optional (see P0602R4):
+//
+// constexpr optional(const optional& rhs);
+// constexpr optional(optional&& rhs) noexcept(see below);
+// constexpr optional<T>& operator=(const optional& rhs);
+// constexpr optional<T>& operator=(optional&& rhs) noexcept(see below);
+
+
+#include <optional>
+#include <type_traits>
+
+#include "archetypes.hpp"
+
+
+constexpr bool implies(bool p, bool q) {
+ return !p || q;
+}
+
+template <class T>
+struct SpecialMemberTest {
+ using O = std::optional<T>;
+
+ static_assert(implies(std::is_trivially_copy_constructible_v<T>,
+ std::is_trivially_copy_constructible_v<O>),
+ "optional<T> is trivially copy constructible if T is trivially copy constructible.");
+
+ static_assert(implies(std::is_trivially_move_constructible_v<T>,
+ std::is_trivially_move_constructible_v<O>),
+ "optional<T> is trivially move constructible if T is trivially move constructible");
+
+ static_assert(implies(std::is_trivially_copy_constructible_v<T> &&
+ std::is_trivially_copy_assignable_v<T> &&
+ std::is_trivially_destructible_v<T>,
+
+ std::is_trivially_copy_assignable_v<O>),
+ "optional<T> is trivially copy assignable if T is "
+ "trivially copy constructible, "
+ "trivially copy assignable, and "
+ "trivially destructible");
+
+ static_assert(implies(std::is_trivially_move_constructible_v<T> &&
+ std::is_trivially_move_assignable_v<T> &&
+ std::is_trivially_destructible_v<T>,
+
+ std::is_trivially_move_assignable_v<O>),
+ "optional<T> is trivially move assignable if T is "
+ "trivially move constructible, "
+ "trivially move assignable, and"
+ "trivially destructible.");
+};
+
+template <class ...Args> static void sink(Args&&...) {}
+
+template <class ...TestTypes>
+struct DoTestsMetafunction {
+ DoTestsMetafunction() { sink(SpecialMemberTest<TestTypes>{}...); }
+};
+
+struct TrivialMoveNonTrivialCopy {
+ TrivialMoveNonTrivialCopy() = default;
+ TrivialMoveNonTrivialCopy(const TrivialMoveNonTrivialCopy&) {}
+ TrivialMoveNonTrivialCopy(TrivialMoveNonTrivialCopy&&) = default;
+ TrivialMoveNonTrivialCopy& operator=(const TrivialMoveNonTrivialCopy&) { return *this; }
+ TrivialMoveNonTrivialCopy& operator=(TrivialMoveNonTrivialCopy&&) = default;
+};
+
+struct TrivialCopyNonTrivialMove {
+ TrivialCopyNonTrivialMove() = default;
+ TrivialCopyNonTrivialMove(const TrivialCopyNonTrivialMove&) = default;
+ TrivialCopyNonTrivialMove(TrivialCopyNonTrivialMove&&) {}
+ TrivialCopyNonTrivialMove& operator=(const TrivialCopyNonTrivialMove&) = default;
+ TrivialCopyNonTrivialMove& operator=(TrivialCopyNonTrivialMove&&) { return *this; }
+};
+
+int main() {
+ sink(
+ ImplicitTypes::ApplyTypes<DoTestsMetafunction>{},
+ ExplicitTypes::ApplyTypes<DoTestsMetafunction>{},
+ NonLiteralTypes::ApplyTypes<DoTestsMetafunction>{},
+ NonTrivialTypes::ApplyTypes<DoTestsMetafunction>{},
+ DoTestsMetafunction<TrivialMoveNonTrivialCopy, TrivialCopyNonTrivialMove>{}
+ );
+}
diff --git a/test/std/utilities/optional/optional.specalg/make_optional.pass.cpp b/test/std/utilities/optional/optional.specalg/make_optional.pass.cpp
index 3fbf19f8ee1ba..421480aa8c031 100644
--- a/test/std/utilities/optional/optional.specalg/make_optional.pass.cpp
+++ b/test/std/utilities/optional/optional.specalg/make_optional.pass.cpp
@@ -10,6 +10,14 @@
// UNSUPPORTED: c++98, c++03, c++11, c++14
// <optional>
+// XFAIL: availability=macosx10.13
+// XFAIL: availability=macosx10.12
+// XFAIL: availability=macosx10.11
+// XFAIL: availability=macosx10.10
+// XFAIL: availability=macosx10.9
+// XFAIL: availability=macosx10.8
+// XFAIL: availability=macosx10.7
+
// template <class T>
// constexpr optional<decay_t<T>> make_optional(T&& v);
diff --git a/test/std/utilities/template.bitset/bitset.members/flip_one.pass.cpp b/test/std/utilities/template.bitset/bitset.members/flip_one.pass.cpp
index 9908811cf3d20..fb47e0cfb3af7 100644
--- a/test/std/utilities/template.bitset/bitset.members/flip_one.pass.cpp
+++ b/test/std/utilities/template.bitset/bitset.members/flip_one.pass.cpp
@@ -12,6 +12,7 @@
#include <bitset>
#include <cstdlib>
#include <cassert>
+#include <stdexcept>
#include "test_macros.h"
diff --git a/test/std/utilities/template.bitset/bitset.members/reset_one.pass.cpp b/test/std/utilities/template.bitset/bitset.members/reset_one.pass.cpp
index 6847694e4b73d..e1bf6b8763bb1 100644
--- a/test/std/utilities/template.bitset/bitset.members/reset_one.pass.cpp
+++ b/test/std/utilities/template.bitset/bitset.members/reset_one.pass.cpp
@@ -11,6 +11,7 @@
#include <bitset>
#include <cassert>
+#include <stdexcept>
#include "test_macros.h"
diff --git a/test/std/utilities/template.bitset/bitset.members/set_one.pass.cpp b/test/std/utilities/template.bitset/bitset.members/set_one.pass.cpp
index 1c8d6a1c32a4e..e46ed978d8a81 100644
--- a/test/std/utilities/template.bitset/bitset.members/set_one.pass.cpp
+++ b/test/std/utilities/template.bitset/bitset.members/set_one.pass.cpp
@@ -11,6 +11,7 @@
#include <bitset>
#include <cassert>
+#include <stdexcept>
#include "test_macros.h"
diff --git a/test/std/utilities/template.bitset/bitset.members/test.pass.cpp b/test/std/utilities/template.bitset/bitset.members/test.pass.cpp
index 084dc9f8d46fa..4a1c0e23bc4da 100644
--- a/test/std/utilities/template.bitset/bitset.members/test.pass.cpp
+++ b/test/std/utilities/template.bitset/bitset.members/test.pass.cpp
@@ -12,6 +12,7 @@
#include <bitset>
#include <cstdlib>
#include <cassert>
+#include <stdexcept>
#include "test_macros.h"
diff --git a/test/std/utilities/template.bitset/includes.pass.cpp b/test/std/utilities/template.bitset/includes.pass.cpp
index e640a1b5b7ed4..021ca28e63e22 100644
--- a/test/std/utilities/template.bitset/includes.pass.cpp
+++ b/test/std/utilities/template.bitset/includes.pass.cpp
@@ -7,7 +7,7 @@
//
//===----------------------------------------------------------------------===//
-// test that <bitset> includes <cstddef>, <string>, <stdexcept> and <iosfwd>
+// test that <bitset> includes <string> and <iosfwd>
#include <bitset>
@@ -15,18 +15,9 @@ template <class> void test_typedef() {}
int main()
{
- { // test for <cstddef>
- std::ptrdiff_t p; ((void)p);
- std::size_t s; ((void)s);
- std::nullptr_t np; ((void)np);
- }
{ // test for <string>
std::string s; ((void)s);
}
- { // test for <stdexcept>
- std::logic_error le("blah"); ((void)le);
- std::runtime_error re("blah"); ((void)re);
- }
{ // test for <iosfwd>
test_typedef<std::ios>();
test_typedef<std::wios>();
diff --git a/test/std/utilities/time/date.time/ctime.pass.cpp b/test/std/utilities/time/date.time/ctime.pass.cpp
index fe9f38daa3ff7..f6dd75d2484ab 100644
--- a/test/std/utilities/time/date.time/ctime.pass.cpp
+++ b/test/std/utilities/time/date.time/ctime.pass.cpp
@@ -26,6 +26,10 @@
#endif
#endif
+#if defined(__GNUC__)
+#pragma GCC diagnostic ignored "-Wformat-zero-length"
+#endif
+
int main()
{
std::clock_t c = 0;
@@ -47,7 +51,7 @@ int main()
static_assert((std::is_same<decltype(std::difftime(t,t)), double>::value), "");
static_assert((std::is_same<decltype(std::mktime(&tm)), std::time_t>::value), "");
static_assert((std::is_same<decltype(std::time(&t)), std::time_t>::value), "");
-#if TEST_STD_VER > 14 && defined(TEST_HAS_C11_FEATURES)
+#if TEST_STD_VER > 14 && defined(TEST_HAS_TIMESPEC_GET)
static_assert((std::is_same<decltype(std::timespec_get(nullptr, 0)), int>::value), "");
#endif
#ifndef _LIBCPP_HAS_NO_THREAD_UNSAFE_C_FUNCTIONS
diff --git a/test/std/utilities/time/days.pass.cpp b/test/std/utilities/time/days.pass.cpp
new file mode 100644
index 0000000000000..14ab01a65c5f2
--- /dev/null
+++ b/test/std/utilities/time/days.pass.cpp
@@ -0,0 +1,28 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
+
+// <chrono>
+
+// using days = duration<signed integer type of at least 25 bits, ratio_multiply<ratio<24>, hours::period>>;
+
+#include <chrono>
+#include <type_traits>
+#include <limits>
+
+int main()
+{
+ typedef std::chrono::days D;
+ typedef D::rep Rep;
+ typedef D::period Period;
+ static_assert(std::is_signed<Rep>::value, "");
+ static_assert(std::is_integral<Rep>::value, "");
+ static_assert(std::numeric_limits<Rep>::digits >= 25, "");
+ static_assert(std::is_same_v<Period, std::ratio_multiply<std::ratio<24>, std::chrono::hours::period>>, "");
+}
diff --git a/test/std/utilities/time/months.pass.cpp b/test/std/utilities/time/months.pass.cpp
new file mode 100644
index 0000000000000..63f85623e873e
--- /dev/null
+++ b/test/std/utilities/time/months.pass.cpp
@@ -0,0 +1,29 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
+
+// <chrono>
+
+// using months = duration<signed integer type of at least 20 bits, ratio_divide<years::period, ratio<12>>>;
+
+
+#include <chrono>
+#include <type_traits>
+#include <limits>
+
+int main()
+{
+ typedef std::chrono::months D;
+ typedef D::rep Rep;
+ typedef D::period Period;
+ static_assert(std::is_signed<Rep>::value, "");
+ static_assert(std::is_integral<Rep>::value, "");
+ static_assert(std::numeric_limits<Rep>::digits >= 20, "");
+ static_assert(std::is_same_v<Period, std::ratio_divide<std::chrono::years::period, std::ratio<12>>>, "");
+}
diff --git a/test/std/utilities/time/time.cal/euclidian.h b/test/std/utilities/time/time.cal/euclidian.h
new file mode 100644
index 0000000000000..cc7e054ac5522
--- /dev/null
+++ b/test/std/utilities/time/time.cal/euclidian.h
@@ -0,0 +1,39 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+
+// Assumption: minValue < maxValue
+// Assumption: minValue <= rhs <= maxValue
+// Assumption: minValue <= lhs <= maxValue
+// Assumption: minValue >= 0
+template <typename T, T minValue, T maxValue>
+T euclidian_addition(T rhs, T lhs)
+{
+ const T modulus = maxValue - minValue + 1;
+ T ret = rhs + lhs;
+ if (ret > maxValue)
+ ret -= modulus;
+ return ret;
+}
+
+// Assumption: minValue < maxValue
+// Assumption: minValue <= rhs <= maxValue
+// Assumption: minValue <= lhs <= maxValue
+// Assumption: minValue >= 0
+template <typename T, T minValue, T maxValue>
+T euclidian_subtraction(T lhs, T rhs)
+{
+ const T modulus = maxValue - minValue + 1;
+ T ret = lhs - rhs;
+ if (ret < minValue)
+ ret += modulus;
+ if (ret > maxValue) // this can happen if T is unsigned
+ ret += modulus;
+ return ret;
+}
diff --git a/test/libcxx/experimental/containers/sequences/dynarray/nothing_to_do.pass.cpp b/test/std/utilities/time/time.cal/nothing_to_do.pass.cpp
index b58f5c55b643a..b58f5c55b643a 100644
--- a/test/libcxx/experimental/containers/sequences/dynarray/nothing_to_do.pass.cpp
+++ b/test/std/utilities/time/time.cal/nothing_to_do.pass.cpp
diff --git a/test/std/utilities/time/time.cal/time.cal.day/time.cal.day.members/ctor.pass.cpp b/test/std/utilities/time/time.cal/time.cal.day/time.cal.day.members/ctor.pass.cpp
new file mode 100644
index 0000000000000..dd36ee5747f52
--- /dev/null
+++ b/test/std/utilities/time/time.cal/time.cal.day/time.cal.day.members/ctor.pass.cpp
@@ -0,0 +1,46 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
+
+// <chrono>
+// class day;
+
+// day() = default;
+// explicit constexpr day(unsigned d) noexcept;
+// explicit constexpr operator unsigned() const noexcept;
+
+// Effects: Constructs an object of type day by initializing d_ with d.
+// The value held is unspecified if d is not in the range [0, 255].
+
+#include <chrono>
+#include <type_traits>
+#include <cassert>
+
+#include "test_macros.h"
+
+int main()
+{
+ using day = std::chrono::day;
+
+ ASSERT_NOEXCEPT(day{});
+ ASSERT_NOEXCEPT(day(0U));
+ ASSERT_NOEXCEPT(static_cast<unsigned>(day(0U)));
+
+ constexpr day d0{};
+ static_assert(static_cast<unsigned>(d0) == 0, "");
+
+ constexpr day d1{1};
+ static_assert(static_cast<unsigned>(d1) == 1, "");
+
+ for (unsigned i = 0; i <= 255; ++i)
+ {
+ day day(i);
+ assert(static_cast<unsigned>(day) == i);
+ }
+}
diff --git a/test/std/utilities/time/time.cal/time.cal.day/time.cal.day.members/decrement.pass.cpp b/test/std/utilities/time/time.cal/time.cal.day/time.cal.day.members/decrement.pass.cpp
new file mode 100644
index 0000000000000..a3ac8dc46cb97
--- /dev/null
+++ b/test/std/utilities/time/time.cal/time.cal.day/time.cal.day.members/decrement.pass.cpp
@@ -0,0 +1,52 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
+
+// <chrono>
+// class day;
+
+// constexpr day& operator--() noexcept;
+// constexpr day operator--(int) noexcept;
+
+
+#include <chrono>
+#include <type_traits>
+#include <cassert>
+
+#include "test_macros.h"
+
+template <typename D>
+constexpr bool testConstexpr()
+{
+ D d1{10};
+ if (static_cast<unsigned>(--d1) != 9) return false;
+ if (static_cast<unsigned>(d1--) != 9) return false;
+ if (static_cast<unsigned>(d1) != 8) return false;
+ return true;
+}
+
+int main()
+{
+ using day = std::chrono::day;
+ ASSERT_NOEXCEPT(--(std::declval<day&>()) );
+ ASSERT_NOEXCEPT( (std::declval<day&>())--);
+
+ ASSERT_SAME_TYPE(day , decltype( std::declval<day&>()--));
+ ASSERT_SAME_TYPE(day&, decltype(--std::declval<day&>() ));
+
+ static_assert(testConstexpr<day>(), "");
+
+ for (unsigned i = 10; i <= 20; ++i)
+ {
+ day day(i);
+ assert(static_cast<unsigned>(--day) == i - 1);
+ assert(static_cast<unsigned>(day--) == i - 1);
+ assert(static_cast<unsigned>(day) == i - 2);
+ }
+}
diff --git a/test/std/utilities/time/time.cal/time.cal.day/time.cal.day.members/increment.pass.cpp b/test/std/utilities/time/time.cal/time.cal.day/time.cal.day.members/increment.pass.cpp
new file mode 100644
index 0000000000000..aa084e8633966
--- /dev/null
+++ b/test/std/utilities/time/time.cal/time.cal.day/time.cal.day.members/increment.pass.cpp
@@ -0,0 +1,52 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
+
+// <chrono>
+// class day;
+
+// constexpr day& operator++() noexcept;
+// constexpr day operator++(int) noexcept;
+
+
+#include <chrono>
+#include <type_traits>
+#include <cassert>
+
+#include "test_macros.h"
+
+template <typename D>
+constexpr bool testConstexpr()
+{
+ D d1{1};
+ if (static_cast<unsigned>(++d1) != 2) return false;
+ if (static_cast<unsigned>(d1++) != 2) return false;
+ if (static_cast<unsigned>(d1) != 3) return false;
+ return true;
+}
+
+int main()
+{
+ using day = std::chrono::day;
+ ASSERT_NOEXCEPT(++(std::declval<day&>()) );
+ ASSERT_NOEXCEPT( (std::declval<day&>())++);
+
+ ASSERT_SAME_TYPE(day , decltype( std::declval<day&>()++));
+ ASSERT_SAME_TYPE(day&, decltype(++std::declval<day&>() ));
+
+ static_assert(testConstexpr<day>(), "");
+
+ for (unsigned i = 10; i <= 20; ++i)
+ {
+ day day(i);
+ assert(static_cast<unsigned>(++day) == i + 1);
+ assert(static_cast<unsigned>(day++) == i + 1);
+ assert(static_cast<unsigned>(day) == i + 2);
+ }
+}
diff --git a/test/std/utilities/time/time.cal/time.cal.day/time.cal.day.members/ok.pass.cpp b/test/std/utilities/time/time.cal/time.cal.day/time.cal.day.members/ok.pass.cpp
new file mode 100644
index 0000000000000..54b18e34b8be3
--- /dev/null
+++ b/test/std/utilities/time/time.cal/time.cal.day/time.cal.day.members/ok.pass.cpp
@@ -0,0 +1,37 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
+
+// <chrono>
+// class day;
+
+// constexpr bool ok() const noexcept;
+// Returns: 1 <= d_ && d_ <= 31
+
+#include <chrono>
+#include <type_traits>
+#include <cassert>
+
+#include "test_macros.h"
+
+int main()
+{
+ using day = std::chrono::day;
+ ASSERT_NOEXCEPT( std::declval<const day>().ok());
+ ASSERT_SAME_TYPE(bool, decltype(std::declval<const day>().ok()));
+
+ static_assert(!day{0}.ok(), "");
+ static_assert( day{1}.ok(), "");
+
+ assert(!day{0}.ok());
+ for (unsigned i = 1; i <= 31; ++i)
+ assert(day{i}.ok());
+ for (unsigned i = 32; i <= 255; ++i)
+ assert(!day{i}.ok());
+}
diff --git a/test/std/utilities/time/time.cal/time.cal.day/time.cal.day.members/plus_minus_equal.pass.cpp b/test/std/utilities/time/time.cal/time.cal.day/time.cal.day.members/plus_minus_equal.pass.cpp
new file mode 100644
index 0000000000000..aed46e7d7c734
--- /dev/null
+++ b/test/std/utilities/time/time.cal/time.cal.day/time.cal.day.members/plus_minus_equal.pass.cpp
@@ -0,0 +1,57 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
+
+// <chrono>
+// class day;
+
+// constexpr day& operator+=(const days& d) noexcept;
+// constexpr day& operator-=(const days& d) noexcept;
+
+#include <chrono>
+#include <type_traits>
+#include <cassert>
+
+#include "test_macros.h"
+
+template <typename D, typename Ds>
+constexpr bool testConstexpr()
+{
+ D d1{1};
+ if (static_cast<unsigned>(d1 += Ds{ 1}) != 2) return false;
+ if (static_cast<unsigned>(d1 += Ds{ 2}) != 4) return false;
+ if (static_cast<unsigned>(d1 += Ds{22}) != 26) return false;
+ if (static_cast<unsigned>(d1 -= Ds{ 1}) != 25) return false;
+ if (static_cast<unsigned>(d1 -= Ds{ 2}) != 23) return false;
+ if (static_cast<unsigned>(d1 -= Ds{22}) != 1) return false;
+ return true;
+}
+
+int main()
+{
+ using day = std::chrono::day;
+ using days = std::chrono::days;
+
+ ASSERT_NOEXCEPT(std::declval<day&>() += std::declval<days>());
+ ASSERT_NOEXCEPT(std::declval<day&>() -= std::declval<days>());
+
+ ASSERT_SAME_TYPE(day&, decltype(std::declval<day&>() += std::declval<days>()));
+ ASSERT_SAME_TYPE(day&, decltype(std::declval<day&>() -= std::declval<days>()));
+
+ static_assert(testConstexpr<day, days>(), "");
+
+ for (unsigned i = 0; i <= 10; ++i)
+ {
+ day day(i);
+ assert(static_cast<unsigned>(day += days{22}) == i + 22);
+ assert(static_cast<unsigned>(day) == i + 22);
+ assert(static_cast<unsigned>(day -= days{12}) == i + 10);
+ assert(static_cast<unsigned>(day) == i + 10);
+ }
+}
diff --git a/test/std/utilities/time/time.cal/time.cal.day/time.cal.day.nonmembers/comparisons.pass.cpp b/test/std/utilities/time/time.cal/time.cal.day/time.cal.day.nonmembers/comparisons.pass.cpp
new file mode 100644
index 0000000000000..1047e1bc33ed7
--- /dev/null
+++ b/test/std/utilities/time/time.cal/time.cal.day/time.cal.day.nonmembers/comparisons.pass.cpp
@@ -0,0 +1,44 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
+
+// <chrono>
+// class day;
+
+// constexpr bool operator==(const day& x, const day& y) noexcept;
+// Returns: unsigned{x} == unsigned{y}.
+// constexpr bool operator<(const day& x, const day& y) noexcept;
+// Returns: unsigned{x} < unsigned{y}.
+
+
+#include <chrono>
+#include <type_traits>
+#include <cassert>
+
+#include "test_macros.h"
+#include "test_comparisons.h"
+
+int main()
+{
+ using day = std::chrono::day;
+
+ AssertComparisons6AreNoexcept<day>();
+ AssertComparisons6ReturnBool<day>();
+
+ static_assert(testComparisons6Values<day>(0U, 0U), "");
+ static_assert(testComparisons6Values<day>(0U, 1U), "");
+
+// Some 'ok' values as well
+ static_assert(testComparisons6Values<day>( 5U, 5U), "");
+ static_assert(testComparisons6Values<day>( 5U, 10U), "");
+
+ for (unsigned i = 1; i < 10; ++i)
+ for (unsigned j = 1; j < 10; ++j)
+ assert(testComparisons6Values<day>(i, j));
+}
diff --git a/test/std/utilities/time/time.cal/time.cal.day/time.cal.day.nonmembers/literals.fail.cpp b/test/std/utilities/time/time.cal/time.cal.day/time.cal.day.nonmembers/literals.fail.cpp
new file mode 100644
index 0000000000000..350a846353a01
--- /dev/null
+++ b/test/std/utilities/time/time.cal/time.cal.day/time.cal.day.nonmembers/literals.fail.cpp
@@ -0,0 +1,28 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
+// UNSUPPORTED: clang-5, clang-6
+// UNSUPPORTED: apple-clang-6, apple-clang-7, apple-clang-8, apple-clang-9, apple-clang-10
+
+// <chrono>
+// class day;
+
+// constexpr day operator""d(unsigned long long d) noexcept;
+
+#include <chrono>
+#include <type_traits>
+#include <cassert>
+
+#include "test_macros.h"
+
+int main()
+{
+ using day = std::chrono::day;
+ day d1 = 4d; // expected-error-re {{no matching literal operator for call to 'operator""d' {{.*}}}}
+}
diff --git a/test/std/utilities/time/time.cal/time.cal.day/time.cal.day.nonmembers/literals.pass.cpp b/test/std/utilities/time/time.cal/time.cal.day/time.cal.day.nonmembers/literals.pass.cpp
new file mode 100644
index 0000000000000..405200e470d86
--- /dev/null
+++ b/test/std/utilities/time/time.cal/time.cal.day/time.cal.day.nonmembers/literals.pass.cpp
@@ -0,0 +1,47 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
+// UNSUPPORTED: clang-5, clang-6, clang-7
+// UNSUPPORTED: apple-clang-6, apple-clang-7, apple-clang-8, apple-clang-9, apple-clang-10
+
+// <chrono>
+// class day;
+
+// constexpr day operator""d(unsigned long long d) noexcept;
+
+#include <chrono>
+#include <type_traits>
+#include <cassert>
+
+#include "test_macros.h"
+
+int main()
+{
+ {
+ using namespace std::chrono;
+ ASSERT_NOEXCEPT( 4d);
+ ASSERT_SAME_TYPE(day, decltype(4d));
+
+ static_assert( 7d == day(7), "");
+ day d1 = 4d;
+ assert (d1 == day(4));
+}
+
+ {
+ using namespace std::literals;
+ ASSERT_NOEXCEPT( 4d);
+ ASSERT_SAME_TYPE(std::chrono::day, decltype(4d));
+
+ static_assert( 7d == std::chrono::day(7), "");
+
+ std::chrono::day d1 = 4d;
+ assert (d1 == std::chrono::day(4));
+ }
+
+}
diff --git a/test/std/utilities/time/time.cal/time.cal.day/time.cal.day.nonmembers/minus.pass.cpp b/test/std/utilities/time/time.cal/time.cal.day/time.cal.day.nonmembers/minus.pass.cpp
new file mode 100644
index 0000000000000..47ef42c07bac0
--- /dev/null
+++ b/test/std/utilities/time/time.cal/time.cal.day/time.cal.day.nonmembers/minus.pass.cpp
@@ -0,0 +1,58 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
+
+// <chrono>
+// class day;
+
+// constexpr day operator-(const day& x, const days& y) noexcept;
+// Returns: x + -y.
+//
+// constexpr days operator-(const day& x, const day& y) noexcept;
+// Returns: days{int(unsigned{x}) - int(unsigned{y}).
+
+
+#include <chrono>
+#include <type_traits>
+#include <cassert>
+
+#include "test_macros.h"
+
+template <typename D, typename Ds>
+constexpr bool testConstexpr()
+{
+ D d{23};
+ Ds offset{6};
+ if (d - offset != D{17}) return false;
+ if (d - D{17} != offset) return false;
+ return true;
+}
+
+int main()
+{
+ using day = std::chrono::day;
+ using days = std::chrono::days;
+
+ ASSERT_NOEXCEPT(std::declval<day>() - std::declval<days>());
+ ASSERT_NOEXCEPT(std::declval<day>() - std::declval<day>());
+
+ ASSERT_SAME_TYPE(day, decltype(std::declval<day>() - std::declval<days>()));
+ ASSERT_SAME_TYPE(days, decltype(std::declval<day>() - std::declval<day>()));
+
+ static_assert(testConstexpr<day, days>(), "");
+
+ day dy{12};
+ for (unsigned i = 0; i <= 10; ++i)
+ {
+ day d1 = dy - days{i};
+ days off = dy - day {i};
+ assert(static_cast<unsigned>(d1) == 12 - i);
+ assert(off.count() == static_cast<int>(12 - i)); // days is signed
+ }
+}
diff --git a/test/std/utilities/time/time.cal/time.cal.day/time.cal.day.nonmembers/plus.pass.cpp b/test/std/utilities/time/time.cal/time.cal.day/time.cal.day.nonmembers/plus.pass.cpp
new file mode 100644
index 0000000000000..b08d6ef4b5c1d
--- /dev/null
+++ b/test/std/utilities/time/time.cal/time.cal.day/time.cal.day.nonmembers/plus.pass.cpp
@@ -0,0 +1,59 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
+
+// <chrono>
+// class day;
+
+// constexpr day operator+(const day& x, const days& y) noexcept;
+// Returns: day(unsigned{x} + y.count()).
+//
+// constexpr day operator+(const days& x, const day& y) noexcept;
+// Returns: y + x.
+
+
+#include <chrono>
+#include <type_traits>
+#include <cassert>
+
+#include "test_macros.h"
+
+template <typename D, typename Ds>
+constexpr bool testConstexpr()
+{
+ D d{1};
+ Ds offset{23};
+ if (d + offset != D{24}) return false;
+ if (offset + d != D{24}) return false;
+ return true;
+}
+
+int main()
+{
+ using day = std::chrono::day;
+ using days = std::chrono::days;
+
+ ASSERT_NOEXCEPT(std::declval<day>() + std::declval<days>());
+ ASSERT_NOEXCEPT(std::declval<days>() + std::declval<day>());
+
+ ASSERT_SAME_TYPE(day, decltype(std::declval<day>() + std::declval<days>()));
+ ASSERT_SAME_TYPE(day, decltype(std::declval<days>() + std::declval<day>()));
+
+ static_assert(testConstexpr<day, days>(), "");
+
+ day dy{12};
+ for (unsigned i = 0; i <= 10; ++i)
+ {
+ day d1 = dy + days{i};
+ day d2 = days{i} + dy;
+ assert(d1 == d2);
+ assert(static_cast<unsigned>(d1) == i + 12);
+ assert(static_cast<unsigned>(d2) == i + 12);
+ }
+}
diff --git a/test/std/utilities/time/time.cal/time.cal.day/time.cal.day.nonmembers/streaming.pass.cpp b/test/std/utilities/time/time.cal/time.cal.day/time.cal.day.nonmembers/streaming.pass.cpp
new file mode 100644
index 0000000000000..9c949170af735
--- /dev/null
+++ b/test/std/utilities/time/time.cal/time.cal.day/time.cal.day.nonmembers/streaming.pass.cpp
@@ -0,0 +1,56 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
+// XFAIL: *
+
+// <chrono>
+// class day;
+
+// template<class charT, class traits>
+// basic_ostream<charT, traits>&
+// operator<<(basic_ostream<charT, traits>& os, const day& d);
+//
+// Effects: Inserts format(fmt, d) where fmt is "%d" widened to charT.
+// If !d.ok(), appends with " is not a valid day".
+//
+// template<class charT, class traits>
+// basic_ostream<charT, traits>&
+// to_stream(basic_ostream<charT, traits>& os, const charT* fmt, const day& d);
+//
+// Effects: Streams d into os using the format specified by the NTCTS fmt.
+// fmt encoding follows the rules specified in 25.11.
+//
+// template<class charT, class traits, class Alloc = allocator<charT>>
+// basic_istream<charT, traits>&
+// from_stream(basic_istream<charT, traits>& is, const charT* fmt,
+// day& d, basic_string<charT, traits, Alloc>* abbrev = nullptr,
+// minutes* offset = nullptr);
+//
+// Effects: Attempts to parse the input stream is into the day d using the format flags
+// given in the NTCTS fmt as specified in 25.12.
+// If the parse fails to decode a valid day, is.setstate(ios_base::failbit)
+// shall be called and d shall not be modified.
+// If %Z is used and successfully parsed, that value will be assigned to *abbrev
+// if abbrev is non-null. If %z (or a modified variant) is used and
+// successfully parsed, that value will be assigned to *offset if offset is non-null.
+//
+
+
+#include <chrono>
+#include <type_traits>
+#include <cassert>
+#include <iostream>
+
+#include "test_macros.h"
+
+int main()
+{
+ using day = std::chrono::day;
+ std::cout << day{1};
+}
diff --git a/test/std/utilities/time/time.cal/time.cal.day/types.pass.cpp b/test/std/utilities/time/time.cal/time.cal.day/types.pass.cpp
new file mode 100644
index 0000000000000..06b70b0aa8902
--- /dev/null
+++ b/test/std/utilities/time/time.cal/time.cal.day/types.pass.cpp
@@ -0,0 +1,26 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
+
+// <chrono>
+// class day;
+
+#include <chrono>
+#include <type_traits>
+#include <cassert>
+
+#include "test_macros.h"
+
+int main()
+{
+ using day = std::chrono::day;
+
+ static_assert(std::is_trivially_copyable_v<day>, "");
+ static_assert(std::is_standard_layout_v<day>, "");
+}
diff --git a/test/std/utilities/time/time.cal/time.cal.last/types.pass.cpp b/test/std/utilities/time/time.cal/time.cal.last/types.pass.cpp
new file mode 100644
index 0000000000000..5d85120580e68
--- /dev/null
+++ b/test/std/utilities/time/time.cal/time.cal.last/types.pass.cpp
@@ -0,0 +1,33 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
+
+// <chrono>
+
+// struct last_spec {
+// explicit last_spec() = default;
+// };
+//
+// inline constexpr last_spec last{};
+
+#include <chrono>
+#include <type_traits>
+#include <cassert>
+
+#include "test_macros.h"
+
+int main()
+{
+ using last_spec = std::chrono::last_spec;
+
+ ASSERT_SAME_TYPE(const last_spec, decltype(std::chrono::last));
+
+ static_assert(std::is_trivially_copyable_v<last_spec>, "");
+ static_assert(std::is_standard_layout_v<last_spec>, "");
+}
diff --git a/test/std/utilities/time/time.cal/time.cal.md/time.cal.md.members/ctor.pass.cpp b/test/std/utilities/time/time.cal/time.cal.md/time.cal.md.members/ctor.pass.cpp
new file mode 100644
index 0000000000000..743da74ba46f7
--- /dev/null
+++ b/test/std/utilities/time/time.cal/time.cal.md/time.cal.md.members/ctor.pass.cpp
@@ -0,0 +1,47 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
+
+// <chrono>
+// class month_day;
+
+// month_day() = default;
+// constexpr month_day(const chrono::month& m, const chrono::day& d) noexcept;
+//
+// Effects: Constructs an object of type month_day by initializing m_ with m, and d_ with d.
+//
+// constexpr chrono::month month() const noexcept;
+// constexpr chrono::day day() const noexcept;
+// constexpr bool ok() const noexcept;
+
+#include <chrono>
+#include <type_traits>
+#include <cassert>
+
+#include "test_macros.h"
+
+int main()
+{
+ using day = std::chrono::day;
+ using month = std::chrono::month;
+ using month_day = std::chrono::month_day;
+
+ ASSERT_NOEXCEPT(month_day{});
+ ASSERT_NOEXCEPT(month_day{month{1}, day{1}});
+
+ constexpr month_day md0{};
+ static_assert( md0.month() == month{}, "");
+ static_assert( md0.day() == day{}, "");
+ static_assert(!md0.ok(), "");
+
+ constexpr month_day md1{std::chrono::January, day{4}};
+ static_assert( md1.month() == std::chrono::January, "");
+ static_assert( md1.day() == day{4}, "");
+ static_assert( md1.ok(), "");
+}
diff --git a/test/std/utilities/time/time.cal/time.cal.md/time.cal.md.members/day.pass.cpp b/test/std/utilities/time/time.cal/time.cal.md/time.cal.md.members/day.pass.cpp
new file mode 100644
index 0000000000000..5bc001c47464f
--- /dev/null
+++ b/test/std/utilities/time/time.cal/time.cal.md/time.cal.md.members/day.pass.cpp
@@ -0,0 +1,38 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
+
+// <chrono>
+// class month_day;
+
+// constexpr chrono::day day() const noexcept;
+// Returns: d_
+
+#include <chrono>
+#include <type_traits>
+#include <cassert>
+
+#include "test_macros.h"
+
+int main()
+{
+ using day = std::chrono::day;
+ using month_day = std::chrono::month_day;
+
+ ASSERT_NOEXCEPT( std::declval<const month_day>().day());
+ ASSERT_SAME_TYPE(day, decltype(std::declval<const month_day>().day()));
+
+ static_assert( month_day{}.day() == day{}, "");
+
+ for (unsigned i = 1; i <= 50; ++i)
+ {
+ month_day md(std::chrono::March, day{i});
+ assert( static_cast<unsigned>(md.day()) == i);
+ }
+}
diff --git a/test/std/utilities/time/time.cal/time.cal.md/time.cal.md.members/month.pass.cpp b/test/std/utilities/time/time.cal/time.cal.md/time.cal.md.members/month.pass.cpp
new file mode 100644
index 0000000000000..96806fda8ea7c
--- /dev/null
+++ b/test/std/utilities/time/time.cal/time.cal.md/time.cal.md.members/month.pass.cpp
@@ -0,0 +1,39 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
+
+// <chrono>
+// class month_day;
+
+// constexpr chrono::month month() const noexcept;
+// Returns: wd_
+
+#include <chrono>
+#include <type_traits>
+#include <cassert>
+
+#include "test_macros.h"
+
+int main()
+{
+ using day = std::chrono::day;
+ using month = std::chrono::month;
+ using month_day = std::chrono::month_day;
+
+ ASSERT_NOEXCEPT( std::declval<const month_day>().month());
+ ASSERT_SAME_TYPE(month, decltype(std::declval<const month_day>().month()));
+
+ static_assert( month_day{}.month() == month{}, "");
+
+ for (unsigned i = 1; i <= 50; ++i)
+ {
+ month_day md(month{i}, day{1});
+ assert( static_cast<unsigned>(md.month()) == i);
+ }
+}
diff --git a/test/std/utilities/time/time.cal/time.cal.md/time.cal.md.members/ok.pass.cpp b/test/std/utilities/time/time.cal/time.cal.md/time.cal.md.members/ok.pass.cpp
new file mode 100644
index 0000000000000..d715635d423ec
--- /dev/null
+++ b/test/std/utilities/time/time.cal/time.cal.md/time.cal.md.members/ok.pass.cpp
@@ -0,0 +1,55 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
+
+// <chrono>
+// class month_day;
+
+// constexpr bool ok() const noexcept;
+// Returns: true if m_.ok() is true, 1d <= d_, and d_ is less than or equal to the
+// number of days in month m_; otherwise returns false.
+// When m_ == February, the number of days is considered to be 29.
+
+#include <chrono>
+#include <type_traits>
+#include <cassert>
+
+#include "test_macros.h"
+
+int main()
+{
+ using day = std::chrono::day;
+ using month = std::chrono::month;
+ using month_day = std::chrono::month_day;
+
+ ASSERT_NOEXCEPT( std::declval<const month_day>().ok());
+ ASSERT_SAME_TYPE(bool, decltype(std::declval<const month_day>().ok()));
+
+ static_assert(!month_day{}.ok(), "");
+ static_assert( month_day{std::chrono::May, day{2}}.ok(), "");
+
+ assert(!(month_day(std::chrono::April, day{0}).ok()));
+
+ assert( (month_day{std::chrono::March, day{1}}.ok()));
+ for (unsigned i = 1; i <= 12; ++i)
+ {
+ const bool is31 = i == 1 || i == 3 || i == 5 || i == 7 || i == 8 || i == 10 || i == 12;
+ assert(!(month_day{month{i}, day{ 0}}.ok()));
+ assert( (month_day{month{i}, day{ 1}}.ok()));
+ assert( (month_day{month{i}, day{10}}.ok()));
+ assert( (month_day{month{i}, day{29}}.ok()));
+ assert( (month_day{month{i}, day{30}}.ok()) == (i != 2));
+ assert( (month_day{month{i}, day{31}}.ok()) == is31);
+ assert(!(month_day{month{i}, day{32}}.ok()));
+ }
+
+// If the month is not ok, all the days are bad
+ for (unsigned i = 1; i <= 35; ++i)
+ assert(!(month_day{month{13}, day{i}}.ok()));
+}
diff --git a/test/std/utilities/time/time.cal/time.cal.md/time.cal.md.nonmembers/comparisons.pass.cpp b/test/std/utilities/time/time.cal/time.cal.md/time.cal.md.nonmembers/comparisons.pass.cpp
new file mode 100644
index 0000000000000..c8938be082a52
--- /dev/null
+++ b/test/std/utilities/time/time.cal/time.cal.md/time.cal.md.nonmembers/comparisons.pass.cpp
@@ -0,0 +1,70 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
+
+// <chrono>
+// class month_day;
+
+// constexpr bool operator==(const month_day& x, const month_day& y) noexcept;
+// Returns: x.month() == y.month() && x.day() == y.day().
+//
+// constexpr bool operator< (const month_day& x, const month_day& y) noexcept;
+// Returns:
+// If x.month() < y.month() returns true.
+// Otherwise, if x.month() > y.month() returns false.
+// Otherwise, returns x.day() < y.day().
+
+#include <chrono>
+#include <type_traits>
+#include <cassert>
+
+#include "test_macros.h"
+#include "test_comparisons.h"
+
+int main()
+{
+ using day = std::chrono::day;
+ using month = std::chrono::month;
+ using month_day = std::chrono::month_day;
+
+ AssertComparisons6AreNoexcept<month_day>();
+ AssertComparisons6ReturnBool<month_day>();
+
+ static_assert( testComparisons6(
+ month_day{std::chrono::January, day{1}},
+ month_day{std::chrono::January, day{1}},
+ true, false), "");
+
+ static_assert( testComparisons6(
+ month_day{std::chrono::January, day{1}},
+ month_day{std::chrono::January, day{2}},
+ false, true), "");
+
+ static_assert( testComparisons6(
+ month_day{std::chrono::January, day{1}},
+ month_day{std::chrono::February, day{1}},
+ false, true), "");
+
+// same day, different months
+ for (unsigned i = 1; i < 12; ++i)
+ for (unsigned j = 1; j < 12; ++j)
+ assert((testComparisons6(
+ month_day{month{i}, day{1}},
+ month_day{month{j}, day{1}},
+ i == j, i < j )));
+
+// same month, different days
+ for (unsigned i = 1; i < 31; ++i)
+ for (unsigned j = 1; j < 31; ++j)
+ assert((testComparisons6(
+ month_day{month{2}, day{i}},
+ month_day{month{2}, day{j}},
+ i == j, i < j )));
+
+}
diff --git a/test/std/utilities/time/time.cal/time.cal.md/time.cal.md.nonmembers/streaming.pass.cpp b/test/std/utilities/time/time.cal/time.cal.md/time.cal.md.nonmembers/streaming.pass.cpp
new file mode 100644
index 0000000000000..46ae31aaf8d66
--- /dev/null
+++ b/test/std/utilities/time/time.cal/time.cal.md/time.cal.md.nonmembers/streaming.pass.cpp
@@ -0,0 +1,41 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
+// XFAIL: *
+
+// <chrono>
+// class month_day;
+
+// template<class charT, class traits>
+// basic_ostream<charT, traits>&
+// operator<<(basic_ostream<charT, traits>& os, const month_day& md);
+//
+// Returns: os << md.month() << '/' << md.day().
+//
+// template<class charT, class traits>
+// basic_ostream<charT, traits>&
+// to_stream(basic_ostream<charT, traits>& os, const charT* fmt, const month_day& md);
+//
+// Effects: Streams md into os using the format specified by the NTCTS fmt.
+// fmt encoding follows the rules specified in 25.11.
+
+
+#include <chrono>
+#include <type_traits>
+#include <cassert>
+#include <iostream>
+#include "test_macros.h"
+
+int main()
+{
+ using month_day = std::chrono::month_day;
+ using month = std::chrono::month;
+ using day = std::chrono::day;
+ std::cout << month_day{month{1}, day{1}};
+}
diff --git a/test/std/utilities/time/time.cal/time.cal.md/types.pass.cpp b/test/std/utilities/time/time.cal/time.cal.md/types.pass.cpp
new file mode 100644
index 0000000000000..988e43323c2a3
--- /dev/null
+++ b/test/std/utilities/time/time.cal/time.cal.md/types.pass.cpp
@@ -0,0 +1,26 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
+
+// <chrono>
+// class month_day;
+
+#include <chrono>
+#include <type_traits>
+#include <cassert>
+
+#include "test_macros.h"
+
+int main()
+{
+ using month_day = std::chrono::month_day;
+
+ static_assert(std::is_trivially_copyable_v<month_day>, "");
+ static_assert(std::is_standard_layout_v<month_day>, "");
+}
diff --git a/test/std/utilities/time/time.cal/time.cal.mdlast/comparisons.pass.cpp b/test/std/utilities/time/time.cal/time.cal.mdlast/comparisons.pass.cpp
new file mode 100644
index 0000000000000..c3bc1777dea56
--- /dev/null
+++ b/test/std/utilities/time/time.cal/time.cal.mdlast/comparisons.pass.cpp
@@ -0,0 +1,43 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
+
+// <chrono>
+// class month_day_last;
+
+// constexpr bool operator==(const month_day& x, const month_day& y) noexcept;
+// Returns: x.month() == y.month()
+//
+// constexpr bool operator< (const month_day& x, const month_day& y) noexcept;
+// Returns: x.month() < y.month()
+
+
+#include <chrono>
+#include <type_traits>
+#include <cassert>
+
+#include "test_macros.h"
+#include "test_comparisons.h"
+
+int main()
+{
+ using month = std::chrono::month;
+ using month_day_last = std::chrono::month_day_last;
+
+ AssertComparisons6AreNoexcept<month_day_last>();
+ AssertComparisons6ReturnBool<month_day_last>();
+
+ static_assert( testComparisons6Values<month_day_last>(month{1}, month{1}), "");
+ static_assert( testComparisons6Values<month_day_last>(month{1}, month{2}), "");
+
+// same day, different months
+ for (unsigned i = 1; i < 12; ++i)
+ for (unsigned j = 1; j < 12; ++j)
+ assert((testComparisons6Values<month_day_last>(month{i}, month{j})));
+}
diff --git a/test/std/utilities/time/time.cal/time.cal.mdlast/ctor.pass.cpp b/test/std/utilities/time/time.cal/time.cal.mdlast/ctor.pass.cpp
new file mode 100644
index 0000000000000..5ae3294402b57
--- /dev/null
+++ b/test/std/utilities/time/time.cal/time.cal.mdlast/ctor.pass.cpp
@@ -0,0 +1,41 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
+
+// <chrono>
+// class month_day_last;
+
+// constexpr month_day_last(const chrono::month& m) noexcept;
+//
+// Effects: Constructs an object of type month_day_last by initializing m_ with m
+//
+// constexpr chrono::month month() const noexcept;
+// constexpr bool ok() const noexcept;
+
+#include <chrono>
+#include <type_traits>
+#include <cassert>
+
+#include "test_macros.h"
+
+int main()
+{
+ using month = std::chrono::month;
+ using month_day_last = std::chrono::month_day_last;
+
+ ASSERT_NOEXCEPT(month_day_last{month{1}});
+
+ constexpr month_day_last md0{month{}};
+ static_assert( md0.month() == month{}, "");
+ static_assert(!md0.ok(), "");
+
+ constexpr month_day_last md1{std::chrono::January};
+ static_assert( md1.month() == std::chrono::January, "");
+ static_assert( md1.ok(), "");
+}
diff --git a/test/std/utilities/time/time.cal/time.cal.mdlast/month.pass.cpp b/test/std/utilities/time/time.cal/time.cal.mdlast/month.pass.cpp
new file mode 100644
index 0000000000000..421f9e7b0a2b1
--- /dev/null
+++ b/test/std/utilities/time/time.cal/time.cal.mdlast/month.pass.cpp
@@ -0,0 +1,38 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
+
+// <chrono>
+// class month_day_last;
+
+// constexpr chrono::month month() const noexcept;
+// Returns: m_
+
+#include <chrono>
+#include <type_traits>
+#include <cassert>
+
+#include "test_macros.h"
+
+int main()
+{
+ using month = std::chrono::month;
+ using month_day_last = std::chrono::month_day_last;
+
+ ASSERT_NOEXCEPT( std::declval<const month_day_last>().month());
+ ASSERT_SAME_TYPE(month, decltype(std::declval<const month_day_last>().month()));
+
+ static_assert( month_day_last{month{}}.month() == month{}, "");
+
+ for (unsigned i = 1; i <= 50; ++i)
+ {
+ month_day_last mdl(month{i});
+ assert( static_cast<unsigned>(mdl.month()) == i);
+ }
+}
diff --git a/test/std/utilities/time/time.cal/time.cal.mdlast/ok.pass.cpp b/test/std/utilities/time/time.cal/time.cal.mdlast/ok.pass.cpp
new file mode 100644
index 0000000000000..85955c819c56c
--- /dev/null
+++ b/test/std/utilities/time/time.cal/time.cal.mdlast/ok.pass.cpp
@@ -0,0 +1,46 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
+
+// <chrono>
+// class month_day_last;
+
+// constexpr bool ok() const noexcept;
+// Returns: m_.ok()
+
+#include <chrono>
+#include <type_traits>
+#include <cassert>
+
+#include "test_macros.h"
+
+int main()
+{
+ using month = std::chrono::month;
+ using month_day_last = std::chrono::month_day_last;
+
+ ASSERT_NOEXCEPT( std::declval<const month_day_last>().ok());
+ ASSERT_SAME_TYPE(bool, decltype(std::declval<const month_day_last>().ok()));
+
+ static_assert(!month_day_last{month{}}.ok(), "");
+ static_assert( month_day_last{std::chrono::May}.ok(), "");
+
+ for (unsigned i = 1; i <= 12; ++i)
+ {
+ month_day_last mdl{month{i}};
+ assert( mdl.ok());
+ }
+
+// If the month is not ok, all the days are bad
+ for (unsigned i = 13; i <= 50; ++i)
+ {
+ month_day_last mdl{month{i}};
+ assert(!mdl.ok());
+ }
+}
diff --git a/test/std/utilities/time/time.cal/time.cal.mdlast/streaming.pass.cpp b/test/std/utilities/time/time.cal/time.cal.mdlast/streaming.pass.cpp
new file mode 100644
index 0000000000000..3c2da00e803a4
--- /dev/null
+++ b/test/std/utilities/time/time.cal/time.cal.mdlast/streaming.pass.cpp
@@ -0,0 +1,34 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
+// XFAIL: *
+
+// <chrono>
+// class month_day_last;
+//
+// template<class charT, class traits>
+// basic_ostream<charT, traits>&
+// operator<<(basic_ostream<charT, traits>& os, const month_day_last& mdl);
+//
+// Returns: os << mdl.month() << "/last".
+
+
+#include <chrono>
+#include <type_traits>
+#include <cassert>
+#include <iostream>
+
+#include "test_macros.h"
+
+int main()
+{
+ using month_day_last = std::chrono::month_day_last;
+ using month = std::chrono::month;
+ std::cout << month_day_last{month{1}};
+}
diff --git a/test/std/language.support/support.dynamic/new.delete/new.delete.single/new_size_align.fail.cpp b/test/std/utilities/time/time.cal/time.cal.mdlast/types.pass.cpp
index c3cabbdb79d5d..de15cabd070d9 100644
--- a/test/std/language.support/support.dynamic/new.delete/new.delete.single/new_size_align.fail.cpp
+++ b/test/std/utilities/time/time.cal/time.cal.mdlast/types.pass.cpp
@@ -1,4 +1,3 @@
-// -*- C++ -*-
//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
@@ -7,19 +6,22 @@
// Source Licenses. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
+// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
-// <new>
-
-// void* operator new(std::size_t, std::align_val_t);
+// <chrono>
-// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
-// UNSUPPORTED: clang-3.3, clang-3.4, clang-3.5, clang-3.6, clang-3.7, clang-3.8
+// class month_day_last;
-#include <new>
+#include <chrono>
+#include <type_traits>
+#include <cassert>
#include "test_macros.h"
-int main ()
+int main()
{
- ::operator new(4, std::align_val_t{4}); // expected-error {{ignoring return value of function declared with 'nodiscard' attribute}}
+ using month_day_last = std::chrono::month_day_last;
+
+ static_assert(std::is_trivially_copyable_v<month_day_last>, "");
+ static_assert(std::is_standard_layout_v<month_day_last>, "");
}
diff --git a/test/std/utilities/time/time.cal/time.cal.month/time.cal.month.members/ctor.pass.cpp b/test/std/utilities/time/time.cal/time.cal.month/time.cal.month.members/ctor.pass.cpp
new file mode 100644
index 0000000000000..5e86f58ec9d00
--- /dev/null
+++ b/test/std/utilities/time/time.cal/time.cal.month/time.cal.month.members/ctor.pass.cpp
@@ -0,0 +1,46 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
+
+// <chrono>
+// class month;
+
+// month() = default;
+// explicit constexpr month(int m) noexcept;
+// explicit constexpr operator int() const noexcept;
+
+// Effects: Constructs an object of type month by initializing m_ with m.
+// The value held is unspecified if d is not in the range [0, 255].
+
+#include <chrono>
+#include <type_traits>
+#include <cassert>
+
+#include "test_macros.h"
+
+int main()
+{
+ using month = std::chrono::month;
+
+ ASSERT_NOEXCEPT(month{});
+ ASSERT_NOEXCEPT(month(1));
+ ASSERT_NOEXCEPT(static_cast<unsigned>(month(1)));
+
+ constexpr month m0{};
+ static_assert(static_cast<unsigned>(m0) == 0, "");
+
+ constexpr month m1{1};
+ static_assert(static_cast<unsigned>(m1) == 1, "");
+
+ for (unsigned i = 0; i <= 255; ++i)
+ {
+ month m(i);
+ assert(static_cast<unsigned>(m) == i);
+ }
+}
diff --git a/test/std/utilities/time/time.cal/time.cal.month/time.cal.month.members/decrement.pass.cpp b/test/std/utilities/time/time.cal/time.cal.month/time.cal.month.members/decrement.pass.cpp
new file mode 100644
index 0000000000000..b6d4848fbf9ac
--- /dev/null
+++ b/test/std/utilities/time/time.cal/time.cal.month/time.cal.month.members/decrement.pass.cpp
@@ -0,0 +1,53 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
+
+// <chrono>
+// class month;
+
+// constexpr month& operator--() noexcept;
+// constexpr month operator--(int) noexcept;
+
+
+#include <chrono>
+#include <type_traits>
+#include <cassert>
+
+#include "test_macros.h"
+
+template <typename M>
+constexpr bool testConstexpr()
+{
+ M m1{10};
+ if (static_cast<unsigned>(--m1) != 9) return false;
+ if (static_cast<unsigned>(m1--) != 9) return false;
+ if (static_cast<unsigned>(m1) != 8) return false;
+ return true;
+}
+
+int main()
+{
+ using month = std::chrono::month;
+
+ ASSERT_NOEXCEPT(--(std::declval<month&>()) );
+ ASSERT_NOEXCEPT( (std::declval<month&>())--);
+
+ ASSERT_SAME_TYPE(month , decltype( std::declval<month&>()--));
+ ASSERT_SAME_TYPE(month&, decltype(--std::declval<month&>() ));
+
+ static_assert(testConstexpr<month>(), "");
+
+ for (unsigned i = 10; i <= 20; ++i)
+ {
+ month month(i);
+ assert(static_cast<unsigned>(--month) == i - 1);
+ assert(static_cast<unsigned>(month--) == i - 1);
+ assert(static_cast<unsigned>(month) == i - 2);
+ }
+}
diff --git a/test/std/utilities/time/time.cal/time.cal.month/time.cal.month.members/increment.pass.cpp b/test/std/utilities/time/time.cal/time.cal.month/time.cal.month.members/increment.pass.cpp
new file mode 100644
index 0000000000000..2309490abb82c
--- /dev/null
+++ b/test/std/utilities/time/time.cal/time.cal.month/time.cal.month.members/increment.pass.cpp
@@ -0,0 +1,52 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
+
+// <chrono>
+// class month;
+
+// constexpr month& operator++() noexcept;
+// constexpr month operator++(int) noexcept;
+
+
+#include <chrono>
+#include <type_traits>
+#include <cassert>
+
+#include "test_macros.h"
+
+template <typename M>
+constexpr bool testConstexpr()
+{
+ M m1{1};
+ if (static_cast<unsigned>(++m1) != 2) return false;
+ if (static_cast<unsigned>(m1++) != 2) return false;
+ if (static_cast<unsigned>(m1) != 3) return false;
+ return true;
+}
+
+int main()
+{
+ using month = std::chrono::month;
+ ASSERT_NOEXCEPT(++(std::declval<month&>()) );
+ ASSERT_NOEXCEPT( (std::declval<month&>())++);
+
+ ASSERT_SAME_TYPE(month , decltype( std::declval<month&>()++));
+ ASSERT_SAME_TYPE(month&, decltype(++std::declval<month&>() ));
+
+ static_assert(testConstexpr<month>(), "");
+
+ for (unsigned i = 0; i <= 10; ++i)
+ {
+ month month(i);
+ assert(static_cast<unsigned>(++month) == i + 1);
+ assert(static_cast<unsigned>(month++) == i + 1);
+ assert(static_cast<unsigned>(month) == i + 2);
+ }
+}
diff --git a/test/std/utilities/time/time.cal/time.cal.month/time.cal.month.members/ok.pass.cpp b/test/std/utilities/time/time.cal/time.cal.month/time.cal.month.members/ok.pass.cpp
new file mode 100644
index 0000000000000..3382a63785651
--- /dev/null
+++ b/test/std/utilities/time/time.cal/time.cal.month/time.cal.month.members/ok.pass.cpp
@@ -0,0 +1,38 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
+
+// <chrono>
+// class month;
+
+// constexpr bool ok() const noexcept;
+// Returns: 1 <= d_ && d_ <= 12
+
+#include <chrono>
+#include <type_traits>
+#include <cassert>
+
+#include "test_macros.h"
+
+int main()
+{
+ using month = std::chrono::month;
+
+ ASSERT_NOEXCEPT( std::declval<const month>().ok());
+ ASSERT_SAME_TYPE(bool, decltype(std::declval<const month>().ok()));
+
+ static_assert(!month{0}.ok(), "");
+ static_assert( month{1}.ok(), "");
+
+ assert(!month{0}.ok());
+ for (unsigned i = 1; i <= 12; ++i)
+ assert(month{i}.ok());
+ for (unsigned i = 13; i <= 255; ++i)
+ assert(!month{i}.ok());
+}
diff --git a/test/std/utilities/time/time.cal/time.cal.month/time.cal.month.members/plus_minus_equal.pass.cpp b/test/std/utilities/time/time.cal/time.cal.month/time.cal.month.members/plus_minus_equal.pass.cpp
new file mode 100644
index 0000000000000..1e5a045ed4af1
--- /dev/null
+++ b/test/std/utilities/time/time.cal/time.cal.month/time.cal.month.members/plus_minus_equal.pass.cpp
@@ -0,0 +1,67 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
+
+// <chrono>
+// class month;
+
+// constexpr month& operator+=(const month& d) noexcept;
+// constexpr month& operator-=(const month& d) noexcept;
+
+#include <chrono>
+#include <type_traits>
+#include <cassert>
+
+#include "test_macros.h"
+
+template <typename M, typename Ms>
+constexpr bool testConstexpr()
+{
+ M m1{1};
+ if (static_cast<unsigned>(m1 += Ms{ 1}) != 2) return false;
+ if (static_cast<unsigned>(m1 += Ms{ 2}) != 4) return false;
+ if (static_cast<unsigned>(m1 += Ms{ 8}) != 12) return false;
+ if (static_cast<unsigned>(m1 -= Ms{ 1}) != 11) return false;
+ if (static_cast<unsigned>(m1 -= Ms{ 2}) != 9) return false;
+ if (static_cast<unsigned>(m1 -= Ms{ 8}) != 1) return false;
+ return true;
+}
+
+int main()
+{
+ using month = std::chrono::month;
+ using months = std::chrono::months;
+
+ ASSERT_NOEXCEPT(std::declval<month&>() += std::declval<months&>());
+ ASSERT_NOEXCEPT(std::declval<month&>() -= std::declval<months&>());
+ ASSERT_SAME_TYPE(month&, decltype(std::declval<month&>() += std::declval<months&>()));
+ ASSERT_SAME_TYPE(month&, decltype(std::declval<month&>() -= std::declval<months&>()));
+
+ static_assert(testConstexpr<month, months>(), "");
+
+ for (unsigned i = 1; i <= 10; ++i)
+ {
+ month month(i);
+ int exp = i + 10;
+ while (exp > 12)
+ exp -= 12;
+ assert(static_cast<unsigned>(month += months{10}) == static_cast<unsigned>(exp));
+ assert(static_cast<unsigned>(month) == static_cast<unsigned>(exp));
+ }
+
+ for (unsigned i = 1; i <= 10; ++i)
+ {
+ month month(i);
+ int exp = i - 9;
+ while (exp < 1)
+ exp += 12;
+ assert(static_cast<unsigned>(month -= months{ 9}) == static_cast<unsigned>(exp));
+ assert(static_cast<unsigned>(month) == static_cast<unsigned>(exp));
+ }
+}
diff --git a/test/std/utilities/time/time.cal/time.cal.month/time.cal.month.nonmembers/comparisons.pass.cpp b/test/std/utilities/time/time.cal/time.cal.month/time.cal.month.nonmembers/comparisons.pass.cpp
new file mode 100644
index 0000000000000..21c6e0027b63e
--- /dev/null
+++ b/test/std/utilities/time/time.cal/time.cal.month/time.cal.month.nonmembers/comparisons.pass.cpp
@@ -0,0 +1,47 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
+
+// <chrono>
+// class month;
+
+// constexpr bool operator==(const month& x, const month& y) noexcept;
+// constexpr bool operator!=(const month& x, const month& y) noexcept;
+// constexpr bool operator< (const month& x, const month& y) noexcept;
+// constexpr bool operator> (const month& x, const month& y) noexcept;
+// constexpr bool operator<=(const month& x, const month& y) noexcept;
+// constexpr bool operator>=(const month& x, const month& y) noexcept;
+
+
+#include <chrono>
+#include <type_traits>
+#include <cassert>
+
+#include "test_macros.h"
+#include "test_comparisons.h"
+
+
+int main()
+{
+ using month = std::chrono::month;
+
+ AssertComparisons6AreNoexcept<month>();
+ AssertComparisons6ReturnBool<month>();
+
+ static_assert(testComparisons6Values<month>(0U ,0U), "");
+ static_assert(testComparisons6Values<month>(0U, 1U), "");
+
+// Some 'ok' values as well
+ static_assert(testComparisons6Values<month>( 5U, 5U), "");
+ static_assert(testComparisons6Values<month>( 5U, 10U), "");
+
+ for (unsigned i = 1; i < 10; ++i)
+ for (unsigned j = 10; j < 10; ++j)
+ assert(testComparisons6Values<month>(i, j));
+}
diff --git a/test/std/utilities/time/time.cal/time.cal.month/time.cal.month.nonmembers/literals.pass.cpp b/test/std/utilities/time/time.cal/time.cal.month/time.cal.month.nonmembers/literals.pass.cpp
new file mode 100644
index 0000000000000..2721a97666b67
--- /dev/null
+++ b/test/std/utilities/time/time.cal/time.cal.month/time.cal.month.nonmembers/literals.pass.cpp
@@ -0,0 +1,87 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
+
+// <chrono>
+
+// inline constexpr month January{1};
+// inline constexpr month February{2};
+// inline constexpr month March{3};
+// inline constexpr month April{4};
+// inline constexpr month May{5};
+// inline constexpr month June{6};
+// inline constexpr month July{7};
+// inline constexpr month August{8};
+// inline constexpr month September{9};
+// inline constexpr month October{10};
+// inline constexpr month November{11};
+// inline constexpr month December{12};
+
+
+#include <chrono>
+#include <type_traits>
+#include <cassert>
+
+#include "test_macros.h"
+
+int main()
+{
+
+ ASSERT_SAME_TYPE(const std::chrono::month, decltype(std::chrono::January));
+ ASSERT_SAME_TYPE(const std::chrono::month, decltype(std::chrono::February));
+ ASSERT_SAME_TYPE(const std::chrono::month, decltype(std::chrono::March));
+ ASSERT_SAME_TYPE(const std::chrono::month, decltype(std::chrono::April));
+ ASSERT_SAME_TYPE(const std::chrono::month, decltype(std::chrono::May));
+ ASSERT_SAME_TYPE(const std::chrono::month, decltype(std::chrono::June));
+ ASSERT_SAME_TYPE(const std::chrono::month, decltype(std::chrono::July));
+ ASSERT_SAME_TYPE(const std::chrono::month, decltype(std::chrono::August));
+ ASSERT_SAME_TYPE(const std::chrono::month, decltype(std::chrono::September));
+ ASSERT_SAME_TYPE(const std::chrono::month, decltype(std::chrono::October));
+ ASSERT_SAME_TYPE(const std::chrono::month, decltype(std::chrono::November));
+ ASSERT_SAME_TYPE(const std::chrono::month, decltype(std::chrono::December));
+
+ static_assert( std::chrono::January == std::chrono::month(1), "");
+ static_assert( std::chrono::February == std::chrono::month(2), "");
+ static_assert( std::chrono::March == std::chrono::month(3), "");
+ static_assert( std::chrono::April == std::chrono::month(4), "");
+ static_assert( std::chrono::May == std::chrono::month(5), "");
+ static_assert( std::chrono::June == std::chrono::month(6), "");
+ static_assert( std::chrono::July == std::chrono::month(7), "");
+ static_assert( std::chrono::August == std::chrono::month(8), "");
+ static_assert( std::chrono::September == std::chrono::month(9), "");
+ static_assert( std::chrono::October == std::chrono::month(10), "");
+ static_assert( std::chrono::November == std::chrono::month(11), "");
+ static_assert( std::chrono::December == std::chrono::month(12), "");
+
+ assert(std::chrono::January == std::chrono::month(1));
+ assert(std::chrono::February == std::chrono::month(2));
+ assert(std::chrono::March == std::chrono::month(3));
+ assert(std::chrono::April == std::chrono::month(4));
+ assert(std::chrono::May == std::chrono::month(5));
+ assert(std::chrono::June == std::chrono::month(6));
+ assert(std::chrono::July == std::chrono::month(7));
+ assert(std::chrono::August == std::chrono::month(8));
+ assert(std::chrono::September == std::chrono::month(9));
+ assert(std::chrono::October == std::chrono::month(10));
+ assert(std::chrono::November == std::chrono::month(11));
+ assert(std::chrono::December == std::chrono::month(12));
+
+ assert(static_cast<unsigned>(std::chrono::January) == 1);
+ assert(static_cast<unsigned>(std::chrono::February) == 2);
+ assert(static_cast<unsigned>(std::chrono::March) == 3);
+ assert(static_cast<unsigned>(std::chrono::April) == 4);
+ assert(static_cast<unsigned>(std::chrono::May) == 5);
+ assert(static_cast<unsigned>(std::chrono::June) == 6);
+ assert(static_cast<unsigned>(std::chrono::July) == 7);
+ assert(static_cast<unsigned>(std::chrono::August) == 8);
+ assert(static_cast<unsigned>(std::chrono::September) == 9);
+ assert(static_cast<unsigned>(std::chrono::October) == 10);
+ assert(static_cast<unsigned>(std::chrono::November) == 11);
+ assert(static_cast<unsigned>(std::chrono::December) == 12);
+}
diff --git a/test/std/utilities/time/time.cal/time.cal.month/time.cal.month.nonmembers/minus.pass.cpp b/test/std/utilities/time/time.cal/time.cal.month/time.cal.month.nonmembers/minus.pass.cpp
new file mode 100644
index 0000000000000..1329a9f956beb
--- /dev/null
+++ b/test/std/utilities/time/time.cal/time.cal.month/time.cal.month.nonmembers/minus.pass.cpp
@@ -0,0 +1,72 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
+
+// <chrono>
+// class month;
+
+// constexpr month operator-(const month& x, const months& y) noexcept;
+// Returns: x + -y.
+//
+// constexpr months operator-(const month& x, const month& y) noexcept;
+// Returns: If x.ok() == true and y.ok() == true, returns a value m in the range
+// [months{0}, months{11}] satisfying y + m == x.
+// Otherwise the value returned is unspecified.
+// [Example: January - February == months{11}. —end example]
+
+extern "C" int printf(const char *, ...);
+
+#include <chrono>
+#include <type_traits>
+#include <cassert>
+
+#include "test_macros.h"
+
+template <typename M, typename Ms>
+constexpr bool testConstexpr()
+{
+ {
+ M m{5};
+ Ms offset{3};
+ if (m - offset != M{2}) return false;
+ if (m - M{2} != offset) return false;
+ }
+
+// Check the example
+ if (M{1} - M{2} != Ms{11}) return false;
+ return true;
+}
+
+#include <iostream>
+
+int main()
+{
+ using month = std::chrono::month;
+ using months = std::chrono::months;
+
+ ASSERT_NOEXCEPT(std::declval<month>() - std::declval<months>());
+ ASSERT_NOEXCEPT(std::declval<month>() - std::declval<month>());
+
+ ASSERT_SAME_TYPE(month , decltype(std::declval<month>() - std::declval<months>()));
+ ASSERT_SAME_TYPE(months, decltype(std::declval<month>() - std::declval<month> ()));
+
+static_assert(testConstexpr<month, months>(), "");
+
+ month m{6};
+ for (unsigned i = 1; i <= 12; ++i)
+ {
+ month m1 = m - months{i};
+// months off = m - month {i};
+ int exp = 6 - i;
+ if (exp < 1)
+ exp += 12;
+ assert(static_cast<unsigned>(m1) == static_cast<unsigned>(exp));
+// assert(off.count() == static_cast<unsigned>(exp));
+ }
+}
diff --git a/test/std/utilities/time/time.cal/time.cal.month/time.cal.month.nonmembers/plus.pass.cpp b/test/std/utilities/time/time.cal/time.cal.month/time.cal.month.nonmembers/plus.pass.cpp
new file mode 100644
index 0000000000000..749635f813d2f
--- /dev/null
+++ b/test/std/utilities/time/time.cal/time.cal.month/time.cal.month.nonmembers/plus.pass.cpp
@@ -0,0 +1,72 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
+
+// <chrono>
+// class month;
+
+// constexpr month operator+(const month& x, const months& y) noexcept;
+// Returns: month(int{x} + y.count()).
+//
+// constexpr month operator+(const months& x, const month& y) noexcept;
+// Returns:
+// month{modulo(static_cast<long long>(int{x}) + (y.count() - 1), 12) + 1}
+// where modulo(n, 12) computes the remainder of n divided by 12 using Euclidean division.
+// [Note: Given a divisor of 12, Euclidean division truncates towards negative infinity
+// and always produces a remainder in the range of [0, 11].
+// Assuming no overflow in the signed summation, this operation results in a month
+// holding a value in the range [1, 12] even if !x.ok(). —end note]
+// [Example: February + months{11} == January. —end example]
+
+
+
+#include <chrono>
+#include <type_traits>
+#include <cassert>
+
+#include "test_macros.h"
+
+template <typename M, typename Ms>
+constexpr bool testConstexpr()
+{
+ M m{1};
+ Ms offset{4};
+ if (m + offset != M{5}) return false;
+ if (offset + m != M{5}) return false;
+// Check the example
+ if (M{2} + Ms{11} != M{1}) return false;
+ return true;
+}
+
+int main()
+{
+ using month = std::chrono::month;
+ using months = std::chrono::months;
+
+ ASSERT_NOEXCEPT(std::declval<month>() + std::declval<months>());
+ ASSERT_NOEXCEPT(std::declval<months>() + std::declval<month>());
+
+ ASSERT_SAME_TYPE(month, decltype(std::declval<month>() + std::declval<months>()));
+ ASSERT_SAME_TYPE(month, decltype(std::declval<months>() + std::declval<month>() ));
+
+ static_assert(testConstexpr<month, months>(), "");
+
+ month my{2};
+ for (unsigned i = 0; i <= 15; ++i)
+ {
+ month m1 = my + months{i};
+ month m2 = months{i} + my;
+ assert(m1 == m2);
+ unsigned exp = i + 2;
+ while (exp > 12)
+ exp -= 12;
+ assert(static_cast<unsigned>(m1) == exp);
+ assert(static_cast<unsigned>(m2) == exp);
+ }
+}
diff --git a/test/std/utilities/time/time.cal/time.cal.month/time.cal.month.nonmembers/streaming.pass.cpp b/test/std/utilities/time/time.cal/time.cal.month/time.cal.month.nonmembers/streaming.pass.cpp
new file mode 100644
index 0000000000000..abc2c1edc9bbf
--- /dev/null
+++ b/test/std/utilities/time/time.cal/time.cal.month/time.cal.month.nonmembers/streaming.pass.cpp
@@ -0,0 +1,53 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
+// XFAIL: *
+
+// <chrono>
+// class month;
+
+// template<class charT, class traits>
+// basic_ostream<charT, traits>&
+// operator<<(basic_ostream<charT, traits>& os, const month& m);
+//
+// Effects: If m.ok() == true inserts format(os.getloc(), fmt, m) where fmt is "%b" widened to charT.
+// Otherwise inserts int{m} << " is not a valid month".
+//
+// template<class charT, class traits>
+// basic_ostream<charT, traits>&
+// to_stream(basic_ostream<charT, traits>& os, const charT* fmt, const month& m);
+//
+// Effects: Streams m into os using the format specified by the NTCTS fmt.
+// fmt encoding follows the rules specified in 25.11.
+//
+// template<class charT, class traits, class Alloc = allocator<charT>>
+// basic_istream<charT, traits>&
+// from_stream(basic_istream<charT, traits>& is, const charT* fmt,
+// month& m, basic_string<charT, traits, Alloc>* abbrev = nullptr,
+// minutes* offset = nullptr);
+//
+// Effects: Attempts to parse the input stream is into the month m using the format flags
+// given in the NTCTS fmt as specified in 25.12. If the parse fails to decode a valid month,
+// is.setstate(ios_- base::failbit) shall be called and m shall not be modified.
+// If %Z is used and successfully parsed, that value will be assigned to *abbrev if
+// abbrev is non-null. If %z (or a modified variant) is used and successfully parsed,
+// that value will be assigned to *offset if offset is non-null.
+
+#include <chrono>
+#include <type_traits>
+#include <cassert>
+#include <iostream>
+
+#include "test_macros.h"
+
+int main()
+{
+ using month = std::chrono::month;
+ std::cout << month{1};
+}
diff --git a/test/std/utilities/time/time.cal/time.cal.month/types.pass.cpp b/test/std/utilities/time/time.cal/time.cal.month/types.pass.cpp
new file mode 100644
index 0000000000000..af7532c7b713a
--- /dev/null
+++ b/test/std/utilities/time/time.cal/time.cal.month/types.pass.cpp
@@ -0,0 +1,26 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
+
+// <chrono>
+// class month;
+
+#include <chrono>
+#include <type_traits>
+#include <cassert>
+
+#include "test_macros.h"
+
+int main()
+{
+ using month = std::chrono::month;
+
+ static_assert(std::is_trivially_copyable_v<month>, "");
+ static_assert(std::is_standard_layout_v<month>, "");
+}
diff --git a/test/std/utilities/time/time.cal/time.cal.mwd/time.cal.mwd.members/ctor.pass.cpp b/test/std/utilities/time/time.cal/time.cal.mwd/time.cal.mwd.members/ctor.pass.cpp
new file mode 100644
index 0000000000000..445b86dde27c3
--- /dev/null
+++ b/test/std/utilities/time/time.cal/time.cal.mwd/time.cal.mwd.members/ctor.pass.cpp
@@ -0,0 +1,46 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
+
+// <chrono>
+// class month_weekday;
+// month_weekday represents the nth weekday of a month, of an as yet unspecified year.
+
+// constexpr month_weekday(const chrono::month& m, const chrono::weekday_indexed& wdi) noexcept;
+// Effects: Constructs an object of type month_weekday by initializing m_ with m, and wdi_ with wdi.
+//
+// constexpr chrono::month month() const noexcept;
+// constexpr chrono::weekday_indexed weekday_indexed() const noexcept;
+// constexpr bool ok() const noexcept;
+
+#include <chrono>
+#include <type_traits>
+#include <cassert>
+
+#include "test_macros.h"
+
+int main()
+{
+ using month_weekday = std::chrono::month_weekday;
+ using month = std::chrono::month;
+ using weekday = std::chrono::weekday;
+ using weekday_indexed = std::chrono::weekday_indexed;
+
+ ASSERT_NOEXCEPT(month_weekday{month{1}, weekday_indexed{weekday{}, 1}});
+
+ constexpr month_weekday md0{month{}, weekday_indexed{}};
+ static_assert( md0.month() == month{}, "");
+ static_assert( md0.weekday_indexed() == weekday_indexed{}, "");
+ static_assert(!md0.ok(), "");
+
+ constexpr month_weekday md1{std::chrono::January, weekday_indexed{std::chrono::Friday, 4}};
+ static_assert( md1.month() == std::chrono::January, "");
+ static_assert( md1.weekday_indexed() == weekday_indexed{std::chrono::Friday, 4}, "");
+ static_assert( md1.ok(), "");
+}
diff --git a/test/std/utilities/time/time.cal/time.cal.mwd/time.cal.mwd.members/month.pass.cpp b/test/std/utilities/time/time.cal/time.cal.mwd/time.cal.mwd.members/month.pass.cpp
new file mode 100644
index 0000000000000..f915b6deb4d7a
--- /dev/null
+++ b/test/std/utilities/time/time.cal/time.cal.mwd/time.cal.mwd.members/month.pass.cpp
@@ -0,0 +1,42 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
+
+// <chrono>
+// class month_weekday;
+
+// constexpr chrono::month month() const noexcept;
+// Returns: wd_
+
+#include <chrono>
+#include <type_traits>
+#include <cassert>
+
+#include "test_macros.h"
+
+int main()
+{
+ using month_weekday = std::chrono::month_weekday;
+ using month = std::chrono::month;
+ using weekday = std::chrono::weekday;
+ using weekday_indexed = std::chrono::weekday_indexed;
+
+ constexpr weekday Sunday = std::chrono::Sunday;
+
+ ASSERT_NOEXCEPT( std::declval<const month_weekday>().month());
+ ASSERT_SAME_TYPE(month, decltype(std::declval<const month_weekday>().month()));
+
+ static_assert( month_weekday{}.month() == month{}, "");
+
+ for (unsigned i = 1; i <= 50; ++i)
+ {
+ month_weekday md(month{i}, weekday_indexed{Sunday, 1});
+ assert( static_cast<unsigned>(md.month()) == i);
+ }
+}
diff --git a/test/std/utilities/time/time.cal/time.cal.mwd/time.cal.mwd.members/ok.pass.cpp b/test/std/utilities/time/time.cal/time.cal.mwd/time.cal.mwd.members/ok.pass.cpp
new file mode 100644
index 0000000000000..11d9e28766ef0
--- /dev/null
+++ b/test/std/utilities/time/time.cal/time.cal.mwd/time.cal.mwd.members/ok.pass.cpp
@@ -0,0 +1,51 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
+
+// <chrono>
+// class month_weekday;
+
+// constexpr bool ok() const noexcept;
+// Returns: m_.ok() && wdi_.ok().
+
+#include <chrono>
+#include <type_traits>
+#include <cassert>
+
+#include "test_macros.h"
+
+int main()
+{
+ using month_weekday = std::chrono::month_weekday;
+ using month = std::chrono::month;
+ using weekday = std::chrono::weekday;
+ using weekday_indexed = std::chrono::weekday_indexed;
+
+ constexpr weekday Sunday = std::chrono::Sunday;
+
+ ASSERT_NOEXCEPT( std::declval<const month_weekday>().ok());
+ ASSERT_SAME_TYPE(bool, decltype(std::declval<const month_weekday>().ok()));
+
+ static_assert(!month_weekday{month{}, weekday_indexed{}}.ok(), "");
+ static_assert( month_weekday{std::chrono::May, weekday_indexed{Sunday, 2}}.ok(), "");
+
+ assert(!(month_weekday(std::chrono::April, weekday_indexed{Sunday, 0}).ok()));
+ assert( (month_weekday{std::chrono::March, weekday_indexed{Sunday, 1}}.ok()));
+
+ for (unsigned i = 1; i <= 12; ++i)
+ for (unsigned j = 0; j <= 6; ++j)
+ {
+ month_weekday mwd{month{i}, weekday_indexed{Sunday, j}};
+ assert(mwd.ok() == (j >= 1 && j <= 5));
+ }
+
+// If the month is not ok, all the weekday_indexed are bad
+ for (unsigned i = 1; i <= 10; ++i)
+ assert(!(month_weekday{month{13}, weekday_indexed{Sunday, i}}.ok()));
+}
diff --git a/test/std/utilities/time/time.cal/time.cal.mwd/time.cal.mwd.members/weekday_indexed.pass.cpp b/test/std/utilities/time/time.cal/time.cal.mwd/time.cal.mwd.members/weekday_indexed.pass.cpp
new file mode 100644
index 0000000000000..3eb67259c787f
--- /dev/null
+++ b/test/std/utilities/time/time.cal/time.cal.mwd/time.cal.mwd.members/weekday_indexed.pass.cpp
@@ -0,0 +1,43 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
+
+// <chrono>
+// class month_weekday;
+
+// constexpr chrono::weekday_indexed weekday_indexed() const noexcept;
+// Returns: wdi_
+
+#include <chrono>
+#include <type_traits>
+#include <cassert>
+
+#include "test_macros.h"
+
+int main()
+{
+ using month_weekday = std::chrono::month_weekday;
+ using month = std::chrono::month;
+ using weekday = std::chrono::weekday;
+ using weekday_indexed = std::chrono::weekday_indexed;
+
+ constexpr weekday Sunday = std::chrono::Sunday;
+
+ ASSERT_NOEXCEPT( std::declval<const month_weekday>().weekday_indexed());
+ ASSERT_SAME_TYPE(weekday_indexed, decltype(std::declval<const month_weekday>().weekday_indexed()));
+
+ static_assert( month_weekday{month{}, weekday_indexed{}}.weekday_indexed() == weekday_indexed{}, "");
+
+ for (unsigned i = 1; i <= 10; ++i)
+ {
+ month_weekday md(std::chrono::March, weekday_indexed{Sunday, i});
+ assert( static_cast<unsigned>(md.weekday_indexed().weekday() == Sunday));
+ assert( static_cast<unsigned>(md.weekday_indexed().index() == i));
+ }
+}
diff --git a/test/std/utilities/time/time.cal/time.cal.mwd/time.cal.mwd.nonmembers/comparisons.pass.cpp b/test/std/utilities/time/time.cal/time.cal.mwd/time.cal.mwd.nonmembers/comparisons.pass.cpp
new file mode 100644
index 0000000000000..21779843a78f2
--- /dev/null
+++ b/test/std/utilities/time/time.cal/time.cal.mwd/time.cal.mwd.nonmembers/comparisons.pass.cpp
@@ -0,0 +1,86 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
+
+// <chrono>
+// class month_weekday;
+
+// constexpr bool operator==(const month_weekday& x, const month_weekday& y) noexcept;
+// Returns: x.month() == y.month() && x.day() == y.day().
+//
+
+#include <chrono>
+#include <type_traits>
+#include <cassert>
+
+#include "test_macros.h"
+#include "test_comparisons.h"
+
+int main()
+{
+ using month_weekday = std::chrono::month_weekday;
+ using month = std::chrono::month;
+ using weekday_indexed = std::chrono::weekday_indexed;
+ using weekday = std::chrono::weekday;
+
+ constexpr weekday Sunday = std::chrono::Sunday;
+ constexpr weekday Monday = std::chrono::Monday;
+
+ AssertComparisons2AreNoexcept<month_weekday>();
+ AssertComparisons2ReturnBool<month_weekday>();
+
+ static_assert( testComparisons2(
+ month_weekday{std::chrono::January, weekday_indexed{Sunday, 1}},
+ month_weekday{std::chrono::January, weekday_indexed{Sunday, 1}},
+ true), "");
+
+ static_assert( testComparisons2(
+ month_weekday{std::chrono::January, weekday_indexed{Sunday, 1}},
+ month_weekday{std::chrono::January, weekday_indexed{Sunday, 2}},
+ false), "");
+
+ static_assert( testComparisons2(
+ month_weekday{std::chrono::January, weekday_indexed{Sunday, 1}},
+ month_weekday{std::chrono::February, weekday_indexed{Sunday, 1}},
+ false), "");
+
+ static_assert( testComparisons2(
+ month_weekday{std::chrono::January, weekday_indexed{Monday, 1}},
+ month_weekday{std::chrono::January, weekday_indexed{Sunday, 2}},
+ false), "");
+
+ static_assert( testComparisons2(
+ month_weekday{std::chrono::January, weekday_indexed{Monday, 1}},
+ month_weekday{std::chrono::February, weekday_indexed{Sunday, 1}},
+ false), "");
+
+// same day, different months
+ for (unsigned i = 1; i < 12; ++i)
+ for (unsigned j = 1; j < 12; ++j)
+ assert((testComparisons2(
+ month_weekday{month{i}, weekday_indexed{Sunday, 1}},
+ month_weekday{month{j}, weekday_indexed{Sunday, 1}},
+ i == j)));
+
+// same month, different weeks
+ for (unsigned i = 1; i < 5; ++i)
+ for (unsigned j = 1; j < 5; ++j)
+ assert((testComparisons2(
+ month_weekday{month{2}, weekday_indexed{Sunday, i}},
+ month_weekday{month{2}, weekday_indexed{Sunday, j}},
+ i == j)));
+
+// same month, different days
+ for (unsigned i = 0; i < 6; ++i)
+ for (unsigned j = 0; j < 6; ++j)
+ assert((testComparisons2(
+ month_weekday{month{2}, weekday_indexed{weekday{i}, 2}},
+ month_weekday{month{2}, weekday_indexed{weekday{j}, 2}},
+ i == j)));
+}
diff --git a/test/std/utilities/time/time.cal/time.cal.mwd/time.cal.mwd.nonmembers/streaming.pass.cpp b/test/std/utilities/time/time.cal/time.cal.mwd/time.cal.mwd.nonmembers/streaming.pass.cpp
new file mode 100644
index 0000000000000..3858731f59338
--- /dev/null
+++ b/test/std/utilities/time/time.cal/time.cal.mwd/time.cal.mwd.nonmembers/streaming.pass.cpp
@@ -0,0 +1,36 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
+// XFAIL: *
+
+// <chrono>
+// class month_weekday;
+
+// template<class charT, class traits>
+// basic_ostream<charT, traits>&
+// operator<<(basic_ostream<charT, traits>& os, const month_weekday& mwd);
+//
+// Returns: os << mwd.month() << '/' << mwd.weekday_indexed().
+
+#include <chrono>
+#include <type_traits>
+#include <cassert>
+#include <iostream>
+
+#include "test_macros.h"
+
+int main()
+{
+ using month_weekday = std::chrono::month_weekday;
+ using month = std::chrono::month;
+ using weekday_indexed = std::chrono::weekday_indexed;
+ using weekday = std::chrono::weekday;
+
+ std::cout << month_weekday{month{1}, weekday_indexed{weekday{3}, 3}};
+}
diff --git a/test/std/utilities/time/time.cal/time.cal.mwd/types.pass.cpp b/test/std/utilities/time/time.cal/time.cal.mwd/types.pass.cpp
new file mode 100644
index 0000000000000..86479d8caae42
--- /dev/null
+++ b/test/std/utilities/time/time.cal/time.cal.mwd/types.pass.cpp
@@ -0,0 +1,26 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
+
+// <chrono>
+// class month_weekday;
+
+#include <chrono>
+#include <type_traits>
+#include <cassert>
+
+#include "test_macros.h"
+
+int main()
+{
+ using month_weekday = std::chrono::month_weekday;
+
+ static_assert(std::is_trivially_copyable_v<month_weekday>, "");
+ static_assert(std::is_standard_layout_v<month_weekday>, "");
+}
diff --git a/test/std/utilities/time/time.cal/time.cal.mwdlast/time.cal.mwdlast.members/ctor.pass.cpp b/test/std/utilities/time/time.cal/time.cal.mwdlast/time.cal.mwdlast.members/ctor.pass.cpp
new file mode 100644
index 0000000000000..2dd64eb80b6c3
--- /dev/null
+++ b/test/std/utilities/time/time.cal/time.cal.mwdlast/time.cal.mwdlast.members/ctor.pass.cpp
@@ -0,0 +1,60 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
+
+// <chrono>
+// class month_weekday_last;
+
+// constexpr month_weekday_last(const chrono::month& m,
+// const chrono::weekday_last& wdl) noexcept;
+//
+// Effects: Constructs an object of type month_weekday_last by
+// initializing m_ with m, and wdl_ with wdl.
+//
+// constexpr chrono::month month() const noexcept;
+// constexpr chrono::weekday_last weekday_last() const noexcept;
+// constexpr bool ok() const noexcept;
+
+
+#include <chrono>
+#include <type_traits>
+#include <cassert>
+
+#include "test_macros.h"
+
+int main()
+{
+ using month = std::chrono::month;
+ using weekday = std::chrono::weekday;
+ using weekday_last = std::chrono::weekday_last;
+ using month_weekday_last = std::chrono::month_weekday_last;
+
+ constexpr month January = std::chrono::January;
+ constexpr weekday Tuesday = std::chrono::Tuesday;
+
+ ASSERT_NOEXCEPT(month_weekday_last{January, weekday_last{Tuesday}});
+
+// bad month
+ constexpr month_weekday_last mwdl1{month{}, weekday_last{Tuesday}};
+ static_assert( mwdl1.month() == month{}, "");
+ static_assert( mwdl1.weekday_last() == weekday_last{Tuesday}, "");
+ static_assert(!mwdl1.ok(), "");
+
+// bad weekday_last
+ constexpr month_weekday_last mwdl2{January, weekday_last{weekday{16}}};
+ static_assert( mwdl2.month() == January, "");
+ static_assert( mwdl2.weekday_last() == weekday_last{weekday{16}}, "");
+ static_assert(!mwdl2.ok(), "");
+
+// Good month and weekday_last
+ constexpr month_weekday_last mwdl3{January, weekday_last{weekday{4}}};
+ static_assert( mwdl3.month() == January, "");
+ static_assert( mwdl3.weekday_last() == weekday_last{weekday{4}}, "");
+ static_assert( mwdl3.ok(), "");
+}
diff --git a/test/std/utilities/time/time.cal/time.cal.mwdlast/time.cal.mwdlast.members/month.pass.cpp b/test/std/utilities/time/time.cal/time.cal.mwdlast/time.cal.mwdlast.members/month.pass.cpp
new file mode 100644
index 0000000000000..155e030ff13a2
--- /dev/null
+++ b/test/std/utilities/time/time.cal/time.cal.mwdlast/time.cal.mwdlast.members/month.pass.cpp
@@ -0,0 +1,42 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
+
+// <chrono>
+// class month_weekday_last;
+
+// constexpr chrono::month month() const noexcept;
+// Returns: m_
+
+#include <chrono>
+#include <type_traits>
+#include <cassert>
+
+#include "test_macros.h"
+
+int main()
+{
+ using month = std::chrono::month;
+ using weekday = std::chrono::weekday;
+ using weekday_last = std::chrono::weekday_last;
+ using month_weekday_last = std::chrono::month_weekday_last;
+
+ constexpr weekday Tuesday = std::chrono::Tuesday;
+
+ ASSERT_NOEXCEPT( std::declval<const month_weekday_last>().month());
+ ASSERT_SAME_TYPE(month, decltype(std::declval<const month_weekday_last>().month()));
+
+ static_assert( month_weekday_last{month{}, weekday_last{Tuesday}}.month() == month{}, "");
+
+ for (unsigned i = 1; i <= 50; ++i)
+ {
+ month_weekday_last mdl(month{i}, weekday_last{Tuesday});
+ assert( static_cast<unsigned>(mdl.month()) == i);
+ }
+}
diff --git a/test/std/utilities/time/time.cal/time.cal.mwdlast/time.cal.mwdlast.members/ok.pass.cpp b/test/std/utilities/time/time.cal/time.cal.mwdlast/time.cal.mwdlast.members/ok.pass.cpp
new file mode 100644
index 0000000000000..b464fec33e5a9
--- /dev/null
+++ b/test/std/utilities/time/time.cal/time.cal.mwdlast/time.cal.mwdlast.members/ok.pass.cpp
@@ -0,0 +1,52 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
+
+// <chrono>
+// class month_weekday_last;
+
+// constexpr bool ok() const noexcept;
+// Returns: m_.ok() && wdl_.ok().
+
+#include <chrono>
+#include <type_traits>
+#include <cassert>
+
+#include "test_macros.h"
+
+int main()
+{
+ using month = std::chrono::month;
+ using weekday = std::chrono::weekday;
+ using weekday_last = std::chrono::weekday_last;
+ using month_weekday_last = std::chrono::month_weekday_last;
+
+ constexpr month January = std::chrono::January;
+ constexpr weekday Tuesday = std::chrono::Tuesday;
+ constexpr weekday_last lastTuesday = weekday_last{Tuesday};
+
+ ASSERT_NOEXCEPT( std::declval<const month_weekday_last>().ok());
+ ASSERT_SAME_TYPE(bool, decltype(std::declval<const month_weekday_last>().ok()));
+
+ static_assert(!month_weekday_last{month{}, lastTuesday}.ok(), ""); // Bad month
+ static_assert(!month_weekday_last{January, weekday_last{weekday{12}}}.ok(), ""); // Bad month
+ static_assert( month_weekday_last{January, lastTuesday}.ok(), ""); // Both OK
+
+ for (unsigned i = 0; i <= 50; ++i)
+ {
+ month_weekday_last mwdl{month{i}, lastTuesday};
+ assert( mwdl.ok() == month{i}.ok());
+ }
+
+ for (unsigned i = 0; i <= 50; ++i)
+ {
+ month_weekday_last mwdl{January, weekday_last{weekday{i}}};
+ assert( mwdl.ok() == weekday_last{weekday{i}}.ok());
+ }
+}
diff --git a/test/std/utilities/time/time.cal/time.cal.mwdlast/time.cal.mwdlast.members/weekday_last.pass.cpp b/test/std/utilities/time/time.cal/time.cal.mwdlast/time.cal.mwdlast.members/weekday_last.pass.cpp
new file mode 100644
index 0000000000000..1a687d962dcfc
--- /dev/null
+++ b/test/std/utilities/time/time.cal/time.cal.mwdlast/time.cal.mwdlast.members/weekday_last.pass.cpp
@@ -0,0 +1,44 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
+
+// <chrono>
+// class month_weekday_last;
+
+// constexpr chrono::weekday_last weekday_last() const noexcept;
+// Returns: wdl_
+
+#include <chrono>
+#include <type_traits>
+#include <cassert>
+
+#include "test_macros.h"
+
+int main()
+{
+ using month = std::chrono::month;
+ using weekday = std::chrono::weekday;
+ using weekday_last = std::chrono::weekday_last;
+ using month_weekday_last = std::chrono::month_weekday_last;
+
+ constexpr month January = std::chrono::January;
+ constexpr weekday Tuesday = std::chrono::Tuesday;
+ constexpr weekday_last lastTuesday = weekday_last{Tuesday};
+
+ ASSERT_NOEXCEPT( std::declval<const month_weekday_last>().weekday_last());
+ ASSERT_SAME_TYPE(weekday_last, decltype(std::declval<const month_weekday_last>().weekday_last()));
+
+ static_assert( month_weekday_last{month{}, lastTuesday}.weekday_last() == lastTuesday, "");
+
+ for (unsigned i = 1; i <= 50; ++i)
+ {
+ month_weekday_last mdl(January, weekday_last{weekday{i}});
+ assert( static_cast<unsigned>(mdl.weekday_last().weekday()) == i);
+ }
+}
diff --git a/test/std/utilities/time/time.cal/time.cal.mwdlast/time.cal.mwdlast.nonmembers/comparisons.pass.cpp b/test/std/utilities/time/time.cal/time.cal.mwdlast/time.cal.mwdlast.nonmembers/comparisons.pass.cpp
new file mode 100644
index 0000000000000..b3cd5ec2b23aa
--- /dev/null
+++ b/test/std/utilities/time/time.cal/time.cal.mwdlast/time.cal.mwdlast.nonmembers/comparisons.pass.cpp
@@ -0,0 +1,73 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
+
+// <chrono>
+// class month_weekday_last;
+
+// constexpr bool operator==(const month_weekday_last& x, const month_weekday_last& y) noexcept;
+// Returns: x.month() == y.month()
+//
+// constexpr bool operator< (const month_weekday_last& x, const month_weekday_last& y) noexcept;
+// Returns: x.month() < y.month()
+
+
+#include <chrono>
+#include <type_traits>
+#include <cassert>
+
+#include "test_macros.h"
+#include "test_comparisons.h"
+
+int main()
+{
+ using month = std::chrono::month;
+ using weekday_last = std::chrono::weekday_last;
+ using weekday = std::chrono::weekday;
+ using month_weekday_last = std::chrono::month_weekday_last;
+
+ constexpr month January = std::chrono::January;
+ constexpr weekday Tuesday = std::chrono::Tuesday;
+ constexpr weekday Wednesday = std::chrono::Wednesday;
+
+ AssertComparisons2AreNoexcept<month_weekday_last>();
+ AssertComparisons2ReturnBool<month_weekday_last>();
+
+ static_assert( testComparisons2(
+ month_weekday_last{std::chrono::January, weekday_last{Tuesday}},
+ month_weekday_last{std::chrono::January, weekday_last{Tuesday}},
+ true), "");
+
+ static_assert( testComparisons2(
+ month_weekday_last{std::chrono::January, weekday_last{Tuesday}},
+ month_weekday_last{std::chrono::January, weekday_last{Wednesday}},
+ false), "");
+
+// vary the months
+ for (unsigned i = 1; i < 12; ++i)
+ for (unsigned j = 1; j < 12; ++j)
+ assert((testComparisons2(
+ month_weekday_last{month{i}, weekday_last{Tuesday}},
+ month_weekday_last{month{j}, weekday_last{Tuesday}},
+ i == j)));
+
+// vary the weekday
+ for (unsigned i = 0; i < 6; ++i)
+ for (unsigned j = 0; j < 6; ++j)
+ assert((testComparisons2(
+ month_weekday_last{January, weekday_last{weekday{i}}},
+ month_weekday_last{January, weekday_last{weekday{j}}},
+ i == j)));
+
+// both different
+ assert((testComparisons2(
+ month_weekday_last{month{1}, weekday_last{weekday{1}}},
+ month_weekday_last{month{2}, weekday_last{weekday{2}}},
+ false)));
+}
diff --git a/test/std/utilities/time/time.cal/time.cal.mwdlast/time.cal.mwdlast.nonmembers/streaming.pass.cpp b/test/std/utilities/time/time.cal/time.cal.mwdlast/time.cal.mwdlast.nonmembers/streaming.pass.cpp
new file mode 100644
index 0000000000000..4e06812e00fc4
--- /dev/null
+++ b/test/std/utilities/time/time.cal/time.cal.mwdlast/time.cal.mwdlast.nonmembers/streaming.pass.cpp
@@ -0,0 +1,37 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
+// XFAIL: *
+
+// <chrono>
+// class month_weekday_last;
+//
+// template<class charT, class traits>
+// basic_ostream<charT, traits>&
+// operator<<(basic_ostream<charT, traits>& os, const month_weekday_last& mdl);
+//
+// Returns: os << mdl.month() << "/last".
+
+
+#include <chrono>
+#include <type_traits>
+#include <cassert>
+#include <iostream>
+
+#include "test_macros.h"
+
+int main()
+{
+ using month_weekday_last = std::chrono::month_weekday_last;
+ using month = std::chrono::month;
+ using weekday = std::chrono::weekday;
+ using weekday_last = std::chrono::weekday_last;
+
+ std::cout << month_weekday_last{month{1}, weekday_last{weekday{3}}};
+}
diff --git a/test/std/utilities/time/time.cal/time.cal.mwdlast/types.pass.cpp b/test/std/utilities/time/time.cal/time.cal.mwdlast/types.pass.cpp
new file mode 100644
index 0000000000000..43982f4b4f3fc
--- /dev/null
+++ b/test/std/utilities/time/time.cal/time.cal.mwdlast/types.pass.cpp
@@ -0,0 +1,27 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
+
+// <chrono>
+
+// class month_weekday_last;
+
+#include <chrono>
+#include <type_traits>
+#include <cassert>
+
+#include "test_macros.h"
+
+int main()
+{
+ using month_weekday_last = std::chrono::month_weekday_last;
+
+ static_assert(std::is_trivially_copyable_v<month_weekday_last>, "");
+ static_assert(std::is_standard_layout_v<month_weekday_last>, "");
+}
diff --git a/test/std/utilities/time/time.cal/time.cal.operators/month_day.pass.cpp b/test/std/utilities/time/time.cal/time.cal.operators/month_day.pass.cpp
new file mode 100644
index 0000000000000..146a0f180efb6
--- /dev/null
+++ b/test/std/utilities/time/time.cal/time.cal.operators/month_day.pass.cpp
@@ -0,0 +1,108 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
+
+// <chrono>
+// class month_day;
+
+// constexpr month_day
+// operator/(const month& m, const day& d) noexcept;
+// Returns: {m, d}.
+//
+// constexpr month_day
+// operator/(const day& d, const month& m) noexcept;
+// Returns: m / d.
+
+// constexpr month_day
+// operator/(const month& m, int d) noexcept;
+// Returns: m / day(d).
+//
+// constexpr month_day
+// operator/(int m, const day& d) noexcept;
+// Returns: month(m) / d.
+//
+// constexpr month_day
+// operator/(const day& d, int m) noexcept;
+// Returns: month(m) / d.
+
+
+#include <chrono>
+#include <type_traits>
+#include <cassert>
+
+#include "test_macros.h"
+#include "test_comparisons.h"
+
+int main()
+{
+ using month_day = std::chrono::month_day;
+ using month = std::chrono::month;
+ using day = std::chrono::day;
+
+ constexpr month February = std::chrono::February;
+
+ { // operator/(const month& m, const day& d) (and switched)
+ ASSERT_NOEXCEPT ( February/day{1});
+ ASSERT_SAME_TYPE(month_day, decltype(February/day{1}));
+ ASSERT_NOEXCEPT ( day{1}/February);
+ ASSERT_SAME_TYPE(month_day, decltype(day{1}/February));
+
+ for (int i = 1; i <= 12; ++i)
+ for (unsigned j = 0; j <= 30; ++j)
+ {
+ month m(i);
+ day d{j};
+ month_day md1 = m/d;
+ month_day md2 = d/m;
+ assert(md1.month() == m);
+ assert(md1.day() == d);
+ assert(md2.month() == m);
+ assert(md2.day() == d);
+ assert(md1 == md2);
+ }
+ }
+
+
+ { // operator/(const month& m, int d) (NOT switched)
+ ASSERT_NOEXCEPT ( February/2);
+ ASSERT_SAME_TYPE(month_day, decltype(February/2));
+
+ for (int i = 1; i <= 12; ++i)
+ for (unsigned j = 0; j <= 30; ++j)
+ {
+ month m(i);
+ day d(j);
+ month_day md1 = m/j;
+ assert(md1.month() == m);
+ assert(md1.day() == d);
+ }
+ }
+
+
+ { // operator/(const day& d, int m) (and switched)
+ ASSERT_NOEXCEPT ( day{2}/2);
+ ASSERT_SAME_TYPE(month_day, decltype(day{2}/2));
+ ASSERT_NOEXCEPT ( 2/day{2});
+ ASSERT_SAME_TYPE(month_day, decltype(2/day{2}));
+
+ for (int i = 1; i <= 12; ++i)
+ for (unsigned j = 0; j <= 30; ++j)
+ {
+ month m(i);
+ day d(j);
+ month_day md1 = d/i;
+ month_day md2 = i/d;
+ assert(md1.month() == m);
+ assert(md1.day() == d);
+ assert(md2.month() == m);
+ assert(md2.day() == d);
+ assert(md1 == md2);
+ }
+ }
+}
diff --git a/test/std/utilities/time/time.cal/time.cal.operators/month_day_last.pass.cpp b/test/std/utilities/time/time.cal/time.cal.operators/month_day_last.pass.cpp
new file mode 100644
index 0000000000000..f3f39c0dcc9dd
--- /dev/null
+++ b/test/std/utilities/time/time.cal/time.cal.operators/month_day_last.pass.cpp
@@ -0,0 +1,107 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
+
+// <chrono>
+// class month_day_last;
+
+// constexpr month_day_last
+// operator/(const month& m, last_spec) noexcept;
+// Returns: month_day_last{m}.
+//
+// constexpr month_day_last
+// operator/(int m, last_spec) noexcept;
+// Returns: month(m) / last.
+//
+// constexpr month_day_last
+// operator/(last_spec, const month& m) noexcept;
+// Returns: m / last.
+//
+// constexpr month_day_last
+// operator/(last_spec, int m) noexcept;
+// Returns: month(m) / last.
+//
+//
+// [Note: A month_day_last object can be constructed using the expression m/last or last/m,
+// where m is an expression of type month. — end note]
+// [Example:
+// constexpr auto mdl = February/last; // mdl is the last day of February of an as yet unspecified year
+// static_assert(mdl.month() == February);
+// --end example]
+
+
+
+
+
+
+#include <chrono>
+#include <type_traits>
+#include <cassert>
+
+#include "test_macros.h"
+#include "test_comparisons.h"
+
+int main()
+{
+ using month = std::chrono::month;
+ using month_day_last = std::chrono::month_day_last;
+
+ constexpr month February = std::chrono::February;
+ constexpr std::chrono::last_spec last = std::chrono::last;
+
+ ASSERT_SAME_TYPE(month_day_last, decltype(last/February));
+ ASSERT_SAME_TYPE(month_day_last, decltype(February/last));
+
+// Run the example
+ {
+ constexpr auto mdl = February/std::chrono::last;
+ static_assert(mdl.month() == February, "");
+ }
+
+ { // operator/(const month& m, last_spec) and switched
+ ASSERT_NOEXCEPT ( last/February);
+ ASSERT_SAME_TYPE(month_day_last, decltype(last/February));
+ ASSERT_NOEXCEPT ( February/last);
+ ASSERT_SAME_TYPE(month_day_last, decltype(February/last));
+
+ static_assert((last/February).month() == February, "");
+ static_assert((February/last).month() == February, "");
+
+ for (unsigned i = 1; i < 12; ++i)
+ {
+ month m{i};
+ month_day_last mdl1 = last/m;
+ month_day_last mdl2 = m/last;
+ assert(mdl1.month() == m);
+ assert(mdl2.month() == m);
+ assert(mdl1 == mdl2);
+ }
+ }
+
+ { // operator/(int, last_spec) and switched
+ ASSERT_NOEXCEPT ( last/2);
+ ASSERT_SAME_TYPE(month_day_last, decltype(last/2));
+ ASSERT_NOEXCEPT ( 2/last);
+ ASSERT_SAME_TYPE(month_day_last, decltype(2/last));
+
+ static_assert((last/2).month() == February, "");
+ static_assert((2/last).month() == February, "");
+
+ for (unsigned i = 1; i < 12; ++i)
+ {
+ month m{i};
+ month_day_last mdl1 = last/i;
+ month_day_last mdl2 = i/last;
+ assert(mdl1.month() == m);
+ assert(mdl2.month() == m);
+ assert(mdl1 == mdl2);
+ }
+ }
+
+}
diff --git a/test/std/utilities/time/time.cal/time.cal.operators/month_weekday.pass.cpp b/test/std/utilities/time/time.cal/time.cal.operators/month_weekday.pass.cpp
new file mode 100644
index 0000000000000..54b494268aa87
--- /dev/null
+++ b/test/std/utilities/time/time.cal/time.cal.operators/month_weekday.pass.cpp
@@ -0,0 +1,115 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
+
+// <chrono>
+// class month_weekday;
+
+// constexpr month_weekday
+// operator/(const month& m, const weekday_indexed& wdi) noexcept;
+// Returns: {m, wdi}.
+//
+// constexpr month_weekday
+// operator/(int m, const weekday_indexed& wdi) noexcept;
+// Returns: month(m) / wdi.
+//
+// constexpr month_weekday
+// operator/(const weekday_indexed& wdi, const month& m) noexcept;
+// Returns: m / wdi. constexpr month_weekday
+//
+// constexpr month_weekday
+// operator/(const weekday_indexed& wdi, int m) noexcept;
+// Returns: month(m) / wdi.
+
+
+//
+// [Example:
+// constexpr auto mwd = February/Tuesday[3]; // mwd is the third Tuesday of February of an as yet unspecified year
+// static_assert(mwd.month() == February);
+// static_assert(mwd.weekday_indexed() == Tuesday[3]);
+// —end example]
+
+
+
+
+#include <chrono>
+#include <type_traits>
+#include <cassert>
+
+#include "test_macros.h"
+#include "test_comparisons.h"
+
+int main()
+{
+ using month_weekday = std::chrono::month_weekday;
+ using month = std::chrono::month;
+ using weekday = std::chrono::weekday;
+ using weekday_indexed = std::chrono::weekday_indexed;
+
+ constexpr weekday Tuesday = std::chrono::Tuesday;
+ constexpr month February = std::chrono::February;
+
+ { // operator/(const month& m, const weekday_indexed& wdi) (and switched)
+ ASSERT_NOEXCEPT (February/Tuesday[2]);
+ ASSERT_SAME_TYPE(month_weekday, decltype(February/Tuesday[2]));
+ ASSERT_NOEXCEPT (Tuesday[2]/February);
+ ASSERT_SAME_TYPE(month_weekday, decltype(Tuesday[2]/February));
+
+ // Run the example
+ {
+ constexpr month_weekday wdi = February/Tuesday[3];
+ static_assert(wdi.month() == February, "");
+ static_assert(wdi.weekday_indexed() == Tuesday[3], "");
+ }
+
+ for (int i = 1; i <= 12; ++i)
+ for (unsigned j = 0; j <= 6; ++j)
+ for (unsigned k = 1; k <= 5; ++k)
+ {
+ month m(i);
+ weekday_indexed wdi = weekday{j}[k];
+ month_weekday mwd1 = m/wdi;
+ month_weekday mwd2 = wdi/m;
+ assert(mwd1.month() == m);
+ assert(mwd1.weekday_indexed() == wdi);
+ assert(mwd2.month() == m);
+ assert(mwd2.weekday_indexed() == wdi);
+ assert(mwd1 == mwd2);
+ }
+ }
+
+
+ { // operator/(int m, const weekday_indexed& wdi) (and switched)
+ ASSERT_NOEXCEPT (2/Tuesday[2]);
+ ASSERT_SAME_TYPE(month_weekday, decltype(2/Tuesday[2]));
+ ASSERT_NOEXCEPT (Tuesday[2]/2);
+ ASSERT_SAME_TYPE(month_weekday, decltype(Tuesday[2]/2));
+
+ // Run the example
+ {
+ constexpr month_weekday wdi = 2/Tuesday[3];
+ static_assert(wdi.month() == February, "");
+ static_assert(wdi.weekday_indexed() == Tuesday[3], "");
+ }
+
+ for (int i = 1; i <= 12; ++i)
+ for (unsigned j = 0; j <= 6; ++j)
+ for (unsigned k = 1; k <= 5; ++k)
+ {
+ weekday_indexed wdi = weekday{j}[k];
+ month_weekday mwd1 = i/wdi;
+ month_weekday mwd2 = wdi/i;
+ assert(mwd1.month() == month(i));
+ assert(mwd1.weekday_indexed() == wdi);
+ assert(mwd2.month() == month(i));
+ assert(mwd2.weekday_indexed() == wdi);
+ assert(mwd1 == mwd2);
+ }
+ }
+}
diff --git a/test/std/utilities/time/time.cal/time.cal.operators/month_weekday_last.pass.cpp b/test/std/utilities/time/time.cal/time.cal.operators/month_weekday_last.pass.cpp
new file mode 100644
index 0000000000000..516e0f182f489
--- /dev/null
+++ b/test/std/utilities/time/time.cal/time.cal.operators/month_weekday_last.pass.cpp
@@ -0,0 +1,107 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
+
+// <chrono>
+// class month_weekday_last;
+
+// constexpr month_weekday_last
+// operator/(const month& m, const weekday_last& wdl) noexcept;
+// Returns: {m, wdl}.
+//
+// constexpr month_weekday_last
+// operator/(int m, const weekday_last& wdl) noexcept;
+// Returns: month(m) / wdl.
+//
+// constexpr month_weekday_last
+// operator/(const weekday_last& wdl, const month& m) noexcept;
+// Returns: m / wdl.
+//
+// constexpr month_weekday_last
+// operator/(const weekday_last& wdl, int m) noexcept;
+// Returns: month(m) / wdl.
+
+
+
+
+#include <chrono>
+#include <type_traits>
+#include <cassert>
+
+#include "test_macros.h"
+#include "test_comparisons.h"
+
+int main()
+{
+ using month_weekday = std::chrono::month_weekday;
+ using month = std::chrono::month;
+ using weekday = std::chrono::weekday;
+ using weekday_last = std::chrono::weekday_last;
+ using month_weekday_last = std::chrono::month_weekday_last;
+
+ constexpr weekday Tuesday = std::chrono::Tuesday;
+ constexpr month February = std::chrono::February;
+ constexpr std::chrono::last_spec last = std::chrono::last;
+
+ { // operator/(const month& m, const weekday_last& wdi) (and switched)
+ ASSERT_NOEXCEPT (February/Tuesday[last]);
+ ASSERT_SAME_TYPE(month_weekday_last, decltype(February/Tuesday[last]));
+ ASSERT_NOEXCEPT (Tuesday[last]/February);
+ ASSERT_SAME_TYPE(month_weekday_last, decltype(Tuesday[last]/February));
+
+ // Run the example
+ {
+ constexpr month_weekday_last wdi = February/Tuesday[last];
+ static_assert(wdi.month() == February, "");
+ static_assert(wdi.weekday_last() == Tuesday[last], "");
+ }
+
+ for (int i = 1; i <= 12; ++i)
+ for (unsigned j = 0; j <= 6; ++j)
+ {
+ month m(i);
+ weekday_last wdi = weekday{j}[last];
+ month_weekday_last mwd1 = m/wdi;
+ month_weekday_last mwd2 = wdi/m;
+ assert(mwd1.month() == m);
+ assert(mwd1.weekday_last() == wdi);
+ assert(mwd2.month() == m);
+ assert(mwd2.weekday_last() == wdi);
+ assert(mwd1 == mwd2);
+ }
+ }
+
+
+ { // operator/(int m, const weekday_last& wdi) (and switched)
+ ASSERT_NOEXCEPT (2/Tuesday[2]);
+ ASSERT_SAME_TYPE(month_weekday_last, decltype(2/Tuesday[last]));
+ ASSERT_NOEXCEPT (Tuesday[2]/2);
+ ASSERT_SAME_TYPE(month_weekday_last, decltype(Tuesday[last]/2));
+
+ // Run the example
+ {
+ constexpr month_weekday wdi = 2/Tuesday[3];
+ static_assert(wdi.month() == February, "");
+ static_assert(wdi.weekday_indexed() == Tuesday[3], "");
+ }
+
+ for (int i = 1; i <= 12; ++i)
+ for (unsigned j = 0; j <= 6; ++j)
+ {
+ weekday_last wdi = weekday{j}[last];
+ month_weekday_last mwd1 = i/wdi;
+ month_weekday_last mwd2 = wdi/i;
+ assert(mwd1.month() == month(i));
+ assert(mwd1.weekday_last() == wdi);
+ assert(mwd2.month() == month(i));
+ assert(mwd2.weekday_last() == wdi);
+ assert(mwd1 == mwd2);
+ }
+ }
+}
diff --git a/test/std/utilities/time/time.cal/time.cal.operators/year_month.pass.cpp b/test/std/utilities/time/time.cal/time.cal.operators/year_month.pass.cpp
new file mode 100644
index 0000000000000..62e1c3acefed8
--- /dev/null
+++ b/test/std/utilities/time/time.cal/time.cal.operators/year_month.pass.cpp
@@ -0,0 +1,68 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
+
+// <chrono>
+// class year_month;
+
+// constexpr year_month operator/(const year& y, const month& m) noexcept;
+// Returns: {y, m}.
+//
+// constexpr year_month operator/(const year& y, int m) noexcept;
+// Returns: y / month(m).
+
+
+
+#include <chrono>
+#include <type_traits>
+#include <cassert>
+
+#include "test_macros.h"
+#include "test_comparisons.h"
+
+int main()
+{
+ using month = std::chrono::month;
+ using year = std::chrono::year;
+ using year_month = std::chrono::year_month;
+
+ constexpr month February = std::chrono::February;
+
+ { // operator/(const year& y, const month& m)
+ ASSERT_NOEXCEPT ( year{2018}/February);
+ ASSERT_SAME_TYPE(year_month, decltype(year{2018}/February));
+
+ static_assert((year{2018}/February).year() == year{2018}, "");
+ static_assert((year{2018}/February).month() == month{2}, "");
+ for (int i = 1000; i <= 1030; ++i)
+ for (unsigned j = 1; j <= 12; ++j)
+ {
+ year_month ym = year{i}/month{j};
+ assert(static_cast<int>(ym.year()) == i);
+ assert(static_cast<unsigned>(ym.month()) == j);
+ }
+ }
+
+
+ { // operator/(const year& y, const int m)
+ ASSERT_NOEXCEPT ( year{2018}/4);
+ ASSERT_SAME_TYPE(year_month, decltype(year{2018}/4));
+
+ static_assert((year{2018}/2).year() == year{2018}, "");
+ static_assert((year{2018}/2).month() == month{2}, "");
+
+ for (int i = 1000; i <= 1030; ++i)
+ for (unsigned j = 1; j <= 12; ++j)
+ {
+ year_month ym = year{i}/j;
+ assert(static_cast<int>(ym.year()) == i);
+ assert(static_cast<unsigned>(ym.month()) == j);
+ }
+ }
+}
diff --git a/test/std/utilities/time/time.cal/time.cal.operators/year_month_day.pass.cpp b/test/std/utilities/time/time.cal/time.cal.operators/year_month_day.pass.cpp
new file mode 100644
index 0000000000000..d2dfc1321fea8
--- /dev/null
+++ b/test/std/utilities/time/time.cal/time.cal.operators/year_month_day.pass.cpp
@@ -0,0 +1,191 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
+
+// <chrono>
+// class year_month_day;
+
+// constexpr year_month_day
+// operator/(const year_month& ym, const day& d) noexcept;
+// Returns: {ym.year(), ym.month(), d}.
+//
+// constexpr year_month_day
+// operator/(const year_month& ym, int d) noexcept;
+// Returns: ym / day(d).
+//
+// constexpr year_month_day
+// operator/(const year& y, const month_day& md) noexcept;
+// Returns: y / md.month() / md.day().
+//
+// constexpr year_month_day
+// operator/(int y, const month_day& md) noexcept;
+// Returns: year(y) / md.
+//
+// constexpr year_month_day
+// operator/(const month_day& md, const year& y) noexcept;
+// Returns: y / md.
+//
+// constexpr year_month_day
+// operator/(const month_day& md, int y) noexcept;
+// Returns: year(y) / md.
+
+
+#include <chrono>
+#include <type_traits>
+#include <cassert>
+
+#include "test_macros.h"
+#include "test_comparisons.h"
+
+int main()
+{
+ using year = std::chrono::year;
+ using month = std::chrono::month;
+ using day = std::chrono::day;
+ using year_month = std::chrono::year_month;
+ using month_day = std::chrono::month_day;
+ using year_month_day = std::chrono::year_month_day;
+
+ constexpr month February = std::chrono::February;
+ constexpr year_month Feb2018{year{2018}, February};
+
+ { // operator/(const year_month& ym, const day& d)
+ ASSERT_NOEXCEPT ( Feb2018/day{2});
+ ASSERT_SAME_TYPE(year_month_day, decltype(Feb2018/day{2}));
+
+ static_assert((Feb2018/day{2}).month() == February, "");
+ static_assert((Feb2018/day{2}).day() == day{2}, "");
+
+ for (int i = 1000; i < 1010; ++i)
+ for (int j = 1; j <= 12; ++j)
+ for (unsigned k = 0; k <= 28; ++k)
+ {
+ year y(i);
+ month m(j);
+ day d(k);
+ year_month ym(y, m);
+ year_month_day ymd = ym/d;
+ assert(ymd.year() == y);
+ assert(ymd.month() == m);
+ assert(ymd.day() == d);
+ }
+ }
+
+
+ { // operator/(const year_month& ym, int d)
+ ASSERT_NOEXCEPT ( Feb2018/2);
+ ASSERT_SAME_TYPE(year_month_day, decltype(Feb2018/2));
+
+ static_assert((Feb2018/2).month() == February, "");
+ static_assert((Feb2018/2).day() == day{2}, "");
+
+ for (int i = 1000; i < 1010; ++i)
+ for (int j = 1; j <= 12; ++j)
+ for (unsigned k = 0; k <= 28; ++k)
+ {
+ year y(i);
+ month m(j);
+ day d(k);
+ year_month ym(y, m);
+ year_month_day ymd = ym/k;
+ assert(ymd.year() == y);
+ assert(ymd.month() == m);
+ assert(ymd.day() == d);
+ }
+ }
+
+
+ { // operator/(const year_month& ym, int d)
+ ASSERT_NOEXCEPT ( Feb2018/2);
+ ASSERT_SAME_TYPE(year_month_day, decltype(Feb2018/2));
+
+ static_assert((Feb2018/2).month() == February, "");
+ static_assert((Feb2018/2).day() == day{2}, "");
+
+ for (int i = 1000; i < 1010; ++i)
+ for (int j = 1; j <= 12; ++j)
+ for (unsigned k = 0; k <= 28; ++k)
+ {
+ year y(i);
+ month m(j);
+ day d(k);
+ year_month ym(y, m);
+ year_month_day ymd = ym/k;
+ assert(ymd.year() == y);
+ assert(ymd.month() == m);
+ assert(ymd.day() == d);
+ }
+ }
+
+
+
+
+ { // operator/(const year& y, const month_day& md) (and switched)
+ ASSERT_NOEXCEPT ( year{2018}/month_day{February, day{2}});
+ ASSERT_SAME_TYPE(year_month_day, decltype(year{2018}/month_day{February, day{2}}));
+ ASSERT_NOEXCEPT ( month_day{February, day{2}}/year{2018});
+ ASSERT_SAME_TYPE(year_month_day, decltype(month_day{February, day{2}}/year{2018}));
+
+ static_assert((year{2018}/month_day{February, day{2}}).month() == February, "" );
+ static_assert((year{2018}/month_day{February, day{2}}).day() == day{2}, "" );
+ static_assert((month_day{February, day{2}}/year{2018}).month() == February, "" );
+ static_assert((month_day{February, day{2}}/year{2018}).day() == day{2}, "" );
+
+ for (int i = 1000; i < 1010; ++i)
+ for (int j = 1; j <= 12; ++j)
+ for (unsigned k = 0; k <= 28; ++k)
+ {
+ year y(i);
+ month m(j);
+ day d(k);
+ month_day md(m, d);
+ year_month_day ymd1 = y/md;
+ year_month_day ymd2 = md/y;
+ assert(ymd1.year() == y);
+ assert(ymd2.year() == y);
+ assert(ymd1.month() == m);
+ assert(ymd2.month() == m);
+ assert(ymd1.day() == d);
+ assert(ymd2.day() == d);
+ assert(ymd1 == ymd2);
+ }
+ }
+
+ { // operator/(const month_day& md, int y) (and switched)
+ ASSERT_NOEXCEPT ( 2018/month_day{February, day{2}});
+ ASSERT_SAME_TYPE(year_month_day, decltype(2018/month_day{February, day{2}}));
+ ASSERT_NOEXCEPT ( month_day{February, day{2}}/2018);
+ ASSERT_SAME_TYPE(year_month_day, decltype(month_day{February, day{2}}/2018));
+
+ static_assert((2018/month_day{February, day{2}}).month() == February, "" );
+ static_assert((2018/month_day{February, day{2}}).day() == day{2}, "" );
+ static_assert((month_day{February, day{2}}/2018).month() == February, "" );
+ static_assert((month_day{February, day{2}}/2018).day() == day{2}, "" );
+
+ for (int i = 1000; i < 1010; ++i)
+ for (int j = 1; j <= 12; ++j)
+ for (unsigned k = 0; k <= 28; ++k)
+ {
+ year y(i);
+ month m(j);
+ day d(k);
+ month_day md(m, d);
+ year_month_day ymd1 = i/md;
+ year_month_day ymd2 = md/i;
+ assert(ymd1.year() == y);
+ assert(ymd2.year() == y);
+ assert(ymd1.month() == m);
+ assert(ymd2.month() == m);
+ assert(ymd1.day() == d);
+ assert(ymd2.day() == d);
+ assert(ymd1 == ymd2);
+ }
+ }
+
+}
diff --git a/test/std/utilities/time/time.cal/time.cal.operators/year_month_day_last.pass.cpp b/test/std/utilities/time/time.cal/time.cal.operators/year_month_day_last.pass.cpp
new file mode 100644
index 0000000000000..dc884638dd2c1
--- /dev/null
+++ b/test/std/utilities/time/time.cal/time.cal.operators/year_month_day_last.pass.cpp
@@ -0,0 +1,125 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
+// <chrono>
+// class year_month_day_last;
+
+// constexpr year_month_day_last
+// operator/(const year_month& ym, last_spec) noexcept;
+// Returns: {ym.year(), month_day_last{ym.month()}}.
+
+
+// constexpr year_month_day_last
+// operator/(const year& y, const month_day_last& mdl) noexcept;
+// Returns: {y, mdl}.
+//
+// constexpr year_month_day_last
+// operator/(int y, const month_day_last& mdl) noexcept;
+// Returns: year(y) / mdl.
+//
+// constexpr year_month_day_last
+// operator/(const month_day_last& mdl, const year& y) noexcept;
+// Returns: y / mdl.
+//
+// constexpr year_month_day_last
+// operator/(const month_day_last& mdl, int y) noexcept;
+// Returns: year(y) / mdl.
+
+
+#include <chrono>
+#include <type_traits>
+#include <cassert>
+
+#include "test_macros.h"
+#include "test_comparisons.h"
+
+int main()
+{
+ using month = std::chrono::month;
+ using year_month = std::chrono::year_month;
+ using year = std::chrono::year;
+ using month_day_last = std::chrono::month_day_last;
+ using year_month_day_last = std::chrono::year_month_day_last;
+
+ constexpr month February = std::chrono::February;
+ constexpr std::chrono::last_spec last = std::chrono::last;
+
+ { // operator/(const year_month& ym, last_spec)
+ constexpr year_month Feb2018{year{2018}, February};
+
+ ASSERT_NOEXCEPT ( Feb2018/last);
+ ASSERT_SAME_TYPE(year_month_day_last, decltype(Feb2018/last));
+
+ static_assert((Feb2018/last).year() == year{2018}, "");
+ static_assert((Feb2018/last).month() == February, "");
+
+ for (int i = 1000; i < 1010; ++i)
+ for (unsigned j = 1; j <= 12; ++j)
+ {
+ year y{i};
+ month m{j};
+ year_month_day_last ymdl = year_month{y,m}/last;
+ assert(ymdl.year() == y);
+ assert(ymdl.month() == m);
+ }
+ }
+
+
+ { // operator/(const year& y, const month_day_last& mdl) (and switched)
+ ASSERT_NOEXCEPT ( year{2018}/month_day_last{February});
+ ASSERT_SAME_TYPE(year_month_day_last, decltype(year{2018}/month_day_last{February}));
+ ASSERT_NOEXCEPT ( month_day_last{February}/year{2018});
+ ASSERT_SAME_TYPE(year_month_day_last, decltype(month_day_last{February}/year{2018}));
+
+ static_assert((year{2018}/month_day_last{February}).month() == February, "");
+ static_assert((year{2018}/month_day_last{February}).year() == year{2018}, "");
+ static_assert((month_day_last{February}/year{2018}).month() == February, "");
+ static_assert((month_day_last{February}/year{2018}).year() == year{2018}, "");
+
+ for (int i = 1000; i < 1010; ++i)
+ for (unsigned j = 1; j <= 12; ++j)
+ {
+ year y{i};
+ month m{j};
+ year_month_day_last ymdl1 = y/month_day_last{m};
+ year_month_day_last ymdl2 = month_day_last{m}/y;
+ assert(ymdl1.month() == m);
+ assert(ymdl2.month() == m);
+ assert(ymdl2.year() == y);
+ assert(ymdl1.year() == y);
+ assert(ymdl1 == ymdl2);
+ }
+ }
+
+ { // operator/(int y, const month_day_last& mdl) (and switched)
+ ASSERT_NOEXCEPT ( 2018/month_day_last{February});
+ ASSERT_SAME_TYPE(year_month_day_last, decltype(2018/month_day_last{February}));
+ ASSERT_NOEXCEPT ( month_day_last{February}/2018);
+ ASSERT_SAME_TYPE(year_month_day_last, decltype(month_day_last{February}/2018));
+
+ static_assert((2018/month_day_last{February}).month() == February, "");
+ static_assert((2018/month_day_last{February}).year() == year{2018}, "");
+ static_assert((month_day_last{February}/2018).month() == February, "");
+ static_assert((month_day_last{February}/2018).year() == year{2018}, "");
+
+ for (int i = 1000; i < 1010; ++i)
+ for (unsigned j = 1; j <= 12; ++j)
+ {
+ year y{i};
+ month m{j};
+ year_month_day_last ymdl1 = i/month_day_last{m};
+ year_month_day_last ymdl2 = month_day_last{m}/i;
+ assert(ymdl1.month() == m);
+ assert(ymdl2.month() == m);
+ assert(ymdl2.year() == y);
+ assert(ymdl1.year() == y);
+ assert(ymdl1 == ymdl2);
+ }
+ }
+}
diff --git a/test/std/utilities/time/time.cal/time.cal.operators/year_month_weekday.pass.cpp b/test/std/utilities/time/time.cal/time.cal.operators/year_month_weekday.pass.cpp
new file mode 100644
index 0000000000000..56d88ca7c3a15
--- /dev/null
+++ b/test/std/utilities/time/time.cal/time.cal.operators/year_month_weekday.pass.cpp
@@ -0,0 +1,145 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
+
+// <chrono>
+// class year_month_weekday;
+
+// constexpr year_month_weekday
+// operator/(const year_month& ym, const weekday_indexed& wdi) noexcept;
+// Returns: {ym.year(), ym.month(), wdi}.
+//
+// constexpr year_month_weekday
+// operator/(const year& y, const month_weekday& mwd) noexcept;
+// Returns: {y, mwd.month(), mwd.weekday_indexed()}.
+//
+// constexpr year_month_weekday
+// operator/(int y, const month_weekday& mwd) noexcept;
+// Returns: year(y) / mwd.
+//
+// constexpr year_month_weekday
+// operator/(const month_weekday& mwd, const year& y) noexcept;
+// Returns: y / mwd.
+//
+// constexpr year_month_weekday
+// operator/(const month_weekday& mwd, int y) noexcept;
+// Returns: year(y) / mwd.
+
+#include <chrono>
+#include <type_traits>
+#include <cassert>
+
+#include "test_macros.h"
+#include "test_comparisons.h"
+
+int main()
+{
+ using year = std::chrono::year;
+ using year_month = std::chrono::year_month;
+ using month_weekday = std::chrono::month_weekday;
+ using year_month_weekday = std::chrono::year_month_weekday;
+ using month = std::chrono::month;
+ using weekday = std::chrono::weekday;
+ using weekday = std::chrono::weekday;
+ using weekday_indexed = std::chrono::weekday_indexed;
+
+ constexpr weekday Tuesday = std::chrono::Tuesday;
+ constexpr month February = std::chrono::February;
+
+
+ { // operator/(const year_month& ym, const weekday_indexed& wdi)
+ constexpr year_month Feb2018{year{2018}, February};
+
+ ASSERT_NOEXCEPT ( Feb2018/weekday_indexed{Tuesday, 2});
+ ASSERT_SAME_TYPE(year_month_weekday, decltype(Feb2018/weekday_indexed{Tuesday, 2}));
+
+ static_assert((Feb2018/weekday_indexed{Tuesday, 2}).year() == year{2018}, "" );
+ static_assert((Feb2018/weekday_indexed{Tuesday, 2}).month() == February, "" );
+ static_assert((Feb2018/weekday_indexed{Tuesday, 2}).weekday() == Tuesday, "" );
+
+ for (int i = 1000; i < 1010; ++i)
+ for (int j = 1; j <= 12; ++j)
+ for (unsigned k = 0; k <= 6; ++k)
+ for (unsigned l = 1; l <= 5; ++l)
+ {
+ year y(i);
+ month m(j);
+ weekday wd{k};
+ year_month_weekday ymd = year_month{y,m}/weekday_indexed{wd,l};
+ assert(ymd.year() == y);
+ assert(ymd.month() == m);
+ assert(ymd.weekday() == wd);
+ }
+ }
+
+ { // operator/(const year& y, const month_weekday& mwd) (and switched)
+ constexpr month_weekday Feb1stTues{February, weekday_indexed{Tuesday, 1}};
+ ASSERT_NOEXCEPT ( year{2018}/Feb1stTues);
+ ASSERT_SAME_TYPE(year_month_weekday, decltype(year{2018}/Feb1stTues));
+ ASSERT_NOEXCEPT ( Feb1stTues/year{2018});
+ ASSERT_SAME_TYPE(year_month_weekday, decltype(Feb1stTues/year{2018}));
+
+ static_assert((year{2018}/Feb1stTues).year() == year{2018}, "" );
+ static_assert((year{2018}/Feb1stTues).month() == February, "" );
+ static_assert((year{2018}/Feb1stTues).weekday() == Tuesday, "" );
+
+ for (int i = 1000; i < 1010; ++i)
+ for (int j = 1; j <= 12; ++j)
+ for (unsigned k = 0; k <= 6; ++k)
+ for (unsigned l = 1; l <= 5; ++l)
+ {
+ year y(i);
+ month m(j);
+ weekday wd{k};
+ month_weekday mwd{m, weekday_indexed{weekday{k}, l}};
+ year_month_weekday ymd1 = y/mwd;
+ year_month_weekday ymd2 = mwd/y;
+ assert(ymd1.year() == y);
+ assert(ymd2.year() == y);
+ assert(ymd1.month() == m);
+ assert(ymd2.month() == m);
+ assert(ymd1.weekday() == wd);
+ assert(ymd2.weekday() == wd);
+ assert(ymd1 == ymd2);
+ }
+ }
+
+
+ { // operator/(int y, const month_weekday& mwd) (and switched)
+ constexpr month_weekday Feb1stTues{February, weekday_indexed{Tuesday, 1}};
+ ASSERT_NOEXCEPT ( 2018/Feb1stTues);
+ ASSERT_SAME_TYPE(year_month_weekday, decltype(2018/Feb1stTues));
+ ASSERT_NOEXCEPT ( Feb1stTues/2018);
+ ASSERT_SAME_TYPE(year_month_weekday, decltype(Feb1stTues/2018));
+
+ static_assert((2018/Feb1stTues).year() == year{2018}, "" );
+ static_assert((2018/Feb1stTues).month() == February, "" );
+ static_assert((2018/Feb1stTues).weekday() == Tuesday, "" );
+
+ for (int i = 1000; i < 1010; ++i)
+ for (int j = 1; j <= 12; ++j)
+ for (unsigned k = 0; k <= 6; ++k)
+ for (unsigned l = 1; l <= 5; ++l)
+ {
+ year y(i);
+ month m(j);
+ weekday wd{k};
+ month_weekday mwd{m, weekday_indexed{weekday{k}, l}};
+ year_month_weekday ymd1 = i/mwd;
+ year_month_weekday ymd2 = mwd/i;
+ assert(ymd1.year() == y);
+ assert(ymd2.year() == y);
+ assert(ymd1.month() == m);
+ assert(ymd2.month() == m);
+ assert(ymd1.weekday() == wd);
+ assert(ymd2.weekday() == wd);
+ assert(ymd1 == ymd2);
+ }
+ }
+}
diff --git a/test/std/utilities/time/time.cal/time.cal.operators/year_month_weekday_last.pass.cpp b/test/std/utilities/time/time.cal/time.cal.operators/year_month_weekday_last.pass.cpp
new file mode 100644
index 0000000000000..84ea86c227bb9
--- /dev/null
+++ b/test/std/utilities/time/time.cal/time.cal.operators/year_month_weekday_last.pass.cpp
@@ -0,0 +1,153 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
+
+// <chrono>
+// class year_month_weekday_last;
+
+// constexpr year_month_weekday_last
+// operator/(const year_month& ym, const weekday_last& wdl) noexcept;
+// Returns: {ym.year(), ym.month(), wdl}.
+//
+// constexpr year_month_weekday_last
+// operator/(const year& y, const month_weekday_last& mwdl) noexcept;
+// Returns: {y, mwdl.month(), mwdl.weekday_last()}.
+//
+// constexpr year_month_weekday_last
+// operator/(int y, const month_weekday_last& mwdl) noexcept;
+// Returns: year(y) / mwdl.
+//
+// constexpr year_month_weekday_last
+// operator/(const month_weekday_last& mwdl, const year& y) noexcept;
+// Returns: y / mwdl.
+//
+// constexpr year_month_weekday_last
+// operator/(const month_weekday_last& mwdl, int y) noexcept;
+// Returns: year(y) / mwdl.
+
+
+
+#include <chrono>
+#include <type_traits>
+#include <cassert>
+
+#include "test_macros.h"
+#include "test_comparisons.h"
+
+int main()
+{
+ using year_month = std::chrono::year_month;
+ using year = std::chrono::year;
+ using month = std::chrono::month;
+ using weekday = std::chrono::weekday;
+ using weekday_last = std::chrono::weekday_last;
+ using month_weekday_last = std::chrono::month_weekday_last;
+ using year_month_weekday_last = std::chrono::year_month_weekday_last;
+
+ constexpr weekday Tuesday = std::chrono::Tuesday;
+ constexpr month February = std::chrono::February;
+
+ { // operator/(const year_month& ym, const weekday_last& wdl) (and switched)
+ constexpr year_month Feb2018{year{2018}, February};
+
+ ASSERT_NOEXCEPT ( Feb2018/weekday_last{Tuesday});
+ ASSERT_SAME_TYPE(year_month_weekday_last, decltype(Feb2018/weekday_last{Tuesday}));
+
+ static_assert((Feb2018/weekday_last{Tuesday}).year() == year{2018}, "");
+ static_assert((Feb2018/weekday_last{Tuesday}).month() == February, "");
+ static_assert((Feb2018/weekday_last{Tuesday}).weekday() == Tuesday, "");
+
+ for (int i = 1000; i < 1010; ++i)
+ for (unsigned j = 1; j <= 12; ++j)
+ for (unsigned k = 0; k <= 6; ++k)
+ {
+ year y{i};
+ month m{j};
+ weekday wd{k};
+ year_month_weekday_last ymwdl = year_month{y,m}/weekday_last{wd};
+ assert(ymwdl.year() == y);
+ assert(ymwdl.month() == m);
+ assert(ymwdl.weekday() == wd);
+ }
+ }
+
+
+ { // operator/(const year& y, const month_weekday_last& mwdl) (and switched)
+ constexpr month_weekday_last FebLastTues{February, weekday_last{Tuesday}};
+
+ ASSERT_NOEXCEPT ( year{2018}/FebLastTues);
+ ASSERT_SAME_TYPE(year_month_weekday_last, decltype(year{2018}/FebLastTues));
+ ASSERT_NOEXCEPT ( FebLastTues/year{2018});
+ ASSERT_SAME_TYPE(year_month_weekday_last, decltype(FebLastTues/year{2018}));
+
+
+ static_assert((year{2018}/FebLastTues).year() == year{2018}, "");
+ static_assert((year{2018}/FebLastTues).month() == February, "");
+ static_assert((year{2018}/FebLastTues).weekday() == Tuesday, "");
+ static_assert((FebLastTues/year{2018}).year() == year{2018}, "");
+ static_assert((FebLastTues/year{2018}).month() == February, "");
+ static_assert((FebLastTues/year{2018}).weekday() == Tuesday, "");
+
+
+ for (int i = 1000; i < 1010; ++i)
+ for (unsigned j = 1; j <= 12; ++j)
+ for (unsigned k = 0; k <= 6; ++k)
+ {
+ year y{i};
+ month m{j};
+ weekday wd{k};
+ year_month_weekday_last ymwdl1 = y/month_weekday_last{m, weekday_last{wd}};
+ year_month_weekday_last ymwdl2 = month_weekday_last{m, weekday_last{wd}}/y;
+ assert(ymwdl1.year() == y);
+ assert(ymwdl2.year() == y);
+ assert(ymwdl1.month() == m);
+ assert(ymwdl2.month() == m);
+ assert(ymwdl1.weekday() == wd);
+ assert(ymwdl2.weekday() == wd);
+ assert(ymwdl1 == ymwdl2);
+ }
+ }
+
+
+ { // operator/(int y, const month_weekday_last& mwdl) (and switched)
+ constexpr month_weekday_last FebLastTues{February, weekday_last{Tuesday}};
+
+ ASSERT_NOEXCEPT ( 2018/FebLastTues);
+ ASSERT_SAME_TYPE(year_month_weekday_last, decltype(2018/FebLastTues));
+ ASSERT_NOEXCEPT ( FebLastTues/2018);
+ ASSERT_SAME_TYPE(year_month_weekday_last, decltype(FebLastTues/2018));
+
+
+ static_assert((2018/FebLastTues).year() == year{2018}, "");
+ static_assert((2018/FebLastTues).month() == February, "");
+ static_assert((2018/FebLastTues).weekday() == Tuesday, "");
+ static_assert((FebLastTues/2018).year() == year{2018}, "");
+ static_assert((FebLastTues/2018).month() == February, "");
+ static_assert((FebLastTues/2018).weekday() == Tuesday, "");
+
+
+ for (int i = 1000; i < 1010; ++i)
+ for (unsigned j = 1; j <= 12; ++j)
+ for (unsigned k = 0; k <= 6; ++k)
+ {
+ year y{i};
+ month m{j};
+ weekday wd{k};
+ year_month_weekday_last ymwdl1 = i/month_weekday_last{m, weekday_last{wd}};
+ year_month_weekday_last ymwdl2 = month_weekday_last{m, weekday_last{wd}}/i;
+ assert(ymwdl1.year() == y);
+ assert(ymwdl2.year() == y);
+ assert(ymwdl1.month() == m);
+ assert(ymwdl2.month() == m);
+ assert(ymwdl1.weekday() == wd);
+ assert(ymwdl2.weekday() == wd);
+ assert(ymwdl1 == ymwdl2);
+ }
+ }
+}
diff --git a/test/std/utilities/time/time.cal/time.cal.wdidx/time.cal.wdidx.members/ctor.pass.cpp b/test/std/utilities/time/time.cal/time.cal.wdidx/time.cal.wdidx.members/ctor.pass.cpp
new file mode 100644
index 0000000000000..7a9cfd2d61aa7
--- /dev/null
+++ b/test/std/utilities/time/time.cal/time.cal.wdidx/time.cal.wdidx.members/ctor.pass.cpp
@@ -0,0 +1,61 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
+
+// <chrono>
+// class weekday_indexed;
+
+// weekday_indexed() = default;
+// constexpr weekday_indexed(const chrono::weekday& wd, unsigned index) noexcept;
+//
+// Effects: Constructs an object of type weekday_indexed by initializing wd_ with wd and index_ with index.
+// The values held are unspecified if !wd.ok() or index is not in the range [1, 5].
+//
+// constexpr chrono::weekday weekday() const noexcept;
+// constexpr unsigned index() const noexcept;
+// constexpr bool ok() const noexcept;
+
+#include <chrono>
+#include <type_traits>
+#include <cassert>
+
+#include "test_macros.h"
+
+int main()
+{
+ using weekday = std::chrono::weekday;
+ using weekday_indexed = std::chrono::weekday_indexed;
+
+ ASSERT_NOEXCEPT(weekday_indexed{});
+ ASSERT_NOEXCEPT(weekday_indexed(weekday{1}, 1));
+
+ constexpr weekday_indexed wdi0{};
+ static_assert( wdi0.weekday() == weekday{}, "");
+ static_assert( wdi0.index() == 0, "");
+ static_assert(!wdi0.ok(), "");
+
+ constexpr weekday_indexed wdi1{std::chrono::Sunday, 2};
+ static_assert( wdi1.weekday() == std::chrono::Sunday, "");
+ static_assert( wdi1.index() == 2, "");
+ static_assert( wdi1.ok(), "");
+
+ for (unsigned i = 1; i <= 5; ++i)
+ {
+ weekday_indexed wdi(std::chrono::Tuesday, i);
+ assert( wdi.weekday() == std::chrono::Tuesday);
+ assert( wdi.index() == i);
+ assert( wdi.ok());
+ }
+
+ for (unsigned i = 6; i <= 20; ++i)
+ {
+ weekday_indexed wdi(std::chrono::Tuesday, i);
+ assert(!wdi.ok());
+ }
+}
diff --git a/test/std/utilities/time/time.cal/time.cal.wdidx/time.cal.wdidx.members/index.pass.cpp b/test/std/utilities/time/time.cal/time.cal.wdidx/time.cal.wdidx.members/index.pass.cpp
new file mode 100644
index 0000000000000..5a29087f2c4c1
--- /dev/null
+++ b/test/std/utilities/time/time.cal/time.cal.wdidx/time.cal.wdidx.members/index.pass.cpp
@@ -0,0 +1,38 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
+
+// <chrono>
+// class weekday_indexed;
+
+// constexpr unsigned index() const noexcept;
+// Returns: index_
+
+#include <chrono>
+#include <type_traits>
+#include <cassert>
+
+#include "test_macros.h"
+
+int main()
+{
+ using weekday = std::chrono::weekday;
+ using weekday_indexed = std::chrono::weekday_indexed;
+
+ ASSERT_NOEXCEPT( std::declval<const weekday_indexed>().index());
+ ASSERT_SAME_TYPE(unsigned, decltype(std::declval<const weekday_indexed>().index()));
+
+ static_assert( weekday_indexed{}.index() == 0, "");
+
+ for (unsigned i = 1; i <= 5; ++i)
+ {
+ weekday_indexed wdi(weekday{2}, i);
+ assert( static_cast<unsigned>(wdi.index()) == i);
+ }
+}
diff --git a/test/std/utilities/time/time.cal/time.cal.wdidx/time.cal.wdidx.members/ok.pass.cpp b/test/std/utilities/time/time.cal/time.cal.wdidx/time.cal.wdidx.members/ok.pass.cpp
new file mode 100644
index 0000000000000..e711426cd2f3e
--- /dev/null
+++ b/test/std/utilities/time/time.cal/time.cal.wdidx/time.cal.wdidx.members/ok.pass.cpp
@@ -0,0 +1,49 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
+
+// <chrono>
+// class weekday_indexed;
+
+// constexpr bool ok() const noexcept;
+// Returns: wd_.ok() && 1 <= index_ && index_ <= 5
+
+#include <chrono>
+#include <type_traits>
+#include <cassert>
+
+#include "test_macros.h"
+
+int main()
+{
+ using weekday = std::chrono::weekday;
+ using weekday_indexed = std::chrono::weekday_indexed;
+
+ ASSERT_NOEXCEPT( std::declval<const weekday_indexed>().ok());
+ ASSERT_SAME_TYPE(bool, decltype(std::declval<const weekday_indexed>().ok()));
+
+ static_assert(!weekday_indexed{}.ok(), "");
+ static_assert( weekday_indexed{std::chrono::Sunday, 2}.ok(), "");
+
+ assert(!(weekday_indexed(std::chrono::Tuesday, 0).ok()));
+ for (unsigned i = 1; i <= 5; ++i)
+ {
+ weekday_indexed wdi(std::chrono::Tuesday, i);
+ assert( wdi.ok());
+ }
+
+ for (unsigned i = 6; i <= 20; ++i)
+ {
+ weekday_indexed wdi(std::chrono::Tuesday, i);
+ assert(!wdi.ok());
+ }
+
+// Not a valid weekday
+ assert(!(weekday_indexed(weekday{9U}, 1).ok()));
+}
diff --git a/test/std/utilities/time/time.cal/time.cal.wdidx/time.cal.wdidx.members/weekday.pass.cpp b/test/std/utilities/time/time.cal/time.cal.wdidx/time.cal.wdidx.members/weekday.pass.cpp
new file mode 100644
index 0000000000000..da975ffc4867e
--- /dev/null
+++ b/test/std/utilities/time/time.cal/time.cal.wdidx/time.cal.wdidx.members/weekday.pass.cpp
@@ -0,0 +1,39 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
+
+// <chrono>
+// class weekday_indexed;
+
+// constexpr chrono::weekday weekday() const noexcept;
+// Returns: wd_
+
+#include <chrono>
+#include <type_traits>
+#include <cassert>
+
+#include "test_macros.h"
+
+int main()
+{
+ using weekday = std::chrono::weekday;
+ using weekday_indexed = std::chrono::weekday_indexed;
+
+ ASSERT_NOEXCEPT( std::declval<const weekday_indexed>().weekday());
+ ASSERT_SAME_TYPE(std::chrono::weekday, decltype(std::declval<const weekday_indexed>().weekday()));
+
+ static_assert( weekday_indexed{}.weekday() == weekday{}, "");
+ static_assert( weekday_indexed{std::chrono::Tuesday, 0}.weekday() == std::chrono::Tuesday, "");
+
+ for (unsigned i = 0; i <= 6; ++i)
+ {
+ weekday_indexed wdi(weekday{i}, 2);
+ assert( static_cast<unsigned>(wdi.weekday()) == i);
+ }
+}
diff --git a/test/std/utilities/time/time.cal/time.cal.wdidx/time.cal.wdidx.nonmembers/comparisons.pass.cpp b/test/std/utilities/time/time.cal/time.cal.wdidx/time.cal.wdidx.nonmembers/comparisons.pass.cpp
new file mode 100644
index 0000000000000..2381322fad331
--- /dev/null
+++ b/test/std/utilities/time/time.cal/time.cal.wdidx/time.cal.wdidx.nonmembers/comparisons.pass.cpp
@@ -0,0 +1,48 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
+
+// <chrono>
+// class weekday_indexed;
+
+// constexpr bool operator==(const weekday_indexed& x, const weekday_indexed& y) noexcept;
+// Returns: x.weekday() == y.weekday() && x.index() == y.index().
+// constexpr bool operator!=(const weekday_indexed& x, const weekday_indexed& y) noexcept;
+// Returns: !(x == y)
+
+#include <chrono>
+#include <type_traits>
+#include <cassert>
+
+#include "test_macros.h"
+#include "test_comparisons.h"
+
+int main()
+{
+ using weekday = std::chrono::weekday;
+ using weekday_indexed = std::chrono::weekday_indexed;
+
+ AssertComparisons2AreNoexcept<weekday_indexed>();
+ AssertComparisons2ReturnBool<weekday_indexed>();
+
+ static_assert( (weekday_indexed{} == weekday_indexed{}), "");
+ static_assert(!(weekday_indexed{} != weekday_indexed{}), "");
+
+ static_assert(!(weekday_indexed{} == weekday_indexed{std::chrono::Tuesday, 1}), "");
+ static_assert( (weekday_indexed{} != weekday_indexed{std::chrono::Tuesday, 1}), "");
+
+// Some 'ok' values as well
+ static_assert( (weekday_indexed{weekday{1}, 2} == weekday_indexed{weekday{1}, 2}), "");
+ static_assert(!(weekday_indexed{weekday{1}, 2} != weekday_indexed{weekday{1}, 2}), "");
+
+ static_assert(!(weekday_indexed{weekday{1}, 2} == weekday_indexed{weekday{1}, 1}), "");
+ static_assert( (weekday_indexed{weekday{1}, 2} != weekday_indexed{weekday{1}, 1}), "");
+ static_assert(!(weekday_indexed{weekday{1}, 2} == weekday_indexed{weekday{2}, 2}), "");
+ static_assert( (weekday_indexed{weekday{1}, 2} != weekday_indexed{weekday{2}, 2}), "");
+}
diff --git a/test/std/utilities/time/time.cal/time.cal.wdidx/time.cal.wdidx.nonmembers/streaming.pass.cpp b/test/std/utilities/time/time.cal/time.cal.wdidx/time.cal.wdidx.nonmembers/streaming.pass.cpp
new file mode 100644
index 0000000000000..0e5f77dd7e769
--- /dev/null
+++ b/test/std/utilities/time/time.cal/time.cal.wdidx/time.cal.wdidx.nonmembers/streaming.pass.cpp
@@ -0,0 +1,36 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
+// XFAIL: *
+
+// <chrono>
+// class weekday_indexed;
+
+// template<class charT, class traits>
+// basic_ostream<charT, traits>&
+// operator<<(basic_ostream<charT, traits>& os, const weekday_indexed& wdi);
+//
+// Effects: os << wdi.weekday() << '[' << wdi.index().
+// If wdi.index() is in the range [1, 5], appends with ']',
+// otherwise appends with " is not a valid index]".
+
+
+#include <chrono>
+#include <type_traits>
+#include <cassert>
+
+#include "test_macros.h"
+
+int main()
+{
+ using weekday_indexed = std::chrono::weekday_indexed;
+ using weekday = std::chrono::weekday;
+
+ std::cout << weekday_indexed{weekday{3}};
+}
diff --git a/test/std/utilities/time/time.cal/time.cal.wdidx/types.pass.cpp b/test/std/utilities/time/time.cal/time.cal.wdidx/types.pass.cpp
new file mode 100644
index 0000000000000..a21ae0dc55d49
--- /dev/null
+++ b/test/std/utilities/time/time.cal/time.cal.wdidx/types.pass.cpp
@@ -0,0 +1,26 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
+
+// <chrono>
+// class weekday_indexed;
+
+#include <chrono>
+#include <type_traits>
+#include <cassert>
+
+#include "test_macros.h"
+
+int main()
+{
+ using weekday_indexed = std::chrono::weekday_indexed;
+
+ static_assert(std::is_trivially_copyable_v<weekday_indexed>, "");
+ static_assert(std::is_standard_layout_v<weekday_indexed>, "");
+}
diff --git a/test/std/utilities/time/time.cal/time.cal.wdlast/time.cal.wdlast.members/ctor.pass.cpp b/test/std/utilities/time/time.cal/time.cal.wdlast/time.cal.wdlast.members/ctor.pass.cpp
new file mode 100644
index 0000000000000..1ea5196ad99ab
--- /dev/null
+++ b/test/std/utilities/time/time.cal/time.cal.wdlast/time.cal.wdlast.members/ctor.pass.cpp
@@ -0,0 +1,47 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
+
+// <chrono>
+// class weekday_last;
+
+// explicit constexpr weekday_last(const chrono::weekday& wd) noexcept;
+//
+// Effects: Constructs an object of type weekday_last by initializing wd_ with wd.
+//
+// constexpr chrono::weekday weekday() const noexcept;
+// constexpr bool ok() const noexcept;
+
+#include <chrono>
+#include <type_traits>
+#include <cassert>
+
+#include "test_macros.h"
+
+int main()
+{
+ using weekday = std::chrono::weekday;
+ using weekday_last = std::chrono::weekday_last;
+
+ ASSERT_NOEXCEPT(weekday_last{weekday{}});
+
+ constexpr weekday_last wdl0{weekday{}};
+ static_assert( wdl0.weekday() == weekday{}, "");
+ static_assert( wdl0.ok(), "");
+
+ constexpr weekday_last wdl1 {weekday{1}};
+ static_assert( wdl1.weekday() == weekday{1}, "");
+ static_assert( wdl1.ok(), "");
+
+ for (unsigned i = 0; i <= 255; ++i)
+ {
+ weekday_last wdl{weekday{i}};
+ assert(wdl.weekday() == weekday{i});
+ }
+}
diff --git a/test/std/utilities/time/time.cal/time.cal.wdlast/time.cal.wdlast.members/ok.pass.cpp b/test/std/utilities/time/time.cal/time.cal.wdlast/time.cal.wdlast.members/ok.pass.cpp
new file mode 100644
index 0000000000000..4bd0f6c2c3fa4
--- /dev/null
+++ b/test/std/utilities/time/time.cal/time.cal.wdlast/time.cal.wdlast.members/ok.pass.cpp
@@ -0,0 +1,37 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
+
+// <chrono>
+// class weekday_last;
+
+// constexpr bool ok() const noexcept;
+// Returns: wd_.ok()
+
+#include <chrono>
+#include <type_traits>
+#include <cassert>
+
+#include "test_macros.h"
+
+int main()
+{
+ using weekday = std::chrono::weekday;
+ using weekday_last = std::chrono::weekday_last;
+
+ ASSERT_NOEXCEPT( std::declval<const weekday_last>().ok());
+ ASSERT_SAME_TYPE(bool, decltype(std::declval<const weekday_last>().ok()));
+
+ static_assert( weekday_last{weekday{0}}.ok(), "");
+ static_assert( weekday_last{weekday{1}}.ok(), "");
+ static_assert(!weekday_last{weekday{7}}.ok(), "");
+
+ for (unsigned i = 0; i <= 255; ++i)
+ assert(weekday_last{weekday{i}}.ok() == weekday{i}.ok());
+}
diff --git a/test/std/utilities/time/time.cal/time.cal.wdlast/time.cal.wdlast.members/weekday.pass.cpp b/test/std/utilities/time/time.cal/time.cal.wdlast/time.cal.wdlast.members/weekday.pass.cpp
new file mode 100644
index 0000000000000..403ce0cf7b2c0
--- /dev/null
+++ b/test/std/utilities/time/time.cal/time.cal.wdlast/time.cal.wdlast.members/weekday.pass.cpp
@@ -0,0 +1,33 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
+
+// <chrono>
+// class weekday_last;
+
+// constexpr chrono::weekday weekday() const noexcept;
+// Returns: wd_
+
+#include <chrono>
+#include <type_traits>
+#include <cassert>
+
+#include "test_macros.h"
+
+int main()
+{
+ using weekday = std::chrono::weekday;
+ using weekday_last = std::chrono::weekday_last;
+
+ ASSERT_NOEXCEPT( std::declval<const weekday_last>().weekday());
+ ASSERT_SAME_TYPE(weekday, decltype(std::declval<const weekday_last>().weekday()));
+
+ for (unsigned i = 0; i <= 255; ++i)
+ assert(weekday_last{weekday{i}}.weekday() == weekday{i});
+}
diff --git a/test/std/utilities/time/time.cal/time.cal.wdlast/time.cal.wdlast.nonmembers/comparisons.pass.cpp b/test/std/utilities/time/time.cal/time.cal.wdlast/time.cal.wdlast.nonmembers/comparisons.pass.cpp
new file mode 100644
index 0000000000000..59ab4da08a368
--- /dev/null
+++ b/test/std/utilities/time/time.cal/time.cal.wdlast/time.cal.wdlast.nonmembers/comparisons.pass.cpp
@@ -0,0 +1,43 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
+
+// <chrono>
+// class weekday_last;
+
+// constexpr bool operator==(const weekday& x, const weekday& y) noexcept;
+// constexpr bool operator!=(const weekday& x, const weekday& y) noexcept;
+
+
+#include <chrono>
+#include <type_traits>
+#include <cassert>
+
+#include "test_macros.h"
+#include "test_comparisons.h"
+
+int main()
+{
+ using weekday = std::chrono::weekday;
+ using weekday_last = std::chrono::weekday_last;
+
+ AssertComparisons2AreNoexcept<weekday_last>();
+ AssertComparisons2ReturnBool<weekday_last>();
+
+ static_assert(testComparisons2Values<weekday_last>(weekday{0}, weekday{0}), "");
+ static_assert(testComparisons2Values<weekday_last>(weekday{0}, weekday{1}), "");
+
+// Some 'ok' values as well
+ static_assert(testComparisons2Values<weekday_last>(weekday{2}, weekday{2}), "");
+ static_assert(testComparisons2Values<weekday_last>(weekday{2}, weekday{3}), "");
+
+ for (unsigned i = 0; i < 6; ++i)
+ for (unsigned j = 0; j < 6; ++j)
+ assert(testComparisons2Values<weekday_last>(weekday{i}, weekday{j}));
+}
diff --git a/test/std/utilities/time/time.cal/time.cal.wdlast/time.cal.wdlast.nonmembers/streaming.pass.cpp b/test/std/utilities/time/time.cal/time.cal.wdlast/time.cal.wdlast.nonmembers/streaming.pass.cpp
new file mode 100644
index 0000000000000..65d0eed4a49b7
--- /dev/null
+++ b/test/std/utilities/time/time.cal/time.cal.wdlast/time.cal.wdlast.nonmembers/streaming.pass.cpp
@@ -0,0 +1,34 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
+// XFAIL: *
+
+// <chrono>
+// class weekday_last;
+
+// template<class charT, class traits>
+// basic_ostream<charT, traits>&
+// operator<<(basic_ostream<charT, traits>& os, const weekday_last& wdl);
+//
+// Returns: os << wdl.weekday() << "[last]".
+
+#include <chrono>
+#include <type_traits>
+#include <cassert>
+#include <iostream>
+
+#include "test_macros.h"
+
+int main()
+{
+ using weekday_last = std::chrono::weekday_last;
+ using weekday = std::chrono::weekday;
+
+ std::cout << weekday_last{weekday{3}};
+}
diff --git a/test/std/utilities/time/time.cal/time.cal.wdlast/types.pass.cpp b/test/std/utilities/time/time.cal/time.cal.wdlast/types.pass.cpp
new file mode 100644
index 0000000000000..f6c191329d54e
--- /dev/null
+++ b/test/std/utilities/time/time.cal/time.cal.wdlast/types.pass.cpp
@@ -0,0 +1,26 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
+
+// <chrono>
+// class weekday_last;
+
+#include <chrono>
+#include <type_traits>
+#include <cassert>
+
+#include "test_macros.h"
+
+int main()
+{
+ using weekday_last = std::chrono::weekday_last;
+
+ static_assert(std::is_trivially_copyable_v<weekday_last>, "");
+ static_assert(std::is_standard_layout_v<weekday_last>, "");
+}
diff --git a/test/std/utilities/time/time.cal/time.cal.weekday/time.cal.weekday.members/ctor.local_days.pass.cpp b/test/std/utilities/time/time.cal/time.cal.weekday/time.cal.weekday.members/ctor.local_days.pass.cpp
new file mode 100644
index 0000000000000..23513823510cb
--- /dev/null
+++ b/test/std/utilities/time/time.cal/time.cal.weekday/time.cal.weekday.members/ctor.local_days.pass.cpp
@@ -0,0 +1,73 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
+
+// <chrono>
+// class weekday;
+
+// constexpr weekday(const local_days& dp) noexcept;
+//
+// Effects: Constructs an object of type weekday by computing what day
+// of the week corresponds to the local_days dp, and representing
+// that day of the week in wd_
+//
+// Remarks: For any value ymd of type year_month_day for which ymd.ok() is true,
+// ymd == year_month_day{sys_days{ymd}} is true.
+//
+// [Example:
+// If dp represents 1970-01-01, the constructed weekday represents Thursday by storing 4 in wd_.
+// —end example]
+
+#include <chrono>
+#include <type_traits>
+#include <cassert>
+
+#include "test_macros.h"
+
+int main()
+{
+ using local_days = std::chrono::local_days;
+ using days = std::chrono::days;
+ using weekday = std::chrono::weekday;
+
+ ASSERT_NOEXCEPT(weekday{std::declval<local_days>()});
+
+ {
+ constexpr local_days sd{}; // 1-Jan-1970 was a Thursday
+ constexpr weekday wd{sd};
+
+ static_assert( wd.ok(), "");
+ static_assert(static_cast<unsigned>(wd) == 4, "");
+ }
+
+ {
+ constexpr local_days sd{days{10957+32}}; // 2-Feb-2000 was a Wednesday
+ constexpr weekday wd{sd};
+
+ static_assert( wd.ok(), "");
+ static_assert(static_cast<unsigned>(wd) == 3, "");
+ }
+
+
+ {
+ constexpr local_days sd{days{-10957}}; // 2-Jan-1940 was a Tuesday
+ constexpr weekday wd{sd};
+
+ static_assert( wd.ok(), "");
+ static_assert(static_cast<unsigned>(wd) == 2, "");
+ }
+
+ {
+ local_days sd{days{-(10957+34)}}; // 29-Nov-1939 was a Wednesday
+ weekday wd{sd};
+
+ assert( wd.ok());
+ assert(static_cast<unsigned>(wd) == 3);
+ }
+}
diff --git a/test/std/utilities/time/time.cal/time.cal.weekday/time.cal.weekday.members/ctor.pass.cpp b/test/std/utilities/time/time.cal/time.cal.weekday/time.cal.weekday.members/ctor.pass.cpp
new file mode 100644
index 0000000000000..f6bfc21928758
--- /dev/null
+++ b/test/std/utilities/time/time.cal/time.cal.weekday/time.cal.weekday.members/ctor.pass.cpp
@@ -0,0 +1,51 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
+
+// <chrono>
+// class weekday;
+
+// weekday() = default;
+// explicit constexpr weekday(unsigned wd) noexcept;
+// constexpr weekday(const sys_days& dp) noexcept;
+// explicit constexpr weekday(const local_days& dp) noexcept;
+//
+// explicit constexpr operator unsigned() const noexcept;
+
+// Effects: Constructs an object of type weekday by initializing m_ with m.
+// The value held is unspecified if d is not in the range [0, 255].
+
+#include <chrono>
+#include <type_traits>
+#include <cassert>
+
+#include "test_macros.h"
+
+int main()
+{
+ using weekday = std::chrono::weekday;
+
+ ASSERT_NOEXCEPT(weekday{});
+ ASSERT_NOEXCEPT(weekday(1));
+ ASSERT_NOEXCEPT(static_cast<unsigned>(weekday(1)));
+
+ constexpr weekday m0{};
+ static_assert(static_cast<unsigned>(m0) == 0, "");
+
+ constexpr weekday m1{1};
+ static_assert(static_cast<unsigned>(m1) == 1, "");
+
+ for (unsigned i = 0; i <= 255; ++i)
+ {
+ weekday m(i);
+ assert(static_cast<unsigned>(m) == i);
+ }
+
+// TODO - sys_days and local_days ctor tests
+}
diff --git a/test/std/utilities/time/time.cal/time.cal.weekday/time.cal.weekday.members/ctor.sys_days.pass.cpp b/test/std/utilities/time/time.cal/time.cal.weekday/time.cal.weekday.members/ctor.sys_days.pass.cpp
new file mode 100644
index 0000000000000..c49d05d3ae54a
--- /dev/null
+++ b/test/std/utilities/time/time.cal/time.cal.weekday/time.cal.weekday.members/ctor.sys_days.pass.cpp
@@ -0,0 +1,73 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
+
+// <chrono>
+// class weekday;
+
+// constexpr weekday(const sys_days& dp) noexcept;
+//
+// Effects: Constructs an object of type weekday by computing what day
+// of the week corresponds to the sys_days dp, and representing
+// that day of the week in wd_
+//
+// Remarks: For any value ymd of type year_month_day for which ymd.ok() is true,
+// ymd == year_month_day{sys_days{ymd}} is true.
+//
+// [Example:
+// If dp represents 1970-01-01, the constructed weekday represents Thursday by storing 4 in wd_.
+// —end example]
+
+#include <chrono>
+#include <type_traits>
+#include <cassert>
+
+#include "test_macros.h"
+
+int main()
+{
+ using sys_days = std::chrono::sys_days;
+ using days = std::chrono::days;
+ using weekday = std::chrono::weekday;
+
+ ASSERT_NOEXCEPT(weekday{std::declval<sys_days>()});
+
+ {
+ constexpr sys_days sd{}; // 1-Jan-1970 was a Thursday
+ constexpr weekday wd{sd};
+
+ static_assert( wd.ok(), "");
+ static_assert(static_cast<unsigned>(wd) == 4, "");
+ }
+
+ {
+ constexpr sys_days sd{days{10957+32}}; // 2-Feb-2000 was a Wednesday
+ constexpr weekday wd{sd};
+
+ static_assert( wd.ok(), "");
+ static_assert(static_cast<unsigned>(wd) == 3, "");
+ }
+
+
+ {
+ constexpr sys_days sd{days{-10957}}; // 2-Jan-1940 was a Tuesday
+ constexpr weekday wd{sd};
+
+ static_assert( wd.ok(), "");
+ static_assert(static_cast<unsigned>(wd) == 2, "");
+ }
+
+ {
+ sys_days sd{days{-(10957+34)}}; // 29-Nov-1939 was a Wednesday
+ weekday wd{sd};
+
+ assert( wd.ok());
+ assert(static_cast<unsigned>(wd) == 3);
+ }
+}
diff --git a/test/std/utilities/time/time.cal/time.cal.weekday/time.cal.weekday.members/decrement.pass.cpp b/test/std/utilities/time/time.cal/time.cal.weekday/time.cal.weekday.members/decrement.pass.cpp
new file mode 100644
index 0000000000000..74774b6a0dccb
--- /dev/null
+++ b/test/std/utilities/time/time.cal/time.cal.weekday/time.cal.weekday.members/decrement.pass.cpp
@@ -0,0 +1,53 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
+
+// <chrono>
+// class weekday;
+
+// constexpr weekday& operator--() noexcept;
+// constexpr weekday operator--(int) noexcept;
+
+
+#include <chrono>
+#include <type_traits>
+#include <cassert>
+
+#include "test_macros.h"
+#include "../../euclidian.h"
+
+template <typename WD>
+constexpr bool testConstexpr()
+{
+ WD wd{1};
+ if (static_cast<unsigned>(--wd) != 0) return false;
+ if (static_cast<unsigned>(wd--) != 0) return false;
+ if (static_cast<unsigned>(wd) != 6) return false;
+ return true;
+}
+
+int main()
+{
+ using weekday = std::chrono::weekday;
+ ASSERT_NOEXCEPT(--(std::declval<weekday&>()) );
+ ASSERT_NOEXCEPT( (std::declval<weekday&>())--);
+
+ ASSERT_SAME_TYPE(weekday , decltype( std::declval<weekday&>()--));
+ ASSERT_SAME_TYPE(weekday&, decltype(--std::declval<weekday&>() ));
+
+ static_assert(testConstexpr<weekday>(), "");
+
+ for (unsigned i = 0; i <= 6; ++i)
+ {
+ weekday wd(i);
+ assert((static_cast<unsigned>(--wd) == euclidian_subtraction<unsigned, 0, 6>(i, 1)));
+ assert((static_cast<unsigned>(wd--) == euclidian_subtraction<unsigned, 0, 6>(i, 1)));
+ assert((static_cast<unsigned>(wd) == euclidian_subtraction<unsigned, 0, 6>(i, 2)));
+ }
+}
diff --git a/test/std/utilities/time/time.cal/time.cal.weekday/time.cal.weekday.members/increment.pass.cpp b/test/std/utilities/time/time.cal/time.cal.weekday/time.cal.weekday.members/increment.pass.cpp
new file mode 100644
index 0000000000000..945d97f49bae1
--- /dev/null
+++ b/test/std/utilities/time/time.cal/time.cal.weekday/time.cal.weekday.members/increment.pass.cpp
@@ -0,0 +1,53 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
+
+// <chrono>
+// class weekday;
+
+// constexpr weekday& operator++() noexcept;
+// constexpr weekday operator++(int) noexcept;
+
+
+#include <chrono>
+#include <type_traits>
+#include <cassert>
+
+#include "test_macros.h"
+#include "../../euclidian.h"
+
+template <typename WD>
+constexpr bool testConstexpr()
+{
+ WD wd{5};
+ if (static_cast<unsigned>(++wd) != 6) return false;
+ if (static_cast<unsigned>(wd++) != 6) return false;
+ if (static_cast<unsigned>(wd) != 0) return false;
+ return true;
+}
+
+int main()
+{
+ using weekday = std::chrono::weekday;
+ ASSERT_NOEXCEPT(++(std::declval<weekday&>()) );
+ ASSERT_NOEXCEPT( (std::declval<weekday&>())++);
+
+ ASSERT_SAME_TYPE(weekday , decltype( std::declval<weekday&>()++));
+ ASSERT_SAME_TYPE(weekday&, decltype(++std::declval<weekday&>() ));
+
+ static_assert(testConstexpr<weekday>(), "");
+
+ for (unsigned i = 0; i <= 6; ++i)
+ {
+ weekday wd(i);
+ assert((static_cast<unsigned>(++wd) == euclidian_addition<unsigned, 0, 6>(i, 1)));
+ assert((static_cast<unsigned>(wd++) == euclidian_addition<unsigned, 0, 6>(i, 1)));
+ assert((static_cast<unsigned>(wd) == euclidian_addition<unsigned, 0, 6>(i, 2)));
+ }
+}
diff --git a/test/std/utilities/time/time.cal/time.cal.weekday/time.cal.weekday.members/ok.pass.cpp b/test/std/utilities/time/time.cal/time.cal.weekday/time.cal.weekday.members/ok.pass.cpp
new file mode 100644
index 0000000000000..5b03b181cc0cf
--- /dev/null
+++ b/test/std/utilities/time/time.cal/time.cal.weekday/time.cal.weekday.members/ok.pass.cpp
@@ -0,0 +1,38 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
+
+// <chrono>
+// class weekday;
+
+// constexpr bool ok() const noexcept;
+// Returns: wd_ <= 6
+
+#include <chrono>
+#include <type_traits>
+#include <cassert>
+
+#include "test_macros.h"
+
+int main()
+{
+ using weekday = std::chrono::weekday;
+
+ ASSERT_NOEXCEPT( std::declval<const weekday>().ok());
+ ASSERT_SAME_TYPE(bool, decltype(std::declval<const weekday>().ok()));
+
+ static_assert( weekday{0}.ok(), "");
+ static_assert( weekday{1}.ok(), "");
+ static_assert(!weekday{7}.ok(), "");
+
+ for (unsigned i = 0; i <= 6; ++i)
+ assert(weekday{i}.ok());
+ for (unsigned i = 7; i <= 255; ++i)
+ assert(!weekday{i}.ok());
+}
diff --git a/test/std/utilities/time/time.cal/time.cal.weekday/time.cal.weekday.members/operator[].pass.cpp b/test/std/utilities/time/time.cal/time.cal.weekday/time.cal.weekday.members/operator[].pass.cpp
new file mode 100644
index 0000000000000..1498d2748ecd6
--- /dev/null
+++ b/test/std/utilities/time/time.cal/time.cal.weekday/time.cal.weekday.members/operator[].pass.cpp
@@ -0,0 +1,59 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
+
+// <chrono>
+// class weekday;
+
+// constexpr weekday_indexed operator[](unsigned index) const noexcept;
+// constexpr weekday_last operator[](last_spec) const noexcept;
+
+
+#include <chrono>
+#include <type_traits>
+#include <cassert>
+
+#include "test_macros.h"
+#include "../../euclidian.h"
+
+int main()
+{
+ using weekday = std::chrono::weekday;
+ using weekday_last = std::chrono::weekday_last;
+ using weekday_indexed = std::chrono::weekday_indexed;
+
+ constexpr weekday Sunday = std::chrono::Sunday;
+
+ ASSERT_NOEXCEPT( std::declval<weekday>()[1U]);
+ ASSERT_SAME_TYPE(weekday_indexed, decltype(std::declval<weekday>()[1U]));
+
+ ASSERT_NOEXCEPT( std::declval<weekday>()[std::chrono::last]);
+ ASSERT_SAME_TYPE(weekday_last, decltype(std::declval<weekday>()[std::chrono::last]));
+
+ static_assert(Sunday[2].weekday() == Sunday, "");
+ static_assert(Sunday[2].index () == 2, "");
+
+ for (unsigned i = 0; i <= 6; ++i)
+ {
+ weekday wd(i);
+ weekday_last wdl = wd[std::chrono::last];
+ assert(wdl.weekday() == wd);
+ assert(wdl.ok());
+ }
+
+ for (unsigned i = 0; i <= 6; ++i)
+ for (unsigned j = 1; j <= 5; ++j)
+ {
+ weekday wd(i);
+ weekday_indexed wdi = wd[j];
+ assert(wdi.weekday() == wd);
+ assert(wdi.index() == j);
+ assert(wdi.ok());
+ }
+}
diff --git a/test/std/utilities/time/time.cal/time.cal.weekday/time.cal.weekday.members/plus_minus_equal.pass.cpp b/test/std/utilities/time/time.cal/time.cal.weekday/time.cal.weekday.members/plus_minus_equal.pass.cpp
new file mode 100644
index 0000000000000..27c14a55a4a9f
--- /dev/null
+++ b/test/std/utilities/time/time.cal/time.cal.weekday/time.cal.weekday.members/plus_minus_equal.pass.cpp
@@ -0,0 +1,63 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
+
+// <chrono>
+// class weekday;
+
+// constexpr weekday& operator+=(const days& d) noexcept;
+// constexpr weekday& operator-=(const days& d) noexcept;
+
+#include <chrono>
+#include <type_traits>
+#include <cassert>
+
+#include "test_macros.h"
+#include "../../euclidian.h"
+
+template <typename M, typename Ms>
+constexpr bool testConstexpr()
+{
+ M m1{1};
+ if (static_cast<unsigned>(m1 += Ms{ 1}) != 2) return false;
+ if (static_cast<unsigned>(m1 += Ms{ 2}) != 4) return false;
+ if (static_cast<unsigned>(m1 += Ms{ 4}) != 1) return false;
+ if (static_cast<unsigned>(m1 -= Ms{ 1}) != 0) return false;
+ if (static_cast<unsigned>(m1 -= Ms{ 2}) != 5) return false;
+ if (static_cast<unsigned>(m1 -= Ms{ 4}) != 1) return false;
+ return true;
+}
+
+int main()
+{
+ using weekday = std::chrono::weekday;
+ using days = std::chrono::days;
+
+ ASSERT_NOEXCEPT( std::declval<weekday&>() += std::declval<days&>());
+ ASSERT_SAME_TYPE(weekday&, decltype(std::declval<weekday&>() += std::declval<days&>()));
+
+ ASSERT_NOEXCEPT( std::declval<weekday&>() -= std::declval<days&>());
+ ASSERT_SAME_TYPE(weekday&, decltype(std::declval<weekday&>() -= std::declval<days&>()));
+
+ static_assert(testConstexpr<weekday, days>(), "");
+
+ for (unsigned i = 0; i <= 6; ++i)
+ {
+ weekday wd(i);
+ assert((static_cast<unsigned>(wd += days{3}) == euclidian_addition<unsigned, 0, 6>(i, 3)));
+ assert((static_cast<unsigned>(wd) == euclidian_addition<unsigned, 0, 6>(i, 3)));
+ }
+
+ for (unsigned i = 0; i <= 6; ++i)
+ {
+ weekday wd(i);
+ assert((static_cast<unsigned>(wd -= days{4}) == euclidian_subtraction<unsigned, 0, 6>(i, 4)));
+ assert((static_cast<unsigned>(wd) == euclidian_subtraction<unsigned, 0, 6>(i, 4)));
+ }
+}
diff --git a/test/std/utilities/time/time.cal/time.cal.weekday/time.cal.weekday.nonmembers/comparisons.pass.cpp b/test/std/utilities/time/time.cal/time.cal.weekday/time.cal.weekday.nonmembers/comparisons.pass.cpp
new file mode 100644
index 0000000000000..0142feee8f608
--- /dev/null
+++ b/test/std/utilities/time/time.cal/time.cal.weekday/time.cal.weekday.nonmembers/comparisons.pass.cpp
@@ -0,0 +1,42 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
+
+// <chrono>
+// class weekday;
+
+// constexpr bool operator==(const weekday& x, const weekday& y) noexcept;
+// constexpr bool operator!=(const weekday& x, const weekday& y) noexcept;
+
+
+#include <chrono>
+#include <type_traits>
+#include <cassert>
+
+#include "test_macros.h"
+#include "test_comparisons.h"
+
+int main()
+{
+ using weekday = std::chrono::weekday;
+
+ AssertComparisons2AreNoexcept<weekday>();
+ AssertComparisons2ReturnBool<weekday>();
+
+ static_assert(testComparisons2Values<weekday>(0U ,0U), "");
+ static_assert(testComparisons2Values<weekday>(0U, 1U), "");
+
+// Some 'ok' values as well
+ static_assert(testComparisons2Values<weekday>(5U, 5U), "");
+ static_assert(testComparisons2Values<weekday>(5U, 2U), "");
+
+ for (unsigned i = 0; i < 6; ++i)
+ for (unsigned j = 0; j < 6; ++j)
+ assert(testComparisons2Values<weekday>(i, j));
+}
diff --git a/test/std/utilities/time/time.cal/time.cal.weekday/time.cal.weekday.nonmembers/literals.pass.cpp b/test/std/utilities/time/time.cal/time.cal.weekday/time.cal.weekday.nonmembers/literals.pass.cpp
new file mode 100644
index 0000000000000..16f9899d655a4
--- /dev/null
+++ b/test/std/utilities/time/time.cal/time.cal.weekday/time.cal.weekday.nonmembers/literals.pass.cpp
@@ -0,0 +1,62 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
+
+// <chrono>
+
+// inline constexpr weekday Sunday{0};
+// inline constexpr weekday Monday{1};
+// inline constexpr weekday Tuesday{2};
+// inline constexpr weekday Wednesday{3};
+// inline constexpr weekday Thursday{4};
+// inline constexpr weekday Friday{5};
+// inline constexpr weekday Saturday{6};
+
+
+#include <chrono>
+#include <type_traits>
+#include <cassert>
+
+#include "test_macros.h"
+
+int main()
+{
+
+ ASSERT_SAME_TYPE(const std::chrono::weekday, decltype(std::chrono::Sunday));
+ ASSERT_SAME_TYPE(const std::chrono::weekday, decltype(std::chrono::Monday));
+ ASSERT_SAME_TYPE(const std::chrono::weekday, decltype(std::chrono::Tuesday));
+ ASSERT_SAME_TYPE(const std::chrono::weekday, decltype(std::chrono::Wednesday));
+ ASSERT_SAME_TYPE(const std::chrono::weekday, decltype(std::chrono::Thursday));
+ ASSERT_SAME_TYPE(const std::chrono::weekday, decltype(std::chrono::Friday));
+ ASSERT_SAME_TYPE(const std::chrono::weekday, decltype(std::chrono::Saturday));
+
+ static_assert( std::chrono::Sunday == std::chrono::weekday(0), "");
+ static_assert( std::chrono::Monday == std::chrono::weekday(1), "");
+ static_assert( std::chrono::Tuesday == std::chrono::weekday(2), "");
+ static_assert( std::chrono::Wednesday == std::chrono::weekday(3), "");
+ static_assert( std::chrono::Thursday == std::chrono::weekday(4), "");
+ static_assert( std::chrono::Friday == std::chrono::weekday(5), "");
+ static_assert( std::chrono::Saturday == std::chrono::weekday(6), "");
+
+ assert(std::chrono::Sunday == std::chrono::weekday(0));
+ assert(std::chrono::Monday == std::chrono::weekday(1));
+ assert(std::chrono::Tuesday == std::chrono::weekday(2));
+ assert(std::chrono::Wednesday == std::chrono::weekday(3));
+ assert(std::chrono::Thursday == std::chrono::weekday(4));
+ assert(std::chrono::Friday == std::chrono::weekday(5));
+ assert(std::chrono::Saturday == std::chrono::weekday(6));
+
+ assert(static_cast<unsigned>(std::chrono::Sunday) == 0);
+ assert(static_cast<unsigned>(std::chrono::Monday) == 1);
+ assert(static_cast<unsigned>(std::chrono::Tuesday) == 2);
+ assert(static_cast<unsigned>(std::chrono::Wednesday) == 3);
+ assert(static_cast<unsigned>(std::chrono::Thursday) == 4);
+ assert(static_cast<unsigned>(std::chrono::Friday) == 5);
+ assert(static_cast<unsigned>(std::chrono::Saturday) == 6);
+}
diff --git a/test/std/utilities/time/time.cal/time.cal.weekday/time.cal.weekday.nonmembers/minus.pass.cpp b/test/std/utilities/time/time.cal/time.cal.weekday/time.cal.weekday.nonmembers/minus.pass.cpp
new file mode 100644
index 0000000000000..ca126e9dceadc
--- /dev/null
+++ b/test/std/utilities/time/time.cal/time.cal.weekday/time.cal.weekday.nonmembers/minus.pass.cpp
@@ -0,0 +1,76 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
+
+// <chrono>
+// class weekday;
+
+// constexpr weekday operator-(const weekday& x, const days& y) noexcept;
+// Returns: x + -y.
+//
+// constexpr days operator-(const weekday& x, const weekday& y) noexcept;
+// Returns: If x.ok() == true and y.ok() == true, returns a value d in the range
+// [days{0}, days{6}] satisfying y + d == x.
+// Otherwise the value returned is unspecified.
+// [Example: Sunday - Monday == days{6}. —end example]
+
+
+extern "C" int printf(const char *, ...);
+
+#include <chrono>
+#include <type_traits>
+#include <cassert>
+
+#include "test_macros.h"
+#include "../../euclidian.h"
+
+template <typename WD, typename Ds>
+constexpr bool testConstexpr()
+{
+ {
+ WD wd{5};
+ Ds offset{3};
+ if (wd - offset != WD{2}) return false;
+ if (wd - WD{2} != offset) return false;
+ }
+
+// Check the example
+ if (WD{0} - WD{1} != Ds{6}) return false;
+ return true;
+}
+
+int main()
+{
+ using weekday = std::chrono::weekday;
+ using days = std::chrono::days;
+
+ ASSERT_NOEXCEPT( std::declval<weekday>() - std::declval<days>());
+ ASSERT_SAME_TYPE(weekday, decltype(std::declval<weekday>() - std::declval<days>()));
+
+ ASSERT_NOEXCEPT( std::declval<weekday>() - std::declval<weekday>());
+ ASSERT_SAME_TYPE(days, decltype(std::declval<weekday>() - std::declval<weekday>()));
+
+ static_assert(testConstexpr<weekday, days>(), "");
+
+ for (unsigned i = 0; i <= 6; ++i)
+ for (unsigned j = 0; j <= 6; ++j)
+ {
+ weekday wd = weekday{i} - days{j};
+ assert(wd + days{j} == weekday{i});
+ assert((static_cast<unsigned>(wd) == euclidian_subtraction<unsigned, 0, 6>(i, j)));
+ }
+
+ for (unsigned i = 0; i <= 6; ++i)
+ for (unsigned j = 0; j <= 6; ++j)
+ {
+ days d = weekday{j} - weekday{i};
+ assert(weekday{i} + d == weekday{j});
+ }
+
+}
diff --git a/test/std/utilities/time/time.cal/time.cal.weekday/time.cal.weekday.nonmembers/plus.pass.cpp b/test/std/utilities/time/time.cal/time.cal.weekday/time.cal.weekday.nonmembers/plus.pass.cpp
new file mode 100644
index 0000000000000..bb9145a6575b3
--- /dev/null
+++ b/test/std/utilities/time/time.cal/time.cal.weekday/time.cal.weekday.nonmembers/plus.pass.cpp
@@ -0,0 +1,70 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
+
+// <chrono>
+// class weekday;
+
+// constexpr weekday operator+(const days& x, const weekday& y) noexcept;
+// Returns: weekday(int{x} + y.count()).
+//
+// constexpr weekday operator+(const weekday& x, const days& y) noexcept;
+// Returns:
+// weekday{modulo(static_cast<long long>(unsigned{x}) + y.count(), 7)}
+// where modulo(n, 7) computes the remainder of n divided by 7 using Euclidean division.
+// [Note: Given a divisor of 12, Euclidean division truncates towards negative infinity
+// and always produces a remainder in the range of [0, 6].
+// Assuming no overflow in the signed summation, this operation results in a weekday
+// holding a value in the range [0, 6] even if !x.ok(). —end note]
+// [Example: Monday + days{6} == Sunday. —end example]
+
+
+
+#include <chrono>
+#include <type_traits>
+#include <cassert>
+
+#include "test_macros.h"
+#include "../../euclidian.h"
+
+template <typename M, typename Ms>
+constexpr bool testConstexpr()
+{
+ M m{1};
+ Ms offset{4};
+ if (m + offset != M{5}) return false;
+ if (offset + m != M{5}) return false;
+// Check the example
+ if (M{1} + Ms{6} != M{0}) return false;
+ return true;
+}
+
+int main()
+{
+ using weekday = std::chrono::weekday;
+ using days = std::chrono::days;
+
+ ASSERT_NOEXCEPT( std::declval<weekday>() + std::declval<days>());
+ ASSERT_SAME_TYPE(weekday, decltype(std::declval<weekday>() + std::declval<days>()));
+
+ ASSERT_NOEXCEPT( std::declval<days>() + std::declval<weekday>());
+ ASSERT_SAME_TYPE(weekday, decltype(std::declval<days>() + std::declval<weekday>()));
+
+ static_assert(testConstexpr<weekday, days>(), "");
+
+ for (unsigned i = 0; i <= 6; ++i)
+ for (unsigned j = 0; j <= 6; ++j)
+ {
+ weekday wd1 = weekday{i} + days{j};
+ weekday wd2 = days{j} + weekday{i};
+ assert(wd1 == wd2);
+ assert((static_cast<unsigned>(wd1) == euclidian_addition<unsigned, 0, 6>(i, j)));
+ assert((static_cast<unsigned>(wd2) == euclidian_addition<unsigned, 0, 6>(i, j)));
+ }
+}
diff --git a/test/std/utilities/time/time.cal/time.cal.weekday/time.cal.weekday.nonmembers/streaming.pass.cpp b/test/std/utilities/time/time.cal/time.cal.weekday/time.cal.weekday.nonmembers/streaming.pass.cpp
new file mode 100644
index 0000000000000..cf28397a3df03
--- /dev/null
+++ b/test/std/utilities/time/time.cal/time.cal.weekday/time.cal.weekday.nonmembers/streaming.pass.cpp
@@ -0,0 +1,56 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
+// XFAIL: *
+
+// <chrono>
+// class weekday;
+
+// template<class charT, class traits>
+// basic_ostream<charT, traits>&
+// operator<<(basic_ostream<charT, traits>& os, const weekday& wd);
+//
+// Effects: If wd.ok() == true inserts format(os.getloc(), fmt, wd) where fmt is "%a" widened to charT.
+// Otherwise inserts unsigned{wd} << " is not a valid weekday".
+//
+// template<class charT, class traits>
+// basic_ostream<charT, traits>&
+// to_stream(basic_ostream<charT, traits>& os, const charT* fmt, const weekday& wd);
+//
+// Effects: Streams wd into os using the format specified by the NTCTS fmt.
+// fmt encoding follows the rules specified in 25.11.
+//
+// template<class charT, class traits, class Alloc = allocator<charT>>
+// basic_istream<charT, traits>&
+// from_stream(basic_istream<charT, traits>& is, const charT* fmt,
+// weekday& wd, basic_string<charT, traits, Alloc>* abbrev = nullptr,
+// minutes* offset = nullptr);
+//
+// Effects: Attempts to parse the input stream is into the weekday wd using
+// the format flags given in the NTCTS fmt as specified in 25.12.
+// If the parse fails to decode a valid weekday, is.setstate(ios_- base::failbit)
+// shall be called and wd shall not be modified.
+// If %Z is used and successfully parsed, that value will be assigned
+// to *abbrev if abbrev is non-null.
+// If %z (or a modified variant) is used and successfully parsed,
+// that value will be assigned to *offset if offset is non-null.
+
+#include <chrono>
+#include <type_traits>
+#include <cassert>
+#include <iostream>
+
+#include "test_macros.h"
+
+int main()
+{
+ using weekday = std::chrono::weekday;
+
+ std::cout << weekday{3};
+}
diff --git a/test/std/utilities/time/time.cal/time.cal.weekday/types.pass.cpp b/test/std/utilities/time/time.cal/time.cal.weekday/types.pass.cpp
new file mode 100644
index 0000000000000..0a3a8940618b5
--- /dev/null
+++ b/test/std/utilities/time/time.cal/time.cal.weekday/types.pass.cpp
@@ -0,0 +1,26 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
+
+// <chrono>
+// class weekday;
+
+#include <chrono>
+#include <type_traits>
+#include <cassert>
+
+#include "test_macros.h"
+
+int main()
+{
+ using weekday = std::chrono::weekday;
+
+ static_assert(std::is_trivially_copyable_v<weekday>, "");
+ static_assert(std::is_standard_layout_v<weekday>, "");
+}
diff --git a/test/std/utilities/time/time.cal/time.cal.year/time.cal.year.members/ctor.pass.cpp b/test/std/utilities/time/time.cal/time.cal.year/time.cal.year.members/ctor.pass.cpp
new file mode 100644
index 0000000000000..904e722dbc858
--- /dev/null
+++ b/test/std/utilities/time/time.cal/time.cal.year/time.cal.year.members/ctor.pass.cpp
@@ -0,0 +1,46 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
+
+// <chrono>
+// class year;
+
+// year() = default;
+// explicit constexpr year(int m) noexcept;
+// explicit constexpr operator int() const noexcept;
+
+// Effects: Constructs an object of type year by initializing y_ with y.
+// The value held is unspecified if d is not in the range [0, 255].
+
+#include <chrono>
+#include <type_traits>
+#include <cassert>
+
+#include "test_macros.h"
+
+int main()
+{
+ using year = std::chrono::year;
+
+ ASSERT_NOEXCEPT(year{});
+ ASSERT_NOEXCEPT(year(0U));
+ ASSERT_NOEXCEPT(static_cast<int>(year(0U)));
+
+ constexpr year y0{};
+ static_assert(static_cast<int>(y0) == 0, "");
+
+ constexpr year y1{1};
+ static_assert(static_cast<int>(y1) == 1, "");
+
+ for (int i = 0; i <= 2550; i += 7)
+ {
+ year year(i);
+ assert(static_cast<int>(year) == i);
+ }
+}
diff --git a/test/std/utilities/time/time.cal/time.cal.year/time.cal.year.members/decrement.pass.cpp b/test/std/utilities/time/time.cal/time.cal.year/time.cal.year.members/decrement.pass.cpp
new file mode 100644
index 0000000000000..810b28d9b2e9f
--- /dev/null
+++ b/test/std/utilities/time/time.cal/time.cal.year/time.cal.year.members/decrement.pass.cpp
@@ -0,0 +1,52 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
+
+// <chrono>
+// class year;
+
+// constexpr year& operator--() noexcept;
+// constexpr year operator--(int) noexcept;
+
+
+#include <chrono>
+#include <type_traits>
+#include <cassert>
+
+#include "test_macros.h"
+
+template <typename Y>
+constexpr bool testConstexpr()
+{
+ Y y1{10};
+ if (static_cast<int>(--y1) != 9) return false;
+ if (static_cast<int>(y1--) != 9) return false;
+ if (static_cast<int>(y1) != 8) return false;
+ return true;
+}
+
+int main()
+{
+ using year = std::chrono::year;
+ ASSERT_NOEXCEPT(--(std::declval<year&>()) );
+ ASSERT_NOEXCEPT( (std::declval<year&>())--);
+
+ ASSERT_SAME_TYPE(year , decltype( std::declval<year&>()--));
+ ASSERT_SAME_TYPE(year&, decltype(--std::declval<year&>() ));
+
+ static_assert(testConstexpr<year>(), "");
+
+ for (int i = 11000; i <= 11020; ++i)
+ {
+ year year(i);
+ assert(static_cast<int>(--year) == i - 1);
+ assert(static_cast<int>(year--) == i - 1);
+ assert(static_cast<int>(year) == i - 2);
+ }
+}
diff --git a/test/std/utilities/time/time.cal/time.cal.year/time.cal.year.members/increment.pass.cpp b/test/std/utilities/time/time.cal/time.cal.year/time.cal.year.members/increment.pass.cpp
new file mode 100644
index 0000000000000..a6b60d6a07d82
--- /dev/null
+++ b/test/std/utilities/time/time.cal/time.cal.year/time.cal.year.members/increment.pass.cpp
@@ -0,0 +1,52 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
+
+// <chrono>
+// class year;
+
+// constexpr year& operator++() noexcept;
+// constexpr year operator++(int) noexcept;
+
+
+#include <chrono>
+#include <type_traits>
+#include <cassert>
+
+#include "test_macros.h"
+
+template <typename Y>
+constexpr bool testConstexpr()
+{
+ Y y1{10};
+ if (static_cast<int>(++y1) != 11) return false;
+ if (static_cast<int>(y1++) != 11) return false;
+ if (static_cast<int>(y1) != 12) return false;
+ return true;
+}
+
+int main()
+{
+ using year = std::chrono::year;
+ ASSERT_NOEXCEPT(++(std::declval<year&>()) );
+ ASSERT_NOEXCEPT( (std::declval<year&>())++);
+
+ ASSERT_SAME_TYPE(year , decltype( std::declval<year&>()++));
+ ASSERT_SAME_TYPE(year&, decltype(++std::declval<year&>() ));
+
+ static_assert(testConstexpr<year>(), "");
+
+ for (int i = 11000; i <= 11020; ++i)
+ {
+ year year(i);
+ assert(static_cast<int>(++year) == i + 1);
+ assert(static_cast<int>(year++) == i + 1);
+ assert(static_cast<int>(year) == i + 2);
+ }
+}
diff --git a/test/std/utilities/time/time.cal/time.cal.year/time.cal.year.members/is_leap.pass.cpp b/test/std/utilities/time/time.cal/time.cal.year/time.cal.year.members/is_leap.pass.cpp
new file mode 100644
index 0000000000000..73c0adb9837ae
--- /dev/null
+++ b/test/std/utilities/time/time.cal/time.cal.year/time.cal.year.members/is_leap.pass.cpp
@@ -0,0 +1,53 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
+
+// <chrono>
+// class year;
+
+// constexpr bool is_is_leap() const noexcept;
+// y_ % 4 == 0 && (y_ % 100 != 0 || y_ % 400 == 0)
+//
+
+#include <chrono>
+#include <type_traits>
+#include <cassert>
+
+#include "test_macros.h"
+
+int main()
+{
+ using year = std::chrono::year;
+
+ ASSERT_NOEXCEPT( year(1).is_leap());
+ ASSERT_SAME_TYPE(bool, decltype(year(1).is_leap()));
+
+ static_assert(!year{1}.is_leap(), "");
+ static_assert(!year{2}.is_leap(), "");
+ static_assert(!year{3}.is_leap(), "");
+ static_assert( year{4}.is_leap(), "");
+
+ assert( year{-2000}.is_leap());
+ assert( year{ -400}.is_leap());
+ assert(!year{ -300}.is_leap());
+ assert(!year{ -200}.is_leap());
+
+ assert(!year{ 200}.is_leap());
+ assert(!year{ 300}.is_leap());
+ assert( year{ 400}.is_leap());
+ assert(!year{ 1997}.is_leap());
+ assert(!year{ 1998}.is_leap());
+ assert(!year{ 1999}.is_leap());
+ assert( year{ 2000}.is_leap());
+ assert(!year{ 2001}.is_leap());
+ assert(!year{ 2002}.is_leap());
+ assert(!year{ 2003}.is_leap());
+ assert( year{ 2004}.is_leap());
+ assert(!year{ 2100}.is_leap());
+}
diff --git a/test/std/utilities/time/time.cal/time.cal.year/time.cal.year.members/ok.pass.cpp b/test/std/utilities/time/time.cal/time.cal.year/time.cal.year.members/ok.pass.cpp
new file mode 100644
index 0000000000000..5f38b4c8c65c9
--- /dev/null
+++ b/test/std/utilities/time/time.cal/time.cal.year/time.cal.year.members/ok.pass.cpp
@@ -0,0 +1,53 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
+
+// <chrono>
+// class year;
+
+// constexpr bool ok() const noexcept;
+// Returns: min() <= y_ && y_ <= max().
+//
+// static constexpr year min() noexcept;
+// Returns year{ 32767};
+// static constexpr year max() noexcept;
+// Returns year{-32767};
+
+#include <chrono>
+#include <type_traits>
+#include <cassert>
+
+#include "test_macros.h"
+
+int main()
+{
+ using year = std::chrono::year;
+
+ ASSERT_NOEXCEPT( std::declval<const year>().ok());
+ ASSERT_SAME_TYPE(bool, decltype(std::declval<const year>().ok()));
+
+ ASSERT_NOEXCEPT( year::max());
+ ASSERT_SAME_TYPE(year, decltype(year::max()));
+
+ ASSERT_NOEXCEPT( year::min());
+ ASSERT_SAME_TYPE(year, decltype(year::min()));
+
+ static_assert(static_cast<int>(year::min()) == -32767, "");
+ static_assert(static_cast<int>(year::max()) == 32767, "");
+
+ assert(year{-20001}.ok());
+ assert(year{ -2000}.ok());
+ assert(year{ -1}.ok());
+ assert(year{ 0}.ok());
+ assert(year{ 1}.ok());
+ assert(year{ 2000}.ok());
+ assert(year{ 20001}.ok());
+
+ static_assert(!year{-32768}.ok(), "");
+}
diff --git a/test/std/utilities/time/time.cal/time.cal.year/time.cal.year.members/plus_minus.pass.cpp b/test/std/utilities/time/time.cal/time.cal.year/time.cal.year.members/plus_minus.pass.cpp
new file mode 100644
index 0000000000000..c74b5f8019d6a
--- /dev/null
+++ b/test/std/utilities/time/time.cal/time.cal.year/time.cal.year.members/plus_minus.pass.cpp
@@ -0,0 +1,50 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
+
+// <chrono>
+// class year;
+
+// constexpr year operator+() const noexcept;
+// constexpr year operator-() const noexcept;
+
+#include <chrono>
+#include <type_traits>
+#include <cassert>
+
+#include "test_macros.h"
+
+template <typename Y>
+constexpr bool testConstexpr()
+{
+ Y y1{1};
+ if (static_cast<int>(+y1) != 1) return false;
+ if (static_cast<int>(-y1) != -1) return false;
+ return true;
+}
+
+int main()
+{
+ using year = std::chrono::year;
+
+ ASSERT_NOEXCEPT(+std::declval<year>());
+ ASSERT_NOEXCEPT(-std::declval<year>());
+
+ ASSERT_SAME_TYPE(year, decltype(+std::declval<year>()));
+ ASSERT_SAME_TYPE(year, decltype(-std::declval<year>()));
+
+ static_assert(testConstexpr<year>(), "");
+
+ for (int i = 10000; i <= 10020; ++i)
+ {
+ year year(i);
+ assert(static_cast<int>(+year) == i);
+ assert(static_cast<int>(-year) == -i);
+ }
+}
diff --git a/test/std/utilities/time/time.cal/time.cal.year/time.cal.year.members/plus_minus_equal.pass.cpp b/test/std/utilities/time/time.cal/time.cal.year/time.cal.year.members/plus_minus_equal.pass.cpp
new file mode 100644
index 0000000000000..b457b7e91da53
--- /dev/null
+++ b/test/std/utilities/time/time.cal/time.cal.year/time.cal.year.members/plus_minus_equal.pass.cpp
@@ -0,0 +1,57 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
+
+// <chrono>
+// class year;
+
+// constexpr year& operator+=(const years& d) noexcept;
+// constexpr year& operator-=(const years& d) noexcept;
+
+#include <chrono>
+#include <type_traits>
+#include <cassert>
+
+#include "test_macros.h"
+
+template <typename Y, typename Ys>
+constexpr bool testConstexpr()
+{
+ Y y1{1};
+ if (static_cast<int>(y1 += Ys{ 1}) != 2) return false;
+ if (static_cast<int>(y1 += Ys{ 2}) != 4) return false;
+ if (static_cast<int>(y1 += Ys{ 8}) != 12) return false;
+ if (static_cast<int>(y1 -= Ys{ 1}) != 11) return false;
+ if (static_cast<int>(y1 -= Ys{ 2}) != 9) return false;
+ if (static_cast<int>(y1 -= Ys{ 8}) != 1) return false;
+ return true;
+}
+
+int main()
+{
+ using year = std::chrono::year;
+ using years = std::chrono::years;
+
+ ASSERT_NOEXCEPT(std::declval<year&>() += std::declval<years>());
+ ASSERT_NOEXCEPT(std::declval<year&>() -= std::declval<years>());
+
+ ASSERT_SAME_TYPE(year&, decltype(std::declval<year&>() += std::declval<years>()));
+ ASSERT_SAME_TYPE(year&, decltype(std::declval<year&>() -= std::declval<years>()));
+
+ static_assert(testConstexpr<year, years>(), "");
+
+ for (int i = 10000; i <= 10020; ++i)
+ {
+ year year(i);
+ assert(static_cast<int>(year += years{10}) == i + 10);
+ assert(static_cast<int>(year) == i + 10);
+ assert(static_cast<int>(year -= years{ 9}) == i + 1);
+ assert(static_cast<int>(year) == i + 1);
+ }
+}
diff --git a/test/std/utilities/time/time.cal/time.cal.year/time.cal.year.nonmembers/comparisons.pass.cpp b/test/std/utilities/time/time.cal/time.cal.year/time.cal.year.nonmembers/comparisons.pass.cpp
new file mode 100644
index 0000000000000..70bf9e11a6133
--- /dev/null
+++ b/test/std/utilities/time/time.cal/time.cal.year/time.cal.year.nonmembers/comparisons.pass.cpp
@@ -0,0 +1,47 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
+
+// <chrono>
+// class year;
+
+// constexpr bool operator==(const year& x, const year& y) noexcept;
+// constexpr bool operator!=(const year& x, const year& y) noexcept;
+// constexpr bool operator< (const year& x, const year& y) noexcept;
+// constexpr bool operator> (const year& x, const year& y) noexcept;
+// constexpr bool operator<=(const year& x, const year& y) noexcept;
+// constexpr bool operator>=(const year& x, const year& y) noexcept;
+
+
+#include <chrono>
+#include <type_traits>
+#include <cassert>
+
+#include "test_macros.h"
+#include "test_comparisons.h"
+
+
+int main()
+{
+ using year = std::chrono::year;
+
+ AssertComparisons6AreNoexcept<year>();
+ AssertComparisons6ReturnBool<year>();
+
+ static_assert(testComparisons6Values<year>(0,0), "");
+ static_assert(testComparisons6Values<year>(0,1), "");
+
+// Some 'ok' values as well
+ static_assert(testComparisons6Values<year>( 5, 5), "");
+ static_assert(testComparisons6Values<year>( 5,10), "");
+
+ for (int i = 1; i < 10; ++i)
+ for (int j = 1; j < 10; ++j)
+ assert(testComparisons6Values<year>(i, j));
+}
diff --git a/test/std/utilities/time/time.cal/time.cal.year/time.cal.year.nonmembers/literals.fail.cpp b/test/std/utilities/time/time.cal/time.cal.year/time.cal.year.nonmembers/literals.fail.cpp
new file mode 100644
index 0000000000000..1d757ec08f826
--- /dev/null
+++ b/test/std/utilities/time/time.cal/time.cal.year/time.cal.year.nonmembers/literals.fail.cpp
@@ -0,0 +1,28 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
+// UNSUPPORTED: clang-5, clang-6
+// UNSUPPORTED: apple-clang-6, apple-clang-7, apple-clang-8, apple-clang-9, apple-clang-10
+
+// <chrono>
+// class year;
+
+// constexpr year operator""y(unsigned long long y) noexcept;
+
+#include <chrono>
+#include <type_traits>
+#include <cassert>
+
+#include "test_macros.h"
+
+int main()
+{
+ using std::chrono::year;
+ year d1 = 1234y; // expected-error-re {{no matching literal operator for call to 'operator""y' {{.*}}}}
+}
diff --git a/test/std/utilities/time/time.cal/time.cal.year/time.cal.year.nonmembers/literals.pass.cpp b/test/std/utilities/time/time.cal/time.cal.year/time.cal.year.nonmembers/literals.pass.cpp
new file mode 100644
index 0000000000000..0661567d8b7f1
--- /dev/null
+++ b/test/std/utilities/time/time.cal/time.cal.year/time.cal.year.nonmembers/literals.pass.cpp
@@ -0,0 +1,44 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
+// UNSUPPORTED: clang-5, clang-6, clang-7
+// UNSUPPORTED: apple-clang-6, apple-clang-7, apple-clang-8, apple-clang-9, apple-clang-10
+
+// <chrono>
+// class year;
+
+// constexpr year operator""y(unsigned long long y) noexcept;
+
+#include <chrono>
+#include <type_traits>
+#include <cassert>
+
+#include "test_macros.h"
+
+int main()
+{
+ {
+ using namespace std::chrono;
+ ASSERT_NOEXCEPT(4y);
+
+ static_assert( 2017y == year(2017), "");
+ year y1 = 2018y;
+ assert (y1 == year(2018));
+ }
+
+ {
+ using namespace std::literals;
+ ASSERT_NOEXCEPT(4d);
+
+ static_assert( 2017y == std::chrono::year(2017), "");
+
+ std::chrono::year y1 = 2020y;
+ assert (y1 == std::chrono::year(2020));
+ }
+}
diff --git a/test/std/utilities/time/time.cal/time.cal.year/time.cal.year.nonmembers/minus.pass.cpp b/test/std/utilities/time/time.cal/time.cal.year/time.cal.year.nonmembers/minus.pass.cpp
new file mode 100644
index 0000000000000..04cf9f617b3bf
--- /dev/null
+++ b/test/std/utilities/time/time.cal/time.cal.year/time.cal.year.nonmembers/minus.pass.cpp
@@ -0,0 +1,62 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
+
+// <chrono>
+// class year;
+
+// constexpr year operator-(const year& x, const years& y) noexcept;
+// Returns: x + -y.
+//
+// constexpr years operator-(const year& x, const year& y) noexcept;
+// Returns: If x.ok() == true and y.ok() == true, returns a value m in the range
+// [years{0}, years{11}] satisfying y + m == x.
+// Otherwise the value returned is unspecified.
+// [Example: January - February == years{11}. —end example]
+
+extern "C" int printf(const char *, ...);
+
+#include <chrono>
+#include <type_traits>
+#include <cassert>
+
+#include "test_macros.h"
+
+template <typename Y, typename Ys>
+constexpr bool testConstexpr()
+{
+ Y y{2313};
+ Ys offset{1006};
+ if (y - offset != Y{1307}) return false;
+ if (y - Y{1307} != offset) return false;
+ return true;
+}
+
+int main()
+{
+ using year = std::chrono::year;
+ using years = std::chrono::years;
+
+ ASSERT_NOEXCEPT( std::declval<year>() - std::declval<years>());
+ ASSERT_SAME_TYPE(year , decltype(std::declval<year>() - std::declval<years>()));
+
+ ASSERT_NOEXCEPT( std::declval<year>() - std::declval<year>());
+ ASSERT_SAME_TYPE(years, decltype(std::declval<year>() - std::declval<year>()));
+
+ static_assert(testConstexpr<year, years>(), "");
+
+ year y{1223};
+ for (int i = 1100; i <= 1110; ++i)
+ {
+ year y1 = y - years{i};
+ years ys1 = y - year{i};
+ assert(static_cast<int>(y1) == 1223 - i);
+ assert(ys1.count() == 1223 - i);
+ }
+}
diff --git a/test/std/utilities/time/time.cal/time.cal.year/time.cal.year.nonmembers/plus.pass.cpp b/test/std/utilities/time/time.cal/time.cal.year/time.cal.year.nonmembers/plus.pass.cpp
new file mode 100644
index 0000000000000..dfb3c5f982f2c
--- /dev/null
+++ b/test/std/utilities/time/time.cal/time.cal.year/time.cal.year.nonmembers/plus.pass.cpp
@@ -0,0 +1,59 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
+
+// <chrono>
+// class year;
+
+// constexpr year operator+(const year& x, const years& y) noexcept;
+// Returns: year(int{x} + y.count()).
+//
+// constexpr year operator+(const years& x, const year& y) noexcept;
+// Returns: y + x
+
+
+#include <chrono>
+#include <type_traits>
+#include <cassert>
+
+#include "test_macros.h"
+
+template <typename Y, typename Ys>
+constexpr bool testConstexpr()
+{
+ Y y{1001};
+ Ys offset{23};
+ if (y + offset != Y{1024}) return false;
+ if (offset + y != Y{1024}) return false;
+ return true;
+}
+
+int main()
+{
+ using year = std::chrono::year;
+ using years = std::chrono::years;
+
+ ASSERT_NOEXCEPT( std::declval<year>() + std::declval<years>());
+ ASSERT_SAME_TYPE(year, decltype(std::declval<year>() + std::declval<years>()));
+
+ ASSERT_NOEXCEPT( std::declval<years>() + std::declval<year>());
+ ASSERT_SAME_TYPE(year, decltype(std::declval<years>() + std::declval<year>()));
+
+ static_assert(testConstexpr<year, years>(), "");
+
+ year y{1223};
+ for (int i = 1100; i <= 1110; ++i)
+ {
+ year y1 = y + years{i};
+ year y2 = years{i} + y;
+ assert(y1 == y2);
+ assert(static_cast<int>(y1) == i + 1223);
+ assert(static_cast<int>(y2) == i + 1223);
+ }
+}
diff --git a/test/std/utilities/time/time.cal/time.cal.year/time.cal.year.nonmembers/streaming.pass.cpp b/test/std/utilities/time/time.cal/time.cal.year/time.cal.year.nonmembers/streaming.pass.cpp
new file mode 100644
index 0000000000000..4bc92df215c5c
--- /dev/null
+++ b/test/std/utilities/time/time.cal/time.cal.year/time.cal.year.nonmembers/streaming.pass.cpp
@@ -0,0 +1,55 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
+// XFAIL: *
+
+// <chrono>
+// class year;
+
+// template<class charT, class traits>
+// basic_ostream<charT, traits>&
+// operator<<(basic_ostream<charT, traits>& os, const year& y);
+//
+// Effects: Inserts format(fmt, y) where fmt is "%Y" widened to charT.
+// If !y.ok(), appends with " is not a valid year".
+//
+// template<class charT, class traits>
+// basic_ostream<charT, traits>&
+// to_stream(basic_ostream<charT, traits>& os, const charT* fmt, const year& y);
+//
+// Effects: Streams y into os using the format specified by the NTCTS fmt.
+// fmt encoding follows the rules specified in 25.11.
+//
+// template<class charT, class traits, class Alloc = allocator<charT>>
+// basic_istream<charT, traits>&
+// from_stream(basic_istream<charT, traits>& is, const charT* fmt,
+// year& y, basic_string<charT, traits, Alloc>* abbrev = nullptr,
+// minutes* offset = nullptr);
+//
+// Effects: Attempts to parse the input stream is into the year y using the format flags
+// given in the NTCTS fmt as specified in 25.12. If the parse fails to decode a valid year,
+// is.setstate(ios_base::failbit) shall be called and y shall not be modified. If %Z is used
+// and successfully parsed, that value will be assigned to *abbrev if abbrev is non-null.
+// If %z (or a modified variant) is used and successfully parsed, that value will be
+// assigned to *offset if offset is non-null.
+
+
+#include <chrono>
+#include <type_traits>
+#include <cassert>
+#include <iostream>
+
+#include "test_macros.h"
+
+int main()
+{
+ using year = std::chrono::year;
+
+ std::cout << year{2018};
+}
diff --git a/test/std/utilities/time/time.cal/time.cal.year/types.pass.cpp b/test/std/utilities/time/time.cal/time.cal.year/types.pass.cpp
new file mode 100644
index 0000000000000..92094b0c2185b
--- /dev/null
+++ b/test/std/utilities/time/time.cal/time.cal.year/types.pass.cpp
@@ -0,0 +1,26 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
+
+// <chrono>
+// class year;
+
+#include <chrono>
+#include <type_traits>
+#include <cassert>
+
+#include "test_macros.h"
+
+int main()
+{
+ using year = std::chrono::year;
+
+ static_assert(std::is_trivially_copyable_v<year>, "");
+ static_assert(std::is_standard_layout_v<year>, "");
+}
diff --git a/test/std/utilities/time/time.cal/time.cal.ym/time.cal.ym.members/ctor.pass.cpp b/test/std/utilities/time/time.cal/time.cal.ym/time.cal.ym.members/ctor.pass.cpp
new file mode 100644
index 0000000000000..4a1cc9087ff38
--- /dev/null
+++ b/test/std/utilities/time/time.cal/time.cal.ym/time.cal.ym.members/ctor.pass.cpp
@@ -0,0 +1,52 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
+
+// <chrono>
+// class year_month;
+
+// year_month() = default;
+// constexpr year_month(const chrono::year& y, const chrono::month& m) noexcept;
+//
+// Effects: Constructs an object of type year_month by initializing y_ with y, and m_ with m.
+//
+// constexpr chrono::year year() const noexcept;
+// constexpr chrono::month month() const noexcept;
+// constexpr bool ok() const noexcept;
+
+#include <chrono>
+#include <type_traits>
+#include <cassert>
+
+#include "test_macros.h"
+
+int main()
+{
+ using year = std::chrono::year;
+ using month = std::chrono::month;
+ using year_month = std::chrono::year_month;
+
+ ASSERT_NOEXCEPT(year_month{});
+ ASSERT_NOEXCEPT(year_month{year{1}, month{1}});
+
+ constexpr year_month ym0{};
+ static_assert( ym0.year() == year{}, "");
+ static_assert( ym0.month() == month{}, "");
+ static_assert(!ym0.ok(), "");
+
+ constexpr year_month ym1{year{2018}, std::chrono::January};
+ static_assert( ym1.year() == year{2018}, "");
+ static_assert( ym1.month() == std::chrono::January, "");
+ static_assert( ym1.ok(), "");
+
+ constexpr year_month ym2{year{2018}, month{}};
+ static_assert( ym2.year() == year{2018}, "");
+ static_assert( ym2.month() == month{}, "");
+ static_assert(!ym2.ok(), "");
+}
diff --git a/test/std/utilities/time/time.cal/time.cal.ym/time.cal.ym.members/month.pass.cpp b/test/std/utilities/time/time.cal/time.cal.ym/time.cal.ym.members/month.pass.cpp
new file mode 100644
index 0000000000000..7a6dba18b814f
--- /dev/null
+++ b/test/std/utilities/time/time.cal/time.cal.ym/time.cal.ym.members/month.pass.cpp
@@ -0,0 +1,39 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
+
+// <chrono>
+// class year_month;
+
+// constexpr chrono::month month() const noexcept;
+// Returns: wd_
+
+#include <chrono>
+#include <type_traits>
+#include <cassert>
+
+#include "test_macros.h"
+
+int main()
+{
+ using year = std::chrono::year;
+ using month = std::chrono::month;
+ using year_month = std::chrono::year_month;
+
+ ASSERT_NOEXCEPT( std::declval<const year_month>().month());
+ ASSERT_SAME_TYPE(month, decltype(std::declval<const year_month>().month()));
+
+ static_assert( year_month{}.month() == month{}, "");
+
+ for (unsigned i = 1; i <= 50; ++i)
+ {
+ year_month ym(year{1234}, month{i});
+ assert( static_cast<unsigned>(ym.month()) == i);
+ }
+}
diff --git a/test/std/utilities/time/time.cal/time.cal.ym/time.cal.ym.members/ok.pass.cpp b/test/std/utilities/time/time.cal/time.cal.ym/time.cal.ym.members/ok.pass.cpp
new file mode 100644
index 0000000000000..7e84b37ab3bf7
--- /dev/null
+++ b/test/std/utilities/time/time.cal/time.cal.ym/time.cal.ym.members/ok.pass.cpp
@@ -0,0 +1,50 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
+
+// <chrono>
+// class year_month;
+
+// constexpr bool ok() const noexcept;
+// Returns: m_.ok() && y_.ok().
+
+#include <chrono>
+#include <type_traits>
+#include <cassert>
+
+#include "test_macros.h"
+
+int main()
+{
+ using month = std::chrono::month;
+ using year = std::chrono::year;
+ using year_month = std::chrono::year_month;
+
+ constexpr month January = std::chrono::January;
+
+ ASSERT_NOEXCEPT( std::declval<const year_month>().ok());
+ ASSERT_SAME_TYPE(bool, decltype(std::declval<const year_month>().ok()));
+
+ static_assert(!year_month{year{-32768}, January}.ok(), ""); // Bad year
+ static_assert(!year_month{year{2019}, month{}}.ok(), ""); // Bad month
+ static_assert( year_month{year{2019}, January}.ok(), ""); // Both OK
+
+ for (unsigned i = 0; i <= 50; ++i)
+ {
+ year_month ym{year{2019}, month{i}};
+ assert( ym.ok() == month{i}.ok());
+ }
+
+ const int ymax = static_cast<int>(year::max());
+ for (int i = ymax - 100; i <= ymax + 100; ++i)
+ {
+ year_month ym{year{i}, January};
+ assert( ym.ok() == year{i}.ok());
+ }
+}
diff --git a/test/std/utilities/time/time.cal/time.cal.ym/time.cal.ym.members/plus_minus_equal_month.pass.cpp b/test/std/utilities/time/time.cal/time.cal.ym/time.cal.ym.members/plus_minus_equal_month.pass.cpp
new file mode 100644
index 0000000000000..44648c4a0241c
--- /dev/null
+++ b/test/std/utilities/time/time.cal/time.cal.ym/time.cal.ym.members/plus_minus_equal_month.pass.cpp
@@ -0,0 +1,64 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
+
+// <chrono>
+// class year_month;
+
+// constexpr year_month& operator+=(const months& d) noexcept;
+// constexpr year_month& operator-=(const months& d) noexcept;
+
+#include <chrono>
+#include <type_traits>
+#include <cassert>
+
+#include "test_macros.h"
+
+template <typename D, typename Ds>
+constexpr bool testConstexpr(D d1)
+{
+ if (static_cast<unsigned>((d1 ).month()) != 1) return false;
+ if (static_cast<unsigned>((d1 += Ds{ 1}).month()) != 2) return false;
+ if (static_cast<unsigned>((d1 += Ds{ 2}).month()) != 4) return false;
+ if (static_cast<unsigned>((d1 += Ds{12}).month()) != 4) return false;
+ if (static_cast<unsigned>((d1 -= Ds{ 1}).month()) != 3) return false;
+ if (static_cast<unsigned>((d1 -= Ds{ 2}).month()) != 1) return false;
+ if (static_cast<unsigned>((d1 -= Ds{12}).month()) != 1) return false;
+ return true;
+}
+
+int main()
+{
+ using month = std::chrono::month;
+ using months = std::chrono::months;
+ using year = std::chrono::year;
+ using year_month = std::chrono::year_month;
+
+ ASSERT_NOEXCEPT( std::declval<year_month&>() += std::declval<months>());
+ ASSERT_SAME_TYPE(year_month&, decltype(std::declval<year_month&>() += std::declval<months>()));
+
+ ASSERT_NOEXCEPT( std::declval<year_month&>() -= std::declval<months>());
+ ASSERT_SAME_TYPE(year_month&, decltype(std::declval<year_month&>() -= std::declval<months>()));
+
+ static_assert(testConstexpr<year_month, months>(year_month{year{1234}, month{1}}), "");
+
+ for (unsigned i = 0; i <= 10; ++i)
+ {
+ year y{1234};
+ year_month ym(y, month{i});
+ assert(static_cast<unsigned>((ym += months{2}).month()) == i + 2);
+ assert(ym.year() == y);
+ assert(static_cast<unsigned>((ym ).month()) == i + 2);
+ assert(ym.year() == y);
+ assert(static_cast<unsigned>((ym -= months{1}).month()) == i + 1);
+ assert(ym.year() == y);
+ assert(static_cast<unsigned>((ym ).month()) == i + 1);
+ assert(ym.year() == y);
+ }
+}
diff --git a/test/std/utilities/time/time.cal/time.cal.ym/time.cal.ym.members/plus_minus_equal_year.pass.cpp b/test/std/utilities/time/time.cal/time.cal.ym/time.cal.ym.members/plus_minus_equal_year.pass.cpp
new file mode 100644
index 0000000000000..073a2865614e4
--- /dev/null
+++ b/test/std/utilities/time/time.cal/time.cal.ym/time.cal.ym.members/plus_minus_equal_year.pass.cpp
@@ -0,0 +1,65 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
+
+// <chrono>
+// class year_month;
+
+// constexpr year_month& operator+=(const years& d) noexcept;
+// constexpr year_month& operator-=(const years& d) noexcept;
+
+#include <chrono>
+#include <type_traits>
+#include <cassert>
+
+#include "test_macros.h"
+
+template <typename D, typename Ds>
+constexpr bool testConstexpr(D d1)
+{
+ if (static_cast<int>((d1 ).year()) != 1) return false;
+ if (static_cast<int>((d1 += Ds{ 1}).year()) != 2) return false;
+ if (static_cast<int>((d1 += Ds{ 2}).year()) != 4) return false;
+ if (static_cast<int>((d1 += Ds{12}).year()) != 16) return false;
+ if (static_cast<int>((d1 -= Ds{ 1}).year()) != 15) return false;
+ if (static_cast<int>((d1 -= Ds{ 2}).year()) != 13) return false;
+ if (static_cast<int>((d1 -= Ds{12}).year()) != 1) return false;
+ return true;
+}
+
+int main()
+{
+ using month = std::chrono::month;
+ using year = std::chrono::year;
+ using years = std::chrono::years;
+ using year_month = std::chrono::year_month;
+
+
+ ASSERT_NOEXCEPT( std::declval<year_month&>() += std::declval<years>());
+ ASSERT_SAME_TYPE(year_month&, decltype(std::declval<year_month&>() += std::declval<years>()));
+
+ ASSERT_NOEXCEPT( std::declval<year_month&>() -= std::declval<years>());
+ ASSERT_SAME_TYPE(year_month&, decltype(std::declval<year_month&>() -= std::declval<years>()));
+
+ static_assert(testConstexpr<year_month, years>(year_month{year{1}, month{1}}), "");
+
+ for (int i = 1000; i <= 1010; ++i)
+ {
+ month m{2};
+ year_month ym(year{i}, m);
+ assert(static_cast<int>((ym += years{2}).year()) == i + 2);
+ assert(ym.month() == m);
+ assert(static_cast<int>((ym ).year()) == i + 2);
+ assert(ym.month() == m);
+ assert(static_cast<int>((ym -= years{1}).year()) == i + 1);
+ assert(ym.month() == m);
+ assert(static_cast<int>((ym ).year()) == i + 1);
+ assert(ym.month() == m);
+ }
+}
diff --git a/test/std/utilities/time/time.cal/time.cal.ym/time.cal.ym.members/year.pass.cpp b/test/std/utilities/time/time.cal/time.cal.ym/time.cal.ym.members/year.pass.cpp
new file mode 100644
index 0000000000000..88e28026a9d2b
--- /dev/null
+++ b/test/std/utilities/time/time.cal/time.cal.ym/time.cal.ym.members/year.pass.cpp
@@ -0,0 +1,39 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
+
+// <chrono>
+// class year_month;
+
+// constexpr chrono::day day() const noexcept;
+// Returns: d_
+
+#include <chrono>
+#include <type_traits>
+#include <cassert>
+
+#include "test_macros.h"
+
+int main()
+{
+ using year = std::chrono::year;
+ using month = std::chrono::month;
+ using year_month = std::chrono::year_month;
+
+ ASSERT_NOEXCEPT( std::declval<const year_month>().year());
+ ASSERT_SAME_TYPE(year, decltype(std::declval<const year_month>().year()));
+
+ static_assert( year_month{}.year() == year{}, "");
+
+ for (int i = 1; i <= 50; ++i)
+ {
+ year_month ym(year{i}, month{});
+ assert( static_cast<int>(ym.year()) == i);
+ }
+}
diff --git a/test/std/utilities/time/time.cal/time.cal.ym/time.cal.ym.nonmembers/comparisons.pass.cpp b/test/std/utilities/time/time.cal/time.cal.ym/time.cal.ym.nonmembers/comparisons.pass.cpp
new file mode 100644
index 0000000000000..d0c8d1e8cc1fe
--- /dev/null
+++ b/test/std/utilities/time/time.cal/time.cal.ym/time.cal.ym.nonmembers/comparisons.pass.cpp
@@ -0,0 +1,69 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
+
+// <chrono>
+// class year_month;
+
+// constexpr bool operator==(const year_month& x, const year_month& y) noexcept;
+// Returns: x.year() == y.year() && x.month() == y.month().
+//
+// constexpr bool operator< (const year_month& x, const year_month& y) noexcept;
+// Returns:
+// If x.year() < y.year() returns true.
+// Otherwise, if x.year() > y.year() returns false.
+// Otherwise, returns x.month() < y.month().
+
+#include <chrono>
+#include <type_traits>
+#include <cassert>
+
+#include "test_macros.h"
+#include "test_comparisons.h"
+
+int main()
+{
+ using year = std::chrono::year;
+ using month = std::chrono::month;
+ using year_month = std::chrono::year_month;
+
+ AssertComparisons6AreNoexcept<year_month>();
+ AssertComparisons6ReturnBool<year_month>();
+
+ static_assert( testComparisons6(
+ year_month{year{1234}, std::chrono::January},
+ year_month{year{1234}, std::chrono::January},
+ true, false), "");
+
+ static_assert( testComparisons6(
+ year_month{year{1234}, std::chrono::January},
+ year_month{year{1234}, std::chrono::February},
+ false, true), "");
+
+ static_assert( testComparisons6(
+ year_month{year{1234}, std::chrono::January},
+ year_month{year{1235}, std::chrono::January},
+ false, true), "");
+
+// same year, different months
+ for (unsigned i = 1; i < 12; ++i)
+ for (unsigned j = 1; j < 12; ++j)
+ assert((testComparisons6(
+ year_month{year{1234}, month{i}},
+ year_month{year{1234}, month{j}},
+ i == j, i < j )));
+
+// same month, different years
+ for (int i = 1000; i < 20; ++i)
+ for (int j = 1000; j < 20; ++j)
+ assert((testComparisons6(
+ year_month{year{i}, std::chrono::January},
+ year_month{year{j}, std::chrono::January},
+ i == j, i < j )));
+}
diff --git a/test/std/utilities/time/time.cal/time.cal.ym/time.cal.ym.nonmembers/minus.pass.cpp b/test/std/utilities/time/time.cal/time.cal.ym/time.cal.ym.nonmembers/minus.pass.cpp
new file mode 100644
index 0000000000000..1f77811accc07
--- /dev/null
+++ b/test/std/utilities/time/time.cal/time.cal.ym/time.cal.ym.nonmembers/minus.pass.cpp
@@ -0,0 +1,90 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
+
+// <chrono>
+// class year_month;
+
+// constexpr year_month operator-(const year_month& ym, const years& dy) noexcept;
+// Returns: ym + -dy.
+//
+// constexpr year_month operator-(const year_month& ym, const months& dm) noexcept;
+// Returns: ym + -dm.
+//
+// constexpr months operator-(const year_month& x, const year_month& y) noexcept;
+// Returns: x.year() - y.year() + months{static_cast<int>(unsigned{x.month()}) -
+// static_cast<int>(unsigned{y.month()})}
+
+
+#include <chrono>
+#include <type_traits>
+#include <cassert>
+
+#include "test_macros.h"
+
+#include <iostream>
+
+int main()
+{
+ using year = std::chrono::year;
+ using years = std::chrono::years;
+ using month = std::chrono::month;
+ using months = std::chrono::months;
+ using year_month = std::chrono::year_month;
+
+ { // year_month - years
+ ASSERT_NOEXCEPT( std::declval<year_month>() - std::declval<years>());
+ ASSERT_SAME_TYPE(year_month, decltype(std::declval<year_month>() - std::declval<years>()));
+
+// static_assert(testConstexprYears (year_month{year{1}, month{1}}), "");
+
+ year_month ym{year{1234}, std::chrono::January};
+ for (int i = 0; i <= 10; ++i)
+ {
+ year_month ym1 = ym - years{i};
+ assert(static_cast<int>(ym1.year()) == 1234 - i);
+ assert(ym1.month() == std::chrono::January);
+ }
+ }
+
+ { // year_month - months
+ ASSERT_NOEXCEPT( std::declval<year_month>() - std::declval<months>());
+ ASSERT_SAME_TYPE(year_month, decltype(std::declval<year_month>() - std::declval<months>()));
+
+// static_assert(testConstexprMonths(year_month{year{1}, month{1}}), "");
+
+ year_month ym{year{1234}, std::chrono::November};
+ for (int i = 0; i <= 10; ++i) // TODO test wrap-around
+ {
+ year_month ym1 = ym - months{i};
+ assert(static_cast<int>(ym1.year()) == 1234);
+ assert(ym1.month() == month(11 - i));
+ }
+ }
+
+ { // year_month - year_month
+ ASSERT_NOEXCEPT( std::declval<year_month>() - std::declval<year_month>());
+ ASSERT_SAME_TYPE(months, decltype(std::declval<year_month>() - std::declval<year_month>()));
+
+// static_assert(testConstexprMonths(year_month{year{1}, month{1}}), "");
+
+// Same year
+ year y{2345};
+ for (int i = 1; i <= 12; ++i)
+ for (int j = 1; j <= 12; ++j)
+ {
+ months diff = year_month{y, month(i)} - year_month{y, month(j)};
+ std::cout << "i: " << i << " j: " << j << " -> " << diff.count() << std::endl;
+ assert(diff.count() == i - j);
+ }
+
+// TODO: different year
+
+ }
+}
diff --git a/test/std/utilities/time/time.cal/time.cal.ym/time.cal.ym.nonmembers/plus.pass.cpp b/test/std/utilities/time/time.cal/time.cal.ym/time.cal.ym.nonmembers/plus.pass.cpp
new file mode 100644
index 0000000000000..67616764d3c52
--- /dev/null
+++ b/test/std/utilities/time/time.cal/time.cal.ym/time.cal.ym.nonmembers/plus.pass.cpp
@@ -0,0 +1,106 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
+
+// <chrono>
+// class year_month;
+
+// constexpr year_month operator+(const year_month& ym, const years& dy) noexcept;
+// Returns: (ym.year() + dy) / ym.month().
+//
+// constexpr year_month operator+(const years& dy, const year_month& ym) noexcept;
+// Returns: ym + dy.
+//
+// constexpr year_month operator+(const year_month& ym, const months& dm) noexcept;
+// Returns: A year_month value z such that z - ym == dm.
+// Complexity: O(1) with respect to the value of dm.
+//
+// constexpr year_month operator+(const months& dm, const year_month& ym) noexcept;
+// Returns: ym + dm.
+
+
+
+#include <chrono>
+#include <type_traits>
+#include <cassert>
+
+#include "test_macros.h"
+
+constexpr bool testConstexprYears(std::chrono::year_month ym)
+{
+ std::chrono::years offset{23};
+ if (static_cast<int>((ym ).year()) != 1) return false;
+ if (static_cast<int>((ym + offset).year()) != 24) return false;
+ if (static_cast<int>((offset + ym).year()) != 24) return false;
+ return true;
+}
+
+
+constexpr bool testConstexprMonths(std::chrono::year_month ym)
+{
+ std::chrono::months offset{6};
+ if (static_cast<unsigned>((ym ).month()) != 1) return false;
+ if (static_cast<unsigned>((ym + offset).month()) != 7) return false;
+ if (static_cast<unsigned>((offset + ym).month()) != 7) return false;
+ return true;
+}
+
+
+int main()
+{
+ using year = std::chrono::year;
+ using years = std::chrono::years;
+ using month = std::chrono::month;
+ using months = std::chrono::months;
+ using year_month = std::chrono::year_month;
+
+ { // year_month + years
+ ASSERT_NOEXCEPT(std::declval<year_month>() + std::declval<years>());
+ ASSERT_NOEXCEPT(std::declval<years>() + std::declval<year_month>());
+
+ ASSERT_SAME_TYPE(year_month, decltype(std::declval<year_month>() + std::declval<years>()));
+ ASSERT_SAME_TYPE(year_month, decltype(std::declval<years>() + std::declval<year_month>()));
+
+ static_assert(testConstexprYears (year_month{year{1}, month{1}}), "");
+
+ year_month ym{year{1234}, std::chrono::January};
+ for (int i = 0; i <= 10; ++i)
+ {
+ year_month ym1 = ym + years{i};
+ year_month ym2 = years{i} + ym;
+ assert(static_cast<int>(ym1.year()) == i + 1234);
+ assert(static_cast<int>(ym2.year()) == i + 1234);
+ assert(ym1.month() == std::chrono::January);
+ assert(ym2.month() == std::chrono::January);
+ assert(ym1 == ym2);
+ }
+ }
+
+ { // year_month + months
+ ASSERT_NOEXCEPT(std::declval<year_month>() + std::declval<months>());
+ ASSERT_NOEXCEPT(std::declval<months>() + std::declval<year_month>());
+
+ ASSERT_SAME_TYPE(year_month, decltype(std::declval<year_month>() + std::declval<months>()));
+ ASSERT_SAME_TYPE(year_month, decltype(std::declval<months>() + std::declval<year_month>()));
+
+ static_assert(testConstexprMonths(year_month{year{1}, month{1}}), "");
+
+ year_month ym{year{1234}, std::chrono::January};
+ for (int i = 0; i <= 10; ++i) // TODO test wrap-around
+ {
+ year_month ym1 = ym + months{i};
+ year_month ym2 = months{i} + ym;
+ assert(static_cast<int>(ym1.year()) == 1234);
+ assert(static_cast<int>(ym2.year()) == 1234);
+ assert(ym1.month() == month(1 + i));
+ assert(ym2.month() == month(1 + i));
+ assert(ym1 == ym2);
+ }
+ }
+}
diff --git a/test/std/utilities/time/time.cal/time.cal.ym/time.cal.ym.nonmembers/streaming.pass.cpp b/test/std/utilities/time/time.cal/time.cal.ym/time.cal.ym.nonmembers/streaming.pass.cpp
new file mode 100644
index 0000000000000..8679c96121181
--- /dev/null
+++ b/test/std/utilities/time/time.cal/time.cal.ym/time.cal.ym.nonmembers/streaming.pass.cpp
@@ -0,0 +1,57 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
+// XFAIL: *
+
+// <chrono>
+// class year_month;
+
+// template<class charT, class traits>
+// basic_ostream<charT, traits>&
+// operator<<(basic_ostream<charT, traits>& os, const year_month& ym);
+//
+// Returns: os << ym.year() << '/' << ym.month().
+//
+//
+// template<class charT, class traits>
+// basic_ostream<charT, traits>&
+// to_stream(basic_ostream<charT, traits>& os, const charT* fmt, const year_month& ym);
+//
+// Effects: Streams ym into os using the format specified by the NTCTS fmt. fmt encoding follows the rules specified in 25.11.
+//
+// template<class charT, class traits, class Alloc = allocator<charT>>
+// basic_istream<charT, traits>&
+// from_stream(basic_istream<charT, traits>& is, const charT* fmt,
+// year_month& ym, basic_string<charT, traits, Alloc>* abbrev = nullptr,
+// minutes* offset = nullptr);
+//
+// Effects: Attempts to parse the input stream is into the year_month ym using the format
+// flags given in the NTCTS fmt as specified in 25.12. If the parse fails to decode
+// a valid year_month, is.setstate(ios_- base::failbit) shall be called and ym shall
+// not be modified. If %Z is used and successfully parsed, that value will be assigned
+// to *abbrev if abbrev is non-null. If %z (or a modified variant) is used and
+// successfully parsed, that value will be assigned to *offset if offset is non-null.
+
+
+
+#include <chrono>
+#include <type_traits>
+#include <cassert>
+#include <iostream>
+
+#include "test_macros.h"
+
+int main()
+{
+ using year_month = std::chrono::year_month;
+ using year = std::chrono::year;
+ using month = std::chrono::month;
+
+ std::cout << year_month{year{2018}, month{3}};
+}
diff --git a/test/std/utilities/time/time.cal/time.cal.ym/types.pass.cpp b/test/std/utilities/time/time.cal/time.cal.ym/types.pass.cpp
new file mode 100644
index 0000000000000..200e2874d2245
--- /dev/null
+++ b/test/std/utilities/time/time.cal/time.cal.ym/types.pass.cpp
@@ -0,0 +1,26 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
+
+// <chrono>
+// class year_month;
+
+#include <chrono>
+#include <type_traits>
+#include <cassert>
+
+#include "test_macros.h"
+
+int main()
+{
+ using year_month = std::chrono::year_month;
+
+ static_assert(std::is_trivially_copyable_v<year_month>, "");
+ static_assert(std::is_standard_layout_v<year_month>, "");
+}
diff --git a/test/std/utilities/time/time.cal/time.cal.ymd/time.cal.ymd.members/ctor.local_days.pass.cpp b/test/std/utilities/time/time.cal/time.cal.ymd/time.cal.ymd.members/ctor.local_days.pass.cpp
new file mode 100644
index 0000000000000..5c7de1418fbdc
--- /dev/null
+++ b/test/std/utilities/time/time.cal/time.cal.ymd/time.cal.ymd.members/ctor.local_days.pass.cpp
@@ -0,0 +1,85 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
+
+// <chrono>
+// class year_month_day;
+
+// explicit constexpr year_month_day(const local_days& dp) noexcept;
+//
+//
+// Effects: Constructs an object of type year_month_day that corresponds
+// to the date represented by dp
+//
+// Remarks: Equivalent to constructing with sys_days{dp.time_since_epoch()}.
+//
+// constexpr chrono::year year() const noexcept;
+// constexpr chrono::month month() const noexcept;
+// constexpr chrono::day day() const noexcept;
+// constexpr bool ok() const noexcept;
+
+#include <chrono>
+#include <type_traits>
+#include <cassert>
+
+#include "test_macros.h"
+
+int main()
+{
+ using year = std::chrono::year;
+ using day = std::chrono::day;
+ using local_days = std::chrono::local_days;
+ using days = std::chrono::days;
+ using year_month_day = std::chrono::year_month_day;
+
+ ASSERT_NOEXCEPT(year_month_day{std::declval<local_days>()});
+
+ {
+ constexpr local_days sd{};
+ constexpr year_month_day ymd{sd};
+
+ static_assert( ymd.ok(), "");
+ static_assert( ymd.year() == year{1970}, "");
+ static_assert( ymd.month() == std::chrono::January, "");
+ static_assert( ymd.day() == day{1}, "");
+ }
+
+ {
+ constexpr local_days sd{days{10957+32}};
+ constexpr year_month_day ymd{sd};
+
+ static_assert( ymd.ok(), "");
+ static_assert( ymd.year() == year{2000}, "");
+ static_assert( ymd.month() == std::chrono::February, "");
+ static_assert( ymd.day() == day{2}, "");
+ }
+
+
+// There's one more leap day between 1/1/40 and 1/1/70
+// when compared to 1/1/70 -> 1/1/2000
+ {
+ constexpr local_days sd{days{-10957}};
+ constexpr year_month_day ymd{sd};
+
+ static_assert( ymd.ok(), "");
+ static_assert( ymd.year() == year{1940}, "");
+ static_assert( ymd.month() == std::chrono::January, "");
+ static_assert( ymd.day() == day{2}, "");
+ }
+
+ {
+ local_days sd{days{-(10957+34)}};
+ year_month_day ymd{sd};
+
+ assert( ymd.ok());
+ assert( ymd.year() == year{1939});
+ assert( ymd.month() == std::chrono::November);
+ assert( ymd.day() == day{29});
+ }
+}
diff --git a/test/std/utilities/time/time.cal/time.cal.ymd/time.cal.ymd.members/ctor.pass.cpp b/test/std/utilities/time/time.cal/time.cal.ymd/time.cal.ymd.members/ctor.pass.cpp
new file mode 100644
index 0000000000000..e2e0ac38ca937
--- /dev/null
+++ b/test/std/utilities/time/time.cal/time.cal.ymd/time.cal.ymd.members/ctor.pass.cpp
@@ -0,0 +1,56 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
+
+// <chrono>
+// class year_month_day;
+
+// year_month_day() = default;
+// constexpr year_month_day(const chrono::year& y, const chrono::month& m,
+// const chrono::day& d) noexcept;
+//
+// Effects: Constructs an object of type year_month_day by initializing
+// y_ with y, m_ with m, and d_ with d.
+//
+// constexpr chrono::year year() const noexcept;
+// constexpr chrono::month month() const noexcept;
+// constexpr chrono::day day() const noexcept;
+// constexpr bool ok() const noexcept;
+
+#include <chrono>
+#include <type_traits>
+#include <cassert>
+
+#include "test_macros.h"
+
+int main()
+{
+ using year = std::chrono::year;
+ using month = std::chrono::month;
+ using day = std::chrono::day;
+ using year_month_day = std::chrono::year_month_day;
+
+ ASSERT_NOEXCEPT(year_month_day{});
+ ASSERT_NOEXCEPT(year_month_day{year{1}, month{1}, day{1}});
+
+ constexpr month January = std::chrono::January;
+
+ constexpr year_month_day ym0{};
+ static_assert( ym0.year() == year{}, "");
+ static_assert( ym0.month() == month{}, "");
+ static_assert( ym0.day() == day{}, "");
+ static_assert(!ym0.ok(), "");
+
+ constexpr year_month_day ym1{year{2019}, January, day{12}};
+ static_assert( ym1.year() == year{2019}, "");
+ static_assert( ym1.month() == January, "");
+ static_assert( ym1.day() == day{12}, "");
+ static_assert( ym1.ok(), "");
+
+}
diff --git a/test/std/utilities/time/time.cal/time.cal.ymd/time.cal.ymd.members/ctor.sys_days.pass.cpp b/test/std/utilities/time/time.cal/time.cal.ymd/time.cal.ymd.members/ctor.sys_days.pass.cpp
new file mode 100644
index 0000000000000..36a6c7d180c1b
--- /dev/null
+++ b/test/std/utilities/time/time.cal/time.cal.ymd/time.cal.ymd.members/ctor.sys_days.pass.cpp
@@ -0,0 +1,84 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
+
+// <chrono>
+// class year_month_day;
+
+// constexpr year_month_day(const sys_days& dp) noexcept;
+//
+// Effects: Constructs an object of type year_month_day that corresponds
+// to the date represented by dp.
+//
+// Remarks: For any value ymd of type year_month_day for which ymd.ok() is true,
+// ymd == year_month_day{sys_days{ymd}} is true.
+//
+// constexpr chrono::year year() const noexcept;
+// constexpr chrono::month month() const noexcept;
+// constexpr bool ok() const noexcept;
+
+#include <chrono>
+#include <type_traits>
+#include <cassert>
+
+#include "test_macros.h"
+
+int main()
+{
+ using year = std::chrono::year;
+ using day = std::chrono::day;
+ using sys_days = std::chrono::sys_days;
+ using days = std::chrono::days;
+ using year_month_day = std::chrono::year_month_day;
+
+ ASSERT_NOEXCEPT(year_month_day{std::declval<sys_days>()});
+
+ {
+ constexpr sys_days sd{};
+ constexpr year_month_day ymd{sd};
+
+ static_assert( ymd.ok(), "");
+ static_assert( ymd.year() == year{1970}, "");
+ static_assert( ymd.month() == std::chrono::January, "");
+ static_assert( ymd.day() == day{1}, "");
+ }
+
+ {
+ constexpr sys_days sd{days{10957+32}};
+ constexpr year_month_day ymd{sd};
+
+ static_assert( ymd.ok(), "");
+ static_assert( ymd.year() == year{2000}, "");
+ static_assert( ymd.month() == std::chrono::February, "");
+ static_assert( ymd.day() == day{2}, "");
+ }
+
+
+// There's one more leap day between 1/1/40 and 1/1/70
+// when compared to 1/1/70 -> 1/1/2000
+ {
+ constexpr sys_days sd{days{-10957}};
+ constexpr year_month_day ymd{sd};
+
+ static_assert( ymd.ok(), "");
+ static_assert( ymd.year() == year{1940}, "");
+ static_assert( ymd.month() == std::chrono::January, "");
+ static_assert( ymd.day() == day{2}, "");
+ }
+
+ {
+ sys_days sd{days{-(10957+34)}};
+ year_month_day ymd{sd};
+
+ assert( ymd.ok());
+ assert( ymd.year() == year{1939});
+ assert( ymd.month() == std::chrono::November);
+ assert( ymd.day() == day{29});
+ }
+}
diff --git a/test/std/utilities/time/time.cal/time.cal.ymd/time.cal.ymd.members/ctor.year_month_day_last.pass.cpp b/test/std/utilities/time/time.cal/time.cal.ymd/time.cal.ymd.members/ctor.year_month_day_last.pass.cpp
new file mode 100644
index 0000000000000..a8d6526b328ad
--- /dev/null
+++ b/test/std/utilities/time/time.cal/time.cal.ymd/time.cal.ymd.members/ctor.year_month_day_last.pass.cpp
@@ -0,0 +1,80 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
+
+// <chrono>
+// class year_month_day;
+
+// constexpr year_month_day(const year_month_day_last& ymdl) noexcept;
+//
+// Effects: Constructs an object of type year_month_day by initializing
+// y_ with ymdl.year(), m_ with ymdl.month(), and d_ with ymdl.day().
+//
+// constexpr chrono::year year() const noexcept;
+// constexpr chrono::month month() const noexcept;
+// constexpr chrono::day day() const noexcept;
+// constexpr bool ok() const noexcept;
+
+#include <chrono>
+#include <type_traits>
+#include <cassert>
+
+#include "test_macros.h"
+
+int main()
+{
+ using year = std::chrono::year;
+ using month = std::chrono::month;
+ using day = std::chrono::day;
+ using month_day_last = std::chrono::month_day_last;
+ using year_month_day_last = std::chrono::year_month_day_last;
+ using year_month_day = std::chrono::year_month_day;
+
+ ASSERT_NOEXCEPT(year_month_day{std::declval<const year_month_day_last>()});
+
+ {
+ constexpr year_month_day_last ymdl{year{2019}, month_day_last{month{1}}};
+ constexpr year_month_day ymd{ymdl};
+
+ static_assert( ymd.year() == year{2019}, "");
+ static_assert( ymd.month() == month{1}, "");
+ static_assert( ymd.day() == day{31}, "");
+ static_assert( ymd.ok(), "");
+ }
+
+ {
+ constexpr year_month_day_last ymdl{year{1970}, month_day_last{month{4}}};
+ constexpr year_month_day ymd{ymdl};
+
+ static_assert( ymd.year() == year{1970}, "");
+ static_assert( ymd.month() == month{4}, "");
+ static_assert( ymd.day() == day{30}, "");
+ static_assert( ymd.ok(), "");
+ }
+
+ {
+ constexpr year_month_day_last ymdl{year{2000}, month_day_last{month{2}}};
+ constexpr year_month_day ymd{ymdl};
+
+ static_assert( ymd.year() == year{2000}, "");
+ static_assert( ymd.month() == month{2}, "");
+ static_assert( ymd.day() == day{29}, "");
+ static_assert( ymd.ok(), "");
+ }
+
+ { // Feb 1900 was NOT a leap year.
+ year_month_day_last ymdl{year{1900}, month_day_last{month{2}}};
+ year_month_day ymd{ymdl};
+
+ assert( ymd.year() == year{1900});
+ assert( ymd.month() == month{2});
+ assert( ymd.day() == day{28});
+ assert( ymd.ok());
+ }
+}
diff --git a/test/std/utilities/time/time.cal/time.cal.ymd/time.cal.ymd.members/day.pass.cpp b/test/std/utilities/time/time.cal/time.cal.ymd/time.cal.ymd.members/day.pass.cpp
new file mode 100644
index 0000000000000..c46b9ce85129b
--- /dev/null
+++ b/test/std/utilities/time/time.cal/time.cal.ymd/time.cal.ymd.members/day.pass.cpp
@@ -0,0 +1,40 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
+
+// <chrono>
+// class year_month_day;
+
+// constexpr chrono::day day() const noexcept;
+// Returns: wd_
+
+#include <chrono>
+#include <type_traits>
+#include <cassert>
+
+#include "test_macros.h"
+
+int main()
+{
+ using year = std::chrono::year;
+ using month = std::chrono::month;
+ using day = std::chrono::day;
+ using year_month_day = std::chrono::year_month_day;
+
+ ASSERT_NOEXCEPT( std::declval<const year_month_day>().day());
+ ASSERT_SAME_TYPE(day, decltype(std::declval<const year_month_day>().day()));
+
+ static_assert( year_month_day{}.day() == day{}, "");
+
+ for (unsigned i = 1; i <= 50; ++i)
+ {
+ year_month_day ymd(year{1234}, month{2}, day{i});
+ assert( static_cast<unsigned>(ymd.day()) == i);
+ }
+}
diff --git a/test/std/utilities/time/time.cal/time.cal.ymd/time.cal.ymd.members/month.pass.cpp b/test/std/utilities/time/time.cal/time.cal.ymd/time.cal.ymd.members/month.pass.cpp
new file mode 100644
index 0000000000000..b3c03041e892d
--- /dev/null
+++ b/test/std/utilities/time/time.cal/time.cal.ymd/time.cal.ymd.members/month.pass.cpp
@@ -0,0 +1,40 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
+
+// <chrono>
+// class year_month_day;
+
+// constexpr chrono::month month() const noexcept;
+// Returns: wd_
+
+#include <chrono>
+#include <type_traits>
+#include <cassert>
+
+#include "test_macros.h"
+
+int main()
+{
+ using year = std::chrono::year;
+ using month = std::chrono::month;
+ using day = std::chrono::day;
+ using year_month_day = std::chrono::year_month_day;
+
+ ASSERT_NOEXCEPT( std::declval<const year_month_day>().month());
+ ASSERT_SAME_TYPE(month, decltype(std::declval<const year_month_day>().month()));
+
+ static_assert( year_month_day{}.month() == month{}, "");
+
+ for (unsigned i = 1; i <= 50; ++i)
+ {
+ year_month_day ymd(year{1234}, month{i}, day{12});
+ assert( static_cast<unsigned>(ymd.month()) == i);
+ }
+}
diff --git a/test/std/utilities/time/time.cal/time.cal.ymd/time.cal.ymd.members/ok.pass.cpp b/test/std/utilities/time/time.cal/time.cal.ymd/time.cal.ymd.members/ok.pass.cpp
new file mode 100644
index 0000000000000..cab0599b9ed39
--- /dev/null
+++ b/test/std/utilities/time/time.cal/time.cal.ymd/time.cal.ymd.members/ok.pass.cpp
@@ -0,0 +1,96 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
+
+// <chrono>
+// class year_month_day;
+
+// constexpr bool ok() const noexcept;
+// Returns: m_.ok() && y_.ok().
+
+#include <chrono>
+#include <type_traits>
+#include <cassert>
+
+#include "test_macros.h"
+
+int main()
+{
+ using year = std::chrono::year;
+ using month = std::chrono::month;
+ using day = std::chrono::day;
+ using year_month_day = std::chrono::year_month_day;
+
+ constexpr month January = std::chrono::January;
+
+ ASSERT_NOEXCEPT( std::declval<const year_month_day>().ok());
+ ASSERT_SAME_TYPE(bool, decltype(std::declval<const year_month_day>().ok()));
+
+ static_assert(!year_month_day{year{-32768}, month{}, day{}}.ok(), ""); // All three bad
+
+ static_assert(!year_month_day{year{-32768}, January, day{1}}.ok(), ""); // Bad year
+ static_assert(!year_month_day{year{2019}, month{}, day{1}}.ok(), ""); // Bad month
+ static_assert(!year_month_day{year{2019}, January, day{} }.ok(), ""); // Bad day
+
+ static_assert(!year_month_day{year{-32768}, month{}, day{1}}.ok(), ""); // Bad year & month
+ static_assert(!year_month_day{year{2019}, month{}, day{} }.ok(), ""); // Bad month & day
+ static_assert(!year_month_day{year{-32768}, January, day{} }.ok(), ""); // Bad year & day
+
+ static_assert( year_month_day{year{2019}, January, day{1}}.ok(), ""); // All OK
+
+// Some months have a 31st
+ static_assert( year_month_day{year{2020}, month{ 1}, day{31}}.ok(), "");
+ static_assert(!year_month_day{year{2020}, month{ 2}, day{31}}.ok(), "");
+ static_assert( year_month_day{year{2020}, month{ 3}, day{31}}.ok(), "");
+ static_assert(!year_month_day{year{2020}, month{ 4}, day{31}}.ok(), "");
+ static_assert( year_month_day{year{2020}, month{ 5}, day{31}}.ok(), "");
+ static_assert(!year_month_day{year{2020}, month{ 6}, day{31}}.ok(), "");
+ static_assert( year_month_day{year{2020}, month{ 7}, day{31}}.ok(), "");
+ static_assert( year_month_day{year{2020}, month{ 8}, day{31}}.ok(), "");
+ static_assert(!year_month_day{year{2020}, month{ 9}, day{31}}.ok(), "");
+ static_assert( year_month_day{year{2020}, month{10}, day{31}}.ok(), "");
+ static_assert(!year_month_day{year{2020}, month{11}, day{31}}.ok(), "");
+ static_assert( year_month_day{year{2020}, month{12}, day{31}}.ok(), "");
+
+// Everyone except FEB has a 30th
+ static_assert( year_month_day{year{2020}, month{ 1}, day{30}}.ok(), "");
+ static_assert(!year_month_day{year{2020}, month{ 2}, day{30}}.ok(), "");
+ static_assert( year_month_day{year{2020}, month{ 3}, day{30}}.ok(), "");
+ static_assert( year_month_day{year{2020}, month{ 4}, day{30}}.ok(), "");
+ static_assert( year_month_day{year{2020}, month{ 5}, day{30}}.ok(), "");
+ static_assert( year_month_day{year{2020}, month{ 6}, day{30}}.ok(), "");
+ static_assert( year_month_day{year{2020}, month{ 7}, day{30}}.ok(), "");
+ static_assert( year_month_day{year{2020}, month{ 8}, day{30}}.ok(), "");
+ static_assert( year_month_day{year{2020}, month{ 9}, day{30}}.ok(), "");
+ static_assert( year_month_day{year{2020}, month{10}, day{30}}.ok(), "");
+ static_assert( year_month_day{year{2020}, month{11}, day{30}}.ok(), "");
+ static_assert( year_month_day{year{2020}, month{12}, day{30}}.ok(), "");
+
+ static_assert(!year_month_day{year{2019}, std::chrono::February, day{29}}.ok(), ""); // Not a leap year
+ static_assert( year_month_day{year{2020}, std::chrono::February, day{29}}.ok(), ""); // Ok; 2020 is a leap year
+
+ for (unsigned i = 0; i <= 50; ++i)
+ {
+ year_month_day ym{year{2019}, January, day{i}};
+ assert( ym.ok() == day{i}.ok());
+ }
+
+ for (unsigned i = 0; i <= 50; ++i)
+ {
+ year_month_day ym{year{2019}, month{i}, day{12}};
+ assert( ym.ok() == month{i}.ok());
+ }
+
+ const int ymax = static_cast<int>(year::max());
+ for (int i = ymax - 100; i <= ymax + 100; ++i)
+ {
+ year_month_day ym{year{i}, January, day{12}};
+ assert( ym.ok() == year{i}.ok());
+ }
+}
diff --git a/test/std/utilities/time/time.cal/time.cal.ymd/time.cal.ymd.members/op.local_days.pass.cpp b/test/std/utilities/time/time.cal/time.cal.ymd/time.cal.ymd.members/op.local_days.pass.cpp
new file mode 100644
index 0000000000000..a70fe30fc5dbf
--- /dev/null
+++ b/test/std/utilities/time/time.cal/time.cal.ymd/time.cal.ymd.members/op.local_days.pass.cpp
@@ -0,0 +1,94 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
+
+// <chrono>
+// class year_month_day;
+
+// constexpr operator local_days() const noexcept;
+//
+// Returns: If ok(), returns a local_days holding a count of days from the
+// local_days epoch to *this (a negative value if *this represents a date
+// prior to the sys_days epoch). Otherwise, if y_.ok() && m_.ok() is true,
+// returns a sys_days which is offset from sys_days{y_/m_/last} by the
+// number of days d_ is offset from sys_days{y_/m_/last}.day(). Otherwise
+// the value returned is unspecified.
+//
+// Remarks: A local_days in the range [days{-12687428}, days{11248737}] which
+// is converted to a year_month_day shall have the same value when
+// converted back to a sys_days.
+//
+// [Example:
+// static_assert(year_month_day{local_days{2017y/January/0}} == 2016y/December/31);
+// static_assert(year_month_day{local_days{2017y/January/31}} == 2017y/January/31);
+// static_assert(year_month_day{local_days{2017y/January/32}} == 2017y/February/1);
+// —end example]
+
+#include <chrono>
+#include <type_traits>
+#include <cassert>
+
+#include "test_macros.h"
+
+void RunTheExample()
+{
+ using namespace std::chrono;
+
+ static_assert(year_month_day{local_days{year{2017}/January/0}} == year{2016}/December/31);
+ static_assert(year_month_day{local_days{year{2017}/January/31}} == year{2017}/January/31);
+ static_assert(year_month_day{local_days{year{2017}/January/32}} == year{2017}/February/1);
+}
+
+int main()
+{
+ using year = std::chrono::year;
+ using month = std::chrono::month;
+ using day = std::chrono::day;
+ using local_days = std::chrono::local_days;
+ using days = std::chrono::days;
+ using year_month_day = std::chrono::year_month_day;
+
+ ASSERT_NOEXCEPT(local_days(std::declval<year_month_day>()));
+ RunTheExample();
+
+ {
+ constexpr year_month_day ymd{year{1970}, month{1}, day{1}};
+ constexpr local_days sd{ymd};
+
+ static_assert( sd.time_since_epoch() == days{0}, "");
+ static_assert( year_month_day{sd} == ymd, ""); // and back
+ }
+
+ {
+ constexpr year_month_day ymd{year{2000}, month{2}, day{2}};
+ constexpr local_days sd{ymd};
+
+ static_assert( sd.time_since_epoch() == days{10957+32}, "");
+ static_assert( year_month_day{sd} == ymd, ""); // and back
+ }
+
+// There's one more leap day between 1/1/40 and 1/1/70
+// when compared to 1/1/70 -> 1/1/2000
+ {
+ constexpr year_month_day ymd{year{1940}, month{1}, day{2}};
+ constexpr local_days sd{ymd};
+
+ static_assert( sd.time_since_epoch() == days{-10957}, "");
+ static_assert( year_month_day{sd} == ymd, ""); // and back
+ }
+
+ {
+ year_month_day ymd{year{1939}, month{11}, day{29}};
+ local_days sd{ymd};
+
+ assert( sd.time_since_epoch() == days{-(10957+34)});
+ assert( year_month_day{sd} == ymd); // and back
+ }
+
+}
diff --git a/test/std/utilities/time/time.cal/time.cal.ymd/time.cal.ymd.members/op.sys_days.pass.cpp b/test/std/utilities/time/time.cal/time.cal.ymd/time.cal.ymd.members/op.sys_days.pass.cpp
new file mode 100644
index 0000000000000..4e263bcccb6b0
--- /dev/null
+++ b/test/std/utilities/time/time.cal/time.cal.ymd/time.cal.ymd.members/op.sys_days.pass.cpp
@@ -0,0 +1,94 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
+
+// <chrono>
+// class year_month_day;
+
+// constexpr operator sys_days() const noexcept;
+//
+// Returns: If ok(), returns a sys_days holding a count of days from the
+// sys_days epoch to *this (a negative value if *this represents a date
+// prior to the sys_days epoch). Otherwise, if y_.ok() && m_.ok() is true,
+// returns a sys_days which is offset from sys_days{y_/m_/last} by the
+// number of days d_ is offset from sys_days{y_/m_/last}.day(). Otherwise
+// the value returned is unspecified.
+//
+// Remarks: A sys_days in the range [days{-12687428}, days{11248737}] which
+// is converted to a year_month_day shall have the same value when
+// converted back to a sys_days.
+//
+// [Example:
+// static_assert(year_month_day{sys_days{2017y/January/0}} == 2016y/December/31);
+// static_assert(year_month_day{sys_days{2017y/January/31}} == 2017y/January/31);
+// static_assert(year_month_day{sys_days{2017y/January/32}} == 2017y/February/1);
+// —end example]
+
+#include <chrono>
+#include <type_traits>
+#include <cassert>
+
+#include "test_macros.h"
+
+void RunTheExample()
+{
+ using namespace std::chrono;
+
+ static_assert(year_month_day{sys_days{year{2017}/January/0}} == year{2016}/December/31);
+ static_assert(year_month_day{sys_days{year{2017}/January/31}} == year{2017}/January/31);
+ static_assert(year_month_day{sys_days{year{2017}/January/32}} == year{2017}/February/1);
+}
+
+int main()
+{
+ using year = std::chrono::year;
+ using month = std::chrono::month;
+ using day = std::chrono::day;
+ using sys_days = std::chrono::sys_days;
+ using days = std::chrono::days;
+ using year_month_day = std::chrono::year_month_day;
+
+ ASSERT_NOEXCEPT(sys_days(std::declval<year_month_day>()));
+ RunTheExample();
+
+ {
+ constexpr year_month_day ymd{year{1970}, month{1}, day{1}};
+ constexpr sys_days sd{ymd};
+
+ static_assert( sd.time_since_epoch() == days{0}, "");
+ static_assert( year_month_day{sd} == ymd, ""); // and back
+ }
+
+ {
+ constexpr year_month_day ymd{year{2000}, month{2}, day{2}};
+ constexpr sys_days sd{ymd};
+
+ static_assert( sd.time_since_epoch() == days{10957+32}, "");
+ static_assert( year_month_day{sd} == ymd, ""); // and back
+ }
+
+// There's one more leap day between 1/1/40 and 1/1/70
+// when compared to 1/1/70 -> 1/1/2000
+ {
+ constexpr year_month_day ymd{year{1940}, month{1}, day{2}};
+ constexpr sys_days sd{ymd};
+
+ static_assert( sd.time_since_epoch() == days{-10957}, "");
+ static_assert( year_month_day{sd} == ymd, ""); // and back
+ }
+
+ {
+ year_month_day ymd{year{1939}, month{11}, day{29}};
+ sys_days sd{ymd};
+
+ assert( sd.time_since_epoch() == days{-(10957+34)});
+ assert( year_month_day{sd} == ymd); // and back
+ }
+
+}
diff --git a/test/std/utilities/time/time.cal/time.cal.ymd/time.cal.ymd.members/plus_minus_equal_month.pass.cpp b/test/std/utilities/time/time.cal/time.cal.ymd/time.cal.ymd.members/plus_minus_equal_month.pass.cpp
new file mode 100644
index 0000000000000..7cd31222daa0b
--- /dev/null
+++ b/test/std/utilities/time/time.cal/time.cal.ymd/time.cal.ymd.members/plus_minus_equal_month.pass.cpp
@@ -0,0 +1,70 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
+
+// <chrono>
+// class year_month_day;
+
+// constexpr year_month_day& operator+=(const months& m) noexcept;
+// constexpr year_month_day& operator-=(const months& m) noexcept;
+
+#include <chrono>
+#include <type_traits>
+#include <cassert>
+
+#include "test_macros.h"
+
+template <typename D, typename Ds>
+constexpr bool testConstexpr(D d1)
+{
+ if (static_cast<unsigned>((d1 ).month()) != 1) return false;
+ if (static_cast<unsigned>((d1 += Ds{ 1}).month()) != 2) return false;
+ if (static_cast<unsigned>((d1 += Ds{ 2}).month()) != 4) return false;
+ if (static_cast<unsigned>((d1 += Ds{12}).month()) != 4) return false;
+ if (static_cast<unsigned>((d1 -= Ds{ 1}).month()) != 3) return false;
+ if (static_cast<unsigned>((d1 -= Ds{ 2}).month()) != 1) return false;
+ if (static_cast<unsigned>((d1 -= Ds{12}).month()) != 1) return false;
+ return true;
+}
+
+int main()
+{
+ using year = std::chrono::year;
+ using month = std::chrono::month;
+ using day = std::chrono::day;
+ using year_month_day = std::chrono::year_month_day;
+ using months = std::chrono::months;
+
+ ASSERT_NOEXCEPT(std::declval<year_month_day&>() += std::declval<months>());
+ ASSERT_NOEXCEPT(std::declval<year_month_day&>() -= std::declval<months>());
+
+ ASSERT_SAME_TYPE(year_month_day&, decltype(std::declval<year_month_day&>() += std::declval<months>()));
+ ASSERT_SAME_TYPE(year_month_day&, decltype(std::declval<year_month_day&>() -= std::declval<months>()));
+
+ static_assert(testConstexpr<year_month_day, months>(year_month_day{year{1234}, month{1}, day{1}}), "");
+
+ for (unsigned i = 0; i <= 10; ++i)
+ {
+ year y{1234};
+ day d{23};
+ year_month_day ym(y, month{i}, d);
+ assert(static_cast<unsigned>((ym += months{2}).month()) == i + 2);
+ assert(ym.year() == y);
+ assert(ym.day() == d);
+ assert(static_cast<unsigned>((ym ).month()) == i + 2);
+ assert(ym.year() == y);
+ assert(ym.day() == d);
+ assert(static_cast<unsigned>((ym -= months{1}).month()) == i + 1);
+ assert(ym.year() == y);
+ assert(ym.day() == d);
+ assert(static_cast<unsigned>((ym ).month()) == i + 1);
+ assert(ym.year() == y);
+ assert(ym.day() == d);
+ }
+}
diff --git a/test/std/utilities/time/time.cal/time.cal.ymd/time.cal.ymd.members/plus_minus_equal_year.pass.cpp b/test/std/utilities/time/time.cal/time.cal.ymd/time.cal.ymd.members/plus_minus_equal_year.pass.cpp
new file mode 100644
index 0000000000000..650941dc945eb
--- /dev/null
+++ b/test/std/utilities/time/time.cal/time.cal.ymd/time.cal.ymd.members/plus_minus_equal_year.pass.cpp
@@ -0,0 +1,70 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
+
+// <chrono>
+// class year_month_day;
+
+// constexpr year_month_day& operator+=(const years& d) noexcept;
+// constexpr year_month_day& operator-=(const years& d) noexcept;
+
+#include <chrono>
+#include <type_traits>
+#include <cassert>
+
+#include "test_macros.h"
+
+template <typename D, typename Ds>
+constexpr bool testConstexpr(D d1)
+{
+ if (static_cast<int>((d1 ).year()) != 1) return false;
+ if (static_cast<int>((d1 += Ds{ 1}).year()) != 2) return false;
+ if (static_cast<int>((d1 += Ds{ 2}).year()) != 4) return false;
+ if (static_cast<int>((d1 += Ds{12}).year()) != 16) return false;
+ if (static_cast<int>((d1 -= Ds{ 1}).year()) != 15) return false;
+ if (static_cast<int>((d1 -= Ds{ 2}).year()) != 13) return false;
+ if (static_cast<int>((d1 -= Ds{12}).year()) != 1) return false;
+ return true;
+}
+
+int main()
+{
+ using year = std::chrono::year;
+ using month = std::chrono::month;
+ using day = std::chrono::day;
+ using year_month_day = std::chrono::year_month_day;
+ using years = std::chrono::years;
+
+ ASSERT_NOEXCEPT(std::declval<year_month_day&>() += std::declval<years>());
+ ASSERT_NOEXCEPT(std::declval<year_month_day&>() -= std::declval<years>());
+
+ ASSERT_SAME_TYPE(year_month_day&, decltype(std::declval<year_month_day&>() += std::declval<years>()));
+ ASSERT_SAME_TYPE(year_month_day&, decltype(std::declval<year_month_day&>() -= std::declval<years>()));
+
+ static_assert(testConstexpr<year_month_day, years>(year_month_day{year{1}, month{1}, day{1}}), "");
+
+ for (int i = 1000; i <= 1010; ++i)
+ {
+ month m{2};
+ day d{23};
+ year_month_day ym(year{i}, m, d);
+ assert(static_cast<int>((ym += years{2}).year()) == i + 2);
+ assert(ym.month() == m);
+ assert(ym.day() == d);
+ assert(static_cast<int>((ym ).year()) == i + 2);
+ assert(ym.month() == m);
+ assert(ym.day() == d);
+ assert(static_cast<int>((ym -= years{1}).year()) == i + 1);
+ assert(ym.month() == m);
+ assert(ym.day() == d);
+ assert(static_cast<int>((ym ).year()) == i + 1);
+ assert(ym.month() == m);
+ assert(ym.day() == d);
+ }
+}
diff --git a/test/std/utilities/time/time.cal/time.cal.ymd/time.cal.ymd.members/year.pass.cpp b/test/std/utilities/time/time.cal/time.cal.ymd/time.cal.ymd.members/year.pass.cpp
new file mode 100644
index 0000000000000..be6aa5c575d9d
--- /dev/null
+++ b/test/std/utilities/time/time.cal/time.cal.ymd/time.cal.ymd.members/year.pass.cpp
@@ -0,0 +1,40 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
+
+// <chrono>
+// class year_month_day;
+
+// constexpr chrono::day day() const noexcept;
+// Returns: d_
+
+#include <chrono>
+#include <type_traits>
+#include <cassert>
+
+#include "test_macros.h"
+
+int main()
+{
+ using year = std::chrono::year;
+ using month = std::chrono::month;
+ using day = std::chrono::day;
+ using year_month_day = std::chrono::year_month_day;
+
+ ASSERT_NOEXCEPT( std::declval<const year_month_day>().year());
+ ASSERT_SAME_TYPE(year, decltype(std::declval<const year_month_day>().year()));
+
+ static_assert( year_month_day{}.year() == year{}, "");
+
+ for (int i = 1; i <= 50; ++i)
+ {
+ year_month_day ym(year{i}, month{}, day{});
+ assert( static_cast<int>(ym.year()) == i);
+ }
+}
diff --git a/test/std/utilities/time/time.cal/time.cal.ymd/time.cal.ymd.nonmembers/comparisons.pass.cpp b/test/std/utilities/time/time.cal/time.cal.ymd/time.cal.ymd.nonmembers/comparisons.pass.cpp
new file mode 100644
index 0000000000000..0df684395d45d
--- /dev/null
+++ b/test/std/utilities/time/time.cal/time.cal.ymd/time.cal.ymd.nonmembers/comparisons.pass.cpp
@@ -0,0 +1,118 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
+
+// <chrono>
+// class year_month_day;
+
+// constexpr bool operator==(const year_month_day& x, const year_month_day& y) noexcept;
+// Returns: x.year() == y.year() && x.month() == y.month().
+//
+// constexpr bool operator< (const year_month_day& x, const year_month_day& y) noexcept;
+// Returns:
+// If x.year() < y.year() returns true.
+// Otherwise, if x.year() > y.year() returns false.
+// Otherwise, if x.month() < y.month() returns true.
+// Otherwise, if x.month() > y.month() returns false.
+// Otherwise, returns x.day() < y.day()
+
+
+#include <chrono>
+#include <type_traits>
+#include <cassert>
+
+#include "test_macros.h"
+#include "test_comparisons.h"
+
+int main()
+{
+ using day = std::chrono::day;
+ using year = std::chrono::year;
+ using month = std::chrono::month;
+ using year_month_day = std::chrono::year_month_day;
+
+ AssertComparisons6AreNoexcept<year_month_day>();
+ AssertComparisons6ReturnBool<year_month_day>();
+
+ constexpr month January = std::chrono::January;
+ constexpr month February = std::chrono::February;
+
+ static_assert( testComparisons6(
+ year_month_day{year{1234}, January, day{1}},
+ year_month_day{year{1234}, January, day{1}},
+ true, false), "");
+
+// different day
+ static_assert( testComparisons6(
+ year_month_day{year{1234}, January, day{1}},
+ year_month_day{year{1234}, January, day{2}},
+ false, true), "");
+
+// different month
+ static_assert( testComparisons6(
+ year_month_day{year{1234}, January, day{1}},
+ year_month_day{year{1234}, February, day{1}},
+ false, true), "");
+
+// different year
+ static_assert( testComparisons6(
+ year_month_day{year{1234}, January, day{1}},
+ year_month_day{year{1235}, January, day{1}},
+ false, true), "");
+
+
+// different month and day
+ static_assert( testComparisons6(
+ year_month_day{year{1234}, January, day{2}},
+ year_month_day{year{1234}, February, day{1}},
+ false, true), "");
+
+// different year and month
+ static_assert( testComparisons6(
+ year_month_day{year{1234}, February, day{1}},
+ year_month_day{year{1235}, January, day{1}},
+ false, true), "");
+
+// different year and day
+ static_assert( testComparisons6(
+ year_month_day{year{1234}, January, day{2}},
+ year_month_day{year{1235}, January, day{1}},
+ false, true), "");
+
+// different year, month and day
+ static_assert( testComparisons6(
+ year_month_day{year{1234}, February, day{2}},
+ year_month_day{year{1235}, January, day{1}},
+ false, true), "");
+
+
+// same year, different days
+ for (unsigned i = 1; i < 28; ++i)
+ for (unsigned j = 1; j < 28; ++j)
+ assert((testComparisons6(
+ year_month_day{year{1234}, January, day{i}},
+ year_month_day{year{1234}, January, day{j}},
+ i == j, i < j )));
+
+// same year, different months
+ for (unsigned i = 1; i < 12; ++i)
+ for (unsigned j = 1; j < 12; ++j)
+ assert((testComparisons6(
+ year_month_day{year{1234}, month{i}, day{12}},
+ year_month_day{year{1234}, month{j}, day{12}},
+ i == j, i < j )));
+
+// same month, different years
+ for (int i = 1000; i < 20; ++i)
+ for (int j = 1000; j < 20; ++j)
+ assert((testComparisons6(
+ year_month_day{year{i}, January, day{12}},
+ year_month_day{year{j}, January, day{12}},
+ i == j, i < j )));
+}
diff --git a/test/std/utilities/time/time.cal/time.cal.ymd/time.cal.ymd.nonmembers/minus.pass.cpp b/test/std/utilities/time/time.cal/time.cal.ymd/time.cal.ymd.nonmembers/minus.pass.cpp
new file mode 100644
index 0000000000000..41b61f7b6854d
--- /dev/null
+++ b/test/std/utilities/time/time.cal/time.cal.ymd/time.cal.ymd.nonmembers/minus.pass.cpp
@@ -0,0 +1,60 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
+
+// <chrono>
+// class year_month_day;
+
+// constexpr year_month_day operator-(const year_month_day& ymd, const years& dy) noexcept;
+// Returns: ymd + (-dy)
+
+
+#include <chrono>
+#include <type_traits>
+#include <cassert>
+
+#include "test_macros.h"
+
+#include <iostream>
+
+constexpr bool test_constexpr ()
+{
+ std::chrono::year_month_day ym0{std::chrono::year{1234}, std::chrono::January, std::chrono::day{12}};
+ std::chrono::year_month_day ym1 = ym0 - std::chrono::years{10};
+ return
+ ym1.year() == std::chrono::year{1234-10}
+ && ym1.month() == std::chrono::January
+ && ym1.day() == std::chrono::day{12}
+ ;
+}
+
+int main()
+{
+ using year = std::chrono::year;
+ using month = std::chrono::month;
+ using day = std::chrono::day;
+ using year_month_day = std::chrono::year_month_day;
+ using years = std::chrono::years;
+
+ ASSERT_NOEXCEPT( std::declval<year_month_day>() - std::declval<years>());
+ ASSERT_SAME_TYPE(year_month_day, decltype(std::declval<year_month_day>() - std::declval<years>()));
+
+ constexpr month January = std::chrono::January;
+
+ static_assert(test_constexpr(), "");
+
+ year_month_day ym{year{1234}, January, day{10}};
+ for (int i = 0; i <= 10; ++i)
+ {
+ year_month_day ym1 = ym - years{i};
+ assert(static_cast<int>(ym1.year()) == 1234 - i);
+ assert(ym1.month() == January);
+ assert(ym1.day() == day{10});
+ }
+}
diff --git a/test/std/utilities/time/time.cal/time.cal.ymd/time.cal.ymd.nonmembers/plus.pass.cpp b/test/std/utilities/time/time.cal/time.cal.ymd/time.cal.ymd.nonmembers/plus.pass.cpp
new file mode 100644
index 0000000000000..c325d1f89ac47
--- /dev/null
+++ b/test/std/utilities/time/time.cal/time.cal.ymd/time.cal.ymd.nonmembers/plus.pass.cpp
@@ -0,0 +1,112 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
+
+// <chrono>
+// class year_month_day;
+
+// constexpr year_month_day operator+(const year_month_day& ymd, const months& dm) noexcept;
+// Returns: (ymd.year() / ymd.month() + dm) / ymd.day().
+//
+// constexpr year_month_day operator+(const months& dm, const year_month_day& ymd) noexcept;
+// Returns: ymd + dm.
+//
+//
+// constexpr year_month_day operator+(const year_month_day& ymd, const years& dy) noexcept;
+// Returns: (ymd.year() + dy) / ymd.month() / ymd.day().
+//
+// constexpr year_month_day operator+(const years& dy, const year_month_day& ymd) noexcept;
+// Returns: ym + dm.
+
+
+
+#include <chrono>
+#include <type_traits>
+#include <cassert>
+
+#include "test_macros.h"
+
+constexpr bool testConstexprYears(std::chrono::year_month_day ym)
+{
+ std::chrono::years offset{23};
+ if (static_cast<int>((ym ).year()) != 1) return false;
+ if (static_cast<int>((ym + offset).year()) != 24) return false;
+ if (static_cast<int>((offset + ym).year()) != 24) return false;
+ return true;
+}
+
+
+constexpr bool testConstexprMonths(std::chrono::year_month_day ym)
+{
+ std::chrono::months offset{6};
+ if (static_cast<unsigned>((ym ).month()) != 1) return false;
+ if (static_cast<unsigned>((ym + offset).month()) != 7) return false;
+ if (static_cast<unsigned>((offset + ym).month()) != 7) return false;
+ return true;
+}
+
+
+int main()
+{
+ using day = std::chrono::day;
+ using year = std::chrono::year;
+ using years = std::chrono::years;
+ using month = std::chrono::month;
+ using months = std::chrono::months;
+ using year_month_day = std::chrono::year_month_day;
+
+ { // year_month_day + months
+ ASSERT_NOEXCEPT(std::declval<year_month_day>() + std::declval<months>());
+ ASSERT_NOEXCEPT(std::declval<months>() + std::declval<year_month_day>());
+
+ ASSERT_SAME_TYPE(year_month_day, decltype(std::declval<year_month_day>() + std::declval<months>()));
+ ASSERT_SAME_TYPE(year_month_day, decltype(std::declval<months>() + std::declval<year_month_day>()));
+
+ static_assert(testConstexprMonths(year_month_day{year{1}, month{1}, day{1}}), "");
+
+ year_month_day ym{year{1234}, std::chrono::January, day{12}};
+ for (int i = 0; i <= 10; ++i) // TODO test wrap-around
+ {
+ year_month_day ym1 = ym + months{i};
+ year_month_day ym2 = months{i} + ym;
+ assert(static_cast<int>(ym1.year()) == 1234);
+ assert(static_cast<int>(ym2.year()) == 1234);
+ assert(ym1.month() == month(1 + i));
+ assert(ym2.month() == month(1 + i));
+ assert(ym1.day() == day{12});
+ assert(ym2.day() == day{12});
+ assert(ym1 == ym2);
+ }
+ }
+
+ { // year_month_day + years
+ ASSERT_NOEXCEPT(std::declval<year_month_day>() + std::declval<years>());
+ ASSERT_NOEXCEPT(std::declval<years>() + std::declval<year_month_day>());
+
+ ASSERT_SAME_TYPE(year_month_day, decltype(std::declval<year_month_day>() + std::declval<years>()));
+ ASSERT_SAME_TYPE(year_month_day, decltype(std::declval<years>() + std::declval<year_month_day>()));
+
+ static_assert(testConstexprYears (year_month_day{year{1}, month{1}, day{1}}), "");
+
+ year_month_day ym{year{1234}, std::chrono::January, day{12}};
+ for (int i = 0; i <= 10; ++i)
+ {
+ year_month_day ym1 = ym + years{i};
+ year_month_day ym2 = years{i} + ym;
+ assert(static_cast<int>(ym1.year()) == i + 1234);
+ assert(static_cast<int>(ym2.year()) == i + 1234);
+ assert(ym1.month() == std::chrono::January);
+ assert(ym2.month() == std::chrono::January);
+ assert(ym1.day() == day{12});
+ assert(ym2.day() == day{12});
+ assert(ym1 == ym2);
+ }
+ }
+
+}
diff --git a/test/std/utilities/time/time.cal/time.cal.ymd/time.cal.ymd.nonmembers/streaming.pass.cpp b/test/std/utilities/time/time.cal/time.cal.ymd/time.cal.ymd.nonmembers/streaming.pass.cpp
new file mode 100644
index 0000000000000..4bfca15494d9e
--- /dev/null
+++ b/test/std/utilities/time/time.cal/time.cal.ymd/time.cal.ymd.nonmembers/streaming.pass.cpp
@@ -0,0 +1,58 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
+// XFAIL: *
+
+// <chrono>
+// class year_month_day;
+
+// template<class charT, class traits>
+// basic_ostream<charT, traits>&
+// operator<<(basic_ostream<charT, traits>& os, const year_month_day& ym);
+//
+// Returns: os << ym.year() << '/' << ym.month().
+//
+//
+// template<class charT, class traits>
+// basic_ostream<charT, traits>&
+// to_stream(basic_ostream<charT, traits>& os, const charT* fmt, const year_month_day& ym);
+//
+// Effects: Streams ym into os using the format specified by the NTCTS fmt. fmt encoding follows the rules specified in 25.11.
+//
+// template<class charT, class traits, class Alloc = allocator<charT>>
+// basic_istream<charT, traits>&
+// from_stream(basic_istream<charT, traits>& is, const charT* fmt,
+// year_month_day& ym, basic_string<charT, traits, Alloc>* abbrev = nullptr,
+// minutes* offset = nullptr);
+//
+// Effects: Attempts to parse the input stream is into the year_month_day ym using the format
+// flags given in the NTCTS fmt as specified in 25.12. If the parse fails to decode
+// a valid year_month_day, is.setstate(ios_- base::failbit) shall be called and ym shall
+// not be modified. If %Z is used and successfully parsed, that value will be assigned
+// to *abbrev if abbrev is non-null. If %z (or a modified variant) is used and
+// successfully parsed, that value will be assigned to *offset if offset is non-null.
+
+
+
+#include <chrono>
+#include <type_traits>
+#include <cassert>
+#include <iostream>
+
+#include "test_macros.h"
+
+int main()
+{
+ using year_month_day = std::chrono::year_month_day;
+ using year = std::chrono::year;
+ using month = std::chrono::month;
+ using day = std::chrono::day;
+
+ std::cout << year_month_day{year{2018}, month{3}, day{12}};
+}
diff --git a/test/std/utilities/time/time.cal/time.cal.ymd/types.pass.cpp b/test/std/utilities/time/time.cal/time.cal.ymd/types.pass.cpp
new file mode 100644
index 0000000000000..f13f4da1a5fd3
--- /dev/null
+++ b/test/std/utilities/time/time.cal/time.cal.ymd/types.pass.cpp
@@ -0,0 +1,26 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
+
+// <chrono>
+// class year_month_day;
+
+#include <chrono>
+#include <type_traits>
+#include <cassert>
+
+#include "test_macros.h"
+
+int main()
+{
+ using year_month_day = std::chrono::year_month_day;
+
+ static_assert(std::is_trivially_copyable_v<year_month_day>, "");
+ static_assert(std::is_standard_layout_v<year_month_day>, "");
+}
diff --git a/test/std/utilities/time/time.cal/time.cal.ymdlast/time.cal.ymdlast.members/ctor.pass.cpp b/test/std/utilities/time/time.cal/time.cal.ymdlast/time.cal.ymdlast.members/ctor.pass.cpp
new file mode 100644
index 0000000000000..e2a6a7acf2806
--- /dev/null
+++ b/test/std/utilities/time/time.cal/time.cal.ymdlast/time.cal.ymdlast.members/ctor.pass.cpp
@@ -0,0 +1,53 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
+
+// <chrono>
+// class year_month_day_last;
+
+// constexpr year_month_day_last(const chrono::year& y,
+// const chrono::month_day_last& mdl) noexcept;
+//
+// Effects: Constructs an object of type year_month_day_last by initializing
+// initializing y_ with y and mdl_ with mdl.
+//
+// constexpr chrono::year year() const noexcept;
+// constexpr chrono::month month() const noexcept;
+// constexpr chrono::month_day_last month_day_last() const noexcept;
+// constexpr bool ok() const noexcept;
+
+#include <chrono>
+#include <type_traits>
+#include <cassert>
+
+#include "test_macros.h"
+
+int main()
+{
+ using year = std::chrono::year;
+ using month = std::chrono::month;
+ using month_day_last = std::chrono::month_day_last;
+ using year_month_day_last = std::chrono::year_month_day_last;
+
+ ASSERT_NOEXCEPT(year_month_day_last{year{1}, month_day_last{month{1}}});
+
+ constexpr month January = std::chrono::January;
+
+ constexpr year_month_day_last ymdl0{year{}, month_day_last{month{}}};
+ static_assert( ymdl0.year() == year{}, "");
+ static_assert( ymdl0.month() == month{}, "");
+ static_assert( ymdl0.month_day_last() == month_day_last{month{}}, "");
+ static_assert(!ymdl0.ok(), "");
+
+ constexpr year_month_day_last ymdl1{year{2019}, month_day_last{January}};
+ static_assert( ymdl1.year() == year{2019}, "");
+ static_assert( ymdl1.month() == January, "");
+ static_assert( ymdl1.month_day_last() == month_day_last{January}, "");
+ static_assert( ymdl1.ok(), "");
+}
diff --git a/test/std/utilities/time/time.cal/time.cal.ymdlast/time.cal.ymdlast.members/day.pass.cpp b/test/std/utilities/time/time.cal/time.cal.ymdlast/time.cal.ymdlast.members/day.pass.cpp
new file mode 100644
index 0000000000000..db3369c6c8a4d
--- /dev/null
+++ b/test/std/utilities/time/time.cal/time.cal.ymdlast/time.cal.ymdlast.members/day.pass.cpp
@@ -0,0 +1,51 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
+
+// <chrono>
+// class year_month_day_last;
+
+// constexpr chrono::day day() const noexcept;
+// Returns: wd_
+
+#include <chrono>
+#include <type_traits>
+#include <cassert>
+
+#include "test_macros.h"
+
+int main()
+{
+ using year = std::chrono::year;
+ using month = std::chrono::month;
+ using day = std::chrono::day;
+ using month_day_last = std::chrono::month_day_last;
+ using year_month_day_last = std::chrono::year_month_day_last;
+
+ ASSERT_NOEXCEPT( std::declval<const year_month_day_last>().day());
+ ASSERT_SAME_TYPE(day, decltype(std::declval<const year_month_day_last>().day()));
+
+// Some months have a 31st
+ static_assert( year_month_day_last{year{2020}, month_day_last{month{ 1}}}.day() == day{31}, "");
+ static_assert( year_month_day_last{year{2020}, month_day_last{month{ 2}}}.day() == day{29}, "");
+ static_assert( year_month_day_last{year{2020}, month_day_last{month{ 3}}}.day() == day{31}, "");
+ static_assert( year_month_day_last{year{2020}, month_day_last{month{ 4}}}.day() == day{30}, "");
+ static_assert( year_month_day_last{year{2020}, month_day_last{month{ 5}}}.day() == day{31}, "");
+ static_assert( year_month_day_last{year{2020}, month_day_last{month{ 6}}}.day() == day{30}, "");
+ static_assert( year_month_day_last{year{2020}, month_day_last{month{ 7}}}.day() == day{31}, "");
+ static_assert( year_month_day_last{year{2020}, month_day_last{month{ 8}}}.day() == day{31}, "");
+ static_assert( year_month_day_last{year{2020}, month_day_last{month{ 9}}}.day() == day{30}, "");
+ static_assert( year_month_day_last{year{2020}, month_day_last{month{10}}}.day() == day{31}, "");
+ static_assert( year_month_day_last{year{2020}, month_day_last{month{11}}}.day() == day{30}, "");
+ static_assert( year_month_day_last{year{2020}, month_day_last{month{12}}}.day() == day{31}, "");
+
+ assert((year_month_day_last{year{2019}, month_day_last{month{ 2}}}.day() == day{28}));
+ assert((year_month_day_last{year{2020}, month_day_last{month{ 2}}}.day() == day{29}));
+ assert((year_month_day_last{year{2021}, month_day_last{month{ 2}}}.day() == day{28}));
+}
diff --git a/test/std/utilities/time/time.cal/time.cal.ymdlast/time.cal.ymdlast.members/month.pass.cpp b/test/std/utilities/time/time.cal/time.cal.ymdlast/time.cal.ymdlast.members/month.pass.cpp
new file mode 100644
index 0000000000000..43ec42d94e109
--- /dev/null
+++ b/test/std/utilities/time/time.cal/time.cal.ymdlast/time.cal.ymdlast.members/month.pass.cpp
@@ -0,0 +1,38 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
+
+// <chrono>
+// class year_month_day_last;
+
+// constexpr chrono::month month() const noexcept;
+// Returns: wd_
+
+#include <chrono>
+#include <type_traits>
+#include <cassert>
+
+#include "test_macros.h"
+
+int main()
+{
+ using year = std::chrono::year;
+ using month = std::chrono::month;
+ using month_day_last = std::chrono::month_day_last;
+ using year_month_day_last = std::chrono::year_month_day_last;
+
+ ASSERT_NOEXCEPT( std::declval<const year_month_day_last>().month());
+ ASSERT_SAME_TYPE(month, decltype(std::declval<const year_month_day_last>().month()));
+
+ for (unsigned i = 1; i <= 50; ++i)
+ {
+ year_month_day_last ymd(year{1234}, month_day_last{month{i}});
+ assert( static_cast<unsigned>(ymd.month()) == i);
+ }
+}
diff --git a/test/std/utilities/time/time.cal/time.cal.ymdlast/time.cal.ymdlast.members/month_day_last.pass.cpp b/test/std/utilities/time/time.cal/time.cal.ymdlast/time.cal.ymdlast.members/month_day_last.pass.cpp
new file mode 100644
index 0000000000000..613cc1c6b3e13
--- /dev/null
+++ b/test/std/utilities/time/time.cal/time.cal.ymdlast/time.cal.ymdlast.members/month_day_last.pass.cpp
@@ -0,0 +1,38 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
+
+// <chrono>
+// class year_month_day_last;
+
+// constexpr chrono::day day() const noexcept;
+// Returns: wd_
+
+#include <chrono>
+#include <type_traits>
+#include <cassert>
+
+#include "test_macros.h"
+
+int main()
+{
+ using year = std::chrono::year;
+ using month = std::chrono::month;
+ using month_day_last = std::chrono::month_day_last;
+ using year_month_day_last = std::chrono::year_month_day_last;
+
+ ASSERT_NOEXCEPT( std::declval<const year_month_day_last>().month_day_last());
+ ASSERT_SAME_TYPE(month_day_last, decltype(std::declval<const year_month_day_last>().month_day_last()));
+
+ for (unsigned i = 1; i <= 50; ++i)
+ {
+ year_month_day_last ymdl(year{1234}, month_day_last{month{i}});
+ assert( static_cast<unsigned>(ymdl.month_day_last().month()) == i);
+ }
+}
diff --git a/test/std/utilities/time/time.cal/time.cal.ymdlast/time.cal.ymdlast.members/ok.pass.cpp b/test/std/utilities/time/time.cal/time.cal.ymdlast/time.cal.ymdlast.members/ok.pass.cpp
new file mode 100644
index 0000000000000..7b61214b7a23d
--- /dev/null
+++ b/test/std/utilities/time/time.cal/time.cal.ymdlast/time.cal.ymdlast.members/ok.pass.cpp
@@ -0,0 +1,52 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
+
+// <chrono>
+// class year_month_day_last;
+
+// constexpr bool ok() const noexcept;
+// Returns: m_.ok() && y_.ok().
+
+#include <chrono>
+#include <type_traits>
+#include <cassert>
+
+#include "test_macros.h"
+
+int main()
+{
+ using year = std::chrono::year;
+ using month = std::chrono::month;
+ using month_day_last = std::chrono::month_day_last;
+ using year_month_day_last = std::chrono::year_month_day_last;
+
+ constexpr month January = std::chrono::January;
+
+ ASSERT_NOEXCEPT( std::declval<const year_month_day_last>().ok());
+ ASSERT_SAME_TYPE(bool, decltype(std::declval<const year_month_day_last>().ok()));
+
+ static_assert(!year_month_day_last{year{-32768}, month_day_last{month{}}}.ok(), ""); // both bad
+ static_assert(!year_month_day_last{year{-32768}, month_day_last{January}}.ok(), ""); // Bad year
+ static_assert(!year_month_day_last{year{2019}, month_day_last{month{}}}.ok(), ""); // Bad month
+ static_assert( year_month_day_last{year{2019}, month_day_last{January}}.ok(), ""); // All OK
+
+ for (unsigned i = 0; i <= 50; ++i)
+ {
+ year_month_day_last ym{year{2019}, month_day_last{month{i}}};
+ assert( ym.ok() == month{i}.ok());
+ }
+
+ const int ymax = static_cast<int>(year::max());
+ for (int i = ymax - 100; i <= ymax + 100; ++i)
+ {
+ year_month_day_last ym{year{i}, month_day_last{January}};
+ assert( ym.ok() == year{i}.ok());
+ }
+}
diff --git a/test/std/utilities/time/time.cal/time.cal.ymdlast/time.cal.ymdlast.members/op_local_days.pass.cpp b/test/std/utilities/time/time.cal/time.cal.ymdlast/time.cal.ymdlast.members/op_local_days.pass.cpp
new file mode 100644
index 0000000000000..45f1ac4ae2d6f
--- /dev/null
+++ b/test/std/utilities/time/time.cal/time.cal.ymdlast/time.cal.ymdlast.members/op_local_days.pass.cpp
@@ -0,0 +1,61 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
+
+// <chrono>
+// class year_month_day_last;
+
+// constexpr operator local_days() const noexcept;
+// Returns: local_days{sys_days{*this}.time_since_epoch()}.
+
+#include <chrono>
+#include <type_traits>
+#include <cassert>
+
+#include "test_macros.h"
+
+int main()
+{
+ using year = std::chrono::year;
+ using month_day_last = std::chrono::month_day_last;
+ using year_month_day_last = std::chrono::year_month_day_last;
+ using local_days = std::chrono::local_days;
+ using days = std::chrono::days;
+
+ ASSERT_NOEXCEPT( static_cast<local_days>(std::declval<const year_month_day_last>()));
+ ASSERT_SAME_TYPE(local_days, decltype(static_cast<local_days>(std::declval<const year_month_day_last>())));
+
+ { // Last day in Jan 1970 was the 31st
+ constexpr year_month_day_last ymdl{year{1970}, month_day_last{std::chrono::January}};
+ constexpr local_days sd{ymdl};
+
+ static_assert(sd.time_since_epoch() == days{30}, "");
+ }
+
+ {
+ constexpr year_month_day_last ymdl{year{2000}, month_day_last{std::chrono::January}};
+ constexpr local_days sd{ymdl};
+
+ static_assert(sd.time_since_epoch() == days{10957+30}, "");
+ }
+
+ {
+ constexpr year_month_day_last ymdl{year{1940}, month_day_last{std::chrono::January}};
+ constexpr local_days sd{ymdl};
+
+ static_assert(sd.time_since_epoch() == days{-10957+29}, "");
+ }
+
+ {
+ year_month_day_last ymdl{year{1939}, month_day_last{std::chrono::November}};
+ local_days sd{ymdl};
+
+ assert(sd.time_since_epoch() == days{-(10957+33)});
+ }
+}
diff --git a/test/std/utilities/time/time.cal/time.cal.ymdlast/time.cal.ymdlast.members/op_sys_days.pass.cpp b/test/std/utilities/time/time.cal/time.cal.ymdlast/time.cal.ymdlast.members/op_sys_days.pass.cpp
new file mode 100644
index 0000000000000..20aff6d1db8c5
--- /dev/null
+++ b/test/std/utilities/time/time.cal/time.cal.ymdlast/time.cal.ymdlast.members/op_sys_days.pass.cpp
@@ -0,0 +1,61 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
+
+// <chrono>
+// class year_month_day_last;
+
+// constexpr operator sys_days() const noexcept;
+// Returns: sys_days{year()/month()/day()}.
+
+#include <chrono>
+#include <type_traits>
+#include <cassert>
+
+#include "test_macros.h"
+
+int main()
+{
+ using year = std::chrono::year;
+ using month_day_last = std::chrono::month_day_last;
+ using year_month_day_last = std::chrono::year_month_day_last;
+ using sys_days = std::chrono::sys_days;
+ using days = std::chrono::days;
+
+ ASSERT_NOEXCEPT( static_cast<sys_days>(std::declval<const year_month_day_last>()));
+ ASSERT_SAME_TYPE(sys_days, decltype(static_cast<sys_days>(std::declval<const year_month_day_last>())));
+
+ { // Last day in Jan 1970 was the 31st
+ constexpr year_month_day_last ymdl{year{1970}, month_day_last{std::chrono::January}};
+ constexpr sys_days sd{ymdl};
+
+ static_assert(sd.time_since_epoch() == days{30}, "");
+ }
+
+ {
+ constexpr year_month_day_last ymdl{year{2000}, month_day_last{std::chrono::January}};
+ constexpr sys_days sd{ymdl};
+
+ static_assert(sd.time_since_epoch() == days{10957+30}, "");
+ }
+
+ {
+ constexpr year_month_day_last ymdl{year{1940}, month_day_last{std::chrono::January}};
+ constexpr sys_days sd{ymdl};
+
+ static_assert(sd.time_since_epoch() == days{-10957+29}, "");
+ }
+
+ {
+ year_month_day_last ymdl{year{1939}, month_day_last{std::chrono::November}};
+ sys_days sd{ymdl};
+
+ assert(sd.time_since_epoch() == days{-(10957+33)});
+ }
+}
diff --git a/test/std/utilities/time/time.cal/time.cal.ymdlast/time.cal.ymdlast.members/plus_minus_equal_month.pass.cpp b/test/std/utilities/time/time.cal/time.cal.ymdlast/time.cal.ymdlast.members/plus_minus_equal_month.pass.cpp
new file mode 100644
index 0000000000000..bfa1d58d9082f
--- /dev/null
+++ b/test/std/utilities/time/time.cal/time.cal.ymdlast/time.cal.ymdlast.members/plus_minus_equal_month.pass.cpp
@@ -0,0 +1,66 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
+
+// <chrono>
+// class year_month_day_last;
+
+// constexpr year_month_day_last& operator+=(const months& m) noexcept;
+// constexpr year_month_day_last& operator-=(const months& m) noexcept;
+
+#include <chrono>
+#include <type_traits>
+#include <cassert>
+
+#include "test_macros.h"
+
+template <typename D, typename Ds>
+constexpr bool testConstexpr(D d1)
+{
+ if (static_cast<unsigned>((d1 ).month()) != 1) return false;
+ if (static_cast<unsigned>((d1 += Ds{ 1}).month()) != 2) return false;
+ if (static_cast<unsigned>((d1 += Ds{ 2}).month()) != 4) return false;
+ if (static_cast<unsigned>((d1 += Ds{12}).month()) != 4) return false;
+ if (static_cast<unsigned>((d1 -= Ds{ 1}).month()) != 3) return false;
+ if (static_cast<unsigned>((d1 -= Ds{ 2}).month()) != 1) return false;
+ if (static_cast<unsigned>((d1 -= Ds{12}).month()) != 1) return false;
+ return true;
+}
+
+int main()
+{
+ using year = std::chrono::year;
+ using month = std::chrono::month;
+ using month_day_last = std::chrono::month_day_last;
+ using year_month_day_last = std::chrono::year_month_day_last;
+ using months = std::chrono::months;
+
+ ASSERT_NOEXCEPT(std::declval<year_month_day_last&>() += std::declval<months>());
+ ASSERT_NOEXCEPT(std::declval<year_month_day_last&>() -= std::declval<months>());
+
+ ASSERT_SAME_TYPE(year_month_day_last&, decltype(std::declval<year_month_day_last&>() += std::declval<months>()));
+ ASSERT_SAME_TYPE(year_month_day_last&, decltype(std::declval<year_month_day_last&>() -= std::declval<months>()));
+
+ static_assert(testConstexpr<year_month_day_last, months>(year_month_day_last{year{1234}, month_day_last{month{1}}}), "");
+
+ for (unsigned i = 0; i <= 10; ++i)
+ {
+ year y{1234};
+ month_day_last mdl{month{i}};
+ year_month_day_last ym(y, mdl);
+ assert(static_cast<unsigned>((ym += months{2}).month()) == i + 2);
+ assert(ym.year() == y);
+ assert(static_cast<unsigned>((ym ).month()) == i + 2);
+ assert(ym.year() == y);
+ assert(static_cast<unsigned>((ym -= months{1}).month()) == i + 1);
+ assert(ym.year() == y);
+ assert(static_cast<unsigned>((ym ).month()) == i + 1);
+ assert(ym.year() == y);
+ }
+}
diff --git a/test/std/utilities/time/time.cal/time.cal.ymdlast/time.cal.ymdlast.members/plus_minus_equal_year.pass.cpp b/test/std/utilities/time/time.cal/time.cal.ymdlast/time.cal.ymdlast.members/plus_minus_equal_year.pass.cpp
new file mode 100644
index 0000000000000..ce364d2361ed1
--- /dev/null
+++ b/test/std/utilities/time/time.cal/time.cal.ymdlast/time.cal.ymdlast.members/plus_minus_equal_year.pass.cpp
@@ -0,0 +1,65 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
+
+// <chrono>
+// class year_month_day_last;
+
+// constexpr year_month_day_last& operator+=(const years& d) noexcept;
+// constexpr year_month_day_last& operator-=(const years& d) noexcept;
+
+#include <chrono>
+#include <type_traits>
+#include <cassert>
+
+#include "test_macros.h"
+
+template <typename D, typename Ds>
+constexpr bool testConstexpr(D d1)
+{
+ if (static_cast<int>((d1 ).year()) != 1) return false;
+ if (static_cast<int>((d1 += Ds{ 1}).year()) != 2) return false;
+ if (static_cast<int>((d1 += Ds{ 2}).year()) != 4) return false;
+ if (static_cast<int>((d1 += Ds{12}).year()) != 16) return false;
+ if (static_cast<int>((d1 -= Ds{ 1}).year()) != 15) return false;
+ if (static_cast<int>((d1 -= Ds{ 2}).year()) != 13) return false;
+ if (static_cast<int>((d1 -= Ds{12}).year()) != 1) return false;
+ return true;
+}
+
+int main()
+{
+ using year = std::chrono::year;
+ using month = std::chrono::month;
+ using month_day_last = std::chrono::month_day_last;
+ using year_month_day_last = std::chrono::year_month_day_last;
+ using years = std::chrono::years;
+
+ ASSERT_NOEXCEPT(std::declval<year_month_day_last&>() += std::declval<years>());
+ ASSERT_NOEXCEPT(std::declval<year_month_day_last&>() -= std::declval<years>());
+
+ ASSERT_SAME_TYPE(year_month_day_last&, decltype(std::declval<year_month_day_last&>() += std::declval<years>()));
+ ASSERT_SAME_TYPE(year_month_day_last&, decltype(std::declval<year_month_day_last&>() -= std::declval<years>()));
+
+ static_assert(testConstexpr<year_month_day_last, years>(year_month_day_last{year{1}, month_day_last{month{1}}}), "");
+
+ for (int i = 1000; i <= 1010; ++i)
+ {
+ month_day_last mdl{month{2}};
+ year_month_day_last ymdl(year{i}, mdl);
+ assert(static_cast<int>((ymdl += years{2}).year()) == i + 2);
+ assert(ymdl.month_day_last() == mdl);
+ assert(static_cast<int>((ymdl ).year()) == i + 2);
+ assert(ymdl.month_day_last() == mdl);
+ assert(static_cast<int>((ymdl -= years{1}).year()) == i + 1);
+ assert(ymdl.month_day_last() == mdl);
+ assert(static_cast<int>((ymdl ).year()) == i + 1);
+ assert(ymdl.month_day_last() == mdl);
+ }
+}
diff --git a/test/std/utilities/time/time.cal/time.cal.ymdlast/time.cal.ymdlast.members/year.pass.cpp b/test/std/utilities/time/time.cal/time.cal.ymdlast/time.cal.ymdlast.members/year.pass.cpp
new file mode 100644
index 0000000000000..0f4da09dc89ee
--- /dev/null
+++ b/test/std/utilities/time/time.cal/time.cal.ymdlast/time.cal.ymdlast.members/year.pass.cpp
@@ -0,0 +1,38 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
+
+// <chrono>
+// class year_month_day_last;
+
+// constexpr chrono::day day() const noexcept;
+// Returns: d_
+
+#include <chrono>
+#include <type_traits>
+#include <cassert>
+
+#include "test_macros.h"
+
+int main()
+{
+ using year = std::chrono::year;
+ using month = std::chrono::month;
+ using month_day_last = std::chrono::month_day_last;
+ using year_month_day_last = std::chrono::year_month_day_last;
+
+ ASSERT_NOEXCEPT( std::declval<const year_month_day_last>().year());
+ ASSERT_SAME_TYPE(year, decltype(std::declval<const year_month_day_last>().year()));
+
+ for (int i = 1; i <= 50; ++i)
+ {
+ year_month_day_last ym(year{i}, month_day_last{month{}});
+ assert( static_cast<int>(ym.year()) == i);
+ }
+}
diff --git a/test/std/utilities/time/time.cal/time.cal.ymdlast/time.cal.ymdlast.nonmembers/comparisons.pass.cpp b/test/std/utilities/time/time.cal/time.cal.ymdlast/time.cal.ymdlast.nonmembers/comparisons.pass.cpp
new file mode 100644
index 0000000000000..d4e4a1185a96f
--- /dev/null
+++ b/test/std/utilities/time/time.cal/time.cal.ymdlast/time.cal.ymdlast.nonmembers/comparisons.pass.cpp
@@ -0,0 +1,87 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
+
+// <chrono>
+// class year_month_day_last;
+
+// constexpr bool operator==(const year_month_day_last& x, const year_month_day_last& y) noexcept;
+// Returns: x.year() == y.year() && x.month_day_last() == y.month_day_last().
+//
+// constexpr bool operator< (const year_month_day_last& x, const year_month_day_last& y) noexcept;
+// Returns:
+// If x.year() < y.year(), returns true.
+// Otherwise, if x.year() > y.year(), returns false.
+// Otherwise, returns x.month_day_last() < y.month_day_last()
+
+#include <chrono>
+#include <type_traits>
+#include <cassert>
+
+#include "test_macros.h"
+#include "test_comparisons.h"
+
+int main()
+{
+ using year = std::chrono::year;
+ using month = std::chrono::month;
+ using month_day_last = std::chrono::month_day_last;
+ using year_month_day_last = std::chrono::year_month_day_last;
+
+ AssertComparisons6AreNoexcept<year_month_day_last>();
+ AssertComparisons6ReturnBool<year_month_day_last>();
+
+ constexpr month January = std::chrono::January;
+ constexpr month February = std::chrono::February;
+
+ static_assert( testComparisons6(
+ year_month_day_last{year{1234}, month_day_last{January}},
+ year_month_day_last{year{1234}, month_day_last{January}},
+ true, false), "");
+
+// different month
+ static_assert( testComparisons6(
+ year_month_day_last{year{1234}, month_day_last{January}},
+ year_month_day_last{year{1234}, month_day_last{February}},
+ false, true), "");
+
+// different year
+ static_assert( testComparisons6(
+ year_month_day_last{year{1234}, month_day_last{January}},
+ year_month_day_last{year{1235}, month_day_last{January}},
+ false, true), "");
+
+// different month
+ static_assert( testComparisons6(
+ year_month_day_last{year{1234}, month_day_last{January}},
+ year_month_day_last{year{1234}, month_day_last{February}},
+ false, true), "");
+
+// different year and month
+ static_assert( testComparisons6(
+ year_month_day_last{year{1234}, month_day_last{February}},
+ year_month_day_last{year{1235}, month_day_last{January}},
+ false, true), "");
+
+// same year, different months
+ for (unsigned i = 1; i < 12; ++i)
+ for (unsigned j = 1; j < 12; ++j)
+ assert((testComparisons6(
+ year_month_day_last{year{1234}, month_day_last{month{i}}},
+ year_month_day_last{year{1234}, month_day_last{month{j}}},
+ i == j, i < j )));
+
+// same month, different years
+ for (int i = 1000; i < 20; ++i)
+ for (int j = 1000; j < 20; ++j)
+ assert((testComparisons6(
+ year_month_day_last{year{i}, month_day_last{January}},
+ year_month_day_last{year{j}, month_day_last{January}},
+ i == j, i < j )));
+}
diff --git a/test/std/utilities/time/time.cal/time.cal.ymdlast/time.cal.ymdlast.nonmembers/minus.pass.cpp b/test/std/utilities/time/time.cal/time.cal.ymdlast/time.cal.ymdlast.nonmembers/minus.pass.cpp
new file mode 100644
index 0000000000000..1c8d4e7afd9e4
--- /dev/null
+++ b/test/std/utilities/time/time.cal/time.cal.ymdlast/time.cal.ymdlast.nonmembers/minus.pass.cpp
@@ -0,0 +1,91 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
+
+// <chrono>
+// class year_month_day_last;
+
+// constexpr year_month_day_last
+// operator-(const year_month_day_last& ymdl, const months& dm) noexcept;
+//
+// Returns: ymdl + (-dm).
+//
+// constexpr year_month_day_last
+// operator-(const year_month_day_last& ymdl, const years& dy) noexcept;
+//
+// Returns: ymdl + (-dy).
+
+
+#include <chrono>
+#include <type_traits>
+#include <cassert>
+
+#include "test_macros.h"
+
+#include <iostream>
+
+constexpr bool testConstexprYears (std::chrono::year_month_day_last ymdl)
+{
+ std::chrono::year_month_day_last ym1 = ymdl - std::chrono::years{10};
+ return
+ ym1.year() == std::chrono::year{static_cast<int>(ymdl.year()) - 10}
+ && ym1.month() == ymdl.month()
+ ;
+}
+
+constexpr bool testConstexprMonths (std::chrono::year_month_day_last ymdl)
+{
+ std::chrono::year_month_day_last ym1 = ymdl - std::chrono::months{6};
+ return
+ ym1.year() == ymdl.year()
+ && ym1.month() == std::chrono::month{static_cast<unsigned>(ymdl.month()) - 6}
+ ;
+}
+
+int main()
+{
+ using year = std::chrono::year;
+ using month = std::chrono::month;
+ using month_day_last = std::chrono::month_day_last;
+ using year_month_day_last = std::chrono::year_month_day_last;
+ using months = std::chrono::months;
+ using years = std::chrono::years;
+
+ constexpr month December = std::chrono::December;
+
+ { // year_month_day_last - years
+ ASSERT_NOEXCEPT( std::declval<year_month_day_last>() - std::declval<years>());
+ ASSERT_SAME_TYPE(year_month_day_last, decltype(std::declval<year_month_day_last>() - std::declval<years>()));
+
+ static_assert(testConstexprYears(year_month_day_last{year{1234}, month_day_last{December}}), "");
+ year_month_day_last ym{year{1234}, month_day_last{December}};
+ for (int i = 0; i <= 10; ++i)
+ {
+ year_month_day_last ym1 = ym - years{i};
+ assert(static_cast<int>(ym1.year()) == 1234 - i);
+ assert(ym1.month() == December);
+ }
+ }
+
+ { // year_month_day_last - months
+ ASSERT_NOEXCEPT( std::declval<year_month_day_last>() - std::declval<months>());
+ ASSERT_SAME_TYPE(year_month_day_last, decltype(std::declval<year_month_day_last>() - std::declval<months>()));
+
+ static_assert(testConstexprMonths(year_month_day_last{year{1234}, month_day_last{December}}), "");
+// TODO test wrapping
+ year_month_day_last ym{year{1234}, month_day_last{December}};
+ for (unsigned i = 0; i <= 10; ++i)
+ {
+ year_month_day_last ym1 = ym - months{i};
+ assert(static_cast<int>(ym1.year()) == 1234);
+ assert(static_cast<unsigned>(ym1.month()) == 12U-i);
+ }
+ }
+
+}
diff --git a/test/std/utilities/time/time.cal/time.cal.ymdlast/time.cal.ymdlast.nonmembers/plus.pass.cpp b/test/std/utilities/time/time.cal/time.cal.ymdlast/time.cal.ymdlast.nonmembers/plus.pass.cpp
new file mode 100644
index 0000000000000..25ab85d8ff5fa
--- /dev/null
+++ b/test/std/utilities/time/time.cal/time.cal.ymdlast/time.cal.ymdlast.nonmembers/plus.pass.cpp
@@ -0,0 +1,122 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
+
+// <chrono>
+// class year_month_day_last;
+
+// constexpr year_month_day_last
+// operator+(const year_month_day_last& ymdl, const months& dm) noexcept;
+//
+// Returns: (ymdl.year() / ymdl.month() + dm) / last.
+//
+// constexpr year_month_day_last
+// operator+(const months& dm, const year_month_day_last& ymdl) noexcept;
+//
+// Returns: ymdl + dm.
+//
+//
+// constexpr year_month_day_last
+// operator+(const year_month_day_last& ymdl, const years& dy) noexcept;
+//
+// Returns: {ymdl.year()+dy, ymdl.month_day_last()}.
+//
+// constexpr year_month_day_last
+// operator+(const years& dy, const year_month_day_last& ymdl) noexcept;
+//
+// Returns: ymdl + dy
+
+
+
+#include <chrono>
+#include <type_traits>
+#include <cassert>
+
+#include "test_macros.h"
+
+constexpr bool testConstexprYears(std::chrono::year_month_day_last ymdl)
+{
+ std::chrono::years offset{23};
+ if (static_cast<int>((ymdl ).year()) != 1) return false;
+ if (static_cast<int>((ymdl + offset).year()) != 24) return false;
+ if ( (ymdl + offset).month() != ymdl.month()) return false;
+ if (static_cast<int>((offset + ymdl).year()) != 24) return false;
+ if ( (offset + ymdl).month() != ymdl.month()) return false;
+ return true;
+}
+
+
+constexpr bool testConstexprMonths(std::chrono::year_month_day_last ymdl)
+{
+ std::chrono::months offset{6};
+ if (static_cast<unsigned>((ymdl ).month()) != 1) return false;
+ if ( (ymdl + offset).year() != ymdl.year()) return false;
+ if (static_cast<unsigned>((ymdl + offset).month()) != 7) return false;
+ if (static_cast<unsigned>((offset + ymdl).month()) != 7) return false;
+ if ( (offset + ymdl).year() != ymdl.year()) return false;
+ return true;
+}
+
+
+int main()
+{
+ using year = std::chrono::year;
+ using month = std::chrono::month;
+ using month_day_last = std::chrono::month_day_last;
+ using year_month_day_last = std::chrono::year_month_day_last;
+ using months = std::chrono::months;
+ using years = std::chrono::years;
+
+ constexpr month January = std::chrono::January;
+
+ { // year_month_day_last + months
+ ASSERT_NOEXCEPT(std::declval<year_month_day_last>() + std::declval<months>());
+ ASSERT_NOEXCEPT(std::declval<months>() + std::declval<year_month_day_last>());
+
+ ASSERT_SAME_TYPE(year_month_day_last, decltype(std::declval<year_month_day_last>() + std::declval<months>()));
+ ASSERT_SAME_TYPE(year_month_day_last, decltype(std::declval<months>() + std::declval<year_month_day_last>()));
+
+ static_assert(testConstexprMonths(year_month_day_last{year{1}, month_day_last{January}}), "");
+
+ year_month_day_last ym{year{1234}, month_day_last{January}};
+ for (int i = 0; i <= 10; ++i) // TODO test wrap-around
+ {
+ year_month_day_last ym1 = ym + months{i};
+ year_month_day_last ym2 = months{i} + ym;
+ assert(static_cast<int>(ym1.year()) == 1234);
+ assert(static_cast<int>(ym2.year()) == 1234);
+ assert(ym1.month() == month(1 + i));
+ assert(ym2.month() == month(1 + i));
+ assert(ym1 == ym2);
+ }
+ }
+
+ { // year_month_day_last + years
+ ASSERT_NOEXCEPT(std::declval<year_month_day_last>() + std::declval<years>());
+ ASSERT_NOEXCEPT(std::declval<years>() + std::declval<year_month_day_last>());
+
+ ASSERT_SAME_TYPE(year_month_day_last, decltype(std::declval<year_month_day_last>() + std::declval<years>()));
+ ASSERT_SAME_TYPE(year_month_day_last, decltype(std::declval<years>() + std::declval<year_month_day_last>()));
+
+ static_assert(testConstexprYears(year_month_day_last{year{1}, month_day_last{January}}), "");
+
+ year_month_day_last ym{year{1234}, month_day_last{January}};
+ for (int i = 0; i <= 10; ++i)
+ {
+ year_month_day_last ym1 = ym + years{i};
+ year_month_day_last ym2 = years{i} + ym;
+ assert(static_cast<int>(ym1.year()) == i + 1234);
+ assert(static_cast<int>(ym2.year()) == i + 1234);
+ assert(ym1.month() == std::chrono::January);
+ assert(ym2.month() == std::chrono::January);
+ assert(ym1 == ym2);
+ }
+ }
+
+}
diff --git a/test/std/utilities/time/time.cal/time.cal.ymdlast/time.cal.ymdlast.nonmembers/streaming.pass.cpp b/test/std/utilities/time/time.cal/time.cal.ymdlast/time.cal.ymdlast.nonmembers/streaming.pass.cpp
new file mode 100644
index 0000000000000..06c752e2905c1
--- /dev/null
+++ b/test/std/utilities/time/time.cal/time.cal.ymdlast/time.cal.ymdlast.nonmembers/streaming.pass.cpp
@@ -0,0 +1,37 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
+// XFAIL: *
+
+// <chrono>
+// class year_month_day_last;
+
+// template<class charT, class traits>
+// basic_ostream<charT, traits>&
+// operator<<(basic_ostream<charT, traits>& os, const year_month_day_last& ymdl);
+//
+// Returns: os << ymdl.year() << '/' << ymdl.month_day_last().
+
+
+#include <chrono>
+#include <type_traits>
+#include <cassert>
+#include <iostream>
+
+#include "test_macros.h"
+
+int main()
+{
+ using year_month_day_last = std::chrono::year_month_day_last;
+ using year = std::chrono::year;
+ using month = std::chrono::month;
+ using month_day_last = std::chrono::month_day_last;
+
+ std::cout << year_month_day_last{year{2018}, month_day_last{month{3}}};
+}
diff --git a/test/std/utilities/time/time.cal/time.cal.ymwd/time.cal.ymwd.members/ctor.local_days.pass.cpp b/test/std/utilities/time/time.cal/time.cal.ymwd/time.cal.ymwd.members/ctor.local_days.pass.cpp
new file mode 100644
index 0000000000000..a0b98abb7ddf4
--- /dev/null
+++ b/test/std/utilities/time/time.cal/time.cal.ymwd/time.cal.ymwd.members/ctor.local_days.pass.cpp
@@ -0,0 +1,95 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
+
+// <chrono>
+// class year_month_weekday;
+
+// explicit constexpr year_month_weekday(const local_days& dp) noexcept;
+//
+//
+// Effects: Constructs an object of type year_month_weekday that corresponds
+// to the date represented by dp
+//
+// Remarks: Equivalent to constructing with sys_days{dp.time_since_epoch()}.
+//
+// constexpr chrono::year year() const noexcept;
+// constexpr chrono::month month() const noexcept;
+// constexpr chrono::day day() const noexcept;
+// constexpr bool ok() const noexcept;
+
+#include <chrono>
+#include <type_traits>
+#include <cassert>
+
+#include "test_macros.h"
+
+int main()
+{
+ using year = std::chrono::year;
+ using days = std::chrono::days;
+ using local_days = std::chrono::local_days;
+ using weekday_indexed = std::chrono::weekday_indexed;
+ using year_month_weekday = std::chrono::year_month_weekday;
+
+ ASSERT_NOEXCEPT(year_month_weekday{std::declval<const local_days>()});
+
+ {
+ constexpr local_days sd{}; // 1-Jan-1970 was a Thursday
+ constexpr year_month_weekday ymwd{sd};
+
+ static_assert( ymwd.ok(), "");
+ static_assert( ymwd.year() == year{1970}, "");
+ static_assert( ymwd.month() == std::chrono::January, "");
+ static_assert( ymwd.weekday() == std::chrono::Thursday, "");
+ static_assert( ymwd.index() == 1, "");
+ static_assert( ymwd.weekday_indexed() == weekday_indexed{std::chrono::Thursday, 1}, "");
+ static_assert( ymwd == year_month_weekday{local_days{ymwd}}, ""); // round trip
+ }
+
+ {
+ constexpr local_days sd{days{10957+32}}; // 2-Feb-2000 was a Wednesday
+ constexpr year_month_weekday ymwd{sd};
+
+ static_assert( ymwd.ok(), "");
+ static_assert( ymwd.year() == year{2000}, "");
+ static_assert( ymwd.month() == std::chrono::February, "");
+ static_assert( ymwd.weekday() == std::chrono::Wednesday, "");
+ static_assert( ymwd.index() == 1, "");
+ static_assert( ymwd.weekday_indexed() == weekday_indexed{std::chrono::Wednesday, 1}, "");
+ static_assert( ymwd == year_month_weekday{local_days{ymwd}}, ""); // round trip
+ }
+
+
+ {
+ constexpr local_days sd{days{-10957}}; // 2-Jan-1940 was a Tuesday
+ constexpr year_month_weekday ymwd{sd};
+
+ static_assert( ymwd.ok(), "");
+ static_assert( ymwd.year() == year{1940}, "");
+ static_assert( ymwd.month() == std::chrono::January, "");
+ static_assert( ymwd.weekday() == std::chrono::Tuesday, "");
+ static_assert( ymwd.index() == 1, "");
+ static_assert( ymwd.weekday_indexed() == weekday_indexed{std::chrono::Tuesday, 1}, "");
+ static_assert( ymwd == year_month_weekday{local_days{ymwd}}, ""); // round trip
+ }
+
+ {
+ local_days sd{days{-(10957+34)}}; // 29-Nov-1939 was a Wednesday
+ year_month_weekday ymwd{sd};
+
+ assert( ymwd.ok());
+ assert( ymwd.year() == year{1939});
+ assert( ymwd.month() == std::chrono::November);
+ assert( ymwd.weekday() == std::chrono::Wednesday);
+ assert( ymwd.index() == 5);
+ assert((ymwd.weekday_indexed() == weekday_indexed{std::chrono::Wednesday, 5}));
+ assert( ymwd == year_month_weekday{local_days{ymwd}}); // round trip
+ }
+}
diff --git a/test/std/utilities/time/time.cal/time.cal.ymwd/time.cal.ymwd.members/ctor.pass.cpp b/test/std/utilities/time/time.cal/time.cal.ymwd/time.cal.ymwd.members/ctor.pass.cpp
new file mode 100644
index 0000000000000..751de609177eb
--- /dev/null
+++ b/test/std/utilities/time/time.cal/time.cal.ymwd/time.cal.ymwd.members/ctor.pass.cpp
@@ -0,0 +1,64 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
+
+// <chrono>
+// class year_month_weekday;
+
+// year_month_weekday() = default;
+// constexpr year_month_weekday(const chrono::year& y, const chrono::month& m,
+// const chrono::weekday_indexed& wdi) noexcept;
+//
+// Effects: Constructs an object of type year_month_weekday by initializing
+// y_ with y, m_ with m, and wdi_ with wdi.
+//
+// constexpr chrono::year year() const noexcept;
+// constexpr chrono::month month() const noexcept;
+// constexpr chrono::weekday weekday() const noexcept;
+// constexpr unsigned index() const noexcept;
+// constexpr chrono::weekday_indexed weekday_indexed() const noexcept;
+// constexpr bool ok() const noexcept;
+
+#include <chrono>
+#include <type_traits>
+#include <cassert>
+
+#include "test_macros.h"
+
+int main()
+{
+ using year = std::chrono::year;
+ using month = std::chrono::month;
+ using weekday = std::chrono::weekday;
+ using weekday_indexed = std::chrono::weekday_indexed;
+ using year_month_weekday = std::chrono::year_month_weekday;
+
+ constexpr month January = std::chrono::January;
+ constexpr weekday Tuesday = std::chrono::Tuesday;
+
+ ASSERT_NOEXCEPT(year_month_weekday{});
+ ASSERT_NOEXCEPT(year_month_weekday{year{1}, month{1}, weekday_indexed{Tuesday, 1}});
+
+ constexpr year_month_weekday ym0{};
+ static_assert( ym0.year() == year{}, "");
+ static_assert( ym0.month() == month{}, "");
+ static_assert( ym0.weekday() == weekday{}, "");
+ static_assert( ym0.index() == 0, "");
+ static_assert( ym0.weekday_indexed() == weekday_indexed{}, "");
+ static_assert(!ym0.ok(), "");
+
+ constexpr year_month_weekday ym1{year{2019}, January, weekday_indexed{Tuesday, 1}};
+ static_assert( ym1.year() == year{2019}, "");
+ static_assert( ym1.month() == January, "");
+ static_assert( ym1.weekday() == Tuesday, "");
+ static_assert( ym1.index() == 1, "");
+ static_assert( ym1.weekday_indexed() == weekday_indexed{Tuesday, 1}, "");
+ static_assert( ym1.ok(), "");
+
+}
diff --git a/test/std/utilities/time/time.cal/time.cal.ymwd/time.cal.ymwd.members/ctor.sys_days.pass.cpp b/test/std/utilities/time/time.cal/time.cal.ymwd/time.cal.ymwd.members/ctor.sys_days.pass.cpp
new file mode 100644
index 0000000000000..b9d3b6c62b1c4
--- /dev/null
+++ b/test/std/utilities/time/time.cal/time.cal.ymwd/time.cal.ymwd.members/ctor.sys_days.pass.cpp
@@ -0,0 +1,94 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
+
+// <chrono>
+// class year_month_weekday;
+
+// constexpr year_month_weekday(const sys_days& dp) noexcept;
+//
+// Effects: Constructs an object of type year_month_weekday that corresponds
+// to the date represented by dp
+//
+// Remarks: For any value ymd of type year_month_weekday for which ymd.ok() is true,
+// ymd == year_month_weekday{sys_days{ymd}} is true.
+//
+// constexpr chrono::year year() const noexcept;
+// constexpr chrono::month month() const noexcept;
+// constexpr bool ok() const noexcept;
+
+#include <chrono>
+#include <type_traits>
+#include <cassert>
+
+#include "test_macros.h"
+
+int main()
+{
+ using year = std::chrono::year;
+ using days = std::chrono::days;
+ using sys_days = std::chrono::sys_days;
+ using weekday_indexed = std::chrono::weekday_indexed;
+ using year_month_weekday = std::chrono::year_month_weekday;
+
+ ASSERT_NOEXCEPT(year_month_weekday{std::declval<const sys_days>()});
+
+ {
+ constexpr sys_days sd{}; // 1-Jan-1970 was a Thursday
+ constexpr year_month_weekday ymwd{sd};
+
+ static_assert( ymwd.ok(), "");
+ static_assert( ymwd.year() == year{1970}, "");
+ static_assert( ymwd.month() == std::chrono::January, "");
+ static_assert( ymwd.weekday() == std::chrono::Thursday, "");
+ static_assert( ymwd.index() == 1, "");
+ static_assert( ymwd.weekday_indexed() == weekday_indexed{std::chrono::Thursday, 1}, "");
+ static_assert( ymwd == year_month_weekday{sys_days{ymwd}}, ""); // round trip
+ }
+
+ {
+ constexpr sys_days sd{days{10957+32}}; // 2-Feb-2000 was a Wednesday
+ constexpr year_month_weekday ymwd{sd};
+
+ static_assert( ymwd.ok(), "");
+ static_assert( ymwd.year() == year{2000}, "");
+ static_assert( ymwd.month() == std::chrono::February, "");
+ static_assert( ymwd.weekday() == std::chrono::Wednesday, "");
+ static_assert( ymwd.index() == 1, "");
+ static_assert( ymwd.weekday_indexed() == weekday_indexed{std::chrono::Wednesday, 1}, "");
+ static_assert( ymwd == year_month_weekday{sys_days{ymwd}}, ""); // round trip
+ }
+
+
+ {
+ constexpr sys_days sd{days{-10957}}; // 2-Jan-1940 was a Tuesday
+ constexpr year_month_weekday ymwd{sd};
+
+ static_assert( ymwd.ok(), "");
+ static_assert( ymwd.year() == year{1940}, "");
+ static_assert( ymwd.month() == std::chrono::January, "");
+ static_assert( ymwd.weekday() == std::chrono::Tuesday, "");
+ static_assert( ymwd.index() == 1, "");
+ static_assert( ymwd.weekday_indexed() == weekday_indexed{std::chrono::Tuesday, 1}, "");
+ static_assert( ymwd == year_month_weekday{sys_days{ymwd}}, ""); // round trip
+ }
+
+ {
+ sys_days sd{days{-(10957+34)}}; // 29-Nov-1939 was a Wednesday
+ year_month_weekday ymwd{sd};
+
+ assert( ymwd.ok());
+ assert( ymwd.year() == year{1939});
+ assert( ymwd.month() == std::chrono::November);
+ assert( ymwd.weekday() == std::chrono::Wednesday);
+ assert( ymwd.index() == 5);
+ assert((ymwd.weekday_indexed() == weekday_indexed{std::chrono::Wednesday, 5}));
+ assert( ymwd == year_month_weekday{sys_days{ymwd}}); // round trip
+ }
+}
diff --git a/test/std/utilities/time/time.cal/time.cal.ymwd/time.cal.ymwd.members/index.pass.cpp b/test/std/utilities/time/time.cal/time.cal.ymwd/time.cal.ymwd.members/index.pass.cpp
new file mode 100644
index 0000000000000..5a29b82180340
--- /dev/null
+++ b/test/std/utilities/time/time.cal/time.cal.ymwd/time.cal.ymwd.members/index.pass.cpp
@@ -0,0 +1,41 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
+
+// <chrono>
+// class year_month_weekday;
+
+// constexpr unsigned index() const noexcept;
+// Returns: wdi_.index()
+
+#include <chrono>
+#include <type_traits>
+#include <cassert>
+
+#include "test_macros.h"
+
+int main()
+{
+ using year = std::chrono::year;
+ using month = std::chrono::month;
+ using weekday = std::chrono::weekday;
+ using weekday_indexed = std::chrono::weekday_indexed;
+ using year_month_weekday = std::chrono::year_month_weekday;
+
+ ASSERT_NOEXCEPT( std::declval<const year_month_weekday>().index());
+ ASSERT_SAME_TYPE(unsigned, decltype(std::declval<const year_month_weekday>().index()));
+
+ static_assert( year_month_weekday{}.index() == 0, "");
+
+ for (unsigned i = 1; i <= 50; ++i)
+ {
+ year_month_weekday ymwd0(year{1234}, month{2}, weekday_indexed{weekday{2}, i});
+ assert(ymwd0.index() == i);
+ }
+}
diff --git a/test/std/utilities/time/time.cal/time.cal.ymwd/time.cal.ymwd.members/month.pass.cpp b/test/std/utilities/time/time.cal/time.cal.ymwd/time.cal.ymwd.members/month.pass.cpp
new file mode 100644
index 0000000000000..5749da9af7e51
--- /dev/null
+++ b/test/std/utilities/time/time.cal/time.cal.ymwd/time.cal.ymwd.members/month.pass.cpp
@@ -0,0 +1,40 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
+
+// <chrono>
+// class year_month_weekday;
+
+// constexpr chrono::month month() const noexcept;
+// Returns: wd_
+
+#include <chrono>
+#include <type_traits>
+#include <cassert>
+
+#include "test_macros.h"
+
+int main()
+{
+ using year = std::chrono::year;
+ using month = std::chrono::month;
+ using weekday_indexed = std::chrono::weekday_indexed;
+ using year_month_weekday = std::chrono::year_month_weekday;
+
+ ASSERT_NOEXCEPT( std::declval<const year_month_weekday>().month());
+ ASSERT_SAME_TYPE(month, decltype(std::declval<const year_month_weekday>().month()));
+
+ static_assert( year_month_weekday{}.month() == month{}, "");
+
+ for (unsigned i = 1; i <= 50; ++i)
+ {
+ year_month_weekday ymd(year{1234}, month{i}, weekday_indexed{});
+ assert( static_cast<unsigned>(ymd.month()) == i);
+ }
+}
diff --git a/test/std/utilities/time/time.cal/time.cal.ymwd/time.cal.ymwd.members/ok.pass.cpp b/test/std/utilities/time/time.cal/time.cal.ymwd/time.cal.ymwd.members/ok.pass.cpp
new file mode 100644
index 0000000000000..97f898986be06
--- /dev/null
+++ b/test/std/utilities/time/time.cal/time.cal.ymwd/time.cal.ymwd.members/ok.pass.cpp
@@ -0,0 +1,75 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
+
+// <chrono>
+// class year_month_weekday;
+
+// constexpr bool ok() const noexcept;
+// Returns: m_.ok() && y_.ok().
+
+#include <chrono>
+#include <type_traits>
+#include <cassert>
+
+#include "test_macros.h"
+
+int main()
+{
+ using year = std::chrono::year;
+ using month = std::chrono::month;
+ using weekday = std::chrono::weekday;
+ using weekday_indexed = std::chrono::weekday_indexed;
+ using year_month_weekday = std::chrono::year_month_weekday;
+
+ constexpr month January = std::chrono::January;
+ constexpr weekday Tuesday = std::chrono::Tuesday;
+
+ ASSERT_NOEXCEPT( std::declval<const year_month_weekday>().ok());
+ ASSERT_SAME_TYPE(bool, decltype(std::declval<const year_month_weekday>().ok()));
+
+ static_assert(!year_month_weekday{}.ok(), "");
+
+ static_assert(!year_month_weekday{year{-32768}, month{}, weekday_indexed{}}.ok(), ""); // All three bad
+
+ static_assert(!year_month_weekday{year{-32768}, January, weekday_indexed{Tuesday, 1}}.ok(), ""); // Bad year
+ static_assert(!year_month_weekday{year{2019}, month{}, weekday_indexed{Tuesday, 1}}.ok(), ""); // Bad month
+ static_assert(!year_month_weekday{year{2019}, January, weekday_indexed{} }.ok(), ""); // Bad day
+
+ static_assert(!year_month_weekday{year{-32768}, month{}, weekday_indexed{Tuesday, 1}}.ok(), ""); // Bad year & month
+ static_assert(!year_month_weekday{year{2019}, month{}, weekday_indexed{} }.ok(), ""); // Bad month & day
+ static_assert(!year_month_weekday{year{-32768}, January, weekday_indexed{} }.ok(), ""); // Bad year & day
+
+ static_assert( year_month_weekday{year{2019}, January, weekday_indexed{Tuesday, 1}}.ok(), ""); // All OK
+
+ for (unsigned i = 0; i <= 50; ++i)
+ {
+ year_month_weekday ym{year{2019}, January, weekday_indexed{Tuesday, i}};
+ assert((ym.ok() == weekday_indexed{Tuesday, i}.ok()));
+ }
+
+ for (unsigned i = 0; i <= 50; ++i)
+ {
+ year_month_weekday ym{year{2019}, January, weekday_indexed{weekday{i}, 1}};
+ assert((ym.ok() == weekday_indexed{weekday{i}, 1}.ok()));
+ }
+
+ for (unsigned i = 0; i <= 50; ++i)
+ {
+ year_month_weekday ym{year{2019}, month{i}, weekday_indexed{Tuesday, 1}};
+ assert((ym.ok() == month{i}.ok()));
+ }
+
+ const int ymax = static_cast<int>(year::max());
+ for (int i = ymax - 100; i <= ymax + 100; ++i)
+ {
+ year_month_weekday ym{year{i}, January, weekday_indexed{Tuesday, 1}};
+ assert((ym.ok() == year{i}.ok()));
+ }
+}
diff --git a/test/std/utilities/time/time.cal/time.cal.ymwd/time.cal.ymwd.members/op.local_days.pass.cpp b/test/std/utilities/time/time.cal/time.cal.ymwd/time.cal.ymwd.members/op.local_days.pass.cpp
new file mode 100644
index 0000000000000..ef30ce526c659
--- /dev/null
+++ b/test/std/utilities/time/time.cal/time.cal.ymwd/time.cal.ymwd.members/op.local_days.pass.cpp
@@ -0,0 +1,74 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
+
+// <chrono>
+// class year_month_weekday;
+
+// explicit constexpr operator local_days() const noexcept;
+//
+// Returns: If y_.ok() && m_.ok() && wdi_.weekday().ok(), returns a
+// sys_days that represents the date (index() - 1) * 7 days after the first
+// weekday() of year()/month(). If index() is 0 the returned sys_days
+// represents the date 7 days prior to the first weekday() of
+// year()/month(). Otherwise the returned value is unspecified.
+//
+
+#include <chrono>
+#include <type_traits>
+#include <cassert>
+
+#include "test_macros.h"
+
+int main()
+{
+ using year = std::chrono::year;
+ using month = std::chrono::month;
+ using weekday_indexed = std::chrono::weekday_indexed;
+ using local_days = std::chrono::local_days;
+ using days = std::chrono::days;
+ using year_month_weekday = std::chrono::year_month_weekday;
+
+ ASSERT_NOEXCEPT(local_days(std::declval<year_month_weekday>()));
+
+ {
+ constexpr year_month_weekday ymwd{year{1970}, month{1}, weekday_indexed{std::chrono::Thursday, 1}};
+ constexpr local_days sd{ymwd};
+
+ static_assert( sd.time_since_epoch() == days{0}, "");
+ static_assert( year_month_weekday{sd} == ymwd, ""); // and back
+ }
+
+ {
+ constexpr year_month_weekday ymwd{year{2000}, month{2}, weekday_indexed{std::chrono::Wednesday, 1}};
+ constexpr local_days sd{ymwd};
+
+ static_assert( sd.time_since_epoch() == days{10957+32}, "");
+ static_assert( year_month_weekday{sd} == ymwd, ""); // and back
+ }
+
+// There's one more leap day between 1/1/40 and 1/1/70
+// when compared to 1/1/70 -> 1/1/2000
+ {
+ constexpr year_month_weekday ymwd{year{1940}, month{1},weekday_indexed{std::chrono::Tuesday, 1}};
+ constexpr local_days sd{ymwd};
+
+ static_assert( sd.time_since_epoch() == days{-10957}, "");
+ static_assert( year_month_weekday{sd} == ymwd, ""); // and back
+ }
+
+ {
+ year_month_weekday ymwd{year{1939}, month{11}, weekday_indexed{std::chrono::Wednesday, 5}};
+ local_days sd{ymwd};
+
+ assert( sd.time_since_epoch() == days{-(10957+34)});
+ assert( year_month_weekday{sd} == ymwd); // and back
+ }
+
+}
diff --git a/test/std/utilities/time/time.cal/time.cal.ymwd/time.cal.ymwd.members/op.sys_days.pass.cpp b/test/std/utilities/time/time.cal/time.cal.ymwd/time.cal.ymwd.members/op.sys_days.pass.cpp
new file mode 100644
index 0000000000000..04986e50d3f1a
--- /dev/null
+++ b/test/std/utilities/time/time.cal/time.cal.ymwd/time.cal.ymwd.members/op.sys_days.pass.cpp
@@ -0,0 +1,74 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
+
+// <chrono>
+// class year_month_weekday;
+
+// constexpr operator sys_days() const noexcept;
+//
+// Returns: If y_.ok() && m_.ok() && wdi_.weekday().ok(), returns a
+// sys_days that represents the date (index() - 1) * 7 days after the first
+// weekday() of year()/month(). If index() is 0 the returned sys_days
+// represents the date 7 days prior to the first weekday() of
+// year()/month(). Otherwise the returned value is unspecified.
+//
+
+#include <chrono>
+#include <type_traits>
+#include <cassert>
+
+#include "test_macros.h"
+
+int main()
+{
+ using year = std::chrono::year;
+ using month = std::chrono::month;
+ using weekday_indexed = std::chrono::weekday_indexed;
+ using sys_days = std::chrono::sys_days;
+ using days = std::chrono::days;
+ using year_month_weekday = std::chrono::year_month_weekday;
+
+ ASSERT_NOEXCEPT(sys_days(std::declval<year_month_weekday>()));
+
+ {
+ constexpr year_month_weekday ymwd{year{1970}, month{1}, weekday_indexed{std::chrono::Thursday, 1}};
+ constexpr sys_days sd{ymwd};
+
+ static_assert( sd.time_since_epoch() == days{0}, "");
+ static_assert( year_month_weekday{sd} == ymwd, ""); // and back
+ }
+
+ {
+ constexpr year_month_weekday ymwd{year{2000}, month{2}, weekday_indexed{std::chrono::Wednesday, 1}};
+ constexpr sys_days sd{ymwd};
+
+ static_assert( sd.time_since_epoch() == days{10957+32}, "");
+ static_assert( year_month_weekday{sd} == ymwd, ""); // and back
+ }
+
+// There's one more leap day between 1/1/40 and 1/1/70
+// when compared to 1/1/70 -> 1/1/2000
+ {
+ constexpr year_month_weekday ymwd{year{1940}, month{1},weekday_indexed{std::chrono::Tuesday, 1}};
+ constexpr sys_days sd{ymwd};
+
+ static_assert( sd.time_since_epoch() == days{-10957}, "");
+ static_assert( year_month_weekday{sd} == ymwd, ""); // and back
+ }
+
+ {
+ year_month_weekday ymwd{year{1939}, month{11}, weekday_indexed{std::chrono::Wednesday, 5}};
+ sys_days sd{ymwd};
+
+ assert( sd.time_since_epoch() == days{-(10957+34)});
+ assert( year_month_weekday{sd} == ymwd); // and back
+ }
+
+}
diff --git a/test/std/utilities/time/time.cal/time.cal.ymwd/time.cal.ymwd.members/plus_minus_equal_month.pass.cpp b/test/std/utilities/time/time.cal/time.cal.ymwd/time.cal.ymwd.members/plus_minus_equal_month.pass.cpp
new file mode 100644
index 0000000000000..c5e101250a311
--- /dev/null
+++ b/test/std/utilities/time/time.cal/time.cal.ymwd/time.cal.ymwd.members/plus_minus_equal_month.pass.cpp
@@ -0,0 +1,80 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
+
+// <chrono>
+// class year_month_weekday;
+
+// constexpr year_month_weekday& operator+=(const months& m) noexcept;
+// constexpr year_month_weekday& operator-=(const months& m) noexcept;
+
+#include <chrono>
+#include <type_traits>
+#include <cassert>
+
+#include "test_macros.h"
+
+template <typename D, typename Ds>
+constexpr bool testConstexpr(D d1)
+{
+ if (static_cast<unsigned>((d1 ).month()) != 1) return false;
+ if (static_cast<unsigned>((d1 += Ds{ 1}).month()) != 2) return false;
+ if (static_cast<unsigned>((d1 += Ds{ 2}).month()) != 4) return false;
+ if (static_cast<unsigned>((d1 += Ds{12}).month()) != 4) return false;
+ if (static_cast<unsigned>((d1 -= Ds{ 1}).month()) != 3) return false;
+ if (static_cast<unsigned>((d1 -= Ds{ 2}).month()) != 1) return false;
+ if (static_cast<unsigned>((d1 -= Ds{12}).month()) != 1) return false;
+ return true;
+}
+
+int main()
+{
+ using year = std::chrono::year;
+ using month = std::chrono::month;
+ using weekday = std::chrono::weekday;
+ using weekday_indexed = std::chrono::weekday_indexed;
+ using year_month_weekday = std::chrono::year_month_weekday;
+ using months = std::chrono::months;
+
+
+ ASSERT_NOEXCEPT( std::declval<year_month_weekday&>() += std::declval<months>());
+ ASSERT_SAME_TYPE(year_month_weekday&, decltype(std::declval<year_month_weekday&>() += std::declval<months>()));
+
+ ASSERT_NOEXCEPT( std::declval<year_month_weekday&>() -= std::declval<months>());
+ ASSERT_SAME_TYPE(year_month_weekday&, decltype(std::declval<year_month_weekday&>() -= std::declval<months>()));
+
+ constexpr weekday Tuesday = std::chrono::Tuesday;
+ static_assert(testConstexpr<year_month_weekday, months>(year_month_weekday{year{1234}, month{1}, weekday_indexed{Tuesday, 2}}), "");
+
+ for (unsigned i = 0; i <= 10; ++i)
+ {
+ year y{1234};
+ year_month_weekday ymwd(y, month{i}, weekday_indexed{Tuesday, 2});
+
+ assert(static_cast<unsigned>((ymwd += months{2}).month()) == i + 2);
+ assert(ymwd.year() == y);
+ assert(ymwd.weekday() == Tuesday);
+ assert(ymwd.index() == 2);
+
+ assert(static_cast<unsigned>((ymwd ).month()) == i + 2);
+ assert(ymwd.year() == y);
+ assert(ymwd.weekday() == Tuesday);
+ assert(ymwd.index() == 2);
+
+ assert(static_cast<unsigned>((ymwd -= months{1}).month()) == i + 1);
+ assert(ymwd.year() == y);
+ assert(ymwd.weekday() == Tuesday);
+ assert(ymwd.index() == 2);
+
+ assert(static_cast<unsigned>((ymwd ).month()) == i + 1);
+ assert(ymwd.year() == y);
+ assert(ymwd.weekday() == Tuesday);
+ assert(ymwd.index() == 2);
+ }
+}
diff --git a/test/std/utilities/time/time.cal/time.cal.ymwd/time.cal.ymwd.members/plus_minus_equal_year.pass.cpp b/test/std/utilities/time/time.cal/time.cal.ymwd/time.cal.ymwd.members/plus_minus_equal_year.pass.cpp
new file mode 100644
index 0000000000000..86830249e7073
--- /dev/null
+++ b/test/std/utilities/time/time.cal/time.cal.ymwd/time.cal.ymwd.members/plus_minus_equal_year.pass.cpp
@@ -0,0 +1,80 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
+
+// <chrono>
+// class year_month_weekday;
+
+// constexpr year_month_weekday& operator+=(const years& d) noexcept;
+// constexpr year_month_weekday& operator-=(const years& d) noexcept;
+
+#include <chrono>
+#include <type_traits>
+#include <cassert>
+
+#include "test_macros.h"
+
+template <typename D, typename Ds>
+constexpr bool testConstexpr(D d1)
+{
+ if (static_cast<int>((d1 ).year()) != 1) return false;
+ if (static_cast<int>((d1 += Ds{ 1}).year()) != 2) return false;
+ if (static_cast<int>((d1 += Ds{ 2}).year()) != 4) return false;
+ if (static_cast<int>((d1 += Ds{12}).year()) != 16) return false;
+ if (static_cast<int>((d1 -= Ds{ 1}).year()) != 15) return false;
+ if (static_cast<int>((d1 -= Ds{ 2}).year()) != 13) return false;
+ if (static_cast<int>((d1 -= Ds{12}).year()) != 1) return false;
+ return true;
+}
+
+int main()
+{
+ using year = std::chrono::year;
+ using month = std::chrono::month;
+ using weekday = std::chrono::weekday;
+ using weekday_indexed = std::chrono::weekday_indexed;
+ using year_month_weekday = std::chrono::year_month_weekday;
+ using years = std::chrono::years;
+
+ ASSERT_NOEXCEPT( std::declval<year_month_weekday&>() += std::declval<years>());
+ ASSERT_SAME_TYPE(year_month_weekday&, decltype(std::declval<year_month_weekday&>() += std::declval<years>()));
+
+ ASSERT_NOEXCEPT( std::declval<year_month_weekday&>() -= std::declval<years>());
+ ASSERT_SAME_TYPE(year_month_weekday&, decltype(std::declval<year_month_weekday&>() -= std::declval<years>()));
+
+ constexpr weekday Tuesday = std::chrono::Tuesday;
+ constexpr month January = std::chrono::January;
+
+ static_assert(testConstexpr<year_month_weekday, years>(year_month_weekday{year{1}, January, weekday_indexed{Tuesday, 2}}), "");
+
+ for (int i = 1000; i <= 1010; ++i)
+ {
+ year_month_weekday ymwd(year{i}, January, weekday_indexed{Tuesday, 2});
+
+ assert(static_cast<int>((ymwd += years{2}).year()) == i + 2);
+ assert(ymwd.month() == January);
+ assert(ymwd.weekday() == Tuesday);
+ assert(ymwd.index() == 2);
+
+ assert(static_cast<int>((ymwd ).year()) == i + 2);
+ assert(ymwd.month() == January);
+ assert(ymwd.weekday() == Tuesday);
+ assert(ymwd.index() == 2);
+
+ assert(static_cast<int>((ymwd -= years{1}).year()) == i + 1);
+ assert(ymwd.month() == January);
+ assert(ymwd.weekday() == Tuesday);
+ assert(ymwd.index() == 2);
+
+ assert(static_cast<int>((ymwd ).year()) == i + 1);
+ assert(ymwd.month() == January);
+ assert(ymwd.weekday() == Tuesday);
+ assert(ymwd.index() == 2);
+ }
+}
diff --git a/test/std/utilities/time/time.cal/time.cal.ymwd/time.cal.ymwd.members/weekday.pass.cpp b/test/std/utilities/time/time.cal/time.cal.ymwd/time.cal.ymwd.members/weekday.pass.cpp
new file mode 100644
index 0000000000000..ad9bc6ee61212
--- /dev/null
+++ b/test/std/utilities/time/time.cal/time.cal.ymwd/time.cal.ymwd.members/weekday.pass.cpp
@@ -0,0 +1,41 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
+
+// <chrono>
+// class year_month_weekday;
+
+// constexpr chrono::weekday weekday() const noexcept;
+// Returns: wdi_.weekday()
+
+#include <chrono>
+#include <type_traits>
+#include <cassert>
+
+#include "test_macros.h"
+
+int main()
+{
+ using year = std::chrono::year;
+ using month = std::chrono::month;
+ using weekday = std::chrono::weekday;
+ using weekday_indexed = std::chrono::weekday_indexed;
+ using year_month_weekday = std::chrono::year_month_weekday;
+
+ ASSERT_NOEXCEPT( std::declval<const year_month_weekday>().weekday());
+ ASSERT_SAME_TYPE(weekday, decltype(std::declval<const year_month_weekday>().weekday()));
+
+ static_assert( year_month_weekday{}.weekday() == weekday{}, "");
+
+ for (unsigned i = 1; i <= 50; ++i)
+ {
+ year_month_weekday ymwd0(year{1234}, month{2}, weekday_indexed{weekday{i}, 1});
+ assert(static_cast<unsigned>(ymwd0.weekday()) == i);
+ }
+}
diff --git a/test/std/utilities/time/time.cal/time.cal.ymwd/time.cal.ymwd.members/weekday_indexed.pass.cpp b/test/std/utilities/time/time.cal/time.cal.ymwd/time.cal.ymwd.members/weekday_indexed.pass.cpp
new file mode 100644
index 0000000000000..52d918e55c489
--- /dev/null
+++ b/test/std/utilities/time/time.cal/time.cal.ymwd/time.cal.ymwd.members/weekday_indexed.pass.cpp
@@ -0,0 +1,45 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
+
+// <chrono>
+// class year_month_weekday;
+
+// constexpr chrono::weekday_indexed weekday_indexed() const noexcept;
+// Returns: wd_
+
+#include <chrono>
+#include <type_traits>
+#include <cassert>
+
+#include "test_macros.h"
+
+int main()
+{
+ using year = std::chrono::year;
+ using month = std::chrono::month;
+ using weekday = std::chrono::weekday;
+ using weekday_indexed = std::chrono::weekday_indexed;
+ using year_month_weekday = std::chrono::year_month_weekday;
+
+ ASSERT_NOEXCEPT( std::declval<const year_month_weekday>().weekday_indexed());
+ ASSERT_SAME_TYPE(weekday_indexed, decltype(std::declval<const year_month_weekday>().weekday_indexed()));
+
+ static_assert( year_month_weekday{}.weekday_indexed() == weekday_indexed{}, "");
+
+ for (unsigned i = 1; i <= 50; ++i)
+ {
+ year_month_weekday ymwd0(year{1234}, month{2}, weekday_indexed{weekday{i}, 1});
+ assert( static_cast<unsigned>(ymwd0.weekday_indexed().weekday()) == i);
+ assert( static_cast<unsigned>(ymwd0.weekday_indexed().index()) == 1);
+ year_month_weekday ymwd1(year{1234}, month{2}, weekday_indexed{weekday{2}, i});
+ assert( static_cast<unsigned>(ymwd1.weekday_indexed().weekday()) == 2);
+ assert( static_cast<unsigned>(ymwd1.weekday_indexed().index()) == i);
+ }
+}
diff --git a/test/std/utilities/time/time.cal/time.cal.ymwd/time.cal.ymwd.members/year.pass.cpp b/test/std/utilities/time/time.cal/time.cal.ymwd/time.cal.ymwd.members/year.pass.cpp
new file mode 100644
index 0000000000000..5cf1cbaf74148
--- /dev/null
+++ b/test/std/utilities/time/time.cal/time.cal.ymwd/time.cal.ymwd.members/year.pass.cpp
@@ -0,0 +1,40 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
+
+// <chrono>
+// class year_month_weekday;
+
+// constexpr chrono::year year() const noexcept;
+// Returns: d_
+
+#include <chrono>
+#include <type_traits>
+#include <cassert>
+
+#include "test_macros.h"
+
+int main()
+{
+ using year = std::chrono::year;
+ using month = std::chrono::month;
+ using weekday_indexed = std::chrono::weekday_indexed;
+ using year_month_weekday = std::chrono::year_month_weekday;
+
+ ASSERT_NOEXCEPT( std::declval<const year_month_weekday>().year());
+ ASSERT_SAME_TYPE(year, decltype(std::declval<const year_month_weekday>().year()));
+
+ static_assert( year_month_weekday{}.year() == year{}, "");
+
+ for (int i = 1; i <= 50; ++i)
+ {
+ year_month_weekday ym(year{i}, month{1}, weekday_indexed{});
+ assert( static_cast<int>(ym.year()) == i);
+ }
+}
diff --git a/test/std/utilities/time/time.cal/time.cal.ymwd/time.cal.ymwd.nonmembers/comparisons.pass.cpp b/test/std/utilities/time/time.cal/time.cal.ymwd/time.cal.ymwd.nonmembers/comparisons.pass.cpp
new file mode 100644
index 0000000000000..fc13709cde087
--- /dev/null
+++ b/test/std/utilities/time/time.cal/time.cal.ymwd/time.cal.ymwd.nonmembers/comparisons.pass.cpp
@@ -0,0 +1,113 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
+
+// <chrono>
+// class year_month_weekday;
+
+// constexpr bool operator==(const year_month_weekday& x, const year_month_weekday& y) noexcept;
+// Returns: x.year() == y.year() && x.month() == y.month() && x.weekday_indexed() == y.weekday_indexed()
+//
+
+
+#include <chrono>
+#include <type_traits>
+#include <cassert>
+
+#include "test_macros.h"
+#include "test_comparisons.h"
+
+int main()
+{
+ using year = std::chrono::year;
+ using month = std::chrono::month;
+ using weekday_indexed = std::chrono::weekday_indexed;
+ using weekday = std::chrono::weekday;
+ using year_month_weekday = std::chrono::year_month_weekday;
+
+ AssertComparisons2AreNoexcept<year_month_weekday>();
+ AssertComparisons2ReturnBool<year_month_weekday>();
+
+ constexpr month January = std::chrono::January;
+ constexpr month February = std::chrono::February;
+ constexpr weekday Tuesday = std::chrono::Tuesday;
+
+ static_assert( testComparisons2(
+ year_month_weekday{year{1234}, January, weekday_indexed{Tuesday, 1}},
+ year_month_weekday{year{1234}, January, weekday_indexed{Tuesday, 1}},
+ true), "");
+
+// different day
+ static_assert( testComparisons2(
+ year_month_weekday{year{1234}, January, weekday_indexed{Tuesday, 1}},
+ year_month_weekday{year{1234}, January, weekday_indexed{Tuesday, 2}},
+ false), "");
+
+// different month
+ static_assert( testComparisons2(
+ year_month_weekday{year{1234}, January, weekday_indexed{Tuesday, 1}},
+ year_month_weekday{year{1234}, February, weekday_indexed{Tuesday, 1}},
+ false), "");
+
+// different year
+ static_assert( testComparisons2(
+ year_month_weekday{year{1234}, January, weekday_indexed{Tuesday, 1}},
+ year_month_weekday{year{1235}, January, weekday_indexed{Tuesday, 1}},
+ false), "");
+
+
+// different month and day
+ static_assert( testComparisons2(
+ year_month_weekday{year{1234}, January, weekday_indexed{Tuesday, 1}},
+ year_month_weekday{year{1234}, February, weekday_indexed{Tuesday, 2}},
+ false), "");
+
+// different year and month
+ static_assert( testComparisons2(
+ year_month_weekday{year{1234}, February, weekday_indexed{Tuesday, 1}},
+ year_month_weekday{year{1235}, January, weekday_indexed{Tuesday, 1}},
+ false), "");
+
+// different year and day
+ static_assert( testComparisons2(
+ year_month_weekday{year{1234}, January, weekday_indexed{Tuesday, 2}},
+ year_month_weekday{year{1235}, January, weekday_indexed{Tuesday, 1}},
+ false), "");
+
+// different year, month and day
+ static_assert( testComparisons2(
+ year_month_weekday{year{1234}, February, weekday_indexed{Tuesday, 2}},
+ year_month_weekday{year{1235}, January, weekday_indexed{Tuesday, 1}},
+ false), "");
+
+
+// same year, different days
+ for (unsigned i = 1; i < 28; ++i)
+ for (unsigned j = 1; j < 28; ++j)
+ assert((testComparisons2(
+ year_month_weekday{year{1234}, January, weekday_indexed{Tuesday, i}},
+ year_month_weekday{year{1234}, January, weekday_indexed{Tuesday, j}},
+ i == j)));
+
+// same year, different months
+ for (unsigned i = 1; i < 12; ++i)
+ for (unsigned j = 1; j < 12; ++j)
+ assert((testComparisons2(
+ year_month_weekday{year{1234}, month{i}, weekday_indexed{Tuesday, 1}},
+ year_month_weekday{year{1234}, month{j}, weekday_indexed{Tuesday, 1}},
+ i == j)));
+
+// same month, different years
+ for (int i = 1000; i < 20; ++i)
+ for (int j = 1000; j < 20; ++j)
+ assert((testComparisons2(
+ year_month_weekday{year{i}, January, weekday_indexed{Tuesday, 1}},
+ year_month_weekday{year{j}, January, weekday_indexed{Tuesday, 1}},
+ i == j)));
+}
diff --git a/test/std/utilities/time/time.cal/time.cal.ymwd/time.cal.ymwd.nonmembers/minus.pass.cpp b/test/std/utilities/time/time.cal/time.cal.ymwd/time.cal.ymwd.nonmembers/minus.pass.cpp
new file mode 100644
index 0000000000000..0b217414ca93c
--- /dev/null
+++ b/test/std/utilities/time/time.cal/time.cal.ymwd/time.cal.ymwd.nonmembers/minus.pass.cpp
@@ -0,0 +1,100 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
+
+// <chrono>
+// class year_month_weekday;
+
+// constexpr year_month_weekday operator-(const year_month_weekday& ymwd, const months& dm) noexcept;
+// Returns: ymwd + (-dm).
+//
+// constexpr year_month_weekday operator-(const year_month_weekday& ymwd, const years& dy) noexcept;
+// Returns: ymwd + (-dy).
+
+
+#include <chrono>
+#include <type_traits>
+#include <cassert>
+
+#include "test_macros.h"
+
+#include <iostream>
+
+constexpr bool testConstexprYears ()
+{
+ std::chrono::year_month_weekday ym0{std::chrono::year{1234}, std::chrono::January, std::chrono::weekday_indexed{std::chrono::Tuesday, 1}};
+ std::chrono::year_month_weekday ym1 = ym0 - std::chrono::years{10};
+ return
+ ym1.year() == std::chrono::year{1234-10}
+ && ym1.month() == std::chrono::January
+ && ym1.weekday() == std::chrono::Tuesday
+ && ym1.index() == 1
+ ;
+}
+
+constexpr bool testConstexprMonths ()
+{
+ std::chrono::year_month_weekday ym0{std::chrono::year{1234}, std::chrono::November, std::chrono::weekday_indexed{std::chrono::Tuesday, 1}};
+ std::chrono::year_month_weekday ym1 = ym0 - std::chrono::months{6};
+ return
+ ym1.year() == std::chrono::year{1234}
+ && ym1.month() == std::chrono::May
+ && ym1.weekday() == std::chrono::Tuesday
+ && ym1.index() == 1
+ ;
+}
+
+
+int main()
+{
+ using year = std::chrono::year;
+ using month = std::chrono::month;
+ using weekday = std::chrono::weekday;
+ using weekday_indexed = std::chrono::weekday_indexed;
+ using year_month_weekday = std::chrono::year_month_weekday;
+ using years = std::chrono::years;
+ using months = std::chrono::months;
+
+ constexpr month November = std::chrono::November;
+ constexpr weekday Tuesday = std::chrono::Tuesday;
+
+ { // year_month_weekday - years
+ ASSERT_NOEXCEPT( std::declval<year_month_weekday>() - std::declval<years>());
+ ASSERT_SAME_TYPE(year_month_weekday, decltype(std::declval<year_month_weekday>() - std::declval<years>()));
+
+ static_assert(testConstexprYears(), "");
+
+ year_month_weekday ym{year{1234}, November, weekday_indexed{Tuesday, 1}};
+ for (int i = 0; i <= 10; ++i)
+ {
+ year_month_weekday ym1 = ym - years{i};
+ assert(static_cast<int>(ym1.year()) == 1234 - i);
+ assert(ym1.month() == November);
+ assert(ym1.weekday() == Tuesday);
+ assert(ym1.index() == 1);
+ }
+ }
+
+ { // year_month_weekday - months
+ ASSERT_NOEXCEPT( std::declval<year_month_weekday>() - std::declval<months>());
+ ASSERT_SAME_TYPE(year_month_weekday, decltype(std::declval<year_month_weekday>() - std::declval<months>()));
+
+ static_assert(testConstexprMonths(), "");
+
+ year_month_weekday ym{year{1234}, November, weekday_indexed{Tuesday, 2}};
+ for (unsigned i = 1; i <= 10; ++i)
+ {
+ year_month_weekday ym1 = ym - months{i};
+ assert(ym1.year() == year{1234});
+ assert(ym1.month() == month{11-i});
+ assert(ym1.weekday() == Tuesday);
+ assert(ym1.index() == 2);
+ }
+ }
+}
diff --git a/test/std/utilities/time/time.cal/time.cal.ymwd/time.cal.ymwd.nonmembers/plus.pass.cpp b/test/std/utilities/time/time.cal/time.cal.ymwd/time.cal.ymwd.nonmembers/plus.pass.cpp
new file mode 100644
index 0000000000000..50572c0c4968d
--- /dev/null
+++ b/test/std/utilities/time/time.cal/time.cal.ymwd/time.cal.ymwd.nonmembers/plus.pass.cpp
@@ -0,0 +1,120 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
+
+// <chrono>
+// class year_month_weekday;
+
+// constexpr year_month_weekday operator+(const year_month_weekday& ymd, const months& dm) noexcept;
+// Returns: (ymd.year() / ymd.month() + dm) / ymd.day().
+//
+// constexpr year_month_weekday operator+(const months& dm, const year_month_weekday& ymd) noexcept;
+// Returns: ymd + dm.
+//
+//
+// constexpr year_month_weekday operator+(const year_month_weekday& ymd, const years& dy) noexcept;
+// Returns: (ymd.year() + dy) / ymd.month() / ymd.day().
+//
+// constexpr year_month_weekday operator+(const years& dy, const year_month_weekday& ymd) noexcept;
+// Returns: ym + dm.
+
+
+
+#include <chrono>
+#include <type_traits>
+#include <cassert>
+
+#include "test_macros.h"
+
+constexpr bool testConstexprYears(std::chrono::year_month_weekday ym)
+{
+ std::chrono::years offset{23};
+ if (static_cast<int>((ym ).year()) != 1) return false;
+ if (static_cast<int>((ym + offset).year()) != 24) return false;
+ if (static_cast<int>((offset + ym).year()) != 24) return false;
+ return true;
+}
+
+
+constexpr bool testConstexprMonths(std::chrono::year_month_weekday ym)
+{
+ std::chrono::months offset{6};
+ if (static_cast<unsigned>((ym ).month()) != 1) return false;
+ if (static_cast<unsigned>((ym + offset).month()) != 7) return false;
+ if (static_cast<unsigned>((offset + ym).month()) != 7) return false;
+ return true;
+}
+
+
+int main()
+{
+ using year = std::chrono::year;
+ using month = std::chrono::month;
+ using weekday = std::chrono::weekday;
+ using weekday_indexed = std::chrono::weekday_indexed;
+ using year_month_weekday = std::chrono::year_month_weekday;
+ using years = std::chrono::years;
+ using months = std::chrono::months;
+
+ constexpr weekday Tuesday = std::chrono::Tuesday;
+ constexpr month January = std::chrono::January;
+
+ { // year_month_weekday + months (and switched)
+ ASSERT_NOEXCEPT(std::declval<year_month_weekday>() + std::declval<months>());
+ ASSERT_NOEXCEPT(std::declval<months>() + std::declval<year_month_weekday>());
+
+ ASSERT_SAME_TYPE(year_month_weekday, decltype(std::declval<year_month_weekday>() + std::declval<months>()));
+ ASSERT_SAME_TYPE(year_month_weekday, decltype(std::declval<months>() + std::declval<year_month_weekday>()));
+
+ static_assert(testConstexprMonths(year_month_weekday{year{1}, January, weekday_indexed{Tuesday, 1}}), "");
+
+ year_month_weekday ym{year{1234}, January, weekday_indexed{Tuesday, 3}};
+ for (int i = 0; i <= 10; ++i) // TODO test wrap-around
+ {
+ year_month_weekday ym1 = ym + months{i};
+ year_month_weekday ym2 = months{i} + ym;
+ assert(static_cast<int>(ym1.year()) == 1234);
+ assert(static_cast<int>(ym2.year()) == 1234);
+ assert(ym1.month() == month(1 + i));
+ assert(ym2.month() == month(1 + i));
+ assert(ym1.weekday() == Tuesday);
+ assert(ym2.weekday() == Tuesday);
+ assert(ym1.index() == 3);
+ assert(ym2.index() == 3);
+ assert(ym1 == ym2);
+ }
+ }
+
+ { // year_month_weekday + years (and switched)
+ ASSERT_NOEXCEPT(std::declval<year_month_weekday>() + std::declval<years>());
+ ASSERT_NOEXCEPT(std::declval<years>() + std::declval<year_month_weekday>());
+
+ ASSERT_SAME_TYPE(year_month_weekday, decltype(std::declval<year_month_weekday>() + std::declval<years>()));
+ ASSERT_SAME_TYPE(year_month_weekday, decltype(std::declval<years>() + std::declval<year_month_weekday>()));
+
+ static_assert(testConstexprYears (year_month_weekday{year{1}, January, weekday_indexed{Tuesday, 1}}), "");
+
+ year_month_weekday ym{year{1234}, std::chrono::January, weekday_indexed{Tuesday, 3}};
+ for (int i = 0; i <= 10; ++i)
+ {
+ year_month_weekday ym1 = ym + years{i};
+ year_month_weekday ym2 = years{i} + ym;
+ assert(static_cast<int>(ym1.year()) == i + 1234);
+ assert(static_cast<int>(ym2.year()) == i + 1234);
+ assert(ym1.month() == January);
+ assert(ym2.month() == January);
+ assert(ym1.weekday() == Tuesday);
+ assert(ym2.weekday() == Tuesday);
+ assert(ym1.index() == 3);
+ assert(ym2.index() == 3);
+ assert(ym1 == ym2);
+ }
+ }
+
+}
diff --git a/test/std/utilities/time/time.cal/time.cal.ymwd/time.cal.ymwd.nonmembers/streaming.pass.cpp b/test/std/utilities/time/time.cal/time.cal.ymwd/time.cal.ymwd.nonmembers/streaming.pass.cpp
new file mode 100644
index 0000000000000..f985f46ea3d54
--- /dev/null
+++ b/test/std/utilities/time/time.cal/time.cal.ymwd/time.cal.ymwd.nonmembers/streaming.pass.cpp
@@ -0,0 +1,57 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
+// XFAIL: *
+
+// <chrono>
+// class year_month_weekday;
+
+// template<class charT, class traits>
+// basic_ostream<charT, traits>&
+// operator<<(basic_ostream<charT, traits>& os, const year_month_weekday& ym);
+//
+// Returns: os << ym.year() << '/' << ym.month().
+//
+//
+// template<class charT, class traits>
+// basic_ostream<charT, traits>&
+// to_stream(basic_ostream<charT, traits>& os, const charT* fmt, const year_month_weekday& ym);
+//
+// Effects: Streams ym into os using the format specified by the NTCTS fmt. fmt encoding follows the rules specified in 25.11.
+//
+// template<class charT, class traits, class Alloc = allocator<charT>>
+// basic_istream<charT, traits>&
+// from_stream(basic_istream<charT, traits>& is, const charT* fmt,
+// year_month_weekday& ym, basic_string<charT, traits, Alloc>* abbrev = nullptr,
+// minutes* offset = nullptr);
+//
+// Effects: Attempts to parse the input stream is into the year_month_weekday ym using the format
+// flags given in the NTCTS fmt as specified in 25.12. If the parse fails to decode
+// a valid year_month_weekday, is.setstate(ios_- base::failbit) shall be called and ym shall
+// not be modified. If %Z is used and successfully parsed, that value will be assigned
+// to *abbrev if abbrev is non-null. If %z (or a modified variant) is used and
+// successfully parsed, that value will be assigned to *offset if offset is non-null.
+
+
+
+#include <chrono>
+#include <type_traits>
+#include <cassert>
+#include <iostream>
+#include "test_macros.h"
+
+int main()
+{
+ using year_month_weekday = std::chrono::year_month_weekday;
+ using year = std::chrono::year;
+ using month = std::chrono::month;
+ using weekday = std::chrono::weekday;
+
+ std::cout << year_month_weekday{year{2018}, month{3}, weekday{4}};
+}
diff --git a/test/std/utilities/time/time.cal/time.cal.ymwd/types.pass.cpp b/test/std/utilities/time/time.cal/time.cal.ymwd/types.pass.cpp
new file mode 100644
index 0000000000000..8969bd32ac46e
--- /dev/null
+++ b/test/std/utilities/time/time.cal/time.cal.ymwd/types.pass.cpp
@@ -0,0 +1,26 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
+
+// <chrono>
+// class year_month_weekday;
+
+#include <chrono>
+#include <type_traits>
+#include <cassert>
+
+#include "test_macros.h"
+
+int main()
+{
+ using year_month_weekday = std::chrono::year_month_weekday;
+
+ static_assert(std::is_trivially_copyable_v<year_month_weekday>, "");
+ static_assert(std::is_standard_layout_v<year_month_weekday>, "");
+}
diff --git a/test/std/utilities/time/time.cal/time.cal.ymwdlast/time.cal.ymwdlast.members/ctor.pass.cpp b/test/std/utilities/time/time.cal/time.cal.ymwdlast/time.cal.ymwdlast.members/ctor.pass.cpp
new file mode 100644
index 0000000000000..cd3f112acc550
--- /dev/null
+++ b/test/std/utilities/time/time.cal/time.cal.ymwdlast/time.cal.ymwdlast.members/ctor.pass.cpp
@@ -0,0 +1,52 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
+
+// <chrono>
+// class year_month_weekday_last;
+
+// constexpr year_month_weekday_last(const chrono::year& y, const chrono::month& m,
+// const chrono::weekday_last& wdl) noexcept;
+//
+// Effects: Constructs an object of type year_month_weekday_last by initializing
+// y_ with y, m_ with m, and wdl_ with wdl.
+//
+// constexpr chrono::year year() const noexcept;
+// constexpr chrono::month month() const noexcept;
+// constexpr chrono::weekday weekday() const noexcept;
+// constexpr chrono::weekday_last weekday_last() const noexcept;
+// constexpr bool ok() const noexcept;
+
+#include <chrono>
+#include <type_traits>
+#include <cassert>
+
+#include "test_macros.h"
+
+int main()
+{
+ using year = std::chrono::year;
+ using month = std::chrono::month;
+ using weekday = std::chrono::weekday;
+ using weekday_last = std::chrono::weekday_last;
+ using year_month_weekday_last = std::chrono::year_month_weekday_last;
+
+ constexpr month January = std::chrono::January;
+ constexpr weekday Tuesday = std::chrono::Tuesday;
+
+ ASSERT_NOEXCEPT(year_month_weekday_last{year{1}, month{1}, weekday_last{Tuesday}});
+
+ constexpr year_month_weekday_last ym1{year{2019}, January, weekday_last{Tuesday}};
+ static_assert( ym1.year() == year{2019}, "");
+ static_assert( ym1.month() == January, "");
+ static_assert( ym1.weekday() == Tuesday, "");
+ static_assert( ym1.weekday_last() == weekday_last{Tuesday}, "");
+ static_assert( ym1.ok(), "");
+
+}
diff --git a/test/std/utilities/time/time.cal/time.cal.ymwdlast/time.cal.ymwdlast.members/month.pass.cpp b/test/std/utilities/time/time.cal/time.cal.ymwdlast/time.cal.ymwdlast.members/month.pass.cpp
new file mode 100644
index 0000000000000..f0c7ec4887dd8
--- /dev/null
+++ b/test/std/utilities/time/time.cal/time.cal.ymwdlast/time.cal.ymwdlast.members/month.pass.cpp
@@ -0,0 +1,41 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
+
+// <chrono>
+// class year_month_weekday_last;
+
+// constexpr chrono::month month() const noexcept;
+// Returns: wd_
+
+#include <chrono>
+#include <type_traits>
+#include <cassert>
+
+#include "test_macros.h"
+
+int main()
+{
+ using year = std::chrono::year;
+ using month = std::chrono::month;
+ using weekday = std::chrono::weekday;
+ using weekday_last = std::chrono::weekday_last;
+ using year_month_weekday_last = std::chrono::year_month_weekday_last;
+
+ ASSERT_NOEXCEPT( std::declval<const year_month_weekday_last>().month());
+ ASSERT_SAME_TYPE(month, decltype(std::declval<const year_month_weekday_last>().month()));
+
+ static_assert( year_month_weekday_last{year{}, month{}, weekday_last{weekday{}}}.month() == month{}, "");
+
+ for (unsigned i = 1; i <= 50; ++i)
+ {
+ year_month_weekday_last ymd(year{1234}, month{i}, weekday_last{weekday{}});
+ assert( static_cast<unsigned>(ymd.month()) == i);
+ }
+}
diff --git a/test/std/utilities/time/time.cal/time.cal.ymwdlast/time.cal.ymwdlast.members/ok.pass.cpp b/test/std/utilities/time/time.cal/time.cal.ymwdlast/time.cal.ymwdlast.members/ok.pass.cpp
new file mode 100644
index 0000000000000..d9443d34b1911
--- /dev/null
+++ b/test/std/utilities/time/time.cal/time.cal.ymwdlast/time.cal.ymwdlast.members/ok.pass.cpp
@@ -0,0 +1,73 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
+
+// <chrono>
+// class year_month_weekday_last;
+
+// constexpr bool ok() const noexcept;
+// Returns: y_.ok() && m_.ok() && wdl_.ok().
+
+#include <chrono>
+#include <type_traits>
+#include <cassert>
+
+#include "test_macros.h"
+
+int main()
+{
+ using year = std::chrono::year;
+ using month = std::chrono::month;
+ using weekday = std::chrono::weekday;
+ using weekday_last = std::chrono::weekday_last;
+ using year_month_weekday_last = std::chrono::year_month_weekday_last;
+
+ constexpr month January = std::chrono::January;
+ constexpr weekday Tuesday = std::chrono::Tuesday;
+
+ ASSERT_NOEXCEPT( std::declval<const year_month_weekday_last>().ok());
+ ASSERT_SAME_TYPE(bool, decltype(std::declval<const year_month_weekday_last>().ok()));
+
+ static_assert(!year_month_weekday_last{year{-32768}, month{}, weekday_last{weekday{}}}.ok(), ""); // All three bad
+
+ static_assert(!year_month_weekday_last{year{-32768}, January, weekday_last{Tuesday}}.ok(), ""); // Bad year
+ static_assert(!year_month_weekday_last{year{2019}, month{}, weekday_last{Tuesday}}.ok(), ""); // Bad month
+ static_assert(!year_month_weekday_last{year{2019}, January, weekday_last{weekday{7}}}.ok(), ""); // Bad day
+
+ static_assert(!year_month_weekday_last{year{-32768}, month{}, weekday_last{Tuesday}}.ok(), ""); // Bad year & month
+ static_assert(!year_month_weekday_last{year{2019}, month{}, weekday_last{weekday{7}}}.ok(), ""); // Bad month & day
+ static_assert(!year_month_weekday_last{year{-32768}, January, weekday_last{weekday{7}}}.ok(), ""); // Bad year & day
+
+ static_assert( year_month_weekday_last{year{2019}, January, weekday_last{Tuesday}}.ok(), ""); // All OK
+
+ for (unsigned i = 0; i <= 50; ++i)
+ {
+ year_month_weekday_last ym{year{2019}, January, weekday_last{Tuesday}};
+ assert((ym.ok() == weekday_last{Tuesday}.ok()));
+ }
+
+ for (unsigned i = 0; i <= 50; ++i)
+ {
+ year_month_weekday_last ym{year{2019}, January, weekday_last{weekday{i}}};
+ assert((ym.ok() == weekday_last{weekday{i}}.ok()));
+ }
+
+ for (unsigned i = 0; i <= 50; ++i)
+ {
+ year_month_weekday_last ym{year{2019}, month{i}, weekday_last{Tuesday}};
+ assert((ym.ok() == month{i}.ok()));
+ }
+
+ const int ymax = static_cast<int>(year::max());
+ for (int i = ymax - 100; i <= ymax + 100; ++i)
+ {
+ year_month_weekday_last ym{year{i}, January, weekday_last{Tuesday}};
+ assert((ym.ok() == year{i}.ok()));
+ }
+}
diff --git a/test/std/utilities/time/time.cal/time.cal.ymwdlast/time.cal.ymwdlast.members/op_local_days.pass.cpp b/test/std/utilities/time/time.cal/time.cal.ymwdlast/time.cal.ymwdlast.members/op_local_days.pass.cpp
new file mode 100644
index 0000000000000..45f1ac4ae2d6f
--- /dev/null
+++ b/test/std/utilities/time/time.cal/time.cal.ymwdlast/time.cal.ymwdlast.members/op_local_days.pass.cpp
@@ -0,0 +1,61 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
+
+// <chrono>
+// class year_month_day_last;
+
+// constexpr operator local_days() const noexcept;
+// Returns: local_days{sys_days{*this}.time_since_epoch()}.
+
+#include <chrono>
+#include <type_traits>
+#include <cassert>
+
+#include "test_macros.h"
+
+int main()
+{
+ using year = std::chrono::year;
+ using month_day_last = std::chrono::month_day_last;
+ using year_month_day_last = std::chrono::year_month_day_last;
+ using local_days = std::chrono::local_days;
+ using days = std::chrono::days;
+
+ ASSERT_NOEXCEPT( static_cast<local_days>(std::declval<const year_month_day_last>()));
+ ASSERT_SAME_TYPE(local_days, decltype(static_cast<local_days>(std::declval<const year_month_day_last>())));
+
+ { // Last day in Jan 1970 was the 31st
+ constexpr year_month_day_last ymdl{year{1970}, month_day_last{std::chrono::January}};
+ constexpr local_days sd{ymdl};
+
+ static_assert(sd.time_since_epoch() == days{30}, "");
+ }
+
+ {
+ constexpr year_month_day_last ymdl{year{2000}, month_day_last{std::chrono::January}};
+ constexpr local_days sd{ymdl};
+
+ static_assert(sd.time_since_epoch() == days{10957+30}, "");
+ }
+
+ {
+ constexpr year_month_day_last ymdl{year{1940}, month_day_last{std::chrono::January}};
+ constexpr local_days sd{ymdl};
+
+ static_assert(sd.time_since_epoch() == days{-10957+29}, "");
+ }
+
+ {
+ year_month_day_last ymdl{year{1939}, month_day_last{std::chrono::November}};
+ local_days sd{ymdl};
+
+ assert(sd.time_since_epoch() == days{-(10957+33)});
+ }
+}
diff --git a/test/std/utilities/time/time.cal/time.cal.ymwdlast/time.cal.ymwdlast.members/op_sys_days.pass.cpp b/test/std/utilities/time/time.cal/time.cal.ymwdlast/time.cal.ymwdlast.members/op_sys_days.pass.cpp
new file mode 100644
index 0000000000000..c5abe4ace248c
--- /dev/null
+++ b/test/std/utilities/time/time.cal/time.cal.ymwdlast/time.cal.ymwdlast.members/op_sys_days.pass.cpp
@@ -0,0 +1,69 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
+
+// <chrono>
+// class year_month_weekday_last;
+
+// constexpr operator sys_days() const noexcept;
+// Returns: If ok() == true, returns a sys_days that represents the last weekday()
+// of year()/month(). Otherwise the returned value is unspecified.
+
+#include <chrono>
+#include <type_traits>
+#include <cassert>
+
+#include "test_macros.h"
+
+#include <iostream>
+
+int main()
+{
+ using year = std::chrono::year;
+ using month = std::chrono::month;
+ using year_month_weekday_last = std::chrono::year_month_weekday_last;
+ using sys_days = std::chrono::sys_days;
+ using days = std::chrono::days;
+ using weekday = std::chrono::weekday;
+ using weekday_last = std::chrono::weekday_last;
+
+ ASSERT_NOEXCEPT( static_cast<sys_days>(std::declval<const year_month_weekday_last>()));
+ ASSERT_SAME_TYPE(sys_days, decltype(static_cast<sys_days>(std::declval<const year_month_weekday_last>())));
+
+ constexpr month January = std::chrono::January;
+ constexpr weekday Tuesday = std::chrono::Tuesday;
+
+ { // Last Tuesday in Jan 1970 was the 27th
+ constexpr year_month_weekday_last ymwdl{year{1970}, January, weekday_last{Tuesday}};
+ constexpr sys_days sd{ymwdl};
+
+ static_assert(sd.time_since_epoch() == days{26}, "");
+ }
+
+ { // Last Tuesday in Jan 2000 was the 25th
+ constexpr year_month_weekday_last ymwdl{year{2000}, January, weekday_last{Tuesday}};
+ constexpr sys_days sd{ymwdl};
+
+ static_assert(sd.time_since_epoch() == days{10957+24}, "");
+ }
+
+ { // Last Tuesday in Jan 1940 was the 30th
+ constexpr year_month_weekday_last ymwdl{year{1940}, January, weekday_last{Tuesday}};
+ constexpr sys_days sd{ymwdl};
+
+ static_assert(sd.time_since_epoch() == days{-10958+29}, "");
+ }
+
+ { // Last Tuesday in Nov 1939 was the 28th
+ year_month_weekday_last ymdl{year{1939}, std::chrono::November, weekday_last{Tuesday}};
+ sys_days sd{ymdl};
+
+ assert(sd.time_since_epoch() == days{-(10957+35)});
+ }
+}
diff --git a/test/std/utilities/time/time.cal/time.cal.ymwdlast/time.cal.ymwdlast.members/plus_minus_equal_month.pass.cpp b/test/std/utilities/time/time.cal/time.cal.ymwdlast/time.cal.ymwdlast.members/plus_minus_equal_month.pass.cpp
new file mode 100644
index 0000000000000..d416f6b2b34e5
--- /dev/null
+++ b/test/std/utilities/time/time.cal/time.cal.ymwdlast/time.cal.ymwdlast.members/plus_minus_equal_month.pass.cpp
@@ -0,0 +1,75 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
+
+// <chrono>
+// class year_month_weekday_last;
+
+// constexpr year_month_weekday_last& operator+=(const months& m) noexcept;
+// constexpr year_month_weekday_last& operator-=(const months& m) noexcept;
+
+#include <chrono>
+#include <type_traits>
+#include <cassert>
+
+#include "test_macros.h"
+
+template <typename D, typename Ds>
+constexpr bool testConstexpr(D d1)
+{
+ if (static_cast<unsigned>((d1 ).month()) != 1) return false;
+ if (static_cast<unsigned>((d1 += Ds{ 1}).month()) != 2) return false;
+ if (static_cast<unsigned>((d1 += Ds{ 2}).month()) != 4) return false;
+ if (static_cast<unsigned>((d1 += Ds{12}).month()) != 4) return false;
+ if (static_cast<unsigned>((d1 -= Ds{ 1}).month()) != 3) return false;
+ if (static_cast<unsigned>((d1 -= Ds{ 2}).month()) != 1) return false;
+ if (static_cast<unsigned>((d1 -= Ds{12}).month()) != 1) return false;
+ return true;
+}
+
+int main()
+{
+ using year = std::chrono::year;
+ using month = std::chrono::month;
+ using weekday = std::chrono::weekday;
+ using weekday_last = std::chrono::weekday_last;
+ using year_month_weekday_last = std::chrono::year_month_weekday_last;
+ using months = std::chrono::months;
+
+ ASSERT_NOEXCEPT(std::declval<year_month_weekday_last&>() += std::declval<months>());
+ ASSERT_NOEXCEPT(std::declval<year_month_weekday_last&>() -= std::declval<months>());
+
+ ASSERT_SAME_TYPE(year_month_weekday_last&, decltype(std::declval<year_month_weekday_last&>() += std::declval<months>()));
+ ASSERT_SAME_TYPE(year_month_weekday_last&, decltype(std::declval<year_month_weekday_last&>() -= std::declval<months>()));
+
+ constexpr weekday Tuesday = std::chrono::Tuesday;
+ static_assert(testConstexpr<year_month_weekday_last, months>(year_month_weekday_last{year{1234}, month{1}, weekday_last{Tuesday}}), "");
+
+ for (unsigned i = 0; i <= 10; ++i)
+ {
+ year y{1234};
+ year_month_weekday_last ymwd(y, month{i}, weekday_last{Tuesday});
+
+ assert(static_cast<unsigned>((ymwd += months{2}).month()) == i + 2);
+ assert(ymwd.year() == y);
+ assert(ymwd.weekday() == Tuesday);
+
+ assert(static_cast<unsigned>((ymwd ).month()) == i + 2);
+ assert(ymwd.year() == y);
+ assert(ymwd.weekday() == Tuesday);
+
+ assert(static_cast<unsigned>((ymwd -= months{1}).month()) == i + 1);
+ assert(ymwd.year() == y);
+ assert(ymwd.weekday() == Tuesday);
+
+ assert(static_cast<unsigned>((ymwd ).month()) == i + 1);
+ assert(ymwd.year() == y);
+ assert(ymwd.weekday() == Tuesday);
+ }
+}
diff --git a/test/std/utilities/time/time.cal/time.cal.ymwdlast/time.cal.ymwdlast.members/plus_minus_equal_year.pass.cpp b/test/std/utilities/time/time.cal/time.cal.ymwdlast/time.cal.ymwdlast.members/plus_minus_equal_year.pass.cpp
new file mode 100644
index 0000000000000..8793c659ad3e5
--- /dev/null
+++ b/test/std/utilities/time/time.cal/time.cal.ymwdlast/time.cal.ymwdlast.members/plus_minus_equal_year.pass.cpp
@@ -0,0 +1,76 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
+
+// <chrono>
+// class year_month_weekday_last;
+
+// constexpr year_month_weekday_last& operator+=(const years& d) noexcept;
+// constexpr year_month_weekday_last& operator-=(const years& d) noexcept;
+
+#include <chrono>
+#include <type_traits>
+#include <cassert>
+
+#include "test_macros.h"
+
+template <typename D, typename Ds>
+constexpr bool testConstexpr(D d1)
+{
+ if (static_cast<int>((d1 ).year()) != 1) return false;
+ if (static_cast<int>((d1 += Ds{ 1}).year()) != 2) return false;
+ if (static_cast<int>((d1 += Ds{ 2}).year()) != 4) return false;
+ if (static_cast<int>((d1 += Ds{12}).year()) != 16) return false;
+ if (static_cast<int>((d1 -= Ds{ 1}).year()) != 15) return false;
+ if (static_cast<int>((d1 -= Ds{ 2}).year()) != 13) return false;
+ if (static_cast<int>((d1 -= Ds{12}).year()) != 1) return false;
+ return true;
+}
+
+int main()
+{
+ using year = std::chrono::year;
+ using month = std::chrono::month;
+ using weekday = std::chrono::weekday;
+ using weekday_last = std::chrono::weekday_last;
+ using year_month_weekday_last = std::chrono::year_month_weekday_last;
+ using years = std::chrono::years;
+
+ ASSERT_NOEXCEPT(std::declval<year_month_weekday_last&>() += std::declval<years>());
+ ASSERT_NOEXCEPT(std::declval<year_month_weekday_last&>() -= std::declval<years>());
+
+ ASSERT_SAME_TYPE(year_month_weekday_last&, decltype(std::declval<year_month_weekday_last&>() += std::declval<years>()));
+ ASSERT_SAME_TYPE(year_month_weekday_last&, decltype(std::declval<year_month_weekday_last&>() -= std::declval<years>()));
+
+ constexpr weekday Tuesday = std::chrono::Tuesday;
+ constexpr month January = std::chrono::January;
+
+ static_assert(testConstexpr<year_month_weekday_last, years>(year_month_weekday_last{year{1}, January, weekday_last{Tuesday}}), "");
+
+ for (int i = 1000; i <= 1010; ++i)
+ {
+ year_month_weekday_last ymwd(year{i}, January, weekday_last{Tuesday});
+
+ assert(static_cast<int>((ymwd += years{2}).year()) == i + 2);
+ assert(ymwd.month() == January);
+ assert(ymwd.weekday() == Tuesday);
+
+ assert(static_cast<int>((ymwd ).year()) == i + 2);
+ assert(ymwd.month() == January);
+ assert(ymwd.weekday() == Tuesday);
+
+ assert(static_cast<int>((ymwd -= years{1}).year()) == i + 1);
+ assert(ymwd.month() == January);
+ assert(ymwd.weekday() == Tuesday);
+
+ assert(static_cast<int>((ymwd ).year()) == i + 1);
+ assert(ymwd.month() == January);
+ assert(ymwd.weekday() == Tuesday);
+ }
+}
diff --git a/test/std/utilities/time/time.cal/time.cal.ymwdlast/time.cal.ymwdlast.members/weekday.pass.cpp b/test/std/utilities/time/time.cal/time.cal.ymwdlast/time.cal.ymwdlast.members/weekday.pass.cpp
new file mode 100644
index 0000000000000..83640302fa34d
--- /dev/null
+++ b/test/std/utilities/time/time.cal/time.cal.ymwdlast/time.cal.ymwdlast.members/weekday.pass.cpp
@@ -0,0 +1,41 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
+
+// <chrono>
+// class year_month_weekday_last;
+
+// constexpr chrono::weekday weekday() const noexcept;
+// Returns: wdi_.weekday()
+
+#include <chrono>
+#include <type_traits>
+#include <cassert>
+
+#include "test_macros.h"
+
+int main()
+{
+ using year = std::chrono::year;
+ using month = std::chrono::month;
+ using weekday = std::chrono::weekday;
+ using weekday_last = std::chrono::weekday_last;
+ using year_month_weekday_last = std::chrono::year_month_weekday_last;
+
+ ASSERT_NOEXCEPT( std::declval<const year_month_weekday_last>().weekday());
+ ASSERT_SAME_TYPE(weekday, decltype(std::declval<const year_month_weekday_last>().weekday()));
+
+ static_assert( year_month_weekday_last{year{}, month{}, weekday_last{weekday{}}}.weekday() == weekday{}, "");
+
+ for (unsigned i = 1; i <= 50; ++i)
+ {
+ year_month_weekday_last ymwdl(year{1}, month{1}, weekday_last{weekday{i}});
+ assert(static_cast<unsigned>(ymwdl.weekday()) == i);
+ }
+}
diff --git a/test/std/utilities/time/time.cal/time.cal.ymwdlast/time.cal.ymwdlast.members/year.pass.cpp b/test/std/utilities/time/time.cal/time.cal.ymwdlast/time.cal.ymwdlast.members/year.pass.cpp
new file mode 100644
index 0000000000000..fb621afcdc026
--- /dev/null
+++ b/test/std/utilities/time/time.cal/time.cal.ymwdlast/time.cal.ymwdlast.members/year.pass.cpp
@@ -0,0 +1,41 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
+
+// <chrono>
+// class year_month_weekday_last;
+
+// constexpr chrono::year year() const noexcept;
+// Returns: d_
+
+#include <chrono>
+#include <type_traits>
+#include <cassert>
+
+#include "test_macros.h"
+
+int main()
+{
+ using year = std::chrono::year;
+ using month = std::chrono::month;
+ using weekday = std::chrono::weekday;
+ using weekday_last = std::chrono::weekday_last;
+ using year_month_weekday_last = std::chrono::year_month_weekday_last;
+
+ ASSERT_NOEXCEPT( std::declval<const year_month_weekday_last>().year());
+ ASSERT_SAME_TYPE(year, decltype(std::declval<const year_month_weekday_last>().year()));
+
+ static_assert( year_month_weekday_last{year{}, month{}, weekday_last{weekday{}}}.year() == year{}, "");
+
+ for (int i = 1; i <= 50; ++i)
+ {
+ year_month_weekday_last ymwdl(year{i}, month{1}, weekday_last{weekday{}});
+ assert(static_cast<int>(ymwdl.year()) == i);
+ }
+}
diff --git a/test/std/utilities/time/time.cal/time.cal.ymwdlast/time.cal.ymwdlast.nonmembers/comparisons.pass.cpp b/test/std/utilities/time/time.cal/time.cal.ymwdlast/time.cal.ymwdlast.nonmembers/comparisons.pass.cpp
new file mode 100644
index 0000000000000..6af54892a5b7b
--- /dev/null
+++ b/test/std/utilities/time/time.cal/time.cal.ymwdlast/time.cal.ymwdlast.nonmembers/comparisons.pass.cpp
@@ -0,0 +1,114 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
+
+// <chrono>
+// class year_month_weekday_last;
+
+// constexpr bool operator==(const year_month_weekday_last& x, const year_month_weekday_last& y) noexcept;
+// Returns: x.year() == y.year() && x.month() == y.month() && x.weekday_last() == y.weekday_last()
+//
+
+
+#include <chrono>
+#include <type_traits>
+#include <cassert>
+
+#include "test_macros.h"
+#include "test_comparisons.h"
+
+int main()
+{
+ using year = std::chrono::year;
+ using month = std::chrono::month;
+ using weekday = std::chrono::weekday;
+ using weekday_last = std::chrono::weekday_last;
+ using year_month_weekday_last = std::chrono::year_month_weekday_last;
+
+ AssertComparisons2AreNoexcept<year_month_weekday_last>();
+ AssertComparisons2ReturnBool<year_month_weekday_last>();
+
+ constexpr month January = std::chrono::January;
+ constexpr month February = std::chrono::February;
+ constexpr weekday Tuesday = std::chrono::Tuesday;
+ constexpr weekday Wednesday = std::chrono::Wednesday;
+
+ static_assert( testComparisons2(
+ year_month_weekday_last{year{1234}, January, weekday_last{Tuesday}},
+ year_month_weekday_last{year{1234}, January, weekday_last{Tuesday}},
+ true), "");
+
+// different day
+ static_assert( testComparisons2(
+ year_month_weekday_last{year{1234}, January, weekday_last{Tuesday}},
+ year_month_weekday_last{year{1234}, January, weekday_last{Wednesday}},
+ false), "");
+
+// different month
+ static_assert( testComparisons2(
+ year_month_weekday_last{year{1234}, January, weekday_last{Tuesday}},
+ year_month_weekday_last{year{1234}, February, weekday_last{Tuesday}},
+ false), "");
+
+// different year
+ static_assert( testComparisons2(
+ year_month_weekday_last{year{1234}, January, weekday_last{Tuesday}},
+ year_month_weekday_last{year{1235}, January, weekday_last{Tuesday}},
+ false), "");
+
+
+// different month and day
+ static_assert( testComparisons2(
+ year_month_weekday_last{year{1234}, January, weekday_last{Tuesday}},
+ year_month_weekday_last{year{1234}, February, weekday_last{Wednesday}},
+ false), "");
+
+// different year and month
+ static_assert( testComparisons2(
+ year_month_weekday_last{year{1234}, February, weekday_last{Tuesday}},
+ year_month_weekday_last{year{1235}, January, weekday_last{Tuesday}},
+ false), "");
+
+// different year and day
+ static_assert( testComparisons2(
+ year_month_weekday_last{year{1234}, January, weekday_last{Wednesday}},
+ year_month_weekday_last{year{1235}, January, weekday_last{Tuesday}},
+ false), "");
+
+// different year, month and day
+ static_assert( testComparisons2(
+ year_month_weekday_last{year{1234}, February, weekday_last{Wednesday}},
+ year_month_weekday_last{year{1235}, January, weekday_last{Tuesday}},
+ false), "");
+
+
+// same year, different days
+ for (unsigned i = 1; i < 28; ++i)
+ for (unsigned j = 1; j < 28; ++j)
+ assert((testComparisons2(
+ year_month_weekday_last{year{1234}, January, weekday_last{weekday{i}}},
+ year_month_weekday_last{year{1234}, January, weekday_last{weekday{j}}},
+ i == j)));
+
+// same year, different months
+ for (unsigned i = 1; i < 12; ++i)
+ for (unsigned j = 1; j < 12; ++j)
+ assert((testComparisons2(
+ year_month_weekday_last{year{1234}, month{i}, weekday_last{Tuesday}},
+ year_month_weekday_last{year{1234}, month{j}, weekday_last{Tuesday}},
+ i == j)));
+
+// same month, different years
+ for (int i = 1000; i < 20; ++i)
+ for (int j = 1000; j < 20; ++j)
+ assert((testComparisons2(
+ year_month_weekday_last{year{i}, January, weekday_last{Tuesday}},
+ year_month_weekday_last{year{j}, January, weekday_last{Tuesday}},
+ i == j)));
+}
diff --git a/test/std/utilities/time/time.cal/time.cal.ymwdlast/time.cal.ymwdlast.nonmembers/minus.pass.cpp b/test/std/utilities/time/time.cal/time.cal.ymwdlast/time.cal.ymwdlast.nonmembers/minus.pass.cpp
new file mode 100644
index 0000000000000..c0ca34e83fcc1
--- /dev/null
+++ b/test/std/utilities/time/time.cal/time.cal.ymwdlast/time.cal.ymwdlast.nonmembers/minus.pass.cpp
@@ -0,0 +1,93 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
+
+// <chrono>
+// class year_month_weekday_last;
+
+// constexpr year_month_weekday_last operator-(const year_month_weekday_last& ymwdl, const months& dm) noexcept;
+// Returns: ymwdl + (-dm).
+//
+// constexpr year_month_weekday_last operator-(const year_month_weekday_last& ymwdl, const years& dy) noexcept;
+// Returns: ymwdl + (-dy).
+
+#include <chrono>
+#include <type_traits>
+#include <cassert>
+
+#include "test_macros.h"
+
+#include <iostream>
+
+constexpr bool testConstexprYears(std::chrono::year_month_weekday_last ym)
+{
+ std::chrono::years offset{14};
+ if (static_cast<int>((ym ).year()) != 66) return false;
+ if (static_cast<int>((ym - offset).year()) != 52) return false;
+ return true;
+}
+
+constexpr bool testConstexprMonths(std::chrono::year_month_weekday_last ym)
+{
+ std::chrono::months offset{6};
+ if (static_cast<unsigned>((ym ).month()) != 10) return false;
+ if (static_cast<unsigned>((ym - offset).month()) != 4) return false;
+ return true;
+}
+
+int main()
+{
+ using year = std::chrono::year;
+ using month = std::chrono::month;
+ using weekday = std::chrono::weekday;
+ using weekday_last = std::chrono::weekday_last;
+ using year_month_weekday_last = std::chrono::year_month_weekday_last;
+ using years = std::chrono::years;
+ using months = std::chrono::months;
+
+ constexpr month October = std::chrono::October;
+ constexpr weekday Tuesday = std::chrono::Tuesday;
+
+ { // year_month_weekday_last - years
+
+ ASSERT_NOEXCEPT( std::declval<year_month_weekday_last>() - std::declval<years>());
+ ASSERT_SAME_TYPE(year_month_weekday_last, decltype(std::declval<year_month_weekday_last>() - std::declval<years>()));
+
+ static_assert(testConstexprYears(year_month_weekday_last{year{66}, October, weekday_last{Tuesday}}), "");
+
+ year_month_weekday_last ym{year{1234}, October, weekday_last{Tuesday}};
+ for (int i = 0; i <= 10; ++i)
+ {
+ year_month_weekday_last ym1 = ym - years{i};
+ assert(ym1.year() == year{1234 - i});
+ assert(ym1.month() == October);
+ assert(ym1.weekday() == Tuesday);
+ assert(ym1.weekday_last() == weekday_last{Tuesday});
+ }
+ }
+
+ { // year_month_weekday_last - months
+
+ ASSERT_NOEXCEPT( std::declval<year_month_weekday_last>() - std::declval<months>());
+ ASSERT_SAME_TYPE(year_month_weekday_last, decltype(std::declval<year_month_weekday_last>() - std::declval<months>()));
+
+ static_assert(testConstexprMonths(year_month_weekday_last{year{66}, October, weekday_last{Tuesday}}), "");
+
+ year_month_weekday_last ym{year{1234}, October, weekday_last{Tuesday}};
+ for (unsigned i = 0; i < 10; ++i)
+ {
+ year_month_weekday_last ym1 = ym - months{i};
+ assert(ym1.year() == year{1234});
+ assert(ym1.month() == month{10 - i});
+ assert(ym1.weekday() == Tuesday);
+ assert(ym1.weekday_last() == weekday_last{Tuesday});
+ }
+ }
+
+}
diff --git a/test/std/utilities/time/time.cal/time.cal.ymwdlast/time.cal.ymwdlast.nonmembers/plus.pass.cpp b/test/std/utilities/time/time.cal/time.cal.ymwdlast/time.cal.ymwdlast.nonmembers/plus.pass.cpp
new file mode 100644
index 0000000000000..9f8eb9dc0309c
--- /dev/null
+++ b/test/std/utilities/time/time.cal/time.cal.ymwdlast/time.cal.ymwdlast.nonmembers/plus.pass.cpp
@@ -0,0 +1,116 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
+
+// <chrono>
+// class year_month_weekday_last;
+
+// constexpr year_month_weekday_last operator+(const year_month_weekday_last& ymwdl, const months& dm) noexcept;
+// Returns: (ymwdl.year() / ymwdl.month() + dm) / ymwdl.weekday_last().
+//
+// constexpr year_month_weekday_last operator+(const months& dm, const year_month_weekday_last& ymwdl) noexcept;
+// Returns: ymwdl + dm.
+//
+// constexpr year_month_weekday_last operator+(const year_month_weekday_last& ymwdl, const years& dy) noexcept;
+// Returns: {ymwdl.year()+dy, ymwdl.month(), ymwdl.weekday_last()}.
+//
+// constexpr year_month_weekday_last operator+(const years& dy, const year_month_weekday_last& ymwdl) noexcept;
+// Returns: ymwdl + dy.
+
+#include <chrono>
+#include <type_traits>
+#include <cassert>
+
+#include "test_macros.h"
+
+constexpr bool testConstexprYears(std::chrono::year_month_weekday_last ym)
+{
+ std::chrono::years offset{23};
+ if (static_cast<int>((ym ).year()) != 1) return false;
+ if (static_cast<int>((ym + offset).year()) != 24) return false;
+ if (static_cast<int>((offset + ym).year()) != 24) return false;
+ return true;
+}
+
+constexpr bool testConstexprMonths(std::chrono::year_month_weekday_last ym)
+{
+ std::chrono::months offset{6};
+ if (static_cast<unsigned>((ym ).month()) != 1) return false;
+ if (static_cast<unsigned>((ym + offset).month()) != 7) return false;
+ if (static_cast<unsigned>((offset + ym).month()) != 7) return false;
+ return true;
+}
+
+
+int main()
+{
+ using year = std::chrono::year;
+ using month = std::chrono::month;
+ using weekday = std::chrono::weekday;
+ using weekday_last = std::chrono::weekday_last;
+ using year_month_weekday_last = std::chrono::year_month_weekday_last;
+ using years = std::chrono::years;
+ using months = std::chrono::months;
+
+ constexpr weekday Tuesday = std::chrono::Tuesday;
+ constexpr month January = std::chrono::January;
+
+ { // year_month_weekday_last + months
+ ASSERT_NOEXCEPT(std::declval<year_month_weekday_last>() + std::declval<months>());
+ ASSERT_NOEXCEPT(std::declval<months>() + std::declval<year_month_weekday_last>());
+
+ ASSERT_SAME_TYPE(year_month_weekday_last, decltype(std::declval<year_month_weekday_last>() + std::declval<months>()));
+ ASSERT_SAME_TYPE(year_month_weekday_last, decltype(std::declval<months>() + std::declval<year_month_weekday_last>()));
+
+ static_assert(testConstexprMonths(year_month_weekday_last{year{1}, January, weekday_last{Tuesday}}), "");
+
+ year_month_weekday_last ym{year{1234}, January, weekday_last{Tuesday}};
+ for (int i = 0; i <= 10; ++i) // TODO test wrap-around
+ {
+ year_month_weekday_last ym1 = ym + months{i};
+ year_month_weekday_last ym2 = months{i} + ym;
+ assert(ym1.year() == year(1234));
+ assert(ym2.year() == year(1234));
+ assert(ym1.month() == month(1 + i));
+ assert(ym2.month() == month(1 + i));
+ assert(ym1.weekday() == Tuesday);
+ assert(ym2.weekday() == Tuesday);
+ assert(ym1.weekday_last() == weekday_last{Tuesday});
+ assert(ym2.weekday_last() == weekday_last{Tuesday});
+ assert(ym1 == ym2);
+ }
+ }
+
+ { // year_month_weekday_last + years
+ ASSERT_NOEXCEPT(std::declval<year_month_weekday_last>() + std::declval<years>());
+ ASSERT_NOEXCEPT(std::declval<years>() + std::declval<year_month_weekday_last>());
+
+ ASSERT_SAME_TYPE(year_month_weekday_last, decltype(std::declval<year_month_weekday_last>() + std::declval<years>()));
+ ASSERT_SAME_TYPE(year_month_weekday_last, decltype(std::declval<years>() + std::declval<year_month_weekday_last>()));
+
+ static_assert(testConstexprYears (year_month_weekday_last{year{1}, January, weekday_last{Tuesday}}), "");
+
+ year_month_weekday_last ym{year{1234}, std::chrono::January, weekday_last{Tuesday}};
+ for (int i = 0; i <= 10; ++i)
+ {
+ year_month_weekday_last ym1 = ym + years{i};
+ year_month_weekday_last ym2 = years{i} + ym;
+ assert(ym1.year() == year(1234 + i));
+ assert(ym2.year() == year(1234 + i));
+ assert(ym1.month() == January);
+ assert(ym2.month() == January);
+ assert(ym1.weekday() == Tuesday);
+ assert(ym2.weekday() == Tuesday);
+ assert(ym1.weekday_last() == weekday_last{Tuesday});
+ assert(ym2.weekday_last() == weekday_last{Tuesday});
+ assert(ym1 == ym2);
+ }
+ }
+
+}
diff --git a/test/std/utilities/time/time.cal/time.cal.ymwdlast/time.cal.ymwdlast.nonmembers/streaming.pass.cpp b/test/std/utilities/time/time.cal/time.cal.ymwdlast/time.cal.ymwdlast.nonmembers/streaming.pass.cpp
new file mode 100644
index 0000000000000..46b6ebaed0f3d
--- /dev/null
+++ b/test/std/utilities/time/time.cal/time.cal.ymwdlast/time.cal.ymwdlast.nonmembers/streaming.pass.cpp
@@ -0,0 +1,38 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
+// XFAIL: *
+
+// <chrono>
+// class year_month_weekday_last;
+
+// template<class charT, class traits>
+// basic_ostream<charT, traits>&
+// operator<<(basic_ostream<charT, traits>& os, const year_month_weekday_last& ymwdl);
+//
+// Returns: os << ymwdl.year() << '/' << ymwdl.month() << '/' << ymwdl.weekday_last().
+
+
+#include <chrono>
+#include <type_traits>
+#include <cassert>
+#include <iostream>
+
+#include "test_macros.h"
+
+int main()
+{
+ using year_month_weekday_last = std::chrono::year_month_weekday_last;
+ using year = std::chrono::year;
+ using month = std::chrono::month;
+ using weekday = std::chrono::weekday;
+ using weekday_last = std::chrono::weekday_last;
+
+ std::cout << year_month_weekday_last{year{2018}, month{3}, weekday_last{weekday{4}}};
+}
diff --git a/test/std/utilities/time/time.cal/time.cal.ymwdlast/types.pass.cpp b/test/std/utilities/time/time.cal/time.cal.ymwdlast/types.pass.cpp
new file mode 100644
index 0000000000000..a7f3f024ebfee
--- /dev/null
+++ b/test/std/utilities/time/time.cal/time.cal.ymwdlast/types.pass.cpp
@@ -0,0 +1,26 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
+
+// <chrono>
+// class year_month_weekday_last_last;
+
+#include <chrono>
+#include <type_traits>
+#include <cassert>
+
+#include "test_macros.h"
+
+int main()
+{
+ using year_month_weekday_last = std::chrono::year_month_weekday_last;
+
+ static_assert(std::is_trivially_copyable_v<year_month_weekday_last>, "");
+ static_assert(std::is_standard_layout_v<year_month_weekday_last>, "");
+}
diff --git a/test/std/utilities/time/time.clock/time.clock.file/consistency.pass.cpp b/test/std/utilities/time/time.clock/time.clock.file/consistency.pass.cpp
new file mode 100644
index 0000000000000..0b5757f672a05
--- /dev/null
+++ b/test/std/utilities/time/time.clock/time.clock.file/consistency.pass.cpp
@@ -0,0 +1,35 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+//
+// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
+//
+// TODO: Remove this when filesystem gets integrated into the dylib
+// REQUIRES: c++filesystem
+
+// <chrono>
+
+// file_clock
+
+// check clock invariants
+
+#include <chrono>
+
+template <class T>
+void test(const T &) {}
+
+int main()
+{
+ typedef std::chrono::file_clock C;
+ static_assert((std::is_same<C::rep, C::duration::rep>::value), "");
+ static_assert((std::is_same<C::period, C::duration::period>::value), "");
+ static_assert((std::is_same<C::duration, C::time_point::duration>::value), "");
+ static_assert((std::is_same<C::time_point::clock, C>::value), "");
+ static_assert(!C::is_steady, "");
+ test(std::chrono::file_clock::is_steady);
+}
diff --git a/test/std/utilities/time/time.clock/time.clock.file/file_time.pass.cpp b/test/std/utilities/time/time.clock/time.clock.file/file_time.pass.cpp
new file mode 100644
index 0000000000000..955e3ebe9d5b0
--- /dev/null
+++ b/test/std/utilities/time/time.clock/time.clock.file/file_time.pass.cpp
@@ -0,0 +1,29 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
+
+// <chrono>
+
+// file_time
+
+#include <chrono>
+
+#include "test_macros.h"
+
+template <class Dur>
+void test() {
+ ASSERT_SAME_TYPE(std::chrono::file_time<Dur>, std::chrono::time_point<std::chrono::file_clock, Dur>);
+}
+
+int main() {
+ test<std::chrono::nanoseconds>();
+ test<std::chrono::minutes>();
+ test<std::chrono::hours>();
+} \ No newline at end of file
diff --git a/test/std/utilities/time/time.clock/time.clock.file/now.pass.cpp b/test/std/utilities/time/time.clock/time.clock.file/now.pass.cpp
new file mode 100644
index 0000000000000..69dfa9180933b
--- /dev/null
+++ b/test/std/utilities/time/time.clock/time.clock.file/now.pass.cpp
@@ -0,0 +1,35 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
+
+// TODO: Remove this when filesystem gets integrated into the dylib
+// REQUIRES: c++filesystem
+
+// <chrono>
+
+// file_clock
+
+// static time_point now() noexcept;
+
+#include <chrono>
+#include <cassert>
+
+#include "test_macros.h"
+
+int main()
+{
+ typedef std::chrono::file_clock C;
+ ASSERT_NOEXCEPT(C::now());
+
+ C::time_point t1 = C::now();
+ assert(t1.time_since_epoch().count() != 0);
+ assert(C::time_point::min() < t1);
+ assert(C::time_point::max() > t1);
+}
diff --git a/test/std/utilities/time/time.clock/time.clock.file/rep_signed.pass.cpp b/test/std/utilities/time/time.clock/time.clock.file/rep_signed.pass.cpp
new file mode 100644
index 0000000000000..c0fa0b5bedaec
--- /dev/null
+++ b/test/std/utilities/time/time.clock/time.clock.file/rep_signed.pass.cpp
@@ -0,0 +1,29 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
+
+// TODO: Remove this when filesystem gets integrated into the dylib
+// REQUIRES: c++filesystem
+
+// <chrono>
+
+// file_clock
+
+// rep should be signed
+
+#include <chrono>
+#include <cassert>
+
+int main()
+{
+ static_assert(std::is_signed<std::chrono::file_clock::rep>::value, "");
+ assert(std::chrono::file_clock::duration::min() <
+ std::chrono::file_clock::duration::zero());
+}
diff --git a/test/std/utilities/time/time.clock/time.clock.hires/consistency.pass.cpp b/test/std/utilities/time/time.clock/time.clock.hires/consistency.pass.cpp
index 2f8a707bfa2fe..47a610f00317b 100644
--- a/test/std/utilities/time/time.clock/time.clock.hires/consistency.pass.cpp
+++ b/test/std/utilities/time/time.clock/time.clock.hires/consistency.pass.cpp
@@ -12,9 +12,10 @@
// UNSUPPORTED: asan
// Starting with C++17, Clock::is_steady is inlined (but not before LLVM-3.9!),
-// but before C++17 it requires the symbol to be present in the dylib.
-// XFAIL: availability=macosx10.7 && (c++98 || c++03 || c++11 || c++14 || apple-clang-7 || apple-clang-8.0)
-// XFAIL: availability=macosx10.8 && (c++98 || c++03 || c++11 || c++14 || apple-clang-7 || apple-clang-8.0)
+// but before C++17 it requires the symbol to be present in the dylib, which
+// is only shipped starting with macosx10.9.
+// XFAIL: with_system_cxx_lib=macosx10.7 && (c++98 || c++03 || c++11 || c++14 || apple-clang-7 || apple-clang-8.0)
+// XFAIL: with_system_cxx_lib=macosx10.8 && (c++98 || c++03 || c++11 || c++14 || apple-clang-7 || apple-clang-8.0)
// <chrono>
diff --git a/test/std/utilities/time/time.clock/time.clock.steady/consistency.pass.cpp b/test/std/utilities/time/time.clock/time.clock.steady/consistency.pass.cpp
index 4458d6f213fa9..e5e6de2605f5b 100644
--- a/test/std/utilities/time/time.clock/time.clock.steady/consistency.pass.cpp
+++ b/test/std/utilities/time/time.clock/time.clock.steady/consistency.pass.cpp
@@ -14,9 +14,10 @@
// UNSUPPORTED: asan
// Starting with C++17, Clock::is_steady is inlined (but not before LLVM-3.9!),
-// but before C++17 it requires the symbol to be present in the dylib.
-// XFAIL: availability=macosx10.7 && (c++98 || c++03 || c++11 || c++14 || apple-clang-7 || apple-clang-8.0)
-// XFAIL: availability=macosx10.8 && (c++98 || c++03 || c++11 || c++14 || apple-clang-7 || apple-clang-8.0)
+// but before C++17 it requires the symbol to be present in the dylib, which
+// is only shipped starting with macosx10.9.
+// XFAIL: with_system_cxx_lib=macosx10.7 && (c++98 || c++03 || c++11 || c++14 || apple-clang-7 || apple-clang-8.0)
+// XFAIL: with_system_cxx_lib=macosx10.8 && (c++98 || c++03 || c++11 || c++14 || apple-clang-7 || apple-clang-8.0)
// <chrono>
diff --git a/test/std/utilities/time/time.clock/time.clock.system/consistency.pass.cpp b/test/std/utilities/time/time.clock/time.clock.system/consistency.pass.cpp
index deb4615fa5a1e..c5ecb32275e3c 100644
--- a/test/std/utilities/time/time.clock/time.clock.system/consistency.pass.cpp
+++ b/test/std/utilities/time/time.clock/time.clock.system/consistency.pass.cpp
@@ -12,9 +12,10 @@
// UNSUPPORTED: asan
// Starting with C++17, Clock::is_steady is inlined (but not before LLVM-3.9!),
-// but before C++17 it requires the symbol to be present in the dylib.
-// XFAIL: availability=macosx10.7 && (c++98 || c++03 || c++11 || c++14 || apple-clang-7 || apple-clang-8.0)
-// XFAIL: availability=macosx10.8 && (c++98 || c++03 || c++11 || c++14 || apple-clang-7 || apple-clang-8.0)
+// but before C++17 it requires the symbol to be present in the dylib, which
+// is only shipped starting with macosx10.9.
+// XFAIL: with_system_cxx_lib=macosx10.7 && (c++98 || c++03 || c++11 || c++14 || apple-clang-7 || apple-clang-8.0)
+// XFAIL: with_system_cxx_lib=macosx10.8 && (c++98 || c++03 || c++11 || c++14 || apple-clang-7 || apple-clang-8.0)
// <chrono>
diff --git a/test/std/utilities/time/time.clock/time.clock.system/local_time.types.pass.cpp b/test/std/utilities/time/time.clock/time.clock.system/local_time.types.pass.cpp
new file mode 100644
index 0000000000000..9f91ca744b733
--- /dev/null
+++ b/test/std/utilities/time/time.clock/time.clock.system/local_time.types.pass.cpp
@@ -0,0 +1,65 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
+
+// <chrono>
+
+// struct local_t {};
+// template<class Duration>
+// using local_time = time_point<system_clock, Duration>;
+// using local_seconds = sys_time<seconds>;
+// using local_days = sys_time<days>;
+
+// [Example:
+// sys_seconds{sys_days{1970y/January/1}}.time_since_epoch() is 0s.
+// sys_seconds{sys_days{2000y/January/1}}.time_since_epoch() is 946’684’800s, which is 10’957 * 86’400s.
+// —end example]
+
+
+#include <chrono>
+#include <cassert>
+
+#include "test_macros.h"
+
+int main()
+{
+ using local_t = std::chrono::local_t;
+ using year = std::chrono::year;
+
+ using seconds = std::chrono::seconds;
+ using minutes = std::chrono::minutes;
+ using days = std::chrono::days;
+
+ using local_seconds = std::chrono::local_seconds;
+ using local_minutes = std::chrono::local_time<minutes>;
+ using local_days = std::chrono::local_days;
+
+ constexpr std::chrono::month January = std::chrono::January;
+
+ ASSERT_SAME_TYPE(std::chrono::local_time<seconds>, local_seconds);
+ ASSERT_SAME_TYPE(std::chrono::local_time<days>, local_days);
+
+// Test the long form, too
+ ASSERT_SAME_TYPE(std::chrono::time_point<local_t, seconds>, local_seconds);
+ ASSERT_SAME_TYPE(std::chrono::time_point<local_t, minutes>, local_minutes);
+ ASSERT_SAME_TYPE(std::chrono::time_point<local_t, days>, local_days);
+
+// Test some well known values
+ local_days d0 = local_days{year{1970}/January/1};
+ local_days d1 = local_days{year{2000}/January/1};
+ ASSERT_SAME_TYPE(decltype(d0.time_since_epoch()), days);
+ assert( d0.time_since_epoch().count() == 0);
+ assert( d1.time_since_epoch().count() == 10957);
+
+ local_seconds s0{d0};
+ local_seconds s1{d1};
+ ASSERT_SAME_TYPE(decltype(s0.time_since_epoch()), seconds);
+ assert( s0.time_since_epoch().count() == 0);
+ assert( s1.time_since_epoch().count() == 946684800L);
+}
diff --git a/test/std/utilities/time/time.clock/time.clock.system/sys.time.types.pass.cpp b/test/std/utilities/time/time.clock/time.clock.system/sys.time.types.pass.cpp
new file mode 100644
index 0000000000000..299e06818138d
--- /dev/null
+++ b/test/std/utilities/time/time.clock/time.clock.system/sys.time.types.pass.cpp
@@ -0,0 +1,64 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
+
+// <chrono>
+
+// template<class Duration>
+// using sys_time = time_point<system_clock, Duration>;
+// using sys_seconds = sys_time<seconds>;
+// using sys_days = sys_time<days>;
+
+// [Example:
+// sys_seconds{sys_days{1970y/January/1}}.time_since_epoch() is 0s.
+// sys_seconds{sys_days{2000y/January/1}}.time_since_epoch() is 946’684’800s, which is 10’957 * 86’400s.
+// —end example]
+
+
+#include <chrono>
+#include <cassert>
+
+#include "test_macros.h"
+
+int main()
+{
+ using system_clock = std::chrono::system_clock;
+ using year = std::chrono::year;
+
+ using seconds = std::chrono::seconds;
+ using minutes = std::chrono::minutes;
+ using days = std::chrono::days;
+
+ using sys_seconds = std::chrono::sys_seconds;
+ using sys_minutes = std::chrono::sys_time<minutes>;
+ using sys_days = std::chrono::sys_days;
+
+ constexpr std::chrono::month January = std::chrono::January;
+
+ ASSERT_SAME_TYPE(std::chrono::sys_time<seconds>, sys_seconds);
+ ASSERT_SAME_TYPE(std::chrono::sys_time<days>, sys_days);
+
+// Test the long form, too
+ ASSERT_SAME_TYPE(std::chrono::time_point<system_clock, seconds>, sys_seconds);
+ ASSERT_SAME_TYPE(std::chrono::time_point<system_clock, minutes>, sys_minutes);
+ ASSERT_SAME_TYPE(std::chrono::time_point<system_clock, days>, sys_days);
+
+// Test some well known values
+ sys_days d0 = sys_days{year{1970}/January/1};
+ sys_days d1 = sys_days{year{2000}/January/1};
+ ASSERT_SAME_TYPE(decltype(d0.time_since_epoch()), days);
+ assert( d0.time_since_epoch().count() == 0);
+ assert( d1.time_since_epoch().count() == 10957);
+
+ sys_seconds s0{d0};
+ sys_seconds s1{d1};
+ ASSERT_SAME_TYPE(decltype(s0.time_since_epoch()), seconds);
+ assert( s0.time_since_epoch().count() == 0);
+ assert( s1.time_since_epoch().count() == 946684800L);
+}
diff --git a/test/std/utilities/time/time.duration/time.duration.literals/literals.pass.cpp b/test/std/utilities/time/time.duration/time.duration.literals/literals.pass.cpp
index d5c0207c0ee76..e10b35efbb9ce 100644
--- a/test/std/utilities/time/time.duration/time.duration.literals/literals.pass.cpp
+++ b/test/std/utilities/time/time.duration/time.duration.literals/literals.pass.cpp
@@ -14,6 +14,8 @@
#include <type_traits>
#include <cassert>
+#include "test_macros.h"
+
int main()
{
using namespace std::literals::chrono_literals;
@@ -55,4 +57,5 @@ int main()
assert ( ns == std::chrono::nanoseconds(645));
auto ns2 = 645.ns;
assert ( ns == ns2 );
+
}
diff --git a/test/std/utilities/time/time.duration/time.duration.literals/literals1.pass.cpp b/test/std/utilities/time/time.duration/time.duration.literals/literals1.pass.cpp
index 5e59e1153787d..6e43e3a9a2fad 100644
--- a/test/std/utilities/time/time.duration/time.duration.literals/literals1.pass.cpp
+++ b/test/std/utilities/time/time.duration/time.duration.literals/literals1.pass.cpp
@@ -7,8 +7,8 @@
// Source Licenses. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
-
// UNSUPPORTED: c++98, c++03, c++11
+
#include <chrono>
#include <cassert>
@@ -45,4 +45,27 @@ int main()
assert ( ns == nanoseconds(645));
auto ns2 = 645.ns;
assert ( ns == ns2 );
+
+#if TEST_STD_VER > 17
+ assert(Sunday == weekday(0));
+ assert(Monday == weekday(1));
+ assert(Tuesday == weekday(2));
+ assert(Wednesday == weekday(3));
+ assert(Thursday == weekday(4));
+ assert(Friday == weekday(5));
+ assert(Saturday == weekday(6));
+
+ assert(January == month(1));
+ assert(February == month(2));
+ assert(March == month(3));
+ assert(April == month(4));
+ assert(May == month(5));
+ assert(June == month(6));
+ assert(July == month(7));
+ assert(August == month(8));
+ assert(September == month(9));
+ assert(October == month(10));
+ assert(November == month(11));
+ assert(December == month(12));
+#endif
}
diff --git a/test/std/utilities/time/time.duration/time.duration.nonmember/op_divide_duration.pass.cpp b/test/std/utilities/time/time.duration/time.duration.nonmember/op_divide_duration.pass.cpp
index 561516b665114..4c4895b2a0bb4 100644
--- a/test/std/utilities/time/time.duration/time.duration.nonmember/op_divide_duration.pass.cpp
+++ b/test/std/utilities/time/time.duration/time.duration.nonmember/op_divide_duration.pass.cpp
@@ -20,6 +20,7 @@
#include <cassert>
#include "test_macros.h"
+#include "truncate_fp.h"
int main()
{
@@ -41,7 +42,7 @@ int main()
{
std::chrono::duration<int, std::ratio<2, 3> > s1(30);
std::chrono::duration<double, std::ratio<3, 5> > s2(5);
- assert(s1 / s2 == 20./3);
+ assert(s1 / s2 == truncate_fp(20./3));
}
#if TEST_STD_VER >= 11
{
diff --git a/test/std/utilities/time/time.duration/time.duration.special/max.pass.cpp b/test/std/utilities/time/time.duration/time.duration.special/max.pass.cpp
index 48c3e86e8101d..275f87760ad10 100644
--- a/test/std/utilities/time/time.duration/time.duration.special/max.pass.cpp
+++ b/test/std/utilities/time/time.duration/time.duration.special/max.pass.cpp
@@ -11,7 +11,7 @@
// duration
-// static constexpr duration max();
+// static constexpr duration max(); // noexcept after C++17
#include <chrono>
#include <limits>
@@ -23,6 +23,10 @@
template <class D>
void test()
{
+ LIBCPP_ASSERT_NOEXCEPT(std::chrono::duration_values<typename D::rep>::max());
+#if TEST_STD_VER > 17
+ ASSERT_NOEXCEPT( std::chrono::duration_values<typename D::rep>::max());
+#endif
{
typedef typename D::rep Rep;
Rep max_rep = std::chrono::duration_values<Rep>::max();
diff --git a/test/std/utilities/time/time.duration/time.duration.special/min.pass.cpp b/test/std/utilities/time/time.duration/time.duration.special/min.pass.cpp
index 0d94aaa5869c0..daf7165cf903e 100644
--- a/test/std/utilities/time/time.duration/time.duration.special/min.pass.cpp
+++ b/test/std/utilities/time/time.duration/time.duration.special/min.pass.cpp
@@ -11,7 +11,7 @@
// duration
-// static constexpr duration min();
+// static constexpr duration min(); // noexcept after C++17
#include <chrono>
#include <limits>
@@ -23,6 +23,10 @@
template <class D>
void test()
{
+ LIBCPP_ASSERT_NOEXCEPT(std::chrono::duration_values<typename D::rep>::min());
+#if TEST_STD_VER > 17
+ ASSERT_NOEXCEPT( std::chrono::duration_values<typename D::rep>::min());
+#endif
{
typedef typename D::rep Rep;
Rep min_rep = std::chrono::duration_values<Rep>::min();
diff --git a/test/std/utilities/time/time.duration/time.duration.special/zero.pass.cpp b/test/std/utilities/time/time.duration/time.duration.special/zero.pass.cpp
index 7b312c5acb50b..a43bb099fe604 100644
--- a/test/std/utilities/time/time.duration/time.duration.special/zero.pass.cpp
+++ b/test/std/utilities/time/time.duration/time.duration.special/zero.pass.cpp
@@ -11,7 +11,7 @@
// duration
-// static constexpr duration zero();
+// static constexpr duration zero(); // noexcept after C++17
#include <chrono>
#include <cassert>
@@ -22,6 +22,10 @@
template <class D>
void test()
{
+ LIBCPP_ASSERT_NOEXCEPT(std::chrono::duration_values<typename D::rep>::zero());
+#if TEST_STD_VER > 17
+ ASSERT_NOEXCEPT( std::chrono::duration_values<typename D::rep>::zero());
+#endif
{
typedef typename D::rep Rep;
Rep zero_rep = std::chrono::duration_values<Rep>::zero();
diff --git a/test/std/utilities/time/time.point/time.point.arithmetic/op_+=.pass.cpp b/test/std/utilities/time/time.point/time.point.arithmetic/op_+=.pass.cpp
index ffe855ce90311..d60f6276ae454 100644
--- a/test/std/utilities/time/time.point/time.point.arithmetic/op_+=.pass.cpp
+++ b/test/std/utilities/time/time.point/time.point.arithmetic/op_+=.pass.cpp
@@ -12,15 +12,35 @@
// time_point
// time_point& operator+=(const duration& d);
+// constexpr in c++17
#include <chrono>
#include <cassert>
+#include "test_macros.h"
+
+#if TEST_STD_VER > 14
+constexpr bool constexpr_test()
+{
+ typedef std::chrono::system_clock Clock;
+ typedef std::chrono::milliseconds Duration;
+ std::chrono::time_point<Clock, Duration> t(Duration(5));
+ t += Duration(4);
+ return t.time_since_epoch() == Duration(9);
+}
+#endif
+
int main()
{
+ {
typedef std::chrono::system_clock Clock;
typedef std::chrono::milliseconds Duration;
std::chrono::time_point<Clock, Duration> t(Duration(3));
t += Duration(2);
assert(t.time_since_epoch() == Duration(5));
+ }
+
+#if TEST_STD_VER > 14
+ static_assert(constexpr_test(), "");
+#endif
}
diff --git a/test/std/utilities/time/time.point/time.point.arithmetic/op_-=.pass.cpp b/test/std/utilities/time/time.point/time.point.arithmetic/op_-=.pass.cpp
index acad1cfecb448..9ef952559209a 100644
--- a/test/std/utilities/time/time.point/time.point.arithmetic/op_-=.pass.cpp
+++ b/test/std/utilities/time/time.point/time.point.arithmetic/op_-=.pass.cpp
@@ -12,15 +12,35 @@
// time_point
// time_point& operator-=(const duration& d);
+// constexpr in c++17
#include <chrono>
#include <cassert>
+#include "test_macros.h"
+
+#if TEST_STD_VER > 14
+constexpr bool constexpr_test()
+{
+ typedef std::chrono::system_clock Clock;
+ typedef std::chrono::milliseconds Duration;
+ std::chrono::time_point<Clock, Duration> t(Duration(5));
+ t -= Duration(4);
+ return t.time_since_epoch() == Duration(1);
+}
+#endif
+
int main()
{
+ {
typedef std::chrono::system_clock Clock;
typedef std::chrono::milliseconds Duration;
std::chrono::time_point<Clock, Duration> t(Duration(3));
t -= Duration(2);
assert(t.time_since_epoch() == Duration(1));
+ }
+
+#if TEST_STD_VER > 14
+ static_assert(constexpr_test(), "");
+#endif
}
diff --git a/test/std/utilities/time/time.point/time.point.special/max.pass.cpp b/test/std/utilities/time/time.point/time.point.special/max.pass.cpp
index 6bba6fc827876..85447ea414c30 100644
--- a/test/std/utilities/time/time.point/time.point.special/max.pass.cpp
+++ b/test/std/utilities/time/time.point/time.point.special/max.pass.cpp
@@ -11,15 +11,21 @@
// time_point
-// static constexpr time_point max();
+// static constexpr time_point max(); // noexcept after C++17
#include <chrono>
#include <cassert>
+#include "test_macros.h"
+
int main()
{
typedef std::chrono::system_clock Clock;
typedef std::chrono::milliseconds Duration;
typedef std::chrono::time_point<Clock, Duration> TP;
+ LIBCPP_ASSERT_NOEXCEPT(TP::max());
+#if TEST_STD_VER > 17
+ ASSERT_NOEXCEPT( TP::max());
+#endif
assert(TP::max() == TP(Duration::max()));
}
diff --git a/test/std/utilities/time/time.point/time.point.special/min.pass.cpp b/test/std/utilities/time/time.point/time.point.special/min.pass.cpp
index b1d955c252aaf..fab5b4aae22cd 100644
--- a/test/std/utilities/time/time.point/time.point.special/min.pass.cpp
+++ b/test/std/utilities/time/time.point/time.point.special/min.pass.cpp
@@ -11,15 +11,21 @@
// time_point
-// static constexpr time_point min();
+// static constexpr time_point min(); // noexcept after C++17
#include <chrono>
#include <cassert>
+#include "test_macros.h"
+
int main()
{
typedef std::chrono::system_clock Clock;
typedef std::chrono::milliseconds Duration;
typedef std::chrono::time_point<Clock, Duration> TP;
+ LIBCPP_ASSERT_NOEXCEPT(TP::max());
+#if TEST_STD_VER > 17
+ ASSERT_NOEXCEPT( TP::max());
+#endif
assert(TP::min() == TP(Duration::min()));
}
diff --git a/test/std/utilities/time/time.traits/time.traits.duration_values/max.pass.cpp b/test/std/utilities/time/time.traits/time.traits.duration_values/max.pass.cpp
index e3754c1f64758..bd4115437947f 100644
--- a/test/std/utilities/time/time.traits/time.traits.duration_values/max.pass.cpp
+++ b/test/std/utilities/time/time.traits/time.traits.duration_values/max.pass.cpp
@@ -9,7 +9,7 @@
// <chrono>
-// duration_values::max
+// duration_values::max // noexcept after C++17
#include <chrono>
#include <limits>
@@ -34,4 +34,13 @@ int main()
static_assert(std::chrono::duration_values<Rep>::max() ==
std::numeric_limits<Rep>::max(), "");
#endif
+
+ LIBCPP_ASSERT_NOEXCEPT(std::chrono::duration_values<int>::max());
+ LIBCPP_ASSERT_NOEXCEPT(std::chrono::duration_values<double>::max());
+ LIBCPP_ASSERT_NOEXCEPT(std::chrono::duration_values<Rep>::max());
+#if TEST_STD_VER > 17
+ ASSERT_NOEXCEPT(std::chrono::duration_values<int>::max());
+ ASSERT_NOEXCEPT(std::chrono::duration_values<double>::max());
+ ASSERT_NOEXCEPT(std::chrono::duration_values<Rep>::max());
+#endif
}
diff --git a/test/std/utilities/time/time.traits/time.traits.duration_values/min.pass.cpp b/test/std/utilities/time/time.traits/time.traits.duration_values/min.pass.cpp
index 508837375b871..207a9ab5aff6a 100644
--- a/test/std/utilities/time/time.traits/time.traits.duration_values/min.pass.cpp
+++ b/test/std/utilities/time/time.traits/time.traits.duration_values/min.pass.cpp
@@ -9,7 +9,7 @@
// <chrono>
-// duration_values::min
+// duration_values::min // noexcept after C++17
#include <chrono>
#include <limits>
@@ -34,4 +34,13 @@ int main()
static_assert(std::chrono::duration_values<Rep>::min() ==
std::numeric_limits<Rep>::lowest(), "");
#endif
+
+ LIBCPP_ASSERT_NOEXCEPT(std::chrono::duration_values<int>::min());
+ LIBCPP_ASSERT_NOEXCEPT(std::chrono::duration_values<double>::min());
+ LIBCPP_ASSERT_NOEXCEPT(std::chrono::duration_values<Rep>::min());
+#if TEST_STD_VER > 17
+ ASSERT_NOEXCEPT(std::chrono::duration_values<int>::min());
+ ASSERT_NOEXCEPT(std::chrono::duration_values<double>::min());
+ ASSERT_NOEXCEPT(std::chrono::duration_values<Rep>::min());
+#endif
}
diff --git a/test/std/utilities/time/time.traits/time.traits.duration_values/zero.pass.cpp b/test/std/utilities/time/time.traits/time.traits.duration_values/zero.pass.cpp
index b84a676738a80..614c69b2e386e 100644
--- a/test/std/utilities/time/time.traits/time.traits.duration_values/zero.pass.cpp
+++ b/test/std/utilities/time/time.traits/time.traits.duration_values/zero.pass.cpp
@@ -9,7 +9,7 @@
// <chrono>
-// duration_values::zero
+// duration_values::zero // noexcept after C++17
#include <chrono>
#include <cassert>
@@ -25,4 +25,11 @@ int main()
static_assert(std::chrono::duration_values<int>::zero() == 0, "");
static_assert(std::chrono::duration_values<Rep>::zero() == 0, "");
#endif
+
+ LIBCPP_ASSERT_NOEXCEPT(std::chrono::duration_values<int>::zero());
+ LIBCPP_ASSERT_NOEXCEPT(std::chrono::duration_values<Rep>::zero());
+#if TEST_STD_VER > 17
+ ASSERT_NOEXCEPT(std::chrono::duration_values<int>::zero());
+ ASSERT_NOEXCEPT(std::chrono::duration_values<Rep>::zero());
+#endif
}
diff --git a/test/std/utilities/time/weeks.pass.cpp b/test/std/utilities/time/weeks.pass.cpp
new file mode 100644
index 0000000000000..8e6f283f0ec87
--- /dev/null
+++ b/test/std/utilities/time/weeks.pass.cpp
@@ -0,0 +1,28 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
+
+// <chrono>
+
+// using weeks = duration<signed integer type of at least 22 bits, ratio_multiply<ratio<7>, days::period>>;
+
+#include <chrono>
+#include <type_traits>
+#include <limits>
+
+int main()
+{
+ typedef std::chrono::weeks D;
+ typedef D::rep Rep;
+ typedef D::period Period;
+ static_assert(std::is_signed<Rep>::value, "");
+ static_assert(std::is_integral<Rep>::value, "");
+ static_assert(std::numeric_limits<Rep>::digits >= 22, "");
+ static_assert(std::is_same_v<Period, std::ratio_multiply<std::ratio<7>, std::chrono::days::period>>, "");
+}
diff --git a/test/std/utilities/time/years.pass.cpp b/test/std/utilities/time/years.pass.cpp
new file mode 100644
index 0000000000000..28a2502742492
--- /dev/null
+++ b/test/std/utilities/time/years.pass.cpp
@@ -0,0 +1,28 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
+
+// <chrono>
+
+// using years = duration<signed integer type of at least 17 bits, ratio_multiply<ratio<146097, 400>, days::period>>
+
+#include <chrono>
+#include <type_traits>
+#include <limits>
+
+int main()
+{
+ typedef std::chrono::years D;
+ typedef D::rep Rep;
+ typedef D::period Period;
+ static_assert(std::is_signed<Rep>::value, "");
+ static_assert(std::is_integral<Rep>::value, "");
+ static_assert(std::numeric_limits<Rep>::digits >= 17, "");
+ static_assert(std::is_same_v<Period, std::ratio_multiply<std::ratio<146097, 400>, std::chrono::days::period>>, "");
+}
diff --git a/test/std/utilities/tuple/tuple.tuple/TupleFunction.pass.cpp b/test/std/utilities/tuple/tuple.tuple/TupleFunction.pass.cpp
index ce6dcf811e468..977d2b6da54b9 100644
--- a/test/std/utilities/tuple/tuple.tuple/TupleFunction.pass.cpp
+++ b/test/std/utilities/tuple/tuple.tuple/TupleFunction.pass.cpp
@@ -26,8 +26,7 @@ struct X
void operator()() {}
};
-int
-main()
+int main()
{
X x;
std::function<void()> f(x);
diff --git a/test/std/utilities/tuple/tuple.tuple/tuple.assign/move.pass.cpp b/test/std/utilities/tuple/tuple.tuple/tuple.assign/move.pass.cpp
index 210f14be318a1..9bc0ef5015f6d 100644
--- a/test/std/utilities/tuple/tuple.tuple/tuple.assign/move.pass.cpp
+++ b/test/std/utilities/tuple/tuple.tuple/tuple.assign/move.pass.cpp
@@ -15,6 +15,7 @@
// UNSUPPORTED: c++98, c++03
+#include <memory>
#include <tuple>
#include <utility>
#include <cassert>
diff --git a/test/std/utilities/tuple/tuple.tuple/tuple.cnstr/PR20855_tuple_ref_binding_diagnostics.pass.cpp b/test/std/utilities/tuple/tuple.tuple/tuple.cnstr/PR20855_tuple_ref_binding_diagnostics.pass.cpp
index 457df5602850f..bfa7c0d2370c5 100644
--- a/test/std/utilities/tuple/tuple.tuple/tuple.cnstr/PR20855_tuple_ref_binding_diagnostics.pass.cpp
+++ b/test/std/utilities/tuple/tuple.tuple/tuple.cnstr/PR20855_tuple_ref_binding_diagnostics.pass.cpp
@@ -14,6 +14,7 @@
// See llvm.org/PR20855
+#include <functional>
#include <tuple>
#include <string>
#include <cassert>
diff --git a/test/std/utilities/tuple/tuple.tuple/tuple.helper/tuple_size_incomplete.fail.cpp b/test/std/utilities/tuple/tuple.tuple/tuple.helper/tuple_size_incomplete.fail.cpp
index 818001833995b..05ff8a4dfd1e9 100644
--- a/test/std/utilities/tuple/tuple.tuple/tuple.helper/tuple_size_incomplete.fail.cpp
+++ b/test/std/utilities/tuple/tuple.tuple/tuple.helper/tuple_size_incomplete.fail.cpp
@@ -12,7 +12,7 @@
// template <class... Types> class tuple;
// template <class... Types>
-// class tuple_size<tuple<Types...>>
+// struct tuple_size<tuple<Types...>>
// : public integral_constant<size_t, sizeof...(Types)> { };
// UNSUPPORTED: c++98, c++03
@@ -26,19 +26,19 @@ struct Dummy2 {};
struct Dummy3 {};
template <>
-class std::tuple_size<Dummy1> {
+struct std::tuple_size<Dummy1> {
public:
static size_t value;
};
template <>
-class std::tuple_size<Dummy2> {
+struct std::tuple_size<Dummy2> {
public:
static void value() {}
};
template <>
-class std::tuple_size<Dummy3> {};
+struct std::tuple_size<Dummy3> {};
int main()
{
diff --git a/test/std/utilities/tuple/tuple.tuple/tuple.helper/tuple_size_incomplete.pass.cpp b/test/std/utilities/tuple/tuple.tuple/tuple.helper/tuple_size_incomplete.pass.cpp
index ccdd48e4c11d4..c4f2e52ab71d3 100644
--- a/test/std/utilities/tuple/tuple.tuple/tuple.helper/tuple_size_incomplete.pass.cpp
+++ b/test/std/utilities/tuple/tuple.tuple/tuple.helper/tuple_size_incomplete.pass.cpp
@@ -12,7 +12,7 @@
// template <class... Types> class tuple;
// template <class... Types>
-// class tuple_size<tuple<Types...>>
+// struct tuple_size<tuple<Types...>>
// : public integral_constant<size_t, sizeof...(Types)> { };
// XFAIL: gcc-4.9
@@ -31,7 +31,7 @@ struct Dummy1 {};
struct Dummy2 {};
namespace std {
-template <> class tuple_size<Dummy1> : public integral_constant<size_t, 0> {};
+template <> struct tuple_size<Dummy1> : public integral_constant<size_t, 0> {};
}
template <class T>
diff --git a/test/std/utilities/tuple/tuple.tuple/tuple.helper/tuple_size_structured_bindings.pass.cpp b/test/std/utilities/tuple/tuple.tuple/tuple.helper/tuple_size_structured_bindings.pass.cpp
index 03fb78caa08e1..a18b9fc8976a4 100644
--- a/test/std/utilities/tuple/tuple.tuple/tuple.helper/tuple_size_structured_bindings.pass.cpp
+++ b/test/std/utilities/tuple/tuple.tuple/tuple.helper/tuple_size_structured_bindings.pass.cpp
@@ -12,7 +12,7 @@
// template <class... Types> class tuple;
// template <class... Types>
-// class tuple_size<tuple<Types...>>
+// struct tuple_size<tuple<Types...>>
// : public integral_constant<size_t, sizeof...(Types)> { };
// UNSUPPORTED: c++98, c++03, c++11, c++14
@@ -129,7 +129,7 @@ void test_before_tuple_size_specialization() {
}
template <>
-class std::tuple_size<Test> {
+struct std::tuple_size<Test> {
public:
static const size_t value = 1;
};
diff --git a/test/std/utilities/type.index/type.index.hash/hash.pass.cpp b/test/std/utilities/type.index/type.index.hash/hash.pass.cpp
index c5ffacfa37e9c..14bf08412bb41 100644
--- a/test/std/utilities/type.index/type.index.hash/hash.pass.cpp
+++ b/test/std/utilities/type.index/type.index.hash/hash.pass.cpp
@@ -19,6 +19,7 @@
// };
#include <typeindex>
+#include <type_traits>
#include <cassert>
int main()
diff --git a/test/std/utilities/utility/pairs/pairs.pair/piecewise.pass.cpp b/test/std/utilities/utility/pairs/pairs.pair/piecewise.pass.cpp
index c738adad7d79b..aa86949dd5b38 100644
--- a/test/std/utilities/utility/pairs/pairs.pair/piecewise.pass.cpp
+++ b/test/std/utilities/utility/pairs/pairs.pair/piecewise.pass.cpp
@@ -17,9 +17,10 @@
// pair(piecewise_construct_t, tuple<Args1...> first_args,
// tuple<Args2...> second_args);
-#include <utility>
-#include <tuple>
#include <cassert>
+#include <tuple>
+#include <utility>
+
int main()
{
diff --git a/test/std/utilities/variant/variant.bad_variant_access/bad_variant_access.pass.cpp b/test/std/utilities/variant/variant.bad_variant_access/bad_variant_access.pass.cpp
index 5b0f15ecbb12d..4e76e12b9a48d 100644
--- a/test/std/utilities/variant/variant.bad_variant_access/bad_variant_access.pass.cpp
+++ b/test/std/utilities/variant/variant.bad_variant_access/bad_variant_access.pass.cpp
@@ -10,12 +10,14 @@
// UNSUPPORTED: c++98, c++03, c++11, c++14
-// XFAIL: with_system_cxx_lib=macosx10.12
-// XFAIL: with_system_cxx_lib=macosx10.11
-// XFAIL: with_system_cxx_lib=macosx10.10
-// XFAIL: with_system_cxx_lib=macosx10.9
-// XFAIL: with_system_cxx_lib=macosx10.7
-// XFAIL: with_system_cxx_lib=macosx10.8
+// XFAIL: availability=macosx10.13
+// XFAIL: availability=macosx10.12
+// XFAIL: availability=macosx10.11
+// XFAIL: availability=macosx10.10
+// XFAIL: availability=macosx10.9
+// XFAIL: availability=macosx10.8
+// XFAIL: availability=macosx10.7
+
// <variant>
diff --git a/test/std/utilities/variant/variant.get/get_index.pass.cpp b/test/std/utilities/variant/variant.get/get_index.pass.cpp
index f52dc5556466b..dd76fa6c73e0c 100644
--- a/test/std/utilities/variant/variant.get/get_index.pass.cpp
+++ b/test/std/utilities/variant/variant.get/get_index.pass.cpp
@@ -10,12 +10,13 @@
// UNSUPPORTED: c++98, c++03, c++11, c++14
-// XFAIL: with_system_cxx_lib=macosx10.12
-// XFAIL: with_system_cxx_lib=macosx10.11
-// XFAIL: with_system_cxx_lib=macosx10.10
-// XFAIL: with_system_cxx_lib=macosx10.9
-// XFAIL: with_system_cxx_lib=macosx10.7
-// XFAIL: with_system_cxx_lib=macosx10.8
+// XFAIL: availability=macosx10.13
+// XFAIL: availability=macosx10.12
+// XFAIL: availability=macosx10.11
+// XFAIL: availability=macosx10.10
+// XFAIL: availability=macosx10.9
+// XFAIL: availability=macosx10.8
+// XFAIL: availability=macosx10.7
// <variant>
diff --git a/test/std/utilities/variant/variant.get/get_type.pass.cpp b/test/std/utilities/variant/variant.get/get_type.pass.cpp
index 0a2222cbf277e..7b4a6704877fd 100644
--- a/test/std/utilities/variant/variant.get/get_type.pass.cpp
+++ b/test/std/utilities/variant/variant.get/get_type.pass.cpp
@@ -10,12 +10,13 @@
// UNSUPPORTED: c++98, c++03, c++11, c++14
-// XFAIL: with_system_cxx_lib=macosx10.12
-// XFAIL: with_system_cxx_lib=macosx10.11
-// XFAIL: with_system_cxx_lib=macosx10.10
-// XFAIL: with_system_cxx_lib=macosx10.9
-// XFAIL: with_system_cxx_lib=macosx10.7
-// XFAIL: with_system_cxx_lib=macosx10.8
+// XFAIL: availability=macosx10.13
+// XFAIL: availability=macosx10.12
+// XFAIL: availability=macosx10.11
+// XFAIL: availability=macosx10.10
+// XFAIL: availability=macosx10.9
+// XFAIL: availability=macosx10.8
+// XFAIL: availability=macosx10.7
// <variant>
diff --git a/test/std/utilities/variant/variant.relops/relops.pass.cpp b/test/std/utilities/variant/variant.relops/relops.pass.cpp
index 4337b4bdbbd72..41a953552150e 100644
--- a/test/std/utilities/variant/variant.relops/relops.pass.cpp
+++ b/test/std/utilities/variant/variant.relops/relops.pass.cpp
@@ -85,43 +85,79 @@ template <class Variant> void makeEmpty(Variant &v) {
}
#endif // TEST_HAS_NO_EXCEPTIONS
-void test_equality() {
+struct MyBool {
+ bool value;
+ constexpr explicit MyBool(bool v) : value(v) {}
+ constexpr operator bool() const noexcept { return value; }
+};
+
+struct ComparesToMyBool {
+ int value = 0;
+};
+inline constexpr MyBool operator==(const ComparesToMyBool& LHS, const ComparesToMyBool& RHS) noexcept {
+ return MyBool(LHS.value == RHS.value);
+}
+inline constexpr MyBool operator!=(const ComparesToMyBool& LHS, const ComparesToMyBool& RHS) noexcept {
+ return MyBool(LHS.value != RHS.value);
+}
+inline constexpr MyBool operator<(const ComparesToMyBool& LHS, const ComparesToMyBool& RHS) noexcept {
+ return MyBool(LHS.value < RHS.value);
+}
+inline constexpr MyBool operator<=(const ComparesToMyBool& LHS, const ComparesToMyBool& RHS) noexcept {
+ return MyBool(LHS.value <= RHS.value);
+}
+inline constexpr MyBool operator>(const ComparesToMyBool& LHS, const ComparesToMyBool& RHS) noexcept {
+ return MyBool(LHS.value > RHS.value);
+}
+inline constexpr MyBool operator>=(const ComparesToMyBool& LHS, const ComparesToMyBool& RHS) noexcept {
+ return MyBool(LHS.value >= RHS.value);
+}
+
+template <class T1, class T2>
+void test_equality_basic() {
{
- using V = std::variant<int, long>;
- constexpr V v1(42);
- constexpr V v2(42);
+ using V = std::variant<T1, T2>;
+ constexpr V v1(std::in_place_index<0>, T1{42});
+ constexpr V v2(std::in_place_index<0>, T1{42});
static_assert(v1 == v2, "");
static_assert(v2 == v1, "");
static_assert(!(v1 != v2), "");
static_assert(!(v2 != v1), "");
}
{
- using V = std::variant<int, long>;
- constexpr V v1(42);
- constexpr V v2(43);
+ using V = std::variant<T1, T2>;
+ constexpr V v1(std::in_place_index<0>, T1{42});
+ constexpr V v2(std::in_place_index<0>, T1{43});
static_assert(!(v1 == v2), "");
static_assert(!(v2 == v1), "");
static_assert(v1 != v2, "");
static_assert(v2 != v1, "");
}
{
- using V = std::variant<int, long>;
- constexpr V v1(42);
- constexpr V v2(42l);
+ using V = std::variant<T1, T2>;
+ constexpr V v1(std::in_place_index<0>, T1{42});
+ constexpr V v2(std::in_place_index<1>, T2{42});
static_assert(!(v1 == v2), "");
static_assert(!(v2 == v1), "");
static_assert(v1 != v2, "");
static_assert(v2 != v1, "");
}
{
- using V = std::variant<int, long>;
- constexpr V v1(42l);
- constexpr V v2(42l);
+ using V = std::variant<T1, T2>;
+ constexpr V v1(std::in_place_index<1>, T2{42});
+ constexpr V v2(std::in_place_index<1>, T2{42});
static_assert(v1 == v2, "");
static_assert(v2 == v1, "");
static_assert(!(v1 != v2), "");
static_assert(!(v2 != v1), "");
}
+}
+
+void test_equality() {
+ test_equality_basic<int, long>();
+ test_equality_basic<ComparesToMyBool, int>();
+ test_equality_basic<int, ComparesToMyBool>();
+ test_equality_basic<ComparesToMyBool, ComparesToMyBool>();
#ifndef TEST_HAS_NO_EXCEPTIONS
{
using V = std::variant<int, MakeEmptyT>;
@@ -160,41 +196,54 @@ void test_equality() {
template <class Var>
constexpr bool test_less(const Var &l, const Var &r, bool expect_less,
bool expect_greater) {
+ static_assert(std::is_same_v<decltype(l < r), bool>, "");
+ static_assert(std::is_same_v<decltype(l <= r), bool>, "");
+ static_assert(std::is_same_v<decltype(l > r), bool>, "");
+ static_assert(std::is_same_v<decltype(l >= r), bool>, "");
+
return ((l < r) == expect_less) && (!(l >= r) == expect_less) &&
((l > r) == expect_greater) && (!(l <= r) == expect_greater);
}
-void test_relational() {
+template <class T1, class T2>
+void test_relational_basic() {
{ // same index, same value
- using V = std::variant<int, long>;
- constexpr V v1(1);
- constexpr V v2(1);
+ using V = std::variant<T1, T2>;
+ constexpr V v1(std::in_place_index<0>, T1{1});
+ constexpr V v2(std::in_place_index<0>, T1{1});
static_assert(test_less(v1, v2, false, false), "");
}
{ // same index, value < other_value
- using V = std::variant<int, long>;
- constexpr V v1(0);
- constexpr V v2(1);
+ using V = std::variant<T1, T2>;
+ constexpr V v1(std::in_place_index<0>, T1{0});
+ constexpr V v2(std::in_place_index<0>, T1{1});
static_assert(test_less(v1, v2, true, false), "");
}
{ // same index, value > other_value
- using V = std::variant<int, long>;
- constexpr V v1(1);
- constexpr V v2(0);
+ using V = std::variant<T1, T2>;
+ constexpr V v1(std::in_place_index<0>, T1{1});
+ constexpr V v2(std::in_place_index<0>, T1{0});
static_assert(test_less(v1, v2, false, true), "");
}
{ // LHS.index() < RHS.index()
- using V = std::variant<int, long>;
- constexpr V v1(0);
- constexpr V v2(0l);
+ using V = std::variant<T1, T2>;
+ constexpr V v1(std::in_place_index<0>, T1{0});
+ constexpr V v2(std::in_place_index<1>, T2{0});
static_assert(test_less(v1, v2, true, false), "");
}
{ // LHS.index() > RHS.index()
- using V = std::variant<int, long>;
- constexpr V v1(0l);
- constexpr V v2(0);
+ using V = std::variant<T1, T2>;
+ constexpr V v1(std::in_place_index<1>, T2{0});
+ constexpr V v2(std::in_place_index<0>, T1{0});
static_assert(test_less(v1, v2, false, true), "");
}
+}
+
+void test_relational() {
+ test_relational_basic<int, long>();
+ test_relational_basic<ComparesToMyBool, int>();
+ test_relational_basic<int, ComparesToMyBool>();
+ test_relational_basic<ComparesToMyBool, ComparesToMyBool>();
#ifndef TEST_HAS_NO_EXCEPTIONS
{ // LHS.index() < RHS.index(), RHS is empty
using V = std::variant<int, MakeEmptyT>;
diff --git a/test/std/utilities/variant/variant.relops/relops_bool_conv.fail.cpp b/test/std/utilities/variant/variant.relops/relops_bool_conv.fail.cpp
new file mode 100644
index 0000000000000..ab68bc4204704
--- /dev/null
+++ b/test/std/utilities/variant/variant.relops/relops_bool_conv.fail.cpp
@@ -0,0 +1,88 @@
+// -*- C++ -*-
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++98, c++03, c++11, c++14
+
+// <variant>
+
+// template <class ...Types>
+// constexpr bool
+// operator==(variant<Types...> const&, variant<Types...> const&) noexcept;
+//
+// template <class ...Types>
+// constexpr bool
+// operator!=(variant<Types...> const&, variant<Types...> const&) noexcept;
+//
+// template <class ...Types>
+// constexpr bool
+// operator<(variant<Types...> const&, variant<Types...> const&) noexcept;
+//
+// template <class ...Types>
+// constexpr bool
+// operator>(variant<Types...> const&, variant<Types...> const&) noexcept;
+//
+// template <class ...Types>
+// constexpr bool
+// operator<=(variant<Types...> const&, variant<Types...> const&) noexcept;
+//
+// template <class ...Types>
+// constexpr bool
+// operator>=(variant<Types...> const&, variant<Types...> const&) noexcept;
+
+#include <cassert>
+#include <type_traits>
+#include <utility>
+#include <variant>
+
+#include "test_macros.h"
+
+
+struct MyBoolExplicit {
+ bool value;
+ constexpr explicit MyBoolExplicit(bool v) : value(v) {}
+ constexpr explicit operator bool() const noexcept { return value; }
+};
+
+struct ComparesToMyBoolExplicit {
+ int value = 0;
+};
+inline constexpr MyBoolExplicit operator==(const ComparesToMyBoolExplicit& LHS, const ComparesToMyBoolExplicit& RHS) noexcept {
+ return MyBoolExplicit(LHS.value == RHS.value);
+}
+inline constexpr MyBoolExplicit operator!=(const ComparesToMyBoolExplicit& LHS, const ComparesToMyBoolExplicit& RHS) noexcept {
+ return MyBoolExplicit(LHS.value != RHS.value);
+}
+inline constexpr MyBoolExplicit operator<(const ComparesToMyBoolExplicit& LHS, const ComparesToMyBoolExplicit& RHS) noexcept {
+ return MyBoolExplicit(LHS.value < RHS.value);
+}
+inline constexpr MyBoolExplicit operator<=(const ComparesToMyBoolExplicit& LHS, const ComparesToMyBoolExplicit& RHS) noexcept {
+ return MyBoolExplicit(LHS.value <= RHS.value);
+}
+inline constexpr MyBoolExplicit operator>(const ComparesToMyBoolExplicit& LHS, const ComparesToMyBoolExplicit& RHS) noexcept {
+ return MyBoolExplicit(LHS.value > RHS.value);
+}
+inline constexpr MyBoolExplicit operator>=(const ComparesToMyBoolExplicit& LHS, const ComparesToMyBoolExplicit& RHS) noexcept {
+ return MyBoolExplicit(LHS.value >= RHS.value);
+}
+
+
+int main() {
+ using V = std::variant<int, ComparesToMyBoolExplicit>;
+ V v1(42);
+ V v2(101);
+ // expected-error-re@variant:* 6 {{static_assert failed {{.*}}"the relational operator does not return a type which is implicitly convertible to bool"}}
+ // expected-error@variant:* 6 {{no viable conversion}}
+ (void)(v1 == v2); // expected-note {{here}}
+ (void)(v1 != v2); // expected-note {{here}}
+ (void)(v1 < v2); // expected-note {{here}}
+ (void)(v1 <= v2); // expected-note {{here}}
+ (void)(v1 > v2); // expected-note {{here}}
+ (void)(v1 >= v2); // expected-note {{here}}
+}
diff --git a/test/std/utilities/variant/variant.variant/variant.assign/T.pass.cpp b/test/std/utilities/variant/variant.variant/variant.assign/T.pass.cpp
index 29228e562d699..6c8a2b86a17ee 100644
--- a/test/std/utilities/variant/variant.variant/variant.assign/T.pass.cpp
+++ b/test/std/utilities/variant/variant.variant/variant.assign/T.pass.cpp
@@ -10,12 +10,13 @@
// UNSUPPORTED: c++98, c++03, c++11, c++14
-// XFAIL: with_system_cxx_lib=macosx10.12
-// XFAIL: with_system_cxx_lib=macosx10.11
-// XFAIL: with_system_cxx_lib=macosx10.10
-// XFAIL: with_system_cxx_lib=macosx10.9
-// XFAIL: with_system_cxx_lib=macosx10.7
-// XFAIL: with_system_cxx_lib=macosx10.8
+// XFAIL: availability=macosx10.13
+// XFAIL: availability=macosx10.12
+// XFAIL: availability=macosx10.11
+// XFAIL: availability=macosx10.10
+// XFAIL: availability=macosx10.9
+// XFAIL: availability=macosx10.8
+// XFAIL: availability=macosx10.7
// <variant>
diff --git a/test/std/utilities/variant/variant.variant/variant.assign/copy.pass.cpp b/test/std/utilities/variant/variant.variant/variant.assign/copy.pass.cpp
index 068b9a2015660..5ea7069f5d114 100644
--- a/test/std/utilities/variant/variant.variant/variant.assign/copy.pass.cpp
+++ b/test/std/utilities/variant/variant.variant/variant.assign/copy.pass.cpp
@@ -14,18 +14,19 @@
// XFAIL: clang-3.5, clang-3.6, clang-3.7, clang-3.8
// XFAIL: apple-clang-6, apple-clang-7, apple-clang-8.0
-// XFAIL: with_system_cxx_lib=macosx10.12
-// XFAIL: with_system_cxx_lib=macosx10.11
-// XFAIL: with_system_cxx_lib=macosx10.10
-// XFAIL: with_system_cxx_lib=macosx10.9
-// XFAIL: with_system_cxx_lib=macosx10.7
-// XFAIL: with_system_cxx_lib=macosx10.8
+// XFAIL: availability=macosx10.13
+// XFAIL: availability=macosx10.12
+// XFAIL: availability=macosx10.11
+// XFAIL: availability=macosx10.10
+// XFAIL: availability=macosx10.9
+// XFAIL: availability=macosx10.8
+// XFAIL: availability=macosx10.7
// <variant>
// template <class ...Types> class variant;
-// variant& operator=(variant const&);
+// variant& operator=(variant const&); // constexpr in C++20
#include <cassert>
#include <string>
@@ -239,7 +240,8 @@ void test_copy_assignment_sfinae() {
static_assert(!std::is_copy_assignable<V>::value, "");
}
- // The following tests are for not-yet-standardized behavior (P0602):
+ // Make sure we properly propagate triviality (see P0602R4).
+#if TEST_STD_VER > 17
{
using V = std::variant<int, long>;
static_assert(std::is_trivially_copy_assignable<V>::value, "");
@@ -261,6 +263,7 @@ void test_copy_assignment_sfinae() {
using V = std::variant<int, CopyOnly>;
static_assert(std::is_trivially_copy_assignable<V>::value, "");
}
+#endif // > C++17
}
void test_copy_assignment_empty_empty() {
@@ -383,7 +386,8 @@ void test_copy_assignment_same_index() {
}
#endif // TEST_HAS_NO_EXCEPTIONS
- // The following tests are for not-yet-standardized behavior (P0602):
+ // Make sure we properly propagate triviality, which implies constexpr-ness (see P0602R4).
+#if TEST_STD_VER > 17
{
struct {
constexpr Result<int> operator()() const {
@@ -440,6 +444,7 @@ void test_copy_assignment_same_index() {
static_assert(result.index == 1, "");
static_assert(result.value == 42, "");
}
+#endif // > C++17
}
void test_copy_assignment_different_index() {
@@ -529,7 +534,8 @@ void test_copy_assignment_different_index() {
}
#endif // TEST_HAS_NO_EXCEPTIONS
- // The following tests are for not-yet-standardized behavior (P0602):
+ // Make sure we properly propagate triviality, which implies constexpr-ness (see P0602R4).
+#if TEST_STD_VER > 17
{
struct {
constexpr Result<long> operator()() const {
@@ -558,10 +564,11 @@ void test_copy_assignment_different_index() {
static_assert(result.index == 1, "");
static_assert(result.value == 42, "");
}
+#endif // > C++17
}
template <size_t NewIdx, class ValueType>
-constexpr bool test_constexpr_assign_extension_imp(
+constexpr bool test_constexpr_assign_imp(
std::variant<long, void*, int>&& v, ValueType&& new_value)
{
const std::variant<long, void*, int> cp(
@@ -571,15 +578,17 @@ constexpr bool test_constexpr_assign_extension_imp(
std::get<NewIdx>(v) == std::get<NewIdx>(cp);
}
-void test_constexpr_copy_assignment_extension() {
- // The following tests are for not-yet-standardized behavior (P0602):
+void test_constexpr_copy_assignment() {
+ // Make sure we properly propagate triviality, which implies constexpr-ness (see P0602R4).
+#if TEST_STD_VER > 17
using V = std::variant<long, void*, int>;
static_assert(std::is_trivially_copyable<V>::value, "");
static_assert(std::is_trivially_copy_assignable<V>::value, "");
- static_assert(test_constexpr_assign_extension_imp<0>(V(42l), 101l), "");
- static_assert(test_constexpr_assign_extension_imp<0>(V(nullptr), 101l), "");
- static_assert(test_constexpr_assign_extension_imp<1>(V(42l), nullptr), "");
- static_assert(test_constexpr_assign_extension_imp<2>(V(42l), 101), "");
+ static_assert(test_constexpr_assign_imp<0>(V(42l), 101l), "");
+ static_assert(test_constexpr_assign_imp<0>(V(nullptr), 101l), "");
+ static_assert(test_constexpr_assign_imp<1>(V(42l), nullptr), "");
+ static_assert(test_constexpr_assign_imp<2>(V(42l), 101), "");
+#endif // > C++17
}
int main() {
@@ -590,5 +599,5 @@ int main() {
test_copy_assignment_different_index();
test_copy_assignment_sfinae();
test_copy_assignment_not_noexcept();
- test_constexpr_copy_assignment_extension();
+ test_constexpr_copy_assignment();
}
diff --git a/test/std/utilities/variant/variant.variant/variant.assign/move.pass.cpp b/test/std/utilities/variant/variant.variant/variant.assign/move.pass.cpp
index c410b4b8f3efa..cee141a8c73aa 100644
--- a/test/std/utilities/variant/variant.variant/variant.assign/move.pass.cpp
+++ b/test/std/utilities/variant/variant.variant/variant.assign/move.pass.cpp
@@ -14,18 +14,20 @@
// XFAIL: clang-3.5, clang-3.6, clang-3.7, clang-3.8
// XFAIL: apple-clang-6, apple-clang-7, apple-clang-8.0
-// XFAIL: with_system_cxx_lib=macosx10.12
-// XFAIL: with_system_cxx_lib=macosx10.11
-// XFAIL: with_system_cxx_lib=macosx10.10
-// XFAIL: with_system_cxx_lib=macosx10.9
-// XFAIL: with_system_cxx_lib=macosx10.7
-// XFAIL: with_system_cxx_lib=macosx10.8
+// XFAIL: availability=macosx10.13
+// XFAIL: availability=macosx10.12
+// XFAIL: availability=macosx10.11
+// XFAIL: availability=macosx10.10
+// XFAIL: availability=macosx10.9
+// XFAIL: availability=macosx10.8
+// XFAIL: availability=macosx10.7
+
// <variant>
// template <class ...Types> class variant;
-// variant& operator=(variant&&) noexcept(see below);
+// variant& operator=(variant&&) noexcept(see below); // constexpr in C++20
#include <cassert>
#include <string>
@@ -204,7 +206,8 @@ void test_move_assignment_sfinae() {
static_assert(!std::is_move_assignable<V>::value, "");
}
- // The following tests are for not-yet-standardized behavior (P0602):
+ // Make sure we properly propagate triviality (see P0602R4).
+#if TEST_STD_VER > 17
{
using V = std::variant<int, long>;
static_assert(std::is_trivially_move_assignable<V>::value, "");
@@ -230,6 +233,7 @@ void test_move_assignment_sfinae() {
using V = std::variant<int, CopyOnly>;
static_assert(std::is_trivially_move_assignable<V>::value, "");
}
+#endif // > C++17
}
void test_move_assignment_empty_empty() {
@@ -351,7 +355,8 @@ void test_move_assignment_same_index() {
}
#endif // TEST_HAS_NO_EXCEPTIONS
- // The following tests are for not-yet-standardized behavior (P0602):
+ // Make sure we properly propagate triviality, which implies constexpr-ness (see P0602R4).
+#if TEST_STD_VER > 17
{
struct {
constexpr Result<int> operator()() const {
@@ -394,6 +399,7 @@ void test_move_assignment_same_index() {
static_assert(result.index == 1, "");
static_assert(result.value == 42, "");
}
+#endif // > C++17
}
void test_move_assignment_different_index() {
@@ -443,7 +449,8 @@ void test_move_assignment_different_index() {
}
#endif // TEST_HAS_NO_EXCEPTIONS
- // The following tests are for not-yet-standardized behavior (P0602):
+ // Make sure we properly propagate triviality, which implies constexpr-ness (see P0602R4).
+#if TEST_STD_VER > 17
{
struct {
constexpr Result<long> operator()() const {
@@ -472,10 +479,11 @@ void test_move_assignment_different_index() {
static_assert(result.index == 1, "");
static_assert(result.value == 42, "");
}
+#endif // > C++17
}
template <size_t NewIdx, class ValueType>
-constexpr bool test_constexpr_assign_extension_imp(
+constexpr bool test_constexpr_assign_imp(
std::variant<long, void*, int>&& v, ValueType&& new_value)
{
std::variant<long, void*, int> v2(
@@ -486,15 +494,17 @@ constexpr bool test_constexpr_assign_extension_imp(
std::get<NewIdx>(v) == std::get<NewIdx>(cp);
}
-void test_constexpr_move_assignment_extension() {
- // The following tests are for not-yet-standardized behavior (P0602):
+void test_constexpr_move_assignment() {
+ // Make sure we properly propagate triviality, which implies constexpr-ness (see P0602R4).
+#if TEST_STD_VER > 17
using V = std::variant<long, void*, int>;
static_assert(std::is_trivially_copyable<V>::value, "");
static_assert(std::is_trivially_move_assignable<V>::value, "");
- static_assert(test_constexpr_assign_extension_imp<0>(V(42l), 101l), "");
- static_assert(test_constexpr_assign_extension_imp<0>(V(nullptr), 101l), "");
- static_assert(test_constexpr_assign_extension_imp<1>(V(42l), nullptr), "");
- static_assert(test_constexpr_assign_extension_imp<2>(V(42l), 101), "");
+ static_assert(test_constexpr_assign_imp<0>(V(42l), 101l), "");
+ static_assert(test_constexpr_assign_imp<0>(V(nullptr), 101l), "");
+ static_assert(test_constexpr_assign_imp<1>(V(42l), nullptr), "");
+ static_assert(test_constexpr_assign_imp<2>(V(42l), 101), "");
+#endif // > C++17
}
int main() {
@@ -505,5 +515,5 @@ int main() {
test_move_assignment_different_index();
test_move_assignment_sfinae();
test_move_assignment_noexcept();
- test_constexpr_move_assignment_extension();
+ test_constexpr_move_assignment();
}
diff --git a/test/std/utilities/variant/variant.variant/variant.ctor/T.pass.cpp b/test/std/utilities/variant/variant.variant/variant.ctor/T.pass.cpp
index 3f7cd4f0b6d21..d414c3503e78d 100644
--- a/test/std/utilities/variant/variant.variant/variant.ctor/T.pass.cpp
+++ b/test/std/utilities/variant/variant.variant/variant.ctor/T.pass.cpp
@@ -12,6 +12,14 @@
// <variant>
+// XFAIL: availability=macosx10.13
+// XFAIL: availability=macosx10.12
+// XFAIL: availability=macosx10.11
+// XFAIL: availability=macosx10.10
+// XFAIL: availability=macosx10.9
+// XFAIL: availability=macosx10.8
+// XFAIL: availability=macosx10.7
+
// template <class ...Types> class variant;
// template <class T> constexpr variant(T&&) noexcept(see below);
diff --git a/test/std/utilities/variant/variant.variant/variant.ctor/copy.pass.cpp b/test/std/utilities/variant/variant.variant/variant.ctor/copy.pass.cpp
index 1696f9cc2320a..6eeec69c891c5 100644
--- a/test/std/utilities/variant/variant.variant/variant.ctor/copy.pass.cpp
+++ b/test/std/utilities/variant/variant.variant/variant.ctor/copy.pass.cpp
@@ -10,18 +10,19 @@
// UNSUPPORTED: c++98, c++03, c++11, c++14
-// XFAIL: with_system_cxx_lib=macosx10.12
-// XFAIL: with_system_cxx_lib=macosx10.11
-// XFAIL: with_system_cxx_lib=macosx10.10
-// XFAIL: with_system_cxx_lib=macosx10.9
-// XFAIL: with_system_cxx_lib=macosx10.7
-// XFAIL: with_system_cxx_lib=macosx10.8
+// XFAIL: availability=macosx10.13
+// XFAIL: availability=macosx10.12
+// XFAIL: availability=macosx10.11
+// XFAIL: availability=macosx10.10
+// XFAIL: availability=macosx10.9
+// XFAIL: availability=macosx10.8
+// XFAIL: availability=macosx10.7
// <variant>
// template <class ...Types> class variant;
-// variant(variant const&);
+// variant(variant const&); // constexpr in C++20
#include <cassert>
#include <type_traits>
@@ -125,7 +126,8 @@ void test_copy_ctor_sfinae() {
static_assert(!std::is_copy_constructible<V>::value, "");
}
- // The following tests are for not-yet-standardized behavior (P0602):
+ // Make sure we properly propagate triviality (see P0602R4).
+#if TEST_STD_VER > 17
{
using V = std::variant<int, long>;
static_assert(std::is_trivially_copy_constructible<V>::value, "");
@@ -143,6 +145,7 @@ void test_copy_ctor_sfinae() {
using V = std::variant<int, TCopyNTMove>;
static_assert(std::is_trivially_copy_constructible<V>::value, "");
}
+#endif // > C++17
}
void test_copy_ctor_basic() {
@@ -173,7 +176,8 @@ void test_copy_ctor_basic() {
assert(std::get<1>(v2).value == 42);
}
- // The following tests are for not-yet-standardized behavior (P0602):
+ // Make sure we properly propagate triviality, which implies constexpr-ness (see P0602R4).
+#if TEST_STD_VER > 17
{
constexpr std::variant<int> v(std::in_place_index<0>, 42);
static_assert(v.index() == 0, "");
@@ -216,6 +220,7 @@ void test_copy_ctor_basic() {
static_assert(v2.index() == 1, "");
static_assert(std::get<1>(v2).value == 42, "");
}
+#endif // > C++17
}
void test_copy_ctor_valueless_by_exception() {
@@ -230,17 +235,16 @@ void test_copy_ctor_valueless_by_exception() {
}
template <size_t Idx>
-constexpr bool test_constexpr_copy_ctor_extension_imp(
- std::variant<long, void*, const int> const& v)
-{
+constexpr bool test_constexpr_copy_ctor_imp(std::variant<long, void*, const int> const& v) {
auto v2 = v;
return v2.index() == v.index() &&
v2.index() == Idx &&
std::get<Idx>(v2) == std::get<Idx>(v);
}
-void test_constexpr_copy_ctor_extension() {
- // NOTE: This test is for not yet standardized behavior. (P0602)
+void test_constexpr_copy_ctor() {
+ // Make sure we properly propagate triviality, which implies constexpr-ness (see P0602R4).
+#if TEST_STD_VER > 17
using V = std::variant<long, void*, const int>;
#ifdef TEST_WORKAROUND_C1XX_BROKEN_IS_TRIVIALLY_COPYABLE
static_assert(std::is_trivially_destructible<V>::value, "");
@@ -251,16 +255,17 @@ void test_constexpr_copy_ctor_extension() {
#else // TEST_WORKAROUND_C1XX_BROKEN_IS_TRIVIALLY_COPYABLE
static_assert(std::is_trivially_copyable<V>::value, "");
#endif // TEST_WORKAROUND_C1XX_BROKEN_IS_TRIVIALLY_COPYABLE
- static_assert(test_constexpr_copy_ctor_extension_imp<0>(V(42l)), "");
- static_assert(test_constexpr_copy_ctor_extension_imp<1>(V(nullptr)), "");
- static_assert(test_constexpr_copy_ctor_extension_imp<2>(V(101)), "");
+ static_assert(test_constexpr_copy_ctor_imp<0>(V(42l)), "");
+ static_assert(test_constexpr_copy_ctor_imp<1>(V(nullptr)), "");
+ static_assert(test_constexpr_copy_ctor_imp<2>(V(101)), "");
+#endif // > C++17
}
int main() {
test_copy_ctor_basic();
test_copy_ctor_valueless_by_exception();
test_copy_ctor_sfinae();
- test_constexpr_copy_ctor_extension();
+ test_constexpr_copy_ctor();
#if 0
// disable this for the moment; it fails on older compilers.
// Need to figure out which compilers will support it.
diff --git a/test/std/utilities/variant/variant.variant/variant.ctor/default.pass.cpp b/test/std/utilities/variant/variant.variant/variant.ctor/default.pass.cpp
index 05a09db45bdf1..e4278f0e0abce 100644
--- a/test/std/utilities/variant/variant.variant/variant.ctor/default.pass.cpp
+++ b/test/std/utilities/variant/variant.variant/variant.ctor/default.pass.cpp
@@ -10,12 +10,13 @@
// UNSUPPORTED: c++98, c++03, c++11, c++14
-// XFAIL: with_system_cxx_lib=macosx10.12
-// XFAIL: with_system_cxx_lib=macosx10.11
-// XFAIL: with_system_cxx_lib=macosx10.10
-// XFAIL: with_system_cxx_lib=macosx10.9
-// XFAIL: with_system_cxx_lib=macosx10.7
-// XFAIL: with_system_cxx_lib=macosx10.8
+// XFAIL: availability=macosx10.13
+// XFAIL: availability=macosx10.12
+// XFAIL: availability=macosx10.11
+// XFAIL: availability=macosx10.10
+// XFAIL: availability=macosx10.9
+// XFAIL: availability=macosx10.8
+// XFAIL: availability=macosx10.7
// <variant>
@@ -31,7 +32,7 @@
#include "variant_test_helpers.hpp"
struct NonDefaultConstructible {
- NonDefaultConstructible(int) {}
+ constexpr NonDefaultConstructible(int) {}
};
struct NotNoexcept {
@@ -98,6 +99,11 @@ void test_default_ctor_basic() {
assert(std::get<0>(v) == 0);
}
{
+ std::variant<int, NonDefaultConstructible> v;
+ assert(v.index() == 0);
+ assert(std::get<0>(v) == 0);
+ }
+ {
using V = std::variant<int, long>;
constexpr V v;
static_assert(v.index() == 0, "");
@@ -109,6 +115,12 @@ void test_default_ctor_basic() {
static_assert(v.index() == 0, "");
static_assert(std::get<0>(v) == 0, "");
}
+ {
+ using V = std::variant<int, NonDefaultConstructible>;
+ constexpr V v;
+ static_assert(v.index() == 0, "");
+ static_assert(std::get<0>(v) == 0, "");
+ }
}
int main() {
diff --git a/test/std/utilities/variant/variant.variant/variant.ctor/in_place_index_args.pass.cpp b/test/std/utilities/variant/variant.variant/variant.ctor/in_place_index_args.pass.cpp
index af6c662130391..0e1ba7bba7dc8 100644
--- a/test/std/utilities/variant/variant.variant/variant.ctor/in_place_index_args.pass.cpp
+++ b/test/std/utilities/variant/variant.variant/variant.ctor/in_place_index_args.pass.cpp
@@ -10,12 +10,13 @@
// UNSUPPORTED: c++98, c++03, c++11, c++14
-// XFAIL: with_system_cxx_lib=macosx10.12
-// XFAIL: with_system_cxx_lib=macosx10.11
-// XFAIL: with_system_cxx_lib=macosx10.10
-// XFAIL: with_system_cxx_lib=macosx10.9
-// XFAIL: with_system_cxx_lib=macosx10.7
-// XFAIL: with_system_cxx_lib=macosx10.8
+// XFAIL: availability=macosx10.13
+// XFAIL: availability=macosx10.12
+// XFAIL: availability=macosx10.11
+// XFAIL: availability=macosx10.10
+// XFAIL: availability=macosx10.9
+// XFAIL: availability=macosx10.8
+// XFAIL: availability=macosx10.7
// <variant>
diff --git a/test/std/utilities/variant/variant.variant/variant.ctor/in_place_index_init_list_args.pass.cpp b/test/std/utilities/variant/variant.variant/variant.ctor/in_place_index_init_list_args.pass.cpp
index 9d0bf55fb5385..7dcd2541bbae0 100644
--- a/test/std/utilities/variant/variant.variant/variant.ctor/in_place_index_init_list_args.pass.cpp
+++ b/test/std/utilities/variant/variant.variant/variant.ctor/in_place_index_init_list_args.pass.cpp
@@ -12,6 +12,14 @@
// <variant>
+// XFAIL: availability=macosx10.13
+// XFAIL: availability=macosx10.12
+// XFAIL: availability=macosx10.11
+// XFAIL: availability=macosx10.10
+// XFAIL: availability=macosx10.9
+// XFAIL: availability=macosx10.8
+// XFAIL: availability=macosx10.7
+
// template <class ...Types> class variant;
// template <size_t I, class Up, class ...Args>
diff --git a/test/std/utilities/variant/variant.variant/variant.ctor/in_place_type_args.pass.cpp b/test/std/utilities/variant/variant.variant/variant.ctor/in_place_type_args.pass.cpp
index ec2730e8740c7..c798efbaaf464 100644
--- a/test/std/utilities/variant/variant.variant/variant.ctor/in_place_type_args.pass.cpp
+++ b/test/std/utilities/variant/variant.variant/variant.ctor/in_place_type_args.pass.cpp
@@ -10,12 +10,13 @@
// UNSUPPORTED: c++98, c++03, c++11, c++14
-// XFAIL: with_system_cxx_lib=macosx10.12
-// XFAIL: with_system_cxx_lib=macosx10.11
-// XFAIL: with_system_cxx_lib=macosx10.10
-// XFAIL: with_system_cxx_lib=macosx10.9
-// XFAIL: with_system_cxx_lib=macosx10.7
-// XFAIL: with_system_cxx_lib=macosx10.8
+// XFAIL: availability=macosx10.13
+// XFAIL: availability=macosx10.12
+// XFAIL: availability=macosx10.11
+// XFAIL: availability=macosx10.10
+// XFAIL: availability=macosx10.9
+// XFAIL: availability=macosx10.8
+// XFAIL: availability=macosx10.7
// <variant>
diff --git a/test/std/utilities/variant/variant.variant/variant.ctor/in_place_type_init_list_args.pass.cpp b/test/std/utilities/variant/variant.variant/variant.ctor/in_place_type_init_list_args.pass.cpp
index e151572c46668..7d632af9ad04a 100644
--- a/test/std/utilities/variant/variant.variant/variant.ctor/in_place_type_init_list_args.pass.cpp
+++ b/test/std/utilities/variant/variant.variant/variant.ctor/in_place_type_init_list_args.pass.cpp
@@ -12,6 +12,14 @@
// <variant>
+// XFAIL: availability=macosx10.13
+// XFAIL: availability=macosx10.12
+// XFAIL: availability=macosx10.11
+// XFAIL: availability=macosx10.10
+// XFAIL: availability=macosx10.9
+// XFAIL: availability=macosx10.8
+// XFAIL: availability=macosx10.7
+
// template <class ...Types> class variant;
// template <class Tp, class Up, class ...Args>
diff --git a/test/std/utilities/variant/variant.variant/variant.ctor/move.pass.cpp b/test/std/utilities/variant/variant.variant/variant.ctor/move.pass.cpp
index 6b392068d5a97..f593671096713 100644
--- a/test/std/utilities/variant/variant.variant/variant.ctor/move.pass.cpp
+++ b/test/std/utilities/variant/variant.variant/variant.ctor/move.pass.cpp
@@ -10,18 +10,19 @@
// UNSUPPORTED: c++98, c++03, c++11, c++14
-// XFAIL: with_system_cxx_lib=macosx10.12
-// XFAIL: with_system_cxx_lib=macosx10.11
-// XFAIL: with_system_cxx_lib=macosx10.10
-// XFAIL: with_system_cxx_lib=macosx10.9
-// XFAIL: with_system_cxx_lib=macosx10.7
-// XFAIL: with_system_cxx_lib=macosx10.8
+// XFAIL: availability=macosx10.13
+// XFAIL: availability=macosx10.12
+// XFAIL: availability=macosx10.11
+// XFAIL: availability=macosx10.10
+// XFAIL: availability=macosx10.9
+// XFAIL: availability=macosx10.8
+// XFAIL: availability=macosx10.7
// <variant>
// template <class ...Types> class variant;
-// variant(variant&&) noexcept(see below);
+// variant(variant&&) noexcept(see below); // constexpr in C++20
#include <cassert>
#include <string>
@@ -146,7 +147,8 @@ void test_move_ctor_sfinae() {
static_assert(!std::is_move_constructible<V>::value, "");
}
- // The following tests are for not-yet-standardized behavior (P0602):
+ // Make sure we properly propagate triviality (see P0602R4).
+#if TEST_STD_VER > 17
{
using V = std::variant<int, long>;
static_assert(std::is_trivially_move_constructible<V>::value, "");
@@ -164,6 +166,7 @@ void test_move_ctor_sfinae() {
using V = std::variant<int, TMoveNTCopy>;
static_assert(std::is_trivially_move_constructible<V>::value, "");
}
+#endif // > C++17
}
template <typename T>
@@ -213,7 +216,8 @@ void test_move_ctor_basic() {
assert(std::get<1>(v2).value == 42);
}
- // The following tests are for not-yet-standardized behavior (P0602):
+ // Make sure we properly propagate triviality, which implies constexpr-ness (see P0602R4).
+#if TEST_STD_VER > 17
{
struct {
constexpr Result<int> operator()() const {
@@ -286,6 +290,7 @@ void test_move_ctor_basic() {
static_assert(result.index == 1, "");
static_assert(result.value.value == 42, "");
}
+#endif // > C++17
}
void test_move_ctor_valueless_by_exception() {
@@ -299,9 +304,7 @@ void test_move_ctor_valueless_by_exception() {
}
template <size_t Idx>
-constexpr bool test_constexpr_ctor_extension_imp(
- std::variant<long, void*, const int> const& v)
-{
+constexpr bool test_constexpr_ctor_imp(std::variant<long, void*, const int> const& v) {
auto copy = v;
auto v2 = std::move(copy);
return v2.index() == v.index() &&
@@ -309,8 +312,9 @@ constexpr bool test_constexpr_ctor_extension_imp(
std::get<Idx>(v2) == std::get<Idx>(v);
}
-void test_constexpr_move_ctor_extension() {
- // NOTE: This test is for not yet standardized behavior. (P0602)
+void test_constexpr_move_ctor() {
+ // Make sure we properly propagate triviality, which implies constexpr-ness (see P0602R4).
+#if TEST_STD_VER > 17
using V = std::variant<long, void*, const int>;
#ifdef TEST_WORKAROUND_C1XX_BROKEN_IS_TRIVIALLY_COPYABLE
static_assert(std::is_trivially_destructible<V>::value, "");
@@ -322,9 +326,10 @@ void test_constexpr_move_ctor_extension() {
static_assert(std::is_trivially_copyable<V>::value, "");
#endif // TEST_WORKAROUND_C1XX_BROKEN_IS_TRIVIALLY_COPYABLE
static_assert(std::is_trivially_move_constructible<V>::value, "");
- static_assert(test_constexpr_ctor_extension_imp<0>(V(42l)), "");
- static_assert(test_constexpr_ctor_extension_imp<1>(V(nullptr)), "");
- static_assert(test_constexpr_ctor_extension_imp<2>(V(101)), "");
+ static_assert(test_constexpr_ctor_imp<0>(V(42l)), "");
+ static_assert(test_constexpr_ctor_imp<1>(V(nullptr)), "");
+ static_assert(test_constexpr_ctor_imp<2>(V(101)), "");
+#endif // > C++17
}
int main() {
@@ -332,5 +337,5 @@ int main() {
test_move_ctor_valueless_by_exception();
test_move_noexcept();
test_move_ctor_sfinae();
- test_constexpr_move_ctor_extension();
+ test_constexpr_move_ctor();
}
diff --git a/test/std/utilities/variant/variant.variant/variant.mod/emplace_index_args.pass.cpp b/test/std/utilities/variant/variant.variant/variant.mod/emplace_index_args.pass.cpp
index 20848db0fc70c..d281927c74239 100644
--- a/test/std/utilities/variant/variant.variant/variant.mod/emplace_index_args.pass.cpp
+++ b/test/std/utilities/variant/variant.variant/variant.mod/emplace_index_args.pass.cpp
@@ -10,12 +10,13 @@
// UNSUPPORTED: c++98, c++03, c++11, c++14
-// XFAIL: with_system_cxx_lib=macosx10.12
-// XFAIL: with_system_cxx_lib=macosx10.11
-// XFAIL: with_system_cxx_lib=macosx10.10
-// XFAIL: with_system_cxx_lib=macosx10.9
-// XFAIL: with_system_cxx_lib=macosx10.7
-// XFAIL: with_system_cxx_lib=macosx10.8
+// XFAIL: availability=macosx10.13
+// XFAIL: availability=macosx10.12
+// XFAIL: availability=macosx10.11
+// XFAIL: availability=macosx10.10
+// XFAIL: availability=macosx10.9
+// XFAIL: availability=macosx10.8
+// XFAIL: availability=macosx10.7
// <variant>
diff --git a/test/std/utilities/variant/variant.variant/variant.mod/emplace_index_init_list_args.pass.cpp b/test/std/utilities/variant/variant.variant/variant.mod/emplace_index_init_list_args.pass.cpp
index 28a0c582853be..939e8f39dc05f 100644
--- a/test/std/utilities/variant/variant.variant/variant.mod/emplace_index_init_list_args.pass.cpp
+++ b/test/std/utilities/variant/variant.variant/variant.mod/emplace_index_init_list_args.pass.cpp
@@ -10,12 +10,13 @@
// UNSUPPORTED: c++98, c++03, c++11, c++14
-// XFAIL: with_system_cxx_lib=macosx10.12
-// XFAIL: with_system_cxx_lib=macosx10.11
-// XFAIL: with_system_cxx_lib=macosx10.10
-// XFAIL: with_system_cxx_lib=macosx10.9
-// XFAIL: with_system_cxx_lib=macosx10.7
-// XFAIL: with_system_cxx_lib=macosx10.8
+// XFAIL: availability=macosx10.13
+// XFAIL: availability=macosx10.12
+// XFAIL: availability=macosx10.11
+// XFAIL: availability=macosx10.10
+// XFAIL: availability=macosx10.9
+// XFAIL: availability=macosx10.8
+// XFAIL: availability=macosx10.7
// <variant>
diff --git a/test/std/utilities/variant/variant.variant/variant.mod/emplace_type_args.pass.cpp b/test/std/utilities/variant/variant.variant/variant.mod/emplace_type_args.pass.cpp
index 923ffd33a75cc..4fed141675154 100644
--- a/test/std/utilities/variant/variant.variant/variant.mod/emplace_type_args.pass.cpp
+++ b/test/std/utilities/variant/variant.variant/variant.mod/emplace_type_args.pass.cpp
@@ -10,12 +10,13 @@
// UNSUPPORTED: c++98, c++03, c++11, c++14
-// XFAIL: with_system_cxx_lib=macosx10.12
-// XFAIL: with_system_cxx_lib=macosx10.11
-// XFAIL: with_system_cxx_lib=macosx10.10
-// XFAIL: with_system_cxx_lib=macosx10.9
-// XFAIL: with_system_cxx_lib=macosx10.7
-// XFAIL: with_system_cxx_lib=macosx10.8
+// XFAIL: availability=macosx10.13
+// XFAIL: availability=macosx10.12
+// XFAIL: availability=macosx10.11
+// XFAIL: availability=macosx10.10
+// XFAIL: availability=macosx10.9
+// XFAIL: availability=macosx10.8
+// XFAIL: availability=macosx10.7
// <variant>
diff --git a/test/std/utilities/variant/variant.variant/variant.mod/emplace_type_init_list_args.pass.cpp b/test/std/utilities/variant/variant.variant/variant.mod/emplace_type_init_list_args.pass.cpp
index c01d333441a98..f03e95644e54a 100644
--- a/test/std/utilities/variant/variant.variant/variant.mod/emplace_type_init_list_args.pass.cpp
+++ b/test/std/utilities/variant/variant.variant/variant.mod/emplace_type_init_list_args.pass.cpp
@@ -10,12 +10,13 @@
// UNSUPPORTED: c++98, c++03, c++11, c++14
-// XFAIL: with_system_cxx_lib=macosx10.12
-// XFAIL: with_system_cxx_lib=macosx10.11
-// XFAIL: with_system_cxx_lib=macosx10.10
-// XFAIL: with_system_cxx_lib=macosx10.9
-// XFAIL: with_system_cxx_lib=macosx10.7
-// XFAIL: with_system_cxx_lib=macosx10.8
+// XFAIL: availability=macosx10.13
+// XFAIL: availability=macosx10.12
+// XFAIL: availability=macosx10.11
+// XFAIL: availability=macosx10.10
+// XFAIL: availability=macosx10.9
+// XFAIL: availability=macosx10.8
+// XFAIL: availability=macosx10.7
// <variant>
diff --git a/test/std/utilities/variant/variant.variant/variant.status/index.pass.cpp b/test/std/utilities/variant/variant.variant/variant.status/index.pass.cpp
index 8025b9e0774eb..6d78de3a48ba8 100644
--- a/test/std/utilities/variant/variant.variant/variant.status/index.pass.cpp
+++ b/test/std/utilities/variant/variant.variant/variant.status/index.pass.cpp
@@ -10,14 +10,6 @@
// UNSUPPORTED: c++98, c++03, c++11, c++14
-// The following compilers don't consider a type an aggregate type (and
-// consequently not a literal type) if it has a base class at all.
-// In C++17, an aggregate type is allowed to have a base class if it's not
-// virtual, private, nor protected (e.g. ConstexprTestTypes:::NoCtors).
-// XFAIL: gcc-5, gcc-6
-// XFAIL: clang-3.5, clang-3.6, clang-3.7, clang-3.8
-// XFAIL: apple-clang-6, apple-clang-7, apple-clang-8.0
-
// <variant>
// template <class ...Types> class variant;
@@ -33,14 +25,20 @@
#include "test_macros.h"
#include "variant_test_helpers.hpp"
+
int main() {
{
- using V = std::variant<int, ConstexprTestTypes::NoCtors>;
+ using V = std::variant<int, long>;
constexpr V v;
static_assert(v.index() == 0, "");
}
{
using V = std::variant<int, long>;
+ V v;
+ assert(v.index() == 0);
+ }
+ {
+ using V = std::variant<int, long>;
constexpr V v(std::in_place_index<1>);
static_assert(v.index() == 1, "");
}
diff --git a/test/std/utilities/variant/variant.variant/variant.status/valueless_by_exception.pass.cpp b/test/std/utilities/variant/variant.variant/variant.status/valueless_by_exception.pass.cpp
index 660a21c4f31d3..9ccdc22219945 100644
--- a/test/std/utilities/variant/variant.variant/variant.status/valueless_by_exception.pass.cpp
+++ b/test/std/utilities/variant/variant.variant/variant.status/valueless_by_exception.pass.cpp
@@ -10,14 +10,6 @@
// UNSUPPORTED: c++98, c++03, c++11, c++14
-// The following compilers don't consider a type an aggregate type (and
-// consequently not a literal type) if it has a base class at all.
-// In C++17, an aggregate type is allowed to have a base class if it's not
-// virtual, private, nor protected (e.g. ConstexprTestTypes:::NoCtors).
-// XFAIL: gcc-5, gcc-6
-// XFAIL: clang-3.5, clang-3.6, clang-3.7, clang-3.8
-// XFAIL: apple-clang-6, apple-clang-7, apple-clang-8.0
-
// <variant>
// template <class ...Types> class variant;
@@ -33,13 +25,19 @@
#include "test_macros.h"
#include "variant_test_helpers.hpp"
+
int main() {
{
- using V = std::variant<int, ConstexprTestTypes::NoCtors>;
+ using V = std::variant<int, long>;
constexpr V v;
static_assert(!v.valueless_by_exception(), "");
}
{
+ using V = std::variant<int, long>;
+ V v;
+ assert(!v.valueless_by_exception());
+ }
+ {
using V = std::variant<int, long, std::string>;
const V v("abc");
assert(!v.valueless_by_exception());
diff --git a/test/std/utilities/variant/variant.variant/variant.swap/swap.pass.cpp b/test/std/utilities/variant/variant.variant/variant.swap/swap.pass.cpp
index b81b3ff6a9679..ec85ce7679b4f 100644
--- a/test/std/utilities/variant/variant.variant/variant.swap/swap.pass.cpp
+++ b/test/std/utilities/variant/variant.variant/variant.swap/swap.pass.cpp
@@ -10,12 +10,13 @@
// UNSUPPORTED: c++98, c++03, c++11, c++14
-// XFAIL: with_system_cxx_lib=macosx10.12
-// XFAIL: with_system_cxx_lib=macosx10.11
-// XFAIL: with_system_cxx_lib=macosx10.10
-// XFAIL: with_system_cxx_lib=macosx10.9
-// XFAIL: with_system_cxx_lib=macosx10.7
-// XFAIL: with_system_cxx_lib=macosx10.8
+// XFAIL: availability=macosx10.13
+// XFAIL: availability=macosx10.12
+// XFAIL: availability=macosx10.11
+// XFAIL: availability=macosx10.10
+// XFAIL: availability=macosx10.9
+// XFAIL: availability=macosx10.8
+// XFAIL: availability=macosx10.7
// <variant>
diff --git a/test/std/utilities/variant/variant.visit/visit.pass.cpp b/test/std/utilities/variant/variant.visit/visit.pass.cpp
index c0db967933b08..693369abb2d50 100644
--- a/test/std/utilities/variant/variant.visit/visit.pass.cpp
+++ b/test/std/utilities/variant/variant.visit/visit.pass.cpp
@@ -10,12 +10,13 @@
// UNSUPPORTED: c++98, c++03, c++11, c++14
-// XFAIL: with_system_cxx_lib=macosx10.12
-// XFAIL: with_system_cxx_lib=macosx10.11
-// XFAIL: with_system_cxx_lib=macosx10.10
-// XFAIL: with_system_cxx_lib=macosx10.9
-// XFAIL: with_system_cxx_lib=macosx10.7
-// XFAIL: with_system_cxx_lib=macosx10.8
+// XFAIL: availability=macosx10.13
+// XFAIL: availability=macosx10.12
+// XFAIL: availability=macosx10.11
+// XFAIL: availability=macosx10.10
+// XFAIL: availability=macosx10.9
+// XFAIL: availability=macosx10.8
+// XFAIL: availability=macosx10.7
// <variant>
// template <class Visitor, class... Variants>
diff --git a/test/support/any_helpers.h b/test/support/any_helpers.h
index afc85c97ff46d..ec8654d1903c5 100644
--- a/test/support/any_helpers.h
+++ b/test/support/any_helpers.h
@@ -68,6 +68,7 @@ template <class> constexpr bool has_value_member(long) { return false; }
// Assert that an 'any' object stores the specified 'Type' and 'value'.
template <class Type>
std::enable_if_t<has_value_member<Type>(0)>
+_LIBCPP_AVAILABILITY_THROW_BAD_ANY_CAST
assertContains(std::any const& a, int value) {
assert(a.has_value());
assert(containsType<Type>(a));
@@ -76,6 +77,7 @@ assertContains(std::any const& a, int value) {
template <class Type, class Value>
std::enable_if_t<!has_value_member<Type>(0)>
+_LIBCPP_AVAILABILITY_THROW_BAD_ANY_CAST
assertContains(std::any const& a, Value value) {
assert(a.has_value());
assert(containsType<Type>(a));
@@ -86,6 +88,7 @@ assertContains(std::any const& a, Value value) {
// Modify the value of a "test type" stored within an any to the specified
// 'value'.
template <class Type>
+_LIBCPP_AVAILABILITY_THROW_BAD_ANY_CAST
void modifyValue(std::any& a, int value) {
using namespace std;
using namespace std::experimental;
diff --git a/test/support/archetypes.hpp b/test/support/archetypes.hpp
index 533f5869b5ab2..a0ea7c3ce8e1b 100644
--- a/test/support/archetypes.hpp
+++ b/test/support/archetypes.hpp
@@ -225,7 +225,6 @@ namespace ExplicitTypes {
#include "archetypes.ipp"
}
-
//============================================================================//
//
namespace NonConstexprTypes {
@@ -242,11 +241,17 @@ namespace NonLiteralTypes {
}
//============================================================================//
+// Non-throwing implicit test types
+namespace NonThrowingTypes {
+#define DEFINE_NOEXCEPT noexcept
+#include "archetypes.ipp"
+}
+
+//============================================================================//
// Non-Trivially Copyable Implicit Test Types
namespace NonTrivialTypes {
#define DEFINE_CTOR {}
#define DEFINE_ASSIGN { return *this; }
-#define DEFINE_DEFAULT_CTOR = default
#include "archetypes.ipp"
}
@@ -314,7 +319,7 @@ constexpr bool operator!=(Tp const& L, Tp const& R) noexcept {
return L.value != R.value;
}
-} // end namespace ValueTypes
+} // end namespace ConstexprTestTypes
//============================================================================//
@@ -337,7 +342,7 @@ constexpr bool operator!=(Tp const& L, Tp const& R) noexcept {
return L.value != R.value;
}
-} // end namespace ValueTypes
+} // end namespace ExplicitConstexprTestTypes
//============================================================================//
@@ -359,7 +364,7 @@ constexpr bool operator!=(Tp const& L, Tp const& R) noexcept {
return L.value != R.value;
}
-} // end namespace TrivialValueTypes
+} // end namespace TrivialTestTypes
//============================================================================//
//
diff --git a/test/support/archetypes.ipp b/test/support/archetypes.ipp
index 36045017907f0..943dcf9f5d8a8 100644
--- a/test/support/archetypes.ipp
+++ b/test/support/archetypes.ipp
@@ -5,6 +5,9 @@
#ifndef DEFINE_EXPLICIT
#define DEFINE_EXPLICIT
#endif
+#ifndef DEFINE_NOEXCEPT
+#define DEFINE_NOEXCEPT
+#endif
#ifndef DEFINE_CONSTEXPR
#ifdef TEST_WORKAROUND_EDG_EXPLICIT_CONSTEXPR
#define DEFINE_CONSTEXPR
@@ -36,114 +39,114 @@ struct AllCtors : DEFINE_BASE(AllCtors) {
using Base = DEFINE_BASE(AllCtors);
using Base::Base;
using Base::operator=;
- DEFINE_EXPLICIT DEFINE_CONSTEXPR AllCtors() DEFINE_DEFAULT_CTOR;
- DEFINE_EXPLICIT DEFINE_CONSTEXPR AllCtors(AllCtors const&) DEFINE_CTOR;
- DEFINE_EXPLICIT DEFINE_CONSTEXPR AllCtors(AllCtors &&) DEFINE_CTOR;
- DEFINE_ASSIGN_CONSTEXPR AllCtors& operator=(AllCtors const&) DEFINE_ASSIGN;
- DEFINE_ASSIGN_CONSTEXPR AllCtors& operator=(AllCtors &&) DEFINE_ASSIGN;
+ DEFINE_EXPLICIT DEFINE_CONSTEXPR AllCtors() DEFINE_NOEXCEPT DEFINE_DEFAULT_CTOR;
+ DEFINE_EXPLICIT DEFINE_CONSTEXPR AllCtors(AllCtors const&) DEFINE_NOEXCEPT DEFINE_CTOR;
+ DEFINE_EXPLICIT DEFINE_CONSTEXPR AllCtors(AllCtors &&) DEFINE_NOEXCEPT DEFINE_CTOR;
+ DEFINE_ASSIGN_CONSTEXPR AllCtors& operator=(AllCtors const&) DEFINE_NOEXCEPT DEFINE_ASSIGN;
+ DEFINE_ASSIGN_CONSTEXPR AllCtors& operator=(AllCtors &&) DEFINE_NOEXCEPT DEFINE_ASSIGN;
DEFINE_DTOR(AllCtors)
};
struct NoCtors : DEFINE_BASE(NoCtors) {
using Base = DEFINE_BASE(NoCtors);
- DEFINE_EXPLICIT NoCtors() = delete;
- DEFINE_EXPLICIT NoCtors(NoCtors const&) = delete;
- NoCtors& operator=(NoCtors const&) = delete;
+ DEFINE_EXPLICIT NoCtors() DEFINE_NOEXCEPT = delete;
+ DEFINE_EXPLICIT NoCtors(NoCtors const&) DEFINE_NOEXCEPT = delete;
+ NoCtors& operator=(NoCtors const&) DEFINE_NOEXCEPT = delete;
DEFINE_DTOR(NoCtors)
};
struct NoDefault : DEFINE_BASE(NoDefault) {
using Base = DEFINE_BASE(NoDefault);
using Base::Base;
- DEFINE_EXPLICIT DEFINE_CONSTEXPR NoDefault() = delete;
+ DEFINE_EXPLICIT DEFINE_CONSTEXPR NoDefault() DEFINE_NOEXCEPT = delete;
DEFINE_DTOR(NoDefault)
};
struct DefaultOnly : DEFINE_BASE(DefaultOnly) {
using Base = DEFINE_BASE(DefaultOnly);
using Base::Base;
- DEFINE_EXPLICIT DEFINE_CONSTEXPR DefaultOnly() DEFINE_DEFAULT_CTOR;
- DefaultOnly(DefaultOnly const&) = delete;
- DefaultOnly& operator=(DefaultOnly const&) = delete;
+ DEFINE_EXPLICIT DEFINE_CONSTEXPR DefaultOnly() DEFINE_NOEXCEPT DEFINE_DEFAULT_CTOR;
+ DefaultOnly(DefaultOnly const&) DEFINE_NOEXCEPT = delete;
+ DefaultOnly& operator=(DefaultOnly const&) DEFINE_NOEXCEPT = delete;
DEFINE_DTOR(DefaultOnly)
};
struct Copyable : DEFINE_BASE(Copyable) {
using Base = DEFINE_BASE(Copyable);
using Base::Base;
- DEFINE_EXPLICIT DEFINE_CONSTEXPR Copyable() DEFINE_DEFAULT_CTOR;
- DEFINE_EXPLICIT DEFINE_CONSTEXPR Copyable(Copyable const &) DEFINE_CTOR;
- Copyable &operator=(Copyable const &) DEFINE_ASSIGN;
+ DEFINE_EXPLICIT DEFINE_CONSTEXPR Copyable() DEFINE_NOEXCEPT DEFINE_DEFAULT_CTOR;
+ DEFINE_EXPLICIT DEFINE_CONSTEXPR Copyable(Copyable const &) DEFINE_NOEXCEPT DEFINE_CTOR;
+ Copyable &operator=(Copyable const &) DEFINE_NOEXCEPT DEFINE_ASSIGN;
DEFINE_DTOR(Copyable)
};
struct CopyOnly : DEFINE_BASE(CopyOnly) {
using Base = DEFINE_BASE(CopyOnly);
using Base::Base;
- DEFINE_EXPLICIT DEFINE_CONSTEXPR CopyOnly() DEFINE_DEFAULT_CTOR;
- DEFINE_EXPLICIT DEFINE_CONSTEXPR CopyOnly(CopyOnly const &) DEFINE_CTOR;
- DEFINE_EXPLICIT DEFINE_CONSTEXPR CopyOnly(CopyOnly &&) = delete;
- CopyOnly &operator=(CopyOnly const &) DEFINE_ASSIGN;
- CopyOnly &operator=(CopyOnly &&) = delete;
+ DEFINE_EXPLICIT DEFINE_CONSTEXPR CopyOnly() DEFINE_NOEXCEPT DEFINE_DEFAULT_CTOR;
+ DEFINE_EXPLICIT DEFINE_CONSTEXPR CopyOnly(CopyOnly const &) DEFINE_NOEXCEPT DEFINE_CTOR;
+ DEFINE_EXPLICIT DEFINE_CONSTEXPR CopyOnly(CopyOnly &&) DEFINE_NOEXCEPT = delete;
+ CopyOnly &operator=(CopyOnly const &) DEFINE_NOEXCEPT DEFINE_ASSIGN;
+ CopyOnly &operator=(CopyOnly &&) DEFINE_NOEXCEPT = delete;
DEFINE_DTOR(CopyOnly)
};
struct NonCopyable : DEFINE_BASE(NonCopyable) {
using Base = DEFINE_BASE(NonCopyable);
using Base::Base;
- DEFINE_EXPLICIT DEFINE_CONSTEXPR NonCopyable() DEFINE_DEFAULT_CTOR;
- DEFINE_EXPLICIT DEFINE_CONSTEXPR NonCopyable(NonCopyable const &) = delete;
- NonCopyable &operator=(NonCopyable const &) = delete;
+ DEFINE_EXPLICIT DEFINE_CONSTEXPR NonCopyable() DEFINE_NOEXCEPT DEFINE_DEFAULT_CTOR;
+ DEFINE_EXPLICIT DEFINE_CONSTEXPR NonCopyable(NonCopyable const &) DEFINE_NOEXCEPT = delete;
+ NonCopyable &operator=(NonCopyable const &) DEFINE_NOEXCEPT = delete;
DEFINE_DTOR(NonCopyable)
};
struct MoveOnly : DEFINE_BASE(MoveOnly) {
using Base = DEFINE_BASE(MoveOnly);
using Base::Base;
- DEFINE_EXPLICIT DEFINE_CONSTEXPR MoveOnly() DEFINE_DEFAULT_CTOR;
- DEFINE_EXPLICIT DEFINE_CONSTEXPR MoveOnly(MoveOnly &&) DEFINE_CTOR;
- MoveOnly &operator=(MoveOnly &&) DEFINE_ASSIGN;
+ DEFINE_EXPLICIT DEFINE_CONSTEXPR MoveOnly() DEFINE_NOEXCEPT DEFINE_DEFAULT_CTOR;
+ DEFINE_EXPLICIT DEFINE_CONSTEXPR MoveOnly(MoveOnly &&) DEFINE_NOEXCEPT DEFINE_CTOR;
+ MoveOnly &operator=(MoveOnly &&) DEFINE_NOEXCEPT DEFINE_ASSIGN;
DEFINE_DTOR(MoveOnly)
};
struct CopyAssignable : DEFINE_BASE(CopyAssignable) {
using Base = DEFINE_BASE(CopyAssignable);
using Base::Base;
- DEFINE_EXPLICIT DEFINE_CONSTEXPR CopyAssignable() = delete;
- CopyAssignable& operator=(CopyAssignable const&) DEFINE_ASSIGN;
+ DEFINE_EXPLICIT DEFINE_CONSTEXPR CopyAssignable() DEFINE_NOEXCEPT = delete;
+ CopyAssignable& operator=(CopyAssignable const&) DEFINE_NOEXCEPT DEFINE_ASSIGN;
DEFINE_DTOR(CopyAssignable)
};
struct CopyAssignOnly : DEFINE_BASE(CopyAssignOnly) {
using Base = DEFINE_BASE(CopyAssignOnly);
using Base::Base;
- DEFINE_EXPLICIT DEFINE_CONSTEXPR CopyAssignOnly() = delete;
- CopyAssignOnly& operator=(CopyAssignOnly const&) DEFINE_ASSIGN;
- CopyAssignOnly& operator=(CopyAssignOnly &&) = delete;
+ DEFINE_EXPLICIT DEFINE_CONSTEXPR CopyAssignOnly() DEFINE_NOEXCEPT = delete;
+ CopyAssignOnly& operator=(CopyAssignOnly const&) DEFINE_NOEXCEPT DEFINE_ASSIGN;
+ CopyAssignOnly& operator=(CopyAssignOnly &&) DEFINE_NOEXCEPT = delete;
DEFINE_DTOR(CopyAssignOnly)
};
struct MoveAssignOnly : DEFINE_BASE(MoveAssignOnly) {
using Base = DEFINE_BASE(MoveAssignOnly);
using Base::Base;
- DEFINE_EXPLICIT DEFINE_CONSTEXPR MoveAssignOnly() = delete;
- MoveAssignOnly& operator=(MoveAssignOnly const&) = delete;
- MoveAssignOnly& operator=(MoveAssignOnly &&) DEFINE_ASSIGN;
+ DEFINE_EXPLICIT DEFINE_CONSTEXPR MoveAssignOnly() DEFINE_NOEXCEPT = delete;
+ MoveAssignOnly& operator=(MoveAssignOnly const&) DEFINE_NOEXCEPT = delete;
+ MoveAssignOnly& operator=(MoveAssignOnly &&) DEFINE_NOEXCEPT DEFINE_ASSIGN;
DEFINE_DTOR(MoveAssignOnly)
};
struct ConvertingType : DEFINE_BASE(ConvertingType) {
using Base = DEFINE_BASE(ConvertingType);
using Base::Base;
- DEFINE_EXPLICIT DEFINE_CONSTEXPR ConvertingType() DEFINE_DEFAULT_CTOR;
- DEFINE_EXPLICIT DEFINE_CONSTEXPR ConvertingType(ConvertingType const&) DEFINE_CTOR;
- DEFINE_EXPLICIT DEFINE_CONSTEXPR ConvertingType(ConvertingType &&) DEFINE_CTOR;
- ConvertingType& operator=(ConvertingType const&) DEFINE_ASSIGN;
- ConvertingType& operator=(ConvertingType &&) DEFINE_ASSIGN;
+ DEFINE_EXPLICIT DEFINE_CONSTEXPR ConvertingType() DEFINE_NOEXCEPT DEFINE_DEFAULT_CTOR;
+ DEFINE_EXPLICIT DEFINE_CONSTEXPR ConvertingType(ConvertingType const&) DEFINE_NOEXCEPT DEFINE_CTOR;
+ DEFINE_EXPLICIT DEFINE_CONSTEXPR ConvertingType(ConvertingType &&) DEFINE_NOEXCEPT DEFINE_CTOR;
+ ConvertingType& operator=(ConvertingType const&) DEFINE_NOEXCEPT DEFINE_ASSIGN;
+ ConvertingType& operator=(ConvertingType &&) DEFINE_NOEXCEPT DEFINE_ASSIGN;
template <class ...Args>
- DEFINE_EXPLICIT DEFINE_CONSTEXPR ConvertingType(Args&&...) {}
+ DEFINE_EXPLICIT DEFINE_CONSTEXPR ConvertingType(Args&&...) DEFINE_NOEXCEPT {}
template <class Arg>
- ConvertingType& operator=(Arg&&) { return *this; }
+ ConvertingType& operator=(Arg&&) DEFINE_NOEXCEPT { return *this; }
DEFINE_DTOR(ConvertingType)
};
@@ -165,6 +168,7 @@ using ApplyTypes = List<
#undef DEFINE_BASE
#undef DEFINE_EXPLICIT
+#undef DEFINE_NOEXCEPT
#undef DEFINE_CONSTEXPR
#undef DEFINE_ASSIGN_CONSTEXPR
#undef DEFINE_CTOR
diff --git a/test/support/counting_predicates.hpp b/test/support/counting_predicates.hpp
index 050b51b75bb1f..a0b3ca518eccf 100644
--- a/test/support/counting_predicates.hpp
+++ b/test/support/counting_predicates.hpp
@@ -7,9 +7,10 @@
//
//===----------------------------------------------------------------------===//
-#ifndef __COUNTING_PREDICATES_H
-#define __COUNTING_PREDICATES_H
+#ifndef TEST_SUPPORT_COUNTING_PREDICATES_H
+#define TEST_SUPPORT_COUNTING_PREDICATES_H
+#include <cstddef>
template <typename Predicate, typename Arg>
struct unary_counting_predicate {
@@ -27,7 +28,7 @@ public:
private:
Predicate p_;
mutable size_t count_;
- };
+};
template <typename Predicate, typename Arg1, typename Arg2=Arg1>
@@ -47,6 +48,6 @@ public:
private:
Predicate p_;
mutable size_t count_;
- };
+};
-#endif // __COUNTING_PREDICATES_H
+#endif // TEST_SUPPORT_COUNTING_PREDICATES_H
diff --git a/test/support/filesystem_dynamic_test_helper.py b/test/support/filesystem_dynamic_test_helper.py
index 081e678b6e844..0789582749785 100644
--- a/test/support/filesystem_dynamic_test_helper.py
+++ b/test/support/filesystem_dynamic_test_helper.py
@@ -1,10 +1,12 @@
import sys
import os
+import socket
import stat
# Ensure that this is being run on a specific platform
assert sys.platform.startswith('linux') or sys.platform.startswith('darwin') \
- or sys.platform.startswith('cygwin') or sys.platform.startswith('freebsd')
+ or sys.platform.startswith('cygwin') or sys.platform.startswith('freebsd') \
+ or sys.platform.startswith('netbsd')
def env_path():
ep = os.environ.get('LIBCXX_FILESYSTEM_DYNAMIC_TEST_ROOT')
@@ -75,8 +77,13 @@ def create_fifo(source):
def create_socket(source):
- mode = 0o600 | stat.S_IFSOCK
- os.mknod(sanitize(source), mode)
+ sock = socket.socket(socket.AF_UNIX)
+ sanitized_source = sanitize(source)
+ # AF_UNIX sockets may have very limited path length, so split it
+ # into chdir call (with technically unlimited length) followed
+ # by bind() relative to the directory
+ os.chdir(os.path.dirname(sanitized_source))
+ sock.bind(os.path.basename(sanitized_source))
if __name__ == '__main__':
diff --git a/test/support/filesystem_test_helper.hpp b/test/support/filesystem_test_helper.hpp
index f027928700b96..467abd5fc6727 100644
--- a/test/support/filesystem_test_helper.hpp
+++ b/test/support/filesystem_test_helper.hpp
@@ -2,6 +2,9 @@
#define FILESYSTEM_TEST_HELPER_HPP
#include "filesystem_include.hpp"
+
+#include <unistd.h> // for ftruncate
+
#include <cassert>
#include <cstdio> // for printf
#include <string>
@@ -147,13 +150,46 @@ struct scoped_test_env
return raw;
}
- std::string create_file(std::string filename, std::size_t size = 0) {
+ // Purposefully using a size potentially larger than off_t here so we can
+ // test the behavior of libc++fs when it is built with _FILE_OFFSET_BITS=64
+ // but the caller is not (std::filesystem also uses uintmax_t rather than
+ // off_t). On a 32-bit system this allows us to create a file larger than
+ // 2GB.
+ std::string create_file(std::string filename, uintmax_t size = 0) {
+#if defined(__LP64__)
+ auto large_file_fopen = fopen;
+ auto large_file_ftruncate = ftruncate;
+ using large_file_offset_t = off_t;
+#else
+ auto large_file_fopen = fopen64;
+ auto large_file_ftruncate = ftruncate64;
+ using large_file_offset_t = off64_t;
+#endif
+
filename = sanitize_path(std::move(filename));
- std::string out_str(size, 'a');
- {
- std::ofstream out(filename.c_str());
- out << out_str;
+
+ if (size > std::numeric_limits<large_file_offset_t>::max()) {
+ fprintf(stderr, "create_file(%s, %ju) too large\n",
+ filename.c_str(), size);
+ abort();
}
+
+ FILE* file = large_file_fopen(filename.c_str(), "we");
+ if (file == nullptr) {
+ fprintf(stderr, "fopen %s failed: %s\n", filename.c_str(),
+ strerror(errno));
+ abort();
+ }
+
+ if (large_file_ftruncate(
+ fileno(file), static_cast<large_file_offset_t>(size)) == -1) {
+ fprintf(stderr, "ftruncate %s %ju failed: %s\n", filename.c_str(),
+ size, strerror(errno));
+ fclose(file);
+ abort();
+ }
+
+ fclose(file);
return filename;
}
diff --git a/test/support/min_allocator.h b/test/support/min_allocator.h
index a3af9e1db66d0..454749397441d 100644
--- a/test/support/min_allocator.h
+++ b/test/support/min_allocator.h
@@ -14,6 +14,7 @@
#include <cstdlib>
#include <cstddef>
#include <cassert>
+#include <climits>
#include "test_macros.h"
@@ -131,6 +132,59 @@ public:
friend bool operator!=(malloc_allocator x, malloc_allocator y) {return !(x == y);}
};
+template <class T>
+struct cpp03_allocator : bare_allocator<T>
+{
+ typedef T value_type;
+ typedef value_type* pointer;
+
+ static bool construct_called;
+
+ // Returned value is not used but it's not prohibited.
+ pointer construct(pointer p, const value_type& val)
+ {
+ ::new(p) value_type(val);
+ construct_called = true;
+ return p;
+ }
+
+ std::size_t max_size() const
+ {
+ return UINT_MAX / sizeof(T);
+ }
+};
+template <class T> bool cpp03_allocator<T>::construct_called = false;
+
+template <class T>
+struct cpp03_overload_allocator : bare_allocator<T>
+{
+ typedef T value_type;
+ typedef value_type* pointer;
+
+ static bool construct_called;
+
+ void construct(pointer p, const value_type& val)
+ {
+ construct(p, val, std::is_class<T>());
+ }
+ void construct(pointer p, const value_type& val, std::true_type)
+ {
+ ::new(p) value_type(val);
+ construct_called = true;
+ }
+ void construct(pointer p, const value_type& val, std::false_type)
+ {
+ ::new(p) value_type(val);
+ construct_called = true;
+ }
+
+ std::size_t max_size() const
+ {
+ return UINT_MAX / sizeof(T);
+ }
+};
+template <class T> bool cpp03_overload_allocator<T>::construct_called = false;
+
#if TEST_STD_VER >= 11
diff --git a/test/support/nasty_macros.hpp b/test/support/nasty_macros.hpp
index 76d8ab0e720f6..3c2a5e27a96e2 100644
--- a/test/support/nasty_macros.hpp
+++ b/test/support/nasty_macros.hpp
@@ -22,7 +22,11 @@
#define _J NASTY_MACRO
#define _K NASTY_MACRO
#define _L NASTY_MACRO
+// Because FreeBSD uses _M in its <sys/types.h>, and it is hard to avoid
+// including that header, only define _M for other operating systems.
+#ifndef __FreeBSD__
#define _M NASTY_MACRO
+#endif
#define _N NASTY_MACRO
#define _O NASTY_MACRO
#define _P NASTY_MACRO
@@ -45,6 +49,9 @@
#define _CRPC NASTY_MACRO
#define _CPC NASTY_MACRO
+// yvals.h on MINGW defines this macro
+#define _C2 NASTY_MACRO
+
// Test that libc++ doesn't use names reserved by WIN32 API Macros.
// NOTE: Obviously we can only define these on non-windows platforms.
#ifndef _WIN32
diff --git a/test/support/poisoned_hash_helper.hpp b/test/support/poisoned_hash_helper.hpp
index 6f42ebf8b480c..07cb7269215e9 100644
--- a/test/support/poisoned_hash_helper.hpp
+++ b/test/support/poisoned_hash_helper.hpp
@@ -147,7 +147,6 @@ void test_hash_enabled(InputKey const& key) {
#endif
// Hashable requirements
- using CKey = ConvertibleTo<Key>;
static_assert(can_hash<Hash(Key&)>(), "");
static_assert(can_hash<Hash(Key const&)>(), "");
static_assert(can_hash<Hash(Key&&)>(), "");
@@ -187,7 +186,6 @@ void test_hash_disabled() {
>::value, "");
// Hashable requirements
- using CKey = ConvertibleTo<Key>;
static_assert(!can_hash<Hash(Key&)>(), "");
static_assert(!can_hash<Hash(Key const&)>(), "");
static_assert(!can_hash<Hash(Key&&)>(), "");
diff --git a/test/support/test_comparisons.h b/test/support/test_comparisons.h
index a3f8dd9f8c35f..cf094eb65b82b 100644
--- a/test/support/test_comparisons.h
+++ b/test/support/test_comparisons.h
@@ -23,8 +23,8 @@
#include "test_macros.h"
// Test all six comparison operations for sanity
-template <class T>
-TEST_CONSTEXPR_CXX14 bool testComparisons6(const T& t1, const T& t2, bool isEqual, bool isLess)
+template <class T, class U = T>
+TEST_CONSTEXPR_CXX14 bool testComparisons6(const T& t1, const U& t2, bool isEqual, bool isLess)
{
if (isEqual)
{
@@ -81,47 +81,47 @@ TEST_CONSTEXPR_CXX14 bool testComparisons6Values(Param val1, Param val2)
{
const bool isEqual = val1 == val2;
const bool isLess = val1 < val2;
-
- return testComparisons6(T{val1}, T{val2}, isEqual, isLess);
+
+ return testComparisons6(T(val1), T(val2), isEqual, isLess);
}
-template <class T>
+template <class T, class U = T>
void AssertComparisons6AreNoexcept()
{
- ASSERT_NOEXCEPT(std::declval<const T&>() == std::declval<const T&>());
- ASSERT_NOEXCEPT(std::declval<const T&>() != std::declval<const T&>());
- ASSERT_NOEXCEPT(std::declval<const T&>() < std::declval<const T&>());
- ASSERT_NOEXCEPT(std::declval<const T&>() <= std::declval<const T&>());
- ASSERT_NOEXCEPT(std::declval<const T&>() > std::declval<const T&>());
- ASSERT_NOEXCEPT(std::declval<const T&>() >= std::declval<const T&>());
+ ASSERT_NOEXCEPT(std::declval<const T&>() == std::declval<const U&>());
+ ASSERT_NOEXCEPT(std::declval<const T&>() != std::declval<const U&>());
+ ASSERT_NOEXCEPT(std::declval<const T&>() < std::declval<const U&>());
+ ASSERT_NOEXCEPT(std::declval<const T&>() <= std::declval<const U&>());
+ ASSERT_NOEXCEPT(std::declval<const T&>() > std::declval<const U&>());
+ ASSERT_NOEXCEPT(std::declval<const T&>() >= std::declval<const U&>());
}
-template <class T>
+template <class T, class U = T>
void AssertComparisons6ReturnBool()
{
- ASSERT_SAME_TYPE(decltype(std::declval<const T&>() == std::declval<const T&>()), bool);
- ASSERT_SAME_TYPE(decltype(std::declval<const T&>() != std::declval<const T&>()), bool);
- ASSERT_SAME_TYPE(decltype(std::declval<const T&>() < std::declval<const T&>()), bool);
- ASSERT_SAME_TYPE(decltype(std::declval<const T&>() <= std::declval<const T&>()), bool);
- ASSERT_SAME_TYPE(decltype(std::declval<const T&>() > std::declval<const T&>()), bool);
- ASSERT_SAME_TYPE(decltype(std::declval<const T&>() >= std::declval<const T&>()), bool);
+ ASSERT_SAME_TYPE(decltype(std::declval<const T&>() == std::declval<const U&>()), bool);
+ ASSERT_SAME_TYPE(decltype(std::declval<const T&>() != std::declval<const U&>()), bool);
+ ASSERT_SAME_TYPE(decltype(std::declval<const T&>() < std::declval<const U&>()), bool);
+ ASSERT_SAME_TYPE(decltype(std::declval<const T&>() <= std::declval<const U&>()), bool);
+ ASSERT_SAME_TYPE(decltype(std::declval<const T&>() > std::declval<const U&>()), bool);
+ ASSERT_SAME_TYPE(decltype(std::declval<const T&>() >= std::declval<const U&>()), bool);
}
-template <class T>
+template <class T, class U = T>
void AssertComparisons6ConvertibleToBool()
{
- static_assert((std::is_convertible<decltype(std::declval<const T&>() == std::declval<const T&>()), bool>::value), "");
- static_assert((std::is_convertible<decltype(std::declval<const T&>() != std::declval<const T&>()), bool>::value), "");
- static_assert((std::is_convertible<decltype(std::declval<const T&>() < std::declval<const T&>()), bool>::value), "");
- static_assert((std::is_convertible<decltype(std::declval<const T&>() <= std::declval<const T&>()), bool>::value), "");
- static_assert((std::is_convertible<decltype(std::declval<const T&>() > std::declval<const T&>()), bool>::value), "");
- static_assert((std::is_convertible<decltype(std::declval<const T&>() >= std::declval<const T&>()), bool>::value), "");
+ static_assert((std::is_convertible<decltype(std::declval<const T&>() == std::declval<const U&>()), bool>::value), "");
+ static_assert((std::is_convertible<decltype(std::declval<const T&>() != std::declval<const U&>()), bool>::value), "");
+ static_assert((std::is_convertible<decltype(std::declval<const T&>() < std::declval<const U&>()), bool>::value), "");
+ static_assert((std::is_convertible<decltype(std::declval<const T&>() <= std::declval<const U&>()), bool>::value), "");
+ static_assert((std::is_convertible<decltype(std::declval<const T&>() > std::declval<const U&>()), bool>::value), "");
+ static_assert((std::is_convertible<decltype(std::declval<const T&>() >= std::declval<const U&>()), bool>::value), "");
}
-// Test all six comparison operations for sanity
-template <class T>
-TEST_CONSTEXPR_CXX14 bool testComparisons2(const T& t1, const T& t2, bool isEqual)
+// Test all two comparison operations for sanity
+template <class T, class U = T>
+TEST_CONSTEXPR_CXX14 bool testComparisons2(const T& t1, const U& t2, bool isEqual)
{
if (isEqual)
{
@@ -130,7 +130,7 @@ TEST_CONSTEXPR_CXX14 bool testComparisons2(const T& t1, const T& t2, bool isEqua
if ( (t1 != t2)) return false;
if ( (t2 != t1)) return false;
}
- else /* greater */
+ else /* not equal */
{
if ( (t1 == t2)) return false;
if ( (t2 == t1)) return false;
@@ -146,30 +146,30 @@ template <class T, class Param>
TEST_CONSTEXPR_CXX14 bool testComparisons2Values(Param val1, Param val2)
{
const bool isEqual = val1 == val2;
-
- return testComparisons2(T{val1}, T{val2}, isEqual);
+
+ return testComparisons2(T(val1), T(val2), isEqual);
}
-template <class T>
+template <class T, class U = T>
void AssertComparisons2AreNoexcept()
{
- ASSERT_NOEXCEPT(std::declval<const T&>() == std::declval<const T&>());
- ASSERT_NOEXCEPT(std::declval<const T&>() != std::declval<const T&>());
+ ASSERT_NOEXCEPT(std::declval<const T&>() == std::declval<const U&>());
+ ASSERT_NOEXCEPT(std::declval<const T&>() != std::declval<const U&>());
}
-template <class T>
+template <class T, class U = T>
void AssertComparisons2ReturnBool()
{
- ASSERT_SAME_TYPE(decltype(std::declval<const T&>() == std::declval<const T&>()), bool);
- ASSERT_SAME_TYPE(decltype(std::declval<const T&>() != std::declval<const T&>()), bool);
+ ASSERT_SAME_TYPE(decltype(std::declval<const T&>() == std::declval<const U&>()), bool);
+ ASSERT_SAME_TYPE(decltype(std::declval<const T&>() != std::declval<const U&>()), bool);
}
-template <class T>
+template <class T, class U = T>
void AssertComparisons2ConvertibleToBool()
{
- static_assert((std::is_convertible<decltype(std::declval<const T&>() == std::declval<const T&>()), bool>::value), "");
- static_assert((std::is_convertible<decltype(std::declval<const T&>() != std::declval<const T&>()), bool>::value), "");
+ static_assert((std::is_convertible<decltype(std::declval<const T&>() == std::declval<const U&>()), bool>::value), "");
+ static_assert((std::is_convertible<decltype(std::declval<const T&>() != std::declval<const U&>()), bool>::value), "");
}
#endif // TEST_COMPARISONS_H
diff --git a/test/support/test_macros.h b/test/support/test_macros.h
index ac6ec79b92357..e452535341743 100644
--- a/test/support/test_macros.h
+++ b/test/support/test_macros.h
@@ -11,7 +11,18 @@
#ifndef SUPPORT_TEST_MACROS_HPP
#define SUPPORT_TEST_MACROS_HPP
-#include <ciso646> // Get STL specific macros like _LIBCPP_VERSION
+// Attempt to get STL specific macros like _LIBCPP_VERSION using the most
+// minimal header possible. If we're testing libc++, we should use `<__config>`.
+// If <__config> isn't available, fall back to <ciso646>.
+#ifdef __has_include
+# if __has_include("<__config>")
+# include <__config>
+# define TEST_IMP_INCLUDED_HEADER
+# endif
+#endif
+#ifndef TEST_IMP_INCLUDED_HEADER
+#include <ciso646>
+#endif
#if defined(__GNUC__)
#pragma GCC diagnostic push
@@ -69,6 +80,7 @@
#define TEST_CLANG_VER (__clang_major__ * 100) + __clang_minor__
#elif defined(__GNUC__)
#define TEST_GCC_VER (__GNUC__ * 100 + __GNUC_MINOR__)
+#define TEST_GCC_VER_NEW (TEST_GCC_VER * 10 + __GNUC_PATCHLEVEL__)
#endif
/* Make a nice name for the standard version */
@@ -87,12 +99,15 @@
#endif
#endif
-// Attempt to deduce GCC version
-#if defined(_LIBCPP_VERSION) && __has_include(<features.h>)
+// Attempt to deduce the GLIBC version
+#if (defined(__has_include) && __has_include(<features.h>)) || \
+ defined(__linux__)
#include <features.h>
+#if defined(__GLIBC_PREREQ)
#define TEST_HAS_GLIBC
#define TEST_GLIBC_PREREQ(major, minor) __GLIBC_PREREQ(major, minor)
#endif
+#endif
#if TEST_STD_VER >= 11
#define TEST_ALIGNOF(...) alignof(__VA_ARGS__)
@@ -112,7 +127,11 @@
# define TEST_THROW_SPEC(...) throw(__VA_ARGS__)
# endif
#else
-#define TEST_ALIGNOF(...) __alignof(__VA_ARGS__)
+#if defined(TEST_COMPILER_CLANG)
+# define TEST_ALIGNOF(...) _Alignof(__VA_ARGS__)
+#else
+# define TEST_ALIGNOF(...) __alignof(__VA_ARGS__)
+#endif
#define TEST_ALIGNAS(...) __attribute__((__aligned__(__VA_ARGS__)))
#define TEST_CONSTEXPR
#define TEST_CONSTEXPR_CXX14
@@ -124,22 +143,33 @@
// Sniff out to see if the underling C library has C11 features
// Note that at this time (July 2018), MacOS X and iOS do NOT.
-#if __ISO_C_VISIBLE >= 2011
+// This is cribbed from __config; but lives here as well because we can't assume libc++
+#if __ISO_C_VISIBLE >= 2011 || TEST_STD_VER >= 11
# if defined(__FreeBSD__)
+// Specifically, FreeBSD does NOT have timespec_get, even though they have all
+// the rest of C11 - this is PR#38495
# define TEST_HAS_C11_FEATURES
# elif defined(__Fuchsia__)
# define TEST_HAS_C11_FEATURES
+# define TEST_HAS_TIMESPEC_GET
# elif defined(__linux__)
-# if !defined(_LIBCPP_HAS_MUSL_LIBC)
-# if _LIBCPP_GLIBC_PREREQ(2, 17)
+// This block preserves the old behavior used by include/__config:
+// _LIBCPP_GLIBC_PREREQ would be defined to 0 if __GLIBC_PREREQ was not
+// available. The configuration here may be too vague though, as Bionic, uClibc,
+// newlib, etc may all support these features but need to be configured.
+# if defined(TEST_GLIBC_PREREQ)
+# if TEST_GLIBC_PREREQ(2, 17)
+# define TEST_HAS_TIMESPEC_GET
# define TEST_HAS_C11_FEATURES
# endif
-# else // defined(_LIBCPP_HAS_MUSL_LIBC)
+# elif defined(_LIBCPP_HAS_MUSL_LIBC)
# define TEST_HAS_C11_FEATURES
+# define TEST_HAS_TIMESPEC_GET
# endif
# elif defined(_WIN32)
# if defined(_MSC_VER) && !defined(__MINGW32__)
# define TEST_HAS_C11_FEATURES // Using Microsoft's C Runtime library
+# define TEST_HAS_TIMESPEC_GET
# endif
# endif
#endif
@@ -196,8 +226,9 @@
// FIXME: Fix this feature check when either (A) a compiler provides a complete
// implementation, or (b) a feature check macro is specified
+#if !defined(_MSC_VER) || defined(__clang__) || _MSC_VER < 1920 || _MSVC_LANG <= 201703L
#define TEST_HAS_NO_SPACESHIP_OPERATOR
-
+#endif
#if TEST_STD_VER < 11
#define ASSERT_NOEXCEPT(...)
@@ -274,6 +305,16 @@ inline void DoNotOptimize(Tp const& value) {
}
#endif
+#if defined(__GNUC__)
+#define TEST_ALWAYS_INLINE __attribute__((always_inline))
+#define TEST_NOINLINE __attribute__((noinline))
+#elif defined(_MSC_VER)
+#define TEST_ALWAYS_INLINE __forceinline
+#define TEST_NOINLINE __declspec(noinline)
+#else
+#define TEST_ALWAYS_INLINE
+#define TEST_NOINLINE
+#endif
#if defined(__GNUC__)
#pragma GCC diagnostic pop
diff --git a/test/support/truncate_fp.h b/test/support/truncate_fp.h
new file mode 100644
index 0000000000000..83b2b2cffebd0
--- /dev/null
+++ b/test/support/truncate_fp.h
@@ -0,0 +1,23 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+inline long double truncate_fp(long double val) {
+ volatile long double sink = val;
+ return sink;
+}
+
+inline double truncate_fp(double val) {
+ volatile double sink = val;
+ return sink;
+}
+
+inline float truncate_fp(float val) {
+ volatile float sink = val;
+ return sink;
+}
diff --git a/test/support/unique_ptr_test_helper.h b/test/support/unique_ptr_test_helper.h
index 6fb9eaa24679d..18c8f780be404 100644
--- a/test/support/unique_ptr_test_helper.h
+++ b/test/support/unique_ptr_test_helper.h
@@ -98,7 +98,6 @@ public:
template <class IncompleteT = IncompleteType,
class Del = std::default_delete<IncompleteT>, class... Args>
void doIncompleteTypeTest(int expect_alive, Args&&... ctor_args) {
- using ValueT = typename std::remove_all_extents<IncompleteT>::type;
checkNumIncompleteTypeAlive(expect_alive);
{
StoresIncomplete<IncompleteT, Del> sptr(std::forward<Args>(ctor_args)...);