From c79549b70e66c251c15dd145c964edb70fa2e2b3 Mon Sep 17 00:00:00 2001 From: Dan Albert Date: Wed, 17 Jan 2018 14:21:02 -0800 Subject: [PATCH] Revert "Revert "Merge to upstream r304942."" This reverts commit 38a0d5af7e5d13553fe623053e05dffc06403280. Test: make checkbuild Test: ./run_tests.py Test: ./run_tests.py --bitness 64 --- .clang-format | 1 + CMakeLists.txt | 64 +- appveyor-reqs-install.cmd | 53 + appveyor.yml | 78 + benchmarks/CMakeLists.txt | 4 +- cmake/Modules/HandleCompilerRT.cmake | 3 + cmake/config-ix.cmake | 20 +- docs/CMakeLists.txt | 4 +- docs/DesignDocs/AvailabilityMarkup.rst | 114 ++ docs/TestingLibcxx.rst | 2 +- docs/UsingLibcxx.rst | 5 + docs/index.rst | 3 +- include/__bit_reference | 8 +- include/__bsd_locale_fallbacks.h | 31 +- include/__config | 198 ++- include/__functional_base | 22 +- include/__hash_table | 28 +- include/__locale | 28 +- include/__mutex_base | 38 +- include/__split_buffer | 37 +- include/__std_stream | 8 +- include/__string | 8 +- include/__threading_support | 13 +- include/__tree | 24 +- include/__tuple | 17 +- include/{__undef_min_max => __undef_macros} | 11 +- include/algorithm | 187 +- include/any | 28 +- include/array | 6 +- include/atomic | 33 +- include/bitset | 30 +- include/chrono | 20 +- include/cmath | 6 - include/cstddef | 29 + include/cstdio | 6 +- include/cstdlib | 2 + include/ctype.h | 9 - include/deque | 366 ++-- include/exception | 129 +- include/experimental/__config | 7 + include/experimental/algorithm | 9 +- include/experimental/coroutine | 294 ++++ include/experimental/dynarray | 7 +- include/experimental/filesystem | 3 + include/experimental/functional | 9 +- include/experimental/memory_resource | 5 + include/experimental/numeric | 19 +- include/experimental/optional | 37 +- include/experimental/string_view | 5 + include/ext/hash_map | 8 +- include/ext/hash_set | 2 +- include/forward_list | 136 +- include/fstream | 40 +- include/functional | 73 +- include/future | 50 +- include/initializer_list | 4 +- include/ios | 2 +- include/istream | 35 +- include/iterator | 65 +- include/limits | 29 +- include/list | 116 +- include/locale | 64 +- include/map | 99 +- include/math.h | 154 +- include/memory | 1558 +++++++++-------- include/module.modulemap | 7 +- include/mutex | 191 +- include/new | 16 +- include/numeric | 16 +- include/optional | 213 +-- include/ostream | 14 +- include/queue | 79 +- include/random | 304 ++-- include/ratio | 8 +- include/regex | 31 +- include/set | 91 +- include/shared_mutex | 20 +- include/sstream | 40 +- include/stack | 33 +- include/stdexcept | 6 +- include/stdio.h | 6 +- include/stdlib.h | 4 - include/streambuf | 7 + include/string | 124 +- include/string_view | 23 +- include/strstream | 20 +- include/support/fuchsia/xlocale.h | 23 + .../{limits_win32.h => limits_msvc_win32.h} | 27 +- include/support/win32/locale_mgmt_win32.h | 33 - include/support/win32/locale_win32.h | 61 +- include/support/win32/support.h | 185 -- include/thread | 49 +- include/tuple | 88 +- include/type_traits | 81 +- include/typeinfo | 1 + include/unordered_map | 136 +- include/unordered_set | 136 +- include/utility | 33 +- include/valarray | 76 +- include/variant | 82 +- include/vector | 139 +- include/wchar.h | 9 +- lib/CMakeLists.txt | 18 +- lib/libc++abi-new-delete.exp | 8 + lib/libc++abi2.exp | 8 - src/chrono.cpp | 2 +- src/condition_variable.cpp | 1 + src/exception.cpp | 2 +- src/experimental/filesystem/operations.cpp | 4 +- src/functional.cpp | 26 + src/include/atomic_support.h | 2 +- src/ios.cpp | 1 + src/iostream.cpp | 16 +- src/locale.cpp | 65 +- src/memory.cpp | 6 +- src/mutex.cpp | 1 + src/new.cpp | 4 +- src/string.cpp | 5 +- src/strstream.cpp | 1 + .../runtime/exception_pointer_msvc.ipp | 95 + src/support/win32/locale_win32.cpp | 57 +- src/support/win32/support.cpp | 11 - src/system_error.cpp | 2 +- src/thread.cpp | 4 +- .../random_shuffle.cxx1z.pass.cpp | 46 + .../diagnose_invalid_memory_order.fail.cpp | 4 + .../sequences/list/list.cons/db_copy.pass.cpp | 2 + .../sequences/list/list.cons/db_move.pass.cpp | 3 + .../list/list.modifiers/emplace_db1.pass.cpp | 3 + .../list.modifiers/erase_iter_db1.pass.cpp | 3 + .../list.modifiers/erase_iter_db2.pass.cpp | 3 + .../erase_iter_iter_db1.pass.cpp | 3 + .../erase_iter_iter_db2.pass.cpp | 3 + .../erase_iter_iter_db3.pass.cpp | 3 + .../erase_iter_iter_db4.pass.cpp | 3 + .../insert_iter_iter_iter_db1.pass.cpp | 3 + .../insert_iter_rvalue_db1.pass.cpp | 3 + .../insert_iter_size_value_db1.pass.cpp | 3 + .../insert_iter_value_db1.pass.cpp | 3 + .../list/list.modifiers/pop_back_db1.pass.cpp | 3 + .../list/list.ops/db_splice_pos_list.pass.cpp | 3 + .../list.ops/db_splice_pos_list_iter.pass.cpp | 3 + .../db_splice_pos_list_iter_iter.pass.cpp | 3 + .../sequences/vector/asan_throw.pass.cpp | 9 +- .../containers/unord/next_pow2.pass.cpp | 88 + .../missing_hash_specialization.fail.cpp | 2 +- .../db_associative_container_tests.pass.cpp | 3 + .../db_sequence_container_iterators.pass.cpp | 3 + .../debug/containers/db_string.pass.cpp | 3 + .../db_unord_container_tests.pass.cpp | 3 + test/libcxx/debug/debug_abort.pass.cpp | 3 + test/libcxx/debug/debug_throw.pass.cpp | 3 + .../debug/debug_throw_register.pass.cpp | 3 + .../depr.adaptors.cxx1z.pass.cpp | 47 + test/libcxx/double_include.sh.cpp | 3 + .../dynarray/dynarray.cons/default.pass.cpp | 6 + .../default_throws_bad_alloc.pass.cpp | 1 + .../dynarray/dynarray.data/default.pass.cpp | 1 + .../dynarray/dynarray.mutate/default.pass.cpp | 2 + .../dynarray/dynarray.overview/at.pass.cpp | 2 + .../dynarray.overview/begin_end.pass.cpp | 2 + .../dynarray.overview/capacity.pass.cpp | 2 + .../dynarray.overview/front_back.pass.cpp | 1 + .../dynarray.overview/indexing.pass.cpp | 8 + .../dynarray/dynarray.zero/default.pass.cpp | 1 + .../sequences/dynarray/lit.local.cfg | 3 + ...erse_iterator_produces_diagnostic.fail.cpp | 31 + .../support.coroutines/dialect_support.sh.cpp | 59 + .../support.coroutines/version.sh.cpp} | 16 +- .../fopen.fail.cpp | 2 + .../rename.fail.cpp | 2 + .../iterators/trivial_iterators.pass.cpp | 2 +- .../new.badlength/bad_array_length.pass.cpp | 9 + .../new_faligned_allocation.sh.cpp | 13 +- .../conversions.string/ctor_move.pass.cpp | 3 + test/libcxx/min_max_macros.sh.cpp | 298 ++++ test/libcxx/modules/cinttypes_exports.sh.cpp | 4 + test/libcxx/modules/clocale_exports.sh.cpp | 4 + test/libcxx/modules/cstdint_exports.sh.cpp | 4 + test/libcxx/modules/inttypes_h_exports.sh.cpp | 4 + .../selftest/test.arc.fail.mm} | 7 +- .../selftest/test.arc.pass.mm} | 15 +- test/libcxx/selftest/test.fail.mm | 13 + test/libcxx/selftest/test.pass.mm | 17 + .../strings/iterators.exceptions.pass.cpp | 2 +- .../strings/iterators.noexcept.pass.cpp | 3 +- .../futures.promise/set_exception.pass.cpp | 1 - .../set_exception_at_thread_exit.pass.cpp | 1 - ...otify_from_pthread_created_thread.pass.cpp | 0 .../variadic_mutex_mangling.pass.cpp | 37 - .../thread_safety_lock_guard.pass.cpp | 4 + .../thread_safety_lock_unlock.pass.cpp | 4 + .../thread_safety_missing_unlock.fail.cpp | 4 + ...thread_safety_requires_capability.pass.cpp | 4 + .../thread.thread.this/sleep_for.pass.cpp | 12 + .../function.objects/refwrap/binary.pass.cpp | 0 .../function.objects/refwrap/unary.pass.cpp | 0 .../function_type_default_deleter.fail.cpp | 44 + .../__has_operator_addressof.pass.cpp | 6 +- .../missing_is_aggregate_trait.fail.cpp | 28 + .../template.bitset/includes.pass.cpp} | 27 +- .../diagnose_reference_binding.fail.cpp | 4 +- .../tuple/tuple.tuple/empty_member.pass.cpp | 0 .../variant.assign/copy.pass.cpp | 209 --- .../variant.assign/move.pass.cpp | 197 --- .../variant.ctor/copy.pass.cpp | 120 -- .../variant.ctor/move.pass.cpp | 153 -- .../alg.move/move.pass.cpp | 13 +- .../alg.move/move_backward.pass.cpp | 13 +- .../alg.partitions/partition.pass.cpp | 4 +- .../random_shuffle.pass.cpp | 1 + .../random_shuffle_rand.pass.cpp | 1 + .../alg.remove/remove.pass.cpp | 15 +- .../alg.remove/remove_copy_if.pass.cpp | 6 +- .../alg.remove/remove_if.pass.cpp | 15 +- .../alg.replace/replace_copy_if.pass.cpp | 6 +- .../alg.replace/replace_if.pass.cpp | 4 +- .../alg.swap/swap_ranges.pass.cpp | 15 +- .../alg.transform/unary_transform.pass.cpp | 6 +- .../alg.unique/unique.pass.cpp | 14 +- .../alg.unique/unique_pred.pass.cpp | 14 +- .../alg.count/count_if.pass.cpp | 13 +- .../alg.find/find_if.pass.cpp | 10 +- .../alg.find/find_if_not.pass.cpp | 11 +- .../alg.foreach/for_each_n.pass.cpp | 61 + .../pop.heap/pop_heap_comp.pass.cpp | 7 +- .../push.heap/push_heap_comp.pass.cpp | 9 +- .../sort.heap/sort_heap_comp.pass.cpp | 9 +- .../alg.nth.element/nth_element_comp.pass.cpp | 9 +- .../partial.sort/partial_sort_comp.pass.cpp | 9 +- .../alg.sort/sort/sort_comp.pass.cpp | 9 +- .../stable.sort/stable_sort_comp.pass.cpp | 9 +- test/std/containers/Emplaceable.h | 8 +- .../map/map.access/index_tuple.pass.cpp | 6 +- .../map.cons/assign_initializer_list.pass.cpp | 6 +- .../map/map.cons/initializer_list.pass.cpp | 6 +- .../initializer_list_compare.pass.cpp | 6 +- .../initializer_list_compare_alloc.pass.cpp | 8 +- .../map.cons/iter_iter_comp_alloc.pass.cpp | 2 - .../associative/map/map.cons/move.pass.cpp | 6 +- .../map/map.cons/move_alloc.pass.cpp | 6 +- .../map/map.cons/move_assign.pass.cpp | 6 +- .../map/map.modifiers/emplace.pass.cpp | 6 +- .../map/map.modifiers/emplace_hint.pass.cpp | 6 +- .../insert_initializer_list.pass.cpp | 6 +- .../assign_initializer_list.pass.cpp | 6 +- .../multimap.cons/initializer_list.pass.cpp | 6 +- .../initializer_list_compare.pass.cpp | 6 +- .../initializer_list_compare_alloc.pass.cpp | 8 +- .../multimap/multimap.cons/move.pass.cpp | 6 +- .../multimap.cons/move_alloc.pass.cpp | 6 +- .../multimap.cons/move_assign.pass.cpp | 6 +- .../multimap.modifiers/emplace.pass.cpp | 6 +- .../multimap.modifiers/emplace_hint.pass.cpp | 6 +- .../insert_initializer_list.pass.cpp | 6 +- .../multimap.ops/equal_range.pass.cpp | 1 - .../multimap/multimap.ops/find.pass.cpp | 1 - .../multimap.ops/lower_bound.pass.cpp | 1 - .../multimap.ops/upper_bound.pass.cpp | 1 - .../associative/multiset/emplace.pass.cpp | 6 +- .../multiset/emplace_hint.pass.cpp | 6 +- .../multiset/insert_initializer_list.pass.cpp | 6 +- .../multiset/insert_iter_rv.pass.cpp | 6 +- .../associative/multiset/insert_rv.pass.cpp | 6 +- .../assign_initializer_list.pass.cpp | 6 +- .../multiset.cons/initializer_list.pass.cpp | 8 +- .../initializer_list_compare.pass.cpp | 4 +- .../initializer_list_compare_alloc.pass.cpp | 4 +- .../multiset/multiset.cons/move.pass.cpp | 6 +- .../multiset.cons/move_alloc.pass.cpp | 4 +- .../multiset.cons/move_assign.pass.cpp | 6 +- .../associative/set/emplace.pass.cpp | 6 +- .../associative/set/emplace_hint.pass.cpp | 6 +- .../set/insert_initializer_list.pass.cpp | 6 +- .../associative/set/insert_iter_rv.pass.cpp | 6 +- .../associative/set/insert_rv.pass.cpp | 6 +- .../set.cons/assign_initializer_list.pass.cpp | 6 +- .../set/set.cons/initializer_list.pass.cpp | 6 +- .../initializer_list_compare.pass.cpp | 4 +- .../initializer_list_compare_alloc.pass.cpp | 6 +- .../associative/set/set.cons/move.pass.cpp | 6 +- .../set/set.cons/move_alloc.pass.cpp | 4 +- .../set/set.cons/move_assign.pass.cpp | 6 +- .../priqueue.cons.alloc/ctor_alloc.pass.cpp | 5 +- .../ctor_comp_alloc.pass.cpp | 5 +- .../ctor_move_alloc.pass.cpp | 6 +- .../priqueue.cons/assign_move.pass.cpp | 6 +- .../ctor_comp_rcontainer.pass.cpp | 6 +- .../ctor_iter_iter_comp_rcont.pass.cpp | 4 +- .../priqueue.cons/ctor_move.pass.cpp | 6 +- .../priqueue.cons/default_noexcept.pass.cpp | 5 +- .../priqueue.cons/move_noexcept.pass.cpp | 4 +- .../priqueue.members/emplace.pass.cpp | 4 +- .../priqueue.members/push_rvalue.pass.cpp | 4 +- .../queue.cons.alloc/ctor_alloc.pass.cpp | 5 +- .../ctor_container_alloc.pass.cpp | 5 +- .../ctor_rcontainer_alloc.pass.cpp | 6 +- .../ctor_rqueue_alloc.pass.cpp | 6 +- .../queue/queue.cons/ctor_move.pass.cpp | 6 +- .../queue/queue.cons/ctor_rcontainer.pass.cpp | 6 +- .../queue.cons/default_noexcept.pass.cpp | 6 +- .../queue/queue.cons/move_noexcept.pass.cpp | 5 +- .../queue/queue.defn/assign_move.pass.cpp | 6 +- .../queue/queue.defn/push_rv.pass.cpp | 4 +- .../stack.cons.alloc/ctor_alloc.pass.cpp | 5 +- .../ctor_container_alloc.pass.cpp | 5 +- .../ctor_rcontainer_alloc.pass.cpp | 6 +- .../ctor_rqueue_alloc.pass.cpp | 6 +- .../stack/stack.cons/ctor_move.pass.cpp | 6 +- .../stack/stack.cons/ctor_rcontainer.pass.cpp | 6 +- .../stack.cons/default_noexcept.pass.cpp | 5 +- .../stack/stack.cons/move_noexcept.pass.cpp | 6 +- .../stack/stack.defn/assign_move.pass.cpp | 6 +- .../stack/stack.defn/push_rv.pass.cpp | 4 +- .../sequences/array/array.size/size.pass.cpp | 4 +- .../assign_initializer_list.pass.cpp | 6 +- .../deque.cons/initializer_list.pass.cpp | 6 +- .../initializer_list_alloc.pass.cpp | 6 +- .../sequences/deque/deque.cons/move.pass.cpp | 6 +- .../deque/deque.cons/move_alloc.pass.cpp | 6 +- .../deque/deque.cons/move_assign.pass.cpp | 6 +- .../op_equal_initializer_list.pass.cpp | 6 +- .../insert_iter_initializer_list.pass.cpp | 4 +- .../deque.modifiers/push_back_rvalue.pass.cpp | 8 +- .../push_front_rvalue.pass.cpp | 8 +- .../forwardlist.cons/assign_init.pass.cpp | 6 +- .../forwardlist.cons/assign_move.pass.cpp | 6 +- .../forwardlist.cons/assign_op_init.pass.cpp | 6 +- .../forwardlist.cons/init.pass.cpp | 6 +- .../forwardlist.cons/init_alloc.pass.cpp | 6 +- .../forwardlist.cons/move.pass.cpp | 6 +- .../forwardlist.cons/size.fail.cpp | 35 - .../forwardlist.cons/size.pass.cpp | 5 + .../emplace_after.pass.cpp | 6 +- .../insert_after_init.pass.cpp | 6 +- .../insert_after_rv.pass.cpp | 6 +- .../forwardlist.modifiers/pop_front.pass.cpp | 6 +- .../push_front_rv.pass.cpp | 6 +- .../assign_initializer_list.pass.cpp | 6 +- .../list/list.cons/assign_move.pass.cpp | 6 +- .../list/list.cons/initializer_list.pass.cpp | 6 +- .../list.cons/initializer_list_alloc.pass.cpp | 6 +- .../list/list.cons/move_alloc.pass.cpp | 6 +- .../op_equal_initializer_list.pass.cpp | 6 +- .../insert_iter_initializer_list.pass.cpp | 6 +- .../list.modifiers/push_back_rvalue.pass.cpp | 6 +- .../list.modifiers/push_front_rvalue.pass.cpp | 6 +- .../assign_initializer_list.pass.cpp | 6 +- .../vector.bool/assign_move.pass.cpp | 6 +- .../vector.bool/emplace_back.pass.cpp | 4 +- .../vector.bool/initializer_list.pass.cpp | 6 +- .../initializer_list_alloc.pass.cpp | 6 +- .../insert_iter_initializer_list.pass.cpp | 6 +- .../sequences/vector.bool/move.pass.cpp | 6 +- .../sequences/vector.bool/move_alloc.pass.cpp | 6 +- .../op_equal_initializer_list.pass.cpp | 6 +- .../vector.bool/vector_bool.pass.cpp | 2 + .../vector.capacity/resize_size.pass.cpp | 51 +- .../assign_initializer_list.pass.cpp | 7 +- .../vector/vector.cons/assign_move.pass.cpp | 6 +- .../vector.cons/initializer_list.pass.cpp | 6 +- .../initializer_list_alloc.pass.cpp | 6 +- .../vector/vector.cons/move.pass.cpp | 6 +- .../vector/vector.cons/move_alloc.pass.cpp | 6 +- .../op_equal_initializer_list.pass.cpp | 6 +- .../vector/vector.modifiers/clear.pass.cpp | 40 + .../vector.modifiers/emplace_extra.pass.cpp | 6 +- .../vector.modifiers/erase_iter.pass.cpp | 28 + .../vector.modifiers/erase_iter_iter.pass.cpp | 28 + .../insert_iter_initializer_list.pass.cpp | 6 +- .../push_back_rvalue.pass.cpp | 6 +- .../unord.map.cnstr/assign_init.pass.cpp | 6 +- .../unord.map.cnstr/assign_move.pass.cpp | 18 +- .../unord.map/unord.map.cnstr/init.pass.cpp | 8 +- .../unord.map.cnstr/init_size.pass.cpp | 6 +- .../unord.map.cnstr/init_size_hash.pass.cpp | 6 +- .../init_size_hash_equal.pass.cpp | 6 +- .../init_size_hash_equal_allocator.pass.cpp | 6 +- .../unord.map.cnstr/move_alloc.pass.cpp | 6 +- .../unord.map.modifiers/emplace.pass.cpp | 6 +- .../unord.map.modifiers/emplace_hint.pass.cpp | 22 +- .../unord.map.modifiers/insert_init.pass.cpp | 6 +- .../unord.multimap.cnstr/assign_init.pass.cpp | 6 +- .../unord.multimap.cnstr/assign_move.pass.cpp | 18 +- .../unord.multimap.cnstr/init.pass.cpp | 8 +- .../unord.multimap.cnstr/init_size.pass.cpp | 6 +- .../init_size_hash.pass.cpp | 6 +- .../init_size_hash_equal.pass.cpp | 6 +- .../init_size_hash_equal_allocator.pass.cpp | 6 +- .../unord.multimap.cnstr/move_alloc.pass.cpp | 6 +- .../unord.multimap.modifiers/emplace.pass.cpp | 6 +- .../emplace_hint.pass.cpp | 22 +- .../insert_init.pass.cpp | 6 +- .../unord/unord.multiset/emplace.pass.cpp | 6 +- .../unord.multiset/emplace_hint.pass.cpp | 19 +- .../insert_hint_rvalue.pass.cpp | 25 +- .../unord/unord.multiset/insert_init.pass.cpp | 6 +- .../unord.multiset/insert_rvalue.pass.cpp | 9 +- .../unord.multiset.cnstr/assign_init.pass.cpp | 6 +- .../unord.multiset.cnstr/assign_move.pass.cpp | 18 +- .../unord.multiset.cnstr/init.pass.cpp | 8 +- .../unord.multiset.cnstr/init_size.pass.cpp | 6 +- .../init_size_hash.pass.cpp | 6 +- .../init_size_hash_equal.pass.cpp | 6 +- .../init_size_hash_equal_allocator.pass.cpp | 6 +- .../unord.multiset.cnstr/move_alloc.pass.cpp | 6 +- .../unord/unord.set/emplace.pass.cpp | 6 +- .../unord/unord.set/emplace_hint.pass.cpp | 19 +- .../unord.set/insert_hint_rvalue.pass.cpp | 25 +- .../unord/unord.set/insert_init.pass.cpp | 6 +- .../unord/unord.set/insert_rvalue.pass.cpp | 9 +- .../unord.set.cnstr/assign_init.pass.cpp | 6 +- .../unord.set.cnstr/assign_move.pass.cpp | 18 +- .../unord.set/unord.set.cnstr/init.pass.cpp | 8 +- .../unord.set.cnstr/init_size.pass.cpp | 6 +- .../unord.set.cnstr/init_size_hash.pass.cpp | 6 +- .../init_size_hash_equal.pass.cpp | 6 +- .../init_size_hash_equal_allocator.pass.cpp | 6 +- .../unord.set.cnstr/move_alloc.pass.cpp | 6 +- ...pointer_to_binary_function.cxx1z.fail.cpp} | 21 +- .../pointer_to_binary_function.pass.cpp | 1 + .../pointer_to_unary_function.cxx1z.fail.cpp} | 22 +- .../pointer_to_unary_function.pass.cpp | 1 + .../ptr_fun1.cxx1z.fail.cpp} | 22 +- .../ptr_fun1.pass.cpp | 1 + .../ptr_fun2.cxx1z.fail.cpp} | 28 +- .../ptr_fun2.pass.cpp | 1 + .../const_mem_fun.cxx1z.fail.cpp | 35 + .../const_mem_fun.pass.cpp | 1 + .../const_mem_fun1.cxx1z.fail.cpp | 35 + .../const_mem_fun1.pass.cpp | 1 + .../const_mem_fun1_ref_t.cxx1z.fail.cpp | 33 + .../const_mem_fun1_ref_t.pass.cpp | 1 + .../const_mem_fun1_t.cxx1z.fail.cpp | 33 + .../const_mem_fun1_t.pass.cpp | 1 + .../const_mem_fun_ref.cxx1z.fail.cpp | 35 + .../const_mem_fun_ref.pass.cpp | 1 + .../const_mem_fun_ref1.cxx1z.fail.cpp | 35 + .../const_mem_fun_ref1.pass.cpp | 1 + .../const_mem_fun_ref_t.cxx1z.fail.cpp | 33 + .../const_mem_fun_ref_t.pass.cpp | 1 + .../const_mem_fun_t.cxx1z.fail.cpp | 33 + .../const_mem_fun_t.pass.cpp | 1 + .../mem_fun.cxx1z.fail.cpp} | 34 +- .../mem_fun.pass.cpp | 1 + .../mem_fun1.cxx1z.fail.cpp | 35 + .../mem_fun1.pass.cpp | 1 + .../mem_fun1_ref_t.cxx1z.fail.cpp | 33 + .../mem_fun1_ref_t.pass.cpp | 1 + .../mem_fun1_t.cxx1z.fail.cpp} | 29 +- .../mem_fun1_t.pass.cpp | 1 + .../mem_fun_ref.cxx1z.fail.cpp | 35 + .../mem_fun_ref.pass.cpp | 1 + .../mem_fun_ref1.cxx1z.fail.cpp | 35 + .../mem_fun_ref1.pass.cpp | 1 + .../mem_fun_ref_t.cxx1z.fail.cpp | 33 + .../mem_fun_ref_t.pass.cpp | 1 + .../mem_fun_t.cxx1z.fail.cpp} | 28 +- .../mem_fun_t.pass.cpp | 1 + .../depr.lib.bind.1st/bind1st.pass.cpp | 1 + .../depr.lib.bind.2nd/bind2nd.pass.cpp | 1 + .../depr.lib.binder.1st/binder1st.pass.cpp | 1 + .../depr.lib.binder.2nd/binder2nd.pass.cpp | 1 + .../overflow.pass.cpp | 4 + .../generic_category.pass.cpp | 9 +- .../system_category.pass.cpp | 9 +- .../syserr/syserr.hash/error_code.pass.cpp | 1 + .../syserr.hash/error_condition.pass.cpp | 1 + .../any/any.class/any.assign/copy.pass.cpp | 7 + .../any/any.class/any.assign/move.pass.cpp | 7 + .../any/any.class/any.assign/value.pass.cpp | 9 +- .../any/any.class/any.cons/copy.pass.cpp | 7 + .../any/any.class/any.cons/move.pass.cpp | 7 + .../any/any.class/any.cons/value.pass.cpp | 9 +- .../any.class/any.modifiers/clear.pass.cpp | 7 + .../any/any.class/any.modifiers/swap.pass.cpp | 7 + .../any.cast/any_cast_reference.pass.cpp | 2 + .../any.cast/not_copy_constructible.fail.cpp | 2 +- .../any/any.nonmembers/swap.pass.cpp | 5 +- .../path.decompose/path.decompose.pass.cpp | 12 +- .../operator_bool.pass.cpp | 58 + .../equal_comp.pass.cpp | 60 + .../less_comp.pass.cpp | 69 + .../coroutine.handle.completion/done.pass.cpp | 44 + .../coroutine.handle.con/assign.pass.cpp | 54 + .../coroutine.handle.con/construct.pass.cpp | 53 + .../coroutine.handle.export/address.pass.cpp | 51 + .../from_address.fail.cpp | 46 + .../from_address.pass.cpp | 46 + .../coroutine.handle.hash/hash.pass.cpp | 63 + .../coroutine.handle.prom/promise.pass.cpp | 49 + .../destroy.pass.cpp | 61 + .../resume.pass.cpp | 80 + .../coroutine.handle/void_handle.pass.cpp | 51 + .../coroutine.traits/promise_type.pass.cpp | 77 + .../suspend_always.pass.cpp | 73 + .../suspend_never.pass.cpp | 75 + .../end.to.end/await_result.pass.cpp | 69 + .../end.to.end/bool_await_suspend.pass.cpp | 69 + .../end.to.end/expected.pass.cpp | 89 + .../end.to.end/fullexpr-dtor.pass.cpp | 117 ++ .../end.to.end/generator.pass.cpp | 103 ++ .../support.coroutines/end.to.end/go.pass.cpp | 176 ++ .../end.to.end/multishot_func.pass.cpp | 87 + .../end.to.end/oneshot_func.pass.cpp | 83 + .../support.coroutines/includes.pass.cpp | 25 + .../support.coroutines/lit.local.cfg | 9 + .../default.pass.cpp | 6 + .../derive.pass.cpp | 6 + .../optional.object.observe/value.pass.cpp | 7 + .../value_const.pass.cpp | 7 + .../meta.type.synop/meta.unary.prop.pass.cpp | 6 + .../lit.local.cfg | 2 - .../filebuf.assign/move_assign.pass.cpp | 4 +- .../fstreams/filebuf.cons/move.pass.cpp | 4 +- .../fstream.assign/member_swap.pass.cpp | 24 +- .../fstream.assign/move_assign.pass.cpp | 4 +- .../fstream.assign/nonmember_swap.pass.cpp | 25 +- .../fstreams/fstream.cons/move.pass.cpp | 4 +- .../ifstream.assign/move_assign.pass.cpp | 4 +- .../fstreams/ifstream.cons/move.pass.cpp | 4 +- .../ofstream.assign/member_swap.pass.cpp | 24 +- .../ofstream.assign/move_assign.pass.cpp | 4 +- .../ofstream.assign/nonmember_swap.pass.cpp | 24 +- .../fstreams/ofstream.cons/move.pass.cpp | 4 +- .../iostream.assign/move_assign.pass.cpp | 6 +- .../iostreamclass/iostream.cons/move.pass.cpp | 6 +- .../pointer.pass.cpp | 4 + .../istream.unformatted/get.pass.cpp | 2 + .../istream.unformatted/get_chart.pass.cpp | 2 + .../istream.unformatted/ignore_0xff.pass.cpp | 3 + .../istream.unformatted/read.pass.cpp | 2 + .../istream.unformatted/readsome.pass.cpp | 3 + .../istream.unformatted/seekg.pass.cpp | 3 + .../istream.unformatted/seekg_off.pass.cpp | 7 + .../istream.assign/move_assign.pass.cpp | 6 +- .../ostream.assign/move_assign.pass.cpp | 6 +- .../output.streams/ostream.cons/move.pass.cpp | 6 +- .../minmax_showbase.pass.cpp | 97 + .../minus1.pass.cpp | 2 + .../ostream.rvalue/CharT_pointer.pass.cpp | 6 +- .../istringstream.assign/move.pass.cpp | 4 +- .../istringstream.cons/move.pass.cpp | 4 +- .../ostringstream.assign/move.pass.cpp | 4 +- .../ostringstream.cons/move.pass.cpp | 4 +- .../stringstream.cons/move.pass.cpp | 4 +- .../stringstream.cons/move2.pass.cpp | 4 +- .../stringstream.assign/move.pass.cpp | 4 +- .../iterator.operations/advance.pass.cpp | 33 +- .../iterator.operations/distance.pass.cpp | 21 + .../iterator.operations/next.pass.cpp | 34 + .../iterator.operations/prev.pass.cpp | 31 + .../istream.iterator/types.pass.cpp | 18 + .../ostream.iterator/types.pass.cpp | 18 + .../ostreambuf.iterator/types.pass.cpp | 18 + .../delete_align_val_t_replace.pass.cpp | 16 +- .../new.delete.array/new_align_val_t.pass.cpp | 19 +- .../new_align_val_t_nothrow.pass.cpp | 14 +- .../new_align_val_t_nothrow_replace.pass.cpp | 14 +- .../new_align_val_t_replace.pass.cpp | 3 +- ...zed_delete_array_fsizeddeallocation.sh.cpp | 6 + .../delete_align_val_t_replace.pass.cpp | 16 +- .../new_align_val_t.pass.cpp | 14 +- .../new_align_val_t_nothrow.pass.cpp | 14 +- .../new_align_val_t_nothrow_replace.pass.cpp | 15 +- .../new_align_val_t_replace.pass.cpp | 3 +- .../sized_delete_fsizeddeallocation.sh.cpp | 5 + .../except.nested/rethrow_if_nested.pass.cpp | 6 +- .../except.nested/throw_with_nested.pass.cpp | 10 + .../propagation/current_exception.pass.cpp | 4 + .../propagation/make_exception_ptr.pass.cpp | 6 + .../propagation/rethrow_exception.pass.cpp | 6 + .../uncaught/uncaught_exceptions.pass.cpp | 8 + .../support.initlist/include_cxx03.pass.cpp} | 11 +- .../support.initlist.access/access.pass.cpp | 8 +- .../support.initlist.cons/default.pass.cpp | 5 +- .../support.initlist.range/begin_end.pass.cpp | 7 +- .../support.initlist/types.pass.cpp | 4 +- .../support.types/byte.pass.cpp | 30 + .../support.types/byteops/and.assign.pass.cpp | 39 + .../support.types/byteops/and.pass.cpp | 31 + .../byteops/enum_direct_init.pass.cpp} | 25 +- .../byteops/lshift.assign.fail.cpp | 31 + .../byteops/lshift.assign.pass.cpp | 36 + .../support.types/byteops/lshift.fail.cpp | 23 + .../support.types/byteops/lshift.pass.cpp | 30 + .../support.types/byteops/not.pass.cpp | 27 + .../support.types/byteops/or.assign.pass.cpp | 40 + .../support.types/byteops/or.pass.cpp | 31 + .../byteops/rshift.assign.fail.cpp | 31 + .../byteops/rshift.assign.pass.cpp | 35 + .../support.types/byteops/rshift.fail.cpp | 23 + .../support.types/byteops/rshift.pass.cpp | 37 + .../support.types/byteops/to_integer.fail.cpp | 23 + .../support.types/byteops/to_integer.pass.cpp | 31 + .../support.types/byteops/xor.assign.pass.cpp | 39 + .../support.types/byteops/xor.pass.cpp | 31 + .../category.ctype/ctype_base.pass.cpp | 4 +- .../locale.ctype.byname/tolower_1.pass.cpp | 3 - .../locale.ctype.byname/tolower_many.pass.cpp | 3 - .../locale.ctype.byname/toupper_1.pass.cpp | 3 - .../locale.ctype.byname/toupper_many.pass.cpp | 3 - .../get_long_double_ru_RU.pass.cpp | 3 +- .../put_long_double_ru_RU.pass.cpp | 3 +- .../locale.moneypunct/types.pass.cpp | 4 +- .../facet.num.get.members/get_double.pass.cpp | 6 +- .../facet.num.get.members/get_float.pass.cpp | 15 + .../get_long_double.pass.cpp | 15 + .../locale.stdcvt/codecvt_utf16_out.pass.cpp | 626 +++---- .../locale.stdcvt/codecvt_utf8_out.pass.cpp | 708 +++----- .../codecvt_utf8_utf16_in.pass.cpp | 546 +++--- .../codecvt_utf8_utf16_out.pass.cpp | 648 +++---- .../conversions.string/converted.pass.cpp | 39 +- .../conversions.string/from_bytes.pass.cpp | 65 +- .../conversions.string/to_bytes.pass.cpp | 65 +- .../locale_char_pointer_cat.pass.cpp | 4 + .../locale.cons/locale_locale_cat.pass.cpp | 4 + .../locale.cons/locale_string_cat.pass.cpp | 4 + .../locale.category/category.pass.cpp | 4 +- test/std/numerics/c.math/cmath.pass.cpp | 33 + .../complex.literals/literals.pass.cpp | 2 + .../complex.literals/literals1.fail.cpp | 2 + .../complex.members/construct.pass.cpp | 4 +- .../complex.ops/stream_input.pass.cpp | 2 + .../double_float_explicit.pass.cpp | 4 +- .../double_float_implicit.pass.cpp | 4 +- .../double_long_double_explicit.pass.cpp | 4 +- .../float_double_explicit.pass.cpp | 4 +- .../float_long_double_explicit.pass.cpp | 4 +- .../long_double_double_explicit.pass.cpp | 4 +- .../long_double_double_implicit.pass.cpp | 4 +- .../long_double_float_explicit.pass.cpp | 4 +- .../long_double_float_implicit.pass.cpp | 4 +- .../initializer_list_assign.pass.cpp | 4 +- .../valarray.cons/initializer_list.pass.cpp | 4 +- .../numeric.ops/numeric.ops.gcd/gcd.pass.cpp | 45 +- .../numeric.ops/numeric.ops.lcm/lcm.pass.cpp | 49 +- .../rand.adapt.disc/values.pass.cpp | 2 + .../rand.adapt.ibits/values.pass.cpp | 2 + .../rand.adapt.shuf/values.pass.cpp | 2 + .../numerics/rand/rand.device/ctor.pass.cpp | 8 + .../numerics/rand/rand.device/eval.pass.cpp | 8 + .../ctor_init.pass.cpp | 4 +- .../param_ctor_default.pass.cpp | 4 +- .../param_ctor_init.pass.cpp | 4 +- .../ctor_default.pass.cpp | 4 +- .../ctor_init_func.pass.cpp | 4 +- .../param_ctor_init_func.pass.cpp | 4 +- .../ctor_default.pass.cpp | 4 +- .../ctor_init_func.pass.cpp | 4 +- .../param_ctor_init_func.pass.cpp | 4 +- .../rand.eng/rand.eng.lcong/values.pass.cpp | 2 + .../rand.eng/rand.eng.mers/values.pass.cpp | 2 + .../rand.eng/rand.eng.sub/values.pass.cpp | 2 + .../initializer_list.pass.cpp | 4 +- test/std/re/re.alg/re.alg.match/awk.pass.cpp | 97 +- .../re.tokiter/re.tokiter.cnstr/init.pass.cpp | 4 +- .../re.regex.assign/assign.il.pass.cpp | 4 +- .../re/re.regex/re.regex.assign/il.pass.cpp | 4 +- .../re.regex.construct/il_flg.pass.cpp | 6 +- .../re/re.traits/lookup_classname.pass.cpp | 68 +- .../re/re.traits/translate_nocase.pass.cpp | 4 +- .../basic.string.hash/strings.pass.cpp | 4 + .../string.capacity/over_max_size.pass.cpp | 6 + .../string.cons/T_size_size.pass.cpp | 19 +- .../string_append/iterator.pass.cpp | 16 + .../string_erase/iter.pass.cpp | 1 + .../string_erase/iter_iter.pass.cpp | 1 + .../string_erase/pop_back.pass.cpp | 1 + .../string_erase/size_size.pass.cpp | 3 + .../iter_initializer_list.pass.cpp | 17 +- .../string_insert/iter_iter_iter.pass.cpp | 33 +- .../iter_iter_initializer_list.pass.cpp | 6 +- .../string.io/get_line_delim_rv.pass.cpp | 6 +- .../string.io/get_line_rv.pass.cpp | 6 +- .../string_op+/char_string.pass.cpp | 48 +- .../string_op+/pointer_string.pass.cpp | 83 +- .../string_op+/string_char.pass.cpp | 48 +- .../string_op+/string_pointer.pass.cpp | 84 +- .../string_op+/string_string.pass.cpp | 181 +- .../basic.string/traits_mismatch.fail.cpp} | 14 +- .../strings/string.conversions/stof.pass.cpp | 5 +- .../strings/string.conversions/stol.pass.cpp | 5 +- .../strings/string.conversions/stoll.pass.cpp | 5 +- .../strings/string.conversions/stoul.pass.cpp | 5 +- .../string.conversions/stoull.pass.cpp | 5 +- .../string.view.hash/string_view.pass.cpp | 3 + .../string.view.modifiers/clear.pass.cpp | 67 - .../string.view/traits_mismatch.fail.cpp | 18 + .../futures.future_error/what.pass.cpp | 8 +- .../ctor_func_alloc.pass.cpp | 2 +- .../thread.lock.algorithm/lock.pass.cpp | 4 +- .../thread.lock.algorithm/try_lock.pass.cpp | 4 +- .../thread.lock.guard/mutex.pass.cpp | 10 + .../variadic_mutex_cxx03.pass.cpp | 21 - .../adopt_lock.pass.cpp} | 25 +- .../assign.fail.cpp} | 21 +- .../copy.fail.cpp} | 20 +- .../mutex.fail.cpp} | 21 +- .../mutex.pass.cpp} | 61 +- .../types.pass.cpp} | 25 +- .../thread.lock.shared/lit.local.cfg | 2 + .../thread.lock.shared.cons/mutex.pass.cpp | 8 + .../thread.lock.unique.cons/mutex.pass.cpp | 10 + .../thread.mutex.class/default.pass.cpp | 2 + .../lit.local.cfg | 2 + .../lit.local.cfg | 2 + .../thread.once.callonce/call_once.pass.cpp | 17 +- .../thread.once.onceflag/default.pass.cpp | 3 +- .../thread.thread.id/thread_id.pass.cpp | 3 + .../sleep_for_tested_elsewhere.pass.cpp} | 21 +- .../allocator.adaptor.cnstr/allocs.pass.cpp | 8 +- .../construct_pair.pass.cpp | 5 +- .../any/any.class/any.assign/copy.pass.cpp | 7 + .../any/any.class/any.assign/move.pass.cpp | 7 + .../any/any.class/any.assign/value.pass.cpp | 7 + .../any/any.class/any.cons/copy.pass.cpp | 7 + .../any.class/any.cons/in_place_type.pass.cpp | 7 + .../any/any.class/any.cons/move.pass.cpp | 7 + .../any/any.class/any.cons/value.pass.cpp | 9 +- .../any.class/any.modifiers/emplace.pass.cpp | 55 +- .../any.class/any.modifiers/reset.pass.cpp | 7 + .../any/any.class/any.modifiers/swap.pass.cpp | 7 + .../any.cast/any_cast_pointer.pass.cpp | 7 + .../any.cast/any_cast_reference.pass.cpp | 7 + .../any.cast/reference_types.fail.cpp | 33 +- .../any/any.nonmembers/make_any.pass.cpp | 7 + .../any/any.nonmembers/swap.pass.cpp | 7 + .../func.not_fn/not_fn.pass.cpp | 2 +- .../func.wrap.func.con/copy_move.pass.cpp | 3 +- .../func.wrap.func.targ/target.pass.cpp | 4 + .../function.objects/unord.hash/enum.pass.cpp | 1 + .../unord.hash/floating.pass.cpp | 3 + .../unord.hash/integral.pass.cpp | 51 +- .../unord.hash/pointer.pass.cpp | 16 + .../unique.ptr.runtime/move01.pass.cpp | 79 - .../unique.ptr.runtime/move03.fail.cpp | 57 - .../unique.ptr.runtime/move04.fail.cpp | 57 - .../move_convert01.fail.cpp | 57 - .../move_convert02.fail.cpp | 61 - .../move_convert03.fail.cpp | 62 - .../move_convert04.fail.cpp | 57 - .../move_convert05.fail.cpp | 61 - .../move_convert06.fail.cpp | 62 - .../move_convert07.fail.cpp | 56 - .../move_convert08.fail.cpp | 60 - .../move_convert09.fail.cpp | 62 - .../unique.ptr.runtime/null_ctor.pass.cpp | 55 - .../unique.ptr.runtime/nullptr_asgn.pass.cpp | 41 - .../default01.fail.cpp | 38 - .../default01.pass.cpp | 47 - .../default02.fail.cpp | 30 - .../default02.pass.cpp | 87 - .../unique.ptr.runtime.ctor/move01.fail.cpp | 42 - .../unique.ptr.runtime.ctor/move01.pass.cpp | 70 - .../unique.ptr.runtime.ctor/move02.fail.cpp | 42 - .../unique.ptr.runtime.ctor/move02.pass.cpp | 72 - .../unique.ptr.runtime.ctor/move03.fail.cpp | 55 - .../unique.ptr.runtime.ctor/move04.fail.cpp | 55 - .../move_convert01.fail.cpp | 57 - .../move_convert02.fail.cpp | 61 - .../move_convert03.fail.cpp | 78 - .../move_convert04.fail.cpp | 57 - .../move_convert05.fail.cpp | 61 - .../move_convert06.fail.cpp | 78 - .../move_convert07.fail.cpp | 57 - .../move_convert08.fail.cpp | 61 - .../move_convert09.fail.cpp | 78 - .../move_convert10.fail.cpp | 57 - .../move_convert11.fail.cpp | 61 - .../move_convert12.fail.cpp | 78 - .../move_convert13.fail.cpp | 57 - .../move_convert14.fail.cpp | 61 - .../move_convert15.fail.cpp | 78 - .../move_convert16.fail.cpp | 57 - .../move_convert17.fail.cpp | 61 - .../move_convert18.fail.cpp | 78 - .../unique.ptr.runtime.ctor/nullptr.pass.cpp | 46 - .../pointer01.fail.cpp | 36 - .../pointer01.pass.cpp | 63 - .../pointer02.pass.cpp | 95 - .../pointer03.fail.cpp | 23 - .../pointer04.fail.cpp | 67 - .../pointer_deleter01.pass.cpp | 51 - .../pointer_deleter02.pass.cpp | 64 - .../pointer_deleter03.pass.cpp | 65 - .../pointer_deleter04.fail.cpp | 33 - .../pointer_deleter04.pass.cpp | 63 - .../pointer_deleter05.fail.cpp | 58 - .../reset1.pass.cpp | 50 - .../reset2.fail.cpp | 64 - .../swap.pass.cpp | 56 - .../get_deleter.pass.cpp | 37 - .../index.pass.cpp | 47 - .../unique.ptr.single/pointer_type.pass.cpp | 55 - .../unique.ptr.single.asgn/move01.pass.cpp | 75 - .../unique.ptr.single.asgn/move02.fail.cpp | 33 - .../unique.ptr.single.asgn/move03.fail.cpp | 33 - .../unique.ptr.single.asgn/move04.fail.cpp | 36 - .../move_convert.pass.cpp | 89 - .../move_convert01.fail.cpp | 42 - .../move_convert02.fail.cpp | 43 - .../move_convert03.fail.cpp | 47 - .../move_convert04.fail.cpp | 43 - .../move_convert05.fail.cpp | 61 - .../move_convert06.fail.cpp | 62 - .../auto_pointer01.fail.cpp | 67 - .../auto_pointer02.fail.cpp | 61 - .../unique.ptr.single.ctor/default.pass.cpp | 86 - .../unique.ptr.single.ctor/default01.fail.cpp | 35 - .../unique.ptr.single.ctor/default02.fail.cpp | 29 - .../unique.ptr.single.ctor/default03.fail.cpp | 23 - .../unique.ptr.single.ctor/move.pass.cpp | 140 -- .../unique.ptr.single.ctor/move01.fail.cpp | 42 - .../unique.ptr.single.ctor/move02.fail.cpp | 42 - .../unique.ptr.single.ctor/move03.fail.cpp | 55 - .../unique.ptr.single.ctor/move04.fail.cpp | 55 - .../move_convert.pass.cpp | 171 -- .../move_convert01.fail.cpp | 56 - .../move_convert02.fail.cpp | 62 - .../move_convert03.fail.cpp | 79 - .../move_convert04.fail.cpp | 58 - .../move_convert05.fail.cpp | 51 - .../move_convert06.fail.cpp | 79 - .../move_convert07.fail.cpp | 58 - .../move_convert08.fail.cpp | 86 - .../move_convert09.fail.cpp | 79 - .../move_convert10.fail.cpp | 58 - .../move_convert11.fail.cpp | 86 - .../move_convert12.fail.cpp | 79 - .../unique.ptr.single.ctor/nullptr.pass.cpp | 46 - .../unique.ptr.single.ctor/pointer.pass.cpp | 163 -- .../unique.ptr.single.ctor/pointer01.fail.cpp | 35 - .../unique.ptr.single.ctor/pointer02.fail.cpp | 29 - .../unique.ptr.single.ctor/pointer03.fail.cpp | 23 - .../pointer_deleter.pass.cpp | 123 -- .../release.pass.cpp | 27 - .../reset1.pass.cpp | 50 - .../unique.ptr.single.modifiers/swap.pass.cpp | 59 - .../explicit_bool.pass.cpp | 39 - .../get_deleter.pass.cpp | 37 - .../enable_shared_from_this.pass.cpp | 10 + .../hash_unique_ptr.pass.cpp | 7 +- .../atomic_compare_exchange_strong.pass.cpp | 4 +- ..._compare_exchange_strong_explicit.pass.cpp | 4 +- .../atomic_compare_exchange_weak.pass.cpp | 4 +- ...ic_compare_exchange_weak_explicit.pass.cpp | 4 +- .../atomic_exchange.pass.cpp | 4 +- .../atomic_exchange_explicit.pass.cpp | 4 +- .../atomic_load.pass.cpp | 4 +- .../atomic_load_explicit.pass.cpp | 4 +- .../atomic_store.pass.cpp | 4 +- .../atomic_store_explicit.pass.cpp | 4 +- .../auto_ptr.pass.cpp | 1 + .../unique_ptr.pass.cpp | 1 + .../make_shared.pass.cpp | 21 + .../owner_before_shared_ptr.pass.cpp | 4 +- .../owner_before_weak_ptr.pass.cpp | 4 +- .../owner_less.pass.cpp | 30 +- .../owner_before_shared_ptr.pass.cpp | 5 +- .../owner_before_weak_ptr.pass.cpp | 5 +- .../meta/meta.help/integral_constant.pass.cpp | 6 +- .../meta/meta.rel/is_convertible.pass.cpp | 4 +- .../meta.trans.other/aligned_union.pass.cpp | 4 +- .../meta.trans.other/common_type.pass.cpp | 25 + .../meta.trans.other/decay.pass.cpp | 6 + .../meta.unary.cat/is_function.pass.cpp | 15 +- .../member_function_pointer.pass.cpp | 21 +- .../meta.unary.prop/is_aggregate.pass.cpp | 79 + .../meta.unary.prop/is_constructible.pass.cpp | 1 + .../is_trivially_copyable.pass.cpp | 12 +- .../default.pass.cpp | 7 + .../optional.comp_with_t/equal.pass.cpp | 61 +- .../optional.comp_with_t/greater.pass.cpp | 63 +- .../greater_equal.pass.cpp | 65 +- .../optional.comp_with_t/less_equal.pass.cpp | 65 +- .../optional.comp_with_t/less_than.pass.cpp | 63 +- .../optional.comp_with_t/not_equal.pass.cpp | 61 +- .../optional/optional.hash/hash.pass.cpp | 15 +- .../assign_value.pass.cpp | 1 - .../optional.object.assign/emplace.pass.cpp | 68 +- .../emplace_initializer_list.pass.cpp | 18 +- .../optional.object.ctor/U.pass.cpp | 21 + .../optional.object.ctor/const_T.pass.cpp | 7 + .../optional.object.ctor/copy.fail.cpp | 36 + .../optional.object.ctor/copy.pass.cpp | 20 +- .../optional.object.ctor/move.fail.cpp | 37 + .../optional.object.ctor/move.pass.cpp | 29 +- .../optional.object.ctor/rvalue_T.pass.cpp | 7 + .../optional.object.observe/value.pass.cpp | 8 + .../value_const.pass.cpp | 8 + .../value_const_rvalue.pass.cpp | 8 + .../optional.object.observe/value_or.pass.cpp | 20 +- .../value_rvalue.pass.cpp | 7 + .../optional/optional.relops/equal.pass.cpp | 96 +- .../optional.relops/greater_equal.pass.cpp | 95 +- .../optional.relops/greater_than.pass.cpp | 93 +- .../optional.relops/less_equal.pass.cpp | 95 +- .../optional.relops/less_than.pass.cpp | 93 +- .../optional.relops/not_equal.pass.cpp | 96 +- .../utilities/smartptr/unique.ptr/README.TXT | 16 + .../unique.ptr/nothing_to_do.pass.cpp | 0 .../unique.ptr.class/pointer_type.pass.cpp | 61 + .../unique.ptr.asgn/move.pass.cpp | 120 ++ .../unique.ptr.asgn/move_convert.pass.cpp | 420 +++++ .../move_convert.runtime.pass.cpp | 121 ++ .../move_convert.single.pass.cpp | 145 ++ .../unique.ptr.asgn}/null.pass.cpp | 36 +- .../unique.ptr.asgn}/nullptr.pass.cpp | 33 +- .../unique.ptr.ctor}/auto_pointer.pass.cpp | 75 +- .../unique.ptr.ctor/default.pass.cpp | 107 ++ .../unique.ptr.ctor/move.pass.cpp | 174 ++ .../unique.ptr.ctor/move_convert.pass.cpp | 219 +++ .../move_convert.runtime.pass.cpp | 83 + .../move_convert.single.pass.cpp | 248 +++ .../unique.ptr.ctor/null.pass.cpp | 74 + .../unique.ptr.ctor/nullptr.pass.cpp | 106 ++ .../unique.ptr.ctor/pointer.pass.cpp | 171 ++ .../unique.ptr.ctor/pointer_deleter.fail.cpp} | 9 +- .../unique.ptr.ctor/pointer_deleter.pass.cpp | 328 ++++ .../unique.ptr.dtor}/null.pass.cpp | 38 +- .../unique.ptr.modifiers/release.pass.cpp | 56 + .../unique.ptr.modifiers/reset.pass.cpp | 117 ++ .../reset.runtime.fail.cpp} | 31 +- .../reset.single.pass.cpp} | 40 +- .../unique.ptr.modifiers}/reset_self.pass.cpp | 14 +- .../unique.ptr.modifiers/swap.pass.cpp | 88 + .../dereference.runtime.fail.cpp} | 25 +- .../dereference.single.pass.cpp} | 7 +- .../explicit_bool.pass.cpp | 66 + .../unique.ptr.observers/get.pass.cpp | 51 + .../unique.ptr.observers/get_deleter.pass.cpp | 65 + .../op_arrow.runtime.fail.cpp | 32 + .../op_arrow.single.pass.cpp} | 14 +- .../op_subscript.runtime.pass.cpp} | 43 +- .../op_subscript.single.fail.cpp | 24 + .../make_unique.array.pass.cpp | 0 .../make_unique.array1.fail.cpp | 0 .../make_unique.array2.fail.cpp | 0 .../make_unique.array3.fail.cpp | 0 .../make_unique.array4.fail.cpp | 0 .../make_unique.single.pass.cpp | 0 .../unique.ptr.dltr/nothing_to_do.pass.cpp | 0 .../convert_ctor.pass.cpp | 0 .../unique.ptr.dltr.dflt/default.pass.cpp | 0 .../unique.ptr.dltr.dflt/incomplete.fail.cpp | 0 .../unique.ptr.dltr.dflt/void.fail.cpp | 0 .../convert_ctor.fail.cpp | 0 .../convert_ctor.pass.cpp | 0 .../unique.ptr.dltr.dflt1/default.pass.cpp | 0 .../unique.ptr.dltr.dflt1/incomplete.fail.cpp | 0 .../nothing_to_do.pass.cpp | 0 .../unique.ptr.special/cmp_nullptr.pass.cpp | 0 .../unique.ptr/unique.ptr.special/eq.pass.cpp | 0 .../unique.ptr.special/rel.pass.cpp | 0 .../unique.ptr.special/swap.pass.cpp | 0 .../bitset.cons/char_ptr_ctor.pass.cpp | 4 + .../bitset.cons/default.pass.cpp | 4 + .../bitset.cons/string_ctor.pass.cpp | 4 + .../bitset.cons/ull_ctor.pass.cpp | 4 + .../bitset.hash/bitset.pass.cpp | 2 + .../bitset.members/count.pass.cpp | 6 +- .../bitset.members/flip_all.pass.cpp | 6 +- .../bitset.members/flip_one.pass.cpp | 4 + .../bitset.members/index.pass.cpp | 6 +- .../bitset.members/index_const.pass.cpp | 6 +- .../bitset.members/left_shift.pass.cpp | 6 +- .../bitset.members/left_shift_eq.pass.cpp | 6 +- .../bitset.members/not_all.pass.cpp | 6 +- .../bitset.members/op_and_eq.pass.cpp | 6 +- .../bitset.members/op_eq_eq.pass.cpp | 6 +- .../bitset.members/op_or_eq.pass.cpp | 6 +- .../bitset.members/op_xor_eq.pass.cpp | 6 +- .../bitset.members/reset_all.pass.cpp | 6 +- .../bitset.members/right_shift.pass.cpp | 6 +- .../bitset.members/right_shift_eq.pass.cpp | 6 +- .../bitset.members/set_all.pass.cpp | 6 +- .../bitset.members/test.pass.cpp | 4 + .../bitset.members/to_string.pass.cpp | 6 +- .../bitset.operators/op_and.pass.cpp | 6 +- .../bitset.operators/op_not.pass.cpp | 6 +- .../bitset.operators/op_or.pass.cpp | 6 +- .../template.bitset/includes.pass.cpp | 35 +- .../time.clock.hires/consistency.pass.cpp | 10 +- .../time.clock.steady/consistency.pass.cpp | 9 +- .../time.clock.system/consistency.pass.cpp | 10 +- .../time.duration.arithmetic/op_+.pass.cpp | 17 +- .../time.duration.arithmetic/op_-.pass.cpp | 18 +- .../time.duration.cast/duration_cast.pass.cpp | 4 +- .../op_equal.pass.cpp | 4 +- .../op_less.pass.cpp | 4 +- .../time.duration.cons/convert_exact.pass.cpp | 4 +- .../convert_inexact.pass.cpp | 4 +- .../convert_int_to_float.pass.cpp | 4 +- .../time.duration.cons/default.pass.cpp | 3 +- .../time.duration.cons/rep.pass.cpp | 3 +- .../time.duration.cons/rep02.pass.cpp | 4 +- .../time.duration.nonmember/op_+.pass.cpp | 4 +- .../time.duration.nonmember/op_-.pass.cpp | 4 +- .../op_divide_duration.pass.cpp | 4 +- .../op_divide_rep.pass.cpp | 4 +- .../op_mod_duration.pass.cpp | 4 +- .../op_mod_rep.pass.cpp | 4 +- .../op_times_rep.pass.cpp | 4 +- .../time.duration.special/max.pass.cpp | 3 +- .../time.duration.special/min.pass.cpp | 3 +- .../time.duration.special/zero.pass.cpp | 3 +- .../time.traits.duration_values/max.pass.cpp | 3 +- .../time.traits.duration_values/min.pass.cpp | 3 +- .../time.traits.duration_values/zero.pass.cpp | 3 +- .../tuple.tuple/tuple.cnstr/default.pass.cpp | 2 - .../tuple.tuple/tuple.cnstr/dtor.pass.cpp | 4 + .../piecewise_construct.pass.cpp | 4 +- .../utility/pairs/pairs.pair/dtor.pass.cpp | 4 + .../pairs/pairs.pair/piecewise.pass.cpp | 4 +- .../bad_variant_access.pass.cpp | 7 + .../variant/variant.get/get_index.pass.cpp | 7 + .../variant/variant.get/get_type.pass.cpp | 7 + .../variant/variant.hash/hash.pass.cpp | 7 +- .../variant.variant/variant.assign/T.pass.cpp | 41 +- .../variant.assign/copy.pass.cpp | 255 ++- .../variant.assign/move.pass.cpp | 206 ++- .../variant.ctor/copy.pass.cpp | 117 +- .../variant.ctor/default.pass.cpp | 7 + .../variant.ctor/in_place_index_args.pass.cpp | 7 + .../variant.ctor/in_place_type_args.pass.cpp | 7 + .../variant.ctor/move.pass.cpp | 147 +- .../variant.mod/emplace_index_args.pass.cpp | 50 +- .../emplace_index_init_list_args.pass.cpp | 21 +- .../variant.mod/emplace_type_args.pass.cpp | 49 +- .../emplace_type_init_list_args.pass.cpp | 21 +- .../variant.swap/swap.pass.cpp | 7 + .../variant/variant.visit/visit.pass.cpp | 17 + test/support/Counter.h | 4 +- test/support/MoveOnly.h | 4 +- test/support/allocators.h | 4 +- test/support/archetypes.hpp | 9 + test/support/archetypes.ipp | 4 + test/support/coroutine_types.h | 75 + test/support/deleter_types.h | 4 + .../support/filesystem_dynamic_test_helper.py | 2 +- test/support/filesystem_test_helper.hpp | 4 +- test/support/msvc_stdlib_force_include.hpp | 49 +- test/support/nasty_containers.hpp | 34 +- test/support/nasty_macros.hpp | 8 + test/support/poisoned_hash_helper.hpp | 1 + ...c1xx_broken_is_trivially_copyable.pass.cpp | 35 + .../c1xx_broken_za_ctor_check.pass.cpp | 41 + test/support/test_iterators.h | 128 +- test/support/test_macros.h | 33 +- test/support/test_workarounds.h | 27 + test/support/tracked_value.h | 6 +- test/support/unique_ptr_test_helper.h | 158 ++ test/support/uses_alloc_types.hpp | 1 + test/support/variant_test_helpers.hpp | 4 +- utils/google-benchmark/AUTHORS | 3 + utils/google-benchmark/CMakeLists.txt | 28 +- utils/google-benchmark/CONTRIBUTORS | 3 + utils/google-benchmark/README.md | 66 +- .../cmake/AddCXXCompilerFlag.cmake | 35 +- .../cmake/CXXFeatureCheck.cmake | 2 +- utils/google-benchmark/cmake/Config.cmake.in | 1 + utils/google-benchmark/docs/tools.md | 59 + .../include/benchmark/benchmark_api.h | 97 +- .../include/benchmark/reporter.h | 13 +- utils/google-benchmark/mingw.py | 320 ++++ utils/google-benchmark/src/CMakeLists.txt | 45 +- utils/google-benchmark/src/benchmark.cc | 37 +- .../src/benchmark_api_internal.h | 2 + .../src/benchmark_register.cc | 35 +- utils/google-benchmark/src/complexity.cc | 40 + .../google-benchmark/src/console_reporter.cc | 33 +- utils/google-benchmark/src/counter.cc | 68 + utils/google-benchmark/src/counter.h | 26 + utils/google-benchmark/src/csv_reporter.cc | 58 +- utils/google-benchmark/src/cycleclock.h | 31 +- utils/google-benchmark/src/internal_macros.h | 19 +- utils/google-benchmark/src/json_reporter.cc | 7 +- utils/google-benchmark/src/re.h | 16 +- utils/google-benchmark/src/sleep.cc | 3 +- utils/google-benchmark/src/sleep.h | 12 +- utils/google-benchmark/src/string_util.cc | 20 +- utils/google-benchmark/src/sysinfo.cc | 9 +- utils/google-benchmark/src/timers.cc | 45 +- utils/google-benchmark/test/CMakeLists.txt | 19 + utils/google-benchmark/test/benchmark_test.cc | 22 +- utils/google-benchmark/test/cxx03_test.cc | 6 + .../google-benchmark/test/diagnostics_test.cc | 2 +- utils/google-benchmark/test/options_test.cc | 24 +- .../test/output_test_helper.cc | 12 +- .../test/reporter_output_test.cc | 6 +- utils/google-benchmark/tools/compare_bench.py | 58 +- .../tools/gbench/Inputs/test1_run1.json | 14 + .../tools/gbench/Inputs/test1_run2.json | 14 + utils/google-benchmark/tools/gbench/report.py | 21 +- utils/google-benchmark/tools/gbench/util.py | 61 +- utils/libcxx/compiler.py | 3 +- utils/libcxx/test/config.py | 197 ++- utils/libcxx/test/executor.py | 34 +- utils/libcxx/test/format.py | 24 +- utils/libcxx/test/target_info.py | 81 +- www/cxx1z_status.html | 70 +- 1102 files changed, 19092 insertions(+), 14798 deletions(-) create mode 100644 appveyor-reqs-install.cmd create mode 100644 appveyor.yml create mode 100644 docs/DesignDocs/AvailabilityMarkup.rst rename include/{__undef_min_max => __undef_macros} (76%) create mode 100644 include/experimental/coroutine create mode 100644 include/support/fuchsia/xlocale.h rename include/support/win32/{limits_win32.h => limits_msvc_win32.h} (80%) delete mode 100644 include/support/win32/locale_mgmt_win32.h delete mode 100644 include/support/win32/support.h create mode 100644 lib/libc++abi-new-delete.exp create mode 100644 src/functional.cpp create mode 100644 src/support/runtime/exception_pointer_msvc.ipp create mode 100644 test/libcxx/algorithms/alg.modifying.operations/alg.random.shuffle/random_shuffle.cxx1z.pass.cpp create mode 100644 test/libcxx/containers/unord/next_pow2.pass.cpp create mode 100644 test/libcxx/depr/depr.function.objects/depr.adaptors.cxx1z.pass.cpp create mode 100644 test/libcxx/experimental/containers/sequences/dynarray/lit.local.cfg create mode 100644 test/libcxx/experimental/filesystem/class.path/path.itr/reverse_iterator_produces_diagnostic.fail.cpp create mode 100644 test/libcxx/experimental/language.support/support.coroutines/dialect_support.sh.cpp rename test/{std/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/default03.fail.cpp => libcxx/experimental/language.support/support.coroutines/version.sh.cpp} (62%) rename test/{std => libcxx}/input.output/file.streams/c.files/no.global.filesystem.namespace/fopen.fail.cpp (89%) rename test/{std => libcxx}/input.output/file.streams/c.files/no.global.filesystem.namespace/rename.fail.cpp (89%) create mode 100644 test/libcxx/min_max_macros.sh.cpp rename test/{std/strings/string.view/nothing_to_do.pass.cpp => libcxx/selftest/test.arc.fail.mm} (80%) rename test/{std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.observers/get.pass.cpp => libcxx/selftest/test.arc.pass.mm} (70%) create mode 100644 test/libcxx/selftest/test.fail.mm create mode 100644 test/libcxx/selftest/test.pass.mm rename test/{std => libcxx}/thread/thread.condition/PR30202_notify_from_pthread_created_thread.pass.cpp (100%) delete mode 100644 test/libcxx/thread/thread.mutex/thread.lock/thread.lock.guard/variadic_mutex_mangling.pass.cpp rename test/{std => libcxx}/thread/thread.threads/thread.thread.this/sleep_for.pass.cpp (80%) rename test/{std => libcxx}/utilities/function.objects/refwrap/binary.pass.cpp (100%) rename test/{std => libcxx}/utilities/function.objects/refwrap/unary.pass.cpp (100%) create mode 100644 test/libcxx/utilities/memory/util.smartptr/util.smartptr.shared/function_type_default_deleter.fail.cpp create mode 100644 test/libcxx/utilities/meta/meta.unary/meta.unary.prop/missing_is_aggregate_trait.fail.cpp rename test/{std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.asgn/move01.fail.cpp => libcxx/utilities/template.bitset/includes.pass.cpp} (50%) rename test/{std => libcxx}/utilities/tuple/tuple.tuple/empty_member.pass.cpp (100%) delete mode 100644 test/libcxx/utilities/variant/variant.variant/variant.assign/copy.pass.cpp delete mode 100644 test/libcxx/utilities/variant/variant.variant/variant.assign/move.pass.cpp delete mode 100644 test/libcxx/utilities/variant/variant.variant/variant.ctor/copy.pass.cpp delete mode 100644 test/libcxx/utilities/variant/variant.variant/variant.ctor/move.pass.cpp create mode 100644 test/std/algorithms/alg.nonmodifying/alg.foreach/for_each_n.pass.cpp delete mode 100644 test/std/containers/sequences/forwardlist/forwardlist.cons/size.fail.cpp create mode 100644 test/std/containers/sequences/vector/vector.modifiers/clear.pass.cpp rename test/std/{utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.observers/op_arrow.fail.cpp => depr/depr.function.objects/depr.adaptors/depr.function.pointer.adaptors/pointer_to_binary_function.cxx1z.fail.cpp} (58%) rename test/std/{utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.modifiers/release.pass.cpp => depr/depr.function.objects/depr.adaptors/depr.function.pointer.adaptors/pointer_to_unary_function.cxx1z.fail.cpp} (60%) rename test/std/{utilities/memory/unique.ptr/unique.ptr.runtime/move01.fail.cpp => depr/depr.function.objects/depr.adaptors/depr.function.pointer.adaptors/ptr_fun1.cxx1z.fail.cpp} (53%) rename test/std/{utilities/memory/unique.ptr/unique.ptr.runtime/pointer_type.pass.cpp => depr/depr.function.objects/depr.adaptors/depr.function.pointer.adaptors/ptr_fun2.cxx1z.fail.cpp} (50%) create mode 100644 test/std/depr/depr.function.objects/depr.adaptors/depr.member.pointer.adaptors/const_mem_fun.cxx1z.fail.cpp create mode 100644 test/std/depr/depr.function.objects/depr.adaptors/depr.member.pointer.adaptors/const_mem_fun1.cxx1z.fail.cpp create mode 100644 test/std/depr/depr.function.objects/depr.adaptors/depr.member.pointer.adaptors/const_mem_fun1_ref_t.cxx1z.fail.cpp create mode 100644 test/std/depr/depr.function.objects/depr.adaptors/depr.member.pointer.adaptors/const_mem_fun1_t.cxx1z.fail.cpp create mode 100644 test/std/depr/depr.function.objects/depr.adaptors/depr.member.pointer.adaptors/const_mem_fun_ref.cxx1z.fail.cpp create mode 100644 test/std/depr/depr.function.objects/depr.adaptors/depr.member.pointer.adaptors/const_mem_fun_ref1.cxx1z.fail.cpp create mode 100644 test/std/depr/depr.function.objects/depr.adaptors/depr.member.pointer.adaptors/const_mem_fun_ref_t.cxx1z.fail.cpp create mode 100644 test/std/depr/depr.function.objects/depr.adaptors/depr.member.pointer.adaptors/const_mem_fun_t.cxx1z.fail.cpp rename test/std/{utilities/memory/unique.ptr/unique.ptr.runtime/null_asgn.pass.cpp => depr/depr.function.objects/depr.adaptors/depr.member.pointer.adaptors/mem_fun.cxx1z.fail.cpp} (50%) create mode 100644 test/std/depr/depr.function.objects/depr.adaptors/depr.member.pointer.adaptors/mem_fun1.cxx1z.fail.cpp create mode 100644 test/std/depr/depr.function.objects/depr.adaptors/depr.member.pointer.adaptors/mem_fun1_ref_t.cxx1z.fail.cpp rename test/std/{utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.asgn/move_convert13.fail.cpp => depr/depr.function.objects/depr.adaptors/depr.member.pointer.adaptors/mem_fun1_t.cxx1z.fail.cpp} (53%) create mode 100644 test/std/depr/depr.function.objects/depr.adaptors/depr.member.pointer.adaptors/mem_fun_ref.cxx1z.fail.cpp create mode 100644 test/std/depr/depr.function.objects/depr.adaptors/depr.member.pointer.adaptors/mem_fun_ref1.cxx1z.fail.cpp create mode 100644 test/std/depr/depr.function.objects/depr.adaptors/depr.member.pointer.adaptors/mem_fun_ref_t.cxx1z.fail.cpp rename test/std/{utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/move_convert13.fail.cpp => depr/depr.function.objects/depr.adaptors/depr.member.pointer.adaptors/mem_fun_t.cxx1z.fail.cpp} (54%) create mode 100644 test/std/experimental/language.support/support.coroutines/coroutine.handle/coroutine.handle.capacity/operator_bool.pass.cpp create mode 100644 test/std/experimental/language.support/support.coroutines/coroutine.handle/coroutine.handle.compare/equal_comp.pass.cpp create mode 100644 test/std/experimental/language.support/support.coroutines/coroutine.handle/coroutine.handle.compare/less_comp.pass.cpp create mode 100644 test/std/experimental/language.support/support.coroutines/coroutine.handle/coroutine.handle.completion/done.pass.cpp create mode 100644 test/std/experimental/language.support/support.coroutines/coroutine.handle/coroutine.handle.con/assign.pass.cpp create mode 100644 test/std/experimental/language.support/support.coroutines/coroutine.handle/coroutine.handle.con/construct.pass.cpp create mode 100644 test/std/experimental/language.support/support.coroutines/coroutine.handle/coroutine.handle.export/address.pass.cpp create mode 100644 test/std/experimental/language.support/support.coroutines/coroutine.handle/coroutine.handle.export/from_address.fail.cpp create mode 100644 test/std/experimental/language.support/support.coroutines/coroutine.handle/coroutine.handle.export/from_address.pass.cpp create mode 100644 test/std/experimental/language.support/support.coroutines/coroutine.handle/coroutine.handle.hash/hash.pass.cpp create mode 100644 test/std/experimental/language.support/support.coroutines/coroutine.handle/coroutine.handle.prom/promise.pass.cpp create mode 100644 test/std/experimental/language.support/support.coroutines/coroutine.handle/coroutine.handle.resumption/destroy.pass.cpp create mode 100644 test/std/experimental/language.support/support.coroutines/coroutine.handle/coroutine.handle.resumption/resume.pass.cpp create mode 100644 test/std/experimental/language.support/support.coroutines/coroutine.handle/void_handle.pass.cpp create mode 100644 test/std/experimental/language.support/support.coroutines/coroutine.traits/promise_type.pass.cpp create mode 100644 test/std/experimental/language.support/support.coroutines/coroutine.trivial.awaitables/suspend_always.pass.cpp create mode 100644 test/std/experimental/language.support/support.coroutines/coroutine.trivial.awaitables/suspend_never.pass.cpp create mode 100644 test/std/experimental/language.support/support.coroutines/end.to.end/await_result.pass.cpp create mode 100644 test/std/experimental/language.support/support.coroutines/end.to.end/bool_await_suspend.pass.cpp create mode 100644 test/std/experimental/language.support/support.coroutines/end.to.end/expected.pass.cpp create mode 100644 test/std/experimental/language.support/support.coroutines/end.to.end/fullexpr-dtor.pass.cpp create mode 100644 test/std/experimental/language.support/support.coroutines/end.to.end/generator.pass.cpp create mode 100644 test/std/experimental/language.support/support.coroutines/end.to.end/go.pass.cpp create mode 100644 test/std/experimental/language.support/support.coroutines/end.to.end/multishot_func.pass.cpp create mode 100644 test/std/experimental/language.support/support.coroutines/end.to.end/oneshot_func.pass.cpp create mode 100644 test/std/experimental/language.support/support.coroutines/includes.pass.cpp create mode 100644 test/std/experimental/language.support/support.coroutines/lit.local.cfg delete mode 100644 test/std/input.output/file.streams/c.files/no.global.filesystem.namespace/lit.local.cfg create mode 100644 test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.arithmetic/minmax_showbase.pass.cpp rename test/std/{utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.observers/dereference.fail.cpp => language.support/support.initlist/include_cxx03.pass.cpp} (72%) create mode 100644 test/std/language.support/support.types/byte.pass.cpp create mode 100644 test/std/language.support/support.types/byteops/and.assign.pass.cpp create mode 100644 test/std/language.support/support.types/byteops/and.pass.cpp rename test/std/{iterators/stream.iterators/istreambuf.iterator/istreambuf.iterator_op_astrk/arrow.pass.cpp => language.support/support.types/byteops/enum_direct_init.pass.cpp} (50%) create mode 100644 test/std/language.support/support.types/byteops/lshift.assign.fail.cpp create mode 100644 test/std/language.support/support.types/byteops/lshift.assign.pass.cpp create mode 100644 test/std/language.support/support.types/byteops/lshift.fail.cpp create mode 100644 test/std/language.support/support.types/byteops/lshift.pass.cpp create mode 100644 test/std/language.support/support.types/byteops/not.pass.cpp create mode 100644 test/std/language.support/support.types/byteops/or.assign.pass.cpp create mode 100644 test/std/language.support/support.types/byteops/or.pass.cpp create mode 100644 test/std/language.support/support.types/byteops/rshift.assign.fail.cpp create mode 100644 test/std/language.support/support.types/byteops/rshift.assign.pass.cpp create mode 100644 test/std/language.support/support.types/byteops/rshift.fail.cpp create mode 100644 test/std/language.support/support.types/byteops/rshift.pass.cpp create mode 100644 test/std/language.support/support.types/byteops/to_integer.fail.cpp create mode 100644 test/std/language.support/support.types/byteops/to_integer.pass.cpp create mode 100644 test/std/language.support/support.types/byteops/xor.assign.pass.cpp create mode 100644 test/std/language.support/support.types/byteops/xor.pass.cpp rename test/std/{utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.observers/get.pass.cpp => strings/basic.string/traits_mismatch.fail.cpp} (69%) delete mode 100644 test/std/strings/string.view/string.view.modifiers/clear.pass.cpp create mode 100644 test/std/strings/string.view/traits_mismatch.fail.cpp delete mode 100644 test/std/thread/thread.mutex/thread.lock/thread.lock.guard/variadic_mutex_cxx03.pass.cpp rename test/std/thread/thread.mutex/thread.lock/{thread.lock.guard/variadic_adopt_lock.pass.cpp => thread.lock.scoped/adopt_lock.pass.cpp} (71%) rename test/std/thread/thread.mutex/thread.lock/{thread.lock.guard/variadic_assign.fail.cpp => thread.lock.scoped/assign.fail.cpp} (66%) rename test/std/thread/thread.mutex/thread.lock/{thread.lock.guard/variadic_copy.fail.cpp => thread.lock.scoped/copy.fail.cpp} (65%) rename test/std/thread/thread.mutex/thread.lock/{thread.lock.guard/variadic_mutex.fail.cpp => thread.lock.scoped/mutex.fail.cpp} (69%) rename test/std/thread/thread.mutex/thread.lock/{thread.lock.guard/variadic_mutex.pass.cpp => thread.lock.scoped/mutex.pass.cpp} (61%) rename test/std/thread/thread.mutex/thread.lock/{thread.lock.guard/variadic_types.pass.cpp => thread.lock.scoped/types.pass.cpp} (75%) create mode 100644 test/std/thread/thread.mutex/thread.lock/thread.lock.shared/lit.local.cfg create mode 100644 test/std/thread/thread.mutex/thread.mutex.requirements/thread.shared_mutex.requirements/lit.local.cfg create mode 100644 test/std/thread/thread.mutex/thread.mutex.requirements/thread.sharedtimedmutex.requirements/lit.local.cfg rename test/std/{utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/pointer02.fail.cpp => thread/thread.threads/thread.thread.this/sleep_for_tested_elsewhere.pass.cpp} (55%) delete mode 100644 test/std/utilities/memory/unique.ptr/unique.ptr.runtime/move01.pass.cpp delete mode 100644 test/std/utilities/memory/unique.ptr/unique.ptr.runtime/move03.fail.cpp delete mode 100644 test/std/utilities/memory/unique.ptr/unique.ptr.runtime/move04.fail.cpp delete mode 100644 test/std/utilities/memory/unique.ptr/unique.ptr.runtime/move_convert01.fail.cpp delete mode 100644 test/std/utilities/memory/unique.ptr/unique.ptr.runtime/move_convert02.fail.cpp delete mode 100644 test/std/utilities/memory/unique.ptr/unique.ptr.runtime/move_convert03.fail.cpp delete mode 100644 test/std/utilities/memory/unique.ptr/unique.ptr.runtime/move_convert04.fail.cpp delete mode 100644 test/std/utilities/memory/unique.ptr/unique.ptr.runtime/move_convert05.fail.cpp delete mode 100644 test/std/utilities/memory/unique.ptr/unique.ptr.runtime/move_convert06.fail.cpp delete mode 100644 test/std/utilities/memory/unique.ptr/unique.ptr.runtime/move_convert07.fail.cpp delete mode 100644 test/std/utilities/memory/unique.ptr/unique.ptr.runtime/move_convert08.fail.cpp delete mode 100644 test/std/utilities/memory/unique.ptr/unique.ptr.runtime/move_convert09.fail.cpp delete mode 100644 test/std/utilities/memory/unique.ptr/unique.ptr.runtime/null_ctor.pass.cpp delete mode 100644 test/std/utilities/memory/unique.ptr/unique.ptr.runtime/nullptr_asgn.pass.cpp delete mode 100644 test/std/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/default01.fail.cpp delete mode 100644 test/std/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/default01.pass.cpp delete mode 100644 test/std/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/default02.fail.cpp delete mode 100644 test/std/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/default02.pass.cpp delete mode 100644 test/std/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/move01.fail.cpp delete mode 100644 test/std/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/move01.pass.cpp delete mode 100644 test/std/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/move02.fail.cpp delete mode 100644 test/std/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/move02.pass.cpp delete mode 100644 test/std/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/move03.fail.cpp delete mode 100644 test/std/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/move04.fail.cpp delete mode 100644 test/std/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/move_convert01.fail.cpp delete mode 100644 test/std/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/move_convert02.fail.cpp delete mode 100644 test/std/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/move_convert03.fail.cpp delete mode 100644 test/std/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/move_convert04.fail.cpp delete mode 100644 test/std/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/move_convert05.fail.cpp delete mode 100644 test/std/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/move_convert06.fail.cpp delete mode 100644 test/std/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/move_convert07.fail.cpp delete mode 100644 test/std/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/move_convert08.fail.cpp delete mode 100644 test/std/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/move_convert09.fail.cpp delete mode 100644 test/std/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/move_convert10.fail.cpp delete mode 100644 test/std/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/move_convert11.fail.cpp delete mode 100644 test/std/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/move_convert12.fail.cpp delete mode 100644 test/std/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/move_convert13.fail.cpp delete mode 100644 test/std/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/move_convert14.fail.cpp delete mode 100644 test/std/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/move_convert15.fail.cpp delete mode 100644 test/std/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/move_convert16.fail.cpp delete mode 100644 test/std/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/move_convert17.fail.cpp delete mode 100644 test/std/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/move_convert18.fail.cpp delete mode 100644 test/std/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/nullptr.pass.cpp delete mode 100644 test/std/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/pointer01.fail.cpp delete mode 100644 test/std/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/pointer01.pass.cpp delete mode 100644 test/std/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/pointer02.pass.cpp delete mode 100644 test/std/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/pointer03.fail.cpp delete mode 100644 test/std/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/pointer04.fail.cpp delete mode 100644 test/std/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/pointer_deleter01.pass.cpp delete mode 100644 test/std/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/pointer_deleter02.pass.cpp delete mode 100644 test/std/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/pointer_deleter03.pass.cpp delete mode 100644 test/std/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/pointer_deleter04.fail.cpp delete mode 100644 test/std/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/pointer_deleter04.pass.cpp delete mode 100644 test/std/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/pointer_deleter05.fail.cpp delete mode 100644 test/std/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.modifiers/reset1.pass.cpp delete mode 100644 test/std/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.modifiers/reset2.fail.cpp delete mode 100644 test/std/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.modifiers/swap.pass.cpp delete mode 100644 test/std/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.observers/get_deleter.pass.cpp delete mode 100644 test/std/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.observers/index.pass.cpp delete mode 100644 test/std/utilities/memory/unique.ptr/unique.ptr.single/pointer_type.pass.cpp delete mode 100644 test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.asgn/move01.pass.cpp delete mode 100644 test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.asgn/move02.fail.cpp delete mode 100644 test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.asgn/move03.fail.cpp delete mode 100644 test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.asgn/move04.fail.cpp delete mode 100644 test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.asgn/move_convert.pass.cpp delete mode 100644 test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.asgn/move_convert01.fail.cpp delete mode 100644 test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.asgn/move_convert02.fail.cpp delete mode 100644 test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.asgn/move_convert03.fail.cpp delete mode 100644 test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.asgn/move_convert04.fail.cpp delete mode 100644 test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.asgn/move_convert05.fail.cpp delete mode 100644 test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.asgn/move_convert06.fail.cpp delete mode 100644 test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/auto_pointer01.fail.cpp delete mode 100644 test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/auto_pointer02.fail.cpp delete mode 100644 test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/default.pass.cpp delete mode 100644 test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/default01.fail.cpp delete mode 100644 test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/default02.fail.cpp delete mode 100644 test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/default03.fail.cpp delete mode 100644 test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/move.pass.cpp delete mode 100644 test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/move01.fail.cpp delete mode 100644 test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/move02.fail.cpp delete mode 100644 test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/move03.fail.cpp delete mode 100644 test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/move04.fail.cpp delete mode 100644 test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/move_convert.pass.cpp delete mode 100644 test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/move_convert01.fail.cpp delete mode 100644 test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/move_convert02.fail.cpp delete mode 100644 test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/move_convert03.fail.cpp delete mode 100644 test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/move_convert04.fail.cpp delete mode 100644 test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/move_convert05.fail.cpp delete mode 100644 test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/move_convert06.fail.cpp delete mode 100644 test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/move_convert07.fail.cpp delete mode 100644 test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/move_convert08.fail.cpp delete mode 100644 test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/move_convert09.fail.cpp delete mode 100644 test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/move_convert10.fail.cpp delete mode 100644 test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/move_convert11.fail.cpp delete mode 100644 test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/move_convert12.fail.cpp delete mode 100644 test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/nullptr.pass.cpp delete mode 100644 test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/pointer.pass.cpp delete mode 100644 test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/pointer01.fail.cpp delete mode 100644 test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/pointer02.fail.cpp delete mode 100644 test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/pointer03.fail.cpp delete mode 100644 test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/pointer_deleter.pass.cpp delete mode 100644 test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.modifiers/release.pass.cpp delete mode 100644 test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.modifiers/reset1.pass.cpp delete mode 100644 test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.modifiers/swap.pass.cpp delete mode 100644 test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.observers/explicit_bool.pass.cpp delete mode 100644 test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.observers/get_deleter.pass.cpp create mode 100644 test/std/utilities/meta/meta.unary/meta.unary.prop/is_aggregate.pass.cpp create mode 100644 test/std/utilities/optional/optional.object/optional.object.ctor/copy.fail.cpp create mode 100644 test/std/utilities/optional/optional.object/optional.object.ctor/move.fail.cpp create mode 100644 test/std/utilities/smartptr/unique.ptr/README.TXT rename test/std/utilities/{memory => smartptr}/unique.ptr/nothing_to_do.pass.cpp (100%) create mode 100644 test/std/utilities/smartptr/unique.ptr/unique.ptr.class/pointer_type.pass.cpp create mode 100644 test/std/utilities/smartptr/unique.ptr/unique.ptr.class/unique.ptr.asgn/move.pass.cpp create mode 100644 test/std/utilities/smartptr/unique.ptr/unique.ptr.class/unique.ptr.asgn/move_convert.pass.cpp create mode 100644 test/std/utilities/smartptr/unique.ptr/unique.ptr.class/unique.ptr.asgn/move_convert.runtime.pass.cpp create mode 100644 test/std/utilities/smartptr/unique.ptr/unique.ptr.class/unique.ptr.asgn/move_convert.single.pass.cpp rename test/std/utilities/{memory/unique.ptr/unique.ptr.single/unique.ptr.single.asgn => smartptr/unique.ptr/unique.ptr.class/unique.ptr.asgn}/null.pass.cpp (57%) rename test/std/utilities/{memory/unique.ptr/unique.ptr.single/unique.ptr.single.asgn => smartptr/unique.ptr/unique.ptr.class/unique.ptr.asgn}/nullptr.pass.cpp (59%) rename test/std/utilities/{memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor => smartptr/unique.ptr/unique.ptr.class/unique.ptr.ctor}/auto_pointer.pass.cpp (50%) create mode 100644 test/std/utilities/smartptr/unique.ptr/unique.ptr.class/unique.ptr.ctor/default.pass.cpp create mode 100644 test/std/utilities/smartptr/unique.ptr/unique.ptr.class/unique.ptr.ctor/move.pass.cpp create mode 100644 test/std/utilities/smartptr/unique.ptr/unique.ptr.class/unique.ptr.ctor/move_convert.pass.cpp create mode 100644 test/std/utilities/smartptr/unique.ptr/unique.ptr.class/unique.ptr.ctor/move_convert.runtime.pass.cpp create mode 100644 test/std/utilities/smartptr/unique.ptr/unique.ptr.class/unique.ptr.ctor/move_convert.single.pass.cpp create mode 100644 test/std/utilities/smartptr/unique.ptr/unique.ptr.class/unique.ptr.ctor/null.pass.cpp create mode 100644 test/std/utilities/smartptr/unique.ptr/unique.ptr.class/unique.ptr.ctor/nullptr.pass.cpp create mode 100644 test/std/utilities/smartptr/unique.ptr/unique.ptr.class/unique.ptr.ctor/pointer.pass.cpp rename test/std/utilities/{memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/pointer_deleter04.fail.cpp => smartptr/unique.ptr/unique.ptr.class/unique.ptr.ctor/pointer_deleter.fail.cpp} (70%) create mode 100644 test/std/utilities/smartptr/unique.ptr/unique.ptr.class/unique.ptr.ctor/pointer_deleter.pass.cpp rename test/std/utilities/{memory/unique.ptr/unique.ptr.single/unique.ptr.single.dtor => smartptr/unique.ptr/unique.ptr.class/unique.ptr.dtor}/null.pass.cpp (54%) create mode 100644 test/std/utilities/smartptr/unique.ptr/unique.ptr.class/unique.ptr.modifiers/release.pass.cpp create mode 100644 test/std/utilities/smartptr/unique.ptr/unique.ptr.class/unique.ptr.modifiers/reset.pass.cpp rename test/std/utilities/{memory/unique.ptr/unique.ptr.runtime/move02.fail.cpp => smartptr/unique.ptr/unique.ptr.class/unique.ptr.modifiers/reset.runtime.fail.cpp} (54%) rename test/std/utilities/{memory/unique.ptr/unique.ptr.single/unique.ptr.single.modifiers/reset2.pass.cpp => smartptr/unique.ptr/unique.ptr.class/unique.ptr.modifiers/reset.single.pass.cpp} (67%) rename test/std/utilities/{memory/unique.ptr/unique.ptr.single/unique.ptr.single.modifiers => smartptr/unique.ptr/unique.ptr.class/unique.ptr.modifiers}/reset_self.pass.cpp (76%) create mode 100644 test/std/utilities/smartptr/unique.ptr/unique.ptr.class/unique.ptr.modifiers/swap.pass.cpp rename test/std/utilities/{memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.observers/explicit_bool.pass.cpp => smartptr/unique.ptr/unique.ptr.class/unique.ptr.observers/dereference.runtime.fail.cpp} (57%) rename test/std/utilities/{memory/unique.ptr/unique.ptr.single/unique.ptr.single.observers/dereference.pass.cpp => smartptr/unique.ptr/unique.ptr.class/unique.ptr.observers/dereference.single.pass.cpp} (85%) create mode 100644 test/std/utilities/smartptr/unique.ptr/unique.ptr.class/unique.ptr.observers/explicit_bool.pass.cpp create mode 100644 test/std/utilities/smartptr/unique.ptr/unique.ptr.class/unique.ptr.observers/get.pass.cpp create mode 100644 test/std/utilities/smartptr/unique.ptr/unique.ptr.class/unique.ptr.observers/get_deleter.pass.cpp create mode 100644 test/std/utilities/smartptr/unique.ptr/unique.ptr.class/unique.ptr.observers/op_arrow.runtime.fail.cpp rename test/std/utilities/{memory/unique.ptr/unique.ptr.single/unique.ptr.single.observers/op_arrow.pass.cpp => smartptr/unique.ptr/unique.ptr.class/unique.ptr.observers/op_arrow.single.pass.cpp} (79%) rename test/std/utilities/{memory/unique.ptr/unique.ptr.single/unique.ptr.single.observers/index.fail.cpp => smartptr/unique.ptr/unique.ptr.class/unique.ptr.observers/op_subscript.runtime.pass.cpp} (50%) create mode 100644 test/std/utilities/smartptr/unique.ptr/unique.ptr.class/unique.ptr.observers/op_subscript.single.fail.cpp rename test/std/utilities/{memory => smartptr}/unique.ptr/unique.ptr.create/make_unique.array.pass.cpp (100%) rename test/std/utilities/{memory => smartptr}/unique.ptr/unique.ptr.create/make_unique.array1.fail.cpp (100%) rename test/std/utilities/{memory => smartptr}/unique.ptr/unique.ptr.create/make_unique.array2.fail.cpp (100%) rename test/std/utilities/{memory => smartptr}/unique.ptr/unique.ptr.create/make_unique.array3.fail.cpp (100%) rename test/std/utilities/{memory => smartptr}/unique.ptr/unique.ptr.create/make_unique.array4.fail.cpp (100%) rename test/std/utilities/{memory => smartptr}/unique.ptr/unique.ptr.create/make_unique.single.pass.cpp (100%) rename test/std/utilities/{memory => smartptr}/unique.ptr/unique.ptr.dltr/nothing_to_do.pass.cpp (100%) rename test/std/utilities/{memory => smartptr}/unique.ptr/unique.ptr.dltr/unique.ptr.dltr.dflt/convert_ctor.pass.cpp (100%) rename test/std/utilities/{memory => smartptr}/unique.ptr/unique.ptr.dltr/unique.ptr.dltr.dflt/default.pass.cpp (100%) rename test/std/utilities/{memory => smartptr}/unique.ptr/unique.ptr.dltr/unique.ptr.dltr.dflt/incomplete.fail.cpp (100%) rename test/std/utilities/{memory => smartptr}/unique.ptr/unique.ptr.dltr/unique.ptr.dltr.dflt/void.fail.cpp (100%) rename test/std/utilities/{memory => smartptr}/unique.ptr/unique.ptr.dltr/unique.ptr.dltr.dflt1/convert_ctor.fail.cpp (100%) rename test/std/utilities/{memory => smartptr}/unique.ptr/unique.ptr.dltr/unique.ptr.dltr.dflt1/convert_ctor.pass.cpp (100%) rename test/std/utilities/{memory => smartptr}/unique.ptr/unique.ptr.dltr/unique.ptr.dltr.dflt1/default.pass.cpp (100%) rename test/std/utilities/{memory => smartptr}/unique.ptr/unique.ptr.dltr/unique.ptr.dltr.dflt1/incomplete.fail.cpp (100%) rename test/std/utilities/{memory => smartptr}/unique.ptr/unique.ptr.dltr/unique.ptr.dltr.general/nothing_to_do.pass.cpp (100%) rename test/std/utilities/{memory => smartptr}/unique.ptr/unique.ptr.special/cmp_nullptr.pass.cpp (100%) rename test/std/utilities/{memory => smartptr}/unique.ptr/unique.ptr.special/eq.pass.cpp (100%) rename test/std/utilities/{memory => smartptr}/unique.ptr/unique.ptr.special/rel.pass.cpp (100%) rename test/std/utilities/{memory => smartptr}/unique.ptr/unique.ptr.special/swap.pass.cpp (100%) create mode 100644 test/support/coroutine_types.h create mode 100644 test/support/test.workarounds/c1xx_broken_is_trivially_copyable.pass.cpp create mode 100644 test/support/test.workarounds/c1xx_broken_za_ctor_check.pass.cpp create mode 100644 test/support/test_workarounds.h create mode 100644 test/support/unique_ptr_test_helper.h create mode 100644 utils/google-benchmark/cmake/Config.cmake.in create mode 100644 utils/google-benchmark/docs/tools.md create mode 100644 utils/google-benchmark/mingw.py create mode 100644 utils/google-benchmark/src/counter.cc create mode 100644 utils/google-benchmark/src/counter.h diff --git a/.clang-format b/.clang-format index 2d1d3bee6..dd596813f 100644 --- a/.clang-format +++ b/.clang-format @@ -2,6 +2,7 @@ BasedOnStyle: LLVM --- Language: Cpp +Standard: Cpp03 AlwaysBreakTemplateDeclarations: true PointerAlignment: Left diff --git a/CMakeLists.txt b/CMakeLists.txt index 9e9360ea9..33d888b80 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -23,7 +23,7 @@ if (CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR) project(libcxx CXX C) set(PACKAGE_NAME libcxx) - set(PACKAGE_VERSION 4.0.0svn) + set(PACKAGE_VERSION 5.0.0svn) set(PACKAGE_STRING "${PACKAGE_NAME} ${PACKAGE_VERSION}") set(PACKAGE_BUGREPORT "llvm-bugs@lists.llvm.org") @@ -64,8 +64,12 @@ option(LIBCXX_ENABLE_ASSERTIONS "Enable assertions independent of build mode." O option(LIBCXX_ENABLE_SHARED "Build libc++ as a shared library." ON) option(LIBCXX_ENABLE_STATIC "Build libc++ as a static library." ON) option(LIBCXX_ENABLE_EXPERIMENTAL_LIBRARY "Build libc++experimental.a" ON) -option(LIBCXX_ENABLE_FILESYSTEM - "Build filesystem as part of libc++experimental.a" ${LIBCXX_ENABLE_EXPERIMENTAL_LIBRARY}) +set(ENABLE_FILESYSTEM_DEFAULT ${LIBCXX_ENABLE_EXPERIMENTAL_LIBRARY}) +if (WIN32) + set(ENABLE_FILESYSTEM_DEFAULT OFF) +endif() +option(LIBCXX_ENABLE_FILESYSTEM "Build filesystem as part of libc++experimental.a" + ${ENABLE_FILESYSTEM_DEFAULT}) option(LIBCXX_INCLUDE_TESTS "Build the libc++ tests." ${LLVM_INCLUDE_TESTS}) # Benchmark options ----------------------------------------------------------- @@ -116,21 +120,19 @@ if (LIBCXX_CXX_ABI STREQUAL "default") ${LLVM_MAIN_SRC_DIR}/runtimes/libcxxabi/include NO_DEFAULT_PATH ) - if ((NOT LIBCXX_STANDALONE_BUILD OR HAVE_LIBCXXABI) AND - IS_DIRECTORY "${LIBCXX_LIBCXXABI_INCLUDES_INTERNAL}") + if (LIBCXX_TARGETING_MSVC) + # FIXME: Figure out how to configure the ABI library on Windows. + set(LIBCXX_CXX_ABI_LIBNAME "vcruntime") + elseif ((NOT LIBCXX_STANDALONE_BUILD OR HAVE_LIBCXXABI) AND + IS_DIRECTORY "${LIBCXX_LIBCXXABI_INCLUDES_INTERNAL}") set(LIBCXX_CXX_ABI_LIBNAME "libcxxabi") set(LIBCXX_CXX_ABI_INCLUDE_PATHS "${LIBCXX_LIBCXXABI_INCLUDES_INTERNAL}") set(LIBCXX_CXX_ABI_INTREE 1) + elseif (APPLE) + set(LIBCXX_CXX_ABI_LIBNAME "libcxxabi") + set(LIBCXX_CXX_ABI_SYSTEM 1) else() - if (LIBCXX_TARGETING_MSVC) - # FIXME: Figure out how to configure the ABI library on Windows. - set(LIBCXX_CXX_ABI_LIBNAME "vcruntime") - elseif(APPLE) - set(LIBCXX_CXX_ABI_LIBNAME "libcxxabi") - set(LIBCXX_CXX_ABI_SYSTEM 1) - else() - set(LIBCXX_CXX_ABI_LIBNAME "default") - endif() + set(LIBCXX_CXX_ABI_LIBNAME "default") endif() else() set(LIBCXX_CXX_ABI_LIBNAME "${LIBCXX_CXX_ABI}") @@ -142,7 +144,7 @@ option(LIBCXX_ENABLE_STATIC_ABI_LIBRARY "Statically link the ABI library" OFF) # Generate and install a linker script inplace of libc++.so. The linker script # will link libc++ to the correct ABI library. This option is on by default -# On UNIX platforms other than Apple unless 'LIBCXX_ENABLE_STATIC_ABI_LIBRARY' +# on UNIX platforms other than Apple unless 'LIBCXX_ENABLE_STATIC_ABI_LIBRARY' # is on. This option is also disabled when the ABI library is not specified # or is specified to be "none". set(ENABLE_LINKER_SCRIPT_DEFAULT_VALUE OFF) @@ -161,7 +163,7 @@ option(LIBCXX_ENABLE_ABI_LINKER_SCRIPT set(ENABLE_NEW_DELETE_DEFAULT ON) if (LIBCXXABI_ENABLE_NEW_DELETE_DEFINITIONS) # FIXME: This option should default to off. Unfortunatly GCC 4.9 fails to link -# programs to due undefined references to new/delete in libc++abi so to work +# programs due to undefined references to new/delete in libc++abi so to work # around this libc++abi currently defaults LIBCXXABI_ENABLE_NEW_DELETE_DEFINITIONS # to ON. Once the GCC bug has been worked around this option should be changed # back to OFF. @@ -342,11 +344,16 @@ set(LIBCXX_COMPILER ${CMAKE_CXX_COMPILER}) set(LIBCXX_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}) set(LIBCXX_BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR}) set(LIBCXX_BINARY_INCLUDE_DIR "${LIBCXX_BINARY_DIR}/include/c++build") -set(LIBCXX_LIBRARY_DIR ${CMAKE_BINARY_DIR}/lib${LIBCXX_LIBDIR_SUFFIX}) +if (LLVM_LIBRARY_OUTPUT_INTDIR) + set(LIBCXX_LIBRARY_DIR ${LLVM_LIBRARY_OUTPUT_INTDIR}) +else() + set(LIBCXX_LIBRARY_DIR ${CMAKE_BINARY_DIR}/lib${LIBCXX_LIBDIR_SUFFIX}) +endif() file(MAKE_DIRECTORY "${LIBCXX_BINARY_INCLUDE_DIR}") set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${LIBCXX_LIBRARY_DIR}) set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${LIBCXX_LIBRARY_DIR}) +set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${LIBCXX_LIBRARY_DIR}) # Declare libc++ configuration variables. # They are intended for use as follows: @@ -369,9 +376,9 @@ include(HandleLibcxxFlags) # 'config-ix' use them during feature checks. It also adds them to both # 'LIBCXX_COMPILE_FLAGS' and 'LIBCXX_LINK_FLAGS' add_target_flags_if(LIBCXX_BUILD_32_BITS "-m32") -add_target_flags_if(LIBCXX_TARGET_TRIPLE "-target ${LIBCXX_TARGET_TRIPLE}") +add_target_flags_if(LIBCXX_TARGET_TRIPLE "--target=${LIBCXX_TARGET_TRIPLE}") add_target_flags_if(LIBCXX_SYSROOT "--sysroot=${LIBCXX_SYSROOT}") -add_target_flags_if(LIBCXX_GCC_TOOLCHAIN "-gcc-toolchain ${LIBCXX_GCC_TOOLCHAIN}") +add_target_flags_if(LIBCXX_GCC_TOOLCHAIN "--gcc-toolchain=${LIBCXX_GCC_TOOLCHAIN}") if (LIBCXX_TARGET_TRIPLE) set(TARGET_TRIPLE "${LIBCXX_TARGET_TRIPLE}") endif() @@ -414,9 +421,9 @@ remove_flags(-stdlib=libc++ -stdlib=libstdc++) # non-debug DLLs remove_flags("/D_DEBUG" "/MTd" "/MDd" "/MT" "/Md") -# FIXME(EricWF): See the FIXME on LIBCXX_ENABLE_PEqDANTIC. +# FIXME(EricWF): See the FIXME on LIBCXX_ENABLE_PEDANTIC. # Remove the -pedantic flag and -Wno-pedantic and -pedantic-errors -# so they don't get transformed into -Wno and -errors respectivly. +# so they don't get transformed into -Wno and -errors respectively. remove_flags(-Wno-pedantic -pedantic-errors -pedantic) # Required flags ============================================================== @@ -445,6 +452,11 @@ add_compile_flags_if_supported(-nostdinc++) # the dylib when get ODR used by another function. add_compile_flags_if_supported(-fvisibility-inlines-hidden) +if (LIBCXX_CONFIGURE_IDE) + # This simply allows IDE to process + add_compile_flags_if_supported(-fcoroutines-ts) +endif() + # Let the library headers know they are currently being used to build the # library. add_definitions(-D_LIBCPP_BUILDING_LIBRARY) @@ -466,7 +478,8 @@ if ("${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang") elseif("${CMAKE_CXX_COMPILER_ID}" MATCHES "GNU") add_compile_flags_if_supported( -Wno-literal-suffix - -Wno-c++14-compat) + -Wno-c++14-compat + -Wno-noexcept-type) endif() if (LIBCXX_ENABLE_WERROR) add_compile_flags_if_supported(-Werror) @@ -623,7 +636,12 @@ endif() # Create the lit.site.cfg file even when LIBCXX_INCLUDE_TESTS is OFF or # LLVM_FOUND is OFF. This allows users to run the tests manually using # LIT without requiring a full LLVM checkout. -add_subdirectory(test) +# +# However, since some submission systems strip test/ subdirectories, check for +# it before adding it. +if(IS_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/test") + add_subdirectory(test) +endif() if (LIBCXX_INCLUDE_TESTS) add_subdirectory(lib/abi) endif() diff --git a/appveyor-reqs-install.cmd b/appveyor-reqs-install.cmd new file mode 100644 index 000000000..e5b30cf43 --- /dev/null +++ b/appveyor-reqs-install.cmd @@ -0,0 +1,53 @@ +@echo on + +if NOT EXIST C:\projects\deps ( + mkdir C:\projects\deps +) +cd C:\projects\deps + +::########################################################################### +:: Setup Compiler +::########################################################################### +if NOT EXIST llvm-installer.exe ( + appveyor DownloadFile http://llvm.org/pre-releases/win-snapshots/LLVM-5.0.0-r303050-win32.exe -FileName llvm-installer.exe +) +if "%CLANG_VERSION%"=="ToT" ( + START /WAIT llvm-installer.exe /S /D=C:\"Program Files\LLVM" +) +if DEFINED CLANG_VERSION @set PATH="C:\Program Files\LLVM\bin";%PATH% +if DEFINED CLANG_VERSION clang-cl -v + +if DEFINED MINGW_PATH rename "C:\Program Files\Git\usr\bin\sh.exe" "sh-ignored.exe" +if DEFINED MINGW_PATH @set "PATH=%PATH:C:\Program Files (x86)\Git\bin=%" +if DEFINED MINGW_PATH @set "PATH=%PATH%;%MINGW_PATH%" +if DEFINED MINGW_PATH g++ -v + +::########################################################################### +:: Install a recent CMake +::########################################################################### +if NOT EXIST cmake ( + appveyor DownloadFile https://cmake.org/files/v3.7/cmake-3.7.2-win64-x64.zip -FileName cmake.zip + 7z x cmake.zip -oC:\projects\deps > nul + move C:\projects\deps\cmake-* C:\projects\deps\cmake + rm cmake.zip +) +@set PATH=C:\projects\deps\cmake\bin;%PATH% +cmake --version + +::########################################################################### +:: Install Ninja +::########################################################################### +if NOT EXIST ninja ( + appveyor DownloadFile https://github.com/ninja-build/ninja/releases/download/v1.6.0/ninja-win.zip -FileName ninja.zip + 7z x ninja.zip -oC:\projects\deps\ninja > nul + rm ninja.zip +) +@set PATH=C:\projects\deps\ninja;%PATH% +ninja --version + +::########################################################################### +:: Setup the cached copy of LLVM +::########################################################################### +git clone --depth=1 http://llvm.org/git/llvm.git + +@echo off diff --git a/appveyor.yml b/appveyor.yml new file mode 100644 index 000000000..be69a555d --- /dev/null +++ b/appveyor.yml @@ -0,0 +1,78 @@ +version: '{build}' + +shallow_clone: true + +build: + verbosity: detailed + +configuration: + - Debug + +environment: + matrix: + - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017 + CMAKE_OPTIONS: -DCMAKE_C_COMPILER=clang-cl.exe -DCMAKE_CXX_COMPILER=clang-cl.exe + CLANG_VERSION: ToT + MSVC_SETUP_PATH: C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build\vcvarsall.bat + MSVC_SETUP_ARG: x86 + GENERATOR: Ninja + MAKE_PROGRAM: ninja + APPVEYOR_SAVE_CACHE_ON_ERROR: true + - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015 + CMAKE_OPTIONS: -DCMAKE_C_COMPILER=clang-cl.exe -DCMAKE_CXX_COMPILER=clang-cl.exe + CLANG_VERSION: 4 + MSVC_SETUP_PATH: C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat + MSVC_SETUP_ARG: x86_amd64 + GENERATOR: Ninja + MAKE_PROGRAM: ninja + APPVEYOR_SAVE_CACHE_ON_ERROR: true + - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015 + MINGW_PATH: C:\mingw-w64\i686-6.3.0-posix-dwarf-rt_v5-rev1\mingw32\bin + GENERATOR: MinGW Makefiles + MAKE_PROGRAM: mingw32-make + APPVEYOR_SAVE_CACHE_ON_ERROR: true + +install: + ############################################################################ + # All external dependencies are installed in C:\projects\deps + ############################################################################ + - call "%APPVEYOR_BUILD_FOLDER%\\appveyor-reqs-install.cmd" + +before_build: + - if DEFINED MSVC_SETUP_PATH call "%MSVC_SETUP_PATH%" %MSVC_SETUP_ARG% + - cd %APPVEYOR_BUILD_FOLDER% + +build_script: + - md C:\projects\build-libcxx + - cd C:\projects\build-libcxx + - echo %configuration% + + ############################################################################# + # Configuration Step + ############################################################################# + - cmake -G "%GENERATOR%" %CMAKE_OPTIONS% + "-DCMAKE_BUILD_TYPE=%configuration%" + "-DLLVM_PATH=C:\projects\deps\llvm" -DLIBCXX_ENABLE_EXPERIMENTAL_LIBRARY=OFF + -DLLVM_LIT_ARGS="-sv --show-xfail --show-unsupported" + %APPVEYOR_BUILD_FOLDER% + + ############################################################################# + # Build Step + ############################################################################# + - "%MAKE_PROGRAM%" + +test_script: + - "%MAKE_PROGRAM% check-cxx" + +on_failure: + - appveyor PushArtifact CMakeFiles/CMakeOutput.log + - appveyor PushArtifact CMakeFiles/CMakeError.log + +artifacts: + - path: '_build/CMakeFiles/*.log' + name: logs + +cache: + - C:\projects\deps\ninja + - C:\projects\deps\cmake + - C:\projects\deps\llvm-installer.exe diff --git a/benchmarks/CMakeLists.txt b/benchmarks/CMakeLists.txt index a4105be08..8211ebd00 100644 --- a/benchmarks/CMakeLists.txt +++ b/benchmarks/CMakeLists.txt @@ -63,7 +63,7 @@ endif() # Benchmark tests configuration #============================================================================== add_custom_target(cxx-benchmarks) - +set(BENCHMARK_OUTPUT_DIR ${CMAKE_CURRENT_BINARY_DIR}) set(BENCHMARK_LIBCXX_INSTALL ${CMAKE_CURRENT_BINARY_DIR}/benchmark-libcxx) set(BENCHMARK_NATIVE_INSTALL ${CMAKE_CURRENT_BINARY_DIR}/benchmark-native) set(BENCHMARK_TEST_COMPILE_FLAGS @@ -111,6 +111,7 @@ macro(add_benchmark_test name source_file) set_target_properties(${libcxx_target} PROPERTIES OUTPUT_NAME "${name}.libcxx.out" + RUNTIME_OUTPUT_DIRECTORY "${BENCHMARK_OUTPUT_DIR}" COMPILE_FLAGS "${BENCHMARK_TEST_LIBCXX_COMPILE_FLAGS}" LINK_FLAGS "${BENCHMARK_TEST_LIBCXX_LINK_FLAGS}") if (LIBCXX_BENCHMARK_NATIVE_STDLIB) @@ -131,6 +132,7 @@ macro(add_benchmark_test name source_file) set_target_properties(${native_target} PROPERTIES OUTPUT_NAME "${name}.native.out" + RUNTIME_OUTPUT_DIRECTORY "${BENCHMARK_OUTPUT_DIR}" INCLUDE_DIRECTORIES "" COMPILE_FLAGS "${BENCHMARK_TEST_NATIVE_COMPILE_FLAGS}" LINK_FLAGS "${BENCHMARK_TEST_NATIVE_LINK_FLAGS}") diff --git a/cmake/Modules/HandleCompilerRT.cmake b/cmake/Modules/HandleCompilerRT.cmake index 973000831..e9da3c43a 100644 --- a/cmake/Modules/HandleCompilerRT.cmake +++ b/cmake/Modules/HandleCompilerRT.cmake @@ -5,6 +5,9 @@ function(find_compiler_rt_library name dest) set(dest "" PARENT_SCOPE) set(CLANG_COMMAND ${CMAKE_CXX_COMPILER} ${LIBCXX_COMPILE_FLAGS} "--rtlib=compiler-rt" "--print-libgcc-file-name") + if (CMAKE_CXX_COMPILER_ID MATCHES Clang AND CMAKE_CXX_COMPILER_TARGET) + list(APPEND CLANG_COMMAND "--target=${CMAKE_CXX_COMPILER_TARGET}") + endif() execute_process( COMMAND ${CLANG_COMMAND} RESULT_VARIABLE HAD_ERROR diff --git a/cmake/config-ix.cmake b/cmake/config-ix.cmake index 4f13b787a..730ee7e16 100644 --- a/cmake/config-ix.cmake +++ b/cmake/config-ix.cmake @@ -1,4 +1,5 @@ include(CheckLibraryExists) +include(CheckCCompilerFlag) include(CheckCXXCompilerFlag) if(WIN32 AND NOT MINGW) @@ -24,17 +25,32 @@ endif() # required during compilation (which has the -nodefaultlibs). libc is # required for the link to go through. We remove sanitizers from the # configuration checks to avoid spurious link errors. -check_cxx_compiler_flag(-nodefaultlibs LIBCXX_SUPPORTS_NODEFAULTLIBS_FLAG) +check_c_compiler_flag(-nodefaultlibs LIBCXX_SUPPORTS_NODEFAULTLIBS_FLAG) if (LIBCXX_SUPPORTS_NODEFAULTLIBS_FLAG) set(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} -nodefaultlibs") if (LIBCXX_HAS_C_LIB) list(APPEND CMAKE_REQUIRED_LIBRARIES c) endif () if (LIBCXX_USE_COMPILER_RT) - list(APPEND CMAKE_REQUIRED_LIBRARIES -rtlib=compiler-rt) + list(APPEND CMAKE_REQUIRED_FLAGS -rtlib=compiler-rt) + find_compiler_rt_library(builtins LIBCXX_BUILTINS_LIBRARY) + list(APPEND CMAKE_REQUIRED_LIBRARIES "${LIBCXX_BUILTINS_LIBRARY}") elseif (LIBCXX_HAS_GCC_S_LIB) list(APPEND CMAKE_REQUIRED_LIBRARIES gcc_s) endif () + if (MINGW) + # Mingw64 requires quite a few "C" runtime libraries in order for basic + # programs to link successfully with -nodefaultlibs. + if (LIBCXX_USE_COMPILER_RT) + set(MINGW_RUNTIME ${LIBCXX_BUILTINS_LIBRARY}) + else () + set(MINGW_RUNTIME gcc_s gcc) + endif() + set(MINGW_LIBRARIES mingw32 ${MINGW_RUNTIME} moldname mingwex msvcrt advapi32 + shell32 user32 kernel32 mingw32 ${MINGW_RUNTIME} + moldname mingwex msvcrt) + list(APPEND CMAKE_REQUIRED_LIBRARIES ${MINGW_LIBRARIES}) + endif() if (CMAKE_C_FLAGS MATCHES -fsanitize OR CMAKE_CXX_FLAGS MATCHES -fsanitize) set(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} -fno-sanitize=all") endif () diff --git a/docs/CMakeLists.txt b/docs/CMakeLists.txt index f63ee00a5..d679761a5 100644 --- a/docs/CMakeLists.txt +++ b/docs/CMakeLists.txt @@ -1,9 +1,9 @@ if (LLVM_ENABLE_SPHINX) + include(AddSphinxTarget) if (SPHINX_FOUND) - include(AddSphinxTarget) if (${SPHINX_OUTPUT_HTML}) add_sphinx_target(html libcxx) endif() endif() -endif() \ No newline at end of file +endif() diff --git a/docs/DesignDocs/AvailabilityMarkup.rst b/docs/DesignDocs/AvailabilityMarkup.rst new file mode 100644 index 000000000..4a85c698f --- /dev/null +++ b/docs/DesignDocs/AvailabilityMarkup.rst @@ -0,0 +1,114 @@ +=================== +Availability Markup +=================== + +.. contents:: + :local: + +Overview +======== + +Libc++ is used as a system library on macOS and iOS (amongst others). In order +for users to be able to compile a binary that is intended to be deployed to an +older version of the platform, clang provides the +`availability attribute `_ +that can be placed on declarations to describe the lifecycle of a symbol in the +library. + +Design +====== + +When a new feature is introduced that requires dylib support, a macro should be +created in include/__config to mark this feature as unavailable for all the +systems. For example:: + + // Define availability macros. + #if defined(_LIBCPP_USE_AVAILABILITY_APPLE) + #define _LIBCPP_AVAILABILITY_BAD_OPTIONAL_ACCESS __attribute__((unavailable)) + #else if defined(_LIBCPP_USE_AVAILABILITY_SOME_OTHER_VENDOR) + #define _LIBCPP_AVAILABILITY_BAD_OPTIONAL_ACCESS __attribute__((unavailable)) + #else + #define _LIBCPP_AVAILABILITY_BAD_OPTIONAL_ACCESS + #endif + +When the library is updated by the platform vendor, the markup can be updated. +For example:: + + #define _LIBCPP_AVAILABILITY_SHARED_MUTEX \ + __attribute__((availability(macosx,strict,introduced=10.12))) \ + __attribute__((availability(ios,strict,introduced=10.0))) \ + __attribute__((availability(tvos,strict,introduced=10.0))) \ + __attribute__((availability(watchos,strict,introduced=3.0))) + +In the source code, the macro can be added on a class if the full class requires +type info from the library for example:: + + _LIBCPP_BEGIN_NAMESPACE_EXPERIMENTAL + class _LIBCPP_EXCEPTION_ABI _LIBCPP_AVAILABILITY_BAD_OPTIONAL_ACCESS bad_optional_access + : public std::logic_error { + +or on a particular symbol: + + _LIBCPP_OVERRIDABLE_FUNC_VIS _LIBCPP_AVAILABILITY_SIZED_NEW_DELETE void operator delete(void* __p, std::size_t __sz) _NOEXCEPT; + + +Testing +======= + +Some parameters can be passed to lit to run the test-suite and exercising the +availability. + +* The `platform` parameter controls the deployement target. For example lit can + be invoked with `--param=platform=macosx10.8`. Default is the current host. +* The `use_system_cxx_lib` parameter indicates to use another library than the + just built one. Invoking lit with `--param=use_system_cxx_lib=true` will run + the test-suite against the host system library. Alternatively a path to the + directory containing a specific prebuilt libc++ can be used, for example: + `--param=use_system_cxx_lib=/path/to/macOS/10.8/`. +* The `with_availability` boolean parameter enables the availability markup. + +Tests can be marked as XFAIL based on multiple features made available by lit: + + +* if either `use_system_cxx_lib` or `with_availability` is passed to lit, + assuming `--param=platform=macosx10.8` is passed as well the following + features will be available: + + - availability + - availability=x86_64 + - availability=macosx + - availability=x86_64-macosx + - availability=x86_64-apple-macosx10.8 + - availability=macosx10.8 + + This feature is used to XFAIL a test that *is* using a class of a method marked + as unavailable *and* that is expected to *fail* if deployed on an older system. + +* if `use_system_cxx_lib` is passed to lit, the following features will also + be available: + + - with_system_cxx_lib + - with_system_cxx_lib=x86_64 + - with_system_cxx_lib=macosx + - with_system_cxx_lib=x86_64-macosx + - with_system_cxx_lib=x86_64-apple-macosx10.8 + - with_system_cxx_lib=macosx10.8 + + This feature is used to XFAIL a test that is *not* using a class of a method + marked as unavailable *but* that is expected to fail if deployed on an older + system. For example if we know that it exhibits a but in the libc on a + particular system version. + +* if `with_availability` is passed to lit, the following features will also + be available: + + - availability_markup + - availability_markup=x86_64 + - availability_markup=macosx + - availability_markup=x86_64-macosx + - availability_markup=x86_64-apple-macosx10.8 + - availability_markup=macosx10.8 + + This feature is used to XFAIL a test that *is* using a class of a method + marked as unavailable *but* that is expected to *pass* if deployed on an older + system. For example if it is using a symbol in a statically evaluated context. diff --git a/docs/TestingLibcxx.rst b/docs/TestingLibcxx.rst index e4292764c..5c48ebe61 100644 --- a/docs/TestingLibcxx.rst +++ b/docs/TestingLibcxx.rst @@ -119,7 +119,7 @@ configuration. Passing the option on the command line will override the default. .. option:: libcxx_site_config= Specify the site configuration to use when running the tests. This option - overrides the enviroment variable LIBCXX_SITE_CONFIG. + overrides the environment variable LIBCXX_SITE_CONFIG. .. option:: cxx_headers= diff --git a/docs/UsingLibcxx.rst b/docs/UsingLibcxx.rst index fe32f5e6b..183664655 100644 --- a/docs/UsingLibcxx.rst +++ b/docs/UsingLibcxx.rst @@ -146,6 +146,11 @@ thread safety annotations. build of libc++ which does not export any symbols, which can be useful when building statically for inclusion into another library. +**_LIBCPP_DISABLE_EXTERN_TEMPLATE**: + This macro is used to disable extern template declarations in the libc++ + headers. The intended use case is for clients who wish to use the libc++ + headers without taking a dependency on the libc++ library itself. + **_LIBCPP_ENABLE_TUPLE_IMPLICIT_REDUCED_ARITY_EXTENSION**: This macro is used to re-enable an extension in `std::tuple` which allowed it to be implicitly constructed from fewer initializers than contained diff --git a/docs/index.rst b/docs/index.rst index 58043f5a4..3526b4721 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -128,6 +128,7 @@ Design Documents .. toctree:: :maxdepth: 1 + DesignDocs/AvailabilityMarkup DesignDocs/DebugMode DesignDocs/CapturingConfigInfo DesignDocs/ABIVersioning @@ -145,7 +146,7 @@ Build Bots and Test Coverage * `LLVM Buildbot Builders `_ * `Apple Jenkins Builders `_ -* `EricWF's Nightly Builders `_ +* `Windows Appveyor Builders `_ * `Code Coverage Results `_ Getting Involved diff --git a/include/__bit_reference b/include/__bit_reference index 9aea96145..3e4a21d26 100644 --- a/include/__bit_reference +++ b/include/__bit_reference @@ -14,12 +14,14 @@ #include <__config> #include -#include <__undef_min_max> - #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) #pragma GCC system_header #endif +_LIBCPP_PUSH_MACROS +#include <__undef_macros> + + _LIBCPP_BEGIN_NAMESPACE_STD template class __bit_iterator; @@ -1273,4 +1275,6 @@ private: _LIBCPP_END_NAMESPACE_STD +_LIBCPP_POP_MACROS + #endif // _LIBCPP___BIT_REFERENCE diff --git a/include/__bsd_locale_fallbacks.h b/include/__bsd_locale_fallbacks.h index 537614c68..57199477a 100644 --- a/include/__bsd_locale_fallbacks.h +++ b/include/__bsd_locale_fallbacks.h @@ -23,27 +23,24 @@ _LIBCPP_BEGIN_NAMESPACE_STD -typedef _VSTD::remove_pointer::type __use_locale_struct; -typedef _VSTD::unique_ptr<__use_locale_struct, decltype(&uselocale)> __locale_raii; - inline _LIBCPP_ALWAYS_INLINE decltype(MB_CUR_MAX) __libcpp_mb_cur_max_l(locale_t __l) { - __locale_raii __current( uselocale(__l), uselocale ); + __libcpp_locale_guard __current(__l); return MB_CUR_MAX; } inline _LIBCPP_ALWAYS_INLINE wint_t __libcpp_btowc_l(int __c, locale_t __l) { - __locale_raii __current( uselocale(__l), uselocale ); + __libcpp_locale_guard __current(__l); return btowc(__c); } inline _LIBCPP_ALWAYS_INLINE int __libcpp_wctob_l(wint_t __c, locale_t __l) { - __locale_raii __current( uselocale(__l), uselocale ); + __libcpp_locale_guard __current(__l); return wctob(__c); } @@ -51,14 +48,14 @@ inline _LIBCPP_ALWAYS_INLINE size_t __libcpp_wcsnrtombs_l(char *__dest, const wchar_t **__src, size_t __nwc, size_t __len, mbstate_t *__ps, locale_t __l) { - __locale_raii __current( uselocale(__l), uselocale ); + __libcpp_locale_guard __current(__l); return wcsnrtombs(__dest, __src, __nwc, __len, __ps); } inline _LIBCPP_ALWAYS_INLINE size_t __libcpp_wcrtomb_l(char *__s, wchar_t __wc, mbstate_t *__ps, locale_t __l) { - __locale_raii __current( uselocale(__l), uselocale ); + __libcpp_locale_guard __current(__l); return wcrtomb(__s, __wc, __ps); } @@ -66,7 +63,7 @@ inline _LIBCPP_ALWAYS_INLINE size_t __libcpp_mbsnrtowcs_l(wchar_t * __dest, const char **__src, size_t __nms, size_t __len, mbstate_t *__ps, locale_t __l) { - __locale_raii __current( uselocale(__l), uselocale ); + __libcpp_locale_guard __current(__l); return mbsnrtowcs(__dest, __src, __nms, __len, __ps); } @@ -74,28 +71,28 @@ inline _LIBCPP_ALWAYS_INLINE size_t __libcpp_mbrtowc_l(wchar_t *__pwc, const char *__s, size_t __n, mbstate_t *__ps, locale_t __l) { - __locale_raii __current( uselocale(__l), uselocale ); + __libcpp_locale_guard __current(__l); return mbrtowc(__pwc, __s, __n, __ps); } inline _LIBCPP_ALWAYS_INLINE int __libcpp_mbtowc_l(wchar_t *__pwc, const char *__pmb, size_t __max, locale_t __l) { - __locale_raii __current( uselocale(__l), uselocale ); + __libcpp_locale_guard __current(__l); return mbtowc(__pwc, __pmb, __max); } inline _LIBCPP_ALWAYS_INLINE size_t __libcpp_mbrlen_l(const char *__s, size_t __n, mbstate_t *__ps, locale_t __l) { - __locale_raii __current( uselocale(__l), uselocale ); + __libcpp_locale_guard __current(__l); return mbrlen(__s, __n, __ps); } inline _LIBCPP_ALWAYS_INLINE lconv *__libcpp_localeconv_l(locale_t __l) { - __locale_raii __current( uselocale(__l), uselocale ); + __libcpp_locale_guard __current(__l); return localeconv(); } @@ -103,7 +100,7 @@ inline _LIBCPP_ALWAYS_INLINE size_t __libcpp_mbsrtowcs_l(wchar_t *__dest, const char **__src, size_t __len, mbstate_t *__ps, locale_t __l) { - __locale_raii __current( uselocale(__l), uselocale ); + __libcpp_locale_guard __current(__l); return mbsrtowcs(__dest, __src, __len, __ps); } @@ -111,7 +108,7 @@ inline int __libcpp_snprintf_l(char *__s, size_t __n, locale_t __l, const char *__format, ...) { va_list __va; va_start(__va, __format); - __locale_raii __current( uselocale(__l), uselocale ); + __libcpp_locale_guard __current(__l); int __res = vsnprintf(__s, __n, __format, __va); va_end(__va); return __res; @@ -121,7 +118,7 @@ inline int __libcpp_asprintf_l(char **__s, locale_t __l, const char *__format, ...) { va_list __va; va_start(__va, __format); - __locale_raii __current( uselocale(__l), uselocale ); + __libcpp_locale_guard __current(__l); int __res = vasprintf(__s, __format, __va); va_end(__va); return __res; @@ -131,7 +128,7 @@ inline int __libcpp_sscanf_l(const char *__s, locale_t __l, const char *__format, ...) { va_list __va; va_start(__va, __format); - __locale_raii __current( uselocale(__l), uselocale ); + __libcpp_locale_guard __current(__l); int __res = vsscanf(__s, __format, __va); va_end(__va); return __res; diff --git a/include/__config b/include/__config index 861adb033..03612ea99 100644 --- a/include/__config +++ b/include/__config @@ -25,8 +25,12 @@ #ifdef __GNUC__ #define _GNUC_VER (__GNUC__ * 100 + __GNUC_MINOR__) +// The _GNUC_VER_NEW macro better represents the new GCC versioning scheme +// introduced in GCC 5.0. +#define _GNUC_VER_NEW (_GNUC_VER * 10 + __GNUC_PATCHLEVEL__) #else #define _GNUC_VER 0 +#define _GNUC_VER_NEW 0 #endif #define _LIBCPP_VERSION 5000 @@ -35,6 +39,16 @@ #define _LIBCPP_ABI_VERSION 1 #endif +#if defined(__ELF__) +#define _LIBCPP_OBJECT_FORMAT_ELF 1 +#elif defined(__MACH__) +#define _LIBCPP_OBJECT_FORMAT_MACHO 1 +#elif defined(_WIN32) +#define _LIBCPP_OBJECT_FORMAT_COFF 1 +#else +#error Unknown object file format +#endif + #if defined(_LIBCPP_ABI_UNSTABLE) || _LIBCPP_ABI_VERSION >= 2 // Change short string representation so that string data starts at offset 0, // improving its alignment in some cases. @@ -49,7 +63,6 @@ #define _LIBCPP_ABI_FIX_UNORDERED_NODE_POINTER_UB #define _LIBCPP_ABI_FORWARD_LIST_REMOVE_NODE_POINTER_UB #define _LIBCPP_ABI_FIX_UNORDERED_CONTAINER_SIZE_TYPE -#define _LIBCPP_ABI_VARIADIC_LOCK_GUARD // Don't use a nullptr_t simulation type in C++03 instead using C++11 nullptr // provided under the alternate keyword __nullptr, which changes the mangling // of nullptr_t. This option is ABI incompatible with GCC in C++03 mode. @@ -59,10 +72,17 @@ // `pointer_safety` and `get_pointer_safety()` will no longer be available // in C++03. #define _LIBCPP_ABI_POINTER_SAFETY_ENUM_TYPE +// Define a key function for `bad_function_call` in the library, to centralize +// its vtable and typeinfo to libc++ rather than having all other libraries +// using that class define their own copies. +#define _LIBCPP_ABI_BAD_FUNCTION_CALL_KEY_FUNCTION #elif _LIBCPP_ABI_VERSION == 1 -#if !defined(_WIN32) +#if !defined(_LIBCPP_OBJECT_FORMAT_COFF) // Enable compiling copies of now inline methods into the dylib to support -// applications compiled against older libraries. +// applications compiled against older libraries. This is unnecessary with +// COFF dllexport semantics, since dllexport forces a non-inline definition +// of inline functions to be emitted anyway. Our own non-inline copy would +// conflict with the dllexport-emitted copy, so we disable it. #define _LIBCPP_DEPRECATED_ABI_LEGACY_LIBRARY_DEFINITIONS_FOR_INLINE_FUNCTIONS #endif // Feature macros for disabling pre ABI v1 features. All of these options @@ -109,6 +129,12 @@ #define __has_keyword(__x) !(__is_identifier(__x)) +#ifdef __has_include +#define __libcpp_has_include(__x) __has_include(__x) +#else +#define __libcpp_has_include(__x) 0 +#endif + #if defined(__clang__) #define _LIBCPP_COMPILER_CLANG # ifndef __apple_build_version__ @@ -194,10 +220,12 @@ #endif // __NetBSD__ #if defined(_WIN32) -# define _LIBCPP_WIN32API 1 +# define _LIBCPP_WIN32API # define _LIBCPP_LITTLE_ENDIAN 1 # define _LIBCPP_BIG_ENDIAN 0 # define _LIBCPP_SHORT_WCHAR 1 +// Both MinGW and native MSVC provide a "MSVC"-like enviroment +# define _LIBCPP_MSVCRT_LIKE // If mingw not explicitly detected, assume using MS C runtime only. # ifndef __MINGW32__ # define _LIBCPP_MSVCRT // Using Microsoft's C Runtime library @@ -208,6 +236,16 @@ # if defined(_LIBCPP_MSVCRT) # define _LIBCPP_HAS_QUICK_EXIT # endif + +// Some CRT APIs are unavailable to store apps +#if defined(WINAPI_FAMILY) +#include +#if !WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP) && \ + (!defined(WINAPI_PARTITION_SYSTEM) || \ + !WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_SYSTEM)) +#define _LIBCPP_WINDOWS_STORE_APP +#endif +#endif #endif // defined(_WIN32) #ifdef __sun__ @@ -262,7 +300,7 @@ // _LIBCPP_ALTERNATE_STRING_LAYOUT is an old name for // _LIBCPP_ABI_ALTERNATE_STRING_LAYOUT left here for backward compatibility. #if (defined(__APPLE__) && !defined(__i386__) && !defined(__x86_64__) && \ - !defined(__arm__)) || \ + (!defined(__arm__) || __ARM_ARCH_7K__ >= 2)) || \ defined(_LIBCPP_ALTERNATE_STRING_LAYOUT) #define _LIBCPP_ABI_ALTERNATE_STRING_LAYOUT #endif @@ -284,7 +322,7 @@ typedef __char32_t char32_t; #define _LIBCPP_NO_EXCEPTIONS #endif -#if !(__has_feature(cxx_rtti)) +#if !(__has_feature(cxx_rtti)) && !defined(_LIBCPP_NO_RTTI) #define _LIBCPP_NO_RTTI #endif @@ -345,7 +383,6 @@ typedef __char32_t char32_t; #if __has_feature(objc_arc_weak) #define _LIBCPP_HAS_OBJC_ARC_WEAK -#define _LIBCPP_HAS_NO_STRONG_ENUMS #endif #if !(__has_feature(cxx_constexpr)) @@ -560,14 +597,6 @@ namespace std { #endif // _LIBCPP_COMPILER_[CLANG|GCC|MSVC|IBM] -#if defined(__ELF__) -#define _LIBCPP_OBJECT_FORMAT_ELF 1 -#elif defined(__MACH__) -#define _LIBCPP_OBJECT_FORMAT_MACHO 1 -#else -#define _LIBCPP_OBJECT_FORMAT_COFF 1 -#endif - #if defined(_LIBCPP_OBJECT_FORMAT_COFF) #if defined(_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS) # define _LIBCPP_DLL_VIS @@ -835,6 +864,11 @@ template struct __static_assert_check {}; # endif #endif +#ifdef _LIBCPP_DISABLE_EXTERN_TEMPLATE +#define _LIBCPP_EXTERN_TEMPLATE(...) +#define _LIBCPP_EXTERN_TEMPLATE2(...) +#endif + #ifndef _LIBCPP_EXTERN_TEMPLATE #define _LIBCPP_EXTERN_TEMPLATE(...) #endif @@ -942,7 +976,7 @@ _LIBCPP_FUNC_VIS extern "C" void __sanitizer_annotate_contiguous_container( # if defined(__GNUC__) && ((__GNUC__ >= 5) || (__GNUC__ == 4 && \ (__GNUC_MINOR__ >= 3 || __GNUC_PATCHLEVEL__ >= 2))) && !defined(__GXX_RTTI) # define _LIBCPP_NO_RTTI -# elif defined(_LIBCPP_MSVC) && !defined(_CPPRTTI) +# elif defined(_LIBCPP_COMPILER_MSVC) && !defined(_CPPRTTI) # define _LIBCPP_NO_RTTI # endif #endif @@ -954,6 +988,7 @@ _LIBCPP_FUNC_VIS extern "C" void __sanitizer_annotate_contiguous_container( // Thread API #if !defined(_LIBCPP_HAS_NO_THREADS) && \ !defined(_LIBCPP_HAS_THREAD_API_PTHREAD) && \ + !defined(_LIBCPP_HAS_THREAD_API_WIN32) && \ !defined(_LIBCPP_HAS_THREAD_API_EXTERNAL) # if defined(__FreeBSD__) || \ defined(__Fuchsia__) || \ @@ -961,7 +996,8 @@ _LIBCPP_FUNC_VIS extern "C" void __sanitizer_annotate_contiguous_container( defined(__linux__) || \ defined(__APPLE__) || \ defined(__CloudABI__) || \ - defined(__sun__) + defined(__sun__) || \ + (defined(__MINGW32__) && __libcpp_has_include()) # define _LIBCPP_HAS_THREAD_API_PTHREAD # elif defined(_LIBCPP_WIN32API) # define _LIBCPP_HAS_THREAD_API_WIN32 @@ -1001,7 +1037,7 @@ _LIBCPP_FUNC_VIS extern "C" void __sanitizer_annotate_contiguous_container( #endif #if defined(__BIONIC__) || defined(__CloudABI__) || \ - defined(_LIBCPP_HAS_MUSL_LIBC) + defined(__Fuchsia__) || defined(_LIBCPP_HAS_MUSL_LIBC) #define _LIBCPP_PROVIDES_DEFAULT_RUNE_TABLE #endif @@ -1044,7 +1080,7 @@ _LIBCPP_FUNC_VIS extern "C" void __sanitizer_annotate_contiguous_container( #endif #if !__has_builtin(__builtin_addressof) && _GNUC_VER < 700 -#define _LIBCPP_HAS_NO_BUILTIN_ADDRESSOF +# define _LIBCPP_HAS_NO_BUILTIN_ADDRESSOF #endif #if !defined(_LIBCPP_HAS_NO_OFF_T_FUNCTIONS) @@ -1063,6 +1099,13 @@ _LIBCPP_FUNC_VIS extern "C" void __sanitizer_annotate_contiguous_container( # define _LIBCPP_DIAGNOSE_ERROR(...) #endif +#if __has_attribute(fallthough) || _GNUC_VER >= 700 +// Use a function like macro to imply that it must be followed by a semicolon +#define _LIBCPP_FALLTHROUGH() __attribute__((__fallthrough__)) +#else +#define _LIBCPP_FALLTHROUGH() ((void)0) +#endif + #if defined(_LIBCPP_ABI_MICROSOFT) && \ (defined(_LIBCPP_COMPILER_MSVC) || __has_declspec_attribute(empty_bases)) # define _LIBCPP_DECLSPEC_EMPTY_BASES __declspec(empty_bases) @@ -1073,8 +1116,125 @@ _LIBCPP_FUNC_VIS extern "C" void __sanitizer_annotate_contiguous_container( #if defined(_LIBCPP_ENABLE_CXX17_REMOVED_FEATURES) # define _LIBCPP_ENABLE_CXX17_REMOVED_AUTO_PTR # define _LIBCPP_ENABLE_CXX17_REMOVED_UNEXPECTED_FUNCTIONS +# define _LIBCPP_ENABLE_CXX17_REMOVED_RANDOM_SHUFFLE +# define _LIBCPP_ENABLE_CXX17_REMOVED_BINDERS #endif // _LIBCPP_ENABLE_CXX17_REMOVED_FEATURES +#if !defined(__cpp_deduction_guides) || __cpp_deduction_guides < 201611 +# define _LIBCPP_HAS_NO_DEDUCTION_GUIDES +#endif + +#if !__has_keyword(__is_aggregate) && (_GNUC_VER_NEW < 7001) +# define _LIBCPP_HAS_NO_IS_AGGREGATE +#endif + +#if !defined(__cpp_coroutines) || __cpp_coroutines < 201703L +# define _LIBCPP_HAS_NO_COROUTINES +#endif + #endif // __cplusplus +// Decide whether to use availability macros. +#if !defined(_LIBCPP_BUILDING_LIBRARY) && \ + !defined(_LIBCPP_DISABLE_AVAILABILITY) && \ + __has_feature(attribute_availability_with_strict) && \ + __has_feature(attribute_availability_in_templates) +#ifdef __APPLE__ +#define _LIBCPP_USE_AVAILABILITY_APPLE +#endif +#endif + +// Define availability macros. +#if defined(_LIBCPP_USE_AVAILABILITY_APPLE) +#define _LIBCPP_AVAILABILITY_SHARED_MUTEX \ + __attribute__((availability(macosx,strict,introduced=10.12))) \ + __attribute__((availability(ios,strict,introduced=10.0))) \ + __attribute__((availability(tvos,strict,introduced=10.0))) \ + __attribute__((availability(watchos,strict,introduced=3.0))) +#define _LIBCPP_AVAILABILITY_BAD_OPTIONAL_ACCESS __attribute__((unavailable)) +#define _LIBCPP_AVAILABILITY_BAD_ARRAY_LENGTH __attribute__((unavailable)) +#define _LIBCPP_AVAILABILITY_UNCAUGHT_EXCEPTIONS \ + __attribute__((availability(macosx,strict,introduced=10.12))) \ + __attribute__((availability(ios,strict,introduced=10.0))) \ + __attribute__((availability(tvos,strict,introduced=10.0))) \ + __attribute__((availability(watchos,strict,introduced=3.0))) +#define _LIBCPP_AVAILABILITY_SIZED_NEW_DELETE \ + __attribute__((availability(macosx,strict,introduced=10.12))) \ + __attribute__((availability(ios,strict,introduced=10.0))) \ + __attribute__((availability(tvos,strict,introduced=10.0))) \ + __attribute__((availability(watchos,strict,introduced=3.0))) +#define _LIBCPP_AVAILABILITY_FUTURE_ERROR \ + __attribute__((availability(ios,strict,introduced=6.0))) +#define _LIBCPP_AVAILABILITY_TYPEINFO_VTABLE \ + __attribute__((availability(macosx,strict,introduced=10.9))) \ + __attribute__((availability(ios,strict,introduced=7.0))) +#define _LIBCPP_AVAILABILITY_LOCALE_CATEGORY \ + __attribute__((availability(macosx,strict,introduced=10.9))) \ + __attribute__((availability(ios,strict,introduced=7.0))) +#define _LIBCPP_AVAILABILITY_ATOMIC_SHARED_PTR \ + __attribute__((availability(macosx,strict,introduced=10.9))) \ + __attribute__((availability(ios,strict,introduced=7.0))) +#else +#define _LIBCPP_AVAILABILITY_SHARED_MUTEX +#define _LIBCPP_AVAILABILITY_BAD_OPTIONAL_ACCESS +#define _LIBCPP_AVAILABILITY_BAD_ARRAY_LENGTH +#define _LIBCPP_AVAILABILITY_UNCAUGHT_EXCEPTIONS +#define _LIBCPP_AVAILABILITY_SIZED_NEW_DELETE +#define _LIBCPP_AVAILABILITY_FUTURE_ERROR +#define _LIBCPP_AVAILABILITY_TYPEINFO_VTABLE +#define _LIBCPP_AVAILABILITY_LOCALE_CATEGORY +#define _LIBCPP_AVAILABILITY_ATOMIC_SHARED_PTR +#endif + +// Define availability that depends on _LIBCPP_NO_EXCEPTIONS. +#ifdef _LIBCPP_NO_EXCEPTIONS +#define _LIBCPP_AVAILABILITY_DYNARRAY +#define _LIBCPP_AVAILABILITY_FUTURE +#else +#define _LIBCPP_AVAILABILITY_DYNARRAY _LIBCPP_AVAILABILITY_BAD_ARRAY_LENGTH +#define _LIBCPP_AVAILABILITY_FUTURE _LIBCPP_AVAILABILITY_FUTURE_ERROR +#endif + +// Availability of stream API in the dylib got dropped and re-added. The +// extern template should effectively be available at: +// availability(macosx,introduced=10.9) +// availability(ios,introduced=7.0) +#if defined(_LIBCPP_USE_AVAILABILITY_APPLE) && \ + ((defined(__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__) && \ + __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ <= 1090) || \ + (defined(__ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__) && \ + __ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__ <= 70000)) +#define _LIBCPP_AVAILABILITY_NO_STREAMS_EXTERN_TEMPLATE +#endif + +#if defined(_LIBCPP_COMPILER_IBM) +#define _LIBCPP_HAS_NO_PRAGMA_PUSH_POP_MACRO +#endif + +#if defined(_LIBCPP_HAS_NO_PRAGMA_PUSH_POP_MACRO) +# define _LIBCPP_PUSH_MACROS +# define _LIBCPP_POP_MACROS +#else + // Don't warn about macro conflicts when we can restore them at the + // end of the header. +# ifndef _LIBCPP_DISABLE_MACRO_CONFLICT_WARNINGS +# define _LIBCPP_DISABLE_MACRO_CONFLICT_WARNINGS +# endif +# if defined(_LIBCPP_COMPILER_MSVC) +# define _LIBCPP_PUSH_MACROS \ + __pragma(push_macro("min")) \ + __pragma(push_macro("max")) +# define _LIBCPP_POP_MACROS \ + __pragma(pop_macro("min")) \ + __pragma(pop_macro("max")) +# else +# define _LIBCPP_PUSH_MACROS \ + _Pragma("push_macro(\"min\")") \ + _Pragma("push_macro(\"max\")") +# define _LIBCPP_POP_MACROS \ + _Pragma("pop_macro(\"min\")") \ + _Pragma("pop_macro(\"max\")") +# endif +#endif // defined(_LIBCPP_HAS_NO_PRAGMA_PUSH_POP_MACRO) + #endif // _LIBCPP_CONFIG diff --git a/include/__functional_base b/include/__functional_base index 4e2b7eb8d..0d2c2fc65 100644 --- a/include/__functional_base +++ b/include/__functional_base @@ -251,7 +251,7 @@ struct __weak_result_type<_Rp (_Cp::*)(_A1) const volatile> }; -#ifndef _LIBCPP_HAS_NO_VARIADICS +#ifndef _LIBCPP_CXX03_LANG // 3 or more arguments template @@ -296,10 +296,6 @@ struct __weak_result_type<_Rp (_Cp::*)(_A1, _A2, _A3...) const volatile> typedef _Rp result_type; }; -#endif // _LIBCPP_HAS_NO_VARIADICS - -#ifndef _LIBCPP_CXX03_LANG - template struct __invoke_return { @@ -316,7 +312,7 @@ struct __invoke_return template struct __invoke_void_return_wrapper { -#ifndef _LIBCPP_HAS_NO_VARIADICS +#ifndef _LIBCPP_CXX03_LANG template static _Ret __call(_Args&&... __args) { return __invoke(_VSTD::forward<_Args>(__args)...); @@ -347,7 +343,7 @@ struct __invoke_void_return_wrapper template <> struct __invoke_void_return_wrapper { -#ifndef _LIBCPP_HAS_NO_VARIADICS +#ifndef _LIBCPP_CXX03_LANG template static void __call(_Args&&... __args) { __invoke(_VSTD::forward<_Args>(__args)...); @@ -389,7 +385,7 @@ public: // construct/copy/destroy _LIBCPP_INLINE_VISIBILITY reference_wrapper(type& __f) _NOEXCEPT : __f_(_VSTD::addressof(__f)) {} -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES +#ifndef _LIBCPP_CXX03_LANG private: reference_wrapper(type&&); public: // = delete; // do not bind to temps #endif @@ -397,7 +393,7 @@ public: _LIBCPP_INLINE_VISIBILITY operator type& () const _NOEXCEPT {return *__f_;} _LIBCPP_INLINE_VISIBILITY type& get() const _NOEXCEPT {return *__f_;} -#ifndef _LIBCPP_HAS_NO_VARIADICS +#ifndef _LIBCPP_CXX03_LANG // invoke template _LIBCPP_INLINE_VISIBILITY @@ -510,7 +506,7 @@ public: operator() (_A0 const& __a0, _A1 const& __a1, _A2 const& __a2) const { return __invoke(get(), __a0, __a1, __a2); } -#endif // _LIBCPP_HAS_NO_VARIADICS +#endif // _LIBCPP_CXX03_LANG }; @@ -568,7 +564,7 @@ public: struct _LIBCPP_TEMPLATE_VIS allocator_arg_t { }; -#if defined(_LIBCPP_HAS_NO_CONSTEXPR) || defined(_LIBCPP_BUILDING_MEMORY) +#if defined(_LIBCPP_CXX03_LANG) || defined(_LIBCPP_BUILDING_MEMORY) extern const allocator_arg_t allocator_arg; #else constexpr allocator_arg_t allocator_arg = allocator_arg_t(); @@ -611,7 +607,7 @@ template constexpr size_t uses_allocator_v = uses_allocator<_Tp, _Alloc>::value; #endif -#ifndef _LIBCPP_HAS_NO_VARIADICS +#ifndef _LIBCPP_CXX03_LANG // allocator construction @@ -663,7 +659,7 @@ void __user_alloc_construct (_Tp *__storage, const _Allocator &__a, _Args &&... __storage, __a, _VSTD::forward<_Args>(__args)... ); } -#endif // _LIBCPP_HAS_NO_VARIADICS +#endif // _LIBCPP_CXX03_LANG _LIBCPP_END_NAMESPACE_STD diff --git a/include/__hash_table b/include/__hash_table index 83a434520..b9cd5158f 100644 --- a/include/__hash_table +++ b/include/__hash_table @@ -20,17 +20,18 @@ #include #include -#include <__undef_min_max> - #include <__debug> #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) #pragma GCC system_header #endif -_LIBCPP_BEGIN_NAMESPACE_STD +_LIBCPP_PUSH_MACROS +#include <__undef_macros> +_LIBCPP_BEGIN_NAMESPACE_STD + #ifndef _LIBCPP_CXX03_LANG template union __hash_value_type; @@ -136,7 +137,7 @@ inline _LIBCPP_INLINE_VISIBILITY size_t __next_hash_pow2(size_t __n) { - return size_t(1) << (std::numeric_limits::digits - __clz(__n-1)); + return __n < 2 ? __n : (size_t(1) << (std::numeric_limits::digits - __clz(__n-1))); } @@ -798,8 +799,7 @@ public: _NOEXCEPT_(is_nothrow_copy_constructible::value) : __data_(__size, __a) {} -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES - +#ifndef _LIBCPP_CXX03_LANG _LIBCPP_INLINE_VISIBILITY __bucket_list_deallocator(__bucket_list_deallocator&& __x) _NOEXCEPT_(is_nothrow_move_constructible::value) @@ -807,8 +807,7 @@ public: { __x.size() = 0; } - -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES +#endif _LIBCPP_INLINE_VISIBILITY size_type& size() _NOEXCEPT {return __data_.first();} @@ -1402,7 +1401,7 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::__hash_table(const hasher& __hf, const key_equal& __eql, const allocator_type& __a) : __bucket_list_(nullptr, __bucket_list_deleter(__pointer_allocator(__a), 0)), - __p1_(__node_allocator(__a)), + __p1_(__second_tag(), __node_allocator(__a)), __p2_(0, __hf), __p3_(1.0f, __eql) { @@ -1411,7 +1410,7 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::__hash_table(const hasher& __hf, template __hash_table<_Tp, _Hash, _Equal, _Alloc>::__hash_table(const allocator_type& __a) : __bucket_list_(nullptr, __bucket_list_deleter(__pointer_allocator(__a), 0)), - __p1_(__node_allocator(__a)), + __p1_(__second_tag(), __node_allocator(__a)), __p2_(0), __p3_(1.0f) { @@ -1423,7 +1422,7 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::__hash_table(const __hash_table& __u) __bucket_list_deleter(allocator_traits<__pointer_allocator>:: select_on_container_copy_construction( __u.__bucket_list_.get_deleter().__alloc()), 0)), - __p1_(allocator_traits<__node_allocator>:: + __p1_(__second_tag(), allocator_traits<__node_allocator>:: select_on_container_copy_construction(__u.__node_alloc())), __p2_(0, __u.hash_function()), __p3_(__u.__p3_) @@ -1434,7 +1433,7 @@ template __hash_table<_Tp, _Hash, _Equal, _Alloc>::__hash_table(const __hash_table& __u, const allocator_type& __a) : __bucket_list_(nullptr, __bucket_list_deleter(__pointer_allocator(__a), 0)), - __p1_(__node_allocator(__a)), + __p1_(__second_tag(), __node_allocator(__a)), __p2_(0, __u.hash_function()), __p3_(__u.__p3_) { @@ -1468,7 +1467,7 @@ template __hash_table<_Tp, _Hash, _Equal, _Alloc>::__hash_table(__hash_table&& __u, const allocator_type& __a) : __bucket_list_(nullptr, __bucket_list_deleter(__pointer_allocator(__a), 0)), - __p1_(__node_allocator(__a)), + __p1_(__second_tag(), __node_allocator(__a)), __p2_(0, _VSTD::move(__u.hash_function())), __p3_(_VSTD::move(__u.__p3_)) { @@ -2670,6 +2669,9 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::__subscriptable(const const_iterator*, } #endif // _LIBCPP_DEBUG_LEVEL >= 2 + _LIBCPP_END_NAMESPACE_STD +_LIBCPP_POP_MACROS + #endif // _LIBCPP__HASH_TABLE diff --git a/include/__locale b/include/__locale index a878e259b..766842294 100644 --- a/include/__locale +++ b/include/__locale @@ -19,7 +19,7 @@ #include #include #include -#if defined(_LIBCPP_MSVCRT) || defined(__MINGW32__) +#if defined(_LIBCPP_MSVCRT_LIKE) # include #elif defined(_AIX) # include @@ -37,9 +37,11 @@ #elif (defined(__GLIBC__) || defined(__APPLE__) || defined(__FreeBSD__) \ || defined(__EMSCRIPTEN__) || defined(__IBMCPP__)) # include +#elif defined(__Fuchsia__) +# include #elif defined(_LIBCPP_HAS_MUSL_LIBC) # include -#endif // __GLIBC__ || __APPLE__ || __FreeBSD__ || __sun__ || __EMSCRIPTEN__ || __IBMCPP__ +#endif #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) #pragma GCC system_header @@ -47,6 +49,25 @@ _LIBCPP_BEGIN_NAMESPACE_STD +#if !defined(_LIBCPP_LOCALE__L_EXTENSIONS) || defined(_LIBCPP_MSVCRT) +struct __libcpp_locale_guard { + _LIBCPP_INLINE_VISIBILITY + __libcpp_locale_guard(locale_t& __loc) : __old_loc_(uselocale(__loc)) {} + + _LIBCPP_INLINE_VISIBILITY + ~__libcpp_locale_guard() { + if (__old_loc_) + uselocale(__old_loc_); + } + + locale_t __old_loc_; +private: + __libcpp_locale_guard(__libcpp_locale_guard const&); + __libcpp_locale_guard& operator=(__libcpp_locale_guard const&); +}; +#endif + + class _LIBCPP_TYPE_VIS locale; template @@ -67,6 +88,7 @@ public: class _LIBCPP_TYPE_VIS id; typedef int category; + _LIBCPP_AVAILABILITY_LOCALE_CATEGORY static const category // values assigned here are for exposition only none = 0, collate = LC_COLLATE_MASK, @@ -345,7 +367,7 @@ public: static const mask punct = _ISpunct; static const mask xdigit = _ISxdigit; static const mask blank = _ISblank; -#elif defined(_LIBCPP_MSVCRT) +#elif defined(_LIBCPP_MSVCRT_LIKE) typedef unsigned short mask; static const mask space = _SPACE; static const mask print = _BLANK|_PUNCT|_ALPHA|_DIGIT; diff --git a/include/__mutex_base b/include/__mutex_base index f76e966e9..3b2453f1b 100644 --- a/include/__mutex_base +++ b/include/__mutex_base @@ -16,10 +16,15 @@ #include #include <__threading_support> + #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) #pragma GCC system_header #endif +_LIBCPP_PUSH_MACROS +#include <__undef_macros> + + _LIBCPP_BEGIN_NAMESPACE_STD #ifndef _LIBCPP_HAS_NO_THREADS @@ -34,7 +39,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD class _LIBCPP_TYPE_VIS _LIBCPP_THREAD_SAFETY_ANNOTATION(capability("mutex")) mutex { -#ifndef _LIBCPP_HAS_NO_CONSTEXPR +#ifndef _LIBCPP_CXX03_LANG __libcpp_mutex_t __m_ = _LIBCPP_MUTEX_INITIALIZER; #else __libcpp_mutex_t __m_; @@ -42,8 +47,8 @@ class _LIBCPP_TYPE_VIS _LIBCPP_THREAD_SAFETY_ANNOTATION(capability("mutex")) mut public: _LIBCPP_INLINE_VISIBILITY -#ifndef _LIBCPP_HAS_NO_CONSTEXPR - constexpr mutex() _NOEXCEPT = default; +#ifndef _LIBCPP_CXX03_LANG + constexpr mutex() = default; #else mutex() _NOEXCEPT {__m_ = (__libcpp_mutex_t)_LIBCPP_MUTEX_INITIALIZER;} #endif @@ -62,11 +67,14 @@ public: _LIBCPP_INLINE_VISIBILITY native_handle_type native_handle() {return &__m_;} }; +static_assert(is_nothrow_default_constructible::value, + "the default constructor for std::mutex must be nothrow"); + struct _LIBCPP_TYPE_VIS defer_lock_t {}; struct _LIBCPP_TYPE_VIS try_to_lock_t {}; struct _LIBCPP_TYPE_VIS adopt_lock_t {}; -#if defined(_LIBCPP_HAS_NO_CONSTEXPR) || defined(_LIBCPP_BUILDING_MUTEX) +#if defined(_LIBCPP_CXX03_LANG) || defined(_LIBCPP_BUILDING_MUTEX) extern const defer_lock_t defer_lock; extern const try_to_lock_t try_to_lock; @@ -80,21 +88,9 @@ constexpr adopt_lock_t adopt_lock = adopt_lock_t(); #endif - -// Forward declare lock_guard as a variadic template even in C++03 to keep -// the mangling consistent between dialects. -#if defined(_LIBCPP_ABI_VARIADIC_LOCK_GUARD) -template -class _LIBCPP_TEMPLATE_VIS lock_guard; -#endif - template class _LIBCPP_TEMPLATE_VIS _LIBCPP_THREAD_SAFETY_ANNOTATION(scoped_lockable) -#if !defined(_LIBCPP_ABI_VARIADIC_LOCK_GUARD) lock_guard -#else -lock_guard<_Mutex> -#endif { public: typedef _Mutex mutex_type; @@ -162,7 +158,7 @@ private: unique_lock& operator=(unique_lock const&); // = delete; public: -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES +#ifndef _LIBCPP_CXX03_LANG _LIBCPP_INLINE_VISIBILITY unique_lock(unique_lock&& __u) _NOEXCEPT : __m_(__u.__m_), __owns_(__u.__owns_) @@ -179,7 +175,7 @@ public: return *this; } -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES +#endif // _LIBCPP_CXX03_LANG void lock(); bool try_lock(); @@ -291,7 +287,7 @@ _LIBCPP_DECLARE_STRONG_ENUM_EPILOG(cv_status) class _LIBCPP_TYPE_VIS condition_variable { -#ifndef _LIBCPP_HAS_NO_CONSTEXPR +#ifndef _LIBCPP_CXX03_LANG __libcpp_condvar_t __cv_ = _LIBCPP_CONDVAR_INITIALIZER; #else __libcpp_condvar_t __cv_; @@ -299,7 +295,7 @@ class _LIBCPP_TYPE_VIS condition_variable public: _LIBCPP_INLINE_VISIBILITY -#ifndef _LIBCPP_HAS_NO_CONSTEXPR +#ifndef _LIBCPP_CXX03_LANG constexpr condition_variable() _NOEXCEPT = default; #else condition_variable() _NOEXCEPT {__cv_ = (__libcpp_condvar_t)_LIBCPP_CONDVAR_INITIALIZER;} @@ -439,4 +435,6 @@ condition_variable::wait_for(unique_lock& __lk, _LIBCPP_END_NAMESPACE_STD +_LIBCPP_POP_MACROS + #endif // _LIBCPP___MUTEX_BASE diff --git a/include/__split_buffer b/include/__split_buffer index 79d1aa1d7..1daa4e5ad 100644 --- a/include/__split_buffer +++ b/include/__split_buffer @@ -6,12 +6,14 @@ #include #include -#include <__undef_min_max> - #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) #pragma GCC system_header #endif +_LIBCPP_PUSH_MACROS +#include <__undef_macros> + + _LIBCPP_BEGIN_NAMESPACE_STD template @@ -66,7 +68,7 @@ public: __split_buffer(size_type __cap, size_type __start, __alloc_rr& __a); ~__split_buffer(); -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES +#ifndef _LIBCPP_CXX03_LANG __split_buffer(__split_buffer&& __c) _NOEXCEPT_(is_nothrow_move_constructible::value); __split_buffer(__split_buffer&& __c, const __alloc_rr& __a); @@ -74,7 +76,7 @@ public: _NOEXCEPT_((__alloc_traits::propagate_on_container_move_assignment::value && is_nothrow_move_assignable::value) || !__alloc_traits::propagate_on_container_move_assignment::value); -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES +#endif // _LIBCPP_CXX03_LANG _LIBCPP_INLINE_VISIBILITY iterator begin() _NOEXCEPT {return __begin_;} _LIBCPP_INLINE_VISIBILITY const_iterator begin() const _NOEXCEPT {return __begin_;} @@ -99,14 +101,12 @@ public: void shrink_to_fit() _NOEXCEPT; void push_front(const_reference __x); _LIBCPP_INLINE_VISIBILITY void push_back(const_reference __x); -#if !defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES) +#ifndef _LIBCPP_CXX03_LANG void push_front(value_type&& __x); void push_back(value_type&& __x); -#if !defined(_LIBCPP_HAS_NO_VARIADICS) template void emplace_back(_Args&&... __args); -#endif // !defined(_LIBCPP_HAS_NO_VARIADICS) -#endif // !defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES) +#endif // !defined(_LIBCPP_CXX03_LANG) _LIBCPP_INLINE_VISIBILITY void pop_front() {__destruct_at_begin(__begin_+1);} _LIBCPP_INLINE_VISIBILITY void pop_back() {__destruct_at_end(__end_-1);} @@ -343,7 +343,7 @@ __split_buffer<_Tp, _Allocator>::~__split_buffer() __alloc_traits::deallocate(__alloc(), __first_, capacity()); } -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES +#ifndef _LIBCPP_CXX03_LANG template __split_buffer<_Tp, _Allocator>::__split_buffer(__split_buffer&& __c) @@ -361,7 +361,7 @@ __split_buffer<_Tp, _Allocator>::__split_buffer(__split_buffer&& __c) template __split_buffer<_Tp, _Allocator>::__split_buffer(__split_buffer&& __c, const __alloc_rr& __a) - : __end_cap_(__a) + : __end_cap_(__second_tag(), __a) { if (__a == __c.__alloc()) { @@ -405,7 +405,7 @@ __split_buffer<_Tp, _Allocator>::operator=(__split_buffer&& __c) return *this; } -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES +#endif // _LIBCPP_CXX03_LANG template void @@ -492,7 +492,7 @@ __split_buffer<_Tp, _Allocator>::push_front(const_reference __x) --__begin_; } -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES +#ifndef _LIBCPP_CXX03_LANG template void @@ -524,7 +524,7 @@ __split_buffer<_Tp, _Allocator>::push_front(value_type&& __x) --__begin_; } -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES +#endif // _LIBCPP_CXX03_LANG template inline _LIBCPP_INLINE_VISIBILITY @@ -556,7 +556,7 @@ __split_buffer<_Tp, _Allocator>::push_back(const_reference __x) ++__end_; } -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES +#ifndef _LIBCPP_CXX03_LANG template void @@ -588,8 +588,6 @@ __split_buffer<_Tp, _Allocator>::push_back(value_type&& __x) ++__end_; } -#ifndef _LIBCPP_HAS_NO_VARIADICS - template template void @@ -621,9 +619,7 @@ __split_buffer<_Tp, _Allocator>::emplace_back(_Args&&... __args) ++__end_; } -#endif // _LIBCPP_HAS_NO_VARIADICS - -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES +#endif // _LIBCPP_CXX03_LANG template inline _LIBCPP_INLINE_VISIBILITY @@ -634,7 +630,8 @@ swap(__split_buffer<_Tp, _Allocator>& __x, __split_buffer<_Tp, _Allocator>& __y) __x.swap(__y); } - _LIBCPP_END_NAMESPACE_STD +_LIBCPP_POP_MACROS + #endif // _LIBCPP_SPLIT_BUFFER diff --git a/include/__std_stream b/include/__std_stream index fb5a346f1..db90795f6 100644 --- a/include/__std_stream +++ b/include/__std_stream @@ -17,12 +17,14 @@ #include <__locale> #include -#include <__undef_min_max> - #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) #pragma GCC system_header #endif +_LIBCPP_PUSH_MACROS +#include <__undef_macros> + + _LIBCPP_BEGIN_NAMESPACE_STD static const int __limit = 8; @@ -355,4 +357,6 @@ __stdoutbuf<_CharT>::imbue(const locale& __loc) _LIBCPP_END_NAMESPACE_STD +_LIBCPP_POP_MACROS + #endif // _LIBCPP___STD_STREAM diff --git a/include/__string b/include/__string index 75608cea7..d30c7fddc 100644 --- a/include/__string +++ b/include/__string @@ -57,14 +57,16 @@ template <> struct char_traits; #include // For EOF. #include // for __murmur2_or_cityhash -#include <__undef_min_max> - #include <__debug> #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) #pragma GCC system_header #endif +_LIBCPP_PUSH_MACROS +#include <__undef_macros> + + _LIBCPP_BEGIN_NAMESPACE_STD // char_traits @@ -870,4 +872,6 @@ struct __quoted_output_proxy _LIBCPP_END_NAMESPACE_STD +_LIBCPP_POP_MACROS + #endif // _LIBCPP___STRING diff --git a/include/__threading_support b/include/__threading_support index aa947139a..5d4c90796 100644 --- a/include/__threading_support +++ b/include/__threading_support @@ -27,11 +27,15 @@ # include # include #elif defined(_LIBCPP_HAS_THREAD_API_WIN32) -#include +#include #include #include #endif +_LIBCPP_PUSH_MACROS +#include <__undef_macros> + + #if defined(_LIBCPP_HAS_THREAD_LIBRARY_EXTERNAL) || \ defined(_LIBCPP_BUILDING_THREAD_LIBRARY_EXTERNAL) #define _LIBCPP_THREAD_ABI_VISIBILITY _LIBCPP_FUNC_VIS @@ -474,7 +478,10 @@ int __libcpp_condvar_timedwait(__libcpp_condvar_t *__cv, __libcpp_mutex_t *__m, timeout_ms.count() > 0 ? timeout_ms.count() : 0, 0)) - return GetLastError(); + { + auto __ec = GetLastError(); + return __ec == ERROR_TIMEOUT ? ETIMEDOUT : __ec; + } return 0; } @@ -625,6 +632,8 @@ int __libcpp_tls_set(__libcpp_tls_key __key, void *__p) _LIBCPP_END_NAMESPACE_STD +_LIBCPP_POP_MACROS + #endif // !_LIBCPP_HAS_NO_THREADS #endif // _LIBCPP_THREADING_SUPPORT diff --git a/include/__tree b/include/__tree index 708fe97cb..792870aa6 100644 --- a/include/__tree +++ b/include/__tree @@ -17,12 +17,14 @@ #include #include -#include <__undef_min_max> - #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) #pragma GCC system_header #endif +_LIBCPP_PUSH_MACROS +#include <__undef_macros> + + _LIBCPP_BEGIN_NAMESPACE_STD template class __tree; @@ -1105,7 +1107,7 @@ public: void __assign_unique(_InputIterator __first, _InputIterator __last); template void __assign_multi(_InputIterator __first, _InputIterator __last); -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES +#ifndef _LIBCPP_CXX03_LANG __tree(__tree&& __t) _NOEXCEPT_( is_nothrow_move_constructible<__node_allocator>::value && @@ -1116,7 +1118,7 @@ public: __node_traits::propagate_on_container_move_assignment::value && is_nothrow_move_assignable::value && is_nothrow_move_assignable<__node_allocator>::value); -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES +#endif // _LIBCPP_CXX03_LANG ~__tree(); @@ -1502,7 +1504,7 @@ __tree<_Tp, _Compare, _Allocator>::__tree(const value_compare& __comp) template __tree<_Tp, _Compare, _Allocator>::__tree(const allocator_type& __a) : __begin_node_(__iter_pointer()), - __pair1_(__node_allocator(__a)), + __pair1_(__second_tag(), __node_allocator(__a)), __pair3_(0) { __begin_node() = __end_node(); @@ -1512,7 +1514,7 @@ template __tree<_Tp, _Compare, _Allocator>::__tree(const value_compare& __comp, const allocator_type& __a) : __begin_node_(__iter_pointer()), - __pair1_(__node_allocator(__a)), + __pair1_(__second_tag(), __node_allocator(__a)), __pair3_(0, __comp) { __begin_node() = __end_node(); @@ -1669,13 +1671,13 @@ __tree<_Tp, _Compare, _Allocator>::__assign_multi(_InputIterator __first, _Input template __tree<_Tp, _Compare, _Allocator>::__tree(const __tree& __t) : __begin_node_(__iter_pointer()), - __pair1_(__node_traits::select_on_container_copy_construction(__t.__node_alloc())), + __pair1_(__second_tag(), __node_traits::select_on_container_copy_construction(__t.__node_alloc())), __pair3_(0, __t.value_comp()) { __begin_node() = __end_node(); } -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES +#ifndef _LIBCPP_CXX03_LANG template __tree<_Tp, _Compare, _Allocator>::__tree(__tree&& __t) @@ -1699,7 +1701,7 @@ __tree<_Tp, _Compare, _Allocator>::__tree(__tree&& __t) template __tree<_Tp, _Compare, _Allocator>::__tree(__tree&& __t, const allocator_type& __a) - : __pair1_(__node_allocator(__a)), + : __pair1_(__second_tag(), __node_allocator(__a)), __pair3_(0, _VSTD::move(__t.value_comp())) { if (__a == __t.__alloc()) @@ -1805,7 +1807,7 @@ __tree<_Tp, _Compare, _Allocator>::operator=(__tree&& __t) return *this; } -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES +#endif // _LIBCPP_CXX03_LANG template __tree<_Tp, _Compare, _Allocator>::~__tree() @@ -2685,4 +2687,6 @@ swap(__tree<_Tp, _Compare, _Allocator>& __x, _LIBCPP_END_NAMESPACE_STD +_LIBCPP_POP_MACROS + #endif // _LIBCPP___TREE diff --git a/include/__tuple b/include/__tuple index 4193d2cff..69d6ee961 100644 --- a/include/__tuple +++ b/include/__tuple @@ -85,7 +85,7 @@ template struct __tuple_like : public __tuple_li // tuple specializations -#if !defined(_LIBCPP_HAS_NO_VARIADICS) +#ifndef _LIBCPP_CXX03_LANG template struct __tuple_indices {}; @@ -189,7 +189,8 @@ template _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 const typename tuple_element<_Ip, tuple<_Tp...> >::type&& get(const tuple<_Tp...>&&) _NOEXCEPT; -#endif + +#endif // !defined(_LIBCPP_CXX03_LANG) // pair specializations @@ -205,7 +206,7 @@ _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 const typename tuple_element<_Ip, pair<_T1, _T2> >::type& get(const pair<_T1, _T2>&) _NOEXCEPT; -#if !defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES) +#ifndef _LIBCPP_CXX03_LANG template _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 typename tuple_element<_Ip, pair<_T1, _T2> >::type&& @@ -233,7 +234,7 @@ _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 const _Tp& get(const array<_Tp, _Size>&) _NOEXCEPT; -#if !defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES) +#ifndef _LIBCPP_CXX03_LANG template _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 _Tp&& @@ -245,8 +246,7 @@ const _Tp&& get(const array<_Tp, _Size>&&) _NOEXCEPT; #endif -#if !defined(_LIBCPP_HAS_NO_VARIADICS) - +#ifndef _LIBCPP_CXX03_LANG // __tuple_types @@ -468,9 +468,6 @@ template using tuple_element_t = typename tuple_element <_Ip, _Tp...>::type; #endif -#endif // _LIBCPP_HAS_NO_VARIADICS - -#ifndef _LIBCPP_CXX03_LANG template struct __tuple_like_with_size_imp : false_type {}; @@ -495,7 +492,7 @@ struct _LIBCPP_TYPE_VIS __check_tuple_constructor_fail { template static constexpr bool __enable_assign() { return false; } }; -#endif +#endif // !defined(_LIBCPP_CXX03_LANG) #if _LIBCPP_STD_VER > 14 diff --git a/include/__undef_min_max b/include/__undef_macros similarity index 76% rename from include/__undef_min_max rename to include/__undef_macros index f4ca091de..60ab1dbfb 100644 --- a/include/__undef_min_max +++ b/include/__undef_macros @@ -1,16 +1,17 @@ // -*- C++ -*- -//===----------------------------------------------------------------------===// +//===------------------------ __undef_macros ------------------------------===// // // The LLVM Compiler Infrastructure // -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. // //===----------------------------------------------------------------------===// + #ifdef min #if !defined(_LIBCPP_DISABLE_MACRO_CONFLICT_WARNINGS) -#if defined(_LIBCPP_MSVC) +#if defined(_LIBCPP_WARNING) _LIBCPP_WARNING("macro min is incompatible with C++. Try #define NOMINMAX " "before any Windows header. #undefing min") #else @@ -22,7 +23,7 @@ _LIBCPP_WARNING("macro min is incompatible with C++. Try #define NOMINMAX " #ifdef max #if !defined(_LIBCPP_DISABLE_MACRO_CONFLICT_WARNINGS) -#if defined(_LIBCPP_MSVC) +#if defined(_LIBCPP_WARNING) _LIBCPP_WARNING("macro max is incompatible with C++. Try #define NOMINMAX " "before any Windows header. #undefing max") #else diff --git a/include/algorithm b/include/algorithm index 5eec80ca0..9fe0361e5 100644 --- a/include/algorithm +++ b/include/algorithm @@ -35,6 +35,9 @@ template Function for_each(InputIterator first, InputIterator last, Function f); +template + InputIterator for_each_n(InputIterator first, Size n, Function f); // C++17 + template InputIterator find(InputIterator first, InputIterator last, const T& value); @@ -281,12 +284,12 @@ template template void - random_shuffle(RandomAccessIterator first, RandomAccessIterator last); // deprecated in C++14 + random_shuffle(RandomAccessIterator first, RandomAccessIterator last); // deprecated in C++14, removed in C++17 template void random_shuffle(RandomAccessIterator first, RandomAccessIterator last, - RandomNumberGenerator& rand); // deprecated in C++14 + RandomNumberGenerator& rand); // deprecated in C++14, removed in C++17 template @@ -644,18 +647,20 @@ template #if defined(__IBMCPP__) #include "support/ibm/support.h" #endif -#if defined(_LIBCPP_MSVCRT) || defined(__MINGW32__) -#include "support/win32/support.h" +#if defined(_LIBCPP_COMPILER_MSVC) +#include #endif -#include <__undef_min_max> - #include <__debug> #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) #pragma GCC system_header #endif +_LIBCPP_PUSH_MACROS +#include <__undef_macros> + + _LIBCPP_BEGIN_NAMESPACE_STD // I'd like to replace these with _VSTD::equal_to, but can't because: @@ -783,51 +788,132 @@ struct __debug_less // Precondition: __x != 0 inline _LIBCPP_INLINE_VISIBILITY -unsigned -__ctz(unsigned __x) -{ +unsigned __ctz(unsigned __x) { +#ifndef _LIBCPP_COMPILER_MSVC return static_cast(__builtin_ctz(__x)); +#else + static_assert(sizeof(unsigned) == sizeof(unsigned long), ""); + static_assert(sizeof(unsigned long) == 4, ""); + unsigned long where; + // Search from LSB to MSB for first set bit. + // Returns zero if no set bit is found. + if (_BitScanForward(&where, mask)) + return where; + return 32; +#endif } inline _LIBCPP_INLINE_VISIBILITY -unsigned long -__ctz(unsigned long __x) -{ +unsigned long __ctz(unsigned long __x) { +#ifndef _LIBCPP_COMPILER_MSVC return static_cast(__builtin_ctzl(__x)); +#else + static_assert(sizeof(unsigned long) == sizeof(unsigned), ""); + return __ctz(static_cast(__x)); +#endif } inline _LIBCPP_INLINE_VISIBILITY -unsigned long long -__ctz(unsigned long long __x) -{ +unsigned long long __ctz(unsigned long long __x) { +#ifndef _LIBCPP_COMPILER_MSVC return static_cast(__builtin_ctzll(__x)); +#else + unsigned long where; +// Search from LSB to MSB for first set bit. +// Returns zero if no set bit is found. +#if defined(_LIBCPP_HAS_BITSCAN64) + (defined(_M_AMD64) || defined(__x86_64__)) + if (_BitScanForward64(&where, mask)) + return static_cast(where); +#else + // Win32 doesn't have _BitScanForward64 so emulate it with two 32 bit calls. + // Scan the Low Word. + if (_BitScanForward(&where, static_cast(mask))) + return where; + // Scan the High Word. + if (_BitScanForward(&where, static_cast(mask >> 32))) + return where + 32; // Create a bit offset from the LSB. +#endif + return 64; +#endif // _LIBCPP_COMPILER_MSVC } // Precondition: __x != 0 inline _LIBCPP_INLINE_VISIBILITY -unsigned -__clz(unsigned __x) -{ +unsigned __clz(unsigned __x) { +#ifndef _LIBCPP_COMPILER_MSVC return static_cast(__builtin_clz(__x)); +#else + static_assert(sizeof(unsigned) == sizeof(unsigned long), ""); + static_assert(sizeof(unsigned long) == 4, ""); + unsigned long where; + // Search from LSB to MSB for first set bit. + // Returns zero if no set bit is found. + if (_BitScanReverse(&where, mask)) + return 31 - where; + return 32; // Undefined Behavior. +#endif } inline _LIBCPP_INLINE_VISIBILITY -unsigned long -__clz(unsigned long __x) -{ +unsigned long __clz(unsigned long __x) { +#ifndef _LIBCPP_COMPILER_MSVC return static_cast(__builtin_clzl (__x)); +#else + static_assert(sizeof(unsigned) == sizeof(unsigned long), ""); + return __clz(static_cast(__x)); +#endif } inline _LIBCPP_INLINE_VISIBILITY -unsigned long long -__clz(unsigned long long __x) -{ +unsigned long long __clz(unsigned long long __x) { +#ifndef _LIBCPP_COMPILER_MSVC return static_cast(__builtin_clzll(__x)); +#else + unsigned long where; +// BitScanReverse scans from MSB to LSB for first set bit. +// Returns 0 if no set bit is found. +#if defined(_LIBCPP_HAS_BITSCAN64) + if (_BitScanReverse64(&where, mask)) + return static_cast(63 - where); +#else + // Scan the high 32 bits. + if (_BitScanReverse(&where, static_cast(mask >> 32))) + return 63 - (where + 32); // Create a bit offset from the MSB. + // Scan the low 32 bits. + if (_BitScanReverse(&where, static_cast(mask))) + return 63 - where; +#endif + return 64; // Undefined Behavior. +#endif // _LIBCPP_COMPILER_MSVC } -inline _LIBCPP_INLINE_VISIBILITY int __pop_count(unsigned __x) {return __builtin_popcount (__x);} -inline _LIBCPP_INLINE_VISIBILITY int __pop_count(unsigned long __x) {return __builtin_popcountl (__x);} -inline _LIBCPP_INLINE_VISIBILITY int __pop_count(unsigned long long __x) {return __builtin_popcountll(__x);} +inline _LIBCPP_INLINE_VISIBILITY int __pop_count(unsigned __x) { +#ifndef _LIBCPP_COMPILER_MSVC + return __builtin_popcount (__x); +#else + static_assert(sizeof(unsigned) == 4, ""); + return __popcnt(__x); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY int __pop_count(unsigned long __x) { +#ifndef _LIBCPP_COMPILER_MSVC + return __builtin_popcountl (__x); +#else + static_assert(sizeof(unsigned long) == 4, ""); + return __popcnt(__x); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY int __pop_count(unsigned long long __x) { +#ifndef _LIBCPP_COMPILER_MSVC + return __builtin_popcountll(__x); +#else + static_assert(sizeof(unsigned long long) == 8, ""); + return __popcnt64(__x); +#endif +} // all_of @@ -880,6 +966,26 @@ for_each(_InputIterator __first, _InputIterator __last, _Function __f) return __f; } +#if _LIBCPP_STD_VER > 14 +// for_each_n + +template +inline _LIBCPP_INLINE_VISIBILITY +_InputIterator +for_each_n(_InputIterator __first, _Size __orig_n, _Function __f) +{ + typedef decltype(__convert_to_integral(__orig_n)) _IntegralSize; + _IntegralSize __n = __orig_n; + while (__n > 0) + { + __f(*__first); + ++__first; + --__n; + } + return __first; +} +#endif + // find template @@ -2548,7 +2654,7 @@ min(const _Tp& __a, const _Tp& __b) return _VSTD::min(__a, __b, __less<_Tp>()); } -#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS +#ifndef _LIBCPP_CXX03_LANG template inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 @@ -2566,7 +2672,7 @@ min(initializer_list<_Tp> __t) return *_VSTD::min_element(__t.begin(), __t.end(), __less<_Tp>()); } -#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS +#endif // _LIBCPP_CXX03_LANG // max_element @@ -2613,7 +2719,7 @@ max(const _Tp& __a, const _Tp& __b) return _VSTD::max(__a, __b, __less<_Tp>()); } -#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS +#ifndef _LIBCPP_CXX03_LANG template inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 @@ -2631,7 +2737,7 @@ max(initializer_list<_Tp> __t) return *_VSTD::max_element(__t.begin(), __t.end(), __less<_Tp>()); } -#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS +#endif // _LIBCPP_CXX03_LANG #if _LIBCPP_STD_VER > 14 // clamp @@ -2732,7 +2838,7 @@ minmax(const _Tp& __a, const _Tp& __b) return _VSTD::minmax(__a, __b, __less<_Tp>()); } -#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS +#ifndef _LIBCPP_CXX03_LANG template inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 @@ -2779,7 +2885,7 @@ minmax(initializer_list<_Tp> __t) return _VSTD::minmax(__t, __less<_Tp>()); } -#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS +#endif // _LIBCPP_CXX03_LANG // random_shuffle @@ -2804,11 +2910,11 @@ struct __log2_imp<0, _Rp> static const size_t value = _Rp + 1; }; -template +template struct __log2 { static const size_t value = __log2_imp<_Xp, - sizeof(_UI) * __CHAR_BIT__ - 1>::value; + sizeof(_UIntType) * __CHAR_BIT__ - 1>::value; }; template @@ -2837,7 +2943,7 @@ private: _Engine_result_type __mask0_; _Engine_result_type __mask1_; -#ifdef _LIBCPP_HAS_NO_CONSTEXPR +#ifdef _LIBCPP_CXX03_LANG static const _Working_result_type _Rp = _Engine::_Max - _Engine::_Min + _Working_result_type(1); #else @@ -3026,6 +3132,8 @@ uniform_int_distribution<_IntType>::operator()(_URNG& __g, const param_type& __p return static_cast(__u + __p.a()); } +#if _LIBCPP_STD_VER <= 14 || defined(_LIBCPP_ENABLE_CXX17_REMOVED_RANDOM_SHUFFLE) \ + || defined(_LIBCPP_BUILDING_LIBRARY) class _LIBCPP_TYPE_VIS __rs_default; _LIBCPP_FUNC_VIS __rs_default __rs_get(); @@ -3078,7 +3186,7 @@ random_shuffle(_RandomAccessIterator __first, _RandomAccessIterator __last) template void random_shuffle(_RandomAccessIterator __first, _RandomAccessIterator __last, -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES +#ifndef _LIBCPP_CXX03_LANG _RandomNumberGenerator&& __rand) #else _RandomNumberGenerator& __rand) @@ -3095,6 +3203,7 @@ random_shuffle(_RandomAccessIterator __first, _RandomAccessIterator __last, } } } +#endif template @@ -3170,7 +3279,7 @@ _SampleIterator sample(_PopulationIterator __first, template void shuffle(_RandomAccessIterator __first, _RandomAccessIterator __last, -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES +#ifndef _LIBCPP_CXX03_LANG _UniformRandomNumberGenerator&& __g) #else _UniformRandomNumberGenerator& __g) @@ -5797,4 +5906,6 @@ prev_permutation(_BidirectionalIterator __first, _BidirectionalIterator __last) _LIBCPP_END_NAMESPACE_STD +_LIBCPP_POP_MACROS + #endif // _LIBCPP_ALGORITHM diff --git a/include/any b/include/any index 823e1304b..d7161b0d6 100644 --- a/include/any +++ b/include/any @@ -45,6 +45,10 @@ namespace std { any& operator=(ValueType&& rhs); // 6.3.3 any modifiers + template + decay_t& emplace(Args&&... args); + template + decay_t& emplace(initializer_list, Args&&...); void reset() noexcept; void swap(any& rhs) noexcept; @@ -73,8 +77,6 @@ namespace std { template ValueType* any_cast(any* operand) noexcept; -} // namespace fundamentals_v1 -} // namespace experimental } // namespace std */ @@ -258,7 +260,7 @@ public: is_copy_constructible<_Tp>::value> > _LIBCPP_INLINE_VISIBILITY - void emplace(_Args&&... args); + _Tp& emplace(_Args&&... args); template , @@ -267,7 +269,7 @@ public: is_copy_constructible<_Tp>::value> > _LIBCPP_INLINE_VISIBILITY - void emplace(initializer_list<_Up>, _Args&&...); + _Tp& emplace(initializer_list<_Up>, _Args&&...); // 6.3.3 any modifiers _LIBCPP_INLINE_VISIBILITY @@ -364,9 +366,10 @@ namespace __any_imp template _LIBCPP_INLINE_VISIBILITY - static void __create(any & __dest, _Args&&... __args) { - ::new (static_cast(&__dest.__s.__buf)) _Tp(_VSTD::forward<_Args>(__args)...); + static _Tp& __create(any & __dest, _Args&&... __args) { + _Tp* __ret = ::new (static_cast(&__dest.__s.__buf)) _Tp(_VSTD::forward<_Args>(__args)...); __dest.__h = &_SmallHandler::__handle; + return *__ret; } private: @@ -439,14 +442,15 @@ namespace __any_imp template _LIBCPP_INLINE_VISIBILITY - static void __create(any & __dest, _Args&&... __args) { + static _Tp& __create(any & __dest, _Args&&... __args) { typedef allocator<_Tp> _Alloc; typedef __allocator_destructor<_Alloc> _Dp; _Alloc __a; unique_ptr<_Tp, _Dp> __hold(__a.allocate(1), _Dp(__a, 1)); - ::new ((void*)__hold.get()) _Tp(_VSTD::forward<_Args>(__args)...); + _Tp* __ret = ::new ((void*)__hold.get()) _Tp(_VSTD::forward<_Args>(__args)...); __dest.__s.__ptr = __hold.release(); __dest.__h = &_LargeHandler::__handle; + return *__ret; } private: @@ -519,16 +523,16 @@ any & any::operator=(_ValueType && __v) template inline _LIBCPP_INLINE_VISIBILITY -void any::emplace(_Args&&... __args) { +_Tp& any::emplace(_Args&&... __args) { reset(); - __any_imp::_Handler<_Tp>::__create(*this, _VSTD::forward<_Args>(__args)...); + return __any_imp::_Handler<_Tp>::__create(*this, _VSTD::forward<_Args>(__args)...); } template inline _LIBCPP_INLINE_VISIBILITY -void any::emplace(initializer_list<_Up> __il, _Args&&... __args) { +_Tp& any::emplace(initializer_list<_Up> __il, _Args&&... __args) { reset(); - __any_imp::_Handler<_Tp>::__create(*this, __il, _VSTD::forward<_Args>(__args)...); + return __any_imp::_Handler<_Tp>::__create(*this, __il, _VSTD::forward<_Args>(__args)...); } inline _LIBCPP_INLINE_VISIBILITY diff --git a/include/array b/include/array index 165ffad6b..79f7e0d62 100644 --- a/include/array +++ b/include/array @@ -113,6 +113,8 @@ template const T&& get(const array&&) noexce #pragma GCC system_header #endif + + _LIBCPP_BEGIN_NAMESPACE_STD template @@ -316,7 +318,7 @@ get(const array<_Tp, _Size>& __a) _NOEXCEPT return __a.__elems_[_Ip]; } -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES +#ifndef _LIBCPP_CXX03_LANG template inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 @@ -336,7 +338,7 @@ get(const array<_Tp, _Size>&& __a) _NOEXCEPT return _VSTD::move(__a.__elems_[_Ip]); } -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES +#endif // !_LIBCPP_CXX03_LANG _LIBCPP_END_NAMESPACE_STD diff --git a/include/atomic b/include/atomic index a17bdce1c..f55e28ff5 100644 --- a/include/atomic +++ b/include/atomic @@ -861,16 +861,29 @@ kill_dependency(_Tp __y) _NOEXCEPT return __y; } -#define ATOMIC_BOOL_LOCK_FREE __GCC_ATOMIC_BOOL_LOCK_FREE -#define ATOMIC_CHAR_LOCK_FREE __GCC_ATOMIC_CHAR_LOCK_FREE -#define ATOMIC_CHAR16_T_LOCK_FREE __GCC_ATOMIC_CHAR16_T_LOCK_FREE -#define ATOMIC_CHAR32_T_LOCK_FREE __GCC_ATOMIC_CHAR32_T_LOCK_FREE -#define ATOMIC_WCHAR_T_LOCK_FREE __GCC_ATOMIC_WCHAR_T_LOCK_FREE -#define ATOMIC_SHORT_LOCK_FREE __GCC_ATOMIC_SHORT_LOCK_FREE -#define ATOMIC_INT_LOCK_FREE __GCC_ATOMIC_INT_LOCK_FREE -#define ATOMIC_LONG_LOCK_FREE __GCC_ATOMIC_LONG_LOCK_FREE -#define ATOMIC_LLONG_LOCK_FREE __GCC_ATOMIC_LLONG_LOCK_FREE -#define ATOMIC_POINTER_LOCK_FREE __GCC_ATOMIC_POINTER_LOCK_FREE +#if defined(__CLANG_ATOMIC_BOOL_LOCK_FREE) +# define ATOMIC_BOOL_LOCK_FREE __CLANG_ATOMIC_BOOL_LOCK_FREE +# define ATOMIC_CHAR_LOCK_FREE __CLANG_ATOMIC_CHAR_LOCK_FREE +# define ATOMIC_CHAR16_T_LOCK_FREE __CLANG_ATOMIC_CHAR16_T_LOCK_FREE +# define ATOMIC_CHAR32_T_LOCK_FREE __CLANG_ATOMIC_CHAR32_T_LOCK_FREE +# define ATOMIC_WCHAR_T_LOCK_FREE __CLANG_ATOMIC_WCHAR_T_LOCK_FREE +# define ATOMIC_SHORT_LOCK_FREE __CLANG_ATOMIC_SHORT_LOCK_FREE +# define ATOMIC_INT_LOCK_FREE __CLANG_ATOMIC_INT_LOCK_FREE +# define ATOMIC_LONG_LOCK_FREE __CLANG_ATOMIC_LONG_LOCK_FREE +# define ATOMIC_LLONG_LOCK_FREE __CLANG_ATOMIC_LLONG_LOCK_FREE +# define ATOMIC_POINTER_LOCK_FREE __CLANG_ATOMIC_POINTER_LOCK_FREE +#else +# define ATOMIC_BOOL_LOCK_FREE __GCC_ATOMIC_BOOL_LOCK_FREE +# define ATOMIC_CHAR_LOCK_FREE __GCC_ATOMIC_CHAR_LOCK_FREE +# define ATOMIC_CHAR16_T_LOCK_FREE __GCC_ATOMIC_CHAR16_T_LOCK_FREE +# define ATOMIC_CHAR32_T_LOCK_FREE __GCC_ATOMIC_CHAR32_T_LOCK_FREE +# define ATOMIC_WCHAR_T_LOCK_FREE __GCC_ATOMIC_WCHAR_T_LOCK_FREE +# define ATOMIC_SHORT_LOCK_FREE __GCC_ATOMIC_SHORT_LOCK_FREE +# define ATOMIC_INT_LOCK_FREE __GCC_ATOMIC_INT_LOCK_FREE +# define ATOMIC_LONG_LOCK_FREE __GCC_ATOMIC_LONG_LOCK_FREE +# define ATOMIC_LLONG_LOCK_FREE __GCC_ATOMIC_LLONG_LOCK_FREE +# define ATOMIC_POINTER_LOCK_FREE __GCC_ATOMIC_POINTER_LOCK_FREE +#endif // general atomic diff --git a/include/bitset b/include/bitset index 827a901ff..583122fbf 100644 --- a/include/bitset +++ b/include/bitset @@ -113,10 +113,6 @@ template struct hash>; */ -#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) -#pragma GCC system_header -#endif - #include <__config> #include <__bit_reference> #include @@ -126,7 +122,13 @@ template struct hash>; #include #include <__functional_base> -#include <__undef_min_max> +#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) +#pragma GCC system_header +#endif + +_LIBCPP_PUSH_MACROS +#include <__undef_macros> + _LIBCPP_BEGIN_NAMESPACE_STD @@ -197,11 +199,11 @@ protected: _LIBCPP_INLINE_VISIBILITY size_t __hash_code() const _NOEXCEPT; private: -#ifdef _LIBCPP_HAS_NO_CONSTEXPR +#ifdef _LIBCPP_CXX03_LANG void __init(unsigned long long __v, false_type) _NOEXCEPT; _LIBCPP_INLINE_VISIBILITY void __init(unsigned long long __v, true_type) _NOEXCEPT; -#endif // _LIBCPP_HAS_NO_CONSTEXPR +#endif // _LIBCPP_CXX03_LANG unsigned long to_ulong(false_type) const; _LIBCPP_INLINE_VISIBILITY unsigned long to_ulong(true_type) const; @@ -217,16 +219,16 @@ template inline _LIBCPP_CONSTEXPR __bitset<_N_words, _Size>::__bitset() _NOEXCEPT -#ifndef _LIBCPP_HAS_NO_CONSTEXPR +#ifndef _LIBCPP_CXX03_LANG : __first_{0} #endif { -#ifdef _LIBCPP_HAS_NO_CONSTEXPR +#ifdef _LIBCPP_CXX03_LANG _VSTD::fill_n(__first_, _N_words, __storage_type(0)); #endif } -#ifdef _LIBCPP_HAS_NO_CONSTEXPR +#ifdef _LIBCPP_CXX03_LANG template void @@ -249,13 +251,13 @@ __bitset<_N_words, _Size>::__init(unsigned long long __v, true_type) _NOEXCEPT _VSTD::fill(__first_ + 1, __first_ + sizeof(__first_)/sizeof(__first_[0]), __storage_type(0)); } -#endif // _LIBCPP_HAS_NO_CONSTEXPR +#endif // _LIBCPP_CXX03_LANG template inline _LIBCPP_CONSTEXPR __bitset<_N_words, _Size>::__bitset(unsigned long long __v) _NOEXCEPT -#ifndef _LIBCPP_HAS_NO_CONSTEXPR +#ifndef _LIBCPP_CXX03_LANG #if __SIZEOF_SIZE_T__ == 8 : __first_{__v} #elif __SIZEOF_SIZE_T__ == 4 @@ -265,7 +267,7 @@ __bitset<_N_words, _Size>::__bitset(unsigned long long __v) _NOEXCEPT #endif #endif { -#ifdef _LIBCPP_HAS_NO_CONSTEXPR +#ifdef _LIBCPP_CXX03_LANG __init(__v, integral_constant()); #endif } @@ -1090,4 +1092,6 @@ operator<<(basic_ostream<_CharT, _Traits>& __os, const bitset<_Size>& __x); _LIBCPP_END_NAMESPACE_STD +_LIBCPP_POP_MACROS + #endif // _LIBCPP_BITSET diff --git a/include/chrono b/include/chrono index 4e82ef2b5..4b793c760 100644 --- a/include/chrono +++ b/include/chrono @@ -48,7 +48,7 @@ class duration static_assert(Period::num > 0, "duration period must be positive"); public: typedef Rep rep; - typedef Period period; + typedef typename _Period::type period; constexpr duration() = default; template @@ -75,8 +75,8 @@ public: // arithmetic - constexpr duration operator+() const; - constexpr duration operator-() const; + constexpr common_type::type operator+() const; + constexpr common_type::type operator-() const; constexpr duration& operator++(); constexpr duration operator++(int); constexpr duration& operator--(); @@ -305,12 +305,14 @@ constexpr chrono::duration operator "" ns(long doub #include #include -#include <__undef_min_max> - #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) #pragma GCC system_header #endif +_LIBCPP_PUSH_MACROS +#include <__undef_macros> + + _LIBCPP_BEGIN_NAMESPACE_STD namespace chrono @@ -523,7 +525,7 @@ class _LIBCPP_TEMPLATE_VIS duration public: typedef _Rep rep; - typedef _Period period; + typedef typename _Period::type period; private: rep __rep_; public: @@ -565,8 +567,8 @@ public: // arithmetic - _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR duration operator+() const {return *this;} - _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR duration operator-() const {return duration(-__rep_);} + _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR typename common_type::type operator+() const {return typename common_type::type(*this);} + _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR typename common_type::type operator-() const {return typename common_type::type(-__rep_);} _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14 duration& operator++() {++__rep_; return *this;} _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14 duration operator++(int) {return duration(__rep_++);} _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14 duration& operator--() {--__rep_; return *this;} @@ -1160,4 +1162,6 @@ namespace chrono { // hoist the literals into namespace std::chrono _LIBCPP_END_NAMESPACE_STD +_LIBCPP_POP_MACROS + #endif // _LIBCPP_CHRONO diff --git a/include/cmath b/include/cmath index 74b4ab8a8..b41f247af 100644 --- a/include/cmath +++ b/include/cmath @@ -398,7 +398,6 @@ using ::cbrtf; using ::copysign; using ::copysignf; -#if !(defined(_LIBCPP_MSVCRT) && ((_VC_CRT_MAJOR_VERSION-0) < 14)) using ::erf; using ::erff; using ::erfc; @@ -435,12 +434,10 @@ using ::lrint; using ::lrintf; using ::lround; using ::lroundf; -#endif // !(defined(_LIBCPP_MSVCRT) && ((_VC_CRT_MAJOR_VERSION-0) < 14)) using ::nan; using ::nanf; -#if !(defined(_LIBCPP_MSVCRT) && ((_VC_CRT_MAJOR_VERSION-0) < 14)) using ::nearbyint; using ::nearbyintf; using ::nextafter; @@ -463,7 +460,6 @@ using ::tgamma; using ::tgammaf; using ::trunc; using ::truncf; -#endif // !(defined(_LIBCPP_MSVCRT) && ((_VC_CRT_MAJOR_VERSION-0) < 14)) using ::acosl; using ::asinl; @@ -495,7 +491,6 @@ using ::cbrtl; using ::copysignl; -#if !(defined(_LIBCPP_MSVCRT) && ((_VC_CRT_MAJOR_VERSION-0) < 14)) using ::erfl; using ::erfcl; using ::exp2l; @@ -526,7 +521,6 @@ using ::scalblnl; using ::scalbnl; using ::tgammal; using ::truncl; -#endif // !(defined(_LIBCPP_MSVCRT) && ((_VC_CRT_MAJOR_VERSION-0) < 14)) #if _LIBCPP_STD_VER > 14 inline _LIBCPP_INLINE_VISIBILITY float hypot( float x, float y, float z ) { return sqrt(x*x + y*y + z*z); } diff --git a/include/cstddef b/include/cstddef index 103898b7d..62584494d 100644 --- a/include/cstddef +++ b/include/cstddef @@ -28,6 +28,7 @@ Types: size_t max_align_t nullptr_t + byte // C++17 } // std @@ -58,4 +59,32 @@ typedef long double max_align_t; _LIBCPP_END_NAMESPACE_STD +#if _LIBCPP_STD_VER > 14 +namespace std // purposefully not versioned +{ +enum class byte : unsigned char {}; + +constexpr byte& operator|=(byte& __lhs, byte __rhs) noexcept +{ return __lhs = byte(static_cast(__lhs) | static_cast(__rhs)); } +constexpr byte operator| (byte __lhs, byte __rhs) noexcept +{ return byte(static_cast(__lhs) | static_cast(__rhs)); } + +constexpr byte& operator&=(byte& __lhs, byte __rhs) noexcept +{ return __lhs = byte(static_cast(__lhs) & static_cast(__rhs)); } +constexpr byte operator& (byte __lhs, byte __rhs) noexcept +{ return byte(static_cast(__lhs) & static_cast(__rhs)); } + +constexpr byte& operator^=(byte& __lhs, byte __rhs) noexcept +{ return __lhs = byte(static_cast(__lhs) ^ static_cast(__rhs)); } +constexpr byte operator^ (byte __lhs, byte __rhs) noexcept +{ return byte(static_cast(__lhs) ^ static_cast(__rhs)); } + +constexpr byte operator~ (byte __b) noexcept +{ return byte(~static_cast(__b)); } + +} + +#include // rest of byte +#endif + #endif // _LIBCPP_CSTDDEF diff --git a/include/cstdio b/include/cstdio index 35941ce35..00b989fad 100644 --- a/include/cstdio +++ b/include/cstdio @@ -98,9 +98,6 @@ void perror(const char* s); #include <__config> #include -#if defined(_LIBCPP_MSVCRT) -#include -#endif #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) #pragma GCC system_header @@ -156,8 +153,7 @@ using ::tmpnam; #ifndef _LIBCPP_HAS_NO_STDIN using ::getchar; -#if _LIBCPP_STD_VER <= 11 && \ - (!defined(_VC_CRT_MAJOR_VERSION) || _VC_CRT_MAJOR_VERSION < 14) +#if _LIBCPP_STD_VER <= 11 && !defined(_LIBCPP_MSVCRT) using ::gets; #endif using ::scanf; diff --git a/include/cstdlib b/include/cstdlib index 2ca25ed56..78c428403 100644 --- a/include/cstdlib +++ b/include/cstdlib @@ -130,8 +130,10 @@ using ::abort; using ::atexit; using ::exit; using ::_Exit; +#ifndef _LIBCPP_WINDOWS_STORE_APP using ::getenv; using ::system; +#endif using ::bsearch; using ::qsort; using ::abs; diff --git a/include/ctype.h b/include/ctype.h index 22d6c49be..e97ff3c48 100644 --- a/include/ctype.h +++ b/include/ctype.h @@ -40,15 +40,6 @@ int toupper(int c); #ifdef __cplusplus -#if defined(_LIBCPP_MSVCRT) -// We support including .h headers inside 'extern "C"' contexts, so switch -// back to C++ linkage before including these C++ headers. -extern "C++" { - #include "support/win32/support.h" - #include "support/win32/locale_win32.h" -} -#endif // _LIBCPP_MSVCRT - #undef isalnum #undef isalpha #undef isblank diff --git a/include/deque b/include/deque index 92801540f..f795b489e 100644 --- a/include/deque +++ b/include/deque @@ -150,10 +150,6 @@ template */ -#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) -#pragma GCC system_header -#endif - #include <__config> #include <__split_buffer> #include @@ -162,7 +158,13 @@ template #include #include -#include <__undef_min_max> +#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) +#pragma GCC system_header +#endif + +_LIBCPP_PUSH_MACROS +#include <__undef_macros> + _LIBCPP_BEGIN_NAMESPACE_STD @@ -968,13 +970,12 @@ protected: public: ~__deque_base(); -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES - +#ifndef _LIBCPP_CXX03_LANG __deque_base(__deque_base&& __c) _NOEXCEPT_(is_nothrow_move_constructible::value); __deque_base(__deque_base&& __c, const allocator_type& __a); +#endif // _LIBCPP_CXX03_LANG -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES void swap(__deque_base& __c) #if _LIBCPP_STD_VER >= 14 _NOEXCEPT; @@ -1108,7 +1109,7 @@ __deque_base<_Tp, _Allocator>::~__deque_base() __alloc_traits::deallocate(__alloc(), *__i, __block_size); } -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES +#ifndef _LIBCPP_CXX03_LANG template __deque_base<_Tp, _Allocator>::__deque_base(__deque_base&& __c) @@ -1140,7 +1141,7 @@ __deque_base<_Tp, _Allocator>::__deque_base(__deque_base&& __c, const allocator_ } } -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES +#endif // _LIBCPP_CXX03_LANG template void @@ -1230,18 +1231,16 @@ public: typename enable_if<__is_input_iterator<_InputIter>::value>::type* = 0); deque(const deque& __c); deque(const deque& __c, const allocator_type& __a); -#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS - deque(initializer_list __il); - deque(initializer_list __il, const allocator_type& __a); -#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS deque& operator=(const deque& __c); -#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS + +#ifndef _LIBCPP_CXX03_LANG + deque(initializer_list __il); + deque(initializer_list __il, const allocator_type& __a); + _LIBCPP_INLINE_VISIBILITY deque& operator=(initializer_list __il) {assign(__il); return *this;} -#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES _LIBCPP_INLINE_VISIBILITY deque(deque&& __c) _NOEXCEPT_(is_nothrow_move_constructible<__base>::value); _LIBCPP_INLINE_VISIBILITY @@ -1250,7 +1249,10 @@ public: deque& operator=(deque&& __c) _NOEXCEPT_(__alloc_traits::propagate_on_container_move_assignment::value && is_nothrow_move_assignable::value); -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES + + _LIBCPP_INLINE_VISIBILITY + void assign(initializer_list __il) {assign(__il.begin(), __il.end());} +#endif // _LIBCPP_CXX03_LANG template void assign(_InputIter __f, _InputIter __l, @@ -1260,10 +1262,6 @@ public: void assign(_RAIter __f, _RAIter __l, typename enable_if<__is_random_access_iterator<_RAIter>::value>::type* = 0); void assign(size_type __n, const value_type& __v); -#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS - _LIBCPP_INLINE_VISIBILITY - void assign(initializer_list __il) {assign(__il.begin(), __il.end());} -#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS _LIBCPP_INLINE_VISIBILITY allocator_type get_allocator() const _NOEXCEPT; @@ -1340,8 +1338,7 @@ public: // 23.2.2.3 modifiers: void push_front(const value_type& __v); void push_back(const value_type& __v); -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES -#ifndef _LIBCPP_HAS_NO_VARIADICS +#ifndef _LIBCPP_CXX03_LANG #if _LIBCPP_STD_VER > 14 template reference emplace_front(_Args&&... __args); template reference emplace_back (_Args&&... __args); @@ -1350,11 +1347,16 @@ public: template void emplace_back (_Args&&... __args); #endif template iterator emplace(const_iterator __p, _Args&&... __args); -#endif // _LIBCPP_HAS_NO_VARIADICS + void push_front(value_type&& __v); void push_back(value_type&& __v); iterator insert(const_iterator __p, value_type&& __v); -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES + + _LIBCPP_INLINE_VISIBILITY + iterator insert(const_iterator __p, initializer_list __il) + {return insert(__p, __il.begin(), __il.end());} +#endif // _LIBCPP_CXX03_LANG + iterator insert(const_iterator __p, const value_type& __v); iterator insert(const_iterator __p, size_type __n, const value_type& __v); template @@ -1368,11 +1370,7 @@ public: template iterator insert(const_iterator __p, _BiIter __f, _BiIter __l, typename enable_if<__is_bidirectional_iterator<_BiIter>::value>::type* = 0); -#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS - _LIBCPP_INLINE_VISIBILITY - iterator insert(const_iterator __p, initializer_list __il) - {return insert(__p, __il.begin(), __il.end());} -#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS + void pop_front(); void pop_back(); iterator erase(const_iterator __p); @@ -1527,7 +1525,19 @@ deque<_Tp, _Allocator>::deque(const deque& __c, const allocator_type& __a) __append(__c.begin(), __c.end()); } -#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS +template +deque<_Tp, _Allocator>& +deque<_Tp, _Allocator>::operator=(const deque& __c) +{ + if (this != &__c) + { + __copy_assign_alloc(__c); + assign(__c.begin(), __c.end()); + } + return *this; +} + +#ifndef _LIBCPP_CXX03_LANG template deque<_Tp, _Allocator>::deque(initializer_list __il) @@ -1542,22 +1552,6 @@ deque<_Tp, _Allocator>::deque(initializer_list __il, const allocator __append(__il.begin(), __il.end()); } -#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS - -template -deque<_Tp, _Allocator>& -deque<_Tp, _Allocator>::operator=(const deque& __c) -{ - if (this != &__c) - { - __copy_assign_alloc(__c); - assign(__c.begin(), __c.end()); - } - return *this; -} - -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES - template inline deque<_Tp, _Allocator>::deque(deque&& __c) @@ -1613,7 +1607,7 @@ deque<_Tp, _Allocator>::__move_assign(deque& __c, true_type) __base::__move_assign(__c); } -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES +#endif // _LIBCPP_CXX03_LANG template template @@ -1809,8 +1803,20 @@ deque<_Tp, _Allocator>::push_back(const value_type& __v) ++__base::size(); } -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES +template +void +deque<_Tp, _Allocator>::push_front(const value_type& __v) +{ + allocator_type& __a = __base::__alloc(); + if (__front_spare() == 0) + __add_front_capacity(); + // __front_spare() >= 1 + __alloc_traits::construct(__a, _VSTD::addressof(*--__base::begin()), __v); + --__base::__start_; + ++__base::size(); +} +#ifndef _LIBCPP_CXX03_LANG template void deque<_Tp, _Allocator>::push_back(value_type&& __v) @@ -1823,8 +1829,6 @@ deque<_Tp, _Allocator>::push_back(value_type&& __v) ++__base::size(); } -#ifndef _LIBCPP_HAS_NO_VARIADICS - template template #if _LIBCPP_STD_VER > 14 @@ -1846,24 +1850,6 @@ deque<_Tp, _Allocator>::emplace_back(_Args&&... __args) #endif } -#endif // _LIBCPP_HAS_NO_VARIADICS -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES - -template -void -deque<_Tp, _Allocator>::push_front(const value_type& __v) -{ - allocator_type& __a = __base::__alloc(); - if (__front_spare() == 0) - __add_front_capacity(); - // __front_spare() >= 1 - __alloc_traits::construct(__a, _VSTD::addressof(*--__base::begin()), __v); - --__base::__start_; - ++__base::size(); -} - -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES - template void deque<_Tp, _Allocator>::push_front(value_type&& __v) @@ -1877,7 +1863,6 @@ deque<_Tp, _Allocator>::push_front(value_type&& __v) ++__base::size(); } -#ifndef _LIBCPP_HAS_NO_VARIADICS template template @@ -1900,8 +1885,121 @@ deque<_Tp, _Allocator>::emplace_front(_Args&&... __args) #endif } -#endif // _LIBCPP_HAS_NO_VARIADICS -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES +template +typename deque<_Tp, _Allocator>::iterator +deque<_Tp, _Allocator>::insert(const_iterator __p, value_type&& __v) +{ + size_type __pos = __p - __base::begin(); + size_type __to_end = __base::size() - __pos; + allocator_type& __a = __base::__alloc(); + if (__pos < __to_end) + { // insert by shifting things backward + if (__front_spare() == 0) + __add_front_capacity(); + // __front_spare() >= 1 + if (__pos == 0) + { + __alloc_traits::construct(__a, _VSTD::addressof(*--__base::begin()), _VSTD::move(__v)); + --__base::__start_; + ++__base::size(); + } + else + { + iterator __b = __base::begin(); + iterator __bm1 = _VSTD::prev(__b); + __alloc_traits::construct(__a, _VSTD::addressof(*__bm1), _VSTD::move(*__b)); + --__base::__start_; + ++__base::size(); + if (__pos > 1) + __b = _VSTD::move(_VSTD::next(__b), __b + __pos, __b); + *__b = _VSTD::move(__v); + } + } + else + { // insert by shifting things forward + if (__back_spare() == 0) + __add_back_capacity(); + // __back_capacity >= 1 + size_type __de = __base::size() - __pos; + if (__de == 0) + { + __alloc_traits::construct(__a, _VSTD::addressof(*__base::end()), _VSTD::move(__v)); + ++__base::size(); + } + else + { + iterator __e = __base::end(); + iterator __em1 = _VSTD::prev(__e); + __alloc_traits::construct(__a, _VSTD::addressof(*__e), _VSTD::move(*__em1)); + ++__base::size(); + if (__de > 1) + __e = _VSTD::move_backward(__e - __de, __em1, __e); + *--__e = _VSTD::move(__v); + } + } + return __base::begin() + __pos; +} + +template +template +typename deque<_Tp, _Allocator>::iterator +deque<_Tp, _Allocator>::emplace(const_iterator __p, _Args&&... __args) +{ + size_type __pos = __p - __base::begin(); + size_type __to_end = __base::size() - __pos; + allocator_type& __a = __base::__alloc(); + if (__pos < __to_end) + { // insert by shifting things backward + if (__front_spare() == 0) + __add_front_capacity(); + // __front_spare() >= 1 + if (__pos == 0) + { + __alloc_traits::construct(__a, _VSTD::addressof(*--__base::begin()), _VSTD::forward<_Args>(__args)...); + --__base::__start_; + ++__base::size(); + } + else + { + __temp_value __tmp(this->__alloc(), _VSTD::forward<_Args>(__args)...); + iterator __b = __base::begin(); + iterator __bm1 = _VSTD::prev(__b); + __alloc_traits::construct(__a, _VSTD::addressof(*__bm1), _VSTD::move(*__b)); + --__base::__start_; + ++__base::size(); + if (__pos > 1) + __b = _VSTD::move(_VSTD::next(__b), __b + __pos, __b); + *__b = _VSTD::move(__tmp.get()); + } + } + else + { // insert by shifting things forward + if (__back_spare() == 0) + __add_back_capacity(); + // __back_capacity >= 1 + size_type __de = __base::size() - __pos; + if (__de == 0) + { + __alloc_traits::construct(__a, _VSTD::addressof(*__base::end()), _VSTD::forward<_Args>(__args)...); + ++__base::size(); + } + else + { + __temp_value __tmp(this->__alloc(), _VSTD::forward<_Args>(__args)...); + iterator __e = __base::end(); + iterator __em1 = _VSTD::prev(__e); + __alloc_traits::construct(__a, _VSTD::addressof(*__e), _VSTD::move(*__em1)); + ++__base::size(); + if (__de > 1) + __e = _VSTD::move_backward(__e - __de, __em1, __e); + *--__e = _VSTD::move(__tmp.get()); + } + } + return __base::begin() + __pos; +} + +#endif // _LIBCPP_CXX03_LANG + template typename deque<_Tp, _Allocator>::iterator @@ -1964,126 +2062,6 @@ deque<_Tp, _Allocator>::insert(const_iterator __p, const value_type& __v) return __base::begin() + __pos; } -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES - -template -typename deque<_Tp, _Allocator>::iterator -deque<_Tp, _Allocator>::insert(const_iterator __p, value_type&& __v) -{ - size_type __pos = __p - __base::begin(); - size_type __to_end = __base::size() - __pos; - allocator_type& __a = __base::__alloc(); - if (__pos < __to_end) - { // insert by shifting things backward - if (__front_spare() == 0) - __add_front_capacity(); - // __front_spare() >= 1 - if (__pos == 0) - { - __alloc_traits::construct(__a, _VSTD::addressof(*--__base::begin()), _VSTD::move(__v)); - --__base::__start_; - ++__base::size(); - } - else - { - iterator __b = __base::begin(); - iterator __bm1 = _VSTD::prev(__b); - __alloc_traits::construct(__a, _VSTD::addressof(*__bm1), _VSTD::move(*__b)); - --__base::__start_; - ++__base::size(); - if (__pos > 1) - __b = _VSTD::move(_VSTD::next(__b), __b + __pos, __b); - *__b = _VSTD::move(__v); - } - } - else - { // insert by shifting things forward - if (__back_spare() == 0) - __add_back_capacity(); - // __back_capacity >= 1 - size_type __de = __base::size() - __pos; - if (__de == 0) - { - __alloc_traits::construct(__a, _VSTD::addressof(*__base::end()), _VSTD::move(__v)); - ++__base::size(); - } - else - { - iterator __e = __base::end(); - iterator __em1 = _VSTD::prev(__e); - __alloc_traits::construct(__a, _VSTD::addressof(*__e), _VSTD::move(*__em1)); - ++__base::size(); - if (__de > 1) - __e = _VSTD::move_backward(__e - __de, __em1, __e); - *--__e = _VSTD::move(__v); - } - } - return __base::begin() + __pos; -} - -#ifndef _LIBCPP_HAS_NO_VARIADICS - -template -template -typename deque<_Tp, _Allocator>::iterator -deque<_Tp, _Allocator>::emplace(const_iterator __p, _Args&&... __args) -{ - size_type __pos = __p - __base::begin(); - size_type __to_end = __base::size() - __pos; - allocator_type& __a = __base::__alloc(); - if (__pos < __to_end) - { // insert by shifting things backward - if (__front_spare() == 0) - __add_front_capacity(); - // __front_spare() >= 1 - if (__pos == 0) - { - __alloc_traits::construct(__a, _VSTD::addressof(*--__base::begin()), _VSTD::forward<_Args>(__args)...); - --__base::__start_; - ++__base::size(); - } - else - { - __temp_value __tmp(this->__alloc(), _VSTD::forward<_Args>(__args)...); - iterator __b = __base::begin(); - iterator __bm1 = _VSTD::prev(__b); - __alloc_traits::construct(__a, _VSTD::addressof(*__bm1), _VSTD::move(*__b)); - --__base::__start_; - ++__base::size(); - if (__pos > 1) - __b = _VSTD::move(_VSTD::next(__b), __b + __pos, __b); - *__b = _VSTD::move(__tmp.get()); - } - } - else - { // insert by shifting things forward - if (__back_spare() == 0) - __add_back_capacity(); - // __back_capacity >= 1 - size_type __de = __base::size() - __pos; - if (__de == 0) - { - __alloc_traits::construct(__a, _VSTD::addressof(*__base::end()), _VSTD::forward<_Args>(__args)...); - ++__base::size(); - } - else - { - __temp_value __tmp(this->__alloc(), _VSTD::forward<_Args>(__args)...); - iterator __e = __base::end(); - iterator __em1 = _VSTD::prev(__e); - __alloc_traits::construct(__a, _VSTD::addressof(*__e), _VSTD::move(*__em1)); - ++__base::size(); - if (__de > 1) - __e = _VSTD::move_backward(__e - __de, __em1, __e); - *--__e = _VSTD::move(__tmp.get()); - } - } - return __base::begin() + __pos; -} - -#endif // _LIBCPP_HAS_NO_VARIADICS -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES - template typename deque<_Tp, _Allocator>::iterator deque<_Tp, _Allocator>::insert(const_iterator __p, size_type __n, const value_type& __v) @@ -2924,4 +2902,6 @@ swap(deque<_Tp, _Allocator>& __x, deque<_Tp, _Allocator>& __y) _LIBCPP_END_NAMESPACE_STD +_LIBCPP_POP_MACROS + #endif // _LIBCPP_DEQUE diff --git a/include/exception b/include/exception index 216ae0c70..ca2eaf5c6 100644 --- a/include/exception +++ b/include/exception @@ -127,30 +127,33 @@ _LIBCPP_FUNC_VIS terminate_handler get_terminate() _NOEXCEPT; _LIBCPP_NORETURN _LIBCPP_FUNC_VIS void terminate() _NOEXCEPT; _LIBCPP_FUNC_VIS bool uncaught_exception() _NOEXCEPT; -_LIBCPP_FUNC_VIS int uncaught_exceptions() _NOEXCEPT; +_LIBCPP_FUNC_VIS _LIBCPP_AVAILABILITY_UNCAUGHT_EXCEPTIONS int uncaught_exceptions() _NOEXCEPT; class _LIBCPP_TYPE_VIS exception_ptr; _LIBCPP_FUNC_VIS exception_ptr current_exception() _NOEXCEPT; _LIBCPP_NORETURN _LIBCPP_FUNC_VIS void rethrow_exception(exception_ptr); +#ifndef _LIBCPP_ABI_MICROSOFT + class _LIBCPP_TYPE_VIS exception_ptr { void* __ptr_; public: _LIBCPP_INLINE_VISIBILITY exception_ptr() _NOEXCEPT : __ptr_() {} _LIBCPP_INLINE_VISIBILITY exception_ptr(nullptr_t) _NOEXCEPT : __ptr_() {} + exception_ptr(const exception_ptr&) _NOEXCEPT; exception_ptr& operator=(const exception_ptr&) _NOEXCEPT; ~exception_ptr() _NOEXCEPT; - _LIBCPP_INLINE_VISIBILITY - _LIBCPP_EXPLICIT - operator bool() const _NOEXCEPT {return __ptr_ != nullptr;} + _LIBCPP_INLINE_VISIBILITY _LIBCPP_EXPLICIT operator bool() const _NOEXCEPT + {return __ptr_ != nullptr;} friend _LIBCPP_INLINE_VISIBILITY bool operator==(const exception_ptr& __x, const exception_ptr& __y) _NOEXCEPT {return __x.__ptr_ == __y.__ptr_;} + friend _LIBCPP_INLINE_VISIBILITY bool operator!=(const exception_ptr& __x, const exception_ptr& __y) _NOEXCEPT {return !(__x == __y);} @@ -178,6 +181,54 @@ make_exception_ptr(_Ep __e) _NOEXCEPT #endif } +#else // _LIBCPP_ABI_MICROSOFT + +class _LIBCPP_TYPE_VIS exception_ptr +{ +#if defined(__clang__) +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wunused-private-field" +#endif + void* __ptr1_; + void* __ptr2_; +#if defined(__clang__) +#pragma clang diagnostic pop +#endif +public: + exception_ptr() _NOEXCEPT; + exception_ptr(nullptr_t) _NOEXCEPT; + exception_ptr(const exception_ptr& __other) _NOEXCEPT; + exception_ptr& operator=(const exception_ptr& __other) _NOEXCEPT; + exception_ptr& operator=(nullptr_t) _NOEXCEPT; + ~exception_ptr() _NOEXCEPT; + _LIBCPP_EXPLICIT operator bool() const _NOEXCEPT; +}; + +_LIBCPP_FUNC_VIS +bool operator==(const exception_ptr& __x, const exception_ptr& __y) _NOEXCEPT; + +inline _LIBCPP_INLINE_VISIBILITY +bool operator!=(const exception_ptr& __x, const exception_ptr& __y) _NOEXCEPT + {return !(__x == __y);} + +_LIBCPP_FUNC_VIS void swap(exception_ptr&, exception_ptr&) _NOEXCEPT; + +_LIBCPP_FUNC_VIS exception_ptr __copy_exception_ptr(void *__except, const void* __ptr); +_LIBCPP_FUNC_VIS exception_ptr current_exception() _NOEXCEPT; +_LIBCPP_NORETURN _LIBCPP_FUNC_VIS void rethrow_exception(exception_ptr p); + +// This is a built-in template function which automagically extracts the required +// information. +template void *__GetExceptionInfo(_E); + +template +exception_ptr +make_exception_ptr(_Ep __e) _NOEXCEPT +{ + return __copy_exception_ptr(_VSTD::addressof(__e), __GetExceptionInfo(__e)); +} + +#endif // _LIBCPP_ABI_MICROSOFT // nested_exception class _LIBCPP_EXCEPTION_ABI nested_exception @@ -202,46 +253,54 @@ struct __nested _LIBCPP_INLINE_VISIBILITY explicit __nested(const _Tp& __t) : _Tp(__t) {} }; -template -_LIBCPP_NORETURN -void -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES -throw_with_nested(_Tp&& __t, typename enable_if< - is_class::type>::value && - !is_base_of::type>::value - && !__libcpp_is_final::type>::value - >::type* = 0) -#else // _LIBCPP_HAS_NO_RVALUE_REFERENCES -throw_with_nested (_Tp& __t, typename enable_if< - is_class<_Tp>::value && !is_base_of::value - >::type* = 0) -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES -{ #ifndef _LIBCPP_NO_EXCEPTIONS - throw __nested::type>(_VSTD::forward<_Tp>(__t)); +template +struct __throw_with_nested; + +template +struct __throw_with_nested<_Tp, _Up, true> { + _LIBCPP_NORETURN static inline _LIBCPP_ALWAYS_INLINE void +#ifndef _LIBCPP_CXX03_LANG + __do_throw(_Tp&& __t) #else - ((void)__t); - // FIXME: Make this abort. + __do_throw (_Tp& __t) +#endif // _LIBCPP_CXX03_LANG + { + throw __nested<_Up>(_VSTD::forward<_Tp>(__t)); + } +}; + +template +struct __throw_with_nested<_Tp, _Up, false> { + _LIBCPP_NORETURN static inline _LIBCPP_ALWAYS_INLINE void +#ifndef _LIBCPP_CXX03_LANG + __do_throw(_Tp&& __t) +#else + __do_throw (_Tp& __t) +#endif // _LIBCPP_CXX03_LANG + { + throw _VSTD::forward<_Tp>(__t); + } +}; #endif -} template _LIBCPP_NORETURN void -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES -throw_with_nested(_Tp&& __t, typename enable_if< - !is_class::type>::value || - is_base_of::type>::value - || __libcpp_is_final::type>::value - >::type* = 0) -#else // _LIBCPP_HAS_NO_RVALUE_REFERENCES -throw_with_nested (_Tp& __t, typename enable_if< - !is_class<_Tp>::value || is_base_of::value - >::type* = 0) -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES +#ifndef _LIBCPP_CXX03_LANG +throw_with_nested(_Tp&& __t) +#else +throw_with_nested (_Tp& __t) +#endif // _LIBCPP_CXX03_LANG { #ifndef _LIBCPP_NO_EXCEPTIONS - throw _VSTD::forward<_Tp>(__t); + typedef typename decay<_Tp>::type _Up; + static_assert( is_copy_constructible<_Up>::value, "type thrown must be CopyConstructible"); + __throw_with_nested<_Tp, _Up, + is_class<_Up>::value && + !is_base_of::value && + !__libcpp_is_final<_Up>::value>:: + __do_throw(_VSTD::forward<_Tp>(__t)); #else ((void)__t); // FIXME: Make this abort diff --git a/include/experimental/__config b/include/experimental/__config index 9a7bbe85d..37f88c166 100644 --- a/include/experimental/__config +++ b/include/experimental/__config @@ -44,6 +44,13 @@ #define _LIBCPP_END_NAMESPACE_EXPERIMENTAL_FILESYSTEM \ } } _LIBCPP_END_NAMESPACE_EXPERIMENTAL +#define _LIBCPP_BEGIN_NAMESPACE_EXPERIMENTAL_COROUTINES \ + _LIBCPP_BEGIN_NAMESPACE_EXPERIMENTAL inline namespace coroutines_v1 { + +#define _LIBCPP_END_NAMESPACE_EXPERIMENTAL_COROUTINES \ + } _LIBCPP_END_NAMESPACE_EXPERIMENTAL + +#define _VSTD_CORO _VSTD_EXPERIMENTAL::coroutines_v1 #define _VSTD_FS ::std::experimental::filesystem::v1 diff --git a/include/experimental/algorithm b/include/experimental/algorithm index b32d7ca66..3801cae4f 100644 --- a/include/experimental/algorithm +++ b/include/experimental/algorithm @@ -39,17 +39,18 @@ SampleIterator sample(PopulationIterator first, PopulationIterator last, #include #include -#include <__undef_min_max> - #include <__debug> #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) #pragma GCC system_header #endif -_LIBCPP_BEGIN_NAMESPACE_LFTS +_LIBCPP_PUSH_MACROS +#include <__undef_macros> +_LIBCPP_BEGIN_NAMESPACE_LFTS + template _LIBCPP_INLINE_VISIBILITY _ForwardIterator search(_ForwardIterator __f, _ForwardIterator __l, const _Searcher &__s) @@ -67,4 +68,6 @@ _SampleIterator sample(_PopulationIterator __first, _PopulationIterator __last, _LIBCPP_END_NAMESPACE_LFTS +_LIBCPP_POP_MACROS + #endif /* _LIBCPP_EXPERIMENTAL_ALGORITHM */ diff --git a/include/experimental/coroutine b/include/experimental/coroutine new file mode 100644 index 000000000..21c1ea566 --- /dev/null +++ b/include/experimental/coroutine @@ -0,0 +1,294 @@ +// -*- C++ -*- +//===----------------------------- coroutine -----------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +#ifndef _LIBCPP_EXPERIMENTAL_COROUTINE +#define _LIBCPP_EXPERIMENTAL_COROUTINE + +/** + experimental/coroutine synopsis + +// C++next + +namespace std { +namespace experimental { +inline namespace coroutines_v1 { + + // 18.11.1 coroutine traits +template +class coroutine_traits; +// 18.11.2 coroutine handle +template +class coroutine_handle; +// 18.11.2.7 comparison operators: +bool operator==(coroutine_handle<> x, coroutine_handle<> y) _NOEXCEPT; +bool operator!=(coroutine_handle<> x, coroutine_handle<> y) _NOEXCEPT; +bool operator<(coroutine_handle<> x, coroutine_handle<> y) _NOEXCEPT; +bool operator<=(coroutine_handle<> x, coroutine_handle<> y) _NOEXCEPT; +bool operator>=(coroutine_handle<> x, coroutine_handle<> y) _NOEXCEPT; +bool operator>(coroutine_handle<> x, coroutine_handle<> y) _NOEXCEPT; +// 18.11.3 trivial awaitables +struct suspend_never; +struct suspend_always; +// 18.11.2.8 hash support: +template struct hash; +template struct hash>; + +} // namespace coroutines_v1 +} // namespace experimental +} // namespace std + + */ + +#include +#include +#include +#include +#include // for hash +#include +#include +#include <__debug> + +#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) +#pragma GCC system_header +#endif + +#ifdef _LIBCPP_HAS_NO_COROUTINES +# if defined(_LIBCPP_WARNING) + _LIBCPP_WARNING(" cannot be used with this compiler") +# else +# warning cannot be used with this compiler +# endif +#endif + +#ifndef _LIBCPP_HAS_NO_COROUTINES + +_LIBCPP_BEGIN_NAMESPACE_EXPERIMENTAL_COROUTINES + +template +struct __coroutine_traits_sfinae {}; + +template +struct __coroutine_traits_sfinae< + _Tp, typename __void_t::type> +{ + using promise_type = typename _Tp::promise_type; +}; + +template +struct _LIBCPP_TEMPLATE_VIS coroutine_traits + : public __coroutine_traits_sfinae<_Ret> +{ +}; + +template +class _LIBCPP_TEMPLATE_VIS coroutine_handle; + +template <> +class _LIBCPP_TEMPLATE_VIS coroutine_handle { +public: + _LIBCPP_ALWAYS_INLINE + _LIBCPP_CONSTEXPR coroutine_handle() _NOEXCEPT : __handle_(nullptr) {} + + _LIBCPP_ALWAYS_INLINE + _LIBCPP_CONSTEXPR coroutine_handle(nullptr_t) _NOEXCEPT : __handle_(nullptr) {} + + _LIBCPP_ALWAYS_INLINE + coroutine_handle& operator=(nullptr_t) _NOEXCEPT { + __handle_ = nullptr; + return *this; + } + + _LIBCPP_ALWAYS_INLINE + _LIBCPP_CONSTEXPR void* address() const _NOEXCEPT { return __handle_; } + + _LIBCPP_ALWAYS_INLINE + _LIBCPP_CONSTEXPR explicit operator bool() const _NOEXCEPT { return __handle_; } + + _LIBCPP_ALWAYS_INLINE + void operator()() { resume(); } + + _LIBCPP_ALWAYS_INLINE + void resume() { + _LIBCPP_ASSERT(__is_suspended(), + "resume() can only be called on suspended coroutines"); + _LIBCPP_ASSERT(!done(), + "resume() has undefined behavior when the coroutine is done"); + __builtin_coro_resume(__handle_); + } + + _LIBCPP_ALWAYS_INLINE + void destroy() { + _LIBCPP_ASSERT(__is_suspended(), + "destroy() can only be called on suspended coroutines"); + __builtin_coro_destroy(__handle_); + } + + _LIBCPP_ALWAYS_INLINE + bool done() const { + _LIBCPP_ASSERT(__is_suspended(), + "done() can only be called on suspended coroutines"); + return __builtin_coro_done(__handle_); + } + +public: + _LIBCPP_ALWAYS_INLINE + static coroutine_handle from_address(void* __addr) _NOEXCEPT { + coroutine_handle __tmp; + __tmp.__handle_ = __addr; + return __tmp; + } + + // FIXME: Should from_address(nullptr) be allowed? + _LIBCPP_ALWAYS_INLINE + static coroutine_handle from_address(nullptr_t) _NOEXCEPT { + return coroutine_handle(nullptr); + } + + template + static coroutine_handle from_address(_Tp*) { + static_assert(_CallIsValid, + "coroutine_handle::from_address cannot be called with " + "non-void pointers"); + } + +private: + bool __is_suspended() const _NOEXCEPT { + // FIXME actually implement a check for if the coro is suspended. + return __handle_; + } + + template friend class coroutine_handle; + void* __handle_; +}; + +// 18.11.2.7 comparison operators: +inline _LIBCPP_ALWAYS_INLINE +bool operator==(coroutine_handle<> __x, coroutine_handle<> __y) _NOEXCEPT { + return __x.address() == __y.address(); +} +inline _LIBCPP_ALWAYS_INLINE +bool operator!=(coroutine_handle<> __x, coroutine_handle<> __y) _NOEXCEPT { + return !(__x == __y); +} +inline _LIBCPP_ALWAYS_INLINE +bool operator<(coroutine_handle<> __x, coroutine_handle<> __y) _NOEXCEPT { + return less()(__x.address(), __y.address()); +} +inline _LIBCPP_ALWAYS_INLINE +bool operator>(coroutine_handle<> __x, coroutine_handle<> __y) _NOEXCEPT { + return __y < __x; +} +inline _LIBCPP_ALWAYS_INLINE +bool operator<=(coroutine_handle<> __x, coroutine_handle<> __y) _NOEXCEPT { + return !(__x > __y); +} +inline _LIBCPP_ALWAYS_INLINE +bool operator>=(coroutine_handle<> __x, coroutine_handle<> __y) _NOEXCEPT { + return !(__x < __y); +} + +template +class _LIBCPP_TEMPLATE_VIS coroutine_handle : public coroutine_handle<> { + using _Base = coroutine_handle<>; +public: +#ifndef _LIBCPP_CXX03_LANG + // 18.11.2.1 construct/reset + using coroutine_handle<>::coroutine_handle; +#else + _LIBCPP_ALWAYS_INLINE coroutine_handle() _NOEXCEPT : _Base() {} + _LIBCPP_ALWAYS_INLINE coroutine_handle(nullptr_t) _NOEXCEPT : _Base(nullptr) {} +#endif + _LIBCPP_INLINE_VISIBILITY + coroutine_handle& operator=(nullptr_t) _NOEXCEPT { + _Base::operator=(nullptr); + return *this; + } + + _LIBCPP_INLINE_VISIBILITY + _Promise& promise() const { + return *reinterpret_cast<_Promise*>( + __builtin_coro_promise(this->__handle_, __alignof(_Promise), false)); + } + +public: + _LIBCPP_ALWAYS_INLINE + static coroutine_handle from_address(void* __addr) _NOEXCEPT { + coroutine_handle __tmp; + __tmp.__handle_ = __addr; + return __tmp; + } + + // NOTE: this overload isn't required by the standard but is needed so + // the deleted _Promise* overload doesn't make from_address(nullptr) + // ambiguous. + // FIXME: should from_address work with nullptr? + _LIBCPP_ALWAYS_INLINE + static coroutine_handle from_address(nullptr_t) _NOEXCEPT { + return coroutine_handle(nullptr); + } + + template + static coroutine_handle from_address(_Tp*) { + static_assert(_CallIsValid, + "coroutine_handle::from_address cannot be called with " + "non-void pointers"); + } + + template + static coroutine_handle from_address(_Promise*) { + static_assert(_CallIsValid, + "coroutine_handle::from_address cannot be used with " + "pointers to the coroutine's promise type; use 'from_promise' instead"); + } + + _LIBCPP_ALWAYS_INLINE + static coroutine_handle from_promise(_Promise& __promise) _NOEXCEPT { + coroutine_handle __tmp; + __tmp.__handle_ = __builtin_coro_promise(_VSTD::addressof(__promise), + __alignof(_Promise), true); + return __tmp; + } +}; + +struct _LIBCPP_TYPE_VIS suspend_never { + _LIBCPP_ALWAYS_INLINE + bool await_ready() const _NOEXCEPT { return true; } + _LIBCPP_ALWAYS_INLINE + void await_suspend(coroutine_handle<>) const _NOEXCEPT {} + _LIBCPP_ALWAYS_INLINE + void await_resume() const _NOEXCEPT {} +}; + +struct _LIBCPP_TYPE_VIS suspend_always { + _LIBCPP_ALWAYS_INLINE + bool await_ready() const _NOEXCEPT { return false; } + _LIBCPP_ALWAYS_INLINE + void await_suspend(coroutine_handle<>) const _NOEXCEPT {} + _LIBCPP_ALWAYS_INLINE + void await_resume() const _NOEXCEPT {} +}; + +_LIBCPP_END_NAMESPACE_EXPERIMENTAL_COROUTINES + +_LIBCPP_BEGIN_NAMESPACE_STD + +template +struct hash<_VSTD_CORO::coroutine_handle<_Tp> > { + using __arg_type = _VSTD_CORO::coroutine_handle<_Tp>; + _LIBCPP_INLINE_VISIBILITY + size_t operator()(__arg_type const& __v) const _NOEXCEPT + {return hash()(__v.address());} +}; + +_LIBCPP_END_NAMESPACE_STD + +#endif // !defined(_LIBCPP_HAS_NO_COROUTINES) + +#endif /* _LIBCPP_EXPERIMENTAL_COROUTINE */ diff --git a/include/experimental/dynarray b/include/experimental/dynarray index 8c9733770..16193317a 100644 --- a/include/experimental/dynarray +++ b/include/experimental/dynarray @@ -107,10 +107,13 @@ public: #pragma GCC system_header #endif +_LIBCPP_PUSH_MACROS +#include <__undef_macros> + namespace std { namespace experimental { inline namespace __array_extensions_v1 { template -struct _LIBCPP_TEMPLATE_VIS dynarray +struct _LIBCPP_TEMPLATE_VIS _LIBCPP_AVAILABILITY_DYNARRAY dynarray { public: // types: @@ -295,5 +298,7 @@ template struct _LIBCPP_TEMPLATE_VIS uses_allocator, _Alloc> : true_type {}; _LIBCPP_END_NAMESPACE_STD +_LIBCPP_POP_MACROS + #endif // if _LIBCPP_STD_VER > 11 #endif // _LIBCPP_DYNARRAY diff --git a/include/experimental/filesystem b/include/experimental/filesystem index cf62ca27a..42157ba30 100644 --- a/include/experimental/filesystem +++ b/include/experimental/filesystem @@ -1091,10 +1091,13 @@ class _LIBCPP_TYPE_VIS path::iterator { public: typedef bidirectional_iterator_tag iterator_category; + typedef path value_type; typedef std::ptrdiff_t difference_type; typedef const path* pointer; typedef const path& reference; + + typedef void __stashing_iterator_tag; // See reverse_iterator and __is_stashing_iterator public: _LIBCPP_INLINE_VISIBILITY iterator() : __stashed_elem_(), __path_ptr_(nullptr), diff --git a/include/experimental/functional b/include/experimental/functional index 75fc8e99f..a136cbb57 100644 --- a/include/experimental/functional +++ b/include/experimental/functional @@ -89,21 +89,22 @@ inline namespace fundamentals_v1 { #include #include - #include #include #include #include #include -#include <__undef_min_max> - #include <__debug> #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) #pragma GCC system_header #endif +_LIBCPP_PUSH_MACROS +#include <__undef_macros> + + _LIBCPP_BEGIN_NAMESPACE_LFTS #if _LIBCPP_STD_VER > 11 @@ -456,4 +457,6 @@ make_boyer_moore_horspool_searcher( _RandomAccessIterator __f, _RandomAccessIter _LIBCPP_END_NAMESPACE_LFTS +_LIBCPP_POP_MACROS + #endif /* _LIBCPP_EXPERIMENTAL_FUNCTIONAL */ diff --git a/include/experimental/memory_resource b/include/experimental/memory_resource index 743f9cbe6..d101f3e08 100644 --- a/include/experimental/memory_resource +++ b/include/experimental/memory_resource @@ -82,6 +82,9 @@ namespace pmr { #pragma GCC system_header #endif +_LIBCPP_PUSH_MACROS +#include <__undef_macros> + _LIBCPP_BEGIN_NAMESPACE_LFTS_PMR // Round __s up to next multiple of __a. @@ -419,4 +422,6 @@ using resource_adaptor = __resource_adaptor_imp< _LIBCPP_END_NAMESPACE_LFTS_PMR +_LIBCPP_POP_MACROS + #endif /* _LIBCPP_EXPERIMENTAL_MEMORY_RESOURCE */ diff --git a/include/experimental/numeric b/include/experimental/numeric index d1209dbec..d784c08f0 100644 --- a/include/experimental/numeric +++ b/include/experimental/numeric @@ -41,6 +41,9 @@ inline namespace fundamentals_v2 { #pragma GCC system_header #endif +_LIBCPP_PUSH_MACROS +#include <__undef_macros> + #if _LIBCPP_STD_VER > 11 _LIBCPP_BEGIN_NAMESPACE_LFTS_V2 @@ -66,11 +69,11 @@ struct __abs<_Result, _Source, false> { template -_LIBCPP_CONSTEXPR _LIBCPP_INLINE_VISIBILITY -_Tp __gcd(_Tp __m, _Tp __n) +_LIBCPP_CONSTEXPR _LIBCPP_HIDDEN +inline _Tp __gcd(_Tp __m, _Tp __n) { static_assert((!is_signed<_Tp>::value), "" ); - return __n == 0 ? __m : __gcd<_Tp>(__n, __m % __n); + return __n == 0 ? __m : _VSTD_LFTS_V2::__gcd<_Tp>(__n, __m % __n); } @@ -84,8 +87,9 @@ gcd(_Tp __m, _Up __n) static_assert((!is_same::type, bool>::value), "Second argument to gcd cannot be bool" ); using _Rp = common_type_t<_Tp,_Up>; using _Wp = make_unsigned_t<_Rp>; - return static_cast<_Rp>(__gcd(static_cast<_Wp>(__abs<_Rp, _Tp>()(__m)), - static_cast<_Wp>(__abs<_Rp, _Up>()(__n)))); + return static_cast<_Rp>(_VSTD_LFTS_V2::__gcd( + static_cast<_Wp>(__abs<_Rp, _Tp>()(__m)), + static_cast<_Wp>(__abs<_Rp, _Up>()(__n)))); } template @@ -100,7 +104,7 @@ lcm(_Tp __m, _Up __n) return 0; using _Rp = common_type_t<_Tp,_Up>; - _Rp __val1 = __abs<_Rp, _Tp>()(__m) / gcd(__m, __n); + _Rp __val1 = __abs<_Rp, _Tp>()(__m) / _VSTD_LFTS_V2::gcd(__m, __n); _Rp __val2 = __abs<_Rp, _Up>()(__n); _LIBCPP_ASSERT((numeric_limits<_Rp>::max() / __val1 > __val2), "Overflow in lcm"); return __val1 * __val2; @@ -109,4 +113,7 @@ lcm(_Tp __m, _Up __n) _LIBCPP_END_NAMESPACE_LFTS_V2 #endif /* _LIBCPP_STD_VER > 11 */ + +_LIBCPP_POP_MACROS + #endif /* _LIBCPP_EXPERIMENTAL_NUMERIC */ diff --git a/include/experimental/optional b/include/experimental/optional index f32941b1a..b251748fb 100644 --- a/include/experimental/optional +++ b/include/experimental/optional @@ -143,9 +143,24 @@ namespace std { namespace experimental { inline namespace fundamentals_v1 { #include #include #include +#if _LIBCPP_STD_VER > 11 +#include +#include +#include +#include <__functional_base> +#include <__debug> +#endif + +#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) +#pragma GCC system_header +#endif + +_LIBCPP_PUSH_MACROS +#include <__undef_macros> + _LIBCPP_BEGIN_NAMESPACE_EXPERIMENTAL -class _LIBCPP_EXCEPTION_ABI bad_optional_access +class _LIBCPP_EXCEPTION_ABI _LIBCPP_AVAILABILITY_BAD_OPTIONAL_ACCESS bad_optional_access : public std::logic_error { public: @@ -160,17 +175,6 @@ _LIBCPP_END_NAMESPACE_EXPERIMENTAL #if _LIBCPP_STD_VER > 11 -#include -#include -#include -#include <__functional_base> -#include <__undef_min_max> -#include <__debug> - -#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) -#pragma GCC system_header -#endif - _LIBCPP_BEGIN_NAMESPACE_LFTS struct in_place_t {}; @@ -523,6 +527,9 @@ public: constexpr explicit operator bool() const noexcept {return this->__engaged_;} _LIBCPP_NORETURN _LIBCPP_INLINE_VISIBILITY +#ifndef _LIBCPP_NO_EXCEPTIONS +_LIBCPP_AVAILABILITY_BAD_OPTIONAL_ACCESS +#endif constexpr void __throw_bad_optional_access() const { #ifndef _LIBCPP_NO_EXCEPTIONS @@ -532,7 +539,7 @@ public: #endif } - _LIBCPP_INLINE_VISIBILITY + _LIBCPP_INLINE_VISIBILITY _LIBCPP_AVAILABILITY_BAD_OPTIONAL_ACCESS constexpr value_type const& value() const { if (!this->__engaged_) @@ -540,7 +547,7 @@ public: return this->__val_; } - _LIBCPP_INLINE_VISIBILITY + _LIBCPP_INLINE_VISIBILITY _LIBCPP_AVAILABILITY_BAD_OPTIONAL_ACCESS value_type& value() { if (!this->__engaged_) @@ -910,4 +917,6 @@ _LIBCPP_END_NAMESPACE_STD #endif // _LIBCPP_STD_VER > 11 +_LIBCPP_POP_MACROS + #endif // _LIBCPP_EXPERIMENTAL_OPTIONAL diff --git a/include/experimental/string_view b/include/experimental/string_view index 41c0d34d3..da104f9a1 100644 --- a/include/experimental/string_view +++ b/include/experimental/string_view @@ -189,6 +189,9 @@ namespace std { #pragma GCC system_header #endif +_LIBCPP_PUSH_MACROS +#include <__undef_macros> + _LIBCPP_BEGIN_NAMESPACE_LFTS template > @@ -810,4 +813,6 @@ quoted ( std::experimental::basic_string_view <_CharT, _Traits> __sv, _LIBCPP_END_NAMESPACE_STD +_LIBCPP_POP_MACROS + #endif // _LIBCPP_LFTS_STRING_VIEW diff --git a/include/ext/hash_map b/include/ext/hash_map index fab36a155..998e8f659 100644 --- a/include/ext/hash_map +++ b/include/ext/hash_map @@ -207,7 +207,7 @@ template #include #if __DEPRECATED -#if defined(_LIBCPP_MSVC) +#if defined(_LIBCPP_WARNING) _LIBCPP_WARNING("Use of the header is deprecated. Migrate to ") #else # warning Use of the header is deprecated. Migrate to @@ -331,7 +331,7 @@ public: __second_constructed(false) {} -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES +#ifndef _LIBCPP_CXX03_LANG _LIBCPP_INLINE_VISIBILITY __hash_map_node_destructor(__hash_node_destructor&& __x) : __na_(__x.__na_), @@ -340,7 +340,7 @@ public: { __x.__value_constructed = false; } -#else // _LIBCPP_HAS_NO_RVALUE_REFERENCES +#else // _LIBCPP_CXX03_LANG _LIBCPP_INLINE_VISIBILITY __hash_map_node_destructor(const __hash_node_destructor& __x) : __na_(__x.__na_), @@ -349,7 +349,7 @@ public: { const_cast(__x.__value_constructed) = false; } -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES +#endif // _LIBCPP_CXX03_LANG _LIBCPP_INLINE_VISIBILITY void operator()(pointer __p) diff --git a/include/ext/hash_set b/include/ext/hash_set index 916ed6910..38f81ed3b 100644 --- a/include/ext/hash_set +++ b/include/ext/hash_set @@ -199,7 +199,7 @@ template #include #if __DEPRECATED -#if defined(_LIBCPP_MSVC) +#if defined(_LIBCPP_WARNING) _LIBCPP_WARNING("Use of the header is deprecated. Migrate to ") #else # warning Use of the header is deprecated. Migrate to diff --git a/include/forward_list b/include/forward_list index 879f2d3ce..8bfa9a084 100644 --- a/include/forward_list +++ b/include/forward_list @@ -167,19 +167,20 @@ template */ #include <__config> - #include #include #include #include #include -#include <__undef_min_max> - #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) #pragma GCC system_header #endif +_LIBCPP_PUSH_MACROS +#include <__undef_macros> + + _LIBCPP_BEGIN_NAMESPACE_STD template struct __forward_list_node; @@ -478,14 +479,14 @@ protected: __forward_list_base(const allocator_type& __a) : __before_begin_(__begin_node(), __node_allocator(__a)) {} -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES +#ifndef _LIBCPP_CXX03_LANG public: _LIBCPP_INLINE_VISIBILITY __forward_list_base(__forward_list_base&& __x) _NOEXCEPT_(is_nothrow_move_constructible<__node_allocator>::value); _LIBCPP_INLINE_VISIBILITY __forward_list_base(__forward_list_base&& __x, const allocator_type& __a); -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES +#endif // _LIBCPP_CXX03_LANG private: __forward_list_base(const __forward_list_base&); @@ -539,7 +540,7 @@ private: {__alloc() = _VSTD::move(__x.__alloc());} }; -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES +#ifndef _LIBCPP_CXX03_LANG template inline @@ -563,7 +564,7 @@ __forward_list_base<_Tp, _Alloc>::__forward_list_base(__forward_list_base&& __x, } } -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES +#endif // _LIBCPP_CXX03_LANG template __forward_list_base<_Tp, _Alloc>::~__forward_list_base() @@ -656,32 +657,33 @@ public: >::type* = nullptr); forward_list(const forward_list& __x); forward_list(const forward_list& __x, const allocator_type& __a); -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES + + forward_list& operator=(const forward_list& __x); + +#ifndef _LIBCPP_CXX03_LANG _LIBCPP_INLINE_VISIBILITY forward_list(forward_list&& __x) _NOEXCEPT_(is_nothrow_move_constructible::value) : base(_VSTD::move(__x)) {} forward_list(forward_list&& __x, const allocator_type& __a); -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES -#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS + forward_list(initializer_list __il); forward_list(initializer_list __il, const allocator_type& __a); -#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS - // ~forward_list() = default; - - forward_list& operator=(const forward_list& __x); -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES _LIBCPP_INLINE_VISIBILITY forward_list& operator=(forward_list&& __x) _NOEXCEPT_( __node_traits::propagate_on_container_move_assignment::value && is_nothrow_move_assignable::value); -#endif -#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS + _LIBCPP_INLINE_VISIBILITY forward_list& operator=(initializer_list __il); -#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS + + _LIBCPP_INLINE_VISIBILITY + void assign(initializer_list __il); +#endif // _LIBCPP_CXX03_LANG + + // ~forward_list() = default; template typename enable_if @@ -691,10 +693,6 @@ public: >::type assign(_InputIterator __f, _InputIterator __l); void assign(size_type __n, const value_type& __v); -#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS - _LIBCPP_INLINE_VISIBILITY - void assign(initializer_list __il); -#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS _LIBCPP_INLINE_VISIBILITY allocator_type get_allocator() const _NOEXCEPT @@ -745,27 +743,26 @@ public: _LIBCPP_INLINE_VISIBILITY const_reference front() const {return base::__before_begin()->__next_->__value_;} -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES -#ifndef _LIBCPP_HAS_NO_VARIADICS +#ifndef _LIBCPP_CXX03_LANG #if _LIBCPP_STD_VER > 14 template reference emplace_front(_Args&&... __args); #else template void emplace_front(_Args&&... __args); -#endif #endif void push_front(value_type&& __v); -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES +#endif // _LIBCPP_CXX03_LANG void push_front(const value_type& __v); void pop_front(); -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES -#ifndef _LIBCPP_HAS_NO_VARIADICS +#ifndef _LIBCPP_CXX03_LANG template iterator emplace_after(const_iterator __p, _Args&&... __args); -#endif // _LIBCPP_HAS_NO_VARIADICS + iterator insert_after(const_iterator __p, value_type&& __v); -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES + iterator insert_after(const_iterator __p, initializer_list __il) + {return insert_after(__p, __il.begin(), __il.end());} +#endif // _LIBCPP_CXX03_LANG iterator insert_after(const_iterator __p, const value_type& __v); iterator insert_after(const_iterator __p, size_type __n, const value_type& __v); template @@ -776,10 +773,6 @@ public: iterator >::type insert_after(const_iterator __p, _InputIterator __f, _InputIterator __l); -#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS - iterator insert_after(const_iterator __p, initializer_list __il) - {return insert_after(__p, __il.begin(), __il.end());} -#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS iterator erase_after(const_iterator __p); iterator erase_after(const_iterator __f, const_iterator __l); @@ -799,7 +792,7 @@ public: _LIBCPP_INLINE_VISIBILITY void clear() _NOEXCEPT {base::clear();} -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES +#ifndef _LIBCPP_CXX03_LANG _LIBCPP_INLINE_VISIBILITY void splice_after(const_iterator __p, forward_list&& __x); _LIBCPP_INLINE_VISIBILITY @@ -807,7 +800,7 @@ public: _LIBCPP_INLINE_VISIBILITY void splice_after(const_iterator __p, forward_list&& __x, const_iterator __f, const_iterator __l); -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES +#endif // _LIBCPP_CXX03_LANG void splice_after(const_iterator __p, forward_list& __x); void splice_after(const_iterator __p, forward_list& __x, const_iterator __i); void splice_after(const_iterator __p, forward_list& __x, @@ -817,14 +810,14 @@ public: _LIBCPP_INLINE_VISIBILITY void unique() {unique(__equal_to());} template void unique(_BinaryPredicate __binary_pred); -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES +#ifndef _LIBCPP_CXX03_LANG _LIBCPP_INLINE_VISIBILITY void merge(forward_list&& __x) {merge(__x, __less());} template _LIBCPP_INLINE_VISIBILITY void merge(forward_list&& __x, _Compare __comp) {merge(__x, _VSTD::move(__comp));} -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES +#endif // _LIBCPP_CXX03_LANG _LIBCPP_INLINE_VISIBILITY void merge(forward_list& __x) {merge(__x, __less());} template void merge(forward_list& __x, _Compare __comp); @@ -835,11 +828,11 @@ public: private: -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES +#ifndef _LIBCPP_CXX03_LANG void __move_assign(forward_list& __x, true_type) _NOEXCEPT_(is_nothrow_move_assignable::value); void __move_assign(forward_list& __x, false_type); -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES +#endif // _LIBCPP_CXX03_LANG template static @@ -955,8 +948,19 @@ forward_list<_Tp, _Alloc>::forward_list(const forward_list& __x, insert_after(cbefore_begin(), __x.begin(), __x.end()); } -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES +template +forward_list<_Tp, _Alloc>& +forward_list<_Tp, _Alloc>::operator=(const forward_list& __x) +{ + if (this != &__x) + { + base::__copy_assign_alloc(__x); + assign(__x.begin(), __x.end()); + } + return *this; +} +#ifndef _LIBCPP_CXX03_LANG template forward_list<_Tp, _Alloc>::forward_list(forward_list&& __x, const allocator_type& __a) @@ -969,10 +973,6 @@ forward_list<_Tp, _Alloc>::forward_list(forward_list&& __x, } } -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES - -#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS - template forward_list<_Tp, _Alloc>::forward_list(initializer_list __il) { @@ -987,22 +987,6 @@ forward_list<_Tp, _Alloc>::forward_list(initializer_list __il, insert_after(cbefore_begin(), __il.begin(), __il.end()); } -#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS - -template -forward_list<_Tp, _Alloc>& -forward_list<_Tp, _Alloc>::operator=(const forward_list& __x) -{ - if (this != &__x) - { - base::__copy_assign_alloc(__x); - assign(__x.begin(), __x.end()); - } - return *this; -} - -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES - template void forward_list<_Tp, _Alloc>::__move_assign(forward_list& __x, true_type) @@ -1040,10 +1024,6 @@ forward_list<_Tp, _Alloc>::operator=(forward_list&& __x) return *this; } -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES - -#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS - template inline forward_list<_Tp, _Alloc>& @@ -1053,7 +1033,7 @@ forward_list<_Tp, _Alloc>::operator=(initializer_list __il) return *this; } -#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS +#endif // _LIBCPP_CXX03_LANG template template @@ -1090,7 +1070,7 @@ forward_list<_Tp, _Alloc>::assign(size_type __n, const value_type& __v) erase_after(__i, __e); } -#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS +#ifndef _LIBCPP_CXX03_LANG template inline @@ -1100,11 +1080,6 @@ forward_list<_Tp, _Alloc>::assign(initializer_list __il) assign(__il.begin(), __il.end()); } -#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS - -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES -#ifndef _LIBCPP_HAS_NO_VARIADICS - template template #if _LIBCPP_STD_VER > 14 @@ -1126,8 +1101,6 @@ forward_list<_Tp, _Alloc>::emplace_front(_Args&&... __args) #endif } -#endif // _LIBCPP_HAS_NO_VARIADICS - template void forward_list<_Tp, _Alloc>::push_front(value_type&& __v) @@ -1140,7 +1113,7 @@ forward_list<_Tp, _Alloc>::push_front(value_type&& __v) base::__before_begin()->__next_ = __h.release(); } -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES +#endif // _LIBCPP_CXX03_LANG template void @@ -1165,8 +1138,7 @@ forward_list<_Tp, _Alloc>::pop_front() __node_traits::deallocate(__a, __p, 1); } -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES -#ifndef _LIBCPP_HAS_NO_VARIADICS +#ifndef _LIBCPP_CXX03_LANG template template @@ -1184,8 +1156,6 @@ forward_list<_Tp, _Alloc>::emplace_after(const_iterator __p, _Args&&... __args) return iterator(__r->__next_); } -#endif // _LIBCPP_HAS_NO_VARIADICS - template typename forward_list<_Tp, _Alloc>::iterator forward_list<_Tp, _Alloc>::insert_after(const_iterator __p, value_type&& __v) @@ -1200,7 +1170,7 @@ forward_list<_Tp, _Alloc>::insert_after(const_iterator __p, value_type&& __v) return iterator(__r->__next_); } -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES +#endif // _LIBCPP_CXX03_LANG template typename forward_list<_Tp, _Alloc>::iterator @@ -1468,7 +1438,7 @@ forward_list<_Tp, _Alloc>::splice_after(const_iterator __p, } } -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES +#ifndef _LIBCPP_CXX03_LANG template inline _LIBCPP_INLINE_VISIBILITY @@ -1499,7 +1469,7 @@ forward_list<_Tp, _Alloc>::splice_after(const_iterator __p, splice_after(__p, __x, __f, __l); } -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES +#endif // _LIBCPP_CXX03_LANG template void @@ -1750,4 +1720,6 @@ swap(forward_list<_Tp, _Alloc>& __x, forward_list<_Tp, _Alloc>& __y) _LIBCPP_END_NAMESPACE_STD +_LIBCPP_POP_MACROS + #endif // _LIBCPP_FORWARD_LIST diff --git a/include/fstream b/include/fstream index 7bcc5d450..e41a53af4 100644 --- a/include/fstream +++ b/include/fstream @@ -171,12 +171,14 @@ typedef basic_fstream wfstream; #include <__locale> #include -#include <__undef_min_max> - #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) #pragma GCC system_header #endif +_LIBCPP_PUSH_MACROS +#include <__undef_macros> + + _LIBCPP_BEGIN_NAMESPACE_STD template @@ -193,13 +195,13 @@ public: // 27.9.1.2 Constructors/destructor: basic_filebuf(); -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES +#ifndef _LIBCPP_CXX03_LANG basic_filebuf(basic_filebuf&& __rhs); #endif virtual ~basic_filebuf(); // 27.9.1.3 Assign/swap: -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES +#ifndef _LIBCPP_CXX03_LANG _LIBCPP_INLINE_VISIBILITY basic_filebuf& operator=(basic_filebuf&& __rhs); #endif @@ -276,7 +278,7 @@ basic_filebuf<_CharT, _Traits>::basic_filebuf() setbuf(0, 4096); } -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES +#ifndef _LIBCPP_CXX03_LANG template basic_filebuf<_CharT, _Traits>::basic_filebuf(basic_filebuf&& __rhs) @@ -352,7 +354,7 @@ basic_filebuf<_CharT, _Traits>::operator=(basic_filebuf&& __rhs) return *this; } -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES +#endif // _LIBCPP_CXX03_LANG template basic_filebuf<_CharT, _Traits>::~basic_filebuf() @@ -1017,12 +1019,10 @@ public: _LIBCPP_INLINE_VISIBILITY explicit basic_ifstream(const string& __s, ios_base::openmode __mode = ios_base::in); #endif -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES +#ifndef _LIBCPP_CXX03_LANG _LIBCPP_INLINE_VISIBILITY basic_ifstream(basic_ifstream&& __rhs); -#endif -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES _LIBCPP_INLINE_VISIBILITY basic_ifstream& operator=(basic_ifstream&& __rhs); #endif @@ -1071,7 +1071,7 @@ basic_ifstream<_CharT, _Traits>::basic_ifstream(const string& __s, ios_base::ope } #endif -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES +#ifndef _LIBCPP_CXX03_LANG template inline @@ -1092,7 +1092,7 @@ basic_ifstream<_CharT, _Traits>::operator=(basic_ifstream&& __rhs) return *this; } -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES +#endif // _LIBCPP_CXX03_LANG template inline @@ -1177,12 +1177,10 @@ public: explicit basic_ofstream(const char* __s, ios_base::openmode __mode = ios_base::out); _LIBCPP_INLINE_VISIBILITY explicit basic_ofstream(const string& __s, ios_base::openmode __mode = ios_base::out); -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES +#ifndef _LIBCPP_CXX03_LANG _LIBCPP_INLINE_VISIBILITY basic_ofstream(basic_ofstream&& __rhs); -#endif -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES _LIBCPP_INLINE_VISIBILITY basic_ofstream& operator=(basic_ofstream&& __rhs); #endif @@ -1231,7 +1229,7 @@ basic_ofstream<_CharT, _Traits>::basic_ofstream(const string& __s, ios_base::ope } #endif -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES +#ifndef _LIBCPP_CXX03_LANG template inline @@ -1252,7 +1250,7 @@ basic_ofstream<_CharT, _Traits>::operator=(basic_ofstream&& __rhs) return *this; } -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES +#endif // _LIBCPP_CXX03_LANG template inline @@ -1339,12 +1337,10 @@ public: _LIBCPP_INLINE_VISIBILITY explicit basic_fstream(const string& __s, ios_base::openmode __mode = ios_base::in | ios_base::out); #endif -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES +#ifndef _LIBCPP_CXX03_LANG _LIBCPP_INLINE_VISIBILITY basic_fstream(basic_fstream&& __rhs); -#endif -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES _LIBCPP_INLINE_VISIBILITY basic_fstream& operator=(basic_fstream&& __rhs); #endif @@ -1393,7 +1389,7 @@ basic_fstream<_CharT, _Traits>::basic_fstream(const string& __s, ios_base::openm } #endif -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES +#ifndef _LIBCPP_CXX03_LANG template inline @@ -1414,7 +1410,7 @@ basic_fstream<_CharT, _Traits>::operator=(basic_fstream&& __rhs) return *this; } -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES +#endif // _LIBCPP_CXX03_LANG template inline @@ -1482,4 +1478,6 @@ basic_fstream<_CharT, _Traits>::close() _LIBCPP_END_NAMESPACE_STD +_LIBCPP_POP_MACROS + #endif // _LIBCPP_FSTREAM diff --git a/include/functional b/include/functional index 2a810b1a0..ea35697d3 100644 --- a/include/functional +++ b/include/functional @@ -235,7 +235,7 @@ namespace placeholders { } template -class binder1st +class binder1st // deprecated in C++11, removed in C++17 : public unary_function { @@ -249,10 +249,10 @@ public: }; template -binder1st bind1st(const Operation& op, const T& x); +binder1st bind1st(const Operation& op, const T& x); // deprecated in C++11, removed in C++17 template -class binder2nd +class binder2nd // deprecated in C++11, removed in C++17 : public unary_function { @@ -266,9 +266,9 @@ public: }; template -binder2nd bind2nd(const Operation& op, const T& x); +binder2nd bind2nd(const Operation& op, const T& x); // deprecated in C++11, removed in C++17 -template +template // deprecated in C++11, removed in C++17 class pointer_to_unary_function : public unary_function { public: @@ -277,9 +277,9 @@ public: }; template -pointer_to_unary_function ptr_fun(Result (*f)(Arg)); +pointer_to_unary_function ptr_fun(Result (*f)(Arg)); // deprecated in C++11, removed in C++17 -template +template // deprecated in C++11, removed in C++17 class pointer_to_binary_function : public binary_function { public: @@ -288,9 +288,9 @@ public: }; template -pointer_to_binary_function ptr_fun(Result (*f)(Arg1,Arg2)); +pointer_to_binary_function ptr_fun(Result (*f)(Arg1,Arg2)); // deprecated in C++11, removed in C++17 -template +template // deprecated in C++11, removed in C++17 class mem_fun_t : public unary_function { public: @@ -299,18 +299,18 @@ public: }; template -class mem_fun1_t : public binary_function +class mem_fun1_t : public binary_function // deprecated in C++11, removed in C++17 { public: explicit mem_fun1_t(S (T::*p)(A)); S operator()(T* p, A x) const; }; -template mem_fun_t mem_fun(S (T::*f)()); -template mem_fun1_t mem_fun(S (T::*f)(A)); +template mem_fun_t mem_fun(S (T::*f)()); // deprecated in C++11, removed in C++17 +template mem_fun1_t mem_fun(S (T::*f)(A)); // deprecated in C++11, removed in C++17 template -class mem_fun_ref_t : public unary_function +class mem_fun_ref_t : public unary_function // deprecated in C++11, removed in C++17 { public: explicit mem_fun_ref_t(S (T::*p)()); @@ -318,18 +318,18 @@ public: }; template -class mem_fun1_ref_t : public binary_function +class mem_fun1_ref_t : public binary_function // deprecated in C++11, removed in C++17 { public: explicit mem_fun1_ref_t(S (T::*p)(A)); S operator()(T& p, A x) const; }; -template mem_fun_ref_t mem_fun_ref(S (T::*f)()); -template mem_fun1_ref_t mem_fun_ref(S (T::*f)(A)); +template mem_fun_ref_t mem_fun_ref(S (T::*f)()); // deprecated in C++11, removed in C++17 +template mem_fun1_ref_t mem_fun_ref(S (T::*f)(A)); // deprecated in C++11, removed in C++17 template -class const_mem_fun_t : public unary_function +class const_mem_fun_t : public unary_function // deprecated in C++11, removed in C++17 { public: explicit const_mem_fun_t(S (T::*p)() const); @@ -337,18 +337,18 @@ public: }; template -class const_mem_fun1_t : public binary_function +class const_mem_fun1_t : public binary_function // deprecated in C++11, removed in C++17 { public: explicit const_mem_fun1_t(S (T::*p)(A) const); S operator()(const T* p, A x) const; }; -template const_mem_fun_t mem_fun(S (T::*f)() const); -template const_mem_fun1_t mem_fun(S (T::*f)(A) const); +template const_mem_fun_t mem_fun(S (T::*f)() const); // deprecated in C++11, removed in C++17 +template const_mem_fun1_t mem_fun(S (T::*f)(A) const); // deprecated in C++11, removed in C++17 template -class const_mem_fun_ref_t : public unary_function +class const_mem_fun_ref_t : public unary_function // deprecated in C++11, removed in C++17 { public: explicit const_mem_fun_ref_t(S (T::*p)() const); @@ -356,15 +356,15 @@ public: }; template -class const_mem_fun1_ref_t : public binary_function +class const_mem_fun1_ref_t : public binary_function // deprecated in C++11, removed in C++17 { public: explicit const_mem_fun1_ref_t(S (T::*p)(A) const); S operator()(const T& p, A x) const; }; -template const_mem_fun_ref_t mem_fun_ref(S (T::*f)() const); -template const_mem_fun1_ref_t mem_fun_ref(S (T::*f)(A) const); +template const_mem_fun_ref_t mem_fun_ref(S (T::*f)() const); // deprecated in C++11, removed in C++17 +template const_mem_fun1_ref_t mem_fun_ref(S (T::*f)(A) const); // deprecated in C++11, removed in C++17 template unspecified mem_fn(R T::*); @@ -470,6 +470,7 @@ template <> struct hash; template <> struct hash; template struct hash; +template <> struct hash; // C++17 } // std @@ -1019,6 +1020,7 @@ inline _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY binary_negate<_Predicate> not2(const _Predicate& __pred) {return binary_negate<_Predicate>(__pred);} +#if _LIBCPP_STD_VER <= 14 || defined(_LIBCPP_ENABLE_CXX17_REMOVED_BINDERS) template class _LIBCPP_TEMPLATE_VIS binder1st : public unary_function mem_fun_ref(_Sp (_Tp::*__f)(_Ap) const) {return const_mem_fun1_ref_t<_Sp,_Tp,_Ap>(__f);} +#endif //////////////////////////////////////////////////////////////////////////////// // MEMFUN @@ -1261,7 +1264,7 @@ private: public: _LIBCPP_INLINE_VISIBILITY __mem_fn(type __f) _NOEXCEPT : __f_(__f) {} -#ifndef _LIBCPP_HAS_NO_VARIADICS +#ifndef _LIBCPP_CXX03_LANG // invoke template _LIBCPP_INLINE_VISIBILITY @@ -1388,6 +1391,12 @@ mem_fn(_Rp _Tp::* __pm) _NOEXCEPT class _LIBCPP_EXCEPTION_ABI bad_function_call : public exception { +#ifdef _LIBCPP_ABI_BAD_FUNCTION_CALL_KEY_FUNCTION +public: + virtual ~bad_function_call() _NOEXCEPT; + + virtual const char* what() const _NOEXCEPT; +#endif }; _LIBCPP_NORETURN inline _LIBCPP_ALWAYS_INLINE @@ -1445,7 +1454,7 @@ bool __not_null(function<_Fp> const& __f) { return !!__f; } } // namespace __function -#ifndef _LIBCPP_HAS_NO_VARIADICS +#ifndef _LIBCPP_CXX03_LANG namespace __function { @@ -1974,7 +1983,7 @@ void swap(function<_Rp(_ArgTypes...)>& __x, function<_Rp(_ArgTypes...)>& __y) _NOEXCEPT {return __x.swap(__y);} -#else // _LIBCPP_HAS_NO_VARIADICS +#else // _LIBCPP_CXX03_LANG #include <__functional_03> @@ -2038,7 +2047,7 @@ struct __is_placeholder > : public integral_constant {}; -#ifndef _LIBCPP_HAS_NO_VARIADICS +#ifndef _LIBCPP_CXX03_LANG template inline _LIBCPP_INLINE_VISIBILITY @@ -2215,7 +2224,7 @@ typename __bind_return<_Fp, _BoundArgs, _Args>::type __apply_functor(_Fp& __f, _BoundArgs& __bound_args, __tuple_indices<_Indx...>, _Args&& __args) { - return __invoke(__f, __mu(_VSTD::get<_Indx>(__bound_args), __args)...); + return _VSTD::__invoke(__f, _VSTD::__mu(_VSTD::get<_Indx>(__bound_args), __args)...); } template @@ -2248,7 +2257,7 @@ public: typename __bind_return<_Fd, _Td, tuple<_Args&&...> >::type operator()(_Args&& ...__args) { - return __apply_functor(__f_, __bound_args_, __indices(), + return _VSTD::__apply_functor(__f_, __bound_args_, __indices(), tuple<_Args&&...>(_VSTD::forward<_Args>(__args)...)); } @@ -2257,7 +2266,7 @@ public: typename __bind_return >::type operator()(_Args&& ...__args) const { - return __apply_functor(__f_, __bound_args_, __indices(), + return _VSTD::__apply_functor(__f_, __bound_args_, __indices(), tuple<_Args&&...>(_VSTD::forward<_Args>(__args)...)); } }; @@ -2338,7 +2347,7 @@ bind(_Fp&& __f, _BoundArgs&&... __bound_args) return type(_VSTD::forward<_Fp>(__f), _VSTD::forward<_BoundArgs>(__bound_args)...); } -#endif // _LIBCPP_HAS_NO_VARIADICS +#endif // _LIBCPP_CXX03_LANG #if _LIBCPP_STD_VER > 14 diff --git a/include/future b/include/future index 1ceedf91e..e38876758 100644 --- a/include/future +++ b/include/future @@ -499,7 +499,7 @@ make_error_condition(future_errc __e) _NOEXCEPT return error_condition(static_cast(__e), future_category()); } -class _LIBCPP_EXCEPTION_ABI future_error +class _LIBCPP_EXCEPTION_ABI _LIBCPP_AVAILABILITY_FUTURE_ERROR future_error : public logic_error { error_code __ec_; @@ -515,6 +515,9 @@ public: }; _LIBCPP_NORETURN inline _LIBCPP_ALWAYS_INLINE +#ifndef _LIBCPP_NO_EXCEPTIONS +_LIBCPP_AVAILABILITY_FUTURE_ERROR +#endif void __throw_future_error(future_errc _Ev) { #ifndef _LIBCPP_NO_EXCEPTIONS @@ -525,7 +528,7 @@ void __throw_future_error(future_errc _Ev) #endif } -class _LIBCPP_TYPE_VIS __assoc_sub_state +class _LIBCPP_TYPE_VIS _LIBCPP_AVAILABILITY_FUTURE __assoc_sub_state : public __shared_count { protected: @@ -612,7 +615,7 @@ __assoc_sub_state::wait_for(const chrono::duration<_Rep, _Period>& __rel_time) c } template -class __assoc_state +class _LIBCPP_AVAILABILITY_FUTURE __assoc_state : public __assoc_sub_state { typedef __assoc_sub_state base; @@ -652,6 +655,7 @@ __assoc_state<_Rp>::__on_zero_shared() _NOEXCEPT template template +_LIBCPP_AVAILABILITY_FUTURE void #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES __assoc_state<_Rp>::set_value(_Arg&& __arg) @@ -707,7 +711,7 @@ __assoc_state<_Rp>::copy() } template -class __assoc_state<_Rp&> +class _LIBCPP_AVAILABILITY_FUTURE __assoc_state<_Rp&> : public __assoc_sub_state { typedef __assoc_sub_state base; @@ -767,7 +771,7 @@ __assoc_state<_Rp&>::copy() } template -class __assoc_state_alloc +class _LIBCPP_AVAILABILITY_FUTURE __assoc_state_alloc : public __assoc_state<_Rp> { typedef __assoc_state<_Rp> base; @@ -795,7 +799,7 @@ __assoc_state_alloc<_Rp, _Alloc>::__on_zero_shared() _NOEXCEPT } template -class __assoc_state_alloc<_Rp&, _Alloc> +class _LIBCPP_AVAILABILITY_FUTURE __assoc_state_alloc<_Rp&, _Alloc> : public __assoc_state<_Rp&> { typedef __assoc_state<_Rp&> base; @@ -821,7 +825,7 @@ __assoc_state_alloc<_Rp&, _Alloc>::__on_zero_shared() _NOEXCEPT } template -class __assoc_sub_state_alloc +class _LIBCPP_AVAILABILITY_FUTURE __assoc_sub_state_alloc : public __assoc_sub_state { typedef __assoc_sub_state base; @@ -847,7 +851,7 @@ __assoc_sub_state_alloc<_Alloc>::__on_zero_shared() _NOEXCEPT } template -class __deferred_assoc_state +class _LIBCPP_AVAILABILITY_FUTURE __deferred_assoc_state : public __assoc_state<_Rp> { typedef __assoc_state<_Rp> base; @@ -894,7 +898,7 @@ __deferred_assoc_state<_Rp, _Fp>::__execute() } template -class __deferred_assoc_state +class _LIBCPP_AVAILABILITY_FUTURE __deferred_assoc_state : public __assoc_sub_state { typedef __assoc_sub_state base; @@ -942,7 +946,7 @@ __deferred_assoc_state::__execute() } template -class __async_assoc_state +class _LIBCPP_AVAILABILITY_FUTURE __async_assoc_state : public __assoc_state<_Rp> { typedef __assoc_state<_Rp> base; @@ -997,7 +1001,7 @@ __async_assoc_state<_Rp, _Fp>::__on_zero_shared() _NOEXCEPT } template -class __async_assoc_state +class _LIBCPP_AVAILABILITY_FUTURE __async_assoc_state : public __assoc_sub_state { typedef __assoc_sub_state base; @@ -1076,7 +1080,7 @@ __make_async_assoc_state(_Fp __f); #endif template -class _LIBCPP_TEMPLATE_VIS future +class _LIBCPP_TEMPLATE_VIS _LIBCPP_AVAILABILITY_FUTURE future { __assoc_state<_Rp>* __state_; @@ -1179,7 +1183,7 @@ future<_Rp>::get() } template -class _LIBCPP_TEMPLATE_VIS future<_Rp&> +class _LIBCPP_TEMPLATE_VIS _LIBCPP_AVAILABILITY_FUTURE future<_Rp&> { __assoc_state<_Rp&>* __state_; @@ -1277,7 +1281,7 @@ future<_Rp&>::get() } template <> -class _LIBCPP_TYPE_VIS future +class _LIBCPP_TYPE_VIS _LIBCPP_AVAILABILITY_FUTURE future { __assoc_sub_state* __state_; @@ -1360,7 +1364,7 @@ swap(future<_Rp>& __x, future<_Rp>& __y) _NOEXCEPT template class packaged_task; template -class _LIBCPP_TEMPLATE_VIS promise +class _LIBCPP_TEMPLATE_VIS _LIBCPP_AVAILABILITY_FUTURE promise { __assoc_state<_Rp>* __state_; @@ -1527,7 +1531,7 @@ promise<_Rp>::set_exception_at_thread_exit(exception_ptr __p) // promise template -class _LIBCPP_TEMPLATE_VIS promise<_Rp&> +class _LIBCPP_TEMPLATE_VIS _LIBCPP_AVAILABILITY_FUTURE promise<_Rp&> { __assoc_state<_Rp&>* __state_; @@ -1663,7 +1667,7 @@ promise<_Rp&>::set_exception_at_thread_exit(exception_ptr __p) // promise template <> -class _LIBCPP_TYPE_VIS promise +class _LIBCPP_TYPE_VIS _LIBCPP_AVAILABILITY_FUTURE promise { __assoc_sub_state* __state_; @@ -1749,7 +1753,7 @@ template template class __packaged_task_base; template -class __packaged_task_base<_Rp(_ArgTypes...)> +class _LIBCPP_AVAILABILITY_FUTURE __packaged_task_base<_Rp(_ArgTypes...)> { __packaged_task_base(const __packaged_task_base&); __packaged_task_base& operator=(const __packaged_task_base&); @@ -1767,7 +1771,7 @@ public: template class __packaged_task_func; template -class __packaged_task_func<_Fp, _Alloc, _Rp(_ArgTypes...)> +class _LIBCPP_AVAILABILITY_FUTURE __packaged_task_func<_Fp, _Alloc, _Rp(_ArgTypes...)> : public __packaged_task_base<_Rp(_ArgTypes...)> { __compressed_pair<_Fp, _Alloc> __f_; @@ -1825,7 +1829,7 @@ __packaged_task_func<_Fp, _Alloc, _Rp(_ArgTypes...)>::operator()(_ArgTypes&& ... template class __packaged_task_function; template -class __packaged_task_function<_Rp(_ArgTypes...)> +class _LIBCPP_AVAILABILITY_FUTURE __packaged_task_function<_Rp(_ArgTypes...)> { typedef __packaged_task_base<_Rp(_ArgTypes...)> __base; typename aligned_storage<3*sizeof(void*)>::type __buf_; @@ -2000,7 +2004,7 @@ __packaged_task_function<_Rp(_ArgTypes...)>::operator()(_ArgTypes... __arg) cons } template -class _LIBCPP_TEMPLATE_VIS packaged_task<_Rp(_ArgTypes...)> +class _LIBCPP_TEMPLATE_VIS _LIBCPP_AVAILABILITY_FUTURE packaged_task<_Rp(_ArgTypes...)> { public: typedef _Rp result_type; // extension @@ -2129,7 +2133,7 @@ packaged_task<_Rp(_ArgTypes...)>::reset() } template -class _LIBCPP_TEMPLATE_VIS packaged_task +class _LIBCPP_TEMPLATE_VIS _LIBCPP_AVAILABILITY_FUTURE packaged_task { public: typedef void result_type; // extension @@ -2517,7 +2521,7 @@ shared_future<_Rp&>::operator=(const shared_future& __rhs) } template <> -class _LIBCPP_TYPE_VIS shared_future +class _LIBCPP_TYPE_VIS _LIBCPP_AVAILABILITY_FUTURE shared_future { __assoc_sub_state* __state_; diff --git a/include/initializer_list b/include/initializer_list index d6dfa8081..8c234aaaa 100644 --- a/include/initializer_list +++ b/include/initializer_list @@ -53,7 +53,7 @@ template const E* end(initializer_list il) noexcept; // constexpr in namespace std // purposefully not versioned { -#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS +#ifndef _LIBCPP_CXX03_LANG template class _LIBCPP_TEMPLATE_VIS initializer_list @@ -111,7 +111,7 @@ end(initializer_list<_Ep> __il) _NOEXCEPT return __il.end(); } -#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS +#endif // !defined(_LIBCPP_CXX03_LANG) } // std diff --git a/include/ios b/include/ios index 49f0c01f9..61d00b90e 100644 --- a/include/ios +++ b/include/ios @@ -657,7 +657,7 @@ protected: _LIBCPP_INLINE_VISIBILITY void move(basic_ios& __rhs); -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES +#ifndef _LIBCPP_CXX03_LANG _LIBCPP_ALWAYS_INLINE void move(basic_ios&& __rhs) {move(__rhs);} #endif diff --git a/include/istream b/include/istream index 774f38df2..0b8e05d95 100644 --- a/include/istream +++ b/include/istream @@ -162,12 +162,14 @@ template #include <__config> #include -#include <__undef_min_max> - #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) #pragma GCC system_header #endif +_LIBCPP_PUSH_MACROS +#include <__undef_macros> + + _LIBCPP_BEGIN_NAMESPACE_STD template @@ -189,12 +191,11 @@ public: { this->init(__sb); } virtual ~basic_istream(); protected: -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES +#ifndef _LIBCPP_CXX03_LANG inline _LIBCPP_INLINE_VISIBILITY basic_istream(basic_istream&& __rhs); -#endif + // 27.7.1.1.2 Assign/swap: -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES inline _LIBCPP_INLINE_VISIBILITY basic_istream& operator=(basic_istream&& __rhs); #endif @@ -332,7 +333,7 @@ basic_istream<_CharT, _Traits>::sentry::sentry(basic_istream<_CharT, _Traits>& _ __is.setstate(ios_base::failbit); } -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES +#ifndef _LIBCPP_CXX03_LANG template basic_istream<_CharT, _Traits>::basic_istream(basic_istream&& __rhs) @@ -350,7 +351,7 @@ basic_istream<_CharT, _Traits>::operator=(basic_istream&& __rhs) return *this; } -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES +#endif // _LIBCPP_CXX03_LANG template basic_istream<_CharT, _Traits>::~basic_istream() @@ -1424,7 +1425,7 @@ ws(basic_istream<_CharT, _Traits>& __is) return __is; } -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES +#ifndef _LIBCPP_CXX03_LANG template inline _LIBCPP_INLINE_VISIBILITY @@ -1435,7 +1436,7 @@ operator>>(basic_istream<_CharT, _Traits>&& __is, _Tp&& __x) return __is; } -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES +#endif // _LIBCPP_CXX03_LANG template class _LIBCPP_TEMPLATE_VIS basic_iostream @@ -1458,13 +1459,11 @@ public: virtual ~basic_iostream(); protected: -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES +#ifndef _LIBCPP_CXX03_LANG inline _LIBCPP_INLINE_VISIBILITY basic_iostream(basic_iostream&& __rhs); -#endif // assign/swap -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES inline _LIBCPP_INLINE_VISIBILITY basic_iostream& operator=(basic_iostream&& __rhs); #endif @@ -1474,7 +1473,7 @@ protected: public: }; -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES +#ifndef _LIBCPP_CXX03_LANG template basic_iostream<_CharT, _Traits>::basic_iostream(basic_iostream&& __rhs) @@ -1490,7 +1489,7 @@ basic_iostream<_CharT, _Traits>::operator=(basic_iostream&& __rhs) return *this; } -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES +#endif // _LIBCPP_CXX03_LANG template basic_iostream<_CharT, _Traits>::~basic_iostream() @@ -1607,7 +1606,7 @@ getline(basic_istream<_CharT, _Traits>& __is, return getline(__is, __str, __is.widen('\n')); } -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES +#ifndef _LIBCPP_CXX03_LANG template inline _LIBCPP_INLINE_VISIBILITY @@ -1627,7 +1626,7 @@ getline(basic_istream<_CharT, _Traits>&& __is, return getline(__is, __str, __is.widen('\n')); } -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES +#endif // _LIBCPP_CXX03_LANG template basic_istream<_CharT, _Traits>& @@ -1678,10 +1677,14 @@ operator>>(basic_istream<_CharT, _Traits>& __is, bitset<_Size>& __x) return __is; } +#ifndef _LIBCPP_AVAILABILITY_NO_STREAMS_EXTERN_TEMPLATE _LIBCPP_EXTERN_TEMPLATE(class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS basic_istream) _LIBCPP_EXTERN_TEMPLATE(class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS basic_istream) _LIBCPP_EXTERN_TEMPLATE(class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS basic_iostream) +#endif _LIBCPP_END_NAMESPACE_STD +_LIBCPP_POP_MACROS + #endif // _LIBCPP_ISTREAM diff --git a/include/iterator b/include/iterator index b8f657085..d163ab1b0 100644 --- a/include/iterator +++ b/include/iterator @@ -64,14 +64,23 @@ struct forward_iterator_tag : public input_iterator_tag {}; struct bidirectional_iterator_tag : public forward_iterator_tag {}; struct random_access_iterator_tag : public bidirectional_iterator_tag {}; +// 27.4.3, iterator operations // extension: second argument not conforming to C++03 -template -void advance(InputIterator& i, +template // constexpr in C++17 + constexpr void advance(InputIterator& i, typename iterator_traits::difference_type n); -template -typename iterator_traits::difference_type -distance(InputIterator first, InputIterator last); +template // constexpr in C++17 + constexpr typename iterator_traits::difference_type + distance(InputIterator first, InputIterator last); + +template // constexpr in C++17 + constexpr InputIterator next(InputIterator x, +typename iterator_traits::difference_type n = 1); + +template // constexpr in C++17 + constexpr BidirectionalIterator prev(BidirectionalIterator x, + typename iterator_traits::difference_type n = 1); template class reverse_iterator @@ -529,7 +538,7 @@ struct _LIBCPP_TEMPLATE_VIS iterator }; template -inline _LIBCPP_INLINE_VISIBILITY +inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14 void __advance(_InputIter& __i, typename iterator_traits<_InputIter>::difference_type __n, input_iterator_tag) { @@ -538,7 +547,7 @@ void __advance(_InputIter& __i, } template -inline _LIBCPP_INLINE_VISIBILITY +inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14 void __advance(_BiDirIter& __i, typename iterator_traits<_BiDirIter>::difference_type __n, bidirectional_iterator_tag) { @@ -551,7 +560,7 @@ void __advance(_BiDirIter& __i, } template -inline _LIBCPP_INLINE_VISIBILITY +inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14 void __advance(_RandIter& __i, typename iterator_traits<_RandIter>::difference_type __n, random_access_iterator_tag) { @@ -559,7 +568,7 @@ void __advance(_RandIter& __i, } template -inline _LIBCPP_INLINE_VISIBILITY +inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14 void advance(_InputIter& __i, typename iterator_traits<_InputIter>::difference_type __n) { @@ -567,7 +576,7 @@ void advance(_InputIter& __i, } template -inline _LIBCPP_INLINE_VISIBILITY +inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14 typename iterator_traits<_InputIter>::difference_type __distance(_InputIter __first, _InputIter __last, input_iterator_tag) { @@ -578,7 +587,7 @@ __distance(_InputIter __first, _InputIter __last, input_iterator_tag) } template -inline _LIBCPP_INLINE_VISIBILITY +inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14 typename iterator_traits<_RandIter>::difference_type __distance(_RandIter __first, _RandIter __last, random_access_iterator_tag) { @@ -586,7 +595,7 @@ __distance(_RandIter __first, _RandIter __last, random_access_iterator_tag) } template -inline _LIBCPP_INLINE_VISIBILITY +inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14 typename iterator_traits<_InputIter>::difference_type distance(_InputIter __first, _InputIter __last) { @@ -594,7 +603,7 @@ distance(_InputIter __first, _InputIter __last) } template -inline _LIBCPP_INLINE_VISIBILITY +inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14 _InputIter next(_InputIter __x, typename iterator_traits<_InputIter>::difference_type __n = 1, @@ -605,7 +614,7 @@ next(_InputIter __x, } template -inline _LIBCPP_INLINE_VISIBILITY +inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14 _BidiretionalIter prev(_BidiretionalIter __x, typename iterator_traits<_BidiretionalIter>::difference_type __n = 1, @@ -615,6 +624,14 @@ prev(_BidiretionalIter __x, return __x; } + +template +struct __is_stashing_iterator : false_type {}; + +template +struct __is_stashing_iterator<_Tp, typename __void_t::type> + : true_type {}; + template class _LIBCPP_TEMPLATE_VIS reverse_iterator : public iterator::iterator_category, @@ -625,6 +642,11 @@ class _LIBCPP_TEMPLATE_VIS reverse_iterator { private: /*mutable*/ _Iter __t; // no longer used as of LWG #2360, not removed due to ABI break + + static_assert(!__is_stashing_iterator<_Iter>::value, + "The specified iterator type cannot be used with reverse_iterator; " + "Using stashing iterators with reverse_iterator causes undefined behavior"); + protected: _Iter current; public: @@ -770,10 +792,10 @@ public: _LIBCPP_INLINE_VISIBILITY explicit back_insert_iterator(_Container& __x) : container(_VSTD::addressof(__x)) {} _LIBCPP_INLINE_VISIBILITY back_insert_iterator& operator=(const typename _Container::value_type& __value_) {container->push_back(__value_); return *this;} -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES +#ifndef _LIBCPP_CXX03_LANG _LIBCPP_INLINE_VISIBILITY back_insert_iterator& operator=(typename _Container::value_type&& __value_) {container->push_back(_VSTD::move(__value_)); return *this;} -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES +#endif // _LIBCPP_CXX03_LANG _LIBCPP_INLINE_VISIBILITY back_insert_iterator& operator*() {return *this;} _LIBCPP_INLINE_VISIBILITY back_insert_iterator& operator++() {return *this;} _LIBCPP_INLINE_VISIBILITY back_insert_iterator operator++(int) {return *this;} @@ -803,10 +825,10 @@ public: _LIBCPP_INLINE_VISIBILITY explicit front_insert_iterator(_Container& __x) : container(_VSTD::addressof(__x)) {} _LIBCPP_INLINE_VISIBILITY front_insert_iterator& operator=(const typename _Container::value_type& __value_) {container->push_front(__value_); return *this;} -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES +#ifndef _LIBCPP_CXX03_LANG _LIBCPP_INLINE_VISIBILITY front_insert_iterator& operator=(typename _Container::value_type&& __value_) {container->push_front(_VSTD::move(__value_)); return *this;} -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES +#endif // _LIBCPP_CXX03_LANG _LIBCPP_INLINE_VISIBILITY front_insert_iterator& operator*() {return *this;} _LIBCPP_INLINE_VISIBILITY front_insert_iterator& operator++() {return *this;} _LIBCPP_INLINE_VISIBILITY front_insert_iterator operator++(int) {return *this;} @@ -838,10 +860,10 @@ public: : container(_VSTD::addressof(__x)), iter(__i) {} _LIBCPP_INLINE_VISIBILITY insert_iterator& operator=(const typename _Container::value_type& __value_) {iter = container->insert(iter, __value_); ++iter; return *this;} -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES +#ifndef _LIBCPP_CXX03_LANG _LIBCPP_INLINE_VISIBILITY insert_iterator& operator=(typename _Container::value_type&& __value_) {iter = container->insert(iter, _VSTD::move(__value_)); ++iter; return *this;} -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES +#endif // _LIBCPP_CXX03_LANG _LIBCPP_INLINE_VISIBILITY insert_iterator& operator*() {return *this;} _LIBCPP_INLINE_VISIBILITY insert_iterator& operator++() {return *this;} _LIBCPP_INLINE_VISIBILITY insert_iterator& operator++(int) {return *this;} @@ -968,7 +990,6 @@ public: _LIBCPP_INLINE_VISIBILITY char_type operator*() const {return static_cast(__sbuf_->sgetc());} - _LIBCPP_INLINE_VISIBILITY char_type* operator->() const {return nullptr;} _LIBCPP_INLINE_VISIBILITY istreambuf_iterator& operator++() { __sbuf_->sbumpc(); @@ -1047,7 +1068,7 @@ public: typedef typename iterator_traits::value_type value_type; typedef typename iterator_traits::difference_type difference_type; typedef iterator_type pointer; -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES +#ifndef _LIBCPP_CXX03_LANG typedef typename iterator_traits::reference __reference; typedef typename conditional< is_reference<__reference>::value, diff --git a/include/limits b/include/limits index b15f8f1b6..f530507f7 100644 --- a/include/limits +++ b/include/limits @@ -101,24 +101,25 @@ template<> class numeric_limits; } // std */ - -#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) -#pragma GCC system_header -#endif - #include <__config> #include -#include <__undef_min_max> - -#if defined(_LIBCPP_MSVCRT) -#include "support/win32/limits_win32.h" +#if defined(_LIBCPP_COMPILER_MSVC) +#include "support/win32/limits_msvc_win32.h" #endif // _LIBCPP_MSVCRT #if defined(__IBMCPP__) #include "support/ibm/limits.h" #endif // __IBMCPP__ +#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) +#pragma GCC system_header +#endif + +_LIBCPP_PUSH_MACROS +#include <__undef_macros> + + _LIBCPP_BEGIN_NAMESPACE_STD enum float_round_style @@ -182,14 +183,14 @@ protected: static _LIBCPP_CONSTEXPR const float_round_style round_style = round_toward_zero; }; -template +template struct __libcpp_compute_min { - static _LIBCPP_CONSTEXPR const _Tp value = _Tp(_Tp(1) << digits); + static _LIBCPP_CONSTEXPR const _Tp value = _Tp(_Tp(1) << __digits); }; -template -struct __libcpp_compute_min<_Tp, digits, false> +template +struct __libcpp_compute_min<_Tp, __digits, false> { static _LIBCPP_CONSTEXPR const _Tp value = _Tp(0); }; @@ -811,4 +812,6 @@ template _LIBCPP_END_NAMESPACE_STD +_LIBCPP_POP_MACROS + #endif // _LIBCPP_LIMITS diff --git a/include/list b/include/list index fa148db51..20a66c360 100644 --- a/include/list +++ b/include/list @@ -177,14 +177,16 @@ template #include #include -#include <__undef_min_max> - #include <__debug> #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) #pragma GCC system_header #endif +_LIBCPP_PUSH_MACROS +#include <__undef_macros> + + _LIBCPP_BEGIN_NAMESPACE_STD template struct __list_node; @@ -860,11 +862,10 @@ public: list(const list& __c, const allocator_type& __a); _LIBCPP_INLINE_VISIBILITY list& operator=(const list& __c); -#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS +#ifndef _LIBCPP_CXX03_LANG list(initializer_list __il); list(initializer_list __il, const allocator_type& __a); -#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES + _LIBCPP_INLINE_VISIBILITY list(list&& __c) _NOEXCEPT_(is_nothrow_move_constructible<__node_allocator>::value); @@ -875,22 +876,20 @@ public: _NOEXCEPT_( __node_alloc_traits::propagate_on_container_move_assignment::value && is_nothrow_move_assignable<__node_allocator>::value); -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES -#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS + _LIBCPP_INLINE_VISIBILITY list& operator=(initializer_list __il) {assign(__il.begin(), __il.end()); return *this;} -#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS + + _LIBCPP_INLINE_VISIBILITY + void assign(initializer_list __il) + {assign(__il.begin(), __il.end());} +#endif // _LIBCPP_CXX03_LANG template void assign(_InpIter __f, _InpIter __l, typename enable_if<__is_input_iterator<_InpIter>::value>::type* = 0); void assign(size_type __n, const value_type& __x); -#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS - _LIBCPP_INLINE_VISIBILITY - void assign(initializer_list __il) - {assign(__il.begin(), __il.end());} -#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS _LIBCPP_INLINE_VISIBILITY allocator_type get_allocator() const _NOEXCEPT; @@ -964,10 +963,10 @@ public: return base::__end_.__prev_->__as_node()->__value_; } -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES +#ifndef _LIBCPP_CXX03_LANG void push_front(value_type&& __x); void push_back(value_type&& __x); -#ifndef _LIBCPP_HAS_NO_VARIADICS + template #if _LIBCPP_STD_VER > 14 reference emplace_front(_Args&&... __args); @@ -982,9 +981,13 @@ public: #endif template iterator emplace(const_iterator __p, _Args&&... __args); -#endif // _LIBCPP_HAS_NO_VARIADICS + iterator insert(const_iterator __p, value_type&& __x); -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES + + _LIBCPP_INLINE_VISIBILITY + iterator insert(const_iterator __p, initializer_list __il) + {return insert(__p, __il.begin(), __il.end());} +#endif // _LIBCPP_CXX03_LANG void push_front(const value_type& __x); void push_back(const value_type& __x); @@ -994,11 +997,6 @@ public: template iterator insert(const_iterator __p, _InpIter __f, _InpIter __l, typename enable_if<__is_input_iterator<_InpIter>::value>::type* = 0); -#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS - _LIBCPP_INLINE_VISIBILITY - iterator insert(const_iterator __p, initializer_list __il) - {return insert(__p, __il.begin(), __il.end());} -#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS _LIBCPP_INLINE_VISIBILITY void swap(list& __c) @@ -1022,22 +1020,18 @@ public: void resize(size_type __n, const value_type& __x); void splice(const_iterator __p, list& __c); -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES +#ifndef _LIBCPP_CXX03_LANG _LIBCPP_INLINE_VISIBILITY void splice(const_iterator __p, list&& __c) {splice(__p, __c);} -#endif - void splice(const_iterator __p, list& __c, const_iterator __i); -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES _LIBCPP_INLINE_VISIBILITY void splice(const_iterator __p, list&& __c, const_iterator __i) {splice(__p, __c, __i);} -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES - void splice(const_iterator __p, list& __c, const_iterator __f, const_iterator __l); -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES _LIBCPP_INLINE_VISIBILITY void splice(const_iterator __p, list&& __c, const_iterator __f, const_iterator __l) {splice(__p, __c, __f, __l);} -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES +#endif + void splice(const_iterator __p, list& __c, const_iterator __i); + void splice(const_iterator __p, list& __c, const_iterator __f, const_iterator __l); void remove(const value_type& __x); template void remove_if(_Pred __pred); @@ -1047,17 +1041,17 @@ public: void unique(_BinaryPred __binary_pred); _LIBCPP_INLINE_VISIBILITY void merge(list& __c); -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES +#ifndef _LIBCPP_CXX03_LANG _LIBCPP_INLINE_VISIBILITY void merge(list&& __c) {merge(__c);} -#endif - template - void merge(list& __c, _Comp __comp); -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES + template _LIBCPP_INLINE_VISIBILITY void merge(list&& __c, _Comp __comp) {merge(__c, __comp);} -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES +#endif + template + void merge(list& __c, _Comp __comp); + _LIBCPP_INLINE_VISIBILITY void sort(); template @@ -1146,7 +1140,7 @@ list<_Tp, _Alloc>::list(size_type __n) __get_db()->__insert_c(this); #endif for (; __n > 0; --__n) -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES +#ifndef _LIBCPP_CXX03_LANG emplace_back(); #else push_back(value_type()); @@ -1161,11 +1155,7 @@ list<_Tp, _Alloc>::list(size_type __n, const allocator_type& __a) : base(__a) __get_db()->__insert_c(this); #endif for (; __n > 0; --__n) -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES emplace_back(); -#else - push_back(value_type()); -#endif } #endif @@ -1239,7 +1229,7 @@ list<_Tp, _Alloc>::list(const list& __c, const allocator_type& __a) push_back(*__i); } -#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS +#ifndef _LIBCPP_CXX03_LANG template list<_Tp, _Alloc>::list(initializer_list __il, const allocator_type& __a) @@ -1264,23 +1254,6 @@ list<_Tp, _Alloc>::list(initializer_list __il) push_back(*__i); } -#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS - -template -inline -list<_Tp, _Alloc>& -list<_Tp, _Alloc>::operator=(const list& __c) -{ - if (this != &__c) - { - base::__copy_assign_alloc(__c); - assign(__c.begin(), __c.end()); - } - return *this; -} - -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES - template inline list<_Tp, _Alloc>::list(list&& __c) @@ -1346,7 +1319,20 @@ list<_Tp, _Alloc>::__move_assign(list& __c, true_type) splice(end(), __c); } -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES +#endif // _LIBCPP_CXX03_LANG + +template +inline +list<_Tp, _Alloc>& +list<_Tp, _Alloc>::operator=(const list& __c) +{ + if (this != &__c) + { + base::__copy_assign_alloc(__c); + assign(__c.begin(), __c.end()); + } + return *this; +} template template @@ -1576,7 +1562,7 @@ list<_Tp, _Alloc>::push_back(const value_type& __x) __hold.release(); } -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES +#ifndef _LIBCPP_CXX03_LANG template void @@ -1604,8 +1590,6 @@ list<_Tp, _Alloc>::push_back(value_type&& __x) __hold.release(); } -#ifndef _LIBCPP_HAS_NO_VARIADICS - template template #if _LIBCPP_STD_VER > 14 @@ -1677,8 +1661,6 @@ list<_Tp, _Alloc>::emplace(const_iterator __p, _Args&&... __args) #endif } -#endif // _LIBCPP_HAS_NO_VARIADICS - template typename list<_Tp, _Alloc>::iterator list<_Tp, _Alloc>::insert(const_iterator __p, value_type&& __x) @@ -1704,7 +1686,7 @@ list<_Tp, _Alloc>::insert(const_iterator __p, value_type&& __x) #endif } -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES +#endif // _LIBCPP_CXX03_LANG template void @@ -2435,4 +2417,6 @@ swap(list<_Tp, _Alloc>& __x, list<_Tp, _Alloc>& __y) _LIBCPP_END_NAMESPACE_STD +_LIBCPP_POP_MACROS + #endif // _LIBCPP_LIST diff --git a/include/locale b/include/locale index 138ebf01b..6aaa22cca 100644 --- a/include/locale +++ b/include/locale @@ -192,14 +192,7 @@ template class messages_byname; #endif #include #include -#if defined(_LIBCPP_MSVCRT) || defined(__MINGW32__) -#include -#elif defined(_NEWLIB_VERSION) -// FIXME: replace all the uses of _NEWLIB_VERSION with __NEWLIB__ preceded by an -// include of once https://sourceware.org/ml/newlib-cvs/2014-q3/msg00038.html -// has had a chance to bake for a bit -#include -#endif +#include #ifdef _LIBCPP_HAS_CATOPEN #include #endif @@ -208,18 +201,20 @@ template class messages_byname; #include #endif -#include <__undef_min_max> - -#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) -#pragma GCC system_header -#endif - #ifdef _LIBCPP_LOCALE__L_EXTENSIONS #include <__bsd_locale_defaults.h> #else #include <__bsd_locale_fallbacks.h> #endif +#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) +#pragma GCC system_header +#endif + +_LIBCPP_PUSH_MACROS +#include <__undef_macros> + + _LIBCPP_BEGIN_NAMESPACE_STD #if defined(__APPLE__) || defined(__FreeBSD__) @@ -233,9 +228,6 @@ _LIBCPP_BEGIN_NAMESPACE_STD #define __cloc_defined #endif -typedef _VSTD::remove_pointer::type __locale_struct; -typedef _VSTD::unique_ptr<__locale_struct, decltype(&freelocale)> __locale_unique_ptr; - // __scan_keyword // Scans [__b, __e) until a match is found in the basic_strings range // [__kb, __ke) or until it can be shown that there is no match in [__kb, __ke). @@ -1402,6 +1394,7 @@ num_put<_CharT, _OutputIterator>::do_put(iter_type __s, ios_base& __iob, this->__format_int(__fmt+1, __len, true, __iob.flags()); const unsigned __nbuf = (numeric_limits::digits / 3) + ((numeric_limits::digits % 3) != 0) + + ((__iob.flags() & ios_base::showbase) != 0) + 2; char __nar[__nbuf]; int __nc = __libcpp_snprintf_l(__nar, sizeof(__nar), _LIBCPP_GET_C_LOCALE, __fmt, __v); @@ -1428,6 +1421,7 @@ num_put<_CharT, _OutputIterator>::do_put(iter_type __s, ios_base& __iob, this->__format_int(__fmt+1, __len, true, __iob.flags()); const unsigned __nbuf = (numeric_limits::digits / 3) + ((numeric_limits::digits % 3) != 0) + + ((__iob.flags() & ios_base::showbase) != 0) + 2; char __nar[__nbuf]; int __nc = __libcpp_snprintf_l(__nar, sizeof(__nar), _LIBCPP_GET_C_LOCALE, __fmt, __v); @@ -1454,6 +1448,7 @@ num_put<_CharT, _OutputIterator>::do_put(iter_type __s, ios_base& __iob, this->__format_int(__fmt+1, __len, false, __iob.flags()); const unsigned __nbuf = (numeric_limits::digits / 3) + ((numeric_limits::digits % 3) != 0) + + ((__iob.flags() & ios_base::showbase) != 0) + 1; char __nar[__nbuf]; int __nc = __libcpp_snprintf_l(__nar, sizeof(__nar), _LIBCPP_GET_C_LOCALE, __fmt, __v); @@ -1480,6 +1475,7 @@ num_put<_CharT, _OutputIterator>::do_put(iter_type __s, ios_base& __iob, this->__format_int(__fmt+1, __len, false, __iob.flags()); const unsigned __nbuf = (numeric_limits::digits / 3) + ((numeric_limits::digits % 3) != 0) + + ((__iob.flags() & ios_base::showbase) != 0) + 1; char __nar[__nbuf]; int __nc = __libcpp_snprintf_l(__nar, sizeof(__nar), _LIBCPP_GET_C_LOCALE, __fmt, __v); @@ -1685,6 +1681,22 @@ protected: ~__time_get_c_storage() {} }; +template <> _LIBCPP_FUNC_VIS const string* __time_get_c_storage::__weeks() const; +template <> _LIBCPP_FUNC_VIS const string* __time_get_c_storage::__months() const; +template <> _LIBCPP_FUNC_VIS const string* __time_get_c_storage::__am_pm() const; +template <> _LIBCPP_FUNC_VIS const string& __time_get_c_storage::__c() const; +template <> _LIBCPP_FUNC_VIS const string& __time_get_c_storage::__r() const; +template <> _LIBCPP_FUNC_VIS const string& __time_get_c_storage::__x() const; +template <> _LIBCPP_FUNC_VIS const string& __time_get_c_storage::__X() const; + +template <> _LIBCPP_FUNC_VIS const wstring* __time_get_c_storage::__weeks() const; +template <> _LIBCPP_FUNC_VIS const wstring* __time_get_c_storage::__months() const; +template <> _LIBCPP_FUNC_VIS const wstring* __time_get_c_storage::__am_pm() const; +template <> _LIBCPP_FUNC_VIS const wstring& __time_get_c_storage::__c() const; +template <> _LIBCPP_FUNC_VIS const wstring& __time_get_c_storage::__r() const; +template <> _LIBCPP_FUNC_VIS const wstring& __time_get_c_storage::__x() const; +template <> _LIBCPP_FUNC_VIS const wstring& __time_get_c_storage::__X() const; + template > class _LIBCPP_TEMPLATE_VIS time_get : public locale::facet, @@ -2631,10 +2643,10 @@ private: void init(const char*); }; -template<> void moneypunct_byname::init(const char*); -template<> void moneypunct_byname::init(const char*); -template<> void moneypunct_byname::init(const char*); -template<> void moneypunct_byname::init(const char*); +template<> _LIBCPP_FUNC_VIS void moneypunct_byname::init(const char*); +template<> _LIBCPP_FUNC_VIS void moneypunct_byname::init(const char*); +template<> _LIBCPP_FUNC_VIS void moneypunct_byname::init(const char*); +template<> _LIBCPP_FUNC_VIS void moneypunct_byname::init(const char*); _LIBCPP_EXTERN_TEMPLATE2(class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS moneypunct_byname) _LIBCPP_EXTERN_TEMPLATE2(class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS moneypunct_byname) @@ -2825,7 +2837,7 @@ money_get<_CharT, _InputIterator>::__do_get(iter_type& __b, iter_type __e, return false; } } - // drop through + _LIBCPP_FALLTHROUGH(); case money_base::none: if (__p != 3) { @@ -3570,7 +3582,7 @@ public: wstring_convert(_Codecvt* __pcvt, state_type __state); _LIBCPP_EXPLICIT_AFTER_CXX11 wstring_convert(const byte_string& __byte_err, const wide_string& __wide_err = wide_string()); -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES +#ifndef _LIBCPP_CXX03_LANG _LIBCPP_ALWAYS_INLINE wstring_convert(wstring_convert&& __wc); #endif @@ -3629,7 +3641,7 @@ wstring_convert<_Codecvt, _Elem, _Wide_alloc, _Byte_alloc>:: __cvtptr_ = new _Codecvt; } -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES +#ifndef _LIBCPP_CXX03_LANG template inline @@ -3643,7 +3655,7 @@ wstring_convert<_Codecvt, _Elem, _Wide_alloc, _Byte_alloc>:: __wc.__cvtptr_ = nullptr; } -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES +#endif // _LIBCPP_CXX03_LANG template wstring_convert<_Codecvt, _Elem, _Wide_alloc, _Byte_alloc>::~wstring_convert() @@ -4257,4 +4269,6 @@ wbuffer_convert<_Codecvt, _Elem, _Tr>::__close() _LIBCPP_END_NAMESPACE_STD +_LIBCPP_POP_MACROS + #endif // _LIBCPP_LOCALE diff --git a/include/map b/include/map index ecd9d924e..71f18693f 100644 --- a/include/map +++ b/include/map @@ -480,8 +480,8 @@ public: void swap(__map_value_compare&__y) _NOEXCEPT_(__is_nothrow_swappable<_Compare>::value) { - using _VSTD::swap; - swap(static_cast(*this), static_cast(__y)); + using _VSTD::swap; + swap(static_cast<_Compare&>(*this), static_cast<_Compare&>(__y)); } #if _LIBCPP_STD_VER > 11 @@ -582,7 +582,7 @@ public: __second_constructed(false) {} -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES +#ifndef _LIBCPP_CXX03_LANG _LIBCPP_INLINE_VISIBILITY __map_node_destructor(__tree_node_destructor&& __x) _NOEXCEPT : __na_(__x.__na_), @@ -591,7 +591,7 @@ public: { __x.__value_constructed = false; } -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES +#endif // _LIBCPP_CXX03_LANG _LIBCPP_INLINE_VISIBILITY void operator()(pointer __p) _NOEXCEPT @@ -667,7 +667,7 @@ private: ~__value_type(); }; -#endif +#endif // _LIBCPP_CXX03_LANG template struct __extract_key_value_types; @@ -921,7 +921,7 @@ public: return *this; } -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES +#ifndef _LIBCPP_CXX03_LANG _LIBCPP_INLINE_VISIBILITY map(map&& __m) @@ -940,10 +940,6 @@ public: return *this; } -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES - -#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS - _LIBCPP_INLINE_VISIBILITY map(initializer_list __il, const key_compare& __comp = key_compare()) : __tree_(__vc(__comp)) @@ -971,7 +967,7 @@ public: return *this; } -#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS +#endif // _LIBCPP_CXX03_LANG _LIBCPP_INLINE_VISIBILITY explicit map(const allocator_type& __a) @@ -1082,6 +1078,10 @@ public: _LIBCPP_INLINE_VISIBILITY iterator insert(const_iterator __p, value_type&& __v) {return __tree_.__insert_unique(__p.__i_, _VSTD::move(__v));} + + _LIBCPP_INLINE_VISIBILITY + void insert(initializer_list __il) + {insert(__il.begin(), __il.end());} #endif template @@ -1092,14 +1092,6 @@ public: insert(__e.__i_, *__f); } -#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS - - _LIBCPP_INLINE_VISIBILITY - void insert(initializer_list __il) - {insert(__il.begin(), __il.end());} - -#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS - #if _LIBCPP_STD_VER > 14 template @@ -1194,7 +1186,7 @@ public: return emplace_hint(__h, _VSTD::move(__k), _VSTD::forward<_Vp>(__v)); } -#endif +#endif // _LIBCPP_STD_VER > 14 _LIBCPP_INLINE_VISIBILITY iterator erase(const_iterator __p) {return __tree_.erase(__p.__i_);} @@ -1307,7 +1299,6 @@ private: #ifndef _LIBCPP_CXX03_LANG - template map<_Key, _Tp, _Compare, _Allocator>::map(map&& __m, const allocator_type& __a) : __tree_(_VSTD::move(__m.__tree_), typename __base::allocator_type(__a)) @@ -1321,10 +1312,27 @@ map<_Key, _Tp, _Compare, _Allocator>::map(map&& __m, const allocator_type& __a) } } -#endif // !_LIBCPP_CXX03_LANG +template +_Tp& +map<_Key, _Tp, _Compare, _Allocator>::operator[](const key_type& __k) +{ + return __tree_.__emplace_unique_key_args(__k, + _VSTD::piecewise_construct, + _VSTD::forward_as_tuple(__k), + _VSTD::forward_as_tuple()).first->__cc.second; +} +template +_Tp& +map<_Key, _Tp, _Compare, _Allocator>::operator[](key_type&& __k) +{ + return __tree_.__emplace_unique_key_args(__k, + _VSTD::piecewise_construct, + _VSTD::forward_as_tuple(_VSTD::move(__k)), + _VSTD::forward_as_tuple()).first->__cc.second; +} -#ifdef _LIBCPP_CXX03_LANG +#else // _LIBCPP_CXX03_LANG template typename map<_Key, _Tp, _Compare, _Allocator>::__node_holder @@ -1355,29 +1363,7 @@ map<_Key, _Tp, _Compare, _Allocator>::operator[](const key_type& __k) return __r->__value_.__cc.second; } -#else - -template -_Tp& -map<_Key, _Tp, _Compare, _Allocator>::operator[](const key_type& __k) -{ - return __tree_.__emplace_unique_key_args(__k, - _VSTD::piecewise_construct, - _VSTD::forward_as_tuple(__k), - _VSTD::forward_as_tuple()).first->__cc.second; -} - -template -_Tp& -map<_Key, _Tp, _Compare, _Allocator>::operator[](key_type&& __k) -{ - return __tree_.__emplace_unique_key_args(__k, - _VSTD::piecewise_construct, - _VSTD::forward_as_tuple(_VSTD::move(__k)), - _VSTD::forward_as_tuple()).first->__cc.second; -} - -#endif // !_LIBCPP_CXX03_LANG +#endif // _LIBCPP_CXX03_LANG template _Tp& @@ -1593,7 +1579,7 @@ public: return *this; } -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES +#ifndef _LIBCPP_CXX03_LANG _LIBCPP_INLINE_VISIBILITY multimap(multimap&& __m) @@ -1612,10 +1598,6 @@ public: return *this; } -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES - -#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS - _LIBCPP_INLINE_VISIBILITY multimap(initializer_list __il, const key_compare& __comp = key_compare()) : __tree_(__vc(__comp)) @@ -1643,7 +1625,7 @@ public: return *this; } -#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS +#endif // _LIBCPP_CXX03_LANG _LIBCPP_INLINE_VISIBILITY explicit multimap(const allocator_type& __a) @@ -1736,6 +1718,11 @@ public: iterator insert(const_iterator __p, value_type&& __v) {return __tree_.__insert_multi(__p.__i_, _VSTD::move(__v));} + + _LIBCPP_INLINE_VISIBILITY + void insert(initializer_list __il) + {insert(__il.begin(), __il.end());} + #endif // _LIBCPP_CXX03_LANG _LIBCPP_INLINE_VISIBILITY @@ -1753,14 +1740,6 @@ public: __tree_.__insert_multi(__e.__i_, *__f); } -#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS - - _LIBCPP_INLINE_VISIBILITY - void insert(initializer_list __il) - {insert(__il.begin(), __il.end());} - -#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS - _LIBCPP_INLINE_VISIBILITY iterator erase(const_iterator __p) {return __tree_.erase(__p.__i_);} _LIBCPP_INLINE_VISIBILITY diff --git a/include/math.h b/include/math.h index b7659267e..8c30ba85d 100644 --- a/include/math.h +++ b/include/math.h @@ -293,9 +293,6 @@ long double truncl(long double x); */ #include <__config> -#if defined(_LIBCPP_MSVCRT) -#include -#endif #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) #pragma GCC system_header @@ -310,6 +307,7 @@ long double truncl(long double x); extern "C++" { #include +#include // signbit @@ -327,22 +325,50 @@ __libcpp_signbit(_A1 __lcpp_x) _NOEXCEPT template inline _LIBCPP_INLINE_VISIBILITY -typename std::enable_if::value, bool>::type +typename std::enable_if::value, bool>::type signbit(_A1 __lcpp_x) _NOEXCEPT { return __libcpp_signbit((typename std::__promote<_A1>::type)__lcpp_x); } -#elif defined(_LIBCPP_MSVCRT) && ((_VC_CRT_MAJOR_VERSION-0) >= 14) +template +inline _LIBCPP_INLINE_VISIBILITY +typename std::enable_if< + std::is_integral<_A1>::value && std::is_signed<_A1>::value, bool>::type +signbit(_A1 __lcpp_x) _NOEXCEPT +{ return __lcpp_x < 0; } + +template +inline _LIBCPP_INLINE_VISIBILITY +typename std::enable_if< + std::is_integral<_A1>::value && !std::is_signed<_A1>::value, bool>::type +signbit(_A1) _NOEXCEPT +{ return false; } + +#elif defined(_LIBCPP_MSVCRT) template inline _LIBCPP_INLINE_VISIBILITY -typename std::enable_if::value, bool>::type +typename std::enable_if::value, bool>::type signbit(_A1 __lcpp_x) _NOEXCEPT { return ::signbit(static_cast::type>(__lcpp_x)); } +template +inline _LIBCPP_INLINE_VISIBILITY +typename std::enable_if< + std::is_integral<_A1>::value && std::is_signed<_A1>::value, bool>::type +signbit(_A1 __lcpp_x) _NOEXCEPT +{ return __lcpp_x < 0; } + +template +inline _LIBCPP_INLINE_VISIBILITY +typename std::enable_if< + std::is_integral<_A1>::value && !std::is_signed<_A1>::value, bool>::type +signbit(_A1) _NOEXCEPT +{ return false; } + #endif // signbit // fpclassify @@ -361,22 +387,34 @@ __libcpp_fpclassify(_A1 __lcpp_x) _NOEXCEPT template inline _LIBCPP_INLINE_VISIBILITY -typename std::enable_if::value, int>::type +typename std::enable_if::value, int>::type fpclassify(_A1 __lcpp_x) _NOEXCEPT { return __libcpp_fpclassify((typename std::__promote<_A1>::type)__lcpp_x); } -#elif defined(_LIBCPP_MSVCRT) && ((_VC_CRT_MAJOR_VERSION-0) >= 14) +template +inline _LIBCPP_INLINE_VISIBILITY +typename std::enable_if::value, int>::type +fpclassify(_A1 __lcpp_x) _NOEXCEPT +{ return __lcpp_x == 0 ? FP_ZERO : FP_NORMAL; } + +#elif defined(_LIBCPP_MSVCRT) template inline _LIBCPP_INLINE_VISIBILITY -typename std::enable_if::value, int>::type +typename std::enable_if::value, bool>::type fpclassify(_A1 __lcpp_x) _NOEXCEPT { return ::fpclassify(static_cast::type>(__lcpp_x)); } +template +inline _LIBCPP_INLINE_VISIBILITY +typename std::enable_if::value, int>::type +fpclassify(_A1 __lcpp_x) _NOEXCEPT +{ return __lcpp_x == 0 ? FP_ZERO : FP_NORMAL; } + #endif // fpclassify // isfinite @@ -395,12 +433,22 @@ __libcpp_isfinite(_A1 __lcpp_x) _NOEXCEPT template inline _LIBCPP_INLINE_VISIBILITY -typename std::enable_if::value, bool>::type +typename std::enable_if< + std::is_arithmetic<_A1>::value && std::numeric_limits<_A1>::has_infinity, + bool>::type isfinite(_A1 __lcpp_x) _NOEXCEPT { return __libcpp_isfinite((typename std::__promote<_A1>::type)__lcpp_x); } +template +inline _LIBCPP_INLINE_VISIBILITY +typename std::enable_if< + std::is_arithmetic<_A1>::value && !std::numeric_limits<_A1>::has_infinity, + bool>::type +isfinite(_A1) _NOEXCEPT +{ return true; } + #endif // isfinite // isinf @@ -419,12 +467,22 @@ __libcpp_isinf(_A1 __lcpp_x) _NOEXCEPT template inline _LIBCPP_INLINE_VISIBILITY -typename std::enable_if::value, bool>::type +typename std::enable_if< + std::is_arithmetic<_A1>::value && std::numeric_limits<_A1>::has_infinity, + bool>::type isinf(_A1 __lcpp_x) _NOEXCEPT { return __libcpp_isinf((typename std::__promote<_A1>::type)__lcpp_x); } +template +inline _LIBCPP_INLINE_VISIBILITY +typename std::enable_if< + std::is_arithmetic<_A1>::value && !std::numeric_limits<_A1>::has_infinity, + bool>::type +isinf(_A1) _NOEXCEPT +{ return false; } + #endif // isinf // isnan @@ -443,12 +501,18 @@ __libcpp_isnan(_A1 __lcpp_x) _NOEXCEPT template inline _LIBCPP_INLINE_VISIBILITY -typename std::enable_if::value, bool>::type +typename std::enable_if::value, bool>::type isnan(_A1 __lcpp_x) _NOEXCEPT { return __libcpp_isnan((typename std::__promote<_A1>::type)__lcpp_x); } +template +inline _LIBCPP_INLINE_VISIBILITY +typename std::enable_if::value, bool>::type +isnan(_A1) _NOEXCEPT +{ return false; } + #endif // isnan // isnormal @@ -467,12 +531,18 @@ __libcpp_isnormal(_A1 __lcpp_x) _NOEXCEPT template inline _LIBCPP_INLINE_VISIBILITY -typename std::enable_if::value, bool>::type +typename std::enable_if::value, bool>::type isnormal(_A1 __lcpp_x) _NOEXCEPT { return __libcpp_isnormal((typename std::__promote<_A1>::type)__lcpp_x); } +template +inline _LIBCPP_INLINE_VISIBILITY +typename std::enable_if::value, bool>::type +isnormal(_A1 __lcpp_x) _NOEXCEPT +{ return __lcpp_x != 0; } + #endif // isnormal // isgreater @@ -673,7 +743,7 @@ abs(long double __lcpp_x) _NOEXCEPT {return ::fabsl(__lcpp_x);} // acos -#if !((defined(_LIBCPP_MSVCRT) && (_VC_CRT_MAJOR_VERSION-0) < 14) || defined(_AIX) || defined(__sun__)) +#if !(defined(_AIX) || defined(__sun__)) inline _LIBCPP_INLINE_VISIBILITY float acos(float __lcpp_x) _NOEXCEPT {return ::acosf(__lcpp_x);} inline _LIBCPP_INLINE_VISIBILITY long double acos(long double __lcpp_x) _NOEXCEPT {return ::acosl(__lcpp_x);} #endif @@ -685,7 +755,7 @@ acos(_A1 __lcpp_x) _NOEXCEPT {return ::acos((double)__lcpp_x);} // asin -#if !((defined(_LIBCPP_MSVCRT) && (_VC_CRT_MAJOR_VERSION-0) < 14) || defined(_AIX) || defined(__sun__)) +#if !(defined(_AIX) || defined(__sun__)) inline _LIBCPP_INLINE_VISIBILITY float asin(float __lcpp_x) _NOEXCEPT {return ::asinf(__lcpp_x);} inline _LIBCPP_INLINE_VISIBILITY long double asin(long double __lcpp_x) _NOEXCEPT {return ::asinl(__lcpp_x);} #endif @@ -697,7 +767,7 @@ asin(_A1 __lcpp_x) _NOEXCEPT {return ::asin((double)__lcpp_x);} // atan -#if !((defined(_LIBCPP_MSVCRT) && (_VC_CRT_MAJOR_VERSION-0) < 14) || defined(_AIX) || defined(__sun__)) +#if !(defined(_AIX) || defined(__sun__)) inline _LIBCPP_INLINE_VISIBILITY float atan(float __lcpp_x) _NOEXCEPT {return ::atanf(__lcpp_x);} inline _LIBCPP_INLINE_VISIBILITY long double atan(long double __lcpp_x) _NOEXCEPT {return ::atanl(__lcpp_x);} #endif @@ -709,7 +779,7 @@ atan(_A1 __lcpp_x) _NOEXCEPT {return ::atan((double)__lcpp_x);} // atan2 -#if !((defined(_LIBCPP_MSVCRT) && (_VC_CRT_MAJOR_VERSION-0) < 14) || defined(_AIX) || defined(__sun__)) +#if !(defined(_AIX) || defined(__sun__)) inline _LIBCPP_INLINE_VISIBILITY float atan2(float __lcpp_y, float __lcpp_x) _NOEXCEPT {return ::atan2f(__lcpp_y, __lcpp_x);} inline _LIBCPP_INLINE_VISIBILITY long double atan2(long double __lcpp_y, long double __lcpp_x) _NOEXCEPT {return ::atan2l(__lcpp_y, __lcpp_x);} #endif @@ -732,7 +802,7 @@ atan2(_A1 __lcpp_y, _A2 __lcpp_x) _NOEXCEPT // ceil -#if !((defined(_LIBCPP_MSVCRT) && (_VC_CRT_MAJOR_VERSION-0) < 14) || defined(_AIX) || defined(__sun__)) +#if !(defined(_AIX) || defined(__sun__)) inline _LIBCPP_INLINE_VISIBILITY float ceil(float __lcpp_x) _NOEXCEPT {return ::ceilf(__lcpp_x);} inline _LIBCPP_INLINE_VISIBILITY long double ceil(long double __lcpp_x) _NOEXCEPT {return ::ceill(__lcpp_x);} #endif @@ -744,7 +814,7 @@ ceil(_A1 __lcpp_x) _NOEXCEPT {return ::ceil((double)__lcpp_x);} // cos -#if !((defined(_LIBCPP_MSVCRT) && (_VC_CRT_MAJOR_VERSION-0) < 14) || defined(_AIX) || defined(__sun__)) +#if !(defined(_AIX) || defined(__sun__)) inline _LIBCPP_INLINE_VISIBILITY float cos(float __lcpp_x) _NOEXCEPT {return ::cosf(__lcpp_x);} inline _LIBCPP_INLINE_VISIBILITY long double cos(long double __lcpp_x) _NOEXCEPT {return ::cosl(__lcpp_x);} #endif @@ -756,7 +826,7 @@ cos(_A1 __lcpp_x) _NOEXCEPT {return ::cos((double)__lcpp_x);} // cosh -#if !((defined(_LIBCPP_MSVCRT) && (_VC_CRT_MAJOR_VERSION-0) < 14) || defined(_AIX) || defined(__sun__)) +#if !(defined(_AIX) || defined(__sun__)) inline _LIBCPP_INLINE_VISIBILITY float cosh(float __lcpp_x) _NOEXCEPT {return ::coshf(__lcpp_x);} inline _LIBCPP_INLINE_VISIBILITY long double cosh(long double __lcpp_x) _NOEXCEPT {return ::coshl(__lcpp_x);} #endif @@ -768,7 +838,7 @@ cosh(_A1 __lcpp_x) _NOEXCEPT {return ::cosh((double)__lcpp_x);} // exp -#if !((defined(_LIBCPP_MSVCRT) && (_VC_CRT_MAJOR_VERSION-0) < 14) || defined(_AIX) || defined(__sun__)) +#if !(defined(_AIX) || defined(__sun__)) inline _LIBCPP_INLINE_VISIBILITY float exp(float __lcpp_x) _NOEXCEPT {return ::expf(__lcpp_x);} inline _LIBCPP_INLINE_VISIBILITY long double exp(long double __lcpp_x) _NOEXCEPT {return ::expl(__lcpp_x);} #endif @@ -780,7 +850,7 @@ exp(_A1 __lcpp_x) _NOEXCEPT {return ::exp((double)__lcpp_x);} // fabs -#if !((defined(_LIBCPP_MSVCRT) && (_VC_CRT_MAJOR_VERSION-0) < 14) || defined(_AIX) || defined(__sun__)) +#if !(defined(_AIX) || defined(__sun__)) inline _LIBCPP_INLINE_VISIBILITY float fabs(float __lcpp_x) _NOEXCEPT {return ::fabsf(__lcpp_x);} inline _LIBCPP_INLINE_VISIBILITY long double fabs(long double __lcpp_x) _NOEXCEPT {return ::fabsl(__lcpp_x);} #endif @@ -792,7 +862,7 @@ fabs(_A1 __lcpp_x) _NOEXCEPT {return ::fabs((double)__lcpp_x);} // floor -#if !((defined(_LIBCPP_MSVCRT) && (_VC_CRT_MAJOR_VERSION-0) < 14) || defined(_AIX) || defined(__sun__)) +#if !(defined(_AIX) || defined(__sun__)) inline _LIBCPP_INLINE_VISIBILITY float floor(float __lcpp_x) _NOEXCEPT {return ::floorf(__lcpp_x);} inline _LIBCPP_INLINE_VISIBILITY long double floor(long double __lcpp_x) _NOEXCEPT {return ::floorl(__lcpp_x);} #endif @@ -804,7 +874,7 @@ floor(_A1 __lcpp_x) _NOEXCEPT {return ::floor((double)__lcpp_x);} // fmod -#if !((defined(_LIBCPP_MSVCRT) && (_VC_CRT_MAJOR_VERSION-0) < 14) || defined(_AIX) || defined(__sun__)) +#if !(defined(_AIX) || defined(__sun__)) inline _LIBCPP_INLINE_VISIBILITY float fmod(float __lcpp_x, float __lcpp_y) _NOEXCEPT {return ::fmodf(__lcpp_x, __lcpp_y);} inline _LIBCPP_INLINE_VISIBILITY long double fmod(long double __lcpp_x, long double __lcpp_y) _NOEXCEPT {return ::fmodl(__lcpp_x, __lcpp_y);} #endif @@ -827,7 +897,7 @@ fmod(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT // frexp -#if !((defined(_LIBCPP_MSVCRT) && (_VC_CRT_MAJOR_VERSION-0) < 14) || defined(_AIX) || defined(__sun__)) +#if !(defined(_AIX) || defined(__sun__)) inline _LIBCPP_INLINE_VISIBILITY float frexp(float __lcpp_x, int* __lcpp_e) _NOEXCEPT {return ::frexpf(__lcpp_x, __lcpp_e);} inline _LIBCPP_INLINE_VISIBILITY long double frexp(long double __lcpp_x, int* __lcpp_e) _NOEXCEPT {return ::frexpl(__lcpp_x, __lcpp_e);} #endif @@ -839,7 +909,7 @@ frexp(_A1 __lcpp_x, int* __lcpp_e) _NOEXCEPT {return ::frexp((double)__lcpp_x, _ // ldexp -#if !((defined(_LIBCPP_MSVCRT) && (_VC_CRT_MAJOR_VERSION-0) < 14) || defined(_AIX) || defined(__sun__)) +#if !(defined(_AIX) || defined(__sun__)) inline _LIBCPP_INLINE_VISIBILITY float ldexp(float __lcpp_x, int __lcpp_e) _NOEXCEPT {return ::ldexpf(__lcpp_x, __lcpp_e);} inline _LIBCPP_INLINE_VISIBILITY long double ldexp(long double __lcpp_x, int __lcpp_e) _NOEXCEPT {return ::ldexpl(__lcpp_x, __lcpp_e);} #endif @@ -851,7 +921,7 @@ ldexp(_A1 __lcpp_x, int __lcpp_e) _NOEXCEPT {return ::ldexp((double)__lcpp_x, __ // log -#if !((defined(_LIBCPP_MSVCRT) && (_VC_CRT_MAJOR_VERSION-0) < 14) || defined(_AIX) || defined(__sun__)) +#if !(defined(_AIX) || defined(__sun__)) inline _LIBCPP_INLINE_VISIBILITY float log(float __lcpp_x) _NOEXCEPT {return ::logf(__lcpp_x);} inline _LIBCPP_INLINE_VISIBILITY long double log(long double __lcpp_x) _NOEXCEPT {return ::logl(__lcpp_x);} #endif @@ -863,7 +933,7 @@ log(_A1 __lcpp_x) _NOEXCEPT {return ::log((double)__lcpp_x);} // log10 -#if !((defined(_LIBCPP_MSVCRT) && (_VC_CRT_MAJOR_VERSION-0) < 14) || defined(_AIX) || defined(__sun__)) +#if !(defined(_AIX) || defined(__sun__)) inline _LIBCPP_INLINE_VISIBILITY float log10(float __lcpp_x) _NOEXCEPT {return ::log10f(__lcpp_x);} inline _LIBCPP_INLINE_VISIBILITY long double log10(long double __lcpp_x) _NOEXCEPT {return ::log10l(__lcpp_x);} #endif @@ -875,14 +945,14 @@ log10(_A1 __lcpp_x) _NOEXCEPT {return ::log10((double)__lcpp_x);} // modf -#if !((defined(_LIBCPP_MSVCRT) && (_VC_CRT_MAJOR_VERSION-0) < 14) || defined(_AIX) || defined(__sun__)) +#if !(defined(_AIX) || defined(__sun__)) inline _LIBCPP_INLINE_VISIBILITY float modf(float __lcpp_x, float* __lcpp_y) _NOEXCEPT {return ::modff(__lcpp_x, __lcpp_y);} inline _LIBCPP_INLINE_VISIBILITY long double modf(long double __lcpp_x, long double* __lcpp_y) _NOEXCEPT {return ::modfl(__lcpp_x, __lcpp_y);} #endif // pow -#if !((defined(_LIBCPP_MSVCRT) && (_VC_CRT_MAJOR_VERSION-0) < 14) || defined(_AIX) || defined(__sun__)) +#if !(defined(_AIX) || defined(__sun__)) inline _LIBCPP_INLINE_VISIBILITY float pow(float __lcpp_x, float __lcpp_y) _NOEXCEPT {return ::powf(__lcpp_x, __lcpp_y);} inline _LIBCPP_INLINE_VISIBILITY long double pow(long double __lcpp_x, long double __lcpp_y) _NOEXCEPT {return ::powl(__lcpp_x, __lcpp_y);} #endif @@ -905,7 +975,7 @@ pow(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT // sin -#if !((defined(_LIBCPP_MSVCRT) && (_VC_CRT_MAJOR_VERSION-0) < 14) || defined(_AIX) || defined(__sun__)) +#if !(defined(_AIX) || defined(__sun__)) inline _LIBCPP_INLINE_VISIBILITY float sin(float __lcpp_x) _NOEXCEPT {return ::sinf(__lcpp_x);} inline _LIBCPP_INLINE_VISIBILITY long double sin(long double __lcpp_x) _NOEXCEPT {return ::sinl(__lcpp_x);} #endif @@ -917,7 +987,7 @@ sin(_A1 __lcpp_x) _NOEXCEPT {return ::sin((double)__lcpp_x);} // sinh -#if !((defined(_LIBCPP_MSVCRT) && (_VC_CRT_MAJOR_VERSION-0) < 14) || defined(_AIX) || defined(__sun__)) +#if !(defined(_AIX) || defined(__sun__)) inline _LIBCPP_INLINE_VISIBILITY float sinh(float __lcpp_x) _NOEXCEPT {return ::sinhf(__lcpp_x);} inline _LIBCPP_INLINE_VISIBILITY long double sinh(long double __lcpp_x) _NOEXCEPT {return ::sinhl(__lcpp_x);} #endif @@ -929,7 +999,7 @@ sinh(_A1 __lcpp_x) _NOEXCEPT {return ::sinh((double)__lcpp_x);} // sqrt -#if !((defined(_LIBCPP_MSVCRT) && (_VC_CRT_MAJOR_VERSION-0) < 14) || defined(_AIX) || defined(__sun__)) +#if !(defined(_AIX) || defined(__sun__)) inline _LIBCPP_INLINE_VISIBILITY float sqrt(float __lcpp_x) _NOEXCEPT {return ::sqrtf(__lcpp_x);} inline _LIBCPP_INLINE_VISIBILITY long double sqrt(long double __lcpp_x) _NOEXCEPT {return ::sqrtl(__lcpp_x);} #endif @@ -941,7 +1011,7 @@ sqrt(_A1 __lcpp_x) _NOEXCEPT {return ::sqrt((double)__lcpp_x);} // tan -#if !((defined(_LIBCPP_MSVCRT) && (_VC_CRT_MAJOR_VERSION-0) < 14) || defined(_AIX) || defined(__sun__)) +#if !(defined(_AIX) || defined(__sun__)) inline _LIBCPP_INLINE_VISIBILITY float tan(float __lcpp_x) _NOEXCEPT {return ::tanf(__lcpp_x);} inline _LIBCPP_INLINE_VISIBILITY long double tan(long double __lcpp_x) _NOEXCEPT {return ::tanl(__lcpp_x);} #endif @@ -953,7 +1023,7 @@ tan(_A1 __lcpp_x) _NOEXCEPT {return ::tan((double)__lcpp_x);} // tanh -#if !((defined(_LIBCPP_MSVCRT) && (_VC_CRT_MAJOR_VERSION-0) < 14) || defined(_AIX) || defined(__sun__)) +#if !(defined(_AIX) || defined(__sun__)) inline _LIBCPP_INLINE_VISIBILITY float tanh(float __lcpp_x) _NOEXCEPT {return ::tanhf(__lcpp_x);} inline _LIBCPP_INLINE_VISIBILITY long double tanh(long double __lcpp_x) _NOEXCEPT {return ::tanhl(__lcpp_x);} #endif @@ -965,7 +1035,6 @@ tanh(_A1 __lcpp_x) _NOEXCEPT {return ::tanh((double)__lcpp_x);} // acosh -#if !(defined(_LIBCPP_MSVCRT) && (_VC_CRT_MAJOR_VERSION-0) < 14) inline _LIBCPP_INLINE_VISIBILITY float acosh(float __lcpp_x) _NOEXCEPT {return ::acoshf(__lcpp_x);} inline _LIBCPP_INLINE_VISIBILITY long double acosh(long double __lcpp_x) _NOEXCEPT {return ::acoshl(__lcpp_x);} @@ -973,11 +1042,9 @@ template inline _LIBCPP_INLINE_VISIBILITY typename std::enable_if::value, double>::type acosh(_A1 __lcpp_x) _NOEXCEPT {return ::acosh((double)__lcpp_x);} -#endif // asinh -#if !(defined(_LIBCPP_MSVCRT) && (_VC_CRT_MAJOR_VERSION-0) < 14) inline _LIBCPP_INLINE_VISIBILITY float asinh(float __lcpp_x) _NOEXCEPT {return ::asinhf(__lcpp_x);} inline _LIBCPP_INLINE_VISIBILITY long double asinh(long double __lcpp_x) _NOEXCEPT {return ::asinhl(__lcpp_x);} @@ -985,11 +1052,9 @@ template inline _LIBCPP_INLINE_VISIBILITY typename std::enable_if::value, double>::type asinh(_A1 __lcpp_x) _NOEXCEPT {return ::asinh((double)__lcpp_x);} -#endif // atanh -#if !(defined(_LIBCPP_MSVCRT) && (_VC_CRT_MAJOR_VERSION-0) < 14) inline _LIBCPP_INLINE_VISIBILITY float atanh(float __lcpp_x) _NOEXCEPT {return ::atanhf(__lcpp_x);} inline _LIBCPP_INLINE_VISIBILITY long double atanh(long double __lcpp_x) _NOEXCEPT {return ::atanhl(__lcpp_x);} @@ -997,11 +1062,9 @@ template inline _LIBCPP_INLINE_VISIBILITY typename std::enable_if::value, double>::type atanh(_A1 __lcpp_x) _NOEXCEPT {return ::atanh((double)__lcpp_x);} -#endif // cbrt -#if !(defined(_LIBCPP_MSVCRT) && (_VC_CRT_MAJOR_VERSION-0) < 14) inline _LIBCPP_INLINE_VISIBILITY float cbrt(float __lcpp_x) _NOEXCEPT {return ::cbrtf(__lcpp_x);} inline _LIBCPP_INLINE_VISIBILITY long double cbrt(long double __lcpp_x) _NOEXCEPT {return ::cbrtl(__lcpp_x);} @@ -1009,11 +1072,9 @@ template inline _LIBCPP_INLINE_VISIBILITY typename std::enable_if::value, double>::type cbrt(_A1 __lcpp_x) _NOEXCEPT {return ::cbrt((double)__lcpp_x);} -#endif // copysign -#if !defined(_VC_CRT_MAJOR_VERSION) || (_VC_CRT_MAJOR_VERSION < 12) inline _LIBCPP_INLINE_VISIBILITY float copysign(float __lcpp_x, float __lcpp_y) _NOEXCEPT { return ::copysignf(__lcpp_x, __lcpp_y); @@ -1022,7 +1083,6 @@ inline _LIBCPP_INLINE_VISIBILITY long double copysign(long double __lcpp_x, long double __lcpp_y) _NOEXCEPT { return ::copysignl(__lcpp_x, __lcpp_y); } -#endif template inline _LIBCPP_INLINE_VISIBILITY @@ -1040,8 +1100,6 @@ copysign(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT return ::copysign((__result_type)__lcpp_x, (__result_type)__lcpp_y); } -#if !(defined(_LIBCPP_MSVCRT) && ((_VC_CRT_MAJOR_VERSION-0) < 14)) - // erf inline _LIBCPP_INLINE_VISIBILITY float erf(float __lcpp_x) _NOEXCEPT {return ::erff(__lcpp_x);} @@ -1424,8 +1482,6 @@ inline _LIBCPP_INLINE_VISIBILITY typename std::enable_if::value, double>::type trunc(_A1 __lcpp_x) _NOEXCEPT {return ::trunc((double)__lcpp_x);} -#endif // !(defined(_LIBCPP_MSVCRT) && ((_VC_CRT_MAJOR_VERSION-0) < 14)) - } // extern "C++" #endif // __cplusplus diff --git a/include/memory b/include/memory index c7f540bb8..711551d57 100644 --- a/include/memory +++ b/include/memory @@ -433,8 +433,8 @@ public: long use_count() const noexcept; bool unique() const noexcept; explicit operator bool() const noexcept; - template bool owner_before(shared_ptr const& b) const; - template bool owner_before(weak_ptr const& b) const; + template bool owner_before(shared_ptr const& b) const noexcept; + template bool owner_before(weak_ptr const& b) const noexcept; }; // shared_ptr comparisons: @@ -531,8 +531,8 @@ public: long use_count() const noexcept; bool expired() const noexcept; shared_ptr lock() const noexcept; - template bool owner_before(shared_ptr const& b) const; - template bool owner_before(weak_ptr const& b) const; + template bool owner_before(shared_ptr const& b) const noexcept; + template bool owner_before(weak_ptr const& b) const noexcept; }; // weak_ptr specialized algorithms: @@ -546,9 +546,9 @@ struct owner_less> : binary_function, shared_ptr, bool> { typedef bool result_type; - bool operator()(shared_ptr const&, shared_ptr const&) const; - bool operator()(shared_ptr const&, weak_ptr const&) const; - bool operator()(weak_ptr const&, shared_ptr const&) const; + bool operator()(shared_ptr const&, shared_ptr const&) const noexcept; + bool operator()(shared_ptr const&, weak_ptr const&) const noexcept; + bool operator()(weak_ptr const&, shared_ptr const&) const noexcept; }; template @@ -556,9 +556,24 @@ struct owner_less> : binary_function, weak_ptr, bool> { typedef bool result_type; - bool operator()(weak_ptr const&, weak_ptr const&) const; - bool operator()(shared_ptr const&, weak_ptr const&) const; - bool operator()(weak_ptr const&, shared_ptr const&) const; + bool operator()(weak_ptr const&, weak_ptr const&) const noexcept; + bool operator()(shared_ptr const&, weak_ptr const&) const noexcept; + bool operator()(weak_ptr const&, shared_ptr const&) const noexcept; +}; + +template <> // Added in C++14 +struct owner_less +{ + template + bool operator()( shared_ptr<_Tp> const& __x, shared_ptr<_Up> const& __y) const noexcept; + template + bool operator()( shared_ptr<_Tp> const& __x, weak_ptr<_Up> const& __y) const noexcept; + template + bool operator()( weak_ptr<_Tp> const& __x, shared_ptr<_Up> const& __y) const noexcept; + template + bool operator()( weak_ptr<_Tp> const& __x, weak_ptr<_Up> const& __y) const noexcept; + + typedef void is_transparent; }; template @@ -638,17 +653,19 @@ void* align(size_t alignment, size_t size, void*& ptr, size_t& space); #include #include #include - +#include #if !defined(_LIBCPP_HAS_NO_ATOMIC_HEADER) # include #endif -#include <__undef_min_max> - #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) #pragma GCC system_header #endif +_LIBCPP_PUSH_MACROS +#include <__undef_macros> + + _LIBCPP_BEGIN_NAMESPACE_STD template @@ -981,11 +998,11 @@ struct __rebind_pointer { // allocator_traits -namespace __has_pointer_type_imp +struct __has_pointer_type_imp { template static __two __test(...); template static char __test(typename _Up::pointer* = 0); -} +}; template struct __has_pointer_type @@ -1526,7 +1543,7 @@ struct _LIBCPP_TEMPLATE_VIS allocator_traits {return __a.allocate(__n);} _LIBCPP_INLINE_VISIBILITY static pointer allocate(allocator_type& __a, size_type __n, const_void_pointer __hint) - {return allocate(__a, __n, __hint, + {return __allocate(__a, __n, __hint, __has_allocate_hint());} _LIBCPP_INLINE_VISIBILITY @@ -1580,7 +1597,7 @@ struct _LIBCPP_TEMPLATE_VIS allocator_traits _LIBCPP_INLINE_VISIBILITY static allocator_type select_on_container_copy_construction(const allocator_type& __a) - {return select_on_container_copy_construction( + {return __select_on_container_copy_construction( __has_select_on_container_copy_construction(), __a);} @@ -1679,11 +1696,11 @@ struct _LIBCPP_TEMPLATE_VIS allocator_traits private: _LIBCPP_INLINE_VISIBILITY - static pointer allocate(allocator_type& __a, size_type __n, + static pointer __allocate(allocator_type& __a, size_type __n, const_void_pointer __hint, true_type) {return __a.allocate(__n, __hint);} _LIBCPP_INLINE_VISIBILITY - static pointer allocate(allocator_type& __a, size_type __n, + static pointer __allocate(allocator_type& __a, size_type __n, const_void_pointer, false_type) {return __a.allocate(__n);} @@ -1720,11 +1737,11 @@ private: _LIBCPP_INLINE_VISIBILITY static allocator_type - select_on_container_copy_construction(true_type, const allocator_type& __a) + __select_on_container_copy_construction(true_type, const allocator_type& __a) {return __a.select_on_container_copy_construction();} _LIBCPP_INLINE_VISIBILITY static allocator_type - select_on_container_copy_construction(false_type, const allocator_type& __a) + __select_on_container_copy_construction(false_type, const allocator_type& __a) {return __a;} }; @@ -2055,778 +2072,817 @@ public: }; #endif -template ::type, - typename remove_cv<_T2>::type>::value, - bool = is_empty<_T1>::value - && !__libcpp_is_final<_T1>::value, - bool = is_empty<_T2>::value - && !__libcpp_is_final<_T2>::value - > -struct __libcpp_compressed_pair_switch; +template ::value && !__libcpp_is_final<_Tp>::value> +struct __compressed_pair_elem { + typedef _Tp _ParamT; + typedef _Tp& reference; + typedef const _Tp& const_reference; -template -struct __libcpp_compressed_pair_switch<_T1, _T2, IsSame, false, false> {enum {value = 0};}; +#ifndef _LIBCPP_CXX03_LANG + constexpr __compressed_pair_elem() : __value_() {} -template -struct __libcpp_compressed_pair_switch<_T1, _T2, IsSame, true, false> {enum {value = 1};}; + template ::type>::value + >::type> + constexpr explicit + __compressed_pair_elem(_Up&& __u) + : __value_(_VSTD::forward<_Up>(__u)){}; -template -struct __libcpp_compressed_pair_switch<_T1, _T2, IsSame, false, true> {enum {value = 2};}; + template + _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14 + __compressed_pair_elem(piecewise_construct_t, tuple<_Args...> __args, + __tuple_indices<_Indexes...>) + : __value_(_VSTD::forward<_Args>(_VSTD::get<_Indexes>(__args))...) {} +#else + __compressed_pair_elem() : __value_() {} + __compressed_pair_elem(_ParamT __p) : __value_(std::forward<_ParamT>(__p)) {} +#endif -template -struct __libcpp_compressed_pair_switch<_T1, _T2, false, true, true> {enum {value = 3};}; + reference __get() _NOEXCEPT { return __value_; } + const_reference __get() const _NOEXCEPT { return __value_; } -template -struct __libcpp_compressed_pair_switch<_T1, _T2, true, true, true> {enum {value = 1};}; - -template ::value> -class __libcpp_compressed_pair_imp; - -template -class __libcpp_compressed_pair_imp<_T1, _T2, 0> -{ private: - _T1 __first_; - _T2 __second_; -public: - typedef _T1 _T1_param; - typedef _T2 _T2_param; - - typedef typename remove_reference<_T1>::type& _T1_reference; - typedef typename remove_reference<_T2>::type& _T2_reference; - - typedef const typename remove_reference<_T1>::type& _T1_const_reference; - typedef const typename remove_reference<_T2>::type& _T2_const_reference; - - _LIBCPP_INLINE_VISIBILITY __libcpp_compressed_pair_imp() : __first_(), __second_() {} - _LIBCPP_INLINE_VISIBILITY explicit __libcpp_compressed_pair_imp(_T1_param __t1) - : __first_(_VSTD::forward<_T1_param>(__t1)), __second_() {} - _LIBCPP_INLINE_VISIBILITY explicit __libcpp_compressed_pair_imp(_T2_param __t2) - : __first_(), __second_(_VSTD::forward<_T2_param>(__t2)) {} - _LIBCPP_INLINE_VISIBILITY __libcpp_compressed_pair_imp(_T1_param __t1, _T2_param __t2) - : __first_(_VSTD::forward<_T1_param>(__t1)), __second_(_VSTD::forward<_T2_param>(__t2)) {} - -#ifndef _LIBCPP_HAS_NO_VARIADICS - - template - _LIBCPP_INLINE_VISIBILITY - __libcpp_compressed_pair_imp(piecewise_construct_t, - tuple<_Args1...> __first_args, - tuple<_Args2...> __second_args, - __tuple_indices<_I1...>, - __tuple_indices<_I2...>) - : __first_(_VSTD::forward<_Args1>(_VSTD::get<_I1>(__first_args))...), - __second_(_VSTD::forward<_Args2>(_VSTD::get<_I2>(__second_args))...) - {} - -#endif // _LIBCPP_HAS_NO_VARIADICS - - _LIBCPP_INLINE_VISIBILITY _T1_reference first() _NOEXCEPT {return __first_;} - _LIBCPP_INLINE_VISIBILITY _T1_const_reference first() const _NOEXCEPT {return __first_;} - - _LIBCPP_INLINE_VISIBILITY _T2_reference second() _NOEXCEPT {return __second_;} - _LIBCPP_INLINE_VISIBILITY _T2_const_reference second() const _NOEXCEPT {return __second_;} - - _LIBCPP_INLINE_VISIBILITY void swap(__libcpp_compressed_pair_imp& __x) - _NOEXCEPT_(__is_nothrow_swappable<_T1>::value && - __is_nothrow_swappable<_T2>::value) - { - using _VSTD::swap; - swap(__first_, __x.__first_); - swap(__second_, __x.__second_); - } + _Tp __value_; }; -template -class __libcpp_compressed_pair_imp<_T1, _T2, 1> - : private _T1 -{ -private: - _T2 __second_; -public: - typedef _T1 _T1_param; - typedef _T2 _T2_param; +template +struct __compressed_pair_elem<_Tp, _Idx, true> : private _Tp { + typedef _Tp _ParamT; + typedef _Tp& reference; + typedef const _Tp& const_reference; + typedef _Tp __value_type; - typedef _T1& _T1_reference; - typedef typename remove_reference<_T2>::type& _T2_reference; +#ifndef _LIBCPP_CXX03_LANG + constexpr __compressed_pair_elem() = default; - typedef const _T1& _T1_const_reference; - typedef const typename remove_reference<_T2>::type& _T2_const_reference; + template ::type>::value + >::type> + constexpr explicit + __compressed_pair_elem(_Up&& __u) + : __value_type(_VSTD::forward<_Up>(__u)){}; - _LIBCPP_INLINE_VISIBILITY __libcpp_compressed_pair_imp() : __second_() {} - _LIBCPP_INLINE_VISIBILITY explicit __libcpp_compressed_pair_imp(_T1_param __t1) - : _T1(_VSTD::forward<_T1_param>(__t1)), __second_() {} - _LIBCPP_INLINE_VISIBILITY explicit __libcpp_compressed_pair_imp(_T2_param __t2) - : __second_(_VSTD::forward<_T2_param>(__t2)) {} - _LIBCPP_INLINE_VISIBILITY __libcpp_compressed_pair_imp(_T1_param __t1, _T2_param __t2) - : _T1(_VSTD::forward<_T1_param>(__t1)), __second_(_VSTD::forward<_T2_param>(__t2)) {} + template + _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14 + __compressed_pair_elem(piecewise_construct_t, tuple<_Args...> __args, + __tuple_indices<_Indexes...>) + : __value_type(_VSTD::forward<_Args>(_VSTD::get<_Indexes>(__args))...) {} +#else + __compressed_pair_elem() : __value_type() {} + __compressed_pair_elem(_ParamT __p) + : __value_type(std::forward<_ParamT>(__p)) {} +#endif -#ifndef _LIBCPP_HAS_NO_VARIADICS - - template - _LIBCPP_INLINE_VISIBILITY - __libcpp_compressed_pair_imp(piecewise_construct_t, - tuple<_Args1...> __first_args, - tuple<_Args2...> __second_args, - __tuple_indices<_I1...>, - __tuple_indices<_I2...>) - : _T1(_VSTD::forward<_Args1>(_VSTD::get<_I1>(__first_args))...), - __second_(_VSTD::forward<_Args2>(_VSTD::get<_I2>(__second_args))...) - {} - -#endif // _LIBCPP_HAS_NO_VARIADICS - - _LIBCPP_INLINE_VISIBILITY _T1_reference first() _NOEXCEPT {return *this;} - _LIBCPP_INLINE_VISIBILITY _T1_const_reference first() const _NOEXCEPT {return *this;} - - _LIBCPP_INLINE_VISIBILITY _T2_reference second() _NOEXCEPT {return __second_;} - _LIBCPP_INLINE_VISIBILITY _T2_const_reference second() const _NOEXCEPT {return __second_;} - - _LIBCPP_INLINE_VISIBILITY void swap(__libcpp_compressed_pair_imp& __x) - _NOEXCEPT_(__is_nothrow_swappable<_T1>::value && - __is_nothrow_swappable<_T2>::value) - { - using _VSTD::swap; - swap(__second_, __x.__second_); - } + reference __get() _NOEXCEPT { return *this; } + const_reference __get() const _NOEXCEPT { return *this; } }; -template -class __libcpp_compressed_pair_imp<_T1, _T2, 2> - : private _T2 -{ -private: - _T1 __first_; -public: - typedef _T1 _T1_param; - typedef _T2 _T2_param; - - typedef typename remove_reference<_T1>::type& _T1_reference; - typedef _T2& _T2_reference; - - typedef const typename remove_reference<_T1>::type& _T1_const_reference; - typedef const _T2& _T2_const_reference; - - _LIBCPP_INLINE_VISIBILITY __libcpp_compressed_pair_imp() : __first_() {} - _LIBCPP_INLINE_VISIBILITY explicit __libcpp_compressed_pair_imp(_T1_param __t1) - : __first_(_VSTD::forward<_T1_param>(__t1)) {} - _LIBCPP_INLINE_VISIBILITY explicit __libcpp_compressed_pair_imp(_T2_param __t2) - : _T2(_VSTD::forward<_T2_param>(__t2)), __first_() {} - _LIBCPP_INLINE_VISIBILITY __libcpp_compressed_pair_imp(_T1_param __t1, _T2_param __t2) - _NOEXCEPT_(is_nothrow_move_constructible<_T1>::value && - is_nothrow_move_constructible<_T2>::value) - : _T2(_VSTD::forward<_T2_param>(__t2)), __first_(_VSTD::forward<_T1_param>(__t1)) {} - -#ifndef _LIBCPP_HAS_NO_VARIADICS - - template - _LIBCPP_INLINE_VISIBILITY - __libcpp_compressed_pair_imp(piecewise_construct_t, - tuple<_Args1...> __first_args, - tuple<_Args2...> __second_args, - __tuple_indices<_I1...>, - __tuple_indices<_I2...>) - : _T2(_VSTD::forward<_Args2>(_VSTD::get<_I2>(__second_args))...), - __first_(_VSTD::forward<_Args1>(_VSTD::get<_I1>(__first_args))...) - - {} - -#endif // _LIBCPP_HAS_NO_VARIADICS - - _LIBCPP_INLINE_VISIBILITY _T1_reference first() _NOEXCEPT {return __first_;} - _LIBCPP_INLINE_VISIBILITY _T1_const_reference first() const _NOEXCEPT {return __first_;} - - _LIBCPP_INLINE_VISIBILITY _T2_reference second() _NOEXCEPT {return *this;} - _LIBCPP_INLINE_VISIBILITY _T2_const_reference second() const _NOEXCEPT {return *this;} - - _LIBCPP_INLINE_VISIBILITY void swap(__libcpp_compressed_pair_imp& __x) - _NOEXCEPT_(__is_nothrow_swappable<_T1>::value && - __is_nothrow_swappable<_T2>::value) - { - using _VSTD::swap; - swap(__first_, __x.__first_); - } -}; +// Tag used to construct the second element of the compressed pair. +struct __second_tag {}; template -class __libcpp_compressed_pair_imp<_T1, _T2, 3> - : private _T1, - private _T2 -{ +class __compressed_pair : private __compressed_pair_elem<_T1, 0>, + private __compressed_pair_elem<_T2, 1> { + typedef __compressed_pair_elem<_T1, 0> _Base1; + typedef __compressed_pair_elem<_T2, 1> _Base2; + + // NOTE: This static assert should never fire because __compressed_pair + // is *almost never* used in a scenario where it's possible for T1 == T2. + // (The exception is std::function where it is possible that the function + // object and the allocator have the same type). + static_assert((!is_same<_T1, _T2>::value), + "__compressed_pair cannot be instantated when T1 and T2 are the same type; " + "The current implementation is NOT ABI-compatible with the previous " + "implementation for this configuration"); + public: - typedef _T1 _T1_param; - typedef _T2 _T2_param; +#ifndef _LIBCPP_CXX03_LANG + template , _Dummy>::value && + __dependent_type, _Dummy>::value + >::type + > + _LIBCPP_INLINE_VISIBILITY + constexpr __compressed_pair() {} - typedef _T1& _T1_reference; - typedef _T2& _T2_reference; + template ::type, + __compressed_pair>::value, + bool>::type = true> + _LIBCPP_INLINE_VISIBILITY constexpr explicit + __compressed_pair(_Tp&& __t) + : _Base1(std::forward<_Tp>(__t)), _Base2() {} - typedef const _T1& _T1_const_reference; - typedef const _T2& _T2_const_reference; + template + _LIBCPP_INLINE_VISIBILITY constexpr + __compressed_pair(__second_tag, _Tp&& __t) + : _Base1(), _Base2(std::forward<_Tp>(__t)) {} - _LIBCPP_INLINE_VISIBILITY __libcpp_compressed_pair_imp() {} - _LIBCPP_INLINE_VISIBILITY explicit __libcpp_compressed_pair_imp(_T1_param __t1) - : _T1(_VSTD::forward<_T1_param>(__t1)) {} - _LIBCPP_INLINE_VISIBILITY explicit __libcpp_compressed_pair_imp(_T2_param __t2) - : _T2(_VSTD::forward<_T2_param>(__t2)) {} - _LIBCPP_INLINE_VISIBILITY __libcpp_compressed_pair_imp(_T1_param __t1, _T2_param __t2) - : _T1(_VSTD::forward<_T1_param>(__t1)), _T2(_VSTD::forward<_T2_param>(__t2)) {} + template + _LIBCPP_INLINE_VISIBILITY constexpr + __compressed_pair(_U1&& __t1, _U2&& __t2) + : _Base1(std::forward<_U1>(__t1)), _Base2(std::forward<_U2>(__t2)) {} -#ifndef _LIBCPP_HAS_NO_VARIADICS + template + _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14 + __compressed_pair(piecewise_construct_t __pc, tuple<_Args1...> __first_args, + tuple<_Args2...> __second_args) + : _Base1(__pc, _VSTD::move(__first_args), + typename __make_tuple_indices::type()), + _Base2(__pc, _VSTD::move(__second_args), + typename __make_tuple_indices::type()) {} - template - _LIBCPP_INLINE_VISIBILITY - __libcpp_compressed_pair_imp(piecewise_construct_t, - tuple<_Args1...> __first_args, - tuple<_Args2...> __second_args, - __tuple_indices<_I1...>, - __tuple_indices<_I2...>) - : _T1(_VSTD::forward<_Args1>(_VSTD::get<_I1>(__first_args))...), - _T2(_VSTD::forward<_Args2>(_VSTD::get<_I2>(__second_args))...) - {} +#else + _LIBCPP_INLINE_VISIBILITY + __compressed_pair() {} -#endif // _LIBCPP_HAS_NO_VARIADICS + _LIBCPP_INLINE_VISIBILITY explicit + __compressed_pair(_T1 __t1) : _Base1(_VSTD::forward<_T1>(__t1)) {} - _LIBCPP_INLINE_VISIBILITY _T1_reference first() _NOEXCEPT {return *this;} - _LIBCPP_INLINE_VISIBILITY _T1_const_reference first() const _NOEXCEPT {return *this;} + _LIBCPP_INLINE_VISIBILITY + __compressed_pair(__second_tag, _T2 __t2) + : _Base1(), _Base2(_VSTD::forward<_T2>(__t2)) {} - _LIBCPP_INLINE_VISIBILITY _T2_reference second() _NOEXCEPT {return *this;} - _LIBCPP_INLINE_VISIBILITY _T2_const_reference second() const _NOEXCEPT {return *this;} + _LIBCPP_INLINE_VISIBILITY + __compressed_pair(_T1 __t1, _T2 __t2) + : _Base1(_VSTD::forward<_T1>(__t1)), _Base2(_VSTD::forward<_T2>(__t2)) {} +#endif - _LIBCPP_INLINE_VISIBILITY void swap(__libcpp_compressed_pair_imp&) - _NOEXCEPT_(__is_nothrow_swappable<_T1>::value && - __is_nothrow_swappable<_T2>::value) - { - } -}; + _LIBCPP_INLINE_VISIBILITY + typename _Base1::reference first() _NOEXCEPT { + return static_cast<_Base1&>(*this).__get(); + } -template -class __compressed_pair - : private __libcpp_compressed_pair_imp<_T1, _T2> -{ - typedef __libcpp_compressed_pair_imp<_T1, _T2> base; -public: - typedef typename base::_T1_param _T1_param; - typedef typename base::_T2_param _T2_param; + _LIBCPP_INLINE_VISIBILITY + typename _Base1::const_reference first() const _NOEXCEPT { + return static_cast<_Base1 const&>(*this).__get(); + } - typedef typename base::_T1_reference _T1_reference; - typedef typename base::_T2_reference _T2_reference; + _LIBCPP_INLINE_VISIBILITY + typename _Base2::reference second() _NOEXCEPT { + return static_cast<_Base2&>(*this).__get(); + } - typedef typename base::_T1_const_reference _T1_const_reference; - typedef typename base::_T2_const_reference _T2_const_reference; + _LIBCPP_INLINE_VISIBILITY + typename _Base2::const_reference second() const _NOEXCEPT { + return static_cast<_Base2 const&>(*this).__get(); + } - _LIBCPP_INLINE_VISIBILITY __compressed_pair() {} - _LIBCPP_INLINE_VISIBILITY explicit __compressed_pair(_T1_param __t1) - : base(_VSTD::forward<_T1_param>(__t1)) {} - _LIBCPP_INLINE_VISIBILITY explicit __compressed_pair(_T2_param __t2) - : base(_VSTD::forward<_T2_param>(__t2)) {} - _LIBCPP_INLINE_VISIBILITY __compressed_pair(_T1_param __t1, _T2_param __t2) - : base(_VSTD::forward<_T1_param>(__t1), _VSTD::forward<_T2_param>(__t2)) {} - -#ifndef _LIBCPP_HAS_NO_VARIADICS - - template - _LIBCPP_INLINE_VISIBILITY - __compressed_pair(piecewise_construct_t __pc, tuple<_Args1...> __first_args, - tuple<_Args2...> __second_args) - : base(__pc, _VSTD::move(__first_args), _VSTD::move(__second_args), - typename __make_tuple_indices::type(), - typename __make_tuple_indices::type()) - {} - -#endif // _LIBCPP_HAS_NO_VARIADICS - - _LIBCPP_INLINE_VISIBILITY _T1_reference first() _NOEXCEPT {return base::first();} - _LIBCPP_INLINE_VISIBILITY _T1_const_reference first() const _NOEXCEPT {return base::first();} - - _LIBCPP_INLINE_VISIBILITY _T2_reference second() _NOEXCEPT {return base::second();} - _LIBCPP_INLINE_VISIBILITY _T2_const_reference second() const _NOEXCEPT {return base::second();} - - _LIBCPP_INLINE_VISIBILITY void swap(__compressed_pair& __x) - _NOEXCEPT_(__is_nothrow_swappable<_T1>::value && - __is_nothrow_swappable<_T2>::value) - {base::swap(__x);} + _LIBCPP_INLINE_VISIBILITY + void swap(__compressed_pair& __x) + _NOEXCEPT_(__is_nothrow_swappable<_T1>::value && + __is_nothrow_swappable<_T2>::value) + { + using std::swap; + swap(first(), __x.first()); + swap(second(), __x.second()); + } }; template inline _LIBCPP_INLINE_VISIBILITY -void -swap(__compressed_pair<_T1, _T2>& __x, __compressed_pair<_T1, _T2>& __y) - _NOEXCEPT_(__is_nothrow_swappable<_T1>::value && - __is_nothrow_swappable<_T2>::value) - {__x.swap(__y);} - -// __same_or_less_cv_qualified - -template ::element_type>::type, - typename remove_cv::element_type>::type - >::value - > -struct __same_or_less_cv_qualified_imp - : is_convertible<_Ptr1, _Ptr2> {}; - -template -struct __same_or_less_cv_qualified_imp<_Ptr1, _Ptr2, false> - : false_type {}; - -template ::value || - is_same<_Ptr1, _Ptr2>::value || - __has_element_type<_Ptr1>::value> -struct __same_or_less_cv_qualified - : __same_or_less_cv_qualified_imp<_Ptr1, _Ptr2> {}; - -template -struct __same_or_less_cv_qualified<_Ptr1, _Ptr2, false> - : false_type {}; +void swap(__compressed_pair<_T1, _T2>& __x, __compressed_pair<_T1, _T2>& __y) + _NOEXCEPT_(__is_nothrow_swappable<_T1>::value && + __is_nothrow_swappable<_T2>::value) { + __x.swap(__y); +} // default_delete template -struct _LIBCPP_TEMPLATE_VIS default_delete -{ +struct _LIBCPP_TEMPLATE_VIS default_delete { + static_assert(!is_function<_Tp>::value, + "default_delete cannot be instantiated for function types"); #ifndef _LIBCPP_CXX03_LANG - _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR default_delete() _NOEXCEPT = default; + _LIBCPP_INLINE_VISIBILITY constexpr default_delete() noexcept = default; #else - _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR default_delete() _NOEXCEPT {} + _LIBCPP_INLINE_VISIBILITY default_delete() {} #endif - template - _LIBCPP_INLINE_VISIBILITY default_delete(const default_delete<_Up>&, - typename enable_if::value>::type* = 0) _NOEXCEPT {} - _LIBCPP_INLINE_VISIBILITY void operator() (_Tp* __ptr) const _NOEXCEPT - { - static_assert(sizeof(_Tp) > 0, "default_delete can not delete incomplete type"); - static_assert(!is_void<_Tp>::value, "default_delete can not delete incomplete type"); - delete __ptr; - } + template + _LIBCPP_INLINE_VISIBILITY + default_delete(const default_delete<_Up>&, + typename enable_if::value>::type* = + 0) _NOEXCEPT {} + + _LIBCPP_INLINE_VISIBILITY void operator()(_Tp* __ptr) const _NOEXCEPT { + static_assert(sizeof(_Tp) > 0, + "default_delete can not delete incomplete type"); + static_assert(!is_void<_Tp>::value, + "default_delete can not delete incomplete type"); + delete __ptr; + } }; template -struct _LIBCPP_TEMPLATE_VIS default_delete<_Tp[]> -{ +struct _LIBCPP_TEMPLATE_VIS default_delete<_Tp[]> { +private: + template + struct _EnableIfConvertible + : enable_if::value> {}; + public: #ifndef _LIBCPP_CXX03_LANG - _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR default_delete() _NOEXCEPT = default; + _LIBCPP_INLINE_VISIBILITY constexpr default_delete() noexcept = default; #else - _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR default_delete() _NOEXCEPT {} + _LIBCPP_INLINE_VISIBILITY default_delete() {} #endif - template - _LIBCPP_INLINE_VISIBILITY default_delete(const default_delete<_Up[]>&, - typename enable_if<__same_or_less_cv_qualified<_Up*, _Tp*>::value>::type* = 0) _NOEXCEPT {} - template - _LIBCPP_INLINE_VISIBILITY - void operator() (_Up* __ptr, - typename enable_if<__same_or_less_cv_qualified<_Up*, _Tp*>::value>::type* = 0) const _NOEXCEPT - { - static_assert(sizeof(_Tp) > 0, "default_delete can not delete incomplete type"); - static_assert(!is_void<_Tp>::value, "default_delete can not delete void type"); - delete [] __ptr; - } + + template + _LIBCPP_INLINE_VISIBILITY + default_delete(const default_delete<_Up[]>&, + typename _EnableIfConvertible<_Up>::type* = 0) _NOEXCEPT {} + + template + _LIBCPP_INLINE_VISIBILITY + typename _EnableIfConvertible<_Up>::type + operator()(_Up* __ptr) const _NOEXCEPT { + static_assert(sizeof(_Tp) > 0, + "default_delete can not delete incomplete type"); + static_assert(!is_void<_Tp>::value, + "default_delete can not delete void type"); + delete[] __ptr; + } }; + + +#ifndef _LIBCPP_CXX03_LANG +template +struct __unique_ptr_deleter_sfinae { + static_assert(!is_reference<_Deleter>::value, "incorrect specialization"); + typedef const _Deleter& __lval_ref_type; + typedef _Deleter&& __good_rval_ref_type; + typedef true_type __enable_rval_overload; +}; + +template +struct __unique_ptr_deleter_sfinae<_Deleter const&> { + typedef const _Deleter& __lval_ref_type; + typedef const _Deleter&& __bad_rval_ref_type; + typedef false_type __enable_rval_overload; +}; + +template +struct __unique_ptr_deleter_sfinae<_Deleter&> { + typedef _Deleter& __lval_ref_type; + typedef _Deleter&& __bad_rval_ref_type; + typedef false_type __enable_rval_overload; +}; +#endif // !defined(_LIBCPP_CXX03_LANG) + template > -class _LIBCPP_TEMPLATE_VIS unique_ptr -{ +class _LIBCPP_TEMPLATE_VIS unique_ptr { public: - typedef _Tp element_type; - typedef _Dp deleter_type; - typedef typename __pointer_type<_Tp, deleter_type>::type pointer; + typedef _Tp element_type; + typedef _Dp deleter_type; + typedef typename __pointer_type<_Tp, deleter_type>::type pointer; + + static_assert(!is_rvalue_reference::value, + "the specified deleter type cannot be an rvalue reference"); + private: - __compressed_pair __ptr_; + __compressed_pair __ptr_; -#ifdef _LIBCPP_HAS_NO_RVALUE_REFERENCES - unique_ptr(unique_ptr&); - template - unique_ptr(unique_ptr<_Up, _Ep>&); - unique_ptr& operator=(unique_ptr&); - template - unique_ptr& operator=(unique_ptr<_Up, _Ep>&); -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES + struct __nat { int __for_bool_; }; - struct __nat {int __for_bool_;}; +#ifndef _LIBCPP_CXX03_LANG + typedef __unique_ptr_deleter_sfinae<_Dp> _DeleterSFINAE; + + template + using _LValRefType = + typename __dependent_type<_DeleterSFINAE, _Dummy>::__lval_ref_type; + + template + using _GoodRValRefType = + typename __dependent_type<_DeleterSFINAE, _Dummy>::__good_rval_ref_type; + + template + using _BadRValRefType = + typename __dependent_type<_DeleterSFINAE, _Dummy>::__bad_rval_ref_type; + + template , _Dummy>::type> + using _EnableIfDeleterDefaultConstructible = + typename enable_if::value && + !is_pointer<_Deleter>::value>::type; + + template + using _EnableIfDeleterConstructible = + typename enable_if::value>::type; + + template + using _EnableIfMoveConvertible = typename enable_if< + is_convertible::value && + !is_array<_Up>::value + >::type; + + template + using _EnableIfDeleterConvertible = typename enable_if< + (is_reference<_Dp>::value && is_same<_Dp, _UDel>::value) || + (!is_reference<_Dp>::value && is_convertible<_UDel, _Dp>::value) + >::type; + + template + using _EnableIfDeleterAssignable = typename enable_if< + is_assignable<_Dp&, _UDel&&>::value + >::type; - typedef typename remove_reference::type& _Dp_reference; - typedef const typename remove_reference::type& _Dp_const_reference; public: - _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR unique_ptr() _NOEXCEPT - : __ptr_(pointer()) - { - static_assert(!is_pointer::value, - "unique_ptr constructed with null function pointer deleter"); - } - _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR unique_ptr(nullptr_t) _NOEXCEPT - : __ptr_(pointer()) - { - static_assert(!is_pointer::value, - "unique_ptr constructed with null function pointer deleter"); - } - _LIBCPP_INLINE_VISIBILITY explicit unique_ptr(pointer __p) _NOEXCEPT - : __ptr_(_VSTD::move(__p)) - { - static_assert(!is_pointer::value, - "unique_ptr constructed with null function pointer deleter"); - } + template > + _LIBCPP_INLINE_VISIBILITY + constexpr unique_ptr() noexcept : __ptr_(pointer()) {} -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES - _LIBCPP_INLINE_VISIBILITY unique_ptr(pointer __p, typename conditional< - is_reference::value, - deleter_type, - typename add_lvalue_reference::type>::type __d) - _NOEXCEPT - : __ptr_(__p, __d) {} + template > + _LIBCPP_INLINE_VISIBILITY + constexpr unique_ptr(nullptr_t) noexcept : __ptr_(pointer()) {} - _LIBCPP_INLINE_VISIBILITY unique_ptr(pointer __p, typename remove_reference::type&& __d) - _NOEXCEPT - : __ptr_(__p, _VSTD::move(__d)) - { - static_assert(!is_reference::value, "rvalue deleter bound to reference"); - } - _LIBCPP_INLINE_VISIBILITY unique_ptr(unique_ptr&& __u) _NOEXCEPT - : __ptr_(__u.release(), _VSTD::forward(__u.get_deleter())) {} - template - _LIBCPP_INLINE_VISIBILITY - unique_ptr(unique_ptr<_Up, _Ep>&& __u, - typename enable_if - < - !is_array<_Up>::value && - is_convertible::pointer, pointer>::value && - is_convertible<_Ep, deleter_type>::value && - ( - !is_reference::value || - is_same::value - ), - __nat - >::type = __nat()) _NOEXCEPT - : __ptr_(__u.release(), _VSTD::forward<_Ep>(__u.get_deleter())) {} + template > + _LIBCPP_INLINE_VISIBILITY + explicit unique_ptr(pointer __p) noexcept : __ptr_(__p) {} + + template >> + _LIBCPP_INLINE_VISIBILITY + unique_ptr(pointer __p, _LValRefType<_Dummy> __d) noexcept + : __ptr_(__p, __d) {} + + template >> + _LIBCPP_INLINE_VISIBILITY + unique_ptr(pointer __p, _GoodRValRefType<_Dummy> __d) noexcept + : __ptr_(__p, _VSTD::move(__d)) { + static_assert(!is_reference::value, + "rvalue deleter bound to reference"); + } + + template >> + _LIBCPP_INLINE_VISIBILITY + unique_ptr(pointer __p, _BadRValRefType<_Dummy> __d) = delete; + + _LIBCPP_INLINE_VISIBILITY + unique_ptr(unique_ptr&& __u) noexcept + : __ptr_(__u.release(), _VSTD::forward(__u.get_deleter())) { + } + + template , _Up>, + class = _EnableIfDeleterConvertible<_Ep> + > + _LIBCPP_INLINE_VISIBILITY + unique_ptr(unique_ptr<_Up, _Ep>&& __u) _NOEXCEPT + : __ptr_(__u.release(), _VSTD::forward<_Ep>(__u.get_deleter())) {} #if _LIBCPP_STD_VER <= 14 || defined(_LIBCPP_ENABLE_CXX17_REMOVED_AUTO_PTR) - template - _LIBCPP_INLINE_VISIBILITY unique_ptr(auto_ptr<_Up>&& __p, - typename enable_if< - is_convertible<_Up*, _Tp*>::value && - is_same<_Dp, default_delete<_Tp> >::value, - __nat - >::type = __nat()) _NOEXCEPT - : __ptr_(__p.release()) - { - } + template + _LIBCPP_INLINE_VISIBILITY + unique_ptr(auto_ptr<_Up>&& __p, + typename enable_if::value && + is_same<_Dp, default_delete<_Tp>>::value, + __nat>::type = __nat()) _NOEXCEPT + : __ptr_(__p.release()) {} #endif - _LIBCPP_INLINE_VISIBILITY unique_ptr& operator=(unique_ptr&& __u) _NOEXCEPT - { - reset(__u.release()); - __ptr_.second() = _VSTD::forward(__u.get_deleter()); - return *this; - } + _LIBCPP_INLINE_VISIBILITY + unique_ptr& operator=(unique_ptr&& __u) _NOEXCEPT { + reset(__u.release()); + __ptr_.second() = _VSTD::forward(__u.get_deleter()); + return *this; + } - template - _LIBCPP_INLINE_VISIBILITY - typename enable_if - < - !is_array<_Up>::value && - is_convertible::pointer, pointer>::value && - is_assignable::value, - unique_ptr& - >::type - operator=(unique_ptr<_Up, _Ep>&& __u) _NOEXCEPT - { - reset(__u.release()); - __ptr_.second() = _VSTD::forward<_Ep>(__u.get_deleter()); - return *this; - } -#else // _LIBCPP_HAS_NO_RVALUE_REFERENCES + template , _Up>, + class = _EnableIfDeleterAssignable<_Ep> + > + _LIBCPP_INLINE_VISIBILITY + unique_ptr& operator=(unique_ptr<_Up, _Ep>&& __u) _NOEXCEPT { + reset(__u.release()); + __ptr_.second() = _VSTD::forward<_Ep>(__u.get_deleter()); + return *this; + } - _LIBCPP_INLINE_VISIBILITY operator __rv() - { - return __rv(*this); - } +#else // _LIBCPP_CXX03_LANG +private: + unique_ptr(unique_ptr&); + template unique_ptr(unique_ptr<_Up, _Ep>&); - _LIBCPP_INLINE_VISIBILITY unique_ptr(__rv __u) - : __ptr_(__u->release(), _VSTD::forward(__u->get_deleter())) {} + unique_ptr& operator=(unique_ptr&); + template unique_ptr& operator=(unique_ptr<_Up, _Ep>&); - template - _LIBCPP_INLINE_VISIBILITY - typename enable_if< - !is_array<_Up>::value && - is_convertible::pointer, pointer>::value && - is_assignable::value, - unique_ptr& - >::type - operator=(unique_ptr<_Up, _Ep> __u) - { - reset(__u.release()); - __ptr_.second() = _VSTD::forward<_Ep>(__u.get_deleter()); - return *this; - } +public: + _LIBCPP_INLINE_VISIBILITY + unique_ptr() : __ptr_(pointer()) + { + static_assert(!is_pointer::value, + "unique_ptr constructed with null function pointer deleter"); + static_assert(is_default_constructible::value, + "unique_ptr::deleter_type is not default constructible"); + } + _LIBCPP_INLINE_VISIBILITY + unique_ptr(nullptr_t) : __ptr_(pointer()) + { + static_assert(!is_pointer::value, + "unique_ptr constructed with null function pointer deleter"); + } + _LIBCPP_INLINE_VISIBILITY + explicit unique_ptr(pointer __p) + : __ptr_(_VSTD::move(__p)) { + static_assert(!is_pointer::value, + "unique_ptr constructed with null function pointer deleter"); + } - _LIBCPP_INLINE_VISIBILITY unique_ptr(pointer __p, deleter_type __d) - : __ptr_(_VSTD::move(__p), _VSTD::move(__d)) {} + _LIBCPP_INLINE_VISIBILITY + operator __rv() { + return __rv(*this); + } + + _LIBCPP_INLINE_VISIBILITY + unique_ptr(__rv __u) + : __ptr_(__u->release(), + _VSTD::forward(__u->get_deleter())) {} + + template + _LIBCPP_INLINE_VISIBILITY + typename enable_if< + !is_array<_Up>::value && + is_convertible::pointer, + pointer>::value && + is_assignable::value, + unique_ptr&>::type + operator=(unique_ptr<_Up, _Ep> __u) { + reset(__u.release()); + __ptr_.second() = _VSTD::forward<_Ep>(__u.get_deleter()); + return *this; + } + + _LIBCPP_INLINE_VISIBILITY + unique_ptr(pointer __p, deleter_type __d) + : __ptr_(_VSTD::move(__p), _VSTD::move(__d)) {} +#endif // _LIBCPP_CXX03_LANG #if _LIBCPP_STD_VER <= 14 || defined(_LIBCPP_ENABLE_CXX17_REMOVED_AUTO_PTR) - template - _LIBCPP_INLINE_VISIBILITY - typename enable_if< - is_convertible<_Up*, _Tp*>::value && - is_same<_Dp, default_delete<_Tp> >::value, - unique_ptr& - >::type - operator=(auto_ptr<_Up> __p) - {reset(__p.release()); return *this;} + template + _LIBCPP_INLINE_VISIBILITY + typename enable_if::value && + is_same<_Dp, default_delete<_Tp> >::value, + unique_ptr&>::type + operator=(auto_ptr<_Up> __p) { + reset(__p.release()); + return *this; + } #endif -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES - _LIBCPP_INLINE_VISIBILITY ~unique_ptr() {reset();} - _LIBCPP_INLINE_VISIBILITY unique_ptr& operator=(nullptr_t) _NOEXCEPT - { - reset(); - return *this; - } + _LIBCPP_INLINE_VISIBILITY + ~unique_ptr() { reset(); } - _LIBCPP_INLINE_VISIBILITY typename add_lvalue_reference<_Tp>::type operator*() const - {return *__ptr_.first();} - _LIBCPP_INLINE_VISIBILITY pointer operator->() const _NOEXCEPT {return __ptr_.first();} - _LIBCPP_INLINE_VISIBILITY pointer get() const _NOEXCEPT {return __ptr_.first();} - _LIBCPP_INLINE_VISIBILITY _Dp_reference get_deleter() _NOEXCEPT - {return __ptr_.second();} - _LIBCPP_INLINE_VISIBILITY _Dp_const_reference get_deleter() const _NOEXCEPT - {return __ptr_.second();} - _LIBCPP_INLINE_VISIBILITY - _LIBCPP_EXPLICIT operator bool() const _NOEXCEPT - {return __ptr_.first() != nullptr;} + _LIBCPP_INLINE_VISIBILITY + unique_ptr& operator=(nullptr_t) _NOEXCEPT { + reset(); + return *this; + } - _LIBCPP_INLINE_VISIBILITY pointer release() _NOEXCEPT - { - pointer __t = __ptr_.first(); - __ptr_.first() = pointer(); - return __t; - } + _LIBCPP_INLINE_VISIBILITY + typename add_lvalue_reference<_Tp>::type + operator*() const { + return *__ptr_.first(); + } + _LIBCPP_INLINE_VISIBILITY + pointer operator->() const _NOEXCEPT { + return __ptr_.first(); + } + _LIBCPP_INLINE_VISIBILITY + pointer get() const _NOEXCEPT { + return __ptr_.first(); + } + _LIBCPP_INLINE_VISIBILITY + deleter_type& get_deleter() _NOEXCEPT { + return __ptr_.second(); + } + _LIBCPP_INLINE_VISIBILITY + const deleter_type& get_deleter() const _NOEXCEPT { + return __ptr_.second(); + } + _LIBCPP_INLINE_VISIBILITY + _LIBCPP_EXPLICIT operator bool() const _NOEXCEPT { + return __ptr_.first() != nullptr; + } - _LIBCPP_INLINE_VISIBILITY void reset(pointer __p = pointer()) _NOEXCEPT - { - pointer __tmp = __ptr_.first(); - __ptr_.first() = __p; - if (__tmp) - __ptr_.second()(__tmp); - } + _LIBCPP_INLINE_VISIBILITY + pointer release() _NOEXCEPT { + pointer __t = __ptr_.first(); + __ptr_.first() = pointer(); + return __t; + } - _LIBCPP_INLINE_VISIBILITY void swap(unique_ptr& __u) _NOEXCEPT - {__ptr_.swap(__u.__ptr_);} + _LIBCPP_INLINE_VISIBILITY + void reset(pointer __p = pointer()) _NOEXCEPT { + pointer __tmp = __ptr_.first(); + __ptr_.first() = __p; + if (__tmp) + __ptr_.second()(__tmp); + } + + _LIBCPP_INLINE_VISIBILITY + void swap(unique_ptr& __u) _NOEXCEPT { + __ptr_.swap(__u.__ptr_); + } }; + template -class _LIBCPP_TEMPLATE_VIS unique_ptr<_Tp[], _Dp> -{ +class _LIBCPP_TEMPLATE_VIS unique_ptr<_Tp[], _Dp> { public: - typedef _Tp element_type; - typedef _Dp deleter_type; - typedef typename __pointer_type<_Tp, deleter_type>::type pointer; + typedef _Tp element_type; + typedef _Dp deleter_type; + typedef typename __pointer_type<_Tp, deleter_type>::type pointer; + private: - __compressed_pair __ptr_; + __compressed_pair __ptr_; -#ifdef _LIBCPP_HAS_NO_RVALUE_REFERENCES - unique_ptr(unique_ptr&); - template - unique_ptr(unique_ptr<_Up>&); - unique_ptr& operator=(unique_ptr&); - template - unique_ptr& operator=(unique_ptr<_Up>&); -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES + template + struct _CheckArrayPointerConversion : is_same<_From, pointer> {}; - struct __nat {int __for_bool_;}; + template + struct _CheckArrayPointerConversion<_FromElem*> + : integral_constant::value || + (is_same::value && + is_convertible<_FromElem(*)[], element_type(*)[]>::value) + > + {}; + +#ifndef _LIBCPP_CXX03_LANG + typedef __unique_ptr_deleter_sfinae<_Dp> _DeleterSFINAE; + + template + using _LValRefType = + typename __dependent_type<_DeleterSFINAE, _Dummy>::__lval_ref_type; + + template + using _GoodRValRefType = + typename __dependent_type<_DeleterSFINAE, _Dummy>::__good_rval_ref_type; + + template + using _BadRValRefType = + typename __dependent_type<_DeleterSFINAE, _Dummy>::__bad_rval_ref_type; + + template , _Dummy>::type> + using _EnableIfDeleterDefaultConstructible = + typename enable_if::value && + !is_pointer<_Deleter>::value>::type; + + template + using _EnableIfDeleterConstructible = + typename enable_if::value>::type; + + template + using _EnableIfPointerConvertible = typename enable_if< + _CheckArrayPointerConversion<_Pp>::value + >::type; + + template + using _EnableIfMoveConvertible = typename enable_if< + is_array<_Up>::value && + is_same::value && + is_same::value && + is_convertible<_ElemT(*)[], element_type(*)[]>::value + >::type; + + template + using _EnableIfDeleterConvertible = typename enable_if< + (is_reference<_Dp>::value && is_same<_Dp, _UDel>::value) || + (!is_reference<_Dp>::value && is_convertible<_UDel, _Dp>::value) + >::type; + + template + using _EnableIfDeleterAssignable = typename enable_if< + is_assignable<_Dp&, _UDel&&>::value + >::type; - typedef typename remove_reference::type& _Dp_reference; - typedef const typename remove_reference::type& _Dp_const_reference; public: - _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR unique_ptr() _NOEXCEPT - : __ptr_(pointer()) - { - static_assert(!is_pointer::value, - "unique_ptr constructed with null function pointer deleter"); - } - _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR unique_ptr(nullptr_t) _NOEXCEPT - : __ptr_(pointer()) - { - static_assert(!is_pointer::value, - "unique_ptr constructed with null function pointer deleter"); - } -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES - template - _LIBCPP_INLINE_VISIBILITY explicit unique_ptr(_Pp __p, - typename enable_if<__same_or_less_cv_qualified<_Pp, pointer>::value, __nat>::type = __nat()) _NOEXCEPT - : __ptr_(__p) - { - static_assert(!is_pointer::value, - "unique_ptr constructed with null function pointer deleter"); - } + template > + _LIBCPP_INLINE_VISIBILITY + constexpr unique_ptr() noexcept : __ptr_(pointer()) {} - template - _LIBCPP_INLINE_VISIBILITY unique_ptr(_Pp __p, typename conditional< - is_reference::value, - deleter_type, - typename add_lvalue_reference::type>::type __d, - typename enable_if<__same_or_less_cv_qualified<_Pp, pointer>::value, __nat>::type = __nat()) - _NOEXCEPT - : __ptr_(__p, __d) {} + template > + _LIBCPP_INLINE_VISIBILITY + constexpr unique_ptr(nullptr_t) noexcept : __ptr_(pointer()) {} - _LIBCPP_INLINE_VISIBILITY unique_ptr(nullptr_t, typename conditional< - is_reference::value, - deleter_type, - typename add_lvalue_reference::type>::type __d) - _NOEXCEPT - : __ptr_(pointer(), __d) {} + template , + class = _EnableIfPointerConvertible<_Pp>> + _LIBCPP_INLINE_VISIBILITY + explicit unique_ptr(_Pp __p) noexcept + : __ptr_(__p) {} - template - _LIBCPP_INLINE_VISIBILITY unique_ptr(_Pp __p, - typename remove_reference::type&& __d, - typename enable_if<__same_or_less_cv_qualified<_Pp, pointer>::value, __nat>::type = __nat()) - _NOEXCEPT - : __ptr_(__p, _VSTD::move(__d)) - { - static_assert(!is_reference::value, "rvalue deleter bound to reference"); - } + template >, + class = _EnableIfPointerConvertible<_Pp>> + _LIBCPP_INLINE_VISIBILITY + unique_ptr(_Pp __p, _LValRefType<_Dummy> __d) noexcept + : __ptr_(__p, __d) {} - _LIBCPP_INLINE_VISIBILITY unique_ptr(nullptr_t, typename remove_reference::type&& __d) - _NOEXCEPT - : __ptr_(pointer(), _VSTD::move(__d)) - { - static_assert(!is_reference::value, "rvalue deleter bound to reference"); - } + template >> + _LIBCPP_INLINE_VISIBILITY + unique_ptr(nullptr_t, _LValRefType<_Dummy> __d) noexcept + : __ptr_(nullptr, __d) {} - _LIBCPP_INLINE_VISIBILITY unique_ptr(unique_ptr&& __u) _NOEXCEPT - : __ptr_(__u.release(), _VSTD::forward(__u.get_deleter())) {} + template >, + class = _EnableIfPointerConvertible<_Pp>> + _LIBCPP_INLINE_VISIBILITY + unique_ptr(_Pp __p, _GoodRValRefType<_Dummy> __d) noexcept + : __ptr_(__p, _VSTD::move(__d)) { + static_assert(!is_reference::value, + "rvalue deleter bound to reference"); + } - _LIBCPP_INLINE_VISIBILITY unique_ptr& operator=(unique_ptr&& __u) _NOEXCEPT - { - reset(__u.release()); - __ptr_.second() = _VSTD::forward(__u.get_deleter()); - return *this; - } + template >> + _LIBCPP_INLINE_VISIBILITY + unique_ptr(nullptr_t, _GoodRValRefType<_Dummy> __d) noexcept + : __ptr_(nullptr, _VSTD::move(__d)) { + static_assert(!is_reference::value, + "rvalue deleter bound to reference"); + } - template - _LIBCPP_INLINE_VISIBILITY - unique_ptr(unique_ptr<_Up, _Ep>&& __u, - typename enable_if - < - is_array<_Up>::value && - __same_or_less_cv_qualified::pointer, pointer>::value - && is_convertible<_Ep, deleter_type>::value && - ( - !is_reference::value || - is_same::value - ), - __nat - >::type = __nat() - ) _NOEXCEPT - : __ptr_(__u.release(), _VSTD::forward(__u.get_deleter())) {} + template >, + class = _EnableIfPointerConvertible<_Pp>> + _LIBCPP_INLINE_VISIBILITY + unique_ptr(_Pp __p, _BadRValRefType<_Dummy> __d) = delete; + _LIBCPP_INLINE_VISIBILITY + unique_ptr(unique_ptr&& __u) noexcept + : __ptr_(__u.release(), _VSTD::forward(__u.get_deleter())) { + } - template - _LIBCPP_INLINE_VISIBILITY - typename enable_if - < - is_array<_Up>::value && - __same_or_less_cv_qualified::pointer, pointer>::value && - is_assignable::value, - unique_ptr& - >::type - operator=(unique_ptr<_Up, _Ep>&& __u) _NOEXCEPT - { - reset(__u.release()); - __ptr_.second() = _VSTD::forward<_Ep>(__u.get_deleter()); - return *this; - } -#else // _LIBCPP_HAS_NO_RVALUE_REFERENCES + _LIBCPP_INLINE_VISIBILITY + unique_ptr& operator=(unique_ptr&& __u) noexcept { + reset(__u.release()); + __ptr_.second() = _VSTD::forward(__u.get_deleter()); + return *this; + } - _LIBCPP_INLINE_VISIBILITY explicit unique_ptr(pointer __p) - : __ptr_(__p) - { - static_assert(!is_pointer::value, - "unique_ptr constructed with null function pointer deleter"); - } + template , _Up>, + class = _EnableIfDeleterConvertible<_Ep> + > + _LIBCPP_INLINE_VISIBILITY + unique_ptr(unique_ptr<_Up, _Ep>&& __u) noexcept + : __ptr_(__u.release(), _VSTD::forward<_Ep>(__u.get_deleter())) { + } - _LIBCPP_INLINE_VISIBILITY unique_ptr(pointer __p, deleter_type __d) - : __ptr_(__p, _VSTD::forward(__d)) {} + template , _Up>, + class = _EnableIfDeleterAssignable<_Ep> + > + _LIBCPP_INLINE_VISIBILITY + unique_ptr& + operator=(unique_ptr<_Up, _Ep>&& __u) noexcept { + reset(__u.release()); + __ptr_.second() = _VSTD::forward<_Ep>(__u.get_deleter()); + return *this; + } - _LIBCPP_INLINE_VISIBILITY unique_ptr(nullptr_t, deleter_type __d) - : __ptr_(pointer(), _VSTD::forward(__d)) {} - - _LIBCPP_INLINE_VISIBILITY operator __rv() - { - return __rv(*this); - } - - _LIBCPP_INLINE_VISIBILITY unique_ptr(__rv __u) - : __ptr_(__u->release(), _VSTD::forward(__u->get_deleter())) {} - - _LIBCPP_INLINE_VISIBILITY unique_ptr& operator=(__rv __u) - { - reset(__u->release()); - __ptr_.second() = _VSTD::forward(__u->get_deleter()); - return *this; - } - -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES - _LIBCPP_INLINE_VISIBILITY ~unique_ptr() {reset();} - - _LIBCPP_INLINE_VISIBILITY unique_ptr& operator=(nullptr_t) _NOEXCEPT - { - reset(); - return *this; - } - - _LIBCPP_INLINE_VISIBILITY typename add_lvalue_reference<_Tp>::type operator[](size_t __i) const - {return __ptr_.first()[__i];} - _LIBCPP_INLINE_VISIBILITY pointer get() const _NOEXCEPT {return __ptr_.first();} - _LIBCPP_INLINE_VISIBILITY _Dp_reference get_deleter() _NOEXCEPT - {return __ptr_.second();} - _LIBCPP_INLINE_VISIBILITY _Dp_const_reference get_deleter() const _NOEXCEPT - {return __ptr_.second();} - _LIBCPP_INLINE_VISIBILITY - _LIBCPP_EXPLICIT operator bool() const _NOEXCEPT - {return __ptr_.first() != nullptr;} - - _LIBCPP_INLINE_VISIBILITY pointer release() _NOEXCEPT - { - pointer __t = __ptr_.first(); - __ptr_.first() = pointer(); - return __t; - } - - template - _LIBCPP_INLINE_VISIBILITY - typename enable_if<__same_or_less_cv_qualified<_Pp, pointer>::value, void>::type - reset(_Pp __p) _NOEXCEPT - { - pointer __tmp = __ptr_.first(); - __ptr_.first() = __p; - if (__tmp) - __ptr_.second()(__tmp); - } - _LIBCPP_INLINE_VISIBILITY void reset(nullptr_t = nullptr) _NOEXCEPT - { - pointer __tmp = __ptr_.first(); - __ptr_.first() = nullptr; - if (__tmp) - __ptr_.second()(__tmp); - } - - _LIBCPP_INLINE_VISIBILITY void swap(unique_ptr& __u) {__ptr_.swap(__u.__ptr_);} +#else // _LIBCPP_CXX03_LANG private: + template explicit unique_ptr(_Up); + + unique_ptr(unique_ptr&); + template unique_ptr(unique_ptr<_Up>&); + + unique_ptr& operator=(unique_ptr&); + template unique_ptr& operator=(unique_ptr<_Up>&); + + template + unique_ptr(_Up __u, + typename conditional< + is_reference::value, deleter_type, + typename add_lvalue_reference::type>::type, + typename enable_if::value, + __nat>::type = __nat()); +public: + _LIBCPP_INLINE_VISIBILITY + unique_ptr() : __ptr_(pointer()) { + static_assert(!is_pointer::value, + "unique_ptr constructed with null function pointer deleter"); + } + _LIBCPP_INLINE_VISIBILITY + unique_ptr(nullptr_t) : __ptr_(pointer()) { + static_assert(!is_pointer::value, + "unique_ptr constructed with null function pointer deleter"); + } + + _LIBCPP_INLINE_VISIBILITY + explicit unique_ptr(pointer __p) : __ptr_(__p) { + static_assert(!is_pointer::value, + "unique_ptr constructed with null function pointer deleter"); + } + + _LIBCPP_INLINE_VISIBILITY + unique_ptr(pointer __p, deleter_type __d) + : __ptr_(__p, _VSTD::forward(__d)) {} + + _LIBCPP_INLINE_VISIBILITY + unique_ptr(nullptr_t, deleter_type __d) + : __ptr_(pointer(), _VSTD::forward(__d)) {} + + _LIBCPP_INLINE_VISIBILITY + operator __rv() { + return __rv(*this); + } + + _LIBCPP_INLINE_VISIBILITY + unique_ptr(__rv __u) + : __ptr_(__u->release(), + _VSTD::forward(__u->get_deleter())) {} + + _LIBCPP_INLINE_VISIBILITY + unique_ptr& operator=(__rv __u) { + reset(__u->release()); + __ptr_.second() = _VSTD::forward(__u->get_deleter()); + return *this; + } + +#endif // _LIBCPP_CXX03_LANG + +public: + _LIBCPP_INLINE_VISIBILITY + ~unique_ptr() { reset(); } + + _LIBCPP_INLINE_VISIBILITY + unique_ptr& operator=(nullptr_t) _NOEXCEPT { + reset(); + return *this; + } + + _LIBCPP_INLINE_VISIBILITY + typename add_lvalue_reference<_Tp>::type + operator[](size_t __i) const { + return __ptr_.first()[__i]; + } + _LIBCPP_INLINE_VISIBILITY + pointer get() const _NOEXCEPT { + return __ptr_.first(); + } + + _LIBCPP_INLINE_VISIBILITY + deleter_type& get_deleter() _NOEXCEPT { + return __ptr_.second(); + } + + _LIBCPP_INLINE_VISIBILITY + const deleter_type& get_deleter() const _NOEXCEPT { + return __ptr_.second(); + } + _LIBCPP_INLINE_VISIBILITY + _LIBCPP_EXPLICIT operator bool() const _NOEXCEPT { + return __ptr_.first() != nullptr; + } + + _LIBCPP_INLINE_VISIBILITY + pointer release() _NOEXCEPT { + pointer __t = __ptr_.first(); + __ptr_.first() = pointer(); + return __t; + } + + template + _LIBCPP_INLINE_VISIBILITY + typename enable_if< + _CheckArrayPointerConversion<_Pp>::value + >::type + reset(_Pp __p) _NOEXCEPT { + pointer __tmp = __ptr_.first(); + __ptr_.first() = __p; + if (__tmp) + __ptr_.second()(__tmp); + } + + _LIBCPP_INLINE_VISIBILITY + void reset(nullptr_t = nullptr) _NOEXCEPT { + pointer __tmp = __ptr_.first(); + __ptr_.first() = nullptr; + if (__tmp) + __ptr_.second()(__tmp); + } + + _LIBCPP_INLINE_VISIBILITY + void swap(unique_ptr& __u) _NOEXCEPT { + __ptr_.swap(__u.__ptr_); + } -#ifdef _LIBCPP_HAS_NO_RVALUE_REFERENCES - template - explicit unique_ptr(_Up); - template - unique_ptr(_Up __u, - typename conditional< - is_reference::value, - deleter_type, - typename add_lvalue_reference::type>::type, - typename enable_if - < - is_convertible<_Up, pointer>::value, - __nat - >::type = __nat()); -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES }; template @@ -3037,7 +3093,7 @@ struct _LIBCPP_TEMPLATE_VIS hash<__enable_hash_helper< typedef unique_ptr<_Tp, _Dp> argument_type; typedef size_t result_type; _LIBCPP_INLINE_VISIBILITY - result_type operator()(const argument_type& __ptr) const _NOEXCEPT + result_type operator()(const argument_type& __ptr) const { typedef typename argument_type::pointer pointer; return hash()(__ptr.get()); @@ -3047,28 +3103,28 @@ struct _LIBCPP_TEMPLATE_VIS hash<__enable_hash_helper< struct __destruct_n { private: - size_t size; + size_t __size_; template _LIBCPP_INLINE_VISIBILITY void __process(_Tp* __p, false_type) _NOEXCEPT - {for (size_t __i = 0; __i < size; ++__i, ++__p) __p->~_Tp();} + {for (size_t __i = 0; __i < __size_; ++__i, ++__p) __p->~_Tp();} template _LIBCPP_INLINE_VISIBILITY void __process(_Tp*, true_type) _NOEXCEPT {} _LIBCPP_INLINE_VISIBILITY void __incr(false_type) _NOEXCEPT - {++size;} + {++__size_;} _LIBCPP_INLINE_VISIBILITY void __incr(true_type) _NOEXCEPT {} _LIBCPP_INLINE_VISIBILITY void __set(size_t __s, false_type) _NOEXCEPT - {size = __s;} + {__size_ = __s;} _LIBCPP_INLINE_VISIBILITY void __set(size_t, true_type) _NOEXCEPT {} public: _LIBCPP_INLINE_VISIBILITY explicit __destruct_n(size_t __s) _NOEXCEPT - : size(__s) {} + : __size_(__s) {} template _LIBCPP_INLINE_VISIBILITY void __incr(_Tp*) _NOEXCEPT @@ -3507,7 +3563,7 @@ template const void* __shared_ptr_pointer<_Tp, _Dp, _Alloc>::__get_deleter(const type_info& __t) const _NOEXCEPT { - return __t == typeid(_Dp) ? _VSTD::addressof(__data_.first().second()) : 0; + return __t == typeid(_Dp) ? _VSTD::addressof(__data_.first().second()) : nullptr; } #endif // _LIBCPP_NO_RTTI @@ -3601,6 +3657,18 @@ __shared_ptr_emplace<_Tp, _Alloc>::__on_zero_shared_weak() _NOEXCEPT __a.deallocate(_PTraits::pointer_to(*this), 1); } +struct __shared_ptr_dummy_rebind_allocator_type; +template <> +class _LIBCPP_TEMPLATE_VIS allocator<__shared_ptr_dummy_rebind_allocator_type> +{ +public: + template + struct rebind + { + typedef allocator<_Other> other; + }; +}; + template class _LIBCPP_TEMPLATE_VIS enable_shared_from_this; template @@ -3807,11 +3875,11 @@ public: _LIBCPP_EXPLICIT operator bool() const _NOEXCEPT {return get() != 0;} template _LIBCPP_INLINE_VISIBILITY - bool owner_before(shared_ptr<_Up> const& __p) const + bool owner_before(shared_ptr<_Up> const& __p) const _NOEXCEPT {return __cntrl_ < __p.__cntrl_;} template _LIBCPP_INLINE_VISIBILITY - bool owner_before(weak_ptr<_Up> const& __p) const + bool owner_before(weak_ptr<_Up> const& __p) const _NOEXCEPT {return __cntrl_ < __p.__cntrl_;} _LIBCPP_INLINE_VISIBILITY bool @@ -3869,10 +3937,24 @@ public: #endif // _LIBCPP_HAS_NO_VARIADICS private: + template ::value> + struct __shared_ptr_default_allocator + { + typedef allocator<_Yp> type; + }; + + template + struct __shared_ptr_default_allocator<_Yp, true> + { + typedef allocator<__shared_ptr_dummy_rebind_allocator_type> type; + }; template _LIBCPP_INLINE_VISIBILITY - void + typename enable_if* + >::value, + void>::type __enable_weak_this(const enable_shared_from_this<_Yp>* __e, _OrigPtr* __ptr) _NOEXCEPT { @@ -3884,13 +3966,13 @@ private: } } - _LIBCPP_INLINE_VISIBILITY - void __enable_weak_this(const volatile void*, const volatile void*) _NOEXCEPT {} + _LIBCPP_INLINE_VISIBILITY void __enable_weak_this(...) _NOEXCEPT {} template friend class _LIBCPP_TEMPLATE_VIS shared_ptr; template friend class _LIBCPP_TEMPLATE_VIS weak_ptr; }; + template inline _LIBCPP_CONSTEXPR @@ -3916,8 +3998,9 @@ shared_ptr<_Tp>::shared_ptr(_Yp* __p, : __ptr_(__p) { unique_ptr<_Yp> __hold(__p); - typedef __shared_ptr_pointer<_Yp*, default_delete<_Yp>, allocator<_Yp> > _CntrlBlk; - __cntrl_ = new _CntrlBlk(__p, default_delete<_Yp>(), allocator<_Yp>()); + typedef typename __shared_ptr_default_allocator<_Yp>::type _AllocT; + typedef __shared_ptr_pointer<_Yp*, default_delete<_Yp>, _AllocT > _CntrlBlk; + __cntrl_ = new _CntrlBlk(__p, default_delete<_Yp>(), _AllocT()); __hold.release(); __enable_weak_this(__p, __p); } @@ -3932,8 +4015,9 @@ shared_ptr<_Tp>::shared_ptr(_Yp* __p, _Dp __d, try { #endif // _LIBCPP_NO_EXCEPTIONS - typedef __shared_ptr_pointer<_Yp*, _Dp, allocator<_Yp> > _CntrlBlk; - __cntrl_ = new _CntrlBlk(__p, __d, allocator<_Yp>()); + typedef typename __shared_ptr_default_allocator<_Yp>::type _AllocT; + typedef __shared_ptr_pointer<_Yp*, _Dp, _AllocT > _CntrlBlk; + __cntrl_ = new _CntrlBlk(__p, __d, _AllocT()); __enable_weak_this(__p, __p); #ifndef _LIBCPP_NO_EXCEPTIONS } @@ -3954,8 +4038,9 @@ shared_ptr<_Tp>::shared_ptr(nullptr_t __p, _Dp __d) try { #endif // _LIBCPP_NO_EXCEPTIONS - typedef __shared_ptr_pointer > _CntrlBlk; - __cntrl_ = new _CntrlBlk(__p, __d, allocator<_Tp>()); + typedef typename __shared_ptr_default_allocator<_Tp>::type _AllocT; + typedef __shared_ptr_pointer _CntrlBlk; + __cntrl_ = new _CntrlBlk(__p, __d, _AllocT()); #ifndef _LIBCPP_NO_EXCEPTIONS } catch (...) @@ -4123,8 +4208,9 @@ shared_ptr<_Tp>::shared_ptr(unique_ptr<_Yp, _Dp> __r, else #endif { - typedef __shared_ptr_pointer<_Yp*, _Dp, allocator<_Yp> > _CntrlBlk; - __cntrl_ = new _CntrlBlk(__r.get(), __r.get_deleter(), allocator<_Yp>()); + typedef typename __shared_ptr_default_allocator<_Yp>::type _AllocT; + typedef __shared_ptr_pointer<_Yp*, _Dp, _AllocT > _CntrlBlk; + __cntrl_ = new _CntrlBlk(__r.get(), __r.get_deleter(), _AllocT()); __enable_weak_this(__r.get(), __r.get()); } __r.release(); @@ -4152,10 +4238,11 @@ shared_ptr<_Tp>::shared_ptr(unique_ptr<_Yp, _Dp> __r, else #endif { + typedef typename __shared_ptr_default_allocator<_Yp>::type _AllocT; typedef __shared_ptr_pointer<_Yp*, reference_wrapper::type>, - allocator<_Yp> > _CntrlBlk; - __cntrl_ = new _CntrlBlk(__r.get(), ref(__r.get_deleter()), allocator<_Yp>()); + _AllocT > _CntrlBlk; + __cntrl_ = new _CntrlBlk(__r.get(), ref(__r.get_deleter()), _AllocT()); __enable_weak_this(__r.get(), __r.get()); } __r.release(); @@ -4907,11 +4994,11 @@ public: shared_ptr<_Tp> lock() const _NOEXCEPT; template _LIBCPP_INLINE_VISIBILITY - bool owner_before(const shared_ptr<_Up>& __r) const + bool owner_before(const shared_ptr<_Up>& __r) const _NOEXCEPT {return __cntrl_ < __r.__cntrl_;} template _LIBCPP_INLINE_VISIBILITY - bool owner_before(const weak_ptr<_Up>& __r) const + bool owner_before(const weak_ptr<_Up>& __r) const _NOEXCEPT {return __cntrl_ < __r.__cntrl_;} template friend class _LIBCPP_TEMPLATE_VIS weak_ptr; @@ -5120,13 +5207,13 @@ struct _LIBCPP_TEMPLATE_VIS owner_less > { typedef bool result_type; _LIBCPP_INLINE_VISIBILITY - bool operator()(shared_ptr<_Tp> const& __x, shared_ptr<_Tp> const& __y) const + bool operator()(shared_ptr<_Tp> const& __x, shared_ptr<_Tp> const& __y) const _NOEXCEPT {return __x.owner_before(__y);} _LIBCPP_INLINE_VISIBILITY - bool operator()(shared_ptr<_Tp> const& __x, weak_ptr<_Tp> const& __y) const + bool operator()(shared_ptr<_Tp> const& __x, weak_ptr<_Tp> const& __y) const _NOEXCEPT {return __x.owner_before(__y);} _LIBCPP_INLINE_VISIBILITY - bool operator()( weak_ptr<_Tp> const& __x, shared_ptr<_Tp> const& __y) const + bool operator()( weak_ptr<_Tp> const& __x, shared_ptr<_Tp> const& __y) const _NOEXCEPT {return __x.owner_before(__y);} }; @@ -5136,13 +5223,13 @@ struct _LIBCPP_TEMPLATE_VIS owner_less > { typedef bool result_type; _LIBCPP_INLINE_VISIBILITY - bool operator()( weak_ptr<_Tp> const& __x, weak_ptr<_Tp> const& __y) const + bool operator()( weak_ptr<_Tp> const& __x, weak_ptr<_Tp> const& __y) const _NOEXCEPT {return __x.owner_before(__y);} _LIBCPP_INLINE_VISIBILITY - bool operator()(shared_ptr<_Tp> const& __x, weak_ptr<_Tp> const& __y) const + bool operator()(shared_ptr<_Tp> const& __x, weak_ptr<_Tp> const& __y) const _NOEXCEPT {return __x.owner_before(__y);} _LIBCPP_INLINE_VISIBILITY - bool operator()( weak_ptr<_Tp> const& __x, shared_ptr<_Tp> const& __y) const + bool operator()( weak_ptr<_Tp> const& __x, shared_ptr<_Tp> const& __y) const _NOEXCEPT {return __x.owner_before(__y);} }; @@ -5152,19 +5239,19 @@ struct _LIBCPP_TEMPLATE_VIS owner_less { template _LIBCPP_INLINE_VISIBILITY - bool operator()( shared_ptr<_Tp> const& __x, shared_ptr<_Up> const& __y) const + bool operator()( shared_ptr<_Tp> const& __x, shared_ptr<_Up> const& __y) const _NOEXCEPT {return __x.owner_before(__y);} template _LIBCPP_INLINE_VISIBILITY - bool operator()( shared_ptr<_Tp> const& __x, weak_ptr<_Up> const& __y) const + bool operator()( shared_ptr<_Tp> const& __x, weak_ptr<_Up> const& __y) const _NOEXCEPT {return __x.owner_before(__y);} template _LIBCPP_INLINE_VISIBILITY - bool operator()( weak_ptr<_Tp> const& __x, shared_ptr<_Up> const& __y) const + bool operator()( weak_ptr<_Tp> const& __x, shared_ptr<_Up> const& __y) const _NOEXCEPT {return __x.owner_before(__y);} template _LIBCPP_INLINE_VISIBILITY - bool operator()( weak_ptr<_Tp> const& __x, weak_ptr<_Up> const& __y) const + bool operator()( weak_ptr<_Tp> const& __x, weak_ptr<_Up> const& __y) const _NOEXCEPT {return __x.owner_before(__y);} typedef void is_transparent; }; @@ -5241,7 +5328,8 @@ private: friend _LIBCPP_FUNC_VIS __sp_mut& __get_sp_mut(const void*); }; -_LIBCPP_FUNC_VIS __sp_mut& __get_sp_mut(const void*); +_LIBCPP_FUNC_VIS _LIBCPP_AVAILABILITY_ATOMIC_SHARED_PTR +__sp_mut& __get_sp_mut(const void*); template inline _LIBCPP_INLINE_VISIBILITY @@ -5252,6 +5340,7 @@ atomic_is_lock_free(const shared_ptr<_Tp>*) } template +_LIBCPP_AVAILABILITY_ATOMIC_SHARED_PTR shared_ptr<_Tp> atomic_load(const shared_ptr<_Tp>* __p) { @@ -5264,6 +5353,7 @@ atomic_load(const shared_ptr<_Tp>* __p) template inline _LIBCPP_INLINE_VISIBILITY +_LIBCPP_AVAILABILITY_ATOMIC_SHARED_PTR shared_ptr<_Tp> atomic_load_explicit(const shared_ptr<_Tp>* __p, memory_order) { @@ -5271,6 +5361,7 @@ atomic_load_explicit(const shared_ptr<_Tp>* __p, memory_order) } template +_LIBCPP_AVAILABILITY_ATOMIC_SHARED_PTR void atomic_store(shared_ptr<_Tp>* __p, shared_ptr<_Tp> __r) { @@ -5282,6 +5373,7 @@ atomic_store(shared_ptr<_Tp>* __p, shared_ptr<_Tp> __r) template inline _LIBCPP_INLINE_VISIBILITY +_LIBCPP_AVAILABILITY_ATOMIC_SHARED_PTR void atomic_store_explicit(shared_ptr<_Tp>* __p, shared_ptr<_Tp> __r, memory_order) { @@ -5289,6 +5381,7 @@ atomic_store_explicit(shared_ptr<_Tp>* __p, shared_ptr<_Tp> __r, memory_order) } template +_LIBCPP_AVAILABILITY_ATOMIC_SHARED_PTR shared_ptr<_Tp> atomic_exchange(shared_ptr<_Tp>* __p, shared_ptr<_Tp> __r) { @@ -5301,6 +5394,7 @@ atomic_exchange(shared_ptr<_Tp>* __p, shared_ptr<_Tp> __r) template inline _LIBCPP_INLINE_VISIBILITY +_LIBCPP_AVAILABILITY_ATOMIC_SHARED_PTR shared_ptr<_Tp> atomic_exchange_explicit(shared_ptr<_Tp>* __p, shared_ptr<_Tp> __r, memory_order) { @@ -5308,6 +5402,7 @@ atomic_exchange_explicit(shared_ptr<_Tp>* __p, shared_ptr<_Tp> __r, memory_order } template +_LIBCPP_AVAILABILITY_ATOMIC_SHARED_PTR bool atomic_compare_exchange_strong(shared_ptr<_Tp>* __p, shared_ptr<_Tp>* __v, shared_ptr<_Tp> __w) { @@ -5329,6 +5424,7 @@ atomic_compare_exchange_strong(shared_ptr<_Tp>* __p, shared_ptr<_Tp>* __v, share template inline _LIBCPP_INLINE_VISIBILITY +_LIBCPP_AVAILABILITY_ATOMIC_SHARED_PTR bool atomic_compare_exchange_weak(shared_ptr<_Tp>* __p, shared_ptr<_Tp>* __v, shared_ptr<_Tp> __w) { @@ -5337,6 +5433,7 @@ atomic_compare_exchange_weak(shared_ptr<_Tp>* __p, shared_ptr<_Tp>* __v, shared_ template inline _LIBCPP_INLINE_VISIBILITY +_LIBCPP_AVAILABILITY_ATOMIC_SHARED_PTR bool atomic_compare_exchange_strong_explicit(shared_ptr<_Tp>* __p, shared_ptr<_Tp>* __v, shared_ptr<_Tp> __w, memory_order, memory_order) @@ -5346,6 +5443,7 @@ atomic_compare_exchange_strong_explicit(shared_ptr<_Tp>* __p, shared_ptr<_Tp>* _ template inline _LIBCPP_INLINE_VISIBILITY +_LIBCPP_AVAILABILITY_ATOMIC_SHARED_PTR bool atomic_compare_exchange_weak_explicit(shared_ptr<_Tp>* __p, shared_ptr<_Tp>* __v, shared_ptr<_Tp> __w, memory_order, memory_order) @@ -5478,4 +5576,6 @@ struct __temp_value { _LIBCPP_END_NAMESPACE_STD +_LIBCPP_POP_MACROS + #endif // _LIBCPP_MEMORY diff --git a/include/module.modulemap b/include/module.modulemap index c354cae1e..3194b5c9f 100644 --- a/include/module.modulemap +++ b/include/module.modulemap @@ -484,7 +484,7 @@ module std [system] { module __string { header "__string" export * } module __tree { header "__tree" export * } module __tuple { header "__tuple" export * } - module __undef_min_max { header "__undef_min_max" export * } + module __undef_macros { header "__undef_macros" export * } module experimental { requires cplusplus11 @@ -500,6 +500,11 @@ module std [system] { module chrono { header "experimental/chrono" export * + } + module coroutine { + requires coroutines + header "experimental/coroutine" + export * } module deque { header "experimental/deque" diff --git a/include/mutex b/include/mutex index 11b0f7e52..553808820 100644 --- a/include/mutex +++ b/include/mutex @@ -109,15 +109,17 @@ public: lock_guard& operator=(lock_guard const&) = delete; }; -template // Variadic lock_guard only provided in ABI V2. -class lock_guard +template +class scoped_lock // C++17 { public: - explicit lock_guard(MutexTypes&... m); - lock_guard(MutexTypes&... m, adopt_lock_t); - ~lock_guard(); - lock_guard(lock_guard const&) = delete; - lock_guard& operator=(lock_guard const&) = delete; + using mutex_type = Mutex; // If MutexTypes... consists of the single type Mutex + + explicit scoped_lock(MutexTypes&... m); + scoped_lock(MutexTypes&... m, adopt_lock_t); + ~scoped_lock(); + scoped_lock(scoped_lock const&) = delete; + scoped_lock& operator=(scoped_lock const&) = delete; private: tuple pm; // exposition only }; @@ -189,17 +191,19 @@ template #include <__mutex_base> #include #include -#ifndef _LIBCPP_HAS_NO_VARIADICS +#ifndef _LIBCPP_CXX03_LANG #include #endif #include <__threading_support> -#include <__undef_min_max> - #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) #pragma GCC system_header #endif +_LIBCPP_PUSH_MACROS +#include <__undef_macros> + + _LIBCPP_BEGIN_NAMESPACE_STD #ifndef _LIBCPP_HAS_NO_THREADS @@ -341,7 +345,7 @@ try_lock(_L0& __l0, _L1& __l1) return 0; } -#ifndef _LIBCPP_HAS_NO_VARIADICS +#ifndef _LIBCPP_CXX03_LANG template int @@ -360,7 +364,7 @@ try_lock(_L0& __l0, _L1& __l1, _L2& __l2, _L3&... __l3) return __r; } -#endif // _LIBCPP_HAS_NO_VARIADICS +#endif // _LIBCPP_CXX03_LANG template void @@ -389,7 +393,7 @@ lock(_L0& __l0, _L1& __l1) } } -#ifndef _LIBCPP_HAS_NO_VARIADICS +#ifndef _LIBCPP_CXX03_LANG template void @@ -464,19 +468,97 @@ void __unlock(_L0& __l0, _L1& __l1, _L2& __l2, _L3&... __l3) { _VSTD::__unlock(__l2, __l3...); } -#endif // _LIBCPP_HAS_NO_VARIADICS +#endif // _LIBCPP_CXX03_LANG +#if _LIBCPP_STD_VER > 14 +template +class _LIBCPP_TEMPLATE_VIS scoped_lock; + +template <> +class _LIBCPP_TEMPLATE_VIS scoped_lock<> { +public: + explicit scoped_lock() {} + ~scoped_lock() = default; + + _LIBCPP_INLINE_VISIBILITY + explicit scoped_lock(adopt_lock_t) {} + + scoped_lock(scoped_lock const&) = delete; + scoped_lock& operator=(scoped_lock const&) = delete; +}; + +template +class _LIBCPP_TEMPLATE_VIS scoped_lock<_Mutex> { +public: + typedef _Mutex mutex_type; +private: + mutex_type& __m_; +public: + explicit scoped_lock(mutex_type & __m) _LIBCPP_THREAD_SAFETY_ANNOTATION(acquire_capability(__m)) + : __m_(__m) {__m_.lock();} + + ~scoped_lock() _LIBCPP_THREAD_SAFETY_ANNOTATION(release_capability()) {__m_.unlock();} + + _LIBCPP_INLINE_VISIBILITY + explicit scoped_lock(mutex_type& __m, adopt_lock_t) _LIBCPP_THREAD_SAFETY_ANNOTATION(requires_capability(__m)) + : __m_(__m) {} + + + scoped_lock(scoped_lock const&) = delete; + scoped_lock& operator=(scoped_lock const&) = delete; +}; + +template +class _LIBCPP_TEMPLATE_VIS scoped_lock +{ + static_assert(sizeof...(_MArgs) > 1, "At least 2 lock types required"); + typedef tuple<_MArgs&...> _MutexTuple; + +public: + _LIBCPP_INLINE_VISIBILITY + explicit scoped_lock(_MArgs&... __margs) + : __t_(__margs...) + { + _VSTD::lock(__margs...); + } + + _LIBCPP_INLINE_VISIBILITY + scoped_lock(_MArgs&... __margs, adopt_lock_t) + : __t_(__margs...) + { + } + + _LIBCPP_INLINE_VISIBILITY + ~scoped_lock() { + typedef typename __make_tuple_indices::type _Indices; + __unlock_unpack(_Indices{}, __t_); + } + + scoped_lock(scoped_lock const&) = delete; + scoped_lock& operator=(scoped_lock const&) = delete; + +private: + template + _LIBCPP_INLINE_VISIBILITY + static void __unlock_unpack(__tuple_indices<_Indx...>, _MutexTuple& __mt) { + _VSTD::__unlock(_VSTD::get<_Indx>(__mt)...); + } + + _MutexTuple __t_; +}; + +#endif // _LIBCPP_STD_VER > 14 #endif // !_LIBCPP_HAS_NO_THREADS struct _LIBCPP_TEMPLATE_VIS once_flag; -#ifndef _LIBCPP_HAS_NO_VARIADICS +#ifndef _LIBCPP_CXX03_LANG template _LIBCPP_INLINE_VISIBILITY void call_once(once_flag&, _Callable&&, _Args&&...); -#else // _LIBCPP_HAS_NO_VARIADICS +#else // _LIBCPP_CXX03_LANG template _LIBCPP_INLINE_VISIBILITY @@ -486,7 +568,7 @@ template _LIBCPP_INLINE_VISIBILITY void call_once(once_flag&, const _Callable&); -#endif // _LIBCPP_HAS_NO_VARIADICS +#endif // _LIBCPP_CXX03_LANG struct _LIBCPP_TEMPLATE_VIS once_flag { @@ -500,11 +582,11 @@ private: unsigned long __state_; -#ifndef _LIBCPP_HAS_NO_VARIADICS +#ifndef _LIBCPP_CXX03_LANG template friend void call_once(once_flag&, _Callable&&, _Args&&...); -#else // _LIBCPP_HAS_NO_VARIADICS +#else // _LIBCPP_CXX03_LANG template friend void call_once(once_flag&, _Callable&); @@ -512,10 +594,10 @@ private: template friend void call_once(once_flag&, const _Callable&); -#endif // _LIBCPP_HAS_NO_VARIADICS +#endif // _LIBCPP_CXX03_LANG }; -#ifndef _LIBCPP_HAS_NO_VARIADICS +#ifndef _LIBCPP_CXX03_LANG template class __call_once_param @@ -570,7 +652,7 @@ __call_once_proxy(void* __vp) _LIBCPP_FUNC_VIS void __call_once(volatile unsigned long&, void*, void(*)(void*)); -#ifndef _LIBCPP_HAS_NO_VARIADICS +#ifndef _LIBCPP_CXX03_LANG template inline _LIBCPP_INLINE_VISIBILITY @@ -586,7 +668,7 @@ call_once(once_flag& __flag, _Callable&& __func, _Args&&... __args) } } -#else // _LIBCPP_HAS_NO_VARIADICS +#else // _LIBCPP_CXX03_LANG template inline _LIBCPP_INLINE_VISIBILITY @@ -605,72 +687,17 @@ inline _LIBCPP_INLINE_VISIBILITY void call_once(once_flag& __flag, const _Callable& __func) { - if (__flag.__state_ != ~0ul) + if (__libcpp_acquire_load(&__flag.__state_) != ~0ul) { __call_once_param __p(__func); __call_once(__flag.__state_, &__p, &__call_once_proxy); } } -#endif // _LIBCPP_HAS_NO_VARIADICS - - -#if defined(_LIBCPP_ABI_VARIADIC_LOCK_GUARD) \ - && !defined(_LIBCPP_CXX03_LANG) -template <> -class _LIBCPP_TEMPLATE_VIS lock_guard<> { -public: - explicit lock_guard() {} - ~lock_guard() = default; - - _LIBCPP_INLINE_VISIBILITY - explicit lock_guard(adopt_lock_t) {} - - lock_guard(lock_guard const&) = delete; - lock_guard& operator=(lock_guard const&) = delete; -}; - -template -class _LIBCPP_TEMPLATE_VIS lock_guard -{ - static_assert(sizeof...(_MArgs) >= 2, "At least 2 lock types required"); - typedef tuple<_MArgs&...> _MutexTuple; - -public: - _LIBCPP_INLINE_VISIBILITY - explicit lock_guard(_MArgs&... __margs) - : __t_(__margs...) - { - _VSTD::lock(__margs...); - } - - _LIBCPP_INLINE_VISIBILITY - lock_guard(_MArgs&... __margs, adopt_lock_t) - : __t_(__margs...) - { - } - - _LIBCPP_INLINE_VISIBILITY - ~lock_guard() { - typedef typename __make_tuple_indices::type _Indices; - __unlock_unpack(_Indices{}, __t_); - } - - lock_guard(lock_guard const&) = delete; - lock_guard& operator=(lock_guard const&) = delete; - -private: - template - _LIBCPP_INLINE_VISIBILITY - static void __unlock_unpack(__tuple_indices<_Indx...>, _MutexTuple& __mt) { - _VSTD::__unlock(_VSTD::get<_Indx>(__mt)...); - } - - _MutexTuple __t_; -}; - -#endif // _LIBCPP_ABI_VARIADIC_LOCK_GUARD +#endif // _LIBCPP_CXX03_LANG _LIBCPP_END_NAMESPACE_STD +_LIBCPP_POP_MACROS + #endif // _LIBCPP_MUTEX diff --git a/include/new b/include/new index c0e7b2daf..34df2efee 100644 --- a/include/new +++ b/include/new @@ -146,9 +146,8 @@ _LIBCPP_NORETURN _LIBCPP_FUNC_VIS void __throw_bad_alloc(); // not in C++ spec #if defined(_LIBCPP_BUILDING_LIBRARY) || (_LIBCPP_STD_VER > 11) -class _LIBCPP_EXCEPTION_ABI bad_array_length - : public bad_alloc -{ +class _LIBCPP_EXCEPTION_ABI _LIBCPP_AVAILABILITY_BAD_ARRAY_LENGTH + bad_array_length : public bad_alloc { public: bad_array_length() _NOEXCEPT; virtual ~bad_array_length() _NOEXCEPT; @@ -182,7 +181,7 @@ _LIBCPP_OVERRIDABLE_FUNC_VIS void* operator new(std::size_t __sz, const std::not _LIBCPP_OVERRIDABLE_FUNC_VIS void operator delete(void* __p) _NOEXCEPT; _LIBCPP_OVERRIDABLE_FUNC_VIS void operator delete(void* __p, const std::nothrow_t&) _NOEXCEPT; #ifndef _LIBCPP_HAS_NO_SIZED_DEALLOCATION -_LIBCPP_OVERRIDABLE_FUNC_VIS void operator delete(void* __p, std::size_t __sz) _NOEXCEPT; +_LIBCPP_OVERRIDABLE_FUNC_VIS _LIBCPP_AVAILABILITY_SIZED_NEW_DELETE void operator delete(void* __p, std::size_t __sz) _NOEXCEPT; #endif _LIBCPP_OVERRIDABLE_FUNC_VIS void* operator new[](std::size_t __sz) _THROW_BAD_ALLOC; @@ -190,7 +189,7 @@ _LIBCPP_OVERRIDABLE_FUNC_VIS void* operator new[](std::size_t __sz, const std::n _LIBCPP_OVERRIDABLE_FUNC_VIS void operator delete[](void* __p) _NOEXCEPT; _LIBCPP_OVERRIDABLE_FUNC_VIS void operator delete[](void* __p, const std::nothrow_t&) _NOEXCEPT; #ifndef _LIBCPP_HAS_NO_SIZED_DEALLOCATION -_LIBCPP_OVERRIDABLE_FUNC_VIS void operator delete[](void* __p, std::size_t __sz) _NOEXCEPT; +_LIBCPP_OVERRIDABLE_FUNC_VIS _LIBCPP_AVAILABILITY_SIZED_NEW_DELETE void operator delete[](void* __p, std::size_t __sz) _NOEXCEPT; #endif #ifndef _LIBCPP_HAS_NO_ALIGNED_ALLOCATION @@ -199,7 +198,7 @@ _LIBCPP_OVERRIDABLE_FUNC_VIS void* operator new(std::size_t __sz, std::align_val _LIBCPP_OVERRIDABLE_FUNC_VIS void operator delete(void* __p, std::align_val_t) _NOEXCEPT; _LIBCPP_OVERRIDABLE_FUNC_VIS void operator delete(void* __p, std::align_val_t, const std::nothrow_t&) _NOEXCEPT; #ifndef _LIBCPP_HAS_NO_SIZED_DEALLOCATION -_LIBCPP_OVERRIDABLE_FUNC_VIS void operator delete(void* __p, std::size_t __sz, std::align_val_t) _NOEXCEPT; +_LIBCPP_OVERRIDABLE_FUNC_VIS _LIBCPP_AVAILABILITY_SIZED_NEW_DELETE void operator delete(void* __p, std::size_t __sz, std::align_val_t) _NOEXCEPT; #endif _LIBCPP_OVERRIDABLE_FUNC_VIS void* operator new[](std::size_t __sz, std::align_val_t) _THROW_BAD_ALLOC; @@ -207,7 +206,7 @@ _LIBCPP_OVERRIDABLE_FUNC_VIS void* operator new[](std::size_t __sz, std::align_v _LIBCPP_OVERRIDABLE_FUNC_VIS void operator delete[](void* __p, std::align_val_t) _NOEXCEPT; _LIBCPP_OVERRIDABLE_FUNC_VIS void operator delete[](void* __p, std::align_val_t, const std::nothrow_t&) _NOEXCEPT; #ifndef _LIBCPP_HAS_NO_SIZED_DEALLOCATION -_LIBCPP_OVERRIDABLE_FUNC_VIS void operator delete[](void* __p, std::size_t __sz, std::align_val_t) _NOEXCEPT; +_LIBCPP_OVERRIDABLE_FUNC_VIS _LIBCPP_AVAILABILITY_SIZED_NEW_DELETE void operator delete[](void* __p, std::size_t __sz, std::align_val_t) _NOEXCEPT; #endif #endif @@ -238,6 +237,9 @@ inline _LIBCPP_INLINE_VISIBILITY void __libcpp_deallocate(void *__ptr) { #ifdef _LIBCPP_BAD_ARRAY_LENGTH_DEFINED _LIBCPP_NORETURN inline _LIBCPP_ALWAYS_INLINE +#ifndef _LIBCPP_NO_EXCEPTIONS +_LIBCPP_AVAILABILITY_BAD_ARRAY_LENGTH +#endif void __throw_bad_array_length() { #ifndef _LIBCPP_NO_EXCEPTIONS diff --git a/include/numeric b/include/numeric index 8f2514693..0e53ba33c 100644 --- a/include/numeric +++ b/include/numeric @@ -71,6 +71,9 @@ template #pragma GCC system_header #endif +_LIBCPP_PUSH_MACROS +#include <__undef_macros> + _LIBCPP_BEGIN_NAMESPACE_STD template @@ -222,11 +225,11 @@ struct __abs<_Result, _Source, false> { template -_LIBCPP_CONSTEXPR _LIBCPP_INLINE_VISIBILITY +_LIBCPP_CONSTEXPR _LIBCPP_HIDDEN _Tp __gcd(_Tp __m, _Tp __n) { static_assert((!is_signed<_Tp>::value), ""); - return __n == 0 ? __m : __gcd<_Tp>(__n, __m % __n); + return __n == 0 ? __m : _VSTD::__gcd<_Tp>(__n, __m % __n); } @@ -240,8 +243,9 @@ gcd(_Tp __m, _Up __n) static_assert((!is_same::type, bool>::value), "Second argument to gcd cannot be bool" ); using _Rp = common_type_t<_Tp,_Up>; using _Wp = make_unsigned_t<_Rp>; - return static_cast<_Rp>(__gcd(static_cast<_Wp>(__abs<_Rp, _Tp>()(__m)), - static_cast<_Wp>(__abs<_Rp, _Up>()(__n)))); + return static_cast<_Rp>(_VSTD::__gcd( + static_cast<_Wp>(__abs<_Rp, _Tp>()(__m)), + static_cast<_Wp>(__abs<_Rp, _Up>()(__n)))); } template @@ -256,7 +260,7 @@ lcm(_Tp __m, _Up __n) return 0; using _Rp = common_type_t<_Tp,_Up>; - _Rp __val1 = __abs<_Rp, _Tp>()(__m) / gcd(__m, __n); + _Rp __val1 = __abs<_Rp, _Tp>()(__m) / _VSTD::gcd(__m, __n); _Rp __val2 = __abs<_Rp, _Up>()(__n); _LIBCPP_ASSERT((numeric_limits<_Rp>::max() / __val1 > __val2), "Overflow in lcm"); return __val1 * __val2; @@ -266,4 +270,6 @@ lcm(_Tp __m, _Up __n) _LIBCPP_END_NAMESPACE_STD +_LIBCPP_POP_MACROS + #endif // _LIBCPP_NUMERIC diff --git a/include/optional b/include/optional index 180f63ffc..c0fd0e7bc 100644 --- a/include/optional +++ b/include/optional @@ -17,29 +17,31 @@ // C++1z namespace std { - // 20.6.3, optional for object types + // 23.6.3, optional for object types template class optional; - // 20.6.4, no-value state indicator + // 23.6.4, no-value state indicator struct nullopt_t{see below }; constexpr nullopt_t nullopt(unspecified ); - // 20.6.5, class bad_optional_access + // 23.6.5, class bad_optional_access class bad_optional_access; - // 20.6.6, relational operators - template - constexpr bool operator==(const optional&, const optional&); - template - constexpr bool operator!=(const optional&, const optional&); - template - constexpr bool operator<(const optional&, const optional&); - template - constexpr bool operator>(const optional&, const optional&); - template - constexpr bool operator<=(const optional&, const optional&); - template - constexpr bool operator>=(const optional&, const optional&); + // 23.6.6, relational operators + template + constexpr bool operator==(const optional&, const optional&); + template + constexpr bool operator!=(const optional&, const optional&); + template + constexpr bool operator<(const optional&, const optional&); + template + constexpr bool operator>(const optional&, const optional&); + template + constexpr bool operator<=(const optional&, const optional&); + template + constexpr bool operator>=(const optional&, const optional&); + + // 23.6.7 comparison with nullopt template constexpr bool operator==(const optional&, nullopt_t) noexcept; template constexpr bool operator==(nullopt_t, const optional&) noexcept; template constexpr bool operator!=(const optional&, nullopt_t) noexcept; @@ -53,21 +55,21 @@ namespace std { template constexpr bool operator>=(const optional&, nullopt_t) noexcept; template constexpr bool operator>=(nullopt_t, const optional&) noexcept; - // 20.6.8, comparison with T - template constexpr bool operator==(const optional&, const T&); - template constexpr bool operator==(const T&, const optional&); - template constexpr bool operator!=(const optional&, const T&); - template constexpr bool operator!=(const T&, const optional&); - template constexpr bool operator<(const optional&, const T&); - template constexpr bool operator<(const T&, const optional&); - template constexpr bool operator<=(const optional&, const T&); - template constexpr bool operator<=(const T&, const optional&); - template constexpr bool operator>(const optional&, const T&); - template constexpr bool operator>(const T&, const optional&); - template constexpr bool operator>=(const optional&, const T&); - template constexpr bool operator>=(const T&, const optional&); + // 23.6.8, comparison with T + template constexpr bool operator==(const optional&, const U&); + template constexpr bool operator==(const U&, const optional&); + template constexpr bool operator!=(const optional&, const U&); + template constexpr bool operator!=(const U&, const optional&); + template constexpr bool operator<(const optional&, const U&); + template constexpr bool operator<(const U&, const optional&); + template constexpr bool operator<=(const optional&, const U&); + template constexpr bool operator<=(const U&, const optional&); + template constexpr bool operator>(const optional&, const U&); + template constexpr bool operator>(const U&, const optional&); + template constexpr bool operator>=(const optional&, const U&); + template constexpr bool operator>=(const U&, const optional&); - // 20.6.9, specialized algorithms + // 23.6.9, specialized algorithms template void swap(optional&, optional&) noexcept(see below ); template constexpr optional make_optional(T&&); template @@ -75,7 +77,7 @@ namespace std { template constexpr optional make_optional(initializer_list il, Args&&... args); - // 20.6.10, hash support + // 23.6.10, hash support template struct hash; template struct hash>; @@ -83,11 +85,11 @@ namespace std { public: using value_type = T; - // 20.6.3.1, constructors + // 23.6.3.1, constructors constexpr optional() noexcept; constexpr optional(nullopt_t) noexcept; optional(const optional &); - optional(optional &&) noexcept(see below ); + optional(optional &&) noexcept(see below); template constexpr explicit optional(in_place_t, Args &&...); template constexpr explicit optional(in_place_t, initializer_list, Args &&...); @@ -98,24 +100,24 @@ namespace std { template constexpr EXPLICIT optional(optional &&); - // 20.6.3.2, destructor + // 23.6.3.2, destructor ~optional(); - // 20.6.3.3, assignment + // 23.6.3.3, assignment optional &operator=(nullopt_t) noexcept; optional &operator=(const optional &); optional &operator=(optional &&) noexcept(see below ); template optional &operator=(U &&); template optional &operator=(const optional &); template optional &operator=(optional &&); - template void emplace(Args &&...); + template T& emplace(Args &&...); template - void emplace(initializer_list, Args &&...); + T& emplace(initializer_list, Args &&...); - // 20.6.3.4, swap + // 23.6.3.4, swap void swap(optional &) noexcept(see below ); - // 20.6.3.5, observers + // 23.6.3.5, observers constexpr T const *operator->() const; constexpr T *operator->(); constexpr T const &operator*() const &; @@ -131,7 +133,7 @@ namespace std { template constexpr T value_or(U &&) const &; template constexpr T value_or(U &&) &&; - // 20.6.3.6, modifiers + // 23.6.3.6, modifiers void reset() noexcept; private: @@ -144,7 +146,6 @@ namespace std { #include <__config> #include <__debug> #include <__functional_base> -#include <__undef_min_max> #include #include #include @@ -156,6 +157,10 @@ namespace std { #pragma GCC system_header #endif +_LIBCPP_PUSH_MACROS +#include <__undef_macros> + + namespace std // purposefully not using versioning namespace { @@ -531,7 +536,7 @@ private: }; template using _CheckOptionalArgsCtor = conditional_t< - !is_same_v && + !is_same_v, in_place_t> && !is_same_v, optional>, _CheckOptionalArgsConstructor, __check_tuple_constructor_fail @@ -597,8 +602,8 @@ private: public: _LIBCPP_INLINE_VISIBILITY constexpr optional() noexcept {} - _LIBCPP_INLINE_VISIBILITY optional(const optional&) = default; - _LIBCPP_INLINE_VISIBILITY optional(optional&&) = default; + _LIBCPP_INLINE_VISIBILITY constexpr optional(const optional&) = default; + _LIBCPP_INLINE_VISIBILITY constexpr optional(optional&&) = default; _LIBCPP_INLINE_VISIBILITY constexpr optional(nullopt_t) noexcept {} template > _LIBCPP_INLINE_VISIBILITY - void + _Tp & emplace(_Args&&... __args) { reset(); this->__construct(_VSTD::forward<_Args>(__args)...); + return this->__get(); } template > _LIBCPP_INLINE_VISIBILITY - void + _Tp & emplace(initializer_list<_Up> __il, _Args&&... __args) { reset(); this->__construct(__il, _VSTD::forward<_Args>(__args)...); + return this->__get(); } _LIBCPP_INLINE_VISIBILITY @@ -890,7 +897,7 @@ public: template _LIBCPP_INLINE_VISIBILITY - value_type value_or(_Up&& __v) && + constexpr value_type value_or(_Up&& __v) && { static_assert(is_move_constructible_v, "optional::value_or: T must be move constructible"); @@ -921,14 +928,14 @@ private: }; // Comparisons between optionals -template +template _LIBCPP_INLINE_VISIBILITY constexpr enable_if_t< is_convertible_v() == - _VSTD::declval()), bool>, + _VSTD::declval()), bool>, bool > -operator==(const optional<_Tp>& __x, const optional<_Tp>& __y) +operator==(const optional<_Tp>& __x, const optional<_Up>& __y) { if (static_cast(__x) != static_cast(__y)) return false; @@ -937,14 +944,14 @@ operator==(const optional<_Tp>& __x, const optional<_Tp>& __y) return *__x == *__y; } -template +template _LIBCPP_INLINE_VISIBILITY constexpr enable_if_t< is_convertible_v() != - _VSTD::declval()), bool>, + _VSTD::declval()), bool>, bool > -operator!=(const optional<_Tp>& __x, const optional<_Tp>& __y) +operator!=(const optional<_Tp>& __x, const optional<_Up>& __y) { if (static_cast(__x) != static_cast(__y)) return true; @@ -953,14 +960,14 @@ operator!=(const optional<_Tp>& __x, const optional<_Tp>& __y) return *__x != *__y; } -template +template _LIBCPP_INLINE_VISIBILITY constexpr enable_if_t< is_convertible_v() < - _VSTD::declval()), bool>, + _VSTD::declval()), bool>, bool > -operator<(const optional<_Tp>& __x, const optional<_Tp>& __y) +operator<(const optional<_Tp>& __x, const optional<_Up>& __y) { if (!static_cast(__y)) return false; @@ -969,14 +976,14 @@ operator<(const optional<_Tp>& __x, const optional<_Tp>& __y) return *__x < *__y; } -template +template _LIBCPP_INLINE_VISIBILITY constexpr enable_if_t< is_convertible_v() > - _VSTD::declval()), bool>, + _VSTD::declval()), bool>, bool > -operator>(const optional<_Tp>& __x, const optional<_Tp>& __y) +operator>(const optional<_Tp>& __x, const optional<_Up>& __y) { if (!static_cast(__x)) return false; @@ -985,14 +992,14 @@ operator>(const optional<_Tp>& __x, const optional<_Tp>& __y) return *__x > *__y; } -template +template _LIBCPP_INLINE_VISIBILITY constexpr enable_if_t< is_convertible_v() <= - _VSTD::declval()), bool>, + _VSTD::declval()), bool>, bool > -operator<=(const optional<_Tp>& __x, const optional<_Tp>& __y) +operator<=(const optional<_Tp>& __x, const optional<_Up>& __y) { if (!static_cast(__x)) return true; @@ -1001,14 +1008,14 @@ operator<=(const optional<_Tp>& __x, const optional<_Tp>& __y) return *__x <= *__y; } -template +template _LIBCPP_INLINE_VISIBILITY constexpr enable_if_t< is_convertible_v() >= - _VSTD::declval()), bool>, + _VSTD::declval()), bool>, bool > -operator>=(const optional<_Tp>& __x, const optional<_Tp>& __y) +operator>=(const optional<_Tp>& __x, const optional<_Up>& __y) { if (!static_cast(__y)) return true; @@ -1115,146 +1122,146 @@ operator>=(nullopt_t, const optional<_Tp>& __x) noexcept } // Comparisons with T -template +template _LIBCPP_INLINE_VISIBILITY constexpr enable_if_t< is_convertible_v() == - _VSTD::declval()), bool>, + _VSTD::declval()), bool>, bool > -operator==(const optional<_Tp>& __x, const _Tp& __v) +operator==(const optional<_Tp>& __x, const _Up& __v) { return static_cast(__x) ? *__x == __v : false; } -template +template _LIBCPP_INLINE_VISIBILITY constexpr enable_if_t< is_convertible_v() == - _VSTD::declval()), bool>, + _VSTD::declval()), bool>, bool > -operator==(const _Tp& __v, const optional<_Tp>& __x) +operator==(const _Tp& __v, const optional<_Up>& __x) { return static_cast(__x) ? __v == *__x : false; } -template +template _LIBCPP_INLINE_VISIBILITY constexpr enable_if_t< is_convertible_v() != - _VSTD::declval()), bool>, + _VSTD::declval()), bool>, bool > -operator!=(const optional<_Tp>& __x, const _Tp& __v) +operator!=(const optional<_Tp>& __x, const _Up& __v) { return static_cast(__x) ? *__x != __v : true; } -template +template _LIBCPP_INLINE_VISIBILITY constexpr enable_if_t< is_convertible_v() != - _VSTD::declval()), bool>, + _VSTD::declval()), bool>, bool > -operator!=(const _Tp& __v, const optional<_Tp>& __x) +operator!=(const _Tp& __v, const optional<_Up>& __x) { return static_cast(__x) ? __v != *__x : true; } -template +template _LIBCPP_INLINE_VISIBILITY constexpr enable_if_t< is_convertible_v() < - _VSTD::declval()), bool>, + _VSTD::declval()), bool>, bool > -operator<(const optional<_Tp>& __x, const _Tp& __v) +operator<(const optional<_Tp>& __x, const _Up& __v) { return static_cast(__x) ? *__x < __v : true; } -template +template _LIBCPP_INLINE_VISIBILITY constexpr enable_if_t< is_convertible_v() < - _VSTD::declval()), bool>, + _VSTD::declval()), bool>, bool > -operator<(const _Tp& __v, const optional<_Tp>& __x) +operator<(const _Tp& __v, const optional<_Up>& __x) { return static_cast(__x) ? __v < *__x : false; } -template +template _LIBCPP_INLINE_VISIBILITY constexpr enable_if_t< is_convertible_v() <= - _VSTD::declval()), bool>, + _VSTD::declval()), bool>, bool > -operator<=(const optional<_Tp>& __x, const _Tp& __v) +operator<=(const optional<_Tp>& __x, const _Up& __v) { return static_cast(__x) ? *__x <= __v : true; } -template +template _LIBCPP_INLINE_VISIBILITY constexpr enable_if_t< is_convertible_v() <= - _VSTD::declval()), bool>, + _VSTD::declval()), bool>, bool > -operator<=(const _Tp& __v, const optional<_Tp>& __x) +operator<=(const _Tp& __v, const optional<_Up>& __x) { return static_cast(__x) ? __v <= *__x : false; } -template +template _LIBCPP_INLINE_VISIBILITY constexpr enable_if_t< is_convertible_v() > - _VSTD::declval()), bool>, + _VSTD::declval()), bool>, bool > -operator>(const optional<_Tp>& __x, const _Tp& __v) +operator>(const optional<_Tp>& __x, const _Up& __v) { return static_cast(__x) ? *__x > __v : false; } -template +template _LIBCPP_INLINE_VISIBILITY constexpr enable_if_t< is_convertible_v() > - _VSTD::declval()), bool>, + _VSTD::declval()), bool>, bool > -operator>(const _Tp& __v, const optional<_Tp>& __x) +operator>(const _Tp& __v, const optional<_Up>& __x) { return static_cast(__x) ? __v > *__x : true; } -template +template _LIBCPP_INLINE_VISIBILITY constexpr enable_if_t< is_convertible_v() >= - _VSTD::declval()), bool>, + _VSTD::declval()), bool>, bool > -operator>=(const optional<_Tp>& __x, const _Tp& __v) +operator>=(const optional<_Tp>& __x, const _Up& __v) { return static_cast(__x) ? *__x >= __v : false; } -template +template _LIBCPP_INLINE_VISIBILITY constexpr enable_if_t< is_convertible_v() >= - _VSTD::declval()), bool>, + _VSTD::declval()), bool>, bool > -operator>=(const _Tp& __v, const optional<_Tp>& __x) +operator>=(const _Tp& __v, const optional<_Up>& __x) { return static_cast(__x) ? __v >= *__x : true; } @@ -1301,7 +1308,7 @@ struct _LIBCPP_TEMPLATE_VIS hash< typedef size_t result_type; _LIBCPP_INLINE_VISIBILITY - result_type operator()(const argument_type& __opt) const _NOEXCEPT + result_type operator()(const argument_type& __opt) const { return static_cast(__opt) ? hash>()(*__opt) : 0; } @@ -1311,4 +1318,6 @@ _LIBCPP_END_NAMESPACE_STD #endif // _LIBCPP_STD_VER > 14 +_LIBCPP_POP_MACROS + #endif // _LIBCPP_OPTIONAL diff --git a/include/ostream b/include/ostream index 3d9be8b7a..9bf8d3cdc 100644 --- a/include/ostream +++ b/include/ostream @@ -165,13 +165,11 @@ public: { this->init(__sb); } virtual ~basic_ostream(); protected: -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES +#ifndef _LIBCPP_CXX03_LANG inline _LIBCPP_INLINE_VISIBILITY basic_ostream(basic_ostream&& __rhs); -#endif // 27.7.2.3 Assign/swap -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES inline _LIBCPP_INLINE_VISIBILITY basic_ostream& operator=(basic_ostream&& __rhs); #endif @@ -290,7 +288,7 @@ basic_ostream<_CharT, _Traits>::sentry::~sentry() } } -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES +#ifndef _LIBCPP_CXX03_LANG template basic_ostream<_CharT, _Traits>::basic_ostream(basic_ostream&& __rhs) @@ -306,7 +304,7 @@ basic_ostream<_CharT, _Traits>::operator=(basic_ostream&& __rhs) return *this; } -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES +#endif // _LIBCPP_CXX03_LANG template basic_ostream<_CharT, _Traits>::~basic_ostream() @@ -1023,7 +1021,7 @@ flush(basic_ostream<_CharT, _Traits>& __os) return __os; } -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES +#ifndef _LIBCPP_CXX03_LANG template inline _LIBCPP_INLINE_VISIBILITY @@ -1039,7 +1037,7 @@ operator<<(_Stream&& __os, const _Tp& __x) return _VSTD::move(__os); } -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES +#endif // _LIBCPP_CXX03_LANG template basic_ostream<_CharT, _Traits>& @@ -1082,8 +1080,10 @@ operator<<(basic_ostream<_CharT, _Traits>& __os, const bitset<_Size>& __x) use_facet >(__os.getloc()).widen('1')); } +#ifndef _LIBCPP_AVAILABILITY_NO_STREAMS_EXTERN_TEMPLATE _LIBCPP_EXTERN_TEMPLATE(class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS basic_ostream) _LIBCPP_EXTERN_TEMPLATE(class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS basic_ostream) +#endif _LIBCPP_END_NAMESPACE_STD diff --git a/include/queue b/include/queue index 57d420c74..feaae8920 100644 --- a/include/queue +++ b/include/queue @@ -213,29 +213,27 @@ public: _LIBCPP_INLINE_VISIBILITY queue(const queue& __q) : c(__q.c) {} -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES + _LIBCPP_INLINE_VISIBILITY + queue& operator=(const queue& __q) {c = __q.c; return *this;} + +#ifndef _LIBCPP_CXX03_LANG _LIBCPP_INLINE_VISIBILITY queue(queue&& __q) _NOEXCEPT_(is_nothrow_move_constructible::value) : c(_VSTD::move(__q.c)) {} -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES - _LIBCPP_INLINE_VISIBILITY - queue& operator=(const queue& __q) {c = __q.c; return *this;} - -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES _LIBCPP_INLINE_VISIBILITY queue& operator=(queue&& __q) _NOEXCEPT_(is_nothrow_move_assignable::value) {c = _VSTD::move(__q.c); return *this;} -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES +#endif // _LIBCPP_CXX03_LANG _LIBCPP_INLINE_VISIBILITY explicit queue(const container_type& __c) : c(__c) {} -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES +#ifndef _LIBCPP_CXX03_LANG _LIBCPP_INLINE_VISIBILITY explicit queue(container_type&& __c) : c(_VSTD::move(__c)) {} -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES +#endif // _LIBCPP_CXX03_LANG template _LIBCPP_INLINE_VISIBILITY explicit queue(const _Alloc& __a, @@ -254,7 +252,7 @@ public: typename enable_if::value>::type* = 0) : c(__c, __a) {} -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES +#ifndef _LIBCPP_CXX03_LANG template _LIBCPP_INLINE_VISIBILITY queue(container_type&& __c, const _Alloc& __a, @@ -268,7 +266,7 @@ public: _Alloc>::value>::type* = 0) : c(_VSTD::move(__q.c), __a) {} -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES +#endif // _LIBCPP_CXX03_LANG _LIBCPP_INLINE_VISIBILITY bool empty() const {return c.empty();} @@ -286,10 +284,9 @@ public: _LIBCPP_INLINE_VISIBILITY void push(const value_type& __v) {c.push_back(__v);} -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES +#ifndef _LIBCPP_CXX03_LANG _LIBCPP_INLINE_VISIBILITY void push(value_type&& __v) {c.push_back(_VSTD::move(__v));} -#ifndef _LIBCPP_HAS_NO_VARIADICS template _LIBCPP_INLINE_VISIBILITY #if _LIBCPP_STD_VER > 14 @@ -299,8 +296,7 @@ public: void emplace(_Args&&... __args) { c.emplace_back(_VSTD::forward<_Args>(__args)...);} #endif -#endif // _LIBCPP_HAS_NO_VARIADICS -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES +#endif // _LIBCPP_CXX03_LANG _LIBCPP_INLINE_VISIBILITY void pop() {c.pop_front();} @@ -418,32 +414,30 @@ public: _LIBCPP_INLINE_VISIBILITY priority_queue(const priority_queue& __q) : c(__q.c), comp(__q.comp) {} -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES + _LIBCPP_INLINE_VISIBILITY + priority_queue& operator=(const priority_queue& __q) + {c = __q.c; comp = __q.comp; return *this;} + +#ifndef _LIBCPP_CXX03_LANG _LIBCPP_INLINE_VISIBILITY priority_queue(priority_queue&& __q) _NOEXCEPT_(is_nothrow_move_constructible::value && is_nothrow_move_constructible::value) : c(_VSTD::move(__q.c)), comp(_VSTD::move(__q.comp)) {} -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES - _LIBCPP_INLINE_VISIBILITY - priority_queue& operator=(const priority_queue& __q) - {c = __q.c; comp = __q.comp; return *this;} - -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES _LIBCPP_INLINE_VISIBILITY priority_queue& operator=(priority_queue&& __q) _NOEXCEPT_(is_nothrow_move_assignable::value && is_nothrow_move_assignable::value) {c = _VSTD::move(__q.c); comp = _VSTD::move(__q.comp); return *this;} -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES +#endif // _LIBCPP_CXX03_LANG _LIBCPP_INLINE_VISIBILITY explicit priority_queue(const value_compare& __comp) : c(), comp(__comp) {} _LIBCPP_INLINE_VISIBILITY priority_queue(const value_compare& __comp, const container_type& __c); -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES +#ifndef _LIBCPP_CXX03_LANG _LIBCPP_INLINE_VISIBILITY explicit priority_queue(const value_compare& __comp, container_type&& __c); #endif @@ -455,12 +449,12 @@ public: _LIBCPP_INLINE_VISIBILITY priority_queue(_InputIter __f, _InputIter __l, const value_compare& __comp, const container_type& __c); -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES +#ifndef _LIBCPP_CXX03_LANG template _LIBCPP_INLINE_VISIBILITY priority_queue(_InputIter __f, _InputIter __l, const value_compare& __comp, container_type&& __c); -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES +#endif // _LIBCPP_CXX03_LANG template _LIBCPP_INLINE_VISIBILITY explicit priority_queue(const _Alloc& __a, @@ -482,7 +476,7 @@ public: priority_queue(const priority_queue& __q, const _Alloc& __a, typename enable_if::value>::type* = 0); -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES +#ifndef _LIBCPP_CXX03_LANG template _LIBCPP_INLINE_VISIBILITY priority_queue(const value_compare& __comp, container_type&& __c, @@ -494,7 +488,7 @@ public: priority_queue(priority_queue&& __q, const _Alloc& __a, typename enable_if::value>::type* = 0); -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES +#endif // _LIBCPP_CXX03_LANG _LIBCPP_INLINE_VISIBILITY bool empty() const {return c.empty();} @@ -505,13 +499,13 @@ public: _LIBCPP_INLINE_VISIBILITY void push(const value_type& __v); -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES +#ifndef _LIBCPP_CXX03_LANG _LIBCPP_INLINE_VISIBILITY void push(value_type&& __v); -#ifndef _LIBCPP_HAS_NO_VARIADICS - template _LIBCPP_INLINE_VISIBILITY void emplace(_Args&&... __args); -#endif -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES + template + _LIBCPP_INLINE_VISIBILITY + void emplace(_Args&&... __args); +#endif // _LIBCPP_CXX03_LANG _LIBCPP_INLINE_VISIBILITY void pop(); @@ -531,7 +525,7 @@ priority_queue<_Tp, _Container, _Compare>::priority_queue(const _Compare& __comp _VSTD::make_heap(c.begin(), c.end(), comp); } -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES +#ifndef _LIBCPP_CXX03_LANG template inline @@ -543,7 +537,7 @@ priority_queue<_Tp, _Container, _Compare>::priority_queue(const value_compare& _ _VSTD::make_heap(c.begin(), c.end(), comp); } -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES +#endif // _LIBCPP_CXX03_LANG template template @@ -569,7 +563,7 @@ priority_queue<_Tp, _Container, _Compare>::priority_queue(_InputIter __f, _Input _VSTD::make_heap(c.begin(), c.end(), comp); } -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES +#ifndef _LIBCPP_CXX03_LANG template template @@ -584,7 +578,7 @@ priority_queue<_Tp, _Container, _Compare>::priority_queue(_InputIter __f, _Input _VSTD::make_heap(c.begin(), c.end(), comp); } -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES +#endif // _LIBCPP_CXX03_LANG template template @@ -635,7 +629,7 @@ priority_queue<_Tp, _Container, _Compare>::priority_queue(const priority_queue& _VSTD::make_heap(c.begin(), c.end(), comp); } -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES +#ifndef _LIBCPP_CXX03_LANG template template @@ -664,7 +658,7 @@ priority_queue<_Tp, _Container, _Compare>::priority_queue(priority_queue&& __q, _VSTD::make_heap(c.begin(), c.end(), comp); } -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES +#endif // _LIBCPP_CXX03_LANG template inline @@ -675,7 +669,7 @@ priority_queue<_Tp, _Container, _Compare>::push(const value_type& __v) _VSTD::push_heap(c.begin(), c.end(), comp); } -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES +#ifndef _LIBCPP_CXX03_LANG template inline @@ -686,8 +680,6 @@ priority_queue<_Tp, _Container, _Compare>::push(value_type&& __v) _VSTD::push_heap(c.begin(), c.end(), comp); } -#ifndef _LIBCPP_HAS_NO_VARIADICS - template template inline @@ -698,8 +690,7 @@ priority_queue<_Tp, _Container, _Compare>::emplace(_Args&&... __args) _VSTD::push_heap(c.begin(), c.end(), comp); } -#endif // _LIBCPP_HAS_NO_VARIADICS -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES +#endif // _LIBCPP_CXX03_LANG template inline diff --git a/include/random b/include/random index 835ebdb6c..ba8a088df 100644 --- a/include/random +++ b/include/random @@ -1646,12 +1646,14 @@ class piecewise_linear_distribution #include #include -#include <__undef_min_max> - #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) #pragma GCC system_header #endif +_LIBCPP_PUSH_MACROS +#include <__undef_macros> + + _LIBCPP_BEGIN_NAMESPACE_STD // __is_seed_sequence @@ -2013,41 +2015,41 @@ template class _LIBCPP_TEMPLATE_VIS mersenne_twister_engine; -template +template bool -operator==(const mersenne_twister_engine<_UI, _Wp, _Np, _Mp, _Rp, _Ap, _Up, _Dp, _Sp, +operator==(const mersenne_twister_engine<_UInt, _Wp, _Np, _Mp, _Rp, _Ap, _Up, _Dp, _Sp, _Bp, _Tp, _Cp, _Lp, _Fp>& __x, - const mersenne_twister_engine<_UI, _Wp, _Np, _Mp, _Rp, _Ap, _Up, _Dp, _Sp, + const mersenne_twister_engine<_UInt, _Wp, _Np, _Mp, _Rp, _Ap, _Up, _Dp, _Sp, _Bp, _Tp, _Cp, _Lp, _Fp>& __y); -template +template _LIBCPP_INLINE_VISIBILITY bool -operator!=(const mersenne_twister_engine<_UI, _Wp, _Np, _Mp, _Rp, _Ap, _Up, _Dp, _Sp, +operator!=(const mersenne_twister_engine<_UInt, _Wp, _Np, _Mp, _Rp, _Ap, _Up, _Dp, _Sp, _Bp, _Tp, _Cp, _Lp, _Fp>& __x, - const mersenne_twister_engine<_UI, _Wp, _Np, _Mp, _Rp, _Ap, _Up, _Dp, _Sp, + const mersenne_twister_engine<_UInt, _Wp, _Np, _Mp, _Rp, _Ap, _Up, _Dp, _Sp, _Bp, _Tp, _Cp, _Lp, _Fp>& __y); template + class _UInt, size_t _Wp, size_t _Np, size_t _Mp, size_t _Rp, + _UInt _Ap, size_t _Up, _UInt _Dp, size_t _Sp, + _UInt _Bp, size_t _Tp, _UInt _Cp, size_t _Lp, _UInt _Fp> basic_ostream<_CharT, _Traits>& operator<<(basic_ostream<_CharT, _Traits>& __os, - const mersenne_twister_engine<_UI, _Wp, _Np, _Mp, _Rp, _Ap, _Up, _Dp, _Sp, + const mersenne_twister_engine<_UInt, _Wp, _Np, _Mp, _Rp, _Ap, _Up, _Dp, _Sp, _Bp, _Tp, _Cp, _Lp, _Fp>& __x); template + class _UInt, size_t _Wp, size_t _Np, size_t _Mp, size_t _Rp, + _UInt _Ap, size_t _Up, _UInt _Dp, size_t _Sp, + _UInt _Bp, size_t _Tp, _UInt _Cp, size_t _Lp, _UInt _Fp> basic_istream<_CharT, _Traits>& operator>>(basic_istream<_CharT, _Traits>& __is, - mersenne_twister_engine<_UI, _Wp, _Np, _Mp, _Rp, _Ap, _Up, _Dp, _Sp, + mersenne_twister_engine<_UInt, _Wp, _Np, _Mp, _Rp, _Ap, _Up, _Dp, _Sp, _Bp, _Tp, _Cp, _Lp, _Fp>& __x); template + template friend bool - operator==(const mersenne_twister_engine<_UI, _Wp, _Np, _Mp, _Rp, _Ap, _Up, _Dp, _Sp, + operator==(const mersenne_twister_engine<_UInt, _Wp, _Np, _Mp, _Rp, _Ap, _Up, _Dp, _Sp, _Bp, _Tp, _Cp, _Lp, _Fp>& __x, - const mersenne_twister_engine<_UI, _Wp, _Np, _Mp, _Rp, _Ap, _Up, _Dp, _Sp, + const mersenne_twister_engine<_UInt, _Wp, _Np, _Mp, _Rp, _Ap, _Up, _Dp, _Sp, _Bp, _Tp, _Cp, _Lp, _Fp>& __y); - template + template friend bool - operator!=(const mersenne_twister_engine<_UI, _Wp, _Np, _Mp, _Rp, _Ap, _Up, _Dp, _Sp, + operator!=(const mersenne_twister_engine<_UInt, _Wp, _Np, _Mp, _Rp, _Ap, _Up, _Dp, _Sp, _Bp, _Tp, _Cp, _Lp, _Fp>& __x, - const mersenne_twister_engine<_UI, _Wp, _Np, _Mp, _Rp, _Ap, _Up, _Dp, _Sp, + const mersenne_twister_engine<_UInt, _Wp, _Np, _Mp, _Rp, _Ap, _Up, _Dp, _Sp, _Bp, _Tp, _Cp, _Lp, _Fp>& __y); template + class _UInt, size_t _Wp, size_t _Np, size_t _Mp, size_t _Rp, + _UInt _Ap, size_t _Up, _UInt _Dp, size_t _Sp, + _UInt _Bp, size_t _Tp, _UInt _Cp, size_t _Lp, _UInt _Fp> friend basic_ostream<_CharT, _Traits>& operator<<(basic_ostream<_CharT, _Traits>& __os, - const mersenne_twister_engine<_UI, _Wp, _Np, _Mp, _Rp, _Ap, _Up, _Dp, _Sp, + const mersenne_twister_engine<_UInt, _Wp, _Np, _Mp, _Rp, _Ap, _Up, _Dp, _Sp, _Bp, _Tp, _Cp, _Lp, _Fp>& __x); template + class _UInt, size_t _Wp, size_t _Np, size_t _Mp, size_t _Rp, + _UInt _Ap, size_t _Up, _UInt _Dp, size_t _Sp, + _UInt _Bp, size_t _Tp, _UInt _Cp, size_t _Lp, _UInt _Fp> friend basic_istream<_CharT, _Traits>& operator>>(basic_istream<_CharT, _Traits>& __is, - mersenne_twister_engine<_UI, _Wp, _Np, _Mp, _Rp, _Ap, _Up, _Dp, _Sp, + mersenne_twister_engine<_UInt, _Wp, _Np, _Mp, _Rp, _Ap, _Up, _Dp, _Sp, _Bp, _Tp, _Cp, _Lp, _Fp>& __x); private: @@ -2384,13 +2386,13 @@ mersenne_twister_engine<_UIntType, __w, __n, __m, __r, __a, __u, __d, __s, __b, return __z ^ __rshift<__l>(__z); } -template +template bool -operator==(const mersenne_twister_engine<_UI, _Wp, _Np, _Mp, _Rp, _Ap, _Up, _Dp, _Sp, +operator==(const mersenne_twister_engine<_UInt, _Wp, _Np, _Mp, _Rp, _Ap, _Up, _Dp, _Sp, _Bp, _Tp, _Cp, _Lp, _Fp>& __x, - const mersenne_twister_engine<_UI, _Wp, _Np, _Mp, _Rp, _Ap, _Up, _Dp, _Sp, + const mersenne_twister_engine<_UInt, _Wp, _Np, _Mp, _Rp, _Ap, _Up, _Dp, _Sp, _Bp, _Tp, _Cp, _Lp, _Fp>& __y) { if (__x.__i_ == __y.__i_) @@ -2428,26 +2430,26 @@ operator==(const mersenne_twister_engine<_UI, _Wp, _Np, _Mp, _Rp, _Ap, _Up, _Dp, __x.__x_ + (_Np - (__y.__i_ + __j))); } -template +template inline _LIBCPP_INLINE_VISIBILITY bool -operator!=(const mersenne_twister_engine<_UI, _Wp, _Np, _Mp, _Rp, _Ap, _Up, _Dp, _Sp, +operator!=(const mersenne_twister_engine<_UInt, _Wp, _Np, _Mp, _Rp, _Ap, _Up, _Dp, _Sp, _Bp, _Tp, _Cp, _Lp, _Fp>& __x, - const mersenne_twister_engine<_UI, _Wp, _Np, _Mp, _Rp, _Ap, _Up, _Dp, _Sp, + const mersenne_twister_engine<_UInt, _Wp, _Np, _Mp, _Rp, _Ap, _Up, _Dp, _Sp, _Bp, _Tp, _Cp, _Lp, _Fp>& __y) { return !(__x == __y); } template + class _UInt, size_t _Wp, size_t _Np, size_t _Mp, size_t _Rp, + _UInt _Ap, size_t _Up, _UInt _Dp, size_t _Sp, + _UInt _Bp, size_t _Tp, _UInt _Cp, size_t _Lp, _UInt _Fp> basic_ostream<_CharT, _Traits>& operator<<(basic_ostream<_CharT, _Traits>& __os, - const mersenne_twister_engine<_UI, _Wp, _Np, _Mp, _Rp, _Ap, _Up, _Dp, _Sp, + const mersenne_twister_engine<_UInt, _Wp, _Np, _Mp, _Rp, _Ap, _Up, _Dp, _Sp, _Bp, _Tp, _Cp, _Lp, _Fp>& __x) { __save_flags<_CharT, _Traits> __lx(__os); @@ -2463,17 +2465,17 @@ operator<<(basic_ostream<_CharT, _Traits>& __os, } template + class _UInt, size_t _Wp, size_t _Np, size_t _Mp, size_t _Rp, + _UInt _Ap, size_t _Up, _UInt _Dp, size_t _Sp, + _UInt _Bp, size_t _Tp, _UInt _Cp, size_t _Lp, _UInt _Fp> basic_istream<_CharT, _Traits>& operator>>(basic_istream<_CharT, _Traits>& __is, - mersenne_twister_engine<_UI, _Wp, _Np, _Mp, _Rp, _Ap, _Up, _Dp, _Sp, + mersenne_twister_engine<_UInt, _Wp, _Np, _Mp, _Rp, _Ap, _Up, _Dp, _Sp, _Bp, _Tp, _Cp, _Lp, _Fp>& __x) { __save_flags<_CharT, _Traits> __lx(__is); __is.flags(ios_base::dec | ios_base::skipws); - _UI __t[_Np]; + _UInt __t[_Np]; for (size_t __i = 0; __i < _Np; ++__i) __is >> __t[__i]; if (!__is.fail()) @@ -2501,30 +2503,30 @@ typedef mersenne_twister_engine class _LIBCPP_TEMPLATE_VIS subtract_with_carry_engine; -template +template bool operator==( - const subtract_with_carry_engine<_UI, _Wp, _Sp, _Rp>& __x, - const subtract_with_carry_engine<_UI, _Wp, _Sp, _Rp>& __y); + const subtract_with_carry_engine<_UInt, _Wp, _Sp, _Rp>& __x, + const subtract_with_carry_engine<_UInt, _Wp, _Sp, _Rp>& __y); -template +template _LIBCPP_INLINE_VISIBILITY bool operator!=( - const subtract_with_carry_engine<_UI, _Wp, _Sp, _Rp>& __x, - const subtract_with_carry_engine<_UI, _Wp, _Sp, _Rp>& __y); + const subtract_with_carry_engine<_UInt, _Wp, _Sp, _Rp>& __x, + const subtract_with_carry_engine<_UInt, _Wp, _Sp, _Rp>& __y); template + class _UInt, size_t _Wp, size_t _Sp, size_t _Rp> basic_ostream<_CharT, _Traits>& operator<<(basic_ostream<_CharT, _Traits>& __os, - const subtract_with_carry_engine<_UI, _Wp, _Sp, _Rp>& __x); + const subtract_with_carry_engine<_UInt, _Wp, _Sp, _Rp>& __x); template + class _UInt, size_t _Wp, size_t _Sp, size_t _Rp> basic_istream<_CharT, _Traits>& operator>>(basic_istream<_CharT, _Traits>& __is, - subtract_with_carry_engine<_UI, _Wp, _Sp, _Rp>& __x); + subtract_with_carry_engine<_UInt, _Wp, _Sp, _Rp>& __x); template class _LIBCPP_TEMPLATE_VIS subtract_with_carry_engine @@ -2586,33 +2588,33 @@ public: _LIBCPP_INLINE_VISIBILITY void discard(unsigned long long __z) {for (; __z; --__z) operator()();} - template + template friend bool operator==( - const subtract_with_carry_engine<_UI, _Wp, _Sp, _Rp>& __x, - const subtract_with_carry_engine<_UI, _Wp, _Sp, _Rp>& __y); + const subtract_with_carry_engine<_UInt, _Wp, _Sp, _Rp>& __x, + const subtract_with_carry_engine<_UInt, _Wp, _Sp, _Rp>& __y); - template + template friend bool operator!=( - const subtract_with_carry_engine<_UI, _Wp, _Sp, _Rp>& __x, - const subtract_with_carry_engine<_UI, _Wp, _Sp, _Rp>& __y); + const subtract_with_carry_engine<_UInt, _Wp, _Sp, _Rp>& __x, + const subtract_with_carry_engine<_UInt, _Wp, _Sp, _Rp>& __y); template + class _UInt, size_t _Wp, size_t _Sp, size_t _Rp> friend basic_ostream<_CharT, _Traits>& operator<<(basic_ostream<_CharT, _Traits>& __os, - const subtract_with_carry_engine<_UI, _Wp, _Sp, _Rp>& __x); + const subtract_with_carry_engine<_UInt, _Wp, _Sp, _Rp>& __x); template + class _UInt, size_t _Wp, size_t _Sp, size_t _Rp> friend basic_istream<_CharT, _Traits>& operator>>(basic_istream<_CharT, _Traits>& __is, - subtract_with_carry_engine<_UI, _Wp, _Sp, _Rp>& __x); + subtract_with_carry_engine<_UInt, _Wp, _Sp, _Rp>& __x); private: @@ -2711,11 +2713,11 @@ subtract_with_carry_engine<_UIntType, __w, __s, __r>::operator()() return __xr; } -template +template bool operator==( - const subtract_with_carry_engine<_UI, _Wp, _Sp, _Rp>& __x, - const subtract_with_carry_engine<_UI, _Wp, _Sp, _Rp>& __y) + const subtract_with_carry_engine<_UInt, _Wp, _Sp, _Rp>& __x, + const subtract_with_carry_engine<_UInt, _Wp, _Sp, _Rp>& __y) { if (__x.__c_ != __y.__c_) return false; @@ -2754,21 +2756,21 @@ operator==( __x.__x_ + (_Rp - (__y.__i_ + __j))); } -template +template inline _LIBCPP_INLINE_VISIBILITY bool operator!=( - const subtract_with_carry_engine<_UI, _Wp, _Sp, _Rp>& __x, - const subtract_with_carry_engine<_UI, _Wp, _Sp, _Rp>& __y) + const subtract_with_carry_engine<_UInt, _Wp, _Sp, _Rp>& __x, + const subtract_with_carry_engine<_UInt, _Wp, _Sp, _Rp>& __y) { return !(__x == __y); } template + class _UInt, size_t _Wp, size_t _Sp, size_t _Rp> basic_ostream<_CharT, _Traits>& operator<<(basic_ostream<_CharT, _Traits>& __os, - const subtract_with_carry_engine<_UI, _Wp, _Sp, _Rp>& __x) + const subtract_with_carry_engine<_UInt, _Wp, _Sp, _Rp>& __x) { __save_flags<_CharT, _Traits> __lx(__os); __os.flags(ios_base::dec | ios_base::left); @@ -2784,14 +2786,14 @@ operator<<(basic_ostream<_CharT, _Traits>& __os, } template + class _UInt, size_t _Wp, size_t _Sp, size_t _Rp> basic_istream<_CharT, _Traits>& operator>>(basic_istream<_CharT, _Traits>& __is, - subtract_with_carry_engine<_UI, _Wp, _Sp, _Rp>& __x) + subtract_with_carry_engine<_UInt, _Wp, _Sp, _Rp>& __x) { __save_flags<_CharT, _Traits> __lx(__is); __is.flags(ios_base::dec | ios_base::skipws); - _UI __t[_Rp+1]; + _UInt __t[_Rp+1]; for (size_t __i = 0; __i < _Rp+1; ++__i) __is >> __t[__i]; if (!__is.fail()) @@ -2826,7 +2828,7 @@ public: static _LIBCPP_CONSTEXPR const size_t block_size = __p; static _LIBCPP_CONSTEXPR const size_t used_block = __r; -#ifdef _LIBCPP_HAS_NO_CONSTEXPR +#ifdef _LIBCPP_CXX03_LANG static const result_type _Min = _Engine::_Min; static const result_type _Max = _Engine::_Max; #else @@ -2845,11 +2847,11 @@ public: _LIBCPP_INLINE_VISIBILITY explicit discard_block_engine(const _Engine& __e) : __e_(__e), __n_(0) {} -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES +#ifndef _LIBCPP_CXX03_LANG _LIBCPP_INLINE_VISIBILITY explicit discard_block_engine(_Engine&& __e) : __e_(_VSTD::move(__e)), __n_(0) {} -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES +#endif // _LIBCPP_CXX03_LANG _LIBCPP_INLINE_VISIBILITY explicit discard_block_engine(result_type __sd) : __e_(__sd), __n_(0) {} template @@ -2986,13 +2988,13 @@ typedef discard_block_engine ranlux48; template class _LIBCPP_TEMPLATE_VIS independent_bits_engine { - template + template class __get_n { - static _LIBCPP_CONSTEXPR const size_t _Dt = numeric_limits<_UI>::digits; + static _LIBCPP_CONSTEXPR const size_t _Dt = numeric_limits<_UInt>::digits; static _LIBCPP_CONSTEXPR const size_t _Np = _Wp / _Mp + (_Wp % _Mp != 0); static _LIBCPP_CONSTEXPR const size_t _W0 = _Wp / _Np; - static _LIBCPP_CONSTEXPR const _UI _Y0 = _W0 >= _Dt ? 0 : (_R0 >> _W0) << _W0; + static _LIBCPP_CONSTEXPR const _UInt _Y0 = _W0 >= _Dt ? 0 : (_R0 >> _W0) << _W0; public: static _LIBCPP_CONSTEXPR const size_t value = _R0 - _Y0 > _Y0 / _Np ? _Np + 1 : _Np; }; @@ -3014,7 +3016,7 @@ private: result_type, _Engine_result_type >::type _Working_result_type; -#ifdef _LIBCPP_HAS_NO_CONSTEXPR +#ifdef _LIBCPP_CXX03_LANG static const _Working_result_type _Rp = _Engine::_Max - _Engine::_Min + _Working_result_type(1); #else @@ -3055,11 +3057,11 @@ public: _LIBCPP_INLINE_VISIBILITY explicit independent_bits_engine(const _Engine& __e) : __e_(__e) {} -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES +#ifndef _LIBCPP_CXX03_LANG _LIBCPP_INLINE_VISIBILITY explicit independent_bits_engine(_Engine&& __e) : __e_(_VSTD::move(__e)) {} -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES +#endif // _LIBCPP_CXX03_LANG _LIBCPP_INLINE_VISIBILITY explicit independent_bits_engine(result_type __sd) : __e_(__sd) {} template @@ -3091,33 +3093,33 @@ public: _LIBCPP_INLINE_VISIBILITY const _Engine& base() const _NOEXCEPT {return __e_;} - template + template friend bool operator==( - const independent_bits_engine<_Eng, _Wp, _UI>& __x, - const independent_bits_engine<_Eng, _Wp, _UI>& __y); + const independent_bits_engine<_Eng, _Wp, _UInt>& __x, + const independent_bits_engine<_Eng, _Wp, _UInt>& __y); - template + template friend bool operator!=( - const independent_bits_engine<_Eng, _Wp, _UI>& __x, - const independent_bits_engine<_Eng, _Wp, _UI>& __y); + const independent_bits_engine<_Eng, _Wp, _UInt>& __x, + const independent_bits_engine<_Eng, _Wp, _UInt>& __y); template + class _Eng, size_t _Wp, class _UInt> friend basic_ostream<_CharT, _Traits>& operator<<(basic_ostream<_CharT, _Traits>& __os, - const independent_bits_engine<_Eng, _Wp, _UI>& __x); + const independent_bits_engine<_Eng, _Wp, _UInt>& __x); template + class _Eng, size_t _Wp, class _UInt> friend basic_istream<_CharT, _Traits>& operator>>(basic_istream<_CharT, _Traits>& __is, - independent_bits_engine<_Eng, _Wp, _UI>& __x); + independent_bits_engine<_Eng, _Wp, _UInt>& __x); private: _LIBCPP_INLINE_VISIBILITY @@ -3179,40 +3181,40 @@ independent_bits_engine<_Engine, __w, _UIntType>::__eval(true_type) return _Sp; } -template +template inline _LIBCPP_INLINE_VISIBILITY bool operator==( - const independent_bits_engine<_Eng, _Wp, _UI>& __x, - const independent_bits_engine<_Eng, _Wp, _UI>& __y) + const independent_bits_engine<_Eng, _Wp, _UInt>& __x, + const independent_bits_engine<_Eng, _Wp, _UInt>& __y) { return __x.base() == __y.base(); } -template +template inline _LIBCPP_INLINE_VISIBILITY bool operator!=( - const independent_bits_engine<_Eng, _Wp, _UI>& __x, - const independent_bits_engine<_Eng, _Wp, _UI>& __y) + const independent_bits_engine<_Eng, _Wp, _UInt>& __x, + const independent_bits_engine<_Eng, _Wp, _UInt>& __y) { return !(__x == __y); } template + class _Eng, size_t _Wp, class _UInt> basic_ostream<_CharT, _Traits>& operator<<(basic_ostream<_CharT, _Traits>& __os, - const independent_bits_engine<_Eng, _Wp, _UI>& __x) + const independent_bits_engine<_Eng, _Wp, _UInt>& __x) { return __os << __x.base(); } template + class _Eng, size_t _Wp, class _UInt> basic_istream<_CharT, _Traits>& operator>>(basic_istream<_CharT, _Traits>& __is, - independent_bits_engine<_Eng, _Wp, _UI>& __x) + independent_bits_engine<_Eng, _Wp, _UInt>& __x) { _Eng __e; __is >> __e; @@ -3264,7 +3266,7 @@ public: // engine characteristics static _LIBCPP_CONSTEXPR const size_t table_size = __k; -#ifdef _LIBCPP_HAS_NO_CONSTEXPR +#ifdef _LIBCPP_CXX03_LANG static const result_type _Min = _Engine::_Min; static const result_type _Max = _Engine::_Max; #else @@ -3285,11 +3287,11 @@ public: _LIBCPP_INLINE_VISIBILITY explicit shuffle_order_engine(const _Engine& __e) : __e_(__e) {__init();} -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES +#ifndef _LIBCPP_CXX03_LANG _LIBCPP_INLINE_VISIBILITY explicit shuffle_order_engine(_Engine&& __e) : __e_(_VSTD::move(__e)) {__init();} -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES +#endif // _LIBCPP_CXX03_LANG _LIBCPP_INLINE_VISIBILITY explicit shuffle_order_engine(result_type __sd) : __e_(__sd) {__init();} template @@ -3526,11 +3528,11 @@ public: // constructors _LIBCPP_INLINE_VISIBILITY seed_seq() _NOEXCEPT {} -#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS +#ifndef _LIBCPP_CXX03_LANG template _LIBCPP_INLINE_VISIBILITY seed_seq(initializer_list<_Tp> __il) {init(__il.begin(), __il.end());} -#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS +#endif // _LIBCPP_CXX03_LANG template _LIBCPP_INLINE_VISIBILITY @@ -3637,7 +3639,7 @@ generate_canonical(_URNG& __g) { const size_t _Dt = numeric_limits<_RealType>::digits; const size_t __b = _Dt < __bits ? _Dt : __bits; -#ifdef _LIBCPP_HAS_NO_CONSTEXPR +#ifdef _LIBCPP_CXX03_LANG const size_t __logR = __log2::value; #else const size_t __logR = __log2::value; @@ -3997,16 +3999,30 @@ public: {return !(__x == __y);} }; +#ifndef _LIBCPP_MSVCRT +extern "C" double lgamma_r(double, int *); +#endif + +inline _LIBCPP_INLINE_VISIBILITY double __libcpp_lgamma(double __d) { +#if defined(_LIBCPP_MSVCRT) + return lgamma(__d); +#else + int __sign; + return lgamma_r(__d, &__sign); +#endif +} + template -binomial_distribution<_IntType>::param_type::param_type(result_type __t, double __p) +binomial_distribution<_IntType>::param_type::param_type(const result_type __t, const double __p) : __t_(__t), __p_(__p) { if (0 < __p_ && __p_ < 1) { __r0_ = static_cast((__t_ + 1) * __p_); - __pr_ = _VSTD::exp(_VSTD::lgamma(__t_ + 1.) - _VSTD::lgamma(__r0_ + 1.) - - _VSTD::lgamma(__t_ - __r0_ + 1.) + __r0_ * _VSTD::log(__p_) + - (__t_ - __r0_) * _VSTD::log(1 - __p_)); + __pr_ = _VSTD::exp(__libcpp_lgamma(__t_ + 1.) - + __libcpp_lgamma(__r0_ + 1.) - + __libcpp_lgamma(__t_ - __r0_ + 1.) + __r0_ * _VSTD::log(__p_) + + (__t_ - __r0_) * _VSTD::log(1 - __p_)); __odds_ratio_ = __p_ / (1 - __p_); } } @@ -5851,11 +5867,11 @@ public: _LIBCPP_INLINE_VISIBILITY param_type(_InputIterator __f, _InputIterator __l) : __p_(__f, __l) {__init();} -#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS +#ifndef _LIBCPP_CXX03_LANG _LIBCPP_INLINE_VISIBILITY param_type(initializer_list __wl) : __p_(__wl.begin(), __wl.end()) {__init();} -#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS +#endif // _LIBCPP_CXX03_LANG template param_type(size_t __nw, double __xmin, double __xmax, _UnaryOperation __fw); @@ -5898,11 +5914,11 @@ public: _LIBCPP_INLINE_VISIBILITY discrete_distribution(_InputIterator __f, _InputIterator __l) : __p_(__f, __l) {} -#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS +#ifndef _LIBCPP_CXX03_LANG _LIBCPP_INLINE_VISIBILITY discrete_distribution(initializer_list __wl) : __p_(__wl) {} -#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS +#endif // _LIBCPP_CXX03_LANG template _LIBCPP_INLINE_VISIBILITY discrete_distribution(size_t __nw, double __xmin, double __xmax, @@ -6079,10 +6095,10 @@ public: template param_type(_InputIteratorB __fB, _InputIteratorB __lB, _InputIteratorW __fW); -#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS +#ifndef _LIBCPP_CXX03_LANG template param_type(initializer_list __bl, _UnaryOperation __fw); -#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS +#endif // _LIBCPP_CXX03_LANG template param_type(size_t __nw, result_type __xmin, result_type __xmax, _UnaryOperation __fw); @@ -6132,13 +6148,13 @@ public: _InputIteratorW __fW) : __p_(__fB, __lB, __fW) {} -#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS +#ifndef _LIBCPP_CXX03_LANG template _LIBCPP_INLINE_VISIBILITY piecewise_constant_distribution(initializer_list __bl, _UnaryOperation __fw) : __p_(__bl, __fw) {} -#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS +#endif // _LIBCPP_CXX03_LANG template _LIBCPP_INLINE_VISIBILITY @@ -6268,7 +6284,7 @@ piecewise_constant_distribution<_RealType>::param_type::param_type( } } -#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS +#ifndef _LIBCPP_CXX03_LANG template template @@ -6293,7 +6309,7 @@ piecewise_constant_distribution<_RealType>::param_type::param_type( } } -#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS +#endif // _LIBCPP_CXX03_LANG template template @@ -6402,10 +6418,10 @@ public: template param_type(_InputIteratorB __fB, _InputIteratorB __lB, _InputIteratorW __fW); -#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS +#ifndef _LIBCPP_CXX03_LANG template param_type(initializer_list __bl, _UnaryOperation __fw); -#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS +#endif // _LIBCPP_CXX03_LANG template param_type(size_t __nw, result_type __xmin, result_type __xmax, _UnaryOperation __fw); @@ -6455,13 +6471,13 @@ public: _InputIteratorW __fW) : __p_(__fB, __lB, __fW) {} -#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS +#ifndef _LIBCPP_CXX03_LANG template _LIBCPP_INLINE_VISIBILITY piecewise_linear_distribution(initializer_list __bl, _UnaryOperation __fw) : __p_(__bl, __fw) {} -#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS +#endif // _LIBCPP_CXX03_LANG template _LIBCPP_INLINE_VISIBILITY @@ -6595,7 +6611,7 @@ piecewise_linear_distribution<_RealType>::param_type::param_type( } } -#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS +#ifndef _LIBCPP_CXX03_LANG template template @@ -6620,7 +6636,7 @@ piecewise_linear_distribution<_RealType>::param_type::param_type( } } -#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS +#endif // _LIBCPP_CXX03_LANG template template @@ -6722,4 +6738,6 @@ operator>>(basic_istream<_CharT, _Traits>& __is, _LIBCPP_END_NAMESPACE_STD +_LIBCPP_POP_MACROS + #endif // _LIBCPP_RANDOM diff --git a/include/ratio b/include/ratio index fa893637d..27aa0ded3 100644 --- a/include/ratio +++ b/include/ratio @@ -83,12 +83,14 @@ typedef ratio<1000000000000000000000000, 1> yotta; // not supported #include #include -#include <__undef_min_max> - #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) #pragma GCC system_header #endif +_LIBCPP_PUSH_MACROS +#include <__undef_macros> + + _LIBCPP_BEGIN_NAMESPACE_STD // __static_gcd @@ -520,4 +522,6 @@ template _LIBCPP_CONSTEXPR bool ratio_greater_equal_v _LIBCPP_END_NAMESPACE_STD +_LIBCPP_POP_MACROS + #endif // _LIBCPP_RATIO diff --git a/include/regex b/include/regex index 2b4c5aaab..b70e313cd 100644 --- a/include/regex +++ b/include/regex @@ -765,12 +765,14 @@ typedef regex_token_iterator wsregex_token_iterator; #include #include -#include <__undef_min_max> - #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) #pragma GCC system_header #endif +_LIBCPP_PUSH_MACROS +#include <__undef_macros> + + _LIBCPP_BEGIN_NAMESPACE_STD namespace regex_constants @@ -2545,14 +2547,14 @@ public: : __flags_(__f), __marked_count_(0), __loop_count_(0), __open_count_(0), __end_(0) {__parse(__first, __last);} -#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS +#ifndef _LIBCPP_CXX03_LANG _LIBCPP_INLINE_VISIBILITY basic_regex(initializer_list __il, flag_type __f = regex_constants::ECMAScript) : __flags_(__f), __marked_count_(0), __loop_count_(0), __open_count_(0), __end_(0) {__parse(__il.begin(), __il.end());} -#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS +#endif // _LIBCPP_CXX03_LANG // ~basic_regex() = default; @@ -2561,11 +2563,11 @@ public: _LIBCPP_INLINE_VISIBILITY basic_regex& operator=(const value_type* __p) {return assign(__p);} -#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS +#ifndef _LIBCPP_CXX03_LANG _LIBCPP_INLINE_VISIBILITY basic_regex& operator=(initializer_list __il) {return assign(__il);} -#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS +#endif // _LIBCPP_CXX03_LANG template _LIBCPP_INLINE_VISIBILITY basic_regex& operator=(const basic_string& __p) @@ -2575,7 +2577,7 @@ public: _LIBCPP_INLINE_VISIBILITY basic_regex& assign(const basic_regex& __that) {return *this = __that;} -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES +#ifndef _LIBCPP_CXX03_LANG _LIBCPP_INLINE_VISIBILITY basic_regex& assign(basic_regex&& __that) _NOEXCEPT {return *this = _VSTD::move(__that);} @@ -2632,14 +2634,14 @@ public: return assign(basic_regex(__first, __last, __f)); } -#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS +#ifndef _LIBCPP_CXX03_LANG _LIBCPP_INLINE_VISIBILITY basic_regex& assign(initializer_list __il, flag_type __f = regex_constants::ECMAScript) {return assign(__il.begin(), __il.end(), __f);} -#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS +#endif // _LIBCPP_CXX03_LANG // const operations: _LIBCPP_INLINE_VISIBILITY @@ -3963,7 +3965,6 @@ basic_regex<_CharT, _Traits>::__parse_equivalence_class(_ForwardIterator __first if (__temp == __last) __throw_regex_error(); // [__first, __temp) contains all text in [= ... =] - typedef typename _Traits::string_type string_type; string_type __collate_name = __traits_.lookup_collatename(__first, __temp); if (__collate_name.empty()) @@ -6220,7 +6221,7 @@ public: regex_constants::match_default) = delete; #endif -#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS +#ifndef _LIBCPP_CXX03_LANG regex_token_iterator(_BidirectionalIterator __a, _BidirectionalIterator __b, const regex_type& __re, initializer_list __submatches, @@ -6234,7 +6235,7 @@ public: regex_constants::match_flag_type __m = regex_constants::match_default) = delete; #endif -#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS +#endif // _LIBCPP_CXX03_LANG template regex_token_iterator(_BidirectionalIterator __a, _BidirectionalIterator __b, @@ -6334,7 +6335,7 @@ regex_token_iterator<_BidirectionalIterator, _CharT, _Traits>:: __init(__a, __b); } -#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS +#ifndef _LIBCPP_CXX03_LANG template regex_token_iterator<_BidirectionalIterator, _CharT, _Traits>:: @@ -6349,7 +6350,7 @@ regex_token_iterator<_BidirectionalIterator, _CharT, _Traits>:: __init(__a, __b); } -#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS +#endif // _LIBCPP_CXX03_LANG template template @@ -6569,4 +6570,6 @@ regex_replace(const _CharT* __s, _LIBCPP_END_NAMESPACE_STD +_LIBCPP_POP_MACROS + #endif // _LIBCPP_REGEX diff --git a/include/set b/include/set index be5c9528c..30f2fa88f 100644 --- a/include/set +++ b/include/set @@ -486,12 +486,12 @@ public: return *this; } -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES +#ifndef _LIBCPP_CXX03_LANG _LIBCPP_INLINE_VISIBILITY set(set&& __s) _NOEXCEPT_(is_nothrow_move_constructible<__base>::value) : __tree_(_VSTD::move(__s.__tree_)) {} -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES +#endif // _LIBCPP_CXX03_LANG _LIBCPP_INLINE_VISIBILITY explicit set(const allocator_type& __a) @@ -504,11 +504,9 @@ public: insert(__s.begin(), __s.end()); } -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES +#ifndef _LIBCPP_CXX03_LANG set(set&& __s, const allocator_type& __a); -#endif -#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS _LIBCPP_INLINE_VISIBILITY set(initializer_list __il, const value_compare& __comp = value_compare()) : __tree_(__comp) @@ -536,9 +534,7 @@ public: __tree_.__assign_unique(__il.begin(), __il.end()); return *this; } -#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES _LIBCPP_INLINE_VISIBILITY set& operator=(set&& __s) _NOEXCEPT_(is_nothrow_move_assignable<__base>::value) @@ -546,7 +542,7 @@ public: __tree_ = _VSTD::move(__s.__tree_); return *this; } -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES +#endif // _LIBCPP_CXX03_LANG _LIBCPP_INLINE_VISIBILITY iterator begin() _NOEXCEPT {return __tree_.begin();} @@ -587,7 +583,7 @@ public: size_type max_size() const _NOEXCEPT {return __tree_.max_size();} // modifiers: -#if !defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES) && !defined(_LIBCPP_HAS_NO_VARIADICS) +#ifndef _LIBCPP_CXX03_LANG template _LIBCPP_INLINE_VISIBILITY pair emplace(_Args&&... __args) @@ -596,23 +592,15 @@ public: _LIBCPP_INLINE_VISIBILITY iterator emplace_hint(const_iterator __p, _Args&&... __args) {return __tree_.__emplace_hint_unique(__p, _VSTD::forward<_Args>(__args)...);} -#endif // !defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES) && !defined(_LIBCPP_HAS_NO_VARIADICS) +#endif // _LIBCPP_CXX03_LANG + _LIBCPP_INLINE_VISIBILITY pair insert(const value_type& __v) {return __tree_.__insert_unique(__v);} -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES - _LIBCPP_INLINE_VISIBILITY - pair insert(value_type&& __v) - {return __tree_.__insert_unique(_VSTD::move(__v));} -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES _LIBCPP_INLINE_VISIBILITY iterator insert(const_iterator __p, const value_type& __v) {return __tree_.__insert_unique(__p, __v);} -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES - _LIBCPP_INLINE_VISIBILITY - iterator insert(const_iterator __p, value_type&& __v) - {return __tree_.__insert_unique(__p, _VSTD::move(__v));} -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES + template _LIBCPP_INLINE_VISIBILITY void insert(_InputIterator __f, _InputIterator __l) @@ -621,11 +609,19 @@ public: __tree_.__insert_unique(__e, *__f); } -#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS +#ifndef _LIBCPP_CXX03_LANG + _LIBCPP_INLINE_VISIBILITY + pair insert(value_type&& __v) + {return __tree_.__insert_unique(_VSTD::move(__v));} + + _LIBCPP_INLINE_VISIBILITY + iterator insert(const_iterator __p, value_type&& __v) + {return __tree_.__insert_unique(__p, _VSTD::move(__v));} + _LIBCPP_INLINE_VISIBILITY void insert(initializer_list __il) {insert(__il.begin(), __il.end());} -#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS +#endif // _LIBCPP_CXX03_LANG _LIBCPP_INLINE_VISIBILITY iterator erase(const_iterator __p) {return __tree_.erase(__p);} @@ -727,7 +723,7 @@ public: #endif }; -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES +#ifndef _LIBCPP_CXX03_LANG template set<_Key, _Compare, _Allocator>::set(set&& __s, const allocator_type& __a) @@ -741,7 +737,7 @@ set<_Key, _Compare, _Allocator>::set(set&& __s, const allocator_type& __a) } } -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES +#endif // _LIBCPP_CXX03_LANG template inline _LIBCPP_INLINE_VISIBILITY @@ -901,12 +897,14 @@ public: return *this; } -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES +#ifndef _LIBCPP_CXX03_LANG _LIBCPP_INLINE_VISIBILITY multiset(multiset&& __s) _NOEXCEPT_(is_nothrow_move_constructible<__base>::value) : __tree_(_VSTD::move(__s.__tree_)) {} -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES + + multiset(multiset&& __s, const allocator_type& __a); +#endif // _LIBCPP_CXX03_LANG _LIBCPP_INLINE_VISIBILITY explicit multiset(const allocator_type& __a) : __tree_(__a) {} @@ -916,11 +914,8 @@ public: { insert(__s.begin(), __s.end()); } -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES - multiset(multiset&& __s, const allocator_type& __a); -#endif -#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS +#ifndef _LIBCPP_CXX03_LANG _LIBCPP_INLINE_VISIBILITY multiset(initializer_list __il, const value_compare& __comp = value_compare()) : __tree_(__comp) @@ -948,9 +943,7 @@ public: __tree_.__assign_multi(__il.begin(), __il.end()); return *this; } -#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES _LIBCPP_INLINE_VISIBILITY multiset& operator=(multiset&& __s) _NOEXCEPT_(is_nothrow_move_assignable<__base>::value) @@ -958,7 +951,7 @@ public: __tree_ = _VSTD::move(__s.__tree_); return *this; } -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES +#endif // _LIBCPP_CXX03_LANG _LIBCPP_INLINE_VISIBILITY iterator begin() _NOEXCEPT {return __tree_.begin();} @@ -999,7 +992,7 @@ public: size_type max_size() const _NOEXCEPT {return __tree_.max_size();} // modifiers: -#if !defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES) && !defined(_LIBCPP_HAS_NO_VARIADICS) +#ifndef _LIBCPP_CXX03_LANG template _LIBCPP_INLINE_VISIBILITY iterator emplace(_Args&&... __args) @@ -1008,23 +1001,15 @@ public: _LIBCPP_INLINE_VISIBILITY iterator emplace_hint(const_iterator __p, _Args&&... __args) {return __tree_.__emplace_hint_multi(__p, _VSTD::forward<_Args>(__args)...);} -#endif // !defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES) && !defined(_LIBCPP_HAS_NO_VARIADICS) +#endif // _LIBCPP_CXX03_LANG + _LIBCPP_INLINE_VISIBILITY iterator insert(const value_type& __v) {return __tree_.__insert_multi(__v);} -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES - _LIBCPP_INLINE_VISIBILITY - iterator insert(value_type&& __v) - {return __tree_.__insert_multi(_VSTD::move(__v));} -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES _LIBCPP_INLINE_VISIBILITY iterator insert(const_iterator __p, const value_type& __v) {return __tree_.__insert_multi(__p, __v);} -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES - _LIBCPP_INLINE_VISIBILITY - iterator insert(const_iterator __p, value_type&& __v) - {return __tree_.__insert_multi(__p, _VSTD::move(__v));} -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES + template _LIBCPP_INLINE_VISIBILITY void insert(_InputIterator __f, _InputIterator __l) @@ -1033,11 +1018,19 @@ public: __tree_.__insert_multi(__e, *__f); } -#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS +#ifndef _LIBCPP_CXX03_LANG + _LIBCPP_INLINE_VISIBILITY + iterator insert(value_type&& __v) + {return __tree_.__insert_multi(_VSTD::move(__v));} + + _LIBCPP_INLINE_VISIBILITY + iterator insert(const_iterator __p, value_type&& __v) + {return __tree_.__insert_multi(__p, _VSTD::move(__v));} + _LIBCPP_INLINE_VISIBILITY void insert(initializer_list __il) {insert(__il.begin(), __il.end());} -#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS +#endif // _LIBCPP_CXX03_LANG _LIBCPP_INLINE_VISIBILITY iterator erase(const_iterator __p) {return __tree_.erase(__p);} @@ -1140,7 +1133,7 @@ public: #endif }; -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES +#ifndef _LIBCPP_CXX03_LANG template multiset<_Key, _Compare, _Allocator>::multiset(multiset&& __s, const allocator_type& __a) @@ -1154,7 +1147,7 @@ multiset<_Key, _Compare, _Allocator>::multiset(multiset&& __s, const allocator_t } } -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES +#endif // _LIBCPP_CXX03_LANG template inline _LIBCPP_INLINE_VISIBILITY diff --git a/include/shared_mutex b/include/shared_mutex index 29e8cef48..9cb81528c 100644 --- a/include/shared_mutex +++ b/include/shared_mutex @@ -125,12 +125,14 @@ template #include <__config> +_LIBCPP_PUSH_MACROS +#include <__undef_macros> + + #if _LIBCPP_STD_VER > 11 || defined(_LIBCPP_BUILDING_SHARED_MUTEX) #include <__mutex_base> -#include <__undef_min_max> - #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) #pragma GCC system_header #endif @@ -141,7 +143,7 @@ template _LIBCPP_BEGIN_NAMESPACE_STD -struct _LIBCPP_TYPE_VIS __shared_mutex_base +struct _LIBCPP_TYPE_VIS _LIBCPP_AVAILABILITY_SHARED_MUTEX __shared_mutex_base { mutex __mut_; condition_variable __gate1_; @@ -173,11 +175,11 @@ struct _LIBCPP_TYPE_VIS __shared_mutex_base #if _LIBCPP_STD_VER > 14 -class _LIBCPP_TYPE_VIS shared_mutex +class _LIBCPP_TYPE_VIS _LIBCPP_AVAILABILITY_SHARED_MUTEX shared_mutex { - __shared_mutex_base __base; + __shared_mutex_base __base; public: - shared_mutex() : __base() {} + _LIBCPP_INLINE_VISIBILITY shared_mutex() : __base() {} _LIBCPP_INLINE_VISIBILITY ~shared_mutex() = default; shared_mutex(const shared_mutex&) = delete; @@ -199,9 +201,9 @@ public: #endif -class _LIBCPP_TYPE_VIS shared_timed_mutex +class _LIBCPP_TYPE_VIS _LIBCPP_AVAILABILITY_SHARED_MUTEX shared_timed_mutex { - __shared_mutex_base __base; + __shared_mutex_base __base; public: shared_timed_mutex(); _LIBCPP_INLINE_VISIBILITY ~shared_timed_mutex() = default; @@ -500,4 +502,6 @@ _LIBCPP_END_NAMESPACE_STD #endif // _LIBCPP_STD_VER > 11 +_LIBCPP_POP_MACROS + #endif // _LIBCPP_SHARED_MUTEX diff --git a/include/sstream b/include/sstream index 40b97854f..b9903f961 100644 --- a/include/sstream +++ b/include/sstream @@ -175,12 +175,14 @@ typedef basic_stringstream wstringstream; #include #include -#include <__undef_min_max> - #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) #pragma GCC system_header #endif +_LIBCPP_PUSH_MACROS +#include <__undef_macros> + + _LIBCPP_BEGIN_NAMESPACE_STD // basic_stringbuf @@ -212,12 +214,10 @@ public: inline _LIBCPP_INLINE_VISIBILITY explicit basic_stringbuf(const string_type& __s, ios_base::openmode __wch = ios_base::in | ios_base::out); -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES +#ifndef _LIBCPP_CXX03_LANG basic_stringbuf(basic_stringbuf&& __rhs); -#endif // 27.8.1.2 Assign and swap: -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES basic_stringbuf& operator=(basic_stringbuf&& __rhs); #endif void swap(basic_stringbuf& __rhs); @@ -255,7 +255,7 @@ basic_stringbuf<_CharT, _Traits, _Allocator>::basic_stringbuf(const string_type& str(__s); } -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES +#ifndef _LIBCPP_CXX03_LANG template basic_stringbuf<_CharT, _Traits, _Allocator>::basic_stringbuf(basic_stringbuf&& __rhs) @@ -346,7 +346,7 @@ basic_stringbuf<_CharT, _Traits, _Allocator>::operator=(basic_stringbuf&& __rhs) return *this; } -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES +#endif // _LIBCPP_CXX03_LANG template void @@ -641,13 +641,13 @@ public: inline _LIBCPP_INLINE_VISIBILITY explicit basic_istringstream(const string_type& __s, ios_base::openmode __wch = ios_base::in); -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES +#ifndef _LIBCPP_CXX03_LANG inline _LIBCPP_INLINE_VISIBILITY basic_istringstream(basic_istringstream&& __rhs); // 27.8.2.2 Assign and swap: basic_istringstream& operator=(basic_istringstream&& __rhs); -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES +#endif // _LIBCPP_CXX03_LANG inline _LIBCPP_INLINE_VISIBILITY void swap(basic_istringstream& __rhs); @@ -675,7 +675,7 @@ basic_istringstream<_CharT, _Traits, _Allocator>::basic_istringstream(const stri { } -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES +#ifndef _LIBCPP_CXX03_LANG template basic_istringstream<_CharT, _Traits, _Allocator>::basic_istringstream(basic_istringstream&& __rhs) @@ -694,7 +694,7 @@ basic_istringstream<_CharT, _Traits, _Allocator>::operator=(basic_istringstream& return *this; } -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES +#endif // _LIBCPP_CXX03_LANG template void basic_istringstream<_CharT, _Traits, _Allocator>::swap(basic_istringstream& __rhs) @@ -758,13 +758,13 @@ public: inline _LIBCPP_INLINE_VISIBILITY explicit basic_ostringstream(const string_type& __s, ios_base::openmode __wch = ios_base::out); -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES +#ifndef _LIBCPP_CXX03_LANG inline _LIBCPP_INLINE_VISIBILITY basic_ostringstream(basic_ostringstream&& __rhs); // 27.8.2.2 Assign and swap: basic_ostringstream& operator=(basic_ostringstream&& __rhs); -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES +#endif // _LIBCPP_CXX03_LANG inline _LIBCPP_INLINE_VISIBILITY void swap(basic_ostringstream& __rhs); @@ -792,7 +792,7 @@ basic_ostringstream<_CharT, _Traits, _Allocator>::basic_ostringstream(const stri { } -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES +#ifndef _LIBCPP_CXX03_LANG template basic_ostringstream<_CharT, _Traits, _Allocator>::basic_ostringstream(basic_ostringstream&& __rhs) @@ -811,7 +811,7 @@ basic_ostringstream<_CharT, _Traits, _Allocator>::operator=(basic_ostringstream& return *this; } -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES +#endif // _LIBCPP_CXX03_LANG template void @@ -877,13 +877,13 @@ public: inline _LIBCPP_INLINE_VISIBILITY explicit basic_stringstream(const string_type& __s, ios_base::openmode __wch = ios_base::in | ios_base::out); -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES +#ifndef _LIBCPP_CXX03_LANG inline _LIBCPP_INLINE_VISIBILITY basic_stringstream(basic_stringstream&& __rhs); // 27.8.2.2 Assign and swap: basic_stringstream& operator=(basic_stringstream&& __rhs); -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES +#endif // _LIBCPP_CXX03_LANG inline _LIBCPP_INLINE_VISIBILITY void swap(basic_stringstream& __rhs); @@ -911,7 +911,7 @@ basic_stringstream<_CharT, _Traits, _Allocator>::basic_stringstream(const string { } -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES +#ifndef _LIBCPP_CXX03_LANG template basic_stringstream<_CharT, _Traits, _Allocator>::basic_stringstream(basic_stringstream&& __rhs) @@ -930,7 +930,7 @@ basic_stringstream<_CharT, _Traits, _Allocator>::operator=(basic_stringstream&& return *this; } -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES +#endif // _LIBCPP_CXX03_LANG template void @@ -972,4 +972,6 @@ basic_stringstream<_CharT, _Traits, _Allocator>::str(const string_type& __s) _LIBCPP_END_NAMESPACE_STD +_LIBCPP_POP_MACROS + #endif // _LIBCPP_SSTREAM diff --git a/include/stack b/include/stack index c797ea5ec..b2d4e2395 100644 --- a/include/stack +++ b/include/stack @@ -126,29 +126,28 @@ public: _LIBCPP_INLINE_VISIBILITY stack(const stack& __q) : c(__q.c) {} -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES + _LIBCPP_INLINE_VISIBILITY + stack& operator=(const stack& __q) {c = __q.c; return *this;} + + +#ifndef _LIBCPP_CXX03_LANG _LIBCPP_INLINE_VISIBILITY stack(stack&& __q) _NOEXCEPT_(is_nothrow_move_constructible::value) : c(_VSTD::move(__q.c)) {} -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES - _LIBCPP_INLINE_VISIBILITY - stack& operator=(const stack& __q) {c = __q.c; return *this;} - -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES _LIBCPP_INLINE_VISIBILITY stack& operator=(stack&& __q) _NOEXCEPT_(is_nothrow_move_assignable::value) {c = _VSTD::move(__q.c); return *this;} -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES + + _LIBCPP_INLINE_VISIBILITY + explicit stack(container_type&& __c) : c(_VSTD::move(__c)) {} +#endif // _LIBCPP_CXX03_LANG _LIBCPP_INLINE_VISIBILITY explicit stack(const container_type& __c) : c(__c) {} -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES - _LIBCPP_INLINE_VISIBILITY - explicit stack(container_type&& __c) : c(_VSTD::move(__c)) {} -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES + template _LIBCPP_INLINE_VISIBILITY explicit stack(const _Alloc& __a, @@ -167,7 +166,7 @@ public: typename enable_if::value>::type* = 0) : c(__s.c, __a) {} -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES +#ifndef _LIBCPP_CXX03_LANG template _LIBCPP_INLINE_VISIBILITY stack(container_type&& __c, const _Alloc& __a, @@ -180,7 +179,7 @@ public: typename enable_if::value>::type* = 0) : c(_VSTD::move(__s.c), __a) {} -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES +#endif // _LIBCPP_CXX03_LANG _LIBCPP_INLINE_VISIBILITY bool empty() const {return c.empty();} @@ -193,10 +192,10 @@ public: _LIBCPP_INLINE_VISIBILITY void push(const value_type& __v) {c.push_back(__v);} -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES +#ifndef _LIBCPP_CXX03_LANG _LIBCPP_INLINE_VISIBILITY void push(value_type&& __v) {c.push_back(_VSTD::move(__v));} -#ifndef _LIBCPP_HAS_NO_VARIADICS + template _LIBCPP_INLINE_VISIBILITY #if _LIBCPP_STD_VER > 14 @@ -206,8 +205,8 @@ public: void emplace(_Args&&... __args) { c.emplace_back(_VSTD::forward<_Args>(__args)...);} #endif -#endif // _LIBCPP_HAS_NO_VARIADICS -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES +#endif // _LIBCPP_CXX03_LANG + _LIBCPP_INLINE_VISIBILITY void pop() {c.pop_back();} diff --git a/include/stdexcept b/include/stdexcept index d501d0916..95a96cc07 100644 --- a/include/stdexcept +++ b/include/stdexcept @@ -61,9 +61,9 @@ class _LIBCPP_HIDDEN __libcpp_refstring bool __uses_refcount() const; public: - explicit __libcpp_refstring(const char* msg); - __libcpp_refstring(const __libcpp_refstring& s) _NOEXCEPT; - __libcpp_refstring& operator=(const __libcpp_refstring& s) _NOEXCEPT; + explicit __libcpp_refstring(const char* __msg); + __libcpp_refstring(const __libcpp_refstring& __s) _NOEXCEPT; + __libcpp_refstring& operator=(const __libcpp_refstring& __s) _NOEXCEPT; ~__libcpp_refstring(); const char* c_str() const _NOEXCEPT {return __imp_;} diff --git a/include/stdio.h b/include/stdio.h index 56fb2d83b..f12417640 100644 --- a/include/stdio.h +++ b/include/stdio.h @@ -110,9 +110,9 @@ void perror(const char* s); #ifdef __cplusplus // snprintf -#if defined(_LIBCPP_MSVCRT) -extern "C++" { -#include "support/win32/support.h" +#if defined(_LIBCPP_MSVCRT_LIKE) +extern "C" { +int vasprintf(char **sptr, const char *__restrict fmt, va_list ap); } #endif diff --git a/include/stdlib.h b/include/stdlib.h index 12fd676a1..f11c5e762 100644 --- a/include/stdlib.h +++ b/include/stdlib.h @@ -97,10 +97,6 @@ void *aligned_alloc(size_t alignment, size_t size); // C11 extern "C++" { -#ifdef _LIBCPP_MSVCRT -#include "support/win32/locale_win32.h" -#endif // _LIBCPP_MSVCRT - #undef abs #undef div #undef labs diff --git a/include/streambuf b/include/streambuf index 86070659a..a10ce1bf5 100644 --- a/include/streambuf +++ b/include/streambuf @@ -116,6 +116,9 @@ protected: #pragma GCC system_header #endif +_LIBCPP_PUSH_MACROS +#include <__undef_macros> + _LIBCPP_BEGIN_NAMESPACE_STD template @@ -476,12 +479,16 @@ basic_streambuf<_CharT, _Traits>::overflow(int_type) return traits_type::eof(); } +#ifndef _LIBCPP_AVAILABILITY_NO_STREAMS_EXTERN_TEMPLATE _LIBCPP_EXTERN_TEMPLATE(class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS basic_streambuf) _LIBCPP_EXTERN_TEMPLATE(class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS basic_streambuf) _LIBCPP_EXTERN_TEMPLATE(class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS basic_ios) _LIBCPP_EXTERN_TEMPLATE(class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS basic_ios) +#endif _LIBCPP_END_NAMESPACE_STD +_LIBCPP_POP_MACROS + #endif // _LIBCPP_STEAMBUF diff --git a/include/string b/include/string index e1c64faf9..accf1ce27 100644 --- a/include/string +++ b/include/string @@ -484,14 +484,16 @@ basic_string operator "" s( const char32_t *str, size_t len ); // C++1 #include #endif -#include <__undef_min_max> - #include <__debug> #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) #pragma GCC system_header #endif +_LIBCPP_PUSH_MACROS +#include <__undef_macros> + + _LIBCPP_BEGIN_NAMESPACE_STD // fpos @@ -637,7 +639,7 @@ public: typedef basic_string __self; typedef basic_string_view<_CharT, _Traits> __self_view; typedef _Traits traits_type; - typedef typename traits_type::char_type value_type; + typedef _CharT value_type; typedef _Allocator allocator_type; typedef allocator_traits __alloc_traits; typedef typename __alloc_traits::size_type size_type; @@ -648,7 +650,7 @@ public: typedef typename __alloc_traits::const_pointer const_pointer; static_assert(is_pod::value, "Character type of basic_string must be a POD"); - static_assert((is_same<_CharT, value_type>::value), + static_assert((is_same<_CharT, typename traits_type::char_type>::value), "traits_type::char_type must be the same type as CharT"); static_assert((is_same::value), "Allocator::value_type must be same type as value_type"); @@ -763,7 +765,7 @@ public: basic_string(const basic_string& __str); basic_string(const basic_string& __str, const allocator_type& __a); -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES +#ifndef _LIBCPP_CXX03_LANG _LIBCPP_INLINE_VISIBILITY basic_string(basic_string&& __str) #if _LIBCPP_STD_VER <= 14 @@ -774,7 +776,7 @@ public: _LIBCPP_INLINE_VISIBILITY basic_string(basic_string&& __str, const allocator_type& __a); -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES +#endif // _LIBCPP_CXX03_LANG _LIBCPP_INLINE_VISIBILITY basic_string(const _CharT* __s); _LIBCPP_INLINE_VISIBILITY basic_string(const _CharT* __s, const _Allocator& __a); @@ -806,12 +808,12 @@ public: template _LIBCPP_INLINE_VISIBILITY basic_string(_InputIterator __first, _InputIterator __last, const allocator_type& __a); -#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS +#ifndef _LIBCPP_CXX03_LANG _LIBCPP_INLINE_VISIBILITY basic_string(initializer_list<_CharT> __il); _LIBCPP_INLINE_VISIBILITY basic_string(initializer_list<_CharT> __il, const _Allocator& __a); -#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS +#endif // _LIBCPP_CXX03_LANG inline ~basic_string(); @@ -825,17 +827,15 @@ public: #endif _LIBCPP_INLINE_VISIBILITY basic_string& operator=(__self_view __sv) {return assign(__sv);} -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES +#ifndef _LIBCPP_CXX03_LANG _LIBCPP_INLINE_VISIBILITY basic_string& operator=(basic_string&& __str) _NOEXCEPT_((__noexcept_move_assign_container<_Allocator, __alloc_traits>::value)); + _LIBCPP_INLINE_VISIBILITY + basic_string& operator=(initializer_list __il) {return assign(__il.begin(), __il.size());} #endif _LIBCPP_INLINE_VISIBILITY basic_string& operator=(const value_type* __s) {return assign(__s);} basic_string& operator=(value_type __c); -#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS - _LIBCPP_INLINE_VISIBILITY - basic_string& operator=(initializer_list __il) {return assign(__il.begin(), __il.size());} -#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS #if _LIBCPP_DEBUG_LEVEL >= 2 _LIBCPP_INLINE_VISIBILITY @@ -901,7 +901,7 @@ public: void resize(size_type __n, value_type __c); _LIBCPP_INLINE_VISIBILITY void resize(size_type __n) {resize(__n, value_type());} - void reserve(size_type res_arg = 0); + void reserve(size_type __res_arg = 0); _LIBCPP_INLINE_VISIBILITY void shrink_to_fit() _NOEXCEPT {reserve();} _LIBCPP_INLINE_VISIBILITY @@ -918,9 +918,9 @@ public: _LIBCPP_INLINE_VISIBILITY basic_string& operator+=(__self_view __sv) {return append(__sv);} _LIBCPP_INLINE_VISIBILITY basic_string& operator+=(const value_type* __s) {return append(__s);} _LIBCPP_INLINE_VISIBILITY basic_string& operator+=(value_type __c) {push_back(__c); return *this;} -#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS +#ifndef _LIBCPP_CXX03_LANG _LIBCPP_INLINE_VISIBILITY basic_string& operator+=(initializer_list __il) {return append(__il);} -#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS +#endif // _LIBCPP_CXX03_LANG _LIBCPP_INLINE_VISIBILITY basic_string& append(const basic_string& __str); @@ -968,10 +968,10 @@ public: return __append_forward_unsafe(__first, __last); } -#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS +#ifndef _LIBCPP_CXX03_LANG _LIBCPP_INLINE_VISIBILITY basic_string& append(initializer_list __il) {return append(__il.begin(), __il.size());} -#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS +#endif // _LIBCPP_CXX03_LANG void push_back(value_type __c); _LIBCPP_INLINE_VISIBILITY @@ -985,11 +985,11 @@ public: basic_string& assign(__self_view __sv) { return assign(__sv.data(), __sv.size()); } _LIBCPP_INLINE_VISIBILITY basic_string& assign(const basic_string& __str) { return *this = __str; } -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES +#ifndef _LIBCPP_CXX03_LANG _LIBCPP_INLINE_VISIBILITY - basic_string& assign(basic_string&& str) + basic_string& assign(basic_string&& __str) _NOEXCEPT_((__noexcept_move_assign_container<_Allocator, __alloc_traits>::value)) - {*this = _VSTD::move(str); return *this;} + {*this = _VSTD::move(__str); return *this;} #endif basic_string& assign(const basic_string& __str, size_type __pos, size_type __n=npos); template @@ -999,7 +999,7 @@ public: __can_be_converted_to_string_view<_CharT, _Traits, _Tp>::value, basic_string& >::type - assign(const _Tp & __t, size_type pos, size_type n=npos); + assign(const _Tp & __t, size_type __pos, size_type __n=npos); basic_string& assign(const value_type* __s, size_type __n); basic_string& assign(const value_type* __s); basic_string& assign(size_type __n, value_type __c); @@ -1021,10 +1021,10 @@ public: basic_string& >::type assign(_ForwardIterator __first, _ForwardIterator __last); -#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS +#ifndef _LIBCPP_CXX03_LANG _LIBCPP_INLINE_VISIBILITY basic_string& assign(initializer_list __il) {return assign(__il.begin(), __il.size());} -#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS +#endif // _LIBCPP_CXX03_LANG _LIBCPP_INLINE_VISIBILITY basic_string& insert(size_type __pos1, const basic_string& __str); @@ -1063,11 +1063,11 @@ public: iterator >::type insert(const_iterator __pos, _ForwardIterator __first, _ForwardIterator __last); -#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS +#ifndef _LIBCPP_CXX03_LANG _LIBCPP_INLINE_VISIBILITY iterator insert(const_iterator __pos, initializer_list __il) {return insert(__pos, __il.begin(), __il.end());} -#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS +#endif // _LIBCPP_CXX03_LANG basic_string& erase(size_type __pos = 0, size_type __n = npos); _LIBCPP_INLINE_VISIBILITY @@ -1109,11 +1109,11 @@ public: basic_string& >::type replace(const_iterator __i1, const_iterator __i2, _InputIterator __j1, _InputIterator __j2); -#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS +#ifndef _LIBCPP_CXX03_LANG _LIBCPP_INLINE_VISIBILITY basic_string& replace(const_iterator __i1, const_iterator __i2, initializer_list __il) {return replace(__i1, __i2, __il.begin(), __il.end());} -#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS +#endif // _LIBCPP_CXX03_LANG size_type copy(value_type* __s, size_type __n, size_type __pos = 0) const; _LIBCPP_INLINE_VISIBILITY @@ -1338,15 +1338,15 @@ private: __align_it (__s+1)) - 1;} - inline _LIBCPP_EXTERN_TEMPLATE_INLINE_VISIBILITY + inline void __init(const value_type* __s, size_type __sz, size_type __reserve); - inline _LIBCPP_EXTERN_TEMPLATE_INLINE_VISIBILITY + inline void __init(const value_type* __s, size_type __sz); - inline _LIBCPP_EXTERN_TEMPLATE_INLINE_VISIBILITY + inline void __init(size_type __n, value_type __c); template - inline _LIBCPP_EXTERN_TEMPLATE_INLINE_VISIBILITY + inline typename enable_if < __is_exactly_input_iterator<_InputIterator>::value, @@ -1355,7 +1355,7 @@ private: __init(_InputIterator __first, _InputIterator __last); template - inline _LIBCPP_EXTERN_TEMPLATE_INLINE_VISIBILITY + inline typename enable_if < __is_forward_iterator<_ForwardIterator>::value, @@ -1408,7 +1408,7 @@ private: void __copy_assign_alloc(const basic_string&, false_type) _NOEXCEPT {} -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES +#ifndef _LIBCPP_CXX03_LANG _LIBCPP_INLINE_VISIBILITY void __move_assign(basic_string& __str, false_type) _NOEXCEPT_(__alloc_traits::is_always_equal::value); @@ -1511,7 +1511,7 @@ basic_string<_CharT, _Traits, _Allocator>::basic_string(const allocator_type& __ #else _NOEXCEPT #endif -: __r_(__a) +: __r_(__second_tag(), __a) { #if _LIBCPP_DEBUG_LEVEL >= 2 __get_db()->__insert_c(this); @@ -1582,7 +1582,7 @@ basic_string<_CharT, _Traits, _Allocator>::basic_string(const _CharT* __s) template inline _LIBCPP_INLINE_VISIBILITY basic_string<_CharT, _Traits, _Allocator>::basic_string(const _CharT* __s, const _Allocator& __a) - : __r_(__a) + : __r_(__second_tag(), __a) { _LIBCPP_ASSERT(__s != nullptr, "basic_string(const char*, allocator) detected nullptr"); __init(__s, traits_type::length(__s)); @@ -1605,7 +1605,7 @@ basic_string<_CharT, _Traits, _Allocator>::basic_string(const _CharT* __s, size_ template inline _LIBCPP_INLINE_VISIBILITY basic_string<_CharT, _Traits, _Allocator>::basic_string(const _CharT* __s, size_type __n, const _Allocator& __a) - : __r_(__a) + : __r_(__second_tag(), __a) { _LIBCPP_ASSERT(__n == 0 || __s != nullptr, "basic_string(const char*, n, allocator) detected nullptr"); __init(__s, __n); @@ -1616,7 +1616,7 @@ basic_string<_CharT, _Traits, _Allocator>::basic_string(const _CharT* __s, size_ template basic_string<_CharT, _Traits, _Allocator>::basic_string(const basic_string& __str) - : __r_(__alloc_traits::select_on_container_copy_construction(__str.__alloc())) + : __r_(__second_tag(), __alloc_traits::select_on_container_copy_construction(__str.__alloc())) { if (!__str.__is_long()) __r_.first().__r = __str.__r_.first().__r; @@ -1630,7 +1630,7 @@ basic_string<_CharT, _Traits, _Allocator>::basic_string(const basic_string& __st template basic_string<_CharT, _Traits, _Allocator>::basic_string( const basic_string& __str, const allocator_type& __a) - : __r_(__a) + : __r_(__second_tag(), __a) { if (!__str.__is_long()) __r_.first().__r = __str.__r_.first().__r; @@ -1641,7 +1641,7 @@ basic_string<_CharT, _Traits, _Allocator>::basic_string( #endif } -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES +#ifndef _LIBCPP_CXX03_LANG template inline _LIBCPP_INLINE_VISIBILITY @@ -1664,7 +1664,7 @@ basic_string<_CharT, _Traits, _Allocator>::basic_string(basic_string&& __str) template inline _LIBCPP_INLINE_VISIBILITY basic_string<_CharT, _Traits, _Allocator>::basic_string(basic_string&& __str, const allocator_type& __a) - : __r_(__a) + : __r_(__second_tag(), __a) { if (__str.__is_long() && __a != __str.__alloc()) // copy, not move __init(_VSTD::__to_raw_pointer(__str.__get_long_pointer()), __str.__get_long_size()); @@ -1680,7 +1680,7 @@ basic_string<_CharT, _Traits, _Allocator>::basic_string(basic_string&& __str, co #endif } -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES +#endif // _LIBCPP_CXX03_LANG template void @@ -1719,7 +1719,7 @@ basic_string<_CharT, _Traits, _Allocator>::basic_string(size_type __n, _CharT __ template inline _LIBCPP_INLINE_VISIBILITY basic_string<_CharT, _Traits, _Allocator>::basic_string(size_type __n, _CharT __c, const _Allocator& __a) - : __r_(__a) + : __r_(__second_tag(), __a) { __init(__n, __c); #if _LIBCPP_DEBUG_LEVEL >= 2 @@ -1731,7 +1731,7 @@ template basic_string<_CharT, _Traits, _Allocator>::basic_string(const basic_string& __str, size_type __pos, size_type __n, const _Allocator& __a) - : __r_(__a) + : __r_(__second_tag(), __a) { size_type __str_sz = __str.size(); if (__pos > __str_sz) @@ -1746,7 +1746,7 @@ template inline _LIBCPP_INLINE_VISIBILITY basic_string<_CharT, _Traits, _Allocator>::basic_string(const basic_string& __str, size_type __pos, const _Allocator& __a) - : __r_(__a) + : __r_(__second_tag(), __a) { size_type __str_sz = __str.size(); if (__pos > __str_sz) @@ -1762,7 +1762,7 @@ template basic_string<_CharT, _Traits, _Allocator>::basic_string( const _Tp& __t, size_type __pos, size_type __n, const allocator_type& __a, typename enable_if<__can_be_converted_to_string_view<_CharT, _Traits, _Tp>::value, void>::type *) - : __r_(__a) + : __r_(__second_tag(), __a) { __self_view __sv = __self_view(__t).substr(__pos, __n); __init(__sv.data(), __sv.size()); @@ -1784,7 +1784,7 @@ basic_string<_CharT, _Traits, _Allocator>::basic_string(__self_view __sv) template inline _LIBCPP_INLINE_VISIBILITY basic_string<_CharT, _Traits, _Allocator>::basic_string(__self_view __sv, const _Allocator& __a) - : __r_(__a) + : __r_(__second_tag(), __a) { __init(__sv.data(), __sv.size()); #if _LIBCPP_DEBUG_LEVEL >= 2 @@ -1866,7 +1866,7 @@ template inline _LIBCPP_INLINE_VISIBILITY basic_string<_CharT, _Traits, _Allocator>::basic_string(_InputIterator __first, _InputIterator __last, const allocator_type& __a) - : __r_(__a) + : __r_(__second_tag(), __a) { __init(__first, __last); #if _LIBCPP_DEBUG_LEVEL >= 2 @@ -1874,7 +1874,7 @@ basic_string<_CharT, _Traits, _Allocator>::basic_string(_InputIterator __first, #endif } -#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS +#ifndef _LIBCPP_CXX03_LANG template inline _LIBCPP_INLINE_VISIBILITY @@ -1889,10 +1889,10 @@ basic_string<_CharT, _Traits, _Allocator>::basic_string( template inline _LIBCPP_INLINE_VISIBILITY + basic_string<_CharT, _Traits, _Allocator>::basic_string( initializer_list<_CharT> __il, const _Allocator& __a) - - : __r_(__a) + : __r_(__second_tag(), __a) { __init(__il.begin(), __il.end()); #if _LIBCPP_DEBUG_LEVEL >= 2 @@ -1900,7 +1900,7 @@ basic_string<_CharT, _Traits, _Allocator>::basic_string( #endif } -#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS +#endif // _LIBCPP_CXX03_LANG template basic_string<_CharT, _Traits, _Allocator>::~basic_string() @@ -2049,7 +2049,7 @@ basic_string<_CharT, _Traits, _Allocator>::operator=(const basic_string& __str) return *this; } -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES +#ifndef _LIBCPP_CXX03_LANG template inline _LIBCPP_INLINE_VISIBILITY @@ -2276,7 +2276,9 @@ basic_string<_CharT, _Traits, _Allocator>::__append_forward_unsafe( size_type __n = static_cast(_VSTD::distance(__first, __last)); if (__n) { - if ( __ptr_in_range(&*__first, data(), data() + size())) + typedef typename iterator_traits<_ForwardIterator>::reference _CharRef; + _CharRef __tmp_ref = *__first; + if (__ptr_in_range(_VSTD::addressof(__tmp_ref), data(), data() + size())) { const basic_string __temp (__first, __last, __alloc()); append(__temp.data(), __temp.size()); @@ -2440,7 +2442,9 @@ basic_string<_CharT, _Traits, _Allocator>::insert(const_iterator __pos, _Forward size_type __n = static_cast(_VSTD::distance(__first, __last)); if (__n) { - if ( __ptr_in_range(&*__first, data(), data() + size())) + typedef typename iterator_traits<_ForwardIterator>::reference _CharRef; + _CharRef __tmp_char = *__first; + if (__ptr_in_range(_VSTD::addressof(__tmp_char), data(), data() + size())) { const basic_string __temp(__first, __last, __alloc()); return insert(__pos, __temp.data(), __temp.data() + __temp.size()); @@ -3786,7 +3790,7 @@ operator+(const basic_string<_CharT, _Traits, _Allocator>& __lhs, _CharT __rhs) return __r; } -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES +#ifndef _LIBCPP_CXX03_LANG template inline _LIBCPP_INLINE_VISIBILITY @@ -3846,7 +3850,7 @@ operator+(basic_string<_CharT, _Traits, _Allocator>&& __lhs, _CharT __rhs) return _VSTD::move(__lhs); } -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES +#endif // _LIBCPP_CXX03_LANG // swap @@ -3948,7 +3952,7 @@ basic_istream<_CharT, _Traits>& getline(basic_istream<_CharT, _Traits>& __is, basic_string<_CharT, _Traits, _Allocator>& __str); -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES +#ifndef _LIBCPP_CXX03_LANG template inline _LIBCPP_INLINE_VISIBILITY @@ -3962,7 +3966,7 @@ basic_istream<_CharT, _Traits>& getline(basic_istream<_CharT, _Traits>&& __is, basic_string<_CharT, _Traits, _Allocator>& __str); -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES +#endif // _LIBCPP_CXX03_LANG #if _LIBCPP_DEBUG_LEVEL >= 2 @@ -4039,4 +4043,6 @@ _LIBCPP_EXTERN_TEMPLATE(string operator+, allocator - #include <__string> #include #include @@ -179,6 +177,10 @@ namespace std { #pragma GCC system_header #endif +_LIBCPP_PUSH_MACROS +#include <__undef_macros> + + _LIBCPP_BEGIN_NAMESPACE_STD template > @@ -199,6 +201,10 @@ public: typedef ptrdiff_t difference_type; static _LIBCPP_CONSTEXPR const size_type npos = -1; // size_type(-1); + static_assert(is_pod::value, "Character type of basic_string_view must be a POD"); + static_assert((is_same<_CharT, typename traits_type::char_type>::value), + "traits_type::char_type must be the same type as CharT"); + // [string.view.cons], construct/copy _LIBCPP_CONSTEXPR _LIBCPP_INLINE_VISIBILITY basic_string_view() _NOEXCEPT : __data (nullptr), __size(0) {} @@ -288,13 +294,6 @@ public: const_pointer data() const _NOEXCEPT { return __data; } // [string.view.modifiers], modifiers: - _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY - void clear() _NOEXCEPT - { - __data = nullptr; - __size = 0; - } - _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY void remove_prefix(size_type __n) _NOEXCEPT { @@ -357,9 +356,9 @@ public: _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY int compare( size_type __pos1, size_type __n1, - basic_string_view _sv, size_type __pos2, size_type __n2) const + basic_string_view __sv, size_type __pos2, size_type __n2) const { - return substr(__pos1, __n1).compare(_sv.substr(__pos2, __n2)); + return substr(__pos1, __n1).compare(__sv.substr(__pos2, __n2)); } _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY @@ -788,4 +787,6 @@ inline namespace literals #endif _LIBCPP_END_NAMESPACE_STD +_LIBCPP_POP_MACROS + #endif // _LIBCPP_STRING_VIEW diff --git a/include/strstream b/include/strstream index 81eef2ab4..b00b9d830 100644 --- a/include/strstream +++ b/include/strstream @@ -151,12 +151,12 @@ public: strstreambuf(unsigned char* __gnext, streamsize __n, unsigned char* __pbeg = 0); strstreambuf(const unsigned char* __gnext, streamsize __n); -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES +#ifndef _LIBCPP_CXX03_LANG _LIBCPP_INLINE_VISIBILITY strstreambuf(strstreambuf&& __rhs); _LIBCPP_INLINE_VISIBILITY strstreambuf& operator=(strstreambuf&& __rhs); -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES +#endif // _LIBCPP_CXX03_LANG virtual ~strstreambuf(); @@ -191,7 +191,7 @@ private: void __init(char* __gnext, streamsize __n, char* __pbeg); }; -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES +#ifndef _LIBCPP_CXX03_LANG inline _LIBCPP_INLINE_VISIBILITY strstreambuf::strstreambuf(strstreambuf&& __rhs) @@ -226,7 +226,7 @@ strstreambuf::operator=(strstreambuf&& __rhs) return *this; } -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES +#endif // _LIBCPP_CXX03_LANG class _LIBCPP_TYPE_VIS istrstream : public istream @@ -245,7 +245,7 @@ public: istrstream(char* __s, streamsize __n) : istream(&__sb_), __sb_(__s, __n) {} -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES +#ifndef _LIBCPP_CXX03_LANG _LIBCPP_INLINE_VISIBILITY istrstream(istrstream&& __rhs) : istream(_VSTD::move(__rhs)), @@ -261,7 +261,7 @@ public: __sb_ = _VSTD::move(__rhs.__sb_); return *this; } -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES +#endif // _LIBCPP_CXX03_LANG virtual ~istrstream(); @@ -294,7 +294,7 @@ public: __sb_(__s, __n, __s + (__mode & ios::app ? strlen(__s) : 0)) {} -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES +#ifndef _LIBCPP_CXX03_LANG _LIBCPP_INLINE_VISIBILITY ostrstream(ostrstream&& __rhs) : ostream(_VSTD::move(__rhs)), @@ -310,7 +310,7 @@ public: __sb_ = _VSTD::move(__rhs.__sb_); return *this; } -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES +#endif // _LIBCPP_CXX03_LANG virtual ~ostrstream(); @@ -354,7 +354,7 @@ public: __sb_(__s, __n, __s + (__mode & ios::app ? strlen(__s) : 0)) {} -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES +#ifndef _LIBCPP_CXX03_LANG _LIBCPP_INLINE_VISIBILITY strstream(strstream&& __rhs) : iostream(_VSTD::move(__rhs)), @@ -370,7 +370,7 @@ public: __sb_ = _VSTD::move(__rhs.__sb_); return *this; } -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES +#endif // _LIBCPP_CXX03_LANG virtual ~strstream(); diff --git a/include/support/fuchsia/xlocale.h b/include/support/fuchsia/xlocale.h new file mode 100644 index 000000000..1de2fca28 --- /dev/null +++ b/include/support/fuchsia/xlocale.h @@ -0,0 +1,23 @@ +// -*- C++ -*- +//===------------------- support/fuchsia/xlocale.h ------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +#ifndef _LIBCPP_SUPPORT_FUCHSIA_XLOCALE_H +#define _LIBCPP_SUPPORT_FUCHSIA_XLOCALE_H + +#if defined(__Fuchsia__) + +#include +#include +#include +#include + +#endif // defined(__Fuchsia__) + +#endif // _LIBCPP_SUPPORT_FUCHSIA_XLOCALE_H diff --git a/include/support/win32/limits_win32.h b/include/support/win32/limits_msvc_win32.h similarity index 80% rename from include/support/win32/limits_win32.h rename to include/support/win32/limits_msvc_win32.h index 406cd3025..1ab2e0b6d 100644 --- a/include/support/win32/limits_win32.h +++ b/include/support/win32/limits_msvc_win32.h @@ -1,5 +1,5 @@ // -*- C++ -*- -//===--------------------- support/win32/limits_win32.h -------------------===// +//===------------------ support/win32/limits_msvc_win32.h -----------------===// // // The LLVM Compiler Infrastructure // @@ -8,17 +8,21 @@ // //===----------------------------------------------------------------------===// -#ifndef _LIBCPP_SUPPORT_WIN32_LIMITS_WIN32_H -#define _LIBCPP_SUPPORT_WIN32_LIMITS_WIN32_H +#ifndef _LIBCPP_SUPPORT_WIN32_LIMITS_MSVC_WIN32_H +#define _LIBCPP_SUPPORT_WIN32_LIMITS_MSVC_WIN32_H #if !defined(_LIBCPP_MSVCRT) #error "This header complements the Microsoft C Runtime library, and should not be included otherwise." -#else +#endif +#if defined(__clang__) +#error "This header should only be included when using Microsofts C1XX frontend" +#endif #include // CHAR_BIT #include // limit constants +#include // HUGE_VAL +#include // internal MSVC header providing the needed functionality -#if ! defined(__clang__) #define __CHAR_BIT__ CHAR_BIT #define __FLT_MANT_DIG__ FLT_MANT_DIG @@ -61,19 +65,8 @@ #define __LDBL_DENORM_MIN__ 3.64519953188247460253e-4951L // __builtin replacements/workarounds -#include // HUGE_VAL -#include // internal MSVC header providing the needed functionality -#define __builtin_huge_val() HUGE_VAL -#define __builtin_huge_valf() _FInf._Float #define __builtin_huge_vall() _LInf._Long_double -#define __builtin_nan(__dummy) _Nan._Double -#define __builtin_nanf(__dummy) _FNan._Float #define __builtin_nanl(__dummmy) _LNan._Long_double -#define __builtin_nans(__dummy) _Snan._Double -#define __builtin_nansf(__dummy) _FSnan._Float #define __builtin_nansl(__dummy) _LSnan._Long_double -#endif // ! defined(__clang__) -#endif // _LIBCPP_MSVCRT - -#endif // _LIBCPP_SUPPORT_WIN32_LIMITS_WIN32_H +#endif // _LIBCPP_SUPPORT_WIN32_LIMITS_MSVC_WIN32_H diff --git a/include/support/win32/locale_mgmt_win32.h b/include/support/win32/locale_mgmt_win32.h deleted file mode 100644 index b3316d625..000000000 --- a/include/support/win32/locale_mgmt_win32.h +++ /dev/null @@ -1,33 +0,0 @@ -// -*- C++ -*- -//===----------------- support/win32/locale_mgmt_win32.h ------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -#ifndef _LIBCPP_SUPPORT_WIN32_LOCALE_MGMT_WIN32_H -#define _LIBCPP_SUPPORT_WIN32_LOCALE_MGMT_WIN32_H - -#include // _locale_t -#define locale_t _locale_t -#define LC_COLLATE_MASK _M_COLLATE -#define LC_CTYPE_MASK _M_CTYPE -#define LC_MONETARY_MASK _M_MONETARY -#define LC_NUMERIC_MASK _M_NUMERIC -#define LC_TIME_MASK _M_TIME -#define LC_MESSAGES_MASK _M_MESSAGES -#define LC_ALL_MASK ( LC_COLLATE_MASK \ - | LC_CTYPE_MASK \ - | LC_MESSAGES_MASK \ - | LC_MONETARY_MASK \ - | LC_NUMERIC_MASK \ - | LC_TIME_MASK ) -#define freelocale _free_locale -// FIXME: base currently unused. Needs manual work to construct the new locale -locale_t newlocale( int mask, const char * locale, locale_t base ); -locale_t uselocale( locale_t newloc ); - -#endif // _LIBCPP_SUPPORT_WIN32_LOCALE_MGMT_WIN32_H diff --git a/include/support/win32/locale_win32.h b/include/support/win32/locale_win32.h index ebf5bda74..b2b3ac4c7 100644 --- a/include/support/win32/locale_win32.h +++ b/include/support/win32/locale_win32.h @@ -11,16 +11,31 @@ #ifndef _LIBCPP_SUPPORT_WIN32_LOCALE_WIN32_H #define _LIBCPP_SUPPORT_WIN32_LOCALE_WIN32_H -#include - -#if _VC_CRT_MAJOR_VERSION < 14 -// ctype mask table defined in msvcrt.dll -extern "C" unsigned short __declspec(dllimport) _ctype[]; -#endif - -#include "support/win32/support.h" -#include "support/win32/locale_mgmt_win32.h" +#include <__config> #include +#include // _locale_t + +#define LC_COLLATE_MASK _M_COLLATE +#define LC_CTYPE_MASK _M_CTYPE +#define LC_MONETARY_MASK _M_MONETARY +#define LC_NUMERIC_MASK _M_NUMERIC +#define LC_TIME_MASK _M_TIME +#define LC_MESSAGES_MASK _M_MESSAGES +#define LC_ALL_MASK ( LC_COLLATE_MASK \ + | LC_CTYPE_MASK \ + | LC_MESSAGES_MASK \ + | LC_MONETARY_MASK \ + | LC_NUMERIC_MASK \ + | LC_TIME_MASK ) + +#define locale_t _locale_t + +// Locale management functions +#define freelocale _free_locale +// FIXME: base currently unused. Needs manual work to construct the new locale +locale_t newlocale( int mask, const char * locale, locale_t base ); +locale_t uselocale( locale_t newloc ); + lconv *localeconv_l( locale_t loc ); size_t mbrlen_l( const char *__restrict s, size_t n, @@ -37,20 +52,21 @@ size_t wcsnrtombs_l( char *__restrict dst, const wchar_t **__restrict src, size_t nwc, size_t len, mbstate_t *__restrict ps, locale_t loc); wint_t btowc_l( int c, locale_t loc ); int wctob_l( wint_t c, locale_t loc ); -inline _LIBCPP_ALWAYS_INLINE -decltype(MB_CUR_MAX) MB_CUR_MAX_L( locale_t __l ) -{ - return ___mb_cur_max_l_func(__l); -} + +decltype(MB_CUR_MAX) MB_CUR_MAX_L( locale_t __l ); // the *_l functions are prefixed on Windows, only available for msvcr80+, VS2005+ #define mbtowc_l _mbtowc_l #define strtoll_l _strtoi64_l #define strtoull_l _strtoui64_l -#define strtof_l _strtof_l #define strtod_l _strtod_l +#if defined(_LIBCPP_MSVCRT) +#define strtof_l _strtof_l #define strtold_l _strtold_l - +#else +float strtof_l(const char*, char**, locale_t); +long double strtold_l(const char*, char**, locale_t); +#endif inline _LIBCPP_INLINE_VISIBILITY int islower_l(int c, _locale_t loc) @@ -90,10 +106,9 @@ isupper_l(int c, _locale_t loc) #define sprintf_l( __s, __l, __f, ... ) _sprintf_l( __s, __f, __l, __VA_ARGS__ ) #define vsprintf_l( __s, __l, __f, ... ) _vsprintf_l( __s, __f, __l, __VA_ARGS__ ) #define vsnprintf_l( __s, __n, __l, __f, ... ) _vsnprintf_l( __s, __n, __f, __l, __VA_ARGS__ ) -int snprintf_l(char *ret, size_t n, locale_t loc, const char *format, ...); -int asprintf_l( char **ret, locale_t loc, const char *format, ... ); -int vasprintf_l( char **ret, locale_t loc, const char *format, va_list ap ); - +_LIBCPP_FUNC_VIS int snprintf_l(char *ret, size_t n, locale_t loc, const char *format, ...); +_LIBCPP_FUNC_VIS int asprintf_l( char **ret, locale_t loc, const char *format, ... ); +_LIBCPP_FUNC_VIS int vasprintf_l( char **ret, locale_t loc, const char *format, va_list ap ); // not-so-pressing FIXME: use locale to determine blank characters inline int isblank_l( int c, locale_t /*loc*/ ) @@ -105,10 +120,4 @@ inline int iswblank_l( wint_t c, locale_t /*loc*/ ) return ( c == L' ' || c == L'\t' ); } -#if defined(_LIBCPP_MSVCRT) -inline int isblank( int c, locale_t /*loc*/ ) -{ return ( c == ' ' || c == '\t' ); } -inline int iswblank( wint_t c, locale_t /*loc*/ ) -{ return ( c == L' ' || c == L'\t' ); } -#endif // _LIBCPP_MSVCRT #endif // _LIBCPP_SUPPORT_WIN32_LOCALE_WIN32_H diff --git a/include/support/win32/support.h b/include/support/win32/support.h deleted file mode 100644 index f9613445c..000000000 --- a/include/support/win32/support.h +++ /dev/null @@ -1,185 +0,0 @@ -// -*- C++ -*- -//===----------------------- support/win32/support.h ----------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -#ifndef _LIBCPP_SUPPORT_WIN32_SUPPORT_H -#define _LIBCPP_SUPPORT_WIN32_SUPPORT_H - -// Functions and constants used in libc++ that -// are missing from the Windows C library. - -#include // mbstate_t -#include // va_ macros -// "builtins" not implemented here for Clang or GCC as they provide -// implementations. Assuming required for elsewhere else, certainly MSVC. -#if defined(_LIBCPP_COMPILER_MSVC) -#include -#endif -#if defined(_LIBCPP_MSVCRT) -#include -#endif -#define swprintf _snwprintf -#define vswprintf _vsnwprintf - -#ifndef NOMINMAX -#define NOMINMAX -#endif - -// The mingw headers already define these as static. -#ifndef __MINGW32__ -extern "C" { - -int vasprintf(char **sptr, const char *__restrict fmt, va_list ap); -int asprintf(char **sptr, const char *__restrict fmt, ...); -size_t mbsnrtowcs(wchar_t *__restrict dst, const char **__restrict src, - size_t nmc, size_t len, mbstate_t *__restrict ps); -size_t wcsnrtombs(char *__restrict dst, const wchar_t **__restrict src, - size_t nwc, size_t len, mbstate_t *__restrict ps); -} -#endif // __MINGW32__ - -#if defined(_VC_CRT_MAJOR_VERSION) && _VC_CRT_MAJOR_VERSION < 14 -#define snprintf _snprintf -#define _Exit _exit -#endif - -#if defined(_LIBCPP_COMPILER_MSVC) - -// Bit builtin's make these assumptions when calling _BitScanForward/Reverse -// etc. These assumptions are expected to be true for Win32/Win64 which this -// file supports. -static_assert(sizeof(unsigned long long) == 8, ""); -static_assert(sizeof(unsigned long) == 4, ""); -static_assert(sizeof(unsigned int) == 4, ""); - -_LIBCPP_ALWAYS_INLINE int __builtin_popcount(unsigned int x) -{ - // Binary: 0101... - static const unsigned int m1 = 0x55555555; - // Binary: 00110011.. - static const unsigned int m2 = 0x33333333; - // Binary: 4 zeros, 4 ones ... - static const unsigned int m4 = 0x0f0f0f0f; - // The sum of 256 to the power of 0,1,2,3... - static const unsigned int h01 = 0x01010101; - // Put count of each 2 bits into those 2 bits. - x -= (x >> 1) & m1; - // Put count of each 4 bits into those 4 bits. - x = (x & m2) + ((x >> 2) & m2); - // Put count of each 8 bits into those 8 bits. - x = (x + (x >> 4)) & m4; - // Returns left 8 bits of x + (x<<8) + (x<<16) + (x<<24). - return (x * h01) >> 24; -} - -_LIBCPP_ALWAYS_INLINE int __builtin_popcountl(unsigned long x) -{ - return __builtin_popcount(static_cast(x)); -} - -_LIBCPP_ALWAYS_INLINE int __builtin_popcountll(unsigned long long x) -{ - // Binary: 0101... - static const unsigned long long m1 = 0x5555555555555555; - // Binary: 00110011.. - static const unsigned long long m2 = 0x3333333333333333; - // Binary: 4 zeros, 4 ones ... - static const unsigned long long m4 = 0x0f0f0f0f0f0f0f0f; - // The sum of 256 to the power of 0,1,2,3... - static const unsigned long long h01 = 0x0101010101010101; - // Put count of each 2 bits into those 2 bits. - x -= (x >> 1) & m1; - // Put count of each 4 bits into those 4 bits. - x = (x & m2) + ((x >> 2) & m2); - // Put count of each 8 bits into those 8 bits. - x = (x + (x >> 4)) & m4; - // Returns left 8 bits of x + (x<<8) + (x<<16) + (x<<24) + ... - return static_cast((x * h01) >> 56); -} - -// Returns the number of trailing 0-bits in x, starting at the least significant -// bit position. If x is 0, the result is undefined. -_LIBCPP_ALWAYS_INLINE int __builtin_ctzll(unsigned long long mask) -{ - unsigned long where; -// Search from LSB to MSB for first set bit. -// Returns zero if no set bit is found. -#if defined(_LIBCPP_HAS_BITSCAN64) - (defined(_M_AMD64) || defined(__x86_64__)) - if (_BitScanForward64(&where, mask)) - return static_cast(where); -#else - // Win32 doesn't have _BitScanForward64 so emulate it with two 32 bit calls. - // Scan the Low Word. - if (_BitScanForward(&where, static_cast(mask))) - return static_cast(where); - // Scan the High Word. - if (_BitScanForward(&where, static_cast(mask >> 32))) - return static_cast(where + 32); // Create a bit offset from the LSB. -#endif - return 64; -} - -_LIBCPP_ALWAYS_INLINE int __builtin_ctzl(unsigned long mask) -{ - unsigned long where; - // Search from LSB to MSB for first set bit. - // Returns zero if no set bit is found. - if (_BitScanForward(&where, mask)) - return static_cast(where); - return 32; -} - -_LIBCPP_ALWAYS_INLINE int __builtin_ctz(unsigned int mask) -{ - // Win32 and Win64 expectations. - static_assert(sizeof(mask) == 4, ""); - static_assert(sizeof(unsigned long) == 4, ""); - return __builtin_ctzl(static_cast(mask)); -} - -// Returns the number of leading 0-bits in x, starting at the most significant -// bit position. If x is 0, the result is undefined. -_LIBCPP_ALWAYS_INLINE int __builtin_clzll(unsigned long long mask) -{ - unsigned long where; -// BitScanReverse scans from MSB to LSB for first set bit. -// Returns 0 if no set bit is found. -#if defined(_LIBCPP_HAS_BITSCAN64) - if (_BitScanReverse64(&where, mask)) - return static_cast(63 - where); -#else - // Scan the high 32 bits. - if (_BitScanReverse(&where, static_cast(mask >> 32))) - return static_cast(63 - - (where + 32)); // Create a bit offset from the MSB. - // Scan the low 32 bits. - if (_BitScanReverse(&where, static_cast(mask))) - return static_cast(63 - where); -#endif - return 64; // Undefined Behavior. -} - -_LIBCPP_ALWAYS_INLINE int __builtin_clzl(unsigned long mask) -{ - unsigned long where; - // Search from LSB to MSB for first set bit. - // Returns zero if no set bit is found. - if (_BitScanReverse(&where, mask)) - return static_cast(31 - where); - return 32; // Undefined Behavior. -} - -_LIBCPP_ALWAYS_INLINE int __builtin_clz(unsigned int x) -{ - return __builtin_clzl(x); -} -#endif // _LIBCPP_MSVC - -#endif // _LIBCPP_SUPPORT_WIN32_SUPPORT_H diff --git a/include/thread b/include/thread index 94c77e0cb..1b8dca394 100644 --- a/include/thread +++ b/include/thread @@ -95,7 +95,7 @@ void sleep_for(const chrono::duration& rel_time); #include #include #include <__mutex_base> -#ifndef _LIBCPP_HAS_NO_VARIADICS +#ifndef _LIBCPP_CXX03_LANG #include #endif #include <__threading_support> @@ -105,6 +105,9 @@ void sleep_for(const chrono::duration& rel_time); #pragma GCC system_header #endif +_LIBCPP_PUSH_MACROS +#include <__undef_macros> + #define __STDCPP_THREADS__ __cplusplus #ifdef _LIBCPP_HAS_NO_THREADS @@ -261,7 +264,7 @@ struct _LIBCPP_TEMPLATE_VIS hash<__thread_id> : public unary_function<__thread_id, size_t> { _LIBCPP_INLINE_VISIBILITY - size_t operator()(__thread_id __v) const + size_t operator()(__thread_id __v) const _NOEXCEPT { return hash<__libcpp_thread_id>()(__v.__id_); } @@ -291,7 +294,7 @@ public: _LIBCPP_INLINE_VISIBILITY thread() _NOEXCEPT : __t_(_LIBCPP_NULL_THREAD) {} -#ifndef _LIBCPP_HAS_NO_VARIADICS +#ifndef _LIBCPP_CXX03_LANG template _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS explicit thread(_Fp&& __f, _Args&&... __args); -#else // _LIBCPP_HAS_NO_VARIADICS +#else // _LIBCPP_CXX03_LANG template _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS explicit thread(_Fp __f); #endif ~thread(); -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES +#ifndef _LIBCPP_CXX03_LANG _LIBCPP_INLINE_VISIBILITY thread(thread&& __t) _NOEXCEPT : __t_(__t.__t_) {__t.__t_ = _LIBCPP_NULL_THREAD;} _LIBCPP_INLINE_VISIBILITY thread& operator=(thread&& __t) _NOEXCEPT; -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES +#endif // _LIBCPP_CXX03_LANG _LIBCPP_INLINE_VISIBILITY void swap(thread& __t) _NOEXCEPT {_VSTD::swap(__t_, __t.__t_);} @@ -329,7 +332,7 @@ public: static unsigned hardware_concurrency() _NOEXCEPT; }; -#ifndef _LIBCPP_HAS_NO_VARIADICS +#ifndef _LIBCPP_CXX03_LANG template inline _LIBCPP_INLINE_VISIBILITY @@ -369,7 +372,18 @@ thread::thread(_Fp&& __f, _Args&&... __args) __throw_system_error(__ec, "thread constructor failed"); } -#else // _LIBCPP_HAS_NO_VARIADICS +inline +thread& +thread::operator=(thread&& __t) _NOEXCEPT +{ + if (!__libcpp_thread_isnull(&__t_)) + terminate(); + __t_ = __t.__t_; + __t.__t_ = _LIBCPP_NULL_THREAD; + return *this; +} + +#else // _LIBCPP_CXX03_LANG template struct __thread_invoke_pair { @@ -404,22 +418,7 @@ thread::thread(_Fp __f) __throw_system_error(__ec, "thread constructor failed"); } -#endif // _LIBCPP_HAS_NO_VARIADICS - -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES - -inline -thread& -thread::operator=(thread&& __t) _NOEXCEPT -{ - if (!__libcpp_thread_isnull(&__t_)) - terminate(); - __t_ = __t.__t_; - __t.__t_ = _LIBCPP_NULL_THREAD; - return *this; -} - -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES +#endif // _LIBCPP_CXX03_LANG inline _LIBCPP_INLINE_VISIBILITY void swap(thread& __x, thread& __y) _NOEXCEPT {__x.swap(__y);} @@ -480,4 +479,6 @@ _LIBCPP_END_NAMESPACE_STD #endif // !_LIBCPP_HAS_NO_THREADS +_LIBCPP_POP_MACROS + #endif // _LIBCPP_THREAD diff --git a/include/tuple b/include/tuple index f2a747219..aa4713faf 100644 --- a/include/tuple +++ b/include/tuple @@ -148,7 +148,7 @@ template _LIBCPP_BEGIN_NAMESPACE_STD -#ifndef _LIBCPP_HAS_NO_VARIADICS +#ifndef _LIBCPP_CXX03_LANG // __tuple_leaf @@ -169,7 +169,7 @@ void swap(__tuple_leaf<_Ip, _Hp, _Ep>& __x, __tuple_leaf<_Ip, _Hp, _Ep>& __y) template class __tuple_leaf { - _Hp value; + _Hp __value_; template static constexpr bool __can_bind_reference() { @@ -188,28 +188,28 @@ class __tuple_leaf __tuple_leaf& operator=(const __tuple_leaf&); public: _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR __tuple_leaf() - _NOEXCEPT_(is_nothrow_default_constructible<_Hp>::value) : value() + _NOEXCEPT_(is_nothrow_default_constructible<_Hp>::value) : __value_() {static_assert(!is_reference<_Hp>::value, "Attempted to default construct a reference element in a tuple");} template _LIBCPP_INLINE_VISIBILITY __tuple_leaf(integral_constant, const _Alloc&) - : value() + : __value_() {static_assert(!is_reference<_Hp>::value, "Attempted to default construct a reference element in a tuple");} template _LIBCPP_INLINE_VISIBILITY __tuple_leaf(integral_constant, const _Alloc& __a) - : value(allocator_arg_t(), __a) + : __value_(allocator_arg_t(), __a) {static_assert(!is_reference<_Hp>::value, "Attempted to default construct a reference element in a tuple");} template _LIBCPP_INLINE_VISIBILITY __tuple_leaf(integral_constant, const _Alloc& __a) - : value(__a) + : __value_(__a) {static_assert(!is_reference<_Hp>::value, "Attempted to default construct a reference element in a tuple");} @@ -223,28 +223,28 @@ public: > _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 explicit __tuple_leaf(_Tp&& __t) _NOEXCEPT_((is_nothrow_constructible<_Hp, _Tp>::value)) - : value(_VSTD::forward<_Tp>(__t)) + : __value_(_VSTD::forward<_Tp>(__t)) {static_assert(__can_bind_reference<_Tp>(), "Attempted to construct a reference element in a tuple with an rvalue");} template _LIBCPP_INLINE_VISIBILITY explicit __tuple_leaf(integral_constant, const _Alloc&, _Tp&& __t) - : value(_VSTD::forward<_Tp>(__t)) + : __value_(_VSTD::forward<_Tp>(__t)) {static_assert(__can_bind_reference<_Tp>(), "Attempted to construct a reference element in a tuple with an rvalue");} template _LIBCPP_INLINE_VISIBILITY explicit __tuple_leaf(integral_constant, const _Alloc& __a, _Tp&& __t) - : value(allocator_arg_t(), __a, _VSTD::forward<_Tp>(__t)) + : __value_(allocator_arg_t(), __a, _VSTD::forward<_Tp>(__t)) {static_assert(!is_reference<_Hp>::value, "Attempted to uses-allocator construct a reference element in a tuple");} template _LIBCPP_INLINE_VISIBILITY explicit __tuple_leaf(integral_constant, const _Alloc& __a, _Tp&& __t) - : value(_VSTD::forward<_Tp>(__t), __a) + : __value_(_VSTD::forward<_Tp>(__t), __a) {static_assert(!is_reference<_Hp>::value, "Attempted to uses-allocator construct a reference element in a tuple");} @@ -256,7 +256,7 @@ public: __tuple_leaf& operator=(_Tp&& __t) _NOEXCEPT_((is_nothrow_assignable<_Hp&, _Tp>::value)) { - value = _VSTD::forward<_Tp>(__t); + __value_ = _VSTD::forward<_Tp>(__t); return *this; } @@ -267,8 +267,8 @@ public: return 0; } - _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 _Hp& get() _NOEXCEPT {return value;} - _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 const _Hp& get() const _NOEXCEPT {return value;} + _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 _Hp& get() _NOEXCEPT {return __value_;} + _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 const _Hp& get() const _NOEXCEPT {return __value_;} }; template @@ -473,9 +473,9 @@ struct _LIBCPP_DECLSPEC_EMPTY_BASES __tuple_impl<__tuple_indices<_Indx...>, _Tp. template class _LIBCPP_TEMPLATE_VIS tuple { - typedef __tuple_impl::type, _Tp...> base; + typedef __tuple_impl::type, _Tp...> _BaseT; - base base_; + _BaseT __base_; #if defined(_LIBCPP_ENABLE_TUPLE_IMPLICIT_REDUCED_ARITY_EXTENSION) static constexpr bool _EnableImplicitReducedArityExtension = true; @@ -628,7 +628,7 @@ public: >::type> _LIBCPP_INLINE_VISIBILITY tuple(_AllocArgT, _Alloc const& __a) - : base_(allocator_arg_t(), __a, + : __base_(allocator_arg_t(), __a, __tuple_indices<>(), __tuple_types<>(), typename __make_tuple_indices::type(), __tuple_types<_Tp...>()) {} @@ -644,7 +644,7 @@ public: > _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 tuple(const _Tp& ... __t) _NOEXCEPT_((__all::value...>::value)) - : base_(typename __make_tuple_indices::type(), + : __base_(typename __make_tuple_indices::type(), typename __make_tuple_types::type(), typename __make_tuple_indices<0>::type(), typename __make_tuple_types::type(), @@ -662,7 +662,7 @@ public: > _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 explicit tuple(const _Tp& ... __t) _NOEXCEPT_((__all::value...>::value)) - : base_(typename __make_tuple_indices::type(), + : __base_(typename __make_tuple_indices::type(), typename __make_tuple_types::type(), typename __make_tuple_indices<0>::type(), typename __make_tuple_types::type(), @@ -680,7 +680,7 @@ public: > _LIBCPP_INLINE_VISIBILITY tuple(allocator_arg_t, const _Alloc& __a, const _Tp& ... __t) - : base_(allocator_arg_t(), __a, + : __base_(allocator_arg_t(), __a, typename __make_tuple_indices::type(), typename __make_tuple_types::type(), typename __make_tuple_indices<0>::type(), @@ -700,7 +700,7 @@ public: _LIBCPP_INLINE_VISIBILITY explicit tuple(allocator_arg_t, const _Alloc& __a, const _Tp& ... __t) - : base_(allocator_arg_t(), __a, + : __base_(allocator_arg_t(), __a, typename __make_tuple_indices::type(), typename __make_tuple_types::type(), typename __make_tuple_indices<0>::type(), @@ -727,7 +727,7 @@ public: _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 tuple(_Up&&... __u) _NOEXCEPT_(( - is_nothrow_constructible::type, typename __make_tuple_types::type, typename __make_tuple_indices::type, @@ -735,7 +735,7 @@ public: _Up... >::value )) - : base_(typename __make_tuple_indices::type(), + : __base_(typename __make_tuple_indices::type(), typename __make_tuple_types::type(), typename __make_tuple_indices::type(), typename __make_tuple_types::type(), @@ -760,7 +760,7 @@ public: explicit tuple(_Up&&... __u) _NOEXCEPT_(( - is_nothrow_constructible::type, typename __make_tuple_types::type, typename __make_tuple_indices::type, @@ -768,7 +768,7 @@ public: _Up... >::value )) - : base_(typename __make_tuple_indices::type(), + : __base_(typename __make_tuple_indices::type(), typename __make_tuple_types::type(), typename __make_tuple_indices::type(), typename __make_tuple_types::type(), @@ -786,7 +786,7 @@ public: > _LIBCPP_INLINE_VISIBILITY tuple(allocator_arg_t, const _Alloc& __a, _Up&&... __u) - : base_(allocator_arg_t(), __a, + : __base_(allocator_arg_t(), __a, typename __make_tuple_indices::type(), typename __make_tuple_types::type(), typename __make_tuple_indices::type(), @@ -806,7 +806,7 @@ public: _LIBCPP_INLINE_VISIBILITY explicit tuple(allocator_arg_t, const _Alloc& __a, _Up&&... __u) - : base_(allocator_arg_t(), __a, + : __base_(allocator_arg_t(), __a, typename __make_tuple_indices::type(), typename __make_tuple_types::type(), typename __make_tuple_indices::type(), @@ -824,8 +824,8 @@ public: >::type = false > _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 - tuple(_Tuple&& __t) _NOEXCEPT_((is_nothrow_constructible::value)) - : base_(_VSTD::forward<_Tuple>(__t)) {} + tuple(_Tuple&& __t) _NOEXCEPT_((is_nothrow_constructible<_BaseT, _Tuple>::value)) + : __base_(_VSTD::forward<_Tuple>(__t)) {} template _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 explicit - tuple(_Tuple&& __t) _NOEXCEPT_((is_nothrow_constructible::value)) - : base_(_VSTD::forward<_Tuple>(__t)) {} + tuple(_Tuple&& __t) _NOEXCEPT_((is_nothrow_constructible<_BaseT, _Tuple>::value)) + : __base_(_VSTD::forward<_Tuple>(__t)) {} template _LIBCPP_INLINE_VISIBILITY tuple(allocator_arg_t, const _Alloc& __a, _Tuple&& __t) - : base_(allocator_arg_t(), __a, _VSTD::forward<_Tuple>(__t)) {} + : __base_(allocator_arg_t(), __a, _VSTD::forward<_Tuple>(__t)) {} template (__t)) {} + : __base_(allocator_arg_t(), __a, _VSTD::forward<_Tuple>(__t)) {} using _CanCopyAssign = __all::value...>; using _CanMoveAssign = __all::value...>; @@ -876,7 +876,7 @@ public: tuple& operator=(typename conditional<_CanCopyAssign::value, tuple, __nat>::type const& __t) _NOEXCEPT_((__all::value...>::value)) { - base_.operator=(__t.base_); + __base_.operator=(__t.__base_); return *this; } @@ -884,7 +884,7 @@ public: tuple& operator=(typename conditional<_CanMoveAssign::value, tuple, __nat>::type&& __t) _NOEXCEPT_((__all::value...>::value)) { - base_.operator=(static_cast(__t.base_)); + __base_.operator=(static_cast<_BaseT&&>(__t.__base_)); return *this; } @@ -896,15 +896,15 @@ public: > _LIBCPP_INLINE_VISIBILITY tuple& - operator=(_Tuple&& __t) _NOEXCEPT_((is_nothrow_assignable::value)) + operator=(_Tuple&& __t) _NOEXCEPT_((is_nothrow_assignable<_BaseT&, _Tuple>::value)) { - base_.operator=(_VSTD::forward<_Tuple>(__t)); + __base_.operator=(_VSTD::forward<_Tuple>(__t)); return *this; } _LIBCPP_INLINE_VISIBILITY void swap(tuple& __t) _NOEXCEPT_(__all<__is_nothrow_swappable<_Tp>::value...>::value) - {base_.swap(__t.base_);} + {__base_.swap(__t.__base_);} }; template <> @@ -948,7 +948,7 @@ typename tuple_element<_Ip, tuple<_Tp...> >::type& get(tuple<_Tp...>& __t) _NOEXCEPT { typedef typename tuple_element<_Ip, tuple<_Tp...> >::type type; - return static_cast<__tuple_leaf<_Ip, type>&>(__t.base_).get(); + return static_cast<__tuple_leaf<_Ip, type>&>(__t.__base_).get(); } template @@ -957,7 +957,7 @@ const typename tuple_element<_Ip, tuple<_Tp...> >::type& get(const tuple<_Tp...>& __t) _NOEXCEPT { typedef typename tuple_element<_Ip, tuple<_Tp...> >::type type; - return static_cast&>(__t.base_).get(); + return static_cast&>(__t.__base_).get(); } template @@ -967,7 +967,7 @@ get(tuple<_Tp...>&& __t) _NOEXCEPT { typedef typename tuple_element<_Ip, tuple<_Tp...> >::type type; return static_cast( - static_cast<__tuple_leaf<_Ip, type>&&>(__t.base_).get()); + static_cast<__tuple_leaf<_Ip, type>&&>(__t.__base_).get()); } template @@ -977,7 +977,7 @@ get(const tuple<_Tp...>&& __t) _NOEXCEPT { typedef typename tuple_element<_Ip, tuple<_Tp...> >::type type; return static_cast( - static_cast&&>(__t.base_).get()); + static_cast&&>(__t.__base_).get()); } #if _LIBCPP_STD_VER > 11 @@ -1345,9 +1345,6 @@ template struct _LIBCPP_TEMPLATE_VIS uses_allocator, _Alloc> : true_type {}; -#endif // _LIBCPP_HAS_NO_VARIADICS - -#ifndef _LIBCPP_CXX03_LANG template template inline _LIBCPP_INLINE_VISIBILITY @@ -1358,7 +1355,6 @@ pair<_T1, _T2>::pair(piecewise_construct_t, second(_VSTD::forward<_Args2>(_VSTD::get<_I2>(__second_args))...) { } -#endif // _LIBCPP_CXX03_LANG #if _LIBCPP_STD_VER > 14 template @@ -1404,6 +1400,8 @@ _LIBCPP_NOEXCEPT_RETURN( #endif // _LIBCPP_STD_VER > 14 +#endif // !defined(_LIBCPP_CXX03_LANG) + _LIBCPP_END_NAMESPACE_STD #endif // _LIBCPP_TUPLE diff --git a/include/type_traits b/include/type_traits index 3aa84605a..9db4d6614 100644 --- a/include/type_traits +++ b/include/type_traits @@ -97,6 +97,7 @@ namespace std template struct is_polymorphic; template struct is_abstract; template struct is_final; // C++14 + template struct is_aggregate; // C++17 template struct is_constructible; template struct is_default_constructible; @@ -286,6 +287,8 @@ namespace std = is_abstract::value; // C++17 template constexpr bool is_final_v = is_final::value; // C++17 + template constexpr bool is_aggregate_v + = is_aggregate::value; // C++17 template constexpr bool is_signed_v = is_signed::value; // C++17 template constexpr bool is_unsigned_v @@ -1272,11 +1275,13 @@ template using remove_all_extents_t = typename remove_all_extents<_T // decay -template -struct _LIBCPP_TEMPLATE_VIS decay -{ -private: - typedef typename remove_reference<_Tp>::type _Up; +template +struct __decay { + typedef typename remove_cv<_Up>::type type; +}; + +template +struct __decay<_Up, true> { public: typedef typename conditional < @@ -1291,6 +1296,15 @@ public: >::type type; }; +template +struct _LIBCPP_TEMPLATE_VIS decay +{ +private: + typedef typename remove_reference<_Tp>::type _Up; +public: + typedef typename __decay<_Up, __is_referenceable<_Up>::value>::type type; +}; + #if _LIBCPP_STD_VER > 11 template using decay_t = typename decay<_Tp>::type; #endif @@ -1325,6 +1339,19 @@ template _LIBCPP_CONSTEXPR bool is_final_v = is_final<_Tp>::value; #endif +// is_aggregate +#if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_IS_AGGREGATE) + +template struct _LIBCPP_TEMPLATE_VIS +is_aggregate : public integral_constant {}; + +#if !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES) +template +constexpr bool is_aggregate_v = is_aggregate<_Tp>::value; +#endif + +#endif // _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_IS_AGGREGATE) + // is_base_of #ifdef _LIBCPP_HAS_IS_BASE_OF @@ -1954,11 +1981,18 @@ public: typedef typename common_type::type, _Vp>::type type; }; +template <> +struct _LIBCPP_TEMPLATE_VIS common_type +{ +public: + typedef void type; +}; + template struct _LIBCPP_TEMPLATE_VIS common_type<_Tp, void, void> { public: - typedef typename decay<_Tp>::type type; + typedef typename common_type<_Tp, _Tp>::type type; }; template @@ -1980,9 +2014,7 @@ struct _LIBCPP_TEMPLATE_VIS common_type {}; template struct _LIBCPP_TEMPLATE_VIS common_type<_Tp> -{ - typedef typename decay<_Tp>::type type; -}; + : public common_type<_Tp, _Tp> {}; // bullet 3 - sizeof...(Tp) == 2 @@ -4707,4 +4739,35 @@ struct __can_extract_map_key<_ValTy, _Key, _Key, _RawValTy> _LIBCPP_END_NAMESPACE_STD +#if _LIBCPP_STD_VER > 14 +// std::byte +namespace std // purposefully not versioned +{ +template + constexpr typename enable_if, byte>::type & + operator<<=(byte& __lhs, _Integer __shift) noexcept + { return __lhs = byte(static_cast(__lhs) << __shift); } + +template + constexpr typename enable_if, byte>::type + operator<< (byte __lhs, _Integer __shift) noexcept + { return byte(static_cast(__lhs) << __shift); } + +template + constexpr typename enable_if, byte>::type & + operator>>=(byte& __lhs, _Integer __shift) noexcept + { return __lhs = byte(static_cast(__lhs) >> __shift); } + +template + constexpr typename enable_if, byte>::type + operator>> (byte __lhs, _Integer __shift) noexcept + { return byte(static_cast(__lhs) >> __shift); } + +template + constexpr typename enable_if, _Integer>::type + to_integer(byte __b) noexcept { return _Integer(__b); } + +} +#endif + #endif // _LIBCPP_TYPE_TRAITS diff --git a/include/typeinfo b/include/typeinfo index 4145ac1a3..8624b3497 100644 --- a/include/typeinfo +++ b/include/typeinfo @@ -108,6 +108,7 @@ protected: #endif public: + _LIBCPP_AVAILABILITY_TYPEINFO_VTABLE virtual ~type_info(); #if defined(_LIBCPP_HAS_NONUNIQUE_TYPEINFO) diff --git a/include/unordered_map b/include/unordered_map index 3f3808c1e..0546c0e2f 100644 --- a/include/unordered_map +++ b/include/unordered_map @@ -404,7 +404,7 @@ public: _NOEXCEPT_(__is_nothrow_swappable<_Hash>::value) { using _VSTD::swap; - swap(static_cast(*this), static_cast(__y)); + swap(static_cast<_Hash&>(*this), static_cast<_Hash&>(__y)); } }; @@ -475,7 +475,7 @@ public: _NOEXCEPT_(__is_nothrow_swappable<_Pred>::value) { using _VSTD::swap; - swap(static_cast(*this), static_cast(__y)); + swap(static_cast<_Pred&>(*this), static_cast<_Pred&>(__y)); } }; @@ -547,7 +547,7 @@ public: __second_constructed(false) {} -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES +#ifndef _LIBCPP_CXX03_LANG _LIBCPP_INLINE_VISIBILITY __hash_map_node_destructor(__hash_node_destructor&& __x) _NOEXCEPT @@ -557,7 +557,7 @@ public: { __x.__value_constructed = false; } -#else // _LIBCPP_HAS_NO_RVALUE_REFERENCES +#else // _LIBCPP_CXX03_LANG _LIBCPP_INLINE_VISIBILITY __hash_map_node_destructor(const __hash_node_destructor& __x) : __na_(__x.__na_), @@ -566,7 +566,7 @@ public: { const_cast(__x.__value_constructed) = false; } -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES +#endif // _LIBCPP_CXX03_LANG _LIBCPP_INLINE_VISIBILITY void operator()(pointer __p) _NOEXCEPT @@ -819,20 +819,18 @@ public: explicit unordered_map(const allocator_type& __a); unordered_map(const unordered_map& __u); unordered_map(const unordered_map& __u, const allocator_type& __a); -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES +#ifndef _LIBCPP_CXX03_LANG _LIBCPP_INLINE_VISIBILITY unordered_map(unordered_map&& __u) _NOEXCEPT_(is_nothrow_move_constructible<__table>::value); unordered_map(unordered_map&& __u, const allocator_type& __a); -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES -#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS unordered_map(initializer_list __il); unordered_map(initializer_list __il, size_type __n, const hasher& __hf = hasher(), const key_equal& __eql = key_equal()); unordered_map(initializer_list __il, size_type __n, const hasher& __hf, const key_equal& __eql, const allocator_type& __a); -#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS +#endif // _LIBCPP_CXX03_LANG #if _LIBCPP_STD_VER > 11 _LIBCPP_INLINE_VISIBILITY unordered_map(size_type __n, const allocator_type& __a) @@ -875,15 +873,13 @@ public: #endif return *this; } -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES +#ifndef _LIBCPP_CXX03_LANG _LIBCPP_INLINE_VISIBILITY unordered_map& operator=(unordered_map&& __u) _NOEXCEPT_(is_nothrow_move_assignable<__table>::value); -#endif -#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS _LIBCPP_INLINE_VISIBILITY unordered_map& operator=(initializer_list __il); -#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS +#endif // _LIBCPP_CXX03_LANG _LIBCPP_INLINE_VISIBILITY allocator_type get_allocator() const _NOEXCEPT @@ -928,13 +924,11 @@ public: _LIBCPP_INLINE_VISIBILITY void insert(_InputIterator __first, _InputIterator __last); -#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS +#ifndef _LIBCPP_CXX03_LANG _LIBCPP_INLINE_VISIBILITY void insert(initializer_list __il) {insert(__il.begin(), __il.end());} -#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS -#ifndef _LIBCPP_CXX03_LANG _LIBCPP_INLINE_VISIBILITY pair insert(value_type&& __x) {return __table_.__insert_unique(_VSTD::move(__x));} @@ -1078,7 +1072,7 @@ public: // FIXME: Add debug mode checking for the iterator input return insert_or_assign(_VSTD::move(__k), _VSTD::forward<_Vp>(__v)).first; } -#endif +#endif // _LIBCPP_STD_VER > 14 _LIBCPP_INLINE_VISIBILITY iterator erase(const_iterator __p) {return __table_.erase(__p.__i_);} @@ -1277,7 +1271,7 @@ unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::unordered_map( insert(__u.begin(), __u.end()); } -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES +#ifndef _LIBCPP_CXX03_LANG template inline @@ -1314,10 +1308,6 @@ unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::unordered_map( #endif } -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES - -#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS - template unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::unordered_map( initializer_list __il) @@ -1354,10 +1344,6 @@ unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::unordered_map( insert(__il.begin(), __il.end()); } -#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS - -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES - template inline unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>& @@ -1368,10 +1354,6 @@ unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::operator=(unordered_map&& __u) return *this; } -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES - -#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS - template inline unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>& @@ -1382,22 +1364,7 @@ unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::operator=( return *this; } -#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS - -#ifdef _LIBCPP_CXX03_LANG -template -typename unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::__node_holder -unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::__construct_node_with_key(const key_type& __k) -{ - __node_allocator& __na = __table_.__node_alloc(); - __node_holder __h(__node_traits::allocate(__na, 1), _Dp(__na)); - __node_traits::construct(__na, _VSTD::addressof(__h->__value_.__cc.first), __k); - __h.get_deleter().__first_constructed = true; - __node_traits::construct(__na, _VSTD::addressof(__h->__value_.__cc.second)); - __h.get_deleter().__second_constructed = true; - return _LIBCPP_EXPLICIT_MOVE(__h); // explicitly moved for C++03 -} -#endif +#endif // _LIBCPP_CXX03_LANG template template @@ -1410,20 +1377,7 @@ unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::insert(_InputIterator __first, __table_.__insert_unique(*__first); } -#ifdef _LIBCPP_CXX03_LANG -template -_Tp& -unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::operator[](const key_type& __k) -{ - iterator __i = find(__k); - if (__i != end()) - return __i->second; - __node_holder __h = __construct_node_with_key(__k); - pair __r = __table_.__node_insert_unique(__h.get()); - __h.release(); - return __r.first->second; -} -#else +#ifndef _LIBCPP_CXX03_LANG template _Tp& @@ -1442,8 +1396,35 @@ unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::operator[](key_type&& __k) std::piecewise_construct, std::forward_as_tuple(std::move(__k)), std::forward_as_tuple()).first->__cc.second; } +#else // _LIBCPP_CXX03_LANG -#endif // !_LIBCPP_CXX03_MODE +template +typename unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::__node_holder +unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::__construct_node_with_key(const key_type& __k) +{ + __node_allocator& __na = __table_.__node_alloc(); + __node_holder __h(__node_traits::allocate(__na, 1), _Dp(__na)); + __node_traits::construct(__na, _VSTD::addressof(__h->__value_.__cc.first), __k); + __h.get_deleter().__first_constructed = true; + __node_traits::construct(__na, _VSTD::addressof(__h->__value_.__cc.second)); + __h.get_deleter().__second_constructed = true; + return _LIBCPP_EXPLICIT_MOVE(__h); // explicitly moved for C++03 +} + +template +_Tp& +unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::operator[](const key_type& __k) +{ + iterator __i = find(__k); + if (__i != end()) + return __i->second; + __node_holder __h = __construct_node_with_key(__k); + pair __r = __table_.__node_insert_unique(__h.get()); + __h.release(); + return __r.first->second; +} + +#endif // _LIBCPP_CXX03_MODE template _Tp& @@ -1586,13 +1567,11 @@ public: explicit unordered_multimap(const allocator_type& __a); unordered_multimap(const unordered_multimap& __u); unordered_multimap(const unordered_multimap& __u, const allocator_type& __a); -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES +#ifndef _LIBCPP_CXX03_LANG _LIBCPP_INLINE_VISIBILITY unordered_multimap(unordered_multimap&& __u) _NOEXCEPT_(is_nothrow_move_constructible<__table>::value); unordered_multimap(unordered_multimap&& __u, const allocator_type& __a); -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES -#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS unordered_multimap(initializer_list __il); unordered_multimap(initializer_list __il, size_type __n, const hasher& __hf = hasher(), @@ -1600,7 +1579,7 @@ public: unordered_multimap(initializer_list __il, size_type __n, const hasher& __hf, const key_equal& __eql, const allocator_type& __a); -#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS +#endif // _LIBCPP_CXX03_LANG #if _LIBCPP_STD_VER > 11 _LIBCPP_INLINE_VISIBILITY unordered_multimap(size_type __n, const allocator_type& __a) @@ -1643,15 +1622,13 @@ public: #endif return *this; } -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES +#ifndef _LIBCPP_CXX03_LANG _LIBCPP_INLINE_VISIBILITY unordered_multimap& operator=(unordered_multimap&& __u) _NOEXCEPT_(is_nothrow_move_assignable<__table>::value); -#endif -#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS _LIBCPP_INLINE_VISIBILITY unordered_multimap& operator=(initializer_list __il); -#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS +#endif // _LIBCPP_CXX03_LANG _LIBCPP_INLINE_VISIBILITY allocator_type get_allocator() const _NOEXCEPT @@ -1688,13 +1665,10 @@ public: _LIBCPP_INLINE_VISIBILITY void insert(_InputIterator __first, _InputIterator __last); -#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS +#ifndef _LIBCPP_CXX03_LANG _LIBCPP_INLINE_VISIBILITY void insert(initializer_list __il) {insert(__il.begin(), __il.end());} -#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS - -#ifndef _LIBCPP_CXX03_LANG _LIBCPP_INLINE_VISIBILITY iterator insert(value_type&& __x) {return __table_.__insert_multi(_VSTD::move(__x));} @@ -1912,7 +1886,7 @@ unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>::unordered_multimap( insert(__u.begin(), __u.end()); } -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES +#ifndef _LIBCPP_CXX03_LANG template inline @@ -1951,10 +1925,6 @@ unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>::unordered_multimap( #endif } -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES - -#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS - template unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>::unordered_multimap( initializer_list __il) @@ -1991,10 +1961,6 @@ unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>::unordered_multimap( insert(__il.begin(), __il.end()); } -#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS - -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES - template inline unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>& @@ -2005,10 +1971,6 @@ unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>::operator=(unordered_multima return *this; } -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES - -#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS - template inline unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>& @@ -2019,7 +1981,7 @@ unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>::operator=( return *this; } -#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS +#endif // _LIBCPP_CXX03_LANG diff --git a/include/unordered_set b/include/unordered_set index fc53c8271..a14fb0004 100644 --- a/include/unordered_set +++ b/include/unordered_set @@ -408,13 +408,11 @@ public: explicit unordered_set(const allocator_type& __a); unordered_set(const unordered_set& __u); unordered_set(const unordered_set& __u, const allocator_type& __a); -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES +#ifndef _LIBCPP_CXX03_LANG _LIBCPP_INLINE_VISIBILITY unordered_set(unordered_set&& __u) _NOEXCEPT_(is_nothrow_move_constructible<__table>::value); unordered_set(unordered_set&& __u, const allocator_type& __a); -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES -#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS unordered_set(initializer_list __il); unordered_set(initializer_list __il, size_type __n, const hasher& __hf = hasher(), @@ -432,7 +430,7 @@ public: const hasher& __hf, const allocator_type& __a) : unordered_set(__il, __n, __hf, key_equal(), __a) {} #endif -#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS +#endif // _LIBCPP_CXX03_LANG // ~unordered_set() = default; _LIBCPP_INLINE_VISIBILITY unordered_set& operator=(const unordered_set& __u) @@ -440,15 +438,13 @@ public: __table_ = __u.__table_; return *this; } -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES +#ifndef _LIBCPP_CXX03_LANG _LIBCPP_INLINE_VISIBILITY unordered_set& operator=(unordered_set&& __u) _NOEXCEPT_(is_nothrow_move_assignable<__table>::value); -#endif -#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS _LIBCPP_INLINE_VISIBILITY unordered_set& operator=(initializer_list __il); -#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS +#endif // _LIBCPP_CXX03_LANG _LIBCPP_INLINE_VISIBILITY allocator_type get_allocator() const _NOEXCEPT @@ -474,7 +470,7 @@ public: _LIBCPP_INLINE_VISIBILITY const_iterator cend() const _NOEXCEPT {return __table_.end();} -#if !defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES) && !defined(_LIBCPP_HAS_NO_VARIADICS) +#ifndef _LIBCPP_CXX03_LANG template _LIBCPP_INLINE_VISIBILITY pair emplace(_Args&&... __args) @@ -493,29 +489,10 @@ public: iterator emplace_hint(const_iterator, _Args&&... __args) {return __table_.__emplace_unique(_VSTD::forward<_Args>(__args)...).first;} #endif -#endif // !defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES) && !defined(_LIBCPP_HAS_NO_VARIADICS) - _LIBCPP_INLINE_VISIBILITY - pair insert(const value_type& __x) - {return __table_.__insert_unique(__x);} -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES + _LIBCPP_INLINE_VISIBILITY pair insert(value_type&& __x) {return __table_.__insert_unique(_VSTD::move(__x));} -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES - _LIBCPP_INLINE_VISIBILITY -#if _LIBCPP_DEBUG_LEVEL >= 2 - iterator insert(const_iterator __p, const value_type& __x) - { - _LIBCPP_ASSERT(__get_const_db()->__find_c_from_i(&__p) == this, - "unordered_set::insert(const_iterator, const value_type&) called with an iterator not" - " referring to this unordered_set"); - return insert(__x).first; - } -#else - iterator insert(const_iterator, const value_type& __x) - {return insert(__x).first;} -#endif -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES _LIBCPP_INLINE_VISIBILITY #if _LIBCPP_DEBUG_LEVEL >= 2 iterator insert(const_iterator __p, value_type&& __x) @@ -529,15 +506,30 @@ public: iterator insert(const_iterator, value_type&& __x) {return insert(_VSTD::move(__x)).first;} #endif -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES - template - _LIBCPP_INLINE_VISIBILITY - void insert(_InputIterator __first, _InputIterator __last); -#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS _LIBCPP_INLINE_VISIBILITY void insert(initializer_list __il) {insert(__il.begin(), __il.end());} -#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS +#endif // _LIBCPP_CXX03_LANG + _LIBCPP_INLINE_VISIBILITY + pair insert(const value_type& __x) + {return __table_.__insert_unique(__x);} + + _LIBCPP_INLINE_VISIBILITY +#if _LIBCPP_DEBUG_LEVEL >= 2 + iterator insert(const_iterator __p, const value_type& __x) + { + _LIBCPP_ASSERT(__get_const_db()->__find_c_from_i(&__p) == this, + "unordered_set::insert(const_iterator, const value_type&) called with an iterator not" + " referring to this unordered_set"); + return insert(__x).first; + } +#else + iterator insert(const_iterator, const value_type& __x) + {return insert(__x).first;} +#endif + template + _LIBCPP_INLINE_VISIBILITY + void insert(_InputIterator __first, _InputIterator __last); _LIBCPP_INLINE_VISIBILITY iterator erase(const_iterator __p) {return __table_.erase(__p);} @@ -717,7 +709,7 @@ unordered_set<_Value, _Hash, _Pred, _Alloc>::unordered_set( insert(__u.begin(), __u.end()); } -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES +#ifndef _LIBCPP_CXX03_LANG template inline @@ -752,10 +744,6 @@ unordered_set<_Value, _Hash, _Pred, _Alloc>::unordered_set( #endif } -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES - -#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS - template unordered_set<_Value, _Hash, _Pred, _Alloc>::unordered_set( initializer_list __il) @@ -792,10 +780,6 @@ unordered_set<_Value, _Hash, _Pred, _Alloc>::unordered_set( insert(__il.begin(), __il.end()); } -#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS - -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES - template inline unordered_set<_Value, _Hash, _Pred, _Alloc>& @@ -806,10 +790,6 @@ unordered_set<_Value, _Hash, _Pred, _Alloc>::operator=(unordered_set&& __u) return *this; } -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES - -#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS - template inline unordered_set<_Value, _Hash, _Pred, _Alloc>& @@ -820,7 +800,7 @@ unordered_set<_Value, _Hash, _Pred, _Alloc>::operator=( return *this; } -#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS +#endif // _LIBCPP_CXX03_LANG template template @@ -949,13 +929,11 @@ public: explicit unordered_multiset(const allocator_type& __a); unordered_multiset(const unordered_multiset& __u); unordered_multiset(const unordered_multiset& __u, const allocator_type& __a); -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES +#ifndef _LIBCPP_CXX03_LANG _LIBCPP_INLINE_VISIBILITY unordered_multiset(unordered_multiset&& __u) _NOEXCEPT_(is_nothrow_move_constructible<__table>::value); unordered_multiset(unordered_multiset&& __u, const allocator_type& __a); -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES -#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS unordered_multiset(initializer_list __il); unordered_multiset(initializer_list __il, size_type __n, const hasher& __hf = hasher(), @@ -971,7 +949,7 @@ public: unordered_multiset(initializer_list __il, size_type __n, const hasher& __hf, const allocator_type& __a) : unordered_multiset(__il, __n, __hf, key_equal(), __a) {} #endif -#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS +#endif // _LIBCPP_CXX03_LANG // ~unordered_multiset() = default; _LIBCPP_INLINE_VISIBILITY unordered_multiset& operator=(const unordered_multiset& __u) @@ -979,14 +957,12 @@ public: __table_ = __u.__table_; return *this; } -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES +#ifndef _LIBCPP_CXX03_LANG _LIBCPP_INLINE_VISIBILITY unordered_multiset& operator=(unordered_multiset&& __u) _NOEXCEPT_(is_nothrow_move_assignable<__table>::value); -#endif -#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS unordered_multiset& operator=(initializer_list __il); -#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS +#endif // _LIBCPP_CXX03_LANG _LIBCPP_INLINE_VISIBILITY allocator_type get_allocator() const _NOEXCEPT @@ -1012,7 +988,7 @@ public: _LIBCPP_INLINE_VISIBILITY const_iterator cend() const _NOEXCEPT {return __table_.end();} -#if !defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES) && !defined(_LIBCPP_HAS_NO_VARIADICS) +#ifndef _LIBCPP_CXX03_LANG template _LIBCPP_INLINE_VISIBILITY iterator emplace(_Args&&... __args) @@ -1021,29 +997,27 @@ public: _LIBCPP_INLINE_VISIBILITY iterator emplace_hint(const_iterator __p, _Args&&... __args) {return __table_.__emplace_hint_multi(__p, _VSTD::forward<_Args>(__args)...);} -#endif // !defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES) && !defined(_LIBCPP_HAS_NO_VARIADICS) - _LIBCPP_INLINE_VISIBILITY - iterator insert(const value_type& __x) {return __table_.__insert_multi(__x);} -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES + _LIBCPP_INLINE_VISIBILITY iterator insert(value_type&& __x) {return __table_.__insert_multi(_VSTD::move(__x));} -#endif - _LIBCPP_INLINE_VISIBILITY - iterator insert(const_iterator __p, const value_type& __x) - {return __table_.__insert_multi(__p, __x);} -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES _LIBCPP_INLINE_VISIBILITY iterator insert(const_iterator __p, value_type&& __x) {return __table_.__insert_multi(__p, _VSTD::move(__x));} -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES - template - _LIBCPP_INLINE_VISIBILITY - void insert(_InputIterator __first, _InputIterator __last); -#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS _LIBCPP_INLINE_VISIBILITY void insert(initializer_list __il) {insert(__il.begin(), __il.end());} -#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS +#endif // _LIBCPP_CXX03_LANG + + _LIBCPP_INLINE_VISIBILITY + iterator insert(const value_type& __x) {return __table_.__insert_multi(__x);} + + _LIBCPP_INLINE_VISIBILITY + iterator insert(const_iterator __p, const value_type& __x) + {return __table_.__insert_multi(__p, __x);} + + template + _LIBCPP_INLINE_VISIBILITY + void insert(_InputIterator __first, _InputIterator __last); _LIBCPP_INLINE_VISIBILITY iterator erase(const_iterator __p) {return __table_.erase(__p);} @@ -1224,7 +1198,7 @@ unordered_multiset<_Value, _Hash, _Pred, _Alloc>::unordered_multiset( insert(__u.begin(), __u.end()); } -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES +#ifndef _LIBCPP_CXX03_LANG template inline @@ -1259,10 +1233,6 @@ unordered_multiset<_Value, _Hash, _Pred, _Alloc>::unordered_multiset( #endif } -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES - -#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS - template unordered_multiset<_Value, _Hash, _Pred, _Alloc>::unordered_multiset( initializer_list __il) @@ -1299,10 +1269,6 @@ unordered_multiset<_Value, _Hash, _Pred, _Alloc>::unordered_multiset( insert(__il.begin(), __il.end()); } -#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS - -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES - template inline unordered_multiset<_Value, _Hash, _Pred, _Alloc>& @@ -1314,10 +1280,6 @@ unordered_multiset<_Value, _Hash, _Pred, _Alloc>::operator=( return *this; } -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES - -#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS - template inline unordered_multiset<_Value, _Hash, _Pred, _Alloc>& @@ -1328,7 +1290,7 @@ unordered_multiset<_Value, _Hash, _Pred, _Alloc>::operator=( return *this; } -#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS +#endif // _LIBCPP_CXX03_LANG template template diff --git a/include/utility b/include/utility index 1f41c0771..be7320713 100644 --- a/include/utility +++ b/include/utility @@ -272,14 +272,14 @@ swap(_Tp (&__a)[_Np], _Tp (&__b)[_Np]) _NOEXCEPT_(__is_nothrow_swappable<_Tp>::v template inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES +#ifndef _LIBCPP_CXX03_LANG typename conditional < !is_nothrow_move_constructible<_Tp>::value && is_copy_constructible<_Tp>::value, const _Tp&, _Tp&& >::type -#else // _LIBCPP_HAS_NO_RVALUE_REFERENCES +#else // _LIBCPP_CXX03_LANG const _Tp& #endif move_if_noexcept(_Tp& __x) _NOEXCEPT @@ -293,7 +293,7 @@ template void as_const(const _Tp&&) = delete; #endif struct _LIBCPP_TEMPLATE_VIS piecewise_construct_t { }; -#if defined(_LIBCPP_HAS_NO_CONSTEXPR) || defined(_LIBCPP_BUILDING_UTILITY) +#if defined(_LIBCPP_CXX03_LANG) || defined(_LIBCPP_BUILDING_UTILITY) extern const piecewise_construct_t piecewise_construct;// = piecewise_construct_t(); #else constexpr piecewise_construct_t piecewise_construct = piecewise_construct_t(); @@ -608,8 +608,7 @@ swap(pair<_T1, _T2>& __x, pair<_T1, _T2>& __y) __x.swap(__y); } -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES - +#ifndef _LIBCPP_CXX03_LANG template struct __make_pair_return_impl @@ -638,7 +637,7 @@ make_pair(_T1&& __t1, _T2&& __t2) (_VSTD::forward<_T1>(__t1), _VSTD::forward<_T2>(__t2)); } -#else // _LIBCPP_HAS_NO_RVALUE_REFERENCES +#else // _LIBCPP_CXX03_LANG template inline _LIBCPP_INLINE_VISIBILITY @@ -648,7 +647,7 @@ make_pair(_T1 __x, _T2 __y) return pair<_T1, _T2>(__x, __y); } -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES +#endif // _LIBCPP_CXX03_LANG template class _LIBCPP_TEMPLATE_VIS tuple_size > @@ -685,8 +684,7 @@ struct __get_pair<0> const _T1& get(const pair<_T1, _T2>& __p) _NOEXCEPT {return __p.first;} -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES - +#ifndef _LIBCPP_CXX03_LANG template static _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 @@ -698,8 +696,7 @@ struct __get_pair<0> _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 const _T1&& get(const pair<_T1, _T2>&& __p) _NOEXCEPT {return _VSTD::forward(__p.first);} - -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES +#endif // _LIBCPP_CXX03_LANG }; template <> @@ -717,8 +714,7 @@ struct __get_pair<1> const _T2& get(const pair<_T1, _T2>& __p) _NOEXCEPT {return __p.second;} -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES - +#ifndef _LIBCPP_CXX03_LANG template static _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 @@ -730,8 +726,7 @@ struct __get_pair<1> _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 const _T2&& get(const pair<_T1, _T2>&& __p) _NOEXCEPT {return _VSTD::forward(__p.second);} - -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES +#endif // _LIBCPP_CXX03_LANG }; template @@ -750,8 +745,7 @@ get(const pair<_T1, _T2>& __p) _NOEXCEPT return __get_pair<_Ip>::get(__p); } -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES - +#ifndef _LIBCPP_CXX03_LANG template inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 typename tuple_element<_Ip, pair<_T1, _T2> >::type&& @@ -767,8 +761,7 @@ get(const pair<_T1, _T2>&& __p) _NOEXCEPT { return __get_pair<_Ip>::get(_VSTD::move(__p)); } - -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES +#endif // _LIBCPP_CXX03_LANG #if _LIBCPP_STD_VER > 11 template @@ -906,7 +899,7 @@ inline constexpr in_place_t in_place{}; template -struct _LIBCPP_TYPE_VIS in_place_type_t { +struct _LIBCPP_TEMPLATE_VIS in_place_type_t { explicit in_place_type_t() = default; }; template diff --git a/include/valarray b/include/valarray index f0f1f62a1..ee61238a9 100644 --- a/include/valarray +++ b/include/valarray @@ -347,12 +347,14 @@ template unspecified2 end(const valarray& v); #include #include -#include <__undef_min_max> - #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) #pragma GCC system_header #endif +_LIBCPP_PUSH_MACROS +#include <__undef_macros> + + _LIBCPP_BEGIN_NAMESPACE_STD template class _LIBCPP_TEMPLATE_VIS valarray; @@ -807,13 +809,11 @@ public: valarray(const value_type& __x, size_t __n); valarray(const value_type* __p, size_t __n); valarray(const valarray& __v); -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES +#ifndef _LIBCPP_CXX03_LANG _LIBCPP_INLINE_VISIBILITY valarray(valarray&& __v) _NOEXCEPT; -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES -#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS valarray(initializer_list __il); -#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS +#endif // _LIBCPP_CXX03_LANG valarray(const slice_array& __sa); valarray(const gslice_array& __ga); valarray(const mask_array& __ma); @@ -823,14 +823,12 @@ public: // assignment: valarray& operator=(const valarray& __v); -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES +#ifndef _LIBCPP_CXX03_LANG _LIBCPP_INLINE_VISIBILITY valarray& operator=(valarray&& __v) _NOEXCEPT; -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES -#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS _LIBCPP_INLINE_VISIBILITY valarray& operator=(initializer_list); -#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS +#endif // _LIBCPP_CXX03_LANG _LIBCPP_INLINE_VISIBILITY valarray& operator=(const value_type& __x); _LIBCPP_INLINE_VISIBILITY @@ -861,32 +859,32 @@ public: __val_expr<__indirect_expr > operator[](const gslice& __gs) const; _LIBCPP_INLINE_VISIBILITY gslice_array operator[](const gslice& __gs); -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES +#ifndef _LIBCPP_CXX03_LANG _LIBCPP_INLINE_VISIBILITY __val_expr<__indirect_expr > operator[](gslice&& __gs) const; _LIBCPP_INLINE_VISIBILITY gslice_array operator[](gslice&& __gs); -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES +#endif // _LIBCPP_CXX03_LANG _LIBCPP_INLINE_VISIBILITY __val_expr<__mask_expr > operator[](const valarray& __vb) const; _LIBCPP_INLINE_VISIBILITY mask_array operator[](const valarray& __vb); -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES +#ifndef _LIBCPP_CXX03_LANG _LIBCPP_INLINE_VISIBILITY __val_expr<__mask_expr > operator[](valarray&& __vb) const; _LIBCPP_INLINE_VISIBILITY mask_array operator[](valarray&& __vb); -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES +#endif // _LIBCPP_CXX03_LANG _LIBCPP_INLINE_VISIBILITY __val_expr<__indirect_expr > operator[](const valarray& __vs) const; _LIBCPP_INLINE_VISIBILITY indirect_array operator[](const valarray& __vs); -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES +#ifndef _LIBCPP_CXX03_LANG _LIBCPP_INLINE_VISIBILITY __val_expr<__indirect_expr > operator[](valarray&& __vs) const; _LIBCPP_INLINE_VISIBILITY indirect_array operator[](valarray&& __vs); -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES +#endif // _LIBCPP_CXX03_LANG // unary operators: valarray operator+() const; @@ -1480,7 +1478,7 @@ public: __stride_(__stride) {__init(__start);} -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES +#ifndef _LIBCPP_CXX03_LANG _LIBCPP_INLINE_VISIBILITY gslice(size_t __start, const valarray& __size, @@ -1503,7 +1501,7 @@ public: __stride_(move(__stride)) {__init(__start);} -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES +#endif // _LIBCPP_CXX03_LANG // gslice(const gslice&) = default; // gslice(gslice&&) = default; @@ -1656,12 +1654,12 @@ private: __1d_(__gs.__1d_) {} -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES +#ifndef _LIBCPP_CXX03_LANG gslice_array(gslice&& __gs, const valarray& __v) : __vp_(const_cast(__v.__begin_)), __1d_(move(__gs.__1d_)) {} -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES +#endif // _LIBCPP_CXX03_LANG template friend class valarray; }; @@ -2353,7 +2351,7 @@ private: __1d_(__ia) {} -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES +#ifndef _LIBCPP_CXX03_LANG _LIBCPP_INLINE_VISIBILITY indirect_array(valarray&& __ia, const valarray& __v) @@ -2361,7 +2359,7 @@ private: __1d_(move(__ia)) {} -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES +#endif // _LIBCPP_CXX03_LANG template friend class valarray; }; @@ -2572,7 +2570,7 @@ private: __1d_(__ia) {} -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES +#ifndef _LIBCPP_CXX03_LANG _LIBCPP_INLINE_VISIBILITY __indirect_expr(valarray&& __ia, const _RmExpr& __e) @@ -2580,7 +2578,7 @@ private: __1d_(move(__ia)) {} -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES +#endif // _LIBCPP_CXX03_LANG public: _LIBCPP_INLINE_VISIBILITY @@ -2814,7 +2812,7 @@ valarray<_Tp>::valarray(const valarray& __v) } } -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES +#ifndef _LIBCPP_CXX03_LANG template inline @@ -2825,10 +2823,6 @@ valarray<_Tp>::valarray(valarray&& __v) _NOEXCEPT __v.__begin_ = __v.__end_ = nullptr; } -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES - -#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS - template valarray<_Tp>::valarray(initializer_list __il) : __begin_(0), @@ -2855,7 +2849,7 @@ valarray<_Tp>::valarray(initializer_list __il) } } -#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS +#endif // _LIBCPP_CXX03_LANG template valarray<_Tp>::valarray(const slice_array& __sa) @@ -2990,7 +2984,7 @@ valarray<_Tp>::operator=(const valarray& __v) return *this; } -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES +#ifndef _LIBCPP_CXX03_LANG template inline @@ -3005,10 +2999,6 @@ valarray<_Tp>::operator=(valarray&& __v) _NOEXCEPT return *this; } -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES - -#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS - template inline valarray<_Tp>& @@ -3020,7 +3010,7 @@ valarray<_Tp>::operator=(initializer_list __il) return *this; } -#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS +#endif // _LIBCPP_CXX03_LANG template inline @@ -3132,7 +3122,7 @@ valarray<_Tp>::operator[](const gslice& __gs) return gslice_array(__gs, *this); } -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES +#ifndef _LIBCPP_CXX03_LANG template inline @@ -3150,7 +3140,7 @@ valarray<_Tp>::operator[](gslice&& __gs) return gslice_array(move(__gs), *this); } -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES +#endif // _LIBCPP_CXX03_LANG template inline @@ -3168,7 +3158,7 @@ valarray<_Tp>::operator[](const valarray& __vb) return mask_array(__vb, *this); } -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES +#ifndef _LIBCPP_CXX03_LANG template inline @@ -3186,7 +3176,7 @@ valarray<_Tp>::operator[](valarray&& __vb) return mask_array(move(__vb), *this); } -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES +#endif // _LIBCPP_CXX03_LANG template inline @@ -3204,7 +3194,7 @@ valarray<_Tp>::operator[](const valarray& __vs) return indirect_array(__vs, *this); } -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES +#ifndef _LIBCPP_CXX03_LANG template inline @@ -3222,7 +3212,7 @@ valarray<_Tp>::operator[](valarray&& __vs) return indirect_array(move(__vs), *this); } -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES +#endif // _LIBCPP_CXX03_LANG template valarray<_Tp> @@ -4877,4 +4867,6 @@ end(const valarray<_Tp>& __v) _LIBCPP_END_NAMESPACE_STD +_LIBCPP_POP_MACROS + #endif // _LIBCPP_VALARRAY diff --git a/include/variant b/include/variant index 099e6c358..8505f3262 100644 --- a/include/variant +++ b/include/variant @@ -53,16 +53,16 @@ namespace std { // 20.7.2.4, modifiers template - void emplace(Args&&...); + T& emplace(Args&&...); template - void emplace(initializer_list, Args&&...); + T& emplace(initializer_list, Args&&...); template - void emplace(Args&&...); + variant_alternative_t& emplace(Args&&...); template - void emplace(initializer_list, Args&&...); + variant_alternative_t& emplace(initializer_list, Args&&...); // 20.7.2.5, value status constexpr bool valueless_by_exception() const noexcept; @@ -358,7 +358,6 @@ struct __traits { static constexpr _Trait __copy_assignable_trait = __common_trait( {__copy_constructible_trait, - __move_constructible_trait, __trait<_Types, is_trivially_copy_assignable, is_copy_assignable>...}); static constexpr _Trait __move_assignable_trait = __common_trait( @@ -425,30 +424,21 @@ struct __base { constexpr auto __fmatrix = __make_fmatrix<_Visitor&&, decltype(_VSTD::forward<_Vs>(__vs).__as_base())...>(); - const size_t __indices[] = {__vs.index()...}; - return __at(__fmatrix, __indices)(_VSTD::forward<_Visitor>(__visitor), - _VSTD::forward<_Vs>(__vs).__as_base()...); + return __at(__fmatrix, __vs.index()...)( + _VSTD::forward<_Visitor>(__visitor), + _VSTD::forward<_Vs>(__vs).__as_base()...); } private: template inline _LIBCPP_INLINE_VISIBILITY - static constexpr const _Tp& __at_impl(const _Tp& __elem, const size_t*) { - return __elem; - } + static constexpr const _Tp& __at(const _Tp& __elem) { return __elem; } - template - inline _LIBCPP_INLINE_VISIBILITY - static constexpr auto&& __at_impl(const array<_Tp, _Np>& __elems, - const size_t* __index) { - return __at_impl(__elems[*__index], __index + 1); - } - - template + template inline _LIBCPP_INLINE_VISIBILITY static constexpr auto&& __at(const array<_Tp, _Np>& __elems, - const size_t (&__indices)[_Ip]) { - return __at_impl(__elems, begin(__indices)); + size_t __index, _Indices... __indices) { + return __at(__elems[__index], __indices...); } template @@ -764,9 +754,10 @@ public: protected: template inline _LIBCPP_INLINE_VISIBILITY - static void __construct_alt(__alt<_Ip, _Tp>& __a, _Args&&... __args) { - ::new (_VSTD::addressof(__a)) + static _Tp& __construct_alt(__alt<_Ip, _Tp>& __a, _Args&&... __args) { + ::new ((void*)_VSTD::addressof(__a)) __alt<_Ip, _Tp>(in_place, _VSTD::forward<_Args>(__args)...); + return __a.__value; } template @@ -876,33 +867,33 @@ public: template inline _LIBCPP_INLINE_VISIBILITY - void __emplace(_Args&&... __args) { + auto& __emplace(_Args&&... __args) { this->__destroy(); - this->__construct_alt(__access::__base::__get_alt<_Ip>(*this), + auto& __res = this->__construct_alt(__access::__base::__get_alt<_Ip>(*this), _VSTD::forward<_Args>(__args)...); this->__index = _Ip; + return __res; } protected: - template + template inline _LIBCPP_INLINE_VISIBILITY - void __assign_alt(__alt<_Ip, _Tp>& __a, - _Arg&& __arg, - bool_constant<_CopyAssign> __tag) { + void __assign_alt(__alt<_Ip, _Tp>& __a, _Arg&& __arg) { if (this->index() == _Ip) { __a.__value = _VSTD::forward<_Arg>(__arg); } else { struct { void operator()(true_type) const { - __this->__emplace<_Ip>(_Tp(_VSTD::forward<_Arg>(__arg))); + __this->__emplace<_Ip>(_VSTD::forward<_Arg>(__arg)); } void operator()(false_type) const { - __this->__emplace<_Ip>(_VSTD::forward<_Arg>(__arg)); + __this->__emplace<_Ip>(_Tp(_VSTD::forward<_Arg>(__arg))); } __assignment* __this; _Arg&& __arg; } __impl{this, _VSTD::forward<_Arg>(__arg)}; - __impl(__tag); + __impl(bool_constant || + !is_nothrow_move_constructible_v<_Tp>>{}); } } @@ -919,8 +910,7 @@ protected: [this](auto& __this_alt, auto&& __that_alt) { this->__assign_alt( __this_alt, - _VSTD::forward(__that_alt).__value, - is_lvalue_reference<_That>{}); + _VSTD::forward(__that_alt).__value); }, *this, _VSTD::forward<_That>(__that)); } @@ -1020,8 +1010,7 @@ public: inline _LIBCPP_INLINE_VISIBILITY void __assign(_Arg&& __arg) { this->__assign_alt(__access::__base::__get_alt<_Ip>(*this), - _VSTD::forward<_Arg>(__arg), - false_type{}); + _VSTD::forward<_Arg>(__arg)); } inline _LIBCPP_INLINE_VISIBILITY @@ -1095,7 +1084,6 @@ class _LIBCPP_TEMPLATE_VIS variant __all...>::value>, private __sfinae_assign_base< __all<(is_copy_constructible_v<_Types> && - is_move_constructible_v<_Types> && is_copy_assignable_v<_Types>)...>::value, __all<(is_move_constructible_v<_Types> && is_move_assignable_v<_Types>)...>::value> { @@ -1138,7 +1126,7 @@ public: : __impl(in_place_index<_Ip>, _VSTD::forward<_Arg>(__arg)) {} template = 0, + class = enable_if_t<(_Ip < sizeof...(_Types)), int>, class _Tp = variant_alternative_t<_Ip, variant<_Types...>>, enable_if_t, int> = 0> inline _LIBCPP_INLINE_VISIBILITY @@ -1218,8 +1206,8 @@ public: class _Tp = variant_alternative_t<_Ip, variant<_Types...>>, enable_if_t, int> = 0> inline _LIBCPP_INLINE_VISIBILITY - void emplace(_Args&&... __args) { - __impl.template __emplace<_Ip>(_VSTD::forward<_Args>(__args)...); + _Tp& emplace(_Args&&... __args) { + return __impl.template __emplace<_Ip>(_VSTD::forward<_Args>(__args)...); } template < @@ -1231,8 +1219,8 @@ public: enable_if_t&, _Args...>, int> = 0> inline _LIBCPP_INLINE_VISIBILITY - void emplace(initializer_list<_Up> __il, _Args&&... __args) { - __impl.template __emplace<_Ip>(__il, _VSTD::forward<_Args>(__args)...); + _Tp& emplace(initializer_list<_Up> __il, _Args&&... __args) { + return __impl.template __emplace<_Ip>(__il, _VSTD::forward<_Args>(__args)...); } template < @@ -1242,8 +1230,8 @@ public: __find_detail::__find_unambiguous_index_sfinae<_Tp, _Types...>::value, enable_if_t, int> = 0> inline _LIBCPP_INLINE_VISIBILITY - void emplace(_Args&&... __args) { - __impl.template __emplace<_Ip>(_VSTD::forward<_Args>(__args)...); + _Tp& emplace(_Args&&... __args) { + return __impl.template __emplace<_Ip>(_VSTD::forward<_Args>(__args)...); } template < @@ -1255,8 +1243,8 @@ public: enable_if_t&, _Args...>, int> = 0> inline _LIBCPP_INLINE_VISIBILITY - void emplace(initializer_list<_Up> __il, _Args&&... __args) { - __impl.template __emplace<_Ip>(__il, _VSTD::forward<_Args>(__args)...); + _Tp& emplace(initializer_list<_Up> __il, _Args&&... __args) { + return __impl.template __emplace<_Ip>(__il, _VSTD::forward<_Args>(__args)...); } inline _LIBCPP_INLINE_VISIBILITY @@ -1562,7 +1550,7 @@ struct _LIBCPP_TEMPLATE_VIS hash { using result_type = size_t; inline _LIBCPP_INLINE_VISIBILITY - result_type operator()(const argument_type&) const { + result_type operator()(const argument_type&) const _NOEXCEPT { return 66740831; // return a fundamentally attractive random value. } }; diff --git a/include/vector b/include/vector index ded057b10..ee19fb708 100644 --- a/include/vector +++ b/include/vector @@ -275,14 +275,16 @@ void swap(vector& x, vector& y) #include <__split_buffer> #include <__functional_base> -#include <__undef_min_max> - #include <__debug> #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) #pragma GCC system_header #endif +_LIBCPP_PUSH_MACROS +#include <__undef_macros> + + _LIBCPP_BEGIN_NAMESPACE_STD template @@ -413,8 +415,10 @@ inline _LIBCPP_INLINE_VISIBILITY void __vector_base<_Tp, _Allocator>::__destruct_at_end(pointer __new_last) _NOEXCEPT { - while (__new_last != __end_) - __alloc_traits::destroy(__alloc(), _VSTD::__to_raw_pointer(--__end_)); + pointer __soon_to_be_end = __end_; + while (__new_last != __soon_to_be_end) + __alloc_traits::destroy(__alloc(), _VSTD::__to_raw_pointer(--__soon_to_be_end)); + __end_ = __new_last; } template @@ -525,12 +529,7 @@ public: is_constructible< value_type, typename iterator_traits<_ForwardIterator>::reference>::value>::type* = 0); -#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS - _LIBCPP_INLINE_VISIBILITY - vector(initializer_list __il); - _LIBCPP_INLINE_VISIBILITY - vector(initializer_list __il, const allocator_type& __a); -#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS + #if _LIBCPP_DEBUG_LEVEL >= 2 _LIBCPP_INLINE_VISIBILITY ~vector() @@ -543,7 +542,14 @@ public: vector(const vector& __x, const allocator_type& __a); _LIBCPP_INLINE_VISIBILITY vector& operator=(const vector& __x); -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES + +#ifndef _LIBCPP_CXX03_LANG + _LIBCPP_INLINE_VISIBILITY + vector(initializer_list __il); + + _LIBCPP_INLINE_VISIBILITY + vector(initializer_list __il, const allocator_type& __a); + _LIBCPP_INLINE_VISIBILITY vector(vector&& __x) #if _LIBCPP_STD_VER > 14 @@ -551,17 +557,18 @@ public: #else _NOEXCEPT_(is_nothrow_move_constructible::value); #endif + _LIBCPP_INLINE_VISIBILITY vector(vector&& __x, const allocator_type& __a); _LIBCPP_INLINE_VISIBILITY vector& operator=(vector&& __x) _NOEXCEPT_((__noexcept_move_assign_container<_Allocator, __alloc_traits>::value)); -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES -#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS + _LIBCPP_INLINE_VISIBILITY vector& operator=(initializer_list __il) {assign(__il.begin(), __il.end()); return *this;} -#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS + +#endif // !_LIBCPP_CXX03_LANG template typename enable_if @@ -586,11 +593,12 @@ public: assign(_ForwardIterator __first, _ForwardIterator __last); void assign(size_type __n, const_reference __u); -#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS + +#ifndef _LIBCPP_CXX03_LANG _LIBCPP_INLINE_VISIBILITY void assign(initializer_list __il) {assign(__il.begin(), __il.end());} -#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS +#endif _LIBCPP_INLINE_VISIBILITY allocator_type get_allocator() const _NOEXCEPT @@ -674,9 +682,10 @@ public: {return _VSTD::__to_raw_pointer(this->__begin_);} _LIBCPP_INLINE_VISIBILITY void push_back(const_reference __x); -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES + +#ifndef _LIBCPP_CXX03_LANG _LIBCPP_INLINE_VISIBILITY void push_back(value_type&& __x); -#ifndef _LIBCPP_HAS_NO_VARIADICS + template _LIBCPP_INLINE_VISIBILITY #if _LIBCPP_STD_VER > 14 @@ -684,19 +693,19 @@ public: #else void emplace_back(_Args&&... __args); #endif -#endif // _LIBCPP_HAS_NO_VARIADICS -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES +#endif // !_LIBCPP_CXX03_LANG + _LIBCPP_INLINE_VISIBILITY void pop_back(); iterator insert(const_iterator __position, const_reference __x); -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES + +#ifndef _LIBCPP_CXX03_LANG iterator insert(const_iterator __position, value_type&& __x); -#ifndef _LIBCPP_HAS_NO_VARIADICS template iterator emplace(const_iterator __position, _Args&&... __args); -#endif // _LIBCPP_HAS_NO_VARIADICS -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES +#endif // !_LIBCPP_CXX03_LANG + iterator insert(const_iterator __position, size_type __n, const_reference __x); template typename enable_if @@ -719,11 +728,12 @@ public: iterator >::type insert(const_iterator __position, _ForwardIterator __first, _ForwardIterator __last); -#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS + +#ifndef _LIBCPP_CXX03_LANG _LIBCPP_INLINE_VISIBILITY iterator insert(const_iterator __position, initializer_list __il) {return insert(__position, __il.begin(), __il.end());} -#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS +#endif _LIBCPP_INLINE_VISIBILITY iterator erase(const_iterator __position); iterator erase(const_iterator __first, const_iterator __last); @@ -796,18 +806,16 @@ private: __base::__destruct_at_end(__new_last); __annotate_shrink(__old_size); } - template - void -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES - __push_back_slow_path(_Up&& __x); -#else - __push_back_slow_path(_Up& __x); -#endif -#if !defined(_LIBCPP_HAS_NO_VARIADICS) && !defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES) + +#ifndef _LIBCPP_CXX03_LANG + template void __push_back_slow_path(_Up&& __x); + template - void - __emplace_back_slow_path(_Args&&... __args); + void __emplace_back_slow_path(_Args&&... __args); +#else + template void __push_back_slow_path(_Up& __x); #endif + // The following functions are no-ops outside of AddressSanitizer mode. // We call annotatations only for the default Allocator because other allocators // may not meet the AddressSanitizer alignment constraints. @@ -1217,7 +1225,7 @@ vector<_Tp, _Allocator>::vector(const vector& __x, const allocator_type& __a) } } -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES +#ifndef _LIBCPP_CXX03_LANG template inline _LIBCPP_INLINE_VISIBILITY @@ -1264,8 +1272,6 @@ vector<_Tp, _Allocator>::vector(vector&& __x, const allocator_type& __a) } } -#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS - template inline _LIBCPP_INLINE_VISIBILITY vector<_Tp, _Allocator>::vector(initializer_list __il) @@ -1295,8 +1301,6 @@ vector<_Tp, _Allocator>::vector(initializer_list __il, const allocat } } -#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS - template inline _LIBCPP_INLINE_VISIBILITY vector<_Tp, _Allocator>& @@ -1338,7 +1342,7 @@ vector<_Tp, _Allocator>::__move_assign(vector& __c, true_type) #endif } -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES +#endif // !_LIBCPP_CXX03_LANG template inline _LIBCPP_INLINE_VISIBILITY @@ -1560,7 +1564,7 @@ vector<_Tp, _Allocator>::shrink_to_fit() _NOEXCEPT template template void -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES +#ifndef _LIBCPP_CXX03_LANG vector<_Tp, _Allocator>::__push_back_slow_path(_Up&& __x) #else vector<_Tp, _Allocator>::__push_back_slow_path(_Up& __x) @@ -1591,7 +1595,7 @@ vector<_Tp, _Allocator>::push_back(const_reference __x) __push_back_slow_path(__x); } -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES +#ifndef _LIBCPP_CXX03_LANG template inline _LIBCPP_INLINE_VISIBILITY @@ -1611,8 +1615,6 @@ vector<_Tp, _Allocator>::push_back(value_type&& __x) __push_back_slow_path(_VSTD::move(__x)); } -#ifndef _LIBCPP_HAS_NO_VARIADICS - template template void @@ -1652,8 +1654,7 @@ vector<_Tp, _Allocator>::emplace_back(_Args&&... __args) #endif } -#endif // _LIBCPP_HAS_NO_VARIADICS -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES +#endif // !_LIBCPP_CXX03_LANG template inline @@ -1758,7 +1759,7 @@ vector<_Tp, _Allocator>::insert(const_iterator __position, const_reference __x) return __make_iter(__p); } -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES +#ifndef _LIBCPP_CXX03_LANG template typename vector<_Tp, _Allocator>::iterator @@ -1797,8 +1798,6 @@ vector<_Tp, _Allocator>::insert(const_iterator __position, value_type&& __x) return __make_iter(__p); } -#ifndef _LIBCPP_HAS_NO_VARIADICS - template template typename vector<_Tp, _Allocator>::iterator @@ -1838,8 +1837,7 @@ vector<_Tp, _Allocator>::emplace(const_iterator __position, _Args&&... __args) return __make_iter(__p); } -#endif // _LIBCPP_HAS_NO_VARIADICS -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES +#endif // !_LIBCPP_CXX03_LANG template typename vector<_Tp, _Allocator>::iterator @@ -2036,7 +2034,7 @@ vector<_Tp, _Allocator>::swap(vector& __x) _VSTD::swap(this->__begin_, __x.__begin_); _VSTD::swap(this->__end_, __x.__end_); _VSTD::swap(this->__end_cap(), __x.__end_cap()); - __swap_allocator(this->__alloc(), __x.__alloc(), + __swap_allocator(this->__alloc(), __x.__alloc(), integral_constant()); #if _LIBCPP_DEBUG_LEVEL >= 2 __get_db()->swap(this, &__x); @@ -2231,12 +2229,11 @@ public: vector(const vector& __v); vector(const vector& __v, const allocator_type& __a); vector& operator=(const vector& __v); -#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS + +#ifndef _LIBCPP_CXX03_LANG vector(initializer_list __il); vector(initializer_list __il, const allocator_type& __a); -#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES _LIBCPP_INLINE_VISIBILITY vector(vector&& __v) #if _LIBCPP_STD_VER > 14 @@ -2248,12 +2245,12 @@ public: _LIBCPP_INLINE_VISIBILITY vector& operator=(vector&& __v) _NOEXCEPT_((__noexcept_move_assign_container<_Allocator, __alloc_traits>::value)); -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES -#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS + _LIBCPP_INLINE_VISIBILITY vector& operator=(initializer_list __il) {assign(__il.begin(), __il.end()); return *this;} -#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS + +#endif // !_LIBCPP_CXX03_LANG template typename enable_if @@ -2272,11 +2269,12 @@ public: assign(_ForwardIterator __first, _ForwardIterator __last); void assign(size_type __n, const value_type& __x); -#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS + +#ifndef _LIBCPP_CXX03_LANG _LIBCPP_INLINE_VISIBILITY void assign(initializer_list __il) {assign(__il.begin(), __il.end());} -#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS +#endif _LIBCPP_INLINE_VISIBILITY allocator_type get_allocator() const _NOEXCEPT {return allocator_type(this->__alloc());} @@ -2385,11 +2383,12 @@ public: iterator >::type insert(const_iterator __position, _ForwardIterator __first, _ForwardIterator __last); -#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS + +#ifndef _LIBCPP_CXX03_LANG _LIBCPP_INLINE_VISIBILITY iterator insert(const_iterator __position, initializer_list __il) {return insert(__position, __il.begin(), __il.end());} -#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS +#endif _LIBCPP_INLINE_VISIBILITY iterator erase(const_iterator __position); iterator erase(const_iterator __first, const_iterator __last); @@ -2749,7 +2748,7 @@ vector::vector(_ForwardIterator __first, _ForwardIterator __la } } -#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS +#ifndef _LIBCPP_CXX03_LANG template vector::vector(initializer_list __il) @@ -2779,7 +2778,7 @@ vector::vector(initializer_list __il, const alloca } } -#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS +#endif // _LIBCPP_CXX03_LANG template vector::~vector() @@ -2836,7 +2835,7 @@ vector::operator=(const vector& __v) return *this; } -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES +#ifndef _LIBCPP_CXX03_LANG template inline _LIBCPP_INLINE_VISIBILITY @@ -2911,7 +2910,7 @@ vector::__move_assign(vector& __c, true_type) __c.__cap() = __c.__size_ = 0; } -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES +#endif // !_LIBCPP_CXX03_LANG template void @@ -3201,7 +3200,7 @@ vector::swap(vector& __x) _VSTD::swap(this->__begin_, __x.__begin_); _VSTD::swap(this->__size_, __x.__size_); _VSTD::swap(this->__cap(), __x.__cap()); - __swap_allocator(this->__alloc(), __x.__alloc(), + __swap_allocator(this->__alloc(), __x.__alloc(), integral_constant()); } @@ -3360,4 +3359,6 @@ swap(vector<_Tp, _Allocator>& __x, vector<_Tp, _Allocator>& __y) _LIBCPP_END_NAMESPACE_STD +_LIBCPP_POP_MACROS + #endif // _LIBCPP_VECTOR diff --git a/include/wchar.h b/include/wchar.h index c0c6ef754..a5666e193 100644 --- a/include/wchar.h +++ b/include/wchar.h @@ -166,9 +166,12 @@ inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_PREFERRED_OVERLOAD } #endif -#if defined(__cplusplus) && (defined(_LIBCPP_MSVCRT) || defined(__MINGW32__)) -extern "C++" { -#include // pull in *swprintf defines +#if defined(__cplusplus) && defined(_LIBCPP_MSVCRT_LIKE) +extern "C" { +size_t mbsnrtowcs(wchar_t *__restrict dst, const char **__restrict src, + size_t nmc, size_t len, mbstate_t *__restrict ps); +size_t wcsnrtombs(char *__restrict dst, const wchar_t **__restrict src, + size_t nwc, size_t len, mbstate_t *__restrict ps); } // extern "C++" #endif // __cplusplus && _LIBCPP_MSVCRT diff --git a/lib/CMakeLists.txt b/lib/CMakeLists.txt index 66bb14c89..fe45f5ac0 100644 --- a/lib/CMakeLists.txt +++ b/lib/CMakeLists.txt @@ -83,7 +83,12 @@ add_library_flags_if(LIBCXX_HAS_PTHREAD_LIB pthread) add_library_flags_if(LIBCXX_HAS_C_LIB c) add_library_flags_if(LIBCXX_HAS_M_LIB m) add_library_flags_if(LIBCXX_HAS_RT_LIB rt) -add_library_flags_if(LIBCXX_HAS_GCC_S_LIB gcc_s) +if (LIBCXX_USE_COMPILER_RT) + find_compiler_rt_library(builtins LIBCXX_BUILTINS_LIBRARY) + add_library_flags_if(LIBCXX_BUILTINS_LIBRARY "${LIBCXX_BUILTINS_LIBRARY}") +else() + add_library_flags_if(LIBCXX_HAS_GCC_S_LIB gcc_s) +endif() add_library_flags_if(LIBCXX_HAVE_CXX_ATOMICS_WITH_LIB atomic) # Add the unwinder library. @@ -116,6 +121,7 @@ if (LIBCXX_TARGETING_MSVC) add_library_flags(ucrt${LIB_SUFFIX}) # Universal C runtime add_library_flags(vcruntime${LIB_SUFFIX}) # C++ runtime add_library_flags(msvcrt${LIB_SUFFIX}) # C runtime startup files + add_library_flags(msvcprt${LIB_SUFFIX}) # C++ standard library. Required for exception_ptr internals. # Required for standards-complaint wide character formatting functions # (e.g. `printfw`/`scanfw`) add_library_flags(iso_stdio_wide_specifiers) @@ -150,7 +156,7 @@ if (LIBCXX_OSX_REEXPORT_SYSTEM_ABI_LIBRARY) "-Wl,-unexported_symbols_list,${CMAKE_CURRENT_SOURCE_DIR}/libc++unexp.exp" "/usr/lib/libSystem.B.dylib") else() - if (DEFINED CMAKE_OSX_SYSROOT AND NOT CMAKE_OSX_SYSROOT STREQUAL "") + if (DEFINED CMAKE_OSX_SYSROOT AND NOT CMAKE_OSX_SYSROOT STREQUAL "") list(FIND CMAKE_OSX_ARCHITECTURES "armv7" OSX_HAS_ARMV7) if (NOT OSX_HAS_ARMV7 EQUAL -1) set(OSX_RE_EXPORT_LINE @@ -162,8 +168,10 @@ if (LIBCXX_OSX_REEXPORT_SYSTEM_ABI_LIBRARY) endif() else() set(OSX_RE_EXPORT_LINE "/usr/lib/libc++abi.dylib -Wl,-reexported_symbols_list,${CMAKE_CURRENT_SOURCE_DIR}/libc++abi${LIBCXX_LIBCPPABI_VERSION}.exp") + if (NOT LIBCXX_ENABLE_NEW_DELETE_DEFINITIONS) + add_link_flags("/usr/lib/libc++abi.dylib -Wl,-reexported_symbols_list,${CMAKE_CURRENT_SOURCE_DIR}/libc++abi-new-delete.exp") + endif() endif() - add_link_flags( "-compatibility_version 1" "-install_name /usr/lib/libc++.1.dylib" @@ -177,7 +185,7 @@ endif() split_list(LIBCXX_COMPILE_FLAGS) split_list(LIBCXX_LINK_FLAGS) -# Add a object library that contains the compiled source files. +# Add an object library that contains the compiled source files. add_library(cxx_objects OBJECT ${exclude_from_all} ${LIBCXX_SOURCES} ${LIBCXX_HEADERS}) if(WIN32 AND NOT MINGW) target_compile_definitions(cxx_objects @@ -234,11 +242,13 @@ endif() if (LIBCXX_ENABLE_STATIC) add_library(cxx_static STATIC $) target_link_libraries(cxx_static ${LIBCXX_LIBRARIES}) + set(CMAKE_STATIC_LIBRARY_PREFIX "lib") set_target_properties(cxx_static PROPERTIES LINK_FLAGS "${LIBCXX_LINK_FLAGS}" OUTPUT_NAME "c++" ) + list(APPEND LIBCXX_TARGETS "cxx_static") # Attempt to merge the libc++.a archive and the ABI library archive into one. if (LIBCXX_ENABLE_STATIC_ABI_LIBRARY) diff --git a/lib/libc++abi-new-delete.exp b/lib/libc++abi-new-delete.exp new file mode 100644 index 000000000..a9e651dd6 --- /dev/null +++ b/lib/libc++abi-new-delete.exp @@ -0,0 +1,8 @@ +__ZdaPv +__ZdlPv +__ZdlPvRKSt9nothrow_t +__Znam +__ZdaPvRKSt9nothrow_t +__Znwm +__ZnwmRKSt9nothrow_t +__ZnamRKSt9nothrow_t diff --git a/lib/libc++abi2.exp b/lib/libc++abi2.exp index 47dcbbb88..eb088f370 100644 --- a/lib/libc++abi2.exp +++ b/lib/libc++abi2.exp @@ -209,14 +209,6 @@ __ZNSt20bad_array_new_lengthC2Ev __ZNSt20bad_array_new_lengthD0Ev __ZNSt20bad_array_new_lengthD2Ev __ZSt10unexpectedv -# __ZdaPv -# __ZdlPv -# __ZdlPvRKSt9nothrow_t -# __Znam -# __ZdaPvRKSt9nothrow_t -# __Znwm -# __ZnwmRKSt9nothrow_t -# __ZnamRKSt9nothrow_t __ZTISt10bad_typeid __ZTISt8bad_cast ___cxa_bad_typeid diff --git a/src/chrono.cpp b/src/chrono.cpp index 9b277a610..d0e184ad3 100644 --- a/src/chrono.cpp +++ b/src/chrono.cpp @@ -37,7 +37,7 @@ #if defined(_LIBCPP_WIN32API) #define WIN32_LEAN_AND_MEAN #define VC_EXTRA_LEAN -#include +#include #if _WIN32_WINNT >= _WIN32_WINNT_WIN8 #include #endif diff --git a/src/condition_variable.cpp b/src/condition_variable.cpp index 3f607271b..2200aefb8 100644 --- a/src/condition_variable.cpp +++ b/src/condition_variable.cpp @@ -14,6 +14,7 @@ #include "condition_variable" #include "thread" #include "system_error" +#include "__undef_macros" _LIBCPP_BEGIN_NAMESPACE_STD diff --git a/src/exception.cpp b/src/exception.cpp index 0b502cd13..4359d1261 100644 --- a/src/exception.cpp +++ b/src/exception.cpp @@ -20,7 +20,7 @@ #if defined(_LIBCPP_ABI_MICROSOFT) #include "support/runtime/exception_msvc.ipp" -#include "support/runtime/exception_pointer_unimplemented.ipp" +#include "support/runtime/exception_pointer_msvc.ipp" #elif defined(_LIBCPPABI_VERSION) #include "support/runtime/exception_libcxxabi.ipp" #include "support/runtime/exception_pointer_cxxabi.ipp" diff --git a/src/experimental/filesystem/operations.cpp b/src/experimental/filesystem/operations.cpp index bd7685819..2856ae453 100644 --- a/src/experimental/filesystem/operations.cpp +++ b/src/experimental/filesystem/operations.cpp @@ -513,8 +513,8 @@ bool checked_set(CType* out, ChronoType time) { return true; } -using TimeSpec = struct ::timespec; -using StatT = struct ::stat; +using TimeSpec = struct timespec; +using StatT = struct stat; #if defined(__APPLE__) TimeSpec extract_mtime(StatT const& st) { return st.st_mtimespec; } diff --git a/src/functional.cpp b/src/functional.cpp new file mode 100644 index 000000000..5c2646f01 --- /dev/null +++ b/src/functional.cpp @@ -0,0 +1,26 @@ +//===----------------------- functional.cpp -------------------------------===// +// +// The 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 "functional" + +_LIBCPP_BEGIN_NAMESPACE_STD + +#ifdef _LIBCPP_ABI_BAD_FUNCTION_CALL_KEY_FUNCTION +bad_function_call::~bad_function_call() _NOEXCEPT +{ +} + +const char* +bad_function_call::what() const _NOEXCEPT +{ + return "std::bad_function_call"; +} +#endif + +_LIBCPP_END_NAMESPACE_STD diff --git a/src/include/atomic_support.h b/src/include/atomic_support.h index 378541b23..08847e630 100644 --- a/src/include/atomic_support.h +++ b/src/include/atomic_support.h @@ -29,7 +29,7 @@ #endif #if !defined(_LIBCPP_HAS_ATOMIC_BUILTINS) && !defined(_LIBCPP_HAS_NO_THREADS) -# if defined(_LIBCPP_MSVC) +# if defined(_LIBCPP_WARNING) _LIBCPP_WARNING("Building libc++ without __atomic builtins is unsupported") # else # warning Building libc++ without __atomic builtins is unsupported diff --git a/src/ios.cpp b/src/ios.cpp index 5c5f241be..c1d232778 100644 --- a/src/ios.cpp +++ b/src/ios.cpp @@ -25,6 +25,7 @@ #include "new" #include "streambuf" #include "string" +#include "__undef_macros" _LIBCPP_BEGIN_NAMESPACE_STD diff --git a/src/iostream.cpp b/src/iostream.cpp index a972be954..534b47a91 100644 --- a/src/iostream.cpp +++ b/src/iostream.cpp @@ -15,14 +15,14 @@ _LIBCPP_BEGIN_NAMESPACE_STD #ifndef _LIBCPP_HAS_NO_STDIN _ALIGNAS_TYPE (istream) _LIBCPP_FUNC_VIS char cin[sizeof(istream)] -#if defined(_MSC_VER) && defined(__clang__) +#if defined(_LIBCPP_ABI_MICROSOFT) && defined(__clang__) __asm__("?cin@__1@std@@3V?$basic_istream@DU?$char_traits@D@__1@std@@@12@A") #endif ; _ALIGNAS_TYPE (__stdinbuf ) static char __cin[sizeof(__stdinbuf )]; static mbstate_t mb_cin; _ALIGNAS_TYPE (wistream) _LIBCPP_FUNC_VIS char wcin[sizeof(wistream)] -#if defined(_MSC_VER) && defined(__clang__) +#if defined(_LIBCPP_ABI_MICROSOFT) && defined(__clang__) __asm__("?wcin@__1@std@@3V?$basic_istream@_WU?$char_traits@_W@__1@std@@@12@A") #endif ; @@ -32,14 +32,14 @@ static mbstate_t mb_wcin; #ifndef _LIBCPP_HAS_NO_STDOUT _ALIGNAS_TYPE (ostream) _LIBCPP_FUNC_VIS char cout[sizeof(ostream)] -#if defined(_MSC_VER) && defined(__clang__) +#if defined(_LIBCPP_ABI_MICROSOFT) && defined(__clang__) __asm__("?cout@__1@std@@3V?$basic_ostream@DU?$char_traits@D@__1@std@@@12@A") #endif ; _ALIGNAS_TYPE (__stdoutbuf) static char __cout[sizeof(__stdoutbuf)]; static mbstate_t mb_cout; _ALIGNAS_TYPE (wostream) _LIBCPP_FUNC_VIS char wcout[sizeof(wostream)] -#if defined(_MSC_VER) && defined(__clang__) +#if defined(_LIBCPP_ABI_MICROSOFT) && defined(__clang__) __asm__("?wcout@__1@std@@3V?$basic_ostream@_WU?$char_traits@_W@__1@std@@@12@A") #endif ; @@ -48,14 +48,14 @@ static mbstate_t mb_wcout; #endif _ALIGNAS_TYPE (ostream) _LIBCPP_FUNC_VIS char cerr[sizeof(ostream)] -#if defined(_MSC_VER) && defined(__clang__) +#if defined(_LIBCPP_ABI_MICROSOFT) && defined(__clang__) __asm__("?cerr@__1@std@@3V?$basic_ostream@DU?$char_traits@D@__1@std@@@12@A") #endif ; _ALIGNAS_TYPE (__stdoutbuf) static char __cerr[sizeof(__stdoutbuf)]; static mbstate_t mb_cerr; _ALIGNAS_TYPE (wostream) _LIBCPP_FUNC_VIS char wcerr[sizeof(wostream)] -#if defined(_MSC_VER) && defined(__clang__) +#if defined(_LIBCPP_ABI_MICROSOFT) && defined(__clang__) __asm__("?wcerr@__1@std@@3V?$basic_ostream@_WU?$char_traits@_W@__1@std@@@12@A") #endif ; @@ -63,12 +63,12 @@ _ALIGNAS_TYPE (__stdoutbuf) static char __wcerr[sizeof(__stdoutbuf #include +#include "__undef_macros" // On Linux, wint_t and wchar_t have different signed-ness, and this causes // lots of noise in the build log, but no bugs that I know of. @@ -48,6 +49,24 @@ _LIBCPP_BEGIN_NAMESPACE_STD +struct __libcpp_unique_locale { + __libcpp_unique_locale(const char* nm) : __loc_(newlocale(LC_ALL_MASK, nm, 0)) {} + + ~__libcpp_unique_locale() { + if (__loc_) + freelocale(__loc_); + } + + explicit operator bool() const { return __loc_; } + + locale_t& get() { return __loc_; } + + locale_t __loc_; +private: + __libcpp_unique_locale(__libcpp_unique_locale const&); + __libcpp_unique_locale& operator=(__libcpp_unique_locale const&); +}; + #ifdef __cloc_defined locale_t __cloc() { // In theory this could create a race condition. In practice @@ -71,8 +90,8 @@ T& make(A0 a0) { static typename aligned_storage::type buf; - ::new (&buf) T(a0); - return *reinterpret_cast(&buf); + auto *obj = ::new (&buf) T(a0); + return *obj; } template @@ -91,8 +110,8 @@ T& make(A0 a0, A1 a1, A2 a2) { static typename aligned_storage::type buf; - ::new (&buf) T(a0, a1, a2); - return *reinterpret_cast(&buf); + auto *obj = ::new (&buf) T(a0, a1, a2); + return *obj; } template @@ -483,8 +502,8 @@ locale::__imp::make_global() { // only one thread can get in here and it only gets in once static aligned_storage::type buf; - ::new (&buf) locale(locale::classic()); - return *reinterpret_cast(&buf); + auto *obj = ::new (&buf) locale(locale::classic()); + return *obj; } locale& @@ -1112,13 +1131,7 @@ ctype::classic_table() _NOEXCEPT #elif __sun__ return __ctype_mask; #elif defined(_LIBCPP_MSVCRT) || defined(__MINGW32__) -#if _VC_CRT_MAJOR_VERSION < 14 - // This is assumed to be safe, which is a nonsense assumption because we're - // going to end up dereferencing it later... - return _ctype+1; // internal ctype mask table defined in msvcrt.dll -#else return __pctype_func(); -#endif #elif defined(__EMSCRIPTEN__) return *__ctype_b_loc(); #elif defined(_NEWLIB_VERSION) @@ -4194,7 +4207,7 @@ __widen_from_utf8<32>::~__widen_from_utf8() static bool checked_string_to_wchar_convert(wchar_t& dest, const char* ptr, - __locale_struct* loc) { + locale_t loc) { if (*ptr == '\0') return false; mbstate_t mb = {}; @@ -4209,7 +4222,7 @@ static bool checked_string_to_wchar_convert(wchar_t& dest, static bool checked_string_to_char_convert(char& dest, const char* ptr, - __locale_struct* __loc) { + locale_t __loc) { if (*ptr == '\0') return false; if (!ptr[1]) { @@ -4304,8 +4317,8 @@ numpunct_byname::__init(const char* nm) { if (strcmp(nm, "C") != 0) { - __locale_unique_ptr loc(newlocale(LC_ALL_MASK, nm, 0), freelocale); - if (loc == nullptr) + __libcpp_unique_locale loc(nm); + if (!loc) __throw_runtime_error("numpunct_byname::numpunct_byname" " failed to construct for " + string(nm)); @@ -4342,8 +4355,8 @@ numpunct_byname::__init(const char* nm) { if (strcmp(nm, "C") != 0) { - __locale_unique_ptr loc(newlocale(LC_ALL_MASK, nm, 0), freelocale); - if (loc == nullptr) + __libcpp_unique_locale loc(nm); + if (!loc) __throw_runtime_error("numpunct_byname::numpunct_byname" " failed to construct for " + string(nm)); @@ -5829,8 +5842,8 @@ void moneypunct_byname::init(const char* nm) { typedef moneypunct base; - __locale_unique_ptr loc(newlocale(LC_ALL_MASK, nm, 0), freelocale); - if (loc == nullptr) + __libcpp_unique_locale loc(nm); + if (!loc) __throw_runtime_error("moneypunct_byname" " failed to construct for " + string(nm)); @@ -5873,8 +5886,8 @@ void moneypunct_byname::init(const char* nm) { typedef moneypunct base; - __locale_unique_ptr loc(newlocale(LC_ALL_MASK, nm, 0), freelocale); - if (loc == nullptr) + __libcpp_unique_locale loc(nm); + if (!loc) __throw_runtime_error("moneypunct_byname" " failed to construct for " + string(nm)); @@ -5933,8 +5946,8 @@ void moneypunct_byname::init(const char* nm) { typedef moneypunct base; - __locale_unique_ptr loc(newlocale(LC_ALL_MASK, nm, 0), freelocale); - if (loc == nullptr) + __libcpp_unique_locale loc(nm); + if (!loc) __throw_runtime_error("moneypunct_byname" " failed to construct for " + string(nm)); lconv* lc = __libcpp_localeconv_l(loc.get()); @@ -5998,8 +6011,8 @@ void moneypunct_byname::init(const char* nm) { typedef moneypunct base; - __locale_unique_ptr loc(newlocale(LC_ALL_MASK, nm, 0), freelocale); - if (loc == nullptr) + __libcpp_unique_locale loc(nm); + if (!loc) __throw_runtime_error("moneypunct_byname" " failed to construct for " + string(nm)); diff --git a/src/memory.cpp b/src/memory.cpp index f6f6fe8da..4e0d3af91 100644 --- a/src/memory.cpp +++ b/src/memory.cpp @@ -120,7 +120,7 @@ __shared_weak_count::lock() _NOEXCEPT object_owners+1)) return this; } - return 0; + return nullptr; } #if !defined(_LIBCPP_NO_RTTI) || !defined(_LIBCPP_BUILD_STATIC) @@ -128,7 +128,7 @@ __shared_weak_count::lock() _NOEXCEPT const void* __shared_weak_count::__get_deleter(const type_info&) const _NOEXCEPT { - return 0; + return nullptr; } #endif // _LIBCPP_NO_RTTI @@ -154,7 +154,7 @@ __sp_mut::lock() _NOEXCEPT { auto m = static_cast<__libcpp_mutex_t*>(__lx); unsigned count = 0; - while (__libcpp_mutex_trylock(m) != 0) + while (!__libcpp_mutex_trylock(m)) { if (++count > 16) { diff --git a/src/mutex.cpp b/src/mutex.cpp index b858e8877..c36bd5549 100644 --- a/src/mutex.cpp +++ b/src/mutex.cpp @@ -12,6 +12,7 @@ #include "limits" #include "system_error" #include "include/atomic_support.h" +#include "__undef_macros" _LIBCPP_BEGIN_NAMESPACE_STD #ifndef _LIBCPP_HAS_NO_THREADS diff --git a/src/new.cpp b/src/new.cpp index 21b307401..2b2682fa6 100644 --- a/src/new.cpp +++ b/src/new.cpp @@ -183,7 +183,7 @@ operator new(std::size_t size, std::align_val_t alignment) _THROW_BAD_ALLOC if (static_cast(alignment) < sizeof(void*)) alignment = std::align_val_t(sizeof(void*)); void* p; -#if defined(_LIBCPP_MSVCRT) +#if defined(_LIBCPP_MSVCRT_LIKE) while ((p = _aligned_malloc(size, static_cast(alignment))) == nullptr) #else while (::posix_memalign(&p, static_cast(alignment), size) != 0) @@ -256,7 +256,7 @@ void operator delete(void* ptr, std::align_val_t) _NOEXCEPT { if (ptr) -#if defined(_LIBCPP_MSVCRT) +#if defined(_LIBCPP_MSVCRT_LIKE) ::_aligned_free(ptr); #else ::free(ptr); diff --git a/src/string.cpp b/src/string.cpp index fb85203d4..6a175f221 100644 --- a/src/string.cpp +++ b/src/string.cpp @@ -16,9 +16,6 @@ #include "cerrno" #include "limits" #include "stdexcept" -#ifdef _LIBCPP_MSVCRT -#include "support/win32/support.h" -#endif // _LIBCPP_MSVCRT #include _LIBCPP_BEGIN_NAMESPACE_STD @@ -433,7 +430,7 @@ get_swprintf() #ifndef _LIBCPP_MSVCRT return swprintf; #else - return static_cast(swprintf); + return static_cast(_snwprintf); #endif } diff --git a/src/strstream.cpp b/src/strstream.cpp index be94f9c89..01523cf45 100644 --- a/src/strstream.cpp +++ b/src/strstream.cpp @@ -13,6 +13,7 @@ #include "cstring" #include "cstdlib" #include "__debug" +#include "__undef_macros" _LIBCPP_BEGIN_NAMESPACE_STD diff --git a/src/support/runtime/exception_pointer_msvc.ipp b/src/support/runtime/exception_pointer_msvc.ipp new file mode 100644 index 000000000..eab5d30a9 --- /dev/null +++ b/src/support/runtime/exception_pointer_msvc.ipp @@ -0,0 +1,95 @@ +// -*- 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. +// +//===----------------------------------------------------------------------===// + +#include +#include +#include // for _CRTIMP2_PURE + +_CRTIMP2_PURE void __CLRCALL_PURE_OR_CDECL __ExceptionPtrCreate(_Out_ void*); +_CRTIMP2_PURE void __CLRCALL_PURE_OR_CDECL __ExceptionPtrDestroy(_Inout_ void*); +_CRTIMP2_PURE void __CLRCALL_PURE_OR_CDECL __ExceptionPtrCopy(_Out_ void*, + _In_ const void*); +_CRTIMP2_PURE void __CLRCALL_PURE_OR_CDECL +__ExceptionPtrAssign(_Inout_ void*, _In_ const void*); +_CRTIMP2_PURE bool __CLRCALL_PURE_OR_CDECL +__ExceptionPtrCompare(_In_ const void*, _In_ const void*); +_CRTIMP2_PURE bool __CLRCALL_PURE_OR_CDECL +__ExceptionPtrToBool(_In_ const void*); +_CRTIMP2_PURE void __CLRCALL_PURE_OR_CDECL __ExceptionPtrSwap(_Inout_ void*, + _Inout_ void*); +_CRTIMP2_PURE void __CLRCALL_PURE_OR_CDECL +__ExceptionPtrCurrentException(_Out_ void*); +[[noreturn]] _CRTIMP2_PURE void __CLRCALL_PURE_OR_CDECL +__ExceptionPtrRethrow(_In_ const void*); +_CRTIMP2_PURE void __CLRCALL_PURE_OR_CDECL +__ExceptionPtrCopyException(_Inout_ void*, _In_ const void*, _In_ const void*); + +namespace std { + +exception_ptr::exception_ptr() _NOEXCEPT { __ExceptionPtrCreate(this); } +exception_ptr::exception_ptr(nullptr_t) _NOEXCEPT { __ExceptionPtrCreate(this); } + +exception_ptr::exception_ptr(const exception_ptr& __other) _NOEXCEPT { + __ExceptionPtrCopy(this, &__other); +} +exception_ptr& exception_ptr::operator=(const exception_ptr& __other) _NOEXCEPT { + __ExceptionPtrAssign(this, &__other); + return *this; +} + +exception_ptr& exception_ptr::operator=(nullptr_t) _NOEXCEPT { + exception_ptr dummy; + __ExceptionPtrAssign(this, &dummy); + return *this; +} + +exception_ptr::~exception_ptr() _NOEXCEPT { __ExceptionPtrDestroy(this); } + +exception_ptr::operator bool() const _NOEXCEPT { + return __ExceptionPtrToBool(this); +} + +bool operator==(const exception_ptr& __x, const exception_ptr& __y) _NOEXCEPT { + return __ExceptionPtrCompare(&__x, &__y); +} + + +void swap(exception_ptr& lhs, exception_ptr& rhs) _NOEXCEPT { + __ExceptionPtrSwap(&rhs, &lhs); +} + +exception_ptr __copy_exception_ptr(void* __except, const void* __ptr) { + exception_ptr __ret = nullptr; + if (__ptr) + __ExceptionPtrCopyException(&__ret, __except, __ptr); + return __ret; +} + +exception_ptr current_exception() _NOEXCEPT { + exception_ptr __ret; + __ExceptionPtrCurrentException(&__ret); + return __ret; +} + +_LIBCPP_NORETURN +void rethrow_exception(exception_ptr p) { __ExceptionPtrRethrow(&p); } + +nested_exception::nested_exception() _NOEXCEPT : __ptr_(current_exception()) {} + +nested_exception::~nested_exception() _NOEXCEPT {} + +_LIBCPP_NORETURN +void nested_exception::rethrow_nested() const { + if (__ptr_ == nullptr) + terminate(); + rethrow_exception(__ptr_); +} + +} // namespace std diff --git a/src/support/win32/locale_win32.cpp b/src/support/win32/locale_win32.cpp index ee1381117..13a6eaeda 100644 --- a/src/support/win32/locale_win32.cpp +++ b/src/support/win32/locale_win32.cpp @@ -13,16 +13,14 @@ #include #include -#include - -typedef _VSTD::remove_pointer::type __locale_struct; -typedef _VSTD::unique_ptr<__locale_struct, decltype(&uselocale)> __locale_raii; +using std::__libcpp_locale_guard; // FIXME: base currently unused. Needs manual work to construct the new locale locale_t newlocale( int mask, const char * locale, locale_t /*base*/ ) { return _create_locale( mask, locale ); } + locale_t uselocale( locale_t newloc ) { locale_t old_locale = _get_current_locale(); @@ -31,67 +29,78 @@ locale_t uselocale( locale_t newloc ) // uselocale sets the thread's locale by definition, so unconditionally use thread-local locale _configthreadlocale( _ENABLE_PER_THREAD_LOCALE ); // uselocale sets all categories -#if _VC_CRT_MAJOR_VERSION < 14 - setlocale( LC_ALL, newloc->locinfo->lc_category[LC_ALL].locale ); -#endif + // disable setting locale on Windows temporarily because the structure is opaque (PR31516) + //setlocale( LC_ALL, newloc->locinfo->lc_category[LC_ALL].locale ); // uselocale returns the old locale_t return old_locale; } + +decltype(MB_CUR_MAX) MB_CUR_MAX_L( locale_t __l ) +{ +#if defined(_LIBCPP_MSVCRT) + return ___mb_cur_max_l_func(__l); +#else + __libcpp_locale_guard __current(__l); + return MB_CUR_MAX; +#endif +} + + lconv *localeconv_l( locale_t loc ) { - __locale_raii __current( uselocale(loc), uselocale ); + __libcpp_locale_guard __current(loc); return localeconv(); } size_t mbrlen_l( const char *__restrict s, size_t n, mbstate_t *__restrict ps, locale_t loc ) { - __locale_raii __current( uselocale(loc), uselocale ); + __libcpp_locale_guard __current(loc); return mbrlen( s, n, ps ); } size_t mbsrtowcs_l( wchar_t *__restrict dst, const char **__restrict src, size_t len, mbstate_t *__restrict ps, locale_t loc ) { - __locale_raii __current( uselocale(loc), uselocale ); + __libcpp_locale_guard __current(loc); return mbsrtowcs( dst, src, len, ps ); } size_t wcrtomb_l( char *__restrict s, wchar_t wc, mbstate_t *__restrict ps, locale_t loc ) { - __locale_raii __current( uselocale(loc), uselocale ); + __libcpp_locale_guard __current(loc); return wcrtomb( s, wc, ps ); } size_t mbrtowc_l( wchar_t *__restrict pwc, const char *__restrict s, size_t n, mbstate_t *__restrict ps, locale_t loc ) { - __locale_raii __current( uselocale(loc), uselocale ); + __libcpp_locale_guard __current(loc); return mbrtowc( pwc, s, n, ps ); } size_t mbsnrtowcs_l( wchar_t *__restrict dst, const char **__restrict src, size_t nms, size_t len, mbstate_t *__restrict ps, locale_t loc ) { - __locale_raii __current( uselocale(loc), uselocale ); + __libcpp_locale_guard __current(loc); return mbsnrtowcs( dst, src, nms, len, ps ); } size_t wcsnrtombs_l( char *__restrict dst, const wchar_t **__restrict src, size_t nwc, size_t len, mbstate_t *__restrict ps, locale_t loc ) { - __locale_raii __current( uselocale(loc), uselocale ); + __libcpp_locale_guard __current(loc); return wcsnrtombs( dst, src, nwc, len, ps ); } wint_t btowc_l( int c, locale_t loc ) { - __locale_raii __current( uselocale(loc), uselocale ); + __libcpp_locale_guard __current(loc); return btowc( c ); } int wctob_l( wint_t c, locale_t loc ) { - __locale_raii __current( uselocale(loc), uselocale ); + __libcpp_locale_guard __current(loc); return wctob( c ); } int snprintf_l(char *ret, size_t n, locale_t loc, const char *format, ...) { - __locale_raii __current( uselocale(loc), uselocale ); + __libcpp_locale_guard __current(loc); va_list ap; va_start( ap, format ); int result = vsnprintf( ret, n, format, ap ); @@ -109,6 +118,18 @@ int asprintf_l( char **ret, locale_t loc, const char *format, ... ) } int vasprintf_l( char **ret, locale_t loc, const char *format, va_list ap ) { - __locale_raii __current( uselocale(loc), uselocale ); + __libcpp_locale_guard __current(loc); return vasprintf( ret, format, ap ); } + +#if !defined(_LIBCPP_MSVCRT) +float strtof_l(const char* nptr, char** endptr, locale_t loc) { + __libcpp_locale_guard __current(loc); + return strtof(nptr, endptr); +} + +long double strtold_l(const char* nptr, char** endptr, locale_t loc) { + __libcpp_locale_guard __current(loc); + return strtold(nptr, endptr); +} +#endif diff --git a/src/support/win32/support.cpp b/src/support/win32/support.cpp index e989681a6..dbd1c4c41 100644 --- a/src/support/win32/support.cpp +++ b/src/support/win32/support.cpp @@ -15,17 +15,6 @@ #include // strcpy, wcsncpy #include // mbstate_t -// Some of these functions aren't standard or if they conform, the name does not. - -int asprintf(char **sptr, const char *__restrict format, ...) -{ - va_list ap; - va_start(ap, format); - int result; - result = vasprintf(sptr, format, ap); - va_end(ap); - return result; -} // Like sprintf, but when return value >= 0 it returns // a pointer to a malloc'd string in *sptr. diff --git a/src/system_error.cpp b/src/system_error.cpp index cbbbb5dcd..17f2c9a5b 100644 --- a/src/system_error.cpp +++ b/src/system_error.cpp @@ -65,7 +65,7 @@ constexpr size_t strerror_buff_size = 1024; string do_strerror_r(int ev); -#if defined(_LIBCPP_MSVCRT) +#if defined(_LIBCPP_MSVCRT_LIKE) string do_strerror_r(int ev) { char buffer[strerror_buff_size]; if (::strerror_s(buffer, strerror_buff_size, ev) == 0) diff --git a/src/thread.cpp b/src/thread.cpp index 3f283c385..550da8ea7 100644 --- a/src/thread.cpp +++ b/src/thread.cpp @@ -34,7 +34,7 @@ #if defined(_LIBCPP_WIN32API) #include -#endif // defined(_LIBCPP_WIN32API) +#endif _LIBCPP_BEGIN_NAMESPACE_STD @@ -99,7 +99,7 @@ thread::hardware_concurrency() _NOEXCEPT #else // defined(CTL_HW) && defined(HW_NCPU) // TODO: grovel through /proc or check cpuid on x86 and similar // instructions on other architectures. -# if defined(_LIBCPP_MSVC) +# if defined(_LIBCPP_WARNING) _LIBCPP_WARNING("hardware_concurrency not yet implemented") # else # warning hardware_concurrency not yet implemented diff --git a/test/libcxx/algorithms/alg.modifying.operations/alg.random.shuffle/random_shuffle.cxx1z.pass.cpp b/test/libcxx/algorithms/alg.modifying.operations/alg.random.shuffle/random_shuffle.cxx1z.pass.cpp new file mode 100644 index 000000000..ef3ef7519 --- /dev/null +++ b/test/libcxx/algorithms/alg.modifying.operations/alg.random.shuffle/random_shuffle.cxx1z.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. +// +//===----------------------------------------------------------------------===// + +// + +// template +// void +// random_shuffle(RandomAccessIterator first, RandomAccessIterator last); +// +// template +// void +// random_shuffle(RandomAccessIterator first, RandomAccessIterator last, +// RandomNumberGenerator& rand); + +// +// In C++17, random_shuffle has been removed. +// However, for backwards compatibility, if _LIBCPP_ENABLE_CXX17_REMOVED_RANDOM_SHUFFLE +// is defined before including , then random_shuffle will be restored. + +#define _LIBCPP_ENABLE_CXX17_REMOVED_RANDOM_SHUFFLE + +#include +#include + +struct gen +{ + std::ptrdiff_t operator()(std::ptrdiff_t n) + { + return n-1; + } +}; + + +int main() +{ + std::vector v; + std::random_shuffle(v.begin(), v.end()); + gen r; + std::random_shuffle(v.begin(), v.end(), r); +} diff --git a/test/libcxx/atomics/diagnose_invalid_memory_order.fail.cpp b/test/libcxx/atomics/diagnose_invalid_memory_order.fail.cpp index d8bb363d8..51a1f2307 100644 --- a/test/libcxx/atomics/diagnose_invalid_memory_order.fail.cpp +++ b/test/libcxx/atomics/diagnose_invalid_memory_order.fail.cpp @@ -7,6 +7,10 @@ // //===----------------------------------------------------------------------===// +// This test fails because diagnose_if doesn't emit all of the diagnostics +// when -fdelayed-template-parsing is enabled, like it is on Windows. +// XFAIL: LIBCXX-WINDOWS-FIXME + // REQUIRES: verify-support, diagnose-if-support // UNSUPPORTED: libcpp-has-no-threads diff --git a/test/libcxx/containers/sequences/list/list.cons/db_copy.pass.cpp b/test/libcxx/containers/sequences/list/list.cons/db_copy.pass.cpp index c84960f37..a0b35f335 100644 --- a/test/libcxx/containers/sequences/list/list.cons/db_copy.pass.cpp +++ b/test/libcxx/containers/sequences/list/list.cons/db_copy.pass.cpp @@ -8,6 +8,8 @@ //===----------------------------------------------------------------------===// // +// Can't test the system lib because this test enables debug mode +// UNSUPPORTED: with_system_cxx_lib // list(list&& c); diff --git a/test/libcxx/containers/sequences/list/list.cons/db_move.pass.cpp b/test/libcxx/containers/sequences/list/list.cons/db_move.pass.cpp index dd424e89e..570e5a0b3 100644 --- a/test/libcxx/containers/sequences/list/list.cons/db_move.pass.cpp +++ b/test/libcxx/containers/sequences/list/list.cons/db_move.pass.cpp @@ -9,6 +9,9 @@ // UNSUPPORTED: c++98, c++03 +// Can't test the system lib because this test enables debug mode +// UNSUPPORTED: with_system_cxx_lib + // // list(list&& c); diff --git a/test/libcxx/containers/sequences/list/list.modifiers/emplace_db1.pass.cpp b/test/libcxx/containers/sequences/list/list.modifiers/emplace_db1.pass.cpp index 1d64f9bd9..67146bc7c 100644 --- a/test/libcxx/containers/sequences/list/list.modifiers/emplace_db1.pass.cpp +++ b/test/libcxx/containers/sequences/list/list.modifiers/emplace_db1.pass.cpp @@ -9,6 +9,9 @@ // UNSUPPORTED: c++98, c++03 +// Can't test the system lib because this test enables debug mode +// UNSUPPORTED: with_system_cxx_lib + // // template void emplace(const_iterator p, Args&&... args); diff --git a/test/libcxx/containers/sequences/list/list.modifiers/erase_iter_db1.pass.cpp b/test/libcxx/containers/sequences/list/list.modifiers/erase_iter_db1.pass.cpp index ec5de0264..24cadbe01 100644 --- a/test/libcxx/containers/sequences/list/list.modifiers/erase_iter_db1.pass.cpp +++ b/test/libcxx/containers/sequences/list/list.modifiers/erase_iter_db1.pass.cpp @@ -7,6 +7,9 @@ // //===----------------------------------------------------------------------===// +// Can't test the system lib because this test enables debug mode +// UNSUPPORTED: with_system_cxx_lib + // // Call erase(const_iterator position) with end() diff --git a/test/libcxx/containers/sequences/list/list.modifiers/erase_iter_db2.pass.cpp b/test/libcxx/containers/sequences/list/list.modifiers/erase_iter_db2.pass.cpp index 833e2b54d..6d3e7617b 100644 --- a/test/libcxx/containers/sequences/list/list.modifiers/erase_iter_db2.pass.cpp +++ b/test/libcxx/containers/sequences/list/list.modifiers/erase_iter_db2.pass.cpp @@ -7,6 +7,9 @@ // //===----------------------------------------------------------------------===// +// Can't test the system lib because this test enables debug mode +// UNSUPPORTED: with_system_cxx_lib + // // Call erase(const_iterator position) with iterator from another container diff --git a/test/libcxx/containers/sequences/list/list.modifiers/erase_iter_iter_db1.pass.cpp b/test/libcxx/containers/sequences/list/list.modifiers/erase_iter_iter_db1.pass.cpp index eef7a98e7..dd592f90c 100644 --- a/test/libcxx/containers/sequences/list/list.modifiers/erase_iter_iter_db1.pass.cpp +++ b/test/libcxx/containers/sequences/list/list.modifiers/erase_iter_iter_db1.pass.cpp @@ -7,6 +7,9 @@ // //===----------------------------------------------------------------------===// +// Can't test the system lib because this test enables debug mode +// UNSUPPORTED: with_system_cxx_lib + // // Call erase(const_iterator first, const_iterator last); with first iterator from another container diff --git a/test/libcxx/containers/sequences/list/list.modifiers/erase_iter_iter_db2.pass.cpp b/test/libcxx/containers/sequences/list/list.modifiers/erase_iter_iter_db2.pass.cpp index 0dd03dc50..d5e8fd9d8 100644 --- a/test/libcxx/containers/sequences/list/list.modifiers/erase_iter_iter_db2.pass.cpp +++ b/test/libcxx/containers/sequences/list/list.modifiers/erase_iter_iter_db2.pass.cpp @@ -7,6 +7,9 @@ // //===----------------------------------------------------------------------===// +// Can't test the system lib because this test enables debug mode +// UNSUPPORTED: with_system_cxx_lib + // // Call erase(const_iterator first, const_iterator last); with second iterator from another container diff --git a/test/libcxx/containers/sequences/list/list.modifiers/erase_iter_iter_db3.pass.cpp b/test/libcxx/containers/sequences/list/list.modifiers/erase_iter_iter_db3.pass.cpp index 22273a89f..3ae20cdc5 100644 --- a/test/libcxx/containers/sequences/list/list.modifiers/erase_iter_iter_db3.pass.cpp +++ b/test/libcxx/containers/sequences/list/list.modifiers/erase_iter_iter_db3.pass.cpp @@ -7,6 +7,9 @@ // //===----------------------------------------------------------------------===// +// Can't test the system lib because this test enables debug mode +// UNSUPPORTED: with_system_cxx_lib + // // Call erase(const_iterator first, const_iterator last); with both iterators from another container diff --git a/test/libcxx/containers/sequences/list/list.modifiers/erase_iter_iter_db4.pass.cpp b/test/libcxx/containers/sequences/list/list.modifiers/erase_iter_iter_db4.pass.cpp index d1e03c8ac..6d6e29e47 100644 --- a/test/libcxx/containers/sequences/list/list.modifiers/erase_iter_iter_db4.pass.cpp +++ b/test/libcxx/containers/sequences/list/list.modifiers/erase_iter_iter_db4.pass.cpp @@ -7,6 +7,9 @@ // //===----------------------------------------------------------------------===// +// Can't test the system lib because this test enables debug mode +// UNSUPPORTED: with_system_cxx_lib + // // Call erase(const_iterator first, const_iterator last); with a bad range diff --git a/test/libcxx/containers/sequences/list/list.modifiers/insert_iter_iter_iter_db1.pass.cpp b/test/libcxx/containers/sequences/list/list.modifiers/insert_iter_iter_iter_db1.pass.cpp index 7fadb14af..03b9667cf 100644 --- a/test/libcxx/containers/sequences/list/list.modifiers/insert_iter_iter_iter_db1.pass.cpp +++ b/test/libcxx/containers/sequences/list/list.modifiers/insert_iter_iter_iter_db1.pass.cpp @@ -7,6 +7,9 @@ // //===----------------------------------------------------------------------===// +// Can't test the system lib because this test enables debug mode +// UNSUPPORTED: with_system_cxx_lib + // // template diff --git a/test/libcxx/containers/sequences/list/list.modifiers/insert_iter_rvalue_db1.pass.cpp b/test/libcxx/containers/sequences/list/list.modifiers/insert_iter_rvalue_db1.pass.cpp index 0d0fd100f..589af7cc4 100644 --- a/test/libcxx/containers/sequences/list/list.modifiers/insert_iter_rvalue_db1.pass.cpp +++ b/test/libcxx/containers/sequences/list/list.modifiers/insert_iter_rvalue_db1.pass.cpp @@ -7,6 +7,9 @@ // //===----------------------------------------------------------------------===// +// Can't test the system lib because this test enables debug mode +// UNSUPPORTED: with_system_cxx_lib + // // iterator insert(const_iterator position, value_type&& x); diff --git a/test/libcxx/containers/sequences/list/list.modifiers/insert_iter_size_value_db1.pass.cpp b/test/libcxx/containers/sequences/list/list.modifiers/insert_iter_size_value_db1.pass.cpp index 4fdfbfa50..6999c4053 100644 --- a/test/libcxx/containers/sequences/list/list.modifiers/insert_iter_size_value_db1.pass.cpp +++ b/test/libcxx/containers/sequences/list/list.modifiers/insert_iter_size_value_db1.pass.cpp @@ -7,6 +7,9 @@ // //===----------------------------------------------------------------------===// +// Can't test the system lib because this test enables debug mode +// UNSUPPORTED: with_system_cxx_lib + // // iterator insert(const_iterator position, size_type n, const value_type& x); diff --git a/test/libcxx/containers/sequences/list/list.modifiers/insert_iter_value_db1.pass.cpp b/test/libcxx/containers/sequences/list/list.modifiers/insert_iter_value_db1.pass.cpp index 9a13520b9..66983f01e 100644 --- a/test/libcxx/containers/sequences/list/list.modifiers/insert_iter_value_db1.pass.cpp +++ b/test/libcxx/containers/sequences/list/list.modifiers/insert_iter_value_db1.pass.cpp @@ -7,6 +7,9 @@ // //===----------------------------------------------------------------------===// +// Can't test the system lib because this test enables debug mode +// UNSUPPORTED: with_system_cxx_lib + // // iterator insert(const_iterator position, const value_type& x); diff --git a/test/libcxx/containers/sequences/list/list.modifiers/pop_back_db1.pass.cpp b/test/libcxx/containers/sequences/list/list.modifiers/pop_back_db1.pass.cpp index 795e66d97..9151fc1dd 100644 --- a/test/libcxx/containers/sequences/list/list.modifiers/pop_back_db1.pass.cpp +++ b/test/libcxx/containers/sequences/list/list.modifiers/pop_back_db1.pass.cpp @@ -7,6 +7,9 @@ // //===----------------------------------------------------------------------===// +// Can't test the system lib because this test enables debug mode +// UNSUPPORTED: with_system_cxx_lib + // // void pop_back(); diff --git a/test/libcxx/containers/sequences/list/list.ops/db_splice_pos_list.pass.cpp b/test/libcxx/containers/sequences/list/list.ops/db_splice_pos_list.pass.cpp index 7a1180a9b..541dd056b 100644 --- a/test/libcxx/containers/sequences/list/list.ops/db_splice_pos_list.pass.cpp +++ b/test/libcxx/containers/sequences/list/list.ops/db_splice_pos_list.pass.cpp @@ -7,6 +7,9 @@ // //===----------------------------------------------------------------------===// +// Can't test the system lib because this test enables debug mode +// UNSUPPORTED: with_system_cxx_lib + // // void splice(const_iterator position, list& x); diff --git a/test/libcxx/containers/sequences/list/list.ops/db_splice_pos_list_iter.pass.cpp b/test/libcxx/containers/sequences/list/list.ops/db_splice_pos_list_iter.pass.cpp index fa5243e32..64ef78ed0 100644 --- a/test/libcxx/containers/sequences/list/list.ops/db_splice_pos_list_iter.pass.cpp +++ b/test/libcxx/containers/sequences/list/list.ops/db_splice_pos_list_iter.pass.cpp @@ -7,6 +7,9 @@ // //===----------------------------------------------------------------------===// +// Can't test the system lib because this test enables debug mode +// UNSUPPORTED: with_system_cxx_lib + // // void splice(const_iterator position, list& x, iterator i); diff --git a/test/libcxx/containers/sequences/list/list.ops/db_splice_pos_list_iter_iter.pass.cpp b/test/libcxx/containers/sequences/list/list.ops/db_splice_pos_list_iter_iter.pass.cpp index a385b4cf7..9fed4b577 100644 --- a/test/libcxx/containers/sequences/list/list.ops/db_splice_pos_list_iter_iter.pass.cpp +++ b/test/libcxx/containers/sequences/list/list.ops/db_splice_pos_list_iter_iter.pass.cpp @@ -7,6 +7,9 @@ // //===----------------------------------------------------------------------===// +// Can't test the system lib because this test enables debug mode +// UNSUPPORTED: with_system_cxx_lib + // // void splice(const_iterator position, list& x, iterator first, iterator last); diff --git a/test/libcxx/containers/sequences/vector/asan_throw.pass.cpp b/test/libcxx/containers/sequences/vector/asan_throw.pass.cpp index 43324e941..30cf3f42e 100644 --- a/test/libcxx/containers/sequences/vector/asan_throw.pass.cpp +++ b/test/libcxx/containers/sequences/vector/asan_throw.pass.cpp @@ -13,6 +13,7 @@ #include #include +#include "test_macros.h" #include "asan_testing.h" class X { @@ -70,7 +71,7 @@ void test_push_back() { } void test_emplace_back() { -#ifndef _LIBCPP_HAS_NO_VARIADICS +#if TEST_STD_VER >= 11 std::vector v; v.reserve(2); v.push_back(X(2)); @@ -83,7 +84,7 @@ void test_emplace_back() { } assert(v.size() == 1); assert(is_contiguous_container_asan_correct(v)); -#endif // _LIBCPP_HAS_NO_VARIADICS +#endif } void test_insert_range() { @@ -121,7 +122,7 @@ void test_insert() { } void test_emplace() { -#ifndef _LIBCPP_HAS_NO_VARIADICS +#if TEST_STD_VER >= 11 std::vector v; v.reserve(3); v.insert(v.end(), X(1)); @@ -135,7 +136,7 @@ void test_emplace() { } assert(v.size() == 2); assert(is_contiguous_container_asan_correct(v)); -#endif // _LIBCPP_HAS_NO_VARIADICS +#endif } void test_insert_range2() { diff --git a/test/libcxx/containers/unord/next_pow2.pass.cpp b/test/libcxx/containers/unord/next_pow2.pass.cpp new file mode 100644 index 000000000..3784eb87c --- /dev/null +++ b/test/libcxx/containers/unord/next_pow2.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. +// +//===----------------------------------------------------------------------===// +// +// REQUIRES: long_tests +// UNSUPPORTED: c++98, c++03 + +// Not a portable test + +// <__hash_table> + +// size_t __next_hash_pow2(size_t n); + +// If n <= 1, return n. If n is a power of 2, return n. +// Otherwise, return the next power of 2. + +#include <__hash_table> +#include +#include + +#include + +bool +is_power_of_two(unsigned long n) +{ + return __builtin_popcount(n) == 1; +} + +void test_next_pow2_val(size_t n) +{ + std::size_t npow2 = std::__next_hash_pow2(n); + assert(is_power_of_two(npow2) && npow2 > n); +} + +void +test_next_pow2() +{ + assert(!is_power_of_two(0)); + assert(is_power_of_two(1)); + assert(is_power_of_two(2)); + assert(!is_power_of_two(3)); + + assert(std::__next_hash_pow2(0) == 0); + assert(std::__next_hash_pow2(1) == 1); + + for (std::size_t n = 2; n < (sizeof(std::size_t) * 8 - 1); ++n) + { + std::size_t pow2 = 1ULL << n; + assert(std::__next_hash_pow2(pow2) == pow2); + } + + test_next_pow2_val(3); + test_next_pow2_val(7); + test_next_pow2_val(9); + test_next_pow2_val(15); + test_next_pow2_val(127); + test_next_pow2_val(129); +} + +// Note: this is only really useful when run with -fsanitize=undefined. +void +fuzz_unordered_map_reserve(unsigned num_inserts, + unsigned num_reserve1, + unsigned num_reserve2) +{ + std::unordered_map m; + m.reserve(num_reserve1); + for (unsigned I = 0; I < num_inserts; ++I) m[I] = 0; + m.reserve(num_reserve2); + assert(m.bucket_count() >= num_reserve2); +} + +int main() +{ + test_next_pow2(); + + for (unsigned num_inserts = 0; num_inserts <= 64; ++num_inserts) + for (unsigned num_reserve1 = 1; num_reserve1 <= 64; ++num_reserve1) + for (unsigned num_reserve2 = 1; num_reserve2 <= 64; ++num_reserve2) + fuzz_unordered_map_reserve(num_inserts, num_reserve1, num_reserve2); + + return 0; +} diff --git a/test/libcxx/containers/unord/unord.set/missing_hash_specialization.fail.cpp b/test/libcxx/containers/unord/unord.set/missing_hash_specialization.fail.cpp index d682e7453..d6554a63c 100644 --- a/test/libcxx/containers/unord/unord.set/missing_hash_specialization.fail.cpp +++ b/test/libcxx/containers/unord/unord.set/missing_hash_specialization.fail.cpp @@ -53,7 +53,7 @@ int main() { // FIXME: It would be great to suppress the below diagnostic all together. // but for now it's sufficient that it appears last. However there is // currently no way to test the order diagnostics are issued. - // expected-error@memory:* {{call to implicitly-deleted default constructor of 'std::__1::hash >'}} + // expected-error@memory:* {{call to implicitly-deleted default constructor of '__compressed_pair_elem}} } { using Set = std::unordered_set; diff --git a/test/libcxx/debug/containers/db_associative_container_tests.pass.cpp b/test/libcxx/debug/containers/db_associative_container_tests.pass.cpp index 91cdf85b1..a727b31e4 100644 --- a/test/libcxx/debug/containers/db_associative_container_tests.pass.cpp +++ b/test/libcxx/debug/containers/db_associative_container_tests.pass.cpp @@ -12,6 +12,9 @@ // MODULES_DEFINES: _LIBCPP_DEBUG=1 // MODULES_DEFINES: _LIBCPP_DEBUG_USE_EXCEPTIONS +// Can't test the system lib because this test enables debug mode +// UNSUPPORTED: with_system_cxx_lib + // test container debugging #define _LIBCPP_DEBUG 1 diff --git a/test/libcxx/debug/containers/db_sequence_container_iterators.pass.cpp b/test/libcxx/debug/containers/db_sequence_container_iterators.pass.cpp index 6e2fb7bf3..3ae009a8e 100644 --- a/test/libcxx/debug/containers/db_sequence_container_iterators.pass.cpp +++ b/test/libcxx/debug/containers/db_sequence_container_iterators.pass.cpp @@ -12,6 +12,9 @@ // MODULES_DEFINES: _LIBCPP_DEBUG=1 // MODULES_DEFINES: _LIBCPP_DEBUG_USE_EXCEPTIONS +// Can't test the system lib because this test enables debug mode +// UNSUPPORTED: with_system_cxx_lib + // test container debugging #define _LIBCPP_DEBUG 1 diff --git a/test/libcxx/debug/containers/db_string.pass.cpp b/test/libcxx/debug/containers/db_string.pass.cpp index 8d1a622b4..f6434d5c7 100644 --- a/test/libcxx/debug/containers/db_string.pass.cpp +++ b/test/libcxx/debug/containers/db_string.pass.cpp @@ -12,6 +12,9 @@ // MODULES_DEFINES: _LIBCPP_DEBUG=1 // MODULES_DEFINES: _LIBCPP_DEBUG_USE_EXCEPTIONS +// Can't test the system lib because this test enables debug mode +// UNSUPPORTED: with_system_cxx_lib + // test container debugging #define _LIBCPP_DEBUG 1 diff --git a/test/libcxx/debug/containers/db_unord_container_tests.pass.cpp b/test/libcxx/debug/containers/db_unord_container_tests.pass.cpp index 5618607fb..d6a31e366 100644 --- a/test/libcxx/debug/containers/db_unord_container_tests.pass.cpp +++ b/test/libcxx/debug/containers/db_unord_container_tests.pass.cpp @@ -12,6 +12,9 @@ // MODULES_DEFINES: _LIBCPP_DEBUG=1 // MODULES_DEFINES: _LIBCPP_DEBUG_USE_EXCEPTIONS +// Can't test the system lib because this test enables debug mode +// UNSUPPORTED: with_system_cxx_lib + // test container debugging #define _LIBCPP_DEBUG 1 diff --git a/test/libcxx/debug/debug_abort.pass.cpp b/test/libcxx/debug/debug_abort.pass.cpp index b6e7b0bd8..9a1b4753f 100644 --- a/test/libcxx/debug/debug_abort.pass.cpp +++ b/test/libcxx/debug/debug_abort.pass.cpp @@ -10,6 +10,9 @@ // MODULES_DEFINES: _LIBCPP_DEBUG=0 +// Can't test the system lib because this test enables debug mode +// UNSUPPORTED: with_system_cxx_lib + // Test that the default debug handler aborts the program. #define _LIBCPP_DEBUG 0 diff --git a/test/libcxx/debug/debug_throw.pass.cpp b/test/libcxx/debug/debug_throw.pass.cpp index 716750c78..d1c88400b 100644 --- a/test/libcxx/debug/debug_throw.pass.cpp +++ b/test/libcxx/debug/debug_throw.pass.cpp @@ -11,6 +11,9 @@ // UNSUPPORTED: libcpp-no-exceptions // MODULES_DEFINES: _LIBCPP_DEBUG=0 +// Can't test the system lib because this test enables debug mode +// UNSUPPORTED: with_system_cxx_lib + // Test that the default debug handler can be overridden and test the // throwing debug handler. diff --git a/test/libcxx/debug/debug_throw_register.pass.cpp b/test/libcxx/debug/debug_throw_register.pass.cpp index ec4be700e..0d2586bf3 100644 --- a/test/libcxx/debug/debug_throw_register.pass.cpp +++ b/test/libcxx/debug/debug_throw_register.pass.cpp @@ -12,6 +12,9 @@ // MODULES_DEFINES: _LIBCPP_DEBUG=1 // MODULES_DEFINES: _LIBCPP_DEBUG_USE_EXCEPTIONS +// Can't test the system lib because this test enables debug mode +// UNSUPPORTED: with_system_cxx_lib + // Test that defining _LIBCPP_DEBUG_USE_EXCEPTIONS causes _LIBCPP_ASSERT // to throw on failure. diff --git a/test/libcxx/depr/depr.function.objects/depr.adaptors.cxx1z.pass.cpp b/test/libcxx/depr/depr.function.objects/depr.adaptors.cxx1z.pass.cpp new file mode 100644 index 000000000..9b8469393 --- /dev/null +++ b/test/libcxx/depr/depr.function.objects/depr.adaptors.cxx1z.pass.cpp @@ -0,0 +1,47 @@ +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// + + +// In C++17, the function adapters mem_fun/mem_fun_ref, etc have been removed. +// However, for backwards compatibility, if _LIBCPP_ENABLE_CXX17_REMOVED_BINDERS +// is defined before including , then they will be restored. + +#define _LIBCPP_ENABLE_CXX17_REMOVED_BINDERS + +#include +#include + +int identity(int v) { return v; } +int sum(int a, int b) { return a + b; } + +struct Foo { + int zero() const { return 0; } + int identity(int v) const { return v; } + int sum(int a, int b) const { return a + b; } +}; + +int main() +{ + typedef std::pointer_to_unary_function PUF; + typedef std::pointer_to_binary_function PBF; + assert((std::ptr_fun(identity)(4) == 4)); + assert((std::ptr_fun(sum)(4, 5) == 9)); + + Foo f; + assert((std::mem_fn(&Foo::identity)(f, 5) == 5)); + assert((std::mem_fn(&Foo::sum)(f, 5, 6) == 11)); + + typedef std::mem_fun_ref_t MFR; + typedef std::const_mem_fun_ref_t CMFR; + + assert((std::mem_fun_ref(&Foo::zero)(f) == 0)); + assert((std::mem_fun_ref(&Foo::identity)(f, 5) == 5)); +} diff --git a/test/libcxx/double_include.sh.cpp b/test/libcxx/double_include.sh.cpp index 46dfc999b..0a9e9fcfa 100644 --- a/test/libcxx/double_include.sh.cpp +++ b/test/libcxx/double_include.sh.cpp @@ -137,6 +137,9 @@ #include #include #include +#if defined(__cpp_coroutines) +#include +#endif #include #include #include 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 14f5c4ed8..db7484d46 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 @@ -8,6 +8,12 @@ //===----------------------------------------------------------------------===// // UNSUPPORTED: c++98, c++03, c++11 +// XFAIL: availability=macosx10.12 +// XFAIL: availability=macosx10.11 +// XFAIL: availability=macosx10.10 +// XFAIL: availability=macosx10.9 +// XFAIL: availability=macosx10.8 +// XFAIL: availability=macosx10.7 // dynarray.cons 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 index 8d7d28b83..9c6cad8ee 100644 --- 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 @@ -8,6 +8,7 @@ //===----------------------------------------------------------------------===// // UNSUPPORTED: libcpp-no-exceptions +// XFAIL: availability // dynarray.cons // explicit dynarray(size_type c); 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 84c602925..5c745e0d1 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 @@ -8,6 +8,7 @@ //===----------------------------------------------------------------------===// // UNSUPPORTED: c++98, c++03, c++11 +// XFAIL: availability // dynarray.data diff --git a/test/libcxx/experimental/containers/sequences/dynarray/dynarray.mutate/default.pass.cpp b/test/libcxx/experimental/containers/sequences/dynarray/dynarray.mutate/default.pass.cpp index 376c94a6b..1ed51538f 100644 --- a/test/libcxx/experimental/containers/sequences/dynarray/dynarray.mutate/default.pass.cpp +++ b/test/libcxx/experimental/containers/sequences/dynarray/dynarray.mutate/default.pass.cpp @@ -8,6 +8,8 @@ //===----------------------------------------------------------------------===// // UNSUPPORTED: c++98, c++03, c++11 +// XFAIL: availability + // dynarray.data // void fill(const T& v); 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 ef9be4532..473313f39 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 @@ -9,6 +9,8 @@ // UNSUPPORTED: c++98, c++03, c++11 // UNSUPPORTED: libcpp-no-exceptions +// XFAIL: availability + // dynarray.overview // const_reference at(size_type n) const; diff --git a/test/libcxx/experimental/containers/sequences/dynarray/dynarray.overview/begin_end.pass.cpp b/test/libcxx/experimental/containers/sequences/dynarray/dynarray.overview/begin_end.pass.cpp index 38aefdfba..f0aa1e3ff 100644 --- a/test/libcxx/experimental/containers/sequences/dynarray/dynarray.overview/begin_end.pass.cpp +++ b/test/libcxx/experimental/containers/sequences/dynarray/dynarray.overview/begin_end.pass.cpp @@ -8,6 +8,8 @@ //===----------------------------------------------------------------------===// // UNSUPPORTED: c++98, c++03, c++11 +// XFAIL: availability + // dynarray.overview diff --git a/test/libcxx/experimental/containers/sequences/dynarray/dynarray.overview/capacity.pass.cpp b/test/libcxx/experimental/containers/sequences/dynarray/dynarray.overview/capacity.pass.cpp index 95262aab1..a5484296f 100644 --- a/test/libcxx/experimental/containers/sequences/dynarray/dynarray.overview/capacity.pass.cpp +++ b/test/libcxx/experimental/containers/sequences/dynarray/dynarray.overview/capacity.pass.cpp @@ -8,6 +8,8 @@ //===----------------------------------------------------------------------===// // UNSUPPORTED: c++98, c++03, c++11 +// XFAIL: availability + // dynarray.overview // size_type size() const noexcept; 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 4f1d0978d..0ba27cf92 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 @@ -8,6 +8,7 @@ //===----------------------------------------------------------------------===// // UNSUPPORTED: c++98, c++03, c++11 +// XFAIL: availability // dynarray.overview diff --git a/test/libcxx/experimental/containers/sequences/dynarray/dynarray.overview/indexing.pass.cpp b/test/libcxx/experimental/containers/sequences/dynarray/dynarray.overview/indexing.pass.cpp index 4bcb229eb..4306d1e9c 100644 --- a/test/libcxx/experimental/containers/sequences/dynarray/dynarray.overview/indexing.pass.cpp +++ b/test/libcxx/experimental/containers/sequences/dynarray/dynarray.overview/indexing.pass.cpp @@ -8,6 +8,14 @@ //===----------------------------------------------------------------------===// // UNSUPPORTED: c++98, c++03, c++11 + +// XFAIL: availability=macosx10.12 +// XFAIL: availability=macosx10.11 +// XFAIL: availability=macosx10.10 +// XFAIL: availability=macosx10.9 +// XFAIL: availability=macosx10.8 +// XFAIL: availability=macosx10.7 + // dynarray.overview // const_reference at(size_type n) const; diff --git a/test/libcxx/experimental/containers/sequences/dynarray/dynarray.zero/default.pass.cpp b/test/libcxx/experimental/containers/sequences/dynarray/dynarray.zero/default.pass.cpp index c0e018093..ab4960035 100644 --- a/test/libcxx/experimental/containers/sequences/dynarray/dynarray.zero/default.pass.cpp +++ b/test/libcxx/experimental/containers/sequences/dynarray/dynarray.zero/default.pass.cpp @@ -8,6 +8,7 @@ //===----------------------------------------------------------------------===// // UNSUPPORTED: c++98, c++03, c++11 +// XFAIL: availability // dynarray.zero // dynarray shall provide support for the special case of construction with a size of zero. diff --git a/test/libcxx/experimental/containers/sequences/dynarray/lit.local.cfg b/test/libcxx/experimental/containers/sequences/dynarray/lit.local.cfg new file mode 100644 index 000000000..93553b513 --- /dev/null +++ b/test/libcxx/experimental/containers/sequences/dynarray/lit.local.cfg @@ -0,0 +1,3 @@ +if ('availability' in config.available_features + and not 'libcpp-no-exceptions' in config.available_features): + config.unsupported = True diff --git a/test/libcxx/experimental/filesystem/class.path/path.itr/reverse_iterator_produces_diagnostic.fail.cpp b/test/libcxx/experimental/filesystem/class.path/path.itr/reverse_iterator_produces_diagnostic.fail.cpp new file mode 100644 index 000000000..6f839befb --- /dev/null +++ b/test/libcxx/experimental/filesystem/class.path/path.itr/reverse_iterator_produces_diagnostic.fail.cpp @@ -0,0 +1,31 @@ +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// UNSUPPORTED: c++98, c++03 + +// + +// class path + +#include +#include + + +namespace fs = std::experimental::filesystem; + +int main() { + using namespace fs; + using RIt = std::reverse_iterator; + + // expected-error@iterator:* {{static_assert failed "The specified iterator type cannot be used with reverse_iterator; Using stashing iterators with reverse_iterator causes undefined behavior"}} + { + RIt r; + ((void)r); + } +} diff --git a/test/libcxx/experimental/language.support/support.coroutines/dialect_support.sh.cpp b/test/libcxx/experimental/language.support/support.coroutines/dialect_support.sh.cpp new file mode 100644 index 000000000..56f47c8fa --- /dev/null +++ b/test/libcxx/experimental/language.support/support.coroutines/dialect_support.sh.cpp @@ -0,0 +1,59 @@ +// -*- 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. +// +//===----------------------------------------------------------------------===// + +// REQUIRES: fcoroutines-ts + +// RUN: %build -fcoroutines-ts +// RUN: %run + +// A simple "breathing" test that checks that +// can be parsed and used in all dialects, including C++03 in order to match +// Clang's behavior. + +#include + +namespace coro = std::experimental::coroutines_v1; + +coro::suspend_always sa; +coro::suspend_never sn; + +struct MyFuture { + struct promise_type { + typedef coro::coroutine_handle HandleT; + coro::suspend_never initial_suspend() { return sn; } + coro::suspend_always final_suspend() { return sa; } + coro::suspend_never yield_value(int) { return sn; } + MyFuture get_return_object() { + MyFuture f(HandleT::from_promise(*this)); + return f; + } + void return_void() {} + void unhandled_exception() {} + }; + typedef promise_type::HandleT HandleT; + MyFuture() : p() {} + MyFuture(HandleT h) : p(h) {} + + coro::coroutine_handle p; +}; + +MyFuture test_coro() { + co_await sn; + co_yield 42; + co_return; +} + +int main() +{ + MyFuture f = test_coro(); + while (!f.p.done()) + f.p.resume(); + f.p.destroy(); +} diff --git a/test/std/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/default03.fail.cpp b/test/libcxx/experimental/language.support/support.coroutines/version.sh.cpp similarity index 62% rename from test/std/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/default03.fail.cpp rename to test/libcxx/experimental/language.support/support.coroutines/version.sh.cpp index 74d24fd48..229ce10dd 100644 --- a/test/std/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/default03.fail.cpp +++ b/test/libcxx/experimental/language.support/support.coroutines/version.sh.cpp @@ -1,3 +1,4 @@ +// -*- C++ -*- //===----------------------------------------------------------------------===// // // The LLVM Compiler Infrastructure @@ -7,17 +8,18 @@ // //===----------------------------------------------------------------------===// -// +// UNSUPPORTED: c++98, c++03, c++11 +// REQUIRES: fcoroutines-ts -// unique_ptr +// RUN: %build -fcoroutines-ts +// RUN: %run -// Test unique_ptr default ctor +#include -// default unique_ptr ctor should require non-pointer Deleter - -#include +#ifndef _LIBCPP_VERSION +#error _LIBCPP_VERSION must be defined +#endif int main() { - std::unique_ptr p; } diff --git a/test/std/input.output/file.streams/c.files/no.global.filesystem.namespace/fopen.fail.cpp b/test/libcxx/input.output/file.streams/c.files/no.global.filesystem.namespace/fopen.fail.cpp similarity index 89% rename from test/std/input.output/file.streams/c.files/no.global.filesystem.namespace/fopen.fail.cpp rename to test/libcxx/input.output/file.streams/c.files/no.global.filesystem.namespace/fopen.fail.cpp index 4d83296f0..31a37229b 100644 --- a/test/std/input.output/file.streams/c.files/no.global.filesystem.namespace/fopen.fail.cpp +++ b/test/libcxx/input.output/file.streams/c.files/no.global.filesystem.namespace/fopen.fail.cpp @@ -7,6 +7,8 @@ // //===----------------------------------------------------------------------===// +// REQUIRES: libcpp-has-no-global-filesystem-namespace + #include int main() { diff --git a/test/std/input.output/file.streams/c.files/no.global.filesystem.namespace/rename.fail.cpp b/test/libcxx/input.output/file.streams/c.files/no.global.filesystem.namespace/rename.fail.cpp similarity index 89% rename from test/std/input.output/file.streams/c.files/no.global.filesystem.namespace/rename.fail.cpp rename to test/libcxx/input.output/file.streams/c.files/no.global.filesystem.namespace/rename.fail.cpp index deca9bf5b..248ab4d67 100644 --- a/test/std/input.output/file.streams/c.files/no.global.filesystem.namespace/rename.fail.cpp +++ b/test/libcxx/input.output/file.streams/c.files/no.global.filesystem.namespace/rename.fail.cpp @@ -7,6 +7,8 @@ // //===----------------------------------------------------------------------===// +// REQUIRES: libcpp-has-no-global-filesystem-namespace + #include int main() { diff --git a/test/libcxx/iterators/trivial_iterators.pass.cpp b/test/libcxx/iterators/trivial_iterators.pass.cpp index d924a57ff..fa3ebf260 100644 --- a/test/libcxx/iterators/trivial_iterators.pass.cpp +++ b/test/libcxx/iterators/trivial_iterators.pass.cpp @@ -179,7 +179,7 @@ int main() static_assert(( std::__libcpp_is_trivial_iterator::reverse_iterator> ::value), ""); static_assert(( std::__libcpp_is_trivial_iterator::const_reverse_iterator>::value), ""); -#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS +#if TEST_STD_VER >= 11 // Initializer list (which has no reverse iterators) static_assert(( std::__libcpp_is_trivial_iterator::iterator> ::value), ""); static_assert(( std::__libcpp_is_trivial_iterator::const_iterator> ::value), ""); diff --git a/test/libcxx/language.support/support.dynamic/alloc.errors/new.badlength/bad_array_length.pass.cpp b/test/libcxx/language.support/support.dynamic/alloc.errors/new.badlength/bad_array_length.pass.cpp index cc99b83ac..c37d23433 100644 --- a/test/libcxx/language.support/support.dynamic/alloc.errors/new.badlength/bad_array_length.pass.cpp +++ b/test/libcxx/language.support/support.dynamic/alloc.errors/new.badlength/bad_array_length.pass.cpp @@ -8,6 +8,15 @@ //===----------------------------------------------------------------------===// // UNSUPPORTED: c++98, c++03, c++11 +// XFAIL: availability + +// XFAIL: availability=macosx10.12 +// XFAIL: availability=macosx10.11 +// XFAIL: availability=macosx10.10 +// XFAIL: availability=macosx10.9 +// XFAIL: availability=macosx10.7 +// XFAIL: availability=macosx10.8 + // test bad_array_length #include diff --git a/test/libcxx/language.support/support.dynamic/new_faligned_allocation.sh.cpp b/test/libcxx/language.support/support.dynamic/new_faligned_allocation.sh.cpp index 04b40009c..388fbebbd 100644 --- a/test/libcxx/language.support/support.dynamic/new_faligned_allocation.sh.cpp +++ b/test/libcxx/language.support/support.dynamic/new_faligned_allocation.sh.cpp @@ -10,8 +10,19 @@ // test libc++'s implementation of align_val_t, and the relevent new/delete // overloads in all dialects when -faligned-allocation is present. +// Libc++ defers to the underlying MSVC library to provide the new/delete +// definitions, which does not yet provide aligned allocation +// XFAIL: LIBCXX-WINDOWS-FIXME + // REQUIRES: -faligned-allocation +// XFAIL: with_system_cxx_lib=macosx10.12 +// XFAIL: with_system_cxx_lib=macosx10.11 +// XFAIL: with_system_cxx_lib=macosx10.10 +// XFAIL: with_system_cxx_lib=macosx10.9 +// XFAIL: with_system_cxx_lib=macosx10.7 +// XFAIL: with_system_cxx_lib=macosx10.8 + // RUN: %build -faligned-allocation // RUN: %run @@ -74,4 +85,4 @@ int main() { assert(typeid(std::align_val_t).name() == std::string("St11align_val_t")); } #endif -} \ No newline at end of file +} diff --git a/test/libcxx/localization/locales/locale.convenience/conversions/conversions.string/ctor_move.pass.cpp b/test/libcxx/localization/locales/locale.convenience/conversions/conversions.string/ctor_move.pass.cpp index 9ba422fc0..18cc0ca97 100644 --- a/test/libcxx/localization/locales/locale.convenience/conversions/conversions.string/ctor_move.pass.cpp +++ b/test/libcxx/localization/locales/locale.convenience/conversions/conversions.string/ctor_move.pass.cpp @@ -7,6 +7,9 @@ // //===----------------------------------------------------------------------===// +// 'do_bytes' throws a std::range_error unexpectedly +// XFAIL: LIBCXX-WINDOWS-FIXME + // UNSUPPORTED: c++98, c++03 // diff --git a/test/libcxx/min_max_macros.sh.cpp b/test/libcxx/min_max_macros.sh.cpp new file mode 100644 index 000000000..bae4175b1 --- /dev/null +++ b/test/libcxx/min_max_macros.sh.cpp @@ -0,0 +1,298 @@ +// -*- C++ -*- +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// Test that we can include each header in two TU's and link them together. + +// RUN: %compile -fsyntax-only + +// Prevent from generating deprecated warnings for this test. +#if defined(__DEPRECATED) +#undef __DEPRECATED +#endif + +#define TEST_MACROS() static_assert(min() == true && max() == true, "") +#define min() true +#define max() true + +// Top level headers +#include +TEST_MACROS(); +#include +TEST_MACROS(); +#include +TEST_MACROS(); +#ifndef _LIBCPP_HAS_NO_THREADS +#include +TEST_MACROS(); +#endif +#include +TEST_MACROS(); +#include +TEST_MACROS(); +#include +TEST_MACROS(); +#include +TEST_MACROS(); +#include +TEST_MACROS(); +#include +TEST_MACROS(); +#include +TEST_MACROS(); +#include +TEST_MACROS(); +#include +TEST_MACROS(); +#include +TEST_MACROS(); +#include +TEST_MACROS(); +#include +TEST_MACROS(); +#include +TEST_MACROS(); +#include +TEST_MACROS(); +#include +TEST_MACROS(); +#include +TEST_MACROS(); +#include +TEST_MACROS(); +#include +TEST_MACROS(); +#include +TEST_MACROS(); +#include +TEST_MACROS(); +#include +TEST_MACROS(); +#include +TEST_MACROS(); +#include +TEST_MACROS(); +#include +TEST_MACROS(); +#include +TEST_MACROS(); +#include +TEST_MACROS(); +#include +TEST_MACROS(); +#include +TEST_MACROS(); +#include +TEST_MACROS(); +#include +TEST_MACROS(); +#include +TEST_MACROS(); +#include +TEST_MACROS(); +#include +TEST_MACROS(); +#include +TEST_MACROS(); +#include +TEST_MACROS(); +#include +TEST_MACROS(); +#include +TEST_MACROS(); +#include +TEST_MACROS(); +#ifndef _LIBCPP_HAS_NO_THREADS +#include +TEST_MACROS(); +#endif +#include +TEST_MACROS(); +#include +TEST_MACROS(); +#include +TEST_MACROS(); +#include +TEST_MACROS(); +#include +TEST_MACROS(); +#include +TEST_MACROS(); +#include +TEST_MACROS(); +#include +TEST_MACROS(); +#include +TEST_MACROS(); +#include +TEST_MACROS(); +#include +TEST_MACROS(); +#include +TEST_MACROS(); +#include +TEST_MACROS(); +#include +TEST_MACROS(); +#include +TEST_MACROS(); +#include +TEST_MACROS(); +#ifndef _LIBCPP_HAS_NO_THREADS +#include +TEST_MACROS(); +#endif +#include +TEST_MACROS(); +#include +TEST_MACROS(); +#include +TEST_MACROS(); +#include +TEST_MACROS(); +#include +TEST_MACROS(); +#include +TEST_MACROS(); +#include +TEST_MACROS(); +#include +TEST_MACROS(); +#include +TEST_MACROS(); +#include +TEST_MACROS(); +#include +TEST_MACROS(); +#ifndef _LIBCPP_HAS_NO_THREADS +#include +TEST_MACROS(); +#endif +#include +TEST_MACROS(); +#include +TEST_MACROS(); +#include +TEST_MACROS(); +#include +TEST_MACROS(); +#include +TEST_MACROS(); +#include +TEST_MACROS(); +#include +TEST_MACROS(); +#include +TEST_MACROS(); +#include +TEST_MACROS(); +#include +TEST_MACROS(); +#include +TEST_MACROS(); +#include +TEST_MACROS(); +#include +TEST_MACROS(); +#include +TEST_MACROS(); +#include +TEST_MACROS(); +#ifndef _LIBCPP_HAS_NO_THREADS +#include +TEST_MACROS(); +#endif +#include +TEST_MACROS(); +#include +TEST_MACROS(); +#include +TEST_MACROS(); +#include +TEST_MACROS(); +#include +TEST_MACROS(); +#include +TEST_MACROS(); +#include +TEST_MACROS(); +#include +TEST_MACROS(); +#include +TEST_MACROS(); +#include +TEST_MACROS(); +#include +TEST_MACROS(); +#include +TEST_MACROS(); + +// experimental headers +#if __cplusplus >= 201103L +#include +TEST_MACROS(); +#include +TEST_MACROS(); +#include +TEST_MACROS(); +#include +TEST_MACROS(); +#include +TEST_MACROS(); +#include +TEST_MACROS(); +#include +TEST_MACROS(); +#include +TEST_MACROS(); +#include +TEST_MACROS(); +#include +TEST_MACROS(); +#include +TEST_MACROS(); +#include +TEST_MACROS(); +#include +TEST_MACROS(); +#include +TEST_MACROS(); +#include +TEST_MACROS(); +#include +TEST_MACROS(); +#include +TEST_MACROS(); +#include +TEST_MACROS(); +#include +TEST_MACROS(); +#include +TEST_MACROS(); +#include +TEST_MACROS(); +#include +TEST_MACROS(); +#include +TEST_MACROS(); +#include +TEST_MACROS(); +#include +TEST_MACROS(); +#include +TEST_MACROS(); +#include +TEST_MACROS(); +#endif // __cplusplus >= 201103L + +// extended headers +#include +TEST_MACROS(); +#include +TEST_MACROS(); diff --git a/test/libcxx/modules/cinttypes_exports.sh.cpp b/test/libcxx/modules/cinttypes_exports.sh.cpp index 99d20ec65..ce39ceea4 100644 --- a/test/libcxx/modules/cinttypes_exports.sh.cpp +++ b/test/libcxx/modules/cinttypes_exports.sh.cpp @@ -7,6 +7,10 @@ // //===----------------------------------------------------------------------===// +// This test fails on Windows because the underlying libc headers on Windows +// are not modular +// XFAIL: LIBCXX-WINDOWS-FIXME + // REQUIRES: modules-support // Test that re-exports diff --git a/test/libcxx/modules/clocale_exports.sh.cpp b/test/libcxx/modules/clocale_exports.sh.cpp index 69b1a9bd6..aacddd2d8 100644 --- a/test/libcxx/modules/clocale_exports.sh.cpp +++ b/test/libcxx/modules/clocale_exports.sh.cpp @@ -7,6 +7,10 @@ // //===----------------------------------------------------------------------===// +// This test fails on Windows because the underlying libc headers on Windows +// are not modular +// XFAIL: LIBCXX-WINDOWS-FIXME + // REQUIRES: modules-support // UNSUPPORTED: c++98, c++03 diff --git a/test/libcxx/modules/cstdint_exports.sh.cpp b/test/libcxx/modules/cstdint_exports.sh.cpp index 8ecc1da28..3d3cbe338 100644 --- a/test/libcxx/modules/cstdint_exports.sh.cpp +++ b/test/libcxx/modules/cstdint_exports.sh.cpp @@ -7,6 +7,10 @@ // //===----------------------------------------------------------------------===// +// This test fails on Windows because the underlying libc headers on Windows +// are not modular +// XFAIL: LIBCXX-WINDOWS-FIXME + // REQUIRES: modules-support // Test that re-exports diff --git a/test/libcxx/modules/inttypes_h_exports.sh.cpp b/test/libcxx/modules/inttypes_h_exports.sh.cpp index d1598d7ea..5354c8fef 100644 --- a/test/libcxx/modules/inttypes_h_exports.sh.cpp +++ b/test/libcxx/modules/inttypes_h_exports.sh.cpp @@ -7,6 +7,10 @@ // //===----------------------------------------------------------------------===// +// This test fails on Windows because the underlying libc headers on Windows +// are not modular +// XFAIL: LIBCXX-WINDOWS-FIXME + // REQUIRES: modules-support // Test that intypes.h re-exports stdint.h diff --git a/test/std/strings/string.view/nothing_to_do.pass.cpp b/test/libcxx/selftest/test.arc.fail.mm similarity index 80% rename from test/std/strings/string.view/nothing_to_do.pass.cpp rename to test/libcxx/selftest/test.arc.fail.mm index 353dd98f4..a185eab13 100644 --- a/test/std/strings/string.view/nothing_to_do.pass.cpp +++ b/test/libcxx/selftest/test.arc.fail.mm @@ -1,3 +1,4 @@ +// -*- C++ -*- //===----------------------------------------------------------------------===// // // The LLVM Compiler Infrastructure @@ -7,6 +8,6 @@ // //===----------------------------------------------------------------------===// -#include - -int main () {} +#if __has_feature(objc_arc) +#error This test should not compile. +#endif diff --git a/test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.observers/get.pass.cpp b/test/libcxx/selftest/test.arc.pass.mm similarity index 70% rename from test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.observers/get.pass.cpp rename to test/libcxx/selftest/test.arc.pass.mm index 24fa6beb4..ec272a872 100644 --- a/test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.observers/get.pass.cpp +++ b/test/libcxx/selftest/test.arc.pass.mm @@ -1,3 +1,4 @@ +// -*- C++ -*- //===----------------------------------------------------------------------===// // // The LLVM Compiler Infrastructure @@ -7,18 +8,10 @@ // //===----------------------------------------------------------------------===// -// - -// unique_ptr - -// test get - -#include -#include +#if __has_feature(objc_arc) == 0 +#error "arc should be enabled" +#endif int main() { - int* p = new int; - std::unique_ptr s(p); - assert(s.get() == p); } diff --git a/test/libcxx/selftest/test.fail.mm b/test/libcxx/selftest/test.fail.mm new file mode 100644 index 000000000..764daf007 --- /dev/null +++ b/test/libcxx/selftest/test.fail.mm @@ -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. +// +//===----------------------------------------------------------------------===// + +#if __has_feature(objc_arc) == 0 +#error This test should not compile. +#endif diff --git a/test/libcxx/selftest/test.pass.mm b/test/libcxx/selftest/test.pass.mm new file mode 100644 index 000000000..b4289556e --- /dev/null +++ b/test/libcxx/selftest/test.pass.mm @@ -0,0 +1,17 @@ +// -*- 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. +// +//===----------------------------------------------------------------------===// + +#if __has_feature(objc_arc) +#error "arc should *not* be enabled" +#endif + +int main() +{ +} diff --git a/test/libcxx/strings/iterators.exceptions.pass.cpp b/test/libcxx/strings/iterators.exceptions.pass.cpp index b236c5180..7dea53c4c 100644 --- a/test/libcxx/strings/iterators.exceptions.pass.cpp +++ b/test/libcxx/strings/iterators.exceptions.pass.cpp @@ -80,7 +80,7 @@ int main() static_assert(( std::__libcpp_string_gets_noexcept_iterator::reverse_iterator> ::value), ""); static_assert(( std::__libcpp_string_gets_noexcept_iterator::const_reverse_iterator>::value), ""); -#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS +#if TEST_STD_VER >= 11 // Initializer list (which has no reverse iterators) static_assert(( std::__libcpp_string_gets_noexcept_iterator::iterator> ::value), ""); static_assert(( std::__libcpp_string_gets_noexcept_iterator::const_iterator> ::value), ""); diff --git a/test/libcxx/strings/iterators.noexcept.pass.cpp b/test/libcxx/strings/iterators.noexcept.pass.cpp index b8e0b4cdf..20b4e3d76 100644 --- a/test/libcxx/strings/iterators.noexcept.pass.cpp +++ b/test/libcxx/strings/iterators.noexcept.pass.cpp @@ -28,6 +28,7 @@ #include #include +#include "test_macros.h" #include "test_iterators.h" int main() @@ -72,7 +73,7 @@ int main() static_assert(( std::__libcpp_string_gets_noexcept_iterator::reverse_iterator> ::value), ""); static_assert(( std::__libcpp_string_gets_noexcept_iterator::const_reverse_iterator>::value), ""); -#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS +#if TEST_STD_VER >= 11 // Initializer list (which has no reverse iterators) static_assert(( std::__libcpp_string_gets_noexcept_iterator::iterator> ::value), ""); static_assert(( std::__libcpp_string_gets_noexcept_iterator::const_iterator> ::value), ""); diff --git a/test/libcxx/thread/futures/futures.promise/set_exception.pass.cpp b/test/libcxx/thread/futures/futures.promise/set_exception.pass.cpp index bf567a302..9efa597d7 100644 --- a/test/libcxx/thread/futures/futures.promise/set_exception.pass.cpp +++ b/test/libcxx/thread/futures/futures.promise/set_exception.pass.cpp @@ -6,7 +6,6 @@ // Source Licenses. See LICENSE.TXT for details. // //===----------------------------------------------------------------------===// -// // UNSUPPORTED: libcpp-no-exceptions // UNSUPPORTED: libcpp-has-no-threads diff --git a/test/libcxx/thread/futures/futures.promise/set_exception_at_thread_exit.pass.cpp b/test/libcxx/thread/futures/futures.promise/set_exception_at_thread_exit.pass.cpp index 1cb61d9af..dca493382 100644 --- a/test/libcxx/thread/futures/futures.promise/set_exception_at_thread_exit.pass.cpp +++ b/test/libcxx/thread/futures/futures.promise/set_exception_at_thread_exit.pass.cpp @@ -6,7 +6,6 @@ // Source Licenses. See LICENSE.TXT for details. // //===----------------------------------------------------------------------===// -// // UNSUPPORTED: libcpp-no-exceptions // UNSUPPORTED: libcpp-has-no-threads diff --git a/test/std/thread/thread.condition/PR30202_notify_from_pthread_created_thread.pass.cpp b/test/libcxx/thread/thread.condition/PR30202_notify_from_pthread_created_thread.pass.cpp similarity index 100% rename from test/std/thread/thread.condition/PR30202_notify_from_pthread_created_thread.pass.cpp rename to test/libcxx/thread/thread.condition/PR30202_notify_from_pthread_created_thread.pass.cpp diff --git a/test/libcxx/thread/thread.mutex/thread.lock/thread.lock.guard/variadic_mutex_mangling.pass.cpp b/test/libcxx/thread/thread.mutex/thread.lock/thread.lock.guard/variadic_mutex_mangling.pass.cpp deleted file mode 100644 index 7e4fe2267..000000000 --- a/test/libcxx/thread/thread.mutex/thread.lock/thread.lock.guard/variadic_mutex_mangling.pass.cpp +++ /dev/null @@ -1,37 +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 - -// TODO(EricWF) Investigate why typeid(...).name() returns a different string -// on GCC 4.9 but not newer GCCs. -// XFAIL: gcc-4.9 -// XFAIL: windows - -// THIS TESTS C++03 EXTENSIONS. - -// - -// template class lock_guard; - -// Test that the the variadic lock guard implementation mangles the same in -// C++11 and C++03. This is important since the mangling of `lock_guard` depends -// on it being declared as a variadic template, even in C++03. - -// MODULES_DEFINES: _LIBCPP_ABI_VARIADIC_LOCK_GUARD -#define _LIBCPP_ABI_VARIADIC_LOCK_GUARD -#include -#include -#include -#include - -int main() { - const std::string expect = "NSt3__110lock_guardIJNS_5mutexEEEE"; - assert(typeid(std::lock_guard).name() == expect); -} diff --git a/test/libcxx/thread/thread.mutex/thread_safety_lock_guard.pass.cpp b/test/libcxx/thread/thread.mutex/thread_safety_lock_guard.pass.cpp index bff682ec4..6024d9978 100644 --- a/test/libcxx/thread/thread.mutex/thread_safety_lock_guard.pass.cpp +++ b/test/libcxx/thread/thread.mutex/thread_safety_lock_guard.pass.cpp @@ -7,6 +7,10 @@ // //===----------------------------------------------------------------------===// +// On Windows Clang bugs out when both __declspec and __attribute__ are present, +// the processing goes awry preventing the definition of the types. +// XFAIL: LIBCXX-WINDOWS-FIXME + // UNSUPPORTED: libcpp-has-no-threads // REQUIRES: thread-safety diff --git a/test/libcxx/thread/thread.mutex/thread_safety_lock_unlock.pass.cpp b/test/libcxx/thread/thread.mutex/thread_safety_lock_unlock.pass.cpp index 3898d08d8..3ada120cb 100644 --- a/test/libcxx/thread/thread.mutex/thread_safety_lock_unlock.pass.cpp +++ b/test/libcxx/thread/thread.mutex/thread_safety_lock_unlock.pass.cpp @@ -7,6 +7,10 @@ // //===----------------------------------------------------------------------===// +// On Windows Clang bugs out when both __declspec and __attribute__ are present, +// the processing goes awry preventing the definition of the types. +// XFAIL: LIBCXX-WINDOWS-FIXME + // UNSUPPORTED: libcpp-has-no-threads // REQUIRES: thread-safety diff --git a/test/libcxx/thread/thread.mutex/thread_safety_missing_unlock.fail.cpp b/test/libcxx/thread/thread.mutex/thread_safety_missing_unlock.fail.cpp index 941e9ff8f..cf3e63847 100644 --- a/test/libcxx/thread/thread.mutex/thread_safety_missing_unlock.fail.cpp +++ b/test/libcxx/thread/thread.mutex/thread_safety_missing_unlock.fail.cpp @@ -7,6 +7,10 @@ // //===----------------------------------------------------------------------===// +// On Windows Clang bugs out when both __declspec and __attribute__ are present, +// the processing goes awry preventing the definition of the types. +// XFAIL: LIBCXX-WINDOWS-FIXME + // UNSUPPORTED: libcpp-has-no-threads // REQUIRES: thread-safety diff --git a/test/libcxx/thread/thread.mutex/thread_safety_requires_capability.pass.cpp b/test/libcxx/thread/thread.mutex/thread_safety_requires_capability.pass.cpp index 1a5685e8d..e0681048d 100644 --- a/test/libcxx/thread/thread.mutex/thread_safety_requires_capability.pass.cpp +++ b/test/libcxx/thread/thread.mutex/thread_safety_requires_capability.pass.cpp @@ -7,6 +7,10 @@ // //===----------------------------------------------------------------------===// +// On Windows Clang bugs out when both __declspec and __attribute__ are present, +// the processing goes awry preventing the definition of the types. +// XFAIL: LIBCXX-WINDOWS-FIXME + // UNSUPPORTED: libcpp-has-no-threads // REQUIRES: thread-safety diff --git a/test/std/thread/thread.threads/thread.thread.this/sleep_for.pass.cpp b/test/libcxx/thread/thread.threads/thread.thread.this/sleep_for.pass.cpp similarity index 80% rename from test/std/thread/thread.threads/thread.thread.this/sleep_for.pass.cpp rename to test/libcxx/thread/thread.threads/thread.thread.this/sleep_for.pass.cpp index 27e1d2a1d..b46c2cdec 100644 --- a/test/std/thread/thread.threads/thread.thread.this/sleep_for.pass.cpp +++ b/test/libcxx/thread/thread.threads/thread.thread.this/sleep_for.pass.cpp @@ -9,6 +9,18 @@ // // UNSUPPORTED: libcpp-has-no-threads +// This test uses the POSIX header which Windows doesn't provide +// UNSUPPORTED: windows + +// This test depends on signal behaviour until r210210, so some system libs +// don't pass. +// +// XFAIL: with_system_cxx_lib=macosx10.11 +// XFAIL: with_system_cxx_lib=macosx10.10 +// XFAIL: with_system_cxx_lib=macosx10.9 +// XFAIL: with_system_cxx_lib=macosx10.8 +// XFAIL: with_system_cxx_lib=macosx10.7 + // // template diff --git a/test/std/utilities/function.objects/refwrap/binary.pass.cpp b/test/libcxx/utilities/function.objects/refwrap/binary.pass.cpp similarity index 100% rename from test/std/utilities/function.objects/refwrap/binary.pass.cpp rename to test/libcxx/utilities/function.objects/refwrap/binary.pass.cpp diff --git a/test/std/utilities/function.objects/refwrap/unary.pass.cpp b/test/libcxx/utilities/function.objects/refwrap/unary.pass.cpp similarity index 100% rename from test/std/utilities/function.objects/refwrap/unary.pass.cpp rename to test/libcxx/utilities/function.objects/refwrap/unary.pass.cpp diff --git a/test/libcxx/utilities/memory/util.smartptr/util.smartptr.shared/function_type_default_deleter.fail.cpp b/test/libcxx/utilities/memory/util.smartptr/util.smartptr.shared/function_type_default_deleter.fail.cpp new file mode 100644 index 000000000..87cd29264 --- /dev/null +++ b/test/libcxx/utilities/memory/util.smartptr/util.smartptr.shared/function_type_default_deleter.fail.cpp @@ -0,0 +1,44 @@ +// UNSUPPORTED: c++98, c++03 + +#include + +template struct Tag {}; + +template +using SPtr = std::shared_ptr)>; + +template +using FnType = void(Tag); + +template +void TestFn(Tag) {} + +template +FnType* getFn() { + return &TestFn; +} + +struct Deleter { + template + void operator()(Tp) const { + using RawT = typename std::remove_pointer::type; + static_assert(std::is_function::value || + std::is_same::type, + std::nullptr_t>::value, + ""); + } +}; + +int main() { + { + SPtr<0> s; // OK + SPtr<1> s1(nullptr); // OK + SPtr<2> s2(getFn<2>(), Deleter{}); // OK + SPtr<3> s3(nullptr, Deleter{}); // OK + } + // expected-error@memory:* 2 {{static_assert failed "default_delete cannot be instantiated for function types"}} + { + SPtr<4> s4(getFn<4>()); // expected-note {{requested here}} + SPtr<5> s5(getFn<5>(), std::default_delete>{}); // expected-note {{requested here}} + } +} diff --git a/test/libcxx/utilities/meta/meta.unary/meta.unary.prop/__has_operator_addressof.pass.cpp b/test/libcxx/utilities/meta/meta.unary/meta.unary.prop/__has_operator_addressof.pass.cpp index 1c715e049..886884234 100644 --- a/test/libcxx/utilities/meta/meta.unary/meta.unary.prop/__has_operator_addressof.pass.cpp +++ b/test/libcxx/utilities/meta/meta.unary/meta.unary.prop/__has_operator_addressof.pass.cpp @@ -7,6 +7,8 @@ // //===----------------------------------------------------------------------===// +// UNSUPPORTED: c++98, c++03 + // type_traits // extension @@ -16,7 +18,6 @@ #include -#ifndef _LIBCPP_HAS_NO_CONSTEXPR struct A { @@ -54,11 +55,9 @@ struct J constexpr J* operator&() const &&; }; -#endif // _LIBCPP_HAS_NO_CONSTEXPR int main() { -#ifndef _LIBCPP_HAS_NO_CONSTEXPR static_assert(std::__has_operator_addressof::value == false, ""); static_assert(std::__has_operator_addressof::value == false, ""); static_assert(std::__has_operator_addressof::value == true, ""); @@ -67,5 +66,4 @@ int main() static_assert(std::__has_operator_addressof::value == true, ""); static_assert(std::__has_operator_addressof::value == true, ""); static_assert(std::__has_operator_addressof::value == true, ""); -#endif // _LIBCPP_HAS_NO_CONSTEXPR } diff --git a/test/libcxx/utilities/meta/meta.unary/meta.unary.prop/missing_is_aggregate_trait.fail.cpp b/test/libcxx/utilities/meta/meta.unary/meta.unary.prop/missing_is_aggregate_trait.fail.cpp new file mode 100644 index 000000000..e3e083bfb --- /dev/null +++ b/test/libcxx/utilities/meta/meta.unary/meta.unary.prop/missing_is_aggregate_trait.fail.cpp @@ -0,0 +1,28 @@ +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// UNSUPPORTED: c++98, c++03, c++11, c++14 + +// + +// template struct is_aggregate; +// template constexpr bool is_aggregate_v = is_aggregate::value; + +#include + +int main () +{ +#ifdef _LIBCPP_HAS_NO_IS_AGGREGATE + // This should not compile when _LIBCPP_HAS_NO_IS_AGGREGATE is defined. + bool b = __is_aggregate(void); + ((void)b); +#else +#error Forcing failure... +#endif +} diff --git a/test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.asgn/move01.fail.cpp b/test/libcxx/utilities/template.bitset/includes.pass.cpp similarity index 50% rename from test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.asgn/move01.fail.cpp rename to test/libcxx/utilities/template.bitset/includes.pass.cpp index 87cfb72ad..2e3c2812e 100644 --- a/test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.asgn/move01.fail.cpp +++ b/test/libcxx/utilities/template.bitset/includes.pass.cpp @@ -7,23 +7,26 @@ // //===----------------------------------------------------------------------===// -// +// test that includes , , and -// unique_ptr +#include -// Test unique_ptr move assignment +#ifndef _LIBCPP_CSTDDEF +#error has not been included +#endif -#include +#ifndef _LIBCPP_STRING +#error has not been included +#endif -#include "test_macros.h" +#ifndef _LIBCPP_STDEXCEPT +#error has not been included +#endif + +#ifndef _LIBCPP_IOSFWD +#error has not been included +#endif -// Can't copy from lvalue int main() { - std::unique_ptr 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/libcxx/utilities/tuple/tuple.tuple/diagnose_reference_binding.fail.cpp b/test/libcxx/utilities/tuple/tuple.tuple/diagnose_reference_binding.fail.cpp index c18822bbe..76d5f0d67 100644 --- a/test/libcxx/utilities/tuple/tuple.tuple/diagnose_reference_binding.fail.cpp +++ b/test/libcxx/utilities/tuple/tuple.tuple/diagnose_reference_binding.fail.cpp @@ -34,7 +34,7 @@ int main() { // FIXME: The below warnings may get emitted as an error, a warning, or not emitted at all // depending on the flags used to compile this test. { - // expected-warning@tuple:* 0+ {{binding reference member 'value' to a temporary value}} - // expected-error@tuple:* 0+ {{binding reference member 'value' to a temporary value}} + // expected-warning@tuple:* 0+ {{binding reference member '__value_' to a temporary value}} + // expected-error@tuple:* 0+ {{binding reference member '__value_' to a temporary value}} } } diff --git a/test/std/utilities/tuple/tuple.tuple/empty_member.pass.cpp b/test/libcxx/utilities/tuple/tuple.tuple/empty_member.pass.cpp similarity index 100% rename from test/std/utilities/tuple/tuple.tuple/empty_member.pass.cpp rename to test/libcxx/utilities/tuple/tuple.tuple/empty_member.pass.cpp diff --git a/test/libcxx/utilities/variant/variant.variant/variant.assign/copy.pass.cpp b/test/libcxx/utilities/variant/variant.variant/variant.assign/copy.pass.cpp deleted file mode 100644 index 26556c6eb..000000000 --- a/test/libcxx/utilities/variant/variant.variant/variant.assign/copy.pass.cpp +++ /dev/null @@ -1,209 +0,0 @@ -// -*- C++ -*- -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// UNSUPPORTED: c++98, c++03, c++11, c++14 - -// The following compilers don't generate constexpr special members correctly. -// XFAIL: clang-3.5, clang-3.6, clang-3.7, clang-3.8 -// XFAIL: apple-clang-6, apple-clang-7, apple-clang-8.0 - -// - -// template class variant; - -// variant& operator=(variant const&); - -#include -#include - -#include "test_macros.h" - -struct NTCopyAssign { - constexpr NTCopyAssign(int v) : value(v) {} - NTCopyAssign(const NTCopyAssign &) = default; - NTCopyAssign(NTCopyAssign &&) = default; - NTCopyAssign &operator=(const NTCopyAssign &that) { - value = that.value; - return *this; - }; - NTCopyAssign &operator=(NTCopyAssign &&) = delete; - int value; -}; - -static_assert(!std::is_trivially_copy_assignable::value, ""); -static_assert(std::is_copy_assignable::value, ""); - -struct TCopyAssign { - constexpr TCopyAssign(int v) : value(v) {} - TCopyAssign(const TCopyAssign &) = default; - TCopyAssign(TCopyAssign &&) = default; - TCopyAssign &operator=(const TCopyAssign &) = default; - TCopyAssign &operator=(TCopyAssign &&) = delete; - int value; -}; - -static_assert(std::is_trivially_copy_assignable::value, ""); - -struct TCopyAssignNTMoveAssign { - constexpr TCopyAssignNTMoveAssign(int v) : value(v) {} - TCopyAssignNTMoveAssign(const TCopyAssignNTMoveAssign &) = default; - TCopyAssignNTMoveAssign(TCopyAssignNTMoveAssign &&) = default; - TCopyAssignNTMoveAssign &operator=(const TCopyAssignNTMoveAssign &) = default; - TCopyAssignNTMoveAssign &operator=(TCopyAssignNTMoveAssign &&that) { - value = that.value; - that.value = -1; - return *this; - } - int value; -}; - -static_assert(std::is_trivially_copy_assignable_v, ""); - -void test_copy_assignment_sfinae() { - { - using V = std::variant; - static_assert(std::is_trivially_copy_assignable::value, ""); - } - { - using V = std::variant; - static_assert(!std::is_trivially_copy_assignable::value, ""); - static_assert(std::is_copy_assignable::value, ""); - } - { - using V = std::variant; - static_assert(std::is_trivially_copy_assignable::value, ""); - } - { - using V = std::variant; - static_assert(std::is_trivially_copy_assignable::value, ""); - } -} - -template struct Result { size_t index; T value; }; - -void test_copy_assignment_same_index() { - { - struct { - constexpr Result operator()() const { - using V = std::variant; - V v(43); - V v2(42); - v = v2; - return {v.index(), std::get<0>(v)}; - } - } test; - constexpr auto result = test(); - static_assert(result.index == 0, ""); - static_assert(result.value == 42, ""); - } - { - struct { - constexpr Result operator()() const { - using V = std::variant; - V v(43l); - V v2(42l); - v = v2; - return {v.index(), std::get<1>(v)}; - } - } test; - constexpr auto result = test(); - static_assert(result.index == 1, ""); - static_assert(result.value == 42l, ""); - } - { - struct { - constexpr Result operator()() const { - using V = std::variant; - V v(std::in_place_type, 43); - V v2(std::in_place_type, 42); - v = v2; - return {v.index(), std::get<1>(v).value}; - } - } test; - constexpr auto result = test(); - static_assert(result.index == 1, ""); - static_assert(result.value == 42, ""); - } - { - struct { - constexpr Result operator()() const { - using V = std::variant; - V v(std::in_place_type, 43); - V v2(std::in_place_type, 42); - v = v2; - return {v.index(), std::get<1>(v).value}; - } - } test; - constexpr auto result = test(); - static_assert(result.index == 1, ""); - static_assert(result.value == 42, ""); - } -} - -void test_copy_assignment_different_index() { - { - struct { - constexpr Result operator()() const { - using V = std::variant; - V v(43); - V v2(42l); - v = v2; - return {v.index(), std::get<1>(v)}; - } - } test; - constexpr auto result = test(); - static_assert(result.index == 1, ""); - static_assert(result.value == 42l, ""); - } - { - struct { - constexpr Result operator()() const { - using V = std::variant; - V v(std::in_place_type, 43); - V v2(std::in_place_type, 42); - v = v2; - return {v.index(), std::get<1>(v).value}; - } - } test; - constexpr auto result = test(); - static_assert(result.index == 1, ""); - static_assert(result.value == 42, ""); - } -} - -template -constexpr bool test_constexpr_assign_extension_imp( - std::variant&& v, ValueType&& new_value) -{ - const std::variant cp( - std::forward(new_value)); - v = cp; - return v.index() == NewIdx && - std::get(v) == std::get(cp); -} - -void test_constexpr_copy_assignment_extension() { -#ifdef _LIBCPP_VERSION - using V = std::variant; - static_assert(std::is_trivially_copyable::value, ""); - static_assert(std::is_trivially_copy_assignable::value, ""); - static_assert(test_constexpr_assign_extension_imp<0>(V(42l), 101l), ""); - static_assert(test_constexpr_assign_extension_imp<0>(V(nullptr), 101l), ""); - static_assert(test_constexpr_assign_extension_imp<1>(V(42l), nullptr), ""); - static_assert(test_constexpr_assign_extension_imp<2>(V(42l), 101), ""); -#endif -} - -int main() { - test_copy_assignment_same_index(); - test_copy_assignment_different_index(); - test_copy_assignment_sfinae(); - test_constexpr_copy_assignment_extension(); -} diff --git a/test/libcxx/utilities/variant/variant.variant/variant.assign/move.pass.cpp b/test/libcxx/utilities/variant/variant.variant/variant.assign/move.pass.cpp deleted file mode 100644 index fb6907dc5..000000000 --- a/test/libcxx/utilities/variant/variant.variant/variant.assign/move.pass.cpp +++ /dev/null @@ -1,197 +0,0 @@ -// -*- C++ -*- -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// UNSUPPORTED: c++98, c++03, c++11, c++14 - -// The following compilers don't generate constexpr special members correctly. -// XFAIL: clang-3.5, clang-3.6, clang-3.7, clang-3.8 -// XFAIL: apple-clang-6, apple-clang-7, apple-clang-8.0 - -// - -// template class variant; - -// variant& operator=(variant&&) noexcept(see below); - -#include -#include - -#include "test_macros.h" - -struct NTMoveAssign { - constexpr NTMoveAssign(int v) : value(v) {} - NTMoveAssign(const NTMoveAssign &) = default; - NTMoveAssign(NTMoveAssign &&) = default; - NTMoveAssign &operator=(const NTMoveAssign &that) = default; - NTMoveAssign &operator=(NTMoveAssign &&that) { - value = that.value; - that.value = -1; - return *this; - }; - int value; -}; - -static_assert(!std::is_trivially_move_assignable::value, ""); -static_assert(std::is_move_assignable::value, ""); - -struct TMoveAssign { - constexpr TMoveAssign(int v) : value(v) {} - TMoveAssign(const TMoveAssign &) = delete; - TMoveAssign(TMoveAssign &&) = default; - TMoveAssign &operator=(const TMoveAssign &) = delete; - TMoveAssign &operator=(TMoveAssign &&) = default; - int value; -}; - -static_assert(std::is_trivially_move_assignable::value, ""); - -struct TMoveAssignNTCopyAssign { - constexpr TMoveAssignNTCopyAssign(int v) : value(v) {} - TMoveAssignNTCopyAssign(const TMoveAssignNTCopyAssign &) = default; - TMoveAssignNTCopyAssign(TMoveAssignNTCopyAssign &&) = default; - TMoveAssignNTCopyAssign &operator=(const TMoveAssignNTCopyAssign &that) { - value = that.value; - return *this; - } - TMoveAssignNTCopyAssign &operator=(TMoveAssignNTCopyAssign &&) = default; - int value; -}; - -static_assert(std::is_trivially_move_assignable_v, ""); - -void test_move_assignment_sfinae() { - { - using V = std::variant; - static_assert(std::is_trivially_move_assignable::value, ""); - } - { - using V = std::variant; - static_assert(!std::is_trivially_move_assignable::value, ""); - static_assert(std::is_move_assignable::value, ""); - } - { - using V = std::variant; - static_assert(std::is_trivially_move_assignable::value, ""); - } - { - using V = std::variant; - static_assert(std::is_trivially_move_assignable::value, ""); - } -} - -template struct Result { size_t index; T value; }; - -void test_move_assignment_same_index() { - { - struct { - constexpr Result operator()() const { - using V = std::variant; - V v(43); - V v2(42); - v = std::move(v2); - return {v.index(), std::get<0>(v)}; - } - } test; - constexpr auto result = test(); - static_assert(result.index == 0, ""); - static_assert(result.value == 42, ""); - } - { - struct { - constexpr Result operator()() const { - using V = std::variant; - V v(43l); - V v2(42l); - v = std::move(v2); - return {v.index(), std::get<1>(v)}; - } - } test; - constexpr auto result = test(); - static_assert(result.index == 1, ""); - static_assert(result.value == 42l, ""); - } - { - struct { - constexpr Result operator()() const { - using V = std::variant; - V v(std::in_place_type, 43); - V v2(std::in_place_type, 42); - v = std::move(v2); - return {v.index(), std::get<1>(v).value}; - } - } test; - constexpr auto result = test(); - static_assert(result.index == 1, ""); - static_assert(result.value == 42, ""); - } -} - -void test_move_assignment_different_index() { - { - struct { - constexpr Result operator()() const { - using V = std::variant; - V v(43); - V v2(42l); - v = std::move(v2); - return {v.index(), std::get<1>(v)}; - } - } test; - constexpr auto result = test(); - static_assert(result.index == 1, ""); - static_assert(result.value == 42l, ""); - } - { - struct { - constexpr Result operator()() const { - using V = std::variant; - V v(std::in_place_type, 43); - V v2(std::in_place_type, 42); - v = std::move(v2); - return {v.index(), std::get<1>(v).value}; - } - } test; - constexpr auto result = test(); - static_assert(result.index == 1, ""); - static_assert(result.value == 42, ""); - } -} - - -template -constexpr bool test_constexpr_assign_extension_imp( - std::variant&& v, ValueType&& new_value) -{ - std::variant v2( - std::forward(new_value)); - const auto cp = v2; - v = std::move(v2); - return v.index() == NewIdx && - std::get(v) == std::get(cp); -} - -void test_constexpr_move_assignment_extension() { -#ifdef _LIBCPP_VERSION - using V = std::variant; - static_assert(std::is_trivially_copyable::value, ""); - static_assert(std::is_trivially_move_assignable::value, ""); - static_assert(test_constexpr_assign_extension_imp<0>(V(42l), 101l), ""); - static_assert(test_constexpr_assign_extension_imp<0>(V(nullptr), 101l), ""); - static_assert(test_constexpr_assign_extension_imp<1>(V(42l), nullptr), ""); - static_assert(test_constexpr_assign_extension_imp<2>(V(42l), 101), ""); -#endif -} - -int main() { - test_move_assignment_same_index(); - test_move_assignment_different_index(); - test_move_assignment_sfinae(); - test_constexpr_move_assignment_extension(); -} diff --git a/test/libcxx/utilities/variant/variant.variant/variant.ctor/copy.pass.cpp b/test/libcxx/utilities/variant/variant.variant/variant.ctor/copy.pass.cpp deleted file mode 100644 index 0d30a78a4..000000000 --- a/test/libcxx/utilities/variant/variant.variant/variant.ctor/copy.pass.cpp +++ /dev/null @@ -1,120 +0,0 @@ -// -*- C++ -*- -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// UNSUPPORTED: c++98, c++03, c++11, c++14 - -// - -// template class variant; - -// variant(variant const&); - -#include -#include - -#include "test_macros.h" - -struct NTCopy { - constexpr NTCopy(int v) : value(v) {} - NTCopy(const NTCopy &that) : value(that.value) {} - NTCopy(NTCopy &&) = delete; - int value; -}; - -static_assert(!std::is_trivially_copy_constructible::value, ""); -static_assert(std::is_copy_constructible::value, ""); - -struct TCopy { - constexpr TCopy(int v) : value(v) {} - TCopy(TCopy const &) = default; - TCopy(TCopy &&) = delete; - int value; -}; - -static_assert(std::is_trivially_copy_constructible::value, ""); - -struct TCopyNTMove { - constexpr TCopyNTMove(int v) : value(v) {} - TCopyNTMove(const TCopyNTMove&) = default; - TCopyNTMove(TCopyNTMove&& that) : value(that.value) { that.value = -1; } - int value; -}; - -static_assert(std::is_trivially_copy_constructible::value, ""); - -void test_copy_ctor_sfinae() { - { - using V = std::variant; - static_assert(std::is_trivially_copy_constructible::value, ""); - } - { - using V = std::variant; - static_assert(!std::is_trivially_copy_constructible::value, ""); - static_assert(std::is_copy_constructible::value, ""); - } - { - using V = std::variant; - static_assert(std::is_trivially_copy_constructible::value, ""); - } - { - using V = std::variant; - static_assert(std::is_trivially_copy_constructible::value, ""); - } -} - -void test_copy_ctor_basic() { - { - constexpr std::variant v(std::in_place_index<0>, 42); - static_assert(v.index() == 0, ""); - constexpr std::variant v2 = v; - static_assert(v2.index() == 0, ""); - static_assert(std::get<0>(v2) == 42, ""); - } - { - constexpr std::variant v(std::in_place_index<1>, 42); - static_assert(v.index() == 1, ""); - constexpr std::variant v2 = v; - static_assert(v2.index() == 1, ""); - static_assert(std::get<1>(v2) == 42, ""); - } - { - constexpr std::variant v(std::in_place_index<0>, 42); - static_assert(v.index() == 0, ""); - constexpr std::variant v2(v); - static_assert(v2.index() == 0, ""); - static_assert(std::get<0>(v2).value == 42, ""); - } - { - constexpr std::variant v(std::in_place_index<1>, 42); - static_assert(v.index() == 1, ""); - constexpr std::variant v2(v); - static_assert(v2.index() == 1, ""); - static_assert(std::get<1>(v2).value == 42, ""); - } - { - constexpr std::variant v(std::in_place_index<0>, 42); - static_assert(v.index() == 0, ""); - constexpr std::variant v2(v); - static_assert(v2.index() == 0, ""); - static_assert(std::get<0>(v2).value == 42, ""); - } - { - constexpr std::variant v(std::in_place_index<1>, 42); - static_assert(v.index() == 1, ""); - constexpr std::variant v2(v); - static_assert(v2.index() == 1, ""); - static_assert(std::get<1>(v2).value == 42, ""); - } -} - -int main() { - test_copy_ctor_basic(); - test_copy_ctor_sfinae(); -} diff --git a/test/libcxx/utilities/variant/variant.variant/variant.ctor/move.pass.cpp b/test/libcxx/utilities/variant/variant.variant/variant.ctor/move.pass.cpp deleted file mode 100644 index 91e8c194d..000000000 --- a/test/libcxx/utilities/variant/variant.variant/variant.ctor/move.pass.cpp +++ /dev/null @@ -1,153 +0,0 @@ -// -*- C++ -*- -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// UNSUPPORTED: c++98, c++03, c++11, c++14 - -// - -// template class variant; - -// variant(variant&&) noexcept(see below); - -#include -#include - -#include "test_macros.h" - -struct NTMove { - constexpr NTMove(int v) : value(v) {} - NTMove(const NTMove &) = delete; - NTMove(NTMove &&that) : value(that.value) { that.value = -1; } - int value; -}; - -static_assert(!std::is_trivially_move_constructible::value, ""); -static_assert(std::is_move_constructible::value, ""); - -struct TMove { - constexpr TMove(int v) : value(v) {} - TMove(const TMove &) = delete; - TMove(TMove &&) = default; - int value; -}; - -static_assert(std::is_trivially_move_constructible::value, ""); - -struct TMoveNTCopy { - constexpr TMoveNTCopy(int v) : value(v) {} - TMoveNTCopy(const TMoveNTCopy& that) : value(that.value) {} - TMoveNTCopy(TMoveNTCopy&&) = default; - int value; -}; - -static_assert(std::is_trivially_move_constructible::value, ""); - -void test_move_ctor_sfinae() { - { - using V = std::variant; - static_assert(std::is_trivially_move_constructible::value, ""); - } - { - using V = std::variant; - static_assert(!std::is_trivially_move_constructible::value, ""); - static_assert(std::is_move_constructible::value, ""); - } - { - using V = std::variant; - static_assert(std::is_trivially_move_constructible::value, ""); - } - { - using V = std::variant; - static_assert(std::is_trivially_move_constructible::value, ""); - } -} - -template -struct Result { size_t index; T value; }; - -void test_move_ctor_basic() { - { - struct { - constexpr Result operator()() const { - std::variant v(std::in_place_index<0>, 42); - std::variant v2 = std::move(v); - return {v2.index(), std::get<0>(std::move(v2))}; - } - } test; - constexpr auto result = test(); - static_assert(result.index == 0, ""); - static_assert(result.value == 42, ""); - } - { - struct { - constexpr Result operator()() const { - std::variant v(std::in_place_index<1>, 42); - std::variant v2 = std::move(v); - return {v2.index(), std::get<1>(std::move(v2))}; - } - } test; - constexpr auto result = test(); - static_assert(result.index == 1, ""); - static_assert(result.value == 42, ""); - } - { - struct { - constexpr Result operator()() const { - std::variant v(std::in_place_index<0>, 42); - std::variant v2(std::move(v)); - return {v2.index(), std::get<0>(std::move(v2))}; - } - } test; - constexpr auto result = test(); - static_assert(result.index == 0, ""); - static_assert(result.value.value == 42, ""); - } - { - struct { - constexpr Result operator()() const { - std::variant v(std::in_place_index<1>, 42); - std::variant v2(std::move(v)); - return {v2.index(), std::get<1>(std::move(v2))}; - } - } test; - constexpr auto result = test(); - static_assert(result.index == 1, ""); - static_assert(result.value.value == 42, ""); - } - { - struct { - constexpr Result operator()() const { - std::variant v(std::in_place_index<0>, 42); - std::variant v2(std::move(v)); - return {v2.index(), std::get<0>(std::move(v2))}; - } - } test; - constexpr auto result = test(); - static_assert(result.index == 0, ""); - static_assert(result.value.value == 42, ""); - } - { - struct { - constexpr Result operator()() const { - std::variant v(std::in_place_index<1>, 42); - std::variant v2(std::move(v)); - return {v2.index(), std::get<1>(std::move(v2))}; - } - } test; - constexpr auto result = test(); - static_assert(result.index == 1, ""); - static_assert(result.value.value == 42, ""); - } -} - -int main() { - test_move_ctor_basic(); - test_move_ctor_sfinae(); -} diff --git a/test/std/algorithms/alg.modifying.operations/alg.move/move.pass.cpp b/test/std/algorithms/alg.modifying.operations/alg.move/move.pass.cpp index 9a954d934..0c1cc1544 100644 --- a/test/std/algorithms/alg.modifying.operations/alg.move/move.pass.cpp +++ b/test/std/algorithms/alg.modifying.operations/alg.move/move.pass.cpp @@ -16,10 +16,9 @@ #include #include -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES #include -#endif +#include "test_macros.h" #include "test_iterators.h" template @@ -38,8 +37,7 @@ test() assert(ia[i] == ib[i]); } -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES - +#if TEST_STD_VER >= 11 template void test1() @@ -55,8 +53,7 @@ test1() for (unsigned i = 0; i < N; ++i) assert(*ib[i] == static_cast(i)); } - -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES +#endif int main() { @@ -95,7 +92,7 @@ int main() test >(); test(); -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES +#if TEST_STD_VER >= 11 test1*>, output_iterator*> >(); test1*>, input_iterator*> >(); test1*>, forward_iterator*> >(); @@ -130,5 +127,5 @@ int main() test1*, bidirectional_iterator*> >(); test1*, random_access_iterator*> >(); test1*, std::unique_ptr*>(); -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES +#endif // TEST_STD_VER >= 11 } diff --git a/test/std/algorithms/alg.modifying.operations/alg.move/move_backward.pass.cpp b/test/std/algorithms/alg.modifying.operations/alg.move/move_backward.pass.cpp index c5f9d3ac7..9b3df5af4 100644 --- a/test/std/algorithms/alg.modifying.operations/alg.move/move_backward.pass.cpp +++ b/test/std/algorithms/alg.modifying.operations/alg.move/move_backward.pass.cpp @@ -16,10 +16,9 @@ #include #include -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES #include -#endif +#include "test_macros.h" #include "test_iterators.h" template @@ -38,8 +37,7 @@ test() assert(ia[i] == ib[i]); } -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES - +#if TEST_STD_VER >= 11 template void test1() @@ -55,8 +53,7 @@ test1() for (unsigned i = 0; i < N; ++i) assert(*ib[i] == static_cast(i)); } - -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES +#endif int main() { @@ -72,7 +69,7 @@ int main() test >(); test(); -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES +#if TEST_STD_VER >= 11 test1*>, bidirectional_iterator*> >(); test1*>, random_access_iterator*> >(); test1*>, std::unique_ptr*>(); @@ -84,5 +81,5 @@ int main() test1*, bidirectional_iterator*> >(); test1*, random_access_iterator*> >(); test1*, std::unique_ptr*>(); -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES +#endif // TEST_STD_VER >= 11 } diff --git a/test/std/algorithms/alg.modifying.operations/alg.partitions/partition.pass.cpp b/test/std/algorithms/alg.modifying.operations/alg.partitions/partition.pass.cpp index 8eddfbc4d..ce74684f3 100644 --- a/test/std/algorithms/alg.modifying.operations/alg.partitions/partition.pass.cpp +++ b/test/std/algorithms/alg.modifying.operations/alg.partitions/partition.pass.cpp @@ -17,9 +17,7 @@ #include #include -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES -#include -#endif + #include "test_iterators.h" diff --git a/test/std/algorithms/alg.modifying.operations/alg.random.shuffle/random_shuffle.pass.cpp b/test/std/algorithms/alg.modifying.operations/alg.random.shuffle/random_shuffle.pass.cpp index e24598a9b..e2abf7cce 100644 --- a/test/std/algorithms/alg.modifying.operations/alg.random.shuffle/random_shuffle.pass.cpp +++ b/test/std/algorithms/alg.modifying.operations/alg.random.shuffle/random_shuffle.pass.cpp @@ -8,6 +8,7 @@ //===----------------------------------------------------------------------===// // +// REQUIRES: c++98 || c++03 || c++11 || c++14 // template // requires ShuffleIterator diff --git a/test/std/algorithms/alg.modifying.operations/alg.random.shuffle/random_shuffle_rand.pass.cpp b/test/std/algorithms/alg.modifying.operations/alg.random.shuffle/random_shuffle_rand.pass.cpp index c923d847f..313b6bac4 100644 --- a/test/std/algorithms/alg.modifying.operations/alg.random.shuffle/random_shuffle_rand.pass.cpp +++ b/test/std/algorithms/alg.modifying.operations/alg.random.shuffle/random_shuffle_rand.pass.cpp @@ -8,6 +8,7 @@ //===----------------------------------------------------------------------===// // +// REQUIRES: c++98 || c++03 || c++11 || c++14 // template Rand> // requires ShuffleIterator diff --git a/test/std/algorithms/alg.modifying.operations/alg.remove/remove.pass.cpp b/test/std/algorithms/alg.modifying.operations/alg.remove/remove.pass.cpp index 80f86568c..a77a9eddb 100644 --- a/test/std/algorithms/alg.modifying.operations/alg.remove/remove.pass.cpp +++ b/test/std/algorithms/alg.modifying.operations/alg.remove/remove.pass.cpp @@ -17,10 +17,9 @@ #include #include -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES #include -#endif +#include "test_macros.h" #include "test_iterators.h" template @@ -39,8 +38,7 @@ test() assert(ia[5] == 4); } -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES - +#if TEST_STD_VER >= 11 template void test1() @@ -62,8 +60,7 @@ test1() assert(*ia[4] == 3); assert(*ia[5] == 4); } - -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES +#endif // TEST_STD_VER >= 11 int main() { @@ -72,12 +69,10 @@ int main() test >(); test(); -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES - +#if TEST_STD_VER >= 11 test1*> >(); test1*> >(); test1*> >(); test1*>(); - -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES +#endif // TEST_STD_VER >= 11 } diff --git a/test/std/algorithms/alg.modifying.operations/alg.remove/remove_copy_if.pass.cpp b/test/std/algorithms/alg.modifying.operations/alg.remove/remove_copy_if.pass.cpp index de3f0a741..8532998eb 100644 --- a/test/std/algorithms/alg.modifying.operations/alg.remove/remove_copy_if.pass.cpp +++ b/test/std/algorithms/alg.modifying.operations/alg.remove/remove_copy_if.pass.cpp @@ -21,6 +21,8 @@ #include "test_iterators.h" +bool equalToTwo(int v) { return v == 2; } + template void test() @@ -28,8 +30,8 @@ test() int ia[] = {0, 1, 2, 3, 4, 2, 3, 4, 2}; const unsigned sa = sizeof(ia)/sizeof(ia[0]); int ib[sa]; - OutIter r = std::remove_copy_if(InIter(ia), InIter(ia+sa), OutIter(ib), - std::bind2nd(std::equal_to(), 2)); + OutIter r = std::remove_copy_if(InIter(ia), InIter(ia+sa), + OutIter(ib), equalToTwo); assert(base(r) == ib + sa-3); assert(ib[0] == 0); assert(ib[1] == 1); diff --git a/test/std/algorithms/alg.modifying.operations/alg.remove/remove_if.pass.cpp b/test/std/algorithms/alg.modifying.operations/alg.remove/remove_if.pass.cpp index b23443129..c40f3e727 100644 --- a/test/std/algorithms/alg.modifying.operations/alg.remove/remove_if.pass.cpp +++ b/test/std/algorithms/alg.modifying.operations/alg.remove/remove_if.pass.cpp @@ -18,10 +18,9 @@ #include #include #include -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES #include -#endif +#include "test_macros.h" #include "test_iterators.h" #include "counting_predicates.hpp" @@ -46,8 +45,7 @@ test() assert(cp.count() == sa); } -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES - +#if TEST_STD_VER >= 11 struct pred { bool operator()(const std::unique_ptr& i) {return *i == 2;} @@ -77,8 +75,7 @@ test1() assert(*ia[4] == 3); assert(*ia[5] == 4); } - -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES +#endif // TEST_STD_VER >= 11 int main() { @@ -87,12 +84,10 @@ int main() test >(); test(); -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES - +#if TEST_STD_VER >= 11 test1*> >(); test1*> >(); test1*> >(); test1*>(); - -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES +#endif // TEST_STD_VER >= 11 } diff --git a/test/std/algorithms/alg.modifying.operations/alg.replace/replace_copy_if.pass.cpp b/test/std/algorithms/alg.modifying.operations/alg.replace/replace_copy_if.pass.cpp index 1eff3d39e..f2ffece12 100644 --- a/test/std/algorithms/alg.modifying.operations/alg.replace/replace_copy_if.pass.cpp +++ b/test/std/algorithms/alg.modifying.operations/alg.replace/replace_copy_if.pass.cpp @@ -23,6 +23,8 @@ #include "test_iterators.h" +bool equalToTwo(int v) { return v == 2; } + template void test() @@ -30,8 +32,8 @@ test() int ia[] = {0, 1, 2, 3, 4}; const unsigned sa = sizeof(ia)/sizeof(ia[0]); int ib[sa] = {0}; - OutIter r = std::replace_copy_if(InIter(ia), InIter(ia+sa), OutIter(ib), - std::bind2nd(std::equal_to(), 2), 5); + OutIter r = std::replace_copy_if(InIter(ia), InIter(ia+sa), + OutIter(ib), equalToTwo, 5); assert(base(r) == ib + sa); assert(ib[0] == 0); assert(ib[1] == 1); diff --git a/test/std/algorithms/alg.modifying.operations/alg.replace/replace_if.pass.cpp b/test/std/algorithms/alg.modifying.operations/alg.replace/replace_if.pass.cpp index 8d6ab04e1..ebb2945d7 100644 --- a/test/std/algorithms/alg.modifying.operations/alg.replace/replace_if.pass.cpp +++ b/test/std/algorithms/alg.modifying.operations/alg.replace/replace_if.pass.cpp @@ -22,13 +22,15 @@ #include "test_iterators.h" +bool equalToTwo(int v) { return v == 2; } + template void test() { int ia[] = {0, 1, 2, 3, 4}; const unsigned sa = sizeof(ia)/sizeof(ia[0]); - std::replace_if(Iter(ia), Iter(ia+sa), std::bind2nd(std::equal_to(), 2), 5); + std::replace_if(Iter(ia), Iter(ia+sa), equalToTwo, 5); assert(ia[0] == 0); assert(ia[1] == 1); assert(ia[2] == 5); diff --git a/test/std/algorithms/alg.modifying.operations/alg.swap/swap_ranges.pass.cpp b/test/std/algorithms/alg.modifying.operations/alg.swap/swap_ranges.pass.cpp index 64a5a6a5a..84f2c8c9f 100644 --- a/test/std/algorithms/alg.modifying.operations/alg.swap/swap_ranges.pass.cpp +++ b/test/std/algorithms/alg.modifying.operations/alg.swap/swap_ranges.pass.cpp @@ -16,10 +16,9 @@ #include #include -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES #include -#endif +#include "test_macros.h" #include "test_iterators.h" template @@ -38,8 +37,7 @@ test() assert(j[2] == 3); } -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES - +#if TEST_STD_VER >= 11 template void test1() @@ -59,8 +57,7 @@ test1() assert(*j[1] == 2); assert(*j[2] == 3); } - -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES +#endif // TEST_STD_VER >= 11 void test2() { @@ -131,8 +128,7 @@ int main() test >(); test(); -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES - +#if TEST_STD_VER >= 11 test1*>, forward_iterator*> >(); test1*>, bidirectional_iterator*> >(); test1*>, random_access_iterator*> >(); @@ -152,8 +148,7 @@ int main() test1*, bidirectional_iterator*> >(); test1*, random_access_iterator*> >(); test1*, std::unique_ptr*>(); - -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES +#endif // TEST_STD_VER >= 11 test2(); } diff --git a/test/std/algorithms/alg.modifying.operations/alg.transform/unary_transform.pass.cpp b/test/std/algorithms/alg.modifying.operations/alg.transform/unary_transform.pass.cpp index 68556fd98..6c5e621e4 100644 --- a/test/std/algorithms/alg.modifying.operations/alg.transform/unary_transform.pass.cpp +++ b/test/std/algorithms/alg.modifying.operations/alg.transform/unary_transform.pass.cpp @@ -21,6 +21,8 @@ #include "test_iterators.h" +int plusOne(int v) { return v + 1; } + template void test() @@ -28,8 +30,8 @@ test() int ia[] = {0, 1, 2, 3, 4}; const unsigned sa = sizeof(ia)/sizeof(ia[0]); int ib[sa] = {0}; - OutIter r = std::transform(InIter(ia), InIter(ia+sa), OutIter(ib), - std::bind2nd(std::plus(), 1)); + OutIter r = std::transform(InIter(ia), InIter(ia+sa), + OutIter(ib), plusOne); assert(base(r) == ib + sa); assert(ib[0] == 1); assert(ib[1] == 2); diff --git a/test/std/algorithms/alg.modifying.operations/alg.unique/unique.pass.cpp b/test/std/algorithms/alg.modifying.operations/alg.unique/unique.pass.cpp index ab4ffad60..049ccfe98 100644 --- a/test/std/algorithms/alg.modifying.operations/alg.unique/unique.pass.cpp +++ b/test/std/algorithms/alg.modifying.operations/alg.unique/unique.pass.cpp @@ -17,10 +17,9 @@ #include #include -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES #include -#endif +#include "test_macros.h" #include "test_iterators.h" template @@ -84,7 +83,7 @@ test() assert(ii[2] == 2); } -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES +#if TEST_STD_VER >= 11 struct do_nothing { @@ -168,8 +167,7 @@ test1() assert(*ii[1] == 1); assert(*ii[2] == 2); } - -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES +#endif // TEST_STD_VER >= 11 int main() { @@ -178,12 +176,10 @@ int main() test >(); test(); -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES - +#if TEST_STD_VER >= 11 test1 >(); test1 >(); test1 >(); test1(); - -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES +#endif } diff --git a/test/std/algorithms/alg.modifying.operations/alg.unique/unique_pred.pass.cpp b/test/std/algorithms/alg.modifying.operations/alg.unique/unique_pred.pass.cpp index c6df235be..164005205 100644 --- a/test/std/algorithms/alg.modifying.operations/alg.unique/unique_pred.pass.cpp +++ b/test/std/algorithms/alg.modifying.operations/alg.unique/unique_pred.pass.cpp @@ -17,10 +17,9 @@ #include #include -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES #include -#endif +#include "test_macros.h" #include "test_iterators.h" struct count_equal @@ -110,7 +109,7 @@ test() assert(count_equal::count == si-1); } -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES +#if TEST_STD_VER >= 11 struct do_nothing { @@ -210,8 +209,7 @@ test1() assert(*ii[2] == 2); assert(count_equal::count == si-1); } - -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES +#endif // TEST_STD_VER >= 11 int main() { @@ -220,12 +218,10 @@ int main() test >(); test(); -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES - +#if TEST_STD_VER >= 11 test1 >(); test1 >(); test1 >(); test1(); - -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES +#endif } diff --git a/test/std/algorithms/alg.nonmodifying/alg.count/count_if.pass.cpp b/test/std/algorithms/alg.nonmodifying/alg.count/count_if.pass.cpp index 025bc06a6..ec0526c2d 100644 --- a/test/std/algorithms/alg.nonmodifying/alg.count/count_if.pass.cpp +++ b/test/std/algorithms/alg.nonmodifying/alg.count/count_if.pass.cpp @@ -20,17 +20,24 @@ #include "test_iterators.h" +struct eq { + eq (int val) : v(val) {} + bool operator () (int v2) const { return v == v2; } + int v; + }; + + int main() { int ia[] = {0, 1, 2, 2, 0, 1, 2, 3}; const unsigned sa = sizeof(ia)/sizeof(ia[0]); assert(std::count_if(input_iterator(ia), input_iterator(ia + sa), - std::bind2nd(std::equal_to(),2)) == 3); + eq(2)) == 3); assert(std::count_if(input_iterator(ia), input_iterator(ia + sa), - std::bind2nd(std::equal_to(),7)) == 0); + eq(7)) == 0); assert(std::count_if(input_iterator(ia), input_iterator(ia), - std::bind2nd(std::equal_to(),2)) == 0); + eq(2)) == 0); } diff --git a/test/std/algorithms/alg.nonmodifying/alg.find/find_if.pass.cpp b/test/std/algorithms/alg.nonmodifying/alg.find/find_if.pass.cpp index bde6ff389..761d71bbf 100644 --- a/test/std/algorithms/alg.nonmodifying/alg.find/find_if.pass.cpp +++ b/test/std/algorithms/alg.nonmodifying/alg.find/find_if.pass.cpp @@ -20,16 +20,22 @@ #include "test_iterators.h" +struct eq { + eq (int val) : v(val) {} + bool operator () (int v2) const { return v == v2; } + int v; + }; + int main() { int ia[] = {0, 1, 2, 3, 4, 5}; const unsigned s = sizeof(ia)/sizeof(ia[0]); input_iterator r = std::find_if(input_iterator(ia), input_iterator(ia+s), - std::bind2nd(std::equal_to(), 3)); + eq(3)); assert(*r == 3); r = std::find_if(input_iterator(ia), input_iterator(ia+s), - std::bind2nd(std::equal_to(), 10)); + eq(10)); assert(r == input_iterator(ia+s)); } diff --git a/test/std/algorithms/alg.nonmodifying/alg.find/find_if_not.pass.cpp b/test/std/algorithms/alg.nonmodifying/alg.find/find_if_not.pass.cpp index 661e643f0..2e52e2603 100644 --- a/test/std/algorithms/alg.nonmodifying/alg.find/find_if_not.pass.cpp +++ b/test/std/algorithms/alg.nonmodifying/alg.find/find_if_not.pass.cpp @@ -20,16 +20,23 @@ #include "test_iterators.h" +struct ne { + ne (int val) : v(val) {} + bool operator () (int v2) const { return v != v2; } + int v; + }; + + int main() { int ia[] = {0, 1, 2, 3, 4, 5}; const unsigned s = sizeof(ia)/sizeof(ia[0]); input_iterator r = std::find_if_not(input_iterator(ia), input_iterator(ia+s), - std::bind2nd(std::not_equal_to(), 3)); + ne(3)); assert(*r == 3); r = std::find_if_not(input_iterator(ia), input_iterator(ia+s), - std::bind2nd(std::not_equal_to(), 10)); + ne(10)); assert(r == input_iterator(ia+s)); } diff --git a/test/std/algorithms/alg.nonmodifying/alg.foreach/for_each_n.pass.cpp b/test/std/algorithms/alg.nonmodifying/alg.foreach/for_each_n.pass.cpp new file mode 100644 index 000000000..fd24edb43 --- /dev/null +++ b/test/std/algorithms/alg.nonmodifying/alg.foreach/for_each_n.pass.cpp @@ -0,0 +1,61 @@ +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// +// UNSUPPORTED: c++98, c++03, c++11, c++14 + +// template +// InputIterator for_each_n(InputIterator first, Size n, Function f); + + +#include +#include + +#include "test_iterators.h" + +struct for_each_test +{ + for_each_test(int c) : count(c) {} + int count; + void operator()(int& i) {++i; ++count;} +}; + +int main() +{ + typedef input_iterator Iter; + int ia[] = {0, 1, 2, 3, 4, 5}; + const unsigned s = sizeof(ia)/sizeof(ia[0]); + + { + auto f = for_each_test(0); + Iter it = std::for_each_n(Iter(ia), 0, std::ref(f)); + assert(it == Iter(ia)); + assert(f.count == 0); + } + + { + auto f = for_each_test(0); + Iter it = std::for_each_n(Iter(ia), s, std::ref(f)); + + assert(it == Iter(ia+s)); + assert(f.count == s); + for (unsigned i = 0; i < s; ++i) + assert(ia[i] == static_cast(i+1)); + } + + { + auto f = for_each_test(0); + Iter it = std::for_each_n(Iter(ia), 1, std::ref(f)); + + assert(it == Iter(ia+1)); + assert(f.count == 1); + for (unsigned i = 0; i < 1; ++i) + assert(ia[i] == static_cast(i+2)); + } +} diff --git a/test/std/algorithms/alg.sorting/alg.heap.operations/pop.heap/pop_heap_comp.pass.cpp b/test/std/algorithms/alg.sorting/alg.heap.operations/pop.heap/pop_heap_comp.pass.cpp index 8e7931f7e..33b8ff9ae 100644 --- a/test/std/algorithms/alg.sorting/alg.heap.operations/pop.heap/pop_heap_comp.pass.cpp +++ b/test/std/algorithms/alg.sorting/alg.heap.operations/pop.heap/pop_heap_comp.pass.cpp @@ -18,9 +18,9 @@ #include #include #include -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES #include +#include "test_macros.h" struct indirect_less { @@ -29,7 +29,6 @@ struct indirect_less {return *x < *y;} }; -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES std::mt19937 randomness; @@ -53,7 +52,7 @@ int main() { test(1000); -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES +#if TEST_STD_VER >= 11 { const int N = 1000; std::unique_ptr* ia = new std::unique_ptr [N]; @@ -68,5 +67,5 @@ int main() } delete [] ia; } -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES +#endif } diff --git a/test/std/algorithms/alg.sorting/alg.heap.operations/push.heap/push_heap_comp.pass.cpp b/test/std/algorithms/alg.sorting/alg.heap.operations/push.heap/push_heap_comp.pass.cpp index 38d09ceda..1b1987aa9 100644 --- a/test/std/algorithms/alg.sorting/alg.heap.operations/push.heap/push_heap_comp.pass.cpp +++ b/test/std/algorithms/alg.sorting/alg.heap.operations/push.heap/push_heap_comp.pass.cpp @@ -19,9 +19,10 @@ #include #include #include -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES #include +#include "test_macros.h" + struct indirect_less { template @@ -29,8 +30,6 @@ struct indirect_less {return *x < *y;} }; -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES - std::mt19937 randomness; void test(int N) @@ -51,7 +50,7 @@ int main() { test(1000); -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES +#if TEST_STD_VER >= 11 { const int N = 1000; std::unique_ptr* ia = new std::unique_ptr [N]; @@ -65,5 +64,5 @@ int main() } delete [] ia; } -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES +#endif } diff --git a/test/std/algorithms/alg.sorting/alg.heap.operations/sort.heap/sort_heap_comp.pass.cpp b/test/std/algorithms/alg.sorting/alg.heap.operations/sort.heap/sort_heap_comp.pass.cpp index c0a05e420..02839abab 100644 --- a/test/std/algorithms/alg.sorting/alg.heap.operations/sort.heap/sort_heap_comp.pass.cpp +++ b/test/std/algorithms/alg.sorting/alg.heap.operations/sort.heap/sort_heap_comp.pass.cpp @@ -18,9 +18,10 @@ #include #include #include -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES #include +#include "test_macros.h" + struct indirect_less { template @@ -28,8 +29,6 @@ struct indirect_less {return *x < *y;} }; -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES - std::mt19937 randomness; void test(int N) @@ -53,7 +52,7 @@ int main() test(10); test(1000); -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES +#if TEST_STD_VER >= 11 { const int N = 1000; std::unique_ptr* ia = new std::unique_ptr [N]; @@ -65,5 +64,5 @@ int main() assert(std::is_sorted(ia, ia+N, indirect_less())); delete [] ia; } -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES +#endif } diff --git a/test/std/algorithms/alg.sorting/alg.nth.element/nth_element_comp.pass.cpp b/test/std/algorithms/alg.sorting/alg.nth.element/nth_element_comp.pass.cpp index 88249ed78..fa30797bd 100644 --- a/test/std/algorithms/alg.sorting/alg.nth.element/nth_element_comp.pass.cpp +++ b/test/std/algorithms/alg.sorting/alg.nth.element/nth_element_comp.pass.cpp @@ -21,9 +21,10 @@ #include #include #include -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES #include +#include "test_macros.h" + struct indirect_less { template @@ -31,8 +32,6 @@ struct indirect_less {return *x < *y;} }; -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES - std::mt19937 randomness; void @@ -78,7 +77,7 @@ int main() test(1000); test(1009); -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES +#if TEST_STD_VER >= 11 { std::vector > v(1000); for (int i = 0; static_cast(i) < v.size(); ++i) @@ -86,5 +85,5 @@ int main() std::nth_element(v.begin(), v.begin() + v.size()/2, v.end(), indirect_less()); assert(static_cast(*v[v.size()/2]) == v.size()/2); } -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES +#endif } diff --git a/test/std/algorithms/alg.sorting/alg.sort/partial.sort/partial_sort_comp.pass.cpp b/test/std/algorithms/alg.sorting/alg.sort/partial.sort/partial_sort_comp.pass.cpp index 847a58291..fb7976713 100644 --- a/test/std/algorithms/alg.sorting/alg.sort/partial.sort/partial_sort_comp.pass.cpp +++ b/test/std/algorithms/alg.sorting/alg.sort/partial.sort/partial_sort_comp.pass.cpp @@ -21,9 +21,10 @@ #include #include #include -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES #include +#include "test_macros.h" + struct indirect_less { template @@ -31,8 +32,6 @@ struct indirect_less {return *x < *y;} }; -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES - std::mt19937 randomness; void @@ -84,7 +83,7 @@ int main() test_larger_sorts(1009); } -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES +#if TEST_STD_VER >= 11 { std::vector > v(1000); for (int i = 0; static_cast(i) < v.size(); ++i) @@ -93,5 +92,5 @@ int main() for (int i = 0; static_cast(i) < v.size()/2; ++i) assert(*v[i] == i); } -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES +#endif } diff --git a/test/std/algorithms/alg.sorting/alg.sort/sort/sort_comp.pass.cpp b/test/std/algorithms/alg.sorting/alg.sort/sort/sort_comp.pass.cpp index c77015993..87d66c472 100644 --- a/test/std/algorithms/alg.sorting/alg.sort/sort/sort_comp.pass.cpp +++ b/test/std/algorithms/alg.sorting/alg.sort/sort/sort_comp.pass.cpp @@ -20,9 +20,10 @@ #include #include #include -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES #include +#include "test_macros.h" + struct indirect_less { template @@ -30,8 +31,6 @@ struct indirect_less {return *x < *y;} }; -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES - int main() { { @@ -43,7 +42,7 @@ int main() assert(std::is_sorted(v.begin(), v.end())); } -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES +#if TEST_STD_VER >= 11 { std::vector > v(1000); for (int i = 0; static_cast(i) < v.size(); ++i) @@ -54,5 +53,5 @@ int main() assert(*v[1] == 1); assert(*v[2] == 2); } -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES +#endif } diff --git a/test/std/algorithms/alg.sorting/alg.sort/stable.sort/stable_sort_comp.pass.cpp b/test/std/algorithms/alg.sorting/alg.sort/stable.sort/stable_sort_comp.pass.cpp index 347711bf5..8306cc3b1 100644 --- a/test/std/algorithms/alg.sorting/alg.sort/stable.sort/stable_sort_comp.pass.cpp +++ b/test/std/algorithms/alg.sorting/alg.sort/stable.sort/stable_sort_comp.pass.cpp @@ -21,9 +21,10 @@ #include #include #include -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES #include +#include "test_macros.h" + struct indirect_less { template @@ -31,8 +32,6 @@ struct indirect_less {return *x < *y;} }; -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES - std::mt19937 randomness; struct first_only @@ -72,7 +71,7 @@ int main() { test(); -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES +#if TEST_STD_VER >= 11 { std::vector > v(1000); for (int i = 0; static_cast(i) < v.size(); ++i) @@ -83,5 +82,5 @@ int main() assert(*v[1] == 1); assert(*v[2] == 2); } -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES +#endif } diff --git a/test/std/containers/Emplaceable.h b/test/std/containers/Emplaceable.h index 34dd32620..f9319d410 100644 --- a/test/std/containers/Emplaceable.h +++ b/test/std/containers/Emplaceable.h @@ -10,7 +10,10 @@ #ifndef EMPLACEABLE_H #define EMPLACEABLE_H -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES +#include +#include "test_macros.h" + +#if TEST_STD_VER >= 11 class Emplaceable { @@ -49,6 +52,5 @@ struct hash } -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES - +#endif // TEST_STD_VER >= 11 #endif // EMPLACEABLE_H diff --git a/test/std/containers/associative/map/map.access/index_tuple.pass.cpp b/test/std/containers/associative/map/map.access/index_tuple.pass.cpp index f8fc21f1f..8d27eabdf 100644 --- a/test/std/containers/associative/map/map.access/index_tuple.pass.cpp +++ b/test/std/containers/associative/map/map.access/index_tuple.pass.cpp @@ -7,6 +7,8 @@ // //===----------------------------------------------------------------------===// +// UNSUPPORTED: c++98, c++03 + // // class map @@ -17,17 +19,13 @@ #include -#ifndef _LIBCPP_HAS_NO_VARIADICS #include -#endif int main() { -#ifndef _LIBCPP_HAS_NO_VARIADICS using namespace std; map, size_t> m; m[make_tuple(2,3)]=7; -#endif } diff --git a/test/std/containers/associative/map/map.cons/assign_initializer_list.pass.cpp b/test/std/containers/associative/map/map.cons/assign_initializer_list.pass.cpp index 679600662..354911b76 100644 --- a/test/std/containers/associative/map/map.cons/assign_initializer_list.pass.cpp +++ b/test/std/containers/associative/map/map.cons/assign_initializer_list.pass.cpp @@ -7,6 +7,8 @@ // //===----------------------------------------------------------------------===// +// UNSUPPORTED: c++98, c++03 + // // class map @@ -20,7 +22,6 @@ int main() { -#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS { typedef std::pair V; std::map m = @@ -45,7 +46,6 @@ int main() assert(*next(m.begin()) == V(2, 1)); assert(*next(m.begin(), 2) == V(3, 1)); } -#if TEST_STD_VER >= 11 { typedef std::pair V; std::map, min_allocator> m = @@ -70,6 +70,4 @@ int main() assert(*next(m.begin()) == V(2, 1)); assert(*next(m.begin(), 2) == V(3, 1)); } -#endif -#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS } diff --git a/test/std/containers/associative/map/map.cons/initializer_list.pass.cpp b/test/std/containers/associative/map/map.cons/initializer_list.pass.cpp index c55d18f54..0504b1adc 100644 --- a/test/std/containers/associative/map/map.cons/initializer_list.pass.cpp +++ b/test/std/containers/associative/map/map.cons/initializer_list.pass.cpp @@ -7,6 +7,8 @@ // //===----------------------------------------------------------------------===// +// UNSUPPORTED: c++98, c++03 + // // class map @@ -20,7 +22,6 @@ int main() { -#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS { typedef std::pair V; std::map m = @@ -41,7 +42,6 @@ int main() assert(*next(m.begin()) == V(2, 1)); assert(*next(m.begin(), 2) == V(3, 1)); } -#if TEST_STD_VER >= 11 { typedef std::pair V; std::map, min_allocator> m = @@ -62,6 +62,4 @@ int main() assert(*next(m.begin()) == V(2, 1)); assert(*next(m.begin(), 2) == V(3, 1)); } -#endif -#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS } diff --git a/test/std/containers/associative/map/map.cons/initializer_list_compare.pass.cpp b/test/std/containers/associative/map/map.cons/initializer_list_compare.pass.cpp index 3133eb2e0..d9c1fb898 100644 --- a/test/std/containers/associative/map/map.cons/initializer_list_compare.pass.cpp +++ b/test/std/containers/associative/map/map.cons/initializer_list_compare.pass.cpp @@ -7,6 +7,8 @@ // //===----------------------------------------------------------------------===// +// UNSUPPORTED: c++98, c++03 + // // class map @@ -20,7 +22,6 @@ int main() { -#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS { typedef std::pair V; typedef test_compare > C; @@ -42,7 +43,6 @@ int main() assert(*next(m.begin(), 2) == V(3, 1)); assert(m.key_comp() == C(3)); } -#if TEST_STD_VER >= 11 { typedef std::pair V; typedef test_compare > C; @@ -64,6 +64,4 @@ int main() assert(*next(m.begin(), 2) == V(3, 1)); assert(m.key_comp() == C(3)); } -#endif -#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS } diff --git a/test/std/containers/associative/map/map.cons/initializer_list_compare_alloc.pass.cpp b/test/std/containers/associative/map/map.cons/initializer_list_compare_alloc.pass.cpp index d7552b360..70783e625 100644 --- a/test/std/containers/associative/map/map.cons/initializer_list_compare_alloc.pass.cpp +++ b/test/std/containers/associative/map/map.cons/initializer_list_compare_alloc.pass.cpp @@ -7,6 +7,8 @@ // //===----------------------------------------------------------------------===// +// UNSUPPORTED: c++98, c++03 + // // class map @@ -21,7 +23,6 @@ int main() { -#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS { typedef std::pair V; typedef test_compare > C; @@ -45,7 +46,6 @@ int main() assert(m.key_comp() == C(3)); assert(m.get_allocator() == A(6)); } -#if TEST_STD_VER >= 11 { typedef std::pair V; typedef test_compare > C; @@ -69,7 +69,6 @@ int main() assert(m.key_comp() == C(3)); assert(m.get_allocator() == A()); } -#if TEST_STD_VER > 11 { typedef std::pair V; typedef min_allocator A; @@ -94,7 +93,6 @@ int main() assert(*next(m.begin(), 2) == V(3, 1)); assert(m.get_allocator() == a); } -#endif { typedef std::pair V; typedef explicit_allocator A; @@ -119,6 +117,4 @@ int main() assert(m.key_comp() == C(3)); assert(m.get_allocator() == a); } -#endif -#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS } diff --git a/test/std/containers/associative/map/map.cons/iter_iter_comp_alloc.pass.cpp b/test/std/containers/associative/map/map.cons/iter_iter_comp_alloc.pass.cpp index 705fb5804..923a2124e 100644 --- a/test/std/containers/associative/map/map.cons/iter_iter_comp_alloc.pass.cpp +++ b/test/std/containers/associative/map/map.cons/iter_iter_comp_alloc.pass.cpp @@ -92,7 +92,6 @@ int main() V(3, 2), }; { - typedef std::pair V; typedef min_allocator A; typedef test_compare > C; A a; @@ -106,7 +105,6 @@ int main() assert(m.get_allocator() == a); } { - typedef std::pair V; typedef explicit_allocator A; typedef test_compare > C; A a; diff --git a/test/std/containers/associative/map/map.cons/move.pass.cpp b/test/std/containers/associative/map/map.cons/move.pass.cpp index 2d19b88bd..dd68f9c39 100644 --- a/test/std/containers/associative/map/map.cons/move.pass.cpp +++ b/test/std/containers/associative/map/map.cons/move.pass.cpp @@ -7,6 +7,8 @@ // //===----------------------------------------------------------------------===// +// UNSUPPORTED: c++98, c++03 + // // class map @@ -22,7 +24,6 @@ int main() { -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES typedef std::pair V; { typedef test_compare > C; @@ -69,7 +70,6 @@ int main() assert(mo.size() == 0); assert(distance(mo.begin(), mo.end()) == 0); } -#if TEST_STD_VER >= 11 { typedef test_compare > C; typedef min_allocator A; @@ -115,6 +115,4 @@ int main() assert(mo.size() == 0); assert(distance(mo.begin(), mo.end()) == 0); } -#endif -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES } diff --git a/test/std/containers/associative/map/map.cons/move_alloc.pass.cpp b/test/std/containers/associative/map/map.cons/move_alloc.pass.cpp index 8349f13fd..5f7ab8ece 100644 --- a/test/std/containers/associative/map/map.cons/move_alloc.pass.cpp +++ b/test/std/containers/associative/map/map.cons/move_alloc.pass.cpp @@ -7,6 +7,8 @@ // //===----------------------------------------------------------------------===// +// UNSUPPORTED: c++98, c++03 + // // class map @@ -24,7 +26,6 @@ int main() { -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES { typedef std::pair V; typedef std::pair VC; @@ -189,7 +190,6 @@ int main() } assert(Counter_base::gConstructed == 0); } -#if TEST_STD_VER >= 11 { typedef std::pair V; typedef std::pair VC; @@ -268,6 +268,4 @@ int main() assert(m3.key_comp() == C(5)); assert(m1.empty()); } -#endif -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES } diff --git a/test/std/containers/associative/map/map.cons/move_assign.pass.cpp b/test/std/containers/associative/map/map.cons/move_assign.pass.cpp index 09b41d3b1..8c0ef6e9a 100644 --- a/test/std/containers/associative/map/map.cons/move_assign.pass.cpp +++ b/test/std/containers/associative/map/map.cons/move_assign.pass.cpp @@ -7,6 +7,8 @@ // //===----------------------------------------------------------------------===// +// UNSUPPORTED: c++98, c++03 + // // class map @@ -23,7 +25,6 @@ int main() { -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES { typedef std::pair V; typedef std::pair VC; @@ -144,7 +145,6 @@ int main() assert(m3.key_comp() == C(5)); assert(m1.empty()); } -#if TEST_STD_VER >= 11 { typedef std::pair V; typedef std::pair VC; @@ -185,6 +185,4 @@ int main() assert(m3.key_comp() == C(5)); assert(m1.empty()); } -#endif -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES } diff --git a/test/std/containers/associative/map/map.modifiers/emplace.pass.cpp b/test/std/containers/associative/map/map.modifiers/emplace.pass.cpp index 63d014fe8..3b595fc73 100644 --- a/test/std/containers/associative/map/map.modifiers/emplace.pass.cpp +++ b/test/std/containers/associative/map/map.modifiers/emplace.pass.cpp @@ -7,6 +7,8 @@ // //===----------------------------------------------------------------------===// +// UNSUPPORTED: c++98, c++03 + // // class map @@ -24,7 +26,6 @@ int main() { -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES { typedef std::map M; typedef std::pair R; @@ -92,7 +93,6 @@ int main() assert(m.begin()->first == 2); assert(m.begin()->second == 3.5); } -#if TEST_STD_VER >= 11 { typedef std::map, min_allocator>> M; typedef std::pair R; @@ -160,6 +160,4 @@ int main() assert(m.begin()->first == 2); assert(m.begin()->second == 3.5); } -#endif -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES } diff --git a/test/std/containers/associative/map/map.modifiers/emplace_hint.pass.cpp b/test/std/containers/associative/map/map.modifiers/emplace_hint.pass.cpp index 319a23952..7236276a2 100644 --- a/test/std/containers/associative/map/map.modifiers/emplace_hint.pass.cpp +++ b/test/std/containers/associative/map/map.modifiers/emplace_hint.pass.cpp @@ -7,6 +7,8 @@ // //===----------------------------------------------------------------------===// +// UNSUPPORTED: c++98, c++03 + // // class map @@ -23,7 +25,6 @@ int main() { -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES { typedef std::map M; typedef M::iterator R; @@ -89,7 +90,6 @@ int main() assert(m.begin()->first == 2); assert(m.begin()->second == 3.5); } -#if TEST_STD_VER >= 11 { typedef std::map, min_allocator>> M; typedef M::iterator R; @@ -155,6 +155,4 @@ int main() assert(m.begin()->first == 2); assert(m.begin()->second == 3.5); } -#endif -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES } diff --git a/test/std/containers/associative/map/map.modifiers/insert_initializer_list.pass.cpp b/test/std/containers/associative/map/map.modifiers/insert_initializer_list.pass.cpp index 9cf3f3dcf..de8191a6b 100644 --- a/test/std/containers/associative/map/map.modifiers/insert_initializer_list.pass.cpp +++ b/test/std/containers/associative/map/map.modifiers/insert_initializer_list.pass.cpp @@ -7,6 +7,8 @@ // //===----------------------------------------------------------------------===// +// UNSUPPORTED: c++98, c++03 + // // class map @@ -20,7 +22,6 @@ int main() { -#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS { typedef std::pair V; std::map m = @@ -43,7 +44,6 @@ int main() assert(*next(m.begin()) == V(2, 1)); assert(*next(m.begin(), 2) == V(3, 1)); } -#if TEST_STD_VER >= 11 { typedef std::pair V; std::map, min_allocator> m = @@ -66,6 +66,4 @@ int main() assert(*next(m.begin()) == V(2, 1)); assert(*next(m.begin(), 2) == V(3, 1)); } -#endif -#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS } diff --git a/test/std/containers/associative/multimap/multimap.cons/assign_initializer_list.pass.cpp b/test/std/containers/associative/multimap/multimap.cons/assign_initializer_list.pass.cpp index 4c0326d90..ae4ab349d 100644 --- a/test/std/containers/associative/multimap/multimap.cons/assign_initializer_list.pass.cpp +++ b/test/std/containers/associative/multimap/multimap.cons/assign_initializer_list.pass.cpp @@ -7,6 +7,8 @@ // //===----------------------------------------------------------------------===// +// UNSUPPORTED: c++98, c++03 + // // class multimap @@ -20,7 +22,6 @@ int main() { -#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS { typedef std::multimap C; typedef C::value_type V; @@ -50,7 +51,6 @@ int main() assert(*++i == V(3, 1.5)); assert(*++i == V(3, 2)); } -#if TEST_STD_VER >= 11 { typedef std::multimap, min_allocator>> C; typedef C::value_type V; @@ -80,6 +80,4 @@ int main() assert(*++i == V(3, 1.5)); assert(*++i == V(3, 2)); } -#endif -#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS } diff --git a/test/std/containers/associative/multimap/multimap.cons/initializer_list.pass.cpp b/test/std/containers/associative/multimap/multimap.cons/initializer_list.pass.cpp index 6f645b63b..54b948c3e 100644 --- a/test/std/containers/associative/multimap/multimap.cons/initializer_list.pass.cpp +++ b/test/std/containers/associative/multimap/multimap.cons/initializer_list.pass.cpp @@ -7,6 +7,8 @@ // //===----------------------------------------------------------------------===// +// UNSUPPORTED: c++98, c++03 + // // class multimap @@ -20,7 +22,6 @@ int main() { -#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS { typedef std::multimap C; typedef C::value_type V; @@ -49,7 +50,6 @@ int main() assert(*++i == V(3, 1.5)); assert(*++i == V(3, 2)); } -#if TEST_STD_VER >= 11 { typedef std::multimap, min_allocator>> C; typedef C::value_type V; @@ -78,6 +78,4 @@ int main() assert(*++i == V(3, 1.5)); assert(*++i == V(3, 2)); } -#endif -#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS } diff --git a/test/std/containers/associative/multimap/multimap.cons/initializer_list_compare.pass.cpp b/test/std/containers/associative/multimap/multimap.cons/initializer_list_compare.pass.cpp index 6d20d14f4..a78e1889a 100644 --- a/test/std/containers/associative/multimap/multimap.cons/initializer_list_compare.pass.cpp +++ b/test/std/containers/associative/multimap/multimap.cons/initializer_list_compare.pass.cpp @@ -7,6 +7,8 @@ // //===----------------------------------------------------------------------===// +// UNSUPPORTED: c++98, c++03 + // // class multimap @@ -20,7 +22,6 @@ int main() { -#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS { typedef test_compare > Cmp; typedef std::multimap C; @@ -53,7 +54,6 @@ int main() assert(*++i == V(3, 2)); assert(m.key_comp() == Cmp(4)); } -#if TEST_STD_VER >= 11 { typedef test_compare > Cmp; typedef std::multimap>> C; @@ -86,6 +86,4 @@ int main() assert(*++i == V(3, 2)); assert(m.key_comp() == Cmp(4)); } -#endif -#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS } diff --git a/test/std/containers/associative/multimap/multimap.cons/initializer_list_compare_alloc.pass.cpp b/test/std/containers/associative/multimap/multimap.cons/initializer_list_compare_alloc.pass.cpp index 8d12a059b..ba6f76e52 100644 --- a/test/std/containers/associative/multimap/multimap.cons/initializer_list_compare_alloc.pass.cpp +++ b/test/std/containers/associative/multimap/multimap.cons/initializer_list_compare_alloc.pass.cpp @@ -7,6 +7,8 @@ // //===----------------------------------------------------------------------===// +// UNSUPPORTED: c++98, c++03 + // // class multimap @@ -21,7 +23,6 @@ int main() { -#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS { typedef test_compare > Cmp; typedef test_allocator > A; @@ -56,8 +57,6 @@ int main() assert(m.key_comp() == Cmp(4)); assert(m.get_allocator() == A(5)); } -#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS -#if TEST_STD_VER >= 11 { typedef test_compare > Cmp; typedef min_allocator > A; @@ -92,7 +91,6 @@ int main() assert(m.key_comp() == Cmp(4)); assert(m.get_allocator() == A()); } -#if TEST_STD_VER > 11 { typedef test_compare > C; typedef std::pair V; @@ -124,7 +122,6 @@ int main() assert(*++i == V(3, 2)); assert(m.get_allocator() == a); } -#endif { typedef test_compare > Cmp; typedef explicit_allocator > A; @@ -159,5 +156,4 @@ int main() assert(m.key_comp() == Cmp(4)); assert(m.get_allocator() == A{}); } -#endif } diff --git a/test/std/containers/associative/multimap/multimap.cons/move.pass.cpp b/test/std/containers/associative/multimap/multimap.cons/move.pass.cpp index 7edec7736..769c709cf 100644 --- a/test/std/containers/associative/multimap/multimap.cons/move.pass.cpp +++ b/test/std/containers/associative/multimap/multimap.cons/move.pass.cpp @@ -7,6 +7,8 @@ // //===----------------------------------------------------------------------===// +// UNSUPPORTED: c++98, c++03 + // // class multimap @@ -22,7 +24,6 @@ int main() { -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES typedef std::pair V; { typedef test_compare > C; @@ -75,7 +76,6 @@ int main() assert(mo.size() == 0); assert(distance(mo.begin(), mo.end()) == 0); } -#if TEST_STD_VER >= 11 { typedef test_compare > C; typedef min_allocator A; @@ -127,6 +127,4 @@ int main() assert(mo.size() == 0); assert(distance(mo.begin(), mo.end()) == 0); } -#endif -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES } diff --git a/test/std/containers/associative/multimap/multimap.cons/move_alloc.pass.cpp b/test/std/containers/associative/multimap/multimap.cons/move_alloc.pass.cpp index 6ce7127ea..5882283ab 100644 --- a/test/std/containers/associative/multimap/multimap.cons/move_alloc.pass.cpp +++ b/test/std/containers/associative/multimap/multimap.cons/move_alloc.pass.cpp @@ -7,6 +7,8 @@ // //===----------------------------------------------------------------------===// +// UNSUPPORTED: c++98, c++03 + // // class multimap @@ -24,7 +26,6 @@ int main() { -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES { typedef std::pair V; typedef std::pair VC; @@ -189,7 +190,6 @@ int main() } assert(Counter_base::gConstructed == 0); } -#if TEST_STD_VER >= 11 { typedef std::pair V; typedef std::pair VC; @@ -268,6 +268,4 @@ int main() assert(m3.key_comp() == C(5)); assert(m1.empty()); } -#endif -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES } diff --git a/test/std/containers/associative/multimap/multimap.cons/move_assign.pass.cpp b/test/std/containers/associative/multimap/multimap.cons/move_assign.pass.cpp index 924e9ddf1..247425415 100644 --- a/test/std/containers/associative/multimap/multimap.cons/move_assign.pass.cpp +++ b/test/std/containers/associative/multimap/multimap.cons/move_assign.pass.cpp @@ -7,6 +7,8 @@ // //===----------------------------------------------------------------------===// +// UNSUPPORTED: c++98, c++03 + // // class multimap @@ -23,7 +25,6 @@ int main() { -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES { typedef std::pair V; typedef std::pair VC; @@ -144,7 +145,6 @@ int main() assert(m3.key_comp() == C(5)); assert(m1.empty()); } -#if TEST_STD_VER >= 11 { typedef std::pair V; typedef std::pair VC; @@ -185,6 +185,4 @@ int main() assert(m3.key_comp() == C(5)); assert(m1.empty()); } -#endif -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES } diff --git a/test/std/containers/associative/multimap/multimap.modifiers/emplace.pass.cpp b/test/std/containers/associative/multimap/multimap.modifiers/emplace.pass.cpp index 7f5b698fa..024cc670e 100644 --- a/test/std/containers/associative/multimap/multimap.modifiers/emplace.pass.cpp +++ b/test/std/containers/associative/multimap/multimap.modifiers/emplace.pass.cpp @@ -7,6 +7,8 @@ // //===----------------------------------------------------------------------===// +// UNSUPPORTED: c++98, c++03 + // // class multimap @@ -23,7 +25,6 @@ int main() { -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES { typedef std::multimap M; typedef M::iterator R; @@ -84,7 +85,6 @@ int main() assert(m.begin()->first == 2); assert(m.begin()->second == 3.5); } -#if TEST_STD_VER >= 11 { typedef std::multimap, min_allocator>> M; typedef M::iterator R; @@ -145,6 +145,4 @@ int main() assert(m.begin()->first == 2); assert(m.begin()->second == 3.5); } -#endif -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES } diff --git a/test/std/containers/associative/multimap/multimap.modifiers/emplace_hint.pass.cpp b/test/std/containers/associative/multimap/multimap.modifiers/emplace_hint.pass.cpp index a6ed318c7..d5fde83a7 100644 --- a/test/std/containers/associative/multimap/multimap.modifiers/emplace_hint.pass.cpp +++ b/test/std/containers/associative/multimap/multimap.modifiers/emplace_hint.pass.cpp @@ -7,6 +7,8 @@ // //===----------------------------------------------------------------------===// +// UNSUPPORTED: c++98, c++03 + // // class multimap @@ -23,7 +25,6 @@ int main() { -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES { typedef std::multimap M; typedef M::iterator R; @@ -89,7 +90,6 @@ int main() assert(m.begin()->first == 2); assert(m.begin()->second == 3.5); } -#if TEST_STD_VER >= 11 { typedef std::multimap, min_allocator>> M; typedef M::iterator R; @@ -155,6 +155,4 @@ int main() assert(m.begin()->first == 2); assert(m.begin()->second == 3.5); } -#endif -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES } diff --git a/test/std/containers/associative/multimap/multimap.modifiers/insert_initializer_list.pass.cpp b/test/std/containers/associative/multimap/multimap.modifiers/insert_initializer_list.pass.cpp index 89befb3e9..20e0ba17e 100644 --- a/test/std/containers/associative/multimap/multimap.modifiers/insert_initializer_list.pass.cpp +++ b/test/std/containers/associative/multimap/multimap.modifiers/insert_initializer_list.pass.cpp @@ -7,6 +7,8 @@ // //===----------------------------------------------------------------------===// +// UNSUPPORTED: c++98, c++03 + // // class multimap @@ -20,7 +22,6 @@ int main() { -#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS { typedef std::multimap C; typedef C::value_type V; @@ -53,7 +54,6 @@ int main() assert(*++i == V(3, 2)); assert(*++i == V(3, 1.5)); } -#if TEST_STD_VER >= 11 { typedef std::multimap, min_allocator>> C; typedef C::value_type V; @@ -86,6 +86,4 @@ int main() assert(*++i == V(3, 2)); assert(*++i == V(3, 1.5)); } -#endif -#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS } diff --git a/test/std/containers/associative/multimap/multimap.ops/equal_range.pass.cpp b/test/std/containers/associative/multimap/multimap.ops/equal_range.pass.cpp index df46d376e..9e67f97f9 100644 --- a/test/std/containers/associative/multimap/multimap.ops/equal_range.pass.cpp +++ b/test/std/containers/associative/multimap/multimap.ops/equal_range.pass.cpp @@ -183,7 +183,6 @@ int main() #endif #if TEST_STD_VER > 11 { - typedef std::pair V; typedef std::multimap> M; typedef std::pair R; diff --git a/test/std/containers/associative/multimap/multimap.ops/find.pass.cpp b/test/std/containers/associative/multimap/multimap.ops/find.pass.cpp index f5295e52d..474b7b6ac 100644 --- a/test/std/containers/associative/multimap/multimap.ops/find.pass.cpp +++ b/test/std/containers/associative/multimap/multimap.ops/find.pass.cpp @@ -147,7 +147,6 @@ int main() #endif #if TEST_STD_VER > 11 { - typedef std::pair V; typedef std::multimap> M; typedef M::iterator R; diff --git a/test/std/containers/associative/multimap/multimap.ops/lower_bound.pass.cpp b/test/std/containers/associative/multimap/multimap.ops/lower_bound.pass.cpp index 8a650fa55..28ff33254 100644 --- a/test/std/containers/associative/multimap/multimap.ops/lower_bound.pass.cpp +++ b/test/std/containers/associative/multimap/multimap.ops/lower_bound.pass.cpp @@ -155,7 +155,6 @@ int main() #endif #if TEST_STD_VER > 11 { - typedef std::pair V; typedef std::multimap> M; typedef M::iterator R; V ar[] = diff --git a/test/std/containers/associative/multimap/multimap.ops/upper_bound.pass.cpp b/test/std/containers/associative/multimap/multimap.ops/upper_bound.pass.cpp index 05760dc0e..4f4b3884f 100644 --- a/test/std/containers/associative/multimap/multimap.ops/upper_bound.pass.cpp +++ b/test/std/containers/associative/multimap/multimap.ops/upper_bound.pass.cpp @@ -155,7 +155,6 @@ int main() #endif #if TEST_STD_VER > 11 { - typedef std::pair V; typedef std::multimap> M; typedef M::iterator R; V ar[] = diff --git a/test/std/containers/associative/multiset/emplace.pass.cpp b/test/std/containers/associative/multiset/emplace.pass.cpp index 93842a250..7e2628db0 100644 --- a/test/std/containers/associative/multiset/emplace.pass.cpp +++ b/test/std/containers/associative/multiset/emplace.pass.cpp @@ -7,6 +7,8 @@ // //===----------------------------------------------------------------------===// +// UNSUPPORTED: c++98, c++03 + // // class multiset @@ -23,7 +25,6 @@ int main() { -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES { typedef std::multiset M; typedef M::iterator R; @@ -68,7 +69,6 @@ int main() assert(m.size() == 1); assert(*r == 2); } -#if TEST_STD_VER >= 11 { typedef std::multiset, min_allocator> M; typedef M::iterator R; @@ -78,6 +78,4 @@ int main() assert(m.size() == 1); assert(*r == 2); } -#endif -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES } diff --git a/test/std/containers/associative/multiset/emplace_hint.pass.cpp b/test/std/containers/associative/multiset/emplace_hint.pass.cpp index 48519fd43..2b9b92d0b 100644 --- a/test/std/containers/associative/multiset/emplace_hint.pass.cpp +++ b/test/std/containers/associative/multiset/emplace_hint.pass.cpp @@ -7,6 +7,8 @@ // //===----------------------------------------------------------------------===// +// UNSUPPORTED: c++98, c++03 + // // class multiset @@ -23,7 +25,6 @@ int main() { -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES { typedef std::multiset M; typedef M::iterator R; @@ -68,7 +69,6 @@ int main() assert(m.size() == 1); assert(*r == 2); } -#if TEST_STD_VER >= 11 { typedef std::multiset, min_allocator> M; typedef M::iterator R; @@ -78,6 +78,4 @@ int main() assert(m.size() == 1); assert(*r == 2); } -#endif -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES } diff --git a/test/std/containers/associative/multiset/insert_initializer_list.pass.cpp b/test/std/containers/associative/multiset/insert_initializer_list.pass.cpp index 590c66801..23a65a3cc 100644 --- a/test/std/containers/associative/multiset/insert_initializer_list.pass.cpp +++ b/test/std/containers/associative/multiset/insert_initializer_list.pass.cpp @@ -7,6 +7,8 @@ // //===----------------------------------------------------------------------===// +// UNSUPPORTED: c++98, c++03 + // // class multiset @@ -21,7 +23,6 @@ int main() { -#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS { typedef std::multiset C; typedef C::value_type V; @@ -39,8 +40,6 @@ int main() assert(*++i == V(8)); assert(*++i == V(10)); } -#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS -#if TEST_STD_VER >= 11 { typedef std::multiset, min_allocator> C; typedef C::value_type V; @@ -58,5 +57,4 @@ int main() assert(*++i == V(8)); assert(*++i == V(10)); } -#endif } diff --git a/test/std/containers/associative/multiset/insert_iter_rv.pass.cpp b/test/std/containers/associative/multiset/insert_iter_rv.pass.cpp index 0afc8dc87..f39fca5c8 100644 --- a/test/std/containers/associative/multiset/insert_iter_rv.pass.cpp +++ b/test/std/containers/associative/multiset/insert_iter_rv.pass.cpp @@ -7,6 +7,8 @@ // //===----------------------------------------------------------------------===// +// UNSUPPORTED: c++98, c++03 + // // class multiset @@ -21,7 +23,6 @@ int main() { -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES { typedef std::multiset M; typedef M::iterator R; @@ -46,8 +47,6 @@ int main() assert(m.size() == 4); assert(*r == 3); } -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES -#if TEST_STD_VER >= 11 { typedef std::multiset, min_allocator> M; typedef M::iterator R; @@ -72,5 +71,4 @@ int main() assert(m.size() == 4); assert(*r == 3); } -#endif } diff --git a/test/std/containers/associative/multiset/insert_rv.pass.cpp b/test/std/containers/associative/multiset/insert_rv.pass.cpp index 3ee464bc5..68d348793 100644 --- a/test/std/containers/associative/multiset/insert_rv.pass.cpp +++ b/test/std/containers/associative/multiset/insert_rv.pass.cpp @@ -7,6 +7,8 @@ // //===----------------------------------------------------------------------===// +// UNSUPPORTED: c++98, c++03 + // // class multiset @@ -21,7 +23,6 @@ int main() { -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES { typedef std::multiset M; typedef M::iterator R; @@ -46,8 +47,6 @@ int main() assert(m.size() == 4); assert(*r == 3); } -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES -#if TEST_STD_VER >= 11 { typedef std::multiset, min_allocator> M; typedef M::iterator R; @@ -72,5 +71,4 @@ int main() assert(m.size() == 4); assert(*r == 3); } -#endif } diff --git a/test/std/containers/associative/multiset/multiset.cons/assign_initializer_list.pass.cpp b/test/std/containers/associative/multiset/multiset.cons/assign_initializer_list.pass.cpp index 2c5318afd..915a15fc6 100644 --- a/test/std/containers/associative/multiset/multiset.cons/assign_initializer_list.pass.cpp +++ b/test/std/containers/associative/multiset/multiset.cons/assign_initializer_list.pass.cpp @@ -7,6 +7,8 @@ // //===----------------------------------------------------------------------===// +// UNSUPPORTED: c++98, c++03 + // // class multiset @@ -20,7 +22,6 @@ int main() { -#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS { typedef std::multiset C; typedef C::value_type V; @@ -36,8 +37,6 @@ int main() assert(*++i == V(5)); assert(*++i == V(6)); } -#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS -#if TEST_STD_VER >= 11 { typedef std::multiset, min_allocator> C; typedef C::value_type V; @@ -53,5 +52,4 @@ int main() assert(*++i == V(5)); assert(*++i == V(6)); } -#endif } diff --git a/test/std/containers/associative/multiset/multiset.cons/initializer_list.pass.cpp b/test/std/containers/associative/multiset/multiset.cons/initializer_list.pass.cpp index b3d6066eb..f3ee002dc 100644 --- a/test/std/containers/associative/multiset/multiset.cons/initializer_list.pass.cpp +++ b/test/std/containers/associative/multiset/multiset.cons/initializer_list.pass.cpp @@ -7,6 +7,8 @@ // //===----------------------------------------------------------------------===// +// UNSUPPORTED: c++98, c++03 + // // class multiset @@ -21,7 +23,6 @@ int main() { -#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS { typedef std::multiset C; typedef C::value_type V; @@ -36,8 +37,6 @@ int main() assert(*++i == V(5)); assert(*++i == V(6)); } -#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS -#if TEST_STD_VER >= 11 { typedef std::multiset, min_allocator> C; typedef C::value_type V; @@ -52,7 +51,6 @@ int main() assert(*++i == V(5)); assert(*++i == V(6)); } -#if TEST_STD_VER > 11 { typedef std::multiset, min_allocator> C; typedef C::value_type V; @@ -69,6 +67,4 @@ int main() assert(*++i == V(6)); assert(m.get_allocator() == a); } -#endif -#endif } diff --git a/test/std/containers/associative/multiset/multiset.cons/initializer_list_compare.pass.cpp b/test/std/containers/associative/multiset/multiset.cons/initializer_list_compare.pass.cpp index c67657aff..3312ca138 100644 --- a/test/std/containers/associative/multiset/multiset.cons/initializer_list_compare.pass.cpp +++ b/test/std/containers/associative/multiset/multiset.cons/initializer_list_compare.pass.cpp @@ -7,6 +7,8 @@ // //===----------------------------------------------------------------------===// +// UNSUPPORTED: c++98, c++03 + // // class multiset @@ -19,7 +21,6 @@ int main() { -#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS typedef test_compare > Cmp; typedef std::multiset C; typedef C::value_type V; @@ -34,5 +35,4 @@ int main() assert(*++i == V(5)); assert(*++i == V(6)); assert(m.key_comp() == Cmp(10)); -#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS } diff --git a/test/std/containers/associative/multiset/multiset.cons/initializer_list_compare_alloc.pass.cpp b/test/std/containers/associative/multiset/multiset.cons/initializer_list_compare_alloc.pass.cpp index 83114893a..e495fce13 100644 --- a/test/std/containers/associative/multiset/multiset.cons/initializer_list_compare_alloc.pass.cpp +++ b/test/std/containers/associative/multiset/multiset.cons/initializer_list_compare_alloc.pass.cpp @@ -7,6 +7,8 @@ // //===----------------------------------------------------------------------===// +// UNSUPPORTED: c++98, c++03 + // // class multiset @@ -20,7 +22,6 @@ int main() { -#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS typedef test_compare > Cmp; typedef test_allocator A; typedef std::multiset C; @@ -37,5 +38,4 @@ int main() assert(*++i == V(6)); assert(m.key_comp() == Cmp(10)); assert(m.get_allocator() == A(4)); -#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS } diff --git a/test/std/containers/associative/multiset/multiset.cons/move.pass.cpp b/test/std/containers/associative/multiset/multiset.cons/move.pass.cpp index 5a905cf15..2adfb5c37 100644 --- a/test/std/containers/associative/multiset/multiset.cons/move.pass.cpp +++ b/test/std/containers/associative/multiset/multiset.cons/move.pass.cpp @@ -7,6 +7,8 @@ // //===----------------------------------------------------------------------===// +// UNSUPPORTED: c++98, c++03 + // // class multiset @@ -22,7 +24,6 @@ int main() { -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES { typedef int V; typedef test_compare > C; @@ -76,8 +77,6 @@ int main() assert(mo.size() == 0); assert(distance(mo.begin(), mo.end()) == 0); } -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES -#if TEST_STD_VER >= 11 { typedef int V; V ar[] = @@ -115,5 +114,4 @@ int main() assert(mo.size() == 0); assert(distance(mo.begin(), mo.end()) == 0); } -#endif } diff --git a/test/std/containers/associative/multiset/multiset.cons/move_alloc.pass.cpp b/test/std/containers/associative/multiset/multiset.cons/move_alloc.pass.cpp index 3da3fc09a..29797c3ee 100644 --- a/test/std/containers/associative/multiset/multiset.cons/move_alloc.pass.cpp +++ b/test/std/containers/associative/multiset/multiset.cons/move_alloc.pass.cpp @@ -7,6 +7,8 @@ // //===----------------------------------------------------------------------===// +// UNSUPPORTED: c++98, c++03 + // // class multiset @@ -23,7 +25,6 @@ int main() { -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES { typedef MoveOnly V; typedef test_compare > C; @@ -183,5 +184,4 @@ int main() } assert(Counter_base::gConstructed == 0); } -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES } diff --git a/test/std/containers/associative/multiset/multiset.cons/move_assign.pass.cpp b/test/std/containers/associative/multiset/multiset.cons/move_assign.pass.cpp index b0ec4f394..e767ff1a4 100644 --- a/test/std/containers/associative/multiset/multiset.cons/move_assign.pass.cpp +++ b/test/std/containers/associative/multiset/multiset.cons/move_assign.pass.cpp @@ -7,6 +7,8 @@ // //===----------------------------------------------------------------------===// +// UNSUPPORTED: c++98, c++03 + // // class multiset @@ -23,7 +25,6 @@ int main() { -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES { typedef MoveOnly V; typedef test_compare > C; @@ -141,8 +142,6 @@ int main() assert(m3.key_comp() == C(5)); assert(m1.empty()); } -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES -#if TEST_STD_VER >= 11 { typedef MoveOnly V; typedef test_compare > C; @@ -182,5 +181,4 @@ int main() assert(m3.key_comp() == C(5)); assert(m1.empty()); } -#endif } diff --git a/test/std/containers/associative/set/emplace.pass.cpp b/test/std/containers/associative/set/emplace.pass.cpp index 47ef455a9..5d50a2435 100644 --- a/test/std/containers/associative/set/emplace.pass.cpp +++ b/test/std/containers/associative/set/emplace.pass.cpp @@ -7,6 +7,8 @@ // //===----------------------------------------------------------------------===// +// UNSUPPORTED: c++98, c++03 + // // class set @@ -23,7 +25,6 @@ int main() { -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES { typedef std::set M; typedef std::pair R; @@ -74,7 +75,6 @@ int main() assert(m.size() == 1); assert(*r.first == 2); } -#if TEST_STD_VER >= 11 { typedef std::set, min_allocator> M; typedef std::pair R; @@ -85,6 +85,4 @@ int main() assert(m.size() == 1); assert(*r.first == 2); } -#endif -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES } diff --git a/test/std/containers/associative/set/emplace_hint.pass.cpp b/test/std/containers/associative/set/emplace_hint.pass.cpp index 036f4d6df..8962c0cbd 100644 --- a/test/std/containers/associative/set/emplace_hint.pass.cpp +++ b/test/std/containers/associative/set/emplace_hint.pass.cpp @@ -7,6 +7,8 @@ // //===----------------------------------------------------------------------===// +// UNSUPPORTED: c++98, c++03 + // // class set @@ -23,7 +25,6 @@ int main() { -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES { typedef std::set M; typedef M::iterator R; @@ -68,7 +69,6 @@ int main() assert(m.size() == 1); assert(*r == 2); } -#if TEST_STD_VER >= 11 { typedef std::set, min_allocator> M; typedef M::iterator R; @@ -78,6 +78,4 @@ int main() assert(m.size() == 1); assert(*r == 2); } -#endif -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES } diff --git a/test/std/containers/associative/set/insert_initializer_list.pass.cpp b/test/std/containers/associative/set/insert_initializer_list.pass.cpp index 490d75905..3114d48ab 100644 --- a/test/std/containers/associative/set/insert_initializer_list.pass.cpp +++ b/test/std/containers/associative/set/insert_initializer_list.pass.cpp @@ -7,6 +7,8 @@ // //===----------------------------------------------------------------------===// +// UNSUPPORTED: c++98, c++03 + // // class set @@ -21,7 +23,6 @@ int main() { -#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS { typedef std::set C; typedef C::value_type V; @@ -39,7 +40,6 @@ int main() assert(*++i == V(8)); assert(*++i == V(10)); } -#if TEST_STD_VER >= 11 { typedef std::set, min_allocator> C; typedef C::value_type V; @@ -57,6 +57,4 @@ int main() assert(*++i == V(8)); assert(*++i == V(10)); } -#endif -#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS } diff --git a/test/std/containers/associative/set/insert_iter_rv.pass.cpp b/test/std/containers/associative/set/insert_iter_rv.pass.cpp index be827d644..9579988c0 100644 --- a/test/std/containers/associative/set/insert_iter_rv.pass.cpp +++ b/test/std/containers/associative/set/insert_iter_rv.pass.cpp @@ -7,6 +7,8 @@ // //===----------------------------------------------------------------------===// +// UNSUPPORTED: c++98, c++03 + // // class set @@ -21,7 +23,6 @@ int main() { -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES { typedef std::set M; typedef M::iterator R; @@ -46,7 +47,6 @@ int main() assert(m.size() == 3); assert(*r == 3); } -#if TEST_STD_VER >= 11 { typedef std::set, min_allocator> M; typedef M::iterator R; @@ -71,6 +71,4 @@ int main() assert(m.size() == 3); assert(*r == 3); } -#endif -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES } diff --git a/test/std/containers/associative/set/insert_rv.pass.cpp b/test/std/containers/associative/set/insert_rv.pass.cpp index e528ef347..25cbfcb88 100644 --- a/test/std/containers/associative/set/insert_rv.pass.cpp +++ b/test/std/containers/associative/set/insert_rv.pass.cpp @@ -7,6 +7,8 @@ // //===----------------------------------------------------------------------===// +// UNSUPPORTED: c++98, c++03 + // // class set @@ -21,7 +23,6 @@ int main() { -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES { typedef std::set M; typedef std::pair R; @@ -50,7 +51,6 @@ int main() assert(m.size() == 3); assert(*r.first == 3); } -#if TEST_STD_VER >= 11 { typedef std::set, min_allocator> M; typedef std::pair R; @@ -79,6 +79,4 @@ int main() assert(m.size() == 3); assert(*r.first == 3); } -#endif -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES } diff --git a/test/std/containers/associative/set/set.cons/assign_initializer_list.pass.cpp b/test/std/containers/associative/set/set.cons/assign_initializer_list.pass.cpp index 70e174a59..9906a1c0b 100644 --- a/test/std/containers/associative/set/set.cons/assign_initializer_list.pass.cpp +++ b/test/std/containers/associative/set/set.cons/assign_initializer_list.pass.cpp @@ -7,6 +7,8 @@ // //===----------------------------------------------------------------------===// +// UNSUPPORTED: c++98, c++03 + // // class set @@ -20,7 +22,6 @@ int main() { -#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS { typedef std::set C; typedef C::value_type V; @@ -36,7 +37,6 @@ int main() assert(*++i == V(5)); assert(*++i == V(6)); } -#if TEST_STD_VER >= 11 { typedef std::set, min_allocator> C; typedef C::value_type V; @@ -52,6 +52,4 @@ int main() assert(*++i == V(5)); assert(*++i == V(6)); } -#endif -#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS } diff --git a/test/std/containers/associative/set/set.cons/initializer_list.pass.cpp b/test/std/containers/associative/set/set.cons/initializer_list.pass.cpp index 5bb5460dd..31521b2f3 100644 --- a/test/std/containers/associative/set/set.cons/initializer_list.pass.cpp +++ b/test/std/containers/associative/set/set.cons/initializer_list.pass.cpp @@ -7,6 +7,8 @@ // //===----------------------------------------------------------------------===// +// UNSUPPORTED: c++98, c++03 + // // class set @@ -20,7 +22,6 @@ int main() { -#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS { typedef std::set C; typedef C::value_type V; @@ -35,7 +36,6 @@ int main() assert(*++i == V(5)); assert(*++i == V(6)); } -#if TEST_STD_VER >= 11 { typedef std::set, min_allocator> C; typedef C::value_type V; @@ -50,6 +50,4 @@ int main() assert(*++i == V(5)); assert(*++i == V(6)); } -#endif -#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS } diff --git a/test/std/containers/associative/set/set.cons/initializer_list_compare.pass.cpp b/test/std/containers/associative/set/set.cons/initializer_list_compare.pass.cpp index a0afa02cf..ea72b6dc0 100644 --- a/test/std/containers/associative/set/set.cons/initializer_list_compare.pass.cpp +++ b/test/std/containers/associative/set/set.cons/initializer_list_compare.pass.cpp @@ -7,6 +7,8 @@ // //===----------------------------------------------------------------------===// +// UNSUPPORTED: c++98, c++03 + // // class set @@ -19,7 +21,6 @@ int main() { -#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS typedef test_compare > Cmp; typedef std::set C; typedef C::value_type V; @@ -34,5 +35,4 @@ int main() assert(*++i == V(5)); assert(*++i == V(6)); assert(m.key_comp() == Cmp(10)); -#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS } diff --git a/test/std/containers/associative/set/set.cons/initializer_list_compare_alloc.pass.cpp b/test/std/containers/associative/set/set.cons/initializer_list_compare_alloc.pass.cpp index 80d41b0b5..f6cb734c3 100644 --- a/test/std/containers/associative/set/set.cons/initializer_list_compare_alloc.pass.cpp +++ b/test/std/containers/associative/set/set.cons/initializer_list_compare_alloc.pass.cpp @@ -7,6 +7,8 @@ // //===----------------------------------------------------------------------===// +// UNSUPPORTED: c++98, c++03 + // // class set @@ -22,7 +24,6 @@ int main() { -#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS { typedef test_compare > Cmp; typedef test_allocator A; @@ -41,7 +42,6 @@ int main() assert(m.key_comp() == Cmp(10)); assert(m.get_allocator() == A(4)); } -#if TEST_STD_VER > 11 { typedef test_compare > Cmp; typedef test_allocator A; @@ -59,6 +59,4 @@ int main() assert(*++i == V(6)); assert(m.get_allocator() == A(4)); } -#endif -#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS } diff --git a/test/std/containers/associative/set/set.cons/move.pass.cpp b/test/std/containers/associative/set/set.cons/move.pass.cpp index c836d4550..dd313e4cd 100644 --- a/test/std/containers/associative/set/set.cons/move.pass.cpp +++ b/test/std/containers/associative/set/set.cons/move.pass.cpp @@ -7,6 +7,8 @@ // //===----------------------------------------------------------------------===// +// UNSUPPORTED: c++98, c++03 + // // class set @@ -22,7 +24,6 @@ int main() { -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES { typedef int V; typedef test_compare > C; @@ -70,7 +71,6 @@ int main() assert(mo.size() == 0); assert(distance(mo.begin(), mo.end()) == 0); } -#if TEST_STD_VER >= 11 { typedef int V; V ar[] = @@ -102,6 +102,4 @@ int main() assert(mo.size() == 0); assert(distance(mo.begin(), mo.end()) == 0); } -#endif -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES } diff --git a/test/std/containers/associative/set/set.cons/move_alloc.pass.cpp b/test/std/containers/associative/set/set.cons/move_alloc.pass.cpp index ba2adf5bb..9e1cd816b 100644 --- a/test/std/containers/associative/set/set.cons/move_alloc.pass.cpp +++ b/test/std/containers/associative/set/set.cons/move_alloc.pass.cpp @@ -7,6 +7,8 @@ // //===----------------------------------------------------------------------===// +// UNSUPPORTED: c++98, c++03 + // // class set @@ -23,7 +25,6 @@ int main() { -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES { typedef MoveOnly V; typedef test_compare > C; @@ -184,5 +185,4 @@ int main() assert(Counter_base::gConstructed == 0); } -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES } diff --git a/test/std/containers/associative/set/set.cons/move_assign.pass.cpp b/test/std/containers/associative/set/set.cons/move_assign.pass.cpp index 07cb4153f..7862f7bf7 100644 --- a/test/std/containers/associative/set/set.cons/move_assign.pass.cpp +++ b/test/std/containers/associative/set/set.cons/move_assign.pass.cpp @@ -7,6 +7,8 @@ // //===----------------------------------------------------------------------===// +// UNSUPPORTED: c++98, c++03 + // // class set @@ -23,7 +25,6 @@ int main() { -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES { typedef MoveOnly V; typedef test_compare > C; @@ -141,7 +142,6 @@ int main() assert(m3.key_comp() == C(5)); assert(m1.empty()); } -#if TEST_STD_VER >= 11 { typedef MoveOnly V; typedef test_compare > C; @@ -181,6 +181,4 @@ int main() assert(m3.key_comp() == C(5)); assert(m1.empty()); } -#endif -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES } diff --git a/test/std/containers/container.adaptors/priority.queue/priqueue.cons.alloc/ctor_alloc.pass.cpp b/test/std/containers/container.adaptors/priority.queue/priqueue.cons.alloc/ctor_alloc.pass.cpp index b102f117d..6210a59c3 100644 --- a/test/std/containers/container.adaptors/priority.queue/priqueue.cons.alloc/ctor_alloc.pass.cpp +++ b/test/std/containers/container.adaptors/priority.queue/priqueue.cons.alloc/ctor_alloc.pass.cpp @@ -15,6 +15,7 @@ #include #include +#include "test_macros.h" #include "test_allocator.h" template @@ -30,11 +31,11 @@ struct test : base(comp, c, a) {} test(const value_compare& comp, const container_type& c, const test_allocator& a) : base(comp, c, a) {} -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES +#if TEST_STD_VER >= 11 test(const value_compare& comp, container_type&& c, const test_allocator& a) : base(comp, std::move(c), a) {} test(test&& q, const test_allocator& a) : base(std::move(q), a) {} -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES +#endif test_allocator get_allocator() {return c.get_allocator();} using base::c; diff --git a/test/std/containers/container.adaptors/priority.queue/priqueue.cons.alloc/ctor_comp_alloc.pass.cpp b/test/std/containers/container.adaptors/priority.queue/priqueue.cons.alloc/ctor_comp_alloc.pass.cpp index 4d99fc147..b1d13fb8b 100644 --- a/test/std/containers/container.adaptors/priority.queue/priqueue.cons.alloc/ctor_comp_alloc.pass.cpp +++ b/test/std/containers/container.adaptors/priority.queue/priqueue.cons.alloc/ctor_comp_alloc.pass.cpp @@ -15,6 +15,7 @@ #include #include +#include "test_macros.h" #include "test_allocator.h" template @@ -30,11 +31,11 @@ struct test : base(comp, a) {} test(const value_compare& comp, const container_type& c, const test_allocator& a) : base(comp, c, a) {} -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES +#if TEST_STD_VER >= 11 test(const value_compare& comp, container_type&& c, const test_allocator& a) : base(comp, std::move(c), a) {} test(test&& q, const test_allocator& a) : base(std::move(q), a) {} -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES +#endif test_allocator get_allocator() {return c.get_allocator();} using base::c; diff --git a/test/std/containers/container.adaptors/priority.queue/priqueue.cons.alloc/ctor_move_alloc.pass.cpp b/test/std/containers/container.adaptors/priority.queue/priqueue.cons.alloc/ctor_move_alloc.pass.cpp index 8bdf7db86..df255b4cf 100644 --- a/test/std/containers/container.adaptors/priority.queue/priqueue.cons.alloc/ctor_move_alloc.pass.cpp +++ b/test/std/containers/container.adaptors/priority.queue/priqueue.cons.alloc/ctor_move_alloc.pass.cpp @@ -7,6 +7,8 @@ // //===----------------------------------------------------------------------===// +// UNSUPPORTED: c++98, c++03 + // // template @@ -17,7 +19,6 @@ #include "MoveOnly.h" -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES template C @@ -52,11 +53,9 @@ struct test using base::c; }; -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES int main() { -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES test qo(std::less(), make > >(5), test_allocator(2)); @@ -64,5 +63,4 @@ int main() assert(q.size() == 5); assert(q.c.get_allocator() == test_allocator(6)); assert(q.top() == MoveOnly(4)); -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES } diff --git a/test/std/containers/container.adaptors/priority.queue/priqueue.cons/assign_move.pass.cpp b/test/std/containers/container.adaptors/priority.queue/priqueue.cons/assign_move.pass.cpp index d43e53819..4b20b265f 100644 --- a/test/std/containers/container.adaptors/priority.queue/priqueue.cons/assign_move.pass.cpp +++ b/test/std/containers/container.adaptors/priority.queue/priqueue.cons/assign_move.pass.cpp @@ -7,6 +7,8 @@ // //===----------------------------------------------------------------------===// +// UNSUPPORTED: c++98, c++03 + // // priority_queue& operator=(priority_queue&& q); @@ -16,7 +18,6 @@ #include "MoveOnly.h" -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES template C @@ -28,15 +29,12 @@ make(int n) return c; } -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES int main() { -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES std::priority_queue qo(std::less(), make >(5)); std::priority_queue q; q = std::move(qo); assert(q.size() == 5); assert(q.top() == MoveOnly(4)); -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES } diff --git a/test/std/containers/container.adaptors/priority.queue/priqueue.cons/ctor_comp_rcontainer.pass.cpp b/test/std/containers/container.adaptors/priority.queue/priqueue.cons/ctor_comp_rcontainer.pass.cpp index b61fb88a5..719f6d980 100644 --- a/test/std/containers/container.adaptors/priority.queue/priqueue.cons/ctor_comp_rcontainer.pass.cpp +++ b/test/std/containers/container.adaptors/priority.queue/priqueue.cons/ctor_comp_rcontainer.pass.cpp @@ -7,6 +7,8 @@ // //===----------------------------------------------------------------------===// +// UNSUPPORTED: c++98, c++03 + // // explicit priority_queue(const Compare& comp, container_type&& c); @@ -16,7 +18,6 @@ #include "MoveOnly.h" -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES template C @@ -28,13 +29,10 @@ make(int n) return c; } -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES int main() { -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES std::priority_queue q(std::less(), make >(5)); assert(q.size() == 5); assert(q.top() == MoveOnly(4)); -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES } diff --git a/test/std/containers/container.adaptors/priority.queue/priqueue.cons/ctor_iter_iter_comp_rcont.pass.cpp b/test/std/containers/container.adaptors/priority.queue/priqueue.cons/ctor_iter_iter_comp_rcont.pass.cpp index 7abe796e5..450dff37c 100644 --- a/test/std/containers/container.adaptors/priority.queue/priqueue.cons/ctor_iter_iter_comp_rcont.pass.cpp +++ b/test/std/containers/container.adaptors/priority.queue/priqueue.cons/ctor_iter_iter_comp_rcont.pass.cpp @@ -7,6 +7,8 @@ // //===----------------------------------------------------------------------===// +// UNSUPPORTED: c++98, c++03 + // // template @@ -20,7 +22,6 @@ int main() { -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES int a[] = {3, 5, 2, 0, 6, 8, 1}; const int n = sizeof(a)/sizeof(a[0]); std::priority_queue q(a+n/2, a+n, @@ -28,5 +29,4 @@ int main() std::vector(a, a+n/2)); assert(q.size() == n); assert(q.top() == MoveOnly(8)); -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES } diff --git a/test/std/containers/container.adaptors/priority.queue/priqueue.cons/ctor_move.pass.cpp b/test/std/containers/container.adaptors/priority.queue/priqueue.cons/ctor_move.pass.cpp index aac8403e5..229ec02fc 100644 --- a/test/std/containers/container.adaptors/priority.queue/priqueue.cons/ctor_move.pass.cpp +++ b/test/std/containers/container.adaptors/priority.queue/priqueue.cons/ctor_move.pass.cpp @@ -7,6 +7,8 @@ // //===----------------------------------------------------------------------===// +// UNSUPPORTED: c++98, c++03 + // // priority_queue(priority_queue&& q); @@ -16,7 +18,6 @@ #include "MoveOnly.h" -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES template C @@ -28,14 +29,11 @@ make(int n) return c; } -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES int main() { -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES std::priority_queue qo(std::less(), make >(5)); std::priority_queue q = std::move(qo); assert(q.size() == 5); assert(q.top() == MoveOnly(4)); -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES } diff --git a/test/std/containers/container.adaptors/priority.queue/priqueue.cons/default_noexcept.pass.cpp b/test/std/containers/container.adaptors/priority.queue/priqueue.cons/default_noexcept.pass.cpp index 5dec2b910..e0547d64a 100644 --- a/test/std/containers/container.adaptors/priority.queue/priqueue.cons/default_noexcept.pass.cpp +++ b/test/std/containers/container.adaptors/priority.queue/priqueue.cons/default_noexcept.pass.cpp @@ -7,6 +7,8 @@ // //===----------------------------------------------------------------------===// +// UNSUPPORTED: c++98, c++03 + // // priority_queue() @@ -15,7 +17,6 @@ // This tests a conforming extension -// UNSUPPORTED: c++98, c++03 #include #include @@ -30,5 +31,5 @@ int main() typedef std::priority_queue C; static_assert(std::is_nothrow_default_constructible::value, ""); } -#endif // _LIBCPP_VERSION +#endif } diff --git a/test/std/containers/container.adaptors/priority.queue/priqueue.cons/move_noexcept.pass.cpp b/test/std/containers/container.adaptors/priority.queue/priqueue.cons/move_noexcept.pass.cpp index 021899267..9c2058d47 100644 --- a/test/std/containers/container.adaptors/priority.queue/priqueue.cons/move_noexcept.pass.cpp +++ b/test/std/containers/container.adaptors/priority.queue/priqueue.cons/move_noexcept.pass.cpp @@ -7,6 +7,8 @@ // //===----------------------------------------------------------------------===// +// UNSUPPORTED: c++98, c++03 + // // priority_queue(priority_queue&&) @@ -15,8 +17,6 @@ // This tests a conforming extension -// UNSUPPORTED: c++98, c++03 - #include #include diff --git a/test/std/containers/container.adaptors/priority.queue/priqueue.members/emplace.pass.cpp b/test/std/containers/container.adaptors/priority.queue/priqueue.members/emplace.pass.cpp index 4f14e93f5..be928fc2e 100644 --- a/test/std/containers/container.adaptors/priority.queue/priqueue.members/emplace.pass.cpp +++ b/test/std/containers/container.adaptors/priority.queue/priqueue.members/emplace.pass.cpp @@ -7,6 +7,8 @@ // //===----------------------------------------------------------------------===// +// UNSUPPORTED: c++98, c++03 + // // priority_queue(); @@ -20,7 +22,6 @@ int main() { -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES std::priority_queue q; q.emplace(1, 2.5); assert(q.top() == Emplaceable(1, 2.5)); @@ -28,5 +29,4 @@ int main() assert(q.top() == Emplaceable(3, 4.5)); q.emplace(2, 3.5); assert(q.top() == Emplaceable(3, 4.5)); -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES } diff --git a/test/std/containers/container.adaptors/priority.queue/priqueue.members/push_rvalue.pass.cpp b/test/std/containers/container.adaptors/priority.queue/priqueue.members/push_rvalue.pass.cpp index 4b20a9bf9..7f4827267 100644 --- a/test/std/containers/container.adaptors/priority.queue/priqueue.members/push_rvalue.pass.cpp +++ b/test/std/containers/container.adaptors/priority.queue/priqueue.members/push_rvalue.pass.cpp @@ -7,6 +7,8 @@ // //===----------------------------------------------------------------------===// +// UNSUPPORTED: c++98, c++03 + // // priority_queue(); @@ -20,7 +22,6 @@ int main() { -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES std::priority_queue q; q.push(1); assert(q.top() == 1); @@ -28,5 +29,4 @@ int main() assert(q.top() == 3); q.push(2); assert(q.top() == 3); -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES } diff --git a/test/std/containers/container.adaptors/queue/queue.cons.alloc/ctor_alloc.pass.cpp b/test/std/containers/container.adaptors/queue/queue.cons.alloc/ctor_alloc.pass.cpp index b3ee75818..404db1240 100644 --- a/test/std/containers/container.adaptors/queue/queue.cons.alloc/ctor_alloc.pass.cpp +++ b/test/std/containers/container.adaptors/queue/queue.cons.alloc/ctor_alloc.pass.cpp @@ -15,6 +15,7 @@ #include #include +#include "test_macros.h" #include "test_allocator.h" struct test @@ -24,10 +25,10 @@ struct test explicit test(const test_allocator& a) : base(a) {} test(const container_type& c, const test_allocator& a) : base(c, a) {} -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES +#if TEST_STD_VER >= 11 test(container_type&& c, const test_allocator& a) : base(std::move(c), a) {} test(test&& q, const test_allocator& a) : base(std::move(q), a) {} -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES +#endif test_allocator get_allocator() {return c.get_allocator();} }; diff --git a/test/std/containers/container.adaptors/queue/queue.cons.alloc/ctor_container_alloc.pass.cpp b/test/std/containers/container.adaptors/queue/queue.cons.alloc/ctor_container_alloc.pass.cpp index e4fff91f0..06a53fe38 100644 --- a/test/std/containers/container.adaptors/queue/queue.cons.alloc/ctor_container_alloc.pass.cpp +++ b/test/std/containers/container.adaptors/queue/queue.cons.alloc/ctor_container_alloc.pass.cpp @@ -16,6 +16,7 @@ #include #include +#include "test_macros.h" #include "test_allocator.h" template @@ -37,10 +38,10 @@ struct test explicit test(const test_allocator& a) : base(a) {} test(const container_type& c, const test_allocator& a) : base(c, a) {} -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES +#if TEST_STD_VER >= 11 test(container_type&& c, const test_allocator& a) : base(std::move(c), a) {} test(test&& q, const test_allocator& a) : base(std::move(q), a) {} -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES +#endif test_allocator get_allocator() {return c.get_allocator();} }; diff --git a/test/std/containers/container.adaptors/queue/queue.cons.alloc/ctor_rcontainer_alloc.pass.cpp b/test/std/containers/container.adaptors/queue/queue.cons.alloc/ctor_rcontainer_alloc.pass.cpp index 0163588ef..243585693 100644 --- a/test/std/containers/container.adaptors/queue/queue.cons.alloc/ctor_rcontainer_alloc.pass.cpp +++ b/test/std/containers/container.adaptors/queue/queue.cons.alloc/ctor_rcontainer_alloc.pass.cpp @@ -7,6 +7,8 @@ // //===----------------------------------------------------------------------===// +// UNSUPPORTED: c++98, c++03 + // // template @@ -18,7 +20,6 @@ #include "test_allocator.h" #include "MoveOnly.h" -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES template C @@ -47,13 +48,10 @@ struct test allocator_type get_allocator() {return this->c.get_allocator();} }; -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES int main() { -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES test q(make(5), test_allocator(4)); assert(q.get_allocator() == test_allocator(4)); assert(q.size() == 5); -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES } diff --git a/test/std/containers/container.adaptors/queue/queue.cons.alloc/ctor_rqueue_alloc.pass.cpp b/test/std/containers/container.adaptors/queue/queue.cons.alloc/ctor_rqueue_alloc.pass.cpp index 7237bf271..76428e33f 100644 --- a/test/std/containers/container.adaptors/queue/queue.cons.alloc/ctor_rqueue_alloc.pass.cpp +++ b/test/std/containers/container.adaptors/queue/queue.cons.alloc/ctor_rqueue_alloc.pass.cpp @@ -7,6 +7,8 @@ // //===----------------------------------------------------------------------===// +// UNSUPPORTED: c++98, c++03 + // // template @@ -18,7 +20,6 @@ #include "test_allocator.h" #include "MoveOnly.h" -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES template C @@ -47,14 +48,11 @@ struct test allocator_type get_allocator() {return this->c.get_allocator();} }; -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES int main() { -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES test q(make(5), test_allocator(4)); test q2(std::move(q), test_allocator(5)); assert(q2.get_allocator() == test_allocator(5)); assert(q2.size() == 5); -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES } diff --git a/test/std/containers/container.adaptors/queue/queue.cons/ctor_move.pass.cpp b/test/std/containers/container.adaptors/queue/queue.cons/ctor_move.pass.cpp index 8dd5d2f64..57e22963e 100644 --- a/test/std/containers/container.adaptors/queue/queue.cons/ctor_move.pass.cpp +++ b/test/std/containers/container.adaptors/queue/queue.cons/ctor_move.pass.cpp @@ -7,6 +7,8 @@ // //===----------------------------------------------------------------------===// +// UNSUPPORTED: c++98, c++03 + // // queue(queue&& q); @@ -16,7 +18,6 @@ #include "MoveOnly.h" -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES template C @@ -28,14 +29,11 @@ make(int n) return c; } -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES int main() { -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES std::queue q(make >(5)); std::queue q2 = std::move(q); assert(q2.size() == 5); assert(q.empty()); -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES } diff --git a/test/std/containers/container.adaptors/queue/queue.cons/ctor_rcontainer.pass.cpp b/test/std/containers/container.adaptors/queue/queue.cons/ctor_rcontainer.pass.cpp index f72067b0a..1b3f25608 100644 --- a/test/std/containers/container.adaptors/queue/queue.cons/ctor_rcontainer.pass.cpp +++ b/test/std/containers/container.adaptors/queue/queue.cons/ctor_rcontainer.pass.cpp @@ -7,6 +7,8 @@ // //===----------------------------------------------------------------------===// +// UNSUPPORTED: c++98, c++03 + // // explicit queue(container_type&& c); @@ -16,7 +18,6 @@ #include "MoveOnly.h" -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES template C @@ -28,12 +29,9 @@ make(int n) return c; } -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES int main() { -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES std::queue q(make >(5)); assert(q.size() == 5); -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES } diff --git a/test/std/containers/container.adaptors/queue/queue.cons/default_noexcept.pass.cpp b/test/std/containers/container.adaptors/queue/queue.cons/default_noexcept.pass.cpp index 781d74016..7518bcc71 100644 --- a/test/std/containers/container.adaptors/queue/queue.cons/default_noexcept.pass.cpp +++ b/test/std/containers/container.adaptors/queue/queue.cons/default_noexcept.pass.cpp @@ -7,6 +7,8 @@ // //===----------------------------------------------------------------------===// +// UNSUPPORTED: c++98, c++03 + // // queue() @@ -14,8 +16,6 @@ // This tests a conforming extension -// UNSUPPORTED: c++98, c++03 - #include #include @@ -29,5 +29,5 @@ int main() typedef std::queue C; static_assert(std::is_nothrow_default_constructible::value, ""); } -#endif // _LIBCPP_VERSION +#endif } diff --git a/test/std/containers/container.adaptors/queue/queue.cons/move_noexcept.pass.cpp b/test/std/containers/container.adaptors/queue/queue.cons/move_noexcept.pass.cpp index 58c8f9ddf..a89fbef8b 100644 --- a/test/std/containers/container.adaptors/queue/queue.cons/move_noexcept.pass.cpp +++ b/test/std/containers/container.adaptors/queue/queue.cons/move_noexcept.pass.cpp @@ -7,6 +7,8 @@ // //===----------------------------------------------------------------------===// +// UNSUPPORTED: c++98, c++03 + // // queue(queue&&) @@ -14,7 +16,6 @@ // This tests a conforming extension -// UNSUPPORTED: c++98, c++03 #include #include @@ -29,5 +30,5 @@ int main() typedef std::queue C; static_assert(std::is_nothrow_move_constructible::value, ""); } -#endif // _LIBCPP_VERSION +#endif } diff --git a/test/std/containers/container.adaptors/queue/queue.defn/assign_move.pass.cpp b/test/std/containers/container.adaptors/queue/queue.defn/assign_move.pass.cpp index af1b7e20c..0932b7d99 100644 --- a/test/std/containers/container.adaptors/queue/queue.defn/assign_move.pass.cpp +++ b/test/std/containers/container.adaptors/queue/queue.defn/assign_move.pass.cpp @@ -7,6 +7,8 @@ // //===----------------------------------------------------------------------===// +// UNSUPPORTED: c++98, c++03 + // // queue& operator=(queue&& q); @@ -16,7 +18,6 @@ #include "MoveOnly.h" -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES template C @@ -28,15 +29,12 @@ make(int n) return c; } -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES int main() { -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES std::queue q(make >(5)); std::queue q2; q2 = std::move(q); assert(q2.size() == 5); assert(q.empty()); -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES } diff --git a/test/std/containers/container.adaptors/queue/queue.defn/push_rv.pass.cpp b/test/std/containers/container.adaptors/queue/queue.defn/push_rv.pass.cpp index d8992821f..2e0a19a7f 100644 --- a/test/std/containers/container.adaptors/queue/queue.defn/push_rv.pass.cpp +++ b/test/std/containers/container.adaptors/queue/queue.defn/push_rv.pass.cpp @@ -7,6 +7,8 @@ // //===----------------------------------------------------------------------===// +// UNSUPPORTED: c++98, c++03 + // // void push(value_type&& v); @@ -18,7 +20,6 @@ int main() { -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES std::queue q; q.push(MoveOnly(1)); assert(q.size() == 1); @@ -32,5 +33,4 @@ int main() assert(q.size() == 3); assert(q.front() == MoveOnly(1)); assert(q.back() == MoveOnly(3)); -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES } diff --git a/test/std/containers/container.adaptors/stack/stack.cons.alloc/ctor_alloc.pass.cpp b/test/std/containers/container.adaptors/stack/stack.cons.alloc/ctor_alloc.pass.cpp index 94899d4f1..bac8378eb 100644 --- a/test/std/containers/container.adaptors/stack/stack.cons.alloc/ctor_alloc.pass.cpp +++ b/test/std/containers/container.adaptors/stack/stack.cons.alloc/ctor_alloc.pass.cpp @@ -15,6 +15,7 @@ #include #include +#include "test_macros.h" #include "test_allocator.h" struct test @@ -24,10 +25,10 @@ struct test explicit test(const test_allocator& a) : base(a) {} test(const container_type& c, const test_allocator& a) : base(c, a) {} -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES +#if TEST_STD_VER >= 11 test(container_type&& c, const test_allocator& a) : base(std::move(c), a) {} test(test&& q, const test_allocator& a) : base(std::move(q), a) {} -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES +#endif test_allocator get_allocator() {return c.get_allocator();} }; diff --git a/test/std/containers/container.adaptors/stack/stack.cons.alloc/ctor_container_alloc.pass.cpp b/test/std/containers/container.adaptors/stack/stack.cons.alloc/ctor_container_alloc.pass.cpp index b3cf39207..237870b2c 100644 --- a/test/std/containers/container.adaptors/stack/stack.cons.alloc/ctor_container_alloc.pass.cpp +++ b/test/std/containers/container.adaptors/stack/stack.cons.alloc/ctor_container_alloc.pass.cpp @@ -16,6 +16,7 @@ #include #include +#include "test_macros.h" #include "test_allocator.h" template @@ -37,10 +38,10 @@ struct test explicit test(const test_allocator& a) : base(a) {} test(const container_type& c, const test_allocator& a) : base(c, a) {} -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES +#if TEST_STD_VER >= 11 test(container_type&& c, const test_allocator& a) : base(std::move(c), a) {} test(test&& q, const test_allocator& a) : base(std::move(q), a) {} -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES +#endif test_allocator get_allocator() {return c.get_allocator();} }; diff --git a/test/std/containers/container.adaptors/stack/stack.cons.alloc/ctor_rcontainer_alloc.pass.cpp b/test/std/containers/container.adaptors/stack/stack.cons.alloc/ctor_rcontainer_alloc.pass.cpp index 374aa996f..b0da1ef8b 100644 --- a/test/std/containers/container.adaptors/stack/stack.cons.alloc/ctor_rcontainer_alloc.pass.cpp +++ b/test/std/containers/container.adaptors/stack/stack.cons.alloc/ctor_rcontainer_alloc.pass.cpp @@ -7,6 +7,8 @@ // //===----------------------------------------------------------------------===// +// UNSUPPORTED: c++98, c++03 + // // template @@ -18,7 +20,6 @@ #include "test_allocator.h" #include "MoveOnly.h" -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES template C @@ -47,13 +48,10 @@ struct test allocator_type get_allocator() {return this->c.get_allocator();} }; -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES int main() { -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES test q(make(5), test_allocator(4)); assert(q.get_allocator() == test_allocator(4)); assert(q.size() == 5); -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES } diff --git a/test/std/containers/container.adaptors/stack/stack.cons.alloc/ctor_rqueue_alloc.pass.cpp b/test/std/containers/container.adaptors/stack/stack.cons.alloc/ctor_rqueue_alloc.pass.cpp index 5fa5bd2a8..e75a8a267 100644 --- a/test/std/containers/container.adaptors/stack/stack.cons.alloc/ctor_rqueue_alloc.pass.cpp +++ b/test/std/containers/container.adaptors/stack/stack.cons.alloc/ctor_rqueue_alloc.pass.cpp @@ -7,6 +7,8 @@ // //===----------------------------------------------------------------------===// +// UNSUPPORTED: c++98, c++03 + // // template @@ -18,7 +20,6 @@ #include "test_allocator.h" #include "MoveOnly.h" -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES template C @@ -47,14 +48,11 @@ struct test allocator_type get_allocator() {return this->c.get_allocator();} }; -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES int main() { -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES test q(make(5), test_allocator(4)); test q2(std::move(q), test_allocator(5)); assert(q2.get_allocator() == test_allocator(5)); assert(q2.size() == 5); -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES } diff --git a/test/std/containers/container.adaptors/stack/stack.cons/ctor_move.pass.cpp b/test/std/containers/container.adaptors/stack/stack.cons/ctor_move.pass.cpp index 44fab41a6..d837e3d65 100644 --- a/test/std/containers/container.adaptors/stack/stack.cons/ctor_move.pass.cpp +++ b/test/std/containers/container.adaptors/stack/stack.cons/ctor_move.pass.cpp @@ -7,6 +7,8 @@ // //===----------------------------------------------------------------------===// +// UNSUPPORTED: c++98, c++03 + // // stack(stack&& q); @@ -16,7 +18,6 @@ #include "MoveOnly.h" -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES template C @@ -28,14 +29,11 @@ make(int n) return c; } -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES int main() { -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES std::stack q(make >(5)); std::stack q2 = std::move(q); assert(q2.size() == 5); assert(q.empty()); -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES } diff --git a/test/std/containers/container.adaptors/stack/stack.cons/ctor_rcontainer.pass.cpp b/test/std/containers/container.adaptors/stack/stack.cons/ctor_rcontainer.pass.cpp index ab08da938..01d467460 100644 --- a/test/std/containers/container.adaptors/stack/stack.cons/ctor_rcontainer.pass.cpp +++ b/test/std/containers/container.adaptors/stack/stack.cons/ctor_rcontainer.pass.cpp @@ -7,6 +7,8 @@ // //===----------------------------------------------------------------------===// +// UNSUPPORTED: c++98, c++03 + // // explicit stack(container_type&& c); @@ -16,7 +18,6 @@ #include "MoveOnly.h" -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES template C @@ -28,12 +29,9 @@ make(int n) return c; } -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES int main() { -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES std::stack q(make >(5)); assert(q.size() == 5); -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES } diff --git a/test/std/containers/container.adaptors/stack/stack.cons/default_noexcept.pass.cpp b/test/std/containers/container.adaptors/stack/stack.cons/default_noexcept.pass.cpp index 2e217c545..03c709ef6 100644 --- a/test/std/containers/container.adaptors/stack/stack.cons/default_noexcept.pass.cpp +++ b/test/std/containers/container.adaptors/stack/stack.cons/default_noexcept.pass.cpp @@ -7,6 +7,8 @@ // //===----------------------------------------------------------------------===// +// UNSUPPORTED: c++98, c++03 + // // stack() @@ -14,7 +16,6 @@ // This tests a conforming extension -// UNSUPPORTED: c++98, c++03 #include #include @@ -29,5 +30,5 @@ int main() typedef std::stack C; static_assert(std::is_nothrow_default_constructible::value, ""); } -#endif // _LIBCPP_VERSION +#endif } diff --git a/test/std/containers/container.adaptors/stack/stack.cons/move_noexcept.pass.cpp b/test/std/containers/container.adaptors/stack/stack.cons/move_noexcept.pass.cpp index af6793f46..92aef08ba 100644 --- a/test/std/containers/container.adaptors/stack/stack.cons/move_noexcept.pass.cpp +++ b/test/std/containers/container.adaptors/stack/stack.cons/move_noexcept.pass.cpp @@ -7,6 +7,8 @@ // //===----------------------------------------------------------------------===// +// UNSUPPORTED: c++98, c++03 + // // stack(stack&&) @@ -14,8 +16,6 @@ // This tests a conforming extension -// UNSUPPORTED: c++98, c++03 - #include #include @@ -29,5 +29,5 @@ int main() typedef std::stack C; static_assert(std::is_nothrow_move_constructible::value, ""); } -#endif // _LIBCPP_VERSION +#endif } diff --git a/test/std/containers/container.adaptors/stack/stack.defn/assign_move.pass.cpp b/test/std/containers/container.adaptors/stack/stack.defn/assign_move.pass.cpp index 75cbec1c4..cbb63462a 100644 --- a/test/std/containers/container.adaptors/stack/stack.defn/assign_move.pass.cpp +++ b/test/std/containers/container.adaptors/stack/stack.defn/assign_move.pass.cpp @@ -7,6 +7,8 @@ // //===----------------------------------------------------------------------===// +// UNSUPPORTED: c++98, c++03 + // // stack& operator=(stack&& q); @@ -16,7 +18,6 @@ #include "MoveOnly.h" -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES template C @@ -28,15 +29,12 @@ make(int n) return c; } -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES int main() { -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES std::stack q(make >(5)); std::stack q2; q2 = std::move(q); assert(q2.size() == 5); assert(q.empty()); -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES } diff --git a/test/std/containers/container.adaptors/stack/stack.defn/push_rv.pass.cpp b/test/std/containers/container.adaptors/stack/stack.defn/push_rv.pass.cpp index 67d0ea338..9165f6ecc 100644 --- a/test/std/containers/container.adaptors/stack/stack.defn/push_rv.pass.cpp +++ b/test/std/containers/container.adaptors/stack/stack.defn/push_rv.pass.cpp @@ -7,6 +7,8 @@ // //===----------------------------------------------------------------------===// +// UNSUPPORTED: c++98, c++03 + // // void push(value_type&& v); @@ -18,7 +20,6 @@ int main() { -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES std::stack q; q.push(MoveOnly(1)); assert(q.size() == 1); @@ -29,5 +30,4 @@ int main() q.push(MoveOnly(3)); assert(q.size() == 3); assert(q.top() == MoveOnly(3)); -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES } 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 a833fdc04..2fe535512 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,8 @@ #include #include +#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" @@ -36,7 +38,7 @@ int main() assert(c.max_size() == 0); assert(c.empty()); } -#ifndef _LIBCPP_HAS_NO_CONSTEXPR +#if TEST_STD_VER >= 11 { typedef double T; typedef std::array C; diff --git a/test/std/containers/sequences/deque/deque.cons/assign_initializer_list.pass.cpp b/test/std/containers/sequences/deque/deque.cons/assign_initializer_list.pass.cpp index dea6492a5..fdb751da6 100644 --- a/test/std/containers/sequences/deque/deque.cons/assign_initializer_list.pass.cpp +++ b/test/std/containers/sequences/deque/deque.cons/assign_initializer_list.pass.cpp @@ -7,6 +7,8 @@ // //===----------------------------------------------------------------------===// +// UNSUPPORTED: c++98, c++03 + // // void assign(initializer_list il); @@ -18,7 +20,6 @@ int main() { -#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS { std::deque d; d.assign({3, 4, 5, 6}); @@ -28,7 +29,6 @@ int main() assert(d[2] == 5); assert(d[3] == 6); } -#if TEST_STD_VER >= 11 { std::deque> d; d.assign({3, 4, 5, 6}); @@ -38,6 +38,4 @@ int main() assert(d[2] == 5); assert(d[3] == 6); } -#endif -#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS } diff --git a/test/std/containers/sequences/deque/deque.cons/initializer_list.pass.cpp b/test/std/containers/sequences/deque/deque.cons/initializer_list.pass.cpp index dbf27053a..dd70cda18 100644 --- a/test/std/containers/sequences/deque/deque.cons/initializer_list.pass.cpp +++ b/test/std/containers/sequences/deque/deque.cons/initializer_list.pass.cpp @@ -7,6 +7,8 @@ // //===----------------------------------------------------------------------===// +// UNSUPPORTED: c++98, c++03 + // // deque(initializer_list il); @@ -18,7 +20,6 @@ int main() { -#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS { std::deque d = {3, 4, 5, 6}; assert(d.size() == 4); @@ -27,7 +28,6 @@ int main() assert(d[2] == 5); assert(d[3] == 6); } -#if TEST_STD_VER >= 11 { std::deque> d = {3, 4, 5, 6}; assert(d.size() == 4); @@ -36,6 +36,4 @@ int main() assert(d[2] == 5); assert(d[3] == 6); } -#endif -#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS } diff --git a/test/std/containers/sequences/deque/deque.cons/initializer_list_alloc.pass.cpp b/test/std/containers/sequences/deque/deque.cons/initializer_list_alloc.pass.cpp index 9be3c63a6..2619569e1 100644 --- a/test/std/containers/sequences/deque/deque.cons/initializer_list_alloc.pass.cpp +++ b/test/std/containers/sequences/deque/deque.cons/initializer_list_alloc.pass.cpp @@ -7,6 +7,8 @@ // //===----------------------------------------------------------------------===// +// UNSUPPORTED: c++98, c++03 + // // deque(initializer_list il, const Allocator& a = allocator_type()); @@ -19,7 +21,6 @@ int main() { -#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS { std::deque> d({3, 4, 5, 6}, test_allocator(3)); assert(d.get_allocator() == test_allocator(3)); @@ -29,7 +30,6 @@ int main() assert(d[2] == 5); assert(d[3] == 6); } -#if TEST_STD_VER >= 11 { std::deque> d({3, 4, 5, 6}, min_allocator()); assert(d.get_allocator() == min_allocator()); @@ -39,6 +39,4 @@ int main() assert(d[2] == 5); assert(d[3] == 6); } -#endif -#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS } diff --git a/test/std/containers/sequences/deque/deque.cons/move.pass.cpp b/test/std/containers/sequences/deque/deque.cons/move.pass.cpp index 68875139d..6e935a52b 100644 --- a/test/std/containers/sequences/deque/deque.cons/move.pass.cpp +++ b/test/std/containers/sequences/deque/deque.cons/move.pass.cpp @@ -7,6 +7,8 @@ // //===----------------------------------------------------------------------===// +// UNSUPPORTED: c++98, c++03 + // // deque(deque&&); @@ -20,7 +22,6 @@ int main() { -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES { int ab[] = {3, 4, 2, 8, 0, 1, 44, 34, 45, 96, 80, 1, 13, 31, 45}; int* an = ab + sizeof(ab)/sizeof(ab[0]); @@ -51,7 +52,6 @@ int main() assert(c1.size() == 0); assert(c3.get_allocator() == c1.get_allocator()); } -#if TEST_STD_VER >= 11 { int ab[] = {3, 4, 2, 8, 0, 1, 44, 34, 45, 96, 80, 1, 13, 31, 45}; int* an = ab + sizeof(ab)/sizeof(ab[0]); @@ -67,6 +67,4 @@ int main() assert(c1.size() == 0); assert(c3.get_allocator() == c1.get_allocator()); } -#endif -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES } diff --git a/test/std/containers/sequences/deque/deque.cons/move_alloc.pass.cpp b/test/std/containers/sequences/deque/deque.cons/move_alloc.pass.cpp index 4aa0fa682..5a9a77c74 100644 --- a/test/std/containers/sequences/deque/deque.cons/move_alloc.pass.cpp +++ b/test/std/containers/sequences/deque/deque.cons/move_alloc.pass.cpp @@ -7,6 +7,8 @@ // //===----------------------------------------------------------------------===// +// UNSUPPORTED: c++98, c++03 + // // deque(deque&& c, const allocator_type& a); @@ -20,7 +22,6 @@ int main() { -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES { int ab[] = {3, 4, 2, 8, 0, 1, 44, 34, 45, 96, 80, 1, 13, 31, 45}; int* an = ab + sizeof(ab)/sizeof(ab[0]); @@ -66,7 +67,6 @@ int main() assert(c3.get_allocator() == A(3)); assert(c1.size() != 0); } -#if TEST_STD_VER >= 11 { int ab[] = {3, 4, 2, 8, 0, 1, 44, 34, 45, 96, 80, 1, 13, 31, 45}; int* an = ab + sizeof(ab)/sizeof(ab[0]); @@ -82,6 +82,4 @@ int main() assert(c3.get_allocator() == A()); assert(c1.size() == 0); } -#endif -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES } diff --git a/test/std/containers/sequences/deque/deque.cons/move_assign.pass.cpp b/test/std/containers/sequences/deque/deque.cons/move_assign.pass.cpp index ed8f1544b..8a65bc2d2 100644 --- a/test/std/containers/sequences/deque/deque.cons/move_assign.pass.cpp +++ b/test/std/containers/sequences/deque/deque.cons/move_assign.pass.cpp @@ -7,6 +7,8 @@ // //===----------------------------------------------------------------------===// +// UNSUPPORTED: c++98, c++03 + // // deque& operator=(deque&& c); @@ -20,7 +22,6 @@ int main() { -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES { int ab[] = {3, 4, 2, 8, 0, 1, 44, 34, 45, 96, 80, 1, 13, 31, 45}; int* an = ab + sizeof(ab)/sizeof(ab[0]); @@ -69,7 +70,6 @@ int main() assert(c1.size() == 0); assert(c3.get_allocator() == A(5)); } -#if TEST_STD_VER >= 11 { int ab[] = {3, 4, 2, 8, 0, 1, 44, 34, 45, 96, 80, 1, 13, 31, 45}; int* an = ab + sizeof(ab)/sizeof(ab[0]); @@ -86,6 +86,4 @@ int main() assert(c1.size() == 0); assert(c3.get_allocator() == A()); } -#endif -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES } diff --git a/test/std/containers/sequences/deque/deque.cons/op_equal_initializer_list.pass.cpp b/test/std/containers/sequences/deque/deque.cons/op_equal_initializer_list.pass.cpp index 597f642db..117e94289 100644 --- a/test/std/containers/sequences/deque/deque.cons/op_equal_initializer_list.pass.cpp +++ b/test/std/containers/sequences/deque/deque.cons/op_equal_initializer_list.pass.cpp @@ -7,6 +7,8 @@ // //===----------------------------------------------------------------------===// +// UNSUPPORTED: c++98, c++03 + // // deque& operator=(initializer_list il); @@ -18,7 +20,6 @@ int main() { -#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS { std::deque d; d = {3, 4, 5, 6}; @@ -28,7 +29,6 @@ int main() assert(d[2] == 5); assert(d[3] == 6); } -#if TEST_STD_VER >= 11 { std::deque> d; d = {3, 4, 5, 6}; @@ -38,6 +38,4 @@ int main() assert(d[2] == 5); assert(d[3] == 6); } -#endif -#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS } diff --git a/test/std/containers/sequences/deque/deque.modifiers/insert_iter_initializer_list.pass.cpp b/test/std/containers/sequences/deque/deque.modifiers/insert_iter_initializer_list.pass.cpp index 5f7804023..6d33424fe 100644 --- a/test/std/containers/sequences/deque/deque.modifiers/insert_iter_initializer_list.pass.cpp +++ b/test/std/containers/sequences/deque/deque.modifiers/insert_iter_initializer_list.pass.cpp @@ -7,6 +7,8 @@ // //===----------------------------------------------------------------------===// +// UNSUPPORTED: c++98, c++03 + // // iterator insert(const_iterator p, initializer_list il); @@ -18,7 +20,6 @@ int main() { -#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS { std::deque d(10, 1); std::deque::iterator i = d.insert(d.cbegin() + 2, {3, 4, 5, 6}); @@ -59,5 +60,4 @@ int main() assert(d[12] == 1); assert(d[13] == 1); } -#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS } diff --git a/test/std/containers/sequences/deque/deque.modifiers/push_back_rvalue.pass.cpp b/test/std/containers/sequences/deque/deque.modifiers/push_back_rvalue.pass.cpp index b5c881064..060d83b5e 100644 --- a/test/std/containers/sequences/deque/deque.modifiers/push_back_rvalue.pass.cpp +++ b/test/std/containers/sequences/deque/deque.modifiers/push_back_rvalue.pass.cpp @@ -7,6 +7,8 @@ // //===----------------------------------------------------------------------===// +// UNSUPPORTED: c++98, c++03 + // // void push_back(value_type&& v); @@ -19,7 +21,6 @@ #include "MoveOnly.h" #include "min_allocator.h" -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES template C @@ -57,24 +58,19 @@ void test(int size) } } -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES int main() { -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES { int rng[] = {0, 1, 2, 3, 1023, 1024, 1025, 2046, 2047, 2048, 2049, 4094, 4095, 4096}; const int N = sizeof(rng)/sizeof(rng[0]); for (int j = 0; j < N; ++j) test >(rng[j]); } -#if TEST_STD_VER >= 11 { int rng[] = {0, 1, 2, 3, 1023, 1024, 1025, 2046, 2047, 2048, 2049, 4094, 4095, 4096}; const int N = sizeof(rng)/sizeof(rng[0]); for (int j = 0; j < N; ++j) test> >(rng[j]); } -#endif -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES } diff --git a/test/std/containers/sequences/deque/deque.modifiers/push_front_rvalue.pass.cpp b/test/std/containers/sequences/deque/deque.modifiers/push_front_rvalue.pass.cpp index 8e734a639..df3d2d099 100644 --- a/test/std/containers/sequences/deque/deque.modifiers/push_front_rvalue.pass.cpp +++ b/test/std/containers/sequences/deque/deque.modifiers/push_front_rvalue.pass.cpp @@ -7,6 +7,8 @@ // //===----------------------------------------------------------------------===// +// UNSUPPORTED: c++98, c++03 + // // void push_front(value_type&& v); @@ -18,7 +20,6 @@ #include "MoveOnly.h" #include "min_allocator.h" -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES template C @@ -66,11 +67,9 @@ testN(int start, int N) test(c1, -10); } -#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]); @@ -78,7 +77,6 @@ int main() for (int j = 0; j < N; ++j) testN >(rng[i], rng[j]); } -#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]); @@ -86,6 +84,4 @@ int main() for (int j = 0; j < N; ++j) testN> >(rng[i], rng[j]); } -#endif -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES } diff --git a/test/std/containers/sequences/forwardlist/forwardlist.cons/assign_init.pass.cpp b/test/std/containers/sequences/forwardlist/forwardlist.cons/assign_init.pass.cpp index d4dda02b8..69fb6eb4c 100644 --- a/test/std/containers/sequences/forwardlist/forwardlist.cons/assign_init.pass.cpp +++ b/test/std/containers/sequences/forwardlist/forwardlist.cons/assign_init.pass.cpp @@ -7,6 +7,8 @@ // //===----------------------------------------------------------------------===// +// UNSUPPORTED: c++98, c++03 + // // void assign(initializer_list il); @@ -19,7 +21,6 @@ int main() { -#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS { typedef int T; typedef std::forward_list C; @@ -42,7 +43,6 @@ int main() assert(*i == 10+n); assert(n == 4); } -#if TEST_STD_VER >= 11 { typedef int T; typedef std::forward_list> C; @@ -65,6 +65,4 @@ int main() assert(*i == 10+n); assert(n == 4); } -#endif -#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS } diff --git a/test/std/containers/sequences/forwardlist/forwardlist.cons/assign_move.pass.cpp b/test/std/containers/sequences/forwardlist/forwardlist.cons/assign_move.pass.cpp index 935284831..61118353d 100644 --- a/test/std/containers/sequences/forwardlist/forwardlist.cons/assign_move.pass.cpp +++ b/test/std/containers/sequences/forwardlist/forwardlist.cons/assign_move.pass.cpp @@ -7,6 +7,8 @@ // //===----------------------------------------------------------------------===// +// UNSUPPORTED: c++98, c++03 + // // forward_list& operator=(forward_list&& x); @@ -21,7 +23,6 @@ int main() { -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES { typedef MoveOnly T; typedef test_allocator A; @@ -159,7 +160,6 @@ int main() assert(c1.get_allocator() == A(10)); assert(c0.empty()); } -#if TEST_STD_VER >= 11 { typedef MoveOnly T; typedef min_allocator A; @@ -194,6 +194,4 @@ int main() assert(c1.get_allocator() == A()); assert(c0.empty()); } -#endif -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES } diff --git a/test/std/containers/sequences/forwardlist/forwardlist.cons/assign_op_init.pass.cpp b/test/std/containers/sequences/forwardlist/forwardlist.cons/assign_op_init.pass.cpp index 3d35916cc..84f1eb996 100644 --- a/test/std/containers/sequences/forwardlist/forwardlist.cons/assign_op_init.pass.cpp +++ b/test/std/containers/sequences/forwardlist/forwardlist.cons/assign_op_init.pass.cpp @@ -7,6 +7,8 @@ // //===----------------------------------------------------------------------===// +// UNSUPPORTED: c++98, c++03 + // // forward_list& operator=(initializer_list il); @@ -19,7 +21,6 @@ int main() { -#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS { typedef int T; typedef std::forward_list C; @@ -42,7 +43,6 @@ int main() assert(*i == 10+n); assert(n == 4); } -#if TEST_STD_VER >= 11 { typedef int T; typedef std::forward_list> C; @@ -65,6 +65,4 @@ int main() assert(*i == 10+n); assert(n == 4); } -#endif -#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS } diff --git a/test/std/containers/sequences/forwardlist/forwardlist.cons/init.pass.cpp b/test/std/containers/sequences/forwardlist/forwardlist.cons/init.pass.cpp index ac73d142a..7575c0e81 100644 --- a/test/std/containers/sequences/forwardlist/forwardlist.cons/init.pass.cpp +++ b/test/std/containers/sequences/forwardlist/forwardlist.cons/init.pass.cpp @@ -7,6 +7,8 @@ // //===----------------------------------------------------------------------===// +// UNSUPPORTED: c++98, c++03 + // // forward_list(initializer_list il); @@ -18,7 +20,6 @@ int main() { -#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS { typedef int T; typedef std::forward_list C; @@ -28,7 +29,6 @@ int main() assert(*i == n); assert(n == 10); } -#if TEST_STD_VER >= 11 { typedef int T; typedef std::forward_list> C; @@ -38,6 +38,4 @@ int main() assert(*i == n); assert(n == 10); } -#endif -#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS } diff --git a/test/std/containers/sequences/forwardlist/forwardlist.cons/init_alloc.pass.cpp b/test/std/containers/sequences/forwardlist/forwardlist.cons/init_alloc.pass.cpp index 844be2001..cf9cbffa7 100644 --- a/test/std/containers/sequences/forwardlist/forwardlist.cons/init_alloc.pass.cpp +++ b/test/std/containers/sequences/forwardlist/forwardlist.cons/init_alloc.pass.cpp @@ -7,6 +7,8 @@ // //===----------------------------------------------------------------------===// +// UNSUPPORTED: c++98, c++03 + // // forward_list(initializer_list il, const allocator_type& a); @@ -19,7 +21,6 @@ int main() { -#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS { typedef int T; typedef test_allocator A; @@ -31,7 +32,6 @@ int main() assert(n == 10); assert(c.get_allocator() == A(14)); } -#if TEST_STD_VER >= 11 { typedef int T; typedef min_allocator A; @@ -43,6 +43,4 @@ int main() assert(n == 10); assert(c.get_allocator() == A()); } -#endif -#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS } 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 a5948b9ef..92a9e39fc 100644 --- a/test/std/containers/sequences/forwardlist/forwardlist.cons/move.pass.cpp +++ b/test/std/containers/sequences/forwardlist/forwardlist.cons/move.pass.cpp @@ -7,6 +7,8 @@ // //===----------------------------------------------------------------------===// +// UNSUPPORTED: c++98, c++03 + // // forward_list(forward_list&& x); @@ -21,7 +23,6 @@ int main() { -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES { typedef MoveOnly T; typedef test_allocator A; @@ -52,7 +53,6 @@ int main() assert(c0.empty()); assert(c.get_allocator() == A(10)); } -#if TEST_STD_VER >= 11 { typedef MoveOnly T; typedef min_allocator A; @@ -68,6 +68,4 @@ int main() assert(c0.empty()); assert(c.get_allocator() == A()); } -#endif -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES } diff --git a/test/std/containers/sequences/forwardlist/forwardlist.cons/size.fail.cpp b/test/std/containers/sequences/forwardlist/forwardlist.cons/size.fail.cpp deleted file mode 100644 index 2d963a1be..000000000 --- a/test/std/containers/sequences/forwardlist/forwardlist.cons/size.fail.cpp +++ /dev/null @@ -1,35 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// - -// explicit forward_list(size_type n); - -#include -#include - -#include "DefaultOnly.h" - -int main() -{ - { - typedef DefaultOnly T; - typedef std::forward_list C; - unsigned N = 10; - C c = N; - unsigned n = 0; - for (C::const_iterator i = c.begin(), e = c.end(); i != e; ++i, ++n) -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES - assert(*i == T()); -#else - ; -#endif - assert(n == N); - } -} diff --git a/test/std/containers/sequences/forwardlist/forwardlist.cons/size.pass.cpp b/test/std/containers/sequences/forwardlist/forwardlist.cons/size.pass.cpp index b536ccf49..061dd6da0 100644 --- a/test/std/containers/sequences/forwardlist/forwardlist.cons/size.pass.cpp +++ b/test/std/containers/sequences/forwardlist/forwardlist.cons/size.pass.cpp @@ -36,6 +36,11 @@ void check_allocator(unsigned n, Allocator const &alloc = Allocator()) int main() { + { // test that the ctor is explicit + typedef std::forward_list C; + static_assert((std::is_constructible::value), ""); + static_assert((!std::is_convertible::value), ""); + } { typedef DefaultOnly T; typedef std::forward_list C; diff --git a/test/std/containers/sequences/forwardlist/forwardlist.modifiers/emplace_after.pass.cpp b/test/std/containers/sequences/forwardlist/forwardlist.modifiers/emplace_after.pass.cpp index dd8ea88c2..8d7c4e989 100644 --- a/test/std/containers/sequences/forwardlist/forwardlist.modifiers/emplace_after.pass.cpp +++ b/test/std/containers/sequences/forwardlist/forwardlist.modifiers/emplace_after.pass.cpp @@ -7,6 +7,8 @@ // //===----------------------------------------------------------------------===// +// UNSUPPORTED: c++98, c++03 + // // template @@ -20,7 +22,6 @@ int main() { -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES { typedef Emplaceable T; typedef std::forward_list C; @@ -52,7 +53,6 @@ int main() assert(*next(c.begin(), 3) == Emplaceable(2, 3.5)); assert(distance(c.begin(), c.end()) == 4); } -#if TEST_STD_VER >= 11 { typedef Emplaceable T; typedef std::forward_list> C; @@ -84,6 +84,4 @@ int main() assert(*next(c.begin(), 3) == Emplaceable(2, 3.5)); assert(distance(c.begin(), c.end()) == 4); } -#endif -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES } diff --git a/test/std/containers/sequences/forwardlist/forwardlist.modifiers/insert_after_init.pass.cpp b/test/std/containers/sequences/forwardlist/forwardlist.modifiers/insert_after_init.pass.cpp index 15e1a08b0..90ee0d231 100644 --- a/test/std/containers/sequences/forwardlist/forwardlist.modifiers/insert_after_init.pass.cpp +++ b/test/std/containers/sequences/forwardlist/forwardlist.modifiers/insert_after_init.pass.cpp @@ -7,6 +7,8 @@ // //===----------------------------------------------------------------------===// +// UNSUPPORTED: c++98, c++03 + // // iterator insert_after(const_iterator p, initializer_list il); @@ -18,7 +20,6 @@ int main() { -#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS { typedef int T; typedef std::forward_list C; @@ -44,7 +45,6 @@ int main() assert(*next(c.begin(), 3) == 1); assert(*next(c.begin(), 4) == 2); } -#if TEST_STD_VER >= 11 { typedef int T; typedef std::forward_list> C; @@ -70,6 +70,4 @@ int main() assert(*next(c.begin(), 3) == 1); assert(*next(c.begin(), 4) == 2); } -#endif -#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS } diff --git a/test/std/containers/sequences/forwardlist/forwardlist.modifiers/insert_after_rv.pass.cpp b/test/std/containers/sequences/forwardlist/forwardlist.modifiers/insert_after_rv.pass.cpp index 2e21cc79d..173ccaa62 100644 --- a/test/std/containers/sequences/forwardlist/forwardlist.modifiers/insert_after_rv.pass.cpp +++ b/test/std/containers/sequences/forwardlist/forwardlist.modifiers/insert_after_rv.pass.cpp @@ -7,6 +7,8 @@ // //===----------------------------------------------------------------------===// +// UNSUPPORTED: c++98, c++03 + // // iterator insert_after(const_iterator p, value_type&& v); @@ -19,7 +21,6 @@ int main() { -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES { typedef MoveOnly T; typedef std::forward_list C; @@ -52,7 +53,6 @@ int main() assert(*next(c.begin(), 3) == 2); assert(distance(c.begin(), c.end()) == 4); } -#if TEST_STD_VER >= 11 { typedef MoveOnly T; typedef std::forward_list> C; @@ -85,6 +85,4 @@ int main() assert(*next(c.begin(), 3) == 2); assert(distance(c.begin(), c.end()) == 4); } -#endif -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES } diff --git a/test/std/containers/sequences/forwardlist/forwardlist.modifiers/pop_front.pass.cpp b/test/std/containers/sequences/forwardlist/forwardlist.modifiers/pop_front.pass.cpp index d831ceb28..545b0e68a 100644 --- a/test/std/containers/sequences/forwardlist/forwardlist.modifiers/pop_front.pass.cpp +++ b/test/std/containers/sequences/forwardlist/forwardlist.modifiers/pop_front.pass.cpp @@ -32,7 +32,7 @@ int main() c.pop_front(); assert(distance(c.begin(), c.end()) == 0); } -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES +#if TEST_STD_VER >= 11 { typedef MoveOnly T; typedef std::forward_list C; @@ -45,8 +45,6 @@ int main() c.pop_front(); assert(distance(c.begin(), c.end()) == 0); } -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES -#if TEST_STD_VER >= 11 { typedef int T; typedef std::forward_list> C; @@ -60,7 +58,6 @@ int main() c.pop_front(); assert(distance(c.begin(), c.end()) == 0); } -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES { typedef MoveOnly T; typedef std::forward_list> C; @@ -73,6 +70,5 @@ int main() c.pop_front(); assert(distance(c.begin(), c.end()) == 0); } -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES #endif } diff --git a/test/std/containers/sequences/forwardlist/forwardlist.modifiers/push_front_rv.pass.cpp b/test/std/containers/sequences/forwardlist/forwardlist.modifiers/push_front_rv.pass.cpp index dfcd2cf90..7fc2b9d76 100644 --- a/test/std/containers/sequences/forwardlist/forwardlist.modifiers/push_front_rv.pass.cpp +++ b/test/std/containers/sequences/forwardlist/forwardlist.modifiers/push_front_rv.pass.cpp @@ -7,6 +7,8 @@ // //===----------------------------------------------------------------------===// +// UNSUPPORTED: c++98, c++03 + // // void push_front(value_type&& v); @@ -19,7 +21,6 @@ int main() { -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES { typedef MoveOnly T; typedef std::forward_list C; @@ -32,7 +33,6 @@ int main() assert(*next(c.begin()) == 1); assert(distance(c.begin(), c.end()) == 2); } -#if TEST_STD_VER >= 11 { typedef MoveOnly T; typedef std::forward_list> C; @@ -45,6 +45,4 @@ int main() assert(*next(c.begin()) == 1); assert(distance(c.begin(), c.end()) == 2); } -#endif -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES } diff --git a/test/std/containers/sequences/list/list.cons/assign_initializer_list.pass.cpp b/test/std/containers/sequences/list/list.cons/assign_initializer_list.pass.cpp index 9b2c6d68c..4704cf40a 100644 --- a/test/std/containers/sequences/list/list.cons/assign_initializer_list.pass.cpp +++ b/test/std/containers/sequences/list/list.cons/assign_initializer_list.pass.cpp @@ -7,6 +7,8 @@ // //===----------------------------------------------------------------------===// +// UNSUPPORTED: c++98, c++03 + // // void assign(initializer_list il); @@ -18,7 +20,6 @@ int main() { -#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS { std::list d; d.assign({3, 4, 5, 6}); @@ -29,7 +30,6 @@ int main() assert(*i++ == 5); assert(*i++ == 6); } -#if TEST_STD_VER >= 11 { std::list> d; d.assign({3, 4, 5, 6}); @@ -40,6 +40,4 @@ int main() assert(*i++ == 5); assert(*i++ == 6); } -#endif -#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS } diff --git a/test/std/containers/sequences/list/list.cons/assign_move.pass.cpp b/test/std/containers/sequences/list/list.cons/assign_move.pass.cpp index 2f863c616..eec214205 100644 --- a/test/std/containers/sequences/list/list.cons/assign_move.pass.cpp +++ b/test/std/containers/sequences/list/list.cons/assign_move.pass.cpp @@ -7,6 +7,8 @@ // //===----------------------------------------------------------------------===// +// UNSUPPORTED: c++98, c++03 + // // list& operator=(list&& c); @@ -19,7 +21,6 @@ int main() { -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES { std::list > l(test_allocator(5)); std::list > lo(test_allocator(5)); @@ -62,7 +63,6 @@ int main() assert(l.empty()); assert(l2.get_allocator() == lo.get_allocator()); } -#if TEST_STD_VER >= 11 { std::list > l(min_allocator{}); std::list > lo(min_allocator{}); @@ -77,6 +77,4 @@ int main() assert(l.empty()); assert(l2.get_allocator() == lo.get_allocator()); } -#endif -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES } diff --git a/test/std/containers/sequences/list/list.cons/initializer_list.pass.cpp b/test/std/containers/sequences/list/list.cons/initializer_list.pass.cpp index 40413203b..8f04e7342 100644 --- a/test/std/containers/sequences/list/list.cons/initializer_list.pass.cpp +++ b/test/std/containers/sequences/list/list.cons/initializer_list.pass.cpp @@ -7,6 +7,8 @@ // //===----------------------------------------------------------------------===// +// UNSUPPORTED: c++98, c++03 + // // list(initializer_list il); @@ -18,7 +20,6 @@ int main() { -#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS { std::list d = {3, 4, 5, 6}; assert(d.size() == 4); @@ -28,7 +29,6 @@ int main() assert(*i++ == 5); assert(*i++ == 6); } -#if TEST_STD_VER >= 11 { std::list> d = {3, 4, 5, 6}; assert(d.size() == 4); @@ -38,6 +38,4 @@ int main() assert(*i++ == 5); assert(*i++ == 6); } -#endif -#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS } diff --git a/test/std/containers/sequences/list/list.cons/initializer_list_alloc.pass.cpp b/test/std/containers/sequences/list/list.cons/initializer_list_alloc.pass.cpp index 6040c648e..3388e00df 100644 --- a/test/std/containers/sequences/list/list.cons/initializer_list_alloc.pass.cpp +++ b/test/std/containers/sequences/list/list.cons/initializer_list_alloc.pass.cpp @@ -7,6 +7,8 @@ // //===----------------------------------------------------------------------===// +// UNSUPPORTED: c++98, c++03 + // // list(initializer_list il, const Allocator& a = allocator_type()); @@ -19,7 +21,6 @@ int main() { -#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS { std::list> d({3, 4, 5, 6}, test_allocator(3)); assert(d.get_allocator() == test_allocator(3)); @@ -30,7 +31,6 @@ int main() assert(*i++ == 5); assert(*i++ == 6); } -#if TEST_STD_VER >= 11 { std::list> d({3, 4, 5, 6}, min_allocator()); assert(d.get_allocator() == min_allocator()); @@ -41,6 +41,4 @@ int main() assert(*i++ == 5); assert(*i++ == 6); } -#endif -#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS } diff --git a/test/std/containers/sequences/list/list.cons/move_alloc.pass.cpp b/test/std/containers/sequences/list/list.cons/move_alloc.pass.cpp index 9f8a536b3..7236f7cc6 100644 --- a/test/std/containers/sequences/list/list.cons/move_alloc.pass.cpp +++ b/test/std/containers/sequences/list/list.cons/move_alloc.pass.cpp @@ -7,6 +7,8 @@ // //===----------------------------------------------------------------------===// +// UNSUPPORTED: c++98, c++03 + // // list(list&& c, const allocator_type& a); @@ -19,7 +21,6 @@ int main() { -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES { std::list > l(test_allocator(5)); std::list > lo(test_allocator(5)); @@ -59,7 +60,6 @@ int main() assert(!l.empty()); assert(l2.get_allocator() == other_allocator(4)); } -#if TEST_STD_VER >= 11 { std::list > l(min_allocator{}); std::list > lo(min_allocator{}); @@ -73,6 +73,4 @@ int main() assert(l.empty()); assert(l2.get_allocator() == min_allocator()); } -#endif -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES } diff --git a/test/std/containers/sequences/list/list.cons/op_equal_initializer_list.pass.cpp b/test/std/containers/sequences/list/list.cons/op_equal_initializer_list.pass.cpp index 1097bdab2..b638e219d 100644 --- a/test/std/containers/sequences/list/list.cons/op_equal_initializer_list.pass.cpp +++ b/test/std/containers/sequences/list/list.cons/op_equal_initializer_list.pass.cpp @@ -7,6 +7,8 @@ // //===----------------------------------------------------------------------===// +// UNSUPPORTED: c++98, c++03 + // // list& operator=(initializer_list il); @@ -17,7 +19,6 @@ int main() { -#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS { std::list d; d = {3, 4, 5, 6}; @@ -28,7 +29,6 @@ int main() assert(*i++ == 5); assert(*i++ == 6); } -#if TEST_STD_VER >= 11 { std::list> d; d = {3, 4, 5, 6}; @@ -39,6 +39,4 @@ int main() assert(*i++ == 5); assert(*i++ == 6); } -#endif -#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS } diff --git a/test/std/containers/sequences/list/list.modifiers/insert_iter_initializer_list.pass.cpp b/test/std/containers/sequences/list/list.modifiers/insert_iter_initializer_list.pass.cpp index 91845e564..2d5231e78 100644 --- a/test/std/containers/sequences/list/list.modifiers/insert_iter_initializer_list.pass.cpp +++ b/test/std/containers/sequences/list/list.modifiers/insert_iter_initializer_list.pass.cpp @@ -7,6 +7,8 @@ // //===----------------------------------------------------------------------===// +// UNSUPPORTED: c++98, c++03 + // // iterator insert(const_iterator p, initializer_list il); @@ -18,7 +20,6 @@ int main() { -#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS { std::list d(10, 1); std::list::iterator i = d.insert(next(d.cbegin(), 2), {3, 4, 5, 6}); @@ -40,7 +41,6 @@ int main() assert(*i++ == 1); assert(*i++ == 1); } -#if TEST_STD_VER >= 11 { std::list> d(10, 1); std::list>::iterator i = d.insert(next(d.cbegin(), 2), {3, 4, 5, 6}); @@ -62,6 +62,4 @@ int main() assert(*i++ == 1); assert(*i++ == 1); } -#endif -#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS } diff --git a/test/std/containers/sequences/list/list.modifiers/push_back_rvalue.pass.cpp b/test/std/containers/sequences/list/list.modifiers/push_back_rvalue.pass.cpp index 10acede51..3d9d00abe 100644 --- a/test/std/containers/sequences/list/list.modifiers/push_back_rvalue.pass.cpp +++ b/test/std/containers/sequences/list/list.modifiers/push_back_rvalue.pass.cpp @@ -7,6 +7,8 @@ // //===----------------------------------------------------------------------===// +// UNSUPPORTED: c++98, c++03 + // // void push_back(value_type&& x); @@ -19,7 +21,6 @@ int main() { -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES { std::list l1; l1.push_back(MoveOnly(1)); @@ -30,7 +31,6 @@ int main() assert(l1.front() == MoveOnly(1)); assert(l1.back() == MoveOnly(2)); } -#if TEST_STD_VER >= 11 { std::list> l1; l1.push_back(MoveOnly(1)); @@ -41,6 +41,4 @@ int main() assert(l1.front() == MoveOnly(1)); assert(l1.back() == MoveOnly(2)); } -#endif -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES } diff --git a/test/std/containers/sequences/list/list.modifiers/push_front_rvalue.pass.cpp b/test/std/containers/sequences/list/list.modifiers/push_front_rvalue.pass.cpp index 5321ee0fa..6fef6ade9 100644 --- a/test/std/containers/sequences/list/list.modifiers/push_front_rvalue.pass.cpp +++ b/test/std/containers/sequences/list/list.modifiers/push_front_rvalue.pass.cpp @@ -7,6 +7,8 @@ // //===----------------------------------------------------------------------===// +// UNSUPPORTED: c++98, c++03 + // // void push_front(value_type&& x); @@ -19,7 +21,6 @@ int main() { -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES { std::list l1; l1.push_front(MoveOnly(1)); @@ -30,7 +31,6 @@ int main() assert(l1.front() == MoveOnly(2)); assert(l1.back() == MoveOnly(1)); } -#if TEST_STD_VER >= 11 { std::list> l1; l1.push_front(MoveOnly(1)); @@ -41,6 +41,4 @@ int main() assert(l1.front() == MoveOnly(2)); assert(l1.back() == MoveOnly(1)); } -#endif -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES } diff --git a/test/std/containers/sequences/vector.bool/assign_initializer_list.pass.cpp b/test/std/containers/sequences/vector.bool/assign_initializer_list.pass.cpp index ac7a2ce38..60146a88b 100644 --- a/test/std/containers/sequences/vector.bool/assign_initializer_list.pass.cpp +++ b/test/std/containers/sequences/vector.bool/assign_initializer_list.pass.cpp @@ -7,6 +7,8 @@ // //===----------------------------------------------------------------------===// +// UNSUPPORTED: c++98, c++03 + // // void assign(initializer_list il); @@ -18,7 +20,6 @@ int main() { -#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS { std::vector d; d.assign({true, false, false, true}); @@ -28,7 +29,6 @@ int main() assert(d[2] == false); assert(d[3] == true); } -#if TEST_STD_VER >= 11 { std::vector> d; d.assign({true, false, false, true}); @@ -38,6 +38,4 @@ int main() assert(d[2] == false); assert(d[3] == true); } -#endif -#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS } diff --git a/test/std/containers/sequences/vector.bool/assign_move.pass.cpp b/test/std/containers/sequences/vector.bool/assign_move.pass.cpp index f07c1d900..13cd65f33 100644 --- a/test/std/containers/sequences/vector.bool/assign_move.pass.cpp +++ b/test/std/containers/sequences/vector.bool/assign_move.pass.cpp @@ -7,6 +7,8 @@ // //===----------------------------------------------------------------------===// +// UNSUPPORTED: c++98, c++03 + // // vector& operator=(vector&& c); @@ -18,7 +20,6 @@ int main() { -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES { std::vector > l(test_allocator(5)); std::vector > lo(test_allocator(5)); @@ -61,7 +62,6 @@ int main() assert(l.empty()); assert(l2.get_allocator() == lo.get_allocator()); } -#if TEST_STD_VER >= 11 { std::vector > l(min_allocator{}); std::vector > lo(min_allocator{}); @@ -76,6 +76,4 @@ int main() assert(l.empty()); assert(l2.get_allocator() == lo.get_allocator()); } -#endif -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES } diff --git a/test/std/containers/sequences/vector.bool/emplace_back.pass.cpp b/test/std/containers/sequences/vector.bool/emplace_back.pass.cpp index 81a8ae475..c737f05fd 100644 --- a/test/std/containers/sequences/vector.bool/emplace_back.pass.cpp +++ b/test/std/containers/sequences/vector.bool/emplace_back.pass.cpp @@ -48,7 +48,7 @@ int main() assert(c.front() == false); assert(c.back() == true); #endif - c.emplace_back(1 == 1); + c.emplace_back(true); assert(c.size() == 3); assert(c.front() == false); assert(c[1] == true); @@ -82,7 +82,7 @@ int main() assert(c.front() == false); assert(c.back() == true); #endif - c.emplace_back(1 == 1); + c.emplace_back(true); assert(c.size() == 3); assert(c.front() == false); assert(c[1] == true); diff --git a/test/std/containers/sequences/vector.bool/initializer_list.pass.cpp b/test/std/containers/sequences/vector.bool/initializer_list.pass.cpp index 07bae0eb7..a850fa2f1 100644 --- a/test/std/containers/sequences/vector.bool/initializer_list.pass.cpp +++ b/test/std/containers/sequences/vector.bool/initializer_list.pass.cpp @@ -7,6 +7,8 @@ // //===----------------------------------------------------------------------===// +// UNSUPPORTED: c++98, c++03 + // // vector(initializer_list il); @@ -18,7 +20,6 @@ int main() { -#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS { std::vector d = {true, false, false, true}; assert(d.size() == 4); @@ -27,7 +28,6 @@ int main() assert(d[2] == false); assert(d[3] == true); } -#if TEST_STD_VER >= 11 { std::vector> d = {true, false, false, true}; assert(d.size() == 4); @@ -36,6 +36,4 @@ int main() assert(d[2] == false); assert(d[3] == true); } -#endif -#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS } diff --git a/test/std/containers/sequences/vector.bool/initializer_list_alloc.pass.cpp b/test/std/containers/sequences/vector.bool/initializer_list_alloc.pass.cpp index 5f7f5144f..9a2df4290 100644 --- a/test/std/containers/sequences/vector.bool/initializer_list_alloc.pass.cpp +++ b/test/std/containers/sequences/vector.bool/initializer_list_alloc.pass.cpp @@ -7,6 +7,8 @@ // //===----------------------------------------------------------------------===// +// UNSUPPORTED: c++98, c++03 + // // vector(initializer_list il, const Allocator& a = allocator_type()); @@ -19,7 +21,6 @@ int main() { -#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS { std::vector> d({true, false, false, true}, test_allocator(3)); assert(d.get_allocator() == test_allocator(3)); @@ -29,7 +30,6 @@ int main() assert(d[2] == false); assert(d[3] == true); } -#if TEST_STD_VER >= 11 { std::vector> d({true, false, false, true}, min_allocator()); assert(d.get_allocator() == min_allocator()); @@ -39,6 +39,4 @@ int main() assert(d[2] == false); assert(d[3] == true); } -#endif -#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS } diff --git a/test/std/containers/sequences/vector.bool/insert_iter_initializer_list.pass.cpp b/test/std/containers/sequences/vector.bool/insert_iter_initializer_list.pass.cpp index 3a176d94e..df4cb199b 100644 --- a/test/std/containers/sequences/vector.bool/insert_iter_initializer_list.pass.cpp +++ b/test/std/containers/sequences/vector.bool/insert_iter_initializer_list.pass.cpp @@ -7,6 +7,8 @@ // //===----------------------------------------------------------------------===// +// UNSUPPORTED: c++98, c++03 + // // iterator insert(const_iterator p, initializer_list il); @@ -18,7 +20,6 @@ int main() { -#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS { std::vector d(10, true); std::vector::iterator i = d.insert(d.cbegin() + 2, {false, true, true, false}); @@ -39,7 +40,6 @@ int main() assert(d[12] == true); assert(d[13] == true); } -#if TEST_STD_VER >= 11 { std::vector> d(10, true); std::vector>::iterator i = d.insert(d.cbegin() + 2, {false, true, true, false}); @@ -60,6 +60,4 @@ int main() assert(d[12] == true); assert(d[13] == true); } -#endif -#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS } diff --git a/test/std/containers/sequences/vector.bool/move.pass.cpp b/test/std/containers/sequences/vector.bool/move.pass.cpp index f3a11ec56..f189e2b97 100644 --- a/test/std/containers/sequences/vector.bool/move.pass.cpp +++ b/test/std/containers/sequences/vector.bool/move.pass.cpp @@ -7,6 +7,8 @@ // //===----------------------------------------------------------------------===// +// UNSUPPORTED: c++98, c++03 + // // vector(vector&& c); @@ -18,7 +20,6 @@ int main() { -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES { std::vector > l(test_allocator(5)); std::vector > lo(test_allocator(5)); @@ -45,7 +46,6 @@ int main() assert(l.empty()); assert(l2.get_allocator() == lo.get_allocator()); } -#if TEST_STD_VER >= 11 { std::vector > l(min_allocator{}); std::vector > lo(min_allocator{}); @@ -59,6 +59,4 @@ int main() assert(l.empty()); assert(l2.get_allocator() == lo.get_allocator()); } -#endif -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES } diff --git a/test/std/containers/sequences/vector.bool/move_alloc.pass.cpp b/test/std/containers/sequences/vector.bool/move_alloc.pass.cpp index 7aaa7c555..b3b6f9649 100644 --- a/test/std/containers/sequences/vector.bool/move_alloc.pass.cpp +++ b/test/std/containers/sequences/vector.bool/move_alloc.pass.cpp @@ -7,6 +7,8 @@ // //===----------------------------------------------------------------------===// +// UNSUPPORTED: c++98, c++03 + // // vector(vector&& c, const allocator_type& a); @@ -18,7 +20,6 @@ int main() { -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES { std::vector > l(test_allocator(5)); std::vector > lo(test_allocator(5)); @@ -58,7 +59,6 @@ int main() assert(!l.empty()); assert(l2.get_allocator() == other_allocator(4)); } -#if TEST_STD_VER >= 11 { std::vector > l(min_allocator{}); std::vector > lo(min_allocator{}); @@ -72,6 +72,4 @@ int main() assert(l.empty()); assert(l2.get_allocator() == min_allocator()); } -#endif -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES } diff --git a/test/std/containers/sequences/vector.bool/op_equal_initializer_list.pass.cpp b/test/std/containers/sequences/vector.bool/op_equal_initializer_list.pass.cpp index 4b959cf00..61874338d 100644 --- a/test/std/containers/sequences/vector.bool/op_equal_initializer_list.pass.cpp +++ b/test/std/containers/sequences/vector.bool/op_equal_initializer_list.pass.cpp @@ -7,6 +7,8 @@ // //===----------------------------------------------------------------------===// +// UNSUPPORTED: c++98, c++03 + // // vector& operator=(initializer_list il); @@ -18,7 +20,6 @@ int main() { -#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS { std::vector d; d = {true, false, false, true}; @@ -28,7 +29,6 @@ int main() assert(d[2] == false); assert(d[3] == true); } -#if TEST_STD_VER >= 11 { std::vector> d; d = {true, false, false, true}; @@ -38,6 +38,4 @@ int main() assert(d[2] == false); assert(d[3] == true); } -#endif -#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS } diff --git a/test/std/containers/sequences/vector.bool/vector_bool.pass.cpp b/test/std/containers/sequences/vector.bool/vector_bool.pass.cpp index 4f82792fa..89f5a6645 100644 --- a/test/std/containers/sequences/vector.bool/vector_bool.pass.cpp +++ b/test/std/containers/sequences/vector.bool/vector_bool.pass.cpp @@ -31,6 +31,7 @@ int main() typedef std::hash H; static_assert((std::is_same::value), "" ); static_assert((std::is_same::value), "" ); + ASSERT_NOEXCEPT(H()(T())); bool ba[] = {true, false, true, true, false}; T vb(std::begin(ba), std::end(ba)); @@ -43,6 +44,7 @@ int main() typedef std::hash H; static_assert((std::is_same::value), "" ); static_assert((std::is_same::value), "" ); + ASSERT_NOEXCEPT(H()(T())); bool ba[] = {true, false, true, true, false}; T vb(std::begin(ba), std::end(ba)); H h; diff --git a/test/std/containers/sequences/vector/vector.capacity/resize_size.pass.cpp b/test/std/containers/sequences/vector/vector.capacity/resize_size.pass.cpp index 6409acaf6..273bdad9a 100644 --- a/test/std/containers/sequences/vector/vector.capacity/resize_size.pass.cpp +++ b/test/std/containers/sequences/vector/vector.capacity/resize_size.pass.cpp @@ -13,6 +13,8 @@ #include #include + +#include "test_macros.h" #include "test_allocator.h" #include "MoveOnly.h" #include "min_allocator.h" @@ -20,31 +22,6 @@ int main() { -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES - { - std::vector v(100); - v.resize(50); - assert(v.size() == 50); - assert(v.capacity() == 100); - assert(is_contiguous_container_asan_correct(v)); - v.resize(200); - assert(v.size() == 200); - assert(v.capacity() >= 200); - assert(is_contiguous_container_asan_correct(v)); - } - { - // Add 1 for implementations that dynamically allocate a container proxy. - std::vector > v(100); - v.resize(50); - assert(v.size() == 50); - assert(v.capacity() == 100); - assert(is_contiguous_container_asan_correct(v)); - v.resize(200); - assert(v.size() == 200); - assert(v.capacity() >= 200); - assert(is_contiguous_container_asan_correct(v)); - } -#else // _LIBCPP_HAS_NO_RVALUE_REFERENCES { std::vector v(100); v.resize(50); @@ -68,8 +45,30 @@ int main() assert(v.capacity() >= 200); assert(is_contiguous_container_asan_correct(v)); } -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES #if TEST_STD_VER >= 11 + { + std::vector v(100); + v.resize(50); + assert(v.size() == 50); + assert(v.capacity() == 100); + assert(is_contiguous_container_asan_correct(v)); + v.resize(200); + assert(v.size() == 200); + assert(v.capacity() >= 200); + assert(is_contiguous_container_asan_correct(v)); + } + { + // Add 1 for implementations that dynamically allocate a container proxy. + std::vector > v(100); + v.resize(50); + assert(v.size() == 50); + assert(v.capacity() == 100); + assert(is_contiguous_container_asan_correct(v)); + v.resize(200); + assert(v.size() == 200); + assert(v.capacity() >= 200); + assert(is_contiguous_container_asan_correct(v)); + } { std::vector> v(100); v.resize(50); diff --git a/test/std/containers/sequences/vector/vector.cons/assign_initializer_list.pass.cpp b/test/std/containers/sequences/vector/vector.cons/assign_initializer_list.pass.cpp index 222fa9c78..853f75583 100644 --- a/test/std/containers/sequences/vector/vector.cons/assign_initializer_list.pass.cpp +++ b/test/std/containers/sequences/vector/vector.cons/assign_initializer_list.pass.cpp @@ -7,6 +7,8 @@ // //===----------------------------------------------------------------------===// +// UNSUPPORTED: c++98, c++03 + // // void assign(initializer_list il); @@ -20,7 +22,6 @@ template void test ( Vec &v ) { -#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS v.assign({3, 4, 5, 6}); assert(v.size() == 4); assert(is_contiguous_container_asan_correct(v)); @@ -28,7 +29,6 @@ void test ( Vec &v ) assert(v[1] == 4); assert(v[2] == 5); assert(v[3] == 6); -#endif } int main() @@ -41,8 +41,6 @@ int main() test(d1); test(d2); } - -#if TEST_STD_VER >= 11 { typedef std::vector> V; V d1; @@ -51,5 +49,4 @@ int main() test(d1); test(d2); } -#endif } diff --git a/test/std/containers/sequences/vector/vector.cons/assign_move.pass.cpp b/test/std/containers/sequences/vector/vector.cons/assign_move.pass.cpp index acbee97bc..c2b6b8378 100644 --- a/test/std/containers/sequences/vector/vector.cons/assign_move.pass.cpp +++ b/test/std/containers/sequences/vector/vector.cons/assign_move.pass.cpp @@ -7,6 +7,8 @@ // //===----------------------------------------------------------------------===// +// UNSUPPORTED: c++98, c++03 + // // vector& operator=(vector&& c); @@ -20,7 +22,6 @@ int main() { -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES { std::vector > l(test_allocator(5)); std::vector > lo(test_allocator(5)); @@ -76,7 +77,6 @@ int main() assert(l2.get_allocator() == lo.get_allocator()); assert(is_contiguous_container_asan_correct(l2)); } -#if TEST_STD_VER >= 11 { std::vector > l(min_allocator{}); std::vector > lo(min_allocator{}); @@ -96,6 +96,4 @@ int main() assert(l2.get_allocator() == lo.get_allocator()); assert(is_contiguous_container_asan_correct(l2)); } -#endif -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES } diff --git a/test/std/containers/sequences/vector/vector.cons/initializer_list.pass.cpp b/test/std/containers/sequences/vector/vector.cons/initializer_list.pass.cpp index 408bcc3b1..edbad8c0d 100644 --- a/test/std/containers/sequences/vector/vector.cons/initializer_list.pass.cpp +++ b/test/std/containers/sequences/vector/vector.cons/initializer_list.pass.cpp @@ -7,6 +7,8 @@ // //===----------------------------------------------------------------------===// +// UNSUPPORTED: c++98, c++03 + // // vector(initializer_list il); @@ -18,7 +20,6 @@ int main() { -#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS { std::vector d = {3, 4, 5, 6}; assert(d.size() == 4); @@ -28,7 +29,6 @@ int main() assert(d[2] == 5); assert(d[3] == 6); } -#if TEST_STD_VER >= 11 { std::vector> d = {3, 4, 5, 6}; assert(d.size() == 4); @@ -38,6 +38,4 @@ int main() assert(d[2] == 5); assert(d[3] == 6); } -#endif -#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS } diff --git a/test/std/containers/sequences/vector/vector.cons/initializer_list_alloc.pass.cpp b/test/std/containers/sequences/vector/vector.cons/initializer_list_alloc.pass.cpp index f4c3b5c1e..ac5d0178e 100644 --- a/test/std/containers/sequences/vector/vector.cons/initializer_list_alloc.pass.cpp +++ b/test/std/containers/sequences/vector/vector.cons/initializer_list_alloc.pass.cpp @@ -7,6 +7,8 @@ // //===----------------------------------------------------------------------===// +// UNSUPPORTED: c++98, c++03 + // // vector(initializer_list il, const Allocator& a = allocator_type()); @@ -20,7 +22,6 @@ int main() { -#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS { std::vector> d({3, 4, 5, 6}, test_allocator(3)); assert(d.get_allocator() == test_allocator(3)); @@ -31,7 +32,6 @@ int main() assert(d[2] == 5); assert(d[3] == 6); } -#if TEST_STD_VER >= 11 { std::vector> d({3, 4, 5, 6}, min_allocator()); assert(d.get_allocator() == min_allocator()); @@ -42,6 +42,4 @@ int main() assert(d[2] == 5); assert(d[3] == 6); } -#endif -#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS } diff --git a/test/std/containers/sequences/vector/vector.cons/move.pass.cpp b/test/std/containers/sequences/vector/vector.cons/move.pass.cpp index d51b364f3..cd50d5432 100644 --- a/test/std/containers/sequences/vector/vector.cons/move.pass.cpp +++ b/test/std/containers/sequences/vector/vector.cons/move.pass.cpp @@ -7,6 +7,8 @@ // //===----------------------------------------------------------------------===// +// UNSUPPORTED: c++98, c++03 + // // vector(vector&& c); @@ -20,7 +22,6 @@ int main() { -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES { std::vector > l(test_allocator(5)); std::vector > lo(test_allocator(5)); @@ -68,7 +69,6 @@ int main() assert(*j == 3); assert(is_contiguous_container_asan_correct(c2)); } -#if TEST_STD_VER >= 11 { std::vector > l(min_allocator{}); std::vector > lo(min_allocator{}); @@ -98,6 +98,4 @@ int main() assert(*j == 3); assert(is_contiguous_container_asan_correct(c2)); } -#endif -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES } diff --git a/test/std/containers/sequences/vector/vector.cons/move_alloc.pass.cpp b/test/std/containers/sequences/vector/vector.cons/move_alloc.pass.cpp index fcdd35ae1..767a0ce3d 100644 --- a/test/std/containers/sequences/vector/vector.cons/move_alloc.pass.cpp +++ b/test/std/containers/sequences/vector/vector.cons/move_alloc.pass.cpp @@ -7,6 +7,8 @@ // //===----------------------------------------------------------------------===// +// UNSUPPORTED: c++98, c++03 + // // vector(vector&& c, const allocator_type& a); @@ -20,7 +22,6 @@ int main() { -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES { std::vector > l(test_allocator(5)); std::vector > lo(test_allocator(5)); @@ -75,7 +76,6 @@ int main() assert(l2.get_allocator() == other_allocator(4)); assert(is_contiguous_container_asan_correct(l2)); } -#if TEST_STD_VER >= 11 { std::vector > l(min_allocator{}); std::vector > lo(min_allocator{}); @@ -94,6 +94,4 @@ int main() assert(l2.get_allocator() == min_allocator()); assert(is_contiguous_container_asan_correct(l2)); } -#endif -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES } diff --git a/test/std/containers/sequences/vector/vector.cons/op_equal_initializer_list.pass.cpp b/test/std/containers/sequences/vector/vector.cons/op_equal_initializer_list.pass.cpp index 4e5a20413..21dd5c384 100644 --- a/test/std/containers/sequences/vector/vector.cons/op_equal_initializer_list.pass.cpp +++ b/test/std/containers/sequences/vector/vector.cons/op_equal_initializer_list.pass.cpp @@ -7,6 +7,8 @@ // //===----------------------------------------------------------------------===// +// UNSUPPORTED: c++98, c++03 + // // vector& operator=(initializer_list il); @@ -19,7 +21,6 @@ int main() { -#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS { std::vector d; d = {3, 4, 5, 6}; @@ -30,7 +31,6 @@ int main() assert(d[2] == 5); assert(d[3] == 6); } -#if TEST_STD_VER >= 11 { std::vector> d; d = {3, 4, 5, 6}; @@ -41,6 +41,4 @@ int main() assert(d[2] == 5); assert(d[3] == 6); } -#endif -#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS } diff --git a/test/std/containers/sequences/vector/vector.modifiers/clear.pass.cpp b/test/std/containers/sequences/vector/vector.modifiers/clear.pass.cpp new file mode 100644 index 000000000..5f053eb85 --- /dev/null +++ b/test/std/containers/sequences/vector/vector.modifiers/clear.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. +// +//===----------------------------------------------------------------------===// + +// + +// void clear(); + +#include +#include + +#include "min_allocator.h" +#include "asan_testing.h" + +int main() +{ + { + int a[] = {1, 2, 3}; + std::vector c(a, a+3); + c.clear(); + assert(c.empty()); + LIBCPP_ASSERT(c.__invariants()); + LIBCPP_ASSERT(is_contiguous_container_asan_correct(c)); + } +#if TEST_STD_VER >= 11 + { + int a[] = {1, 2, 3}; + std::vector> c(a, a+3); + c.clear(); + assert(c.empty()); + LIBCPP_ASSERT(c.__invariants()); + LIBCPP_ASSERT(is_contiguous_container_asan_correct(c)); + } +#endif +} diff --git a/test/std/containers/sequences/vector/vector.modifiers/emplace_extra.pass.cpp b/test/std/containers/sequences/vector/vector.modifiers/emplace_extra.pass.cpp index 7e4aed8c1..e5e0277fa 100644 --- a/test/std/containers/sequences/vector/vector.modifiers/emplace_extra.pass.cpp +++ b/test/std/containers/sequences/vector/vector.modifiers/emplace_extra.pass.cpp @@ -7,6 +7,8 @@ // //===----------------------------------------------------------------------===// +// UNSUPPORTED: c++98, c++03 + // // template iterator emplace(const_iterator pos, Args&&... args); @@ -19,7 +21,6 @@ int main() { -#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS { std::vector v; v.reserve(3); @@ -38,7 +39,6 @@ int main() assert(v[0] == 3); assert(is_contiguous_container_asan_correct(v)); } -#if TEST_STD_VER >= 11 { std::vector> v; v.reserve(3); @@ -57,6 +57,4 @@ int main() assert(v[0] == 3); assert(is_contiguous_container_asan_correct(v)); } -#endif -#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS } diff --git a/test/std/containers/sequences/vector/vector.modifiers/erase_iter.pass.cpp b/test/std/containers/sequences/vector/vector.modifiers/erase_iter.pass.cpp index dbdccf13b..785a5be8b 100644 --- a/test/std/containers/sequences/vector/vector.modifiers/erase_iter.pass.cpp +++ b/test/std/containers/sequences/vector/vector.modifiers/erase_iter.pass.cpp @@ -18,6 +18,21 @@ #include "min_allocator.h" #include "asan_testing.h" +#ifndef TEST_HAS_NO_EXCEPTIONS +struct Throws { + Throws() : v_(0) {} + Throws(int v) : v_(v) {} + Throws(const Throws &rhs) : v_(rhs.v_) { if (sThrows) throw 1; } + Throws( Throws &&rhs) : v_(rhs.v_) { if (sThrows) throw 1; } + Throws& operator=(const Throws &rhs) { v_ = rhs.v_; return *this; } + Throws& operator=( Throws &&rhs) { v_ = rhs.v_; return *this; } + int v_; + static bool sThrows; + }; + +bool Throws::sThrows = false; +#endif + int main() { { @@ -72,4 +87,17 @@ int main() assert(is_contiguous_container_asan_correct(l1)); } #endif +#ifndef TEST_HAS_NO_EXCEPTIONS +// Test for LWG2853: +// Throws: Nothing unless an exception is thrown by the assignment operator or move assignment operator of T. + { + Throws arr[] = {1, 2, 3}; + std::vector v(arr, arr+3); + Throws::sThrows = true; + v.erase(v.begin()); + v.erase(--v.end()); + v.erase(v.begin()); + assert(v.size() == 0); + } +#endif } diff --git a/test/std/containers/sequences/vector/vector.modifiers/erase_iter_iter.pass.cpp b/test/std/containers/sequences/vector/vector.modifiers/erase_iter_iter.pass.cpp index f7fa0dba2..2fc4981b6 100644 --- a/test/std/containers/sequences/vector/vector.modifiers/erase_iter_iter.pass.cpp +++ b/test/std/containers/sequences/vector/vector.modifiers/erase_iter_iter.pass.cpp @@ -18,6 +18,21 @@ #include "min_allocator.h" #include "asan_testing.h" +#ifndef TEST_HAS_NO_EXCEPTIONS +struct Throws { + Throws() : v_(0) {} + Throws(int v) : v_(v) {} + Throws(const Throws &rhs) : v_(rhs.v_) { if (sThrows) throw 1; } + Throws( Throws &&rhs) : v_(rhs.v_) { if (sThrows) throw 1; } + Throws& operator=(const Throws &rhs) { v_ = rhs.v_; return *this; } + Throws& operator=( Throws &&rhs) { v_ = rhs.v_; return *this; } + int v_; + static bool sThrows; + }; + +bool Throws::sThrows = false; +#endif + int main() { int a1[] = {1, 2, 3}; @@ -125,4 +140,17 @@ int main() assert(is_contiguous_container_asan_correct(outer[1])); } #endif +#ifndef TEST_HAS_NO_EXCEPTIONS +// Test for LWG2853: +// Throws: Nothing unless an exception is thrown by the assignment operator or move assignment operator of T. + { + Throws arr[] = {1, 2, 3}; + std::vector v(arr, arr+3); + Throws::sThrows = true; + v.erase(v.begin(), --v.end()); + assert(v.size() == 1); + v.erase(v.begin(), v.end()); + assert(v.size() == 0); + } +#endif } diff --git a/test/std/containers/sequences/vector/vector.modifiers/insert_iter_initializer_list.pass.cpp b/test/std/containers/sequences/vector/vector.modifiers/insert_iter_initializer_list.pass.cpp index b0fe123aa..9072d427c 100644 --- a/test/std/containers/sequences/vector/vector.modifiers/insert_iter_initializer_list.pass.cpp +++ b/test/std/containers/sequences/vector/vector.modifiers/insert_iter_initializer_list.pass.cpp @@ -7,6 +7,8 @@ // //===----------------------------------------------------------------------===// +// UNSUPPORTED: c++98, c++03 + // // iterator insert(const_iterator p, initializer_list il); @@ -19,7 +21,6 @@ int main() { -#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS { std::vector d(10, 1); std::vector::iterator i = d.insert(d.cbegin() + 2, {3, 4, 5, 6}); @@ -41,7 +42,6 @@ int main() assert(d[12] == 1); assert(d[13] == 1); } -#if TEST_STD_VER >= 11 { std::vector> d(10, 1); std::vector>::iterator i = d.insert(d.cbegin() + 2, {3, 4, 5, 6}); @@ -63,6 +63,4 @@ int main() assert(d[12] == 1); assert(d[13] == 1); } -#endif -#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS } diff --git a/test/std/containers/sequences/vector/vector.modifiers/push_back_rvalue.pass.cpp b/test/std/containers/sequences/vector/vector.modifiers/push_back_rvalue.pass.cpp index f4a1f5d5f..ac1fffd9d 100644 --- a/test/std/containers/sequences/vector/vector.modifiers/push_back_rvalue.pass.cpp +++ b/test/std/containers/sequences/vector/vector.modifiers/push_back_rvalue.pass.cpp @@ -7,6 +7,8 @@ // //===----------------------------------------------------------------------===// +// UNSUPPORTED: c++98, c++03 + // // void push_back(value_type&& x); @@ -21,7 +23,6 @@ int main() { -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES { std::vector c; c.push_back(MoveOnly(0)); @@ -81,7 +82,6 @@ int main() for (int j = 0; static_cast(j) < c.size(); ++j) assert(c[j] == MoveOnly(j)); } -#if TEST_STD_VER >= 11 { std::vector> c; c.push_back(MoveOnly(0)); @@ -110,6 +110,4 @@ int main() for (int j = 0; static_cast(j) < c.size(); ++j) assert(c[j] == MoveOnly(j)); } -#endif -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES } diff --git a/test/std/containers/unord/unord.map/unord.map.cnstr/assign_init.pass.cpp b/test/std/containers/unord/unord.map/unord.map.cnstr/assign_init.pass.cpp index 4d92b3d4c..9fca1f105 100644 --- a/test/std/containers/unord/unord.map/unord.map.cnstr/assign_init.pass.cpp +++ b/test/std/containers/unord/unord.map/unord.map.cnstr/assign_init.pass.cpp @@ -7,6 +7,8 @@ // //===----------------------------------------------------------------------===// +// UNSUPPORTED: c++98, c++03 + // // template , class Pred = equal_to, @@ -27,7 +29,6 @@ int main() { -#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS { typedef std::allocator > A; typedef std::unordered_map= 11 { typedef min_allocator > A; typedef std::unordered_map // template , class Pred = equal_to, @@ -29,7 +31,6 @@ int main() { -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES { typedef test_allocator > A; typedef std::unordered_map= 11 { typedef min_allocator > A; typedef std::unordered_map= 1 - { - std::unordered_map s1 = {{1, 1}, {2, 2}, {3, 3}}; - std::unordered_map::iterator i = s1.begin(); - std::pair k = *i; - std::unordered_map s2; - s2 = std::move(s1); - assert(*i == k); - s2.erase(i); - assert(s2.size() == 2); - } -#endif -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES } diff --git a/test/std/containers/unord/unord.map/unord.map.cnstr/init.pass.cpp b/test/std/containers/unord/unord.map/unord.map.cnstr/init.pass.cpp index bebab0375..b06e4db13 100644 --- a/test/std/containers/unord/unord.map/unord.map.cnstr/init.pass.cpp +++ b/test/std/containers/unord/unord.map/unord.map.cnstr/init.pass.cpp @@ -7,6 +7,8 @@ // //===----------------------------------------------------------------------===// +// UNSUPPORTED: c++98, c++03 + // // template , class Pred = equal_to, @@ -29,7 +31,6 @@ int main() { -#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS { typedef std::unordered_map >, @@ -61,7 +62,6 @@ int main() assert(fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON); assert(c.max_load_factor() == 1); } -#if TEST_STD_VER >= 11 { typedef std::unordered_map >, @@ -158,7 +158,5 @@ int main() assert(fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON); assert(c.max_load_factor() == 1); } -#endif -#endif -#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS +#endif // TEST_STD_VER > 11 } diff --git a/test/std/containers/unord/unord.map/unord.map.cnstr/init_size.pass.cpp b/test/std/containers/unord/unord.map/unord.map.cnstr/init_size.pass.cpp index 9055e3dcd..ca48808f4 100644 --- a/test/std/containers/unord/unord.map/unord.map.cnstr/init_size.pass.cpp +++ b/test/std/containers/unord/unord.map/unord.map.cnstr/init_size.pass.cpp @@ -7,6 +7,8 @@ // //===----------------------------------------------------------------------===// +// UNSUPPORTED: c++98, c++03 + // // template , class Pred = equal_to, @@ -30,7 +32,6 @@ int main() { -#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS { typedef std::unordered_map >, @@ -64,7 +65,6 @@ int main() assert(std::fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON); assert(c.max_load_factor() == 1); } -#if TEST_STD_VER >= 11 { typedef std::unordered_map >, @@ -98,6 +98,4 @@ int main() assert(std::fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON); assert(c.max_load_factor() == 1); } -#endif -#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS } diff --git a/test/std/containers/unord/unord.map/unord.map.cnstr/init_size_hash.pass.cpp b/test/std/containers/unord/unord.map/unord.map.cnstr/init_size_hash.pass.cpp index db0010b34..02360f8ac 100644 --- a/test/std/containers/unord/unord.map/unord.map.cnstr/init_size_hash.pass.cpp +++ b/test/std/containers/unord/unord.map/unord.map.cnstr/init_size_hash.pass.cpp @@ -7,6 +7,8 @@ // //===----------------------------------------------------------------------===// +// UNSUPPORTED: c++98, c++03 + // // template , class Pred = equal_to, @@ -30,7 +32,6 @@ int main() { -#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS { typedef std::unordered_map >, @@ -65,7 +66,6 @@ int main() assert(std::fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON); assert(c.max_load_factor() == 1); } -#if TEST_STD_VER >= 11 { typedef std::unordered_map >, @@ -100,6 +100,4 @@ int main() assert(std::fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON); assert(c.max_load_factor() == 1); } -#endif -#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS } diff --git a/test/std/containers/unord/unord.map/unord.map.cnstr/init_size_hash_equal.pass.cpp b/test/std/containers/unord/unord.map/unord.map.cnstr/init_size_hash_equal.pass.cpp index c76ce3968..c6a397656 100644 --- a/test/std/containers/unord/unord.map/unord.map.cnstr/init_size_hash_equal.pass.cpp +++ b/test/std/containers/unord/unord.map/unord.map.cnstr/init_size_hash_equal.pass.cpp @@ -7,6 +7,8 @@ // //===----------------------------------------------------------------------===// +// UNSUPPORTED: c++98, c++03 + // // template , class Pred = equal_to, @@ -31,7 +33,6 @@ int main() { -#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS { typedef std::unordered_map >, @@ -67,7 +68,6 @@ int main() assert(std::fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON); assert(c.max_load_factor() == 1); } -#if TEST_STD_VER >= 11 { typedef std::unordered_map >, @@ -103,6 +103,4 @@ int main() assert(std::fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON); assert(c.max_load_factor() == 1); } -#endif -#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS } diff --git a/test/std/containers/unord/unord.map/unord.map.cnstr/init_size_hash_equal_allocator.pass.cpp b/test/std/containers/unord/unord.map/unord.map.cnstr/init_size_hash_equal_allocator.pass.cpp index 6cb57d4ff..5acc4c34b 100644 --- a/test/std/containers/unord/unord.map/unord.map.cnstr/init_size_hash_equal_allocator.pass.cpp +++ b/test/std/containers/unord/unord.map/unord.map.cnstr/init_size_hash_equal_allocator.pass.cpp @@ -7,6 +7,8 @@ // //===----------------------------------------------------------------------===// +// UNSUPPORTED: c++98, c++03 + // // template , class Pred = equal_to, @@ -31,7 +33,6 @@ int main() { -#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS { typedef std::unordered_map >, @@ -68,7 +69,6 @@ int main() assert(std::fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON); assert(c.max_load_factor() == 1); } -#if TEST_STD_VER >= 11 { typedef std::unordered_map >, @@ -141,6 +141,4 @@ int main() assert(std::fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON); assert(c.max_load_factor() == 1); } -#endif -#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS } diff --git a/test/std/containers/unord/unord.map/unord.map.cnstr/move_alloc.pass.cpp b/test/std/containers/unord/unord.map/unord.map.cnstr/move_alloc.pass.cpp index 681c0e95b..296363166 100644 --- a/test/std/containers/unord/unord.map/unord.map.cnstr/move_alloc.pass.cpp +++ b/test/std/containers/unord/unord.map/unord.map.cnstr/move_alloc.pass.cpp @@ -7,6 +7,8 @@ // //===----------------------------------------------------------------------===// +// UNSUPPORTED: c++98, c++03 + // // template , class Pred = equal_to, @@ -30,7 +32,6 @@ int main() { -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES { typedef std::pair P; typedef test_allocator> A; @@ -113,7 +114,6 @@ int main() assert(c0.empty()); } -#if TEST_STD_VER >= 11 { typedef std::pair P; typedef min_allocator> A; @@ -196,6 +196,4 @@ int main() assert(c0.empty()); } -#endif -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES } diff --git a/test/std/containers/unord/unord.map/unord.map.modifiers/emplace.pass.cpp b/test/std/containers/unord/unord.map/unord.map.modifiers/emplace.pass.cpp index 26f716166..18c83dd31 100644 --- a/test/std/containers/unord/unord.map/unord.map.modifiers/emplace.pass.cpp +++ b/test/std/containers/unord/unord.map/unord.map.modifiers/emplace.pass.cpp @@ -7,6 +7,8 @@ // //===----------------------------------------------------------------------===// +// UNSUPPORTED: c++98, c++03 + // // template , class Pred = equal_to, @@ -24,7 +26,6 @@ int main() { -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES { typedef std::unordered_map C; typedef std::pair R; @@ -49,7 +50,6 @@ int main() assert(r.first->first == 5); assert(r.first->second == Emplaceable(6, 7)); } -#if TEST_STD_VER >= 11 { typedef std::unordered_map, std::equal_to, min_allocator>> C; @@ -75,6 +75,4 @@ int main() assert(r.first->first == 5); assert(r.first->second == Emplaceable(6, 7)); } -#endif -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES } diff --git a/test/std/containers/unord/unord.map/unord.map.modifiers/emplace_hint.pass.cpp b/test/std/containers/unord/unord.map/unord.map.modifiers/emplace_hint.pass.cpp index 477f2cf02..ce7fa835c 100644 --- a/test/std/containers/unord/unord.map/unord.map.modifiers/emplace_hint.pass.cpp +++ b/test/std/containers/unord/unord.map/unord.map.modifiers/emplace_hint.pass.cpp @@ -7,6 +7,8 @@ // //===----------------------------------------------------------------------===// +// UNSUPPORTED: c++98, c++03 + // // template , class Pred = equal_to, @@ -16,9 +18,6 @@ // template // iterator emplace_hint(const_iterator p, Args&&... args); -#if _LIBCPP_DEBUG >= 1 -#define _LIBCPP_ASSERT(x, m) ((x) ? (void)0 : std::exit(0)) -#endif #include #include @@ -28,7 +27,6 @@ int main() { -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES { typedef std::unordered_map C; typedef C::iterator R; @@ -51,7 +49,6 @@ int main() assert(r->first == 5); assert(r->second == Emplaceable(6, 7)); } -#if TEST_STD_VER >= 11 { typedef std::unordered_map, std::equal_to, min_allocator>> C; @@ -75,19 +72,4 @@ int main() assert(r->first == 5); assert(r->second == Emplaceable(6, 7)); } -#endif -#if _LIBCPP_DEBUG >= 1 - { - typedef std::unordered_map C; - typedef C::iterator R; - typedef C::value_type P; - C c; - C c2; - R r = c.emplace_hint(c2.end(), std::piecewise_construct, - std::forward_as_tuple(3), - std::forward_as_tuple()); - assert(false); - } -#endif -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES } diff --git a/test/std/containers/unord/unord.map/unord.map.modifiers/insert_init.pass.cpp b/test/std/containers/unord/unord.map/unord.map.modifiers/insert_init.pass.cpp index a4d8b5d41..477a229d0 100644 --- a/test/std/containers/unord/unord.map/unord.map.modifiers/insert_init.pass.cpp +++ b/test/std/containers/unord/unord.map/unord.map.modifiers/insert_init.pass.cpp @@ -7,6 +7,8 @@ // //===----------------------------------------------------------------------===// +// UNSUPPORTED: c++98, c++03 + // // template , class Pred = equal_to, @@ -24,7 +26,6 @@ int main() { -#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS { typedef std::unordered_map C; typedef std::pair P; @@ -45,7 +46,6 @@ int main() assert(c.at(3) == "three"); assert(c.at(4) == "four"); } -#if TEST_STD_VER >= 11 { typedef std::unordered_map, std::equal_to, min_allocator>> C; @@ -67,6 +67,4 @@ int main() assert(c.at(3) == "three"); assert(c.at(4) == "four"); } -#endif -#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS } diff --git a/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/assign_init.pass.cpp b/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/assign_init.pass.cpp index 6d27dec98..cefbf4596 100644 --- a/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/assign_init.pass.cpp +++ b/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/assign_init.pass.cpp @@ -7,6 +7,8 @@ // //===----------------------------------------------------------------------===// +// UNSUPPORTED: c++98, c++03 + // // template , class Pred = equal_to, @@ -28,7 +30,6 @@ int main() { -#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS { typedef test_allocator > A; typedef std::unordered_multimap= 11 { typedef min_allocator > A; typedef std::unordered_multimap // template , class Pred = equal_to, @@ -29,7 +31,6 @@ int main() { -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES { typedef test_allocator > A; typedef std::unordered_multimap= 11 { typedef min_allocator > A; typedef std::unordered_multimap= 1 - { - std::unordered_multimap s1 = {{1, 1}, {2, 2}, {3, 3}}; - std::unordered_multimap::iterator i = s1.begin(); - std::pair k = *i; - std::unordered_multimap s2; - s2 = std::move(s1); - assert(*i == k); - s2.erase(i); - assert(s2.size() == 2); - } -#endif -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES } diff --git a/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/init.pass.cpp b/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/init.pass.cpp index 445fd2d82..1a222cef1 100644 --- a/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/init.pass.cpp +++ b/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/init.pass.cpp @@ -7,6 +7,8 @@ // //===----------------------------------------------------------------------===// +// UNSUPPORTED: c++98, c++03 + // // template , class Pred = equal_to, @@ -29,7 +31,6 @@ int main() { -#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS { typedef std::unordered_multimap >, @@ -83,7 +84,6 @@ int main() assert(c.key_eq() == test_compare >()); assert((c.get_allocator() == test_allocator >())); } -#if TEST_STD_VER >= 11 { typedef std::unordered_multimap >, @@ -250,7 +250,5 @@ int main() assert(c.get_allocator() == a); assert(!(c.get_allocator() == A())); } -#endif -#endif -#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS +#endif // TEST_STD_VER > 11 } diff --git a/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/init_size.pass.cpp b/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/init_size.pass.cpp index 92a43b482..ef75b6ce0 100644 --- a/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/init_size.pass.cpp +++ b/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/init_size.pass.cpp @@ -7,6 +7,8 @@ // //===----------------------------------------------------------------------===// +// UNSUPPORTED: c++98, c++03 + // // template , class Pred = equal_to, @@ -30,7 +32,6 @@ int main() { -#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS { typedef std::unordered_multimap >, @@ -86,7 +87,6 @@ int main() assert(c.key_eq() == test_compare >()); assert((c.get_allocator() == test_allocator >())); } -#if TEST_STD_VER >= 11 { typedef std::unordered_multimap >, @@ -142,6 +142,4 @@ int main() assert(c.key_eq() == test_compare >()); assert((c.get_allocator() == min_allocator >())); } -#endif -#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS } diff --git a/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/init_size_hash.pass.cpp b/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/init_size_hash.pass.cpp index d7afafcae..998125391 100644 --- a/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/init_size_hash.pass.cpp +++ b/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/init_size_hash.pass.cpp @@ -7,6 +7,8 @@ // //===----------------------------------------------------------------------===// +// UNSUPPORTED: c++98, c++03 + // // template , class Pred = equal_to, @@ -30,7 +32,6 @@ int main() { -#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS { typedef std::unordered_multimap >, @@ -87,7 +88,6 @@ int main() assert(c.key_eq() == test_compare >()); assert((c.get_allocator() == test_allocator >())); } -#if TEST_STD_VER >= 11 { typedef std::unordered_multimap >, @@ -144,6 +144,4 @@ int main() assert(c.key_eq() == test_compare >()); assert((c.get_allocator() == min_allocator >())); } -#endif -#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS } diff --git a/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/init_size_hash_equal.pass.cpp b/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/init_size_hash_equal.pass.cpp index 9842a4bbd..1ca94641c 100644 --- a/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/init_size_hash_equal.pass.cpp +++ b/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/init_size_hash_equal.pass.cpp @@ -7,6 +7,8 @@ // //===----------------------------------------------------------------------===// +// UNSUPPORTED: c++98, c++03 + // // template , class Pred = equal_to, @@ -31,7 +33,6 @@ int main() { -#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS { typedef std::unordered_multimap >, @@ -89,7 +90,6 @@ int main() assert(c.key_eq() == test_compare >(9)); assert((c.get_allocator() == test_allocator >())); } -#if TEST_STD_VER >= 11 { typedef std::unordered_multimap >, @@ -147,6 +147,4 @@ int main() assert(c.key_eq() == test_compare >(9)); assert((c.get_allocator() == min_allocator >())); } -#endif -#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS } diff --git a/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/init_size_hash_equal_allocator.pass.cpp b/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/init_size_hash_equal_allocator.pass.cpp index 244c3f5c6..e8efefbee 100644 --- a/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/init_size_hash_equal_allocator.pass.cpp +++ b/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/init_size_hash_equal_allocator.pass.cpp @@ -7,6 +7,8 @@ // //===----------------------------------------------------------------------===// +// UNSUPPORTED: c++98, c++03 + // // template , class Pred = equal_to, @@ -31,7 +33,6 @@ int main() { -#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS { typedef std::unordered_multimap >, @@ -90,7 +91,6 @@ int main() assert(c.key_eq() == test_compare >(9)); assert((c.get_allocator() == test_allocator >(10))); } -#if TEST_STD_VER >= 11 { typedef std::unordered_multimap >, @@ -208,6 +208,4 @@ int main() assert(c.key_eq() == test_compare >(9)); assert(c.get_allocator() == A{}); } -#endif -#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS } diff --git a/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/move_alloc.pass.cpp b/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/move_alloc.pass.cpp index 878ef598f..0e004522c 100644 --- a/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/move_alloc.pass.cpp +++ b/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/move_alloc.pass.cpp @@ -7,6 +7,8 @@ // //===----------------------------------------------------------------------===// +// UNSUPPORTED: c++98, c++03 + // // template , class Pred = equal_to, @@ -32,7 +34,6 @@ int main() { -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES { typedef std::pair P; typedef test_allocator> A; @@ -161,7 +162,6 @@ int main() assert(c0.empty()); } -#if TEST_STD_VER >= 11 { typedef std::pair P; typedef min_allocator> A; @@ -290,6 +290,4 @@ int main() assert(c0.empty()); } -#endif -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES } diff --git a/test/std/containers/unord/unord.multimap/unord.multimap.modifiers/emplace.pass.cpp b/test/std/containers/unord/unord.multimap/unord.multimap.modifiers/emplace.pass.cpp index 96678cf33..68e5267a9 100644 --- a/test/std/containers/unord/unord.multimap/unord.multimap.modifiers/emplace.pass.cpp +++ b/test/std/containers/unord/unord.multimap/unord.multimap.modifiers/emplace.pass.cpp @@ -7,6 +7,8 @@ // //===----------------------------------------------------------------------===// +// UNSUPPORTED: c++98, c++03 + // // template , class Pred = equal_to, @@ -24,7 +26,6 @@ int main() { -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES { typedef std::unordered_multimap C; typedef C::iterator R; @@ -46,7 +47,6 @@ int main() assert(r->first == 5); assert(r->second == Emplaceable(6, 7)); } -#if TEST_STD_VER >= 11 { typedef std::unordered_multimap, std::equal_to, min_allocator>> C; @@ -69,6 +69,4 @@ int main() assert(r->first == 5); assert(r->second == Emplaceable(6, 7)); } -#endif -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES } diff --git a/test/std/containers/unord/unord.multimap/unord.multimap.modifiers/emplace_hint.pass.cpp b/test/std/containers/unord/unord.multimap/unord.multimap.modifiers/emplace_hint.pass.cpp index a8095135c..86950e289 100644 --- a/test/std/containers/unord/unord.multimap/unord.multimap.modifiers/emplace_hint.pass.cpp +++ b/test/std/containers/unord/unord.multimap/unord.multimap.modifiers/emplace_hint.pass.cpp @@ -7,6 +7,8 @@ // //===----------------------------------------------------------------------===// +// UNSUPPORTED: c++98, c++03 + // // template , class Pred = equal_to, @@ -16,9 +18,6 @@ // template // iterator emplace_hint(const_iterator p, Args&&... args); -#if _LIBCPP_DEBUG >= 1 -#define _LIBCPP_ASSERT(x, m) ((x) ? (void)0 : std::exit(0)) -#endif #include #include @@ -29,7 +28,6 @@ int main() { -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES { typedef std::unordered_multimap C; typedef C::iterator R; @@ -60,7 +58,6 @@ int main() assert(r->first == 3); LIBCPP_ASSERT(r->second == Emplaceable(5, 6)); } -#if TEST_STD_VER >= 11 { typedef std::unordered_multimap, std::equal_to, min_allocator>> C; @@ -92,19 +89,4 @@ int main() assert(r->first == 3); LIBCPP_ASSERT(r->second == Emplaceable(5, 6)); } -#endif -#if _LIBCPP_DEBUG >= 1 - { - typedef std::unordered_multimap C; - typedef C::iterator R; - typedef C::value_type P; - C c; - C c2; - R r = c.emplace_hint(c2.end(), std::piecewise_construct, - std::forward_as_tuple(3), - std::forward_as_tuple()); - assert(false); - } -#endif -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES } diff --git a/test/std/containers/unord/unord.multimap/unord.multimap.modifiers/insert_init.pass.cpp b/test/std/containers/unord/unord.multimap/unord.multimap.modifiers/insert_init.pass.cpp index e0b1c6941..ef1577170 100644 --- a/test/std/containers/unord/unord.multimap/unord.multimap.modifiers/insert_init.pass.cpp +++ b/test/std/containers/unord/unord.multimap/unord.multimap.modifiers/insert_init.pass.cpp @@ -7,6 +7,8 @@ // //===----------------------------------------------------------------------===// +// UNSUPPORTED: c++98, c++03 + // // template , class Pred = equal_to, @@ -25,7 +27,6 @@ int main() { -#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS { typedef std::unordered_multimap C; typedef std::pair P; @@ -71,7 +72,6 @@ int main() assert(static_cast(std::distance(c.begin(), c.end())) == c.size()); assert(static_cast(std::distance(c.cbegin(), c.cend())) == c.size()); } -#if TEST_STD_VER >= 11 { typedef std::unordered_multimap, std::equal_to, min_allocator>> C; @@ -118,6 +118,4 @@ int main() assert(static_cast(std::distance(c.begin(), c.end())) == c.size()); assert(static_cast(std::distance(c.cbegin(), c.cend())) == c.size()); } -#endif -#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS } diff --git a/test/std/containers/unord/unord.multiset/emplace.pass.cpp b/test/std/containers/unord/unord.multiset/emplace.pass.cpp index d8d9e9bc5..5d925c8d4 100644 --- a/test/std/containers/unord/unord.multiset/emplace.pass.cpp +++ b/test/std/containers/unord/unord.multiset/emplace.pass.cpp @@ -7,6 +7,8 @@ // //===----------------------------------------------------------------------===// +// UNSUPPORTED: c++98, c++03 + // // template , class Pred = equal_to, @@ -24,7 +26,6 @@ int main() { -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES { typedef std::unordered_multiset C; typedef C::iterator R; @@ -41,7 +42,6 @@ int main() assert(c.size() == 3); assert(*r == Emplaceable(5, 6)); } -#if TEST_STD_VER >= 11 { typedef std::unordered_multiset, std::equal_to, min_allocator> C; @@ -59,6 +59,4 @@ int main() assert(c.size() == 3); assert(*r == Emplaceable(5, 6)); } -#endif -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES } diff --git a/test/std/containers/unord/unord.multiset/emplace_hint.pass.cpp b/test/std/containers/unord/unord.multiset/emplace_hint.pass.cpp index 3756476dc..d9bab1f49 100644 --- a/test/std/containers/unord/unord.multiset/emplace_hint.pass.cpp +++ b/test/std/containers/unord/unord.multiset/emplace_hint.pass.cpp @@ -7,6 +7,8 @@ // //===----------------------------------------------------------------------===// +// UNSUPPORTED: c++98, c++03 + // // template , class Pred = equal_to, @@ -16,9 +18,6 @@ // template // iterator emplace_hint(const_iterator p, Args&&... args); -#if _LIBCPP_DEBUG >= 1 -#define _LIBCPP_ASSERT(x, m) ((x) ? (void)0 : std::exit(0)) -#endif #include #include @@ -28,7 +27,6 @@ int main() { -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES { typedef std::unordered_multiset C; typedef C::iterator R; @@ -46,7 +44,6 @@ int main() assert(c.size() == 3); assert(*r == Emplaceable(5, 6)); } -#if TEST_STD_VER >= 11 { typedef std::unordered_multiset, std::equal_to, min_allocator> C; @@ -65,16 +62,4 @@ int main() assert(c.size() == 3); assert(*r == Emplaceable(5, 6)); } -#endif -#if _LIBCPP_DEBUG >= 1 - { - typedef std::unordered_multiset C; - typedef C::iterator R; - C c1; - C c2; - R r = c1.emplace_hint(c2.begin(), 5, 6); - assert(false); - } -#endif -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES } diff --git a/test/std/containers/unord/unord.multiset/insert_hint_rvalue.pass.cpp b/test/std/containers/unord/unord.multiset/insert_hint_rvalue.pass.cpp index f5026e102..ffe6534b2 100644 --- a/test/std/containers/unord/unord.multiset/insert_hint_rvalue.pass.cpp +++ b/test/std/containers/unord/unord.multiset/insert_hint_rvalue.pass.cpp @@ -15,13 +15,10 @@ // iterator insert(const_iterator p, value_type&& x); -#if _LIBCPP_DEBUG >= 1 -#define _LIBCPP_ASSERT(x, m) ((x) ? (void)0 : std::exit(0)) -#endif - #include #include +#include "test_macros.h" #include "MoveOnly.h" #include "min_allocator.h" @@ -49,7 +46,7 @@ int main() assert(c.size() == 4); assert(*r == 5.5); } -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES +#if TEST_STD_VER >= 11 { typedef std::unordered_multiset C; typedef C::iterator R; @@ -72,8 +69,6 @@ int main() assert(c.size() == 4); assert(*r == 5); } -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES -#if TEST_STD_VER >= 11 { typedef std::unordered_multiset, std::equal_to, min_allocator> C; @@ -97,7 +92,6 @@ int main() assert(c.size() == 4); assert(*r == 5.5); } -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES { typedef std::unordered_multiset, std::equal_to, min_allocator> C; @@ -121,18 +115,5 @@ int main() assert(c.size() == 4); assert(*r == 5); } -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES -#if _LIBCPP_DEBUG >= 1 - { - typedef std::unordered_multiset C; - typedef C::iterator R; - typedef C::value_type P; - C c; - C c2; - C::const_iterator e = c2.end(); - R r = c.insert(e, P(3.5)); - assert(false); - } -#endif -#endif +#endif // TEST_STD_VER >= 11 } diff --git a/test/std/containers/unord/unord.multiset/insert_init.pass.cpp b/test/std/containers/unord/unord.multiset/insert_init.pass.cpp index 9010cac99..88661b569 100644 --- a/test/std/containers/unord/unord.multiset/insert_init.pass.cpp +++ b/test/std/containers/unord/unord.multiset/insert_init.pass.cpp @@ -7,6 +7,8 @@ // //===----------------------------------------------------------------------===// +// UNSUPPORTED: c++98, c++03 + // // template , class Pred = equal_to, @@ -23,7 +25,6 @@ int main() { -#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS { typedef std::unordered_multiset C; typedef int P; @@ -44,7 +45,6 @@ int main() assert(c.count(3) == 1); assert(c.count(4) == 1); } -#if TEST_STD_VER >= 11 { typedef std::unordered_multiset, std::equal_to, min_allocator> C; @@ -66,6 +66,4 @@ int main() assert(c.count(3) == 1); assert(c.count(4) == 1); } -#endif -#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS } diff --git a/test/std/containers/unord/unord.multiset/insert_rvalue.pass.cpp b/test/std/containers/unord/unord.multiset/insert_rvalue.pass.cpp index 04f9e3416..893949010 100644 --- a/test/std/containers/unord/unord.multiset/insert_rvalue.pass.cpp +++ b/test/std/containers/unord/unord.multiset/insert_rvalue.pass.cpp @@ -18,6 +18,7 @@ #include #include +#include "test_macros.h" #include "MoveOnly.h" #include "min_allocator.h" @@ -44,7 +45,7 @@ int main() assert(c.size() == 4); assert(*r == 5.5); } -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES +#if TEST_STD_VER >= 11 { typedef std::unordered_multiset C; typedef C::iterator R; @@ -66,8 +67,6 @@ int main() assert(c.size() == 4); assert(*r == 5); } -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES -#if TEST_STD_VER >= 11 { typedef std::unordered_multiset, std::equal_to, min_allocator> C; @@ -90,7 +89,6 @@ int main() assert(c.size() == 4); assert(*r == 5.5); } -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES { typedef std::unordered_multiset, std::equal_to, min_allocator> C; @@ -113,6 +111,5 @@ int main() assert(c.size() == 4); assert(*r == 5); } -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES -#endif +#endif // TEST_STD_VER >= 11 } diff --git a/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/assign_init.pass.cpp b/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/assign_init.pass.cpp index 3e4230530..ce664034d 100644 --- a/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/assign_init.pass.cpp +++ b/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/assign_init.pass.cpp @@ -7,6 +7,8 @@ // //===----------------------------------------------------------------------===// +// UNSUPPORTED: c++98, c++03 + // // template , class Pred = equal_to, @@ -27,7 +29,6 @@ int main() { -#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS { typedef test_allocator A; typedef std::unordered_multiset= 11 { typedef min_allocator A; typedef std::unordered_multiset // template , class Pred = equal_to, @@ -28,7 +30,6 @@ int main() { -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES { typedef test_allocator A; typedef std::unordered_multiset= 11 { typedef test_allocator A; typedef std::unordered_multiset= 1 - { - std::unordered_multiset s1 = {1, 2, 3}; - std::unordered_multiset::iterator i = s1.begin(); - int k = *i; - std::unordered_multiset s2; - s2 = std::move(s1); - assert(*i == k); - s2.erase(i); - assert(s2.size() == 2); - } -#endif -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES } diff --git a/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/init.pass.cpp b/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/init.pass.cpp index ced52b5e6..df49abe07 100644 --- a/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/init.pass.cpp +++ b/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/init.pass.cpp @@ -7,6 +7,8 @@ // //===----------------------------------------------------------------------===// +// UNSUPPORTED: c++98, c++03 + // // template , class Pred = equal_to, @@ -28,7 +30,6 @@ int main() { -#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS { typedef std::unordered_multiset >, @@ -59,7 +60,6 @@ int main() assert(fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON); assert(c.max_load_factor() == 1); } -#if TEST_STD_VER >= 11 { typedef std::unordered_multiset >, @@ -159,7 +159,5 @@ int main() assert(fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON); assert(c.max_load_factor() == 1); } -#endif -#endif -#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS +#endif // TEST_STD_VER > 11 } diff --git a/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/init_size.pass.cpp b/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/init_size.pass.cpp index 845139f98..b83507934 100644 --- a/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/init_size.pass.cpp +++ b/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/init_size.pass.cpp @@ -7,6 +7,8 @@ // //===----------------------------------------------------------------------===// +// UNSUPPORTED: c++98, c++03 + // // template , class Pred = equal_to, @@ -29,7 +31,6 @@ int main() { -#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS { typedef std::unordered_multiset >, @@ -62,7 +63,6 @@ int main() assert(std::fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON); assert(c.max_load_factor() == 1); } -#if TEST_STD_VER >= 11 { typedef std::unordered_multiset >, @@ -95,6 +95,4 @@ int main() assert(std::fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON); assert(c.max_load_factor() == 1); } -#endif -#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS } diff --git a/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/init_size_hash.pass.cpp b/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/init_size_hash.pass.cpp index 4dc78bd26..92edfc35b 100644 --- a/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/init_size_hash.pass.cpp +++ b/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/init_size_hash.pass.cpp @@ -7,6 +7,8 @@ // //===----------------------------------------------------------------------===// +// UNSUPPORTED: c++98, c++03 + // // template , class Pred = equal_to, @@ -30,7 +32,6 @@ int main() { -#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS { typedef std::unordered_multiset >, @@ -64,7 +65,6 @@ int main() assert(std::fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON); assert(c.max_load_factor() == 1); } -#if TEST_STD_VER >= 11 { typedef std::unordered_multiset >, @@ -98,6 +98,4 @@ int main() assert(std::fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON); assert(c.max_load_factor() == 1); } -#endif -#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS } diff --git a/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/init_size_hash_equal.pass.cpp b/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/init_size_hash_equal.pass.cpp index f33120859..877306db6 100644 --- a/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/init_size_hash_equal.pass.cpp +++ b/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/init_size_hash_equal.pass.cpp @@ -7,6 +7,8 @@ // //===----------------------------------------------------------------------===// +// UNSUPPORTED: c++98, c++03 + // // template , class Pred = equal_to, @@ -30,7 +32,6 @@ int main() { -#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS { typedef std::unordered_multiset >, @@ -65,7 +66,6 @@ int main() assert(std::fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON); assert(c.max_load_factor() == 1); } -#if TEST_STD_VER >= 11 { typedef std::unordered_multiset >, @@ -100,6 +100,4 @@ int main() assert(std::fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON); assert(c.max_load_factor() == 1); } -#endif -#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS } diff --git a/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/init_size_hash_equal_allocator.pass.cpp b/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/init_size_hash_equal_allocator.pass.cpp index 17f064f46..e77be8463 100644 --- a/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/init_size_hash_equal_allocator.pass.cpp +++ b/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/init_size_hash_equal_allocator.pass.cpp @@ -7,6 +7,8 @@ // //===----------------------------------------------------------------------===// +// UNSUPPORTED: c++98, c++03 + // // template , class Pred = equal_to, @@ -30,7 +32,6 @@ int main() { -#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS { typedef std::unordered_multiset >, @@ -66,7 +67,6 @@ int main() assert(std::fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON); assert(c.max_load_factor() == 1); } -#if TEST_STD_VER >= 11 { typedef std::unordered_multiset >, @@ -102,6 +102,4 @@ int main() assert(std::fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON); assert(c.max_load_factor() == 1); } -#endif -#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS } diff --git a/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/move_alloc.pass.cpp b/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/move_alloc.pass.cpp index bc804b42e..fb144d9b1 100644 --- a/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/move_alloc.pass.cpp +++ b/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/move_alloc.pass.cpp @@ -7,6 +7,8 @@ // //===----------------------------------------------------------------------===// +// UNSUPPORTED: c++98, c++03 + // // template , class Pred = equal_to, @@ -29,7 +31,6 @@ int main() { -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES { typedef int P; typedef test_allocator A; @@ -120,7 +121,6 @@ int main() assert(c0.empty()); } -#if TEST_STD_VER >= 11 { typedef int P; typedef min_allocator A; @@ -203,6 +203,4 @@ int main() assert(c0.empty()); } -#endif -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES } diff --git a/test/std/containers/unord/unord.set/emplace.pass.cpp b/test/std/containers/unord/unord.set/emplace.pass.cpp index 19af80658..c09ad1505 100644 --- a/test/std/containers/unord/unord.set/emplace.pass.cpp +++ b/test/std/containers/unord/unord.set/emplace.pass.cpp @@ -7,6 +7,8 @@ // //===----------------------------------------------------------------------===// +// UNSUPPORTED: c++98, c++03 + // // template , class Pred = equal_to, @@ -24,7 +26,6 @@ int main() { -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES { typedef std::unordered_set C; typedef std::pair R; @@ -44,7 +45,6 @@ int main() assert(*r.first == Emplaceable(5, 6)); assert(!r.second); } -#if TEST_STD_VER >= 11 { typedef std::unordered_set, std::equal_to, min_allocator> C; @@ -65,6 +65,4 @@ int main() assert(*r.first == Emplaceable(5, 6)); assert(!r.second); } -#endif -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES } diff --git a/test/std/containers/unord/unord.set/emplace_hint.pass.cpp b/test/std/containers/unord/unord.set/emplace_hint.pass.cpp index 97f3591d0..16f9eff19 100644 --- a/test/std/containers/unord/unord.set/emplace_hint.pass.cpp +++ b/test/std/containers/unord/unord.set/emplace_hint.pass.cpp @@ -7,6 +7,8 @@ // //===----------------------------------------------------------------------===// +// UNSUPPORTED: c++98, c++03 + // // template , class Pred = equal_to, @@ -16,9 +18,6 @@ // template // iterator emplace_hint(const_iterator p, Args&&... args); -#if _LIBCPP_DEBUG >= 1 -#define _LIBCPP_ASSERT(x, m) ((x) ? (void)0 : std::exit(0)) -#endif #include #include @@ -28,7 +27,6 @@ int main() { -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES { typedef std::unordered_set C; typedef C::iterator R; @@ -46,7 +44,6 @@ int main() assert(c.size() == 2); assert(*r == Emplaceable(5, 6)); } -#if TEST_STD_VER >= 11 { typedef std::unordered_set, std::equal_to, min_allocator> C; @@ -65,16 +62,4 @@ int main() assert(c.size() == 2); assert(*r == Emplaceable(5, 6)); } -#endif -#if _LIBCPP_DEBUG >= 1 - { - typedef std::unordered_set C; - typedef C::iterator R; - C c1; - C c2; - R r = c1.emplace_hint(c2.begin(), 5, 6); - assert(false); - } -#endif -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES } diff --git a/test/std/containers/unord/unord.set/insert_hint_rvalue.pass.cpp b/test/std/containers/unord/unord.set/insert_hint_rvalue.pass.cpp index da94bc553..676c39527 100644 --- a/test/std/containers/unord/unord.set/insert_hint_rvalue.pass.cpp +++ b/test/std/containers/unord/unord.set/insert_hint_rvalue.pass.cpp @@ -15,13 +15,10 @@ // iterator insert(const_iterator p, value_type&& x); -#if _LIBCPP_DEBUG >= 1 -#define _LIBCPP_ASSERT(x, m) ((x) ? (void)0 : std::exit(0)) -#endif - #include #include +#include "test_macros.h" #include "MoveOnly.h" #include "min_allocator.h" @@ -49,7 +46,7 @@ int main() assert(c.size() == 3); assert(*r == 5.5); } -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES +#if TEST_STD_VER >= 11 { typedef std::unordered_set C; typedef C::iterator R; @@ -72,8 +69,6 @@ int main() assert(c.size() == 3); assert(*r == 5); } -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES -#if TEST_STD_VER >= 11 { typedef std::unordered_set, std::equal_to, min_allocator> C; @@ -97,7 +92,6 @@ int main() assert(c.size() == 3); assert(*r == 5.5); } -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES { typedef std::unordered_set, std::equal_to, min_allocator> C; @@ -121,18 +115,5 @@ int main() assert(c.size() == 3); assert(*r == 5); } -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES -#if _LIBCPP_DEBUG >= 1 - { - typedef std::unordered_set C; - typedef C::iterator R; - typedef C::value_type P; - C c; - C c2; - C::const_iterator e = c2.end(); - R r = c.insert(e, P(3.5)); - assert(false); - } -#endif -#endif +#endif // TEST_STD_VER >= 11 } diff --git a/test/std/containers/unord/unord.set/insert_init.pass.cpp b/test/std/containers/unord/unord.set/insert_init.pass.cpp index 27b7290eb..c106fed10 100644 --- a/test/std/containers/unord/unord.set/insert_init.pass.cpp +++ b/test/std/containers/unord/unord.set/insert_init.pass.cpp @@ -7,6 +7,8 @@ // //===----------------------------------------------------------------------===// +// UNSUPPORTED: c++98, c++03 + // // template , class Pred = equal_to, @@ -23,7 +25,6 @@ int main() { -#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS { typedef std::unordered_set C; typedef int P; @@ -44,7 +45,6 @@ int main() assert(c.count(3) == 1); assert(c.count(4) == 1); } -#if TEST_STD_VER >= 11 { typedef std::unordered_set, std::equal_to, min_allocator> C; @@ -66,6 +66,4 @@ int main() assert(c.count(3) == 1); assert(c.count(4) == 1); } -#endif -#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS } diff --git a/test/std/containers/unord/unord.set/insert_rvalue.pass.cpp b/test/std/containers/unord/unord.set/insert_rvalue.pass.cpp index 5d12f225c..45b168d89 100644 --- a/test/std/containers/unord/unord.set/insert_rvalue.pass.cpp +++ b/test/std/containers/unord/unord.set/insert_rvalue.pass.cpp @@ -18,6 +18,7 @@ #include #include +#include "test_macros.h" #include "MoveOnly.h" #include "min_allocator.h" @@ -48,7 +49,7 @@ int main() assert(*r.first == 5.5); assert(r.second); } -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES +#if TEST_STD_VER >= 11 { typedef std::unordered_set C; typedef std::pair R; @@ -74,8 +75,6 @@ int main() assert(*r.first == 5); assert(r.second); } -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES -#if TEST_STD_VER >= 11 { typedef std::unordered_set, std::equal_to, min_allocator> C; @@ -102,7 +101,6 @@ int main() assert(*r.first == 5.5); assert(r.second); } -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES { typedef std::unordered_set, std::equal_to, min_allocator> C; @@ -129,6 +127,5 @@ int main() assert(*r.first == 5); assert(r.second); } -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES -#endif +#endif // TEST_STD_VER >= 11 } diff --git a/test/std/containers/unord/unord.set/unord.set.cnstr/assign_init.pass.cpp b/test/std/containers/unord/unord.set/unord.set.cnstr/assign_init.pass.cpp index 2db01a21e..4f7ccfec6 100644 --- a/test/std/containers/unord/unord.set/unord.set.cnstr/assign_init.pass.cpp +++ b/test/std/containers/unord/unord.set/unord.set.cnstr/assign_init.pass.cpp @@ -7,6 +7,8 @@ // //===----------------------------------------------------------------------===// +// UNSUPPORTED: c++98, c++03 + // // template , class Pred = equal_to, @@ -27,7 +29,6 @@ int main() { -#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS { typedef test_allocator A; typedef std::unordered_set= 11 { typedef min_allocator A; typedef std::unordered_set // template , class Pred = equal_to, @@ -28,7 +30,6 @@ int main() { -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES { typedef test_allocator A; typedef std::unordered_set= 11 { typedef min_allocator A; typedef std::unordered_set= 1 - { - std::unordered_set s1 = {1, 2, 3}; - std::unordered_set::iterator i = s1.begin(); - int k = *i; - std::unordered_set s2; - s2 = std::move(s1); - assert(*i == k); - s2.erase(i); - assert(s2.size() == 2); - } -#endif -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES } diff --git a/test/std/containers/unord/unord.set/unord.set.cnstr/init.pass.cpp b/test/std/containers/unord/unord.set/unord.set.cnstr/init.pass.cpp index eea61c7ab..7ba340bf9 100644 --- a/test/std/containers/unord/unord.set/unord.set.cnstr/init.pass.cpp +++ b/test/std/containers/unord/unord.set/unord.set.cnstr/init.pass.cpp @@ -7,6 +7,8 @@ // //===----------------------------------------------------------------------===// +// UNSUPPORTED: c++98, c++03 + // // template , class Pred = equal_to, @@ -28,8 +30,7 @@ int main() { -#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS - { + { typedef std::unordered_set >, test_compare >, @@ -59,7 +60,6 @@ int main() assert(fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON); assert(c.max_load_factor() == 1); } -#if TEST_STD_VER >= 11 { typedef std::unordered_set >, @@ -160,6 +160,4 @@ int main() assert(c.max_load_factor() == 1); } #endif -#endif -#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS } diff --git a/test/std/containers/unord/unord.set/unord.set.cnstr/init_size.pass.cpp b/test/std/containers/unord/unord.set/unord.set.cnstr/init_size.pass.cpp index 95baa3df2..0ca9b4857 100644 --- a/test/std/containers/unord/unord.set/unord.set.cnstr/init_size.pass.cpp +++ b/test/std/containers/unord/unord.set/unord.set.cnstr/init_size.pass.cpp @@ -7,6 +7,8 @@ // //===----------------------------------------------------------------------===// +// UNSUPPORTED: c++98, c++03 + // // template , class Pred = equal_to, @@ -29,7 +31,6 @@ int main() { -#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS { typedef std::unordered_set >, @@ -62,7 +63,6 @@ int main() assert(std::fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON); assert(c.max_load_factor() == 1); } -#if TEST_STD_VER >= 11 { typedef std::unordered_set >, @@ -95,6 +95,4 @@ int main() assert(std::fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON); assert(c.max_load_factor() == 1); } -#endif -#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS } diff --git a/test/std/containers/unord/unord.set/unord.set.cnstr/init_size_hash.pass.cpp b/test/std/containers/unord/unord.set/unord.set.cnstr/init_size_hash.pass.cpp index 108d67b66..45ed588a7 100644 --- a/test/std/containers/unord/unord.set/unord.set.cnstr/init_size_hash.pass.cpp +++ b/test/std/containers/unord/unord.set/unord.set.cnstr/init_size_hash.pass.cpp @@ -7,6 +7,8 @@ // //===----------------------------------------------------------------------===// +// UNSUPPORTED: c++98, c++03 + // // template , class Pred = equal_to, @@ -30,7 +32,6 @@ int main() { -#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS { typedef std::unordered_set >, @@ -64,7 +65,6 @@ int main() assert(std::fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON); assert(c.max_load_factor() == 1); } -#if TEST_STD_VER >= 11 { typedef std::unordered_set >, @@ -98,6 +98,4 @@ int main() assert(std::fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON); assert(c.max_load_factor() == 1); } -#endif -#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS } diff --git a/test/std/containers/unord/unord.set/unord.set.cnstr/init_size_hash_equal.pass.cpp b/test/std/containers/unord/unord.set/unord.set.cnstr/init_size_hash_equal.pass.cpp index 5cb4d499a..8ace22a58 100644 --- a/test/std/containers/unord/unord.set/unord.set.cnstr/init_size_hash_equal.pass.cpp +++ b/test/std/containers/unord/unord.set/unord.set.cnstr/init_size_hash_equal.pass.cpp @@ -7,6 +7,8 @@ // //===----------------------------------------------------------------------===// +// UNSUPPORTED: c++98, c++03 + // // template , class Pred = equal_to, @@ -30,7 +32,6 @@ int main() { -#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS { typedef std::unordered_set >, @@ -65,7 +66,6 @@ int main() assert(std::fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON); assert(c.max_load_factor() == 1); } -#if TEST_STD_VER >= 11 { typedef std::unordered_set >, @@ -100,6 +100,4 @@ int main() assert(std::fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON); assert(c.max_load_factor() == 1); } -#endif -#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS } diff --git a/test/std/containers/unord/unord.set/unord.set.cnstr/init_size_hash_equal_allocator.pass.cpp b/test/std/containers/unord/unord.set/unord.set.cnstr/init_size_hash_equal_allocator.pass.cpp index 7c1cbc866..4fd50a818 100644 --- a/test/std/containers/unord/unord.set/unord.set.cnstr/init_size_hash_equal_allocator.pass.cpp +++ b/test/std/containers/unord/unord.set/unord.set.cnstr/init_size_hash_equal_allocator.pass.cpp @@ -7,6 +7,8 @@ // //===----------------------------------------------------------------------===// +// UNSUPPORTED: c++98, c++03 + // // template , class Pred = equal_to, @@ -30,7 +32,6 @@ int main() { -#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS { typedef std::unordered_set >, @@ -66,7 +67,6 @@ int main() assert(std::fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON); assert(c.max_load_factor() == 1); } -#if TEST_STD_VER >= 11 { typedef std::unordered_set >, @@ -102,6 +102,4 @@ int main() assert(std::fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON); assert(c.max_load_factor() == 1); } -#endif -#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS } diff --git a/test/std/containers/unord/unord.set/unord.set.cnstr/move_alloc.pass.cpp b/test/std/containers/unord/unord.set/unord.set.cnstr/move_alloc.pass.cpp index 4d2830b3a..bcd10b077 100644 --- a/test/std/containers/unord/unord.set/unord.set.cnstr/move_alloc.pass.cpp +++ b/test/std/containers/unord/unord.set/unord.set.cnstr/move_alloc.pass.cpp @@ -7,6 +7,8 @@ // //===----------------------------------------------------------------------===// +// UNSUPPORTED: c++98, c++03 + // // template , class Pred = equal_to, @@ -28,7 +30,6 @@ int main() { -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES { typedef int P; typedef test_allocator A; @@ -111,7 +112,6 @@ int main() assert(c0.empty()); } -#if TEST_STD_VER >= 11 { typedef int P; typedef min_allocator A; @@ -153,6 +153,4 @@ int main() assert(c0.empty()); } -#endif -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES } diff --git a/test/std/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.observers/op_arrow.fail.cpp b/test/std/depr/depr.function.objects/depr.adaptors/depr.function.pointer.adaptors/pointer_to_binary_function.cxx1z.fail.cpp similarity index 58% rename from test/std/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.observers/op_arrow.fail.cpp rename to test/std/depr/depr.function.objects/depr.adaptors/depr.function.pointer.adaptors/pointer_to_binary_function.cxx1z.fail.cpp index 1c90ba76a..fc37c9a59 100644 --- a/test/std/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.observers/op_arrow.fail.cpp +++ b/test/std/depr/depr.function.objects/depr.adaptors/depr.function.pointer.adaptors/pointer_to_binary_function.cxx1z.fail.cpp @@ -7,24 +7,19 @@ // //===----------------------------------------------------------------------===// -// +// +// pointer_to_binary_function +// UNSUPPORTED: c++98, c++03, c++11, c++14 -// unique_ptr - -// test op->() - -#include +#include +#include #include -struct A -{ - int i_; +#include "test_macros.h" - A() : i_(7) {} -}; +double binary_f(int i, short j) {return i - j + .75;} int main() { - std::unique_ptr p(new A); - assert(p->i_ == 7); + typedef std::pointer_to_binary_function F; } diff --git a/test/std/depr/depr.function.objects/depr.adaptors/depr.function.pointer.adaptors/pointer_to_binary_function.pass.cpp b/test/std/depr/depr.function.objects/depr.adaptors/depr.function.pointer.adaptors/pointer_to_binary_function.pass.cpp index 41c99998c..e47731a65 100644 --- a/test/std/depr/depr.function.objects/depr.adaptors/depr.function.pointer.adaptors/pointer_to_binary_function.pass.cpp +++ b/test/std/depr/depr.function.objects/depr.adaptors/depr.function.pointer.adaptors/pointer_to_binary_function.pass.cpp @@ -8,6 +8,7 @@ //===----------------------------------------------------------------------===// // +// REQUIRES: c++98 || c++03 || c++11 || c++14 // pointer_to_binary_function diff --git a/test/std/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.modifiers/release.pass.cpp b/test/std/depr/depr.function.objects/depr.adaptors/depr.function.pointer.adaptors/pointer_to_unary_function.cxx1z.fail.cpp similarity index 60% rename from test/std/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.modifiers/release.pass.cpp rename to test/std/depr/depr.function.objects/depr.adaptors/depr.function.pointer.adaptors/pointer_to_unary_function.cxx1z.fail.cpp index d79a4e396..687a819a3 100644 --- a/test/std/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.modifiers/release.pass.cpp +++ b/test/std/depr/depr.function.objects/depr.adaptors/depr.function.pointer.adaptors/pointer_to_unary_function.cxx1z.fail.cpp @@ -7,21 +7,19 @@ // //===----------------------------------------------------------------------===// -// +// +// pointer_to_unary_function +// UNSUPPORTED: c++98, c++03, c++11, c++14 -// unique_ptr - -// test release - -#include +#include +#include #include +#include "test_macros.h" + +double unary_f(int i) {return 0.5 - i;} + int main() { - std::unique_ptr p(new int[3]); - int* i = p.get(); - int* j = p.release(); - assert(p.get() == 0); - assert(i == j); - delete [] j; + typedef std::pointer_to_unary_function F; } diff --git a/test/std/depr/depr.function.objects/depr.adaptors/depr.function.pointer.adaptors/pointer_to_unary_function.pass.cpp b/test/std/depr/depr.function.objects/depr.adaptors/depr.function.pointer.adaptors/pointer_to_unary_function.pass.cpp index 126cf32af..2d713b3be 100644 --- a/test/std/depr/depr.function.objects/depr.adaptors/depr.function.pointer.adaptors/pointer_to_unary_function.pass.cpp +++ b/test/std/depr/depr.function.objects/depr.adaptors/depr.function.pointer.adaptors/pointer_to_unary_function.pass.cpp @@ -8,6 +8,7 @@ //===----------------------------------------------------------------------===// // +// REQUIRES: c++98 || c++03 || c++11 || c++14 // pointer_to_unary_function diff --git a/test/std/utilities/memory/unique.ptr/unique.ptr.runtime/move01.fail.cpp b/test/std/depr/depr.function.objects/depr.adaptors/depr.function.pointer.adaptors/ptr_fun1.cxx1z.fail.cpp similarity index 53% rename from test/std/utilities/memory/unique.ptr/unique.ptr.runtime/move01.fail.cpp rename to test/std/depr/depr.function.objects/depr.adaptors/depr.function.pointer.adaptors/ptr_fun1.cxx1z.fail.cpp index ed94c1a1e..2d2321936 100644 --- a/test/std/utilities/memory/unique.ptr/unique.ptr.runtime/move01.fail.cpp +++ b/test/std/depr/depr.function.objects/depr.adaptors/depr.function.pointer.adaptors/ptr_fun1.cxx1z.fail.cpp @@ -7,22 +7,22 @@ // //===----------------------------------------------------------------------===// -// +// -// unique_ptr +// template +// pointer_to_unary_function +// ptr_fun(Result (*f)(Arg)); +// UNSUPPORTED: c++98, c++03, c++11, c++14 -// Test unique_ptr move assignment - -#include +#include +#include +#include #include "test_macros.h" +double unary_f(int i) {return 0.5 - i;} + int main() { - std::unique_ptr 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 + assert(std::ptr_fun(unary_f)(36) == -35.5); } diff --git a/test/std/depr/depr.function.objects/depr.adaptors/depr.function.pointer.adaptors/ptr_fun1.pass.cpp b/test/std/depr/depr.function.objects/depr.adaptors/depr.function.pointer.adaptors/ptr_fun1.pass.cpp index c7ce90df3..65f2a8d34 100644 --- a/test/std/depr/depr.function.objects/depr.adaptors/depr.function.pointer.adaptors/ptr_fun1.pass.cpp +++ b/test/std/depr/depr.function.objects/depr.adaptors/depr.function.pointer.adaptors/ptr_fun1.pass.cpp @@ -8,6 +8,7 @@ //===----------------------------------------------------------------------===// // +// REQUIRES: c++98 || c++03 || c++11 || c++14 // template // pointer_to_unary_function diff --git a/test/std/utilities/memory/unique.ptr/unique.ptr.runtime/pointer_type.pass.cpp b/test/std/depr/depr.function.objects/depr.adaptors/depr.function.pointer.adaptors/ptr_fun2.cxx1z.fail.cpp similarity index 50% rename from test/std/utilities/memory/unique.ptr/unique.ptr.runtime/pointer_type.pass.cpp rename to test/std/depr/depr.function.objects/depr.adaptors/depr.function.pointer.adaptors/ptr_fun2.cxx1z.fail.cpp index e7ad6ad7e..202abe25e 100644 --- a/test/std/utilities/memory/unique.ptr/unique.ptr.runtime/pointer_type.pass.cpp +++ b/test/std/depr/depr.function.objects/depr.adaptors/depr.function.pointer.adaptors/ptr_fun2.cxx1z.fail.cpp @@ -7,28 +7,22 @@ // //===----------------------------------------------------------------------===// -// +// -// unique_ptr +// template +// pointer_to_binary_function +// ptr_fun(Result (*f)(Arg1, Arg2)); +// UNSUPPORTED: c++98, c++03, c++11, c++14 -// Test unique_ptr::pointer type - -#include +#include #include +#include -struct Deleter -{ - struct pointer {}; -}; +#include "test_macros.h" + +double binary_f(int i, short j) {return i - j + .75;} int main() { - { - typedef std::unique_ptr P; - static_assert((std::is_same::value), ""); - } - { - typedef std::unique_ptr P; - static_assert((std::is_same::value), ""); - } + assert(std::ptr_fun(binary_f)(36, 27) == 9.75); } diff --git a/test/std/depr/depr.function.objects/depr.adaptors/depr.function.pointer.adaptors/ptr_fun2.pass.cpp b/test/std/depr/depr.function.objects/depr.adaptors/depr.function.pointer.adaptors/ptr_fun2.pass.cpp index 17c4b611a..5628c026c 100644 --- a/test/std/depr/depr.function.objects/depr.adaptors/depr.function.pointer.adaptors/ptr_fun2.pass.cpp +++ b/test/std/depr/depr.function.objects/depr.adaptors/depr.function.pointer.adaptors/ptr_fun2.pass.cpp @@ -8,6 +8,7 @@ //===----------------------------------------------------------------------===// // +// REQUIRES: c++98 || c++03 || c++11 || c++14 // template // pointer_to_binary_function diff --git a/test/std/depr/depr.function.objects/depr.adaptors/depr.member.pointer.adaptors/const_mem_fun.cxx1z.fail.cpp b/test/std/depr/depr.function.objects/depr.adaptors/depr.member.pointer.adaptors/const_mem_fun.cxx1z.fail.cpp new file mode 100644 index 000000000..1c56aa9f5 --- /dev/null +++ b/test/std/depr/depr.function.objects/depr.adaptors/depr.member.pointer.adaptors/const_mem_fun.cxx1z.fail.cpp @@ -0,0 +1,35 @@ +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// + +// template +// const_mem_fun_t +// mem_fun(S (T::*f)() const); +// Removed in c++1z +// UNSUPPORTED: c++98, c++03, c++11, c++14 + +#include +#include + +#include "test_macros.h" + +struct A +{ + char a1() {return 5;} + short a2(int i) {return short(i+1);} + int a3() const {return 1;} + double a4(unsigned i) const {return i-1;} +}; + +int main() +{ + const A a = A(); + assert(std::mem_fun(&A::a3)(&a) == 1); +} diff --git a/test/std/depr/depr.function.objects/depr.adaptors/depr.member.pointer.adaptors/const_mem_fun.pass.cpp b/test/std/depr/depr.function.objects/depr.adaptors/depr.member.pointer.adaptors/const_mem_fun.pass.cpp index 455eed9b3..4693c816c 100644 --- a/test/std/depr/depr.function.objects/depr.adaptors/depr.member.pointer.adaptors/const_mem_fun.pass.cpp +++ b/test/std/depr/depr.function.objects/depr.adaptors/depr.member.pointer.adaptors/const_mem_fun.pass.cpp @@ -8,6 +8,7 @@ //===----------------------------------------------------------------------===// // +// REQUIRES: c++98 || c++03 || c++11 || c++14 // template // const_mem_fun_t diff --git a/test/std/depr/depr.function.objects/depr.adaptors/depr.member.pointer.adaptors/const_mem_fun1.cxx1z.fail.cpp b/test/std/depr/depr.function.objects/depr.adaptors/depr.member.pointer.adaptors/const_mem_fun1.cxx1z.fail.cpp new file mode 100644 index 000000000..c727e955b --- /dev/null +++ b/test/std/depr/depr.function.objects/depr.adaptors/depr.member.pointer.adaptors/const_mem_fun1.cxx1z.fail.cpp @@ -0,0 +1,35 @@ +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// + +// template +// const_mem_fun1_t +// mem_fun(S (T::*f)(A) const); +// Removed in c++1z +// UNSUPPORTED: c++98, c++03, c++11, c++14 + +#include +#include + +#include "test_macros.h" + +struct A +{ + char a1() {return 5;} + short a2(int i) {return short(i+1);} + int a3() const {return 1;} + double a4(unsigned i) const {return i-1;} +}; + +int main() +{ + const A a = A(); + assert(std::mem_fun(&A::a4)(&a, 6) == 5); +} diff --git a/test/std/depr/depr.function.objects/depr.adaptors/depr.member.pointer.adaptors/const_mem_fun1.pass.cpp b/test/std/depr/depr.function.objects/depr.adaptors/depr.member.pointer.adaptors/const_mem_fun1.pass.cpp index 46fd6d28d..9f0b605d9 100644 --- a/test/std/depr/depr.function.objects/depr.adaptors/depr.member.pointer.adaptors/const_mem_fun1.pass.cpp +++ b/test/std/depr/depr.function.objects/depr.adaptors/depr.member.pointer.adaptors/const_mem_fun1.pass.cpp @@ -8,6 +8,7 @@ //===----------------------------------------------------------------------===// // +// REQUIRES: c++98 || c++03 || c++11 || c++14 // template // const_mem_fun1_t diff --git a/test/std/depr/depr.function.objects/depr.adaptors/depr.member.pointer.adaptors/const_mem_fun1_ref_t.cxx1z.fail.cpp b/test/std/depr/depr.function.objects/depr.adaptors/depr.member.pointer.adaptors/const_mem_fun1_ref_t.cxx1z.fail.cpp new file mode 100644 index 000000000..39b3112da --- /dev/null +++ b/test/std/depr/depr.function.objects/depr.adaptors/depr.member.pointer.adaptors/const_mem_fun1_ref_t.cxx1z.fail.cpp @@ -0,0 +1,33 @@ +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// + +// const_mem_fun1_ref_t +// Removed in c++1z +// UNSUPPORTED: c++98, c++03, c++11, c++14 + +#include +#include +#include + +#include "test_macros.h" + +struct A +{ + char a1() {return 5;} + short a2(int i) {return short(i+1);} + int a3() const {return 1;} + double a4(unsigned i) const {return i-1;} +}; + +int main() +{ + typedef std::const_mem_fun1_ref_t F; +} diff --git a/test/std/depr/depr.function.objects/depr.adaptors/depr.member.pointer.adaptors/const_mem_fun1_ref_t.pass.cpp b/test/std/depr/depr.function.objects/depr.adaptors/depr.member.pointer.adaptors/const_mem_fun1_ref_t.pass.cpp index 0c4bb93ff..65fc8c07e 100644 --- a/test/std/depr/depr.function.objects/depr.adaptors/depr.member.pointer.adaptors/const_mem_fun1_ref_t.pass.cpp +++ b/test/std/depr/depr.function.objects/depr.adaptors/depr.member.pointer.adaptors/const_mem_fun1_ref_t.pass.cpp @@ -8,6 +8,7 @@ //===----------------------------------------------------------------------===// // +// REQUIRES: c++98 || c++03 || c++11 || c++14 // const_mem_fun1_ref_t diff --git a/test/std/depr/depr.function.objects/depr.adaptors/depr.member.pointer.adaptors/const_mem_fun1_t.cxx1z.fail.cpp b/test/std/depr/depr.function.objects/depr.adaptors/depr.member.pointer.adaptors/const_mem_fun1_t.cxx1z.fail.cpp new file mode 100644 index 000000000..f07a3b798 --- /dev/null +++ b/test/std/depr/depr.function.objects/depr.adaptors/depr.member.pointer.adaptors/const_mem_fun1_t.cxx1z.fail.cpp @@ -0,0 +1,33 @@ +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// + +// const_mem_fun1_t +// Removed in c++1z +// UNSUPPORTED: c++98, c++03, c++11, c++14 + +#include +#include +#include + +#include "test_macros.h" + +struct A +{ + char a1() {return 5;} + short a2(int i) {return short(i+1);} + int a3() const {return 1;} + double a4(unsigned i) const {return i-1;} +}; + +int main() +{ + typedef std::const_mem_fun1_t F; +} diff --git a/test/std/depr/depr.function.objects/depr.adaptors/depr.member.pointer.adaptors/const_mem_fun1_t.pass.cpp b/test/std/depr/depr.function.objects/depr.adaptors/depr.member.pointer.adaptors/const_mem_fun1_t.pass.cpp index ca670bcde..71588fa1f 100644 --- a/test/std/depr/depr.function.objects/depr.adaptors/depr.member.pointer.adaptors/const_mem_fun1_t.pass.cpp +++ b/test/std/depr/depr.function.objects/depr.adaptors/depr.member.pointer.adaptors/const_mem_fun1_t.pass.cpp @@ -8,6 +8,7 @@ //===----------------------------------------------------------------------===// // +// REQUIRES: c++98 || c++03 || c++11 || c++14 // const_mem_fun1_t diff --git a/test/std/depr/depr.function.objects/depr.adaptors/depr.member.pointer.adaptors/const_mem_fun_ref.cxx1z.fail.cpp b/test/std/depr/depr.function.objects/depr.adaptors/depr.member.pointer.adaptors/const_mem_fun_ref.cxx1z.fail.cpp new file mode 100644 index 000000000..fea1441b3 --- /dev/null +++ b/test/std/depr/depr.function.objects/depr.adaptors/depr.member.pointer.adaptors/const_mem_fun_ref.cxx1z.fail.cpp @@ -0,0 +1,35 @@ +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// + +// template +// const_mem_fun_ref_t +// mem_fun_ref(S (T::*f)() const); +// Removed in c++1z +// UNSUPPORTED: c++98, c++03, c++11, c++14 + +#include +#include + +#include "test_macros.h" + +struct A +{ + char a1() {return 5;} + short a2(int i) {return short(i+1);} + int a3() const {return 1;} + double a4(unsigned i) const {return i-1;} +}; + +int main() +{ + const A a = A(); + assert(std::mem_fun_ref(&A::a3)(a) == 1); +} diff --git a/test/std/depr/depr.function.objects/depr.adaptors/depr.member.pointer.adaptors/const_mem_fun_ref.pass.cpp b/test/std/depr/depr.function.objects/depr.adaptors/depr.member.pointer.adaptors/const_mem_fun_ref.pass.cpp index 74d8950de..22f44c65c 100644 --- a/test/std/depr/depr.function.objects/depr.adaptors/depr.member.pointer.adaptors/const_mem_fun_ref.pass.cpp +++ b/test/std/depr/depr.function.objects/depr.adaptors/depr.member.pointer.adaptors/const_mem_fun_ref.pass.cpp @@ -8,6 +8,7 @@ //===----------------------------------------------------------------------===// // +// REQUIRES: c++98 || c++03 || c++11 || c++14 // template // const_mem_fun_ref_t diff --git a/test/std/depr/depr.function.objects/depr.adaptors/depr.member.pointer.adaptors/const_mem_fun_ref1.cxx1z.fail.cpp b/test/std/depr/depr.function.objects/depr.adaptors/depr.member.pointer.adaptors/const_mem_fun_ref1.cxx1z.fail.cpp new file mode 100644 index 000000000..f993b7ce1 --- /dev/null +++ b/test/std/depr/depr.function.objects/depr.adaptors/depr.member.pointer.adaptors/const_mem_fun_ref1.cxx1z.fail.cpp @@ -0,0 +1,35 @@ +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// + +// template +// const_mem_fun1_ref_t +// mem_fun_ref(S (T::*f)(A) const); +// Removed in c++1z +// UNSUPPORTED: c++98, c++03, c++11, c++14 + +#include +#include + +#include "test_macros.h" + +struct A +{ + char a1() {return 5;} + short a2(int i) {return short(i+1);} + int a3() const {return 1;} + double a4(unsigned i) const {return i-1;} +}; + +int main() +{ + const A a = A(); + assert(std::mem_fun_ref(&A::a4)(a, 6) == 5); +} diff --git a/test/std/depr/depr.function.objects/depr.adaptors/depr.member.pointer.adaptors/const_mem_fun_ref1.pass.cpp b/test/std/depr/depr.function.objects/depr.adaptors/depr.member.pointer.adaptors/const_mem_fun_ref1.pass.cpp index b858561ae..267b80681 100644 --- a/test/std/depr/depr.function.objects/depr.adaptors/depr.member.pointer.adaptors/const_mem_fun_ref1.pass.cpp +++ b/test/std/depr/depr.function.objects/depr.adaptors/depr.member.pointer.adaptors/const_mem_fun_ref1.pass.cpp @@ -8,6 +8,7 @@ //===----------------------------------------------------------------------===// // +// REQUIRES: c++98 || c++03 || c++11 || c++14 // template // const_mem_fun1_ref_t diff --git a/test/std/depr/depr.function.objects/depr.adaptors/depr.member.pointer.adaptors/const_mem_fun_ref_t.cxx1z.fail.cpp b/test/std/depr/depr.function.objects/depr.adaptors/depr.member.pointer.adaptors/const_mem_fun_ref_t.cxx1z.fail.cpp new file mode 100644 index 000000000..e195213f9 --- /dev/null +++ b/test/std/depr/depr.function.objects/depr.adaptors/depr.member.pointer.adaptors/const_mem_fun_ref_t.cxx1z.fail.cpp @@ -0,0 +1,33 @@ +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// + +// const_mem_fun_ref_t +// Removed in c++1z +// UNSUPPORTED: c++98, c++03, c++11, c++14 + +#include +#include +#include + +#include "test_macros.h" + +struct A +{ + char a1() {return 5;} + short a2(int i) {return short(i+1);} + int a3() const {return 1;} + double a4(unsigned i) const {return i-1;} +}; + +int main() +{ + typedef std::const_mem_fun_ref_t F; +} diff --git a/test/std/depr/depr.function.objects/depr.adaptors/depr.member.pointer.adaptors/const_mem_fun_ref_t.pass.cpp b/test/std/depr/depr.function.objects/depr.adaptors/depr.member.pointer.adaptors/const_mem_fun_ref_t.pass.cpp index 9eec24e57..6f80993cb 100644 --- a/test/std/depr/depr.function.objects/depr.adaptors/depr.member.pointer.adaptors/const_mem_fun_ref_t.pass.cpp +++ b/test/std/depr/depr.function.objects/depr.adaptors/depr.member.pointer.adaptors/const_mem_fun_ref_t.pass.cpp @@ -8,6 +8,7 @@ //===----------------------------------------------------------------------===// // +// REQUIRES: c++98 || c++03 || c++11 || c++14 // const_mem_fun_ref_t diff --git a/test/std/depr/depr.function.objects/depr.adaptors/depr.member.pointer.adaptors/const_mem_fun_t.cxx1z.fail.cpp b/test/std/depr/depr.function.objects/depr.adaptors/depr.member.pointer.adaptors/const_mem_fun_t.cxx1z.fail.cpp new file mode 100644 index 000000000..228eb3da6 --- /dev/null +++ b/test/std/depr/depr.function.objects/depr.adaptors/depr.member.pointer.adaptors/const_mem_fun_t.cxx1z.fail.cpp @@ -0,0 +1,33 @@ +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// + +// const_mem_fun_t +// Removed in c++1z +// UNSUPPORTED: c++98, c++03, c++11, c++14 + +#include +#include +#include + +#include "test_macros.h" + +struct A +{ + char a1() {return 5;} + short a2(int i) {return short(i+1);} + int a3() const {return 1;} + double a4(unsigned i) const {return i-1;} +}; + +int main() +{ + typedef std::const_mem_fun_t F; +} diff --git a/test/std/depr/depr.function.objects/depr.adaptors/depr.member.pointer.adaptors/const_mem_fun_t.pass.cpp b/test/std/depr/depr.function.objects/depr.adaptors/depr.member.pointer.adaptors/const_mem_fun_t.pass.cpp index 9681b74d7..01945fc46 100644 --- a/test/std/depr/depr.function.objects/depr.adaptors/depr.member.pointer.adaptors/const_mem_fun_t.pass.cpp +++ b/test/std/depr/depr.function.objects/depr.adaptors/depr.member.pointer.adaptors/const_mem_fun_t.pass.cpp @@ -8,6 +8,7 @@ //===----------------------------------------------------------------------===// // +// REQUIRES: c++98 || c++03 || c++11 || c++14 // const_mem_fun_t diff --git a/test/std/utilities/memory/unique.ptr/unique.ptr.runtime/null_asgn.pass.cpp b/test/std/depr/depr.function.objects/depr.adaptors/depr.member.pointer.adaptors/mem_fun.cxx1z.fail.cpp similarity index 50% rename from test/std/utilities/memory/unique.ptr/unique.ptr.runtime/null_asgn.pass.cpp rename to test/std/depr/depr.function.objects/depr.adaptors/depr.member.pointer.adaptors/mem_fun.cxx1z.fail.cpp index e2d7956cd..8f59a1ae2 100644 --- a/test/std/utilities/memory/unique.ptr/unique.ptr.runtime/null_asgn.pass.cpp +++ b/test/std/depr/depr.function.objects/depr.adaptors/depr.member.pointer.adaptors/mem_fun.cxx1z.fail.cpp @@ -7,35 +7,29 @@ // //===----------------------------------------------------------------------===// -// +// -// unique_ptr +// template +// mem_fun_t +// mem_fun(S (T::*f)()); +// Removed in c++1z +// UNSUPPORTED: c++98, c++03, c++11, c++14 -// Test unique_ptr move assignment - -#include +#include #include -// test assignment from null +#include "test_macros.h" struct A { - static int count; - A() {++count;} - A(const A&) {++count;} - ~A() {--count;} + char a1() {return 5;} + short a2(int i) {return short(i+1);} + int a3() const {return 1;} + double a4(unsigned i) const {return i-1;} }; -int A::count = 0; - int main() { - { - std::unique_ptr s2(new A); - assert(A::count == 1); - s2 = 0; - assert(A::count == 0); - assert(s2.get() == 0); - } - assert(A::count == 0); + A a; + assert(std::mem_fun(&A::a1)(&a) == 5); } diff --git a/test/std/depr/depr.function.objects/depr.adaptors/depr.member.pointer.adaptors/mem_fun.pass.cpp b/test/std/depr/depr.function.objects/depr.adaptors/depr.member.pointer.adaptors/mem_fun.pass.cpp index d0d286009..f3c12973f 100644 --- a/test/std/depr/depr.function.objects/depr.adaptors/depr.member.pointer.adaptors/mem_fun.pass.cpp +++ b/test/std/depr/depr.function.objects/depr.adaptors/depr.member.pointer.adaptors/mem_fun.pass.cpp @@ -8,6 +8,7 @@ //===----------------------------------------------------------------------===// // +// REQUIRES: c++98 || c++03 || c++11 || c++14 // template // mem_fun_t diff --git a/test/std/depr/depr.function.objects/depr.adaptors/depr.member.pointer.adaptors/mem_fun1.cxx1z.fail.cpp b/test/std/depr/depr.function.objects/depr.adaptors/depr.member.pointer.adaptors/mem_fun1.cxx1z.fail.cpp new file mode 100644 index 000000000..6191de3fb --- /dev/null +++ b/test/std/depr/depr.function.objects/depr.adaptors/depr.member.pointer.adaptors/mem_fun1.cxx1z.fail.cpp @@ -0,0 +1,35 @@ +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// + +// template +// mem_fun1_t +// mem_fun(S (T::*f)(A)); +// Removed in c++1z +// UNSUPPORTED: c++98, c++03, c++11, c++14 + +#include +#include + +#include "test_macros.h" + +struct A +{ + char a1() {return 5;} + short a2(int i) {return short(i+1);} + int a3() const {return 1;} + double a4(unsigned i) const {return i-1;} +}; + +int main() +{ + A a; + assert(std::mem_fun(&A::a2)(&a, 5) == 6); +} diff --git a/test/std/depr/depr.function.objects/depr.adaptors/depr.member.pointer.adaptors/mem_fun1.pass.cpp b/test/std/depr/depr.function.objects/depr.adaptors/depr.member.pointer.adaptors/mem_fun1.pass.cpp index acee9afee..30f3c9422 100644 --- a/test/std/depr/depr.function.objects/depr.adaptors/depr.member.pointer.adaptors/mem_fun1.pass.cpp +++ b/test/std/depr/depr.function.objects/depr.adaptors/depr.member.pointer.adaptors/mem_fun1.pass.cpp @@ -8,6 +8,7 @@ //===----------------------------------------------------------------------===// // +// REQUIRES: c++98 || c++03 || c++11 || c++14 // template // mem_fun1_t diff --git a/test/std/depr/depr.function.objects/depr.adaptors/depr.member.pointer.adaptors/mem_fun1_ref_t.cxx1z.fail.cpp b/test/std/depr/depr.function.objects/depr.adaptors/depr.member.pointer.adaptors/mem_fun1_ref_t.cxx1z.fail.cpp new file mode 100644 index 000000000..0effd33f3 --- /dev/null +++ b/test/std/depr/depr.function.objects/depr.adaptors/depr.member.pointer.adaptors/mem_fun1_ref_t.cxx1z.fail.cpp @@ -0,0 +1,33 @@ +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// + +// mem_fun1_ref_t +// Removed in c++1z +// UNSUPPORTED: c++98, c++03, c++11, c++14 + +#include +#include +#include + +#include "test_macros.h" + +struct A +{ + char a1() {return 5;} + short a2(int i) {return short(i+1);} + int a3() const {return 1;} + double a4(unsigned i) const {return i-1;} +}; + +int main() +{ + typedef std::mem_fun1_ref_t F; +} diff --git a/test/std/depr/depr.function.objects/depr.adaptors/depr.member.pointer.adaptors/mem_fun1_ref_t.pass.cpp b/test/std/depr/depr.function.objects/depr.adaptors/depr.member.pointer.adaptors/mem_fun1_ref_t.pass.cpp index a78cbf25c..0b63bb76d 100644 --- a/test/std/depr/depr.function.objects/depr.adaptors/depr.member.pointer.adaptors/mem_fun1_ref_t.pass.cpp +++ b/test/std/depr/depr.function.objects/depr.adaptors/depr.member.pointer.adaptors/mem_fun1_ref_t.pass.cpp @@ -8,6 +8,7 @@ //===----------------------------------------------------------------------===// // +// REQUIRES: c++98 || c++03 || c++11 || c++14 // mem_fun1_ref_t diff --git a/test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.asgn/move_convert13.fail.cpp b/test/std/depr/depr.function.objects/depr.adaptors/depr.member.pointer.adaptors/mem_fun1_t.cxx1z.fail.cpp similarity index 53% rename from test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.asgn/move_convert13.fail.cpp rename to test/std/depr/depr.function.objects/depr.adaptors/depr.member.pointer.adaptors/mem_fun1_t.cxx1z.fail.cpp index 412648420..aa8e25abe 100644 --- a/test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.asgn/move_convert13.fail.cpp +++ b/test/std/depr/depr.function.objects/depr.adaptors/depr.member.pointer.adaptors/mem_fun1_t.cxx1z.fail.cpp @@ -7,30 +7,27 @@ // //===----------------------------------------------------------------------===// -// +// -// unique_ptr +// mem_fun1_t +// Removed in c++1z +// UNSUPPORTED: c++98, c++03, c++11, c++14 -// Test unique_ptr converting move assignment - -// Do not convert from an array unique_ptr - -#include -#include +#include +#include #include +#include "test_macros.h" + struct A { -}; - -struct Deleter -{ - void operator()(void*) {} + char a1() {return 5;} + short a2(int i) {return short(i+1);} + int a3() const {return 1;} + double a4(unsigned i) const {return i-1;} }; int main() { - std::unique_ptr s; - std::unique_ptr s2; - s2 = std::move(s); // expected-error {{no viable overloaded '='}} + typedef std::mem_fun1_t F; } diff --git a/test/std/depr/depr.function.objects/depr.adaptors/depr.member.pointer.adaptors/mem_fun1_t.pass.cpp b/test/std/depr/depr.function.objects/depr.adaptors/depr.member.pointer.adaptors/mem_fun1_t.pass.cpp index 90ba9bbf7..79895c4b4 100644 --- a/test/std/depr/depr.function.objects/depr.adaptors/depr.member.pointer.adaptors/mem_fun1_t.pass.cpp +++ b/test/std/depr/depr.function.objects/depr.adaptors/depr.member.pointer.adaptors/mem_fun1_t.pass.cpp @@ -8,6 +8,7 @@ //===----------------------------------------------------------------------===// // +// REQUIRES: c++98 || c++03 || c++11 || c++14 // mem_fun1_t diff --git a/test/std/depr/depr.function.objects/depr.adaptors/depr.member.pointer.adaptors/mem_fun_ref.cxx1z.fail.cpp b/test/std/depr/depr.function.objects/depr.adaptors/depr.member.pointer.adaptors/mem_fun_ref.cxx1z.fail.cpp new file mode 100644 index 000000000..ff7f28af8 --- /dev/null +++ b/test/std/depr/depr.function.objects/depr.adaptors/depr.member.pointer.adaptors/mem_fun_ref.cxx1z.fail.cpp @@ -0,0 +1,35 @@ +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// + +// template +// mem_fun_ref_t +// mem_fun_ref(S (T::*f)()); +// Removed in c++1z +// UNSUPPORTED: c++98, c++03, c++11, c++14 + +#include +#include + +#include "test_macros.h" + +struct A +{ + char a1() {return 5;} + short a2(int i) {return short(i+1);} + int a3() const {return 1;} + double a4(unsigned i) const {return i-1;} +}; + +int main() +{ + A a; + assert(std::mem_fun_ref(&A::a1)(a) == 5); +} diff --git a/test/std/depr/depr.function.objects/depr.adaptors/depr.member.pointer.adaptors/mem_fun_ref.pass.cpp b/test/std/depr/depr.function.objects/depr.adaptors/depr.member.pointer.adaptors/mem_fun_ref.pass.cpp index d3843fc53..8a6a8b943 100644 --- a/test/std/depr/depr.function.objects/depr.adaptors/depr.member.pointer.adaptors/mem_fun_ref.pass.cpp +++ b/test/std/depr/depr.function.objects/depr.adaptors/depr.member.pointer.adaptors/mem_fun_ref.pass.cpp @@ -8,6 +8,7 @@ //===----------------------------------------------------------------------===// // +// REQUIRES: c++98 || c++03 || c++11 || c++14 // template // mem_fun_ref_t diff --git a/test/std/depr/depr.function.objects/depr.adaptors/depr.member.pointer.adaptors/mem_fun_ref1.cxx1z.fail.cpp b/test/std/depr/depr.function.objects/depr.adaptors/depr.member.pointer.adaptors/mem_fun_ref1.cxx1z.fail.cpp new file mode 100644 index 000000000..82d47fefd --- /dev/null +++ b/test/std/depr/depr.function.objects/depr.adaptors/depr.member.pointer.adaptors/mem_fun_ref1.cxx1z.fail.cpp @@ -0,0 +1,35 @@ +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// + +// template +// mem_fun1_ref_t +// mem_fun_ref(S (T::*f)(A)); +// Removed in c++1z +// UNSUPPORTED: c++98, c++03, c++11, c++14 + +#include +#include + +#include "test_macros.h" + +struct A +{ + char a1() {return 5;} + short a2(int i) {return short(i+1);} + int a3() const {return 1;} + double a4(unsigned i) const {return i-1;} +}; + +int main() +{ + A a; + assert(std::mem_fun_ref(&A::a2)(a, 5) == 6); +} diff --git a/test/std/depr/depr.function.objects/depr.adaptors/depr.member.pointer.adaptors/mem_fun_ref1.pass.cpp b/test/std/depr/depr.function.objects/depr.adaptors/depr.member.pointer.adaptors/mem_fun_ref1.pass.cpp index 39a324d10..142b16a6b 100644 --- a/test/std/depr/depr.function.objects/depr.adaptors/depr.member.pointer.adaptors/mem_fun_ref1.pass.cpp +++ b/test/std/depr/depr.function.objects/depr.adaptors/depr.member.pointer.adaptors/mem_fun_ref1.pass.cpp @@ -8,6 +8,7 @@ //===----------------------------------------------------------------------===// // +// REQUIRES: c++98 || c++03 || c++11 || c++14 // template // mem_fun1_ref_t diff --git a/test/std/depr/depr.function.objects/depr.adaptors/depr.member.pointer.adaptors/mem_fun_ref_t.cxx1z.fail.cpp b/test/std/depr/depr.function.objects/depr.adaptors/depr.member.pointer.adaptors/mem_fun_ref_t.cxx1z.fail.cpp new file mode 100644 index 000000000..f1cf01c5c --- /dev/null +++ b/test/std/depr/depr.function.objects/depr.adaptors/depr.member.pointer.adaptors/mem_fun_ref_t.cxx1z.fail.cpp @@ -0,0 +1,33 @@ +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// + +// mem_fun_ref_t +// Removed in c++1z +// UNSUPPORTED: c++98, c++03, c++11, c++14 + +#include +#include +#include + +#include "test_macros.h" + +struct A +{ + char a1() {return 5;} + short a2(int i) {return short(i+1);} + int a3() const {return 1;} + double a4(unsigned i) const {return i-1;} +}; + +int main() +{ + typedef std::mem_fun_ref_t F; +} diff --git a/test/std/depr/depr.function.objects/depr.adaptors/depr.member.pointer.adaptors/mem_fun_ref_t.pass.cpp b/test/std/depr/depr.function.objects/depr.adaptors/depr.member.pointer.adaptors/mem_fun_ref_t.pass.cpp index 236d8d094..5af028b39 100644 --- a/test/std/depr/depr.function.objects/depr.adaptors/depr.member.pointer.adaptors/mem_fun_ref_t.pass.cpp +++ b/test/std/depr/depr.function.objects/depr.adaptors/depr.member.pointer.adaptors/mem_fun_ref_t.pass.cpp @@ -8,6 +8,7 @@ //===----------------------------------------------------------------------===// // +// REQUIRES: c++98 || c++03 || c++11 || c++14 // mem_fun_ref_t diff --git a/test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/move_convert13.fail.cpp b/test/std/depr/depr.function.objects/depr.adaptors/depr.member.pointer.adaptors/mem_fun_t.cxx1z.fail.cpp similarity index 54% rename from test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/move_convert13.fail.cpp rename to test/std/depr/depr.function.objects/depr.adaptors/depr.member.pointer.adaptors/mem_fun_t.cxx1z.fail.cpp index a4bd2cba1..e6a1ed330 100644 --- a/test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/move_convert13.fail.cpp +++ b/test/std/depr/depr.function.objects/depr.adaptors/depr.member.pointer.adaptors/mem_fun_t.cxx1z.fail.cpp @@ -7,29 +7,27 @@ // //===----------------------------------------------------------------------===// -// +// -// unique_ptr +// mem_fun_t +// Removed in c++1z +// UNSUPPORTED: c++98, c++03, c++11, c++14 -// Test unique_ptr converting move ctor - -// Do not convert from an array unique_ptr - -#include -#include +#include +#include #include +#include "test_macros.h" + struct A { -}; - -struct Deleter -{ - void operator()(void*) {} + char a1() {return 5;} + short a2(int i) {return short(i+1);} + int a3() const {return 1;} + double a4(unsigned i) const {return i-1;} }; int main() { - std::unique_ptr s; - std::unique_ptr s2(std::move(s)); + typedef std::mem_fun_t F; } diff --git a/test/std/depr/depr.function.objects/depr.adaptors/depr.member.pointer.adaptors/mem_fun_t.pass.cpp b/test/std/depr/depr.function.objects/depr.adaptors/depr.member.pointer.adaptors/mem_fun_t.pass.cpp index 3fc84cd05..c33e2f7d7 100644 --- a/test/std/depr/depr.function.objects/depr.adaptors/depr.member.pointer.adaptors/mem_fun_t.pass.cpp +++ b/test/std/depr/depr.function.objects/depr.adaptors/depr.member.pointer.adaptors/mem_fun_t.pass.cpp @@ -8,6 +8,7 @@ //===----------------------------------------------------------------------===// // +// REQUIRES: c++98 || c++03 || c++11 || c++14 // mem_fun_t diff --git a/test/std/depr/depr.lib.binders/depr.lib.bind.1st/bind1st.pass.cpp b/test/std/depr/depr.lib.binders/depr.lib.bind.1st/bind1st.pass.cpp index b6b75263c..796e4ad87 100644 --- a/test/std/depr/depr.lib.binders/depr.lib.bind.1st/bind1st.pass.cpp +++ b/test/std/depr/depr.lib.binders/depr.lib.bind.1st/bind1st.pass.cpp @@ -8,6 +8,7 @@ //===----------------------------------------------------------------------===// // +// REQUIRES: c++98 || c++03 || c++11 || c++14 // template // binder1st diff --git a/test/std/depr/depr.lib.binders/depr.lib.bind.2nd/bind2nd.pass.cpp b/test/std/depr/depr.lib.binders/depr.lib.bind.2nd/bind2nd.pass.cpp index b7feb243b..cbf1dbf9f 100644 --- a/test/std/depr/depr.lib.binders/depr.lib.bind.2nd/bind2nd.pass.cpp +++ b/test/std/depr/depr.lib.binders/depr.lib.bind.2nd/bind2nd.pass.cpp @@ -8,6 +8,7 @@ //===----------------------------------------------------------------------===// // +// REQUIRES: c++98 || c++03 || c++11 || c++14 // template // binder2nd diff --git a/test/std/depr/depr.lib.binders/depr.lib.binder.1st/binder1st.pass.cpp b/test/std/depr/depr.lib.binders/depr.lib.binder.1st/binder1st.pass.cpp index 8b7aaf0fd..480148b76 100644 --- a/test/std/depr/depr.lib.binders/depr.lib.binder.1st/binder1st.pass.cpp +++ b/test/std/depr/depr.lib.binders/depr.lib.binder.1st/binder1st.pass.cpp @@ -8,6 +8,7 @@ //===----------------------------------------------------------------------===// // +// REQUIRES: c++98 || c++03 || c++11 || c++14 // template // class binder1st diff --git a/test/std/depr/depr.lib.binders/depr.lib.binder.2nd/binder2nd.pass.cpp b/test/std/depr/depr.lib.binders/depr.lib.binder.2nd/binder2nd.pass.cpp index 645c1688c..3dfb1f02d 100644 --- a/test/std/depr/depr.lib.binders/depr.lib.binder.2nd/binder2nd.pass.cpp +++ b/test/std/depr/depr.lib.binders/depr.lib.binder.2nd/binder2nd.pass.cpp @@ -8,6 +8,7 @@ //===----------------------------------------------------------------------===// // +// REQUIRES: c++98 || c++03 || c++11 || c++14 // template // class binder2nd diff --git a/test/std/depr/depr.str.strstreams/depr.strstreambuf/depr.strstreambuf.members/overflow.pass.cpp b/test/std/depr/depr.str.strstreams/depr.strstreambuf/depr.strstreambuf.members/overflow.pass.cpp index dda19a951..c829a97b4 100644 --- a/test/std/depr/depr.str.strstreams/depr.strstreambuf/depr.strstreambuf.members/overflow.pass.cpp +++ b/test/std/depr/depr.str.strstreams/depr.strstreambuf/depr.strstreambuf.members/overflow.pass.cpp @@ -9,6 +9,10 @@ // +// There was an overflow in the dylib on older macOS versions +// UNSUPPORTED: availability=macosx10.8 +// UNSUPPORTED: availability=macosx10.7 + // class strstreambuf // int overflow(int c); diff --git a/test/std/diagnostics/syserr/syserr.errcat/syserr.errcat.objects/generic_category.pass.cpp b/test/std/diagnostics/syserr/syserr.errcat/syserr.errcat.objects/generic_category.pass.cpp index 65ecc4921..0783de85c 100644 --- a/test/std/diagnostics/syserr/syserr.errcat/syserr.errcat.objects/generic_category.pass.cpp +++ b/test/std/diagnostics/syserr/syserr.errcat/syserr.errcat.objects/generic_category.pass.cpp @@ -7,6 +7,13 @@ // //===----------------------------------------------------------------------===// +// XFAIL: with_system_cxx_lib=macosx10.12 +// XFAIL: with_system_cxx_lib=macosx10.11 +// XFAIL: with_system_cxx_lib=macosx10.10 +// XFAIL: with_system_cxx_lib=macosx10.9 +// XFAIL: with_system_cxx_lib=macosx10.7 +// XFAIL: with_system_cxx_lib=macosx10.8 + // // class error_category @@ -24,7 +31,7 @@ void test_message_for_bad_value() { errno = E2BIG; // something that message will never generate const std::error_category& e_cat1 = std::generic_category(); const std::string msg = e_cat1.message(-1); - LIBCPP_ASSERT(msg == "Unknown error -1"); + LIBCPP_ASSERT(msg == "Unknown error -1" || msg == "Unknown error"); assert(errno == E2BIG); } diff --git a/test/std/diagnostics/syserr/syserr.errcat/syserr.errcat.objects/system_category.pass.cpp b/test/std/diagnostics/syserr/syserr.errcat/syserr.errcat.objects/system_category.pass.cpp index d1a94883f..8cccb0255 100644 --- a/test/std/diagnostics/syserr/syserr.errcat/syserr.errcat.objects/system_category.pass.cpp +++ b/test/std/diagnostics/syserr/syserr.errcat/syserr.errcat.objects/system_category.pass.cpp @@ -13,6 +13,13 @@ // const error_category& system_category(); +// XFAIL: with_system_cxx_lib=macosx10.12 +// XFAIL: with_system_cxx_lib=macosx10.11 +// XFAIL: with_system_cxx_lib=macosx10.10 +// XFAIL: with_system_cxx_lib=macosx10.9 +// XFAIL: with_system_cxx_lib=macosx10.7 +// XFAIL: with_system_cxx_lib=macosx10.8 + #include #include #include @@ -24,7 +31,7 @@ void test_message_for_bad_value() { errno = E2BIG; // something that message will never generate const std::error_category& e_cat1 = std::system_category(); const std::string msg = e_cat1.message(-1); - LIBCPP_ASSERT(msg == "Unknown error -1"); + LIBCPP_ASSERT(msg == "Unknown error -1" || msg == "Unknown error"); assert(errno == E2BIG); } diff --git a/test/std/diagnostics/syserr/syserr.hash/error_code.pass.cpp b/test/std/diagnostics/syserr/syserr.hash/error_code.pass.cpp index 4091f446a..dac13bdb8 100644 --- a/test/std/diagnostics/syserr/syserr.hash/error_code.pass.cpp +++ b/test/std/diagnostics/syserr/syserr.hash/error_code.pass.cpp @@ -29,6 +29,7 @@ test(int i) typedef std::hash H; static_assert((std::is_same::value), "" ); static_assert((std::is_same::value), "" ); + ASSERT_NOEXCEPT(H()(T())); H h; T ec(i, std::system_category()); const std::size_t result = h(ec); diff --git a/test/std/diagnostics/syserr/syserr.hash/error_condition.pass.cpp b/test/std/diagnostics/syserr/syserr.hash/error_condition.pass.cpp index d455210c2..eef37c68b 100644 --- a/test/std/diagnostics/syserr/syserr.hash/error_condition.pass.cpp +++ b/test/std/diagnostics/syserr/syserr.hash/error_condition.pass.cpp @@ -29,6 +29,7 @@ test(int i) typedef std::hash H; static_assert((std::is_same::value), "" ); static_assert((std::is_same::value), "" ); + ASSERT_NOEXCEPT(H()(T())); H h; T ec(i, std::system_category()); const std::size_t result = h(ec); 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 index 17b01fe63..7140fab88 100644 --- a/test/std/experimental/any/any.class/any.assign/copy.pass.cpp +++ b/test/std/experimental/any/any.class/any.assign/copy.pass.cpp @@ -9,6 +9,13 @@ // UNSUPPORTED: c++98, c++03, c++11 +// XFAIL: with_system_cxx_lib=macosx10.12 +// XFAIL: with_system_cxx_lib=macosx10.11 +// XFAIL: with_system_cxx_lib=macosx10.10 +// XFAIL: with_system_cxx_lib=macosx10.9 +// XFAIL: with_system_cxx_lib=macosx10.7 +// XFAIL: with_system_cxx_lib=macosx10.8 + // // any& operator=(any const &); 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 index 49508febd..35fc56c24 100644 --- a/test/std/experimental/any/any.class/any.assign/move.pass.cpp +++ b/test/std/experimental/any/any.class/any.assign/move.pass.cpp @@ -9,6 +9,13 @@ // UNSUPPORTED: c++98, c++03, c++11 +// XFAIL: with_system_cxx_lib=macosx10.12 +// XFAIL: with_system_cxx_lib=macosx10.11 +// XFAIL: with_system_cxx_lib=macosx10.10 +// XFAIL: with_system_cxx_lib=macosx10.9 +// XFAIL: with_system_cxx_lib=macosx10.7 +// XFAIL: with_system_cxx_lib=macosx10.8 + // // any& operator=(any &&); 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 index b42a4ba2b..8ff4ad594 100644 --- a/test/std/experimental/any/any.class/any.assign/value.pass.cpp +++ b/test/std/experimental/any/any.class/any.assign/value.pass.cpp @@ -9,6 +9,13 @@ // UNSUPPORTED: c++98, c++03, c++11 +// XFAIL: with_system_cxx_lib=macosx10.12 +// XFAIL: with_system_cxx_lib=macosx10.11 +// XFAIL: with_system_cxx_lib=macosx10.10 +// XFAIL: with_system_cxx_lib=macosx10.9 +// XFAIL: with_system_cxx_lib=macosx10.7 +// XFAIL: with_system_cxx_lib=macosx10.8 + // // any& operator=(any const &); @@ -174,4 +181,4 @@ int main() { test_assign_throws(); test_assign_throws(); test_assign_throws(); -} \ No newline at end of file +} 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 index 69341ca6b..47f12d739 100644 --- a/test/std/experimental/any/any.class/any.cons/copy.pass.cpp +++ b/test/std/experimental/any/any.class/any.cons/copy.pass.cpp @@ -9,6 +9,13 @@ // UNSUPPORTED: c++98, c++03, c++11 +// XFAIL: with_system_cxx_lib=macosx10.12 +// XFAIL: with_system_cxx_lib=macosx10.11 +// XFAIL: with_system_cxx_lib=macosx10.10 +// XFAIL: with_system_cxx_lib=macosx10.9 +// XFAIL: with_system_cxx_lib=macosx10.7 +// XFAIL: with_system_cxx_lib=macosx10.8 + // // any(any const &); 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 index 2a050946a..c5395daa3 100644 --- a/test/std/experimental/any/any.class/any.cons/move.pass.cpp +++ b/test/std/experimental/any/any.class/any.cons/move.pass.cpp @@ -9,6 +9,13 @@ // UNSUPPORTED: c++98, c++03, c++11 +// XFAIL: with_system_cxx_lib=macosx10.12 +// XFAIL: with_system_cxx_lib=macosx10.11 +// XFAIL: with_system_cxx_lib=macosx10.10 +// XFAIL: with_system_cxx_lib=macosx10.9 +// XFAIL: with_system_cxx_lib=macosx10.7 +// XFAIL: with_system_cxx_lib=macosx10.8 + // // any(any &&) noexcept; 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 index a3ab0edc8..fcace5028 100644 --- a/test/std/experimental/any/any.class/any.cons/value.pass.cpp +++ b/test/std/experimental/any/any.class/any.cons/value.pass.cpp @@ -9,6 +9,13 @@ // UNSUPPORTED: c++98, c++03, c++11 +// XFAIL: with_system_cxx_lib=macosx10.12 +// XFAIL: with_system_cxx_lib=macosx10.11 +// XFAIL: with_system_cxx_lib=macosx10.10 +// XFAIL: with_system_cxx_lib=macosx10.9 +// XFAIL: with_system_cxx_lib=macosx10.7 +// XFAIL: with_system_cxx_lib=macosx10.8 + // // template any(Value &&) @@ -113,4 +120,4 @@ int main() { test_copy_value_throws(); test_copy_value_throws(); 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 index 781ed73f2..1b0b75d61 100644 --- a/test/std/experimental/any/any.class/any.modifiers/clear.pass.cpp +++ b/test/std/experimental/any/any.class/any.modifiers/clear.pass.cpp @@ -9,6 +9,13 @@ // UNSUPPORTED: c++98, c++03, c++11 +// XFAIL: with_system_cxx_lib=macosx10.12 +// XFAIL: with_system_cxx_lib=macosx10.11 +// XFAIL: with_system_cxx_lib=macosx10.10 +// XFAIL: with_system_cxx_lib=macosx10.9 +// XFAIL: with_system_cxx_lib=macosx10.7 +// XFAIL: with_system_cxx_lib=macosx10.8 + // // any::clear() noexcept 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 index b1d315468..9f499b4a1 100644 --- a/test/std/experimental/any/any.class/any.modifiers/swap.pass.cpp +++ b/test/std/experimental/any/any.class/any.modifiers/swap.pass.cpp @@ -9,6 +9,13 @@ // UNSUPPORTED: c++98, c++03, c++11 +// XFAIL: with_system_cxx_lib=macosx10.12 +// XFAIL: with_system_cxx_lib=macosx10.11 +// XFAIL: with_system_cxx_lib=macosx10.10 +// XFAIL: with_system_cxx_lib=macosx10.9 +// XFAIL: with_system_cxx_lib=macosx10.7 +// XFAIL: with_system_cxx_lib=macosx10.8 + // // any::swap(any &) noexcept 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 index 47fe52f7b..ca6d1de11 100644 --- 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 @@ -9,6 +9,8 @@ // UNSUPPORTED: c++98, c++03, c++11 +// XFAIL: availability=macosx + // // template 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 index c6cc68d72..1c52a64fc 100644 --- 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 @@ -42,4 +42,4 @@ int main() { any_cast(static_cast(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/swap.pass.cpp b/test/std/experimental/any/any.nonmembers/swap.pass.cpp index a3fbd43d9..e79bc9ef0 100644 --- a/test/std/experimental/any/any.nonmembers/swap.pass.cpp +++ b/test/std/experimental/any/any.nonmembers/swap.pass.cpp @@ -34,7 +34,8 @@ int main() swap(a1, a2); - assert(any_cast(a1) == 2); - assert(any_cast(a2) == 1); + // Support testing against system dylibs that don't have bad_any_cast. + assert(*any_cast(&a1) == 2); + assert(*any_cast(&a2) == 1); } } diff --git a/test/std/experimental/filesystem/class.path/path.member/path.decompose/path.decompose.pass.cpp b/test/std/experimental/filesystem/class.path/path.member/path.decompose/path.decompose.pass.cpp index 4c83481aa..078e00666 100644 --- a/test/std/experimental/filesystem/class.path/path.member/path.decompose/path.decompose.pass.cpp +++ b/test/std/experimental/filesystem/class.path/path.member/path.decompose/path.decompose.pass.cpp @@ -54,12 +54,6 @@ #include "count_new.hpp" #include "filesystem_test_helper.hpp" -template -std::reverse_iterator mkRev(It it) { - return std::reverse_iterator(it); -} - - namespace fs = std::experimental::filesystem; struct PathDecomposeTestcase { @@ -147,7 +141,11 @@ void decompPathTest() assert(checkCollectionsEqual(p.begin(), p.end(), TC.elements.begin(), TC.elements.end())); // check backwards - assert(checkCollectionsEqual(mkRev(p.end()), mkRev(p.begin()), + + std::vector Parts; + for (auto it = p.end(); it != p.begin(); ) + Parts.push_back(*--it); + assert(checkCollectionsEqual(Parts.begin(), Parts.end(), TC.elements.rbegin(), TC.elements.rend())); } } diff --git a/test/std/experimental/language.support/support.coroutines/coroutine.handle/coroutine.handle.capacity/operator_bool.pass.cpp b/test/std/experimental/language.support/support.coroutines/coroutine.handle/coroutine.handle.capacity/operator_bool.pass.cpp new file mode 100644 index 000000000..30081fc3a --- /dev/null +++ b/test/std/experimental/language.support/support.coroutines/coroutine.handle/coroutine.handle.capacity/operator_bool.pass.cpp @@ -0,0 +1,58 @@ +// -*- C++ -*- +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// UNSUPPORTED: c++98, c++03, c++11 + +// + +// template +// struct coroutine_handle; + +// constexpr explicit operator bool() const noexcept + +#include +#include +#include + +#include "test_macros.h" + +namespace coro = std::experimental; + +template +void do_test() { + static_assert(std::is_nothrow_constructible::value, ""); + static_assert(!std::is_convertible::value, ""); + { + constexpr C c; ((void)c); + static_assert(bool(c) == false, ""); + } + { // null case + const C c = {}; ((void)c); + ASSERT_NOEXCEPT(bool(c)); + if (c) + assert(false); + else + assert(true); + assert(c.address() == nullptr); + assert(bool(c) == false); + } + { // non-null case + char dummy = 42; + C c = C::from_address((void*)&dummy); + assert(c.address() == &dummy); + assert(bool(c) == true); + } +} + +int main() +{ + do_test>(); + do_test>(); +} diff --git a/test/std/experimental/language.support/support.coroutines/coroutine.handle/coroutine.handle.compare/equal_comp.pass.cpp b/test/std/experimental/language.support/support.coroutines/coroutine.handle/coroutine.handle.compare/equal_comp.pass.cpp new file mode 100644 index 000000000..278ea9d06 --- /dev/null +++ b/test/std/experimental/language.support/support.coroutines/coroutine.handle/coroutine.handle.compare/equal_comp.pass.cpp @@ -0,0 +1,60 @@ +// -*- C++ -*- +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// UNSUPPORTED: c++98, c++03, c++11 + +// + +// template +// struct coroutine_handle; + +// bool operator==(coroutine_handle<>, coroutine_handle<>) noexcept +// bool operator!=(coroutine_handle<>, coroutine_handle<>) noexcept + +#include +#include +#include +#include +#include + +#include "test_macros.h" + +namespace coro = std::experimental; + +template +void do_test(uintptr_t LHSVal, uintptr_t RHSVal) { + const C LHS = C::from_address(reinterpret_cast(LHSVal)); + const C RHS = C::from_address(reinterpret_cast(RHSVal)); + const bool ExpectIsEqual = (LHSVal == RHSVal); + assert((LHS == RHS) == ExpectIsEqual); + assert((RHS == LHS) == ExpectIsEqual); + assert((LHS != RHS) == !ExpectIsEqual); + assert((RHS != LHS) == !ExpectIsEqual); + { + static_assert(noexcept(LHS == RHS), ""); + static_assert(noexcept(LHS != RHS), ""); + ASSERT_SAME_TYPE(decltype(LHS == RHS), bool); + ASSERT_SAME_TYPE(decltype(LHS != RHS), bool); + } +} + +int main() +{ + std::pair const TestCases[] = { + {0, 0}, + {16, 16}, + {0, 16}, + {16, 0} + }; + for (auto& TC : TestCases) { + do_test>(TC.first, TC.second); + do_test>(TC.first, TC.second); + } +} diff --git a/test/std/experimental/language.support/support.coroutines/coroutine.handle/coroutine.handle.compare/less_comp.pass.cpp b/test/std/experimental/language.support/support.coroutines/coroutine.handle/coroutine.handle.compare/less_comp.pass.cpp new file mode 100644 index 000000000..e92adf033 --- /dev/null +++ b/test/std/experimental/language.support/support.coroutines/coroutine.handle/coroutine.handle.compare/less_comp.pass.cpp @@ -0,0 +1,69 @@ +// -*- C++ -*- +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// UNSUPPORTED: c++98, c++03, c++11 + +// + +// template +// struct coroutine_handle; + +// bool operator<(coroutine_handle<>, coroutine_handle<>) noexcept +// bool operator>(coroutine_handle<>, coroutine_handle<>) noexcept +// bool operator>=(coroutine_handle<>, coroutine_handle<>) noexcept +// bool operator<=(coroutine_handle<>, coroutine_handle<>) noexcept + +#include +#include +#include +#include +#include + +#include "test_macros.h" + +namespace coro = std::experimental; + +template +void do_test(uintptr_t LHSVal, uintptr_t RHSVal) { + const C LHS = C::from_address(reinterpret_cast(LHSVal)); + const C RHS = C::from_address(reinterpret_cast(RHSVal)); + assert((LHS < RHS) == (LHSVal < RHSVal)); + assert((RHS < LHS) == (RHSVal < LHSVal)); + assert((LHS > RHS) == (LHSVal > RHSVal)); + assert((RHS > LHS) == (RHSVal > LHSVal)); + assert((LHS <= RHS) == (LHSVal <= RHSVal)); + assert((RHS <= LHS) == (RHSVal <= LHSVal)); + assert((LHS >= RHS) == (LHSVal >= RHSVal)); + assert((RHS >= LHS) == (RHSVal >= LHSVal)); + { + static_assert(noexcept(LHS < RHS), ""); + static_assert(noexcept(LHS > RHS), ""); + static_assert(noexcept(LHS <= RHS), ""); + static_assert(noexcept(LHS >= RHS), ""); + ASSERT_SAME_TYPE(decltype(LHS < RHS), bool); + ASSERT_SAME_TYPE(decltype(LHS > RHS), bool); + ASSERT_SAME_TYPE(decltype(LHS <= RHS), bool); + ASSERT_SAME_TYPE(decltype(LHS >= RHS), bool); + } +} + +int main() +{ + std::pair const TestCases[] = { + {0, 0}, + {16, 16}, + {0, 16}, + {16, 0} + }; + for (auto& TC : TestCases) { + do_test>(TC.first, TC.second); + do_test>(TC.first, TC.second); + } +} diff --git a/test/std/experimental/language.support/support.coroutines/coroutine.handle/coroutine.handle.completion/done.pass.cpp b/test/std/experimental/language.support/support.coroutines/coroutine.handle/coroutine.handle.completion/done.pass.cpp new file mode 100644 index 000000000..240d93245 --- /dev/null +++ b/test/std/experimental/language.support/support.coroutines/coroutine.handle/coroutine.handle.completion/done.pass.cpp @@ -0,0 +1,44 @@ +// -*- C++ -*- +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// UNSUPPORTED: c++98, c++03, c++11 + +// + +// template +// struct coroutine_handle; + +// bool done() const + +#include +#include +#include +#include +#include +#include + +#include "test_macros.h" + +namespace coro = std::experimental; + +template +void do_test(coro::coroutine_handle const& H) { + // FIXME Add a runtime test + { + ASSERT_SAME_TYPE(decltype(H.done()), bool); + LIBCPP_ASSERT_NOT_NOEXCEPT(H.done()); + } +} + +int main() +{ + do_test(coro::coroutine_handle<>{}); + do_test(coro::coroutine_handle{}); +} diff --git a/test/std/experimental/language.support/support.coroutines/coroutine.handle/coroutine.handle.con/assign.pass.cpp b/test/std/experimental/language.support/support.coroutines/coroutine.handle/coroutine.handle.con/assign.pass.cpp new file mode 100644 index 000000000..0cd3d05c2 --- /dev/null +++ b/test/std/experimental/language.support/support.coroutines/coroutine.handle/coroutine.handle.con/assign.pass.cpp @@ -0,0 +1,54 @@ +// -*- C++ -*- +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// UNSUPPORTED: c++98, c++03, c++11 + +// + +// template +// struct coroutine_handle; + +// coroutine_handle& operator=(nullptr_t) noexcept + +#include +#include +#include + +namespace coro = std::experimental; + +template +void do_test() { + int dummy = 42; + void* dummy_h = &dummy; + { + C c; ((void)c); + static_assert(std::is_nothrow_assignable::value, ""); + static_assert(!std::is_assignable::value, ""); + } + { + C c = C::from_address(dummy_h); + assert(c.address() == &dummy); + c = nullptr; + assert(c.address() == nullptr); + c = nullptr; + assert(c.address() == nullptr); + } + { + C c; + C& cr = (c = nullptr); + assert(&c == &cr); + } +} + +int main() +{ + do_test>(); + do_test>(); +} diff --git a/test/std/experimental/language.support/support.coroutines/coroutine.handle/coroutine.handle.con/construct.pass.cpp b/test/std/experimental/language.support/support.coroutines/coroutine.handle/coroutine.handle.con/construct.pass.cpp new file mode 100644 index 000000000..be5174dd3 --- /dev/null +++ b/test/std/experimental/language.support/support.coroutines/coroutine.handle/coroutine.handle.con/construct.pass.cpp @@ -0,0 +1,53 @@ +// -*- C++ -*- +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// UNSUPPORTED: c++98, c++03, c++11 + +// + +// template +// struct coroutine_handle; + +// constexpr coroutine_handle() noexcept +// constexpr coroutine_handle(nullptr_t) noexcept + +#include +#include +#include + +namespace coro = std::experimental; + +template +void do_test() { + { + constexpr C c; + static_assert(std::is_nothrow_default_constructible::value, ""); + static_assert(c.address() == nullptr, ""); + } + { + constexpr C c(nullptr); + static_assert(std::is_nothrow_constructible::value, ""); + static_assert(c.address() == nullptr, ""); + } + { + C c; + assert(c.address() == nullptr); + } + { + C c(nullptr); + assert(c.address() == nullptr); + } +} + +int main() +{ + do_test>(); + do_test>(); +} diff --git a/test/std/experimental/language.support/support.coroutines/coroutine.handle/coroutine.handle.export/address.pass.cpp b/test/std/experimental/language.support/support.coroutines/coroutine.handle/coroutine.handle.export/address.pass.cpp new file mode 100644 index 000000000..aba5eb663 --- /dev/null +++ b/test/std/experimental/language.support/support.coroutines/coroutine.handle/coroutine.handle.export/address.pass.cpp @@ -0,0 +1,51 @@ +// -*- C++ -*- +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// UNSUPPORTED: c++98, c++03, c++11 + +// + +// template +// struct coroutine_handle; + +// constexpr void* address() const noexcept + +#include +#include +#include + +#include "test_macros.h" + +namespace coro = std::experimental; + +template +void do_test() { + { + constexpr C c; ((void)c); + static_assert(c.address() == nullptr, ""); + } + { + const C c = {}; ((void)c); + ASSERT_NOEXCEPT(c.address()); + ASSERT_SAME_TYPE(decltype(c.address()), void*); + assert(c.address() == nullptr); + } + { + char dummy = 42; + C c = C::from_address((void*)&dummy); + assert(c.address() == &dummy); + } +} + +int main() +{ + do_test>(); + do_test>(); +} diff --git a/test/std/experimental/language.support/support.coroutines/coroutine.handle/coroutine.handle.export/from_address.fail.cpp b/test/std/experimental/language.support/support.coroutines/coroutine.handle/coroutine.handle.export/from_address.fail.cpp new file mode 100644 index 000000000..1c87b9443 --- /dev/null +++ b/test/std/experimental/language.support/support.coroutines/coroutine.handle/coroutine.handle.export/from_address.fail.cpp @@ -0,0 +1,46 @@ +// -*- C++ -*- +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// UNSUPPORTED: c++98, c++03, c++11 +// + +// template +// struct coroutine_handle; + +// static coroutine_handle from_address(void*) noexcept + +// Test that `from_address` is explicitly ill-formed when called with a typed +// pointer. The user cannot possibly have a typed pointer to the coroutine. +// FIXME: This behavior is an extension, and should upstreamed into the TS or +// the test removed if the TS changes are rejected. + +#include +#include +#include + +namespace coro = std::experimental; + +int main() +{ + { + using H = coro::coroutine_handle<>; + // expected-error@experimental/coroutine:* 3 {{coroutine_handle::from_address cannot be called with non-void pointers}} + H::from_address((int*)nullptr); // expected-note {{requested here}} + H::from_address((const void*)nullptr); // expected-note {{requested here}} + H::from_address((const char*)nullptr); // expected-note {{requested here}} + } + { + using H = coro::coroutine_handle; + // expected-error@experimental/coroutine:* 1 {{static_assert failed "coroutine_handle::from_address cannot be used with pointers to the coroutine's promise type; use 'from_promise' instead"}} + H::from_address((const char*)nullptr); // expected-note {{requested here}} + // expected-error@experimental/coroutine:* 1 {{coroutine_handle::from_address cannot be called with non-void pointers}} + H::from_address((int*)nullptr); // expected-note {{requested here}} + } +} diff --git a/test/std/experimental/language.support/support.coroutines/coroutine.handle/coroutine.handle.export/from_address.pass.cpp b/test/std/experimental/language.support/support.coroutines/coroutine.handle/coroutine.handle.export/from_address.pass.cpp new file mode 100644 index 000000000..636d5da4e --- /dev/null +++ b/test/std/experimental/language.support/support.coroutines/coroutine.handle/coroutine.handle.export/from_address.pass.cpp @@ -0,0 +1,46 @@ +// -*- C++ -*- +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// UNSUPPORTED: c++98, c++03, c++11 + +// + +// template +// struct coroutine_handle; + +// static coroutine_handle from_address(void*) noexcept + +#include +#include +#include + +namespace coro = std::experimental; + +template +void do_test() { + { + C c = C::from_address(nullptr); + static_assert(noexcept(C::from_address(nullptr)), ""); + // FIXME: Should the return type not be 'C'? + static_assert(std::is_same::value, ""); + assert(c.address() == nullptr); + } + { + char dummy = 42; + C c = C::from_address((void*)&dummy); + assert(c.address() == &dummy); + } +} + +int main() +{ + do_test>(); + do_test>(); +} diff --git a/test/std/experimental/language.support/support.coroutines/coroutine.handle/coroutine.handle.hash/hash.pass.cpp b/test/std/experimental/language.support/support.coroutines/coroutine.handle/coroutine.handle.hash/hash.pass.cpp new file mode 100644 index 000000000..342232962 --- /dev/null +++ b/test/std/experimental/language.support/support.coroutines/coroutine.handle/coroutine.handle.hash/hash.pass.cpp @@ -0,0 +1,63 @@ +// -*- C++ -*- +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// UNSUPPORTED: c++98, c++03, c++11 + +// + +// template +// struct coroutine_handle; + +// namespace std { +// template struct hash>; +// } + +#include +#include +#include +#include +#include +#include + +#include "test_macros.h" + +namespace coro = std::experimental; + +template +void do_test(uintptr_t LHSVal, uintptr_t RHSVal) { + const size_t ExpectLHS = std::hash{}(reinterpret_cast(LHSVal)); + const size_t ExpectRHS = std::hash{}(reinterpret_cast(RHSVal)); + const C LHS = C::from_address(reinterpret_cast(LHSVal)); + const C RHS = C::from_address(reinterpret_cast(RHSVal)); + const std::hash h; + // FIXME: libc++'s implementation hash's the result of LHS.address(), so we + // expect that value. However this is not required. + assert(h(LHS) == ExpectLHS); + assert(h(RHS) == ExpectRHS); + assert((h(LHS) == h(RHS)) == (LHSVal == RHSVal)); + { + ASSERT_SAME_TYPE(decltype(h(LHS)), size_t); + ASSERT_NOEXCEPT(std::hash{}(LHS)); + } +} + +int main() +{ + std::pair const TestCases[] = { + {0, 0}, + {0, 8}, + {8, 8}, + {8, 16} + }; + for (auto& TC : TestCases) { + do_test>(TC.first, TC.second); + do_test>(TC.first, TC.second); + } +} diff --git a/test/std/experimental/language.support/support.coroutines/coroutine.handle/coroutine.handle.prom/promise.pass.cpp b/test/std/experimental/language.support/support.coroutines/coroutine.handle/coroutine.handle.prom/promise.pass.cpp new file mode 100644 index 000000000..4a61047a8 --- /dev/null +++ b/test/std/experimental/language.support/support.coroutines/coroutine.handle/coroutine.handle.prom/promise.pass.cpp @@ -0,0 +1,49 @@ +// -*- C++ -*- +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// UNSUPPORTED: c++98, c++03, c++11 + +// + +// template +// struct coroutine_handle; + +// Promise& promise() const + +#include +#include +#include +#include +#include +#include + +#include "test_macros.h" + +namespace coro = std::experimental; + +template +void do_test(coro::coroutine_handle&& H) { + + // FIXME Add a runtime test + { + ASSERT_SAME_TYPE(decltype(H.promise()), Promise&); + LIBCPP_ASSERT_NOT_NOEXCEPT(H.promise()); + } + { + auto const& CH = H; + ASSERT_SAME_TYPE(decltype(CH.promise()), Promise&); + LIBCPP_ASSERT_NOT_NOEXCEPT(CH.promise()); + } +} + +int main() +{ + do_test(coro::coroutine_handle{}); +} diff --git a/test/std/experimental/language.support/support.coroutines/coroutine.handle/coroutine.handle.resumption/destroy.pass.cpp b/test/std/experimental/language.support/support.coroutines/coroutine.handle/coroutine.handle.resumption/destroy.pass.cpp new file mode 100644 index 000000000..df3337c4c --- /dev/null +++ b/test/std/experimental/language.support/support.coroutines/coroutine.handle/coroutine.handle.resumption/destroy.pass.cpp @@ -0,0 +1,61 @@ +// -*- C++ -*- +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// UNSUPPORTED: c++98, c++03, c++11 + +// + +// template +// struct coroutine_handle; + +// void destroy() + +#include +#include +#include +#include +#include +#include + +#include "test_macros.h" + +namespace coro = std::experimental; + +template +auto has_destroy_imp(H&& h, int) -> decltype(h.destroy(), std::true_type{}); +template +auto has_destroy_imp(H&&, long) -> std::false_type; + +template +constexpr bool has_destroy() { + return decltype(has_destroy_imp(std::declval(), 0))::value; +} + +template +void do_test(coro::coroutine_handle&& H) { + using HType = coro::coroutine_handle; + // FIXME Add a runtime test + { + ASSERT_SAME_TYPE(decltype(H.destroy()), void); + LIBCPP_ASSERT_NOT_NOEXCEPT(H.destroy()); + static_assert(has_destroy(), ""); + static_assert(has_destroy(), ""); + } + { + static_assert(!has_destroy(), ""); + static_assert(!has_destroy(), ""); + } +} + +int main() +{ + do_test(coro::coroutine_handle<>{}); + do_test(coro::coroutine_handle{}); +} diff --git a/test/std/experimental/language.support/support.coroutines/coroutine.handle/coroutine.handle.resumption/resume.pass.cpp b/test/std/experimental/language.support/support.coroutines/coroutine.handle/coroutine.handle.resumption/resume.pass.cpp new file mode 100644 index 000000000..21c05e2be --- /dev/null +++ b/test/std/experimental/language.support/support.coroutines/coroutine.handle/coroutine.handle.resumption/resume.pass.cpp @@ -0,0 +1,80 @@ +// -*- C++ -*- +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// UNSUPPORTED: c++98, c++03, c++11 + +// + +// template +// struct coroutine_handle; + +// void operator()() +// void resume() + +#include +#include +#include +#include +#include +#include + +#include "test_macros.h" + +namespace coro = std::experimental; + + +template +auto has_resume_imp(H&& h, int) -> decltype(h.resume(), std::true_type{}); +template +auto has_resume_imp(H&&, long) -> std::false_type; + +template +constexpr bool has_resume() { + return decltype(has_resume_imp(std::declval(), 0))::value; +} + + +template +auto has_call_operator_imp(H&& h, int) -> decltype(h(), std::true_type{}); +template +auto has_call_operator_imp(H&&, long) -> std::false_type; + +template +constexpr bool has_call_operator() { + return decltype(has_call_operator_imp(std::declval(), 0))::value; +} + +template +void do_test(coro::coroutine_handle&& H) { + using HType = coro::coroutine_handle; + // FIXME Add a runtime test + { + ASSERT_SAME_TYPE(decltype(H.resume()), void); + ASSERT_SAME_TYPE(decltype(H()), void); + LIBCPP_ASSERT_NOT_NOEXCEPT(H.resume()); + LIBCPP_ASSERT_NOT_NOEXCEPT(H()); + static_assert(has_resume(), ""); + static_assert(has_resume(), ""); + static_assert(has_call_operator(), ""); + static_assert(has_call_operator(), ""); + } + { + static_assert(!has_resume(), ""); + static_assert(!has_resume(), ""); + static_assert(!has_call_operator(), ""); + static_assert(!has_call_operator(), ""); + } +} + +int main() +{ + do_test(coro::coroutine_handle<>{}); + do_test(coro::coroutine_handle{}); +} diff --git a/test/std/experimental/language.support/support.coroutines/coroutine.handle/void_handle.pass.cpp b/test/std/experimental/language.support/support.coroutines/coroutine.handle/void_handle.pass.cpp new file mode 100644 index 000000000..844d34cc4 --- /dev/null +++ b/test/std/experimental/language.support/support.coroutines/coroutine.handle/void_handle.pass.cpp @@ -0,0 +1,51 @@ +// -*- C++ -*- +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// UNSUPPORTED: c++98, c++03, c++11 + +#include + +namespace coro = std::experimental; + +struct A { + using promise_type = A*; +}; + +struct B {}; +struct C {}; + +namespace std { namespace experimental { + template <> + struct coroutine_traits<::A, int> { + using promise_type = int*; + }; + template + struct coroutine_traits<::B, Args...> { + using promise_type = B*; + }; + template <> + struct coroutine_traits<::C> { + using promise_type = void; + }; +}} + +template +void check_type() { + using P = typename coro::coroutine_traits::promise_type ; + static_assert(std::is_same::value, ""); +}; + +int main() +{ + check_type(); + check_type(); + check_type(); + check_type(); +} diff --git a/test/std/experimental/language.support/support.coroutines/coroutine.traits/promise_type.pass.cpp b/test/std/experimental/language.support/support.coroutines/coroutine.traits/promise_type.pass.cpp new file mode 100644 index 000000000..e26f333aa --- /dev/null +++ b/test/std/experimental/language.support/support.coroutines/coroutine.traits/promise_type.pass.cpp @@ -0,0 +1,77 @@ +// -*- C++ -*- +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// UNSUPPORTED: c++98, c++03, c++11 + +#include + +namespace coro = std::experimental; + +template +constexpr bool has_promise_type(int) { return true; } +template +constexpr bool has_promise_type(long) { return false; } +template +constexpr bool has_promise_type() { return has_promise_type(0); } + +struct A { + using promise_type = A*; +}; + +struct B {}; +struct C {}; +struct D { +private: + using promise_type = void; +}; +struct E {}; + +namespace std { namespace experimental { + template <> + struct coroutine_traits<::A, int> { + using promise_type = int*; + }; + template + struct coroutine_traits<::B, Args...> { + using promise_type = B*; + }; + template <> + struct coroutine_traits<::C> { + using promise_type = void; + }; +}} + +template +void check_type() { + using Traits = coro::coroutine_traits; + static_assert(has_promise_type(), ""); + static_assert(std::is_same::value, ""); +} + +template +void check_no_type() { + using Traits = coro::coroutine_traits; + static_assert(!has_promise_type(), ""); +} + +int main() +{ + { + check_type(); + check_type(); + check_type(); + check_type(); + } + { + check_no_type(); + check_no_type(); + check_no_type(); + } +} diff --git a/test/std/experimental/language.support/support.coroutines/coroutine.trivial.awaitables/suspend_always.pass.cpp b/test/std/experimental/language.support/support.coroutines/coroutine.trivial.awaitables/suspend_always.pass.cpp new file mode 100644 index 000000000..b10e72082 --- /dev/null +++ b/test/std/experimental/language.support/support.coroutines/coroutine.trivial.awaitables/suspend_always.pass.cpp @@ -0,0 +1,73 @@ +// -*- C++ -*- +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// UNSUPPORTED: c++98, c++03, c++11 + +#include +#include +#include + +#include "test_macros.h" + +namespace coro = std::experimental; + +using SuspendT = std::experimental::coroutines_v1::suspend_always; + +TEST_SAFE_STATIC SuspendT safe_sa; +constexpr SuspendT constexpr_sa; + +constexpr bool check_suspend_constexpr() { + SuspendT s{}; + const SuspendT scopy(s); ((void)scopy); + SuspendT smove(std::move(s)); ((void)smove); + s = scopy; + s = std::move(smove); + return true; +} + +int main() +{ + using H = coro::coroutine_handle<>; + using S = SuspendT; + H h{}; + S s{}; + S const& cs = s; + { + LIBCPP_STATIC_ASSERT(noexcept(s.await_ready()), ""); + static_assert(std::is_same::value, ""); + assert(s.await_ready() == false); + assert(cs.await_ready() == false); + } + { + LIBCPP_STATIC_ASSERT(noexcept(s.await_suspend(h)), ""); + static_assert(std::is_same::value, ""); + s.await_suspend(h); + cs.await_suspend(h); + } + { + LIBCPP_STATIC_ASSERT(noexcept(s.await_resume()), ""); + static_assert(std::is_same::value, ""); + s.await_resume(); + cs.await_resume(); + } + { + static_assert(std::is_nothrow_default_constructible::value, ""); + static_assert(std::is_nothrow_copy_constructible::value, ""); + static_assert(std::is_nothrow_move_constructible::value, ""); + static_assert(std::is_nothrow_copy_assignable::value, ""); + static_assert(std::is_nothrow_move_assignable::value, ""); + static_assert(std::is_trivially_copyable::value, ""); + static_assert(check_suspend_constexpr(), ""); + } + { + // suppress unused warnings for the global constexpr test variable + ((void)constexpr_sa); + } +} diff --git a/test/std/experimental/language.support/support.coroutines/coroutine.trivial.awaitables/suspend_never.pass.cpp b/test/std/experimental/language.support/support.coroutines/coroutine.trivial.awaitables/suspend_never.pass.cpp new file mode 100644 index 000000000..9c2f39238 --- /dev/null +++ b/test/std/experimental/language.support/support.coroutines/coroutine.trivial.awaitables/suspend_never.pass.cpp @@ -0,0 +1,75 @@ +// -*- C++ -*- +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// UNSUPPORTED: c++98, c++03, c++11 + +#include +#include +#include + +#include "test_macros.h" + +namespace coro = std::experimental; + +// Test that the type is in the correct namespace +using SuspendT = std::experimental::coroutines_v1::suspend_never; + +TEST_SAFE_STATIC SuspendT safe_sn; +constexpr SuspendT constexpr_sn; + +constexpr bool check_suspend_constexpr() { + SuspendT s{}; + const SuspendT scopy(s); ((void)scopy); + SuspendT smove(std::move(s)); ((void)smove); + s = scopy; + s = std::move(smove); + return true; +} + + +int main() +{ + using H = coro::coroutine_handle<>; + using S = SuspendT; + H h{}; + S s{}; + S const& cs = s; + { + LIBCPP_STATIC_ASSERT(noexcept(s.await_ready()), ""); + static_assert(std::is_same::value, ""); + assert(s.await_ready() == true); + assert(cs.await_ready() == true); + } + { + LIBCPP_STATIC_ASSERT(noexcept(s.await_suspend(h)), ""); + static_assert(std::is_same::value, ""); + s.await_suspend(h); + cs.await_suspend(h); + } + { + LIBCPP_STATIC_ASSERT(noexcept(s.await_resume()), ""); + static_assert(std::is_same::value, ""); + s.await_resume(); + cs.await_resume(); + } + { + static_assert(std::is_nothrow_default_constructible::value, ""); + static_assert(std::is_nothrow_copy_constructible::value, ""); + static_assert(std::is_nothrow_move_constructible::value, ""); + static_assert(std::is_nothrow_copy_assignable::value, ""); + static_assert(std::is_nothrow_move_assignable::value, ""); + static_assert(std::is_trivially_copyable::value, ""); + static_assert(check_suspend_constexpr(), ""); + } + { + // suppress unused warnings for the global constexpr test variable + ((void)constexpr_sn); + } +} diff --git a/test/std/experimental/language.support/support.coroutines/end.to.end/await_result.pass.cpp b/test/std/experimental/language.support/support.coroutines/end.to.end/await_result.pass.cpp new file mode 100644 index 000000000..b8606317a --- /dev/null +++ b/test/std/experimental/language.support/support.coroutines/end.to.end/await_result.pass.cpp @@ -0,0 +1,69 @@ +// -*- C++ -*- +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// UNSUPPORTED: c++98, c++03, c++11 + +#include +#include + +using namespace std::experimental; + +struct coro_t { + struct promise_type { + coro_t get_return_object() { + coroutine_handle{}; + return {}; + } + suspend_never initial_suspend() { return {}; } + suspend_never final_suspend() { return {}; } + void return_void() {} + static void unhandled_exception() {} + }; +}; + +struct B { + ~B() {} + bool await_ready() { return true; } + B await_resume() { return {}; } + template void await_suspend(F) {} +}; + + +struct A { + ~A() {} + bool await_ready() { return true; } + int await_resume() { return 42; } + template void await_suspend(F) {} +}; + +int last_value = -1; +void set_value(int x) { + last_value = x; +} + +coro_t f(int n) { + if (n == 0) { + set_value(0); + co_return; + } + int val = co_await A{}; + ((void)val); + set_value(42); +} + +coro_t g() { B val = co_await B{}; } + +int main() { + last_value = -1; + f(0); + assert(last_value == 0); + f(1); + assert(last_value == 42); +} diff --git a/test/std/experimental/language.support/support.coroutines/end.to.end/bool_await_suspend.pass.cpp b/test/std/experimental/language.support/support.coroutines/end.to.end/bool_await_suspend.pass.cpp new file mode 100644 index 000000000..12ab92ff3 --- /dev/null +++ b/test/std/experimental/language.support/support.coroutines/end.to.end/bool_await_suspend.pass.cpp @@ -0,0 +1,69 @@ +// -*- C++ -*- +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// UNSUPPORTED: c++98, c++03, c++11 + +// See https://bugs.llvm.org/show_bug.cgi?id=33271 +// UNSUPPORTED: ubsan + +#include +#include + +using namespace std::experimental; + +struct coro_t { + struct promise_type { + coro_t get_return_object() { + return coroutine_handle::from_promise(*this); + } + suspend_never initial_suspend() { return {}; } + suspend_never final_suspend() { return {}; } + void return_void() {} + void unhandled_exception() {} + }; + coro_t(coroutine_handle hh) : h(hh) {} + coroutine_handle h; +}; + +struct NoSuspend { + bool await_ready() { return false; } + void await_resume() {} + template bool await_suspend(F) { return false; } +}; + +struct DoSuspend { + bool await_ready() { return false; } + void await_resume() {} + template bool await_suspend(F) { return true; } +}; + +bool f_started, f_resumed = false; +coro_t f() { + f_started = true; + co_await DoSuspend{}; + f_resumed = true; +} + +bool g_started, g_resumed = false; +coro_t g() { + g_started = true; + co_await NoSuspend{}; + g_resumed = true; +} + +int main() { + assert(!f_started && !f_resumed && !g_started && !g_resumed); + auto fret = f(); + assert(f_started && !f_resumed); + fret.h.destroy(); + assert(f_started && !f_resumed); + g(); + assert(g_started && g_resumed); +} diff --git a/test/std/experimental/language.support/support.coroutines/end.to.end/expected.pass.cpp b/test/std/experimental/language.support/support.coroutines/end.to.end/expected.pass.cpp new file mode 100644 index 000000000..77070cc5a --- /dev/null +++ b/test/std/experimental/language.support/support.coroutines/end.to.end/expected.pass.cpp @@ -0,0 +1,89 @@ +// -*- C++ -*- +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// UNSUPPORTED: c++98, c++03, c++11 + +#include +#include +using namespace std::experimental; + +struct error {}; + +template +struct expected { + + struct Data { + T val; + Error error; + }; + Data data; + + struct DataPtr { + Data *p; + ~DataPtr() { delete p; } + }; + + expected() {} + expected(T val) : data{std::move(val),{}} {} + expected(struct error, Error error) : data{{}, std::move(error)} {} + expected(DataPtr & p) : data{std::move(p.p->val), std::move(p.p->error)} {} + + struct promise_type { + Data* data; + DataPtr get_return_object() { data = new Data{}; return {data}; } + suspend_never initial_suspend() { return {}; } + suspend_never final_suspend() { return {}; } + void return_value(T v) { data->val = std::move(v); data->error = {};} + void unhandled_exception() {} + }; + + bool await_ready() { return !data.error; } + T await_resume() { return std::move(data.val); } + void await_suspend(coroutine_handle h) { + h.promise().data->error =std::move(data.error); + h.destroy(); + } + + T const& value() { return data.val; } + Error const& error() { return data.error; } +}; + +expected g() { return {0}; } +expected h() { return {error{}, 42}; } + +extern "C" void print(int); + +bool f1_started, f1_resumed = false; +expected f1() { + f1_started = true; + (void)(co_await g()); + f1_resumed = true; + co_return 100; +} + +bool f2_started, f2_resumed = false; +expected f2() { + f2_started = true; + (void)(co_await h()); + f2_resumed = true; + co_return 200; +} + +int main() { + auto c1 = f1(); + assert(f1_started && f1_resumed); + assert(c1.value() == 100); + assert(c1.error() == 0); + + auto c2 = f2(); + assert(f2_started && !f2_resumed); + assert(c2.value() == 0); + assert(c2.error() == 42); +} diff --git a/test/std/experimental/language.support/support.coroutines/end.to.end/fullexpr-dtor.pass.cpp b/test/std/experimental/language.support/support.coroutines/end.to.end/fullexpr-dtor.pass.cpp new file mode 100644 index 000000000..20bcf60fb --- /dev/null +++ b/test/std/experimental/language.support/support.coroutines/end.to.end/fullexpr-dtor.pass.cpp @@ -0,0 +1,117 @@ +// -*- C++ -*- +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// UNSUPPORTED: c++98, c++03, c++11 + +#include +#include + +#include "test_macros.h" + +using namespace std::experimental; + +int alive = 0; +int ctor_called = 0; +int dtor_called = 0; +void reset() { + assert(alive == 0); + alive = 0; + ctor_called = 0; + dtor_called = 0; +} +struct Noisy { + Noisy() { ++alive; ++ctor_called; } + ~Noisy() { --alive; ++dtor_called; } +#if TEST_STD_VER > 14 + Noisy(Noisy const&) = delete; +#else + // FIXME: This test depends on copy elision taking place in C++14 + // (pre-c++17 guaranteed copy elision) + Noisy(Noisy const&); +#endif +}; + +struct Bug { + bool await_ready() { return true; } + void await_suspend(std::experimental::coroutine_handle<>) {} + Noisy await_resume() { return {}; } +}; +struct coro2 { + struct promise_type { + suspend_never initial_suspend() { return{}; } + suspend_never final_suspend() { return{}; } + coro2 get_return_object() { return{}; } + void return_void() {} + Bug yield_value(int) { return {}; } + void unhandled_exception() {} + }; +}; + +// Checks that destructors are correctly invoked for the object returned by +// coawait. +coro2 a() { + reset(); + { + auto x = co_await Bug{}; + assert(alive == 1); + assert(ctor_called == 1); + assert(dtor_called == 0); + ((void)x); + } + assert(alive == 0); + assert(dtor_called == 1); +} + +coro2 b() { + reset(); + { + (void)(co_await Bug{}); + assert(ctor_called == 1); + assert(dtor_called == 1); + assert(alive == 0); + } + assert(ctor_called == 1); + assert(dtor_called == 1); + assert(alive == 0); + +} + +coro2 c() { + reset(); + { + auto x = co_yield 42; + assert(alive == 1); + assert(ctor_called == 1); + assert(dtor_called == 0); + } + assert(alive == 0); + assert(ctor_called == 1); + assert(dtor_called == 1); +} + +coro2 d() { + reset(); + { + (void)(co_yield 42); + assert(ctor_called == 1); + assert(dtor_called == 1); + assert(alive == 0); + } + assert(alive == 0); + assert(ctor_called == 1); + assert(dtor_called == 1); +} + +int main() { + a(); + b(); + c(); + d(); +} diff --git a/test/std/experimental/language.support/support.coroutines/end.to.end/generator.pass.cpp b/test/std/experimental/language.support/support.coroutines/end.to.end/generator.pass.cpp new file mode 100644 index 000000000..c92e26184 --- /dev/null +++ b/test/std/experimental/language.support/support.coroutines/end.to.end/generator.pass.cpp @@ -0,0 +1,103 @@ +// -*- C++ -*- +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// UNSUPPORTED: c++98, c++03, c++11 + +// See https://bugs.llvm.org/show_bug.cgi?id=33271 +// UNSUPPORTED: ubsan + +#include +#include +#include + +#include "coroutine_types.h" + +using namespace std::experimental; + +struct minig { + struct promise_type { + int current_value; + suspend_always yield_value(int value) { + this->current_value = value; + return {}; + } + suspend_always initial_suspend() { return {}; } + suspend_always final_suspend() { return {}; } + minig get_return_object() { return minig{this}; }; + void return_void() {} + void unhandled_exception() {} + }; + + bool move_next() { + p.resume(); + return !p.done(); + } + int current_value() { return p.promise().current_value; } + + minig(minig &&rhs) : p(rhs.p) { rhs.p = nullptr; } + + ~minig() { + if (p) + p.destroy(); + } + +private: + explicit minig(promise_type *p) + : p(coroutine_handle::from_promise(*p)) {} + + coroutine_handle p; +}; + + +minig mini_count(int n) { + for (int i = 0; i < n; i++) { + co_yield i; + } +} + +generator count(int n) { + for (int i = 0; i < n; ++i) + co_yield i; +} + +generator range(int from, int n) { + for (int i = from; i < n; ++i) + co_yield i; +} + +void test_count() { + const std::vector expect = {0, 1, 2, 3, 4}; + std::vector got; + for (auto x : count(5)) + got.push_back(x); + assert(expect == got); +} + +void test_range() { + int sum = 0; + for (auto v: range(1, 20)) + sum += v; + assert(sum == 190); +} + +void test_mini_generator() { + int sum = 0; + auto g = mini_count(5); + while (g.move_next()) { + sum += g.current_value(); + } + assert(sum == 10); +} + +int main() { + test_count(); + test_range(); + test_mini_generator(); +} diff --git a/test/std/experimental/language.support/support.coroutines/end.to.end/go.pass.cpp b/test/std/experimental/language.support/support.coroutines/end.to.end/go.pass.cpp new file mode 100644 index 000000000..1fdf2c855 --- /dev/null +++ b/test/std/experimental/language.support/support.coroutines/end.to.end/go.pass.cpp @@ -0,0 +1,176 @@ +// -*- C++ -*- +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// UNSUPPORTED: c++98, c++03, c++11 + +#include +#include + +using namespace std::experimental; + +bool cancel = false; + +struct goroutine +{ + static int const N = 10; + static int count; + static coroutine_handle<> stack[N]; + + static void schedule(coroutine_handle<>& rh) + { + assert(count < N); + stack[count++] = rh; + rh = nullptr; + } + + ~goroutine() {} + + static void go(goroutine) {} + + static void run_one() + { + assert(count > 0); + stack[--count](); + } + + struct promise_type + { + suspend_never initial_suspend() { + return {}; + } + suspend_never final_suspend() { + return {}; + } + void return_void() {} + goroutine get_return_object() { + return{}; + } + void unhandled_exception() {} + }; +}; +int goroutine::count; +coroutine_handle<> goroutine::stack[N]; + +coroutine_handle workaround; + +class channel; + +struct push_awaiter { + channel* ch; + bool await_ready() {return false; } + void await_suspend(coroutine_handle<> rh); + void await_resume() {} +}; + +struct pull_awaiter { + channel * ch; + + bool await_ready(); + void await_suspend(coroutine_handle<> rh); + int await_resume(); +}; + +class channel +{ + using T = int; + + friend struct push_awaiter; + friend struct pull_awaiter; + + T const* pvalue = nullptr; + coroutine_handle<> reader = nullptr; + coroutine_handle<> writer = nullptr; +public: + push_awaiter push(T const& value) + { + assert(pvalue == nullptr); + assert(!writer); + pvalue = &value; + + return { this }; + } + + pull_awaiter pull() + { + assert(!reader); + + return { this }; + } + + void sync_push(T const& value) + { + assert(!pvalue); + pvalue = &value; + assert(reader); + reader(); + assert(!pvalue); + reader = nullptr; + } + + auto sync_pull() + { + while (!pvalue) goroutine::run_one(); + auto result = *pvalue; + pvalue = nullptr; + if (writer) + { + auto wr = writer; + writer = nullptr; + wr(); + } + return result; + } +}; + +void push_awaiter::await_suspend(coroutine_handle<> rh) +{ + ch->writer = rh; + if (ch->reader) goroutine::schedule(ch->reader); +} + + +bool pull_awaiter::await_ready() { + return !!ch->writer; +} +void pull_awaiter::await_suspend(coroutine_handle<> rh) { + ch->reader = rh; +} +int pull_awaiter::await_resume() { + auto result = *ch->pvalue; + ch->pvalue = nullptr; + if (ch->writer) { + //goroutine::schedule(ch->writer); + auto wr = ch->writer; + ch->writer = nullptr; + wr(); + } + return result; +} + +goroutine pusher(channel& left, channel& right) +{ + for (;;) { + auto val = co_await left.pull(); + co_await right.push(val + 1); + } +} + +const int N = 100; +channel* c = new channel[N + 1]; + +int main() { + for (int i = 0; i < N; ++i) + goroutine::go(pusher(c[i], c[i + 1])); + + c[0].sync_push(0); + int result = c[N].sync_pull(); + + assert(result == 100); +} diff --git a/test/std/experimental/language.support/support.coroutines/end.to.end/multishot_func.pass.cpp b/test/std/experimental/language.support/support.coroutines/end.to.end/multishot_func.pass.cpp new file mode 100644 index 000000000..e3c965303 --- /dev/null +++ b/test/std/experimental/language.support/support.coroutines/end.to.end/multishot_func.pass.cpp @@ -0,0 +1,87 @@ +// -*- C++ -*- +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// UNSUPPORTED: c++98, c++03, c++11 + +#include +#include + +using namespace std::experimental; + +// This file tests, multishot, movable std::function like thing using coroutine +// for compile-time type erasure and unerasure. +template struct func { + struct Input {R a, b;}; + + struct promise_type { + Input* I; + R result; + func get_return_object() { return {this}; } + suspend_always initial_suspend() { return {}; } + suspend_never final_suspend() { return {}; } + void return_void() {} + template + suspend_always yield_value(F&& f) { + result = f(I->a, I->b); + return {}; + } + void unhandled_exception() {} + }; + + R operator()(Input I) { + h.promise().I = &I; + h.resume(); + R result = h.promise().result; + return result; + }; + + func() {} + func(func &&rhs) : h(rhs.h) { rhs.h = nullptr; } + func(func const &) = delete; + + func &operator=(func &&rhs) { + if (this != &rhs) { + if (h) + h.destroy(); + h = rhs.h; + rhs.h = nullptr; + } + return *this; + } + + template static func Create(F f) { + for (;;) { + co_yield f; + } + } + + template func(F f) : func(Create(f)) {} + + ~func() { + if (h) + h.destroy(); + } + +private: + func(promise_type *promise) + : h(coroutine_handle::from_promise(*promise)) {} + coroutine_handle h; +}; + +int Do(int acc, int n, func f) { + for (int i = 0; i < n; ++i) + acc = f({acc, i}); + return acc; +} + +int main() { + int result = Do(1, 10, [](int a, int b) {return a + b;}); + assert(result == 46); +} diff --git a/test/std/experimental/language.support/support.coroutines/end.to.end/oneshot_func.pass.cpp b/test/std/experimental/language.support/support.coroutines/end.to.end/oneshot_func.pass.cpp new file mode 100644 index 000000000..ae0a950dc --- /dev/null +++ b/test/std/experimental/language.support/support.coroutines/end.to.end/oneshot_func.pass.cpp @@ -0,0 +1,83 @@ +// -*- C++ -*- +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// UNSUPPORTED: c++98, c++03, c++11 + +#include +#include +#include + +using namespace std::experimental; + +// This file tests, one shot, movable std::function like thing using coroutine +// for compile-time type erasure and unerasure. + +template struct func { + struct promise_type { + R result; + func get_return_object() { return {this}; } + suspend_always initial_suspend() { return {}; } + suspend_always final_suspend() { return {}; } + void return_value(R v) { result = v; } + void unhandled_exception() {} + }; + + R operator()() { + h.resume(); + R result = h.promise().result; + h.destroy(); + h = nullptr; + return result; + }; + + func() {} + func(func &&rhs) : h(rhs.h) { rhs.h = nullptr; } + func(func const &) = delete; + + func &operator=(func &&rhs) { + if (this != &rhs) { + if (h) + h.destroy(); + h = rhs.h; + rhs.h = nullptr; + } + return *this; + } + + template static func Create(F f) { co_return f(); } + + template func(F f) : func(Create(f)) {} + + ~func() { + if (h) + h.destroy(); + } + +private: + func(promise_type *promise) + : h(coroutine_handle::from_promise(*promise)) {} + coroutine_handle h; +}; + +std::vector yielded_values = {}; +int yield(int x) { yielded_values.push_back(x); return x + 1; } +float fyield(int x) { yielded_values.push_back(x); return static_cast(x + 2); } + +void Do1(func f) { yield(f()); } +void Do2(func f) { yield(static_cast(f())); } + +int main() { + Do1([] { return yield(43); }); + assert((yielded_values == std::vector{43, 44})); + + yielded_values = {}; + Do2([] { return fyield(44); }); + assert((yielded_values == std::vector{44, 46})); +} diff --git a/test/std/experimental/language.support/support.coroutines/includes.pass.cpp b/test/std/experimental/language.support/support.coroutines/includes.pass.cpp new file mode 100644 index 000000000..b30d8c7ed --- /dev/null +++ b/test/std/experimental/language.support/support.coroutines/includes.pass.cpp @@ -0,0 +1,25 @@ +// -*- C++ -*- +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// UNSUPPORTED: c++98, c++03, c++11 + +// + +// Test that includes + +#include + +int main(){ + // std::nothrow is not implicitly defined by the compiler when the include is + // missing, unlike other parts of . Therefore we use std::nothrow to + // test for #include + (void)std::nothrow; + +} diff --git a/test/std/experimental/language.support/support.coroutines/lit.local.cfg b/test/std/experimental/language.support/support.coroutines/lit.local.cfg new file mode 100644 index 000000000..a0b3de8af --- /dev/null +++ b/test/std/experimental/language.support/support.coroutines/lit.local.cfg @@ -0,0 +1,9 @@ +# If the compiler doesn't support coroutines mark all of the tests under +# this directory as unsupported. Otherwise add the required `-fcoroutines-ts` +# flag. +if 'fcoroutines-ts' not in config.available_features: + config.unsupported = True +else: + import copy + config.test_format.cxx = copy.deepcopy(config.test_format.cxx) + config.test_format.cxx.compile_flags += ['-fcoroutines-ts'] diff --git a/test/std/experimental/optional/optional.bad_optional_access/default.pass.cpp b/test/std/experimental/optional/optional.bad_optional_access/default.pass.cpp index c166bb72a..f26914982 100644 --- a/test/std/experimental/optional/optional.bad_optional_access/default.pass.cpp +++ b/test/std/experimental/optional/optional.bad_optional_access/default.pass.cpp @@ -8,6 +8,12 @@ //===----------------------------------------------------------------------===// // UNSUPPORTED: c++98, c++03, c++11 +// XFAIL: availability=macosx10.12 +// XFAIL: availability=macosx10.11 +// XFAIL: availability=macosx10.10 +// XFAIL: availability=macosx10.9 +// XFAIL: availability=macosx10.8 +// XFAIL: availability=macosx10.7 // diff --git a/test/std/experimental/optional/optional.bad_optional_access/derive.pass.cpp b/test/std/experimental/optional/optional.bad_optional_access/derive.pass.cpp index 4630165f0..a4af713a3 100644 --- a/test/std/experimental/optional/optional.bad_optional_access/derive.pass.cpp +++ b/test/std/experimental/optional/optional.bad_optional_access/derive.pass.cpp @@ -8,6 +8,12 @@ //===----------------------------------------------------------------------===// // UNSUPPORTED: c++98, c++03, c++11 +// XFAIL: availability_markup=macosx10.12 +// XFAIL: availability_markup=macosx10.11 +// XFAIL: availability_markup=macosx10.10 +// XFAIL: availability_markup=macosx10.9 +// XFAIL: availability_markup=macosx10.8 +// XFAIL: availability_markup=macosx10.7 // 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 c8f07111c..72d779059 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 @@ -8,6 +8,13 @@ //===----------------------------------------------------------------------===// // UNSUPPORTED: c++98, c++03, c++11 +// XFAIL: availability=macosx10.12 +// XFAIL: availability=macosx10.11 +// XFAIL: availability=macosx10.10 +// XFAIL: availability=macosx10.9 +// XFAIL: availability=macosx10.8 +// XFAIL: availability=macosx10.7 + // // T& optional::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 98ff16e4d..b3d6dfda4 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 @@ -8,6 +8,13 @@ //===----------------------------------------------------------------------===// // UNSUPPORTED: c++98, c++03, c++11 +// XFAIL: availability=macosx10.12 +// XFAIL: availability=macosx10.11 +// XFAIL: availability=macosx10.10 +// XFAIL: availability=macosx10.9 +// XFAIL: availability=macosx10.8 +// XFAIL: availability=macosx10.7 + // // constexpr const T& optional::value() const; diff --git a/test/std/experimental/utilities/meta/meta.type.synop/meta.unary.prop.pass.cpp b/test/std/experimental/utilities/meta/meta.type.synop/meta.unary.prop.pass.cpp index e267c6833..bfd385a1b 100644 --- a/test/std/experimental/utilities/meta/meta.type.synop/meta.unary.prop.pass.cpp +++ b/test/std/experimental/utilities/meta/meta.type.synop/meta.unary.prop.pass.cpp @@ -8,6 +8,12 @@ //===----------------------------------------------------------------------===// // UNSUPPORTED: c++98, c++03, c++11 + +// GCC returns true for __is_trivially_constructible(void, int) +// See gcc.gnu.org/PR80682 +// NOTE: This has been fixed in trunk and will be backported soon. +// XFAIL: gcc-7, gcc-6, gcc-5, gcc-4 + // #include diff --git a/test/std/input.output/file.streams/c.files/no.global.filesystem.namespace/lit.local.cfg b/test/std/input.output/file.streams/c.files/no.global.filesystem.namespace/lit.local.cfg deleted file mode 100644 index 4ea670935..000000000 --- a/test/std/input.output/file.streams/c.files/no.global.filesystem.namespace/lit.local.cfg +++ /dev/null @@ -1,2 +0,0 @@ -if 'libcpp-has-no-global-filesystem-namespace' not in config.available_features: - config.unsupported = True diff --git a/test/std/input.output/file.streams/fstreams/filebuf.assign/move_assign.pass.cpp b/test/std/input.output/file.streams/fstreams/filebuf.assign/move_assign.pass.cpp index a92ec872a..66409543f 100644 --- a/test/std/input.output/file.streams/fstreams/filebuf.assign/move_assign.pass.cpp +++ b/test/std/input.output/file.streams/fstreams/filebuf.assign/move_assign.pass.cpp @@ -7,6 +7,8 @@ // //===----------------------------------------------------------------------===// +// UNSUPPORTED: c++98, c++03 + // // template > @@ -20,7 +22,6 @@ int main() { -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES std::string temp = get_temp_file_name(); { std::filebuf f; @@ -52,5 +53,4 @@ int main() assert(f2.sgetc() == L'2'); } std::remove(temp.c_str()); -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES } diff --git a/test/std/input.output/file.streams/fstreams/filebuf.cons/move.pass.cpp b/test/std/input.output/file.streams/fstreams/filebuf.cons/move.pass.cpp index f13ee4470..96806fbfe 100644 --- a/test/std/input.output/file.streams/fstreams/filebuf.cons/move.pass.cpp +++ b/test/std/input.output/file.streams/fstreams/filebuf.cons/move.pass.cpp @@ -7,6 +7,8 @@ // //===----------------------------------------------------------------------===// +// UNSUPPORTED: c++98, c++03 + // // template > @@ -20,7 +22,6 @@ int main() { -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES std::string temp = get_temp_file_name(); { std::filebuf f; @@ -50,5 +51,4 @@ int main() assert(f2.sgetc() == L'2'); } std::remove(temp.c_str()); -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES } diff --git a/test/std/input.output/file.streams/fstreams/fstream.assign/member_swap.pass.cpp b/test/std/input.output/file.streams/fstreams/fstream.assign/member_swap.pass.cpp index fcc86a13f..949ea50d0 100644 --- a/test/std/input.output/file.streams/fstreams/fstream.assign/member_swap.pass.cpp +++ b/test/std/input.output/file.streams/fstreams/fstream.assign/member_swap.pass.cpp @@ -15,13 +15,33 @@ // void swap(basic_fstream& rhs); #include +#include #include #include "platform_support.h" +std::pair get_temp_file_names() { + std::pair names; + names.first = get_temp_file_name(); + + // Create the file so the next call to `get_temp_file_name()` doesn't + // return the same file. + std::FILE *fd1 = std::fopen(names.first.c_str(), "w"); + + names.second = get_temp_file_name(); + assert(names.first != names.second); + + std::fclose(fd1); + std::remove(names.first.c_str()); + + return names; +} + int main() { - std::string temp1 = get_temp_file_name(); - std::string temp2 = get_temp_file_name(); + std::pair temp_files = get_temp_file_names(); + std::string& temp1 = temp_files.first; + std::string& temp2 = temp_files.second; + assert(temp1 != temp2); { std::fstream fs1(temp1.c_str(), std::ios_base::in | std::ios_base::out | std::ios_base::trunc); diff --git a/test/std/input.output/file.streams/fstreams/fstream.assign/move_assign.pass.cpp b/test/std/input.output/file.streams/fstreams/fstream.assign/move_assign.pass.cpp index b5157e90e..b143bd4a5 100644 --- a/test/std/input.output/file.streams/fstreams/fstream.assign/move_assign.pass.cpp +++ b/test/std/input.output/file.streams/fstreams/fstream.assign/move_assign.pass.cpp @@ -7,6 +7,8 @@ // //===----------------------------------------------------------------------===// +// UNSUPPORTED: c++98, c++03 + // // template > @@ -20,7 +22,6 @@ int main() { -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES std::string temp = get_temp_file_name(); { std::fstream fso(temp.c_str(), std::ios_base::in | std::ios_base::out @@ -46,5 +47,4 @@ int main() assert(x == 3.25); } std::remove(temp.c_str()); -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES } diff --git a/test/std/input.output/file.streams/fstreams/fstream.assign/nonmember_swap.pass.cpp b/test/std/input.output/file.streams/fstreams/fstream.assign/nonmember_swap.pass.cpp index 0a4f7240d..4ff84f26c 100644 --- a/test/std/input.output/file.streams/fstreams/fstream.assign/nonmember_swap.pass.cpp +++ b/test/std/input.output/file.streams/fstreams/fstream.assign/nonmember_swap.pass.cpp @@ -16,13 +16,34 @@ // void swap(basic_fstream& x, basic_fstream& y); #include +#include #include #include "platform_support.h" + +std::pair get_temp_file_names() { + std::pair names; + names.first = get_temp_file_name(); + + // Create the file so the next call to `get_temp_file_name()` doesn't + // return the same file. + std::FILE *fd1 = std::fopen(names.first.c_str(), "w"); + + names.second = get_temp_file_name(); + assert(names.first != names.second); + + std::fclose(fd1); + std::remove(names.first.c_str()); + + return names; +} + int main() { - std::string temp1 = get_temp_file_name(); - std::string temp2 = get_temp_file_name(); + std::pair temp_files = get_temp_file_names(); + std::string& temp1 = temp_files.first; + std::string& temp2 = temp_files.second; + assert(temp1 != temp2); { std::fstream fs1(temp1.c_str(), std::ios_base::in | std::ios_base::out | std::ios_base::trunc); diff --git a/test/std/input.output/file.streams/fstreams/fstream.cons/move.pass.cpp b/test/std/input.output/file.streams/fstreams/fstream.cons/move.pass.cpp index d2ae30286..556cc858a 100644 --- a/test/std/input.output/file.streams/fstreams/fstream.cons/move.pass.cpp +++ b/test/std/input.output/file.streams/fstreams/fstream.cons/move.pass.cpp @@ -7,6 +7,8 @@ // //===----------------------------------------------------------------------===// +// UNSUPPORTED: c++98, c++03 + // // template > @@ -20,7 +22,6 @@ int main() { -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES std::string temp = get_temp_file_name(); { std::fstream fso(temp, std::ios_base::in | std::ios_base::out @@ -44,5 +45,4 @@ int main() assert(x == 3.25); } std::remove(temp.c_str()); -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES } diff --git a/test/std/input.output/file.streams/fstreams/ifstream.assign/move_assign.pass.cpp b/test/std/input.output/file.streams/fstreams/ifstream.assign/move_assign.pass.cpp index 9c2fcad33..36fa29a4e 100644 --- a/test/std/input.output/file.streams/fstreams/ifstream.assign/move_assign.pass.cpp +++ b/test/std/input.output/file.streams/fstreams/ifstream.assign/move_assign.pass.cpp @@ -7,6 +7,8 @@ // //===----------------------------------------------------------------------===// +// UNSUPPORTED: c++98, c++03 + // // template > @@ -19,7 +21,6 @@ int main() { -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES { std::ifstream fso("test.dat"); std::ifstream fs; @@ -36,5 +37,4 @@ int main() fs >> x; assert(x == 3.25); } -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES } diff --git a/test/std/input.output/file.streams/fstreams/ifstream.cons/move.pass.cpp b/test/std/input.output/file.streams/fstreams/ifstream.cons/move.pass.cpp index aaac12122..eeb06e0e5 100644 --- a/test/std/input.output/file.streams/fstreams/ifstream.cons/move.pass.cpp +++ b/test/std/input.output/file.streams/fstreams/ifstream.cons/move.pass.cpp @@ -7,6 +7,8 @@ // //===----------------------------------------------------------------------===// +// UNSUPPORTED: c++98, c++03 + // // template > @@ -19,7 +21,6 @@ int main() { -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES { std::ifstream fso("test.dat"); std::ifstream fs = move(fso); @@ -34,5 +35,4 @@ int main() fs >> x; assert(x == 3.25); } -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES } diff --git a/test/std/input.output/file.streams/fstreams/ofstream.assign/member_swap.pass.cpp b/test/std/input.output/file.streams/fstreams/ofstream.assign/member_swap.pass.cpp index 519b84fb1..95224774c 100644 --- a/test/std/input.output/file.streams/fstreams/ofstream.assign/member_swap.pass.cpp +++ b/test/std/input.output/file.streams/fstreams/ofstream.assign/member_swap.pass.cpp @@ -15,13 +15,33 @@ // void swap(basic_ofstream& rhs); #include +#include #include #include "platform_support.h" +std::pair get_temp_file_names() { + std::pair names; + names.first = get_temp_file_name(); + + // Create the file so the next call to `get_temp_file_name()` doesn't + // return the same file. + std::FILE *fd1 = std::fopen(names.first.c_str(), "w"); + + names.second = get_temp_file_name(); + assert(names.first != names.second); + + std::fclose(fd1); + std::remove(names.first.c_str()); + + return names; +} + int main() { - std::string temp1 = get_temp_file_name(); - std::string temp2 = get_temp_file_name(); + std::pair temp_files = get_temp_file_names(); + std::string& temp1 = temp_files.first; + std::string& temp2 = temp_files.second; + assert(temp1 != temp2); { std::ofstream fs1(temp1.c_str()); std::ofstream fs2(temp2.c_str()); diff --git a/test/std/input.output/file.streams/fstreams/ofstream.assign/move_assign.pass.cpp b/test/std/input.output/file.streams/fstreams/ofstream.assign/move_assign.pass.cpp index 0f21eb81d..094f55073 100644 --- a/test/std/input.output/file.streams/fstreams/ofstream.assign/move_assign.pass.cpp +++ b/test/std/input.output/file.streams/fstreams/ofstream.assign/move_assign.pass.cpp @@ -7,6 +7,8 @@ // //===----------------------------------------------------------------------===// +// UNSUPPORTED: c++98, c++03 + // // template > @@ -20,7 +22,6 @@ int main() { -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES std::string temp = get_temp_file_name(); { std::ofstream fso(temp.c_str()); @@ -48,5 +49,4 @@ int main() assert(x == 3.25); } std::remove(temp.c_str()); -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES } diff --git a/test/std/input.output/file.streams/fstreams/ofstream.assign/nonmember_swap.pass.cpp b/test/std/input.output/file.streams/fstreams/ofstream.assign/nonmember_swap.pass.cpp index d58f5f256..31f2153eb 100644 --- a/test/std/input.output/file.streams/fstreams/ofstream.assign/nonmember_swap.pass.cpp +++ b/test/std/input.output/file.streams/fstreams/ofstream.assign/nonmember_swap.pass.cpp @@ -16,13 +16,33 @@ // void swap(basic_ofstream& x, basic_ofstream& y); #include +#include #include #include "platform_support.h" +std::pair get_temp_file_names() { + std::pair names; + names.first = get_temp_file_name(); + + // Create the file so the next call to `get_temp_file_name()` doesn't + // return the same file. + std::FILE *fd1 = std::fopen(names.first.c_str(), "w"); + + names.second = get_temp_file_name(); + assert(names.first != names.second); + + std::fclose(fd1); + std::remove(names.first.c_str()); + + return names; +} + int main() { - std::string temp1 = get_temp_file_name(); - std::string temp2 = get_temp_file_name(); + std::pair temp_files = get_temp_file_names(); + std::string& temp1 = temp_files.first; + std::string& temp2 = temp_files.second; + assert(temp1 != temp2); { std::ofstream fs1(temp1.c_str()); std::ofstream fs2(temp2.c_str()); diff --git a/test/std/input.output/file.streams/fstreams/ofstream.cons/move.pass.cpp b/test/std/input.output/file.streams/fstreams/ofstream.cons/move.pass.cpp index 8645358cb..fe885cf40 100644 --- a/test/std/input.output/file.streams/fstreams/ofstream.cons/move.pass.cpp +++ b/test/std/input.output/file.streams/fstreams/ofstream.cons/move.pass.cpp @@ -7,6 +7,8 @@ // //===----------------------------------------------------------------------===// +// UNSUPPORTED: c++98, c++03 + // // template > @@ -20,7 +22,6 @@ int main() { -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES std::string temp = get_temp_file_name(); { std::ofstream fso(temp.c_str()); @@ -46,5 +47,4 @@ int main() assert(x == 3.25); } std::remove(temp.c_str()); -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES } diff --git a/test/std/input.output/iostream.format/input.streams/iostreamclass/iostream.assign/move_assign.pass.cpp b/test/std/input.output/iostream.format/input.streams/iostreamclass/iostream.assign/move_assign.pass.cpp index 2032e935b..cf6c8ae68 100644 --- a/test/std/input.output/iostream.format/input.streams/iostreamclass/iostream.assign/move_assign.pass.cpp +++ b/test/std/input.output/iostream.format/input.streams/iostreamclass/iostream.assign/move_assign.pass.cpp @@ -7,6 +7,8 @@ // //===----------------------------------------------------------------------===// +// UNSUPPORTED: c++98, c++03 + // // template > @@ -17,7 +19,6 @@ #include #include -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES template struct testbuf @@ -37,11 +38,9 @@ struct test_iostream {base::operator=(std::move(s)); return *this;} }; -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES int main() { -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES { testbuf sb1; testbuf sb2; @@ -88,5 +87,4 @@ int main() assert(is2.precision() == 6); assert(is2.getloc().name() == "C"); } -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES } diff --git a/test/std/input.output/iostream.format/input.streams/iostreamclass/iostream.cons/move.pass.cpp b/test/std/input.output/iostream.format/input.streams/iostreamclass/iostream.cons/move.pass.cpp index c0592e927..e8fd00c7a 100644 --- a/test/std/input.output/iostream.format/input.streams/iostreamclass/iostream.cons/move.pass.cpp +++ b/test/std/input.output/iostream.format/input.streams/iostreamclass/iostream.cons/move.pass.cpp @@ -7,6 +7,8 @@ // //===----------------------------------------------------------------------===// +// UNSUPPORTED: c++98, c++03 + // // template > @@ -17,7 +19,6 @@ #include #include -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES template struct testbuf @@ -37,11 +38,9 @@ struct test_iostream : base(std::move(s)) {} }; -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES int main() { -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES { testbuf sb; test_iostream is1(&sb); @@ -74,5 +73,4 @@ int main() assert(is.precision() == 6); assert(is.getloc().name() == "C"); } -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES } diff --git a/test/std/input.output/iostream.format/input.streams/istream.formatted/istream.formatted.arithmetic/pointer.pass.cpp b/test/std/input.output/iostream.format/input.streams/istream.formatted/istream.formatted.arithmetic/pointer.pass.cpp index 52b356664..eda490f8d 100644 --- a/test/std/input.output/iostream.format/input.streams/istream.formatted/istream.formatted.arithmetic/pointer.pass.cpp +++ b/test/std/input.output/iostream.format/input.streams/istream.formatted/istream.formatted.arithmetic/pointer.pass.cpp @@ -7,6 +7,10 @@ // //===----------------------------------------------------------------------===// +// XFAIL: with_system_cxx_lib=macosx10.11 +// XFAIL: with_system_cxx_lib=macosx10.10 +// XFAIL: with_system_cxx_lib=macosx10.9 + // // template > diff --git a/test/std/input.output/iostream.format/input.streams/istream.unformatted/get.pass.cpp b/test/std/input.output/iostream.format/input.streams/istream.unformatted/get.pass.cpp index 0f356e26d..c7f16ca7e 100644 --- a/test/std/input.output/iostream.format/input.streams/istream.unformatted/get.pass.cpp +++ b/test/std/input.output/iostream.format/input.streams/istream.unformatted/get.pass.cpp @@ -7,6 +7,8 @@ // //===----------------------------------------------------------------------===// +// XFAIL: with_system_cxx_lib=macosx10.7 + // // int_type get(); diff --git a/test/std/input.output/iostream.format/input.streams/istream.unformatted/get_chart.pass.cpp b/test/std/input.output/iostream.format/input.streams/istream.unformatted/get_chart.pass.cpp index cf06e343b..b3d3c69b4 100644 --- a/test/std/input.output/iostream.format/input.streams/istream.unformatted/get_chart.pass.cpp +++ b/test/std/input.output/iostream.format/input.streams/istream.unformatted/get_chart.pass.cpp @@ -7,6 +7,8 @@ // //===----------------------------------------------------------------------===// +// XFAIL: with_system_cxx_lib=macosx10.7 + // // basic_istream& get(char_type& c); diff --git a/test/std/input.output/iostream.format/input.streams/istream.unformatted/ignore_0xff.pass.cpp b/test/std/input.output/iostream.format/input.streams/istream.unformatted/ignore_0xff.pass.cpp index 3095712b9..3a37cffce 100644 --- a/test/std/input.output/iostream.format/input.streams/istream.unformatted/ignore_0xff.pass.cpp +++ b/test/std/input.output/iostream.format/input.streams/istream.unformatted/ignore_0xff.pass.cpp @@ -7,6 +7,9 @@ // //===----------------------------------------------------------------------===// +// XFAIL: with_system_cxx_lib=macosx10.7 +// XFAIL: with_system_cxx_lib=macosx10.8 + // // basic_istream& diff --git a/test/std/input.output/iostream.format/input.streams/istream.unformatted/read.pass.cpp b/test/std/input.output/iostream.format/input.streams/istream.unformatted/read.pass.cpp index 20e70cfbd..ceef0d28f 100644 --- a/test/std/input.output/iostream.format/input.streams/istream.unformatted/read.pass.cpp +++ b/test/std/input.output/iostream.format/input.streams/istream.unformatted/read.pass.cpp @@ -7,6 +7,8 @@ // //===----------------------------------------------------------------------===// +// XFAIL: with_system_cxx_lib=macosx10.7 + // // basic_istream& read(char_type* s, streamsize n); diff --git a/test/std/input.output/iostream.format/input.streams/istream.unformatted/readsome.pass.cpp b/test/std/input.output/iostream.format/input.streams/istream.unformatted/readsome.pass.cpp index 01eecb5d8..a0a8e2f1b 100644 --- a/test/std/input.output/iostream.format/input.streams/istream.unformatted/readsome.pass.cpp +++ b/test/std/input.output/iostream.format/input.streams/istream.unformatted/readsome.pass.cpp @@ -7,6 +7,9 @@ // //===----------------------------------------------------------------------===// +// XFAIL: with_system_cxx_lib=macosx10.7 +// XFAIL: with_system_cxx_lib=macosx10.8 + // // streamsize readsome(char_type* s, streamsize n); diff --git a/test/std/input.output/iostream.format/input.streams/istream.unformatted/seekg.pass.cpp b/test/std/input.output/iostream.format/input.streams/istream.unformatted/seekg.pass.cpp index dc4e0ba0d..e370b4bfb 100644 --- a/test/std/input.output/iostream.format/input.streams/istream.unformatted/seekg.pass.cpp +++ b/test/std/input.output/iostream.format/input.streams/istream.unformatted/seekg.pass.cpp @@ -7,6 +7,9 @@ // //===----------------------------------------------------------------------===// +// XFAIL: with_system_cxx_lib=macosx10.7 +// XFAIL: with_system_cxx_lib=macosx10.8 + // // basic_istream& seekg(pos_type pos); diff --git a/test/std/input.output/iostream.format/input.streams/istream.unformatted/seekg_off.pass.cpp b/test/std/input.output/iostream.format/input.streams/istream.unformatted/seekg_off.pass.cpp index 818d42c26..cac1e3955 100644 --- a/test/std/input.output/iostream.format/input.streams/istream.unformatted/seekg_off.pass.cpp +++ b/test/std/input.output/iostream.format/input.streams/istream.unformatted/seekg_off.pass.cpp @@ -7,6 +7,13 @@ // //===----------------------------------------------------------------------===// +// XFAIL: with_system_cxx_lib=macosx10.12 +// XFAIL: with_system_cxx_lib=macosx10.11 +// XFAIL: with_system_cxx_lib=macosx10.10 +// XFAIL: with_system_cxx_lib=macosx10.9 +// XFAIL: with_system_cxx_lib=macosx10.7 +// XFAIL: with_system_cxx_lib=macosx10.8 + // // basic_istream& seekg(off_type off, ios_base::seekdir dir); diff --git a/test/std/input.output/iostream.format/input.streams/istream/istream.assign/move_assign.pass.cpp b/test/std/input.output/iostream.format/input.streams/istream/istream.assign/move_assign.pass.cpp index 2876d76c1..18887b75d 100644 --- a/test/std/input.output/iostream.format/input.streams/istream/istream.assign/move_assign.pass.cpp +++ b/test/std/input.output/iostream.format/input.streams/istream/istream.assign/move_assign.pass.cpp @@ -7,6 +7,8 @@ // //===----------------------------------------------------------------------===// +// UNSUPPORTED: c++98, c++03 + // // template > @@ -17,7 +19,6 @@ #include #include -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES template struct testbuf @@ -37,11 +38,9 @@ struct test_istream {base::operator=(std::move(s)); return *this;} }; -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES int main() { -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES { testbuf sb1; testbuf sb2; @@ -88,5 +87,4 @@ int main() assert(is2.precision() == 6); assert(is2.getloc().name() == "C"); } -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES } diff --git a/test/std/input.output/iostream.format/output.streams/ostream.assign/move_assign.pass.cpp b/test/std/input.output/iostream.format/output.streams/ostream.assign/move_assign.pass.cpp index 40fe0795d..1b58a9a52 100644 --- a/test/std/input.output/iostream.format/output.streams/ostream.assign/move_assign.pass.cpp +++ b/test/std/input.output/iostream.format/output.streams/ostream.assign/move_assign.pass.cpp @@ -7,6 +7,8 @@ // //===----------------------------------------------------------------------===// +// UNSUPPORTED: c++98, c++03 + // // template > @@ -17,7 +19,6 @@ #include #include -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES template struct testbuf @@ -37,11 +38,9 @@ struct test_ostream {base::operator=(std::move(s)); return *this;} }; -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES int main() { -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES { testbuf sb1; testbuf sb2; @@ -88,5 +87,4 @@ int main() assert(os2.precision() == 6); assert(os2.getloc().name() == "C"); } -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES } diff --git a/test/std/input.output/iostream.format/output.streams/ostream.cons/move.pass.cpp b/test/std/input.output/iostream.format/output.streams/ostream.cons/move.pass.cpp index b3045b323..7d225d495 100644 --- a/test/std/input.output/iostream.format/output.streams/ostream.cons/move.pass.cpp +++ b/test/std/input.output/iostream.format/output.streams/ostream.cons/move.pass.cpp @@ -7,6 +7,8 @@ // //===----------------------------------------------------------------------===// +// UNSUPPORTED: c++98, c++03 + // // template > @@ -17,7 +19,6 @@ #include #include -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES template struct testbuf @@ -37,11 +38,9 @@ struct test_ostream : base(std::move(s)) {} }; -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES int main() { -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES { testbuf sb; test_ostream os1(&sb); @@ -70,5 +69,4 @@ int main() assert(os.precision() == 6); assert(os.getloc().name() == "C"); } -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES } diff --git a/test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.arithmetic/minmax_showbase.pass.cpp b/test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.arithmetic/minmax_showbase.pass.cpp new file mode 100644 index 000000000..956cd171a --- /dev/null +++ b/test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.arithmetic/minmax_showbase.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. +// +//===----------------------------------------------------------------------===// + +// + +// template > +// class basic_ostream; + +// operator<<(short n); +// operator<<(unsigned short n); +// operator<<(int n); +// operator<<(unsigned int n); +// operator<<(long n); +// operator<<(unsigned long n); +// operator<<(long long n); +// operator<<(unsigned long long n); + +// Testing to make sure that the max length values are correctly inserted when +// using std::showbase + +#include +#include +#include +#include +#include +#include + +template +static void test(std::ios_base::fmtflags fmt, const char *expected) +{ + std::stringstream ss; + ss.setf(fmt, std::ios_base::basefield); + ss << std::showbase << (std::is_signed::value ? std::numeric_limits::min() : std::numeric_limits::max()); + assert(ss.str() == expected); +} + +int main(void) +{ + const std::ios_base::fmtflags o = std::ios_base::oct; + const std::ios_base::fmtflags d = std::ios_base::dec; + const std::ios_base::fmtflags x = std::ios_base::hex; + + test(o, "0100000"); + test(d, "-32768"); + test(x, "0x8000"); + + test(o, "0177777"); + test(d, "65535"); + test(x, "0xffff"); + + test(o, "020000000000"); + test(d, "-2147483648"); + test(x, "0x80000000"); + + test(o, "037777777777"); + test(d, "4294967295"); + test(x, "0xffffffff"); + + const bool long_is_32 = std::integral_constant::value; // avoid compiler warnings + const bool long_is_64 = std::integral_constant::value; // avoid compiler warnings + const bool long_long_is_64 = std::integral_constant::value; // avoid compiler warnings + + if (long_is_32) { + test(o, "020000000000"); + test(d, "-2147483648"); + test(x, "0x80000000"); + + test(o, "037777777777"); + test(d, "4294967295"); + test(x, "0xffffffff"); + } else if (long_is_64) { + test(o, "01000000000000000000000"); + test(d, "-9223372036854775808"); + test(x, "0x8000000000000000"); + + test(o, "01777777777777777777777"); + test(d, "18446744073709551615"); + test(x, "0xffffffffffffffff"); + } + if (long_long_is_64) { + test(o, "01000000000000000000000"); + test(d, "-9223372036854775808"); + test(x, "0x8000000000000000"); + + test(o, "01777777777777777777777"); + test(d, "18446744073709551615"); + test(x, "0xffffffffffffffff"); + } + + return 0; +} diff --git a/test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.arithmetic/minus1.pass.cpp b/test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.arithmetic/minus1.pass.cpp index e09c0ed20..54c8a2838 100644 --- a/test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.arithmetic/minus1.pass.cpp +++ b/test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.arithmetic/minus1.pass.cpp @@ -7,6 +7,8 @@ // //===----------------------------------------------------------------------===// +// XFAIL: with_system_cxx_lib=macosx10.12 + // // template > diff --git a/test/std/input.output/iostream.format/output.streams/ostream.rvalue/CharT_pointer.pass.cpp b/test/std/input.output/iostream.format/output.streams/ostream.rvalue/CharT_pointer.pass.cpp index 8be0b51d9..83210c087 100644 --- a/test/std/input.output/iostream.format/output.streams/ostream.rvalue/CharT_pointer.pass.cpp +++ b/test/std/input.output/iostream.format/output.streams/ostream.rvalue/CharT_pointer.pass.cpp @@ -7,6 +7,8 @@ // //===----------------------------------------------------------------------===// +// UNSUPPORTED: c++98, c++03 + // // template > @@ -19,7 +21,6 @@ #include #include -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES template class testbuf @@ -53,11 +54,9 @@ protected: } }; -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES int main() { -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES { testbuf sb; std::ostream(&sb) << "testing..."; @@ -68,5 +67,4 @@ int main() std::wostream(&sb) << L"123"; assert(sb.str() == L"123"); } -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES } diff --git a/test/std/input.output/string.streams/istringstream/istringstream.assign/move.pass.cpp b/test/std/input.output/string.streams/istringstream/istringstream.assign/move.pass.cpp index e57ad55c9..2a428c5d9 100644 --- a/test/std/input.output/string.streams/istringstream/istringstream.assign/move.pass.cpp +++ b/test/std/input.output/string.streams/istringstream/istringstream.assign/move.pass.cpp @@ -7,6 +7,8 @@ // //===----------------------------------------------------------------------===// +// UNSUPPORTED: c++98, c++03 + // // template , class Allocator = allocator > @@ -19,7 +21,6 @@ int main() { -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES { std::istringstream ss0(" 123 456"); std::istringstream ss; @@ -82,5 +83,4 @@ int main() s1 >> s; assert(s == L"Dddddddddddddddddd"); } -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES } diff --git a/test/std/input.output/string.streams/istringstream/istringstream.cons/move.pass.cpp b/test/std/input.output/string.streams/istringstream/istringstream.cons/move.pass.cpp index adc46ab65..0a45b796b 100644 --- a/test/std/input.output/string.streams/istringstream/istringstream.cons/move.pass.cpp +++ b/test/std/input.output/string.streams/istringstream/istringstream.cons/move.pass.cpp @@ -7,6 +7,8 @@ // //===----------------------------------------------------------------------===// +// UNSUPPORTED: c++98, c++03 + // // template , class Allocator = allocator > @@ -19,7 +21,6 @@ int main() { -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES { std::istringstream ss0(" 123 456"); std::istringstream ss(std::move(ss0)); @@ -44,5 +45,4 @@ int main() ss >> i; assert(i == 456); } -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES } diff --git a/test/std/input.output/string.streams/ostringstream/ostringstream.assign/move.pass.cpp b/test/std/input.output/string.streams/ostringstream/ostringstream.assign/move.pass.cpp index a52068595..8801001f4 100644 --- a/test/std/input.output/string.streams/ostringstream/ostringstream.assign/move.pass.cpp +++ b/test/std/input.output/string.streams/ostringstream/ostringstream.assign/move.pass.cpp @@ -7,6 +7,8 @@ // //===----------------------------------------------------------------------===// +// UNSUPPORTED: c++98, c++03 + // // template , class Allocator = allocator > @@ -19,7 +21,6 @@ int main() { -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES { std::ostringstream ss0(" 123 456"); std::ostringstream ss; @@ -42,5 +43,4 @@ int main() ss << i << ' ' << 567; assert(ss.str() == L"234 5676"); } -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES } diff --git a/test/std/input.output/string.streams/ostringstream/ostringstream.cons/move.pass.cpp b/test/std/input.output/string.streams/ostringstream/ostringstream.cons/move.pass.cpp index 3d9e305e0..67bfc50cd 100644 --- a/test/std/input.output/string.streams/ostringstream/ostringstream.cons/move.pass.cpp +++ b/test/std/input.output/string.streams/ostringstream/ostringstream.cons/move.pass.cpp @@ -7,6 +7,8 @@ // //===----------------------------------------------------------------------===// +// UNSUPPORTED: c++98, c++03 + // // template , class Allocator = allocator > @@ -19,7 +21,6 @@ int main() { -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES { std::ostringstream ss0(" 123 456"); std::ostringstream ss(std::move(ss0)); @@ -40,5 +41,4 @@ int main() ss << i << ' ' << 567; assert(ss.str() == L"234 5676"); } -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES } diff --git a/test/std/input.output/string.streams/stringstream.cons/move.pass.cpp b/test/std/input.output/string.streams/stringstream.cons/move.pass.cpp index 4ae3aa6e8..436c76c5b 100644 --- a/test/std/input.output/string.streams/stringstream.cons/move.pass.cpp +++ b/test/std/input.output/string.streams/stringstream.cons/move.pass.cpp @@ -7,6 +7,8 @@ // //===----------------------------------------------------------------------===// +// UNSUPPORTED: c++98, c++03 + // // template , class Allocator = allocator > @@ -19,7 +21,6 @@ int main() { -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES { std::stringstream ss0(" 123 456 "); std::stringstream ss(std::move(ss0)); @@ -48,5 +49,4 @@ int main() ss << i << ' ' << 123; assert(ss.str() == L"456 1236 "); } -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES } diff --git a/test/std/input.output/string.streams/stringstream.cons/move2.pass.cpp b/test/std/input.output/string.streams/stringstream.cons/move2.pass.cpp index 78d682fc4..94de61610 100644 --- a/test/std/input.output/string.streams/stringstream.cons/move2.pass.cpp +++ b/test/std/input.output/string.streams/stringstream.cons/move2.pass.cpp @@ -7,6 +7,8 @@ // //===----------------------------------------------------------------------===// +// UNSUPPORTED: c++98, c++03 + // // template , class Allocator = allocator > @@ -22,7 +24,6 @@ int main() { -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES std::vector vecis; vecis.push_back(std::istringstream()); vecis.back().str("hub started at [00 6b 8b 45 69]"); @@ -34,5 +35,4 @@ int main() vecis[n].seekg(0, std::ios_base::beg); assert(vecis[n].str().size() == 31); } -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES } diff --git a/test/std/input.output/string.streams/stringstream.cons/stringstream.assign/move.pass.cpp b/test/std/input.output/string.streams/stringstream.cons/stringstream.assign/move.pass.cpp index ccaf72d7e..3cce695c4 100644 --- a/test/std/input.output/string.streams/stringstream.cons/stringstream.assign/move.pass.cpp +++ b/test/std/input.output/string.streams/stringstream.cons/stringstream.assign/move.pass.cpp @@ -7,6 +7,8 @@ // //===----------------------------------------------------------------------===// +// UNSUPPORTED: c++98, c++03 + // // template , class Allocator = allocator > @@ -19,7 +21,6 @@ int main() { -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES { std::stringstream ss0(" 123 456 "); std::stringstream ss; @@ -50,5 +51,4 @@ int main() ss << i << ' ' << 123; assert(ss.str() == L"456 1236 "); } -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES } diff --git a/test/std/iterators/iterator.primitives/iterator.operations/advance.pass.cpp b/test/std/iterators/iterator.primitives/iterator.operations/advance.pass.cpp index e395da299..e5bd5603b 100644 --- a/test/std/iterators/iterator.primitives/iterator.operations/advance.pass.cpp +++ b/test/std/iterators/iterator.primitives/iterator.operations/advance.pass.cpp @@ -9,14 +9,16 @@ // +// All of these became constexpr in C++17 +// // template -// void advance(Iter& i, Iter::difference_type n); +// constexpr void advance(Iter& i, Iter::difference_type n); // // template -// void advance(Iter& i, Iter::difference_type n); +// constexpr void advance(Iter& i, Iter::difference_type n); // // template -// void advance(Iter& i, Iter::difference_type n); +// constexpr void advance(Iter& i, Iter::difference_type n); #include #include @@ -31,8 +33,19 @@ test(It i, typename std::iterator_traits::difference_type n, It x) assert(i == x); } +#if TEST_STD_VER > 14 +template +constexpr bool +constepxr_test(It i, typename std::iterator_traits::difference_type n, It x) +{ + std::advance(i, n); + return i == x; +} +#endif + int main() { + { const char* s = "1234567890"; test(input_iterator(s), 10, input_iterator(s+10)); test(forward_iterator(s), 10, forward_iterator(s+10)); @@ -42,4 +55,18 @@ int main() test(random_access_iterator(s+5), -5, random_access_iterator(s)); test(s+5, 5, s+10); test(s+5, -5, s); + } +#if TEST_STD_VER > 14 + { + constexpr const char* s = "1234567890"; + static_assert( constepxr_test(input_iterator(s), 10, input_iterator(s+10)), "" ); + static_assert( constepxr_test(forward_iterator(s), 10, forward_iterator(s+10)), "" ); + static_assert( constepxr_test(bidirectional_iterator(s+5), 5, bidirectional_iterator(s+10)), "" ); + static_assert( constepxr_test(bidirectional_iterator(s+5), -5, bidirectional_iterator(s)), "" ); + static_assert( constepxr_test(random_access_iterator(s+5), 5, random_access_iterator(s+10)), "" ); + static_assert( constepxr_test(random_access_iterator(s+5), -5, random_access_iterator(s)), "" ); + static_assert( constepxr_test(s+5, 5, s+10), "" ); + static_assert( constepxr_test(s+5, -5, s), "" ); + } +#endif } diff --git a/test/std/iterators/iterator.primitives/iterator.operations/distance.pass.cpp b/test/std/iterators/iterator.primitives/iterator.operations/distance.pass.cpp index 7fef63583..2f16fcb38 100644 --- a/test/std/iterators/iterator.primitives/iterator.operations/distance.pass.cpp +++ b/test/std/iterators/iterator.primitives/iterator.operations/distance.pass.cpp @@ -29,12 +29,33 @@ test(It first, It last, typename std::iterator_traits::difference_type x) assert(std::distance(first, last) == x); } +#if TEST_STD_VER > 14 +template +constexpr bool +constexpr_test(It first, It last, typename std::iterator_traits::difference_type x) +{ + return std::distance(first, last) == x; +} +#endif + int main() { + { const char* s = "1234567890"; test(input_iterator(s), input_iterator(s+10), 10); test(forward_iterator(s), forward_iterator(s+10), 10); test(bidirectional_iterator(s), bidirectional_iterator(s+10), 10); test(random_access_iterator(s), random_access_iterator(s+10), 10); test(s, s+10, 10); + } +#if TEST_STD_VER > 14 + { + constexpr const char* s = "1234567890"; + static_assert( constexpr_test(input_iterator(s), input_iterator(s+10), 10), ""); + static_assert( constexpr_test(forward_iterator(s), forward_iterator(s+10), 10), ""); + static_assert( constexpr_test(bidirectional_iterator(s), bidirectional_iterator(s+10), 10), ""); + static_assert( constexpr_test(random_access_iterator(s), random_access_iterator(s+10), 10), ""); + static_assert( constexpr_test(s, s+10, 10), ""); + } +#endif } 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 0952588b0..e257b3eaa 100644 --- a/test/std/iterators/iterator.primitives/iterator.operations/next.pass.cpp +++ b/test/std/iterators/iterator.primitives/iterator.operations/next.pass.cpp @@ -33,8 +33,25 @@ test(It i, It x) assert(std::next(i) == x); } +#if TEST_STD_VER > 14 +template +constexpr bool +constexpr_test(It i, typename std::iterator_traits::difference_type n, It x) +{ + return std::next(i, n) == x; +} + +template +constexpr bool +constexpr_test(It i, It x) +{ + return std::next(i) == x; +} +#endif + int main() { + { const char* s = "1234567890"; test(input_iterator(s), 10, input_iterator(s+10)); test(forward_iterator(s), 10, forward_iterator(s+10)); @@ -47,4 +64,21 @@ int main() test(bidirectional_iterator(s), bidirectional_iterator(s+1)); test(random_access_iterator(s), random_access_iterator(s+1)); test(s, s+1); + } +#if TEST_STD_VER > 14 + { + constexpr const char* s = "1234567890"; + static_assert( constexpr_test(input_iterator(s), 10, input_iterator(s+10)), "" ); + static_assert( constexpr_test(forward_iterator(s), 10, forward_iterator(s+10)), "" ); + static_assert( constexpr_test(bidirectional_iterator(s), 10, bidirectional_iterator(s+10)), "" ); + static_assert( constexpr_test(random_access_iterator(s), 10, random_access_iterator(s+10)), "" ); + static_assert( constexpr_test(s, 10, s+10), "" ); + + static_assert( constexpr_test(input_iterator(s), input_iterator(s+1)), "" ); + static_assert( constexpr_test(forward_iterator(s), forward_iterator(s+1)), "" ); + static_assert( constexpr_test(bidirectional_iterator(s), bidirectional_iterator(s+1)), "" ); + static_assert( constexpr_test(random_access_iterator(s), random_access_iterator(s+1)), "" ); + static_assert( constexpr_test(s, s+1), "" ); + } +#endif } diff --git a/test/std/iterators/iterator.primitives/iterator.operations/prev.pass.cpp b/test/std/iterators/iterator.primitives/iterator.operations/prev.pass.cpp index 0641706c9..465cda1c4 100644 --- a/test/std/iterators/iterator.primitives/iterator.operations/prev.pass.cpp +++ b/test/std/iterators/iterator.primitives/iterator.operations/prev.pass.cpp @@ -31,8 +31,25 @@ test(It i, It x) assert(std::prev(i) == x); } +#if TEST_STD_VER > 14 +template +constexpr bool +constexpr_test(It i, typename std::iterator_traits::difference_type n, It x) +{ + return std::prev(i, n) == x; +} + +template +constexpr bool +constexpr_test(It i, It x) +{ + return std::prev(i) == x; +} +#endif + int main() { + { const char* s = "1234567890"; test(bidirectional_iterator(s+10), 10, bidirectional_iterator(s)); test(random_access_iterator(s+10), 10, random_access_iterator(s)); @@ -41,4 +58,18 @@ int main() test(bidirectional_iterator(s+1), bidirectional_iterator(s)); test(random_access_iterator(s+1), random_access_iterator(s)); test(s+1, s); + } +#if TEST_STD_VER > 14 + { + constexpr const char* s = "1234567890"; + static_assert( constexpr_test(bidirectional_iterator(s+10), 10, bidirectional_iterator(s)), "" ); + static_assert( constexpr_test(random_access_iterator(s+10), 10, random_access_iterator(s)), "" ); + static_assert( constexpr_test(s+10, 10, s), "" ); + + static_assert( constexpr_test(bidirectional_iterator(s+1), bidirectional_iterator(s)), "" ); + static_assert( constexpr_test(random_access_iterator(s+1), random_access_iterator(s)), "" ); + static_assert( constexpr_test(s+1, s), "" ); + } +#endif + } diff --git a/test/std/iterators/stream.iterators/istream.iterator/types.pass.cpp b/test/std/iterators/stream.iterators/istream.iterator/types.pass.cpp index a680aa3f4..3046ced75 100644 --- a/test/std/iterators/stream.iterators/istream.iterator/types.pass.cpp +++ b/test/std/iterators/stream.iterators/istream.iterator/types.pass.cpp @@ -40,12 +40,22 @@ #include #include +#include "test_macros.h" + int main() { typedef std::istream_iterator I1; // double is trivially destructible +#if TEST_STD_VER <= 14 static_assert((std::is_convertible >::value), ""); +#else + static_assert((std::is_same::value), ""); + static_assert((std::is_same::value), ""); + static_assert((std::is_same::value), ""); + static_assert((std::is_same::value), ""); + static_assert((std::is_same::value), ""); +#endif static_assert((std::is_same::value), ""); static_assert((std::is_same >::value), ""); static_assert((std::is_same::value), ""); @@ -53,9 +63,17 @@ int main() static_assert( std::is_trivially_destructible::value, ""); typedef std::istream_iterator I2; // unsigned is trivially destructible +#if TEST_STD_VER <= 14 static_assert((std::is_convertible >::value), ""); +#else + static_assert((std::is_same::value), ""); + static_assert((std::is_same::value), ""); + static_assert((std::is_same::value), ""); + static_assert((std::is_same::value), ""); + static_assert((std::is_same::value), ""); +#endif static_assert((std::is_same::value), ""); static_assert((std::is_same >::value), ""); static_assert((std::is_same::value), ""); diff --git a/test/std/iterators/stream.iterators/ostream.iterator/types.pass.cpp b/test/std/iterators/stream.iterators/ostream.iterator/types.pass.cpp index 460da642b..8d043e1e6 100644 --- a/test/std/iterators/stream.iterators/ostream.iterator/types.pass.cpp +++ b/test/std/iterators/stream.iterators/ostream.iterator/types.pass.cpp @@ -23,17 +23,35 @@ #include #include +#include "test_macros.h" + int main() { typedef std::ostream_iterator I1; +#if TEST_STD_VER <= 14 static_assert((std::is_convertible >::value), ""); +#else + static_assert((std::is_same::value), ""); + static_assert((std::is_same::value), ""); + static_assert((std::is_same::value), ""); + static_assert((std::is_same::value), ""); + static_assert((std::is_same::value), ""); +#endif static_assert((std::is_same::value), ""); static_assert((std::is_same >::value), ""); static_assert((std::is_same::value), ""); typedef std::ostream_iterator I2; +#if TEST_STD_VER <= 14 static_assert((std::is_convertible >::value), ""); +#else + static_assert((std::is_same::value), ""); + static_assert((std::is_same::value), ""); + static_assert((std::is_same::value), ""); + static_assert((std::is_same::value), ""); + static_assert((std::is_same::value), ""); +#endif static_assert((std::is_same::value), ""); static_assert((std::is_same >::value), ""); static_assert((std::is_same::value), ""); diff --git a/test/std/iterators/stream.iterators/ostreambuf.iterator/types.pass.cpp b/test/std/iterators/stream.iterators/ostreambuf.iterator/types.pass.cpp index a699b2419..cdf748465 100644 --- a/test/std/iterators/stream.iterators/ostreambuf.iterator/types.pass.cpp +++ b/test/std/iterators/stream.iterators/ostreambuf.iterator/types.pass.cpp @@ -24,19 +24,37 @@ #include #include +#include "test_macros.h" + int main() { typedef std::ostreambuf_iterator I1; +#if TEST_STD_VER <= 14 static_assert((std::is_convertible >::value), ""); +#else + static_assert((std::is_same::value), ""); + static_assert((std::is_same::value), ""); + static_assert((std::is_same::value), ""); + static_assert((std::is_same::value), ""); + static_assert((std::is_same::value), ""); +#endif static_assert((std::is_same::value), ""); static_assert((std::is_same >::value), ""); static_assert((std::is_same::value), ""); static_assert((std::is_same::value), ""); typedef std::ostreambuf_iterator I2; +#if TEST_STD_VER <= 14 static_assert((std::is_convertible >::value), ""); +#else + static_assert((std::is_same::value), ""); + static_assert((std::is_same::value), ""); + static_assert((std::is_same::value), ""); + static_assert((std::is_same::value), ""); + static_assert((std::is_same::value), ""); +#endif static_assert((std::is_same::value), ""); static_assert((std::is_same >::value), ""); static_assert((std::is_same::value), ""); diff --git a/test/std/language.support/support.dynamic/new.delete/new.delete.array/delete_align_val_t_replace.pass.cpp b/test/std/language.support/support.dynamic/new.delete/new.delete.array/delete_align_val_t_replace.pass.cpp index c88e5b06e..36f815a81 100644 --- a/test/std/language.support/support.dynamic/new.delete/new.delete.array/delete_align_val_t_replace.pass.cpp +++ b/test/std/language.support/support.dynamic/new.delete/new.delete.array/delete_align_val_t_replace.pass.cpp @@ -12,10 +12,22 @@ // UNSUPPORTED: sanitizer-new-delete, c++98, c++03, c++11, c++14 // Older Clang versions do not support this -// XFAIL: clang-3, apple-clang +// XFAIL: clang-3, apple-clang-7, apple-clang-8 // None of the current GCC compilers support this. -// XFAIL: gcc +// XFAIL: gcc-5, gcc-6 + +// XFAIL: with_system_cxx_lib=macosx10.12 +// XFAIL: with_system_cxx_lib=macosx10.11 +// XFAIL: with_system_cxx_lib=macosx10.10 +// XFAIL: with_system_cxx_lib=macosx10.9 +// XFAIL: with_system_cxx_lib=macosx10.7 +// XFAIL: with_system_cxx_lib=macosx10.8 + +// On Windows libc++ doesn't provide its own definitions for new/delete +// but instead depends on the ones in VCRuntime. However VCRuntime does not +// yet provide aligned new/delete definitions so this test fails to compile/link. +// XFAIL: LIBCXX-WINDOWS-FIXME #include #include diff --git a/test/std/language.support/support.dynamic/new.delete/new.delete.array/new_align_val_t.pass.cpp b/test/std/language.support/support.dynamic/new.delete/new.delete.array/new_align_val_t.pass.cpp index 55c26fa5c..69f5ac8c9 100644 --- a/test/std/language.support/support.dynamic/new.delete/new.delete.array/new_align_val_t.pass.cpp +++ b/test/std/language.support/support.dynamic/new.delete/new.delete.array/new_align_val_t.pass.cpp @@ -13,7 +13,20 @@ // UNSUPPORTED: sanitizer-new-delete // FIXME change this to XFAIL. -// UNSUPPORTED: no-aligned-allocation +// UNSUPPORTED: no-aligned-allocation && !gcc + +// XFAIL: with_system_cxx_lib=macosx10.12 +// XFAIL: with_system_cxx_lib=macosx10.11 +// XFAIL: with_system_cxx_lib=macosx10.10 +// XFAIL: with_system_cxx_lib=macosx10.9 +// XFAIL: with_system_cxx_lib=macosx10.7 +// XFAIL: with_system_cxx_lib=macosx10.8 + + +// On Windows libc++ doesn't provide its own definitions for new/delete +// but instead depends on the ones in VCRuntime. However VCRuntime does not +// yet provide aligned new/delete definitions so this test fails to link. +// XFAIL: LIBCXX-WINDOWS-FIXME // test operator new @@ -29,7 +42,7 @@ constexpr auto OverAligned = alignof(std::max_align_t) * 2; int new_handler_called = 0; -void new_handler() +void my_new_handler() { ++new_handler_called; std::set_new_handler(0); @@ -45,7 +58,7 @@ struct alignas(OverAligned) A void test_throw_max_size() { #ifndef TEST_HAS_NO_EXCEPTIONS - std::set_new_handler(new_handler); + std::set_new_handler(my_new_handler); try { void* vp = operator new[] (std::numeric_limits::max(), diff --git a/test/std/language.support/support.dynamic/new.delete/new.delete.array/new_align_val_t_nothrow.pass.cpp b/test/std/language.support/support.dynamic/new.delete/new.delete.array/new_align_val_t_nothrow.pass.cpp index ec5d0a445..36453283c 100644 --- a/test/std/language.support/support.dynamic/new.delete/new.delete.array/new_align_val_t_nothrow.pass.cpp +++ b/test/std/language.support/support.dynamic/new.delete/new.delete.array/new_align_val_t_nothrow.pass.cpp @@ -13,7 +13,19 @@ // UNSUPPORTED: sanitizer-new-delete // FIXME turn this into an XFAIL -// UNSUPPORTED: no-aligned-allocation +// UNSUPPORTED: no-aligned-allocation && !gcc + +// XFAIL: with_system_cxx_lib=macosx10.12 +// XFAIL: with_system_cxx_lib=macosx10.11 +// XFAIL: with_system_cxx_lib=macosx10.10 +// XFAIL: with_system_cxx_lib=macosx10.9 +// XFAIL: with_system_cxx_lib=macosx10.7 +// XFAIL: with_system_cxx_lib=macosx10.8 + +// On Windows libc++ doesn't provide its own definitions for new/delete +// but instead depends on the ones in VCRuntime. However VCRuntime does not +// yet provide aligned new/delete definitions so this test fails to compile/link. +// XFAIL: LIBCXX-WINDOWS-FIXME // test operator new (nothrow) diff --git a/test/std/language.support/support.dynamic/new.delete/new.delete.array/new_align_val_t_nothrow_replace.pass.cpp b/test/std/language.support/support.dynamic/new.delete/new.delete.array/new_align_val_t_nothrow_replace.pass.cpp index 03e490e8e..228d176a2 100644 --- a/test/std/language.support/support.dynamic/new.delete/new.delete.array/new_align_val_t_nothrow_replace.pass.cpp +++ b/test/std/language.support/support.dynamic/new.delete/new.delete.array/new_align_val_t_nothrow_replace.pass.cpp @@ -10,7 +10,19 @@ // UNSUPPORTED: c++98, c++03, c++11, c++14 // UNSUPPORTED: sanitizer-new-delete -// XFAIL: no-aligned-allocation +// XFAIL: with_system_cxx_lib=macosx10.12 +// XFAIL: with_system_cxx_lib=macosx10.11 +// XFAIL: with_system_cxx_lib=macosx10.10 +// XFAIL: with_system_cxx_lib=macosx10.9 +// XFAIL: with_system_cxx_lib=macosx10.7 +// XFAIL: with_system_cxx_lib=macosx10.8 + +// XFAIL: no-aligned-allocation && !gcc + +// On Windows libc++ doesn't provide its own definitions for new/delete +// but instead depends on the ones in VCRuntime. However VCRuntime does not +// yet provide aligned new/delete definitions so this test fails. +// XFAIL: LIBCXX-WINDOWS-FIXME // test operator new nothrow by replacing only operator new diff --git a/test/std/language.support/support.dynamic/new.delete/new.delete.array/new_align_val_t_replace.pass.cpp b/test/std/language.support/support.dynamic/new.delete/new.delete.array/new_align_val_t_replace.pass.cpp index 131deb340..15bebcbcb 100644 --- a/test/std/language.support/support.dynamic/new.delete/new.delete.array/new_align_val_t_replace.pass.cpp +++ b/test/std/language.support/support.dynamic/new.delete/new.delete.array/new_align_val_t_replace.pass.cpp @@ -10,7 +10,8 @@ // UNSUPPORTED: c++98, c++03, c++11, c++14 // UNSUPPORTED: sanitizer-new-delete -// XFAIL: no-aligned-allocation +// NOTE: GCC doesn't provide the -faligned-allocation flag to test for +// XFAIL: no-aligned-allocation && !gcc // test operator new replacement diff --git a/test/std/language.support/support.dynamic/new.delete/new.delete.array/sized_delete_array_fsizeddeallocation.sh.cpp b/test/std/language.support/support.dynamic/new.delete/new.delete.array/sized_delete_array_fsizeddeallocation.sh.cpp index 5b93540ea..f71cf19cc 100644 --- a/test/std/language.support/support.dynamic/new.delete/new.delete.array/sized_delete_array_fsizeddeallocation.sh.cpp +++ b/test/std/language.support/support.dynamic/new.delete/new.delete.array/sized_delete_array_fsizeddeallocation.sh.cpp @@ -13,6 +13,12 @@ // when sized deallocation is not supported, e.g., prior to C++14. // UNSUPPORTED: sanitizer-new-delete +// XFAIL: availability_markup=macosx10.11 +// XFAIL: availability_markup=macosx10.10 +// XFAIL: availability_markup=macosx10.9 +// XFAIL: availability_markup=macosx10.8 +// XFAIL: availability_markup=macosx10.7 + // NOTE: Only clang-3.7 and GCC 5.1 and greater support -fsized-deallocation. // REQUIRES: fsized-deallocation diff --git a/test/std/language.support/support.dynamic/new.delete/new.delete.single/delete_align_val_t_replace.pass.cpp b/test/std/language.support/support.dynamic/new.delete/new.delete.single/delete_align_val_t_replace.pass.cpp index a5d4df34a..b0e932c96 100644 --- a/test/std/language.support/support.dynamic/new.delete/new.delete.single/delete_align_val_t_replace.pass.cpp +++ b/test/std/language.support/support.dynamic/new.delete/new.delete.single/delete_align_val_t_replace.pass.cpp @@ -10,13 +10,23 @@ // test aligned operator delete replacement. // UNSUPPORTED: sanitizer-new-delete, c++98, c++03, c++11, c++14 - // Older Clang versions do not support this -// XFAIL: clang-3, apple-clang +// XFAIL: clang-3, apple-clang-7, apple-clang-8 // None of the current GCC compilers support this. -// XFAIL: gcc +// XFAIL: gcc-5, gcc-6 +// XFAIL: with_system_cxx_lib=macosx10.12 +// XFAIL: with_system_cxx_lib=macosx10.11 +// XFAIL: with_system_cxx_lib=macosx10.10 +// XFAIL: with_system_cxx_lib=macosx10.9 +// XFAIL: with_system_cxx_lib=macosx10.7 +// XFAIL: with_system_cxx_lib=macosx10.8 + +// On Windows libc++ doesn't provide its own definitions for new/delete +// but instead depends on the ones in VCRuntime. However VCRuntime does not +// yet provide aligned new/delete definitions so this test fails to compile/link. +// XFAIL: LIBCXX-WINDOWS-FIXME #include #include diff --git a/test/std/language.support/support.dynamic/new.delete/new.delete.single/new_align_val_t.pass.cpp b/test/std/language.support/support.dynamic/new.delete/new.delete.single/new_align_val_t.pass.cpp index 5ebbc8a1a..22ea5e2ff 100644 --- a/test/std/language.support/support.dynamic/new.delete/new.delete.single/new_align_val_t.pass.cpp +++ b/test/std/language.support/support.dynamic/new.delete/new.delete.single/new_align_val_t.pass.cpp @@ -9,11 +9,23 @@ // UNSUPPORTED: c++98, c++03, c++11, c++14 +// XFAIL: with_system_cxx_lib=macosx10.12 +// XFAIL: with_system_cxx_lib=macosx10.11 +// XFAIL: with_system_cxx_lib=macosx10.10 +// XFAIL: with_system_cxx_lib=macosx10.9 +// XFAIL: with_system_cxx_lib=macosx10.7 +// XFAIL: with_system_cxx_lib=macosx10.8 + // asan and msan will not call the new handler. // UNSUPPORTED: sanitizer-new-delete // FIXME turn this into an XFAIL -// UNSUPPORTED: no-aligned-allocation +// UNSUPPORTED: no-aligned-allocation && !gcc + +// On Windows libc++ doesn't provide its own definitions for new/delete +// but instead depends on the ones in VCRuntime. However VCRuntime does not +// yet provide aligned new/delete definitions so this test fails to compile/link. +// XFAIL: LIBCXX-WINDOWS-FIXME // test operator new diff --git a/test/std/language.support/support.dynamic/new.delete/new.delete.single/new_align_val_t_nothrow.pass.cpp b/test/std/language.support/support.dynamic/new.delete/new.delete.single/new_align_val_t_nothrow.pass.cpp index 6e2eca314..2c5c0f80b 100644 --- a/test/std/language.support/support.dynamic/new.delete/new.delete.single/new_align_val_t_nothrow.pass.cpp +++ b/test/std/language.support/support.dynamic/new.delete/new.delete.single/new_align_val_t_nothrow.pass.cpp @@ -9,11 +9,23 @@ // UNSUPPORTED: c++98, c++03, c++11, c++14 +// XFAIL: with_system_cxx_lib=macosx10.12 +// XFAIL: with_system_cxx_lib=macosx10.11 +// XFAIL: with_system_cxx_lib=macosx10.10 +// XFAIL: with_system_cxx_lib=macosx10.9 +// XFAIL: with_system_cxx_lib=macosx10.7 +// XFAIL: with_system_cxx_lib=macosx10.8 + // asan and msan will not call the new handler. // UNSUPPORTED: sanitizer-new-delete // FIXME turn this into an XFAIL -// UNSUPPORTED: no-aligned-allocation +// UNSUPPORTED: no-aligned-allocation && !gcc + +// On Windows libc++ doesn't provide its own definitions for new/delete +// but instead depends on the ones in VCRuntime. However VCRuntime does not +// yet provide aligned new/delete definitions so this test fails to compile/link. +// XFAIL: LIBCXX-WINDOWS-FIXME // test operator new (nothrow) diff --git a/test/std/language.support/support.dynamic/new.delete/new.delete.single/new_align_val_t_nothrow_replace.pass.cpp b/test/std/language.support/support.dynamic/new.delete/new.delete.single/new_align_val_t_nothrow_replace.pass.cpp index 9f64c9730..b50f49dc6 100644 --- a/test/std/language.support/support.dynamic/new.delete/new.delete.single/new_align_val_t_nothrow_replace.pass.cpp +++ b/test/std/language.support/support.dynamic/new.delete/new.delete.single/new_align_val_t_nothrow_replace.pass.cpp @@ -10,7 +10,20 @@ // UNSUPPORTED: c++98, c++03, c++11, c++14 // UNSUPPORTED: sanitizer-new-delete -// XFAIL: no-aligned-allocation +// XFAIL: with_system_cxx_lib=macosx10.12 +// XFAIL: with_system_cxx_lib=macosx10.11 +// XFAIL: with_system_cxx_lib=macosx10.10 +// XFAIL: with_system_cxx_lib=macosx10.9 +// XFAIL: with_system_cxx_lib=macosx10.7 +// XFAIL: with_system_cxx_lib=macosx10.8 + +// NOTE: gcc doesn't provide -faligned-allocation flag to test for +// XFAIL: no-aligned-allocation && !gcc + +// On Windows libc++ doesn't provide its own definitions for new/delete +// but instead depends on the ones in VCRuntime. However VCRuntime does not +// yet provide aligned new/delete definitions so this test fails. +// XFAIL: LIBCXX-WINDOWS-FIXME // test operator new nothrow by replacing only operator new diff --git a/test/std/language.support/support.dynamic/new.delete/new.delete.single/new_align_val_t_replace.pass.cpp b/test/std/language.support/support.dynamic/new.delete/new.delete.single/new_align_val_t_replace.pass.cpp index df3e4c156..66bb613ad 100644 --- a/test/std/language.support/support.dynamic/new.delete/new.delete.single/new_align_val_t_replace.pass.cpp +++ b/test/std/language.support/support.dynamic/new.delete/new.delete.single/new_align_val_t_replace.pass.cpp @@ -10,7 +10,8 @@ // UNSUPPORTED: c++98, c++03, c++11, c++14 // UNSUPPORTED: sanitizer-new-delete -// XFAIL: no-aligned-allocation +// NOTE: GCC doesn't provide a -faligned-allocation flag +// XFAIL: no-aligned-allocation && !gcc // test operator new replacement diff --git a/test/std/language.support/support.dynamic/new.delete/new.delete.single/sized_delete_fsizeddeallocation.sh.cpp b/test/std/language.support/support.dynamic/new.delete/new.delete.single/sized_delete_fsizeddeallocation.sh.cpp index 61fca5f12..40de3a098 100644 --- a/test/std/language.support/support.dynamic/new.delete/new.delete.single/sized_delete_fsizeddeallocation.sh.cpp +++ b/test/std/language.support/support.dynamic/new.delete/new.delete.single/sized_delete_fsizeddeallocation.sh.cpp @@ -13,6 +13,11 @@ // when sized deallocation is not supported, e.g., prior to C++14. // UNSUPPORTED: sanitizer-new-delete +// XFAIL: availability_markup=macosx10.11 +// XFAIL: availability_markup=macosx10.10 +// XFAIL: availability_markup=macosx10.9 +// XFAIL: availability_markup=macosx10.8 +// XFAIL: availability_markup=macosx10.7 // NOTE: Only clang-3.7 and GCC 5.1 and greater support -fsized-deallocation. // REQUIRES: fsized-deallocation 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 68cd85038..88e2253d0 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 @@ -8,6 +8,10 @@ //===----------------------------------------------------------------------===// // UNSUPPORTED: libcpp-no-exceptions + +// This test fails due to a stack overflow +// XFAIL: LIBCXX-WINDOWS-FIXME + // // class nested_exception; @@ -43,7 +47,7 @@ class C { public: virtual ~C() {} - C * operator&() const { assert(false); } // should not be called + C * operator&() const { assert(false); return nullptr; } // should not be called }; class D : private std::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 a86d8bcbe..6a9f25cd0 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 @@ -107,6 +107,16 @@ int main() assert(i == 7); } } + { + try + { + std::throw_with_nested("String literal"); + assert(false); + } + catch (const char *) + { + } + } #if TEST_STD_VER > 11 { try 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 661f789fe..c33d64d06 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,10 @@ // //===----------------------------------------------------------------------===// +// This test needs to be rewritten for the Windows exception_ptr semantics +// which copy the exception each time the exception_ptr is copied. +// XFAIL: LIBCXX-WINDOWS-FIXME + // UNSUPPORTED: libcpp-no-exceptions // 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 36feda730..35821d9bd 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 @@ -38,7 +38,12 @@ int main() } catch (const A& a) { +#ifndef _LIBCPP_ABI_MICROSOFT assert(A::constructed == 1); +#else + // On Windows exception_ptr copies the exception + assert(A::constructed == 2); +#endif assert(p != nullptr); p = nullptr; assert(p == nullptr); @@ -47,4 +52,5 @@ int main() } assert(A::constructed == 0); } + assert(A::constructed == 0); } 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 565166cbd..37ffb5be5 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 @@ -46,7 +46,12 @@ int main() } catch (const A& a) { +#ifndef _LIBCPP_ABI_MICROSOFT assert(A::constructed == 1); +#else + // On Windows the exception_ptr copies the exception + assert(A::constructed == 2); +#endif assert(p != nullptr); p = nullptr; assert(p == nullptr); @@ -55,4 +60,5 @@ int main() } assert(A::constructed == 0); } + assert(A::constructed == 0); } 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 b92671588..e35e7afa3 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 @@ -8,6 +8,14 @@ //===----------------------------------------------------------------------===// // UNSUPPORTED: libcpp-no-exceptions +// XFAIL: libcpp-no-exceptions + +// XFAIL: availability=macosx10.7 +// XFAIL: availability=macosx10.8 +// XFAIL: availability=macosx10.9 +// XFAIL: availability=macosx10.10 +// XFAIL: availability=macosx10.11 + // test uncaught_exceptions #include diff --git a/test/std/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.observers/dereference.fail.cpp b/test/std/language.support/support.initlist/include_cxx03.pass.cpp similarity index 72% rename from test/std/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.observers/dereference.fail.cpp rename to test/std/language.support/support.initlist/include_cxx03.pass.cpp index 46ba1395b..8710ddcdd 100644 --- a/test/std/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.observers/dereference.fail.cpp +++ b/test/std/language.support/support.initlist/include_cxx03.pass.cpp @@ -7,17 +7,12 @@ // //===----------------------------------------------------------------------===// -// +// -// unique_ptr +// Test that the file can be included in C++03 -// test op*() - -#include -#include +#include int main() { - std::unique_ptr p(new int(3)); - assert(*p == 3); } diff --git a/test/std/language.support/support.initlist/support.initlist.access/access.pass.cpp b/test/std/language.support/support.initlist/support.initlist.access/access.pass.cpp index e51ef7bd9..f6fd5564f 100644 --- a/test/std/language.support/support.initlist/support.initlist.access/access.pass.cpp +++ b/test/std/language.support/support.initlist/support.initlist.access/access.pass.cpp @@ -7,6 +7,8 @@ // //===----------------------------------------------------------------------===// +// UNSUPPORTED: c++98, c++03 + // template class initializer_list; // const E* begin() const; @@ -19,8 +21,6 @@ #include "test_macros.h" -#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS - struct A { A(std::initializer_list il) @@ -52,13 +52,9 @@ struct B #endif // TEST_STD_VER > 11 -#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS - int main() { -#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS A test1 = {3, 2, 1}; -#endif #if TEST_STD_VER > 11 constexpr B test2 = {3, 2, 1}; #endif // TEST_STD_VER > 11 diff --git a/test/std/language.support/support.initlist/support.initlist.cons/default.pass.cpp b/test/std/language.support/support.initlist/support.initlist.cons/default.pass.cpp index e09183434..2d831c9e1 100644 --- a/test/std/language.support/support.initlist/support.initlist.cons/default.pass.cpp +++ b/test/std/language.support/support.initlist/support.initlist.cons/default.pass.cpp @@ -7,6 +7,8 @@ // //===----------------------------------------------------------------------===// +// UNSUPPORTED: c++98, c++03 + // template class initializer_list; // initializer_list(); @@ -20,10 +22,9 @@ struct A {}; int main() { -#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS std::initializer_list il; assert(il.size() == 0); -#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS + #if TEST_STD_VER > 11 constexpr std::initializer_list il2; static_assert(il2.size() == 0, ""); diff --git a/test/std/language.support/support.initlist/support.initlist.range/begin_end.pass.cpp b/test/std/language.support/support.initlist/support.initlist.range/begin_end.pass.cpp index 938025d38..102ed64fe 100644 --- a/test/std/language.support/support.initlist/support.initlist.range/begin_end.pass.cpp +++ b/test/std/language.support/support.initlist/support.initlist.range/begin_end.pass.cpp @@ -7,6 +7,8 @@ // //===----------------------------------------------------------------------===// +// UNSUPPORTED: c++98, c++03 + // // template const E* begin(initializer_list il); @@ -17,8 +19,6 @@ #include "test_macros.h" -#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS - struct A { A(std::initializer_list il) @@ -49,13 +49,10 @@ struct B }; #endif // TEST_STD_VER > 11 -#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS int main() { -#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS A test1 = {3, 2, 1}; -#endif #if TEST_STD_VER > 11 constexpr B test2 = {3, 2, 1}; #endif // TEST_STD_VER > 11 diff --git a/test/std/language.support/support.initlist/types.pass.cpp b/test/std/language.support/support.initlist/types.pass.cpp index 835830055..a301ef924 100644 --- a/test/std/language.support/support.initlist/types.pass.cpp +++ b/test/std/language.support/support.initlist/types.pass.cpp @@ -7,6 +7,8 @@ // //===----------------------------------------------------------------------===// +// UNSUPPORTED: c++98, c++03 + // template // class initializer_list // { @@ -26,12 +28,10 @@ struct A {}; int main() { -#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS static_assert((std::is_same::value_type, A>::value), ""); static_assert((std::is_same::reference, const A&>::value), ""); static_assert((std::is_same::const_reference, const A&>::value), ""); static_assert((std::is_same::size_type, std::size_t>::value), ""); static_assert((std::is_same::iterator, const A*>::value), ""); static_assert((std::is_same::const_iterator, const A*>::value), ""); -#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS } diff --git a/test/std/language.support/support.types/byte.pass.cpp b/test/std/language.support/support.types/byte.pass.cpp new file mode 100644 index 000000000..66b2a5531 --- /dev/null +++ b/test/std/language.support/support.types/byte.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. +// +//===----------------------------------------------------------------------===// + +#include +#include +#include + +// XFAIL: c++98, c++03, c++11, c++14 + +// std::byte is not an integer type, nor a character type. +// It is a distinct type for accessing the bits that ultimately make up object storage. + +static_assert( std::is_pod::value, "" ); +static_assert(!std::is_arithmetic::value, "" ); +static_assert(!std::is_integral::value, "" ); + +static_assert(!std::is_same::value, "" ); +static_assert(!std::is_same::value, "" ); +static_assert(!std::is_same::value, "" ); + +// The standard doesn't outright say this, but it's pretty clear that it has to be true. +static_assert(sizeof(std::byte) == 1, "" ); + +int main () {} diff --git a/test/std/language.support/support.types/byteops/and.assign.pass.cpp b/test/std/language.support/support.types/byteops/and.assign.pass.cpp new file mode 100644 index 000000000..ec1c3805a --- /dev/null +++ b/test/std/language.support/support.types/byteops/and.assign.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. +// +//===----------------------------------------------------------------------===// + +#include +#include + +// UNSUPPORTED: c++98, c++03, c++11, c++14 + +// constexpr byte& operator &=(byte l, byte r) noexcept; + + +constexpr std::byte test(std::byte b1, std::byte b2) { + std::byte bret = b1; + return bret &= b2; + } + + +int main () { + std::byte b; // not constexpr, just used in noexcept check + constexpr std::byte b1{static_cast(1)}; + constexpr std::byte b8{static_cast(8)}; + constexpr std::byte b9{static_cast(9)}; + + static_assert(noexcept(b &= b), "" ); + + static_assert(std::to_integer(test(b1, b8)) == 0, ""); + static_assert(std::to_integer(test(b1, b9)) == 1, ""); + static_assert(std::to_integer(test(b8, b9)) == 8, ""); + + static_assert(std::to_integer(test(b8, b1)) == 0, ""); + static_assert(std::to_integer(test(b9, b1)) == 1, ""); + static_assert(std::to_integer(test(b9, b8)) == 8, ""); +} diff --git a/test/std/language.support/support.types/byteops/and.pass.cpp b/test/std/language.support/support.types/byteops/and.pass.cpp new file mode 100644 index 000000000..6c5419cfc --- /dev/null +++ b/test/std/language.support/support.types/byteops/and.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. +// +//===----------------------------------------------------------------------===// + +#include +#include + +// UNSUPPORTED: c++98, c++03, c++11, c++14 + +// constexpr byte operator&(byte l, byte r) noexcept; + +int main () { + constexpr std::byte b1{static_cast(1)}; + constexpr std::byte b8{static_cast(8)}; + constexpr std::byte b9{static_cast(9)}; + + static_assert(noexcept(b1 & b8), "" ); + + static_assert(std::to_integer(b1 & b8) == 0, ""); + static_assert(std::to_integer(b1 & b9) == 1, ""); + static_assert(std::to_integer(b8 & b9) == 8, ""); + + static_assert(std::to_integer(b8 & b1) == 0, ""); + static_assert(std::to_integer(b9 & b1) == 1, ""); + static_assert(std::to_integer(b9 & b8) == 8, ""); +} diff --git a/test/std/iterators/stream.iterators/istreambuf.iterator/istreambuf.iterator_op_astrk/arrow.pass.cpp b/test/std/language.support/support.types/byteops/enum_direct_init.pass.cpp similarity index 50% rename from test/std/iterators/stream.iterators/istreambuf.iterator/istreambuf.iterator_op_astrk/arrow.pass.cpp rename to test/std/language.support/support.types/byteops/enum_direct_init.pass.cpp index e3bf5e2bd..157626137 100644 --- a/test/std/iterators/stream.iterators/istreambuf.iterator/istreambuf.iterator_op_astrk/arrow.pass.cpp +++ b/test/std/language.support/support.types/byteops/enum_direct_init.pass.cpp @@ -7,22 +7,15 @@ // //===----------------------------------------------------------------------===// -// +#include +#include -// istreambuf_iterator +// UNSUPPORTED: c++98, c++03, c++11, c++14 +// The following compilers don't like "std::byte b1{1}" +// XFAIL: clang-3.5, clang-3.6, clang-3.7, clang-3.8 +// XFAIL: apple-clang-6, apple-clang-7, apple-clang-8.0 -// pointer operator->() const; - -#include -#include -#include - -typedef char C; -int main () -{ - std::istringstream s("filename"); - std::istreambuf_iterator i(s); - - (*i).~C(); // This is well-formed... - i->~C(); // ... so this should be supported! +int main () { + constexpr std::byte b{42}; + static_assert(std::to_integer(b) == 42, ""); } diff --git a/test/std/language.support/support.types/byteops/lshift.assign.fail.cpp b/test/std/language.support/support.types/byteops/lshift.assign.fail.cpp new file mode 100644 index 000000000..8f6822932 --- /dev/null +++ b/test/std/language.support/support.types/byteops/lshift.assign.fail.cpp @@ -0,0 +1,31 @@ +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +#include +#include + +// UNSUPPORTED: c++98, c++03, c++11, c++14 +// The following compilers don't like "std::byte b1{1}" +// UNSUPPORTED: clang-3.5, clang-3.6, clang-3.7, clang-3.8 +// UNSUPPORTED: apple-clang-6, apple-clang-7, apple-clang-8.0 + +// template +// constexpr byte& operator<<=(byte& b, IntegerType shift) noexcept; +// This function shall not participate in overload resolution unless +// is_integral_v is true. + + +constexpr std::byte test(std::byte b) { + return b <<= 2.0; + } + + +int main () { + constexpr std::byte b1 = test(std::byte{1}); +} diff --git a/test/std/language.support/support.types/byteops/lshift.assign.pass.cpp b/test/std/language.support/support.types/byteops/lshift.assign.pass.cpp new file mode 100644 index 000000000..abfeebf2b --- /dev/null +++ b/test/std/language.support/support.types/byteops/lshift.assign.pass.cpp @@ -0,0 +1,36 @@ +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +#include +#include + +// UNSUPPORTED: c++98, c++03, c++11, c++14 + +// template +// constexpr byte& operator<<=(byte& b, IntegerType shift) noexcept; +// This function shall not participate in overload resolution unless +// is_integral_v is true. + + +constexpr std::byte test(std::byte b) { + return b <<= 2; + } + + +int main () { + std::byte b; // not constexpr, just used in noexcept check + constexpr std::byte b2{static_cast(2)}; + constexpr std::byte b3{static_cast(3)}; + + static_assert(noexcept(b <<= 2), "" ); + + static_assert(std::to_integer(test(b2)) == 8, "" ); + static_assert(std::to_integer(test(b3)) == 12, "" ); + +} diff --git a/test/std/language.support/support.types/byteops/lshift.fail.cpp b/test/std/language.support/support.types/byteops/lshift.fail.cpp new file mode 100644 index 000000000..707258c6d --- /dev/null +++ b/test/std/language.support/support.types/byteops/lshift.fail.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. +// +//===----------------------------------------------------------------------===// + +#include +#include + +// UNSUPPORTED: c++98, c++03, c++11, c++14 + +// template +// constexpr byte operator <<(byte b, IntegerType shift) noexcept; +// These functions shall not participate in overload resolution unless +// is_integral_v is true. + +int main () { + constexpr std::byte b1{static_cast(1)}; + constexpr std::byte b2 = b1 << 2.0f; +} diff --git a/test/std/language.support/support.types/byteops/lshift.pass.cpp b/test/std/language.support/support.types/byteops/lshift.pass.cpp new file mode 100644 index 000000000..15ad796cb --- /dev/null +++ b/test/std/language.support/support.types/byteops/lshift.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. +// +//===----------------------------------------------------------------------===// + +#include +#include + +// UNSUPPORTED: c++98, c++03, c++11, c++14 + +// template +// constexpr byte operator <<(byte b, IntegerType shift) noexcept; +// These functions shall not participate in overload resolution unless +// is_integral_v is true. + +int main () { + constexpr std::byte b1{static_cast(1)}; + constexpr std::byte b3{static_cast(3)}; + + static_assert(noexcept(b3 << 2), "" ); + + static_assert(std::to_integer(b1 << 1) == 2, ""); + static_assert(std::to_integer(b1 << 2) == 4, ""); + static_assert(std::to_integer(b3 << 4) == 48, ""); + static_assert(std::to_integer(b3 << 6) == 192, ""); +} diff --git a/test/std/language.support/support.types/byteops/not.pass.cpp b/test/std/language.support/support.types/byteops/not.pass.cpp new file mode 100644 index 000000000..53f1d91fa --- /dev/null +++ b/test/std/language.support/support.types/byteops/not.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. +// +//===----------------------------------------------------------------------===// + +#include +#include + +// UNSUPPORTED: c++98, c++03, c++11, c++14 + +// constexpr byte operator~(byte b) noexcept; + +int main () { + constexpr std::byte b1{static_cast(1)}; + constexpr std::byte b2{static_cast(2)}; + constexpr std::byte b8{static_cast(8)}; + + static_assert(noexcept(~b1), "" ); + + static_assert(std::to_integer(~b1) == 254, ""); + static_assert(std::to_integer(~b2) == 253, ""); + static_assert(std::to_integer(~b8) == 247, ""); +} diff --git a/test/std/language.support/support.types/byteops/or.assign.pass.cpp b/test/std/language.support/support.types/byteops/or.assign.pass.cpp new file mode 100644 index 000000000..bb4a84ec6 --- /dev/null +++ b/test/std/language.support/support.types/byteops/or.assign.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. +// +//===----------------------------------------------------------------------===// + +#include +#include + +// UNSUPPORTED: c++98, c++03, c++11, c++14 + +// constexpr byte& operator |=(byte l, byte r) noexcept; + + +constexpr std::byte test(std::byte b1, std::byte b2) { + std::byte bret = b1; + return bret |= b2; + } + + +int main () { + std::byte b; // not constexpr, just used in noexcept check + constexpr std::byte b1{static_cast(1)}; + constexpr std::byte b2{static_cast(2)}; + constexpr std::byte b8{static_cast(8)}; + + static_assert(noexcept(b |= b), "" ); + + static_assert(std::to_integer(test(b1, b2)) == 3, ""); + static_assert(std::to_integer(test(b1, b8)) == 9, ""); + static_assert(std::to_integer(test(b2, b8)) == 10, ""); + + static_assert(std::to_integer(test(b2, b1)) == 3, ""); + static_assert(std::to_integer(test(b8, b1)) == 9, ""); + static_assert(std::to_integer(test(b8, b2)) == 10, ""); + +} diff --git a/test/std/language.support/support.types/byteops/or.pass.cpp b/test/std/language.support/support.types/byteops/or.pass.cpp new file mode 100644 index 000000000..e2b734982 --- /dev/null +++ b/test/std/language.support/support.types/byteops/or.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. +// +//===----------------------------------------------------------------------===// + +#include +#include + +// UNSUPPORTED: c++98, c++03, c++11, c++14 + +// constexpr byte operator|(byte l, byte r) noexcept; + +int main () { + constexpr std::byte b1{static_cast(1)}; + constexpr std::byte b2{static_cast(2)}; + constexpr std::byte b8{static_cast(8)}; + + static_assert(noexcept(b1 | b2), "" ); + + static_assert(std::to_integer(b1 | b2) == 3, ""); + static_assert(std::to_integer(b1 | b8) == 9, ""); + static_assert(std::to_integer(b2 | b8) == 10, ""); + + static_assert(std::to_integer(b2 | b1) == 3, ""); + static_assert(std::to_integer(b8 | b1) == 9, ""); + static_assert(std::to_integer(b8 | b2) == 10, ""); +} diff --git a/test/std/language.support/support.types/byteops/rshift.assign.fail.cpp b/test/std/language.support/support.types/byteops/rshift.assign.fail.cpp new file mode 100644 index 000000000..44992fa98 --- /dev/null +++ b/test/std/language.support/support.types/byteops/rshift.assign.fail.cpp @@ -0,0 +1,31 @@ +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +#include +#include + +// UNSUPPORTED: c++98, c++03, c++11, c++14 +// The following compilers don't like "std::byte b1{1}" +// UNSUPPORTED: clang-3.5, clang-3.6, clang-3.7, clang-3.8 +// UNSUPPORTED: apple-clang-6, apple-clang-7, apple-clang-8.0 + +// template +// constexpr byte operator>>(byte& b, IntegerType shift) noexcept; +// This function shall not participate in overload resolution unless +// is_integral_v is true. + + +constexpr std::byte test(std::byte b) { + return b >>= 2.0; + } + + +int main () { + constexpr std::byte b1 = test(std::byte{1}); +} diff --git a/test/std/language.support/support.types/byteops/rshift.assign.pass.cpp b/test/std/language.support/support.types/byteops/rshift.assign.pass.cpp new file mode 100644 index 000000000..82c611cfd --- /dev/null +++ b/test/std/language.support/support.types/byteops/rshift.assign.pass.cpp @@ -0,0 +1,35 @@ +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +#include +#include + +// UNSUPPORTED: c++98, c++03, c++11, c++14 + +// template +// constexpr byte& operator>>=(byte& b, IntegerType shift) noexcept; +// This function shall not participate in overload resolution unless +// is_integral_v is true. + + +constexpr std::byte test(std::byte b) { + return b >>= 2; + } + + +int main () { + std::byte b; // not constexpr, just used in noexcept check + constexpr std::byte b16{static_cast(16)}; + constexpr std::byte b192{static_cast(192)}; + + static_assert(noexcept(b >>= 2), "" ); + + static_assert(std::to_integer(test(b16)) == 4, "" ); + static_assert(std::to_integer(test(b192)) == 48, "" ); +} diff --git a/test/std/language.support/support.types/byteops/rshift.fail.cpp b/test/std/language.support/support.types/byteops/rshift.fail.cpp new file mode 100644 index 000000000..8e142dd90 --- /dev/null +++ b/test/std/language.support/support.types/byteops/rshift.fail.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. +// +//===----------------------------------------------------------------------===// + +#include +#include + +// UNSUPPORTED: c++98, c++03, c++11, c++14 + +// template +// constexpr byte operator >>(byte b, IntegerType shift) noexcept; +// These functions shall not participate in overload resolution unless +// is_integral_v is true. + +int main () { + constexpr std::byte b1{static_cast(1)}; + constexpr std::byte b2 = b1 >> 2.0f; +} diff --git a/test/std/language.support/support.types/byteops/rshift.pass.cpp b/test/std/language.support/support.types/byteops/rshift.pass.cpp new file mode 100644 index 000000000..22d399130 --- /dev/null +++ b/test/std/language.support/support.types/byteops/rshift.pass.cpp @@ -0,0 +1,37 @@ +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +#include +#include + +// UNSUPPORTED: c++98, c++03, c++11, c++14 + +// template +// constexpr byte operator <<(byte b, IntegerType shift) noexcept; +// These functions shall not participate in overload resolution unless +// is_integral_v is true. + + +constexpr std::byte test(std::byte b) { + return b <<= 2; + } + + +int main () { + constexpr std::byte b100{static_cast(100)}; + constexpr std::byte b115{static_cast(115)}; + + static_assert(noexcept(b100 << 2), "" ); + + static_assert(std::to_integer(b100 >> 1) == 50, ""); + static_assert(std::to_integer(b100 >> 2) == 25, ""); + static_assert(std::to_integer(b115 >> 3) == 14, ""); + static_assert(std::to_integer(b115 >> 6) == 1, ""); + +} diff --git a/test/std/language.support/support.types/byteops/to_integer.fail.cpp b/test/std/language.support/support.types/byteops/to_integer.fail.cpp new file mode 100644 index 000000000..fb4928956 --- /dev/null +++ b/test/std/language.support/support.types/byteops/to_integer.fail.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. +// +//===----------------------------------------------------------------------===// + +#include +#include + +// UNSUPPORTED: c++98, c++03, c++11, c++14 + +// template +// constexpr IntegerType to_integer(byte b) noexcept; +// This function shall not participate in overload resolution unless +// is_integral_v is true. + +int main () { + constexpr std::byte b1{static_cast(1)}; + auto f = std::to_integer(b1); +} diff --git a/test/std/language.support/support.types/byteops/to_integer.pass.cpp b/test/std/language.support/support.types/byteops/to_integer.pass.cpp new file mode 100644 index 000000000..4f3436344 --- /dev/null +++ b/test/std/language.support/support.types/byteops/to_integer.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. +// +//===----------------------------------------------------------------------===// + +#include +#include + +// UNSUPPORTED: c++98, c++03, c++11, c++14 + +// template +// constexpr IntegerType to_integer(byte b) noexcept; +// This function shall not participate in overload resolution unless +// is_integral_v is true. + +int main () { + constexpr std::byte b1{static_cast(1)}; + constexpr std::byte b3{static_cast(3)}; + + static_assert(noexcept(std::to_integer(b1)), "" ); + static_assert(std::is_same(b1))>::value, "" ); + static_assert(std::is_same(b1))>::value, "" ); + static_assert(std::is_same(b1))>::value, "" ); + + static_assert(std::to_integer(b1) == 1, ""); + static_assert(std::to_integer(b3) == 3, ""); +} diff --git a/test/std/language.support/support.types/byteops/xor.assign.pass.cpp b/test/std/language.support/support.types/byteops/xor.assign.pass.cpp new file mode 100644 index 000000000..6a526da3d --- /dev/null +++ b/test/std/language.support/support.types/byteops/xor.assign.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. +// +//===----------------------------------------------------------------------===// + +#include +#include + +// UNSUPPORTED: c++98, c++03, c++11, c++14 + +// constexpr byte& operator ^=(byte l, byte r) noexcept; + + +constexpr std::byte test(std::byte b1, std::byte b2) { + std::byte bret = b1; + return bret ^= b2; + } + + +int main () { + std::byte b; // not constexpr, just used in noexcept check + constexpr std::byte b1{static_cast(1)}; + constexpr std::byte b8{static_cast(8)}; + constexpr std::byte b9{static_cast(9)}; + + static_assert(noexcept(b ^= b), "" ); + + static_assert(std::to_integer(test(b1, b8)) == 9, ""); + static_assert(std::to_integer(test(b1, b9)) == 8, ""); + static_assert(std::to_integer(test(b8, b9)) == 1, ""); + + static_assert(std::to_integer(test(b8, b1)) == 9, ""); + static_assert(std::to_integer(test(b9, b1)) == 8, ""); + static_assert(std::to_integer(test(b9, b8)) == 1, ""); +} diff --git a/test/std/language.support/support.types/byteops/xor.pass.cpp b/test/std/language.support/support.types/byteops/xor.pass.cpp new file mode 100644 index 000000000..e8c3b9875 --- /dev/null +++ b/test/std/language.support/support.types/byteops/xor.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. +// +//===----------------------------------------------------------------------===// + +#include +#include + +// UNSUPPORTED: c++98, c++03, c++11, c++14 + +// constexpr byte operator^(byte l, byte r) noexcept; + +int main () { + constexpr std::byte b1{static_cast(1)}; + constexpr std::byte b8{static_cast(8)}; + constexpr std::byte b9{static_cast(9)}; + + static_assert(noexcept(b1 ^ b8), "" ); + + static_assert(std::to_integer(b1 ^ b8) == 9, ""); + static_assert(std::to_integer(b1 ^ b9) == 8, ""); + static_assert(std::to_integer(b8 ^ b9) == 1, ""); + + static_assert(std::to_integer(b8 ^ b1) == 9, ""); + static_assert(std::to_integer(b9 ^ b1) == 8, ""); + static_assert(std::to_integer(b9 ^ b8) == 1, ""); +} diff --git a/test/std/localization/locale.categories/category.ctype/ctype_base.pass.cpp b/test/std/localization/locale.categories/category.ctype/ctype_base.pass.cpp index 044ba2b97..06c171f56 100644 --- a/test/std/localization/locale.categories/category.ctype/ctype_base.pass.cpp +++ b/test/std/localization/locale.categories/category.ctype/ctype_base.pass.cpp @@ -9,8 +9,8 @@ // // This test uses new symbols that were not defined in the libc++ shipped on // darwin11 and darwin12: -// XFAIL: with_system_cxx_lib=x86_64-apple-darwin11 -// XFAIL: with_system_cxx_lib=x86_64-apple-darwin12 +// XFAIL: with_system_cxx_lib=macosx10.7 +// XFAIL: with_system_cxx_lib=macosx10.8 // diff --git a/test/std/localization/locale.categories/category.ctype/locale.ctype.byname/tolower_1.pass.cpp b/test/std/localization/locale.categories/category.ctype/locale.ctype.byname/tolower_1.pass.cpp index 4488e9c3f..a9a872014 100644 --- a/test/std/localization/locale.categories/category.ctype/locale.ctype.byname/tolower_1.pass.cpp +++ b/test/std/localization/locale.categories/category.ctype/locale.ctype.byname/tolower_1.pass.cpp @@ -15,9 +15,6 @@ // charT tolower(charT) const; -// XFAIL: with_system_cxx_lib=x86_64-apple-darwin11 -// XFAIL: with_system_cxx_lib=x86_64-apple-darwin12 - #include #include diff --git a/test/std/localization/locale.categories/category.ctype/locale.ctype.byname/tolower_many.pass.cpp b/test/std/localization/locale.categories/category.ctype/locale.ctype.byname/tolower_many.pass.cpp index 0c224e342..67fe44931 100644 --- a/test/std/localization/locale.categories/category.ctype/locale.ctype.byname/tolower_many.pass.cpp +++ b/test/std/localization/locale.categories/category.ctype/locale.ctype.byname/tolower_many.pass.cpp @@ -15,9 +15,6 @@ // const charT* tolower(charT* low, const charT* high) const; -// XFAIL: with_system_cxx_lib=x86_64-apple-darwin11 -// XFAIL: with_system_cxx_lib=x86_64-apple-darwin12 - #include #include #include diff --git a/test/std/localization/locale.categories/category.ctype/locale.ctype.byname/toupper_1.pass.cpp b/test/std/localization/locale.categories/category.ctype/locale.ctype.byname/toupper_1.pass.cpp index 0985de500..271ae2c03 100644 --- a/test/std/localization/locale.categories/category.ctype/locale.ctype.byname/toupper_1.pass.cpp +++ b/test/std/localization/locale.categories/category.ctype/locale.ctype.byname/toupper_1.pass.cpp @@ -15,9 +15,6 @@ // charT toupper(charT) const; -// XFAIL: with_system_cxx_lib=x86_64-apple-darwin11 -// XFAIL: with_system_cxx_lib=x86_64-apple-darwin12 - #include #include diff --git a/test/std/localization/locale.categories/category.ctype/locale.ctype.byname/toupper_many.pass.cpp b/test/std/localization/locale.categories/category.ctype/locale.ctype.byname/toupper_many.pass.cpp index ba0477549..650713570 100644 --- a/test/std/localization/locale.categories/category.ctype/locale.ctype.byname/toupper_many.pass.cpp +++ b/test/std/localization/locale.categories/category.ctype/locale.ctype.byname/toupper_many.pass.cpp @@ -15,9 +15,6 @@ // const charT* toupper(charT* low, const charT* high) const; -// XFAIL: with_system_cxx_lib=x86_64-apple-darwin11 -// XFAIL: with_system_cxx_lib=x86_64-apple-darwin12 - #include #include #include diff --git a/test/std/localization/locale.categories/category.monetary/locale.money.get/locale.money.get.members/get_long_double_ru_RU.pass.cpp b/test/std/localization/locale.categories/category.monetary/locale.money.get/locale.money.get.members/get_long_double_ru_RU.pass.cpp index ec563fe4c..7776c67a6 100644 --- a/test/std/localization/locale.categories/category.monetary/locale.money.get/locale.money.get.members/get_long_double_ru_RU.pass.cpp +++ b/test/std/localization/locale.categories/category.monetary/locale.money.get/locale.money.get.members/get_long_double_ru_RU.pass.cpp @@ -7,7 +7,8 @@ // //===----------------------------------------------------------------------===// // -// XFAIL: apple-darwin +// This test is passing in an uncontrolled manner in some Apple environment. +// UNSUPPORTED: apple-darwin // Failure related to GLIBC's use of U00A0 as mon_thousands_sep // and U002E as mon_decimal_point. diff --git a/test/std/localization/locale.categories/category.monetary/locale.money.put/locale.money.put.members/put_long_double_ru_RU.pass.cpp b/test/std/localization/locale.categories/category.monetary/locale.money.put/locale.money.put.members/put_long_double_ru_RU.pass.cpp index 54bfcfb5c..4d805b0f7 100644 --- a/test/std/localization/locale.categories/category.monetary/locale.money.put/locale.money.put.members/put_long_double_ru_RU.pass.cpp +++ b/test/std/localization/locale.categories/category.monetary/locale.money.put/locale.money.put.members/put_long_double_ru_RU.pass.cpp @@ -7,7 +7,8 @@ // //===----------------------------------------------------------------------===// // -// XFAIL: apple-darwin +// This test is passing in an uncontrolled manner in some Apple environment. +// UNSUPPORTED: apple-darwin // Failure related to GLIBC's use of U00A0 as mon_thousands_sep // and U002E as mon_decimal_point. diff --git a/test/std/localization/locale.categories/category.monetary/locale.moneypunct/types.pass.cpp b/test/std/localization/locale.categories/category.monetary/locale.moneypunct/types.pass.cpp index 32e7249ab..323d856a3 100644 --- a/test/std/localization/locale.categories/category.monetary/locale.moneypunct/types.pass.cpp +++ b/test/std/localization/locale.categories/category.monetary/locale.moneypunct/types.pass.cpp @@ -9,8 +9,8 @@ // // This test uses new symbols that were not defined in the libc++ shipped on // darwin11 and darwin12: -// XFAIL: with_system_cxx_lib=x86_64-apple-darwin11 -// XFAIL: with_system_cxx_lib=x86_64-apple-darwin12 +// XFAIL: with_system_cxx_lib=macosx10.7 +// XFAIL: with_system_cxx_lib=macosx10.8 // diff --git a/test/std/localization/locale.categories/category.numeric/locale.num.get/facet.num.get.members/get_double.pass.cpp b/test/std/localization/locale.categories/category.numeric/locale.num.get/facet.num.get.members/get_double.pass.cpp index 6d7f506bb..e3367b26f 100644 --- a/test/std/localization/locale.categories/category.numeric/locale.num.get/facet.num.get.members/get_double.pass.cpp +++ b/test/std/localization/locale.categories/category.numeric/locale.num.get/facet.num.get.members/get_double.pass.cpp @@ -7,8 +7,10 @@ // //===----------------------------------------------------------------------===// // -// XFAIL: with_system_cxx_lib=x86_64-apple-darwin11 -// XFAIL: with_system_cxx_lib=x86_64-apple-darwin12 +// PR11871 +// XFAIL: with_system_cxx_lib=macosx10.7 +// PR15445 +// XFAIL: with_system_cxx_lib=macosx10.8 // diff --git a/test/std/localization/locale.categories/category.numeric/locale.num.get/facet.num.get.members/get_float.pass.cpp b/test/std/localization/locale.categories/category.numeric/locale.num.get/facet.num.get.members/get_float.pass.cpp index d01f63d59..174312d09 100644 --- a/test/std/localization/locale.categories/category.numeric/locale.num.get/facet.num.get.members/get_float.pass.cpp +++ b/test/std/localization/locale.categories/category.numeric/locale.num.get/facet.num.get.members/get_float.pass.cpp @@ -6,6 +6,9 @@ // Source Licenses. See LICENSE.TXT for details. // //===----------------------------------------------------------------------===// +// +// PR11871 +// XFAIL: with_system_cxx_lib=macosx10.7 // @@ -194,4 +197,16 @@ int main() assert(v == -HUGE_VALF); } + { + v = -1; + const char str[] = "2-"; + std::ios_base::iostate err = ios.goodbit; + input_iterator iter = + f.get(input_iterator(str), + input_iterator(str+sizeof(str)), + ios, err, v); + assert(iter.base() == str+1); + assert(err == ios.goodbit); + assert(v == 2); + } } diff --git a/test/std/localization/locale.categories/category.numeric/locale.num.get/facet.num.get.members/get_long_double.pass.cpp b/test/std/localization/locale.categories/category.numeric/locale.num.get/facet.num.get.members/get_long_double.pass.cpp index b79650b01..cf671b000 100644 --- a/test/std/localization/locale.categories/category.numeric/locale.num.get/facet.num.get.members/get_long_double.pass.cpp +++ b/test/std/localization/locale.categories/category.numeric/locale.num.get/facet.num.get.members/get_long_double.pass.cpp @@ -6,6 +6,9 @@ // Source Licenses. See LICENSE.TXT for details. // //===----------------------------------------------------------------------===// +// +// PR11871 +// XFAIL: with_system_cxx_lib=macosx10.7 // @@ -253,4 +256,16 @@ int main() assert(err == ios.failbit); assert(v == -HUGE_VALL); } + { + v = -1; + const char str[] = "2-"; + std::ios_base::iostate err = ios.goodbit; + input_iterator iter = + f.get(input_iterator(str), + input_iterator(str+sizeof(str)), + ios, err, v); + assert(iter.base() == str+1); + assert(err == ios.goodbit); + assert(v == 2); + } } diff --git a/test/std/localization/locale.stdcvt/codecvt_utf16_out.pass.cpp b/test/std/localization/locale.stdcvt/codecvt_utf16_out.pass.cpp index 2eb6978b0..b90c41e59 100644 --- a/test/std/localization/locale.stdcvt/codecvt_utf16_out.pass.cpp +++ b/test/std/localization/locale.stdcvt/codecvt_utf16_out.pass.cpp @@ -25,307 +25,329 @@ #include #include -int main() -{ - { - typedef std::codecvt_utf16 C; - C c; - wchar_t w = 0x40003; - char n[4] = {0}; - const wchar_t* wp = nullptr; - std::mbstate_t m; - char* np = nullptr; - std::codecvt_base::result r = c.out(m, &w, &w+1, wp, n, n+4, np); - assert(r == std::codecvt_base::ok); - assert(wp == &w+1); - assert(np == n+4); - assert(n[0] == char(0xD8)); - assert(n[1] == char(0xC0)); - assert(n[2] == char(0xDC)); - assert(n[3] == char(0x03)); +template +struct TestHelper; +template +struct TestHelper { + static void test(); +}; +template +struct TestHelper { + static void test(); +}; - w = 0x1005; - r = c.out(m, &w, &w+1, wp, n, n+4, np); - assert(r == std::codecvt_base::ok); - assert(wp == &w+1); - assert(np == n+2); - assert(n[0] == char(0x10)); - assert(n[1] == char(0x05)); - assert(n[2] == char(0xDC)); - assert(n[3] == char(0x03)); - - w = 0x453; - r = c.out(m, &w, &w+1, wp, n, n+4, np); - assert(r == std::codecvt_base::ok); - assert(wp == &w+1); - assert(np == n+2); - assert(n[0] == char(0x04)); - assert(n[1] == char(0x53)); - assert(n[2] == char(0xDC)); - assert(n[3] == char(0x03)); - - w = 0x56; - r = c.out(m, &w, &w+1, wp, n, n+4, np); - assert(r == std::codecvt_base::ok); - assert(wp == &w+1); - assert(np == n+2); - assert(n[0] == char(0x00)); - assert(n[1] == char(0x56)); - assert(n[2] == char(0xDC)); - assert(n[3] == char(0x03)); - } - { - typedef std::codecvt_utf16 C; - C c; - wchar_t w = 0x40003; - char n[4] = {0}; - const wchar_t* wp = nullptr; - std::mbstate_t m; - char* np = nullptr; - std::codecvt_base::result r = c.out(m, &w, &w+1, wp, n, n+4, np); - assert(r == std::codecvt_base::error); - assert(wp == &w); - assert(np == n); - assert(n[0] == char(0)); - assert(n[1] == char(0)); - assert(n[2] == char(0)); - assert(n[3] == char(0)); - - w = 0x1005; - r = c.out(m, &w, &w+1, wp, n, n+4, np); - assert(r == std::codecvt_base::error); - assert(wp == &w); - assert(np == n); - assert(n[0] == char(0)); - assert(n[1] == char(0)); - assert(n[2] == char(0)); - assert(n[3] == char(0)); - - w = 0x453; - r = c.out(m, &w, &w+1, wp, n, n+4, np); - assert(r == std::codecvt_base::ok); - assert(wp == &w+1); - assert(np == n+2); - assert(n[0] == char(0x04)); - assert(n[1] == char(0x53)); - assert(n[2] == char(0)); - assert(n[3] == char(0)); - - w = 0x56; - r = c.out(m, &w, &w+1, wp, n, n+4, np); - assert(r == std::codecvt_base::ok); - assert(wp == &w+1); - assert(np == n+2); - assert(n[0] == char(0x00)); - assert(n[1] == char(0x56)); - assert(n[2] == char(0)); - assert(n[3] == char(0)); - } - { - typedef std::codecvt_utf16 C; - C c; - wchar_t w = 0x40003; - char n[6] = {0}; - const wchar_t* wp = nullptr; - std::mbstate_t m; - char* np = nullptr; - std::codecvt_base::result r = c.out(m, &w, &w+1, wp, n, n+6, np); - assert(r == std::codecvt_base::ok); - assert(wp == &w+1); - assert(np == n+6); - assert(n[0] == char(0xFE)); - assert(n[1] == char(0xFF)); - assert(n[2] == char(0xD8)); - assert(n[3] == char(0xC0)); - assert(n[4] == char(0xDC)); - assert(n[5] == char(0x03)); - - w = 0x1005; - r = c.out(m, &w, &w+1, wp, n, n+6, np); - assert(r == std::codecvt_base::ok); - assert(wp == &w+1); - assert(np == n+4); - assert(n[0] == char(0xFE)); - assert(n[1] == char(0xFF)); - assert(n[2] == char(0x10)); - assert(n[3] == char(0x05)); - assert(n[4] == char(0xDC)); - assert(n[5] == char(0x03)); - - w = 0x453; - r = c.out(m, &w, &w+1, wp, n, n+6, np); - assert(r == std::codecvt_base::ok); - assert(wp == &w+1); - assert(np == n+4); - assert(n[0] == char(0xFE)); - assert(n[1] == char(0xFF)); - assert(n[2] == char(0x04)); - assert(n[3] == char(0x53)); - assert(n[4] == char(0xDC)); - assert(n[5] == char(0x03)); - - w = 0x56; - r = c.out(m, &w, &w+1, wp, n, n+6, np); - assert(r == std::codecvt_base::ok); - assert(wp == &w+1); - assert(np == n+4); - assert(n[0] == char(0xFE)); - assert(n[1] == char(0xFF)); - assert(n[2] == char(0x00)); - assert(n[3] == char(0x56)); - assert(n[4] == char(0xDC)); - assert(n[5] == char(0x03)); - } - - { - typedef std::codecvt_utf16 C; - C c; - wchar_t w = 0x40003; - char n[4] = {0}; - const wchar_t* wp = nullptr; - std::mbstate_t m; - char* np = nullptr; - std::codecvt_base::result r = c.out(m, &w, &w+1, wp, n, n+4, np); - assert(r == std::codecvt_base::ok); - assert(wp == &w+1); - assert(np == n+4); - assert(n[1] == char(0xD8)); - assert(n[0] == char(0xC0)); - assert(n[3] == char(0xDC)); - assert(n[2] == char(0x03)); - - w = 0x1005; - r = c.out(m, &w, &w+1, wp, n, n+4, np); - assert(r == std::codecvt_base::ok); - assert(wp == &w+1); - assert(np == n+2); - assert(n[1] == char(0x10)); - assert(n[0] == char(0x05)); - assert(n[3] == char(0xDC)); - assert(n[2] == char(0x03)); - - w = 0x453; - r = c.out(m, &w, &w+1, wp, n, n+4, np); - assert(r == std::codecvt_base::ok); - assert(wp == &w+1); - assert(np == n+2); - assert(n[1] == char(0x04)); - assert(n[0] == char(0x53)); - assert(n[3] == char(0xDC)); - assert(n[2] == char(0x03)); - - w = 0x56; - r = c.out(m, &w, &w+1, wp, n, n+4, np); - assert(r == std::codecvt_base::ok); - assert(wp == &w+1); - assert(np == n+2); - assert(n[1] == char(0x00)); - assert(n[0] == char(0x56)); - assert(n[3] == char(0xDC)); - assert(n[2] == char(0x03)); - } - { - typedef std::codecvt_utf16 C; - C c; - wchar_t w = 0x40003; - char n[4] = {0}; - const wchar_t* wp = nullptr; - std::mbstate_t m; - char* np = nullptr; - std::codecvt_base::result r = c.out(m, &w, &w+1, wp, n, n+4, np); - assert(r == std::codecvt_base::error); - assert(wp == &w); - assert(np == n); - assert(n[1] == char(0)); - assert(n[0] == char(0)); - assert(n[3] == char(0)); - assert(n[2] == char(0)); - - w = 0x1005; - r = c.out(m, &w, &w+1, wp, n, n+4, np); - assert(r == std::codecvt_base::error); - assert(wp == &w); - assert(np == n); - assert(n[1] == char(0)); - assert(n[0] == char(0)); - assert(n[3] == char(0)); - assert(n[2] == char(0)); - - w = 0x453; - r = c.out(m, &w, &w+1, wp, n, n+4, np); - assert(r == std::codecvt_base::ok); - assert(wp == &w+1); - assert(np == n+2); - assert(n[1] == char(0x04)); - assert(n[0] == char(0x53)); - assert(n[3] == char(0)); - assert(n[2] == char(0)); - - w = 0x56; - r = c.out(m, &w, &w+1, wp, n, n+4, np); - assert(r == std::codecvt_base::ok); - assert(wp == &w+1); - assert(np == n+2); - assert(n[1] == char(0x00)); - assert(n[0] == char(0x56)); - assert(n[3] == char(0)); - assert(n[2] == char(0)); - } - { - typedef std::codecvt_utf16 C; - C c; - wchar_t w = 0x40003; - char n[6] = {0}; - const wchar_t* wp = nullptr; - std::mbstate_t m; - char* np = nullptr; - std::codecvt_base::result r = c.out(m, &w, &w+1, wp, n, n+6, np); - assert(r == std::codecvt_base::ok); - assert(wp == &w+1); - assert(np == n+6); - assert(n[1] == char(0xFE)); - assert(n[0] == char(0xFF)); - assert(n[3] == char(0xD8)); - assert(n[2] == char(0xC0)); - assert(n[5] == char(0xDC)); - assert(n[4] == char(0x03)); - - w = 0x1005; - r = c.out(m, &w, &w+1, wp, n, n+6, np); - assert(r == std::codecvt_base::ok); - assert(wp == &w+1); - assert(np == n+4); - assert(n[1] == char(0xFE)); - assert(n[0] == char(0xFF)); - assert(n[3] == char(0x10)); - assert(n[2] == char(0x05)); - assert(n[5] == char(0xDC)); - assert(n[4] == char(0x03)); - - w = 0x453; - r = c.out(m, &w, &w+1, wp, n, n+6, np); - assert(r == std::codecvt_base::ok); - assert(wp == &w+1); - assert(np == n+4); - assert(n[1] == char(0xFE)); - assert(n[0] == char(0xFF)); - assert(n[3] == char(0x04)); - assert(n[2] == char(0x53)); - assert(n[5] == char(0xDC)); - assert(n[4] == char(0x03)); - - w = 0x56; - r = c.out(m, &w, &w+1, wp, n, n+6, np); - assert(r == std::codecvt_base::ok); - assert(wp == &w+1); - assert(np == n+4); - assert(n[1] == char(0xFE)); - assert(n[0] == char(0xFF)); - assert(n[3] == char(0x00)); - assert(n[2] == char(0x56)); - assert(n[5] == char(0xDC)); - assert(n[4] == char(0x03)); - } +template +void TestHelper::test() { + // Nothing to do, the conversion in unsupported +} + +template +void TestHelper::test() { + { + typedef std::codecvt_utf16 C; + C c; + CharT w = 0x40003; + char n[4] = {0}; + const CharT* wp = nullptr; + std::mbstate_t m; + char* np = nullptr; + std::codecvt_base::result r = c.out(m, &w, &w + 1, wp, n, n + 4, np); + assert(r == std::codecvt_base::ok); + assert(wp == &w + 1); + assert(np == n + 4); + assert(n[0] == char(0xD8)); + assert(n[1] == char(0xC0)); + assert(n[2] == char(0xDC)); + assert(n[3] == char(0x03)); + + w = 0x1005; + r = c.out(m, &w, &w + 1, wp, n, n + 4, np); + assert(r == std::codecvt_base::ok); + assert(wp == &w + 1); + assert(np == n + 2); + assert(n[0] == char(0x10)); + assert(n[1] == char(0x05)); + assert(n[2] == char(0xDC)); + assert(n[3] == char(0x03)); + + w = 0x453; + r = c.out(m, &w, &w + 1, wp, n, n + 4, np); + assert(r == std::codecvt_base::ok); + assert(wp == &w + 1); + assert(np == n + 2); + assert(n[0] == char(0x04)); + assert(n[1] == char(0x53)); + assert(n[2] == char(0xDC)); + assert(n[3] == char(0x03)); + + w = 0x56; + r = c.out(m, &w, &w + 1, wp, n, n + 4, np); + assert(r == std::codecvt_base::ok); + assert(wp == &w + 1); + assert(np == n + 2); + assert(n[0] == char(0x00)); + assert(n[1] == char(0x56)); + assert(n[2] == char(0xDC)); + assert(n[3] == char(0x03)); + } + { + typedef std::codecvt_utf16 C; + C c; + CharT w = 0x40003; + char n[4] = {0}; + const CharT* wp = nullptr; + std::mbstate_t m; + char* np = nullptr; + std::codecvt_base::result r = c.out(m, &w, &w + 1, wp, n, n + 4, np); + assert(r == std::codecvt_base::error); + assert(wp == &w); + assert(np == n); + assert(n[0] == char(0)); + assert(n[1] == char(0)); + assert(n[2] == char(0)); + assert(n[3] == char(0)); + + w = 0x1005; + r = c.out(m, &w, &w + 1, wp, n, n + 4, np); + assert(r == std::codecvt_base::error); + assert(wp == &w); + assert(np == n); + assert(n[0] == char(0)); + assert(n[1] == char(0)); + assert(n[2] == char(0)); + assert(n[3] == char(0)); + + w = 0x453; + r = c.out(m, &w, &w + 1, wp, n, n + 4, np); + assert(r == std::codecvt_base::ok); + assert(wp == &w + 1); + assert(np == n + 2); + assert(n[0] == char(0x04)); + assert(n[1] == char(0x53)); + assert(n[2] == char(0)); + assert(n[3] == char(0)); + + w = 0x56; + r = c.out(m, &w, &w + 1, wp, n, n + 4, np); + assert(r == std::codecvt_base::ok); + assert(wp == &w + 1); + assert(np == n + 2); + assert(n[0] == char(0x00)); + assert(n[1] == char(0x56)); + assert(n[2] == char(0)); + assert(n[3] == char(0)); + } + { + typedef std::codecvt_utf16 C; + C c; + CharT w = 0x40003; + char n[6] = {0}; + const CharT* wp = nullptr; + std::mbstate_t m; + char* np = nullptr; + std::codecvt_base::result r = c.out(m, &w, &w + 1, wp, n, n + 6, np); + assert(r == std::codecvt_base::ok); + assert(wp == &w + 1); + assert(np == n + 6); + assert(n[0] == char(0xFE)); + assert(n[1] == char(0xFF)); + assert(n[2] == char(0xD8)); + assert(n[3] == char(0xC0)); + assert(n[4] == char(0xDC)); + assert(n[5] == char(0x03)); + + w = 0x1005; + r = c.out(m, &w, &w + 1, wp, n, n + 6, np); + assert(r == std::codecvt_base::ok); + assert(wp == &w + 1); + assert(np == n + 4); + assert(n[0] == char(0xFE)); + assert(n[1] == char(0xFF)); + assert(n[2] == char(0x10)); + assert(n[3] == char(0x05)); + assert(n[4] == char(0xDC)); + assert(n[5] == char(0x03)); + + w = 0x453; + r = c.out(m, &w, &w + 1, wp, n, n + 6, np); + assert(r == std::codecvt_base::ok); + assert(wp == &w + 1); + assert(np == n + 4); + assert(n[0] == char(0xFE)); + assert(n[1] == char(0xFF)); + assert(n[2] == char(0x04)); + assert(n[3] == char(0x53)); + assert(n[4] == char(0xDC)); + assert(n[5] == char(0x03)); + + w = 0x56; + r = c.out(m, &w, &w + 1, wp, n, n + 6, np); + assert(r == std::codecvt_base::ok); + assert(wp == &w + 1); + assert(np == n + 4); + assert(n[0] == char(0xFE)); + assert(n[1] == char(0xFF)); + assert(n[2] == char(0x00)); + assert(n[3] == char(0x56)); + assert(n[4] == char(0xDC)); + assert(n[5] == char(0x03)); + } + + { + typedef std::codecvt_utf16 C; + C c; + CharT w = 0x40003; + char n[4] = {0}; + const CharT* wp = nullptr; + std::mbstate_t m; + char* np = nullptr; + std::codecvt_base::result r = c.out(m, &w, &w + 1, wp, n, n + 4, np); + assert(r == std::codecvt_base::ok); + assert(wp == &w + 1); + assert(np == n + 4); + assert(n[1] == char(0xD8)); + assert(n[0] == char(0xC0)); + assert(n[3] == char(0xDC)); + assert(n[2] == char(0x03)); + + w = 0x1005; + r = c.out(m, &w, &w + 1, wp, n, n + 4, np); + assert(r == std::codecvt_base::ok); + assert(wp == &w + 1); + assert(np == n + 2); + assert(n[1] == char(0x10)); + assert(n[0] == char(0x05)); + assert(n[3] == char(0xDC)); + assert(n[2] == char(0x03)); + + w = 0x453; + r = c.out(m, &w, &w + 1, wp, n, n + 4, np); + assert(r == std::codecvt_base::ok); + assert(wp == &w + 1); + assert(np == n + 2); + assert(n[1] == char(0x04)); + assert(n[0] == char(0x53)); + assert(n[3] == char(0xDC)); + assert(n[2] == char(0x03)); + + w = 0x56; + r = c.out(m, &w, &w + 1, wp, n, n + 4, np); + assert(r == std::codecvt_base::ok); + assert(wp == &w + 1); + assert(np == n + 2); + assert(n[1] == char(0x00)); + assert(n[0] == char(0x56)); + assert(n[3] == char(0xDC)); + assert(n[2] == char(0x03)); + } + { + typedef std::codecvt_utf16 C; + C c; + CharT w = 0x40003; + char n[4] = {0}; + const CharT* wp = nullptr; + std::mbstate_t m; + char* np = nullptr; + std::codecvt_base::result r = c.out(m, &w, &w + 1, wp, n, n + 4, np); + assert(r == std::codecvt_base::error); + assert(wp == &w); + assert(np == n); + assert(n[1] == char(0)); + assert(n[0] == char(0)); + assert(n[3] == char(0)); + assert(n[2] == char(0)); + + w = 0x1005; + r = c.out(m, &w, &w + 1, wp, n, n + 4, np); + assert(r == std::codecvt_base::error); + assert(wp == &w); + assert(np == n); + assert(n[1] == char(0)); + assert(n[0] == char(0)); + assert(n[3] == char(0)); + assert(n[2] == char(0)); + + w = 0x453; + r = c.out(m, &w, &w + 1, wp, n, n + 4, np); + assert(r == std::codecvt_base::ok); + assert(wp == &w + 1); + assert(np == n + 2); + assert(n[1] == char(0x04)); + assert(n[0] == char(0x53)); + assert(n[3] == char(0)); + assert(n[2] == char(0)); + + w = 0x56; + r = c.out(m, &w, &w + 1, wp, n, n + 4, np); + assert(r == std::codecvt_base::ok); + assert(wp == &w + 1); + assert(np == n + 2); + assert(n[1] == char(0x00)); + assert(n[0] == char(0x56)); + assert(n[3] == char(0)); + assert(n[2] == char(0)); + } + { + typedef std::codecvt_utf16 + C; + C c; + CharT w = 0x40003; + char n[6] = {0}; + const CharT* wp = nullptr; + std::mbstate_t m; + char* np = nullptr; + std::codecvt_base::result r = c.out(m, &w, &w + 1, wp, n, n + 6, np); + assert(r == std::codecvt_base::ok); + assert(wp == &w + 1); + assert(np == n + 6); + assert(n[1] == char(0xFE)); + assert(n[0] == char(0xFF)); + assert(n[3] == char(0xD8)); + assert(n[2] == char(0xC0)); + assert(n[5] == char(0xDC)); + assert(n[4] == char(0x03)); + + w = 0x1005; + r = c.out(m, &w, &w + 1, wp, n, n + 6, np); + assert(r == std::codecvt_base::ok); + assert(wp == &w + 1); + assert(np == n + 4); + assert(n[1] == char(0xFE)); + assert(n[0] == char(0xFF)); + assert(n[3] == char(0x10)); + assert(n[2] == char(0x05)); + assert(n[5] == char(0xDC)); + assert(n[4] == char(0x03)); + + w = 0x453; + r = c.out(m, &w, &w + 1, wp, n, n + 6, np); + assert(r == std::codecvt_base::ok); + assert(wp == &w + 1); + assert(np == n + 4); + assert(n[1] == char(0xFE)); + assert(n[0] == char(0xFF)); + assert(n[3] == char(0x04)); + assert(n[2] == char(0x53)); + assert(n[5] == char(0xDC)); + assert(n[4] == char(0x03)); + + w = 0x56; + r = c.out(m, &w, &w + 1, wp, n, n + 6, np); + assert(r == std::codecvt_base::ok); + assert(wp == &w + 1); + assert(np == n + 4); + assert(n[1] == char(0xFE)); + assert(n[0] == char(0xFF)); + assert(n[3] == char(0x00)); + assert(n[2] == char(0x56)); + assert(n[5] == char(0xDC)); + assert(n[4] == char(0x03)); + } +} + +int main() { + TestHelper::test(); + TestHelper::test(); } diff --git a/test/std/localization/locale.stdcvt/codecvt_utf8_out.pass.cpp b/test/std/localization/locale.stdcvt/codecvt_utf8_out.pass.cpp index 02cf7cf95..886fc4416 100644 --- a/test/std/localization/locale.stdcvt/codecvt_utf8_out.pass.cpp +++ b/test/std/localization/locale.stdcvt/codecvt_utf8_out.pass.cpp @@ -25,432 +25,302 @@ #include #include -int main() -{ - { - typedef std::codecvt_utf8 C; - C c; - wchar_t w = 0x40003; - char n[4] = {0}; - const wchar_t* wp = nullptr; - std::mbstate_t m; - char* np = nullptr; - std::codecvt_base::result r = c.out(m, &w, &w+1, wp, n, n+4, np); - assert(r == std::codecvt_base::ok); - assert(wp == &w+1); - assert(np == n+4); - assert(n[0] == char(0xF1)); - assert(n[1] == char(0x80)); - assert(n[2] == char(0x80)); - assert(n[3] == char(0x83)); +template +struct TestHelper; - w = 0x1005; - r = c.out(m, &w, &w+1, wp, n, n+4, np); - assert(r == std::codecvt_base::ok); - assert(wp == &w+1); - assert(np == n+3); - assert(n[0] == char(0xE1)); - assert(n[1] == char(0x80)); - assert(n[2] == char(0x85)); - assert(n[3] == char(0x83)); +template +struct TestHelper { + static void test(); +}; - w = 0x453; - r = c.out(m, &w, &w+1, wp, n, n+4, np); - assert(r == std::codecvt_base::ok); - assert(wp == &w+1); - assert(np == n+2); - assert(n[0] == char(0xD1)); - assert(n[1] == char(0x93)); - assert(n[2] == char(0x85)); - assert(n[3] == char(0x83)); +template +struct TestHelper { + static void test(); +}; - w = 0x56; - r = c.out(m, &w, &w+1, wp, n, n+4, np); - assert(r == std::codecvt_base::ok); - assert(wp == &w+1); - assert(np == n+1); - assert(n[0] == char(0x56)); - assert(n[1] == char(0x93)); - assert(n[2] == char(0x85)); - assert(n[3] == char(0x83)); - } - { - typedef std::codecvt_utf8 C; - C c; - wchar_t w = 0x40003; - char n[4] = {0}; - const wchar_t* wp = nullptr; - std::mbstate_t m; - char* np = nullptr; - std::codecvt_base::result r = c.out(m, &w, &w+1, wp, n, n+4, np); - assert(r == std::codecvt_base::error); - assert(wp == &w); - assert(np == n); - assert(n[0] == char(0)); - assert(n[1] == char(0)); - assert(n[2] == char(0)); - assert(n[3] == char(0)); +template +void TestHelper::test() { + { + typedef std::codecvt_utf8 C; + C c; + CharT w = 0x1005; + char n[4] = {0}; + const CharT* wp = nullptr; + std::mbstate_t m; + char* np = nullptr; + std::codecvt_base::result r = c.out(m, &w, &w + 1, wp, n, n + 4, np); + assert(r == std::codecvt_base::ok); + assert(wp == &w + 1); + assert(np == n + 3); + assert(n[0] == char(0xE1)); + assert(n[1] == char(0x80)); + assert(n[2] == char(0x85)); + assert(n[3] == char(0)); - w = 0x1005; - r = c.out(m, &w, &w+1, wp, n, n+4, np); - assert(r == std::codecvt_base::error); - assert(wp == &w); - assert(np == n); - assert(n[0] == char(0)); - assert(n[1] == char(0)); - assert(n[2] == char(0)); - assert(n[3] == char(0)); + w = 0x453; + r = c.out(m, &w, &w + 1, wp, n, n + 4, np); + assert(r == std::codecvt_base::ok); + assert(wp == &w + 1); + assert(np == n + 2); + assert(n[0] == char(0xD1)); + assert(n[1] == char(0x93)); + assert(n[2] == char(0x85)); + assert(n[3] == char(0)); - w = 0x453; - r = c.out(m, &w, &w+1, wp, n, n+4, np); - assert(r == std::codecvt_base::ok); - assert(wp == &w+1); - assert(np == n+2); - assert(n[0] == char(0xD1)); - assert(n[1] == char(0x93)); - assert(n[2] == char(0)); - assert(n[3] == char(0)); + w = 0x56; + r = c.out(m, &w, &w + 1, wp, n, n + 4, np); + assert(r == std::codecvt_base::ok); + assert(wp == &w + 1); + assert(np == n + 1); + assert(n[0] == char(0x56)); + assert(n[1] == char(0x93)); + assert(n[2] == char(0x85)); + assert(n[3] == char(0)); + } + { + typedef std::codecvt_utf8 C; + C c; + CharT w = 0x1005; + char n[4] = {0}; + const CharT* wp = nullptr; + std::mbstate_t m; + char* np = nullptr; + std::codecvt_base::result r = c.out(m, &w, &w + 1, wp, n, n + 4, np); + assert(r == std::codecvt_base::error); + assert(wp == &w); + assert(np == n); + assert(n[0] == char(0)); + assert(n[1] == char(0)); + assert(n[2] == char(0)); + assert(n[3] == char(0)); - w = 0x56; - r = c.out(m, &w, &w+1, wp, n, n+4, np); - assert(r == std::codecvt_base::ok); - assert(wp == &w+1); - assert(np == n+1); - assert(n[0] == char(0x56)); - assert(n[1] == char(0x93)); - assert(n[2] == char(0)); - assert(n[3] == char(0)); - } - { - typedef std::codecvt_utf8 C; - C c; - wchar_t w = 0x40003; - char n[7] = {0}; - const wchar_t* wp = nullptr; - std::mbstate_t m; - char* np = nullptr; - std::codecvt_base::result r = c.out(m, &w, &w+1, wp, n, n+7, np); - assert(r == std::codecvt_base::ok); - assert(wp == &w+1); - assert(np == n+7); - assert(n[0] == char(0xEF)); - assert(n[1] == char(0xBB)); - assert(n[2] == char(0xBF)); - assert(n[3] == char(0xF1)); - assert(n[4] == char(0x80)); - assert(n[5] == char(0x80)); - assert(n[6] == char(0x83)); + w = 0x453; + r = c.out(m, &w, &w + 1, wp, n, n + 4, np); + assert(r == std::codecvt_base::ok); + assert(wp == &w + 1); + assert(np == n + 2); + assert(n[0] == char(0xD1)); + assert(n[1] == char(0x93)); + assert(n[2] == char(0)); + assert(n[3] == char(0)); - w = 0x1005; - r = c.out(m, &w, &w+1, wp, n, n+7, np); - assert(r == std::codecvt_base::ok); - assert(wp == &w+1); - assert(np == n+6); - assert(n[0] == char(0xEF)); - assert(n[1] == char(0xBB)); - assert(n[2] == char(0xBF)); - assert(n[3] == char(0xE1)); - assert(n[4] == char(0x80)); - assert(n[5] == char(0x85)); - assert(n[6] == char(0x83)); + w = 0x56; + r = c.out(m, &w, &w + 1, wp, n, n + 4, np); + assert(r == std::codecvt_base::ok); + assert(wp == &w + 1); + assert(np == n + 1); + assert(n[0] == char(0x56)); + assert(n[1] == char(0x93)); + assert(n[2] == char(0)); + assert(n[3] == char(0)); + } + { + typedef std::codecvt_utf8 C; + C c; + CharT w = 0x1005; + char n[7] = {0}; + const CharT* wp = nullptr; + std::mbstate_t m; + char* np = nullptr; + std::codecvt_base::result r = c.out(m, &w, &w + 1, wp, n, n + 7, np); + assert(r == std::codecvt_base::ok); + assert(wp == &w + 1); + assert(np == n + 6); + assert(n[0] == char(0xEF)); + assert(n[1] == char(0xBB)); + assert(n[2] == char(0xBF)); + assert(n[3] == char(0xE1)); + assert(n[4] == char(0x80)); + assert(n[5] == char(0x85)); + assert(n[6] == char(0)); - w = 0x453; - r = c.out(m, &w, &w+1, wp, n, n+7, np); - assert(r == std::codecvt_base::ok); - assert(wp == &w+1); - assert(np == n+5); - assert(n[0] == char(0xEF)); - assert(n[1] == char(0xBB)); - assert(n[2] == char(0xBF)); - assert(n[3] == char(0xD1)); - assert(n[4] == char(0x93)); - assert(n[5] == char(0x85)); - assert(n[6] == char(0x83)); + w = 0x453; + r = c.out(m, &w, &w + 1, wp, n, n + 7, np); + assert(r == std::codecvt_base::ok); + assert(wp == &w + 1); + assert(np == n + 5); + assert(n[0] == char(0xEF)); + assert(n[1] == char(0xBB)); + assert(n[2] == char(0xBF)); + assert(n[3] == char(0xD1)); + assert(n[4] == char(0x93)); + assert(n[5] == char(0x85)); + assert(n[6] == char(0)); - w = 0x56; - r = c.out(m, &w, &w+1, wp, n, n+7, np); - assert(r == std::codecvt_base::ok); - assert(wp == &w+1); - assert(np == n+4); - assert(n[0] == char(0xEF)); - assert(n[1] == char(0xBB)); - assert(n[2] == char(0xBF)); - assert(n[3] == char(0x56)); - assert(n[4] == char(0x93)); - assert(n[5] == char(0x85)); - assert(n[6] == char(0x83)); - } - { - typedef std::codecvt_utf8 C; - C c; - char32_t w = 0x40003; - char n[4] = {0}; - const char32_t* wp = nullptr; - std::mbstate_t m; - char* np = nullptr; - std::codecvt_base::result r = c.out(m, &w, &w+1, wp, n, n+4, np); - assert(r == std::codecvt_base::ok); - assert(wp == &w+1); - assert(np == n+4); - assert(n[0] == char(0xF1)); - assert(n[1] == char(0x80)); - assert(n[2] == char(0x80)); - assert(n[3] == char(0x83)); - - w = 0x1005; - r = c.out(m, &w, &w+1, wp, n, n+4, np); - assert(r == std::codecvt_base::ok); - assert(wp == &w+1); - assert(np == n+3); - assert(n[0] == char(0xE1)); - assert(n[1] == char(0x80)); - assert(n[2] == char(0x85)); - assert(n[3] == char(0x83)); - - w = 0x453; - r = c.out(m, &w, &w+1, wp, n, n+4, np); - assert(r == std::codecvt_base::ok); - assert(wp == &w+1); - assert(np == n+2); - assert(n[0] == char(0xD1)); - assert(n[1] == char(0x93)); - assert(n[2] == char(0x85)); - assert(n[3] == char(0x83)); - - w = 0x56; - r = c.out(m, &w, &w+1, wp, n, n+4, np); - assert(r == std::codecvt_base::ok); - assert(wp == &w+1); - assert(np == n+1); - assert(n[0] == char(0x56)); - assert(n[1] == char(0x93)); - assert(n[2] == char(0x85)); - assert(n[3] == char(0x83)); - } - { - typedef std::codecvt_utf8 C; - C c; - char32_t w = 0x40003; - char n[4] = {0}; - const char32_t* wp = nullptr; - std::mbstate_t m; - char* np = nullptr; - std::codecvt_base::result r = c.out(m, &w, &w+1, wp, n, n+4, np); - assert(r == std::codecvt_base::error); - assert(wp == &w); - assert(np == n); - assert(n[0] == char(0)); - assert(n[1] == char(0)); - assert(n[2] == char(0)); - assert(n[3] == char(0)); - - w = 0x1005; - r = c.out(m, &w, &w+1, wp, n, n+4, np); - assert(r == std::codecvt_base::error); - assert(wp == &w); - assert(np == n); - assert(n[0] == char(0)); - assert(n[1] == char(0)); - assert(n[2] == char(0)); - assert(n[3] == char(0)); - - w = 0x453; - r = c.out(m, &w, &w+1, wp, n, n+4, np); - assert(r == std::codecvt_base::ok); - assert(wp == &w+1); - assert(np == n+2); - assert(n[0] == char(0xD1)); - assert(n[1] == char(0x93)); - assert(n[2] == char(0)); - assert(n[3] == char(0)); - - w = 0x56; - r = c.out(m, &w, &w+1, wp, n, n+4, np); - assert(r == std::codecvt_base::ok); - assert(wp == &w+1); - assert(np == n+1); - assert(n[0] == char(0x56)); - assert(n[1] == char(0x93)); - assert(n[2] == char(0)); - assert(n[3] == char(0)); - } - { - typedef std::codecvt_utf8 C; - C c; - char32_t w = 0x40003; - char n[7] = {0}; - const char32_t* wp = nullptr; - std::mbstate_t m; - char* np = nullptr; - std::codecvt_base::result r = c.out(m, &w, &w+1, wp, n, n+7, np); - assert(r == std::codecvt_base::ok); - assert(wp == &w+1); - assert(np == n+7); - assert(n[0] == char(0xEF)); - assert(n[1] == char(0xBB)); - assert(n[2] == char(0xBF)); - assert(n[3] == char(0xF1)); - assert(n[4] == char(0x80)); - assert(n[5] == char(0x80)); - assert(n[6] == char(0x83)); - - w = 0x1005; - r = c.out(m, &w, &w+1, wp, n, n+7, np); - assert(r == std::codecvt_base::ok); - assert(wp == &w+1); - assert(np == n+6); - assert(n[0] == char(0xEF)); - assert(n[1] == char(0xBB)); - assert(n[2] == char(0xBF)); - assert(n[3] == char(0xE1)); - assert(n[4] == char(0x80)); - assert(n[5] == char(0x85)); - assert(n[6] == char(0x83)); - - w = 0x453; - r = c.out(m, &w, &w+1, wp, n, n+7, np); - assert(r == std::codecvt_base::ok); - assert(wp == &w+1); - assert(np == n+5); - assert(n[0] == char(0xEF)); - assert(n[1] == char(0xBB)); - assert(n[2] == char(0xBF)); - assert(n[3] == char(0xD1)); - assert(n[4] == char(0x93)); - assert(n[5] == char(0x85)); - assert(n[6] == char(0x83)); - - w = 0x56; - r = c.out(m, &w, &w+1, wp, n, n+7, np); - assert(r == std::codecvt_base::ok); - assert(wp == &w+1); - assert(np == n+4); - assert(n[0] == char(0xEF)); - assert(n[1] == char(0xBB)); - assert(n[2] == char(0xBF)); - assert(n[3] == char(0x56)); - assert(n[4] == char(0x93)); - assert(n[5] == char(0x85)); - assert(n[6] == char(0x83)); - } - { - typedef std::codecvt_utf8 C; - C c; - char16_t w = 0x1005; - char n[4] = {0}; - const char16_t* wp = nullptr; - std::mbstate_t m; - char* np = nullptr; - std::codecvt_base::result r = c.out(m, &w, &w+1, wp, n, n+4, np); - assert(r == std::codecvt_base::ok); - assert(wp == &w+1); - assert(np == n+3); - assert(n[0] == char(0xE1)); - assert(n[1] == char(0x80)); - assert(n[2] == char(0x85)); - assert(n[3] == char(0)); - - w = 0x453; - r = c.out(m, &w, &w+1, wp, n, n+4, np); - assert(r == std::codecvt_base::ok); - assert(wp == &w+1); - assert(np == n+2); - assert(n[0] == char(0xD1)); - assert(n[1] == char(0x93)); - assert(n[2] == char(0x85)); - assert(n[3] == char(0)); - - w = 0x56; - r = c.out(m, &w, &w+1, wp, n, n+4, np); - assert(r == std::codecvt_base::ok); - assert(wp == &w+1); - assert(np == n+1); - assert(n[0] == char(0x56)); - assert(n[1] == char(0x93)); - assert(n[2] == char(0x85)); - assert(n[3] == char(0)); - } - { - typedef std::codecvt_utf8 C; - C c; - char16_t w = 0x1005; - char n[4] = {0}; - const char16_t* wp = nullptr; - std::mbstate_t m; - char* np = nullptr; - std::codecvt_base::result r = c.out(m, &w, &w+1, wp, n, n+4, np); - assert(r == std::codecvt_base::error); - assert(wp == &w); - assert(np == n); - assert(n[0] == char(0)); - assert(n[1] == char(0)); - assert(n[2] == char(0)); - assert(n[3] == char(0)); - - w = 0x453; - r = c.out(m, &w, &w+1, wp, n, n+4, np); - assert(r == std::codecvt_base::ok); - assert(wp == &w+1); - assert(np == n+2); - assert(n[0] == char(0xD1)); - assert(n[1] == char(0x93)); - assert(n[2] == char(0)); - assert(n[3] == char(0)); - - w = 0x56; - r = c.out(m, &w, &w+1, wp, n, n+4, np); - assert(r == std::codecvt_base::ok); - assert(wp == &w+1); - assert(np == n+1); - assert(n[0] == char(0x56)); - assert(n[1] == char(0x93)); - assert(n[2] == char(0)); - assert(n[3] == char(0)); - } - { - typedef std::codecvt_utf8 C; - C c; - char16_t w = 0x1005; - char n[7] = {0}; - const char16_t* wp = nullptr; - std::mbstate_t m; - char* np = nullptr; - std::codecvt_base::result r = c.out(m, &w, &w+1, wp, n, n+7, np); - assert(r == std::codecvt_base::ok); - assert(wp == &w+1); - assert(np == n+6); - assert(n[0] == char(0xEF)); - assert(n[1] == char(0xBB)); - assert(n[2] == char(0xBF)); - assert(n[3] == char(0xE1)); - assert(n[4] == char(0x80)); - assert(n[5] == char(0x85)); - assert(n[6] == char(0)); - - w = 0x453; - r = c.out(m, &w, &w+1, wp, n, n+7, np); - assert(r == std::codecvt_base::ok); - assert(wp == &w+1); - assert(np == n+5); - assert(n[0] == char(0xEF)); - assert(n[1] == char(0xBB)); - assert(n[2] == char(0xBF)); - assert(n[3] == char(0xD1)); - assert(n[4] == char(0x93)); - assert(n[5] == char(0x85)); - assert(n[6] == char(0)); - - w = 0x56; - r = c.out(m, &w, &w+1, wp, n, n+7, np); - assert(r == std::codecvt_base::ok); - assert(wp == &w+1); - assert(np == n+4); - assert(n[0] == char(0xEF)); - assert(n[1] == char(0xBB)); - assert(n[2] == char(0xBF)); - assert(n[3] == char(0x56)); - assert(n[4] == char(0x93)); - assert(n[5] == char(0x85)); - assert(n[6] == char(0)); - } + w = 0x56; + r = c.out(m, &w, &w + 1, wp, n, n + 7, np); + assert(r == std::codecvt_base::ok); + assert(wp == &w + 1); + assert(np == n + 4); + assert(n[0] == char(0xEF)); + assert(n[1] == char(0xBB)); + assert(n[2] == char(0xBF)); + assert(n[3] == char(0x56)); + assert(n[4] == char(0x93)); + assert(n[5] == char(0x85)); + assert(n[6] == char(0)); + } +} + +template +void TestHelper::test() { + { + typedef std::codecvt_utf8 C; + C c; + CharT w = 0x40003; + char n[4] = {0}; + const CharT* wp = nullptr; + std::mbstate_t m; + char* np = nullptr; + std::codecvt_base::result r = c.out(m, &w, &w + 1, wp, n, n + 4, np); + assert(r == std::codecvt_base::ok); + assert(wp == &w + 1); + assert(np == n + 4); + assert(n[0] == char(0xF1)); + assert(n[1] == char(0x80)); + assert(n[2] == char(0x80)); + assert(n[3] == char(0x83)); + + w = 0x1005; + r = c.out(m, &w, &w + 1, wp, n, n + 4, np); + assert(r == std::codecvt_base::ok); + assert(wp == &w + 1); + assert(np == n + 3); + assert(n[0] == char(0xE1)); + assert(n[1] == char(0x80)); + assert(n[2] == char(0x85)); + assert(n[3] == char(0x83)); + + w = 0x453; + r = c.out(m, &w, &w + 1, wp, n, n + 4, np); + assert(r == std::codecvt_base::ok); + assert(wp == &w + 1); + assert(np == n + 2); + assert(n[0] == char(0xD1)); + assert(n[1] == char(0x93)); + assert(n[2] == char(0x85)); + assert(n[3] == char(0x83)); + + w = 0x56; + r = c.out(m, &w, &w + 1, wp, n, n + 4, np); + assert(r == std::codecvt_base::ok); + assert(wp == &w + 1); + assert(np == n + 1); + assert(n[0] == char(0x56)); + assert(n[1] == char(0x93)); + assert(n[2] == char(0x85)); + assert(n[3] == char(0x83)); + } + { + typedef std::codecvt_utf8 C; + C c; + CharT w = 0x40003; + char n[4] = {0}; + const CharT* wp = nullptr; + std::mbstate_t m; + char* np = nullptr; + std::codecvt_base::result r = c.out(m, &w, &w + 1, wp, n, n + 4, np); + assert(r == std::codecvt_base::error); + assert(wp == &w); + assert(np == n); + assert(n[0] == char(0)); + assert(n[1] == char(0)); + assert(n[2] == char(0)); + assert(n[3] == char(0)); + + w = 0x1005; + r = c.out(m, &w, &w + 1, wp, n, n + 4, np); + assert(r == std::codecvt_base::error); + assert(wp == &w); + assert(np == n); + assert(n[0] == char(0)); + assert(n[1] == char(0)); + assert(n[2] == char(0)); + assert(n[3] == char(0)); + + w = 0x453; + r = c.out(m, &w, &w + 1, wp, n, n + 4, np); + assert(r == std::codecvt_base::ok); + assert(wp == &w + 1); + assert(np == n + 2); + assert(n[0] == char(0xD1)); + assert(n[1] == char(0x93)); + assert(n[2] == char(0)); + assert(n[3] == char(0)); + + w = 0x56; + r = c.out(m, &w, &w + 1, wp, n, n + 4, np); + assert(r == std::codecvt_base::ok); + assert(wp == &w + 1); + assert(np == n + 1); + assert(n[0] == char(0x56)); + assert(n[1] == char(0x93)); + assert(n[2] == char(0)); + assert(n[3] == char(0)); + } + { + typedef std::codecvt_utf8 C; + C c; + CharT w = 0x40003; + char n[7] = {0}; + const CharT* wp = nullptr; + std::mbstate_t m; + char* np = nullptr; + std::codecvt_base::result r = c.out(m, &w, &w + 1, wp, n, n + 7, np); + assert(r == std::codecvt_base::ok); + assert(wp == &w + 1); + assert(np == n + 7); + assert(n[0] == char(0xEF)); + assert(n[1] == char(0xBB)); + assert(n[2] == char(0xBF)); + assert(n[3] == char(0xF1)); + assert(n[4] == char(0x80)); + assert(n[5] == char(0x80)); + assert(n[6] == char(0x83)); + + w = 0x1005; + r = c.out(m, &w, &w + 1, wp, n, n + 7, np); + assert(r == std::codecvt_base::ok); + assert(wp == &w + 1); + assert(np == n + 6); + assert(n[0] == char(0xEF)); + assert(n[1] == char(0xBB)); + assert(n[2] == char(0xBF)); + assert(n[3] == char(0xE1)); + assert(n[4] == char(0x80)); + assert(n[5] == char(0x85)); + assert(n[6] == char(0x83)); + + w = 0x453; + r = c.out(m, &w, &w + 1, wp, n, n + 7, np); + assert(r == std::codecvt_base::ok); + assert(wp == &w + 1); + assert(np == n + 5); + assert(n[0] == char(0xEF)); + assert(n[1] == char(0xBB)); + assert(n[2] == char(0xBF)); + assert(n[3] == char(0xD1)); + assert(n[4] == char(0x93)); + assert(n[5] == char(0x85)); + assert(n[6] == char(0x83)); + + w = 0x56; + r = c.out(m, &w, &w + 1, wp, n, n + 7, np); + assert(r == std::codecvt_base::ok); + assert(wp == &w + 1); + assert(np == n + 4); + assert(n[0] == char(0xEF)); + assert(n[1] == char(0xBB)); + assert(n[2] == char(0xBF)); + assert(n[3] == char(0x56)); + assert(n[4] == char(0x93)); + assert(n[5] == char(0x85)); + assert(n[6] == char(0x83)); + } +} + +int main() { + TestHelper::test(); + TestHelper::test(); + TestHelper::test(); } diff --git a/test/std/localization/locale.stdcvt/codecvt_utf8_utf16_in.pass.cpp b/test/std/localization/locale.stdcvt/codecvt_utf8_utf16_in.pass.cpp index 0cd941764..392d66f22 100644 --- a/test/std/localization/locale.stdcvt/codecvt_utf8_utf16_in.pass.cpp +++ b/test/std/localization/locale.stdcvt/codecvt_utf8_utf16_in.pass.cpp @@ -25,348 +25,220 @@ #include #include -int main() -{ - { - typedef std::codecvt_utf8_utf16 C; - C c; - wchar_t w[2] = {0}; - char n[4] = {char(0xF1), char(0x80), char(0x80), char(0x83)}; - wchar_t* wp = nullptr; - std::mbstate_t m; - const char* np = nullptr; - std::codecvt_base::result r = c.in(m, n, n+4, np, w, w+2, wp); - assert(r == std::codecvt_base::ok); - assert(wp == w+2); - assert(np == n+4); - assert(w[0] == 0xD8C0); - assert(w[1] == 0xDC03); +template +struct TestHelper; +template +struct TestHelper { + static void test(); +}; +template +struct TestHelper { + static void test(); +}; - n[0] = char(0xE1); - n[1] = char(0x80); - n[2] = char(0x85); - r = c.in(m, n, n+3, np, w, w+2, wp); - assert(r == std::codecvt_base::ok); - assert(wp == w+1); - assert(np == n+3); - assert(w[0] == 0x1005); +template +void TestHelper::test() { + { + typedef std::codecvt_utf8_utf16 C; + C c; + CharT w[2] = {0}; + char n[4] = {char(0xF1), char(0x80), char(0x80), char(0x83)}; + CharT* wp = nullptr; + std::mbstate_t m; + const char* np = nullptr; + std::codecvt_base::result r = c.in(m, n, n + 4, np, w, w + 2, wp); + assert(r == std::codecvt_base::error); + assert(wp == w); + assert(np == n); - n[0] = char(0xD1); - n[1] = char(0x93); - r = c.in(m, n, n+2, np, w, w+2, wp); - assert(r == std::codecvt_base::ok); - assert(wp == w+1); - assert(np == n+2); - assert(w[0] == 0x0453); + n[0] = char(0xE1); + n[1] = char(0x80); + n[2] = char(0x85); + r = c.in(m, n, n + 3, np, w, w + 2, wp); + assert(r == std::codecvt_base::error); + assert(wp == w); + assert(np == n); - n[0] = char(0x56); - r = c.in(m, n, n+1, np, w, w+2, wp); - assert(r == std::codecvt_base::ok); - assert(wp == w+1); - assert(np == n+1); - assert(w[0] == 0x0056); - } - { - typedef std::codecvt_utf8_utf16 C; - C c; - wchar_t w[2] = {0}; - char n[4] = {char(0xF1), char(0x80), char(0x80), char(0x83)}; - wchar_t* wp = nullptr; - std::mbstate_t m; - const char* np = nullptr; - std::codecvt_base::result r = c.in(m, n, n+4, np, w, w+2, wp); - assert(r == std::codecvt_base::error); - assert(wp == w); - assert(np == n); + n[0] = char(0xD1); + n[1] = char(0x93); + r = c.in(m, n, n + 2, np, w, w + 2, wp); + assert(r == std::codecvt_base::ok); + assert(wp == w + 1); + assert(np == n + 2); + assert(w[0] == 0x0453); - n[0] = char(0xE1); - n[1] = char(0x80); - n[2] = char(0x85); - r = c.in(m, n, n+3, np, w, w+2, wp); - assert(r == std::codecvt_base::error); - assert(wp == w); - assert(np == n); + n[0] = char(0x56); + r = c.in(m, n, n + 1, np, w, w + 2, wp); + assert(r == std::codecvt_base::ok); + assert(wp == w + 1); + assert(np == n + 1); + assert(w[0] == 0x0056); + } + { + typedef std::codecvt_utf8_utf16 C; + C c; + CharT w[2] = {0}; + char n[7] = {char(0xEF), char(0xBB), char(0xBF), char(0xF1), + char(0x80), char(0x80), char(0x83)}; + CharT* wp = nullptr; + std::mbstate_t m; + const char* np = nullptr; + std::codecvt_base::result r = c.in(m, n, n + 7, np, w, w + 2, wp); + assert(r == std::codecvt_base::ok); + assert(wp == w + 2); + assert(np == n + 7); + assert(w[0] == 0xD8C0); + assert(w[1] == 0xDC03); - n[0] = char(0xD1); - n[1] = char(0x93); - r = c.in(m, n, n+2, np, w, w+2, wp); - assert(r == std::codecvt_base::ok); - assert(wp == w+1); - assert(np == n+2); - assert(w[0] == 0x0453); + n[0] = char(0xE1); + n[1] = char(0x80); + n[2] = char(0x85); + r = c.in(m, n, n + 3, np, w, w + 2, wp); + assert(r == std::codecvt_base::ok); + assert(wp == w + 1); + assert(np == n + 3); + assert(w[0] == 0x1005); - n[0] = char(0x56); - r = c.in(m, n, n+1, np, w, w+2, wp); - assert(r == std::codecvt_base::ok); - assert(wp == w+1); - assert(np == n+1); - assert(w[0] == 0x0056); - } - { - typedef std::codecvt_utf8_utf16 C; - C c; - wchar_t w[2] = {0}; - char n[7] = {char(0xEF), char(0xBB), char(0xBF), char(0xF1), char(0x80), char(0x80), char(0x83)}; - wchar_t* wp = nullptr; - std::mbstate_t m; - const char* np = nullptr; - std::codecvt_base::result r = c.in(m, n, n+7, np, w, w+2, wp); - assert(r == std::codecvt_base::ok); - assert(wp == w+2); - assert(np == n+7); - assert(w[0] == 0xD8C0); - assert(w[1] == 0xDC03); + n[0] = char(0xD1); + n[1] = char(0x93); + r = c.in(m, n, n + 2, np, w, w + 2, wp); + assert(r == std::codecvt_base::ok); + assert(wp == w + 1); + assert(np == n + 2); + assert(w[0] == 0x0453); - n[0] = char(0xE1); - n[1] = char(0x80); - n[2] = char(0x85); - r = c.in(m, n, n+3, np, w, w+2, wp); - assert(r == std::codecvt_base::ok); - assert(wp == w+1); - assert(np == n+3); - assert(w[0] == 0x1005); - - n[0] = char(0xD1); - n[1] = char(0x93); - r = c.in(m, n, n+2, np, w, w+2, wp); - assert(r == std::codecvt_base::ok); - assert(wp == w+1); - assert(np == n+2); - assert(w[0] == 0x0453); - - n[0] = char(0x56); - r = c.in(m, n, n+1, np, w, w+2, wp); - assert(r == std::codecvt_base::ok); - assert(wp == w+1); - assert(np == n+1); - assert(w[0] == 0x0056); - } - { - typedef std::codecvt_utf8_utf16 C; - C c; - char32_t w[2] = {0}; - char n[4] = {char(0xF1), char(0x80), char(0x80), char(0x83)}; - char32_t* wp = nullptr; - std::mbstate_t m; - const char* np = nullptr; - std::codecvt_base::result r = c.in(m, n, n+4, np, w, w+2, wp); - assert(r == std::codecvt_base::ok); - assert(wp == w+2); - assert(np == n+4); - assert(w[0] == 0xD8C0); - assert(w[1] == 0xDC03); - - n[0] = char(0xE1); - n[1] = char(0x80); - n[2] = char(0x85); - r = c.in(m, n, n+3, np, w, w+2, wp); - assert(r == std::codecvt_base::ok); - assert(wp == w+1); - assert(np == n+3); - assert(w[0] == 0x1005); - - n[0] = char(0xD1); - n[1] = char(0x93); - r = c.in(m, n, n+2, np, w, w+2, wp); - assert(r == std::codecvt_base::ok); - assert(wp == w+1); - assert(np == n+2); - assert(w[0] == 0x0453); - - n[0] = char(0x56); - r = c.in(m, n, n+1, np, w, w+2, wp); - assert(r == std::codecvt_base::ok); - assert(wp == w+1); - assert(np == n+1); - assert(w[0] == 0x0056); - } - { - typedef std::codecvt_utf8_utf16 C; - C c; - char32_t w[2] = {0}; - char n[4] = {char(0xF1), char(0x80), char(0x80), char(0x83)}; - char32_t* wp = nullptr; - std::mbstate_t m; - const char* np = nullptr; - std::codecvt_base::result r = c.in(m, n, n+4, np, w, w+2, wp); - assert(r == std::codecvt_base::error); - assert(wp == w); - assert(np == n); - - n[0] = char(0xE1); - n[1] = char(0x80); - n[2] = char(0x85); - r = c.in(m, n, n+3, np, w, w+2, wp); - assert(r == std::codecvt_base::error); - assert(wp == w); - assert(np == n); - - n[0] = char(0xD1); - n[1] = char(0x93); - r = c.in(m, n, n+2, np, w, w+2, wp); - assert(r == std::codecvt_base::ok); - assert(wp == w+1); - assert(np == n+2); - assert(w[0] == 0x0453); - - n[0] = char(0x56); - r = c.in(m, n, n+1, np, w, w+2, wp); - assert(r == std::codecvt_base::ok); - assert(wp == w+1); - assert(np == n+1); - assert(w[0] == 0x0056); - } - { - typedef std::codecvt_utf8_utf16 C; - C c; - char32_t w[2] = {0}; - char n[7] = {char(0xEF), char(0xBB), char(0xBF), char(0xF1), char(0x80), char(0x80), char(0x83)}; - char32_t* wp = nullptr; - std::mbstate_t m; - const char* np = nullptr; - std::codecvt_base::result r = c.in(m, n, n+7, np, w, w+2, wp); - assert(r == std::codecvt_base::ok); - assert(wp == w+2); - assert(np == n+7); - assert(w[0] == 0xD8C0); - assert(w[1] == 0xDC03); - - n[0] = char(0xE1); - n[1] = char(0x80); - n[2] = char(0x85); - r = c.in(m, n, n+3, np, w, w+2, wp); - assert(r == std::codecvt_base::ok); - assert(wp == w+1); - assert(np == n+3); - assert(w[0] == 0x1005); - - n[0] = char(0xD1); - n[1] = char(0x93); - r = c.in(m, n, n+2, np, w, w+2, wp); - assert(r == std::codecvt_base::ok); - assert(wp == w+1); - assert(np == n+2); - assert(w[0] == 0x0453); - - n[0] = char(0x56); - r = c.in(m, n, n+1, np, w, w+2, wp); - assert(r == std::codecvt_base::ok); - assert(wp == w+1); - assert(np == n+1); - assert(w[0] == 0x0056); - } - { - typedef std::codecvt_utf8_utf16 C; - C c; - char16_t w[2] = {0}; - char n[4] = {char(0xF1), char(0x80), char(0x80), char(0x83)}; - char16_t* wp = nullptr; - std::mbstate_t m; - const char* np = nullptr; - std::codecvt_base::result r = c.in(m, n, n+4, np, w, w+2, wp); - assert(r == std::codecvt_base::ok); - assert(wp == w+2); - assert(np == n+4); - assert(w[0] == 0xD8C0); - assert(w[1] == 0xDC03); - - n[0] = char(0xE1); - n[1] = char(0x80); - n[2] = char(0x85); - r = c.in(m, n, n+3, np, w, w+2, wp); - assert(r == std::codecvt_base::ok); - assert(wp == w+1); - assert(np == n+3); - assert(w[0] == 0x1005); - - n[0] = char(0xD1); - n[1] = char(0x93); - r = c.in(m, n, n+2, np, w, w+2, wp); - assert(r == std::codecvt_base::ok); - assert(wp == w+1); - assert(np == n+2); - assert(w[0] == 0x0453); - - n[0] = char(0x56); - r = c.in(m, n, n+1, np, w, w+2, wp); - assert(r == std::codecvt_base::ok); - assert(wp == w+1); - assert(np == n+1); - assert(w[0] == 0x0056); - } - { - typedef std::codecvt_utf8_utf16 C; - C c; - char16_t w[2] = {0}; - char n[4] = {char(0xF1), char(0x80), char(0x80), char(0x83)}; - char16_t* wp = nullptr; - std::mbstate_t m; - const char* np = nullptr; - std::codecvt_base::result r = c.in(m, n, n+4, np, w, w+2, wp); - assert(r == std::codecvt_base::error); - assert(wp == w); - assert(np == n); - - n[0] = char(0xE1); - n[1] = char(0x80); - n[2] = char(0x85); - r = c.in(m, n, n+3, np, w, w+2, wp); - assert(r == std::codecvt_base::error); - assert(wp == w); - assert(np == n); - - n[0] = char(0xD1); - n[1] = char(0x93); - r = c.in(m, n, n+2, np, w, w+2, wp); - assert(r == std::codecvt_base::ok); - assert(wp == w+1); - assert(np == n+2); - assert(w[0] == 0x0453); - - n[0] = char(0x56); - r = c.in(m, n, n+1, np, w, w+2, wp); - assert(r == std::codecvt_base::ok); - assert(wp == w+1); - assert(np == n+1); - assert(w[0] == 0x0056); - } - { - typedef std::codecvt_utf8_utf16 C; - C c; - char16_t w[2] = {0}; - char n[7] = {char(0xEF), char(0xBB), char(0xBF), char(0xF1), char(0x80), char(0x80), char(0x83)}; - char16_t* wp = nullptr; - std::mbstate_t m; - const char* np = nullptr; - std::codecvt_base::result r = c.in(m, n, n+7, np, w, w+2, wp); - assert(r == std::codecvt_base::ok); - assert(wp == w+2); - assert(np == n+7); - assert(w[0] == 0xD8C0); - assert(w[1] == 0xDC03); - - n[0] = char(0xE1); - n[1] = char(0x80); - n[2] = char(0x85); - r = c.in(m, n, n+3, np, w, w+2, wp); - assert(r == std::codecvt_base::ok); - assert(wp == w+1); - assert(np == n+3); - assert(w[0] == 0x1005); - - n[0] = char(0xD1); - n[1] = char(0x93); - r = c.in(m, n, n+2, np, w, w+2, wp); - assert(r == std::codecvt_base::ok); - assert(wp == w+1); - assert(np == n+2); - assert(w[0] == 0x0453); - - n[0] = char(0x56); - r = c.in(m, n, n+1, np, w, w+2, wp); - assert(r == std::codecvt_base::ok); - assert(wp == w+1); - assert(np == n+1); - assert(w[0] == 0x0056); - } + n[0] = char(0x56); + r = c.in(m, n, n + 1, np, w, w + 2, wp); + assert(r == std::codecvt_base::ok); + assert(wp == w + 1); + assert(np == n + 1); + assert(w[0] == 0x0056); + } +} + +template +void TestHelper::test() { + { + typedef std::codecvt_utf8_utf16 C; + C c; + CharT w[2] = {0}; + char n[4] = {char(0xF1), char(0x80), char(0x80), char(0x83)}; + CharT* wp = nullptr; + std::mbstate_t m; + const char* np = nullptr; + std::codecvt_base::result r = c.in(m, n, n + 4, np, w, w + 2, wp); + assert(r == std::codecvt_base::ok); + assert(wp == w + 2); + assert(np == n + 4); + assert(w[0] == 0xD8C0); + assert(w[1] == 0xDC03); + + n[0] = char(0xE1); + n[1] = char(0x80); + n[2] = char(0x85); + r = c.in(m, n, n + 3, np, w, w + 2, wp); + assert(r == std::codecvt_base::ok); + assert(wp == w + 1); + assert(np == n + 3); + assert(w[0] == 0x1005); + + n[0] = char(0xD1); + n[1] = char(0x93); + r = c.in(m, n, n + 2, np, w, w + 2, wp); + assert(r == std::codecvt_base::ok); + assert(wp == w + 1); + assert(np == n + 2); + assert(w[0] == 0x0453); + + n[0] = char(0x56); + r = c.in(m, n, n + 1, np, w, w + 2, wp); + assert(r == std::codecvt_base::ok); + assert(wp == w + 1); + assert(np == n + 1); + assert(w[0] == 0x0056); + } + { + typedef std::codecvt_utf8_utf16 C; + C c; + CharT w[2] = {0}; + char n[4] = {char(0xF1), char(0x80), char(0x80), char(0x83)}; + CharT* wp = nullptr; + std::mbstate_t m; + const char* np = nullptr; + std::codecvt_base::result r = c.in(m, n, n + 4, np, w, w + 2, wp); + assert(r == std::codecvt_base::error); + assert(wp == w); + assert(np == n); + + n[0] = char(0xE1); + n[1] = char(0x80); + n[2] = char(0x85); + r = c.in(m, n, n + 3, np, w, w + 2, wp); + assert(r == std::codecvt_base::error); + assert(wp == w); + assert(np == n); + + n[0] = char(0xD1); + n[1] = char(0x93); + r = c.in(m, n, n + 2, np, w, w + 2, wp); + assert(r == std::codecvt_base::ok); + assert(wp == w + 1); + assert(np == n + 2); + assert(w[0] == 0x0453); + + n[0] = char(0x56); + r = c.in(m, n, n + 1, np, w, w + 2, wp); + assert(r == std::codecvt_base::ok); + assert(wp == w + 1); + assert(np == n + 1); + assert(w[0] == 0x0056); + } + { + typedef std::codecvt_utf8_utf16 C; + C c; + CharT w[2] = {0}; + char n[7] = {char(0xEF), char(0xBB), char(0xBF), char(0xF1), + char(0x80), char(0x80), char(0x83)}; + CharT* wp = nullptr; + std::mbstate_t m; + const char* np = nullptr; + std::codecvt_base::result r = c.in(m, n, n + 7, np, w, w + 2, wp); + assert(r == std::codecvt_base::ok); + assert(wp == w + 2); + assert(np == n + 7); + assert(w[0] == 0xD8C0); + assert(w[1] == 0xDC03); + + n[0] = char(0xE1); + n[1] = char(0x80); + n[2] = char(0x85); + r = c.in(m, n, n + 3, np, w, w + 2, wp); + assert(r == std::codecvt_base::ok); + assert(wp == w + 1); + assert(np == n + 3); + assert(w[0] == 0x1005); + + n[0] = char(0xD1); + n[1] = char(0x93); + r = c.in(m, n, n + 2, np, w, w + 2, wp); + assert(r == std::codecvt_base::ok); + assert(wp == w + 1); + assert(np == n + 2); + assert(w[0] == 0x0453); + + n[0] = char(0x56); + r = c.in(m, n, n + 1, np, w, w + 2, wp); + assert(r == std::codecvt_base::ok); + assert(wp == w + 1); + assert(np == n + 1); + assert(w[0] == 0x0056); + } +} + +int main() { +#ifndef _WIN32 + TestHelper::test(); +#endif + TestHelper::test(); + TestHelper::test(); } diff --git a/test/std/localization/locale.stdcvt/codecvt_utf8_utf16_out.pass.cpp b/test/std/localization/locale.stdcvt/codecvt_utf8_utf16_out.pass.cpp index 29c5342e4..ced2a36a4 100644 --- a/test/std/localization/locale.stdcvt/codecvt_utf8_utf16_out.pass.cpp +++ b/test/std/localization/locale.stdcvt/codecvt_utf8_utf16_out.pass.cpp @@ -25,391 +25,285 @@ #include #include -int main() -{ - { - typedef std::codecvt_utf8_utf16 C; - C c; - wchar_t w[2] = {0xD8C0, 0xDC03}; - char n[4] = {0}; - const wchar_t* wp = nullptr; - std::mbstate_t m; - char* np = nullptr; - std::codecvt_base::result r = c.out(m, w, w+2, wp, n, n+4, np); - assert(r == std::codecvt_base::ok); - assert(wp == w+2); - assert(np == n+4); - assert(n[0] == char(0xF1)); - assert(n[1] == char(0x80)); - assert(n[2] == char(0x80)); - assert(n[3] == char(0x83)); +template +struct TestHelper; +template +struct TestHelper { + static void test(); +}; +template +struct TestHelper { + static void test(); +}; - w[0] = 0x1005; - r = c.out(m, w, w+1, wp, n, n+4, np); - assert(r == std::codecvt_base::ok); - assert(wp == w+1); - assert(np == n+3); - assert(n[0] == char(0xE1)); - assert(n[1] == char(0x80)); - assert(n[2] == char(0x85)); +template +void TestHelper::test() { + { + typedef std::codecvt_utf8_utf16 C; + C c; + CharT w[2] = {0xD8C0, 0xDC03}; + char n[4] = {0}; + const CharT* wp = nullptr; + std::mbstate_t m; + char* np = nullptr; + std::codecvt_base::result r = c.out(m, w, w + 2, wp, n, n + 4, np); + assert(r == std::codecvt_base::ok); + assert(wp == w + 2); + assert(np == n + 4); + assert(n[0] == char(0xF1)); + assert(n[1] == char(0x80)); + assert(n[2] == char(0x80)); + assert(n[3] == char(0x83)); - w[0] = 0x453; - r = c.out(m, w, w+1, wp, n, n+4, np); - assert(r == std::codecvt_base::ok); - assert(wp == w+1); - assert(np == n+2); - assert(n[0] == char(0xD1)); - assert(n[1] == char(0x93)); + w[0] = 0x1005; + r = c.out(m, w, w + 1, wp, n, n + 4, np); + assert(r == std::codecvt_base::ok); + assert(wp == w + 1); + assert(np == n + 3); + assert(n[0] == char(0xE1)); + assert(n[1] == char(0x80)); + assert(n[2] == char(0x85)); - w[0] = 0x56; - r = c.out(m, w, w+1, wp, n, n+4, np); - assert(r == std::codecvt_base::ok); - assert(wp == w+1); - assert(np == n+1); - assert(n[0] == char(0x56)); - } - { - typedef std::codecvt_utf8_utf16 C; - C c; - wchar_t w[2] = {0xD8C0, 0xDC03}; - char n[4] = {0}; - const wchar_t* wp = nullptr; - std::mbstate_t m; - char* np = nullptr; - std::codecvt_base::result r = c.out(m, w, w+2, wp, n, n+4, np); - assert(r == std::codecvt_base::error); - assert(wp == w); - assert(np == n); + w[0] = 0x453; + r = c.out(m, w, w + 1, wp, n, n + 4, np); + assert(r == std::codecvt_base::ok); + assert(wp == w + 1); + assert(np == n + 2); + assert(n[0] == char(0xD1)); + assert(n[1] == char(0x93)); - w[0] = 0x1005; - r = c.out(m, w, w+1, wp, n, n+4, np); - assert(r == std::codecvt_base::error); - assert(wp == w); - assert(np == n); + w[0] = 0x56; + r = c.out(m, w, w + 1, wp, n, n + 4, np); + assert(r == std::codecvt_base::ok); + assert(wp == w + 1); + assert(np == n + 1); + assert(n[0] == char(0x56)); + } + { + typedef std::codecvt_utf8_utf16 C; + C c; + CharT w[2] = {0xD8C0, 0xDC03}; + char n[4] = {0}; + const CharT* wp = nullptr; + std::mbstate_t m; + char* np = nullptr; + std::codecvt_base::result r = c.out(m, w, w + 2, wp, n, n + 4, np); + assert(r == std::codecvt_base::error); + assert(wp == w); + assert(np == n); - w[0] = 0x453; - r = c.out(m, w, w+1, wp, n, n+4, np); - assert(r == std::codecvt_base::ok); - assert(wp == w+1); - assert(np == n+2); - assert(n[0] == char(0xD1)); - assert(n[1] == char(0x93)); + w[0] = 0x1005; + r = c.out(m, w, w + 1, wp, n, n + 4, np); + assert(r == std::codecvt_base::error); + assert(wp == w); + assert(np == n); - w[0] = 0x56; - r = c.out(m, w, w+1, wp, n, n+4, np); - assert(r == std::codecvt_base::ok); - assert(wp == w+1); - assert(np == n+1); - assert(n[0] == char(0x56)); - } - { - typedef std::codecvt_utf8_utf16 C; - C c; - wchar_t w[2] = {0xD8C0, 0xDC03}; - char n[7] = {0}; - const wchar_t* wp = nullptr; - std::mbstate_t m; - char* np = nullptr; - std::codecvt_base::result r = c.out(m, w, w+2, wp, n, n+7, np); - assert(r == std::codecvt_base::ok); - assert(wp == w+2); - assert(np == n+7); - assert(n[0] == char(0xEF)); - assert(n[1] == char(0xBB)); - assert(n[2] == char(0xBF)); - assert(n[3] == char(0xF1)); - assert(n[4] == char(0x80)); - assert(n[5] == char(0x80)); - assert(n[6] == char(0x83)); + w[0] = 0x453; + r = c.out(m, w, w + 1, wp, n, n + 4, np); + assert(r == std::codecvt_base::ok); + assert(wp == w + 1); + assert(np == n + 2); + assert(n[0] == char(0xD1)); + assert(n[1] == char(0x93)); - w[0] = 0x1005; - r = c.out(m, w, w+1, wp, n, n+7, np); - assert(r == std::codecvt_base::ok); - assert(wp == w+1); - assert(np == n+6); - assert(n[0] == char(0xEF)); - assert(n[1] == char(0xBB)); - assert(n[2] == char(0xBF)); - assert(n[3] == char(0xE1)); - assert(n[4] == char(0x80)); - assert(n[5] == char(0x85)); + w[0] = 0x56; + r = c.out(m, w, w + 1, wp, n, n + 4, np); + assert(r == std::codecvt_base::ok); + assert(wp == w + 1); + assert(np == n + 1); + assert(n[0] == char(0x56)); + } + { + typedef std::codecvt_utf8_utf16 C; + C c; + CharT w[2] = {0xD8C0, 0xDC03}; + char n[7] = {0}; + const CharT* wp = nullptr; + std::mbstate_t m; + char* np = nullptr; + std::codecvt_base::result r = c.out(m, w, w + 2, wp, n, n + 7, np); + assert(r == std::codecvt_base::ok); + assert(wp == w + 2); + assert(np == n + 7); + assert(n[0] == char(0xEF)); + assert(n[1] == char(0xBB)); + assert(n[2] == char(0xBF)); + assert(n[3] == char(0xF1)); + assert(n[4] == char(0x80)); + assert(n[5] == char(0x80)); + assert(n[6] == char(0x83)); - w[0] = 0x453; - r = c.out(m, w, w+1, wp, n, n+7, np); - assert(r == std::codecvt_base::ok); - assert(wp == w+1); - assert(np == n+5); - assert(n[0] == char(0xEF)); - assert(n[1] == char(0xBB)); - assert(n[2] == char(0xBF)); - assert(n[3] == char(0xD1)); - assert(n[4] == char(0x93)); + w[0] = 0x1005; + r = c.out(m, w, w + 1, wp, n, n + 7, np); + assert(r == std::codecvt_base::ok); + assert(wp == w + 1); + assert(np == n + 6); + assert(n[0] == char(0xEF)); + assert(n[1] == char(0xBB)); + assert(n[2] == char(0xBF)); + assert(n[3] == char(0xE1)); + assert(n[4] == char(0x80)); + assert(n[5] == char(0x85)); - w[0] = 0x56; - r = c.out(m, w, w+1, wp, n, n+7, np); - assert(r == std::codecvt_base::ok); - assert(wp == w+1); - assert(np == n+4); - assert(n[0] == char(0xEF)); - assert(n[1] == char(0xBB)); - assert(n[2] == char(0xBF)); - assert(n[3] == char(0x56)); - } - { - typedef std::codecvt_utf8_utf16 C; - C c; - char32_t w[2] = {0xD8C0, 0xDC03}; - char n[4] = {0}; - const char32_t* wp = nullptr; - std::mbstate_t m; - char* np = nullptr; - std::codecvt_base::result r = c.out(m, w, w+2, wp, n, n+4, np); - assert(r == std::codecvt_base::ok); - assert(wp == w+2); - assert(np == n+4); - assert(n[0] == char(0xF1)); - assert(n[1] == char(0x80)); - assert(n[2] == char(0x80)); - assert(n[3] == char(0x83)); + w[0] = 0x453; + r = c.out(m, w, w + 1, wp, n, n + 7, np); + assert(r == std::codecvt_base::ok); + assert(wp == w + 1); + assert(np == n + 5); + assert(n[0] == char(0xEF)); + assert(n[1] == char(0xBB)); + assert(n[2] == char(0xBF)); + assert(n[3] == char(0xD1)); + assert(n[4] == char(0x93)); - w[0] = 0x1005; - r = c.out(m, w, w+1, wp, n, n+4, np); - assert(r == std::codecvt_base::ok); - assert(wp == w+1); - assert(np == n+3); - assert(n[0] == char(0xE1)); - assert(n[1] == char(0x80)); - assert(n[2] == char(0x85)); - - w[0] = 0x453; - r = c.out(m, w, w+1, wp, n, n+4, np); - assert(r == std::codecvt_base::ok); - assert(wp == w+1); - assert(np == n+2); - assert(n[0] == char(0xD1)); - assert(n[1] == char(0x93)); - - w[0] = 0x56; - r = c.out(m, w, w+1, wp, n, n+4, np); - assert(r == std::codecvt_base::ok); - assert(wp == w+1); - assert(np == n+1); - assert(n[0] == char(0x56)); - } - { - typedef std::codecvt_utf8_utf16 C; - C c; - char32_t w[2] = {0xD8C0, 0xDC03}; - char n[4] = {0}; - const char32_t* wp = nullptr; - std::mbstate_t m; - char* np = nullptr; - std::codecvt_base::result r = c.out(m, w, w+2, wp, n, n+4, np); - assert(r == std::codecvt_base::error); - assert(wp == w); - assert(np == n); - - w[0] = 0x1005; - r = c.out(m, w, w+1, wp, n, n+4, np); - assert(r == std::codecvt_base::error); - assert(wp == w); - assert(np == n); - - w[0] = 0x453; - r = c.out(m, w, w+1, wp, n, n+4, np); - assert(r == std::codecvt_base::ok); - assert(wp == w+1); - assert(np == n+2); - assert(n[0] == char(0xD1)); - assert(n[1] == char(0x93)); - - w[0] = 0x56; - r = c.out(m, w, w+1, wp, n, n+4, np); - assert(r == std::codecvt_base::ok); - assert(wp == w+1); - assert(np == n+1); - assert(n[0] == char(0x56)); - } - { - typedef std::codecvt_utf8_utf16 C; - C c; - char32_t w[2] = {0xD8C0, 0xDC03}; - char n[7] = {0}; - const char32_t* wp = nullptr; - std::mbstate_t m; - char* np = nullptr; - std::codecvt_base::result r = c.out(m, w, w+2, wp, n, n+7, np); - assert(r == std::codecvt_base::ok); - assert(wp == w+2); - assert(np == n+7); - assert(n[0] == char(0xEF)); - assert(n[1] == char(0xBB)); - assert(n[2] == char(0xBF)); - assert(n[3] == char(0xF1)); - assert(n[4] == char(0x80)); - assert(n[5] == char(0x80)); - assert(n[6] == char(0x83)); - - w[0] = 0x1005; - r = c.out(m, w, w+1, wp, n, n+7, np); - assert(r == std::codecvt_base::ok); - assert(wp == w+1); - assert(np == n+6); - assert(n[0] == char(0xEF)); - assert(n[1] == char(0xBB)); - assert(n[2] == char(0xBF)); - assert(n[3] == char(0xE1)); - assert(n[4] == char(0x80)); - assert(n[5] == char(0x85)); - - w[0] = 0x453; - r = c.out(m, w, w+1, wp, n, n+7, np); - assert(r == std::codecvt_base::ok); - assert(wp == w+1); - assert(np == n+5); - assert(n[0] == char(0xEF)); - assert(n[1] == char(0xBB)); - assert(n[2] == char(0xBF)); - assert(n[3] == char(0xD1)); - assert(n[4] == char(0x93)); - - w[0] = 0x56; - r = c.out(m, w, w+1, wp, n, n+7, np); - assert(r == std::codecvt_base::ok); - assert(wp == w+1); - assert(np == n+4); - assert(n[0] == char(0xEF)); - assert(n[1] == char(0xBB)); - assert(n[2] == char(0xBF)); - assert(n[3] == char(0x56)); - } - - { - typedef std::codecvt_utf8_utf16 C; - C c; - char16_t w[2] = {0xD8C0, 0xDC03}; - char n[4] = {0}; - const char16_t* wp = nullptr; - std::mbstate_t m; - char* np = nullptr; - std::codecvt_base::result r = c.out(m, w, w+2, wp, n, n+4, np); - assert(r == std::codecvt_base::ok); - assert(wp == w+2); - assert(np == n+4); - assert(n[0] == char(0xF1)); - assert(n[1] == char(0x80)); - assert(n[2] == char(0x80)); - assert(n[3] == char(0x83)); - - w[0] = 0x1005; - r = c.out(m, w, w+1, wp, n, n+4, np); - assert(r == std::codecvt_base::ok); - assert(wp == w+1); - assert(np == n+3); - assert(n[0] == char(0xE1)); - assert(n[1] == char(0x80)); - assert(n[2] == char(0x85)); - - w[0] = 0x453; - r = c.out(m, w, w+1, wp, n, n+4, np); - assert(r == std::codecvt_base::ok); - assert(wp == w+1); - assert(np == n+2); - assert(n[0] == char(0xD1)); - assert(n[1] == char(0x93)); - - w[0] = 0x56; - r = c.out(m, w, w+1, wp, n, n+4, np); - assert(r == std::codecvt_base::ok); - assert(wp == w+1); - assert(np == n+1); - assert(n[0] == char(0x56)); - } - { - typedef std::codecvt_utf8_utf16 C; - C c; - char16_t w[2] = {0xD8C0, 0xDC03}; - char n[4] = {0}; - const char16_t* wp = nullptr; - std::mbstate_t m; - char* np = nullptr; - std::codecvt_base::result r = c.out(m, w, w+2, wp, n, n+4, np); - assert(r == std::codecvt_base::error); - assert(wp == w); - assert(np == n); - - w[0] = 0x1005; - r = c.out(m, w, w+1, wp, n, n+4, np); - assert(r == std::codecvt_base::error); - assert(wp == w); - assert(np == n); - - w[0] = 0x453; - r = c.out(m, w, w+1, wp, n, n+4, np); - assert(r == std::codecvt_base::ok); - assert(wp == w+1); - assert(np == n+2); - assert(n[0] == char(0xD1)); - assert(n[1] == char(0x93)); - - w[0] = 0x56; - r = c.out(m, w, w+1, wp, n, n+4, np); - assert(r == std::codecvt_base::ok); - assert(wp == w+1); - assert(np == n+1); - assert(n[0] == char(0x56)); - } - { - typedef std::codecvt_utf8_utf16 C; - C c; - char16_t w[2] = {0xD8C0, 0xDC03}; - char n[7] = {0}; - const char16_t* wp = nullptr; - std::mbstate_t m; - char* np = nullptr; - std::codecvt_base::result r = c.out(m, w, w+2, wp, n, n+7, np); - assert(r == std::codecvt_base::ok); - assert(wp == w+2); - assert(np == n+7); - assert(n[0] == char(0xEF)); - assert(n[1] == char(0xBB)); - assert(n[2] == char(0xBF)); - assert(n[3] == char(0xF1)); - assert(n[4] == char(0x80)); - assert(n[5] == char(0x80)); - assert(n[6] == char(0x83)); - - w[0] = 0x1005; - r = c.out(m, w, w+1, wp, n, n+7, np); - assert(r == std::codecvt_base::ok); - assert(wp == w+1); - assert(np == n+6); - assert(n[0] == char(0xEF)); - assert(n[1] == char(0xBB)); - assert(n[2] == char(0xBF)); - assert(n[3] == char(0xE1)); - assert(n[4] == char(0x80)); - assert(n[5] == char(0x85)); - - w[0] = 0x453; - r = c.out(m, w, w+1, wp, n, n+7, np); - assert(r == std::codecvt_base::ok); - assert(wp == w+1); - assert(np == n+5); - assert(n[0] == char(0xEF)); - assert(n[1] == char(0xBB)); - assert(n[2] == char(0xBF)); - assert(n[3] == char(0xD1)); - assert(n[4] == char(0x93)); - - w[0] = 0x56; - r = c.out(m, w, w+1, wp, n, n+7, np); - assert(r == std::codecvt_base::ok); - assert(wp == w+1); - assert(np == n+4); - assert(n[0] == char(0xEF)); - assert(n[1] == char(0xBB)); - assert(n[2] == char(0xBF)); - assert(n[3] == char(0x56)); - } + w[0] = 0x56; + r = c.out(m, w, w + 1, wp, n, n + 7, np); + assert(r == std::codecvt_base::ok); + assert(wp == w + 1); + assert(np == n + 4); + assert(n[0] == char(0xEF)); + assert(n[1] == char(0xBB)); + assert(n[2] == char(0xBF)); + assert(n[3] == char(0x56)); + } +} + +template +void TestHelper::test() { + { + typedef std::codecvt_utf8_utf16 C; + C c; + CharT w[2] = {0xD8C0, 0xDC03}; + char n[4] = {0}; + const CharT* wp = nullptr; + std::mbstate_t m; + char* np = nullptr; + std::codecvt_base::result r = c.out(m, w, w + 2, wp, n, n + 4, np); + assert(r == std::codecvt_base::ok); + assert(wp == w + 2); + assert(np == n + 4); + assert(n[0] == char(0xF1)); + assert(n[1] == char(0x80)); + assert(n[2] == char(0x80)); + assert(n[3] == char(0x83)); + + w[0] = 0x1005; + r = c.out(m, w, w + 1, wp, n, n + 4, np); + assert(r == std::codecvt_base::ok); + assert(wp == w + 1); + assert(np == n + 3); + assert(n[0] == char(0xE1)); + assert(n[1] == char(0x80)); + assert(n[2] == char(0x85)); + + w[0] = 0x453; + r = c.out(m, w, w + 1, wp, n, n + 4, np); + assert(r == std::codecvt_base::ok); + assert(wp == w + 1); + assert(np == n + 2); + assert(n[0] == char(0xD1)); + assert(n[1] == char(0x93)); + + w[0] = 0x56; + r = c.out(m, w, w + 1, wp, n, n + 4, np); + assert(r == std::codecvt_base::ok); + assert(wp == w + 1); + assert(np == n + 1); + assert(n[0] == char(0x56)); + } + { + typedef std::codecvt_utf8_utf16 C; + C c; + CharT w[2] = {0xD8C0, 0xDC03}; + char n[4] = {0}; + const CharT* wp = nullptr; + std::mbstate_t m; + char* np = nullptr; + std::codecvt_base::result r = c.out(m, w, w + 2, wp, n, n + 4, np); + assert(r == std::codecvt_base::error); + assert(wp == w); + assert(np == n); + + w[0] = 0x1005; + r = c.out(m, w, w + 1, wp, n, n + 4, np); + assert(r == std::codecvt_base::error); + assert(wp == w); + assert(np == n); + + w[0] = 0x453; + r = c.out(m, w, w + 1, wp, n, n + 4, np); + assert(r == std::codecvt_base::ok); + assert(wp == w + 1); + assert(np == n + 2); + assert(n[0] == char(0xD1)); + assert(n[1] == char(0x93)); + + w[0] = 0x56; + r = c.out(m, w, w + 1, wp, n, n + 4, np); + assert(r == std::codecvt_base::ok); + assert(wp == w + 1); + assert(np == n + 1); + assert(n[0] == char(0x56)); + } + { + typedef std::codecvt_utf8_utf16 C; + C c; + CharT w[2] = {0xD8C0, 0xDC03}; + char n[7] = {0}; + const CharT* wp = nullptr; + std::mbstate_t m; + char* np = nullptr; + std::codecvt_base::result r = c.out(m, w, w + 2, wp, n, n + 7, np); + assert(r == std::codecvt_base::ok); + assert(wp == w + 2); + assert(np == n + 7); + assert(n[0] == char(0xEF)); + assert(n[1] == char(0xBB)); + assert(n[2] == char(0xBF)); + assert(n[3] == char(0xF1)); + assert(n[4] == char(0x80)); + assert(n[5] == char(0x80)); + assert(n[6] == char(0x83)); + + w[0] = 0x1005; + r = c.out(m, w, w + 1, wp, n, n + 7, np); + assert(r == std::codecvt_base::ok); + assert(wp == w + 1); + assert(np == n + 6); + assert(n[0] == char(0xEF)); + assert(n[1] == char(0xBB)); + assert(n[2] == char(0xBF)); + assert(n[3] == char(0xE1)); + assert(n[4] == char(0x80)); + assert(n[5] == char(0x85)); + + w[0] = 0x453; + r = c.out(m, w, w + 1, wp, n, n + 7, np); + assert(r == std::codecvt_base::ok); + assert(wp == w + 1); + assert(np == n + 5); + assert(n[0] == char(0xEF)); + assert(n[1] == char(0xBB)); + assert(n[2] == char(0xBF)); + assert(n[3] == char(0xD1)); + assert(n[4] == char(0x93)); + + w[0] = 0x56; + r = c.out(m, w, w + 1, wp, n, n + 7, np); + assert(r == std::codecvt_base::ok); + assert(wp == w + 1); + assert(np == n + 4); + assert(n[0] == char(0xEF)); + assert(n[1] == char(0xBB)); + assert(n[2] == char(0xBF)); + assert(n[3] == char(0x56)); + } +} + +int main() { +#ifndef _WIN32 + TestHelper::test(); +#endif + TestHelper::test(); + TestHelper::test(); } diff --git a/test/std/localization/locales/locale.convenience/conversions/conversions.string/converted.pass.cpp b/test/std/localization/locales/locale.convenience/conversions/conversions.string/converted.pass.cpp index 06df18575..480628f70 100644 --- a/test/std/localization/locales/locale.convenience/conversions/conversions.string/converted.pass.cpp +++ b/test/std/localization/locales/locale.convenience/conversions/conversions.string/converted.pass.cpp @@ -17,9 +17,39 @@ #include #include -int main() -{ - typedef std::codecvt_utf8 Codecvt; +template +struct TestHelper; +template +struct TestHelper { + static void test(); +}; +template +struct TestHelper { + static void test(); +}; + +template +void TestHelper::test() { + static_assert((std::is_same::value), ""); + { + typedef std::codecvt_utf8 Codecvt; + typedef std::wstring_convert Myconv; + Myconv myconv; + assert(myconv.converted() == 0); + std::string bs = myconv.to_bytes(L"\x1005"); + assert(myconv.converted() == 1); + bs = myconv.to_bytes(L"\x1005\x65"); + assert(myconv.converted() == 2); + std::wstring ws = myconv.from_bytes("\xE1\x80\x85"); + assert(myconv.converted() == 3); + } +} + +template +void TestHelper::test() { + static_assert((std::is_same::value), ""); + { + typedef std::codecvt_utf8 Codecvt; typedef std::wstring_convert Myconv; Myconv myconv; assert(myconv.converted() == 0); @@ -29,4 +59,7 @@ int main() assert(myconv.converted() == 2); std::wstring ws = myconv.from_bytes("\xF1\x80\x80\x83"); assert(myconv.converted() == 4); + } } + +int main() { TestHelper::test(); } diff --git a/test/std/localization/locales/locale.convenience/conversions/conversions.string/from_bytes.pass.cpp b/test/std/localization/locales/locale.convenience/conversions/conversions.string/from_bytes.pass.cpp index 8705a5f3b..2e627b739 100644 --- a/test/std/localization/locales/locale.convenience/conversions/conversions.string/from_bytes.pass.cpp +++ b/test/std/localization/locales/locale.convenience/conversions/conversions.string/from_bytes.pass.cpp @@ -20,20 +20,53 @@ #include #include -int main() -{ - { - std::wstring_convert > myconv; - std::string bs("\xF1\x80\x80\x83"); - std::wstring ws = myconv.from_bytes('a'); - assert(ws == L"a"); - ws = myconv.from_bytes(bs.c_str()); - assert(ws == L"\x40003"); - ws = myconv.from_bytes(bs); - assert(ws == L"\x40003"); - ws = myconv.from_bytes(bs.data(), bs.data() + bs.size()); - assert(ws == L"\x40003"); - ws = myconv.from_bytes(""); - assert(ws.size() == 0); - } +template +struct TestHelper; +template +struct TestHelper { + static void test(); +}; +template +struct TestHelper { + static void test(); +}; + +template +void TestHelper::test() { + static_assert((std::is_same::value), ""); + { + std::wstring_convert > myconv; + std::string bs("\xE1\x80\x85\x00"); + std::wstring ws = myconv.from_bytes('a'); + assert(ws == L"a"); + ws = myconv.from_bytes(bs.c_str()); + assert(ws == L"\x1005"); + ws = myconv.from_bytes(bs); + assert(ws == L"\x1005"); + ws = myconv.from_bytes(bs.data(), bs.data() + bs.size()); + assert(ws == L"\x1005"); + ws = myconv.from_bytes(""); + assert(ws.size() == 0); + } } + +template +void TestHelper::test() { + static_assert((std::is_same::value), ""); + { + std::wstring_convert > myconv; + std::string bs("\xF1\x80\x80\x83"); + std::wstring ws = myconv.from_bytes('a'); + assert(ws == L"a"); + ws = myconv.from_bytes(bs.c_str()); + assert(ws == L"\x40003"); + ws = myconv.from_bytes(bs); + assert(ws == L"\x40003"); + ws = myconv.from_bytes(bs.data(), bs.data() + bs.size()); + assert(ws == L"\x40003"); + ws = myconv.from_bytes(""); + assert(ws.size() == 0); + } +} + +int main() { TestHelper::test(); } diff --git a/test/std/localization/locales/locale.convenience/conversions/conversions.string/to_bytes.pass.cpp b/test/std/localization/locales/locale.convenience/conversions/conversions.string/to_bytes.pass.cpp index 7253a18a7..0a6cab73b 100644 --- a/test/std/localization/locales/locale.convenience/conversions/conversions.string/to_bytes.pass.cpp +++ b/test/std/localization/locales/locale.convenience/conversions/conversions.string/to_bytes.pass.cpp @@ -20,20 +20,53 @@ #include #include -int main() -{ - { - std::wstring_convert > myconv; - std::wstring ws(1, L'\x40003'); - std::string bs = myconv.to_bytes(ws[0]); - assert(bs == "\xF1\x80\x80\x83"); - bs = myconv.to_bytes(ws.c_str()); - assert(bs == "\xF1\x80\x80\x83"); - bs = myconv.to_bytes(ws); - assert(bs == "\xF1\x80\x80\x83"); - bs = myconv.to_bytes(ws.data(), ws.data() + ws.size()); - assert(bs == "\xF1\x80\x80\x83"); - bs = myconv.to_bytes(L""); - assert(bs.size() == 0); - } +template +struct TestHelper; +template +struct TestHelper { + static void test(); +}; +template +struct TestHelper { + static void test(); +}; + +template +void TestHelper::test() { + static_assert((std::is_same::value), ""); + { + std::wstring_convert > myconv; + std::wstring ws(1, CharT(0x1005)); + std::string bs = myconv.to_bytes(ws[0]); + assert(bs == "\xE1\x80\x85\x00"); + bs = myconv.to_bytes(ws.c_str()); + assert(bs == "\xE1\x80\x85\x00"); + bs = myconv.to_bytes(ws); + assert(bs == "\xE1\x80\x85\x00"); + bs = myconv.to_bytes(ws.data(), ws.data() + ws.size()); + assert(bs == "\xE1\x80\x85\x00"); + bs = myconv.to_bytes(L""); + assert(bs.size() == 0); + } } + +template +void TestHelper::test() { + static_assert((std::is_same::value), ""); + { + std::wstring_convert > myconv; + std::wstring ws(1, CharT(0x40003)); + std::string bs = myconv.to_bytes(ws[0]); + assert(bs == "\xF1\x80\x80\x83"); + bs = myconv.to_bytes(ws.c_str()); + assert(bs == "\xF1\x80\x80\x83"); + bs = myconv.to_bytes(ws); + assert(bs == "\xF1\x80\x80\x83"); + bs = myconv.to_bytes(ws.data(), ws.data() + ws.size()); + assert(bs == "\xF1\x80\x80\x83"); + bs = myconv.to_bytes(L""); + assert(bs.size() == 0); + } +} + +int main() { TestHelper::test(); } diff --git a/test/std/localization/locales/locale/locale.cons/locale_char_pointer_cat.pass.cpp b/test/std/localization/locales/locale/locale.cons/locale_char_pointer_cat.pass.cpp index eb381f9a5..e25fe3893 100644 --- a/test/std/localization/locales/locale/locale.cons/locale_char_pointer_cat.pass.cpp +++ b/test/std/localization/locales/locale/locale.cons/locale_char_pointer_cat.pass.cpp @@ -9,6 +9,10 @@ // REQUIRES: locale.en_US.UTF-8 // REQUIRES: locale.ru_RU.UTF-8 +// UNSUPPORTED: sanitizer-new-delete + +// XFAIL: availability_markup=macosx10.8 +// XFAIL: availability_markup=macosx10.7 // diff --git a/test/std/localization/locales/locale/locale.cons/locale_locale_cat.pass.cpp b/test/std/localization/locales/locale/locale.cons/locale_locale_cat.pass.cpp index f1afff665..72d47a391 100644 --- a/test/std/localization/locales/locale/locale.cons/locale_locale_cat.pass.cpp +++ b/test/std/localization/locales/locale/locale.cons/locale_locale_cat.pass.cpp @@ -9,6 +9,10 @@ // REQUIRES: locale.en_US.UTF-8 // REQUIRES: locale.ru_RU.UTF-8 +// UNSUPPORTED: sanitizer-new-delete + +// XFAIL: availability_markup=macosx10.8 +// XFAIL: availability_markup=macosx10.7 // diff --git a/test/std/localization/locales/locale/locale.cons/locale_string_cat.pass.cpp b/test/std/localization/locales/locale/locale.cons/locale_string_cat.pass.cpp index eb63cd03b..26ddfa600 100644 --- a/test/std/localization/locales/locale/locale.cons/locale_string_cat.pass.cpp +++ b/test/std/localization/locales/locale/locale.cons/locale_string_cat.pass.cpp @@ -9,6 +9,10 @@ // REQUIRES: locale.en_US.UTF-8 // REQUIRES: locale.ru_RU.UTF-8 +// UNSUPPORTED: sanitizer-new-delete + +// XFAIL: availability_markup=macosx10.8 +// XFAIL: availability_markup=macosx10.7 // diff --git a/test/std/localization/locales/locale/locale.types/locale.category/category.pass.cpp b/test/std/localization/locales/locale/locale.types/locale.category/category.pass.cpp index 0087f1943..8fc311a5b 100644 --- a/test/std/localization/locales/locale/locale.types/locale.category/category.pass.cpp +++ b/test/std/localization/locales/locale/locale.types/locale.category/category.pass.cpp @@ -9,8 +9,8 @@ // // This test uses new symbols that were not defined in the libc++ shipped on // darwin11 and darwin12: -// XFAIL: with_system_cxx_lib=x86_64-apple-darwin11 -// XFAIL: with_system_cxx_lib=x86_64-apple-darwin12 +// XFAIL: availability=macosx10.7 +// XFAIL: availability=macosx10.8 // diff --git a/test/std/numerics/c.math/cmath.pass.cpp b/test/std/numerics/c.math/cmath.pass.cpp index 7161bd37e..b5f586492 100644 --- a/test/std/numerics/c.math/cmath.pass.cpp +++ b/test/std/numerics/c.math/cmath.pass.cpp @@ -10,6 +10,7 @@ // #include +#include #include #include @@ -551,6 +552,13 @@ void test_signbit() static_assert((std::is_same::value), ""); static_assert((std::is_same::value), ""); assert(std::signbit(-1.0) == true); + assert(std::signbit(0u) == false); + assert(std::signbit(std::numeric_limits::max()) == false); + assert(std::signbit(0) == false); + assert(std::signbit(1) == false); + assert(std::signbit(-1) == true); + assert(std::signbit(std::numeric_limits::max()) == false); + assert(std::signbit(std::numeric_limits::min()) == true); } void test_fpclassify() @@ -564,6 +572,11 @@ void test_fpclassify() static_assert((std::is_same::value), ""); static_assert((std::is_same::value), ""); assert(std::fpclassify(-1.0) == FP_NORMAL); + assert(std::fpclassify(0) == FP_ZERO); + assert(std::fpclassify(1) == FP_NORMAL); + assert(std::fpclassify(-1) == FP_NORMAL); + assert(std::fpclassify(std::numeric_limits::max()) == FP_NORMAL); + assert(std::fpclassify(std::numeric_limits::min()) == FP_NORMAL); } void test_isfinite() @@ -577,6 +590,11 @@ void test_isfinite() static_assert((std::is_same::value), ""); static_assert((std::is_same::value), ""); assert(std::isfinite(-1.0) == true); + assert(std::isfinite(0) == true); + assert(std::isfinite(1) == true); + assert(std::isfinite(-1) == true); + assert(std::isfinite(std::numeric_limits::max()) == true); + assert(std::isfinite(std::numeric_limits::min()) == true); } void test_isnormal() @@ -590,6 +608,11 @@ void test_isnormal() static_assert((std::is_same::value), ""); static_assert((std::is_same::value), ""); assert(std::isnormal(-1.0) == true); + assert(std::isnormal(0) == false); + assert(std::isnormal(1) == true); + assert(std::isnormal(-1) == true); + assert(std::isnormal(std::numeric_limits::max()) == true); + assert(std::isnormal(std::numeric_limits::min()) == true); } void test_isgreater() @@ -651,6 +674,11 @@ void test_isinf() static_assert((std::is_same::value), ""); static_assert((std::is_same::value), ""); assert(std::isinf(-1.0) == false); + assert(std::isinf(0) == false); + assert(std::isinf(1) == false); + assert(std::isinf(-1) == false); + assert(std::isinf(std::numeric_limits::max()) == false); + assert(std::isinf(std::numeric_limits::min()) == false); } void test_isless() @@ -731,6 +759,11 @@ void test_isnan() static_assert((std::is_same::value), ""); static_assert((std::is_same::value), ""); assert(std::isnan(-1.0) == false); + assert(std::isnan(0) == false); + assert(std::isnan(1) == false); + assert(std::isnan(-1) == false); + assert(std::isnan(std::numeric_limits::max()) == false); + assert(std::isnan(std::numeric_limits::min()) == false); } void test_isunordered() diff --git a/test/std/numerics/complex.number/complex.literals/literals.pass.cpp b/test/std/numerics/complex.number/complex.literals/literals.pass.cpp index a2e53629f..8831ca1d6 100644 --- a/test/std/numerics/complex.number/complex.literals/literals.pass.cpp +++ b/test/std/numerics/complex.number/complex.literals/literals.pass.cpp @@ -14,6 +14,8 @@ #include #include +#include "test_macros.h" + int main() { using namespace std::literals::complex_literals; diff --git a/test/std/numerics/complex.number/complex.literals/literals1.fail.cpp b/test/std/numerics/complex.number/complex.literals/literals1.fail.cpp index 67e0fa131..6cc911d4e 100644 --- a/test/std/numerics/complex.number/complex.literals/literals1.fail.cpp +++ b/test/std/numerics/complex.number/complex.literals/literals1.fail.cpp @@ -12,6 +12,8 @@ #include #include +#include "test_macros.h" + int main() { std::complex foo = 1.0if; // should fail w/conversion operator not found diff --git a/test/std/numerics/complex.number/complex.members/construct.pass.cpp b/test/std/numerics/complex.number/complex.members/construct.pass.cpp index b4d870fad..25b9ce62c 100644 --- a/test/std/numerics/complex.number/complex.members/construct.pass.cpp +++ b/test/std/numerics/complex.number/complex.members/construct.pass.cpp @@ -14,6 +14,8 @@ #include #include +#include "test_macros.h" + template void test() @@ -38,7 +40,7 @@ test() assert(c.real() == 10.5); assert(c.imag() == -9.5); } -#ifndef _LIBCPP_HAS_NO_CONSTEXPR +#if TEST_STD_VER >= 11 { constexpr std::complex c; static_assert(c.real() == 0, ""); diff --git a/test/std/numerics/complex.number/complex.ops/stream_input.pass.cpp b/test/std/numerics/complex.number/complex.ops/stream_input.pass.cpp index 24644e307..4d866acb8 100644 --- a/test/std/numerics/complex.number/complex.ops/stream_input.pass.cpp +++ b/test/std/numerics/complex.number/complex.ops/stream_input.pass.cpp @@ -7,6 +7,8 @@ // //===----------------------------------------------------------------------===// +// XFAIL: with_system_cxx_lib=macosx10.7 + // // template diff --git a/test/std/numerics/complex.number/complex.special/double_float_explicit.pass.cpp b/test/std/numerics/complex.number/complex.special/double_float_explicit.pass.cpp index e8d07ce28..ac26e3c9e 100644 --- a/test/std/numerics/complex.number/complex.special/double_float_explicit.pass.cpp +++ b/test/std/numerics/complex.number/complex.special/double_float_explicit.pass.cpp @@ -18,6 +18,8 @@ #include #include +#include "test_macros.h" + int main() { { @@ -26,7 +28,7 @@ int main() assert(cf.real() == cd.real()); assert(cf.imag() == cd.imag()); } -#ifndef _LIBCPP_HAS_NO_CONSTEXPR +#if TEST_STD_VER >= 11 { constexpr std::complex cd(2.5, 3.5); constexpr std::complex cf(cd); diff --git a/test/std/numerics/complex.number/complex.special/double_float_implicit.pass.cpp b/test/std/numerics/complex.number/complex.special/double_float_implicit.pass.cpp index 298aaa3a7..3bb01ac46 100644 --- a/test/std/numerics/complex.number/complex.special/double_float_implicit.pass.cpp +++ b/test/std/numerics/complex.number/complex.special/double_float_implicit.pass.cpp @@ -18,6 +18,8 @@ #include #include +#include "test_macros.h" + int main() { { @@ -26,7 +28,7 @@ int main() assert(cf.real() == cd.real()); assert(cf.imag() == cd.imag()); } -#ifndef _LIBCPP_HAS_NO_CONSTEXPR +#if TEST_STD_VER >= 11 { constexpr std::complex cd(2.5, 3.5); constexpr std::complex cf = cd; diff --git a/test/std/numerics/complex.number/complex.special/double_long_double_explicit.pass.cpp b/test/std/numerics/complex.number/complex.special/double_long_double_explicit.pass.cpp index 6ff74a2cd..97c258024 100644 --- a/test/std/numerics/complex.number/complex.special/double_long_double_explicit.pass.cpp +++ b/test/std/numerics/complex.number/complex.special/double_long_double_explicit.pass.cpp @@ -18,6 +18,8 @@ #include #include +#include "test_macros.h" + int main() { { @@ -26,7 +28,7 @@ int main() assert(cf.real() == cd.real()); assert(cf.imag() == cd.imag()); } -#ifndef _LIBCPP_HAS_NO_CONSTEXPR +#if TEST_STD_VER >= 11 { constexpr std::complex cd(2.5, 3.5); constexpr std::complex cf(cd); diff --git a/test/std/numerics/complex.number/complex.special/float_double_explicit.pass.cpp b/test/std/numerics/complex.number/complex.special/float_double_explicit.pass.cpp index 77ca9d7f2..3027d4cdc 100644 --- a/test/std/numerics/complex.number/complex.special/float_double_explicit.pass.cpp +++ b/test/std/numerics/complex.number/complex.special/float_double_explicit.pass.cpp @@ -18,6 +18,8 @@ #include #include +#include "test_macros.h" + int main() { { @@ -26,7 +28,7 @@ int main() assert(cf.real() == cd.real()); assert(cf.imag() == cd.imag()); } -#ifndef _LIBCPP_HAS_NO_CONSTEXPR +#if TEST_STD_VER >= 11 { constexpr std::complex cd(2.5, 3.5); constexpr std::complex cf(cd); diff --git a/test/std/numerics/complex.number/complex.special/float_long_double_explicit.pass.cpp b/test/std/numerics/complex.number/complex.special/float_long_double_explicit.pass.cpp index 4fb11b4ca..515e83dfc 100644 --- a/test/std/numerics/complex.number/complex.special/float_long_double_explicit.pass.cpp +++ b/test/std/numerics/complex.number/complex.special/float_long_double_explicit.pass.cpp @@ -18,6 +18,8 @@ #include #include +#include "test_macros.h" + int main() { { @@ -26,7 +28,7 @@ int main() assert(cf.real() == cd.real()); assert(cf.imag() == cd.imag()); } -#ifndef _LIBCPP_HAS_NO_CONSTEXPR +#if TEST_STD_VER >= 11 { constexpr std::complex cd(2.5, 3.5); constexpr std::complex cf(cd); diff --git a/test/std/numerics/complex.number/complex.special/long_double_double_explicit.pass.cpp b/test/std/numerics/complex.number/complex.special/long_double_double_explicit.pass.cpp index dd10c808b..4f24a1c65 100644 --- a/test/std/numerics/complex.number/complex.special/long_double_double_explicit.pass.cpp +++ b/test/std/numerics/complex.number/complex.special/long_double_double_explicit.pass.cpp @@ -18,6 +18,8 @@ #include #include +#include "test_macros.h" + int main() { { @@ -26,7 +28,7 @@ int main() assert(cf.real() == cd.real()); assert(cf.imag() == cd.imag()); } -#ifndef _LIBCPP_HAS_NO_CONSTEXPR +#if TEST_STD_VER >= 11 { constexpr std::complex cd(2.5, 3.5); constexpr std::complex cf(cd); diff --git a/test/std/numerics/complex.number/complex.special/long_double_double_implicit.pass.cpp b/test/std/numerics/complex.number/complex.special/long_double_double_implicit.pass.cpp index aab539407..8cbd7a8a1 100644 --- a/test/std/numerics/complex.number/complex.special/long_double_double_implicit.pass.cpp +++ b/test/std/numerics/complex.number/complex.special/long_double_double_implicit.pass.cpp @@ -18,6 +18,8 @@ #include #include +#include "test_macros.h" + int main() { { @@ -26,7 +28,7 @@ int main() assert(cf.real() == cd.real()); assert(cf.imag() == cd.imag()); } -#ifndef _LIBCPP_HAS_NO_CONSTEXPR +#if TEST_STD_VER >= 11 { constexpr std::complex cd(2.5, 3.5); constexpr std::complex cf = cd; diff --git a/test/std/numerics/complex.number/complex.special/long_double_float_explicit.pass.cpp b/test/std/numerics/complex.number/complex.special/long_double_float_explicit.pass.cpp index a5f5101c4..7930548f9 100644 --- a/test/std/numerics/complex.number/complex.special/long_double_float_explicit.pass.cpp +++ b/test/std/numerics/complex.number/complex.special/long_double_float_explicit.pass.cpp @@ -18,6 +18,8 @@ #include #include +#include "test_macros.h" + int main() { { @@ -26,7 +28,7 @@ int main() assert(cf.real() == cd.real()); assert(cf.imag() == cd.imag()); } -#ifndef _LIBCPP_HAS_NO_CONSTEXPR +#if TEST_STD_VER >= 11 { constexpr std::complex cd(2.5, 3.5); constexpr std::complex cf(cd); diff --git a/test/std/numerics/complex.number/complex.special/long_double_float_implicit.pass.cpp b/test/std/numerics/complex.number/complex.special/long_double_float_implicit.pass.cpp index 25b93823f..22b9fd08a 100644 --- a/test/std/numerics/complex.number/complex.special/long_double_float_implicit.pass.cpp +++ b/test/std/numerics/complex.number/complex.special/long_double_float_implicit.pass.cpp @@ -18,6 +18,8 @@ #include #include +#include "test_macros.h" + int main() { { @@ -26,7 +28,7 @@ int main() assert(cf.real() == cd.real()); assert(cf.imag() == cd.imag()); } -#ifndef _LIBCPP_HAS_NO_CONSTEXPR +#if TEST_STD_VER >= 11 { constexpr std::complex cd(2.5, 3.5); constexpr std::complex cf = cd; diff --git a/test/std/numerics/numarray/template.valarray/valarray.assign/initializer_list_assign.pass.cpp b/test/std/numerics/numarray/template.valarray/valarray.assign/initializer_list_assign.pass.cpp index 7a671a73e..5122f44c3 100644 --- a/test/std/numerics/numarray/template.valarray/valarray.assign/initializer_list_assign.pass.cpp +++ b/test/std/numerics/numarray/template.valarray/valarray.assign/initializer_list_assign.pass.cpp @@ -7,6 +7,8 @@ // //===----------------------------------------------------------------------===// +// UNSUPPORTED: c++98, c++03 + // // template class valarray; @@ -19,7 +21,6 @@ int main() { -#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS { typedef int T; T a[] = {1, 2, 3, 4, 5}; @@ -54,5 +55,4 @@ int main() assert(v2[i][j] == a[i][j]); } } -#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS } diff --git a/test/std/numerics/numarray/template.valarray/valarray.cons/initializer_list.pass.cpp b/test/std/numerics/numarray/template.valarray/valarray.cons/initializer_list.pass.cpp index 4dfbe11bd..ce385e65c 100644 --- a/test/std/numerics/numarray/template.valarray/valarray.cons/initializer_list.pass.cpp +++ b/test/std/numerics/numarray/template.valarray/valarray.cons/initializer_list.pass.cpp @@ -7,6 +7,8 @@ // //===----------------------------------------------------------------------===// +// UNSUPPORTED: c++98, c++03 + // // template class valarray; @@ -18,7 +20,6 @@ int main() { -#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS { typedef int T; T a[] = {1, 2, 3, 4, 5}; @@ -37,5 +38,4 @@ int main() for (unsigned i = 0; i < N; ++i) assert(v[i] == a[i]); } -#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS } diff --git a/test/std/numerics/numeric.ops/numeric.ops.gcd/gcd.pass.cpp b/test/std/numerics/numeric.ops/numeric.ops.gcd/gcd.pass.cpp index 961b515ef..517a62a00 100644 --- a/test/std/numerics/numeric.ops/numeric.ops.gcd/gcd.pass.cpp +++ b/test/std/numerics/numeric.ops/numeric.ops.gcd/gcd.pass.cpp @@ -16,8 +16,10 @@ #include #include +#include +#include #include // for rand() -#include +#include constexpr struct { int x; @@ -36,21 +38,24 @@ constexpr struct { template -constexpr bool test0(Input1 in1, Input2 in2, Output out) +constexpr bool test0(int in1, int in2, int out) { - static_assert((std::is_same::value), "" ); - static_assert((std::is_same::value), "" ); - return out == std::gcd(in1, in2) ? true : (std::abort(), false); + auto value1 = static_cast(in1); + auto value2 = static_cast(in2); + static_assert(std::is_same_v, ""); + static_assert(std::is_same_v, ""); + assert(static_cast(out) == std::gcd(value1, value2)); + return true; } template constexpr bool do_test(int = 0) { - using S1 = typename std::make_signed::type; - using S2 = typename std::make_signed::type; - using U1 = typename std::make_unsigned::type; - using U2 = typename std::make_unsigned::type; + using S1 = std::make_signed_t; + using S2 = std::make_signed_t; + using U1 = std::make_unsigned_t; + using U2 = std::make_unsigned_t; bool accumulate = true; for (auto TC : Cases) { { // Test with two signed types @@ -103,15 +108,15 @@ int main() assert(do_test(non_cce)); assert(do_test(non_cce)); - static_assert(do_test< int8_t>(), ""); - static_assert(do_test(), ""); - static_assert(do_test(), ""); - static_assert(do_test(), ""); + static_assert(do_test(), ""); + static_assert(do_test(), ""); + static_assert(do_test(), ""); + static_assert(do_test(), ""); - assert(do_test< int8_t>(non_cce)); - assert(do_test(non_cce)); - assert(do_test(non_cce)); - assert(do_test(non_cce)); + assert(do_test(non_cce)); + assert(do_test(non_cce)); + assert(do_test(non_cce)); + assert(do_test(non_cce)); static_assert(do_test(), ""); static_assert(do_test(), ""); @@ -133,8 +138,8 @@ int main() // LWG#2837 { - auto res = std::gcd((int64_t)1234, (int32_t)-2147483648); - static_assert( std::is_same::type>::value, ""); - assert(res == 2); + auto res = std::gcd(static_cast(1234), INT32_MIN); + static_assert(std::is_same_v, ""); + assert(res == 2); } } diff --git a/test/std/numerics/numeric.ops/numeric.ops.lcm/lcm.pass.cpp b/test/std/numerics/numeric.ops/numeric.ops.lcm/lcm.pass.cpp index 90d48398f..6bd8a4f1e 100644 --- a/test/std/numerics/numeric.ops/numeric.ops.lcm/lcm.pass.cpp +++ b/test/std/numerics/numeric.ops/numeric.ops.lcm/lcm.pass.cpp @@ -11,12 +11,14 @@ // // template -// constexpr common_type_t<_M,_N> gcd(_M __m, _N __n) +// constexpr common_type_t<_M,_N> lcm(_M __m, _N __n) #include #include +#include +#include #include -#include +#include constexpr struct { int x; @@ -34,21 +36,24 @@ constexpr struct { }; template -constexpr bool test0(Input1 in1, Input2 in2, Output out) +constexpr bool test0(int in1, int in2, int out) { - static_assert((std::is_same::value), "" ); - static_assert((std::is_same::value), "" ); - return out == std::lcm(in1, in2) ? true : (std::abort(), false); + auto value1 = static_cast(in1); + auto value2 = static_cast(in2); + static_assert(std::is_same_v, ""); + static_assert(std::is_same_v, ""); + assert(static_cast(out) == std::lcm(value1, value2)); + return true; } template constexpr bool do_test(int = 0) { - using S1 = typename std::make_signed::type; - using S2 = typename std::make_signed::type; - using U1 = typename std::make_unsigned::type; - using U2 = typename std::make_unsigned::type; + using S1 = std::make_signed_t; + using S2 = std::make_signed_t; + using U1 = std::make_unsigned_t; + using U2 = std::make_unsigned_t; bool accumulate = true; for (auto TC : Cases) { { // Test with two signed types @@ -101,15 +106,15 @@ int main() assert(do_test(non_cce)); assert(do_test(non_cce)); - static_assert(do_test< int8_t>(), ""); - static_assert(do_test(), ""); - static_assert(do_test(), ""); - static_assert(do_test(), ""); + static_assert(do_test(), ""); + static_assert(do_test(), ""); + static_assert(do_test(), ""); + static_assert(do_test(), ""); - assert(do_test< int8_t>(non_cce)); - assert(do_test(non_cce)); - assert(do_test(non_cce)); - assert(do_test(non_cce)); + assert(do_test(non_cce)); + assert(do_test(non_cce)); + assert(do_test(non_cce)); + assert(do_test(non_cce)); static_assert(do_test(), ""); static_assert(do_test(), ""); @@ -131,9 +136,9 @@ int main() // LWG#2837 { - auto res1 = std::lcm((int64_t)1234, (int32_t)-2147483648); - (void) std::lcm(INT_MIN, 2); // this used to trigger UBSAN - static_assert( std::is_same::type>::value, ""); - assert(res1 == 1324997410816LL); + auto res1 = std::lcm(static_cast(1234), INT32_MIN); + (void)std::lcm(INT_MIN, 2UL); // this used to trigger UBSAN + static_assert(std::is_same_v, ""); + assert(res1 == 1324997410816LL); } } diff --git a/test/std/numerics/rand/rand.adapt/rand.adapt.disc/values.pass.cpp b/test/std/numerics/rand/rand.adapt/rand.adapt.disc/values.pass.cpp index f819f48b1..8cc523e2f 100644 --- a/test/std/numerics/rand/rand.adapt/rand.adapt.disc/values.pass.cpp +++ b/test/std/numerics/rand/rand.adapt/rand.adapt.disc/values.pass.cpp @@ -26,6 +26,8 @@ #include #include +#include "test_macros.h" + template void where(const _Tp &) {} diff --git a/test/std/numerics/rand/rand.adapt/rand.adapt.ibits/values.pass.cpp b/test/std/numerics/rand/rand.adapt/rand.adapt.ibits/values.pass.cpp index 187a71edc..6076f934f 100644 --- a/test/std/numerics/rand/rand.adapt/rand.adapt.ibits/values.pass.cpp +++ b/test/std/numerics/rand/rand.adapt/rand.adapt.ibits/values.pass.cpp @@ -24,6 +24,8 @@ #include #include +#include "test_macros.h" + void test1() { diff --git a/test/std/numerics/rand/rand.adapt/rand.adapt.shuf/values.pass.cpp b/test/std/numerics/rand/rand.adapt/rand.adapt.shuf/values.pass.cpp index be5b4a978..c592b6df2 100644 --- a/test/std/numerics/rand/rand.adapt/rand.adapt.shuf/values.pass.cpp +++ b/test/std/numerics/rand/rand.adapt/rand.adapt.shuf/values.pass.cpp @@ -25,6 +25,8 @@ #include #include +#include "test_macros.h" + template void where(const _Tp &) {} diff --git a/test/std/numerics/rand/rand.device/ctor.pass.cpp b/test/std/numerics/rand/rand.device/ctor.pass.cpp index 730576844..5d72e474e 100644 --- a/test/std/numerics/rand/rand.device/ctor.pass.cpp +++ b/test/std/numerics/rand/rand.device/ctor.pass.cpp @@ -7,6 +7,14 @@ // //===----------------------------------------------------------------------===// +// See bugs.llvm.org/PR20183 +// +// XFAIL: with_system_cxx_lib=macosx10.11 +// XFAIL: with_system_cxx_lib=macosx10.10 +// XFAIL: with_system_cxx_lib=macosx10.9 +// XFAIL: with_system_cxx_lib=macosx10.8 +// XFAIL: with_system_cxx_lib=macosx10.7 + // // 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 890f4caa3..b34e40c75 100644 --- a/test/std/numerics/rand/rand.device/eval.pass.cpp +++ b/test/std/numerics/rand/rand.device/eval.pass.cpp @@ -7,6 +7,14 @@ // //===----------------------------------------------------------------------===// +// See bugs.llvm.org/PR20183 +// +// XFAIL: with_system_cxx_lib=macosx10.11 +// XFAIL: with_system_cxx_lib=macosx10.10 +// XFAIL: with_system_cxx_lib=macosx10.9 +// XFAIL: with_system_cxx_lib=macosx10.8 +// XFAIL: with_system_cxx_lib=macosx10.7 + // // class random_device; diff --git a/test/std/numerics/rand/rand.dis/rand.dist.samp/rand.dist.samp.discrete/ctor_init.pass.cpp b/test/std/numerics/rand/rand.dis/rand.dist.samp/rand.dist.samp.discrete/ctor_init.pass.cpp index bc4494b98..031839317 100644 --- a/test/std/numerics/rand/rand.dis/rand.dist.samp/rand.dist.samp.discrete/ctor_init.pass.cpp +++ b/test/std/numerics/rand/rand.dis/rand.dist.samp/rand.dist.samp.discrete/ctor_init.pass.cpp @@ -7,6 +7,8 @@ // //===----------------------------------------------------------------------===// +// UNSUPPORTED: c++98, c++03 + // // template @@ -19,7 +21,6 @@ int main() { -#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS { typedef std::discrete_distribution<> D; D d = {}; @@ -77,5 +78,4 @@ int main() assert(p[1] == 0); assert(p[2] == 1); } -#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS } diff --git a/test/std/numerics/rand/rand.dis/rand.dist.samp/rand.dist.samp.discrete/param_ctor_default.pass.cpp b/test/std/numerics/rand/rand.dis/rand.dist.samp/rand.dist.samp.discrete/param_ctor_default.pass.cpp index 1071305f4..bd2a8c83d 100644 --- a/test/std/numerics/rand/rand.dis/rand.dist.samp/rand.dist.samp.discrete/param_ctor_default.pass.cpp +++ b/test/std/numerics/rand/rand.dis/rand.dist.samp/rand.dist.samp.discrete/param_ctor_default.pass.cpp @@ -7,6 +7,8 @@ // //===----------------------------------------------------------------------===// +// UNSUPPORTED: c++98, c++03 + // // template @@ -19,7 +21,6 @@ int main() { -#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS { typedef std::discrete_distribution<> D; typedef D::param_type P; @@ -28,5 +29,4 @@ int main() assert(p.size() == 1); assert(p[0] == 1); } -#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS } diff --git a/test/std/numerics/rand/rand.dis/rand.dist.samp/rand.dist.samp.discrete/param_ctor_init.pass.cpp b/test/std/numerics/rand/rand.dis/rand.dist.samp/rand.dist.samp.discrete/param_ctor_init.pass.cpp index 79d8a0b71..1144bfed3 100644 --- a/test/std/numerics/rand/rand.dis/rand.dist.samp/rand.dist.samp.discrete/param_ctor_init.pass.cpp +++ b/test/std/numerics/rand/rand.dis/rand.dist.samp/rand.dist.samp.discrete/param_ctor_init.pass.cpp @@ -7,6 +7,8 @@ // //===----------------------------------------------------------------------===// +// UNSUPPORTED: c++98, c++03 + // // template @@ -19,7 +21,6 @@ int main() { -#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS { typedef std::discrete_distribution<> D; typedef D::param_type P; @@ -84,5 +85,4 @@ int main() assert(p[1] == 0); assert(p[2] == 1); } -#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS } diff --git a/test/std/numerics/rand/rand.dis/rand.dist.samp/rand.dist.samp.pconst/ctor_default.pass.cpp b/test/std/numerics/rand/rand.dis/rand.dist.samp/rand.dist.samp.pconst/ctor_default.pass.cpp index d4f339fe7..e901afc39 100644 --- a/test/std/numerics/rand/rand.dis/rand.dist.samp/rand.dist.samp.pconst/ctor_default.pass.cpp +++ b/test/std/numerics/rand/rand.dis/rand.dist.samp/rand.dist.samp.pconst/ctor_default.pass.cpp @@ -7,6 +7,8 @@ // //===----------------------------------------------------------------------===// +// UNSUPPORTED: c++98, c++03 + // // template @@ -19,7 +21,6 @@ int main() { -#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS { typedef std::piecewise_constant_distribution<> D; D d; @@ -31,5 +32,4 @@ int main() assert(dn.size() == 1); assert(dn[0] == 1); } -#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS } diff --git a/test/std/numerics/rand/rand.dis/rand.dist.samp/rand.dist.samp.pconst/ctor_init_func.pass.cpp b/test/std/numerics/rand/rand.dis/rand.dist.samp/rand.dist.samp.pconst/ctor_init_func.pass.cpp index 5708e4509..ecc3c8922 100644 --- a/test/std/numerics/rand/rand.dis/rand.dist.samp/rand.dist.samp.pconst/ctor_init_func.pass.cpp +++ b/test/std/numerics/rand/rand.dis/rand.dist.samp/rand.dist.samp.pconst/ctor_init_func.pass.cpp @@ -7,6 +7,8 @@ // //===----------------------------------------------------------------------===// +// UNSUPPORTED: c++98, c++03 + // // template @@ -27,7 +29,6 @@ double f(double x) int main() { -#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS { typedef std::piecewise_constant_distribution<> D; D d({}, f); @@ -74,5 +75,4 @@ int main() assert(dn[0] == 0.203125); assert(dn[1] == 0.1484375); } -#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS } diff --git a/test/std/numerics/rand/rand.dis/rand.dist.samp/rand.dist.samp.pconst/param_ctor_init_func.pass.cpp b/test/std/numerics/rand/rand.dis/rand.dist.samp/rand.dist.samp.pconst/param_ctor_init_func.pass.cpp index fa6530979..c037338cd 100644 --- a/test/std/numerics/rand/rand.dis/rand.dist.samp/rand.dist.samp.pconst/param_ctor_init_func.pass.cpp +++ b/test/std/numerics/rand/rand.dis/rand.dist.samp/rand.dist.samp.pconst/param_ctor_init_func.pass.cpp @@ -7,6 +7,8 @@ // //===----------------------------------------------------------------------===// +// UNSUPPORTED: c++98, c++03 + // // template @@ -24,7 +26,6 @@ double f(double x) int main() { -#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS { typedef std::piecewise_constant_distribution<> D; typedef D::param_type P; @@ -75,5 +76,4 @@ int main() assert(dn[0] == 0.203125); assert(dn[1] == 0.1484375); } -#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS } diff --git a/test/std/numerics/rand/rand.dis/rand.dist.samp/rand.dist.samp.plinear/ctor_default.pass.cpp b/test/std/numerics/rand/rand.dis/rand.dist.samp/rand.dist.samp.plinear/ctor_default.pass.cpp index 745bd6b97..99b0f5f4b 100644 --- a/test/std/numerics/rand/rand.dis/rand.dist.samp/rand.dist.samp.plinear/ctor_default.pass.cpp +++ b/test/std/numerics/rand/rand.dis/rand.dist.samp/rand.dist.samp.plinear/ctor_default.pass.cpp @@ -7,6 +7,8 @@ // //===----------------------------------------------------------------------===// +// UNSUPPORTED: c++98, c++03 + // // template @@ -19,7 +21,6 @@ int main() { -#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS { typedef std::piecewise_linear_distribution<> D; D d; @@ -32,5 +33,4 @@ int main() assert(dn[0] == 1); assert(dn[1] == 1); } -#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS } diff --git a/test/std/numerics/rand/rand.dis/rand.dist.samp/rand.dist.samp.plinear/ctor_init_func.pass.cpp b/test/std/numerics/rand/rand.dis/rand.dist.samp/rand.dist.samp.plinear/ctor_init_func.pass.cpp index 44c76f0cf..77371de45 100644 --- a/test/std/numerics/rand/rand.dis/rand.dist.samp/rand.dist.samp.plinear/ctor_init_func.pass.cpp +++ b/test/std/numerics/rand/rand.dis/rand.dist.samp/rand.dist.samp.plinear/ctor_init_func.pass.cpp @@ -7,6 +7,8 @@ // //===----------------------------------------------------------------------===// +// UNSUPPORTED: c++98, c++03 + // // template @@ -27,7 +29,6 @@ double f(double x) int main() { -#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS { typedef std::piecewise_linear_distribution<> D; D d({}, f); @@ -78,5 +79,4 @@ int main() assert(dn[1] == 0.125); assert(dn[2] == 0.175); } -#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS } diff --git a/test/std/numerics/rand/rand.dis/rand.dist.samp/rand.dist.samp.plinear/param_ctor_init_func.pass.cpp b/test/std/numerics/rand/rand.dis/rand.dist.samp/rand.dist.samp.plinear/param_ctor_init_func.pass.cpp index cfa416434..518a4f265 100644 --- a/test/std/numerics/rand/rand.dis/rand.dist.samp/rand.dist.samp.plinear/param_ctor_init_func.pass.cpp +++ b/test/std/numerics/rand/rand.dis/rand.dist.samp/rand.dist.samp.plinear/param_ctor_init_func.pass.cpp @@ -7,6 +7,8 @@ // //===----------------------------------------------------------------------===// +// UNSUPPORTED: c++98, c++03 + // // template @@ -24,7 +26,6 @@ double f(double x) int main() { -#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS { typedef std::piecewise_linear_distribution<> D; typedef D::param_type P; @@ -79,5 +80,4 @@ int main() assert(dn[1] == 0.125); assert(dn[2] == 0.175); } -#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS } diff --git a/test/std/numerics/rand/rand.eng/rand.eng.lcong/values.pass.cpp b/test/std/numerics/rand/rand.eng/rand.eng.lcong/values.pass.cpp index cd496fdbc..2080ac5f4 100644 --- a/test/std/numerics/rand/rand.eng/rand.eng.lcong/values.pass.cpp +++ b/test/std/numerics/rand/rand.eng/rand.eng.lcong/values.pass.cpp @@ -25,6 +25,8 @@ #include #include +#include "test_macros.h" + template void where(const _Tp &) {} diff --git a/test/std/numerics/rand/rand.eng/rand.eng.mers/values.pass.cpp b/test/std/numerics/rand/rand.eng/rand.eng.mers/values.pass.cpp index 3a16d62d7..f7834afd4 100644 --- a/test/std/numerics/rand/rand.eng/rand.eng.mers/values.pass.cpp +++ b/test/std/numerics/rand/rand.eng/rand.eng.mers/values.pass.cpp @@ -40,6 +40,8 @@ #include #include +#include "test_macros.h" + template void where(const _Tp &) {} diff --git a/test/std/numerics/rand/rand.eng/rand.eng.sub/values.pass.cpp b/test/std/numerics/rand/rand.eng/rand.eng.sub/values.pass.cpp index b3f12e723..6b8b4eed9 100644 --- a/test/std/numerics/rand/rand.eng/rand.eng.sub/values.pass.cpp +++ b/test/std/numerics/rand/rand.eng/rand.eng.sub/values.pass.cpp @@ -28,6 +28,8 @@ #include #include +#include "test_macros.h" + template void where(const _Tp &) {} diff --git a/test/std/numerics/rand/rand.util/rand.util.seedseq/initializer_list.pass.cpp b/test/std/numerics/rand/rand.util/rand.util.seedseq/initializer_list.pass.cpp index d4ee9c14d..c0921d913 100644 --- a/test/std/numerics/rand/rand.util/rand.util.seedseq/initializer_list.pass.cpp +++ b/test/std/numerics/rand/rand.util/rand.util.seedseq/initializer_list.pass.cpp @@ -7,6 +7,8 @@ // //===----------------------------------------------------------------------===// +// UNSUPPORTED: c++98, c++03 + // // class seed_seq; @@ -19,7 +21,6 @@ int main() { -#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS std::seed_seq s= {5, 4, 3, 2, 1}; assert(s.size() == 5); unsigned b[5] = {0}; @@ -29,5 +30,4 @@ int main() assert(b[2] == 3); assert(b[3] == 2); assert(b[4] == 1); -#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS } diff --git a/test/std/re/re.alg/re.alg.match/awk.pass.cpp b/test/std/re/re.alg/re.alg.match/awk.pass.cpp index f86692979..4fc1ea7fe 100644 --- a/test/std/re/re.alg/re.alg.match/awk.pass.cpp +++ b/test/std/re/re.alg/re.alg.match/awk.pass.cpp @@ -26,7 +26,8 @@ int main() { -/* { +#if 0 + { std::cmatch m; const char s[] = "a"; assert(std::regex_match(s, m, std::regex("a", std::regex_constants::awk))); @@ -263,7 +264,7 @@ int main() assert(!m.suffix().matched); assert(m.suffix().first == m[0].second); assert(m.suffix().second == m[0].second); - assert(m.length(0) == std::char_traits::length(s)); + assert((size_t)m.length(0) == std::char_traits::length(s)); assert(m.position(0) == 0); assert(m.str(0) == s); } @@ -278,7 +279,7 @@ int main() assert(!m.suffix().matched); assert(m.suffix().first == m[0].second); assert(m.suffix().second == m[0].second); - assert(m.length(0) == std::char_traits::length(s)); + assert((size_t)m.length(0) == std::char_traits::length(s)); assert(m.position(0) == 0); assert(m.str(0) == s); } @@ -293,7 +294,7 @@ int main() assert(!m.suffix().matched); assert(m.suffix().first == m[0].second); assert(m.suffix().second == m[0].second); - assert(m.length(0) == std::char_traits::length(s)); + assert((size_t)m.length(0) == std::char_traits::length(s)); assert(m.position(0) == 0); assert(m.str(0) == s); } @@ -326,7 +327,7 @@ int main() assert(!m.suffix().matched); assert(m.suffix().first == m[0].second); assert(m.suffix().second == m[0].second); - assert(m.length(0) == std::char_traits::length(s)); + assert((size_t)m.length(0) == std::char_traits::length(s)); assert(m.position(0) == 0); assert(m.str(0) == s); } @@ -341,7 +342,7 @@ int main() assert(!m.suffix().matched); assert(m.suffix().first == m[0].second); assert(m.suffix().second == m[0].second); - assert(m.length(0) == std::char_traits::length(s)); + assert((size_t)m.length(0) == std::char_traits::length(s)); assert(m.position(0) == 0); assert(m.str(0) == s); } @@ -356,7 +357,7 @@ int main() assert(!m.suffix().matched); assert(m.suffix().first == m[0].second); assert(m.suffix().second == m[0].second); - assert(m.length(0) == std::char_traits::length(s)); + assert((size_t)m.length(0) == std::char_traits::length(s)); assert(m.position(0) == 0); assert(m.str(0) == s); } @@ -378,7 +379,7 @@ int main() assert(!m.suffix().matched); assert(m.suffix().first == m[0].second); assert(m.suffix().second == m[0].second); - assert(m.length(0) == std::char_traits::length(s)); + assert((size_t)m.length(0) == std::char_traits::length(s)); assert(m.position(0) == 0); assert(m.str(0) == s); } @@ -394,7 +395,7 @@ int main() assert(!m.suffix().matched); assert(m.suffix().first == m[0].second); assert(m.suffix().second == m[0].second); - assert(m.length(0) == std::char_traits::length(s)); + assert((size_t)m.length(0) == std::char_traits::length(s)); assert(m.position(0) == 0); assert(m.str(0) == s); } @@ -410,7 +411,7 @@ int main() assert(!m.suffix().matched); assert(m.suffix().first == m[0].second); assert(m.suffix().second == m[0].second); - assert(m.length(0) == std::char_traits::length(s)); + assert((size_t)m.length(0) == std::char_traits::length(s)); assert(m.position(0) == 0); assert(m.str(0) == s); assert(m.length(1) == 4); @@ -434,7 +435,7 @@ int main() assert(!m.suffix().matched); assert(m.suffix().first == m[0].second); assert(m.suffix().second == m[0].second); - assert(m.length(0) == std::char_traits::length(s)); + assert((size_t)m.length(0) == std::char_traits::length(s)); assert(m.position(0) == 0); assert(m.str(0) == s); } @@ -519,7 +520,7 @@ int main() assert(!m.suffix().matched); assert(m.suffix().first == m[0].second); assert(m.suffix().second == m[0].second); - assert(m.length(0) == std::char_traits::length(s)); + assert((size_t)m.length(0) == std::char_traits::length(s)); assert(m.position(0) == 0); assert(m.str(0) == s); } @@ -542,7 +543,7 @@ int main() assert(!m.suffix().matched); assert(m.suffix().first == m[0].second); assert(m.suffix().second == m[0].second); - assert(m.length(0) == std::char_traits::length(s)); + assert((size_t)m.length(0) == std::char_traits::length(s)); assert(m.position(0) == 0); assert(m.str(0) == s); } @@ -572,7 +573,7 @@ int main() assert(!m.suffix().matched); assert(m.suffix().first == m[0].second); assert(m.suffix().second == m[0].second); - assert(m.length(0) == std::char_traits::length(s)); + assert((size_t)m.length(0) == std::char_traits::length(s)); assert(m.position(0) == 0); assert(m.str(0) == s); } @@ -588,7 +589,7 @@ int main() assert(!m.suffix().matched); assert(m.suffix().first == m[0].second); assert(m.suffix().second == m[0].second); - assert(m.length(0) == std::char_traits::length(s)); + assert((size_t)m.length(0) == std::char_traits::length(s)); assert(m.position(0) == 0); assert(m.str(0) == s); } @@ -604,7 +605,7 @@ int main() assert(!m.suffix().matched); assert(m.suffix().first == m[0].second); assert(m.suffix().second == m[0].second); - assert(m.length(0) == std::char_traits::length(s)); + assert((size_t)m.length(0) == std::char_traits::length(s)); assert(m.position(0) == 0); assert(m.str(0) == s); } @@ -616,24 +617,23 @@ int main() assert(m.size() == 0); } std::locale::global(std::locale(LOCALE_cs_CZ_ISO8859_2)); -*/ { - /* + { std::cmatch m; const char s[] = "m"; - assert(std::regex_match(s, m, std::regex("[a[=M=]z]", - std::regex_constants::awk); - assert(m.size() == 1); + assert(std::regex_match(s, m, + std::regex("[a[=M=]z]", std::regex_constants::awk))); + assert(m.size() == 1); assert(!m.prefix().matched); assert(m.prefix().first == s); assert(m.prefix().second == m[0].first); assert(!m.suffix().matched); assert(m.suffix().first == m[0].second); assert(m.suffix().second == m[0].second); - assert(m.length(0) == std::char_traits::length(s)); + assert((size_t)m.length(0) == std::char_traits::length(s)); assert(m.position(0) == 0); assert(m.str(0) == s); -*/ } -/* { + } + { std::cmatch m; const char s[] = "Ch"; assert(std::regex_match(s, m, std::regex("[a[.ch.]z]", @@ -645,7 +645,7 @@ int main() assert(!m.suffix().matched); assert(m.suffix().first == m[0].second); assert(m.suffix().second == m[0].second); - assert(m.length(0) == std::char_traits::length(s)); + assert((size_t)m.length(0) == std::char_traits::length(s)); assert(m.position(0) == 0); assert(m.str(0) == s); } @@ -688,7 +688,7 @@ int main() assert(!m.suffix().matched); assert(m.suffix().first == m[0].second); assert(m.suffix().second == m[0].second); - assert(m.length(0) == 4); + assert((size_t)m.length(0) == 4); assert(m.position(0) == 0); assert(m.str(0) == s); } @@ -704,7 +704,7 @@ int main() assert(!m.suffix().matched); assert(m.suffix().first == m[0].second); assert(m.suffix().second == s + std::char_traits::length(s)); - assert(m.length(0) == std::char_traits::length(s)); + assert((size_t)m.length(0) == std::char_traits::length(s)); assert(m.position(0) == 0); assert(m.str(0) == s); } @@ -720,7 +720,7 @@ int main() assert(!m.suffix().matched); assert(m.suffix().first == m[0].second); assert(m.suffix().second == s+1); - assert(m.length(0) == 1); + assert((size_t)m.length(0) == 1); assert(m.position(0) == 0); assert(m.str(0) == L"a"); } @@ -735,7 +735,7 @@ int main() assert(!m.suffix().matched); assert(m.suffix().first == m[0].second); assert(m.suffix().second == s+2); - assert(m.length(0) == 2); + assert((size_t)m.length(0) == 2); assert(m.position(0) == 0); assert(m.str(0) == L"ab"); } @@ -945,7 +945,7 @@ int main() assert(!m.suffix().matched); assert(m.suffix().first == m[0].second); assert(m.suffix().second == m[0].second); - assert(m.length(0) == std::char_traits::length(s)); + assert((size_t)m.length(0) == std::char_traits::length(s)); assert(m.position(0) == 0); assert(m.str(0) == s); } @@ -960,7 +960,7 @@ int main() assert(!m.suffix().matched); assert(m.suffix().first == m[0].second); assert(m.suffix().second == m[0].second); - assert(m.length(0) == std::char_traits::length(s)); + assert((size_t)m.length(0) == std::char_traits::length(s)); assert(m.position(0) == 0); assert(m.str(0) == s); } @@ -975,7 +975,7 @@ int main() assert(!m.suffix().matched); assert(m.suffix().first == m[0].second); assert(m.suffix().second == m[0].second); - assert(m.length(0) == std::char_traits::length(s)); + assert((size_t)m.length(0) == std::char_traits::length(s)); assert(m.position(0) == 0); assert(m.str(0) == s); } @@ -1008,7 +1008,7 @@ int main() assert(!m.suffix().matched); assert(m.suffix().first == m[0].second); assert(m.suffix().second == m[0].second); - assert(m.length(0) == std::char_traits::length(s)); + assert((size_t)m.length(0) == std::char_traits::length(s)); assert(m.position(0) == 0); assert(m.str(0) == s); } @@ -1023,7 +1023,7 @@ int main() assert(!m.suffix().matched); assert(m.suffix().first == m[0].second); assert(m.suffix().second == m[0].second); - assert(m.length(0) == std::char_traits::length(s)); + assert((size_t)m.length(0) == std::char_traits::length(s)); assert(m.position(0) == 0); assert(m.str(0) == s); } @@ -1038,7 +1038,7 @@ int main() assert(!m.suffix().matched); assert(m.suffix().first == m[0].second); assert(m.suffix().second == m[0].second); - assert(m.length(0) == std::char_traits::length(s)); + assert((size_t)m.length(0) == std::char_traits::length(s)); assert(m.position(0) == 0); assert(m.str(0) == s); } @@ -1060,7 +1060,7 @@ int main() assert(!m.suffix().matched); assert(m.suffix().first == m[0].second); assert(m.suffix().second == m[0].second); - assert(m.length(0) == std::char_traits::length(s)); + assert((size_t)m.length(0) == std::char_traits::length(s)); assert(m.position(0) == 0); assert(m.str(0) == s); } @@ -1076,7 +1076,7 @@ int main() assert(!m.suffix().matched); assert(m.suffix().first == m[0].second); assert(m.suffix().second == m[0].second); - assert(m.length(0) == std::char_traits::length(s)); + assert((size_t)m.length(0) == std::char_traits::length(s)); assert(m.position(0) == 0); assert(m.str(0) == s); } @@ -1092,7 +1092,7 @@ int main() assert(!m.suffix().matched); assert(m.suffix().first == m[0].second); assert(m.suffix().second == m[0].second); - assert(m.length(0) == std::char_traits::length(s)); + assert((size_t)m.length(0) == std::char_traits::length(s)); assert(m.position(0) == 0); assert(m.str(0) == s); assert(m.length(1) == 4); @@ -1116,7 +1116,7 @@ int main() assert(!m.suffix().matched); assert(m.suffix().first == m[0].second); assert(m.suffix().second == m[0].second); - assert(m.length(0) == std::char_traits::length(s)); + assert((size_t)m.length(0) == std::char_traits::length(s)); assert(m.position(0) == 0); assert(m.str(0) == s); } @@ -1201,7 +1201,7 @@ int main() assert(!m.suffix().matched); assert(m.suffix().first == m[0].second); assert(m.suffix().second == m[0].second); - assert(m.length(0) == std::char_traits::length(s)); + assert((size_t)m.length(0) == std::char_traits::length(s)); assert(m.position(0) == 0); assert(m.str(0) == s); } @@ -1224,7 +1224,7 @@ int main() assert(!m.suffix().matched); assert(m.suffix().first == m[0].second); assert(m.suffix().second == m[0].second); - assert(m.length(0) == std::char_traits::length(s)); + assert((size_t)m.length(0) == std::char_traits::length(s)); assert(m.position(0) == 0); assert(m.str(0) == s); } @@ -1254,7 +1254,7 @@ int main() assert(!m.suffix().matched); assert(m.suffix().first == m[0].second); assert(m.suffix().second == m[0].second); - assert(m.length(0) == std::char_traits::length(s)); + assert((size_t)m.length(0) == std::char_traits::length(s)); assert(m.position(0) == 0); assert(m.str(0) == s); } @@ -1270,7 +1270,7 @@ int main() assert(!m.suffix().matched); assert(m.suffix().first == m[0].second); assert(m.suffix().second == m[0].second); - assert(m.length(0) == std::char_traits::length(s)); + assert((size_t)m.length(0) == std::char_traits::length(s)); assert(m.position(0) == 0); assert(m.str(0) == s); } @@ -1286,7 +1286,7 @@ int main() assert(!m.suffix().matched); assert(m.suffix().first == m[0].second); assert(m.suffix().second == m[0].second); - assert(m.length(0) == std::char_traits::length(s)); + assert((size_t)m.length(0) == std::char_traits::length(s)); assert(m.position(0) == 0); assert(m.str(0) == s); } @@ -1310,7 +1310,7 @@ int main() assert(!m.suffix().matched); assert(m.suffix().first == m[0].second); assert(m.suffix().second == m[0].second); - assert(m.length(0) == std::char_traits::length(s)); + assert((size_t)m.length(0) == std::char_traits::length(s)); assert(m.position(0) == 0); assert(m.str(0) == s); } @@ -1326,7 +1326,7 @@ int main() assert(!m.suffix().matched); assert(m.suffix().first == m[0].second); assert(m.suffix().second == m[0].second); - assert(m.length(0) == std::char_traits::length(s)); + assert((size_t)m.length(0) == std::char_traits::length(s)); assert(m.position(0) == 0); assert(m.str(0) == s); } @@ -1385,8 +1385,9 @@ int main() assert(!m.suffix().matched); assert(m.suffix().first == m[0].second); assert(m.suffix().second == s + std::char_traits::length(s)); - assert(m.length(0) == std::char_traits::length(s)); + assert((size_t)m.length(0) == std::char_traits::length(s)); assert(m.position(0) == 0); assert(m.str(0) == s); } -*/} +#endif +} diff --git a/test/std/re/re.iter/re.tokiter/re.tokiter.cnstr/init.pass.cpp b/test/std/re/re.iter/re.tokiter/re.tokiter.cnstr/init.pass.cpp index 6cffc0da9..849ec4ae5 100644 --- a/test/std/re/re.iter/re.tokiter/re.tokiter.cnstr/init.pass.cpp +++ b/test/std/re/re.iter/re.tokiter/re.tokiter.cnstr/init.pass.cpp @@ -7,6 +7,8 @@ // //===----------------------------------------------------------------------===// +// UNSUPPORTED: c++98, c++03 + // // class regex_token_iterator @@ -23,7 +25,6 @@ int main() { -#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS { std::regex phone_numbers("\\d{3}-(\\d{4})"); const char phone_book[] = "start 555-1234, 555-2345, 555-3456 end"; @@ -61,5 +62,4 @@ int main() ++i; assert(i == std::cregex_token_iterator()); } -#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS } diff --git a/test/std/re/re.regex/re.regex.assign/assign.il.pass.cpp b/test/std/re/re.regex/re.regex.assign/assign.il.pass.cpp index 39c3a22ef..fcaee8c3d 100644 --- a/test/std/re/re.regex/re.regex.assign/assign.il.pass.cpp +++ b/test/std/re/re.regex/re.regex.assign/assign.il.pass.cpp @@ -7,6 +7,8 @@ // //===----------------------------------------------------------------------===// +// UNSUPPORTED: c++98, c++03 + // // template > class basic_regex; @@ -21,7 +23,6 @@ int main() { -#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS std::regex r2; r2.assign({'(', 'a', '(', '[', 'b', 'c', ']', ')', ')'}); assert(r2.flags() == std::regex::ECMAScript); @@ -30,5 +31,4 @@ int main() r2.assign({'(', 'a', '(', '[', 'b', 'c', ']', ')', ')'}, std::regex::extended); assert(r2.flags() == std::regex::extended); assert(r2.mark_count() == 2); -#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS } diff --git a/test/std/re/re.regex/re.regex.assign/il.pass.cpp b/test/std/re/re.regex/re.regex.assign/il.pass.cpp index 022170f2d..a74d9cf6e 100644 --- a/test/std/re/re.regex/re.regex.assign/il.pass.cpp +++ b/test/std/re/re.regex/re.regex.assign/il.pass.cpp @@ -7,6 +7,8 @@ // //===----------------------------------------------------------------------===// +// UNSUPPORTED: c++98, c++03 + // // template > class basic_regex; @@ -19,10 +21,8 @@ int main() { -#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS std::regex r2; r2 = {'(', 'a', '(', '[', 'b', 'c', ']', ')', ')'}; assert(r2.flags() == std::regex::ECMAScript); assert(r2.mark_count() == 2); -#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS } diff --git a/test/std/re/re.regex/re.regex.construct/il_flg.pass.cpp b/test/std/re/re.regex/re.regex.construct/il_flg.pass.cpp index c1554d6c3..87dcc8569 100644 --- a/test/std/re/re.regex/re.regex.construct/il_flg.pass.cpp +++ b/test/std/re/re.regex/re.regex.construct/il_flg.pass.cpp @@ -7,6 +7,8 @@ // //===----------------------------------------------------------------------===// +// UNSUPPORTED: c++98, c++03 + // // template > class basic_regex; @@ -18,7 +20,6 @@ #include #include "test_macros.h" -#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS void test(std::initializer_list il, std::regex_constants::syntax_option_type f, unsigned mc) @@ -28,11 +29,9 @@ test(std::initializer_list il, std::regex_constants::syntax_option_type f, assert(r.mark_count() == mc); } -#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS int main() { -#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS std::string s1("\\(a\\)"); std::string s2("\\(a[bc]\\)"); std::string s3("\\(a\\([bc]\\)\\)"); @@ -67,5 +66,4 @@ int main() test({'\\', '(', 'a', '[', 'b', 'c', ']', '\\', ')'}, std::regex_constants::egrep, 0); test({'\\', '(', 'a', '\\', '(', '[', 'b', 'c', ']', '\\', ')', '\\', ')'}, std::regex_constants::egrep, 0); test({'(', 'a', '(', '[', 'b', 'c', ']', ')', ')'}, std::regex_constants::egrep, 2); -#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS } diff --git a/test/std/re/re.traits/lookup_classname.pass.cpp b/test/std/re/re.traits/lookup_classname.pass.cpp index 2215b9043..b61f772b2 100644 --- a/test/std/re/re.traits/lookup_classname.pass.cpp +++ b/test/std/re/re.traits/lookup_classname.pass.cpp @@ -27,39 +27,61 @@ test(const char_type* A, typename std::regex_traits::char_class_type expected, bool icase = false) { + typedef typename std::regex_traits::char_class_type char_class_type; std::regex_traits t; typedef forward_iterator F; - assert(t.lookup_classname(F(A), F(A + t.length(A)), icase) == expected); + char_class_type result = t.lookup_classname(F(A), F(A + t.length(A)), icase); + assert(result == expected); +} + +template +void +test_w(const char_type* A, + typename std::regex_traits::char_class_type expected, + bool icase = false) +{ + typedef typename std::regex_traits::char_class_type char_class_type; + std::regex_traits t; + typedef forward_iterator F; + char_class_type result = t.lookup_classname(F(A), F(A + t.length(A)), icase); + assert((result & expected) == expected); + LIBCPP_ASSERT((expected | std::regex_traits::__regex_word) == result); + + const bool matches_underscore = t.isctype('_', result); + if (result != expected) + assert(matches_underscore && "expected to match underscore"); + else + assert(!matches_underscore && "should not match underscore"); } int main() { // if __regex_word is not distinct from all the classes, bad things happen // See https://bugs.llvm.org/show_bug.cgi?id=26476 for an example. - assert((std::ctype_base::space & std::regex_traits::__regex_word) == 0); - assert((std::ctype_base::print & std::regex_traits::__regex_word) == 0); - assert((std::ctype_base::cntrl & std::regex_traits::__regex_word) == 0); - assert((std::ctype_base::upper & std::regex_traits::__regex_word) == 0); - assert((std::ctype_base::lower & std::regex_traits::__regex_word) == 0); - assert((std::ctype_base::alpha & std::regex_traits::__regex_word) == 0); - assert((std::ctype_base::digit & std::regex_traits::__regex_word) == 0); - assert((std::ctype_base::punct & std::regex_traits::__regex_word) == 0); - assert((std::ctype_base::xdigit & std::regex_traits::__regex_word) == 0); - assert((std::ctype_base::blank & std::regex_traits::__regex_word) == 0); + LIBCPP_ASSERT((std::ctype_base::space & std::regex_traits::__regex_word) == 0); + LIBCPP_ASSERT((std::ctype_base::print & std::regex_traits::__regex_word) == 0); + LIBCPP_ASSERT((std::ctype_base::cntrl & std::regex_traits::__regex_word) == 0); + LIBCPP_ASSERT((std::ctype_base::upper & std::regex_traits::__regex_word) == 0); + LIBCPP_ASSERT((std::ctype_base::lower & std::regex_traits::__regex_word) == 0); + LIBCPP_ASSERT((std::ctype_base::alpha & std::regex_traits::__regex_word) == 0); + LIBCPP_ASSERT((std::ctype_base::digit & std::regex_traits::__regex_word) == 0); + LIBCPP_ASSERT((std::ctype_base::punct & std::regex_traits::__regex_word) == 0); + LIBCPP_ASSERT((std::ctype_base::xdigit & std::regex_traits::__regex_word) == 0); + LIBCPP_ASSERT((std::ctype_base::blank & std::regex_traits::__regex_word) == 0); test("d", std::ctype_base::digit); test("D", std::ctype_base::digit); test("d", std::ctype_base::digit, true); test("D", std::ctype_base::digit, true); - test("w", std::regex_traits::__regex_word | std::ctype_base::alnum - | std::ctype_base::upper | std::ctype_base::lower); - test("W", std::regex_traits::__regex_word | std::ctype_base::alnum - | std::ctype_base::upper | std::ctype_base::lower); - test("w", std::regex_traits::__regex_word | std::ctype_base::alnum - | std::ctype_base::upper | std::ctype_base::lower, true); - test("W", std::regex_traits::__regex_word | std::ctype_base::alnum - | std::ctype_base::upper | std::ctype_base::lower, true); + test_w("w", std::ctype_base::alnum + | std::ctype_base::upper | std::ctype_base::lower); + test_w("W", std::ctype_base::alnum + | std::ctype_base::upper | std::ctype_base::lower); + test_w("w", std::ctype_base::alnum + | std::ctype_base::upper | std::ctype_base::lower, true); + test_w("W", std::ctype_base::alnum + | std::ctype_base::upper | std::ctype_base::lower, true); test("s", std::ctype_base::space); test("S", std::ctype_base::space); @@ -140,13 +162,13 @@ int main() test(L"d", std::ctype_base::digit, true); test(L"D", std::ctype_base::digit, true); - test(L"w", std::regex_traits::__regex_word | std::ctype_base::alnum + test_w(L"w", std::ctype_base::alnum | std::ctype_base::upper | std::ctype_base::lower); - test(L"W", std::regex_traits::__regex_word | std::ctype_base::alnum + test_w(L"W", std::ctype_base::alnum | std::ctype_base::upper | std::ctype_base::lower); - test(L"w", std::regex_traits::__regex_word | std::ctype_base::alnum + test_w(L"w", std::ctype_base::alnum | std::ctype_base::upper | std::ctype_base::lower, true); - test(L"W", std::regex_traits::__regex_word | std::ctype_base::alnum + test_w(L"W", std::ctype_base::alnum | std::ctype_base::upper | std::ctype_base::lower, true); test(L"s", std::ctype_base::space); diff --git a/test/std/re/re.traits/translate_nocase.pass.cpp b/test/std/re/re.traits/translate_nocase.pass.cpp index bf79629d3..33d365a9e 100644 --- a/test/std/re/re.traits/translate_nocase.pass.cpp +++ b/test/std/re/re.traits/translate_nocase.pass.cpp @@ -16,8 +16,8 @@ // REQUIRES: locale.en_US.UTF-8 -// XFAIL: with_system_cxx_lib=x86_64-apple-darwin11 -// XFAIL: with_system_cxx_lib=x86_64-apple-darwin12 +// XFAIL: with_system_cxx_lib=macosx10.7 +// XFAIL: with_system_cxx_lib=macosx10.8 // TODO: investigation needed // XFAIL: linux-gnu diff --git a/test/std/strings/basic.string.hash/strings.pass.cpp b/test/std/strings/basic.string.hash/strings.pass.cpp index 5fc32c06a..d74e48575 100644 --- a/test/std/strings/basic.string.hash/strings.pass.cpp +++ b/test/std/strings/basic.string.hash/strings.pass.cpp @@ -22,6 +22,8 @@ #include #include +#include "test_macros.h" + template void test() @@ -29,6 +31,8 @@ test() typedef std::hash H; static_assert((std::is_same::value), "" ); static_assert((std::is_same::value), "" ); + ASSERT_NOEXCEPT(H()(T())); + H h; std::string g1 = "1234567890"; std::string g2 = "1234567891"; 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 59267f245..f36f53e65 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 @@ -8,6 +8,12 @@ //===----------------------------------------------------------------------===// // UNSUPPORTED: libcpp-no-exceptions +// XFAIL: with_system_cxx_lib=macosx10.11 +// XFAIL: with_system_cxx_lib=macosx10.10 +// XFAIL: with_system_cxx_lib=macosx10.9 +// XFAIL: with_system_cxx_lib=macosx10.8 +// XFAIL: with_system_cxx_lib=macosx10.7 + // // size_type max_size() const; diff --git a/test/std/strings/basic.string/string.cons/T_size_size.pass.cpp b/test/std/strings/basic.string/string.cons/T_size_size.pass.cpp index 312e4d27f..67ac43494 100644 --- a/test/std/strings/basic.string/string.cons/T_size_size.pass.cpp +++ b/test/std/strings/basic.string/string.cons/T_size_size.pass.cpp @@ -27,16 +27,17 @@ template void -test(SV sv, unsigned pos, unsigned n) +test(SV sv, std::size_t pos, std::size_t n) { typedef typename S::traits_type T; typedef typename S::allocator_type A; + typedef typename S::size_type Size; if (pos <= sv.size()) { - S s2(sv, pos, n); + S s2(sv, static_cast(pos), static_cast(n)); LIBCPP_ASSERT(s2.__invariants()); assert(pos <= sv.size()); - unsigned rlen = std::min(sv.size() - pos, n); + std::size_t rlen = std::min(sv.size() - pos, n); assert(s2.size() == rlen); assert(T::compare(s2.data(), sv.data() + pos, rlen) == 0); assert(s2.get_allocator() == A()); @@ -47,7 +48,7 @@ test(SV sv, unsigned pos, unsigned n) { try { - S s2(sv, pos, n); + S s2(sv, static_cast(pos), static_cast(n)); assert(false); } catch (std::out_of_range&) @@ -60,16 +61,16 @@ test(SV sv, unsigned pos, unsigned n) template void -test(SV sv, unsigned pos, unsigned n, const typename S::allocator_type& a) +test(SV sv, std::size_t pos, std::size_t n, const typename S::allocator_type& a) { typedef typename S::traits_type T; - typedef typename S::allocator_type A; + typedef typename S::size_type Size; if (pos <= sv.size()) { - S s2(sv, pos, n, a); + S s2(sv, static_cast(pos), static_cast(n), a); LIBCPP_ASSERT(s2.__invariants()); assert(pos <= sv.size()); - unsigned rlen = std::min(sv.size() - pos, n); + std::size_t rlen = std::min(sv.size() - pos, n); assert(s2.size() == rlen); assert(T::compare(s2.data(), sv.data() + pos, rlen) == 0); assert(s2.get_allocator() == a); @@ -80,7 +81,7 @@ test(SV sv, unsigned pos, unsigned n, const typename S::allocator_type& a) { try { - S s2(sv, pos, n, a); + S s2(sv, static_cast(pos), static_cast(n), a); assert(false); } catch (std::out_of_range&) diff --git a/test/std/strings/basic.string/string.modifiers/string_append/iterator.pass.cpp b/test/std/strings/basic.string/string.modifiers/string_append/iterator.pass.cpp index dac8860f9..b464291d4 100644 --- a/test/std/strings/basic.string/string.modifiers/string_append/iterator.pass.cpp +++ b/test/std/strings/basic.string/string.modifiers/string_append/iterator.pass.cpp @@ -204,4 +204,20 @@ int main() assert(s == "ABCD"); } + { // test with a move iterator that returns char&& + typedef forward_iterator It; + typedef std::move_iterator MoveIt; + const char p[] = "ABCD"; + std::string s; + s.append(MoveIt(It(std::begin(p))), MoveIt(It(std::end(p) - 1))); + assert(s == "ABCD"); + } + { // test with a move iterator that returns char&& + typedef const char* It; + typedef std::move_iterator MoveIt; + const char p[] = "ABCD"; + std::string s; + s.append(MoveIt(It(std::begin(p))), MoveIt(It(std::end(p) - 1))); + assert(s == "ABCD"); + } } diff --git a/test/std/strings/basic.string/string.modifiers/string_erase/iter.pass.cpp b/test/std/strings/basic.string/string.modifiers/string_erase/iter.pass.cpp index 8de5fc7ba..31add9df2 100644 --- a/test/std/strings/basic.string/string.modifiers/string_erase/iter.pass.cpp +++ b/test/std/strings/basic.string/string.modifiers/string_erase/iter.pass.cpp @@ -24,6 +24,7 @@ test(S s, typename S::difference_type pos, S expected) typename S::const_iterator p = s.begin() + pos; typename S::iterator i = s.erase(p); LIBCPP_ASSERT(s.__invariants()); + assert(s[s.size()] == typename S::value_type()); assert(s == expected); assert(i - s.begin() == pos); } diff --git a/test/std/strings/basic.string/string.modifiers/string_erase/iter_iter.pass.cpp b/test/std/strings/basic.string/string.modifiers/string_erase/iter_iter.pass.cpp index e4fe2cdfd..858d3754e 100644 --- a/test/std/strings/basic.string/string.modifiers/string_erase/iter_iter.pass.cpp +++ b/test/std/strings/basic.string/string.modifiers/string_erase/iter_iter.pass.cpp @@ -25,6 +25,7 @@ test(S s, typename S::difference_type pos, typename S::difference_type n, S expe typename S::const_iterator last = s.cbegin() + pos + n; typename S::iterator i = s.erase(first, last); LIBCPP_ASSERT(s.__invariants()); + assert(s[s.size()] == typename S::value_type()); assert(s == expected); assert(i - s.begin() == pos); } diff --git a/test/std/strings/basic.string/string.modifiers/string_erase/pop_back.pass.cpp b/test/std/strings/basic.string/string.modifiers/string_erase/pop_back.pass.cpp index 64f8e506b..8424b5429 100644 --- a/test/std/strings/basic.string/string.modifiers/string_erase/pop_back.pass.cpp +++ b/test/std/strings/basic.string/string.modifiers/string_erase/pop_back.pass.cpp @@ -23,6 +23,7 @@ test(S s, S expected) { s.pop_back(); LIBCPP_ASSERT(s.__invariants()); + assert(s[s.size()] == typename S::value_type()); assert(s == expected); } 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 eb6be202a..2c900bb31 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 @@ -29,6 +29,7 @@ test(S s, typename S::size_type pos, typename S::size_type n, S expected) { s.erase(pos, n); LIBCPP_ASSERT(s.__invariants()); + assert(s[s.size()] == typename S::value_type()); assert(s == expected); } #ifndef TEST_HAS_NO_EXCEPTIONS @@ -58,6 +59,7 @@ test(S s, typename S::size_type pos, S expected) { s.erase(pos); LIBCPP_ASSERT(s.__invariants()); + assert(s[s.size()] == typename S::value_type()); assert(s == expected); } #ifndef TEST_HAS_NO_EXCEPTIONS @@ -83,6 +85,7 @@ test(S s, S expected) { s.erase(); LIBCPP_ASSERT(s.__invariants()); + assert(s[s.size()] == typename S::value_type()); assert(s == expected); } diff --git a/test/std/strings/basic.string/string.modifiers/string_insert/iter_initializer_list.pass.cpp b/test/std/strings/basic.string/string.modifiers/string_insert/iter_initializer_list.pass.cpp index 2adf846c1..c5b7cbf9d 100644 --- a/test/std/strings/basic.string/string.modifiers/string_insert/iter_initializer_list.pass.cpp +++ b/test/std/strings/basic.string/string.modifiers/string_insert/iter_initializer_list.pass.cpp @@ -7,13 +7,12 @@ // //===----------------------------------------------------------------------===// +// UNSUPPORTED: c++98, c++03 + // // iterator insert(const_iterator p, initializer_list il); -#if _LIBCPP_DEBUG >= 1 -#define _LIBCPP_ASSERT(x, m) ((x) ? (void)0 : std::exit(0)) -#endif #include #include @@ -22,14 +21,12 @@ int main() { -#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS { std::string s("123456"); std::string::iterator i = s.insert(s.begin() + 3, {'a', 'b', 'c'}); assert(i - s.begin() == 3); assert(s == "123abc456"); } -#if TEST_STD_VER >= 11 { typedef std::basic_string, min_allocator> S; S s("123456"); @@ -37,14 +34,4 @@ int main() assert(i - s.begin() == 3); assert(s == "123abc456"); } -#endif -#if _LIBCPP_DEBUG >= 1 - { - std::string s; - std::string s2; - s.insert(s2.begin(), {'a', 'b', 'c'}); - assert(false); - } -#endif -#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS } diff --git a/test/std/strings/basic.string/string.modifiers/string_insert/iter_iter_iter.pass.cpp b/test/std/strings/basic.string/string.modifiers/string_insert/iter_iter_iter.pass.cpp index e5ce8e51e..2c8b6e4a1 100644 --- a/test/std/strings/basic.string/string.modifiers/string_insert/iter_iter_iter.pass.cpp +++ b/test/std/strings/basic.string/string.modifiers/string_insert/iter_iter_iter.pass.cpp @@ -188,10 +188,35 @@ int main() { // test assigning a different type typedef std::string S; - const uint8_t p[] = "ABCD"; + const uint8_t p[] = "ABCD"; - S s; - s.insert(s.begin(), p, p + 4); - assert(s == "ABCD"); + S s; + s.insert(s.begin(), p, p + 4); + assert(s == "ABCD"); } + + { // test with a move iterator that returns char&& + typedef input_iterator It; + typedef std::move_iterator MoveIt; + const char p[] = "ABCD"; + std::string s; + s.insert(s.begin(), MoveIt(It(std::begin(p))), MoveIt(It(std::end(p) - 1))); + assert(s == "ABCD"); + } + { // test with a move iterator that returns char&& + typedef forward_iterator It; + typedef std::move_iterator MoveIt; + const char p[] = "ABCD"; + std::string s; + s.insert(s.begin(), MoveIt(It(std::begin(p))), MoveIt(It(std::end(p) - 1))); + assert(s == "ABCD"); + } + { // test with a move iterator that returns char&& + typedef const char* It; + typedef std::move_iterator MoveIt; + const char p[] = "ABCD"; + std::string s; + s.insert(s.begin(), MoveIt(It(std::begin(p))), MoveIt(It(std::end(p) - 1))); + assert(s == "ABCD"); + } } diff --git a/test/std/strings/basic.string/string.modifiers/string_replace/iter_iter_initializer_list.pass.cpp b/test/std/strings/basic.string/string.modifiers/string_replace/iter_iter_initializer_list.pass.cpp index b60a58c55..2a705ebf4 100644 --- a/test/std/strings/basic.string/string.modifiers/string_replace/iter_iter_initializer_list.pass.cpp +++ b/test/std/strings/basic.string/string.modifiers/string_replace/iter_iter_initializer_list.pass.cpp @@ -7,6 +7,8 @@ // //===----------------------------------------------------------------------===// +// UNSUPPORTED: c++98, c++03 + // // basic_string& replace(const_iterator i1, const_iterator i2, initializer_list il); @@ -18,19 +20,15 @@ int main() { -#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS { std::string s("123def456"); s.replace(s.cbegin() + 3, s.cbegin() + 6, {'a', 'b', 'c'}); assert(s == "123abc456"); } -#if TEST_STD_VER >= 11 { typedef std::basic_string, min_allocator> S; S s("123def456"); s.replace(s.cbegin() + 3, s.cbegin() + 6, {'a', 'b', 'c'}); assert(s == "123abc456"); } -#endif -#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS } diff --git a/test/std/strings/basic.string/string.nonmembers/string.io/get_line_delim_rv.pass.cpp b/test/std/strings/basic.string/string.nonmembers/string.io/get_line_delim_rv.pass.cpp index 48d185480..5dbfe9d4d 100644 --- a/test/std/strings/basic.string/string.nonmembers/string.io/get_line_delim_rv.pass.cpp +++ b/test/std/strings/basic.string/string.nonmembers/string.io/get_line_delim_rv.pass.cpp @@ -7,6 +7,8 @@ // //===----------------------------------------------------------------------===// +// UNSUPPORTED: c++98, c++03 + // // template @@ -22,7 +24,6 @@ int main() { -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES { std::string s("initial text"); getline(std::istringstream(" abc* def* ghij"), s, '*'); @@ -33,7 +34,6 @@ int main() getline(std::wistringstream(L" abc* def* ghij"), s, L'*'); assert(s == L" abc"); } -#if TEST_STD_VER >= 11 { typedef std::basic_string, min_allocator> S; S s("initial text"); @@ -46,6 +46,4 @@ int main() getline(std::wistringstream(L" abc* def* ghij"), s, L'*'); assert(s == L" abc"); } -#endif -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES } diff --git a/test/std/strings/basic.string/string.nonmembers/string.io/get_line_rv.pass.cpp b/test/std/strings/basic.string/string.nonmembers/string.io/get_line_rv.pass.cpp index 18c22f915..0c1fa8203 100644 --- a/test/std/strings/basic.string/string.nonmembers/string.io/get_line_rv.pass.cpp +++ b/test/std/strings/basic.string/string.nonmembers/string.io/get_line_rv.pass.cpp @@ -7,6 +7,8 @@ // //===----------------------------------------------------------------------===// +// UNSUPPORTED: c++98, c++03 + // // template @@ -22,7 +24,6 @@ int main() { -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES { std::string s("initial text"); getline(std::istringstream(" abc\n def\n ghij"), s); @@ -33,7 +34,6 @@ int main() getline(std::wistringstream(L" abc\n def\n ghij"), s); assert(s == L" abc"); } -#if TEST_STD_VER >= 11 { typedef std::basic_string, min_allocator> S; S s("initial text"); @@ -46,6 +46,4 @@ int main() getline(std::wistringstream(L" abc\n def\n ghij"), s); assert(s == L" abc"); } -#endif -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES } diff --git a/test/std/strings/basic.string/string.nonmembers/string_op+/char_string.pass.cpp b/test/std/strings/basic.string/string.nonmembers/string_op+/char_string.pass.cpp index 9a8213e23..7bf7da890 100644 --- a/test/std/strings/basic.string/string.nonmembers/string_op+/char_string.pass.cpp +++ b/test/std/strings/basic.string/string.nonmembers/string_op+/char_string.pass.cpp @@ -21,60 +21,50 @@ #include #include +#include "test_macros.h" #include "min_allocator.h" template -void -test0(typename S::value_type lhs, const S& rhs, const S& x) -{ - assert(lhs + rhs == x); +void test0(typename S::value_type lhs, const S& rhs, const S& x) { + assert(lhs + rhs == x); } -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES - +#if TEST_STD_VER >= 11 template -void -test1(typename S::value_type lhs, S&& rhs, const S& x) -{ - assert(lhs + move(rhs) == x); +void test1(typename S::value_type lhs, S&& rhs, const S& x) { + assert(lhs + move(rhs) == x); } +#endif -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES - -int main() -{ - { +int main() { + { typedef std::string S; test0('a', S(""), S("a")); test0('a', S("12345"), S("a12345")); test0('a', S("1234567890"), S("a1234567890")); test0('a', S("12345678901234567890"), S("a12345678901234567890")); - -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES - + } +#if TEST_STD_VER >= 11 + { + typedef std::string S; test1('a', S(""), S("a")); test1('a', S("12345"), S("a12345")); test1('a', S("1234567890"), S("a1234567890")); test1('a', S("12345678901234567890"), S("a12345678901234567890")); - -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES - } -#if TEST_STD_VER >= 11 - { - typedef std::basic_string, min_allocator> S; + } + { + typedef std::basic_string, + min_allocator > + S; test0('a', S(""), S("a")); test0('a', S("12345"), S("a12345")); test0('a', S("1234567890"), S("a1234567890")); test0('a', S("12345678901234567890"), S("a12345678901234567890")); -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES - test1('a', S(""), S("a")); test1('a', S("12345"), S("a12345")); test1('a', S("1234567890"), S("a1234567890")); test1('a', S("12345678901234567890"), S("a12345678901234567890")); - -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES - } + } #endif } diff --git a/test/std/strings/basic.string/string.nonmembers/string_op+/pointer_string.pass.cpp b/test/std/strings/basic.string/string.nonmembers/string_op+/pointer_string.pass.cpp index 88fa678ec..090707fd8 100644 --- a/test/std/strings/basic.string/string.nonmembers/string_op+/pointer_string.pass.cpp +++ b/test/std/strings/basic.string/string.nonmembers/string_op+/pointer_string.pass.cpp @@ -21,29 +21,23 @@ #include #include +#include "test_macros.h" #include "min_allocator.h" template -void -test0(const typename S::value_type* lhs, const S& rhs, const S& x) -{ - assert(lhs + rhs == x); +void test0(const typename S::value_type* lhs, const S& rhs, const S& x) { + assert(lhs + rhs == x); } -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES - +#if TEST_STD_VER >= 11 template -void -test1(const typename S::value_type* lhs, S&& rhs, const S& x) -{ - assert(lhs + move(rhs) == x); +void test1(const typename S::value_type* lhs, S&& rhs, const S& x) { + assert(lhs + move(rhs) == x); } +#endif -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES - -int main() -{ - { +int main() { + { typedef std::string S; test0("", S(""), S("")); test0("", S("12345"), S("12345")); @@ -56,14 +50,19 @@ int main() test0("abcdefghij", S(""), S("abcdefghij")); test0("abcdefghij", S("12345"), S("abcdefghij12345")); test0("abcdefghij", S("1234567890"), S("abcdefghij1234567890")); - test0("abcdefghij", S("12345678901234567890"), S("abcdefghij12345678901234567890")); + test0("abcdefghij", S("12345678901234567890"), + S("abcdefghij12345678901234567890")); test0("abcdefghijklmnopqrst", S(""), S("abcdefghijklmnopqrst")); test0("abcdefghijklmnopqrst", S("12345"), S("abcdefghijklmnopqrst12345")); - test0("abcdefghijklmnopqrst", S("1234567890"), S("abcdefghijklmnopqrst1234567890")); - test0("abcdefghijklmnopqrst", S("12345678901234567890"), S("abcdefghijklmnopqrst12345678901234567890")); - -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES + test0("abcdefghijklmnopqrst", S("1234567890"), + S("abcdefghijklmnopqrst1234567890")); + test0("abcdefghijklmnopqrst", S("12345678901234567890"), + S("abcdefghijklmnopqrst12345678901234567890")); + } +#if TEST_STD_VER >= 11 + { + typedef std::string S; test1("", S(""), S("")); test1("", S("12345"), S("12345")); test1("", S("1234567890"), S("1234567890")); @@ -75,17 +74,19 @@ int main() test1("abcdefghij", S(""), S("abcdefghij")); test1("abcdefghij", S("12345"), S("abcdefghij12345")); test1("abcdefghij", S("1234567890"), S("abcdefghij1234567890")); - test1("abcdefghij", S("12345678901234567890"), S("abcdefghij12345678901234567890")); + test1("abcdefghij", S("12345678901234567890"), + S("abcdefghij12345678901234567890")); test1("abcdefghijklmnopqrst", S(""), S("abcdefghijklmnopqrst")); test1("abcdefghijklmnopqrst", S("12345"), S("abcdefghijklmnopqrst12345")); - test1("abcdefghijklmnopqrst", S("1234567890"), S("abcdefghijklmnopqrst1234567890")); - test1("abcdefghijklmnopqrst", S("12345678901234567890"), S("abcdefghijklmnopqrst12345678901234567890")); - -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES - } -#if TEST_STD_VER >= 11 - { - typedef std::basic_string, min_allocator> S; + test1("abcdefghijklmnopqrst", S("1234567890"), + S("abcdefghijklmnopqrst1234567890")); + test1("abcdefghijklmnopqrst", S("12345678901234567890"), + S("abcdefghijklmnopqrst12345678901234567890")); + } + { + typedef std::basic_string, + min_allocator > + S; test0("", S(""), S("")); test0("", S("12345"), S("12345")); test0("", S("1234567890"), S("1234567890")); @@ -97,13 +98,14 @@ int main() test0("abcdefghij", S(""), S("abcdefghij")); test0("abcdefghij", S("12345"), S("abcdefghij12345")); test0("abcdefghij", S("1234567890"), S("abcdefghij1234567890")); - test0("abcdefghij", S("12345678901234567890"), S("abcdefghij12345678901234567890")); + test0("abcdefghij", S("12345678901234567890"), + S("abcdefghij12345678901234567890")); test0("abcdefghijklmnopqrst", S(""), S("abcdefghijklmnopqrst")); test0("abcdefghijklmnopqrst", S("12345"), S("abcdefghijklmnopqrst12345")); - test0("abcdefghijklmnopqrst", S("1234567890"), S("abcdefghijklmnopqrst1234567890")); - test0("abcdefghijklmnopqrst", S("12345678901234567890"), S("abcdefghijklmnopqrst12345678901234567890")); - -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES + test0("abcdefghijklmnopqrst", S("1234567890"), + S("abcdefghijklmnopqrst1234567890")); + test0("abcdefghijklmnopqrst", S("12345678901234567890"), + S("abcdefghijklmnopqrst12345678901234567890")); test1("", S(""), S("")); test1("", S("12345"), S("12345")); @@ -116,13 +118,14 @@ int main() test1("abcdefghij", S(""), S("abcdefghij")); test1("abcdefghij", S("12345"), S("abcdefghij12345")); test1("abcdefghij", S("1234567890"), S("abcdefghij1234567890")); - test1("abcdefghij", S("12345678901234567890"), S("abcdefghij12345678901234567890")); + test1("abcdefghij", S("12345678901234567890"), + S("abcdefghij12345678901234567890")); test1("abcdefghijklmnopqrst", S(""), S("abcdefghijklmnopqrst")); test1("abcdefghijklmnopqrst", S("12345"), S("abcdefghijklmnopqrst12345")); - test1("abcdefghijklmnopqrst", S("1234567890"), S("abcdefghijklmnopqrst1234567890")); - test1("abcdefghijklmnopqrst", S("12345678901234567890"), S("abcdefghijklmnopqrst12345678901234567890")); - -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES - } + test1("abcdefghijklmnopqrst", S("1234567890"), + S("abcdefghijklmnopqrst1234567890")); + test1("abcdefghijklmnopqrst", S("12345678901234567890"), + S("abcdefghijklmnopqrst12345678901234567890")); + } #endif } diff --git a/test/std/strings/basic.string/string.nonmembers/string_op+/string_char.pass.cpp b/test/std/strings/basic.string/string.nonmembers/string_op+/string_char.pass.cpp index b4c2c9704..9bc3a4d41 100644 --- a/test/std/strings/basic.string/string.nonmembers/string_op+/string_char.pass.cpp +++ b/test/std/strings/basic.string/string.nonmembers/string_op+/string_char.pass.cpp @@ -21,60 +21,50 @@ #include #include +#include "test_macros.h" #include "min_allocator.h" template -void -test0(const S& lhs, typename S::value_type rhs, const S& x) -{ - assert(lhs + rhs == x); +void test0(const S& lhs, typename S::value_type rhs, const S& x) { + assert(lhs + rhs == x); } -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES - +#if TEST_STD_VER >= 11 template -void -test1(S&& lhs, typename S::value_type rhs, const S& x) -{ - assert(move(lhs) + rhs == x); +void test1(S&& lhs, typename S::value_type rhs, const S& x) { + assert(move(lhs) + rhs == x); } +#endif -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES - -int main() -{ - { +int main() { + { typedef std::string S; test0(S(""), '1', S("1")); test0(S("abcde"), '1', S("abcde1")); test0(S("abcdefghij"), '1', S("abcdefghij1")); test0(S("abcdefghijklmnopqrst"), '1', S("abcdefghijklmnopqrst1")); - -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES - + } +#if TEST_STD_VER >= 11 + { + typedef std::string S; test1(S(""), '1', S("1")); test1(S("abcde"), '1', S("abcde1")); test1(S("abcdefghij"), '1', S("abcdefghij1")); test1(S("abcdefghijklmnopqrst"), '1', S("abcdefghijklmnopqrst1")); - -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES - } -#if TEST_STD_VER >= 11 - { - typedef std::basic_string, min_allocator> S; + } + { + typedef std::basic_string, + min_allocator > + S; test0(S(""), '1', S("1")); test0(S("abcde"), '1', S("abcde1")); test0(S("abcdefghij"), '1', S("abcdefghij1")); test0(S("abcdefghijklmnopqrst"), '1', S("abcdefghijklmnopqrst1")); -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES - test1(S(""), '1', S("1")); test1(S("abcde"), '1', S("abcde1")); test1(S("abcdefghij"), '1', S("abcdefghij1")); test1(S("abcdefghijklmnopqrst"), '1', S("abcdefghijklmnopqrst1")); - -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES - } + } #endif } diff --git a/test/std/strings/basic.string/string.nonmembers/string_op+/string_pointer.pass.cpp b/test/std/strings/basic.string/string.nonmembers/string_op+/string_pointer.pass.cpp index 3b669e7d9..a9aa92f37 100644 --- a/test/std/strings/basic.string/string.nonmembers/string_op+/string_pointer.pass.cpp +++ b/test/std/strings/basic.string/string.nonmembers/string_op+/string_pointer.pass.cpp @@ -21,29 +21,23 @@ #include #include +#include "test_macros.h" #include "min_allocator.h" template -void -test0(const S& lhs, const typename S::value_type* rhs, const S& x) -{ - assert(lhs + rhs == x); +void test0(const S& lhs, const typename S::value_type* rhs, const S& x) { + assert(lhs + rhs == x); } -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES - +#if TEST_STD_VER >= 11 template -void -test1(S&& lhs, const typename S::value_type* rhs, const S& x) -{ - assert(move(lhs) + rhs == x); +void test1(S&& lhs, const typename S::value_type* rhs, const S& x) { + assert(move(lhs) + rhs == x); } +#endif -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES - -int main() -{ - { +int main() { + { typedef std::string S; test0(S(""), "", S("")); test0(S(""), "12345", S("12345")); @@ -56,14 +50,18 @@ int main() test0(S("abcdefghij"), "", S("abcdefghij")); test0(S("abcdefghij"), "12345", S("abcdefghij12345")); test0(S("abcdefghij"), "1234567890", S("abcdefghij1234567890")); - test0(S("abcdefghij"), "12345678901234567890", S("abcdefghij12345678901234567890")); + test0(S("abcdefghij"), "12345678901234567890", + S("abcdefghij12345678901234567890")); test0(S("abcdefghijklmnopqrst"), "", S("abcdefghijklmnopqrst")); test0(S("abcdefghijklmnopqrst"), "12345", S("abcdefghijklmnopqrst12345")); - test0(S("abcdefghijklmnopqrst"), "1234567890", S("abcdefghijklmnopqrst1234567890")); - test0(S("abcdefghijklmnopqrst"), "12345678901234567890", S("abcdefghijklmnopqrst12345678901234567890")); - -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES - + test0(S("abcdefghijklmnopqrst"), "1234567890", + S("abcdefghijklmnopqrst1234567890")); + test0(S("abcdefghijklmnopqrst"), "12345678901234567890", + S("abcdefghijklmnopqrst12345678901234567890")); + } +#if TEST_STD_VER >= 11 + { + typedef std::string S; test1(S(""), "", S("")); test1(S(""), "12345", S("12345")); test1(S(""), "1234567890", S("1234567890")); @@ -75,17 +73,19 @@ int main() test1(S("abcdefghij"), "", S("abcdefghij")); test1(S("abcdefghij"), "12345", S("abcdefghij12345")); test1(S("abcdefghij"), "1234567890", S("abcdefghij1234567890")); - test1(S("abcdefghij"), "12345678901234567890", S("abcdefghij12345678901234567890")); + test1(S("abcdefghij"), "12345678901234567890", + S("abcdefghij12345678901234567890")); test1(S("abcdefghijklmnopqrst"), "", S("abcdefghijklmnopqrst")); test1(S("abcdefghijklmnopqrst"), "12345", S("abcdefghijklmnopqrst12345")); - test1(S("abcdefghijklmnopqrst"), "1234567890", S("abcdefghijklmnopqrst1234567890")); - test1(S("abcdefghijklmnopqrst"), "12345678901234567890", S("abcdefghijklmnopqrst12345678901234567890")); - -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES - } -#if TEST_STD_VER >= 11 - { - typedef std::basic_string, min_allocator> S; + test1(S("abcdefghijklmnopqrst"), "1234567890", + S("abcdefghijklmnopqrst1234567890")); + test1(S("abcdefghijklmnopqrst"), "12345678901234567890", + S("abcdefghijklmnopqrst12345678901234567890")); + } + { + typedef std::basic_string, + min_allocator > + S; test0(S(""), "", S("")); test0(S(""), "12345", S("12345")); test0(S(""), "1234567890", S("1234567890")); @@ -97,13 +97,14 @@ int main() test0(S("abcdefghij"), "", S("abcdefghij")); test0(S("abcdefghij"), "12345", S("abcdefghij12345")); test0(S("abcdefghij"), "1234567890", S("abcdefghij1234567890")); - test0(S("abcdefghij"), "12345678901234567890", S("abcdefghij12345678901234567890")); + test0(S("abcdefghij"), "12345678901234567890", + S("abcdefghij12345678901234567890")); test0(S("abcdefghijklmnopqrst"), "", S("abcdefghijklmnopqrst")); test0(S("abcdefghijklmnopqrst"), "12345", S("abcdefghijklmnopqrst12345")); - test0(S("abcdefghijklmnopqrst"), "1234567890", S("abcdefghijklmnopqrst1234567890")); - test0(S("abcdefghijklmnopqrst"), "12345678901234567890", S("abcdefghijklmnopqrst12345678901234567890")); - -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES + test0(S("abcdefghijklmnopqrst"), "1234567890", + S("abcdefghijklmnopqrst1234567890")); + test0(S("abcdefghijklmnopqrst"), "12345678901234567890", + S("abcdefghijklmnopqrst12345678901234567890")); test1(S(""), "", S("")); test1(S(""), "12345", S("12345")); @@ -116,13 +117,14 @@ int main() test1(S("abcdefghij"), "", S("abcdefghij")); test1(S("abcdefghij"), "12345", S("abcdefghij12345")); test1(S("abcdefghij"), "1234567890", S("abcdefghij1234567890")); - test1(S("abcdefghij"), "12345678901234567890", S("abcdefghij12345678901234567890")); + test1(S("abcdefghij"), "12345678901234567890", + S("abcdefghij12345678901234567890")); test1(S("abcdefghijklmnopqrst"), "", S("abcdefghijklmnopqrst")); test1(S("abcdefghijklmnopqrst"), "12345", S("abcdefghijklmnopqrst12345")); - test1(S("abcdefghijklmnopqrst"), "1234567890", S("abcdefghijklmnopqrst1234567890")); - test1(S("abcdefghijklmnopqrst"), "12345678901234567890", S("abcdefghijklmnopqrst12345678901234567890")); - -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES - } + test1(S("abcdefghijklmnopqrst"), "1234567890", + S("abcdefghijklmnopqrst1234567890")); + test1(S("abcdefghijklmnopqrst"), "12345678901234567890", + S("abcdefghijklmnopqrst12345678901234567890")); + } #endif } diff --git a/test/std/strings/basic.string/string.nonmembers/string_op+/string_string.pass.cpp b/test/std/strings/basic.string/string.nonmembers/string_op+/string_string.pass.cpp index 1977b6f51..fbef64627 100644 --- a/test/std/strings/basic.string/string.nonmembers/string_op+/string_string.pass.cpp +++ b/test/std/strings/basic.string/string.nonmembers/string_op+/string_string.pass.cpp @@ -33,43 +33,34 @@ #include #include +#include "test_macros.h" #include "min_allocator.h" template -void -test0(const S& lhs, const S& rhs, const S& x) -{ - assert(lhs + rhs == x); +void test0(const S& lhs, const S& rhs, const S& x) { + assert(lhs + rhs == x); } -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES - +#if TEST_STD_VER >= 11 template -void -test1(S&& lhs, const S& rhs, const S& x) -{ - assert(move(lhs) + rhs == x); +void test1(S&& lhs, const S& rhs, const S& x) { + assert(move(lhs) + rhs == x); } template -void -test2(const S& lhs, S&& rhs, const S& x) -{ - assert(lhs + move(rhs) == x); +void test2(const S& lhs, S&& rhs, const S& x) { + assert(lhs + move(rhs) == x); } template -void -test3(S&& lhs, S&& rhs, const S& x) -{ - assert(move(lhs) + move(rhs) == x); +void test3(S&& lhs, S&& rhs, const S& x) { + assert(move(lhs) + move(rhs) == x); } -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES +#endif -int main() -{ - { +int main() { + { typedef std::string S; test0(S(""), S(""), S("")); test0(S(""), S("12345"), S("12345")); @@ -78,18 +69,24 @@ int main() test0(S("abcde"), S(""), S("abcde")); test0(S("abcde"), S("12345"), S("abcde12345")); test0(S("abcde"), S("1234567890"), S("abcde1234567890")); - test0(S("abcde"), S("12345678901234567890"), S("abcde12345678901234567890")); + test0(S("abcde"), S("12345678901234567890"), + S("abcde12345678901234567890")); test0(S("abcdefghij"), S(""), S("abcdefghij")); test0(S("abcdefghij"), S("12345"), S("abcdefghij12345")); test0(S("abcdefghij"), S("1234567890"), S("abcdefghij1234567890")); - test0(S("abcdefghij"), S("12345678901234567890"), S("abcdefghij12345678901234567890")); + test0(S("abcdefghij"), S("12345678901234567890"), + S("abcdefghij12345678901234567890")); test0(S("abcdefghijklmnopqrst"), S(""), S("abcdefghijklmnopqrst")); - test0(S("abcdefghijklmnopqrst"), S("12345"), S("abcdefghijklmnopqrst12345")); - test0(S("abcdefghijklmnopqrst"), S("1234567890"), S("abcdefghijklmnopqrst1234567890")); - test0(S("abcdefghijklmnopqrst"), S("12345678901234567890"), S("abcdefghijklmnopqrst12345678901234567890")); - -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES - + test0(S("abcdefghijklmnopqrst"), S("12345"), + S("abcdefghijklmnopqrst12345")); + test0(S("abcdefghijklmnopqrst"), S("1234567890"), + S("abcdefghijklmnopqrst1234567890")); + test0(S("abcdefghijklmnopqrst"), S("12345678901234567890"), + S("abcdefghijklmnopqrst12345678901234567890")); + } +#if TEST_STD_VER >= 11 + { + typedef std::string S; test1(S(""), S(""), S("")); test1(S(""), S("12345"), S("12345")); test1(S(""), S("1234567890"), S("1234567890")); @@ -97,15 +94,20 @@ int main() test1(S("abcde"), S(""), S("abcde")); test1(S("abcde"), S("12345"), S("abcde12345")); test1(S("abcde"), S("1234567890"), S("abcde1234567890")); - test1(S("abcde"), S("12345678901234567890"), S("abcde12345678901234567890")); + test1(S("abcde"), S("12345678901234567890"), + S("abcde12345678901234567890")); test1(S("abcdefghij"), S(""), S("abcdefghij")); test1(S("abcdefghij"), S("12345"), S("abcdefghij12345")); test1(S("abcdefghij"), S("1234567890"), S("abcdefghij1234567890")); - test1(S("abcdefghij"), S("12345678901234567890"), S("abcdefghij12345678901234567890")); + test1(S("abcdefghij"), S("12345678901234567890"), + S("abcdefghij12345678901234567890")); test1(S("abcdefghijklmnopqrst"), S(""), S("abcdefghijklmnopqrst")); - test1(S("abcdefghijklmnopqrst"), S("12345"), S("abcdefghijklmnopqrst12345")); - test1(S("abcdefghijklmnopqrst"), S("1234567890"), S("abcdefghijklmnopqrst1234567890")); - test1(S("abcdefghijklmnopqrst"), S("12345678901234567890"), S("abcdefghijklmnopqrst12345678901234567890")); + test1(S("abcdefghijklmnopqrst"), S("12345"), + S("abcdefghijklmnopqrst12345")); + test1(S("abcdefghijklmnopqrst"), S("1234567890"), + S("abcdefghijklmnopqrst1234567890")); + test1(S("abcdefghijklmnopqrst"), S("12345678901234567890"), + S("abcdefghijklmnopqrst12345678901234567890")); test2(S(""), S(""), S("")); test2(S(""), S("12345"), S("12345")); @@ -114,15 +116,20 @@ int main() test2(S("abcde"), S(""), S("abcde")); test2(S("abcde"), S("12345"), S("abcde12345")); test2(S("abcde"), S("1234567890"), S("abcde1234567890")); - test2(S("abcde"), S("12345678901234567890"), S("abcde12345678901234567890")); + test2(S("abcde"), S("12345678901234567890"), + S("abcde12345678901234567890")); test2(S("abcdefghij"), S(""), S("abcdefghij")); test2(S("abcdefghij"), S("12345"), S("abcdefghij12345")); test2(S("abcdefghij"), S("1234567890"), S("abcdefghij1234567890")); - test2(S("abcdefghij"), S("12345678901234567890"), S("abcdefghij12345678901234567890")); + test2(S("abcdefghij"), S("12345678901234567890"), + S("abcdefghij12345678901234567890")); test2(S("abcdefghijklmnopqrst"), S(""), S("abcdefghijklmnopqrst")); - test2(S("abcdefghijklmnopqrst"), S("12345"), S("abcdefghijklmnopqrst12345")); - test2(S("abcdefghijklmnopqrst"), S("1234567890"), S("abcdefghijklmnopqrst1234567890")); - test2(S("abcdefghijklmnopqrst"), S("12345678901234567890"), S("abcdefghijklmnopqrst12345678901234567890")); + test2(S("abcdefghijklmnopqrst"), S("12345"), + S("abcdefghijklmnopqrst12345")); + test2(S("abcdefghijklmnopqrst"), S("1234567890"), + S("abcdefghijklmnopqrst1234567890")); + test2(S("abcdefghijklmnopqrst"), S("12345678901234567890"), + S("abcdefghijklmnopqrst12345678901234567890")); test3(S(""), S(""), S("")); test3(S(""), S("12345"), S("12345")); @@ -131,21 +138,25 @@ int main() test3(S("abcde"), S(""), S("abcde")); test3(S("abcde"), S("12345"), S("abcde12345")); test3(S("abcde"), S("1234567890"), S("abcde1234567890")); - test3(S("abcde"), S("12345678901234567890"), S("abcde12345678901234567890")); + test3(S("abcde"), S("12345678901234567890"), + S("abcde12345678901234567890")); test3(S("abcdefghij"), S(""), S("abcdefghij")); test3(S("abcdefghij"), S("12345"), S("abcdefghij12345")); test3(S("abcdefghij"), S("1234567890"), S("abcdefghij1234567890")); - test3(S("abcdefghij"), S("12345678901234567890"), S("abcdefghij12345678901234567890")); + test3(S("abcdefghij"), S("12345678901234567890"), + S("abcdefghij12345678901234567890")); test3(S("abcdefghijklmnopqrst"), S(""), S("abcdefghijklmnopqrst")); - test3(S("abcdefghijklmnopqrst"), S("12345"), S("abcdefghijklmnopqrst12345")); - test3(S("abcdefghijklmnopqrst"), S("1234567890"), S("abcdefghijklmnopqrst1234567890")); - test3(S("abcdefghijklmnopqrst"), S("12345678901234567890"), S("abcdefghijklmnopqrst12345678901234567890")); - -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES - } -#if TEST_STD_VER >= 11 - { - typedef std::basic_string, min_allocator> S; + test3(S("abcdefghijklmnopqrst"), S("12345"), + S("abcdefghijklmnopqrst12345")); + test3(S("abcdefghijklmnopqrst"), S("1234567890"), + S("abcdefghijklmnopqrst1234567890")); + test3(S("abcdefghijklmnopqrst"), S("12345678901234567890"), + S("abcdefghijklmnopqrst12345678901234567890")); + } + { + typedef std::basic_string, + min_allocator > + S; test0(S(""), S(""), S("")); test0(S(""), S("12345"), S("12345")); test0(S(""), S("1234567890"), S("1234567890")); @@ -153,17 +164,20 @@ int main() test0(S("abcde"), S(""), S("abcde")); test0(S("abcde"), S("12345"), S("abcde12345")); test0(S("abcde"), S("1234567890"), S("abcde1234567890")); - test0(S("abcde"), S("12345678901234567890"), S("abcde12345678901234567890")); + test0(S("abcde"), S("12345678901234567890"), + S("abcde12345678901234567890")); test0(S("abcdefghij"), S(""), S("abcdefghij")); test0(S("abcdefghij"), S("12345"), S("abcdefghij12345")); test0(S("abcdefghij"), S("1234567890"), S("abcdefghij1234567890")); - test0(S("abcdefghij"), S("12345678901234567890"), S("abcdefghij12345678901234567890")); + test0(S("abcdefghij"), S("12345678901234567890"), + S("abcdefghij12345678901234567890")); test0(S("abcdefghijklmnopqrst"), S(""), S("abcdefghijklmnopqrst")); - test0(S("abcdefghijklmnopqrst"), S("12345"), S("abcdefghijklmnopqrst12345")); - test0(S("abcdefghijklmnopqrst"), S("1234567890"), S("abcdefghijklmnopqrst1234567890")); - test0(S("abcdefghijklmnopqrst"), S("12345678901234567890"), S("abcdefghijklmnopqrst12345678901234567890")); - -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES + test0(S("abcdefghijklmnopqrst"), S("12345"), + S("abcdefghijklmnopqrst12345")); + test0(S("abcdefghijklmnopqrst"), S("1234567890"), + S("abcdefghijklmnopqrst1234567890")); + test0(S("abcdefghijklmnopqrst"), S("12345678901234567890"), + S("abcdefghijklmnopqrst12345678901234567890")); test1(S(""), S(""), S("")); test1(S(""), S("12345"), S("12345")); @@ -172,15 +186,20 @@ int main() test1(S("abcde"), S(""), S("abcde")); test1(S("abcde"), S("12345"), S("abcde12345")); test1(S("abcde"), S("1234567890"), S("abcde1234567890")); - test1(S("abcde"), S("12345678901234567890"), S("abcde12345678901234567890")); + test1(S("abcde"), S("12345678901234567890"), + S("abcde12345678901234567890")); test1(S("abcdefghij"), S(""), S("abcdefghij")); test1(S("abcdefghij"), S("12345"), S("abcdefghij12345")); test1(S("abcdefghij"), S("1234567890"), S("abcdefghij1234567890")); - test1(S("abcdefghij"), S("12345678901234567890"), S("abcdefghij12345678901234567890")); + test1(S("abcdefghij"), S("12345678901234567890"), + S("abcdefghij12345678901234567890")); test1(S("abcdefghijklmnopqrst"), S(""), S("abcdefghijklmnopqrst")); - test1(S("abcdefghijklmnopqrst"), S("12345"), S("abcdefghijklmnopqrst12345")); - test1(S("abcdefghijklmnopqrst"), S("1234567890"), S("abcdefghijklmnopqrst1234567890")); - test1(S("abcdefghijklmnopqrst"), S("12345678901234567890"), S("abcdefghijklmnopqrst12345678901234567890")); + test1(S("abcdefghijklmnopqrst"), S("12345"), + S("abcdefghijklmnopqrst12345")); + test1(S("abcdefghijklmnopqrst"), S("1234567890"), + S("abcdefghijklmnopqrst1234567890")); + test1(S("abcdefghijklmnopqrst"), S("12345678901234567890"), + S("abcdefghijklmnopqrst12345678901234567890")); test2(S(""), S(""), S("")); test2(S(""), S("12345"), S("12345")); @@ -189,15 +208,20 @@ int main() test2(S("abcde"), S(""), S("abcde")); test2(S("abcde"), S("12345"), S("abcde12345")); test2(S("abcde"), S("1234567890"), S("abcde1234567890")); - test2(S("abcde"), S("12345678901234567890"), S("abcde12345678901234567890")); + test2(S("abcde"), S("12345678901234567890"), + S("abcde12345678901234567890")); test2(S("abcdefghij"), S(""), S("abcdefghij")); test2(S("abcdefghij"), S("12345"), S("abcdefghij12345")); test2(S("abcdefghij"), S("1234567890"), S("abcdefghij1234567890")); - test2(S("abcdefghij"), S("12345678901234567890"), S("abcdefghij12345678901234567890")); + test2(S("abcdefghij"), S("12345678901234567890"), + S("abcdefghij12345678901234567890")); test2(S("abcdefghijklmnopqrst"), S(""), S("abcdefghijklmnopqrst")); - test2(S("abcdefghijklmnopqrst"), S("12345"), S("abcdefghijklmnopqrst12345")); - test2(S("abcdefghijklmnopqrst"), S("1234567890"), S("abcdefghijklmnopqrst1234567890")); - test2(S("abcdefghijklmnopqrst"), S("12345678901234567890"), S("abcdefghijklmnopqrst12345678901234567890")); + test2(S("abcdefghijklmnopqrst"), S("12345"), + S("abcdefghijklmnopqrst12345")); + test2(S("abcdefghijklmnopqrst"), S("1234567890"), + S("abcdefghijklmnopqrst1234567890")); + test2(S("abcdefghijklmnopqrst"), S("12345678901234567890"), + S("abcdefghijklmnopqrst12345678901234567890")); test3(S(""), S(""), S("")); test3(S(""), S("12345"), S("12345")); @@ -206,17 +230,20 @@ int main() test3(S("abcde"), S(""), S("abcde")); test3(S("abcde"), S("12345"), S("abcde12345")); test3(S("abcde"), S("1234567890"), S("abcde1234567890")); - test3(S("abcde"), S("12345678901234567890"), S("abcde12345678901234567890")); + test3(S("abcde"), S("12345678901234567890"), + S("abcde12345678901234567890")); test3(S("abcdefghij"), S(""), S("abcdefghij")); test3(S("abcdefghij"), S("12345"), S("abcdefghij12345")); test3(S("abcdefghij"), S("1234567890"), S("abcdefghij1234567890")); - test3(S("abcdefghij"), S("12345678901234567890"), S("abcdefghij12345678901234567890")); + test3(S("abcdefghij"), S("12345678901234567890"), + S("abcdefghij12345678901234567890")); test3(S("abcdefghijklmnopqrst"), S(""), S("abcdefghijklmnopqrst")); - test3(S("abcdefghijklmnopqrst"), S("12345"), S("abcdefghijklmnopqrst12345")); - test3(S("abcdefghijklmnopqrst"), S("1234567890"), S("abcdefghijklmnopqrst1234567890")); - test3(S("abcdefghijklmnopqrst"), S("12345678901234567890"), S("abcdefghijklmnopqrst12345678901234567890")); - -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES - } -#endif + test3(S("abcdefghijklmnopqrst"), S("12345"), + S("abcdefghijklmnopqrst12345")); + test3(S("abcdefghijklmnopqrst"), S("1234567890"), + S("abcdefghijklmnopqrst1234567890")); + test3(S("abcdefghijklmnopqrst"), S("12345678901234567890"), + S("abcdefghijklmnopqrst12345678901234567890")); + } +#endif // TEST_STD_VER >= 11 } diff --git a/test/std/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.observers/get.pass.cpp b/test/std/strings/basic.string/traits_mismatch.fail.cpp similarity index 69% rename from test/std/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.observers/get.pass.cpp rename to test/std/strings/basic.string/traits_mismatch.fail.cpp index 2ae0659ad..1d54238ae 100644 --- a/test/std/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.observers/get.pass.cpp +++ b/test/std/strings/basic.string/traits_mismatch.fail.cpp @@ -7,18 +7,12 @@ // //===----------------------------------------------------------------------===// -// +// +// The strings's value type must be the same as the traits's char_type -// unique_ptr - -// test get - -#include -#include +#include int main() { - int* p = new int[3]; - std::unique_ptr s(p); - assert(s.get() == p); + std::basic_string> s; } diff --git a/test/std/strings/string.conversions/stof.pass.cpp b/test/std/strings/string.conversions/stof.pass.cpp index 1e17e1d3a..a5e587236 100644 --- a/test/std/strings/string.conversions/stof.pass.cpp +++ b/test/std/strings/string.conversions/stof.pass.cpp @@ -7,8 +7,9 @@ // //===----------------------------------------------------------------------===// // -// XFAIL: with_system_cxx_lib=x86_64-apple-darwin11 -// XFAIL: with_system_cxx_lib=x86_64-apple-darwin12 +// PR14919 was fixed in r172447, out_of_range wasn't thrown before. +// XFAIL: with_system_cxx_lib=macosx10.7 +// XFAIL: with_system_cxx_lib=macosx10.8 // diff --git a/test/std/strings/string.conversions/stol.pass.cpp b/test/std/strings/string.conversions/stol.pass.cpp index 457cf0a76..5e16735dc 100644 --- a/test/std/strings/string.conversions/stol.pass.cpp +++ b/test/std/strings/string.conversions/stol.pass.cpp @@ -7,8 +7,9 @@ // //===----------------------------------------------------------------------===// // -// XFAIL: with_system_cxx_lib=x86_64-apple-darwin11 -// XFAIL: with_system_cxx_lib=x86_64-apple-darwin12 +// PR14919 was fixed in r172447, out_of_range wasn't thrown before. +// XFAIL: with_system_cxx_lib=macosx10.7 +// XFAIL: with_system_cxx_lib=macosx10.8 // diff --git a/test/std/strings/string.conversions/stoll.pass.cpp b/test/std/strings/string.conversions/stoll.pass.cpp index ca8412aeb..c33f9ee5e 100644 --- a/test/std/strings/string.conversions/stoll.pass.cpp +++ b/test/std/strings/string.conversions/stoll.pass.cpp @@ -7,8 +7,9 @@ // //===----------------------------------------------------------------------===// // -// XFAIL: with_system_cxx_lib=x86_64-apple-darwin11 -// XFAIL: with_system_cxx_lib=x86_64-apple-darwin12 +// PR14919 was fixed in r172447, out_of_range wasn't thrown before. +// XFAIL: with_system_cxx_lib=macosx10.7 +// XFAIL: with_system_cxx_lib=macosx10.8 // diff --git a/test/std/strings/string.conversions/stoul.pass.cpp b/test/std/strings/string.conversions/stoul.pass.cpp index 1acdf1164..523c49a29 100644 --- a/test/std/strings/string.conversions/stoul.pass.cpp +++ b/test/std/strings/string.conversions/stoul.pass.cpp @@ -7,8 +7,9 @@ // //===----------------------------------------------------------------------===// // -// XFAIL: with_system_cxx_lib=x86_64-apple-darwin11 -// XFAIL: with_system_cxx_lib=x86_64-apple-darwin12 +// PR14919 was fixed in r172447, out_of_range wasn't thrown before. +// XFAIL: with_system_cxx_lib=macosx10.7 +// XFAIL: with_system_cxx_lib=macosx10.8 // diff --git a/test/std/strings/string.conversions/stoull.pass.cpp b/test/std/strings/string.conversions/stoull.pass.cpp index e63679eed..549c8da9a 100644 --- a/test/std/strings/string.conversions/stoull.pass.cpp +++ b/test/std/strings/string.conversions/stoull.pass.cpp @@ -7,8 +7,9 @@ // //===----------------------------------------------------------------------===// // -// XFAIL: with_system_cxx_lib=x86_64-apple-darwin11 -// XFAIL: with_system_cxx_lib=x86_64-apple-darwin12 +// PR14919 was fixed in r172447, out_of_range wasn't thrown before. +// XFAIL: with_system_cxx_lib=macosx10.7 +// XFAIL: with_system_cxx_lib=macosx10.8 // diff --git a/test/std/strings/string.view/string.view.hash/string_view.pass.cpp b/test/std/strings/string.view/string.view.hash/string_view.pass.cpp index d07664825..53c3d261d 100644 --- a/test/std/strings/string.view/string.view.hash/string_view.pass.cpp +++ b/test/std/strings/string.view/string.view.hash/string_view.pass.cpp @@ -23,6 +23,8 @@ #include #include +#include "test_macros.h" + using std::string_view; template @@ -36,6 +38,7 @@ test() typedef typename SV::value_type char_type; typedef std::basic_string String; typedef std::hash SH; + ASSERT_NOEXCEPT(H()(SV())); char_type g1 [ 10 ]; char_type g2 [ 10 ]; diff --git a/test/std/strings/string.view/string.view.modifiers/clear.pass.cpp b/test/std/strings/string.view/string.view.modifiers/clear.pass.cpp deleted file mode 100644 index c1137e80a..000000000 --- a/test/std/strings/string.view/string.view.modifiers/clear.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. -// -//===----------------------------------------------------------------------===// - - -// - -// void clear() noexcept - -#include -#include - -#include "test_macros.h" - -template -void test ( const CharT *s, size_t len ) { - typedef std::basic_string_view SV; - { - SV sv1 ( s ); - assert ( sv1.size() == len ); - assert ( sv1.data() == s ); - - sv1.clear (); - assert ( sv1.data() == nullptr ); - assert ( sv1.size() == 0 ); - assert ( sv1 == SV()); - } -} - -#if TEST_STD_VER > 11 -constexpr size_t test_ce ( size_t n ) { - typedef std::basic_string_view SV; - SV sv1{ "ABCDEFGHIJKL", n }; - sv1.clear(); - return sv1.size(); -} -#endif - -int main () { - test ( "ABCDE", 5 ); - test ( "a", 1 ); - test ( "", 0 ); - - test ( L"ABCDE", 5 ); - test ( L"a", 1 ); - test ( L"", 0 ); - -#if TEST_STD_VER >= 11 - test ( u"ABCDE", 5 ); - test ( u"a", 1 ); - test ( u"", 0 ); - - test ( U"ABCDE", 5 ); - test ( U"a", 1 ); - test ( U"", 0 ); -#endif - -#if TEST_STD_VER > 11 - static_assert ( test_ce (5) == 0, "" ); -#endif - -} diff --git a/test/std/strings/string.view/traits_mismatch.fail.cpp b/test/std/strings/string.view/traits_mismatch.fail.cpp new file mode 100644 index 000000000..6cd15e6a6 --- /dev/null +++ b/test/std/strings/string.view/traits_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. +// +//===----------------------------------------------------------------------===// + +// +// The string_views's value type must be the same as the traits's char_type + +#include + +int main() +{ + std::basic_string_view> s; +} diff --git a/test/std/thread/futures/futures.future_error/what.pass.cpp b/test/std/thread/futures/futures.future_error/what.pass.cpp index a44f8af7d..957d530ab 100644 --- a/test/std/thread/futures/futures.future_error/what.pass.cpp +++ b/test/std/thread/futures/futures.future_error/what.pass.cpp @@ -12,9 +12,11 @@ // LWG 2056 changed the values of future_errc, so if we're using new headers // with an old library we'll get incorrect messages. // -// XFAIL: with_system_cxx_lib=x86_64-apple-darwin11 -// XFAIL: with_system_cxx_lib=x86_64-apple-darwin12 -// XFAIL: with_system_cxx_lib=x86_64-apple-darwin13 +// XFAIL: with_system_cxx_lib=macosx10.11 +// XFAIL: with_system_cxx_lib=macosx10.10 +// XFAIL: with_system_cxx_lib=macosx10.9 +// XFAIL: with_system_cxx_lib=macosx10.7 +// XFAIL: with_system_cxx_lib=macosx10.8 // diff --git a/test/std/thread/futures/futures.task/futures.task.members/ctor_func_alloc.pass.cpp b/test/std/thread/futures/futures.task/futures.task.members/ctor_func_alloc.pass.cpp index 39784876b..7cac21d48 100644 --- a/test/std/thread/futures/futures.task/futures.task.members/ctor_func_alloc.pass.cpp +++ b/test/std/thread/futures/futures.task/futures.task.members/ctor_func_alloc.pass.cpp @@ -69,7 +69,7 @@ int main() p(3, 'a'); assert(f.get() == 105.0); assert(A::n_copies > 0); - assert(A::n_moves > 0); + assert(A::n_moves >= 0); } assert(test_alloc_base::alloc_count == 0); A::n_copies = 0; 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 245c48088..a0071cd65 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 @@ -188,7 +188,7 @@ int main() } } #endif -#ifndef _LIBCPP_HAS_NO_VARIADICS +#if TEST_STD_VER >= 11 { L0 l0; L0 l1; @@ -518,5 +518,5 @@ int main() } } #endif // TEST_HAS_NO_EXCEPTIONS -#endif // _LIBCPP_HAS_NO_VARIADICS +#endif // TEST_STD_VER >= 11 } 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 fb563cbe0..4ad7a3ac2 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 @@ -126,7 +126,7 @@ int main() } } #endif -#ifndef _LIBCPP_HAS_NO_VARIADICS +#if TEST_STD_VER >= 11 { L0 l0; L0 l1; @@ -522,5 +522,5 @@ int main() assert(!l2.locked()); assert(!l3.locked()); } -#endif // _LIBCPP_HAS_NO_VARIADICS +#endif // TEST_STD_VER >= 11 } diff --git a/test/std/thread/thread.mutex/thread.lock/thread.lock.guard/mutex.pass.cpp b/test/std/thread/thread.mutex/thread.lock/thread.lock.guard/mutex.pass.cpp index a15405fcd..97f9d07c1 100644 --- a/test/std/thread/thread.mutex/thread.lock/thread.lock.guard/mutex.pass.cpp +++ b/test/std/thread/thread.mutex/thread.lock/thread.lock.guard/mutex.pass.cpp @@ -15,11 +15,16 @@ // explicit lock_guard(mutex_type& m); +// template lock_guard(lock_guard<_Mutex>) +// -> lock_guard<_Mutex>; // C++17 + #include #include #include #include +#include "test_macros.h" + std::mutex m; typedef std::chrono::system_clock Clock; @@ -47,4 +52,9 @@ int main() std::this_thread::sleep_for(ms(250)); m.unlock(); t.join(); + +#ifdef __cpp_deduction_guides + std::lock_guard lg(m); + static_assert((std::is_same>::value), "" ); +#endif } diff --git a/test/std/thread/thread.mutex/thread.lock/thread.lock.guard/variadic_mutex_cxx03.pass.cpp b/test/std/thread/thread.mutex/thread.lock/thread.lock.guard/variadic_mutex_cxx03.pass.cpp deleted file mode 100644 index 0ad16e285..000000000 --- a/test/std/thread/thread.mutex/thread.lock/thread.lock.guard/variadic_mutex_cxx03.pass.cpp +++ /dev/null @@ -1,21 +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 -// - -// template class lock_guard; - -// Test that the variadic lock guard implementation compiles in all standard -// dialects, including C++03, even though it is forward declared using -// variadic templates. - -// MODULES_DEFINES: _LIBCPP_ABI_VARIADIC_LOCK_GUARD -#define _LIBCPP_ABI_VARIADIC_LOCK_GUARD -#include "mutex.pass.cpp" // Use the existing non-variadic test diff --git a/test/std/thread/thread.mutex/thread.lock/thread.lock.guard/variadic_adopt_lock.pass.cpp b/test/std/thread/thread.mutex/thread.lock/thread.lock.scoped/adopt_lock.pass.cpp similarity index 71% rename from test/std/thread/thread.mutex/thread.lock/thread.lock.guard/variadic_adopt_lock.pass.cpp rename to test/std/thread/thread.mutex/thread.lock/thread.lock.scoped/adopt_lock.pass.cpp index 81fc0d368..78165383a 100644 --- a/test/std/thread/thread.mutex/thread.lock/thread.lock.guard/variadic_adopt_lock.pass.cpp +++ b/test/std/thread/thread.mutex/thread.lock/thread.lock.scoped/adopt_lock.pass.cpp @@ -8,18 +8,17 @@ //===----------------------------------------------------------------------===// // // UNSUPPORTED: libcpp-has-no-threads -// UNSUPPORTED: c++98, c++03 +// UNSUPPORTED: c++98, c++03, c++11, c++14 // -// template class lock_guard; +// template class scoped_lock; -// lock_guard(Mutex&..., adopt_lock_t); +// scoped_lock(Mutex&..., adopt_lock_t); -// MODULES_DEFINES: _LIBCPP_ABI_VARIADIC_LOCK_GUARD -#define _LIBCPP_ABI_VARIADIC_LOCK_GUARD #include #include +#include "test_macros.h" struct TestMutex { bool locked = false; @@ -36,12 +35,22 @@ struct TestMutex { int main() { { - using LG = std::lock_guard<>; + using LG = std::scoped_lock<>; LG lg(std::adopt_lock); } + { + TestMutex m1; + using LG = std::scoped_lock; + m1.lock(); + { + LG lg(m1, std::adopt_lock); + assert(m1.locked); + } + assert(!m1.locked); + } { TestMutex m1, m2; - using LG = std::lock_guard; + using LG = std::scoped_lock; m1.lock(); m2.lock(); { LG lg(m1, m2, std::adopt_lock); @@ -51,7 +60,7 @@ int main() } { TestMutex m1, m2, m3; - using LG = std::lock_guard; + using LG = std::scoped_lock; m1.lock(); m2.lock(); m3.lock(); { LG lg(m1, m2, m3, std::adopt_lock); diff --git a/test/std/thread/thread.mutex/thread.lock/thread.lock.guard/variadic_assign.fail.cpp b/test/std/thread/thread.mutex/thread.lock/thread.lock.scoped/assign.fail.cpp similarity index 66% rename from test/std/thread/thread.mutex/thread.lock/thread.lock.guard/variadic_assign.fail.cpp rename to test/std/thread/thread.mutex/thread.lock/thread.lock.scoped/assign.fail.cpp index 1b4c9d4bf..a05472935 100644 --- a/test/std/thread/thread.mutex/thread.lock/thread.lock.guard/variadic_assign.fail.cpp +++ b/test/std/thread/thread.mutex/thread.lock/thread.lock.scoped/assign.fail.cpp @@ -8,17 +8,16 @@ //===----------------------------------------------------------------------===// // UNSUPPORTED: libcpp-has-no-threads -// UNSUPPORTED: c++98, c++03 +// UNSUPPORTED: c++98, c++03, c++11, c++14 // -// template class lock_guard; +// template class scoped_lock; -// lock_guard& operator=(lock_guard const&) = delete; +// scoped_lock& operator=(scoped_lock const&) = delete; -// MODULES_DEFINES: _LIBCPP_ABI_VARIADIC_LOCK_GUARD -#define _LIBCPP_ABI_VARIADIC_LOCK_GUARD #include +#include "test_macros.h" int main() { @@ -26,18 +25,24 @@ int main() M m0, m1, m2; M om0, om1, om2; { - using LG = std::lock_guard<>; + using LG = std::scoped_lock<>; LG lg1, lg2; lg1 = lg2; // expected-error{{overload resolution selected deleted operator '='}} } { - using LG = std::lock_guard; + using LG = std::scoped_lock; + LG lg1(m0); + LG lg2(om0); + lg1 = lg2; // expected-error{{overload resolution selected deleted operator '='}} + } + { + using LG = std::scoped_lock; LG lg1(m0, m1); LG lg2(om0, om1); lg1 = lg2; // expected-error{{overload resolution selected deleted operator '='}} } { - using LG = std::lock_guard; + using LG = std::scoped_lock; LG lg1(m0, m1, m2); LG lg2(om0, om1, om2); lg1 = lg2; // expected-error{{overload resolution selected deleted operator '='}} diff --git a/test/std/thread/thread.mutex/thread.lock/thread.lock.guard/variadic_copy.fail.cpp b/test/std/thread/thread.mutex/thread.lock/thread.lock.scoped/copy.fail.cpp similarity index 65% rename from test/std/thread/thread.mutex/thread.lock/thread.lock.guard/variadic_copy.fail.cpp rename to test/std/thread/thread.mutex/thread.lock/thread.lock.scoped/copy.fail.cpp index c7fd0e94b..5075a4268 100644 --- a/test/std/thread/thread.mutex/thread.lock/thread.lock.guard/variadic_copy.fail.cpp +++ b/test/std/thread/thread.mutex/thread.lock/thread.lock.scoped/copy.fail.cpp @@ -8,34 +8,38 @@ //===----------------------------------------------------------------------===// // UNSUPPORTED: libcpp-has-no-threads -// UNSUPPORTED: c++98, c++03 +// UNSUPPORTED: c++98, c++03, c++11, c++14 // -// template class lock_guard; +// template class scoped_lock; -// lock_guard(lock_guard const&) = delete; +// scoped_lock(scoped_lock const&) = delete; -// MODULES_DEFINES: _LIBCPP_ABI_VARIADIC_LOCK_GUARD -#define _LIBCPP_ABI_VARIADIC_LOCK_GUARD #include +#include "test_macros.h" int main() { using M = std::mutex; M m0, m1, m2; { - using LG = std::lock_guard<>; + using LG = std::scoped_lock<>; const LG Orig; LG Copy(Orig); // expected-error{{call to deleted constructor of 'LG'}} } { - using LG = std::lock_guard; + using LG = std::scoped_lock; + const LG Orig(m0); + LG Copy(Orig); // expected-error{{call to deleted constructor of 'LG'}} + } + { + using LG = std::scoped_lock; const LG Orig(m0, m1); LG Copy(Orig); // expected-error{{call to deleted constructor of 'LG'}} } { - using LG = std::lock_guard; + using LG = std::scoped_lock; const LG Orig(m0, m1, m2); LG Copy(Orig); // expected-error{{call to deleted constructor of 'LG'}} } diff --git a/test/std/thread/thread.mutex/thread.lock/thread.lock.guard/variadic_mutex.fail.cpp b/test/std/thread/thread.mutex/thread.lock/thread.lock.scoped/mutex.fail.cpp similarity index 69% rename from test/std/thread/thread.mutex/thread.lock/thread.lock.guard/variadic_mutex.fail.cpp rename to test/std/thread/thread.mutex/thread.lock/thread.lock.scoped/mutex.fail.cpp index 1eef7e268..7bb467326 100644 --- a/test/std/thread/thread.mutex/thread.lock/thread.lock.guard/variadic_mutex.fail.cpp +++ b/test/std/thread/thread.mutex/thread.lock/thread.lock.scoped/mutex.fail.cpp @@ -8,17 +8,16 @@ //===----------------------------------------------------------------------===// // UNSUPPORTED: libcpp-has-no-threads -// UNSUPPORTED: c++98, c++03 +// UNSUPPORTED: c++98, c++03, c++11, c++14 // -// template class lock_guard; +// template class scoped_lock; -// explicit lock_guard(Mutex&...); +// explicit scoped_lock(Mutex&...); -// MODULES_DEFINES: _LIBCPP_ABI_VARIADIC_LOCK_GUARD -#define _LIBCPP_ABI_VARIADIC_LOCK_GUARD #include +#include "test_macros.h" template void test_conversion(LG) {} @@ -29,19 +28,25 @@ int main() M m0, m1, m2; M n0, n1, n2; { - using LG = std::lock_guard<>; + using LG = std::scoped_lock<>; LG lg = {}; // expected-error{{chosen constructor is explicit in copy-initialization}} test_conversion({}); // expected-error{{no matching function for call}} ((void)lg); } { - using LG = std::lock_guard; + using LG = std::scoped_lock; + LG lg = {m0}; // expected-error{{chosen constructor is explicit in copy-initialization}} + test_conversion({n0}); // expected-error{{no matching function for call}} + ((void)lg); + } + { + using LG = std::scoped_lock; LG lg = {m0, m1}; // expected-error{{chosen constructor is explicit in copy-initialization}} test_conversion({n0, n1}); // expected-error{{no matching function for call}} ((void)lg); } { - using LG = std::lock_guard; + using LG = std::scoped_lock; LG lg = {m0, m1, m2}; // expected-error{{chosen constructor is explicit in copy-initialization}} test_conversion({n0, n1, n2}); // expected-error{{no matching function for call}} } diff --git a/test/std/thread/thread.mutex/thread.lock/thread.lock.guard/variadic_mutex.pass.cpp b/test/std/thread/thread.mutex/thread.lock/thread.lock.scoped/mutex.pass.cpp similarity index 61% rename from test/std/thread/thread.mutex/thread.lock/thread.lock.guard/variadic_mutex.pass.cpp rename to test/std/thread/thread.mutex/thread.lock/thread.lock.scoped/mutex.pass.cpp index 8d83ddf98..cdf3ceeb6 100644 --- a/test/std/thread/thread.mutex/thread.lock/thread.lock.guard/variadic_mutex.pass.cpp +++ b/test/std/thread/thread.mutex/thread.lock/thread.lock.scoped/mutex.pass.cpp @@ -8,19 +8,16 @@ //===----------------------------------------------------------------------===// // // UNSUPPORTED: libcpp-has-no-threads -// UNSUPPORTED: c++98, c++03 +// UNSUPPORTED: c++98, c++03, c++11, c++14 // -// template class lock_guard; +// template class scoped_lock; -// explicit lock_guard(mutex_type& m); +// explicit scoped_lock(mutex_type& m); -// MODULES_DEFINES: _LIBCPP_ABI_VARIADIC_LOCK_GUARD -#define _LIBCPP_ABI_VARIADIC_LOCK_GUARD #include #include - #include "test_macros.h" struct TestMutex { @@ -68,11 +65,20 @@ struct TestMutexThrows { int main() { { - using LG = std::lock_guard<>; + using LG = std::scoped_lock<>; LG lg; } { - using LG = std::lock_guard; + using LG = std::scoped_lock; + TestMutex m1; + { + LG lg(m1); + assert(m1.locked); + } + assert(!m1.locked); + } + { + using LG = std::scoped_lock; TestMutex m1, m2; { LG lg(m1, m2); @@ -81,7 +87,7 @@ int main() assert(!m1.locked && !m2.locked); } { - using LG = std::lock_guard; + using LG = std::scoped_lock; TestMutex m1, m2, m3; { LG lg(m1, m2, m3); @@ -92,7 +98,18 @@ int main() #if !defined(TEST_HAS_NO_EXCEPTIONS) { using MT = TestMutexThrows; - using LG = std::lock_guard; + using LG = std::scoped_lock; + MT m1; + m1.throws_on_lock = true; + try { + LG lg(m1); + assert(false); + } catch (int) {} + assert(!m1.locked); + } + { + using MT = TestMutexThrows; + using LG = std::scoped_lock; MT m1, m2; m1.throws_on_lock = true; try { @@ -103,7 +120,7 @@ int main() } { using MT = TestMutexThrows; - using LG = std::lock_guard; + using LG = std::scoped_lock; MT m1, m2, m3; m2.throws_on_lock = true; try { @@ -113,4 +130,26 @@ int main() assert(!m1.locked && !m2.locked && !m3.locked); } #endif + +#ifdef __cpp_deduction_guides + { + TestMutex m1, m2, m3; + { + std::scoped_lock sl{}; + static_assert((std::is_same>::value), "" ); + } + { + std::scoped_lock sl{m1}; + static_assert((std::is_same>::value), "" ); + } + { + std::scoped_lock sl{m1, m2}; + static_assert((std::is_same>::value), "" ); + } + { + std::scoped_lock sl{m1, m2, m3}; + static_assert((std::is_same>::value), "" ); + } + } +#endif } diff --git a/test/std/thread/thread.mutex/thread.lock/thread.lock.guard/variadic_types.pass.cpp b/test/std/thread/thread.mutex/thread.lock/thread.lock.scoped/types.pass.cpp similarity index 75% rename from test/std/thread/thread.mutex/thread.lock/thread.lock.guard/variadic_types.pass.cpp rename to test/std/thread/thread.mutex/thread.lock/thread.lock.scoped/types.pass.cpp index 600399d97..6af3c6c95 100644 --- a/test/std/thread/thread.mutex/thread.lock/thread.lock.guard/variadic_types.pass.cpp +++ b/test/std/thread/thread.mutex/thread.lock/thread.lock.scoped/types.pass.cpp @@ -8,22 +8,21 @@ //===----------------------------------------------------------------------===// // // UNSUPPORTED: libcpp-has-no-threads -// UNSUPPORTED: c++98, c++03 +// UNSUPPORTED: c++98, c++03, c++11, c++14 // -// template -// class lock_guard +// template +// class scoped_lock // { // public: -// typedef Mutex mutex_type; +// typedef Mutex mutex_type; // only if sizeof...(Mutex) == 1 // ... // }; -// MODULES_DEFINES: _LIBCPP_ABI_VARIADIC_LOCK_GUARD -#define _LIBCPP_ABI_VARIADIC_LOCK_GUARD #include #include +#include "test_macros.h" struct NAT {}; @@ -41,39 +40,39 @@ constexpr bool has_mutex_type() { int main() { { - using T = std::lock_guard<>; + using T = std::scoped_lock<>; static_assert(!has_mutex_type(), ""); } { using M1 = std::mutex; - using T = std::lock_guard; + using T = std::scoped_lock; static_assert(std::is_same::value, ""); } { using M1 = std::recursive_mutex; - using T = std::lock_guard; + using T = std::scoped_lock; static_assert(std::is_same::value, ""); } { using M1 = std::mutex; using M2 = std::recursive_mutex; - using T = std::lock_guard; + using T = std::scoped_lock; static_assert(!has_mutex_type(), ""); } { using M1 = std::mutex; using M2 = std::recursive_mutex; - using T = std::lock_guard; + using T = std::scoped_lock; static_assert(!has_mutex_type(), ""); } { using M1 = std::mutex; - using T = std::lock_guard; + using T = std::scoped_lock; static_assert(!has_mutex_type(), ""); } { using M1 = std::recursive_mutex; - using T = std::lock_guard; + using T = std::scoped_lock; static_assert(!has_mutex_type(), ""); } } diff --git a/test/std/thread/thread.mutex/thread.lock/thread.lock.shared/lit.local.cfg b/test/std/thread/thread.mutex/thread.lock/thread.lock.shared/lit.local.cfg new file mode 100644 index 000000000..fd3dc778c --- /dev/null +++ b/test/std/thread/thread.mutex/thread.lock/thread.lock.shared/lit.local.cfg @@ -0,0 +1,2 @@ +if 'availability' in config.available_features: + config.unsupported = True 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 f9a537085..ac338064d 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 @@ -18,6 +18,9 @@ // explicit shared_lock(mutex_type& m); +// template shared_lock(shared_lock<_Mutex>) +// -> shared_lock<_Mutex>; // C++17 + #include #include #include @@ -92,4 +95,9 @@ int main() t.join(); q.join(); } + +#ifdef __cpp_deduction_guides + std::shared_lock sl(m); + static_assert((std::is_same>::value), "" ); +#endif } diff --git a/test/std/thread/thread.mutex/thread.lock/thread.lock.unique/thread.lock.unique.cons/mutex.pass.cpp b/test/std/thread/thread.mutex/thread.lock/thread.lock.unique/thread.lock.unique.cons/mutex.pass.cpp index 1f7217a83..ca8bc6982 100644 --- a/test/std/thread/thread.mutex/thread.lock/thread.lock.unique/thread.lock.unique.cons/mutex.pass.cpp +++ b/test/std/thread/thread.mutex/thread.lock/thread.lock.unique/thread.lock.unique.cons/mutex.pass.cpp @@ -15,11 +15,16 @@ // explicit unique_lock(mutex_type& m); +// template unique_lock(unique_lock<_Mutex>) +// -> unique_lock<_Mutex>; // C++17 + #include #include #include #include +#include "test_macros.h" + std::mutex m; typedef std::chrono::system_clock Clock; @@ -47,4 +52,9 @@ int main() std::this_thread::sleep_for(ms(250)); m.unlock(); t.join(); + +#ifdef __cpp_deduction_guides + std::unique_lock ul(m); + static_assert((std::is_same>::value), "" ); +#endif } diff --git a/test/std/thread/thread.mutex/thread.mutex.requirements/thread.mutex.requirements.mutex/thread.mutex.class/default.pass.cpp b/test/std/thread/thread.mutex/thread.mutex.requirements/thread.mutex.requirements.mutex/thread.mutex.class/default.pass.cpp index 4de42fbd0..48c3a73a0 100644 --- a/test/std/thread/thread.mutex/thread.mutex.requirements/thread.mutex.requirements.mutex/thread.mutex.class/default.pass.cpp +++ b/test/std/thread/thread.mutex/thread.mutex.requirements/thread.mutex.requirements.mutex/thread.mutex.class/default.pass.cpp @@ -16,8 +16,10 @@ // mutex(); #include +#include int main() { + static_assert(std::is_nothrow_default_constructible::value, ""); std::mutex m; } diff --git a/test/std/thread/thread.mutex/thread.mutex.requirements/thread.shared_mutex.requirements/lit.local.cfg b/test/std/thread/thread.mutex/thread.mutex.requirements/thread.shared_mutex.requirements/lit.local.cfg new file mode 100644 index 000000000..fd3dc778c --- /dev/null +++ b/test/std/thread/thread.mutex/thread.mutex.requirements/thread.shared_mutex.requirements/lit.local.cfg @@ -0,0 +1,2 @@ +if 'availability' in config.available_features: + config.unsupported = True diff --git a/test/std/thread/thread.mutex/thread.mutex.requirements/thread.sharedtimedmutex.requirements/lit.local.cfg b/test/std/thread/thread.mutex/thread.mutex.requirements/thread.sharedtimedmutex.requirements/lit.local.cfg new file mode 100644 index 000000000..fd3dc778c --- /dev/null +++ b/test/std/thread/thread.mutex/thread.mutex.requirements/thread.sharedtimedmutex.requirements/lit.local.cfg @@ -0,0 +1,2 @@ +if 'availability' in config.available_features: + config.unsupported = True 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 138b65719..dfd2f10b7 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 @@ -66,7 +66,7 @@ void f3() #endif } -#ifndef _LIBCPP_HAS_NO_VARIADICS +#if TEST_STD_VER >= 11 struct init1 { @@ -101,7 +101,7 @@ void f2() std::call_once(flg2, init2(), 4, 5); } -#endif // _LIBCPP_HAS_NO_VARIADICS +#endif // TEST_STD_VER >= 11 std::once_flag flg41; std::once_flag flg42; @@ -135,7 +135,7 @@ void f42() std::call_once(flg41, init41); } -#ifndef _LIBCPP_HAS_NO_VARIADICS +#if TEST_STD_VER >= 11 class MoveOnly { @@ -174,7 +174,6 @@ public: void operator()(int&) {} }; -#if TEST_STD_VER >= 11 // reference qualifiers on functions are a C++11 extension struct RefQual { @@ -185,8 +184,8 @@ struct RefQual void operator()() & { ++lv_called; } void operator()() && { ++rv_called; } }; -#endif -#endif + +#endif // TEST_STD_VER >= 11 int main() { @@ -218,7 +217,7 @@ int main() assert(init41_called == 1); assert(init42_called == 1); } -#ifndef _LIBCPP_HAS_NO_VARIADICS +#if TEST_STD_VER >= 11 // check functors with 1 arg { std::thread t0(f1); @@ -245,7 +244,6 @@ int main() int i = 0; std::call_once(f, NonCopyable(), i); } -#if TEST_STD_VER >= 11 // reference qualifiers on functions are a C++11 extension { std::once_flag f1, f2; @@ -255,6 +253,5 @@ int main() std::call_once(f2, std::move(rq)); assert(rq.rv_called == 1); } -#endif -#endif // _LIBCPP_HAS_NO_VARIADICS +#endif // TEST_STD_VER >= 11 } diff --git a/test/std/thread/thread.mutex/thread.once/thread.once.onceflag/default.pass.cpp b/test/std/thread/thread.mutex/thread.once/thread.once.onceflag/default.pass.cpp index 6995f0648..21011ed17 100644 --- a/test/std/thread/thread.mutex/thread.once/thread.once.onceflag/default.pass.cpp +++ b/test/std/thread/thread.mutex/thread.once/thread.once.onceflag/default.pass.cpp @@ -14,13 +14,14 @@ // constexpr once_flag() noexcept; #include +#include "test_macros.h" int main() { { std::once_flag f; } -#ifndef _LIBCPP_HAS_NO_CONSTEXPR +#if TEST_STD_VER >= 11 { constexpr std::once_flag f; } diff --git a/test/std/thread/thread.threads/thread.thread.class/thread.thread.id/thread_id.pass.cpp b/test/std/thread/thread.threads/thread.thread.class/thread.thread.id/thread_id.pass.cpp index f7d4deb8f..4f1491dec 100644 --- a/test/std/thread/thread.threads/thread.thread.class/thread.thread.id/thread_id.pass.cpp +++ b/test/std/thread/thread.threads/thread.thread.class/thread.thread.id/thread_id.pass.cpp @@ -23,6 +23,8 @@ #include #include +#include "test_macros.h" + int main() { std::thread::id id1; @@ -30,6 +32,7 @@ int main() typedef std::hash H; static_assert((std::is_same::value), "" ); static_assert((std::is_same::value), "" ); + ASSERT_NOEXCEPT(H()(id2)); H h; assert(h(id1) != h(id2)); } diff --git a/test/std/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/pointer02.fail.cpp b/test/std/thread/thread.threads/thread.thread.this/sleep_for_tested_elsewhere.pass.cpp similarity index 55% rename from test/std/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/pointer02.fail.cpp rename to test/std/thread/thread.threads/thread.thread.this/sleep_for_tested_elsewhere.pass.cpp index af7f27f73..3406fff70 100644 --- a/test/std/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/pointer02.fail.cpp +++ b/test/std/thread/thread.threads/thread.thread.this/sleep_for_tested_elsewhere.pass.cpp @@ -1,3 +1,4 @@ +// -*- C++ -*- //===----------------------------------------------------------------------===// // // The LLVM Compiler Infrastructure @@ -7,23 +8,15 @@ // //===----------------------------------------------------------------------===// -// +// -// unique_ptr +// template +// void sleep_for(const chrono::duration& rel_time); -// Test unique_ptr(pointer) ctor - -#include - -// unique_ptr(pointer) ctor should require non-reference Deleter ctor -class Deleter -{ -public: - - void operator()(void*) {} -}; +// The std::this_thread::sleep_for test requires POSIX specific headers and +// is therefore non-standard. For this reason the test lives under the 'libcxx' +// subdirectory. int main() { - std::unique_ptr p(new int); } diff --git a/test/std/utilities/allocator.adaptor/allocator.adaptor.cnstr/allocs.pass.cpp b/test/std/utilities/allocator.adaptor/allocator.adaptor.cnstr/allocs.pass.cpp index 0aef2af85..2aa19c618 100644 --- a/test/std/utilities/allocator.adaptor/allocator.adaptor.cnstr/allocs.pass.cpp +++ b/test/std/utilities/allocator.adaptor/allocator.adaptor.cnstr/allocs.pass.cpp @@ -107,5 +107,11 @@ int main() assert((a.inner_allocator() == std::scoped_allocator_adaptor, A3>(A2(5), A3(6)))); } - +// Test for LWG2782 + { + static_assert(!std::is_convertible, A2>::value, ""); + static_assert(!std::is_convertible< + std::scoped_allocator_adaptor>, + std::scoped_allocator_adaptor>>::value, ""); + } } diff --git a/test/std/utilities/allocator.adaptor/allocator.adaptor.members/construct_pair.pass.cpp b/test/std/utilities/allocator.adaptor/allocator.adaptor.members/construct_pair.pass.cpp index 4e73d8064..82d63ecad 100644 --- a/test/std/utilities/allocator.adaptor/allocator.adaptor.members/construct_pair.pass.cpp +++ b/test/std/utilities/allocator.adaptor/allocator.adaptor.members/construct_pair.pass.cpp @@ -39,6 +39,7 @@ void test_no_inner_alloc() using SA = std::scoped_allocator_adaptor; static_assert(std::uses_allocator >::value, ""); Pair * ptr = (Pair*)std::malloc(sizeof(Pair)); + assert(ptr); Alloc CA(P); SA A(CA); A.construct(ptr); @@ -61,6 +62,7 @@ void test_no_inner_alloc() using SA = std::scoped_allocator_adaptor; static_assert(std::uses_allocator >::value, ""); Pair * ptr = (Pair*)std::malloc(sizeof(Pair)); + assert(ptr); Alloc CA(P); SA A(CA); A.construct(ptr); @@ -77,7 +79,6 @@ void test_no_inner_alloc() void test_with_inner_alloc() { - using VoidAlloc1 = CountingAllocator; using VoidAlloc2 = CountingAllocator; AllocController POuter; @@ -93,6 +94,7 @@ void test_with_inner_alloc() static_assert(!std::uses_allocator::value, ""); static_assert(std::uses_allocator::value, ""); Pair * ptr = (Pair*)std::malloc(sizeof(Pair)); + assert(ptr); Outer O(POuter); Inner I(PInner); SA A(O, I); @@ -119,6 +121,7 @@ void test_with_inner_alloc() static_assert(!std::uses_allocator::value, ""); static_assert(std::uses_allocator::value, ""); Pair * ptr = (Pair*)std::malloc(sizeof(Pair)); + assert(ptr); Outer O(POuter); Inner I(PInner); SA A(O, I); diff --git a/test/std/utilities/any/any.class/any.assign/copy.pass.cpp b/test/std/utilities/any/any.class/any.assign/copy.pass.cpp index eba9bc6d5..37618f7aa 100644 --- a/test/std/utilities/any/any.class/any.assign/copy.pass.cpp +++ b/test/std/utilities/any/any.class/any.assign/copy.pass.cpp @@ -9,6 +9,13 @@ // UNSUPPORTED: c++98, c++03, c++11, c++14 +// XFAIL: with_system_cxx_lib=macosx10.12 +// XFAIL: with_system_cxx_lib=macosx10.11 +// XFAIL: with_system_cxx_lib=macosx10.10 +// XFAIL: with_system_cxx_lib=macosx10.9 +// XFAIL: with_system_cxx_lib=macosx10.7 +// XFAIL: with_system_cxx_lib=macosx10.8 + // // any& operator=(any const &); diff --git a/test/std/utilities/any/any.class/any.assign/move.pass.cpp b/test/std/utilities/any/any.class/any.assign/move.pass.cpp index 2063e4f1e..418f200be 100644 --- a/test/std/utilities/any/any.class/any.assign/move.pass.cpp +++ b/test/std/utilities/any/any.class/any.assign/move.pass.cpp @@ -9,6 +9,13 @@ // UNSUPPORTED: c++98, c++03, c++11, c++14 +// XFAIL: with_system_cxx_lib=macosx10.12 +// XFAIL: with_system_cxx_lib=macosx10.11 +// XFAIL: with_system_cxx_lib=macosx10.10 +// XFAIL: with_system_cxx_lib=macosx10.9 +// XFAIL: with_system_cxx_lib=macosx10.7 +// XFAIL: with_system_cxx_lib=macosx10.8 + // // any& operator=(any &&); diff --git a/test/std/utilities/any/any.class/any.assign/value.pass.cpp b/test/std/utilities/any/any.class/any.assign/value.pass.cpp index 6af481714..ddedb886c 100644 --- a/test/std/utilities/any/any.class/any.assign/value.pass.cpp +++ b/test/std/utilities/any/any.class/any.assign/value.pass.cpp @@ -9,6 +9,13 @@ // UNSUPPORTED: c++98, c++03, c++11, c++14 +// XFAIL: with_system_cxx_lib=macosx10.12 +// XFAIL: with_system_cxx_lib=macosx10.11 +// XFAIL: with_system_cxx_lib=macosx10.10 +// XFAIL: with_system_cxx_lib=macosx10.9 +// XFAIL: with_system_cxx_lib=macosx10.7 +// XFAIL: with_system_cxx_lib=macosx10.8 + // // template diff --git a/test/std/utilities/any/any.class/any.cons/copy.pass.cpp b/test/std/utilities/any/any.class/any.cons/copy.pass.cpp index 021c9e452..aceb9e6cf 100644 --- a/test/std/utilities/any/any.class/any.cons/copy.pass.cpp +++ b/test/std/utilities/any/any.class/any.cons/copy.pass.cpp @@ -9,6 +9,13 @@ // UNSUPPORTED: c++98, c++03, c++11, c++14 +// XFAIL: with_system_cxx_lib=macosx10.12 +// XFAIL: with_system_cxx_lib=macosx10.11 +// XFAIL: with_system_cxx_lib=macosx10.10 +// XFAIL: with_system_cxx_lib=macosx10.9 +// XFAIL: with_system_cxx_lib=macosx10.7 +// XFAIL: with_system_cxx_lib=macosx10.8 + // // any(any const &); diff --git a/test/std/utilities/any/any.class/any.cons/in_place_type.pass.cpp b/test/std/utilities/any/any.class/any.cons/in_place_type.pass.cpp index 4cf5d914f..d01a88da5 100644 --- a/test/std/utilities/any/any.class/any.cons/in_place_type.pass.cpp +++ b/test/std/utilities/any/any.class/any.cons/in_place_type.pass.cpp @@ -9,6 +9,13 @@ // UNSUPPORTED: c++98, c++03, c++11, c++14 +// XFAIL: with_system_cxx_lib=macosx10.12 +// XFAIL: with_system_cxx_lib=macosx10.11 +// XFAIL: with_system_cxx_lib=macosx10.10 +// XFAIL: with_system_cxx_lib=macosx10.9 +// XFAIL: with_system_cxx_lib=macosx10.7 +// XFAIL: with_system_cxx_lib=macosx10.8 + // // template any(in_place_type_t, Args&&...); diff --git a/test/std/utilities/any/any.class/any.cons/move.pass.cpp b/test/std/utilities/any/any.class/any.cons/move.pass.cpp index fb7dda886..09e9288e0 100644 --- a/test/std/utilities/any/any.class/any.cons/move.pass.cpp +++ b/test/std/utilities/any/any.class/any.cons/move.pass.cpp @@ -9,6 +9,13 @@ // UNSUPPORTED: c++98, c++03, c++11, c++14 +// XFAIL: with_system_cxx_lib=macosx10.12 +// XFAIL: with_system_cxx_lib=macosx10.11 +// XFAIL: with_system_cxx_lib=macosx10.10 +// XFAIL: with_system_cxx_lib=macosx10.9 +// XFAIL: with_system_cxx_lib=macosx10.7 +// XFAIL: with_system_cxx_lib=macosx10.8 + // // any(any &&) noexcept; diff --git a/test/std/utilities/any/any.class/any.cons/value.pass.cpp b/test/std/utilities/any/any.class/any.cons/value.pass.cpp index a164fbeb5..d18de0664 100644 --- a/test/std/utilities/any/any.class/any.cons/value.pass.cpp +++ b/test/std/utilities/any/any.class/any.cons/value.pass.cpp @@ -9,6 +9,13 @@ // UNSUPPORTED: c++98, c++03, c++11, c++14 +// XFAIL: with_system_cxx_lib=macosx10.12 +// XFAIL: with_system_cxx_lib=macosx10.11 +// XFAIL: with_system_cxx_lib=macosx10.10 +// XFAIL: with_system_cxx_lib=macosx10.9 +// XFAIL: with_system_cxx_lib=macosx10.7 +// XFAIL: with_system_cxx_lib=macosx10.8 + // // template any(Value &&) @@ -151,4 +158,4 @@ int main() { test_copy_value_throws(); test_move_value_throws(); test_sfinae_constraints(); -} \ No newline at end of file +} diff --git a/test/std/utilities/any/any.class/any.modifiers/emplace.pass.cpp b/test/std/utilities/any/any.class/any.modifiers/emplace.pass.cpp index 65d94fd1e..789a861ee 100644 --- a/test/std/utilities/any/any.class/any.modifiers/emplace.pass.cpp +++ b/test/std/utilities/any/any.class/any.modifiers/emplace.pass.cpp @@ -9,11 +9,18 @@ // UNSUPPORTED: c++98, c++03, c++11, c++14 +// XFAIL: with_system_cxx_lib=macosx10.12 +// XFAIL: with_system_cxx_lib=macosx10.11 +// XFAIL: with_system_cxx_lib=macosx10.10 +// XFAIL: with_system_cxx_lib=macosx10.9 +// XFAIL: with_system_cxx_lib=macosx10.7 +// XFAIL: with_system_cxx_lib=macosx10.8 + // -// template emplace(Args&&...); +// template T& emplace(Args&&...); // template -// void emplace(initializer_list, Args&&...); +// T& emplace(initializer_list, Args&&...); #include #include @@ -42,7 +49,9 @@ void test_emplace_type() { any a(std::in_place_type); assert(Tracked::count == 1); - a.emplace(); + auto &v = a.emplace(); + static_assert( std::is_same_v, "" ); + assert(&v == std::any_cast(&a)); assert(Tracked::count == 0); assert(Type::count == 1); @@ -56,7 +65,9 @@ void test_emplace_type() { any a(std::in_place_type); assert(Tracked::count == 1); - a.emplace(101); + auto &v = a.emplace(101); + static_assert( std::is_same_v, "" ); + assert(&v == std::any_cast(&a)); assert(Tracked::count == 0); assert(Type::count == 1); @@ -70,7 +81,9 @@ void test_emplace_type() { any a(std::in_place_type); assert(Tracked::count == 1); - a.emplace(-1, 42, -1); + auto &v = a.emplace(-1, 42, -1); + static_assert( std::is_same_v, "" ); + assert(&v == std::any_cast(&a)); assert(Tracked::count == 0); assert(Type::count == 1); @@ -89,14 +102,20 @@ void test_emplace_type_tracked() { { any a(std::in_place_type); assert(Tracked::count == 1); - a.emplace(); + auto &v = a.emplace(); + static_assert( std::is_same_v, "" ); + assert(&v == std::any_cast(&a)); + assert(Tracked::count == 0); assertArgsMatch(a); } { any a(std::in_place_type); assert(Tracked::count == 1); - a.emplace(-1, 42, -1); + auto &v = a.emplace(-1, 42, -1); + static_assert( std::is_same_v, "" ); + assert(&v == std::any_cast(&a)); + assert(Tracked::count == 0); assertArgsMatch(a); } @@ -104,7 +123,10 @@ void test_emplace_type_tracked() { { any a(std::in_place_type); assert(Tracked::count == 1); - a.emplace({-1, 42, -1}); + auto &v = a.emplace({-1, 42, -1}); + static_assert( std::is_same_v, "" ); + assert(&v == std::any_cast(&a)); + assert(Tracked::count == 0); assertArgsMatch>(a); } @@ -112,7 +134,10 @@ void test_emplace_type_tracked() { int x = 42; any a(std::in_place_type); assert(Tracked::count == 1); - a.emplace({-1, 42, -1}, x); + auto &v = a.emplace({-1, 42, -1}, x); + static_assert( std::is_same_v, "" ); + assert(&v == std::any_cast(&a)); + assert(Tracked::count == 0); assertArgsMatch, int&>(a); } @@ -141,7 +166,8 @@ void test_emplace_throws() std::any a(small{42}); assert(small::count == 1); try { - a.emplace(101); + auto &v = a.emplace(101); + static_assert( std::is_same_v, "" ); assert(false); } catch (int const&) { } @@ -151,7 +177,8 @@ void test_emplace_throws() std::any a(small{42}); assert(small::count == 1); try { - a.emplace({1, 2, 3}, 101); + auto &v = a.emplace({1, 2, 3}, 101); + static_assert( std::is_same_v, "" ); assert(false); } catch (int const&) { } @@ -162,7 +189,8 @@ void test_emplace_throws() std::any a(large{42}); assert(large::count == 1); try { - a.emplace(101); + auto &v = a.emplace(101); + static_assert( std::is_same_v, "" ); assert(false); } catch (int const&) { } @@ -172,7 +200,8 @@ void test_emplace_throws() std::any a(large{42}); assert(large::count == 1); try { - a.emplace({1, 2, 3}, 101); + auto &v = a.emplace({1, 2, 3}, 101); + static_assert( std::is_same_v, "" ); assert(false); } catch (int const&) { } diff --git a/test/std/utilities/any/any.class/any.modifiers/reset.pass.cpp b/test/std/utilities/any/any.class/any.modifiers/reset.pass.cpp index 45bc70f7a..2e781d954 100644 --- a/test/std/utilities/any/any.class/any.modifiers/reset.pass.cpp +++ b/test/std/utilities/any/any.class/any.modifiers/reset.pass.cpp @@ -9,6 +9,13 @@ // UNSUPPORTED: c++98, c++03, c++11, c++14 +// XFAIL: with_system_cxx_lib=macosx10.12 +// XFAIL: with_system_cxx_lib=macosx10.11 +// XFAIL: with_system_cxx_lib=macosx10.10 +// XFAIL: with_system_cxx_lib=macosx10.9 +// XFAIL: with_system_cxx_lib=macosx10.7 +// XFAIL: with_system_cxx_lib=macosx10.8 + // // any::reset() noexcept diff --git a/test/std/utilities/any/any.class/any.modifiers/swap.pass.cpp b/test/std/utilities/any/any.class/any.modifiers/swap.pass.cpp index 6fc100943..f56a25656 100644 --- a/test/std/utilities/any/any.class/any.modifiers/swap.pass.cpp +++ b/test/std/utilities/any/any.class/any.modifiers/swap.pass.cpp @@ -9,6 +9,13 @@ // UNSUPPORTED: c++98, c++03, c++11, c++14 +// XFAIL: with_system_cxx_lib=macosx10.12 +// XFAIL: with_system_cxx_lib=macosx10.11 +// XFAIL: with_system_cxx_lib=macosx10.10 +// XFAIL: with_system_cxx_lib=macosx10.9 +// XFAIL: with_system_cxx_lib=macosx10.7 +// XFAIL: with_system_cxx_lib=macosx10.8 + // // any::swap(any &) noexcept diff --git a/test/std/utilities/any/any.nonmembers/any.cast/any_cast_pointer.pass.cpp b/test/std/utilities/any/any.nonmembers/any.cast/any_cast_pointer.pass.cpp index 1a5a85482..a5fa93218 100644 --- a/test/std/utilities/any/any.nonmembers/any.cast/any_cast_pointer.pass.cpp +++ b/test/std/utilities/any/any.nonmembers/any.cast/any_cast_pointer.pass.cpp @@ -9,6 +9,13 @@ // UNSUPPORTED: c++98, c++03, c++11, c++14 +// XFAIL: with_system_cxx_lib=macosx10.12 +// XFAIL: with_system_cxx_lib=macosx10.11 +// XFAIL: with_system_cxx_lib=macosx10.10 +// XFAIL: with_system_cxx_lib=macosx10.9 +// XFAIL: with_system_cxx_lib=macosx10.7 +// XFAIL: with_system_cxx_lib=macosx10.8 + // // template diff --git a/test/std/utilities/any/any.nonmembers/any.cast/any_cast_reference.pass.cpp b/test/std/utilities/any/any.nonmembers/any.cast/any_cast_reference.pass.cpp index af081ecce..ed04a91ca 100644 --- a/test/std/utilities/any/any.nonmembers/any.cast/any_cast_reference.pass.cpp +++ b/test/std/utilities/any/any.nonmembers/any.cast/any_cast_reference.pass.cpp @@ -9,6 +9,13 @@ // UNSUPPORTED: c++98, c++03, c++11, c++14 +// XFAIL: with_system_cxx_lib=macosx10.12 +// XFAIL: with_system_cxx_lib=macosx10.11 +// XFAIL: with_system_cxx_lib=macosx10.10 +// XFAIL: with_system_cxx_lib=macosx10.9 +// XFAIL: with_system_cxx_lib=macosx10.7 +// XFAIL: with_system_cxx_lib=macosx10.8 + // // template diff --git a/test/std/utilities/any/any.nonmembers/any.cast/reference_types.fail.cpp b/test/std/utilities/any/any.nonmembers/any.cast/reference_types.fail.cpp index 99cc02997..bbc135051 100644 --- a/test/std/utilities/any/any.nonmembers/any.cast/reference_types.fail.cpp +++ b/test/std/utilities/any/any.nonmembers/any.cast/reference_types.fail.cpp @@ -25,13 +25,30 @@ using std::any_cast; int main() { any a(1); - any_cast(&a); // expected-error@any:* 1 {{static_assert failed "_ValueType may not be a reference."}} - any_cast(&a); // expected-error@any:* 1 {{static_assert failed "_ValueType may not be a reference."}} - any_cast(&a); // expected-error@any:* 1 {{static_assert failed "_ValueType may not be a reference."}} - any_cast(&a); // expected-error@any:* 1 {{static_assert failed "_ValueType may not be a reference."}} + + // expected-error@any:* 1 {{static_assert failed "_ValueType may not be a reference."}} + any_cast(&a); // expected-note {{requested here}} + + // expected-error@any:* 1 {{static_assert failed "_ValueType may not be a reference."}} + any_cast(&a); // expected-note {{requested here}} + + // expected-error@any:* 1 {{static_assert failed "_ValueType may not be a reference."}} + any_cast(&a); // expected-note {{requested here}} + + // expected-error@any:* 1 {{static_assert failed "_ValueType may not be a reference."}} + any_cast(&a); // expected-note {{requested here}} + any const& a2 = a; - any_cast(&a2); // expected-error@any:* 1 {{static_assert failed "_ValueType may not be a reference."}} - any_cast(&a2); // expected-error@any:* 1 {{static_assert failed "_ValueType may not be a reference."}} - any_cast(&a2); // expected-error@any:* 1 {{static_assert failed "_ValueType may not be a reference."}} - any_cast(&a2); // expected-error@any:* 1 {{static_assert failed "_ValueType may not be a reference."}} + + // expected-error@any:* 1 {{static_assert failed "_ValueType may not be a reference."}} + any_cast(&a2); // expected-note {{requested here}} + + // expected-error@any:* 1 {{static_assert failed "_ValueType may not be a reference."}} + any_cast(&a2); // expected-note {{requested here}} + + // expected-error@any:* 1 {{static_assert failed "_ValueType may not be a reference."}} + any_cast(&a2); // expected-note {{requested here}} + + // expected-error@any:* 1 {{static_assert failed "_ValueType may not be a reference."}} + any_cast(&a2); // expected-note {{requested here}} } diff --git a/test/std/utilities/any/any.nonmembers/make_any.pass.cpp b/test/std/utilities/any/any.nonmembers/make_any.pass.cpp index 59c06be6a..5a4a3c3c1 100644 --- a/test/std/utilities/any/any.nonmembers/make_any.pass.cpp +++ b/test/std/utilities/any/any.nonmembers/make_any.pass.cpp @@ -9,6 +9,13 @@ // UNSUPPORTED: c++98, c++03, c++11, c++14 +// XFAIL: with_system_cxx_lib=macosx10.12 +// XFAIL: with_system_cxx_lib=macosx10.11 +// XFAIL: with_system_cxx_lib=macosx10.10 +// XFAIL: with_system_cxx_lib=macosx10.9 +// XFAIL: with_system_cxx_lib=macosx10.7 +// XFAIL: with_system_cxx_lib=macosx10.8 + // // template any make_any(Args&&...); diff --git a/test/std/utilities/any/any.nonmembers/swap.pass.cpp b/test/std/utilities/any/any.nonmembers/swap.pass.cpp index 1b3785bb1..c723b6e08 100644 --- a/test/std/utilities/any/any.nonmembers/swap.pass.cpp +++ b/test/std/utilities/any/any.nonmembers/swap.pass.cpp @@ -9,6 +9,13 @@ // UNSUPPORTED: c++98, c++03, c++11, c++14 +// XFAIL: with_system_cxx_lib=macosx10.12 +// XFAIL: with_system_cxx_lib=macosx10.11 +// XFAIL: with_system_cxx_lib=macosx10.10 +// XFAIL: with_system_cxx_lib=macosx10.9 +// XFAIL: with_system_cxx_lib=macosx10.7 +// XFAIL: with_system_cxx_lib=macosx10.8 + // // void swap(any &, any &) noexcept diff --git a/test/std/utilities/function.objects/func.not_fn/not_fn.pass.cpp b/test/std/utilities/function.objects/func.not_fn/not_fn.pass.cpp index 2b19211be..aa8eb3916 100644 --- a/test/std/utilities/function.objects/func.not_fn/not_fn.pass.cpp +++ b/test/std/utilities/function.objects/func.not_fn/not_fn.pass.cpp @@ -416,7 +416,7 @@ void throws_in_constructor_test() ThrowsOnCopy() = default; bool operator()() const { assert(false); -#if defined(_LIBCPP_MSVC) +#if defined(TEST_COMPILER_C1XX) __assume(0); #else __builtin_unreachable(); diff --git a/test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/copy_move.pass.cpp b/test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/copy_move.pass.cpp index 9d5681a3d..7516b2e3a 100644 --- a/test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/copy_move.pass.cpp +++ b/test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/copy_move.pass.cpp @@ -11,7 +11,8 @@ // class function -// function(const function& f); +// function(const function& f); +// function(const function&& f); #include #include diff --git a/test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.targ/target.pass.cpp b/test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.targ/target.pass.cpp index 53476a274..7a4678ad1 100644 --- a/test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.targ/target.pass.cpp +++ b/test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.targ/target.pass.cpp @@ -63,6 +63,7 @@ int main() assert(A::count == 1); assert(f.target()); assert(f.target() == 0); + assert(f.target() == nullptr); } assert(A::count == 0); { @@ -70,6 +71,7 @@ int main() assert(A::count == 0); assert(f.target()); assert(f.target() == 0); + assert(f.target() == nullptr); } assert(A::count == 0); { @@ -77,6 +79,7 @@ int main() assert(A::count == 1); assert(f.target()); assert(f.target() == 0); + assert(f.target() == nullptr); } assert(A::count == 0); { @@ -84,6 +87,7 @@ int main() assert(A::count == 0); assert(f.target()); assert(f.target() == 0); + assert(f.target() == nullptr); } assert(A::count == 0); } diff --git a/test/std/utilities/function.objects/unord.hash/enum.pass.cpp b/test/std/utilities/function.objects/unord.hash/enum.pass.cpp index 09ea034b7..a7ddd9a49 100644 --- a/test/std/utilities/function.objects/unord.hash/enum.pass.cpp +++ b/test/std/utilities/function.objects/unord.hash/enum.pass.cpp @@ -36,6 +36,7 @@ test() typedef std::hash H; static_assert((std::is_same::value), "" ); static_assert((std::is_same::value), "" ); + ASSERT_NOEXCEPT(H()(T())); typedef typename std::underlying_type::type under_type; H h1; diff --git a/test/std/utilities/function.objects/unord.hash/floating.pass.cpp b/test/std/utilities/function.objects/unord.hash/floating.pass.cpp index 643e2d8c5..e67aa016c 100644 --- a/test/std/utilities/function.objects/unord.hash/floating.pass.cpp +++ b/test/std/utilities/function.objects/unord.hash/floating.pass.cpp @@ -24,6 +24,8 @@ #include #include +#include "test_macros.h" + template void test() @@ -31,6 +33,7 @@ test() typedef std::hash H; static_assert((std::is_same::value), "" ); static_assert((std::is_same::value), "" ); + ASSERT_NOEXCEPT(H()(T())); H h; std::size_t t0 = h(0.); 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 08a2a8c71..ce87f5918 100644 --- a/test/std/utilities/function.objects/unord.hash/integral.pass.cpp +++ b/test/std/utilities/function.objects/unord.hash/integral.pass.cpp @@ -31,6 +31,7 @@ test() typedef std::hash H; static_assert((std::is_same::value), "" ); static_assert((std::is_same::value), "" ); + ASSERT_NOEXCEPT(H()(T())); H h; for (int i = 0; i <= 5; ++i) @@ -64,42 +65,42 @@ int main() test(); test(); -// LWG #2119 +// LWG #2119 test(); test(); - test(); - test(); - test(); - test(); + test(); + test(); + test(); + test(); - test(); - test(); - test(); - test(); + test(); + test(); + test(); + test(); - test(); - test(); - test(); - test(); + test(); + test(); + test(); + test(); test(); test(); - test(); - test(); - test(); - test(); + test(); + test(); + test(); + test(); - test(); - test(); - test(); - test(); + test(); + test(); + test(); + test(); - test(); - test(); - test(); - test(); + test(); + test(); + test(); + test(); test(); test(); diff --git a/test/std/utilities/function.objects/unord.hash/pointer.pass.cpp b/test/std/utilities/function.objects/unord.hash/pointer.pass.cpp index a48394495..36280a38e 100644 --- a/test/std/utilities/function.objects/unord.hash/pointer.pass.cpp +++ b/test/std/utilities/function.objects/unord.hash/pointer.pass.cpp @@ -23,6 +23,8 @@ #include #include +#include "test_macros.h" + template void test() @@ -30,6 +32,7 @@ test() typedef std::hash H; static_assert((std::is_same::value), "" ); static_assert((std::is_same::value), "" ); + ASSERT_NOEXCEPT(H()(T())); H h; typedef typename std::remove_pointer::type type; @@ -38,7 +41,20 @@ test() assert(h(&i) != h(&j)); } +// can't hash nullptr_t until c++17 +void test_nullptr() +{ +#if TEST_STD_VER > 14 + typedef std::nullptr_t T; + typedef std::hash H; + static_assert((std::is_same::value), "" ); + static_assert((std::is_same::value), "" ); + ASSERT_NOEXCEPT(H()(T())); +#endif +} + int main() { test(); + test_nullptr(); } diff --git a/test/std/utilities/memory/unique.ptr/unique.ptr.runtime/move01.pass.cpp b/test/std/utilities/memory/unique.ptr/unique.ptr.runtime/move01.pass.cpp deleted file mode 100644 index a29c52764..000000000 --- a/test/std/utilities/memory/unique.ptr/unique.ptr.runtime/move01.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. -// -//===----------------------------------------------------------------------===// - -// - -// unique_ptr - -// Test unique_ptr move assignment - -// test move assignment. Should only require a MoveConstructible deleter, or if -// deleter is a reference, not even that. - -#include -#include -#include - -#include "deleter_types.h" - -struct A -{ - static int count; - A() {++count;} - A(const A&) {++count;} - ~A() {--count;} -}; - -int A::count = 0; - -int main() -{ - { - std::unique_ptr s1(new A[3]); - A* p = s1.get(); - assert(A::count == 3); - std::unique_ptr s2(new A[2]); - assert(A::count == 5); - s2 = std::move(s1); - assert(A::count == 3); - assert(s2.get() == p); - assert(s1.get() == 0); - } - assert(A::count == 0); - { - std::unique_ptr > s1(new A[4], Deleter(5)); - A* p = s1.get(); - assert(A::count == 4); - std::unique_ptr > s2(new A[5]); - assert(A::count == 9); - s2 = std::move(s1); - assert(s2.get() == p); - assert(s1.get() == 0); - assert(A::count == 4); - assert(s2.get_deleter().state() == 5); - assert(s1.get_deleter().state() == 0); - } - assert(A::count == 0); - { - CDeleter d1(5); - std::unique_ptr&> s1(new A[6], d1); - A* p = s1.get(); - assert(A::count == 6); - CDeleter d2(6); - std::unique_ptr&> s2(new A[3], d2); - assert(A::count == 9); - s2 = std::move(s1); - assert(A::count == 6); - assert(s2.get() == p); - assert(s1.get() == 0); - assert(d1.state() == 5); - assert(d2.state() == 5); - } - assert(A::count == 0); -} diff --git a/test/std/utilities/memory/unique.ptr/unique.ptr.runtime/move03.fail.cpp b/test/std/utilities/memory/unique.ptr/unique.ptr.runtime/move03.fail.cpp deleted file mode 100644 index 3712a2796..000000000 --- a/test/std/utilities/memory/unique.ptr/unique.ptr.runtime/move03.fail.cpp +++ /dev/null @@ -1,57 +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. -// -//===----------------------------------------------------------------------===// - -// - -// unique_ptr - -// Test unique_ptr move assignment - -#include -#include -#include - -// Can't copy from lvalue - -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;} -}; - -int main() -{ - { - std::unique_ptr s(new A); - A* p = s.get(); - std::unique_ptr s2; - s2 = s; - assert(s2.get() == p); - assert(s.get() == 0); - assert(A::count == 1); - } - assert(A::count == 0); -} diff --git a/test/std/utilities/memory/unique.ptr/unique.ptr.runtime/move04.fail.cpp b/test/std/utilities/memory/unique.ptr/unique.ptr.runtime/move04.fail.cpp deleted file mode 100644 index 4e85e5b0f..000000000 --- a/test/std/utilities/memory/unique.ptr/unique.ptr.runtime/move04.fail.cpp +++ /dev/null @@ -1,57 +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. -// -//===----------------------------------------------------------------------===// - -// - -// unique_ptr - -// Test unique_ptr move ctor - -#include -#include -#include - -// test move ctor. Can't copy from const lvalue - -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;} -}; - -int main() -{ - { - const std::unique_ptr s(new A); - A* p = s.get(); - std::unique_ptr s2; - s2 = s; - assert(s2.get() == p); - assert(s.get() == 0); - assert(A::count == 1); - } - assert(A::count == 0); -} diff --git a/test/std/utilities/memory/unique.ptr/unique.ptr.runtime/move_convert01.fail.cpp b/test/std/utilities/memory/unique.ptr/unique.ptr.runtime/move_convert01.fail.cpp deleted file mode 100644 index 9461958a4..000000000 --- a/test/std/utilities/memory/unique.ptr/unique.ptr.runtime/move_convert01.fail.cpp +++ /dev/null @@ -1,57 +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. -// -//===----------------------------------------------------------------------===// - -// - -// unique_ptr - -// Test unique_ptr converting move assignment - -#include -#include -#include - -// Can't assign from lvalue - -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 s(new B); - A* p = s.get(); - std::unique_ptr 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); -} diff --git a/test/std/utilities/memory/unique.ptr/unique.ptr.runtime/move_convert02.fail.cpp b/test/std/utilities/memory/unique.ptr/unique.ptr.runtime/move_convert02.fail.cpp deleted file mode 100644 index 78caaa4f4..000000000 --- a/test/std/utilities/memory/unique.ptr/unique.ptr.runtime/move_convert02.fail.cpp +++ /dev/null @@ -1,61 +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. -// -//===----------------------------------------------------------------------===// - -// - -// unique_ptr - -// Test unique_ptr converting move assignment - -// Can't assign from lvalue - -#include -#include -#include - -#include "deleter_types.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() -{ - { - boost::unique_ptr > s(new B); - A* p = s.get(); - boost::unique_ptr > 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); -} diff --git a/test/std/utilities/memory/unique.ptr/unique.ptr.runtime/move_convert03.fail.cpp b/test/std/utilities/memory/unique.ptr/unique.ptr.runtime/move_convert03.fail.cpp deleted file mode 100644 index b9693b86e..000000000 --- a/test/std/utilities/memory/unique.ptr/unique.ptr.runtime/move_convert03.fail.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. -// -//===----------------------------------------------------------------------===// - -// - -// unique_ptr - -// Test unique_ptr converting move assignment - -// Can't assign from lvalue - -#include -#include -#include - -#include "deleter_types.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() -{ - { - Deleter db(5); - boost::unique_ptr&> s(new B, db); - A* p = s.get(); - Deleter da(6); - boost::unique_ptr&> 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); -} diff --git a/test/std/utilities/memory/unique.ptr/unique.ptr.runtime/move_convert04.fail.cpp b/test/std/utilities/memory/unique.ptr/unique.ptr.runtime/move_convert04.fail.cpp deleted file mode 100644 index 970beb5a1..000000000 --- a/test/std/utilities/memory/unique.ptr/unique.ptr.runtime/move_convert04.fail.cpp +++ /dev/null @@ -1,57 +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. -// -//===----------------------------------------------------------------------===// - -// - -// unique_ptr - -// Test unique_ptr converting move assignment - -#include -#include -#include - -// Can't assign from const lvalue - -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() -{ - { - const boost::unique_ptr s(new B); - A* p = s.get(); - boost::unique_ptr 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); -} diff --git a/test/std/utilities/memory/unique.ptr/unique.ptr.runtime/move_convert05.fail.cpp b/test/std/utilities/memory/unique.ptr/unique.ptr.runtime/move_convert05.fail.cpp deleted file mode 100644 index 897673147..000000000 --- a/test/std/utilities/memory/unique.ptr/unique.ptr.runtime/move_convert05.fail.cpp +++ /dev/null @@ -1,61 +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. -// -//===----------------------------------------------------------------------===// - -// - -// unique_ptr - -// Test unique_ptr converting move assignment - -// Can't assign from const lvalue - -#include -#include -#include - -#include "deleter_types.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() -{ - { - const boost::unique_ptr > s(new B); - A* p = s.get(); - boost::unique_ptr > 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); -} diff --git a/test/std/utilities/memory/unique.ptr/unique.ptr.runtime/move_convert06.fail.cpp b/test/std/utilities/memory/unique.ptr/unique.ptr.runtime/move_convert06.fail.cpp deleted file mode 100644 index 1081cd195..000000000 --- a/test/std/utilities/memory/unique.ptr/unique.ptr.runtime/move_convert06.fail.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. -// -//===----------------------------------------------------------------------===// - -// - -// unique_ptr - -// Test unique_ptr converting move assignment - -// Can't assign from const lvalue - -#include -#include -#include - -#include "deleter_types.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() -{ - { - Deleter db(5); - const boost::unique_ptr&> s(new B, db); - A* p = s.get(); - Deleter da(6); - boost::unique_ptr&> 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); -} diff --git a/test/std/utilities/memory/unique.ptr/unique.ptr.runtime/move_convert07.fail.cpp b/test/std/utilities/memory/unique.ptr/unique.ptr.runtime/move_convert07.fail.cpp deleted file mode 100644 index 65ee26941..000000000 --- a/test/std/utilities/memory/unique.ptr/unique.ptr.runtime/move_convert07.fail.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. -// -//===----------------------------------------------------------------------===// - -// - -// unique_ptr - -// Test unique_ptr converting move assignment - -#include -#include -#include - -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() -{ - { - boost::unique_ptr s(new B); - A* p = s.get(); - boost::unique_ptr s2(new A); - assert(A::count == 2); - s2 = boost::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.runtime/move_convert08.fail.cpp b/test/std/utilities/memory/unique.ptr/unique.ptr.runtime/move_convert08.fail.cpp deleted file mode 100644 index 310be99f8..000000000 --- a/test/std/utilities/memory/unique.ptr/unique.ptr.runtime/move_convert08.fail.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. -// -//===----------------------------------------------------------------------===// - -// - -// unique_ptr - -// Test unique_ptr converting move assignment - -#include -#include -#include - -#include "deleter_types.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() -{ - { - boost::unique_ptr > s(new B); - A* p = s.get(); - boost::unique_ptr > s2(new A); - assert(A::count == 2); - s2 = (boost::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.runtime/move_convert09.fail.cpp b/test/std/utilities/memory/unique.ptr/unique.ptr.runtime/move_convert09.fail.cpp deleted file mode 100644 index eb48e9c94..000000000 --- a/test/std/utilities/memory/unique.ptr/unique.ptr.runtime/move_convert09.fail.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. -// -//===----------------------------------------------------------------------===// - -// - -// unique_ptr - -// Test unique_ptr converting move assignment - -// test converting move assignment with reference deleters - -#include -#include -#include - -#include "deleter_types.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() -{ - { - Deleter db(5); - boost::unique_ptr&> s(new B, db); - A* p = s.get(); - Deleter da(6); - boost::unique_ptr&> s2(new A, da); - s2 = boost::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(A::count == 0); - assert(B::count == 0); -} diff --git a/test/std/utilities/memory/unique.ptr/unique.ptr.runtime/null_ctor.pass.cpp b/test/std/utilities/memory/unique.ptr/unique.ptr.runtime/null_ctor.pass.cpp deleted file mode 100644 index 50389978e..000000000 --- a/test/std/utilities/memory/unique.ptr/unique.ptr.runtime/null_ctor.pass.cpp +++ /dev/null @@ -1,55 +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. -// -//===----------------------------------------------------------------------===// - -// - -// unique_ptr - -// The deleter is not called if get() == 0 - -#include -#include - -#include "test_macros.h" - -class Deleter -{ - int state_; - - Deleter(Deleter&); - Deleter& operator=(Deleter&); - -public: - Deleter() : state_(0) {} - - int state() const {return state_;} - - void operator()(void*) {++state_;} -}; - -int main() -{ - Deleter d; - assert(d.state() == 0); - { - std::unique_ptr p(nullptr, d); - assert(p.get() == 0); - assert(&p.get_deleter() == &d); - } -#if defined(_LIBCPP_VERSION) - { - // The standard only requires the constructor accept nullptr, but libc++ - // also supports the literal 0. - std::unique_ptr p(0, d); - assert(p.get() == 0); - assert(&p.get_deleter() == &d); - } -#endif - assert(d.state() == 0); -} diff --git a/test/std/utilities/memory/unique.ptr/unique.ptr.runtime/nullptr_asgn.pass.cpp b/test/std/utilities/memory/unique.ptr/unique.ptr.runtime/nullptr_asgn.pass.cpp deleted file mode 100644 index 30ecdded3..000000000 --- a/test/std/utilities/memory/unique.ptr/unique.ptr.runtime/nullptr_asgn.pass.cpp +++ /dev/null @@ -1,41 +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. -// -//===----------------------------------------------------------------------===// - -// - -// unique_ptr - -// Test unique_ptr move assignment - -#include -#include - -// test assignment from null - -struct A -{ - static int count; - A() {++count;} - A(const A&) {++count;} - ~A() {--count;} -}; - -int A::count = 0; - -int main() -{ - { - std::unique_ptr s2(new A[3]); - assert(A::count == 3); - s2 = nullptr; - assert(A::count == 0); - assert(s2.get() == 0); - } - assert(A::count == 0); -} diff --git a/test/std/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/default01.fail.cpp b/test/std/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/default01.fail.cpp deleted file mode 100644 index b6bcad9a9..000000000 --- a/test/std/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/default01.fail.cpp +++ /dev/null @@ -1,38 +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. -// -//===----------------------------------------------------------------------===// - -// - -// unique_ptr - -// Test unique_ptr default ctor - -// default unique_ptr ctor should require default Deleter ctor - - -#include - -class Deleter -{ - // expected-error@memory:* {{base class 'Deleter' has private default constructor}} - // expected-note@memory:* + {{in instantiation of member function}} - Deleter() {} // expected-note {{implicitly declared private here}} - -public: - - Deleter(Deleter&) {} - Deleter& operator=(Deleter&) { return *this; } - - void operator()(void*) const {} -}; - -int main() -{ - std::unique_ptr p; -} diff --git a/test/std/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/default01.pass.cpp b/test/std/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/default01.pass.cpp deleted file mode 100644 index 0cc54382b..000000000 --- a/test/std/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/default01.pass.cpp +++ /dev/null @@ -1,47 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// - -// unique_ptr - -// Test unique_ptr default ctor - -// default unique_ptr ctor should only require default Deleter ctor - -#include -#include - -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 p; - assert(p.get() == 0); - } - { - std::unique_ptr p; - assert(p.get() == 0); - assert(p.get_deleter().state() == 5); - } -} diff --git a/test/std/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/default02.fail.cpp b/test/std/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/default02.fail.cpp deleted file mode 100644 index 82b84948f..000000000 --- a/test/std/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/default02.fail.cpp +++ /dev/null @@ -1,30 +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. -// -//===----------------------------------------------------------------------===// - -// - -// unique_ptr - -// Test unique_ptr default ctor - -// default unique_ptr ctor should require non-reference Deleter ctor - -#include - -class Deleter -{ -public: - - void operator()(void*) {} -}; - -int main() -{ - std::unique_ptr p; -} diff --git a/test/std/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/default02.pass.cpp b/test/std/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/default02.pass.cpp deleted file mode 100644 index 3ded41c41..000000000 --- a/test/std/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/default02.pass.cpp +++ /dev/null @@ -1,87 +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. -// -//===----------------------------------------------------------------------===// - -// - -// unique_ptr - -// Test default unique_ptr ctor - -// default unique_ptr ctor shouldn't require complete type - -#include -#include - -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 > -struct B -{ - std::unique_ptr 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 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 -B::B() {} - -template -B::~B() {} diff --git a/test/std/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/move01.fail.cpp b/test/std/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/move01.fail.cpp deleted file mode 100644 index bc49a0e5c..000000000 --- a/test/std/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/move01.fail.cpp +++ /dev/null @@ -1,42 +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. -// -//===----------------------------------------------------------------------===// - -// - -// unique_ptr - -// Test unique_ptr move ctor - -#include -#include - -// test move ctor. Can't copy from lvalue - -struct A -{ - static int count; - A() {++count;} - A(const A&) {++count;} - ~A() {--count;} -}; - -int A::count = 0; - -int main() -{ - { - std::unique_ptr s(new A[3]); - A* p = s.get(); - std::unique_ptr s2 = s; - assert(s2.get() == p); - assert(s.get() == 0); - assert(A::count == 1); - } - assert(A::count == 0); -} 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 deleted file mode 100644 index 8a1f2ce97..000000000 --- a/test/std/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/move01.pass.cpp +++ /dev/null @@ -1,70 +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. -// -//===----------------------------------------------------------------------===// - -// - -// unique_ptr - -// Test unique_ptr move ctor - -// test move ctor. Should only require a MoveConstructible deleter, or if -// deleter is a reference, not even that. - -#include -#include -#include - -#include "deleter_types.h" - -struct A -{ - static int count; - A() {++count;} - A(const A&) {++count;} - ~A() {--count;} -}; - -int A::count = 0; - -int main() -{ - { - std::unique_ptr s(new A[3]); - A* p = s.get(); - std::unique_ptr s2 = std::move(s); - assert(s2.get() == p); - assert(s.get() == 0); - assert(A::count == 3); - } - assert(A::count == 0); - { - std::unique_ptr > s(new A[3], Deleter(5)); - A* p = s.get(); - std::unique_ptr > s2 = std::move(s); - assert(s2.get() == p); - assert(s.get() == 0); - assert(A::count == 3); - assert(s2.get_deleter().state() == 5); - assert(s.get_deleter().state() == 0); - } - assert(A::count == 0); - { - NCDeleter d; - std::unique_ptr&> s(new A[3], d); - A* p = s.get(); - std::unique_ptr&> s2 = std::move(s); - assert(s2.get() == p); - assert(s.get() == 0); - assert(A::count == 3); - 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.runtime/unique.ptr.runtime.ctor/move02.fail.cpp b/test/std/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/move02.fail.cpp deleted file mode 100644 index 8e44c78bf..000000000 --- a/test/std/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/move02.fail.cpp +++ /dev/null @@ -1,42 +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. -// -//===----------------------------------------------------------------------===// - -// - -// unique_ptr - -// Test unique_ptr move ctor - -// test move ctor. Can't copy from const lvalue - -#include -#include - -struct A -{ - static int count; - A() {++count;} - A(const A&) {++count;} - ~A() {--count;} -}; - -int A::count = 0; - -int main() -{ - { - const std::unique_ptr s(new A[3]); - A* p = s.get(); - std::unique_ptr s2 = s; - assert(s2.get() == p); - assert(s.get() == 0); - assert(A::count == 1); - } - assert(A::count == 0); -} 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 deleted file mode 100644 index f758b083f..000000000 --- a/test/std/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/move02.pass.cpp +++ /dev/null @@ -1,72 +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. -// -//===----------------------------------------------------------------------===// - -// - -// unique_ptr - -// Test unique_ptr move ctor - -// test move ctor. Should only require a MoveConstructible deleter, or if -// deleter is a reference, not even that. - -#include -#include - -#include "deleter_types.h" - -struct A -{ - static int count; - A() {++count;} - A(const A&) {++count;} - ~A() {--count;} -}; - -int A::count = 0; - - -std::unique_ptr -source1() -{ - return std::unique_ptr(new A[3]); -} - -void sink1(std::unique_ptr) -{ -} - -std::unique_ptr > -source2() -{ - return std::unique_ptr >(new A[3]); -} - -void sink2(std::unique_ptr >) -{ -} - -std::unique_ptr&> -source3() -{ - static NCDeleter d; - return std::unique_ptr&>(new A[3], d); -} - -void sink3(std::unique_ptr&>) -{ -} - -int main() -{ - sink1(source1()); - sink2(source2()); - sink3(source3()); - assert(A::count == 0); -} diff --git a/test/std/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/move03.fail.cpp b/test/std/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/move03.fail.cpp deleted file mode 100644 index c952cf2d4..000000000 --- a/test/std/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/move03.fail.cpp +++ /dev/null @@ -1,55 +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. -// -//===----------------------------------------------------------------------===// - -// - -// unique_ptr - -// Test unique_ptr move ctor - -// test move ctor. Can't copy from lvalue - -#include -#include - -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;} -}; - -int main() -{ - { - std::unique_ptr s(new A[3]); - A* p = s.get(); - std::unique_ptr s2 = s; - assert(s2.get() == p); - assert(s.get() == 0); - assert(A::count == 1); - } - assert(A::count == 0); -} diff --git a/test/std/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/move04.fail.cpp b/test/std/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/move04.fail.cpp deleted file mode 100644 index 0d091ff34..000000000 --- a/test/std/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/move04.fail.cpp +++ /dev/null @@ -1,55 +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. -// -//===----------------------------------------------------------------------===// - -// - -// unique_ptr - -// Test unique_ptr move ctor - -// test move ctor. Can't copy from const lvalue - -#include -#include - -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;} -}; - -int main() -{ - { - const std::unique_ptr s(new A[3]); - A* p = s.get(); - std::unique_ptr s2 = s; - assert(s2.get() == p); - assert(s.get() == 0); - assert(A::count == 1); - } - assert(A::count == 0); -} diff --git a/test/std/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/move_convert01.fail.cpp b/test/std/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/move_convert01.fail.cpp deleted file mode 100644 index d175fbf93..000000000 --- a/test/std/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/move_convert01.fail.cpp +++ /dev/null @@ -1,57 +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. -// -//===----------------------------------------------------------------------===// - -// - -// unique_ptr - -// Test unique_ptr converting move ctor - -// test converting move ctor. Should only require a MoveConstructible deleter, or if -// deleter is a reference, not even that. -// Explicit version - -#include -#include - -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 s(new B); - A* p = s.get(); - std::unique_ptr 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); -} diff --git a/test/std/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/move_convert02.fail.cpp b/test/std/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/move_convert02.fail.cpp deleted file mode 100644 index 1d3dd853f..000000000 --- a/test/std/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/move_convert02.fail.cpp +++ /dev/null @@ -1,61 +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. -// -//===----------------------------------------------------------------------===// - -// - -// unique_ptr - -// Test unique_ptr converting move ctor - -// test converting move ctor. Should only require a MoveConstructible deleter, or if -// deleter is a reference, not even that. -// Explicit version - -#include -#include - -#include "deleter_types.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 > s(new B); - A* p = s.get(); - std::unique_ptr > 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); -} diff --git a/test/std/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/move_convert03.fail.cpp b/test/std/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/move_convert03.fail.cpp deleted file mode 100644 index 36ad75d83..000000000 --- a/test/std/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/move_convert03.fail.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. -// -//===----------------------------------------------------------------------===// - -// - -// unique_ptr - -// Test unique_ptr converting move ctor - -// test converting move ctor. Should only require a MoveConstructible deleter, or if -// deleter is a reference, not even that. -// Explicit version - -#include -#include - -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 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 d; - std::unique_ptr&> s(new B, d); - A* p = s.get(); - std::unique_ptr&> s2(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.runtime/unique.ptr.runtime.ctor/move_convert04.fail.cpp b/test/std/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/move_convert04.fail.cpp deleted file mode 100644 index 3a19bde92..000000000 --- a/test/std/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/move_convert04.fail.cpp +++ /dev/null @@ -1,57 +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. -// -//===----------------------------------------------------------------------===// - -// - -// unique_ptr - -// Test unique_ptr converting move ctor - -// test converting move ctor. Should only require a MoveConstructible deleter, or if -// deleter is a reference, not even that. -// implicit version - -#include -#include - -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 s(new B); - A* p = s.get(); - std::unique_ptr 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); -} diff --git a/test/std/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/move_convert05.fail.cpp b/test/std/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/move_convert05.fail.cpp deleted file mode 100644 index 225376688..000000000 --- a/test/std/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/move_convert05.fail.cpp +++ /dev/null @@ -1,61 +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. -// -//===----------------------------------------------------------------------===// - -// - -// unique_ptr - -// Test unique_ptr converting move ctor - -// test converting move ctor. Should only require a MoveConstructible deleter, or if -// deleter is a reference, not even that. -// Implicit version - -#include -#include - -#include "deleter_types.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 > s(new B); - A* p = s.get(); - std::unique_ptr > 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); -} diff --git a/test/std/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/move_convert06.fail.cpp b/test/std/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/move_convert06.fail.cpp deleted file mode 100644 index fba895137..000000000 --- a/test/std/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/move_convert06.fail.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. -// -//===----------------------------------------------------------------------===// - -// - -// unique_ptr - -// Test unique_ptr converting move ctor - -// test converting move ctor. Should only require a MoveConstructible deleter, or if -// deleter is a reference, not even that. -// Explicit version - -#include -#include - -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 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 d; - std::unique_ptr&> s(new B, d); - A* p = s.get(); - std::unique_ptr&> s2 = 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.runtime/unique.ptr.runtime.ctor/move_convert07.fail.cpp b/test/std/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/move_convert07.fail.cpp deleted file mode 100644 index 24c646988..000000000 --- a/test/std/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/move_convert07.fail.cpp +++ /dev/null @@ -1,57 +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. -// -//===----------------------------------------------------------------------===// - -// - -// unique_ptr - -// Test unique_ptr converting move ctor - -// test converting move ctor. Should only require a MoveConstructible deleter, or if -// deleter is a reference, not even that. -// Explicit version - -#include -#include - -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() -{ - { - const std::unique_ptr s(new B); - A* p = s.get(); - std::unique_ptr 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); -} diff --git a/test/std/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/move_convert08.fail.cpp b/test/std/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/move_convert08.fail.cpp deleted file mode 100644 index 2c8f28154..000000000 --- a/test/std/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/move_convert08.fail.cpp +++ /dev/null @@ -1,61 +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. -// -//===----------------------------------------------------------------------===// - -// - -// unique_ptr - -// Test unique_ptr converting move ctor - -// test converting move ctor. Should only require a MoveConstructible deleter, or if -// deleter is a reference, not even that. -// Explicit version - -#include -#include - -#include "deleter_types.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() -{ - { - const std::unique_ptr > s(new B); - A* p = s.get(); - std::unique_ptr > 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); -} diff --git a/test/std/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/move_convert09.fail.cpp b/test/std/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/move_convert09.fail.cpp deleted file mode 100644 index e4cbef5c0..000000000 --- a/test/std/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/move_convert09.fail.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. -// -//===----------------------------------------------------------------------===// - -// - -// unique_ptr - -// Test unique_ptr converting move ctor - -// test converting move ctor. Should only require a MoveConstructible deleter, or if -// deleter is a reference, not even that. -// Explicit version - -#include -#include - -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 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 d; - const std::unique_ptr&> s(new B, d); - A* p = s.get(); - std::unique_ptr&> s2(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.runtime/unique.ptr.runtime.ctor/move_convert10.fail.cpp b/test/std/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/move_convert10.fail.cpp deleted file mode 100644 index 73423d1b3..000000000 --- a/test/std/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/move_convert10.fail.cpp +++ /dev/null @@ -1,57 +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. -// -//===----------------------------------------------------------------------===// - -// - -// unique_ptr - -// Test unique_ptr converting move ctor - -// test converting move ctor. Should only require a MoveConstructible deleter, or if -// deleter is a reference, not even that. -// implicit version - -#include -#include - -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() -{ - { - const std::unique_ptr s(new B); - A* p = s.get(); - std::unique_ptr 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); -} diff --git a/test/std/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/move_convert11.fail.cpp b/test/std/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/move_convert11.fail.cpp deleted file mode 100644 index a7d853ddb..000000000 --- a/test/std/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/move_convert11.fail.cpp +++ /dev/null @@ -1,61 +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. -// -//===----------------------------------------------------------------------===// - -// - -// unique_ptr - -// Test unique_ptr converting move ctor - -// test converting move ctor. Should only require a MoveConstructible deleter, or if -// deleter is a reference, not even that. -// Implicit version - -#include -#include - -#include "deleter_types.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() -{ - { - const std::unique_ptr > s(new B); - A* p = s.get(); - std::unique_ptr > 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); -} diff --git a/test/std/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/move_convert12.fail.cpp b/test/std/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/move_convert12.fail.cpp deleted file mode 100644 index fdb088250..000000000 --- a/test/std/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/move_convert12.fail.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. -// -//===----------------------------------------------------------------------===// - -// - -// unique_ptr - -// Test unique_ptr converting move ctor - -// test converting move ctor. Should only require a MoveConstructible deleter, or if -// deleter is a reference, not even that. -// Explicit version - -#include -#include - -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 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 d; - const std::unique_ptr&> s(new B, d); - A* p = s.get(); - std::unique_ptr&> s2 = 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.runtime/unique.ptr.runtime.ctor/move_convert13.fail.cpp b/test/std/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/move_convert13.fail.cpp deleted file mode 100644 index d9ef8e96f..000000000 --- a/test/std/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/move_convert13.fail.cpp +++ /dev/null @@ -1,57 +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. -// -//===----------------------------------------------------------------------===// - -// - -// unique_ptr - -// Test unique_ptr converting move ctor - -// test converting move ctor. Should only require a MoveConstructible deleter, or if -// deleter is a reference, not even that. -// Explicit version - -#include -#include - -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 s(new B); - A* p = s.get(); - std::unique_ptr 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.runtime/unique.ptr.runtime.ctor/move_convert14.fail.cpp b/test/std/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/move_convert14.fail.cpp deleted file mode 100644 index 431c8bf3c..000000000 --- a/test/std/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/move_convert14.fail.cpp +++ /dev/null @@ -1,61 +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. -// -//===----------------------------------------------------------------------===// - -// - -// unique_ptr - -// Test unique_ptr converting move ctor - -// test converting move ctor. Should only require a MoveConstructible deleter, or if -// deleter is a reference, not even that. -// Explicit version - -#include -#include - -#include "deleter_types.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 > s(new B); - A* p = s.get(); - std::unique_ptr > 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.runtime/unique.ptr.runtime.ctor/move_convert15.fail.cpp b/test/std/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/move_convert15.fail.cpp deleted file mode 100644 index 9325d07d0..000000000 --- a/test/std/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/move_convert15.fail.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. -// -//===----------------------------------------------------------------------===// - -// - -// unique_ptr - -// Test unique_ptr converting move ctor - -// test converting move ctor. Should only require a MoveConstructible deleter, or if -// deleter is a reference, not even that. -// Explicit version - -#include -#include - -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 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 d; - std::unique_ptr&> s(new B, d); - A* p = s.get(); - std::unique_ptr&> 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.runtime/unique.ptr.runtime.ctor/move_convert16.fail.cpp b/test/std/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/move_convert16.fail.cpp deleted file mode 100644 index b090e593e..000000000 --- a/test/std/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/move_convert16.fail.cpp +++ /dev/null @@ -1,57 +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. -// -//===----------------------------------------------------------------------===// - -// - -// unique_ptr - -// Test unique_ptr converting move ctor - -// test converting move ctor. Should only require a MoveConstructible deleter, or if -// deleter is a reference, not even that. -// implicit version - -#include -#include - -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 s(new B); - A* p = s.get(); - std::unique_ptr 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.runtime/unique.ptr.runtime.ctor/move_convert17.fail.cpp b/test/std/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/move_convert17.fail.cpp deleted file mode 100644 index 6e214f137..000000000 --- a/test/std/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/move_convert17.fail.cpp +++ /dev/null @@ -1,61 +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. -// -//===----------------------------------------------------------------------===// - -// - -// unique_ptr - -// Test unique_ptr converting move ctor - -// test converting move ctor. Should only require a MoveConstructible deleter, or if -// deleter is a reference, not even that. -// Implicit version - -#include -#include - -#include "deleter_types.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 > s(new B); - A* p = s.get(); - std::unique_ptr > 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.runtime/unique.ptr.runtime.ctor/move_convert18.fail.cpp b/test/std/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/move_convert18.fail.cpp deleted file mode 100644 index d1c0e8a78..000000000 --- a/test/std/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/move_convert18.fail.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. -// -//===----------------------------------------------------------------------===// - -// - -// unique_ptr - -// Test unique_ptr converting move ctor - -// test converting move ctor. Should only require a MoveConstructible deleter, or if -// deleter is a reference, not even that. -// Explicit version - -#include -#include - -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 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 d; - std::unique_ptr&> s(new B, d); - A* p = s.get(); - std::unique_ptr&> 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.runtime/unique.ptr.runtime.ctor/nullptr.pass.cpp b/test/std/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/nullptr.pass.cpp deleted file mode 100644 index 9a8c17547..000000000 --- a/test/std/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/nullptr.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. -// -//===----------------------------------------------------------------------===// - -// - -// unique_ptr - -// unique_ptr(nullptr_t); - -#include -#include - -// 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 p(nullptr); - assert(p.get() == 0); - } - { - std::unique_ptr p(nullptr); - assert(p.get() == 0); - assert(p.get_deleter().state() == 5); - } -} diff --git a/test/std/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/pointer01.fail.cpp b/test/std/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/pointer01.fail.cpp deleted file mode 100644 index 4c3161150..000000000 --- a/test/std/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/pointer01.fail.cpp +++ /dev/null @@ -1,36 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// - -// unique_ptr - -// Test unique_ptr(pointer) ctor - -// unique_ptr(pointer) ctor should require default Deleter ctor - -#include - -class Deleter -{ - - Deleter() {} - -public: - - Deleter(Deleter&) {} - Deleter& operator=(Deleter&) {} - - void operator()(void*) const {} -}; - -int main() -{ - std::unique_ptr p(new int); -} diff --git a/test/std/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/pointer01.pass.cpp b/test/std/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/pointer01.pass.cpp deleted file mode 100644 index dab42f277..000000000 --- a/test/std/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.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. -// -//===----------------------------------------------------------------------===// - -// - -// unique_ptr - -// Test unique_ptr(pointer) ctor - -// unique_ptr(pointer) ctor should only require default Deleter ctor - -#include -#include - -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[3]; - assert(A::count == 3); - std::unique_ptr s(p); - assert(s.get() == p); - } - assert(A::count == 0); - { - A* p = new A[3]; - assert(A::count == 3); - std::unique_ptr 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.runtime/unique.ptr.runtime.ctor/pointer02.pass.cpp b/test/std/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/pointer02.pass.cpp deleted file mode 100644 index 1afb1c32c..000000000 --- a/test/std/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.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. -// -//===----------------------------------------------------------------------===// - -// - -// unique_ptr - -// Test unique_ptr(pointer) ctor - -// unique_ptr(pointer) ctor shouldn't require complete type - -#include -#include - -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 > -struct B -{ - std::unique_ptr 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(3); - B<> s(p); - assert(s.get() == p); - } - check(0); - { - A* p = get(); - check(3); - B 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[3];} - -void Deleter::operator()(A* p) {delete [] p;} - -void check(int i) -{ - assert(A::count == i); -} - -template -B::B(A* a) : a_(a) {} - -template -B::~B() {} diff --git a/test/std/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/pointer03.fail.cpp b/test/std/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/pointer03.fail.cpp deleted file mode 100644 index 31f7ce367..000000000 --- a/test/std/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/pointer03.fail.cpp +++ /dev/null @@ -1,23 +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. -// -//===----------------------------------------------------------------------===// - -// - -// unique_ptr - -// Test unique_ptr(pointer) ctor - -// unique_ptr(pointer) ctor should require non-pointer Deleter - -#include - -int main() -{ - std::unique_ptr p(new int); -} diff --git a/test/std/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/pointer04.fail.cpp b/test/std/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/pointer04.fail.cpp deleted file mode 100644 index 591144f7a..000000000 --- a/test/std/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/pointer04.fail.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. -// -//===----------------------------------------------------------------------===// - -// - -// unique_ptr - -// Test unique_ptr(pointer) ctor - -// unique_ptr(pointer) ctor should not work with derived pointers - -#include -#include - -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[3]; - std::unique_ptr s(p); - } - { - B* p = new B[3]; - std::unique_ptr s(p); - } -} diff --git a/test/std/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/pointer_deleter01.pass.cpp b/test/std/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/pointer_deleter01.pass.cpp deleted file mode 100644 index 480dc0889..000000000 --- a/test/std/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/pointer_deleter01.pass.cpp +++ /dev/null @@ -1,51 +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. -// -//===----------------------------------------------------------------------===// - -// - -// unique_ptr - -// Test unique_ptr(pointer, deleter) ctor - -// unique_ptr(pointer, deleter()) only requires MoveConstructible deleter - -#include -#include - -#include "deleter_types.h" - -struct A -{ - static int count; - A() {++count;} - A(const A&) {++count;} - ~A() {--count;} -}; - -int A::count = 0; - -int main() -{ - { - A* p = new A[3]; - assert(A::count == 3); - std::unique_ptr > s(p, Deleter()); - assert(s.get() == p); - assert(s.get_deleter().state() == 0); - } - assert(A::count == 0); - - { // LWG#2520 says that nullptr is a valid input as well as null -#ifdef _LIBCPP_VERSION - std::unique_ptr > s1(NULL, Deleter()); -#endif - std::unique_ptr > s2(nullptr, Deleter()); - } - assert(A::count == 0); -} diff --git a/test/std/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/pointer_deleter02.pass.cpp b/test/std/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/pointer_deleter02.pass.cpp deleted file mode 100644 index a92fdbc1d..000000000 --- a/test/std/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/pointer_deleter02.pass.cpp +++ /dev/null @@ -1,64 +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. -// -//===----------------------------------------------------------------------===// - -// - -// unique_ptr - -// Test unique_ptr(pointer, deleter) ctor - -// unique_ptr(pointer, d) requires CopyConstructible deleter - -#include -#include - -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[3]; - assert(A::count == 3); - Deleter d; - std::unique_ptr 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); - { - Deleter d; - std::unique_ptr s(nullptr, d); - assert(s.get() == nullptr); - assert(s.get_deleter().state() == 5); - } -} diff --git a/test/std/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/pointer_deleter03.pass.cpp b/test/std/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/pointer_deleter03.pass.cpp deleted file mode 100644 index dd2740173..000000000 --- a/test/std/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/pointer_deleter03.pass.cpp +++ /dev/null @@ -1,65 +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. -// -//===----------------------------------------------------------------------===// - -// - -// unique_ptr - -// Test unique_ptr(pointer, deleter) ctor - -// unique_ptr(pointer, d) does not requires CopyConstructible deleter - -#include -#include - -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[3]; - assert(A::count == 3); - Deleter d; - std::unique_ptr 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); - { - Deleter d; - std::unique_ptr s(nullptr, d); - assert(s.get() == nullptr); - } -} 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 deleted file mode 100644 index 9d3f94098..000000000 --- a/test/std/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/pointer_deleter04.fail.cpp +++ /dev/null @@ -1,33 +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. -// -//===----------------------------------------------------------------------===// - -// XFAIL: c++98, c++03 - -// - -// unique_ptr - -// Test unique_ptr(pointer, deleter) ctor - -// unique_ptr(pointer, D()) should not compile - -#include - -class Deleter -{ -public: - Deleter() {} - void operator()(int* p) const {delete [] p;} -}; - -int main() -{ - int* p = nullptr; - std::unique_ptr 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.runtime/unique.ptr.runtime.ctor/pointer_deleter04.pass.cpp b/test/std/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/pointer_deleter04.pass.cpp deleted file mode 100644 index 02f44d357..000000000 --- a/test/std/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/pointer_deleter04.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. -// -//===----------------------------------------------------------------------===// - -// - -// unique_ptr - -// Test unique_ptr(pointer, deleter) ctor - -// unique_ptr(pointer, d) does not requires CopyConstructible deleter - -#include -#include - -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[3]; - assert(A::count == 3); - Deleter d; - std::unique_ptr s(p, d); - assert(s.get() == p); - assert(s.get_deleter().state() == 5); - } - assert(A::count == 0); - { - Deleter d; - std::unique_ptr s(nullptr, d); - assert(s.get() == nullptr); - } -} diff --git a/test/std/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/pointer_deleter05.fail.cpp b/test/std/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/pointer_deleter05.fail.cpp deleted file mode 100644 index 0e03a7da0..000000000 --- a/test/std/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/pointer_deleter05.fail.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. -// -//===----------------------------------------------------------------------===// - -// - -// unique_ptr - -// Test unique_ptr(pointer, deleter) ctor - -// unique_ptr(pointer, deleter) should not work with derived pointers - -#include -#include - -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[3]; - std::unique_ptr s(p, Deleter()); -} diff --git a/test/std/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.modifiers/reset1.pass.cpp b/test/std/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.modifiers/reset1.pass.cpp deleted file mode 100644 index 195d877bb..000000000 --- a/test/std/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.modifiers/reset1.pass.cpp +++ /dev/null @@ -1,50 +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. -// -//===----------------------------------------------------------------------===// - -// - -// unique_ptr - -// test reset - -#include -#include - -struct A -{ - static int count; - A() {++count;} - A(const A&) {++count;} - ~A() {--count;} -}; - -int A::count = 0; - -int main() -{ - { - std::unique_ptr p(new A[3]); - assert(A::count == 3); - A* i = p.get(); - assert(i != nullptr); - p.reset(); - assert(A::count == 0); - assert(p.get() == 0); - } - assert(A::count == 0); - { - std::unique_ptr p(new A[4]); - assert(A::count == 4); - A* i = p.get(); - assert(i != nullptr); - p.reset(new A[5]); - assert(A::count == 5); - } - assert(A::count == 0); -} diff --git a/test/std/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.modifiers/reset2.fail.cpp b/test/std/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.modifiers/reset2.fail.cpp deleted file mode 100644 index bca6cb247..000000000 --- a/test/std/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.modifiers/reset2.fail.cpp +++ /dev/null @@ -1,64 +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. -// -//===----------------------------------------------------------------------===// - -// - -// unique_ptr - -// test reset - -#include -#include - -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 p(new A); - assert(A::count == 1); - assert(B::count == 0); - A* i = p.get(); - p.reset(new B); - assert(A::count == 1); - assert(B::count == 1); - } - assert(A::count == 0); - assert(B::count == 0); - { - std::unique_ptr p(new B); - assert(A::count == 1); - assert(B::count == 1); - A* i = p.get(); - p.reset(new B); - 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.runtime/unique.ptr.runtime.modifiers/swap.pass.cpp b/test/std/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.modifiers/swap.pass.cpp deleted file mode 100644 index 5e98475c7..000000000 --- a/test/std/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.modifiers/swap.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. -// -//===----------------------------------------------------------------------===// - -// - -// unique_ptr - -// test swap - -#include -#include - -#include "deleter_types.h" - -struct A -{ - int state_; - static int count; - A() : state_(0) {++count;} - explicit A(int i) : state_(i) {++count;} - A(const A& a) : state_(a.state_) {++count;} - A& operator=(const A& a) {state_ = a.state_; return *this;} - ~A() {--count;} - - friend bool operator==(const A& x, const A& y) - {return x.state_ == y.state_;} -}; - -int A::count = 0; - -int main() -{ - { - A* p1 = new A[3]; - std::unique_ptr > s1(p1, Deleter(1)); - A* p2 = new A[3]; - std::unique_ptr > s2(p2, Deleter(2)); - assert(s1.get() == p1); - assert(s1.get_deleter().state() == 1); - assert(s2.get() == p2); - assert(s2.get_deleter().state() == 2); - s1.swap(s2); - assert(s1.get() == p2); - assert(s1.get_deleter().state() == 2); - assert(s2.get() == p1); - assert(s2.get_deleter().state() == 1); - assert(A::count == 6); - } - assert(A::count == 0); -} diff --git a/test/std/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.observers/get_deleter.pass.cpp b/test/std/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.observers/get_deleter.pass.cpp deleted file mode 100644 index 449674071..000000000 --- a/test/std/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.observers/get_deleter.pass.cpp +++ /dev/null @@ -1,37 +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. -// -//===----------------------------------------------------------------------===// - -// - -// unique_ptr - -// test get_deleter() - -#include -#include - -struct Deleter -{ - void operator()(void*) {} - - int test() {return 5;} - int test() const {return 6;} -}; - -int main() -{ - { - std::unique_ptr p; - assert(p.get_deleter().test() == 5); - } - { - const std::unique_ptr p; - assert(p.get_deleter().test() == 6); - } -} diff --git a/test/std/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.observers/index.pass.cpp b/test/std/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.observers/index.pass.cpp deleted file mode 100644 index 519eae688..000000000 --- a/test/std/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.observers/index.pass.cpp +++ /dev/null @@ -1,47 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// - -// unique_ptr - -// test op[](size_t) - -#include -#include - -class A -{ - int state_; - static int next_; -public: - A() : state_(++next_) {} - int get() const {return state_;} - - friend bool operator==(const A& x, int y) - {return x.state_ == y;} - - A& operator=(int i) {state_ = i; return *this;} -}; - -int A::next_ = 0; - -int main() -{ - std::unique_ptr p(new A[3]); - assert(p[0] == 1); - assert(p[1] == 2); - assert(p[2] == 3); - p[0] = 3; - p[1] = 2; - p[2] = 1; - assert(p[0] == 3); - assert(p[1] == 2); - assert(p[2] == 1); -} diff --git a/test/std/utilities/memory/unique.ptr/unique.ptr.single/pointer_type.pass.cpp b/test/std/utilities/memory/unique.ptr/unique.ptr.single/pointer_type.pass.cpp deleted file mode 100644 index 380f2e100..000000000 --- a/test/std/utilities/memory/unique.ptr/unique.ptr.single/pointer_type.pass.cpp +++ /dev/null @@ -1,55 +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. -// -//===----------------------------------------------------------------------===// - -// - -// unique_ptr - -// Test unique_ptr::pointer type - -#include -#include - -#include "test_macros.h" - -struct Deleter -{ - struct pointer {}; -}; - -struct D2 { -private: - typedef void pointer; -}; - -struct D3 { - static long pointer; -}; - -int main() -{ - { - typedef std::unique_ptr P; - static_assert((std::is_same::value), ""); - } - { - typedef std::unique_ptr P; - static_assert((std::is_same::value), ""); - } -#if TEST_STD_VER >= 11 - { - typedef std::unique_ptr P; - static_assert(std::is_same::value, ""); - } - { - typedef std::unique_ptr P; - static_assert(std::is_same::value, ""); - } -#endif -} diff --git a/test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.asgn/move01.pass.cpp b/test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.asgn/move01.pass.cpp deleted file mode 100644 index 67f4da2be..000000000 --- a/test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.asgn/move01.pass.cpp +++ /dev/null @@ -1,75 +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. -// -//===----------------------------------------------------------------------===// - -// - -// unique_ptr - -// Test unique_ptr move assignment - -// test move assignment. Should only require a MoveConstructible deleter, or if -// deleter is a reference, not even that. - -#include -#include -#include - -#include "deleter_types.h" - -struct A -{ - static int count; - A() {++count;} - A(const A&) {++count;} - ~A() {--count;} -}; - -int A::count = 0; - -int main() -{ - { - std::unique_ptr s1(new A); - A* p = s1.get(); - std::unique_ptr s2(new A); - assert(A::count == 2); - s2 = std::move(s1); - assert(A::count == 1); - assert(s2.get() == p); - assert(s1.get() == 0); - } - assert(A::count == 0); - { - std::unique_ptr > s1(new A, Deleter(5)); - A* p = s1.get(); - std::unique_ptr > s2(new A); - assert(A::count == 2); - s2 = std::move(s1); - assert(s2.get() == p); - assert(s1.get() == 0); - assert(A::count == 1); - assert(s2.get_deleter().state() == 5); - assert(s1.get_deleter().state() == 0); - } - assert(A::count == 0); - { - CDeleter d1(5); - std::unique_ptr&> s1(new A, d1); - A* p = s1.get(); - CDeleter d2(6); - std::unique_ptr&> s2(new A, d2); - s2 = std::move(s1); - assert(s2.get() == p); - assert(s1.get() == 0); - assert(A::count == 1); - assert(d1.state() == 5); - assert(d2.state() == 5); - } - assert(A::count == 0); -} 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 deleted file mode 100644 index 9cea12b12..000000000 --- a/test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.asgn/move02.fail.cpp +++ /dev/null @@ -1,33 +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. -// -//===----------------------------------------------------------------------===// - -// - -// unique_ptr - -// Test unique_ptr move assignment - -#include - -#include "test_macros.h" - -// Can't copy from const lvalue - -int main() -{ - const std::unique_ptr s(new int); - std::unique_ptr 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 deleted file mode 100644 index 05a057f9b..000000000 --- a/test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.asgn/move03.fail.cpp +++ /dev/null @@ -1,33 +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. -// -//===----------------------------------------------------------------------===// - -// - -// unique_ptr - -// Test unique_ptr move assignment - -#include - -#include "test_macros.h" - -struct Deleter { - void operator()(int* p) {delete p;} -}; - -// Can't copy from lvalue -int main() -{ - std::unique_ptr 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 deleted file mode 100644 index 24703ec98..000000000 --- a/test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.asgn/move04.fail.cpp +++ /dev/null @@ -1,36 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// - -// unique_ptr - -// Test unique_ptr move assignment - -#include - -#include "test_macros.h" - -struct Deleter { - void operator()(int* p) {delete p;} -}; - -// Can't copy from a const lvalue -int main() -{ - const std::unique_ptr s(new int); - std::unique_ptr 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 deleted file mode 100644 index 7876760fe..000000000 --- a/test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.asgn/move_convert.pass.cpp +++ /dev/null @@ -1,89 +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. -// -//===----------------------------------------------------------------------===// - -// - -// unique_ptr - -// Test unique_ptr converting move assignment - -#include -#include -#include - -#include "deleter_types.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 -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 -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 bptr(new B); - std::unique_ptr aptr(new A); - testAssign(aptr, bptr); - } - assert(A::count == 0); - assert(B::count == 0); - { - Deleter del(42); - std::unique_ptr > bptr(new B, std::move(del)); - std::unique_ptr > aptr(new A); - testAssign(aptr, bptr); - checkDeleter(aptr, bptr, 42, 0); - } - assert(A::count == 0); - assert(B::count == 0); - { - CDeleter adel(6); - CDeleter bdel(42); - std::unique_ptr&> bptr(new B, bdel); - std::unique_ptr&> 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 deleted file mode 100644 index 816a598d9..000000000 --- a/test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.asgn/move_convert01.fail.cpp +++ /dev/null @@ -1,42 +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. -// -//===----------------------------------------------------------------------===// - -// - -// unique_ptr - -// Test unique_ptr converting move assignment - -#include - -#include "test_macros.h" - -struct A -{ - A() {} - virtual ~A() {} -}; - -struct B : public A -{ -}; - -// Can't assign from lvalue -int main() -{ - std::unique_ptr s; - std::unique_ptr s2; -#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.fail.cpp b/test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.asgn/move_convert02.fail.cpp deleted file mode 100644 index 6e69d5152..000000000 --- a/test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.asgn/move_convert02.fail.cpp +++ /dev/null @@ -1,43 +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. -// -//===----------------------------------------------------------------------===// - -// - -// unique_ptr - -// Test unique_ptr converting move assignment - -#include - -#include "test_macros.h" -#include "deleter_types.h" - -struct A -{ - A() {} - virtual ~A() {} -}; - -struct B : public A -{ -}; - -// Can't assign from lvalue -int main() -{ - std::unique_ptr > s; - std::unique_ptr > s2; -#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.fail.cpp b/test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.asgn/move_convert03.fail.cpp deleted file mode 100644 index 1d89f99c7..000000000 --- a/test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.asgn/move_convert03.fail.cpp +++ /dev/null @@ -1,47 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// - -// unique_ptr - -// Test unique_ptr converting move assignment - -// Can't assign from lvalue - -#include - -#include "test_macros.h" -#include "deleter_types.h" - -struct A -{ - A() {} - virtual ~A() {} -}; - -struct B : public A -{ -}; - -// Can't assign from lvalue -int main() -{ - Deleter db; - std::unique_ptr& > s(new B, db); - Deleter da; - std::unique_ptr &> 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_convert04.fail.cpp b/test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.asgn/move_convert04.fail.cpp deleted file mode 100644 index f7de69cb7..000000000 --- a/test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.asgn/move_convert04.fail.cpp +++ /dev/null @@ -1,43 +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. -// -//===----------------------------------------------------------------------===// - -// - -// unique_ptr - -// Test unique_ptr converting move assignment - -#include - -#include "test_macros.h" -#include "deleter_types.h" - -struct A -{ - A() {} - virtual ~A() {} -}; - -struct B : public A -{ -}; - -// Can't assign from lvalue -int main() -{ - const std::unique_ptr s(new B); - std::unique_ptr s2; -#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_convert05.fail.cpp b/test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.asgn/move_convert05.fail.cpp deleted file mode 100644 index 55ebe5119..000000000 --- a/test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.asgn/move_convert05.fail.cpp +++ /dev/null @@ -1,61 +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. -// -//===----------------------------------------------------------------------===// - -// - -// unique_ptr - -// Test unique_ptr converting move assignment - -// Can't assign from const lvalue - -#include -#include -#include - -#include "deleter_types.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() -{ - { - const std::unique_ptr > s(new B); - A* p = s.get(); - std::unique_ptr > 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); -} diff --git a/test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.asgn/move_convert06.fail.cpp b/test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.asgn/move_convert06.fail.cpp deleted file mode 100644 index 657b011b3..000000000 --- a/test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.asgn/move_convert06.fail.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. -// -//===----------------------------------------------------------------------===// - -// - -// unique_ptr - -// Test unique_ptr converting move assignment - -// Can't assign from const lvalue - -#include -#include -#include - -#include "deleter_types.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() -{ - { - Deleter db(5); - const std::unique_ptr&> s(new B, db); - A* p = s.get(); - Deleter da(6); - std::unique_ptr&> 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); -} diff --git a/test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/auto_pointer01.fail.cpp b/test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/auto_pointer01.fail.cpp deleted file mode 100644 index 1f317c782..000000000 --- a/test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/auto_pointer01.fail.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. -// -//===----------------------------------------------------------------------===// - -// - -// unique_ptr - -// Test unique_ptr(pointer) ctor - -#include -#include - -// template explicit unique_ptr(auto_ptr&); - -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() -{ - { - B* p = new B; - std::auto_ptr ap(p); - std::unique_ptr up(ap); - assert(up.get() == p); - assert(ap.get() == 0); - assert(A::count == 1); - assert(B::count == 1); - } - assert(A::count == 0); - assert(B::count == 0); - { - B* p = new B; - std::auto_ptr ap(p); - std::unique_ptr up; - up = ap; - assert(up.get() == p); - assert(ap.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/auto_pointer02.fail.cpp b/test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/auto_pointer02.fail.cpp deleted file mode 100644 index 2dd5ea300..000000000 --- a/test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/auto_pointer02.fail.cpp +++ /dev/null @@ -1,61 +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. -// -//===----------------------------------------------------------------------===// - -// - -// unique_ptr - -// Test unique_ptr(pointer) ctor - -#include -#include - -// template explicit unique_ptr(auto_ptr&); - -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 Deleter -{ - template - void operator()(T*) {} -}; - -int main() -{ - { - B* p = new B; - std::auto_ptr ap(p); - std::unique_ptr up(ap); - assert(up.get() == p); - assert(ap.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/default.pass.cpp b/test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/default.pass.cpp deleted file mode 100644 index 569daae7d..000000000 --- a/test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/default.pass.cpp +++ /dev/null @@ -1,86 +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. -// -//===----------------------------------------------------------------------===// - -// - -// 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 an incomplete element_type and -// various deleter types (C-1,2) - -#include -#include - -#include "deleter_types.h" - -struct IncompleteT; - -void checkNumIncompleteTypeAlive(int i); - -template > -struct StoresIncomplete { - std::unique_ptr m_ptr; - StoresIncomplete() {} - ~StoresIncomplete(); - - IncompleteT* get() const { return m_ptr.get(); } - Del& get_deleter() { return m_ptr.get_deleter(); } -}; - -int main() -{ - { - std::unique_ptr p; - assert(p.get() == 0); - } - { - std::unique_ptr > 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 > 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 -StoresIncomplete::~StoresIncomplete() { } diff --git a/test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/default01.fail.cpp b/test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/default01.fail.cpp deleted file mode 100644 index 2ffe1be19..000000000 --- a/test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/default01.fail.cpp +++ /dev/null @@ -1,35 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// - -// unique_ptr - -// Test unique_ptr default ctor - -#include - -// default unique_ptr ctor should require default Deleter ctor -class Deleter -{ - - Deleter() {} - -public: - - Deleter(Deleter&) {} - Deleter& operator=(Deleter&) {} - - void operator()(void*) const {} -}; - -int main() -{ - std::unique_ptr p; -} diff --git a/test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/default02.fail.cpp b/test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/default02.fail.cpp deleted file mode 100644 index 690750143..000000000 --- a/test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/default02.fail.cpp +++ /dev/null @@ -1,29 +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. -// -//===----------------------------------------------------------------------===// - -// - -// unique_ptr - -// Test unique_ptr default ctor - -#include - -// default unique_ptr ctor should require non-reference Deleter ctor -class Deleter -{ -public: - - void operator()(void*) {} -}; - -int main() -{ - std::unique_ptr p; -} diff --git a/test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/default03.fail.cpp b/test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/default03.fail.cpp deleted file mode 100644 index 78f6e73a1..000000000 --- a/test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/default03.fail.cpp +++ /dev/null @@ -1,23 +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. -// -//===----------------------------------------------------------------------===// - -// - -// unique_ptr - -// Test unique_ptr default ctor - -#include - -// default unique_ptr ctor should require non-pointer Deleter - -int main() -{ - std::unique_ptr p; -} 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 deleted file mode 100644 index f49702a3d..000000000 --- a/test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/move.pass.cpp +++ /dev/null @@ -1,140 +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. -// -//===----------------------------------------------------------------------===// - -// - -// unique_ptr - -// Test unique_ptr move ctor - -#include -#include -#include - -#include "deleter_types.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 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 -// 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 -void sinkFunction(Expect) -{ -} - -typedef std::unique_ptr APtrSource1; -typedef std::unique_ptr > APtrSource2; -typedef std::unique_ptr& > APtrSource3; - -APtrSource1 source1() { - return APtrSource1 (new A); -} - -void sink1(APtrSource1 p) { - assert(p.get() != nullptr); -} - -APtrSource2 source2() { - return APtrSource2(new A, Deleter(5)); -} - -void sink2(APtrSource2 p) { - assert(p.get() != nullptr); - assert(p.get_deleter().state() == 5); -} - -APtrSource3 source3() { - static NCDeleter 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 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 MoveDel; - typedef std::unique_ptr 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 NonCopyDel; - typedef std::unique_ptr 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.fail.cpp b/test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/move01.fail.cpp deleted file mode 100644 index 68ad589b1..000000000 --- a/test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/move01.fail.cpp +++ /dev/null @@ -1,42 +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. -// -//===----------------------------------------------------------------------===// - -// - -// unique_ptr - -// Test unique_ptr move ctor - -#include -#include - -// test move ctor. Can't copy from lvalue - -struct A -{ - static int count; - A() {++count;} - A(const A&) {++count;} - ~A() {--count;} -}; - -int A::count = 0; - -int main() -{ - { - std::unique_ptr s(new A); - A* p = s.get(); - std::unique_ptr s2 = s; - assert(s2.get() == p); - assert(s.get() == 0); - assert(A::count == 1); - } - assert(A::count == 0); -} diff --git a/test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/move02.fail.cpp b/test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/move02.fail.cpp deleted file mode 100644 index 897b889d6..000000000 --- a/test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/move02.fail.cpp +++ /dev/null @@ -1,42 +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. -// -//===----------------------------------------------------------------------===// - -// - -// unique_ptr - -// Test unique_ptr move ctor - -#include -#include - -// test move ctor. Can't copy from const lvalue - -struct A -{ - static int count; - A() {++count;} - A(const A&) {++count;} - ~A() {--count;} -}; - -int A::count = 0; - -int main() -{ - { - const std::unique_ptr s(new A); - A* p = s.get(); - std::unique_ptr s2 = s; - assert(s2.get() == p); - assert(s.get() == 0); - assert(A::count == 1); - } - assert(A::count == 0); -} diff --git a/test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/move03.fail.cpp b/test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/move03.fail.cpp deleted file mode 100644 index 7fb1a0a74..000000000 --- a/test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/move03.fail.cpp +++ /dev/null @@ -1,55 +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. -// -//===----------------------------------------------------------------------===// - -// - -// unique_ptr - -// Test unique_ptr move ctor - -#include -#include - -// test move ctor. Can't copy from lvalue - -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;} -}; - -int main() -{ - { - std::unique_ptr s(new A); - A* p = s.get(); - std::unique_ptr s2 = s; - assert(s2.get() == p); - assert(s.get() == 0); - assert(A::count == 1); - } - assert(A::count == 0); -} diff --git a/test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/move04.fail.cpp b/test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/move04.fail.cpp deleted file mode 100644 index 671e343fd..000000000 --- a/test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/move04.fail.cpp +++ /dev/null @@ -1,55 +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. -// -//===----------------------------------------------------------------------===// - -// - -// unique_ptr - -// Test unique_ptr move ctor - -#include -#include - -// test move ctor. Can't copy from const lvalue - -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;} -}; - -int main() -{ - { - const std::unique_ptr s(new A); - A* p = s.get(); - std::unique_ptr s2 = s; - assert(s2.get() == p); - assert(s.get() == 0); - assert(A::count == 1); - } - 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 deleted file mode 100644 index ada010929..000000000 --- a/test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/move_convert.pass.cpp +++ /dev/null @@ -1,171 +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. -// - -//===----------------------------------------------------------------------===// - -// - -// 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 -#include -#include -#include - -#include "deleter_types.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 -void checkReferenceDeleter(LHS& lhs, RHS& rhs) { - typedef typename LHS::deleter_type NewDel; - static_assert(std::is_reference::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 -void checkDeleter(LHS& lhs, RHS& rhs, int LHSVal, int RHSVal) { - assert(lhs.get_deleter().state() == LHSVal); - assert(rhs.get_deleter().state() == RHSVal); -} - -template -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 APtr; - typedef std::unique_ptr 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 > APtr; - typedef std::unique_ptr > BPtr; - { - Deleter 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 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& > APtr; - typedef std::unique_ptr& > BPtr; - NCDeleter 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 > APtr; - typedef std::unique_ptr& > BPtr; - CDeleter 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.fail.cpp b/test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/move_convert01.fail.cpp deleted file mode 100644 index ed1fe8c2b..000000000 --- a/test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/move_convert01.fail.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. -// -//===----------------------------------------------------------------------===// - -// - -// unique_ptr - -// Test unique_ptr converting move ctor - -#include -#include -#include - -// Can't construct from lvalue - -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 s(new B); - A* p = s.get(); - std::unique_ptr 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); -} diff --git a/test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/move_convert02.fail.cpp b/test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/move_convert02.fail.cpp deleted file mode 100644 index 3d1cb6fd0..000000000 --- a/test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/move_convert02.fail.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. -// -//===----------------------------------------------------------------------===// - -// - -// unique_ptr - -// Test unique_ptr converting move ctor - -// test converting move ctor. Should only require a MoveConstructible deleter, or if -// deleter is a reference, not even that. -// Explicit version - -#include -#include -#include - -#include "deleter_types.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 > s(new B); - A* p = s.get(); - std::unique_ptr > 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); -} diff --git a/test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/move_convert03.fail.cpp b/test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/move_convert03.fail.cpp deleted file mode 100644 index 740919979..000000000 --- a/test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/move_convert03.fail.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. -// -//===----------------------------------------------------------------------===// - -// - -// unique_ptr - -// Test unique_ptr converting move ctor - -#include -#include -#include - -// 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 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 d; - std::unique_ptr&> s(new B, d); - A* p = s.get(); - std::unique_ptr&> s2(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.fail.cpp b/test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/move_convert04.fail.cpp deleted file mode 100644 index 981ea706e..000000000 --- a/test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/move_convert04.fail.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. -// -//===----------------------------------------------------------------------===// - -// - -// unique_ptr - -// Test unique_ptr converting move ctor - -#include -#include -#include - -// 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 s(new B); - A* p = s.get(); - std::unique_ptr 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); -} diff --git a/test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/move_convert05.fail.cpp b/test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/move_convert05.fail.cpp deleted file mode 100644 index 76462dc04..000000000 --- a/test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/move_convert05.fail.cpp +++ /dev/null @@ -1,51 +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. -// -//===----------------------------------------------------------------------===// - -// - -// unique_ptr - -// Test unique_ptr converting move ctor - -#include -#include -#include - -#include "deleter_types.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 > s(new B); - std::unique_ptr > s2 = s; -} diff --git a/test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/move_convert06.fail.cpp b/test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/move_convert06.fail.cpp deleted file mode 100644 index 5b9b12e0d..000000000 --- a/test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/move_convert06.fail.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. -// -//===----------------------------------------------------------------------===// - -// - -// unique_ptr - -// Test unique_ptr converting move ctor - -#include -#include -#include - -// 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 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 d; - std::unique_ptr&> s(new B, d); - A* p = s.get(); - std::unique_ptr&> s2 = 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.fail.cpp b/test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/move_convert07.fail.cpp deleted file mode 100644 index bef022cfc..000000000 --- a/test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/move_convert07.fail.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. -// -//===----------------------------------------------------------------------===// - -// - -// unique_ptr - -// Test unique_ptr converting move ctor - -#include -#include -#include - -// 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() -{ - { - const std::unique_ptr s(new B); - A* p = s.get(); - std::unique_ptr 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); -} diff --git a/test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/move_convert08.fail.cpp b/test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/move_convert08.fail.cpp deleted file mode 100644 index 016eadcb2..000000000 --- a/test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/move_convert08.fail.cpp +++ /dev/null @@ -1,86 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// UNSUPPORTED: c++98, c++03 - -// - -// unique_ptr - -// Test unique_ptr converting move ctor - -#include -#include -#include - -// 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 Deleter -{ - int state_; - Deleter(const Deleter&); - Deleter& operator=(const Deleter&); - -public: - Deleter(Deleter&& r) : state_(r.state_) {r.state_ = 0;} - Deleter& operator=(Deleter&& r) - { - state_ = r.state_; - r.state_ = 0; - return *this; - } - - Deleter() : state_(5) {} - - template - Deleter(Deleter&& d, - typename std::enable_if::value>::type* = 0) - : state_(d.state()) {d.set_state(0);} - -private: - template - Deleter(const Deleter& d, - typename std::enable_if::value>::type* = 0); - -public: - int state() const {return state_;} - void set_state(int i) {state_ = i;} - - void operator()(T* p) {delete p;} -}; - -int main() -{ - const std::unique_ptr > s; - std::unique_ptr > s2(s); // expected-error {{no matching constructor}} -} diff --git a/test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/move_convert09.fail.cpp b/test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/move_convert09.fail.cpp deleted file mode 100644 index a475c1754..000000000 --- a/test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/move_convert09.fail.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. -// -//===----------------------------------------------------------------------===// - -// - -// unique_ptr - -// Test unique_ptr converting move ctor - -#include -#include -#include - -// 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 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 d; - const std::unique_ptr&> s(new B, d); - A* p = s.get(); - std::unique_ptr&> s2(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_convert10.fail.cpp b/test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/move_convert10.fail.cpp deleted file mode 100644 index f0da5efb6..000000000 --- a/test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/move_convert10.fail.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. -// -//===----------------------------------------------------------------------===// - -// - -// unique_ptr - -// Test unique_ptr converting move ctor - -#include -#include -#include - -// 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() -{ - { - const std::unique_ptr s(new B); - A* p = s.get(); - std::unique_ptr 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); -} diff --git a/test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/move_convert11.fail.cpp b/test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/move_convert11.fail.cpp deleted file mode 100644 index 1b8bb736d..000000000 --- a/test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/move_convert11.fail.cpp +++ /dev/null @@ -1,86 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// UNSUPPORTED: c++98, c++03 - -// - -// unique_ptr - -// Test unique_ptr converting move ctor - -#include -#include -#include - -// 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; - -template -class Deleter -{ - int state_; - - Deleter(const Deleter&); - Deleter& operator=(const Deleter&); -public: - Deleter(Deleter&& r) : state_(r.state_) {r.state_ = 0;} - Deleter& operator=(Deleter&& r) - { - state_ = r.state_; - r.state_ = 0; - return *this; - } - - Deleter() : state_(5) {} - - template - Deleter(Deleter&& d, - typename std::enable_if::value>::type* = 0) - : state_(d.state()) {d.set_state(0);} - -private: - template - Deleter(const Deleter& d, - typename std::enable_if::value>::type* = 0); - -public: - int state() const {return state_;} - void set_state(int i) {state_ = i;} - - void operator()(T* p) {delete p;} -}; - -int main() -{ - const std::unique_ptr > s; - std::unique_ptr > s2 = s; // expected-error {{no viable conversion}} -} diff --git a/test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/move_convert12.fail.cpp b/test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/move_convert12.fail.cpp deleted file mode 100644 index 095bec656..000000000 --- a/test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/move_convert12.fail.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. -// -//===----------------------------------------------------------------------===// - -// - -// unique_ptr - -// Test unique_ptr converting move ctor - -#include -#include -#include - -// 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 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 d; - const std::unique_ptr&> s(new B, d); - A* p = s.get(); - std::unique_ptr&> s2 = 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/nullptr.pass.cpp b/test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/nullptr.pass.cpp deleted file mode 100644 index 67a48a3e7..000000000 --- a/test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/nullptr.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. -// -//===----------------------------------------------------------------------===// - -// - -// unique_ptr - -// unique_ptr(nullptr_t); - -#include -#include - -// 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 p(nullptr); - assert(p.get() == 0); - } - { - std::unique_ptr p(nullptr); - 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/pointer.pass.cpp b/test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/pointer.pass.cpp deleted file mode 100644 index da502b0b2..000000000 --- a/test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/pointer.pass.cpp +++ /dev/null @@ -1,163 +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. -// -//===----------------------------------------------------------------------===// - -// - -// 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's with a pointer to 'T' and various deleter -// types (C-1) -// 2 Construct unique_ptr's with a pointer to 'D' and various deleter -// types where 'D' is derived from 'T'. (C-1,2) -// 3 Construct a unique_ptr with a pointer to 'T' and various deleter -// types where 'T' is an incomplete type (C-1,3) - -// Test unique_ptr(pointer) ctor - -#include -#include - -#include "deleter_types.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 > -struct StoresIncomplete { - std::unique_ptr 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 s(p); - assert(s.get() == p); - } - assert(A::count == 0); - { - A* p = new A; - assert(A::count == 1); - std::unique_ptr > 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 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 > 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 > 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 -StoresIncomplete::~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.fail.cpp b/test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/pointer01.fail.cpp deleted file mode 100644 index 1af04b2c0..000000000 --- a/test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/pointer01.fail.cpp +++ /dev/null @@ -1,35 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// - -// unique_ptr - -// Test unique_ptr(pointer) ctor - -#include - -// unique_ptr(pointer) ctor should require default Deleter ctor -class Deleter -{ - - Deleter() {} - -public: - - Deleter(Deleter&) {} - Deleter& operator=(Deleter&) {} - - void operator()(void*) const {} -}; - -int main() -{ - std::unique_ptr p(new int); -} diff --git a/test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/pointer02.fail.cpp b/test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/pointer02.fail.cpp deleted file mode 100644 index 9b7dd8c70..000000000 --- a/test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/pointer02.fail.cpp +++ /dev/null @@ -1,29 +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. -// -//===----------------------------------------------------------------------===// - -// - -// unique_ptr - -// Test unique_ptr(pointer) ctor - -#include - -// unique_ptr(pointer) ctor should require non-reference Deleter ctor -class Deleter -{ -public: - - void operator()(void*) {} -}; - -int main() -{ - std::unique_ptr p(new int); -} diff --git a/test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/pointer03.fail.cpp b/test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/pointer03.fail.cpp deleted file mode 100644 index a917d87ee..000000000 --- a/test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/pointer03.fail.cpp +++ /dev/null @@ -1,23 +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. -// -//===----------------------------------------------------------------------===// - -// - -// unique_ptr - -// Test unique_ptr(pointer) ctor - -#include - -// unique_ptr(pointer) ctor should require non-pointer Deleter - -int main() -{ - std::unique_ptr p(new int); -} 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 deleted file mode 100644 index 929468119..000000000 --- a/test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/pointer_deleter.pass.cpp +++ /dev/null @@ -1,123 +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. -// -//===----------------------------------------------------------------------===// - -// - -// 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(pointer, deleter) does not require a CopyConstructible deleter. -// 4 unique_ptr(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 should work. - - -#include -#include - -#include "deleter_types.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 > s(p, Deleter(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 d(5); - std::unique_ptr > 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 d(5); - std::unique_ptr&> 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 d(5); - std::unique_ptr 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 > s(p, Deleter(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 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.modifiers/release.pass.cpp b/test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.modifiers/release.pass.cpp deleted file mode 100644 index dadd4ecbe..000000000 --- a/test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.modifiers/release.pass.cpp +++ /dev/null @@ -1,27 +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. -// -//===----------------------------------------------------------------------===// - -// - -// unique_ptr - -// test release - -#include -#include - -int main() -{ - std::unique_ptr p(new int(3)); - int* i = p.get(); - int* j = p.release(); - assert(p.get() == 0); - assert(i == j); - delete j; -} diff --git a/test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.modifiers/reset1.pass.cpp b/test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.modifiers/reset1.pass.cpp deleted file mode 100644 index 2cf7f8b77..000000000 --- a/test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.modifiers/reset1.pass.cpp +++ /dev/null @@ -1,50 +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. -// -//===----------------------------------------------------------------------===// - -// - -// unique_ptr - -// test reset - -#include -#include - -struct A -{ - static int count; - A() {++count;} - A(const A&) {++count;} - ~A() {--count;} -}; - -int A::count = 0; - -int main() -{ - { - std::unique_ptr p(new A); - assert(A::count == 1); - A* i = p.get(); - assert(i != nullptr); - p.reset(); - assert(A::count == 0); - assert(p.get() == 0); - } - assert(A::count == 0); - { - std::unique_ptr p(new A); - assert(A::count == 1); - A* i = p.get(); - assert(i != nullptr); - p.reset(new A); - assert(A::count == 1); - } - assert(A::count == 0); -} diff --git a/test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.modifiers/swap.pass.cpp b/test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.modifiers/swap.pass.cpp deleted file mode 100644 index 68a320458..000000000 --- a/test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.modifiers/swap.pass.cpp +++ /dev/null @@ -1,59 +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. -// -//===----------------------------------------------------------------------===// - -// - -// unique_ptr - -// test swap - -#include -#include - -#include "deleter_types.h" - -struct A -{ - int state_; - static int count; - explicit A(int i) : state_(i) {++count;} - A(const A& a) : state_(a.state_) {++count;} - A& operator=(const A& a) {state_ = a.state_; return *this;} - ~A() {--count;} - - friend bool operator==(const A& x, const A& y) - {return x.state_ == y.state_;} -}; - -int A::count = 0; - -int main() -{ - { - A* p1 = new A(1); - std::unique_ptr > s1(p1, Deleter(1)); - A* p2 = new A(2); - std::unique_ptr > s2(p2, Deleter(2)); - assert(s1.get() == p1); - assert(*s1 == A(1)); - assert(s1.get_deleter().state() == 1); - assert(s2.get() == p2); - assert(*s2 == A(2)); - assert(s2.get_deleter().state() == 2); - s1.swap(s2); - assert(s1.get() == p2); - assert(*s1 == A(2)); - assert(s1.get_deleter().state() == 2); - assert(s2.get() == p1); - assert(*s2 == A(1)); - assert(s2.get_deleter().state() == 1); - assert(A::count == 2); - } - assert(A::count == 0); -} diff --git a/test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.observers/explicit_bool.pass.cpp b/test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.observers/explicit_bool.pass.cpp deleted file mode 100644 index d5c7445b0..000000000 --- a/test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.observers/explicit_bool.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. -// -//===----------------------------------------------------------------------===// - -// - -// unique_ptr - -// test op*() - -#include -#include - -int main() -{ - { - std::unique_ptr p(new int(3)); - if (p) - ; - else - assert(false); - if (!p) - assert(false); - } - { - std::unique_ptr p; - if (!p) - ; - else - assert(false); - if (p) - assert(false); - } -} diff --git a/test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.observers/get_deleter.pass.cpp b/test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.observers/get_deleter.pass.cpp deleted file mode 100644 index 5ed8a22b1..000000000 --- a/test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.observers/get_deleter.pass.cpp +++ /dev/null @@ -1,37 +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. -// -//===----------------------------------------------------------------------===// - -// - -// unique_ptr - -// test get_deleter() - -#include -#include - -struct Deleter -{ - void operator()(void*) {} - - int test() {return 5;} - int test() const {return 6;} -}; - -int main() -{ - { - std::unique_ptr p; - assert(p.get_deleter().test() == 5); - } - { - const std::unique_ptr p; - assert(p.get_deleter().test() == 6); - } -} diff --git a/test/std/utilities/memory/util.smartptr/util.smartptr.enab/enable_shared_from_this.pass.cpp b/test/std/utilities/memory/util.smartptr/util.smartptr.enab/enable_shared_from_this.pass.cpp index 5a0d9259c..eb0d0a955 100644 --- a/test/std/utilities/memory/util.smartptr/util.smartptr.enab/enable_shared_from_this.pass.cpp +++ b/test/std/utilities/memory/util.smartptr/util.smartptr.enab/enable_shared_from_this.pass.cpp @@ -49,6 +49,10 @@ struct Bar : public Foo { }; +struct PrivateBase : private std::enable_shared_from_this { +}; + + int main() { { // https://bugs.llvm.org/show_bug.cgi?id=18843 @@ -74,6 +78,12 @@ int main() assert(p == q); assert(!p.owner_before(q) && !q.owner_before(p)); // p and q share ownership } + { + typedef std::shared_ptr APtr; + typedef std::weak_ptr WeakAPtr; + APtr a1 = std::make_shared(); + assert(a1.use_count() == 1); + } // Test LWG issue 2529. Only reset '__weak_ptr_' when it's already expired. // http://cplusplus.github.io/LWG/lwg-active.html#2529. // Test two different ways: diff --git a/test/std/utilities/memory/util.smartptr/util.smartptr.hash/hash_unique_ptr.pass.cpp b/test/std/utilities/memory/util.smartptr/util.smartptr.hash/hash_unique_ptr.pass.cpp index 879ea405c..78b04d861 100644 --- a/test/std/utilities/memory/util.smartptr/util.smartptr.hash/hash_unique_ptr.pass.cpp +++ b/test/std/utilities/memory/util.smartptr/util.smartptr.hash/hash_unique_ptr.pass.cpp @@ -50,7 +50,7 @@ namespace std { template struct hash<::min_pointer>> { - size_t operator()(::min_pointer> p) const { + size_t operator()(::min_pointer> p) const TEST_NOEXCEPT_FALSE { if (!p) return 0; return std::hash{}(std::addressof(*p)); } @@ -71,6 +71,11 @@ int main() assert(h == std::hash()(ptr)); } #if TEST_STD_VER >= 11 + { + std::unique_ptr> pThrowingHash; + std::hash>> fThrowingHash; + ASSERT_NOT_NOEXCEPT(fThrowingHash(pThrowingHash)); + } { test_enabled_with_deleter>(); test_enabled_with_deleter>(); diff --git a/test/std/utilities/memory/util.smartptr/util.smartptr.shared.atomic/atomic_compare_exchange_strong.pass.cpp b/test/std/utilities/memory/util.smartptr/util.smartptr.shared.atomic/atomic_compare_exchange_strong.pass.cpp index 3bad537e3..4b56a8fb6 100644 --- a/test/std/utilities/memory/util.smartptr/util.smartptr.shared.atomic/atomic_compare_exchange_strong.pass.cpp +++ b/test/std/utilities/memory/util.smartptr/util.smartptr.shared.atomic/atomic_compare_exchange_strong.pass.cpp @@ -11,8 +11,8 @@ // // This test uses new symbols that were not defined in the libc++ shipped on // darwin11 and darwin12: -// XFAIL: with_system_cxx_lib=x86_64-apple-darwin11 -// XFAIL: with_system_cxx_lib=x86_64-apple-darwin12 +// XFAIL: availability=macosx10.7 +// XFAIL: availability=macosx10.8 // diff --git a/test/std/utilities/memory/util.smartptr/util.smartptr.shared.atomic/atomic_compare_exchange_strong_explicit.pass.cpp b/test/std/utilities/memory/util.smartptr/util.smartptr.shared.atomic/atomic_compare_exchange_strong_explicit.pass.cpp index 5cc1234ad..065a7e90a 100644 --- a/test/std/utilities/memory/util.smartptr/util.smartptr.shared.atomic/atomic_compare_exchange_strong_explicit.pass.cpp +++ b/test/std/utilities/memory/util.smartptr/util.smartptr.shared.atomic/atomic_compare_exchange_strong_explicit.pass.cpp @@ -11,8 +11,8 @@ // // This test uses new symbols that were not defined in the libc++ shipped on // darwin11 and darwin12: -// XFAIL: with_system_cxx_lib=x86_64-apple-darwin11 -// XFAIL: with_system_cxx_lib=x86_64-apple-darwin12 +// XFAIL: availability=macosx10.7 +// XFAIL: availability=macosx10.8 // diff --git a/test/std/utilities/memory/util.smartptr/util.smartptr.shared.atomic/atomic_compare_exchange_weak.pass.cpp b/test/std/utilities/memory/util.smartptr/util.smartptr.shared.atomic/atomic_compare_exchange_weak.pass.cpp index a89c0dbd2..2351e9741 100644 --- a/test/std/utilities/memory/util.smartptr/util.smartptr.shared.atomic/atomic_compare_exchange_weak.pass.cpp +++ b/test/std/utilities/memory/util.smartptr/util.smartptr.shared.atomic/atomic_compare_exchange_weak.pass.cpp @@ -11,8 +11,8 @@ // // This test uses new symbols that were not defined in the libc++ shipped on // darwin11 and darwin12: -// XFAIL: with_system_cxx_lib=x86_64-apple-darwin11 -// XFAIL: with_system_cxx_lib=x86_64-apple-darwin12 +// XFAIL: availability=macosx10.7 +// XFAIL: availability=macosx10.8 // diff --git a/test/std/utilities/memory/util.smartptr/util.smartptr.shared.atomic/atomic_compare_exchange_weak_explicit.pass.cpp b/test/std/utilities/memory/util.smartptr/util.smartptr.shared.atomic/atomic_compare_exchange_weak_explicit.pass.cpp index 821cea686..e36c8a5a9 100644 --- a/test/std/utilities/memory/util.smartptr/util.smartptr.shared.atomic/atomic_compare_exchange_weak_explicit.pass.cpp +++ b/test/std/utilities/memory/util.smartptr/util.smartptr.shared.atomic/atomic_compare_exchange_weak_explicit.pass.cpp @@ -11,8 +11,8 @@ // // This test uses new symbols that were not defined in the libc++ shipped on // darwin11 and darwin12: -// XFAIL: with_system_cxx_lib=x86_64-apple-darwin11 -// XFAIL: with_system_cxx_lib=x86_64-apple-darwin12 +// XFAIL: availability=macosx10.7 +// XFAIL: availability=macosx10.8 // diff --git a/test/std/utilities/memory/util.smartptr/util.smartptr.shared.atomic/atomic_exchange.pass.cpp b/test/std/utilities/memory/util.smartptr/util.smartptr.shared.atomic/atomic_exchange.pass.cpp index 66be756d5..f1fe28cc1 100644 --- a/test/std/utilities/memory/util.smartptr/util.smartptr.shared.atomic/atomic_exchange.pass.cpp +++ b/test/std/utilities/memory/util.smartptr/util.smartptr.shared.atomic/atomic_exchange.pass.cpp @@ -11,8 +11,8 @@ // // This test uses new symbols that were not defined in the libc++ shipped on // darwin11 and darwin12: -// XFAIL: with_system_cxx_lib=x86_64-apple-darwin11 -// XFAIL: with_system_cxx_lib=x86_64-apple-darwin12 +// XFAIL: availability=macosx10.7 +// XFAIL: availability=macosx10.8 // diff --git a/test/std/utilities/memory/util.smartptr/util.smartptr.shared.atomic/atomic_exchange_explicit.pass.cpp b/test/std/utilities/memory/util.smartptr/util.smartptr.shared.atomic/atomic_exchange_explicit.pass.cpp index 493ba7fcc..45cbc5099 100644 --- a/test/std/utilities/memory/util.smartptr/util.smartptr.shared.atomic/atomic_exchange_explicit.pass.cpp +++ b/test/std/utilities/memory/util.smartptr/util.smartptr.shared.atomic/atomic_exchange_explicit.pass.cpp @@ -11,8 +11,8 @@ // // This test uses new symbols that were not defined in the libc++ shipped on // darwin11 and darwin12: -// XFAIL: with_system_cxx_lib=x86_64-apple-darwin11 -// XFAIL: with_system_cxx_lib=x86_64-apple-darwin12 +// XFAIL: availability=macosx10.7 +// XFAIL: availability=macosx10.8 // diff --git a/test/std/utilities/memory/util.smartptr/util.smartptr.shared.atomic/atomic_load.pass.cpp b/test/std/utilities/memory/util.smartptr/util.smartptr.shared.atomic/atomic_load.pass.cpp index 4820d0542..b51c6cf08 100644 --- a/test/std/utilities/memory/util.smartptr/util.smartptr.shared.atomic/atomic_load.pass.cpp +++ b/test/std/utilities/memory/util.smartptr/util.smartptr.shared.atomic/atomic_load.pass.cpp @@ -11,8 +11,8 @@ // // This test uses new symbols that were not defined in the libc++ shipped on // darwin11 and darwin12: -// XFAIL: with_system_cxx_lib=x86_64-apple-darwin11 -// XFAIL: with_system_cxx_lib=x86_64-apple-darwin12 +// XFAIL: availability=macosx10.7 +// XFAIL: availability=macosx10.8 // diff --git a/test/std/utilities/memory/util.smartptr/util.smartptr.shared.atomic/atomic_load_explicit.pass.cpp b/test/std/utilities/memory/util.smartptr/util.smartptr.shared.atomic/atomic_load_explicit.pass.cpp index ef8dc8221..9f3617a2c 100644 --- a/test/std/utilities/memory/util.smartptr/util.smartptr.shared.atomic/atomic_load_explicit.pass.cpp +++ b/test/std/utilities/memory/util.smartptr/util.smartptr.shared.atomic/atomic_load_explicit.pass.cpp @@ -11,8 +11,8 @@ // // This test uses new symbols that were not defined in the libc++ shipped on // darwin11 and darwin12: -// XFAIL: with_system_cxx_lib=x86_64-apple-darwin11 -// XFAIL: with_system_cxx_lib=x86_64-apple-darwin12 +// XFAIL: availability=macosx10.7 +// XFAIL: availability=macosx10.8 // diff --git a/test/std/utilities/memory/util.smartptr/util.smartptr.shared.atomic/atomic_store.pass.cpp b/test/std/utilities/memory/util.smartptr/util.smartptr.shared.atomic/atomic_store.pass.cpp index a13a7d57a..5ae26809f 100644 --- a/test/std/utilities/memory/util.smartptr/util.smartptr.shared.atomic/atomic_store.pass.cpp +++ b/test/std/utilities/memory/util.smartptr/util.smartptr.shared.atomic/atomic_store.pass.cpp @@ -11,8 +11,8 @@ // // This test uses new symbols that were not defined in the libc++ shipped on // darwin11 and darwin12: -// XFAIL: with_system_cxx_lib=x86_64-apple-darwin11 -// XFAIL: with_system_cxx_lib=x86_64-apple-darwin12 +// XFAIL: availability=macosx10.7 +// XFAIL: availability=macosx10.8 // diff --git a/test/std/utilities/memory/util.smartptr/util.smartptr.shared.atomic/atomic_store_explicit.pass.cpp b/test/std/utilities/memory/util.smartptr/util.smartptr.shared.atomic/atomic_store_explicit.pass.cpp index 6dfe3166c..ecba90b71 100644 --- a/test/std/utilities/memory/util.smartptr/util.smartptr.shared.atomic/atomic_store_explicit.pass.cpp +++ b/test/std/utilities/memory/util.smartptr/util.smartptr.shared.atomic/atomic_store_explicit.pass.cpp @@ -11,8 +11,8 @@ // // This test uses new symbols that were not defined in the libc++ shipped on // darwin11 and darwin12: -// XFAIL: with_system_cxx_lib=x86_64-apple-darwin11 -// XFAIL: with_system_cxx_lib=x86_64-apple-darwin12 +// XFAIL: availability=macosx10.7 +// XFAIL: availability=macosx10.8 // 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 73e87f314..3ad3232a9 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 @@ -86,6 +86,7 @@ int main() // Without rvalue references, ptr got copied into // the shared_ptr destructor and the copy was // destroyed during unwinding. + (void) raw_ptr; // silence 'unused variable' warning assert(A::count == 0); assert(B::count == 0); #endif 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 877577c9c..17289197d 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 @@ -80,6 +80,7 @@ int main() assert(B::count == 1); assert(ptr.get() == raw_ptr); #else + (void) raw_ptr; // silence 'unused variable' warning assert(A::count == 0); assert(B::count == 0); assert(ptr.get() == 0); diff --git a/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.create/make_shared.pass.cpp b/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.create/make_shared.pass.cpp index 2a7ac9979..f8f73f771 100644 --- a/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.create/make_shared.pass.cpp +++ b/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.create/make_shared.pass.cpp @@ -45,6 +45,25 @@ struct Foo virtual ~Foo() = default; }; +#ifdef _LIBCPP_VERSION +struct Result {}; +static Result theFunction() { return Result(); } +static int resultDeletorCount; +static void resultDeletor(Result (*pf)()) { + assert(pf == theFunction); + ++resultDeletorCount; +} + +void test_pointer_to_function() { + { // https://bugs.llvm.org/show_bug.cgi?id=27566 + std::shared_ptr x(&theFunction, &resultDeletor); + std::shared_ptr y(theFunction, resultDeletor); + } + assert(resultDeletorCount == 2); +} +#else // _LIBCPP_VERSION +void test_pointer_to_function() {} +#endif // _LIBCPP_VERSION int main() { @@ -66,6 +85,8 @@ int main() assert(p2.get()); } + test_pointer_to_function(); + #if TEST_STD_VER >= 11 nc = globalMemCounter.outstanding_new; { diff --git a/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.obs/owner_before_shared_ptr.pass.cpp b/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.obs/owner_before_shared_ptr.pass.cpp index 3acd2f8c6..9f6f1bc75 100644 --- a/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.obs/owner_before_shared_ptr.pass.cpp +++ b/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.obs/owner_before_shared_ptr.pass.cpp @@ -11,10 +11,11 @@ // shared_ptr -// template bool owner_before(shared_ptr const& b) const; +// template bool owner_before(shared_ptr const& b) const noexcept; #include #include +#include "test_macros.h" int main() { @@ -25,4 +26,5 @@ int main() assert(!p2.owner_before(p1)); assert(p1.owner_before(p3) || p3.owner_before(p1)); assert(p3.owner_before(p1) == p3.owner_before(p2)); + ASSERT_NOEXCEPT(p1.owner_before(p2)); } diff --git a/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.obs/owner_before_weak_ptr.pass.cpp b/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.obs/owner_before_weak_ptr.pass.cpp index 33447ba7d..560293bbe 100644 --- a/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.obs/owner_before_weak_ptr.pass.cpp +++ b/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.obs/owner_before_weak_ptr.pass.cpp @@ -11,10 +11,11 @@ // shared_ptr -// template bool owner_before(weak_ptr const& b) const; +// template bool owner_before(weak_ptr const& b) const noexcept; #include #include +#include "test_macros.h" int main() { @@ -28,4 +29,5 @@ int main() assert(!p2.owner_before(w1)); assert(p1.owner_before(w3) || p3.owner_before(w1)); assert(p3.owner_before(w1) == p3.owner_before(w2)); + ASSERT_NOEXCEPT(p1.owner_before(w2)); } 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 142eba2d9..501844a1d 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 @@ -16,9 +16,9 @@ // : binary_function, shared_ptr, bool> // { // typedef bool result_type; -// bool operator()(shared_ptr const&, shared_ptr const&) const; -// bool operator()(shared_ptr const&, weak_ptr const&) const; -// bool operator()(weak_ptr const&, shared_ptr const&) const; +// bool operator()(shared_ptr const&, shared_ptr const&) const noexcept; +// bool operator()(shared_ptr const&, weak_ptr const&) const noexcept; +// bool operator()(weak_ptr const&, shared_ptr const&) const noexcept; // }; // // template @@ -26,22 +26,22 @@ // : binary_function, weak_ptr, bool> // { // typedef bool result_type; -// bool operator()(weak_ptr const&, weak_ptr const&) const; -// bool operator()(shared_ptr const&, weak_ptr const&) const; -// bool operator()(weak_ptr const&, shared_ptr const&) const; +// bool operator()(weak_ptr const&, weak_ptr const&) const noexcept; +// bool operator()(shared_ptr const&, weak_ptr const&) const noexcept; +// bool operator()(weak_ptr const&, shared_ptr const&) const noexcept; // }; // // Added in C++17 // template<> struct owner_less // { // template -// bool operator()(shared_ptr const&, shared_ptr const&) const; +// bool operator()(shared_ptr const&, shared_ptr const&) const noexcept; // template -// bool operator()(shared_ptr const&, weak_ptr const&) const; +// bool operator()(shared_ptr const&, weak_ptr const&) const noexcept; // template -// bool operator()(weak_ptr const&, shared_ptr const&) const; +// bool operator()(weak_ptr const&, shared_ptr const&) const noexcept; // template -// bool operator()(weak_ptr const&, weak_ptr const&) const; +// bool operator()(weak_ptr const&, weak_ptr const&) const noexcept; // // typedef unspecified is_transparent; // }; @@ -74,11 +74,14 @@ int main() assert(!cs(p2, p1)); assert(cs(p1 ,p3) || cs(p3, p1)); assert(cs(p3, p1) == cs(p3, p2)); + ASSERT_NOEXCEPT(cs(p1, p1)); assert(!cs(p1, w2)); assert(!cs(p2, w1)); assert(cs(p1, w3) || cs(p3, w1)); assert(cs(p3, w1) == cs(p3, w2)); + ASSERT_NOEXCEPT(cs(p1, w1)); + ASSERT_NOEXCEPT(cs(w1, p1)); } { typedef std::owner_less > CS; @@ -92,11 +95,14 @@ int main() assert(!cs(w2, w1)); assert(cs(w1, w3) || cs(w3, w1)); assert(cs(w3, w1) == cs(w3, w2)); + ASSERT_NOEXCEPT(cs(w1, w1)); assert(!cs(w1, p2)); assert(!cs(w2, p1)); assert(cs(w1, p3) || cs(w3, p1)); assert(cs(w3, p1) == cs(w3, p2)); + ASSERT_NOEXCEPT(cs(w1, p1)); + ASSERT_NOEXCEPT(cs(p1, w1)); } #if TEST_STD_VER > 14 { @@ -111,6 +117,10 @@ int main() cmp(sp1, sp3); cmp(wp1, sp1); cmp(wp1, wp1); + ASSERT_NOEXCEPT(cmp(sp1, sp1)); + ASSERT_NOEXCEPT(cmp(sp1, wp1)); + ASSERT_NOEXCEPT(cmp(wp1, sp1)); + ASSERT_NOEXCEPT(cmp(wp1, wp1)); } { // test heterogeneous lookups diff --git a/test/std/utilities/memory/util.smartptr/util.smartptr.weak/util.smartptr.weak.obs/owner_before_shared_ptr.pass.cpp b/test/std/utilities/memory/util.smartptr/util.smartptr.weak/util.smartptr.weak.obs/owner_before_shared_ptr.pass.cpp index 4aa49cfe8..458f8a11e 100644 --- a/test/std/utilities/memory/util.smartptr/util.smartptr.weak/util.smartptr.weak.obs/owner_before_shared_ptr.pass.cpp +++ b/test/std/utilities/memory/util.smartptr/util.smartptr.weak/util.smartptr.weak.obs/owner_before_shared_ptr.pass.cpp @@ -11,10 +11,11 @@ // weak_ptr -// template bool owner_before(const shared_ptr& b); +// template bool owner_before(const shared_ptr& b) const noexcept; #include #include +#include "test_macros.h" int main() { @@ -28,4 +29,6 @@ int main() assert(!w2.owner_before(p1)); assert(w1.owner_before(p3) || w3.owner_before(p1)); assert(w3.owner_before(p1) == w3.owner_before(p2)); +// change to 'ASSERT_NOEXCEPT' when LWG2942 is adopted + LIBCPP_ASSERT_NOEXCEPT(w1.owner_before(p2)); } diff --git a/test/std/utilities/memory/util.smartptr/util.smartptr.weak/util.smartptr.weak.obs/owner_before_weak_ptr.pass.cpp b/test/std/utilities/memory/util.smartptr/util.smartptr.weak/util.smartptr.weak.obs/owner_before_weak_ptr.pass.cpp index 9fe2b6e39..5cd171a53 100644 --- a/test/std/utilities/memory/util.smartptr/util.smartptr.weak/util.smartptr.weak.obs/owner_before_weak_ptr.pass.cpp +++ b/test/std/utilities/memory/util.smartptr/util.smartptr.weak/util.smartptr.weak.obs/owner_before_weak_ptr.pass.cpp @@ -11,10 +11,11 @@ // weak_ptr -// template bool owner_before(const weak_ptr& b); +// template bool owner_before(const weak_ptr& b) const noexcept; #include #include +#include "test_macros.h" int main() { @@ -28,4 +29,6 @@ int main() assert(!w2.owner_before(w1)); assert(w1.owner_before(w3) || w3.owner_before(w1)); assert(w3.owner_before(w1) == w3.owner_before(w2)); +// change to 'ASSERT_NOEXCEPT' when LWG2942 is adopted + LIBCPP_ASSERT_NOEXCEPT(w1.owner_before(w2)); } diff --git a/test/std/utilities/meta/meta.help/integral_constant.pass.cpp b/test/std/utilities/meta/meta.help/integral_constant.pass.cpp index 51a837e4e..bf8aa0453 100644 --- a/test/std/utilities/meta/meta.help/integral_constant.pass.cpp +++ b/test/std/utilities/meta/meta.help/integral_constant.pass.cpp @@ -22,11 +22,11 @@ int main() static_assert(_5::value == 5, ""); static_assert((std::is_same<_5::value_type, int>::value), ""); static_assert((std::is_same<_5::type, _5>::value), ""); -#ifndef _LIBCPP_HAS_NO_CONSTEXPR +#if TEST_STD_VER >= 11 static_assert((_5() == 5), ""); -#else - assert(_5() == 5); #endif + assert(_5() == 5); + #if TEST_STD_VER > 11 static_assert ( _5{}() == 5, "" ); 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 552c16075..20c9eca8e 100644 --- a/test/std/utilities/meta/meta.rel/is_convertible.pass.cpp +++ b/test/std/utilities/meta/meta.rel/is_convertible.pass.cpp @@ -120,7 +120,9 @@ int main() static_assert((!std::is_convertible::value), ""); static_assert((!std::is_convertible::value), ""); static_assert((!std::is_convertible::value), ""); - static_assert((!std::is_convertible::value), ""); +#if TEST_STD_VER >= 11 + static_assert((!std::is_convertible::value), ""); +#endif static_assert((!std::is_convertible::value), ""); static_assert((!std::is_convertible::value), ""); static_assert((!std::is_convertible::value), ""); diff --git a/test/std/utilities/meta/meta.trans/meta.trans.other/aligned_union.pass.cpp b/test/std/utilities/meta/meta.trans/meta.trans.other/aligned_union.pass.cpp index 43f23f5cc..883548270 100644 --- a/test/std/utilities/meta/meta.trans/meta.trans.other/aligned_union.pass.cpp +++ b/test/std/utilities/meta/meta.trans/meta.trans.other/aligned_union.pass.cpp @@ -7,6 +7,8 @@ // //===----------------------------------------------------------------------===// +// UNSUPPORTED: c++98, c++03 + // type_traits // aligned_union @@ -17,7 +19,6 @@ int main() { -#ifndef _LIBCPP_HAS_NO_VARIADICS { typedef std::aligned_union<10, char >::type T1; #if TEST_STD_VER > 11 @@ -90,5 +91,4 @@ int main() static_assert(std::alignment_of::value == 4, ""); static_assert(sizeof(T1) == 4, ""); } -#endif } 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 61523e487..85b147266 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 @@ -37,8 +37,16 @@ namespace std typedef S type; }; +// P0548 + template + struct common_type< ::S, ::S > { + typedef S type; + }; + template <> struct common_type< ::S, long> {}; template <> struct common_type > {}; + template <> struct common_type< ::X > {}; + template <> struct common_type< ::X, ::X > {}; } #if TEST_STD_VER >= 11 @@ -88,6 +96,9 @@ void test_bullet_two() { static_assert(std::is_same, int>::value, ""); static_assert(std::is_same, int volatile*>::value, ""); static_assert(std::is_same, void(*)()>::value, ""); + + static_assert(no_common_type >::value, ""); + static_assert(no_common_type >::value, ""); } template @@ -284,4 +295,18 @@ int main() test_bullet_three_two(); test_bullet_four(); #endif + +// P0548 + static_assert((std::is_same >::type, S >::value), ""); + static_assert((std::is_same, S >::type, S >::value), ""); + + static_assert((std::is_same::type, int>::value), ""); + static_assert((std::is_same::type, int>::value), ""); + static_assert((std::is_same::type, int>::value), ""); + static_assert((std::is_same::type, int>::value), ""); + + static_assert((std::is_same::type, int>::value), ""); + static_assert((std::is_same::type, int>::value), ""); + static_assert((std::is_same::type, int>::value), ""); + static_assert((std::is_same::type, int>::value), ""); } diff --git a/test/std/utilities/meta/meta.trans/meta.trans.other/decay.pass.cpp b/test/std/utilities/meta/meta.trans/meta.trans.other/decay.pass.cpp index bcd839849..4f45a0340 100644 --- a/test/std/utilities/meta/meta.trans/meta.trans.other/decay.pass.cpp +++ b/test/std/utilities/meta/meta.trans/meta.trans.other/decay.pass.cpp @@ -33,4 +33,10 @@ int main() test_decay(); test_decay(); test_decay(); +#if TEST_STD_VER > 11 + test_decay(); + test_decay(); + test_decay(); + test_decay(); +#endif } 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 index c340ba69c..4e875fa94 100644 --- 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 @@ -16,9 +16,13 @@ #include "test_macros.h" +// NOTE: On Windows the function `test_is_function` and +// `test_is_function has the same mangled despite being +// a distinct instantiation. This causes Clang to emit an error. However +// structs do not have this problem. + template -void test_is_function() -{ +struct test_is_function { static_assert( std::is_function::value, ""); static_assert( std::is_function::value, ""); static_assert( std::is_function::value, ""); @@ -29,11 +33,10 @@ void test_is_function() static_assert( std::is_function_v, ""); static_assert( std::is_function_v, ""); #endif -} +}; template -void test_is_not_function() -{ +struct test_is_not_function { static_assert(!std::is_function::value, ""); static_assert(!std::is_function::value, ""); static_assert(!std::is_function::value, ""); @@ -44,7 +47,7 @@ void test_is_not_function() static_assert(!std::is_function_v, ""); static_assert(!std::is_function_v, ""); #endif -} +}; class Empty { diff --git a/test/std/utilities/meta/meta.unary/meta.unary.cat/member_function_pointer.pass.cpp b/test/std/utilities/meta/meta.unary/meta.unary.cat/member_function_pointer.pass.cpp index 691c549b5..f685d71ee 100644 --- a/test/std/utilities/meta/meta.unary/meta.unary.cat/member_function_pointer.pass.cpp +++ b/test/std/utilities/meta/meta.unary/meta.unary.cat/member_function_pointer.pass.cpp @@ -14,9 +14,12 @@ #include #include "test_macros.h" +// NOTE: On Windows the function `test_is_member_function` and +// `test_is_member_function has the same mangled despite being +// a distinct instantiation. This causes Clang to emit an error. However +// structs do not have this problem. template -void test_member_function_pointer_imp() -{ +struct test_member_function_pointer_imp { static_assert(!std::is_void::value, ""); #if TEST_STD_VER > 11 static_assert(!std::is_null_pointer::value, ""); @@ -33,16 +36,16 @@ void test_member_function_pointer_imp() static_assert(!std::is_union::value, ""); static_assert(!std::is_class::value, ""); static_assert(!std::is_function::value, ""); -} +}; template -void test_member_function_pointer() +struct test_member_function_pointer : + test_member_function_pointer_imp, + test_member_function_pointer_imp, + test_member_function_pointer_imp, + test_member_function_pointer_imp { - test_member_function_pointer_imp(); - test_member_function_pointer_imp(); - test_member_function_pointer_imp(); - test_member_function_pointer_imp(); -} +}; class Class { diff --git a/test/std/utilities/meta/meta.unary/meta.unary.prop/is_aggregate.pass.cpp b/test/std/utilities/meta/meta.unary/meta.unary.prop/is_aggregate.pass.cpp new file mode 100644 index 000000000..9c72d4d44 --- /dev/null +++ b/test/std/utilities/meta/meta.unary/meta.unary.prop/is_aggregate.pass.cpp @@ -0,0 +1,79 @@ +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// UNSUPPORTED: c++98, c++03, c++11, c++14 + +// + +// template struct is_aggregate; +// template constexpr bool is_aggregate_v = is_aggregate::value; + +#include +#include "test_macros.h" + +template +void test_true() +{ +#if !defined(_LIBCPP_HAS_NO_IS_AGGREGATE) + static_assert( std::is_aggregate::value, ""); + static_assert( std::is_aggregate::value, ""); + static_assert( std::is_aggregate::value, ""); + static_assert( std::is_aggregate::value, ""); + static_assert( std::is_aggregate_v, ""); + static_assert( std::is_aggregate_v, ""); + static_assert( std::is_aggregate_v, ""); + static_assert( std::is_aggregate_v, ""); +#endif +} + +template +void test_false() +{ +#if !defined(_LIBCPP_HAS_NO_IS_AGGREGATE) + static_assert(!std::is_aggregate::value, ""); + static_assert(!std::is_aggregate::value, ""); + static_assert(!std::is_aggregate::value, ""); + static_assert(!std::is_aggregate::value, ""); + static_assert(!std::is_aggregate_v, ""); + static_assert(!std::is_aggregate_v, ""); + static_assert(!std::is_aggregate_v, ""); + static_assert(!std::is_aggregate_v, ""); +#endif +} + +struct Aggregate {}; +struct HasCons { HasCons(int); }; +struct HasPriv { + void PreventUnusedPrivateMemberWarning(); +private: + int x; +}; +struct Union { int x; void* y; }; + + +int main () +{ + { + test_false(); + test_false(); + test_false(); + test_false(); + test_false(); + test_false(); + test_false(); + test_false(); + test_false(); + } + { + test_true(); + test_true(); + test_true(); + test_true(); + } +} 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 f6ae40153..9d2ec5ede 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 @@ -251,6 +251,7 @@ int main() LIBCPP_STATIC_ASSERT( clang_disallows_valid_static_cast_bug != std::__libcpp_is_constructible>::value, ""); + ((void)clang_disallows_valid_static_cast_bug); // Prevent unused warning #else static_assert(clang_disallows_valid_static_cast_bug == false, ""); LIBCPP_STATIC_ASSERT(std::__libcpp_is_constructible>::value, ""); 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 42ecdb3b8..0bb373c96 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 @@ -11,7 +11,9 @@ // is_trivially_copyable -// XFAIL: gcc-4.9 +// These compilers have not implemented Core 2094 which makes volatile +// qualified types trivially copyable. +// XFAIL: clang-3, clang-4, apple-clang, gcc #include #include @@ -22,13 +24,13 @@ void test_is_trivially_copyable() { static_assert( std::is_trivially_copyable::value, ""); static_assert( std::is_trivially_copyable::value, ""); - static_assert(!std::is_trivially_copyable::value, ""); - static_assert(!std::is_trivially_copyable::value, ""); + static_assert( std::is_trivially_copyable::value, ""); + static_assert( std::is_trivially_copyable::value, ""); #if TEST_STD_VER > 14 static_assert( std::is_trivially_copyable_v, ""); static_assert( std::is_trivially_copyable_v, ""); - static_assert(!std::is_trivially_copyable_v, ""); - static_assert(!std::is_trivially_copyable_v, ""); + static_assert( std::is_trivially_copyable_v, ""); + static_assert( std::is_trivially_copyable_v, ""); #endif } diff --git a/test/std/utilities/optional/optional.bad_optional_access/default.pass.cpp b/test/std/utilities/optional/optional.bad_optional_access/default.pass.cpp index e3c7bb5ad..198eee62b 100644 --- a/test/std/utilities/optional/optional.bad_optional_access/default.pass.cpp +++ b/test/std/utilities/optional/optional.bad_optional_access/default.pass.cpp @@ -9,6 +9,13 @@ // UNSUPPORTED: c++98, c++03, c++11, c++14 +// XFAIL: with_system_cxx_lib=macosx10.12 +// XFAIL: with_system_cxx_lib=macosx10.11 +// XFAIL: with_system_cxx_lib=macosx10.10 +// XFAIL: with_system_cxx_lib=macosx10.9 +// XFAIL: with_system_cxx_lib=macosx10.7 +// XFAIL: with_system_cxx_lib=macosx10.8 + // // class bad_optional_access is default constructible diff --git a/test/std/utilities/optional/optional.comp_with_t/equal.pass.cpp b/test/std/utilities/optional/optional.comp_with_t/equal.pass.cpp index b54a08f55..dc6973927 100644 --- a/test/std/utilities/optional/optional.comp_with_t/equal.pass.cpp +++ b/test/std/utilities/optional/optional.comp_with_t/equal.pass.cpp @@ -10,44 +10,55 @@ // UNSUPPORTED: c++98, c++03, c++11, c++14 // -// template constexpr bool operator==(const optional& x, const T& v); -// template constexpr bool operator==(const T& v, const optional& x); +// template constexpr bool operator==(const optional& x, const U& v); +// template constexpr bool operator==(const U& v, const optional& x); #include using std::optional; -struct X -{ - int i_; +struct X { + int i_; - constexpr X(int i) : i_(i) {} + constexpr X(int i) : i_(i) {} }; -constexpr bool operator == ( const X &lhs, const X &rhs ) - { return lhs.i_ == rhs.i_ ; } +constexpr bool operator==(const X& lhs, const X& rhs) { + return lhs.i_ == rhs.i_; +} -int main() -{ - { +int main() { + { typedef X T; typedef optional O; constexpr T val(2); - constexpr O o1; // disengaged - constexpr O o2{1}; // engaged - constexpr O o3{val}; // engaged + constexpr O o1; // disengaged + constexpr O o2{1}; // engaged + constexpr O o3{val}; // engaged - static_assert ( !(o1 == T(1)), "" ); - static_assert ( (o2 == T(1)), "" ); - static_assert ( !(o3 == T(1)), "" ); - static_assert ( (o3 == T(2)), "" ); - static_assert ( (o3 == val), "" ); + static_assert(!(o1 == T(1)), ""); + static_assert((o2 == T(1)), ""); + static_assert(!(o3 == T(1)), ""); + static_assert((o3 == T(2)), ""); + static_assert((o3 == val), ""); - static_assert ( !(T(1) == o1), "" ); - static_assert ( (T(1) == o2), "" ); - static_assert ( !(T(1) == o3), "" ); - static_assert ( (T(2) == o3), "" ); - static_assert ( (val == o3), "" ); - } + static_assert(!(T(1) == o1), ""); + static_assert((T(1) == o2), ""); + static_assert(!(T(1) == o3), ""); + static_assert((T(2) == o3), ""); + static_assert((val == o3), ""); + } + { + using O = optional; + constexpr O o1(42); + static_assert(o1 == 42l, ""); + static_assert(!(101l == o1), ""); + } + { + using O = optional; + constexpr O o1(42); + static_assert(o1 == 42, ""); + static_assert(!(101 == o1), ""); + } } diff --git a/test/std/utilities/optional/optional.comp_with_t/greater.pass.cpp b/test/std/utilities/optional/optional.comp_with_t/greater.pass.cpp index 064114fb9..e1bad12e3 100644 --- a/test/std/utilities/optional/optional.comp_with_t/greater.pass.cpp +++ b/test/std/utilities/optional/optional.comp_with_t/greater.pass.cpp @@ -10,46 +10,55 @@ // UNSUPPORTED: c++98, c++03, c++11, c++14 // -// template constexpr bool operator>(const optional& x, const T& v); -// template constexpr bool operator>(const T& v, const optional& x); +// template constexpr bool operator>(const optional& x, const U& v); +// template constexpr bool operator>(const U& v, const optional& x); #include using std::optional; -struct X -{ - int i_; +struct X { + int i_; - constexpr X(int i) : i_(i) {} + constexpr X(int i) : i_(i) {} }; -constexpr bool operator > ( const X &lhs, const X &rhs ) - { return lhs.i_ > rhs.i_ ; } +constexpr bool operator>(const X& lhs, const X& rhs) { return lhs.i_ > rhs.i_; } -int main() -{ - { +int main() { + { typedef X T; typedef optional O; constexpr T val(2); - constexpr O o1; // disengaged - constexpr O o2{1}; // engaged - constexpr O o3{val}; // engaged + constexpr O o1; // disengaged + constexpr O o2{1}; // engaged + constexpr O o3{val}; // engaged - static_assert ( !(o1 > T(1)), "" ); - static_assert ( !(o2 > T(1)), "" ); // equal - static_assert ( (o3 > T(1)), "" ); - static_assert ( !(o2 > val), "" ); - static_assert ( !(o3 > val), "" ); // equal - static_assert ( !(o3 > T(3)), "" ); + static_assert(!(o1 > T(1)), ""); + static_assert(!(o2 > T(1)), ""); // equal + static_assert((o3 > T(1)), ""); + static_assert(!(o2 > val), ""); + static_assert(!(o3 > val), ""); // equal + static_assert(!(o3 > T(3)), ""); - static_assert ( (T(1) > o1), "" ); - static_assert ( !(T(1) > o2), "" ); // equal - static_assert ( !(T(1) > o3), "" ); - static_assert ( (val > o2), "" ); - static_assert ( !(val > o3), "" ); // equal - static_assert ( (T(3) > o3), "" ); - } + static_assert((T(1) > o1), ""); + static_assert(!(T(1) > o2), ""); // equal + static_assert(!(T(1) > o3), ""); + static_assert((val > o2), ""); + static_assert(!(val > o3), ""); // equal + static_assert((T(3) > o3), ""); + } + { + using O = optional; + constexpr O o1(42); + static_assert(o1 > 11l, ""); + static_assert(!(42l > o1), ""); + } + { + using O = optional; + constexpr O o1(42); + static_assert(o1 > 11, ""); + static_assert(!(42 > o1), ""); + } } diff --git a/test/std/utilities/optional/optional.comp_with_t/greater_equal.pass.cpp b/test/std/utilities/optional/optional.comp_with_t/greater_equal.pass.cpp index 663686cdf..342ddffc2 100644 --- a/test/std/utilities/optional/optional.comp_with_t/greater_equal.pass.cpp +++ b/test/std/utilities/optional/optional.comp_with_t/greater_equal.pass.cpp @@ -10,46 +10,57 @@ // UNSUPPORTED: c++98, c++03, c++11, c++14 // -// template constexpr bool operator>=(const optional& x, const T& v); -// template constexpr bool operator>=(const T& v, const optional& x); +// template constexpr bool operator>=(const optional& x, const U& v); +// template constexpr bool operator>=(const U& v, const optional& x); #include using std::optional; -struct X -{ - int i_; +struct X { + int i_; - constexpr X(int i) : i_(i) {} + constexpr X(int i) : i_(i) {} }; -constexpr bool operator >= ( const X &lhs, const X &rhs ) - { return lhs.i_ >= rhs.i_ ; } +constexpr bool operator>=(const X& lhs, const X& rhs) { + return lhs.i_ >= rhs.i_; +} -int main() -{ - { +int main() { + { typedef X T; typedef optional O; constexpr T val(2); - constexpr O o1; // disengaged - constexpr O o2{1}; // engaged - constexpr O o3{val}; // engaged + constexpr O o1; // disengaged + constexpr O o2{1}; // engaged + constexpr O o3{val}; // engaged - static_assert ( !(o1 >= T(1)), "" ); - static_assert ( (o2 >= T(1)), "" ); // equal - static_assert ( (o3 >= T(1)), "" ); - static_assert ( !(o2 >= val), "" ); - static_assert ( (o3 >= val), "" ); // equal - static_assert ( !(o3 >= T(3)), "" ); + static_assert(!(o1 >= T(1)), ""); + static_assert((o2 >= T(1)), ""); // equal + static_assert((o3 >= T(1)), ""); + static_assert(!(o2 >= val), ""); + static_assert((o3 >= val), ""); // equal + static_assert(!(o3 >= T(3)), ""); - static_assert ( (T(1) >= o1), "" ); - static_assert ( (T(1) >= o2), "" ); // equal - static_assert ( !(T(1) >= o3), "" ); - static_assert ( (val >= o2), "" ); - static_assert ( (val >= o3), "" ); // equal - static_assert ( (T(3) >= o3), "" ); - } + static_assert((T(1) >= o1), ""); + static_assert((T(1) >= o2), ""); // equal + static_assert(!(T(1) >= o3), ""); + static_assert((val >= o2), ""); + static_assert((val >= o3), ""); // equal + static_assert((T(3) >= o3), ""); + } + { + using O = optional; + constexpr O o1(42); + static_assert(o1 >= 42l, ""); + static_assert(!(11l >= o1), ""); + } + { + using O = optional; + constexpr O o1(42); + static_assert(o1 >= 42, ""); + static_assert(!(11 >= o1), ""); + } } diff --git a/test/std/utilities/optional/optional.comp_with_t/less_equal.pass.cpp b/test/std/utilities/optional/optional.comp_with_t/less_equal.pass.cpp index 05ac5eb12..bcf6afcc6 100644 --- a/test/std/utilities/optional/optional.comp_with_t/less_equal.pass.cpp +++ b/test/std/utilities/optional/optional.comp_with_t/less_equal.pass.cpp @@ -10,46 +10,57 @@ // UNSUPPORTED: c++98, c++03, c++11, c++14 // -// template constexpr bool operator<=(const optional& x, const T& v); -// template constexpr bool operator<=(const T& v, const optional& x); +// template constexpr bool operator<=(const optional& x, const U& v); +// template constexpr bool operator<=(const U& v, const optional& x); #include using std::optional; -struct X -{ - int i_; +struct X { + int i_; - constexpr X(int i) : i_(i) {} + constexpr X(int i) : i_(i) {} }; -constexpr bool operator <= ( const X &lhs, const X &rhs ) - { return lhs.i_ <= rhs.i_ ; } +constexpr bool operator<=(const X& lhs, const X& rhs) { + return lhs.i_ <= rhs.i_; +} -int main() -{ - { +int main() { + { typedef X T; typedef optional O; constexpr T val(2); - constexpr O o1; // disengaged - constexpr O o2{1}; // engaged - constexpr O o3{val}; // engaged + constexpr O o1; // disengaged + constexpr O o2{1}; // engaged + constexpr O o3{val}; // engaged - static_assert ( (o1 <= T(1)), "" ); - static_assert ( (o2 <= T(1)), "" ); // equal - static_assert ( !(o3 <= T(1)), "" ); - static_assert ( (o2 <= val), "" ); - static_assert ( (o3 <= val), "" ); // equal - static_assert ( (o3 <= T(3)), "" ); + static_assert((o1 <= T(1)), ""); + static_assert((o2 <= T(1)), ""); // equal + static_assert(!(o3 <= T(1)), ""); + static_assert((o2 <= val), ""); + static_assert((o3 <= val), ""); // equal + static_assert((o3 <= T(3)), ""); - static_assert ( !(T(1) <= o1), "" ); - static_assert ( (T(1) <= o2), "" ); // equal - static_assert ( (T(1) <= o3), "" ); - static_assert ( !(val <= o2), "" ); - static_assert ( (val <= o3), "" ); // equal - static_assert ( !(T(3) <= o3), "" ); - } + static_assert(!(T(1) <= o1), ""); + static_assert((T(1) <= o2), ""); // equal + static_assert((T(1) <= o3), ""); + static_assert(!(val <= o2), ""); + static_assert((val <= o3), ""); // equal + static_assert(!(T(3) <= o3), ""); + } + { + using O = optional; + constexpr O o1(42); + static_assert(o1 <= 42l, ""); + static_assert(!(101l <= o1), ""); + } + { + using O = optional; + constexpr O o1(42); + static_assert(o1 <= 42, ""); + static_assert(!(101 <= o1), ""); + } } diff --git a/test/std/utilities/optional/optional.comp_with_t/less_than.pass.cpp b/test/std/utilities/optional/optional.comp_with_t/less_than.pass.cpp index d1891a286..3d5e2144a 100644 --- a/test/std/utilities/optional/optional.comp_with_t/less_than.pass.cpp +++ b/test/std/utilities/optional/optional.comp_with_t/less_than.pass.cpp @@ -10,46 +10,55 @@ // UNSUPPORTED: c++98, c++03, c++11, c++14 // -// template constexpr bool operator<(const optional& x, const T& v); -// template constexpr bool operator<(const T& v, const optional& x); +// template constexpr bool operator<(const optional& x, const U& v); +// template constexpr bool operator<(const U& v, const optional& x); #include using std::optional; -struct X -{ - int i_; +struct X { + int i_; - constexpr X(int i) : i_(i) {} + constexpr X(int i) : i_(i) {} }; -constexpr bool operator < ( const X &lhs, const X &rhs ) - { return lhs.i_ < rhs.i_ ; } +constexpr bool operator<(const X& lhs, const X& rhs) { return lhs.i_ < rhs.i_; } -int main() -{ - { +int main() { + { typedef X T; typedef optional O; constexpr T val(2); - constexpr O o1; // disengaged - constexpr O o2{1}; // engaged - constexpr O o3{val}; // engaged + constexpr O o1; // disengaged + constexpr O o2{1}; // engaged + constexpr O o3{val}; // engaged - static_assert ( (o1 < T(1)), "" ); - static_assert ( !(o2 < T(1)), "" ); // equal - static_assert ( !(o3 < T(1)), "" ); - static_assert ( (o2 < val), "" ); - static_assert ( !(o3 < val), "" ); // equal - static_assert ( (o3 < T(3)), "" ); + static_assert((o1 < T(1)), ""); + static_assert(!(o2 < T(1)), ""); // equal + static_assert(!(o3 < T(1)), ""); + static_assert((o2 < val), ""); + static_assert(!(o3 < val), ""); // equal + static_assert((o3 < T(3)), ""); - static_assert ( !(T(1) < o1), "" ); - static_assert ( !(T(1) < o2), "" ); // equal - static_assert ( (T(1) < o3), "" ); - static_assert ( !(val < o2), "" ); - static_assert ( !(val < o3), "" ); // equal - static_assert ( !(T(3) < o3), "" ); - } + static_assert(!(T(1) < o1), ""); + static_assert(!(T(1) < o2), ""); // equal + static_assert((T(1) < o3), ""); + static_assert(!(val < o2), ""); + static_assert(!(val < o3), ""); // equal + static_assert(!(T(3) < o3), ""); + } + { + using O = optional; + constexpr O o1(42); + static_assert(o1 < 101l, ""); + static_assert(!(42l < o1), ""); + } + { + using O = optional; + constexpr O o1(42); + static_assert(o1 < 101, ""); + static_assert(!(42 < o1), ""); + } } diff --git a/test/std/utilities/optional/optional.comp_with_t/not_equal.pass.cpp b/test/std/utilities/optional/optional.comp_with_t/not_equal.pass.cpp index ae2ff808f..7da9b7ba7 100644 --- a/test/std/utilities/optional/optional.comp_with_t/not_equal.pass.cpp +++ b/test/std/utilities/optional/optional.comp_with_t/not_equal.pass.cpp @@ -10,44 +10,55 @@ // UNSUPPORTED: c++98, c++03, c++11, c++14 // -// template constexpr bool operator!=(const optional& x, const T& v); -// template constexpr bool operator!=(const T& v, const optional& x); +// template constexpr bool operator!=(const optional& x, const U& v); +// template constexpr bool operator!=(const U& v, const optional& x); #include using std::optional; -struct X -{ - int i_; +struct X { + int i_; - constexpr X(int i) : i_(i) {} + constexpr X(int i) : i_(i) {} }; -constexpr bool operator != ( const X &lhs, const X &rhs ) - { return lhs.i_ != rhs.i_ ; } +constexpr bool operator!=(const X& lhs, const X& rhs) { + return lhs.i_ != rhs.i_; +} -int main() -{ - { +int main() { + { typedef X T; typedef optional O; constexpr T val(2); - constexpr O o1; // disengaged - constexpr O o2{1}; // engaged - constexpr O o3{val}; // engaged + constexpr O o1; // disengaged + constexpr O o2{1}; // engaged + constexpr O o3{val}; // engaged - static_assert ( (o1 != T(1)), "" ); - static_assert ( !(o2 != T(1)), "" ); - static_assert ( (o3 != T(1)), "" ); - static_assert ( !(o3 != T(2)), "" ); - static_assert ( !(o3 != val), "" ); + static_assert((o1 != T(1)), ""); + static_assert(!(o2 != T(1)), ""); + static_assert((o3 != T(1)), ""); + static_assert(!(o3 != T(2)), ""); + static_assert(!(o3 != val), ""); - static_assert ( (T(1) != o1), "" ); - static_assert ( !(T(1) != o2), "" ); - static_assert ( (T(1) != o3), "" ); - static_assert ( !(T(2) != o3), "" ); - static_assert ( !(val != o3), "" ); - } + static_assert((T(1) != o1), ""); + static_assert(!(T(1) != o2), ""); + static_assert((T(1) != o3), ""); + static_assert(!(T(2) != o3), ""); + static_assert(!(val != o3), ""); + } + { + using O = optional; + constexpr O o1(42); + static_assert(o1 != 101l, ""); + static_assert(!(42l != o1), ""); + } + { + using O = optional; + constexpr O o1(42); + static_assert(o1 != 101, ""); + static_assert(!(42 != o1), ""); + } } diff --git a/test/std/utilities/optional/optional.hash/hash.pass.cpp b/test/std/utilities/optional/optional.hash/hash.pass.cpp index ea89dc3bd..b4a1832cd 100644 --- a/test/std/utilities/optional/optional.hash/hash.pass.cpp +++ b/test/std/utilities/optional/optional.hash/hash.pass.cpp @@ -22,17 +22,28 @@ struct A {}; struct B {}; +namespace std { + template <> -struct std::hash { - size_t operator()(B const&) { return 0; } +struct hash { + size_t operator()(B const&) TEST_NOEXCEPT_FALSE { return 0; } }; +} + int main() { using std::optional; const std::size_t nullopt_hash = std::hash>{}(optional{}); + + { + optional opt; + ASSERT_NOT_NOEXCEPT(std::hash>()(opt)); + ASSERT_NOT_NOEXCEPT(std::hash>()(opt)); + } + { typedef int T; optional opt; diff --git a/test/std/utilities/optional/optional.object/optional.object.assign/assign_value.pass.cpp b/test/std/utilities/optional/optional.object/optional.object.assign/assign_value.pass.cpp index 1207e2415..0fcc52be1 100644 --- a/test/std/utilities/optional/optional.object/optional.object.assign/assign_value.pass.cpp +++ b/test/std/utilities/optional/optional.object/optional.object.assign/assign_value.pass.cpp @@ -216,7 +216,6 @@ void test_throws() #ifndef TEST_HAS_NO_EXCEPTIONS using T = ThrowAssign; { - using T = ThrowAssign; optional opt; try { opt = 42; diff --git a/test/std/utilities/optional/optional.object/optional.object.assign/emplace.pass.cpp b/test/std/utilities/optional/optional.object/optional.object.assign/emplace.pass.cpp index b53625899..e7f59f1a9 100644 --- a/test/std/utilities/optional/optional.object/optional.object.assign/emplace.pass.cpp +++ b/test/std/utilities/optional/optional.object/optional.object.assign/emplace.pass.cpp @@ -10,7 +10,7 @@ // UNSUPPORTED: c++98, c++03, c++11, c++14 // -// template void optional::emplace(Args&&... args); +// template T& optional::emplace(Args&&... args); #include #include @@ -51,27 +51,35 @@ void test_one_arg() { using Opt = std::optional; { Opt opt; - opt.emplace(); + auto & v = opt.emplace(); + static_assert( std::is_same_v, "" ); assert(static_cast(opt) == true); assert(*opt == T(0)); + assert(&v == &*opt); } { Opt opt; - opt.emplace(1); + auto & v = opt.emplace(1); + static_assert( std::is_same_v, "" ); assert(static_cast(opt) == true); assert(*opt == T(1)); + assert(&v == &*opt); } { Opt opt(2); - opt.emplace(); + auto & v = opt.emplace(); + static_assert( std::is_same_v, "" ); assert(static_cast(opt) == true); assert(*opt == T(0)); + assert(&v == &*opt); } { Opt opt(2); - opt.emplace(1); + auto & v = opt.emplace(1); + static_assert( std::is_same_v, "" ); assert(static_cast(opt) == true); assert(*opt == T(1)); + assert(&v == &*opt); } } @@ -83,20 +91,26 @@ void test_multi_arg() using Opt = std::optional; { Opt opt; - opt.emplace(101, 41); + auto &v = opt.emplace(101, 41); + static_assert( std::is_same_v, "" ); assert(static_cast(opt) == true); + assert( v == T(101, 41)); assert(*opt == T(101, 41)); } { Opt opt; - opt.emplace({1, 2, 3, 4}); + auto &v = opt.emplace({1, 2, 3, 4}); + static_assert( std::is_same_v, "" ); assert(static_cast(opt) == true); - assert(*opt == T(4)); // T sets its value to the size of the init list + assert( v == T(4)); // T sets its value to the size of the init list + assert(*opt == T(4)); } { Opt opt; - opt.emplace({1, 2, 3, 4, 5}, 6); + auto &v = opt.emplace({1, 2, 3, 4, 5}, 6); + static_assert( std::is_same_v, "" ); assert(static_cast(opt) == true); + assert( v == T(5)); // T sets its value to the size of the init list assert(*opt == T(5)); // T sets its value to the size of the init list } } @@ -109,73 +123,87 @@ void test_on_test_type() { assert(T::alive == 0); { T::reset_constructors(); - opt.emplace(); + auto &v = opt.emplace(); + static_assert( std::is_same_v, "" ); assert(T::alive == 1); assert(T::constructed == 1); assert(T::default_constructed == 1); assert(T::destroyed == 0); assert(static_cast(opt) == true); assert(*opt == T()); + assert(&v == &*opt); } { T::reset_constructors(); - opt.emplace(); + auto &v = opt.emplace(); + static_assert( std::is_same_v, "" ); assert(T::alive == 1); assert(T::constructed == 1); assert(T::default_constructed == 1); assert(T::destroyed == 1); assert(static_cast(opt) == true); assert(*opt == T()); + assert(&v == &*opt); } { T::reset_constructors(); - opt.emplace(101); + auto &v = opt.emplace(101); + static_assert( std::is_same_v, "" ); assert(T::alive == 1); assert(T::constructed == 1); assert(T::value_constructed == 1); assert(T::destroyed == 1); assert(static_cast(opt) == true); assert(*opt == T(101)); + assert(&v == &*opt); } { T::reset_constructors(); - opt.emplace(-10, 99); + auto &v = opt.emplace(-10, 99); + static_assert( std::is_same_v, "" ); assert(T::alive == 1); assert(T::constructed == 1); assert(T::value_constructed == 1); assert(T::destroyed == 1); assert(static_cast(opt) == true); assert(*opt == T(-10, 99)); + assert(&v == &*opt); } { T::reset_constructors(); - opt.emplace(-10, 99); + auto &v = opt.emplace(-10, 99); + static_assert( std::is_same_v, "" ); assert(T::alive == 1); assert(T::constructed == 1); assert(T::value_constructed == 1); assert(T::destroyed == 1); assert(static_cast(opt) == true); assert(*opt == T(-10, 99)); + assert(&v == &*opt); } { T::reset_constructors(); - opt.emplace({-10, 99, 42, 1}); + auto &v = opt.emplace({-10, 99, 42, 1}); + static_assert( std::is_same_v, "" ); assert(T::alive == 1); assert(T::constructed == 1); assert(T::value_constructed == 1); assert(T::destroyed == 1); assert(static_cast(opt) == true); assert(*opt == T(4)); // size of the initializer list + assert(&v == &*opt); } { T::reset_constructors(); - opt.emplace({-10, 99, 42, 1}, 42); + auto &v = opt.emplace({-10, 99, 42, 1}, 42); + static_assert( std::is_same_v, "" ); assert(T::alive == 1); assert(T::constructed == 1); assert(T::value_constructed == 1); assert(T::destroyed == 1); assert(static_cast(opt) == true); assert(*opt == T(4)); // size of the initializer list + assert(&v == &*opt); } } @@ -210,8 +238,10 @@ int main() } { optional opt; - opt.emplace(42); + auto &v = opt.emplace(42); + static_assert( std::is_same_v, "" ); assert(*opt == 42); + assert( v == 42); opt.emplace(); assert(*opt == 0); } @@ -224,7 +254,9 @@ int main() { assert(static_cast(opt) == true); assert(Y::dtor_called == false); - opt.emplace(1); + auto &v = opt.emplace(1); + static_assert( std::is_same_v, "" ); + assert(false); } catch (int i) { diff --git a/test/std/utilities/optional/optional.object/optional.object.assign/emplace_initializer_list.pass.cpp b/test/std/utilities/optional/optional.object/optional.object.assign/emplace_initializer_list.pass.cpp index 1c3c69a70..f6959c7e9 100644 --- a/test/std/utilities/optional/optional.object/optional.object.assign/emplace_initializer_list.pass.cpp +++ b/test/std/utilities/optional/optional.object/optional.object.assign/emplace_initializer_list.pass.cpp @@ -11,7 +11,7 @@ // // template -// void optional::emplace(initializer_list il, Args&&... args); +// T& optional::emplace(initializer_list il, Args&&... args); #include #include @@ -76,21 +76,27 @@ int main() X x; optional opt(x); assert(X::dtor_called == false); - opt.emplace({1, 2}); + auto &v = opt.emplace({1, 2}); + static_assert( std::is_same_v, "" ); assert(X::dtor_called == true); assert(*opt == X({1, 2})); + assert(&v == &*opt); } { optional> opt; - opt.emplace({1, 2, 3}, std::allocator()); + auto &v = opt.emplace({1, 2, 3}, std::allocator()); + static_assert( std::is_same_v&, decltype(v)>, "" ); assert(static_cast(opt) == true); assert(*opt == std::vector({1, 2, 3})); + assert(&v == &*opt); } { optional opt; - opt.emplace({1, 2}); + auto &v = opt.emplace({1, 2}); + static_assert( std::is_same_v, "" ); assert(static_cast(opt) == true); assert(*opt == Y({1, 2})); + assert(&v == &*opt); } #ifndef TEST_HAS_NO_EXCEPTIONS { @@ -100,7 +106,9 @@ int main() { assert(static_cast(opt) == true); assert(Z::dtor_called == false); - opt.emplace({1, 2}); + auto &v = opt.emplace({1, 2}); + static_assert( std::is_same_v, "" ); + assert(false); } catch (int i) { diff --git a/test/std/utilities/optional/optional.object/optional.object.ctor/U.pass.cpp b/test/std/utilities/optional/optional.object/optional.object.ctor/U.pass.cpp index 4020d70a4..e4e4a979e 100644 --- a/test/std/utilities/optional/optional.object/optional.object.ctor/U.pass.cpp +++ b/test/std/utilities/optional/optional.object/optional.object.ctor/U.pass.cpp @@ -9,6 +9,13 @@ // // UNSUPPORTED: c++98, c++03, c++11, c++14 +// XFAIL: with_system_cxx_lib=macosx10.12 +// XFAIL: with_system_cxx_lib=macosx10.11 +// XFAIL: with_system_cxx_lib=macosx10.10 +// XFAIL: with_system_cxx_lib=macosx10.9 +// XFAIL: with_system_cxx_lib=macosx10.7 +// XFAIL: with_system_cxx_lib=macosx10.8 + // // template @@ -35,6 +42,11 @@ struct ExplicitThrow constexpr explicit ExplicitThrow(int x) { if (x != -1) TEST_THROW(6);} }; +struct ImplicitAny { + template + constexpr ImplicitAny(U&&) {} +}; + template constexpr bool implicit_conversion(optional&& opt, const From& v) @@ -79,6 +91,15 @@ void test_implicit() using T = TestTypes::TestType; assert(implicit_conversion(3, T(3))); } + { + using O = optional; + static_assert(!test_convertible(), ""); + static_assert(!test_convertible(), ""); + static_assert(!test_convertible(), ""); + static_assert(!test_convertible(), ""); + static_assert(!test_convertible(), ""); + + } #ifndef TEST_HAS_NO_EXCEPTIONS { try { diff --git a/test/std/utilities/optional/optional.object/optional.object.ctor/const_T.pass.cpp b/test/std/utilities/optional/optional.object/optional.object.ctor/const_T.pass.cpp index 34a12b8ad..e9e98c0bd 100644 --- a/test/std/utilities/optional/optional.object/optional.object.ctor/const_T.pass.cpp +++ b/test/std/utilities/optional/optional.object/optional.object.ctor/const_T.pass.cpp @@ -9,6 +9,13 @@ // // UNSUPPORTED: c++98, c++03, c++11, c++14 +// XFAIL: with_system_cxx_lib=macosx10.12 +// XFAIL: with_system_cxx_lib=macosx10.11 +// XFAIL: with_system_cxx_lib=macosx10.10 +// XFAIL: with_system_cxx_lib=macosx10.9 +// XFAIL: with_system_cxx_lib=macosx10.7 +// XFAIL: with_system_cxx_lib=macosx10.8 + // // constexpr optional(const T& v); diff --git a/test/std/utilities/optional/optional.object/optional.object.ctor/copy.fail.cpp b/test/std/utilities/optional/optional.object/optional.object.ctor/copy.fail.cpp new file mode 100644 index 000000000..3224c1bac --- /dev/null +++ b/test/std/utilities/optional/optional.object/optional.object.ctor/copy.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, c++14 +// + +// constexpr optional(const optional& rhs); +// If is_trivially_copy_constructible_v is true, +// this constructor shall be a constexpr constructor. + +#include +#include +#include + +#include "test_macros.h" + +struct S { + constexpr S() : v_(0) {} + S(int v) : v_(v) {} + S(const S &rhs) : v_(rhs.v_) {} // make it not trivially copyable + int v_; + }; + + +int main() +{ + static_assert (!std::is_trivially_copy_constructible_v, "" ); + constexpr std::optional o1; + constexpr std::optional o2 = o1; // not constexpr +} diff --git a/test/std/utilities/optional/optional.object/optional.object.ctor/copy.pass.cpp b/test/std/utilities/optional/optional.object/optional.object.ctor/copy.pass.cpp index 5906d4edd..6b4283a28 100644 --- a/test/std/utilities/optional/optional.object/optional.object.ctor/copy.pass.cpp +++ b/test/std/utilities/optional/optional.object/optional.object.ctor/copy.pass.cpp @@ -10,7 +10,7 @@ // UNSUPPORTED: c++98, c++03, c++11, c++14 // -// optional(const optional& rhs); +// constexpr optional(const optional& rhs); #include #include @@ -32,6 +32,16 @@ void test(InitArgs&&... args) assert(*lhs == *rhs); } +template +constexpr bool constexpr_test(InitArgs&&... args) +{ + static_assert( std::is_trivially_copy_constructible_v, ""); // requirement + const optional rhs(std::forward(args)...); + optional lhs = rhs; + return (lhs.has_value() == rhs.has_value()) && + (lhs.has_value() ? *lhs == *rhs : true); +} + void test_throwing_ctor() { #ifndef TEST_HAS_NO_EXCEPTIONS struct Z { @@ -108,6 +118,9 @@ int main() { test(); test(3); + static_assert(constexpr_test(), "" ); + static_assert(constexpr_test(3), "" ); + { const optional o(42); optional o2(o); @@ -152,4 +165,9 @@ int main() { test_reference_extension(); } + { + constexpr std::optional o1{4}; + constexpr std::optional o2 = o1; + static_assert( *o2 == 4, "" ); + } } diff --git a/test/std/utilities/optional/optional.object/optional.object.ctor/move.fail.cpp b/test/std/utilities/optional/optional.object/optional.object.ctor/move.fail.cpp new file mode 100644 index 000000000..fb2e139ad --- /dev/null +++ b/test/std/utilities/optional/optional.object/optional.object.ctor/move.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, c++14 +// + +// constexpr optional(const optional&& rhs); +// If is_trivially_move_constructible_v is true, +// this constructor shall be a constexpr constructor. + +#include +#include +#include + +#include "test_macros.h" + +struct S { + constexpr S() : v_(0) {} + S(int v) : v_(v) {} + constexpr S(const S &rhs) : v_(rhs.v_) {} // not trivially moveable + constexpr S(const S &&rhs) : v_(rhs.v_) {} // not trivially moveable + int v_; + }; + + +int main() +{ + static_assert (!std::is_trivially_move_constructible_v, "" ); + constexpr std::optional o1; + constexpr std::optional o2 = std::move(o1); // not constexpr +} diff --git a/test/std/utilities/optional/optional.object/optional.object.ctor/move.pass.cpp b/test/std/utilities/optional/optional.object/optional.object.ctor/move.pass.cpp index bff6f5bf8..82acdd9d7 100644 --- a/test/std/utilities/optional/optional.object/optional.object.ctor/move.pass.cpp +++ b/test/std/utilities/optional/optional.object/optional.object.ctor/move.pass.cpp @@ -8,9 +8,17 @@ //===----------------------------------------------------------------------===// // UNSUPPORTED: c++98, c++03, c++11, c++14 + +// XFAIL: with_system_cxx_lib=macosx10.12 +// XFAIL: with_system_cxx_lib=macosx10.11 +// XFAIL: with_system_cxx_lib=macosx10.10 +// XFAIL: with_system_cxx_lib=macosx10.9 +// XFAIL: with_system_cxx_lib=macosx10.7 +// XFAIL: with_system_cxx_lib=macosx10.8 + // -// optional(optional&& rhs); +// constexpr optional(optional&& rhs); #include #include @@ -33,6 +41,17 @@ void test(InitArgs&&... args) assert(*lhs == *orig); } +template +constexpr bool constexpr_test(InitArgs&&... args) +{ + static_assert( std::is_trivially_copy_constructible_v, ""); // requirement + const optional orig(std::forward(args)...); + optional rhs(orig); + optional lhs = std::move(rhs); + return (lhs.has_value() == orig.has_value()) && + (lhs.has_value() ? *lhs == *orig : true); +} + void test_throwing_ctor() { #ifndef TEST_HAS_NO_EXCEPTIONS struct Z { @@ -136,6 +155,9 @@ int main() { test(); test(3); + static_assert(constexpr_test(), "" ); + static_assert(constexpr_test(3), "" ); + { optional o(42); optional o2(std::move(o)); @@ -198,4 +220,9 @@ int main() { test_reference_extension(); } + { + constexpr std::optional o1{4}; + constexpr std::optional o2 = std::move(o1); + static_assert( *o2 == 4, "" ); + } } diff --git a/test/std/utilities/optional/optional.object/optional.object.ctor/rvalue_T.pass.cpp b/test/std/utilities/optional/optional.object/optional.object.ctor/rvalue_T.pass.cpp index eee749d01..761cbee4b 100644 --- a/test/std/utilities/optional/optional.object/optional.object.ctor/rvalue_T.pass.cpp +++ b/test/std/utilities/optional/optional.object/optional.object.ctor/rvalue_T.pass.cpp @@ -9,6 +9,13 @@ // // UNSUPPORTED: c++98, c++03, c++11, c++14 +// XFAIL: with_system_cxx_lib=macosx10.12 +// XFAIL: with_system_cxx_lib=macosx10.11 +// XFAIL: with_system_cxx_lib=macosx10.10 +// XFAIL: with_system_cxx_lib=macosx10.9 +// XFAIL: with_system_cxx_lib=macosx10.7 +// XFAIL: with_system_cxx_lib=macosx10.8 + // // constexpr optional(T&& v); diff --git a/test/std/utilities/optional/optional.object/optional.object.observe/value.pass.cpp b/test/std/utilities/optional/optional.object/optional.object.observe/value.pass.cpp index 516a79db5..44e6e7305 100644 --- a/test/std/utilities/optional/optional.object/optional.object.observe/value.pass.cpp +++ b/test/std/utilities/optional/optional.object/optional.object.observe/value.pass.cpp @@ -8,6 +8,14 @@ //===----------------------------------------------------------------------===// // UNSUPPORTED: c++98, c++03, c++11, c++14 + +// XFAIL: with_system_cxx_lib=macosx10.12 +// XFAIL: with_system_cxx_lib=macosx10.11 +// XFAIL: with_system_cxx_lib=macosx10.10 +// XFAIL: with_system_cxx_lib=macosx10.9 +// XFAIL: with_system_cxx_lib=macosx10.7 +// XFAIL: with_system_cxx_lib=macosx10.8 + // // constexpr T& optional::value() &; diff --git a/test/std/utilities/optional/optional.object/optional.object.observe/value_const.pass.cpp b/test/std/utilities/optional/optional.object/optional.object.observe/value_const.pass.cpp index d4038e4ef..e2d48ec99 100644 --- a/test/std/utilities/optional/optional.object/optional.object.observe/value_const.pass.cpp +++ b/test/std/utilities/optional/optional.object/optional.object.observe/value_const.pass.cpp @@ -8,6 +8,14 @@ //===----------------------------------------------------------------------===// // UNSUPPORTED: c++98, c++03, c++11, c++14 + +// XFAIL: with_system_cxx_lib=macosx10.12 +// XFAIL: with_system_cxx_lib=macosx10.11 +// XFAIL: with_system_cxx_lib=macosx10.10 +// XFAIL: with_system_cxx_lib=macosx10.9 +// XFAIL: with_system_cxx_lib=macosx10.7 +// XFAIL: with_system_cxx_lib=macosx10.8 + // // constexpr const T& optional::value() const &; diff --git a/test/std/utilities/optional/optional.object/optional.object.observe/value_const_rvalue.pass.cpp b/test/std/utilities/optional/optional.object/optional.object.observe/value_const_rvalue.pass.cpp index e189d3af6..874a5441a 100644 --- a/test/std/utilities/optional/optional.object/optional.object.observe/value_const_rvalue.pass.cpp +++ b/test/std/utilities/optional/optional.object/optional.object.observe/value_const_rvalue.pass.cpp @@ -8,6 +8,14 @@ //===----------------------------------------------------------------------===// // UNSUPPORTED: c++98, c++03, c++11, c++14 + +// XFAIL: with_system_cxx_lib=macosx10.12 +// XFAIL: with_system_cxx_lib=macosx10.11 +// XFAIL: with_system_cxx_lib=macosx10.10 +// XFAIL: with_system_cxx_lib=macosx10.9 +// XFAIL: with_system_cxx_lib=macosx10.7 +// XFAIL: with_system_cxx_lib=macosx10.8 + // // constexpr const T& optional::value() const &&; diff --git a/test/std/utilities/optional/optional.object/optional.object.observe/value_or.pass.cpp b/test/std/utilities/optional/optional.object/optional.object.observe/value_or.pass.cpp index c219e9704..f94dcabde 100644 --- a/test/std/utilities/optional/optional.object/optional.object.observe/value_or.pass.cpp +++ b/test/std/utilities/optional/optional.object/optional.object.observe/value_or.pass.cpp @@ -10,7 +10,7 @@ // UNSUPPORTED: c++98, c++03, c++11, c++14 // -// template T optional::value_or(U&& v) &&; +// template constexpr T optional::value_or(U&& v) &&; #include #include @@ -26,22 +26,22 @@ struct Y { int i_; - Y(int i) : i_(i) {} + constexpr Y(int i) : i_(i) {} }; struct X { int i_; - X(int i) : i_(i) {} - X(X&& x) : i_(x.i_) {x.i_ = 0;} - X(const Y& y) : i_(y.i_) {} - X(Y&& y) : i_(y.i_+1) {} + constexpr X(int i) : i_(i) {} + constexpr X(X&& x) : i_(x.i_) {x.i_ = 0;} + constexpr X(const Y& y) : i_(y.i_) {} + constexpr X(Y&& y) : i_(y.i_+1) {} friend constexpr bool operator==(const X& x, const X& y) {return x.i_ == y.i_;} }; -int main() +constexpr int test() { { optional opt(in_place, 2); @@ -65,4 +65,10 @@ int main() assert(std::move(opt).value_or(Y(3)) == 4); assert(!opt); } + return 0; +} + +int main() +{ + static_assert(test() == 0); } diff --git a/test/std/utilities/optional/optional.object/optional.object.observe/value_rvalue.pass.cpp b/test/std/utilities/optional/optional.object/optional.object.observe/value_rvalue.pass.cpp index 2ef485b7f..60cab7d27 100644 --- a/test/std/utilities/optional/optional.object/optional.object.observe/value_rvalue.pass.cpp +++ b/test/std/utilities/optional/optional.object/optional.object.observe/value_rvalue.pass.cpp @@ -10,6 +10,13 @@ // UNSUPPORTED: c++98, c++03, c++11, c++14 // +// XFAIL: with_system_cxx_lib=macosx10.12 +// XFAIL: with_system_cxx_lib=macosx10.11 +// XFAIL: with_system_cxx_lib=macosx10.10 +// XFAIL: with_system_cxx_lib=macosx10.9 +// XFAIL: with_system_cxx_lib=macosx10.7 +// XFAIL: with_system_cxx_lib=macosx10.8 + // constexpr T& optional::value() &&; #include diff --git a/test/std/utilities/optional/optional.relops/equal.pass.cpp b/test/std/utilities/optional/optional.relops/equal.pass.cpp index 6650b6720..0752841d3 100644 --- a/test/std/utilities/optional/optional.relops/equal.pass.cpp +++ b/test/std/utilities/optional/optional.relops/equal.pass.cpp @@ -10,7 +10,7 @@ // UNSUPPORTED: c++98, c++03, c++11, c++14 // -// template constexpr bool operator==(const optional& x, const optional& y); +// template constexpr bool operator==(const optional& x, const optional& y); #include #include @@ -18,57 +18,69 @@ using std::optional; -struct X -{ - int i_; +struct X { + int i_; - constexpr X(int i) : i_(i) {} + constexpr X(int i) : i_(i) {} }; -constexpr bool operator == ( const X &lhs, const X &rhs ) - { return lhs.i_ == rhs.i_ ; } +constexpr bool operator==(const X& lhs, const X& rhs) { + return lhs.i_ == rhs.i_; +} -int main() -{ - { +int main() { + { typedef X T; typedef optional O; - constexpr O o1; // disengaged - constexpr O o2; // disengaged - constexpr O o3{1}; // engaged - constexpr O o4{2}; // engaged - constexpr O o5{1}; // engaged + constexpr O o1; // disengaged + constexpr O o2; // disengaged + constexpr O o3{1}; // engaged + constexpr O o4{2}; // engaged + constexpr O o5{1}; // engaged - static_assert ( o1 == o1 , "" ); - static_assert ( o1 == o2 , "" ); - static_assert ( !(o1 == o3), "" ); - static_assert ( !(o1 == o4), "" ); - static_assert ( !(o1 == o5), "" ); + static_assert(o1 == o1, ""); + static_assert(o1 == o2, ""); + static_assert(!(o1 == o3), ""); + static_assert(!(o1 == o4), ""); + static_assert(!(o1 == o5), ""); - static_assert ( o2 == o1 , "" ); - static_assert ( o2 == o2 , "" ); - static_assert ( !(o2 == o3), "" ); - static_assert ( !(o2 == o4), "" ); - static_assert ( !(o2 == o5), "" ); + static_assert(o2 == o1, ""); + static_assert(o2 == o2, ""); + static_assert(!(o2 == o3), ""); + static_assert(!(o2 == o4), ""); + static_assert(!(o2 == o5), ""); - static_assert ( !(o3 == o1), "" ); - static_assert ( !(o3 == o2), "" ); - static_assert ( o3 == o3 , "" ); - static_assert ( !(o3 == o4), "" ); - static_assert ( o3 == o5 , "" ); + static_assert(!(o3 == o1), ""); + static_assert(!(o3 == o2), ""); + static_assert(o3 == o3, ""); + static_assert(!(o3 == o4), ""); + static_assert(o3 == o5, ""); - static_assert ( !(o4 == o1), "" ); - static_assert ( !(o4 == o2), "" ); - static_assert ( !(o4 == o3), "" ); - static_assert ( o4 == o4 , "" ); - static_assert ( !(o4 == o5), "" ); + static_assert(!(o4 == o1), ""); + static_assert(!(o4 == o2), ""); + static_assert(!(o4 == o3), ""); + static_assert(o4 == o4, ""); + static_assert(!(o4 == o5), ""); - static_assert ( !(o5 == o1), "" ); - static_assert ( !(o5 == o2), "" ); - static_assert ( o5 == o3 , "" ); - static_assert ( !(o5 == o4), "" ); - static_assert ( o5 == o5 , "" ); - - } + static_assert(!(o5 == o1), ""); + static_assert(!(o5 == o2), ""); + static_assert(o5 == o3, ""); + static_assert(!(o5 == o4), ""); + static_assert(o5 == o5, ""); + } + { + using O1 = optional; + using O2 = optional; + constexpr O1 o1(42); + static_assert(o1 == O2(42), ""); + static_assert(!(O2(101) == o1), ""); + } + { + using O1 = optional; + using O2 = optional; + constexpr O1 o1(42); + static_assert(o1 == O2(42), ""); + static_assert(!(O2(101) == o1), ""); + } } diff --git a/test/std/utilities/optional/optional.relops/greater_equal.pass.cpp b/test/std/utilities/optional/optional.relops/greater_equal.pass.cpp index f9b304496..f475f3796 100644 --- a/test/std/utilities/optional/optional.relops/greater_equal.pass.cpp +++ b/test/std/utilities/optional/optional.relops/greater_equal.pass.cpp @@ -10,61 +10,74 @@ // UNSUPPORTED: c++98, c++03, c++11, c++14 // -// template constexpr bool operator>= (const optional& x, const optional& y); +// template constexpr bool operator>= (const optional& x, const optional& y); #include using std::optional; -struct X -{ - int i_; +struct X { + int i_; - constexpr X(int i) : i_(i) {} + constexpr X(int i) : i_(i) {} }; -constexpr bool operator >= ( const X &lhs, const X &rhs ) - { return lhs.i_ >= rhs.i_ ; } +constexpr bool operator>=(const X& lhs, const X& rhs) { + return lhs.i_ >= rhs.i_; +} -int main() -{ - { +int main() { + { typedef optional O; - constexpr O o1; // disengaged - constexpr O o2; // disengaged - constexpr O o3{1}; // engaged - constexpr O o4{2}; // engaged - constexpr O o5{1}; // engaged + constexpr O o1; // disengaged + constexpr O o2; // disengaged + constexpr O o3{1}; // engaged + constexpr O o4{2}; // engaged + constexpr O o5{1}; // engaged - static_assert ( (o1 >= o1), "" ); - static_assert ( (o1 >= o2), "" ); - static_assert ( !(o1 >= o3), "" ); - static_assert ( !(o1 >= o4), "" ); - static_assert ( !(o1 >= o5), "" ); + static_assert((o1 >= o1), ""); + static_assert((o1 >= o2), ""); + static_assert(!(o1 >= o3), ""); + static_assert(!(o1 >= o4), ""); + static_assert(!(o1 >= o5), ""); - static_assert ( (o2 >= o1), "" ); - static_assert ( (o2 >= o2), "" ); - static_assert ( !(o2 >= o3), "" ); - static_assert ( !(o2 >= o4), "" ); - static_assert ( !(o2 >= o5), "" ); + static_assert((o2 >= o1), ""); + static_assert((o2 >= o2), ""); + static_assert(!(o2 >= o3), ""); + static_assert(!(o2 >= o4), ""); + static_assert(!(o2 >= o5), ""); - static_assert ( (o3 >= o1), "" ); - static_assert ( (o3 >= o2), "" ); - static_assert ( (o3 >= o3), "" ); - static_assert ( !(o3 >= o4), "" ); - static_assert ( (o3 >= o5), "" ); + static_assert((o3 >= o1), ""); + static_assert((o3 >= o2), ""); + static_assert((o3 >= o3), ""); + static_assert(!(o3 >= o4), ""); + static_assert((o3 >= o5), ""); - static_assert ( (o4 >= o1), "" ); - static_assert ( (o4 >= o2), "" ); - static_assert ( (o4 >= o3), "" ); - static_assert ( (o4 >= o4), "" ); - static_assert ( (o4 >= o5), "" ); + static_assert((o4 >= o1), ""); + static_assert((o4 >= o2), ""); + static_assert((o4 >= o3), ""); + static_assert((o4 >= o4), ""); + static_assert((o4 >= o5), ""); - static_assert ( (o5 >= o1), "" ); - static_assert ( (o5 >= o2), "" ); - static_assert ( (o5 >= o3), "" ); - static_assert ( !(o5 >= o4), "" ); - static_assert ( (o5 >= o5), "" ); - } + static_assert((o5 >= o1), ""); + static_assert((o5 >= o2), ""); + static_assert((o5 >= o3), ""); + static_assert(!(o5 >= o4), ""); + static_assert((o5 >= o5), ""); + } + { + using O1 = optional; + using O2 = optional; + constexpr O1 o1(42); + static_assert(o1 >= O2(42), ""); + static_assert(!(O2(11) >= o1), ""); + } + { + using O1 = optional; + using O2 = optional; + constexpr O1 o1(42); + static_assert(o1 >= O2(42), ""); + static_assert(!(O2(1) >= o1), ""); + } } diff --git a/test/std/utilities/optional/optional.relops/greater_than.pass.cpp b/test/std/utilities/optional/optional.relops/greater_than.pass.cpp index 8a27eb471..c3f2af932 100644 --- a/test/std/utilities/optional/optional.relops/greater_than.pass.cpp +++ b/test/std/utilities/optional/optional.relops/greater_than.pass.cpp @@ -10,61 +10,72 @@ // UNSUPPORTED: c++98, c++03, c++11, c++14 // -// template constexpr bool operator> (const optional& x, const optional& y); +// template constexpr bool operator> (const optional& x, const optional& y); #include using std::optional; -struct X -{ - int i_; +struct X { + int i_; - constexpr X(int i) : i_(i) {} + constexpr X(int i) : i_(i) {} }; -constexpr bool operator > ( const X &lhs, const X &rhs ) - { return lhs.i_ > rhs.i_ ; } +constexpr bool operator>(const X& lhs, const X& rhs) { return lhs.i_ > rhs.i_; } -int main() -{ - { +int main() { + { typedef optional O; - constexpr O o1; // disengaged - constexpr O o2; // disengaged - constexpr O o3{1}; // engaged - constexpr O o4{2}; // engaged - constexpr O o5{1}; // engaged + constexpr O o1; // disengaged + constexpr O o2; // disengaged + constexpr O o3{1}; // engaged + constexpr O o4{2}; // engaged + constexpr O o5{1}; // engaged - static_assert ( !(o1 > o1), "" ); - static_assert ( !(o1 > o2), "" ); - static_assert ( !(o1 > o3), "" ); - static_assert ( !(o1 > o4), "" ); - static_assert ( !(o1 > o5), "" ); + static_assert(!(o1 > o1), ""); + static_assert(!(o1 > o2), ""); + static_assert(!(o1 > o3), ""); + static_assert(!(o1 > o4), ""); + static_assert(!(o1 > o5), ""); - static_assert ( !(o2 > o1), "" ); - static_assert ( !(o2 > o2), "" ); - static_assert ( !(o2 > o3), "" ); - static_assert ( !(o2 > o4), "" ); - static_assert ( !(o2 > o5), "" ); + static_assert(!(o2 > o1), ""); + static_assert(!(o2 > o2), ""); + static_assert(!(o2 > o3), ""); + static_assert(!(o2 > o4), ""); + static_assert(!(o2 > o5), ""); - static_assert ( (o3 > o1), "" ); - static_assert ( (o3 > o2), "" ); - static_assert ( !(o3 > o3), "" ); - static_assert ( !(o3 > o4), "" ); - static_assert ( !(o3 > o5), "" ); + static_assert((o3 > o1), ""); + static_assert((o3 > o2), ""); + static_assert(!(o3 > o3), ""); + static_assert(!(o3 > o4), ""); + static_assert(!(o3 > o5), ""); - static_assert ( (o4 > o1), "" ); - static_assert ( (o4 > o2), "" ); - static_assert ( (o4 > o3), "" ); - static_assert ( !(o4 > o4), "" ); - static_assert ( (o4 > o5), "" ); + static_assert((o4 > o1), ""); + static_assert((o4 > o2), ""); + static_assert((o4 > o3), ""); + static_assert(!(o4 > o4), ""); + static_assert((o4 > o5), ""); - static_assert ( (o5 > o1), "" ); - static_assert ( (o5 > o2), "" ); - static_assert ( !(o5 > o3), "" ); - static_assert ( !(o5 > o4), "" ); - static_assert ( !(o5 > o5), "" ); - } + static_assert((o5 > o1), ""); + static_assert((o5 > o2), ""); + static_assert(!(o5 > o3), ""); + static_assert(!(o5 > o4), ""); + static_assert(!(o5 > o5), ""); + } + { + using O1 = optional; + using O2 = optional; + constexpr O1 o1(42); + static_assert(o1 > O2(1), ""); + static_assert(!(O2(42) > o1), ""); + } + { + using O1 = optional; + using O2 = optional; + constexpr O1 o1(42); + static_assert(o1 > O2(1), ""); + static_assert(!(O2(42) > o1), ""); + } } diff --git a/test/std/utilities/optional/optional.relops/less_equal.pass.cpp b/test/std/utilities/optional/optional.relops/less_equal.pass.cpp index a7d594dd3..35e80d3d4 100644 --- a/test/std/utilities/optional/optional.relops/less_equal.pass.cpp +++ b/test/std/utilities/optional/optional.relops/less_equal.pass.cpp @@ -10,61 +10,74 @@ // UNSUPPORTED: c++98, c++03, c++11, c++14 // -// template constexpr bool operator<= (const optional& x, const optional& y); +// template constexpr bool operator<= (const optional& x, const optional& y); #include using std::optional; -struct X -{ - int i_; +struct X { + int i_; - constexpr X(int i) : i_(i) {} + constexpr X(int i) : i_(i) {} }; -constexpr bool operator <= ( const X &lhs, const X &rhs ) - { return lhs.i_ <= rhs.i_ ; } +constexpr bool operator<=(const X& lhs, const X& rhs) { + return lhs.i_ <= rhs.i_; +} -int main() -{ - { +int main() { + { typedef optional O; - constexpr O o1; // disengaged - constexpr O o2; // disengaged - constexpr O o3{1}; // engaged - constexpr O o4{2}; // engaged - constexpr O o5{1}; // engaged + constexpr O o1; // disengaged + constexpr O o2; // disengaged + constexpr O o3{1}; // engaged + constexpr O o4{2}; // engaged + constexpr O o5{1}; // engaged - static_assert ( (o1 <= o1), "" ); - static_assert ( (o1 <= o2), "" ); - static_assert ( (o1 <= o3), "" ); - static_assert ( (o1 <= o4), "" ); - static_assert ( (o1 <= o5), "" ); + static_assert((o1 <= o1), ""); + static_assert((o1 <= o2), ""); + static_assert((o1 <= o3), ""); + static_assert((o1 <= o4), ""); + static_assert((o1 <= o5), ""); - static_assert ( (o2 <= o1), "" ); - static_assert ( (o2 <= o2), "" ); - static_assert ( (o2 <= o3), "" ); - static_assert ( (o2 <= o4), "" ); - static_assert ( (o2 <= o5), "" ); + static_assert((o2 <= o1), ""); + static_assert((o2 <= o2), ""); + static_assert((o2 <= o3), ""); + static_assert((o2 <= o4), ""); + static_assert((o2 <= o5), ""); - static_assert ( !(o3 <= o1), "" ); - static_assert ( !(o3 <= o2), "" ); - static_assert ( (o3 <= o3), "" ); - static_assert ( (o3 <= o4), "" ); - static_assert ( (o3 <= o5), "" ); + static_assert(!(o3 <= o1), ""); + static_assert(!(o3 <= o2), ""); + static_assert((o3 <= o3), ""); + static_assert((o3 <= o4), ""); + static_assert((o3 <= o5), ""); - static_assert ( !(o4 <= o1), "" ); - static_assert ( !(o4 <= o2), "" ); - static_assert ( !(o4 <= o3), "" ); - static_assert ( (o4 <= o4), "" ); - static_assert ( !(o4 <= o5), "" ); + static_assert(!(o4 <= o1), ""); + static_assert(!(o4 <= o2), ""); + static_assert(!(o4 <= o3), ""); + static_assert((o4 <= o4), ""); + static_assert(!(o4 <= o5), ""); - static_assert ( !(o5 <= o1), "" ); - static_assert ( !(o5 <= o2), "" ); - static_assert ( (o5 <= o3), "" ); - static_assert ( (o5 <= o4), "" ); - static_assert ( (o5 <= o5), "" ); - } + static_assert(!(o5 <= o1), ""); + static_assert(!(o5 <= o2), ""); + static_assert((o5 <= o3), ""); + static_assert((o5 <= o4), ""); + static_assert((o5 <= o5), ""); + } + { + using O1 = optional; + using O2 = optional; + constexpr O1 o1(42); + static_assert(o1 <= O2(42), ""); + static_assert(!(O2(101) <= o1), ""); + } + { + using O1 = optional; + using O2 = optional; + constexpr O1 o1(42); + static_assert(o1 <= O2(42), ""); + static_assert(!(O2(101) <= o1), ""); + } } diff --git a/test/std/utilities/optional/optional.relops/less_than.pass.cpp b/test/std/utilities/optional/optional.relops/less_than.pass.cpp index deffa5e84..1dbffbd92 100644 --- a/test/std/utilities/optional/optional.relops/less_than.pass.cpp +++ b/test/std/utilities/optional/optional.relops/less_than.pass.cpp @@ -10,61 +10,72 @@ // UNSUPPORTED: c++98, c++03, c++11, c++14 // -// template constexpr bool operator< (const optional& x, const optional& y); +// template constexpr bool operator< (const optional& x, const optional& y); #include using std::optional; -struct X -{ - int i_; +struct X { + int i_; - constexpr X(int i) : i_(i) {} + constexpr X(int i) : i_(i) {} }; -constexpr bool operator < ( const X &lhs, const X &rhs ) - { return lhs.i_ < rhs.i_ ; } +constexpr bool operator<(const X& lhs, const X& rhs) { return lhs.i_ < rhs.i_; } -int main() -{ - { +int main() { + { typedef optional O; - constexpr O o1; // disengaged - constexpr O o2; // disengaged - constexpr O o3{1}; // engaged - constexpr O o4{2}; // engaged - constexpr O o5{1}; // engaged + constexpr O o1; // disengaged + constexpr O o2; // disengaged + constexpr O o3{1}; // engaged + constexpr O o4{2}; // engaged + constexpr O o5{1}; // engaged - static_assert ( !(o1 < o1), "" ); - static_assert ( !(o1 < o2), "" ); - static_assert ( (o1 < o3), "" ); - static_assert ( (o1 < o4), "" ); - static_assert ( (o1 < o5), "" ); + static_assert(!(o1 < o1), ""); + static_assert(!(o1 < o2), ""); + static_assert((o1 < o3), ""); + static_assert((o1 < o4), ""); + static_assert((o1 < o5), ""); - static_assert ( !(o2 < o1), "" ); - static_assert ( !(o2 < o2), "" ); - static_assert ( (o2 < o3), "" ); - static_assert ( (o2 < o4), "" ); - static_assert ( (o2 < o5), "" ); + static_assert(!(o2 < o1), ""); + static_assert(!(o2 < o2), ""); + static_assert((o2 < o3), ""); + static_assert((o2 < o4), ""); + static_assert((o2 < o5), ""); - static_assert ( !(o3 < o1), "" ); - static_assert ( !(o3 < o2), "" ); - static_assert ( !(o3 < o3), "" ); - static_assert ( (o3 < o4), "" ); - static_assert ( !(o3 < o5), "" ); + static_assert(!(o3 < o1), ""); + static_assert(!(o3 < o2), ""); + static_assert(!(o3 < o3), ""); + static_assert((o3 < o4), ""); + static_assert(!(o3 < o5), ""); - static_assert ( !(o4 < o1), "" ); - static_assert ( !(o4 < o2), "" ); - static_assert ( !(o4 < o3), "" ); - static_assert ( !(o4 < o4), "" ); - static_assert ( !(o4 < o5), "" ); + static_assert(!(o4 < o1), ""); + static_assert(!(o4 < o2), ""); + static_assert(!(o4 < o3), ""); + static_assert(!(o4 < o4), ""); + static_assert(!(o4 < o5), ""); - static_assert ( !(o5 < o1), "" ); - static_assert ( !(o5 < o2), "" ); - static_assert ( !(o5 < o3), "" ); - static_assert ( (o5 < o4), "" ); - static_assert ( !(o5 < o5), "" ); - } + static_assert(!(o5 < o1), ""); + static_assert(!(o5 < o2), ""); + static_assert(!(o5 < o3), ""); + static_assert((o5 < o4), ""); + static_assert(!(o5 < o5), ""); + } + { + using O1 = optional; + using O2 = optional; + constexpr O1 o1(42); + static_assert(o1 < O2(101), ""); + static_assert(!(O2(101) < o1), ""); + } + { + using O1 = optional; + using O2 = optional; + constexpr O1 o1(42); + static_assert(o1 < O2(101), ""); + static_assert(!(O2(101) < o1), ""); + } } diff --git a/test/std/utilities/optional/optional.relops/not_equal.pass.cpp b/test/std/utilities/optional/optional.relops/not_equal.pass.cpp index fd11b2a20..12d9922a9 100644 --- a/test/std/utilities/optional/optional.relops/not_equal.pass.cpp +++ b/test/std/utilities/optional/optional.relops/not_equal.pass.cpp @@ -10,7 +10,7 @@ // UNSUPPORTED: c++98, c++03, c++11, c++14 // -// template constexpr bool operator!=(const optional& x, const optional& y); +// template constexpr bool operator!=(const optional& x, const optional& y); #include #include @@ -18,57 +18,69 @@ using std::optional; -struct X -{ - int i_; +struct X { + int i_; - constexpr X(int i) : i_(i) {} + constexpr X(int i) : i_(i) {} }; -constexpr bool operator != ( const X &lhs, const X &rhs ) - { return lhs.i_ != rhs.i_ ; } +constexpr bool operator!=(const X& lhs, const X& rhs) { + return lhs.i_ != rhs.i_; +} -int main() -{ - { +int main() { + { typedef X T; typedef optional O; - constexpr O o1; // disengaged - constexpr O o2; // disengaged - constexpr O o3{1}; // engaged - constexpr O o4{2}; // engaged - constexpr O o5{1}; // engaged + constexpr O o1; // disengaged + constexpr O o2; // disengaged + constexpr O o3{1}; // engaged + constexpr O o4{2}; // engaged + constexpr O o5{1}; // engaged - static_assert ( !(o1 != o1), "" ); - static_assert ( !(o1 != o2), "" ); - static_assert ( (o1 != o3), "" ); - static_assert ( (o1 != o4), "" ); - static_assert ( (o1 != o5), "" ); + static_assert(!(o1 != o1), ""); + static_assert(!(o1 != o2), ""); + static_assert((o1 != o3), ""); + static_assert((o1 != o4), ""); + static_assert((o1 != o5), ""); - static_assert ( !(o2 != o1), "" ); - static_assert ( !(o2 != o2), "" ); - static_assert ( (o2 != o3), "" ); - static_assert ( (o2 != o4), "" ); - static_assert ( (o2 != o5), "" ); + static_assert(!(o2 != o1), ""); + static_assert(!(o2 != o2), ""); + static_assert((o2 != o3), ""); + static_assert((o2 != o4), ""); + static_assert((o2 != o5), ""); - static_assert ( (o3 != o1), "" ); - static_assert ( (o3 != o2), "" ); - static_assert ( !(o3 != o3), "" ); - static_assert ( (o3 != o4), "" ); - static_assert ( !(o3 != o5), "" ); + static_assert((o3 != o1), ""); + static_assert((o3 != o2), ""); + static_assert(!(o3 != o3), ""); + static_assert((o3 != o4), ""); + static_assert(!(o3 != o5), ""); - static_assert ( (o4 != o1), "" ); - static_assert ( (o4 != o2), "" ); - static_assert ( (o4 != o3), "" ); - static_assert ( !(o4 != o4), "" ); - static_assert ( (o4 != o5), "" ); + static_assert((o4 != o1), ""); + static_assert((o4 != o2), ""); + static_assert((o4 != o3), ""); + static_assert(!(o4 != o4), ""); + static_assert((o4 != o5), ""); - static_assert ( (o5 != o1), "" ); - static_assert ( (o5 != o2), "" ); - static_assert ( !(o5 != o3), "" ); - static_assert ( (o5 != o4), "" ); - static_assert ( !(o5 != o5), "" ); - - } + static_assert((o5 != o1), ""); + static_assert((o5 != o2), ""); + static_assert(!(o5 != o3), ""); + static_assert((o5 != o4), ""); + static_assert(!(o5 != o5), ""); + } + { + using O1 = optional; + using O2 = optional; + constexpr O1 o1(42); + static_assert(o1 != O2(101), ""); + static_assert(!(O2(42) != o1), ""); + } + { + using O1 = optional; + using O2 = optional; + constexpr O1 o1(42); + static_assert(o1 != O2(101), ""); + static_assert(!(O2(42) != o1), ""); + } } diff --git a/test/std/utilities/smartptr/unique.ptr/README.TXT b/test/std/utilities/smartptr/unique.ptr/README.TXT new file mode 100644 index 000000000..20f77f618 --- /dev/null +++ b/test/std/utilities/smartptr/unique.ptr/README.TXT @@ -0,0 +1,16 @@ +Test Naming and Directory Structure +=================================== + +The directory structure for the unique_ptr class templates differs from the +normal test directory naming conventions (e.g. matching the stable name in the standard). + +Instead of having a [unique.ptr.single] and [unique.ptr.runtime] directory, +each containing their own tests, a single directory, "unique.ptr.class", +contains both sets of tests. + +This allows the common behavior of the two unique_ptr specializations to be +tested in the same place without duplication. + +Tests specific to [unique.ptr.single] have the suffix ".single.pass.cpp" +and those specific to [unique.ptr.runtime] are named "*.runtime.pass.cpp". +Tests for both specializations are named normally. diff --git a/test/std/utilities/memory/unique.ptr/nothing_to_do.pass.cpp b/test/std/utilities/smartptr/unique.ptr/nothing_to_do.pass.cpp similarity index 100% rename from test/std/utilities/memory/unique.ptr/nothing_to_do.pass.cpp rename to test/std/utilities/smartptr/unique.ptr/nothing_to_do.pass.cpp diff --git a/test/std/utilities/smartptr/unique.ptr/unique.ptr.class/pointer_type.pass.cpp b/test/std/utilities/smartptr/unique.ptr/unique.ptr.class/pointer_type.pass.cpp new file mode 100644 index 000000000..54c2cf16e --- /dev/null +++ b/test/std/utilities/smartptr/unique.ptr/unique.ptr.class/pointer_type.pass.cpp @@ -0,0 +1,61 @@ +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// + +// unique_ptr + +// Test unique_ptr::pointer type + +#include +#include + +#include "test_macros.h" + +struct Deleter { + struct pointer {}; +}; + +struct D2 { +private: + typedef void pointer; +}; + +struct D3 { + static long pointer; +}; + +template +void test_basic() { + typedef typename std::conditional::type VT; + { + typedef std::unique_ptr P; + static_assert((std::is_same::value), ""); + } + { + typedef std::unique_ptr P; + static_assert((std::is_same::value), + ""); + } +#if TEST_STD_VER >= 11 + { + typedef std::unique_ptr P; + static_assert(std::is_same::value, ""); + } + { + typedef std::unique_ptr P; + static_assert(std::is_same::value, ""); + } +#endif +} + +int main() { + test_basic(); + test_basic(); +} diff --git a/test/std/utilities/smartptr/unique.ptr/unique.ptr.class/unique.ptr.asgn/move.pass.cpp b/test/std/utilities/smartptr/unique.ptr/unique.ptr.class/unique.ptr.asgn/move.pass.cpp new file mode 100644 index 000000000..5d2f955aa --- /dev/null +++ b/test/std/utilities/smartptr/unique.ptr/unique.ptr.class/unique.ptr.asgn/move.pass.cpp @@ -0,0 +1,120 @@ +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// UNSUPPORTED: c++98, c++03 + +// + +// unique_ptr + +// Test unique_ptr move assignment + +// test move assignment. Should only require a MoveConstructible deleter, or if +// deleter is a reference, not even that. + +#include +#include +#include + +#include "deleter_types.h" +#include "unique_ptr_test_helper.h" + +struct GenericDeleter { + void operator()(void*) const; +}; + +template +void test_basic() { + typedef typename std::conditional::type VT; + const int expect_alive = IsArray ? 5 : 1; + { + std::unique_ptr s1(newValue(expect_alive)); + A* p = s1.get(); + std::unique_ptr s2(newValue(expect_alive)); + assert(A::count == (expect_alive * 2)); + s2 = std::move(s1); + assert(A::count == expect_alive); + assert(s2.get() == p); + assert(s1.get() == 0); + } + assert(A::count == 0); + { + std::unique_ptr > s1(newValue(expect_alive), + Deleter(5)); + A* p = s1.get(); + std::unique_ptr > s2(newValue(expect_alive)); + assert(A::count == (expect_alive * 2)); + s2 = std::move(s1); + assert(s2.get() == p); + assert(s1.get() == 0); + assert(A::count == expect_alive); + assert(s2.get_deleter().state() == 5); + assert(s1.get_deleter().state() == 0); + } + assert(A::count == 0); + { + CDeleter d1(5); + std::unique_ptr&> s1(newValue(expect_alive), d1); + A* p = s1.get(); + CDeleter d2(6); + std::unique_ptr&> s2(newValue(expect_alive), d2); + s2 = std::move(s1); + assert(s2.get() == p); + assert(s1.get() == 0); + assert(A::count == expect_alive); + assert(d1.state() == 5); + assert(d2.state() == 5); + } + assert(A::count == 0); +} + +template +void test_sfinae() { + typedef typename std::conditional::type VT; + { + typedef std::unique_ptr U; + static_assert(!std::is_assignable::value, ""); + static_assert(!std::is_assignable::value, ""); + static_assert(!std::is_assignable::value, ""); + static_assert(std::is_nothrow_assignable::value, ""); + } + { + typedef std::unique_ptr U; + static_assert(!std::is_assignable::value, ""); + static_assert(!std::is_assignable::value, ""); + static_assert(!std::is_assignable::value, ""); + static_assert(std::is_nothrow_assignable::value, ""); + } + { + typedef std::unique_ptr&> U; + static_assert(!std::is_assignable::value, ""); + static_assert(!std::is_assignable::value, ""); + static_assert(!std::is_assignable::value, ""); + static_assert(std::is_nothrow_assignable::value, ""); + } + { + typedef std::unique_ptr&> U; + static_assert(!std::is_assignable::value, ""); + static_assert(!std::is_assignable::value, ""); + static_assert(!std::is_assignable::value, ""); + static_assert(std::is_nothrow_assignable::value, ""); + } +} + + +int main() { + { + test_basic(); + test_sfinae(); + } + { + test_basic(); + test_sfinae(); + } +} diff --git a/test/std/utilities/smartptr/unique.ptr/unique.ptr.class/unique.ptr.asgn/move_convert.pass.cpp b/test/std/utilities/smartptr/unique.ptr/unique.ptr.class/unique.ptr.asgn/move_convert.pass.cpp new file mode 100644 index 000000000..8d83c3c88 --- /dev/null +++ b/test/std/utilities/smartptr/unique.ptr/unique.ptr.class/unique.ptr.asgn/move_convert.pass.cpp @@ -0,0 +1,420 @@ +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// UNSUPPORTED: c++98, c++03 + +// + +// unique_ptr + +// Test unique_ptr converting move ctor + +#include +#include + +#include "test_macros.h" +#include "unique_ptr_test_helper.h" +#include "type_id.h" + +template +struct GenericDeleter { + void operator()(void*) const {} +}; + +template +struct GenericConvertingDeleter { + + template + GenericConvertingDeleter(GenericConvertingDeleter) {} + + template + GenericConvertingDeleter& operator=(GenericConvertingDeleter const&) { + return *this; + } + + void operator()(void*) const {} +}; + +template +using EnableIfNotSame = typename std::enable_if< + !std::is_same::type, typename std::decay::type>::value +>::type; + +template +struct is_specialization; + +template