aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/CMakeLists.txt115
-rw-r--r--test/libcxx/atomics/libcpp-has-no-threads.fail.cpp (renamed from test/std/atomics/libcpp-has-no-threads.fail.cpp)0
-rw-r--r--test/libcxx/atomics/libcpp-has-no-threads.pass.cpp (renamed from test/std/atomics/libcpp-has-no-threads.pass.cpp)2
-rw-r--r--test/libcxx/compiler.py36
-rw-r--r--test/libcxx/containers/sequences/deque/incomplete.pass.cpp31
-rw-r--r--test/libcxx/containers/sequences/vector/asan.pass.cpp (renamed from test/std/containers/sequences/vector/asan.pass.cpp)31
-rw-r--r--test/libcxx/containers/sequences/vector/asan_throw.pass.cpp (renamed from test/std/containers/sequences/vector/asan_throw.pass.cpp)1
-rw-r--r--test/libcxx/double_include.sh.cpp7
-rw-r--r--test/libcxx/experimental/any/size_and_alignment.pass.cpp23
-rw-r--r--test/libcxx/experimental/any/small_type.pass.cpp114
-rw-r--r--test/libcxx/experimental/any/version.pass.cpp20
-rw-r--r--test/libcxx/experimental/containers/sequences/dynarray/dynarray.cons/default.pass.cpp44
-rw-r--r--test/libcxx/experimental/containers/sequences/dynarray/dynarray.cons/default_throws_bad_alloc.pass.cpp34
-rw-r--r--test/libcxx/experimental/containers/sequences/dynarray/dynarray.data/default.pass.cpp41
-rw-r--r--test/libcxx/experimental/containers/sequences/dynarray/dynarray.overview/at.pass.cpp1
-rw-r--r--test/libcxx/experimental/containers/sequences/dynarray/dynarray.overview/front_back.pass.cpp45
-rw-r--r--test/libcxx/test/config.py294
-rw-r--r--test/libcxx/test/format.py21
-rw-r--r--test/libcxx/test/target_info.py223
-rw-r--r--test/libcxx/test/tracing.py6
-rw-r--r--test/libcxx/thread/futures/version.pass.cpp (renamed from test/std/thread/futures/version.pass.cpp)0
-rw-r--r--test/libcxx/type_traits/convert_to_integral.pass.cpp17
-rw-r--r--test/libcxx/type_traits/lazy_metafunctions.pass.cpp137
-rw-r--r--test/libcxx/utilities/memory/util.smartptr/race_condition.pass.cpp3
-rw-r--r--test/libcxx/utilities/time/date.time/asctime.thread-unsafe.fail.cpp (renamed from test/std/utilities/date.time/asctime.thread-unsafe.fail.cpp)0
-rw-r--r--test/libcxx/utilities/time/date.time/ctime.thread-unsafe.fail.cpp (renamed from test/std/utilities/date.time/ctime.thread-unsafe.fail.cpp)0
-rw-r--r--test/libcxx/utilities/time/date.time/gmtime.thread-unsafe.fail.cpp (renamed from test/std/utilities/date.time/gmtime.thread-unsafe.fail.cpp)0
-rw-r--r--test/libcxx/utilities/time/date.time/localtime.thread-unsafe.fail.cpp (renamed from test/std/utilities/date.time/localtime.thread-unsafe.fail.cpp)0
-rw-r--r--test/lit.site.cfg.in9
-rw-r--r--test/std/algorithms/alg.modifying.operations/alg.partitions/stable_partition.pass.cpp10
-rw-r--r--test/std/algorithms/alg.nonmodifying/mismatch/mismatch.pass.cpp8
-rw-r--r--test/std/algorithms/alg.nonmodifying/mismatch/mismatch_pred.pass.cpp5
-rw-r--r--test/std/algorithms/alg.sorting/alg.set.operations/includes/includes.pass.cpp4
-rw-r--r--test/std/algorithms/alg.sorting/alg.set.operations/includes/includes_comp.pass.cpp4
-rw-r--r--test/std/atomics/atomics.flag/atomic_flag_clear.pass.cpp4
-rw-r--r--test/std/atomics/atomics.flag/atomic_flag_clear_explicit.pass.cpp12
-rw-r--r--test/std/atomics/atomics.flag/clear.pass.cpp16
-rw-r--r--test/std/atomics/atomics.flag/default.pass.cpp3
-rw-r--r--test/std/atomics/atomics.flag/init.pass.cpp1
-rw-r--r--test/std/atomics/atomics.flag/init03.pass.cpp (renamed from test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/no-variadics.pass.cpp)15
-rw-r--r--test/std/atomics/atomics.types.generic/address.pass.cpp3
-rw-r--r--test/std/atomics/atomics.types.generic/bool.pass.cpp3
-rw-r--r--test/std/atomics/atomics.types.generic/integral.pass.cpp1
-rw-r--r--test/std/atomics/atomics.types.generic/trivially_copyable.fail.cpp6
-rw-r--r--test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_compare_exchange_strong.pass.cpp38
-rw-r--r--test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_compare_exchange_strong_explicit.pass.cpp38
-rw-r--r--test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_compare_exchange_weak.pass.cpp37
-rw-r--r--test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_compare_exchange_weak_explicit.pass.cpp38
-rw-r--r--test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_exchange.pass.cpp39
-rw-r--r--test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_exchange_explicit.pass.cpp39
-rw-r--r--test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_fetch_add.pass.cpp44
-rw-r--r--test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_fetch_add_explicit.pass.cpp41
-rw-r--r--test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_fetch_and.pass.cpp27
-rw-r--r--test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_fetch_and_explicit.pass.cpp27
-rw-r--r--test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_fetch_or.pass.cpp27
-rw-r--r--test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_fetch_or_explicit.pass.cpp27
-rw-r--r--test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_fetch_sub.pass.cpp44
-rw-r--r--test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_fetch_sub_explicit.pass.cpp44
-rw-r--r--test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_fetch_xor.pass.cpp27
-rw-r--r--test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_fetch_xor_explicit.pass.cpp27
-rw-r--r--test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_helpers.h51
-rw-r--r--test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_init.pass.cpp40
-rw-r--r--test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_is_lock_free.pass.cpp33
-rw-r--r--test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_load.pass.cpp40
-rw-r--r--test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_load_explicit.pass.cpp38
-rw-r--r--test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_store.pass.cpp40
-rw-r--r--test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_store_explicit.pass.cpp40
-rw-r--r--test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_var_init.pass.cpp1
-rw-r--r--test/std/atomics/atomics.types.operations/atomics.types.operations.req/ctor.pass.cpp44
-rw-r--r--test/std/containers/associative/map/allocator_mismatch.fail.cpp18
-rw-r--r--test/std/containers/associative/map/compare.pass.cpp30
-rw-r--r--test/std/containers/associative/map/map.access/at.pass.cpp1
-rw-r--r--test/std/containers/associative/map/map.access/index_rv_key.pass.cpp8
-rw-r--r--test/std/containers/associative/map/map.cons/default_noexcept.pass.cpp5
-rw-r--r--test/std/containers/associative/map/map.cons/dtor_noexcept.pass.cpp5
-rw-r--r--test/std/containers/associative/map/map.cons/move_assign_noexcept.pass.cpp5
-rw-r--r--test/std/containers/associative/map/map.cons/move_noexcept.pass.cpp5
-rw-r--r--test/std/containers/associative/map/map.special/swap_noexcept.pass.cpp15
-rw-r--r--test/std/containers/associative/multimap/allocator_mismatch.fail.cpp18
-rw-r--r--test/std/containers/associative/multimap/multimap.cons/default_noexcept.pass.cpp5
-rw-r--r--test/std/containers/associative/multimap/multimap.cons/dtor_noexcept.pass.cpp5
-rw-r--r--test/std/containers/associative/multimap/multimap.cons/move_assign_noexcept.pass.cpp5
-rw-r--r--test/std/containers/associative/multimap/multimap.cons/move_noexcept.pass.cpp5
-rw-r--r--test/std/containers/associative/multimap/multimap.special/swap_noexcept.pass.cpp15
-rw-r--r--test/std/containers/associative/multimap/scary.pass.cpp1
-rw-r--r--test/std/containers/associative/multiset/allocator_mismatch.fail.cpp18
-rw-r--r--test/std/containers/associative/multiset/scary.pass.cpp1
-rw-r--r--test/std/containers/associative/set/allocator_mismatch.fail.cpp18
-rw-r--r--test/std/containers/sequences/array/array.cons/initializer_list.pass.cpp4
-rw-r--r--test/std/containers/sequences/array/array.data/data.pass.cpp4
-rw-r--r--test/std/containers/sequences/array/array.data/data_const.pass.cpp4
-rw-r--r--test/std/containers/sequences/array/array.fill/fill.pass.cpp4
-rw-r--r--test/std/containers/sequences/array/array.size/size.pass.cpp4
-rw-r--r--test/std/containers/sequences/array/array.special/swap.pass.cpp4
-rw-r--r--test/std/containers/sequences/array/array.swap/swap.pass.cpp4
-rw-r--r--test/std/containers/sequences/array/array.tuple/get.fail.cpp18
-rw-r--r--test/std/containers/sequences/array/array.tuple/get.pass.cpp13
-rw-r--r--test/std/containers/sequences/array/array.tuple/get_const.pass.cpp8
-rw-r--r--test/std/containers/sequences/array/array.tuple/get_const_rv.pass.cpp51
-rw-r--r--test/std/containers/sequences/array/array.tuple/get_rv.pass.cpp9
-rw-r--r--test/std/containers/sequences/array/at.pass.cpp11
-rw-r--r--test/std/containers/sequences/array/begin.pass.cpp6
-rw-r--r--test/std/containers/sequences/array/front_back.pass.cpp10
-rw-r--r--test/std/containers/sequences/array/indexing.pass.cpp12
-rw-r--r--test/std/containers/sequences/deque/allocator_mismatch.fail.cpp18
-rw-r--r--test/std/containers/sequences/deque/deque.capacity/resize_size.pass.cpp4
-rw-r--r--test/std/containers/sequences/deque/deque.capacity/resize_size_value.pass.cpp4
-rw-r--r--test/std/containers/sequences/deque/deque.capacity/shrink_to_fit.pass.cpp4
-rw-r--r--test/std/containers/sequences/deque/deque.cons/assign_iter_iter.pass.cpp9
-rw-r--r--test/std/containers/sequences/deque/deque.cons/assign_size_value.pass.cpp6
-rw-r--r--test/std/containers/sequences/deque/deque.modifiers/emplace.pass.cpp11
-rw-r--r--test/std/containers/sequences/deque/deque.modifiers/insert_iter_iter.pass.cpp19
-rw-r--r--test/std/containers/sequences/deque/deque.modifiers/insert_rvalue.pass.cpp12
-rw-r--r--test/std/containers/sequences/deque/deque.modifiers/insert_size_value.pass.cpp6
-rw-r--r--test/std/containers/sequences/deque/deque.modifiers/insert_value.pass.cpp6
-rw-r--r--test/std/containers/sequences/deque/deque.modifiers/push_back_exception_safety.pass.cpp1
-rw-r--r--test/std/containers/sequences/deque/deque.modifiers/push_front_exception_safety.pass.cpp1
-rw-r--r--test/std/containers/sequences/forwardlist/allocator_mismatch.fail.cpp18
-rw-r--r--test/std/containers/sequences/forwardlist/forwardlist.cons/move.pass.cpp6
-rw-r--r--test/std/containers/sequences/forwardlist/forwardlist.cons/move_alloc.pass.cpp6
-rw-r--r--test/std/containers/sequences/forwardlist/forwardlist.modifiers/push_front_exception_safety.pass.cpp1
-rw-r--r--test/std/containers/sequences/forwardlist/forwardlist.ops/splice_after_one.pass.cpp4
-rw-r--r--test/std/containers/sequences/forwardlist/forwardlist.spec/equal.pass.cpp4
-rw-r--r--test/std/containers/sequences/forwardlist/forwardlist.spec/relational.pass.cpp4
-rw-r--r--test/std/containers/sequences/list/allocator_mismatch.fail.cpp18
-rw-r--r--test/std/containers/sequences/list/incomplete_type.pass.cpp27
-rw-r--r--test/std/containers/sequences/list/list.modifiers/insert_iter_iter_iter.pass.cpp1
-rw-r--r--test/std/containers/sequences/list/list.modifiers/insert_iter_size_value.pass.cpp1
-rw-r--r--test/std/containers/sequences/list/list.modifiers/insert_iter_value.pass.cpp1
-rw-r--r--test/std/containers/sequences/list/list.modifiers/push_back_exception_safety.pass.cpp1
-rw-r--r--test/std/containers/sequences/list/list.modifiers/push_front_exception_safety.pass.cpp1
-rw-r--r--test/std/containers/sequences/vector.bool/move_assign_noexcept.pass.cpp41
-rw-r--r--test/std/containers/sequences/vector/allocator_mismatch.fail.cpp18
-rw-r--r--test/std/containers/sequences/vector/vector.cons/move_assign_noexcept.pass.cpp44
-rw-r--r--test/std/containers/sequences/vector/vector.modifiers/push_back_exception_safety.pass.cpp1
-rw-r--r--test/std/containers/unord/unord.map/allocator_mismatch.fail.cpp18
-rw-r--r--test/std/containers/unord/unord.map/bucket_count.pass.cpp9
-rw-r--r--test/std/containers/unord/unord.map/compare.pass.cpp13
-rw-r--r--test/std/containers/unord/unord.map/load_factor.pass.cpp5
-rw-r--r--test/std/containers/unord/unord.map/max_bucket_count.pass.cpp7
-rw-r--r--test/std/containers/unord/unord.map/max_load_factor.pass.cpp11
-rw-r--r--test/std/containers/unord/unord.map/rehash.pass.cpp12
-rw-r--r--test/std/containers/unord/unord.map/reserve.pass.cpp16
-rw-r--r--test/std/containers/unord/unord.map/swap_member.pass.cpp6
-rw-r--r--test/std/containers/unord/unord.map/unord.map.cnstr/move.pass.cpp26
-rw-r--r--test/std/containers/unord/unord.map/unord.map.elem/at.pass.cpp1
-rw-r--r--test/std/containers/unord/unord.map/unord.map.modifiers/clear.pass.cpp (renamed from test/std/containers/unord/unord.map/unorder.map.modifiers/clear.pass.cpp)0
-rw-r--r--test/std/containers/unord/unord.map/unord.map.modifiers/emplace.pass.cpp (renamed from test/std/containers/unord/unord.map/unorder.map.modifiers/emplace.pass.cpp)0
-rw-r--r--test/std/containers/unord/unord.map/unord.map.modifiers/emplace_hint.pass.cpp (renamed from test/std/containers/unord/unord.map/unorder.map.modifiers/emplace_hint.pass.cpp)0
-rw-r--r--test/std/containers/unord/unord.map/unord.map.modifiers/erase_const_iter.pass.cpp (renamed from test/std/containers/unord/unord.map/unorder.map.modifiers/erase_const_iter.pass.cpp)9
-rw-r--r--test/std/containers/unord/unord.map/unord.map.modifiers/erase_iter_db1.pass.cpp (renamed from test/std/containers/unord/unord.map/unorder.map.modifiers/erase_iter_db1.pass.cpp)0
-rw-r--r--test/std/containers/unord/unord.map/unord.map.modifiers/erase_iter_db2.pass.cpp (renamed from test/std/containers/unord/unord.map/unorder.map.modifiers/erase_iter_db2.pass.cpp)0
-rw-r--r--test/std/containers/unord/unord.map/unord.map.modifiers/erase_iter_iter_db1.pass.cpp (renamed from test/std/containers/unord/unord.map/unorder.map.modifiers/erase_iter_iter_db1.pass.cpp)0
-rw-r--r--test/std/containers/unord/unord.map/unord.map.modifiers/erase_iter_iter_db2.pass.cpp (renamed from test/std/containers/unord/unord.map/unorder.map.modifiers/erase_iter_iter_db2.pass.cpp)0
-rw-r--r--test/std/containers/unord/unord.map/unord.map.modifiers/erase_iter_iter_db3.pass.cpp (renamed from test/std/containers/unord/unord.map/unorder.map.modifiers/erase_iter_iter_db3.pass.cpp)0
-rw-r--r--test/std/containers/unord/unord.map/unord.map.modifiers/erase_iter_iter_db4.pass.cpp (renamed from test/std/containers/unord/unord.map/unorder.map.modifiers/erase_iter_iter_db4.pass.cpp)0
-rw-r--r--test/std/containers/unord/unord.map/unord.map.modifiers/erase_key.pass.cpp (renamed from test/std/containers/unord/unord.map/unorder.map.modifiers/erase_key.pass.cpp)11
-rw-r--r--test/std/containers/unord/unord.map/unord.map.modifiers/erase_range.pass.cpp (renamed from test/std/containers/unord/unord.map/unorder.map.modifiers/erase_range.pass.cpp)0
-rw-r--r--test/std/containers/unord/unord.map/unord.map.modifiers/insert_const_lvalue.pass.cpp (renamed from test/std/containers/unord/unord.map/unorder.map.modifiers/insert_const_lvalue.pass.cpp)0
-rw-r--r--test/std/containers/unord/unord.map/unord.map.modifiers/insert_hint_const_lvalue.pass.cpp (renamed from test/std/containers/unord/unord.map/unorder.map.modifiers/insert_hint_const_lvalue.pass.cpp)0
-rw-r--r--test/std/containers/unord/unord.map/unord.map.modifiers/insert_hint_rvalue.pass.cpp (renamed from test/std/containers/unord/unord.map/unorder.map.modifiers/insert_hint_rvalue.pass.cpp)0
-rw-r--r--test/std/containers/unord/unord.map/unord.map.modifiers/insert_init.pass.cpp (renamed from test/std/containers/unord/unord.map/unorder.map.modifiers/insert_init.pass.cpp)0
-rw-r--r--test/std/containers/unord/unord.map/unord.map.modifiers/insert_or_assign.pass.cpp (renamed from test/std/containers/unord/unord.map/unorder.map.modifiers/insert_or_assign.pass.cpp)10
-rw-r--r--test/std/containers/unord/unord.map/unord.map.modifiers/insert_range.pass.cpp (renamed from test/std/containers/unord/unord.map/unorder.map.modifiers/insert_range.pass.cpp)0
-rw-r--r--test/std/containers/unord/unord.map/unord.map.modifiers/insert_rvalue.pass.cpp (renamed from test/std/containers/unord/unord.map/unorder.map.modifiers/insert_rvalue.pass.cpp)0
-rw-r--r--test/std/containers/unord/unord.map/unord.map.modifiers/try.emplace.pass.cpp (renamed from test/std/containers/unord/unord.map/unorder.map.modifiers/try.emplace.pass.cpp)11
-rw-r--r--test/std/containers/unord/unord.map/unord.map.swap/swap_non_member.pass.cpp6
-rw-r--r--test/std/containers/unord/unord.multimap/allocator_mismatch.fail.cpp18
-rw-r--r--test/std/containers/unord/unord.multimap/rehash.pass.cpp12
-rw-r--r--test/std/containers/unord/unord.multimap/reserve.pass.cpp16
-rw-r--r--test/std/containers/unord/unord.multimap/unord.multimap.swap/swap_noexcept.pass.cpp24
-rw-r--r--test/std/containers/unord/unord.multiset/allocator_mismatch.fail.cpp18
-rw-r--r--test/std/containers/unord/unord.multiset/rehash.pass.cpp12
-rw-r--r--test/std/containers/unord/unord.multiset/reserve.pass.cpp16
-rw-r--r--test/std/containers/unord/unord.set/allocator_mismatch.fail.cpp18
-rw-r--r--test/std/containers/unord/unord.set/rehash.pass.cpp12
-rw-r--r--test/std/containers/unord/unord.set/reserve.pass.cpp16
-rw-r--r--test/std/depr/depr.auto.ptr/auto.ptr/auto.ptr.conv/convert_to_auto_ptr_ref.pass.cpp4
-rw-r--r--test/std/depr/depr.auto.ptr/auto.ptr/element_type.pass.cpp3
-rw-r--r--test/std/depr/depr.c.headers/extern_c.pass.cpp43
-rw-r--r--test/std/depr/depr.c.headers/inttypes_h.pass.cpp286
-rw-r--r--test/std/depr/depr.c.headers/locale_h.pass.cpp2
-rw-r--r--test/std/depr/depr.c.headers/math_h.pass.cpp846
-rw-r--r--test/std/depr/depr.c.headers/math_h_isinf.pass.cpp30
-rw-r--r--test/std/depr/depr.c.headers/math_h_isnan.pass.cpp30
-rw-r--r--test/std/depr/depr.c.headers/setjmp_h.pass.cpp4
-rw-r--r--test/std/depr/depr.c.headers/signal_h.pass.cpp2
-rw-r--r--test/std/depr/depr.c.headers/stdarg_h.pass.cpp1
-rw-r--r--test/std/depr/depr.c.headers/stddef_h.pass.cpp22
-rw-r--r--test/std/depr/depr.c.headers/stdint_h.pass.cpp4
-rw-r--r--test/std/depr/depr.c.headers/stdio_h.pass.cpp31
-rw-r--r--test/std/depr/depr.c.headers/stdlib_h.pass.cpp38
-rw-r--r--test/std/depr/depr.c.headers/time_h.pass.cpp2
-rw-r--r--test/std/depr/depr.c.headers/wchar_h.pass.cpp43
-rw-r--r--test/std/depr/depr.ios.members/io_state.pass.cpp5
-rw-r--r--test/std/depr/depr.ios.members/open_mode.pass.cpp5
-rw-r--r--test/std/depr/depr.ios.members/seek_dir.pass.cpp5
-rw-r--r--test/std/depr/depr.ios.members/streamoff.pass.cpp5
-rw-r--r--test/std/depr/depr.ios.members/streampos.pass.cpp5
-rw-r--r--test/std/depr/exception.unexpected/unexpected.handler/unexpected_handler.pass.cpp1
-rw-r--r--test/std/diagnostics/syserr/syserr.errcat/syserr.errcat.overview/error_category.pass.cpp1
-rw-r--r--test/std/experimental/algorithms/alg.search/search.pass.cpp45
-rw-r--r--test/std/experimental/any/any.class/any.assign/copy.pass.cpp197
-rw-r--r--test/std/experimental/any/any.class/any.assign/move.pass.cpp102
-rw-r--r--test/std/experimental/any/any.class/any.assign/value.pass.cpp177
-rw-r--r--test/std/experimental/any/any.class/any.assign/value_non_copyable_assign.fail.cpp38
-rw-r--r--test/std/experimental/any/any.class/any.cons/copy.pass.cpp100
-rw-r--r--test/std/experimental/any/any.class/any.cons/default.pass.cpp38
-rw-r--r--test/std/experimental/any/any.class/any.cons/move.pass.cpp102
-rw-r--r--test/std/experimental/any/any.class/any.cons/non_copyable_value.fail.cpp36
-rw-r--r--test/std/experimental/any/any.class/any.cons/value.pass.cpp116
-rw-r--r--test/std/experimental/any/any.class/any.modifiers/clear.pass.cpp63
-rw-r--r--test/std/experimental/any/any.class/any.modifiers/swap.pass.cpp101
-rw-r--r--test/std/experimental/any/any.class/any.observers/empty.pass.cpp64
-rw-r--r--test/std/experimental/any/any.class/any.observers/type.pass.cpp41
-rw-r--r--test/std/experimental/any/any.class/nothing_to_do.pass.cpp12
-rw-r--r--test/std/experimental/any/any.nonmembers/any.cast/any_cast_pointer.pass.cpp146
-rw-r--r--test/std/experimental/any/any.nonmembers/any.cast/any_cast_reference.pass.cpp309
-rw-r--r--test/std/experimental/any/any.nonmembers/any.cast/const_correctness.fail.cpp38
-rw-r--r--test/std/experimental/any/any.nonmembers/any.cast/not_copy_constructible.fail.cpp45
-rw-r--r--test/std/experimental/any/any.nonmembers/any.cast/reference_types.fail.cpp37
-rw-r--r--test/std/experimental/any/any.nonmembers/swap.pass.cpp40
-rw-r--r--test/std/experimental/func/func.searchers/func.searchers.boyer_moore/default.pass.cpp128
-rw-r--r--test/std/experimental/func/func.searchers/func.searchers.boyer_moore/hash.pass.cpp124
-rw-r--r--test/std/experimental/func/func.searchers/func.searchers.boyer_moore/hash.pred.pass.cpp135
-rw-r--r--test/std/experimental/func/func.searchers/func.searchers.boyer_moore/pred.pass.cpp131
-rw-r--r--test/std/experimental/func/func.searchers/func.searchers.boyer_moore_horspool/default.pass.cpp128
-rw-r--r--test/std/experimental/func/func.searchers/func.searchers.boyer_moore_horspool/hash.pass.cpp123
-rw-r--r--test/std/experimental/func/func.searchers/func.searchers.boyer_moore_horspool/hash.pred.pass.cpp134
-rw-r--r--test/std/experimental/func/func.searchers/func.searchers.boyer_moore_horspool/pred.pass.cpp130
-rw-r--r--test/std/experimental/func/func.searchers/func.searchers.default/default.pass.cpp95
-rw-r--r--test/std/experimental/func/func.searchers/func.searchers.default/default.pred.pass.cpp102
-rw-r--r--test/std/experimental/func/func.searchers/func.searchers.default/func.searchers.default.creation/make_default_searcher.pass.cpp81
-rw-r--r--test/std/experimental/func/func.searchers/func.searchers.default/func.searchers.default.creation/make_default_searcher.pred.pass.cpp88
-rw-r--r--test/std/experimental/func/func.searchers/nothing_to_do.pass.cpp13
-rw-r--r--test/std/experimental/func/header.functional.synop/includes.pass.cpp21
-rw-r--r--test/std/experimental/func/nothing_to_do.pass.cpp13
-rw-r--r--test/std/experimental/optional/optional.object/optional.object.assign/copy.pass.cpp1
-rw-r--r--test/std/experimental/optional/optional.object/optional.object.assign/emplace.pass.cpp1
-rw-r--r--test/std/experimental/optional/optional.object/optional.object.assign/emplace_initializer_list.pass.cpp1
-rw-r--r--test/std/experimental/optional/optional.object/optional.object.assign/move.pass.cpp1
-rw-r--r--test/std/experimental/optional/optional.object/optional.object.ctor/const_T.pass.cpp12
-rw-r--r--test/std/experimental/optional/optional.object/optional.object.ctor/copy.pass.cpp1
-rw-r--r--test/std/experimental/optional/optional.object/optional.object.ctor/in_place_t.pass.cpp11
-rw-r--r--test/std/experimental/optional/optional.object/optional.object.ctor/initializer_list.pass.cpp1
-rw-r--r--test/std/experimental/optional/optional.object/optional.object.ctor/move.pass.cpp1
-rw-r--r--test/std/experimental/optional/optional.object/optional.object.ctor/rvalue_T.pass.cpp11
-rw-r--r--test/std/experimental/optional/optional.object/optional.object.observe/value.pass.cpp1
-rw-r--r--test/std/experimental/optional/optional.object/optional.object.observe/value_const.pass.cpp1
-rw-r--r--test/std/experimental/optional/optional.object/optional.object.swap/swap.pass.cpp1
-rw-r--r--test/std/experimental/optional/optional.specalg/swap.pass.cpp1
-rw-r--r--test/std/experimental/string.view/string.view.access/at.pass.cpp1
-rw-r--r--test/std/experimental/string.view/string.view.ops/compare.pointer_size.pass.cpp1
-rw-r--r--test/std/experimental/string.view/string.view.ops/compare.size_size_sv.pass.cpp1
-rw-r--r--test/std/experimental/string.view/string.view.ops/compare.size_size_sv_pointer_size.pass.cpp1
-rw-r--r--test/std/experimental/string.view/string.view.ops/compare.size_size_sv_size_size.pass.cpp1
-rw-r--r--test/std/experimental/string.view/string.view.ops/copy.pass.cpp1
-rw-r--r--test/std/experimental/string.view/string.view.ops/substr.pass.cpp1
-rw-r--r--test/std/experimental/utilities/tuple/tuple.apply/arg_type.pass.cpp5
-rw-r--r--test/std/experimental/utilities/tuple/tuple.apply/extended_types.pass.cpp4
-rw-r--r--test/std/experimental/utilities/tuple/tuple.apply/types.pass.cpp4
-rw-r--r--test/std/input.output/file.streams/c.files/cstdio.pass.cpp1
-rw-r--r--test/std/input.output/iostream.format/input.streams/istream.unformatted/seekg.pass.cpp9
-rw-r--r--test/std/input.output/iostream.format/input.streams/istream.unformatted/seekg_off.pass.cpp9
-rw-r--r--test/std/input.output/iostream.format/output.streams/ostream_sentry/destruct.pass.cpp1
-rw-r--r--test/std/input.output/iostreams.base/ios.base/ios.types/ios_failure/ctor_string_error_code.pass.cpp3
-rw-r--r--test/std/input.output/iostreams.base/ios/basic.ios.members/copyfmt.pass.cpp1
-rw-r--r--test/std/input.output/iostreams.base/ios/basic.ios.members/set_rdbuf.pass.cpp1
-rw-r--r--test/std/input.output/iostreams.base/ios/iostate.flags/clear.pass.cpp1
-rw-r--r--test/std/input.output/iostreams.base/ios/iostate.flags/exceptions_iostate.pass.cpp1
-rw-r--r--test/std/input.output/iostreams.base/ios/iostate.flags/setstate.pass.cpp1
-rw-r--r--test/std/input.output/string.streams/stringbuf/stringbuf.virtuals/overflow.pass.cpp6
-rw-r--r--test/std/input.output/string.streams/stringbuf/stringbuf.virtuals/pbackfail.pass.cpp6
-rw-r--r--test/std/iterators/iterator.primitives/iterator.operations/next.pass.cpp4
-rw-r--r--test/std/iterators/stream.iterators/ostream.iterator/ostream.iterator.ops/assign_t.pass.cpp4
-rw-r--r--test/std/language.support/support.dynamic/alloc.errors/new.handler/new_handler.pass.cpp4
-rw-r--r--test/std/language.support/support.dynamic/new.delete/new.delete.array/new_array.pass.cpp4
-rw-r--r--test/std/language.support/support.dynamic/new.delete/new.delete.array/new_array_nothrow.pass.cpp1
-rw-r--r--test/std/language.support/support.dynamic/new.delete/new.delete.array/sized_delete_array14.pass.cpp7
-rw-r--r--test/std/language.support/support.dynamic/new.delete/new.delete.single/new.pass.cpp2
-rw-r--r--test/std/language.support/support.dynamic/new.delete/new.delete.single/new_nothrow.pass.cpp1
-rw-r--r--test/std/language.support/support.dynamic/new.delete/new.delete.single/sized_delete14.pass.cpp7
-rw-r--r--test/std/language.support/support.exception/except.nested/assign.pass.cpp1
-rw-r--r--test/std/language.support/support.exception/except.nested/ctor_copy.pass.cpp1
-rw-r--r--test/std/language.support/support.exception/except.nested/ctor_default.pass.cpp1
-rw-r--r--test/std/language.support/support.exception/except.nested/rethrow_if_nested.pass.cpp11
-rw-r--r--test/std/language.support/support.exception/except.nested/rethrow_nested.pass.cpp1
-rw-r--r--test/std/language.support/support.exception/except.nested/throw_with_nested.pass.cpp1
-rw-r--r--test/std/language.support/support.exception/exception.terminate/terminate.handler/terminate_handler.pass.cpp4
-rw-r--r--test/std/language.support/support.exception/propagation/current_exception.pass.cpp1
-rw-r--r--test/std/language.support/support.exception/propagation/make_exception_ptr.pass.cpp1
-rw-r--r--test/std/language.support/support.exception/propagation/rethrow_exception.pass.cpp1
-rw-r--r--test/std/language.support/support.exception/uncaught/uncaught_exception.pass.cpp1
-rw-r--r--test/std/language.support/support.exception/uncaught/uncaught_exceptions.pass.cpp1
-rw-r--r--test/std/language.support/support.runtime/csignal.pass.cpp3
-rw-r--r--test/std/language.support/support.runtime/cstdarg.pass.cpp1
-rw-r--r--test/std/language.support/support.runtime/cstdlib.pass.cpp24
-rw-r--r--test/std/language.support/support.runtime/ctime.pass.cpp1
-rw-r--r--test/std/language.support/support.types/nullptr_t.pass.cpp23
-rw-r--r--test/std/localization/locale.categories/category.collate/locale.collate.byname/transform.pass.cpp2
-rw-r--r--test/std/localization/locale.categories/category.ctype/locale.codecvt/locale.codecvt.members/char16_t_in.pass.cpp2
-rw-r--r--test/std/localization/locale.categories/category.ctype/locale.codecvt/locale.codecvt.members/char16_t_length.pass.cpp2
-rw-r--r--test/std/localization/locale.categories/category.ctype/locale.codecvt/locale.codecvt.members/char16_t_out.pass.cpp2
-rw-r--r--test/std/localization/locale.categories/category.ctype/locale.codecvt/locale.codecvt.members/char16_t_unshift.pass.cpp2
-rw-r--r--test/std/localization/locale.categories/category.ctype/locale.codecvt/locale.codecvt.members/char32_t_in.pass.cpp2
-rw-r--r--test/std/localization/locale.categories/category.ctype/locale.codecvt/locale.codecvt.members/char32_t_length.pass.cpp2
-rw-r--r--test/std/localization/locale.categories/category.ctype/locale.codecvt/locale.codecvt.members/char32_t_out.pass.cpp2
-rw-r--r--test/std/localization/locale.categories/category.ctype/locale.codecvt/locale.codecvt.members/char32_t_unshift.pass.cpp2
-rw-r--r--test/std/localization/locale.categories/category.ctype/locale.codecvt/locale.codecvt.members/char_in.pass.cpp2
-rw-r--r--test/std/localization/locale.categories/category.ctype/locale.codecvt/locale.codecvt.members/char_length.pass.cpp2
-rw-r--r--test/std/localization/locale.categories/category.ctype/locale.codecvt/locale.codecvt.members/char_out.pass.cpp2
-rw-r--r--test/std/localization/locale.categories/category.ctype/locale.codecvt/locale.codecvt.members/char_unshift.pass.cpp2
-rw-r--r--test/std/localization/locale.categories/category.ctype/locale.codecvt/locale.codecvt.members/utf_sanity_check.pass.cpp2
-rw-r--r--test/std/localization/locale.categories/category.ctype/locale.codecvt/locale.codecvt.members/wchar_t_in.pass.cpp2
-rw-r--r--test/std/localization/locale.categories/category.ctype/locale.codecvt/locale.codecvt.members/wchar_t_length.pass.cpp2
-rw-r--r--test/std/localization/locale.categories/category.ctype/locale.codecvt/locale.codecvt.members/wchar_t_out.pass.cpp6
-rw-r--r--test/std/localization/locale.categories/category.ctype/locale.codecvt/locale.codecvt.members/wchar_t_unshift.pass.cpp2
-rw-r--r--test/std/localization/locale.categories/category.time/locale.time.get.byname/get_monthname.pass.cpp2
-rw-r--r--test/std/localization/locale.categories/category.time/locale.time.get.byname/get_monthname_wide.pass.cpp2
-rw-r--r--test/std/localization/locales/locale.convenience/conversions/conversions.string/ctor_err_string.pass.cpp1
-rw-r--r--test/std/localization/locales/locale.global.templates/use_facet.pass.cpp1
-rw-r--r--test/std/localization/locales/locale/locale.cons/char_pointer.pass.cpp1
-rw-r--r--test/std/localization/locales/locale/locale.members/combine.pass.cpp1
-rw-r--r--test/std/numerics/rand/rand.device/ctor.pass.cpp1
-rw-r--r--test/std/numerics/rand/rand.device/eval.pass.cpp1
-rw-r--r--test/std/re/re.alg/re.alg.search/grep.pass.cpp28
-rw-r--r--test/std/re/re.regex/re.regex.assign/assign.pass.cpp1
-rw-r--r--test/std/re/re.regex/re.regex.construct/bad_escape.pass.cpp3
-rw-r--r--test/std/re/re.regex/re.regex.construct/bad_repeat.pass.cpp43
-rw-r--r--test/std/strings/basic.string/allocator_mismatch.fail.cpp18
-rw-r--r--test/std/strings/basic.string/string.access/at.pass.cpp1
-rw-r--r--test/std/strings/basic.string/string.capacity/capacity.pass.cpp1
-rw-r--r--test/std/strings/basic.string/string.capacity/max_size.pass.cpp1
-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.cpp1
-rw-r--r--test/std/strings/basic.string/string.capacity/resize_size.pass.cpp1
-rw-r--r--test/std/strings/basic.string/string.capacity/resize_size_char.pass.cpp1
-rw-r--r--test/std/strings/basic.string/string.cons/move_assign_noexcept.pass.cpp56
-rw-r--r--test/std/strings/basic.string/string.cons/substr.pass.cpp1
-rw-r--r--test/std/strings/basic.string/string.modifiers/string_append/string_size_size.pass.cpp1
-rw-r--r--test/std/strings/basic.string/string.modifiers/string_assign/string.pass.cpp6
-rw-r--r--test/std/strings/basic.string/string.modifiers/string_assign/string_size_size.pass.cpp1
-rw-r--r--test/std/strings/basic.string/string.modifiers/string_copy/copy.pass.cpp1
-rw-r--r--test/std/strings/basic.string/string.modifiers/string_erase/size_size.pass.cpp1
-rw-r--r--test/std/strings/basic.string/string.modifiers/string_insert/size_pointer.pass.cpp1
-rw-r--r--test/std/strings/basic.string/string.modifiers/string_insert/size_pointer_size.pass.cpp1
-rw-r--r--test/std/strings/basic.string/string.modifiers/string_insert/size_size_char.pass.cpp1
-rw-r--r--test/std/strings/basic.string/string.modifiers/string_insert/size_string.pass.cpp1
-rw-r--r--test/std/strings/basic.string/string.modifiers/string_insert/size_string_size_size.pass.cpp1
-rw-r--r--test/std/strings/basic.string/string.modifiers/string_replace/size_size_pointer.pass.cpp1
-rw-r--r--test/std/strings/basic.string/string.modifiers/string_replace/size_size_pointer_size.pass.cpp1
-rw-r--r--test/std/strings/basic.string/string.modifiers/string_replace/size_size_size_char.pass.cpp1
-rw-r--r--test/std/strings/basic.string/string.modifiers/string_replace/size_size_string.pass.cpp1
-rw-r--r--test/std/strings/basic.string/string.modifiers/string_replace/size_size_string_size_size.pass.cpp1
-rw-r--r--test/std/strings/basic.string/string.ops/string_compare/size_size_pointer.pass.cpp1
-rw-r--r--test/std/strings/basic.string/string.ops/string_compare/size_size_pointer_size.pass.cpp1
-rw-r--r--test/std/strings/basic.string/string.ops/string_compare/size_size_string.pass.cpp1
-rw-r--r--test/std/strings/basic.string/string.ops/string_compare/size_size_string_size_size.pass.cpp1
-rw-r--r--test/std/strings/basic.string/string.ops/string_substr/substr.pass.cpp1
-rw-r--r--test/std/strings/c.strings/cctype.pass.cpp28
-rw-r--r--test/std/strings/c.strings/cwchar.pass.cpp2
-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/stold.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/thread/futures/futures.async/async.pass.cpp2
-rw-r--r--test/std/thread/futures/futures.async/async_race.pass.cpp1
-rw-r--r--test/std/thread/futures/futures.promise/alloc_ctor.pass.cpp29
-rw-r--r--test/std/thread/futures/futures.promise/copy_assign.fail.cpp82
-rw-r--r--test/std/thread/futures/futures.promise/copy_ctor.fail.cpp76
-rw-r--r--test/std/thread/futures/futures.promise/default.pass.cpp1
-rw-r--r--test/std/thread/futures/futures.promise/dtor.pass.cpp2
-rw-r--r--test/std/thread/futures/futures.promise/get_future.pass.cpp2
-rw-r--r--test/std/thread/futures/futures.promise/move_assign.pass.cpp38
-rw-r--r--test/std/thread/futures/futures.promise/move_ctor.pass.cpp32
-rw-r--r--test/std/thread/futures/futures.promise/set_exception.pass.cpp2
-rw-r--r--test/std/thread/futures/futures.promise/set_exception_at_thread_exit.pass.cpp2
-rw-r--r--test/std/thread/futures/futures.promise/set_lvalue.pass.cpp2
-rw-r--r--test/std/thread/futures/futures.promise/set_lvalue_at_thread_exit.pass.cpp1
-rw-r--r--test/std/thread/futures/futures.promise/set_rvalue.pass.cpp1
-rw-r--r--test/std/thread/futures/futures.promise/set_value_at_thread_exit_const.pass.cpp1
-rw-r--r--test/std/thread/futures/futures.promise/set_value_at_thread_exit_void.pass.cpp1
-rw-r--r--test/std/thread/futures/futures.promise/set_value_const.pass.cpp2
-rw-r--r--test/std/thread/futures/futures.promise/set_value_void.pass.cpp2
-rw-r--r--test/std/thread/futures/futures.promise/swap.pass.cpp45
-rw-r--r--test/std/thread/futures/futures.promise/uses_allocator.pass.cpp2
-rw-r--r--test/std/thread/futures/futures.shared_future/copy_assign.pass.cpp3
-rw-r--r--test/std/thread/futures/futures.shared_future/copy_ctor.pass.cpp1
-rw-r--r--test/std/thread/futures/futures.shared_future/ctor_future.pass.cpp1
-rw-r--r--test/std/thread/futures/futures.shared_future/dtor.pass.cpp30
-rw-r--r--test/std/thread/futures/futures.shared_future/get.pass.cpp2
-rw-r--r--test/std/thread/futures/futures.shared_future/move_assign.pass.cpp3
-rw-r--r--test/std/thread/futures/futures.shared_future/move_ctor.pass.cpp1
-rw-r--r--test/std/thread/futures/futures.shared_future/wait.pass.cpp1
-rw-r--r--test/std/thread/futures/futures.shared_future/wait_for.pass.cpp1
-rw-r--r--test/std/thread/futures/futures.shared_future/wait_until.pass.cpp1
-rw-r--r--test/std/thread/futures/futures.tas/futures.task.members/assign_copy.fail.cpp30
-rw-r--r--test/std/thread/futures/futures.tas/futures.task.members/assign_move.pass.cpp1
-rw-r--r--test/std/thread/futures/futures.tas/futures.task.members/ctor1.fail.cpp5
-rw-r--r--test/std/thread/futures/futures.tas/futures.task.members/ctor2.fail.cpp7
-rw-r--r--test/std/thread/futures/futures.tas/futures.task.members/ctor_copy.fail.cpp25
-rw-r--r--test/std/thread/futures/futures.tas/futures.task.members/ctor_default.pass.cpp1
-rw-r--r--test/std/thread/futures/futures.tas/futures.task.members/ctor_func.pass.cpp1
-rw-r--r--test/std/thread/futures/futures.tas/futures.task.members/ctor_func_alloc.pass.cpp19
-rw-r--r--test/std/thread/futures/futures.tas/futures.task.members/ctor_move.pass.cpp1
-rw-r--r--test/std/thread/futures/futures.tas/futures.task.members/dtor.pass.cpp2
-rw-r--r--test/std/thread/futures/futures.tas/futures.task.members/get_future.pass.cpp2
-rw-r--r--test/std/thread/futures/futures.tas/futures.task.members/make_ready_at_thread_exit.pass.cpp2
-rw-r--r--test/std/thread/futures/futures.tas/futures.task.members/operator.pass.cpp2
-rw-r--r--test/std/thread/futures/futures.tas/futures.task.members/reset.pass.cpp2
-rw-r--r--test/std/thread/futures/futures.tas/futures.task.members/swap.pass.cpp1
-rw-r--r--test/std/thread/futures/futures.tas/futures.task.nonmembers/swap.pass.cpp1
-rw-r--r--test/std/thread/futures/futures.tas/futures.task.nonmembers/uses_allocator.pass.cpp8
-rw-r--r--test/std/thread/futures/futures.tas/types.pass.cpp1
-rw-r--r--test/std/thread/futures/futures.unique_future/copy_assign.fail.cpp59
-rw-r--r--test/std/thread/futures/futures.unique_future/copy_ctor.fail.cpp51
-rw-r--r--test/std/thread/futures/futures.unique_future/dtor.pass.cpp30
-rw-r--r--test/std/thread/futures/futures.unique_future/get.pass.cpp2
-rw-r--r--test/std/thread/futures/futures.unique_future/share.pass.cpp1
-rw-r--r--test/std/thread/futures/futures.unique_future/wait.pass.cpp1
-rw-r--r--test/std/thread/futures/futures.unique_future/wait_for.pass.cpp1
-rw-r--r--test/std/thread/futures/futures.unique_future/wait_until.pass.cpp259
-rw-r--r--test/std/thread/futures/test_allocator.h158
-rw-r--r--test/std/thread/thread.condition/notify_all_at_thread_exit.pass.cpp7
-rw-r--r--test/std/thread/thread.condition/thread.condition.condvar/notify_one.pass.cpp11
-rw-r--r--test/std/thread/thread.condition/thread.condition.condvarany/wait.exception.pass.cpp63
-rw-r--r--test/std/thread/thread.condition/thread.condition.condvarany/wait_for.exception.pass.cpp63
-rw-r--r--test/std/thread/thread.condition/thread.condition.condvarany/wait_terminates.sh.cpp134
-rw-r--r--test/std/thread/thread.mutex/thread.lock.algorithm/lock.pass.cpp1
-rw-r--r--test/std/thread/thread.mutex/thread.lock.algorithm/try_lock.pass.cpp1
-rw-r--r--test/std/thread/thread.mutex/thread.lock/thread.lock.shared/thread.lock.shared.cons/default.pass.cpp3
-rw-r--r--test/std/thread/thread.mutex/thread.lock/thread.lock.shared/thread.lock.shared.cons/move_assign.pass.cpp7
-rw-r--r--test/std/thread/thread.mutex/thread.lock/thread.lock.shared/thread.lock.shared.cons/move_ctor.pass.cpp8
-rw-r--r--test/std/thread/thread.mutex/thread.lock/thread.lock.shared/thread.lock.shared.cons/mutex.pass.cpp64
-rw-r--r--test/std/thread/thread.mutex/thread.lock/thread.lock.shared/thread.lock.shared.cons/mutex_adopt_lock.pass.cpp3
-rw-r--r--test/std/thread/thread.mutex/thread.lock/thread.lock.shared/thread.lock.shared.cons/mutex_defer_lock.pass.cpp3
-rw-r--r--test/std/thread/thread.mutex/thread.lock/thread.lock.shared/thread.lock.shared.cons/mutex_duration.pass.cpp35
-rw-r--r--test/std/thread/thread.mutex/thread.lock/thread.lock.shared/thread.lock.shared.cons/mutex_time_point.pass.cpp34
-rw-r--r--test/std/thread/thread.mutex/thread.lock/thread.lock.shared/thread.lock.shared.cons/mutex_try_to_lock.pass.cpp7
-rw-r--r--test/std/thread/thread.mutex/thread.lock/thread.lock.shared/thread.lock.shared.locking/lock.pass.cpp26
-rw-r--r--test/std/thread/thread.mutex/thread.lock/thread.lock.shared/thread.lock.shared.locking/try_lock.pass.cpp9
-rw-r--r--test/std/thread/thread.mutex/thread.lock/thread.lock.shared/thread.lock.shared.locking/try_lock_for.pass.cpp8
-rw-r--r--test/std/thread/thread.mutex/thread.lock/thread.lock.shared/thread.lock.shared.locking/try_lock_until.pass.cpp8
-rw-r--r--test/std/thread/thread.mutex/thread.lock/thread.lock.shared/thread.lock.shared.locking/unlock.pass.cpp8
-rw-r--r--test/std/thread/thread.mutex/thread.lock/thread.lock.shared/thread.lock.shared.mod/member_swap.pass.cpp7
-rw-r--r--test/std/thread/thread.mutex/thread.lock/thread.lock.shared/thread.lock.shared.mod/nonmember_swap.pass.cpp7
-rw-r--r--test/std/thread/thread.mutex/thread.lock/thread.lock.shared/thread.lock.shared.mod/release.pass.cpp7
-rw-r--r--test/std/thread/thread.mutex/thread.lock/thread.lock.shared/thread.lock.shared.obs/mutex.pass.cpp7
-rw-r--r--test/std/thread/thread.mutex/thread.lock/thread.lock.shared/thread.lock.shared.obs/op_bool.pass.cpp7
-rw-r--r--test/std/thread/thread.mutex/thread.lock/thread.lock.shared/thread.lock.shared.obs/owns_lock.pass.cpp7
-rw-r--r--test/std/thread/thread.mutex/thread.lock/thread.lock.shared/types.pass.cpp4
-rw-r--r--test/std/thread/thread.mutex/thread.lock/thread.lock.unique/thread.lock.unique.locking/lock.pass.cpp1
-rw-r--r--test/std/thread/thread.mutex/thread.lock/thread.lock.unique/thread.lock.unique.locking/try_lock.pass.cpp1
-rw-r--r--test/std/thread/thread.mutex/thread.lock/thread.lock.unique/thread.lock.unique.locking/try_lock_for.pass.cpp1
-rw-r--r--test/std/thread/thread.mutex/thread.lock/thread.lock.unique/thread.lock.unique.locking/try_lock_until.pass.cpp1
-rw-r--r--test/std/thread/thread.mutex/thread.lock/thread.lock.unique/thread.lock.unique.locking/unlock.pass.cpp1
-rw-r--r--test/std/thread/thread.mutex/thread.mutex.requirements/thread.shared_mutex.requirements/thread.shared_mutex.class/assign.fail.cpp10
-rw-r--r--test/std/thread/thread.mutex/thread.mutex.requirements/thread.shared_mutex.requirements/thread.shared_mutex.class/copy.fail.cpp10
-rw-r--r--test/std/thread/thread.mutex/thread.mutex.requirements/thread.shared_mutex.requirements/thread.shared_mutex.class/lock.pass.cpp18
-rw-r--r--test/std/thread/thread.mutex/thread.mutex.requirements/thread.shared_mutex.requirements/thread.shared_mutex.class/lock_shared.pass.cpp23
-rw-r--r--test/std/thread/thread.mutex/thread.mutex.requirements/thread.sharedtimedmutex.requirements/thread.sharedtimedmutex.class/lock.pass.cpp15
-rw-r--r--test/std/thread/thread.mutex/thread.mutex.requirements/thread.sharedtimedmutex.requirements/thread.sharedtimedmutex.class/lock_shared.pass.cpp25
-rw-r--r--test/std/thread/thread.mutex/thread.mutex.requirements/thread.sharedtimedmutex.requirements/thread.sharedtimedmutex.class/try_lock_for.pass.cpp30
-rw-r--r--test/std/thread/thread.mutex/thread.mutex.requirements/thread.sharedtimedmutex.requirements/thread.sharedtimedmutex.class/try_lock_shared.pass.cpp11
-rw-r--r--test/std/thread/thread.mutex/thread.mutex.requirements/thread.sharedtimedmutex.requirements/thread.sharedtimedmutex.class/try_lock_shared_for.pass.cpp29
-rw-r--r--test/std/thread/thread.mutex/thread.mutex.requirements/thread.sharedtimedmutex.requirements/thread.sharedtimedmutex.class/try_lock_shared_until.pass.cpp29
-rw-r--r--test/std/thread/thread.mutex/thread.mutex.requirements/thread.sharedtimedmutex.requirements/thread.sharedtimedmutex.class/try_lock_until.pass.cpp28
-rw-r--r--test/std/thread/thread.mutex/thread.once/thread.once.callonce/call_once.pass.cpp1
-rw-r--r--test/std/thread/thread.threads/thread.thread.class/thread.thread.assign/move2.pass.cpp17
-rw-r--r--test/std/thread/thread.threads/thread.thread.class/thread.thread.constr/F.pass.cpp9
-rw-r--r--test/std/thread/thread.threads/thread.thread.class/thread.thread.destr/dtor.pass.cpp4
-rw-r--r--test/std/thread/thread.threads/thread.thread.class/thread.thread.member/detach.pass.cpp2
-rw-r--r--test/std/utilities/allocator.adaptor/scoped.adaptor.operators/copy_assign.pass.cpp72
-rw-r--r--test/std/utilities/allocator.adaptor/scoped.adaptor.operators/move_assign.pass.cpp72
-rw-r--r--test/std/utilities/function.objects/bind/func.bind/func.bind.bind/copy.pass.cpp2
-rw-r--r--test/std/utilities/function.objects/bind/func.bind/func.bind.bind/invoke_function_object.pass.cpp2
-rw-r--r--test/std/utilities/function.objects/bind/func.bind/func.bind.bind/invoke_int_0.pass.cpp2
-rw-r--r--test/std/utilities/function.objects/bind/func.bind/func.bind.bind/invoke_lvalue.pass.cpp2
-rw-r--r--test/std/utilities/function.objects/bind/func.bind/func.bind.bind/invoke_rvalue.pass.cpp2
-rw-r--r--test/std/utilities/function.objects/bind/func.bind/func.bind.bind/invoke_void_0.pass.cpp2
-rw-r--r--test/std/utilities/function.objects/bind/func.bind/func.bind.bind/nested.pass.cpp2
-rw-r--r--test/std/utilities/function.objects/bind/func.bind/func.bind.isbind/is_bind_expression.pass.cpp2
-rw-r--r--test/std/utilities/function.objects/bind/func.bind/func.bind.isbind/is_bind_expression_03.pass.cpp39
-rw-r--r--test/std/utilities/function.objects/func.invoke/invoke.pass.cpp1
-rw-r--r--test/std/utilities/function.objects/func.memfn/member_function.pass.cpp3
-rw-r--r--test/std/utilities/function.objects/func.require/bullet_1_and_2.pass.cpp318
-rw-r--r--test/std/utilities/function.objects/func.require/bullet_3_and_4.pass.cpp164
-rw-r--r--test/std/utilities/function.objects/func.require/bullet_5.pass.cpp327
-rw-r--r--test/std/utilities/function.objects/func.require/invoke_helpers.h317
-rw-r--r--test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/F.pass.cpp6
-rw-r--r--test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/F_nullptr.pass.cpp247
-rw-r--r--test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.inv/invoke.fail.cpp14
-rw-r--r--test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.inv/invoke.pass.cpp382
-rw-r--r--test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.inv/invoke_int_0.pass.cpp58
-rw-r--r--test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.inv/invoke_no_variadics.pass.cpp60
-rw-r--r--test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.inv/invoke_void_0.pass.cpp67
-rw-r--r--test/std/utilities/function.objects/refwrap/refwrap.const/type_ctor.fail.cpp2
-rw-r--r--test/std/utilities/function.objects/refwrap/refwrap.helpers/ref_1.fail.cpp2
-rw-r--r--test/std/utilities/function.objects/unord.hash/integral.pass.cpp40
-rw-r--r--test/std/utilities/intseq/intseq.make/make_integer_seq.fail.cpp18
-rw-r--r--test/std/utilities/intseq/intseq.make/make_integer_seq.pass.cpp6
-rw-r--r--test/std/utilities/intseq/intseq.make/make_integer_seq_fallback.fail.cpp18
-rw-r--r--test/std/utilities/intseq/intseq.make/make_integer_seq_fallback.pass.cpp18
-rw-r--r--test/std/utilities/memory/allocator.traits/allocator.traits.members/max_size.pass.cpp4
-rw-r--r--test/std/utilities/memory/default.allocator/allocator.members/construct.pass.cpp25
-rw-r--r--test/std/utilities/memory/default.allocator/allocator.members/max_size.pass.cpp4
-rw-r--r--test/std/utilities/memory/specialized.algorithms/uninitialized.copy/uninitialized_copy.pass.cpp15
-rw-r--r--test/std/utilities/memory/specialized.algorithms/uninitialized.copy/uninitialized_copy_n.pass.cpp15
-rw-r--r--test/std/utilities/memory/specialized.algorithms/uninitialized.fill.n/uninitialized_fill_n.pass.cpp14
-rw-r--r--test/std/utilities/memory/specialized.algorithms/uninitialized.fill/uninitialized_fill.pass.cpp14
-rw-r--r--test/std/utilities/memory/storage.iterator/raw_storag_iterator.pass.cpp27
-rw-r--r--test/std/utilities/memory/unique.ptr/deleter.h230
-rw-r--r--test/std/utilities/memory/unique.ptr/unique.ptr.runtime/move01.fail.cpp25
-rw-r--r--test/std/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/move01.pass.cpp22
-rw-r--r--test/std/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/move02.pass.cpp23
-rw-r--r--test/std/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/pointer_deleter04.fail.cpp34
-rw-r--r--test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.asgn/move01.fail.cpp25
-rw-r--r--test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.asgn/move02.fail.cpp27
-rw-r--r--test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.asgn/move03.fail.cpp43
-rw-r--r--test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.asgn/move04.fail.cpp48
-rw-r--r--test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.asgn/move_convert.pass.cpp89
-rw-r--r--test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.asgn/move_convert01.fail.cpp41
-rw-r--r--test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.asgn/move_convert01.pass.cpp56
-rw-r--r--test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.asgn/move_convert02.fail.cpp44
-rw-r--r--test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.asgn/move_convert02.pass.cpp60
-rw-r--r--test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.asgn/move_convert03.fail.cpp47
-rw-r--r--test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.asgn/move_convert03.pass.cpp63
-rw-r--r--test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.asgn/move_convert04.fail.cpp40
-rw-r--r--test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.asgn/move_convert13.fail.cpp2
-rw-r--r--test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/auto_pointer.pass.cpp16
-rw-r--r--test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/default.pass.cpp86
-rw-r--r--test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/default01.pass.cpp46
-rw-r--r--test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/default02.pass.cpp84
-rw-r--r--test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/move.pass.cpp140
-rw-r--r--test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/move01.pass.cpp142
-rw-r--r--test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/move02.pass.cpp143
-rw-r--r--test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/move_convert.pass.cpp171
-rw-r--r--test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/move_convert01.pass.cpp58
-rw-r--r--test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/move_convert02.pass.cpp62
-rw-r--r--test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/move_convert03.pass.cpp79
-rw-r--r--test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/move_convert04.pass.cpp58
-rw-r--r--test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/move_convert05.pass.cpp62
-rw-r--r--test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/move_convert06.pass.cpp79
-rw-r--r--test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/move_convert07.pass.cpp63
-rw-r--r--test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/pointer.pass.cpp163
-rw-r--r--test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/pointer01.pass.cpp63
-rw-r--r--test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/pointer02.pass.cpp95
-rw-r--r--test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/pointer03.pass.cpp78
-rw-r--r--test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/pointer_deleter.pass.cpp123
-rw-r--r--test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/pointer_deleter01.pass.cpp99
-rw-r--r--test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/pointer_deleter02.pass.cpp58
-rw-r--r--test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/pointer_deleter03.pass.cpp60
-rw-r--r--test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/pointer_deleter04.fail.cpp43
-rw-r--r--test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/pointer_deleter04.pass.cpp58
-rw-r--r--test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/pointer_deleter05.pass.cpp66
-rw-r--r--test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/pointer_deleter06.pass.cpp39
-rw-r--r--test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/auto_ptr.pass.cpp1
-rw-r--r--test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/nullptr_t_deleter_allocator_throw.pass.cpp1
-rw-r--r--test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/nullptr_t_deleter_throw.pass.cpp1
-rw-r--r--test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/pointer_deleter_allocator_throw.pass.cpp1
-rw-r--r--test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/pointer_deleter_throw.pass.cpp1
-rw-r--r--test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/pointer_throw.pass.cpp1
-rw-r--r--test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/unique_ptr.pass.cpp1
-rw-r--r--test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/weak_ptr.pass.cpp1
-rw-r--r--test/std/utilities/memory/util.smartptr/util.smartptr.weak/util.smartptr.ownerless/owner_less.pass.cpp40
-rw-r--r--test/std/utilities/meta/meta.logical/conjunction.pass.cpp66
-rw-r--r--test/std/utilities/meta/meta.logical/disjunction.pass.cpp66
-rw-r--r--test/std/utilities/meta/meta.logical/negation.pass.cpp39
-rw-r--r--test/std/utilities/meta/meta.rel/is_base_of.pass.cpp8
-rw-r--r--test/std/utilities/meta/meta.rel/is_convertible.pass.cpp14
-rw-r--r--test/std/utilities/meta/meta.rel/is_convertible_fallback.pass.cpp8
-rw-r--r--test/std/utilities/meta/meta.rel/is_same.pass.cpp18
-rw-r--r--test/std/utilities/meta/meta.trans/meta.trans.other/aligned_storage.pass.cpp44
-rw-r--r--test/std/utilities/meta/meta.trans/meta.trans.other/common_type.pass.cpp58
-rw-r--r--test/std/utilities/meta/meta.trans/meta.trans.ref/add_lvalue_ref.pass.cpp36
-rw-r--r--test/std/utilities/meta/meta.unary.prop.query/alignment_of.pass.cpp8
-rw-r--r--test/std/utilities/meta/meta.unary.prop.query/extent.pass.cpp14
-rw-r--r--test/std/utilities/meta/meta.unary.prop.query/rank.pass.cpp8
-rw-r--r--test/std/utilities/meta/meta.unary.prop.query/void_t.pass.cpp9
-rw-r--r--test/std/utilities/meta/meta.unary/meta.unary.cat/is_array.pass.cpp93
-rw-r--r--test/std/utilities/meta/meta.unary/meta.unary.cat/is_class.pass.cpp98
-rw-r--r--test/std/utilities/meta/meta.unary/meta.unary.cat/is_enum.pass.cpp93
-rw-r--r--test/std/utilities/meta/meta.unary/meta.unary.cat/is_floating_point.pass.cpp101
-rw-r--r--test/std/utilities/meta/meta.unary/meta.unary.cat/is_function.pass.cpp98
-rw-r--r--test/std/utilities/meta/meta.unary/meta.unary.cat/is_integral.pass.cpp104
-rw-r--r--test/std/utilities/meta/meta.unary/meta.unary.cat/is_lvalue_reference.pass.cpp95
-rw-r--r--test/std/utilities/meta/meta.unary/meta.unary.cat/is_member_object_pointer.pass.cpp97
-rw-r--r--test/std/utilities/meta/meta.unary/meta.unary.cat/is_member_pointer.pass.cpp98
-rw-r--r--test/std/utilities/meta/meta.unary/meta.unary.cat/is_null_pointer.pass.cpp95
-rw-r--r--test/std/utilities/meta/meta.unary/meta.unary.cat/is_pointer.pass.cpp94
-rw-r--r--test/std/utilities/meta/meta.unary/meta.unary.cat/is_rvalue_reference.pass.cpp95
-rw-r--r--test/std/utilities/meta/meta.unary/meta.unary.cat/is_union.pass.cpp93
-rw-r--r--test/std/utilities/meta/meta.unary/meta.unary.cat/is_void.pass.cpp92
-rw-r--r--test/std/utilities/meta/meta.unary/meta.unary.cat/nullptr.pass.cpp1
-rw-r--r--test/std/utilities/meta/meta.unary/meta.unary.comp/is_arithmetic.pass.cpp104
-rw-r--r--test/std/utilities/meta/meta.unary/meta.unary.comp/is_compound.pass.cpp95
-rw-r--r--test/std/utilities/meta/meta.unary/meta.unary.comp/is_fundamental.pass.cpp112
-rw-r--r--test/std/utilities/meta/meta.unary/meta.unary.comp/is_member_pointer.pass.cpp102
-rw-r--r--test/std/utilities/meta/meta.unary/meta.unary.comp/is_object.pass.cpp101
-rw-r--r--test/std/utilities/meta/meta.unary/meta.unary.comp/is_reference.pass.cpp101
-rw-r--r--test/std/utilities/meta/meta.unary/meta.unary.comp/is_scalar.pass.cpp111
-rw-r--r--test/std/utilities/meta/meta.unary/meta.unary.prop/has_virtual_destructor.pass.cpp12
-rw-r--r--test/std/utilities/meta/meta.unary/meta.unary.prop/is_abstract.pass.cpp13
-rw-r--r--test/std/utilities/meta/meta.unary/meta.unary.prop/is_assignable.pass.cpp7
-rw-r--r--test/std/utilities/meta/meta.unary/meta.unary.prop/is_const.pass.cpp7
-rw-r--r--test/std/utilities/meta/meta.unary/meta.unary.prop/is_constructible.pass.cpp20
-rw-r--r--test/std/utilities/meta/meta.unary/meta.unary.prop/is_copy_assignable.pass.cpp7
-rw-r--r--test/std/utilities/meta/meta.unary/meta.unary.prop/is_copy_constructible.pass.cpp7
-rw-r--r--test/std/utilities/meta/meta.unary/meta.unary.prop/is_default_constructible.pass.cpp13
-rw-r--r--test/std/utilities/meta/meta.unary/meta.unary.prop/is_destructible.pass.cpp27
-rw-r--r--test/std/utilities/meta/meta.unary/meta.unary.prop/is_empty.pass.cpp13
-rw-r--r--test/std/utilities/meta/meta.unary/meta.unary.prop/is_final.pass.cpp13
-rw-r--r--test/std/utilities/meta/meta.unary/meta.unary.prop/is_literal_type.pass.cpp77
-rw-r--r--test/std/utilities/meta/meta.unary/meta.unary.prop/is_move_assignable.pass.cpp11
-rw-r--r--test/std/utilities/meta/meta.unary/meta.unary.prop/is_move_constructible.pass.cpp7
-rw-r--r--test/std/utilities/meta/meta.unary/meta.unary.prop/is_nothrow_assignable.pass.cpp7
-rw-r--r--test/std/utilities/meta/meta.unary/meta.unary.prop/is_nothrow_constructible.pass.cpp16
-rw-r--r--test/std/utilities/meta/meta.unary/meta.unary.prop/is_nothrow_copy_assignable.pass.cpp7
-rw-r--r--test/std/utilities/meta/meta.unary/meta.unary.prop/is_nothrow_copy_constructible.pass.cpp11
-rw-r--r--test/std/utilities/meta/meta.unary/meta.unary.prop/is_nothrow_default_constructible.pass.cpp13
-rw-r--r--test/std/utilities/meta/meta.unary/meta.unary.prop/is_nothrow_destructible.pass.cpp70
-rw-r--r--test/std/utilities/meta/meta.unary/meta.unary.prop/is_nothrow_move_assignable.pass.cpp7
-rw-r--r--test/std/utilities/meta/meta.unary/meta.unary.prop/is_nothrow_move_constructible.pass.cpp11
-rw-r--r--test/std/utilities/meta/meta.unary/meta.unary.prop/is_pod.pass.cpp13
-rw-r--r--test/std/utilities/meta/meta.unary/meta.unary.prop/is_polymorphic.pass.cpp13
-rw-r--r--test/std/utilities/meta/meta.unary/meta.unary.prop/is_signed.pass.cpp13
-rw-r--r--test/std/utilities/meta/meta.unary/meta.unary.prop/is_standard_layout.pass.cpp13
-rw-r--r--test/std/utilities/meta/meta.unary/meta.unary.prop/is_trivial.pass.cpp13
-rw-r--r--test/std/utilities/meta/meta.unary/meta.unary.prop/is_trivially_assignable.pass.cpp7
-rw-r--r--test/std/utilities/meta/meta.unary/meta.unary.prop/is_trivially_constructible.pass.cpp16
-rw-r--r--test/std/utilities/meta/meta.unary/meta.unary.prop/is_trivially_copy_assignable.pass.cpp7
-rw-r--r--test/std/utilities/meta/meta.unary/meta.unary.prop/is_trivially_copy_constructible.pass.cpp9
-rw-r--r--test/std/utilities/meta/meta.unary/meta.unary.prop/is_trivially_copyable.pass.cpp13
-rw-r--r--test/std/utilities/meta/meta.unary/meta.unary.prop/is_trivially_default_constructible.pass.cpp13
-rw-r--r--test/std/utilities/meta/meta.unary/meta.unary.prop/is_trivially_destructible.pass.cpp47
-rw-r--r--test/std/utilities/meta/meta.unary/meta.unary.prop/is_trivially_move_assignable.pass.cpp7
-rw-r--r--test/std/utilities/meta/meta.unary/meta.unary.prop/is_trivially_move_constructible.pass.cpp7
-rw-r--r--test/std/utilities/meta/meta.unary/meta.unary.prop/is_unsigned.pass.cpp13
-rw-r--r--test/std/utilities/meta/meta.unary/meta.unary.prop/is_volatile.pass.cpp7
-rw-r--r--test/std/utilities/ratio/ratio.comparison/ratio_equal.pass.cpp27
-rw-r--r--test/std/utilities/ratio/ratio.comparison/ratio_greater.pass.cpp27
-rw-r--r--test/std/utilities/ratio/ratio.comparison/ratio_greater_equal.pass.cpp27
-rw-r--r--test/std/utilities/ratio/ratio.comparison/ratio_less.pass.cpp39
-rw-r--r--test/std/utilities/ratio/ratio.comparison/ratio_less_equal.pass.cpp27
-rw-r--r--test/std/utilities/ratio/ratio.comparison/ratio_not_equal.pass.cpp27
-rw-r--r--test/std/utilities/template.bitset/bitset.cons/char_ptr_ctor.pass.cpp3
-rw-r--r--test/std/utilities/template.bitset/bitset.cons/string_ctor.pass.cpp3
-rw-r--r--test/std/utilities/template.bitset/bitset.cons/ull_ctor.pass.cpp1
-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/time/date.time/ctime.pass.cpp (renamed from test/std/utilities/date.time/tested_elsewhere.pass.cpp)2
-rw-r--r--test/std/utilities/time/time.duration/time.duration.alg/abs.fail.cpp27
-rw-r--r--test/std/utilities/time/time.duration/time.duration.alg/abs.pass.cpp50
-rw-r--r--test/std/utilities/time/time.duration/time.duration.cast/ceil.fail.cpp26
-rw-r--r--test/std/utilities/time/time.duration/time.duration.cast/ceil.pass.cpp51
-rw-r--r--test/std/utilities/time/time.duration/time.duration.cast/floor.fail.cpp26
-rw-r--r--test/std/utilities/time/time.duration/time.duration.cast/floor.pass.cpp50
-rw-r--r--test/std/utilities/time/time.duration/time.duration.cast/round.fail.cpp26
-rw-r--r--test/std/utilities/time/time.duration/time.duration.cast/round.pass.cpp50
-rw-r--r--test/std/utilities/time/time.point/time.point.cast/ceil.fail.cpp26
-rw-r--r--test/std/utilities/time/time.point/time.point.cast/ceil.pass.cpp69
-rw-r--r--test/std/utilities/time/time.point/time.point.cast/floor.fail.cpp26
-rw-r--r--test/std/utilities/time/time.point/time.point.cast/floor.pass.cpp68
-rw-r--r--test/std/utilities/time/time.point/time.point.cast/round.fail.cpp26
-rw-r--r--test/std/utilities/time/time.point/time.point.cast/round.pass.cpp68
-rw-r--r--test/std/utilities/time/time.traits/time.traits.is_fp/treat_as_floating_point.pass.cpp4
-rw-r--r--test/std/utilities/tuple/tuple.tuple/tuple.elem/get_const_rv.fail.cpp34
-rw-r--r--test/std/utilities/tuple/tuple.tuple/tuple.elem/get_const_rv.pass.cpp80
-rw-r--r--test/std/utilities/tuple/tuple.tuple/tuple.elem/tuple.by.type.pass.cpp45
-rw-r--r--test/std/utilities/utility/as_const/as_const.fail.cpp22
-rw-r--r--test/std/utilities/utility/as_const/as_const.pass.cpp46
-rw-r--r--test/std/utilities/utility/declval/declval.pass.cpp6
-rw-r--r--test/std/utilities/utility/forward/move_if_noexcept.pass.cpp15
-rw-r--r--test/std/utilities/utility/pairs/pair.astuple/get_const_rv.pass.cpp66
-rw-r--r--test/std/utilities/utility/pairs/pair.astuple/pairs.by.type.pass.cpp50
-rw-r--r--test/std/utilities/utility/pairs/pairs.pair/default-sfinae.pass.cpp164
-rw-r--r--test/std/utilities/utility/pairs/pairs.pair/default.pass.cpp17
-rw-r--r--test/std/utilities/utility/pairs/pairs.pair/swap.pass.cpp19
-rw-r--r--test/support/allocators.h8
-rw-r--r--test/support/any_helpers.h318
-rw-r--r--test/support/count_new.hpp43
-rw-r--r--test/support/disable_missing_braces_warning.h8
-rw-r--r--test/support/test_allocator.h4
-rw-r--r--test/support/test_macros.h27
-rwxr-xr-xtest/testit2
691 files changed, 15622 insertions, 5050 deletions
diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt
index ca937a8dba9a..b67b3b43f83e 100644
--- a/test/CMakeLists.txt
+++ b/test/CMakeLists.txt
@@ -6,84 +6,43 @@ macro(pythonize_bool var)
endif()
endmacro()
-set(LIT_EXECUTABLE "" CACHE FILEPATH "Path to LLVM's llvm-lit.")
-
-if(LIBCXX_BUILT_STANDALONE)
- # Make sure we can use the console pool for recent cmake and ninja > 1.5
- if(CMAKE_VERSION VERSION_LESS 3.1.20141117)
- set(cmake_3_2_USES_TERMINAL)
- else()
- set(cmake_3_2_USES_TERMINAL USES_TERMINAL)
- endif()
-else()
- include(FindPythonInterp)
- if(PYTHONINTERP_FOUND)
- set(LIT_EXECUTABLE
- ${PYTHON_EXECUTABLE} ${CMAKE_SOURCE_DIR}/utils/lit/lit.py)
- else()
- message(WARNING "Could not find Python, cannot set LIT_EXECUTABLE.")
- endif()
+set(LIBCXX_LIT_VARIANT "libcxx" CACHE STRING
+ "Configuration variant to use for LIT.")
+
+pythonize_bool(LIBCXX_ENABLE_EXCEPTIONS)
+pythonize_bool(LIBCXX_ENABLE_RTTI)
+pythonize_bool(LIBCXX_ENABLE_SHARED)
+pythonize_bool(LIBCXX_BUILD_32_BITS)
+pythonize_bool(LIBCXX_GENERATE_COVERAGE)
+pythonize_bool(LIBCXXABI_USE_LLVM_UNWINDER)
+
+# The tests shouldn't link to any ABI library when it has been linked into
+# libc++ statically or via a linker script.
+if (LIBCXX_ENABLE_STATIC_ABI_LIBRARY OR LIBCXX_ENABLE_ABI_LINKER_SCRIPT)
+ set(LIBCXX_CXX_ABI_LIBNAME "none")
endif()
-if (LIT_EXECUTABLE)
- set(LIT_ARGS_DEFAULT "-sv --show-unsupported --show-xfail")
- if (MSVC OR XCODE)
- set(LIT_ARGS_DEFAULT "${LIT_ARGS_DEFAULT} --no-progress-bar")
- endif()
- set(LLVM_LIT_ARGS "${LIT_ARGS_DEFAULT}"
- CACHE STRING "Default options for lit")
- set(LIT_ARGS "${LLVM_LIT_ARGS}")
- separate_arguments(LIT_ARGS)
-
- set(LIBCXX_LIT_VARIANT "libcxx" CACHE STRING
- "Configuration variant to use for LIT.")
-
- pythonize_bool(LIBCXX_ENABLE_EXCEPTIONS)
- pythonize_bool(LIBCXX_ENABLE_RTTI)
- pythonize_bool(LIBCXX_ENABLE_SHARED)
- pythonize_bool(LIBCXX_BUILD_32_BITS)
- pythonize_bool(LIBCXX_ENABLE_GLOBAL_FILESYSTEM_NAMESPACE)
- pythonize_bool(LIBCXX_ENABLE_STDIN)
- pythonize_bool(LIBCXX_ENABLE_STDOUT)
- pythonize_bool(LIBCXX_ENABLE_THREADS)
- pythonize_bool(LIBCXX_ENABLE_THREAD_UNSAFE_C_FUNCTIONS)
- pythonize_bool(LIBCXX_ENABLE_MONOTONIC_CLOCK)
- pythonize_bool(LIBCXX_GENERATE_COVERAGE)
- pythonize_bool(LIBCXXABI_USE_LLVM_UNWINDER)
-
- # The tests shouldn't link to any ABI library when it has been linked into
- # libc++ statically.
- if (LIBCXX_ENABLE_STATIC_ABI_LIBRARY)
- set(LIBCXX_CXX_ABI_LIBNAME "none")
- endif()
- set(LIBCXX_TARGET_INFO "libcxx.test.target_info.LocalTI" CACHE STRING
- "TargetInfo to use when setting up test environment.")
- set(LIBCXX_EXECUTOR "None" CACHE STRING
- "Executor to use when running tests.")
-
- set(AUTO_GEN_COMMENT "## Autogenerated by libcxx configuration.\n# Do not edit!")
-
- configure_file(
- ${CMAKE_CURRENT_SOURCE_DIR}/lit.site.cfg.in
- ${CMAKE_CURRENT_BINARY_DIR}/lit.site.cfg
- @ONLY)
-
- add_custom_target(check-libcxx
- COMMAND ${LIT_EXECUTABLE}
- ${LIT_ARGS}
- ${CMAKE_CURRENT_BINARY_DIR}
- DEPENDS cxx
- COMMENT "Running libcxx tests"
- ${cmake_3_2_USES_TERMINAL})
-
- if (LIBCXX_GENERATE_COVERAGE)
- include(CodeCoverage)
- set(output_dir "${CMAKE_CURRENT_BINARY_DIR}/coverage")
- set(capture_dirs "${LIBCXX_LIB_CMAKEFILES_DIR}/cxx.dir/;${CMAKE_CURRENT_BINARY_DIR}")
- set(extract_dirs "${LIBCXX_SOURCE_DIR}/include;${LIBCXX_SOURCE_DIR}/src")
- setup_lcov_test_target_coverage("cxx" "${output_dir}" "${capture_dirs}" "${extract_dirs}")
- endif()
-else()
- message(WARNING
- "LIT_EXECUTABLE not set, no check-libcxx target will be available!")
+set(LIBCXX_TARGET_INFO "libcxx.test.target_info.LocalTI" CACHE STRING
+ "TargetInfo to use when setting up test environment.")
+set(LIBCXX_EXECUTOR "None" CACHE STRING
+ "Executor to use when running tests.")
+
+set(AUTO_GEN_COMMENT "## Autogenerated by libcxx configuration.\n# Do not edit!")
+
+configure_file(
+ ${CMAKE_CURRENT_SOURCE_DIR}/lit.site.cfg.in
+ ${CMAKE_CURRENT_BINARY_DIR}/lit.site.cfg
+ @ONLY)
+
+add_lit_testsuite(check-libcxx
+ "Running libcxx tests"
+ ${CMAKE_CURRENT_BINARY_DIR}
+ DEPENDS cxx)
+
+if (LIBCXX_GENERATE_COVERAGE)
+ include(CodeCoverage)
+ set(output_dir "${CMAKE_CURRENT_BINARY_DIR}/coverage")
+ set(capture_dirs "${LIBCXX_LIB_CMAKEFILES_DIR}/cxx.dir/;${CMAKE_CURRENT_BINARY_DIR}")
+ set(extract_dirs "${LIBCXX_SOURCE_DIR}/include;${LIBCXX_SOURCE_DIR}/src")
+ setup_lcov_test_target_coverage("cxx" "${output_dir}" "${capture_dirs}" "${extract_dirs}")
endif()
diff --git a/test/std/atomics/libcpp-has-no-threads.fail.cpp b/test/libcxx/atomics/libcpp-has-no-threads.fail.cpp
index fe95e6a5983a..fe95e6a5983a 100644
--- a/test/std/atomics/libcpp-has-no-threads.fail.cpp
+++ b/test/libcxx/atomics/libcpp-has-no-threads.fail.cpp
diff --git a/test/std/atomics/libcpp-has-no-threads.pass.cpp b/test/libcxx/atomics/libcpp-has-no-threads.pass.cpp
index 9c0cccbda380..e587e6b4317a 100644
--- a/test/std/atomics/libcpp-has-no-threads.pass.cpp
+++ b/test/libcxx/atomics/libcpp-has-no-threads.pass.cpp
@@ -10,7 +10,7 @@
#ifdef _LIBCPP_HAS_NO_THREADS
#error This should be XFAIL'd for the purpose of detecting that the LIT feature\
- 'libcpp-has-no-threads' is available iff _LIBCPP_HAS_NO_THREADS is defined
+ 'libcpp-has-no-threads' is available iff _LIBCPP_HAS_NO_THREADS is defined
#endif
int main()
diff --git a/test/libcxx/compiler.py b/test/libcxx/compiler.py
index 7afbed461e31..4962038cbbed 100644
--- a/test/libcxx/compiler.py
+++ b/test/libcxx/compiler.py
@@ -150,3 +150,39 @@ class CXXCompiler(object):
cmd, out, err, rc = self.compile(os.devnull, out=os.devnull,
flags=flags)
return rc == 0
+
+ def addCompileFlagIfSupported(self, flag):
+ if isinstance(flag, list):
+ flags = list(flag)
+ else:
+ flags = [flag]
+ if self.hasCompileFlag(flags):
+ self.compile_flags += flags
+ return True
+ else:
+ return False
+
+ def addWarningFlagIfSupported(self, flag):
+ """
+ addWarningFlagIfSupported - Add a warning flag if the compiler
+ supports it. Unlike addCompileFlagIfSupported, this function detects
+ when "-Wno-<warning>" flags are unsupported. If flag is a
+ "-Wno-<warning>" GCC will not emit an unknown option diagnostic unless
+ another error is triggered during compilation.
+ """
+ assert isinstance(flag, str)
+ if not flag.startswith('-Wno-'):
+ return self.addCompileFlagIfSupported(flag)
+ flags = ['-Werror', flag]
+ cmd = self.compileCmd('-', os.devnull, flags)
+ # Remove '-v' because it will cause the command line invocation
+ # to be printed as part of the error output.
+ # TODO(EricWF): Are there other flags we need to worry about?
+ if '-v' in cmd:
+ cmd.remove('-v')
+ out, err, rc = lit.util.executeCommand(cmd, input='#error\n')
+ assert rc != 0
+ if flag in err:
+ return False
+ self.compile_flags += [flag]
+ return True
diff --git a/test/libcxx/containers/sequences/deque/incomplete.pass.cpp b/test/libcxx/containers/sequences/deque/incomplete.pass.cpp
new file mode 100644
index 000000000000..dbeea5f9aefb
--- /dev/null
+++ b/test/libcxx/containers/sequences/deque/incomplete.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <deque>
+
+// deque()
+// deque::iterator()
+
+#define _LIBCPP_ABI_INCOMPLETE_TYPES_IN_DEQUE
+#include <deque>
+#include <cassert>
+
+struct A {
+ std::deque<A> d;
+ std::deque<A>::iterator it;
+ std::deque<A>::reverse_iterator it2;
+};
+
+int main()
+{
+ A a;
+ assert(a.d.size() == 0);
+ a.it = a.d.begin();
+ a.it2 = a.d.rend();
+}
diff --git a/test/std/containers/sequences/vector/asan.pass.cpp b/test/libcxx/containers/sequences/vector/asan.pass.cpp
index 86c02b295624..b102fc08dafb 100644
--- a/test/std/containers/sequences/vector/asan.pass.cpp
+++ b/test/libcxx/containers/sequences/vector/asan.pass.cpp
@@ -7,6 +7,8 @@
//
//===----------------------------------------------------------------------===//
+// UNSUPPORTED: clang-3.3, clang-3.4, clang-3.5
+
// <vector>
// reference operator[](size_type n);
@@ -15,15 +17,21 @@
#include <cassert>
#include <cstdlib>
-#include "min_allocator.h"
#include "asan_testing.h"
+#include "min_allocator.h"
+#include "test_iterators.h"
+#include "test_macros.h"
#ifndef _LIBCPP_HAS_NO_ASAN
-extern "C" void __asan_set_error_exit_code(int);
+extern "C" void __sanitizer_set_death_callback(void (*callback)(void));
+
+void do_exit() {
+ exit(0);
+}
int main()
{
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef int T;
typedef std::vector<T, min_allocator<T>> C;
@@ -33,15 +41,26 @@ int main()
T foo = c[c.size()]; // bad, but not caught by ASAN
}
#endif
-
- __asan_set_error_exit_code(0);
+
+ {
+ typedef input_iterator<int*> MyInputIter;
+ // Sould not trigger ASan.
+ std::vector<int> v;
+ v.reserve(1);
+ int i[] = {42};
+ v.insert(v.begin(), MyInputIter(i), MyInputIter(i + 1));
+ assert(v[0] == 42);
+ assert(is_contiguous_container_asan_correct(v));
+ }
+
+ __sanitizer_set_death_callback(do_exit);
{
typedef int T;
typedef std::vector<T> C;
const T t[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
C c(std::begin(t), std::end(t));
c.reserve(2*c.size());
- assert(is_contiguous_container_asan_correct(c));
+ assert(is_contiguous_container_asan_correct(c));
assert(!__sanitizer_verify_contiguous_container ( c.data(), c.data() + 1, c.data() + c.capacity()));
T foo = c[c.size()]; // should trigger ASAN
assert(false); // if we got here, ASAN didn't trigger
diff --git a/test/std/containers/sequences/vector/asan_throw.pass.cpp b/test/libcxx/containers/sequences/vector/asan_throw.pass.cpp
index c100da1aade7..9af3f6be53e8 100644
--- a/test/std/containers/sequences/vector/asan_throw.pass.cpp
+++ b/test/libcxx/containers/sequences/vector/asan_throw.pass.cpp
@@ -7,6 +7,7 @@
//
//===----------------------------------------------------------------------===//
+// XFAIL: libcpp-no-exceptions
// Test asan vector annotations with a class that throws in a CTOR.
#include <vector>
diff --git a/test/libcxx/double_include.sh.cpp b/test/libcxx/double_include.sh.cpp
index 5620e5b35c2b..99767cf1bbc8 100644
--- a/test/libcxx/double_include.sh.cpp
+++ b/test/libcxx/double_include.sh.cpp
@@ -15,6 +15,12 @@
// RUN: %cxx -o %t.exe %t.first.o %t.second.o %flags %link_flags
// RUN: %run
+
+// Prevent <ext/hash_map> from generating deprecated warnings for this test.
+#if defined(__DEPRECATED)
+#undef __DEPRECATED
+#endif
+
#include <algorithm>
#include <array>
#include <bitset>
@@ -50,6 +56,7 @@
#include <deque>
#include <exception>
#include <experimental/algorithm>
+#include <experimental/any>
#include <experimental/chrono>
#include <experimental/dynarray>
#include <experimental/optional>
diff --git a/test/libcxx/experimental/any/size_and_alignment.pass.cpp b/test/libcxx/experimental/any/size_and_alignment.pass.cpp
new file mode 100644
index 000000000000..b7db54020478
--- /dev/null
+++ b/test/libcxx/experimental/any/size_and_alignment.pass.cpp
@@ -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.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++98, c++03, c++11
+
+// <experimental/any>
+
+// Check that the size and alignment of any are what we expect.
+
+#include <experimental/any>
+
+int main()
+{
+ using std::experimental::any;
+ static_assert(sizeof(any) == sizeof(void*)*4, "");
+ static_assert(alignof(any) == alignof(void*), "");
+}
diff --git a/test/libcxx/experimental/any/small_type.pass.cpp b/test/libcxx/experimental/any/small_type.pass.cpp
new file mode 100644
index 000000000000..e6595d4a4ab3
--- /dev/null
+++ b/test/libcxx/experimental/any/small_type.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
+
+// <experimental/any>
+
+// Check that the size and alignment of any are what we expect.
+
+#include <experimental/any>
+#include "any_helpers.h"
+
+constexpr std::size_t BufferSize = (sizeof(void*) * 3);
+constexpr std::size_t BufferAlignment = alignof(void*);
+// Clang doesn't like "alignof(BufferAlignment * 2)" due to PR13986.
+// So we create "DoubleBufferAlignment" instead.
+constexpr std::size_t DoubleBufferAlignment = BufferAlignment * 2;
+
+class SmallThrowsDtor
+{
+public:
+ SmallThrowsDtor() {}
+ SmallThrowsDtor(SmallThrowsDtor const &) noexcept {}
+ SmallThrowsDtor(SmallThrowsDtor &&) noexcept {}
+ ~SmallThrowsDtor() noexcept(false) {}
+};
+
+
+struct alignas(1) MaxSizeType {
+ char buff[BufferSize];
+};
+
+struct alignas(BufferAlignment) MaxAlignType {
+};
+
+struct alignas(BufferAlignment) MaxSizeAndAlignType {
+ char buff[BufferSize];
+};
+
+
+struct alignas(1) OverSizeType {
+ char buff[BufferSize + 1];
+};
+
+struct alignas(DoubleBufferAlignment) OverAlignedType {
+};
+
+struct alignas(DoubleBufferAlignment) OverSizeAndAlignedType {
+ char buff[BufferSize + 1];
+};
+
+int main()
+{
+ using std::experimental::any;
+ using std::experimental::__any_imp::_IsSmallObject;
+ static_assert(_IsSmallObject<small>::value, "");
+ static_assert(_IsSmallObject<void*>::value, "");
+ static_assert(!_IsSmallObject<SmallThrowsDtor>::value, "");
+ static_assert(!_IsSmallObject<large>::value, "");
+ {
+ // Check a type that meets the size requirement *exactly* and has
+ // a lesser alignment requirement is considered small.
+ typedef MaxSizeType T;
+ static_assert(sizeof(T) == BufferSize, "");
+ static_assert(alignof(T) < BufferAlignment, "");
+ static_assert(_IsSmallObject<T>::value, "");
+ }
+ {
+ // Check a type that meets the alignment requirement *exactly* and has
+ // a lesser size is considered small.
+ typedef MaxAlignType T;
+ static_assert(sizeof(T) < BufferSize, "");
+ static_assert(alignof(T) == BufferAlignment, "");
+ static_assert(_IsSmallObject<T>::value, "");
+ }
+ {
+ // Check a type that meets the size and alignment requirements *exactly*
+ // is considered small.
+ typedef MaxSizeAndAlignType T;
+ static_assert(sizeof(T) == BufferSize, "");
+ static_assert(alignof(T) == BufferAlignment, "");
+ static_assert(_IsSmallObject<T>::value, "");
+ }
+ {
+ // Check a type that meets the alignment requirements but is over-sized
+ // is not considered small.
+ typedef OverSizeType T;
+ static_assert(sizeof(T) > BufferSize, "");
+ static_assert(alignof(T) < BufferAlignment, "");
+ static_assert(!_IsSmallObject<T>::value, "");
+ }
+ {
+ // Check a type that meets the size requirements but is over-aligned
+ // is not considered small.
+ typedef OverAlignedType T;
+ static_assert(sizeof(T) < BufferSize, "");
+ static_assert(alignof(T) > BufferAlignment, "");
+ static_assert(!_IsSmallObject<T>::value, "");
+ }
+ {
+ // Check a type that exceeds both the size an alignment requirements
+ // is not considered small.
+ typedef OverSizeAndAlignedType T;
+ static_assert(sizeof(T) > BufferSize, "");
+ static_assert(alignof(T) > BufferAlignment, "");
+ static_assert(!_IsSmallObject<T>::value, "");
+ }
+}
diff --git a/test/libcxx/experimental/any/version.pass.cpp b/test/libcxx/experimental/any/version.pass.cpp
new file mode 100644
index 000000000000..611d65027b19
--- /dev/null
+++ b/test/libcxx/experimental/any/version.pass.cpp
@@ -0,0 +1,20 @@
+//===----------------------------------------------------------------------===//
+//
+// The 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>
+
+#include <experimental/any>
+
+#ifndef _LIBCPP_VERSION
+#error _LIBCPP_VERSION not defined
+#endif
+
+int main()
+{
+}
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
index 0effac2fc142..738c0c72592e 100644
--- a/test/libcxx/experimental/containers/sequences/dynarray/dynarray.cons/default.pass.cpp
+++ b/test/libcxx/experimental/containers/sequences/dynarray/dynarray.cons/default.pass.cpp
@@ -7,6 +7,9 @@
//
//===----------------------------------------------------------------------===//
+// XFAIL: libcpp-no-exceptions
+// UNSUPPORTED: c++98, c++03, c++11
+
// dynarray.cons
// explicit dynarray(size_type c);
@@ -16,22 +19,21 @@
// ~dynarray();
-
-#include <__config>
-
-#if _LIBCPP_STD_VER > 11
#include <experimental/dynarray>
#include <cassert>
#include <algorithm>
#include <complex>
+#include <limits>
+#include <new>
#include <string>
+
using std::experimental::dynarray;
template <class T>
-void test ( const std::initializer_list<T> &vals ) {
+void testInitList( const std::initializer_list<T> &vals ) {
typedef dynarray<T> dynA;
dynA d1 ( vals );
@@ -41,12 +43,14 @@ void test ( const std::initializer_list<T> &vals ) {
template <class T>
-void test ( const T &val ) {
+void test ( const T &val, bool DefaultValueIsIndeterminate = false) {
typedef dynarray<T> dynA;
dynA d1 ( 4 );
assert ( d1.size () == 4 );
- assert ( std::all_of ( d1.begin (), d1.end (), []( const T &item ){ return item == T(); } ));
+ if (!DefaultValueIsIndeterminate) {
+ assert ( std::all_of ( d1.begin (), d1.end (), []( const T &item ){ return item == T(); } ));
+ }
dynA d2 ( 7, val );
assert ( d2.size () == 7 );
@@ -60,27 +64,23 @@ void test ( const T &val ) {
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 );
- }
+}
-void test_bad_alloc () {
- try { dynarray<int> ( std::numeric_limits<size_t>::max() / sizeof ( int ) - 1 ); }
- catch ( std::bad_alloc & ) { return ; }
- assert ( false );
- }
int main()
{
-// test<int> ( 14 ); // ints don't get default initialized
- test<long> ( 0 );
- test<double> ( 14.0 );
+ 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" );
- 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")} );
+ 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 );
@@ -88,8 +88,4 @@ int main()
assert ( std::all_of ( d1.begin (), d1.end (), []( long item ){ return item == 3L; } ));
test_bad_length ();
- test_bad_alloc ();
}
-#else
-int main() {}
-#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
new file mode 100644
index 000000000000..612e661ea6db
--- /dev/null
+++ b/test/libcxx/experimental/containers/sequences/dynarray/dynarray.cons/default_throws_bad_alloc.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.
+//
+//===----------------------------------------------------------------------===//
+
+// XFAIL: libcpp-no-exceptions
+// 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, ubsan
+
+
+#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
index b669f25948ed..1bbd8cde92fe 100644
--- a/test/libcxx/experimental/containers/sequences/dynarray/dynarray.data/default.pass.cpp
+++ b/test/libcxx/experimental/containers/sequences/dynarray/dynarray.data/default.pass.cpp
@@ -7,15 +7,13 @@
//
//===----------------------------------------------------------------------===//
+// UNSUPPORTED: c++98, c++03, c++11
+
// dynarray.data
// T* data() noexcept;
// const T* data() const noexcept;
-
-#include <__config>
-
-#if _LIBCPP_STD_VER > 11
#include <experimental/dynarray>
#include <cassert>
@@ -27,41 +25,44 @@
using std::experimental::dynarray;
template <class T>
-void dyn_test_const ( const dynarray<T> &dyn ) {
+void dyn_test_const(const dynarray<T> &dyn, bool CheckEquals = true) {
const T *data = dyn.data ();
assert ( data != NULL );
- assert ( std::equal ( dyn.begin(), dyn.end(), data ));
+ if (CheckEquals) {
+ assert ( std::equal ( dyn.begin(), dyn.end(), data ));
}
+}
template <class T>
-void dyn_test ( dynarray<T> &dyn ) {
+void dyn_test( dynarray<T> &dyn, bool CheckEquals = true) {
T *data = dyn.data ();
assert ( data != NULL );
- assert ( std::equal ( dyn.begin(), dyn.end(), data ));
+ if (CheckEquals) {
+ assert ( std::equal ( dyn.begin(), dyn.end(), data ));
}
+}
template <class T>
-void test ( const T &val ) {
+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 d1 ( 4 );
- dyn_test ( d1 );
- dyn_test_const ( d1 );
-
- dynA d2 ( 7, val );
+ dynA d2 (7, val);
dyn_test ( d2 );
dyn_test_const ( d2 );
- }
+}
int main()
{
- test<int> ( 14 );
- test<double> ( 14.0 );
+ test<int>(14, /* DefaultValueIsIndeterminate */ true);
+ test<double>(14.0, true);
test<std::complex<double>> ( std::complex<double> ( 14, 0 ));
test<std::string> ( "fourteen" );
}
-#else
-int main() {}
-#endif
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
index 4d77cf732758..8c0d08538716 100644
--- a/test/libcxx/experimental/containers/sequences/dynarray/dynarray.overview/at.pass.cpp
+++ b/test/libcxx/experimental/containers/sequences/dynarray/dynarray.overview/at.pass.cpp
@@ -7,6 +7,7 @@
//
//===----------------------------------------------------------------------===//
+// XFAIL: libcpp-no-exceptions
// dynarray.overview
// const_reference at(size_type n) const;
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
index e82aa64b98b6..2af862a5530f 100644
--- 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
@@ -7,6 +7,8 @@
//
//===----------------------------------------------------------------------===//
+// UNSUPPORTED: c++98, c++03, c++11
+
// dynarray.overview
// reference front();
@@ -14,10 +16,6 @@
// reference back();
// const_reference back() const;
-
-#include <__config>
-
-#if _LIBCPP_STD_VER > 11
#include <experimental/dynarray>
#include <cassert>
@@ -29,40 +27,47 @@
using std::experimental::dynarray;
template <class T>
-void dyn_test_const ( const dynarray<T> &dyn ) {
+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 ());
+ 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 ) {
+void dyn_test ( dynarray<T> &dyn, bool CheckValues = true ) {
T *data = dyn.data ();
- assert ( *data == dyn.front ());
- assert ( *(data + dyn.size() - 1 ) == dyn.back ());
+ 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 ) {
+void test ( const T &val, bool DefaultValueIsIndeterminate = false) {
typedef dynarray<T> dynA;
-
+
+ const bool CheckDefaultValues = ! DefaultValueIsIndeterminate;
+
dynA d1 ( 4 );
- dyn_test ( d1 );
- dyn_test_const ( d1 );
+ 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 );
- test<double> ( 14.0 );
+ test<int> ( 14, /* DefaultValueIsIndeterminate */ true);
+ test<double> ( 14.0, true );
test<std::complex<double>> ( std::complex<double> ( 14, 0 ));
test<std::string> ( "fourteen" );
}
-#else
-int main() {}
-#endif
diff --git a/test/libcxx/test/config.py b/test/libcxx/test/config.py
index 09fbf66dbba0..fefbf01ad450 100644
--- a/test/libcxx/test/config.py
+++ b/test/libcxx/test/config.py
@@ -1,4 +1,3 @@
-import importlib
import locale
import os
import platform
@@ -12,6 +11,7 @@ import lit.util # pylint: disable=import-error,no-name-in-module
from libcxx.test.format import LibcxxTestFormat
from libcxx.compiler import CXXCompiler
+from libcxx.test.target_info import make_target_info
from libcxx.test.executor import *
from libcxx.test.tracing import *
@@ -42,13 +42,13 @@ def loadSiteConfig(lit_config, config, param_name, env_name):
ld_fn(config, site_cfg)
lit_config.load_config = ld_fn
-
class Configuration(object):
# pylint: disable=redefined-outer-name
def __init__(self, lit_config, config):
self.lit_config = lit_config
self.config = config
self.cxx = None
+ self.project_obj_root = None
self.libcxx_src_root = None
self.libcxx_obj_root = None
self.cxx_library_root = None
@@ -141,13 +141,7 @@ class Configuration(object):
self.executor = te
def configure_target_info(self):
- default = "libcxx.test.target_info.LocalTI"
- info_str = self.get_lit_conf('target_info', default)
- mod_path, _, info = info_str.rpartition('.')
- mod = importlib.import_module(mod_path)
- self.target_info = getattr(mod, info)()
- if info_str != default:
- self.lit_config.note("inferred target_info as: %r" % info_str)
+ self.target_info = make_target_info(self)
def configure_cxx(self):
# Gather various compiler parameters.
@@ -179,7 +173,14 @@ class Configuration(object):
'libcxx_src_root', os.path.dirname(self.config.test_source_root))
def configure_obj_root(self):
+ self.project_obj_root = self.get_lit_conf('project_obj_root')
self.libcxx_obj_root = self.get_lit_conf('libcxx_obj_root')
+ if not self.libcxx_obj_root and self.project_obj_root is not None:
+ possible_root = os.path.join(self.project_obj_root, 'projects', 'libcxx')
+ if os.path.isdir(possible_root):
+ self.libcxx_obj_root = possible_root
+ else:
+ self.libcxx_obj_root = self.project_obj_root
def configure_cxx_library_root(self):
self.cxx_library_root = self.get_lit_conf('cxx_library_root',
@@ -211,13 +212,12 @@ class Configuration(object):
def configure_execute_external(self):
# Choose between lit's internal shell pipeline runner and a real shell.
# If LIT_USE_INTERNAL_SHELL is in the environment, we use that as the
- # default value. Otherwise we default to internal on Windows and
- # external elsewhere, as bash on Windows is usually very slow.
+ # default value. Otherwise we ask the target_info.
use_lit_shell_default = os.environ.get('LIT_USE_INTERNAL_SHELL')
if use_lit_shell_default is not None:
use_lit_shell_default = use_lit_shell_default != '0'
else:
- use_lit_shell_default = sys.platform == 'win32'
+ use_lit_shell_default = self.target_info.use_lit_shell_default()
# Check for the command line parameter using the default value if it is
# not present.
use_lit_shell = self.get_lit_bool('use_lit_shell',
@@ -236,63 +236,10 @@ class Configuration(object):
if additional_features:
for f in additional_features.split(','):
self.config.available_features.add(f.strip())
+ self.target_info.add_locale_features(self.config.available_features)
- # Figure out which of the required locales we support
- locales = {
- 'Darwin': {
- 'en_US.UTF-8': 'en_US.UTF-8',
- 'cs_CZ.ISO8859-2': 'cs_CZ.ISO8859-2',
- 'fr_FR.UTF-8': 'fr_FR.UTF-8',
- 'fr_CA.ISO8859-1': 'fr_CA.ISO8859-1',
- 'ru_RU.UTF-8': 'ru_RU.UTF-8',
- 'zh_CN.UTF-8': 'zh_CN.UTF-8',
- },
- 'FreeBSD': {
- 'en_US.UTF-8': 'en_US.UTF-8',
- 'cs_CZ.ISO8859-2': 'cs_CZ.ISO8859-2',
- 'fr_FR.UTF-8': 'fr_FR.UTF-8',
- 'fr_CA.ISO8859-1': 'fr_CA.ISO8859-1',
- 'ru_RU.UTF-8': 'ru_RU.UTF-8',
- 'zh_CN.UTF-8': 'zh_CN.UTF-8',
- },
- 'Linux': {
- 'en_US.UTF-8': 'en_US.UTF-8',
- 'cs_CZ.ISO8859-2': 'cs_CZ.ISO-8859-2',
- 'fr_FR.UTF-8': 'fr_FR.UTF-8',
- 'fr_CA.ISO8859-1': 'fr_CA.ISO-8859-1',
- 'ru_RU.UTF-8': 'ru_RU.UTF-8',
- 'zh_CN.UTF-8': 'zh_CN.UTF-8',
- },
- 'Windows': {
- 'en_US.UTF-8': 'English_United States.1252',
- 'cs_CZ.ISO8859-2': 'Czech_Czech Republic.1250',
- 'fr_FR.UTF-8': 'French_France.1252',
- 'fr_CA.ISO8859-1': 'French_Canada.1252',
- 'ru_RU.UTF-8': 'Russian_Russia.1251',
- 'zh_CN.UTF-8': 'Chinese_China.936',
- },
- }
-
- target_system = self.target_info.system()
target_platform = self.target_info.platform()
- if target_system in locales:
- default_locale = locale.setlocale(locale.LC_ALL)
- for feature, loc in locales[target_system].items():
- try:
- locale.setlocale(locale.LC_ALL, loc)
- self.config.available_features.add(
- 'locale.{0}'.format(feature))
- except locale.Error:
- self.lit_config.warning('The locale {0} is not supported by '
- 'your platform. Some tests will be '
- 'unsupported.'.format(loc))
- locale.setlocale(locale.LC_ALL, default_locale)
- else:
- # Warn that the user doesn't get any free XFAILs for locale issues
- self.lit_config.warning("No locales entry for target_system: %s" %
- target_system)
-
# Write an "available feature" that combines the triple when
# use_system_cxx_lib is enabled. This is so that we can easily write
# XFAIL markers for tests that are known to fail with versions of
@@ -304,17 +251,6 @@ class Configuration(object):
# Insert the platform name into the available features as a lower case.
self.config.available_features.add(target_platform)
- # Some linux distributions have different locale data than others.
- # Insert the distributions name and name-version into the available
- # features to allow tests to XFAIL on them.
- if target_platform == 'linux':
- name = self.target_info.platform_name()
- ver = self.target_info.platform_ver()
- if name:
- self.config.available_features.add(name)
- if name and ver:
- self.config.available_features.add('%s-%s' % (name, ver))
-
# Simulator testing can take a really long time for some of these tests
# so add a feature check so we can REQUIRES: long_tests in them
self.long_tests = self.get_lit_bool('long_tests')
@@ -344,38 +280,33 @@ class Configuration(object):
# Try and get the std version from the command line. Fall back to
# default given in lit.site.cfg is not present. If default is not
# present then force c++11.
- std = self.get_lit_conf('std', 'c++11')
+ std = self.get_lit_conf('std')
+ if not std:
+ # Choose the newest possible language dialect if none is given.
+ possible_stds = ['c++1z', 'c++14', 'c++11', 'c++03']
+ for s in possible_stds:
+ if self.cxx.hasCompileFlag('-std=%s' % s):
+ std = s
+ self.lit_config.note(
+ 'inferred language dialect as: %s' % std)
+ break
+ if not std:
+ self.lit_config.fatal(
+ 'Failed to infer a supported language dialect from one of %r'
+ % possible_stds)
self.cxx.compile_flags += ['-std={0}'.format(std)]
self.config.available_features.add(std)
# Configure include paths
self.cxx.compile_flags += ['-nostdinc++']
self.configure_compile_flags_header_includes()
- if self.target_info.platform() == 'linux':
- self.cxx.compile_flags += ['-D__STDC_FORMAT_MACROS',
- '-D__STDC_LIMIT_MACROS',
- '-D__STDC_CONSTANT_MACROS']
+ self.target_info.add_cxx_compile_flags(self.cxx.compile_flags)
# Configure feature flags.
self.configure_compile_flags_exceptions()
self.configure_compile_flags_rtti()
- self.configure_compile_flags_no_global_filesystem_namespace()
- self.configure_compile_flags_no_stdin()
- self.configure_compile_flags_no_stdout()
+ self.configure_compile_flags_abi_version()
enable_32bit = self.get_lit_bool('enable_32bit', False)
if enable_32bit:
self.cxx.flags += ['-m32']
- # Configure threading features.
- enable_threads = self.get_lit_bool('enable_threads', True)
- enable_monotonic_clock = self.get_lit_bool('enable_monotonic_clock',
- True)
- if not enable_threads:
- self.configure_compile_flags_no_threads()
- if not enable_monotonic_clock:
- self.configure_compile_flags_no_monotonic_clock()
- elif not enable_monotonic_clock:
- self.lit_config.fatal('enable_monotonic_clock cannot be false when'
- ' enable_threads is true.')
- self.configure_compile_flags_no_thread_unsafe_c_functions()
-
# Use verbose output for better errors
self.cxx.flags += ['-v']
sysroot = self.get_lit_conf('sysroot')
@@ -391,6 +322,7 @@ class Configuration(object):
support_path = os.path.join(self.libcxx_src_root, 'test/support')
self.cxx.compile_flags += ['-I' + support_path]
self.cxx.compile_flags += ['-include', os.path.join(support_path, 'nasty_macros.hpp')]
+ self.configure_config_site_header()
libcxx_headers = self.get_lit_conf(
'libcxx_headers', os.path.join(self.libcxx_src_root, 'include'))
if not os.path.isdir(libcxx_headers):
@@ -398,6 +330,56 @@ class Configuration(object):
% libcxx_headers)
self.cxx.compile_flags += ['-I' + libcxx_headers]
+ def configure_config_site_header(self):
+ # Check for a possible __config_site in the build directory. We
+ # use this if it exists.
+ if self.libcxx_obj_root is None:
+ return
+ config_site_header = os.path.join(self.libcxx_obj_root, '__config_site')
+ if not os.path.isfile(config_site_header):
+ return
+ contained_macros = self.parse_config_site_and_add_features(
+ config_site_header)
+ self.lit_config.note('Using __config_site header %s with macros: %r'
+ % (config_site_header, contained_macros))
+ # FIXME: This must come after the call to
+ # 'parse_config_site_and_add_features(...)' in order for it to work.
+ self.cxx.compile_flags += ['-include', config_site_header]
+
+ def parse_config_site_and_add_features(self, header):
+ """ parse_config_site_and_add_features - Deduce and add the test
+ features that that are implied by the #define's in the __config_site
+ header. Return a dictionary containing the macros found in the
+ '__config_site' header.
+ """
+ # Parse the macro contents of __config_site by dumping the macros
+ # using 'c++ -dM -E' and filtering the predefines.
+ predefines = self.cxx.dumpMacros()
+ macros = self.cxx.dumpMacros(header)
+ feature_macros_keys = set(macros.keys()) - set(predefines.keys())
+ feature_macros = {}
+ for k in feature_macros_keys:
+ feature_macros[k] = macros[k]
+ # We expect the header guard to be one of the definitions
+ assert '_LIBCPP_CONFIG_SITE' in feature_macros
+ del feature_macros['_LIBCPP_CONFIG_SITE']
+ # The __config_site header should be non-empty. Otherwise it should
+ # have never been emitted by CMake.
+ assert len(feature_macros) > 0
+ # Transform each macro name into the feature name used in the tests.
+ # Ex. _LIBCPP_HAS_NO_THREADS -> libcpp-has-no-threads
+ for m in feature_macros:
+ if m == '_LIBCPP_ABI_VERSION':
+ self.config.available_features.add('libcpp-abi-version-v%s'
+ % feature_macros[m])
+ continue
+ assert m.startswith('_LIBCPP_HAS_') or m == '_LIBCPP_ABI_UNSTABLE'
+ m = m.lower()[1:].replace('_', '-')
+ self.config.available_features.add(m)
+ return feature_macros
+
+
+
def configure_compile_flags_exceptions(self):
enable_exceptions = self.get_lit_bool('enable_exceptions', True)
if not enable_exceptions:
@@ -410,43 +392,16 @@ class Configuration(object):
self.config.available_features.add('libcpp-no-rtti')
self.cxx.compile_flags += ['-fno-rtti', '-D_LIBCPP_NO_RTTI']
- def configure_compile_flags_no_global_filesystem_namespace(self):
- enable_global_filesystem_namespace = self.get_lit_bool(
- 'enable_global_filesystem_namespace', True)
- if not enable_global_filesystem_namespace:
- self.config.available_features.add(
- 'libcpp-has-no-global-filesystem-namespace')
- self.cxx.compile_flags += [
- '-D_LIBCPP_HAS_NO_GLOBAL_FILESYSTEM_NAMESPACE']
-
- def configure_compile_flags_no_stdin(self):
- enable_stdin = self.get_lit_bool('enable_stdin', True)
- if not enable_stdin:
- self.config.available_features.add('libcpp-has-no-stdin')
- self.cxx.compile_flags += ['-D_LIBCPP_HAS_NO_STDIN']
-
- def configure_compile_flags_no_stdout(self):
- enable_stdout = self.get_lit_bool('enable_stdout', True)
- if not enable_stdout:
- self.config.available_features.add('libcpp-has-no-stdout')
- self.cxx.compile_flags += ['-D_LIBCPP_HAS_NO_STDOUT']
-
- def configure_compile_flags_no_threads(self):
- self.cxx.compile_flags += ['-D_LIBCPP_HAS_NO_THREADS']
- self.config.available_features.add('libcpp-has-no-threads')
-
- def configure_compile_flags_no_thread_unsafe_c_functions(self):
- enable_thread_unsafe_c_functions = self.get_lit_bool(
- 'enable_thread_unsafe_c_functions', True)
- if not enable_thread_unsafe_c_functions:
- self.cxx.compile_flags += [
- '-D_LIBCPP_HAS_NO_THREAD_UNSAFE_C_FUNCTIONS']
- self.config.available_features.add(
- 'libcpp-has-no-thread-unsafe-c-functions')
-
- def configure_compile_flags_no_monotonic_clock(self):
- self.cxx.compile_flags += ['-D_LIBCPP_HAS_NO_MONOTONIC_CLOCK']
- self.config.available_features.add('libcpp-has-no-monotonic-clock')
+ def configure_compile_flags_abi_version(self):
+ abi_version = self.get_lit_conf('abi_version', '').strip()
+ abi_unstable = self.get_lit_bool('abi_unstable')
+ # Only add the ABI version when it is non-default.
+ # FIXME(EricWF): Get the ABI version from the "__config_site".
+ if abi_version and abi_version != '1':
+ self.cxx.compile_flags += ['-D_LIBCPP_ABI_VERSION=' + abi_version]
+ if abi_unstable:
+ self.config.available_features.add('libcpp-abi-unstable')
+ self.cxx.compile_flags += ['-D_LIBCPP_ABI_UNSTABLE']
def configure_link_flags(self):
no_default_flags = self.get_lit_bool('no_default_flags', False)
@@ -505,9 +460,7 @@ class Configuration(object):
elif cxx_abi == 'libsupc++':
self.cxx.link_flags += ['-lsupc++']
elif cxx_abi == 'libcxxabi':
- # Don't link libc++abi explicitly on OS X because the symbols
- # should be available in libc++ directly.
- if self.target_info.platform() != 'darwin':
+ if self.target_info.allow_cxxabi_link():
self.cxx.link_flags += ['-lc++abi']
elif cxx_abi == 'libcxxrt':
self.cxx.link_flags += ['-lcxxrt']
@@ -518,26 +471,7 @@ class Configuration(object):
'C++ ABI setting %s unsupported for tests' % cxx_abi)
def configure_extra_library_flags(self):
- enable_threads = self.get_lit_bool('enable_threads', True)
- llvm_unwinder = self.get_lit_bool('llvm_unwinder', False)
- target_platform = self.target_info.platform()
- if target_platform == 'darwin':
- self.cxx.link_flags += ['-lSystem']
- elif target_platform == 'linux':
- if not llvm_unwinder:
- self.cxx.link_flags += ['-lgcc_eh']
- self.cxx.link_flags += ['-lc', '-lm']
- if enable_threads:
- self.cxx.link_flags += ['-lpthread']
- self.cxx.link_flags += ['-lrt']
- if llvm_unwinder:
- self.cxx.link_flags += ['-lunwind', '-ldl']
- else:
- self.cxx.link_flags += ['-lgcc_s']
- elif target_platform.startswith('freebsd'):
- self.cxx.link_flags += ['-lc', '-lm', '-lpthread', '-lgcc_s', '-lcxxrt']
- else:
- self.lit_config.fatal("unrecognized system: %r" % target_platform)
+ self.target_info.add_cxx_link_flags(self.cxx.link_flags)
def configure_color_diagnostics(self):
use_color = self.get_lit_conf('color_diagnostics')
@@ -570,14 +504,28 @@ class Configuration(object):
def configure_warnings(self):
enable_warnings = self.get_lit_bool('enable_warnings', False)
if enable_warnings:
- self.cxx.compile_flags += ['-Wsystem-headers', '-Wall', '-Werror']
- if ('clang' in self.config.available_features or
- 'apple-clang' in self.config.available_features):
- self.cxx.compile_flags += ['-Wno-user-defined-literals']
+ self.cxx.compile_flags += [
+ '-D_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER',
+ '-Wall', '-Werror'
+ ]
+ self.cxx.addWarningFlagIfSupported('-Wno-attributes')
+ self.cxx.addWarningFlagIfSupported('-Wno-pessimizing-move')
+ self.cxx.addWarningFlagIfSupported('-Wno-c++11-extensions')
+ self.cxx.addWarningFlagIfSupported('-Wno-user-defined-literals')
+ # TODO(EricWF) Remove the unused warnings once the test suite
+ # compiles clean with them.
+ self.cxx.addWarningFlagIfSupported('-Wno-unused-local-typedef')
+ self.cxx.addWarningFlagIfSupported('-Wno-unused-variable')
+ std = self.get_lit_conf('std', None)
+ if std in ['c++98', 'c++03']:
+ # The '#define static_assert' provided by libc++ in C++03 mode
+ # causes an unused local typedef whenever it is used.
+ self.cxx.addWarningFlagIfSupported('-Wno-unused-local-typedef')
def configure_sanitizer(self):
san = self.get_lit_conf('use_sanitizer', '').strip()
if san:
+ self.target_info.add_sanitizer_features(san, self.config.available_features)
# Search for llvm-symbolizer along the compiler path first
# and then along the PATH env variable.
symbolizer_search_paths = os.environ.get('PATH', '')
@@ -590,8 +538,6 @@ class Configuration(object):
symbolizer_search_paths)
# Setup the sanitizer compile flags
self.cxx.flags += ['-g', '-fno-omit-frame-pointer']
- if self.target_info.platform() == 'linux':
- self.cxx.link_flags += ['-ldl']
if san == 'Address':
self.cxx.flags += ['-fsanitize=address']
if llvm_symbolizer is not None:
@@ -620,6 +566,10 @@ class Configuration(object):
else:
self.lit_config.fatal('unsupported value for '
'use_sanitizer: {0}'.format(san))
+ san_lib = self.get_lit_conf('sanitizer_library')
+ if san_lib:
+ self.cxx.link_flags += [
+ san_lib, '-Wl,-rpath,%s' % os.path.dirname(san_lib)]
def configure_coverage(self):
self.generate_coverage = self.get_lit_bool('generate_coverage', False)
@@ -692,18 +642,4 @@ class Configuration(object):
"inferred target_triple as: %r" % self.config.target_triple)
def configure_env(self):
- if self.target_info.platform() == 'darwin':
- library_paths = []
- # Configure the library path for libc++
- libcxx_library = self.get_lit_conf('libcxx_library')
- if self.use_system_cxx_lib:
- pass
- elif libcxx_library:
- library_paths += [os.path.dirname(libcxx_library)]
- elif self.cxx_library_root:
- library_paths += [self.cxx_library_root]
- # Configure the abi library path
- if self.abi_library_root:
- library_paths += [self.abi_library_root]
- if library_paths:
- self.env['DYLD_LIBRARY_PATH'] = ':'.join(library_paths)
+ self.target_info.configure_env(self.env)
diff --git a/test/libcxx/test/format.py b/test/libcxx/test/format.py
index 238dcdb29af7..19c9fc742a49 100644
--- a/test/libcxx/test/format.py
+++ b/test/libcxx/test/format.py
@@ -64,20 +64,24 @@ class LibcxxTestFormat(object):
return (lit.Test.UNSUPPORTED,
"A lit.local.cfg marked this unsupported")
- res = lit.TestRunner.parseIntegratedTestScript(
+ script = lit.TestRunner.parseIntegratedTestScript(
test, require_script=is_sh_test)
# Check if a result for the test was returned. If so return that
# result.
- if isinstance(res, lit.Test.Result):
- return res
+ if isinstance(script, lit.Test.Result):
+ return script
if lit_config.noExecute:
return lit.Test.Result(lit.Test.PASS)
- # res is not an instance of lit.test.Result. Expand res into its parts.
- script, tmpBase, execDir = res
+
# Check that we don't have run lines on tests that don't support them.
if not is_sh_test and len(script) != 0:
lit_config.fatal('Unsupported RUN line found in test %s' % name)
+ tmpDir, tmpBase = lit.TestRunner.getTempPaths(test)
+ substitutions = lit.TestRunner.getDefaultSubstitutions(test, tmpDir,
+ tmpBase)
+ script = lit.TestRunner.applySubstitutions(script, substitutions)
+
# Dispatch the test based on its suffix.
if is_sh_test:
if not isinstance(self.executor, LocalExecutor):
@@ -86,11 +90,11 @@ class LibcxxTestFormat(object):
return lit.Test.UNSUPPORTED, 'ShTest format not yet supported'
return lit.TestRunner._runShTest(test, lit_config,
self.execute_external, script,
- tmpBase, execDir)
+ tmpBase)
elif is_fail_test:
return self._evaluate_fail_test(test)
elif is_pass_test:
- return self._evaluate_pass_test(test, tmpBase, execDir, lit_config)
+ return self._evaluate_pass_test(test, tmpBase, lit_config)
else:
# No other test type is supported
assert False
@@ -98,7 +102,8 @@ class LibcxxTestFormat(object):
def _clean(self, exec_path): # pylint: disable=no-self-use
libcxx.util.cleanFile(exec_path)
- def _evaluate_pass_test(self, test, tmpBase, execDir, lit_config):
+ def _evaluate_pass_test(self, test, tmpBase, lit_config):
+ execDir = os.path.dirname(test.getExecPath())
source_path = test.getSourcePath()
exec_path = tmpBase + '.exe'
object_path = tmpBase + '.o'
diff --git a/test/libcxx/test/target_info.py b/test/libcxx/test/target_info.py
index a61737786896..667644d2fec6 100644
--- a/test/libcxx/test/target_info.py
+++ b/test/libcxx/test/target_info.py
@@ -1,55 +1,202 @@
+import importlib
+import lit.util # pylint: disable=import-error,no-name-in-module
import locale
+import os
import platform
import sys
-class TargetInfo(object):
+class DefaultTargetInfo(object):
+ def __init__(self, full_config):
+ self.full_config = full_config
+
def platform(self):
- raise NotImplementedError
+ return sys.platform.lower().strip()
- def system(self):
- raise NotImplementedError
+ def add_locale_features(self, features):
+ self.full_config.lit_config.warning(
+ "No locales entry for target_system: %s" % self.platform())
- def platform_ver(self):
- raise NotImplementedError
+ def add_cxx_compile_flags(self, flags): pass
+ def add_cxx_link_flags(self, flags): pass
+ def configure_env(self, env): pass
+ def allow_cxxabi_link(self): return True
+ def add_sanitizer_features(self, sanitizer_type, features): pass
+ def use_lit_shell_default(self): return False
- def platform_name(self):
- raise NotImplementedError
- def supports_locale(self, loc):
- raise NotImplementedError
+def test_locale(loc):
+ assert loc is not None
+ default_locale = locale.setlocale(locale.LC_ALL)
+ try:
+ locale.setlocale(locale.LC_ALL, loc)
+ return True
+ except locale.Error:
+ return False
+ finally:
+ locale.setlocale(locale.LC_ALL, default_locale)
-class LocalTI(TargetInfo):
- def platform(self):
- platform_name = sys.platform.lower().strip()
- # Strip the '2' from linux2.
- if platform_name.startswith('linux'):
- platform_name = 'linux'
- return platform_name
+def add_common_locales(features, lit_config):
+ # A list of locales needed by the test-suite.
+ # The list uses the canonical name for the locale used in the test-suite
+ # TODO: On Linux ISO8859 *may* needs to hyphenated.
+ locales = [
+ 'en_US.UTF-8',
+ 'fr_FR.UTF-8',
+ 'ru_RU.UTF-8',
+ 'zh_CN.UTF-8',
+ 'fr_CA.ISO8859-1',
+ 'cs_CZ.ISO8859-2'
+ ]
+ for loc in locales:
+ if test_locale(loc):
+ features.add('locale.{0}'.format(loc))
+ else:
+ lit_config.warning('The locale {0} is not supported by '
+ 'your platform. Some tests will be '
+ 'unsupported.'.format(loc))
+
+
+class DarwinLocalTI(DefaultTargetInfo):
+ def __init__(self, full_config):
+ super(DarwinLocalTI, self).__init__(full_config)
+
+ def add_locale_features(self, features):
+ add_common_locales(feature, self.full_config.lit_config)
+
+ def add_cxx_compile_flags(self, flags):
+ try:
+ out = lit.util.capture(['xcrun', '--show-sdk-path']).strip()
+ res = 0
+ except OSError:
+ res = -1
+ if res == 0 and out:
+ sdk_path = out
+ self.full_config.lit_config.note('using SDKROOT: %r' % sdk_path)
+ flags += ["-isysroot", sdk_path]
+
+ def add_cxx_link_flags(self, flags):
+ flags += ['-lSystem']
+
+ def configure_env(self, env):
+ library_paths = []
+ # Configure the library path for libc++
+ libcxx_library = self.full_config.get_lit_conf('libcxx_library')
+ if self.full_config.use_system_cxx_lib:
+ pass
+ elif libcxx_library:
+ library_paths += [os.path.dirname(libcxx_library)]
+ elif self.full_config.cxx_library_root:
+ library_paths += [self.full_config.cxx_library_root]
+ # Configure the abi library path
+ if self.full_config.abi_library_root:
+ library_paths += [self.full_config.abi_library_root]
+ if library_paths:
+ env['DYLD_LIBRARY_PATH'] = ':'.join(library_paths)
+
+ def allow_cxxabi_link(self):
+ # Don't link libc++abi explicitly on OS X because the symbols
+ # should be available in libc++ directly.
+ return False
+
+ def add_sanitizer_features(self, sanitizer_type, features):
+ if san == 'Undefined':
+ features.add('sanitizer-new-delete')
+
+
+class FreeBSDLocalTI(DefaultTargetInfo):
+ def __init__(self, full_config):
+ super(FreeBSDLocalTI, self).__init__(full_config)
- def system(self):
- return platform.system()
+ def add_locale_features(self, features):
+ add_common_locales(features, self.full_config.lit_config)
+
+ def add_cxx_link_flags(self, flags):
+ flags += ['-lc', '-lm', '-lpthread', '-lgcc_s', '-lcxxrt']
+
+
+class LinuxLocalTI(DefaultTargetInfo):
+ def __init__(self, full_config):
+ super(LinuxLocalTI, self).__init__(full_config)
+
+ def platform(self):
+ return 'linux'
def platform_name(self):
- if self.platform() == 'linux':
- name, _, _ = platform.linux_distribution()
- name = name.lower().strip()
- if name:
- return name
- return None
+ name, _, _ = platform.linux_distribution()
+ name = name.lower().strip()
+ return name # Permitted to be None
def platform_ver(self):
- if self.platform() == 'linux':
- _, ver, _ = platform.linux_distribution()
- ver = ver.lower().strip()
- if ver:
- return ver
- return None
-
- def supports_locale(self, loc):
- try:
- locale.setlocale(locale.LC_ALL, loc)
- return True
- except locale.Error:
- return False
+ _, ver, _ = platform.linux_distribution()
+ ver = ver.lower().strip()
+ return ver # Permitted to be None.
+
+ def add_locale_features(self, features):
+ add_common_locales(features, self.full_config.lit_config)
+ # Some linux distributions have different locale data than others.
+ # Insert the distributions name and name-version into the available
+ # features to allow tests to XFAIL on them.
+ name = self.platform_name()
+ ver = self.platform_ver()
+ if name:
+ features.add(name)
+ if name and ver:
+ features.add('%s-%s' % (name, ver))
+
+ def add_cxx_compile_flags(self, flags):
+ flags += ['-D__STDC_FORMAT_MACROS',
+ '-D__STDC_LIMIT_MACROS',
+ '-D__STDC_CONSTANT_MACROS']
+
+ def add_cxx_link_flags(self, flags):
+ enable_threads = ('libcpp-has-no-threads' not in
+ self.full_config.config.available_features)
+ llvm_unwinder = self.full_config.get_lit_bool('llvm_unwinder', False)
+ flags += ['-lm']
+ if not llvm_unwinder:
+ flags += ['-lgcc_s', '-lgcc']
+ if enable_threads:
+ flags += ['-lpthread']
+ flags += ['-lc']
+ if llvm_unwinder:
+ flags += ['-lunwind', '-ldl']
+ else:
+ flags += ['-lgcc_s', '-lgcc']
+ san = self.full_config.get_lit_conf('use_sanitizer', '').strip()
+ if san:
+ # The libraries and their order are taken from the
+ # linkSanitizerRuntimeDeps function in
+ # clang/lib/Driver/Tools.cpp
+ flags += ['-lpthread', '-lrt', '-lm', '-ldl']
+
+
+class WindowsLocalTI(DefaultTargetInfo):
+ def __init__(self, full_config):
+ super(WindowsLocalTI, self).__init__(full_config)
+
+ def add_locale_features(self, features):
+ add_common_locales(features, self.full_config.lit_config)
+
+ def use_lit_shell_default(self):
+ # Default to the internal shell on Windows, as bash on Windows is
+ # usually very slow.
+ return True
+
+
+def make_target_info(full_config):
+ default = "libcxx.test.target_info.LocalTI"
+ info_str = full_config.get_lit_conf('target_info', default)
+ if info_str != default:
+ mod_path, _, info = info_str.rpartition('.')
+ mod = importlib.import_module(mod_path)
+ target_info = getattr(mod, info)(full_config)
+ full_config.lit_config.note("inferred target_info as: %r" % info_str)
+ return target_info
+ target_system = platform.system()
+ if target_system == 'Darwin': return DarwinLocalTI(full_config)
+ if target_system == 'FreeBSD': return FreeBSDLocalTI(full_config)
+ if target_system == 'Linux': return LinuxLocalTI(full_config)
+ if target_system == 'Windows': return WindowsLocalTI(full_config)
+ return DefaultTargetInfo(full_config)
diff --git a/test/libcxx/test/tracing.py b/test/libcxx/test/tracing.py
index efef158160c5..766fc192f9f5 100644
--- a/test/libcxx/test/tracing.py
+++ b/test/libcxx/test/tracing.py
@@ -11,14 +11,14 @@ def trace_function(function, log_calls, log_results, label=''):
# Perform the call itself, logging before, after, and anything thrown.
try:
if log_calls:
- print '{}: Calling {}'.format(label, call_str)
+ print('{}: Calling {}'.format(label, call_str))
res = function(*args, **kwargs)
if log_results:
- print '{}: {} -> {}'.format(label, call_str, res)
+ print('{}: {} -> {}'.format(label, call_str, res))
return res
except Exception as ex:
if log_results:
- print '{}: {} raised {}'.format(label, call_str, type(ex))
+ print('{}: {} raised {}'.format(label, call_str, type(ex)))
raise ex
return wrapper
diff --git a/test/std/thread/futures/version.pass.cpp b/test/libcxx/thread/futures/version.pass.cpp
index 6730a1477db7..6730a1477db7 100644
--- a/test/std/thread/futures/version.pass.cpp
+++ b/test/libcxx/thread/futures/version.pass.cpp
diff --git a/test/libcxx/type_traits/convert_to_integral.pass.cpp b/test/libcxx/type_traits/convert_to_integral.pass.cpp
index b97832b5e6d7..3fdc98f5468f 100644
--- a/test/libcxx/type_traits/convert_to_integral.pass.cpp
+++ b/test/libcxx/type_traits/convert_to_integral.pass.cpp
@@ -1,7 +1,22 @@
-
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+//
// TODO: Make this test pass for all standards.
// XFAIL: c++98, c++03
+// <type_traits>
+
+// __convert_to_integral(Tp)
+
+// Test that the __convert_to_integral functions properly converts Tp to the
+// correct type and value for integral, enum and user defined types.
+
#include <limits>
#include <type_traits>
#include <cstdint>
diff --git a/test/libcxx/type_traits/lazy_metafunctions.pass.cpp b/test/libcxx/type_traits/lazy_metafunctions.pass.cpp
new file mode 100644
index 000000000000..8f75080ab956
--- /dev/null
+++ b/test/libcxx/type_traits/lazy_metafunctions.pass.cpp
@@ -0,0 +1,137 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+//
+// UNSUPPORTED: c++98, c++03
+
+// <type_traits>
+
+// __lazy_enable_if, __lazy_not, __lazy_and and __lazy_or
+
+// Test the libc++ lazy meta-programming helpers in <type_traits>
+
+#include <type_traits>
+
+template <class Type>
+struct Identity {
+ typedef Type type;
+};
+
+typedef std::true_type TrueT;
+typedef std::false_type FalseT;
+
+typedef Identity<TrueT> LazyTrueT;
+typedef Identity<FalseT> LazyFalseT;
+
+// A type that cannot be instantiated
+template <class T>
+struct CannotInst {
+ typedef T type;
+ static_assert(std::is_same<T, T>::value == false, "");
+};
+
+
+template <int Value>
+struct NextInt {
+ typedef NextInt<Value + 1> type;
+ static const int value = Value;
+};
+
+template <int Value>
+const int NextInt<Value>::value;
+
+
+template <class Type>
+struct HasTypeImp {
+ template <class Up, class = typename Up::type>
+ static TrueT test(int);
+ template <class>
+ static FalseT test(...);
+
+ typedef decltype(test<Type>(0)) type;
+};
+
+// A metafunction that returns True if Type has a nested 'type' typedef
+// and false otherwise.
+template <class Type>
+struct HasType : HasTypeImp<Type>::type {};
+
+void LazyEnableIfTest() {
+ {
+ typedef std::__lazy_enable_if<true, NextInt<0> > Result;
+ static_assert(HasType<Result>::value, "");
+ static_assert(Result::type::value == 1, "");
+ }
+ {
+ typedef std::__lazy_enable_if<false, CannotInst<int> > Result;
+ static_assert(!HasType<Result>::value, "");
+ }
+}
+
+void LazyNotTest() {
+ {
+ typedef std::__lazy_not<LazyTrueT> NotT;
+ static_assert(std::is_same<typename NotT::type, FalseT>::value, "");
+ static_assert(NotT::value == false, "");
+ }
+ {
+ typedef std::__lazy_not<LazyFalseT> NotT;
+ static_assert(std::is_same<typename NotT::type, TrueT>::value, "");
+ static_assert(NotT::value == true, "");
+ }
+ {
+ // Check that CannotInst<int> is not instantiated.
+ typedef std::__lazy_not<CannotInst<int> > NotT;
+
+ static_assert(std::is_same<NotT, NotT>::value, "");
+
+ }
+}
+
+void LazyAndTest() {
+ { // Test that it acts as the identity function for a single value
+ static_assert(std::__lazy_and<LazyFalseT>::value == false, "");
+ static_assert(std::__lazy_and<LazyTrueT>::value == true, "");
+ }
+ {
+ static_assert(std::__lazy_and<LazyTrueT, LazyTrueT>::value == true, "");
+ static_assert(std::__lazy_and<LazyTrueT, LazyFalseT>::value == false, "");
+ static_assert(std::__lazy_and<LazyFalseT, LazyTrueT>::value == false, "");
+ static_assert(std::__lazy_and<LazyFalseT, LazyFalseT>::value == false, "");
+ }
+ { // Test short circuiting - CannotInst<T> should never be instantiated.
+ static_assert(std::__lazy_and<LazyFalseT, CannotInst<int>>::value == false, "");
+ static_assert(std::__lazy_and<LazyTrueT, LazyFalseT, CannotInst<int>>::value == false, "");
+ }
+}
+
+
+void LazyOrTest() {
+ { // Test that it acts as the identity function for a single value
+ static_assert(std::__lazy_or<LazyFalseT>::value == false, "");
+ static_assert(std::__lazy_or<LazyTrueT>::value == true, "");
+ }
+ {
+ static_assert(std::__lazy_or<LazyTrueT, LazyTrueT>::value == true, "");
+ static_assert(std::__lazy_or<LazyTrueT, LazyFalseT>::value == true, "");
+ static_assert(std::__lazy_or<LazyFalseT, LazyTrueT>::value == true, "");
+ static_assert(std::__lazy_or<LazyFalseT, LazyFalseT>::value == false, "");
+ }
+ { // Test short circuiting - CannotInst<T> should never be instantiated.
+ static_assert(std::__lazy_or<LazyTrueT, CannotInst<int>>::value == true, "");
+ static_assert(std::__lazy_or<LazyFalseT, LazyTrueT, CannotInst<int>>::value == true, "");
+ }
+}
+
+
+int main() {
+ LazyEnableIfTest();
+ LazyNotTest();
+ LazyAndTest();
+ LazyOrTest();
+} \ No newline at end of file
diff --git a/test/libcxx/utilities/memory/util.smartptr/race_condition.pass.cpp b/test/libcxx/utilities/memory/util.smartptr/race_condition.pass.cpp
index 25dd31190685..fce8443ebd0c 100644
--- a/test/libcxx/utilities/memory/util.smartptr/race_condition.pass.cpp
+++ b/test/libcxx/utilities/memory/util.smartptr/race_condition.pass.cpp
@@ -87,7 +87,8 @@ int main() {
}
{
// Test with in-place shared_count.
- Ptr p = std::make_shared<int>(42);
+ int val = 42;
+ Ptr p = std::make_shared<int>(val);
run_test(p);
assert(p.use_count() == 1);
}
diff --git a/test/std/utilities/date.time/asctime.thread-unsafe.fail.cpp b/test/libcxx/utilities/time/date.time/asctime.thread-unsafe.fail.cpp
index 3a9749e21c52..3a9749e21c52 100644
--- a/test/std/utilities/date.time/asctime.thread-unsafe.fail.cpp
+++ b/test/libcxx/utilities/time/date.time/asctime.thread-unsafe.fail.cpp
diff --git a/test/std/utilities/date.time/ctime.thread-unsafe.fail.cpp b/test/libcxx/utilities/time/date.time/ctime.thread-unsafe.fail.cpp
index cd246c631527..cd246c631527 100644
--- a/test/std/utilities/date.time/ctime.thread-unsafe.fail.cpp
+++ b/test/libcxx/utilities/time/date.time/ctime.thread-unsafe.fail.cpp
diff --git a/test/std/utilities/date.time/gmtime.thread-unsafe.fail.cpp b/test/libcxx/utilities/time/date.time/gmtime.thread-unsafe.fail.cpp
index a6debcbd98d8..a6debcbd98d8 100644
--- a/test/std/utilities/date.time/gmtime.thread-unsafe.fail.cpp
+++ b/test/libcxx/utilities/time/date.time/gmtime.thread-unsafe.fail.cpp
diff --git a/test/std/utilities/date.time/localtime.thread-unsafe.fail.cpp b/test/libcxx/utilities/time/date.time/localtime.thread-unsafe.fail.cpp
index c9e55c8fd3a6..c9e55c8fd3a6 100644
--- a/test/std/utilities/date.time/localtime.thread-unsafe.fail.cpp
+++ b/test/libcxx/utilities/time/date.time/localtime.thread-unsafe.fail.cpp
diff --git a/test/lit.site.cfg.in b/test/lit.site.cfg.in
index 17f0686add6e..fa25834d1110 100644
--- a/test/lit.site.cfg.in
+++ b/test/lit.site.cfg.in
@@ -1,6 +1,6 @@
@AUTO_GEN_COMMENT@
config.cxx_under_test = "@LIBCXX_COMPILER@"
-config.std = "@LIBCXX_STD_VERSION@"
+config.project_obj_root = "@CMAKE_BINARY_DIR@"
config.libcxx_src_root = "@LIBCXX_SOURCE_DIR@"
config.libcxx_obj_root = "@LIBCXX_BINARY_DIR@"
config.cxx_library_root = "@LIBCXX_LIBRARY_DIR@"
@@ -8,14 +8,9 @@ config.enable_exceptions = "@LIBCXX_ENABLE_EXCEPTIONS@"
config.enable_rtti = "@LIBCXX_ENABLE_RTTI@"
config.enable_shared = "@LIBCXX_ENABLE_SHARED@"
config.enable_32bit = "@LIBCXX_BUILD_32_BITS@"
-config.enable_global_filesystem_namespace = "@LIBCXX_ENABLE_GLOBAL_FILESYSTEM_NAMESPACE@"
-config.enable_stdin = "@LIBCXX_ENABLE_STDIN@"
-config.enable_stdout = "@LIBCXX_ENABLE_STDOUT@"
-config.enable_threads = "@LIBCXX_ENABLE_THREADS@"
-config.enable_thread_unsafe_c_functions = "@LIBCXX_ENABLE_THREAD_UNSAFE_C_FUNCTIONS@"
-config.enable_monotonic_clock = "@LIBCXX_ENABLE_MONOTONIC_CLOCK@"
config.cxx_abi = "@LIBCXX_CXX_ABI_LIBNAME@"
config.use_sanitizer = "@LLVM_USE_SANITIZER@"
+config.sanitizer_library = "@LIBCXX_SANITIZER_LIBRARY@"
config.abi_library_path = "@LIBCXX_CXX_ABI_LIBRARY_PATH@"
config.configuration_variant = "@LIBCXX_LIT_VARIANT@"
config.target_triple = "@LIBCXX_TARGET_TRIPLE@"
diff --git a/test/std/algorithms/alg.modifying.operations/alg.partitions/stable_partition.pass.cpp b/test/std/algorithms/alg.modifying.operations/alg.partitions/stable_partition.pass.cpp
index 7810dec2fe1b..cf23c7743996 100644
--- a/test/std/algorithms/alg.modifying.operations/alg.partitions/stable_partition.pass.cpp
+++ b/test/std/algorithms/alg.modifying.operations/alg.partitions/stable_partition.pass.cpp
@@ -17,10 +17,9 @@
#include <algorithm>
#include <cassert>
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
#include <memory>
-#endif
+#include "test_macros.h"
#include "test_iterators.h"
struct is_odd
@@ -283,7 +282,7 @@ test()
}
}
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+#if TEST_STD_VER >= 11
struct is_null
{
@@ -298,9 +297,10 @@ test1()
const unsigned size = 5;
std::unique_ptr<int> array[size];
Iter r = std::stable_partition(Iter(array), Iter(array+size), is_null());
+ assert(r == Iter(array+size));
}
-#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+#endif // TEST_STD_VER >= 11
int main()
{
@@ -308,7 +308,7 @@ int main()
test<random_access_iterator<std::pair<int,int>*> >();
test<std::pair<int,int>*>();
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+#if TEST_STD_VER >= 11
test1<bidirectional_iterator<std::unique_ptr<int>*> >();
#endif
}
diff --git a/test/std/algorithms/alg.nonmodifying/mismatch/mismatch.pass.cpp b/test/std/algorithms/alg.nonmodifying/mismatch/mismatch.pass.cpp
index abc89dc56097..eb37ccac5779 100644
--- a/test/std/algorithms/alg.nonmodifying/mismatch/mismatch.pass.cpp
+++ b/test/std/algorithms/alg.nonmodifying/mismatch/mismatch.pass.cpp
@@ -17,18 +17,16 @@
#include <algorithm>
#include <cassert>
+#include "test_macros.h"
#include "test_iterators.h"
-#if _LIBCPP_STD_VER > 11
-#define HAS_FOUR_ITERATOR_VERSION
-#endif
int main()
{
int ia[] = {0, 1, 2, 2, 0, 1, 2, 3};
const unsigned sa = sizeof(ia)/sizeof(ia[0]);
int ib[] = {0, 1, 2, 3, 0, 1, 2, 3};
- const unsigned sb = sizeof(ib)/sizeof(ib[0]);
+ const unsigned sb = sizeof(ib)/sizeof(ib[0]); ((void)sb); // unused in c++11
typedef input_iterator<const int*> II;
typedef random_access_iterator<const int*> RAI;
@@ -39,7 +37,7 @@ int main()
assert(std::mismatch(RAI(ia), RAI(ia + sa), RAI(ib))
== (std::pair<RAI, RAI>(RAI(ia+3), RAI(ib+3))));
-#ifdef HAS_FOUR_ITERATOR_VERSION
+#if TEST_STD_VER > 11 // We have the four iteration version
assert(std::mismatch(II(ia), II(ia + sa), II(ib), II(ib+sb))
== (std::pair<II, II>(II(ia+3), II(ib+3))));
diff --git a/test/std/algorithms/alg.nonmodifying/mismatch/mismatch_pred.pass.cpp b/test/std/algorithms/alg.nonmodifying/mismatch/mismatch_pred.pass.cpp
index 8d85d993cd61..3e1dfd17c3ff 100644
--- a/test/std/algorithms/alg.nonmodifying/mismatch/mismatch_pred.pass.cpp
+++ b/test/std/algorithms/alg.nonmodifying/mismatch/mismatch_pred.pass.cpp
@@ -19,10 +19,11 @@
#include <functional>
#include <cassert>
+#include "test_macros.h"
#include "test_iterators.h"
#include "counting_predicates.hpp"
-#if _LIBCPP_STD_VER > 11
+#if TEST_STD_VER > 11
#define HAS_FOUR_ITERATOR_VERSION
#endif
@@ -31,7 +32,7 @@ int main()
int ia[] = {0, 1, 2, 2, 0, 1, 2, 3};
const unsigned sa = sizeof(ia)/sizeof(ia[0]);
int ib[] = {0, 1, 2, 3, 0, 1, 2, 3};
- const unsigned sb = sizeof(ib)/sizeof(ib[0]);
+ const unsigned sb = sizeof(ib)/sizeof(ib[0]); ((void)sb); // unused in c++11
typedef input_iterator<const int*> II;
typedef random_access_iterator<const int*> RAI;
diff --git a/test/std/algorithms/alg.sorting/alg.set.operations/includes/includes.pass.cpp b/test/std/algorithms/alg.sorting/alg.set.operations/includes/includes.pass.cpp
index 8db8177fb9c8..70abd1809753 100644
--- a/test/std/algorithms/alg.sorting/alg.set.operations/includes/includes.pass.cpp
+++ b/test/std/algorithms/alg.sorting/alg.set.operations/includes/includes.pass.cpp
@@ -29,9 +29,9 @@ test()
int ib[] = {2, 4};
const unsigned sb = sizeof(ib)/sizeof(ib[0]);
int ic[] = {1, 2};
- const unsigned sc = sizeof(ic)/sizeof(ic[0]);
+ const unsigned sc = sizeof(ic)/sizeof(ic[0]); ((void)sc);
int id[] = {3, 3, 3, 3};
- const unsigned sd = sizeof(id)/sizeof(id[0]);
+ const unsigned sd = sizeof(id)/sizeof(id[0]); ((void)sd);
assert(std::includes(Iter1(ia), Iter1(ia), Iter2(ib), Iter2(ib)));
assert(!std::includes(Iter1(ia), Iter1(ia), Iter2(ib), Iter2(ib+1)));
diff --git a/test/std/algorithms/alg.sorting/alg.set.operations/includes/includes_comp.pass.cpp b/test/std/algorithms/alg.sorting/alg.set.operations/includes/includes_comp.pass.cpp
index 7e1aef4749a5..299dc893560f 100644
--- a/test/std/algorithms/alg.sorting/alg.set.operations/includes/includes_comp.pass.cpp
+++ b/test/std/algorithms/alg.sorting/alg.set.operations/includes/includes_comp.pass.cpp
@@ -30,9 +30,9 @@ test()
int ib[] = {2, 4};
const unsigned sb = sizeof(ib)/sizeof(ib[0]);
int ic[] = {1, 2};
- const unsigned sc = sizeof(ic)/sizeof(ic[0]);
+ const unsigned sc = sizeof(ic)/sizeof(ic[0]); ((void)sc);
int id[] = {3, 3, 3, 3};
- const unsigned sd = sizeof(id)/sizeof(id[0]);
+ const unsigned sd = sizeof(id)/sizeof(id[0]); ((void)sd);
assert(std::includes(Iter1(ia), Iter1(ia), Iter2(ib), Iter2(ib), std::less<int>()));
assert(!std::includes(Iter1(ia), Iter1(ia), Iter2(ib), Iter2(ib+1), std::less<int>()));
diff --git a/test/std/atomics/atomics.flag/atomic_flag_clear.pass.cpp b/test/std/atomics/atomics.flag/atomic_flag_clear.pass.cpp
index 8a60f8196dab..3a74e13faf19 100644
--- a/test/std/atomics/atomics.flag/atomic_flag_clear.pass.cpp
+++ b/test/std/atomics/atomics.flag/atomic_flag_clear.pass.cpp
@@ -22,13 +22,13 @@
int main()
{
{
- std::atomic_flag f = ATOMIC_FLAG_INIT;
+ std::atomic_flag f(false);
f.test_and_set();
atomic_flag_clear(&f);
assert(f.test_and_set() == 0);
}
{
- volatile std::atomic_flag f = ATOMIC_FLAG_INIT;
+ volatile std::atomic_flag f(false);
f.test_and_set();
atomic_flag_clear(&f);
assert(f.test_and_set() == 0);
diff --git a/test/std/atomics/atomics.flag/atomic_flag_clear_explicit.pass.cpp b/test/std/atomics/atomics.flag/atomic_flag_clear_explicit.pass.cpp
index 92e57ecc03f8..0467384455cc 100644
--- a/test/std/atomics/atomics.flag/atomic_flag_clear_explicit.pass.cpp
+++ b/test/std/atomics/atomics.flag/atomic_flag_clear_explicit.pass.cpp
@@ -22,37 +22,37 @@
int main()
{
{
- std::atomic_flag f = ATOMIC_FLAG_INIT;
+ std::atomic_flag f(false);
f.test_and_set();
atomic_flag_clear_explicit(&f, std::memory_order_relaxed);
assert(f.test_and_set() == 0);
}
{
- std::atomic_flag f = ATOMIC_FLAG_INIT;
+ std::atomic_flag f(false);
f.test_and_set();
atomic_flag_clear_explicit(&f, std::memory_order_release);
assert(f.test_and_set() == 0);
}
{
- std::atomic_flag f = ATOMIC_FLAG_INIT;
+ std::atomic_flag f(false);
f.test_and_set();
atomic_flag_clear_explicit(&f, std::memory_order_seq_cst);
assert(f.test_and_set() == 0);
}
{
- volatile std::atomic_flag f = ATOMIC_FLAG_INIT;
+ volatile std::atomic_flag f(false);
f.test_and_set();
atomic_flag_clear_explicit(&f, std::memory_order_relaxed);
assert(f.test_and_set() == 0);
}
{
- volatile std::atomic_flag f = ATOMIC_FLAG_INIT;
+ volatile std::atomic_flag f(false);
f.test_and_set();
atomic_flag_clear_explicit(&f, std::memory_order_release);
assert(f.test_and_set() == 0);
}
{
- volatile std::atomic_flag f = ATOMIC_FLAG_INIT;
+ volatile std::atomic_flag f(false);
f.test_and_set();
atomic_flag_clear_explicit(&f, std::memory_order_seq_cst);
assert(f.test_and_set() == 0);
diff --git a/test/std/atomics/atomics.flag/clear.pass.cpp b/test/std/atomics/atomics.flag/clear.pass.cpp
index 7c9362680bba..ea5ae45ae99a 100644
--- a/test/std/atomics/atomics.flag/clear.pass.cpp
+++ b/test/std/atomics/atomics.flag/clear.pass.cpp
@@ -22,49 +22,49 @@
int main()
{
{
- std::atomic_flag f = ATOMIC_FLAG_INIT;
+ std::atomic_flag f(false);
f.test_and_set();
f.clear();
assert(f.test_and_set() == 0);
}
{
- std::atomic_flag f = ATOMIC_FLAG_INIT;
+ std::atomic_flag f(false);
f.test_and_set();
f.clear(std::memory_order_relaxed);
assert(f.test_and_set() == 0);
}
{
- std::atomic_flag f = ATOMIC_FLAG_INIT;
+ std::atomic_flag f(false);
f.test_and_set();
f.clear(std::memory_order_release);
assert(f.test_and_set() == 0);
}
{
- std::atomic_flag f = ATOMIC_FLAG_INIT;
+ std::atomic_flag f(false);
f.test_and_set();
f.clear(std::memory_order_seq_cst);
assert(f.test_and_set() == 0);
}
{
- volatile std::atomic_flag f = ATOMIC_FLAG_INIT;
+ volatile std::atomic_flag f(false);
f.test_and_set();
f.clear();
assert(f.test_and_set() == 0);
}
{
- volatile std::atomic_flag f = ATOMIC_FLAG_INIT;
+ volatile std::atomic_flag f(false);
f.test_and_set();
f.clear(std::memory_order_relaxed);
assert(f.test_and_set() == 0);
}
{
- volatile std::atomic_flag f = ATOMIC_FLAG_INIT;
+ volatile std::atomic_flag f(false);
f.test_and_set();
f.clear(std::memory_order_release);
assert(f.test_and_set() == 0);
}
{
- volatile std::atomic_flag f = ATOMIC_FLAG_INIT;
+ volatile std::atomic_flag f(false);
f.test_and_set();
f.clear(std::memory_order_seq_cst);
assert(f.test_and_set() == 0);
diff --git a/test/std/atomics/atomics.flag/default.pass.cpp b/test/std/atomics/atomics.flag/default.pass.cpp
index 45f5e709245b..11c08f50266a 100644
--- a/test/std/atomics/atomics.flag/default.pass.cpp
+++ b/test/std/atomics/atomics.flag/default.pass.cpp
@@ -22,7 +22,8 @@
int main()
{
std::atomic_flag f;
-
+ f.clear();
+ assert(f.test_and_set() == 0);
{
typedef std::atomic_flag A;
_ALIGNAS_TYPE(A) char storage[sizeof(A)] = {1};
diff --git a/test/std/atomics/atomics.flag/init.pass.cpp b/test/std/atomics/atomics.flag/init.pass.cpp
index c90509d8fbb5..c4a121b094a4 100644
--- a/test/std/atomics/atomics.flag/init.pass.cpp
+++ b/test/std/atomics/atomics.flag/init.pass.cpp
@@ -8,6 +8,7 @@
//===----------------------------------------------------------------------===//
//
// UNSUPPORTED: libcpp-has-no-threads
+// XFAIL: c++98, c++03
// <atomic>
diff --git a/test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/no-variadics.pass.cpp b/test/std/atomics/atomics.flag/init03.pass.cpp
index 7099c45fab81..0910bc5ceccb 100644
--- a/test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/no-variadics.pass.cpp
+++ b/test/std/atomics/atomics.flag/init03.pass.cpp
@@ -6,19 +6,20 @@
// Source Licenses. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
+//
+// UNSUPPORTED: libcpp-has-no-threads
-// <functional>
+// <atomic>
-// class function<R()>
+// struct atomic_flag
-// template<class F> function(F);
+// TESTING EXTENSION atomic_flag(bool)
-#define _LIBCPP_HAS_NO_VARIADICS
-#include <functional>
+#include <atomic>
#include <cassert>
int main()
{
- std::function<void()> f(static_cast<void(*)()>(0));
- assert(!f);
+ std::atomic_flag f(false);
+ assert(f.test_and_set() == 0);
}
diff --git a/test/std/atomics/atomics.types.generic/address.pass.cpp b/test/std/atomics/atomics.types.generic/address.pass.cpp
index 3b9f3ce76cad..eceac25c9d94 100644
--- a/test/std/atomics/atomics.types.generic/address.pass.cpp
+++ b/test/std/atomics/atomics.types.generic/address.pass.cpp
@@ -81,12 +81,13 @@ do_test()
{
typedef typename std::remove_pointer<T>::type X;
A obj(T(0));
+ bool b0 = obj.is_lock_free();
+ ((void)b0); // mark as unused
assert(obj == T(0));
std::atomic_init(&obj, T(1));
assert(obj == T(1));
std::atomic_init(&obj, T(2));
assert(obj == T(2));
- bool b0 = obj.is_lock_free();
obj.store(T(0));
assert(obj == T(0));
obj.store(T(1), std::memory_order_release);
diff --git a/test/std/atomics/atomics.types.generic/bool.pass.cpp b/test/std/atomics/atomics.types.generic/bool.pass.cpp
index dd851e86530c..8eb04ee577cf 100644
--- a/test/std/atomics/atomics.types.generic/bool.pass.cpp
+++ b/test/std/atomics/atomics.types.generic/bool.pass.cpp
@@ -60,7 +60,6 @@
int main()
{
{
- volatile std::atomic<bool> _;
volatile std::atomic<bool> obj(true);
assert(obj == true);
std::atomic_init(&obj, false);
@@ -116,7 +115,6 @@ int main()
assert(obj == true);
}
{
- std::atomic<bool> _;
std::atomic<bool> obj(true);
assert(obj == true);
std::atomic_init(&obj, false);
@@ -172,7 +170,6 @@ int main()
assert(obj == true);
}
{
- std::atomic_bool _;
std::atomic_bool obj(true);
assert(obj == true);
std::atomic_init(&obj, false);
diff --git a/test/std/atomics/atomics.types.generic/integral.pass.cpp b/test/std/atomics/atomics.types.generic/integral.pass.cpp
index f9c758336099..802a37c30a93 100644
--- a/test/std/atomics/atomics.types.generic/integral.pass.cpp
+++ b/test/std/atomics/atomics.types.generic/integral.pass.cpp
@@ -103,6 +103,7 @@ do_test()
std::atomic_init(&obj, T(2));
assert(obj == T(2));
bool b0 = obj.is_lock_free();
+ ((void)b0); // mark as unused
obj.store(T(0));
assert(obj == T(0));
obj.store(T(1), std::memory_order_release);
diff --git a/test/std/atomics/atomics.types.generic/trivially_copyable.fail.cpp b/test/std/atomics/atomics.types.generic/trivially_copyable.fail.cpp
index f2bf4db0de48..d940980e32f0 100644
--- a/test/std/atomics/atomics.types.generic/trivially_copyable.fail.cpp
+++ b/test/std/atomics/atomics.types.generic/trivially_copyable.fail.cpp
@@ -57,12 +57,12 @@ struct NotTriviallyCopyable {
NotTriviallyCopyable ( int i ) : i_(i) {}
NotTriviallyCopyable ( const NotTriviallyCopyable &rhs) : i_(rhs.i_) {}
int i_;
- };
+};
-template <class T>
+template <class T, class >
void test ( T t ) {
std::atomic<T> t0(t);
- }
+}
int main()
{
diff --git a/test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_compare_exchange_strong.pass.cpp b/test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_compare_exchange_strong.pass.cpp
index f1cc993ed33e..7b221dc6eff8 100644
--- a/test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_compare_exchange_strong.pass.cpp
+++ b/test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_compare_exchange_strong.pass.cpp
@@ -24,10 +24,11 @@
#include <type_traits>
#include <cassert>
+#include "atomic_helpers.h"
+
template <class T>
-void
-test()
-{
+struct TestFn {
+ void operator()() const {
{
typedef std::atomic<T> A;
A a;
@@ -52,37 +53,10 @@ test()
assert(a == T(2));
assert(t == T(2));
}
-}
-
-struct A
-{
- int i;
-
- explicit A(int d = 0) noexcept {i=d;}
-
- friend bool operator==(const A& x, const A& y)
- {return x.i == y.i;}
+ }
};
int main()
{
- test<A>();
- test<char>();
- test<signed char>();
- test<unsigned char>();
- test<short>();
- test<unsigned short>();
- test<int>();
- test<unsigned int>();
- test<long>();
- test<unsigned long>();
- test<long long>();
- test<unsigned long long>();
- test<wchar_t>();
-#ifndef _LIBCPP_HAS_NO_UNICODE_CHARS
- test<char16_t>();
- test<char32_t>();
-#endif // _LIBCPP_HAS_NO_UNICODE_CHARS
- test<int*>();
- test<const int*>();
+ TestEachAtomicType<TestFn>()();
}
diff --git a/test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_compare_exchange_strong_explicit.pass.cpp b/test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_compare_exchange_strong_explicit.pass.cpp
index f667ab7f139b..27de5bec4928 100644
--- a/test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_compare_exchange_strong_explicit.pass.cpp
+++ b/test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_compare_exchange_strong_explicit.pass.cpp
@@ -27,10 +27,11 @@
#include <type_traits>
#include <cassert>
+#include "atomic_helpers.h"
+
template <class T>
-void
-test()
-{
+struct TestFn {
+ void operator()() const {
{
typedef std::atomic<T> A;
A a;
@@ -59,37 +60,10 @@ test()
assert(a == T(2));
assert(t == T(2));
}
-}
-
-struct A
-{
- int i;
-
- explicit A(int d = 0) noexcept {i=d;}
-
- friend bool operator==(const A& x, const A& y)
- {return x.i == y.i;}
+ }
};
int main()
{
- test<A>();
- test<char>();
- test<signed char>();
- test<unsigned char>();
- test<short>();
- test<unsigned short>();
- test<int>();
- test<unsigned int>();
- test<long>();
- test<unsigned long>();
- test<long long>();
- test<unsigned long long>();
- test<wchar_t>();
-#ifndef _LIBCPP_HAS_NO_UNICODE_CHARS
- test<char16_t>();
- test<char32_t>();
-#endif // _LIBCPP_HAS_NO_UNICODE_CHARS
- test<int*>();
- test<const int*>();
+ TestEachAtomicType<TestFn>()();
}
diff --git a/test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_compare_exchange_weak.pass.cpp b/test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_compare_exchange_weak.pass.cpp
index 175c445d4560..8c12715647e8 100644
--- a/test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_compare_exchange_weak.pass.cpp
+++ b/test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_compare_exchange_weak.pass.cpp
@@ -25,11 +25,11 @@
#include <cassert>
#include <cmpxchg_loop.h>
+#include "atomic_helpers.h"
template <class T>
-void
-test()
-{
+struct TestFn {
+ void operator()() const {
{
typedef std::atomic<T> A;
A a;
@@ -54,37 +54,10 @@ test()
assert(a == T(2));
assert(t == T(2));
}
-}
-
-struct A
-{
- int i;
-
- explicit A(int d = 0) noexcept {i=d;}
-
- friend bool operator==(const A& x, const A& y)
- {return x.i == y.i;}
+ }
};
int main()
{
- test<A>();
- test<char>();
- test<signed char>();
- test<unsigned char>();
- test<short>();
- test<unsigned short>();
- test<int>();
- test<unsigned int>();
- test<long>();
- test<unsigned long>();
- test<long long>();
- test<unsigned long long>();
- test<wchar_t>();
-#ifndef _LIBCPP_HAS_NO_UNICODE_CHARS
- test<char16_t>();
- test<char32_t>();
-#endif // _LIBCPP_HAS_NO_UNICODE_CHARS
- test<int*>();
- test<const int*>();
+ TestEachAtomicType<TestFn>()();
}
diff --git a/test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_compare_exchange_weak_explicit.pass.cpp b/test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_compare_exchange_weak_explicit.pass.cpp
index 46f80bfbcb7b..90a93f02b978 100644
--- a/test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_compare_exchange_weak_explicit.pass.cpp
+++ b/test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_compare_exchange_weak_explicit.pass.cpp
@@ -29,10 +29,11 @@
#include <cmpxchg_loop.h>
+#include "atomic_helpers.h"
+
template <class T>
-void
-test()
-{
+struct TestFn {
+ void operator()() const {
{
typedef std::atomic<T> A;
A a;
@@ -61,37 +62,10 @@ test()
assert(a == T(2));
assert(t == T(2));
}
-}
-
-struct A
-{
- int i;
-
- explicit A(int d = 0) noexcept {i=d;}
-
- friend bool operator==(const A& x, const A& y)
- {return x.i == y.i;}
+ }
};
int main()
{
- test<A>();
- test<char>();
- test<signed char>();
- test<unsigned char>();
- test<short>();
- test<unsigned short>();
- test<int>();
- test<unsigned int>();
- test<long>();
- test<unsigned long>();
- test<long long>();
- test<unsigned long long>();
- test<wchar_t>();
-#ifndef _LIBCPP_HAS_NO_UNICODE_CHARS
- test<char16_t>();
- test<char32_t>();
-#endif // _LIBCPP_HAS_NO_UNICODE_CHARS
- test<int*>();
- test<const int*>();
+ TestEachAtomicType<TestFn>()();
}
diff --git a/test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_exchange.pass.cpp b/test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_exchange.pass.cpp
index 525e74aa6374..035d974427a4 100644
--- a/test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_exchange.pass.cpp
+++ b/test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_exchange.pass.cpp
@@ -24,10 +24,11 @@
#include <type_traits>
#include <cassert>
+#include "atomic_helpers.h"
+
template <class T>
-void
-test()
-{
+struct TestFn {
+ void operator()() const {
typedef std::atomic<T> A;
A t;
std::atomic_init(&t, T(1));
@@ -37,37 +38,11 @@ test()
std::atomic_init(&vt, T(3));
assert(std::atomic_exchange(&vt, T(4)) == T(3));
assert(vt == T(4));
-}
-
-struct A
-{
- int i;
-
- explicit A(int d = 0) noexcept {i=d;}
-
- friend bool operator==(const A& x, const A& y)
- {return x.i == y.i;}
+ }
};
+
int main()
{
- test<A>();
- test<char>();
- test<signed char>();
- test<unsigned char>();
- test<short>();
- test<unsigned short>();
- test<int>();
- test<unsigned int>();
- test<long>();
- test<unsigned long>();
- test<long long>();
- test<unsigned long long>();
- test<wchar_t>();
-#ifndef _LIBCPP_HAS_NO_UNICODE_CHARS
- test<char16_t>();
- test<char32_t>();
-#endif // _LIBCPP_HAS_NO_UNICODE_CHARS
- test<int*>();
- test<const int*>();
+ TestEachAtomicType<TestFn>()();
}
diff --git a/test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_exchange_explicit.pass.cpp b/test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_exchange_explicit.pass.cpp
index 9fe4ac816448..4d66bb5f3b81 100644
--- a/test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_exchange_explicit.pass.cpp
+++ b/test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_exchange_explicit.pass.cpp
@@ -24,10 +24,11 @@
#include <type_traits>
#include <cassert>
+#include "atomic_helpers.h"
+
template <class T>
-void
-test()
-{
+struct TestFn {
+ void operator()() const {
typedef std::atomic<T> A;
A t;
std::atomic_init(&t, T(1));
@@ -39,37 +40,11 @@ test()
assert(std::atomic_exchange_explicit(&vt, T(4), std::memory_order_seq_cst)
== T(3));
assert(vt == T(4));
-}
-
-struct A
-{
- int i;
-
- explicit A(int d = 0) noexcept {i=d;}
-
- friend bool operator==(const A& x, const A& y)
- {return x.i == y.i;}
+ }
};
+
int main()
{
- test<A>();
- test<char>();
- test<signed char>();
- test<unsigned char>();
- test<short>();
- test<unsigned short>();
- test<int>();
- test<unsigned int>();
- test<long>();
- test<unsigned long>();
- test<long long>();
- test<unsigned long long>();
- test<wchar_t>();
-#ifndef _LIBCPP_HAS_NO_UNICODE_CHARS
- test<char16_t>();
- test<char32_t>();
-#endif // _LIBCPP_HAS_NO_UNICODE_CHARS
- test<int*>();
- test<const int*>();
+ TestEachAtomicType<TestFn>()();
}
diff --git a/test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_fetch_add.pass.cpp b/test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_fetch_add.pass.cpp
index 3408def9058a..48ff601539cf 100644
--- a/test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_fetch_add.pass.cpp
+++ b/test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_fetch_add.pass.cpp
@@ -32,10 +32,11 @@
#include <type_traits>
#include <cassert>
+#include "atomic_helpers.h"
+
template <class T>
-void
-test()
-{
+struct TestFn {
+ void operator()() const {
{
typedef std::atomic<T> A;
A t;
@@ -50,11 +51,11 @@ test()
assert(std::atomic_fetch_add(&t, T(2)) == T(1));
assert(t == T(3));
}
-}
+ }
+};
template <class T>
-void
-testp()
+void testp()
{
{
typedef std::atomic<T> A;
@@ -74,38 +75,9 @@ testp()
}
}
-struct A
-{
- int i;
-
- explicit A(int d = 0) noexcept {i=d;}
- A(const A& a) : i(a.i) {}
- A(const volatile A& a) : i(a.i) {}
-
- void operator=(const volatile A& a) volatile {i = a.i;}
-
- friend bool operator==(const A& x, const A& y)
- {return x.i == y.i;}
-};
-
int main()
{
- test<char>();
- test<signed char>();
- test<unsigned char>();
- test<short>();
- test<unsigned short>();
- test<int>();
- test<unsigned int>();
- test<long>();
- test<unsigned long>();
- test<long long>();
- test<unsigned long long>();
- test<wchar_t>();
-#ifndef _LIBCPP_HAS_NO_UNICODE_CHARS
- test<char16_t>();
- test<char32_t>();
-#endif // _LIBCPP_HAS_NO_UNICODE_CHARS
+ TestEachIntegralType<TestFn>()();
testp<int*>();
testp<const int*>();
}
diff --git a/test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_fetch_add_explicit.pass.cpp b/test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_fetch_add_explicit.pass.cpp
index 9977bd491e7a..2dc90c9aca68 100644
--- a/test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_fetch_add_explicit.pass.cpp
+++ b/test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_fetch_add_explicit.pass.cpp
@@ -32,10 +32,11 @@
#include <type_traits>
#include <cassert>
+#include "atomic_helpers.h"
+
template <class T>
-void
-test()
-{
+struct TestFn {
+ void operator()() const {
{
typedef std::atomic<T> A;
A t;
@@ -52,7 +53,8 @@ test()
std::memory_order_seq_cst) == T(1));
assert(t == T(3));
}
-}
+ }
+};
template <class T>
void
@@ -78,38 +80,9 @@ testp()
}
}
-struct A
-{
- int i;
-
- explicit A(int d = 0) noexcept {i=d;}
- A(const A& a) : i(a.i) {}
- A(const volatile A& a) : i(a.i) {}
-
- void operator=(const volatile A& a) volatile {i = a.i;}
-
- friend bool operator==(const A& x, const A& y)
- {return x.i == y.i;}
-};
-
int main()
{
- test<char>();
- test<signed char>();
- test<unsigned char>();
- test<short>();
- test<unsigned short>();
- test<int>();
- test<unsigned int>();
- test<long>();
- test<unsigned long>();
- test<long long>();
- test<unsigned long long>();
- test<wchar_t>();
-#ifndef _LIBCPP_HAS_NO_UNICODE_CHARS
- test<char16_t>();
- test<char32_t>();
-#endif // _LIBCPP_HAS_NO_UNICODE_CHARS
+ TestEachIntegralType<TestFn>()();
testp<int*>();
testp<const int*>();
}
diff --git a/test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_fetch_and.pass.cpp b/test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_fetch_and.pass.cpp
index 4c7c0432efc9..57355d30411e 100644
--- a/test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_fetch_and.pass.cpp
+++ b/test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_fetch_and.pass.cpp
@@ -23,10 +23,11 @@
#include <type_traits>
#include <cassert>
+#include "atomic_helpers.h"
+
template <class T>
-void
-test()
-{
+struct TestFn {
+ void operator()() const {
{
typedef std::atomic<T> A;
A t;
@@ -41,24 +42,10 @@ test()
assert(std::atomic_fetch_and(&t, T(2)) == T(3));
assert(t == T(2));
}
-}
+ }
+};
int main()
{
- test<char>();
- test<signed char>();
- test<unsigned char>();
- test<short>();
- test<unsigned short>();
- test<int>();
- test<unsigned int>();
- test<long>();
- test<unsigned long>();
- test<long long>();
- test<unsigned long long>();
- test<wchar_t>();
-#ifndef _LIBCPP_HAS_NO_UNICODE_CHARS
- test<char16_t>();
- test<char32_t>();
-#endif // _LIBCPP_HAS_NO_UNICODE_CHARS
+ TestEachIntegralType<TestFn>()();
}
diff --git a/test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_fetch_and_explicit.pass.cpp b/test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_fetch_and_explicit.pass.cpp
index d83bbf264de5..26ff5f65e7db 100644
--- a/test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_fetch_and_explicit.pass.cpp
+++ b/test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_fetch_and_explicit.pass.cpp
@@ -23,10 +23,11 @@
#include <type_traits>
#include <cassert>
+#include "atomic_helpers.h"
+
template <class T>
-void
-test()
-{
+struct TestFn {
+ void operator()() const {
{
typedef std::atomic<T> A;
A t;
@@ -43,24 +44,10 @@ test()
std::memory_order_seq_cst) == T(3));
assert(t == T(2));
}
-}
+ }
+};
int main()
{
- test<char>();
- test<signed char>();
- test<unsigned char>();
- test<short>();
- test<unsigned short>();
- test<int>();
- test<unsigned int>();
- test<long>();
- test<unsigned long>();
- test<long long>();
- test<unsigned long long>();
- test<wchar_t>();
-#ifndef _LIBCPP_HAS_NO_UNICODE_CHARS
- test<char16_t>();
- test<char32_t>();
-#endif // _LIBCPP_HAS_NO_UNICODE_CHARS
+ TestEachIntegralType<TestFn>()();
}
diff --git a/test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_fetch_or.pass.cpp b/test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_fetch_or.pass.cpp
index acf6d439de43..ca44fdc3217d 100644
--- a/test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_fetch_or.pass.cpp
+++ b/test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_fetch_or.pass.cpp
@@ -23,10 +23,11 @@
#include <type_traits>
#include <cassert>
+#include "atomic_helpers.h"
+
template <class T>
-void
-test()
-{
+struct TestFn {
+ void operator()() const {
{
typedef std::atomic<T> A;
A t;
@@ -41,24 +42,10 @@ test()
assert(std::atomic_fetch_or(&t, T(2)) == T(3));
assert(t == T(3));
}
-}
+ }
+};
int main()
{
- test<char>();
- test<signed char>();
- test<unsigned char>();
- test<short>();
- test<unsigned short>();
- test<int>();
- test<unsigned int>();
- test<long>();
- test<unsigned long>();
- test<long long>();
- test<unsigned long long>();
- test<wchar_t>();
-#ifndef _LIBCPP_HAS_NO_UNICODE_CHARS
- test<char16_t>();
- test<char32_t>();
-#endif // _LIBCPP_HAS_NO_UNICODE_CHARS
+ TestEachIntegralType<TestFn>()();
}
diff --git a/test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_fetch_or_explicit.pass.cpp b/test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_fetch_or_explicit.pass.cpp
index 72685e4d9408..72bbde798cb9 100644
--- a/test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_fetch_or_explicit.pass.cpp
+++ b/test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_fetch_or_explicit.pass.cpp
@@ -23,10 +23,11 @@
#include <type_traits>
#include <cassert>
+#include "atomic_helpers.h"
+
template <class T>
-void
-test()
-{
+struct TestFn {
+ void operator()() const {
{
typedef std::atomic<T> A;
A t;
@@ -43,24 +44,10 @@ test()
std::memory_order_seq_cst) == T(3));
assert(t == T(3));
}
-}
+ }
+};
int main()
{
- test<char>();
- test<signed char>();
- test<unsigned char>();
- test<short>();
- test<unsigned short>();
- test<int>();
- test<unsigned int>();
- test<long>();
- test<unsigned long>();
- test<long long>();
- test<unsigned long long>();
- test<wchar_t>();
-#ifndef _LIBCPP_HAS_NO_UNICODE_CHARS
- test<char16_t>();
- test<char32_t>();
-#endif // _LIBCPP_HAS_NO_UNICODE_CHARS
+ TestEachIntegralType<TestFn>()();
}
diff --git a/test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_fetch_sub.pass.cpp b/test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_fetch_sub.pass.cpp
index ed8b541291af..2743040428c5 100644
--- a/test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_fetch_sub.pass.cpp
+++ b/test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_fetch_sub.pass.cpp
@@ -32,10 +32,11 @@
#include <type_traits>
#include <cassert>
+#include "atomic_helpers.h"
+
template <class T>
-void
-test()
-{
+struct TestFn {
+ void operator()() const {
{
typedef std::atomic<T> A;
A t;
@@ -50,11 +51,11 @@ test()
assert(std::atomic_fetch_sub(&t, T(2)) == T(3));
assert(t == T(1));
}
-}
+ }
+};
template <class T>
-void
-testp()
+void testp()
{
{
typedef std::atomic<T> A;
@@ -74,38 +75,9 @@ testp()
}
}
-struct A
-{
- int i;
-
- explicit A(int d = 0) noexcept {i=d;}
- A(const A& a) : i(a.i) {}
- A(const volatile A& a) : i(a.i) {}
-
- void operator=(const volatile A& a) volatile {i = a.i;}
-
- friend bool operator==(const A& x, const A& y)
- {return x.i == y.i;}
-};
-
int main()
{
- test<char>();
- test<signed char>();
- test<unsigned char>();
- test<short>();
- test<unsigned short>();
- test<int>();
- test<unsigned int>();
- test<long>();
- test<unsigned long>();
- test<long long>();
- test<unsigned long long>();
- test<wchar_t>();
-#ifndef _LIBCPP_HAS_NO_UNICODE_CHARS
- test<char16_t>();
- test<char32_t>();
-#endif // _LIBCPP_HAS_NO_UNICODE_CHARS
+ TestEachIntegralType<TestFn>()();
testp<int*>();
testp<const int*>();
}
diff --git a/test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_fetch_sub_explicit.pass.cpp b/test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_fetch_sub_explicit.pass.cpp
index e6c92eada6df..6e94c505fd8c 100644
--- a/test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_fetch_sub_explicit.pass.cpp
+++ b/test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_fetch_sub_explicit.pass.cpp
@@ -33,10 +33,11 @@
#include <type_traits>
#include <cassert>
+#include "atomic_helpers.h"
+
template <class T>
-void
-test()
-{
+struct TestFn {
+ void operator()() const {
{
typedef std::atomic<T> A;
A t;
@@ -53,11 +54,11 @@ test()
std::memory_order_seq_cst) == T(3));
assert(t == T(1));
}
-}
+ }
+};
template <class T>
-void
-testp()
+void testp()
{
{
typedef std::atomic<T> A;
@@ -79,38 +80,9 @@ testp()
}
}
-struct A
-{
- int i;
-
- explicit A(int d = 0) noexcept {i=d;}
- A(const A& a) : i(a.i) {}
- A(const volatile A& a) : i(a.i) {}
-
- void operator=(const volatile A& a) volatile {i = a.i;}
-
- friend bool operator==(const A& x, const A& y)
- {return x.i == y.i;}
-};
-
int main()
{
- test<char>();
- test<signed char>();
- test<unsigned char>();
- test<short>();
- test<unsigned short>();
- test<int>();
- test<unsigned int>();
- test<long>();
- test<unsigned long>();
- test<long long>();
- test<unsigned long long>();
- test<wchar_t>();
-#ifndef _LIBCPP_HAS_NO_UNICODE_CHARS
- test<char16_t>();
- test<char32_t>();
-#endif // _LIBCPP_HAS_NO_UNICODE_CHARS
+ TestEachIntegralType<TestFn>()();
testp<int*>();
testp<const int*>();
}
diff --git a/test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_fetch_xor.pass.cpp b/test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_fetch_xor.pass.cpp
index fc6b97b7db45..42d57dedbd11 100644
--- a/test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_fetch_xor.pass.cpp
+++ b/test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_fetch_xor.pass.cpp
@@ -23,10 +23,11 @@
#include <type_traits>
#include <cassert>
+#include "atomic_helpers.h"
+
template <class T>
-void
-test()
-{
+struct TestFn {
+ void operator()() const {
{
typedef std::atomic<T> A;
A t;
@@ -41,24 +42,10 @@ test()
assert(std::atomic_fetch_xor(&t, T(2)) == T(3));
assert(t == T(1));
}
-}
+ }
+};
int main()
{
- test<char>();
- test<signed char>();
- test<unsigned char>();
- test<short>();
- test<unsigned short>();
- test<int>();
- test<unsigned int>();
- test<long>();
- test<unsigned long>();
- test<long long>();
- test<unsigned long long>();
- test<wchar_t>();
-#ifndef _LIBCPP_HAS_NO_UNICODE_CHARS
- test<char16_t>();
- test<char32_t>();
-#endif // _LIBCPP_HAS_NO_UNICODE_CHARS
+ TestEachIntegralType<TestFn>()();
}
diff --git a/test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_fetch_xor_explicit.pass.cpp b/test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_fetch_xor_explicit.pass.cpp
index 58772aa4d152..8f388fee6325 100644
--- a/test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_fetch_xor_explicit.pass.cpp
+++ b/test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_fetch_xor_explicit.pass.cpp
@@ -23,10 +23,11 @@
#include <type_traits>
#include <cassert>
+#include "atomic_helpers.h"
+
template <class T>
-void
-test()
-{
+struct TestFn {
+ void operator()() const {
{
typedef std::atomic<T> A;
A t;
@@ -43,24 +44,10 @@ test()
std::memory_order_seq_cst) == T(3));
assert(t == T(1));
}
-}
+ }
+};
int main()
{
- test<char>();
- test<signed char>();
- test<unsigned char>();
- test<short>();
- test<unsigned short>();
- test<int>();
- test<unsigned int>();
- test<long>();
- test<unsigned long>();
- test<long long>();
- test<unsigned long long>();
- test<wchar_t>();
-#ifndef _LIBCPP_HAS_NO_UNICODE_CHARS
- test<char16_t>();
- test<char32_t>();
-#endif // _LIBCPP_HAS_NO_UNICODE_CHARS
+ TestEachIntegralType<TestFn>()();
}
diff --git a/test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_helpers.h b/test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_helpers.h
new file mode 100644
index 000000000000..e31420b156c6
--- /dev/null
+++ b/test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_helpers.h
@@ -0,0 +1,51 @@
+#ifndef ATOMIC_HELPERS_H
+#define ATOMIC_HELPERS_H
+
+#include <cassert>
+
+#include "test_macros.h"
+
+struct UserAtomicType
+{
+ int i;
+
+ explicit UserAtomicType(int d = 0) TEST_NOEXCEPT : i(d) {}
+
+ friend bool operator==(const UserAtomicType& x, const UserAtomicType& y)
+ { return x.i == y.i; }
+};
+
+template < template <class TestArg> class TestFunctor >
+struct TestEachIntegralType {
+ void operator()() const {
+ TestFunctor<char>()();
+ TestFunctor<signed char>()();
+ TestFunctor<unsigned char>()();
+ TestFunctor<short>()();
+ TestFunctor<unsigned short>()();
+ TestFunctor<int>()();
+ TestFunctor<unsigned int>()();
+ TestFunctor<long>()();
+ TestFunctor<unsigned long>()();
+ TestFunctor<long long>()();
+ TestFunctor<unsigned long long>()();
+ TestFunctor<wchar_t>();
+#ifndef _LIBCPP_HAS_NO_UNICODE_CHARS
+ TestFunctor<char16_t>()();
+ TestFunctor<char32_t>()();
+#endif
+ }
+};
+
+template < template <class TestArg> class TestFunctor >
+struct TestEachAtomicType {
+ void operator()() const {
+ TestEachIntegralType<TestFunctor>()();
+ TestFunctor<UserAtomicType>()();
+ TestFunctor<int*>()();
+ TestFunctor<const int*>()();
+ }
+};
+
+
+#endif // ATOMIC_HELPER_H
diff --git a/test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_init.pass.cpp b/test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_init.pass.cpp
index 137b6f60f746..884c02dfe7ea 100644
--- a/test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_init.pass.cpp
+++ b/test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_init.pass.cpp
@@ -8,7 +8,7 @@
//===----------------------------------------------------------------------===//
//
// UNSUPPORTED: libcpp-has-no-threads
-// ... assertion fails line 34
+// ... assertion fails line 36
// <atomic>
@@ -24,10 +24,11 @@
#include <type_traits>
#include <cassert>
+#include "atomic_helpers.h"
+
template <class T>
-void
-test()
-{
+struct TestFn {
+ void operator()() const {
typedef std::atomic<T> A;
A t;
std::atomic_init(&t, T(1));
@@ -35,37 +36,10 @@ test()
volatile A vt;
std::atomic_init(&vt, T(2));
assert(vt == T(2));
-}
-
-struct A
-{
- int i;
-
- explicit A(int d = 0) noexcept {i=d;}
-
- friend bool operator==(const A& x, const A& y)
- {return x.i == y.i;}
+ }
};
int main()
{
- test<A>();
- test<char>();
- test<signed char>();
- test<unsigned char>();
- test<short>();
- test<unsigned short>();
- test<int>();
- test<unsigned int>();
- test<long>();
- test<unsigned long>();
- test<long long>();
- test<unsigned long long>();
- test<wchar_t>();
-#ifndef _LIBCPP_HAS_NO_UNICODE_CHARS
- test<char16_t>();
- test<char32_t>();
-#endif // _LIBCPP_HAS_NO_UNICODE_CHARS
- test<int*>();
- test<const int*>();
+ TestEachAtomicType<TestFn>()();
}
diff --git a/test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_is_lock_free.pass.cpp b/test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_is_lock_free.pass.cpp
index 18a1605e2092..5d50016ed32c 100644
--- a/test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_is_lock_free.pass.cpp
+++ b/test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_is_lock_free.pass.cpp
@@ -20,17 +20,21 @@
// atomic_is_lock_free(const atomic<T>* obj);
#include <atomic>
+#include <cassert>
+
+#include "atomic_helpers.h"
template <class T>
-void
-test()
-{
+struct TestFn {
+ void operator()() const {
typedef std::atomic<T> A;
A t;
bool b1 = std::atomic_is_lock_free(static_cast<const A*>(&t));
volatile A vt;
bool b2 = std::atomic_is_lock_free(static_cast<const volatile A*>(&vt));
-}
+ assert(b1 == b2);
+ }
+};
struct A
{
@@ -39,23 +43,6 @@ struct A
int main()
{
- test<A>();
- test<char>();
- test<signed char>();
- test<unsigned char>();
- test<short>();
- test<unsigned short>();
- test<int>();
- test<unsigned int>();
- test<long>();
- test<unsigned long>();
- test<long long>();
- test<unsigned long long>();
- test<wchar_t>();
-#ifndef _LIBCPP_HAS_NO_UNICODE_CHARS
- test<char16_t>();
- test<char32_t>();
-#endif // _LIBCPP_HAS_NO_UNICODE_CHARS
- test<int*>();
- test<const int*>();
+ TestFn<A>()();
+ TestEachAtomicType<TestFn>()();
}
diff --git a/test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_load.pass.cpp b/test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_load.pass.cpp
index 66918c71f1f6..e7b8e64b434f 100644
--- a/test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_load.pass.cpp
+++ b/test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_load.pass.cpp
@@ -8,7 +8,7 @@
//===----------------------------------------------------------------------===//
//
// UNSUPPORTED: libcpp-has-no-threads
-// ... assertion fails line 34
+// ... assertion fails line 35
// <atomic>
@@ -24,10 +24,11 @@
#include <type_traits>
#include <cassert>
+#include "atomic_helpers.h"
+
template <class T>
-void
-test()
-{
+struct TestFn {
+ void operator()() const {
typedef std::atomic<T> A;
A t;
std::atomic_init(&t, T(1));
@@ -35,37 +36,10 @@ test()
volatile A vt;
std::atomic_init(&vt, T(2));
assert(std::atomic_load(&vt) == T(2));
-}
-
-struct A
-{
- int i;
-
- explicit A(int d = 0) noexcept {i=d;}
-
- friend bool operator==(const A& x, const A& y)
- {return x.i == y.i;}
+ }
};
int main()
{
- test<A>();
- test<char>();
- test<signed char>();
- test<unsigned char>();
- test<short>();
- test<unsigned short>();
- test<int>();
- test<unsigned int>();
- test<long>();
- test<unsigned long>();
- test<long long>();
- test<unsigned long long>();
- test<wchar_t>();
-#ifndef _LIBCPP_HAS_NO_UNICODE_CHARS
- test<char16_t>();
- test<char32_t>();
-#endif // _LIBCPP_HAS_NO_UNICODE_CHARS
- test<int*>();
- test<const int*>();
+ TestEachAtomicType<TestFn>()();
}
diff --git a/test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_load_explicit.pass.cpp b/test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_load_explicit.pass.cpp
index 5f402a9f139f..56533fa871e5 100644
--- a/test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_load_explicit.pass.cpp
+++ b/test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_load_explicit.pass.cpp
@@ -24,10 +24,11 @@
#include <type_traits>
#include <cassert>
+#include "atomic_helpers.h"
+
template <class T>
-void
-test()
-{
+struct TestFn {
+ void operator()() const {
typedef std::atomic<T> A;
A t;
std::atomic_init(&t, T(1));
@@ -35,37 +36,10 @@ test()
volatile A vt;
std::atomic_init(&vt, T(2));
assert(std::atomic_load_explicit(&vt, std::memory_order_seq_cst) == T(2));
-}
-
-struct A
-{
- int i;
-
- explicit A(int d = 0) noexcept {i=d;}
-
- friend bool operator==(const A& x, const A& y)
- {return x.i == y.i;}
+ }
};
int main()
{
- test<A>();
- test<char>();
- test<signed char>();
- test<unsigned char>();
- test<short>();
- test<unsigned short>();
- test<int>();
- test<unsigned int>();
- test<long>();
- test<unsigned long>();
- test<long long>();
- test<unsigned long long>();
- test<wchar_t>();
-#ifndef _LIBCPP_HAS_NO_UNICODE_CHARS
- test<char16_t>();
- test<char32_t>();
-#endif // _LIBCPP_HAS_NO_UNICODE_CHARS
- test<int*>();
- test<const int*>();
+ TestEachAtomicType<TestFn>()();
}
diff --git a/test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_store.pass.cpp b/test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_store.pass.cpp
index 2b9582b3c522..e61dae904116 100644
--- a/test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_store.pass.cpp
+++ b/test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_store.pass.cpp
@@ -8,7 +8,6 @@
//===----------------------------------------------------------------------===//
//
// UNSUPPORTED: libcpp-has-no-threads
-// ... assertion fails line 31
// <atomic>
@@ -24,10 +23,11 @@
#include <type_traits>
#include <cassert>
+#include "atomic_helpers.h"
+
template <class T>
-void
-test()
-{
+struct TestFn {
+ void operator()() const {
typedef std::atomic<T> A;
A t;
std::atomic_store(&t, T(1));
@@ -35,37 +35,11 @@ test()
volatile A vt;
std::atomic_store(&vt, T(2));
assert(vt == T(2));
-}
-
-struct A
-{
- int i;
-
- explicit A(int d = 0) noexcept {i=d;}
-
- friend bool operator==(const A& x, const A& y)
- {return x.i == y.i;}
+ }
};
+
int main()
{
- test<A>();
- test<char>();
- test<signed char>();
- test<unsigned char>();
- test<short>();
- test<unsigned short>();
- test<int>();
- test<unsigned int>();
- test<long>();
- test<unsigned long>();
- test<long long>();
- test<unsigned long long>();
- test<wchar_t>();
-#ifndef _LIBCPP_HAS_NO_UNICODE_CHARS
- test<char16_t>();
- test<char32_t>();
-#endif // _LIBCPP_HAS_NO_UNICODE_CHARS
- test<int*>();
- test<const int*>();
+ TestEachAtomicType<TestFn>()();
}
diff --git a/test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_store_explicit.pass.cpp b/test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_store_explicit.pass.cpp
index 8fe0c7d88421..e57cf8b1b323 100644
--- a/test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_store_explicit.pass.cpp
+++ b/test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_store_explicit.pass.cpp
@@ -8,7 +8,6 @@
//===----------------------------------------------------------------------===//
//
// UNSUPPORTED: libcpp-has-no-threads
-// ... assertion fails line 31
// <atomic>
@@ -24,10 +23,11 @@
#include <type_traits>
#include <cassert>
+#include "atomic_helpers.h"
+
template <class T>
-void
-test()
-{
+struct TestFn {
+ void operator()() const {
typedef std::atomic<T> A;
A t;
std::atomic_store_explicit(&t, T(1), std::memory_order_seq_cst);
@@ -35,37 +35,11 @@ test()
volatile A vt;
std::atomic_store_explicit(&vt, T(2), std::memory_order_seq_cst);
assert(vt == T(2));
-}
-
-struct A
-{
- int i;
-
- explicit A(int d = 0) noexcept {i=d;}
-
- friend bool operator==(const A& x, const A& y)
- {return x.i == y.i;}
+ }
};
+
int main()
{
- test<A>();
- test<char>();
- test<signed char>();
- test<unsigned char>();
- test<short>();
- test<unsigned short>();
- test<int>();
- test<unsigned int>();
- test<long>();
- test<unsigned long>();
- test<long long>();
- test<unsigned long long>();
- test<wchar_t>();
-#ifndef _LIBCPP_HAS_NO_UNICODE_CHARS
- test<char16_t>();
- test<char32_t>();
-#endif // _LIBCPP_HAS_NO_UNICODE_CHARS
- test<int*>();
- test<const int*>();
+ TestEachAtomicType<TestFn>()();
}
diff --git a/test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_var_init.pass.cpp b/test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_var_init.pass.cpp
index 5fed691da268..9f25807fbcde 100644
--- a/test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_var_init.pass.cpp
+++ b/test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_var_init.pass.cpp
@@ -8,6 +8,7 @@
//===----------------------------------------------------------------------===//
//
// UNSUPPORTED: libcpp-has-no-threads
+// XFAIL: c++98, c++03
// <atomic>
diff --git a/test/std/atomics/atomics.types.operations/atomics.types.operations.req/ctor.pass.cpp b/test/std/atomics/atomics.types.operations/atomics.types.operations.req/ctor.pass.cpp
index 0eda2338d257..f6944c7255bc 100644
--- a/test/std/atomics/atomics.types.operations/atomics.types.operations.req/ctor.pass.cpp
+++ b/test/std/atomics/atomics.types.operations/atomics.types.operations.req/ctor.pass.cpp
@@ -10,6 +10,10 @@
// UNSUPPORTED: libcpp-has-no-threads
// UNSUPPORTED: c++98, c++03
+// NOTE: atomic<> of a TriviallyCopyable class is wrongly rejected by older
+// clang versions. It was fixed right before the llvm 3.5 release. See PR18097.
+// XFAIL: apple-clang-6.0, clang-3.4, clang-3.3
+
// <atomic>
// constexpr atomic<T>::atomic(T value)
@@ -18,6 +22,8 @@
#include <type_traits>
#include <cassert>
+#include "atomic_helpers.h"
+
struct UserType {
int i;
@@ -30,27 +36,29 @@ struct UserType {
};
template <class Tp>
-void test() {
- typedef std::atomic<Tp> Atomic;
- static_assert(std::is_literal_type<Atomic>::value, "");
- constexpr Tp t(42);
- {
- constexpr Atomic a(t);
- assert(a == t);
- }
- {
- constexpr Atomic a{t};
- assert(a == t);
+struct TestFunc {
+ void operator()() const {
+ typedef std::atomic<Tp> Atomic;
+ static_assert(std::is_literal_type<Atomic>::value, "");
+ constexpr Tp t(42);
+ {
+ constexpr Atomic a(t);
+ assert(a == t);
+ }
+ {
+ constexpr Atomic a{t};
+ assert(a == t);
+ }
+ {
+ constexpr Atomic a = ATOMIC_VAR_INIT(t);
+ assert(a == t);
+ }
}
- {
- constexpr Atomic a = ATOMIC_VAR_INIT(t);
- assert(a == t);
- }
-}
+};
int main()
{
- test<int>();
- test<UserType>();
+ TestFunc<UserType>()();
+ TestEachIntegralType<TestFunc>()();
}
diff --git a/test/std/containers/associative/map/allocator_mismatch.fail.cpp b/test/std/containers/associative/map/allocator_mismatch.fail.cpp
new file mode 100644
index 000000000000..f5da14539c47
--- /dev/null
+++ b/test/std/containers/associative/map/allocator_mismatch.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <map>
+// The container's value type must be the same as the allocator's value type
+
+#include <map>
+
+int main()
+{
+ std::map<int, int, std::less<int>, std::allocator<long> > m;
+}
diff --git a/test/std/containers/associative/map/compare.pass.cpp b/test/std/containers/associative/map/compare.pass.cpp
index aa4d5999ff46..26ac7af7d908 100644
--- a/test/std/containers/associative/map/compare.pass.cpp
+++ b/test/std/containers/associative/map/compare.pass.cpp
@@ -17,16 +17,36 @@
// http://llvm.org/bugs/show_bug.cgi?id=16549
#include <map>
+#include <utility>
+#include <cassert>
struct Key {
template <typename T> Key(const T&) {}
bool operator< (const Key&) const { return false; }
};
-int
-main()
+int main()
{
- std::map<Key, int>::iterator it = std::map<Key, int>().find(Key(0));
- std::pair<std::map<Key, int>::iterator, bool> result =
- std::map<Key, int>().insert(std::make_pair(Key(0), 0));
+ typedef std::map<Key, int> MapT;
+ typedef MapT::iterator Iter;
+ typedef std::pair<Iter, bool> IterBool;
+ {
+ MapT m_empty;
+ MapT m_contains;
+ m_contains[Key(0)] = 42;
+
+ Iter it = m_empty.find(Key(0));
+ assert(it == m_empty.end());
+ it = m_contains.find(Key(0));
+ assert(it != m_contains.end());
+ }
+ {
+ MapT map;
+ IterBool result = map.insert(std::make_pair(Key(0), 42));
+ assert(result.second);
+ assert(result.first->second = 42);
+ IterBool result2 = map.insert(std::make_pair(Key(0), 43));
+ assert(!result2.second);
+ assert(map[Key(0)] == 42);
+ }
}
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 86b1e3d2dfa6..0da28507fce3 100644
--- a/test/std/containers/associative/map/map.access/at.pass.cpp
+++ b/test/std/containers/associative/map/map.access/at.pass.cpp
@@ -7,6 +7,7 @@
//
//===----------------------------------------------------------------------===//
+// XFAIL: libcpp-no-exceptions
// <map>
// class map
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 d14603e1a281..6511dcc85f53 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
@@ -16,14 +16,14 @@
#include <map>
#include <cassert>
+#include "test_macros.h"
#include "MoveOnly.h"
#include "min_allocator.h"
int main()
{
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+#if TEST_STD_VER >= 11
{
- typedef std::pair<MoveOnly, double> V;
std::map<MoveOnly, double> m;
assert(m.size() == 0);
assert(m[1] == 0.0);
@@ -37,10 +37,8 @@ int main()
assert(m[6] == 6.5);
assert(m.size() == 2);
}
-#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
-#if __cplusplus >= 201103L
{
- typedef std::pair<MoveOnly, double> V;
+ typedef std::pair<const MoveOnly, double> V;
std::map<MoveOnly, double, std::less<MoveOnly>, min_allocator<V>> m;
assert(m.size() == 0);
assert(m[1] == 0.0);
diff --git a/test/std/containers/associative/map/map.cons/default_noexcept.pass.cpp b/test/std/containers/associative/map/map.cons/default_noexcept.pass.cpp
index 1f11fc9582ed..dedc89bd435e 100644
--- a/test/std/containers/associative/map/map.cons/default_noexcept.pass.cpp
+++ b/test/std/containers/associative/map/map.cons/default_noexcept.pass.cpp
@@ -33,16 +33,17 @@ struct some_comp
int main()
{
#if __has_feature(cxx_noexcept)
+ typedef std::pair<const MoveOnly, MoveOnly> V;
{
typedef std::map<MoveOnly, MoveOnly> C;
static_assert(std::is_nothrow_default_constructible<C>::value, "");
}
{
- typedef std::map<MoveOnly, MoveOnly, std::less<MoveOnly>, test_allocator<MoveOnly>> C;
+ typedef std::map<MoveOnly, MoveOnly, std::less<MoveOnly>, test_allocator<V>> C;
static_assert(std::is_nothrow_default_constructible<C>::value, "");
}
{
- typedef std::map<MoveOnly, MoveOnly, std::less<MoveOnly>, other_allocator<MoveOnly>> C;
+ typedef std::map<MoveOnly, MoveOnly, std::less<MoveOnly>, other_allocator<V>> C;
static_assert(!std::is_nothrow_default_constructible<C>::value, "");
}
{
diff --git a/test/std/containers/associative/map/map.cons/dtor_noexcept.pass.cpp b/test/std/containers/associative/map/map.cons/dtor_noexcept.pass.cpp
index eed26d3a6136..9baa19b53d05 100644
--- a/test/std/containers/associative/map/map.cons/dtor_noexcept.pass.cpp
+++ b/test/std/containers/associative/map/map.cons/dtor_noexcept.pass.cpp
@@ -31,16 +31,17 @@ struct some_comp
int main()
{
#if __has_feature(cxx_noexcept)
+ typedef std::pair<const MoveOnly, MoveOnly> V;
{
typedef std::map<MoveOnly, MoveOnly> C;
static_assert(std::is_nothrow_destructible<C>::value, "");
}
{
- typedef std::map<MoveOnly, MoveOnly, std::less<MoveOnly>, test_allocator<MoveOnly>> C;
+ typedef std::map<MoveOnly, MoveOnly, std::less<MoveOnly>, test_allocator<V>> C;
static_assert(std::is_nothrow_destructible<C>::value, "");
}
{
- typedef std::map<MoveOnly, MoveOnly, std::less<MoveOnly>, other_allocator<MoveOnly>> C;
+ typedef std::map<MoveOnly, MoveOnly, std::less<MoveOnly>, other_allocator<V>> C;
static_assert(std::is_nothrow_destructible<C>::value, "");
}
{
diff --git a/test/std/containers/associative/map/map.cons/move_assign_noexcept.pass.cpp b/test/std/containers/associative/map/map.cons/move_assign_noexcept.pass.cpp
index f80b1d323178..3b28118b5b1e 100644
--- a/test/std/containers/associative/map/map.cons/move_assign_noexcept.pass.cpp
+++ b/test/std/containers/associative/map/map.cons/move_assign_noexcept.pass.cpp
@@ -33,16 +33,17 @@ struct some_comp
int main()
{
#if __has_feature(cxx_noexcept)
+ typedef std::pair<const MoveOnly, MoveOnly> V;
{
typedef std::map<MoveOnly, MoveOnly> C;
static_assert(std::is_nothrow_move_assignable<C>::value, "");
}
{
- typedef std::map<MoveOnly, MoveOnly, std::less<MoveOnly>, test_allocator<MoveOnly>> C;
+ typedef std::map<MoveOnly, MoveOnly, std::less<MoveOnly>, test_allocator<V>> C;
static_assert(!std::is_nothrow_move_assignable<C>::value, "");
}
{
- typedef std::map<MoveOnly, MoveOnly, std::less<MoveOnly>, other_allocator<MoveOnly>> C;
+ typedef std::map<MoveOnly, MoveOnly, std::less<MoveOnly>, other_allocator<V>> C;
static_assert(std::is_nothrow_move_assignable<C>::value, "");
}
{
diff --git a/test/std/containers/associative/map/map.cons/move_noexcept.pass.cpp b/test/std/containers/associative/map/map.cons/move_noexcept.pass.cpp
index 9347b8329ae3..0f1fd396639e 100644
--- a/test/std/containers/associative/map/map.cons/move_noexcept.pass.cpp
+++ b/test/std/containers/associative/map/map.cons/move_noexcept.pass.cpp
@@ -31,16 +31,17 @@ struct some_comp
int main()
{
#if __has_feature(cxx_noexcept)
+ typedef std::pair<const MoveOnly, MoveOnly> V;
{
typedef std::map<MoveOnly, MoveOnly> C;
static_assert(std::is_nothrow_move_constructible<C>::value, "");
}
{
- typedef std::map<MoveOnly, MoveOnly, std::less<MoveOnly>, test_allocator<MoveOnly>> C;
+ typedef std::map<MoveOnly, MoveOnly, std::less<MoveOnly>, test_allocator<V>> C;
static_assert(std::is_nothrow_move_constructible<C>::value, "");
}
{
- typedef std::map<MoveOnly, MoveOnly, std::less<MoveOnly>, other_allocator<MoveOnly>> C;
+ typedef std::map<MoveOnly, MoveOnly, std::less<MoveOnly>, other_allocator<V>> C;
static_assert(std::is_nothrow_move_constructible<C>::value, "");
}
{
diff --git a/test/std/containers/associative/map/map.special/swap_noexcept.pass.cpp b/test/std/containers/associative/map/map.special/swap_noexcept.pass.cpp
index 4598e9945d4e..f25dff2c86da 100644
--- a/test/std/containers/associative/map/map.special/swap_noexcept.pass.cpp
+++ b/test/std/containers/associative/map/map.special/swap_noexcept.pass.cpp
@@ -94,18 +94,19 @@ struct some_alloc3
int main()
{
#if __has_feature(cxx_noexcept)
+ typedef std::pair<const MoveOnly, MoveOnly> V;
{
typedef std::map<MoveOnly, MoveOnly> C;
C c1, c2;
static_assert(noexcept(swap(c1, c2)), "");
}
{
- typedef std::map<MoveOnly, MoveOnly, std::less<MoveOnly>, test_allocator<MoveOnly>> C;
+ typedef std::map<MoveOnly, MoveOnly, std::less<MoveOnly>, test_allocator<V>> C;
C c1, c2;
static_assert(noexcept(swap(c1, c2)), "");
}
{
- typedef std::map<MoveOnly, MoveOnly, std::less<MoveOnly>, other_allocator<MoveOnly>> C;
+ typedef std::map<MoveOnly, MoveOnly, std::less<MoveOnly>, other_allocator<V>> C;
C c1, c2;
static_assert(noexcept(swap(c1, c2)), "");
}
@@ -117,28 +118,28 @@ int main()
#if TEST_STD_VER >= 14
{ // POCS allocator, throwable swap for comp
- typedef std::map<MoveOnly, MoveOnly, some_comp <MoveOnly>, some_alloc <MoveOnly>> C;
+ typedef std::map<MoveOnly, MoveOnly, some_comp <MoveOnly>, some_alloc <V>> C;
C c1, c2;
static_assert(!noexcept(swap(c1, c2)), "");
}
{ // always equal allocator, throwable swap for comp
- typedef std::map<MoveOnly, MoveOnly, some_comp <MoveOnly>, some_alloc2<MoveOnly>> C;
+ typedef std::map<MoveOnly, MoveOnly, some_comp <MoveOnly>, some_alloc2<V>> C;
C c1, c2;
static_assert(!noexcept(swap(c1, c2)), "");
}
{ // POCS allocator, nothrow swap for comp
- typedef std::map<MoveOnly, MoveOnly, some_comp2<MoveOnly>, some_alloc <MoveOnly>> C;
+ typedef std::map<MoveOnly, MoveOnly, some_comp2<MoveOnly>, some_alloc <V>> C;
C c1, c2;
static_assert( noexcept(swap(c1, c2)), "");
}
{ // always equal allocator, nothrow swap for comp
- typedef std::map<MoveOnly, MoveOnly, some_comp2<MoveOnly>, some_alloc2<MoveOnly>> C;
+ typedef std::map<MoveOnly, MoveOnly, some_comp2<MoveOnly>, some_alloc2<V>> C;
C c1, c2;
static_assert( noexcept(swap(c1, c2)), "");
}
{ // NOT always equal allocator, nothrow swap for comp
- typedef std::map<MoveOnly, MoveOnly, some_comp2<MoveOnly>, some_alloc3<MoveOnly>> C;
+ typedef std::map<MoveOnly, MoveOnly, some_comp2<MoveOnly>, some_alloc3<V>> C;
C c1, c2;
static_assert( noexcept(swap(c1, c2)), "");
}
diff --git a/test/std/containers/associative/multimap/allocator_mismatch.fail.cpp b/test/std/containers/associative/multimap/allocator_mismatch.fail.cpp
new file mode 100644
index 000000000000..18823212f409
--- /dev/null
+++ b/test/std/containers/associative/multimap/allocator_mismatch.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <map>
+// The container's value type must be the same as the allocator's value type
+
+#include <map>
+
+int main()
+{
+ std::multimap<int, int, std::less<int>, std::allocator<long> > m;
+}
diff --git a/test/std/containers/associative/multimap/multimap.cons/default_noexcept.pass.cpp b/test/std/containers/associative/multimap/multimap.cons/default_noexcept.pass.cpp
index d1db40b1fc7a..5f05a0dca28e 100644
--- a/test/std/containers/associative/multimap/multimap.cons/default_noexcept.pass.cpp
+++ b/test/std/containers/associative/multimap/multimap.cons/default_noexcept.pass.cpp
@@ -33,16 +33,17 @@ struct some_comp
int main()
{
#if __has_feature(cxx_noexcept)
+ typedef std::pair<const MoveOnly, MoveOnly> V;
{
typedef std::multimap<MoveOnly, MoveOnly> C;
static_assert(std::is_nothrow_default_constructible<C>::value, "");
}
{
- typedef std::multimap<MoveOnly, MoveOnly, std::less<MoveOnly>, test_allocator<MoveOnly>> C;
+ typedef std::multimap<MoveOnly, MoveOnly, std::less<MoveOnly>, test_allocator<V>> C;
static_assert(std::is_nothrow_default_constructible<C>::value, "");
}
{
- typedef std::multimap<MoveOnly, MoveOnly, std::less<MoveOnly>, other_allocator<MoveOnly>> C;
+ typedef std::multimap<MoveOnly, MoveOnly, std::less<MoveOnly>, other_allocator<V>> C;
static_assert(!std::is_nothrow_default_constructible<C>::value, "");
}
{
diff --git a/test/std/containers/associative/multimap/multimap.cons/dtor_noexcept.pass.cpp b/test/std/containers/associative/multimap/multimap.cons/dtor_noexcept.pass.cpp
index cb55e3fb33ec..dd1701240c63 100644
--- a/test/std/containers/associative/multimap/multimap.cons/dtor_noexcept.pass.cpp
+++ b/test/std/containers/associative/multimap/multimap.cons/dtor_noexcept.pass.cpp
@@ -31,16 +31,17 @@ struct some_comp
int main()
{
#if __has_feature(cxx_noexcept)
+ typedef std::pair<const MoveOnly, MoveOnly> V;
{
typedef std::multimap<MoveOnly, MoveOnly> C;
static_assert(std::is_nothrow_destructible<C>::value, "");
}
{
- typedef std::multimap<MoveOnly, MoveOnly, std::less<MoveOnly>, test_allocator<MoveOnly>> C;
+ typedef std::multimap<MoveOnly, MoveOnly, std::less<MoveOnly>, test_allocator<V>> C;
static_assert(std::is_nothrow_destructible<C>::value, "");
}
{
- typedef std::multimap<MoveOnly, MoveOnly, std::less<MoveOnly>, other_allocator<MoveOnly>> C;
+ typedef std::multimap<MoveOnly, MoveOnly, std::less<MoveOnly>, other_allocator<V>> C;
static_assert(std::is_nothrow_destructible<C>::value, "");
}
{
diff --git a/test/std/containers/associative/multimap/multimap.cons/move_assign_noexcept.pass.cpp b/test/std/containers/associative/multimap/multimap.cons/move_assign_noexcept.pass.cpp
index 8ad9e8b82fd1..635a8dca0357 100644
--- a/test/std/containers/associative/multimap/multimap.cons/move_assign_noexcept.pass.cpp
+++ b/test/std/containers/associative/multimap/multimap.cons/move_assign_noexcept.pass.cpp
@@ -33,16 +33,17 @@ struct some_comp
int main()
{
#if __has_feature(cxx_noexcept)
+ typedef std::pair<const MoveOnly, MoveOnly> V;
{
typedef std::multimap<MoveOnly, MoveOnly> C;
static_assert(std::is_nothrow_move_assignable<C>::value, "");
}
{
- typedef std::multimap<MoveOnly, MoveOnly, std::less<MoveOnly>, test_allocator<MoveOnly>> C;
+ typedef std::multimap<MoveOnly, MoveOnly, std::less<MoveOnly>, test_allocator<V>> C;
static_assert(!std::is_nothrow_move_assignable<C>::value, "");
}
{
- typedef std::multimap<MoveOnly, MoveOnly, std::less<MoveOnly>, other_allocator<MoveOnly>> C;
+ typedef std::multimap<MoveOnly, MoveOnly, std::less<MoveOnly>, other_allocator<V>> C;
static_assert(std::is_nothrow_move_assignable<C>::value, "");
}
{
diff --git a/test/std/containers/associative/multimap/multimap.cons/move_noexcept.pass.cpp b/test/std/containers/associative/multimap/multimap.cons/move_noexcept.pass.cpp
index 66ea8737fb75..0f31f04ff829 100644
--- a/test/std/containers/associative/multimap/multimap.cons/move_noexcept.pass.cpp
+++ b/test/std/containers/associative/multimap/multimap.cons/move_noexcept.pass.cpp
@@ -31,16 +31,17 @@ struct some_comp
int main()
{
#if __has_feature(cxx_noexcept)
+ typedef std::pair<const MoveOnly, MoveOnly> V;
{
typedef std::multimap<MoveOnly, MoveOnly> C;
static_assert(std::is_nothrow_move_constructible<C>::value, "");
}
{
- typedef std::multimap<MoveOnly, MoveOnly, std::less<MoveOnly>, test_allocator<MoveOnly>> C;
+ typedef std::multimap<MoveOnly, MoveOnly, std::less<MoveOnly>, test_allocator<V>> C;
static_assert(std::is_nothrow_move_constructible<C>::value, "");
}
{
- typedef std::multimap<MoveOnly, MoveOnly, std::less<MoveOnly>, other_allocator<MoveOnly>> C;
+ typedef std::multimap<MoveOnly, MoveOnly, std::less<MoveOnly>, other_allocator<V>> C;
static_assert(std::is_nothrow_move_constructible<C>::value, "");
}
{
diff --git a/test/std/containers/associative/multimap/multimap.special/swap_noexcept.pass.cpp b/test/std/containers/associative/multimap/multimap.special/swap_noexcept.pass.cpp
index 1013c62804b8..e70ee1fae565 100644
--- a/test/std/containers/associative/multimap/multimap.special/swap_noexcept.pass.cpp
+++ b/test/std/containers/associative/multimap/multimap.special/swap_noexcept.pass.cpp
@@ -94,18 +94,19 @@ struct some_alloc3
int main()
{
#if __has_feature(cxx_noexcept)
+ typedef std::pair<const MoveOnly, MoveOnly> V;
{
typedef std::multimap<MoveOnly, MoveOnly> C;
C c1, c2;
static_assert(noexcept(swap(c1, c2)), "");
}
{
- typedef std::multimap<MoveOnly, MoveOnly, std::less<MoveOnly>, test_allocator<MoveOnly>> C;
+ typedef std::multimap<MoveOnly, MoveOnly, std::less<MoveOnly>, test_allocator<V>> C;
C c1, c2;
static_assert(noexcept(swap(c1, c2)), "");
}
{
- typedef std::multimap<MoveOnly, MoveOnly, std::less<MoveOnly>, other_allocator<MoveOnly>> C;
+ typedef std::multimap<MoveOnly, MoveOnly, std::less<MoveOnly>, other_allocator<V>> C;
C c1, c2;
static_assert(noexcept(swap(c1, c2)), "");
}
@@ -117,28 +118,28 @@ int main()
#if TEST_STD_VER >= 14
{ // POCS allocator, throwable swap for comp
- typedef std::multimap<MoveOnly, MoveOnly, some_comp <MoveOnly>, some_alloc <MoveOnly>> C;
+ typedef std::multimap<MoveOnly, MoveOnly, some_comp <MoveOnly>, some_alloc <V>> C;
C c1, c2;
static_assert(!noexcept(swap(c1, c2)), "");
}
{ // always equal allocator, throwable swap for comp
- typedef std::multimap<MoveOnly, MoveOnly, some_comp <MoveOnly>, some_alloc2<MoveOnly>> C;
+ typedef std::multimap<MoveOnly, MoveOnly, some_comp <MoveOnly>, some_alloc2<V>> C;
C c1, c2;
static_assert(!noexcept(swap(c1, c2)), "");
}
{ // POCS allocator, nothrow swap for comp
- typedef std::multimap<MoveOnly, MoveOnly, some_comp2<MoveOnly>, some_alloc <MoveOnly>> C;
+ typedef std::multimap<MoveOnly, MoveOnly, some_comp2<MoveOnly>, some_alloc <V>> C;
C c1, c2;
static_assert( noexcept(swap(c1, c2)), "");
}
{ // always equal allocator, nothrow swap for comp
- typedef std::multimap<MoveOnly, MoveOnly, some_comp2<MoveOnly>, some_alloc2<MoveOnly>> C;
+ typedef std::multimap<MoveOnly, MoveOnly, some_comp2<MoveOnly>, some_alloc2<V>> C;
C c1, c2;
static_assert( noexcept(swap(c1, c2)), "");
}
{ // NOT always equal allocator, nothrow swap for comp
- typedef std::map<MoveOnly, MoveOnly, some_comp2<MoveOnly>, some_alloc3<MoveOnly>> C;
+ typedef std::map<MoveOnly, MoveOnly, some_comp2<MoveOnly>, some_alloc3<V>> C;
C c1, c2;
static_assert( noexcept(swap(c1, c2)), "");
}
diff --git a/test/std/containers/associative/multimap/scary.pass.cpp b/test/std/containers/associative/multimap/scary.pass.cpp
index b99d9bc2df91..e6dc5aaca953 100644
--- a/test/std/containers/associative/multimap/scary.pass.cpp
+++ b/test/std/containers/associative/multimap/scary.pass.cpp
@@ -21,4 +21,5 @@ int main()
typedef std::multimap<int, int> M2;
M2::iterator i;
M1::iterator j = i;
+ ((void)j);
}
diff --git a/test/std/containers/associative/multiset/allocator_mismatch.fail.cpp b/test/std/containers/associative/multiset/allocator_mismatch.fail.cpp
new file mode 100644
index 000000000000..b2b30d6fdc1d
--- /dev/null
+++ b/test/std/containers/associative/multiset/allocator_mismatch.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <set>
+// The container's value type must be the same as the allocator's value type
+
+#include <set>
+
+int main()
+{
+ std::multiset<int, std::less<int>, std::allocator<long> > ms;
+}
diff --git a/test/std/containers/associative/multiset/scary.pass.cpp b/test/std/containers/associative/multiset/scary.pass.cpp
index f5ee32714e86..bc4328b5332b 100644
--- a/test/std/containers/associative/multiset/scary.pass.cpp
+++ b/test/std/containers/associative/multiset/scary.pass.cpp
@@ -21,4 +21,5 @@ int main()
typedef std::multiset<int> M2;
M2::iterator i;
M1::iterator j = i;
+ ((void)j);
}
diff --git a/test/std/containers/associative/set/allocator_mismatch.fail.cpp b/test/std/containers/associative/set/allocator_mismatch.fail.cpp
new file mode 100644
index 000000000000..6905d9344864
--- /dev/null
+++ b/test/std/containers/associative/set/allocator_mismatch.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <set>
+// The container's value type must be the same as the allocator's value type
+
+#include <set>
+
+int main()
+{
+ std::set<int, std::less<int>, std::allocator<long> > s;
+}
diff --git a/test/std/containers/sequences/array/array.cons/initializer_list.pass.cpp b/test/std/containers/sequences/array/array.cons/initializer_list.pass.cpp
index b9775eef0673..5e429adb6fc9 100644
--- a/test/std/containers/sequences/array/array.cons/initializer_list.pass.cpp
+++ b/test/std/containers/sequences/array/array.cons/initializer_list.pass.cpp
@@ -14,6 +14,10 @@
#include <array>
#include <cassert>
+// 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"
+
int main()
{
{
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 08e4fd39d377..d7aed70c98ad 100644
--- a/test/std/containers/sequences/array/array.data/data.pass.cpp
+++ b/test/std/containers/sequences/array/array.data/data.pass.cpp
@@ -14,6 +14,10 @@
#include <array>
#include <cassert>
+// 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"
+
int main()
{
{
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 8eb9762dcb89..58840e940899 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
@@ -14,6 +14,10 @@
#include <array>
#include <cassert>
+// 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"
+
int main()
{
{
diff --git a/test/std/containers/sequences/array/array.fill/fill.pass.cpp b/test/std/containers/sequences/array/array.fill/fill.pass.cpp
index 675f49500627..5bc42ceb89f3 100644
--- a/test/std/containers/sequences/array/array.fill/fill.pass.cpp
+++ b/test/std/containers/sequences/array/array.fill/fill.pass.cpp
@@ -14,6 +14,10 @@
#include <array>
#include <cassert>
+// 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"
+
int main()
{
{
diff --git a/test/std/containers/sequences/array/array.size/size.pass.cpp b/test/std/containers/sequences/array/array.size/size.pass.cpp
index fe5a0d5c8db0..a833fdc04715 100644
--- a/test/std/containers/sequences/array/array.size/size.pass.cpp
+++ b/test/std/containers/sequences/array/array.size/size.pass.cpp
@@ -14,6 +14,10 @@
#include <array>
#include <cassert>
+// 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"
+
int main()
{
{
diff --git a/test/std/containers/sequences/array/array.special/swap.pass.cpp b/test/std/containers/sequences/array/array.special/swap.pass.cpp
index 08e437739ee6..c1b0b235ab34 100644
--- a/test/std/containers/sequences/array/array.special/swap.pass.cpp
+++ b/test/std/containers/sequences/array/array.special/swap.pass.cpp
@@ -14,6 +14,10 @@
#include <array>
#include <cassert>
+// 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"
+
int main()
{
{
diff --git a/test/std/containers/sequences/array/array.swap/swap.pass.cpp b/test/std/containers/sequences/array/array.swap/swap.pass.cpp
index c7a4cb8df38c..651798e1e790 100644
--- a/test/std/containers/sequences/array/array.swap/swap.pass.cpp
+++ b/test/std/containers/sequences/array/array.swap/swap.pass.cpp
@@ -14,6 +14,10 @@
#include <array>
#include <cassert>
+// 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"
+
int main()
{
{
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 4f4fbcf93af6..13323dd8e519 100644
--- a/test/std/containers/sequences/array/array.tuple/get.fail.cpp
+++ b/test/std/containers/sequences/array/array.tuple/get.fail.cpp
@@ -11,15 +11,31 @@
// template <size_t I, class T, size_t N> T& get(array<T, N>& a);
+// Prevent -Warray-bounds from issuing a diagnostic when testing with clang verify.
+#if defined(__clang__)
+#pragma clang diagnostic ignored "-Warray-bounds"
+#endif
+
#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"
+
int main()
{
{
typedef double T;
typedef std::array<T, 3> C;
C c = {1, 2, 3.5};
- std::get<3>(c) = 5.5; // Can't get element 3!
+ std::get<3>(c) = 5.5; // expected-note {{requested here}}
+#if TEST_STD_VER >= 11
+ // expected-error@array:* {{static_assert failed "Index out of bounds in std::get<> (std::array)"}}
+#else
+ // expected-error@array:* {{implicit instantiation of undefined template '__static_assert_test<false>'}}
+#endif
}
}
diff --git a/test/std/containers/sequences/array/array.tuple/get.pass.cpp b/test/std/containers/sequences/array/array.tuple/get.pass.cpp
index d9e242cd420b..4f210c4f762e 100644
--- a/test/std/containers/sequences/array/array.tuple/get.pass.cpp
+++ b/test/std/containers/sequences/array/array.tuple/get.pass.cpp
@@ -14,12 +14,19 @@
#include <array>
#include <cassert>
-#if __cplusplus > 201103L
+#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"
+
+
+#if TEST_STD_VER > 11
struct S {
std::array<int, 3> a;
int k;
constexpr S() : a{1,2,3}, k(std::get<2>(a)) {}
- };
+};
constexpr std::array<int, 2> getArr () { return { 3, 4 }; }
#endif
@@ -35,7 +42,7 @@ int main()
assert(c[1] == 5.5);
assert(c[2] == 3.5);
}
-#if _LIBCPP_STD_VER > 11
+#if TEST_STD_VER > 11
{
typedef double T;
typedef std::array<T, 3> C;
diff --git a/test/std/containers/sequences/array/array.tuple/get_const.pass.cpp b/test/std/containers/sequences/array/array.tuple/get_const.pass.cpp
index 1cbdfa4ff393..04606bf6cf73 100644
--- a/test/std/containers/sequences/array/array.tuple/get_const.pass.cpp
+++ b/test/std/containers/sequences/array/array.tuple/get_const.pass.cpp
@@ -14,6 +14,12 @@
#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"
+
int main()
{
{
@@ -24,7 +30,7 @@ int main()
assert(std::get<1>(c) == 2);
assert(std::get<2>(c) == 3.5);
}
-#if _LIBCPP_STD_VER > 11
+#if TEST_STD_VER > 11
{
typedef double T;
typedef std::array<T, 3> C;
diff --git a/test/std/containers/sequences/array/array.tuple/get_const_rv.pass.cpp b/test/std/containers/sequences/array/array.tuple/get_const_rv.pass.cpp
new file mode 100644
index 000000000000..a22c91a4de47
--- /dev/null
+++ b/test/std/containers/sequences/array/array.tuple/get_const_rv.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <array>
+
+// template <size_t I, class T, size_t N> const T&& get(const array<T, N>&& a);
+
+// UNSUPPORTED: c++98, c++03
+
+#include <array>
+#include <memory>
+#include <type_traits>
+#include <utility>
+#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"
+
+int main()
+{
+
+ {
+ typedef std::unique_ptr<double> T;
+ typedef std::array<T, 1> C;
+ const C c = {std::unique_ptr<double>(new double(3.5))};
+ static_assert(std::is_same<const T&&, decltype(std::get<0>(std::move(c)))>::value, "");
+ static_assert(noexcept(std::get<0>(std::move(c))), "");
+ const T&& t = std::get<0>(std::move(c));
+ assert(*t == 3.5);
+ }
+
+#if TEST_STD_VER > 11
+ {
+ typedef double T;
+ typedef std::array<T, 3> C;
+ constexpr const C c = {1, 2, 3.5};
+ static_assert(std::get<0>(std::move(c)) == 1, "");
+ static_assert(std::get<1>(std::move(c)) == 2, "");
+ static_assert(std::get<2>(std::move(c)) == 3.5, "");
+ }
+#endif
+}
diff --git a/test/std/containers/sequences/array/array.tuple/get_rv.pass.cpp b/test/std/containers/sequences/array/array.tuple/get_rv.pass.cpp
index 8eec3ceff514..72ef49b157f6 100644
--- a/test/std/containers/sequences/array/array.tuple/get_rv.pass.cpp
+++ b/test/std/containers/sequences/array/array.tuple/get_rv.pass.cpp
@@ -11,14 +11,20 @@
// template <size_t I, class T, size_t N> T&& get(array<T, N>&& a);
+// UNSUPPORTED: c++98, c++03
+
#include <array>
#include <memory>
#include <utility>
#include <cassert>
+// 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"
+
int main()
{
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+
{
typedef std::unique_ptr<double> T;
typedef std::array<T, 1> C;
@@ -26,5 +32,4 @@ int main()
T t = std::get<0>(std::move(c));
assert(*t == 3.5);
}
-#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
}
diff --git a/test/std/containers/sequences/array/at.pass.cpp b/test/std/containers/sequences/array/at.pass.cpp
index b5cf8a5aaa8f..5cb89dfeeb9a 100644
--- a/test/std/containers/sequences/array/at.pass.cpp
+++ b/test/std/containers/sequences/array/at.pass.cpp
@@ -7,6 +7,7 @@
//
//===----------------------------------------------------------------------===//
+// XFAIL: libcpp-no-exceptions
// <array>
// reference operator[] (size_type)
@@ -17,6 +18,12 @@
#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"
+
int main()
{
{
@@ -27,7 +34,7 @@ int main()
assert(r1 == 1);
r1 = 5.5;
assert(c.front() == 5.5);
-
+
C::reference r2 = c.at(2);
assert(r2 == 3.5);
r2 = 7.5;
@@ -50,7 +57,7 @@ int main()
catch (const std::out_of_range &) {}
}
-#if _LIBCPP_STD_VER > 11
+#if TEST_STD_VER > 11
{
typedef double T;
typedef std::array<T, 3> C;
diff --git a/test/std/containers/sequences/array/begin.pass.cpp b/test/std/containers/sequences/array/begin.pass.cpp
index 9cba0d6fceb0..b12ffc851b84 100644
--- a/test/std/containers/sequences/array/begin.pass.cpp
+++ b/test/std/containers/sequences/array/begin.pass.cpp
@@ -14,6 +14,10 @@
#include <array>
#include <cassert>
+// 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"
+
int main()
{
{
@@ -27,6 +31,4 @@ int main()
*i = 5.5;
assert(c[0] == 5.5);
}
- {
- }
}
diff --git a/test/std/containers/sequences/array/front_back.pass.cpp b/test/std/containers/sequences/array/front_back.pass.cpp
index 45a963b9947d..bccaade986ea 100644
--- a/test/std/containers/sequences/array/front_back.pass.cpp
+++ b/test/std/containers/sequences/array/front_back.pass.cpp
@@ -17,6 +17,12 @@
#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"
+
int main()
{
{
@@ -45,12 +51,12 @@ int main()
assert(r2 == 3.5);
}
-#if _LIBCPP_STD_VER > 11
+#if TEST_STD_VER > 11
{
typedef double T;
typedef std::array<T, 3> C;
constexpr C c = {1, 2, 3.5};
-
+
constexpr T t1 = c.front();
static_assert (t1 == 1, "");
diff --git a/test/std/containers/sequences/array/indexing.pass.cpp b/test/std/containers/sequences/array/indexing.pass.cpp
index e4dda0dc5cfd..5ccb0b487b95 100644
--- a/test/std/containers/sequences/array/indexing.pass.cpp
+++ b/test/std/containers/sequences/array/indexing.pass.cpp
@@ -17,6 +17,12 @@
#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"
+
int main()
{
{
@@ -42,13 +48,13 @@ int main()
C::const_reference r2 = c[2];
assert(r2 == 3.5);
}
-
-#if _LIBCPP_STD_VER > 11
+
+#if TEST_STD_VER > 11
{
typedef double T;
typedef std::array<T, 3> C;
constexpr C c = {1, 2, 3.5};
-
+
constexpr T t1 = c[0];
static_assert (t1 == 1, "");
diff --git a/test/std/containers/sequences/deque/allocator_mismatch.fail.cpp b/test/std/containers/sequences/deque/allocator_mismatch.fail.cpp
new file mode 100644
index 000000000000..9223c1ecddcb
--- /dev/null
+++ b/test/std/containers/sequences/deque/allocator_mismatch.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <deque>
+// The container's value type must be the same as the allocator's value type
+
+#include <deque>
+
+int main()
+{
+ std::deque<int, std::allocator<long> > d;
+}
diff --git a/test/std/containers/sequences/deque/deque.capacity/resize_size.pass.cpp b/test/std/containers/sequences/deque/deque.capacity/resize_size.pass.cpp
index 522f839973db..84f04f9d52da 100644
--- a/test/std/containers/sequences/deque/deque.capacity/resize_size.pass.cpp
+++ b/test/std/containers/sequences/deque/deque.capacity/resize_size.pass.cpp
@@ -14,6 +14,7 @@
#include <deque>
#include <cassert>
+#include "test_macros.h"
#include "min_allocator.h"
template <class C>
@@ -58,7 +59,6 @@ template <class C>
void
testN(int start, int N, int M)
{
- typedef typename C::const_iterator CI;
C c1 = make<C>(N, start);
test(c1, M);
}
@@ -73,7 +73,7 @@ int main()
for (int k = 0; k < N; ++k)
testN<std::deque<int> >(rng[i], rng[j], rng[k]);
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
int rng[] = {0, 1, 2, 3, 1023, 1024, 1025, 2047, 2048, 2049};
const int N = sizeof(rng)/sizeof(rng[0]);
diff --git a/test/std/containers/sequences/deque/deque.capacity/resize_size_value.pass.cpp b/test/std/containers/sequences/deque/deque.capacity/resize_size_value.pass.cpp
index 9eb514ba92f7..2bf2423fb9af 100644
--- a/test/std/containers/sequences/deque/deque.capacity/resize_size_value.pass.cpp
+++ b/test/std/containers/sequences/deque/deque.capacity/resize_size_value.pass.cpp
@@ -14,6 +14,7 @@
#include <deque>
#include <cassert>
+#include "test_macros.h"
#include "min_allocator.h"
template <class C>
@@ -58,7 +59,6 @@ template <class C>
void
testN(int start, int N, int M)
{
- typedef typename C::const_iterator CI;
C c1 = make<C>(N, start);
test(c1, M, -10);
}
@@ -73,7 +73,7 @@ int main()
for (int k = 0; k < N; ++k)
testN<std::deque<int> >(rng[i], rng[j], rng[k]);
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
int rng[] = {0, 1, 2, 3, 1023, 1024, 1025, 2047, 2048, 2049};
const int N = sizeof(rng)/sizeof(rng[0]);
diff --git a/test/std/containers/sequences/deque/deque.capacity/shrink_to_fit.pass.cpp b/test/std/containers/sequences/deque/deque.capacity/shrink_to_fit.pass.cpp
index fb00069f33b6..0cf0387211d3 100644
--- a/test/std/containers/sequences/deque/deque.capacity/shrink_to_fit.pass.cpp
+++ b/test/std/containers/sequences/deque/deque.capacity/shrink_to_fit.pass.cpp
@@ -14,6 +14,7 @@
#include <deque>
#include <cassert>
+#include "test_macros.h"
#include "min_allocator.h"
template <class C>
@@ -51,7 +52,6 @@ template <class C>
void
testN(int start, int N)
{
- typedef typename C::const_iterator CI;
C c1 = make<C>(N, start);
test(c1);
}
@@ -65,7 +65,7 @@ int main()
for (int j = 0; j < N; ++j)
testN<std::deque<int> >(rng[i], rng[j]);
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
int rng[] = {0, 1, 2, 3, 1023, 1024, 1025, 2047, 2048, 2049};
const int N = sizeof(rng)/sizeof(rng[0]);
diff --git a/test/std/containers/sequences/deque/deque.cons/assign_iter_iter.pass.cpp b/test/std/containers/sequences/deque/deque.cons/assign_iter_iter.pass.cpp
index 51a37cc33b7a..6507f58e1194 100644
--- a/test/std/containers/sequences/deque/deque.cons/assign_iter_iter.pass.cpp
+++ b/test/std/containers/sequences/deque/deque.cons/assign_iter_iter.pass.cpp
@@ -15,6 +15,7 @@
#include <deque>
#include <cassert>
+#include "test_macros.h"
#include "test_iterators.h"
#include "min_allocator.h"
@@ -44,7 +45,6 @@ template <class C>
void
test(C& c1, const C& c2)
{
- std::size_t c1_osize = c1.size();
c1.assign(c2.begin(), c2.end());
assert(distance(c1.begin(), c1.end()) == c1.size());
assert(c1 == c2);
@@ -54,8 +54,6 @@ template <class C>
void
testN(int start, int N, int M)
{
- typedef typename C::iterator I;
- typedef typename C::const_iterator CI;
C c1 = make<C>(N, start);
C c2 = make<C>(M);
test(c1, c2);
@@ -67,7 +65,6 @@ testI(C& c1, const C& c2)
{
typedef typename C::const_iterator CI;
typedef input_iterator<CI> ICI;
- std::size_t c1_osize = c1.size();
c1.assign(ICI(c2.begin()), ICI(c2.end()));
assert(distance(c1.begin(), c1.end()) == c1.size());
assert(c1 == c2);
@@ -77,8 +74,6 @@ template <class C>
void
testNI(int start, int N, int M)
{
- typedef typename C::iterator I;
- typedef typename C::const_iterator CI;
C c1 = make<C>(N, start);
C c2 = make<C>(M);
testI(c1, c2);
@@ -95,7 +90,7 @@ int main()
testN<std::deque<int> >(rng[i], rng[j], rng[k]);
testNI<std::deque<int> >(1500, 2000, 1000);
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
int rng[] = {0, 1, 2, 3, 1023, 1024, 1025, 2047, 2048, 2049};
const int N = sizeof(rng)/sizeof(rng[0]);
diff --git a/test/std/containers/sequences/deque/deque.cons/assign_size_value.pass.cpp b/test/std/containers/sequences/deque/deque.cons/assign_size_value.pass.cpp
index 3ab79a095fce..e00e0442d22e 100644
--- a/test/std/containers/sequences/deque/deque.cons/assign_size_value.pass.cpp
+++ b/test/std/containers/sequences/deque/deque.cons/assign_size_value.pass.cpp
@@ -14,6 +14,7 @@
#include <deque>
#include <cassert>
+#include "test_macros.h"
#include "test_iterators.h"
#include "min_allocator.h"
@@ -44,7 +45,6 @@ void
test(C& c1, int size, int v)
{
typedef typename C::const_iterator CI;
- std::size_t c1_osize = c1.size();
c1.assign(size, v);
assert(c1.size() == size);
assert(distance(c1.begin(), c1.end()) == c1.size());
@@ -56,8 +56,6 @@ template <class C>
void
testN(int start, int N, int M)
{
- typedef typename C::iterator I;
- typedef typename C::const_iterator CI;
C c1 = make<C>(N, start);
test(c1, M, -10);
}
@@ -72,7 +70,7 @@ int main()
for (int k = 0; k < N; ++k)
testN<std::deque<int> >(rng[i], rng[j], rng[k]);
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
int rng[] = {0, 1, 2, 3, 1023, 1024, 1025, 2047, 2048, 2049};
const int N = sizeof(rng)/sizeof(rng[0]);
diff --git a/test/std/containers/sequences/deque/deque.modifiers/emplace.pass.cpp b/test/std/containers/sequences/deque/deque.modifiers/emplace.pass.cpp
index 7a0a2512ee2f..713f2159e598 100644
--- a/test/std/containers/sequences/deque/deque.modifiers/emplace.pass.cpp
+++ b/test/std/containers/sequences/deque/deque.modifiers/emplace.pass.cpp
@@ -11,13 +11,14 @@
// template <class... Args> iterator emplace(const_iterator p, Args&&... args);
+// UNSUPPORTED: c++98, c++03
+
#include <deque>
#include <cassert>
#include "../../../Emplaceable.h"
#include "min_allocator.h"
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
template <class C>
C
@@ -45,7 +46,6 @@ template <class C>
void
test(int P, C& c1)
{
- typedef typename C::iterator I;
typedef typename C::const_iterator CI;
std::size_t c1_osize = c1.size();
CI i = c1.emplace(c1.begin() + P, Emplaceable(1, 2.5));
@@ -59,8 +59,6 @@ template <class C>
void
testN(int start, int N)
{
- typedef typename C::iterator I;
- typedef typename C::const_iterator CI;
for (int i = 0; i <= 3; ++i)
{
if (0 <= i && i <= N)
@@ -87,11 +85,9 @@ testN(int start, int N)
}
}
-#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
int main()
{
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
{
int rng[] = {0, 1, 2, 3, 1023, 1024, 1025, 2047, 2048, 2049};
const int N = sizeof(rng)/sizeof(rng[0]);
@@ -99,7 +95,6 @@ int main()
for (int j = 0; j < N; ++j)
testN<std::deque<Emplaceable> >(rng[i], rng[j]);
}
-#if __cplusplus >= 201103L
{
int rng[] = {0, 1, 2, 3, 1023, 1024, 1025, 2047, 2048, 2049};
const int N = sizeof(rng)/sizeof(rng[0]);
@@ -107,6 +102,4 @@ int main()
for (int j = 0; j < N; ++j)
testN<std::deque<Emplaceable, min_allocator<Emplaceable>> >(rng[i], rng[j]);
}
-#endif
-#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
}
diff --git a/test/std/containers/sequences/deque/deque.modifiers/insert_iter_iter.pass.cpp b/test/std/containers/sequences/deque/deque.modifiers/insert_iter_iter.pass.cpp
index ecb95d72a21e..fbe3cb69ccdd 100644
--- a/test/std/containers/sequences/deque/deque.modifiers/insert_iter_iter.pass.cpp
+++ b/test/std/containers/sequences/deque/deque.modifiers/insert_iter_iter.pass.cpp
@@ -17,6 +17,7 @@
#include <deque>
#include <cassert>
+#include "test_macros.h"
#include "test_iterators.h"
#include "MoveOnly.h"
#include "../../../stack_allocator.h"
@@ -49,7 +50,6 @@ void
test(int P, const C& c0, const C& c2)
{
{
- typedef typename C::iterator I;
typedef typename C::const_iterator CI;
typedef input_iterator<CI> BCI;
C c1 = c0;
@@ -67,7 +67,6 @@ test(int P, const C& c0, const C& c2)
assert(*i == j);
}
{
- typedef typename C::iterator I;
typedef typename C::const_iterator CI;
typedef forward_iterator<CI> BCI;
C c1 = c0;
@@ -85,7 +84,6 @@ test(int P, const C& c0, const C& c2)
assert(*i == j);
}
{
- typedef typename C::iterator I;
typedef typename C::const_iterator CI;
typedef bidirectional_iterator<CI> BCI;
C c1 = c0;
@@ -108,8 +106,6 @@ template <class C>
void
testN(int start, int N, int M)
{
- typedef typename C::iterator I;
- typedef typename C::const_iterator CI;
for (int i = 0; i <= 3; ++i)
{
if (0 <= i && i <= N)
@@ -170,7 +166,6 @@ template <class C>
void
testI(int P, C& c1, const C& c2)
{
- typedef typename C::iterator I;
typedef typename C::const_iterator CI;
typedef input_iterator<CI> ICI;
std::size_t c1_osize = c1.size();
@@ -191,8 +186,6 @@ template <class C>
void
testNI(int start, int N, int M)
{
- typedef typename C::iterator I;
- typedef typename C::const_iterator CI;
for (int i = 0; i <= 3; ++i)
{
if (0 <= i && i <= N)
@@ -244,7 +237,7 @@ template <class C>
void
test_move()
{
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+#if TEST_STD_VER >= 11
C c;
typedef typename C::const_iterator CI;
{
@@ -263,7 +256,7 @@ test_move()
j = 0;
for (CI i = c.begin(); i != c.end(); ++i, ++j)
assert(*i == MoveOnly(j));
-#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+#endif
}
int main()
@@ -276,11 +269,11 @@ int main()
for (int k = 0; k < N; ++k)
testN<std::deque<int> >(rng[i], rng[j], rng[k]);
testNI<std::deque<int> >(1500, 2000, 1000);
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+#if TEST_STD_VER >= 11
test_move<std::deque<MoveOnly, stack_allocator<MoveOnly, 2000> > >();
-#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+#endif
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
int rng[] = {0, 1, 2, 3, 1023, 1024, 1025, 2047, 2048, 2049};
const int N = sizeof(rng)/sizeof(rng[0]);
diff --git a/test/std/containers/sequences/deque/deque.modifiers/insert_rvalue.pass.cpp b/test/std/containers/sequences/deque/deque.modifiers/insert_rvalue.pass.cpp
index b7e73f265028..3c7b0fef28b4 100644
--- a/test/std/containers/sequences/deque/deque.modifiers/insert_rvalue.pass.cpp
+++ b/test/std/containers/sequences/deque/deque.modifiers/insert_rvalue.pass.cpp
@@ -11,13 +11,14 @@
// iterator insert (const_iterator p, value_type&& v);
+// UNSUPPORTED: c++98, c++03
+
#include <deque>
#include <cassert>
#include "MoveOnly.h"
#include "min_allocator.h"
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
template <class C>
C
@@ -45,7 +46,6 @@ template <class C>
void
test(int P, C& c1, int x)
{
- typedef typename C::iterator I;
typedef typename C::const_iterator CI;
std::size_t c1_osize = c1.size();
CI i = c1.insert(c1.begin() + P, MoveOnly(x));
@@ -65,8 +65,6 @@ template <class C>
void
testN(int start, int N)
{
- typedef typename C::iterator I;
- typedef typename C::const_iterator CI;
for (int i = 0; i <= 3; ++i)
{
if (0 <= i && i <= N)
@@ -93,11 +91,8 @@ testN(int start, int N)
}
}
-#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
-
int main()
{
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
{
int rng[] = {0, 1, 2, 3, 1023, 1024, 1025, 2047, 2048, 2049};
const int N = sizeof(rng)/sizeof(rng[0]);
@@ -105,7 +100,6 @@ int main()
for (int j = 0; j < N; ++j)
testN<std::deque<MoveOnly> >(rng[i], rng[j]);
}
-#if __cplusplus >= 201103L
{
int rng[] = {0, 1, 2, 3, 1023, 1024, 1025, 2047, 2048, 2049};
const int N = sizeof(rng)/sizeof(rng[0]);
@@ -113,6 +107,4 @@ int main()
for (int j = 0; j < N; ++j)
testN<std::deque<MoveOnly, min_allocator<MoveOnly>> >(rng[i], rng[j]);
}
-#endif
-#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
}
diff --git a/test/std/containers/sequences/deque/deque.modifiers/insert_size_value.pass.cpp b/test/std/containers/sequences/deque/deque.modifiers/insert_size_value.pass.cpp
index 2737dfba7739..0efe3b44c604 100644
--- a/test/std/containers/sequences/deque/deque.modifiers/insert_size_value.pass.cpp
+++ b/test/std/containers/sequences/deque/deque.modifiers/insert_size_value.pass.cpp
@@ -16,6 +16,7 @@
#include <deque>
#include <cassert>
+#include "test_macros.h"
#include "min_allocator.h"
template <class C>
@@ -44,7 +45,6 @@ template <class C>
void
test(int P, C& c1, int size, int x)
{
- typedef typename C::iterator I;
typedef typename C::const_iterator CI;
std::size_t c1_osize = c1.size();
CI i = c1.insert(c1.begin() + P, size, x);
@@ -64,8 +64,6 @@ template <class C>
void
testN(int start, int N, int M)
{
- typedef typename C::iterator I;
- typedef typename C::const_iterator CI;
for (int i = 0; i <= 3; ++i)
{
if (0 <= i && i <= N)
@@ -145,7 +143,7 @@ int main()
testN<std::deque<int> >(rng[i], rng[j], rng[k]);
self_reference_test<std::deque<int> >();
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
int rng[] = {0, 1, 2, 3, 1023, 1024, 1025, 2047, 2048, 2049};
const int N = sizeof(rng)/sizeof(rng[0]);
diff --git a/test/std/containers/sequences/deque/deque.modifiers/insert_value.pass.cpp b/test/std/containers/sequences/deque/deque.modifiers/insert_value.pass.cpp
index fbbaad4f89e5..04c4ca4f7b26 100644
--- a/test/std/containers/sequences/deque/deque.modifiers/insert_value.pass.cpp
+++ b/test/std/containers/sequences/deque/deque.modifiers/insert_value.pass.cpp
@@ -14,6 +14,7 @@
#include <deque>
#include <cassert>
+#include "test_macros.h"
#include "min_allocator.h"
template <class C>
@@ -42,7 +43,6 @@ template <class C>
void
test(int P, C& c1, int x)
{
- typedef typename C::iterator I;
typedef typename C::const_iterator CI;
std::size_t c1_osize = c1.size();
CI i = c1.insert(c1.begin() + P, x);
@@ -62,8 +62,6 @@ template <class C>
void
testN(int start, int N)
{
- typedef typename C::iterator I;
- typedef typename C::const_iterator CI;
for (int i = 0; i <= 3; ++i)
{
if (0 <= i && i <= N)
@@ -126,7 +124,7 @@ int main()
testN<std::deque<int> >(rng[i], rng[j]);
self_reference_test<std::deque<int> >();
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
int rng[] = {0, 1, 2, 3, 1023, 1024, 1025, 2047, 2048, 2049};
const int N = sizeof(rng)/sizeof(rng[0]);
diff --git a/test/std/containers/sequences/deque/deque.modifiers/push_back_exception_safety.pass.cpp b/test/std/containers/sequences/deque/deque.modifiers/push_back_exception_safety.pass.cpp
index 8ad6b53f1b5f..b37e961e442f 100644
--- a/test/std/containers/sequences/deque/deque.modifiers/push_back_exception_safety.pass.cpp
+++ b/test/std/containers/sequences/deque/deque.modifiers/push_back_exception_safety.pass.cpp
@@ -7,6 +7,7 @@
//
//===----------------------------------------------------------------------===//
+// XFAIL: libcpp-no-exceptions
// <deque>
// void push_back(const value_type& x);
diff --git a/test/std/containers/sequences/deque/deque.modifiers/push_front_exception_safety.pass.cpp b/test/std/containers/sequences/deque/deque.modifiers/push_front_exception_safety.pass.cpp
index e01b2a224ffd..b4caa947aed8 100644
--- a/test/std/containers/sequences/deque/deque.modifiers/push_front_exception_safety.pass.cpp
+++ b/test/std/containers/sequences/deque/deque.modifiers/push_front_exception_safety.pass.cpp
@@ -7,6 +7,7 @@
//
//===----------------------------------------------------------------------===//
+// XFAIL: libcpp-no-exceptions
// <deque>
// void push_front(const value_type& x);
diff --git a/test/std/containers/sequences/forwardlist/allocator_mismatch.fail.cpp b/test/std/containers/sequences/forwardlist/allocator_mismatch.fail.cpp
new file mode 100644
index 000000000000..b53075d033bc
--- /dev/null
+++ b/test/std/containers/sequences/forwardlist/allocator_mismatch.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <forward_list>
+// The container's value type must be the same as the allocator's value type
+
+#include <forward_list>
+
+int main()
+{
+ std::forward_list<int, std::allocator<long> > fl;
+}
diff --git a/test/std/containers/sequences/forwardlist/forwardlist.cons/move.pass.cpp b/test/std/containers/sequences/forwardlist/forwardlist.cons/move.pass.cpp
index 8341f7ba0cb2..88ecb7540951 100644
--- a/test/std/containers/sequences/forwardlist/forwardlist.cons/move.pass.cpp
+++ b/test/std/containers/sequences/forwardlist/forwardlist.cons/move.pass.cpp
@@ -24,7 +24,7 @@ int main()
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
{
typedef MoveOnly T;
- typedef test_allocator<int> A;
+ typedef test_allocator<T> A;
typedef std::forward_list<T, A> C;
T t[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
typedef std::move_iterator<T*> I;
@@ -39,7 +39,7 @@ int main()
}
{
typedef MoveOnly T;
- typedef other_allocator<int> A;
+ typedef other_allocator<T> A;
typedef std::forward_list<T, A> C;
T t[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
typedef std::move_iterator<T*> I;
@@ -55,7 +55,7 @@ int main()
#if __cplusplus >= 201103L
{
typedef MoveOnly T;
- typedef min_allocator<int> A;
+ typedef min_allocator<T> A;
typedef std::forward_list<T, A> C;
T t[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
typedef std::move_iterator<T*> I;
diff --git a/test/std/containers/sequences/forwardlist/forwardlist.cons/move_alloc.pass.cpp b/test/std/containers/sequences/forwardlist/forwardlist.cons/move_alloc.pass.cpp
index 6bb575ef80f1..3f0e45af1f0b 100644
--- a/test/std/containers/sequences/forwardlist/forwardlist.cons/move_alloc.pass.cpp
+++ b/test/std/containers/sequences/forwardlist/forwardlist.cons/move_alloc.pass.cpp
@@ -24,7 +24,7 @@ int main()
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
{
typedef MoveOnly T;
- typedef test_allocator<int> A;
+ typedef test_allocator<T> A;
typedef std::forward_list<T, A> C;
T t[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
typedef std::move_iterator<T*> I;
@@ -39,7 +39,7 @@ int main()
}
{
typedef MoveOnly T;
- typedef test_allocator<int> A;
+ typedef test_allocator<T> A;
typedef std::forward_list<T, A> C;
T t[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
typedef std::move_iterator<T*> I;
@@ -55,7 +55,7 @@ int main()
#if __cplusplus >= 201103L
{
typedef MoveOnly T;
- typedef min_allocator<int> A;
+ typedef min_allocator<T> A;
typedef std::forward_list<T, A> C;
T t[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
typedef std::move_iterator<T*> I;
diff --git a/test/std/containers/sequences/forwardlist/forwardlist.modifiers/push_front_exception_safety.pass.cpp b/test/std/containers/sequences/forwardlist/forwardlist.modifiers/push_front_exception_safety.pass.cpp
index 43c62eb00cbf..b501347e7893 100644
--- a/test/std/containers/sequences/forwardlist/forwardlist.modifiers/push_front_exception_safety.pass.cpp
+++ b/test/std/containers/sequences/forwardlist/forwardlist.modifiers/push_front_exception_safety.pass.cpp
@@ -7,6 +7,7 @@
//
//===----------------------------------------------------------------------===//
+// XFAIL: libcpp-no-exceptions
// <forward_list>
// void push_front(const value_type& x);
diff --git a/test/std/containers/sequences/forwardlist/forwardlist.ops/splice_after_one.pass.cpp b/test/std/containers/sequences/forwardlist/forwardlist.ops/splice_after_one.pass.cpp
index 296ffcd6955d..349a3872d754 100644
--- a/test/std/containers/sequences/forwardlist/forwardlist.ops/splice_after_one.pass.cpp
+++ b/test/std/containers/sequences/forwardlist/forwardlist.ops/splice_after_one.pass.cpp
@@ -15,6 +15,7 @@
#include <cassert>
#include <iterator>
+#include "test_macros.h"
#include "min_allocator.h"
typedef int T;
@@ -44,7 +45,6 @@ tests(const C& c, int p, int f)
{
typename C::const_iterator i = c.begin();
int n = 0;
- int d = 1;
if (p == f || p == f+1)
{
for (n = 0; n < size_t1; ++n, ++i)
@@ -106,7 +106,7 @@ int main()
}
}
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
// splicing different containers
typedef std::forward_list<T, min_allocator<T>> C;
diff --git a/test/std/containers/sequences/forwardlist/forwardlist.spec/equal.pass.cpp b/test/std/containers/sequences/forwardlist/forwardlist.spec/equal.pass.cpp
index ca673b583683..9f01fed66465 100644
--- a/test/std/containers/sequences/forwardlist/forwardlist.spec/equal.pass.cpp
+++ b/test/std/containers/sequences/forwardlist/forwardlist.spec/equal.pass.cpp
@@ -22,12 +22,12 @@
#include <algorithm>
#include <cassert>
+#include "test_macros.h"
#include "min_allocator.h"
template <class C>
void test(int N, int M)
{
- typedef typename C::value_type T;
C c1;
for (int i = 0; i < N; ++i)
c1.push_front(i);
@@ -52,7 +52,7 @@ int main()
for (int i = 0; i < 10; ++i)
for (int j = 0; j < 10; ++j)
test<std::forward_list<int> >(i, j);
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
for (int i = 0; i < 10; ++i)
for (int j = 0; j < 10; ++j)
test<std::forward_list<int, min_allocator<int>> >(i, j);
diff --git a/test/std/containers/sequences/forwardlist/forwardlist.spec/relational.pass.cpp b/test/std/containers/sequences/forwardlist/forwardlist.spec/relational.pass.cpp
index 42e245d007b0..e65e064ffdaf 100644
--- a/test/std/containers/sequences/forwardlist/forwardlist.spec/relational.pass.cpp
+++ b/test/std/containers/sequences/forwardlist/forwardlist.spec/relational.pass.cpp
@@ -30,12 +30,12 @@
#include <algorithm>
#include <cassert>
+#include "test_macros.h"
#include "min_allocator.h"
template <class C>
void test(int N, int M)
{
- typedef typename C::value_type T;
C c1;
for (int i = 0; i < N; ++i)
c1.push_front(i);
@@ -57,7 +57,7 @@ int main()
for (int i = 0; i < 10; ++i)
for (int j = 0; j < 10; ++j)
test<std::forward_list<int> >(i, j);
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
for (int i = 0; i < 10; ++i)
for (int j = 0; j < 10; ++j)
test<std::forward_list<int, min_allocator<int>> >(i, j);
diff --git a/test/std/containers/sequences/list/allocator_mismatch.fail.cpp b/test/std/containers/sequences/list/allocator_mismatch.fail.cpp
new file mode 100644
index 000000000000..3490d106a60c
--- /dev/null
+++ b/test/std/containers/sequences/list/allocator_mismatch.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <list>
+// The container's value type must be the same as the allocator's value type
+
+#include <list>
+
+int main()
+{
+ std::list<int, std::allocator<long> > l;
+}
diff --git a/test/std/containers/sequences/list/incomplete_type.pass.cpp b/test/std/containers/sequences/list/incomplete_type.pass.cpp
new file mode 100644
index 000000000000..adfb4d45fc81
--- /dev/null
+++ b/test/std/containers/sequences/list/incomplete_type.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <list>
+
+// Check that std::list and it's iterators can be instantiated with an incomplete
+// type.
+
+#include <list>
+
+struct A {
+ std::list<A> l;
+ std::list<A>::iterator it;
+ std::list<A>::const_iterator cit;
+ std::list<A>::reverse_iterator rit;
+ std::list<A>::const_reverse_iterator crit;
+};
+
+int main() {
+ A a;
+}
diff --git a/test/std/containers/sequences/list/list.modifiers/insert_iter_iter_iter.pass.cpp b/test/std/containers/sequences/list/list.modifiers/insert_iter_iter_iter.pass.cpp
index a7f1917ab856..736b9baae746 100644
--- a/test/std/containers/sequences/list/list.modifiers/insert_iter_iter_iter.pass.cpp
+++ b/test/std/containers/sequences/list/list.modifiers/insert_iter_iter_iter.pass.cpp
@@ -7,6 +7,7 @@
//
//===----------------------------------------------------------------------===//
+// XFAIL: libcpp-no-exceptions
// <list>
// template <InputIterator Iter>
diff --git a/test/std/containers/sequences/list/list.modifiers/insert_iter_size_value.pass.cpp b/test/std/containers/sequences/list/list.modifiers/insert_iter_size_value.pass.cpp
index eeb74b83e509..c0f6ed198751 100644
--- a/test/std/containers/sequences/list/list.modifiers/insert_iter_size_value.pass.cpp
+++ b/test/std/containers/sequences/list/list.modifiers/insert_iter_size_value.pass.cpp
@@ -7,6 +7,7 @@
//
//===----------------------------------------------------------------------===//
+// XFAIL: libcpp-no-exceptions
// <list>
// iterator insert(const_iterator position, size_type n, const value_type& x);
diff --git a/test/std/containers/sequences/list/list.modifiers/insert_iter_value.pass.cpp b/test/std/containers/sequences/list/list.modifiers/insert_iter_value.pass.cpp
index 406e93a376a1..1aacb63e4a70 100644
--- a/test/std/containers/sequences/list/list.modifiers/insert_iter_value.pass.cpp
+++ b/test/std/containers/sequences/list/list.modifiers/insert_iter_value.pass.cpp
@@ -7,6 +7,7 @@
//
//===----------------------------------------------------------------------===//
+// XFAIL: libcpp-no-exceptions
// <list>
// iterator insert(const_iterator position, const value_type& x);
diff --git a/test/std/containers/sequences/list/list.modifiers/push_back_exception_safety.pass.cpp b/test/std/containers/sequences/list/list.modifiers/push_back_exception_safety.pass.cpp
index 9d3c05e26b1c..8d16142defc0 100644
--- a/test/std/containers/sequences/list/list.modifiers/push_back_exception_safety.pass.cpp
+++ b/test/std/containers/sequences/list/list.modifiers/push_back_exception_safety.pass.cpp
@@ -7,6 +7,7 @@
//
//===----------------------------------------------------------------------===//
+// XFAIL: libcpp-no-exceptions
// <list>
// void push_back(const value_type& x);
diff --git a/test/std/containers/sequences/list/list.modifiers/push_front_exception_safety.pass.cpp b/test/std/containers/sequences/list/list.modifiers/push_front_exception_safety.pass.cpp
index 6609005262eb..aafcceecd471 100644
--- a/test/std/containers/sequences/list/list.modifiers/push_front_exception_safety.pass.cpp
+++ b/test/std/containers/sequences/list/list.modifiers/push_front_exception_safety.pass.cpp
@@ -7,6 +7,7 @@
//
//===----------------------------------------------------------------------===//
+// XFAIL: libcpp-no-exceptions
// <list>
// void push_front(const value_type& x);
diff --git a/test/std/containers/sequences/vector.bool/move_assign_noexcept.pass.cpp b/test/std/containers/sequences/vector.bool/move_assign_noexcept.pass.cpp
index b580eb4ae3b0..4dd871c9447e 100644
--- a/test/std/containers/sequences/vector.bool/move_assign_noexcept.pass.cpp
+++ b/test/std/containers/sequences/vector.bool/move_assign_noexcept.pass.cpp
@@ -28,6 +28,32 @@ struct some_alloc
some_alloc(const some_alloc&);
};
+template <class T>
+struct some_alloc2
+{
+ typedef T value_type;
+
+ some_alloc2() {}
+ some_alloc2(const some_alloc2&);
+ void deallocate(void*, unsigned) {}
+
+ typedef std::false_type propagate_on_container_move_assignment;
+ typedef std::true_type is_always_equal;
+};
+
+template <class T>
+struct some_alloc3
+{
+ typedef T value_type;
+
+ some_alloc3() {}
+ some_alloc3(const some_alloc3&);
+ void deallocate(void*, unsigned) {}
+
+ typedef std::false_type propagate_on_container_move_assignment;
+ typedef std::false_type is_always_equal;
+};
+
int main()
{
#if __has_feature(cxx_noexcept)
@@ -45,7 +71,22 @@ int main()
}
{
typedef std::vector<bool, some_alloc<bool>> C;
+#if TEST_STD_VER > 14
+ static_assert( std::is_nothrow_move_assignable<C>::value, "");
+#else
static_assert(!std::is_nothrow_move_assignable<C>::value, "");
+#endif
+ }
+#if TEST_STD_VER > 14
+ { // POCMA false, is_always_equal true
+ typedef std::vector<bool, some_alloc2<bool>> C;
+ static_assert( std::is_nothrow_move_assignable<C>::value, "");
}
+ { // POCMA false, is_always_equal false
+ typedef std::vector<bool, some_alloc3<bool>> C;
+ static_assert(!std::is_nothrow_move_assignable<C>::value, "");
+ }
+#endif
+
#endif
}
diff --git a/test/std/containers/sequences/vector/allocator_mismatch.fail.cpp b/test/std/containers/sequences/vector/allocator_mismatch.fail.cpp
new file mode 100644
index 000000000000..65fdb63ee6a0
--- /dev/null
+++ b/test/std/containers/sequences/vector/allocator_mismatch.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <vector>
+// The container's value type must be the same as the allocator's value type
+
+#include <vector>
+
+int main()
+{
+ std::vector<int, std::allocator<long> > v;
+}
diff --git a/test/std/containers/sequences/vector/vector.cons/move_assign_noexcept.pass.cpp b/test/std/containers/sequences/vector/vector.cons/move_assign_noexcept.pass.cpp
index 1c4a4f7c9282..c09224497966 100644
--- a/test/std/containers/sequences/vector/vector.cons/move_assign_noexcept.pass.cpp
+++ b/test/std/containers/sequences/vector/vector.cons/move_assign_noexcept.pass.cpp
@@ -29,6 +29,33 @@ struct some_alloc
some_alloc(const some_alloc&);
};
+template <class T>
+struct some_alloc2
+{
+ typedef T value_type;
+
+ some_alloc2() {}
+ some_alloc2(const some_alloc2&);
+ void deallocate(void*, unsigned) {}
+
+ typedef std::false_type propagate_on_container_move_assignment;
+ typedef std::true_type is_always_equal;
+};
+
+template <class T>
+struct some_alloc3
+{
+ typedef T value_type;
+
+ some_alloc3() {}
+ some_alloc3(const some_alloc3&);
+ void deallocate(void*, unsigned) {}
+
+ typedef std::false_type propagate_on_container_move_assignment;
+ typedef std::false_type is_always_equal;
+};
+
+
int main()
{
#if __has_feature(cxx_noexcept)
@@ -46,7 +73,24 @@ int main()
}
{
typedef std::vector<MoveOnly, some_alloc<MoveOnly>> C;
+ // In C++17, move assignment for allocators are not allowed to throw
+#if TEST_STD_VER > 14
+ static_assert( std::is_nothrow_move_assignable<C>::value, "");
+#else
+ static_assert(!std::is_nothrow_move_assignable<C>::value, "");
+#endif
+ }
+
+#if TEST_STD_VER > 14
+ { // POCMA false, is_always_equal true
+ typedef std::vector<MoveOnly, some_alloc2<MoveOnly>> C;
+ static_assert( std::is_nothrow_move_assignable<C>::value, "");
+ }
+ { // POCMA false, is_always_equal false
+ typedef std::vector<MoveOnly, some_alloc3<MoveOnly>> C;
static_assert(!std::is_nothrow_move_assignable<C>::value, "");
}
#endif
+
+#endif
}
diff --git a/test/std/containers/sequences/vector/vector.modifiers/push_back_exception_safety.pass.cpp b/test/std/containers/sequences/vector/vector.modifiers/push_back_exception_safety.pass.cpp
index 6615a25a620f..785225357d4b 100644
--- a/test/std/containers/sequences/vector/vector.modifiers/push_back_exception_safety.pass.cpp
+++ b/test/std/containers/sequences/vector/vector.modifiers/push_back_exception_safety.pass.cpp
@@ -7,6 +7,7 @@
//
//===----------------------------------------------------------------------===//
+// XFAIL: libcpp-no-exceptions
// <vector>
// void push_back(const value_type& x);
diff --git a/test/std/containers/unord/unord.map/allocator_mismatch.fail.cpp b/test/std/containers/unord/unord.map/allocator_mismatch.fail.cpp
new file mode 100644
index 000000000000..39fcb11add40
--- /dev/null
+++ b/test/std/containers/unord/unord.map/allocator_mismatch.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <unordered_map>
+// The container's value type must be the same as the allocator's value type
+
+#include <unordered_map>
+
+int main()
+{
+ std::unordered_map<int, int, std::hash<int>, std::less<int>, std::allocator<long> > m;
+}
diff --git a/test/std/containers/unord/unord.map/bucket_count.pass.cpp b/test/std/containers/unord/unord.map/bucket_count.pass.cpp
index d3e80d86379a..bc3733742600 100644
--- a/test/std/containers/unord/unord.map/bucket_count.pass.cpp
+++ b/test/std/containers/unord/unord.map/bucket_count.pass.cpp
@@ -19,20 +19,18 @@
#include <string>
#include <cassert>
+#include "test_macros.h"
#include "min_allocator.h"
int main()
{
{
typedef std::unordered_map<int, std::string> C;
- typedef C::const_iterator I;
- typedef std::pair<int, std::string> P;
const C c;
assert(c.bucket_count() == 0);
}
{
typedef std::unordered_map<int, std::string> C;
- typedef C::const_iterator I;
typedef std::pair<int, std::string> P;
P a[] =
{
@@ -48,19 +46,16 @@ int main()
const C c(std::begin(a), std::end(a));
assert(c.bucket_count() >= 11);
}
-#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;
- typedef C::const_iterator I;
- typedef std::pair<int, std::string> P;
const C c;
assert(c.bucket_count() == 0);
}
{
typedef std::unordered_map<int, std::string, std::hash<int>, std::equal_to<int>,
min_allocator<std::pair<const int, std::string>>> C;
- typedef C::const_iterator I;
typedef std::pair<int, std::string> P;
P a[] =
{
diff --git a/test/std/containers/unord/unord.map/compare.pass.cpp b/test/std/containers/unord/unord.map/compare.pass.cpp
index 8979a3a34ad6..ea6d02f5fcbc 100644
--- a/test/std/containers/unord/unord.map/compare.pass.cpp
+++ b/test/std/containers/unord/unord.map/compare.pass.cpp
@@ -17,6 +17,7 @@
// http://llvm.org/bugs/show_bug.cgi?id=16549
#include <unordered_map>
+#include <cassert>
struct Key {
template <typename T> Key(const T&) {}
@@ -35,8 +36,12 @@ namespace std
int
main()
{
- std::unordered_map<Key, int>::iterator it =
- std::unordered_map<Key, int>().find(Key(0));
- std::pair<std::unordered_map<Key, int>::iterator, bool> result =
- std::unordered_map<Key, int>().insert(std::make_pair(Key(0), 0));
+ typedef std::unordered_map<Key, int> MapT;
+ typedef MapT::iterator Iter;
+ MapT map;
+ Iter it = map.find(Key(0));
+ assert(it == map.end());
+ std::pair<Iter, bool> result = map.insert(std::make_pair(Key(0), 42));
+ assert(result.second);
+ assert(result.first->second == 42);
}
diff --git a/test/std/containers/unord/unord.map/load_factor.pass.cpp b/test/std/containers/unord/unord.map/load_factor.pass.cpp
index 472e41abf6e0..b25c019688a6 100644
--- a/test/std/containers/unord/unord.map/load_factor.pass.cpp
+++ b/test/std/containers/unord/unord.map/load_factor.pass.cpp
@@ -20,6 +20,7 @@
#include <cassert>
#include <cfloat>
+#include "test_macros.h"
#include "min_allocator.h"
int main()
@@ -43,11 +44,10 @@ int main()
}
{
typedef std::unordered_map<int, std::string> C;
- typedef std::pair<int, std::string> P;
const C c;
assert(c.load_factor() == 0);
}
-#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;
@@ -69,7 +69,6 @@ int main()
{
typedef std::unordered_map<int, std::string, std::hash<int>, std::equal_to<int>,
min_allocator<std::pair<const int, std::string>>> C;
- typedef std::pair<int, std::string> P;
const C c;
assert(c.load_factor() == 0);
}
diff --git a/test/std/containers/unord/unord.map/max_bucket_count.pass.cpp b/test/std/containers/unord/unord.map/max_bucket_count.pass.cpp
index b4ca8eb04472..08f014da2f49 100644
--- a/test/std/containers/unord/unord.map/max_bucket_count.pass.cpp
+++ b/test/std/containers/unord/unord.map/max_bucket_count.pass.cpp
@@ -19,23 +19,20 @@
#include <string>
#include <cassert>
+#include "test_macros.h"
#include "min_allocator.h"
int main()
{
{
typedef std::unordered_map<int, std::string> C;
- typedef C::const_iterator I;
- typedef std::pair<int, std::string> P;
const C c;
assert(c.max_bucket_count() > 0);
}
-#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;
- typedef C::const_iterator I;
- typedef std::pair<int, std::string> P;
const C c;
assert(c.max_bucket_count() > 0);
}
diff --git a/test/std/containers/unord/unord.map/max_load_factor.pass.cpp b/test/std/containers/unord/unord.map/max_load_factor.pass.cpp
index 69fd70d2a172..b19a6e6cfa08 100644
--- a/test/std/containers/unord/unord.map/max_load_factor.pass.cpp
+++ b/test/std/containers/unord/unord.map/max_load_factor.pass.cpp
@@ -16,44 +16,37 @@
// float max_load_factor() const;
// void max_load_factor(float mlf);
-#ifdef _LIBCPP_DEBUG
-#define _LIBCPP_ASSERT(x, m) ((x) ? (void)0 : std::exit(0))
-#endif
-
#include <unordered_map>
#include <string>
#include <cassert>
+#include "test_macros.h"
#include "min_allocator.h"
int main()
{
{
typedef std::unordered_map<int, std::string> C;
- typedef std::pair<int, std::string> P;
const C c;
assert(c.max_load_factor() == 1);
}
{
typedef std::unordered_map<int, std::string> C;
- typedef std::pair<int, std::string> P;
C c;
assert(c.max_load_factor() == 1);
c.max_load_factor(2.5);
assert(c.max_load_factor() == 2.5);
}
-#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;
- typedef std::pair<int, std::string> P;
const C c;
assert(c.max_load_factor() == 1);
}
{
typedef std::unordered_map<int, std::string, std::hash<int>, std::equal_to<int>,
min_allocator<std::pair<const int, std::string>>> C;
- typedef std::pair<int, std::string> P;
C c;
assert(c.max_load_factor() == 1);
c.max_load_factor(2.5);
diff --git a/test/std/containers/unord/unord.map/rehash.pass.cpp b/test/std/containers/unord/unord.map/rehash.pass.cpp
index 84ece2355511..e1a882c69ffd 100644
--- a/test/std/containers/unord/unord.map/rehash.pass.cpp
+++ b/test/std/containers/unord/unord.map/rehash.pass.cpp
@@ -22,6 +22,12 @@
#include "min_allocator.h"
template <class C>
+void rehash_postcondition(const C& c, size_t n)
+{
+ assert(c.bucket_count() >= c.size() / c.max_load_factor() && c.bucket_count() >= n);
+}
+
+template <class C>
void test(const C& c)
{
assert(c.size() == 4);
@@ -49,13 +55,16 @@ int main()
test(c);
assert(c.bucket_count() >= 5);
c.rehash(3);
+ rehash_postcondition(c, 3);
assert(c.bucket_count() == 5);
test(c);
c.max_load_factor(2);
c.rehash(3);
+ rehash_postcondition(c, 3);
assert(c.bucket_count() == 3);
test(c);
c.rehash(31);
+ rehash_postcondition(c, 31);
assert(c.bucket_count() == 31);
test(c);
}
@@ -77,13 +86,16 @@ int main()
test(c);
assert(c.bucket_count() >= 5);
c.rehash(3);
+ rehash_postcondition(c, 3);
assert(c.bucket_count() == 5);
test(c);
c.max_load_factor(2);
c.rehash(3);
+ rehash_postcondition(c, 3);
assert(c.bucket_count() == 3);
test(c);
c.rehash(31);
+ rehash_postcondition(c, 31);
assert(c.bucket_count() == 31);
test(c);
}
diff --git a/test/std/containers/unord/unord.map/reserve.pass.cpp b/test/std/containers/unord/unord.map/reserve.pass.cpp
index 48667cdc7f92..bef237f960af 100644
--- a/test/std/containers/unord/unord.map/reserve.pass.cpp
+++ b/test/std/containers/unord/unord.map/reserve.pass.cpp
@@ -31,6 +31,21 @@ void test(const C& c)
assert(c.at(4) == "four");
}
+void reserve_invariant(size_t n) // LWG #2156
+{
+ for (size_t i = 0; i < n; ++i)
+ {
+ std::unordered_map<size_t, size_t> c;
+ c.reserve(n);
+ size_t buckets = c.bucket_count();
+ for (size_t j = 0; j < i; ++j)
+ {
+ c[i] = i;
+ assert(buckets == c.bucket_count());
+ }
+ }
+}
+
int main()
{
{
@@ -88,4 +103,5 @@ int main()
test(c);
}
#endif
+ reserve_invariant(20);
}
diff --git a/test/std/containers/unord/unord.map/swap_member.pass.cpp b/test/std/containers/unord/unord.map/swap_member.pass.cpp
index 8ab1eb6211b8..0f98b66aa401 100644
--- a/test/std/containers/unord/unord.map/swap_member.pass.cpp
+++ b/test/std/containers/unord/unord.map/swap_member.pass.cpp
@@ -21,6 +21,7 @@
#include "../../test_compare.h"
#include "../../test_hash.h"
+#include "test_macros.h"
#include "test_allocator.h"
#include "min_allocator.h"
@@ -31,7 +32,6 @@ int main()
typedef test_compare<std::equal_to<int> > Compare;
typedef test_allocator<std::pair<const int, std::string> > Alloc;
typedef std::unordered_map<int, std::string, Hash, Compare, Alloc> C;
- typedef std::pair<int, std::string> P;
C c1(0, Hash(1), Compare(1), Alloc(1));
C c2(0, Hash(2), Compare(2), Alloc(2));
c2.max_load_factor(2);
@@ -212,7 +212,6 @@ int main()
typedef test_compare<std::equal_to<int> > Compare;
typedef other_allocator<std::pair<const int, std::string> > Alloc;
typedef std::unordered_map<int, std::string, Hash, Compare, Alloc> C;
- typedef std::pair<int, std::string> P;
C c1(0, Hash(1), Compare(1), Alloc(1));
C c2(0, Hash(2), Compare(2), Alloc(2));
c2.max_load_factor(2);
@@ -387,13 +386,12 @@ int main()
assert(std::distance(c2.cbegin(), c2.cend()) == c2.size());
assert(c2.max_load_factor() == 1);
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef test_hash<std::hash<int> > Hash;
typedef test_compare<std::equal_to<int> > Compare;
typedef min_allocator<std::pair<const int, std::string> > Alloc;
typedef std::unordered_map<int, std::string, Hash, Compare, Alloc> C;
- typedef std::pair<int, std::string> P;
C c1(0, Hash(1), Compare(1), Alloc());
C c2(0, Hash(2), Compare(2), Alloc());
c2.max_load_factor(2);
diff --git a/test/std/containers/unord/unord.map/unord.map.cnstr/move.pass.cpp b/test/std/containers/unord/unord.map/unord.map.cnstr/move.pass.cpp
index 18e6683011c8..1420204c5f76 100644
--- a/test/std/containers/unord/unord.map/unord.map.cnstr/move.pass.cpp
+++ b/test/std/containers/unord/unord.map/unord.map.cnstr/move.pass.cpp
@@ -15,6 +15,8 @@
// unordered_map(unordered_map&& u);
+// UNSUPPORTED: c++98, c++03
+
#include <unordered_map>
#include <string>
#include <cassert>
@@ -27,23 +29,12 @@
int main()
{
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
{
typedef std::unordered_map<int, std::string,
test_hash<std::hash<int> >,
test_compare<std::equal_to<int> >,
test_allocator<std::pair<const int, std::string> >
> C;
- typedef std::pair<int, std::string> P;
- P a[] =
- {
- P(1, "one"),
- P(2, "two"),
- P(3, "three"),
- P(4, "four"),
- P(1, "four"),
- P(2, "four"),
- };
C c0(7,
test_hash<std::hash<int> >(8),
test_compare<std::equal_to<int> >(9),
@@ -105,23 +96,12 @@ int main()
assert(c0.empty());
}
-#if __cplusplus >= 201103L
{
typedef std::unordered_map<int, std::string,
test_hash<std::hash<int> >,
test_compare<std::equal_to<int> >,
min_allocator<std::pair<const int, std::string> >
> C;
- typedef std::pair<int, std::string> P;
- P a[] =
- {
- P(1, "one"),
- P(2, "two"),
- P(3, "three"),
- P(4, "four"),
- P(1, "four"),
- P(2, "four"),
- };
C c0(7,
test_hash<std::hash<int> >(8),
test_compare<std::equal_to<int> >(9),
@@ -183,7 +163,6 @@ int main()
assert(c0.empty());
}
-#endif
#if _LIBCPP_DEBUG >= 1
{
std::unordered_map<int, int> s1 = {{1, 1}, {2, 2}, {3, 3}};
@@ -195,5 +174,4 @@ int main()
assert(s2.size() == 2);
}
#endif
-#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
}
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 5fd9f9d6114a..04ce91f69917 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
@@ -7,6 +7,7 @@
//
//===----------------------------------------------------------------------===//
+// XFAIL: libcpp-no-exceptions
// <unordered_map>
// template <class Key, class T, class Hash = hash<Key>, class Pred = equal_to<Key>,
diff --git a/test/std/containers/unord/unord.map/unorder.map.modifiers/clear.pass.cpp b/test/std/containers/unord/unord.map/unord.map.modifiers/clear.pass.cpp
index 9f320e949479..9f320e949479 100644
--- a/test/std/containers/unord/unord.map/unorder.map.modifiers/clear.pass.cpp
+++ b/test/std/containers/unord/unord.map/unord.map.modifiers/clear.pass.cpp
diff --git a/test/std/containers/unord/unord.map/unorder.map.modifiers/emplace.pass.cpp b/test/std/containers/unord/unord.map/unord.map.modifiers/emplace.pass.cpp
index 5de74d2e6c92..5de74d2e6c92 100644
--- a/test/std/containers/unord/unord.map/unorder.map.modifiers/emplace.pass.cpp
+++ b/test/std/containers/unord/unord.map/unord.map.modifiers/emplace.pass.cpp
diff --git a/test/std/containers/unord/unord.map/unorder.map.modifiers/emplace_hint.pass.cpp b/test/std/containers/unord/unord.map/unord.map.modifiers/emplace_hint.pass.cpp
index 21a4689658ae..21a4689658ae 100644
--- a/test/std/containers/unord/unord.map/unorder.map.modifiers/emplace_hint.pass.cpp
+++ b/test/std/containers/unord/unord.map/unord.map.modifiers/emplace_hint.pass.cpp
diff --git a/test/std/containers/unord/unord.map/unorder.map.modifiers/erase_const_iter.pass.cpp b/test/std/containers/unord/unord.map/unord.map.modifiers/erase_const_iter.pass.cpp
index dbb812974d46..803ecb5adfcb 100644
--- a/test/std/containers/unord/unord.map/unorder.map.modifiers/erase_const_iter.pass.cpp
+++ b/test/std/containers/unord/unord.map/unord.map.modifiers/erase_const_iter.pass.cpp
@@ -19,6 +19,7 @@
#include <string>
#include <cassert>
+#include "test_macros.h"
#include "min_allocator.h"
struct TemplateConstructor
@@ -46,13 +47,13 @@ int main()
};
C c(a, a + sizeof(a)/sizeof(a[0]));
C::const_iterator i = c.find(2);
- C::iterator j = c.erase(i);
+ c.erase(i);
assert(c.size() == 3);
assert(c.at(1) == "one");
assert(c.at(3) == "three");
assert(c.at(4) == "four");
}
-#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;
@@ -68,14 +69,14 @@ int main()
};
C c(a, a + sizeof(a)/sizeof(a[0]));
C::const_iterator i = c.find(2);
- C::iterator j = c.erase(i);
+ c.erase(i);
assert(c.size() == 3);
assert(c.at(1) == "one");
assert(c.at(3) == "three");
assert(c.at(4) == "four");
}
#endif
-#if __cplusplus >= 201402L
+#if TEST_STD_VER >= 14
{
// This is LWG #2059
typedef TemplateConstructor T;
diff --git a/test/std/containers/unord/unord.map/unorder.map.modifiers/erase_iter_db1.pass.cpp b/test/std/containers/unord/unord.map/unord.map.modifiers/erase_iter_db1.pass.cpp
index 60b093553f18..60b093553f18 100644
--- a/test/std/containers/unord/unord.map/unorder.map.modifiers/erase_iter_db1.pass.cpp
+++ b/test/std/containers/unord/unord.map/unord.map.modifiers/erase_iter_db1.pass.cpp
diff --git a/test/std/containers/unord/unord.map/unorder.map.modifiers/erase_iter_db2.pass.cpp b/test/std/containers/unord/unord.map/unord.map.modifiers/erase_iter_db2.pass.cpp
index 05046f5dedc1..05046f5dedc1 100644
--- a/test/std/containers/unord/unord.map/unorder.map.modifiers/erase_iter_db2.pass.cpp
+++ b/test/std/containers/unord/unord.map/unord.map.modifiers/erase_iter_db2.pass.cpp
diff --git a/test/std/containers/unord/unord.map/unorder.map.modifiers/erase_iter_iter_db1.pass.cpp b/test/std/containers/unord/unord.map/unord.map.modifiers/erase_iter_iter_db1.pass.cpp
index 81a8d3de1576..81a8d3de1576 100644
--- a/test/std/containers/unord/unord.map/unorder.map.modifiers/erase_iter_iter_db1.pass.cpp
+++ b/test/std/containers/unord/unord.map/unord.map.modifiers/erase_iter_iter_db1.pass.cpp
diff --git a/test/std/containers/unord/unord.map/unorder.map.modifiers/erase_iter_iter_db2.pass.cpp b/test/std/containers/unord/unord.map/unord.map.modifiers/erase_iter_iter_db2.pass.cpp
index 4b103a0ad75c..4b103a0ad75c 100644
--- a/test/std/containers/unord/unord.map/unorder.map.modifiers/erase_iter_iter_db2.pass.cpp
+++ b/test/std/containers/unord/unord.map/unord.map.modifiers/erase_iter_iter_db2.pass.cpp
diff --git a/test/std/containers/unord/unord.map/unorder.map.modifiers/erase_iter_iter_db3.pass.cpp b/test/std/containers/unord/unord.map/unord.map.modifiers/erase_iter_iter_db3.pass.cpp
index 6ef1e07add1e..6ef1e07add1e 100644
--- a/test/std/containers/unord/unord.map/unorder.map.modifiers/erase_iter_iter_db3.pass.cpp
+++ b/test/std/containers/unord/unord.map/unord.map.modifiers/erase_iter_iter_db3.pass.cpp
diff --git a/test/std/containers/unord/unord.map/unorder.map.modifiers/erase_iter_iter_db4.pass.cpp b/test/std/containers/unord/unord.map/unord.map.modifiers/erase_iter_iter_db4.pass.cpp
index 1185ddf8fd4a..1185ddf8fd4a 100644
--- a/test/std/containers/unord/unord.map/unorder.map.modifiers/erase_iter_iter_db4.pass.cpp
+++ b/test/std/containers/unord/unord.map/unord.map.modifiers/erase_iter_iter_db4.pass.cpp
diff --git a/test/std/containers/unord/unord.map/unorder.map.modifiers/erase_key.pass.cpp b/test/std/containers/unord/unord.map/unord.map.modifiers/erase_key.pass.cpp
index 0e8ef8b895a7..cdd19eb3459d 100644
--- a/test/std/containers/unord/unord.map/unorder.map.modifiers/erase_key.pass.cpp
+++ b/test/std/containers/unord/unord.map/unord.map.modifiers/erase_key.pass.cpp
@@ -19,15 +19,16 @@
#include <string>
#include <cassert>
+#include "test_macros.h"
#include "min_allocator.h"
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
template <typename Unordered>
bool only_deletions ( const Unordered &whole, const Unordered &part ) {
typename Unordered::const_iterator w = whole.begin();
typename Unordered::const_iterator p = part.begin();
-
- while ( w != whole.end () && p != part.end()) {
+
+ while ( w != whole.end () && p != part.end()) {
if ( *w == *p )
p++;
w++;
@@ -96,7 +97,7 @@ int main()
assert(c.erase(3) == 0);
assert(c.size() == 0);
}
-#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;
@@ -161,7 +162,7 @@ int main()
m[i] = i;
m2[i] = i;
}
-
+
C::iterator i = m2.begin();
int ctr = 0;
while (i != m2.end()) {
diff --git a/test/std/containers/unord/unord.map/unorder.map.modifiers/erase_range.pass.cpp b/test/std/containers/unord/unord.map/unord.map.modifiers/erase_range.pass.cpp
index f0664c3c3ffc..f0664c3c3ffc 100644
--- a/test/std/containers/unord/unord.map/unorder.map.modifiers/erase_range.pass.cpp
+++ b/test/std/containers/unord/unord.map/unord.map.modifiers/erase_range.pass.cpp
diff --git a/test/std/containers/unord/unord.map/unorder.map.modifiers/insert_const_lvalue.pass.cpp b/test/std/containers/unord/unord.map/unord.map.modifiers/insert_const_lvalue.pass.cpp
index a16f097b4c01..a16f097b4c01 100644
--- a/test/std/containers/unord/unord.map/unorder.map.modifiers/insert_const_lvalue.pass.cpp
+++ b/test/std/containers/unord/unord.map/unord.map.modifiers/insert_const_lvalue.pass.cpp
diff --git a/test/std/containers/unord/unord.map/unorder.map.modifiers/insert_hint_const_lvalue.pass.cpp b/test/std/containers/unord/unord.map/unord.map.modifiers/insert_hint_const_lvalue.pass.cpp
index 981b8fb18a0a..981b8fb18a0a 100644
--- a/test/std/containers/unord/unord.map/unorder.map.modifiers/insert_hint_const_lvalue.pass.cpp
+++ b/test/std/containers/unord/unord.map/unord.map.modifiers/insert_hint_const_lvalue.pass.cpp
diff --git a/test/std/containers/unord/unord.map/unorder.map.modifiers/insert_hint_rvalue.pass.cpp b/test/std/containers/unord/unord.map/unord.map.modifiers/insert_hint_rvalue.pass.cpp
index 1618c1019e1c..1618c1019e1c 100644
--- a/test/std/containers/unord/unord.map/unorder.map.modifiers/insert_hint_rvalue.pass.cpp
+++ b/test/std/containers/unord/unord.map/unord.map.modifiers/insert_hint_rvalue.pass.cpp
diff --git a/test/std/containers/unord/unord.map/unorder.map.modifiers/insert_init.pass.cpp b/test/std/containers/unord/unord.map/unord.map.modifiers/insert_init.pass.cpp
index 81e8a468d83f..81e8a468d83f 100644
--- a/test/std/containers/unord/unord.map/unorder.map.modifiers/insert_init.pass.cpp
+++ b/test/std/containers/unord/unord.map/unord.map.modifiers/insert_init.pass.cpp
diff --git a/test/std/containers/unord/unord.map/unorder.map.modifiers/insert_or_assign.pass.cpp b/test/std/containers/unord/unord.map/unord.map.modifiers/insert_or_assign.pass.cpp
index 89929c856ec9..a4d8abc7d317 100644
--- a/test/std/containers/unord/unord.map/unorder.map.modifiers/insert_or_assign.pass.cpp
+++ b/test/std/containers/unord/unord.map/unord.map.modifiers/insert_or_assign.pass.cpp
@@ -7,7 +7,7 @@
//
//===----------------------------------------------------------------------===//
//
-// UNSUPPORTED: c++03, c++11, c++14
+// UNSUPPORTED: c++98, c++03, c++11, c++14
// <unordered_map>
@@ -22,12 +22,10 @@
// template <class M>
// iterator insert_or_assign(const_iterator hint, key_type&& k, M&& obj); // C++17
-#include <__config>
#include <unordered_map>
#include <cassert>
#include <tuple>
-#include <iostream>
class Moveable
{
@@ -53,7 +51,7 @@ public:
bool operator<(const Moveable& x) const
{return int_ < x.int_ || (int_ == x.int_ && double_ < x.double_);}
size_t hash () const { return std::hash<int>()(int_) + std::hash<double>()(double_); }
-
+
int get() const {return int_;}
bool moved() const {return int_ == -1;}
};
@@ -66,8 +64,6 @@ namespace std {
int main()
{
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
-#ifndef _LIBCPP_HAS_NO_VARIADICS
{ // pair<iterator, bool> insert_or_assign(const key_type& k, M&& obj);
typedef std::unordered_map<int, Moveable> M;
@@ -193,6 +189,4 @@ int main()
assert(r->second.get() == 5); // value
}
-#endif // _LIBCPP_HAS_NO_VARIADICS
-#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
} \ No newline at end of file
diff --git a/test/std/containers/unord/unord.map/unorder.map.modifiers/insert_range.pass.cpp b/test/std/containers/unord/unord.map/unord.map.modifiers/insert_range.pass.cpp
index fc44e7828ffa..fc44e7828ffa 100644
--- a/test/std/containers/unord/unord.map/unorder.map.modifiers/insert_range.pass.cpp
+++ b/test/std/containers/unord/unord.map/unord.map.modifiers/insert_range.pass.cpp
diff --git a/test/std/containers/unord/unord.map/unorder.map.modifiers/insert_rvalue.pass.cpp b/test/std/containers/unord/unord.map/unord.map.modifiers/insert_rvalue.pass.cpp
index f53dc6c7e97a..f53dc6c7e97a 100644
--- a/test/std/containers/unord/unord.map/unorder.map.modifiers/insert_rvalue.pass.cpp
+++ b/test/std/containers/unord/unord.map/unord.map.modifiers/insert_rvalue.pass.cpp
diff --git a/test/std/containers/unord/unord.map/unorder.map.modifiers/try.emplace.pass.cpp b/test/std/containers/unord/unord.map/unord.map.modifiers/try.emplace.pass.cpp
index e6964ce947b5..eabcf2e85db2 100644
--- a/test/std/containers/unord/unord.map/unorder.map.modifiers/try.emplace.pass.cpp
+++ b/test/std/containers/unord/unord.map/unord.map.modifiers/try.emplace.pass.cpp
@@ -7,7 +7,7 @@
//
//===----------------------------------------------------------------------===//
//
-// UNSUPPORTED: c++03, c++11, c++14
+// UNSUPPORTED: c++98, c++03, c++11, c++14
// <unordered_map>
@@ -64,8 +64,6 @@ namespace std {
int main()
{
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
-#ifndef _LIBCPP_HAS_NO_VARIADICS
{ // pair<iterator, bool> try_emplace(const key_type& k, Args&&... args);
typedef std::unordered_map<int, Moveable> M;
@@ -110,7 +108,7 @@ int main()
assert(r.first->second.get() == -1); // value
}
- { // pair<iterator, bool> try_emplace(key_type&& k, Args&&... args);
+ { // pair<iterator, bool> try_emplace(key_type&& k, Args&&... args);
typedef std::unordered_map<Moveable, Moveable> M;
typedef std::pair<M::iterator, bool> R;
M m;
@@ -146,7 +144,7 @@ int main()
m.try_emplace ( i, Moveable(i, (double) i));
assert(m.size() == 10);
M::const_iterator it = m.find(2);
-
+
Moveable mv1(3, 3.0);
for (int i=0; i < 20; i += 2)
{
@@ -189,7 +187,4 @@ int main()
assert(r->first.get() == 3); // key
assert(r->second.get() == 4); // value
}
-
-#endif // _LIBCPP_HAS_NO_VARIADICS
-#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
}
diff --git a/test/std/containers/unord/unord.map/unord.map.swap/swap_non_member.pass.cpp b/test/std/containers/unord/unord.map/unord.map.swap/swap_non_member.pass.cpp
index 7e04b8db117c..f3d51f6da275 100644
--- a/test/std/containers/unord/unord.map/unord.map.swap/swap_non_member.pass.cpp
+++ b/test/std/containers/unord/unord.map/unord.map.swap/swap_non_member.pass.cpp
@@ -21,6 +21,7 @@
#include "../../../test_compare.h"
#include "../../../test_hash.h"
+#include "test_macros.h"
#include "test_allocator.h"
#include "min_allocator.h"
@@ -31,7 +32,6 @@ int main()
typedef test_compare<std::equal_to<int> > Compare;
typedef test_allocator<std::pair<const int, std::string> > Alloc;
typedef std::unordered_map<int, std::string, Hash, Compare, Alloc> C;
- typedef std::pair<int, std::string> P;
C c1(0, Hash(1), Compare(1), Alloc(1));
C c2(0, Hash(2), Compare(2), Alloc(2));
c2.max_load_factor(2);
@@ -212,7 +212,6 @@ int main()
typedef test_compare<std::equal_to<int> > Compare;
typedef other_allocator<std::pair<const int, std::string> > Alloc;
typedef std::unordered_map<int, std::string, Hash, Compare, Alloc> C;
- typedef std::pair<int, std::string> P;
C c1(0, Hash(1), Compare(1), Alloc(1));
C c2(0, Hash(2), Compare(2), Alloc(2));
c2.max_load_factor(2);
@@ -387,13 +386,12 @@ int main()
assert(std::distance(c2.cbegin(), c2.cend()) == c2.size());
assert(c2.max_load_factor() == 1);
}
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
{
typedef test_hash<std::hash<int> > Hash;
typedef test_compare<std::equal_to<int> > Compare;
typedef min_allocator<std::pair<const int, std::string> > Alloc;
typedef std::unordered_map<int, std::string, Hash, Compare, Alloc> C;
- typedef std::pair<int, std::string> P;
C c1(0, Hash(1), Compare(1), Alloc());
C c2(0, Hash(2), Compare(2), Alloc());
c2.max_load_factor(2);
diff --git a/test/std/containers/unord/unord.multimap/allocator_mismatch.fail.cpp b/test/std/containers/unord/unord.multimap/allocator_mismatch.fail.cpp
new file mode 100644
index 000000000000..3c740950d04e
--- /dev/null
+++ b/test/std/containers/unord/unord.multimap/allocator_mismatch.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <unordered_map>
+// The container's value type must be the same as the allocator's value type
+
+#include <unordered_map>
+
+int main()
+{
+ std::unordered_multimap<int, int, std::hash<int>, std::less<int>, std::allocator<long> > m;
+}
diff --git a/test/std/containers/unord/unord.multimap/rehash.pass.cpp b/test/std/containers/unord/unord.multimap/rehash.pass.cpp
index 1d99208596c1..d36dc42e262d 100644
--- a/test/std/containers/unord/unord.multimap/rehash.pass.cpp
+++ b/test/std/containers/unord/unord.multimap/rehash.pass.cpp
@@ -23,6 +23,12 @@
#include "min_allocator.h"
template <class C>
+void rehash_postcondition(const C& c, size_t n)
+{
+ assert(c.bucket_count() >= c.size() / c.max_load_factor() && c.bucket_count() >= n);
+}
+
+template <class C>
void test(const C& c)
{
assert(c.size() == 6);
@@ -77,13 +83,16 @@ int main()
test(c);
assert(c.bucket_count() >= 7);
c.rehash(3);
+ rehash_postcondition(c, 3);
assert(c.bucket_count() == 7);
test(c);
c.max_load_factor(2);
c.rehash(3);
+ rehash_postcondition(c, 3);
assert(c.bucket_count() == 3);
test(c);
c.rehash(31);
+ rehash_postcondition(c, 31);
assert(c.bucket_count() == 31);
test(c);
}
@@ -105,13 +114,16 @@ int main()
test(c);
assert(c.bucket_count() >= 7);
c.rehash(3);
+ rehash_postcondition(c, 3);
assert(c.bucket_count() == 7);
test(c);
c.max_load_factor(2);
c.rehash(3);
+ rehash_postcondition(c, 3);
assert(c.bucket_count() == 3);
test(c);
c.rehash(31);
+ rehash_postcondition(c, 31);
assert(c.bucket_count() == 31);
test(c);
}
diff --git a/test/std/containers/unord/unord.multimap/reserve.pass.cpp b/test/std/containers/unord/unord.multimap/reserve.pass.cpp
index 801c74457d74..388b1f67e450 100644
--- a/test/std/containers/unord/unord.multimap/reserve.pass.cpp
+++ b/test/std/containers/unord/unord.multimap/reserve.pass.cpp
@@ -33,6 +33,21 @@ void test(const C& c)
assert(c.find(4)->second == "four");
}
+void reserve_invariant(size_t n) // LWG #2156
+{
+ for (size_t i = 0; i < n; ++i)
+ {
+ std::unordered_multimap<size_t, size_t> c;
+ c.reserve(n);
+ size_t buckets = c.bucket_count();
+ for (size_t j = 0; j < i; ++j)
+ {
+ c.insert(std::unordered_multimap<size_t, size_t>::value_type(i,i));
+ assert(buckets == c.bucket_count());
+ }
+ }
+}
+
int main()
{
{
@@ -90,4 +105,5 @@ int main()
test(c);
}
#endif
+ reserve_invariant(20);
}
diff --git a/test/std/containers/unord/unord.multimap/unord.multimap.swap/swap_noexcept.pass.cpp b/test/std/containers/unord/unord.multimap/unord.multimap.swap/swap_noexcept.pass.cpp
index 37c8119060b7..7c912e01d572 100644
--- a/test/std/containers/unord/unord.multimap/unord.multimap.swap/swap_noexcept.pass.cpp
+++ b/test/std/containers/unord/unord.multimap/unord.multimap.swap/swap_noexcept.pass.cpp
@@ -116,7 +116,7 @@ struct some_alloc3
int main()
{
#if __has_feature(cxx_noexcept)
- typedef std::pair<const MoveOnly, MoveOnly> MapType;
+ typedef std::pair<const MoveOnly, MoveOnly> V;
{
typedef std::unordered_multimap<MoveOnly, MoveOnly> C;
C c1, c2;
@@ -124,13 +124,13 @@ int main()
}
{
typedef std::unordered_multimap<MoveOnly, MoveOnly, std::hash<MoveOnly>,
- std::equal_to<MoveOnly>, test_allocator<MapType>> C;
+ std::equal_to<MoveOnly>, test_allocator<V>> C;
C c1, c2;
static_assert(noexcept(swap(c1, c2)), "");
}
{
typedef std::unordered_multimap<MoveOnly, MoveOnly, std::hash<MoveOnly>,
- std::equal_to<MoveOnly>, other_allocator<MapType>> C;
+ std::equal_to<MoveOnly>, other_allocator<V>> C;
C c1, c2;
static_assert(noexcept(swap(c1, c2)), "");
}
@@ -148,47 +148,47 @@ int main()
#if TEST_STD_VER >= 14
{ // POCS allocator, throwable swap for hash, throwable swap for comp
- typedef std::unordered_multimap<MoveOnly, MoveOnly, some_hash<MoveOnly>, some_comp <MoveOnly>, some_alloc <MapType>> C;
+ typedef std::unordered_multimap<MoveOnly, MoveOnly, some_hash<MoveOnly>, some_comp <MoveOnly>, some_alloc <V>> C;
C c1, c2;
static_assert(!noexcept(swap(c1, c2)), "");
}
{ // always equal allocator, throwable swap for hash, throwable swap for comp
- typedef std::unordered_multimap<MoveOnly, MoveOnly, some_hash<MoveOnly>, some_comp <MoveOnly>, some_alloc2<MapType>> C;
+ typedef std::unordered_multimap<MoveOnly, MoveOnly, some_hash<MoveOnly>, some_comp <MoveOnly>, some_alloc2<V>> C;
C c1, c2;
static_assert(!noexcept(swap(c1, c2)), "");
}
{ // POCS allocator, throwable swap for hash, nothrow swap for comp
- typedef std::unordered_multimap<MoveOnly, MoveOnly, some_hash<MoveOnly>, some_comp2<MoveOnly>, some_alloc <MapType>> C;
+ typedef std::unordered_multimap<MoveOnly, MoveOnly, some_hash<MoveOnly>, some_comp2<MoveOnly>, some_alloc <V>> C;
C c1, c2;
static_assert(!noexcept(swap(c1, c2)), "");
}
{ // always equal allocator, throwable swap for hash, nothrow swap for comp
- typedef std::unordered_multimap<MoveOnly, MoveOnly, some_hash<MoveOnly>, some_comp2<MoveOnly>, some_alloc2<MapType>> C;
+ typedef std::unordered_multimap<MoveOnly, MoveOnly, some_hash<MoveOnly>, some_comp2<MoveOnly>, some_alloc2<V>> C;
C c1, c2;
static_assert(!noexcept(swap(c1, c2)), "");
}
{ // POCS allocator, nothrow swap for hash, throwable swap for comp
- typedef std::unordered_multimap<MoveOnly, MoveOnly, some_hash2<MoveOnly>, some_comp <MoveOnly>, some_alloc <MapType>> C;
+ typedef std::unordered_multimap<MoveOnly, MoveOnly, some_hash2<MoveOnly>, some_comp <MoveOnly>, some_alloc <V>> C;
C c1, c2;
static_assert(!noexcept(swap(c1, c2)), "");
}
{ // always equal allocator, nothrow swap for hash, throwable swap for comp
- typedef std::unordered_multimap<MoveOnly, MoveOnly, some_hash2<MoveOnly>, some_comp <MoveOnly>, some_alloc2<MapType>> C;
+ typedef std::unordered_multimap<MoveOnly, MoveOnly, some_hash2<MoveOnly>, some_comp <MoveOnly>, some_alloc2<V>> C;
C c1, c2;
static_assert(!noexcept(swap(c1, c2)), "");
}
{ // POCS allocator, nothrow swap for hash, nothrow swap for comp
- typedef std::unordered_multimap<MoveOnly, MoveOnly, some_hash2<MoveOnly>, some_comp2<MoveOnly>, some_alloc <MapType>> C;
+ typedef std::unordered_multimap<MoveOnly, MoveOnly, some_hash2<MoveOnly>, some_comp2<MoveOnly>, some_alloc <V>> C;
C c1, c2;
static_assert( noexcept(swap(c1, c2)), "");
}
{ // always equal allocator, nothrow swap for hash, nothrow swap for comp
- typedef std::unordered_multimap<MoveOnly, MoveOnly, some_hash2<MoveOnly>, some_comp2<MoveOnly>, some_alloc2<MapType>> C;
+ typedef std::unordered_multimap<MoveOnly, MoveOnly, some_hash2<MoveOnly>, some_comp2<MoveOnly>, some_alloc2<V>> C;
C c1, c2;
static_assert( noexcept(swap(c1, c2)), "");
}
{ // NOT always equal allocator, nothrow swap for hash, nothrow swap for comp
- typedef std::unordered_multimap<MoveOnly, MoveOnly, some_hash2<MoveOnly>, some_comp2<MoveOnly>, some_alloc3<MapType>> C;
+ typedef std::unordered_multimap<MoveOnly, MoveOnly, some_hash2<MoveOnly>, some_comp2<MoveOnly>, some_alloc3<V>> C;
C c1, c2;
static_assert( noexcept(swap(c1, c2)), "");
}
diff --git a/test/std/containers/unord/unord.multiset/allocator_mismatch.fail.cpp b/test/std/containers/unord/unord.multiset/allocator_mismatch.fail.cpp
new file mode 100644
index 000000000000..5836cb366159
--- /dev/null
+++ b/test/std/containers/unord/unord.multiset/allocator_mismatch.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <unordered_set>
+// The container's value type must be the same as the allocator's value type
+
+#include <unordered_set>
+
+int main()
+{
+ std::unordered_multiset<int, std::hash<int>, std::less<int>, std::allocator<long> > v;
+}
diff --git a/test/std/containers/unord/unord.multiset/rehash.pass.cpp b/test/std/containers/unord/unord.multiset/rehash.pass.cpp
index bc8d461c60bf..5c7c6aa8aad3 100644
--- a/test/std/containers/unord/unord.multiset/rehash.pass.cpp
+++ b/test/std/containers/unord/unord.multiset/rehash.pass.cpp
@@ -21,6 +21,12 @@
#include "min_allocator.h"
template <class C>
+void rehash_postcondition(const C& c, size_t n)
+{
+ assert(c.bucket_count() >= c.size() / c.max_load_factor() && c.bucket_count() >= n);
+}
+
+template <class C>
void test(const C& c)
{
assert(c.size() == 6);
@@ -48,13 +54,16 @@ int main()
test(c);
assert(c.bucket_count() >= 7);
c.rehash(3);
+ rehash_postcondition(c, 3);
assert(c.bucket_count() == 7);
test(c);
c.max_load_factor(2);
c.rehash(3);
+ rehash_postcondition(c, 3);
assert(c.bucket_count() == 3);
test(c);
c.rehash(31);
+ rehash_postcondition(c, 31);
assert(c.bucket_count() == 31);
test(c);
}
@@ -76,13 +85,16 @@ int main()
test(c);
assert(c.bucket_count() >= 7);
c.rehash(3);
+ rehash_postcondition(c, 3);
assert(c.bucket_count() == 7);
test(c);
c.max_load_factor(2);
c.rehash(3);
+ rehash_postcondition(c, 3);
assert(c.bucket_count() == 3);
test(c);
c.rehash(31);
+ rehash_postcondition(c, 31);
assert(c.bucket_count() == 31);
test(c);
}
diff --git a/test/std/containers/unord/unord.multiset/reserve.pass.cpp b/test/std/containers/unord/unord.multiset/reserve.pass.cpp
index 0c17583d371d..1d393a09cde2 100644
--- a/test/std/containers/unord/unord.multiset/reserve.pass.cpp
+++ b/test/std/containers/unord/unord.multiset/reserve.pass.cpp
@@ -30,6 +30,21 @@ void test(const C& c)
assert(c.count(4) == 1);
}
+void reserve_invariant(size_t n) // LWG #2156
+{
+ for (size_t i = 0; i < n; ++i)
+ {
+ std::unordered_multiset<size_t> c;
+ c.reserve(n);
+ size_t buckets = c.bucket_count();
+ for (size_t j = 0; j < i; ++j)
+ {
+ c.insert(i);
+ assert(buckets == c.bucket_count());
+ }
+ }
+}
+
int main()
{
{
@@ -87,4 +102,5 @@ int main()
test(c);
}
#endif
+ reserve_invariant(20);
}
diff --git a/test/std/containers/unord/unord.set/allocator_mismatch.fail.cpp b/test/std/containers/unord/unord.set/allocator_mismatch.fail.cpp
new file mode 100644
index 000000000000..b87c9a24d3a5
--- /dev/null
+++ b/test/std/containers/unord/unord.set/allocator_mismatch.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <unordered_set>
+// The container's value type must be the same as the allocator's value type
+
+#include <unordered_set>
+
+int main()
+{
+ std::unordered_set<int, std::hash<int>, std::less<int>, std::allocator<long> > v;
+}
diff --git a/test/std/containers/unord/unord.set/rehash.pass.cpp b/test/std/containers/unord/unord.set/rehash.pass.cpp
index 30fffa561f78..e28c25dc8197 100644
--- a/test/std/containers/unord/unord.set/rehash.pass.cpp
+++ b/test/std/containers/unord/unord.set/rehash.pass.cpp
@@ -21,6 +21,12 @@
#include "min_allocator.h"
template <class C>
+void rehash_postcondition(const C& c, size_t n)
+{
+ assert(c.bucket_count() >= c.size() / c.max_load_factor() && c.bucket_count() >= n);
+}
+
+template <class C>
void test(const C& c)
{
assert(c.size() == 4);
@@ -48,13 +54,16 @@ int main()
test(c);
assert(c.bucket_count() >= 5);
c.rehash(3);
+ rehash_postcondition(c, 3);
assert(c.bucket_count() == 5);
test(c);
c.max_load_factor(2);
c.rehash(3);
+ rehash_postcondition(c, 3);
assert(c.bucket_count() == 3);
test(c);
c.rehash(31);
+ rehash_postcondition(c, 31);
assert(c.bucket_count() == 31);
test(c);
}
@@ -76,13 +85,16 @@ int main()
test(c);
assert(c.bucket_count() >= 5);
c.rehash(3);
+ rehash_postcondition(c, 3);
assert(c.bucket_count() == 5);
test(c);
c.max_load_factor(2);
c.rehash(3);
+ rehash_postcondition(c, 3);
assert(c.bucket_count() == 3);
test(c);
c.rehash(31);
+ rehash_postcondition(c, 31);
assert(c.bucket_count() == 31);
test(c);
}
diff --git a/test/std/containers/unord/unord.set/reserve.pass.cpp b/test/std/containers/unord/unord.set/reserve.pass.cpp
index 7d6656a18674..078b886b267e 100644
--- a/test/std/containers/unord/unord.set/reserve.pass.cpp
+++ b/test/std/containers/unord/unord.set/reserve.pass.cpp
@@ -30,6 +30,21 @@ void test(const C& c)
assert(c.count(4) == 1);
}
+void reserve_invariant(size_t n) // LWG #2156
+{
+ for (size_t i = 0; i < n; ++i)
+ {
+ std::unordered_set<size_t> c;
+ c.reserve(n);
+ size_t buckets = c.bucket_count();
+ for (size_t j = 0; j < i; ++j)
+ {
+ c.insert(i);
+ assert(buckets == c.bucket_count());
+ }
+ }
+}
+
int main()
{
{
@@ -87,4 +102,5 @@ int main()
test(c);
}
#endif
+ reserve_invariant(20);
}
diff --git a/test/std/depr/depr.auto.ptr/auto.ptr/auto.ptr.conv/convert_to_auto_ptr_ref.pass.cpp b/test/std/depr/depr.auto.ptr/auto.ptr/auto.ptr.conv/convert_to_auto_ptr_ref.pass.cpp
index f61a28e84d4c..a5db81e6c632 100644
--- a/test/std/depr/depr.auto.ptr/auto.ptr/auto.ptr.conv/convert_to_auto_ptr_ref.pass.cpp
+++ b/test/std/depr/depr.auto.ptr/auto.ptr/auto.ptr.conv/convert_to_auto_ptr_ref.pass.cpp
@@ -24,6 +24,10 @@ test()
B* p1 = new B(1);
std::auto_ptr<B> ap1(p1);
std::auto_ptr_ref<A> apr = ap1;
+ std::auto_ptr<A> ap2(apr);
+ assert(ap1.get() == nullptr);
+ assert(ap2.get() == p1);
+ ap2.release();
delete p1;
}
diff --git a/test/std/depr/depr.auto.ptr/auto.ptr/element_type.pass.cpp b/test/std/depr/depr.auto.ptr/auto.ptr/element_type.pass.cpp
index 2d1c2af8062d..256563439a17 100644
--- a/test/std/depr/depr.auto.ptr/auto.ptr/element_type.pass.cpp
+++ b/test/std/depr/depr.auto.ptr/auto.ptr/element_type.pass.cpp
@@ -25,6 +25,8 @@ void
test()
{
static_assert((std::is_same<typename std::auto_ptr<T>::element_type, T>::value), "");
+ std::auto_ptr<T> p;
+ ((void)p);
}
int main()
@@ -32,5 +34,4 @@ int main()
test<int>();
test<double>();
test<void>();
- std::auto_ptr<void> p;
}
diff --git a/test/std/depr/depr.c.headers/extern_c.pass.cpp b/test/std/depr/depr.c.headers/extern_c.pass.cpp
new file mode 100644
index 000000000000..d4d8b5fafdde
--- /dev/null
+++ b/test/std/depr/depr.c.headers/extern_c.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.
+//
+//===----------------------------------------------------------------------===//
+
+// Sometimes C++'s <foo.h> headers get included within extern "C" contexts. This
+// is ill-formed (no diagnostic required), per [using.headers]p3, but we permit
+// it as an extension.
+
+extern "C" {
+#include <assert.h>
+// complex.h is not supported in extern "C".
+#include <ctype.h>
+#include <errno.h>
+#include <fenv.h>
+#include <float.h>
+#include <inttypes.h>
+#include <iso646.h>
+#include <limits.h>
+#include <locale.h>
+#include <math.h>
+#include <setjmp.h>
+#include <signal.h>
+#include <stdalign.h>
+#include <stdarg.h>
+#include <stdbool.h>
+#include <stddef.h>
+#include <stdint.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+// tgmath.h is not supported in extern "C".
+#include <time.h>
+// FIXME: #include <uchar.h>
+#include <wchar.h>
+#include <wctype.h>
+}
+
+int main() {}
diff --git a/test/std/depr/depr.c.headers/inttypes_h.pass.cpp b/test/std/depr/depr.c.headers/inttypes_h.pass.cpp
index 4adf82da95ec..637cf72287b8 100644
--- a/test/std/depr/depr.c.headers/inttypes_h.pass.cpp
+++ b/test/std/depr/depr.c.headers/inttypes_h.pass.cpp
@@ -12,6 +12,250 @@
#include <inttypes.h>
#include <type_traits>
+#ifndef INT8_MIN
+#error INT8_MIN not defined
+#endif
+
+#ifndef INT16_MIN
+#error INT16_MIN not defined
+#endif
+
+#ifndef INT32_MIN
+#error INT32_MIN not defined
+#endif
+
+#ifndef INT64_MIN
+#error INT64_MIN not defined
+#endif
+
+#ifndef INT8_MAX
+#error INT8_MAX not defined
+#endif
+
+#ifndef INT16_MAX
+#error INT16_MAX not defined
+#endif
+
+#ifndef INT32_MAX
+#error INT32_MAX not defined
+#endif
+
+#ifndef INT64_MAX
+#error INT64_MAX not defined
+#endif
+
+#ifndef UINT8_MAX
+#error UINT8_MAX not defined
+#endif
+
+#ifndef UINT16_MAX
+#error UINT16_MAX not defined
+#endif
+
+#ifndef UINT32_MAX
+#error UINT32_MAX not defined
+#endif
+
+#ifndef UINT64_MAX
+#error UINT64_MAX not defined
+#endif
+
+#ifndef INT_LEAST8_MIN
+#error INT_LEAST8_MIN not defined
+#endif
+
+#ifndef INT_LEAST16_MIN
+#error INT_LEAST16_MIN not defined
+#endif
+
+#ifndef INT_LEAST32_MIN
+#error INT_LEAST32_MIN not defined
+#endif
+
+#ifndef INT_LEAST64_MIN
+#error INT_LEAST64_MIN not defined
+#endif
+
+#ifndef INT_LEAST8_MAX
+#error INT_LEAST8_MAX not defined
+#endif
+
+#ifndef INT_LEAST16_MAX
+#error INT_LEAST16_MAX not defined
+#endif
+
+#ifndef INT_LEAST32_MAX
+#error INT_LEAST32_MAX not defined
+#endif
+
+#ifndef INT_LEAST64_MAX
+#error INT_LEAST64_MAX not defined
+#endif
+
+#ifndef UINT_LEAST8_MAX
+#error UINT_LEAST8_MAX not defined
+#endif
+
+#ifndef UINT_LEAST16_MAX
+#error UINT_LEAST16_MAX not defined
+#endif
+
+#ifndef UINT_LEAST32_MAX
+#error UINT_LEAST32_MAX not defined
+#endif
+
+#ifndef UINT_LEAST64_MAX
+#error UINT_LEAST64_MAX not defined
+#endif
+
+#ifndef INT_FAST8_MIN
+#error INT_FAST8_MIN not defined
+#endif
+
+#ifndef INT_FAST16_MIN
+#error INT_FAST16_MIN not defined
+#endif
+
+#ifndef INT_FAST32_MIN
+#error INT_FAST32_MIN not defined
+#endif
+
+#ifndef INT_FAST64_MIN
+#error INT_FAST64_MIN not defined
+#endif
+
+#ifndef INT_FAST8_MAX
+#error INT_FAST8_MAX not defined
+#endif
+
+#ifndef INT_FAST16_MAX
+#error INT_FAST16_MAX not defined
+#endif
+
+#ifndef INT_FAST32_MAX
+#error INT_FAST32_MAX not defined
+#endif
+
+#ifndef INT_FAST64_MAX
+#error INT_FAST64_MAX not defined
+#endif
+
+#ifndef UINT_FAST8_MAX
+#error UINT_FAST8_MAX not defined
+#endif
+
+#ifndef UINT_FAST16_MAX
+#error UINT_FAST16_MAX not defined
+#endif
+
+#ifndef UINT_FAST32_MAX
+#error UINT_FAST32_MAX not defined
+#endif
+
+#ifndef UINT_FAST64_MAX
+#error UINT_FAST64_MAX not defined
+#endif
+
+#ifndef INTPTR_MIN
+#error INTPTR_MIN not defined
+#endif
+
+#ifndef INTPTR_MAX
+#error INTPTR_MAX not defined
+#endif
+
+#ifndef UINTPTR_MAX
+#error UINTPTR_MAX not defined
+#endif
+
+#ifndef INTMAX_MIN
+#error INTMAX_MIN not defined
+#endif
+
+#ifndef INTMAX_MAX
+#error INTMAX_MAX not defined
+#endif
+
+#ifndef UINTMAX_MAX
+#error UINTMAX_MAX not defined
+#endif
+
+#ifndef PTRDIFF_MIN
+#error PTRDIFF_MIN not defined
+#endif
+
+#ifndef PTRDIFF_MAX
+#error PTRDIFF_MAX not defined
+#endif
+
+#ifndef SIG_ATOMIC_MIN
+#error SIG_ATOMIC_MIN not defined
+#endif
+
+#ifndef SIG_ATOMIC_MAX
+#error SIG_ATOMIC_MAX not defined
+#endif
+
+#ifndef SIZE_MAX
+#error SIZE_MAX not defined
+#endif
+
+#ifndef WCHAR_MIN
+#error WCHAR_MIN not defined
+#endif
+
+#ifndef WCHAR_MAX
+#error WCHAR_MAX not defined
+#endif
+
+#ifndef WINT_MIN
+#error WINT_MIN not defined
+#endif
+
+#ifndef WINT_MAX
+#error WINT_MAX not defined
+#endif
+
+#ifndef INT8_C
+#error INT8_C not defined
+#endif
+
+#ifndef INT16_C
+#error INT16_C not defined
+#endif
+
+#ifndef INT32_C
+#error INT32_C not defined
+#endif
+
+#ifndef INT64_C
+#error INT64_C not defined
+#endif
+
+#ifndef UINT8_C
+#error UINT8_C not defined
+#endif
+
+#ifndef UINT16_C
+#error UINT16_C not defined
+#endif
+
+#ifndef UINT32_C
+#error UINT32_C not defined
+#endif
+
+#ifndef UINT64_C
+#error UINT64_C not defined
+#endif
+
+#ifndef INTMAX_C
+#error INTMAX_C not defined
+#endif
+
+#ifndef UINTMAX_C
+#error UINTMAX_C not defined
+#endif
+
#ifndef PRId8
#error PRId8 not defined
#endif
@@ -631,6 +875,48 @@
int main()
{
{
+ int8_t i1 = 0;
+ int16_t i2 = 0;
+ int32_t i3 = 0;
+ int64_t i4 = 0;
+ }
+ {
+ uint8_t i1 = 0;
+ uint16_t i2 = 0;
+ uint32_t i3 = 0;
+ uint64_t i4 = 0;
+ }
+ {
+ int_least8_t i1 = 0;
+ int_least16_t i2 = 0;
+ int_least32_t i3 = 0;
+ int_least64_t i4 = 0;
+ }
+ {
+ uint_least8_t i1 = 0;
+ uint_least16_t i2 = 0;
+ uint_least32_t i3 = 0;
+ uint_least64_t i4 = 0;
+ }
+ {
+ int_fast8_t i1 = 0;
+ int_fast16_t i2 = 0;
+ int_fast32_t i3 = 0;
+ int_fast64_t i4 = 0;
+ }
+ {
+ uint_fast8_t i1 = 0;
+ uint_fast16_t i2 = 0;
+ uint_fast32_t i3 = 0;
+ uint_fast64_t i4 = 0;
+ }
+ {
+ intptr_t i1 = 0;
+ uintptr_t i2 = 0;
+ intmax_t i3 = 0;
+ uintmax_t i4 = 0;
+ }
+ {
imaxdiv_t i1 = {0};
}
intmax_t i = 0;
diff --git a/test/std/depr/depr.c.headers/locale_h.pass.cpp b/test/std/depr/depr.c.headers/locale_h.pass.cpp
index 6ecf5a82e8dd..f5735b6ea19d 100644
--- a/test/std/depr/depr.c.headers/locale_h.pass.cpp
+++ b/test/std/depr/depr.c.headers/locale_h.pass.cpp
@@ -42,7 +42,7 @@
int main()
{
- lconv lc;
+ lconv lc; ((void)lc);
static_assert((std::is_same<decltype(setlocale(0, "")), char*>::value), "");
static_assert((std::is_same<decltype(localeconv()), lconv*>::value), "");
}
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 b03a61b15e11..ed12fcf73a8c 100644
--- a/test/std/depr/depr.c.headers/math_h.pass.cpp
+++ b/test/std/depr/depr.c.headers/math_h.pass.cpp
@@ -9,7 +9,8 @@
// <math.h>
-// XFAIL: linux
+// NOTE: isinf and isnan are tested separately because they are expected to fail
+// on linux. We don't want their expected failure to hide other failures in this file.
#include <math.h>
#include <type_traits>
@@ -17,498 +18,1168 @@
#include "hexfloat.h"
+// convertible to int/float/double/etc
+template <class T, int N=0>
+struct Value {
+ operator T () { return T(N); }
+};
+
+// See PR21083
+// Ambiguous is a user-defined type that defines its own overloads of cmath
+// functions. When the std overloads are candidates too (by using or adl),
+// they should not interfere.
+struct Ambiguous : std::true_type { // ADL
+ operator float () { return 0.f; }
+ operator double () { return 0.; }
+};
+Ambiguous abs(Ambiguous){ return Ambiguous(); }
+Ambiguous acos(Ambiguous){ return Ambiguous(); }
+Ambiguous asin(Ambiguous){ return Ambiguous(); }
+Ambiguous atan(Ambiguous){ return Ambiguous(); }
+Ambiguous atan2(Ambiguous, Ambiguous){ return Ambiguous(); }
+Ambiguous ceil(Ambiguous){ return Ambiguous(); }
+Ambiguous cos(Ambiguous){ return Ambiguous(); }
+Ambiguous cosh(Ambiguous){ return Ambiguous(); }
+Ambiguous exp(Ambiguous){ return Ambiguous(); }
+Ambiguous fabs(Ambiguous){ return Ambiguous(); }
+Ambiguous floor(Ambiguous){ return Ambiguous(); }
+Ambiguous fmod(Ambiguous, Ambiguous){ return Ambiguous(); }
+Ambiguous frexp(Ambiguous, int*){ return Ambiguous(); }
+Ambiguous ldexp(Ambiguous, int){ return Ambiguous(); }
+Ambiguous log(Ambiguous){ return Ambiguous(); }
+Ambiguous log10(Ambiguous){ return Ambiguous(); }
+Ambiguous modf(Ambiguous, Ambiguous*){ return Ambiguous(); }
+Ambiguous pow(Ambiguous, Ambiguous){ return Ambiguous(); }
+Ambiguous sin(Ambiguous){ return Ambiguous(); }
+Ambiguous sinh(Ambiguous){ return Ambiguous(); }
+Ambiguous sqrt(Ambiguous){ return Ambiguous(); }
+Ambiguous tan(Ambiguous){ return Ambiguous(); }
+Ambiguous tanh(Ambiguous){ return Ambiguous(); }
+Ambiguous signbit(Ambiguous){ return Ambiguous(); }
+Ambiguous fpclassify(Ambiguous){ return Ambiguous(); }
+Ambiguous isfinite(Ambiguous){ return Ambiguous(); }
+Ambiguous isnormal(Ambiguous){ return Ambiguous(); }
+Ambiguous isgreater(Ambiguous, Ambiguous){ return Ambiguous(); }
+Ambiguous isgreaterequal(Ambiguous, Ambiguous){ return Ambiguous(); }
+Ambiguous isless(Ambiguous, Ambiguous){ return Ambiguous(); }
+Ambiguous islessequal(Ambiguous, Ambiguous){ return Ambiguous(); }
+Ambiguous islessgreater(Ambiguous, Ambiguous){ return Ambiguous(); }
+Ambiguous isunordered(Ambiguous, Ambiguous){ return Ambiguous(); }
+Ambiguous acosh(Ambiguous){ return Ambiguous(); }
+Ambiguous asinh(Ambiguous){ return Ambiguous(); }
+Ambiguous atanh(Ambiguous){ return Ambiguous(); }
+Ambiguous cbrt(Ambiguous){ return Ambiguous(); }
+Ambiguous copysign(Ambiguous, Ambiguous){ return Ambiguous(); }
+Ambiguous erf(Ambiguous){ return Ambiguous(); }
+Ambiguous erfc(Ambiguous){ return Ambiguous(); }
+Ambiguous exp2(Ambiguous){ return Ambiguous(); }
+Ambiguous expm1(Ambiguous){ return Ambiguous(); }
+Ambiguous fdim(Ambiguous, Ambiguous){ return Ambiguous(); }
+Ambiguous fma(Ambiguous, Ambiguous, Ambiguous){ return Ambiguous(); }
+Ambiguous fmax(Ambiguous, Ambiguous){ return Ambiguous(); }
+Ambiguous fmin(Ambiguous, Ambiguous){ return Ambiguous(); }
+Ambiguous hypot(Ambiguous, Ambiguous){ return Ambiguous(); }
+Ambiguous ilogb(Ambiguous){ return Ambiguous(); }
+Ambiguous lgamma(Ambiguous){ return Ambiguous(); }
+Ambiguous llrint(Ambiguous){ return Ambiguous(); }
+Ambiguous llround(Ambiguous){ return Ambiguous(); }
+Ambiguous log1p(Ambiguous){ return Ambiguous(); }
+Ambiguous log2(Ambiguous){ return Ambiguous(); }
+Ambiguous logb(Ambiguous){ return Ambiguous(); }
+Ambiguous lrint(Ambiguous){ return Ambiguous(); }
+Ambiguous lround(Ambiguous){ return Ambiguous(); }
+Ambiguous nearbyint(Ambiguous){ return Ambiguous(); }
+Ambiguous nextafter(Ambiguous, Ambiguous){ return Ambiguous(); }
+Ambiguous nexttoward(Ambiguous, Ambiguous){ return Ambiguous(); }
+Ambiguous remainder(Ambiguous, Ambiguous){ return Ambiguous(); }
+Ambiguous remquo(Ambiguous, Ambiguous, int*){ return Ambiguous(); }
+Ambiguous rint(Ambiguous){ return Ambiguous(); }
+Ambiguous round(Ambiguous){ return Ambiguous(); }
+Ambiguous scalbln(Ambiguous, Ambiguous){ return Ambiguous(); }
+Ambiguous scalbn(Ambiguous, Ambiguous){ return Ambiguous(); }
+Ambiguous tgamma(Ambiguous){ return Ambiguous(); }
+Ambiguous trunc(Ambiguous){ return Ambiguous(); }
+
+void test_abs()
+{
+ static_assert((std::is_same<decltype(abs((float)0)), float>::value), "");
+ static_assert((std::is_same<decltype(abs((double)0)), double>::value), "");
+ static_assert((std::is_same<decltype(abs((long double)0)), long double>::value), "");
+ static_assert((std::is_same<decltype(abs(Ambiguous())), Ambiguous>::value), "");
+ assert(abs(-1.) == 1);
+}
+
void test_acos()
{
+ static_assert((std::is_same<decltype(acos((float)0)), float>::value), "");
+ static_assert((std::is_same<decltype(acos((bool)0)), double>::value), "");
+ static_assert((std::is_same<decltype(acos((unsigned short)0)), double>::value), "");
+ static_assert((std::is_same<decltype(acos((int)0)), double>::value), "");
+ static_assert((std::is_same<decltype(acos((unsigned int)0)), double>::value), "");
+ static_assert((std::is_same<decltype(acos((long)0)), double>::value), "");
+ static_assert((std::is_same<decltype(acos((unsigned long)0)), double>::value), "");
+ static_assert((std::is_same<decltype(acos((long long)0)), double>::value), "");
+ static_assert((std::is_same<decltype(acos((unsigned long long)0)), double>::value), "");
static_assert((std::is_same<decltype(acos((double)0)), double>::value), "");
+ static_assert((std::is_same<decltype(acos((long double)0)), long double>::value), "");
static_assert((std::is_same<decltype(acosf(0)), float>::value), "");
static_assert((std::is_same<decltype(acosl(0)), long double>::value), "");
+ static_assert((std::is_same<decltype(acos(Ambiguous())), Ambiguous>::value), "");
assert(acos(1) == 0);
}
void test_asin()
{
+ static_assert((std::is_same<decltype(asin((float)0)), float>::value), "");
+ static_assert((std::is_same<decltype(asin((bool)0)), double>::value), "");
+ static_assert((std::is_same<decltype(asin((unsigned short)0)), double>::value), "");
+ static_assert((std::is_same<decltype(asin((int)0)), double>::value), "");
+ static_assert((std::is_same<decltype(asin((unsigned int)0)), double>::value), "");
+ static_assert((std::is_same<decltype(asin((long)0)), double>::value), "");
+ static_assert((std::is_same<decltype(asin((unsigned long)0)), double>::value), "");
+ static_assert((std::is_same<decltype(asin((long long)0)), double>::value), "");
+ static_assert((std::is_same<decltype(asin((unsigned long long)0)), double>::value), "");
static_assert((std::is_same<decltype(asin((double)0)), double>::value), "");
+ static_assert((std::is_same<decltype(asin((long double)0)), long double>::value), "");
static_assert((std::is_same<decltype(asinf(0)), float>::value), "");
static_assert((std::is_same<decltype(asinl(0)), long double>::value), "");
+ static_assert((std::is_same<decltype(asin(Ambiguous())), Ambiguous>::value), "");
assert(asin(0) == 0);
}
void test_atan()
{
+ static_assert((std::is_same<decltype(atan((float)0)), float>::value), "");
+ static_assert((std::is_same<decltype(atan((bool)0)), double>::value), "");
+ static_assert((std::is_same<decltype(atan((unsigned short)0)), double>::value), "");
+ static_assert((std::is_same<decltype(atan((int)0)), double>::value), "");
+ static_assert((std::is_same<decltype(atan((unsigned int)0)), double>::value), "");
+ static_assert((std::is_same<decltype(atan((long)0)), double>::value), "");
+ static_assert((std::is_same<decltype(atan((unsigned long)0)), double>::value), "");
+ static_assert((std::is_same<decltype(atan((long long)0)), double>::value), "");
+ static_assert((std::is_same<decltype(atan((unsigned long long)0)), double>::value), "");
static_assert((std::is_same<decltype(atan((double)0)), double>::value), "");
+ static_assert((std::is_same<decltype(atan((long double)0)), long double>::value), "");
static_assert((std::is_same<decltype(atanf(0)), float>::value), "");
static_assert((std::is_same<decltype(atanl(0)), long double>::value), "");
+ static_assert((std::is_same<decltype(atan(Ambiguous())), Ambiguous>::value), "");
assert(atan(0) == 0);
}
void test_atan2()
{
+ static_assert((std::is_same<decltype(atan2((float)0, (float)0)), float>::value), "");
+ static_assert((std::is_same<decltype(atan2((bool)0, (float)0)), double>::value), "");
+ static_assert((std::is_same<decltype(atan2((unsigned short)0, (double)0)), double>::value), "");
+ static_assert((std::is_same<decltype(atan2((int)0, (long double)0)), long double>::value), "");
+ static_assert((std::is_same<decltype(atan2((float)0, (unsigned int)0)), double>::value), "");
+ static_assert((std::is_same<decltype(atan2((double)0, (long)0)), double>::value), "");
+ static_assert((std::is_same<decltype(atan2((long double)0, (unsigned long)0)), long double>::value), "");
+ static_assert((std::is_same<decltype(atan2((int)0, (long long)0)), double>::value), "");
+ static_assert((std::is_same<decltype(atan2((int)0, (unsigned long long)0)), double>::value), "");
static_assert((std::is_same<decltype(atan2((double)0, (double)0)), double>::value), "");
+ static_assert((std::is_same<decltype(atan2((long double)0, (long double)0)), long double>::value), "");
+ static_assert((std::is_same<decltype(atan2((float)0, (double)0)), double>::value), "");
+ static_assert((std::is_same<decltype(atan2((float)0, (long double)0)), long double>::value), "");
+ static_assert((std::is_same<decltype(atan2((double)0, (long double)0)), long double>::value), "");
static_assert((std::is_same<decltype(atan2f(0,0)), float>::value), "");
static_assert((std::is_same<decltype(atan2l(0,0)), long double>::value), "");
+ static_assert((std::is_same<decltype(atan2((int)0, (int)0)), double>::value), "");
+ static_assert((std::is_same<decltype(atan2(Ambiguous(), Ambiguous())), Ambiguous>::value), "");
assert(atan2(0,1) == 0);
}
void test_ceil()
{
+ static_assert((std::is_same<decltype(ceil((float)0)), float>::value), "");
+ static_assert((std::is_same<decltype(ceil((bool)0)), double>::value), "");
+ static_assert((std::is_same<decltype(ceil((unsigned short)0)), double>::value), "");
+ static_assert((std::is_same<decltype(ceil((int)0)), double>::value), "");
+ static_assert((std::is_same<decltype(ceil((unsigned int)0)), double>::value), "");
+ static_assert((std::is_same<decltype(ceil((long)0)), double>::value), "");
+ static_assert((std::is_same<decltype(ceil((unsigned long)0)), double>::value), "");
+ static_assert((std::is_same<decltype(ceil((long long)0)), double>::value), "");
+ static_assert((std::is_same<decltype(ceil((unsigned long long)0)), double>::value), "");
static_assert((std::is_same<decltype(ceil((double)0)), double>::value), "");
+ static_assert((std::is_same<decltype(ceil((long double)0)), long double>::value), "");
static_assert((std::is_same<decltype(ceilf(0)), float>::value), "");
static_assert((std::is_same<decltype(ceill(0)), long double>::value), "");
+ static_assert((std::is_same<decltype(ceil(Ambiguous())), Ambiguous>::value), "");
assert(ceil(0) == 0);
}
void test_cos()
{
+ static_assert((std::is_same<decltype(cos((float)0)), float>::value), "");
+ static_assert((std::is_same<decltype(cos((bool)0)), double>::value), "");
+ static_assert((std::is_same<decltype(cos((unsigned short)0)), double>::value), "");
+ static_assert((std::is_same<decltype(cos((int)0)), double>::value), "");
+ static_assert((std::is_same<decltype(cos((unsigned int)0)), double>::value), "");
+ static_assert((std::is_same<decltype(cos((long)0)), double>::value), "");
+ static_assert((std::is_same<decltype(cos((unsigned long)0)), double>::value), "");
+ static_assert((std::is_same<decltype(cos((long long)0)), double>::value), "");
+ static_assert((std::is_same<decltype(cos((unsigned long long)0)), double>::value), "");
static_assert((std::is_same<decltype(cos((double)0)), double>::value), "");
+ static_assert((std::is_same<decltype(cos((long double)0)), long double>::value), "");
static_assert((std::is_same<decltype(cosf(0)), float>::value), "");
static_assert((std::is_same<decltype(cosl(0)), long double>::value), "");
+ static_assert((std::is_same<decltype(cos(Ambiguous())), Ambiguous>::value), "");
assert(cos(0) == 1);
}
void test_cosh()
{
+ static_assert((std::is_same<decltype(cosh((float)0)), float>::value), "");
+ static_assert((std::is_same<decltype(cosh((bool)0)), double>::value), "");
+ static_assert((std::is_same<decltype(cosh((unsigned short)0)), double>::value), "");
+ static_assert((std::is_same<decltype(cosh((int)0)), double>::value), "");
+ static_assert((std::is_same<decltype(cosh((unsigned int)0)), double>::value), "");
+ static_assert((std::is_same<decltype(cosh((long)0)), double>::value), "");
+ static_assert((std::is_same<decltype(cosh((unsigned long)0)), double>::value), "");
+ static_assert((std::is_same<decltype(cosh((long long)0)), double>::value), "");
+ static_assert((std::is_same<decltype(cosh((unsigned long long)0)), double>::value), "");
static_assert((std::is_same<decltype(cosh((double)0)), double>::value), "");
+ static_assert((std::is_same<decltype(cosh((long double)0)), long double>::value), "");
static_assert((std::is_same<decltype(coshf(0)), float>::value), "");
static_assert((std::is_same<decltype(coshl(0)), long double>::value), "");
+ static_assert((std::is_same<decltype(cosh(Ambiguous())), Ambiguous>::value), "");
assert(cosh(0) == 1);
}
void test_exp()
{
+ static_assert((std::is_same<decltype(exp((float)0)), float>::value), "");
+ static_assert((std::is_same<decltype(exp((bool)0)), double>::value), "");
+ static_assert((std::is_same<decltype(exp((unsigned short)0)), double>::value), "");
+ static_assert((std::is_same<decltype(exp((int)0)), double>::value), "");
+ static_assert((std::is_same<decltype(exp((unsigned int)0)), double>::value), "");
+ static_assert((std::is_same<decltype(exp((long)0)), double>::value), "");
+ static_assert((std::is_same<decltype(exp((unsigned long)0)), double>::value), "");
+ static_assert((std::is_same<decltype(exp((long long)0)), double>::value), "");
+ static_assert((std::is_same<decltype(exp((unsigned long long)0)), double>::value), "");
static_assert((std::is_same<decltype(exp((double)0)), double>::value), "");
+ static_assert((std::is_same<decltype(exp((long double)0)), long double>::value), "");
static_assert((std::is_same<decltype(expf(0)), float>::value), "");
static_assert((std::is_same<decltype(expl(0)), long double>::value), "");
+ static_assert((std::is_same<decltype(exp(Ambiguous())), Ambiguous>::value), "");
assert(exp(0) == 1);
}
void test_fabs()
{
+ static_assert((std::is_same<decltype(fabs((float)0)), float>::value), "");
+ static_assert((std::is_same<decltype(fabs((bool)0)), double>::value), "");
+ static_assert((std::is_same<decltype(fabs((unsigned short)0)), double>::value), "");
+ static_assert((std::is_same<decltype(fabs((int)0)), double>::value), "");
+ static_assert((std::is_same<decltype(fabs((unsigned int)0)), double>::value), "");
+ static_assert((std::is_same<decltype(fabs((long)0)), double>::value), "");
+ static_assert((std::is_same<decltype(fabs((unsigned long)0)), double>::value), "");
+ static_assert((std::is_same<decltype(fabs((long long)0)), double>::value), "");
+ static_assert((std::is_same<decltype(fabs((unsigned long long)0)), double>::value), "");
static_assert((std::is_same<decltype(fabs((double)0)), double>::value), "");
- static_assert((std::is_same<decltype(fabsf(0.f)), float>::value), "");
- static_assert((std::is_same<decltype(fabsl(0.L)), long double>::value), "");
- assert(fabs(-1.f) == 1);
+ static_assert((std::is_same<decltype(fabs((long double)0)), long double>::value), "");
+ static_assert((std::is_same<decltype(fabsf(0.0f)), float>::value), "");
+ static_assert((std::is_same<decltype(fabsl(0.0L)), long double>::value), "");
+ static_assert((std::is_same<decltype(fabs(Ambiguous())), Ambiguous>::value), "");
+ assert(fabs(-1) == 1);
}
void test_floor()
{
+ static_assert((std::is_same<decltype(floor((float)0)), float>::value), "");
+ static_assert((std::is_same<decltype(floor((bool)0)), double>::value), "");
+ static_assert((std::is_same<decltype(floor((unsigned short)0)), double>::value), "");
+ static_assert((std::is_same<decltype(floor((int)0)), double>::value), "");
+ static_assert((std::is_same<decltype(floor((unsigned int)0)), double>::value), "");
+ static_assert((std::is_same<decltype(floor((long)0)), double>::value), "");
+ static_assert((std::is_same<decltype(floor((unsigned long)0)), double>::value), "");
+ static_assert((std::is_same<decltype(floor((long long)0)), double>::value), "");
+ static_assert((std::is_same<decltype(floor((unsigned long long)0)), double>::value), "");
static_assert((std::is_same<decltype(floor((double)0)), double>::value), "");
+ static_assert((std::is_same<decltype(floor((long double)0)), long double>::value), "");
static_assert((std::is_same<decltype(floorf(0)), float>::value), "");
static_assert((std::is_same<decltype(floorl(0)), long double>::value), "");
+ static_assert((std::is_same<decltype(floor(Ambiguous())), Ambiguous>::value), "");
assert(floor(1) == 1);
}
void test_fmod()
{
+ static_assert((std::is_same<decltype(fmod((float)0, (float)0)), float>::value), "");
+ static_assert((std::is_same<decltype(fmod((bool)0, (float)0)), double>::value), "");
+ static_assert((std::is_same<decltype(fmod((unsigned short)0, (double)0)), double>::value), "");
+ static_assert((std::is_same<decltype(fmod((int)0, (long double)0)), long double>::value), "");
+ static_assert((std::is_same<decltype(fmod((float)0, (unsigned int)0)), double>::value), "");
+ static_assert((std::is_same<decltype(fmod((double)0, (long)0)), double>::value), "");
+ static_assert((std::is_same<decltype(fmod((long double)0, (unsigned long)0)), long double>::value), "");
+ static_assert((std::is_same<decltype(fmod((int)0, (long long)0)), double>::value), "");
+ static_assert((std::is_same<decltype(fmod((int)0, (unsigned long long)0)), double>::value), "");
static_assert((std::is_same<decltype(fmod((double)0, (double)0)), double>::value), "");
+ static_assert((std::is_same<decltype(fmod((long double)0, (long double)0)), long double>::value), "");
+ static_assert((std::is_same<decltype(fmod((float)0, (double)0)), double>::value), "");
+ static_assert((std::is_same<decltype(fmod((float)0, (long double)0)), long double>::value), "");
+ static_assert((std::is_same<decltype(fmod((double)0, (long double)0)), long double>::value), "");
static_assert((std::is_same<decltype(fmodf(0,0)), float>::value), "");
static_assert((std::is_same<decltype(fmodl(0,0)), long double>::value), "");
+ static_assert((std::is_same<decltype(fmod((int)0, (int)0)), double>::value), "");
+ static_assert((std::is_same<decltype(fmod(Ambiguous(), Ambiguous())), Ambiguous>::value), "");
assert(fmod(1.5,1) == .5);
}
void test_frexp()
{
int ip;
+ static_assert((std::is_same<decltype(frexp((float)0, &ip)), float>::value), "");
+ static_assert((std::is_same<decltype(frexp((bool)0, &ip)), double>::value), "");
+ static_assert((std::is_same<decltype(frexp((unsigned short)0, &ip)), double>::value), "");
+ static_assert((std::is_same<decltype(frexp((int)0, &ip)), double>::value), "");
+ static_assert((std::is_same<decltype(frexp((unsigned int)0, &ip)), double>::value), "");
+ static_assert((std::is_same<decltype(frexp((long)0, &ip)), double>::value), "");
+ static_assert((std::is_same<decltype(frexp((unsigned long)0, &ip)), double>::value), "");
+ static_assert((std::is_same<decltype(frexp((long long)0, &ip)), double>::value), "");
+ static_assert((std::is_same<decltype(frexp((unsigned long long)0, &ip)), double>::value), "");
static_assert((std::is_same<decltype(frexp((double)0, &ip)), double>::value), "");
+ static_assert((std::is_same<decltype(frexp((long double)0, &ip)), long double>::value), "");
static_assert((std::is_same<decltype(frexpf(0, &ip)), float>::value), "");
static_assert((std::is_same<decltype(frexpl(0, &ip)), long double>::value), "");
+ static_assert((std::is_same<decltype(frexp(Ambiguous(), &ip)), Ambiguous>::value), "");
assert(frexp(0, &ip) == 0);
}
void test_ldexp()
{
int ip = 1;
+ static_assert((std::is_same<decltype(ldexp((float)0, ip)), float>::value), "");
+ static_assert((std::is_same<decltype(ldexp((bool)0, ip)), double>::value), "");
+ static_assert((std::is_same<decltype(ldexp((unsigned short)0, ip)), double>::value), "");
+ static_assert((std::is_same<decltype(ldexp((int)0, ip)), double>::value), "");
+ static_assert((std::is_same<decltype(ldexp((unsigned int)0, ip)), double>::value), "");
+ static_assert((std::is_same<decltype(ldexp((long)0, ip)), double>::value), "");
+ static_assert((std::is_same<decltype(ldexp((unsigned long)0, ip)), double>::value), "");
+ static_assert((std::is_same<decltype(ldexp((long long)0, ip)), double>::value), "");
+ static_assert((std::is_same<decltype(ldexp((unsigned long long)0, ip)), double>::value), "");
static_assert((std::is_same<decltype(ldexp((double)0, ip)), double>::value), "");
+ static_assert((std::is_same<decltype(ldexp((long double)0, ip)), long double>::value), "");
static_assert((std::is_same<decltype(ldexpf(0, ip)), float>::value), "");
static_assert((std::is_same<decltype(ldexpl(0, ip)), long double>::value), "");
+ static_assert((std::is_same<decltype(ldexp(Ambiguous(), ip)), Ambiguous>::value), "");
assert(ldexp(1, ip) == 2);
}
void test_log()
{
+ static_assert((std::is_same<decltype(log((float)0)), float>::value), "");
+ static_assert((std::is_same<decltype(log((bool)0)), double>::value), "");
+ static_assert((std::is_same<decltype(log((unsigned short)0)), double>::value), "");
+ static_assert((std::is_same<decltype(log((int)0)), double>::value), "");
+ static_assert((std::is_same<decltype(log((unsigned int)0)), double>::value), "");
+ static_assert((std::is_same<decltype(log((long)0)), double>::value), "");
+ static_assert((std::is_same<decltype(log((unsigned long)0)), double>::value), "");
+ static_assert((std::is_same<decltype(log((long long)0)), double>::value), "");
+ static_assert((std::is_same<decltype(log((unsigned long long)0)), double>::value), "");
static_assert((std::is_same<decltype(log((double)0)), double>::value), "");
+ static_assert((std::is_same<decltype(log((long double)0)), long double>::value), "");
static_assert((std::is_same<decltype(logf(0)), float>::value), "");
static_assert((std::is_same<decltype(logl(0)), long double>::value), "");
+ static_assert((std::is_same<decltype(log(Ambiguous())), Ambiguous>::value), "");
assert(log(1) == 0);
}
void test_log10()
{
+ static_assert((std::is_same<decltype(log10((float)0)), float>::value), "");
+ static_assert((std::is_same<decltype(log10((bool)0)), double>::value), "");
+ static_assert((std::is_same<decltype(log10((unsigned short)0)), double>::value), "");
+ static_assert((std::is_same<decltype(log10((int)0)), double>::value), "");
+ static_assert((std::is_same<decltype(log10((unsigned int)0)), double>::value), "");
+ static_assert((std::is_same<decltype(log10((long)0)), double>::value), "");
+ static_assert((std::is_same<decltype(log10((unsigned long)0)), double>::value), "");
+ static_assert((std::is_same<decltype(log10((long long)0)), double>::value), "");
+ static_assert((std::is_same<decltype(log10((unsigned long long)0)), double>::value), "");
static_assert((std::is_same<decltype(log10((double)0)), double>::value), "");
+ static_assert((std::is_same<decltype(log10((long double)0)), long double>::value), "");
static_assert((std::is_same<decltype(log10f(0)), float>::value), "");
static_assert((std::is_same<decltype(log10l(0)), long double>::value), "");
+ static_assert((std::is_same<decltype(log10(Ambiguous())), Ambiguous>::value), "");
assert(log10(1) == 0);
}
void test_modf()
{
+ static_assert((std::is_same<decltype(modf((float)0, (float*)0)), float>::value), "");
static_assert((std::is_same<decltype(modf((double)0, (double*)0)), double>::value), "");
+ static_assert((std::is_same<decltype(modf((long double)0, (long double*)0)), long double>::value), "");
static_assert((std::is_same<decltype(modff(0, (float*)0)), float>::value), "");
static_assert((std::is_same<decltype(modfl(0, (long double*)0)), long double>::value), "");
+ static_assert((std::is_same<decltype(modf(Ambiguous(), (Ambiguous*)0)), Ambiguous>::value), "");
double i;
assert(modf(1., &i) == 0);
}
void test_pow()
{
+ static_assert((std::is_same<decltype(pow((float)0, (float)0)), float>::value), "");
+ static_assert((std::is_same<decltype(pow((bool)0, (float)0)), double>::value), "");
+ static_assert((std::is_same<decltype(pow((unsigned short)0, (double)0)), double>::value), "");
+ static_assert((std::is_same<decltype(pow((int)0, (long double)0)), long double>::value), "");
+ static_assert((std::is_same<decltype(pow((float)0, (unsigned int)0)), double>::value), "");
+ static_assert((std::is_same<decltype(pow((double)0, (long)0)), double>::value), "");
+ static_assert((std::is_same<decltype(pow((long double)0, (unsigned long)0)), long double>::value), "");
+ static_assert((std::is_same<decltype(pow((int)0, (long long)0)), double>::value), "");
+ static_assert((std::is_same<decltype(pow((int)0, (unsigned long long)0)), double>::value), "");
static_assert((std::is_same<decltype(pow((double)0, (double)0)), double>::value), "");
+ static_assert((std::is_same<decltype(pow((long double)0, (long double)0)), long double>::value), "");
+ static_assert((std::is_same<decltype(pow((float)0, (double)0)), double>::value), "");
+ static_assert((std::is_same<decltype(pow((float)0, (long double)0)), long double>::value), "");
+ static_assert((std::is_same<decltype(pow((double)0, (long double)0)), long double>::value), "");
static_assert((std::is_same<decltype(powf(0,0)), float>::value), "");
static_assert((std::is_same<decltype(powl(0,0)), long double>::value), "");
+ static_assert((std::is_same<decltype(pow((int)0, (int)0)), double>::value), "");
+// static_assert((std::is_same<decltype(pow(Value<int>(), (int)0)), double>::value), "");
+// static_assert((std::is_same<decltype(pow(Value<long double>(), (float)0)), long double>::value), "");
+// static_assert((std::is_same<decltype(pow((float) 0, Value<float>())), float>::value), "");
+ static_assert((std::is_same<decltype(pow(Ambiguous(), Ambiguous())), Ambiguous>::value), "");
assert(pow(1,1) == 1);
+// assert(pow(Value<int,1>(), Value<float,1>()) == 1);
+// assert(pow(1.0f, Value<double,1>()) == 1);
+// assert(pow(1.0, Value<int,1>()) == 1);
+// assert(pow(Value<long double,1>(), 1LL) == 1);
}
void test_sin()
{
+ static_assert((std::is_same<decltype(sin((float)0)), float>::value), "");
+ static_assert((std::is_same<decltype(sin((bool)0)), double>::value), "");
+ static_assert((std::is_same<decltype(sin((unsigned short)0)), double>::value), "");
+ static_assert((std::is_same<decltype(sin((int)0)), double>::value), "");
+ static_assert((std::is_same<decltype(sin((unsigned int)0)), double>::value), "");
+ static_assert((std::is_same<decltype(sin((long)0)), double>::value), "");
+ static_assert((std::is_same<decltype(sin((unsigned long)0)), double>::value), "");
+ static_assert((std::is_same<decltype(sin((long long)0)), double>::value), "");
+ static_assert((std::is_same<decltype(sin((unsigned long long)0)), double>::value), "");
static_assert((std::is_same<decltype(sin((double)0)), double>::value), "");
+ static_assert((std::is_same<decltype(sin((long double)0)), long double>::value), "");
static_assert((std::is_same<decltype(sinf(0)), float>::value), "");
static_assert((std::is_same<decltype(sinl(0)), long double>::value), "");
+ static_assert((std::is_same<decltype(sin(Ambiguous())), Ambiguous>::value), "");
assert(sin(0) == 0);
}
void test_sinh()
{
+ static_assert((std::is_same<decltype(sinh((float)0)), float>::value), "");
+ static_assert((std::is_same<decltype(sinh((bool)0)), double>::value), "");
+ static_assert((std::is_same<decltype(sinh((unsigned short)0)), double>::value), "");
+ static_assert((std::is_same<decltype(sinh((int)0)), double>::value), "");
+ static_assert((std::is_same<decltype(sinh((unsigned int)0)), double>::value), "");
+ static_assert((std::is_same<decltype(sinh((long)0)), double>::value), "");
+ static_assert((std::is_same<decltype(sinh((unsigned long)0)), double>::value), "");
+ static_assert((std::is_same<decltype(sinh((long long)0)), double>::value), "");
+ static_assert((std::is_same<decltype(sinh((unsigned long long)0)), double>::value), "");
static_assert((std::is_same<decltype(sinh((double)0)), double>::value), "");
+ static_assert((std::is_same<decltype(sinh((long double)0)), long double>::value), "");
static_assert((std::is_same<decltype(sinhf(0)), float>::value), "");
static_assert((std::is_same<decltype(sinhl(0)), long double>::value), "");
+ static_assert((std::is_same<decltype(sinh(Ambiguous())), Ambiguous>::value), "");
assert(sinh(0) == 0);
}
void test_sqrt()
{
+ static_assert((std::is_same<decltype(sqrt((float)0)), float>::value), "");
+ static_assert((std::is_same<decltype(sqrt((bool)0)), double>::value), "");
+ static_assert((std::is_same<decltype(sqrt((unsigned short)0)), double>::value), "");
+ static_assert((std::is_same<decltype(sqrt((int)0)), double>::value), "");
+ static_assert((std::is_same<decltype(sqrt((unsigned int)0)), double>::value), "");
+ static_assert((std::is_same<decltype(sqrt((long)0)), double>::value), "");
+ static_assert((std::is_same<decltype(sqrt((unsigned long)0)), double>::value), "");
+ static_assert((std::is_same<decltype(sqrt((long long)0)), double>::value), "");
+ static_assert((std::is_same<decltype(sqrt((unsigned long long)0)), double>::value), "");
static_assert((std::is_same<decltype(sqrt((double)0)), double>::value), "");
+ static_assert((std::is_same<decltype(sqrt((long double)0)), long double>::value), "");
static_assert((std::is_same<decltype(sqrtf(0)), float>::value), "");
static_assert((std::is_same<decltype(sqrtl(0)), long double>::value), "");
+ static_assert((std::is_same<decltype(sqrt(Ambiguous())), Ambiguous>::value), "");
assert(sqrt(4) == 2);
}
void test_tan()
{
+ static_assert((std::is_same<decltype(tan((float)0)), float>::value), "");
+ static_assert((std::is_same<decltype(tan((bool)0)), double>::value), "");
+ static_assert((std::is_same<decltype(tan((unsigned short)0)), double>::value), "");
+ static_assert((std::is_same<decltype(tan((int)0)), double>::value), "");
+ static_assert((std::is_same<decltype(tan((unsigned int)0)), double>::value), "");
+ static_assert((std::is_same<decltype(tan((long)0)), double>::value), "");
+ static_assert((std::is_same<decltype(tan((unsigned long)0)), double>::value), "");
+ static_assert((std::is_same<decltype(tan((long long)0)), double>::value), "");
+ static_assert((std::is_same<decltype(tan((unsigned long long)0)), double>::value), "");
static_assert((std::is_same<decltype(tan((double)0)), double>::value), "");
+ static_assert((std::is_same<decltype(tan((long double)0)), long double>::value), "");
static_assert((std::is_same<decltype(tanf(0)), float>::value), "");
static_assert((std::is_same<decltype(tanl(0)), long double>::value), "");
+ static_assert((std::is_same<decltype(tan(Ambiguous())), Ambiguous>::value), "");
assert(tan(0) == 0);
}
void test_tanh()
{
+ static_assert((std::is_same<decltype(tanh((float)0)), float>::value), "");
+ static_assert((std::is_same<decltype(tanh((bool)0)), double>::value), "");
+ static_assert((std::is_same<decltype(tanh((unsigned short)0)), double>::value), "");
+ static_assert((std::is_same<decltype(tanh((int)0)), double>::value), "");
+ static_assert((std::is_same<decltype(tanh((unsigned int)0)), double>::value), "");
+ static_assert((std::is_same<decltype(tanh((long)0)), double>::value), "");
+ static_assert((std::is_same<decltype(tanh((unsigned long)0)), double>::value), "");
+ static_assert((std::is_same<decltype(tanh((long long)0)), double>::value), "");
+ static_assert((std::is_same<decltype(tanh((unsigned long long)0)), double>::value), "");
static_assert((std::is_same<decltype(tanh((double)0)), double>::value), "");
+ static_assert((std::is_same<decltype(tanh((long double)0)), long double>::value), "");
static_assert((std::is_same<decltype(tanhf(0)), float>::value), "");
static_assert((std::is_same<decltype(tanhl(0)), long double>::value), "");
+ static_assert((std::is_same<decltype(tanh(Ambiguous())), Ambiguous>::value), "");
assert(tanh(0) == 0);
}
void test_signbit()
{
+#ifdef signbit
+#error signbit defined
+#endif
static_assert((std::is_same<decltype(signbit((float)0)), bool>::value), "");
static_assert((std::is_same<decltype(signbit((double)0)), bool>::value), "");
+ static_assert((std::is_same<decltype(signbit(0)), bool>::value), "");
static_assert((std::is_same<decltype(signbit((long double)0)), bool>::value), "");
+ static_assert((std::is_same<decltype(signbit(Ambiguous())), Ambiguous>::value), "");
assert(signbit(-1.0) == true);
}
void test_fpclassify()
{
+#ifdef fpclassify
+#error fpclassify defined
+#endif
static_assert((std::is_same<decltype(fpclassify((float)0)), int>::value), "");
static_assert((std::is_same<decltype(fpclassify((double)0)), int>::value), "");
+ static_assert((std::is_same<decltype(fpclassify(0)), int>::value), "");
static_assert((std::is_same<decltype(fpclassify((long double)0)), int>::value), "");
+ static_assert((std::is_same<decltype(fpclassify(Ambiguous())), Ambiguous>::value), "");
assert(fpclassify(-1.0) == FP_NORMAL);
}
void test_isfinite()
{
+#ifdef isfinite
+#error isfinite defined
+#endif
static_assert((std::is_same<decltype(isfinite((float)0)), bool>::value), "");
static_assert((std::is_same<decltype(isfinite((double)0)), bool>::value), "");
+ static_assert((std::is_same<decltype(isfinite(0)), bool>::value), "");
static_assert((std::is_same<decltype(isfinite((long double)0)), bool>::value), "");
+ static_assert((std::is_same<decltype(isfinite(Ambiguous())), Ambiguous>::value), "");
assert(isfinite(-1.0) == true);
}
-void test_isinf()
-{
- static_assert((std::is_same<decltype(isinf((float)0)), bool>::value), "");
- static_assert((std::is_same<decltype(isinf((double)0)), bool>::value), "");
- static_assert((std::is_same<decltype(isinf((long double)0)), bool>::value), "");
- assert(isinf(-1.0) == false);
-}
-
-void test_isnan()
-{
- static_assert((std::is_same<decltype(isnan((float)0)), bool>::value), "");
- static_assert((std::is_same<decltype(isnan((double)0)), bool>::value), "");
- static_assert((std::is_same<decltype(isnan((long double)0)), bool>::value), "");
- assert(isnan(-1.0) == false);
-}
-
void test_isnormal()
{
+#ifdef isnormal
+#error isnormal defined
+#endif
static_assert((std::is_same<decltype(isnormal((float)0)), bool>::value), "");
static_assert((std::is_same<decltype(isnormal((double)0)), bool>::value), "");
+ static_assert((std::is_same<decltype(isnormal(0)), bool>::value), "");
static_assert((std::is_same<decltype(isnormal((long double)0)), bool>::value), "");
+ static_assert((std::is_same<decltype(isnormal(Ambiguous())), Ambiguous>::value), "");
assert(isnormal(-1.0) == true);
}
void test_isgreater()
{
+#ifdef isgreater
+#error isgreater defined
+#endif
static_assert((std::is_same<decltype(isgreater((float)0, (float)0)), bool>::value), "");
static_assert((std::is_same<decltype(isgreater((float)0, (double)0)), bool>::value), "");
static_assert((std::is_same<decltype(isgreater((float)0, (long double)0)), bool>::value), "");
static_assert((std::is_same<decltype(isgreater((double)0, (float)0)), bool>::value), "");
static_assert((std::is_same<decltype(isgreater((double)0, (double)0)), bool>::value), "");
+ static_assert((std::is_same<decltype(isgreater(0, (double)0)), bool>::value), "");
static_assert((std::is_same<decltype(isgreater((double)0, (long double)0)), bool>::value), "");
static_assert((std::is_same<decltype(isgreater((long double)0, (float)0)), bool>::value), "");
static_assert((std::is_same<decltype(isgreater((long double)0, (double)0)), bool>::value), "");
static_assert((std::is_same<decltype(isgreater((long double)0, (long double)0)), bool>::value), "");
+ static_assert((std::is_same<decltype(isgreater(Ambiguous(), Ambiguous())), Ambiguous>::value), "");
assert(isgreater(-1.0, 0.F) == false);
}
void test_isgreaterequal()
{
+#ifdef isgreaterequal
+#error isgreaterequal defined
+#endif
static_assert((std::is_same<decltype(isgreaterequal((float)0, (float)0)), bool>::value), "");
static_assert((std::is_same<decltype(isgreaterequal((float)0, (double)0)), bool>::value), "");
static_assert((std::is_same<decltype(isgreaterequal((float)0, (long double)0)), bool>::value), "");
static_assert((std::is_same<decltype(isgreaterequal((double)0, (float)0)), bool>::value), "");
static_assert((std::is_same<decltype(isgreaterequal((double)0, (double)0)), bool>::value), "");
+ static_assert((std::is_same<decltype(isgreaterequal(0, (double)0)), bool>::value), "");
static_assert((std::is_same<decltype(isgreaterequal((double)0, (long double)0)), bool>::value), "");
static_assert((std::is_same<decltype(isgreaterequal((long double)0, (float)0)), bool>::value), "");
static_assert((std::is_same<decltype(isgreaterequal((long double)0, (double)0)), bool>::value), "");
static_assert((std::is_same<decltype(isgreaterequal((long double)0, (long double)0)), bool>::value), "");
+ static_assert((std::is_same<decltype(isgreaterequal(Ambiguous(), Ambiguous())), Ambiguous>::value), "");
assert(isgreaterequal(-1.0, 0.F) == false);
}
void test_isless()
{
+#ifdef isless
+#error isless defined
+#endif
static_assert((std::is_same<decltype(isless((float)0, (float)0)), bool>::value), "");
static_assert((std::is_same<decltype(isless((float)0, (double)0)), bool>::value), "");
static_assert((std::is_same<decltype(isless((float)0, (long double)0)), bool>::value), "");
static_assert((std::is_same<decltype(isless((double)0, (float)0)), bool>::value), "");
static_assert((std::is_same<decltype(isless((double)0, (double)0)), bool>::value), "");
+ static_assert((std::is_same<decltype(isless(0, (double)0)), bool>::value), "");
static_assert((std::is_same<decltype(isless((double)0, (long double)0)), bool>::value), "");
static_assert((std::is_same<decltype(isless((long double)0, (float)0)), bool>::value), "");
static_assert((std::is_same<decltype(isless((long double)0, (double)0)), bool>::value), "");
static_assert((std::is_same<decltype(isless((long double)0, (long double)0)), bool>::value), "");
+ static_assert((std::is_same<decltype(isless(Ambiguous(), Ambiguous())), Ambiguous>::value), "");
assert(isless(-1.0, 0.F) == true);
}
void test_islessequal()
{
+#ifdef islessequal
+#error islessequal defined
+#endif
static_assert((std::is_same<decltype(islessequal((float)0, (float)0)), bool>::value), "");
static_assert((std::is_same<decltype(islessequal((float)0, (double)0)), bool>::value), "");
static_assert((std::is_same<decltype(islessequal((float)0, (long double)0)), bool>::value), "");
static_assert((std::is_same<decltype(islessequal((double)0, (float)0)), bool>::value), "");
static_assert((std::is_same<decltype(islessequal((double)0, (double)0)), bool>::value), "");
+ static_assert((std::is_same<decltype(islessequal(0, (double)0)), bool>::value), "");
static_assert((std::is_same<decltype(islessequal((double)0, (long double)0)), bool>::value), "");
static_assert((std::is_same<decltype(islessequal((long double)0, (float)0)), bool>::value), "");
static_assert((std::is_same<decltype(islessequal((long double)0, (double)0)), bool>::value), "");
static_assert((std::is_same<decltype(islessequal((long double)0, (long double)0)), bool>::value), "");
+ static_assert((std::is_same<decltype(islessequal(Ambiguous(), Ambiguous())), Ambiguous>::value), "");
assert(islessequal(-1.0, 0.F) == true);
}
void test_islessgreater()
{
+#ifdef islessgreater
+#error islessgreater defined
+#endif
static_assert((std::is_same<decltype(islessgreater((float)0, (float)0)), bool>::value), "");
static_assert((std::is_same<decltype(islessgreater((float)0, (double)0)), bool>::value), "");
static_assert((std::is_same<decltype(islessgreater((float)0, (long double)0)), bool>::value), "");
static_assert((std::is_same<decltype(islessgreater((double)0, (float)0)), bool>::value), "");
static_assert((std::is_same<decltype(islessgreater((double)0, (double)0)), bool>::value), "");
+ static_assert((std::is_same<decltype(islessgreater(0, (double)0)), bool>::value), "");
static_assert((std::is_same<decltype(islessgreater((double)0, (long double)0)), bool>::value), "");
static_assert((std::is_same<decltype(islessgreater((long double)0, (float)0)), bool>::value), "");
static_assert((std::is_same<decltype(islessgreater((long double)0, (double)0)), bool>::value), "");
static_assert((std::is_same<decltype(islessgreater((long double)0, (long double)0)), bool>::value), "");
+ static_assert((std::is_same<decltype(islessgreater(Ambiguous(), Ambiguous())), Ambiguous>::value), "");
assert(islessgreater(-1.0, 0.F) == true);
}
void test_isunordered()
{
+#ifdef isunordered
+#error isunordered defined
+#endif
static_assert((std::is_same<decltype(isunordered((float)0, (float)0)), bool>::value), "");
static_assert((std::is_same<decltype(isunordered((float)0, (double)0)), bool>::value), "");
static_assert((std::is_same<decltype(isunordered((float)0, (long double)0)), bool>::value), "");
static_assert((std::is_same<decltype(isunordered((double)0, (float)0)), bool>::value), "");
static_assert((std::is_same<decltype(isunordered((double)0, (double)0)), bool>::value), "");
+ static_assert((std::is_same<decltype(isunordered(0, (double)0)), bool>::value), "");
static_assert((std::is_same<decltype(isunordered((double)0, (long double)0)), bool>::value), "");
static_assert((std::is_same<decltype(isunordered((long double)0, (float)0)), bool>::value), "");
static_assert((std::is_same<decltype(isunordered((long double)0, (double)0)), bool>::value), "");
static_assert((std::is_same<decltype(isunordered((long double)0, (long double)0)), bool>::value), "");
+ static_assert((std::is_same<decltype(isunordered(Ambiguous(), Ambiguous())), Ambiguous>::value), "");
assert(isunordered(-1.0, 0.F) == false);
}
void test_acosh()
{
+ static_assert((std::is_same<decltype(acosh((float)0)), float>::value), "");
+ static_assert((std::is_same<decltype(acosh((bool)0)), double>::value), "");
+ static_assert((std::is_same<decltype(acosh((unsigned short)0)), double>::value), "");
+ static_assert((std::is_same<decltype(acosh((int)0)), double>::value), "");
+ static_assert((std::is_same<decltype(acosh((unsigned int)0)), double>::value), "");
+ static_assert((std::is_same<decltype(acosh((long)0)), double>::value), "");
+ static_assert((std::is_same<decltype(acosh((unsigned long)0)), double>::value), "");
+ static_assert((std::is_same<decltype(acosh((long long)0)), double>::value), "");
+ static_assert((std::is_same<decltype(acosh((unsigned long long)0)), double>::value), "");
static_assert((std::is_same<decltype(acosh((double)0)), double>::value), "");
+ static_assert((std::is_same<decltype(acosh((long double)0)), long double>::value), "");
static_assert((std::is_same<decltype(acoshf(0)), float>::value), "");
static_assert((std::is_same<decltype(acoshl(0)), long double>::value), "");
+ static_assert((std::is_same<decltype(acosh(Ambiguous())), Ambiguous>::value), "");
assert(acosh(1) == 0);
}
void test_asinh()
{
+ static_assert((std::is_same<decltype(asinh((float)0)), float>::value), "");
+ static_assert((std::is_same<decltype(asinh((bool)0)), double>::value), "");
+ static_assert((std::is_same<decltype(asinh((unsigned short)0)), double>::value), "");
+ static_assert((std::is_same<decltype(asinh((int)0)), double>::value), "");
+ static_assert((std::is_same<decltype(asinh((unsigned int)0)), double>::value), "");
+ static_assert((std::is_same<decltype(asinh((long)0)), double>::value), "");
+ static_assert((std::is_same<decltype(asinh((unsigned long)0)), double>::value), "");
+ static_assert((std::is_same<decltype(asinh((long long)0)), double>::value), "");
+ static_assert((std::is_same<decltype(asinh((unsigned long long)0)), double>::value), "");
static_assert((std::is_same<decltype(asinh((double)0)), double>::value), "");
+ static_assert((std::is_same<decltype(asinh((long double)0)), long double>::value), "");
static_assert((std::is_same<decltype(asinhf(0)), float>::value), "");
static_assert((std::is_same<decltype(asinhl(0)), long double>::value), "");
+ static_assert((std::is_same<decltype(asinh(Ambiguous())), Ambiguous>::value), "");
assert(asinh(0) == 0);
}
void test_atanh()
{
+ static_assert((std::is_same<decltype(atanh((float)0)), float>::value), "");
+ static_assert((std::is_same<decltype(atanh((bool)0)), double>::value), "");
+ static_assert((std::is_same<decltype(atanh((unsigned short)0)), double>::value), "");
+ static_assert((std::is_same<decltype(atanh((int)0)), double>::value), "");
+ static_assert((std::is_same<decltype(atanh((unsigned int)0)), double>::value), "");
+ static_assert((std::is_same<decltype(atanh((long)0)), double>::value), "");
+ static_assert((std::is_same<decltype(atanh((unsigned long)0)), double>::value), "");
+ static_assert((std::is_same<decltype(atanh((long long)0)), double>::value), "");
+ static_assert((std::is_same<decltype(atanh((unsigned long long)0)), double>::value), "");
static_assert((std::is_same<decltype(atanh((double)0)), double>::value), "");
+ static_assert((std::is_same<decltype(atanh((long double)0)), long double>::value), "");
static_assert((std::is_same<decltype(atanhf(0)), float>::value), "");
static_assert((std::is_same<decltype(atanhl(0)), long double>::value), "");
+ static_assert((std::is_same<decltype(atanh(Ambiguous())), Ambiguous>::value), "");
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), "");
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);
}
void test_copysign()
{
+ static_assert((std::is_same<decltype(copysign((float)0, (float)0)), float>::value), "");
+ static_assert((std::is_same<decltype(copysign((bool)0, (float)0)), double>::value), "");
+ static_assert((std::is_same<decltype(copysign((unsigned short)0, (double)0)), double>::value), "");
+ static_assert((std::is_same<decltype(copysign((int)0, (long double)0)), long double>::value), "");
+ static_assert((std::is_same<decltype(copysign((float)0, (unsigned int)0)), double>::value), "");
+ static_assert((std::is_same<decltype(copysign((double)0, (long)0)), double>::value), "");
+ static_assert((std::is_same<decltype(copysign((long double)0, (unsigned long)0)), long double>::value), "");
+ static_assert((std::is_same<decltype(copysign((int)0, (long long)0)), double>::value), "");
+ static_assert((std::is_same<decltype(copysign((int)0, (unsigned long long)0)), double>::value), "");
static_assert((std::is_same<decltype(copysign((double)0, (double)0)), double>::value), "");
+ static_assert((std::is_same<decltype(copysign((long double)0, (long double)0)), long double>::value), "");
+ static_assert((std::is_same<decltype(copysign((float)0, (double)0)), double>::value), "");
+ static_assert((std::is_same<decltype(copysign((float)0, (long double)0)), long double>::value), "");
+ static_assert((std::is_same<decltype(copysign((double)0, (long double)0)), long double>::value), "");
static_assert((std::is_same<decltype(copysignf(0,0)), float>::value), "");
static_assert((std::is_same<decltype(copysignl(0,0)), long double>::value), "");
+ static_assert((std::is_same<decltype(copysign((int)0, (int)0)), double>::value), "");
+ static_assert((std::is_same<decltype(copysign(Ambiguous(), Ambiguous())), Ambiguous>::value), "");
assert(copysign(1,1) == 1);
}
void test_erf()
{
+ static_assert((std::is_same<decltype(erf((float)0)), float>::value), "");
+ static_assert((std::is_same<decltype(erf((bool)0)), double>::value), "");
+ static_assert((std::is_same<decltype(erf((unsigned short)0)), double>::value), "");
+ static_assert((std::is_same<decltype(erf((int)0)), double>::value), "");
+ static_assert((std::is_same<decltype(erf((unsigned int)0)), double>::value), "");
+ static_assert((std::is_same<decltype(erf((long)0)), double>::value), "");
+ static_assert((std::is_same<decltype(erf((unsigned long)0)), double>::value), "");
+ static_assert((std::is_same<decltype(erf((long long)0)), double>::value), "");
+ static_assert((std::is_same<decltype(erf((unsigned long long)0)), double>::value), "");
static_assert((std::is_same<decltype(erf((double)0)), double>::value), "");
+ static_assert((std::is_same<decltype(erf((long double)0)), long double>::value), "");
static_assert((std::is_same<decltype(erff(0)), float>::value), "");
static_assert((std::is_same<decltype(erfl(0)), long double>::value), "");
+ static_assert((std::is_same<decltype(erf(Ambiguous())), Ambiguous>::value), "");
assert(erf(0) == 0);
}
void test_erfc()
{
+ static_assert((std::is_same<decltype(erfc((float)0)), float>::value), "");
+ static_assert((std::is_same<decltype(erfc((bool)0)), double>::value), "");
+ static_assert((std::is_same<decltype(erfc((unsigned short)0)), double>::value), "");
+ static_assert((std::is_same<decltype(erfc((int)0)), double>::value), "");
+ static_assert((std::is_same<decltype(erfc((unsigned int)0)), double>::value), "");
+ static_assert((std::is_same<decltype(erfc((long)0)), double>::value), "");
+ static_assert((std::is_same<decltype(erfc((unsigned long)0)), double>::value), "");
+ static_assert((std::is_same<decltype(erfc((long long)0)), double>::value), "");
+ static_assert((std::is_same<decltype(erfc((unsigned long long)0)), double>::value), "");
static_assert((std::is_same<decltype(erfc((double)0)), double>::value), "");
+ static_assert((std::is_same<decltype(erfc((long double)0)), long double>::value), "");
static_assert((std::is_same<decltype(erfcf(0)), float>::value), "");
static_assert((std::is_same<decltype(erfcl(0)), long double>::value), "");
+ static_assert((std::is_same<decltype(erfc(Ambiguous())), Ambiguous>::value), "");
assert(erfc(0) == 1);
}
void test_exp2()
{
+ static_assert((std::is_same<decltype(exp2((float)0)), float>::value), "");
+ static_assert((std::is_same<decltype(exp2((bool)0)), double>::value), "");
+ static_assert((std::is_same<decltype(exp2((unsigned short)0)), double>::value), "");
+ static_assert((std::is_same<decltype(exp2((int)0)), double>::value), "");
+ static_assert((std::is_same<decltype(exp2((unsigned int)0)), double>::value), "");
+ static_assert((std::is_same<decltype(exp2((long)0)), double>::value), "");
+ static_assert((std::is_same<decltype(exp2((unsigned long)0)), double>::value), "");
+ static_assert((std::is_same<decltype(exp2((long long)0)), double>::value), "");
+ static_assert((std::is_same<decltype(exp2((unsigned long long)0)), double>::value), "");
static_assert((std::is_same<decltype(exp2((double)0)), double>::value), "");
+ static_assert((std::is_same<decltype(exp2((long double)0)), long double>::value), "");
static_assert((std::is_same<decltype(exp2f(0)), float>::value), "");
static_assert((std::is_same<decltype(exp2l(0)), long double>::value), "");
+ static_assert((std::is_same<decltype(exp2(Ambiguous())), Ambiguous>::value), "");
assert(exp2(1) == 2);
}
void test_expm1()
{
+ static_assert((std::is_same<decltype(expm1((float)0)), float>::value), "");
+ static_assert((std::is_same<decltype(expm1((bool)0)), double>::value), "");
+ static_assert((std::is_same<decltype(expm1((unsigned short)0)), double>::value), "");
+ static_assert((std::is_same<decltype(expm1((int)0)), double>::value), "");
+ static_assert((std::is_same<decltype(expm1((unsigned int)0)), double>::value), "");
+ static_assert((std::is_same<decltype(expm1((long)0)), double>::value), "");
+ static_assert((std::is_same<decltype(expm1((unsigned long)0)), double>::value), "");
+ static_assert((std::is_same<decltype(expm1((long long)0)), double>::value), "");
+ static_assert((std::is_same<decltype(expm1((unsigned long long)0)), double>::value), "");
static_assert((std::is_same<decltype(expm1((double)0)), double>::value), "");
+ static_assert((std::is_same<decltype(expm1((long double)0)), long double>::value), "");
static_assert((std::is_same<decltype(expm1f(0)), float>::value), "");
static_assert((std::is_same<decltype(expm1l(0)), long double>::value), "");
+ static_assert((std::is_same<decltype(expm1(Ambiguous())), Ambiguous>::value), "");
assert(expm1(0) == 0);
}
void test_fdim()
{
+ static_assert((std::is_same<decltype(fdim((float)0, (float)0)), float>::value), "");
+ static_assert((std::is_same<decltype(fdim((bool)0, (float)0)), double>::value), "");
+ static_assert((std::is_same<decltype(fdim((unsigned short)0, (double)0)), double>::value), "");
+ static_assert((std::is_same<decltype(fdim((int)0, (long double)0)), long double>::value), "");
+ static_assert((std::is_same<decltype(fdim((float)0, (unsigned int)0)), double>::value), "");
+ static_assert((std::is_same<decltype(fdim((double)0, (long)0)), double>::value), "");
+ static_assert((std::is_same<decltype(fdim((long double)0, (unsigned long)0)), long double>::value), "");
+ static_assert((std::is_same<decltype(fdim((int)0, (long long)0)), double>::value), "");
+ static_assert((std::is_same<decltype(fdim((int)0, (unsigned long long)0)), double>::value), "");
static_assert((std::is_same<decltype(fdim((double)0, (double)0)), double>::value), "");
+ static_assert((std::is_same<decltype(fdim((long double)0, (long double)0)), long double>::value), "");
+ static_assert((std::is_same<decltype(fdim((float)0, (double)0)), double>::value), "");
+ static_assert((std::is_same<decltype(fdim((float)0, (long double)0)), long double>::value), "");
+ static_assert((std::is_same<decltype(fdim((double)0, (long double)0)), long double>::value), "");
static_assert((std::is_same<decltype(fdimf(0,0)), float>::value), "");
static_assert((std::is_same<decltype(fdiml(0,0)), long double>::value), "");
+ static_assert((std::is_same<decltype(fdim((int)0, (int)0)), double>::value), "");
+ static_assert((std::is_same<decltype(fdim(Ambiguous(), Ambiguous())), Ambiguous>::value), "");
assert(fdim(1,0) == 1);
}
void test_fma()
{
+ static_assert((std::is_same<decltype(fma((bool)0, (float)0, (float)0)), double>::value), "");
+ static_assert((std::is_same<decltype(fma((char)0, (float)0, (float)0)), double>::value), "");
+ static_assert((std::is_same<decltype(fma((unsigned)0, (float)0, (float)0)), double>::value), "");
+ static_assert((std::is_same<decltype(fma((float)0, (int)0, (float)0)), double>::value), "");
+ static_assert((std::is_same<decltype(fma((float)0, (long)0, (float)0)), double>::value), "");
+ static_assert((std::is_same<decltype(fma((float)0, (float)0, (unsigned long long)0)), double>::value), "");
+ static_assert((std::is_same<decltype(fma((float)0, (float)0, (double)0)), double>::value), "");
+ static_assert((std::is_same<decltype(fma((float)0, (float)0, (long double)0)), long double>::value), "");
+ static_assert((std::is_same<decltype(fma((float)0, (float)0, (float)0)), float>::value), "");
+
+ static_assert((std::is_same<decltype(fma((bool)0, (double)0, (double)0)), double>::value), "");
+ static_assert((std::is_same<decltype(fma((char)0, (double)0, (double)0)), double>::value), "");
+ static_assert((std::is_same<decltype(fma((unsigned)0, (double)0, (double)0)), double>::value), "");
+ static_assert((std::is_same<decltype(fma((double)0, (int)0, (double)0)), double>::value), "");
+ static_assert((std::is_same<decltype(fma((double)0, (long)0, (double)0)), double>::value), "");
+ static_assert((std::is_same<decltype(fma((double)0, (double)0, (unsigned long long)0)), double>::value), "");
+ static_assert((std::is_same<decltype(fma((double)0, (double)0, (float)0)), double>::value), "");
+ static_assert((std::is_same<decltype(fma((double)0, (double)0, (long double)0)), long double>::value), "");
static_assert((std::is_same<decltype(fma((double)0, (double)0, (double)0)), double>::value), "");
+
+ static_assert((std::is_same<decltype(fma((bool)0, (long double)0, (long double)0)), long double>::value), "");
+ static_assert((std::is_same<decltype(fma((char)0, (long double)0, (long double)0)), long double>::value), "");
+ static_assert((std::is_same<decltype(fma((unsigned)0, (long double)0, (long double)0)), long double>::value), "");
+ static_assert((std::is_same<decltype(fma((long double)0, (int)0, (long double)0)), long double>::value), "");
+ static_assert((std::is_same<decltype(fma((long double)0, (long)0, (long double)0)), long double>::value), "");
+ static_assert((std::is_same<decltype(fma((long double)0, (long double)0, (unsigned long long)0)), long double>::value), "");
+ static_assert((std::is_same<decltype(fma((long double)0, (long double)0, (float)0)), long double>::value), "");
+ static_assert((std::is_same<decltype(fma((double)0, (long double)0, (long double)0)), long double>::value), "");
+ static_assert((std::is_same<decltype(fma((long double)0, (long double)0, (long double)0)), long double>::value), "");
+
static_assert((std::is_same<decltype(fmaf(0,0,0)), float>::value), "");
static_assert((std::is_same<decltype(fmal(0,0,0)), long double>::value), "");
+ static_assert((std::is_same<decltype(fma(Ambiguous(), Ambiguous(), Ambiguous())), Ambiguous>::value), "");
assert(fma(1,1,1) == 2);
}
void test_fmax()
{
+ static_assert((std::is_same<decltype(fmax((float)0, (float)0)), float>::value), "");
+ static_assert((std::is_same<decltype(fmax((bool)0, (float)0)), double>::value), "");
+ static_assert((std::is_same<decltype(fmax((unsigned short)0, (double)0)), double>::value), "");
+ static_assert((std::is_same<decltype(fmax((int)0, (long double)0)), long double>::value), "");
+ static_assert((std::is_same<decltype(fmax((float)0, (unsigned int)0)), double>::value), "");
+ static_assert((std::is_same<decltype(fmax((double)0, (long)0)), double>::value), "");
+ static_assert((std::is_same<decltype(fmax((long double)0, (unsigned long)0)), long double>::value), "");
+ static_assert((std::is_same<decltype(fmax((int)0, (long long)0)), double>::value), "");
+ static_assert((std::is_same<decltype(fmax((int)0, (unsigned long long)0)), double>::value), "");
static_assert((std::is_same<decltype(fmax((double)0, (double)0)), double>::value), "");
+ static_assert((std::is_same<decltype(fmax((long double)0, (long double)0)), long double>::value), "");
+ static_assert((std::is_same<decltype(fmax((float)0, (double)0)), double>::value), "");
+ static_assert((std::is_same<decltype(fmax((float)0, (long double)0)), long double>::value), "");
+ static_assert((std::is_same<decltype(fmax((double)0, (long double)0)), long double>::value), "");
static_assert((std::is_same<decltype(fmaxf(0,0)), float>::value), "");
static_assert((std::is_same<decltype(fmaxl(0,0)), long double>::value), "");
+ static_assert((std::is_same<decltype(fmax((int)0, (int)0)), double>::value), "");
+ static_assert((std::is_same<decltype(fmax(Ambiguous(), Ambiguous())), Ambiguous>::value), "");
assert(fmax(1,0) == 1);
}
void test_fmin()
{
+ static_assert((std::is_same<decltype(fmin((float)0, (float)0)), float>::value), "");
+ static_assert((std::is_same<decltype(fmin((bool)0, (float)0)), double>::value), "");
+ static_assert((std::is_same<decltype(fmin((unsigned short)0, (double)0)), double>::value), "");
+ static_assert((std::is_same<decltype(fmin((int)0, (long double)0)), long double>::value), "");
+ static_assert((std::is_same<decltype(fmin((float)0, (unsigned int)0)), double>::value), "");
+ static_assert((std::is_same<decltype(fmin((double)0, (long)0)), double>::value), "");
+ static_assert((std::is_same<decltype(fmin((long double)0, (unsigned long)0)), long double>::value), "");
+ static_assert((std::is_same<decltype(fmin((int)0, (long long)0)), double>::value), "");
+ static_assert((std::is_same<decltype(fmin((int)0, (unsigned long long)0)), double>::value), "");
static_assert((std::is_same<decltype(fmin((double)0, (double)0)), double>::value), "");
+ static_assert((std::is_same<decltype(fmin((long double)0, (long double)0)), long double>::value), "");
+ static_assert((std::is_same<decltype(fmin((float)0, (double)0)), double>::value), "");
+ static_assert((std::is_same<decltype(fmin((float)0, (long double)0)), long double>::value), "");
+ static_assert((std::is_same<decltype(fmin((double)0, (long double)0)), long double>::value), "");
static_assert((std::is_same<decltype(fminf(0,0)), float>::value), "");
static_assert((std::is_same<decltype(fminl(0,0)), long double>::value), "");
+ static_assert((std::is_same<decltype(fmin((int)0, (int)0)), double>::value), "");
+ static_assert((std::is_same<decltype(fmin(Ambiguous(), Ambiguous())), Ambiguous>::value), "");
assert(fmin(1,0) == 0);
}
void test_hypot()
{
+ static_assert((std::is_same<decltype(hypot((float)0, (float)0)), float>::value), "");
+ static_assert((std::is_same<decltype(hypot((bool)0, (float)0)), double>::value), "");
+ static_assert((std::is_same<decltype(hypot((unsigned short)0, (double)0)), double>::value), "");
+ static_assert((std::is_same<decltype(hypot((int)0, (long double)0)), long double>::value), "");
+ static_assert((std::is_same<decltype(hypot((float)0, (unsigned int)0)), double>::value), "");
+ static_assert((std::is_same<decltype(hypot((double)0, (long)0)), double>::value), "");
+ static_assert((std::is_same<decltype(hypot((long double)0, (unsigned long)0)), long double>::value), "");
+ static_assert((std::is_same<decltype(hypot((int)0, (long long)0)), double>::value), "");
+ static_assert((std::is_same<decltype(hypot((int)0, (unsigned long long)0)), double>::value), "");
static_assert((std::is_same<decltype(hypot((double)0, (double)0)), double>::value), "");
+ static_assert((std::is_same<decltype(hypot((long double)0, (long double)0)), long double>::value), "");
+ static_assert((std::is_same<decltype(hypot((float)0, (double)0)), double>::value), "");
+ static_assert((std::is_same<decltype(hypot((float)0, (long double)0)), long double>::value), "");
+ static_assert((std::is_same<decltype(hypot((double)0, (long double)0)), long double>::value), "");
static_assert((std::is_same<decltype(hypotf(0,0)), float>::value), "");
static_assert((std::is_same<decltype(hypotl(0,0)), long double>::value), "");
+ static_assert((std::is_same<decltype(hypot((int)0, (int)0)), double>::value), "");
+ static_assert((std::is_same<decltype(hypot(Ambiguous(), Ambiguous())), Ambiguous>::value), "");
assert(hypot(3,4) == 5);
}
void test_ilogb()
{
+ static_assert((std::is_same<decltype(ilogb((float)0)), int>::value), "");
+ static_assert((std::is_same<decltype(ilogb((bool)0)), int>::value), "");
+ static_assert((std::is_same<decltype(ilogb((unsigned short)0)), int>::value), "");
+ static_assert((std::is_same<decltype(ilogb((int)0)), int>::value), "");
+ static_assert((std::is_same<decltype(ilogb((unsigned int)0)), int>::value), "");
+ static_assert((std::is_same<decltype(ilogb((long)0)), int>::value), "");
+ static_assert((std::is_same<decltype(ilogb((unsigned long)0)), int>::value), "");
+ static_assert((std::is_same<decltype(ilogb((long long)0)), int>::value), "");
+ static_assert((std::is_same<decltype(ilogb((unsigned long long)0)), int>::value), "");
static_assert((std::is_same<decltype(ilogb((double)0)), int>::value), "");
+ static_assert((std::is_same<decltype(ilogb((long double)0)), int>::value), "");
static_assert((std::is_same<decltype(ilogbf(0)), int>::value), "");
static_assert((std::is_same<decltype(ilogbl(0)), int>::value), "");
+ static_assert((std::is_same<decltype(ilogb(Ambiguous())), Ambiguous>::value), "");
assert(ilogb(1) == 0);
}
void test_lgamma()
{
+ static_assert((std::is_same<decltype(lgamma((float)0)), float>::value), "");
+ static_assert((std::is_same<decltype(lgamma((bool)0)), double>::value), "");
+ static_assert((std::is_same<decltype(lgamma((unsigned short)0)), double>::value), "");
+ static_assert((std::is_same<decltype(lgamma((int)0)), double>::value), "");
+ static_assert((std::is_same<decltype(lgamma((unsigned int)0)), double>::value), "");
+ static_assert((std::is_same<decltype(lgamma((long)0)), double>::value), "");
+ static_assert((std::is_same<decltype(lgamma((unsigned long)0)), double>::value), "");
+ static_assert((std::is_same<decltype(lgamma((long long)0)), double>::value), "");
+ static_assert((std::is_same<decltype(lgamma((unsigned long long)0)), double>::value), "");
static_assert((std::is_same<decltype(lgamma((double)0)), double>::value), "");
+ static_assert((std::is_same<decltype(lgamma((long double)0)), long double>::value), "");
static_assert((std::is_same<decltype(lgammaf(0)), float>::value), "");
static_assert((std::is_same<decltype(lgammal(0)), long double>::value), "");
+ static_assert((std::is_same<decltype(lgamma(Ambiguous())), Ambiguous>::value), "");
assert(lgamma(1) == 0);
}
void test_llrint()
{
+ static_assert((std::is_same<decltype(llrint((float)0)), long long>::value), "");
+ static_assert((std::is_same<decltype(llrint((bool)0)), long long>::value), "");
+ static_assert((std::is_same<decltype(llrint((unsigned short)0)), long long>::value), "");
+ static_assert((std::is_same<decltype(llrint((int)0)), long long>::value), "");
+ static_assert((std::is_same<decltype(llrint((unsigned int)0)), long long>::value), "");
+ static_assert((std::is_same<decltype(llrint((long)0)), long long>::value), "");
+ static_assert((std::is_same<decltype(llrint((unsigned long)0)), long long>::value), "");
+ static_assert((std::is_same<decltype(llrint((long long)0)), long long>::value), "");
+ static_assert((std::is_same<decltype(llrint((unsigned long long)0)), long long>::value), "");
static_assert((std::is_same<decltype(llrint((double)0)), long long>::value), "");
+ static_assert((std::is_same<decltype(llrint((long double)0)), long long>::value), "");
static_assert((std::is_same<decltype(llrintf(0)), long long>::value), "");
static_assert((std::is_same<decltype(llrintl(0)), long long>::value), "");
+ static_assert((std::is_same<decltype(llrint(Ambiguous())), Ambiguous>::value), "");
assert(llrint(1) == 1LL);
}
void test_llround()
{
+ static_assert((std::is_same<decltype(llround((float)0)), long long>::value), "");
+ static_assert((std::is_same<decltype(llround((bool)0)), long long>::value), "");
+ static_assert((std::is_same<decltype(llround((unsigned short)0)), long long>::value), "");
+ static_assert((std::is_same<decltype(llround((int)0)), long long>::value), "");
+ static_assert((std::is_same<decltype(llround((unsigned int)0)), long long>::value), "");
+ static_assert((std::is_same<decltype(llround((long)0)), long long>::value), "");
+ static_assert((std::is_same<decltype(llround((unsigned long)0)), long long>::value), "");
+ static_assert((std::is_same<decltype(llround((long long)0)), long long>::value), "");
+ static_assert((std::is_same<decltype(llround((unsigned long long)0)), long long>::value), "");
static_assert((std::is_same<decltype(llround((double)0)), long long>::value), "");
+ static_assert((std::is_same<decltype(llround((long double)0)), long long>::value), "");
static_assert((std::is_same<decltype(llroundf(0)), long long>::value), "");
static_assert((std::is_same<decltype(llroundl(0)), long long>::value), "");
+ static_assert((std::is_same<decltype(llround(Ambiguous())), Ambiguous>::value), "");
assert(llround(1) == 1LL);
}
void test_log1p()
{
+ static_assert((std::is_same<decltype(log1p((float)0)), float>::value), "");
+ static_assert((std::is_same<decltype(log1p((bool)0)), double>::value), "");
+ static_assert((std::is_same<decltype(log1p((unsigned short)0)), double>::value), "");
+ static_assert((std::is_same<decltype(log1p((int)0)), double>::value), "");
+ static_assert((std::is_same<decltype(log1p((unsigned int)0)), double>::value), "");
+ static_assert((std::is_same<decltype(log1p((long)0)), double>::value), "");
+ static_assert((std::is_same<decltype(log1p((unsigned long)0)), double>::value), "");
+ static_assert((std::is_same<decltype(log1p((long long)0)), double>::value), "");
+ static_assert((std::is_same<decltype(log1p((unsigned long long)0)), double>::value), "");
static_assert((std::is_same<decltype(log1p((double)0)), double>::value), "");
+ static_assert((std::is_same<decltype(log1p((long double)0)), long double>::value), "");
static_assert((std::is_same<decltype(log1pf(0)), float>::value), "");
static_assert((std::is_same<decltype(log1pl(0)), long double>::value), "");
+ static_assert((std::is_same<decltype(log1p(Ambiguous())), Ambiguous>::value), "");
assert(log1p(0) == 0);
}
void test_log2()
{
+ static_assert((std::is_same<decltype(log2((float)0)), float>::value), "");
+ static_assert((std::is_same<decltype(log2((bool)0)), double>::value), "");
+ static_assert((std::is_same<decltype(log2((unsigned short)0)), double>::value), "");
+ static_assert((std::is_same<decltype(log2((int)0)), double>::value), "");
+ static_assert((std::is_same<decltype(log2((unsigned int)0)), double>::value), "");
+ static_assert((std::is_same<decltype(log2((long)0)), double>::value), "");
+ static_assert((std::is_same<decltype(log2((unsigned long)0)), double>::value), "");
+ static_assert((std::is_same<decltype(log2((long long)0)), double>::value), "");
+ static_assert((std::is_same<decltype(log2((unsigned long long)0)), double>::value), "");
static_assert((std::is_same<decltype(log2((double)0)), double>::value), "");
+ static_assert((std::is_same<decltype(log2((long double)0)), long double>::value), "");
static_assert((std::is_same<decltype(log2f(0)), float>::value), "");
static_assert((std::is_same<decltype(log2l(0)), long double>::value), "");
+ static_assert((std::is_same<decltype(log2(Ambiguous())), Ambiguous>::value), "");
assert(log2(1) == 0);
}
void test_logb()
{
+ static_assert((std::is_same<decltype(logb((float)0)), float>::value), "");
+ static_assert((std::is_same<decltype(logb((bool)0)), double>::value), "");
+ static_assert((std::is_same<decltype(logb((unsigned short)0)), double>::value), "");
+ static_assert((std::is_same<decltype(logb((int)0)), double>::value), "");
+ static_assert((std::is_same<decltype(logb((unsigned int)0)), double>::value), "");
+ static_assert((std::is_same<decltype(logb((long)0)), double>::value), "");
+ static_assert((std::is_same<decltype(logb((unsigned long)0)), double>::value), "");
+ static_assert((std::is_same<decltype(logb((long long)0)), double>::value), "");
+ static_assert((std::is_same<decltype(logb((unsigned long long)0)), double>::value), "");
static_assert((std::is_same<decltype(logb((double)0)), double>::value), "");
+ static_assert((std::is_same<decltype(logb((long double)0)), long double>::value), "");
static_assert((std::is_same<decltype(logbf(0)), float>::value), "");
static_assert((std::is_same<decltype(logbl(0)), long double>::value), "");
+ static_assert((std::is_same<decltype(logb(Ambiguous())), Ambiguous>::value), "");
assert(logb(1) == 0);
}
void test_lrint()
{
+ static_assert((std::is_same<decltype(lrint((float)0)), long>::value), "");
+ static_assert((std::is_same<decltype(lrint((bool)0)), long>::value), "");
+ static_assert((std::is_same<decltype(lrint((unsigned short)0)), long>::value), "");
+ static_assert((std::is_same<decltype(lrint((int)0)), long>::value), "");
+ static_assert((std::is_same<decltype(lrint((unsigned int)0)), long>::value), "");
+ static_assert((std::is_same<decltype(lrint((long)0)), long>::value), "");
+ static_assert((std::is_same<decltype(lrint((unsigned long)0)), long>::value), "");
+ static_assert((std::is_same<decltype(lrint((long long)0)), long>::value), "");
+ static_assert((std::is_same<decltype(lrint((unsigned long long)0)), long>::value), "");
static_assert((std::is_same<decltype(lrint((double)0)), long>::value), "");
+ static_assert((std::is_same<decltype(lrint((long double)0)), long>::value), "");
static_assert((std::is_same<decltype(lrintf(0)), long>::value), "");
static_assert((std::is_same<decltype(lrintl(0)), long>::value), "");
+ static_assert((std::is_same<decltype(lrint(Ambiguous())), Ambiguous>::value), "");
assert(lrint(1) == 1L);
}
void test_lround()
{
+ static_assert((std::is_same<decltype(lround((float)0)), long>::value), "");
+ static_assert((std::is_same<decltype(lround((bool)0)), long>::value), "");
+ static_assert((std::is_same<decltype(lround((unsigned short)0)), long>::value), "");
+ static_assert((std::is_same<decltype(lround((int)0)), long>::value), "");
+ static_assert((std::is_same<decltype(lround((unsigned int)0)), long>::value), "");
+ static_assert((std::is_same<decltype(lround((long)0)), long>::value), "");
+ static_assert((std::is_same<decltype(lround((unsigned long)0)), long>::value), "");
+ static_assert((std::is_same<decltype(lround((long long)0)), long>::value), "");
+ static_assert((std::is_same<decltype(lround((unsigned long long)0)), long>::value), "");
static_assert((std::is_same<decltype(lround((double)0)), long>::value), "");
+ static_assert((std::is_same<decltype(lround((long double)0)), long>::value), "");
static_assert((std::is_same<decltype(lroundf(0)), long>::value), "");
static_assert((std::is_same<decltype(lroundl(0)), long>::value), "");
+ static_assert((std::is_same<decltype(lround(Ambiguous())), Ambiguous>::value), "");
assert(lround(1) == 1L);
}
@@ -521,96 +1192,229 @@ void test_nan()
void test_nearbyint()
{
+ static_assert((std::is_same<decltype(nearbyint((float)0)), float>::value), "");
+ static_assert((std::is_same<decltype(nearbyint((bool)0)), double>::value), "");
+ static_assert((std::is_same<decltype(nearbyint((unsigned short)0)), double>::value), "");
+ static_assert((std::is_same<decltype(nearbyint((int)0)), double>::value), "");
+ static_assert((std::is_same<decltype(nearbyint((unsigned int)0)), double>::value), "");
+ static_assert((std::is_same<decltype(nearbyint((long)0)), double>::value), "");
+ static_assert((std::is_same<decltype(nearbyint((unsigned long)0)), double>::value), "");
+ static_assert((std::is_same<decltype(nearbyint((long long)0)), double>::value), "");
+ static_assert((std::is_same<decltype(nearbyint((unsigned long long)0)), double>::value), "");
static_assert((std::is_same<decltype(nearbyint((double)0)), double>::value), "");
+ static_assert((std::is_same<decltype(nearbyint((long double)0)), long double>::value), "");
static_assert((std::is_same<decltype(nearbyintf(0)), float>::value), "");
static_assert((std::is_same<decltype(nearbyintl(0)), long double>::value), "");
+ static_assert((std::is_same<decltype(nearbyint(Ambiguous())), Ambiguous>::value), "");
assert(nearbyint(1) == 1);
}
void test_nextafter()
{
+ static_assert((std::is_same<decltype(nextafter((float)0, (float)0)), float>::value), "");
+ static_assert((std::is_same<decltype(nextafter((bool)0, (float)0)), double>::value), "");
+ static_assert((std::is_same<decltype(nextafter((unsigned short)0, (double)0)), double>::value), "");
+ static_assert((std::is_same<decltype(nextafter((int)0, (long double)0)), long double>::value), "");
+ static_assert((std::is_same<decltype(nextafter((float)0, (unsigned int)0)), double>::value), "");
+ static_assert((std::is_same<decltype(nextafter((double)0, (long)0)), double>::value), "");
+ static_assert((std::is_same<decltype(nextafter((long double)0, (unsigned long)0)), long double>::value), "");
+ static_assert((std::is_same<decltype(nextafter((int)0, (long long)0)), double>::value), "");
+ static_assert((std::is_same<decltype(nextafter((int)0, (unsigned long long)0)), double>::value), "");
static_assert((std::is_same<decltype(nextafter((double)0, (double)0)), double>::value), "");
+ static_assert((std::is_same<decltype(nextafter((long double)0, (long double)0)), long double>::value), "");
+ static_assert((std::is_same<decltype(nextafter((float)0, (double)0)), double>::value), "");
+ static_assert((std::is_same<decltype(nextafter((float)0, (long double)0)), long double>::value), "");
+ static_assert((std::is_same<decltype(nextafter((double)0, (long double)0)), long double>::value), "");
static_assert((std::is_same<decltype(nextafterf(0,0)), float>::value), "");
static_assert((std::is_same<decltype(nextafterl(0,0)), long double>::value), "");
+ static_assert((std::is_same<decltype(nextafter((int)0, (int)0)), double>::value), "");
+ static_assert((std::is_same<decltype(nextafter(Ambiguous(), Ambiguous())), Ambiguous>::value), "");
assert(nextafter(0,1) == hexfloat<double>(0x1, 0, -1074));
}
void test_nexttoward()
{
+ static_assert((std::is_same<decltype(nexttoward((float)0, (long double)0)), float>::value), "");
+ static_assert((std::is_same<decltype(nexttoward((bool)0, (long double)0)), double>::value), "");
+ static_assert((std::is_same<decltype(nexttoward((unsigned short)0, (long double)0)), double>::value), "");
+ static_assert((std::is_same<decltype(nexttoward((int)0, (long double)0)), double>::value), "");
+ static_assert((std::is_same<decltype(nexttoward((unsigned int)0, (long double)0)), double>::value), "");
+ static_assert((std::is_same<decltype(nexttoward((long)0, (long double)0)), double>::value), "");
+ static_assert((std::is_same<decltype(nexttoward((unsigned long)0, (long double)0)), double>::value), "");
+ static_assert((std::is_same<decltype(nexttoward((long long)0, (long double)0)), double>::value), "");
+ static_assert((std::is_same<decltype(nexttoward((unsigned long long)0, (long double)0)), double>::value), "");
static_assert((std::is_same<decltype(nexttoward((double)0, (long double)0)), double>::value), "");
+ static_assert((std::is_same<decltype(nexttoward((long double)0, (long double)0)), long double>::value), "");
static_assert((std::is_same<decltype(nexttowardf(0, (long double)0)), float>::value), "");
static_assert((std::is_same<decltype(nexttowardl(0, (long double)0)), long double>::value), "");
+ static_assert((std::is_same<decltype(nexttoward(Ambiguous(), Ambiguous())), Ambiguous>::value), "");
assert(nexttoward(0, 1) == hexfloat<double>(0x1, 0, -1074));
}
void test_remainder()
{
+ static_assert((std::is_same<decltype(remainder((float)0, (float)0)), float>::value), "");
+ static_assert((std::is_same<decltype(remainder((bool)0, (float)0)), double>::value), "");
+ static_assert((std::is_same<decltype(remainder((unsigned short)0, (double)0)), double>::value), "");
+ static_assert((std::is_same<decltype(remainder((int)0, (long double)0)), long double>::value), "");
+ static_assert((std::is_same<decltype(remainder((float)0, (unsigned int)0)), double>::value), "");
+ static_assert((std::is_same<decltype(remainder((double)0, (long)0)), double>::value), "");
+ static_assert((std::is_same<decltype(remainder((long double)0, (unsigned long)0)), long double>::value), "");
+ static_assert((std::is_same<decltype(remainder((int)0, (long long)0)), double>::value), "");
+ static_assert((std::is_same<decltype(remainder((int)0, (unsigned long long)0)), double>::value), "");
static_assert((std::is_same<decltype(remainder((double)0, (double)0)), double>::value), "");
+ static_assert((std::is_same<decltype(remainder((long double)0, (long double)0)), long double>::value), "");
+ static_assert((std::is_same<decltype(remainder((float)0, (double)0)), double>::value), "");
+ static_assert((std::is_same<decltype(remainder((float)0, (long double)0)), long double>::value), "");
+ static_assert((std::is_same<decltype(remainder((double)0, (long double)0)), long double>::value), "");
static_assert((std::is_same<decltype(remainderf(0,0)), float>::value), "");
static_assert((std::is_same<decltype(remainderl(0,0)), long double>::value), "");
static_assert((std::is_same<decltype(remainder((int)0, (int)0)), double>::value), "");
+ static_assert((std::is_same<decltype(remainder(Ambiguous(), Ambiguous())), Ambiguous>::value), "");
assert(remainder(0.5,1) == 0.5);
}
void test_remquo()
{
int ip;
+ static_assert((std::is_same<decltype(remquo((float)0, (float)0, &ip)), float>::value), "");
+ static_assert((std::is_same<decltype(remquo((bool)0, (float)0, &ip)), double>::value), "");
+ static_assert((std::is_same<decltype(remquo((unsigned short)0, (double)0, &ip)), double>::value), "");
+ static_assert((std::is_same<decltype(remquo((int)0, (long double)0, &ip)), long double>::value), "");
+ static_assert((std::is_same<decltype(remquo((float)0, (unsigned int)0, &ip)), double>::value), "");
+ static_assert((std::is_same<decltype(remquo((double)0, (long)0, &ip)), double>::value), "");
+ static_assert((std::is_same<decltype(remquo((long double)0, (unsigned long)0, &ip)), long double>::value), "");
+ static_assert((std::is_same<decltype(remquo((int)0, (long long)0, &ip)), double>::value), "");
+ static_assert((std::is_same<decltype(remquo((int)0, (unsigned long long)0, &ip)), double>::value), "");
static_assert((std::is_same<decltype(remquo((double)0, (double)0, &ip)), double>::value), "");
+ static_assert((std::is_same<decltype(remquo((long double)0, (long double)0, &ip)), long double>::value), "");
+ static_assert((std::is_same<decltype(remquo((float)0, (double)0, &ip)), double>::value), "");
+ static_assert((std::is_same<decltype(remquo((float)0, (long double)0, &ip)), long double>::value), "");
+ static_assert((std::is_same<decltype(remquo((double)0, (long double)0, &ip)), long double>::value), "");
static_assert((std::is_same<decltype(remquof(0,0, &ip)), float>::value), "");
static_assert((std::is_same<decltype(remquol(0,0, &ip)), long double>::value), "");
+ static_assert((std::is_same<decltype(remquo((int)0, (int)0, &ip)), double>::value), "");
+ static_assert((std::is_same<decltype(remquo(Ambiguous(), Ambiguous(), &ip)), Ambiguous>::value), "");
assert(remquo(0.5,1, &ip) == 0.5);
}
void test_rint()
{
+ static_assert((std::is_same<decltype(rint((float)0)), float>::value), "");
+ static_assert((std::is_same<decltype(rint((bool)0)), double>::value), "");
+ static_assert((std::is_same<decltype(rint((unsigned short)0)), double>::value), "");
+ static_assert((std::is_same<decltype(rint((int)0)), double>::value), "");
+ static_assert((std::is_same<decltype(rint((unsigned int)0)), double>::value), "");
+ static_assert((std::is_same<decltype(rint((long)0)), double>::value), "");
+ static_assert((std::is_same<decltype(rint((unsigned long)0)), double>::value), "");
+ static_assert((std::is_same<decltype(rint((long long)0)), double>::value), "");
+ static_assert((std::is_same<decltype(rint((unsigned long long)0)), double>::value), "");
static_assert((std::is_same<decltype(rint((double)0)), double>::value), "");
+ static_assert((std::is_same<decltype(rint((long double)0)), long double>::value), "");
static_assert((std::is_same<decltype(rintf(0)), float>::value), "");
static_assert((std::is_same<decltype(rintl(0)), long double>::value), "");
+ static_assert((std::is_same<decltype(rint(Ambiguous())), Ambiguous>::value), "");
assert(rint(1) == 1);
}
void test_round()
{
+ static_assert((std::is_same<decltype(round((float)0)), float>::value), "");
+ static_assert((std::is_same<decltype(round((bool)0)), double>::value), "");
+ static_assert((std::is_same<decltype(round((unsigned short)0)), double>::value), "");
+ static_assert((std::is_same<decltype(round((int)0)), double>::value), "");
+ static_assert((std::is_same<decltype(round((unsigned int)0)), double>::value), "");
+ static_assert((std::is_same<decltype(round((long)0)), double>::value), "");
+ static_assert((std::is_same<decltype(round((unsigned long)0)), double>::value), "");
+ static_assert((std::is_same<decltype(round((long long)0)), double>::value), "");
+ static_assert((std::is_same<decltype(round((unsigned long long)0)), double>::value), "");
static_assert((std::is_same<decltype(round((double)0)), double>::value), "");
+ static_assert((std::is_same<decltype(round((long double)0)), long double>::value), "");
static_assert((std::is_same<decltype(roundf(0)), float>::value), "");
static_assert((std::is_same<decltype(roundl(0)), long double>::value), "");
+ static_assert((std::is_same<decltype(round(Ambiguous())), Ambiguous>::value), "");
assert(round(1) == 1);
}
void test_scalbln()
{
+ static_assert((std::is_same<decltype(scalbln((float)0, (long)0)), float>::value), "");
+ static_assert((std::is_same<decltype(scalbln((bool)0, (long)0)), double>::value), "");
+ static_assert((std::is_same<decltype(scalbln((unsigned short)0, (long)0)), double>::value), "");
+ static_assert((std::is_same<decltype(scalbln((int)0, (long)0)), double>::value), "");
+ static_assert((std::is_same<decltype(scalbln((unsigned int)0, (long)0)), double>::value), "");
+ static_assert((std::is_same<decltype(scalbln((long)0, (long)0)), double>::value), "");
+ static_assert((std::is_same<decltype(scalbln((unsigned long)0, (long)0)), double>::value), "");
+ static_assert((std::is_same<decltype(scalbln((long long)0, (long)0)), double>::value), "");
+ static_assert((std::is_same<decltype(scalbln((unsigned long long)0, (long)0)), double>::value), "");
static_assert((std::is_same<decltype(scalbln((double)0, (long)0)), double>::value), "");
+ static_assert((std::is_same<decltype(scalbln((long double)0, (long)0)), long double>::value), "");
static_assert((std::is_same<decltype(scalblnf(0, (long)0)), float>::value), "");
static_assert((std::is_same<decltype(scalblnl(0, (long)0)), long double>::value), "");
+ static_assert((std::is_same<decltype(scalbln(Ambiguous(), Ambiguous())), Ambiguous>::value), "");
assert(scalbln(1, 1) == 2);
}
void test_scalbn()
{
+ static_assert((std::is_same<decltype(scalbn((float)0, (int)0)), float>::value), "");
+ static_assert((std::is_same<decltype(scalbn((bool)0, (int)0)), double>::value), "");
+ static_assert((std::is_same<decltype(scalbn((unsigned short)0, (int)0)), double>::value), "");
+ static_assert((std::is_same<decltype(scalbn((int)0, (int)0)), double>::value), "");
+ static_assert((std::is_same<decltype(scalbn((unsigned int)0, (int)0)), double>::value), "");
+ static_assert((std::is_same<decltype(scalbn((long)0, (int)0)), double>::value), "");
+ static_assert((std::is_same<decltype(scalbn((unsigned long)0, (int)0)), double>::value), "");
+ static_assert((std::is_same<decltype(scalbn((long long)0, (int)0)), double>::value), "");
+ static_assert((std::is_same<decltype(scalbn((unsigned long long)0, (int)0)), double>::value), "");
static_assert((std::is_same<decltype(scalbn((double)0, (int)0)), double>::value), "");
+ static_assert((std::is_same<decltype(scalbn((long double)0, (int)0)), long double>::value), "");
static_assert((std::is_same<decltype(scalbnf(0, (int)0)), float>::value), "");
static_assert((std::is_same<decltype(scalbnl(0, (int)0)), long double>::value), "");
+ static_assert((std::is_same<decltype(scalbn(Ambiguous(), Ambiguous())), Ambiguous>::value), "");
assert(scalbn(1, 1) == 2);
}
void test_tgamma()
{
+ static_assert((std::is_same<decltype(tgamma((float)0)), float>::value), "");
+ static_assert((std::is_same<decltype(tgamma((bool)0)), double>::value), "");
+ static_assert((std::is_same<decltype(tgamma((unsigned short)0)), double>::value), "");
+ static_assert((std::is_same<decltype(tgamma((int)0)), double>::value), "");
+ static_assert((std::is_same<decltype(tgamma((unsigned int)0)), double>::value), "");
+ static_assert((std::is_same<decltype(tgamma((long)0)), double>::value), "");
+ static_assert((std::is_same<decltype(tgamma((unsigned long)0)), double>::value), "");
+ static_assert((std::is_same<decltype(tgamma((long long)0)), double>::value), "");
+ static_assert((std::is_same<decltype(tgamma((unsigned long long)0)), double>::value), "");
static_assert((std::is_same<decltype(tgamma((double)0)), double>::value), "");
+ static_assert((std::is_same<decltype(tgamma((long double)0)), long double>::value), "");
static_assert((std::is_same<decltype(tgammaf(0)), float>::value), "");
static_assert((std::is_same<decltype(tgammal(0)), long double>::value), "");
+ static_assert((std::is_same<decltype(tgamma(Ambiguous())), Ambiguous>::value), "");
assert(tgamma(1) == 1);
}
void test_trunc()
{
+ static_assert((std::is_same<decltype(trunc((float)0)), float>::value), "");
+ static_assert((std::is_same<decltype(trunc((bool)0)), double>::value), "");
+ static_assert((std::is_same<decltype(trunc((unsigned short)0)), double>::value), "");
+ static_assert((std::is_same<decltype(trunc((int)0)), double>::value), "");
+ static_assert((std::is_same<decltype(trunc((unsigned int)0)), double>::value), "");
+ static_assert((std::is_same<decltype(trunc((long)0)), double>::value), "");
+ static_assert((std::is_same<decltype(trunc((unsigned long)0)), double>::value), "");
+ static_assert((std::is_same<decltype(trunc((long long)0)), double>::value), "");
+ static_assert((std::is_same<decltype(trunc((unsigned long long)0)), double>::value), "");
static_assert((std::is_same<decltype(trunc((double)0)), double>::value), "");
+ static_assert((std::is_same<decltype(trunc((long double)0)), long double>::value), "");
static_assert((std::is_same<decltype(truncf(0)), float>::value), "");
static_assert((std::is_same<decltype(truncl(0)), long double>::value), "");
+ static_assert((std::is_same<decltype(trunc(Ambiguous())), Ambiguous>::value), "");
assert(trunc(1) == 1);
}
int main()
{
+ test_abs();
test_acos();
test_asin();
test_atan();
@@ -636,8 +1440,6 @@ int main()
test_signbit();
test_fpclassify();
test_isfinite();
- test_isinf();
- test_isnan();
test_isnormal();
test_isgreater();
test_isgreaterequal();
diff --git a/test/std/depr/depr.c.headers/math_h_isinf.pass.cpp b/test/std/depr/depr.c.headers/math_h_isinf.pass.cpp
new file mode 100644
index 000000000000..cc7eaac7de62
--- /dev/null
+++ b/test/std/depr/depr.c.headers/math_h_isinf.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <math.h>
+
+// isinf
+
+// XFAIL: linux
+
+#include <math.h>
+#include <type_traits>
+#include <cassert>
+
+int main()
+{
+#ifdef isinf
+#error isinf defined
+#endif
+ static_assert((std::is_same<decltype(isinf((float)0)), bool>::value), "");
+ static_assert((std::is_same<decltype(isinf((double)0)), bool>::value), "");
+ static_assert((std::is_same<decltype(isinf(0)), bool>::value), "");
+ static_assert((std::is_same<decltype(isinf((long double)0)), bool>::value), "");
+ assert(isinf(-1.0) == false);
+}
diff --git a/test/std/depr/depr.c.headers/math_h_isnan.pass.cpp b/test/std/depr/depr.c.headers/math_h_isnan.pass.cpp
new file mode 100644
index 000000000000..118f96bdd434
--- /dev/null
+++ b/test/std/depr/depr.c.headers/math_h_isnan.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <math.h>
+
+// isnan
+
+// XFAIL: linux
+
+#include <math.h>
+#include <type_traits>
+#include <cassert>
+
+int main()
+{
+#ifdef isnan
+#error isnan defined
+#endif
+ static_assert((std::is_same<decltype(isnan((float)0)), bool>::value), "");
+ static_assert((std::is_same<decltype(isnan((double)0)), bool>::value), "");
+ static_assert((std::is_same<decltype(isnan(0)), bool>::value), "");
+ static_assert((std::is_same<decltype(isnan((long double)0)), bool>::value), "");
+ assert(isnan(-1.0) == false);
+}
diff --git a/test/std/depr/depr.c.headers/setjmp_h.pass.cpp b/test/std/depr/depr.c.headers/setjmp_h.pass.cpp
index 36f425390694..9bc35b747493 100644
--- a/test/std/depr/depr.c.headers/setjmp_h.pass.cpp
+++ b/test/std/depr/depr.c.headers/setjmp_h.pass.cpp
@@ -12,6 +12,10 @@
#include <setjmp.h>
#include <type_traits>
+#ifndef setjmp
+#error setjmp not defined
+#endif
+
int main()
{
jmp_buf jb;
diff --git a/test/std/depr/depr.c.headers/signal_h.pass.cpp b/test/std/depr/depr.c.headers/signal_h.pass.cpp
index a8ef5f993fe6..83f45c9b142e 100644
--- a/test/std/depr/depr.c.headers/signal_h.pass.cpp
+++ b/test/std/depr/depr.c.headers/signal_h.pass.cpp
@@ -50,7 +50,7 @@
int main()
{
- sig_atomic_t sig;
+ sig_atomic_t sig; ((void)sig);
typedef void (*func)(int);
static_assert((std::is_same<decltype(signal(0, (func)0)), func>::value), "");
static_assert((std::is_same<decltype(raise(0)), int>::value), "");
diff --git a/test/std/depr/depr.c.headers/stdarg_h.pass.cpp b/test/std/depr/depr.c.headers/stdarg_h.pass.cpp
index 7a60902529ea..f7d12b1ad551 100644
--- a/test/std/depr/depr.c.headers/stdarg_h.pass.cpp
+++ b/test/std/depr/depr.c.headers/stdarg_h.pass.cpp
@@ -32,4 +32,5 @@
int main()
{
va_list va;
+ ((void)va);
}
diff --git a/test/std/depr/depr.c.headers/stddef_h.pass.cpp b/test/std/depr/depr.c.headers/stddef_h.pass.cpp
index 140c91b53e6e..0c08c782a3e4 100644
--- a/test/std/depr/depr.c.headers/stddef_h.pass.cpp
+++ b/test/std/depr/depr.c.headers/stddef_h.pass.cpp
@@ -10,6 +10,7 @@
// <stddef.h>
#include <stddef.h>
+#include <cassert>
#include <type_traits>
#ifndef NULL
@@ -22,6 +23,9 @@
int main()
{
+ void *p = NULL;
+ assert(!p);
+
static_assert(sizeof(size_t) == sizeof(void*),
"sizeof(size_t) == sizeof(void*)");
static_assert(std::is_unsigned<size_t>::value,
@@ -34,4 +38,22 @@ int main()
"std::is_signed<ptrdiff_t>::value");
static_assert(std::is_integral<ptrdiff_t>::value,
"std::is_integral<ptrdiff_t>::value");
+ static_assert((std::is_same<decltype(nullptr), nullptr_t>::value),
+ "decltype(nullptr) == nullptr_t");
+ static_assert(sizeof(nullptr_t) == sizeof(void*),
+ "sizeof(nullptr_t) == sizeof(void*)");
+ static_assert(std::is_pod<max_align_t>::value,
+ "std::is_pod<max_align_t>::value");
+ static_assert((std::alignment_of<max_align_t>::value >=
+ std::alignment_of<long long>::value),
+ "std::alignment_of<max_align_t>::value >= "
+ "std::alignment_of<long long>::value");
+ static_assert(std::alignment_of<max_align_t>::value >=
+ std::alignment_of<long double>::value,
+ "std::alignment_of<max_align_t>::value >= "
+ "std::alignment_of<long double>::value");
+ static_assert(std::alignment_of<max_align_t>::value >=
+ std::alignment_of<void*>::value,
+ "std::alignment_of<max_align_t>::value >= "
+ "std::alignment_of<void*>::value");
}
diff --git a/test/std/depr/depr.c.headers/stdint_h.pass.cpp b/test/std/depr/depr.c.headers/stdint_h.pass.cpp
index 3861ee509753..92bb04e558bb 100644
--- a/test/std/depr/depr.c.headers/stdint_h.pass.cpp
+++ b/test/std/depr/depr.c.headers/stdint_h.pass.cpp
@@ -223,10 +223,10 @@ int main()
assert(UINTMAX_MAX == std::numeric_limits<uintmax_t>::max());
// PTRDIFF_MIN
- assert(PTRDIFF_MIN == std::numeric_limits<ptrdiff_t>::min());
+ assert(PTRDIFF_MIN == std::numeric_limits<std::ptrdiff_t>::min());
// PTRDIFF_MAX
- assert(PTRDIFF_MAX == std::numeric_limits<ptrdiff_t>::max());
+ assert(PTRDIFF_MAX == std::numeric_limits<std::ptrdiff_t>::max());
// SIG_ATOMIC_MIN
assert(SIG_ATOMIC_MIN == std::numeric_limits<sig_atomic_t>::min());
diff --git a/test/std/depr/depr.c.headers/stdio_h.pass.cpp b/test/std/depr/depr.c.headers/stdio_h.pass.cpp
index d4cfbc80a5ce..3c5dd0ebf0e0 100644
--- a/test/std/depr/depr.c.headers/stdio_h.pass.cpp
+++ b/test/std/depr/depr.c.headers/stdio_h.pass.cpp
@@ -11,6 +11,27 @@
#include <stdio.h>
#include <type_traits>
+#include "test_macros.h"
+
+#ifdef getc
+#error getc is defined
+#endif
+
+#ifdef putc
+#error putc is defined
+#endif
+
+#ifdef clearerr
+#error clearerr is defined
+#endif
+
+#ifdef feof
+#error feof is defined
+#endif
+
+#ifdef ferror
+#error ferror is defined
+#endif
#ifndef BUFSIZ
#error BUFSIZ not defined
@@ -78,14 +99,16 @@
#include <cstdarg>
-#pragma clang diagnostic ignored "-Wformat-zero-length"
+#pragma GCC diagnostic ignored "-Wformat-zero-length"
+#pragma GCC diagnostic ignored "-Wdeprecated-declarations" // for tmpnam
int main()
{
FILE* fp = 0;
fpos_t fpos = {0};
- size_t s = 0;
+ size_t s = 0; ((void)s);
char* cp = 0;
+ char arr[] = {'a', 'b'};
va_list va;
static_assert((std::is_same<decltype(remove("")), int>::value), "");
static_assert((std::is_same<decltype(rename("","")), int>::value), "");
@@ -117,7 +140,7 @@ int main()
static_assert((std::is_same<decltype(fputs("",fp)), int>::value), "");
static_assert((std::is_same<decltype(getc(fp)), int>::value), "");
static_assert((std::is_same<decltype(getchar()), int>::value), "");
-#if _LIBCPP_STD_VER < 14
+#if TEST_STD_VER < 14
static_assert((std::is_same<decltype(gets(cp)), char*>::value), "");
#endif
static_assert((std::is_same<decltype(putc(0,fp)), int>::value), "");
@@ -125,7 +148,7 @@ int main()
static_assert((std::is_same<decltype(puts("")), int>::value), "");
static_assert((std::is_same<decltype(ungetc(0,fp)), int>::value), "");
static_assert((std::is_same<decltype(fread((void*)0,0,0,fp)), size_t>::value), "");
- static_assert((std::is_same<decltype(fwrite((const void*)0,0,0,fp)), size_t>::value), "");
+ static_assert((std::is_same<decltype(fwrite((const void*)arr,1,0,fp)), size_t>::value), "");
static_assert((std::is_same<decltype(fgetpos(fp, &fpos)), int>::value), "");
static_assert((std::is_same<decltype(fseek(fp, 0,0)), int>::value), "");
static_assert((std::is_same<decltype(fsetpos(fp, &fpos)), int>::value), "");
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 47e1527fb175..96d1143d4de6 100644
--- a/test/std/depr/depr.c.headers/stdlib_h.pass.cpp
+++ b/test/std/depr/depr.c.headers/stdlib_h.pass.cpp
@@ -12,6 +12,36 @@
#include <stdlib.h>
#include <type_traits>
+// As of 1/10/2015 clang emits a -Wnonnull warnings even if the warning occurs
+// in an unevaluated context. For this reason we manually suppress the warning.
+#if defined(__clang__)
+#pragma clang diagnostic ignored "-Wnonnull"
+#endif
+
+#ifdef abs
+#error abs is defined
+#endif
+
+#ifdef labs
+#error labs is defined
+#endif
+
+#ifdef llabs
+#error llabs is defined
+#endif
+
+#ifdef div
+#error div is defined
+#endif
+
+#ifdef ldiv
+#error ldiv is defined
+#endif
+
+#ifdef lldiv
+#error lldiv is defined
+#endif
+
#ifndef EXIT_FAILURE
#error EXIT_FAILURE not defined
#endif
@@ -34,10 +64,10 @@
int main()
{
- size_t s = 0;
- div_t d;
- ldiv_t ld;
- lldiv_t lld;
+ size_t s = 0; ((void)s);
+ div_t d; ((void)d);
+ ldiv_t ld; ((void)ld);
+ lldiv_t lld; ((void)lld);
char** endptr = 0;
static_assert((std::is_same<decltype(atof("")), double>::value), "");
static_assert((std::is_same<decltype(atoi("")), int>::value), "");
diff --git a/test/std/depr/depr.c.headers/time_h.pass.cpp b/test/std/depr/depr.c.headers/time_h.pass.cpp
index c468693ccb26..0d229af409bd 100644
--- a/test/std/depr/depr.c.headers/time_h.pass.cpp
+++ b/test/std/depr/depr.c.headers/time_h.pass.cpp
@@ -22,7 +22,7 @@
int main()
{
- clock_t c = 0;
+ clock_t c = 0; ((void)c);
size_t s = 0;
time_t t = 0;
tm tmv = {0};
diff --git a/test/std/depr/depr.c.headers/wchar_h.pass.cpp b/test/std/depr/depr.c.headers/wchar_h.pass.cpp
index 68bea49cfe03..e561b3e5a724 100644
--- a/test/std/depr/depr.c.headers/wchar_h.pass.cpp
+++ b/test/std/depr/depr.c.headers/wchar_h.pass.cpp
@@ -9,6 +9,7 @@
// <wchar.h>
+
#include <wchar.h>
#include <type_traits>
@@ -30,7 +31,15 @@
int main()
{
+// mbstate_t comes from the underlying C library; it is defined (in C99) as:
+// a complete object type other than an array type that can hold the conversion
+// state information necessary to convert between sequences of multibyte
+// characters and wide characters
+#pragma clang diagnostic push
+#pragma clang diagnostic ignored "-Wmissing-braces"
mbstate_t mb = {0};
+#pragma clang diagnostic pop
+
size_t s = 0;
tm *tm = 0;
wint_t w = 0;
@@ -50,19 +59,13 @@ int main()
static_assert((std::is_same<decltype(vfwscanf(fp, L"", va)), int>::value), "");
static_assert((std::is_same<decltype(vswprintf(ws, s, L"", va)), int>::value), "");
static_assert((std::is_same<decltype(vswscanf(L"", L"", va)), int>::value), "");
- static_assert((std::is_same<decltype(vwprintf(L"", va)), int>::value), "");
- static_assert((std::is_same<decltype(vwscanf(L"", va)), int>::value), "");
- static_assert((std::is_same<decltype(wprintf(L"")), int>::value), "");
- static_assert((std::is_same<decltype(wscanf(L"")), int>::value), "");
static_assert((std::is_same<decltype(fgetwc(fp)), wint_t>::value), "");
static_assert((std::is_same<decltype(fgetws(ws, 0, fp)), wchar_t*>::value), "");
static_assert((std::is_same<decltype(fputwc(L' ', fp)), wint_t>::value), "");
static_assert((std::is_same<decltype(fputws(L"", fp)), int>::value), "");
static_assert((std::is_same<decltype(fwide(fp, 0)), int>::value), "");
static_assert((std::is_same<decltype(getwc(fp)), wint_t>::value), "");
- static_assert((std::is_same<decltype(getwchar()), wint_t>::value), "");
static_assert((std::is_same<decltype(putwc(L' ', fp)), wint_t>::value), "");
- static_assert((std::is_same<decltype(putwchar(L' ')), wint_t>::value), "");
static_assert((std::is_same<decltype(ungetwc(L' ', fp)), wint_t>::value), "");
static_assert((std::is_same<decltype(wcstod(L"", (wchar_t**)0)), double>::value), "");
static_assert((std::is_same<decltype(wcstof(L"", (wchar_t**)0)), float>::value), "");
@@ -79,14 +82,19 @@ int main()
static_assert((std::is_same<decltype(wcscoll(L"", L"")), int>::value), "");
static_assert((std::is_same<decltype(wcsncmp(L"", L"", s)), int>::value), "");
static_assert((std::is_same<decltype(wcsxfrm(ws, L"", s)), size_t>::value), "");
+ // const wchar_t* wcschr((const wchar_t*)0, L' ') - See below
static_assert((std::is_same<decltype(wcschr((wchar_t*)0, L' ')), wchar_t*>::value), "");
static_assert((std::is_same<decltype(wcscspn(L"", L"")), size_t>::value), "");
static_assert((std::is_same<decltype(wcslen(L"")), size_t>::value), "");
+ // const wchar_t* wcspbrk((const wchar_t*)0, L"") - See below
static_assert((std::is_same<decltype(wcspbrk((wchar_t*)0, L"")), wchar_t*>::value), "");
+ // const wchar_t* wcsrchr((const wchar_t*)0, L' ') - See below
static_assert((std::is_same<decltype(wcsrchr((wchar_t*)0, L' ')), wchar_t*>::value), "");
static_assert((std::is_same<decltype(wcsspn(L"", L"")), size_t>::value), "");
+ // const wchar_t* wcsstr((const wchar_t*)0, L"") - See below
static_assert((std::is_same<decltype(wcsstr((wchar_t*)0, L"")), wchar_t*>::value), "");
static_assert((std::is_same<decltype(wcstok(ws, L"", (wchar_t**)0)), wchar_t*>::value), "");
+ // const wchar_t* wmemchr((const wchar_t*)0, L' ', s) - See below
static_assert((std::is_same<decltype(wmemchr((wchar_t*)0, L' ', s)), wchar_t*>::value), "");
static_assert((std::is_same<decltype(wmemcmp(L"", L"", s)), int>::value), "");
static_assert((std::is_same<decltype(wmemcpy(ws, L"", s)), wchar_t*>::value), "");
@@ -101,4 +109,27 @@ int main()
static_assert((std::is_same<decltype(wcrtomb(ns, L' ', &mb)), size_t>::value), "");
static_assert((std::is_same<decltype(mbsrtowcs(ws, (const char**)0, s, &mb)), size_t>::value), "");
static_assert((std::is_same<decltype(wcsrtombs(ns, (const wchar_t**)0, s, &mb)), size_t>::value), "");
+
+// This test fails on systems whose C library doesn't provide a correct overload
+// set for wcschr, wcspbrk, wcsrchr, wcsstr, and wmemchr. There's no way for
+// libc++ to fix that on the C library's behalf.
+#ifndef __APPLE__
+ static_assert((std::is_same<decltype(wcschr((const wchar_t*)0, L' ')), const wchar_t*>::value), "");
+ static_assert((std::is_same<decltype(wcspbrk((const wchar_t*)0, L"")), const wchar_t*>::value), "");
+ static_assert((std::is_same<decltype(wcsrchr((const wchar_t*)0, L' ')), const wchar_t*>::value), "");
+ static_assert((std::is_same<decltype(wcsstr((const wchar_t*)0, L"")), const wchar_t*>::value), "");
+ static_assert((std::is_same<decltype(wmemchr((const wchar_t*)0, L' ', s)), const wchar_t*>::value), "");
+#endif
+
+#ifndef _LIBCPP_HAS_NO_STDIN
+ static_assert((std::is_same<decltype(getwchar()), wint_t>::value), "");
+ static_assert((std::is_same<decltype(vwscanf(L"", va)), int>::value), "");
+ static_assert((std::is_same<decltype(wscanf(L"")), int>::value), "");
+#endif
+
+#ifndef _LIBCPP_HAS_NO_STDOUT
+ static_assert((std::is_same<decltype(putwchar(L' ')), wint_t>::value), "");
+ static_assert((std::is_same<decltype(vwprintf(L"", va)), int>::value), "");
+ static_assert((std::is_same<decltype(wprintf(L"")), int>::value), "");
+#endif
}
diff --git a/test/std/depr/depr.ios.members/io_state.pass.cpp b/test/std/depr/depr.ios.members/io_state.pass.cpp
index 15bfbf197802..6b362d016036 100644
--- a/test/std/depr/depr.ios.members/io_state.pass.cpp
+++ b/test/std/depr/depr.ios.members/io_state.pass.cpp
@@ -15,11 +15,16 @@
// typedef T1 io_state;
// };
+// These members were removed for C++17
+
+#include "test_macros.h"
#include <strstream>
#include <cassert>
int main()
{
+#if TEST_STD_VER <= 14
std::strstream::io_state b = std::strstream::eofbit;
assert(b == std::ios::eofbit);
+#endif
}
diff --git a/test/std/depr/depr.ios.members/open_mode.pass.cpp b/test/std/depr/depr.ios.members/open_mode.pass.cpp
index 12a8e9458809..cf91e7c9d1d5 100644
--- a/test/std/depr/depr.ios.members/open_mode.pass.cpp
+++ b/test/std/depr/depr.ios.members/open_mode.pass.cpp
@@ -15,11 +15,16 @@
// typedef T2 open_mode;
// };
+// These members were removed for C++17
+
+#include "test_macros.h"
#include <strstream>
#include <cassert>
int main()
{
+#if TEST_STD_VER <= 14
std::strstream::open_mode b = std::strstream::app;
assert(b == std::ios::app);
+#endif
}
diff --git a/test/std/depr/depr.ios.members/seek_dir.pass.cpp b/test/std/depr/depr.ios.members/seek_dir.pass.cpp
index 891a7a345638..0dd70c101858 100644
--- a/test/std/depr/depr.ios.members/seek_dir.pass.cpp
+++ b/test/std/depr/depr.ios.members/seek_dir.pass.cpp
@@ -15,11 +15,16 @@
// typedef T3 seek_dir;
// };
+// These members were removed for C++17
+
+#include "test_macros.h"
#include <strstream>
#include <cassert>
int main()
{
+#if TEST_STD_VER <= 14
std::strstream::seek_dir b = std::strstream::cur;
assert(b == std::ios::cur);
+#endif
}
diff --git a/test/std/depr/depr.ios.members/streamoff.pass.cpp b/test/std/depr/depr.ios.members/streamoff.pass.cpp
index 4ccfd1f7d225..0c237b3547d6 100644
--- a/test/std/depr/depr.ios.members/streamoff.pass.cpp
+++ b/test/std/depr/depr.ios.members/streamoff.pass.cpp
@@ -15,11 +15,16 @@
// typedef OFF_T streamoff;
// };
+// These members were removed for C++17
+
+#include "test_macros.h"
#include <ios>
#include <type_traits>
int main()
{
+#if TEST_STD_VER <= 14
static_assert((std::is_integral<std::ios_base::streamoff>::value), "");
static_assert((std::is_signed<std::ios_base::streamoff>::value), "");
+#endif
}
diff --git a/test/std/depr/depr.ios.members/streampos.pass.cpp b/test/std/depr/depr.ios.members/streampos.pass.cpp
index 315118cb3e3d..863905f710eb 100644
--- a/test/std/depr/depr.ios.members/streampos.pass.cpp
+++ b/test/std/depr/depr.ios.members/streampos.pass.cpp
@@ -15,10 +15,15 @@
// typedef POS_T streampos;
// };
+// These members were removed for C++17
+
+#include "test_macros.h"
#include <ios>
#include <type_traits>
int main()
{
+#if TEST_STD_VER <= 14
static_assert((std::is_same<std::ios_base::streampos, std::streampos>::value), "");
+#endif
}
diff --git a/test/std/depr/exception.unexpected/unexpected.handler/unexpected_handler.pass.cpp b/test/std/depr/exception.unexpected/unexpected.handler/unexpected_handler.pass.cpp
index 7fab50081d2a..5879529317ef 100644
--- a/test/std/depr/exception.unexpected/unexpected.handler/unexpected_handler.pass.cpp
+++ b/test/std/depr/exception.unexpected/unexpected.handler/unexpected_handler.pass.cpp
@@ -16,4 +16,5 @@ void f() {}
int main()
{
std::unexpected_handler p = f;
+ ((void)p);
}
diff --git a/test/std/diagnostics/syserr/syserr.errcat/syserr.errcat.overview/error_category.pass.cpp b/test/std/diagnostics/syserr/syserr.errcat/syserr.errcat.overview/error_category.pass.cpp
index 235305878390..79162ddaa8fd 100644
--- a/test/std/diagnostics/syserr/syserr.errcat/syserr.errcat.overview/error_category.pass.cpp
+++ b/test/std/diagnostics/syserr/syserr.errcat/syserr.errcat.overview/error_category.pass.cpp
@@ -16,4 +16,5 @@
int main()
{
std::error_category* p = 0;
+ ((void)p);
}
diff --git a/test/std/experimental/algorithms/alg.search/search.pass.cpp b/test/std/experimental/algorithms/alg.search/search.pass.cpp
new file mode 100644
index 000000000000..60a44e4c26a2
--- /dev/null
+++ b/test/std/experimental/algorithms/alg.search/search.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
+
+// <algorithm>
+
+// template<class ForwardIterator, class Searcher>
+// ForwardIterator search(ForwardIterator first, ForwardIterator last,
+// const Searcher& searcher);
+//
+// returns searcher.operator(first, last)
+//
+
+#include <experimental/algorithm>
+#include <cassert>
+
+#include "test_iterators.h"
+
+int searcher_called = 0;
+
+struct MySearcher {
+ template <typename Iterator>
+ Iterator operator() ( Iterator b, Iterator /*e*/) const
+ {
+ ++searcher_called;
+ return b;
+ }
+};
+
+
+int main() {
+ typedef int * RI;
+ static_assert((std::is_same<RI, decltype(std::experimental::search(RI(), RI(), MySearcher()))>::value), "" );
+
+ RI it(nullptr);
+ assert(it == std::experimental::search(it, it, MySearcher()));
+ assert(searcher_called == 1);
+}
diff --git a/test/std/experimental/any/any.class/any.assign/copy.pass.cpp b/test/std/experimental/any/any.class/any.assign/copy.pass.cpp
new file mode 100644
index 000000000000..8ee575c408f9
--- /dev/null
+++ b/test/std/experimental/any/any.class/any.assign/copy.pass.cpp
@@ -0,0 +1,197 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file 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
+
+// <experimental/any>
+
+// any& operator=(any const &);
+
+// Test copy assignment
+
+#include <experimental/any>
+#include <cassert>
+
+#include "any_helpers.h"
+#include "count_new.hpp"
+#include "test_macros.h"
+
+using std::experimental::any;
+using std::experimental::any_cast;
+
+template <class LHS, class RHS>
+void test_copy_assign() {
+ assert(LHS::count == 0);
+ assert(RHS::count == 0);
+ LHS::reset();
+ RHS::reset();
+ {
+ any lhs(LHS(1));
+ any const rhs(RHS(2));
+
+ assert(LHS::count == 1);
+ assert(RHS::count == 1);
+ assert(RHS::copied == 0);
+
+ lhs = rhs;
+
+ assert(RHS::copied == 1);
+ assert(LHS::count == 0);
+ assert(RHS::count == 2);
+
+ assertContains<RHS>(lhs, 2);
+ assertContains<RHS>(rhs, 2);
+ }
+ assert(LHS::count == 0);
+ assert(RHS::count == 0);
+}
+
+template <class LHS>
+void test_copy_assign_empty() {
+ assert(LHS::count == 0);
+ LHS::reset();
+ {
+ any lhs;
+ any const rhs(LHS(42));
+
+ assert(LHS::count == 1);
+ assert(LHS::copied == 0);
+
+ lhs = rhs;
+
+ assert(LHS::copied == 1);
+ assert(LHS::count == 2);
+
+ assertContains<LHS>(lhs, 42);
+ assertContains<LHS>(rhs, 42);
+ }
+ assert(LHS::count == 0);
+ LHS::reset();
+ {
+ any lhs(LHS(1));
+ any const rhs;
+
+ assert(LHS::count == 1);
+ assert(LHS::copied == 0);
+
+ lhs = rhs;
+
+ assert(LHS::copied == 0);
+ assert(LHS::count == 0);
+
+ assertEmpty<LHS>(lhs);
+ assertEmpty(rhs);
+ }
+ assert(LHS::count == 0);
+}
+
+void test_copy_assign_self() {
+ // empty
+ {
+ any a;
+ a = a;
+ assertEmpty(a);
+ assert(globalMemCounter.checkOutstandingNewEq(0));
+ }
+ assert(globalMemCounter.checkOutstandingNewEq(0));
+ // small
+ {
+ any a((small(1)));
+ assert(small::count == 1);
+
+ a = a;
+
+ assert(small::count == 1);
+ assertContains<small>(a, 1);
+ assert(globalMemCounter.checkOutstandingNewEq(0));
+ }
+ assert(small::count == 0);
+ assert(globalMemCounter.checkOutstandingNewEq(0));
+ // large
+ {
+ any a(large(1));
+ assert(large::count == 1);
+
+ a = a;
+
+ assert(large::count == 1);
+ assertContains<large>(a, 1);
+ assert(globalMemCounter.checkOutstandingNewEq(1));
+ }
+ assert(large::count == 0);
+ assert(globalMemCounter.checkOutstandingNewEq(0));
+}
+
+template <class Tp>
+void test_copy_assign_throws()
+{
+#if !defined(TEST_HAS_NO_EXCEPTIONS)
+ auto try_throw =
+ [](any& lhs, any const& rhs) {
+ try {
+ lhs = rhs;
+ assert(false);
+ } catch (my_any_exception const &) {
+ // do nothing
+ } catch (...) {
+ assert(false);
+ }
+ };
+ // const lvalue to empty
+ {
+ any lhs;
+ any const rhs((Tp(1)));
+ assert(Tp::count == 1);
+
+ try_throw(lhs, rhs);
+
+ assert(Tp::count == 1);
+ assertEmpty<Tp>(lhs);
+ assertContains<Tp>(rhs);
+ }
+ {
+ any lhs((small(2)));
+ any const rhs((Tp(1)));
+ assert(small::count == 1);
+ assert(Tp::count == 1);
+
+ try_throw(lhs, rhs);
+
+ assert(small::count == 1);
+ assert(Tp::count == 1);
+ assertContains<small>(lhs, 2);
+ assertContains<Tp>(rhs);
+ }
+ {
+ any lhs((large(2)));
+ any const rhs((Tp(1)));
+ assert(large::count == 1);
+ assert(Tp::count == 1);
+
+ try_throw(lhs, rhs);
+
+ assert(large::count == 1);
+ assert(Tp::count == 1);
+ assertContains<large>(lhs, 2);
+ assertContains<Tp>(rhs);
+ }
+#endif
+}
+
+int main() {
+ test_copy_assign<small1, small2>();
+ test_copy_assign<large1, large2>();
+ test_copy_assign<small, large>();
+ test_copy_assign<large, small>();
+ test_copy_assign_empty<small>();
+ test_copy_assign_empty<large>();
+ test_copy_assign_self();
+ test_copy_assign_throws<small_throws_on_copy>();
+ test_copy_assign_throws<large_throws_on_copy>();
+}
diff --git a/test/std/experimental/any/any.class/any.assign/move.pass.cpp b/test/std/experimental/any/any.class/any.assign/move.pass.cpp
new file mode 100644
index 000000000000..0a2d71967cd4
--- /dev/null
+++ b/test/std/experimental/any/any.class/any.assign/move.pass.cpp
@@ -0,0 +1,102 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file 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
+
+// <experimental/any>
+
+// any& operator=(any &&);
+
+// Test move assignment.
+
+#include <experimental/any>
+#include <cassert>
+
+#include "any_helpers.h"
+#include "test_macros.h"
+
+using std::experimental::any;
+using std::experimental::any_cast;
+
+template <class LHS, class RHS>
+void test_move_assign() {
+ assert(LHS::count == 0);
+ assert(RHS::count == 0);
+ {
+ LHS const s1(1);
+ any a(s1);
+ RHS const s2(2);
+ any a2(s2);
+
+ assert(LHS::count == 2);
+ assert(RHS::count == 2);
+
+ a = std::move(a2);
+
+ assert(LHS::count == 1);
+ assert(RHS::count == 2);
+
+ assertContains<RHS>(a, 2);
+ assertEmpty<RHS>(a2);
+ }
+ assert(LHS::count == 0);
+ assert(RHS::count == 0);
+}
+
+template <class LHS>
+void test_move_assign_empty() {
+ assert(LHS::count == 0);
+ {
+ any a;
+ any a2((LHS(1)));
+
+ assert(LHS::count == 1);
+
+ a = std::move(a2);
+
+ assert(LHS::count == 1);
+
+ assertContains<LHS>(a, 1);
+ assertEmpty<LHS>(a2);
+ }
+ assert(LHS::count == 0);
+ {
+ any a((LHS(1)));
+ any a2;
+
+ assert(LHS::count == 1);
+
+ a = std::move(a2);
+
+ assert(LHS::count == 0);
+
+ assertEmpty<LHS>(a);
+ assertEmpty(a2);
+ }
+ assert(LHS::count == 0);
+}
+
+void test_move_assign_noexcept() {
+ any a1;
+ any a2;
+ static_assert(
+ noexcept(a1 = std::move(a2))
+ , "any & operator=(any &&) must be noexcept"
+ );
+}
+
+int main() {
+ test_move_assign_noexcept();
+ test_move_assign<small1, small2>();
+ test_move_assign<large1, large2>();
+ test_move_assign<small, large>();
+ test_move_assign<large, small>();
+ test_move_assign_empty<small>();
+ test_move_assign_empty<large>();
+}
diff --git a/test/std/experimental/any/any.class/any.assign/value.pass.cpp b/test/std/experimental/any/any.class/any.assign/value.pass.cpp
new file mode 100644
index 000000000000..8262990523c3
--- /dev/null
+++ b/test/std/experimental/any/any.class/any.assign/value.pass.cpp
@@ -0,0 +1,177 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file 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
+
+// <experimental/any>
+
+// any& operator=(any const &);
+
+// Test value copy and move assignment.
+
+#include <experimental/any>
+#include <cassert>
+
+#include "any_helpers.h"
+#include "count_new.hpp"
+#include "test_macros.h"
+
+using std::experimental::any;
+using std::experimental::any_cast;
+
+template <class LHS, class RHS>
+void test_assign_value() {
+ assert(LHS::count == 0);
+ assert(RHS::count == 0);
+ LHS::reset();
+ RHS::reset();
+ {
+ any lhs(LHS(1));
+ any const rhs(RHS(2));
+
+ assert(LHS::count == 1);
+ assert(RHS::count == 1);
+ assert(RHS::copied == 0);
+
+ lhs = rhs;
+
+ assert(RHS::copied == 1);
+ assert(LHS::count == 0);
+ assert(RHS::count == 2);
+
+ assertContains<RHS>(lhs, 2);
+ assertContains<RHS>(rhs, 2);
+ }
+ assert(LHS::count == 0);
+ assert(RHS::count == 0);
+ LHS::reset();
+ RHS::reset();
+ {
+ any lhs(LHS(1));
+ any rhs(RHS(2));
+
+ assert(LHS::count == 1);
+ assert(RHS::count == 1);
+ assert(RHS::moved == 1);
+
+ lhs = std::move(rhs);
+
+ assert(RHS::moved >= 1);
+ assert(RHS::copied == 0);
+ assert(LHS::count == 0);
+ assert(RHS::count == 1);
+
+ assertContains<RHS>(lhs, 2);
+ assertEmpty<RHS>(rhs);
+ }
+ assert(LHS::count == 0);
+ assert(RHS::count == 0);
+}
+
+template <class RHS>
+void test_assign_value_empty() {
+ assert(RHS::count == 0);
+ RHS::reset();
+ {
+ any lhs;
+ RHS rhs(42);
+ assert(RHS::count == 1);
+ assert(RHS::copied == 0);
+
+ lhs = rhs;
+
+ assert(RHS::count == 2);
+ assert(RHS::copied == 1);
+ assert(RHS::moved >= 0);
+ assertContains<RHS>(lhs, 42);
+ }
+ assert(RHS::count == 0);
+ RHS::reset();
+ {
+ any lhs;
+ RHS rhs(42);
+ assert(RHS::count == 1);
+ assert(RHS::moved == 0);
+
+ lhs = std::move(rhs);
+
+ assert(RHS::count == 2);
+ assert(RHS::copied == 0);
+ assert(RHS::moved >= 1);
+ assertContains<RHS>(lhs, 42);
+ }
+ assert(RHS::count == 0);
+ RHS::reset();
+}
+
+
+template <class Tp, bool Move = false>
+void test_assign_throws() {
+#if !defined(TEST_HAS_NO_EXCEPTIONS)
+ auto try_throw=
+ [](any& lhs, auto&& rhs) {
+ try {
+ Move ? lhs = std::move(rhs)
+ : lhs = rhs;
+ assert(false);
+ } catch (my_any_exception const &) {
+ // do nothing
+ } catch (...) {
+ assert(false);
+ }
+ };
+ // const lvalue to empty
+ {
+ any lhs;
+ Tp rhs(1);
+ assert(Tp::count == 1);
+
+ try_throw(lhs, rhs);
+
+ assert(Tp::count == 1);
+ assertEmpty<Tp>(lhs);
+ }
+ {
+ any lhs((small(2)));
+ Tp rhs(1);
+ assert(small::count == 1);
+ assert(Tp::count == 1);
+
+ try_throw(lhs, rhs);
+
+ assert(small::count == 1);
+ assert(Tp::count == 1);
+ assertContains<small>(lhs, 2);
+ }
+ {
+ any lhs((large(2)));
+ Tp rhs(1);
+ assert(large::count == 1);
+ assert(Tp::count == 1);
+
+ try_throw(lhs, rhs);
+
+ assert(large::count == 1);
+ assert(Tp::count == 1);
+ assertContains<large>(lhs, 2);
+ }
+#endif
+}
+
+int main() {
+ test_assign_value<small1, small2>();
+ test_assign_value<large1, large2>();
+ test_assign_value<small, large>();
+ test_assign_value<large, small>();
+ test_assign_value_empty<small>();
+ test_assign_value_empty<large>();
+ test_assign_throws<small_throws_on_copy>();
+ test_assign_throws<large_throws_on_copy>();
+ test_assign_throws<throws_on_move, /* Move = */ true>();
+} \ No newline at end of file
diff --git a/test/std/experimental/any/any.class/any.assign/value_non_copyable_assign.fail.cpp b/test/std/experimental/any/any.class/any.assign/value_non_copyable_assign.fail.cpp
new file mode 100644
index 000000000000..ce0d44f32d98
--- /dev/null
+++ b/test/std/experimental/any/any.class/any.assign/value_non_copyable_assign.fail.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
+
+// <experimental/any>
+
+// template <class Value>
+// any& operator=(Value &&);
+
+// Instantiate the value assignment operator with a non-copyable type.
+
+#include <experimental/any>
+
+class non_copyable
+{
+ non_copyable(non_copyable const &);
+
+public:
+ non_copyable() {}
+ non_copyable(non_copyable &&) {}
+};
+
+int main()
+{
+ using namespace std::experimental;
+ non_copyable nc;
+ any a;
+ a = static_cast<non_copyable &&>(nc); // expected-error@experimental/any:* 2 {{static_assert failed "_ValueType must be CopyConstructible."}}
+ // expected-error@experimental/any:* {{calling a private constructor of class 'non_copyable'}}
+
+}
diff --git a/test/std/experimental/any/any.class/any.cons/copy.pass.cpp b/test/std/experimental/any/any.class/any.cons/copy.pass.cpp
new file mode 100644
index 000000000000..3d0b34b27406
--- /dev/null
+++ b/test/std/experimental/any/any.class/any.cons/copy.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
+
+// <experimental/any>
+
+// any(any const &);
+
+#include <experimental/any>
+#include <cassert>
+
+#include "any_helpers.h"
+#include "count_new.hpp"
+#include "test_macros.h"
+
+using std::experimental::any;
+using std::experimental::any_cast;
+
+template <class Type>
+void test_copy_throws() {
+#if !defined(TEST_HAS_NO_EXCEPTIONS)
+ assert(Type::count == 0);
+ {
+ any const a((Type(42)));
+ assert(Type::count == 1);
+ try {
+ any const a2(a);
+ assert(false);
+ } catch (my_any_exception const &) {
+ // do nothing
+ } catch (...) {
+ assert(false);
+ }
+ assert(Type::count == 1);
+ assertContains<Type>(a, 42);
+ }
+ assert(Type::count == 0);
+#endif
+}
+
+void test_copy_empty() {
+ DisableAllocationGuard g; ((void)g); // No allocations should occur.
+ any a1;
+ any a2(a1);
+
+ assertEmpty(a1);
+ assertEmpty(a2);
+}
+
+template <class Type>
+void test_copy()
+{
+ // Copying small types should not perform any allocations.
+ DisableAllocationGuard g(isSmallType<Type>()); ((void)g);
+ assert(Type::count == 0);
+ Type::reset();
+ {
+ any a((Type(42)));
+ assert(Type::count == 1);
+ assert(Type::copied == 0);
+
+ any a2(a);
+
+ assert(Type::copied == 1);
+ assert(Type::count == 2);
+ assertContains<Type>(a, 42);
+ assertContains<Type>(a, 42);
+
+ // Modify a and check that a2 is unchanged
+ modifyValue<Type>(a, -1);
+ assertContains<Type>(a, -1);
+ assertContains<Type>(a2, 42);
+
+ // modify a2 and check that a is unchanged
+ modifyValue<Type>(a2, 999);
+ assertContains<Type>(a, -1);
+ assertContains<Type>(a2, 999);
+
+ // clear a and check that a2 is unchanged
+ a.clear();
+ assertEmpty(a);
+ assertContains<Type>(a2, 999);
+ }
+ assert(Type::count == 0);
+}
+
+int main() {
+ test_copy<small>();
+ test_copy<large>();
+ test_copy_empty();
+ test_copy_throws<small_throws_on_copy>();
+ test_copy_throws<large_throws_on_copy>();
+}
diff --git a/test/std/experimental/any/any.class/any.cons/default.pass.cpp b/test/std/experimental/any/any.class/any.cons/default.pass.cpp
new file mode 100644
index 000000000000..b52c83fc3881
--- /dev/null
+++ b/test/std/experimental/any/any.class/any.cons/default.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
+
+// <experimental/any>
+
+// any() noexcept;
+
+#include <experimental/any>
+#include <type_traits>
+#include <cassert>
+
+#include "any_helpers.h"
+#include "count_new.hpp"
+
+
+int main()
+{
+ using std::experimental::any;
+ {
+ static_assert(
+ std::is_nothrow_default_constructible<any>::value
+ , "Must be default constructible"
+ );
+ }
+ {
+ DisableAllocationGuard g; ((void)g);
+ any const a;
+ assertEmpty(a);
+ }
+}
diff --git a/test/std/experimental/any/any.class/any.cons/move.pass.cpp b/test/std/experimental/any/any.class/any.cons/move.pass.cpp
new file mode 100644
index 000000000000..40534cb55066
--- /dev/null
+++ b/test/std/experimental/any/any.class/any.cons/move.pass.cpp
@@ -0,0 +1,102 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file 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
+
+// <experimental/any>
+
+// any(any &&) noexcept;
+
+#include <experimental/any>
+#include <utility>
+#include <type_traits>
+#include <cassert>
+
+#include "any_helpers.h"
+#include "count_new.hpp"
+#include "test_macros.h"
+
+using std::experimental::any;
+using std::experimental::any_cast;
+
+// Moves are always noexcept. The throws_on_move object
+// must be stored dynamically so the pointer is moved and
+// not the stored object.
+void test_move_does_not_throw()
+{
+#if !defined(TEST_HAS_NO_EXCEPTIONS)
+ assert(throws_on_move::count == 0);
+ {
+ throws_on_move v(42);
+ any a(v);
+ assert(throws_on_move::count == 2);
+ // No allocations should be performed after this point.
+ DisableAllocationGuard g; ((void)g);
+ try {
+ any const a2(std::move(a));
+ assertEmpty(a);
+ assertContains<throws_on_move>(a2, 42);
+ } catch (...) {
+ assert(false);
+ }
+ assert(throws_on_move::count == 1);
+ assertEmpty(a);
+ }
+ assert(throws_on_move::count == 0);
+#endif
+}
+
+void test_move_empty() {
+ DisableAllocationGuard g; ((void)g); // no allocations should be performed.
+
+ any a1;
+ any a2(std::move(a1));
+
+ assertEmpty(a1);
+ assertEmpty(a2);
+}
+
+template <class Type>
+void test_move() {
+ assert(Type::count == 0);
+ Type::reset();
+ {
+ any a((Type(42)));
+ assert(Type::count == 1);
+ assert(Type::copied == 0);
+ assert(Type::moved == 1);
+
+ // Moving should not perform allocations since it must be noexcept.
+ DisableAllocationGuard g; ((void)g);
+
+ any a2(std::move(a));
+
+ assert(Type::moved >= 1); // zero or more move operations can be performed.
+ assert(Type::copied == 0); // no copies can be performed.
+ assert(Type::count == 1);
+ assertEmpty(a); // Moves are always destructive.
+ assertContains<Type>(a2, 42);
+ }
+ assert(Type::count == 0);
+}
+
+int main()
+{
+ // noexcept test
+ {
+ static_assert(
+ std::is_nothrow_move_constructible<any>::value
+ , "any must be nothrow move constructible"
+ );
+ }
+ test_move<small>();
+ test_move<large>();
+ test_move_empty();
+ test_move_does_not_throw();
+}
diff --git a/test/std/experimental/any/any.class/any.cons/non_copyable_value.fail.cpp b/test/std/experimental/any/any.class/any.cons/non_copyable_value.fail.cpp
new file mode 100644
index 000000000000..643b9621ca2f
--- /dev/null
+++ b/test/std/experimental/any/any.class/any.cons/non_copyable_value.fail.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
+
+// <experimental/any>
+
+// any::any<Value>(Value &&)
+
+// Attempt to construct any with a non-copyable type.
+
+#include <experimental/any>
+
+class non_copyable
+{
+ non_copyable(non_copyable const &);
+
+public:
+ non_copyable() {}
+ non_copyable(non_copyable &&) {}
+};
+
+int main()
+{
+ using namespace std::experimental;
+ non_copyable nc;
+ any a(static_cast<non_copyable &&>(nc));
+ // expected-error@experimental/any:* 1 {{static_assert failed "_ValueType must be CopyConstructible."}}
+ // expected-error@experimental/any:* 1 {{calling a private constructor of class 'non_copyable'}}
+}
diff --git a/test/std/experimental/any/any.class/any.cons/value.pass.cpp b/test/std/experimental/any/any.class/any.cons/value.pass.cpp
new file mode 100644
index 000000000000..7bb134efd28a
--- /dev/null
+++ b/test/std/experimental/any/any.class/any.cons/value.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
+
+// <experimental/any>
+
+// template <class Value> any(Value &&)
+
+// Test construction from a value.
+// Concerns:
+// ---------
+// 1. The value is properly move/copied depending on the value category.
+// 2. Both small and large values are properly handled.
+
+
+#include <experimental/any>
+#include <cassert>
+
+#include "any_helpers.h"
+#include "count_new.hpp"
+#include "test_macros.h"
+
+using std::experimental::any;
+using std::experimental::any_cast;
+
+template <class Type>
+void test_copy_value_throws()
+{
+#if !defined(TEST_HAS_NO_EXCEPTIONS)
+ assert(Type::count == 0);
+ {
+ Type const t(42);
+ assert(Type::count == 1);
+ try {
+ any const a2(t);
+ assert(false);
+ } catch (my_any_exception const &) {
+ // do nothing
+ } catch (...) {
+ assert(false);
+ }
+ assert(Type::count == 1);
+ assert(t.value == 42);
+ }
+ assert(Type::count == 0);
+#endif
+}
+
+void test_move_value_throws()
+{
+#if !defined(TEST_HAS_NO_EXCEPTIONS)
+ assert(throws_on_move::count == 0);
+ {
+ throws_on_move v;
+ assert(throws_on_move::count == 1);
+ try {
+ any const a(std::move(v));
+ assert(false);
+ } catch (my_any_exception const &) {
+ // do nothing
+ } catch (...) {
+ assert(false);
+ }
+ assert(throws_on_move::count == 1);
+ }
+ assert(throws_on_move::count == 0);
+#endif
+}
+
+template <class Type>
+void test_copy_move_value() {
+ // constructing from a small type should perform no allocations.
+ DisableAllocationGuard g(isSmallType<Type>()); ((void)g);
+ assert(Type::count == 0);
+ Type::reset();
+ {
+ Type t(42);
+ assert(Type::count == 1);
+
+ any a(t);
+
+ assert(Type::count == 2);
+ assert(Type::copied == 1);
+ assert(Type::moved == 0);
+ assertContains<Type>(a, 42);
+ }
+ assert(Type::count == 0);
+ Type::reset();
+ {
+ Type t(42);
+ assert(Type::count == 1);
+
+ any a(std::move(t));
+
+ assert(Type::count == 2);
+ assert(Type::copied == 0);
+ assert(Type::moved == 1);
+ assertContains<Type>(a, 42);
+ }
+}
+
+
+int main() {
+ test_copy_move_value<small>();
+ test_copy_move_value<large>();
+ test_copy_value_throws<small_throws_on_copy>();
+ test_copy_value_throws<large_throws_on_copy>();
+ test_move_value_throws();
+} \ No newline at end of file
diff --git a/test/std/experimental/any/any.class/any.modifiers/clear.pass.cpp b/test/std/experimental/any/any.class/any.modifiers/clear.pass.cpp
new file mode 100644
index 000000000000..603490cef43d
--- /dev/null
+++ b/test/std/experimental/any/any.class/any.modifiers/clear.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
+
+// <experimental/any>
+
+// any::clear() noexcept
+
+#include <experimental/any>
+#include <cassert>
+
+#include "any_helpers.h"
+
+int main()
+{
+ using std::experimental::any;
+ using std::experimental::any_cast;
+ // empty
+ {
+ any a;
+
+ // noexcept check
+ static_assert(
+ noexcept(a.clear())
+ , "any.clear() must be noexcept"
+ );
+
+ assertEmpty(a);
+
+ a.clear();
+
+ assertEmpty(a);
+ }
+ // small object
+ {
+ any a((small(1)));
+ assert(small::count == 1);
+ assertContains<small>(a, 1);
+
+ a.clear();
+
+ assertEmpty<small>(a);
+ assert(small::count == 0);
+ }
+ // large object
+ {
+ any a(large(1));
+ assert(large::count == 1);
+ assertContains<large>(a);
+
+ a.clear();
+
+ assertEmpty<large>(a);
+ assert(large::count == 0);
+ }
+}
diff --git a/test/std/experimental/any/any.class/any.modifiers/swap.pass.cpp b/test/std/experimental/any/any.class/any.modifiers/swap.pass.cpp
new file mode 100644
index 000000000000..064935167eb5
--- /dev/null
+++ b/test/std/experimental/any/any.class/any.modifiers/swap.pass.cpp
@@ -0,0 +1,101 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file 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
+
+// <experimental/any>
+
+// any::swap(any &) noexcept
+
+// Test swap(large, small) and swap(small, large)
+
+#include <experimental/any>
+#include <cassert>
+
+#include "any_helpers.h"
+
+using std::experimental::any;
+using std::experimental::any_cast;
+
+template <class LHS, class RHS>
+void test_swap() {
+ assert(LHS::count == 0);
+ assert(RHS::count == 0);
+ {
+ any a1((LHS(1)));
+ any a2(RHS{2});
+ assert(LHS::count == 1);
+ assert(RHS::count == 1);
+
+ a1.swap(a2);
+
+ assert(LHS::count == 1);
+ assert(RHS::count == 1);
+
+ assertContains<RHS>(a1, 2);
+ assertContains<LHS>(a2, 1);
+ }
+ assert(LHS::count == 0);
+ assert(RHS::count == 0);
+ assert(LHS::copied == 0);
+ assert(RHS::copied == 0);
+}
+
+template <class Tp>
+void test_swap_empty() {
+ assert(Tp::count == 0);
+ {
+ any a1((Tp(1)));
+ any a2;
+ assert(Tp::count == 1);
+
+ a1.swap(a2);
+
+ assert(Tp::count == 1);
+
+ assertContains<Tp>(a2, 1);
+ assertEmpty(a1);
+ }
+ assert(Tp::count == 0);
+ {
+ any a1((Tp(1)));
+ any a2;
+ assert(Tp::count == 1);
+
+ a2.swap(a1);
+
+ assert(Tp::count == 1);
+
+ assertContains<Tp>(a2, 1);
+ assertEmpty(a1);
+ }
+ assert(Tp::count == 0);
+ assert(Tp::copied == 0);
+}
+
+void test_noexcept()
+{
+ any a1;
+ any a2;
+ static_assert(
+ noexcept(a1.swap(a2))
+ , "any::swap(any&) must be noexcept"
+ );
+}
+
+int main()
+{
+ test_noexcept();
+ test_swap_empty<small>();
+ test_swap_empty<large>();
+ test_swap<small1, small2>();
+ test_swap<large1, large2>();
+ test_swap<small, large>();
+ test_swap<large, small>();
+}
diff --git a/test/std/experimental/any/any.class/any.observers/empty.pass.cpp b/test/std/experimental/any/any.class/any.observers/empty.pass.cpp
new file mode 100644
index 000000000000..8c681f37017f
--- /dev/null
+++ b/test/std/experimental/any/any.class/any.observers/empty.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
+
+// <experimental/any>
+
+// any::empty() noexcept
+
+#include <experimental/any>
+#include <cassert>
+
+#include "any_helpers.h"
+
+int main()
+{
+ using std::experimental::any;
+ // noexcept test
+ {
+ any a;
+ static_assert(noexcept(a.empty()), "any::empty() must be noexcept");
+ }
+ // empty
+ {
+ any a;
+ assert(a.empty());
+
+ a.clear();
+ assert(a.empty());
+
+ a = 42;
+ assert(!a.empty());
+ }
+ // small object
+ {
+ small const s(1);
+ any a(s);
+ assert(!a.empty());
+
+ a.clear();
+ assert(a.empty());
+
+ a = s;
+ assert(!a.empty());
+ }
+ // large object
+ {
+ large const l(1);
+ any a(l);
+ assert(!a.empty());
+
+ a.clear();
+ assert(a.empty());
+
+ a = l;
+ assert(!a.empty());
+ }
+}
diff --git a/test/std/experimental/any/any.class/any.observers/type.pass.cpp b/test/std/experimental/any/any.class/any.observers/type.pass.cpp
new file mode 100644
index 000000000000..682b73bc98c4
--- /dev/null
+++ b/test/std/experimental/any/any.class/any.observers/type.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
+
+// XFAIL: libcpp-no-rtti
+
+// <experimental/any>
+
+// any::type() noexcept
+
+#include <experimental/any>
+#include <cassert>
+#include "any_helpers.h"
+
+int main()
+{
+ using std::experimental::any;
+ {
+ any const a;
+ assert(a.type() == typeid(void));
+ static_assert(noexcept(a.type()), "any::type() must be noexcept");
+ }
+ {
+ small const s(1);
+ any const a(s);
+ assert(a.type() == typeid(small));
+
+ }
+ {
+ large const l(1);
+ any const a(l);
+ assert(a.type() == typeid(large));
+ }
+}
diff --git a/test/std/experimental/any/any.class/nothing_to_do.pass.cpp b/test/std/experimental/any/any.class/nothing_to_do.pass.cpp
new file mode 100644
index 000000000000..c21f8a701685
--- /dev/null
+++ b/test/std/experimental/any/any.class/nothing_to_do.pass.cpp
@@ -0,0 +1,12 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#include <experimental/string_view>
+
+int main () {}
diff --git a/test/std/experimental/any/any.nonmembers/any.cast/any_cast_pointer.pass.cpp b/test/std/experimental/any/any.nonmembers/any.cast/any_cast_pointer.pass.cpp
new file mode 100644
index 000000000000..9d9a5cdb4726
--- /dev/null
+++ b/test/std/experimental/any/any.nonmembers/any.cast/any_cast_pointer.pass.cpp
@@ -0,0 +1,146 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file 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
+
+// <experimental/any>
+
+// template <class ValueType>
+// ValueType const* any_cast(any const *) noexcept;
+//
+// template <class ValueType>
+// ValueType * any_cast(any *) noexcept;
+
+#include <experimental/any>
+#include <type_traits>
+#include <cassert>
+
+#include "any_helpers.h"
+
+using std::experimental::any;
+using std::experimental::any_cast;
+
+// Test that the operators are properly noexcept.
+void test_cast_is_noexcept() {
+ any a;
+ static_assert(noexcept(any_cast<int>(&a)), "");
+
+ any const& ca = a;
+ static_assert(noexcept(any_cast<int>(&ca)), "");
+}
+
+// Test that the return type of any_cast is correct.
+void test_cast_return_type() {
+ any a;
+ static_assert(std::is_same<decltype(any_cast<int>(&a)), int*>::value, "");
+ static_assert(std::is_same<decltype(any_cast<int const>(&a)), int const*>::value, "");
+
+ any const& ca = a;
+ static_assert(std::is_same<decltype(any_cast<int>(&ca)), int const*>::value, "");
+ static_assert(std::is_same<decltype(any_cast<int const>(&ca)), int const*>::value, "");
+}
+
+// Test that any_cast handles null pointers.
+void test_cast_nullptr() {
+ any* a = nullptr;
+ assert(nullptr == any_cast<int>(a));
+ assert(nullptr == any_cast<int const>(a));
+
+ any const* ca = nullptr;
+ assert(nullptr == any_cast<int>(ca));
+ assert(nullptr == any_cast<int const>(ca));
+}
+
+// Test casting an empty object.
+void test_cast_empty() {
+ {
+ any a;
+ assert(nullptr == any_cast<int>(&a));
+ assert(nullptr == any_cast<int const>(&a));
+
+ any const& ca = a;
+ assert(nullptr == any_cast<int>(&ca));
+ assert(nullptr == any_cast<int const>(&ca));
+ }
+ // Create as non-empty, then make empty and run test.
+ {
+ any a(42);
+ a.clear();
+ assert(nullptr == any_cast<int>(&a));
+ assert(nullptr == any_cast<int const>(&a));
+
+ any const& ca = a;
+ assert(nullptr == any_cast<int>(&ca));
+ assert(nullptr == any_cast<int const>(&ca));
+ }
+}
+
+template <class Type>
+void test_cast() {
+ assert(Type::count == 0);
+ Type::reset();
+ {
+ any a((Type(42)));
+ any const& ca = a;
+ assert(Type::count == 1);
+ assert(Type::copied == 0);
+ assert(Type::moved == 1);
+
+ // Try a cast to a bad type.
+ // NOTE: Type cannot be an int.
+ assert(any_cast<int>(&a) == nullptr);
+ assert(any_cast<int const>(&a) == nullptr);
+ assert(any_cast<int const volatile>(&a) == nullptr);
+
+ // Try a cast to the right type, but as a pointer.
+ assert(any_cast<Type*>(&a) == nullptr);
+ assert(any_cast<Type const*>(&a) == nullptr);
+
+ // Check getting a unqualified type from a non-const any.
+ Type* v = any_cast<Type>(&a);
+ assert(v != nullptr);
+ assert(v->value == 42);
+
+ // change the stored value and later check for the new value.
+ v->value = 999;
+
+ // Check getting a const qualified type from a non-const any.
+ Type const* cv = any_cast<Type const>(&a);
+ assert(cv != nullptr);
+ assert(cv == v);
+ assert(cv->value == 999);
+
+ // Check getting a unqualified type from a const any.
+ cv = any_cast<Type>(&ca);
+ assert(cv != nullptr);
+ assert(cv == v);
+ assert(cv->value == 999);
+
+ // Check getting a const-qualified type from a const any.
+ cv = any_cast<Type const>(&ca);
+ assert(cv != nullptr);
+ assert(cv == v);
+ assert(cv->value == 999);
+
+ // Check that no more objects were created, copied or moved.
+ assert(Type::count == 1);
+ assert(Type::copied == 0);
+ assert(Type::moved == 1);
+ }
+ assert(Type::count == 0);
+}
+
+int main() {
+ test_cast_is_noexcept();
+ test_cast_return_type();
+ test_cast_nullptr();
+ test_cast_empty();
+ test_cast<small>();
+ test_cast<large>();
+}
diff --git a/test/std/experimental/any/any.nonmembers/any.cast/any_cast_reference.pass.cpp b/test/std/experimental/any/any.nonmembers/any.cast/any_cast_reference.pass.cpp
new file mode 100644
index 000000000000..e97560937fb0
--- /dev/null
+++ b/test/std/experimental/any/any.nonmembers/any.cast/any_cast_reference.pass.cpp
@@ -0,0 +1,309 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file 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
+
+// <experimental/any>
+
+// template <class ValueType>
+// ValueType const any_cast(any const&);
+//
+// template <class ValueType>
+// ValueType any_cast(any &);
+//
+// template <class ValueType>
+// ValueType any_cast(any &&);
+
+#include <experimental/any>
+#include <type_traits>
+#include <cassert>
+
+#include "any_helpers.h"
+#include "count_new.hpp"
+#include "test_macros.h"
+
+using std::experimental::any;
+using std::experimental::any_cast;
+using std::experimental::bad_any_cast;
+
+
+// Test that the operators are NOT marked noexcept.
+void test_cast_is_not_noexcept() {
+ any a;
+ static_assert(!noexcept(any_cast<int>(static_cast<any&>(a))), "");
+ static_assert(!noexcept(any_cast<int>(static_cast<any const&>(a))), "");
+ static_assert(!noexcept(any_cast<int>(static_cast<any &&>(a))), "");
+}
+
+// Test that the return type of any_cast is correct.
+void test_cast_return_type() {
+ any a;
+ static_assert(std::is_same<decltype(any_cast<int>(a)), int>::value, "");
+ static_assert(std::is_same<decltype(any_cast<int const>(a)), int>::value, "");
+ static_assert(std::is_same<decltype(any_cast<int&>(a)), int&>::value, "");
+ static_assert(std::is_same<decltype(any_cast<int const&>(a)), int const&>::value, "");
+
+ //static_assert(std::is_same<decltype(any_cast<int&&>(a)), int&&>::value, "");
+ //static_assert(std::is_same<decltype(any_cast<int const&&>(a)), int const&&>::value, "");
+
+ static_assert(std::is_same<decltype(any_cast<int>(std::move(a))), int>::value, "");
+ static_assert(std::is_same<decltype(any_cast<int const>(std::move(a))), int>::value, "");
+ static_assert(std::is_same<decltype(any_cast<int&>(std::move(a))), int&>::value, "");
+ static_assert(std::is_same<decltype(any_cast<int const&>(std::move(a))), int const&>::value, "");
+
+ //static_assert(std::is_same<decltype(any_cast<int&&>(std::move(a))), int&&>::value, "");
+ //static_assert(std::is_same<decltype(any_cast<int const&&>(std::move(a))), int const&&>::value, "");
+
+ any const& ca = a;
+ static_assert(std::is_same<decltype(any_cast<int>(ca)), int>::value, "");
+ static_assert(std::is_same<decltype(any_cast<int const>(ca)), int>::value, "");
+ static_assert(std::is_same<decltype(any_cast<int const&>(ca)), int const&>::value, "");
+
+ //static_assert(std::is_same<decltype(any_cast<int const&&>(ca)), int const&&>::value, "");
+}
+
+template <class Type, class ConstT = Type>
+void checkThrows(any& a)
+{
+#if !defined(TEST_HAS_NO_EXCEPTIONS)
+ try {
+ any_cast<Type>(a);
+ assert(false);
+ } catch (bad_any_cast const &) {
+ // do nothing
+ } catch (...) {
+ assert(false);
+ }
+
+ try {
+ any_cast<ConstT>(static_cast<any const&>(a));
+ assert(false);
+ } catch (bad_any_cast const &) {
+ // do nothing
+ } catch (...) {
+ assert(false);
+ }
+
+ try {
+ any_cast<Type>(static_cast<any&&>(a));
+ assert(false);
+ } catch (bad_any_cast const &) {
+ // do nothing
+ } catch (...) {
+ assert(false);
+ }
+#endif
+}
+
+void test_cast_empty() {
+ // None of these operations should allocate.
+ DisableAllocationGuard g; ((void)g);
+ any a;
+ checkThrows<int>(a);
+}
+
+template <class Type>
+void test_cast_to_reference() {
+ assert(Type::count == 0);
+ Type::reset();
+ {
+ any a((Type(42)));
+ any const& ca = a;
+ assert(Type::count == 1);
+ assert(Type::copied == 0);
+ assert(Type::moved == 1);
+
+ // Try a cast to a bad type.
+ // NOTE: Type cannot be an int.
+ checkThrows<int>(a);
+ checkThrows<int&, int const&>(a);
+ checkThrows<Type*, Type const*>(a);
+ checkThrows<Type const*>(a);
+
+ // Check getting a type by reference from a non-const lvalue any.
+ {
+ Type& v = any_cast<Type&>(a);
+ assert(v.value == 42);
+
+ Type const &cv = any_cast<Type const&>(a);
+ assert(&cv == &v);
+ }
+ // Check getting a type by reference from a const lvalue any.
+ {
+ Type const& v = any_cast<Type const&>(ca);
+ assert(v.value == 42);
+
+ Type const &cv = any_cast<Type const&>(ca);
+ assert(&cv == &v);
+ }
+ // Check getting a type by reference from a non-const rvalue
+ {
+ Type& v = any_cast<Type&>(std::move(a));
+ assert(v.value == 42);
+
+ Type const &cv = any_cast<Type const&>(std::move(a));
+ assert(&cv == &v);
+ }
+ // Check getting a type by reference from a const rvalue any.
+ {
+ Type const& v = any_cast<Type const&>(std::move(ca));
+ assert(v.value == 42);
+
+ Type const &cv = any_cast<Type const&>(std::move(ca));
+ assert(&cv == &v);
+ }
+
+ // Check that the original object hasn't been changed.
+ assertContains<Type>(a, 42);
+
+ // Check that no objects have been created/copied/moved.
+ assert(Type::count == 1);
+ assert(Type::copied == 0);
+ assert(Type::moved == 1);
+ }
+ assert(Type::count == 0);
+}
+
+template <class Type>
+void test_cast_to_value() {
+ assert(Type::count == 0);
+ Type::reset();
+ {
+ any a((Type(42)));
+ any const& ca = a;
+ assert(Type::count == 1);
+ assert(Type::copied == 0);
+ assert(Type::moved == 1);
+
+ // Try a cast to a bad type.
+ // NOTE: Type cannot be an int.
+ checkThrows<int>(a);
+ checkThrows<int&, int const&>(a);
+ checkThrows<Type*, Type const*>(a);
+ checkThrows<Type const*>(a);
+
+ Type::reset(); // NOTE: reset does not modify Type::count
+ // Check getting Type by value from a non-const lvalue any.
+ // This should cause the non-const copy constructor to be called.
+ {
+ Type t = any_cast<Type>(a);
+
+ assert(Type::count == 2);
+ assert(Type::copied == 1);
+ assert(Type::const_copied == 0);
+ assert(Type::non_const_copied == 1);
+ assert(Type::moved == 0);
+ assert(t.value == 42);
+ }
+ assert(Type::count == 1);
+ Type::reset();
+ // Check getting const Type by value from a non-const lvalue any.
+ // This should cause the const copy constructor to be called.
+ {
+ Type t = any_cast<Type const>(a);
+
+ assert(Type::count == 2);
+ assert(Type::copied == 1);
+ assert(Type::const_copied == 1);
+ assert(Type::non_const_copied == 0);
+ assert(Type::moved == 0);
+ assert(t.value == 42);
+ }
+ assert(Type::count == 1);
+ Type::reset();
+ // Check getting Type by value from a non-const lvalue any.
+ // This should cause the const copy constructor to be called.
+ {
+ Type t = any_cast<Type>(static_cast<any const&>(a));
+
+ assert(Type::count == 2);
+ assert(Type::copied == 1);
+ assert(Type::const_copied == 1);
+ assert(Type::non_const_copied == 0);
+ assert(Type::moved == 0);
+ assert(t.value == 42);
+ }
+ assert(Type::count == 1);
+ Type::reset();
+ // Check getting Type by value from a non-const rvalue any.
+ // This should cause the non-const copy constructor to be called.
+ {
+ Type t = any_cast<Type>(static_cast<any &&>(a));
+
+ assert(Type::count == 2);
+ assert(Type::copied == 1);
+ assert(Type::const_copied == 0);
+ assert(Type::non_const_copied == 1);
+ assert(Type::moved == 0);
+ assert(t.value == 42);
+ }
+ assert(Type::count == 1);
+ Type::reset();
+ // Check getting const Type by value from a non-const rvalue any.
+ // This should cause the const copy constructor to be called.
+ {
+ Type t = any_cast<Type const>(static_cast<any &&>(a));
+
+ assert(Type::count == 2);
+ assert(Type::copied == 1);
+ assert(Type::const_copied == 1);
+ assert(Type::non_const_copied == 0);
+ assert(Type::moved == 0);
+ assert(t.value == 42);
+ }
+ assert(Type::count == 1);
+ Type::reset();
+ // Check getting Type by value from a const rvalue any.
+ // This should cause the const copy constructor to be called.
+ {
+ Type t = any_cast<Type>(static_cast<any const&&>(a));
+
+ assert(Type::count == 2);
+ assert(Type::copied == 1);
+ assert(Type::const_copied == 1);
+ assert(Type::non_const_copied == 0);
+ assert(Type::moved == 0);
+ assert(t.value == 42);
+ }
+ // Ensure we still only have 1 Type object alive.
+ assert(Type::count == 1);
+
+ // Check that the original object hasn't been changed.
+ assertContains<Type>(a, 42);
+ }
+ assert(Type::count == 0);
+}
+
+// Even though you can't get a non-copyable class into std::any
+// the standard requires that these overloads compile and function.
+void test_non_copyable_ref() {
+ struct no_copy
+ {
+ no_copy() {}
+ no_copy(no_copy &&) {}
+ private:
+ no_copy(no_copy const &);
+ };
+
+ any a;
+ checkThrows<no_copy &, no_copy const&>(a);
+ checkThrows<no_copy const&>(a);
+ assertEmpty(a);
+}
+
+int main() {
+ test_cast_is_not_noexcept();
+ test_cast_return_type();
+ test_cast_empty();
+ test_cast_to_reference<small>();
+ test_cast_to_reference<large>();
+ test_cast_to_value<small>();
+ test_cast_to_value<large>();
+ test_non_copyable_ref();
+}
diff --git a/test/std/experimental/any/any.nonmembers/any.cast/const_correctness.fail.cpp b/test/std/experimental/any/any.nonmembers/any.cast/const_correctness.fail.cpp
new file mode 100644
index 000000000000..db5149265ccc
--- /dev/null
+++ b/test/std/experimental/any/any.nonmembers/any.cast/const_correctness.fail.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
+
+// <experimental/any>
+
+// template <class ValueType>
+// ValueType any_cast(any const &);
+
+// Try and cast away const.
+
+#include <experimental/any>
+
+struct TestType {};
+struct TestType2 {};
+
+int main()
+{
+ using std::experimental::any;
+ using std::experimental::any_cast;
+
+ any a;
+
+ // expected-error@experimental/any:* 2 {{binding value of type '_Tp' (aka 'const TestType') to reference to type 'TestType' drops 'const' qualifier}}
+ any_cast<TestType &>(static_cast<any const&>(a)); // expected-note {{requested here}}
+ any_cast<TestType &&>(static_cast<any const&>(a)); // expected-note {{requested here}}
+
+ // expected-error@experimental/any:* 2 {{binding value of type '_Tp' (aka 'const TestType2') to reference to type 'TestType2' drops 'const' qualifier}}
+ any_cast<TestType2 &>(static_cast<any const&&>(a)); // expected-note {{requested here}}
+ any_cast<TestType2 &&>(static_cast<any const&&>(a)); // expected-note {{requested here}}
+}
diff --git a/test/std/experimental/any/any.nonmembers/any.cast/not_copy_constructible.fail.cpp b/test/std/experimental/any/any.nonmembers/any.cast/not_copy_constructible.fail.cpp
new file mode 100644
index 000000000000..c6cc68d72706
--- /dev/null
+++ b/test/std/experimental/any/any.nonmembers/any.cast/not_copy_constructible.fail.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
+
+// <experimental/any>
+
+// template <class ValueType>
+// ValueType const any_cast(any const&);
+//
+// template <class ValueType>
+// ValueType any_cast(any &);
+//
+// template <class ValueType>
+// ValueType any_cast(any &&);
+
+// Test instantiating the any_cast with a non-copyable type.
+
+#include <experimental/any>
+
+using std::experimental::any;
+using std::experimental::any_cast;
+
+struct no_copy
+{
+ no_copy() {}
+ no_copy(no_copy &&) {}
+private:
+ no_copy(no_copy const &);
+};
+
+int main() {
+ any a;
+ any_cast<no_copy>(static_cast<any&>(a));
+ any_cast<no_copy>(static_cast<any const&>(a));
+ any_cast<no_copy>(static_cast<any &&>(a));
+ // expected-error@experimental/any:* 3 {{static_assert failed "_ValueType is required to be a reference or a CopyConstructible type."}}
+ // expected-error@experimental/any:* 3 {{calling a private constructor of class 'no_copy'}}
+} \ No newline at end of file
diff --git a/test/std/experimental/any/any.nonmembers/any.cast/reference_types.fail.cpp b/test/std/experimental/any/any.nonmembers/any.cast/reference_types.fail.cpp
new file mode 100644
index 000000000000..6c6ccc68787a
--- /dev/null
+++ b/test/std/experimental/any/any.nonmembers/any.cast/reference_types.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.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++98, c++03, c++11
+
+// <experimental/any>
+
+// template <class ValueType>
+// ValueType const* any_cast(any const *) noexcept;
+//
+// template <class ValueType>
+// ValueType * any_cast(any *) noexcept;
+
+#include <experimental/any>
+
+using std::experimental::any;
+using std::experimental::any_cast;
+
+int main()
+{
+ any a(1);
+ any_cast<int &>(&a); // expected-error@experimental/any:* 1 {{static_assert failed "_ValueType may not be a reference."}}
+ any_cast<int &&>(&a); // expected-error@experimental/any:* 1 {{static_assert failed "_ValueType may not be a reference."}}
+ any_cast<int const &>(&a); // expected-error@experimental/any:* 1 {{static_assert failed "_ValueType may not be a reference."}}
+ any_cast<int const&&>(&a); // expected-error@experimental/any:* 1 {{static_assert failed "_ValueType may not be a reference."}}
+ any const& a2 = a;
+ any_cast<int &>(&a2); // expected-error@experimental/any:* 1 {{static_assert failed "_ValueType may not be a reference."}}
+ any_cast<int &&>(&a2); // expected-error@experimental/any:* 1 {{static_assert failed "_ValueType may not be a reference."}}
+ any_cast<int const &>(&a2); // expected-error@experimental/any:* 1 {{static_assert failed "_ValueType may not be a reference."}}
+ any_cast<int const &&>(&a2); // expected-error@experimental/any:* 1 {{static_assert failed "_ValueType may not be a reference."}}
+}
diff --git a/test/std/experimental/any/any.nonmembers/swap.pass.cpp b/test/std/experimental/any/any.nonmembers/swap.pass.cpp
new file mode 100644
index 000000000000..a3fbd43d9247
--- /dev/null
+++ b/test/std/experimental/any/any.nonmembers/swap.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
+
+// <experimental/any>
+
+// void swap(any &, any &) noexcept
+
+// swap(...) just wraps any::swap(...). That function is tested elsewhere.
+
+#include <experimental/any>
+#include <cassert>
+
+using std::experimental::any;
+using std::experimental::any_cast;
+
+int main()
+{
+
+ { // test noexcept
+ any a;
+ static_assert(noexcept(swap(a, a)), "swap(any&, any&) must be noexcept");
+ }
+ {
+ any a1(1);
+ any a2(2);
+
+ swap(a1, a2);
+
+ assert(any_cast<int>(a1) == 2);
+ assert(any_cast<int>(a2) == 1);
+ }
+}
diff --git a/test/std/experimental/func/func.searchers/func.searchers.boyer_moore/default.pass.cpp b/test/std/experimental/func/func.searchers/func.searchers.boyer_moore/default.pass.cpp
new file mode 100644
index 000000000000..7647b536aa95
--- /dev/null
+++ b/test/std/experimental/func/func.searchers/func.searchers.boyer_moore/default.pass.cpp
@@ -0,0 +1,128 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file 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
+
+// <functional>
+
+// boyer_moore searcher
+// template<class RandomAccessIterator1,
+// class Hash = hash<typename iterator_traits<RandomAccessIterator1>::value_type>,
+// class BinaryPredicate = equal_to<>>
+// class boyer_moore_searcher {
+// public:
+// boyer_moore_searcher(RandomAccessIterator1 pat_first, RandomAccessIterator1 pat_last,
+// Hash hf = Hash(), BinaryPredicate pred = BinaryPredicate());
+//
+// template<class RandomAccessIterator2>
+// RandomAccessIterator2
+// operator()(RandomAccessIterator2 first, RandomAccessIterator2 last) const;
+//
+// private:
+// RandomAccessIterator1 pat_first_; // exposition only
+// RandomAccessIterator1 pat_last_; // exposition only
+// Hash hash_; // exposition only
+// BinaryPredicate pred_; // exposition only
+// };
+
+
+#include <experimental/algorithm>
+#include <experimental/functional>
+#include <cassert>
+
+#include "test_iterators.h"
+
+template <typename Iter1, typename Iter2>
+void do_search(Iter1 b1, Iter1 e1, Iter2 b2, Iter2 e2, Iter1 result) {
+ std::experimental::boyer_moore_searcher<Iter2> s{b2, e2};
+ assert(result == std::experimental::search(b1, e1, s));
+}
+
+template <class Iter1, class Iter2>
+void
+test()
+{
+ int ia[] = {0, 1, 2, 3, 4, 5};
+ const unsigned sa = sizeof(ia)/sizeof(ia[0]);
+ do_search(Iter1(ia), Iter1(ia+sa), Iter2(ia), Iter2(ia), Iter1(ia));
+ do_search(Iter1(ia), Iter1(ia+sa), Iter2(ia), Iter2(ia+1), Iter1(ia));
+ do_search(Iter1(ia), Iter1(ia+sa), Iter2(ia+1), Iter2(ia+2), Iter1(ia+1));
+ do_search(Iter1(ia), Iter1(ia+sa), Iter2(ia+2), Iter2(ia+2), Iter1(ia));
+ do_search(Iter1(ia), Iter1(ia+sa), Iter2(ia+2), Iter2(ia+3), Iter1(ia+2));
+ do_search(Iter1(ia), Iter1(ia+sa), Iter2(ia+2), Iter2(ia+3), Iter1(ia+2));
+ do_search(Iter1(ia), Iter1(ia), Iter2(ia+2), Iter2(ia+3), Iter1(ia));
+ do_search(Iter1(ia), Iter1(ia+sa), Iter2(ia+sa-1), Iter2(ia+sa), Iter1(ia+sa-1));
+ do_search(Iter1(ia), Iter1(ia+sa), Iter2(ia+sa-3), Iter2(ia+sa), Iter1(ia+sa-3));
+ do_search(Iter1(ia), Iter1(ia+sa), Iter2(ia), Iter2(ia+sa), Iter1(ia));
+ do_search(Iter1(ia), Iter1(ia+sa-1), Iter2(ia), Iter2(ia+sa), Iter1(ia+sa-1));
+ do_search(Iter1(ia), Iter1(ia+1), Iter2(ia), Iter2(ia+sa), Iter1(ia+1));
+ int ib[] = {0, 1, 2, 0, 1, 2, 3, 0, 1, 2, 3, 4};
+ const unsigned sb = sizeof(ib)/sizeof(ib[0]);
+ int ic[] = {1};
+ do_search(Iter1(ib), Iter1(ib+sb), Iter2(ic), Iter2(ic+1), Iter1(ib+1));
+ int id[] = {1, 2};
+ do_search(Iter1(ib), Iter1(ib+sb), Iter2(id), Iter2(id+2), Iter1(ib+1));
+ int ie[] = {1, 2, 3};
+ do_search(Iter1(ib), Iter1(ib+sb), Iter2(ie), Iter2(ie+3), Iter1(ib+4));
+ int ig[] = {1, 2, 3, 4};
+ do_search(Iter1(ib), Iter1(ib+sb), Iter2(ig), Iter2(ig+4), Iter1(ib+8));
+ int ih[] = {0, 1, 1, 1, 1, 2, 3, 0, 1, 2, 3, 4};
+ const unsigned sh = sizeof(ih)/sizeof(ih[0]);
+ int ii[] = {1, 1, 2};
+ do_search(Iter1(ih), Iter1(ih+sh), Iter2(ii), Iter2(ii+3), Iter1(ih+3));
+ int ij[] = {0, 1, 0, 0, 1, 0, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0};
+ const unsigned sj = sizeof(ij)/sizeof(ij[0]);
+ int ik[] = {0, 0, 0, 0, 1, 1, 1, 1, 0, 0};
+ const unsigned sk = sizeof(ik)/sizeof(ik[0]);
+ do_search(Iter1(ij), Iter1(ij+sj), Iter2(ik), Iter2(ik+sk), Iter1(ij+6));
+}
+
+template <class Iter1, class Iter2>
+void
+test2()
+{
+ char ia[] = {0, 1, 2, 3, 4, 5};
+ const unsigned sa = sizeof(ia)/sizeof(ia[0]);
+ do_search(Iter1(ia), Iter1(ia+sa), Iter2(ia), Iter2(ia), Iter1(ia));
+ do_search(Iter1(ia), Iter1(ia+sa), Iter2(ia), Iter2(ia+1), Iter1(ia));
+ do_search(Iter1(ia), Iter1(ia+sa), Iter2(ia+1), Iter2(ia+2), Iter1(ia+1));
+ do_search(Iter1(ia), Iter1(ia+sa), Iter2(ia+2), Iter2(ia+2), Iter1(ia));
+ do_search(Iter1(ia), Iter1(ia+sa), Iter2(ia+2), Iter2(ia+3), Iter1(ia+2));
+ do_search(Iter1(ia), Iter1(ia+sa), Iter2(ia+2), Iter2(ia+3), Iter1(ia+2));
+ do_search(Iter1(ia), Iter1(ia), Iter2(ia+2), Iter2(ia+3), Iter1(ia));
+ do_search(Iter1(ia), Iter1(ia+sa), Iter2(ia+sa-1), Iter2(ia+sa), Iter1(ia+sa-1));
+ do_search(Iter1(ia), Iter1(ia+sa), Iter2(ia+sa-3), Iter2(ia+sa), Iter1(ia+sa-3));
+ do_search(Iter1(ia), Iter1(ia+sa), Iter2(ia), Iter2(ia+sa), Iter1(ia));
+ do_search(Iter1(ia), Iter1(ia+sa-1), Iter2(ia), Iter2(ia+sa), Iter1(ia+sa-1));
+ do_search(Iter1(ia), Iter1(ia+1), Iter2(ia), Iter2(ia+sa), Iter1(ia+1));
+ char ib[] = {0, 1, 2, 0, 1, 2, 3, 0, 1, 2, 3, 4};
+ const unsigned sb = sizeof(ib)/sizeof(ib[0]);
+ char ic[] = {1};
+ do_search(Iter1(ib), Iter1(ib+sb), Iter2(ic), Iter2(ic+1), Iter1(ib+1));
+ char id[] = {1, 2};
+ do_search(Iter1(ib), Iter1(ib+sb), Iter2(id), Iter2(id+2), Iter1(ib+1));
+ char ie[] = {1, 2, 3};
+ do_search(Iter1(ib), Iter1(ib+sb), Iter2(ie), Iter2(ie+3), Iter1(ib+4));
+ char ig[] = {1, 2, 3, 4};
+ do_search(Iter1(ib), Iter1(ib+sb), Iter2(ig), Iter2(ig+4), Iter1(ib+8));
+ char ih[] = {0, 1, 1, 1, 1, 2, 3, 0, 1, 2, 3, 4};
+ const unsigned sh = sizeof(ih)/sizeof(ih[0]);
+ char ii[] = {1, 1, 2};
+ do_search(Iter1(ih), Iter1(ih+sh), Iter2(ii), Iter2(ii+3), Iter1(ih+3));
+ char ij[] = {0, 1, 0, 0, 1, 0, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0};
+ const unsigned sj = sizeof(ij)/sizeof(ij[0]);
+ char ik[] = {0, 0, 0, 0, 1, 1, 1, 1, 0, 0};
+ const unsigned sk = sizeof(ik)/sizeof(ik[0]);
+ do_search(Iter1(ij), Iter1(ij+sj), Iter2(ik), Iter2(ik+sk), Iter1(ij+6));
+}
+
+int main() {
+ test<random_access_iterator<const int*>, random_access_iterator<const int*> >();
+ test2<random_access_iterator<const char*>, random_access_iterator<const char*> >();
+}
diff --git a/test/std/experimental/func/func.searchers/func.searchers.boyer_moore/hash.pass.cpp b/test/std/experimental/func/func.searchers/func.searchers.boyer_moore/hash.pass.cpp
new file mode 100644
index 000000000000..1323044c8704
--- /dev/null
+++ b/test/std/experimental/func/func.searchers/func.searchers.boyer_moore/hash.pass.cpp
@@ -0,0 +1,124 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file 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
+
+// <functional>
+
+// boyer_moore searcher
+// template<class RandomAccessIterator1,
+// class Hash = hash<typename iterator_traits<RandomAccessIterator1>::value_type>,
+// class BinaryPredicate = equal_to<>>
+// class boyer_moore_searcher {
+// public:
+// boyer_moore_searcher(RandomAccessIterator1 pat_first, RandomAccessIterator1 pat_last,
+// Hash hf = Hash(), BinaryPredicate pred = BinaryPredicate());
+//
+// template<class RandomAccessIterator2>
+// RandomAccessIterator2
+// operator()(RandomAccessIterator2 first, RandomAccessIterator2 last) const;
+//
+// private:
+// RandomAccessIterator1 pat_first_; // exposition only
+// RandomAccessIterator1 pat_last_; // exposition only
+// Hash hash_; // exposition only
+// BinaryPredicate pred_; // exposition only
+// };
+
+
+#include <experimental/algorithm>
+#include <experimental/functional>
+#include <cassert>
+
+#include "test_iterators.h"
+
+template <typename T> struct MyHash {
+ size_t operator () (T t) const { return static_cast<size_t>(t); }
+};
+
+template <typename Iter1, typename Iter2>
+void do_search(Iter1 b1, Iter1 e1, Iter2 b2, Iter2 e2, Iter1 result, unsigned max_count) {
+ std::experimental::boyer_moore_searcher<Iter2,
+ MyHash<typename std::remove_cv<typename std::iterator_traits<Iter2>::value_type>::type>>
+ s{b2, e2};
+ assert(result == std::experimental::search(b1, e1, s));
+}
+
+template <class Iter1, class Iter2>
+void
+test()
+{
+ int ia[] = {0, 1, 2, 3, 4, 5};
+ const unsigned sa = sizeof(ia)/sizeof(ia[0]);
+ do_search(Iter1(ia), Iter1(ia+sa), Iter2(ia), Iter2(ia), Iter1(ia), 0);
+ do_search(Iter1(ia), Iter1(ia+sa), Iter2(ia), Iter2(ia+1), Iter1(ia), sa);
+ do_search(Iter1(ia), Iter1(ia+sa), Iter2(ia+1), Iter2(ia+2), Iter1(ia+1), sa);
+ do_search(Iter1(ia), Iter1(ia+sa), Iter2(ia+2), Iter2(ia+2), Iter1(ia), 0);
+ do_search(Iter1(ia), Iter1(ia+sa), Iter2(ia+2), Iter2(ia+3), Iter1(ia+2), sa);
+ do_search(Iter1(ia), Iter1(ia+sa), Iter2(ia+2), Iter2(ia+3), Iter1(ia+2), sa);
+ do_search(Iter1(ia), Iter1(ia), Iter2(ia+2), Iter2(ia+3), Iter1(ia), 0);
+ do_search(Iter1(ia), Iter1(ia+sa), Iter2(ia+sa-1), Iter2(ia+sa), Iter1(ia+sa-1), sa);
+ do_search(Iter1(ia), Iter1(ia+sa), Iter2(ia+sa-3), Iter2(ia+sa), Iter1(ia+sa-3), 3*sa);
+ do_search(Iter1(ia), Iter1(ia+sa), Iter2(ia), Iter2(ia+sa), Iter1(ia), sa*sa);
+ do_search(Iter1(ia), Iter1(ia+sa-1), Iter2(ia), Iter2(ia+sa), Iter1(ia+sa-1), (sa-1)*sa);
+ do_search(Iter1(ia), Iter1(ia+1), Iter2(ia), Iter2(ia+sa), Iter1(ia+1), sa);
+ int ib[] = {0, 1, 2, 0, 1, 2, 3, 0, 1, 2, 3, 4};
+ const unsigned sb = sizeof(ib)/sizeof(ib[0]);
+ int ic[] = {1};
+ do_search(Iter1(ib), Iter1(ib+sb), Iter2(ic), Iter2(ic+1), Iter1(ib+1), sb);
+ int id[] = {1, 2};
+ do_search(Iter1(ib), Iter1(ib+sb), Iter2(id), Iter2(id+2), Iter1(ib+1), sb*2);
+ int ie[] = {1, 2, 3};
+ do_search(Iter1(ib), Iter1(ib+sb), Iter2(ie), Iter2(ie+3), Iter1(ib+4), sb*3);
+ int ig[] = {1, 2, 3, 4};
+ do_search(Iter1(ib), Iter1(ib+sb), Iter2(ig), Iter2(ig+4), Iter1(ib+8), sb*4);
+ int ih[] = {0, 1, 1, 1, 1, 2, 3, 0, 1, 2, 3, 4};
+ const unsigned sh = sizeof(ih)/sizeof(ih[0]);
+ int ii[] = {1, 1, 2};
+ do_search(Iter1(ih), Iter1(ih+sh), Iter2(ii), Iter2(ii+3), Iter1(ih+3), sh*3);
+}
+
+template <class Iter1, class Iter2>
+void
+test2()
+{
+ char ia[] = {0, 1, 2, 3, 4, 5};
+ const unsigned sa = sizeof(ia)/sizeof(ia[0]);
+ do_search(Iter1(ia), Iter1(ia+sa), Iter2(ia), Iter2(ia), Iter1(ia), 0);
+ do_search(Iter1(ia), Iter1(ia+sa), Iter2(ia), Iter2(ia+1), Iter1(ia), sa);
+ do_search(Iter1(ia), Iter1(ia+sa), Iter2(ia+1), Iter2(ia+2), Iter1(ia+1), sa);
+ do_search(Iter1(ia), Iter1(ia+sa), Iter2(ia+2), Iter2(ia+2), Iter1(ia), 0);
+ do_search(Iter1(ia), Iter1(ia+sa), Iter2(ia+2), Iter2(ia+3), Iter1(ia+2), sa);
+ do_search(Iter1(ia), Iter1(ia+sa), Iter2(ia+2), Iter2(ia+3), Iter1(ia+2), sa);
+ do_search(Iter1(ia), Iter1(ia), Iter2(ia+2), Iter2(ia+3), Iter1(ia), 0);
+ do_search(Iter1(ia), Iter1(ia+sa), Iter2(ia+sa-1), Iter2(ia+sa), Iter1(ia+sa-1), sa);
+ do_search(Iter1(ia), Iter1(ia+sa), Iter2(ia+sa-3), Iter2(ia+sa), Iter1(ia+sa-3), 3*sa);
+ do_search(Iter1(ia), Iter1(ia+sa), Iter2(ia), Iter2(ia+sa), Iter1(ia), sa*sa);
+ do_search(Iter1(ia), Iter1(ia+sa-1), Iter2(ia), Iter2(ia+sa), Iter1(ia+sa-1), (sa-1)*sa);
+ do_search(Iter1(ia), Iter1(ia+1), Iter2(ia), Iter2(ia+sa), Iter1(ia+1), sa);
+ char ib[] = {0, 1, 2, 0, 1, 2, 3, 0, 1, 2, 3, 4};
+ const unsigned sb = sizeof(ib)/sizeof(ib[0]);
+ char ic[] = {1};
+ do_search(Iter1(ib), Iter1(ib+sb), Iter2(ic), Iter2(ic+1), Iter1(ib+1), sb);
+ char id[] = {1, 2};
+ do_search(Iter1(ib), Iter1(ib+sb), Iter2(id), Iter2(id+2), Iter1(ib+1), sb*2);
+ char ie[] = {1, 2, 3};
+ do_search(Iter1(ib), Iter1(ib+sb), Iter2(ie), Iter2(ie+3), Iter1(ib+4), sb*3);
+ char ig[] = {1, 2, 3, 4};
+ do_search(Iter1(ib), Iter1(ib+sb), Iter2(ig), Iter2(ig+4), Iter1(ib+8), sb*4);
+ char ih[] = {0, 1, 1, 1, 1, 2, 3, 0, 1, 2, 3, 4};
+ const unsigned sh = sizeof(ih)/sizeof(ih[0]);
+ char ii[] = {1, 1, 2};
+ do_search(Iter1(ih), Iter1(ih+sh), Iter2(ii), Iter2(ii+3), Iter1(ih+3), sh*3);
+}
+
+int main() {
+ test<random_access_iterator<const int*>, random_access_iterator<const int*> >();
+ test2<random_access_iterator<const char*>, random_access_iterator<const char*> >();
+}
diff --git a/test/std/experimental/func/func.searchers/func.searchers.boyer_moore/hash.pred.pass.cpp b/test/std/experimental/func/func.searchers/func.searchers.boyer_moore/hash.pred.pass.cpp
new file mode 100644
index 000000000000..8fd5b8c9f784
--- /dev/null
+++ b/test/std/experimental/func/func.searchers/func.searchers.boyer_moore/hash.pred.pass.cpp
@@ -0,0 +1,135 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file 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
+
+// <functional>
+
+// boyer_moore searcher
+// template<class RandomAccessIterator1,
+// class Hash = hash<typename iterator_traits<RandomAccessIterator1>::value_type>,
+// class BinaryPredicate = equal_to<>>
+// class boyer_moore_searcher {
+// public:
+// boyer_moore_searcher(RandomAccessIterator1 pat_first, RandomAccessIterator1 pat_last,
+// Hash hf = Hash(), BinaryPredicate pred = BinaryPredicate());
+//
+// template<class RandomAccessIterator2>
+// RandomAccessIterator2
+// operator()(RandomAccessIterator2 first, RandomAccessIterator2 last) const;
+//
+// private:
+// RandomAccessIterator1 pat_first_; // exposition only
+// RandomAccessIterator1 pat_last_; // exposition only
+// Hash hash_; // exposition only
+// BinaryPredicate pred_; // exposition only
+// };
+
+
+#include <experimental/algorithm>
+#include <experimental/functional>
+#include <cassert>
+
+#include "test_iterators.h"
+
+template <typename T> struct MyHash {
+ size_t operator () (T t) const { return static_cast<size_t>(t); }
+};
+
+struct count_equal
+{
+ static unsigned count;
+ template <class T>
+ bool operator()(const T& x, const T& y) const
+ {++count; return x == y;}
+};
+
+unsigned count_equal::count = 0;
+
+template <typename Iter1, typename Iter2>
+void do_search(Iter1 b1, Iter1 e1, Iter2 b2, Iter2 e2, Iter1 result, unsigned max_count) {
+ std::experimental::boyer_moore_searcher<Iter2,
+ MyHash<typename std::remove_cv<typename std::iterator_traits<Iter2>::value_type>::type>,
+ count_equal>
+ s{b2, e2};
+ assert(result == std::experimental::search(b1, e1, s));
+}
+
+template <class Iter1, class Iter2>
+void
+test()
+{
+ int ia[] = {0, 1, 2, 3, 4, 5};
+ const unsigned sa = sizeof(ia)/sizeof(ia[0]);
+ do_search(Iter1(ia), Iter1(ia+sa), Iter2(ia), Iter2(ia), Iter1(ia), 0);
+ do_search(Iter1(ia), Iter1(ia+sa), Iter2(ia), Iter2(ia+1), Iter1(ia), sa);
+ do_search(Iter1(ia), Iter1(ia+sa), Iter2(ia+1), Iter2(ia+2), Iter1(ia+1), sa);
+ do_search(Iter1(ia), Iter1(ia+sa), Iter2(ia+2), Iter2(ia+2), Iter1(ia), 0);
+ do_search(Iter1(ia), Iter1(ia+sa), Iter2(ia+2), Iter2(ia+3), Iter1(ia+2), sa);
+ do_search(Iter1(ia), Iter1(ia+sa), Iter2(ia+2), Iter2(ia+3), Iter1(ia+2), sa);
+ do_search(Iter1(ia), Iter1(ia), Iter2(ia+2), Iter2(ia+3), Iter1(ia), 0);
+ do_search(Iter1(ia), Iter1(ia+sa), Iter2(ia+sa-1), Iter2(ia+sa), Iter1(ia+sa-1), sa);
+ do_search(Iter1(ia), Iter1(ia+sa), Iter2(ia+sa-3), Iter2(ia+sa), Iter1(ia+sa-3), 3*sa);
+ do_search(Iter1(ia), Iter1(ia+sa), Iter2(ia), Iter2(ia+sa), Iter1(ia), sa*sa);
+ do_search(Iter1(ia), Iter1(ia+sa-1), Iter2(ia), Iter2(ia+sa), Iter1(ia+sa-1), (sa-1)*sa);
+ do_search(Iter1(ia), Iter1(ia+1), Iter2(ia), Iter2(ia+sa), Iter1(ia+1), sa);
+ int ib[] = {0, 1, 2, 0, 1, 2, 3, 0, 1, 2, 3, 4};
+ const unsigned sb = sizeof(ib)/sizeof(ib[0]);
+ int ic[] = {1};
+ do_search(Iter1(ib), Iter1(ib+sb), Iter2(ic), Iter2(ic+1), Iter1(ib+1), sb);
+ int id[] = {1, 2};
+ do_search(Iter1(ib), Iter1(ib+sb), Iter2(id), Iter2(id+2), Iter1(ib+1), sb*2);
+ int ie[] = {1, 2, 3};
+ do_search(Iter1(ib), Iter1(ib+sb), Iter2(ie), Iter2(ie+3), Iter1(ib+4), sb*3);
+ int ig[] = {1, 2, 3, 4};
+ do_search(Iter1(ib), Iter1(ib+sb), Iter2(ig), Iter2(ig+4), Iter1(ib+8), sb*4);
+ int ih[] = {0, 1, 1, 1, 1, 2, 3, 0, 1, 2, 3, 4};
+ const unsigned sh = sizeof(ih)/sizeof(ih[0]);
+ int ii[] = {1, 1, 2};
+ do_search(Iter1(ih), Iter1(ih+sh), Iter2(ii), Iter2(ii+3), Iter1(ih+3), sh*3);
+}
+
+template <class Iter1, class Iter2>
+void
+test2()
+{
+ char ia[] = {0, 1, 2, 3, 4, 5};
+ const unsigned sa = sizeof(ia)/sizeof(ia[0]);
+ do_search(Iter1(ia), Iter1(ia+sa), Iter2(ia), Iter2(ia), Iter1(ia), 0);
+ do_search(Iter1(ia), Iter1(ia+sa), Iter2(ia), Iter2(ia+1), Iter1(ia), sa);
+ do_search(Iter1(ia), Iter1(ia+sa), Iter2(ia+1), Iter2(ia+2), Iter1(ia+1), sa);
+ do_search(Iter1(ia), Iter1(ia+sa), Iter2(ia+2), Iter2(ia+2), Iter1(ia), 0);
+ do_search(Iter1(ia), Iter1(ia+sa), Iter2(ia+2), Iter2(ia+3), Iter1(ia+2), sa);
+ do_search(Iter1(ia), Iter1(ia+sa), Iter2(ia+2), Iter2(ia+3), Iter1(ia+2), sa);
+ do_search(Iter1(ia), Iter1(ia), Iter2(ia+2), Iter2(ia+3), Iter1(ia), 0);
+ do_search(Iter1(ia), Iter1(ia+sa), Iter2(ia+sa-1), Iter2(ia+sa), Iter1(ia+sa-1), sa);
+ do_search(Iter1(ia), Iter1(ia+sa), Iter2(ia+sa-3), Iter2(ia+sa), Iter1(ia+sa-3), 3*sa);
+ do_search(Iter1(ia), Iter1(ia+sa), Iter2(ia), Iter2(ia+sa), Iter1(ia), sa*sa);
+ do_search(Iter1(ia), Iter1(ia+sa-1), Iter2(ia), Iter2(ia+sa), Iter1(ia+sa-1), (sa-1)*sa);
+ do_search(Iter1(ia), Iter1(ia+1), Iter2(ia), Iter2(ia+sa), Iter1(ia+1), sa);
+ char ib[] = {0, 1, 2, 0, 1, 2, 3, 0, 1, 2, 3, 4};
+ const unsigned sb = sizeof(ib)/sizeof(ib[0]);
+ char ic[] = {1};
+ do_search(Iter1(ib), Iter1(ib+sb), Iter2(ic), Iter2(ic+1), Iter1(ib+1), sb);
+ char id[] = {1, 2};
+ do_search(Iter1(ib), Iter1(ib+sb), Iter2(id), Iter2(id+2), Iter1(ib+1), sb*2);
+ char ie[] = {1, 2, 3};
+ do_search(Iter1(ib), Iter1(ib+sb), Iter2(ie), Iter2(ie+3), Iter1(ib+4), sb*3);
+ char ig[] = {1, 2, 3, 4};
+ do_search(Iter1(ib), Iter1(ib+sb), Iter2(ig), Iter2(ig+4), Iter1(ib+8), sb*4);
+ char ih[] = {0, 1, 1, 1, 1, 2, 3, 0, 1, 2, 3, 4};
+ const unsigned sh = sizeof(ih)/sizeof(ih[0]);
+ char ii[] = {1, 1, 2};
+ do_search(Iter1(ih), Iter1(ih+sh), Iter2(ii), Iter2(ii+3), Iter1(ih+3), sh*3);
+}
+
+int main() {
+ test<random_access_iterator<const int*>, random_access_iterator<const int*> >();
+ test2<random_access_iterator<const char*>, random_access_iterator<const char*> >();
+}
diff --git a/test/std/experimental/func/func.searchers/func.searchers.boyer_moore/pred.pass.cpp b/test/std/experimental/func/func.searchers/func.searchers.boyer_moore/pred.pass.cpp
new file mode 100644
index 000000000000..d0655c82febb
--- /dev/null
+++ b/test/std/experimental/func/func.searchers/func.searchers.boyer_moore/pred.pass.cpp
@@ -0,0 +1,131 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file 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
+
+// <functional>
+
+// boyer_moore searcher
+// template<class RandomAccessIterator1,
+// class Hash = hash<typename iterator_traits<RandomAccessIterator1>::value_type>,
+// class BinaryPredicate = equal_to<>>
+// class boyer_moore_searcher {
+// public:
+// boyer_moore_searcher(RandomAccessIterator1 pat_first, RandomAccessIterator1 pat_last,
+// Hash hf = Hash(), BinaryPredicate pred = BinaryPredicate());
+//
+// template<class RandomAccessIterator2>
+// RandomAccessIterator2
+// operator()(RandomAccessIterator2 first, RandomAccessIterator2 last) const;
+//
+// private:
+// RandomAccessIterator1 pat_first_; // exposition only
+// RandomAccessIterator1 pat_last_; // exposition only
+// Hash hash_; // exposition only
+// BinaryPredicate pred_; // exposition only
+// };
+
+
+#include <experimental/algorithm>
+#include <experimental/functional>
+#include <cassert>
+
+#include "test_iterators.h"
+
+struct count_equal
+{
+ static unsigned count;
+ template <class T>
+ bool operator()(const T& x, const T& y) const
+ {++count; return x == y;}
+};
+
+unsigned count_equal::count = 0;
+
+template <typename Iter1, typename Iter2>
+void do_search(Iter1 b1, Iter1 e1, Iter2 b2, Iter2 e2, Iter1 result, unsigned max_count) {
+ std::experimental::boyer_moore_searcher<Iter2,
+ typename std::hash<typename std::remove_cv<typename std::iterator_traits<Iter2>::value_type>::type>, count_equal> s{b2, e2};
+ count_equal::count = 0;
+ assert(result == std::experimental::search(b1, e1, s));
+// assert(count_equal::count <= max_count);
+}
+
+template <class Iter1, class Iter2>
+void
+test()
+{
+ int ia[] = {0, 1, 2, 3, 4, 5};
+ const unsigned sa = sizeof(ia)/sizeof(ia[0]);
+ do_search(Iter1(ia), Iter1(ia+sa), Iter2(ia), Iter2(ia), Iter1(ia), 0);
+ do_search(Iter1(ia), Iter1(ia+sa), Iter2(ia), Iter2(ia+1), Iter1(ia), sa);
+ do_search(Iter1(ia), Iter1(ia+sa), Iter2(ia+1), Iter2(ia+2), Iter1(ia+1), sa);
+ do_search(Iter1(ia), Iter1(ia+sa), Iter2(ia+2), Iter2(ia+2), Iter1(ia), 0);
+ do_search(Iter1(ia), Iter1(ia+sa), Iter2(ia+2), Iter2(ia+3), Iter1(ia+2), sa);
+ do_search(Iter1(ia), Iter1(ia+sa), Iter2(ia+2), Iter2(ia+3), Iter1(ia+2), sa);
+ do_search(Iter1(ia), Iter1(ia), Iter2(ia+2), Iter2(ia+3), Iter1(ia), 0);
+ do_search(Iter1(ia), Iter1(ia+sa), Iter2(ia+sa-1), Iter2(ia+sa), Iter1(ia+sa-1), sa);
+ do_search(Iter1(ia), Iter1(ia+sa), Iter2(ia+sa-3), Iter2(ia+sa), Iter1(ia+sa-3), 3*sa);
+ do_search(Iter1(ia), Iter1(ia+sa), Iter2(ia), Iter2(ia+sa), Iter1(ia), sa*sa);
+ do_search(Iter1(ia), Iter1(ia+sa-1), Iter2(ia), Iter2(ia+sa), Iter1(ia+sa-1), (sa-1)*sa);
+ do_search(Iter1(ia), Iter1(ia+1), Iter2(ia), Iter2(ia+sa), Iter1(ia+1), sa);
+ int ib[] = {0, 1, 2, 0, 1, 2, 3, 0, 1, 2, 3, 4};
+ const unsigned sb = sizeof(ib)/sizeof(ib[0]);
+ int ic[] = {1};
+ do_search(Iter1(ib), Iter1(ib+sb), Iter2(ic), Iter2(ic+1), Iter1(ib+1), sb);
+ int id[] = {1, 2};
+ do_search(Iter1(ib), Iter1(ib+sb), Iter2(id), Iter2(id+2), Iter1(ib+1), sb*2);
+ int ie[] = {1, 2, 3};
+ do_search(Iter1(ib), Iter1(ib+sb), Iter2(ie), Iter2(ie+3), Iter1(ib+4), sb*3);
+ int ig[] = {1, 2, 3, 4};
+ do_search(Iter1(ib), Iter1(ib+sb), Iter2(ig), Iter2(ig+4), Iter1(ib+8), sb*4);
+ int ih[] = {0, 1, 1, 1, 1, 2, 3, 0, 1, 2, 3, 4};
+ const unsigned sh = sizeof(ih)/sizeof(ih[0]);
+ int ii[] = {1, 1, 2};
+ do_search(Iter1(ih), Iter1(ih+sh), Iter2(ii), Iter2(ii+3), Iter1(ih+3), sh*3);
+}
+
+template <class Iter1, class Iter2>
+void
+test2()
+{
+ char ia[] = {0, 1, 2, 3, 4, 5};
+ const unsigned sa = sizeof(ia)/sizeof(ia[0]);
+ do_search(Iter1(ia), Iter1(ia+sa), Iter2(ia), Iter2(ia), Iter1(ia), 0);
+ do_search(Iter1(ia), Iter1(ia+sa), Iter2(ia), Iter2(ia+1), Iter1(ia), sa);
+ do_search(Iter1(ia), Iter1(ia+sa), Iter2(ia+1), Iter2(ia+2), Iter1(ia+1), sa);
+ do_search(Iter1(ia), Iter1(ia+sa), Iter2(ia+2), Iter2(ia+2), Iter1(ia), 0);
+ do_search(Iter1(ia), Iter1(ia+sa), Iter2(ia+2), Iter2(ia+3), Iter1(ia+2), sa);
+ do_search(Iter1(ia), Iter1(ia+sa), Iter2(ia+2), Iter2(ia+3), Iter1(ia+2), sa);
+ do_search(Iter1(ia), Iter1(ia), Iter2(ia+2), Iter2(ia+3), Iter1(ia), 0);
+ do_search(Iter1(ia), Iter1(ia+sa), Iter2(ia+sa-1), Iter2(ia+sa), Iter1(ia+sa-1), sa);
+ do_search(Iter1(ia), Iter1(ia+sa), Iter2(ia+sa-3), Iter2(ia+sa), Iter1(ia+sa-3), 3*sa);
+ do_search(Iter1(ia), Iter1(ia+sa), Iter2(ia), Iter2(ia+sa), Iter1(ia), sa*sa);
+ do_search(Iter1(ia), Iter1(ia+sa-1), Iter2(ia), Iter2(ia+sa), Iter1(ia+sa-1), (sa-1)*sa);
+ do_search(Iter1(ia), Iter1(ia+1), Iter2(ia), Iter2(ia+sa), Iter1(ia+1), sa);
+ char ib[] = {0, 1, 2, 0, 1, 2, 3, 0, 1, 2, 3, 4};
+ const unsigned sb = sizeof(ib)/sizeof(ib[0]);
+ char ic[] = {1};
+ do_search(Iter1(ib), Iter1(ib+sb), Iter2(ic), Iter2(ic+1), Iter1(ib+1), sb);
+ char id[] = {1, 2};
+ do_search(Iter1(ib), Iter1(ib+sb), Iter2(id), Iter2(id+2), Iter1(ib+1), sb*2);
+ char ie[] = {1, 2, 3};
+ do_search(Iter1(ib), Iter1(ib+sb), Iter2(ie), Iter2(ie+3), Iter1(ib+4), sb*3);
+ char ig[] = {1, 2, 3, 4};
+ do_search(Iter1(ib), Iter1(ib+sb), Iter2(ig), Iter2(ig+4), Iter1(ib+8), sb*4);
+ char ih[] = {0, 1, 1, 1, 1, 2, 3, 0, 1, 2, 3, 4};
+ const unsigned sh = sizeof(ih)/sizeof(ih[0]);
+ char ii[] = {1, 1, 2};
+ do_search(Iter1(ih), Iter1(ih+sh), Iter2(ii), Iter2(ii+3), Iter1(ih+3), sh*3);
+}
+
+int main() {
+ test<random_access_iterator<const int*>, random_access_iterator<const int*> >();
+ test2<random_access_iterator<const char*>, random_access_iterator<const char*> >();
+}
diff --git a/test/std/experimental/func/func.searchers/func.searchers.boyer_moore_horspool/default.pass.cpp b/test/std/experimental/func/func.searchers/func.searchers.boyer_moore_horspool/default.pass.cpp
new file mode 100644
index 000000000000..af3bbbafb24e
--- /dev/null
+++ b/test/std/experimental/func/func.searchers/func.searchers.boyer_moore_horspool/default.pass.cpp
@@ -0,0 +1,128 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file 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
+
+// <functional>
+
+// boyer_moore_horspool searcher
+// template<class RandomAccessIterator1,
+// class Hash = hash<typename iterator_traits<RandomAccessIterator1>::value_type>,
+// class BinaryPredicate = equal_to<>>
+// class boyer_moore_horspool_searcher {
+// public:
+// boyer_moore_horspool_searcher(RandomAccessIterator1 pat_first, RandomAccessIterator1 pat_last,
+// Hash hf = Hash(), BinaryPredicate pred = BinaryPredicate());
+//
+// template<class RandomAccessIterator2>
+// RandomAccessIterator2
+// operator()(RandomAccessIterator2 first, RandomAccessIterator2 last) const;
+//
+// private:
+// RandomAccessIterator1 pat_first_; // exposition only
+// RandomAccessIterator1 pat_last_; // exposition only
+// Hash hash_; // exposition only
+// BinaryPredicate pred_; // exposition only
+// };
+
+
+#include <experimental/algorithm>
+#include <experimental/functional>
+#include <cassert>
+
+#include "test_iterators.h"
+
+template <typename Iter1, typename Iter2>
+void do_search(Iter1 b1, Iter1 e1, Iter2 b2, Iter2 e2, Iter1 result) {
+ std::experimental::boyer_moore_horspool_searcher<Iter2> s{b2, e2};
+ assert(result == std::experimental::search(b1, e1, s));
+}
+
+template <class Iter1, class Iter2>
+void
+test()
+{
+ int ia[] = {0, 1, 2, 3, 4, 5};
+ const unsigned sa = sizeof(ia)/sizeof(ia[0]);
+ do_search(Iter1(ia), Iter1(ia+sa), Iter2(ia), Iter2(ia), Iter1(ia));
+ do_search(Iter1(ia), Iter1(ia+sa), Iter2(ia), Iter2(ia+1), Iter1(ia));
+ do_search(Iter1(ia), Iter1(ia+sa), Iter2(ia+1), Iter2(ia+2), Iter1(ia+1));
+ do_search(Iter1(ia), Iter1(ia+sa), Iter2(ia+2), Iter2(ia+2), Iter1(ia));
+ do_search(Iter1(ia), Iter1(ia+sa), Iter2(ia+2), Iter2(ia+3), Iter1(ia+2));
+ do_search(Iter1(ia), Iter1(ia+sa), Iter2(ia+2), Iter2(ia+3), Iter1(ia+2));
+ do_search(Iter1(ia), Iter1(ia), Iter2(ia+2), Iter2(ia+3), Iter1(ia));
+ do_search(Iter1(ia), Iter1(ia+sa), Iter2(ia+sa-1), Iter2(ia+sa), Iter1(ia+sa-1));
+ do_search(Iter1(ia), Iter1(ia+sa), Iter2(ia+sa-3), Iter2(ia+sa), Iter1(ia+sa-3));
+ do_search(Iter1(ia), Iter1(ia+sa), Iter2(ia), Iter2(ia+sa), Iter1(ia));
+ do_search(Iter1(ia), Iter1(ia+sa-1), Iter2(ia), Iter2(ia+sa), Iter1(ia+sa-1));
+ do_search(Iter1(ia), Iter1(ia+1), Iter2(ia), Iter2(ia+sa), Iter1(ia+1));
+ int ib[] = {0, 1, 2, 0, 1, 2, 3, 0, 1, 2, 3, 4};
+ const unsigned sb = sizeof(ib)/sizeof(ib[0]);
+ int ic[] = {1};
+ do_search(Iter1(ib), Iter1(ib+sb), Iter2(ic), Iter2(ic+1), Iter1(ib+1));
+ int id[] = {1, 2};
+ do_search(Iter1(ib), Iter1(ib+sb), Iter2(id), Iter2(id+2), Iter1(ib+1));
+ int ie[] = {1, 2, 3};
+ do_search(Iter1(ib), Iter1(ib+sb), Iter2(ie), Iter2(ie+3), Iter1(ib+4));
+ int ig[] = {1, 2, 3, 4};
+ do_search(Iter1(ib), Iter1(ib+sb), Iter2(ig), Iter2(ig+4), Iter1(ib+8));
+ int ih[] = {0, 1, 1, 1, 1, 2, 3, 0, 1, 2, 3, 4};
+ const unsigned sh = sizeof(ih)/sizeof(ih[0]);
+ int ii[] = {1, 1, 2};
+ do_search(Iter1(ih), Iter1(ih+sh), Iter2(ii), Iter2(ii+3), Iter1(ih+3));
+ int ij[] = {0, 1, 0, 0, 1, 0, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0};
+ const unsigned sj = sizeof(ij)/sizeof(ij[0]);
+ int ik[] = {0, 0, 0, 0, 1, 1, 1, 1, 0, 0};
+ const unsigned sk = sizeof(ik)/sizeof(ik[0]);
+ do_search(Iter1(ij), Iter1(ij+sj), Iter2(ik), Iter2(ik+sk), Iter1(ij+6));
+}
+
+template <class Iter1, class Iter2>
+void
+test2()
+{
+ char ia[] = {0, 1, 2, 3, 4, 5};
+ const unsigned sa = sizeof(ia)/sizeof(ia[0]);
+ do_search(Iter1(ia), Iter1(ia+sa), Iter2(ia), Iter2(ia), Iter1(ia));
+ do_search(Iter1(ia), Iter1(ia+sa), Iter2(ia), Iter2(ia+1), Iter1(ia));
+ do_search(Iter1(ia), Iter1(ia+sa), Iter2(ia+1), Iter2(ia+2), Iter1(ia+1));
+ do_search(Iter1(ia), Iter1(ia+sa), Iter2(ia+2), Iter2(ia+2), Iter1(ia));
+ do_search(Iter1(ia), Iter1(ia+sa), Iter2(ia+2), Iter2(ia+3), Iter1(ia+2));
+ do_search(Iter1(ia), Iter1(ia+sa), Iter2(ia+2), Iter2(ia+3), Iter1(ia+2));
+ do_search(Iter1(ia), Iter1(ia), Iter2(ia+2), Iter2(ia+3), Iter1(ia));
+ do_search(Iter1(ia), Iter1(ia+sa), Iter2(ia+sa-1), Iter2(ia+sa), Iter1(ia+sa-1));
+ do_search(Iter1(ia), Iter1(ia+sa), Iter2(ia+sa-3), Iter2(ia+sa), Iter1(ia+sa-3));
+ do_search(Iter1(ia), Iter1(ia+sa), Iter2(ia), Iter2(ia+sa), Iter1(ia));
+ do_search(Iter1(ia), Iter1(ia+sa-1), Iter2(ia), Iter2(ia+sa), Iter1(ia+sa-1));
+ do_search(Iter1(ia), Iter1(ia+1), Iter2(ia), Iter2(ia+sa), Iter1(ia+1));
+ char ib[] = {0, 1, 2, 0, 1, 2, 3, 0, 1, 2, 3, 4};
+ const unsigned sb = sizeof(ib)/sizeof(ib[0]);
+ char ic[] = {1};
+ do_search(Iter1(ib), Iter1(ib+sb), Iter2(ic), Iter2(ic+1), Iter1(ib+1));
+ char id[] = {1, 2};
+ do_search(Iter1(ib), Iter1(ib+sb), Iter2(id), Iter2(id+2), Iter1(ib+1));
+ char ie[] = {1, 2, 3};
+ do_search(Iter1(ib), Iter1(ib+sb), Iter2(ie), Iter2(ie+3), Iter1(ib+4));
+ char ig[] = {1, 2, 3, 4};
+ do_search(Iter1(ib), Iter1(ib+sb), Iter2(ig), Iter2(ig+4), Iter1(ib+8));
+ char ih[] = {0, 1, 1, 1, 1, 2, 3, 0, 1, 2, 3, 4};
+ const unsigned sh = sizeof(ih)/sizeof(ih[0]);
+ char ii[] = {1, 1, 2};
+ do_search(Iter1(ih), Iter1(ih+sh), Iter2(ii), Iter2(ii+3), Iter1(ih+3));
+ char ij[] = {0, 1, 0, 0, 1, 0, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0};
+ const unsigned sj = sizeof(ij)/sizeof(ij[0]);
+ char ik[] = {0, 0, 0, 0, 1, 1, 1, 1, 0, 0};
+ const unsigned sk = sizeof(ik)/sizeof(ik[0]);
+ do_search(Iter1(ij), Iter1(ij+sj), Iter2(ik), Iter2(ik+sk), Iter1(ij+6));
+}
+
+int main() {
+ test<random_access_iterator<const int*>, random_access_iterator<const int*> >();
+ test2<random_access_iterator<const char*>, random_access_iterator<const char*> >();
+}
diff --git a/test/std/experimental/func/func.searchers/func.searchers.boyer_moore_horspool/hash.pass.cpp b/test/std/experimental/func/func.searchers/func.searchers.boyer_moore_horspool/hash.pass.cpp
new file mode 100644
index 000000000000..ff289f0edeb0
--- /dev/null
+++ b/test/std/experimental/func/func.searchers/func.searchers.boyer_moore_horspool/hash.pass.cpp
@@ -0,0 +1,123 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file 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
+
+// <functional>
+
+// boyer_moore_horspool searcher
+// template<class RandomAccessIterator1,
+// class Hash = hash<typename iterator_traits<RandomAccessIterator1>::value_type>,
+// class BinaryPredicate = equal_to<>>
+// class boyer_moore_horspool_searcher {
+// public:
+// boyer_moore_horspool_searcher(RandomAccessIterator1 pat_first, RandomAccessIterator1 pat_last,
+// Hash hf = Hash(), BinaryPredicate pred = BinaryPredicate());
+//
+// template<class RandomAccessIterator2>
+// RandomAccessIterator2
+// operator()(RandomAccessIterator2 first, RandomAccessIterator2 last) const;
+//
+// private:
+// RandomAccessIterator1 pat_first_; // exposition only
+// RandomAccessIterator1 pat_last_; // exposition only
+// Hash hash_; // exposition only
+// BinaryPredicate pred_; // exposition only
+// };
+
+#include <experimental/algorithm>
+#include <experimental/functional>
+#include <cassert>
+
+#include "test_iterators.h"
+
+template <typename T> struct MyHash {
+ size_t operator () (T t) const { return static_cast<size_t>(t); }
+};
+
+template <typename Iter1, typename Iter2>
+void do_search(Iter1 b1, Iter1 e1, Iter2 b2, Iter2 e2, Iter1 result, unsigned max_count) {
+ std::experimental::boyer_moore_horspool_searcher<Iter2,
+ MyHash<typename std::remove_cv<typename std::iterator_traits<Iter2>::value_type>::type>>
+ s{b2, e2};
+ assert(result == std::experimental::search(b1, e1, s));
+}
+
+template <class Iter1, class Iter2>
+void
+test()
+{
+ int ia[] = {0, 1, 2, 3, 4, 5};
+ const unsigned sa = sizeof(ia)/sizeof(ia[0]);
+ do_search(Iter1(ia), Iter1(ia+sa), Iter2(ia), Iter2(ia), Iter1(ia), 0);
+ do_search(Iter1(ia), Iter1(ia+sa), Iter2(ia), Iter2(ia+1), Iter1(ia), sa);
+ do_search(Iter1(ia), Iter1(ia+sa), Iter2(ia+1), Iter2(ia+2), Iter1(ia+1), sa);
+ do_search(Iter1(ia), Iter1(ia+sa), Iter2(ia+2), Iter2(ia+2), Iter1(ia), 0);
+ do_search(Iter1(ia), Iter1(ia+sa), Iter2(ia+2), Iter2(ia+3), Iter1(ia+2), sa);
+ do_search(Iter1(ia), Iter1(ia+sa), Iter2(ia+2), Iter2(ia+3), Iter1(ia+2), sa);
+ do_search(Iter1(ia), Iter1(ia), Iter2(ia+2), Iter2(ia+3), Iter1(ia), 0);
+ do_search(Iter1(ia), Iter1(ia+sa), Iter2(ia+sa-1), Iter2(ia+sa), Iter1(ia+sa-1), sa);
+ do_search(Iter1(ia), Iter1(ia+sa), Iter2(ia+sa-3), Iter2(ia+sa), Iter1(ia+sa-3), 3*sa);
+ do_search(Iter1(ia), Iter1(ia+sa), Iter2(ia), Iter2(ia+sa), Iter1(ia), sa*sa);
+ do_search(Iter1(ia), Iter1(ia+sa-1), Iter2(ia), Iter2(ia+sa), Iter1(ia+sa-1), (sa-1)*sa);
+ do_search(Iter1(ia), Iter1(ia+1), Iter2(ia), Iter2(ia+sa), Iter1(ia+1), sa);
+ int ib[] = {0, 1, 2, 0, 1, 2, 3, 0, 1, 2, 3, 4};
+ const unsigned sb = sizeof(ib)/sizeof(ib[0]);
+ int ic[] = {1};
+ do_search(Iter1(ib), Iter1(ib+sb), Iter2(ic), Iter2(ic+1), Iter1(ib+1), sb);
+ int id[] = {1, 2};
+ do_search(Iter1(ib), Iter1(ib+sb), Iter2(id), Iter2(id+2), Iter1(ib+1), sb*2);
+ int ie[] = {1, 2, 3};
+ do_search(Iter1(ib), Iter1(ib+sb), Iter2(ie), Iter2(ie+3), Iter1(ib+4), sb*3);
+ int ig[] = {1, 2, 3, 4};
+ do_search(Iter1(ib), Iter1(ib+sb), Iter2(ig), Iter2(ig+4), Iter1(ib+8), sb*4);
+ int ih[] = {0, 1, 1, 1, 1, 2, 3, 0, 1, 2, 3, 4};
+ const unsigned sh = sizeof(ih)/sizeof(ih[0]);
+ int ii[] = {1, 1, 2};
+ do_search(Iter1(ih), Iter1(ih+sh), Iter2(ii), Iter2(ii+3), Iter1(ih+3), sh*3);
+}
+
+template <class Iter1, class Iter2>
+void
+test2()
+{
+ char ia[] = {0, 1, 2, 3, 4, 5};
+ const unsigned sa = sizeof(ia)/sizeof(ia[0]);
+ do_search(Iter1(ia), Iter1(ia+sa), Iter2(ia), Iter2(ia), Iter1(ia), 0);
+ do_search(Iter1(ia), Iter1(ia+sa), Iter2(ia), Iter2(ia+1), Iter1(ia), sa);
+ do_search(Iter1(ia), Iter1(ia+sa), Iter2(ia+1), Iter2(ia+2), Iter1(ia+1), sa);
+ do_search(Iter1(ia), Iter1(ia+sa), Iter2(ia+2), Iter2(ia+2), Iter1(ia), 0);
+ do_search(Iter1(ia), Iter1(ia+sa), Iter2(ia+2), Iter2(ia+3), Iter1(ia+2), sa);
+ do_search(Iter1(ia), Iter1(ia+sa), Iter2(ia+2), Iter2(ia+3), Iter1(ia+2), sa);
+ do_search(Iter1(ia), Iter1(ia), Iter2(ia+2), Iter2(ia+3), Iter1(ia), 0);
+ do_search(Iter1(ia), Iter1(ia+sa), Iter2(ia+sa-1), Iter2(ia+sa), Iter1(ia+sa-1), sa);
+ do_search(Iter1(ia), Iter1(ia+sa), Iter2(ia+sa-3), Iter2(ia+sa), Iter1(ia+sa-3), 3*sa);
+ do_search(Iter1(ia), Iter1(ia+sa), Iter2(ia), Iter2(ia+sa), Iter1(ia), sa*sa);
+ do_search(Iter1(ia), Iter1(ia+sa-1), Iter2(ia), Iter2(ia+sa), Iter1(ia+sa-1), (sa-1)*sa);
+ do_search(Iter1(ia), Iter1(ia+1), Iter2(ia), Iter2(ia+sa), Iter1(ia+1), sa);
+ char ib[] = {0, 1, 2, 0, 1, 2, 3, 0, 1, 2, 3, 4};
+ const unsigned sb = sizeof(ib)/sizeof(ib[0]);
+ char ic[] = {1};
+ do_search(Iter1(ib), Iter1(ib+sb), Iter2(ic), Iter2(ic+1), Iter1(ib+1), sb);
+ char id[] = {1, 2};
+ do_search(Iter1(ib), Iter1(ib+sb), Iter2(id), Iter2(id+2), Iter1(ib+1), sb*2);
+ char ie[] = {1, 2, 3};
+ do_search(Iter1(ib), Iter1(ib+sb), Iter2(ie), Iter2(ie+3), Iter1(ib+4), sb*3);
+ char ig[] = {1, 2, 3, 4};
+ do_search(Iter1(ib), Iter1(ib+sb), Iter2(ig), Iter2(ig+4), Iter1(ib+8), sb*4);
+ char ih[] = {0, 1, 1, 1, 1, 2, 3, 0, 1, 2, 3, 4};
+ const unsigned sh = sizeof(ih)/sizeof(ih[0]);
+ char ii[] = {1, 1, 2};
+ do_search(Iter1(ih), Iter1(ih+sh), Iter2(ii), Iter2(ii+3), Iter1(ih+3), sh*3);
+}
+
+int main() {
+ test<random_access_iterator<const int*>, random_access_iterator<const int*> >();
+ test2<random_access_iterator<const char*>, random_access_iterator<const char*> >();
+}
diff --git a/test/std/experimental/func/func.searchers/func.searchers.boyer_moore_horspool/hash.pred.pass.cpp b/test/std/experimental/func/func.searchers/func.searchers.boyer_moore_horspool/hash.pred.pass.cpp
new file mode 100644
index 000000000000..1150210a978a
--- /dev/null
+++ b/test/std/experimental/func/func.searchers/func.searchers.boyer_moore_horspool/hash.pred.pass.cpp
@@ -0,0 +1,134 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file 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
+
+// <functional>
+
+// boyer_moore_horspool searcher
+// template<class RandomAccessIterator1,
+// class Hash = hash<typename iterator_traits<RandomAccessIterator1>::value_type>,
+// class BinaryPredicate = equal_to<>>
+// class boyer_moore_horspool_searcher {
+// public:
+// boyer_moore_horspool_searcher(RandomAccessIterator1 pat_first, RandomAccessIterator1 pat_last,
+// Hash hf = Hash(), BinaryPredicate pred = BinaryPredicate());
+//
+// template<class RandomAccessIterator2>
+// RandomAccessIterator2
+// operator()(RandomAccessIterator2 first, RandomAccessIterator2 last) const;
+//
+// private:
+// RandomAccessIterator1 pat_first_; // exposition only
+// RandomAccessIterator1 pat_last_; // exposition only
+// Hash hash_; // exposition only
+// BinaryPredicate pred_; // exposition only
+// };
+
+#include <experimental/algorithm>
+#include <experimental/functional>
+#include <cassert>
+
+#include "test_iterators.h"
+
+template <typename T> struct MyHash {
+ size_t operator () (T t) const { return static_cast<size_t>(t); }
+};
+
+struct count_equal
+{
+ static unsigned count;
+ template <class T>
+ bool operator()(const T& x, const T& y) const
+ {++count; return x == y;}
+};
+
+unsigned count_equal::count = 0;
+
+template <typename Iter1, typename Iter2>
+void do_search(Iter1 b1, Iter1 e1, Iter2 b2, Iter2 e2, Iter1 result, unsigned max_count) {
+ std::experimental::boyer_moore_horspool_searcher<Iter2,
+ MyHash<typename std::remove_cv<typename std::iterator_traits<Iter2>::value_type>::type>,
+ count_equal>
+ s{b2, e2};
+ assert(result == std::experimental::search(b1, e1, s));
+}
+
+template <class Iter1, class Iter2>
+void
+test()
+{
+ int ia[] = {0, 1, 2, 3, 4, 5};
+ const unsigned sa = sizeof(ia)/sizeof(ia[0]);
+ do_search(Iter1(ia), Iter1(ia+sa), Iter2(ia), Iter2(ia), Iter1(ia), 0);
+ do_search(Iter1(ia), Iter1(ia+sa), Iter2(ia), Iter2(ia+1), Iter1(ia), sa);
+ do_search(Iter1(ia), Iter1(ia+sa), Iter2(ia+1), Iter2(ia+2), Iter1(ia+1), sa);
+ do_search(Iter1(ia), Iter1(ia+sa), Iter2(ia+2), Iter2(ia+2), Iter1(ia), 0);
+ do_search(Iter1(ia), Iter1(ia+sa), Iter2(ia+2), Iter2(ia+3), Iter1(ia+2), sa);
+ do_search(Iter1(ia), Iter1(ia+sa), Iter2(ia+2), Iter2(ia+3), Iter1(ia+2), sa);
+ do_search(Iter1(ia), Iter1(ia), Iter2(ia+2), Iter2(ia+3), Iter1(ia), 0);
+ do_search(Iter1(ia), Iter1(ia+sa), Iter2(ia+sa-1), Iter2(ia+sa), Iter1(ia+sa-1), sa);
+ do_search(Iter1(ia), Iter1(ia+sa), Iter2(ia+sa-3), Iter2(ia+sa), Iter1(ia+sa-3), 3*sa);
+ do_search(Iter1(ia), Iter1(ia+sa), Iter2(ia), Iter2(ia+sa), Iter1(ia), sa*sa);
+ do_search(Iter1(ia), Iter1(ia+sa-1), Iter2(ia), Iter2(ia+sa), Iter1(ia+sa-1), (sa-1)*sa);
+ do_search(Iter1(ia), Iter1(ia+1), Iter2(ia), Iter2(ia+sa), Iter1(ia+1), sa);
+ int ib[] = {0, 1, 2, 0, 1, 2, 3, 0, 1, 2, 3, 4};
+ const unsigned sb = sizeof(ib)/sizeof(ib[0]);
+ int ic[] = {1};
+ do_search(Iter1(ib), Iter1(ib+sb), Iter2(ic), Iter2(ic+1), Iter1(ib+1), sb);
+ int id[] = {1, 2};
+ do_search(Iter1(ib), Iter1(ib+sb), Iter2(id), Iter2(id+2), Iter1(ib+1), sb*2);
+ int ie[] = {1, 2, 3};
+ do_search(Iter1(ib), Iter1(ib+sb), Iter2(ie), Iter2(ie+3), Iter1(ib+4), sb*3);
+ int ig[] = {1, 2, 3, 4};
+ do_search(Iter1(ib), Iter1(ib+sb), Iter2(ig), Iter2(ig+4), Iter1(ib+8), sb*4);
+ int ih[] = {0, 1, 1, 1, 1, 2, 3, 0, 1, 2, 3, 4};
+ const unsigned sh = sizeof(ih)/sizeof(ih[0]);
+ int ii[] = {1, 1, 2};
+ do_search(Iter1(ih), Iter1(ih+sh), Iter2(ii), Iter2(ii+3), Iter1(ih+3), sh*3);
+}
+
+template <class Iter1, class Iter2>
+void
+test2()
+{
+ char ia[] = {0, 1, 2, 3, 4, 5};
+ const unsigned sa = sizeof(ia)/sizeof(ia[0]);
+ do_search(Iter1(ia), Iter1(ia+sa), Iter2(ia), Iter2(ia), Iter1(ia), 0);
+ do_search(Iter1(ia), Iter1(ia+sa), Iter2(ia), Iter2(ia+1), Iter1(ia), sa);
+ do_search(Iter1(ia), Iter1(ia+sa), Iter2(ia+1), Iter2(ia+2), Iter1(ia+1), sa);
+ do_search(Iter1(ia), Iter1(ia+sa), Iter2(ia+2), Iter2(ia+2), Iter1(ia), 0);
+ do_search(Iter1(ia), Iter1(ia+sa), Iter2(ia+2), Iter2(ia+3), Iter1(ia+2), sa);
+ do_search(Iter1(ia), Iter1(ia+sa), Iter2(ia+2), Iter2(ia+3), Iter1(ia+2), sa);
+ do_search(Iter1(ia), Iter1(ia), Iter2(ia+2), Iter2(ia+3), Iter1(ia), 0);
+ do_search(Iter1(ia), Iter1(ia+sa), Iter2(ia+sa-1), Iter2(ia+sa), Iter1(ia+sa-1), sa);
+ do_search(Iter1(ia), Iter1(ia+sa), Iter2(ia+sa-3), Iter2(ia+sa), Iter1(ia+sa-3), 3*sa);
+ do_search(Iter1(ia), Iter1(ia+sa), Iter2(ia), Iter2(ia+sa), Iter1(ia), sa*sa);
+ do_search(Iter1(ia), Iter1(ia+sa-1), Iter2(ia), Iter2(ia+sa), Iter1(ia+sa-1), (sa-1)*sa);
+ do_search(Iter1(ia), Iter1(ia+1), Iter2(ia), Iter2(ia+sa), Iter1(ia+1), sa);
+ char ib[] = {0, 1, 2, 0, 1, 2, 3, 0, 1, 2, 3, 4};
+ const unsigned sb = sizeof(ib)/sizeof(ib[0]);
+ char ic[] = {1};
+ do_search(Iter1(ib), Iter1(ib+sb), Iter2(ic), Iter2(ic+1), Iter1(ib+1), sb);
+ char id[] = {1, 2};
+ do_search(Iter1(ib), Iter1(ib+sb), Iter2(id), Iter2(id+2), Iter1(ib+1), sb*2);
+ char ie[] = {1, 2, 3};
+ do_search(Iter1(ib), Iter1(ib+sb), Iter2(ie), Iter2(ie+3), Iter1(ib+4), sb*3);
+ char ig[] = {1, 2, 3, 4};
+ do_search(Iter1(ib), Iter1(ib+sb), Iter2(ig), Iter2(ig+4), Iter1(ib+8), sb*4);
+ char ih[] = {0, 1, 1, 1, 1, 2, 3, 0, 1, 2, 3, 4};
+ const unsigned sh = sizeof(ih)/sizeof(ih[0]);
+ char ii[] = {1, 1, 2};
+ do_search(Iter1(ih), Iter1(ih+sh), Iter2(ii), Iter2(ii+3), Iter1(ih+3), sh*3);
+}
+
+int main() {
+ test<random_access_iterator<const int*>, random_access_iterator<const int*> >();
+ test2<random_access_iterator<const char*>, random_access_iterator<const char*> >();
+}
diff --git a/test/std/experimental/func/func.searchers/func.searchers.boyer_moore_horspool/pred.pass.cpp b/test/std/experimental/func/func.searchers/func.searchers.boyer_moore_horspool/pred.pass.cpp
new file mode 100644
index 000000000000..55426874abe5
--- /dev/null
+++ b/test/std/experimental/func/func.searchers/func.searchers.boyer_moore_horspool/pred.pass.cpp
@@ -0,0 +1,130 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file 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
+
+// <functional>
+
+// boyer_moore_horspool searcher
+// template<class RandomAccessIterator1,
+// class Hash = hash<typename iterator_traits<RandomAccessIterator1>::value_type>,
+// class BinaryPredicate = equal_to<>>
+// class boyer_moore_horspool_searcher {
+// public:
+// boyer_moore_horspool_searcher(RandomAccessIterator1 pat_first, RandomAccessIterator1 pat_last,
+// Hash hf = Hash(), BinaryPredicate pred = BinaryPredicate());
+//
+// template<class RandomAccessIterator2>
+// RandomAccessIterator2
+// operator()(RandomAccessIterator2 first, RandomAccessIterator2 last) const;
+//
+// private:
+// RandomAccessIterator1 pat_first_; // exposition only
+// RandomAccessIterator1 pat_last_; // exposition only
+// Hash hash_; // exposition only
+// BinaryPredicate pred_; // exposition only
+// };
+
+#include <experimental/algorithm>
+#include <experimental/functional>
+#include <cassert>
+
+#include "test_iterators.h"
+
+struct count_equal
+{
+ static unsigned count;
+ template <class T>
+ bool operator()(const T& x, const T& y) const
+ {++count; return x == y;}
+};
+
+unsigned count_equal::count = 0;
+
+template <typename Iter1, typename Iter2>
+void do_search(Iter1 b1, Iter1 e1, Iter2 b2, Iter2 e2, Iter1 result, unsigned max_count) {
+ std::experimental::boyer_moore_horspool_searcher<Iter2,
+ typename std::hash<typename std::remove_cv<typename std::iterator_traits<Iter2>::value_type>::type>, count_equal> s{b2, e2};
+ count_equal::count = 0;
+ assert(result == std::experimental::search(b1, e1, s));
+// assert(count_equal::count <= max_count);
+}
+
+template <class Iter1, class Iter2>
+void
+test()
+{
+ int ia[] = {0, 1, 2, 3, 4, 5};
+ const unsigned sa = sizeof(ia)/sizeof(ia[0]);
+ do_search(Iter1(ia), Iter1(ia+sa), Iter2(ia), Iter2(ia), Iter1(ia), 0);
+ do_search(Iter1(ia), Iter1(ia+sa), Iter2(ia), Iter2(ia+1), Iter1(ia), sa);
+ do_search(Iter1(ia), Iter1(ia+sa), Iter2(ia+1), Iter2(ia+2), Iter1(ia+1), sa);
+ do_search(Iter1(ia), Iter1(ia+sa), Iter2(ia+2), Iter2(ia+2), Iter1(ia), 0);
+ do_search(Iter1(ia), Iter1(ia+sa), Iter2(ia+2), Iter2(ia+3), Iter1(ia+2), sa);
+ do_search(Iter1(ia), Iter1(ia+sa), Iter2(ia+2), Iter2(ia+3), Iter1(ia+2), sa);
+ do_search(Iter1(ia), Iter1(ia), Iter2(ia+2), Iter2(ia+3), Iter1(ia), 0);
+ do_search(Iter1(ia), Iter1(ia+sa), Iter2(ia+sa-1), Iter2(ia+sa), Iter1(ia+sa-1), sa);
+ do_search(Iter1(ia), Iter1(ia+sa), Iter2(ia+sa-3), Iter2(ia+sa), Iter1(ia+sa-3), 3*sa);
+ do_search(Iter1(ia), Iter1(ia+sa), Iter2(ia), Iter2(ia+sa), Iter1(ia), sa*sa);
+ do_search(Iter1(ia), Iter1(ia+sa-1), Iter2(ia), Iter2(ia+sa), Iter1(ia+sa-1), (sa-1)*sa);
+ do_search(Iter1(ia), Iter1(ia+1), Iter2(ia), Iter2(ia+sa), Iter1(ia+1), sa);
+ int ib[] = {0, 1, 2, 0, 1, 2, 3, 0, 1, 2, 3, 4};
+ const unsigned sb = sizeof(ib)/sizeof(ib[0]);
+ int ic[] = {1};
+ do_search(Iter1(ib), Iter1(ib+sb), Iter2(ic), Iter2(ic+1), Iter1(ib+1), sb);
+ int id[] = {1, 2};
+ do_search(Iter1(ib), Iter1(ib+sb), Iter2(id), Iter2(id+2), Iter1(ib+1), sb*2);
+ int ie[] = {1, 2, 3};
+ do_search(Iter1(ib), Iter1(ib+sb), Iter2(ie), Iter2(ie+3), Iter1(ib+4), sb*3);
+ int ig[] = {1, 2, 3, 4};
+ do_search(Iter1(ib), Iter1(ib+sb), Iter2(ig), Iter2(ig+4), Iter1(ib+8), sb*4);
+ int ih[] = {0, 1, 1, 1, 1, 2, 3, 0, 1, 2, 3, 4};
+ const unsigned sh = sizeof(ih)/sizeof(ih[0]);
+ int ii[] = {1, 1, 2};
+ do_search(Iter1(ih), Iter1(ih+sh), Iter2(ii), Iter2(ii+3), Iter1(ih+3), sh*3);
+}
+
+template <class Iter1, class Iter2>
+void
+test2()
+{
+ char ia[] = {0, 1, 2, 3, 4, 5};
+ const unsigned sa = sizeof(ia)/sizeof(ia[0]);
+ do_search(Iter1(ia), Iter1(ia+sa), Iter2(ia), Iter2(ia), Iter1(ia), 0);
+ do_search(Iter1(ia), Iter1(ia+sa), Iter2(ia), Iter2(ia+1), Iter1(ia), sa);
+ do_search(Iter1(ia), Iter1(ia+sa), Iter2(ia+1), Iter2(ia+2), Iter1(ia+1), sa);
+ do_search(Iter1(ia), Iter1(ia+sa), Iter2(ia+2), Iter2(ia+2), Iter1(ia), 0);
+ do_search(Iter1(ia), Iter1(ia+sa), Iter2(ia+2), Iter2(ia+3), Iter1(ia+2), sa);
+ do_search(Iter1(ia), Iter1(ia+sa), Iter2(ia+2), Iter2(ia+3), Iter1(ia+2), sa);
+ do_search(Iter1(ia), Iter1(ia), Iter2(ia+2), Iter2(ia+3), Iter1(ia), 0);
+ do_search(Iter1(ia), Iter1(ia+sa), Iter2(ia+sa-1), Iter2(ia+sa), Iter1(ia+sa-1), sa);
+ do_search(Iter1(ia), Iter1(ia+sa), Iter2(ia+sa-3), Iter2(ia+sa), Iter1(ia+sa-3), 3*sa);
+ do_search(Iter1(ia), Iter1(ia+sa), Iter2(ia), Iter2(ia+sa), Iter1(ia), sa*sa);
+ do_search(Iter1(ia), Iter1(ia+sa-1), Iter2(ia), Iter2(ia+sa), Iter1(ia+sa-1), (sa-1)*sa);
+ do_search(Iter1(ia), Iter1(ia+1), Iter2(ia), Iter2(ia+sa), Iter1(ia+1), sa);
+ char ib[] = {0, 1, 2, 0, 1, 2, 3, 0, 1, 2, 3, 4};
+ const unsigned sb = sizeof(ib)/sizeof(ib[0]);
+ char ic[] = {1};
+ do_search(Iter1(ib), Iter1(ib+sb), Iter2(ic), Iter2(ic+1), Iter1(ib+1), sb);
+ char id[] = {1, 2};
+ do_search(Iter1(ib), Iter1(ib+sb), Iter2(id), Iter2(id+2), Iter1(ib+1), sb*2);
+ char ie[] = {1, 2, 3};
+ do_search(Iter1(ib), Iter1(ib+sb), Iter2(ie), Iter2(ie+3), Iter1(ib+4), sb*3);
+ char ig[] = {1, 2, 3, 4};
+ do_search(Iter1(ib), Iter1(ib+sb), Iter2(ig), Iter2(ig+4), Iter1(ib+8), sb*4);
+ char ih[] = {0, 1, 1, 1, 1, 2, 3, 0, 1, 2, 3, 4};
+ const unsigned sh = sizeof(ih)/sizeof(ih[0]);
+ char ii[] = {1, 1, 2};
+ do_search(Iter1(ih), Iter1(ih+sh), Iter2(ii), Iter2(ii+3), Iter1(ih+3), sh*3);
+}
+
+int main() {
+ test<random_access_iterator<const int*>, random_access_iterator<const int*> >();
+ test2<random_access_iterator<const char*>, random_access_iterator<const char*> >();
+}
diff --git a/test/std/experimental/func/func.searchers/func.searchers.default/default.pass.cpp b/test/std/experimental/func/func.searchers/func.searchers.default/default.pass.cpp
new file mode 100644
index 000000000000..446dcbde42be
--- /dev/null
+++ b/test/std/experimental/func/func.searchers/func.searchers.default/default.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
+
+// <functional>
+
+// default searcher
+// template<class _ForwardIterator, class _BinaryPredicate = equal_to<>>
+// class default_searcher {
+// public:
+// default_searcher(_ForwardIterator __f, _ForwardIterator __l,
+// _BinaryPredicate __p = _BinaryPredicate())
+// : __first_(__f), __last_(__l), __pred_(__p) {}
+//
+// template <typename _ForwardIterator2>
+// _ForwardIterator2 operator () (_ForwardIterator2 __f, _ForwardIterator2 __l) const {
+// return std::search(__f, __l, __first_, __last_, __pred_);
+// }
+//
+// private:
+// _ForwardIterator __first_;
+// _ForwardIterator __last_;
+// _BinaryPredicate __pred_;
+// };
+
+
+#include <experimental/algorithm>
+#include <experimental/functional>
+#include <cassert>
+
+#include "test_iterators.h"
+
+template <typename Iter1, typename Iter2>
+void do_search(Iter1 b1, Iter1 e1, Iter2 b2, Iter2 e2, Iter1 result) {
+ std::experimental::default_searcher<Iter2> s{b2, e2};
+ assert(result == std::experimental::search(b1, e1, s));
+}
+
+template <class Iter1, class Iter2>
+void
+test()
+{
+ int ia[] = {0, 1, 2, 3, 4, 5};
+ const unsigned sa = sizeof(ia)/sizeof(ia[0]);
+ do_search(Iter1(ia), Iter1(ia+sa), Iter2(ia), Iter2(ia), Iter1(ia));
+ do_search(Iter1(ia), Iter1(ia+sa), Iter2(ia), Iter2(ia+1), Iter1(ia));
+ do_search(Iter1(ia), Iter1(ia+sa), Iter2(ia+1), Iter2(ia+2), Iter1(ia+1));
+ do_search(Iter1(ia), Iter1(ia+sa), Iter2(ia+2), Iter2(ia+2), Iter1(ia));
+ do_search(Iter1(ia), Iter1(ia+sa), Iter2(ia+2), Iter2(ia+3), Iter1(ia+2));
+ do_search(Iter1(ia), Iter1(ia+sa), Iter2(ia+2), Iter2(ia+3), Iter1(ia+2));
+ do_search(Iter1(ia), Iter1(ia), Iter2(ia+2), Iter2(ia+3), Iter1(ia));
+ do_search(Iter1(ia), Iter1(ia+sa), Iter2(ia+sa-1), Iter2(ia+sa), Iter1(ia+sa-1));
+ do_search(Iter1(ia), Iter1(ia+sa), Iter2(ia+sa-3), Iter2(ia+sa), Iter1(ia+sa-3));
+ do_search(Iter1(ia), Iter1(ia+sa), Iter2(ia), Iter2(ia+sa), Iter1(ia));
+ do_search(Iter1(ia), Iter1(ia+sa-1), Iter2(ia), Iter2(ia+sa), Iter1(ia+sa-1));
+ do_search(Iter1(ia), Iter1(ia+1), Iter2(ia), Iter2(ia+sa), Iter1(ia+1));
+ int ib[] = {0, 1, 2, 0, 1, 2, 3, 0, 1, 2, 3, 4};
+ const unsigned sb = sizeof(ib)/sizeof(ib[0]);
+ int ic[] = {1};
+ do_search(Iter1(ib), Iter1(ib+sb), Iter2(ic), Iter2(ic+1), Iter1(ib+1));
+ int id[] = {1, 2};
+ do_search(Iter1(ib), Iter1(ib+sb), Iter2(id), Iter2(id+2), Iter1(ib+1));
+ int ie[] = {1, 2, 3};
+ do_search(Iter1(ib), Iter1(ib+sb), Iter2(ie), Iter2(ie+3), Iter1(ib+4));
+ int ig[] = {1, 2, 3, 4};
+ do_search(Iter1(ib), Iter1(ib+sb), Iter2(ig), Iter2(ig+4), Iter1(ib+8));
+ int ih[] = {0, 1, 1, 1, 1, 2, 3, 0, 1, 2, 3, 4};
+ const unsigned sh = sizeof(ih)/sizeof(ih[0]);
+ int ii[] = {1, 1, 2};
+ do_search(Iter1(ih), Iter1(ih+sh), Iter2(ii), Iter2(ii+3), Iter1(ih+3));
+ int ij[] = {0, 1, 0, 0, 1, 0, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0};
+ const unsigned sj = sizeof(ij)/sizeof(ij[0]);
+ int ik[] = {0, 0, 0, 0, 1, 1, 1, 1, 0, 0};
+ const unsigned sk = sizeof(ik)/sizeof(ik[0]);
+ do_search(Iter1(ij), Iter1(ij+sj), Iter2(ik), Iter2(ik+sk), Iter1(ij+6));
+}
+
+int main() {
+ test<forward_iterator<const int*>, forward_iterator<const int*> >();
+ test<forward_iterator<const int*>, bidirectional_iterator<const int*> >();
+ test<forward_iterator<const int*>, random_access_iterator<const int*> >();
+ test<bidirectional_iterator<const int*>, forward_iterator<const int*> >();
+ test<bidirectional_iterator<const int*>, bidirectional_iterator<const int*> >();
+ test<bidirectional_iterator<const int*>, random_access_iterator<const int*> >();
+ test<random_access_iterator<const int*>, forward_iterator<const int*> >();
+ test<random_access_iterator<const int*>, bidirectional_iterator<const int*> >();
+ test<random_access_iterator<const int*>, random_access_iterator<const int*> >();
+}
diff --git a/test/std/experimental/func/func.searchers/func.searchers.default/default.pred.pass.cpp b/test/std/experimental/func/func.searchers/func.searchers.default/default.pred.pass.cpp
new file mode 100644
index 000000000000..b65c500c3192
--- /dev/null
+++ b/test/std/experimental/func/func.searchers/func.searchers.default/default.pred.pass.cpp
@@ -0,0 +1,102 @@
+//===----------------------------------------------------------------------===//
+//
+// The 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: c++98, c++03, c++11
+
+// default searcher
+// template<class _ForwardIterator, class _BinaryPredicate = equal_to<>>
+// class default_searcher {
+// public:
+// default_searcher(_ForwardIterator __f, _ForwardIterator __l,
+// _BinaryPredicate __p = _BinaryPredicate())
+// : __first_(__f), __last_(__l), __pred_(__p) {}
+//
+// template <typename _ForwardIterator2>
+// _ForwardIterator2 operator () (_ForwardIterator2 __f, _ForwardIterator2 __l) const {
+// return std::search(__f, __l, __first_, __last_, __pred_);
+// }
+//
+// private:
+// _ForwardIterator __first_;
+// _ForwardIterator __last_;
+// _BinaryPredicate __pred_;
+// };
+
+
+#include <experimental/algorithm>
+#include <experimental/functional>
+#include <cassert>
+
+#include "test_iterators.h"
+
+struct count_equal
+{
+ static unsigned count;
+ template <class T>
+ bool operator()(const T& x, const T& y) const
+ {++count; return x == y;}
+};
+
+unsigned count_equal::count = 0;
+
+template <typename Iter1, typename Iter2>
+void do_search(Iter1 b1, Iter1 e1, Iter2 b2, Iter2 e2, Iter1 result, unsigned max_count) {
+ std::experimental::default_searcher<Iter2, count_equal> s{b2, e2};
+ count_equal::count = 0;
+ assert(result == std::experimental::search(b1, e1, s));
+ assert(count_equal::count <= max_count);
+}
+
+template <class Iter1, class Iter2>
+void
+test()
+{
+ int ia[] = {0, 1, 2, 3, 4, 5};
+ const unsigned sa = sizeof(ia)/sizeof(ia[0]);
+ do_search(Iter1(ia), Iter1(ia+sa), Iter2(ia), Iter2(ia), Iter1(ia), 0);
+ do_search(Iter1(ia), Iter1(ia+sa), Iter2(ia), Iter2(ia+1), Iter1(ia), sa);
+ do_search(Iter1(ia), Iter1(ia+sa), Iter2(ia+1), Iter2(ia+2), Iter1(ia+1), sa);
+ do_search(Iter1(ia), Iter1(ia+sa), Iter2(ia+2), Iter2(ia+2), Iter1(ia), 0);
+ do_search(Iter1(ia), Iter1(ia+sa), Iter2(ia+2), Iter2(ia+3), Iter1(ia+2), sa);
+ do_search(Iter1(ia), Iter1(ia+sa), Iter2(ia+2), Iter2(ia+3), Iter1(ia+2), sa);
+ do_search(Iter1(ia), Iter1(ia), Iter2(ia+2), Iter2(ia+3), Iter1(ia), 0);
+ do_search(Iter1(ia), Iter1(ia+sa), Iter2(ia+sa-1), Iter2(ia+sa), Iter1(ia+sa-1), sa);
+ do_search(Iter1(ia), Iter1(ia+sa), Iter2(ia+sa-3), Iter2(ia+sa), Iter1(ia+sa-3), 3*sa);
+ do_search(Iter1(ia), Iter1(ia+sa), Iter2(ia), Iter2(ia+sa), Iter1(ia), sa*sa);
+ do_search(Iter1(ia), Iter1(ia+sa-1), Iter2(ia), Iter2(ia+sa), Iter1(ia+sa-1), (sa-1)*sa);
+ do_search(Iter1(ia), Iter1(ia+1), Iter2(ia), Iter2(ia+sa), Iter1(ia+1), sa);
+ int ib[] = {0, 1, 2, 0, 1, 2, 3, 0, 1, 2, 3, 4};
+ const unsigned sb = sizeof(ib)/sizeof(ib[0]);
+ int ic[] = {1};
+ do_search(Iter1(ib), Iter1(ib+sb), Iter2(ic), Iter2(ic+1), Iter1(ib+1), sb);
+ int id[] = {1, 2};
+ do_search(Iter1(ib), Iter1(ib+sb), Iter2(id), Iter2(id+2), Iter1(ib+1), sb*2);
+ int ie[] = {1, 2, 3};
+ do_search(Iter1(ib), Iter1(ib+sb), Iter2(ie), Iter2(ie+3), Iter1(ib+4), sb*3);
+ int ig[] = {1, 2, 3, 4};
+ do_search(Iter1(ib), Iter1(ib+sb), Iter2(ig), Iter2(ig+4), Iter1(ib+8), sb*4);
+ int ih[] = {0, 1, 1, 1, 1, 2, 3, 0, 1, 2, 3, 4};
+ const unsigned sh = sizeof(ih)/sizeof(ih[0]);
+ int ii[] = {1, 1, 2};
+ do_search(Iter1(ih), Iter1(ih+sh), Iter2(ii), Iter2(ii+3), Iter1(ih+3), sh*3);
+}
+
+int main() {
+ test<forward_iterator<const int*>, forward_iterator<const int*> >();
+ test<forward_iterator<const int*>, bidirectional_iterator<const int*> >();
+ test<forward_iterator<const int*>, random_access_iterator<const int*> >();
+ test<bidirectional_iterator<const int*>, forward_iterator<const int*> >();
+ test<bidirectional_iterator<const int*>, bidirectional_iterator<const int*> >();
+ test<bidirectional_iterator<const int*>, random_access_iterator<const int*> >();
+ test<random_access_iterator<const int*>, forward_iterator<const int*> >();
+ test<random_access_iterator<const int*>, bidirectional_iterator<const int*> >();
+ test<random_access_iterator<const int*>, random_access_iterator<const int*> >();
+}
diff --git a/test/std/experimental/func/func.searchers/func.searchers.default/func.searchers.default.creation/make_default_searcher.pass.cpp b/test/std/experimental/func/func.searchers/func.searchers.default/func.searchers.default.creation/make_default_searcher.pass.cpp
new file mode 100644
index 000000000000..9528002d5f2d
--- /dev/null
+++ b/test/std/experimental/func/func.searchers/func.searchers.default/func.searchers.default.creation/make_default_searcher.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
+
+// <functional>
+
+// template<class ForwardIterator, class BinaryPredicate = equal_to<>>
+// default_searcher<ForwardIterator, BinaryPredicate>
+// make_default_searcher(ForwardIterator pat_first, ForwardIterator pat_last,
+// BinaryPredicate pred = BinaryPredicate());
+
+
+#include <experimental/algorithm>
+#include <experimental/functional>
+#include <cassert>
+
+#include "test_iterators.h"
+
+template <typename Iter1, typename Iter2>
+void do_search(Iter1 b1, Iter1 e1, Iter2 b2, Iter2 e2, Iter1 result) {
+ assert(result == std::experimental::search(b1, e1,
+ std::experimental::make_default_searcher(b2, e2)));
+}
+
+template <class Iter1, class Iter2>
+void
+test()
+{
+ int ia[] = {0, 1, 2, 3, 4, 5};
+ const unsigned sa = sizeof(ia)/sizeof(ia[0]);
+ do_search(Iter1(ia), Iter1(ia+sa), Iter2(ia), Iter2(ia), Iter1(ia));
+ do_search(Iter1(ia), Iter1(ia+sa), Iter2(ia), Iter2(ia+1), Iter1(ia));
+ do_search(Iter1(ia), Iter1(ia+sa), Iter2(ia+1), Iter2(ia+2), Iter1(ia+1));
+ do_search(Iter1(ia), Iter1(ia+sa), Iter2(ia+2), Iter2(ia+2), Iter1(ia));
+ do_search(Iter1(ia), Iter1(ia+sa), Iter2(ia+2), Iter2(ia+3), Iter1(ia+2));
+ do_search(Iter1(ia), Iter1(ia+sa), Iter2(ia+2), Iter2(ia+3), Iter1(ia+2));
+ do_search(Iter1(ia), Iter1(ia), Iter2(ia+2), Iter2(ia+3), Iter1(ia));
+ do_search(Iter1(ia), Iter1(ia+sa), Iter2(ia+sa-1), Iter2(ia+sa), Iter1(ia+sa-1));
+ do_search(Iter1(ia), Iter1(ia+sa), Iter2(ia+sa-3), Iter2(ia+sa), Iter1(ia+sa-3));
+ do_search(Iter1(ia), Iter1(ia+sa), Iter2(ia), Iter2(ia+sa), Iter1(ia));
+ do_search(Iter1(ia), Iter1(ia+sa-1), Iter2(ia), Iter2(ia+sa), Iter1(ia+sa-1));
+ do_search(Iter1(ia), Iter1(ia+1), Iter2(ia), Iter2(ia+sa), Iter1(ia+1));
+ int ib[] = {0, 1, 2, 0, 1, 2, 3, 0, 1, 2, 3, 4};
+ const unsigned sb = sizeof(ib)/sizeof(ib[0]);
+ int ic[] = {1};
+ do_search(Iter1(ib), Iter1(ib+sb), Iter2(ic), Iter2(ic+1), Iter1(ib+1));
+ int id[] = {1, 2};
+ do_search(Iter1(ib), Iter1(ib+sb), Iter2(id), Iter2(id+2), Iter1(ib+1));
+ int ie[] = {1, 2, 3};
+ do_search(Iter1(ib), Iter1(ib+sb), Iter2(ie), Iter2(ie+3), Iter1(ib+4));
+ int ig[] = {1, 2, 3, 4};
+ do_search(Iter1(ib), Iter1(ib+sb), Iter2(ig), Iter2(ig+4), Iter1(ib+8));
+ int ih[] = {0, 1, 1, 1, 1, 2, 3, 0, 1, 2, 3, 4};
+ const unsigned sh = sizeof(ih)/sizeof(ih[0]);
+ int ii[] = {1, 1, 2};
+ do_search(Iter1(ih), Iter1(ih+sh), Iter2(ii), Iter2(ii+3), Iter1(ih+3));
+ int ij[] = {0, 1, 0, 0, 1, 0, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0};
+ const unsigned sj = sizeof(ij)/sizeof(ij[0]);
+ int ik[] = {0, 0, 0, 0, 1, 1, 1, 1, 0, 0};
+ const unsigned sk = sizeof(ik)/sizeof(ik[0]);
+ do_search(Iter1(ij), Iter1(ij+sj), Iter2(ik), Iter2(ik+sk), Iter1(ij+6));
+}
+
+int main() {
+ test<forward_iterator<const int*>, forward_iterator<const int*> >();
+ test<forward_iterator<const int*>, bidirectional_iterator<const int*> >();
+ test<forward_iterator<const int*>, random_access_iterator<const int*> >();
+ test<bidirectional_iterator<const int*>, forward_iterator<const int*> >();
+ test<bidirectional_iterator<const int*>, bidirectional_iterator<const int*> >();
+ test<bidirectional_iterator<const int*>, random_access_iterator<const int*> >();
+ test<random_access_iterator<const int*>, forward_iterator<const int*> >();
+ test<random_access_iterator<const int*>, bidirectional_iterator<const int*> >();
+ test<random_access_iterator<const int*>, random_access_iterator<const int*> >();
+}
diff --git a/test/std/experimental/func/func.searchers/func.searchers.default/func.searchers.default.creation/make_default_searcher.pred.pass.cpp b/test/std/experimental/func/func.searchers/func.searchers.default/func.searchers.default.creation/make_default_searcher.pred.pass.cpp
new file mode 100644
index 000000000000..277020213149
--- /dev/null
+++ b/test/std/experimental/func/func.searchers/func.searchers.default/func.searchers.default.creation/make_default_searcher.pred.pass.cpp
@@ -0,0 +1,88 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file 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
+
+// <functional>
+
+// template<class ForwardIterator, class BinaryPredicate = equal_to<>>
+// default_searcher<ForwardIterator, BinaryPredicate>
+// make_default_searcher(ForwardIterator pat_first, ForwardIterator pat_last,
+// BinaryPredicate pred = BinaryPredicate());
+
+
+#include <experimental/algorithm>
+#include <experimental/functional>
+#include <cassert>
+
+#include "test_iterators.h"
+
+struct count_equal
+{
+ static unsigned count;
+ template <class T>
+ bool operator()(const T& x, const T& y)
+ {++count; return x == y;}
+};
+
+unsigned count_equal::count = 0;
+
+template <typename Iter1, typename Iter2>
+void do_search(Iter1 b1, Iter1 e1, Iter2 b2, Iter2 e2, Iter1 result, unsigned max_count) {
+ count_equal::count = 0;
+ assert(result == std::experimental::search(b1, e1,
+ std::experimental::make_default_searcher(b2, e2)));
+ assert(count_equal::count <= max_count);
+}
+
+template <class Iter1, class Iter2>
+void
+test()
+{
+ int ia[] = {0, 1, 2, 3, 4, 5};
+ const unsigned sa = sizeof(ia)/sizeof(ia[0]);
+ do_search(Iter1(ia), Iter1(ia+sa), Iter2(ia), Iter2(ia), Iter1(ia), 0);
+ do_search(Iter1(ia), Iter1(ia+sa), Iter2(ia), Iter2(ia+1), Iter1(ia), sa);
+ do_search(Iter1(ia), Iter1(ia+sa), Iter2(ia+1), Iter2(ia+2), Iter1(ia+1), sa);
+ do_search(Iter1(ia), Iter1(ia+sa), Iter2(ia+2), Iter2(ia+2), Iter1(ia), 0);
+ do_search(Iter1(ia), Iter1(ia+sa), Iter2(ia+2), Iter2(ia+3), Iter1(ia+2), sa);
+ do_search(Iter1(ia), Iter1(ia+sa), Iter2(ia+2), Iter2(ia+3), Iter1(ia+2), sa);
+ do_search(Iter1(ia), Iter1(ia), Iter2(ia+2), Iter2(ia+3), Iter1(ia), 0);
+ do_search(Iter1(ia), Iter1(ia+sa), Iter2(ia+sa-1), Iter2(ia+sa), Iter1(ia+sa-1), sa);
+ do_search(Iter1(ia), Iter1(ia+sa), Iter2(ia+sa-3), Iter2(ia+sa), Iter1(ia+sa-3), 3*sa);
+ do_search(Iter1(ia), Iter1(ia+sa), Iter2(ia), Iter2(ia+sa), Iter1(ia), sa*sa);
+ do_search(Iter1(ia), Iter1(ia+sa-1), Iter2(ia), Iter2(ia+sa), Iter1(ia+sa-1), (sa-1)*sa);
+ do_search(Iter1(ia), Iter1(ia+1), Iter2(ia), Iter2(ia+sa), Iter1(ia+1), sa);
+ int ib[] = {0, 1, 2, 0, 1, 2, 3, 0, 1, 2, 3, 4};
+ const unsigned sb = sizeof(ib)/sizeof(ib[0]);
+ int ic[] = {1};
+ do_search(Iter1(ib), Iter1(ib+sb), Iter2(ic), Iter2(ic+1), Iter1(ib+1), sb);
+ int id[] = {1, 2};
+ do_search(Iter1(ib), Iter1(ib+sb), Iter2(id), Iter2(id+2), Iter1(ib+1), sb*2);
+ int ie[] = {1, 2, 3};
+ do_search(Iter1(ib), Iter1(ib+sb), Iter2(ie), Iter2(ie+3), Iter1(ib+4), sb*3);
+ int ig[] = {1, 2, 3, 4};
+ do_search(Iter1(ib), Iter1(ib+sb), Iter2(ig), Iter2(ig+4), Iter1(ib+8), sb*4);
+ int ih[] = {0, 1, 1, 1, 1, 2, 3, 0, 1, 2, 3, 4};
+ const unsigned sh = sizeof(ih)/sizeof(ih[0]);
+ int ii[] = {1, 1, 2};
+ do_search(Iter1(ih), Iter1(ih+sh), Iter2(ii), Iter2(ii+3), Iter1(ih+3), sh*3);
+}
+
+int main() {
+ test<forward_iterator<const int*>, forward_iterator<const int*> >();
+ test<forward_iterator<const int*>, bidirectional_iterator<const int*> >();
+ test<forward_iterator<const int*>, random_access_iterator<const int*> >();
+ test<bidirectional_iterator<const int*>, forward_iterator<const int*> >();
+ test<bidirectional_iterator<const int*>, bidirectional_iterator<const int*> >();
+ test<bidirectional_iterator<const int*>, random_access_iterator<const int*> >();
+ test<random_access_iterator<const int*>, forward_iterator<const int*> >();
+ test<random_access_iterator<const int*>, bidirectional_iterator<const int*> >();
+ test<random_access_iterator<const int*>, random_access_iterator<const int*> >();
+}
diff --git a/test/std/experimental/func/func.searchers/nothing_to_do.pass.cpp b/test/std/experimental/func/func.searchers/nothing_to_do.pass.cpp
new file mode 100644
index 000000000000..9a59227abdd9
--- /dev/null
+++ b/test/std/experimental/func/func.searchers/nothing_to_do.pass.cpp
@@ -0,0 +1,13 @@
+// -*- 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.
+//
+//===----------------------------------------------------------------------===//
+
+int main()
+{
+}
diff --git a/test/std/experimental/func/header.functional.synop/includes.pass.cpp b/test/std/experimental/func/header.functional.synop/includes.pass.cpp
new file mode 100644
index 000000000000..1b72d4a7ad02
--- /dev/null
+++ b/test/std/experimental/func/header.functional.synop/includes.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.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++98, c++03, c++11
+
+// <experimental/functional>
+//
+// has to include <functional>
+
+#include <experimental/functional>
+
+int main()
+{
+ std::function<int(int)> x;
+}
diff --git a/test/std/experimental/func/nothing_to_do.pass.cpp b/test/std/experimental/func/nothing_to_do.pass.cpp
new file mode 100644
index 000000000000..9a59227abdd9
--- /dev/null
+++ b/test/std/experimental/func/nothing_to_do.pass.cpp
@@ -0,0 +1,13 @@
+// -*- 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.
+//
+//===----------------------------------------------------------------------===//
+
+int main()
+{
+}
diff --git a/test/std/experimental/optional/optional.object/optional.object.assign/copy.pass.cpp b/test/std/experimental/optional/optional.object/optional.object.assign/copy.pass.cpp
index 81c3b4e6dfa2..999d03d3a885 100644
--- a/test/std/experimental/optional/optional.object/optional.object.assign/copy.pass.cpp
+++ b/test/std/experimental/optional/optional.object/optional.object.assign/copy.pass.cpp
@@ -7,6 +7,7 @@
//
//===----------------------------------------------------------------------===//
+// XFAIL: libcpp-no-exceptions
// <optional>
// optional<T>& operator=(const optional<T>& rhs);
diff --git a/test/std/experimental/optional/optional.object/optional.object.assign/emplace.pass.cpp b/test/std/experimental/optional/optional.object/optional.object.assign/emplace.pass.cpp
index c4361ea5178d..ec98ef449153 100644
--- a/test/std/experimental/optional/optional.object/optional.object.assign/emplace.pass.cpp
+++ b/test/std/experimental/optional/optional.object/optional.object.assign/emplace.pass.cpp
@@ -7,6 +7,7 @@
//
//===----------------------------------------------------------------------===//
+// XFAIL: libcpp-no-exceptions
// <optional>
// template <class... Args> void optional<T>::emplace(Args&&... args);
diff --git a/test/std/experimental/optional/optional.object/optional.object.assign/emplace_initializer_list.pass.cpp b/test/std/experimental/optional/optional.object/optional.object.assign/emplace_initializer_list.pass.cpp
index 8d20be3de19a..aada0f4ec535 100644
--- a/test/std/experimental/optional/optional.object/optional.object.assign/emplace_initializer_list.pass.cpp
+++ b/test/std/experimental/optional/optional.object/optional.object.assign/emplace_initializer_list.pass.cpp
@@ -7,6 +7,7 @@
//
//===----------------------------------------------------------------------===//
+// XFAIL: libcpp-no-exceptions
// <optional>
// template <class U, class... Args>
diff --git a/test/std/experimental/optional/optional.object/optional.object.assign/move.pass.cpp b/test/std/experimental/optional/optional.object/optional.object.assign/move.pass.cpp
index d27313dad42b..3e084e5b7dc2 100644
--- a/test/std/experimental/optional/optional.object/optional.object.assign/move.pass.cpp
+++ b/test/std/experimental/optional/optional.object/optional.object.assign/move.pass.cpp
@@ -7,6 +7,7 @@
//
//===----------------------------------------------------------------------===//
+// XFAIL: libcpp-no-exceptions
// <optional>
// optional<T>& operator=(optional<T>&& rhs)
diff --git a/test/std/experimental/optional/optional.object/optional.object.ctor/const_T.pass.cpp b/test/std/experimental/optional/optional.object/optional.object.ctor/const_T.pass.cpp
index 071f5943b972..9b6511a0006d 100644
--- a/test/std/experimental/optional/optional.object/optional.object.ctor/const_T.pass.cpp
+++ b/test/std/experimental/optional/optional.object/optional.object.ctor/const_T.pass.cpp
@@ -6,6 +6,9 @@
// Source Licenses. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
+//
+// UNSUPPORTED: c++98, c++03, c++11
+// XFAIL: libcpp-no-exceptions
// <optional>
@@ -15,8 +18,6 @@
#include <type_traits>
#include <cassert>
-#if _LIBCPP_STD_VER > 11
-
using std::experimental::optional;
class X
@@ -39,18 +40,14 @@ public:
class Z
{
- int i_;
public:
- Z(int i) : i_(i) {}
+ Z(int) {}
Z(const Z&) {throw 6;}
};
-#endif // _LIBCPP_STD_VER > 11
-
int main()
{
-#if _LIBCPP_STD_VER > 11
{
typedef int T;
constexpr T t(5);
@@ -113,5 +110,4 @@ int main()
assert(i == 6);
}
}
-#endif // _LIBCPP_STD_VER > 11
}
diff --git a/test/std/experimental/optional/optional.object/optional.object.ctor/copy.pass.cpp b/test/std/experimental/optional/optional.object/optional.object.ctor/copy.pass.cpp
index 8726f95a00c0..7d401de1d978 100644
--- a/test/std/experimental/optional/optional.object/optional.object.ctor/copy.pass.cpp
+++ b/test/std/experimental/optional/optional.object/optional.object.ctor/copy.pass.cpp
@@ -7,6 +7,7 @@
//
//===----------------------------------------------------------------------===//
+// XFAIL: libcpp-no-exceptions
// <optional>
// optional(const optional<T>& rhs);
diff --git a/test/std/experimental/optional/optional.object/optional.object.ctor/in_place_t.pass.cpp b/test/std/experimental/optional/optional.object/optional.object.ctor/in_place_t.pass.cpp
index 412c993ffbd7..014ee859e8a9 100644
--- a/test/std/experimental/optional/optional.object/optional.object.ctor/in_place_t.pass.cpp
+++ b/test/std/experimental/optional/optional.object/optional.object.ctor/in_place_t.pass.cpp
@@ -6,6 +6,9 @@
// Source Licenses. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
+//
+// UNSUPPORTED: c++98, c++03, c++11
+// XFAIL: libcpp-no-exceptions
// <optional>
@@ -16,7 +19,6 @@
#include <type_traits>
#include <cassert>
-#if _LIBCPP_STD_VER > 11
using std::experimental::optional;
using std::experimental::in_place_t;
@@ -52,17 +54,13 @@ public:
class Z
{
- int i_;
public:
- Z(int i) : i_(i) {throw 6;}
+ Z(int i) {throw 6;}
};
-#endif // _LIBCPP_STD_VER > 11
-
int main()
{
-#if _LIBCPP_STD_VER > 11
{
constexpr optional<int> opt(in_place, 5);
static_assert(static_cast<bool>(opt) == true, "");
@@ -141,5 +139,4 @@ int main()
assert(i == 6);
}
}
-#endif // _LIBCPP_STD_VER > 11
}
diff --git a/test/std/experimental/optional/optional.object/optional.object.ctor/initializer_list.pass.cpp b/test/std/experimental/optional/optional.object/optional.object.ctor/initializer_list.pass.cpp
index 98cb929dc51e..7a98e0bf31f3 100644
--- a/test/std/experimental/optional/optional.object/optional.object.ctor/initializer_list.pass.cpp
+++ b/test/std/experimental/optional/optional.object/optional.object.ctor/initializer_list.pass.cpp
@@ -7,6 +7,7 @@
//
//===----------------------------------------------------------------------===//
+// XFAIL: libcpp-no-exceptions
// <optional>
// template <class U, class... Args>
diff --git a/test/std/experimental/optional/optional.object/optional.object.ctor/move.pass.cpp b/test/std/experimental/optional/optional.object/optional.object.ctor/move.pass.cpp
index b320c95c5827..40d55f918993 100644
--- a/test/std/experimental/optional/optional.object/optional.object.ctor/move.pass.cpp
+++ b/test/std/experimental/optional/optional.object/optional.object.ctor/move.pass.cpp
@@ -7,6 +7,7 @@
//
//===----------------------------------------------------------------------===//
+// XFAIL: libcpp-no-exceptions
// <optional>
// optional(optional<T>&& rhs) noexcept(is_nothrow_move_constructible<T>::value);
diff --git a/test/std/experimental/optional/optional.object/optional.object.ctor/rvalue_T.pass.cpp b/test/std/experimental/optional/optional.object/optional.object.ctor/rvalue_T.pass.cpp
index ac52a42d5953..ef21fcdf9e6d 100644
--- a/test/std/experimental/optional/optional.object/optional.object.ctor/rvalue_T.pass.cpp
+++ b/test/std/experimental/optional/optional.object/optional.object.ctor/rvalue_T.pass.cpp
@@ -6,6 +6,9 @@
// Source Licenses. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
+//
+// UNSUPPORTED: c++98, c++03, c++11
+// XFAIL: libcpp-no-exceptions
// <optional>
@@ -15,8 +18,6 @@
#include <type_traits>
#include <cassert>
-#if _LIBCPP_STD_VER > 11
-
using std::experimental::optional;
class X
@@ -41,17 +42,14 @@ public:
class Z
{
- int i_;
public:
- Z(int i) : i_(i) {}
+ Z(int) {}
Z(Z&&) {throw 6;}
};
-#endif // _LIBCPP_STD_VER > 11
int main()
{
-#if _LIBCPP_STD_VER > 11
{
typedef int T;
constexpr optional<T> opt(T(5));
@@ -106,5 +104,4 @@ int main()
assert(i == 6);
}
}
-#endif // _LIBCPP_STD_VER > 11
}
diff --git a/test/std/experimental/optional/optional.object/optional.object.observe/value.pass.cpp b/test/std/experimental/optional/optional.object/optional.object.observe/value.pass.cpp
index e91805e9c8e5..85f9be6998a0 100644
--- a/test/std/experimental/optional/optional.object/optional.object.observe/value.pass.cpp
+++ b/test/std/experimental/optional/optional.object/optional.object.observe/value.pass.cpp
@@ -7,6 +7,7 @@
//
//===----------------------------------------------------------------------===//
+// XFAIL: libcpp-no-exceptions
// <optional>
// T& optional<T>::value();
diff --git a/test/std/experimental/optional/optional.object/optional.object.observe/value_const.pass.cpp b/test/std/experimental/optional/optional.object/optional.object.observe/value_const.pass.cpp
index 39bf687ff3c5..c99baab8b6e4 100644
--- a/test/std/experimental/optional/optional.object/optional.object.observe/value_const.pass.cpp
+++ b/test/std/experimental/optional/optional.object/optional.object.observe/value_const.pass.cpp
@@ -7,6 +7,7 @@
//
//===----------------------------------------------------------------------===//
+// XFAIL: libcpp-no-exceptions
// <optional>
// constexpr const T& optional<T>::value() const;
diff --git a/test/std/experimental/optional/optional.object/optional.object.swap/swap.pass.cpp b/test/std/experimental/optional/optional.object/optional.object.swap/swap.pass.cpp
index e0ecfdebb8cf..d24a2d06b9d5 100644
--- a/test/std/experimental/optional/optional.object/optional.object.swap/swap.pass.cpp
+++ b/test/std/experimental/optional/optional.object/optional.object.swap/swap.pass.cpp
@@ -7,6 +7,7 @@
//
//===----------------------------------------------------------------------===//
+// XFAIL: libcpp-no-exceptions
// <optional>
// void swap(optional&)
diff --git a/test/std/experimental/optional/optional.specalg/swap.pass.cpp b/test/std/experimental/optional/optional.specalg/swap.pass.cpp
index e31d2173425b..6c5f7b0e860c 100644
--- a/test/std/experimental/optional/optional.specalg/swap.pass.cpp
+++ b/test/std/experimental/optional/optional.specalg/swap.pass.cpp
@@ -7,6 +7,7 @@
//
//===----------------------------------------------------------------------===//
+// XFAIL: libcpp-no-exceptions
// <optional>
// template <class T> void swap(optional<T>& x, optional<T>& y)
diff --git a/test/std/experimental/string.view/string.view.access/at.pass.cpp b/test/std/experimental/string.view/string.view.access/at.pass.cpp
index 3003ea835470..a3208c1645a2 100644
--- a/test/std/experimental/string.view/string.view.access/at.pass.cpp
+++ b/test/std/experimental/string.view/string.view.access/at.pass.cpp
@@ -10,6 +10,7 @@
// NOTE: Older versions of clang have a bug where they fail to evalute
// string_view::at as a constant expression.
// XFAIL: clang-3.4, clang-3.3
+// XFAIL: libcpp-no-exceptions
// <string_view>
diff --git a/test/std/experimental/string.view/string.view.ops/compare.pointer_size.pass.cpp b/test/std/experimental/string.view/string.view.ops/compare.pointer_size.pass.cpp
index 6b20639f7752..7ccbd528c7fc 100644
--- a/test/std/experimental/string.view/string.view.ops/compare.pointer_size.pass.cpp
+++ b/test/std/experimental/string.view/string.view.ops/compare.pointer_size.pass.cpp
@@ -7,6 +7,7 @@
//
//===----------------------------------------------------------------------===//
+// XFAIL: libcpp-no-exceptions
// <string_view>
// constexpr int compare(size_type pos1, size_type n1, const charT* s) const;
diff --git a/test/std/experimental/string.view/string.view.ops/compare.size_size_sv.pass.cpp b/test/std/experimental/string.view/string.view.ops/compare.size_size_sv.pass.cpp
index 2047862b0002..244de9eb5104 100644
--- a/test/std/experimental/string.view/string.view.ops/compare.size_size_sv.pass.cpp
+++ b/test/std/experimental/string.view/string.view.ops/compare.size_size_sv.pass.cpp
@@ -8,6 +8,7 @@
//===----------------------------------------------------------------------===//
+// XFAIL: libcpp-no-exceptions
// <string_view>
// constexpr int compare(size_type pos1, size_type n1, basic_string_view str) const;
diff --git a/test/std/experimental/string.view/string.view.ops/compare.size_size_sv_pointer_size.pass.cpp b/test/std/experimental/string.view/string.view.ops/compare.size_size_sv_pointer_size.pass.cpp
index acb48f5fb6cc..1c3bc089a656 100644
--- a/test/std/experimental/string.view/string.view.ops/compare.size_size_sv_pointer_size.pass.cpp
+++ b/test/std/experimental/string.view/string.view.ops/compare.size_size_sv_pointer_size.pass.cpp
@@ -8,6 +8,7 @@
//===----------------------------------------------------------------------===//
+// XFAIL: libcpp-no-exceptions
// <string_view>
// constexpr int compare(size_type pos1, size_type n1,
diff --git a/test/std/experimental/string.view/string.view.ops/compare.size_size_sv_size_size.pass.cpp b/test/std/experimental/string.view/string.view.ops/compare.size_size_sv_size_size.pass.cpp
index 33407ef0747e..c7a6f1e1eb66 100644
--- a/test/std/experimental/string.view/string.view.ops/compare.size_size_sv_size_size.pass.cpp
+++ b/test/std/experimental/string.view/string.view.ops/compare.size_size_sv_size_size.pass.cpp
@@ -8,6 +8,7 @@
//===----------------------------------------------------------------------===//
+// XFAIL: libcpp-no-exceptions
// <string_view>
// constexpr int compare(size_type pos1, size_type n1, basic_string_view str,
diff --git a/test/std/experimental/string.view/string.view.ops/copy.pass.cpp b/test/std/experimental/string.view/string.view.ops/copy.pass.cpp
index 96246d2732c7..0e4eb9e50bb0 100644
--- a/test/std/experimental/string.view/string.view.ops/copy.pass.cpp
+++ b/test/std/experimental/string.view/string.view.ops/copy.pass.cpp
@@ -8,6 +8,7 @@
//===----------------------------------------------------------------------===//
+// XFAIL: libcpp-no-exceptions
// <string_view>
// size_type copy(charT* s, size_type n, size_type pos = 0) const;
diff --git a/test/std/experimental/string.view/string.view.ops/substr.pass.cpp b/test/std/experimental/string.view/string.view.ops/substr.pass.cpp
index 123646240f2e..c80e90a04788 100644
--- a/test/std/experimental/string.view/string.view.ops/substr.pass.cpp
+++ b/test/std/experimental/string.view/string.view.ops/substr.pass.cpp
@@ -8,6 +8,7 @@
//===----------------------------------------------------------------------===//
+// XFAIL: libcpp-no-exceptions
// <string_view>
// constexpr basic_string_view substr(size_type pos = 0, size_type n = npos) const;
diff --git a/test/std/experimental/utilities/tuple/tuple.apply/arg_type.pass.cpp b/test/std/experimental/utilities/tuple/tuple.apply/arg_type.pass.cpp
index 56dc3c6aaa25..cb44707fa7e7 100644
--- a/test/std/experimental/utilities/tuple/tuple.apply/arg_type.pass.cpp
+++ b/test/std/experimental/utilities/tuple/tuple.apply/arg_type.pass.cpp
@@ -20,6 +20,11 @@
#include <utility>
#include <cassert>
+// 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"
+
+
namespace ex = std::experimental;
int call_with_value(int x, int y) { return (x + y); }
diff --git a/test/std/experimental/utilities/tuple/tuple.apply/extended_types.pass.cpp b/test/std/experimental/utilities/tuple/tuple.apply/extended_types.pass.cpp
index 322554925d3f..0c5170f29cea 100644
--- a/test/std/experimental/utilities/tuple/tuple.apply/extended_types.pass.cpp
+++ b/test/std/experimental/utilities/tuple/tuple.apply/extended_types.pass.cpp
@@ -22,6 +22,10 @@
#include <utility>
#include <cassert>
+// 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"
+
int count = 0;
struct A_int_0
diff --git a/test/std/experimental/utilities/tuple/tuple.apply/types.pass.cpp b/test/std/experimental/utilities/tuple/tuple.apply/types.pass.cpp
index 5d3d564c26fb..52eec276394a 100644
--- a/test/std/experimental/utilities/tuple/tuple.apply/types.pass.cpp
+++ b/test/std/experimental/utilities/tuple/tuple.apply/types.pass.cpp
@@ -20,6 +20,10 @@
#include <utility>
#include <cassert>
+// 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"
+
namespace ex = std::experimental;
int count = 0;
diff --git a/test/std/input.output/file.streams/c.files/cstdio.pass.cpp b/test/std/input.output/file.streams/c.files/cstdio.pass.cpp
index ec4ad8a3bbca..a06f0443d701 100644
--- a/test/std/input.output/file.streams/c.files/cstdio.pass.cpp
+++ b/test/std/input.output/file.streams/c.files/cstdio.pass.cpp
@@ -80,6 +80,7 @@
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wformat-zero-length"
+#pragma clang diagnostic ignored "-Wdeprecated-declarations"
int main()
{
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 e6f4e1e4c19e..dc4e0ba0de20 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
@@ -63,4 +63,13 @@ int main()
is.seekg(-1);
assert(is.fail());
}
+ {
+ testbuf<char> sb(" 123456789");
+ std::istream is(&sb);
+ is.setstate(std::ios_base::eofbit);
+ assert(is.eof());
+ is.seekg(5);
+ assert(is.good());
+ assert(!is.eof());
+ }
}
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 73f3da1c6bd1..3cedf9192808 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
@@ -71,4 +71,13 @@ int main()
assert(is.fail());
assert(seekoff_called == 4);
}
+ {
+ testbuf<char> sb(" 123456789");
+ std::istream is(&sb);
+ is.setstate(std::ios_base::eofbit);
+ assert(is.eof());
+ is.seekg(5, std::ios_base::beg);
+ assert(is.good());
+ assert(!is.eof());
+ }
}
diff --git a/test/std/input.output/iostream.format/output.streams/ostream_sentry/destruct.pass.cpp b/test/std/input.output/iostream.format/output.streams/ostream_sentry/destruct.pass.cpp
index 112928ca0ce6..a8ef34e49278 100644
--- a/test/std/input.output/iostream.format/output.streams/ostream_sentry/destruct.pass.cpp
+++ b/test/std/input.output/iostream.format/output.streams/ostream_sentry/destruct.pass.cpp
@@ -7,6 +7,7 @@
//
//===----------------------------------------------------------------------===//
+// XFAIL: libcpp-no-exceptions
// <ostream>
// template <class charT, class traits = char_traits<charT> >
diff --git a/test/std/input.output/iostreams.base/ios.base/ios.types/ios_failure/ctor_string_error_code.pass.cpp b/test/std/input.output/iostreams.base/ios.base/ios.types/ios_failure/ctor_string_error_code.pass.cpp
index 5c9abbe53793..a9c5f30f37ae 100644
--- a/test/std/input.output/iostreams.base/ios.base/ios.types/ios_failure/ctor_string_error_code.pass.cpp
+++ b/test/std/input.output/iostreams.base/ios.base/ios.types/ios_failure/ctor_string_error_code.pass.cpp
@@ -19,6 +19,9 @@
int main()
{
+ // LWG2462 std::ios_base::failure is overspecified
+ static_assert((std::is_base_of<std::system_error, std::ios_base::failure>::value), "");
+
{
std::string what_arg("io test message");
std::ios_base::failure se(what_arg, make_error_code(std::errc::is_a_directory));
diff --git a/test/std/input.output/iostreams.base/ios/basic.ios.members/copyfmt.pass.cpp b/test/std/input.output/iostreams.base/ios/basic.ios.members/copyfmt.pass.cpp
index c46e2c054e8f..acefb8d16176 100644
--- a/test/std/input.output/iostreams.base/ios/basic.ios.members/copyfmt.pass.cpp
+++ b/test/std/input.output/iostreams.base/ios/basic.ios.members/copyfmt.pass.cpp
@@ -7,6 +7,7 @@
//
//===----------------------------------------------------------------------===//
+// XFAIL: libcpp-no-exceptions
// REQUIRES: locale.en_US.UTF-8
// REQUIRES: locale.fr_FR.UTF-8
diff --git a/test/std/input.output/iostreams.base/ios/basic.ios.members/set_rdbuf.pass.cpp b/test/std/input.output/iostreams.base/ios/basic.ios.members/set_rdbuf.pass.cpp
index 2d4beee37ec2..1c40a81aa069 100644
--- a/test/std/input.output/iostreams.base/ios/basic.ios.members/set_rdbuf.pass.cpp
+++ b/test/std/input.output/iostreams.base/ios/basic.ios.members/set_rdbuf.pass.cpp
@@ -7,6 +7,7 @@
//
//===----------------------------------------------------------------------===//
+// XFAIL: libcpp-no-exceptions
// <ios>
// template <class charT, class traits> class basic_ios
diff --git a/test/std/input.output/iostreams.base/ios/iostate.flags/clear.pass.cpp b/test/std/input.output/iostreams.base/ios/iostate.flags/clear.pass.cpp
index 0c2e8f0860ce..c4aad797801d 100644
--- a/test/std/input.output/iostreams.base/ios/iostate.flags/clear.pass.cpp
+++ b/test/std/input.output/iostreams.base/ios/iostate.flags/clear.pass.cpp
@@ -7,6 +7,7 @@
//
//===----------------------------------------------------------------------===//
+// XFAIL: libcpp-no-exceptions
// <ios>
// template <class charT, class traits> class basic_ios
diff --git a/test/std/input.output/iostreams.base/ios/iostate.flags/exceptions_iostate.pass.cpp b/test/std/input.output/iostreams.base/ios/iostate.flags/exceptions_iostate.pass.cpp
index a0013eabdac6..9347644b12b1 100644
--- a/test/std/input.output/iostreams.base/ios/iostate.flags/exceptions_iostate.pass.cpp
+++ b/test/std/input.output/iostreams.base/ios/iostate.flags/exceptions_iostate.pass.cpp
@@ -7,6 +7,7 @@
//
//===----------------------------------------------------------------------===//
+// XFAIL: libcpp-no-exceptions
// <ios>
// template <class charT, class traits> class basic_ios
diff --git a/test/std/input.output/iostreams.base/ios/iostate.flags/setstate.pass.cpp b/test/std/input.output/iostreams.base/ios/iostate.flags/setstate.pass.cpp
index b3c66c487e9f..41cb61db194d 100644
--- a/test/std/input.output/iostreams.base/ios/iostate.flags/setstate.pass.cpp
+++ b/test/std/input.output/iostreams.base/ios/iostate.flags/setstate.pass.cpp
@@ -7,6 +7,7 @@
//
//===----------------------------------------------------------------------===//
+// XFAIL: libcpp-no-exceptions
// <ios>
// template <class charT, class traits> class basic_ios
diff --git a/test/std/input.output/string.streams/stringbuf/stringbuf.virtuals/overflow.pass.cpp b/test/std/input.output/string.streams/stringbuf/stringbuf.virtuals/overflow.pass.cpp
index 3abf9423a12e..67363b559d99 100644
--- a/test/std/input.output/string.streams/stringbuf/stringbuf.virtuals/overflow.pass.cpp
+++ b/test/std/input.output/string.streams/stringbuf/stringbuf.virtuals/overflow.pass.cpp
@@ -29,7 +29,7 @@ struct testbuf
: base(str, which) {}
typename base::int_type
- overflow(typename base::int_type c = base::type_traits::eof())
+ overflow(typename base::int_type c = base::traits_type::eof())
{++overflow_called; return base::overflow(c);}
void pbump(int n) {base::pbump(n);}
@@ -37,6 +37,10 @@ struct testbuf
int main()
{
+ { // sanity check
+ testbuf<char> tb("");;
+ tb.overflow();
+ }
{
testbuf<char> sb("abc");
assert(sb.sputc('1') == '1');
diff --git a/test/std/input.output/string.streams/stringbuf/stringbuf.virtuals/pbackfail.pass.cpp b/test/std/input.output/string.streams/stringbuf/stringbuf.virtuals/pbackfail.pass.cpp
index 4af0e63029a7..a0509008d50b 100644
--- a/test/std/input.output/string.streams/stringbuf/stringbuf.virtuals/pbackfail.pass.cpp
+++ b/test/std/input.output/string.streams/stringbuf/stringbuf.virtuals/pbackfail.pass.cpp
@@ -27,7 +27,7 @@ struct testbuf
: base(str, which) {}
typename base::int_type
- pbackfail(typename base::int_type c = base::type_traits::eof())
+ pbackfail(typename base::int_type c = base::traits_type::eof())
{return base::pbackfail(c);}
void pbump(int n) {base::pbump(n);}
@@ -35,6 +35,10 @@ struct testbuf
int main()
{
+ { // sanity check
+ testbuf<char> tb("");;
+ tb.pbackfail();
+ }
{
testbuf<char> sb("123", std::ios_base::in);
assert(sb.sgetc() == '1');
diff --git a/test/std/iterators/iterator.primitives/iterator.operations/next.pass.cpp b/test/std/iterators/iterator.primitives/iterator.operations/next.pass.cpp
index f584110499b8..0952588b0cb1 100644
--- a/test/std/iterators/iterator.primitives/iterator.operations/next.pass.cpp
+++ b/test/std/iterators/iterator.primitives/iterator.operations/next.pass.cpp
@@ -12,6 +12,8 @@
// template <InputIterator Iter>
// Iter next(Iter x, Iter::difference_type n = 1);
+// LWG #2353 relaxed the requirement on next from ForwardIterator to InputIterator
+
#include <iterator>
#include <cassert>
@@ -34,11 +36,13 @@ test(It i, It x)
int main()
{
const char* s = "1234567890";
+ test(input_iterator<const char*>(s), 10, input_iterator<const char*>(s+10));
test(forward_iterator<const char*>(s), 10, forward_iterator<const char*>(s+10));
test(bidirectional_iterator<const char*>(s), 10, bidirectional_iterator<const char*>(s+10));
test(random_access_iterator<const char*>(s), 10, random_access_iterator<const char*>(s+10));
test(s, 10, s+10);
+ test(input_iterator<const char*>(s), input_iterator<const char*>(s+1));
test(forward_iterator<const char*>(s), forward_iterator<const char*>(s+1));
test(bidirectional_iterator<const char*>(s), bidirectional_iterator<const char*>(s+1));
test(random_access_iterator<const char*>(s), random_access_iterator<const char*>(s+1));
diff --git a/test/std/iterators/stream.iterators/ostream.iterator/ostream.iterator.ops/assign_t.pass.cpp b/test/std/iterators/stream.iterators/ostream.iterator/ostream.iterator.ops/assign_t.pass.cpp
index 02ef571a06f9..932ef25b784c 100644
--- a/test/std/iterators/stream.iterators/ostream.iterator/ostream.iterator.ops/assign_t.pass.cpp
+++ b/test/std/iterators/stream.iterators/ostream.iterator/ostream.iterator.ops/assign_t.pass.cpp
@@ -17,6 +17,10 @@
#include <sstream>
#include <cassert>
+#if defined(__clang__)
+#pragma clang diagnostic ignored "-Wliteral-conversion"
+#endif
+
int main()
{
{
diff --git a/test/std/language.support/support.dynamic/alloc.errors/new.handler/new_handler.pass.cpp b/test/std/language.support/support.dynamic/alloc.errors/new.handler/new_handler.pass.cpp
index 6b799a3e83d8..0d4524cacb38 100644
--- a/test/std/language.support/support.dynamic/alloc.errors/new.handler/new_handler.pass.cpp
+++ b/test/std/language.support/support.dynamic/alloc.errors/new.handler/new_handler.pass.cpp
@@ -10,10 +10,14 @@
// test new_handler
#include <new>
+#include <type_traits>
+#include <cassert>
void f() {}
int main()
{
+ static_assert((std::is_same<std::new_handler, void(*)()>::value), "");
std::new_handler p = f;
+ assert(p == &f);
}
diff --git a/test/std/language.support/support.dynamic/new.delete/new.delete.array/new_array.pass.cpp b/test/std/language.support/support.dynamic/new.delete/new.delete.array/new_array.pass.cpp
index 5a87c0738784..55a3200a13b7 100644
--- a/test/std/language.support/support.dynamic/new.delete/new.delete.array/new_array.pass.cpp
+++ b/test/std/language.support/support.dynamic/new.delete/new.delete.array/new_array.pass.cpp
@@ -7,6 +7,7 @@
//
//===----------------------------------------------------------------------===//
+// XFAIL: libcpp-no-exceptions
// test operator new[]
// NOTE: asan and msan will not call the new handler.
// UNSUPPORTED: sanitizer-new-delete
@@ -38,7 +39,8 @@ int main()
std::set_new_handler(new_handler);
try
{
- void*volatile vp = operator new[] (std::numeric_limits<std::size_t>::max());
+ void* volatile vp = operator new[] (std::numeric_limits<std::size_t>::max());
+ ((void)vp);
assert(false);
}
catch (std::bad_alloc&)
diff --git a/test/std/language.support/support.dynamic/new.delete/new.delete.array/new_array_nothrow.pass.cpp b/test/std/language.support/support.dynamic/new.delete/new.delete.array/new_array_nothrow.pass.cpp
index b0db4a8e57e2..9531b1c37480 100644
--- a/test/std/language.support/support.dynamic/new.delete/new.delete.array/new_array_nothrow.pass.cpp
+++ b/test/std/language.support/support.dynamic/new.delete/new.delete.array/new_array_nothrow.pass.cpp
@@ -7,6 +7,7 @@
//
//===----------------------------------------------------------------------===//
+// XFAIL: libcpp-no-exceptions
// test operator new [] (nothrow)
// NOTE: 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.array/sized_delete_array14.pass.cpp b/test/std/language.support/support.dynamic/new.delete/new.delete.array/sized_delete_array14.pass.cpp
index 6447e29726c1..0e2cc6d8da4e 100644
--- a/test/std/language.support/support.dynamic/new.delete/new.delete.array/sized_delete_array14.pass.cpp
+++ b/test/std/language.support/support.dynamic/new.delete/new.delete.array/sized_delete_array14.pass.cpp
@@ -11,11 +11,10 @@
// UNSUPPORTED: sanitizer-new-delete, c++98, c++03, c++11
-// TODO: Clang does not enable sized-deallocation in c++14 and behond by
+// NOTE: Clang does not enable sized-deallocation in c++14 and beyond by
// default. It is only enabled when -fsized-deallocation is given.
-// (except clang-3.6 which temporarly enabled sized-deallocation)
-// XFAIL: clang-3.4, clang-3.5, clang-3.7
-// XFAIL: apple-clang
+// (except clang-3.6 which temporarily enabled sized-deallocation)
+// UNSUPPORTED: clang, apple-clang
// NOTE: GCC 4.9.1 does not support sized-deallocation in c++14. However
// GCC 5.1 does.
diff --git a/test/std/language.support/support.dynamic/new.delete/new.delete.single/new.pass.cpp b/test/std/language.support/support.dynamic/new.delete/new.delete.single/new.pass.cpp
index 58aa3f2d529c..57ce28752208 100644
--- a/test/std/language.support/support.dynamic/new.delete/new.delete.single/new.pass.cpp
+++ b/test/std/language.support/support.dynamic/new.delete/new.delete.single/new.pass.cpp
@@ -7,6 +7,7 @@
//
//===----------------------------------------------------------------------===//
+// XFAIL: libcpp-no-exceptions
// test operator new
// asan and msan will not call the new handler.
@@ -39,6 +40,7 @@ int main()
try
{
void* vp = operator new (std::numeric_limits<std::size_t>::max());
+ ((void)vp);
assert(false);
}
catch (std::bad_alloc&)
diff --git a/test/std/language.support/support.dynamic/new.delete/new.delete.single/new_nothrow.pass.cpp b/test/std/language.support/support.dynamic/new.delete/new.delete.single/new_nothrow.pass.cpp
index 8c095ad32db4..c2f5830495d2 100644
--- a/test/std/language.support/support.dynamic/new.delete/new.delete.single/new_nothrow.pass.cpp
+++ b/test/std/language.support/support.dynamic/new.delete/new.delete.single/new_nothrow.pass.cpp
@@ -7,6 +7,7 @@
//
//===----------------------------------------------------------------------===//
+// XFAIL: libcpp-no-exceptions
// test operator new (nothrow)
// asan and msan will not call the new handler.
diff --git a/test/std/language.support/support.dynamic/new.delete/new.delete.single/sized_delete14.pass.cpp b/test/std/language.support/support.dynamic/new.delete/new.delete.single/sized_delete14.pass.cpp
index 3c7f54fef726..5d9ddd4f0526 100644
--- a/test/std/language.support/support.dynamic/new.delete/new.delete.single/sized_delete14.pass.cpp
+++ b/test/std/language.support/support.dynamic/new.delete/new.delete.single/sized_delete14.pass.cpp
@@ -11,11 +11,10 @@
// UNSUPPORTED: sanitizer-new-delete, c++98, c++03, c++11
-// TODO: Clang does not enable sized-deallocation in c++14 and behond by
+// NOTE: Clang does not enable sized-deallocation in c++14 and beyond by
// default. It is only enabled when -fsized-deallocation is given.
-// (except clang-3.6 which temporarly enabled sized-deallocation)
-// XFAIL: clang-3.4, clang-3.5, clang-3.7
-// XFAIL: apple-clang
+// (except clang-3.6 which temporarily enabled sized-deallocation)
+// UNSUPPORTED: clang, apple-clang
// NOTE: GCC 4.9.1 does not support sized-deallocation in c++14. However
// GCC 5.1 does.
diff --git a/test/std/language.support/support.exception/except.nested/assign.pass.cpp b/test/std/language.support/support.exception/except.nested/assign.pass.cpp
index cbe303c570d6..a5508d1436fa 100644
--- a/test/std/language.support/support.exception/except.nested/assign.pass.cpp
+++ b/test/std/language.support/support.exception/except.nested/assign.pass.cpp
@@ -7,6 +7,7 @@
//
//===----------------------------------------------------------------------===//
+// XFAIL: libcpp-no-exceptions
// <exception>
// class nested_exception;
diff --git a/test/std/language.support/support.exception/except.nested/ctor_copy.pass.cpp b/test/std/language.support/support.exception/except.nested/ctor_copy.pass.cpp
index bfa13707a971..f9f293300e62 100644
--- a/test/std/language.support/support.exception/except.nested/ctor_copy.pass.cpp
+++ b/test/std/language.support/support.exception/except.nested/ctor_copy.pass.cpp
@@ -7,6 +7,7 @@
//
//===----------------------------------------------------------------------===//
+// XFAIL: libcpp-no-exceptions
// <exception>
// class nested_exception;
diff --git a/test/std/language.support/support.exception/except.nested/ctor_default.pass.cpp b/test/std/language.support/support.exception/except.nested/ctor_default.pass.cpp
index 1422f770eca8..67766aa2c461 100644
--- a/test/std/language.support/support.exception/except.nested/ctor_default.pass.cpp
+++ b/test/std/language.support/support.exception/except.nested/ctor_default.pass.cpp
@@ -7,6 +7,7 @@
//
//===----------------------------------------------------------------------===//
+// XFAIL: libcpp-no-exceptions
// <exception>
// class nested_exception;
diff --git a/test/std/language.support/support.exception/except.nested/rethrow_if_nested.pass.cpp b/test/std/language.support/support.exception/except.nested/rethrow_if_nested.pass.cpp
index 567ed579eb7b..a8b6e15feab8 100644
--- a/test/std/language.support/support.exception/except.nested/rethrow_if_nested.pass.cpp
+++ b/test/std/language.support/support.exception/except.nested/rethrow_if_nested.pass.cpp
@@ -7,6 +7,7 @@
//
//===----------------------------------------------------------------------===//
+// XFAIL: libcpp-no-exceptions
// <exception>
// class nested_exception;
@@ -36,6 +37,13 @@ public:
B(const B& b) : A(b) {}
};
+class C
+{
+public:
+ virtual ~C() {}
+ C * operator&() const { assert(false); } // should not be called
+};
+
int main()
{
{
@@ -78,7 +86,7 @@ int main()
{
try
{
- std::rethrow_if_nested(1);
+ std::rethrow_if_nested(C());
assert(true);
}
catch (...)
@@ -86,4 +94,5 @@ int main()
assert(false);
}
}
+
}
diff --git a/test/std/language.support/support.exception/except.nested/rethrow_nested.pass.cpp b/test/std/language.support/support.exception/except.nested/rethrow_nested.pass.cpp
index b07269061b4b..13c1dfe59311 100644
--- a/test/std/language.support/support.exception/except.nested/rethrow_nested.pass.cpp
+++ b/test/std/language.support/support.exception/except.nested/rethrow_nested.pass.cpp
@@ -7,6 +7,7 @@
//
//===----------------------------------------------------------------------===//
+// XFAIL: libcpp-no-exceptions
// <exception>
// class nested_exception;
diff --git a/test/std/language.support/support.exception/except.nested/throw_with_nested.pass.cpp b/test/std/language.support/support.exception/except.nested/throw_with_nested.pass.cpp
index dad0df248076..98006bb1e3a0 100644
--- a/test/std/language.support/support.exception/except.nested/throw_with_nested.pass.cpp
+++ b/test/std/language.support/support.exception/except.nested/throw_with_nested.pass.cpp
@@ -7,6 +7,7 @@
//
//===----------------------------------------------------------------------===//
+// XFAIL: libcpp-no-exceptions
// <exception>
// class nested_exception;
diff --git a/test/std/language.support/support.exception/exception.terminate/terminate.handler/terminate_handler.pass.cpp b/test/std/language.support/support.exception/exception.terminate/terminate.handler/terminate_handler.pass.cpp
index 232ce0a5a888..e477f5298e89 100644
--- a/test/std/language.support/support.exception/exception.terminate/terminate.handler/terminate_handler.pass.cpp
+++ b/test/std/language.support/support.exception/exception.terminate/terminate.handler/terminate_handler.pass.cpp
@@ -10,10 +10,14 @@
// test terminate_handler
#include <exception>
+#include <type_traits>
+#include <cassert>
void f() {}
int main()
{
+ static_assert((std::is_same<std::terminate_handler, void(*)()>::value), "");
std::terminate_handler p = f;
+ assert(p == &f);
}
diff --git a/test/std/language.support/support.exception/propagation/current_exception.pass.cpp b/test/std/language.support/support.exception/propagation/current_exception.pass.cpp
index 9ff0d6e2ce4d..09adf580bddf 100644
--- a/test/std/language.support/support.exception/propagation/current_exception.pass.cpp
+++ b/test/std/language.support/support.exception/propagation/current_exception.pass.cpp
@@ -7,6 +7,7 @@
//
//===----------------------------------------------------------------------===//
+// XFAIL: libcpp-no-exceptions
// <exception>
// exception_ptr current_exception();
diff --git a/test/std/language.support/support.exception/propagation/make_exception_ptr.pass.cpp b/test/std/language.support/support.exception/propagation/make_exception_ptr.pass.cpp
index 89c9f85d3810..6e4c0a98b09f 100644
--- a/test/std/language.support/support.exception/propagation/make_exception_ptr.pass.cpp
+++ b/test/std/language.support/support.exception/propagation/make_exception_ptr.pass.cpp
@@ -7,6 +7,7 @@
//
//===----------------------------------------------------------------------===//
+// XFAIL: libcpp-no-exceptions
// <exception>
// template<class E> exception_ptr make_exception_ptr(E e);
diff --git a/test/std/language.support/support.exception/propagation/rethrow_exception.pass.cpp b/test/std/language.support/support.exception/propagation/rethrow_exception.pass.cpp
index e47a5989d41c..c28c901bdd73 100644
--- a/test/std/language.support/support.exception/propagation/rethrow_exception.pass.cpp
+++ b/test/std/language.support/support.exception/propagation/rethrow_exception.pass.cpp
@@ -7,6 +7,7 @@
//
//===----------------------------------------------------------------------===//
+// XFAIL: libcpp-no-exceptions
// <exception>
// void rethrow_exception [[noreturn]] (exception_ptr p);
diff --git a/test/std/language.support/support.exception/uncaught/uncaught_exception.pass.cpp b/test/std/language.support/support.exception/uncaught/uncaught_exception.pass.cpp
index 22d8d8e982ae..573d85bd242c 100644
--- a/test/std/language.support/support.exception/uncaught/uncaught_exception.pass.cpp
+++ b/test/std/language.support/support.exception/uncaught/uncaught_exception.pass.cpp
@@ -7,6 +7,7 @@
//
//===----------------------------------------------------------------------===//
+// XFAIL: libcpp-no-exceptions
// test uncaught_exception
#include <exception>
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 1adc904fd5d2..b35ad7313bcc 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
@@ -7,6 +7,7 @@
//
//===----------------------------------------------------------------------===//
+// XFAIL: libcpp-no-exceptions
// test uncaught_exceptions
#include <exception>
diff --git a/test/std/language.support/support.runtime/csignal.pass.cpp b/test/std/language.support/support.runtime/csignal.pass.cpp
index 717347df7f00..a42363f8b27f 100644
--- a/test/std/language.support/support.runtime/csignal.pass.cpp
+++ b/test/std/language.support/support.runtime/csignal.pass.cpp
@@ -50,7 +50,8 @@
int main()
{
- std::sig_atomic_t sig;
+ std::sig_atomic_t sig = 0;
+ ((void)sig);
typedef void (*func)(int);
static_assert((std::is_same<decltype(std::signal(0, (func)0)), func>::value), "");
static_assert((std::is_same<decltype(std::raise(0)), int>::value), "");
diff --git a/test/std/language.support/support.runtime/cstdarg.pass.cpp b/test/std/language.support/support.runtime/cstdarg.pass.cpp
index 059ad2f4ff91..9d6f610a943e 100644
--- a/test/std/language.support/support.runtime/cstdarg.pass.cpp
+++ b/test/std/language.support/support.runtime/cstdarg.pass.cpp
@@ -32,4 +32,5 @@
int main()
{
std::va_list va;
+ ((void)va);
}
diff --git a/test/std/language.support/support.runtime/cstdlib.pass.cpp b/test/std/language.support/support.runtime/cstdlib.pass.cpp
index 073949122b01..d8f88cf58d9d 100644
--- a/test/std/language.support/support.runtime/cstdlib.pass.cpp
+++ b/test/std/language.support/support.runtime/cstdlib.pass.cpp
@@ -11,6 +11,13 @@
#include <cstdlib>
#include <type_traits>
+#include <cassert>
+
+// As of 1/10/2015 clang emits a -Wnonnull warnings even if the warning occurs
+// in an unevaluated context. For this reason we manually suppress the warning.
+#if defined(__clang__)
+#pragma clang diagnostic ignored "-Wnonnull"
+#endif
#ifndef EXIT_FAILURE
#error EXIT_FAILURE not defined
@@ -32,12 +39,23 @@
#error RAND_MAX not defined
#endif
+template <class TestType, class IntType>
+void test_div_struct() {
+ TestType obj;
+ static_assert(sizeof(obj) >= sizeof(IntType) * 2, ""); // >= to account for alignment.
+ static_assert((std::is_same<decltype(obj.quot), IntType>::value), "");
+ static_assert((std::is_same<decltype(obj.rem), IntType>::value), "");
+ ((void) obj);
+};
+
int main()
{
std::size_t s = 0;
- std::div_t d;
- std::ldiv_t ld;
- std::lldiv_t lld;
+ ((void)s);
+ static_assert((std::is_same<std::size_t, decltype(sizeof(int))>::value), "");
+ test_div_struct<std::div_t, int>();
+ test_div_struct<std::ldiv_t, long>();
+ test_div_struct<std::lldiv_t, long long>();
char** endptr = 0;
static_assert((std::is_same<decltype(std::atof("")), double>::value), "");
static_assert((std::is_same<decltype(std::atoi("")), int>::value), "");
diff --git a/test/std/language.support/support.runtime/ctime.pass.cpp b/test/std/language.support/support.runtime/ctime.pass.cpp
index 8c5d2811d8a9..03a0aa4d6966 100644
--- a/test/std/language.support/support.runtime/ctime.pass.cpp
+++ b/test/std/language.support/support.runtime/ctime.pass.cpp
@@ -23,6 +23,7 @@
int main()
{
std::clock_t c = 0;
+ ((void)c);
std::size_t s = 0;
std::time_t t = 0;
std::tm tm = {0};
diff --git a/test/std/language.support/support.types/nullptr_t.pass.cpp b/test/std/language.support/support.types/nullptr_t.pass.cpp
index 4d7c8b0bc0a6..1cc2aa62032e 100644
--- a/test/std/language.support/support.types/nullptr_t.pass.cpp
+++ b/test/std/language.support/support.types/nullptr_t.pass.cpp
@@ -52,6 +52,24 @@ void test_comparisons()
assert(!(nullptr > p));
}
+#if defined(__clang__)
+#pragma clang diagnostic push
+#pragma clang diagnostic ignored "-Wnull-conversion"
+#endif
+void test_nullptr_conversions() {
+ {
+ bool b = nullptr;
+ assert(!b);
+ }
+ {
+ bool b(nullptr);
+ assert(!b);
+ }
+}
+#if defined(__clang__)
+#pragma clang diagnostic pop
+#endif
+
int main()
{
@@ -72,8 +90,5 @@ int main()
test_comparisons<A*>();
test_comparisons<void(*)()>();
}
- {
- bool b = nullptr;
- assert(!b);
- }
+ test_nullptr_conversions();
}
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 897141235cf2..04cc060ad985 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
@@ -26,7 +26,7 @@
int main()
{
// Ensure that the default locale is not C. If it is, the second tests will fail.
- putenv(const_cast<char*>("LANG=" LOCALE_en_US_UTF_8));
+ putenv(const_cast<char*>("LC_COLLATE=" LOCALE_en_US_UTF_8));
{
std::locale l(LOCALE_en_US_UTF_8);
{
diff --git a/test/std/localization/locale.categories/category.ctype/locale.codecvt/locale.codecvt.members/char16_t_in.pass.cpp b/test/std/localization/locale.categories/category.ctype/locale.codecvt/locale.codecvt.members/char16_t_in.pass.cpp
index 331f4ba222dd..41c26508e22e 100644
--- a/test/std/localization/locale.categories/category.ctype/locale.codecvt/locale.codecvt.members/char16_t_in.pass.cpp
+++ b/test/std/localization/locale.categories/category.ctype/locale.codecvt/locale.codecvt.members/char16_t_in.pass.cpp
@@ -28,7 +28,7 @@ int main()
const char from[] = "some text";
F::intern_type to[9];
const F& f = std::use_facet<F>(l);
- std::mbstate_t mbs = {0};
+ std::mbstate_t mbs = {};
const char* from_next = 0;
F::intern_type* to_next = 0;
assert(f.in(mbs, from, from + 9, from_next,
diff --git a/test/std/localization/locale.categories/category.ctype/locale.codecvt/locale.codecvt.members/char16_t_length.pass.cpp b/test/std/localization/locale.categories/category.ctype/locale.codecvt/locale.codecvt.members/char16_t_length.pass.cpp
index 34ab2178327e..bd3482974a53 100644
--- a/test/std/localization/locale.categories/category.ctype/locale.codecvt/locale.codecvt.members/char16_t_length.pass.cpp
+++ b/test/std/localization/locale.categories/category.ctype/locale.codecvt/locale.codecvt.members/char16_t_length.pass.cpp
@@ -22,7 +22,7 @@ int main()
{
std::locale l = std::locale::classic();
const F& f = std::use_facet<F>(l);
- std::mbstate_t mbs = {0};
+ std::mbstate_t mbs = {};
const char from[] = "some text";
assert(f.length(mbs, from, from+10, 0) == 0);
assert(f.length(mbs, from, from+10, 8) == 8);
diff --git a/test/std/localization/locale.categories/category.ctype/locale.codecvt/locale.codecvt.members/char16_t_out.pass.cpp b/test/std/localization/locale.categories/category.ctype/locale.codecvt/locale.codecvt.members/char16_t_out.pass.cpp
index 0f65f13242c2..18997714fda6 100644
--- a/test/std/localization/locale.categories/category.ctype/locale.codecvt/locale.codecvt.members/char16_t_out.pass.cpp
+++ b/test/std/localization/locale.categories/category.ctype/locale.codecvt/locale.codecvt.members/char16_t_out.pass.cpp
@@ -31,7 +31,7 @@ int main()
{
F::intern_type from[9] = {'s', 'o', 'm', 'e', ' ', 't', 'e', 'x', 't'};
char to[9] = {0};
- std::mbstate_t mbs = {0};
+ std::mbstate_t mbs = {};
const F::intern_type* from_next = 0;
char* to_next = 0;
F::result r = f.out(mbs, from, from + 9, from_next,
diff --git a/test/std/localization/locale.categories/category.ctype/locale.codecvt/locale.codecvt.members/char16_t_unshift.pass.cpp b/test/std/localization/locale.categories/category.ctype/locale.codecvt/locale.codecvt.members/char16_t_unshift.pass.cpp
index c21303070717..9b91a03d493a 100644
--- a/test/std/localization/locale.categories/category.ctype/locale.codecvt/locale.codecvt.members/char16_t_unshift.pass.cpp
+++ b/test/std/localization/locale.categories/category.ctype/locale.codecvt/locale.codecvt.members/char16_t_unshift.pass.cpp
@@ -26,7 +26,7 @@ int main()
std::locale l = std::locale::classic();
std::vector<char> to(3);
const F& f = std::use_facet<F>(l);
- std::mbstate_t mbs = {0};
+ std::mbstate_t mbs = {};
char* to_next = 0;
assert(f.unshift(mbs, to.data(), to.data() + to.size(), to_next) == F::noconv);
assert(to_next == to.data());
diff --git a/test/std/localization/locale.categories/category.ctype/locale.codecvt/locale.codecvt.members/char32_t_in.pass.cpp b/test/std/localization/locale.categories/category.ctype/locale.codecvt/locale.codecvt.members/char32_t_in.pass.cpp
index 8fb28f0a26ac..8f9d1e6cd1f0 100644
--- a/test/std/localization/locale.categories/category.ctype/locale.codecvt/locale.codecvt.members/char32_t_in.pass.cpp
+++ b/test/std/localization/locale.categories/category.ctype/locale.codecvt/locale.codecvt.members/char32_t_in.pass.cpp
@@ -28,7 +28,7 @@ int main()
const char from[] = "some text";
F::intern_type to[9];
const F& f = std::use_facet<F>(l);
- std::mbstate_t mbs = {0};
+ std::mbstate_t mbs = {};
const char* from_next = 0;
F::intern_type* to_next = 0;
assert(f.in(mbs, from, from + 9, from_next,
diff --git a/test/std/localization/locale.categories/category.ctype/locale.codecvt/locale.codecvt.members/char32_t_length.pass.cpp b/test/std/localization/locale.categories/category.ctype/locale.codecvt/locale.codecvt.members/char32_t_length.pass.cpp
index d8555d188566..4455b9f55fbb 100644
--- a/test/std/localization/locale.categories/category.ctype/locale.codecvt/locale.codecvt.members/char32_t_length.pass.cpp
+++ b/test/std/localization/locale.categories/category.ctype/locale.codecvt/locale.codecvt.members/char32_t_length.pass.cpp
@@ -22,7 +22,7 @@ int main()
{
std::locale l = std::locale::classic();
const F& f = std::use_facet<F>(l);
- std::mbstate_t mbs = {0};
+ std::mbstate_t mbs = {};
const char from[] = "some text";
assert(f.length(mbs, from, from+10, 0) == 0);
assert(f.length(mbs, from, from+10, 8) == 8);
diff --git a/test/std/localization/locale.categories/category.ctype/locale.codecvt/locale.codecvt.members/char32_t_out.pass.cpp b/test/std/localization/locale.categories/category.ctype/locale.codecvt/locale.codecvt.members/char32_t_out.pass.cpp
index a1d11f748d9f..4e0f600097a0 100644
--- a/test/std/localization/locale.categories/category.ctype/locale.codecvt/locale.codecvt.members/char32_t_out.pass.cpp
+++ b/test/std/localization/locale.categories/category.ctype/locale.codecvt/locale.codecvt.members/char32_t_out.pass.cpp
@@ -31,7 +31,7 @@ int main()
{
F::intern_type from[9] = {'s', 'o', 'm', 'e', ' ', 't', 'e', 'x', 't'};
char to[9] = {0};
- std::mbstate_t mbs = {0};
+ std::mbstate_t mbs = {};
const F::intern_type* from_next = 0;
char* to_next = 0;
F::result r = f.out(mbs, from, from + 9, from_next,
diff --git a/test/std/localization/locale.categories/category.ctype/locale.codecvt/locale.codecvt.members/char32_t_unshift.pass.cpp b/test/std/localization/locale.categories/category.ctype/locale.codecvt/locale.codecvt.members/char32_t_unshift.pass.cpp
index 1bd45e0370d9..0a4aa20039c5 100644
--- a/test/std/localization/locale.categories/category.ctype/locale.codecvt/locale.codecvt.members/char32_t_unshift.pass.cpp
+++ b/test/std/localization/locale.categories/category.ctype/locale.codecvt/locale.codecvt.members/char32_t_unshift.pass.cpp
@@ -26,7 +26,7 @@ int main()
std::locale l = std::locale::classic();
std::vector<char> to(3);
const F& f = std::use_facet<F>(l);
- std::mbstate_t mbs = {0};
+ std::mbstate_t mbs = {};
char* to_next = 0;
assert(f.unshift(mbs, to.data(), to.data() + to.size(), to_next) == F::noconv);
assert(to_next == to.data());
diff --git a/test/std/localization/locale.categories/category.ctype/locale.codecvt/locale.codecvt.members/char_in.pass.cpp b/test/std/localization/locale.categories/category.ctype/locale.codecvt/locale.codecvt.members/char_in.pass.cpp
index 4d2f6f260dfc..10c9fcdc03fe 100644
--- a/test/std/localization/locale.categories/category.ctype/locale.codecvt/locale.codecvt.members/char_in.pass.cpp
+++ b/test/std/localization/locale.categories/category.ctype/locale.codecvt/locale.codecvt.members/char_in.pass.cpp
@@ -28,7 +28,7 @@ int main()
const std::basic_string<F::intern_type> from("some text");
std::vector<char> to(from.size());
const F& f = std::use_facet<F>(l);
- std::mbstate_t mbs = {0};
+ std::mbstate_t mbs = {};
const char* from_next = 0;
char* to_next = 0;
assert(f.in(mbs, from.data(), from.data() + from.size(), from_next,
diff --git a/test/std/localization/locale.categories/category.ctype/locale.codecvt/locale.codecvt.members/char_length.pass.cpp b/test/std/localization/locale.categories/category.ctype/locale.codecvt/locale.codecvt.members/char_length.pass.cpp
index df33b182a07a..c5897c86bb8f 100644
--- a/test/std/localization/locale.categories/category.ctype/locale.codecvt/locale.codecvt.members/char_length.pass.cpp
+++ b/test/std/localization/locale.categories/category.ctype/locale.codecvt/locale.codecvt.members/char_length.pass.cpp
@@ -22,7 +22,7 @@ int main()
{
std::locale l = std::locale::classic();
const F& f = std::use_facet<F>(l);
- std::mbstate_t mbs = {0};
+ std::mbstate_t mbs = {};
const char from[10]= {0};
assert(f.length(mbs, from, from+10, 0) == 0);
assert(f.length(mbs, from, from+10, 9) == 9);
diff --git a/test/std/localization/locale.categories/category.ctype/locale.codecvt/locale.codecvt.members/char_out.pass.cpp b/test/std/localization/locale.categories/category.ctype/locale.codecvt/locale.codecvt.members/char_out.pass.cpp
index de7f024fd467..17bde6cecc2f 100644
--- a/test/std/localization/locale.categories/category.ctype/locale.codecvt/locale.codecvt.members/char_out.pass.cpp
+++ b/test/std/localization/locale.categories/category.ctype/locale.codecvt/locale.codecvt.members/char_out.pass.cpp
@@ -28,7 +28,7 @@ int main()
const std::basic_string<F::intern_type> from("some text");
std::vector<char> to(from.size());
const F& f = std::use_facet<F>(l);
- std::mbstate_t mbs = {0};
+ std::mbstate_t mbs = {};
const char* from_next = 0;
char* to_next = 0;
assert(f.out(mbs, from.data(), from.data() + from.size(), from_next,
diff --git a/test/std/localization/locale.categories/category.ctype/locale.codecvt/locale.codecvt.members/char_unshift.pass.cpp b/test/std/localization/locale.categories/category.ctype/locale.codecvt/locale.codecvt.members/char_unshift.pass.cpp
index 830bc43e9ead..834fa0f2724e 100644
--- a/test/std/localization/locale.categories/category.ctype/locale.codecvt/locale.codecvt.members/char_unshift.pass.cpp
+++ b/test/std/localization/locale.categories/category.ctype/locale.codecvt/locale.codecvt.members/char_unshift.pass.cpp
@@ -26,7 +26,7 @@ int main()
std::locale l = std::locale::classic();
std::vector<char> to(3);
const F& f = std::use_facet<F>(l);
- std::mbstate_t mbs = {0};
+ std::mbstate_t mbs = {};
char* to_next = 0;
assert(f.unshift(mbs, to.data(), to.data() + to.size(), to_next) == F::noconv);
assert(to_next == to.data());
diff --git a/test/std/localization/locale.categories/category.ctype/locale.codecvt/locale.codecvt.members/utf_sanity_check.pass.cpp b/test/std/localization/locale.categories/category.ctype/locale.codecvt/locale.codecvt.members/utf_sanity_check.pass.cpp
index 2505582c2613..c256078786d7 100644
--- a/test/std/localization/locale.categories/category.ctype/locale.codecvt/locale.codecvt.members/utf_sanity_check.pass.cpp
+++ b/test/std/localization/locale.categories/category.ctype/locale.codecvt/locale.codecvt.members/utf_sanity_check.pass.cpp
@@ -30,7 +30,7 @@ int main()
const F32_8& f32_8 = std::use_facet<F32_8>(std::locale::classic());
const F32_16& f32_16 = std::use_facet<F32_16>(l);
const F16_8& f16_8 = std::use_facet<F16_8>(std::locale::classic());
- std::mbstate_t mbs = {0};
+ std::mbstate_t mbs = {};
F32_8::intern_type* c32p;
F16_8::intern_type* c16p;
F32_8::extern_type* c8p;
diff --git a/test/std/localization/locale.categories/category.ctype/locale.codecvt/locale.codecvt.members/wchar_t_in.pass.cpp b/test/std/localization/locale.categories/category.ctype/locale.codecvt/locale.codecvt.members/wchar_t_in.pass.cpp
index e98097ba889c..a4ff61bcff65 100644
--- a/test/std/localization/locale.categories/category.ctype/locale.codecvt/locale.codecvt.members/wchar_t_in.pass.cpp
+++ b/test/std/localization/locale.categories/category.ctype/locale.codecvt/locale.codecvt.members/wchar_t_in.pass.cpp
@@ -29,7 +29,7 @@ int main()
const std::basic_string<F::intern_type> expected(from.begin(), from.end());
std::basic_string<F::intern_type> to(from.size(), F::intern_type());
const F& f = std::use_facet<F>(l);
- std::mbstate_t mbs = {0};
+ std::mbstate_t mbs = {};
const F::extern_type* from_next = 0;
F::intern_type* to_next = 0;
F::result r = f.in(mbs, from.data(), from.data() + from.size(), from_next,
diff --git a/test/std/localization/locale.categories/category.ctype/locale.codecvt/locale.codecvt.members/wchar_t_length.pass.cpp b/test/std/localization/locale.categories/category.ctype/locale.codecvt/locale.codecvt.members/wchar_t_length.pass.cpp
index f97f2b4a324d..69037aad733d 100644
--- a/test/std/localization/locale.categories/category.ctype/locale.codecvt/locale.codecvt.members/wchar_t_length.pass.cpp
+++ b/test/std/localization/locale.categories/category.ctype/locale.codecvt/locale.codecvt.members/wchar_t_length.pass.cpp
@@ -22,7 +22,7 @@ int main()
{
std::locale l = std::locale::classic();
const F& f = std::use_facet<F>(l);
- std::mbstate_t mbs = {0};
+ std::mbstate_t mbs = {};
const char* from = "123467890";
assert(f.length(mbs, from, from+10, 0) == 0);
assert(f.length(mbs, from, from+10, 9) == 9);
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 dce2d38c8279..6f025e3ff094 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
@@ -29,7 +29,7 @@ int main()
{
const std::basic_string<F::intern_type> from(L"some text");
std::vector<char> to(from.size()+1);
- std::mbstate_t mbs = {0};
+ std::mbstate_t mbs = {};
const F::intern_type* from_next = 0;
char* to_next = 0;
F::result r = f.out(mbs, from.data(), from.data() + from.size(), from_next,
@@ -43,7 +43,7 @@ int main()
std::basic_string<F::intern_type> from(L"some text");
from[4] = '\0';
std::vector<char> to(from.size()+1);
- std::mbstate_t mbs = {0};
+ std::mbstate_t mbs = {};
const F::intern_type* from_next = 0;
char* to_next = 0;
F::result r = f.out(mbs, from.data(), from.data() + from.size(), from_next,
@@ -56,7 +56,7 @@ int main()
{
std::basic_string<F::intern_type> from(L"some text");
std::vector<char> to(from.size()-1);
- std::mbstate_t mbs = {0};
+ std::mbstate_t mbs = {};
const F::intern_type* from_next = 0;
char* to_next = 0;
F::result r = f.out(mbs, from.data(), from.data() + from.size(), from_next,
diff --git a/test/std/localization/locale.categories/category.ctype/locale.codecvt/locale.codecvt.members/wchar_t_unshift.pass.cpp b/test/std/localization/locale.categories/category.ctype/locale.codecvt/locale.codecvt.members/wchar_t_unshift.pass.cpp
index 4d8895cf1a7e..10ab7a2b89f4 100644
--- a/test/std/localization/locale.categories/category.ctype/locale.codecvt/locale.codecvt.members/wchar_t_unshift.pass.cpp
+++ b/test/std/localization/locale.categories/category.ctype/locale.codecvt/locale.codecvt.members/wchar_t_unshift.pass.cpp
@@ -28,7 +28,7 @@ int main()
std::locale l = std::locale::classic();
std::vector<F::extern_type> to(3);
const F& f = std::use_facet<F>(l);
- std::mbstate_t mbs = {0};
+ std::mbstate_t mbs = {};
F::extern_type* to_next = 0;
assert(f.unshift(mbs, to.data(), to.data() + to.size(), to_next) == F::ok);
assert(to_next == to.data());
diff --git a/test/std/localization/locale.categories/category.time/locale.time.get.byname/get_monthname.pass.cpp b/test/std/localization/locale.categories/category.time/locale.time.get.byname/get_monthname.pass.cpp
index a442ae577b47..7ad431652a89 100644
--- a/test/std/localization/locale.categories/category.time/locale.time.get.byname/get_monthname.pass.cpp
+++ b/test/std/localization/locale.categories/category.time/locale.time.get.byname/get_monthname.pass.cpp
@@ -12,7 +12,7 @@
// REQUIRES: locale.ru_RU.UTF-8
// REQUIRES: locale.zh_CN.UTF-8
-// NOTE: debian and opensuse use old locale data for ru_RU.UTF-8 abreviated
+// NOTE: debian and opensuse use old locale data for ru_RU.UTF-8 abbreviated
// months. This locale data was changed in glibc 2.14.
// Debian uses glibc 2.13 as of 20/11/2014
// OpenSuse uses glibc 2.19 with old locale data as of 20/11/2014
diff --git a/test/std/localization/locale.categories/category.time/locale.time.get.byname/get_monthname_wide.pass.cpp b/test/std/localization/locale.categories/category.time/locale.time.get.byname/get_monthname_wide.pass.cpp
index 631a500362da..631a6de03d82 100644
--- a/test/std/localization/locale.categories/category.time/locale.time.get.byname/get_monthname_wide.pass.cpp
+++ b/test/std/localization/locale.categories/category.time/locale.time.get.byname/get_monthname_wide.pass.cpp
@@ -12,7 +12,7 @@
// REQUIRES: locale.ru_RU.UTF-8
// REQUIRES: locale.zh_CN.UTF-8
-// NOTE: debian and opensuse use bad locale data for ru_RU.UTF-8 abreviated
+// NOTE: debian and opensuse use bad locale data for ru_RU.UTF-8 abbreviated
// months. This locale data was fixed in glibc 2.14.
// Debian uses glibc 2.13 as of 20/11/2014
// OpenSuse uses glibc 2.19 with old locale data as of 20/11/2014
diff --git a/test/std/localization/locales/locale.convenience/conversions/conversions.string/ctor_err_string.pass.cpp b/test/std/localization/locales/locale.convenience/conversions/conversions.string/ctor_err_string.pass.cpp
index 27a3da76270f..5a58b06cc2d7 100644
--- a/test/std/localization/locales/locale.convenience/conversions/conversions.string/ctor_err_string.pass.cpp
+++ b/test/std/localization/locales/locale.convenience/conversions/conversions.string/ctor_err_string.pass.cpp
@@ -7,6 +7,7 @@
//
//===----------------------------------------------------------------------===//
+// XFAIL: libcpp-no-exceptions
// <locale>
// wstring_convert<Codecvt, Elem, Wide_alloc, Byte_alloc>
diff --git a/test/std/localization/locales/locale.global.templates/use_facet.pass.cpp b/test/std/localization/locales/locale.global.templates/use_facet.pass.cpp
index a40a2d2d8833..303fd790566c 100644
--- a/test/std/localization/locales/locale.global.templates/use_facet.pass.cpp
+++ b/test/std/localization/locales/locale.global.templates/use_facet.pass.cpp
@@ -7,6 +7,7 @@
//
//===----------------------------------------------------------------------===//
+// XFAIL: libcpp-no-exceptions
// <locale>
// template <class Facet> const Facet& use_facet(const locale& loc);
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 3567bf56c55a..b808a7650c47 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
@@ -7,6 +7,7 @@
//
//===----------------------------------------------------------------------===//
+// XFAIL: libcpp-no-exceptions
// REQUIRES: locale.ru_RU.UTF-8
// REQUIRES: locale.zh_CN.UTF-8
// UNSUPPORTED: sanitizer-new-delete
diff --git a/test/std/localization/locales/locale/locale.members/combine.pass.cpp b/test/std/localization/locales/locale/locale.members/combine.pass.cpp
index e956102c08fc..4573a4b01f47 100644
--- a/test/std/localization/locales/locale/locale.members/combine.pass.cpp
+++ b/test/std/localization/locales/locale/locale.members/combine.pass.cpp
@@ -7,6 +7,7 @@
//
//===----------------------------------------------------------------------===//
+// XFAIL: libcpp-no-exceptions
// <locale>
// template <class Facet> locale combine(const locale& other) const;
diff --git a/test/std/numerics/rand/rand.device/ctor.pass.cpp b/test/std/numerics/rand/rand.device/ctor.pass.cpp
index 97f46b26aa27..a7b5a7c9c348 100644
--- a/test/std/numerics/rand/rand.device/ctor.pass.cpp
+++ b/test/std/numerics/rand/rand.device/ctor.pass.cpp
@@ -7,6 +7,7 @@
//
//===----------------------------------------------------------------------===//
+// XFAIL: libcpp-no-exceptions
// <random>
// class random_device;
diff --git a/test/std/numerics/rand/rand.device/eval.pass.cpp b/test/std/numerics/rand/rand.device/eval.pass.cpp
index 72aff076a5df..ed5361fbde75 100644
--- a/test/std/numerics/rand/rand.device/eval.pass.cpp
+++ b/test/std/numerics/rand/rand.device/eval.pass.cpp
@@ -7,6 +7,7 @@
//
//===----------------------------------------------------------------------===//
+// XFAIL: libcpp-no-exceptions
// <random>
// class random_device;
diff --git a/test/std/re/re.alg/re.alg.search/grep.pass.cpp b/test/std/re/re.alg/re.alg.search/grep.pass.cpp
index 113243ecd349..9d74c2417d2d 100644
--- a/test/std/re/re.alg/re.alg.search/grep.pass.cpp
+++ b/test/std/re/re.alg/re.alg.search/grep.pass.cpp
@@ -7,6 +7,7 @@
//
//===----------------------------------------------------------------------===//
+// XFAIL: libcpp-no-exceptions
// <regex>
// template <class BidirectionalIterator, class Allocator, class charT, class traits>
@@ -19,8 +20,34 @@
#include <regex>
#include <cassert>
+#include "test_macros.h"
#include "test_iterators.h"
+extern "C" void LLVMFuzzerTestOneInput(const char *data)
+{
+ size_t size = strlen(data);
+ if (size > 0)
+ {
+ try
+ {
+ std::regex::flag_type flag = std::regex_constants::grep;
+ std::string s((const char *)data, size);
+ std::regex re(s, flag);
+ std::regex_match(s, re);
+ }
+ catch (std::regex_error &ex) {}
+ }
+}
+
+
+void fuzz_tests() // patterns that the fuzzer has found
+{
+// Raw string literals are a C++11 feature.
+#if TEST_STD_VER >= 11
+ LLVMFuzzerTestOneInput(R"XX(Õ)_%()()((\8'_%()_%()_%()_%(()_%()_%()_%(.t;)()¥f()_%()(.)_%;)()!¥f(((()()XX");
+#endif
+}
+
int main()
{
{
@@ -55,4 +82,5 @@ int main()
assert(m.position(0) == 0);
assert(m.str(0) == "");
}
+ fuzz_tests();
}
diff --git a/test/std/re/re.regex/re.regex.assign/assign.pass.cpp b/test/std/re/re.regex/re.regex.assign/assign.pass.cpp
index 8bf98268c493..9c5f834b9452 100644
--- a/test/std/re/re.regex/re.regex.assign/assign.pass.cpp
+++ b/test/std/re/re.regex/re.regex.assign/assign.pass.cpp
@@ -7,6 +7,7 @@
//
//===----------------------------------------------------------------------===//
+// XFAIL: libcpp-no-exceptions
// <regex>
// template <class charT, class traits = regex_traits<charT>> class basic_regex;
diff --git a/test/std/re/re.regex/re.regex.construct/bad_escape.pass.cpp b/test/std/re/re.regex/re.regex.construct/bad_escape.pass.cpp
index 9455527412bb..4da4d957a88a 100644
--- a/test/std/re/re.regex/re.regex.construct/bad_escape.pass.cpp
+++ b/test/std/re/re.regex/re.regex.construct/bad_escape.pass.cpp
@@ -7,6 +7,7 @@
//
//===----------------------------------------------------------------------===//
+// XFAIL: libcpp-no-exceptions
// <regex>
// template <class charT, class traits = regex_traits<charT>> class basic_regex;
@@ -22,7 +23,7 @@ static bool error_escape_thrown(const char *pat)
bool result = false;
try {
std::regex re(pat);
- } catch (std::regex_error &ex) {
+ } catch (const std::regex_error &ex) {
result = (ex.code() == std::regex_constants::error_escape);
}
return result;
diff --git a/test/std/re/re.regex/re.regex.construct/bad_repeat.pass.cpp b/test/std/re/re.regex/re.regex.construct/bad_repeat.pass.cpp
new file mode 100644
index 000000000000..c21672f02c98
--- /dev/null
+++ b/test/std/re/re.regex/re.regex.construct/bad_repeat.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.
+//
+//===----------------------------------------------------------------------===//
+
+// XFAIL: libcpp-no-exceptions
+// <regex>
+
+// template <class charT, class traits = regex_traits<charT>> class basic_regex;
+
+// template <class ST, class SA>
+// basic_regex(const basic_string<charT, ST, SA>& s);
+
+#include <regex>
+#include <cassert>
+
+static bool error_badrepeat_thrown(const char *pat)
+{
+ bool result = false;
+ try {
+ std::regex re(pat);
+ } catch (const std::regex_error &ex) {
+ result = (ex.code() == std::regex_constants::error_badrepeat);
+ }
+ return result;
+}
+
+int main()
+{
+ assert(error_badrepeat_thrown("?a"));
+ assert(error_badrepeat_thrown("*a"));
+ assert(error_badrepeat_thrown("+a"));
+ assert(error_badrepeat_thrown("{a"));
+
+ assert(error_badrepeat_thrown("?(a+)"));
+ assert(error_badrepeat_thrown("*(a+)"));
+ assert(error_badrepeat_thrown("+(a+)"));
+ assert(error_badrepeat_thrown("{(a+)"));
+}
diff --git a/test/std/strings/basic.string/allocator_mismatch.fail.cpp b/test/std/strings/basic.string/allocator_mismatch.fail.cpp
new file mode 100644
index 000000000000..644137ec2576
--- /dev/null
+++ b/test/std/strings/basic.string/allocator_mismatch.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <string>
+// The container's value type must be the same as the allocator's value type
+
+#include <string>
+
+int main()
+{
+ std::basic_string<char, std::char_traits<char>, std::allocator<int> > s;
+}
diff --git a/test/std/strings/basic.string/string.access/at.pass.cpp b/test/std/strings/basic.string/string.access/at.pass.cpp
index 8fada8fb1eea..87998e18c581 100644
--- a/test/std/strings/basic.string/string.access/at.pass.cpp
+++ b/test/std/strings/basic.string/string.access/at.pass.cpp
@@ -7,6 +7,7 @@
//
//===----------------------------------------------------------------------===//
+// XFAIL: libcpp-no-exceptions
// <string>
// const_reference at(size_type pos) const;
diff --git a/test/std/strings/basic.string/string.capacity/capacity.pass.cpp b/test/std/strings/basic.string/string.capacity/capacity.pass.cpp
index bae762155527..c05346a633e9 100644
--- a/test/std/strings/basic.string/string.capacity/capacity.pass.cpp
+++ b/test/std/strings/basic.string/string.capacity/capacity.pass.cpp
@@ -7,6 +7,7 @@
//
//===----------------------------------------------------------------------===//
+// XFAIL: libcpp-no-exceptions
// <string>
// size_type capacity() const;
diff --git a/test/std/strings/basic.string/string.capacity/max_size.pass.cpp b/test/std/strings/basic.string/string.capacity/max_size.pass.cpp
index e4ff556d9e3f..d857be28a6c9 100644
--- a/test/std/strings/basic.string/string.capacity/max_size.pass.cpp
+++ b/test/std/strings/basic.string/string.capacity/max_size.pass.cpp
@@ -7,6 +7,7 @@
//
//===----------------------------------------------------------------------===//
+// XFAIL: libcpp-no-exceptions
// <string>
// size_type max_size() const;
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 bbadb9ccc5a8..9c8f67950fb4 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
@@ -7,6 +7,7 @@
//
//===----------------------------------------------------------------------===//
+// XFAIL: libcpp-no-exceptions
// <string>
// size_type max_size() const;
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 a155825be752..569ca760c7ce 100644
--- a/test/std/strings/basic.string/string.capacity/reserve.pass.cpp
+++ b/test/std/strings/basic.string/string.capacity/reserve.pass.cpp
@@ -7,6 +7,7 @@
//
//===----------------------------------------------------------------------===//
+// XFAIL: libcpp-no-exceptions
// <string>
// void reserve(size_type res_arg=0);
diff --git a/test/std/strings/basic.string/string.capacity/resize_size.pass.cpp b/test/std/strings/basic.string/string.capacity/resize_size.pass.cpp
index 14fe209fd59a..16eca38e8012 100644
--- a/test/std/strings/basic.string/string.capacity/resize_size.pass.cpp
+++ b/test/std/strings/basic.string/string.capacity/resize_size.pass.cpp
@@ -7,6 +7,7 @@
//
//===----------------------------------------------------------------------===//
+// XFAIL: libcpp-no-exceptions
// <string>
// void resize(size_type n);
diff --git a/test/std/strings/basic.string/string.capacity/resize_size_char.pass.cpp b/test/std/strings/basic.string/string.capacity/resize_size_char.pass.cpp
index f293df971f21..cb01be01f34b 100644
--- a/test/std/strings/basic.string/string.capacity/resize_size_char.pass.cpp
+++ b/test/std/strings/basic.string/string.capacity/resize_size_char.pass.cpp
@@ -7,6 +7,7 @@
//
//===----------------------------------------------------------------------===//
+// XFAIL: libcpp-no-exceptions
// <string>
// void resize(size_type n, charT c);
diff --git a/test/std/strings/basic.string/string.cons/move_assign_noexcept.pass.cpp b/test/std/strings/basic.string/string.cons/move_assign_noexcept.pass.cpp
index 32c9514a9154..d7bd5e06bbe9 100644
--- a/test/std/strings/basic.string/string.cons/move_assign_noexcept.pass.cpp
+++ b/test/std/strings/basic.string/string.cons/move_assign_noexcept.pass.cpp
@@ -11,14 +11,18 @@
// basic_string& operator=(basic_string&& c)
// noexcept(
-// allocator_type::propagate_on_container_move_assignment::value &&
-// is_nothrow_move_assignable<allocator_type>::value);
-
-// This tests a conforming extension
+// allocator_traits<allocator_type>::propagate_on_container_move_assignment::value ||
+// allocator_traits<allocator_type>::is_always_equal::value); // C++17
+//
+// before C++17, we use the conforming extension
+// noexcept(
+// allocator_type::propagate_on_container_move_assignment::value &&
+// is_nothrow_move_assignable<allocator_type>::value);
#include <string>
#include <cassert>
+#include "test_macros.h"
#include "test_allocator.h"
template <class T>
@@ -28,6 +32,32 @@ struct some_alloc
some_alloc(const some_alloc&);
};
+template <class T>
+struct some_alloc2
+{
+ typedef T value_type;
+
+ some_alloc2() {}
+ some_alloc2(const some_alloc2&);
+ void deallocate(void*, unsigned) {}
+
+ typedef std::false_type propagate_on_container_move_assignment;
+ typedef std::true_type is_always_equal;
+};
+
+template <class T>
+struct some_alloc3
+{
+ typedef T value_type;
+
+ some_alloc3() {}
+ some_alloc3(const some_alloc3&);
+ void deallocate(void*, unsigned) {}
+
+ typedef std::false_type propagate_on_container_move_assignment;
+ typedef std::false_type is_always_equal;
+};
+
int main()
{
#if __has_feature(cxx_noexcept)
@@ -41,7 +71,25 @@ int main()
}
{
typedef std::basic_string<char, std::char_traits<char>, some_alloc<char>> C;
+#if TEST_STD_VER > 14
+ // if the allocators are always equal, then the move assignment can be noexcept
+ static_assert( std::is_nothrow_move_assignable<C>::value, "");
+#else
static_assert(!std::is_nothrow_move_assignable<C>::value, "");
+#endif
+ }
+#if TEST_STD_VER > 14
+ {
+ // POCMA is false, always equal
+ typedef std::basic_string<char, std::char_traits<char>, some_alloc2<char>> C;
+ static_assert( std::is_nothrow_move_assignable<C>::value, "");
}
+ {
+ // POCMA is false, not always equal
+ typedef std::basic_string<char, std::char_traits<char>, some_alloc3<char>> C;
+ static_assert(!std::is_nothrow_move_assignable<C>::value, "");
+ }
+#endif
+
#endif
}
diff --git a/test/std/strings/basic.string/string.cons/substr.pass.cpp b/test/std/strings/basic.string/string.cons/substr.pass.cpp
index 2a9bf2ac88bb..2e42be13a842 100644
--- a/test/std/strings/basic.string/string.cons/substr.pass.cpp
+++ b/test/std/strings/basic.string/string.cons/substr.pass.cpp
@@ -7,6 +7,7 @@
//
//===----------------------------------------------------------------------===//
+// XFAIL: libcpp-no-exceptions
// <string>
// basic_string(const basic_string<charT,traits,Allocator>& str,
diff --git a/test/std/strings/basic.string/string.modifiers/string_append/string_size_size.pass.cpp b/test/std/strings/basic.string/string.modifiers/string_append/string_size_size.pass.cpp
index e8f54f475240..1d409b0932da 100644
--- a/test/std/strings/basic.string/string.modifiers/string_append/string_size_size.pass.cpp
+++ b/test/std/strings/basic.string/string.modifiers/string_append/string_size_size.pass.cpp
@@ -7,6 +7,7 @@
//
//===----------------------------------------------------------------------===//
+// XFAIL: libcpp-no-exceptions
// <string>
// basic_string<charT,traits,Allocator>&
diff --git a/test/std/strings/basic.string/string.modifiers/string_assign/string.pass.cpp b/test/std/strings/basic.string/string.modifiers/string_assign/string.pass.cpp
index d7ddb77b8e0f..99b53155d37e 100644
--- a/test/std/strings/basic.string/string.modifiers/string_assign/string.pass.cpp
+++ b/test/std/strings/basic.string/string.modifiers/string_assign/string.pass.cpp
@@ -76,4 +76,10 @@ int main()
S("12345678901234567890"));
}
#endif
+#if __cplusplus > 201402L
+ {
+ typedef std::string S;
+ static_assert(noexcept(S().assign(S())), ""); // LWG#2063
+ }
+#endif
}
diff --git a/test/std/strings/basic.string/string.modifiers/string_assign/string_size_size.pass.cpp b/test/std/strings/basic.string/string.modifiers/string_assign/string_size_size.pass.cpp
index 5f5983e76c94..db9e9a3271c6 100644
--- a/test/std/strings/basic.string/string.modifiers/string_assign/string_size_size.pass.cpp
+++ b/test/std/strings/basic.string/string.modifiers/string_assign/string_size_size.pass.cpp
@@ -7,6 +7,7 @@
//
//===----------------------------------------------------------------------===//
+// XFAIL: libcpp-no-exceptions
// <string>
// basic_string<charT,traits,Allocator>&
diff --git a/test/std/strings/basic.string/string.modifiers/string_copy/copy.pass.cpp b/test/std/strings/basic.string/string.modifiers/string_copy/copy.pass.cpp
index 33801352816f..69f001cf4f00 100644
--- a/test/std/strings/basic.string/string.modifiers/string_copy/copy.pass.cpp
+++ b/test/std/strings/basic.string/string.modifiers/string_copy/copy.pass.cpp
@@ -7,6 +7,7 @@
//
//===----------------------------------------------------------------------===//
+// XFAIL: libcpp-no-exceptions
// <string>
// size_type copy(charT* s, size_type n, size_type pos = 0) const;
diff --git a/test/std/strings/basic.string/string.modifiers/string_erase/size_size.pass.cpp b/test/std/strings/basic.string/string.modifiers/string_erase/size_size.pass.cpp
index bc9ec1cf8255..11015cb973ed 100644
--- a/test/std/strings/basic.string/string.modifiers/string_erase/size_size.pass.cpp
+++ b/test/std/strings/basic.string/string.modifiers/string_erase/size_size.pass.cpp
@@ -7,6 +7,7 @@
//
//===----------------------------------------------------------------------===//
+// XFAIL: libcpp-no-exceptions
// <string>
// basic_string<charT,traits,Allocator>&
diff --git a/test/std/strings/basic.string/string.modifiers/string_insert/size_pointer.pass.cpp b/test/std/strings/basic.string/string.modifiers/string_insert/size_pointer.pass.cpp
index 734dd8dffb78..8277f88d99cd 100644
--- a/test/std/strings/basic.string/string.modifiers/string_insert/size_pointer.pass.cpp
+++ b/test/std/strings/basic.string/string.modifiers/string_insert/size_pointer.pass.cpp
@@ -7,6 +7,7 @@
//
//===----------------------------------------------------------------------===//
+// XFAIL: libcpp-no-exceptions
// <string>
// basic_string<charT,traits,Allocator>&
diff --git a/test/std/strings/basic.string/string.modifiers/string_insert/size_pointer_size.pass.cpp b/test/std/strings/basic.string/string.modifiers/string_insert/size_pointer_size.pass.cpp
index 29b00ec55b9f..4df5a14cbc0e 100644
--- a/test/std/strings/basic.string/string.modifiers/string_insert/size_pointer_size.pass.cpp
+++ b/test/std/strings/basic.string/string.modifiers/string_insert/size_pointer_size.pass.cpp
@@ -7,6 +7,7 @@
//
//===----------------------------------------------------------------------===//
+// XFAIL: libcpp-no-exceptions
// <string>
// basic_string<charT,traits,Allocator>&
diff --git a/test/std/strings/basic.string/string.modifiers/string_insert/size_size_char.pass.cpp b/test/std/strings/basic.string/string.modifiers/string_insert/size_size_char.pass.cpp
index fd85696704cd..20e030273962 100644
--- a/test/std/strings/basic.string/string.modifiers/string_insert/size_size_char.pass.cpp
+++ b/test/std/strings/basic.string/string.modifiers/string_insert/size_size_char.pass.cpp
@@ -7,6 +7,7 @@
//
//===----------------------------------------------------------------------===//
+// XFAIL: libcpp-no-exceptions
// <string>
// basic_string<charT,traits,Allocator>&
diff --git a/test/std/strings/basic.string/string.modifiers/string_insert/size_string.pass.cpp b/test/std/strings/basic.string/string.modifiers/string_insert/size_string.pass.cpp
index 8c18941cf46a..016dcaf396fe 100644
--- a/test/std/strings/basic.string/string.modifiers/string_insert/size_string.pass.cpp
+++ b/test/std/strings/basic.string/string.modifiers/string_insert/size_string.pass.cpp
@@ -7,6 +7,7 @@
//
//===----------------------------------------------------------------------===//
+// XFAIL: libcpp-no-exceptions
// <string>
// basic_string<charT,traits,Allocator>&
diff --git a/test/std/strings/basic.string/string.modifiers/string_insert/size_string_size_size.pass.cpp b/test/std/strings/basic.string/string.modifiers/string_insert/size_string_size_size.pass.cpp
index 51c9e72fc56f..3c4c818e0396 100644
--- a/test/std/strings/basic.string/string.modifiers/string_insert/size_string_size_size.pass.cpp
+++ b/test/std/strings/basic.string/string.modifiers/string_insert/size_string_size_size.pass.cpp
@@ -7,6 +7,7 @@
//
//===----------------------------------------------------------------------===//
+// XFAIL: libcpp-no-exceptions
// <string>
// basic_string<charT,traits,Allocator>&
diff --git a/test/std/strings/basic.string/string.modifiers/string_replace/size_size_pointer.pass.cpp b/test/std/strings/basic.string/string.modifiers/string_replace/size_size_pointer.pass.cpp
index 914081bbc456..18f32bfe222a 100644
--- a/test/std/strings/basic.string/string.modifiers/string_replace/size_size_pointer.pass.cpp
+++ b/test/std/strings/basic.string/string.modifiers/string_replace/size_size_pointer.pass.cpp
@@ -7,6 +7,7 @@
//
//===----------------------------------------------------------------------===//
+// XFAIL: libcpp-no-exceptions
// <string>
// basic_string<charT,traits,Allocator>&
diff --git a/test/std/strings/basic.string/string.modifiers/string_replace/size_size_pointer_size.pass.cpp b/test/std/strings/basic.string/string.modifiers/string_replace/size_size_pointer_size.pass.cpp
index d98704287327..fc7ee98f9e34 100644
--- a/test/std/strings/basic.string/string.modifiers/string_replace/size_size_pointer_size.pass.cpp
+++ b/test/std/strings/basic.string/string.modifiers/string_replace/size_size_pointer_size.pass.cpp
@@ -7,6 +7,7 @@
//
//===----------------------------------------------------------------------===//
+// XFAIL: libcpp-no-exceptions
// <string>
// basic_string<charT,traits,Allocator>&
diff --git a/test/std/strings/basic.string/string.modifiers/string_replace/size_size_size_char.pass.cpp b/test/std/strings/basic.string/string.modifiers/string_replace/size_size_size_char.pass.cpp
index 33f57fd3b86c..cda4112257b0 100644
--- a/test/std/strings/basic.string/string.modifiers/string_replace/size_size_size_char.pass.cpp
+++ b/test/std/strings/basic.string/string.modifiers/string_replace/size_size_size_char.pass.cpp
@@ -7,6 +7,7 @@
//
//===----------------------------------------------------------------------===//
+// XFAIL: libcpp-no-exceptions
// <string>
// basic_string<charT,traits,Allocator>&
diff --git a/test/std/strings/basic.string/string.modifiers/string_replace/size_size_string.pass.cpp b/test/std/strings/basic.string/string.modifiers/string_replace/size_size_string.pass.cpp
index c130780dc9d1..59e4d5c28096 100644
--- a/test/std/strings/basic.string/string.modifiers/string_replace/size_size_string.pass.cpp
+++ b/test/std/strings/basic.string/string.modifiers/string_replace/size_size_string.pass.cpp
@@ -7,6 +7,7 @@
//
//===----------------------------------------------------------------------===//
+// XFAIL: libcpp-no-exceptions
// <string>
// basic_string<charT,traits,Allocator>&
diff --git a/test/std/strings/basic.string/string.modifiers/string_replace/size_size_string_size_size.pass.cpp b/test/std/strings/basic.string/string.modifiers/string_replace/size_size_string_size_size.pass.cpp
index ef0de8975eda..f5ac2e8b6023 100644
--- a/test/std/strings/basic.string/string.modifiers/string_replace/size_size_string_size_size.pass.cpp
+++ b/test/std/strings/basic.string/string.modifiers/string_replace/size_size_string_size_size.pass.cpp
@@ -7,6 +7,7 @@
//
//===----------------------------------------------------------------------===//
+// XFAIL: libcpp-no-exceptions
// <string>
// basic_string<charT,traits,Allocator>&
diff --git a/test/std/strings/basic.string/string.ops/string_compare/size_size_pointer.pass.cpp b/test/std/strings/basic.string/string.ops/string_compare/size_size_pointer.pass.cpp
index 9ed58a3e9bbc..2fef19a24df9 100644
--- a/test/std/strings/basic.string/string.ops/string_compare/size_size_pointer.pass.cpp
+++ b/test/std/strings/basic.string/string.ops/string_compare/size_size_pointer.pass.cpp
@@ -7,6 +7,7 @@
//
//===----------------------------------------------------------------------===//
+// XFAIL: libcpp-no-exceptions
// <string>
// int compare(size_type pos, size_type n1, const charT *s) const;
diff --git a/test/std/strings/basic.string/string.ops/string_compare/size_size_pointer_size.pass.cpp b/test/std/strings/basic.string/string.ops/string_compare/size_size_pointer_size.pass.cpp
index ee804d9cc6e5..cc61a2e453c4 100644
--- a/test/std/strings/basic.string/string.ops/string_compare/size_size_pointer_size.pass.cpp
+++ b/test/std/strings/basic.string/string.ops/string_compare/size_size_pointer_size.pass.cpp
@@ -7,6 +7,7 @@
//
//===----------------------------------------------------------------------===//
+// XFAIL: libcpp-no-exceptions
// <string>
// int compare(size_type pos, size_type n1, const charT *s, size_type n2) const;
diff --git a/test/std/strings/basic.string/string.ops/string_compare/size_size_string.pass.cpp b/test/std/strings/basic.string/string.ops/string_compare/size_size_string.pass.cpp
index 3deb617e8d84..66417482fb58 100644
--- a/test/std/strings/basic.string/string.ops/string_compare/size_size_string.pass.cpp
+++ b/test/std/strings/basic.string/string.ops/string_compare/size_size_string.pass.cpp
@@ -7,6 +7,7 @@
//
//===----------------------------------------------------------------------===//
+// XFAIL: libcpp-no-exceptions
// <string>
// int compare(size_type pos1, size_type n1, const basic_string& str) const;
diff --git a/test/std/strings/basic.string/string.ops/string_compare/size_size_string_size_size.pass.cpp b/test/std/strings/basic.string/string.ops/string_compare/size_size_string_size_size.pass.cpp
index 122e6e9c487a..f5c067699233 100644
--- a/test/std/strings/basic.string/string.ops/string_compare/size_size_string_size_size.pass.cpp
+++ b/test/std/strings/basic.string/string.ops/string_compare/size_size_string_size_size.pass.cpp
@@ -7,6 +7,7 @@
//
//===----------------------------------------------------------------------===//
+// XFAIL: libcpp-no-exceptions
// <string>
// int compare(size_type pos1, size_type n1, const basic_string& str,
diff --git a/test/std/strings/basic.string/string.ops/string_substr/substr.pass.cpp b/test/std/strings/basic.string/string.ops/string_substr/substr.pass.cpp
index a73f70cd4b89..dc01f4f47747 100644
--- a/test/std/strings/basic.string/string.ops/string_substr/substr.pass.cpp
+++ b/test/std/strings/basic.string/string.ops/string_substr/substr.pass.cpp
@@ -7,6 +7,7 @@
//
//===----------------------------------------------------------------------===//
+// XFAIL: libcpp-no-exceptions
// <string>
// basic_string substr(size_type pos = 0, size_type n = npos) const;
diff --git a/test/std/strings/c.strings/cctype.pass.cpp b/test/std/strings/c.strings/cctype.pass.cpp
index 867338fb09c2..027fbcd469d5 100644
--- a/test/std/strings/c.strings/cctype.pass.cpp
+++ b/test/std/strings/c.strings/cctype.pass.cpp
@@ -86,18 +86,18 @@ int main()
static_assert((std::is_same<decltype(std::tolower(0)), int>::value), "");
static_assert((std::is_same<decltype(std::toupper(0)), int>::value), "");
- assert(isalnum('a'));
- assert(isalpha('a'));
- assert(isblank(' '));
- assert(!iscntrl(' '));
- assert(!isdigit('a'));
- assert(isgraph('a'));
- assert(islower('a'));
- assert(isprint('a'));
- assert(!ispunct('a'));
- assert(!isspace('a'));
- assert(!isupper('a'));
- assert(isxdigit('a'));
- assert(tolower('A') == 'a');
- assert(toupper('a') == 'A');
+ 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::ispunct('a'));
+ assert(!std::isspace('a'));
+ assert(!std::isupper('a'));
+ assert(std::isxdigit('a'));
+ assert(std::tolower('A') == 'a');
+ assert(std::toupper('a') == 'A');
}
diff --git a/test/std/strings/c.strings/cwchar.pass.cpp b/test/std/strings/c.strings/cwchar.pass.cpp
index c3d868fbc3b7..93d2bb1efa50 100644
--- a/test/std/strings/c.strings/cwchar.pass.cpp
+++ b/test/std/strings/c.strings/cwchar.pass.cpp
@@ -30,7 +30,7 @@
int main()
{
- std::mbstate_t mb = {0};
+ std::mbstate_t mb = {};
std::size_t s = 0;
std::tm *tm = 0;
std::wint_t w = 0;
diff --git a/test/std/strings/string.conversions/stod.pass.cpp b/test/std/strings/string.conversions/stod.pass.cpp
index 026d2301e071..27d5e5cbd19b 100644
--- a/test/std/strings/string.conversions/stod.pass.cpp
+++ b/test/std/strings/string.conversions/stod.pass.cpp
@@ -7,6 +7,7 @@
//
//===----------------------------------------------------------------------===//
+// XFAIL: libcpp-no-exceptions
// <string>
// double stod(const string& str, size_t *idx = 0);
diff --git a/test/std/strings/string.conversions/stof.pass.cpp b/test/std/strings/string.conversions/stof.pass.cpp
index 3e9b681ddeb1..38519a2feba0 100644
--- a/test/std/strings/string.conversions/stof.pass.cpp
+++ b/test/std/strings/string.conversions/stof.pass.cpp
@@ -7,6 +7,7 @@
//
//===----------------------------------------------------------------------===//
//
+// XFAIL: libcpp-no-exceptions
// XFAIL: with_system_cxx_lib=x86_64-apple-darwin11
// XFAIL: with_system_cxx_lib=x86_64-apple-darwin12
diff --git a/test/std/strings/string.conversions/stoi.pass.cpp b/test/std/strings/string.conversions/stoi.pass.cpp
index c2fc2103579d..238072740703 100644
--- a/test/std/strings/string.conversions/stoi.pass.cpp
+++ b/test/std/strings/string.conversions/stoi.pass.cpp
@@ -7,6 +7,7 @@
//
//===----------------------------------------------------------------------===//
+// XFAIL: libcpp-no-exceptions
// <string>
// int stoi(const string& str, size_t *idx = 0, int base = 10);
diff --git a/test/std/strings/string.conversions/stol.pass.cpp b/test/std/strings/string.conversions/stol.pass.cpp
index dbbccc92799c..2ca2c01cfb8c 100644
--- a/test/std/strings/string.conversions/stol.pass.cpp
+++ b/test/std/strings/string.conversions/stol.pass.cpp
@@ -7,6 +7,7 @@
//
//===----------------------------------------------------------------------===//
//
+// XFAIL: libcpp-no-exceptions
// XFAIL: with_system_cxx_lib=x86_64-apple-darwin11
// XFAIL: with_system_cxx_lib=x86_64-apple-darwin12
diff --git a/test/std/strings/string.conversions/stold.pass.cpp b/test/std/strings/string.conversions/stold.pass.cpp
index 93c59fe09a11..f489df2f124d 100644
--- a/test/std/strings/string.conversions/stold.pass.cpp
+++ b/test/std/strings/string.conversions/stold.pass.cpp
@@ -7,6 +7,7 @@
//
//===----------------------------------------------------------------------===//
+// XFAIL: libcpp-no-exceptions
// <string>
// long double stold(const string& str, size_t *idx = 0);
diff --git a/test/std/strings/string.conversions/stoll.pass.cpp b/test/std/strings/string.conversions/stoll.pass.cpp
index f68490ed13ae..d41db4284acd 100644
--- a/test/std/strings/string.conversions/stoll.pass.cpp
+++ b/test/std/strings/string.conversions/stoll.pass.cpp
@@ -7,6 +7,7 @@
//
//===----------------------------------------------------------------------===//
//
+// XFAIL: libcpp-no-exceptions
// XFAIL: with_system_cxx_lib=x86_64-apple-darwin11
// XFAIL: with_system_cxx_lib=x86_64-apple-darwin12
diff --git a/test/std/strings/string.conversions/stoul.pass.cpp b/test/std/strings/string.conversions/stoul.pass.cpp
index 37d33c4a9091..9dbd952434a9 100644
--- a/test/std/strings/string.conversions/stoul.pass.cpp
+++ b/test/std/strings/string.conversions/stoul.pass.cpp
@@ -7,6 +7,7 @@
//
//===----------------------------------------------------------------------===//
//
+// XFAIL: libcpp-no-exceptions
// XFAIL: with_system_cxx_lib=x86_64-apple-darwin11
// XFAIL: with_system_cxx_lib=x86_64-apple-darwin12
diff --git a/test/std/strings/string.conversions/stoull.pass.cpp b/test/std/strings/string.conversions/stoull.pass.cpp
index c0667edb385e..837ca3120100 100644
--- a/test/std/strings/string.conversions/stoull.pass.cpp
+++ b/test/std/strings/string.conversions/stoull.pass.cpp
@@ -7,6 +7,7 @@
//
//===----------------------------------------------------------------------===//
//
+// XFAIL: libcpp-no-exceptions
// XFAIL: with_system_cxx_lib=x86_64-apple-darwin11
// XFAIL: with_system_cxx_lib=x86_64-apple-darwin12
diff --git a/test/std/thread/futures/futures.async/async.pass.cpp b/test/std/thread/futures/futures.async/async.pass.cpp
index c8a742566d8f..2c1313b7a2f0 100644
--- a/test/std/thread/futures/futures.async/async.pass.cpp
+++ b/test/std/thread/futures/futures.async/async.pass.cpp
@@ -7,7 +7,9 @@
//
//===----------------------------------------------------------------------===//
//
+// XFAIL: libcpp-no-exceptions
// UNSUPPORTED: libcpp-has-no-threads
+// UNSUPPORTED: c++98, c++03
// <future>
diff --git a/test/std/thread/futures/futures.async/async_race.pass.cpp b/test/std/thread/futures/futures.async/async_race.pass.cpp
index 325a027132de..9acdd1abc485 100644
--- a/test/std/thread/futures/futures.async/async_race.pass.cpp
+++ b/test/std/thread/futures/futures.async/async_race.pass.cpp
@@ -8,6 +8,7 @@
//===----------------------------------------------------------------------===//
//
// UNSUPPORTED: libcpp-has-no-threads
+// UNSUPPORTED: c++98, c++03
// <future>
diff --git a/test/std/thread/futures/futures.promise/alloc_ctor.pass.cpp b/test/std/thread/futures/futures.promise/alloc_ctor.pass.cpp
index 70a4e00b0d6a..c0fe2ef881e8 100644
--- a/test/std/thread/futures/futures.promise/alloc_ctor.pass.cpp
+++ b/test/std/thread/futures/futures.promise/alloc_ctor.pass.cpp
@@ -8,6 +8,7 @@
//===----------------------------------------------------------------------===//
//
// UNSUPPORTED: libcpp-has-no-threads
+// UNSUPPORTED: c++98, c++03
// <future>
@@ -19,36 +20,36 @@
#include <future>
#include <cassert>
-#include "../test_allocator.h"
+#include "test_allocator.h"
#include "min_allocator.h"
int main()
{
- assert(test_alloc_base::count == 0);
+ assert(test_alloc_base::alloc_count == 0);
{
- std::promise<int> p(std::allocator_arg, test_allocator<int>());
- assert(test_alloc_base::count == 1);
+ std::promise<int> p(std::allocator_arg, test_allocator<int>(42));
+ assert(test_alloc_base::alloc_count == 1);
std::future<int> f = p.get_future();
- assert(test_alloc_base::count == 1);
+ assert(test_alloc_base::alloc_count == 1);
assert(f.valid());
}
- assert(test_alloc_base::count == 0);
+ assert(test_alloc_base::alloc_count == 0);
{
- std::promise<int&> p(std::allocator_arg, test_allocator<int>());
- assert(test_alloc_base::count == 1);
+ std::promise<int&> p(std::allocator_arg, test_allocator<int>(42));
+ assert(test_alloc_base::alloc_count == 1);
std::future<int&> f = p.get_future();
- assert(test_alloc_base::count == 1);
+ assert(test_alloc_base::alloc_count == 1);
assert(f.valid());
}
- assert(test_alloc_base::count == 0);
+ assert(test_alloc_base::alloc_count == 0);
{
- std::promise<void> p(std::allocator_arg, test_allocator<void>());
- assert(test_alloc_base::count == 1);
+ std::promise<void> p(std::allocator_arg, test_allocator<void>(42));
+ assert(test_alloc_base::alloc_count == 1);
std::future<void> f = p.get_future();
- assert(test_alloc_base::count == 1);
+ assert(test_alloc_base::alloc_count == 1);
assert(f.valid());
}
- assert(test_alloc_base::count == 0);
+ assert(test_alloc_base::alloc_count == 0);
// Test with a minimal allocator
{
std::promise<int> p(std::allocator_arg, bare_allocator<void>());
diff --git a/test/std/thread/futures/futures.promise/copy_assign.fail.cpp b/test/std/thread/futures/futures.promise/copy_assign.fail.cpp
index c08278122225..e150ba0df65a 100644
--- a/test/std/thread/futures/futures.promise/copy_assign.fail.cpp
+++ b/test/std/thread/futures/futures.promise/copy_assign.fail.cpp
@@ -14,74 +14,36 @@
// promise& operator=(const promise& rhs) = delete;
#include <future>
-#include <cassert>
-#include "../test_allocator.h"
+#include "test_macros.h"
int main()
{
- assert(test_alloc_base::count == 0);
+#if TEST_STD_VER >= 11
{
- std::promise<int> p0(std::allocator_arg, test_allocator<int>());
- std::promise<int> p(std::allocator_arg, test_allocator<int>());
- assert(test_alloc_base::count == 2);
- p = p0;
- assert(test_alloc_base::count == 1);
- std::future<int> f = p.get_future();
- assert(test_alloc_base::count == 1);
- assert(f.valid());
- try
- {
- f = p0.get_future();
- assert(false);
- }
- catch (const std::future_error& e)
- {
- assert(e.code() == make_error_code(std::future_errc::no_state));
- }
- assert(test_alloc_base::count == 1);
+ std::promise<int> p0, p;
+ p = p0; // expected-error {{overload resolution selected deleted operator '='}}
}
- assert(test_alloc_base::count == 0);
{
- std::promise<int&> p0(std::allocator_arg, test_allocator<int>());
- std::promise<int&> p(std::allocator_arg, test_allocator<int>());
- assert(test_alloc_base::count == 2);
- p = p0;
- assert(test_alloc_base::count == 1);
- std::future<int&> f = p.get_future();
- assert(test_alloc_base::count == 1);
- assert(f.valid());
- try
- {
- f = p0.get_future();
- assert(false);
- }
- catch (const std::future_error& e)
- {
- assert(e.code() == make_error_code(std::future_errc::no_state));
- }
- assert(test_alloc_base::count == 1);
+ std::promise<int&> p0, p;
+ p = p0; // expected-error {{overload resolution selected deleted operator '='}}
}
- assert(test_alloc_base::count == 0);
{
- std::promise<void> p0(std::allocator_arg, test_allocator<void>());
- std::promise<void> p(std::allocator_arg, test_allocator<void>());
- assert(test_alloc_base::count == 2);
- p = p0;
- assert(test_alloc_base::count == 1);
- std::future<void> f = p.get_future();
- assert(test_alloc_base::count == 1);
- assert(f.valid());
- try
- {
- f = p0.get_future();
- assert(false);
- }
- catch (const std::future_error& e)
- {
- assert(e.code() == make_error_code(std::future_errc::no_state));
- }
- assert(test_alloc_base::count == 1);
+ std::promise<void> p0, p;
+ p = p0; // expected-error {{overload resolution selected deleted operator '='}}
}
- assert(test_alloc_base::count == 0);
+#else
+ {
+ std::promise<int> p0, p;
+ p = p0; // expected-error {{'operator=' is a private member of 'std::__1::promise<int>'}}
+ }
+ {
+ std::promise<int&> p0, p;
+ p = p0; // expected-error {{'operator=' is a private member of 'std::__1::promise<int &>'}}
+ }
+ {
+ std::promise<void> p0, p;
+ p = p0; // expected-error {{'operator=' is a private member of 'std::__1::promise<void>'}}
+ }
+#endif
}
diff --git a/test/std/thread/futures/futures.promise/copy_ctor.fail.cpp b/test/std/thread/futures/futures.promise/copy_ctor.fail.cpp
index 36a3555aed46..34becbc1259b 100644
--- a/test/std/thread/futures/futures.promise/copy_ctor.fail.cpp
+++ b/test/std/thread/futures/futures.promise/copy_ctor.fail.cpp
@@ -14,68 +14,36 @@
// promise(const promise&) = delete;
#include <future>
-#include <cassert>
-#include "../test_allocator.h"
+#include "test_macros.h"
int main()
{
- assert(test_alloc_base::count == 0);
+#if TEST_STD_VER >= 11
{
- std::promise<int> p0(std::allocator_arg, test_allocator<int>());
- std::promise<int> p(p0);
- assert(test_alloc_base::count == 1);
- std::future<int> f = p.get_future();
- assert(test_alloc_base::count == 1);
- assert(f.valid());
- try
- {
- f = p0.get_future();
- assert(false);
- }
- catch (const std::future_error& e)
- {
- assert(e.code() == make_error_code(std::future_errc::no_state));
- }
- assert(test_alloc_base::count == 1);
+ std::promise<int> p0;
+ std::promise<int> p(p0); // expected-error {{call to deleted constructor of 'std::promise<int>'}}
}
- assert(test_alloc_base::count == 0);
{
- std::promise<int&> p0(std::allocator_arg, test_allocator<int>());
- std::promise<int&> p(p0);
- assert(test_alloc_base::count == 1);
- std::future<int&> f = p.get_future();
- assert(test_alloc_base::count == 1);
- assert(f.valid());
- try
- {
- f = p0.get_future();
- assert(false);
- }
- catch (const std::future_error& e)
- {
- assert(e.code() == make_error_code(std::future_errc::no_state));
- }
- assert(test_alloc_base::count == 1);
+ std::promise<int &> p0;
+ std::promise<int &> p(p0); // expected-error {{call to deleted constructor of 'std::promise<int &>'}}
}
- assert(test_alloc_base::count == 0);
{
- std::promise<void> p0(std::allocator_arg, test_allocator<void>());
- std::promise<void> p(p0);
- assert(test_alloc_base::count == 1);
- std::future<void> f = p.get_future();
- assert(test_alloc_base::count == 1);
- assert(f.valid());
- try
- {
- f = p0.get_future();
- assert(false);
- }
- catch (const std::future_error& e)
- {
- assert(e.code() == make_error_code(std::future_errc::no_state));
- }
- assert(test_alloc_base::count == 1);
+ std::promise<void> p0;
+ std::promise<void> p(p0); // expected-error {{call to deleted constructor of 'std::promise<void>'}}
}
- assert(test_alloc_base::count == 0);
+#else
+ {
+ std::promise<int> p0;
+ std::promise<int> p(p0); // expected-error {{calling a private constructor of class 'std::__1::promise<int>'}}
+ }
+ {
+ std::promise<int &> p0;
+ std::promise<int &> p(p0); // expected-error {{calling a private constructor of class 'std::__1::promise<int &>'}}
+ }
+ {
+ std::promise<void> p0;
+ std::promise<void> p(p0); // expected-error {{calling a private constructor of class 'std::__1::promise<void>'}}
+ }
+#endif
}
diff --git a/test/std/thread/futures/futures.promise/default.pass.cpp b/test/std/thread/futures/futures.promise/default.pass.cpp
index 95c9657c633e..d108b42756e2 100644
--- a/test/std/thread/futures/futures.promise/default.pass.cpp
+++ b/test/std/thread/futures/futures.promise/default.pass.cpp
@@ -8,6 +8,7 @@
//===----------------------------------------------------------------------===//
//
// UNSUPPORTED: libcpp-has-no-threads
+// UNSUPPORTED: c++98, c++03
// <future>
diff --git a/test/std/thread/futures/futures.promise/dtor.pass.cpp b/test/std/thread/futures/futures.promise/dtor.pass.cpp
index 78912f12adb9..e3151ab38322 100644
--- a/test/std/thread/futures/futures.promise/dtor.pass.cpp
+++ b/test/std/thread/futures/futures.promise/dtor.pass.cpp
@@ -7,7 +7,9 @@
//
//===----------------------------------------------------------------------===//
//
+// XFAIL: libcpp-no-exceptions
// UNSUPPORTED: libcpp-has-no-threads
+// UNSUPPORTED: c++98, c++03
// <future>
diff --git a/test/std/thread/futures/futures.promise/get_future.pass.cpp b/test/std/thread/futures/futures.promise/get_future.pass.cpp
index a7d084ee7873..bc45e28a9f96 100644
--- a/test/std/thread/futures/futures.promise/get_future.pass.cpp
+++ b/test/std/thread/futures/futures.promise/get_future.pass.cpp
@@ -7,7 +7,9 @@
//
//===----------------------------------------------------------------------===//
//
+// XFAIL: libcpp-no-exceptions
// UNSUPPORTED: libcpp-has-no-threads
+// UNSUPPORTED: c++98, c++03
// <future>
diff --git a/test/std/thread/futures/futures.promise/move_assign.pass.cpp b/test/std/thread/futures/futures.promise/move_assign.pass.cpp
index c3097df74990..9dd8a9daef80 100644
--- a/test/std/thread/futures/futures.promise/move_assign.pass.cpp
+++ b/test/std/thread/futures/futures.promise/move_assign.pass.cpp
@@ -7,7 +7,9 @@
//
//===----------------------------------------------------------------------===//
//
+// XFAIL: libcpp-no-exceptions
// UNSUPPORTED: libcpp-has-no-threads
+// UNSUPPORTED: c++98, c++03
// <future>
@@ -18,20 +20,19 @@
#include <future>
#include <cassert>
-#include "../test_allocator.h"
+#include "test_allocator.h"
int main()
{
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
- assert(test_alloc_base::count == 0);
+ assert(test_alloc_base::alloc_count == 0);
{
std::promise<int> p0(std::allocator_arg, test_allocator<int>());
std::promise<int> p(std::allocator_arg, test_allocator<int>());
- assert(test_alloc_base::count == 2);
+ assert(test_alloc_base::alloc_count == 2);
p = std::move(p0);
- assert(test_alloc_base::count == 1);
+ assert(test_alloc_base::alloc_count == 1);
std::future<int> f = p.get_future();
- assert(test_alloc_base::count == 1);
+ assert(test_alloc_base::alloc_count == 1);
assert(f.valid());
try
{
@@ -42,17 +43,17 @@ int main()
{
assert(e.code() == make_error_code(std::future_errc::no_state));
}
- assert(test_alloc_base::count == 1);
+ assert(test_alloc_base::alloc_count == 1);
}
- assert(test_alloc_base::count == 0);
+ assert(test_alloc_base::alloc_count == 0);
{
std::promise<int&> p0(std::allocator_arg, test_allocator<int>());
std::promise<int&> p(std::allocator_arg, test_allocator<int>());
- assert(test_alloc_base::count == 2);
+ assert(test_alloc_base::alloc_count == 2);
p = std::move(p0);
- assert(test_alloc_base::count == 1);
+ assert(test_alloc_base::alloc_count == 1);
std::future<int&> f = p.get_future();
- assert(test_alloc_base::count == 1);
+ assert(test_alloc_base::alloc_count == 1);
assert(f.valid());
try
{
@@ -63,17 +64,17 @@ int main()
{
assert(e.code() == make_error_code(std::future_errc::no_state));
}
- assert(test_alloc_base::count == 1);
+ assert(test_alloc_base::alloc_count == 1);
}
- assert(test_alloc_base::count == 0);
+ assert(test_alloc_base::alloc_count == 0);
{
std::promise<void> p0(std::allocator_arg, test_allocator<void>());
std::promise<void> p(std::allocator_arg, test_allocator<void>());
- assert(test_alloc_base::count == 2);
+ assert(test_alloc_base::alloc_count == 2);
p = std::move(p0);
- assert(test_alloc_base::count == 1);
+ assert(test_alloc_base::alloc_count == 1);
std::future<void> f = p.get_future();
- assert(test_alloc_base::count == 1);
+ assert(test_alloc_base::alloc_count == 1);
assert(f.valid());
try
{
@@ -84,8 +85,7 @@ int main()
{
assert(e.code() == make_error_code(std::future_errc::no_state));
}
- assert(test_alloc_base::count == 1);
+ assert(test_alloc_base::alloc_count == 1);
}
- assert(test_alloc_base::count == 0);
-#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+ assert(test_alloc_base::alloc_count == 0);
}
diff --git a/test/std/thread/futures/futures.promise/move_ctor.pass.cpp b/test/std/thread/futures/futures.promise/move_ctor.pass.cpp
index eeec4fb15b95..9a68b5c1b4e1 100644
--- a/test/std/thread/futures/futures.promise/move_ctor.pass.cpp
+++ b/test/std/thread/futures/futures.promise/move_ctor.pass.cpp
@@ -7,7 +7,9 @@
//
//===----------------------------------------------------------------------===//
//
+// XFAIL: libcpp-no-exceptions
// UNSUPPORTED: libcpp-has-no-threads
+// UNSUPPORTED: c++98, c++03
// <future>
@@ -18,18 +20,17 @@
#include <future>
#include <cassert>
-#include "../test_allocator.h"
+#include "test_allocator.h"
int main()
{
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
- assert(test_alloc_base::count == 0);
+ assert(test_alloc_base::alloc_count == 0);
{
std::promise<int> p0(std::allocator_arg, test_allocator<int>());
std::promise<int> p(std::move(p0));
- assert(test_alloc_base::count == 1);
+ assert(test_alloc_base::alloc_count == 1);
std::future<int> f = p.get_future();
- assert(test_alloc_base::count == 1);
+ assert(test_alloc_base::alloc_count == 1);
assert(f.valid());
try
{
@@ -40,15 +41,15 @@ int main()
{
assert(e.code() == make_error_code(std::future_errc::no_state));
}
- assert(test_alloc_base::count == 1);
+ assert(test_alloc_base::alloc_count == 1);
}
- assert(test_alloc_base::count == 0);
+ assert(test_alloc_base::alloc_count == 0);
{
std::promise<int&> p0(std::allocator_arg, test_allocator<int>());
std::promise<int&> p(std::move(p0));
- assert(test_alloc_base::count == 1);
+ assert(test_alloc_base::alloc_count == 1);
std::future<int&> f = p.get_future();
- assert(test_alloc_base::count == 1);
+ assert(test_alloc_base::alloc_count == 1);
assert(f.valid());
try
{
@@ -59,15 +60,15 @@ int main()
{
assert(e.code() == make_error_code(std::future_errc::no_state));
}
- assert(test_alloc_base::count == 1);
+ assert(test_alloc_base::alloc_count == 1);
}
- assert(test_alloc_base::count == 0);
+ assert(test_alloc_base::alloc_count == 0);
{
std::promise<void> p0(std::allocator_arg, test_allocator<void>());
std::promise<void> p(std::move(p0));
- assert(test_alloc_base::count == 1);
+ assert(test_alloc_base::alloc_count == 1);
std::future<void> f = p.get_future();
- assert(test_alloc_base::count == 1);
+ assert(test_alloc_base::alloc_count == 1);
assert(f.valid());
try
{
@@ -78,8 +79,7 @@ int main()
{
assert(e.code() == make_error_code(std::future_errc::no_state));
}
- assert(test_alloc_base::count == 1);
+ assert(test_alloc_base::alloc_count == 1);
}
- assert(test_alloc_base::count == 0);
-#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+ assert(test_alloc_base::alloc_count == 0);
}
diff --git a/test/std/thread/futures/futures.promise/set_exception.pass.cpp b/test/std/thread/futures/futures.promise/set_exception.pass.cpp
index 51c05eb803cb..6ef41af94545 100644
--- a/test/std/thread/futures/futures.promise/set_exception.pass.cpp
+++ b/test/std/thread/futures/futures.promise/set_exception.pass.cpp
@@ -7,7 +7,9 @@
//
//===----------------------------------------------------------------------===//
//
+// XFAIL: libcpp-no-exceptions
// UNSUPPORTED: libcpp-has-no-threads
+// UNSUPPORTED: c++98, c++03
// <future>
diff --git a/test/std/thread/futures/futures.promise/set_exception_at_thread_exit.pass.cpp b/test/std/thread/futures/futures.promise/set_exception_at_thread_exit.pass.cpp
index 5e57692563d8..f54d7cd16bdb 100644
--- a/test/std/thread/futures/futures.promise/set_exception_at_thread_exit.pass.cpp
+++ b/test/std/thread/futures/futures.promise/set_exception_at_thread_exit.pass.cpp
@@ -7,7 +7,9 @@
//
//===----------------------------------------------------------------------===//
//
+// XFAIL: libcpp-no-exceptions
// UNSUPPORTED: libcpp-has-no-threads
+// UNSUPPORTED: c++98, c++03
// <future>
diff --git a/test/std/thread/futures/futures.promise/set_lvalue.pass.cpp b/test/std/thread/futures/futures.promise/set_lvalue.pass.cpp
index cdc37775012c..98394871e703 100644
--- a/test/std/thread/futures/futures.promise/set_lvalue.pass.cpp
+++ b/test/std/thread/futures/futures.promise/set_lvalue.pass.cpp
@@ -7,7 +7,9 @@
//
//===----------------------------------------------------------------------===//
//
+// XFAIL: libcpp-no-exceptions
// UNSUPPORTED: libcpp-has-no-threads
+// UNSUPPORTED: c++98, c++03
// <future>
diff --git a/test/std/thread/futures/futures.promise/set_lvalue_at_thread_exit.pass.cpp b/test/std/thread/futures/futures.promise/set_lvalue_at_thread_exit.pass.cpp
index 18f87c596a00..e127d2c37faf 100644
--- a/test/std/thread/futures/futures.promise/set_lvalue_at_thread_exit.pass.cpp
+++ b/test/std/thread/futures/futures.promise/set_lvalue_at_thread_exit.pass.cpp
@@ -8,6 +8,7 @@
//===----------------------------------------------------------------------===//
//
// UNSUPPORTED: libcpp-has-no-threads
+// UNSUPPORTED: c++98, c++03
// <future>
diff --git a/test/std/thread/futures/futures.promise/set_rvalue.pass.cpp b/test/std/thread/futures/futures.promise/set_rvalue.pass.cpp
index dab4bf7e9c83..9cce3f59550a 100644
--- a/test/std/thread/futures/futures.promise/set_rvalue.pass.cpp
+++ b/test/std/thread/futures/futures.promise/set_rvalue.pass.cpp
@@ -7,6 +7,7 @@
//
//===----------------------------------------------------------------------===//
//
+// XFAIL: libcpp-no-exceptions
// UNSUPPORTED: libcpp-has-no-threads
// <future>
diff --git a/test/std/thread/futures/futures.promise/set_value_at_thread_exit_const.pass.cpp b/test/std/thread/futures/futures.promise/set_value_at_thread_exit_const.pass.cpp
index ec50cc310298..79137488e606 100644
--- a/test/std/thread/futures/futures.promise/set_value_at_thread_exit_const.pass.cpp
+++ b/test/std/thread/futures/futures.promise/set_value_at_thread_exit_const.pass.cpp
@@ -8,6 +8,7 @@
//===----------------------------------------------------------------------===//
//
// UNSUPPORTED: libcpp-has-no-threads
+// UNSUPPORTED: c++98, c++03
// <future>
diff --git a/test/std/thread/futures/futures.promise/set_value_at_thread_exit_void.pass.cpp b/test/std/thread/futures/futures.promise/set_value_at_thread_exit_void.pass.cpp
index 8c092084668d..6a0ce36326eb 100644
--- a/test/std/thread/futures/futures.promise/set_value_at_thread_exit_void.pass.cpp
+++ b/test/std/thread/futures/futures.promise/set_value_at_thread_exit_void.pass.cpp
@@ -8,6 +8,7 @@
//===----------------------------------------------------------------------===//
//
// UNSUPPORTED: libcpp-has-no-threads
+// UNSUPPORTED: c++98, c++03
// <future>
diff --git a/test/std/thread/futures/futures.promise/set_value_const.pass.cpp b/test/std/thread/futures/futures.promise/set_value_const.pass.cpp
index 6673f6307579..db7465ceab85 100644
--- a/test/std/thread/futures/futures.promise/set_value_const.pass.cpp
+++ b/test/std/thread/futures/futures.promise/set_value_const.pass.cpp
@@ -7,7 +7,9 @@
//
//===----------------------------------------------------------------------===//
//
+// XFAIL: libcpp-no-exceptions
// UNSUPPORTED: libcpp-has-no-threads
+// UNSUPPORTED: c++98, c++03
// <future>
diff --git a/test/std/thread/futures/futures.promise/set_value_void.pass.cpp b/test/std/thread/futures/futures.promise/set_value_void.pass.cpp
index 5012e0bfe5fd..87be8cd60a5e 100644
--- a/test/std/thread/futures/futures.promise/set_value_void.pass.cpp
+++ b/test/std/thread/futures/futures.promise/set_value_void.pass.cpp
@@ -7,7 +7,9 @@
//
//===----------------------------------------------------------------------===//
//
+// XFAIL: libcpp-no-exceptions
// UNSUPPORTED: libcpp-has-no-threads
+// UNSUPPORTED: c++98, c++03
// <future>
diff --git a/test/std/thread/futures/futures.promise/swap.pass.cpp b/test/std/thread/futures/futures.promise/swap.pass.cpp
index 1ed3e646813c..21c946981a28 100644
--- a/test/std/thread/futures/futures.promise/swap.pass.cpp
+++ b/test/std/thread/futures/futures.promise/swap.pass.cpp
@@ -8,6 +8,7 @@
//===----------------------------------------------------------------------===//
//
// UNSUPPORTED: libcpp-has-no-threads
+// UNSUPPORTED: c++98, c++03
// <future>
@@ -20,65 +21,65 @@
#include <future>
#include <cassert>
-#include "../test_allocator.h"
+#include "test_allocator.h"
int main()
{
- assert(test_alloc_base::count == 0);
+ assert(test_alloc_base::alloc_count == 0);
{
std::promise<int> p0(std::allocator_arg, test_allocator<int>());
std::promise<int> p(std::allocator_arg, test_allocator<int>());
- assert(test_alloc_base::count == 2);
+ assert(test_alloc_base::alloc_count == 2);
p.swap(p0);
- assert(test_alloc_base::count == 2);
+ assert(test_alloc_base::alloc_count == 2);
std::future<int> f = p.get_future();
- assert(test_alloc_base::count == 2);
+ assert(test_alloc_base::alloc_count == 2);
assert(f.valid());
f = p0.get_future();
assert(f.valid());
- assert(test_alloc_base::count == 2);
+ assert(test_alloc_base::alloc_count == 2);
}
- assert(test_alloc_base::count == 0);
+ assert(test_alloc_base::alloc_count == 0);
{
std::promise<int> p0(std::allocator_arg, test_allocator<int>());
std::promise<int> p(std::allocator_arg, test_allocator<int>());
- assert(test_alloc_base::count == 2);
+ assert(test_alloc_base::alloc_count == 2);
swap(p, p0);
- assert(test_alloc_base::count == 2);
+ assert(test_alloc_base::alloc_count == 2);
std::future<int> f = p.get_future();
- assert(test_alloc_base::count == 2);
+ assert(test_alloc_base::alloc_count == 2);
assert(f.valid());
f = p0.get_future();
assert(f.valid());
- assert(test_alloc_base::count == 2);
+ assert(test_alloc_base::alloc_count == 2);
}
- assert(test_alloc_base::count == 0);
+ assert(test_alloc_base::alloc_count == 0);
{
std::promise<int> p0(std::allocator_arg, test_allocator<int>());
std::promise<int> p;
- assert(test_alloc_base::count == 1);
+ assert(test_alloc_base::alloc_count == 1);
p.swap(p0);
- assert(test_alloc_base::count == 1);
+ assert(test_alloc_base::alloc_count == 1);
std::future<int> f = p.get_future();
- assert(test_alloc_base::count == 1);
+ assert(test_alloc_base::alloc_count == 1);
assert(f.valid());
f = p0.get_future();
assert(f.valid());
- assert(test_alloc_base::count == 1);
+ assert(test_alloc_base::alloc_count == 1);
}
- assert(test_alloc_base::count == 0);
+ assert(test_alloc_base::alloc_count == 0);
{
std::promise<int> p0(std::allocator_arg, test_allocator<int>());
std::promise<int> p;
- assert(test_alloc_base::count == 1);
+ assert(test_alloc_base::alloc_count == 1);
swap(p, p0);
- assert(test_alloc_base::count == 1);
+ assert(test_alloc_base::alloc_count == 1);
std::future<int> f = p.get_future();
- assert(test_alloc_base::count == 1);
+ assert(test_alloc_base::alloc_count == 1);
assert(f.valid());
f = p0.get_future();
assert(f.valid());
- assert(test_alloc_base::count == 1);
+ assert(test_alloc_base::alloc_count == 1);
}
- assert(test_alloc_base::count == 0);
+ assert(test_alloc_base::alloc_count == 0);
}
diff --git a/test/std/thread/futures/futures.promise/uses_allocator.pass.cpp b/test/std/thread/futures/futures.promise/uses_allocator.pass.cpp
index 458826e956e1..9a1d41cc0cb6 100644
--- a/test/std/thread/futures/futures.promise/uses_allocator.pass.cpp
+++ b/test/std/thread/futures/futures.promise/uses_allocator.pass.cpp
@@ -18,7 +18,7 @@
// : true_type { };
#include <future>
-#include "../test_allocator.h"
+#include "test_allocator.h"
int main()
{
diff --git a/test/std/thread/futures/futures.shared_future/copy_assign.pass.cpp b/test/std/thread/futures/futures.shared_future/copy_assign.pass.cpp
index b23ba196ec30..3f9e945dddaf 100644
--- a/test/std/thread/futures/futures.shared_future/copy_assign.pass.cpp
+++ b/test/std/thread/futures/futures.shared_future/copy_assign.pass.cpp
@@ -8,6 +8,7 @@
//===----------------------------------------------------------------------===//
//
// UNSUPPORTED: libcpp-has-no-threads
+// UNSUPPORTED: c++98, c++03
// <future>
@@ -20,7 +21,6 @@
int main()
{
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
{
typedef int T;
std::promise<T> p;
@@ -72,5 +72,4 @@ int main()
assert(!f0.valid());
assert(!f.valid());
}
-#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
}
diff --git a/test/std/thread/futures/futures.shared_future/copy_ctor.pass.cpp b/test/std/thread/futures/futures.shared_future/copy_ctor.pass.cpp
index 425d1f9be96f..1da08808db2e 100644
--- a/test/std/thread/futures/futures.shared_future/copy_ctor.pass.cpp
+++ b/test/std/thread/futures/futures.shared_future/copy_ctor.pass.cpp
@@ -8,6 +8,7 @@
//===----------------------------------------------------------------------===//
//
// UNSUPPORTED: libcpp-has-no-threads
+// UNSUPPORTED: c++98, c++03
// <future>
diff --git a/test/std/thread/futures/futures.shared_future/ctor_future.pass.cpp b/test/std/thread/futures/futures.shared_future/ctor_future.pass.cpp
index 3a78b80f0634..1590efd7b634 100644
--- a/test/std/thread/futures/futures.shared_future/ctor_future.pass.cpp
+++ b/test/std/thread/futures/futures.shared_future/ctor_future.pass.cpp
@@ -8,6 +8,7 @@
//===----------------------------------------------------------------------===//
//
// UNSUPPORTED: libcpp-has-no-threads
+// UNSUPPORTED: c++98, c++03
// <future>
diff --git a/test/std/thread/futures/futures.shared_future/dtor.pass.cpp b/test/std/thread/futures/futures.shared_future/dtor.pass.cpp
index baa89cb12b1c..af061268410d 100644
--- a/test/std/thread/futures/futures.shared_future/dtor.pass.cpp
+++ b/test/std/thread/futures/futures.shared_future/dtor.pass.cpp
@@ -7,7 +7,9 @@
//
//===----------------------------------------------------------------------===//
//
+// XFAIL: libcpp-no-exceptions
// UNSUPPORTED: libcpp-has-no-threads
+// UNSUPPORTED: c++98, c++03
// <future>
@@ -18,51 +20,51 @@
#include <future>
#include <cassert>
-#include "../test_allocator.h"
+#include "test_allocator.h"
int main()
{
- assert(test_alloc_base::count == 0);
+ assert(test_alloc_base::alloc_count == 0);
{
typedef int T;
std::shared_future<T> f;
{
std::promise<T> p(std::allocator_arg, test_allocator<T>());
- assert(test_alloc_base::count == 1);
+ assert(test_alloc_base::alloc_count == 1);
f = p.get_future();
- assert(test_alloc_base::count == 1);
+ assert(test_alloc_base::alloc_count == 1);
assert(f.valid());
}
- assert(test_alloc_base::count == 1);
+ assert(test_alloc_base::alloc_count == 1);
assert(f.valid());
}
- assert(test_alloc_base::count == 0);
+ assert(test_alloc_base::alloc_count == 0);
{
typedef int& T;
std::shared_future<T> f;
{
std::promise<T> p(std::allocator_arg, test_allocator<int>());
- assert(test_alloc_base::count == 1);
+ assert(test_alloc_base::alloc_count == 1);
f = p.get_future();
- assert(test_alloc_base::count == 1);
+ assert(test_alloc_base::alloc_count == 1);
assert(f.valid());
}
- assert(test_alloc_base::count == 1);
+ assert(test_alloc_base::alloc_count == 1);
assert(f.valid());
}
- assert(test_alloc_base::count == 0);
+ assert(test_alloc_base::alloc_count == 0);
{
typedef void T;
std::shared_future<T> f;
{
std::promise<T> p(std::allocator_arg, test_allocator<T>());
- assert(test_alloc_base::count == 1);
+ assert(test_alloc_base::alloc_count == 1);
f = p.get_future();
- assert(test_alloc_base::count == 1);
+ assert(test_alloc_base::alloc_count == 1);
assert(f.valid());
}
- assert(test_alloc_base::count == 1);
+ assert(test_alloc_base::alloc_count == 1);
assert(f.valid());
}
- assert(test_alloc_base::count == 0);
+ assert(test_alloc_base::alloc_count == 0);
}
diff --git a/test/std/thread/futures/futures.shared_future/get.pass.cpp b/test/std/thread/futures/futures.shared_future/get.pass.cpp
index c5ee234b127f..6eea1d889b6d 100644
--- a/test/std/thread/futures/futures.shared_future/get.pass.cpp
+++ b/test/std/thread/futures/futures.shared_future/get.pass.cpp
@@ -7,7 +7,9 @@
//
//===----------------------------------------------------------------------===//
//
+// XFAIL: libcpp-no-exceptions
// UNSUPPORTED: libcpp-has-no-threads
+// UNSUPPORTED: c++98, c++03
// <future>
diff --git a/test/std/thread/futures/futures.shared_future/move_assign.pass.cpp b/test/std/thread/futures/futures.shared_future/move_assign.pass.cpp
index 6b58f41c9085..3a1ef7a6849c 100644
--- a/test/std/thread/futures/futures.shared_future/move_assign.pass.cpp
+++ b/test/std/thread/futures/futures.shared_future/move_assign.pass.cpp
@@ -8,6 +8,7 @@
//===----------------------------------------------------------------------===//
//
// UNSUPPORTED: libcpp-has-no-threads
+// UNSUPPORTED: c++98, c++03
// <future>
@@ -20,7 +21,6 @@
int main()
{
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
{
typedef int T;
std::promise<T> p;
@@ -72,5 +72,4 @@ int main()
assert(!f0.valid());
assert(!f.valid());
}
-#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
}
diff --git a/test/std/thread/futures/futures.shared_future/move_ctor.pass.cpp b/test/std/thread/futures/futures.shared_future/move_ctor.pass.cpp
index 32b8fd77c672..15323d678e3c 100644
--- a/test/std/thread/futures/futures.shared_future/move_ctor.pass.cpp
+++ b/test/std/thread/futures/futures.shared_future/move_ctor.pass.cpp
@@ -8,6 +8,7 @@
//===----------------------------------------------------------------------===//
//
// UNSUPPORTED: libcpp-has-no-threads
+// UNSUPPORTED: c++98, c++03
// <future>
diff --git a/test/std/thread/futures/futures.shared_future/wait.pass.cpp b/test/std/thread/futures/futures.shared_future/wait.pass.cpp
index 4293fcab3564..6ff74f6c6b90 100644
--- a/test/std/thread/futures/futures.shared_future/wait.pass.cpp
+++ b/test/std/thread/futures/futures.shared_future/wait.pass.cpp
@@ -8,6 +8,7 @@
//===----------------------------------------------------------------------===//
//
// UNSUPPORTED: libcpp-has-no-threads
+// UNSUPPORTED: c++98, c++03
// <future>
diff --git a/test/std/thread/futures/futures.shared_future/wait_for.pass.cpp b/test/std/thread/futures/futures.shared_future/wait_for.pass.cpp
index e5a4754e38ad..1ec086266b0d 100644
--- a/test/std/thread/futures/futures.shared_future/wait_for.pass.cpp
+++ b/test/std/thread/futures/futures.shared_future/wait_for.pass.cpp
@@ -8,6 +8,7 @@
//===----------------------------------------------------------------------===//
//
// UNSUPPORTED: libcpp-has-no-threads
+// UNSUPPORTED: c++98, c++03
// <future>
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 6a6aeba7759e..9cdc2e431f45 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
@@ -8,6 +8,7 @@
//===----------------------------------------------------------------------===//
//
// UNSUPPORTED: libcpp-has-no-threads
+ // UNSUPPORTED: c++98, c++03
// <future>
diff --git a/test/std/thread/futures/futures.tas/futures.task.members/assign_copy.fail.cpp b/test/std/thread/futures/futures.tas/futures.task.members/assign_copy.fail.cpp
index 70ea0ad31fed..6c6418594d00 100644
--- a/test/std/thread/futures/futures.tas/futures.task.members/assign_copy.fail.cpp
+++ b/test/std/thread/futures/futures.tas/futures.task.members/assign_copy.fail.cpp
@@ -7,6 +7,8 @@
//
//===----------------------------------------------------------------------===//
+// UNSUPPORTED: c++98, c++03
+
// <future>
// class packaged_task<R(ArgTypes...)>
@@ -14,35 +16,11 @@
// packaged_task& operator=(packaged_task&) = delete;
#include <future>
-#include <cassert>
-
-class A
-{
- long data_;
-
-public:
- explicit A(long i) : data_(i) {}
-
- long operator()(long i, long j) const {return data_ + i + j;}
-};
int main()
{
{
- std::packaged_task<double(int, char)> p0(A(5));
- std::packaged_task<double(int, char)> p;
- p = p0;
- assert(!p0.valid());
- assert(p.valid());
- std::future<double> f = p.get_future();
- p(3, 'a');
- assert(f.get() == 105.0);
- }
- {
- std::packaged_task<double(int, char)> p0;
- std::packaged_task<double(int, char)> p;
- p = p0;
- assert(!p0.valid());
- assert(!p.valid());
+ std::packaged_task<double(int, char)> p0, p;
+ p = p0; // expected-error {{overload resolution selected deleted operator '='}}
}
}
diff --git a/test/std/thread/futures/futures.tas/futures.task.members/assign_move.pass.cpp b/test/std/thread/futures/futures.tas/futures.task.members/assign_move.pass.cpp
index 18786f4eb7a2..3f11d670bede 100644
--- a/test/std/thread/futures/futures.tas/futures.task.members/assign_move.pass.cpp
+++ b/test/std/thread/futures/futures.tas/futures.task.members/assign_move.pass.cpp
@@ -8,6 +8,7 @@
//===----------------------------------------------------------------------===//
//
// UNSUPPORTED: libcpp-has-no-threads
+// UNSUPPORTED: c++98, c++03
// <future>
diff --git a/test/std/thread/futures/futures.tas/futures.task.members/ctor1.fail.cpp b/test/std/thread/futures/futures.tas/futures.task.members/ctor1.fail.cpp
index 45048b747f7a..7097d428962a 100644
--- a/test/std/thread/futures/futures.tas/futures.task.members/ctor1.fail.cpp
+++ b/test/std/thread/futures/futures.tas/futures.task.members/ctor1.fail.cpp
@@ -7,6 +7,8 @@
//
//===----------------------------------------------------------------------===//
+// UNSUPPORTED: c++98, c++03
+
// <future>
// class packaged_task<R(ArgTypes...)>
@@ -25,5 +27,6 @@ typedef volatile std::packaged_task<A(int, char)> VPT;
int main()
{
- PT p { VPT{} };
+ PT p { VPT{} }; // expected-error {{no matching constructor for initialization of 'PT' (aka 'packaged_task<A (int, char)>')}}
+ // expected-note@future:* 1 {{candidate template ignored: disabled by 'enable_if'}}
}
diff --git a/test/std/thread/futures/futures.tas/futures.task.members/ctor2.fail.cpp b/test/std/thread/futures/futures.tas/futures.task.members/ctor2.fail.cpp
index e4df4ec225e7..feb7657bed37 100644
--- a/test/std/thread/futures/futures.tas/futures.task.members/ctor2.fail.cpp
+++ b/test/std/thread/futures/futures.tas/futures.task.members/ctor2.fail.cpp
@@ -7,6 +7,8 @@
//
//===----------------------------------------------------------------------===//
+// UNSUPPORTED: c++98, c++03
+
// <future>
// class packaged_task<R(ArgTypes...)>
@@ -18,7 +20,7 @@
#include <future>
#include <cassert>
-#include "../../test_allocator.h"
+#include "test_allocator.h"
struct A {};
typedef std::packaged_task<A(int, char)> PT;
@@ -26,5 +28,6 @@ typedef volatile std::packaged_task<A(int, char)> VPT;
int main()
{
- PT p { std::allocator_arg_t{}, test_allocator<A>{}, VPT {}};
+ PT p { std::allocator_arg_t{}, test_allocator<A>{}, VPT {}}; // expected-error {{no matching constructor for initialization of 'PT' (aka 'packaged_task<A (int, char)>')}}
+ // expected-note@future:* 1 {{candidate template ignored: disabled by 'enable_if'}}
}
diff --git a/test/std/thread/futures/futures.tas/futures.task.members/ctor_copy.fail.cpp b/test/std/thread/futures/futures.tas/futures.task.members/ctor_copy.fail.cpp
index 9884c49a6dc7..97624f90f3df 100644
--- a/test/std/thread/futures/futures.tas/futures.task.members/ctor_copy.fail.cpp
+++ b/test/std/thread/futures/futures.tas/futures.task.members/ctor_copy.fail.cpp
@@ -7,6 +7,8 @@
//
//===----------------------------------------------------------------------===//
+// UNSUPPORTED: c++98, c++03
+
// <future>
// class packaged_task<R(ArgTypes...)>
@@ -14,33 +16,12 @@
// packaged_task(packaged_task&) = delete;
#include <future>
-#include <cassert>
-
-class A
-{
- long data_;
-public:
- explicit A(long i) : data_(i) {}
-
- long operator()(long i, long j) const {return data_ + i + j;}
-};
int main()
{
{
- std::packaged_task<double(int, char)> p0(A(5));
- std::packaged_task<double(int, char)> p(p0);
- assert(!p0.valid());
- assert(p.valid());
- std::future<double> f = p.get_future();
- p(3, 'a');
- assert(f.get() == 105.0);
- }
- {
std::packaged_task<double(int, char)> p0;
- std::packaged_task<double(int, char)> p(p0);
- assert(!p0.valid());
- assert(!p.valid());
+ std::packaged_task<double(int, char)> p(p0); // expected-error {{call to deleted constructor of 'std::packaged_task<double (int, char)>'}}
}
}
diff --git a/test/std/thread/futures/futures.tas/futures.task.members/ctor_default.pass.cpp b/test/std/thread/futures/futures.tas/futures.task.members/ctor_default.pass.cpp
index 76904962a778..ed147d74895b 100644
--- a/test/std/thread/futures/futures.tas/futures.task.members/ctor_default.pass.cpp
+++ b/test/std/thread/futures/futures.tas/futures.task.members/ctor_default.pass.cpp
@@ -8,6 +8,7 @@
//===----------------------------------------------------------------------===//
//
// UNSUPPORTED: libcpp-has-no-threads
+// UNSUPPORTED: c++98, c++03
// <future>
diff --git a/test/std/thread/futures/futures.tas/futures.task.members/ctor_func.pass.cpp b/test/std/thread/futures/futures.tas/futures.task.members/ctor_func.pass.cpp
index 2eee2cbc2d50..14ac7614bb8e 100644
--- a/test/std/thread/futures/futures.tas/futures.task.members/ctor_func.pass.cpp
+++ b/test/std/thread/futures/futures.tas/futures.task.members/ctor_func.pass.cpp
@@ -8,6 +8,7 @@
//===----------------------------------------------------------------------===//
//
// UNSUPPORTED: libcpp-has-no-threads
+// UNSUPPORTED: c++98, c++03
// <future>
diff --git a/test/std/thread/futures/futures.tas/futures.task.members/ctor_func_alloc.pass.cpp b/test/std/thread/futures/futures.tas/futures.task.members/ctor_func_alloc.pass.cpp
index 3aac2b26bfc1..39784876b8c3 100644
--- a/test/std/thread/futures/futures.tas/futures.task.members/ctor_func_alloc.pass.cpp
+++ b/test/std/thread/futures/futures.tas/futures.task.members/ctor_func_alloc.pass.cpp
@@ -8,6 +8,7 @@
//===----------------------------------------------------------------------===//
//
// UNSUPPORTED: libcpp-has-no-threads
+// UNSUPPORTED: c++98, c++03
// <future>
@@ -19,7 +20,7 @@
#include <future>
#include <cassert>
-#include "../../test_allocator.h"
+#include "test_allocator.h"
#include "min_allocator.h"
class A
@@ -47,7 +48,7 @@ int main()
{
std::packaged_task<double(int, char)> p(std::allocator_arg,
test_allocator<A>(), A(5));
- assert(test_alloc_base::count > 0);
+ assert(test_alloc_base::alloc_count > 0);
assert(p.valid());
std::future<double> f = p.get_future();
p(3, 'a');
@@ -55,14 +56,14 @@ int main()
assert(A::n_copies == 0);
assert(A::n_moves > 0);
}
- assert(test_alloc_base::count == 0);
+ assert(test_alloc_base::alloc_count == 0);
A::n_copies = 0;
A::n_moves = 0;
{
A a(5);
std::packaged_task<double(int, char)> p(std::allocator_arg,
test_allocator<A>(), a);
- assert(test_alloc_base::count > 0);
+ assert(test_alloc_base::alloc_count > 0);
assert(p.valid());
std::future<double> f = p.get_future();
p(3, 'a');
@@ -70,31 +71,31 @@ int main()
assert(A::n_copies > 0);
assert(A::n_moves > 0);
}
- assert(test_alloc_base::count == 0);
+ assert(test_alloc_base::alloc_count == 0);
A::n_copies = 0;
A::n_moves = 0;
{
A a(5);
std::packaged_task<int(int)> p(std::allocator_arg, test_allocator<A>(), &func);
- assert(test_alloc_base::count > 0);
+ assert(test_alloc_base::alloc_count > 0);
assert(p.valid());
std::future<int> f = p.get_future();
p(4);
assert(f.get() == 4);
}
- assert(test_alloc_base::count == 0);
+ assert(test_alloc_base::alloc_count == 0);
A::n_copies = 0;
A::n_moves = 0;
{
A a(5);
std::packaged_task<int(int)> p(std::allocator_arg, test_allocator<A>(), func);
- assert(test_alloc_base::count > 0);
+ assert(test_alloc_base::alloc_count > 0);
assert(p.valid());
std::future<int> f = p.get_future();
p(4);
assert(f.get() == 4);
}
- assert(test_alloc_base::count == 0);
+ assert(test_alloc_base::alloc_count == 0);
A::n_copies = 0;
A::n_moves = 0;
{
diff --git a/test/std/thread/futures/futures.tas/futures.task.members/ctor_move.pass.cpp b/test/std/thread/futures/futures.tas/futures.task.members/ctor_move.pass.cpp
index 88f072281750..d9951dca585a 100644
--- a/test/std/thread/futures/futures.tas/futures.task.members/ctor_move.pass.cpp
+++ b/test/std/thread/futures/futures.tas/futures.task.members/ctor_move.pass.cpp
@@ -8,6 +8,7 @@
//===----------------------------------------------------------------------===//
//
// UNSUPPORTED: libcpp-has-no-threads
+// UNSUPPORTED: c++98, c++03
// <future>
diff --git a/test/std/thread/futures/futures.tas/futures.task.members/dtor.pass.cpp b/test/std/thread/futures/futures.tas/futures.task.members/dtor.pass.cpp
index e24232d1b227..7fafd1005649 100644
--- a/test/std/thread/futures/futures.tas/futures.task.members/dtor.pass.cpp
+++ b/test/std/thread/futures/futures.tas/futures.task.members/dtor.pass.cpp
@@ -7,7 +7,9 @@
//
//===----------------------------------------------------------------------===//
//
+// XFAIL: libcpp-no-exceptions
// UNSUPPORTED: libcpp-has-no-threads
+// UNSUPPORTED: c++98, c++03
// <future>
diff --git a/test/std/thread/futures/futures.tas/futures.task.members/get_future.pass.cpp b/test/std/thread/futures/futures.tas/futures.task.members/get_future.pass.cpp
index 13b5db110668..c8e5d6efd6b4 100644
--- a/test/std/thread/futures/futures.tas/futures.task.members/get_future.pass.cpp
+++ b/test/std/thread/futures/futures.tas/futures.task.members/get_future.pass.cpp
@@ -7,7 +7,9 @@
//
//===----------------------------------------------------------------------===//
//
+// XFAIL: libcpp-no-exceptions
// UNSUPPORTED: libcpp-has-no-threads
+// UNSUPPORTED: c++98, c++03
// <future>
diff --git a/test/std/thread/futures/futures.tas/futures.task.members/make_ready_at_thread_exit.pass.cpp b/test/std/thread/futures/futures.tas/futures.task.members/make_ready_at_thread_exit.pass.cpp
index 61a6a4f87965..54ac64458248 100644
--- a/test/std/thread/futures/futures.tas/futures.task.members/make_ready_at_thread_exit.pass.cpp
+++ b/test/std/thread/futures/futures.tas/futures.task.members/make_ready_at_thread_exit.pass.cpp
@@ -7,7 +7,9 @@
//
//===----------------------------------------------------------------------===//
//
+// XFAIL: libcpp-no-exceptions
// UNSUPPORTED: libcpp-has-no-threads
+// UNSUPPORTED: c++98, c++03
// <future>
diff --git a/test/std/thread/futures/futures.tas/futures.task.members/operator.pass.cpp b/test/std/thread/futures/futures.tas/futures.task.members/operator.pass.cpp
index 2a09353b1e63..9ad1509517f6 100644
--- a/test/std/thread/futures/futures.tas/futures.task.members/operator.pass.cpp
+++ b/test/std/thread/futures/futures.tas/futures.task.members/operator.pass.cpp
@@ -7,7 +7,9 @@
//
//===----------------------------------------------------------------------===//
//
+// XFAIL: libcpp-no-exceptions
// UNSUPPORTED: libcpp-has-no-threads
+// UNSUPPORTED: c++98, c++03
// <future>
diff --git a/test/std/thread/futures/futures.tas/futures.task.members/reset.pass.cpp b/test/std/thread/futures/futures.tas/futures.task.members/reset.pass.cpp
index 9d38d9b409c0..02a567500ee2 100644
--- a/test/std/thread/futures/futures.tas/futures.task.members/reset.pass.cpp
+++ b/test/std/thread/futures/futures.tas/futures.task.members/reset.pass.cpp
@@ -7,7 +7,9 @@
//
//===----------------------------------------------------------------------===//
//
+// XFAIL: libcpp-no-exceptions
// UNSUPPORTED: libcpp-has-no-threads
+// UNSUPPORTED: c++98, c++03
// <future>
diff --git a/test/std/thread/futures/futures.tas/futures.task.members/swap.pass.cpp b/test/std/thread/futures/futures.tas/futures.task.members/swap.pass.cpp
index 33763bef0d0f..eb0091c8e817 100644
--- a/test/std/thread/futures/futures.tas/futures.task.members/swap.pass.cpp
+++ b/test/std/thread/futures/futures.tas/futures.task.members/swap.pass.cpp
@@ -8,6 +8,7 @@
//===----------------------------------------------------------------------===//
//
// UNSUPPORTED: libcpp-has-no-threads
+// UNSUPPORTED: c++98, c++03
// <future>
diff --git a/test/std/thread/futures/futures.tas/futures.task.nonmembers/swap.pass.cpp b/test/std/thread/futures/futures.tas/futures.task.nonmembers/swap.pass.cpp
index 668732b9b24a..d90d593a75bd 100644
--- a/test/std/thread/futures/futures.tas/futures.task.nonmembers/swap.pass.cpp
+++ b/test/std/thread/futures/futures.tas/futures.task.nonmembers/swap.pass.cpp
@@ -8,6 +8,7 @@
//===----------------------------------------------------------------------===//
//
// UNSUPPORTED: libcpp-has-no-threads
+// UNSUPPORTED: c++98, c++03
// <future>
diff --git a/test/std/thread/futures/futures.tas/futures.task.nonmembers/uses_allocator.pass.cpp b/test/std/thread/futures/futures.tas/futures.task.nonmembers/uses_allocator.pass.cpp
index 986f71e29a46..bbe75de7f8a9 100644
--- a/test/std/thread/futures/futures.tas/futures.task.nonmembers/uses_allocator.pass.cpp
+++ b/test/std/thread/futures/futures.tas/futures.task.nonmembers/uses_allocator.pass.cpp
@@ -9,6 +9,12 @@
//
// UNSUPPORTED: libcpp-has-no-threads
+// This test is marked XFAIL and not UNSUPPORTED because the non-variadic
+// declaration of packaged_task is available in C++03. Therefore the test
+// should fail because the static_assert fires and not because std::packaged_task
+// in undefined.
+// XFAIL: c++98, c++03
+
// <future>
// class packaged_task<R(ArgTypes...)>
@@ -18,7 +24,7 @@
// : true_type { };
#include <future>
-#include "../../test_allocator.h"
+#include "test_allocator.h"
int main()
{
diff --git a/test/std/thread/futures/futures.tas/types.pass.cpp b/test/std/thread/futures/futures.tas/types.pass.cpp
index dd1724ddbda5..f7c9b223add1 100644
--- a/test/std/thread/futures/futures.tas/types.pass.cpp
+++ b/test/std/thread/futures/futures.tas/types.pass.cpp
@@ -8,6 +8,7 @@
//===----------------------------------------------------------------------===//
//
// UNSUPPORTED: libcpp-has-no-threads
+// UNSUPPORTED: c++98, c++03
// <future>
diff --git a/test/std/thread/futures/futures.unique_future/copy_assign.fail.cpp b/test/std/thread/futures/futures.unique_future/copy_assign.fail.cpp
index ebdcbf98d996..781c9c9d6199 100644
--- a/test/std/thread/futures/futures.unique_future/copy_assign.fail.cpp
+++ b/test/std/thread/futures/futures.unique_future/copy_assign.fail.cpp
@@ -14,61 +14,36 @@
// future& operator=(const future&) = delete;
#include <future>
-#include <cassert>
+
+#include "test_macros.h"
int main()
{
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+#if TEST_STD_VER >= 11
{
- typedef int T;
- std::promise<T> p;
- std::future<T> f0 = p.get_future();
- std::future<T> f;
- f = f0;
- assert(!f0.valid());
- assert(f.valid());
+ std::future<int> f0, f;
+ f = f0; // expected-error {{overload resolution selected deleted operator '='}}
}
{
- typedef int T;
- std::future<T> f0;
- std::future<T> f;
- f = f0;
- assert(!f0.valid());
- assert(!f.valid());
+ std::future<int &> f0, f;
+ f = f0; // expected-error {{overload resolution selected deleted operator '='}}
}
{
- typedef int& T;
- std::promise<T> p;
- std::future<T> f0 = p.get_future();
- std::future<T> f;
- f = f0;
- assert(!f0.valid());
- assert(f.valid());
+ std::future<void> f0, f;
+ f = f0; // expected-error {{overload resolution selected deleted operator '='}}
}
+#else
{
- typedef int& T;
- std::future<T> f0;
- std::future<T> f;
- f = f0;
- assert(!f0.valid());
- assert(!f.valid());
+ std::future<int> f0, f;
+ f = f0; // expected-error {{'operator=' is a private member of 'std::__1::future<int>'}}
}
{
- typedef void T;
- std::promise<T> p;
- std::future<T> f0 = p.get_future();
- std::future<T> f;
- f = f0;
- assert(!f0.valid());
- assert(f.valid());
+ std::future<int &> f0, f;
+ f = f0; // expected-error {{'operator=' is a private member of 'std::__1::future<int &>'}}
}
{
- typedef void T;
- std::future<T> f0;
- std::future<T> f;
- f = f0;
- assert(!f0.valid());
- assert(!f.valid());
+ std::future<void> f0, f;
+ f = f0; // expected-error {{'operator=' is a private member of 'std::__1::future<void>'}}
}
-#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+#endif
}
diff --git a/test/std/thread/futures/futures.unique_future/copy_ctor.fail.cpp b/test/std/thread/futures/futures.unique_future/copy_ctor.fail.cpp
index 8d43294edc26..0d7b5f5074d3 100644
--- a/test/std/thread/futures/futures.unique_future/copy_ctor.fail.cpp
+++ b/test/std/thread/futures/futures.unique_future/copy_ctor.fail.cpp
@@ -14,53 +14,36 @@
// future(const future&) = delete;
#include <future>
-#include <cassert>
+
+#include "test_macros.h"
int main()
{
+#if TEST_STD_VER >= 11
{
- typedef int T;
- std::promise<T> p;
- std::future<T> f0 = p.get_future();
- std::future<T> f = f0;
- assert(!f0.valid());
- assert(f.valid());
+ std::future<int> f0;
+ std::future<int> f = f0; // expected-error {{call to deleted constructor of 'std::future<int>'}}
}
{
- typedef int T;
- std::future<T> f0;
- std::future<T> f = f0;
- assert(!f0.valid());
- assert(!f.valid());
+ std::future<int &> f0;
+ std::future<int &> f = f0; // expected-error {{call to deleted constructor of 'std::future<int &>'}}
}
{
- typedef int& T;
- std::promise<T> p;
- std::future<T> f0 = p.get_future();
- std::future<T> f = f0;
- assert(!f0.valid());
- assert(f.valid());
+ std::future<void> f0;
+ std::future<void> f = f0; // expected-error {{call to deleted constructor of 'std::future<void>'}}
}
+#else
{
- typedef int& T;
- std::future<T> f0;
- std::future<T> f = std::move(f0);
- assert(!f0.valid());
- assert(!f.valid());
+ std::future<int> f0;
+ std::future<int> f = f0; // expected-error {{calling a private constructor of class 'std::__1::future<int>'}}
}
{
- typedef void T;
- std::promise<T> p;
- std::future<T> f0 = p.get_future();
- std::future<T> f = f0;
- assert(!f0.valid());
- assert(f.valid());
+ std::future<int &> f0;
+ std::future<int &> f = f0; // expected-error {{calling a private constructor of class 'std::__1::future<int &>'}}
}
{
- typedef void T;
- std::future<T> f0;
- std::future<T> f = f0;
- assert(!f0.valid());
- assert(!f.valid());
+ std::future<void> f0;
+ std::future<void> f = f0; // expected-error {{calling a private constructor of class 'std::__1::future<void>'}}
}
+#endif
}
diff --git a/test/std/thread/futures/futures.unique_future/dtor.pass.cpp b/test/std/thread/futures/futures.unique_future/dtor.pass.cpp
index 5e9697bb939b..03d7c915cb61 100644
--- a/test/std/thread/futures/futures.unique_future/dtor.pass.cpp
+++ b/test/std/thread/futures/futures.unique_future/dtor.pass.cpp
@@ -7,7 +7,9 @@
//
//===----------------------------------------------------------------------===//
//
+// XFAIL: libcpp-no-exceptions
// UNSUPPORTED: libcpp-has-no-threads
+// UNSUPPORTED: c++98, c++03
// <future>
@@ -18,51 +20,51 @@
#include <future>
#include <cassert>
-#include "../test_allocator.h"
+#include "test_allocator.h"
int main()
{
- assert(test_alloc_base::count == 0);
+ assert(test_alloc_base::alloc_count == 0);
{
typedef int T;
std::future<T> f;
{
std::promise<T> p(std::allocator_arg, test_allocator<T>());
- assert(test_alloc_base::count == 1);
+ assert(test_alloc_base::alloc_count == 1);
f = p.get_future();
- assert(test_alloc_base::count == 1);
+ assert(test_alloc_base::alloc_count == 1);
assert(f.valid());
}
- assert(test_alloc_base::count == 1);
+ assert(test_alloc_base::alloc_count == 1);
assert(f.valid());
}
- assert(test_alloc_base::count == 0);
+ assert(test_alloc_base::alloc_count == 0);
{
typedef int& T;
std::future<T> f;
{
std::promise<T> p(std::allocator_arg, test_allocator<int>());
- assert(test_alloc_base::count == 1);
+ assert(test_alloc_base::alloc_count == 1);
f = p.get_future();
- assert(test_alloc_base::count == 1);
+ assert(test_alloc_base::alloc_count == 1);
assert(f.valid());
}
- assert(test_alloc_base::count == 1);
+ assert(test_alloc_base::alloc_count == 1);
assert(f.valid());
}
- assert(test_alloc_base::count == 0);
+ assert(test_alloc_base::alloc_count == 0);
{
typedef void T;
std::future<T> f;
{
std::promise<T> p(std::allocator_arg, test_allocator<T>());
- assert(test_alloc_base::count == 1);
+ assert(test_alloc_base::alloc_count == 1);
f = p.get_future();
- assert(test_alloc_base::count == 1);
+ assert(test_alloc_base::alloc_count == 1);
assert(f.valid());
}
- assert(test_alloc_base::count == 1);
+ assert(test_alloc_base::alloc_count == 1);
assert(f.valid());
}
- assert(test_alloc_base::count == 0);
+ assert(test_alloc_base::alloc_count == 0);
}
diff --git a/test/std/thread/futures/futures.unique_future/get.pass.cpp b/test/std/thread/futures/futures.unique_future/get.pass.cpp
index 758e38a7dae9..67b1052c175d 100644
--- a/test/std/thread/futures/futures.unique_future/get.pass.cpp
+++ b/test/std/thread/futures/futures.unique_future/get.pass.cpp
@@ -7,7 +7,9 @@
//
//===----------------------------------------------------------------------===//
//
+// XFAIL: libcpp-no-exceptions
// UNSUPPORTED: libcpp-has-no-threads
+// UNSUPPORTED: c++98, c++03
// <future>
diff --git a/test/std/thread/futures/futures.unique_future/share.pass.cpp b/test/std/thread/futures/futures.unique_future/share.pass.cpp
index 794b5ce38feb..ef011d8df752 100644
--- a/test/std/thread/futures/futures.unique_future/share.pass.cpp
+++ b/test/std/thread/futures/futures.unique_future/share.pass.cpp
@@ -8,6 +8,7 @@
//===----------------------------------------------------------------------===//
//
// UNSUPPORTED: libcpp-has-no-threads
+// UNSUPPORTED: c++98, c++03
// <future>
diff --git a/test/std/thread/futures/futures.unique_future/wait.pass.cpp b/test/std/thread/futures/futures.unique_future/wait.pass.cpp
index e10d37cf8064..f6de983f3057 100644
--- a/test/std/thread/futures/futures.unique_future/wait.pass.cpp
+++ b/test/std/thread/futures/futures.unique_future/wait.pass.cpp
@@ -8,6 +8,7 @@
//===----------------------------------------------------------------------===//
//
// UNSUPPORTED: libcpp-has-no-threads
+// UNSUPPORTED: c++98, c++03
// <future>
diff --git a/test/std/thread/futures/futures.unique_future/wait_for.pass.cpp b/test/std/thread/futures/futures.unique_future/wait_for.pass.cpp
index 0a381d9ca2f0..c4f358268432 100644
--- a/test/std/thread/futures/futures.unique_future/wait_for.pass.cpp
+++ b/test/std/thread/futures/futures.unique_future/wait_for.pass.cpp
@@ -8,6 +8,7 @@
//===----------------------------------------------------------------------===//
//
// UNSUPPORTED: libcpp-has-no-threads
+// UNSUPPORTED: c++98, c++03
// <future>
diff --git a/test/std/thread/futures/futures.unique_future/wait_until.pass.cpp b/test/std/thread/futures/futures.unique_future/wait_until.pass.cpp
index d5865b9b9dcf..541c00860752 100644
--- a/test/std/thread/futures/futures.unique_future/wait_until.pass.cpp
+++ b/test/std/thread/futures/futures.unique_future/wait_until.pass.cpp
@@ -1,129 +1,130 @@
- //===----------------------------------------------------------------------===//
- //
- // The LLVM 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
-
- // <future>
-
- // class future<R>
-
- // template <class Clock, class Duration>
- // future_status
- // wait_until(const chrono::time_point<Clock, Duration>& abs_time) const;
-
- #include <future>
- #include <atomic>
- #include <cassert>
-
- enum class WorkerThreadState { Uninitialized, AllowedToRun, Exiting };
- typedef std::chrono::milliseconds ms;
-
- std::atomic<WorkerThreadState> thread_state(WorkerThreadState::Uninitialized);
-
- void set_worker_thread_state(WorkerThreadState state)
- {
- thread_state.store(state, std::memory_order_relaxed);
- }
-
- void wait_for_worker_thread_state(WorkerThreadState state)
- {
- while (thread_state.load(std::memory_order_relaxed) != state);
- }
-
- void func1(std::promise<int> p)
- {
- wait_for_worker_thread_state(WorkerThreadState::AllowedToRun);
- p.set_value(3);
- set_worker_thread_state(WorkerThreadState::Exiting);
- }
-
- int j = 0;
-
- void func3(std::promise<int&> p)
- {
- wait_for_worker_thread_state(WorkerThreadState::AllowedToRun);
- j = 5;
- p.set_value(j);
- set_worker_thread_state(WorkerThreadState::Exiting);
- }
-
- void func5(std::promise<void> p)
- {
- wait_for_worker_thread_state(WorkerThreadState::AllowedToRun);
- p.set_value();
- set_worker_thread_state(WorkerThreadState::Exiting);
- }
-
- int main()
- {
- typedef std::chrono::high_resolution_clock Clock;
- {
- typedef int T;
- std::promise<T> p;
- std::future<T> f = p.get_future();
- std::thread(func1, std::move(p)).detach();
- assert(f.valid());
- assert(f.wait_until(Clock::now() + ms(10)) == std::future_status::timeout);
- assert(f.valid());
-
- // allow the worker thread to produce the result and wait until the worker is done
- set_worker_thread_state(WorkerThreadState::AllowedToRun);
- wait_for_worker_thread_state(WorkerThreadState::Exiting);
-
- assert(f.wait_until(Clock::now() + ms(10)) == std::future_status::ready);
- assert(f.valid());
- Clock::time_point t0 = Clock::now();
- f.wait();
- Clock::time_point t1 = Clock::now();
- assert(f.valid());
- assert(t1-t0 < ms(5));
- }
- {
- typedef int& T;
- std::promise<T> p;
- std::future<T> f = p.get_future();
- std::thread(func3, std::move(p)).detach();
- assert(f.valid());
- assert(f.wait_until(Clock::now() + ms(10)) == std::future_status::timeout);
- assert(f.valid());
-
- // allow the worker thread to produce the result and wait until the worker is done
- set_worker_thread_state(WorkerThreadState::AllowedToRun);
- wait_for_worker_thread_state(WorkerThreadState::Exiting);
-
- assert(f.wait_until(Clock::now() + ms(10)) == std::future_status::ready);
- assert(f.valid());
- Clock::time_point t0 = Clock::now();
- f.wait();
- Clock::time_point t1 = Clock::now();
- assert(f.valid());
- assert(t1-t0 < ms(5));
- }
- {
- typedef void T;
- std::promise<T> p;
- std::future<T> f = p.get_future();
- std::thread(func5, std::move(p)).detach();
- assert(f.valid());
- assert(f.wait_until(Clock::now() + ms(10)) == std::future_status::timeout);
- assert(f.valid());
-
- // allow the worker thread to produce the result and wait until the worker is done
- set_worker_thread_state(WorkerThreadState::AllowedToRun);
- wait_for_worker_thread_state(WorkerThreadState::Exiting);
-
- assert(f.wait_until(Clock::now() + ms(10)) == std::future_status::ready);
- assert(f.valid());
- Clock::time_point t0 = Clock::now();
- f.wait();
- Clock::time_point t1 = Clock::now();
- assert(f.valid());
- assert(t1-t0 < ms(5));
- }
- }
+//===----------------------------------------------------------------------===//
+//
+// The LLVM 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
+
+// <future>
+
+// class future<R>
+
+// template <class Clock, class Duration>
+// future_status
+// wait_until(const chrono::time_point<Clock, Duration>& abs_time) const;
+
+#include <future>
+#include <atomic>
+#include <cassert>
+
+enum class WorkerThreadState { Uninitialized, AllowedToRun, Exiting };
+typedef std::chrono::milliseconds ms;
+
+std::atomic<WorkerThreadState> thread_state(WorkerThreadState::Uninitialized);
+
+void set_worker_thread_state(WorkerThreadState state)
+{
+ thread_state.store(state, std::memory_order_relaxed);
+}
+
+void wait_for_worker_thread_state(WorkerThreadState state)
+{
+ while (thread_state.load(std::memory_order_relaxed) != state);
+}
+
+void func1(std::promise<int> p)
+{
+ wait_for_worker_thread_state(WorkerThreadState::AllowedToRun);
+ p.set_value(3);
+ set_worker_thread_state(WorkerThreadState::Exiting);
+}
+
+int j = 0;
+
+void func3(std::promise<int&> p)
+{
+ wait_for_worker_thread_state(WorkerThreadState::AllowedToRun);
+ j = 5;
+ p.set_value(j);
+ set_worker_thread_state(WorkerThreadState::Exiting);
+}
+
+void func5(std::promise<void> p)
+{
+ wait_for_worker_thread_state(WorkerThreadState::AllowedToRun);
+ p.set_value();
+ set_worker_thread_state(WorkerThreadState::Exiting);
+}
+
+int main()
+{
+ typedef std::chrono::high_resolution_clock Clock;
+ {
+ typedef int T;
+ std::promise<T> p;
+ std::future<T> f = p.get_future();
+ std::thread(func1, std::move(p)).detach();
+ assert(f.valid());
+ assert(f.wait_until(Clock::now() + ms(10)) == std::future_status::timeout);
+ assert(f.valid());
+
+ // allow the worker thread to produce the result and wait until the worker is done
+ set_worker_thread_state(WorkerThreadState::AllowedToRun);
+ wait_for_worker_thread_state(WorkerThreadState::Exiting);
+
+ assert(f.wait_until(Clock::now() + ms(10)) == std::future_status::ready);
+ assert(f.valid());
+ Clock::time_point t0 = Clock::now();
+ f.wait();
+ Clock::time_point t1 = Clock::now();
+ assert(f.valid());
+ assert(t1-t0 < ms(5));
+ }
+ {
+ typedef int& T;
+ std::promise<T> p;
+ std::future<T> f = p.get_future();
+ std::thread(func3, std::move(p)).detach();
+ assert(f.valid());
+ assert(f.wait_until(Clock::now() + ms(10)) == std::future_status::timeout);
+ assert(f.valid());
+
+ // allow the worker thread to produce the result and wait until the worker is done
+ set_worker_thread_state(WorkerThreadState::AllowedToRun);
+ wait_for_worker_thread_state(WorkerThreadState::Exiting);
+
+ assert(f.wait_until(Clock::now() + ms(10)) == std::future_status::ready);
+ assert(f.valid());
+ Clock::time_point t0 = Clock::now();
+ f.wait();
+ Clock::time_point t1 = Clock::now();
+ assert(f.valid());
+ assert(t1-t0 < ms(5));
+ }
+ {
+ typedef void T;
+ std::promise<T> p;
+ std::future<T> f = p.get_future();
+ std::thread(func5, std::move(p)).detach();
+ assert(f.valid());
+ assert(f.wait_until(Clock::now() + ms(10)) == std::future_status::timeout);
+ assert(f.valid());
+
+ // allow the worker thread to produce the result and wait until the worker is done
+ set_worker_thread_state(WorkerThreadState::AllowedToRun);
+ wait_for_worker_thread_state(WorkerThreadState::Exiting);
+
+ assert(f.wait_until(Clock::now() + ms(10)) == std::future_status::ready);
+ assert(f.valid());
+ Clock::time_point t0 = Clock::now();
+ f.wait();
+ Clock::time_point t1 = Clock::now();
+ assert(f.valid());
+ assert(t1-t0 < ms(5));
+ }
+}
diff --git a/test/std/thread/futures/test_allocator.h b/test/std/thread/futures/test_allocator.h
deleted file mode 100644
index 50072909fa4e..000000000000
--- a/test/std/thread/futures/test_allocator.h
+++ /dev/null
@@ -1,158 +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.
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef TEST_ALLOCATOR_H
-#define TEST_ALLOCATOR_H
-
-#include <cstddef>
-#include <type_traits>
-#include <utility>
-#include <cstdlib>
-#include <new>
-#include <climits>
-
-class test_alloc_base
-{
-public:
- static int count;
-public:
- static int throw_after;
-};
-
-int test_alloc_base::count = 0;
-int test_alloc_base::throw_after = INT_MAX;
-
-template <class T>
-class test_allocator
- : public test_alloc_base
-{
- int data_;
-
- template <class U> friend class test_allocator;
-public:
-
- typedef unsigned size_type;
- typedef int difference_type;
- typedef T value_type;
- typedef value_type* pointer;
- typedef const value_type* const_pointer;
- typedef typename std::add_lvalue_reference<value_type>::type reference;
- typedef typename std::add_lvalue_reference<const value_type>::type const_reference;
-
- template <class U> struct rebind {typedef test_allocator<U> other;};
-
- test_allocator() throw() : data_(-1) {}
- explicit test_allocator(int i) throw() : data_(i) {}
- test_allocator(const test_allocator& a) throw()
- : data_(a.data_) {}
- template <class U> test_allocator(const test_allocator<U>& a) throw()
- : data_(a.data_) {}
- ~test_allocator() throw() {data_ = 0;}
- pointer address(reference x) const {return &x;}
- const_pointer address(const_reference x) const {return &x;}
- pointer allocate(size_type n, const void* = 0)
- {
- if (count >= throw_after) {
-#ifndef _LIBCPP_NO_EXCEPTIONS
- throw std::bad_alloc();
-#else
- std::terminate();
-#endif
- }
- ++count;
- return (pointer)std::malloc(n * sizeof(T));
- }
- void deallocate(pointer p, size_type n)
- {--count; std::free(p);}
- size_type max_size() const throw()
- {return UINT_MAX / sizeof(T);}
- void construct(pointer p, const T& val)
- {::new(p) T(val);}
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
- void construct(pointer p, T&& val)
- {::new(p) T(std::move(val));}
-#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
- void destroy(pointer p) {p->~T();}
-
- friend bool operator==(const test_allocator& x, const test_allocator& y)
- {return x.data_ == y.data_;}
- friend bool operator!=(const test_allocator& x, const test_allocator& y)
- {return !(x == y);}
-};
-
-template <>
-class test_allocator<void>
- : public test_alloc_base
-{
- int data_;
-
- template <class U> friend class test_allocator;
-public:
-
- typedef unsigned size_type;
- typedef int difference_type;
- typedef void value_type;
- typedef value_type* pointer;
- typedef const value_type* const_pointer;
-
- template <class U> struct rebind {typedef test_allocator<U> other;};
-
- test_allocator() throw() : data_(-1) {}
- explicit test_allocator(int i) throw() : data_(i) {}
- test_allocator(const test_allocator& a) throw()
- : data_(a.data_) {}
- template <class U> test_allocator(const test_allocator<U>& a) throw()
- : data_(a.data_) {}
- ~test_allocator() throw() {data_ = 0;}
-
- friend bool operator==(const test_allocator& x, const test_allocator& y)
- {return x.data_ == y.data_;}
- friend bool operator!=(const test_allocator& x, const test_allocator& y)
- {return !(x == y);}
-};
-
-template <class T>
-class other_allocator
-{
- int data_;
-
- template <class U> friend class other_allocator;
-
-public:
- typedef T value_type;
-
- other_allocator() : data_(-1) {}
- explicit other_allocator(int i) : data_(i) {}
- template <class U> other_allocator(const other_allocator<U>& a)
- : data_(a.data_) {}
- T* allocate(std::size_t n)
- {return (T*)std::malloc(n * sizeof(T));}
- void deallocate(T* p, std::size_t n)
- {std::free(p);}
-
- other_allocator select_on_container_copy_construction() const
- {return other_allocator(-2);}
-
- friend bool operator==(const other_allocator& x, const other_allocator& y)
- {return x.data_ == y.data_;}
- friend bool operator!=(const other_allocator& x, const other_allocator& y)
- {return !(x == y);}
-
- typedef std::true_type propagate_on_container_copy_assignment;
- typedef std::true_type propagate_on_container_move_assignment;
- typedef std::true_type propagate_on_container_swap;
-
-#ifdef _LIBCPP_HAS_NO_ADVANCED_SFINAE
- std::size_t max_size() const
- {return UINT_MAX / sizeof(T);}
-#endif // _LIBCPP_HAS_NO_ADVANCED_SFINAE
-
-};
-
-#endif // TEST_ALLOCATOR_H
diff --git a/test/std/thread/thread.condition/notify_all_at_thread_exit.pass.cpp b/test/std/thread/thread.condition/notify_all_at_thread_exit.pass.cpp
index 2b8772f92ed2..02da345cb7d1 100644
--- a/test/std/thread/thread.condition/notify_all_at_thread_exit.pass.cpp
+++ b/test/std/thread/thread.condition/notify_all_at_thread_exit.pass.cpp
@@ -9,6 +9,10 @@
//
// UNSUPPORTED: libcpp-has-no-threads
+// notify_all_at_thread_exit(...) requires move semantics to transfer the
+// unique_lock.
+// UNSUPPORTED: c++98, c++03
+
// <condition_variable>
// void
@@ -36,9 +40,10 @@ void func()
int main()
{
std::unique_lock<std::mutex> lk(mut);
- std::thread(func).detach();
+ std::thread t(func);
Clock::time_point t0 = Clock::now();
cv.wait(lk);
Clock::time_point t1 = Clock::now();
assert(t1-t0 > ms(250));
+ t.join();
}
diff --git a/test/std/thread/thread.condition/thread.condition.condvar/notify_one.pass.cpp b/test/std/thread/thread.condition/thread.condition.condvar/notify_one.pass.cpp
index 6236a13df80e..e99ebee9c8e0 100644
--- a/test/std/thread/thread.condition/thread.condition.condvar/notify_one.pass.cpp
+++ b/test/std/thread/thread.condition/thread.condition.condvar/notify_one.pass.cpp
@@ -16,16 +16,17 @@
// void notify_one();
#include <condition_variable>
+#include <atomic>
#include <mutex>
#include <thread>
#include <cassert>
+
std::condition_variable cv;
std::mutex mut;
-int test0 = 0;
-int test1 = 0;
-int test2 = 0;
+std::atomic_int test1(0);
+std::atomic_int test2(0);
void f1()
{
@@ -64,11 +65,13 @@ int main()
}
if (test1 == 2)
{
+ assert(test2 == 1);
t1.join();
test1 = 0;
}
else if (test2 == 2)
{
+ assert(test1 == 1);
t2.join();
test2 = 0;
}
@@ -81,11 +84,13 @@ int main()
}
if (test1 == 2)
{
+ assert(test2 == 0);
t1.join();
test1 = 0;
}
else if (test2 == 2)
{
+ assert(test1 == 0);
t2.join();
test2 = 0;
}
diff --git a/test/std/thread/thread.condition/thread.condition.condvarany/wait.exception.pass.cpp b/test/std/thread/thread.condition/thread.condition.condvarany/wait.exception.pass.cpp
deleted file mode 100644
index 522c61b02d17..000000000000
--- a/test/std/thread/thread.condition/thread.condition.condvarany/wait.exception.pass.cpp
+++ /dev/null
@@ -1,63 +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-has-no-threads
-
-#include <thread>
-#include <condition_variable>
-#include <mutex>
-#include <chrono>
-#include <iostream>
-#include <cassert>
-
-void f1()
-{
- std::exit(0);
-}
-
-struct Mutex
-{
- unsigned state = 0;
- Mutex() = default;
- ~Mutex() = default;
- Mutex(const Mutex&) = delete;
- Mutex& operator=(const Mutex&) = delete;
-
- void lock()
- {
- if (++state == 2)
- throw 1; // this throw should end up calling terminate()
- }
-
- void unlock() {}
-};
-
-Mutex mut;
-std::condition_variable_any cv;
-
-void
-signal_me()
-{
- std::this_thread::sleep_for(std::chrono::milliseconds(500));
- cv.notify_one();
-}
-
-int
-main()
-{
- std::set_terminate(f1);
- try
- {
- std::thread(signal_me).detach();
- mut.lock();
- cv.wait(mut);
- }
- catch (...) {}
- assert(false);
-}
diff --git a/test/std/thread/thread.condition/thread.condition.condvarany/wait_for.exception.pass.cpp b/test/std/thread/thread.condition/thread.condition.condvarany/wait_for.exception.pass.cpp
deleted file mode 100644
index 1906b5892506..000000000000
--- a/test/std/thread/thread.condition/thread.condition.condvarany/wait_for.exception.pass.cpp
+++ /dev/null
@@ -1,63 +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-has-no-threads
-
-#include <thread>
-#include <condition_variable>
-#include <mutex>
-#include <chrono>
-#include <iostream>
-#include <cassert>
-
-void f1()
-{
- std::exit(0);
-}
-
-struct Mutex
-{
- unsigned state = 0;
- Mutex() = default;
- ~Mutex() = default;
- Mutex(const Mutex&) = delete;
- Mutex& operator=(const Mutex&) = delete;
-
- void lock()
- {
- if (++state == 2)
- throw 1; // this throw should end up calling terminate()
- }
-
- void unlock() {}
-};
-
-Mutex mut;
-std::condition_variable_any cv;
-
-void
-signal_me()
-{
- std::this_thread::sleep_for(std::chrono::milliseconds(500));
- cv.notify_one();
-}
-
-int
-main()
-{
- std::set_terminate(f1);
- try
- {
- std::thread(signal_me).detach();
- mut.lock();
- cv.wait_for(mut, std::chrono::milliseconds(250));
- }
- catch (...) {}
- assert(false);
-}
diff --git a/test/std/thread/thread.condition/thread.condition.condvarany/wait_terminates.sh.cpp b/test/std/thread/thread.condition/thread.condition.condvarany/wait_terminates.sh.cpp
new file mode 100644
index 000000000000..f9a35cc905c7
--- /dev/null
+++ b/test/std/thread/thread.condition/thread.condition.condvarany/wait_terminates.sh.cpp
@@ -0,0 +1,134 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// XFAIL: libcpp-no-exceptions
+// UNSUPPORTED: libcpp-has-no-threads
+
+// <condition_variable>
+
+// class condition_variable_any;
+
+// RUN: %build
+// RUN: %run 1
+// RUN: %run 2
+// RUN: %run 3
+// RUN: %run 4
+// RUN: %run 5
+// RUN: %run 6
+
+// -----------------------------------------------------------------------------
+// Overview
+// Check that std::terminate is called if wait(...) fails to meet it's post
+// conditions. This can happens when reacquiring the mutex throws
+// an exception.
+//
+// The following methods are tested within this file
+// 1. void wait(Lock& lock);
+// 2. void wait(Lock& lock, Pred);
+// 3. void wait_for(Lock& lock, Duration);
+// 4. void wait_for(Lock& lock, Duration, Pred);
+// 5. void wait_until(Lock& lock, TimePoint);
+// 6. void wait_until(Lock& lock, TimePoint, Pred);
+//
+// Plan
+// 1 Create a mutex type, 'ThrowingMutex', that throws when the lock is aquired
+// for the *second* time.
+//
+// 2 Replace the terminate handler with one that exits with a '0' exit code.
+//
+// 3 Create a 'condition_variable_any' object 'cv' and a 'ThrowingMutex'
+// object 'm' and lock 'm'.
+//
+// 4 Start a thread 'T2' that will notify 'cv' once 'm' has been unlocked.
+//
+// 5 From the main thread call the specified wait method on 'cv' with 'm'.
+// When 'T2' notifies 'cv' and the wait method attempts to re-lock
+// 'm' an exception will be thrown from 'm.lock()'.
+//
+// 6 Check that control flow does not return from the wait method and that
+// terminate is called (If the program exits with a 0 exit code we know
+// that terminate has been called)
+
+
+#include <condition_variable>
+#include <atomic>
+#include <thread>
+#include <chrono>
+#include <string>
+#include <cstdlib>
+#include <cassert>
+
+void my_terminate() {
+ std::_Exit(0); // Use _Exit to prevent cleanup from taking place.
+}
+
+// The predicate used in the cv.wait calls.
+bool pred = false;
+bool pred_function() {
+ return pred == true;
+}
+
+class ThrowingMutex
+{
+ std::atomic_bool locked;
+ unsigned state = 0;
+ ThrowingMutex(const ThrowingMutex&) = delete;
+ ThrowingMutex& operator=(const ThrowingMutex&) = delete;
+public:
+ ThrowingMutex() {
+ locked = false;
+ }
+ ~ThrowingMutex() = default;
+
+ void lock() {
+ locked = true;
+ if (++state == 2) {
+ assert(pred); // Check that we actually waited until we were signaled.
+ throw 1; // this throw should end up calling terminate()
+ }
+ }
+
+ void unlock() { locked = false; }
+ bool isLocked() const { return locked == true; }
+};
+
+ThrowingMutex mut;
+std::condition_variable_any cv;
+
+void signal_me() {
+ while (mut.isLocked()) {} // wait until T1 releases mut inside the cv.wait call.
+ pred = true;
+ cv.notify_one();
+}
+
+typedef std::chrono::system_clock Clock;
+typedef std::chrono::milliseconds MS;
+
+int main(int argc, char** argv) {
+ assert(argc == 2);
+ int id = std::stoi(argv[1]);
+ assert(id >= 1 && id <= 6);
+ std::set_terminate(my_terminate); // set terminate after std::stoi because it can throw.
+ MS wait(250);
+ try {
+ mut.lock();
+ assert(pred == false);
+ std::thread(signal_me).detach();
+ switch (id) {
+ case 1: cv.wait(mut); break;
+ case 2: cv.wait(mut, pred_function); break;
+ case 3: cv.wait_for(mut, wait); break;
+ case 4: cv.wait_for(mut, wait, pred_function); break;
+ case 5: cv.wait_until(mut, Clock::now() + wait); break;
+ case 6: cv.wait_until(mut, Clock::now() + wait, pred_function); break;
+ default: assert(false);
+ }
+ } catch (...) {}
+ assert(false);
+}
diff --git a/test/std/thread/thread.mutex/thread.lock.algorithm/lock.pass.cpp b/test/std/thread/thread.mutex/thread.lock.algorithm/lock.pass.cpp
index f67ca2169825..eac7600b5d11 100644
--- a/test/std/thread/thread.mutex/thread.lock.algorithm/lock.pass.cpp
+++ b/test/std/thread/thread.mutex/thread.lock.algorithm/lock.pass.cpp
@@ -7,6 +7,7 @@
//
//===----------------------------------------------------------------------===//
//
+// XFAIL: libcpp-no-exceptions
// UNSUPPORTED: libcpp-has-no-threads
// <mutex>
diff --git a/test/std/thread/thread.mutex/thread.lock.algorithm/try_lock.pass.cpp b/test/std/thread/thread.mutex/thread.lock.algorithm/try_lock.pass.cpp
index f0c54b71883f..8889408be2d7 100644
--- a/test/std/thread/thread.mutex/thread.lock.algorithm/try_lock.pass.cpp
+++ b/test/std/thread/thread.mutex/thread.lock.algorithm/try_lock.pass.cpp
@@ -7,6 +7,7 @@
//
//===----------------------------------------------------------------------===//
//
+// XFAIL: libcpp-no-exceptions
// UNSUPPORTED: libcpp-has-no-threads
// <mutex>
diff --git a/test/std/thread/thread.mutex/thread.lock/thread.lock.shared/thread.lock.shared.cons/default.pass.cpp b/test/std/thread/thread.mutex/thread.lock/thread.lock.shared/thread.lock.shared.cons/default.pass.cpp
index 2c1c665fdeda..f7cf49c81f3f 100644
--- a/test/std/thread/thread.mutex/thread.lock/thread.lock.shared/thread.lock.shared.cons/default.pass.cpp
+++ b/test/std/thread/thread.mutex/thread.lock/thread.lock.shared/thread.lock.shared.cons/default.pass.cpp
@@ -8,6 +8,7 @@
//===----------------------------------------------------------------------===//
//
// UNSUPPORTED: libcpp-has-no-threads
+// UNSUPPORTED: c++98, c++03, c++11
// <shared_mutex>
@@ -20,9 +21,7 @@
int main()
{
-#if _LIBCPP_STD_VER > 11
std::shared_lock<std::shared_timed_mutex> ul;
assert(!ul.owns_lock());
assert(ul.mutex() == nullptr);
-#endif // _LIBCPP_STD_VER > 11
}
diff --git a/test/std/thread/thread.mutex/thread.lock/thread.lock.shared/thread.lock.shared.cons/move_assign.pass.cpp b/test/std/thread/thread.mutex/thread.lock/thread.lock.shared/thread.lock.shared.cons/move_assign.pass.cpp
index 8676f2ca0472..15c193c60b5d 100644
--- a/test/std/thread/thread.mutex/thread.lock/thread.lock.shared/thread.lock.shared.cons/move_assign.pass.cpp
+++ b/test/std/thread/thread.mutex/thread.lock/thread.lock.shared/thread.lock.shared.cons/move_assign.pass.cpp
@@ -8,6 +8,7 @@
//===----------------------------------------------------------------------===//
//
// UNSUPPORTED: libcpp-has-no-threads
+// UNSUPPORTED: c++98, c++03, c++11
// <shared_mutex>
@@ -18,16 +19,11 @@
#include <shared_mutex>
#include <cassert>
-#if _LIBCPP_STD_VER > 11
-
std::shared_timed_mutex m0;
std::shared_timed_mutex m1;
-#endif // _LIBCPP_STD_VER > 11
-
int main()
{
-#if _LIBCPP_STD_VER > 11
std::shared_lock<std::shared_timed_mutex> lk0(m0);
std::shared_lock<std::shared_timed_mutex> lk1(m1);
lk1 = std::move(lk0);
@@ -35,5 +31,4 @@ int main()
assert(lk1.owns_lock() == true);
assert(lk0.mutex() == nullptr);
assert(lk0.owns_lock() == false);
-#endif // _LIBCPP_STD_VER > 11
}
diff --git a/test/std/thread/thread.mutex/thread.lock/thread.lock.shared/thread.lock.shared.cons/move_ctor.pass.cpp b/test/std/thread/thread.mutex/thread.lock/thread.lock.shared/thread.lock.shared.cons/move_ctor.pass.cpp
index f59d2e826980..4f4f6a5e9fbd 100644
--- a/test/std/thread/thread.mutex/thread.lock/thread.lock.shared/thread.lock.shared.cons/move_ctor.pass.cpp
+++ b/test/std/thread/thread.mutex/thread.lock/thread.lock.shared/thread.lock.shared.cons/move_ctor.pass.cpp
@@ -8,6 +8,7 @@
//===----------------------------------------------------------------------===//
//
// UNSUPPORTED: libcpp-has-no-threads
+// UNSUPPORTED: c++98, c++03, c++11
// <shared_mutex>
@@ -18,18 +19,13 @@
#include <shared_mutex>
#include <cassert>
-#if _LIBCPP_STD_VER > 11
-std::shared_timed_mutex m;
-#endif // _LIBCPP_STD_VER > 11
-
int main()
{
-#if _LIBCPP_STD_VER > 11
+ std::shared_timed_mutex m;
std::shared_lock<std::shared_timed_mutex> lk0(m);
std::shared_lock<std::shared_timed_mutex> lk = std::move(lk0);
assert(lk.mutex() == &m);
assert(lk.owns_lock() == true);
assert(lk0.mutex() == nullptr);
assert(lk0.owns_lock() == false);
-#endif // _LIBCPP_STD_VER > 11
}
diff --git a/test/std/thread/thread.mutex/thread.lock/thread.lock.shared/thread.lock.shared.cons/mutex.pass.cpp b/test/std/thread/thread.mutex/thread.lock/thread.lock.shared/thread.lock.shared.cons/mutex.pass.cpp
index c8a0287314bf..12bef34cf87b 100644
--- a/test/std/thread/thread.mutex/thread.lock/thread.lock.shared/thread.lock.shared.cons/mutex.pass.cpp
+++ b/test/std/thread/thread.mutex/thread.lock/thread.lock.shared/thread.lock.shared.cons/mutex.pass.cpp
@@ -8,6 +8,7 @@
//===----------------------------------------------------------------------===//
//
// UNSUPPORTED: libcpp-has-no-threads
+// UNSUPPORTED: c++98, c++03, c++11
// <shared_mutex>
@@ -21,9 +22,7 @@
#include <cstdlib>
#include <cassert>
-#if _LIBCPP_STD_VER > 11
-
-std::shared_timed_mutex m;
+#include "test_macros.h"
typedef std::chrono::system_clock Clock;
typedef Clock::time_point time_point;
@@ -31,6 +30,19 @@ typedef Clock::duration duration;
typedef std::chrono::milliseconds ms;
typedef std::chrono::nanoseconds ns;
+ms WaitTime = ms(250);
+
+// Thread sanitizer causes more overhead and will sometimes cause this test
+// to fail. To prevent this we give Thread sanitizer more time to complete the
+// test.
+#if !defined(TEST_HAS_SANITIZERS)
+ms Tolerance = ms(50);
+#else
+ms Tolerance = ms(50 * 5);
+#endif
+
+std::shared_timed_mutex m;
+
void f()
{
time_point t0 = Clock::now();
@@ -39,8 +51,8 @@ void f()
std::shared_lock<std::shared_timed_mutex> ul(m);
t1 = Clock::now();
}
- ns d = t1 - t0 - ms(250);
- assert(d < ms(50)); // within 50ms
+ ns d = t1 - t0 - WaitTime;
+ assert(d < Tolerance); // within tolerance
}
void g()
@@ -52,30 +64,30 @@ void g()
t1 = Clock::now();
}
ns d = t1 - t0;
- assert(d < ms(50)); // within 50ms
+ assert(d < Tolerance); // within tolerance
}
-#endif // _LIBCPP_STD_VER > 11
-
int main()
{
-#if _LIBCPP_STD_VER > 11
- m.lock();
std::vector<std::thread> v;
- for (int i = 0; i < 5; ++i)
- v.push_back(std::thread(f));
- std::this_thread::sleep_for(ms(250));
- m.unlock();
- for (auto& t : v)
- t.join();
- m.lock_shared();
- for (auto& t : v)
- t = std::thread(g);
- std::thread q(f);
- std::this_thread::sleep_for(ms(250));
- m.unlock_shared();
- for (auto& t : v)
- t.join();
- q.join();
-#endif // _LIBCPP_STD_VER > 11
+ {
+ m.lock();
+ for (int i = 0; i < 5; ++i)
+ v.push_back(std::thread(f));
+ std::this_thread::sleep_for(WaitTime);
+ m.unlock();
+ for (auto& t : v)
+ t.join();
+ }
+ {
+ m.lock_shared();
+ for (auto& t : v)
+ t = std::thread(g);
+ std::thread q(f);
+ std::this_thread::sleep_for(WaitTime);
+ m.unlock_shared();
+ for (auto& t : v)
+ t.join();
+ q.join();
+ }
}
diff --git a/test/std/thread/thread.mutex/thread.lock/thread.lock.shared/thread.lock.shared.cons/mutex_adopt_lock.pass.cpp b/test/std/thread/thread.mutex/thread.lock/thread.lock.shared/thread.lock.shared.cons/mutex_adopt_lock.pass.cpp
index 3b49b3029052..995210221065 100644
--- a/test/std/thread/thread.mutex/thread.lock/thread.lock.shared/thread.lock.shared.cons/mutex_adopt_lock.pass.cpp
+++ b/test/std/thread/thread.mutex/thread.lock/thread.lock.shared/thread.lock.shared.cons/mutex_adopt_lock.pass.cpp
@@ -8,6 +8,7 @@
//===----------------------------------------------------------------------===//
//
// UNSUPPORTED: libcpp-has-no-threads
+// UNSUPPORTED: c++98, c++03, c++11
// <shared_mutex>
@@ -20,11 +21,9 @@
int main()
{
-#if _LIBCPP_STD_VER > 11
std::shared_timed_mutex m;
m.lock_shared();
std::shared_lock<std::shared_timed_mutex> lk(m, std::adopt_lock);
assert(lk.mutex() == &m);
assert(lk.owns_lock() == true);
-#endif // _LIBCPP_STD_VER > 11
}
diff --git a/test/std/thread/thread.mutex/thread.lock/thread.lock.shared/thread.lock.shared.cons/mutex_defer_lock.pass.cpp b/test/std/thread/thread.mutex/thread.lock/thread.lock.shared/thread.lock.shared.cons/mutex_defer_lock.pass.cpp
index bbc38fcadb10..d81796b95bf3 100644
--- a/test/std/thread/thread.mutex/thread.lock/thread.lock.shared/thread.lock.shared.cons/mutex_defer_lock.pass.cpp
+++ b/test/std/thread/thread.mutex/thread.lock/thread.lock.shared/thread.lock.shared.cons/mutex_defer_lock.pass.cpp
@@ -8,6 +8,7 @@
//===----------------------------------------------------------------------===//
//
// UNSUPPORTED: libcpp-has-no-threads
+// UNSUPPORTED: c++98, c++03, c++11
// <shared_mutex>
@@ -20,10 +21,8 @@
int main()
{
-#if _LIBCPP_STD_VER > 11
std::shared_timed_mutex m;
std::shared_lock<std::shared_timed_mutex> lk(m, std::defer_lock);
assert(lk.mutex() == &m);
assert(lk.owns_lock() == false);
-#endif // _LIBCPP_STD_VER > 11
}
diff --git a/test/std/thread/thread.mutex/thread.lock/thread.lock.shared/thread.lock.shared.cons/mutex_duration.pass.cpp b/test/std/thread/thread.mutex/thread.lock/thread.lock.shared/thread.lock.shared.cons/mutex_duration.pass.cpp
index 9816e57f692a..84f868d6810b 100644
--- a/test/std/thread/thread.mutex/thread.lock/thread.lock.shared/thread.lock.shared.cons/mutex_duration.pass.cpp
+++ b/test/std/thread/thread.mutex/thread.lock/thread.lock.shared/thread.lock.shared.cons/mutex_duration.pass.cpp
@@ -8,6 +8,7 @@
//===----------------------------------------------------------------------===//
//
// UNSUPPORTED: libcpp-has-no-threads
+// UNSUPPORTED: c++98, c++03, c++11
// <shared_mutex>
@@ -22,7 +23,7 @@
#include <cstdlib>
#include <cassert>
-#if _LIBCPP_STD_VER > 11
+#include "test_macros.h"
std::shared_timed_mutex m;
@@ -32,37 +33,46 @@ typedef Clock::duration duration;
typedef std::chrono::milliseconds ms;
typedef std::chrono::nanoseconds ns;
+ms WaitTime = ms(250);
+
+// Thread sanitizer causes more overhead and will sometimes cause this test
+// to fail. To prevent this we give Thread sanitizer more time to complete the
+// test.
+#if !defined(TEST_HAS_SANITIZERS)
+ms Tolerance = ms(50);
+#else
+ms Tolerance = ms(50 * 5);
+#endif
+
+
void f1()
{
time_point t0 = Clock::now();
- std::shared_lock<std::shared_timed_mutex> lk(m, ms(300));
+ std::shared_lock<std::shared_timed_mutex> lk(m, WaitTime + Tolerance);
assert(lk.owns_lock() == true);
time_point t1 = Clock::now();
- ns d = t1 - t0 - ms(250);
- assert(d < ms(50)); // within 50ms
+ ns d = t1 - t0 - WaitTime;
+ assert(d < Tolerance); // within 50ms
}
void f2()
{
time_point t0 = Clock::now();
- std::shared_lock<std::shared_timed_mutex> lk(m, ms(250));
+ std::shared_lock<std::shared_timed_mutex> lk(m, WaitTime);
assert(lk.owns_lock() == false);
time_point t1 = Clock::now();
- ns d = t1 - t0 - ms(250);
- assert(d < ms(50)); // within 50ms
+ ns d = t1 - t0 - WaitTime;
+ assert(d < Tolerance); // within 50ms
}
-#endif // _LIBCPP_STD_VER > 11
-
int main()
{
-#if _LIBCPP_STD_VER > 11
{
m.lock();
std::vector<std::thread> v;
for (int i = 0; i < 5; ++i)
v.push_back(std::thread(f1));
- std::this_thread::sleep_for(ms(250));
+ std::this_thread::sleep_for(WaitTime);
m.unlock();
for (auto& t : v)
t.join();
@@ -72,10 +82,9 @@ int main()
std::vector<std::thread> v;
for (int i = 0; i < 5; ++i)
v.push_back(std::thread(f2));
- std::this_thread::sleep_for(ms(300));
+ std::this_thread::sleep_for(WaitTime + Tolerance);
m.unlock();
for (auto& t : v)
t.join();
}
-#endif // _LIBCPP_STD_VER > 11
}
diff --git a/test/std/thread/thread.mutex/thread.lock/thread.lock.shared/thread.lock.shared.cons/mutex_time_point.pass.cpp b/test/std/thread/thread.mutex/thread.lock/thread.lock.shared/thread.lock.shared.cons/mutex_time_point.pass.cpp
index 5d188ab06737..9359731486dd 100644
--- a/test/std/thread/thread.mutex/thread.lock/thread.lock.shared/thread.lock.shared.cons/mutex_time_point.pass.cpp
+++ b/test/std/thread/thread.mutex/thread.lock/thread.lock.shared/thread.lock.shared.cons/mutex_time_point.pass.cpp
@@ -8,6 +8,7 @@
//===----------------------------------------------------------------------===//
//
// UNSUPPORTED: libcpp-has-no-threads
+// UNSUPPORTED: c++98, c++03, c++11
// <shared_mutex>
@@ -22,7 +23,7 @@
#include <cstdlib>
#include <cassert>
-#if _LIBCPP_STD_VER > 11
+#include "test_macros.h"
std::shared_timed_mutex m;
@@ -32,37 +33,45 @@ typedef Clock::duration duration;
typedef std::chrono::milliseconds ms;
typedef std::chrono::nanoseconds ns;
+ms WaitTime = ms(250);
+
+// Thread sanitizer causes more overhead and will sometimes cause this test
+// to fail. To prevent this we give Thread sanitizer more time to complete the
+// test.
+#if !defined(TEST_HAS_SANITIZERS)
+ms Tolerance = ms(50);
+#else
+ms Tolerance = ms(50 * 5);
+#endif
+
void f1()
{
time_point t0 = Clock::now();
- std::shared_lock<std::shared_timed_mutex> lk(m, Clock::now() + ms(300));
+ std::shared_lock<std::shared_timed_mutex> lk(m, Clock::now() + WaitTime + Tolerance);
assert(lk.owns_lock() == true);
time_point t1 = Clock::now();
- ns d = t1 - t0 - ms(250);
- assert(d < ns(50000000)); // within 50ms
+ ns d = t1 - t0 - WaitTime;
+ assert(d < Tolerance); // within 50ms
}
void f2()
{
time_point t0 = Clock::now();
- std::shared_lock<std::shared_timed_mutex> lk(m, Clock::now() + ms(250));
+ std::shared_lock<std::shared_timed_mutex> lk(m, Clock::now() + WaitTime);
assert(lk.owns_lock() == false);
time_point t1 = Clock::now();
- ns d = t1 - t0 - ms(250);
- assert(d < ms(50)); // within 50ms
+ ns d = t1 - t0 - WaitTime;
+ assert(d < Tolerance); // within 50ms
}
-#endif // _LIBCPP_STD_VER > 11
-
int main()
{
-#if _LIBCPP_STD_VER > 11
{
m.lock();
std::vector<std::thread> v;
for (int i = 0; i < 5; ++i)
v.push_back(std::thread(f1));
- std::this_thread::sleep_for(ms(250));
+ std::this_thread::sleep_for(WaitTime);
m.unlock();
for (auto& t : v)
t.join();
@@ -72,10 +81,9 @@ int main()
std::vector<std::thread> v;
for (int i = 0; i < 5; ++i)
v.push_back(std::thread(f2));
- std::this_thread::sleep_for(ms(300));
+ std::this_thread::sleep_for(WaitTime + Tolerance);
m.unlock();
for (auto& t : v)
t.join();
}
-#endif // _LIBCPP_STD_VER > 11
}
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 f2d4e0deb73f..7f89f0af801f 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
@@ -8,6 +8,7 @@
//===----------------------------------------------------------------------===//
//
// UNSUPPORTED: libcpp-has-no-threads
+// UNSUPPORTED: c++98, c++03, c++11
// <shared_mutex>
@@ -21,8 +22,6 @@
#include <cstdlib>
#include <cassert>
-#if _LIBCPP_STD_VER > 11
-
std::shared_timed_mutex m;
typedef std::chrono::system_clock Clock;
@@ -57,11 +56,8 @@ void f()
assert(d < ms(200)); // within 200ms
}
-#endif // _LIBCPP_STD_VER > 11
-
int main()
{
-#if _LIBCPP_STD_VER > 11
m.lock();
std::vector<std::thread> v;
for (int i = 0; i < 5; ++i)
@@ -70,5 +66,4 @@ int main()
m.unlock();
for (auto& t : v)
t.join();
-#endif // _LIBCPP_STD_VER > 11
}
diff --git a/test/std/thread/thread.mutex/thread.lock/thread.lock.shared/thread.lock.shared.locking/lock.pass.cpp b/test/std/thread/thread.mutex/thread.lock/thread.lock.shared/thread.lock.shared.locking/lock.pass.cpp
index f1500652badd..5c3513c98e03 100644
--- a/test/std/thread/thread.mutex/thread.lock/thread.lock.shared/thread.lock.shared.locking/lock.pass.cpp
+++ b/test/std/thread/thread.mutex/thread.lock/thread.lock.shared/thread.lock.shared.locking/lock.pass.cpp
@@ -7,7 +7,9 @@
//
//===----------------------------------------------------------------------===//
//
+// XFAIL: libcpp-no-exceptions
// UNSUPPORTED: libcpp-has-no-threads
+// UNSUPPORTED: c++98, c++03, c++11
// <shared_mutex>
@@ -21,7 +23,7 @@
#include <cstdlib>
#include <cassert>
-#if _LIBCPP_STD_VER > 11
+#include "test_macros.h"
std::shared_timed_mutex m;
@@ -31,6 +33,18 @@ typedef Clock::duration duration;
typedef std::chrono::milliseconds ms;
typedef std::chrono::nanoseconds ns;
+ms WaitTime = ms(250);
+
+// Thread sanitizer causes more overhead and will sometimes cause this test
+// to fail. To prevent this we give Thread sanitizer more time to complete the
+// test.
+#if !defined(TEST_HAS_SANITIZERS)
+ms Tolerance = ms(25);
+#else
+ms Tolerance = ms(25 * 5);
+#endif
+
+
void f()
{
std::shared_lock<std::shared_timed_mutex> lk(m, std::defer_lock);
@@ -38,8 +52,8 @@ void f()
lk.lock();
time_point t1 = Clock::now();
assert(lk.owns_lock() == true);
- ns d = t1 - t0 - ms(250);
- assert(d < ms(25)); // within 25ms
+ ns d = t1 - t0 - WaitTime;
+ assert(d < Tolerance); // within tolerance
try
{
lk.lock();
@@ -62,18 +76,14 @@ void f()
}
}
-#endif // _LIBCPP_STD_VER > 11
-
int main()
{
-#if _LIBCPP_STD_VER > 11
m.lock();
std::vector<std::thread> v;
for (int i = 0; i < 5; ++i)
v.push_back(std::thread(f));
- std::this_thread::sleep_for(ms(250));
+ std::this_thread::sleep_for(WaitTime);
m.unlock();
for (auto& t : v)
t.join();
-#endif // _LIBCPP_STD_VER > 11
}
diff --git a/test/std/thread/thread.mutex/thread.lock/thread.lock.shared/thread.lock.shared.locking/try_lock.pass.cpp b/test/std/thread/thread.mutex/thread.lock/thread.lock.shared/thread.lock.shared.locking/try_lock.pass.cpp
index 82b1ff865053..01693c77ea39 100644
--- a/test/std/thread/thread.mutex/thread.lock/thread.lock.shared/thread.lock.shared.locking/try_lock.pass.cpp
+++ b/test/std/thread/thread.mutex/thread.lock/thread.lock.shared/thread.lock.shared.locking/try_lock.pass.cpp
@@ -7,7 +7,9 @@
//
//===----------------------------------------------------------------------===//
//
+// XFAIL: libcpp-no-exceptions
// UNSUPPORTED: libcpp-has-no-threads
+// UNSUPPORTED: c++98, c++03, c++11
// <shared_mutex>
@@ -18,8 +20,6 @@
#include <shared_mutex>
#include <cassert>
-#if _LIBCPP_STD_VER > 11
-
bool try_lock_called = false;
struct mutex
@@ -34,11 +34,9 @@ struct mutex
mutex m;
-#endif // _LIBCPP_STD_VER > 11
-
int main()
{
-#if _LIBCPP_STD_VER > 11
+
std::shared_lock<mutex> lk(m, std::defer_lock);
assert(lk.try_lock() == true);
assert(try_lock_called == true);
@@ -66,5 +64,4 @@ int main()
{
assert(e.code().value() == EPERM);
}
-#endif // _LIBCPP_STD_VER > 11
}
diff --git a/test/std/thread/thread.mutex/thread.lock/thread.lock.shared/thread.lock.shared.locking/try_lock_for.pass.cpp b/test/std/thread/thread.mutex/thread.lock/thread.lock.shared/thread.lock.shared.locking/try_lock_for.pass.cpp
index 5867465a6626..852a94eb65ec 100644
--- a/test/std/thread/thread.mutex/thread.lock/thread.lock.shared/thread.lock.shared.locking/try_lock_for.pass.cpp
+++ b/test/std/thread/thread.mutex/thread.lock/thread.lock.shared/thread.lock.shared.locking/try_lock_for.pass.cpp
@@ -7,7 +7,9 @@
//
//===----------------------------------------------------------------------===//
//
+// XFAIL: libcpp-no-exceptions
// UNSUPPORTED: libcpp-has-no-threads
+// UNSUPPORTED: c++98, c++03, c++11
// <shared_mutex>
@@ -19,8 +21,6 @@
#include <shared_mutex>
#include <cassert>
-#if _LIBCPP_STD_VER > 11
-
bool try_lock_for_called = false;
typedef std::chrono::milliseconds ms;
@@ -39,11 +39,8 @@ struct mutex
mutex m;
-#endif // _LIBCPP_STD_VER > 11
-
int main()
{
-#if _LIBCPP_STD_VER > 11
std::shared_lock<mutex> lk(m, std::defer_lock);
assert(lk.try_lock_for(ms(5)) == true);
assert(try_lock_for_called == true);
@@ -71,5 +68,4 @@ int main()
{
assert(e.code().value() == EPERM);
}
-#endif // _LIBCPP_STD_VER > 11
}
diff --git a/test/std/thread/thread.mutex/thread.lock/thread.lock.shared/thread.lock.shared.locking/try_lock_until.pass.cpp b/test/std/thread/thread.mutex/thread.lock/thread.lock.shared/thread.lock.shared.locking/try_lock_until.pass.cpp
index 9d38983be724..31574afd7d8f 100644
--- a/test/std/thread/thread.mutex/thread.lock/thread.lock.shared/thread.lock.shared.locking/try_lock_until.pass.cpp
+++ b/test/std/thread/thread.mutex/thread.lock/thread.lock.shared/thread.lock.shared.locking/try_lock_until.pass.cpp
@@ -7,7 +7,9 @@
//
//===----------------------------------------------------------------------===//
//
+// XFAIL: libcpp-no-exceptions
// UNSUPPORTED: libcpp-has-no-threads
+// UNSUPPORTED: c++98, c++03, c++11
// <shared_mutex>
@@ -19,8 +21,6 @@
#include <shared_mutex>
#include <cassert>
-#if _LIBCPP_STD_VER > 11
-
bool try_lock_until_called = false;
struct mutex
@@ -38,11 +38,8 @@ struct mutex
mutex m;
-#endif // _LIBCPP_STD_VER > 11
-
int main()
{
-#if _LIBCPP_STD_VER > 11
typedef std::chrono::steady_clock Clock;
std::shared_lock<mutex> lk(m, std::defer_lock);
assert(lk.try_lock_until(Clock::now()) == true);
@@ -71,5 +68,4 @@ int main()
{
assert(e.code().value() == EPERM);
}
-#endif // _LIBCPP_STD_VER > 11
}
diff --git a/test/std/thread/thread.mutex/thread.lock/thread.lock.shared/thread.lock.shared.locking/unlock.pass.cpp b/test/std/thread/thread.mutex/thread.lock/thread.lock.shared/thread.lock.shared.locking/unlock.pass.cpp
index eb08a45cde6e..6a7385ed42a6 100644
--- a/test/std/thread/thread.mutex/thread.lock/thread.lock.shared/thread.lock.shared.locking/unlock.pass.cpp
+++ b/test/std/thread/thread.mutex/thread.lock/thread.lock.shared/thread.lock.shared.locking/unlock.pass.cpp
@@ -7,7 +7,9 @@
//
//===----------------------------------------------------------------------===//
//
+// XFAIL: libcpp-no-exceptions
// UNSUPPORTED: libcpp-has-no-threads
+// UNSUPPORTED: c++98, c++03, c++11
// <shared_mutex>
@@ -18,8 +20,6 @@
#include <shared_mutex>
#include <cassert>
-#if _LIBCPP_STD_VER > 11
-
bool unlock_called = false;
struct mutex
@@ -30,11 +30,8 @@ struct mutex
mutex m;
-#endif // _LIBCPP_STD_VER > 11
-
int main()
{
-#if _LIBCPP_STD_VER > 11
std::shared_lock<mutex> lk(m);
lk.unlock();
assert(unlock_called == true);
@@ -58,5 +55,4 @@ int main()
{
assert(e.code().value() == EPERM);
}
-#endif // _LIBCPP_STD_VER > 11
}
diff --git a/test/std/thread/thread.mutex/thread.lock/thread.lock.shared/thread.lock.shared.mod/member_swap.pass.cpp b/test/std/thread/thread.mutex/thread.lock/thread.lock.shared/thread.lock.shared.mod/member_swap.pass.cpp
index 8505763e44bc..23a0c7030d76 100644
--- a/test/std/thread/thread.mutex/thread.lock/thread.lock.shared/thread.lock.shared.mod/member_swap.pass.cpp
+++ b/test/std/thread/thread.mutex/thread.lock/thread.lock.shared/thread.lock.shared.mod/member_swap.pass.cpp
@@ -8,6 +8,7 @@
//===----------------------------------------------------------------------===//
//
// UNSUPPORTED: libcpp-has-no-threads
+// UNSUPPORTED: c++98, c++03, c++11
// <shared_mutex>
@@ -18,8 +19,6 @@
#include <shared_mutex>
#include <cassert>
-#if _LIBCPP_STD_VER > 11
-
struct mutex
{
void lock_shared() {}
@@ -28,11 +27,8 @@ struct mutex
mutex m;
-#endif // _LIBCPP_STD_VER > 11
-
int main()
{
-#if _LIBCPP_STD_VER > 11
std::shared_lock<mutex> lk1(m);
std::shared_lock<mutex> lk2;
lk1.swap(lk2);
@@ -41,5 +37,4 @@ int main()
assert(lk2.mutex() == &m);
assert(lk2.owns_lock() == true);
static_assert(noexcept(lk1.swap(lk2)), "member swap must be noexcept");
-#endif // _LIBCPP_STD_VER > 11
}
diff --git a/test/std/thread/thread.mutex/thread.lock/thread.lock.shared/thread.lock.shared.mod/nonmember_swap.pass.cpp b/test/std/thread/thread.mutex/thread.lock/thread.lock.shared/thread.lock.shared.mod/nonmember_swap.pass.cpp
index 057dbc4cd3b7..0f19174d51f0 100644
--- a/test/std/thread/thread.mutex/thread.lock/thread.lock.shared/thread.lock.shared.mod/nonmember_swap.pass.cpp
+++ b/test/std/thread/thread.mutex/thread.lock/thread.lock.shared/thread.lock.shared.mod/nonmember_swap.pass.cpp
@@ -8,6 +8,7 @@
//===----------------------------------------------------------------------===//
//
// UNSUPPORTED: libcpp-has-no-threads
+// UNSUPPORTED: c++98, c++03, c++11
// <shared_mutex>
@@ -19,8 +20,6 @@
#include <shared_mutex>
#include <cassert>
-#if _LIBCPP_STD_VER > 11
-
struct mutex
{
void lock_shared() {}
@@ -29,11 +28,8 @@ struct mutex
mutex m;
-#endif // _LIBCPP_STD_VER > 11
-
int main()
{
-#if _LIBCPP_STD_VER > 11
std::shared_lock<mutex> lk1(m);
std::shared_lock<mutex> lk2;
swap(lk1, lk2);
@@ -42,5 +38,4 @@ int main()
assert(lk2.mutex() == &m);
assert(lk2.owns_lock() == true);
static_assert(noexcept(swap(lk1, lk2)), "non-member swap must be noexcept");
-#endif // _LIBCPP_STD_VER > 11
}
diff --git a/test/std/thread/thread.mutex/thread.lock/thread.lock.shared/thread.lock.shared.mod/release.pass.cpp b/test/std/thread/thread.mutex/thread.lock/thread.lock.shared/thread.lock.shared.mod/release.pass.cpp
index 65ddca624725..2b5f8c1f1658 100644
--- a/test/std/thread/thread.mutex/thread.lock/thread.lock.shared/thread.lock.shared.mod/release.pass.cpp
+++ b/test/std/thread/thread.mutex/thread.lock/thread.lock.shared/thread.lock.shared.mod/release.pass.cpp
@@ -8,6 +8,7 @@
//===----------------------------------------------------------------------===//
//
// UNSUPPORTED: libcpp-has-no-threads
+// UNSUPPORTED: c++98, c++03, c++11
// <shared_mutex>
@@ -18,8 +19,6 @@
#include <shared_mutex>
#include <cassert>
-#if _LIBCPP_STD_VER > 11
-
struct mutex
{
static int lock_count;
@@ -33,11 +32,8 @@ int mutex::unlock_count = 0;
mutex m;
-#endif // _LIBCPP_STD_VER > 11
-
int main()
{
-#if _LIBCPP_STD_VER > 11
std::shared_lock<mutex> lk(m);
assert(lk.mutex() == &m);
assert(lk.owns_lock() == true);
@@ -49,5 +45,4 @@ int main()
assert(mutex::lock_count == 1);
assert(mutex::unlock_count == 0);
static_assert(noexcept(lk.release()), "release must be noexcept");
-#endif // _LIBCPP_STD_VER > 11
}
diff --git a/test/std/thread/thread.mutex/thread.lock/thread.lock.shared/thread.lock.shared.obs/mutex.pass.cpp b/test/std/thread/thread.mutex/thread.lock/thread.lock.shared/thread.lock.shared.obs/mutex.pass.cpp
index 4eb75d8f050e..711ab7c6fca0 100644
--- a/test/std/thread/thread.mutex/thread.lock/thread.lock.shared/thread.lock.shared.obs/mutex.pass.cpp
+++ b/test/std/thread/thread.mutex/thread.lock/thread.lock.shared/thread.lock.shared.obs/mutex.pass.cpp
@@ -8,6 +8,7 @@
//===----------------------------------------------------------------------===//
//
// UNSUPPORTED: libcpp-has-no-threads
+// UNSUPPORTED: c++98, c++03, c++11
// <shared_mutex>
@@ -18,15 +19,10 @@
#include <shared_mutex>
#include <cassert>
-#if _LIBCPP_STD_VER > 11
-
std::shared_timed_mutex m;
-#endif // _LIBCPP_STD_VER > 11
-
int main()
{
-#if _LIBCPP_STD_VER > 11
std::shared_lock<std::shared_timed_mutex> lk0;
assert(lk0.mutex() == nullptr);
std::shared_lock<std::shared_timed_mutex> lk1(m);
@@ -34,5 +30,4 @@ int main()
lk1.unlock();
assert(lk1.mutex() == &m);
static_assert(noexcept(lk0.mutex()), "mutex() must be noexcept");
-#endif // _LIBCPP_STD_VER > 11
}
diff --git a/test/std/thread/thread.mutex/thread.lock/thread.lock.shared/thread.lock.shared.obs/op_bool.pass.cpp b/test/std/thread/thread.mutex/thread.lock/thread.lock.shared/thread.lock.shared.obs/op_bool.pass.cpp
index d079d2d8b03a..3f6ad2b555a3 100644
--- a/test/std/thread/thread.mutex/thread.lock/thread.lock.shared/thread.lock.shared.obs/op_bool.pass.cpp
+++ b/test/std/thread/thread.mutex/thread.lock/thread.lock.shared/thread.lock.shared.obs/op_bool.pass.cpp
@@ -8,6 +8,7 @@
//===----------------------------------------------------------------------===//
//
// UNSUPPORTED: libcpp-has-no-threads
+// UNSUPPORTED: c++98, c++03, c++11
// <shared_mutex>
@@ -18,15 +19,10 @@
#include <shared_mutex>
#include <cassert>
-#if _LIBCPP_STD_VER > 11
-
std::shared_timed_mutex m;
-#endif // _LIBCPP_STD_VER > 11
-
int main()
{
-#if _LIBCPP_STD_VER > 11
std::shared_lock<std::shared_timed_mutex> lk0;
assert(static_cast<bool>(lk0) == false);
std::shared_lock<std::shared_timed_mutex> lk1(m);
@@ -34,5 +30,4 @@ int main()
lk1.unlock();
assert(static_cast<bool>(lk1) == false);
static_assert(noexcept(static_cast<bool>(lk0)), "explicit operator bool() must be noexcept");
-#endif // _LIBCPP_STD_VER > 11
}
diff --git a/test/std/thread/thread.mutex/thread.lock/thread.lock.shared/thread.lock.shared.obs/owns_lock.pass.cpp b/test/std/thread/thread.mutex/thread.lock/thread.lock.shared/thread.lock.shared.obs/owns_lock.pass.cpp
index d64b0aa6a736..5ab3ac009fe1 100644
--- a/test/std/thread/thread.mutex/thread.lock/thread.lock.shared/thread.lock.shared.obs/owns_lock.pass.cpp
+++ b/test/std/thread/thread.mutex/thread.lock/thread.lock.shared/thread.lock.shared.obs/owns_lock.pass.cpp
@@ -8,6 +8,7 @@
//===----------------------------------------------------------------------===//
//
// UNSUPPORTED: libcpp-has-no-threads
+// UNSUPPORTED: c++98, c++03, c++11
// <shared_mutex>
@@ -18,15 +19,10 @@
#include <shared_mutex>
#include <cassert>
-#if _LIBCPP_STD_VER > 11
-
std::shared_timed_mutex m;
-#endif // _LIBCPP_STD_VER > 11
-
int main()
{
-#if _LIBCPP_STD_VER > 11
std::shared_lock<std::shared_timed_mutex> lk0;
assert(lk0.owns_lock() == false);
std::shared_lock<std::shared_timed_mutex> lk1(m);
@@ -34,5 +30,4 @@ int main()
lk1.unlock();
assert(lk1.owns_lock() == false);
static_assert(noexcept(lk0.owns_lock()), "owns_lock must be noexcept");
-#endif // _LIBCPP_STD_VER > 11
}
diff --git a/test/std/thread/thread.mutex/thread.lock/thread.lock.shared/types.pass.cpp b/test/std/thread/thread.mutex/thread.lock/thread.lock.shared/types.pass.cpp
index c153b455f404..f555d3de5ee0 100644
--- a/test/std/thread/thread.mutex/thread.lock/thread.lock.shared/types.pass.cpp
+++ b/test/std/thread/thread.mutex/thread.lock/thread.lock.shared/types.pass.cpp
@@ -8,6 +8,8 @@
//===----------------------------------------------------------------------===//
//
// UNSUPPORTED: libcpp-has-no-threads
+// UNSUPPORTED: c++98, c++03, c++11
+
// <shared_mutex>
@@ -24,8 +26,6 @@
int main()
{
-#if _LIBCPP_STD_VER > 11
static_assert((std::is_same<std::shared_lock<std::mutex>::mutex_type,
std::mutex>::value), "");
-#endif // _LIBCPP_STD_VER > 11
}
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 f5408df98199..6ce33761068f 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
@@ -7,6 +7,7 @@
//
//===----------------------------------------------------------------------===//
//
+// XFAIL: libcpp-no-exceptions
// UNSUPPORTED: libcpp-has-no-threads
// <mutex>
diff --git a/test/std/thread/thread.mutex/thread.lock/thread.lock.unique/thread.lock.unique.locking/try_lock.pass.cpp b/test/std/thread/thread.mutex/thread.lock/thread.lock.unique/thread.lock.unique.locking/try_lock.pass.cpp
index bd88577f0a22..27d0562de31f 100644
--- a/test/std/thread/thread.mutex/thread.lock/thread.lock.unique/thread.lock.unique.locking/try_lock.pass.cpp
+++ b/test/std/thread/thread.mutex/thread.lock/thread.lock.unique/thread.lock.unique.locking/try_lock.pass.cpp
@@ -7,6 +7,7 @@
//
//===----------------------------------------------------------------------===//
//
+// XFAIL: libcpp-no-exceptions
// UNSUPPORTED: libcpp-has-no-threads
// <mutex>
diff --git a/test/std/thread/thread.mutex/thread.lock/thread.lock.unique/thread.lock.unique.locking/try_lock_for.pass.cpp b/test/std/thread/thread.mutex/thread.lock/thread.lock.unique/thread.lock.unique.locking/try_lock_for.pass.cpp
index 558f079463a4..6f0a7219d2d8 100644
--- a/test/std/thread/thread.mutex/thread.lock/thread.lock.unique/thread.lock.unique.locking/try_lock_for.pass.cpp
+++ b/test/std/thread/thread.mutex/thread.lock/thread.lock.unique/thread.lock.unique.locking/try_lock_for.pass.cpp
@@ -7,6 +7,7 @@
//
//===----------------------------------------------------------------------===//
//
+// XFAIL: libcpp-no-exceptions
// UNSUPPORTED: libcpp-has-no-threads
// <mutex>
diff --git a/test/std/thread/thread.mutex/thread.lock/thread.lock.unique/thread.lock.unique.locking/try_lock_until.pass.cpp b/test/std/thread/thread.mutex/thread.lock/thread.lock.unique/thread.lock.unique.locking/try_lock_until.pass.cpp
index 24e4d109a097..b7e87249b596 100644
--- a/test/std/thread/thread.mutex/thread.lock/thread.lock.unique/thread.lock.unique.locking/try_lock_until.pass.cpp
+++ b/test/std/thread/thread.mutex/thread.lock/thread.lock.unique/thread.lock.unique.locking/try_lock_until.pass.cpp
@@ -7,6 +7,7 @@
//
//===----------------------------------------------------------------------===//
//
+// XFAIL: libcpp-no-exceptions
// UNSUPPORTED: libcpp-has-no-threads
// <mutex>
diff --git a/test/std/thread/thread.mutex/thread.lock/thread.lock.unique/thread.lock.unique.locking/unlock.pass.cpp b/test/std/thread/thread.mutex/thread.lock/thread.lock.unique/thread.lock.unique.locking/unlock.pass.cpp
index bbabfc41df11..62497c9ec45a 100644
--- a/test/std/thread/thread.mutex/thread.lock/thread.lock.unique/thread.lock.unique.locking/unlock.pass.cpp
+++ b/test/std/thread/thread.mutex/thread.lock/thread.lock.unique/thread.lock.unique.locking/unlock.pass.cpp
@@ -7,6 +7,7 @@
//
//===----------------------------------------------------------------------===//
//
+// XFAIL: libcpp-no-exceptions
// UNSUPPORTED: libcpp-has-no-threads
// <mutex>
diff --git a/test/std/thread/thread.mutex/thread.mutex.requirements/thread.shared_mutex.requirements/thread.shared_mutex.class/assign.fail.cpp b/test/std/thread/thread.mutex/thread.mutex.requirements/thread.shared_mutex.requirements/thread.shared_mutex.class/assign.fail.cpp
index 7bcb2d61379a..5c67a34ab52b 100644
--- a/test/std/thread/thread.mutex/thread.mutex.requirements/thread.shared_mutex.requirements/thread.shared_mutex.class/assign.fail.cpp
+++ b/test/std/thread/thread.mutex/thread.mutex.requirements/thread.shared_mutex.requirements/thread.shared_mutex.class/assign.fail.cpp
@@ -6,6 +6,8 @@
// Source Licenses. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
+//
+// UNSUPPORTED: c++98, c++03, c++11, c++14
// <shared_mutex>
@@ -15,15 +17,9 @@
#include <shared_mutex>
-#include "test_macros.h"
-
int main()
{
-#if TEST_STD_VER > 14
std::shared_mutex m0;
std::shared_mutex m1;
- m1 = m0;
-#else
-# error
-#endif
+ m1 = m0; // expected-error {{overload resolution selected deleted operator '='}}
}
diff --git a/test/std/thread/thread.mutex/thread.mutex.requirements/thread.shared_mutex.requirements/thread.shared_mutex.class/copy.fail.cpp b/test/std/thread/thread.mutex/thread.mutex.requirements/thread.shared_mutex.requirements/thread.shared_mutex.class/copy.fail.cpp
index af064aeee26c..c7cac6041c82 100644
--- a/test/std/thread/thread.mutex/thread.mutex.requirements/thread.shared_mutex.requirements/thread.shared_mutex.class/copy.fail.cpp
+++ b/test/std/thread/thread.mutex/thread.mutex.requirements/thread.shared_mutex.requirements/thread.shared_mutex.class/copy.fail.cpp
@@ -6,6 +6,8 @@
// Source Licenses. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
+//
+// UNSUPPORTED: c++98, c++03, c++11, c++14
// <shared_mutex>
@@ -15,14 +17,8 @@
#include <shared_mutex>
-#include "test_macros.h"
-
int main()
{
-#if TEST_STD_VER > 14
std::shared_mutex m0;
- std::shared_mutex m1(m0);
-#else
-# error
-#endif
+ std::shared_mutex m1(m0); // expected-error {{call to deleted constructor of 'std::shared_mutex'}}
}
diff --git a/test/std/thread/thread.mutex/thread.mutex.requirements/thread.shared_mutex.requirements/thread.shared_mutex.class/lock.pass.cpp b/test/std/thread/thread.mutex/thread.mutex.requirements/thread.shared_mutex.requirements/thread.shared_mutex.class/lock.pass.cpp
index 9bf7a79e3400..75ddebff0ed9 100644
--- a/test/std/thread/thread.mutex/thread.mutex.requirements/thread.shared_mutex.requirements/thread.shared_mutex.class/lock.pass.cpp
+++ b/test/std/thread/thread.mutex/thread.mutex.requirements/thread.shared_mutex.requirements/thread.shared_mutex.class/lock.pass.cpp
@@ -21,6 +21,7 @@
#include <cstdlib>
#include <cassert>
+#include "test_macros.h"
std::shared_mutex m;
@@ -30,21 +31,32 @@ typedef Clock::duration duration;
typedef std::chrono::milliseconds ms;
typedef std::chrono::nanoseconds ns;
+ms WaitTime = ms(250);
+
+// Thread sanitizer causes more overhead and will sometimes cause this test
+// to fail. To prevent this we give Thread sanitizer more time to complete the
+// test.
+#if !defined(TEST_HAS_SANITIZERS)
+ms Tolerance = ms(50);
+#else
+ms Tolerance = ms(50 * 5);
+#endif
+
void f()
{
time_point t0 = Clock::now();
m.lock();
time_point t1 = Clock::now();
m.unlock();
- ns d = t1 - t0 - ms(250);
- assert(d < ms(50)); // within 50ms
+ ns d = t1 - t0 - WaitTime;
+ assert(d < Tolerance); // within tolerance
}
int main()
{
m.lock();
std::thread t(f);
- std::this_thread::sleep_for(ms(250));
+ std::this_thread::sleep_for(WaitTime);
m.unlock();
t.join();
}
diff --git a/test/std/thread/thread.mutex/thread.mutex.requirements/thread.shared_mutex.requirements/thread.shared_mutex.class/lock_shared.pass.cpp b/test/std/thread/thread.mutex/thread.mutex.requirements/thread.shared_mutex.requirements/thread.shared_mutex.class/lock_shared.pass.cpp
index 3ffa9e2d0065..6b5089d38859 100644
--- a/test/std/thread/thread.mutex/thread.mutex.requirements/thread.shared_mutex.requirements/thread.shared_mutex.class/lock_shared.pass.cpp
+++ b/test/std/thread/thread.mutex/thread.mutex.requirements/thread.shared_mutex.requirements/thread.shared_mutex.class/lock_shared.pass.cpp
@@ -22,6 +22,8 @@
#include <cstdlib>
#include <cassert>
+#include "test_macros.h"
+
std::shared_mutex m;
typedef std::chrono::system_clock Clock;
@@ -30,14 +32,25 @@ typedef Clock::duration duration;
typedef std::chrono::milliseconds ms;
typedef std::chrono::nanoseconds ns;
+ms WaitTime = ms(250);
+
+// Thread sanitizer causes more overhead and will sometimes cause this test
+// to fail. To prevent this we give Thread sanitizer more time to complete the
+// test.
+#if !defined(TEST_HAS_SANITIZERS)
+ms Tolerance = ms(50);
+#else
+ms Tolerance = ms(50 * 5);
+#endif
+
void f()
{
time_point t0 = Clock::now();
m.lock_shared();
time_point t1 = Clock::now();
m.unlock_shared();
- ns d = t1 - t0 - ms(250);
- assert(d < ms(50)); // within 50ms
+ ns d = t1 - t0 - WaitTime;
+ assert(d < Tolerance); // within tolerance
}
void g()
@@ -47,7 +60,7 @@ void g()
time_point t1 = Clock::now();
m.unlock_shared();
ns d = t1 - t0;
- assert(d < ms(50)); // within 50ms
+ assert(d < Tolerance); // within tolerance
}
@@ -57,7 +70,7 @@ int main()
std::vector<std::thread> v;
for (int i = 0; i < 5; ++i)
v.push_back(std::thread(f));
- std::this_thread::sleep_for(ms(250));
+ std::this_thread::sleep_for(WaitTime);
m.unlock();
for (auto& t : v)
t.join();
@@ -65,7 +78,7 @@ int main()
for (auto& t : v)
t = std::thread(g);
std::thread q(f);
- std::this_thread::sleep_for(ms(250));
+ std::this_thread::sleep_for(WaitTime);
m.unlock_shared();
for (auto& t : v)
t.join();
diff --git a/test/std/thread/thread.mutex/thread.mutex.requirements/thread.sharedtimedmutex.requirements/thread.sharedtimedmutex.class/lock.pass.cpp b/test/std/thread/thread.mutex/thread.mutex.requirements/thread.sharedtimedmutex.requirements/thread.sharedtimedmutex.class/lock.pass.cpp
index 62bb736837ea..2818bd617542 100644
--- a/test/std/thread/thread.mutex/thread.mutex.requirements/thread.sharedtimedmutex.requirements/thread.sharedtimedmutex.class/lock.pass.cpp
+++ b/test/std/thread/thread.mutex/thread.mutex.requirements/thread.sharedtimedmutex.requirements/thread.sharedtimedmutex.class/lock.pass.cpp
@@ -21,6 +21,8 @@
#include <cstdlib>
#include <cassert>
+#include "test_macros.h"
+
std::shared_timed_mutex m;
typedef std::chrono::system_clock Clock;
@@ -29,6 +31,19 @@ typedef Clock::duration duration;
typedef std::chrono::milliseconds ms;
typedef std::chrono::nanoseconds ns;
+
+ms WaitTime = ms(250);
+
+// Thread sanitizer causes more overhead and will sometimes cause this test
+// to fail. To prevent this we give Thread sanitizer more time to complete the
+// test.
+#if !TEST_HAS_FEATURE(thread_sanitizer)
+ms Tolerance = ms(50);
+#else
+ms Tolerance = ms(100);
+#endif
+
+
void f()
{
time_point t0 = Clock::now();
diff --git a/test/std/thread/thread.mutex/thread.mutex.requirements/thread.sharedtimedmutex.requirements/thread.sharedtimedmutex.class/lock_shared.pass.cpp b/test/std/thread/thread.mutex/thread.mutex.requirements/thread.sharedtimedmutex.requirements/thread.sharedtimedmutex.class/lock_shared.pass.cpp
index 8fc6299f1b8f..77a9107de923 100644
--- a/test/std/thread/thread.mutex/thread.mutex.requirements/thread.sharedtimedmutex.requirements/thread.sharedtimedmutex.class/lock_shared.pass.cpp
+++ b/test/std/thread/thread.mutex/thread.mutex.requirements/thread.sharedtimedmutex.requirements/thread.sharedtimedmutex.class/lock_shared.pass.cpp
@@ -22,6 +22,8 @@
#include <cstdlib>
#include <cassert>
+#include "test_macros.h"
+
std::shared_timed_mutex m;
typedef std::chrono::system_clock Clock;
@@ -30,14 +32,27 @@ typedef Clock::duration duration;
typedef std::chrono::milliseconds ms;
typedef std::chrono::nanoseconds ns;
+
+ms WaitTime = ms(250);
+
+// Thread sanitizer causes more overhead and will sometimes cause this test
+// to fail. To prevent this we give Thread sanitizer more time to complete the
+// test.
+#if !defined(TEST_HAS_SANITIZERS)
+ms Tolerance = ms(50);
+#else
+ms Tolerance = ms(50 * 5);
+#endif
+
+
void f()
{
time_point t0 = Clock::now();
m.lock_shared();
time_point t1 = Clock::now();
m.unlock_shared();
- ns d = t1 - t0 - ms(250);
- assert(d < ms(50)); // within 50ms
+ ns d = t1 - t0 - WaitTime;
+ assert(d < Tolerance); // within tolerance
}
void g()
@@ -47,7 +62,7 @@ void g()
time_point t1 = Clock::now();
m.unlock_shared();
ns d = t1 - t0;
- assert(d < ms(50)); // within 50ms
+ assert(d < Tolerance); // within tolerance
}
@@ -57,7 +72,7 @@ int main()
std::vector<std::thread> v;
for (int i = 0; i < 5; ++i)
v.push_back(std::thread(f));
- std::this_thread::sleep_for(ms(250));
+ std::this_thread::sleep_for(WaitTime);
m.unlock();
for (auto& t : v)
t.join();
@@ -65,7 +80,7 @@ int main()
for (auto& t : v)
t = std::thread(g);
std::thread q(f);
- std::this_thread::sleep_for(ms(250));
+ std::this_thread::sleep_for(WaitTime);
m.unlock_shared();
for (auto& t : v)
t.join();
diff --git a/test/std/thread/thread.mutex/thread.mutex.requirements/thread.sharedtimedmutex.requirements/thread.sharedtimedmutex.class/try_lock_for.pass.cpp b/test/std/thread/thread.mutex/thread.mutex.requirements/thread.sharedtimedmutex.requirements/thread.sharedtimedmutex.class/try_lock_for.pass.cpp
index ab20241895ba..320a268ae77d 100644
--- a/test/std/thread/thread.mutex/thread.mutex.requirements/thread.sharedtimedmutex.requirements/thread.sharedtimedmutex.class/try_lock_for.pass.cpp
+++ b/test/std/thread/thread.mutex/thread.mutex.requirements/thread.sharedtimedmutex.requirements/thread.sharedtimedmutex.class/try_lock_for.pass.cpp
@@ -22,6 +22,8 @@
#include <cstdlib>
#include <cassert>
+#include "test_macros.h"
+
std::shared_timed_mutex m;
typedef std::chrono::steady_clock Clock;
@@ -30,23 +32,35 @@ typedef Clock::duration duration;
typedef std::chrono::milliseconds ms;
typedef std::chrono::nanoseconds ns;
+
+ms WaitTime = ms(250);
+
+// Thread sanitizer causes more overhead and will sometimes cause this test
+// to fail. To prevent this we give Thread sanitizer more time to complete the
+// test.
+#if !defined(TEST_HAS_SANITIZERS)
+ms Tolerance = ms(50);
+#else
+ms Tolerance = ms(50 * 5);
+#endif
+
void f1()
{
time_point t0 = Clock::now();
- assert(m.try_lock_for(ms(300)) == true);
+ assert(m.try_lock_for(WaitTime + Tolerance) == true);
time_point t1 = Clock::now();
m.unlock();
- ns d = t1 - t0 - ms(250);
- assert(d < ms(50)); // within 50ms
+ ns d = t1 - t0 - WaitTime;
+ assert(d < Tolerance); // within tolerance
}
void f2()
{
time_point t0 = Clock::now();
- assert(m.try_lock_for(ms(250)) == false);
+ assert(m.try_lock_for(WaitTime) == false);
time_point t1 = Clock::now();
- ns d = t1 - t0 - ms(250);
- assert(d < ms(50)); // within 50ms
+ ns d = t1 - t0 - WaitTime;
+ assert(d < Tolerance); // within tolerance
}
int main()
@@ -54,14 +68,14 @@ int main()
{
m.lock();
std::thread t(f1);
- std::this_thread::sleep_for(ms(250));
+ std::this_thread::sleep_for(WaitTime);
m.unlock();
t.join();
}
{
m.lock();
std::thread t(f2);
- std::this_thread::sleep_for(ms(300));
+ std::this_thread::sleep_for(WaitTime + Tolerance);
m.unlock();
t.join();
}
diff --git a/test/std/thread/thread.mutex/thread.mutex.requirements/thread.sharedtimedmutex.requirements/thread.sharedtimedmutex.class/try_lock_shared.pass.cpp b/test/std/thread/thread.mutex/thread.mutex.requirements/thread.sharedtimedmutex.requirements/thread.sharedtimedmutex.class/try_lock_shared.pass.cpp
index 9c2d8c9c8e5c..3d5604d886cb 100644
--- a/test/std/thread/thread.mutex/thread.mutex.requirements/thread.sharedtimedmutex.requirements/thread.sharedtimedmutex.class/try_lock_shared.pass.cpp
+++ b/test/std/thread/thread.mutex/thread.mutex.requirements/thread.sharedtimedmutex.requirements/thread.sharedtimedmutex.class/try_lock_shared.pass.cpp
@@ -22,6 +22,8 @@
#include <cstdlib>
#include <cassert>
+#include "test_macros.h"
+
std::shared_timed_mutex m;
typedef std::chrono::system_clock Clock;
@@ -30,6 +32,13 @@ typedef Clock::duration duration;
typedef std::chrono::milliseconds ms;
typedef std::chrono::nanoseconds ns;
+
+#if !defined(TEST_HAS_SANITIZERS)
+ms Tolerance = ms(200);
+#else
+ms Tolerance = ms(200 * 5);
+#endif
+
void f()
{
time_point t0 = Clock::now();
@@ -41,7 +50,7 @@ void f()
time_point t1 = Clock::now();
m.unlock_shared();
ns d = t1 - t0 - ms(250);
- assert(d < ms(200)); // within 200ms
+ assert(d < Tolerance); // within tolerance
}
int main()
diff --git a/test/std/thread/thread.mutex/thread.mutex.requirements/thread.sharedtimedmutex.requirements/thread.sharedtimedmutex.class/try_lock_shared_for.pass.cpp b/test/std/thread/thread.mutex/thread.mutex.requirements/thread.sharedtimedmutex.requirements/thread.sharedtimedmutex.class/try_lock_shared_for.pass.cpp
index 35444112a5da..4cdb5873f9a1 100644
--- a/test/std/thread/thread.mutex/thread.mutex.requirements/thread.sharedtimedmutex.requirements/thread.sharedtimedmutex.class/try_lock_shared_for.pass.cpp
+++ b/test/std/thread/thread.mutex/thread.mutex.requirements/thread.sharedtimedmutex.requirements/thread.sharedtimedmutex.class/try_lock_shared_for.pass.cpp
@@ -23,6 +23,8 @@
#include <cstdlib>
#include <cassert>
+#include "test_macros.h"
+
std::shared_timed_mutex m;
typedef std::chrono::steady_clock Clock;
@@ -31,23 +33,34 @@ typedef Clock::duration duration;
typedef std::chrono::milliseconds ms;
typedef std::chrono::nanoseconds ns;
+ms WaitTime = ms(250);
+
+// Thread sanitizer causes more overhead and will sometimes cause this test
+// to fail. To prevent this we give Thread sanitizer more time to complete the
+// test.
+#if !defined(TEST_HAS_SANITIZERS)
+ms Tolerance = ms(50);
+#else
+ms Tolerance = ms(50 * 5);
+#endif
+
void f1()
{
time_point t0 = Clock::now();
- assert(m.try_lock_shared_for(ms(300)) == true);
+ assert(m.try_lock_shared_for(WaitTime + Tolerance) == true);
time_point t1 = Clock::now();
m.unlock_shared();
- ns d = t1 - t0 - ms(250);
- assert(d < ms(50)); // within 50ms
+ ns d = t1 - t0 - WaitTime;
+ assert(d < Tolerance); // within 50ms
}
void f2()
{
time_point t0 = Clock::now();
- assert(m.try_lock_shared_for(ms(250)) == false);
+ assert(m.try_lock_shared_for(WaitTime) == false);
time_point t1 = Clock::now();
- ns d = t1 - t0 - ms(250);
- assert(d < ms(50)); // within 50ms
+ ns d = t1 - t0 - WaitTime;
+ assert(d < Tolerance); // within 50ms
}
int main()
@@ -57,7 +70,7 @@ int main()
std::vector<std::thread> v;
for (int i = 0; i < 5; ++i)
v.push_back(std::thread(f1));
- std::this_thread::sleep_for(ms(250));
+ std::this_thread::sleep_for(WaitTime);
m.unlock();
for (auto& t : v)
t.join();
@@ -67,7 +80,7 @@ int main()
std::vector<std::thread> v;
for (int i = 0; i < 5; ++i)
v.push_back(std::thread(f2));
- std::this_thread::sleep_for(ms(300));
+ std::this_thread::sleep_for(WaitTime + Tolerance);
m.unlock();
for (auto& t : v)
t.join();
diff --git a/test/std/thread/thread.mutex/thread.mutex.requirements/thread.sharedtimedmutex.requirements/thread.sharedtimedmutex.class/try_lock_shared_until.pass.cpp b/test/std/thread/thread.mutex/thread.mutex.requirements/thread.sharedtimedmutex.requirements/thread.sharedtimedmutex.class/try_lock_shared_until.pass.cpp
index 4e0f19de07ce..f7ddbaeef498 100644
--- a/test/std/thread/thread.mutex/thread.mutex.requirements/thread.sharedtimedmutex.requirements/thread.sharedtimedmutex.class/try_lock_shared_until.pass.cpp
+++ b/test/std/thread/thread.mutex/thread.mutex.requirements/thread.sharedtimedmutex.requirements/thread.sharedtimedmutex.class/try_lock_shared_until.pass.cpp
@@ -23,6 +23,8 @@
#include <cstdlib>
#include <cassert>
+#include "test_macros.h"
+
std::shared_timed_mutex m;
typedef std::chrono::steady_clock Clock;
@@ -31,23 +33,34 @@ typedef Clock::duration duration;
typedef std::chrono::milliseconds ms;
typedef std::chrono::nanoseconds ns;
+ms WaitTime = ms(250);
+
+// Thread sanitizer causes more overhead and will sometimes cause this test
+// to fail. To prevent this we give Thread sanitizer more time to complete the
+// test.
+#if !defined(TEST_HAS_SANITIZERS)
+ms Tolerance = ms(50);
+#else
+ms Tolerance = ms(50 * 5);
+#endif
+
void f1()
{
time_point t0 = Clock::now();
- assert(m.try_lock_shared_until(Clock::now() + ms(300)) == true);
+ assert(m.try_lock_shared_until(Clock::now() + WaitTime + Tolerance) == true);
time_point t1 = Clock::now();
m.unlock_shared();
- ns d = t1 - t0 - ms(250);
- assert(d < ms(50)); // within 50ms
+ ns d = t1 - t0 - WaitTime;
+ assert(d < Tolerance); // within 50ms
}
void f2()
{
time_point t0 = Clock::now();
- assert(m.try_lock_shared_until(Clock::now() + ms(250)) == false);
+ assert(m.try_lock_shared_until(Clock::now() + WaitTime) == false);
time_point t1 = Clock::now();
- ns d = t1 - t0 - ms(250);
- assert(d < ms(50)); // within 50ms
+ ns d = t1 - t0 - WaitTime;
+ assert(d < Tolerance); // within tolerance
}
int main()
@@ -57,7 +70,7 @@ int main()
std::vector<std::thread> v;
for (int i = 0; i < 5; ++i)
v.push_back(std::thread(f1));
- std::this_thread::sleep_for(ms(250));
+ std::this_thread::sleep_for(WaitTime);
m.unlock();
for (auto& t : v)
t.join();
@@ -67,7 +80,7 @@ int main()
std::vector<std::thread> v;
for (int i = 0; i < 5; ++i)
v.push_back(std::thread(f2));
- std::this_thread::sleep_for(ms(300));
+ std::this_thread::sleep_for(WaitTime + Tolerance);
m.unlock();
for (auto& t : v)
t.join();
diff --git a/test/std/thread/thread.mutex/thread.mutex.requirements/thread.sharedtimedmutex.requirements/thread.sharedtimedmutex.class/try_lock_until.pass.cpp b/test/std/thread/thread.mutex/thread.mutex.requirements/thread.sharedtimedmutex.requirements/thread.sharedtimedmutex.class/try_lock_until.pass.cpp
index aa90cf71502f..1560af2c9ecc 100644
--- a/test/std/thread/thread.mutex/thread.mutex.requirements/thread.sharedtimedmutex.requirements/thread.sharedtimedmutex.class/try_lock_until.pass.cpp
+++ b/test/std/thread/thread.mutex/thread.mutex.requirements/thread.sharedtimedmutex.requirements/thread.sharedtimedmutex.class/try_lock_until.pass.cpp
@@ -32,23 +32,35 @@ typedef Clock::duration duration;
typedef std::chrono::milliseconds ms;
typedef std::chrono::nanoseconds ns;
+
+ms WaitTime = ms(250);
+
+// Thread sanitizer causes more overhead and will sometimes cause this test
+// to fail. To prevent this we give Thread sanitizer more time to complete the
+// test.
+#if !defined(TEST_HAS_SANITIZERS)
+ms Tolerance = ms(50);
+#else
+ms Tolerance = ms(50 * 5);
+#endif
+
void f1()
{
time_point t0 = Clock::now();
- assert(m.try_lock_until(Clock::now() + ms(300)) == true);
+ assert(m.try_lock_until(Clock::now() + WaitTime + Tolerance) == true);
time_point t1 = Clock::now();
m.unlock();
- ns d = t1 - t0 - ms(250);
- assert(d < ms(50)); // within 50ms
+ ns d = t1 - t0 - WaitTime;
+ assert(d < Tolerance); // within tolerance
}
void f2()
{
time_point t0 = Clock::now();
- assert(m.try_lock_until(Clock::now() + ms(250)) == false);
+ assert(m.try_lock_until(Clock::now() + WaitTime) == false);
time_point t1 = Clock::now();
- ns d = t1 - t0 - ms(250);
- assert(d < ms(50)); // within 50ms
+ ns d = t1 - t0 - WaitTime;
+ assert(d < Tolerance); // within tolerance
}
int main()
@@ -56,14 +68,14 @@ int main()
{
m.lock();
std::thread t(f1);
- std::this_thread::sleep_for(ms(250));
+ std::this_thread::sleep_for(WaitTime);
m.unlock();
t.join();
}
{
m.lock();
std::thread t(f2);
- std::this_thread::sleep_for(ms(300));
+ std::this_thread::sleep_for(WaitTime + Tolerance);
m.unlock();
t.join();
}
diff --git a/test/std/thread/thread.mutex/thread.once/thread.once.callonce/call_once.pass.cpp b/test/std/thread/thread.mutex/thread.once/thread.once.callonce/call_once.pass.cpp
index 89b99348459b..afc318cc3d7a 100644
--- a/test/std/thread/thread.mutex/thread.once/thread.once.callonce/call_once.pass.cpp
+++ b/test/std/thread/thread.mutex/thread.once/thread.once.callonce/call_once.pass.cpp
@@ -7,6 +7,7 @@
//
//===----------------------------------------------------------------------===//
//
+// XFAIL: libcpp-no-exceptions
// UNSUPPORTED: libcpp-has-no-threads
// <mutex>
diff --git a/test/std/thread/thread.threads/thread.thread.class/thread.thread.assign/move2.pass.cpp b/test/std/thread/thread.threads/thread.thread.class/thread.thread.assign/move2.pass.cpp
index 7198d226960a..6c31df593c0e 100644
--- a/test/std/thread/thread.threads/thread.thread.class/thread.thread.assign/move2.pass.cpp
+++ b/test/std/thread/thread.threads/thread.thread.class/thread.thread.assign/move2.pass.cpp
@@ -8,13 +8,7 @@
//===----------------------------------------------------------------------===//
//
// UNSUPPORTED: libcpp-has-no-threads
-
-// NOTE: std::terminate is called so the destructors are not invoked and the
-// memory is not freed. This will cause ASAN to fail.
-// XFAIL: asan
-
-// NOTE: TSAN will report this test as leaking a thread.
-// XFAIL: tsan
+// UNSUPPORTED: c++98, c++03
// <thread>
@@ -38,12 +32,7 @@ public:
G(const G& g) : alive_(g.alive_) {++n_alive;}
~G() {alive_ = 0; --n_alive;}
- void operator()()
- {
- assert(alive_ == 1);
- assert(n_alive >= 1);
- op_run = true;
- }
+
void operator()(int i, double j)
{
@@ -60,7 +49,7 @@ bool G::op_run = false;
void f1()
{
- std::exit(0);
+ std::_Exit(0);
}
int main()
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 a8b4be16e631..3de15af8929b 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
@@ -7,6 +7,7 @@
//
//===----------------------------------------------------------------------===//
//
+// XFAIL: libcpp-no-exceptions
// UNSUPPORTED: libcpp-has-no-threads
// <thread>
@@ -22,6 +23,8 @@
#include <cstdlib>
#include <cassert>
+#include "test_macros.h"
+
unsigned throw_one = 0xFFFF;
void* operator new(std::size_t s) throw(std::bad_alloc)
@@ -75,7 +78,7 @@ public:
int G::n_alive = 0;
bool G::op_run = false;
-#ifndef _LIBCPP_HAS_NO_VARIADICS
+#if TEST_STD_VER >= 11
class MoveOnly
{
@@ -137,7 +140,7 @@ int main()
assert(!G::op_run);
}
}
-#ifndef _LIBCPP_HAS_NO_VARIADICS
+#if TEST_STD_VER >= 11
{
assert(G::n_alive == 0);
assert(!G::op_run);
@@ -150,5 +153,5 @@ int main()
std::thread t = std::thread(MoveOnly(), MoveOnly());
t.join();
}
-#endif // _LIBCPP_HAS_NO_VARIADICS
+#endif
}
diff --git a/test/std/thread/thread.threads/thread.thread.class/thread.thread.destr/dtor.pass.cpp b/test/std/thread/thread.threads/thread.thread.class/thread.thread.destr/dtor.pass.cpp
index ddf96d095730..0efb7713e985 100644
--- a/test/std/thread/thread.threads/thread.thread.class/thread.thread.destr/dtor.pass.cpp
+++ b/test/std/thread/thread.threads/thread.thread.class/thread.thread.destr/dtor.pass.cpp
@@ -9,8 +9,6 @@
//
// UNSUPPORTED: libcpp-has-no-threads
-// NOTE: TSAN will report this test as leaking a thread.
-// XFAIL: tsan
// <thread>
@@ -47,7 +45,7 @@ bool G::op_run = false;
void f1()
{
- std::exit(0);
+ std::_Exit(0);
}
int main()
diff --git a/test/std/thread/thread.threads/thread.thread.class/thread.thread.member/detach.pass.cpp b/test/std/thread/thread.threads/thread.thread.class/thread.thread.member/detach.pass.cpp
index f4a4d1f777f1..726395d99044 100644
--- a/test/std/thread/thread.threads/thread.thread.class/thread.thread.member/detach.pass.cpp
+++ b/test/std/thread/thread.threads/thread.thread.class/thread.thread.member/detach.pass.cpp
@@ -19,7 +19,7 @@
#include <atomic>
#include <cassert>
-std::atomic_bool done = ATOMIC_VAR_INIT(false);
+std::atomic_bool done(false);
class G
{
diff --git a/test/std/utilities/allocator.adaptor/scoped.adaptor.operators/copy_assign.pass.cpp b/test/std/utilities/allocator.adaptor/scoped.adaptor.operators/copy_assign.pass.cpp
new file mode 100644
index 000000000000..72f0e867b1d2
--- /dev/null
+++ b/test/std/utilities/allocator.adaptor/scoped.adaptor.operators/copy_assign.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <memory>
+
+// template <class OuterAlloc, class... InnerAllocs>
+// class scoped_allocator_adaptor
+
+// scoped_allocator_adaptor& operator=(const scoped_allocator_adaptor& other);
+
+
+#include <scoped_allocator>
+#include <cassert>
+
+#include "allocators.h"
+
+int main()
+{
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+ {
+ typedef std::scoped_allocator_adaptor<A1<int>> A;
+ A a1(A1<int>(3));
+ A aN;
+ A1<int>::copy_called = false;
+ A1<int>::move_called = false;
+ aN = a1;
+ assert(A1<int>::copy_called == true);
+ assert(A1<int>::move_called == false);
+ assert(aN == a1);
+ }
+ {
+ typedef std::scoped_allocator_adaptor<A1<int>, A2<int>> A;
+ A a1(A1<int>(4), A2<int>(5));
+ A aN;
+ A1<int>::copy_called = false;
+ A1<int>::move_called = false;
+ A2<int>::copy_called = false;
+ A2<int>::move_called = false;
+ aN = a1;
+ assert(A1<int>::copy_called == true);
+ assert(A1<int>::move_called == false);
+ assert(A2<int>::copy_called == true);
+ assert(A2<int>::move_called == false);
+ assert(aN == a1);
+ }
+ {
+ typedef std::scoped_allocator_adaptor<A1<int>, A2<int>, A3<int>> A;
+ A a1(A1<int>(4), A2<int>(5), A3<int>(6));
+ A aN;
+ A1<int>::copy_called = false;
+ A1<int>::move_called = false;
+ A2<int>::copy_called = false;
+ A2<int>::move_called = false;
+ A3<int>::copy_called = false;
+ A3<int>::move_called = false;
+ aN = a1;
+ assert(A1<int>::copy_called == true);
+ assert(A1<int>::move_called == false);
+ assert(A2<int>::copy_called == true);
+ assert(A2<int>::move_called == false);
+ assert(A3<int>::copy_called == true);
+ assert(A3<int>::move_called == false);
+ assert(aN == a1);
+ }
+#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+}
diff --git a/test/std/utilities/allocator.adaptor/scoped.adaptor.operators/move_assign.pass.cpp b/test/std/utilities/allocator.adaptor/scoped.adaptor.operators/move_assign.pass.cpp
new file mode 100644
index 000000000000..0dc479c246c9
--- /dev/null
+++ b/test/std/utilities/allocator.adaptor/scoped.adaptor.operators/move_assign.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <memory>
+
+// template <class OuterAlloc, class... InnerAllocs>
+// class scoped_allocator_adaptor
+
+// scoped_allocator_adaptor& operator=(const scoped_allocator_adaptor&& other);
+
+
+#include <scoped_allocator>
+#include <cassert>
+
+#include "allocators.h"
+
+int main()
+{
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+ {
+ typedef std::scoped_allocator_adaptor<A1<int>> A;
+ A a1(A1<int>(3));
+ A aN;
+ A1<int>::copy_called = false;
+ A1<int>::move_called = false;
+ aN = std::move(a1);
+ assert(A1<int>::copy_called == false);
+ assert(A1<int>::move_called == true);
+ assert(aN == a1);
+ }
+ {
+ typedef std::scoped_allocator_adaptor<A1<int>, A2<int>> A;
+ A a1(A1<int>(4), A2<int>(5));
+ A aN;
+ A1<int>::copy_called = false;
+ A1<int>::move_called = false;
+ A2<int>::copy_called = false;
+ A2<int>::move_called = false;
+ aN = std::move(a1);
+ assert(A1<int>::copy_called == false);
+ assert(A1<int>::move_called == true);
+ assert(A2<int>::copy_called == false);
+ assert(A2<int>::move_called == true);
+ assert(aN == a1);
+ }
+ {
+ typedef std::scoped_allocator_adaptor<A1<int>, A2<int>, A3<int>> A;
+ A a1(A1<int>(4), A2<int>(5), A3<int>(6));
+ A aN;
+ A1<int>::copy_called = false;
+ A1<int>::move_called = false;
+ A2<int>::copy_called = false;
+ A2<int>::move_called = false;
+ A3<int>::copy_called = false;
+ A3<int>::move_called = false;
+ aN = std::move(a1);
+ assert(A1<int>::copy_called == false);
+ assert(A1<int>::move_called == true);
+ assert(A2<int>::copy_called == false);
+ assert(A2<int>::move_called == true);
+ assert(A3<int>::copy_called == false);
+ assert(A3<int>::move_called == true);
+ assert(aN == a1);
+ }
+#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+}
diff --git a/test/std/utilities/function.objects/bind/func.bind/func.bind.bind/copy.pass.cpp b/test/std/utilities/function.objects/bind/func.bind/func.bind.bind/copy.pass.cpp
index 6315598125c9..ad03e8fb6bb2 100644
--- a/test/std/utilities/function.objects/bind/func.bind/func.bind.bind/copy.pass.cpp
+++ b/test/std/utilities/function.objects/bind/func.bind/func.bind.bind/copy.pass.cpp
@@ -7,6 +7,8 @@
//
//===----------------------------------------------------------------------===//
+// UNSUPPORTED: c++98, c++03
+
// <functional>
// template<CopyConstructible Fn, CopyConstructible... Types>
diff --git a/test/std/utilities/function.objects/bind/func.bind/func.bind.bind/invoke_function_object.pass.cpp b/test/std/utilities/function.objects/bind/func.bind/func.bind.bind/invoke_function_object.pass.cpp
index 33bf01855908..4577d0bf4d54 100644
--- a/test/std/utilities/function.objects/bind/func.bind/func.bind.bind/invoke_function_object.pass.cpp
+++ b/test/std/utilities/function.objects/bind/func.bind/func.bind.bind/invoke_function_object.pass.cpp
@@ -7,6 +7,8 @@
//
//===----------------------------------------------------------------------===//
+// UNSUPPORTED: c++98, c++03
+
// <functional>
// template<CopyConstructible Fn, CopyConstructible... Types>
diff --git a/test/std/utilities/function.objects/bind/func.bind/func.bind.bind/invoke_int_0.pass.cpp b/test/std/utilities/function.objects/bind/func.bind/func.bind.bind/invoke_int_0.pass.cpp
index ab4dd59534d5..815096f6b157 100644
--- a/test/std/utilities/function.objects/bind/func.bind/func.bind.bind/invoke_int_0.pass.cpp
+++ b/test/std/utilities/function.objects/bind/func.bind/func.bind.bind/invoke_int_0.pass.cpp
@@ -7,6 +7,8 @@
//
//===----------------------------------------------------------------------===//
+// UNSUPPORTED: c++98, c++03
+
// <functional>
// template<CopyConstructible Fn, CopyConstructible... Types>
diff --git a/test/std/utilities/function.objects/bind/func.bind/func.bind.bind/invoke_lvalue.pass.cpp b/test/std/utilities/function.objects/bind/func.bind/func.bind.bind/invoke_lvalue.pass.cpp
index af5efe464d5d..f69afbf57667 100644
--- a/test/std/utilities/function.objects/bind/func.bind/func.bind.bind/invoke_lvalue.pass.cpp
+++ b/test/std/utilities/function.objects/bind/func.bind/func.bind.bind/invoke_lvalue.pass.cpp
@@ -7,6 +7,8 @@
//
//===----------------------------------------------------------------------===//
+// UNSUPPORTED: c++98, c++03
+
// <functional>
// template<CopyConstructible Fn, CopyConstructible... Types>
diff --git a/test/std/utilities/function.objects/bind/func.bind/func.bind.bind/invoke_rvalue.pass.cpp b/test/std/utilities/function.objects/bind/func.bind/func.bind.bind/invoke_rvalue.pass.cpp
index 4913a510c36e..a1137ee388c1 100644
--- a/test/std/utilities/function.objects/bind/func.bind/func.bind.bind/invoke_rvalue.pass.cpp
+++ b/test/std/utilities/function.objects/bind/func.bind/func.bind.bind/invoke_rvalue.pass.cpp
@@ -7,6 +7,8 @@
//
//===----------------------------------------------------------------------===//
+// UNSUPPORTED: c++98, c++03
+
// <functional>
// template<CopyConstructible Fn, CopyConstructible... Types>
diff --git a/test/std/utilities/function.objects/bind/func.bind/func.bind.bind/invoke_void_0.pass.cpp b/test/std/utilities/function.objects/bind/func.bind/func.bind.bind/invoke_void_0.pass.cpp
index b7874b77cf03..73f26e4b585a 100644
--- a/test/std/utilities/function.objects/bind/func.bind/func.bind.bind/invoke_void_0.pass.cpp
+++ b/test/std/utilities/function.objects/bind/func.bind/func.bind.bind/invoke_void_0.pass.cpp
@@ -7,6 +7,8 @@
//
//===----------------------------------------------------------------------===//
+// UNSUPPORTED: c++98, c++03
+
// <functional>
// template<CopyConstructible Fn, CopyConstructible... Types>
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 12720f7b550a..f61d93aefd89 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
@@ -7,6 +7,8 @@
//
//===----------------------------------------------------------------------===//
+// UNSUPPORTED: c++98, c++03
+
// <functional>
// template<CopyConstructible Fn, CopyConstructible... Types>
diff --git a/test/std/utilities/function.objects/bind/func.bind/func.bind.isbind/is_bind_expression.pass.cpp b/test/std/utilities/function.objects/bind/func.bind/func.bind.isbind/is_bind_expression.pass.cpp
index 7f8dd4a98d2b..83fa452fecb3 100644
--- a/test/std/utilities/function.objects/bind/func.bind/func.bind.isbind/is_bind_expression.pass.cpp
+++ b/test/std/utilities/function.objects/bind/func.bind/func.bind.isbind/is_bind_expression.pass.cpp
@@ -7,6 +7,8 @@
//
//===----------------------------------------------------------------------===//
+// UNSUPPORTED: c++98, c++03
+
// <functional>
// template<class T> struct is_bind_expression
diff --git a/test/std/utilities/function.objects/bind/func.bind/func.bind.isbind/is_bind_expression_03.pass.cpp b/test/std/utilities/function.objects/bind/func.bind/func.bind.isbind/is_bind_expression_03.pass.cpp
new file mode 100644
index 000000000000..12a78dbc7548
--- /dev/null
+++ b/test/std/utilities/function.objects/bind/func.bind/func.bind.isbind/is_bind_expression_03.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <functional>
+
+//-----------------------------------------------------------------------------
+// TESTING template<class T> struct is_bind_expression
+//
+// bind is not implemented in C++03 so nothing is a bind expression. However
+// for compatibility reasons the trait is_bind_expression should be available
+// in C++03 and it should always return false.
+
+#include <functional>
+
+template <class T>
+void test() {
+ static_assert(!std::is_bind_expression<T>::value, "");
+}
+
+struct C {};
+
+int main() {
+ test<int>();
+ test<void>();
+ test<C>();
+ test<C&>();
+ test<C const&>();
+ test<C*>();
+ test<void()>();
+ test<int(*)()>();
+ test<int (C::*)()>();
+ test<decltype(std::placeholders::_2)>();
+}
diff --git a/test/std/utilities/function.objects/func.invoke/invoke.pass.cpp b/test/std/utilities/function.objects/func.invoke/invoke.pass.cpp
index 4b9cc76f7e4f..97b0b4d158a0 100644
--- a/test/std/utilities/function.objects/func.invoke/invoke.pass.cpp
+++ b/test/std/utilities/function.objects/func.invoke/invoke.pass.cpp
@@ -40,6 +40,7 @@
#include <functional>
#include <type_traits>
+#include <utility> // for std::move
#include <cassert>
struct NonCopyable {
diff --git a/test/std/utilities/function.objects/func.memfn/member_function.pass.cpp b/test/std/utilities/function.objects/func.memfn/member_function.pass.cpp
index 4096bd814421..f371223ee84c 100644
--- a/test/std/utilities/function.objects/func.memfn/member_function.pass.cpp
+++ b/test/std/utilities/function.objects/func.memfn/member_function.pass.cpp
@@ -69,4 +69,7 @@ int main()
test0(std::mem_fn(&A::test0));
test1(std::mem_fn(&A::test1));
test2(std::mem_fn(&A::test2));
+#if __has_feature(cxx_noexcept)
+ static_assert((noexcept(std::mem_fn(&A::test0))), ""); // LWG#2489
+#endif
}
diff --git a/test/std/utilities/function.objects/func.require/bullet_1_and_2.pass.cpp b/test/std/utilities/function.objects/func.require/bullet_1_and_2.pass.cpp
new file mode 100644
index 000000000000..e579f207a33f
--- /dev/null
+++ b/test/std/utilities/function.objects/func.require/bullet_1_and_2.pass.cpp
@@ -0,0 +1,318 @@
+//===----------------------------------------------------------------------===//
+//
+// The 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>
+
+// INVOKE (f, t1, t2, ..., tN)
+
+//------------------------------------------------------------------------------
+// TESTING INVOKE(f, t1, t2, ..., tN)
+// - Bullet 1 -- (t1.*f)(t2, ..., tN)
+// - Bullet 2 -- ((*t1).*f)(t2, ..., tN)
+//
+// Overview:
+// Bullets 1 and 2 handle the case where 'f' is a pointer to member function.
+// Bullet 1 only handles the cases where t1 is an object of type T or a
+// type derived from 'T'. Bullet 2 handles all other cases.
+//
+// Concerns:
+// 1) cv-qualified member function signatures are accepted.
+// 2) reference qualified member function signatures are accepted.
+// 3) member functions with varargs at the end are accepted.
+// 4) The arguments are perfect forwarded to the member function call.
+// 5) Classes that are publicly derived from 'T' are accepted as the call object
+// 6) All types that dereference to T or a type derived from T can be used
+// as the call object.
+// 7) Pointers to T or a type derived from T can be used as the call object.
+// 8) Reference return types are properly deduced.
+//
+//
+// Plan:
+// 1) Create a class that contains a set, 'S', of non-static functions.
+// 'S' should include functions that cover every single combination
+// of qualifiers and varargs for arities of 0, 1 and 2 (C-1,2,3).
+// The argument types used in the functions should be non-copyable (C-4).
+// The functions should return 'MethodID::setUncheckedCall()'.
+//
+// 2) Create a set of supported call object, 'Objs', of different types
+// and behaviors. (C-5,6,7)
+//
+// 3) Attempt to call each function, 'f', in 'S' with each call object, 'c',
+// in 'Objs'. After every attempted call to 'f' check that 'f' was
+// actually called using 'MethodID::checkCalled(<return-value>)'
+//
+// 3b) If 'f' is reference qualified call 'f' with the properly qualified
+// call object. Otherwise call 'f' with lvalue call objects.
+//
+// 3a) If 'f' is const, volatile, or cv qualified then call it with call
+// objects that are equally or less cv-qualified.
+
+#include <functional>
+#include <type_traits>
+#include <cassert>
+
+#include "test_macros.h"
+#include "invoke_helpers.h"
+
+//==============================================================================
+// MemFun03 - C++03 compatible set of test member functions.
+struct MemFun03 {
+ typedef void*& R;
+#define F(...) \
+ R f(__VA_ARGS__) { return MethodID<R(MemFun03::*)(__VA_ARGS__)>::setUncheckedCall(); } \
+ R f(__VA_ARGS__) const { return MethodID<R(MemFun03::*)(__VA_ARGS__) const>::setUncheckedCall(); } \
+ R f(__VA_ARGS__) volatile { return MethodID<R(MemFun03::*)(__VA_ARGS__) volatile>::setUncheckedCall(); } \
+ R f(__VA_ARGS__) const volatile { return MethodID<R(MemFun03::*)(__VA_ARGS__) const volatile>::setUncheckedCall(); }
+#
+ F()
+ F(...)
+ F(ArgType&)
+ F(ArgType&, ...)
+ F(ArgType&, ArgType&)
+ F(ArgType&, ArgType&, ...)
+ F(ArgType&, ArgType&, ArgType&)
+ F(ArgType&, ArgType&, ArgType&, ...)
+#undef F
+public:
+ MemFun03() {}
+private:
+ MemFun03(MemFun03 const&);
+ MemFun03& operator=(MemFun03 const&);
+};
+
+
+#if TEST_STD_VER >= 11
+
+//==============================================================================
+// MemFun11 - C++11 reference qualified test member functions.
+struct MemFun11 {
+ typedef void*& R;
+ typedef MemFun11 C;
+#define F(...) \
+ R f(__VA_ARGS__) & { return MethodID<R(C::*)(__VA_ARGS__) &>::setUncheckedCall(); } \
+ R f(__VA_ARGS__) const & { return MethodID<R(C::*)(__VA_ARGS__) const &>::setUncheckedCall(); } \
+ R f(__VA_ARGS__) volatile & { return MethodID<R(C::*)(__VA_ARGS__) volatile &>::setUncheckedCall(); } \
+ R f(__VA_ARGS__) const volatile & { return MethodID<R(C::*)(__VA_ARGS__) const volatile &>::setUncheckedCall(); } \
+ R f(__VA_ARGS__) && { return MethodID<R(C::*)(__VA_ARGS__) &&>::setUncheckedCall(); } \
+ R f(__VA_ARGS__) const && { return MethodID<R(C::*)(__VA_ARGS__) const &&>::setUncheckedCall(); } \
+ R f(__VA_ARGS__) volatile && { return MethodID<R(C::*)(__VA_ARGS__) volatile &&>::setUncheckedCall(); } \
+ R f(__VA_ARGS__) const volatile && { return MethodID<R(C::*)(__VA_ARGS__) const volatile &&>::setUncheckedCall(); }
+#
+ F()
+ F(...)
+ F(ArgType&&)
+ F(ArgType&&, ...)
+ F(ArgType&&, ArgType&&)
+ F(ArgType&&, ArgType&&, ...)
+ F(ArgType&&, ArgType&&, ArgType&&)
+ F(ArgType&&, ArgType&&, ArgType&&, ...)
+#undef F
+public:
+ MemFun11() {}
+private:
+ MemFun11(MemFun11 const&);
+ MemFun11& operator=(MemFun11 const&);
+};
+
+#endif // TEST_STD_VER >= 11
+
+
+//==============================================================================
+// TestCase - A test case for a single member function.
+// ClassType - The type of the class being tested.
+// CallSig - The function signature of the method being tested.
+// Arity - the arity of 'CallSig'
+// CV - the cv qualifiers of 'CallSig' represented as a type tag.
+// RValue - The method is RValue qualified.
+// ArgRValue - Call the method with RValue arguments.
+template <class ClassType, class CallSig, int Arity, class CV,
+ bool RValue = false, bool ArgRValue = false>
+struct TestCaseImp {
+public:
+
+ static void run() { TestCaseImp().doTest(); }
+
+private:
+ //==========================================================================
+ // TEST DISPATCH
+ void doTest() {
+ // (Plan-2) Create test call objects.
+ typedef ClassType T;
+ typedef DerivedFromType<T> D;
+ T obj;
+ T* obj_ptr = &obj;
+ D der;
+ D* der_ptr = &der;
+ DerefToType<T> dref;
+ DerefPropType<T> dref2;
+
+ // (Plan-3) Dispatch based on the CV tags.
+ CV tag;
+ Bool<!RValue> NotRValue;
+ runTestDispatch(tag, obj);
+ runTestDispatch(tag, der);
+ runTestDispatch(tag, dref2);
+ runTestDispatchIf(NotRValue, tag, dref);
+ runTestDispatchIf(NotRValue, tag, obj_ptr);
+ runTestDispatchIf(NotRValue, tag, der_ptr);
+ }
+
+ template <class QT, class Tp>
+ void runTestDispatchIf(Bool<true>, QT q, Tp& v) {
+ runTestDispatch(q, v);
+ }
+
+ template <class QT, class Tp>
+ void runTestDispatchIf(Bool<false>, QT, Tp&) {
+ }
+
+ template <class Tp>
+ void runTestDispatch(Q_None, Tp& v) {
+ runTest(v);
+ }
+
+ template <class Tp>
+ void runTestDispatch(Q_Const, Tp& v) {
+ Tp const& cv = v;
+ runTest(v);
+ runTest(cv);
+ }
+
+ template <class Tp>
+ void runTestDispatch(Q_Volatile, Tp& v) {
+ Tp volatile& vv = v;
+ runTest(v);
+ runTest(vv);
+ }
+
+ template <class Tp>
+ void runTestDispatch(Q_CV, Tp& v) {
+ Tp const& cv = v;
+ Tp volatile& vv = v;
+ Tp const volatile& cvv = v;
+ runTest(v);
+ runTest(cv);
+ runTest(vv);
+ runTest(cvv);
+ }
+
+ template <class Obj>
+ void runTest(Obj& obj) {
+ typedef Caster<Q_None, RValue> SCast;
+ typedef Caster<Q_None, ArgRValue> ACast;
+ typedef CallSig (ClassType::*MemPtr);
+ // Delegate test to logic in invoke_helpers.h
+ BasicTest<MethodID<MemPtr>, Arity, SCast, ACast> b;
+ b.runTest( (MemPtr)&ClassType::f, obj);
+ }
+};
+
+template <class Sig, int Arity, class CV>
+struct TestCase : public TestCaseImp<MemFun03, Sig, Arity, CV> {};
+
+#if TEST_STD_VER >= 11
+template <class Sig, int Arity, class CV, bool RValue = false>
+struct TestCase11 : public TestCaseImp<MemFun11, Sig, Arity, CV, RValue, true> {};
+#endif
+
+int main() {
+ typedef void*& R;
+ typedef ArgType A;
+ TestCase<R(), 0, Q_None>::run();
+ TestCase<R() const, 0, Q_Const>::run();
+ TestCase<R() volatile, 0, Q_Volatile>::run();
+ TestCase<R() const volatile, 0, Q_CV>::run();
+ TestCase<R(...), 0, Q_None>::run();
+ TestCase<R(...) const, 0, Q_Const>::run();
+ TestCase<R(...) volatile, 0, Q_Volatile>::run();
+ TestCase<R(...) const volatile, 0, Q_CV>::run();
+ TestCase<R(A&), 1, Q_None>::run();
+ TestCase<R(A&) const, 1, Q_Const>::run();
+ TestCase<R(A&) volatile, 1, Q_Volatile>::run();
+ TestCase<R(A&) const volatile, 1, Q_CV>::run();
+ TestCase<R(A&, ...), 1, Q_None>::run();
+ TestCase<R(A&, ...) const, 1, Q_Const>::run();
+ TestCase<R(A&, ...) volatile, 1, Q_Volatile>::run();
+ TestCase<R(A&, ...) const volatile, 1, Q_CV>::run();
+ TestCase<R(A&, A&), 2, Q_None>::run();
+ TestCase<R(A&, A&) const, 2, Q_Const>::run();
+ TestCase<R(A&, A&) volatile, 2, Q_Volatile>::run();
+ TestCase<R(A&, A&) const volatile, 2, Q_CV>::run();
+ TestCase<R(A&, A&, ...), 2, Q_None>::run();
+ TestCase<R(A&, A&, ...) const, 2, Q_Const>::run();
+ TestCase<R(A&, A&, ...) volatile, 2, Q_Volatile>::run();
+ TestCase<R(A&, A&, ...) const volatile, 2, Q_CV>::run();
+ TestCase<R(A&, A&, A&), 3, Q_None>::run();
+ TestCase<R(A&, A&, A&) const, 3, Q_Const>::run();
+ TestCase<R(A&, A&, A&) volatile, 3, Q_Volatile>::run();
+ TestCase<R(A&, A&, A&) const volatile, 3, Q_CV>::run();
+ TestCase<R(A&, A&, A&, ...), 3, Q_None>::run();
+ TestCase<R(A&, A&, A&, ...) const, 3, Q_Const>::run();
+ TestCase<R(A&, A&, A&, ...) volatile, 3, Q_Volatile>::run();
+ TestCase<R(A&, A&, A&, ...) const volatile, 3, Q_CV>::run();
+
+#if TEST_STD_VER >= 11
+ TestCase11<R() &, 0, Q_None>::run();
+ TestCase11<R() const &, 0, Q_Const>::run();
+ TestCase11<R() volatile &, 0, Q_Volatile>::run();
+ TestCase11<R() const volatile &, 0, Q_CV>::run();
+ TestCase11<R(...) &, 0, Q_None>::run();
+ TestCase11<R(...) const &, 0, Q_Const>::run();
+ TestCase11<R(...) volatile &, 0, Q_Volatile>::run();
+ TestCase11<R(...) const volatile &, 0, Q_CV>::run();
+ TestCase11<R(A&&) &, 1, Q_None>::run();
+ TestCase11<R(A&&) const &, 1, Q_Const>::run();
+ TestCase11<R(A&&) volatile &, 1, Q_Volatile>::run();
+ TestCase11<R(A&&) const volatile &, 1, Q_CV>::run();
+ TestCase11<R(A&&, ...) &, 1, Q_None>::run();
+ TestCase11<R(A&&, ...) const &, 1, Q_Const>::run();
+ TestCase11<R(A&&, ...) volatile &, 1, Q_Volatile>::run();
+ TestCase11<R(A&&, ...) const volatile &, 1, Q_CV>::run();
+ TestCase11<R(A&&, A&&) &, 2, Q_None>::run();
+ TestCase11<R(A&&, A&&) const &, 2, Q_Const>::run();
+ TestCase11<R(A&&, A&&) volatile &, 2, Q_Volatile>::run();
+ TestCase11<R(A&&, A&&) const volatile &, 2, Q_CV>::run();
+ TestCase11<R(A&&, A&&, ...) &, 2, Q_None>::run();
+ TestCase11<R(A&&, A&&, ...) const &, 2, Q_Const>::run();
+ TestCase11<R(A&&, A&&, ...) volatile &, 2, Q_Volatile>::run();
+ TestCase11<R(A&&, A&&, ...) const volatile &, 2, Q_CV>::run();
+ TestCase11<R() &&, 0, Q_None, /* RValue */ true>::run();
+ TestCase11<R() const &&, 0, Q_Const, /* RValue */ true>::run();
+ TestCase11<R() volatile &&, 0, Q_Volatile, /* RValue */ true>::run();
+ TestCase11<R() const volatile &&, 0, Q_CV, /* RValue */ true>::run();
+ TestCase11<R(...) &&, 0, Q_None, /* RValue */ true>::run();
+ TestCase11<R(...) const &&, 0, Q_Const, /* RValue */ true>::run();
+ TestCase11<R(...) volatile &&, 0, Q_Volatile, /* RValue */ true>::run();
+ TestCase11<R(...) const volatile &&, 0, Q_CV, /* RValue */ true>::run();
+ TestCase11<R(A&&) &&, 1, Q_None, /* RValue */ true>::run();
+ TestCase11<R(A&&) const &&, 1, Q_Const, /* RValue */ true>::run();
+ TestCase11<R(A&&) volatile &&, 1, Q_Volatile, /* RValue */ true>::run();
+ TestCase11<R(A&&) const volatile &&, 1, Q_CV, /* RValue */ true>::run();
+ TestCase11<R(A&&, ...) &&, 1, Q_None, /* RValue */ true>::run();
+ TestCase11<R(A&&, ...) const &&, 1, Q_Const, /* RValue */ true>::run();
+ TestCase11<R(A&&, ...) volatile &&, 1, Q_Volatile, /* RValue */ true>::run();
+ TestCase11<R(A&&, ...) const volatile &&, 1, Q_CV, /* RValue */ true>::run();
+ TestCase11<R(A&&, A&&) &&, 2, Q_None, /* RValue */ true>::run();
+ TestCase11<R(A&&, A&&) const &&, 2, Q_Const, /* RValue */ true>::run();
+ TestCase11<R(A&&, A&&) volatile &&, 2, Q_Volatile, /* RValue */ true>::run();
+ TestCase11<R(A&&, A&&) const volatile &&, 2, Q_CV, /* RValue */ true>::run();
+ TestCase11<R(A&&, A&&, ...) &&, 2, Q_None, /* RValue */ true>::run();
+ TestCase11<R(A&&, A&&, ...) const &&, 2, Q_Const, /* RValue */ true>::run();
+ TestCase11<R(A&&, A&&, ...) volatile &&, 2, Q_Volatile, /* RValue */ true>::run();
+ TestCase11<R(A&&, A&&, ...) const volatile &&, 2, Q_CV, /* RValue */ true>::run();
+ TestCase11<R(A&&, A&&, A&&) &&, 3, Q_None, /* RValue */ true>::run();
+ TestCase11<R(A&&, A&&, A&&) const &&, 3, Q_Const, /* RValue */ true>::run();
+ TestCase11<R(A&&, A&&, A&&) volatile &&, 3, Q_Volatile, /* RValue */ true>::run();
+ TestCase11<R(A&&, A&&, A&&) const volatile &&, 3, Q_CV, /* RValue */ true>::run();
+ TestCase11<R(A&&, A&&, A&&, ...) &&, 3, Q_None, /* RValue */ true>::run();
+ TestCase11<R(A&&, A&&, A&&, ...) const &&, 3, Q_Const, /* RValue */ true>::run();
+ TestCase11<R(A&&, A&&, A&&, ...) volatile &&, 3, Q_Volatile, /* RValue */ true>::run();
+ TestCase11<R(A&&, A&&, A&&, ...) const volatile &&, 3, Q_CV, /* RValue */ true>::run();
+#endif
+} \ No newline at end of file
diff --git a/test/std/utilities/function.objects/func.require/bullet_3_and_4.pass.cpp b/test/std/utilities/function.objects/func.require/bullet_3_and_4.pass.cpp
new file mode 100644
index 000000000000..b6fe190bd2a7
--- /dev/null
+++ b/test/std/utilities/function.objects/func.require/bullet_3_and_4.pass.cpp
@@ -0,0 +1,164 @@
+//===----------------------------------------------------------------------===//
+//
+// The 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>
+
+// INVOKE (f, t1, t2, ..., tN)
+
+//------------------------------------------------------------------------------
+// TESTING INVOKE(f, t1, t2, ..., tN)
+// - Bullet 3 -- t1.*f
+// - Bullet 4 -- (*t1).*f
+//
+// Overview:
+// Bullets 3 and 4 handle the case where 'f' is a pointer to member object.
+// Bullet 3 only handles the cases where t1 is an object of type T or a
+// type derived from 'T'. Bullet 4 handles all other cases.
+//
+// Concerns:
+// 1) The return type is always an lvalue reference.
+// 2) The return type is not less cv-qualified that the object that contains it.
+// 3) The return type is not less cv-qualified than object type.
+// 4) The call object is perfectly forwarded.
+// 5) Classes that are publicly derived from 'T' are accepted as the call object
+// 6) All types that dereference to T or a type derived from T can be used
+// as the call object.
+// 7) Pointers to T or a type derived from T can be used as the call object.
+
+#include <functional>
+#include <type_traits>
+#include <cassert>
+
+#include "test_macros.h"
+#include "invoke_helpers.h"
+
+template <class Tp>
+struct TestMemberObject {
+ TestMemberObject() : object() {}
+ Tp object;
+private:
+ TestMemberObject(TestMemberObject const&);
+ TestMemberObject& operator=(TestMemberObject const&);
+};
+
+template <class ObjectType>
+struct TestCase {
+ public:
+
+ static void run() { TestCase().doTest(); }
+
+private:
+ typedef TestMemberObject<ObjectType> TestType;
+
+ //==========================================================================
+ // TEST DISPATCH
+ void doTest() {
+ typedef DerivedFromType<TestType> Derived;
+ TestType obj;
+ TestType* obj_ptr = &obj;
+ Derived der;
+ Derived* der_ptr = &der;
+ DerefToType<TestType> dref;
+ DerefPropType<TestType> dref2;
+
+ {
+ typedef ObjectType (TestType::*MemPtr);
+ typedef ObjectType E;
+ MemPtr M = &TestType::object;
+ runTestDispatch<E>(M, obj, &obj.object);
+ runTestDispatch<E>(M, der, &der.object);
+ runTestDispatch<E>(M, dref2, &dref2.object.object);
+ runTestPointerDispatch<E>(M, obj_ptr, &obj_ptr->object);
+ runTestPointerDispatch<E>(M, der_ptr, &der_ptr->object);
+ runTestPointerDispatch<E>(M, dref, &dref.object.object);
+ }
+ {
+ typedef ObjectType const (TestType::*CMemPtr);
+ typedef ObjectType const E;
+ CMemPtr M = &TestType::object;
+ runTestDispatch<E>(M, obj, &obj.object);
+ runTestDispatch<E>(M, der, &der.object);
+ runTestDispatch<E>(M, dref2, &dref2.object.object);
+ runTestPointerDispatch<E>(M, obj_ptr, &obj_ptr->object);
+ runTestPointerDispatch<E>(M, der_ptr, &der_ptr->object);
+ runTestPointerDispatch<E>(M, dref, &dref.object.object);
+ }
+ {
+ typedef ObjectType volatile (TestType::*VMemPtr);
+ typedef ObjectType volatile E;
+ VMemPtr M = &TestType::object;
+ runTestDispatch<E>(M, obj, &obj.object);
+ runTestDispatch<E>(M, der, &der.object);
+ runTestDispatch<E>(M, dref2, &dref2.object.object);
+ runTestPointerDispatch<E>(M, obj_ptr, &obj_ptr->object);
+ runTestPointerDispatch<E>(M, der_ptr, &der_ptr->object);
+ runTestPointerDispatch<E>(M, dref, &dref.object.object);
+ }
+ {
+ typedef ObjectType const volatile (TestType::*CVMemPtr);
+ typedef ObjectType const volatile E;
+ CVMemPtr M = &TestType::object;
+ runTestDispatch<E>(M, obj, &obj.object);
+ runTestDispatch<E>(M, der, &der.object);
+ runTestDispatch<E>(M, dref2, &dref2.object.object);
+ runTestPointerDispatch<E>(M, obj_ptr, &obj_ptr->object);
+ runTestPointerDispatch<E>(M, der_ptr, &der_ptr->object);
+ runTestPointerDispatch<E>(M, dref, &dref.object.object);
+ }
+ }
+
+ template <class Expect, class Fn, class T>
+ void runTestDispatch(Fn M, T& obj, ObjectType* expect) {
+ runTest<Expect &> (M, C_<T&>(obj), expect);
+ runTest<Expect const&> (M, C_<T const&>(obj), expect);
+ runTest<Expect volatile&> (M, C_<T volatile&>(obj), expect);
+ runTest<Expect const volatile&>(M, C_<T const volatile&>(obj), expect);
+#if TEST_STD_VER >= 11
+ runTest<Expect&&> (M, C_<T&&>(obj), expect);
+ runTest<Expect const&&> (M, C_<T const&&>(obj), expect);
+ runTest<Expect volatile&&> (M, C_<T volatile&&>(obj), expect);
+ runTest<Expect const volatile&&>(M, C_<T const volatile&&>(obj), expect);
+#endif
+ }
+
+ template <class Expect, class Fn, class T>
+ void runTestPointerDispatch(Fn M, T& obj, ObjectType* expect) {
+ runTest<Expect&>(M, C_<T &>(obj), expect);
+ runTest<Expect&>(M, C_<T const&>(obj), expect);
+ runTest<Expect&>(M, C_<T volatile&>(obj), expect);
+ runTest<Expect&>(M, C_<T const volatile&>(obj), expect);
+#if TEST_STD_VER >= 11
+ runTest<Expect&>(M, C_<T&&>(obj), expect);
+ runTest<Expect&>(M, C_<T const&&>(obj), expect);
+ runTest<Expect&>(M, C_<T volatile&&>(obj), expect);
+ runTest<Expect&>(M, C_<T const volatile&&>(obj), expect);
+#endif
+ }
+
+ template <class Expect, class Fn, class T>
+#if TEST_STD_VER >= 11
+ void runTest(Fn M, T&& obj, ObjectType* expect) {
+#else
+ void runTest(Fn M, T& obj, ObjectType* expect ) {
+#endif
+ static_assert((std::is_same<
+ decltype(std::__invoke(M, std::forward<T>(obj))), Expect
+ >::value), "");
+ Expect e = std::__invoke(M, std::forward<T>(obj));
+ assert(&e == expect);
+ }
+};
+
+int main() {
+ TestCase<ArgType>::run();
+ TestCase<ArgType const>::run();
+ TestCase<ArgType volatile>::run();
+ TestCase<ArgType const volatile>::run();
+ TestCase<ArgType*>::run();
+} \ No newline at end of file
diff --git a/test/std/utilities/function.objects/func.require/bullet_5.pass.cpp b/test/std/utilities/function.objects/func.require/bullet_5.pass.cpp
new file mode 100644
index 000000000000..3f3c96a9b9bd
--- /dev/null
+++ b/test/std/utilities/function.objects/func.require/bullet_5.pass.cpp
@@ -0,0 +1,327 @@
+//===----------------------------------------------------------------------===//
+//
+// The 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>
+
+// INVOKE (f, t1, t2, ..., tN)
+
+//------------------------------------------------------------------------------
+// TESTING INVOKE(f, t1, t2, ..., tN)
+// - Bullet 5 -- f(t2, ..., tN)
+//
+// Overview:
+// Bullet 5 handles the cases where the first argument is not a member
+// function.
+//
+// Concerns:
+// 1) Different types of callable objects are supported. Including
+// 1a) Free Function pointers and references.
+// 1b) Classes which provide a call operator
+// 1c) lambdas
+// 2) The callable objects are perfect forwarded.
+// 3) The arguments are perfect forwarded.
+// 4) Signatures which include varargs are supported.
+// 5) In C++03 3 extra arguments should be allowed.
+//
+// Plan:
+// 1) Define a set of free functions, 'SF', and class types with call
+// operators, 'SC', that address concerns 4 and 5. The free functions should
+// return 'FunctionID::setUncheckedCall()' and the call operators should
+// return 'MethodID::setUncheckedCall()'.
+//
+// 2) For each function 'f' in 'SF' and 'SC' attempt to call 'f'
+// using the correct number of arguments and cv-ref qualifiers. Check that
+// 'f' has been called using 'FunctionID::checkCall()' if 'f' is a free
+// function and 'MethodID::checkCall()' otherwise.
+
+
+
+#include <functional>
+#include <type_traits>
+#include <cassert>
+
+#include "test_macros.h"
+#include "invoke_helpers.h"
+
+
+//==============================================================================
+// freeFunction03 - A C++03 free function.
+void*& freeFunction03() {
+ return FunctionPtrID<void*&(), freeFunction03>::setUncheckedCall();
+}
+
+void*& freeFunction03(...) {
+ return FunctionPtrID<void*&(...), freeFunction03>::setUncheckedCall();
+}
+
+template <class A0>
+void*& freeFunction03(A0&) {
+ return FunctionPtrID<void*&(A0&), freeFunction03>::setUncheckedCall();
+}
+
+
+template <class A0>
+void*& freeFunction03(A0&, ...) {
+ return FunctionPtrID<void*&(A0&, ...), freeFunction03>::setUncheckedCall();
+}
+
+template <class A0, class A1>
+void*& freeFunction03(A0&, A1&) {
+ return FunctionPtrID<void*&(A0&, A1&), freeFunction03>::setUncheckedCall();
+}
+
+
+template <class A0, class A1>
+void*& freeFunction03(A0&, A1&, ...) {
+ return FunctionPtrID<void*&(A0&, A1&, ...), freeFunction03>::setUncheckedCall();
+}
+
+template <class A0, class A1, class A2>
+void*& freeFunction03(A0&, A1&, A2&) {
+ return FunctionPtrID<void*&(A0&, A1&, A2&), freeFunction03>::setUncheckedCall();
+}
+
+template <class A0, class A1, class A2>
+void*& freeFunction03(A0&, A1&, A2&, ...) {
+ return FunctionPtrID<void*&(A0&, A1&, A2&, ...), freeFunction03>::setUncheckedCall();
+}
+
+//==============================================================================
+// Functor03 - C++03 compatible functor object
+struct Functor03 {
+ typedef void*& R;
+ typedef Functor03 C;
+#define F(Args, ...) \
+ __VA_ARGS__ R operator() Args { return MethodID<R(C::*) Args>::setUncheckedCall(); } \
+ __VA_ARGS__ R operator() Args const { return MethodID<R(C::*) Args const>::setUncheckedCall(); } \
+ __VA_ARGS__ R operator() Args volatile { return MethodID<R(C::*) Args volatile>::setUncheckedCall(); } \
+ __VA_ARGS__ R operator() Args const volatile { return MethodID<R(C::*) Args const volatile>::setUncheckedCall(); }
+#
+ F(())
+ F((A0&), template <class A0>)
+ F((A0&, A1&), template <class A0, class A1>)
+ F((A0&, A1&, A2&), template <class A0, class A1, class A2>)
+#undef F
+public:
+ Functor03() {}
+private:
+ Functor03(Functor03 const&);
+ Functor03& operator=(Functor03 const&);
+};
+
+
+#if TEST_STD_VER >= 11
+
+//==============================================================================
+// freeFunction11 - A C++11 free function.
+template <class ...Args>
+void*& freeFunction11(Args&&...) {
+ return FunctionPtrID<void*&(Args&&...), freeFunction11>::setUncheckedCall();
+}
+
+template <class ...Args>
+void*& freeFunction11(Args&&...,...) {
+ return FunctionPtrID<void*&(Args&&...,...), freeFunction11>::setUncheckedCall();
+}
+
+//==============================================================================
+// Functor11 - C++11 reference qualified test member functions.
+struct Functor11 {
+ typedef void*& R;
+ typedef Functor11 C;
+
+#define F(CV) \
+ template <class ...Args> \
+ R operator()(Args&&...) CV { return MethodID<R(C::*)(Args&&...) CV>::setUncheckedCall(); }
+#
+ F(&)
+ F(const &)
+ F(volatile &)
+ F(const volatile &)
+ F(&&)
+ F(const &&)
+ F(volatile &&)
+ F(const volatile &&)
+#undef F
+public:
+ Functor11() {}
+private:
+ Functor11(Functor11 const&);
+ Functor11& operator=(Functor11 const&);
+};
+
+#endif // TEST_STD_VER >= 11
+
+
+//==============================================================================
+// TestCaseFunctorImp - A test case for an operator() class method.
+// ClassType - The type of the call object.
+// CallSig - The function signature of the call operator being tested.
+// Arity - the arity of 'CallSig'
+// ObjCaster - Transformation function applied to call object.
+// ArgCaster - Transformation function applied to the extra arguments.
+template <class ClassType, class CallSig, int Arity,
+ class ObjCaster, class ArgCaster = LValueCaster>
+struct TestCaseFunctorImp {
+public:
+ static void run() {
+ typedef MethodID<CallSig ClassType::*> MID;
+ BasicTest<MID, Arity, ObjCaster, ArgCaster> t;
+ typedef ClassType T;
+ typedef DerivedFromType<T> D;
+ T obj;
+ D der;
+ t.runTest(obj);
+ t.runTest(der);
+ }
+};
+
+//==============================================================================
+// TestCaseFreeFunction - A test case for a free function.
+// CallSig - The function signature of the free function being tested.
+// FnPtr - The function being tested.
+// Arity - the arity of 'CallSig'
+// ArgCaster - Transformation function to be applied to the extra arguments.
+template <class CallSig, CallSig* FnPtr, int Arity, class ArgCaster>
+struct TestCaseFreeFunction {
+public:
+ static void run() {
+ typedef FunctionPtrID<CallSig, FnPtr> FID;
+ BasicTest<FID, Arity, LValueCaster, ArgCaster> t;
+
+ DerefToType<CallSig*> deref_to(FnPtr);
+ DerefToType<CallSig&> deref_to_ref(*FnPtr);
+
+ t.runTest(FnPtr);
+ t.runTest(*FnPtr);
+ t.runTest(deref_to);
+ t.runTest(deref_to_ref);
+ }
+};
+
+//==============================================================================
+// runTest Helpers
+//==============================================================================
+#if TEST_STD_VER >= 11
+template <class Sig, int Arity, class ArgCaster>
+void runFunctionTestCase11() {
+ TestCaseFreeFunction<Sig, freeFunction11, Arity, ArgCaster>();
+}
+#endif
+
+template <class Sig, int Arity, class ArgCaster>
+void runFunctionTestCase() {
+ TestCaseFreeFunction<Sig, freeFunction03, Arity, ArgCaster>();
+#if TEST_STD_VER >= 11
+ runFunctionTestCase11<Sig, Arity, ArgCaster>();
+#endif
+}
+
+template <class Sig, int Arity, class ObjCaster, class ArgCaster>
+void runFunctorTestCase() {
+ TestCaseFunctorImp<Functor03, Sig, Arity, ObjCaster, ArgCaster>::run();
+}
+
+template <class Sig, int Arity, class ObjCaster>
+void runFunctorTestCase() {
+ TestCaseFunctorImp<Functor03, Sig, Arity, ObjCaster>::run();
+}
+
+#if TEST_STD_VER >= 11
+// runTestCase - Run a test case for C++11 class functor types
+template <class Sig, int Arity, class ObjCaster, class ArgCaster = LValueCaster>
+void runFunctorTestCase11() {
+ TestCaseFunctorImp<Functor11, Sig, Arity, ObjCaster, ArgCaster>::run();
+}
+#endif
+
+// runTestCase - Run a test case for both function and functor types.
+template <class Sig, int Arity, class ArgCaster>
+void runTestCase() {
+ runFunctionTestCase<Sig, Arity, ArgCaster>();
+ runFunctorTestCase <Sig, Arity, LValueCaster, ArgCaster>();
+};
+
+int main() {
+ typedef void*& R;
+ typedef ArgType A;
+ typedef A const CA;
+
+ runTestCase< R(), 0, LValueCaster >();
+ runTestCase< R(A&), 1, LValueCaster >();
+ runTestCase< R(A&, A&), 2, LValueCaster >();
+ runTestCase< R(A&, A&, A&), 3, LValueCaster >();
+ runTestCase< R(CA&), 1, ConstCaster >();
+ runTestCase< R(CA&, CA&), 2, ConstCaster >();
+ runTestCase< R(CA&, CA&, CA&), 3, ConstCaster >();
+
+ runFunctionTestCase<R(...), 0, LValueCaster >();
+ runFunctionTestCase<R(A&, ...), 1, LValueCaster >();
+ runFunctionTestCase<R(A&, A&, ...), 2, LValueCaster >();
+ runFunctionTestCase<R(A&, A&, A&, ...), 3, LValueCaster >();
+
+#if TEST_STD_VER >= 11
+ runFunctionTestCase11<R(A&&), 1, MoveCaster >();
+ runFunctionTestCase11<R(A&&, ...), 1, MoveCaster >();
+#endif
+
+ runFunctorTestCase<R(), 0, LValueCaster >();
+ runFunctorTestCase<R() const, 0, ConstCaster >();
+ runFunctorTestCase<R() volatile, 0, VolatileCaster >();
+ runFunctorTestCase<R() const volatile, 0, CVCaster >();
+ runFunctorTestCase<R(A&), 1, LValueCaster >();
+ runFunctorTestCase<R(A&) const, 1, ConstCaster >();
+ runFunctorTestCase<R(A&) volatile, 1, VolatileCaster >();
+ runFunctorTestCase<R(A&) const volatile, 1, CVCaster >();
+ runFunctorTestCase<R(A&, A&), 2, LValueCaster >();
+ runFunctorTestCase<R(A&, A&) const, 2, ConstCaster >();
+ runFunctorTestCase<R(A&, A&) volatile, 2, VolatileCaster >();
+ runFunctorTestCase<R(A&, A&) const volatile, 2, CVCaster >();
+ runFunctorTestCase<R(A&, A&, A&), 3, LValueCaster >();
+ runFunctorTestCase<R(A&, A&, A&) const, 3, ConstCaster >();
+ runFunctorTestCase<R(A&, A&, A&) volatile, 3, VolatileCaster >();
+ runFunctorTestCase<R(A&, A&, A&) const volatile, 3, CVCaster >();
+ {
+ typedef ConstCaster CC;
+ runFunctorTestCase<R(CA&), 1, LValueCaster, CC>();
+ runFunctorTestCase<R(CA&) const, 1, ConstCaster, CC>();
+ runFunctorTestCase<R(CA&) volatile, 1, VolatileCaster, CC>();
+ runFunctorTestCase<R(CA&) const volatile, 1, CVCaster, CC>();
+ runFunctorTestCase<R(CA&, CA&), 2, LValueCaster, CC>();
+ runFunctorTestCase<R(CA&, CA&) const, 2, ConstCaster, CC>();
+ runFunctorTestCase<R(CA&, CA&) volatile, 2, VolatileCaster, CC>();
+ runFunctorTestCase<R(CA&, CA&) const volatile, 2, CVCaster, CC>();
+ runFunctorTestCase<R(CA&, CA&, CA&), 3, LValueCaster, CC>();
+ runFunctorTestCase<R(CA&, CA&, CA&) const, 3, ConstCaster, CC>();
+ runFunctorTestCase<R(CA&, CA&, CA&) volatile, 3, VolatileCaster, CC>();
+ runFunctorTestCase<R(CA&, CA&, CA&) const volatile, 3, CVCaster, CC>();
+ }
+
+#if TEST_STD_VER >= 11
+ runFunctorTestCase11<R() &, 0, LValueCaster >();
+ runFunctorTestCase11<R() const &, 0, ConstCaster >();
+ runFunctorTestCase11<R() volatile &, 0, VolatileCaster >();
+ runFunctorTestCase11<R() const volatile &, 0, CVCaster >();
+ runFunctorTestCase11<R() &&, 0, MoveCaster >();
+ runFunctorTestCase11<R() const &&, 0, MoveConstCaster >();
+ runFunctorTestCase11<R() volatile &&, 0, MoveVolatileCaster >();
+ runFunctorTestCase11<R() const volatile &&, 0, MoveCVCaster >();
+ {
+ typedef MoveCaster MC;
+ runFunctorTestCase11<R(A&&) &, 1, LValueCaster, MC>();
+ runFunctorTestCase11<R(A&&) const &, 1, ConstCaster, MC>();
+ runFunctorTestCase11<R(A&&) volatile &, 1, VolatileCaster, MC>();
+ runFunctorTestCase11<R(A&&) const volatile &, 1, CVCaster, MC>();
+ runFunctorTestCase11<R(A&&) &&, 1, MoveCaster, MC>();
+ runFunctorTestCase11<R(A&&) const &&, 1, MoveConstCaster, MC>();
+ runFunctorTestCase11<R(A&&) volatile &&, 1, MoveVolatileCaster, MC>();
+ runFunctorTestCase11<R(A&&) const volatile &&, 1, MoveCVCaster, MC>();
+ }
+#endif
+}
diff --git a/test/std/utilities/function.objects/func.require/invoke_helpers.h b/test/std/utilities/function.objects/func.require/invoke_helpers.h
new file mode 100644
index 000000000000..0583b624da31
--- /dev/null
+++ b/test/std/utilities/function.objects/func.require/invoke_helpers.h
@@ -0,0 +1,317 @@
+#ifndef INVOKE_HELPERS_H
+#define INVOKE_HELPERS_H
+
+#include <type_traits>
+#include <cassert>
+#include <functional>
+
+#include "test_macros.h"
+
+template <int I>
+struct Int : public std::integral_constant<int, I> {};
+
+template <bool P>
+struct Bool : public std::integral_constant<bool, P> {};
+
+struct Q_None {
+ template <class T>
+ struct apply { typedef T type; };
+};
+
+struct Q_Const {
+ template <class T>
+ struct apply { typedef T const type; };
+};
+
+struct Q_Volatile {
+ template <class T>
+ struct apply { typedef T volatile type; };
+};
+
+struct Q_CV {
+ template <class T>
+ struct apply { typedef T const volatile type; };
+};
+
+// Caster - A functor object that performs cv-qualifier and value category
+// conversions.
+// QualTag - A metafunction type that applies cv-qualifiers to its argument.
+// RValue - True if the resulting object should be an RValue reference.
+// False otherwise.
+template <class QualTag, bool RValue = false>
+struct Caster {
+ template <class T>
+ struct apply {
+ typedef typename std::remove_reference<T>::type RawType;
+ typedef typename QualTag::template apply<RawType>::type CVType;
+#if TEST_STD_VER >= 11
+ typedef typename std::conditional<RValue,
+ CVType&&, CVType&
+ >::type type;
+#else
+ typedef CVType& type;
+#endif
+ };
+
+ template <class T>
+ typename apply<T>::type
+ operator()(T& obj) const {
+ typedef typename apply<T>::type OutType;
+ return static_cast<OutType>(obj);
+ }
+};
+
+typedef Caster<Q_None> LValueCaster;
+typedef Caster<Q_Const> ConstCaster;
+typedef Caster<Q_Volatile> VolatileCaster;
+typedef Caster<Q_CV> CVCaster;
+typedef Caster<Q_None, true> MoveCaster;
+typedef Caster<Q_Const, true> MoveConstCaster;
+typedef Caster<Q_Volatile, true> MoveVolatileCaster;
+typedef Caster<Q_CV, true> MoveCVCaster;
+
+// A shorter name for 'static_cast'
+template <class QualType, class Tp>
+QualType C_(Tp& v) { return static_cast<QualType>(v); };
+
+//==============================================================================
+// ArgType - A non-copyable type intended to be used as a dummy argument type
+// to test functions.
+struct ArgType {
+ int value;
+ explicit ArgType(int val = 0) : value(val) {}
+private:
+ ArgType(ArgType const&);
+ ArgType& operator=(ArgType const&);
+};
+
+//==============================================================================
+// DerivedFromBase - A type that derives from it's template argument 'Base'
+template <class Base>
+struct DerivedFromType : public Base {
+ DerivedFromType() : Base() {}
+ template <class Tp>
+ explicit DerivedFromType(Tp const& t) : Base(t) {}
+};
+
+//==============================================================================
+// DerefToType - A type that dereferences to it's template argument 'To'.
+// The cv-ref qualifiers of the 'DerefToType' object do not propagate
+// to the resulting 'To' object.
+template <class To>
+struct DerefToType {
+ To object;
+
+ DerefToType() {}
+
+ template <class Up>
+ explicit DerefToType(Up const& val) : object(val) {}
+
+ To& operator*() const volatile { return const_cast<To&>(object); }
+};
+
+//==============================================================================
+// DerefPropToType - A type that dereferences to it's template argument 'To'.
+// The cv-ref qualifiers of the 'DerefPropToType' object propagate
+// to the resulting 'To' object.
+template <class To>
+struct DerefPropType {
+ To object;
+
+ DerefPropType() {}
+
+ template <class Up>
+ explicit DerefPropType(Up const& val) : object(val) {}
+
+#if TEST_STD_VER < 11
+ To& operator*() { return object; }
+ To const& operator*() const { return object; }
+ To volatile& operator*() volatile { return object; }
+ To const volatile& operator*() const volatile { return object; }
+#else
+ To& operator*() & { return object; }
+ To const& operator*() const & { return object; }
+ To volatile& operator*() volatile & { return object; }
+ To const volatile& operator*() const volatile & { return object; }
+ To&& operator*() && { return static_cast<To &&>(object); }
+ To const&& operator*() const && { return static_cast<To const&&>(object); }
+ To volatile&& operator*() volatile && { return static_cast<To volatile&&>(object); }
+ To const volatile&& operator*() const volatile && { return static_cast<To const volatile&&>(object); }
+#endif
+};
+
+//==============================================================================
+// MethodID - A type that uniquely identifies a member function for a class.
+// This type is used to communicate between the member functions being tested
+// and the tests invoking them.
+// - Test methods should call 'setUncheckedCall()' whenever they are invoked.
+// - Tests consume the unchecked call using checkCall(<return-value>)` to assert
+// that the method has been called and that the return value of `__invoke`
+// matches what the method actually returned.
+template <class T>
+struct MethodID {
+ typedef void* IDType;
+
+ static int dummy; // A dummy memory location.
+ static void* id; // The "ID" is the value of this pointer.
+ static bool unchecked_call; // Has a call happened that has not been checked.
+
+ static void*& setUncheckedCall() {
+ assert(unchecked_call == false);
+ unchecked_call = true;
+ return id;
+ }
+
+ static bool checkCalled(void*& return_value) {
+ bool old = unchecked_call;
+ unchecked_call = false;
+ return old && id == return_value && &id == &return_value;
+ }
+};
+
+template <class T> int MethodID<T>::dummy = 0;
+template <class T> void* MethodID<T>::id = (void*)&MethodID<T>::dummy;
+template <class T> bool MethodID<T>::unchecked_call = false;
+
+
+//==============================================================================
+// FunctionPtrID - Like MethodID but for free function pointers.
+template <class T, T*>
+struct FunctionPtrID {
+ static int dummy; // A dummy memory location.
+ static void* id; // The "ID" is the value of this pointer.
+ static bool unchecked_call; // Has a call happened that has not been checked.
+
+ static void*& setUncheckedCall() {
+ assert(unchecked_call == false);
+ unchecked_call = true;
+ return id;
+ }
+
+ static bool checkCalled(void*& return_value) {
+ bool old = unchecked_call;
+ unchecked_call = false;
+ return old && id == return_value && &id == &return_value;
+ }
+};
+
+template <class T, T* Ptr> int FunctionPtrID<T, Ptr>::dummy = 0;
+template <class T, T* Ptr> void* FunctionPtrID<T, Ptr>::id = (void*)&FunctionPtrID<T, Ptr>::dummy;
+template <class T, T* Ptr> bool FunctionPtrID<T, Ptr>::unchecked_call = false;
+
+//==============================================================================
+// BasicTest - The basic test structure for everything except
+// member object pointers.
+// ID - The "Function Identifier" type used either MethodID or FunctionPtrID.
+// Arity - The Arity of the call signature.
+// ObjectCaster - The object transformation functor type.
+// ArgCaster - The extra argument transformation functor type.
+template <class ID, int Arity, class ObjectCaster = LValueCaster,
+ class ArgCaster = LValueCaster>
+struct BasicTest {
+ template <class ObjectT>
+ void runTest(ObjectT& object) {
+ Int<Arity> A;
+ runTestImp(A, object);
+ }
+
+ template <class MethodPtr, class ObjectT>
+ void runTest(MethodPtr ptr, ObjectT& object) {
+ Int<Arity> A;
+ runTestImp(A, ptr, object);
+ }
+
+private:
+ typedef void*& CallRet;
+ ObjectCaster object_cast;
+ ArgCaster arg_cast;
+ ArgType a0, a1, a2;
+
+ //==========================================================================
+ // BULLET 1 AND 2 TEST METHODS
+ //==========================================================================
+ template <class MethodPtr, class ObjectT>
+ void runTestImp(Int<0>, MethodPtr ptr, ObjectT& object) {
+ static_assert((std::is_same<
+ decltype(std::__invoke(ptr, object_cast(object)))
+ , CallRet>::value), "");
+ assert(ID::unchecked_call == false);
+ CallRet ret = std::__invoke(ptr, object_cast(object));
+ assert(ID::checkCalled(ret));
+ }
+
+ template <class MethodPtr, class ObjectT>
+ void runTestImp(Int<1>, MethodPtr ptr, ObjectT& object) {
+ static_assert((std::is_same<
+ decltype(std::__invoke(ptr, object_cast(object), arg_cast(a0)))
+ , CallRet>::value), "");
+ assert(ID::unchecked_call == false);
+ CallRet ret = std::__invoke(ptr, object_cast(object), arg_cast(a0));
+ assert(ID::checkCalled(ret));
+ }
+
+ template <class MethodPtr, class ObjectT>
+ void runTestImp(Int<2>, MethodPtr ptr, ObjectT& object) {
+ static_assert((std::is_same<
+ decltype(std::__invoke(ptr, object_cast(object), arg_cast(a0), arg_cast(a1)))
+ , CallRet>::value), "");
+ assert(ID::unchecked_call == false);
+ CallRet ret = std::__invoke(ptr, object_cast(object), arg_cast(a0), arg_cast(a1));
+ assert(ID::checkCalled(ret));
+ }
+
+ template <class MethodPtr, class ObjectT>
+ void runTestImp(Int<3>, MethodPtr ptr, ObjectT& object) {
+ static_assert((std::is_same<
+ decltype(std::__invoke(ptr, object_cast(object), arg_cast(a0), arg_cast(a1), arg_cast(a2)))
+ , CallRet>::value), "");
+ assert(ID::unchecked_call == false);
+ CallRet ret = std::__invoke(ptr, object_cast(object), arg_cast(a0), arg_cast(a1), arg_cast(a2));
+ assert(ID::checkCalled(ret));
+ }
+
+ //==========================================================================
+ // BULLET 5 TEST METHODS
+ //==========================================================================
+ template <class ObjectT>
+ void runTestImp(Int<0>, ObjectT& object) {
+ static_assert((std::is_same<
+ decltype(std::__invoke(object_cast(object)))
+ , CallRet>::value), "");
+ assert(ID::unchecked_call == false);
+ CallRet ret = std::__invoke(object_cast(object));
+ assert(ID::checkCalled(ret));
+ }
+
+ template <class ObjectT>
+ void runTestImp(Int<1>, ObjectT& object) {
+ static_assert((std::is_same<
+ decltype(std::__invoke(object_cast(object), arg_cast(a0)))
+ , CallRet>::value), "");
+ assert(ID::unchecked_call == false);
+ CallRet ret = std::__invoke(object_cast(object), arg_cast(a0));
+ assert(ID::checkCalled(ret));
+ }
+
+ template <class ObjectT>
+ void runTestImp(Int<2>, ObjectT& object) {
+ static_assert((std::is_same<
+ decltype(std::__invoke(object_cast(object), arg_cast(a0), arg_cast(a1)))
+ , CallRet>::value), "");
+ assert(ID::unchecked_call == false);
+ CallRet ret = std::__invoke(object_cast(object), arg_cast(a0), arg_cast(a1));
+ assert(ID::checkCalled(ret));
+ }
+
+ template <class ObjectT>
+ void runTestImp(Int<3>, ObjectT& object) {
+ static_assert((std::is_same<
+ decltype(std::__invoke(object_cast(object), arg_cast(a0), arg_cast(a1), arg_cast(a2)))
+ , CallRet>::value), "");
+ assert(ID::unchecked_call == false);
+ CallRet ret = std::__invoke(object_cast(object), arg_cast(a0), arg_cast(a1), arg_cast(a2));
+ assert(ID::checkCalled(ret));
+ }
+};
+
+#endif // INVOKE_HELPERS_H
diff --git a/test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/F.pass.cpp b/test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/F.pass.cpp
index cd86e4cbf8eb..82a6f6c5215e 100644
--- a/test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/F.pass.cpp
+++ b/test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/F.pass.cpp
@@ -11,7 +11,7 @@
// class function<R(ArgTypes...)>
-// function(nullptr_t);
+// function(F);
#include <functional>
#include <cassert>
@@ -87,4 +87,8 @@ int main()
assert(f.target<int(*)(int)>() != 0);
f(1);
}
+ {
+ std::function <void()> f(static_cast<void (*)()>(0));
+ assert(!f);
+ }
}
diff --git a/test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/F_nullptr.pass.cpp b/test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/F_nullptr.pass.cpp
new file mode 100644
index 000000000000..f89bde8e6544
--- /dev/null
+++ b/test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/F_nullptr.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <functional>
+
+// class function<R(ArgTypes...)>
+
+// function(Fp);
+
+// Ensure that __not_null works for all function types.
+// See https://llvm.org/bugs/show_bug.cgi?id=23589
+
+//------------------------------------------------------------------------------
+// TESTING std::function<...>::__not_null(Callable)
+//
+// Concerns:
+// 1) The call __not_null(Callable) is well formed and correct for each
+// possible 'Callable' type category. These categories include:
+// 1a) function pointers
+// 1b) member function pointer
+// 1c) member data pointer
+// 1d) callable class type
+// 1e) lambdas
+// Categories 1a, 1b, and 1c are 'Nullable' types. Only objects of these
+// types can be null. The other categories are not tested here.
+// 3) '__not_null(Callable)' is well formed when the call signature includes
+// varargs.
+// 4) '__not_null(Callable)' works for Callable types with all aritys less
+// than or equal to 3 in C++03.
+// 5) '__not_null(Callable)' works when 'Callable' is a member function
+// pointer to a cv or ref qualified function type.
+//
+// Plan:
+// 1 For categories 1a, 1b and 1c define a set of
+// 'Callable' objects for this category. This set should include examples
+// of arity 0, 1, 2 and possible 3 including versions with varargs as the
+// last parameter.
+//
+// 2 For each 'Callable' object in categories 1a, 1b and 1c do the following.
+//
+// 1 Define a type 'std::function<Sig>' as 'F' where 'Sig' is compatible with
+// the signature of the 'Callable' object.
+//
+// 2 Create an object of type 'F' using a null pointer of type 'Callable'.
+// Check that 'F.target<Callable>()' is null.
+//
+// 3 Create an object of type 'F' that is not null. Check that
+// 'F.target<Callable>()' is not null and is equal to the original
+// argument.
+
+#include <functional>
+#include <type_traits>
+#include <cassert>
+
+#include "test_macros.h"
+
+///////////////////////////////////////////////////////////////////////////////
+int foo() { return 42; }
+int foo(int) { return 42; }
+int foo(int, int) { return 42; }
+int foo(int, int, int) { return 42; }
+
+int foo(...) { return 42; }
+int foo(int, ...) { return 42; }
+int foo(int, int, ...) { return 42; }
+int foo(int, int, int, ...) { return 42; }
+
+///////////////////////////////////////////////////////////////////////////////
+struct MemFun03 {
+ int foo() { return 42; }
+ int foo() const { return 42; }
+ int foo() volatile { return 42; }
+ int foo() const volatile { return 42; }
+
+ int foo(int) { return 42; }
+ int foo(int) const { return 42; }
+ int foo(int) volatile { return 42; }
+ int foo(int) const volatile { return 42; }
+
+ int foo(int, int) { return 42; }
+ int foo(int, int) const { return 42; }
+ int foo(int, int) volatile { return 42; }
+ int foo(int, int) const volatile { return 42; }
+
+ int foo(int, int, int) { return 42; }
+ int foo(int, int, int) const { return 42; }
+ int foo(int, int, int) volatile { return 42; }
+ int foo(int, int, int) const volatile { return 42; }
+
+ int foo(...) { return 42; }
+ int foo(...) const { return 42; }
+ int foo(...) volatile { return 42; }
+ int foo(...) const volatile { return 42; }
+
+ int foo(int, ...) { return 42; }
+ int foo(int, ...) const { return 42; }
+ int foo(int, ...) volatile { return 42; }
+ int foo(int, ...) const volatile { return 42; }
+
+ int foo(int, int, ...) { return 42; }
+ int foo(int, int, ...) const { return 42; }
+ int foo(int, int, ...) volatile { return 42; }
+ int foo(int, int, ...) const volatile { return 42; }
+
+ int foo(int, int, int, ...) { return 42; }
+ int foo(int, int, int, ...) const { return 42; }
+ int foo(int, int, int, ...) volatile { return 42; }
+ int foo(int, int, int, ...) const volatile { return 42; }
+};
+
+#if TEST_STD_VER >= 11
+struct MemFun11 {
+ int foo() & { return 42; }
+ int foo() const & { return 42; }
+ int foo() volatile & { return 42; }
+ int foo() const volatile & { return 42; }
+
+ int foo(...) & { return 42; }
+ int foo(...) const & { return 42; }
+ int foo(...) volatile & { return 42; }
+ int foo(...) const volatile & { return 42; }
+
+ int foo() && { return 42; }
+ int foo() const && { return 42; }
+ int foo() volatile && { return 42; }
+ int foo() const volatile && { return 42; }
+
+ int foo(...) && { return 42; }
+ int foo(...) const && { return 42; }
+ int foo(...) volatile && { return 42; }
+ int foo(...) const volatile && { return 42; }
+};
+#endif // TEST_STD_VER >= 11
+
+struct MemData {
+ int foo;
+};
+
+// Create a non-null free function by taking the address of
+// &static_cast<Tp&>(foo);
+template <class Tp>
+struct Creator {
+ static Tp create() {
+ return &foo;
+ }
+};
+
+// Create a non-null member pointer.
+template <class Ret, class Class>
+struct Creator<Ret Class::*> {
+ typedef Ret Class::*ReturnType;
+ static ReturnType create() {
+ return &Class::foo;
+ }
+};
+
+template <class TestFn, class Fn>
+void test_imp() {
+ { // Check that the null value is detected
+ TestFn tf = nullptr;
+ std::function<Fn> f = tf;
+ assert(f.template target<TestFn>() == nullptr);
+ }
+ { // Check that the non-null value is detected.
+ TestFn tf = Creator<TestFn>::create();
+ assert(tf != nullptr);
+ std::function<Fn> f = tf;
+ assert(f.template target<TestFn>() != nullptr);
+ assert(*f.template target<TestFn>() == tf);
+ }
+}
+
+void test_func() {
+ test_imp<int(*)(), int()>();
+ test_imp<int(*)(...), int()>();
+ test_imp<int(*)(int), int(int)>();
+ test_imp<int(*)(int, ...), int(int)>();
+ test_imp<int(*)(int, int), int(int, int)>();
+ test_imp<int(*)(int, int, ...), int(int, int)>();
+ test_imp<int(*)(int, int, int), int(int, int, int)>();
+ test_imp<int(*)(int, int, int, ...), int(int, int, int)>();
+}
+
+void test_mf() {
+ test_imp<int(MemFun03::*)(), int(MemFun03&)>();
+ test_imp<int(MemFun03::*)(...), int(MemFun03&)>();
+ test_imp<int(MemFun03::*)() const, int(MemFun03&)>();
+ test_imp<int(MemFun03::*)(...) const, int(MemFun03&)>();
+ test_imp<int(MemFun03::*)() volatile, int(MemFun03&)>();
+ test_imp<int(MemFun03::*)(...) volatile, int(MemFun03&)>();
+ test_imp<int(MemFun03::*)() const volatile, int(MemFun03&)>();
+ test_imp<int(MemFun03::*)(...) const volatile, int(MemFun03&)>();
+
+ test_imp<int(MemFun03::*)(int), int(MemFun03&, int)>();
+ test_imp<int(MemFun03::*)(int, ...), int(MemFun03&, int)>();
+ test_imp<int(MemFun03::*)(int) const, int(MemFun03&, int)>();
+ test_imp<int(MemFun03::*)(int, ...) const, int(MemFun03&, int)>();
+ test_imp<int(MemFun03::*)(int) volatile, int(MemFun03&, int)>();
+ test_imp<int(MemFun03::*)(int, ...) volatile, int(MemFun03&, int)>();
+ test_imp<int(MemFun03::*)(int) const volatile, int(MemFun03&, int)>();
+ test_imp<int(MemFun03::*)(int, ...) const volatile, int(MemFun03&, int)>();
+
+ test_imp<int(MemFun03::*)(int, int), int(MemFun03&, int, int)>();
+ test_imp<int(MemFun03::*)(int, int, ...), int(MemFun03&, int, int)>();
+ test_imp<int(MemFun03::*)(int, int) const, int(MemFun03&, int, int)>();
+ test_imp<int(MemFun03::*)(int, int, ...) const, int(MemFun03&, int, int)>();
+ test_imp<int(MemFun03::*)(int, int) volatile, int(MemFun03&, int, int)>();
+ test_imp<int(MemFun03::*)(int, int, ...) volatile, int(MemFun03&, int, int)>();
+ test_imp<int(MemFun03::*)(int, int) const volatile, int(MemFun03&, int, int)>();
+ test_imp<int(MemFun03::*)(int, int, ...) const volatile, int(MemFun03&, int, int)>();
+
+#if TEST_STD_VER >= 11
+ test_imp<int(MemFun11::*)() &, int(MemFun11&)>();
+ test_imp<int(MemFun11::*)(...) &, int(MemFun11&)>();
+ test_imp<int(MemFun11::*)() const &, int(MemFun11&)>();
+ test_imp<int(MemFun11::*)(...) const &, int(MemFun11&)>();
+ test_imp<int(MemFun11::*)() volatile &, int(MemFun11&)>();
+ test_imp<int(MemFun11::*)(...) volatile &, int(MemFun11&)>();
+ test_imp<int(MemFun11::*)() const volatile &, int(MemFun11&)>();
+ test_imp<int(MemFun11::*)(...) const volatile &, int(MemFun11&)>();
+
+ test_imp<int(MemFun11::*)() &&, int(MemFun11&&)>();
+ test_imp<int(MemFun11::*)(...) &&, int(MemFun11&&)>();
+ test_imp<int(MemFun11::*)() const &&, int(MemFun11&&)>();
+ test_imp<int(MemFun11::*)(...) const &&, int(MemFun11&&)>();
+ test_imp<int(MemFun11::*)() volatile &&, int(MemFun11&&)>();
+ test_imp<int(MemFun11::*)(...) volatile &&, int(MemFun11&&)>();
+ test_imp<int(MemFun11::*)() const volatile &&, int(MemFun11&&)>();
+ test_imp<int(MemFun11::*)(...) const volatile &&, int(MemFun11&&)>();
+#endif
+}
+
+void test_md() {
+ test_imp<int MemData::*, int(MemData&)>();
+}
+
+int main() {
+ test_func();
+ test_mf();
+ test_md();
+}
diff --git a/test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.inv/invoke.fail.cpp b/test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.inv/invoke.fail.cpp
index 6dcd2857452c..61eda7244d3b 100644
--- a/test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.inv/invoke.fail.cpp
+++ b/test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.inv/invoke.fail.cpp
@@ -30,13 +30,13 @@ test_int_1()
{
// member data pointer
{
- int A_int_1::*fp = &A_int_1::data_;
- A_int_1 a;
- std::function<int& (const A_int_1*)> r2(fp);
- const A_int_1* ap = &a;
- assert(r2(ap) == 6);
- r2(ap) = 7;
- assert(r2(ap) == 7);
+ int A_int_1::*fp = &A_int_1::data_;
+ A_int_1 a;
+ std::function<int& (const A_int_1*)> r2(fp);
+ const A_int_1* ap = &a;
+ assert(r2(ap) == 6);
+ r2(ap) = 7;
+ assert(r2(ap) == 7);
}
}
diff --git a/test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.inv/invoke.pass.cpp b/test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.inv/invoke.pass.cpp
index 31b80c3323c1..cc4315c14422 100644
--- a/test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.inv/invoke.pass.cpp
+++ b/test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.inv/invoke.pass.cpp
@@ -16,8 +16,85 @@
#include <functional>
#include <cassert>
+
int count = 0;
+
+// 0 args, return int
+
+int f_int_0()
+{
+ return 3;
+}
+
+struct A_int_0
+{
+ int operator()() {return 4;}
+};
+
+void test_int_0()
+{
+ // function
+ {
+ std::function<int ()> r1(f_int_0);
+ assert(r1() == 3);
+ }
+ // function pointer
+ {
+ int (*fp)() = f_int_0;
+ std::function<int ()> r1(fp);
+ assert(r1() == 3);
+ }
+ // functor
+ {
+ A_int_0 a0;
+ std::function<int ()> r1(a0);
+ assert(r1() == 4);
+ }
+}
+
+
+// 0 args, return void
+
+void f_void_0()
+{
+ ++count;
+}
+
+struct A_void_0
+{
+ void operator()() {++count;}
+};
+
+void
+test_void_0()
+{
+ int save_count = count;
+ // function
+ {
+ std::function<void ()> r1(f_void_0);
+ r1();
+ assert(count == save_count+1);
+ save_count = count;
+ }
+ // function pointer
+ {
+ void (*fp)() = f_void_0;
+ std::function<void ()> r1(fp);
+ r1();
+ assert(count == save_count+1);
+ save_count = count;
+ }
+ // functor
+ {
+ A_void_0 a0;
+ std::function<void ()> r1(a0);
+ r1();
+ assert(count == save_count+1);
+ save_count = count;
+ }
+}
+
// 1 arg, return void
void f_void_1(int i)
@@ -42,57 +119,57 @@ test_void_1()
int save_count = count;
// function
{
- std::function<void (int)> r1(f_void_1);
- int i = 2;
- r1(i);
- assert(count == save_count+2);
- save_count = count;
+ std::function<void (int)> r1(f_void_1);
+ int i = 2;
+ r1(i);
+ assert(count == save_count+2);
+ save_count = count;
}
// function pointer
{
- void (*fp)(int) = f_void_1;
- std::function<void (int)> r1(fp);
- int i = 3;
- r1(i);
- assert(count == save_count+3);
- save_count = count;
+ void (*fp)(int) = f_void_1;
+ std::function<void (int)> r1(fp);
+ int i = 3;
+ r1(i);
+ assert(count == save_count+3);
+ save_count = count;
}
// functor
{
- A_void_1 a0;
- std::function<void (int)> r1(a0);
- int i = 4;
- r1(i);
- assert(count == save_count+4);
- save_count = count;
+ A_void_1 a0;
+ std::function<void (int)> r1(a0);
+ int i = 4;
+ r1(i);
+ assert(count == save_count+4);
+ save_count = count;
}
// member function pointer
{
- void (A_void_1::*fp)() = &A_void_1::mem1;
- std::function<void (A_void_1)> r1(fp);
- A_void_1 a;
- r1(a);
- assert(count == save_count+1);
- save_count = count;
- A_void_1* ap = &a;
- std::function<void (A_void_1*)> r2 = fp;
- r2(ap);
- assert(count == save_count+1);
- save_count = count;
+ void (A_void_1::*fp)() = &A_void_1::mem1;
+ std::function<void (A_void_1)> r1(fp);
+ A_void_1 a;
+ r1(a);
+ assert(count == save_count+1);
+ save_count = count;
+ A_void_1* ap = &a;
+ std::function<void (A_void_1*)> r2 = fp;
+ r2(ap);
+ assert(count == save_count+1);
+ save_count = count;
}
// const member function pointer
{
- void (A_void_1::*fp)() const = &A_void_1::mem2;
- std::function<void (A_void_1)> r1(fp);
- A_void_1 a;
- r1(a);
- assert(count == save_count+1);
- save_count = count;
- std::function<void (A_void_1*)> r2(fp);
- A_void_1* ap = &a;
- r2(ap);
- assert(count == save_count+1);
- save_count = count;
+ void (A_void_1::*fp)() const = &A_void_1::mem2;
+ std::function<void (A_void_1)> r1(fp);
+ A_void_1 a;
+ r1(a);
+ assert(count == save_count+1);
+ save_count = count;
+ std::function<void (A_void_1*)> r2(fp);
+ A_void_1* ap = &a;
+ r2(ap);
+ assert(count == save_count+1);
+ save_count = count;
}
}
@@ -121,57 +198,57 @@ test_int_1()
{
// function
{
- std::function<int (int)> r1(f_int_1);
- int i = 2;
- assert(r1(i) == 3);
+ std::function<int (int)> r1(f_int_1);
+ int i = 2;
+ assert(r1(i) == 3);
}
// function pointer
{
- int (*fp)(int) = f_int_1;
- std::function<int (int)> r1(fp);
- int i = 3;
- assert(r1(i) == 4);
+ int (*fp)(int) = f_int_1;
+ std::function<int (int)> r1(fp);
+ int i = 3;
+ assert(r1(i) == 4);
}
// functor
{
- A_int_1 a0;
- std::function<int (int)> r1(a0);
- int i = 4;
- assert(r1(i) == 3);
+ A_int_1 a0;
+ std::function<int (int)> r1(a0);
+ int i = 4;
+ assert(r1(i) == 3);
}
// member function pointer
{
- int (A_int_1::*fp)() = &A_int_1::mem1;
- std::function<int (A_int_1)> r1(fp);
- A_int_1 a;
- assert(r1(a) == 3);
- std::function<int (A_int_1*)> r2(fp);
- A_int_1* ap = &a;
- assert(r2(ap) == 3);
+ int (A_int_1::*fp)() = &A_int_1::mem1;
+ std::function<int (A_int_1)> r1(fp);
+ A_int_1 a;
+ assert(r1(a) == 3);
+ std::function<int (A_int_1*)> r2(fp);
+ A_int_1* ap = &a;
+ assert(r2(ap) == 3);
}
// const member function pointer
{
- int (A_int_1::*fp)() const = &A_int_1::mem2;
- std::function<int (A_int_1)> r1(fp);
- A_int_1 a;
- assert(r1(a) == 4);
- std::function<int (A_int_1*)> r2(fp);
- A_int_1* ap = &a;
- assert(r2(ap) == 4);
+ int (A_int_1::*fp)() const = &A_int_1::mem2;
+ std::function<int (A_int_1)> r1(fp);
+ A_int_1 a;
+ assert(r1(a) == 4);
+ std::function<int (A_int_1*)> r2(fp);
+ A_int_1* ap = &a;
+ assert(r2(ap) == 4);
}
// member data pointer
{
- int A_int_1::*fp = &A_int_1::data_;
- std::function<int& (A_int_1&)> r1(fp);
- A_int_1 a;
- assert(r1(a) == 5);
- r1(a) = 6;
- assert(r1(a) == 6);
- std::function<int& (A_int_1*)> r2(fp);
- A_int_1* ap = &a;
- assert(r2(ap) == 6);
- r2(ap) = 7;
- assert(r2(ap) == 7);
+ int A_int_1::*fp = &A_int_1::data_;
+ std::function<int& (A_int_1&)> r1(fp);
+ A_int_1 a;
+ assert(r1(a) == 5);
+ r1(a) = 6;
+ assert(r1(a) == 6);
+ std::function<int& (A_int_1*)> r2(fp);
+ A_int_1* ap = &a;
+ assert(r2(ap) == 6);
+ r2(ap) = 7;
+ assert(r2(ap) == 7);
}
}
@@ -199,62 +276,62 @@ test_void_2()
int save_count = count;
// function
{
- std::function<void (int, int)> r1(f_void_2);
- int i = 2;
- int j = 3;
- r1(i, j);
- assert(count == save_count+5);
- save_count = count;
+ std::function<void (int, int)> r1(f_void_2);
+ int i = 2;
+ int j = 3;
+ r1(i, j);
+ assert(count == save_count+5);
+ save_count = count;
}
// function pointer
{
- void (*fp)(int, int) = f_void_2;
- std::function<void (int, int)> r1(fp);
- int i = 3;
- int j = 4;
- r1(i, j);
- assert(count == save_count+7);
- save_count = count;
+ void (*fp)(int, int) = f_void_2;
+ std::function<void (int, int)> r1(fp);
+ int i = 3;
+ int j = 4;
+ r1(i, j);
+ assert(count == save_count+7);
+ save_count = count;
}
// functor
{
- A_void_2 a0;
- std::function<void (int, int)> r1(a0);
- int i = 4;
- int j = 5;
- r1(i, j);
- assert(count == save_count+9);
- save_count = count;
+ A_void_2 a0;
+ std::function<void (int, int)> r1(a0);
+ int i = 4;
+ int j = 5;
+ r1(i, j);
+ assert(count == save_count+9);
+ save_count = count;
}
// member function pointer
{
- void (A_void_2::*fp)(int) = &A_void_2::mem1;
- std::function<void (A_void_2, int)> r1(fp);
- A_void_2 a;
- int i = 3;
- r1(a, i);
- assert(count == save_count+3);
- save_count = count;
- std::function<void (A_void_2*, int)> r2(fp);
- A_void_2* ap = &a;
- r2(ap, i);
- assert(count == save_count+3);
- save_count = count;
+ void (A_void_2::*fp)(int) = &A_void_2::mem1;
+ std::function<void (A_void_2, int)> r1(fp);
+ A_void_2 a;
+ int i = 3;
+ r1(a, i);
+ assert(count == save_count+3);
+ save_count = count;
+ std::function<void (A_void_2*, int)> r2(fp);
+ A_void_2* ap = &a;
+ r2(ap, i);
+ assert(count == save_count+3);
+ save_count = count;
}
// const member function pointer
{
- void (A_void_2::*fp)(int) const = &A_void_2::mem2;
- std::function<void (A_void_2, int)> r1(fp);
- A_void_2 a;
- int i = 4;
- r1(a, i);
- assert(count == save_count+4);
- save_count = count;
- std::function<void (A_void_2*, int)> r2(fp);
- A_void_2* ap = &a;
- r2(ap, i);
- assert(count == save_count+4);
- save_count = count;
+ void (A_void_2::*fp)(int) const = &A_void_2::mem2;
+ std::function<void (A_void_2, int)> r1(fp);
+ A_void_2 a;
+ int i = 4;
+ r1(a, i);
+ assert(count == save_count+4);
+ save_count = count;
+ std::function<void (A_void_2*, int)> r2(fp);
+ A_void_2* ap = &a;
+ r2(ap, i);
+ assert(count == save_count+4);
+ save_count = count;
}
}
@@ -276,60 +353,61 @@ struct A_int_2
int mem2(int i) const {return i+2;}
};
-void
-testint_2()
+void test_int_2()
{
// function
{
- std::function<int (int, int)> r1(f_int_2);
- int i = 2;
- int j = 3;
- assert(r1(i, j) == i+j);
+ std::function<int (int, int)> r1(f_int_2);
+ int i = 2;
+ int j = 3;
+ assert(r1(i, j) == i+j);
}
// function pointer
{
- int (*fp)(int, int) = f_int_2;
- std::function<int (int, int)> r1(fp);
- int i = 3;
- int j = 4;
- assert(r1(i, j) == i+j);
+ int (*fp)(int, int) = f_int_2;
+ std::function<int (int, int)> r1(fp);
+ int i = 3;
+ int j = 4;
+ assert(r1(i, j) == i+j);
}
// functor
{
- A_int_2 a0;
- std::function<int (int, int)> r1(a0);
- int i = 4;
- int j = 5;
- assert(r1(i, j) == i+j);
+ A_int_2 a0;
+ std::function<int (int, int)> r1(a0);
+ int i = 4;
+ int j = 5;
+ assert(r1(i, j) == i+j);
}
// member function pointer
{
- int(A_int_2::*fp)(int) = &A_int_2::mem1;
- std::function<int (A_int_2, int)> r1(fp);
- A_int_2 a;
- int i = 3;
- assert(r1(a, i) == i+1);
- std::function<int (A_int_2*, int)> r2(fp);
- A_int_2* ap = &a;
- assert(r2(ap, i) == i+1);
+ int(A_int_2::*fp)(int) = &A_int_2::mem1;
+ std::function<int (A_int_2, int)> r1(fp);
+ A_int_2 a;
+ int i = 3;
+ assert(r1(a, i) == i+1);
+ std::function<int (A_int_2*, int)> r2(fp);
+ A_int_2* ap = &a;
+ assert(r2(ap, i) == i+1);
}
// const member function pointer
{
- int (A_int_2::*fp)(int) const = &A_int_2::mem2;
- std::function<int (A_int_2, int)> r1(fp);
- A_int_2 a;
- int i = 4;
- assert(r1(a, i) == i+2);
- std::function<int (A_int_2*, int)> r2(fp);
- A_int_2* ap = &a;
- assert(r2(ap, i) == i+2);
+ int (A_int_2::*fp)(int) const = &A_int_2::mem2;
+ std::function<int (A_int_2, int)> r1(fp);
+ A_int_2 a;
+ int i = 4;
+ assert(r1(a, i) == i+2);
+ std::function<int (A_int_2*, int)> r2(fp);
+ A_int_2* ap = &a;
+ assert(r2(ap, i) == i+2);
}
}
int main()
{
+ test_void_0();
+ test_int_0();
test_void_1();
test_int_1();
test_void_2();
- testint_2();
+ test_int_2();
}
diff --git a/test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.inv/invoke_int_0.pass.cpp b/test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.inv/invoke_int_0.pass.cpp
deleted file mode 100644
index 67b4ec22da8c..000000000000
--- a/test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.inv/invoke_int_0.pass.cpp
+++ /dev/null
@@ -1,58 +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.
-//
-//===----------------------------------------------------------------------===//
-
-// <functional>
-
-// class function<R(ArgTypes...)>
-
-// R operator()(ArgTypes... args) const
-
-#include <functional>
-#include <cassert>
-
-// 0 args, return int
-
-int count = 0;
-
-int f_int_0()
-{
- return 3;
-}
-
-struct A_int_0
-{
- int operator()() {return 4;}
-};
-
-void
-test_int_0()
-{
- // function
- {
- std::function<int ()> r1(f_int_0);
- assert(r1() == 3);
- }
- // function pointer
- {
- int (*fp)() = f_int_0;
- std::function<int ()> r1(fp);
- assert(r1() == 3);
- }
- // functor
- {
- A_int_0 a0;
- std::function<int ()> r1(a0);
- assert(r1() == 4);
- }
-}
-
-int main()
-{
- test_int_0();
-}
diff --git a/test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.inv/invoke_no_variadics.pass.cpp b/test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.inv/invoke_no_variadics.pass.cpp
deleted file mode 100644
index c0a14fd96fcb..000000000000
--- a/test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.inv/invoke_no_variadics.pass.cpp
+++ /dev/null
@@ -1,60 +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.
-//
-//===----------------------------------------------------------------------===//
-
-// <functional>
-
-// class function<R()>
-
-// Test that we properly return both values and void for all non-variadic
-// overloads of function::operator()(...)
-
-#define _LIBCPP_HAS_NO_VARIADICS
-#include <functional>
-#include <cassert>
-
-int foo0() { return 42; }
-int foo1(int) { return 42; }
-int foo2(int, int) { return 42; }
-int foo3(int, int, int) { return 42; }
-
-int main()
-{
- {
- std::function<int()> f(&foo0);
- assert(f() == 42);
- }
- {
- std::function<int(int)> f(&foo1);
- assert(f(1) == 42);
- }
- {
- std::function<int(int, int)> f(&foo2);
- assert(f(1, 1) == 42);
- }
- {
- std::function<int(int, int, int)> f(&foo3);
- assert(f(1, 1, 1) == 42);
- }
- {
- std::function<void()> f(&foo0);
- f();
- }
- {
- std::function<void(int)> f(&foo1);
- f(1);
- }
- {
- std::function<void(int, int)> f(&foo2);
- f(1, 1);
- }
- {
- std::function<void(int, int, int)> f(&foo3);
- f(1, 1, 1);
- }
-}
diff --git a/test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.inv/invoke_void_0.pass.cpp b/test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.inv/invoke_void_0.pass.cpp
deleted file mode 100644
index a820cb1b8f38..000000000000
--- a/test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.inv/invoke_void_0.pass.cpp
+++ /dev/null
@@ -1,67 +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.
-//
-//===----------------------------------------------------------------------===//
-
-// <functional>
-
-// class function<R(ArgTypes...)>
-
-// R operator()(ArgTypes... args) const
-
-#include <functional>
-#include <new>
-#include <cstdlib>
-#include <cassert>
-
-// 0 args, return void
-
-int count = 0;
-
-void f_void_0()
-{
- ++count;
-}
-
-struct A_void_0
-{
- void operator()() {++count;}
-};
-
-void
-test_void_0()
-{
- int save_count = count;
- // function
- {
- std::function<void ()> r1(f_void_0);
- r1();
- assert(count == save_count+1);
- save_count = count;
- }
- // function pointer
- {
- void (*fp)() = f_void_0;
- std::function<void ()> r1(fp);
- r1();
- assert(count == save_count+1);
- save_count = count;
- }
- // functor
- {
- A_void_0 a0;
- std::function<void ()> r1(a0);
- r1();
- assert(count == save_count+1);
- save_count = count;
- }
-}
-
-int main()
-{
- test_void_0();
-}
diff --git a/test/std/utilities/function.objects/refwrap/refwrap.const/type_ctor.fail.cpp b/test/std/utilities/function.objects/refwrap/refwrap.const/type_ctor.fail.cpp
index ba46946aae1b..a2316063cec6 100644
--- a/test/std/utilities/function.objects/refwrap/refwrap.const/type_ctor.fail.cpp
+++ b/test/std/utilities/function.objects/refwrap/refwrap.const/type_ctor.fail.cpp
@@ -13,6 +13,8 @@
// reference_wrapper(T&&) = delete;
+// XFAIL: c++98, c++03
+
#include <functional>
#include <cassert>
diff --git a/test/std/utilities/function.objects/refwrap/refwrap.helpers/ref_1.fail.cpp b/test/std/utilities/function.objects/refwrap/refwrap.helpers/ref_1.fail.cpp
index 86a5696f48ca..0aad4986a1f8 100644
--- a/test/std/utilities/function.objects/refwrap/refwrap.helpers/ref_1.fail.cpp
+++ b/test/std/utilities/function.objects/refwrap/refwrap.helpers/ref_1.fail.cpp
@@ -15,6 +15,8 @@
// Don't allow binding to a temp
+// XFAIL: c++98, c++03
+
#include <functional>
struct A {};
diff --git a/test/std/utilities/function.objects/unord.hash/integral.pass.cpp b/test/std/utilities/function.objects/unord.hash/integral.pass.cpp
index 7cd9f15e93d1..d3db45fad7c0 100644
--- a/test/std/utilities/function.objects/unord.hash/integral.pass.cpp
+++ b/test/std/utilities/function.objects/unord.hash/integral.pass.cpp
@@ -57,4 +57,44 @@ int main()
test<unsigned long>();
test<long long>();
test<unsigned long long>();
+
+// LWG #2119
+ test<ptrdiff_t>();
+ test<size_t>();
+
+ test<int8_t>();
+ test<int16_t>();
+ test<int32_t>();
+ test<int64_t>();
+
+ test<int_fast8_t>();
+ test<int_fast16_t>();
+ test<int_fast32_t>();
+ test<int_fast64_t>();
+
+ test<int_least8_t>();
+ test<int_least16_t>();
+ test<int_least32_t>();
+ test<int_least64_t>();
+
+ test<intmax_t>();
+ test<intptr_t>();
+
+ test<uint8_t>();
+ test<uint16_t>();
+ test<uint32_t>();
+ test<uint64_t>();
+
+ test<uint_fast8_t>();
+ test<uint_fast16_t>();
+ test<uint_fast32_t>();
+ test<uint_fast64_t>();
+
+ test<uint_least8_t>();
+ test<uint_least16_t>();
+ test<uint_least32_t>();
+ test<uint_least64_t>();
+
+ test<uintmax_t>();
+ test<uintptr_t>();
}
diff --git a/test/std/utilities/intseq/intseq.make/make_integer_seq.fail.cpp b/test/std/utilities/intseq/intseq.make/make_integer_seq.fail.cpp
index 2dd6c17b3dee..af4a3c4dfe7f 100644
--- a/test/std/utilities/intseq/intseq.make/make_integer_seq.fail.cpp
+++ b/test/std/utilities/intseq/intseq.make/make_integer_seq.fail.cpp
@@ -12,19 +12,23 @@
// template<class T, T N>
// using make_integer_sequence = integer_sequence<T, 0, 1, ..., N-1>;
+// UNSUPPORTED: c++98, c++03, c++11
+
#include <utility>
#include <type_traits>
#include <cassert>
+#include "test_macros.h"
+
int main()
{
-#if _LIBCPP_STD_VER > 11
-
- std::make_integer_sequence<int, -3>::value_type i;
+ typedef std::make_integer_sequence<int, -3> MakeSeqT;
+ // std::make_integer_sequence is implemented using a compiler builtin if available.
+ // this builtin has different diagnostic messages than the fallback implementation.
+#if TEST_HAS_BUILTIN(__make_integer_seq) && !defined(_LIBCPP_TESTING_FALLBACK_MAKE_INTEGER_SEQUENCE)
+ MakeSeqT i; // expected-error@utility:* {{integer sequences must have non-negative sequence length}}
#else
-
-X
-
-#endif // _LIBCPP_STD_VER > 11
+ MakeSeqT i; // expected-error@utility:* {{static_assert failed "std::make_integer_sequence must have a non-negative sequence length"}}
+#endif
}
diff --git a/test/std/utilities/intseq/intseq.make/make_integer_seq.pass.cpp b/test/std/utilities/intseq/intseq.make/make_integer_seq.pass.cpp
index 7e82b94a7da0..9bfc5f3d9d70 100644
--- a/test/std/utilities/intseq/intseq.make/make_integer_seq.pass.cpp
+++ b/test/std/utilities/intseq/intseq.make/make_integer_seq.pass.cpp
@@ -12,14 +12,14 @@
// template<class T, T N>
// using make_integer_sequence = integer_sequence<T, 0, 1, ..., N-1>;
+// UNSUPPORTED: c++98, c++03, c++11
+
#include <utility>
#include <type_traits>
#include <cassert>
int main()
{
-#if _LIBCPP_STD_VER > 11
-
static_assert(std::is_same<std::make_integer_sequence<int, 0>, std::integer_sequence<int>>::value, "");
static_assert(std::is_same<std::make_integer_sequence<int, 1>, std::integer_sequence<int, 0>>::value, "");
static_assert(std::is_same<std::make_integer_sequence<int, 2>, std::integer_sequence<int, 0, 1>>::value, "");
@@ -29,6 +29,4 @@ int main()
static_assert(std::is_same<std::make_integer_sequence<unsigned long long, 1>, std::integer_sequence<unsigned long long, 0>>::value, "");
static_assert(std::is_same<std::make_integer_sequence<unsigned long long, 2>, std::integer_sequence<unsigned long long, 0, 1>>::value, "");
static_assert(std::is_same<std::make_integer_sequence<unsigned long long, 3>, std::integer_sequence<unsigned long long, 0, 1, 2>>::value, "");
-
-#endif // _LIBCPP_STD_VER > 11
}
diff --git a/test/std/utilities/intseq/intseq.make/make_integer_seq_fallback.fail.cpp b/test/std/utilities/intseq/intseq.make/make_integer_seq_fallback.fail.cpp
new file mode 100644
index 000000000000..b6431b56d5f0
--- /dev/null
+++ b/test/std/utilities/intseq/intseq.make/make_integer_seq_fallback.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <utility>
+
+// template<class T, T N>
+// using make_integer_sequence = integer_sequence<T, 0, 1, ..., N-1>;
+
+// UNSUPPORTED: c++98, c++03, c++11
+
+#define _LIBCPP_TESTING_FALLBACK_MAKE_INTEGER_SEQUENCE
+#include "make_integer_seq.fail.cpp"
diff --git a/test/std/utilities/intseq/intseq.make/make_integer_seq_fallback.pass.cpp b/test/std/utilities/intseq/intseq.make/make_integer_seq_fallback.pass.cpp
new file mode 100644
index 000000000000..c75d20b11af3
--- /dev/null
+++ b/test/std/utilities/intseq/intseq.make/make_integer_seq_fallback.pass.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <utility>
+
+// template<class T, T N>
+// using make_integer_sequence = integer_sequence<T, 0, 1, ..., N-1>;
+
+// UNSUPPORTED: c++98, c++03, c++11
+
+#define _LIBCPP_TESTING_FALLBACK_MAKE_INTEGER_SEQUENCE
+#include "make_integer_seq.pass.cpp"
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 1fa7291203ed..352c7c8d0caf 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
@@ -45,12 +45,12 @@ int main()
{
A<int> a;
assert(std::allocator_traits<A<int> >::max_size(a) ==
- std::numeric_limits<std::size_t>::max());
+ std::numeric_limits<std::size_t>::max() / sizeof(int));
}
{
const A<int> a = {};
assert(std::allocator_traits<A<int> >::max_size(a) ==
- std::numeric_limits<std::size_t>::max());
+ std::numeric_limits<std::size_t>::max() / sizeof(int));
}
#endif // _LIBCPP_HAS_NO_ADVANCED_SFINAE
{
diff --git a/test/std/utilities/memory/default.allocator/allocator.members/construct.pass.cpp b/test/std/utilities/memory/default.allocator/allocator.members/construct.pass.cpp
index d0a870e60690..28dadd831514 100644
--- a/test/std/utilities/memory/default.allocator/allocator.members/construct.pass.cpp
+++ b/test/std/utilities/memory/default.allocator/allocator.members/construct.pass.cpp
@@ -15,6 +15,7 @@
#include <memory>
#include <cassert>
+#include "test_macros.h"
#include "count_new.hpp"
int A_constructed = 0;
@@ -34,30 +35,24 @@ struct A
int move_only_constructed = 0;
+#if TEST_STD_VER >= 11
class move_only
{
- int data;
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
- move_only(const move_only&);
- move_only& operator=(const move_only&);
-#else // _LIBCPP_HAS_NO_RVALUE_REFERENCES
- move_only(move_only&);
- move_only& operator=(move_only&);
-#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+ move_only(const move_only&) = delete;
+ move_only& operator=(const move_only&)= delete;
public:
-
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
move_only(move_only&&) {++move_only_constructed;}
move_only& operator=(move_only&&) {return *this;}
-#else // _LIBCPP_HAS_NO_RVALUE_REFERENCES
- operator std::__rv<move_only> () {return std::__rv<move_only>(*this);}
- move_only(std::__rv<move_only>) {++move_only_constructed;}
-#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
move_only() {++move_only_constructed;}
~move_only() {--move_only_constructed;}
+
+public:
+ int data; // unused other than to make sizeof(move_only) == sizeof(int).
+ // but public to suppress "-Wunused-private-field"
};
+#endif // TEST_STD_VER >= 11
int main()
{
@@ -108,6 +103,7 @@ int main()
assert(globalMemCounter.checkOutstandingNewEq(0));
assert(A_constructed == 0);
}
+#if TEST_STD_VER >= 11
{
std::allocator<move_only> a;
assert(globalMemCounter.checkOutstandingNewEq(0));
@@ -139,4 +135,5 @@ int main()
assert(globalMemCounter.checkOutstandingNewEq(0));
assert(move_only_constructed == 0);
}
+#endif
}
diff --git a/test/std/utilities/memory/default.allocator/allocator.members/max_size.pass.cpp b/test/std/utilities/memory/default.allocator/allocator.members/max_size.pass.cpp
index 6ec9339bc48f..10109383b0c7 100644
--- a/test/std/utilities/memory/default.allocator/allocator.members/max_size.pass.cpp
+++ b/test/std/utilities/memory/default.allocator/allocator.members/max_size.pass.cpp
@@ -22,6 +22,6 @@ int new_called = 0;
int main()
{
const std::allocator<int> a;
- std::size_t M = a.max_size() * sizeof(int);
- assert(M > 0xFFFF && M <= std::numeric_limits<std::size_t>::max());
+ std::size_t M = a.max_size();
+ assert(M > 0xFFFF && M <= (std::numeric_limits<std::size_t>::max() / sizeof(int)));
}
diff --git a/test/std/utilities/memory/specialized.algorithms/uninitialized.copy/uninitialized_copy.pass.cpp b/test/std/utilities/memory/specialized.algorithms/uninitialized.copy/uninitialized_copy.pass.cpp
index f431335db732..8bb818319a37 100644
--- a/test/std/utilities/memory/specialized.algorithms/uninitialized.copy/uninitialized_copy.pass.cpp
+++ b/test/std/utilities/memory/specialized.algorithms/uninitialized.copy/uninitialized_copy.pass.cpp
@@ -7,6 +7,7 @@
//
//===----------------------------------------------------------------------===//
+// XFAIL: libcpp-no-exceptions
// <memory>
// template <class InputIterator, class ForwardIterator>
@@ -20,13 +21,15 @@
struct B
{
static int count_;
+ static int population_;
int data_;
- explicit B() : data_(1) {}
- B(const B& b) {if (++count_ == 3) throw 1; data_ = b.data_;}
- ~B() {data_ = 0;}
+ explicit B() : data_(1) { ++population_; }
+ B(const B& b) {if (++count_ == 3) throw 1; data_ = b.data_; ++population_; }
+ ~B() {data_ = 0; --population_; }
};
int B::count_ = 0;
+int B::population_ = 0;
struct Nasty
{
@@ -45,6 +48,7 @@ int main()
char pool[sizeof(B)*N] = {0};
B* bp = (B*)pool;
B b[N];
+ assert(B::population_ == N);
try
{
std::uninitialized_copy(b, b+N, bp);
@@ -52,14 +56,15 @@ int main()
}
catch (...)
{
- for (int i = 0; i < N; ++i)
- assert(bp[i].data_ == 0);
+ assert(B::population_ == N);
}
B::count_ = 0;
std::uninitialized_copy(b, b+2, bp);
for (int i = 0; i < 2; ++i)
assert(bp[i].data_ == 1);
+ assert(B::population_ == N + 2);
}
+
{
const int N = 5;
char pool[sizeof(Nasty)*N] = {0};
diff --git a/test/std/utilities/memory/specialized.algorithms/uninitialized.copy/uninitialized_copy_n.pass.cpp b/test/std/utilities/memory/specialized.algorithms/uninitialized.copy/uninitialized_copy_n.pass.cpp
index 3b2007b969c3..ae438ef7d561 100644
--- a/test/std/utilities/memory/specialized.algorithms/uninitialized.copy/uninitialized_copy_n.pass.cpp
+++ b/test/std/utilities/memory/specialized.algorithms/uninitialized.copy/uninitialized_copy_n.pass.cpp
@@ -7,6 +7,7 @@
//
//===----------------------------------------------------------------------===//
+// XFAIL: libcpp-no-exceptions
// <memory>
// template <class InputIterator, class Size, class ForwardIterator>
@@ -20,12 +21,14 @@
struct B
{
static int count_;
+ static int population_;
int data_;
- explicit B() : data_(1) {}
- B(const B& b) {if (++count_ == 3) throw 1; data_ = b.data_;}
- ~B() {data_ = 0;}
+ explicit B() : data_(1) { ++population_; }
+ B(const B& b) {if (++count_ == 3) throw 1; data_ = b.data_; ++population_; }
+ ~B() {data_ = 0; --population_; }
};
+int B::population_ = 0;
int B::count_ = 0;
struct Nasty
@@ -45,6 +48,7 @@ int main()
char pool[sizeof(B)*N] = {0};
B* bp = (B*)pool;
B b[N];
+ assert(B::population_ == N);
try
{
std::uninitialized_copy_n(b, 5, bp);
@@ -52,14 +56,15 @@ int main()
}
catch (...)
{
- for (int i = 0; i < N; ++i)
- assert(bp[i].data_ == 0);
+ assert(B::population_ == N);
}
B::count_ = 0;
std::uninitialized_copy_n(b, 2, bp);
for (int i = 0; i < 2; ++i)
assert(bp[i].data_ == 1);
+ assert(B::population_ == N + 2);
}
+
{
const int N = 5;
char pool[sizeof(Nasty)*N] = {0};
diff --git a/test/std/utilities/memory/specialized.algorithms/uninitialized.fill.n/uninitialized_fill_n.pass.cpp b/test/std/utilities/memory/specialized.algorithms/uninitialized.fill.n/uninitialized_fill_n.pass.cpp
index d2b1dfa28868..22aa8b98b8c9 100644
--- a/test/std/utilities/memory/specialized.algorithms/uninitialized.fill.n/uninitialized_fill_n.pass.cpp
+++ b/test/std/utilities/memory/specialized.algorithms/uninitialized.fill.n/uninitialized_fill_n.pass.cpp
@@ -7,6 +7,7 @@
//
//===----------------------------------------------------------------------===//
+// XFAIL: libcpp-no-exceptions
// <memory>
// template <class ForwardIterator, class Size, class T>
@@ -19,13 +20,15 @@
struct B
{
static int count_;
+ static int population_;
int data_;
- explicit B() : data_(1) {}
- B(const B& b) {if (++count_ == 3) throw 1; data_ = b.data_;}
- ~B() {data_ = 0;}
+ explicit B() : data_(1) { ++population_; }
+ B(const B& b) {if (++count_ == 3) throw 1; data_ = b.data_; ++population_; }
+ ~B() {data_ = 0; --population_; }
};
int B::count_ = 0;
+int B::population_ = 0;
struct Nasty
{
@@ -43,6 +46,7 @@ int main()
const int N = 5;
char pool[sizeof(B)*N] = {0};
B* bp = (B*)pool;
+ assert(B::population_ == 0);
try
{
std::uninitialized_fill_n(bp, 5, B());
@@ -50,14 +54,14 @@ int main()
}
catch (...)
{
- for (int i = 0; i < N; ++i)
- assert(bp[i].data_ == 0);
+ assert(B::population_ == 0);
}
B::count_ = 0;
B* r = std::uninitialized_fill_n(bp, 2, B());
assert(r == bp + 2);
for (int i = 0; i < 2; ++i)
assert(bp[i].data_ == 1);
+ assert(B::population_ == 2);
}
{
{
diff --git a/test/std/utilities/memory/specialized.algorithms/uninitialized.fill/uninitialized_fill.pass.cpp b/test/std/utilities/memory/specialized.algorithms/uninitialized.fill/uninitialized_fill.pass.cpp
index 47cabdfa478a..95c45dd50541 100644
--- a/test/std/utilities/memory/specialized.algorithms/uninitialized.fill/uninitialized_fill.pass.cpp
+++ b/test/std/utilities/memory/specialized.algorithms/uninitialized.fill/uninitialized_fill.pass.cpp
@@ -7,6 +7,7 @@
//
//===----------------------------------------------------------------------===//
+// XFAIL: libcpp-no-exceptions
// <memory>
// template <class ForwardIterator, class T>
@@ -20,13 +21,15 @@
struct B
{
static int count_;
+ static int population_;
int data_;
- explicit B() : data_(1) {}
- B(const B& b) {if (++count_ == 3) throw 1; data_ = b.data_;}
- ~B() {data_ = 0;}
+ explicit B() : data_(1) { ++population_; }
+ B(const B& b) {if (++count_ == 3) throw 1; data_ = b.data_; ++population_; }
+ ~B() {data_ = 0; --population_; }
};
int B::count_ = 0;
+int B::population_ = 0;
struct Nasty
{
@@ -44,6 +47,7 @@ int main()
const int N = 5;
char pool[sizeof(B)*N] = {0};
B* bp = (B*)pool;
+ assert(B::population_ == 0);
try
{
std::uninitialized_fill(bp, bp+N, B());
@@ -51,13 +55,13 @@ int main()
}
catch (...)
{
- for (int i = 0; i < N; ++i)
- assert(bp[i].data_ == 0);
+ assert(B::population_ == 0);
}
B::count_ = 0;
std::uninitialized_fill(bp, bp+2, B());
for (int i = 0; i < 2; ++i)
assert(bp[i].data_ == 1);
+ assert(B::population_ == 2);
}
{
const int N = 5;
diff --git a/test/std/utilities/memory/storage.iterator/raw_storag_iterator.pass.cpp b/test/std/utilities/memory/storage.iterator/raw_storag_iterator.pass.cpp
index f77d6c75e17a..914802423ce7 100644
--- a/test/std/utilities/memory/storage.iterator/raw_storag_iterator.pass.cpp
+++ b/test/std/utilities/memory/storage.iterator/raw_storag_iterator.pass.cpp
@@ -13,6 +13,8 @@
#include <type_traits>
#include <cassert>
+#include <MoveOnly.h>
+
int A_constructed = 0;
struct A
@@ -29,16 +31,33 @@ public:
int main()
{
- typedef std::aligned_storage<3*sizeof(A), std::alignment_of<A>::value>::type
+ {
+ typedef A S;
+ typedef std::aligned_storage<3*sizeof(S), std::alignment_of<S>::value>::type
Storage;
Storage buffer;
- std::raw_storage_iterator<A*, A> it((A*)&buffer);
+ std::raw_storage_iterator<S*, S> it((S*)&buffer);
assert(A_constructed == 0);
for (int i = 0; i < 3; ++i)
{
- *it++ = A(i+1);
- A* ap = (A*)&buffer + i;
+ *it++ = S(i+1);
+ S* ap = (S*)&buffer + i;
assert(*ap == i+1);
assert(A_constructed == i+1);
}
+ }
+#if _LIBCPP_STD_VER >= 14
+ {
+ typedef MoveOnly S;
+ typedef std::aligned_storage<3*sizeof(S), std::alignment_of<S>::value>::type
+ Storage;
+ Storage buffer;
+ std::raw_storage_iterator<S*, S> it((S*)&buffer);
+ S m{1};
+ *it++ = std::move(m);
+ assert(m.get() == 0); // moved from
+ S *ap = (S*) &buffer;
+ assert(ap->get() == 1); // original value
+ }
+#endif
}
diff --git a/test/std/utilities/memory/unique.ptr/deleter.h b/test/std/utilities/memory/unique.ptr/deleter.h
index fb26044d98ff..1d8e19d5bc41 100644
--- a/test/std/utilities/memory/unique.ptr/deleter.h
+++ b/test/std/utilities/memory/unique.ptr/deleter.h
@@ -20,21 +20,19 @@
#include <utility>
#include <cassert>
+#include "test_macros.h"
+
+#if TEST_STD_VER >= 11
+
template <class T>
class Deleter
{
int state_;
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
Deleter(const Deleter&);
Deleter& operator=(const Deleter&);
-#else // _LIBCPP_HAS_NO_RVALUE_REFERENCES
- Deleter(Deleter&);
- Deleter& operator=(Deleter&);
-#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
public:
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
Deleter(Deleter&& r) : state_(r.state_) {r.state_ = 0;}
Deleter& operator=(Deleter&& r)
{
@@ -42,22 +40,12 @@ public:
r.state_ = 0;
return *this;
}
-#else // _LIBCPP_HAS_NO_RVALUE_REFERENCES
- operator std::__rv<Deleter>() {return std::__rv<Deleter>(*this);}
- Deleter(std::__rv<Deleter> r) : state_(r->state_) {r->state_ = 0;}
- Deleter& operator=(std::__rv<Deleter> r)
- {
- state_ = r->state_;
- r->state_ = 0;
- return *this;
- }
-#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+
Deleter() : state_(0) {}
explicit Deleter(int s) : state_(s) {}
~Deleter() {assert(state_ >= 0); state_ = -1;}
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
template <class U>
Deleter(Deleter<U>&& d,
typename std::enable_if<!std::is_same<U, T>::value>::type* = 0)
@@ -67,12 +55,6 @@ private:
template <class U>
Deleter(const Deleter<U>& d,
typename std::enable_if<!std::is_same<U, T>::value>::type* = 0);
-#else // _LIBCPP_HAS_NO_RVALUE_REFERENCES
- template <class U>
- Deleter(Deleter<U> d,
- typename std::enable_if<!std::is_same<U, T>::value>::type* = 0)
- : state_(d.state()) {}
-#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
public:
int state() const {return state_;}
void set_state(int i) {state_ = i;}
@@ -85,16 +67,11 @@ class Deleter<T[]>
{
int state_;
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
Deleter(const Deleter&);
Deleter& operator=(const Deleter&);
-#else // _LIBCPP_HAS_NO_RVALUE_REFERENCES
- Deleter(Deleter&);
- Deleter& operator=(Deleter&);
-#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
public:
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+
Deleter(Deleter&& r) : state_(r.state_) {r.state_ = 0;}
Deleter& operator=(Deleter&& r)
{
@@ -102,16 +79,66 @@ public:
r.state_ = 0;
return *this;
}
-#else // _LIBCPP_HAS_NO_RVALUE_REFERENCES
- operator std::__rv<Deleter>() {return std::__rv<Deleter>(*this);}
- Deleter(std::__rv<Deleter> r) : state_(r->state_) {r->state_ = 0;}
- Deleter& operator=(std::__rv<Deleter> r)
- {
- state_ = r->state_;
- r->state_ = 0;
+
+ Deleter() : state_(0) {}
+ explicit Deleter(int s) : state_(s) {}
+ ~Deleter() {assert(state_ >= 0); state_ = -1;}
+
+ int state() const {return state_;}
+ void set_state(int i) {state_ = i;}
+
+ void operator()(T* p) {delete [] p;}
+};
+
+#else // TEST_STD_VER < 11
+
+template <class T>
+class Deleter
+{
+ mutable int state_;
+
+public:
+ Deleter() : state_(0) {}
+ explicit Deleter(int s) : state_(s) {}
+
+ Deleter(Deleter const & other) : state_(other.state_) {
+ other.state_ = 0;
+ }
+ Deleter& operator=(Deleter const& other) {
+ state_ = other.state_;
+ other.state_ = 0;
+ return *this;
+ }
+
+ ~Deleter() {assert(state_ >= 0); state_ = -1;}
+
+ template <class U>
+ Deleter(Deleter<U> d,
+ typename std::enable_if<!std::is_same<U, T>::value>::type* = 0)
+ : state_(d.state()) {}
+
+public:
+ int state() const {return state_;}
+ void set_state(int i) {state_ = i;}
+
+ void operator()(T* p) {delete p;}
+};
+
+template <class T>
+class Deleter<T[]>
+{
+ mutable int state_;
+
+public:
+
+ Deleter(Deleter const& other) : state_(other.state_) {
+ other.state_ = 0;
+ }
+ Deleter& operator=(Deleter const& other) {
+ state_ = other.state_;
+ other.state_ = 0;
return *this;
}
-#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
Deleter() : state_(0) {}
explicit Deleter(int s) : state_(s) {}
@@ -123,6 +150,8 @@ public:
void operator()(T* p) {delete [] p;}
};
+#endif
+
template <class T>
void
swap(Deleter<T>& x, Deleter<T>& y)
@@ -132,6 +161,7 @@ swap(Deleter<T>& x, Deleter<T>& y)
y = std::move(t);
}
+
template <class T>
class CDeleter
{
@@ -179,4 +209,130 @@ swap(CDeleter<T>& x, CDeleter<T>& y)
y = std::move(t);
}
+// Non-copyable deleter
+template <class T>
+class NCDeleter
+{
+ int state_;
+ NCDeleter(NCDeleter const&);
+ NCDeleter& operator=(NCDeleter const&);
+public:
+
+ NCDeleter() : state_(0) {}
+ explicit NCDeleter(int s) : state_(s) {}
+ ~NCDeleter() {assert(state_ >= 0); state_ = -1;}
+
+ int state() const {return state_;}
+ void set_state(int i) {state_ = i;}
+
+ void operator()(T* p) {delete p;}
+};
+
+
+template <class T>
+class NCDeleter<T[]>
+{
+ int state_;
+ NCDeleter(NCDeleter const&);
+ NCDeleter& operator=(NCDeleter const&);
+public:
+
+ NCDeleter() : state_(0) {}
+ explicit NCDeleter(int s) : state_(s) {}
+ ~NCDeleter() {assert(state_ >= 0); state_ = -1;}
+
+ int state() const {return state_;}
+ void set_state(int i) {state_ = i;}
+
+ void operator()(T* p) {delete [] p;}
+};
+
+
+// Non-copyable deleter
+template <class T>
+class NCConstDeleter
+{
+ int state_;
+ NCConstDeleter(NCConstDeleter const&);
+ NCConstDeleter& operator=(NCConstDeleter const&);
+public:
+
+ NCConstDeleter() : state_(0) {}
+ explicit NCConstDeleter(int s) : state_(s) {}
+ ~NCConstDeleter() {assert(state_ >= 0); state_ = -1;}
+
+ int state() const {return state_;}
+ void set_state(int i) {state_ = i;}
+
+ void operator()(T* p) const {delete p;}
+};
+
+
+template <class T>
+class NCConstDeleter<T[]>
+{
+ int state_;
+ NCConstDeleter(NCConstDeleter const&);
+ NCConstDeleter& operator=(NCConstDeleter const&);
+public:
+
+ NCConstDeleter() : state_(0) {}
+ explicit NCConstDeleter(int s) : state_(s) {}
+ ~NCConstDeleter() {assert(state_ >= 0); state_ = -1;}
+
+ int state() const {return state_;}
+ void set_state(int i) {state_ = i;}
+
+ void operator()(T* p) const {delete [] p;}
+};
+
+
+// Non-copyable deleter
+template <class T>
+class CopyDeleter
+{
+ int state_;
+public:
+
+ CopyDeleter() : state_(0) {}
+ explicit CopyDeleter(int s) : state_(s) {}
+ ~CopyDeleter() {assert(state_ >= 0); state_ = -1;}
+
+ CopyDeleter(CopyDeleter const& other) : state_(other.state_) {}
+ CopyDeleter& operator=(CopyDeleter const& other) {
+ state_ = other.state_;
+ return *this;
+ }
+
+ int state() const {return state_;}
+ void set_state(int i) {state_ = i;}
+
+ void operator()(T* p) {delete p;}
+};
+
+
+template <class T>
+class CopyDeleter<T[]>
+{
+ int state_;
+
+public:
+
+ CopyDeleter() : state_(0) {}
+ explicit CopyDeleter(int s) : state_(s) {}
+ ~CopyDeleter() {assert(state_ >= 0); state_ = -1;}
+
+ CopyDeleter(CopyDeleter const& other) : state_(other.state_) {}
+ CopyDeleter& operator=(CopyDeleter const& other) {
+ state_ = other.state_;
+ return *this;
+ }
+
+ int state() const {return state_;}
+ void set_state(int i) {state_ = i;}
+
+ void operator()(T* p) {delete [] p;}
+};
+
+
#endif // DELETER_H
diff --git a/test/std/utilities/memory/unique.ptr/unique.ptr.runtime/move01.fail.cpp b/test/std/utilities/memory/unique.ptr/unique.ptr.runtime/move01.fail.cpp
index 17375ede00f5..ed94c1a1e470 100644
--- a/test/std/utilities/memory/unique.ptr/unique.ptr.runtime/move01.fail.cpp
+++ b/test/std/utilities/memory/unique.ptr/unique.ptr.runtime/move01.fail.cpp
@@ -14,26 +14,15 @@
// Test unique_ptr move assignment
#include <memory>
-#include <utility>
-#include <cassert>
-// Can't copy from lvalue
-
-struct A
-{
- static int count;
- A() {++count;}
- A(const A&) {++count;}
- ~A() {--count;}
-};
-
-int A::count = 0;
+#include "test_macros.h"
int main()
{
- {
- std::unique_ptr<A> s(new A);
- std::unique_ptr<A> s2;
- s2 = s;
- }
+ std::unique_ptr<int> s, s2;
+#if TEST_STD_VER >= 11
+ s2 = s; // expected-error {{cannot be assigned because its copy assignment operator is implicitly deleted}}
+#else
+ s2 = s; // expected-error {{'operator=' is a private member of 'std::__1::unique_ptr}}
+#endif
}
diff --git a/test/std/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/move01.pass.cpp b/test/std/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/move01.pass.cpp
index 03747b4f89cf..5088a4410e79 100644
--- a/test/std/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/move01.pass.cpp
+++ b/test/std/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/move01.pass.cpp
@@ -32,22 +32,6 @@ struct A
int A::count = 0;
-class NCDeleter
-{
- int state_;
-
- NCDeleter(NCDeleter&);
- NCDeleter& operator=(NCDeleter&);
-public:
-
- NCDeleter() : state_(5) {}
-
- int state() const {return state_;}
- void set_state(int s) {state_ = s;}
-
- void operator()(A* p) {delete [] p;}
-};
-
int main()
{
{
@@ -71,10 +55,10 @@ int main()
}
assert(A::count == 0);
{
- NCDeleter d;
- std::unique_ptr<A[], NCDeleter&> s(new A[3], d);
+ NCDeleter<A[]> d;
+ std::unique_ptr<A[], NCDeleter<A[]>&> s(new A[3], d);
A* p = s.get();
- std::unique_ptr<A[], NCDeleter&> s2 = std::move(s);
+ std::unique_ptr<A[], NCDeleter<A[]>&> s2 = std::move(s);
assert(s2.get() == p);
assert(s.get() == 0);
assert(A::count == 3);
diff --git a/test/std/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/move02.pass.cpp b/test/std/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/move02.pass.cpp
index ef821a915e44..5720d3bd288f 100644
--- a/test/std/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/move02.pass.cpp
+++ b/test/std/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/move02.pass.cpp
@@ -31,21 +31,6 @@ struct A
int A::count = 0;
-class NCDeleter
-{
- int state_;
-
- NCDeleter(NCDeleter&);
- NCDeleter& operator=(NCDeleter&);
-public:
-
- NCDeleter() : state_(5) {}
-
- int state() const {return state_;}
- void set_state(int s) {state_ = s;}
-
- void operator()(A* p) {delete [] p;}
-};
std::unique_ptr<A[]>
source1()
@@ -67,14 +52,14 @@ void sink2(std::unique_ptr<A[], Deleter<A[]> > p)
{
}
-std::unique_ptr<A[], NCDeleter&>
+std::unique_ptr<A[], NCDeleter<A[]>&>
source3()
{
- static NCDeleter d;
- return std::unique_ptr<A[], NCDeleter&>(new A[3], d);
+ static NCDeleter<A[]> d;
+ return std::unique_ptr<A[], NCDeleter<A[]>&>(new A[3], d);
}
-void sink3(std::unique_ptr<A[], NCDeleter&> p)
+void sink3(std::unique_ptr<A[], NCDeleter<A[]>&> p)
{
}
diff --git a/test/std/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/pointer_deleter04.fail.cpp b/test/std/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/pointer_deleter04.fail.cpp
index b635d507b2ec..9d3f94098a08 100644
--- a/test/std/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/pointer_deleter04.fail.cpp
+++ b/test/std/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/pointer_deleter04.fail.cpp
@@ -7,6 +7,8 @@
//
//===----------------------------------------------------------------------===//
+// XFAIL: c++98, c++03
+
// <memory>
// unique_ptr
@@ -16,40 +18,16 @@
// unique_ptr<T, const D&>(pointer, D()) should not compile
#include <memory>
-#include <cassert>
-
-struct A
-{
- static int count;
- A() {++count;}
- A(const A&) {++count;}
- ~A() {--count;}
-};
-
-int A::count = 0;
class Deleter
{
- int state_;
-
public:
-
- Deleter() : state_(5) {}
-
- int state() const {return state_;}
- void set_state(int s) {state_ = s;}
-
- void operator()(A* p) const {delete [] p;}
+ Deleter() {}
+ void operator()(int* p) const {delete [] p;}
};
int main()
{
- {
- A* p = new A[3];
- assert(A::count == 3);
- std::unique_ptr<A[], const Deleter&> s(p, Deleter());
- assert(s.get() == p);
- assert(s.get_deleter().state() == 5);
- }
- assert(A::count == 0);
+ int* p = nullptr;
+ std::unique_ptr<int[], const Deleter&> s(p, Deleter()); // expected-error@memory:* {{static_assert failed "rvalue deleter bound to reference"}}
}
diff --git a/test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.asgn/move01.fail.cpp b/test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.asgn/move01.fail.cpp
index 57724ae10a70..87cfb72ad6e0 100644
--- a/test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.asgn/move01.fail.cpp
+++ b/test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.asgn/move01.fail.cpp
@@ -14,25 +14,16 @@
// Test unique_ptr move assignment
#include <memory>
-#include <cassert>
-// Can't copy from lvalue
-
-struct A
-{
- static int count;
- A() {++count;}
- A(const A&) {++count;}
- ~A() {--count;}
-};
-
-int A::count = 0;
+#include "test_macros.h"
+// Can't copy from lvalue
int main()
{
- {
- std::unique_ptr<A> s(new A);
- std::unique_ptr<A> s2;
- s2 = s;
- }
+ std::unique_ptr<int> s, s2;
+#if TEST_STD_VER >= 11
+ s2 = s; // expected-error {{cannot be assigned because its copy assignment operator is implicitly deleted}}
+#else
+ s2 = s; // expected-error {{'operator=' is a private member}}
+#endif
}
diff --git a/test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.asgn/move02.fail.cpp b/test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.asgn/move02.fail.cpp
index 5046fd8aae6b..9cea12b1249f 100644
--- a/test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.asgn/move02.fail.cpp
+++ b/test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.asgn/move02.fail.cpp
@@ -14,25 +14,20 @@
// Test unique_ptr move assignment
#include <memory>
-#include <cassert>
-// Can't copy from const lvalue
-
-struct A
-{
- static int count;
- A() {++count;}
- A(const A&) {++count;}
- ~A() {--count;}
-};
+#include "test_macros.h"
-int A::count = 0;
+// Can't copy from const lvalue
int main()
{
- {
- const std::unique_ptr<A> s(new A);
- std::unique_ptr<A> s2;
- s2 = s;
- }
+ const std::unique_ptr<int> s(new int);
+ std::unique_ptr<int> s2;
+#if TEST_STD_VER >= 11
+ s2 = s; // expected-error {{cannot be assigned because its copy assignment operator is implicitly deleted}}
+#else
+ // NOTE: The error says "constructor" because the assignment operator takes
+ // 's' by value and attempts to copy construct it.
+ s2 = s; // expected-error {{no matching constructor for initialization}}
+#endif
}
diff --git a/test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.asgn/move03.fail.cpp b/test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.asgn/move03.fail.cpp
index aa4fdb8a96b1..05a057f9bb32 100644
--- a/test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.asgn/move03.fail.cpp
+++ b/test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.asgn/move03.fail.cpp
@@ -14,43 +14,20 @@
// Test unique_ptr move assignment
#include <memory>
-#include <cassert>
-// Can't copy from lvalue
+#include "test_macros.h"
-struct A
-{
- static int count;
- A() {++count;}
- A(const A&) {++count;}
- ~A() {--count;}
-};
-
-int A::count = 0;
-
-class Deleter
-{
- int state_;
-
-public:
-
- Deleter() : state_(5) {}
-
- int state() const {return state_;}
-
- void operator()(A* p) {delete p;}
+struct Deleter {
+ void operator()(int* p) {delete p;}
};
+// Can't copy from lvalue
int main()
{
- {
- std::unique_ptr<A, Deleter> s(new A);
- A* p = s.get();
- std::unique_ptr<A, Deleter> s2;
- s2 = s;
- assert(s2.get() == p);
- assert(s.get() == 0);
- assert(A::count == 1);
- }
- assert(A::count == 0);
+ std::unique_ptr<int, Deleter> s, s2;
+#if TEST_STD_VER >= 11
+ s2 = s; // expected-error {{cannot be assigned because its copy assignment operator is implicitly deleted}}
+#else
+ s2 = s; // expected-error {{'operator=' is a private member}}
+#endif
}
diff --git a/test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.asgn/move04.fail.cpp b/test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.asgn/move04.fail.cpp
index e0d7c891c80f..24703ec98238 100644
--- a/test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.asgn/move04.fail.cpp
+++ b/test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.asgn/move04.fail.cpp
@@ -11,46 +11,26 @@
// unique_ptr
-// Test unique_ptr move ctor
+// Test unique_ptr move assignment
#include <memory>
-#include <cassert>
-// test move ctor. Can't copy from const lvalue
+#include "test_macros.h"
-struct A
-{
- static int count;
- A() {++count;}
- A(const A&) {++count;}
- ~A() {--count;}
-};
-
-int A::count = 0;
-
-class Deleter
-{
- int state_;
-
-public:
-
- Deleter() : state_(5) {}
-
- int state() const {return state_;}
-
- void operator()(A* p) {delete p;}
+struct Deleter {
+ void operator()(int* p) {delete p;}
};
+// Can't copy from a const lvalue
int main()
{
- {
- const std::unique_ptr<A, Deleter> s(new A);
- A* p = s.get();
- std::unique_ptr<A, Deleter> s2;
- s2 = s;
- assert(s2.get() == p);
- assert(s.get() == 0);
- assert(A::count == 1);
- }
- assert(A::count == 0);
+ const std::unique_ptr<int, Deleter> s(new int);
+ std::unique_ptr<int, Deleter> s2;
+#if TEST_STD_VER >= 11
+ s2 = s; // expected-error {{cannot be assigned because its copy assignment operator is implicitly deleted}}
+#else
+ // NOTE: The error says "constructor" because the assignment operator takes
+ // 's' by value and attempts to copy construct it.
+ s2 = s; // expected-error {{no matching constructor for initialization}}
+#endif
}
diff --git a/test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.asgn/move_convert.pass.cpp b/test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.asgn/move_convert.pass.cpp
new file mode 100644
index 000000000000..4c4a32035641
--- /dev/null
+++ b/test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.asgn/move_convert.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <memory>
+
+// unique_ptr
+
+// Test unique_ptr converting move assignment
+
+#include <memory>
+#include <utility>
+#include <cassert>
+
+#include "../../deleter.h"
+
+struct A
+{
+ static int count;
+ A() {++count;}
+ A(const A&) {++count;}
+ virtual ~A() {--count;}
+};
+
+int A::count = 0;
+
+struct B
+ : public A
+{
+ static int count;
+ B() {++count;}
+ B(const B&) {++count;}
+ virtual ~B() {--count;}
+};
+
+int B::count = 0;
+
+
+template <class APtr, class BPtr>
+void testAssign(APtr& aptr, BPtr& bptr) {
+ A* p = bptr.get();
+ assert(A::count == 2);
+ aptr = std::move(bptr);
+ assert(aptr.get() == p);
+ assert(bptr.get() == 0);
+ assert(A::count == 1);
+ assert(B::count == 1);
+}
+
+template <class LHS, class RHS>
+void checkDeleter(LHS& lhs, RHS& rhs, int LHSState, int RHSState) {
+ assert(lhs.get_deleter().state() == LHSState);
+ assert(rhs.get_deleter().state() == RHSState);
+}
+
+int main()
+{
+ {
+ std::unique_ptr<B> bptr(new B);
+ std::unique_ptr<A> aptr(new A);
+ testAssign(aptr, bptr);
+ }
+ assert(A::count == 0);
+ assert(B::count == 0);
+ {
+ Deleter<B> del(42);
+ std::unique_ptr<B, Deleter<B> > bptr(new B, std::move(del));
+ std::unique_ptr<A, Deleter<A> > aptr(new A);
+ testAssign(aptr, bptr);
+ checkDeleter(aptr, bptr, 42, 0);
+ }
+ assert(A::count == 0);
+ assert(B::count == 0);
+ {
+ CDeleter<A> adel(6);
+ CDeleter<B> bdel(42);
+ std::unique_ptr<B, CDeleter<B>&> bptr(new B, bdel);
+ std::unique_ptr<A, CDeleter<A>&> aptr(new A, adel);
+ testAssign(aptr, bptr);
+ checkDeleter(aptr, bptr, 42, 42);
+ }
+ assert(A::count == 0);
+ assert(B::count == 0);
+}
diff --git a/test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.asgn/move_convert01.fail.cpp b/test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.asgn/move_convert01.fail.cpp
index 3fd2cbc42bd6..816a598d9a23 100644
--- a/test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.asgn/move_convert01.fail.cpp
+++ b/test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.asgn/move_convert01.fail.cpp
@@ -14,44 +14,29 @@
// Test unique_ptr converting move assignment
#include <memory>
-#include <utility>
-#include <cassert>
-// Can't assign from lvalue
+#include "test_macros.h"
struct A
{
- static int count;
- A() {++count;}
- A(const A&) {++count;}
- virtual ~A() {--count;}
+ A() {}
+ virtual ~A() {}
};
-int A::count = 0;
-
-struct B
- : public A
+struct B : public A
{
- static int count;
- B() {++count;}
- B(const B&) {++count;}
- virtual ~B() {--count;}
};
-int B::count = 0;
-
+// Can't assign from lvalue
int main()
{
- {
- std::unique_ptr<B> s(new B);
- A* p = s.get();
+ std::unique_ptr<B> s;
std::unique_ptr<A> s2;
- s2 = s;
- assert(s2.get() == p);
- assert(s.get() == 0);
- assert(A::count == 1);
- assert(B::count == 1);
- }
- assert(A::count == 0);
- assert(B::count == 0);
+#if TEST_STD_VER >= 11
+ s2 = s; // expected-error {{no viable overloaded '='}}
+#else
+ // NOTE: The move-semantic emulation creates an ambiguous overload set
+ // so that assignment from an lvalue does not compile
+ s2 = s; // expected-error {{use of overloaded operator '=' is ambiguous}}
+#endif
}
diff --git a/test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.asgn/move_convert01.pass.cpp b/test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.asgn/move_convert01.pass.cpp
deleted file mode 100644
index 989f594e38b8..000000000000
--- a/test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.asgn/move_convert01.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.
-//
-//===----------------------------------------------------------------------===//
-
-// <memory>
-
-// unique_ptr
-
-// Test unique_ptr converting move assignment
-
-#include <memory>
-#include <utility>
-#include <cassert>
-
-struct A
-{
- static int count;
- A() {++count;}
- A(const A&) {++count;}
- virtual ~A() {--count;}
-};
-
-int A::count = 0;
-
-struct B
- : public A
-{
- static int count;
- B() {++count;}
- B(const B&) {++count;}
- virtual ~B() {--count;}
-};
-
-int B::count = 0;
-
-int main()
-{
- {
- std::unique_ptr<B> s(new B);
- A* p = s.get();
- std::unique_ptr<A> s2(new A);
- assert(A::count == 2);
- s2 = std::move(s);
- assert(s2.get() == p);
- assert(s.get() == 0);
- assert(A::count == 1);
- assert(B::count == 1);
- }
- assert(A::count == 0);
- assert(B::count == 0);
-}
diff --git a/test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.asgn/move_convert02.fail.cpp b/test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.asgn/move_convert02.fail.cpp
index 0f900603e239..1ddf1d811651 100644
--- a/test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.asgn/move_convert02.fail.cpp
+++ b/test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.asgn/move_convert02.fail.cpp
@@ -14,48 +14,30 @@
// Test unique_ptr converting move assignment
#include <memory>
-#include <utility>
-#include <cassert>
+#include "test_macros.h"
#include "../../deleter.h"
-// Can't assign from lvalue
-
struct A
{
- static int count;
- A() {++count;}
- A(const A&) {++count;}
- virtual ~A() {--count;}
+ A() {}
+ virtual ~A() {}
};
-int A::count = 0;
-
-struct B
- : public A
+struct B : public A
{
- static int count;
- B() {++count;}
- B(const B&) {++count;}
- virtual ~B() {--count;}
};
-int B::count = 0;
-
+// Can't assign from lvalue
int main()
{
- {
- std::unique_ptr<B, Deleter<B> > s(new B);
- A* p = s.get();
+ std::unique_ptr<B, Deleter<B> > s;
std::unique_ptr<A, Deleter<A> > s2;
- s2 = s;
- assert(s2.get() == p);
- assert(s.get() == 0);
- assert(A::count == 1);
- assert(B::count == 1);
- assert(s2.get_deleter().state() == 5);
- assert(s.get_deleter().state() == 0);
- }
- assert(A::count == 0);
- assert(B::count == 0);
+#if TEST_STD_VER >= 11
+ s2 = s; // expected-error {{no viable overloaded '='}}
+#else
+ // NOTE: The move-semantic emulation creates an ambiguous overload set
+ // so that assignment from an lvalue does not compile
+ s2 = s; // expected-error {{use of overloaded operator '=' is ambiguous}}
+#endif
}
diff --git a/test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.asgn/move_convert02.pass.cpp b/test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.asgn/move_convert02.pass.cpp
deleted file mode 100644
index a448c77a66a7..000000000000
--- a/test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.asgn/move_convert02.pass.cpp
+++ /dev/null
@@ -1,60 +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.
-//
-//===----------------------------------------------------------------------===//
-
-// <memory>
-
-// unique_ptr
-
-// Test unique_ptr converting move assignment
-
-#include <memory>
-#include <utility>
-#include <cassert>
-
-#include "../../deleter.h"
-
-struct A
-{
- static int count;
- A() {++count;}
- A(const A&) {++count;}
- virtual ~A() {--count;}
-};
-
-int A::count = 0;
-
-struct B
- : public A
-{
- static int count;
- B() {++count;}
- B(const B&) {++count;}
- virtual ~B() {--count;}
-};
-
-int B::count = 0;
-
-int main()
-{
- {
- std::unique_ptr<B, Deleter<B> > s(new B, Deleter<B>(5));
- A* p = s.get();
- std::unique_ptr<A, Deleter<A> > s2(new A);
- assert(A::count == 2);
- s2 = std::move(s);
- assert(s2.get() == p);
- assert(s.get() == 0);
- assert(A::count == 1);
- assert(B::count == 1);
- assert(s2.get_deleter().state() == 5);
- assert(s.get_deleter().state() == 0);
- }
- assert(A::count == 0);
- assert(B::count == 0);
-}
diff --git a/test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.asgn/move_convert03.fail.cpp b/test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.asgn/move_convert03.fail.cpp
index f35af9f453ff..570c1c42f4fe 100644
--- a/test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.asgn/move_convert03.fail.cpp
+++ b/test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.asgn/move_convert03.fail.cpp
@@ -16,47 +16,32 @@
// Can't assign from lvalue
#include <memory>
-#include <utility>
-#include <cassert>
+#include "test_macros.h"
#include "../../deleter.h"
struct A
{
- static int count;
- A() {++count;}
- A(const A&) {++count;}
- virtual ~A() {--count;}
+ A() {}
+ virtual ~A() {}
};
-int A::count = 0;
-
-struct B
- : public A
+struct B : public A
{
- static int count;
- B() {++count;}
- B(const B&) {++count;}
- virtual ~B() {--count;}
};
-int B::count = 0;
-
+// Can't assign from lvalue
int main()
{
- {
- Deleter<B> db(5);
- std::unique_ptr<B, Deleter<B>&> s(new B, db);
- A* p = s.get();
- Deleter<A> da(6);
- std::unique_ptr<A, Deleter<A>&> s2(new A, da);
- s2 = s;
- assert(s2.get() == p);
- assert(s.get() == 0);
- assert(A::count == 1);
- assert(B::count == 1);
- assert(s2.get_deleter().state() == 5);
- }
- assert(A::count == 0);
- assert(B::count == 0);
+ Deleter<B> db;
+ std::unique_ptr<B, Deleter<B>& > s(new B, db);
+ Deleter<A> da;
+ std::unique_ptr<A, Deleter<A> &> s2(new A, da);
+#if TEST_STD_VER >= 11
+ s2 = s; // expected-error {{no viable overloaded '='}}
+#else
+ // NOTE: The move-semantic emulation creates an ambiguous overload set
+ // so that assignment from an lvalue does not compile
+ s2 = s; // expected-error {{use of overloaded operator '=' is ambiguous}}
+#endif
}
diff --git a/test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.asgn/move_convert03.pass.cpp b/test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.asgn/move_convert03.pass.cpp
deleted file mode 100644
index 9aea81a8b144..000000000000
--- a/test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.asgn/move_convert03.pass.cpp
+++ /dev/null
@@ -1,63 +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.
-//
-//===----------------------------------------------------------------------===//
-
-// <memory>
-
-// unique_ptr
-
-// Test unique_ptr converting move assignment
-
-// test converting move assignment with reference deleters
-
-#include <memory>
-#include <utility>
-#include <cassert>
-
-#include "../../deleter.h"
-
-struct A
-{
- static int count;
- A() {++count;}
- A(const A&) {++count;}
- virtual ~A() {--count;}
-};
-
-int A::count = 0;
-
-struct B
- : public A
-{
- static int count;
- B() {++count;}
- B(const B&) {++count;}
- virtual ~B() {--count;}
-};
-
-int B::count = 0;
-
-int main()
-{
- {
- CDeleter<B> db(5);
- std::unique_ptr<B, CDeleter<B>&> s(new B, db);
- A* p = s.get();
- CDeleter<A> da(6);
- std::unique_ptr<A, CDeleter<A>&> s2(new A, da);
- s2 = std::move(s);
- assert(s2.get() == p);
- assert(s.get() == 0);
- assert(A::count == 1);
- assert(B::count == 1);
- assert(s.get_deleter().state() == 5);
- assert(s2.get_deleter().state() == 5);
- }
- assert(A::count == 0);
- assert(B::count == 0);
-}
diff --git a/test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.asgn/move_convert04.fail.cpp b/test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.asgn/move_convert04.fail.cpp
index dba901b2ce17..2ebc33d21d81 100644
--- a/test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.asgn/move_convert04.fail.cpp
+++ b/test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.asgn/move_convert04.fail.cpp
@@ -14,44 +14,30 @@
// Test unique_ptr converting move assignment
#include <memory>
-#include <utility>
-#include <cassert>
-// Can't assign from const lvalue
+#include "test_macros.h"
+#include "../../deleter.h"
struct A
{
- static int count;
- A() {++count;}
- A(const A&) {++count;}
- virtual ~A() {--count;}
+ A() {}
+ virtual ~A() {}
};
-int A::count = 0;
-
-struct B
- : public A
+struct B : public A
{
- static int count;
- B() {++count;}
- B(const B&) {++count;}
- virtual ~B() {--count;}
};
-int B::count = 0;
-
+// Can't assign from lvalue
int main()
{
- {
const std::unique_ptr<B> s(new B);
- A* p = s.get();
std::unique_ptr<A> s2;
- s2 = s;
- assert(s2.get() == p);
- assert(s.get() == 0);
- assert(A::count == 1);
- assert(B::count == 1);
- }
- assert(A::count == 0);
- assert(B::count == 0);
+#if TEST_STD_VER >= 11
+ s2 = s; // expected-error {{no viable overloaded '='}}
+#else
+ // NOTE: The error says "constructor" because the assignment operator takes
+ // 's' by value and attempts to copy construct it.
+ s2 = s; // expected-error {{no matching constructor for initialization}}
+#endif
}
diff --git a/test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.asgn/move_convert13.fail.cpp b/test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.asgn/move_convert13.fail.cpp
index 56ab43c7de24..412648420d46 100644
--- a/test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.asgn/move_convert13.fail.cpp
+++ b/test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.asgn/move_convert13.fail.cpp
@@ -32,5 +32,5 @@ int main()
{
std::unique_ptr<A[], Deleter> s;
std::unique_ptr<A, Deleter> s2;
- s2 = std::move(s);
+ s2 = std::move(s); // expected-error {{no viable overloaded '='}}
}
diff --git a/test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/auto_pointer.pass.cpp b/test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/auto_pointer.pass.cpp
index 1ce1838afbb7..7c3ac462c287 100644
--- a/test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/auto_pointer.pass.cpp
+++ b/test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/auto_pointer.pass.cpp
@@ -7,17 +7,21 @@
//
//===----------------------------------------------------------------------===//
+// libc++ cannot safely provide the auto_ptr constructor without rvalue
+// references.
+// XFAIL: c++98, c++03
+
// <memory>
// unique_ptr
-// Test unique_ptr(pointer) ctor
+// template <class U> unique_ptr(auto_ptr<U>&&) noexcept
#include <memory>
#include <utility>
#include <cassert>
-// template <class U> explicit unique_ptr(auto_ptr<U>&);
+#include "test_macros.h"
struct A
{
@@ -65,4 +69,12 @@ int main()
}
assert(A::count == 0);
assert(B::count == 0);
+#if TEST_STD_VER >= 11
+ {
+ static_assert(std::is_nothrow_constructible<
+ std::unique_ptr<A>,
+ std::auto_ptr<B>&&
+ >::value, "");
+ }
+#endif
}
diff --git a/test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/default.pass.cpp b/test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/default.pass.cpp
new file mode 100644
index 000000000000..2694538145b9
--- /dev/null
+++ b/test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/default.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <memory>
+
+// unique_ptr
+
+//=============================================================================
+// TESTING std::unique_ptr::unique_ptr()
+//
+// Concerns:
+// 1 The default constructor works for any default constructible deleter types.
+// 2 The stored type 'T' is allowed to be incomplete.
+//
+// Plan
+// 1 Default construct unique_ptr's with various deleter types (C-1)
+// 2 Default construct a unique_ptr with a incomplete element_type and
+// various deleter types (C-1,2)
+
+#include <memory>
+#include <cassert>
+
+#include "../../deleter.h"
+
+struct IncompleteT;
+
+void checkNumIncompleteTypeAlive(int i);
+
+template <class Del = std::default_delete<IncompleteT> >
+struct StoresIncomplete {
+ std::unique_ptr<IncompleteT, Del> m_ptr;
+ StoresIncomplete() {}
+ ~StoresIncomplete();
+
+ IncompleteT* get() const { return m_ptr.get(); }
+ Del& get_deleter() { return m_ptr.get_deleter(); }
+};
+
+int main()
+{
+ {
+ std::unique_ptr<int> p;
+ assert(p.get() == 0);
+ }
+ {
+ std::unique_ptr<int, NCDeleter<int> > p;
+ assert(p.get() == 0);
+ assert(p.get_deleter().state() == 0);
+ p.get_deleter().set_state(5);
+ assert(p.get_deleter().state() == 5);
+ }
+ {
+ StoresIncomplete<> s;
+ assert(s.get() == 0);
+ checkNumIncompleteTypeAlive(0);
+ }
+ checkNumIncompleteTypeAlive(0);
+ {
+ StoresIncomplete< Deleter<IncompleteT> > s;
+ assert(s.get() == 0);
+ assert(s.get_deleter().state() == 0);
+ checkNumIncompleteTypeAlive(0);
+ }
+ checkNumIncompleteTypeAlive(0);
+}
+
+struct IncompleteT {
+ static int count;
+ IncompleteT() { ++count; }
+ ~IncompleteT() {--count; }
+};
+
+int IncompleteT::count = 0;
+
+void checkNumIncompleteTypeAlive(int i) {
+ assert(IncompleteT::count == i);
+}
+
+template <class Del>
+StoresIncomplete<Del>::~StoresIncomplete() { } \ No newline at end of file
diff --git a/test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/default01.pass.cpp b/test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/default01.pass.cpp
deleted file mode 100644
index e63db5cb7185..000000000000
--- a/test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/default01.pass.cpp
+++ /dev/null
@@ -1,46 +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.
-//
-//===----------------------------------------------------------------------===//
-
-// <memory>
-
-// unique_ptr
-
-// Test unique_ptr default ctor
-
-#include <memory>
-#include <cassert>
-
-// default unique_ptr ctor should only require default Deleter ctor
-class Deleter
-{
- int state_;
-
- Deleter(Deleter&);
- Deleter& operator=(Deleter&);
-
-public:
- Deleter() : state_(5) {}
-
- int state() const {return state_;}
-
- void operator()(void*) {}
-};
-
-int main()
-{
- {
- std::unique_ptr<int> p;
- assert(p.get() == 0);
- }
- {
- std::unique_ptr<int, Deleter> p;
- assert(p.get() == 0);
- assert(p.get_deleter().state() == 5);
- }
-}
diff --git a/test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/default02.pass.cpp b/test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/default02.pass.cpp
deleted file mode 100644
index e9af7e285255..000000000000
--- a/test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/default02.pass.cpp
+++ /dev/null
@@ -1,84 +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.
-//
-//===----------------------------------------------------------------------===//
-
-// <memory>
-
-// unique_ptr
-
-// Test default unique_ptr ctor
-
-#include <memory>
-#include <cassert>
-
-// default unique_ptr ctor shouldn't require complete type
-
-struct A;
-
-class Deleter
-{
- int state_;
-
- Deleter(Deleter&);
- Deleter& operator=(Deleter&);
-
-public:
- Deleter() : state_(5) {}
-
- int state() const {return state_;}
-
- void operator()(A* p);
-};
-
-void check(int i);
-
-template <class D = std::default_delete<A> >
-struct B
-{
- std::unique_ptr<A, D> a_;
- B() {}
- ~B();
-
- A* get() const {return a_.get();}
- D& get_deleter() {return a_.get_deleter();}
-};
-
-int main()
-{
- {
- B<> s;
- assert(s.get() == 0);
- }
- check(0);
- {
- B<Deleter> s;
- assert(s.get() == 0);
- assert(s.get_deleter().state() == 5);
- }
- check(0);
-}
-
-struct A
-{
- static int count;
- A() {++count;}
- A(const A&) {++count;}
- ~A() {--count;}
-};
-
-int A::count = 0;
-
-void Deleter::operator()(A* p) {delete p;}
-
-void check(int i)
-{
- assert(A::count == i);
-}
-
-template <class D>
-B<D>::~B() {}
diff --git a/test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/move.pass.cpp b/test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/move.pass.cpp
new file mode 100644
index 000000000000..4c5cc843a138
--- /dev/null
+++ b/test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/move.pass.cpp
@@ -0,0 +1,140 @@
+//===----------------------------------------------------------------------===//
+//
+// The 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>
+
+// unique_ptr
+
+// Test unique_ptr move ctor
+
+#include <memory>
+#include <utility>
+#include <cassert>
+
+#include "../../deleter.h"
+
+//=============================================================================
+// TESTING unique_ptr(unique_ptr&&)
+//
+// Concerns
+// 1 The moved from pointer is empty and the new pointer stores the old value.
+// 2 The only requirement on the deleter is that it is MoveConstructible
+// or a reference.
+// 3 The constructor works for explicitly moved values (ie std::move(x))
+// 4 The constructor works for true temporaries (ie a return value)
+//
+// Plan
+// 1 Explicitly construct unique_ptr<T, D> for various deleter types 'D'.
+// check that the value and deleter have been properly moved. (C-1,2,3)
+//
+// 2 Use the expression 'sink(source())' to move construct a unique_ptr<T, D>
+// from a temporary. 'source' should return the unique_ptr by value and
+// 'sink' should accept the unique_ptr by value. (C-1,2,4)
+
+struct A
+{
+ static int count;
+ A() {++count;}
+ A(const A&) {++count;}
+ virtual ~A() {--count;}
+};
+
+int A::count = 0;
+
+template <class Expect>
+void sinkFunction(Expect)
+{
+}
+
+typedef std::unique_ptr<A> APtrSource1;
+typedef std::unique_ptr<A, Deleter<A> > APtrSource2;
+typedef std::unique_ptr<A, NCDeleter<A>& > APtrSource3;
+
+APtrSource1 source1() {
+ return APtrSource1 (new A);
+}
+
+void sink1(APtrSource1 p) {
+ assert(p.get() != nullptr);
+}
+
+APtrSource2 source2() {
+ return APtrSource2(new A, Deleter<A>(5));
+}
+
+void sink2(APtrSource2 p) {
+ assert(p.get() != nullptr);
+ assert(p.get_deleter().state() == 5);
+}
+
+APtrSource3 source3() {
+ static NCDeleter<A> d(5);
+ return APtrSource3(new A, d);
+}
+
+void sink3(APtrSource3 p) {
+ assert(p.get() != nullptr);
+ assert(p.get_deleter().state() == 5);
+ assert(&p.get_deleter() == &source3().get_deleter());
+}
+
+int main()
+{
+ {
+ typedef std::unique_ptr<A> APtr;
+ APtr s(new A);
+ A* p = s.get();
+ APtr s2 = std::move(s);
+ assert(s2.get() == p);
+ assert(s.get() == 0);
+ assert(A::count == 1);
+ }
+ assert(A::count == 0);
+ {
+ typedef Deleter<A> MoveDel;
+ typedef std::unique_ptr<A, MoveDel> APtr;
+ MoveDel d(5);
+ APtr s(new A, std::move(d));
+ assert(d.state() == 0);
+ assert(s.get_deleter().state() == 5);
+ A* p = s.get();
+ APtr s2 = std::move(s);
+ assert(s2.get() == p);
+ assert(s.get() == 0);
+ assert(A::count == 1);
+ assert(s2.get_deleter().state() == 5);
+ assert(s.get_deleter().state() == 0);
+ }
+ assert(A::count == 0);
+ {
+ typedef NCDeleter<A> NonCopyDel;
+ typedef std::unique_ptr<A, NonCopyDel&> APtr;
+
+ NonCopyDel d;
+ APtr s(new A, d);
+ A* p = s.get();
+ APtr s2 = std::move(s);
+ assert(s2.get() == p);
+ assert(s.get() == 0);
+ assert(A::count == 1);
+ d.set_state(6);
+ assert(s2.get_deleter().state() == d.state());
+ assert(s.get_deleter().state() == d.state());
+ }
+ assert(A::count == 0);
+ {
+ sink1(source1());
+ assert(A::count == 0);
+ sink2(source2());
+ assert(A::count == 0);
+ sink3(source3());
+ assert(A::count == 0);
+ }
+ assert(A::count == 0);
+}
diff --git a/test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/move01.pass.cpp b/test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/move01.pass.cpp
deleted file mode 100644
index dc16c3115376..000000000000
--- a/test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/move01.pass.cpp
+++ /dev/null
@@ -1,142 +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.
-//
-//===----------------------------------------------------------------------===//
-
-// <memory>
-
-// unique_ptr
-
-// Test unique_ptr move ctor
-
-#include <memory>
-#include <utility>
-#include <cassert>
-
-// test move ctor. Should only require a MoveConstructible deleter, or if
-// deleter is a reference, not even that.
-
-struct A
-{
- static int count;
- A() {++count;}
- A(const A&) {++count;}
- ~A() {--count;}
-};
-
-int A::count = 0;
-
-template <class T>
-class Deleter
-{
- int state_;
-
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
- Deleter(const Deleter&);
- Deleter& operator=(const Deleter&);
-#else // _LIBCPP_HAS_NO_RVALUE_REFERENCES
- Deleter(Deleter&);
- Deleter& operator=(Deleter&);
-#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
-
-public:
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
- Deleter(Deleter&& r) : state_(r.state_) {r.state_ = 0;}
- Deleter& operator=(Deleter&& r)
- {
- state_ = r.state_;
- r.state_ = 0;
- return *this;
- }
-#else // _LIBCPP_HAS_NO_RVALUE_REFERENCES
- operator std::__rv<Deleter>() {return std::__rv<Deleter>(*this);}
- Deleter(std::__rv<Deleter> r) : state_(r->state_) {r->state_ = 0;}
- Deleter& operator=(std::__rv<Deleter> r)
- {
- state_ = r->state_;
- r->state_ = 0;
- return *this;
- }
-#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
-
- Deleter() : state_(5) {}
-
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
- template <class U>
- Deleter(Deleter<U>&& d,
- typename std::enable_if<!std::is_same<U, T>::value>::type* = 0)
- : state_(d.state()) {d.set_state(0);}
-
-private:
- template <class U>
- Deleter(const Deleter<U>& d,
- typename std::enable_if<!std::is_same<U, T>::value>::type* = 0);
-#else // _LIBCPP_HAS_NO_RVALUE_REFERENCES
- template <class U>
- Deleter(Deleter<U> d,
- typename std::enable_if<!std::is_same<U, T>::value>::type* = 0)
- : state_(d.state()) {}
-#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
-public:
- int state() const {return state_;}
- void set_state(int i) {state_ = i;}
-
- void operator()(T* p) {delete p;}
-};
-
-class CDeleter
-{
- int state_;
-
- CDeleter(CDeleter&);
- CDeleter& operator=(CDeleter&);
-public:
-
- CDeleter() : state_(5) {}
-
- int state() const {return state_;}
- void set_state(int s) {state_ = s;}
-
- void operator()(A* p) {delete p;}
-};
-
-int main()
-{
- {
- std::unique_ptr<A> s(new A);
- A* p = s.get();
- std::unique_ptr<A> s2 = std::move(s);
- assert(s2.get() == p);
- assert(s.get() == 0);
- assert(A::count == 1);
- }
- assert(A::count == 0);
- {
- std::unique_ptr<A, Deleter<A> > s(new A);
- A* p = s.get();
- std::unique_ptr<A, Deleter<A> > s2 = std::move(s);
- assert(s2.get() == p);
- assert(s.get() == 0);
- assert(A::count == 1);
- assert(s2.get_deleter().state() == 5);
- assert(s.get_deleter().state() == 0);
- }
- assert(A::count == 0);
- {
- CDeleter d;
- std::unique_ptr<A, CDeleter&> s(new A, d);
- A* p = s.get();
- std::unique_ptr<A, CDeleter&> s2 = std::move(s);
- assert(s2.get() == p);
- assert(s.get() == 0);
- assert(A::count == 1);
- d.set_state(6);
- assert(s2.get_deleter().state() == d.state());
- assert(s.get_deleter().state() == d.state());
- }
- assert(A::count == 0);
-}
diff --git a/test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/move02.pass.cpp b/test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/move02.pass.cpp
deleted file mode 100644
index 4b997df95a0b..000000000000
--- a/test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/move02.pass.cpp
+++ /dev/null
@@ -1,143 +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.
-//
-//===----------------------------------------------------------------------===//
-
-// <memory>
-
-// unique_ptr
-
-// Test unique_ptr move ctor
-
-#include <memory>
-#include <cassert>
-
-// test move ctor. Should only require a MoveConstructible deleter, or if
-// deleter is a reference, not even that.
-
-struct A
-{
- static int count;
- A() {++count;}
- A(const A&) {++count;}
- ~A() {--count;}
-};
-
-int A::count = 0;
-
-template <class T>
-class Deleter
-{
- int state_;
-
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
- Deleter(const Deleter&);
- Deleter& operator=(const Deleter&);
-#else // _LIBCPP_HAS_NO_RVALUE_REFERENCES
- Deleter(Deleter&);
- Deleter& operator=(Deleter&);
-#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
-
-public:
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
- Deleter(Deleter&& r) : state_(r.state_) {r.state_ = 0;}
- Deleter& operator=(Deleter&& r)
- {
- state_ = r.state_;
- r.state_ = 0;
- return *this;
- }
-#else // _LIBCPP_HAS_NO_RVALUE_REFERENCES
- operator std::__rv<Deleter>() {return std::__rv<Deleter>(*this);}
- Deleter(std::__rv<Deleter> r) : state_(r->state_) {r->state_ = 0;}
- Deleter& operator=(std::__rv<Deleter> r)
- {
- state_ = r->state_;
- r->state_ = 0;
- return *this;
- }
-#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
-
- Deleter() : state_(5) {}
-
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
- template <class U>
- Deleter(Deleter<U>&& d,
- typename std::enable_if<!std::is_same<U, T>::value>::type* = 0)
- : state_(d.state()) {d.set_state(0);}
-
-private:
- template <class U>
- Deleter(const Deleter<U>& d,
- typename std::enable_if<!std::is_same<U, T>::value>::type* = 0);
-#else // _LIBCPP_HAS_NO_RVALUE_REFERENCES
- template <class U>
- Deleter(Deleter<U> d,
- typename std::enable_if<!std::is_same<U, T>::value>::type* = 0)
- : state_(d.state()) {}
-#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
-public:
- int state() const {return state_;}
- void set_state(int i) {state_ = i;}
-
- void operator()(T* p) {delete p;}
-};
-
-class CDeleter
-{
- int state_;
-
- CDeleter(CDeleter&);
- CDeleter& operator=(CDeleter&);
-public:
-
- CDeleter() : state_(5) {}
-
- int state() const {return state_;}
- void set_state(int s) {state_ = s;}
-
- void operator()(A* p) {delete p;}
-};
-
-std::unique_ptr<A>
-source1()
-{
- return std::unique_ptr<A>(new A);
-}
-
-void sink1(std::unique_ptr<A> p)
-{
-}
-
-std::unique_ptr<A, Deleter<A> >
-source2()
-{
- return std::unique_ptr<A, Deleter<A> >(new A);
-}
-
-void sink2(std::unique_ptr<A, Deleter<A> > p)
-{
-}
-
-std::unique_ptr<A, CDeleter&>
-source3()
-{
- static CDeleter d;
- return std::unique_ptr<A, CDeleter&>(new A, d);
-}
-
-void sink3(std::unique_ptr<A, CDeleter&> p)
-{
-}
-
-int main()
-{
- sink1(source1());
- sink2(source2());
- sink3(source3());
- assert(A::count == 0);
-}
diff --git a/test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/move_convert.pass.cpp b/test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/move_convert.pass.cpp
new file mode 100644
index 000000000000..f00fcfe15b80
--- /dev/null
+++ b/test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/move_convert.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.
+//
+
+//===----------------------------------------------------------------------===//
+
+// <memory>
+
+// unique_ptr
+
+// Test unique_ptr converting move ctor
+
+// NOTE: unique_ptr does not provide converting constructors in c++03
+// XFAIL: c++98, c++03
+
+
+
+#include <memory>
+#include <type_traits>
+#include <utility>
+#include <cassert>
+
+#include "../../deleter.h"
+
+// test converting move ctor. Should only require a MoveConstructible deleter, or if
+// deleter is a reference, not even that.
+// Explicit version
+
+struct A
+{
+ static int count;
+ A() {++count;}
+ A(const A&) {++count;}
+ virtual ~A() {--count;}
+};
+
+int A::count = 0;
+
+struct B
+ : public A
+{
+ static int count;
+ B() {++count;}
+ B(const B&) {++count;}
+ virtual ~B() {--count;}
+};
+
+int B::count = 0;
+
+
+template <class LHS, class RHS>
+void checkReferenceDeleter(LHS& lhs, RHS& rhs) {
+ typedef typename LHS::deleter_type NewDel;
+ static_assert(std::is_reference<NewDel>::value, "");
+ rhs.get_deleter().set_state(42);
+ assert(rhs.get_deleter().state() == 42);
+ assert(lhs.get_deleter().state() == 42);
+ lhs.get_deleter().set_state(99);
+ assert(lhs.get_deleter().state() == 99);
+ assert(rhs.get_deleter().state() == 99);
+}
+
+template <class LHS, class RHS>
+void checkDeleter(LHS& lhs, RHS& rhs, int LHSVal, int RHSVal) {
+ assert(lhs.get_deleter().state() == LHSVal);
+ assert(rhs.get_deleter().state() == RHSVal);
+}
+
+template <class LHS, class RHS>
+void checkCtor(LHS& lhs, RHS& rhs, A* RHSVal) {
+ assert(lhs.get() == RHSVal);
+ assert(rhs.get() == nullptr);
+ assert(A::count == 1);
+ assert(B::count == 1);
+}
+
+void checkNoneAlive() {
+ assert(A::count == 0);
+ assert(B::count == 0);
+}
+
+int main()
+{
+ {
+ typedef std::unique_ptr<A> APtr;
+ typedef std::unique_ptr<B> BPtr;
+ { // explicit
+ BPtr b(new B);
+ A* p = b.get();
+ APtr a(std::move(b));
+ checkCtor(a, b, p);
+ }
+ checkNoneAlive();
+ { // implicit
+ BPtr b(new B);
+ A* p = b.get();
+ APtr a = std::move(b);
+ checkCtor(a, b, p);
+ }
+ checkNoneAlive();
+ }
+ { // test with moveable deleters
+ typedef std::unique_ptr<A, Deleter<A> > APtr;
+ typedef std::unique_ptr<B, Deleter<B> > BPtr;
+ {
+ Deleter<B> del(5);
+ BPtr b(new B, std::move(del));
+ A* p = b.get();
+ APtr a(std::move(b));
+ checkCtor(a, b, p);
+ checkDeleter(a, b, 5, 0);
+ }
+ checkNoneAlive();
+ {
+ Deleter<B> del(5);
+ BPtr b(new B, std::move(del));
+ A* p = b.get();
+ APtr a = std::move(b);
+ checkCtor(a, b, p);
+ checkDeleter(a, b, 5, 0);
+ }
+ checkNoneAlive();
+
+ }
+ { // test with reference deleters
+ typedef std::unique_ptr<A, NCDeleter<A>& > APtr;
+ typedef std::unique_ptr<B, NCDeleter<A>& > BPtr;
+ NCDeleter<A> del(5);
+ {
+ BPtr b(new B, del);
+ A* p = b.get();
+ APtr a(std::move(b));
+ checkCtor(a, b, p);
+ checkReferenceDeleter(a, b);
+ }
+ checkNoneAlive();
+ {
+ BPtr b(new B, del);
+ A* p = b.get();
+ APtr a = std::move(b);
+ checkCtor(a, b, p);
+ checkReferenceDeleter(a, b);
+ }
+ checkNoneAlive();
+ }
+ {
+ typedef std::unique_ptr<A, CDeleter<A> > APtr;
+ typedef std::unique_ptr<B, CDeleter<B>& > BPtr;
+ CDeleter<B> del(5);
+ {
+ BPtr b(new B, del);
+ A* p = b.get();
+ APtr a(std::move(b));
+ checkCtor(a, b, p);
+ checkDeleter(a, b, 5, 5);
+ }
+ checkNoneAlive();
+ {
+ BPtr b(new B, del);
+ A* p = b.get();
+ APtr a = std::move(b);
+ checkCtor(a, b, p);
+ checkDeleter(a, b, 5, 5);
+ }
+ checkNoneAlive();
+ }
+}
diff --git a/test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/move_convert01.pass.cpp b/test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/move_convert01.pass.cpp
deleted file mode 100644
index b65cf564a925..000000000000
--- a/test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/move_convert01.pass.cpp
+++ /dev/null
@@ -1,58 +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.
-//
-//===----------------------------------------------------------------------===//
-
-// <memory>
-
-// unique_ptr
-
-// Test unique_ptr converting move ctor
-
-#include <memory>
-#include <utility>
-#include <cassert>
-
-// test converting move ctor. Should only require a MoveConstructible deleter, or if
-// deleter is a reference, not even that.
-// Explicit version
-
-struct A
-{
- static int count;
- A() {++count;}
- A(const A&) {++count;}
- virtual ~A() {--count;}
-};
-
-int A::count = 0;
-
-struct B
- : public A
-{
- static int count;
- B() {++count;}
- B(const B&) {++count;}
- virtual ~B() {--count;}
-};
-
-int B::count = 0;
-
-int main()
-{
- {
- std::unique_ptr<B> s(new B);
- A* p = s.get();
- std::unique_ptr<A> s2(std::move(s));
- assert(s2.get() == p);
- assert(s.get() == 0);
- assert(A::count == 1);
- assert(B::count == 1);
- }
- assert(A::count == 0);
- assert(B::count == 0);
-}
diff --git a/test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/move_convert02.pass.cpp b/test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/move_convert02.pass.cpp
deleted file mode 100644
index 829e7553acd9..000000000000
--- a/test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/move_convert02.pass.cpp
+++ /dev/null
@@ -1,62 +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.
-//
-//===----------------------------------------------------------------------===//
-
-// <memory>
-
-// unique_ptr
-
-// Test unique_ptr converting move ctor
-
-#include <memory>
-#include <utility>
-#include <cassert>
-
-#include "../../deleter.h"
-
-// test converting move ctor. Should only require a MoveConstructible deleter, or if
-// deleter is a reference, not even that.
-// Explicit version
-
-struct A
-{
- static int count;
- A() {++count;}
- A(const A&) {++count;}
- virtual ~A() {--count;}
-};
-
-int A::count = 0;
-
-struct B
- : public A
-{
- static int count;
- B() {++count;}
- B(const B&) {++count;}
- virtual ~B() {--count;}
-};
-
-int B::count = 0;
-
-int main()
-{
- {
- std::unique_ptr<B, Deleter<B> > s(new B, Deleter<B>(5));
- A* p = s.get();
- std::unique_ptr<A, Deleter<A> > s2(std::move(s));
- assert(s2.get() == p);
- assert(s.get() == 0);
- assert(A::count == 1);
- assert(B::count == 1);
- assert(s2.get_deleter().state() == 5);
- assert(s.get_deleter().state() == 0);
- }
- assert(A::count == 0);
- assert(B::count == 0);
-}
diff --git a/test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/move_convert03.pass.cpp b/test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/move_convert03.pass.cpp
deleted file mode 100644
index 792076a95245..000000000000
--- a/test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/move_convert03.pass.cpp
+++ /dev/null
@@ -1,79 +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.
-//
-//===----------------------------------------------------------------------===//
-
-// <memory>
-
-// unique_ptr
-
-// Test unique_ptr converting move ctor
-
-#include <memory>
-#include <utility>
-#include <cassert>
-
-// test converting move ctor. Should only require a MoveConstructible deleter, or if
-// deleter is a reference, not even that.
-// Explicit version
-
-struct A
-{
- static int count;
- A() {++count;}
- A(const A&) {++count;}
- virtual ~A() {--count;}
-};
-
-int A::count = 0;
-
-struct B
- : public A
-{
- static int count;
- B() {++count;}
- B(const B&) {++count;}
- virtual ~B() {--count;}
-};
-
-int B::count = 0;
-
-template <class T>
-class CDeleter
-{
- int state_;
-
- CDeleter(CDeleter&);
- CDeleter& operator=(CDeleter&);
-public:
-
- CDeleter() : state_(5) {}
-
- int state() const {return state_;}
- void set_state(int s) {state_ = s;}
-
- void operator()(T* p) {delete p;}
-};
-
-int main()
-{
- {
- CDeleter<A> d;
- std::unique_ptr<B, CDeleter<A>&> s(new B, d);
- A* p = s.get();
- std::unique_ptr<A, CDeleter<A>&> s2(std::move(s));
- assert(s2.get() == p);
- assert(s.get() == 0);
- assert(A::count == 1);
- assert(B::count == 1);
- d.set_state(6);
- assert(s2.get_deleter().state() == d.state());
- assert(s.get_deleter().state() == d.state());
- }
- assert(A::count == 0);
- assert(B::count == 0);
-}
diff --git a/test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/move_convert04.pass.cpp b/test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/move_convert04.pass.cpp
deleted file mode 100644
index 12ab17fadcd3..000000000000
--- a/test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/move_convert04.pass.cpp
+++ /dev/null
@@ -1,58 +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.
-//
-//===----------------------------------------------------------------------===//
-
-// <memory>
-
-// unique_ptr
-
-// Test unique_ptr converting move ctor
-
-#include <memory>
-#include <utility>
-#include <cassert>
-
-// test converting move ctor. Should only require a MoveConstructible deleter, or if
-// deleter is a reference, not even that.
-// implicit version
-
-struct A
-{
- static int count;
- A() {++count;}
- A(const A&) {++count;}
- virtual ~A() {--count;}
-};
-
-int A::count = 0;
-
-struct B
- : public A
-{
- static int count;
- B() {++count;}
- B(const B&) {++count;}
- virtual ~B() {--count;}
-};
-
-int B::count = 0;
-
-int main()
-{
- {
- std::unique_ptr<B> s(new B);
- A* p = s.get();
- std::unique_ptr<A> s2 = std::move(s);
- assert(s2.get() == p);
- assert(s.get() == 0);
- assert(A::count == 1);
- assert(B::count == 1);
- }
- assert(A::count == 0);
- assert(B::count == 0);
-}
diff --git a/test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/move_convert05.pass.cpp b/test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/move_convert05.pass.cpp
deleted file mode 100644
index 8077b0dacb23..000000000000
--- a/test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/move_convert05.pass.cpp
+++ /dev/null
@@ -1,62 +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.
-//
-//===----------------------------------------------------------------------===//
-
-// <memory>
-
-// unique_ptr
-
-// Test unique_ptr converting move ctor
-
-#include <memory>
-#include <utility>
-#include <cassert>
-
-#include "../../deleter.h"
-
-// test converting move ctor. Should only require a MoveConstructible deleter, or if
-// deleter is a reference, not even that.
-// Implicit version
-
-struct A
-{
- static int count;
- A() {++count;}
- A(const A&) {++count;}
- virtual ~A() {--count;}
-};
-
-int A::count = 0;
-
-struct B
- : public A
-{
- static int count;
- B() {++count;}
- B(const B&) {++count;}
- virtual ~B() {--count;}
-};
-
-int B::count = 0;
-
-int main()
-{
- {
- std::unique_ptr<B, Deleter<B> > s(new B, Deleter<B>(5));
- A* p = s.get();
- std::unique_ptr<A, Deleter<A> > s2 = std::move(s);
- assert(s2.get() == p);
- assert(s.get() == 0);
- assert(A::count == 1);
- assert(B::count == 1);
- assert(s2.get_deleter().state() == 5);
- assert(s.get_deleter().state() == 0);
- }
- assert(A::count == 0);
- assert(B::count == 0);
-}
diff --git a/test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/move_convert06.pass.cpp b/test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/move_convert06.pass.cpp
deleted file mode 100644
index 4115107b85f9..000000000000
--- a/test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/move_convert06.pass.cpp
+++ /dev/null
@@ -1,79 +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.
-//
-//===----------------------------------------------------------------------===//
-
-// <memory>
-
-// unique_ptr
-
-// Test unique_ptr converting move ctor
-
-#include <memory>
-#include <utility>
-#include <cassert>
-
-// test converting move ctor. Should only require a MoveConstructible deleter, or if
-// deleter is a reference, not even that.
-// Explicit version
-
-struct A
-{
- static int count;
- A() {++count;}
- A(const A&) {++count;}
- virtual ~A() {--count;}
-};
-
-int A::count = 0;
-
-struct B
- : public A
-{
- static int count;
- B() {++count;}
- B(const B&) {++count;}
- virtual ~B() {--count;}
-};
-
-int B::count = 0;
-
-template <class T>
-class CDeleter
-{
- int state_;
-
- CDeleter(CDeleter&);
- CDeleter& operator=(CDeleter&);
-public:
-
- CDeleter() : state_(5) {}
-
- int state() const {return state_;}
- void set_state(int s) {state_ = s;}
-
- void operator()(T* p) {delete p;}
-};
-
-int main()
-{
- {
- CDeleter<A> d;
- std::unique_ptr<B, CDeleter<A>&> s(new B, d);
- A* p = s.get();
- std::unique_ptr<A, CDeleter<A>&> s2 = std::move(s);
- assert(s2.get() == p);
- assert(s.get() == 0);
- assert(A::count == 1);
- assert(B::count == 1);
- d.set_state(6);
- assert(s2.get_deleter().state() == d.state());
- assert(s.get_deleter().state() == d.state());
- }
- assert(A::count == 0);
- assert(B::count == 0);
-}
diff --git a/test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/move_convert07.pass.cpp b/test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/move_convert07.pass.cpp
deleted file mode 100644
index 978cb0e9024b..000000000000
--- a/test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/move_convert07.pass.cpp
+++ /dev/null
@@ -1,63 +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.
-//
-//===----------------------------------------------------------------------===//
-
-// <memory>
-
-// unique_ptr
-
-// Test unique_ptr converting move ctor
-
-#include <memory>
-#include <utility>
-#include <cassert>
-
-#include "../../deleter.h"
-
-// test converting move ctor. Should only require a MoveConstructible deleter, or if
-// deleter is a reference, not even that.
-// Implicit version
-
-struct A
-{
- static int count;
- A() {++count;}
- A(const A&) {++count;}
- virtual ~A() {--count;}
-};
-
-int A::count = 0;
-
-struct B
- : public A
-{
- static int count;
- B() {++count;}
- B(const B&) {++count;}
- virtual ~B() {--count;}
-};
-
-int B::count = 0;
-
-int main()
-{
- {
- CDeleter<B> b(5);
- std::unique_ptr<B, CDeleter<B>&> s(new B, b);
- A* p = s.get();
- std::unique_ptr<A, CDeleter<A> > s2 = std::move(s);
- assert(s2.get() == p);
- assert(s.get() == 0);
- assert(A::count == 1);
- assert(B::count == 1);
- assert(s2.get_deleter().state() == 5);
- assert(s.get_deleter().state() == 5);
- }
- assert(A::count == 0);
- assert(B::count == 0);
-}
diff --git a/test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/pointer.pass.cpp b/test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/pointer.pass.cpp
new file mode 100644
index 000000000000..faa554d8b320
--- /dev/null
+++ b/test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/pointer.pass.cpp
@@ -0,0 +1,163 @@
+//===----------------------------------------------------------------------===//
+//
+// The 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>
+
+// unique_ptr
+
+//=============================================================================
+// TESTING std::unique_ptr::unique_ptr()
+//
+// Concerns:
+// 1 The pointer constructor works for any default constructible deleter types.
+// 2 The pointer constructor accepts pointers to derived types.
+// 2 The stored type 'T' is allowed to be incomplete.
+//
+// Plan
+// 1 Construct unique_ptr<T, D>'s with a pointer to 'T' and various deleter
+// types (C-1)
+// 2 Construct unique_ptr<T, D>'s with a pointer to 'D' and various deleter
+// types where 'D' is derived from 'T'. (C-1,2)
+// 3 Construct a unique_ptr<T, D> with a pointer to 'T' and various deleter
+// types where 'T' is an incomplete type (C-1,3)
+
+// Test unique_ptr(pointer) ctor
+
+#include <memory>
+#include <cassert>
+
+#include "../../deleter.h"
+
+// unique_ptr(pointer) ctor should only require default Deleter ctor
+
+struct A
+{
+ static int count;
+ A() {++count;}
+ A(const A&) {++count;}
+ virtual ~A() {--count;}
+};
+
+int A::count = 0;
+
+
+struct B
+ : public A
+{
+ static int count;
+ B() {++count;}
+ B(const B&) {++count;}
+ virtual ~B() {--count;}
+};
+
+int B::count = 0;
+
+
+struct IncompleteT;
+
+IncompleteT* getIncomplete();
+void checkNumIncompleteTypeAlive(int i);
+
+template <class Del = std::default_delete<IncompleteT> >
+struct StoresIncomplete {
+ std::unique_ptr<IncompleteT, Del> m_ptr;
+ StoresIncomplete() {}
+ explicit StoresIncomplete(IncompleteT* ptr) : m_ptr(ptr) {}
+ ~StoresIncomplete();
+
+ IncompleteT* get() const { return m_ptr.get(); }
+ Del& get_deleter() { return m_ptr.get_deleter(); }
+};
+
+void test_pointer()
+{
+ {
+ A* p = new A;
+ assert(A::count == 1);
+ std::unique_ptr<A> s(p);
+ assert(s.get() == p);
+ }
+ assert(A::count == 0);
+ {
+ A* p = new A;
+ assert(A::count == 1);
+ std::unique_ptr<A, NCDeleter<A> > s(p);
+ assert(s.get() == p);
+ assert(s.get_deleter().state() == 0);
+ }
+ assert(A::count == 0);
+}
+
+void test_derived()
+{
+ {
+ B* p = new B;
+ assert(A::count == 1);
+ assert(B::count == 1);
+ std::unique_ptr<A> s(p);
+ assert(s.get() == p);
+ }
+ assert(A::count == 0);
+ assert(B::count == 0);
+ {
+ B* p = new B;
+ assert(A::count == 1);
+ assert(B::count == 1);
+ std::unique_ptr<A, NCDeleter<A> > s(p);
+ assert(s.get() == p);
+ assert(s.get_deleter().state() == 0);
+ }
+ assert(A::count == 0);
+ assert(B::count == 0);
+}
+
+void test_incomplete()
+{
+ {
+ IncompleteT* p = getIncomplete();
+ checkNumIncompleteTypeAlive(1);
+ StoresIncomplete<> s(p);
+ assert(s.get() == p);
+ }
+ checkNumIncompleteTypeAlive(0);
+ {
+ IncompleteT* p = getIncomplete();
+ checkNumIncompleteTypeAlive(1);
+ StoresIncomplete< NCDeleter<IncompleteT> > s(p);
+ assert(s.get() == p);
+ assert(s.get_deleter().state() == 0);
+ }
+ checkNumIncompleteTypeAlive(0);
+}
+
+struct IncompleteT {
+ static int count;
+ IncompleteT() { ++count; }
+ ~IncompleteT() {--count; }
+};
+
+int IncompleteT::count = 0;
+
+IncompleteT* getIncomplete() {
+ return new IncompleteT;
+}
+
+void checkNumIncompleteTypeAlive(int i) {
+ assert(IncompleteT::count == i);
+}
+
+template <class Del>
+StoresIncomplete<Del>::~StoresIncomplete() { }
+
+int main()
+{
+ test_pointer();
+ test_derived();
+ test_incomplete();
+}
diff --git a/test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/pointer01.pass.cpp b/test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/pointer01.pass.cpp
deleted file mode 100644
index e5fff774b790..000000000000
--- a/test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/pointer01.pass.cpp
+++ /dev/null
@@ -1,63 +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.
-//
-//===----------------------------------------------------------------------===//
-
-// <memory>
-
-// unique_ptr
-
-// Test unique_ptr(pointer) ctor
-
-#include <memory>
-#include <cassert>
-
-// unique_ptr(pointer) ctor should only require default Deleter ctor
-
-struct A
-{
- static int count;
- A() {++count;}
- A(const A&) {++count;}
- ~A() {--count;}
-};
-
-int A::count = 0;
-
-class Deleter
-{
- int state_;
-
- Deleter(Deleter&);
- Deleter& operator=(Deleter&);
-
-public:
- Deleter() : state_(5) {}
-
- int state() const {return state_;}
-
- void operator()(A* p) {delete p;}
-};
-
-int main()
-{
- {
- A* p = new A;
- assert(A::count == 1);
- std::unique_ptr<A> s(p);
- assert(s.get() == p);
- }
- assert(A::count == 0);
- {
- A* p = new A;
- assert(A::count == 1);
- std::unique_ptr<A, Deleter> s(p);
- assert(s.get() == p);
- assert(s.get_deleter().state() == 5);
- }
- assert(A::count == 0);
-}
diff --git a/test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/pointer02.pass.cpp b/test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/pointer02.pass.cpp
deleted file mode 100644
index a226e87d64a4..000000000000
--- a/test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/pointer02.pass.cpp
+++ /dev/null
@@ -1,95 +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.
-//
-//===----------------------------------------------------------------------===//
-
-// <memory>
-
-// unique_ptr
-
-// Test unique_ptr(pointer) ctor
-
-#include <memory>
-#include <cassert>
-
-// unique_ptr(pointer) ctor shouldn't require complete type
-
-struct A;
-
-class Deleter
-{
- int state_;
-
- Deleter(Deleter&);
- Deleter& operator=(Deleter&);
-
-public:
- Deleter() : state_(5) {}
-
- int state() const {return state_;}
-
- void operator()(A* p);
-};
-
-void check(int i);
-
-template <class D = std::default_delete<A> >
-struct B
-{
- std::unique_ptr<A, D> a_;
- explicit B(A*);
- ~B();
-
- A* get() const {return a_.get();}
- D& get_deleter() {return a_.get_deleter();}
-};
-
-A* get();
-
-int main()
-{
- {
- A* p = get();
- check(1);
- B<> s(p);
- assert(s.get() == p);
- }
- check(0);
- {
- A* p = get();
- check(1);
- B<Deleter> s(p);
- assert(s.get() == p);
- assert(s.get_deleter().state() == 5);
- }
- check(0);
-}
-
-struct A
-{
- static int count;
- A() {++count;}
- A(const A&) {++count;}
- ~A() {--count;}
-};
-
-int A::count = 0;
-
-A* get() {return new A;}
-
-void Deleter::operator()(A* p) {delete p;}
-
-void check(int i)
-{
- assert(A::count == i);
-}
-
-template <class D>
-B<D>::B(A* a) : a_(a) {}
-
-template <class D>
-B<D>::~B() {}
diff --git a/test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/pointer03.pass.cpp b/test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/pointer03.pass.cpp
deleted file mode 100644
index 42fc09453914..000000000000
--- a/test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/pointer03.pass.cpp
+++ /dev/null
@@ -1,78 +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.
-//
-//===----------------------------------------------------------------------===//
-
-// <memory>
-
-// unique_ptr
-
-// Test unique_ptr(pointer) ctor
-
-#include <memory>
-#include <cassert>
-
-// unique_ptr(pointer) ctor should work with derived pointers
-
-struct A
-{
- static int count;
- A() {++count;}
- A(const A&) {++count;}
- virtual ~A() {--count;}
-};
-
-int A::count = 0;
-
-struct B
- : public A
-{
- static int count;
- B() {++count;}
- B(const B&) {++count;}
- virtual ~B() {--count;}
-};
-
-int B::count = 0;
-
-class Deleter
-{
- int state_;
-
- Deleter(Deleter&);
- Deleter& operator=(Deleter&);
-
-public:
- Deleter() : state_(5) {}
-
- int state() const {return state_;}
-
- void operator()(A* p) {delete p;}
-};
-
-int main()
-{
- {
- B* p = new B;
- assert(A::count == 1);
- assert(B::count == 1);
- std::unique_ptr<A> s(p);
- assert(s.get() == p);
- }
- assert(A::count == 0);
- assert(B::count == 0);
- {
- B* p = new B;
- assert(A::count == 1);
- assert(B::count == 1);
- std::unique_ptr<A, Deleter> s(p);
- assert(s.get() == p);
- assert(s.get_deleter().state() == 5);
- }
- assert(A::count == 0);
- assert(B::count == 0);
-}
diff --git a/test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/pointer_deleter.pass.cpp b/test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/pointer_deleter.pass.cpp
new file mode 100644
index 000000000000..7ddd16265107
--- /dev/null
+++ b/test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/pointer_deleter.pass.cpp
@@ -0,0 +1,123 @@
+//===----------------------------------------------------------------------===//
+//
+// The 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>
+
+// unique_ptr
+
+//=============================================================================
+// TESTING unique_ptr(pointer, deleter)
+//
+// Concerns:
+// 1 unique_ptr(pointer, deleter&&) only requires a MoveConstructible deleter.
+// 2 unique_ptr(pointer, deleter&) requires a CopyConstructible deleter.
+// 3 unique_ptr<T, D&>(pointer, deleter) does not require a CopyConstructible deleter.
+// 4 unique_ptr<T, D const&>(pointer, deleter) does not require a CopyConstructible deleter.
+// 5 unique_ptr(pointer, deleter) should work for derived pointers.
+// 6 unique_ptr(pointer, deleter) should work with function pointers.
+// 7 unique_ptr<void> should work.
+
+
+#include <memory>
+#include <cassert>
+
+#include "../../deleter.h"
+
+struct A
+{
+ static int count;
+ A() {++count;}
+ A(const A&) {++count;}
+ virtual ~A() {--count;}
+};
+
+int A::count = 0;
+
+
+struct B
+ : public A
+{
+ static int count;
+ B() {++count;}
+ B(const B&) {++count;}
+ virtual ~B() {--count;}
+};
+
+int B::count = 0;
+
+bool my_free_called = false;
+
+void my_free(void*) {
+ my_free_called = true;
+}
+
+int main()
+{
+ { // MoveConstructible deleter (C-1)
+ A* p = new A;
+ assert(A::count == 1);
+ std::unique_ptr<A, Deleter<A> > s(p, Deleter<A>(5));
+ assert(s.get() == p);
+ assert(s.get_deleter().state() == 5);
+ }
+ assert(A::count == 0);
+ { // CopyConstructible deleter (C-2)
+ A* p = new A;
+ assert(A::count == 1);
+ CopyDeleter<A> d(5);
+ std::unique_ptr<A, CopyDeleter<A> > s(p, d);
+ assert(s.get() == p);
+ assert(s.get_deleter().state() == 5);
+ d.set_state(6);
+ assert(s.get_deleter().state() == 5);
+ }
+ assert(A::count == 0);
+ { // Reference deleter (C-3)
+ A* p = new A;
+ assert(A::count == 1);
+ NCDeleter<A> d(5);
+ std::unique_ptr<A, NCDeleter<A>&> s(p, d);
+ assert(s.get() == p);
+ assert(&s.get_deleter() == &d);
+ assert(s.get_deleter().state() == 5);
+ d.set_state(6);
+ assert(s.get_deleter().state() == 6);
+ }
+ assert(A::count == 0);
+ { // Const Reference deleter (C-4)
+ A* p = new A;
+ assert(A::count == 1);
+ NCConstDeleter<A> d(5);
+ std::unique_ptr<A, NCConstDeleter<A> const&> s(p, d);
+ assert(s.get() == p);
+ assert(s.get_deleter().state() == 5);
+ assert(&s.get_deleter() == &d);
+ }
+ assert(A::count == 0);
+ { // Derived pointers (C-5)
+ B* p = new B;
+ assert(A::count == 1);
+ assert(B::count == 1);
+ std::unique_ptr<A, Deleter<A> > s(p, Deleter<A>(5));
+ assert(s.get() == p);
+ assert(s.get_deleter().state() == 5);
+ }
+ assert(A::count == 0);
+ assert(B::count == 0);
+ { // Void and function pointers (C-6,7)
+ {
+ int i = 0;
+ std::unique_ptr<void, void(*)(void*)> s(&i, my_free);
+ assert(s.get() == &i);
+ assert(s.get_deleter() == my_free);
+ assert(!my_free_called);
+ }
+ assert(my_free_called);
+ }
+}
diff --git a/test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/pointer_deleter01.pass.cpp b/test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/pointer_deleter01.pass.cpp
deleted file mode 100644
index 130f91d6216f..000000000000
--- a/test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/pointer_deleter01.pass.cpp
+++ /dev/null
@@ -1,99 +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.
-//
-//===----------------------------------------------------------------------===//
-
-// <memory>
-
-// unique_ptr
-
-// Test unique_ptr(pointer) ctor
-
-#include <memory>
-#include <cassert>
-
-// unique_ptr(pointer, deleter()) only requires MoveConstructible deleter
-
-struct A
-{
- static int count;
- A() {++count;}
- A(const A&) {++count;}
- ~A() {--count;}
-};
-
-int A::count = 0;
-
-template <class T>
-class Deleter
-{
- int state_;
-
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
- Deleter(const Deleter&);
- Deleter& operator=(const Deleter&);
-#else // _LIBCPP_HAS_NO_RVALUE_REFERENCES
- Deleter(Deleter&);
- Deleter& operator=(Deleter&);
-#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
-
-public:
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
- Deleter(Deleter&& r) : state_(r.state_) {r.state_ = 0;}
- Deleter& operator=(Deleter&& r)
- {
- state_ = r.state_;
- r.state_ = 0;
- return *this;
- }
-#else // _LIBCPP_HAS_NO_RVALUE_REFERENCES
- operator std::__rv<Deleter>() {return std::__rv<Deleter>(*this);}
- Deleter(std::__rv<Deleter> r) : state_(r->state_) {r->state_ = 0;}
- Deleter& operator=(std::__rv<Deleter> r)
- {
- state_ = r->state_;
- r->state_ = 0;
- return *this;
- }
-#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
-
- Deleter() : state_(5) {}
-
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
- template <class U>
- Deleter(Deleter<U>&& d,
- typename std::enable_if<!std::is_same<U, T>::value>::type* = 0)
- : state_(d.state()) {d.set_state(0);}
-
-private:
- template <class U>
- Deleter(const Deleter<U>& d,
- typename std::enable_if<!std::is_same<U, T>::value>::type* = 0);
-#else // _LIBCPP_HAS_NO_RVALUE_REFERENCES
- template <class U>
- Deleter(Deleter<U> d,
- typename std::enable_if<!std::is_same<U, T>::value>::type* = 0)
- : state_(d.state()) {}
-#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
-public:
- int state() const {return state_;}
- void set_state(int i) {state_ = i;}
-
- void operator()(T* p) {delete p;}
-};
-
-int main()
-{
- {
- A* p = new A;
- assert(A::count == 1);
- std::unique_ptr<A, Deleter<A> > s(p, Deleter<A>());
- assert(s.get() == p);
- assert(s.get_deleter().state() == 5);
- }
- assert(A::count == 0);
-}
diff --git a/test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/pointer_deleter02.pass.cpp b/test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/pointer_deleter02.pass.cpp
deleted file mode 100644
index 421bec55f99c..000000000000
--- a/test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/pointer_deleter02.pass.cpp
+++ /dev/null
@@ -1,58 +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.
-//
-//===----------------------------------------------------------------------===//
-
-// <memory>
-
-// unique_ptr
-
-// Test unique_ptr(pointer) ctor
-
-#include <memory>
-#include <cassert>
-
-// unique_ptr(pointer, d) requires CopyConstructible deleter
-
-struct A
-{
- static int count;
- A() {++count;}
- A(const A&) {++count;}
- ~A() {--count;}
-};
-
-int A::count = 0;
-
-class Deleter
-{
- int state_;
-
-public:
-
- Deleter() : state_(5) {}
-
- int state() const {return state_;}
- void set_state(int s) {state_ = s;}
-
- void operator()(A* p) {delete p;}
-};
-
-int main()
-{
- {
- A* p = new A;
- assert(A::count == 1);
- Deleter d;
- std::unique_ptr<A, Deleter> s(p, d);
- assert(s.get() == p);
- assert(s.get_deleter().state() == 5);
- d.set_state(6);
- assert(s.get_deleter().state() == 5);
- }
- assert(A::count == 0);
-}
diff --git a/test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/pointer_deleter03.pass.cpp b/test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/pointer_deleter03.pass.cpp
deleted file mode 100644
index bce79dbb1a97..000000000000
--- a/test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/pointer_deleter03.pass.cpp
+++ /dev/null
@@ -1,60 +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.
-//
-//===----------------------------------------------------------------------===//
-
-// <memory>
-
-// unique_ptr
-
-// Test unique_ptr(pointer) ctor
-
-#include <memory>
-#include <cassert>
-
-// unique_ptr<T, D&>(pointer, d) does not requires CopyConstructible deleter
-
-struct A
-{
- static int count;
- A() {++count;}
- A(const A&) {++count;}
- ~A() {--count;}
-};
-
-int A::count = 0;
-
-class Deleter
-{
- int state_;
-
- Deleter(const Deleter&);
- Deleter& operator=(const Deleter&);
-public:
-
- Deleter() : state_(5) {}
-
- int state() const {return state_;}
- void set_state(int s) {state_ = s;}
-
- void operator()(A* p) {delete p;}
-};
-
-int main()
-{
- {
- A* p = new A;
- assert(A::count == 1);
- Deleter d;
- std::unique_ptr<A, Deleter&> s(p, d);
- assert(s.get() == p);
- assert(s.get_deleter().state() == 5);
- d.set_state(6);
- assert(s.get_deleter().state() == 6);
- }
- assert(A::count == 0);
-}
diff --git a/test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/pointer_deleter04.fail.cpp b/test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/pointer_deleter04.fail.cpp
index 7cacd1fda9f3..ad64b5e4ea39 100644
--- a/test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/pointer_deleter04.fail.cpp
+++ b/test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/pointer_deleter04.fail.cpp
@@ -7,49 +7,24 @@
//
//===----------------------------------------------------------------------===//
+// Without rvalue references it is impossible to detect when a rvalue deleter
+// is given.
+// XFAIL: c++98, c++03
+
// <memory>
// unique_ptr
-// Test unique_ptr(pointer) ctor
-
-#include <memory>
-#include <cassert>
-
// unique_ptr<T, const D&>(pointer, D()) should not compile
-struct A
-{
- static int count;
- A() {++count;}
- A(const A&) {++count;}
- ~A() {--count;}
-};
-
-int A::count = 0;
-
-class Deleter
-{
- int state_;
-
-public:
-
- Deleter() : state_(5) {}
-
- int state() const {return state_;}
- void set_state(int s) {state_ = s;}
+#include <memory>
- void operator()(A* p) const {delete p;}
+struct Deleter {
+ void operator()(int* p) const {delete p;}
};
int main()
{
- {
- A* p = new A;
- assert(A::count == 1);
- std::unique_ptr<A, const Deleter&> s(p, Deleter());
- assert(s.get() == p);
- assert(s.get_deleter().state() == 5);
- }
- assert(A::count == 0);
+ // expected-error@memory:* {{static_assert failed "rvalue deleter bound to reference"}}
+ std::unique_ptr<int, const Deleter&> s((int*)nullptr, Deleter()); // expected-note {{requested here}}
}
diff --git a/test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/pointer_deleter04.pass.cpp b/test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/pointer_deleter04.pass.cpp
deleted file mode 100644
index a7750fcb9f0f..000000000000
--- a/test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/pointer_deleter04.pass.cpp
+++ /dev/null
@@ -1,58 +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.
-//
-//===----------------------------------------------------------------------===//
-
-// <memory>
-
-// unique_ptr
-
-// Test unique_ptr(pointer) ctor
-
-#include <memory>
-#include <cassert>
-
-// unique_ptr<T, const D&>(pointer, d) does not requires CopyConstructible deleter
-
-struct A
-{
- static int count;
- A() {++count;}
- A(const A&) {++count;}
- ~A() {--count;}
-};
-
-int A::count = 0;
-
-class Deleter
-{
- int state_;
-
- Deleter(const Deleter&);
- Deleter& operator=(const Deleter&);
-public:
-
- Deleter() : state_(5) {}
-
- int state() const {return state_;}
- void set_state(int s) {state_ = s;}
-
- void operator()(A* p) const {delete p;}
-};
-
-int main()
-{
- {
- A* p = new A;
- assert(A::count == 1);
- Deleter d;
- std::unique_ptr<A, const Deleter&> s(p, d);
- assert(s.get() == p);
- assert(s.get_deleter().state() == 5);
- }
- assert(A::count == 0);
-}
diff --git a/test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/pointer_deleter05.pass.cpp b/test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/pointer_deleter05.pass.cpp
deleted file mode 100644
index 1a83258e1e41..000000000000
--- a/test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/pointer_deleter05.pass.cpp
+++ /dev/null
@@ -1,66 +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.
-//
-//===----------------------------------------------------------------------===//
-
-// <memory>
-
-// unique_ptr
-
-// Test unique_ptr(pointer, deleter) ctor
-
-#include <memory>
-#include <cassert>
-
-// unique_ptr(pointer, deleter) should work with derived pointers
-
-struct A
-{
- static int count;
- A() {++count;}
- A(const A&) {++count;}
- virtual ~A() {--count;}
-};
-
-int A::count = 0;
-
-struct B
- : public A
-{
- static int count;
- B() {++count;}
- B(const B&) {++count;}
- virtual ~B() {--count;}
-};
-
-int B::count = 0;
-
-class Deleter
-{
- int state_;
-
-public:
- Deleter() : state_(5) {}
-
- int state() const {return state_;}
-
- void operator()(A* p) {delete p;}
-};
-
-int main()
-{
- {
- B* p = new B;
- assert(A::count == 1);
- assert(B::count == 1);
- std::unique_ptr<A, Deleter> s(p, Deleter());
- assert(s.get() == p);
- assert(s.get_deleter().state() == 5);
- }
- assert(A::count == 0);
- assert(B::count == 0);
-}
diff --git a/test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/pointer_deleter06.pass.cpp b/test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/pointer_deleter06.pass.cpp
deleted file mode 100644
index ed68052cd3bb..000000000000
--- a/test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/pointer_deleter06.pass.cpp
+++ /dev/null
@@ -1,39 +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.
-//
-//===----------------------------------------------------------------------===//
-
-// <memory>
-
-// unique_ptr
-
-// Test unique_ptr(pointer, deleter) ctor
-
-#include <memory>
-#include <cassert>
-
-// unique_ptr(pointer, deleter) should work with function pointers
-// unique_ptr<void> should work
-
-bool my_free_called = false;
-
-void my_free(void*)
-{
- my_free_called = true;
-}
-
-int main()
-{
- {
- int i = 0;
- std::unique_ptr<void, void (*)(void*)> s(&i, my_free);
- assert(s.get() == &i);
- assert(s.get_deleter() == my_free);
- assert(!my_free_called);
- }
- assert(my_free_called);
-}
diff --git a/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/auto_ptr.pass.cpp b/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/auto_ptr.pass.cpp
index b2e61faff5ed..f17485108b92 100644
--- a/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/auto_ptr.pass.cpp
+++ b/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/auto_ptr.pass.cpp
@@ -7,6 +7,7 @@
//
//===----------------------------------------------------------------------===//
+// XFAIL: libcpp-no-exceptions
// <memory>
// template<class Y> explicit shared_ptr(auto_ptr<Y>&& r);
diff --git a/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/nullptr_t_deleter_allocator_throw.pass.cpp b/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/nullptr_t_deleter_allocator_throw.pass.cpp
index ab2c73e0c5f1..41aeb04a5feb 100644
--- a/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/nullptr_t_deleter_allocator_throw.pass.cpp
+++ b/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/nullptr_t_deleter_allocator_throw.pass.cpp
@@ -7,6 +7,7 @@
//
//===----------------------------------------------------------------------===//
+// XFAIL: libcpp-no-exceptions
// <memory>
// template<class D, class A> shared_ptr(nullptr_t, D d, A a);
diff --git a/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/nullptr_t_deleter_throw.pass.cpp b/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/nullptr_t_deleter_throw.pass.cpp
index 97d3f69fb5c4..6a79a8ef60db 100644
--- a/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/nullptr_t_deleter_throw.pass.cpp
+++ b/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/nullptr_t_deleter_throw.pass.cpp
@@ -7,6 +7,7 @@
//
//===----------------------------------------------------------------------===//
+// XFAIL: libcpp-no-exceptions
// <memory>
// shared_ptr
diff --git a/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/pointer_deleter_allocator_throw.pass.cpp b/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/pointer_deleter_allocator_throw.pass.cpp
index 4220993a5fd1..c72847791778 100644
--- a/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/pointer_deleter_allocator_throw.pass.cpp
+++ b/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/pointer_deleter_allocator_throw.pass.cpp
@@ -7,6 +7,7 @@
//
//===----------------------------------------------------------------------===//
+// XFAIL: libcpp-no-exceptions
// <memory>
// template<class Y, class D, class A> shared_ptr(Y* p, D d, A a);
diff --git a/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/pointer_deleter_throw.pass.cpp b/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/pointer_deleter_throw.pass.cpp
index ead081645671..982313b07499 100644
--- a/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/pointer_deleter_throw.pass.cpp
+++ b/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/pointer_deleter_throw.pass.cpp
@@ -7,6 +7,7 @@
//
//===----------------------------------------------------------------------===//
+// XFAIL: libcpp-no-exceptions
// <memory>
// shared_ptr
diff --git a/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/pointer_throw.pass.cpp b/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/pointer_throw.pass.cpp
index 041fe9a7853d..2e761d70bba0 100644
--- a/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/pointer_throw.pass.cpp
+++ b/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/pointer_throw.pass.cpp
@@ -7,6 +7,7 @@
//
//===----------------------------------------------------------------------===//
+// XFAIL: libcpp-no-exceptions
// <memory>
// template<class Y> explicit shared_ptr(Y* p);
diff --git a/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/unique_ptr.pass.cpp b/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/unique_ptr.pass.cpp
index 5e09d9a7934c..c62fcd689320 100644
--- a/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/unique_ptr.pass.cpp
+++ b/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/unique_ptr.pass.cpp
@@ -7,6 +7,7 @@
//
//===----------------------------------------------------------------------===//
+// XFAIL: libcpp-no-exceptions
// <memory>
// template <class Y, class D> explicit shared_ptr(unique_ptr<Y, D>&&r);
diff --git a/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/weak_ptr.pass.cpp b/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/weak_ptr.pass.cpp
index a9d8aff145a7..35a7d077b424 100644
--- a/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/weak_ptr.pass.cpp
+++ b/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/weak_ptr.pass.cpp
@@ -7,6 +7,7 @@
//
//===----------------------------------------------------------------------===//
+// XFAIL: libcpp-no-exceptions
// <memory>
// shared_ptr
diff --git a/test/std/utilities/memory/util.smartptr/util.smartptr.weak/util.smartptr.ownerless/owner_less.pass.cpp b/test/std/utilities/memory/util.smartptr/util.smartptr.weak/util.smartptr.ownerless/owner_less.pass.cpp
index d091ae99fc27..bf1719c66ffa 100644
--- a/test/std/utilities/memory/util.smartptr/util.smartptr.weak/util.smartptr.ownerless/owner_less.pass.cpp
+++ b/test/std/utilities/memory/util.smartptr/util.smartptr.weak/util.smartptr.ownerless/owner_less.pass.cpp
@@ -30,9 +30,28 @@
// bool operator()(shared_ptr<T> const&, weak_ptr<T> const&) const;
// bool operator()(weak_ptr<T> const&, shared_ptr<T> const&) const;
// };
+//
+// Added in C++17
+// template<> struct owner_less<void>
+// {
+// template<class T, class U>
+// bool operator()(shared_ptr<T> const&, shared_ptr<U> const&) const;
+// template<class T, class U>
+// bool operator()(shared_ptr<T> const&, weak_ptr<U> const&) const;
+// template<class T, class U>
+// bool operator()(weak_ptr<T> const&, shared_ptr<U> const&) const;
+// template<class T, class U>
+// bool operator()(weak_ptr<T> const&, weak_ptr<U> const&) const;
+//
+// typedef unspecified is_transparent;
+// };
#include <memory>
#include <cassert>
+#include <set>
+#include "test_macros.h"
+
+struct X {};
int main()
{
@@ -79,4 +98,25 @@ int main()
assert(cs(w1, p3) || cs(w3, p1));
assert(cs(w3, p1) == cs(w3, p2));
}
+#if TEST_STD_VER > 14
+ {
+ std::shared_ptr<int> sp1;
+ std::shared_ptr<void> sp2;
+ std::shared_ptr<long> sp3;
+ std::weak_ptr<int> wp1;
+
+ std::owner_less<> cmp;
+ cmp(sp1, sp2);
+ cmp(sp1, wp1);
+ cmp(sp1, sp3);
+ cmp(wp1, sp1);
+ cmp(wp1, wp1);
+ }
+ {
+ // test heterogeneous lookups
+ std::set<std::shared_ptr<X>, std::owner_less<>> s;
+ std::shared_ptr<void> vp;
+ s.find(vp);
+ }
+#endif
}
diff --git a/test/std/utilities/meta/meta.logical/conjunction.pass.cpp b/test/std/utilities/meta/meta.logical/conjunction.pass.cpp
new file mode 100644
index 000000000000..dce58ec23725
--- /dev/null
+++ b/test/std/utilities/meta/meta.logical/conjunction.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
+// type_traits
+
+// template<class... B> struct conjunction; // C++17
+// template<class... B>
+// constexpr bool conjunction_v = conjunction<B...>::value; // C++17
+
+#include <type_traits>
+#include <cassert>
+
+struct True { static constexpr bool value = true; };
+struct False { static constexpr bool value = false; };
+
+int main()
+{
+ static_assert ( std::conjunction<>::value, "" );
+ static_assert ( std::conjunction<std::true_type >::value, "" );
+ static_assert (!std::conjunction<std::false_type>::value, "" );
+
+ static_assert ( std::conjunction_v<>, "" );
+ static_assert ( std::conjunction_v<std::true_type >, "" );
+ static_assert (!std::conjunction_v<std::false_type>, "" );
+
+ static_assert ( std::conjunction<std::true_type, std::true_type >::value, "" );
+ static_assert (!std::conjunction<std::true_type, std::false_type>::value, "" );
+ static_assert (!std::conjunction<std::false_type, std::true_type >::value, "" );
+ static_assert (!std::conjunction<std::false_type, std::false_type>::value, "" );
+
+ static_assert ( std::conjunction_v<std::true_type, std::true_type >, "" );
+ static_assert (!std::conjunction_v<std::true_type, std::false_type>, "" );
+ static_assert (!std::conjunction_v<std::false_type, std::true_type >, "" );
+ static_assert (!std::conjunction_v<std::false_type, std::false_type>, "" );
+
+ static_assert ( std::conjunction<std::true_type, std::true_type, std::true_type >::value, "" );
+ static_assert (!std::conjunction<std::true_type, std::false_type, std::true_type >::value, "" );
+ static_assert (!std::conjunction<std::false_type, std::true_type, std::true_type >::value, "" );
+ static_assert (!std::conjunction<std::false_type, std::false_type, std::true_type >::value, "" );
+ static_assert (!std::conjunction<std::true_type, std::true_type, std::false_type>::value, "" );
+ static_assert (!std::conjunction<std::true_type, std::false_type, std::false_type>::value, "" );
+ static_assert (!std::conjunction<std::false_type, std::true_type, std::false_type>::value, "" );
+ static_assert (!std::conjunction<std::false_type, std::false_type, std::false_type>::value, "" );
+
+ static_assert ( std::conjunction_v<std::true_type, std::true_type, std::true_type >, "" );
+ static_assert (!std::conjunction_v<std::true_type, std::false_type, std::true_type >, "" );
+ static_assert (!std::conjunction_v<std::false_type, std::true_type, std::true_type >, "" );
+ static_assert (!std::conjunction_v<std::false_type, std::false_type, std::true_type >, "" );
+ static_assert (!std::conjunction_v<std::true_type, std::true_type, std::false_type>, "" );
+ static_assert (!std::conjunction_v<std::true_type, std::false_type, std::false_type>, "" );
+ static_assert (!std::conjunction_v<std::false_type, std::true_type, std::false_type>, "" );
+ static_assert (!std::conjunction_v<std::false_type, std::false_type, std::false_type>, "" );
+
+ static_assert ( std::conjunction<True >::value, "" );
+ static_assert (!std::conjunction<False>::value, "" );
+
+ static_assert ( std::conjunction_v<True >, "" );
+ static_assert (!std::conjunction_v<False>, "" );
+}
diff --git a/test/std/utilities/meta/meta.logical/disjunction.pass.cpp b/test/std/utilities/meta/meta.logical/disjunction.pass.cpp
new file mode 100644
index 000000000000..13cd9341b99f
--- /dev/null
+++ b/test/std/utilities/meta/meta.logical/disjunction.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
+// type_traits
+
+// template<class... B> struct disjunction; // C++17
+// template<class... B>
+// constexpr bool disjunction_v = disjunction<B...>::value; // C++17
+
+#include <type_traits>
+#include <cassert>
+
+struct True { static constexpr bool value = true; };
+struct False { static constexpr bool value = false; };
+
+int main()
+{
+ static_assert (!std::disjunction<>::value, "" );
+ static_assert ( std::disjunction<std::true_type >::value, "" );
+ static_assert (!std::disjunction<std::false_type>::value, "" );
+
+ static_assert (!std::disjunction_v<>, "" );
+ static_assert ( std::disjunction_v<std::true_type >, "" );
+ static_assert (!std::disjunction_v<std::false_type>, "" );
+
+ static_assert ( std::disjunction<std::true_type, std::true_type >::value, "" );
+ static_assert ( std::disjunction<std::true_type, std::false_type>::value, "" );
+ static_assert ( std::disjunction<std::false_type, std::true_type >::value, "" );
+ static_assert (!std::disjunction<std::false_type, std::false_type>::value, "" );
+
+ static_assert ( std::disjunction_v<std::true_type, std::true_type >, "" );
+ static_assert ( std::disjunction_v<std::true_type, std::false_type>, "" );
+ static_assert ( std::disjunction_v<std::false_type, std::true_type >, "" );
+ static_assert (!std::disjunction_v<std::false_type, std::false_type>, "" );
+
+ static_assert ( std::disjunction<std::true_type, std::true_type, std::true_type >::value, "" );
+ static_assert ( std::disjunction<std::true_type, std::false_type, std::true_type >::value, "" );
+ static_assert ( std::disjunction<std::false_type, std::true_type, std::true_type >::value, "" );
+ static_assert ( std::disjunction<std::false_type, std::false_type, std::true_type >::value, "" );
+ static_assert ( std::disjunction<std::true_type, std::true_type, std::false_type>::value, "" );
+ static_assert ( std::disjunction<std::true_type, std::false_type, std::false_type>::value, "" );
+ static_assert ( std::disjunction<std::false_type, std::true_type, std::false_type>::value, "" );
+ static_assert (!std::disjunction<std::false_type, std::false_type, std::false_type>::value, "" );
+
+ static_assert ( std::disjunction_v<std::true_type, std::true_type, std::true_type >, "" );
+ static_assert ( std::disjunction_v<std::true_type, std::false_type, std::true_type >, "" );
+ static_assert ( std::disjunction_v<std::false_type, std::true_type, std::true_type >, "" );
+ static_assert ( std::disjunction_v<std::false_type, std::false_type, std::true_type >, "" );
+ static_assert ( std::disjunction_v<std::true_type, std::true_type, std::false_type>, "" );
+ static_assert ( std::disjunction_v<std::true_type, std::false_type, std::false_type>, "" );
+ static_assert ( std::disjunction_v<std::false_type, std::true_type, std::false_type>, "" );
+ static_assert (!std::disjunction_v<std::false_type, std::false_type, std::false_type>, "" );
+
+ static_assert ( std::disjunction<True >::value, "" );
+ static_assert (!std::disjunction<False>::value, "" );
+
+ static_assert ( std::disjunction_v<True >, "" );
+ static_assert (!std::disjunction_v<False>, "" );
+}
diff --git a/test/std/utilities/meta/meta.logical/negation.pass.cpp b/test/std/utilities/meta/meta.logical/negation.pass.cpp
new file mode 100644
index 000000000000..76ff6c5b24db
--- /dev/null
+++ b/test/std/utilities/meta/meta.logical/negation.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
+// type_traits
+
+// template<class B> struct negation; // C++17
+// template<class B>
+// constexpr bool negation_v = negation<B>::value; // C++17
+
+#include <type_traits>
+#include <cassert>
+
+struct True { static constexpr bool value = true; };
+struct False { static constexpr bool value = false; };
+
+int main()
+{
+ static_assert (!std::negation<std::true_type >::value, "" );
+ static_assert ( std::negation<std::false_type>::value, "" );
+
+ static_assert (!std::negation_v<std::true_type >, "" );
+ static_assert ( std::negation_v<std::false_type>, "" );
+
+ static_assert (!std::negation<True >::value, "" );
+ static_assert ( std::negation<False>::value, "" );
+
+ static_assert (!std::negation_v<True >, "" );
+ static_assert ( std::negation_v<False>, "" );
+
+ static_assert ( std::negation<std::negation<std::true_type >>::value, "" );
+ static_assert (!std::negation<std::negation<std::false_type>>::value, "" );
+}
diff --git a/test/std/utilities/meta/meta.rel/is_base_of.pass.cpp b/test/std/utilities/meta/meta.rel/is_base_of.pass.cpp
index 0f90ae5c1cab..4b17a9f96505 100644
--- a/test/std/utilities/meta/meta.rel/is_base_of.pass.cpp
+++ b/test/std/utilities/meta/meta.rel/is_base_of.pass.cpp
@@ -13,6 +13,8 @@
#include <type_traits>
+#include "test_macros.h"
+
template <class T, class U>
void test_is_base_of()
{
@@ -20,6 +22,12 @@ void test_is_base_of()
static_assert((std::is_base_of<const T, U>::value), "");
static_assert((std::is_base_of<T, const U>::value), "");
static_assert((std::is_base_of<const T, const U>::value), "");
+#if TEST_STD_VER > 14
+ static_assert((std::is_base_of_v<T, U>), "");
+ static_assert((std::is_base_of_v<const T, U>), "");
+ static_assert((std::is_base_of_v<T, const U>), "");
+ static_assert((std::is_base_of_v<const T, const U>), "");
+#endif
}
template <class T, class U>
diff --git a/test/std/utilities/meta/meta.rel/is_convertible.pass.cpp b/test/std/utilities/meta/meta.rel/is_convertible.pass.cpp
index 429fb33037ff..1681c39972d2 100644
--- a/test/std/utilities/meta/meta.rel/is_convertible.pass.cpp
+++ b/test/std/utilities/meta/meta.rel/is_convertible.pass.cpp
@@ -13,6 +13,8 @@
#include <type_traits>
+#include "test_macros.h"
+
template <class T, class U>
void test_is_convertible()
{
@@ -20,6 +22,12 @@ void test_is_convertible()
static_assert((std::is_convertible<const T, U>::value), "");
static_assert((std::is_convertible<T, const U>::value), "");
static_assert((std::is_convertible<const T, const U>::value), "");
+#if TEST_STD_VER > 14
+ static_assert((std::is_convertible_v<T, U>), "");
+ static_assert((std::is_convertible_v<const T, U>), "");
+ static_assert((std::is_convertible_v<T, const U>), "");
+ static_assert((std::is_convertible_v<const T, const U>), "");
+#endif
}
template <class T, class U>
@@ -29,6 +37,12 @@ void test_is_not_convertible()
static_assert((!std::is_convertible<const T, U>::value), "");
static_assert((!std::is_convertible<T, const U>::value), "");
static_assert((!std::is_convertible<const T, const U>::value), "");
+#if TEST_STD_VER > 14
+ static_assert((!std::is_convertible_v<T, U>), "");
+ static_assert((!std::is_convertible_v<const T, U>), "");
+ static_assert((!std::is_convertible_v<T, const U>), "");
+ static_assert((!std::is_convertible_v<const T, const U>), "");
+#endif
}
typedef void Function();
diff --git a/test/std/utilities/meta/meta.rel/is_convertible_fallback.pass.cpp b/test/std/utilities/meta/meta.rel/is_convertible_fallback.pass.cpp
index bd35ef63d08b..5a607f3b12ad 100644
--- a/test/std/utilities/meta/meta.rel/is_convertible_fallback.pass.cpp
+++ b/test/std/utilities/meta/meta.rel/is_convertible_fallback.pass.cpp
@@ -13,6 +13,14 @@
// Test the fallback implementation.
+// libc++ provides a fallback implementation of the compiler trait
+// `__is_convertible` with the same name when clang doesn't.
+// Because this test forces the use of the fallback even when clang provides
+// it causing a keyword incompatibility.
+#if defined(__clang__)
+#pragma clang diagnostic ignored "-Wkeyword-compat"
+#endif
+
#define _LIBCPP_USE_IS_CONVERTIBLE_FALLBACK
#include "is_convertible.pass.cpp"
diff --git a/test/std/utilities/meta/meta.rel/is_same.pass.cpp b/test/std/utilities/meta/meta.rel/is_same.pass.cpp
index 7250d6ca7730..9db367391f69 100644
--- a/test/std/utilities/meta/meta.rel/is_same.pass.cpp
+++ b/test/std/utilities/meta/meta.rel/is_same.pass.cpp
@@ -13,13 +13,21 @@
#include <type_traits>
+#include "test_macros.h"
+
template <class T, class U>
void test_is_same()
{
- static_assert((std::is_same<T, U>::value), "");
+ static_assert(( std::is_same<T, U>::value), "");
static_assert((!std::is_same<const T, U>::value), "");
static_assert((!std::is_same<T, const U>::value), "");
- static_assert((std::is_same<const T, const U>::value), "");
+ static_assert(( std::is_same<const T, const U>::value), "");
+#if TEST_STD_VER > 14
+ static_assert(( std::is_same_v<T, U>), "");
+ static_assert((!std::is_same_v<const T, U>), "");
+ static_assert((!std::is_same_v<T, const U>), "");
+ static_assert(( std::is_same_v<const T, const U>), "");
+#endif
}
template <class T, class U>
@@ -29,6 +37,12 @@ void test_is_same_ref()
static_assert((std::is_same<const T, U>::value), "");
static_assert((std::is_same<T, const U>::value), "");
static_assert((std::is_same<const T, const U>::value), "");
+#if TEST_STD_VER > 14
+ static_assert((std::is_same_v<T, U>), "");
+ static_assert((std::is_same_v<const T, U>), "");
+ static_assert((std::is_same_v<T, const U>), "");
+ static_assert((std::is_same_v<const T, const U>), "");
+#endif
}
template <class T, class U>
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 c87e99c46e80..a53bed984c5e 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
@@ -12,12 +12,14 @@
// aligned_storage
#include <type_traits>
+#include <cstddef> // for std::max_align_t
+#include "test_macros.h"
int main()
{
{
typedef std::aligned_storage<10, 1 >::type T1;
-#if _LIBCPP_STD_VER > 11
+#if TEST_STD_VER > 11
static_assert(std::is_same<std::aligned_storage_t<10, 1>, T1>::value, "" );
#endif
static_assert(std::alignment_of<T1>::value == 1, "");
@@ -25,7 +27,7 @@ int main()
}
{
typedef std::aligned_storage<10, 2 >::type T1;
-#if _LIBCPP_STD_VER > 11
+#if TEST_STD_VER > 11
static_assert(std::is_same<std::aligned_storage_t<10, 2>, T1>::value, "" );
#endif
static_assert(std::alignment_of<T1>::value == 2, "");
@@ -33,7 +35,7 @@ int main()
}
{
typedef std::aligned_storage<10, 4 >::type T1;
-#if _LIBCPP_STD_VER > 11
+#if TEST_STD_VER > 11
static_assert(std::is_same<std::aligned_storage_t<10, 4>, T1>::value, "" );
#endif
static_assert(std::alignment_of<T1>::value == 4, "");
@@ -41,7 +43,7 @@ int main()
}
{
typedef std::aligned_storage<10, 8 >::type T1;
-#if _LIBCPP_STD_VER > 11
+#if TEST_STD_VER > 11
static_assert(std::is_same<std::aligned_storage_t<10, 8>, T1>::value, "" );
#endif
static_assert(std::alignment_of<T1>::value == 8, "");
@@ -49,7 +51,7 @@ int main()
}
{
typedef std::aligned_storage<10, 16 >::type T1;
-#if _LIBCPP_STD_VER > 11
+#if TEST_STD_VER > 11
static_assert(std::is_same<std::aligned_storage_t<10, 16>, T1>::value, "" );
#endif
static_assert(std::alignment_of<T1>::value == 16, "");
@@ -57,7 +59,7 @@ int main()
}
{
typedef std::aligned_storage<10, 32 >::type T1;
-#if _LIBCPP_STD_VER > 11
+#if TEST_STD_VER > 11
static_assert(std::is_same<std::aligned_storage_t<10, 32>, T1>::value, "" );
#endif
static_assert(std::alignment_of<T1>::value == 32, "");
@@ -65,7 +67,7 @@ int main()
}
{
typedef std::aligned_storage<20, 32 >::type T1;
-#if _LIBCPP_STD_VER > 11
+#if TEST_STD_VER > 11
static_assert(std::is_same<std::aligned_storage_t<20, 32>, T1>::value, "" );
#endif
static_assert(std::alignment_of<T1>::value == 32, "");
@@ -73,7 +75,7 @@ int main()
}
{
typedef std::aligned_storage<40, 32 >::type T1;
-#if _LIBCPP_STD_VER > 11
+#if TEST_STD_VER > 11
static_assert(std::is_same<std::aligned_storage_t<40, 32>, T1>::value, "" );
#endif
static_assert(std::alignment_of<T1>::value == 32, "");
@@ -81,7 +83,7 @@ int main()
}
{
typedef std::aligned_storage<12, 16 >::type T1;
-#if _LIBCPP_STD_VER > 11
+#if TEST_STD_VER > 11
static_assert(std::is_same<std::aligned_storage_t<12, 16>, T1>::value, "" );
#endif
static_assert(std::alignment_of<T1>::value == 16, "");
@@ -89,7 +91,7 @@ int main()
}
{
typedef std::aligned_storage<1>::type T1;
-#if _LIBCPP_STD_VER > 11
+#if TEST_STD_VER > 11
static_assert(std::is_same<std::aligned_storage_t<1>, T1>::value, "" );
#endif
static_assert(std::alignment_of<T1>::value == 1, "");
@@ -97,7 +99,7 @@ int main()
}
{
typedef std::aligned_storage<2>::type T1;
-#if _LIBCPP_STD_VER > 11
+#if TEST_STD_VER > 11
static_assert(std::is_same<std::aligned_storage_t<2>, T1>::value, "" );
#endif
static_assert(std::alignment_of<T1>::value == 2, "");
@@ -105,7 +107,7 @@ int main()
}
{
typedef std::aligned_storage<3>::type T1;
-#if _LIBCPP_STD_VER > 11
+#if TEST_STD_VER > 11
static_assert(std::is_same<std::aligned_storage_t<3>, T1>::value, "" );
#endif
static_assert(std::alignment_of<T1>::value == 2, "");
@@ -113,7 +115,7 @@ int main()
}
{
typedef std::aligned_storage<4>::type T1;
-#if _LIBCPP_STD_VER > 11
+#if TEST_STD_VER > 11
static_assert(std::is_same<std::aligned_storage_t<4>, T1>::value, "" );
#endif
static_assert(std::alignment_of<T1>::value == 4, "");
@@ -121,7 +123,7 @@ int main()
}
{
typedef std::aligned_storage<5>::type T1;
-#if _LIBCPP_STD_VER > 11
+#if TEST_STD_VER > 11
static_assert(std::is_same<std::aligned_storage_t<5>, T1>::value, "" );
#endif
static_assert(std::alignment_of<T1>::value == 4, "");
@@ -129,7 +131,7 @@ int main()
}
{
typedef std::aligned_storage<7>::type T1;
-#if _LIBCPP_STD_VER > 11
+#if TEST_STD_VER > 11
static_assert(std::is_same<std::aligned_storage_t<7>, T1>::value, "" );
#endif
static_assert(std::alignment_of<T1>::value == 4, "");
@@ -137,7 +139,7 @@ int main()
}
{
typedef std::aligned_storage<8>::type T1;
-#if _LIBCPP_STD_VER > 11
+#if TEST_STD_VER > 11
static_assert(std::is_same<std::aligned_storage_t<8>, T1>::value, "" );
#endif
static_assert(std::alignment_of<T1>::value == 8, "");
@@ -145,7 +147,7 @@ int main()
}
{
typedef std::aligned_storage<9>::type T1;
-#if _LIBCPP_STD_VER > 11
+#if TEST_STD_VER > 11
static_assert(std::is_same<std::aligned_storage_t<9>, T1>::value, "" );
#endif
static_assert(std::alignment_of<T1>::value == 8, "");
@@ -153,7 +155,7 @@ int main()
}
{
typedef std::aligned_storage<15>::type T1;
-#if _LIBCPP_STD_VER > 11
+#if TEST_STD_VER > 11
static_assert(std::is_same<std::aligned_storage_t<15>, T1>::value, "" );
#endif
static_assert(std::alignment_of<T1>::value == 8, "");
@@ -167,7 +169,7 @@ int main()
#endif
{
typedef std::aligned_storage<16>::type T1;
-#if _LIBCPP_STD_VER > 11
+#if TEST_STD_VER > 11
static_assert(std::is_same<std::aligned_storage_t<16>, T1>::value, "" );
#endif
static_assert(std::alignment_of<T1>::value == alignof(std::max_align_t),
@@ -176,7 +178,7 @@ int main()
}
{
typedef std::aligned_storage<17>::type T1;
-#if _LIBCPP_STD_VER > 11
+#if TEST_STD_VER > 11
static_assert(std::is_same<std::aligned_storage_t<17>, T1>::value, "" );
#endif
static_assert(std::alignment_of<T1>::value == alignof(std::max_align_t),
@@ -185,7 +187,7 @@ int main()
}
{
typedef std::aligned_storage<10>::type T1;
-#if _LIBCPP_STD_VER > 11
+#if TEST_STD_VER > 11
static_assert(std::is_same<std::aligned_storage_t<10>, T1>::value, "" );
#endif
static_assert(std::alignment_of<T1>::value == 8, "");
diff --git a/test/std/utilities/meta/meta.trans/meta.trans.other/common_type.pass.cpp b/test/std/utilities/meta/meta.trans/meta.trans.other/common_type.pass.cpp
index 91bf7e7654e0..e8611253c5d4 100644
--- a/test/std/utilities/meta/meta.trans/meta.trans.other/common_type.pass.cpp
+++ b/test/std/utilities/meta/meta.trans/meta.trans.other/common_type.pass.cpp
@@ -13,11 +13,39 @@
#include <type_traits>
+#include "test_macros.h"
+
+struct E {};
+
+template <class T>
+struct X { explicit X(T const&){} };
+
+template <class T>
+struct S { explicit S(T const&){} };
+
+namespace std
+{
+ template <typename T>
+ struct common_type<T, ::S<T> >
+ {
+ typedef S<T> type;
+ };
+}
+
+#if TEST_STD_VER >= 11
+template <class T, class U, class = void>
+struct no_common_type : std::true_type {};
+
+template <class T, class U>
+struct no_common_type<T, U, typename std::conditional<false,
+ typename std::common_type<T, U>::type, void>::type> : std::false_type {};
+#endif // TEST_STD_VER >= 11
+
int main()
{
static_assert((std::is_same<std::common_type<int>::type, int>::value), "");
static_assert((std::is_same<std::common_type<char>::type, char>::value), "");
-#if _LIBCPP_STD_VER > 11
+#if TEST_STD_VER > 11
static_assert((std::is_same<std::common_type_t<int>, int>::value), "");
static_assert((std::is_same<std::common_type_t<char>, char>::value), "");
#endif
@@ -29,7 +57,7 @@ int main()
static_assert((std::is_same<std::common_type<int, int>::type, int>::value), "");
static_assert((std::is_same<std::common_type<int, const int>::type, int>::value), "");
-
+
static_assert((std::is_same<std::common_type<long, const int>::type, long>::value), "");
static_assert((std::is_same<std::common_type<const long, int>::type, long>::value), "");
static_assert((std::is_same<std::common_type<long, volatile int>::type, long>::value), "");
@@ -38,15 +66,37 @@ int main()
static_assert((std::is_same<std::common_type<double, char>::type, double>::value), "");
static_assert((std::is_same<std::common_type<short, char>::type, int>::value), "");
-#if _LIBCPP_STD_VER > 11
+#if TEST_STD_VER > 11
static_assert((std::is_same<std::common_type_t<double, char>, double>::value), "");
static_assert((std::is_same<std::common_type_t<short, char>, int>::value), "");
#endif
static_assert((std::is_same<std::common_type<double, char, long long>::type, double>::value), "");
static_assert((std::is_same<std::common_type<unsigned, char, long long>::type, long long>::value), "");
-#if _LIBCPP_STD_VER > 11
+#if TEST_STD_VER > 11
static_assert((std::is_same<std::common_type_t<double, char, long long>, double>::value), "");
static_assert((std::is_same<std::common_type_t<unsigned, char, long long>, long long>::value), "");
#endif
+
+ static_assert((std::is_same<std::common_type< void>::type, void>::value), "");
+ static_assert((std::is_same<std::common_type<const void>::type, void>::value), "");
+ static_assert((std::is_same<std::common_type< volatile void>::type, void>::value), "");
+ static_assert((std::is_same<std::common_type<const volatile void>::type, void>::value), "");
+
+ static_assert((std::is_same<std::common_type<void, const void>::type, void>::value), "");
+ static_assert((std::is_same<std::common_type<const void, void>::type, void>::value), "");
+ static_assert((std::is_same<std::common_type<void, volatile void>::type, void>::value), "");
+ static_assert((std::is_same<std::common_type<volatile void, void>::type, void>::value), "");
+ static_assert((std::is_same<std::common_type<const void, const void>::type, void>::value), "");
+
+#if TEST_STD_VER >= 11
+ static_assert((no_common_type<void, int>::value), "");
+ static_assert((no_common_type<int, void>::value), "");
+ static_assert((no_common_type<int, E>::value), "");
+ static_assert((no_common_type<int, X<int> >::value), "");
+#endif // TEST_STD_VER >= 11
+
+ static_assert((std::is_same<std::common_type<int, S<int> >::type, S<int> >::value), "");
+ static_assert((std::is_same<std::common_type<int, S<int>, S<int> >::type, S<int> >::value), "");
+ static_assert((std::is_same<std::common_type<int, int, S<int> >::type, S<int> >::value), "");
}
diff --git a/test/std/utilities/meta/meta.trans/meta.trans.ref/add_lvalue_ref.pass.cpp b/test/std/utilities/meta/meta.trans/meta.trans.ref/add_lvalue_ref.pass.cpp
index 8150ce04e37f..fb53312cbe67 100644
--- a/test/std/utilities/meta/meta.trans/meta.trans.ref/add_lvalue_ref.pass.cpp
+++ b/test/std/utilities/meta/meta.trans/meta.trans.ref/add_lvalue_ref.pass.cpp
@@ -22,6 +22,26 @@ void test_add_lvalue_reference()
#endif
}
+template <class F>
+void test_function0()
+{
+ static_assert((std::is_same<typename std::add_lvalue_reference<F>::type, F&>::value), "");
+#if _LIBCPP_STD_VER > 11
+ static_assert((std::is_same<std::add_lvalue_reference_t<F>, F&>::value), "");
+#endif
+}
+
+template <class F>
+void test_function1()
+{
+ static_assert((std::is_same<typename std::add_lvalue_reference<F>::type, F>::value), "");
+#if _LIBCPP_STD_VER > 11
+ static_assert((std::is_same<std::add_lvalue_reference_t<F>, F>::value), "");
+#endif
+}
+
+struct Foo {};
+
int main()
{
test_add_lvalue_reference<void, void>();
@@ -31,4 +51,20 @@ int main()
test_add_lvalue_reference<const int&, const int&>();
test_add_lvalue_reference<int*, int*&>();
test_add_lvalue_reference<const int*, const int*&>();
+
+// LWG 2101 specifically talks about add_lvalue_reference and functions.
+// The term of art is "a referenceable type", which a cv- or ref-qualified function is not.
+ test_function0<void()>();
+// test_function1<void() const>();
+// test_function1<void() &>();
+// test_function1<void() &&>();
+// test_function1<void() const &>();
+// test_function1<void() const &&>();
+
+ test_function0<void (Foo::*)()>();
+ test_function0<void (Foo::*)() const>();
+ test_function0<void (Foo::*)() &>();
+ test_function0<void (Foo::*)() &&>();
+ test_function0<void (Foo::*)() const &>();
+ test_function0<void (Foo::*)() const &&>();
}
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 6ea1cac789ef..0f55db64719b 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
@@ -14,6 +14,8 @@
#include <type_traits>
#include <cstdint>
+#include "test_macros.h"
+
template <class T, unsigned A>
void test_alignment_of()
{
@@ -21,6 +23,12 @@ void test_alignment_of()
static_assert( std::alignment_of<const T>::value == A, "");
static_assert( std::alignment_of<volatile T>::value == A, "");
static_assert( std::alignment_of<const volatile T>::value == A, "");
+#if TEST_STD_VER > 14
+ static_assert( std::alignment_of_v<T> == A, "");
+ static_assert( std::alignment_of_v<const T> == A, "");
+ static_assert( std::alignment_of_v<volatile T> == A, "");
+ static_assert( std::alignment_of_v<const volatile T> == A, "");
+#endif
}
class Class
diff --git a/test/std/utilities/meta/meta.unary.prop.query/extent.pass.cpp b/test/std/utilities/meta/meta.unary.prop.query/extent.pass.cpp
index a99dc6948529..39a7c2b593bb 100644
--- a/test/std/utilities/meta/meta.unary.prop.query/extent.pass.cpp
+++ b/test/std/utilities/meta/meta.unary.prop.query/extent.pass.cpp
@@ -13,6 +13,8 @@
#include <type_traits>
+#include "test_macros.h"
+
template <class T, unsigned A>
void test_extent()
{
@@ -20,6 +22,12 @@ void test_extent()
static_assert((std::extent<const T>::value == A), "");
static_assert((std::extent<volatile T>::value == A), "");
static_assert((std::extent<const volatile T>::value == A), "");
+#if TEST_STD_VER > 14
+ static_assert((std::extent_v<T> == A), "");
+ static_assert((std::extent_v<const T> == A), "");
+ static_assert((std::extent_v<volatile T> == A), "");
+ static_assert((std::extent_v<const volatile T> == A), "");
+#endif
}
template <class T, unsigned A>
@@ -29,6 +37,12 @@ void test_extent1()
static_assert((std::extent<const T, 1>::value == A), "");
static_assert((std::extent<volatile T, 1>::value == A), "");
static_assert((std::extent<const volatile T, 1>::value == A), "");
+#if TEST_STD_VER > 14
+ static_assert((std::extent_v<T, 1> == A), "");
+ static_assert((std::extent_v<const T, 1> == A), "");
+ static_assert((std::extent_v<volatile T, 1> == A), "");
+ static_assert((std::extent_v<const volatile T, 1> == A), "");
+#endif
}
class Class
diff --git a/test/std/utilities/meta/meta.unary.prop.query/rank.pass.cpp b/test/std/utilities/meta/meta.unary.prop.query/rank.pass.cpp
index 06f66a92c7c3..755269d1d403 100644
--- a/test/std/utilities/meta/meta.unary.prop.query/rank.pass.cpp
+++ b/test/std/utilities/meta/meta.unary.prop.query/rank.pass.cpp
@@ -13,6 +13,8 @@
#include <type_traits>
+#include "test_macros.h"
+
template <class T, unsigned A>
void test_rank()
{
@@ -20,6 +22,12 @@ void test_rank()
static_assert( std::rank<const T>::value == A, "");
static_assert( std::rank<volatile T>::value == A, "");
static_assert( std::rank<const volatile T>::value == A, "");
+#if TEST_STD_VER > 14
+ static_assert( std::rank_v<T> == A, "");
+ static_assert( std::rank_v<const T> == A, "");
+ static_assert( std::rank_v<volatile T> == A, "");
+ static_assert( std::rank_v<const volatile T> == A, "");
+#endif
}
class Class
diff --git a/test/std/utilities/meta/meta.unary.prop.query/void_t.pass.cpp b/test/std/utilities/meta/meta.unary.prop.query/void_t.pass.cpp
index 5deeeff110d4..ccec65fec399 100644
--- a/test/std/utilities/meta/meta.unary.prop.query/void_t.pass.cpp
+++ b/test/std/utilities/meta/meta.unary.prop.query/void_t.pass.cpp
@@ -11,11 +11,11 @@
// void_t
-#include <type_traits>
+// UNSUPPORTED: c++98, c++03, c++11, c++14
+
+// XFAIL: gcc-5.1 gcc-5.2
-#if _LIBCPP_STD_VER <= 14
-int main () {}
-#else
+#include <type_traits>
template <class T>
void test1()
@@ -66,4 +66,3 @@ int main()
static_assert( std::is_same<void, std::void_t<int, double const &, Class, volatile int[], void>>::value, "");
}
-#endif
diff --git a/test/std/utilities/meta/meta.unary/meta.unary.cat/is_array.pass.cpp b/test/std/utilities/meta/meta.unary/meta.unary.cat/is_array.pass.cpp
new file mode 100644
index 000000000000..72955defa399
--- /dev/null
+++ b/test/std/utilities/meta/meta.unary/meta.unary.cat/is_array.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.
+//
+//===----------------------------------------------------------------------===//
+
+// type_traits
+
+// is_array
+
+#include <type_traits>
+#include <cstddef> // for std::nullptr_t
+#include "test_macros.h"
+
+template <class T>
+void test_is_array()
+{
+ static_assert( std::is_array<T>::value, "");
+ static_assert( std::is_array<const T>::value, "");
+ static_assert( std::is_array<volatile T>::value, "");
+ static_assert( std::is_array<const volatile T>::value, "");
+#if TEST_STD_VER > 14
+ static_assert( std::is_array_v<T>, "");
+ static_assert( std::is_array_v<const T>, "");
+ static_assert( std::is_array_v<volatile T>, "");
+ static_assert( std::is_array_v<const volatile T>, "");
+#endif
+}
+
+template <class T>
+void test_is_not_array()
+{
+ static_assert(!std::is_array<T>::value, "");
+ static_assert(!std::is_array<const T>::value, "");
+ static_assert(!std::is_array<volatile T>::value, "");
+ static_assert(!std::is_array<const volatile T>::value, "");
+#if TEST_STD_VER > 14
+ static_assert(!std::is_array_v<T>, "");
+ static_assert(!std::is_array_v<const T>, "");
+ static_assert(!std::is_array_v<volatile T>, "");
+ static_assert(!std::is_array_v<const volatile T>, "");
+#endif
+}
+
+class Empty
+{
+};
+
+class NotEmpty
+{
+ virtual ~NotEmpty();
+};
+
+union Union {};
+
+struct bit_zero
+{
+ int : 0;
+};
+
+class Abstract
+{
+ virtual ~Abstract() = 0;
+};
+
+enum Enum {zero, one};
+
+typedef void (*FunctionPtr)();
+
+int main()
+{
+ test_is_array<char[3]>();
+ test_is_array<char[]>();
+ test_is_array<Union[]>();
+
+ test_is_not_array<std::nullptr_t>();
+ test_is_not_array<void>();
+ test_is_not_array<int&>();
+ test_is_not_array<int&&>();
+ test_is_not_array<int*>();
+ test_is_not_array<double>();
+ test_is_not_array<const int*>();
+ test_is_not_array<Enum>();
+ test_is_not_array<Union>();
+ test_is_not_array<FunctionPtr>();
+ test_is_not_array<Empty>();
+ test_is_not_array<bit_zero>();
+ test_is_not_array<NotEmpty>();
+ test_is_not_array<Abstract>();
+}
diff --git a/test/std/utilities/meta/meta.unary/meta.unary.cat/is_class.pass.cpp b/test/std/utilities/meta/meta.unary/meta.unary.cat/is_class.pass.cpp
new file mode 100644
index 000000000000..97671e7b62e0
--- /dev/null
+++ b/test/std/utilities/meta/meta.unary/meta.unary.cat/is_class.pass.cpp
@@ -0,0 +1,98 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// type_traits
+
+// is_class
+
+#include <type_traits>
+#include <cstddef> // for std::nullptr_t
+#include "test_macros.h"
+
+template <class T>
+void test_is_class()
+{
+ static_assert( std::is_class<T>::value, "");
+ static_assert( std::is_class<const T>::value, "");
+ static_assert( std::is_class<volatile T>::value, "");
+ static_assert( std::is_class<const volatile T>::value, "");
+#if TEST_STD_VER > 14
+ static_assert( std::is_class_v<T>, "");
+ static_assert( std::is_class_v<const T>, "");
+ static_assert( std::is_class_v<volatile T>, "");
+ static_assert( std::is_class_v<const volatile T>, "");
+#endif
+}
+
+template <class T>
+void test_is_not_class()
+{
+ static_assert(!std::is_class<T>::value, "");
+ static_assert(!std::is_class<const T>::value, "");
+ static_assert(!std::is_class<volatile T>::value, "");
+ static_assert(!std::is_class<const volatile T>::value, "");
+#if TEST_STD_VER > 14
+ static_assert(!std::is_class_v<T>, "");
+ static_assert(!std::is_class_v<const T>, "");
+ static_assert(!std::is_class_v<volatile T>, "");
+ static_assert(!std::is_class_v<const volatile T>, "");
+#endif
+}
+
+class Empty
+{
+};
+
+class NotEmpty
+{
+ virtual ~NotEmpty();
+};
+
+union Union {};
+
+struct bit_zero
+{
+ int : 0;
+};
+
+class Abstract
+{
+ virtual ~Abstract() = 0;
+};
+
+enum Enum {zero, one};
+
+typedef void (*FunctionPtr)();
+
+int main()
+{
+ test_is_class<Empty>();
+ test_is_class<bit_zero>();
+ test_is_class<NotEmpty>();
+ test_is_class<Abstract>();
+
+#if TEST_STD_VER >= 11
+// In C++03 we have an emulation of std::nullptr_t
+ test_is_not_class<std::nullptr_t>();
+#endif
+ test_is_not_class<void>();
+ test_is_not_class<int>();
+ test_is_not_class<int&>();
+#if TEST_STD_VER >= 11
+ test_is_not_class<int&&>();
+#endif
+ test_is_not_class<int*>();
+ test_is_not_class<double>();
+ test_is_not_class<const int*>();
+ test_is_not_class<char[3]>();
+ test_is_not_class<char[]>();
+ test_is_not_class<Enum>();
+ test_is_not_class<Union>();
+ test_is_not_class<FunctionPtr>();
+}
diff --git a/test/std/utilities/meta/meta.unary/meta.unary.cat/is_enum.pass.cpp b/test/std/utilities/meta/meta.unary/meta.unary.cat/is_enum.pass.cpp
new file mode 100644
index 000000000000..481260ea6e52
--- /dev/null
+++ b/test/std/utilities/meta/meta.unary/meta.unary.cat/is_enum.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.
+//
+//===----------------------------------------------------------------------===//
+
+// type_traits
+
+// is_enum
+
+#include <type_traits>
+#include <cstddef> // for std::nullptr_t
+#include "test_macros.h"
+
+template <class T>
+void test_is_enum()
+{
+ static_assert( std::is_enum<T>::value, "");
+ static_assert( std::is_enum<const T>::value, "");
+ static_assert( std::is_enum<volatile T>::value, "");
+ static_assert( std::is_enum<const volatile T>::value, "");
+#if TEST_STD_VER > 14
+ static_assert( std::is_enum_v<T>, "");
+ static_assert( std::is_enum_v<const T>, "");
+ static_assert( std::is_enum_v<volatile T>, "");
+ static_assert( std::is_enum_v<const volatile T>, "");
+#endif
+}
+
+template <class T>
+void test_is_not_enum()
+{
+ static_assert(!std::is_enum<T>::value, "");
+ static_assert(!std::is_enum<const T>::value, "");
+ static_assert(!std::is_enum<volatile T>::value, "");
+ static_assert(!std::is_enum<const volatile T>::value, "");
+#if TEST_STD_VER > 14
+ static_assert(!std::is_enum_v<T>, "");
+ static_assert(!std::is_enum_v<const T>, "");
+ static_assert(!std::is_enum_v<volatile T>, "");
+ static_assert(!std::is_enum_v<const volatile T>, "");
+#endif
+}
+
+class Empty
+{
+};
+
+class NotEmpty
+{
+ virtual ~NotEmpty();
+};
+
+union Union {};
+
+struct bit_zero
+{
+ int : 0;
+};
+
+class Abstract
+{
+ virtual ~Abstract() = 0;
+};
+
+enum Enum {zero, one};
+
+typedef void (*FunctionPtr)();
+
+int main()
+{
+ test_is_enum<Enum>();
+
+ test_is_not_enum<std::nullptr_t>();
+ test_is_not_enum<void>();
+ test_is_not_enum<int>();
+ test_is_not_enum<int&>();
+ test_is_not_enum<int&&>();
+ test_is_not_enum<int*>();
+ test_is_not_enum<double>();
+ test_is_not_enum<const int*>();
+ test_is_not_enum<char[3]>();
+ test_is_not_enum<char[]>();
+ test_is_not_enum<Union>();
+ test_is_not_enum<Empty>();
+ test_is_not_enum<bit_zero>();
+ test_is_not_enum<NotEmpty>();
+ test_is_not_enum<Abstract>();
+ test_is_not_enum<FunctionPtr>();
+}
diff --git a/test/std/utilities/meta/meta.unary/meta.unary.cat/is_floating_point.pass.cpp b/test/std/utilities/meta/meta.unary/meta.unary.cat/is_floating_point.pass.cpp
new file mode 100644
index 000000000000..de9c146bcb4e
--- /dev/null
+++ b/test/std/utilities/meta/meta.unary/meta.unary.cat/is_floating_point.pass.cpp
@@ -0,0 +1,101 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// type_traits
+
+// is_floating_point
+
+#include <type_traits>
+#include <cstddef> // for std::nullptr_t
+#include "test_macros.h"
+
+template <class T>
+void test_is_floating_point()
+{
+ static_assert( std::is_floating_point<T>::value, "");
+ static_assert( std::is_floating_point<const T>::value, "");
+ static_assert( std::is_floating_point<volatile T>::value, "");
+ static_assert( std::is_floating_point<const volatile T>::value, "");
+#if TEST_STD_VER > 14
+ static_assert( std::is_floating_point_v<T>, "");
+ static_assert( std::is_floating_point_v<const T>, "");
+ static_assert( std::is_floating_point_v<volatile T>, "");
+ static_assert( std::is_floating_point_v<const volatile T>, "");
+#endif
+}
+
+template <class T>
+void test_is_not_floating_point()
+{
+ static_assert(!std::is_floating_point<T>::value, "");
+ static_assert(!std::is_floating_point<const T>::value, "");
+ static_assert(!std::is_floating_point<volatile T>::value, "");
+ static_assert(!std::is_floating_point<const volatile T>::value, "");
+#if TEST_STD_VER > 14
+ static_assert(!std::is_floating_point_v<T>, "");
+ static_assert(!std::is_floating_point_v<const T>, "");
+ static_assert(!std::is_floating_point_v<volatile T>, "");
+ static_assert(!std::is_floating_point_v<const volatile T>, "");
+#endif
+}
+
+class Empty
+{
+};
+
+class NotEmpty
+{
+ virtual ~NotEmpty();
+};
+
+union Union {};
+
+struct bit_zero
+{
+ int : 0;
+};
+
+class Abstract
+{
+ virtual ~Abstract() = 0;
+};
+
+enum Enum {zero, one};
+
+typedef void (*FunctionPtr)();
+
+int main()
+{
+ test_is_floating_point<float>();
+ test_is_floating_point<double>();
+ test_is_floating_point<long double>();
+
+ test_is_not_floating_point<short>();
+ test_is_not_floating_point<unsigned short>();
+ test_is_not_floating_point<int>();
+ test_is_not_floating_point<unsigned int>();
+ test_is_not_floating_point<long>();
+ test_is_not_floating_point<unsigned long>();
+
+ test_is_not_floating_point<std::nullptr_t>();
+ test_is_not_floating_point<void>();
+ test_is_not_floating_point<int&>();
+ test_is_not_floating_point<int&&>();
+ test_is_not_floating_point<int*>();
+ test_is_not_floating_point<const int*>();
+ test_is_not_floating_point<char[3]>();
+ test_is_not_floating_point<char[]>();
+ test_is_not_floating_point<Union>();
+ test_is_not_floating_point<Empty>();
+ test_is_not_floating_point<bit_zero>();
+ test_is_not_floating_point<NotEmpty>();
+ test_is_not_floating_point<Abstract>();
+ test_is_not_floating_point<Enum>();
+ test_is_not_floating_point<FunctionPtr>();
+}
diff --git a/test/std/utilities/meta/meta.unary/meta.unary.cat/is_function.pass.cpp b/test/std/utilities/meta/meta.unary/meta.unary.cat/is_function.pass.cpp
new file mode 100644
index 000000000000..9a1d821b0746
--- /dev/null
+++ b/test/std/utilities/meta/meta.unary/meta.unary.cat/is_function.pass.cpp
@@ -0,0 +1,98 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// type_traits
+
+// is_function
+
+#include <type_traits>
+#include <cstddef> // for std::nullptr_t
+#include "test_macros.h"
+
+template <class T>
+void test_is_function()
+{
+ static_assert( std::is_function<T>::value, "");
+ static_assert( std::is_function<const T>::value, "");
+ static_assert( std::is_function<volatile T>::value, "");
+ static_assert( std::is_function<const volatile T>::value, "");
+#if TEST_STD_VER > 14
+ static_assert( std::is_function_v<T>, "");
+ static_assert( std::is_function_v<const T>, "");
+ static_assert( std::is_function_v<volatile T>, "");
+ static_assert( std::is_function_v<const volatile T>, "");
+#endif
+}
+
+template <class T>
+void test_is_not_function()
+{
+ static_assert(!std::is_function<T>::value, "");
+ static_assert(!std::is_function<const T>::value, "");
+ static_assert(!std::is_function<volatile T>::value, "");
+ static_assert(!std::is_function<const volatile T>::value, "");
+#if TEST_STD_VER > 14
+ static_assert(!std::is_function_v<T>, "");
+ static_assert(!std::is_function_v<const T>, "");
+ static_assert(!std::is_function_v<volatile T>, "");
+ static_assert(!std::is_function_v<const volatile T>, "");
+#endif
+}
+
+class Empty
+{
+};
+
+class NotEmpty
+{
+ virtual ~NotEmpty();
+};
+
+union Union {};
+
+struct bit_zero
+{
+ int : 0;
+};
+
+class Abstract
+{
+ virtual ~Abstract() = 0;
+};
+
+enum Enum {zero, one};
+
+typedef void (*FunctionPtr)();
+
+int main()
+{
+ test_is_function<void(void)>();
+ test_is_function<int(int)>();
+ test_is_function<int(int, double)>();
+ test_is_function<int(Abstract *)>();
+ test_is_function<void(...)>();
+
+ test_is_not_function<std::nullptr_t>();
+ test_is_not_function<void>();
+ test_is_not_function<int>();
+ test_is_not_function<int&>();
+ test_is_not_function<int&&>();
+ test_is_not_function<int*>();
+ test_is_not_function<double>();
+ test_is_not_function<char[3]>();
+ test_is_not_function<char[]>();
+ test_is_not_function<Union>();
+ test_is_not_function<Enum>();
+ test_is_not_function<FunctionPtr>(); // function pointer is not a function
+ test_is_not_function<Empty>();
+ test_is_not_function<bit_zero>();
+ test_is_not_function<NotEmpty>();
+ test_is_not_function<Abstract>();
+ test_is_not_function<Abstract*>();
+}
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
new file mode 100644
index 000000000000..86b63c53da54
--- /dev/null
+++ b/test/std/utilities/meta/meta.unary/meta.unary.cat/is_integral.pass.cpp
@@ -0,0 +1,104 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// type_traits
+
+// is_integral
+
+#include <type_traits>
+#include <cstddef> // for std::nullptr_t
+#include "test_macros.h"
+
+template <class T>
+void test_is_integral()
+{
+ static_assert( std::is_integral<T>::value, "");
+ static_assert( std::is_integral<const T>::value, "");
+ static_assert( std::is_integral<volatile T>::value, "");
+ static_assert( std::is_integral<const volatile T>::value, "");
+#if TEST_STD_VER > 14
+ static_assert( std::is_integral_v<T>, "");
+ static_assert( std::is_integral_v<const T>, "");
+ static_assert( std::is_integral_v<volatile T>, "");
+ static_assert( std::is_integral_v<const volatile T>, "");
+#endif
+}
+
+template <class T>
+void test_is_not_integral()
+{
+ static_assert(!std::is_integral<T>::value, "");
+ static_assert(!std::is_integral<const T>::value, "");
+ static_assert(!std::is_integral<volatile T>::value, "");
+ static_assert(!std::is_integral<const volatile T>::value, "");
+#if TEST_STD_VER > 14
+ static_assert(!std::is_integral_v<T>, "");
+ static_assert(!std::is_integral_v<const T>, "");
+ static_assert(!std::is_integral_v<volatile T>, "");
+ static_assert(!std::is_integral_v<const volatile T>, "");
+#endif
+}
+
+class Empty
+{
+};
+
+class NotEmpty
+{
+ virtual ~NotEmpty();
+};
+
+union Union {};
+
+struct bit_zero
+{
+ int : 0;
+};
+
+class Abstract
+{
+ virtual ~Abstract() = 0;
+};
+
+enum Enum {zero, one};
+
+typedef void (*FunctionPtr)();
+
+
+int main()
+{
+ test_is_integral<short>();
+ test_is_integral<unsigned short>();
+ test_is_integral<int>();
+ test_is_integral<unsigned int>();
+ test_is_integral<long>();
+ test_is_integral<unsigned long>();
+ test_is_integral<bool>();
+ test_is_integral<char>();
+ test_is_integral<signed char>();
+ test_is_integral<unsigned char>();
+ test_is_integral<wchar_t>();
+
+ test_is_not_integral<std::nullptr_t>();
+ test_is_not_integral<void>();
+ test_is_not_integral<int&>();
+ test_is_not_integral<int&&>();
+ test_is_not_integral<int*>();
+ test_is_not_integral<double>();
+ test_is_not_integral<const int*>();
+ test_is_not_integral<char[3]>();
+ test_is_not_integral<char[]>();
+ test_is_not_integral<Union>();
+ test_is_not_integral<Enum>();
+ test_is_not_integral<FunctionPtr>();
+ test_is_not_integral<Empty>();
+ test_is_not_integral<bit_zero>();
+ test_is_not_integral<NotEmpty>();
+ test_is_not_integral<Abstract>();
+}
diff --git a/test/std/utilities/meta/meta.unary/meta.unary.cat/is_lvalue_reference.pass.cpp b/test/std/utilities/meta/meta.unary/meta.unary.cat/is_lvalue_reference.pass.cpp
new file mode 100644
index 000000000000..0e59f7153f50
--- /dev/null
+++ b/test/std/utilities/meta/meta.unary/meta.unary.cat/is_lvalue_reference.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.
+//
+//===----------------------------------------------------------------------===//
+
+// type_traits
+
+// is_lvalue_reference
+
+// UNSUPPORTED: c++98, c++03
+
+#include <type_traits>
+#include <cstddef> // for std::nullptr_t
+#include "test_macros.h"
+
+template <class T>
+void test_is_lvalue_reference()
+{
+ static_assert( std::is_lvalue_reference<T>::value, "");
+ static_assert( std::is_lvalue_reference<const T>::value, "");
+ static_assert( std::is_lvalue_reference<volatile T>::value, "");
+ static_assert( std::is_lvalue_reference<const volatile T>::value, "");
+#if TEST_STD_VER > 14
+ static_assert( std::is_lvalue_reference_v<T>, "");
+ static_assert( std::is_lvalue_reference_v<const T>, "");
+ static_assert( std::is_lvalue_reference_v<volatile T>, "");
+ static_assert( std::is_lvalue_reference_v<const volatile T>, "");
+#endif
+}
+
+template <class T>
+void test_is_not_lvalue_reference()
+{
+ static_assert(!std::is_lvalue_reference<T>::value, "");
+ static_assert(!std::is_lvalue_reference<const T>::value, "");
+ static_assert(!std::is_lvalue_reference<volatile T>::value, "");
+ static_assert(!std::is_lvalue_reference<const volatile T>::value, "");
+#if TEST_STD_VER > 14
+ static_assert(!std::is_lvalue_reference_v<T>, "");
+ static_assert(!std::is_lvalue_reference_v<const T>, "");
+ static_assert(!std::is_lvalue_reference_v<volatile T>, "");
+ static_assert(!std::is_lvalue_reference_v<const volatile T>, "");
+#endif
+}
+
+class Empty
+{
+};
+
+class NotEmpty
+{
+ virtual ~NotEmpty();
+};
+
+union Union {};
+
+struct bit_zero
+{
+ int : 0;
+};
+
+class Abstract
+{
+ virtual ~Abstract() = 0;
+};
+
+enum Enum {zero, one};
+
+typedef void (*FunctionPtr)();
+
+int main()
+{
+ test_is_lvalue_reference<int&>();
+
+ test_is_not_lvalue_reference<std::nullptr_t>();
+ test_is_not_lvalue_reference<void>();
+ test_is_not_lvalue_reference<int>();
+ test_is_not_lvalue_reference<int*>();
+ test_is_not_lvalue_reference<int&&>();
+ test_is_not_lvalue_reference<double>();
+ test_is_not_lvalue_reference<const int*>();
+ test_is_not_lvalue_reference<char[3]>();
+ test_is_not_lvalue_reference<char[]>();
+ test_is_not_lvalue_reference<Union>();
+ test_is_not_lvalue_reference<Enum>();
+ test_is_not_lvalue_reference<FunctionPtr>();
+ test_is_not_lvalue_reference<Empty>();
+ test_is_not_lvalue_reference<bit_zero>();
+ test_is_not_lvalue_reference<NotEmpty>();
+ test_is_not_lvalue_reference<Abstract>();
+}
diff --git a/test/std/utilities/meta/meta.unary/meta.unary.cat/is_member_object_pointer.pass.cpp b/test/std/utilities/meta/meta.unary/meta.unary.cat/is_member_object_pointer.pass.cpp
new file mode 100644
index 000000000000..8da411d2eeed
--- /dev/null
+++ b/test/std/utilities/meta/meta.unary/meta.unary.cat/is_member_object_pointer.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.
+//
+//===----------------------------------------------------------------------===//
+
+// type_traits
+
+// is_member_object_pointer
+
+#include <type_traits>
+#include <cstddef> // for std::nullptr_t
+#include "test_macros.h"
+
+template <class T>
+void test_is_member_object_pointer()
+{
+ static_assert( std::is_member_object_pointer<T>::value, "");
+ static_assert( std::is_member_object_pointer<const T>::value, "");
+ static_assert( std::is_member_object_pointer<volatile T>::value, "");
+ static_assert( std::is_member_object_pointer<const volatile T>::value, "");
+#if TEST_STD_VER > 14
+ static_assert( std::is_member_object_pointer_v<T>, "");
+ static_assert( std::is_member_object_pointer_v<const T>, "");
+ static_assert( std::is_member_object_pointer_v<volatile T>, "");
+ static_assert( std::is_member_object_pointer_v<const volatile T>, "");
+#endif
+}
+
+template <class T>
+void test_is_not_member_object_pointer()
+{
+ static_assert(!std::is_member_object_pointer<T>::value, "");
+ static_assert(!std::is_member_object_pointer<const T>::value, "");
+ static_assert(!std::is_member_object_pointer<volatile T>::value, "");
+ static_assert(!std::is_member_object_pointer<const volatile T>::value, "");
+#if TEST_STD_VER > 14
+ static_assert(!std::is_member_object_pointer_v<T>, "");
+ static_assert(!std::is_member_object_pointer_v<const T>, "");
+ static_assert(!std::is_member_object_pointer_v<volatile T>, "");
+ static_assert(!std::is_member_object_pointer_v<const volatile T>, "");
+#endif
+}
+
+class Empty
+{
+};
+
+class NotEmpty
+{
+ virtual ~NotEmpty();
+};
+
+union Union {};
+
+struct bit_zero
+{
+ int : 0;
+};
+
+class Abstract
+{
+ virtual ~Abstract() = 0;
+};
+
+enum Enum {zero, one};
+
+typedef void (*FunctionPtr)();
+
+
+int main()
+{
+ test_is_member_object_pointer<int Abstract::*>();
+ test_is_member_object_pointer<double NotEmpty::*>();
+ test_is_member_object_pointer<FunctionPtr Empty::*>();
+
+ test_is_not_member_object_pointer<std::nullptr_t>();
+ test_is_not_member_object_pointer<void>();
+ test_is_not_member_object_pointer<int>();
+ test_is_not_member_object_pointer<int&>();
+ test_is_not_member_object_pointer<int&&>();
+ test_is_not_member_object_pointer<int*>();
+ test_is_not_member_object_pointer<double>();
+ test_is_not_member_object_pointer<const int*>();
+ test_is_not_member_object_pointer<char[3]>();
+ test_is_not_member_object_pointer<char[]>();
+ test_is_not_member_object_pointer<Union>();
+ test_is_not_member_object_pointer<Enum>();
+ test_is_not_member_object_pointer<FunctionPtr>();
+ test_is_not_member_object_pointer<Empty>();
+ test_is_not_member_object_pointer<bit_zero>();
+ test_is_not_member_object_pointer<NotEmpty>();
+ test_is_not_member_object_pointer<Abstract>();
+}
diff --git a/test/std/utilities/meta/meta.unary/meta.unary.cat/is_member_pointer.pass.cpp b/test/std/utilities/meta/meta.unary/meta.unary.cat/is_member_pointer.pass.cpp
new file mode 100644
index 000000000000..19a74b01d0fd
--- /dev/null
+++ b/test/std/utilities/meta/meta.unary/meta.unary.cat/is_member_pointer.pass.cpp
@@ -0,0 +1,98 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// type_traits
+
+// is_member_pointer
+
+#include <type_traits>
+#include <cstddef> // for std::nullptr_t
+#include "test_macros.h"
+
+template <class T>
+void test_is_member_pointer()
+{
+ static_assert( std::is_member_pointer<T>::value, "");
+ static_assert( std::is_member_pointer<const T>::value, "");
+ static_assert( std::is_member_pointer<volatile T>::value, "");
+ static_assert( std::is_member_pointer<const volatile T>::value, "");
+#if TEST_STD_VER > 14
+ static_assert( std::is_member_pointer_v<T>, "");
+ static_assert( std::is_member_pointer_v<const T>, "");
+ static_assert( std::is_member_pointer_v<volatile T>, "");
+ static_assert( std::is_member_pointer_v<const volatile T>, "");
+#endif
+}
+
+template <class T>
+void test_is_not_member_pointer()
+{
+ static_assert(!std::is_member_pointer<T>::value, "");
+ static_assert(!std::is_member_pointer<const T>::value, "");
+ static_assert(!std::is_member_pointer<volatile T>::value, "");
+ static_assert(!std::is_member_pointer<const volatile T>::value, "");
+#if TEST_STD_VER > 14
+ static_assert(!std::is_member_pointer_v<T>, "");
+ static_assert(!std::is_member_pointer_v<const T>, "");
+ static_assert(!std::is_member_pointer_v<volatile T>, "");
+ static_assert(!std::is_member_pointer_v<const volatile T>, "");
+#endif
+}
+
+class Empty
+{
+};
+
+class NotEmpty
+{
+ virtual ~NotEmpty();
+};
+
+union Union {};
+
+struct bit_zero
+{
+ int : 0;
+};
+
+class Abstract
+{
+ virtual ~Abstract() = 0;
+};
+
+enum Enum {zero, one};
+
+typedef void (*FunctionPtr)();
+
+
+int main()
+{
+ test_is_member_pointer<int Abstract::*>();
+ test_is_member_pointer<double NotEmpty::*>();
+ test_is_member_pointer<FunctionPtr Empty::*>();
+ test_is_member_pointer<void (Empty::*)()>();
+
+ test_is_not_member_pointer<std::nullptr_t>();
+ test_is_not_member_pointer<void>();
+ test_is_not_member_pointer<int>();
+ test_is_not_member_pointer<int&>();
+ test_is_not_member_pointer<int&&>();
+ test_is_not_member_pointer<int*>();
+ test_is_not_member_pointer<double>();
+ test_is_not_member_pointer<const int*>();
+ test_is_not_member_pointer<char[3]>();
+ test_is_not_member_pointer<char[]>();
+ test_is_not_member_pointer<Union>();
+ test_is_not_member_pointer<Enum>();
+ test_is_not_member_pointer<FunctionPtr>();
+ test_is_not_member_pointer<Empty>();
+ test_is_not_member_pointer<bit_zero>();
+ test_is_not_member_pointer<NotEmpty>();
+ test_is_not_member_pointer<Abstract>();
+}
diff --git a/test/std/utilities/meta/meta.unary/meta.unary.cat/is_null_pointer.pass.cpp b/test/std/utilities/meta/meta.unary/meta.unary.cat/is_null_pointer.pass.cpp
new file mode 100644
index 000000000000..80f563e8969e
--- /dev/null
+++ b/test/std/utilities/meta/meta.unary/meta.unary.cat/is_null_pointer.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.
+//
+//===----------------------------------------------------------------------===//
+
+// type_traits
+
+// is_null_pointer
+
+// UNSUPPORTED: c++98, c++03, c++11
+
+#include <type_traits>
+#include <cstddef> // for std::nullptr_t
+#include "test_macros.h"
+
+template <class T>
+void test_is_null_pointer()
+{
+ static_assert( std::is_null_pointer<T>::value, "");
+ static_assert( std::is_null_pointer<const T>::value, "");
+ static_assert( std::is_null_pointer<volatile T>::value, "");
+ static_assert( std::is_null_pointer<const volatile T>::value, "");
+#if TEST_STD_VER > 14
+ static_assert( std::is_null_pointer_v<T>, "");
+ static_assert( std::is_null_pointer_v<const T>, "");
+ static_assert( std::is_null_pointer_v<volatile T>, "");
+ static_assert( std::is_null_pointer_v<const volatile T>, "");
+#endif
+}
+
+template <class T>
+void test_is_not_null_pointer()
+{
+ static_assert(!std::is_null_pointer<T>::value, "");
+ static_assert(!std::is_null_pointer<const T>::value, "");
+ static_assert(!std::is_null_pointer<volatile T>::value, "");
+ static_assert(!std::is_null_pointer<const volatile T>::value, "");
+#if TEST_STD_VER > 14
+ static_assert(!std::is_null_pointer_v<T>, "");
+ static_assert(!std::is_null_pointer_v<const T>, "");
+ static_assert(!std::is_null_pointer_v<volatile T>, "");
+ static_assert(!std::is_null_pointer_v<const volatile T>, "");
+#endif
+}
+
+class Empty
+{
+};
+
+class NotEmpty
+{
+ virtual ~NotEmpty();
+};
+
+union Union {};
+
+struct bit_zero
+{
+ int : 0;
+};
+
+class Abstract
+{
+ virtual ~Abstract() = 0;
+};
+
+enum Enum {zero, one};
+
+typedef void (*FunctionPtr)();
+
+int main()
+{
+ test_is_null_pointer<std::nullptr_t>();
+
+ test_is_not_null_pointer<void>();
+ test_is_not_null_pointer<int>();
+ test_is_not_null_pointer<int&>();
+ test_is_not_null_pointer<int&&>();
+ test_is_not_null_pointer<int*>();
+ test_is_not_null_pointer<double>();
+ test_is_not_null_pointer<const int*>();
+ test_is_not_null_pointer<char[3]>();
+ test_is_not_null_pointer<char[]>();
+ test_is_not_null_pointer<Union>();
+ test_is_not_null_pointer<Enum>();
+ test_is_not_null_pointer<FunctionPtr>();
+ test_is_not_null_pointer<Empty>();
+ test_is_not_null_pointer<bit_zero>();
+ test_is_not_null_pointer<NotEmpty>();
+ test_is_not_null_pointer<Abstract>();
+}
diff --git a/test/std/utilities/meta/meta.unary/meta.unary.cat/is_pointer.pass.cpp b/test/std/utilities/meta/meta.unary/meta.unary.cat/is_pointer.pass.cpp
new file mode 100644
index 000000000000..a901aed1143e
--- /dev/null
+++ b/test/std/utilities/meta/meta.unary/meta.unary.cat/is_pointer.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.
+//
+//===----------------------------------------------------------------------===//
+
+// type_traits
+
+// is_pointer
+
+#include <type_traits>
+#include <cstddef> // for std::nullptr_t
+#include "test_macros.h"
+
+template <class T>
+void test_is_pointer()
+{
+ static_assert( std::is_pointer<T>::value, "");
+ static_assert( std::is_pointer<const T>::value, "");
+ static_assert( std::is_pointer<volatile T>::value, "");
+ static_assert( std::is_pointer<const volatile T>::value, "");
+#if TEST_STD_VER > 14
+ static_assert( std::is_pointer_v<T>, "");
+ static_assert( std::is_pointer_v<const T>, "");
+ static_assert( std::is_pointer_v<volatile T>, "");
+ static_assert( std::is_pointer_v<const volatile T>, "");
+#endif
+}
+
+template <class T>
+void test_is_not_pointer()
+{
+ static_assert(!std::is_pointer<T>::value, "");
+ static_assert(!std::is_pointer<const T>::value, "");
+ static_assert(!std::is_pointer<volatile T>::value, "");
+ static_assert(!std::is_pointer<const volatile T>::value, "");
+#if TEST_STD_VER > 14
+ static_assert(!std::is_pointer_v<T>, "");
+ static_assert(!std::is_pointer_v<const T>, "");
+ static_assert(!std::is_pointer_v<volatile T>, "");
+ static_assert(!std::is_pointer_v<const volatile T>, "");
+#endif
+}
+
+class Empty
+{
+};
+
+class NotEmpty
+{
+ virtual ~NotEmpty();
+};
+
+union Union {};
+
+struct bit_zero
+{
+ int : 0;
+};
+
+class Abstract
+{
+ virtual ~Abstract() = 0;
+};
+
+enum Enum {zero, one};
+
+typedef void (*FunctionPtr)();
+
+int main()
+{
+ test_is_pointer<void*>();
+ test_is_pointer<int*>();
+ test_is_pointer<const int*>();
+ test_is_pointer<Abstract*>();
+ test_is_pointer<FunctionPtr>();
+
+ test_is_not_pointer<std::nullptr_t>();
+ test_is_not_pointer<void>();
+ test_is_not_pointer<int&>();
+ test_is_not_pointer<int&&>();
+ test_is_not_pointer<double>();
+ test_is_not_pointer<char[3]>();
+ test_is_not_pointer<char[]>();
+ test_is_not_pointer<Union>();
+ test_is_not_pointer<Enum>();
+ test_is_not_pointer<Empty>();
+ test_is_not_pointer<bit_zero>();
+ test_is_not_pointer<NotEmpty>();
+ test_is_not_pointer<Abstract>();
+}
diff --git a/test/std/utilities/meta/meta.unary/meta.unary.cat/is_rvalue_reference.pass.cpp b/test/std/utilities/meta/meta.unary/meta.unary.cat/is_rvalue_reference.pass.cpp
new file mode 100644
index 000000000000..b7b52687018a
--- /dev/null
+++ b/test/std/utilities/meta/meta.unary/meta.unary.cat/is_rvalue_reference.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.
+//
+//===----------------------------------------------------------------------===//
+
+// type_traits
+
+// is_rvalue_reference
+
+// UNSUPPORTED: c++98, c++03
+
+#include <type_traits>
+#include <cstddef> // for std::nullptr_t
+#include "test_macros.h"
+
+template <class T>
+void test_is_rvalue_reference()
+{
+ static_assert( std::is_rvalue_reference<T>::value, "");
+ static_assert( std::is_rvalue_reference<const T>::value, "");
+ static_assert( std::is_rvalue_reference<volatile T>::value, "");
+ static_assert( std::is_rvalue_reference<const volatile T>::value, "");
+#if TEST_STD_VER > 14
+ static_assert( std::is_rvalue_reference_v<T>, "");
+ static_assert( std::is_rvalue_reference_v<const T>, "");
+ static_assert( std::is_rvalue_reference_v<volatile T>, "");
+ static_assert( std::is_rvalue_reference_v<const volatile T>, "");
+#endif
+}
+
+template <class T>
+void test_is_not_rvalue_reference()
+{
+ static_assert(!std::is_rvalue_reference<T>::value, "");
+ static_assert(!std::is_rvalue_reference<const T>::value, "");
+ static_assert(!std::is_rvalue_reference<volatile T>::value, "");
+ static_assert(!std::is_rvalue_reference<const volatile T>::value, "");
+#if TEST_STD_VER > 14
+ static_assert(!std::is_rvalue_reference_v<T>, "");
+ static_assert(!std::is_rvalue_reference_v<const T>, "");
+ static_assert(!std::is_rvalue_reference_v<volatile T>, "");
+ static_assert(!std::is_rvalue_reference_v<const volatile T>, "");
+#endif
+}
+
+class Empty
+{
+};
+
+class NotEmpty
+{
+ virtual ~NotEmpty();
+};
+
+union Union {};
+
+struct bit_zero
+{
+ int : 0;
+};
+
+class Abstract
+{
+ virtual ~Abstract() = 0;
+};
+
+enum Enum {zero, one};
+
+typedef void (*FunctionPtr)();
+
+int main()
+{
+ test_is_rvalue_reference<int&&>();
+
+ test_is_not_rvalue_reference<std::nullptr_t>();
+ test_is_not_rvalue_reference<void>();
+ test_is_not_rvalue_reference<int>();
+ test_is_not_rvalue_reference<int*>();
+ test_is_not_rvalue_reference<int&>();
+ test_is_not_rvalue_reference<double>();
+ test_is_not_rvalue_reference<const int*>();
+ test_is_not_rvalue_reference<char[3]>();
+ test_is_not_rvalue_reference<char[]>();
+ test_is_not_rvalue_reference<Union>();
+ test_is_not_rvalue_reference<Enum>();
+ test_is_not_rvalue_reference<FunctionPtr>();
+ test_is_not_rvalue_reference<Empty>();
+ test_is_not_rvalue_reference<bit_zero>();
+ test_is_not_rvalue_reference<NotEmpty>();
+ test_is_not_rvalue_reference<Abstract>();
+}
diff --git a/test/std/utilities/meta/meta.unary/meta.unary.cat/is_union.pass.cpp b/test/std/utilities/meta/meta.unary/meta.unary.cat/is_union.pass.cpp
new file mode 100644
index 000000000000..307fedb32b26
--- /dev/null
+++ b/test/std/utilities/meta/meta.unary/meta.unary.cat/is_union.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.
+//
+//===----------------------------------------------------------------------===//
+
+// type_traits
+
+// is_union
+
+#include <type_traits>
+#include <cstddef> // for std::nullptr_t
+#include "test_macros.h"
+
+template <class T>
+void test_is_union()
+{
+ static_assert( std::is_union<T>::value, "");
+ static_assert( std::is_union<const T>::value, "");
+ static_assert( std::is_union<volatile T>::value, "");
+ static_assert( std::is_union<const volatile T>::value, "");
+#if TEST_STD_VER > 14
+ static_assert( std::is_union_v<T>, "");
+ static_assert( std::is_union_v<const T>, "");
+ static_assert( std::is_union_v<volatile T>, "");
+ static_assert( std::is_union_v<const volatile T>, "");
+#endif
+}
+
+template <class T>
+void test_is_not_union()
+{
+ static_assert(!std::is_union<T>::value, "");
+ static_assert(!std::is_union<const T>::value, "");
+ static_assert(!std::is_union<volatile T>::value, "");
+ static_assert(!std::is_union<const volatile T>::value, "");
+#if TEST_STD_VER > 14
+ static_assert(!std::is_union_v<T>, "");
+ static_assert(!std::is_union_v<const T>, "");
+ static_assert(!std::is_union_v<volatile T>, "");
+ static_assert(!std::is_union_v<const volatile T>, "");
+#endif
+}
+
+class Empty
+{
+};
+
+class NotEmpty
+{
+ virtual ~NotEmpty();
+};
+
+union Union {};
+
+struct bit_zero
+{
+ int : 0;
+};
+
+class Abstract
+{
+ virtual ~Abstract() = 0;
+};
+
+enum Enum {zero, one};
+
+typedef void (*FunctionPtr)();
+
+int main()
+{
+ test_is_union<Union>();
+
+ test_is_not_union<std::nullptr_t>();
+ test_is_not_union<void>();
+ test_is_not_union<int>();
+ test_is_not_union<int&>();
+ test_is_not_union<int&&>();
+ test_is_not_union<int*>();
+ test_is_not_union<double>();
+ test_is_not_union<const int*>();
+ test_is_not_union<char[3]>();
+ test_is_not_union<char[]>();
+ test_is_not_union<Enum>();
+ test_is_not_union<FunctionPtr>();
+ test_is_not_union<Empty>();
+ test_is_not_union<bit_zero>();
+ test_is_not_union<NotEmpty>();
+ test_is_not_union<Abstract>();
+}
diff --git a/test/std/utilities/meta/meta.unary/meta.unary.cat/is_void.pass.cpp b/test/std/utilities/meta/meta.unary/meta.unary.cat/is_void.pass.cpp
new file mode 100644
index 000000000000..1647666adf2e
--- /dev/null
+++ b/test/std/utilities/meta/meta.unary/meta.unary.cat/is_void.pass.cpp
@@ -0,0 +1,92 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// type_traits
+
+// is_void
+
+#include <type_traits>
+#include <cstddef> // for std::nullptr_t
+#include "test_macros.h"
+
+template <class T>
+void test_is_void()
+{
+ static_assert( std::is_void<T>::value, "");
+ static_assert( std::is_void<const T>::value, "");
+ static_assert( std::is_void<volatile T>::value, "");
+ static_assert( std::is_void<const volatile T>::value, "");
+#if TEST_STD_VER > 14
+ static_assert( std::is_void_v<T>, "");
+ static_assert( std::is_void_v<const T>, "");
+ static_assert( std::is_void_v<volatile T>, "");
+ static_assert( std::is_void_v<const volatile T>, "");
+#endif
+}
+
+template <class T>
+void test_is_not_void()
+{
+ static_assert(!std::is_void<T>::value, "");
+ static_assert(!std::is_void<const T>::value, "");
+ static_assert(!std::is_void<volatile T>::value, "");
+ static_assert(!std::is_void<const volatile T>::value, "");
+#if TEST_STD_VER > 14
+ static_assert(!std::is_void_v<T>, "");
+ static_assert(!std::is_void_v<const T>, "");
+ static_assert(!std::is_void_v<volatile T>, "");
+ static_assert(!std::is_void_v<const volatile T>, "");
+#endif
+}
+
+class Empty
+{
+};
+
+class NotEmpty
+{
+ virtual ~NotEmpty();
+};
+
+union Union {};
+
+struct bit_zero
+{
+ int : 0;
+};
+
+class Abstract
+{
+ virtual ~Abstract() = 0;
+};
+
+enum Enum {zero, one};
+
+typedef void (*FunctionPtr)();
+
+int main()
+{
+ test_is_void<void>();
+
+ test_is_not_void<int>();
+ test_is_not_void<int*>();
+ test_is_not_void<int&>();
+ test_is_not_void<int&&>();
+ test_is_not_void<double>();
+ test_is_not_void<const int*>();
+ test_is_not_void<char[3]>();
+ test_is_not_void<char[]>();
+ test_is_not_void<Union>();
+ test_is_not_void<Empty>();
+ test_is_not_void<bit_zero>();
+ test_is_not_void<NotEmpty>();
+ test_is_not_void<Abstract>();
+ test_is_not_void<Enum>();
+ test_is_not_void<FunctionPtr>();
+}
diff --git a/test/std/utilities/meta/meta.unary/meta.unary.cat/nullptr.pass.cpp b/test/std/utilities/meta/meta.unary/meta.unary.cat/nullptr.pass.cpp
index 691e3536167d..1c7a32fc9dc9 100644
--- a/test/std/utilities/meta/meta.unary/meta.unary.cat/nullptr.pass.cpp
+++ b/test/std/utilities/meta/meta.unary/meta.unary.cat/nullptr.pass.cpp
@@ -13,6 +13,7 @@
// is_null_pointer
#include <type_traits>
+#include <cstddef> // for std::nullptr_t
#if _LIBCPP_STD_VER > 11
template <class T>
diff --git a/test/std/utilities/meta/meta.unary/meta.unary.comp/is_arithmetic.pass.cpp b/test/std/utilities/meta/meta.unary/meta.unary.comp/is_arithmetic.pass.cpp
new file mode 100644
index 000000000000..a3f18d52a706
--- /dev/null
+++ b/test/std/utilities/meta/meta.unary/meta.unary.comp/is_arithmetic.pass.cpp
@@ -0,0 +1,104 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// type_traits
+
+// is_arithmetic
+
+#include <type_traits>
+#include <cstddef> // for std::nullptr_t
+#include "test_macros.h"
+
+template <class T>
+void test_is_arithmetic()
+{
+ static_assert( std::is_arithmetic<T>::value, "");
+ static_assert( std::is_arithmetic<const T>::value, "");
+ static_assert( std::is_arithmetic<volatile T>::value, "");
+ static_assert( std::is_arithmetic<const volatile T>::value, "");
+#if TEST_STD_VER > 14
+ static_assert( std::is_arithmetic_v<T>, "");
+ static_assert( std::is_arithmetic_v<const T>, "");
+ static_assert( std::is_arithmetic_v<volatile T>, "");
+ static_assert( std::is_arithmetic_v<const volatile T>, "");
+#endif
+}
+
+template <class T>
+void test_is_not_arithmetic()
+{
+ static_assert(!std::is_arithmetic<T>::value, "");
+ static_assert(!std::is_arithmetic<const T>::value, "");
+ static_assert(!std::is_arithmetic<volatile T>::value, "");
+ static_assert(!std::is_arithmetic<const volatile T>::value, "");
+#if TEST_STD_VER > 14
+ static_assert(!std::is_arithmetic_v<T>, "");
+ static_assert(!std::is_arithmetic_v<const T>, "");
+ static_assert(!std::is_arithmetic_v<volatile T>, "");
+ static_assert(!std::is_arithmetic_v<const volatile T>, "");
+#endif
+}
+
+class Empty
+{
+};
+
+class NotEmpty
+{
+ virtual ~NotEmpty();
+};
+
+union Union {};
+
+struct bit_zero
+{
+ int : 0;
+};
+
+class Abstract
+{
+ virtual ~Abstract() = 0;
+};
+
+enum Enum {zero, one};
+
+typedef void (*FunctionPtr)();
+
+
+int main()
+{
+ test_is_arithmetic<short>();
+ test_is_arithmetic<unsigned short>();
+ test_is_arithmetic<int>();
+ test_is_arithmetic<unsigned int>();
+ test_is_arithmetic<long>();
+ test_is_arithmetic<unsigned long>();
+ test_is_arithmetic<bool>();
+ test_is_arithmetic<char>();
+ test_is_arithmetic<signed char>();
+ test_is_arithmetic<unsigned char>();
+ test_is_arithmetic<wchar_t>();
+ test_is_arithmetic<double>();
+
+ test_is_not_arithmetic<std::nullptr_t>();
+ test_is_not_arithmetic<void>();
+ test_is_not_arithmetic<int&>();
+ test_is_not_arithmetic<int&&>();
+ test_is_not_arithmetic<int*>();
+ test_is_not_arithmetic<const int*>();
+ test_is_not_arithmetic<char[3]>();
+ test_is_not_arithmetic<char[]>();
+ test_is_not_arithmetic<Union>();
+ test_is_not_arithmetic<Enum>();
+ test_is_not_arithmetic<FunctionPtr>();
+ test_is_not_arithmetic<Empty>();
+ test_is_not_arithmetic<bit_zero>();
+ test_is_not_arithmetic<NotEmpty>();
+ test_is_not_arithmetic<Abstract>();
+}
diff --git a/test/std/utilities/meta/meta.unary/meta.unary.comp/is_compound.pass.cpp b/test/std/utilities/meta/meta.unary/meta.unary.comp/is_compound.pass.cpp
new file mode 100644
index 000000000000..6a1798ab5adc
--- /dev/null
+++ b/test/std/utilities/meta/meta.unary/meta.unary.comp/is_compound.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.
+//
+//===----------------------------------------------------------------------===//
+
+// type_traits
+
+// is_compound
+
+#include <type_traits>
+#include <cstddef> // for std::nullptr_t
+#include "test_macros.h"
+
+template <class T>
+void test_is_compound()
+{
+ static_assert( std::is_compound<T>::value, "");
+ static_assert( std::is_compound<const T>::value, "");
+ static_assert( std::is_compound<volatile T>::value, "");
+ static_assert( std::is_compound<const volatile T>::value, "");
+#if TEST_STD_VER > 14
+ static_assert( std::is_compound_v<T>, "");
+ static_assert( std::is_compound_v<const T>, "");
+ static_assert( std::is_compound_v<volatile T>, "");
+ static_assert( std::is_compound_v<const volatile T>, "");
+#endif
+}
+
+template <class T>
+void test_is_not_compound()
+{
+ static_assert(!std::is_compound<T>::value, "");
+ static_assert(!std::is_compound<const T>::value, "");
+ static_assert(!std::is_compound<volatile T>::value, "");
+ static_assert(!std::is_compound<const volatile T>::value, "");
+#if TEST_STD_VER > 14
+ static_assert(!std::is_compound_v<T>, "");
+ static_assert(!std::is_compound_v<const T>, "");
+ static_assert(!std::is_compound_v<volatile T>, "");
+ static_assert(!std::is_compound_v<const volatile T>, "");
+#endif
+}
+
+class Empty
+{
+};
+
+class NotEmpty
+{
+ virtual ~NotEmpty();
+};
+
+union Union {};
+
+struct bit_zero
+{
+ int : 0;
+};
+
+class Abstract
+{
+ virtual ~Abstract() = 0;
+};
+
+enum Enum {zero, one};
+
+typedef void (*FunctionPtr)();
+
+
+int main()
+{
+ test_is_compound<char[3]>();
+ test_is_compound<char[]>();
+ test_is_compound<void *>();
+ test_is_compound<FunctionPtr>();
+ test_is_compound<int&>();
+ test_is_compound<int&&>();
+ test_is_compound<Union>();
+ test_is_compound<Empty>();
+ test_is_compound<bit_zero>();
+ test_is_compound<int*>();
+ test_is_compound<const int*>();
+ test_is_compound<Enum>();
+ test_is_compound<NotEmpty>();
+ test_is_compound<Abstract>();
+
+ test_is_not_compound<std::nullptr_t>();
+ test_is_not_compound<void>();
+ test_is_not_compound<int>();
+ test_is_not_compound<double>();
+}
diff --git a/test/std/utilities/meta/meta.unary/meta.unary.comp/is_fundamental.pass.cpp b/test/std/utilities/meta/meta.unary/meta.unary.comp/is_fundamental.pass.cpp
new file mode 100644
index 000000000000..e16337e05f1c
--- /dev/null
+++ b/test/std/utilities/meta/meta.unary/meta.unary.comp/is_fundamental.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.
+//
+//===----------------------------------------------------------------------===//
+
+// type_traits
+
+// is_fundamental
+
+#include <type_traits>
+#include <cstddef> // for std::nullptr_t
+#include "test_macros.h"
+
+template <class T>
+void test_is_fundamental()
+{
+ static_assert( std::is_fundamental<T>::value, "");
+ static_assert( std::is_fundamental<const T>::value, "");
+ static_assert( std::is_fundamental<volatile T>::value, "");
+ static_assert( std::is_fundamental<const volatile T>::value, "");
+#if TEST_STD_VER > 14
+ static_assert( std::is_fundamental_v<T>, "");
+ static_assert( std::is_fundamental_v<const T>, "");
+ static_assert( std::is_fundamental_v<volatile T>, "");
+ static_assert( std::is_fundamental_v<const volatile T>, "");
+#endif
+}
+
+template <class T>
+void test_is_not_fundamental()
+{
+ static_assert(!std::is_fundamental<T>::value, "");
+ static_assert(!std::is_fundamental<const T>::value, "");
+ static_assert(!std::is_fundamental<volatile T>::value, "");
+ static_assert(!std::is_fundamental<const volatile T>::value, "");
+#if TEST_STD_VER > 14
+ static_assert(!std::is_fundamental_v<T>, "");
+ static_assert(!std::is_fundamental_v<const T>, "");
+ static_assert(!std::is_fundamental_v<volatile T>, "");
+ static_assert(!std::is_fundamental_v<const volatile T>, "");
+#endif
+}
+
+class Empty
+{
+};
+
+class NotEmpty
+{
+ virtual ~NotEmpty();
+};
+
+union Union {};
+
+struct bit_zero
+{
+ int : 0;
+};
+
+class Abstract
+{
+ virtual ~Abstract() = 0;
+};
+
+enum Enum {zero, one};
+
+typedef void (*FunctionPtr)();
+
+
+int main()
+{
+ test_is_fundamental<std::nullptr_t>();
+ test_is_fundamental<void>();
+ test_is_fundamental<short>();
+ test_is_fundamental<unsigned short>();
+ test_is_fundamental<int>();
+ test_is_fundamental<unsigned int>();
+ test_is_fundamental<long>();
+ test_is_fundamental<unsigned long>();
+ test_is_fundamental<long long>();
+ test_is_fundamental<unsigned long long>();
+ test_is_fundamental<bool>();
+ test_is_fundamental<char>();
+ test_is_fundamental<signed char>();
+ test_is_fundamental<unsigned char>();
+ test_is_fundamental<wchar_t>();
+ test_is_fundamental<double>();
+ test_is_fundamental<float>();
+ test_is_fundamental<double>();
+ test_is_fundamental<long double>();
+ test_is_fundamental<char16_t>();
+ test_is_fundamental<char32_t>();
+
+ test_is_not_fundamental<char[3]>();
+ test_is_not_fundamental<char[]>();
+ test_is_not_fundamental<void *>();
+ test_is_not_fundamental<FunctionPtr>();
+ test_is_not_fundamental<int&>();
+ test_is_not_fundamental<int&&>();
+ test_is_not_fundamental<Union>();
+ test_is_not_fundamental<Empty>();
+ test_is_not_fundamental<bit_zero>();
+ test_is_not_fundamental<int*>();
+ test_is_not_fundamental<const int*>();
+ test_is_not_fundamental<Enum>();
+ test_is_not_fundamental<NotEmpty>();
+ test_is_not_fundamental<Abstract>();
+}
diff --git a/test/std/utilities/meta/meta.unary/meta.unary.comp/is_member_pointer.pass.cpp b/test/std/utilities/meta/meta.unary/meta.unary.comp/is_member_pointer.pass.cpp
new file mode 100644
index 000000000000..890da659e218
--- /dev/null
+++ b/test/std/utilities/meta/meta.unary/meta.unary.comp/is_member_pointer.pass.cpp
@@ -0,0 +1,102 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// type_traits
+
+// is_member_pointer
+
+#include <type_traits>
+#include <cstddef> // for std::nullptr_t
+#include "test_macros.h"
+
+template <class T>
+void test_is_member_pointer()
+{
+ static_assert( std::is_member_pointer<T>::value, "");
+ static_assert( std::is_member_pointer<const T>::value, "");
+ static_assert( std::is_member_pointer<volatile T>::value, "");
+ static_assert( std::is_member_pointer<const volatile T>::value, "");
+#if TEST_STD_VER > 14
+ static_assert( std::is_member_pointer_v<T>, "");
+ static_assert( std::is_member_pointer_v<const T>, "");
+ static_assert( std::is_member_pointer_v<volatile T>, "");
+ static_assert( std::is_member_pointer_v<const volatile T>, "");
+#endif
+}
+
+template <class T>
+void test_is_not_member_pointer()
+{
+ static_assert(!std::is_member_pointer<T>::value, "");
+ static_assert(!std::is_member_pointer<const T>::value, "");
+ static_assert(!std::is_member_pointer<volatile T>::value, "");
+ static_assert(!std::is_member_pointer<const volatile T>::value, "");
+#if TEST_STD_VER > 14
+ static_assert(!std::is_member_pointer_v<T>, "");
+ static_assert(!std::is_member_pointer_v<const T>, "");
+ static_assert(!std::is_member_pointer_v<volatile T>, "");
+ static_assert(!std::is_member_pointer_v<const volatile T>, "");
+#endif
+}
+
+class Empty
+{
+};
+
+class NotEmpty
+{
+ virtual ~NotEmpty();
+};
+
+union Union {};
+
+struct bit_zero
+{
+ int : 0;
+};
+
+class Abstract
+{
+ virtual ~Abstract() = 0;
+};
+
+enum Enum {zero, one};
+
+typedef void (*FunctionPtr)();
+
+
+int main()
+{
+// Arithmetic types (3.9.1), enumeration types, pointer types, pointer to member types (3.9.2),
+// std::nullptr_t, and cv-qualified versions of these types (3.9.3)
+// are collectively called scalar types.
+
+ test_is_member_pointer<int Empty::*>();
+ test_is_member_pointer<void (Empty::*)(int)>();
+
+ test_is_not_member_pointer<std::nullptr_t>();
+ test_is_not_member_pointer<void>();
+ test_is_not_member_pointer<void *>();
+ test_is_not_member_pointer<int>();
+ test_is_not_member_pointer<int*>();
+ test_is_not_member_pointer<const int*>();
+ test_is_not_member_pointer<int&>();
+ test_is_not_member_pointer<int&&>();
+ test_is_not_member_pointer<double>();
+ test_is_not_member_pointer<char[3]>();
+ test_is_not_member_pointer<char[]>();
+ test_is_not_member_pointer<Union>();
+ test_is_not_member_pointer<Empty>();
+ test_is_not_member_pointer<bit_zero>();
+ test_is_not_member_pointer<NotEmpty>();
+ test_is_not_member_pointer<Abstract>();
+ test_is_not_member_pointer<int(int)>();
+ test_is_not_member_pointer<Enum>();
+ test_is_not_member_pointer<FunctionPtr>();
+}
diff --git a/test/std/utilities/meta/meta.unary/meta.unary.comp/is_object.pass.cpp b/test/std/utilities/meta/meta.unary/meta.unary.comp/is_object.pass.cpp
new file mode 100644
index 000000000000..ff7dda30d111
--- /dev/null
+++ b/test/std/utilities/meta/meta.unary/meta.unary.comp/is_object.pass.cpp
@@ -0,0 +1,101 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// type_traits
+
+// is_object
+
+#include <type_traits>
+#include <cstddef> // for std::nullptr_t
+#include "test_macros.h"
+
+template <class T>
+void test_is_object()
+{
+ static_assert( std::is_object<T>::value, "");
+ static_assert( std::is_object<const T>::value, "");
+ static_assert( std::is_object<volatile T>::value, "");
+ static_assert( std::is_object<const volatile T>::value, "");
+#if TEST_STD_VER > 14
+ static_assert( std::is_object_v<T>, "");
+ static_assert( std::is_object_v<const T>, "");
+ static_assert( std::is_object_v<volatile T>, "");
+ static_assert( std::is_object_v<const volatile T>, "");
+#endif
+}
+
+template <class T>
+void test_is_not_object()
+{
+ static_assert(!std::is_object<T>::value, "");
+ static_assert(!std::is_object<const T>::value, "");
+ static_assert(!std::is_object<volatile T>::value, "");
+ static_assert(!std::is_object<const volatile T>::value, "");
+#if TEST_STD_VER > 14
+ static_assert(!std::is_object_v<T>, "");
+ static_assert(!std::is_object_v<const T>, "");
+ static_assert(!std::is_object_v<volatile T>, "");
+ static_assert(!std::is_object_v<const volatile T>, "");
+#endif
+}
+
+class Empty
+{
+};
+
+class NotEmpty
+{
+ virtual ~NotEmpty();
+};
+
+union Union {};
+
+struct bit_zero
+{
+ int : 0;
+};
+
+class Abstract
+{
+ virtual ~Abstract() = 0;
+};
+
+enum Enum {zero, one};
+
+typedef void (*FunctionPtr)();
+
+
+int main()
+{
+// An object type is a (possibly cv-qualified) type that is not a function type,
+// not a reference type, and not a void type.
+
+ test_is_object<std::nullptr_t>();
+ test_is_object<void *>();
+ test_is_object<char[3]>();
+ test_is_object<char[]>();
+ test_is_object<int>();
+ test_is_object<int*>();
+ test_is_object<Union>();
+ test_is_object<int*>();
+ test_is_object<const int*>();
+ test_is_object<Enum>();
+ test_is_object<Empty>();
+ test_is_object<bit_zero>();
+ test_is_object<NotEmpty>();
+ test_is_object<Abstract>();
+ test_is_object<FunctionPtr>();
+ test_is_object<int Empty::*>();
+ test_is_object<void (Empty::*)(int)>();
+
+ test_is_not_object<void>();
+ test_is_not_object<int&>();
+ test_is_not_object<int&&>();
+ test_is_not_object<int(int)>();
+}
diff --git a/test/std/utilities/meta/meta.unary/meta.unary.comp/is_reference.pass.cpp b/test/std/utilities/meta/meta.unary/meta.unary.comp/is_reference.pass.cpp
new file mode 100644
index 000000000000..e56c8f761814
--- /dev/null
+++ b/test/std/utilities/meta/meta.unary/meta.unary.comp/is_reference.pass.cpp
@@ -0,0 +1,101 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// type_traits
+
+// is_reference
+
+#include <type_traits>
+#include <cstddef> // for std::nullptr_t
+#include "test_macros.h"
+
+template <class T>
+void test_is_reference()
+{
+ static_assert( std::is_reference<T>::value, "");
+ static_assert( std::is_reference<const T>::value, "");
+ static_assert( std::is_reference<volatile T>::value, "");
+ static_assert( std::is_reference<const volatile T>::value, "");
+#if TEST_STD_VER > 14
+ static_assert( std::is_reference_v<T>, "");
+ static_assert( std::is_reference_v<const T>, "");
+ static_assert( std::is_reference_v<volatile T>, "");
+ static_assert( std::is_reference_v<const volatile T>, "");
+#endif
+}
+
+template <class T>
+void test_is_not_reference()
+{
+ static_assert(!std::is_reference<T>::value, "");
+ static_assert(!std::is_reference<const T>::value, "");
+ static_assert(!std::is_reference<volatile T>::value, "");
+ static_assert(!std::is_reference<const volatile T>::value, "");
+#if TEST_STD_VER > 14
+ static_assert(!std::is_reference_v<T>, "");
+ static_assert(!std::is_reference_v<const T>, "");
+ static_assert(!std::is_reference_v<volatile T>, "");
+ static_assert(!std::is_reference_v<const volatile T>, "");
+#endif
+}
+
+class Empty
+{
+};
+
+class NotEmpty
+{
+ virtual ~NotEmpty();
+};
+
+union Union {};
+
+struct bit_zero
+{
+ int : 0;
+};
+
+class Abstract
+{
+ virtual ~Abstract() = 0;
+};
+
+enum Enum {zero, one};
+
+typedef void (*FunctionPtr)();
+
+
+int main()
+{
+ test_is_reference<int&>();
+#if TEST_STD_VER >= 11
+ test_is_reference<int&&>();
+#endif
+
+ test_is_not_reference<std::nullptr_t>();
+ test_is_not_reference<void>();
+ test_is_not_reference<int>();
+ test_is_not_reference<double>();
+ test_is_not_reference<char[3]>();
+ test_is_not_reference<char[]>();
+ test_is_not_reference<void *>();
+ test_is_not_reference<FunctionPtr>();
+ test_is_not_reference<Union>();
+ test_is_not_reference<Empty>();
+ test_is_not_reference<bit_zero>();
+ test_is_not_reference<int*>();
+ test_is_not_reference<const int*>();
+ test_is_not_reference<Enum>();
+ test_is_not_reference<NotEmpty>();
+ test_is_not_reference<Abstract>();
+ test_is_not_reference<int(int)>();
+ test_is_not_reference<int Empty::*>();
+ test_is_not_reference<void (Empty::*)(int)>();
+
+}
diff --git a/test/std/utilities/meta/meta.unary/meta.unary.comp/is_scalar.pass.cpp b/test/std/utilities/meta/meta.unary/meta.unary.comp/is_scalar.pass.cpp
new file mode 100644
index 000000000000..2b412a68833b
--- /dev/null
+++ b/test/std/utilities/meta/meta.unary/meta.unary.comp/is_scalar.pass.cpp
@@ -0,0 +1,111 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// type_traits
+
+// is_scalar
+
+#include <type_traits>
+#include <cstddef> // for std::nullptr_t
+#include "test_macros.h"
+
+template <class T>
+void test_is_scalar()
+{
+ static_assert( std::is_scalar<T>::value, "");
+ static_assert( std::is_scalar<const T>::value, "");
+ static_assert( std::is_scalar<volatile T>::value, "");
+ static_assert( std::is_scalar<const volatile T>::value, "");
+#if TEST_STD_VER > 14
+ static_assert( std::is_scalar_v<T>, "");
+ static_assert( std::is_scalar_v<const T>, "");
+ static_assert( std::is_scalar_v<volatile T>, "");
+ static_assert( std::is_scalar_v<const volatile T>, "");
+#endif
+}
+
+template <class T>
+void test_is_not_scalar()
+{
+ static_assert(!std::is_scalar<T>::value, "");
+ static_assert(!std::is_scalar<const T>::value, "");
+ static_assert(!std::is_scalar<volatile T>::value, "");
+ static_assert(!std::is_scalar<const volatile T>::value, "");
+#if TEST_STD_VER > 14
+ static_assert(!std::is_scalar_v<T>, "");
+ static_assert(!std::is_scalar_v<const T>, "");
+ static_assert(!std::is_scalar_v<volatile T>, "");
+ static_assert(!std::is_scalar_v<const volatile T>, "");
+#endif
+}
+
+class Empty
+{
+};
+
+class NotEmpty
+{
+ virtual ~NotEmpty();
+};
+
+union Union {};
+
+struct bit_zero
+{
+ int : 0;
+};
+
+class Abstract
+{
+ virtual ~Abstract() = 0;
+};
+
+enum Enum {zero, one};
+
+typedef void (*FunctionPtr)();
+
+
+int main()
+{
+// Arithmetic types (3.9.1), enumeration types, pointer types, pointer to member types (3.9.2),
+// std::nullptr_t, and cv-qualified versions of these types (3.9.3)
+// are collectively called scalar types.
+
+ test_is_scalar<std::nullptr_t>();
+ test_is_scalar<short>();
+ test_is_scalar<unsigned short>();
+ test_is_scalar<int>();
+ test_is_scalar<unsigned int>();
+ test_is_scalar<long>();
+ test_is_scalar<unsigned long>();
+ test_is_scalar<bool>();
+ test_is_scalar<char>();
+ test_is_scalar<signed char>();
+ test_is_scalar<unsigned char>();
+ test_is_scalar<wchar_t>();
+ test_is_scalar<double>();
+ test_is_scalar<int*>();
+ test_is_scalar<const int*>();
+ test_is_scalar<int Empty::*>();
+ test_is_scalar<void (Empty::*)(int)>();
+ test_is_scalar<Enum>();
+ test_is_scalar<FunctionPtr>();
+
+ test_is_not_scalar<void>();
+ test_is_not_scalar<int&>();
+ test_is_not_scalar<int&&>();
+ test_is_not_scalar<char[3]>();
+ test_is_not_scalar<char[]>();
+ test_is_not_scalar<Union>();
+ test_is_not_scalar<Empty>();
+ test_is_not_scalar<bit_zero>();
+ test_is_not_scalar<NotEmpty>();
+ test_is_not_scalar<Abstract>();
+ test_is_not_scalar<int(int)>();
+}
diff --git a/test/std/utilities/meta/meta.unary/meta.unary.prop/has_virtual_destructor.pass.cpp b/test/std/utilities/meta/meta.unary/meta.unary.prop/has_virtual_destructor.pass.cpp
index 685d30de692f..36020139ec58 100644
--- a/test/std/utilities/meta/meta.unary/meta.unary.prop/has_virtual_destructor.pass.cpp
+++ b/test/std/utilities/meta/meta.unary/meta.unary.prop/has_virtual_destructor.pass.cpp
@@ -20,6 +20,12 @@ void test_has_virtual_destructor()
static_assert( std::has_virtual_destructor<const T>::value, "");
static_assert( std::has_virtual_destructor<volatile T>::value, "");
static_assert( std::has_virtual_destructor<const volatile T>::value, "");
+#if TEST_STD_VER > 14
+ static_assert( std::has_virtual_destructor_v<T>, "");
+ static_assert( std::has_virtual_destructor_v<const T>, "");
+ static_assert( std::has_virtual_destructor_v<volatile T>, "");
+ static_assert( std::has_virtual_destructor_v<const volatile T>, "");
+#endif
}
template <class T>
@@ -29,6 +35,12 @@ void test_has_not_virtual_destructor()
static_assert(!std::has_virtual_destructor<const T>::value, "");
static_assert(!std::has_virtual_destructor<volatile T>::value, "");
static_assert(!std::has_virtual_destructor<const volatile T>::value, "");
+#if TEST_STD_VER > 14
+ static_assert(!std::has_virtual_destructor_v<T>, "");
+ static_assert(!std::has_virtual_destructor_v<const T>, "");
+ static_assert(!std::has_virtual_destructor_v<volatile T>, "");
+ static_assert(!std::has_virtual_destructor_v<const volatile T>, "");
+#endif
}
class Empty
diff --git a/test/std/utilities/meta/meta.unary/meta.unary.prop/is_abstract.pass.cpp b/test/std/utilities/meta/meta.unary/meta.unary.prop/is_abstract.pass.cpp
index f2a8c23246b1..a54adf10258f 100644
--- a/test/std/utilities/meta/meta.unary/meta.unary.prop/is_abstract.pass.cpp
+++ b/test/std/utilities/meta/meta.unary/meta.unary.prop/is_abstract.pass.cpp
@@ -12,6 +12,7 @@
// is_abstract
#include <type_traits>
+#include "test_macros.h"
template <class T>
void test_is_abstract()
@@ -20,6 +21,12 @@ void test_is_abstract()
static_assert( std::is_abstract<const T>::value, "");
static_assert( std::is_abstract<volatile T>::value, "");
static_assert( std::is_abstract<const volatile T>::value, "");
+#if TEST_STD_VER > 14
+ static_assert( std::is_abstract_v<T>, "");
+ static_assert( std::is_abstract_v<const T>, "");
+ static_assert( std::is_abstract_v<volatile T>, "");
+ static_assert( std::is_abstract_v<const volatile T>, "");
+#endif
}
template <class T>
@@ -29,6 +36,12 @@ void test_is_not_abstract()
static_assert(!std::is_abstract<const T>::value, "");
static_assert(!std::is_abstract<volatile T>::value, "");
static_assert(!std::is_abstract<const volatile T>::value, "");
+#if TEST_STD_VER > 14
+ static_assert(!std::is_abstract_v<T>, "");
+ static_assert(!std::is_abstract_v<const T>, "");
+ static_assert(!std::is_abstract_v<volatile T>, "");
+ static_assert(!std::is_abstract_v<const volatile T>, "");
+#endif
}
class Empty
diff --git a/test/std/utilities/meta/meta.unary/meta.unary.prop/is_assignable.pass.cpp b/test/std/utilities/meta/meta.unary/meta.unary.prop/is_assignable.pass.cpp
index d33019bcba9e..c0f6bb9bdfaf 100644
--- a/test/std/utilities/meta/meta.unary/meta.unary.prop/is_assignable.pass.cpp
+++ b/test/std/utilities/meta/meta.unary/meta.unary.prop/is_assignable.pass.cpp
@@ -12,6 +12,7 @@
// is_assignable
#include <type_traits>
+#include "test_macros.h"
struct A
{
@@ -26,12 +27,18 @@ template <class T, class U>
void test_is_assignable()
{
static_assert(( std::is_assignable<T, U>::value), "");
+#if TEST_STD_VER > 14
+ static_assert( std::is_assignable_v<T, U>, "");
+#endif
}
template <class T, class U>
void test_is_not_assignable()
{
static_assert((!std::is_assignable<T, U>::value), "");
+#if TEST_STD_VER > 14
+ static_assert( !std::is_assignable_v<T, U>, "");
+#endif
}
struct D;
diff --git a/test/std/utilities/meta/meta.unary/meta.unary.prop/is_const.pass.cpp b/test/std/utilities/meta/meta.unary/meta.unary.prop/is_const.pass.cpp
index 72f2ff458921..7f63ae40aca7 100644
--- a/test/std/utilities/meta/meta.unary/meta.unary.prop/is_const.pass.cpp
+++ b/test/std/utilities/meta/meta.unary/meta.unary.prop/is_const.pass.cpp
@@ -12,6 +12,7 @@
// is_const
#include <type_traits>
+#include "test_macros.h"
template <class T>
void test_is_const()
@@ -20,6 +21,12 @@ void test_is_const()
static_assert( std::is_const<const T>::value, "");
static_assert(!std::is_const<volatile T>::value, "");
static_assert( std::is_const<const volatile T>::value, "");
+#if TEST_STD_VER > 14
+ static_assert(!std::is_const_v<T>, "");
+ static_assert( std::is_const_v<const T>, "");
+ static_assert(!std::is_const_v<volatile T>, "");
+ static_assert( std::is_const_v<const volatile T>, "");
+#endif
}
int main()
diff --git a/test/std/utilities/meta/meta.unary/meta.unary.prop/is_constructible.pass.cpp b/test/std/utilities/meta/meta.unary/meta.unary.prop/is_constructible.pass.cpp
index 2b8f7efec602..5401d95532b1 100644
--- a/test/std/utilities/meta/meta.unary/meta.unary.prop/is_constructible.pass.cpp
+++ b/test/std/utilities/meta/meta.unary/meta.unary.prop/is_constructible.pass.cpp
@@ -13,6 +13,7 @@
// struct is_constructible;
#include <type_traits>
+#include "test_macros.h"
struct A
{
@@ -38,30 +39,45 @@ template <class T>
void test_is_constructible()
{
static_assert( (std::is_constructible<T>::value), "");
+#if TEST_STD_VER > 14
+ static_assert( std::is_constructible_v<T>, "");
+#endif
}
template <class T, class A0>
void test_is_constructible()
{
- static_assert( (std::is_constructible<T, A0>::value), "");
+ static_assert(( std::is_constructible<T, A0>::value), "");
+#if TEST_STD_VER > 14
+ static_assert(( std::is_constructible_v<T, A0>), "");
+#endif
}
template <class T, class A0, class A1>
void test_is_constructible()
{
- static_assert( (std::is_constructible<T, A0, A1>::value), "");
+ static_assert(( std::is_constructible<T, A0, A1>::value), "");
+#if TEST_STD_VER > 14
+ static_assert(( std::is_constructible_v<T, A0, A1>), "");
+#endif
}
template <class T>
void test_is_not_constructible()
{
static_assert((!std::is_constructible<T>::value), "");
+#if TEST_STD_VER > 14
+ static_assert((!std::is_constructible_v<T>), "");
+#endif
}
template <class T, class A0>
void test_is_not_constructible()
{
static_assert((!std::is_constructible<T, A0>::value), "");
+#if TEST_STD_VER > 14
+ static_assert((!std::is_constructible_v<T, A0>), "");
+#endif
}
int main()
diff --git a/test/std/utilities/meta/meta.unary/meta.unary.prop/is_copy_assignable.pass.cpp b/test/std/utilities/meta/meta.unary/meta.unary.prop/is_copy_assignable.pass.cpp
index c43d59479fb2..421f865a623c 100644
--- a/test/std/utilities/meta/meta.unary/meta.unary.prop/is_copy_assignable.pass.cpp
+++ b/test/std/utilities/meta/meta.unary/meta.unary.prop/is_copy_assignable.pass.cpp
@@ -12,17 +12,24 @@
// is_copy_assignable
#include <type_traits>
+#include "test_macros.h"
template <class T>
void test_is_copy_assignable()
{
static_assert(( std::is_copy_assignable<T>::value), "");
+#if TEST_STD_VER > 14
+ static_assert(( std::is_copy_assignable_v<T>), "");
+#endif
}
template <class T>
void test_is_not_copy_assignable()
{
static_assert((!std::is_copy_assignable<T>::value), "");
+#if TEST_STD_VER > 14
+ static_assert((!std::is_copy_assignable_v<T>), "");
+#endif
}
class Empty
diff --git a/test/std/utilities/meta/meta.unary/meta.unary.prop/is_copy_constructible.pass.cpp b/test/std/utilities/meta/meta.unary/meta.unary.prop/is_copy_constructible.pass.cpp
index f878a50c3af5..fe2e01429b22 100644
--- a/test/std/utilities/meta/meta.unary/meta.unary.prop/is_copy_constructible.pass.cpp
+++ b/test/std/utilities/meta/meta.unary/meta.unary.prop/is_copy_constructible.pass.cpp
@@ -12,17 +12,24 @@
// is_copy_constructible
#include <type_traits>
+#include "test_macros.h"
template <class T>
void test_is_copy_constructible()
{
static_assert( std::is_copy_constructible<T>::value, "");
+#if TEST_STD_VER > 14
+ static_assert( std::is_copy_constructible_v<T>, "");
+#endif
}
template <class T>
void test_is_not_copy_constructible()
{
static_assert(!std::is_copy_constructible<T>::value, "");
+#if TEST_STD_VER > 14
+ static_assert(!std::is_copy_constructible_v<T>, "");
+#endif
}
class Empty
diff --git a/test/std/utilities/meta/meta.unary/meta.unary.prop/is_default_constructible.pass.cpp b/test/std/utilities/meta/meta.unary/meta.unary.prop/is_default_constructible.pass.cpp
index c8d5c42fbf89..7b46eeaab66b 100644
--- a/test/std/utilities/meta/meta.unary/meta.unary.prop/is_default_constructible.pass.cpp
+++ b/test/std/utilities/meta/meta.unary/meta.unary.prop/is_default_constructible.pass.cpp
@@ -12,6 +12,7 @@
// is_default_constructible
#include <type_traits>
+#include "test_macros.h"
template <class T>
void test_is_default_constructible()
@@ -20,6 +21,12 @@ void test_is_default_constructible()
static_assert( std::is_default_constructible<const T>::value, "");
static_assert( std::is_default_constructible<volatile T>::value, "");
static_assert( std::is_default_constructible<const volatile T>::value, "");
+#if TEST_STD_VER > 14
+ static_assert( std::is_default_constructible_v<T>, "");
+ static_assert( std::is_default_constructible_v<const T>, "");
+ static_assert( std::is_default_constructible_v<volatile T>, "");
+ static_assert( std::is_default_constructible_v<const volatile T>, "");
+#endif
}
template <class T>
@@ -29,6 +36,12 @@ void test_is_not_default_constructible()
static_assert(!std::is_default_constructible<const T>::value, "");
static_assert(!std::is_default_constructible<volatile T>::value, "");
static_assert(!std::is_default_constructible<const volatile T>::value, "");
+#if TEST_STD_VER > 14
+ static_assert(!std::is_default_constructible_v<T>, "");
+ static_assert(!std::is_default_constructible_v<const T>, "");
+ static_assert(!std::is_default_constructible_v<volatile T>, "");
+ static_assert(!std::is_default_constructible_v<const volatile T>, "");
+#endif
}
class Empty
diff --git a/test/std/utilities/meta/meta.unary/meta.unary.prop/is_destructible.pass.cpp b/test/std/utilities/meta/meta.unary/meta.unary.prop/is_destructible.pass.cpp
index 807745ef66c1..60d607aba61c 100644
--- a/test/std/utilities/meta/meta.unary/meta.unary.prop/is_destructible.pass.cpp
+++ b/test/std/utilities/meta/meta.unary/meta.unary.prop/is_destructible.pass.cpp
@@ -12,6 +12,7 @@
// is_destructible
#include <type_traits>
+#include "test_macros.h"
template <class T>
void test_is_destructible()
@@ -20,6 +21,12 @@ void test_is_destructible()
static_assert( std::is_destructible<const T>::value, "");
static_assert( std::is_destructible<volatile T>::value, "");
static_assert( std::is_destructible<const volatile T>::value, "");
+#if TEST_STD_VER > 14
+ static_assert( std::is_destructible_v<T>, "");
+ static_assert( std::is_destructible_v<const T>, "");
+ static_assert( std::is_destructible_v<volatile T>, "");
+ static_assert( std::is_destructible_v<const volatile T>, "");
+#endif
}
template <class T>
@@ -29,6 +36,12 @@ void test_is_not_destructible()
static_assert(!std::is_destructible<const T>::value, "");
static_assert(!std::is_destructible<volatile T>::value, "");
static_assert(!std::is_destructible<const volatile T>::value, "");
+#if TEST_STD_VER > 14
+ static_assert(!std::is_destructible_v<T>, "");
+ static_assert(!std::is_destructible_v<const T>, "");
+ static_assert(!std::is_destructible_v<volatile T>, "");
+ static_assert(!std::is_destructible_v<const volatile T>, "");
+#endif
}
class Empty {};
@@ -68,6 +81,7 @@ struct PurePublicDestructor { public: virtual ~PurePublicDestruc
struct PureProtectedDestructor { protected: virtual ~PureProtectedDestructor() = 0; };
struct PurePrivateDestructor { private: virtual ~PurePrivateDestructor() = 0; };
+#if TEST_STD_VER >= 11
struct DeletedPublicDestructor { public: ~DeletedPublicDestructor() = delete; };
struct DeletedProtectedDestructor { protected: ~DeletedProtectedDestructor() = delete; };
struct DeletedPrivateDestructor { private: ~DeletedPrivateDestructor() = delete; };
@@ -75,6 +89,7 @@ struct DeletedPrivateDestructor { private: ~DeletedPrivateDestructor(
struct DeletedVirtualPublicDestructor { public: virtual ~DeletedVirtualPublicDestructor() = delete; };
struct DeletedVirtualProtectedDestructor { protected: virtual ~DeletedVirtualProtectedDestructor() = delete; };
struct DeletedVirtualPrivateDestructor { private: virtual ~DeletedVirtualPrivateDestructor() = delete; };
+#endif
int main()
@@ -99,23 +114,27 @@ int main()
test_is_not_destructible<int[]>();
test_is_not_destructible<void>();
+ test_is_not_destructible<Function>();
+#if TEST_STD_VER >= 11
+ // Test access controlled destructors
test_is_not_destructible<ProtectedDestructor>();
test_is_not_destructible<PrivateDestructor>();
test_is_not_destructible<VirtualProtectedDestructor>();
test_is_not_destructible<VirtualPrivateDestructor>();
test_is_not_destructible<PureProtectedDestructor>();
test_is_not_destructible<PurePrivateDestructor>();
+
+ // Test deleted constructors
test_is_not_destructible<DeletedPublicDestructor>();
test_is_not_destructible<DeletedProtectedDestructor>();
test_is_not_destructible<DeletedPrivateDestructor>();
-
-// test_is_not_destructible<DeletedVirtualPublicDestructor>(); // currently fails due to clang bug #20268
+ //test_is_not_destructible<DeletedVirtualPublicDestructor>(); // previously failed due to clang bug #20268
test_is_not_destructible<DeletedVirtualProtectedDestructor>();
test_is_not_destructible<DeletedVirtualPrivateDestructor>();
-#if __has_feature(cxx_access_control_sfinae)
+ // Test private destructors
test_is_not_destructible<NotEmpty>();
#endif
- test_is_not_destructible<Function>();
+
}
diff --git a/test/std/utilities/meta/meta.unary/meta.unary.prop/is_empty.pass.cpp b/test/std/utilities/meta/meta.unary/meta.unary.prop/is_empty.pass.cpp
index 47af3c45cdea..410c1db7244d 100644
--- a/test/std/utilities/meta/meta.unary/meta.unary.prop/is_empty.pass.cpp
+++ b/test/std/utilities/meta/meta.unary/meta.unary.prop/is_empty.pass.cpp
@@ -12,6 +12,7 @@
// is_empty
#include <type_traits>
+#include "test_macros.h"
template <class T>
void test_is_empty()
@@ -20,6 +21,12 @@ void test_is_empty()
static_assert( std::is_empty<const T>::value, "");
static_assert( std::is_empty<volatile T>::value, "");
static_assert( std::is_empty<const volatile T>::value, "");
+#if TEST_STD_VER > 14
+ static_assert( std::is_empty_v<T>, "");
+ static_assert( std::is_empty_v<const T>, "");
+ static_assert( std::is_empty_v<volatile T>, "");
+ static_assert( std::is_empty_v<const volatile T>, "");
+#endif
}
template <class T>
@@ -29,6 +36,12 @@ void test_is_not_empty()
static_assert(!std::is_empty<const T>::value, "");
static_assert(!std::is_empty<volatile T>::value, "");
static_assert(!std::is_empty<const volatile T>::value, "");
+#if TEST_STD_VER > 14
+ static_assert(!std::is_empty_v<T>, "");
+ static_assert(!std::is_empty_v<const T>, "");
+ static_assert(!std::is_empty_v<volatile T>, "");
+ static_assert(!std::is_empty_v<const volatile T>, "");
+#endif
}
class Empty
diff --git a/test/std/utilities/meta/meta.unary/meta.unary.prop/is_final.pass.cpp b/test/std/utilities/meta/meta.unary/meta.unary.prop/is_final.pass.cpp
index cf32196213e1..baf85e3e8139 100644
--- a/test/std/utilities/meta/meta.unary/meta.unary.prop/is_final.pass.cpp
+++ b/test/std/utilities/meta/meta.unary/meta.unary.prop/is_final.pass.cpp
@@ -12,6 +12,7 @@
// is_final
#include <type_traits>
+#include "test_macros.h"
#if _LIBCPP_STD_VER > 11
@@ -26,6 +27,12 @@ void test_is_final()
static_assert( std::is_final<const T>::value, "");
static_assert( std::is_final<volatile T>::value, "");
static_assert( std::is_final<const volatile T>::value, "");
+#if TEST_STD_VER > 14
+ static_assert( std::is_final_v<T>, "");
+ static_assert( std::is_final_v<const T>, "");
+ static_assert( std::is_final_v<volatile T>, "");
+ static_assert( std::is_final_v<const volatile T>, "");
+#endif
}
template <class T>
@@ -35,6 +42,12 @@ void test_is_not_final()
static_assert(!std::is_final<const T>::value, "");
static_assert(!std::is_final<volatile T>::value, "");
static_assert(!std::is_final<const volatile T>::value, "");
+#if TEST_STD_VER > 14
+ static_assert(!std::is_final_v<T>, "");
+ static_assert(!std::is_final_v<const T>, "");
+ static_assert(!std::is_final_v<volatile T>, "");
+ static_assert(!std::is_final_v<const volatile T>, "");
+#endif
}
int main ()
diff --git a/test/std/utilities/meta/meta.unary/meta.unary.prop/is_literal_type.pass.cpp b/test/std/utilities/meta/meta.unary/meta.unary.prop/is_literal_type.pass.cpp
index ce781cd936b0..59aa5e26a292 100644
--- a/test/std/utilities/meta/meta.unary/meta.unary.prop/is_literal_type.pass.cpp
+++ b/test/std/utilities/meta/meta.unary/meta.unary.prop/is_literal_type.pass.cpp
@@ -12,35 +12,94 @@
// is_literal_type
#include <type_traits>
+#include <cstddef> // for std::nullptr_t
+#include "test_macros.h"
template <class T>
void test_is_literal_type()
{
static_assert( std::is_literal_type<T>::value, "");
+ static_assert( std::is_literal_type<const T>::value, "");
+ static_assert( std::is_literal_type<volatile T>::value, "");
+ static_assert( std::is_literal_type<const volatile T>::value, "");
+#if TEST_STD_VER > 14
+ static_assert( std::is_literal_type_v<T>, "");
+ static_assert( std::is_literal_type_v<const T>, "");
+ static_assert( std::is_literal_type_v<volatile T>, "");
+ static_assert( std::is_literal_type_v<const volatile T>, "");
+#endif
}
template <class T>
void test_is_not_literal_type()
{
static_assert(!std::is_literal_type<T>::value, "");
+ static_assert(!std::is_literal_type<const T>::value, "");
+ static_assert(!std::is_literal_type<volatile T>::value, "");
+ static_assert(!std::is_literal_type<const volatile T>::value, "");
+#if TEST_STD_VER > 14
+ static_assert(!std::is_literal_type_v<T>, "");
+ static_assert(!std::is_literal_type_v<const T>, "");
+ static_assert(!std::is_literal_type_v<volatile T>, "");
+ static_assert(!std::is_literal_type_v<const volatile T>, "");
+#endif
}
-struct A
+class Empty
{
};
-struct B
+class NotEmpty
{
- B();
+ virtual ~NotEmpty();
};
+union Union {};
+
+struct bit_zero
+{
+ int : 0;
+};
+
+class Abstract
+{
+ virtual ~Abstract() = 0;
+};
+
+enum Enum {zero, one};
+
+typedef void (*FunctionPtr)();
+
int main()
{
- test_is_literal_type<int> ();
- test_is_literal_type<const int> ();
- test_is_literal_type<int&> ();
- test_is_literal_type<volatile int&> ();
- test_is_literal_type<A> ();
+#if TEST_STD_VER >= 11
+ test_is_literal_type<std::nullptr_t>();
+#endif
+
+// Before C++14, void was not a literal type
+// In C++14, cv-void is is a literal type
+#if TEST_STD_VER < 14
+ test_is_not_literal_type<void>();
+#else
+ test_is_literal_type<void>();
+#endif
+
+ test_is_literal_type<int>();
+ test_is_literal_type<int*>();
+ test_is_literal_type<const int*>();
+ test_is_literal_type<int&>();
+#if TEST_STD_VER >= 11
+ test_is_literal_type<int&&>();
+#endif
+ test_is_literal_type<double>();
+ test_is_literal_type<char[3]>();
+ test_is_literal_type<char[]>();
+ test_is_literal_type<Empty>();
+ test_is_literal_type<bit_zero>();
+ test_is_literal_type<Union>();
+ test_is_literal_type<Enum>();
+ test_is_literal_type<FunctionPtr>();
- test_is_not_literal_type<B> ();
+ test_is_not_literal_type<NotEmpty>();
+ test_is_not_literal_type<Abstract>();
}
diff --git a/test/std/utilities/meta/meta.unary/meta.unary.prop/is_move_assignable.pass.cpp b/test/std/utilities/meta/meta.unary/meta.unary.prop/is_move_assignable.pass.cpp
index a89ee7d4e490..613c1123e3fa 100644
--- a/test/std/utilities/meta/meta.unary/meta.unary.prop/is_move_assignable.pass.cpp
+++ b/test/std/utilities/meta/meta.unary/meta.unary.prop/is_move_assignable.pass.cpp
@@ -12,17 +12,24 @@
// is_move_assignable
#include <type_traits>
+#include "test_macros.h"
template <class T>
void test_is_move_assignable()
{
- static_assert( std::is_move_assignable<T>::value, "");
+ static_assert(( std::is_move_assignable<T>::value), "");
+#if TEST_STD_VER > 14
+ static_assert(( std::is_move_assignable_v<T>), "");
+#endif
}
template <class T>
void test_is_not_move_assignable()
{
- static_assert(!std::is_move_assignable<T>::value, "");
+ static_assert((!std::is_move_assignable<T>::value), "");
+#if TEST_STD_VER > 14
+ static_assert((!std::is_move_assignable_v<T>), "");
+#endif
}
class Empty
diff --git a/test/std/utilities/meta/meta.unary/meta.unary.prop/is_move_constructible.pass.cpp b/test/std/utilities/meta/meta.unary/meta.unary.prop/is_move_constructible.pass.cpp
index 7409ebaa56c8..07c283bf8890 100644
--- a/test/std/utilities/meta/meta.unary/meta.unary.prop/is_move_constructible.pass.cpp
+++ b/test/std/utilities/meta/meta.unary/meta.unary.prop/is_move_constructible.pass.cpp
@@ -12,17 +12,24 @@
// is_move_constructible
#include <type_traits>
+#include "test_macros.h"
template <class T>
void test_is_move_constructible()
{
static_assert( std::is_move_constructible<T>::value, "");
+#if TEST_STD_VER > 14
+ static_assert( std::is_move_constructible_v<T>, "");
+#endif
}
template <class T>
void test_is_not_move_constructible()
{
static_assert(!std::is_move_constructible<T>::value, "");
+#if TEST_STD_VER > 14
+ static_assert(!std::is_move_constructible_v<T>, "");
+#endif
}
class Empty
diff --git a/test/std/utilities/meta/meta.unary/meta.unary.prop/is_nothrow_assignable.pass.cpp b/test/std/utilities/meta/meta.unary/meta.unary.prop/is_nothrow_assignable.pass.cpp
index 8fff5f8b3de3..9d629dc7ef46 100644
--- a/test/std/utilities/meta/meta.unary/meta.unary.prop/is_nothrow_assignable.pass.cpp
+++ b/test/std/utilities/meta/meta.unary/meta.unary.prop/is_nothrow_assignable.pass.cpp
@@ -12,17 +12,24 @@
// is_nothrow_assignable
#include <type_traits>
+#include "test_macros.h"
template <class T, class U>
void test_is_nothrow_assignable()
{
static_assert(( std::is_nothrow_assignable<T, U>::value), "");
+#if TEST_STD_VER > 14
+ static_assert(( std::is_nothrow_assignable_v<T, U>), "");
+#endif
}
template <class T, class U>
void test_is_not_nothrow_assignable()
{
static_assert((!std::is_nothrow_assignable<T, U>::value), "");
+#if TEST_STD_VER > 14
+ static_assert((!std::is_nothrow_assignable_v<T, U>), "");
+#endif
}
struct A
diff --git a/test/std/utilities/meta/meta.unary/meta.unary.prop/is_nothrow_constructible.pass.cpp b/test/std/utilities/meta/meta.unary/meta.unary.prop/is_nothrow_constructible.pass.cpp
index fe0b5673bc44..c778a5d24b2e 100644
--- a/test/std/utilities/meta/meta.unary/meta.unary.prop/is_nothrow_constructible.pass.cpp
+++ b/test/std/utilities/meta/meta.unary/meta.unary.prop/is_nothrow_constructible.pass.cpp
@@ -13,35 +13,51 @@
// struct is_nothrow_constructible;
#include <type_traits>
+#include "test_macros.h"
template <class T>
void test_is_nothrow_constructible()
{
static_assert(( std::is_nothrow_constructible<T>::value), "");
+#if TEST_STD_VER > 14
+ static_assert(( std::is_nothrow_constructible_v<T>), "");
+#endif
}
template <class T, class A0>
void test_is_nothrow_constructible()
{
static_assert(( std::is_nothrow_constructible<T, A0>::value), "");
+#if TEST_STD_VER > 14
+ static_assert(( std::is_nothrow_constructible_v<T, A0>), "");
+#endif
}
template <class T>
void test_is_not_nothrow_constructible()
{
static_assert((!std::is_nothrow_constructible<T>::value), "");
+#if TEST_STD_VER > 14
+ static_assert((!std::is_nothrow_constructible_v<T>), "");
+#endif
}
template <class T, class A0>
void test_is_not_nothrow_constructible()
{
static_assert((!std::is_nothrow_constructible<T, A0>::value), "");
+#if TEST_STD_VER > 14
+ static_assert((!std::is_nothrow_constructible_v<T, A0>), "");
+#endif
}
template <class T, class A0, class A1>
void test_is_not_nothrow_constructible()
{
static_assert((!std::is_nothrow_constructible<T, A0, A1>::value), "");
+#if TEST_STD_VER > 14
+ static_assert((!std::is_nothrow_constructible_v<T, A0, A1>), "");
+#endif
}
class Empty
diff --git a/test/std/utilities/meta/meta.unary/meta.unary.prop/is_nothrow_copy_assignable.pass.cpp b/test/std/utilities/meta/meta.unary/meta.unary.prop/is_nothrow_copy_assignable.pass.cpp
index d843803cf21d..01c9bd0d0941 100644
--- a/test/std/utilities/meta/meta.unary/meta.unary.prop/is_nothrow_copy_assignable.pass.cpp
+++ b/test/std/utilities/meta/meta.unary/meta.unary.prop/is_nothrow_copy_assignable.pass.cpp
@@ -12,17 +12,24 @@
// is_nothrow_copy_assignable
#include <type_traits>
+#include "test_macros.h"
template <class T>
void test_has_nothrow_assign()
{
static_assert( std::is_nothrow_copy_assignable<T>::value, "");
+#if TEST_STD_VER > 14
+ static_assert( std::is_nothrow_copy_assignable_v<T>, "");
+#endif
}
template <class T>
void test_has_not_nothrow_assign()
{
static_assert(!std::is_nothrow_copy_assignable<T>::value, "");
+#if TEST_STD_VER > 14
+ static_assert(!std::is_nothrow_copy_assignable_v<T>, "");
+#endif
}
class Empty
diff --git a/test/std/utilities/meta/meta.unary/meta.unary.prop/is_nothrow_copy_constructible.pass.cpp b/test/std/utilities/meta/meta.unary/meta.unary.prop/is_nothrow_copy_constructible.pass.cpp
index 99fce65dcc7e..9dbdc4e2acfb 100644
--- a/test/std/utilities/meta/meta.unary/meta.unary.prop/is_nothrow_copy_constructible.pass.cpp
+++ b/test/std/utilities/meta/meta.unary/meta.unary.prop/is_nothrow_copy_constructible.pass.cpp
@@ -12,12 +12,17 @@
// is_nothrow_copy_constructible
#include <type_traits>
+#include "test_macros.h"
template <class T>
void test_is_nothrow_copy_constructible()
{
static_assert( std::is_nothrow_copy_constructible<T>::value, "");
static_assert( std::is_nothrow_copy_constructible<const T>::value, "");
+#if TEST_STD_VER > 14
+ static_assert( std::is_nothrow_copy_constructible_v<T>, "");
+ static_assert( std::is_nothrow_copy_constructible_v<const T>, "");
+#endif
}
template <class T>
@@ -27,6 +32,12 @@ void test_has_not_nothrow_copy_constructor()
static_assert(!std::is_nothrow_copy_constructible<const T>::value, "");
static_assert(!std::is_nothrow_copy_constructible<volatile T>::value, "");
static_assert(!std::is_nothrow_copy_constructible<const volatile T>::value, "");
+#if TEST_STD_VER > 14
+ static_assert(!std::is_nothrow_copy_constructible_v<T>, "");
+ static_assert(!std::is_nothrow_copy_constructible_v<const T>, "");
+ static_assert(!std::is_nothrow_copy_constructible_v<volatile T>, "");
+ static_assert(!std::is_nothrow_copy_constructible_v<const volatile T>, "");
+#endif
}
class Empty
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 1550dff08bb5..c89ac8944a93 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
@@ -12,6 +12,7 @@
// is_nothrow_default_constructible
#include <type_traits>
+#include "test_macros.h"
template <class T>
void test_is_nothrow_default_constructible()
@@ -20,6 +21,12 @@ void test_is_nothrow_default_constructible()
static_assert( std::is_nothrow_default_constructible<const T>::value, "");
static_assert( std::is_nothrow_default_constructible<volatile T>::value, "");
static_assert( std::is_nothrow_default_constructible<const volatile T>::value, "");
+#if TEST_STD_VER > 14
+ static_assert( std::is_nothrow_default_constructible_v<T>, "");
+ static_assert( std::is_nothrow_default_constructible_v<const T>, "");
+ static_assert( std::is_nothrow_default_constructible_v<volatile T>, "");
+ static_assert( std::is_nothrow_default_constructible_v<const volatile T>, "");
+#endif
}
template <class T>
@@ -29,6 +36,12 @@ void test_has_not_nothrow_default_constructor()
static_assert(!std::is_nothrow_default_constructible<const T>::value, "");
static_assert(!std::is_nothrow_default_constructible<volatile T>::value, "");
static_assert(!std::is_nothrow_default_constructible<const volatile T>::value, "");
+#if TEST_STD_VER > 14
+ static_assert(!std::is_nothrow_default_constructible_v<T>, "");
+ static_assert(!std::is_nothrow_default_constructible_v<const T>, "");
+ static_assert(!std::is_nothrow_default_constructible_v<volatile T>, "");
+ static_assert(!std::is_nothrow_default_constructible_v<const volatile T>, "");
+#endif
}
class Empty
diff --git a/test/std/utilities/meta/meta.unary/meta.unary.prop/is_nothrow_destructible.pass.cpp b/test/std/utilities/meta/meta.unary/meta.unary.prop/is_nothrow_destructible.pass.cpp
index 8fd5bab5a019..42c9807efa83 100644
--- a/test/std/utilities/meta/meta.unary/meta.unary.prop/is_nothrow_destructible.pass.cpp
+++ b/test/std/utilities/meta/meta.unary/meta.unary.prop/is_nothrow_destructible.pass.cpp
@@ -12,6 +12,7 @@
// is_nothrow_destructible
#include <type_traits>
+#include "test_macros.h"
template <class T>
void test_is_nothrow_destructible()
@@ -20,6 +21,12 @@ void test_is_nothrow_destructible()
static_assert( std::is_nothrow_destructible<const T>::value, "");
static_assert( std::is_nothrow_destructible<volatile T>::value, "");
static_assert( std::is_nothrow_destructible<const volatile T>::value, "");
+#if TEST_STD_VER > 14
+ static_assert( std::is_nothrow_destructible_v<T>, "");
+ static_assert( std::is_nothrow_destructible_v<const T>, "");
+ static_assert( std::is_nothrow_destructible_v<volatile T>, "");
+ static_assert( std::is_nothrow_destructible_v<const volatile T>, "");
+#endif
}
template <class T>
@@ -29,16 +36,31 @@ void test_is_not_nothrow_destructible()
static_assert(!std::is_nothrow_destructible<const T>::value, "");
static_assert(!std::is_nothrow_destructible<volatile T>::value, "");
static_assert(!std::is_nothrow_destructible<const volatile T>::value, "");
+#if TEST_STD_VER > 14
+ static_assert(!std::is_nothrow_destructible_v<T>, "");
+ static_assert(!std::is_nothrow_destructible_v<const T>, "");
+ static_assert(!std::is_nothrow_destructible_v<volatile T>, "");
+ static_assert(!std::is_nothrow_destructible_v<const volatile T>, "");
+#endif
}
+
+struct PublicDestructor { public: ~PublicDestructor() {}};
+struct ProtectedDestructor { protected: ~ProtectedDestructor() {}};
+struct PrivateDestructor { private: ~PrivateDestructor() {}};
+
+struct VirtualPublicDestructor { public: virtual ~VirtualPublicDestructor() {}};
+struct VirtualProtectedDestructor { protected: virtual ~VirtualProtectedDestructor() {}};
+struct VirtualPrivateDestructor { private: virtual ~VirtualPrivateDestructor() {}};
+
+struct PurePublicDestructor { public: virtual ~PurePublicDestructor() = 0; };
+struct PureProtectedDestructor { protected: virtual ~PureProtectedDestructor() = 0; };
+struct PurePrivateDestructor { private: virtual ~PurePrivateDestructor() = 0; };
+
class Empty
{
};
-class NotEmpty
-{
- virtual ~NotEmpty();
-};
union Union {};
@@ -52,40 +74,36 @@ class Abstract
virtual void foo() = 0;
};
-class AbstractDestructor
-{
- virtual ~AbstractDestructor() = 0;
-};
-
-struct A
-{
- ~A();
-};
int main()
{
test_is_not_nothrow_destructible<void>();
- test_is_not_nothrow_destructible<AbstractDestructor>();
- test_is_not_nothrow_destructible<NotEmpty>();
test_is_not_nothrow_destructible<char[]>();
+ test_is_not_nothrow_destructible<char[][3]>();
-#if __has_feature(cxx_noexcept)
- test_is_nothrow_destructible<A>();
-#endif
test_is_nothrow_destructible<int&>();
-#if __has_feature(cxx_unrestricted_unions)
- test_is_nothrow_destructible<Union>();
-#endif
-#if __has_feature(cxx_access_control_sfinae)
- test_is_nothrow_destructible<Empty>();
-#endif
test_is_nothrow_destructible<int>();
test_is_nothrow_destructible<double>();
test_is_nothrow_destructible<int*>();
test_is_nothrow_destructible<const int*>();
test_is_nothrow_destructible<char[3]>();
- test_is_nothrow_destructible<Abstract>();
-#if __has_feature(cxx_noexcept)
+
+#if TEST_STD_VER >= 11
+ // requires noexcept. These are all destructible.
+ test_is_nothrow_destructible<PublicDestructor>();
+ test_is_nothrow_destructible<VirtualPublicDestructor>();
+ test_is_nothrow_destructible<PurePublicDestructor>();
test_is_nothrow_destructible<bit_zero>();
+ test_is_nothrow_destructible<Abstract>();
+ test_is_nothrow_destructible<Empty>();
+ test_is_nothrow_destructible<Union>();
+
+ // requires access control
+ test_is_not_nothrow_destructible<ProtectedDestructor>();
+ test_is_not_nothrow_destructible<PrivateDestructor>();
+ test_is_not_nothrow_destructible<VirtualProtectedDestructor>();
+ test_is_not_nothrow_destructible<VirtualPrivateDestructor>();
+ test_is_not_nothrow_destructible<PureProtectedDestructor>();
+ test_is_not_nothrow_destructible<PurePrivateDestructor>();
#endif
}
diff --git a/test/std/utilities/meta/meta.unary/meta.unary.prop/is_nothrow_move_assignable.pass.cpp b/test/std/utilities/meta/meta.unary/meta.unary.prop/is_nothrow_move_assignable.pass.cpp
index fe51e438864f..11852f6aec98 100644
--- a/test/std/utilities/meta/meta.unary/meta.unary.prop/is_nothrow_move_assignable.pass.cpp
+++ b/test/std/utilities/meta/meta.unary/meta.unary.prop/is_nothrow_move_assignable.pass.cpp
@@ -12,17 +12,24 @@
// has_nothrow_move_assign
#include <type_traits>
+#include "test_macros.h"
template <class T>
void test_has_nothrow_assign()
{
static_assert( std::is_nothrow_move_assignable<T>::value, "");
+#if TEST_STD_VER > 14
+ static_assert( std::is_nothrow_move_assignable_v<T>, "");
+#endif
}
template <class T>
void test_has_not_nothrow_assign()
{
static_assert(!std::is_nothrow_move_assignable<T>::value, "");
+#if TEST_STD_VER > 14
+ static_assert(!std::is_nothrow_move_assignable_v<T>, "");
+#endif
}
class Empty
diff --git a/test/std/utilities/meta/meta.unary/meta.unary.prop/is_nothrow_move_constructible.pass.cpp b/test/std/utilities/meta/meta.unary/meta.unary.prop/is_nothrow_move_constructible.pass.cpp
index f5a42afe0d50..b93dbb634e4d 100644
--- a/test/std/utilities/meta/meta.unary/meta.unary.prop/is_nothrow_move_constructible.pass.cpp
+++ b/test/std/utilities/meta/meta.unary/meta.unary.prop/is_nothrow_move_constructible.pass.cpp
@@ -12,12 +12,17 @@
// has_nothrow_move_constructor
#include <type_traits>
+#include "test_macros.h"
template <class T>
void test_is_nothrow_move_constructible()
{
static_assert( std::is_nothrow_move_constructible<T>::value, "");
static_assert( std::is_nothrow_move_constructible<const T>::value, "");
+#if TEST_STD_VER > 14
+ static_assert( std::is_nothrow_move_constructible_v<T>, "");
+ static_assert( std::is_nothrow_move_constructible_v<const T>, "");
+#endif
}
template <class T>
@@ -27,6 +32,12 @@ void test_has_not_nothrow_move_constructor()
static_assert(!std::is_nothrow_move_constructible<const T>::value, "");
static_assert(!std::is_nothrow_move_constructible<volatile T>::value, "");
static_assert(!std::is_nothrow_move_constructible<const volatile T>::value, "");
+#if TEST_STD_VER > 14
+ static_assert(!std::is_nothrow_move_constructible_v<T>, "");
+ static_assert(!std::is_nothrow_move_constructible_v<const T>, "");
+ static_assert(!std::is_nothrow_move_constructible_v<volatile T>, "");
+ static_assert(!std::is_nothrow_move_constructible_v<const volatile T>, "");
+#endif
}
class Empty
diff --git a/test/std/utilities/meta/meta.unary/meta.unary.prop/is_pod.pass.cpp b/test/std/utilities/meta/meta.unary/meta.unary.prop/is_pod.pass.cpp
index 4ec1ae9949ef..2ca2b8640141 100644
--- a/test/std/utilities/meta/meta.unary/meta.unary.prop/is_pod.pass.cpp
+++ b/test/std/utilities/meta/meta.unary/meta.unary.prop/is_pod.pass.cpp
@@ -12,6 +12,7 @@
// is_pod
#include <type_traits>
+#include "test_macros.h"
template <class T>
void test_is_pod()
@@ -20,6 +21,12 @@ void test_is_pod()
static_assert( std::is_pod<const T>::value, "");
static_assert( std::is_pod<volatile T>::value, "");
static_assert( std::is_pod<const volatile T>::value, "");
+#if TEST_STD_VER > 14
+ static_assert( std::is_pod_v<T>, "");
+ static_assert( std::is_pod_v<const T>, "");
+ static_assert( std::is_pod_v<volatile T>, "");
+ static_assert( std::is_pod_v<const volatile T>, "");
+#endif
}
template <class T>
@@ -29,6 +36,12 @@ void test_is_not_pod()
static_assert(!std::is_pod<const T>::value, "");
static_assert(!std::is_pod<volatile T>::value, "");
static_assert(!std::is_pod<const volatile T>::value, "");
+#if TEST_STD_VER > 14
+ static_assert(!std::is_pod_v<T>, "");
+ static_assert(!std::is_pod_v<const T>, "");
+ static_assert(!std::is_pod_v<volatile T>, "");
+ static_assert(!std::is_pod_v<const volatile T>, "");
+#endif
}
class Class
diff --git a/test/std/utilities/meta/meta.unary/meta.unary.prop/is_polymorphic.pass.cpp b/test/std/utilities/meta/meta.unary/meta.unary.prop/is_polymorphic.pass.cpp
index 6e82cddc5166..b66e7a296f39 100644
--- a/test/std/utilities/meta/meta.unary/meta.unary.prop/is_polymorphic.pass.cpp
+++ b/test/std/utilities/meta/meta.unary/meta.unary.prop/is_polymorphic.pass.cpp
@@ -12,6 +12,7 @@
// is_polymorphic
#include <type_traits>
+#include "test_macros.h"
template <class T>
void test_is_polymorphic()
@@ -20,6 +21,12 @@ void test_is_polymorphic()
static_assert( std::is_polymorphic<const T>::value, "");
static_assert( std::is_polymorphic<volatile T>::value, "");
static_assert( std::is_polymorphic<const volatile T>::value, "");
+#if TEST_STD_VER > 14
+ static_assert( std::is_polymorphic_v<T>, "");
+ static_assert( std::is_polymorphic_v<const T>, "");
+ static_assert( std::is_polymorphic_v<volatile T>, "");
+ static_assert( std::is_polymorphic_v<const volatile T>, "");
+#endif
}
template <class T>
@@ -29,6 +36,12 @@ void test_is_not_polymorphic()
static_assert(!std::is_polymorphic<const T>::value, "");
static_assert(!std::is_polymorphic<volatile T>::value, "");
static_assert(!std::is_polymorphic<const volatile T>::value, "");
+#if TEST_STD_VER > 14
+ static_assert(!std::is_polymorphic_v<T>, "");
+ static_assert(!std::is_polymorphic_v<const T>, "");
+ static_assert(!std::is_polymorphic_v<volatile T>, "");
+ static_assert(!std::is_polymorphic_v<const volatile T>, "");
+#endif
}
class Empty
diff --git a/test/std/utilities/meta/meta.unary/meta.unary.prop/is_signed.pass.cpp b/test/std/utilities/meta/meta.unary/meta.unary.prop/is_signed.pass.cpp
index 479c2529f02a..94bf7fb58041 100644
--- a/test/std/utilities/meta/meta.unary/meta.unary.prop/is_signed.pass.cpp
+++ b/test/std/utilities/meta/meta.unary/meta.unary.prop/is_signed.pass.cpp
@@ -12,6 +12,7 @@
// is_signed
#include <type_traits>
+#include "test_macros.h"
template <class T>
void test_is_signed()
@@ -20,6 +21,12 @@ void test_is_signed()
static_assert( std::is_signed<const T>::value, "");
static_assert( std::is_signed<volatile T>::value, "");
static_assert( std::is_signed<const volatile T>::value, "");
+#if TEST_STD_VER > 14
+ static_assert( std::is_signed_v<T>, "");
+ static_assert( std::is_signed_v<const T>, "");
+ static_assert( std::is_signed_v<volatile T>, "");
+ static_assert( std::is_signed_v<const volatile T>, "");
+#endif
}
template <class T>
@@ -29,6 +36,12 @@ void test_is_not_signed()
static_assert(!std::is_signed<const T>::value, "");
static_assert(!std::is_signed<volatile T>::value, "");
static_assert(!std::is_signed<const volatile T>::value, "");
+#if TEST_STD_VER > 14
+ static_assert(!std::is_signed_v<T>, "");
+ static_assert(!std::is_signed_v<const T>, "");
+ static_assert(!std::is_signed_v<volatile T>, "");
+ static_assert(!std::is_signed_v<const volatile T>, "");
+#endif
}
class Class
diff --git a/test/std/utilities/meta/meta.unary/meta.unary.prop/is_standard_layout.pass.cpp b/test/std/utilities/meta/meta.unary/meta.unary.prop/is_standard_layout.pass.cpp
index 668c4cdc7dd6..6e601c1ac04b 100644
--- a/test/std/utilities/meta/meta.unary/meta.unary.prop/is_standard_layout.pass.cpp
+++ b/test/std/utilities/meta/meta.unary/meta.unary.prop/is_standard_layout.pass.cpp
@@ -12,6 +12,7 @@
// is_standard_layout
#include <type_traits>
+#include "test_macros.h"
template <class T>
void test_is_standard_layout()
@@ -20,6 +21,12 @@ void test_is_standard_layout()
static_assert( std::is_standard_layout<const T>::value, "");
static_assert( std::is_standard_layout<volatile T>::value, "");
static_assert( std::is_standard_layout<const volatile T>::value, "");
+#if TEST_STD_VER > 14
+ static_assert( std::is_standard_layout_v<T>, "");
+ static_assert( std::is_standard_layout_v<const T>, "");
+ static_assert( std::is_standard_layout_v<volatile T>, "");
+ static_assert( std::is_standard_layout_v<const volatile T>, "");
+#endif
}
template <class T>
@@ -29,6 +36,12 @@ void test_is_not_standard_layout()
static_assert(!std::is_standard_layout<const T>::value, "");
static_assert(!std::is_standard_layout<volatile T>::value, "");
static_assert(!std::is_standard_layout<const volatile T>::value, "");
+#if TEST_STD_VER > 14
+ static_assert(!std::is_standard_layout_v<T>, "");
+ static_assert(!std::is_standard_layout_v<const T>, "");
+ static_assert(!std::is_standard_layout_v<volatile T>, "");
+ static_assert(!std::is_standard_layout_v<const volatile T>, "");
+#endif
}
template <class T1, class T2>
diff --git a/test/std/utilities/meta/meta.unary/meta.unary.prop/is_trivial.pass.cpp b/test/std/utilities/meta/meta.unary/meta.unary.prop/is_trivial.pass.cpp
index af38699d881b..2d2df14d3bbc 100644
--- a/test/std/utilities/meta/meta.unary/meta.unary.prop/is_trivial.pass.cpp
+++ b/test/std/utilities/meta/meta.unary/meta.unary.prop/is_trivial.pass.cpp
@@ -12,6 +12,7 @@
// is_trivial
#include <type_traits>
+#include "test_macros.h"
template <class T>
void test_is_trivial()
@@ -20,6 +21,12 @@ void test_is_trivial()
static_assert( std::is_trivial<const T>::value, "");
static_assert( std::is_trivial<volatile T>::value, "");
static_assert( std::is_trivial<const volatile T>::value, "");
+#if TEST_STD_VER > 14
+ static_assert( std::is_trivial_v<T>, "");
+ static_assert( std::is_trivial_v<const T>, "");
+ static_assert( std::is_trivial_v<volatile T>, "");
+ static_assert( std::is_trivial_v<const volatile T>, "");
+#endif
}
template <class T>
@@ -29,6 +36,12 @@ void test_is_not_trivial()
static_assert(!std::is_trivial<const T>::value, "");
static_assert(!std::is_trivial<volatile T>::value, "");
static_assert(!std::is_trivial<const volatile T>::value, "");
+#if TEST_STD_VER > 14
+ static_assert(!std::is_trivial_v<T>, "");
+ static_assert(!std::is_trivial_v<const T>, "");
+ static_assert(!std::is_trivial_v<volatile T>, "");
+ static_assert(!std::is_trivial_v<const volatile T>, "");
+#endif
}
struct A {};
diff --git a/test/std/utilities/meta/meta.unary/meta.unary.prop/is_trivially_assignable.pass.cpp b/test/std/utilities/meta/meta.unary/meta.unary.prop/is_trivially_assignable.pass.cpp
index 735d05fa6ee4..3ebb9dba429d 100644
--- a/test/std/utilities/meta/meta.unary/meta.unary.prop/is_trivially_assignable.pass.cpp
+++ b/test/std/utilities/meta/meta.unary/meta.unary.prop/is_trivially_assignable.pass.cpp
@@ -12,17 +12,24 @@
// is_trivially_assignable
#include <type_traits>
+#include "test_macros.h"
template <class T, class U>
void test_is_trivially_assignable()
{
static_assert(( std::is_trivially_assignable<T, U>::value), "");
+#if TEST_STD_VER > 14
+ static_assert(( std::is_trivially_assignable_v<T, U>), "");
+#endif
}
template <class T, class U>
void test_is_not_trivially_assignable()
{
static_assert((!std::is_trivially_assignable<T, U>::value), "");
+#if TEST_STD_VER > 14
+ static_assert((!std::is_trivially_assignable_v<T, U>), "");
+#endif
}
struct A
diff --git a/test/std/utilities/meta/meta.unary/meta.unary.prop/is_trivially_constructible.pass.cpp b/test/std/utilities/meta/meta.unary/meta.unary.prop/is_trivially_constructible.pass.cpp
index 4171d4d32f5d..212245f00691 100644
--- a/test/std/utilities/meta/meta.unary/meta.unary.prop/is_trivially_constructible.pass.cpp
+++ b/test/std/utilities/meta/meta.unary/meta.unary.prop/is_trivially_constructible.pass.cpp
@@ -13,35 +13,51 @@
// struct is_trivially_constructible;
#include <type_traits>
+#include "test_macros.h"
template <class T>
void test_is_trivially_constructible()
{
static_assert(( std::is_trivially_constructible<T>::value), "");
+#if TEST_STD_VER > 14
+ static_assert(( std::is_trivially_constructible_v<T>), "");
+#endif
}
template <class T, class A0>
void test_is_trivially_constructible()
{
static_assert(( std::is_trivially_constructible<T, A0>::value), "");
+#if TEST_STD_VER > 14
+ static_assert(( std::is_trivially_constructible_v<T, A0>), "");
+#endif
}
template <class T>
void test_is_not_trivially_constructible()
{
static_assert((!std::is_trivially_constructible<T>::value), "");
+#if TEST_STD_VER > 14
+ static_assert((!std::is_trivially_constructible_v<T>), "");
+#endif
}
template <class T, class A0>
void test_is_not_trivially_constructible()
{
static_assert((!std::is_trivially_constructible<T, A0>::value), "");
+#if TEST_STD_VER > 14
+ static_assert((!std::is_trivially_constructible_v<T, A0>), "");
+#endif
}
template <class T, class A0, class A1>
void test_is_not_trivially_constructible()
{
static_assert((!std::is_trivially_constructible<T, A0, A1>::value), "");
+#if TEST_STD_VER > 14
+ static_assert((!std::is_trivially_constructible_v<T, A0, A1>), "");
+#endif
}
struct A
diff --git a/test/std/utilities/meta/meta.unary/meta.unary.prop/is_trivially_copy_assignable.pass.cpp b/test/std/utilities/meta/meta.unary/meta.unary.prop/is_trivially_copy_assignable.pass.cpp
index 7d72565e40ca..25429f5470e7 100644
--- a/test/std/utilities/meta/meta.unary/meta.unary.prop/is_trivially_copy_assignable.pass.cpp
+++ b/test/std/utilities/meta/meta.unary/meta.unary.prop/is_trivially_copy_assignable.pass.cpp
@@ -12,17 +12,24 @@
// is_trivially_copy_assignable
#include <type_traits>
+#include "test_macros.h"
template <class T>
void test_has_trivially_copy_assignable()
{
static_assert( std::is_trivially_copy_assignable<T>::value, "");
+#if TEST_STD_VER > 14
+ static_assert( std::is_trivially_copy_assignable_v<T>, "");
+#endif
}
template <class T>
void test_has_not_trivially_copy_assignable()
{
static_assert(!std::is_trivially_copy_assignable<T>::value, "");
+#if TEST_STD_VER > 14
+ static_assert(!std::is_trivially_copy_assignable_v<T>, "");
+#endif
}
class Empty
diff --git a/test/std/utilities/meta/meta.unary/meta.unary.prop/is_trivially_copy_constructible.pass.cpp b/test/std/utilities/meta/meta.unary/meta.unary.prop/is_trivially_copy_constructible.pass.cpp
index 6bd78ec9e7a1..9556959e1262 100644
--- a/test/std/utilities/meta/meta.unary/meta.unary.prop/is_trivially_copy_constructible.pass.cpp
+++ b/test/std/utilities/meta/meta.unary/meta.unary.prop/is_trivially_copy_constructible.pass.cpp
@@ -12,12 +12,17 @@
// is_trivially_copy_constructible
#include <type_traits>
+#include "test_macros.h"
template <class T>
void test_is_trivially_copy_constructible()
{
static_assert( std::is_trivially_copy_constructible<T>::value, "");
static_assert( std::is_trivially_copy_constructible<const T>::value, "");
+#if TEST_STD_VER > 14
+ static_assert( std::is_trivially_copy_constructible_v<T>, "");
+ static_assert( std::is_trivially_copy_constructible_v<const T>, "");
+#endif
}
template <class T>
@@ -25,6 +30,10 @@ void test_has_not_trivial_copy_constructor()
{
static_assert(!std::is_trivially_copy_constructible<T>::value, "");
static_assert(!std::is_trivially_copy_constructible<const T>::value, "");
+#if TEST_STD_VER > 14
+ static_assert(!std::is_trivially_copy_constructible_v<T>, "");
+ static_assert(!std::is_trivially_copy_constructible_v<const T>, "");
+#endif
}
class Empty
diff --git a/test/std/utilities/meta/meta.unary/meta.unary.prop/is_trivially_copyable.pass.cpp b/test/std/utilities/meta/meta.unary/meta.unary.prop/is_trivially_copyable.pass.cpp
index d65882378fc4..c19a29ffb586 100644
--- a/test/std/utilities/meta/meta.unary/meta.unary.prop/is_trivially_copyable.pass.cpp
+++ b/test/std/utilities/meta/meta.unary/meta.unary.prop/is_trivially_copyable.pass.cpp
@@ -13,6 +13,7 @@
#include <type_traits>
#include <cassert>
+#include "test_macros.h"
template <class T>
void test_is_trivially_copyable()
@@ -21,6 +22,12 @@ void test_is_trivially_copyable()
static_assert( std::is_trivially_copyable<const T>::value, "");
static_assert(!std::is_trivially_copyable<volatile T>::value, "");
static_assert(!std::is_trivially_copyable<const volatile T>::value, "");
+#if TEST_STD_VER > 14
+ static_assert( std::is_trivially_copyable_v<T>, "");
+ static_assert( std::is_trivially_copyable_v<const T>, "");
+ static_assert(!std::is_trivially_copyable_v<volatile T>, "");
+ static_assert(!std::is_trivially_copyable_v<const volatile T>, "");
+#endif
}
template <class T>
@@ -30,6 +37,12 @@ void test_is_not_trivially_copyable()
static_assert(!std::is_trivially_copyable<const T>::value, "");
static_assert(!std::is_trivially_copyable<volatile T>::value, "");
static_assert(!std::is_trivially_copyable<const volatile T>::value, "");
+#if TEST_STD_VER > 14
+ static_assert(!std::is_trivially_copyable_v<T>, "");
+ static_assert(!std::is_trivially_copyable_v<const T>, "");
+ static_assert(!std::is_trivially_copyable_v<volatile T>, "");
+ static_assert(!std::is_trivially_copyable_v<const volatile T>, "");
+#endif
}
struct A
diff --git a/test/std/utilities/meta/meta.unary/meta.unary.prop/is_trivially_default_constructible.pass.cpp b/test/std/utilities/meta/meta.unary/meta.unary.prop/is_trivially_default_constructible.pass.cpp
index 1f63401dacb7..2d367159ca30 100644
--- a/test/std/utilities/meta/meta.unary/meta.unary.prop/is_trivially_default_constructible.pass.cpp
+++ b/test/std/utilities/meta/meta.unary/meta.unary.prop/is_trivially_default_constructible.pass.cpp
@@ -12,6 +12,7 @@
// is_trivially_default_constructible
#include <type_traits>
+#include "test_macros.h"
template <class T>
void test_is_trivially_default_constructible()
@@ -20,6 +21,12 @@ void test_is_trivially_default_constructible()
static_assert( std::is_trivially_default_constructible<const T>::value, "");
static_assert( std::is_trivially_default_constructible<volatile T>::value, "");
static_assert( std::is_trivially_default_constructible<const volatile T>::value, "");
+#if TEST_STD_VER > 14
+ static_assert( std::is_trivially_default_constructible_v<T>, "");
+ static_assert( std::is_trivially_default_constructible_v<const T>, "");
+ static_assert( std::is_trivially_default_constructible_v<volatile T>, "");
+ static_assert( std::is_trivially_default_constructible_v<const volatile T>, "");
+#endif
}
template <class T>
@@ -29,6 +36,12 @@ void test_has_not_trivial_default_constructor()
static_assert(!std::is_trivially_default_constructible<const T>::value, "");
static_assert(!std::is_trivially_default_constructible<volatile T>::value, "");
static_assert(!std::is_trivially_default_constructible<const volatile T>::value, "");
+#if TEST_STD_VER > 14
+ static_assert(!std::is_trivially_default_constructible_v<T>, "");
+ static_assert(!std::is_trivially_default_constructible_v<const T>, "");
+ static_assert(!std::is_trivially_default_constructible_v<volatile T>, "");
+ static_assert(!std::is_trivially_default_constructible_v<const volatile T>, "");
+#endif
}
class Empty
diff --git a/test/std/utilities/meta/meta.unary/meta.unary.prop/is_trivially_destructible.pass.cpp b/test/std/utilities/meta/meta.unary/meta.unary.prop/is_trivially_destructible.pass.cpp
index b18ace44bda1..9e2507067d2d 100644
--- a/test/std/utilities/meta/meta.unary/meta.unary.prop/is_trivially_destructible.pass.cpp
+++ b/test/std/utilities/meta/meta.unary/meta.unary.prop/is_trivially_destructible.pass.cpp
@@ -12,6 +12,7 @@
// is_trivially_destructible
#include <type_traits>
+#include "test_macros.h"
template <class T>
void test_is_trivially_destructible()
@@ -20,6 +21,12 @@ void test_is_trivially_destructible()
static_assert( std::is_trivially_destructible<const T>::value, "");
static_assert( std::is_trivially_destructible<volatile T>::value, "");
static_assert( std::is_trivially_destructible<const volatile T>::value, "");
+#if TEST_STD_VER > 14
+ static_assert( std::is_trivially_destructible_v<T>, "");
+ static_assert( std::is_trivially_destructible_v<const T>, "");
+ static_assert( std::is_trivially_destructible_v<volatile T>, "");
+ static_assert( std::is_trivially_destructible_v<const volatile T>, "");
+#endif
}
template <class T>
@@ -29,15 +36,29 @@ void test_is_not_trivially_destructible()
static_assert(!std::is_trivially_destructible<const T>::value, "");
static_assert(!std::is_trivially_destructible<volatile T>::value, "");
static_assert(!std::is_trivially_destructible<const volatile T>::value, "");
+#if TEST_STD_VER > 14
+ static_assert(!std::is_trivially_destructible_v<T>, "");
+ static_assert(!std::is_trivially_destructible_v<const T>, "");
+ static_assert(!std::is_trivially_destructible_v<volatile T>, "");
+ static_assert(!std::is_trivially_destructible_v<const volatile T>, "");
+#endif
}
-class Empty
-{
-};
+struct PublicDestructor { public: ~PublicDestructor() {}};
+struct ProtectedDestructor { protected: ~ProtectedDestructor() {}};
+struct PrivateDestructor { private: ~PrivateDestructor() {}};
+
+struct VirtualPublicDestructor { public: virtual ~VirtualPublicDestructor() {}};
+struct VirtualProtectedDestructor { protected: virtual ~VirtualProtectedDestructor() {}};
+struct VirtualPrivateDestructor { private: virtual ~VirtualPrivateDestructor() {}};
+
+struct PurePublicDestructor { public: virtual ~PurePublicDestructor() = 0; };
+struct PureProtectedDestructor { protected: virtual ~PureProtectedDestructor() = 0; };
+struct PurePrivateDestructor { private: virtual ~PurePrivateDestructor() = 0; };
-class NotEmpty
+
+class Empty
{
- virtual ~NotEmpty();
};
union Union {};
@@ -66,18 +87,28 @@ int main()
{
test_is_not_trivially_destructible<void>();
test_is_not_trivially_destructible<A>();
- test_is_not_trivially_destructible<AbstractDestructor>();
- test_is_not_trivially_destructible<NotEmpty>();
test_is_not_trivially_destructible<char[]>();
+ test_is_not_trivially_destructible<VirtualPublicDestructor>();
+ test_is_not_trivially_destructible<PurePublicDestructor>();
test_is_trivially_destructible<Abstract>();
- test_is_trivially_destructible<int&>();
test_is_trivially_destructible<Union>();
test_is_trivially_destructible<Empty>();
+ test_is_trivially_destructible<int&>();
test_is_trivially_destructible<int>();
test_is_trivially_destructible<double>();
test_is_trivially_destructible<int*>();
test_is_trivially_destructible<const int*>();
test_is_trivially_destructible<char[3]>();
test_is_trivially_destructible<bit_zero>();
+
+#if TEST_STD_VER >= 11
+ // requires access control sfinae
+ test_is_not_trivially_destructible<ProtectedDestructor>();
+ test_is_not_trivially_destructible<PrivateDestructor>();
+ test_is_not_trivially_destructible<VirtualProtectedDestructor>();
+ test_is_not_trivially_destructible<VirtualPrivateDestructor>();
+ test_is_not_trivially_destructible<PureProtectedDestructor>();
+ test_is_not_trivially_destructible<PurePrivateDestructor>();
+#endif
}
diff --git a/test/std/utilities/meta/meta.unary/meta.unary.prop/is_trivially_move_assignable.pass.cpp b/test/std/utilities/meta/meta.unary/meta.unary.prop/is_trivially_move_assignable.pass.cpp
index c3fc7ac0a3df..eca596ee1c19 100644
--- a/test/std/utilities/meta/meta.unary/meta.unary.prop/is_trivially_move_assignable.pass.cpp
+++ b/test/std/utilities/meta/meta.unary/meta.unary.prop/is_trivially_move_assignable.pass.cpp
@@ -12,17 +12,24 @@
// is_trivially_move_assignable
#include <type_traits>
+#include "test_macros.h"
template <class T>
void test_has_trivial_assign()
{
static_assert( std::is_trivially_move_assignable<T>::value, "");
+#if TEST_STD_VER > 14
+ static_assert( std::is_trivially_move_assignable_v<T>, "");
+#endif
}
template <class T>
void test_has_not_trivial_assign()
{
static_assert(!std::is_trivially_move_assignable<T>::value, "");
+#if TEST_STD_VER > 14
+ static_assert(!std::is_trivially_move_assignable_v<T>, "");
+#endif
}
class Empty
diff --git a/test/std/utilities/meta/meta.unary/meta.unary.prop/is_trivially_move_constructible.pass.cpp b/test/std/utilities/meta/meta.unary/meta.unary.prop/is_trivially_move_constructible.pass.cpp
index 54cb5e853a81..313da175f715 100644
--- a/test/std/utilities/meta/meta.unary/meta.unary.prop/is_trivially_move_constructible.pass.cpp
+++ b/test/std/utilities/meta/meta.unary/meta.unary.prop/is_trivially_move_constructible.pass.cpp
@@ -12,17 +12,24 @@
// is_trivially_move_constructible
#include <type_traits>
+#include "test_macros.h"
template <class T>
void test_is_trivially_move_constructible()
{
static_assert( std::is_trivially_move_constructible<T>::value, "");
+#if TEST_STD_VER > 14
+ static_assert( std::is_trivially_move_constructible_v<T>, "");
+#endif
}
template <class T>
void test_has_not_trivial_move_constructor()
{
static_assert(!std::is_trivially_move_constructible<T>::value, "");
+#if TEST_STD_VER > 14
+ static_assert(!std::is_trivially_move_constructible_v<T>, "");
+#endif
}
class Empty
diff --git a/test/std/utilities/meta/meta.unary/meta.unary.prop/is_unsigned.pass.cpp b/test/std/utilities/meta/meta.unary/meta.unary.prop/is_unsigned.pass.cpp
index dfdb15542610..9ca42432df16 100644
--- a/test/std/utilities/meta/meta.unary/meta.unary.prop/is_unsigned.pass.cpp
+++ b/test/std/utilities/meta/meta.unary/meta.unary.prop/is_unsigned.pass.cpp
@@ -12,6 +12,7 @@
// is_unsigned
#include <type_traits>
+#include "test_macros.h"
template <class T>
void test_is_unsigned()
@@ -20,6 +21,12 @@ void test_is_unsigned()
static_assert( std::is_unsigned<const T>::value, "");
static_assert( std::is_unsigned<volatile T>::value, "");
static_assert( std::is_unsigned<const volatile T>::value, "");
+#if TEST_STD_VER > 14
+ static_assert( std::is_unsigned_v<T>, "");
+ static_assert( std::is_unsigned_v<const T>, "");
+ static_assert( std::is_unsigned_v<volatile T>, "");
+ static_assert( std::is_unsigned_v<const volatile T>, "");
+#endif
}
template <class T>
@@ -29,6 +36,12 @@ void test_is_not_unsigned()
static_assert(!std::is_unsigned<const T>::value, "");
static_assert(!std::is_unsigned<volatile T>::value, "");
static_assert(!std::is_unsigned<const volatile T>::value, "");
+#if TEST_STD_VER > 14
+ static_assert(!std::is_unsigned_v<T>, "");
+ static_assert(!std::is_unsigned_v<const T>, "");
+ static_assert(!std::is_unsigned_v<volatile T>, "");
+ static_assert(!std::is_unsigned_v<const volatile T>, "");
+#endif
}
class Class
diff --git a/test/std/utilities/meta/meta.unary/meta.unary.prop/is_volatile.pass.cpp b/test/std/utilities/meta/meta.unary/meta.unary.prop/is_volatile.pass.cpp
index f6805bc1c4ff..36697a3f3eba 100644
--- a/test/std/utilities/meta/meta.unary/meta.unary.prop/is_volatile.pass.cpp
+++ b/test/std/utilities/meta/meta.unary/meta.unary.prop/is_volatile.pass.cpp
@@ -12,6 +12,7 @@
// is_volatile
#include <type_traits>
+#include "test_macros.h"
template <class T>
void test_is_volatile()
@@ -20,6 +21,12 @@ void test_is_volatile()
static_assert(!std::is_volatile<const T>::value, "");
static_assert( std::is_volatile<volatile T>::value, "");
static_assert( std::is_volatile<const volatile T>::value, "");
+#if TEST_STD_VER > 14
+ static_assert(!std::is_volatile_v<T>, "");
+ static_assert(!std::is_volatile_v<const T>, "");
+ static_assert( std::is_volatile_v<volatile T>, "");
+ static_assert( std::is_volatile_v<const volatile T>, "");
+#endif
}
int main()
diff --git a/test/std/utilities/ratio/ratio.comparison/ratio_equal.pass.cpp b/test/std/utilities/ratio/ratio.comparison/ratio_equal.pass.cpp
index 78027f7e48b8..9331b7094f48 100644
--- a/test/std/utilities/ratio/ratio.comparison/ratio_equal.pass.cpp
+++ b/test/std/utilities/ratio/ratio.comparison/ratio_equal.pass.cpp
@@ -11,46 +11,57 @@
#include <ratio>
+#include "test_macros.h"
+
+template <class Rat1, class Rat2, bool result>
+void test()
+{
+ static_assert((result == std::ratio_equal<Rat1, Rat2>::value), "");
+#if TEST_STD_VER > 14
+ static_assert((result == std::ratio_equal_v<Rat1, Rat2>), "");
+#endif
+}
+
int main()
{
{
typedef std::ratio<1, 1> R1;
typedef std::ratio<1, 1> R2;
- static_assert((std::ratio_equal<R1, R2>::value), "");
+ test<R1, R2, true>();
}
{
typedef std::ratio<0x7FFFFFFFFFFFFFFFLL, 1> R1;
typedef std::ratio<0x7FFFFFFFFFFFFFFFLL, 1> R2;
- static_assert((std::ratio_equal<R1, R2>::value), "");
+ test<R1, R2, true>();
}
{
typedef std::ratio<-0x7FFFFFFFFFFFFFFFLL, 1> R1;
typedef std::ratio<-0x7FFFFFFFFFFFFFFFLL, 1> R2;
- static_assert((std::ratio_equal<R1, R2>::value), "");
+ test<R1, R2, true>();
}
{
typedef std::ratio<1, 0x7FFFFFFFFFFFFFFFLL> R1;
typedef std::ratio<1, 0x7FFFFFFFFFFFFFFFLL> R2;
- static_assert((std::ratio_equal<R1, R2>::value), "");
+ test<R1, R2, true>();
}
{
typedef std::ratio<1, 1> R1;
typedef std::ratio<1, -1> R2;
- static_assert((!std::ratio_equal<R1, R2>::value), "");
+ test<R1, R2, false>();
}
{
typedef std::ratio<0x7FFFFFFFFFFFFFFFLL, 1> R1;
typedef std::ratio<-0x7FFFFFFFFFFFFFFFLL, 1> R2;
- static_assert((!std::ratio_equal<R1, R2>::value), "");
+ test<R1, R2, false>();
}
{
typedef std::ratio<-0x7FFFFFFFFFFFFFFFLL, 1> R1;
typedef std::ratio<0x7FFFFFFFFFFFFFFFLL, 1> R2;
- static_assert((!std::ratio_equal<R1, R2>::value), "");
+ test<R1, R2, false>();
}
{
typedef std::ratio<1, 0x7FFFFFFFFFFFFFFFLL> R1;
typedef std::ratio<1, -0x7FFFFFFFFFFFFFFFLL> R2;
- static_assert((!std::ratio_equal<R1, R2>::value), "");
+ test<R1, R2, false>();
}
}
diff --git a/test/std/utilities/ratio/ratio.comparison/ratio_greater.pass.cpp b/test/std/utilities/ratio/ratio.comparison/ratio_greater.pass.cpp
index 9182a9ec503c..7f7a74068299 100644
--- a/test/std/utilities/ratio/ratio.comparison/ratio_greater.pass.cpp
+++ b/test/std/utilities/ratio/ratio.comparison/ratio_greater.pass.cpp
@@ -11,46 +11,57 @@
#include <ratio>
+#include "test_macros.h"
+
+template <class Rat1, class Rat2, bool result>
+void test()
+{
+ static_assert((result == std::ratio_greater<Rat1, Rat2>::value), "");
+#if TEST_STD_VER > 14
+ static_assert((result == std::ratio_greater_v<Rat1, Rat2>), "");
+#endif
+}
+
int main()
{
{
typedef std::ratio<1, 1> R1;
typedef std::ratio<1, 1> R2;
- static_assert((!std::ratio_greater<R1, R2>::value), "");
+ test<R1, R2, false>();
}
{
typedef std::ratio<0x7FFFFFFFFFFFFFFFLL, 1> R1;
typedef std::ratio<0x7FFFFFFFFFFFFFFFLL, 1> R2;
- static_assert((!std::ratio_greater<R1, R2>::value), "");
+ test<R1, R2, false>();
}
{
typedef std::ratio<-0x7FFFFFFFFFFFFFFFLL, 1> R1;
typedef std::ratio<-0x7FFFFFFFFFFFFFFFLL, 1> R2;
- static_assert((!std::ratio_greater<R1, R2>::value), "");
+ test<R1, R2, false>();
}
{
typedef std::ratio<1, 0x7FFFFFFFFFFFFFFFLL> R1;
typedef std::ratio<1, 0x7FFFFFFFFFFFFFFFLL> R2;
- static_assert((!std::ratio_greater<R1, R2>::value), "");
+ test<R1, R2, false>();
}
{
typedef std::ratio<1, 1> R1;
typedef std::ratio<1, -1> R2;
- static_assert((std::ratio_greater<R1, R2>::value), "");
+ test<R1, R2, true>();
}
{
typedef std::ratio<0x7FFFFFFFFFFFFFFFLL, 1> R1;
typedef std::ratio<-0x7FFFFFFFFFFFFFFFLL, 1> R2;
- static_assert((std::ratio_greater<R1, R2>::value), "");
+ test<R1, R2, true>();
}
{
typedef std::ratio<-0x7FFFFFFFFFFFFFFFLL, 1> R1;
typedef std::ratio<0x7FFFFFFFFFFFFFFFLL, 1> R2;
- static_assert((!std::ratio_greater<R1, R2>::value), "");
+ test<R1, R2, false>();
}
{
typedef std::ratio<1, 0x7FFFFFFFFFFFFFFFLL> R1;
typedef std::ratio<1, -0x7FFFFFFFFFFFFFFFLL> R2;
- static_assert((std::ratio_greater<R1, R2>::value), "");
+ test<R1, R2, true>();
}
}
diff --git a/test/std/utilities/ratio/ratio.comparison/ratio_greater_equal.pass.cpp b/test/std/utilities/ratio/ratio.comparison/ratio_greater_equal.pass.cpp
index a1f5a185e621..db78557ec4c1 100644
--- a/test/std/utilities/ratio/ratio.comparison/ratio_greater_equal.pass.cpp
+++ b/test/std/utilities/ratio/ratio.comparison/ratio_greater_equal.pass.cpp
@@ -11,46 +11,57 @@
#include <ratio>
+#include "test_macros.h"
+
+template <class Rat1, class Rat2, bool result>
+void test()
+{
+ static_assert((result == std::ratio_greater_equal<Rat1, Rat2>::value), "");
+#if TEST_STD_VER > 14
+ static_assert((result == std::ratio_greater_equal_v<Rat1, Rat2>), "");
+#endif
+}
+
int main()
{
{
typedef std::ratio<1, 1> R1;
typedef std::ratio<1, 1> R2;
- static_assert((std::ratio_greater_equal<R1, R2>::value), "");
+ test<R1, R2, true>();
}
{
typedef std::ratio<0x7FFFFFFFFFFFFFFFLL, 1> R1;
typedef std::ratio<0x7FFFFFFFFFFFFFFFLL, 1> R2;
- static_assert((std::ratio_greater_equal<R1, R2>::value), "");
+ test<R1, R2, true>();
}
{
typedef std::ratio<-0x7FFFFFFFFFFFFFFFLL, 1> R1;
typedef std::ratio<-0x7FFFFFFFFFFFFFFFLL, 1> R2;
- static_assert((std::ratio_greater_equal<R1, R2>::value), "");
+ test<R1, R2, true>();
}
{
typedef std::ratio<1, 0x7FFFFFFFFFFFFFFFLL> R1;
typedef std::ratio<1, 0x7FFFFFFFFFFFFFFFLL> R2;
- static_assert((std::ratio_greater_equal<R1, R2>::value), "");
+ test<R1, R2, true>();
}
{
typedef std::ratio<1, 1> R1;
typedef std::ratio<1, -1> R2;
- static_assert((std::ratio_greater_equal<R1, R2>::value), "");
+ test<R1, R2, true>();
}
{
typedef std::ratio<0x7FFFFFFFFFFFFFFFLL, 1> R1;
typedef std::ratio<-0x7FFFFFFFFFFFFFFFLL, 1> R2;
- static_assert((std::ratio_greater_equal<R1, R2>::value), "");
+ test<R1, R2, true>();
}
{
typedef std::ratio<-0x7FFFFFFFFFFFFFFFLL, 1> R1;
typedef std::ratio<0x7FFFFFFFFFFFFFFFLL, 1> R2;
- static_assert((!std::ratio_greater_equal<R1, R2>::value), "");
+ test<R1, R2, false>();
}
{
typedef std::ratio<1, 0x7FFFFFFFFFFFFFFFLL> R1;
typedef std::ratio<1, -0x7FFFFFFFFFFFFFFFLL> R2;
- static_assert((std::ratio_greater_equal<R1, R2>::value), "");
+ test<R1, R2, true>();
}
}
diff --git a/test/std/utilities/ratio/ratio.comparison/ratio_less.pass.cpp b/test/std/utilities/ratio/ratio.comparison/ratio_less.pass.cpp
index db53ab0ad448..a428be28aa56 100644
--- a/test/std/utilities/ratio/ratio.comparison/ratio_less.pass.cpp
+++ b/test/std/utilities/ratio/ratio.comparison/ratio_less.pass.cpp
@@ -11,76 +11,87 @@
#include <ratio>
+#include "test_macros.h"
+
+template <class Rat1, class Rat2, bool result>
+void test()
+{
+ static_assert((result == std::ratio_less<Rat1, Rat2>::value), "");
+#if TEST_STD_VER > 14
+ static_assert((result == std::ratio_less_v<Rat1, Rat2>), "");
+#endif
+}
+
int main()
{
{
typedef std::ratio<1, 1> R1;
typedef std::ratio<1, 1> R2;
- static_assert((!std::ratio_less<R1, R2>::value), "");
+ test<R1, R2, false>();
}
{
typedef std::ratio<0x7FFFFFFFFFFFFFFFLL, 1> R1;
typedef std::ratio<0x7FFFFFFFFFFFFFFFLL, 1> R2;
- static_assert((!std::ratio_less<R1, R2>::value), "");
+ test<R1, R2, false>();
}
{
typedef std::ratio<-0x7FFFFFFFFFFFFFFFLL, 1> R1;
typedef std::ratio<-0x7FFFFFFFFFFFFFFFLL, 1> R2;
- static_assert((!std::ratio_less<R1, R2>::value), "");
+ test<R1, R2, false>();
}
{
typedef std::ratio<1, 0x7FFFFFFFFFFFFFFFLL> R1;
typedef std::ratio<1, 0x7FFFFFFFFFFFFFFFLL> R2;
- static_assert((!std::ratio_less<R1, R2>::value), "");
+ test<R1, R2, false>();
}
{
typedef std::ratio<1, 1> R1;
typedef std::ratio<1, -1> R2;
- static_assert((!std::ratio_less<R1, R2>::value), "");
+ test<R1, R2, false>();
}
{
typedef std::ratio<0x7FFFFFFFFFFFFFFFLL, 1> R1;
typedef std::ratio<-0x7FFFFFFFFFFFFFFFLL, 1> R2;
- static_assert((!std::ratio_less<R1, R2>::value), "");
+ test<R1, R2, false>();
}
{
typedef std::ratio<-0x7FFFFFFFFFFFFFFFLL, 1> R1;
typedef std::ratio<0x7FFFFFFFFFFFFFFFLL, 1> R2;
- static_assert((std::ratio_less<R1, R2>::value), "");
+ test<R1, R2, true>();
}
{
typedef std::ratio<1, 0x7FFFFFFFFFFFFFFFLL> R1;
typedef std::ratio<1, -0x7FFFFFFFFFFFFFFFLL> R2;
- static_assert((!std::ratio_less<R1, R2>::value), "");
+ test<R1, R2, false>();
}
{
typedef std::ratio<0x7FFFFFFFFFFFFFFFLL, 0x7FFFFFFFFFFFFFFELL> R1;
typedef std::ratio<0x7FFFFFFFFFFFFFFDLL, 0x7FFFFFFFFFFFFFFCLL> R2;
- static_assert((std::ratio_less<R1, R2>::value), "");
+ test<R1, R2, true>();
}
{
typedef std::ratio<0x7FFFFFFFFFFFFFFDLL, 0x7FFFFFFFFFFFFFFCLL> R1;
typedef std::ratio<0x7FFFFFFFFFFFFFFFLL, 0x7FFFFFFFFFFFFFFELL> R2;
- static_assert((!std::ratio_less<R1, R2>::value), "");
+ test<R1, R2, false>();
}
{
typedef std::ratio<-0x7FFFFFFFFFFFFFFDLL, 0x7FFFFFFFFFFFFFFCLL> R1;
typedef std::ratio<-0x7FFFFFFFFFFFFFFFLL, 0x7FFFFFFFFFFFFFFELL> R2;
- static_assert((std::ratio_less<R1, R2>::value), "");
+ test<R1, R2, true>();
}
{
typedef std::ratio<0x7FFFFFFFFFFFFFFFLL, 0x7FFFFFFFFFFFFFFELL> R1;
typedef std::ratio<0x7FFFFFFFFFFFFFFELL, 0x7FFFFFFFFFFFFFFDLL> R2;
- static_assert((std::ratio_less<R1, R2>::value), "");
+ test<R1, R2, true>();
}
{
typedef std::ratio<641981, 1339063> R1;
typedef std::ratio<1291640, 2694141LL> R2;
- static_assert((!std::ratio_less<R1, R2>::value), "");
+ test<R1, R2, false>();
}
{
typedef std::ratio<1291640, 2694141LL> R1;
typedef std::ratio<641981, 1339063> R2;
- static_assert((std::ratio_less<R1, R2>::value), "");
+ test<R1, R2, true>();
}
}
diff --git a/test/std/utilities/ratio/ratio.comparison/ratio_less_equal.pass.cpp b/test/std/utilities/ratio/ratio.comparison/ratio_less_equal.pass.cpp
index 5b148f0e1435..7b224ab7c892 100644
--- a/test/std/utilities/ratio/ratio.comparison/ratio_less_equal.pass.cpp
+++ b/test/std/utilities/ratio/ratio.comparison/ratio_less_equal.pass.cpp
@@ -11,46 +11,57 @@
#include <ratio>
+#include "test_macros.h"
+
+template <class Rat1, class Rat2, bool result>
+void test()
+{
+ static_assert((result == std::ratio_less_equal<Rat1, Rat2>::value), "");
+#if TEST_STD_VER > 14
+ static_assert((result == std::ratio_less_equal_v<Rat1, Rat2>), "");
+#endif
+}
+
int main()
{
{
typedef std::ratio<1, 1> R1;
typedef std::ratio<1, 1> R2;
- static_assert((std::ratio_less_equal<R1, R2>::value), "");
+ test<R1, R2, true>();
}
{
typedef std::ratio<0x7FFFFFFFFFFFFFFFLL, 1> R1;
typedef std::ratio<0x7FFFFFFFFFFFFFFFLL, 1> R2;
- static_assert((std::ratio_less_equal<R1, R2>::value), "");
+ test<R1, R2, true>();
}
{
typedef std::ratio<-0x7FFFFFFFFFFFFFFFLL, 1> R1;
typedef std::ratio<-0x7FFFFFFFFFFFFFFFLL, 1> R2;
- static_assert((std::ratio_less_equal<R1, R2>::value), "");
+ test<R1, R2, true>();
}
{
typedef std::ratio<1, 0x7FFFFFFFFFFFFFFFLL> R1;
typedef std::ratio<1, 0x7FFFFFFFFFFFFFFFLL> R2;
- static_assert((std::ratio_less_equal<R1, R2>::value), "");
+ test<R1, R2, true>();
}
{
typedef std::ratio<1, 1> R1;
typedef std::ratio<1, -1> R2;
- static_assert((!std::ratio_less_equal<R1, R2>::value), "");
+ test<R1, R2, false>();
}
{
typedef std::ratio<0x7FFFFFFFFFFFFFFFLL, 1> R1;
typedef std::ratio<-0x7FFFFFFFFFFFFFFFLL, 1> R2;
- static_assert((!std::ratio_less_equal<R1, R2>::value), "");
+ test<R1, R2, false>();
}
{
typedef std::ratio<-0x7FFFFFFFFFFFFFFFLL, 1> R1;
typedef std::ratio<0x7FFFFFFFFFFFFFFFLL, 1> R2;
- static_assert((std::ratio_less_equal<R1, R2>::value), "");
+ test<R1, R2, true>();
}
{
typedef std::ratio<1, 0x7FFFFFFFFFFFFFFFLL> R1;
typedef std::ratio<1, -0x7FFFFFFFFFFFFFFFLL> R2;
- static_assert((!std::ratio_less_equal<R1, R2>::value), "");
+ test<R1, R2, false>();
}
}
diff --git a/test/std/utilities/ratio/ratio.comparison/ratio_not_equal.pass.cpp b/test/std/utilities/ratio/ratio.comparison/ratio_not_equal.pass.cpp
index ebf930746585..fcd31207fdbf 100644
--- a/test/std/utilities/ratio/ratio.comparison/ratio_not_equal.pass.cpp
+++ b/test/std/utilities/ratio/ratio.comparison/ratio_not_equal.pass.cpp
@@ -11,46 +11,57 @@
#include <ratio>
+#include "test_macros.h"
+
+template <class Rat1, class Rat2, bool result>
+void test()
+{
+ static_assert((result == std::ratio_not_equal<Rat1, Rat2>::value), "");
+#if TEST_STD_VER > 14
+ static_assert((result == std::ratio_not_equal_v<Rat1, Rat2>), "");
+#endif
+}
+
int main()
{
{
typedef std::ratio<1, 1> R1;
typedef std::ratio<1, 1> R2;
- static_assert((!std::ratio_not_equal<R1, R2>::value), "");
+ test<R1, R2, false>();
}
{
typedef std::ratio<0x7FFFFFFFFFFFFFFFLL, 1> R1;
typedef std::ratio<0x7FFFFFFFFFFFFFFFLL, 1> R2;
- static_assert((!std::ratio_not_equal<R1, R2>::value), "");
+ test<R1, R2, false>();
}
{
typedef std::ratio<-0x7FFFFFFFFFFFFFFFLL, 1> R1;
typedef std::ratio<-0x7FFFFFFFFFFFFFFFLL, 1> R2;
- static_assert((!std::ratio_not_equal<R1, R2>::value), "");
+ test<R1, R2, false>();
}
{
typedef std::ratio<1, 0x7FFFFFFFFFFFFFFFLL> R1;
typedef std::ratio<1, 0x7FFFFFFFFFFFFFFFLL> R2;
- static_assert((!std::ratio_not_equal<R1, R2>::value), "");
+ test<R1, R2, false>();
}
{
typedef std::ratio<1, 1> R1;
typedef std::ratio<1, -1> R2;
- static_assert((std::ratio_not_equal<R1, R2>::value), "");
+ test<R1, R2, true>();
}
{
typedef std::ratio<0x7FFFFFFFFFFFFFFFLL, 1> R1;
typedef std::ratio<-0x7FFFFFFFFFFFFFFFLL, 1> R2;
- static_assert((std::ratio_not_equal<R1, R2>::value), "");
+ test<R1, R2, true>();
}
{
typedef std::ratio<-0x7FFFFFFFFFFFFFFFLL, 1> R1;
typedef std::ratio<0x7FFFFFFFFFFFFFFFLL, 1> R2;
- static_assert((std::ratio_not_equal<R1, R2>::value), "");
+ test<R1, R2, true>();
}
{
typedef std::ratio<1, 0x7FFFFFFFFFFFFFFFLL> R1;
typedef std::ratio<1, -0x7FFFFFFFFFFFFFFFLL> R2;
- static_assert((std::ratio_not_equal<R1, R2>::value), "");
+ test<R1, R2, true>();
}
}
diff --git a/test/std/utilities/template.bitset/bitset.cons/char_ptr_ctor.pass.cpp b/test/std/utilities/template.bitset/bitset.cons/char_ptr_ctor.pass.cpp
index 7fe78bad1cc6..9411435e29e8 100644
--- a/test/std/utilities/template.bitset/bitset.cons/char_ptr_ctor.pass.cpp
+++ b/test/std/utilities/template.bitset/bitset.cons/char_ptr_ctor.pass.cpp
@@ -7,6 +7,7 @@
//
//===----------------------------------------------------------------------===//
+// XFAIL: libcpp-no-exceptions
// template <class charT>
// explicit bitset(const charT* str,
// typename basic_string<charT>::size_type n = basic_string<charT>::npos,
@@ -14,6 +15,8 @@
#include <bitset>
#include <cassert>
+#include <algorithm> // for 'min' and 'max'
+#include <stdexcept> // for 'invalid_argument'
#pragma clang diagnostic ignored "-Wtautological-compare"
diff --git a/test/std/utilities/template.bitset/bitset.cons/string_ctor.pass.cpp b/test/std/utilities/template.bitset/bitset.cons/string_ctor.pass.cpp
index bcee50c4c63a..b08720f57ee3 100644
--- a/test/std/utilities/template.bitset/bitset.cons/string_ctor.pass.cpp
+++ b/test/std/utilities/template.bitset/bitset.cons/string_ctor.pass.cpp
@@ -7,10 +7,13 @@
//
//===----------------------------------------------------------------------===//
+// XFAIL: libcpp-no-exceptions
// test bitset(string, pos, n, zero, one);
#include <bitset>
#include <cassert>
+#include <algorithm> // for 'min' and 'max'
+#include <stdexcept> // for 'invalid_argument'
#pragma clang diagnostic ignored "-Wtautological-compare"
diff --git a/test/std/utilities/template.bitset/bitset.cons/ull_ctor.pass.cpp b/test/std/utilities/template.bitset/bitset.cons/ull_ctor.pass.cpp
index 023fedc25839..f232447e08c3 100644
--- a/test/std/utilities/template.bitset/bitset.cons/ull_ctor.pass.cpp
+++ b/test/std/utilities/template.bitset/bitset.cons/ull_ctor.pass.cpp
@@ -11,6 +11,7 @@
#include <bitset>
#include <cassert>
+#include <algorithm> // for 'min' and 'max'
#pragma clang diagnostic ignored "-Wtautological-compare"
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 3e09b202097d..cffca68fb1ea 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
@@ -7,6 +7,7 @@
//
//===----------------------------------------------------------------------===//
+// XFAIL: libcpp-no-exceptions
// test bitset<N>& flip(size_t pos);
#include <bitset>
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 ebaa9e7a8d72..6de256b00cc5 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
@@ -7,6 +7,7 @@
//
//===----------------------------------------------------------------------===//
+// XFAIL: libcpp-no-exceptions
// test bitset<N>& reset(size_t pos);
#include <bitset>
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 116eaf3f46e0..debe5431d8d0 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
@@ -7,6 +7,7 @@
//
//===----------------------------------------------------------------------===//
+// XFAIL: libcpp-no-exceptions
// test bitset<N>& set(size_t pos, bool val = true);
#include <bitset>
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 5102b46171a2..ce594d0ae891 100644
--- a/test/std/utilities/template.bitset/bitset.members/test.pass.cpp
+++ b/test/std/utilities/template.bitset/bitset.members/test.pass.cpp
@@ -7,6 +7,7 @@
//
//===----------------------------------------------------------------------===//
+// XFAIL: libcpp-no-exceptions
// test constexpr bool test(size_t pos) const;
#include <bitset>
diff --git a/test/std/utilities/date.time/tested_elsewhere.pass.cpp b/test/std/utilities/time/date.time/ctime.pass.cpp
index 419f415dee19..d0a838e0c271 100644
--- a/test/std/utilities/date.time/tested_elsewhere.pass.cpp
+++ b/test/std/utilities/time/date.time/ctime.pass.cpp
@@ -30,9 +30,11 @@ 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), "");
+#ifndef _LIBCPP_HAS_NO_THREAD_UNSAFE_C_FUNCTIONS
static_assert((std::is_same<decltype(std::asctime(&tm)), char*>::value), "");
static_assert((std::is_same<decltype(std::ctime(&t)), char*>::value), "");
static_assert((std::is_same<decltype(std::gmtime(&t)), std::tm*>::value), "");
static_assert((std::is_same<decltype(std::localtime(&t)), std::tm*>::value), "");
+#endif
static_assert((std::is_same<decltype(std::strftime(str,s,"",&tm)), std::size_t>::value), "");
}
diff --git a/test/std/utilities/time/time.duration/time.duration.alg/abs.fail.cpp b/test/std/utilities/time/time.duration/time.duration.alg/abs.fail.cpp
new file mode 100644
index 000000000000..221004c568ce
--- /dev/null
+++ b/test/std/utilities/time/time.duration/time.duration.alg/abs.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++03, c++11, c++14
+// <chrono>
+
+// ceil
+
+// template <class Rep, class Period>
+// constexpr duration<Rep, Period> abs(duration<Rep, Period> d)
+
+// This function shall not participate in overload resolution unless numeric_limits<Rep>::is_signed is true.
+
+#include <chrono>
+
+typedef std::chrono::duration<unsigned> unsigned_secs;
+
+int main()
+{
+ std::chrono::abs(unsigned_secs(0));
+}
diff --git a/test/std/utilities/time/time.duration/time.duration.alg/abs.pass.cpp b/test/std/utilities/time/time.duration/time.duration.alg/abs.pass.cpp
new file mode 100644
index 000000000000..ec32c37a9423
--- /dev/null
+++ b/test/std/utilities/time/time.duration/time.duration.alg/abs.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++03, c++11, c++14
+
+// <chrono>
+
+// abs
+
+// template <class Rep, class Period>
+// constexpr duration<Rep, Period> abs(duration<Rep, Period> d)
+
+#include <chrono>
+#include <type_traits>
+#include <cassert>
+
+template <class Duration>
+void
+test(const Duration& f, const Duration& d)
+{
+ {
+ typedef decltype(std::chrono::abs(f)) R;
+ static_assert((std::is_same<R, Duration>::value), "");
+ assert(std::chrono::abs(f) == d);
+ }
+}
+
+int main()
+{
+// 7290000ms is 2 hours, 1 minute, and 30 seconds
+ test(std::chrono::milliseconds( 7290000), std::chrono::milliseconds( 7290000));
+ test(std::chrono::milliseconds(-7290000), std::chrono::milliseconds( 7290000));
+ test(std::chrono::minutes( 122), std::chrono::minutes( 122));
+ test(std::chrono::minutes(-122), std::chrono::minutes( 122));
+ test(std::chrono::hours(0), std::chrono::hours(0));
+
+ {
+// 9000000ms is 2 hours and 30 minutes
+ constexpr std::chrono::hours h1 = std::chrono::abs(std::chrono::hours(-3));
+ static_assert(h1.count() == 3, "");
+ constexpr std::chrono::hours h2 = std::chrono::abs(std::chrono::hours(3));
+ static_assert(h2.count() == 3, "");
+ }
+}
diff --git a/test/std/utilities/time/time.duration/time.duration.cast/ceil.fail.cpp b/test/std/utilities/time/time.duration/time.duration.cast/ceil.fail.cpp
new file mode 100644
index 000000000000..909e8573247c
--- /dev/null
+++ b/test/std/utilities/time/time.duration/time.duration.cast/ceil.fail.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++03, c++11, c++14
+// <chrono>
+
+// ceil
+
+// template <class ToDuration, class Rep, class Period>
+// ToDuration
+// ceil(const duration<Rep, Period>& d);
+
+// ToDuration shall be an instantiation of duration.
+
+#include <chrono>
+
+int main()
+{
+ std::chrono::ceil<int>(std::chrono::milliseconds(3));
+}
diff --git a/test/std/utilities/time/time.duration/time.duration.cast/ceil.pass.cpp b/test/std/utilities/time/time.duration/time.duration.cast/ceil.pass.cpp
new file mode 100644
index 000000000000..6fb73b97db17
--- /dev/null
+++ b/test/std/utilities/time/time.duration/time.duration.cast/ceil.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, c++11, c++14
+
+// <chrono>
+
+// ceil
+
+// template <class ToDuration, class Rep, class Period>
+// constexpr
+// ToDuration
+// ceil(const duration<Rep, Period>& d);
+
+#include <chrono>
+#include <type_traits>
+#include <cassert>
+
+template <class ToDuration, class FromDuration>
+void
+test(const FromDuration& f, const ToDuration& d)
+{
+ {
+ typedef decltype(std::chrono::ceil<ToDuration>(f)) R;
+ static_assert((std::is_same<R, ToDuration>::value), "");
+ assert(std::chrono::ceil<ToDuration>(f) == d);
+ }
+}
+
+int main()
+{
+// 7290000ms is 2 hours, 1 minute, and 30 seconds
+ test(std::chrono::milliseconds( 7290000), std::chrono::hours( 3));
+ test(std::chrono::milliseconds(-7290000), std::chrono::hours(-2));
+ test(std::chrono::milliseconds( 7290000), std::chrono::minutes( 122));
+ test(std::chrono::milliseconds(-7290000), std::chrono::minutes(-121));
+
+ {
+// 9000000ms is 2 hours and 30 minutes
+ constexpr std::chrono::hours h1 = std::chrono::ceil<std::chrono::hours>(std::chrono::milliseconds(9000000));
+ static_assert(h1.count() == 3, "");
+ constexpr std::chrono::hours h2 = std::chrono::ceil<std::chrono::hours>(std::chrono::milliseconds(-9000000));
+ static_assert(h2.count() == -2, "");
+ }
+}
diff --git a/test/std/utilities/time/time.duration/time.duration.cast/floor.fail.cpp b/test/std/utilities/time/time.duration/time.duration.cast/floor.fail.cpp
new file mode 100644
index 000000000000..14d9ca878df8
--- /dev/null
+++ b/test/std/utilities/time/time.duration/time.duration.cast/floor.fail.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++03, c++11, c++14
+// <chrono>
+
+// floor
+
+// template <class ToDuration, class Rep, class Period>
+// ToDuration
+// floor(const duration<Rep, Period>& d);
+
+// ToDuration shall be an instantiation of duration.
+
+#include <chrono>
+
+int main()
+{
+ std::chrono::floor<int>(std::chrono::milliseconds(3));
+}
diff --git a/test/std/utilities/time/time.duration/time.duration.cast/floor.pass.cpp b/test/std/utilities/time/time.duration/time.duration.cast/floor.pass.cpp
new file mode 100644
index 000000000000..57929dd91228
--- /dev/null
+++ b/test/std/utilities/time/time.duration/time.duration.cast/floor.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++03, c++11, c++14
+// <chrono>
+
+// floor
+
+// template <class ToDuration, class Rep, class Period>
+// constexpr
+// ToDuration
+// floor(const duration<Rep, Period>& d);
+
+#include <chrono>
+#include <type_traits>
+#include <cassert>
+
+template <class ToDuration, class FromDuration>
+void
+test(const FromDuration& f, const ToDuration& d)
+{
+ {
+ typedef decltype(std::chrono::floor<ToDuration>(f)) R;
+ static_assert((std::is_same<R, ToDuration>::value), "");
+ assert(std::chrono::floor<ToDuration>(f) == d);
+ }
+}
+
+int main()
+{
+// 7290000ms is 2 hours, 1 minute, and 30 seconds
+ test(std::chrono::milliseconds( 7290000), std::chrono::hours( 2));
+ test(std::chrono::milliseconds(-7290000), std::chrono::hours(-3));
+ test(std::chrono::milliseconds( 7290000), std::chrono::minutes( 121));
+ test(std::chrono::milliseconds(-7290000), std::chrono::minutes(-122));
+
+ {
+// 9000000ms is 2 hours and 30 minutes
+ constexpr std::chrono::hours h1 = std::chrono::floor<std::chrono::hours>(std::chrono::milliseconds(9000000));
+ static_assert(h1.count() == 2, "");
+ constexpr std::chrono::hours h2 = std::chrono::floor<std::chrono::hours>(std::chrono::milliseconds(-9000000));
+ static_assert(h2.count() == -3, "");
+ }
+}
diff --git a/test/std/utilities/time/time.duration/time.duration.cast/round.fail.cpp b/test/std/utilities/time/time.duration/time.duration.cast/round.fail.cpp
new file mode 100644
index 000000000000..6f9f5bd29b63
--- /dev/null
+++ b/test/std/utilities/time/time.duration/time.duration.cast/round.fail.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++03, c++11, c++14
+// <chrono>
+
+// round
+
+// template <class ToDuration, class Rep, class Period>
+// ToDuration
+// round(const duration<Rep, Period>& d);
+
+// ToDuration shall be an instantiation of duration.
+
+#include <chrono>
+
+int main()
+{
+ std::chrono::round<int>(std::chrono::milliseconds(3));
+}
diff --git a/test/std/utilities/time/time.duration/time.duration.cast/round.pass.cpp b/test/std/utilities/time/time.duration/time.duration.cast/round.pass.cpp
new file mode 100644
index 000000000000..e50b85c991a2
--- /dev/null
+++ b/test/std/utilities/time/time.duration/time.duration.cast/round.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++03, c++11, c++14
+// <chrono>
+
+// round
+
+// template <class ToDuration, class Rep, class Period>
+// constexpr
+// ToDuration
+// ceil(const duration<Rep, Period>& d);
+
+#include <chrono>
+#include <type_traits>
+#include <cassert>
+
+template <class ToDuration, class FromDuration>
+void
+test(const FromDuration& f, const ToDuration& d)
+{
+ {
+ typedef decltype(std::chrono::round<ToDuration>(f)) R;
+ static_assert((std::is_same<R, ToDuration>::value), "");
+ assert(std::chrono::round<ToDuration>(f) == d);
+ }
+}
+
+int main()
+{
+// 7290000ms is 2 hours, 1 minute, and 30 seconds
+ test(std::chrono::milliseconds( 7290000), std::chrono::hours( 2));
+ test(std::chrono::milliseconds(-7290000), std::chrono::hours(-2));
+ test(std::chrono::milliseconds( 7290000), std::chrono::minutes( 122));
+ test(std::chrono::milliseconds(-7290000), std::chrono::minutes(-122));
+
+ {
+// 9000000ms is 2 hours and 30 minutes
+ constexpr std::chrono::hours h1 = std::chrono::round<std::chrono::hours>(std::chrono::milliseconds(9000000));
+ static_assert(h1.count() == 2, "");
+ constexpr std::chrono::hours h2 = std::chrono::round<std::chrono::hours>(std::chrono::milliseconds(-9000000));
+ static_assert(h2.count() == -2, "");
+ }
+}
diff --git a/test/std/utilities/time/time.point/time.point.cast/ceil.fail.cpp b/test/std/utilities/time/time.point/time.point.cast/ceil.fail.cpp
new file mode 100644
index 000000000000..1c92d75b97ca
--- /dev/null
+++ b/test/std/utilities/time/time.point/time.point.cast/ceil.fail.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++03, c++11, c++14
+// <chrono>
+
+// ceil
+
+// template <class ToDuration, class Clock, class Duration>
+// time_point<Clock, ToDuration>
+// ceil(const time_point<Clock, Duration>& t);
+
+// ToDuration shall be an instantiation of duration.
+
+#include <chrono>
+
+int main()
+{
+ std::chrono::ceil<int>(std::chrono::system_clock::now());
+}
diff --git a/test/std/utilities/time/time.point/time.point.cast/ceil.pass.cpp b/test/std/utilities/time/time.point/time.point.cast/ceil.pass.cpp
new file mode 100644
index 000000000000..379929c7f2d8
--- /dev/null
+++ b/test/std/utilities/time/time.point/time.point.cast/ceil.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++03, c++11, c++14
+// <chrono>
+
+// ceil
+
+// template <class ToDuration, class Clock, class Duration>
+// time_point<Clock, ToDuration>
+// ceil(const time_point<Clock, Duration>& t);
+
+#include <chrono>
+#include <type_traits>
+#include <cassert>
+
+template <class FromDuration, class ToDuration>
+void
+test(const FromDuration& df, const ToDuration& d)
+{
+ typedef std::chrono::system_clock Clock;
+ typedef std::chrono::time_point<Clock, FromDuration> FromTimePoint;
+ typedef std::chrono::time_point<Clock, ToDuration> ToTimePoint;
+ {
+ FromTimePoint f(df);
+ ToTimePoint t(d);
+ typedef decltype(std::chrono::ceil<ToDuration>(f)) R;
+ static_assert((std::is_same<R, ToTimePoint>::value), "");
+ assert(std::chrono::ceil<ToDuration>(f) == t);
+ }
+}
+
+template<class FromDuration, long long From, class ToDuration, long long To>
+void test_constexpr ()
+{
+ typedef std::chrono::system_clock Clock;
+ typedef std::chrono::time_point<Clock, FromDuration> FromTimePoint;
+ typedef std::chrono::time_point<Clock, ToDuration> ToTimePoint;
+ {
+ constexpr FromTimePoint f{FromDuration{From}};
+ constexpr ToTimePoint t{ToDuration{To}};
+ static_assert(std::chrono::ceil<ToDuration>(f) == t, "");
+ }
+}
+
+
+int main()
+{
+// 7290000ms is 2 hours, 1 minute, and 30 seconds
+ test(std::chrono::milliseconds( 7290000), std::chrono::hours( 3));
+ test(std::chrono::milliseconds(-7290000), std::chrono::hours(-2));
+ test(std::chrono::milliseconds( 7290000), std::chrono::minutes( 122));
+ test(std::chrono::milliseconds(-7290000), std::chrono::minutes(-121));
+
+// 9000000ms is 2 hours and 30 minutes
+ test_constexpr<std::chrono::milliseconds, 9000000, std::chrono::hours, 3> ();
+ test_constexpr<std::chrono::milliseconds,-9000000, std::chrono::hours, -2> ();
+ test_constexpr<std::chrono::milliseconds, 9000001, std::chrono::minutes, 151> ();
+ test_constexpr<std::chrono::milliseconds,-9000001, std::chrono::minutes,-150> ();
+
+ test_constexpr<std::chrono::milliseconds, 9000000, std::chrono::seconds, 9000> ();
+ test_constexpr<std::chrono::milliseconds,-9000000, std::chrono::seconds,-9000> ();
+}
diff --git a/test/std/utilities/time/time.point/time.point.cast/floor.fail.cpp b/test/std/utilities/time/time.point/time.point.cast/floor.fail.cpp
new file mode 100644
index 000000000000..ea48e1219e34
--- /dev/null
+++ b/test/std/utilities/time/time.point/time.point.cast/floor.fail.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++03, c++11, c++14
+// <chrono>
+
+// floor
+
+// template <class ToDuration, class Clock, class Duration>
+// time_point<Clock, ToDuration>
+// floor(const time_point<Clock, Duration>& t);
+
+// ToDuration shall be an instantiation of duration.
+
+#include <chrono>
+
+int main()
+{
+ std::chrono::floor<int>(std::chrono::system_clock::now());
+}
diff --git a/test/std/utilities/time/time.point/time.point.cast/floor.pass.cpp b/test/std/utilities/time/time.point/time.point.cast/floor.pass.cpp
new file mode 100644
index 000000000000..d0a908fa932a
--- /dev/null
+++ b/test/std/utilities/time/time.point/time.point.cast/floor.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++03, c++11, c++14
+// <chrono>
+
+// floor
+
+// template <class ToDuration, class Clock, class Duration>
+// time_point<Clock, ToDuration>
+// floor(const time_point<Clock, Duration>& t);
+
+#include <chrono>
+#include <type_traits>
+#include <cassert>
+
+template <class FromDuration, class ToDuration>
+void
+test(const FromDuration& df, const ToDuration& d)
+{
+ typedef std::chrono::system_clock Clock;
+ typedef std::chrono::time_point<Clock, FromDuration> FromTimePoint;
+ typedef std::chrono::time_point<Clock, ToDuration> ToTimePoint;
+ {
+ FromTimePoint f(df);
+ ToTimePoint t(d);
+ typedef decltype(std::chrono::floor<ToDuration>(f)) R;
+ static_assert((std::is_same<R, ToTimePoint>::value), "");
+ assert(std::chrono::floor<ToDuration>(f) == t);
+ }
+}
+
+template<class FromDuration, long long From, class ToDuration, long long To>
+void test_constexpr ()
+{
+ typedef std::chrono::system_clock Clock;
+ typedef std::chrono::time_point<Clock, FromDuration> FromTimePoint;
+ typedef std::chrono::time_point<Clock, ToDuration> ToTimePoint;
+ {
+ constexpr FromTimePoint f{FromDuration{From}};
+ constexpr ToTimePoint t{ToDuration{To}};
+ static_assert(std::chrono::floor<ToDuration>(f) == t, "");
+ }
+}
+
+int main()
+{
+// 7290000ms is 2 hours, 1 minute, and 30 seconds
+ test(std::chrono::milliseconds( 7290000), std::chrono::hours( 2));
+ test(std::chrono::milliseconds(-7290000), std::chrono::hours(-3));
+ test(std::chrono::milliseconds( 7290000), std::chrono::minutes( 121));
+ test(std::chrono::milliseconds(-7290000), std::chrono::minutes(-122));
+
+// 9000000ms is 2 hours and 30 minutes
+ test_constexpr<std::chrono::milliseconds, 9000000, std::chrono::hours, 2> ();
+ test_constexpr<std::chrono::milliseconds,-9000000, std::chrono::hours, -3> ();
+ test_constexpr<std::chrono::milliseconds, 9000001, std::chrono::minutes, 150> ();
+ test_constexpr<std::chrono::milliseconds,-9000001, std::chrono::minutes,-151> ();
+
+ test_constexpr<std::chrono::milliseconds, 9000000, std::chrono::seconds, 9000> ();
+ test_constexpr<std::chrono::milliseconds,-9000000, std::chrono::seconds,-9000> ();
+}
diff --git a/test/std/utilities/time/time.point/time.point.cast/round.fail.cpp b/test/std/utilities/time/time.point/time.point.cast/round.fail.cpp
new file mode 100644
index 000000000000..53c14f47de69
--- /dev/null
+++ b/test/std/utilities/time/time.point/time.point.cast/round.fail.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++03, c++11, c++14
+// <chrono>
+
+// round
+
+// template <class ToDuration, class Clock, class Duration>
+// time_point<Clock, ToDuration>
+// round(const time_point<Clock, Duration>& t);
+
+// ToDuration shall be an instantiation of duration.
+
+#include <chrono>
+
+int main()
+{
+ std::chrono::round<int>(std::chrono::system_clock::now());
+}
diff --git a/test/std/utilities/time/time.point/time.point.cast/round.pass.cpp b/test/std/utilities/time/time.point/time.point.cast/round.pass.cpp
new file mode 100644
index 000000000000..ab8bf3a75e79
--- /dev/null
+++ b/test/std/utilities/time/time.point/time.point.cast/round.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++03, c++11, c++14
+// <chrono>
+
+// round
+
+// template <class ToDuration, class Clock, class Duration>
+// time_point<Clock, ToDuration>
+// round(const time_point<Clock, Duration>& t);
+
+#include <chrono>
+#include <type_traits>
+#include <cassert>
+
+template <class FromDuration, class ToDuration>
+void
+test(const FromDuration& df, const ToDuration& d)
+{
+ typedef std::chrono::system_clock Clock;
+ typedef std::chrono::time_point<Clock, FromDuration> FromTimePoint;
+ typedef std::chrono::time_point<Clock, ToDuration> ToTimePoint;
+ {
+ FromTimePoint f(df);
+ ToTimePoint t(d);
+ typedef decltype(std::chrono::round<ToDuration>(f)) R;
+ static_assert((std::is_same<R, ToTimePoint>::value), "");
+ assert(std::chrono::round<ToDuration>(f) == t);
+ }
+}
+
+template<class FromDuration, long long From, class ToDuration, long long To>
+void test_constexpr ()
+{
+ typedef std::chrono::system_clock Clock;
+ typedef std::chrono::time_point<Clock, FromDuration> FromTimePoint;
+ typedef std::chrono::time_point<Clock, ToDuration> ToTimePoint;
+ {
+ constexpr FromTimePoint f{FromDuration{From}};
+ constexpr ToTimePoint t{ToDuration{To}};
+ static_assert(std::chrono::round<ToDuration>(f) == t, "");
+ }
+}
+
+int main()
+{
+// 7290000ms is 2 hours, 1 minute, and 30 seconds
+ test(std::chrono::milliseconds( 7290000), std::chrono::hours( 2));
+ test(std::chrono::milliseconds(-7290000), std::chrono::hours(-2));
+ test(std::chrono::milliseconds( 7290000), std::chrono::minutes( 122));
+ test(std::chrono::milliseconds(-7290000), std::chrono::minutes(-122));
+
+// 9000000ms is 2 hours and 30 minutes
+ test_constexpr<std::chrono::milliseconds, 9000000, std::chrono::hours, 2> ();
+ test_constexpr<std::chrono::milliseconds,-9000000, std::chrono::hours, -2> ();
+ test_constexpr<std::chrono::milliseconds, 9000001, std::chrono::minutes, 150> ();
+ test_constexpr<std::chrono::milliseconds,-9000001, std::chrono::minutes,-150> ();
+
+ test_constexpr<std::chrono::milliseconds, 9000000, std::chrono::seconds, 9000> ();
+ test_constexpr<std::chrono::milliseconds,-9000000, std::chrono::seconds,-9000> ();
+}
diff --git a/test/std/utilities/time/time.traits/time.traits.is_fp/treat_as_floating_point.pass.cpp b/test/std/utilities/time/time.traits/time.traits.is_fp/treat_as_floating_point.pass.cpp
index c32350faa83b..f9ddc87a7a14 100644
--- a/test/std/utilities/time/time.traits/time.traits.is_fp/treat_as_floating_point.pass.cpp
+++ b/test/std/utilities/time/time.traits/time.traits.is_fp/treat_as_floating_point.pass.cpp
@@ -20,6 +20,10 @@ test()
{
static_assert((std::is_base_of<std::is_floating_point<T>,
std::chrono::treat_as_floating_point<T> >::value), "");
+#if TEST_STD_VER > 14
+ static_assert((std::is_base_of<std::is_floating_point<T>,
+ std::chrono::treat_as_floating_point_v<T> >), "");
+#endif
}
struct A {};
diff --git a/test/std/utilities/tuple/tuple.tuple/tuple.elem/get_const_rv.fail.cpp b/test/std/utilities/tuple/tuple.tuple/tuple.elem/get_const_rv.fail.cpp
new file mode 100644
index 000000000000..58df2df7679a
--- /dev/null
+++ b/test/std/utilities/tuple/tuple.tuple/tuple.elem/get_const_rv.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <tuple>
+
+// template <class... Types> class tuple;
+
+// template <size_t I, class... Types>
+// const typename tuple_element<I, tuple<Types...> >::type&&
+// get(const tuple<Types...>&& t);
+
+// UNSUPPORTED: c++98, c++03
+
+#include <tuple>
+
+template <class T> void cref(T const&) {};
+template <class T> void cref(T const&&) = delete;
+
+std::tuple<int> const tup4() { return std::make_tuple(4); }
+
+int main()
+{
+ // LWG2485: tuple should not open a hole in the type system, get() should
+ // imitate [expr.ref]'s rules for accessing data members
+ {
+ cref(std::get<0>(tup4())); // expected-error {{call to deleted function 'cref'}}
+ }
+}
diff --git a/test/std/utilities/tuple/tuple.tuple/tuple.elem/get_const_rv.pass.cpp b/test/std/utilities/tuple/tuple.tuple/tuple.elem/get_const_rv.pass.cpp
new file mode 100644
index 000000000000..720a9064015d
--- /dev/null
+++ b/test/std/utilities/tuple/tuple.tuple/tuple.elem/get_const_rv.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <tuple>
+
+// template <class... Types> class tuple;
+
+// template <size_t I, class... Types>
+// const typename tuple_element<I, tuple<Types...> >::type&&
+// get(const tuple<Types...>&& t);
+
+// UNSUPPORTED: c++98, c++03
+
+#include <tuple>
+#include <utility>
+#include <string>
+#include <type_traits>
+#include <cassert>
+
+#include "test_macros.h"
+
+int main()
+{
+ {
+ typedef std::tuple<int> T;
+ const T t(3);
+ static_assert(std::is_same<const int&&, decltype(std::get<0>(std::move(t)))>::value, "");
+ static_assert(noexcept(std::get<0>(std::move(t))), "");
+ const int&& i = std::get<0>(std::move(t));
+ assert(i == 3);
+ }
+
+ {
+ typedef std::tuple<std::string, int> T;
+ const T t("high", 5);
+ static_assert(std::is_same<const std::string&&, decltype(std::get<0>(std::move(t)))>::value, "");
+ static_assert(noexcept(std::get<0>(std::move(t))), "");
+ static_assert(std::is_same<const int&&, decltype(std::get<1>(std::move(t)))>::value, "");
+ static_assert(noexcept(std::get<1>(std::move(t))), "");
+ const std::string&& s = std::get<0>(std::move(t));
+ const int&& i = std::get<1>(std::move(t));
+ assert(s == "high");
+ assert(i == 5);
+ }
+
+ {
+ int x = 42;
+ int const y = 43;
+ std::tuple<int&, int const&> const p(x, y);
+ static_assert(std::is_same<int&, decltype(std::get<0>(std::move(p)))>::value, "");
+ static_assert(noexcept(std::get<0>(std::move(p))), "");
+ static_assert(std::is_same<int const&, decltype(std::get<1>(std::move(p)))>::value, "");
+ static_assert(noexcept(std::get<1>(std::move(p))), "");
+ }
+
+ {
+ int x = 42;
+ int const y = 43;
+ std::tuple<int&&, int const&&> const p(std::move(x), std::move(y));
+ static_assert(std::is_same<int&&, decltype(std::get<0>(std::move(p)))>::value, "");
+ static_assert(noexcept(std::get<0>(std::move(p))), "");
+ static_assert(std::is_same<int const&&, decltype(std::get<1>(std::move(p)))>::value, "");
+ static_assert(noexcept(std::get<1>(std::move(p))), "");
+ }
+
+#if TEST_STD_VER > 11
+ {
+ typedef std::tuple<double, int> T;
+ constexpr const T t(2.718, 5);
+ static_assert(std::get<0>(std::move(t)) == 2.718, "");
+ static_assert(std::get<1>(std::move(t)) == 5, "");
+ }
+#endif
+}
diff --git a/test/std/utilities/tuple/tuple.tuple/tuple.elem/tuple.by.type.pass.cpp b/test/std/utilities/tuple/tuple.tuple/tuple.elem/tuple.by.type.pass.cpp
index aa020dab47c7..b661a78de8db 100644
--- a/test/std/utilities/tuple/tuple.tuple/tuple.elem/tuple.by.type.pass.cpp
+++ b/test/std/utilities/tuple/tuple.tuple/tuple.elem/tuple.by.type.pass.cpp
@@ -10,30 +10,31 @@
// UNSUPPORTED: c++98, c++03, c++11
#include <tuple>
+#include <utility>
#include <string>
#include <complex>
+#include <type_traits>
#include <cassert>
int main()
{
-#if _LIBCPP_STD_VER > 11
typedef std::complex<float> cf;
{
auto t1 = std::tuple<int, std::string, cf> { 42, "Hi", { 1,2 }};
- assert ( std::get<int>(t1) == 42 ); // find at the beginning
+ assert ( std::get<int>(t1) == 42 ); // find at the beginning
assert ( std::get<std::string>(t1) == "Hi" ); // find in the middle
assert ( std::get<cf>(t1).real() == 1 ); // find at the end
assert ( std::get<cf>(t1).imag() == 2 );
}
-
+
{
auto t2 = std::tuple<int, std::string, int, cf> { 42, "Hi", 23, { 1,2 }};
// get<int> would fail!
assert ( std::get<std::string>(t2) == "Hi" );
assert (( std::get<cf>(t2) == cf{ 1,2 } ));
}
-
+
{
constexpr std::tuple<int, const int, double, double> p5 { 1, 2, 3.4, 5.6 };
static_assert ( std::get<int>(p5) == 1, "" );
@@ -53,8 +54,40 @@ int main()
std::tuple<upint> t(upint(new int(4)));
upint p = std::get<upint>(std::move(t)); // get rvalue
assert(*p == 4);
- assert(std::get<0>(t) == nullptr); // has been moved from
+ assert(std::get<upint>(t) == nullptr); // has been moved from
+ }
+
+ {
+ typedef std::unique_ptr<int> upint;
+ const std::tuple<upint> t(upint(new int(4)));
+ const upint&& p = std::get<upint>(std::move(t)); // get const rvalue
+ assert(*p == 4);
+ assert(std::get<upint>(t) != nullptr);
}
-#endif
+ {
+ int x = 42;
+ int y = 43;
+ std::tuple<int&, int const&> const t(x, y);
+ static_assert(std::is_same<int&, decltype(std::get<int&>(std::move(t)))>::value, "");
+ static_assert(noexcept(std::get<int&>(std::move(t))), "");
+ static_assert(std::is_same<int const&, decltype(std::get<int const&>(std::move(t)))>::value, "");
+ static_assert(noexcept(std::get<int const&>(std::move(t))), "");
+ }
+
+ {
+ int x = 42;
+ int y = 43;
+ std::tuple<int&&, int const&&> const t(std::move(x), std::move(y));
+ static_assert(std::is_same<int&&, decltype(std::get<int&&>(std::move(t)))>::value, "");
+ static_assert(noexcept(std::get<int&&>(std::move(t))), "");
+ static_assert(std::is_same<int const&&, decltype(std::get<int const&&>(std::move(t)))>::value, "");
+ static_assert(noexcept(std::get<int const&&>(std::move(t))), "");
+ }
+
+ {
+ constexpr const std::tuple<int, const int, double, double> t { 1, 2, 3.4, 5.6 };
+ static_assert(std::get<int>(std::move(t)) == 1, "");
+ static_assert(std::get<const int>(std::move(t)) == 2, "");
+ }
}
diff --git a/test/std/utilities/utility/as_const/as_const.fail.cpp b/test/std/utilities/utility/as_const/as_const.fail.cpp
new file mode 100644
index 000000000000..6334e1460259
--- /dev/null
+++ b/test/std/utilities/utility/as_const/as_const.fail.cpp
@@ -0,0 +1,22 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file 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
+
+// template <class T> constexpr add_const<T>& as_const(T& t) noexcept; // C++17
+// template <class T> add_const<T>& as_const(const T&&) = delete; // C++17
+
+#include <utility>
+
+struct S {int i;};
+
+int main()
+{
+ std::as_const(S{});
+}
diff --git a/test/std/utilities/utility/as_const/as_const.pass.cpp b/test/std/utilities/utility/as_const/as_const.pass.cpp
new file mode 100644
index 000000000000..ff3f84a5532f
--- /dev/null
+++ b/test/std/utilities/utility/as_const/as_const.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
+
+// template <class T> constexpr add_const<T>& as_const(T& t) noexcept; // C++17
+// template <class T> add_const<T>& as_const(const T&&) = delete; // C++17
+
+#include <utility>
+#include <cassert>
+
+struct S {int i;};
+bool operator==(const S& x, const S& y) { return x.i == y.i; }
+bool operator==(const volatile S& x, const volatile S& y) { return x.i == y.i; }
+
+template<typename T>
+void test(T& t)
+{
+ static_assert(std::is_const<typename std::remove_reference<decltype(std::as_const (t))>::type>::value, "");
+ static_assert(std::is_const<typename std::remove_reference<decltype(std::as_const< T>(t))>::type>::value, "");
+ static_assert(std::is_const<typename std::remove_reference<decltype(std::as_const<const T>(t))>::type>::value, "");
+ static_assert(std::is_const<typename std::remove_reference<decltype(std::as_const<volatile T>(t))>::type>::value, "");
+ static_assert(std::is_const<typename std::remove_reference<decltype(std::as_const<const volatile T>(t))>::type>::value, "");
+
+ assert(std::as_const(t) == t);
+ assert(std::as_const< T>(t) == t);
+ assert(std::as_const<const T>(t) == t);
+ assert(std::as_const<volatile T>(t) == t);
+ assert(std::as_const<const volatile T>(t) == t);
+}
+
+int main()
+{
+ int i = 3;
+ double d = 4.0;
+ S s{2};
+ test(i);
+ test(d);
+ test(s);
+}
diff --git a/test/std/utilities/utility/declval/declval.pass.cpp b/test/std/utilities/utility/declval/declval.pass.cpp
index 81f4df8e8b2b..aabd0e6f6c74 100644
--- a/test/std/utilities/utility/declval/declval.pass.cpp
+++ b/test/std/utilities/utility/declval/declval.pass.cpp
@@ -14,6 +14,8 @@
#include <utility>
#include <type_traits>
+#include "test_macros.h"
+
class A
{
A(const A&);
@@ -22,9 +24,9 @@ class A
int main()
{
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+#if TEST_STD_VER >= 11
static_assert((std::is_same<decltype(std::declval<A>()), A&&>::value), "");
#else
- static_assert((std::is_same<decltype(std::declval<A>()), A>::value), "");
+ static_assert((std::is_same<decltype(std::declval<A>()), A&>::value), "");
#endif
}
diff --git a/test/std/utilities/utility/forward/move_if_noexcept.pass.cpp b/test/std/utilities/utility/forward/move_if_noexcept.pass.cpp
index c8375e9d7238..bc60d3d27614 100644
--- a/test/std/utilities/utility/forward/move_if_noexcept.pass.cpp
+++ b/test/std/utilities/utility/forward/move_if_noexcept.pass.cpp
@@ -56,13 +56,14 @@ int main()
static_assert((std::is_same<decltype(std::move_if_noexcept(ca)), const A&&>::value), "");
static_assert((std::is_same<decltype(std::move_if_noexcept(l)), const legacy&>::value), "");
#else // C++ < 11
- // libc++ defines decltype to be __typeof__ in C++03. __typeof__ does not
- // deduce the reference qualifiers.
- static_assert((std::is_same<decltype(std::move_if_noexcept(i)), const int>::value), "");
- static_assert((std::is_same<decltype(std::move_if_noexcept(ci)), const int>::value), "");
- static_assert((std::is_same<decltype(std::move_if_noexcept(a)), const A>::value), "");
- static_assert((std::is_same<decltype(std::move_if_noexcept(ca)), const A>::value), "");
- static_assert((std::is_same<decltype(std::move_if_noexcept(l)), const legacy>::value), "");
+ // In C++03 libc++ #define's decltype to be __decltype on clang and
+ // __typeof__ for other compilers. __typeof__ does not deduce the reference
+ // qualifiers and will cause this test to fail.
+ static_assert((std::is_same<decltype(std::move_if_noexcept(i)), const int&>::value), "");
+ static_assert((std::is_same<decltype(std::move_if_noexcept(ci)), const int&>::value), "");
+ static_assert((std::is_same<decltype(std::move_if_noexcept(a)), const A&>::value), "");
+ static_assert((std::is_same<decltype(std::move_if_noexcept(ca)), const A&>::value), "");
+ static_assert((std::is_same<decltype(std::move_if_noexcept(l)), const legacy&>::value), "");
#endif
#if TEST_STD_VER > 11
diff --git a/test/std/utilities/utility/pairs/pair.astuple/get_const_rv.pass.cpp b/test/std/utilities/utility/pairs/pair.astuple/get_const_rv.pass.cpp
new file mode 100644
index 000000000000..edd2f3d0752f
--- /dev/null
+++ b/test/std/utilities/utility/pairs/pair.astuple/get_const_rv.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <utility>
+
+// template <class T1, class T2> struct pair
+
+// template<size_t I, class T1, class T2>
+// const typename tuple_element<I, std::pair<T1, T2> >::type&&
+// get(const pair<T1, T2>&&);
+
+// UNSUPPORTED: c++98, c++03
+
+#include <utility>
+#include <memory>
+#include <type_traits>
+#include <cassert>
+
+#include "test_macros.h"
+
+int main()
+{
+ {
+ typedef std::pair<std::unique_ptr<int>, short> P;
+ const P p(std::unique_ptr<int>(new int(3)), 4);
+ static_assert(std::is_same<const std::unique_ptr<int>&&, decltype(std::get<0>(std::move(p)))>::value, "");
+ static_assert(noexcept(std::get<0>(std::move(p))), "");
+ const std::unique_ptr<int>&& ptr = std::get<0>(std::move(p));
+ assert(*ptr == 3);
+ }
+
+ {
+ int x = 42;
+ int const y = 43;
+ std::pair<int&, int const&> const p(x, y);
+ static_assert(std::is_same<int&, decltype(std::get<0>(std::move(p)))>::value, "");
+ static_assert(noexcept(std::get<0>(std::move(p))), "");
+ static_assert(std::is_same<int const&, decltype(std::get<1>(std::move(p)))>::value, "");
+ static_assert(noexcept(std::get<1>(std::move(p))), "");
+ }
+
+ {
+ int x = 42;
+ int const y = 43;
+ std::pair<int&&, int const&&> const p(std::move(x), std::move(y));
+ static_assert(std::is_same<int&&, decltype(std::get<0>(std::move(p)))>::value, "");
+ static_assert(noexcept(std::get<0>(std::move(p))), "");
+ static_assert(std::is_same<int const&&, decltype(std::get<1>(std::move(p)))>::value, "");
+ static_assert(noexcept(std::get<1>(std::move(p))), "");
+ }
+
+#if TEST_STD_VER > 11
+ {
+ typedef std::pair<int, short> P;
+ constexpr const P p1(3, 4);
+ static_assert(std::get<0>(std::move(p1)) == 3, "");
+ static_assert(std::get<1>(std::move(p1)) == 4, "");
+ }
+#endif
+}
diff --git a/test/std/utilities/utility/pairs/pair.astuple/pairs.by.type.pass.cpp b/test/std/utilities/utility/pairs/pair.astuple/pairs.by.type.pass.cpp
index 176d58330d16..efcc2cedc6e1 100644
--- a/test/std/utilities/utility/pairs/pair.astuple/pairs.by.type.pass.cpp
+++ b/test/std/utilities/utility/pairs/pair.astuple/pairs.by.type.pass.cpp
@@ -7,15 +7,17 @@
//
//===----------------------------------------------------------------------===//
+// UNSUPPORTED: c++98, c++03, c++11
+
#include <utility>
#include <string>
+#include <type_traits>
#include <complex>
#include <cassert>
int main()
{
-#if _LIBCPP_STD_VER > 11
typedef std::complex<float> cf;
{
auto t1 = std::make_pair<int, cf> ( 42, { 1,2 } );
@@ -23,7 +25,7 @@ int main()
assert ( std::get<cf>(t1).real() == 1 );
assert ( std::get<cf>(t1).imag() == 2 );
}
-
+
{
const std::pair<int, const int> p1 { 1, 2 };
const int &i1 = std::get<int>(p1);
@@ -35,10 +37,48 @@ int main()
{
typedef std::unique_ptr<int> upint;
std::pair<upint, int> t(upint(new int(4)), 42);
- upint p = std::get<0>(std::move(t)); // get rvalue
+ upint p = std::get<upint>(std::move(t)); // get rvalue
+ assert(*p == 4);
+ assert(std::get<upint>(t) == nullptr); // has been moved from
+ }
+
+ {
+ typedef std::unique_ptr<int> upint;
+ const std::pair<upint, int> t(upint(new int(4)), 42);
+ static_assert(std::is_same<const upint&&, decltype(std::get<upint>(std::move(t)))>::value, "");
+ static_assert(noexcept(std::get<upint>(std::move(t))), "");
+ static_assert(std::is_same<const int&&, decltype(std::get<int>(std::move(t)))>::value, "");
+ static_assert(noexcept(std::get<int>(std::move(t))), "");
+ auto&& p = std::get<upint>(std::move(t)); // get const rvalue
+ auto&& i = std::get<int>(std::move(t)); // get const rvalue
assert(*p == 4);
- assert(std::get<0>(t) == nullptr); // has been moved from
+ assert(i == 42);
+ assert(std::get<upint>(t) != nullptr);
}
-#endif
+ {
+ int x = 42;
+ int const y = 43;
+ std::pair<int&, int const&> const p(x, y);
+ static_assert(std::is_same<int&, decltype(std::get<int&>(std::move(p)))>::value, "");
+ static_assert(noexcept(std::get<int&>(std::move(p))), "");
+ static_assert(std::is_same<int const&, decltype(std::get<int const&>(std::move(p)))>::value, "");
+ static_assert(noexcept(std::get<int const&>(std::move(p))), "");
+ }
+
+ {
+ int x = 42;
+ int const y = 43;
+ std::pair<int&&, int const&&> const p(std::move(x), std::move(y));
+ static_assert(std::is_same<int&&, decltype(std::get<int&&>(std::move(p)))>::value, "");
+ static_assert(noexcept(std::get<int&&>(std::move(p))), "");
+ static_assert(std::is_same<int const&&, decltype(std::get<int const&&>(std::move(p)))>::value, "");
+ static_assert(noexcept(std::get<int const&&>(std::move(p))), "");
+ }
+
+ {
+ constexpr const std::pair<int, const int> p { 1, 2 };
+ static_assert(std::get<int>(std::move(p)) == 1, "");
+ static_assert(std::get<const int>(std::move(p)) == 2, "");
+ }
}
diff --git a/test/std/utilities/utility/pairs/pairs.pair/default-sfinae.pass.cpp b/test/std/utilities/utility/pairs/pairs.pair/default-sfinae.pass.cpp
new file mode 100644
index 000000000000..8f9fc669251a
--- /dev/null
+++ b/test/std/utilities/utility/pairs/pairs.pair/default-sfinae.pass.cpp
@@ -0,0 +1,164 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <utility>
+
+// template <class T1, class T2> struct pair
+
+// Test the SFINAE required by LWG Issue #2367.
+// is_default_constructible<pair>
+
+// UNSUPPORTED: c++98, c++03
+
+#include <utility>
+#include <type_traits>
+#include <cassert>
+
+#include "test_macros.h"
+
+#if TEST_STD_VER > 11
+#define CONSTEXPR_CXX14 constexpr
+#define STATIC_ASSERT_CXX14(Pred) static_assert(Pred, "")
+#else
+#define CONSTEXPR_CXX14
+#define STATIC_ASSERT_CXX14(Pred) assert(Pred)
+#endif
+
+struct DeletedDefault {
+ // A class with a deleted default constructor. Used to test the SFINAE
+ // on std::pairs default constructor.
+ constexpr explicit DeletedDefault(int x) : value(x) {}
+ constexpr DeletedDefault() = delete;
+ int value;
+};
+
+template <class Tp, bool>
+struct DependantType: public Tp {};
+
+template <class T, bool Val>
+using DependantIsDefault = DependantType<std::is_default_constructible<T>, Val>;
+
+template <class T>
+struct DefaultSFINAES {
+ template <bool Dummy = false, class = typename std::enable_if<
+ DependantIsDefault<T, Dummy>::value
+ >::type
+ >
+ constexpr DefaultSFINAES() : value() {}
+ constexpr explicit DefaultSFINAES(T const& x) : value(x) {}
+ T value;
+};
+
+struct NoDefault {
+ constexpr NoDefault(int v) : value(v) {}
+ int value;
+};
+
+template <class Tp>
+void test_not_is_default_constructible()
+{
+ {
+ typedef std::pair<int, Tp> P;
+ static_assert(!std::is_default_constructible<P>::value, "");
+ static_assert(std::is_constructible<P, int, Tp>::value, "");
+ }
+ {
+ typedef std::pair<Tp, int> P;
+ static_assert(!std::is_default_constructible<P>::value, "");
+ static_assert(std::is_constructible<P, Tp, int>::value, "");
+ }
+ {
+ typedef std::pair<Tp, Tp> P;
+ static_assert(!std::is_default_constructible<P>::value, "");
+ static_assert(std::is_constructible<P, Tp, Tp>::value, "");
+ }
+}
+
+template <class Tp>
+void test_is_default_constructible()
+{
+ {
+ typedef std::pair<int, Tp> P;
+ static_assert(std::is_default_constructible<P>::value, "");
+ }
+ {
+ typedef std::pair<Tp, int> P;
+ static_assert(std::is_default_constructible<P>::value, "");
+ }
+ {
+ typedef std::pair<Tp, Tp> P;
+ static_assert(std::is_default_constructible<P>::value, "");
+ }
+}
+
+template <class T>
+struct IllFormedDefaultImp {
+ constexpr explicit IllFormedDefaultImp(int v) : value(v) {}
+ constexpr IllFormedDefaultImp() : value(T::DoesNotExistAndShouldNotCompile) {}
+ int value;
+};
+
+typedef IllFormedDefaultImp<int> IllFormedDefault;
+ // A class which provides a constexpr default constructor with a valid
+ // signature but an ill-formed body. The A compile error will be emitted if
+ // the default constructor is instantiated.
+
+
+// Check that the SFINAE on the default constructor is not evaluated when
+// it isn't needed. If the default constructor of 'IllFormedDefault' is evaluated
+// in C++11, even with is_default_constructible, then this test should fail to
+// compile. In C++14 and greater evaluate each test is evaluated as a constant
+// expression.
+// See LWG issue #2367
+void test_illformed_default()
+{
+ {
+ typedef std::pair<IllFormedDefault, int> P;
+ static_assert((std::is_constructible<P, IllFormedDefault, int>::value), "");
+ CONSTEXPR_CXX14 P p(IllFormedDefault(42), -5);
+ STATIC_ASSERT_CXX14(p.first.value == 42 && p.second == -5);
+ }
+ {
+ typedef std::pair<int, IllFormedDefault> P;
+ static_assert((std::is_constructible<P, int, IllFormedDefault>::value), "");
+ CONSTEXPR_CXX14 IllFormedDefault dd(-5);
+ CONSTEXPR_CXX14 P p(42, dd);
+ STATIC_ASSERT_CXX14(p.first == 42 && p.second.value == -5);
+ }
+ {
+ typedef std::pair<IllFormedDefault, IllFormedDefault> P;
+ static_assert((std::is_constructible<P, IllFormedDefault, IllFormedDefault>::value), "");
+ CONSTEXPR_CXX14 P p(IllFormedDefault(42), IllFormedDefault(-5));
+ STATIC_ASSERT_CXX14(p.first.value == 42 && p.second.value == -5);
+ }
+}
+
+
+int main()
+{
+ {
+ // Check that pair<T, U> can still be used even if
+ // is_default_constructible<T> or is_default_constructible<U> cause
+ // a compilation error.
+ test_illformed_default();
+ }
+ {
+ // pair::pair() is only disable in C++11 and beyond.
+ test_not_is_default_constructible<NoDefault>();
+ test_not_is_default_constructible<DeletedDefault>();
+ test_not_is_default_constructible<DefaultSFINAES<int&>>();
+ test_not_is_default_constructible<DefaultSFINAES<int&&>>();
+ test_not_is_default_constructible<int&>();
+ test_not_is_default_constructible<int&&>();
+ }
+ {
+ test_is_default_constructible<int>();
+ test_is_default_constructible<DefaultSFINAES<int>>();
+ }
+}
diff --git a/test/std/utilities/utility/pairs/pairs.pair/default.pass.cpp b/test/std/utilities/utility/pairs/pairs.pair/default.pass.cpp
index bb6661f7966c..d83328b8f2d0 100644
--- a/test/std/utilities/utility/pairs/pairs.pair/default.pass.cpp
+++ b/test/std/utilities/utility/pairs/pairs.pair/default.pass.cpp
@@ -13,9 +13,15 @@
// constexpr pair();
+// NOTE: The SFINAE on the default constructor is tested in
+// default-sfinae.pass.cpp
+
#include <utility>
+#include <type_traits>
#include <cassert>
+#include "test_macros.h"
+
int main()
{
{
@@ -24,13 +30,12 @@ int main()
assert(p.first == 0.0f);
assert(p.second == nullptr);
}
-
-#if _LIBCPP_STD_VER > 11
+#if TEST_STD_VER >= 11
{
- typedef std::pair<float, short*> P;
- constexpr P p;
- static_assert(p.first == 0.0f, "");
- static_assert(p.second == nullptr, "");
+ typedef std::pair<float, short*> P;
+ constexpr P p;
+ static_assert(p.first == 0.0f, "");
+ static_assert(p.second == nullptr, "");
}
#endif
}
diff --git a/test/std/utilities/utility/pairs/pairs.pair/swap.pass.cpp b/test/std/utilities/utility/pairs/pairs.pair/swap.pass.cpp
index a912df00d7bb..0ad5786bce29 100644
--- a/test/std/utilities/utility/pairs/pairs.pair/swap.pass.cpp
+++ b/test/std/utilities/utility/pairs/pairs.pair/swap.pass.cpp
@@ -16,6 +16,15 @@
#include <utility>
#include <cassert>
+struct S {
+ int i;
+ S() : i(0) {}
+ S(int j) : i(j) {}
+ S * operator& () { assert(false); return this; }
+ S const * operator& () const { assert(false); return this; }
+ bool operator==(int x) const { return i == x; }
+ };
+
int main()
{
{
@@ -28,4 +37,14 @@ int main()
assert(p2.first == 3);
assert(p2.second == 4);
}
+ {
+ typedef std::pair<int, S> P1;
+ P1 p1(3, S(4));
+ P1 p2(5, S(6));
+ p1.swap(p2);
+ assert(p1.first == 5);
+ assert(p1.second == 6);
+ assert(p2.first == 3);
+ assert(p2.second == 4);
+ }
}
diff --git a/test/support/allocators.h b/test/support/allocators.h
index b7aba12e21fd..7c2103ff2721 100644
--- a/test/support/allocators.h
+++ b/test/support/allocators.h
@@ -35,6 +35,8 @@ public:
A1(const A1& a) TEST_NOEXCEPT : id_(a.id()) {copy_called = true;}
A1(A1&& a) TEST_NOEXCEPT : id_(a.id()) {move_called = true;}
+ A1& operator=(const A1& a) TEST_NOEXCEPT { id_ = a.id(); copy_called = true; return *this;}
+ A1& operator=(A1&& a) TEST_NOEXCEPT { id_ = a.id(); move_called = true; return *this;}
template <class U>
A1(const A1<U>& a) TEST_NOEXCEPT : id_(a.id()) {copy_called = true;}
@@ -96,6 +98,8 @@ public:
A2(const A2& a) TEST_NOEXCEPT : id_(a.id()) {copy_called = true;}
A2(A2&& a) TEST_NOEXCEPT : id_(a.id()) {move_called = true;}
+ A2& operator=(const A2& a) TEST_NOEXCEPT { id_ = a.id(); copy_called = true; return *this;}
+ A2& operator=(A2&& a) TEST_NOEXCEPT { id_ = a.id(); move_called = true; return *this;}
T* allocate(std::size_t n, const void* hint)
{
@@ -142,7 +146,9 @@ public:
static bool destroy_called;
A3(const A3& a) TEST_NOEXCEPT : id_(a.id()) {copy_called = true;}
- A3(A3&& a) TEST_NOEXCEPT: id_(a.id()) {move_called = true;}
+ A3(A3&& a) TEST_NOEXCEPT : id_(a.id()) {move_called = true;}
+ A3& operator=(const A3& a) TEST_NOEXCEPT { id_ = a.id(); copy_called = true; return *this;}
+ A3& operator=(A3&& a) TEST_NOEXCEPT { id_ = a.id(); move_called = true; return *this;}
template <class U, class ...Args>
void construct(U* p, Args&& ...args)
diff --git a/test/support/any_helpers.h b/test/support/any_helpers.h
new file mode 100644
index 000000000000..76b1922fb1f1
--- /dev/null
+++ b/test/support/any_helpers.h
@@ -0,0 +1,318 @@
+#ifndef ANY_HELPERS_H
+#define ANY_HELPERS_H
+
+#include <experimental/any>
+#include <typeinfo>
+#include <type_traits>
+#include <cassert>
+
+#include "test_macros.h"
+
+#if !defined(TEST_HAS_NO_RTTI)
+#define RTTI_ASSERT(X) assert(X)
+#else
+#define RTTI_ASSERT(X)
+#endif
+
+template <class _Tp>
+ struct IsSmallObject
+ : public std::integral_constant<bool
+ , sizeof(_Tp) <= (sizeof(void*)*3)
+ && std::alignment_of<void*>::value
+ % std::alignment_of<_Tp>::value == 0
+ && std::is_nothrow_move_constructible<_Tp>::value
+ >
+ {};
+
+
+// Return 'true' if 'Type' will be considered a small type by 'any'
+template <class Type>
+bool isSmallType() {
+#if defined(_LIBCPP_VERSION)
+ return std::experimental::__any_imp::_IsSmallObject<Type>::value;
+#else
+ return IsSmallObject<Type>::value;
+#endif
+
+}
+
+// Assert that an object is empty. If the object used to contain an object
+// of type 'LastType' check that it can no longer be accessed.
+template <class LastType = int>
+void assertEmpty(std::experimental::any const& a) {
+ assert(a.empty());
+ RTTI_ASSERT(a.type() == typeid(void));
+ assert(std::experimental::any_cast<LastType const>(&a) == nullptr);
+}
+
+// Assert that an 'any' object stores the specified 'Type' and 'value'.
+template <class Type>
+void assertContains(std::experimental::any const& a, int value = 1) {
+ assert(!a.empty());
+ RTTI_ASSERT(a.type() == typeid(Type));
+ assert(std::experimental::any_cast<Type const &>(a).value == value);
+}
+
+// Modify the value of a "test type" stored within an any to the specified
+// 'value'.
+template <class Type>
+void modifyValue(std::experimental::any& a, int value) {
+ assert(!a.empty());
+ RTTI_ASSERT(a.type() == typeid(Type));
+ std::experimental::any_cast<Type&>(a).value = value;
+}
+
+// A test type that will trigger the small object optimization within 'any'.
+template <int Dummy = 0>
+struct small_type
+{
+ static int count;
+ static int copied;
+ static int moved;
+ static int const_copied;
+ static int non_const_copied;
+
+ static void reset() {
+ small_type::copied = 0;
+ small_type::moved = 0;
+ small_type::const_copied = 0;
+ small_type::non_const_copied = 0;
+ }
+
+ int value;
+
+ explicit small_type(int val) : value(val) {
+ ++count;
+ }
+
+ small_type(small_type const & other) throw() {
+ value = other.value;
+ ++count;
+ ++copied;
+ ++const_copied;
+ }
+
+ small_type(small_type& other) throw() {
+ value = other.value;
+ ++count;
+ ++copied;
+ ++non_const_copied;
+ }
+
+ small_type(small_type && other) throw() {
+ value = other.value;
+ other.value = 0;
+ ++count;
+ ++moved;
+ }
+
+ ~small_type() {
+ value = -1;
+ --count;
+ }
+
+private:
+ small_type& operator=(small_type const&) = delete;
+ small_type& operator=(small_type&&) = delete;
+};
+
+template <int Dummy>
+int small_type<Dummy>::count = 0;
+
+template <int Dummy>
+int small_type<Dummy>::copied = 0;
+
+template <int Dummy>
+int small_type<Dummy>::moved = 0;
+
+template <int Dummy>
+int small_type<Dummy>::const_copied = 0;
+
+template <int Dummy>
+int small_type<Dummy>::non_const_copied = 0;
+
+typedef small_type<> small;
+typedef small_type<1> small1;
+typedef small_type<2> small2;
+
+
+// A test type that will NOT trigger the small object optimization in any.
+template <int Dummy = 0>
+struct large_type
+{
+ static int count;
+ static int copied;
+ static int moved;
+ static int const_copied;
+ static int non_const_copied;
+
+ static void reset() {
+ large_type::copied = 0;
+ large_type::moved = 0;
+ large_type::const_copied = 0;
+ large_type::non_const_copied = 0;
+ }
+
+ int value;
+
+ large_type(int val) : value(val) {
+ ++count;
+ data[0] = 0;
+ }
+
+ large_type(large_type const & other) {
+ value = other.value;
+ ++count;
+ ++copied;
+ ++const_copied;
+ }
+
+ large_type(large_type & other) {
+ value = other.value;
+ ++count;
+ ++copied;
+ ++non_const_copied;
+ }
+
+ large_type(large_type && other) {
+ value = other.value;
+ other.value = 0;
+ ++count;
+ ++moved;
+ }
+
+ ~large_type() {
+ value = 0;
+ --count;
+ }
+
+private:
+ large_type& operator=(large_type const&) = delete;
+ large_type& operator=(large_type &&) = delete;
+ int data[10];
+};
+
+template <int Dummy>
+int large_type<Dummy>::count = 0;
+
+template <int Dummy>
+int large_type<Dummy>::copied = 0;
+
+template <int Dummy>
+int large_type<Dummy>::moved = 0;
+
+template <int Dummy>
+int large_type<Dummy>::const_copied = 0;
+
+template <int Dummy>
+int large_type<Dummy>::non_const_copied = 0;
+
+typedef large_type<> large;
+typedef large_type<1> large1;
+typedef large_type<2> large2;
+
+// The exception type thrown by 'small_throws_on_copy', 'large_throws_on_copy'
+// and 'throws_on_move'.
+struct my_any_exception {};
+
+void throwMyAnyExpression() {
+#if !defined(TEST_HAS_NO_EXCEPTIONS)
+ throw my_any_exception();
+#else
+ assert(false && "Exceptions are disabled");
+#endif
+}
+
+// A test type that will trigger the small object optimization within 'any'.
+// this type throws if it is copied.
+struct small_throws_on_copy
+{
+ static int count;
+ int value;
+
+ explicit small_throws_on_copy(int val = 0) : value(val) {
+ ++count;
+ }
+
+ small_throws_on_copy(small_throws_on_copy const &) {
+ throwMyAnyExpression();
+ }
+
+ small_throws_on_copy(small_throws_on_copy && other) throw() {
+ value = other.value;
+ ++count;
+ }
+
+ ~small_throws_on_copy() {
+ --count;
+ }
+private:
+ small_throws_on_copy& operator=(small_throws_on_copy const&) = delete;
+ small_throws_on_copy& operator=(small_throws_on_copy &&) = delete;
+};
+
+int small_throws_on_copy::count = 0;
+
+// A test type that will NOT trigger the small object optimization within 'any'.
+// this type throws if it is copied.
+struct large_throws_on_copy
+{
+ static int count;
+ int value = 0;
+
+ explicit large_throws_on_copy(int val = 0) : value(val) {
+ data[0] = 0;
+ ++count;
+ }
+
+ large_throws_on_copy(large_throws_on_copy const &) {
+ throwMyAnyExpression();
+ }
+
+ large_throws_on_copy(large_throws_on_copy && other) throw() {
+ value = other.value;
+ ++count;
+ }
+
+ ~large_throws_on_copy() {
+ --count;
+ }
+
+private:
+ large_throws_on_copy& operator=(large_throws_on_copy const&) = delete;
+ large_throws_on_copy& operator=(large_throws_on_copy &&) = delete;
+ int data[10];
+};
+
+int large_throws_on_copy::count = 0;
+
+// A test type that throws when it is moved. This object will NOT trigger
+// the small object optimization in 'any'.
+struct throws_on_move
+{
+ static int count;
+ int value;
+
+ explicit throws_on_move(int val = 0) : value(val) { ++count; }
+
+ throws_on_move(throws_on_move const & other) {
+ value = other.value;
+ ++count;
+ }
+
+ throws_on_move(throws_on_move &&) {
+ throwMyAnyExpression();
+ }
+
+ ~throws_on_move() {
+ --count;
+ }
+private:
+ throws_on_move& operator=(throws_on_move const&) = delete;
+ throws_on_move& operator=(throws_on_move &&) = delete;
+};
+
+int throws_on_move::count = 0;
+
+
+#endif
diff --git a/test/support/count_new.hpp b/test/support/count_new.hpp
index ddaf036f7d16..57aca7def335 100644
--- a/test/support/count_new.hpp
+++ b/test/support/count_new.hpp
@@ -30,6 +30,10 @@ public:
// All checks return true when disable_checking is enabled.
static const bool disable_checking;
+ // Disallow any allocations from occurring. Useful for testing that
+ // code doesn't perform any allocations.
+ bool disable_allocations;
+
int outstanding_new;
int new_called;
int delete_called;
@@ -43,6 +47,7 @@ public:
public:
void newCalled(std::size_t s)
{
+ assert(disable_allocations == false);
assert(s);
++new_called;
++outstanding_new;
@@ -58,6 +63,7 @@ public:
void newArrayCalled(std::size_t s)
{
+ assert(disable_allocations == false);
assert(s);
++outstanding_array_new;
++new_array_called;
@@ -71,8 +77,20 @@ public:
++delete_array_called;
}
+ void disableAllocations()
+ {
+ disable_allocations = true;
+ }
+
+ void enableAllocations()
+ {
+ disable_allocations = false;
+ }
+
void reset()
{
+ disable_allocations = false;
+
outstanding_new = 0;
new_called = 0;
delete_called = 0;
@@ -203,4 +221,29 @@ void operator delete[](void* p) throw()
#endif // DISABLE_NEW_COUNT
+
+struct DisableAllocationGuard {
+ explicit DisableAllocationGuard(bool disable = true) : m_disabled(disable)
+ {
+ // Don't re-disable if already disabled.
+ if (globalMemCounter.disable_allocations == true) m_disabled = false;
+ if (m_disabled) globalMemCounter.disableAllocations();
+ }
+
+ void release() {
+ if (m_disabled) globalMemCounter.enableAllocations();
+ m_disabled = false;
+ }
+
+ ~DisableAllocationGuard() {
+ release();
+ }
+
+private:
+ bool m_disabled;
+
+ DisableAllocationGuard(DisableAllocationGuard const&);
+ DisableAllocationGuard& operator=(DisableAllocationGuard const&);
+};
+
#endif /* COUNT_NEW_HPP */
diff --git a/test/support/disable_missing_braces_warning.h b/test/support/disable_missing_braces_warning.h
new file mode 100644
index 000000000000..967a87ab3a2e
--- /dev/null
+++ b/test/support/disable_missing_braces_warning.h
@@ -0,0 +1,8 @@
+#ifndef SUPPORT_DISABLE_MISSING_BRACES_WARNING_H
+#define SUPPORT_DISABLE_MISSING_BRACES_WARNING_H
+
+// std::array is explicitly allowed to be initialized with A a = { init-list };.
+// Disable the missing braces warning for this reason.
+#pragma GCC diagnostic ignored "-Wmissing-braces"
+
+#endif // SUPPORT_DISABLE_MISSING_BRACES_WARNING_H
diff --git a/test/support/test_allocator.h b/test/support/test_allocator.h
index 47ef1d556784..3ca672f89a9b 100644
--- a/test/support/test_allocator.h
+++ b/test/support/test_allocator.h
@@ -171,13 +171,13 @@ public:
template <class U> struct rebind {typedef test_allocator<U> other;};
- test_allocator() throw() : data_(-1) {}
+ test_allocator() throw() : data_(0) {}
explicit test_allocator(int i) throw() : data_(i) {}
test_allocator(const test_allocator& a) throw()
: data_(a.data_) {}
template <class U> test_allocator(const test_allocator<U>& a) throw()
: data_(a.data_) {}
- ~test_allocator() throw() {data_ = 0;}
+ ~test_allocator() throw() {data_ = -1;}
friend bool operator==(const test_allocator& x, const test_allocator& y)
{return x.data_ == y.data_;}
diff --git a/test/support/test_macros.h b/test/support/test_macros.h
index a08ca87be935..c34e8cf7ef14 100644
--- a/test/support/test_macros.h
+++ b/test/support/test_macros.h
@@ -14,12 +14,24 @@
#define TEST_CONCAT1(X, Y) X##Y
#define TEST_CONCAT(X, Y) TEST_CONCAT1(X, Y)
+#ifdef __has_feature
+#define TEST_HAS_FEATURE(X) __has_feature(X)
+#else
+#define TEST_HAS_FEATURE(X) 0
+#endif
+
#ifdef __has_extension
#define TEST_HAS_EXTENSION(X) __has_extension(X)
#else
#define TEST_HAS_EXTENSION(X) 0
#endif
+#ifdef __has_builtin
+#define TEST_HAS_BUILTIN(X) __has_builtin(X)
+#else
+#define TEST_HAS_BUILTIN(X) 0
+#endif
+
/* Make a nice name for the standard version */
#if __cplusplus <= 199711L
# define TEST_STD_VER 3
@@ -56,8 +68,10 @@
#endif
#if TEST_STD_VER >= 11
+#define TEST_CONSTEXPR constexpr
#define TEST_NOEXCEPT noexcept
#else
+#define TEST_CONSTEXPR
#define TEST_NOEXCEPT
#endif
@@ -80,4 +94,17 @@ template <unsigned> struct static_assert_check {};
} // end namespace test_detail
+#if !TEST_HAS_FEATURE(cxx_rtti) && !defined(__cxx_rtti)
+#define TEST_HAS_NO_RTTI
+#endif
+
+#if !TEST_HAS_FEATURE(cxx_exceptions) && !defined(__cxx_exceptions)
+#define TEST_HAS_NO_EXCEPTIONS
+#endif
+
+#if TEST_HAS_FEATURE(address_sanitizer) || TEST_HAS_FEATURE(memory_sanitizer) || \
+ TEST_HAS_FEATURE(thread_sanitizer)
+#define TEST_HAS_SANITIZERS
+#endif
+
#endif // SUPPORT_TEST_MACROS_HPP
diff --git a/test/testit b/test/testit
index 821292efb5a3..cac668497fa5 100755
--- a/test/testit
+++ b/test/testit
@@ -42,7 +42,7 @@ then
fi
if [ -z "$OPTIONS" ]
then
- OPTIONS="-std=${CXX_LANG} -stdlib=libc++"
+ OPTIONS="-std=${CXX_LANG} -stdlib=libc++ -nostdinc++"
fi
OPTIONS="$OPTIONS -I$LIBCXX_ROOT/test/support"