From 0dc0969cd0a732760f0aa79942a04e0eaef297c4 Mon Sep 17 00:00:00 2001 From: Dimitry Andric Date: Sun, 16 Apr 2017 16:03:23 +0000 Subject: Vendor import of libc++ trunk r300422: https://llvm.org/svn/llvm-project/libcxx/trunk@300422 --- .../alg.random.shuffle/random_shuffle.pass.cpp | 1 + .../random_shuffle_rand.pass.cpp | 1 + .../alg.remove/remove_copy_if.pass.cpp | 6 +- .../alg.replace/replace_copy_if.pass.cpp | 6 +- .../alg.replace/replace_if.pass.cpp | 4 +- .../alg.transform/unary_transform.pass.cpp | 6 +- .../alg.nonmodifying/alg.count/count_if.pass.cpp | 13 +- .../alg.nonmodifying/alg.find/find_if.pass.cpp | 10 +- .../alg.nonmodifying/alg.find/find_if_not.pass.cpp | 11 +- .../make.heap/make_heap.pass.cpp | 5 +- .../make.heap/make_heap_comp.pass.cpp | 8 +- .../alg.heap.operations/pop.heap/pop_heap.pass.cpp | 5 +- .../pop.heap/pop_heap_comp.pass.cpp | 8 +- .../push.heap/push_heap.pass.cpp | 5 +- .../push.heap/push_heap_comp.pass.cpp | 7 +- .../sort.heap/sort_heap.pass.cpp | 5 +- .../sort.heap/sort_heap_comp.pass.cpp | 7 +- .../alg.sorting/alg.merge/inplace_merge.pass.cpp | 5 +- .../alg.merge/inplace_merge_comp.pass.cpp | 7 +- .../alg.sorting/alg.merge/merge.pass.cpp | 5 +- .../alg.sorting/alg.merge/merge_comp.pass.cpp | 5 +- .../alg.sorting/alg.min.max/max_element.pass.cpp | 5 +- .../alg.min.max/max_element_comp.pass.cpp | 5 +- .../alg.sorting/alg.min.max/min_element.pass.cpp | 5 +- .../alg.min.max/min_element_comp.pass.cpp | 5 +- .../alg.min.max/minmax_element.pass.cpp | 7 +- .../alg.min.max/minmax_element_comp.pass.cpp | 7 +- .../alg.nth.element/nth_element.pass.cpp | 5 +- .../alg.nth.element/nth_element_comp.pass.cpp | 5 +- .../partial.sort.copy/partial_sort_copy.pass.cpp | 5 +- .../partial_sort_copy_comp.pass.cpp | 5 +- .../alg.sort/partial.sort/partial_sort.pass.cpp | 5 +- .../partial.sort/partial_sort_comp.pass.cpp | 5 +- .../alg.sorting/alg.sort/sort/sort.pass.cpp | 5 +- .../alg.sort/stable.sort/stable_sort.pass.cpp | 5 +- .../alg.sort/stable.sort/stable_sort_comp.pass.cpp | 5 +- .../map/PR28469_undefined_behavior_segfault.sh.cpp | 2 +- .../containers/associative/map/compare.pass.cpp | 4 +- .../associative/map/incomplete_type.pass.cpp | 2 +- .../map/map.access/index_tuple.pass.cpp | 2 +- .../map/map.cons/default_noexcept.pass.cpp | 6 +- .../map/map.cons/dtor_noexcept.pass.cpp | 4 +- .../map/map.cons/iter_iter_comp_alloc.pass.cpp | 2 - .../map/map.cons/move_assign_noexcept.pass.cpp | 4 +- .../map/map.cons/move_noexcept.pass.cpp | 8 +- .../map/map.special/swap_noexcept.pass.cpp | 11 +- .../associative/multimap/incomplete_type.pass.cpp | 2 +- .../multimap.cons/default_noexcept.pass.cpp | 6 +- .../multimap/multimap.cons/dtor_noexcept.pass.cpp | 4 +- .../multimap.cons/move_assign_noexcept.pass.cpp | 4 +- .../multimap/multimap.cons/move_noexcept.pass.cpp | 8 +- .../multimap/multimap.ops/equal_range.pass.cpp | 1 - .../multimap/multimap.ops/find.pass.cpp | 1 - .../multimap/multimap.ops/lower_bound.pass.cpp | 1 - .../multimap/multimap.ops/upper_bound.pass.cpp | 1 - .../multimap.special/swap_noexcept.pass.cpp | 11 +- .../associative/multiset/incomplete_type.pass.cpp | 2 +- .../multiset.cons/default_noexcept.pass.cpp | 6 +- .../multiset/multiset.cons/dtor_noexcept.pass.cpp | 4 +- .../multiset.cons/move_assign_noexcept.pass.cpp | 4 +- .../multiset/multiset.cons/move_noexcept.pass.cpp | 8 +- .../multiset.special/swap_noexcept.pass.cpp | 11 +- .../associative/set/incomplete_type.pass.cpp | 2 +- .../set/set.cons/default_noexcept.pass.cpp | 6 +- .../set/set.cons/dtor_noexcept.pass.cpp | 4 +- .../set/set.cons/move_assign_noexcept.pass.cpp | 4 +- .../set/set.cons/move_noexcept.pass.cpp | 8 +- .../set/set.special/swap_noexcept.pass.cpp | 11 +- .../priqueue.cons/default_noexcept.pass.cpp | 4 +- .../queue/queue.cons/default_noexcept.pass.cpp | 4 +- .../queue/queue.cons/move_noexcept.pass.cpp | 4 +- .../stack/stack.cons/default_noexcept.pass.cpp | 4 +- .../stack/stack.cons/move_noexcept.pass.cpp | 4 +- .../sequences/array/array.size/size.pass.cpp | 4 +- test/std/containers/sequences/array/at.pass.cpp | 2 +- .../containers/sequences/array/front_back.pass.cpp | 4 +- .../containers/sequences/array/indexing.pass.cpp | 2 +- .../deque.cons/assign_initializer_list.pass.cpp | 6 +- .../deque/deque.cons/default_noexcept.pass.cpp | 6 +- .../deque/deque.cons/dtor_noexcept.pass.cpp | 4 +- .../deque/deque.cons/initializer_list.pass.cpp | 6 +- .../deque.cons/initializer_list_alloc.pass.cpp | 6 +- .../sequences/deque/deque.cons/move.pass.cpp | 6 +- .../sequences/deque/deque.cons/move_alloc.pass.cpp | 6 +- .../deque/deque.cons/move_assign.pass.cpp | 6 +- .../deque/deque.cons/move_assign_noexcept.pass.cpp | 6 +- .../deque/deque.cons/move_noexcept.pass.cpp | 8 +- .../deque.cons/op_equal_initializer_list.pass.cpp | 6 +- .../sequences/deque/deque.cons/size.pass.cpp | 1 - .../insert_iter_initializer_list.pass.cpp | 4 +- .../deque.modifiers/push_back_rvalue.pass.cpp | 8 +- .../deque.modifiers/push_front_rvalue.pass.cpp | 8 +- .../deque/deque.special/swap_noexcept.pass.cpp | 6 +- .../forwardlist.cons/assign_init.pass.cpp | 6 +- .../forwardlist.cons/assign_move.pass.cpp | 6 +- .../forwardlist.cons/assign_op_init.pass.cpp | 6 +- .../forwardlist.cons/default_noexcept.pass.cpp | 6 +- .../forwardlist.cons/dtor_noexcept.pass.cpp | 4 +- .../forwardlist/forwardlist.cons/init.pass.cpp | 6 +- .../forwardlist.cons/init_alloc.pass.cpp | 6 +- .../forwardlist/forwardlist.cons/move.pass.cpp | 6 +- .../forwardlist.cons/move_alloc.pass.cpp | 12 +- .../forwardlist.cons/move_assign_noexcept.pass.cpp | 6 +- .../forwardlist.cons/move_noexcept.pass.cpp | 8 +- .../forwardlist/forwardlist.cons/size.fail.cpp | 35 -- .../forwardlist/forwardlist.cons/size.pass.cpp | 5 + .../forwardlist.modifiers/emplace_after.pass.cpp | 6 +- .../insert_after_init.pass.cpp | 6 +- .../forwardlist.modifiers/insert_after_rv.pass.cpp | 6 +- .../forwardlist.modifiers/pop_front.pass.cpp | 6 +- .../forwardlist.modifiers/push_front_rv.pass.cpp | 6 +- .../forwardlist/forwardlist.ops/sort.pass.cpp | 5 +- .../forwardlist/forwardlist.ops/sort_pred.pass.cpp | 5 +- .../forwardlist.spec/swap_noexcept.pass.cpp | 6 +- .../sequences/list/incomplete_type.pass.cpp | 2 +- .../list.cons/assign_initializer_list.pass.cpp | 6 +- .../sequences/list/list.cons/assign_move.pass.cpp | 6 +- .../list/list.cons/default_noexcept.pass.cpp | 6 +- .../list/list.cons/dtor_noexcept.pass.cpp | 4 +- .../list/list.cons/initializer_list.pass.cpp | 6 +- .../list/list.cons/initializer_list_alloc.pass.cpp | 6 +- .../sequences/list/list.cons/move_alloc.pass.cpp | 6 +- .../list/list.cons/move_assign_noexcept.pass.cpp | 6 +- .../list/list.cons/move_noexcept.pass.cpp | 8 +- .../list.cons/op_equal_initializer_list.pass.cpp | 6 +- .../sequences/list/list.cons/size_type.pass.cpp | 1 - .../insert_iter_initializer_list.pass.cpp | 6 +- .../list/list.modifiers/push_back_rvalue.pass.cpp | 6 +- .../list/list.modifiers/push_front_rvalue.pass.cpp | 6 +- .../list/list.special/swap_noexcept.pass.cpp | 6 +- .../vector.bool/assign_initializer_list.pass.cpp | 6 +- .../sequences/vector.bool/assign_move.pass.cpp | 6 +- .../vector.bool/default_noexcept.pass.cpp | 6 +- .../sequences/vector.bool/dtor_noexcept.pass.cpp | 4 +- .../sequences/vector.bool/emplace.pass.cpp | 4 +- .../sequences/vector.bool/enabled_hash.pass.cpp | 28 ++ .../containers/sequences/vector.bool/find.pass.cpp | 2 +- .../vector.bool/initializer_list.pass.cpp | 6 +- .../vector.bool/initializer_list_alloc.pass.cpp | 6 +- .../insert_iter_initializer_list.pass.cpp | 6 +- .../containers/sequences/vector.bool/move.pass.cpp | 6 +- .../sequences/vector.bool/move_alloc.pass.cpp | 6 +- .../vector.bool/move_assign_noexcept.pass.cpp | 19 +- .../sequences/vector.bool/move_noexcept.pass.cpp | 15 +- .../vector.bool/op_equal_initializer_list.pass.cpp | 6 +- .../sequences/vector.bool/swap_noexcept.pass.cpp | 19 +- .../sequences/vector.bool/vector_bool.pass.cpp | 4 +- .../vector/vector.capacity/resize_size.pass.cpp | 15 +- .../vector.cons/assign_initializer_list.pass.cpp | 7 +- .../vector/vector.cons/assign_move.pass.cpp | 6 +- .../vector/vector.cons/dtor_noexcept.pass.cpp | 4 +- .../vector/vector.cons/initializer_list.pass.cpp | 6 +- .../vector.cons/initializer_list_alloc.pass.cpp | 6 +- .../sequences/vector/vector.cons/move.pass.cpp | 6 +- .../vector/vector.cons/move_alloc.pass.cpp | 6 +- .../vector.cons/op_equal_initializer_list.pass.cpp | 6 +- .../vector/vector.modifiers/clear.pass.cpp | 40 ++ .../vector/vector.modifiers/emplace_extra.pass.cpp | 6 +- .../insert_iter_initializer_list.pass.cpp | 6 +- .../vector.modifiers/push_back_rvalue.pass.cpp | 6 +- .../vector/vector.special/swap_noexcept.pass.cpp | 4 +- .../containers/unord/unord.map/compare.pass.cpp | 4 +- .../unord/unord.map/incomplete_type.pass.cpp | 2 +- .../unord.map.cnstr/default_noexcept.pass.cpp | 8 +- .../unord.map.cnstr/dtor_noexcept.pass.cpp | 8 +- .../unord.map.cnstr/move_assign_noexcept.pass.cpp | 6 +- .../unord.map.cnstr/move_noexcept.pass.cpp | 10 +- .../unord.map/unord.map.elem/index_tuple.pass.cpp | 2 +- .../unord.map.swap/swap_noexcept.pass.cpp | 13 +- .../unord/unord.multimap/bucket_count.pass.cpp | 3 - .../unord/unord.multimap/incomplete.pass.cpp | 2 +- .../unord/unord.multimap/load_factor.pass.cpp | 2 - .../unord/unord.multimap/max_bucket_count.pass.cpp | 4 - .../unord/unord.multimap/max_load_factor.pass.cpp | 4 - .../unord/unord.multimap/swap_member.pass.cpp | 3 - .../unord.multimap.cnstr/default_noexcept.pass.cpp | 7 +- .../unord.multimap.cnstr/dtor_noexcept.pass.cpp | 7 +- .../move_assign_noexcept.pass.cpp | 5 +- .../unord.multimap.cnstr/move_noexcept.pass.cpp | 9 +- .../unord.multimap.swap/swap_noexcept.pass.cpp | 12 +- .../unord.multimap.swap/swap_non_member.pass.cpp | 3 - .../unord/unord.multiset/bucket_count.pass.cpp | 6 - .../unord/unord.multiset/incomplete.pass.cpp | 2 +- .../unord/unord.multiset/load_factor.pass.cpp | 2 - .../unord/unord.multiset/max_load_factor.pass.cpp | 4 - .../unord/unord.multiset/swap_member.pass.cpp | 3 - .../unord.multiset.cnstr/default_noexcept.pass.cpp | 7 +- .../unord.multiset.cnstr/dtor_noexcept.pass.cpp | 7 +- .../move_assign_noexcept.pass.cpp | 5 +- .../unord.multiset.cnstr/move_noexcept.pass.cpp | 9 +- .../unord.multiset.swap/swap_noexcept.pass.cpp | 11 +- .../unord.multiset.swap/swap_non_member.pass.cpp | 3 - .../unord/unord.set/bucket_count.pass.cpp | 6 - .../containers/unord/unord.set/incomplete.pass.cpp | 2 +- .../unord/unord.set/load_factor.pass.cpp | 2 - .../unord/unord.set/max_load_factor.pass.cpp | 4 - .../unord/unord.set/swap_member.pass.cpp | 3 - .../unord.set.cnstr/default_noexcept.pass.cpp | 7 +- .../unord.set.cnstr/dtor_noexcept.pass.cpp | 7 +- .../unord.set.cnstr/move_assign_noexcept.pass.cpp | 5 +- .../unord.set.cnstr/move_noexcept.pass.cpp | 9 +- .../unord.set.swap/swap_noexcept.pass.cpp | 11 +- .../unord.set.swap/swap_non_member.pass.cpp | 3 - .../auto.ptr/auto.ptr.cons/assignment.pass.cpp | 2 + .../auto.ptr/auto.ptr.cons/convert.pass.cpp | 2 + .../auto.ptr.cons/convert_assignment.pass.cpp | 2 + .../auto.ptr/auto.ptr.cons/copy.pass.cpp | 2 + .../auto.ptr/auto.ptr.cons/pointer.pass.cpp | 2 + .../assign_from_auto_ptr_ref.pass.cpp | 2 + .../convert_from_auto_ptr_ref.pass.cpp | 2 + .../auto.ptr.conv/convert_to_auto_ptr.pass.cpp | 2 + .../auto.ptr.conv/convert_to_auto_ptr_ref.pass.cpp | 2 + .../auto.ptr/auto.ptr.members/arrow.pass.cpp | 2 + .../auto.ptr/auto.ptr.members/deref.pass.cpp | 2 + .../auto.ptr/auto.ptr.members/release.pass.cpp | 2 + .../auto.ptr/auto.ptr.members/reset.pass.cpp | 2 + .../depr.auto.ptr/auto.ptr/element_type.pass.cpp | 2 + test/std/depr/depr.c.headers/stdio_h.pass.cpp | 4 +- .../pointer_to_binary_function.cxx1z.fail.cpp | 25 ++ .../pointer_to_binary_function.pass.cpp | 1 + .../pointer_to_unary_function.cxx1z.fail.cpp | 25 ++ .../pointer_to_unary_function.pass.cpp | 1 + .../ptr_fun1.cxx1z.fail.cpp | 28 ++ .../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 | 35 ++ .../depr.member.pointer.adaptors/mem_fun.pass.cpp | 1 + .../mem_fun1.cxx1z.fail.cpp | 35 ++ .../depr.member.pointer.adaptors/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 | 33 ++ .../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 | 33 ++ .../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 + .../set.unexpected/get_unexpected.pass.cpp | 2 + .../set.unexpected/set_unexpected.pass.cpp | 2 + .../unexpected.handler/unexpected_handler.pass.cpp | 2 + .../unexpected/unexpected.pass.cpp | 2 + .../syserr.errcode.observers/bool.fail.cpp | 30 ++ .../syserr/syserr.hash/enabled_hash.pass.cpp | 27 ++ .../syserr/syserr.hash/error_code.pass.cpp | 1 + .../syserr/syserr.hash/error_condition.pass.cpp | 1 + .../algorithms/alg.random.sample/sample.pass.cpp | 14 +- .../class.file_status/file_status.cons.pass.cpp | 4 +- .../class.path/path.member/path.append.pass.cpp | 2 +- .../path.member/path.assign/braced_init.pass.cpp | 32 ++ .../path.member/path.assign/source.pass.cpp | 24 +- .../class.path/path.member/path.concat.pass.cpp | 2 +- .../path.decompose/path.decompose.pass.cpp | 12 +- .../filesystem/class.path/synop.pass.cpp | 2 +- .../rec.dir.itr.members/increment.pass.cpp | 4 +- .../fs.filesystem.synopsis/file_time_type.pass.cpp | 4 +- .../fs.op.funcs/fs.op.absolute/absolute.pass.cpp | 4 +- .../fs.op.funcs/fs.op.exists/exists.pass.cpp | 9 + .../fs.op.permissions/permissions.pass.cpp | 2 +- .../fs.op.funcs/fs.op.status/status.pass.cpp | 25 +- .../temp_directory_path.pass.cpp | 8 + .../construct_types.pass.cpp | 2 +- .../numeric.ops/numeric.ops.gcd/gcd.bool1.fail.cpp | 25 ++ .../numeric.ops/numeric.ops.gcd/gcd.bool2.fail.cpp | 25 ++ .../numeric.ops/numeric.ops.gcd/gcd.bool3.fail.cpp | 25 ++ .../numeric.ops/numeric.ops.gcd/gcd.bool4.fail.cpp | 25 ++ .../numeric.ops/numeric.ops.gcd/gcd.pass.cpp | 7 + .../numeric.ops/numeric.ops.lcm/lcm.bool1.fail.cpp | 25 ++ .../numeric.ops/numeric.ops.lcm/lcm.bool2.fail.cpp | 25 ++ .../numeric.ops/numeric.ops.lcm/lcm.bool3.fail.cpp | 25 ++ .../numeric.ops/numeric.ops.lcm/lcm.bool4.fail.cpp | 25 ++ .../numeric.ops/numeric.ops.lcm/lcm.pass.cpp | 8 + test/std/experimental/string.view/lit.local.cfg | 3 + .../string.view/string.view.access/at.pass.cpp | 2 +- .../tuple/tuple.apply/extended_types.pass.cpp | 2 +- .../file.streams/c.files/cstdio.pass.cpp | 2 +- .../istream.unformatted/ignore_0xff.pass.cpp | 2 +- .../ostream.inserters.arithmetic/minus1.pass.cpp | 17 +- .../output.streams/ostream.seeks/seekp.pass.cpp | 2 +- .../output.streams/ostream.seeks/seekp2.pass.cpp | 2 +- .../quoted.manip/quoted_char.fail.cpp | 2 +- .../ios.base/ios.base.storage/iword.pass.cpp | 3 + .../ios.base/ios.base.storage/pword.pass.cpp | 3 + .../back.insert.iter.op=/rv_value.pass.cpp | 8 +- .../front.insert.iter.op=/rv_value.pass.cpp | 9 +- .../insert.iter.op=/rv_value.pass.cpp | 7 +- .../istream.iterator.cons/copy.pass.cpp | 2 +- .../istream.iterator.cons/default.pass.cpp | 6 +- .../istream.iterator/types.pass.cpp | 6 +- .../new_align_val_t_nothrow.pass.cpp | 4 +- .../new.delete/new.delete.array/new_array.pass.cpp | 4 +- .../new.delete.array/new_array_nothrow.pass.cpp | 4 +- ...elete_array_calls_unsized_delete_array.pass.cpp | 4 +- .../new.delete/new.delete.single/new.pass.cpp | 4 +- .../new.delete.single/new_align_val_t.pass.cpp | 4 +- .../new_align_val_t_nothrow.pass.cpp | 4 +- .../new.delete.single/new_nothrow.pass.cpp | 4 +- .../new.delete.single/new_replace.pass.cpp | 4 +- .../new.delete.single/sized_delete11.pass.cpp | 4 +- .../new.delete.single/sized_delete14.pass.cpp | 4 +- .../sized_delete_fsizeddeallocation.sh.cpp | 2 +- .../except.nested/rethrow_if_nested.pass.cpp | 33 +- .../except.nested/throw_with_nested.pass.cpp | 10 + .../language.support/support.types/byte.pass.cpp | 30 ++ .../support.types/byteops/and.assign.pass.cpp | 42 +++ .../support.types/byteops/and.pass.cpp | 34 ++ .../support.types/byteops/lshift.assign.fail.cpp | 31 ++ .../support.types/byteops/lshift.assign.pass.cpp | 39 ++ .../support.types/byteops/lshift.fail.cpp | 26 ++ .../support.types/byteops/lshift.pass.cpp | 33 ++ .../support.types/byteops/not.pass.cpp | 30 ++ .../support.types/byteops/or.assign.pass.cpp | 43 +++ .../support.types/byteops/or.pass.cpp | 34 ++ .../support.types/byteops/rshift.assign.fail.cpp | 31 ++ .../support.types/byteops/rshift.assign.pass.cpp | 38 ++ .../support.types/byteops/rshift.fail.cpp | 26 ++ .../support.types/byteops/rshift.pass.cpp | 40 ++ .../support.types/byteops/to_integer.fail.cpp | 26 ++ .../support.types/byteops/to_integer.pass.cpp | 34 ++ .../support.types/byteops/xor.assign.pass.cpp | 42 +++ .../support.types/byteops/xor.pass.cpp | 34 ++ .../category.ctype/ctype_base.pass.cpp | 4 +- .../locale.ctype.byname/tolower_1.pass.cpp | 4 +- .../locale.ctype.byname/tolower_many.pass.cpp | 4 +- .../locale.ctype.byname/toupper_1.pass.cpp | 4 +- .../locale.ctype.byname/toupper_many.pass.cpp | 4 +- .../negative_sign.pass.cpp | 2 +- .../locale.moneypunct/types.pass.cpp | 4 +- .../facet.num.put.members/put_pointer.pass.cpp | 8 +- .../facet.num.get.members/get_double.pass.cpp | 4 +- .../locale.time.get.byname/get_date.pass.cpp | 2 +- .../locale.time.get.byname/get_date_wide.pass.cpp | 2 +- .../locale.stdcvt/codecvt_utf16_in.pass.cpp | 40 +- .../locale.stdcvt/codecvt_utf8_in.pass.cpp | 18 +- .../locale.types/locale.category/category.pass.cpp | 4 +- .../complex.transcendentals/atan.pass.cpp | 1 - .../complex.transcendentals/tan.pass.cpp | 1 - .../valarray.assign/move_assign.pass.cpp | 4 +- .../template.valarray/valarray.cons/move.pass.cpp | 4 +- .../adjacent_difference.pass.cpp | 5 +- .../adjacent_difference_op.pass.cpp | 5 +- .../numeric.ops/numeric.ops.gcd/gcd.pass.cpp | 8 + .../numeric.ops/numeric.ops.lcm/lcm.pass.cpp | 8 + .../rand.dist.norm.cauchy/eval.pass.cpp | 3 - .../rand.dist.norm.chisq/eval.pass.cpp | 3 - .../rand.dist.norm/rand.dist.norm.f/eval.pass.cpp | 3 - .../rand.dist.norm.normal/eval.pass.cpp | 1 - .../rand.dist.pois.exp/eval.pass.cpp | 3 - .../rand.dist.pois.weibull/eval.pass.cpp | 3 - test/std/re/re.alg/re.alg.match/awk.pass.cpp | 97 ++--- .../re.alg.match/parse_curly_brackets.pass.cpp | 2 +- test/std/re/re.alg/re.alg.search/backup.pass.cpp | 2 +- .../std/re/re.alg/re.alg.search/lookahead.pass.cpp | 2 +- .../re.regex.construct/bad_backref.pass.cpp | 2 +- test/std/re/re.traits/lookup_classname.pass.cpp | 2 +- test/std/re/re.traits/translate_nocase.pass.cpp | 4 +- .../basic.string.hash/enabled_hashes.pass.cpp | 31 ++ .../std/strings/basic.string.hash/strings.pass.cpp | 4 + .../basic.string/string.cons/copy_alloc.pass.cpp | 81 ++++ .../string.cons/dtor_noexcept.pass.cpp | 4 +- .../string.cons/implicit_deduction_guides.pass.cpp | 300 +++++++++++++++ .../basic.string/string.cons/iter_alloc.pass.cpp | 2 - .../string.cons/pointer_alloc.pass.cpp | 2 - .../string.cons/pointer_size_alloc.pass.cpp | 2 - .../string.cons/size_char_alloc.pass.cpp | 6 - .../basic.string/string.cons/substr.pass.cpp | 1 - .../string_append/iterator.pass.cpp | 16 + .../string_insert/iter_iter_iter.pass.cpp | 33 +- .../string_replace/size_size_T_size_size.pass.cpp | 19 +- .../string.special/swap_noexcept.pass.cpp | 4 +- .../strings/basic.string/traits_mismatch.fail.cpp | 18 + test/std/strings/string.classes/typedefs.pass.cpp | 9 +- test/std/strings/string.conversions/stof.pass.cpp | 4 +- test/std/strings/string.conversions/stol.pass.cpp | 4 +- test/std/strings/string.conversions/stoll.pass.cpp | 4 +- test/std/strings/string.conversions/stoul.pass.cpp | 4 +- .../std/strings/string.conversions/stoull.pass.cpp | 4 +- .../std/strings/string.view/nothing_to_do.pass.cpp | 12 - .../string.view/string.view.access/at.pass.cpp | 2 +- .../string.view/string.view.cons/assign.pass.cpp | 50 +++ .../implicit_deduction_guides.pass.cpp | 65 ++++ .../string.view.hash/enabled_hashes.pass.cpp | 31 ++ .../string.view.hash/string_view.pass.cpp | 30 +- .../string.view.iterators/rbegin.pass.cpp | 19 + .../string.view.iterators/rend.pass.cpp | 19 + .../string_view.literals/literal.pass.cpp | 2 +- .../strings/string.view/traits_mismatch.fail.cpp | 18 + .../futures/futures.future_error/what.pass.cpp | 4 +- .../futures/futures.promise/set_rvalue.pass.cpp | 9 +- .../set_rvalue_at_thread_exit.pass.cpp | 8 +- .../futures.task.members/ctor_func_alloc.pass.cpp | 2 +- .../futures.unique_future/move_assign.pass.cpp | 4 +- .../futures.unique_future/move_ctor.pass.cpp | 4 +- .../futures/futures.unique_future/share.pass.cpp | 18 +- ...202_notify_from_pthread_created_thread.pass.cpp | 1 + .../wait_terminates.sh.cpp | 6 +- .../thread.lock.algorithm/lock.pass.cpp | 4 +- .../thread.lock/thread.lock.guard/mutex.pass.cpp | 10 + .../thread.lock.guard/variadic_adopt_lock.pass.cpp | 63 ---- .../thread.lock.guard/variadic_assign.fail.cpp | 45 --- .../thread.lock.guard/variadic_copy.fail.cpp | 42 --- .../thread.lock.guard/variadic_mutex.fail.cpp | 48 --- .../thread.lock.guard/variadic_mutex.pass.cpp | 116 ------ .../variadic_mutex_cxx03.pass.cpp | 21 -- .../thread.lock.guard/variadic_types.pass.cpp | 79 ---- .../thread.lock.scoped/adopt_lock.pass.cpp | 72 ++++ .../thread.lock/thread.lock.scoped/assign.fail.cpp | 50 +++ .../thread.lock/thread.lock.scoped/copy.fail.cpp | 46 +++ .../thread.lock/thread.lock.scoped/mutex.fail.cpp | 53 +++ .../thread.lock/thread.lock.scoped/mutex.pass.cpp | 155 ++++++++ .../thread.lock/thread.lock.scoped/types.pass.cpp | 78 ++++ .../thread.lock.shared.cons/mutex.pass.cpp | 8 + .../thread.lock.unique.cons/move_assign.pass.cpp | 4 +- .../thread.lock.unique.cons/move_ctor.pass.cpp | 4 +- .../thread.lock.unique.cons/mutex.pass.cpp | 10 + .../thread.thread.assign/move.pass.cpp | 4 +- .../thread.thread.constr/F.pass.cpp | 2 +- .../thread.thread.constr/move.pass.cpp | 4 +- .../thread.thread.id/enabled_hashes.pass.cpp | 27 ++ .../thread.thread.id/thread_id.pass.cpp | 5 +- .../construct_pair_const_lvalue_pair.pass.cpp | 1 - .../construct_pair_piecewise.pass.cpp | 1 - .../construct_pair_rvalue.pass.cpp | 1 - .../construct_pair_values.pass.cpp | 1 - .../construct_type.pass.cpp | 6 - .../any/any.class/any.modifiers/emplace.pass.cpp | 36 +- .../any.cast/reference_types.fail.cpp | 33 +- .../PR23141_invoke_not_constexpr.pass.cpp | 2 +- .../bind/func.bind/func.bind.bind/copy.pass.cpp | 2 +- .../func.bind.bind/invoke_function_object.pass.cpp | 2 +- .../bind/func.bind/func.bind.bind/nested.pass.cpp | 2 +- .../function.objects/func.not_fn/not_fn.pass.cpp | 9 +- .../func.wrap/func.wrap.func/derive_from.pass.cpp | 4 +- .../func.wrap.func.con/F_nullptr.pass.cpp | 4 +- .../func.wrap.func.con/alloc.pass.cpp | 2 +- .../func.wrap.func.con/alloc_F.pass.cpp | 2 +- .../func.wrap.func.con/alloc_function.pass.cpp | 2 +- .../func.wrap.func.con/alloc_nullptr.pass.cpp | 2 +- .../func.wrap.func.con/alloc_rfunction.pass.cpp | 2 +- .../unord.hash/enabled_hashes.pass.cpp | 23 ++ .../function.objects/unord.hash/enum.pass.cpp | 4 +- .../function.objects/unord.hash/floating.pass.cpp | 3 + .../function.objects/unord.hash/integral.pass.cpp | 54 +-- .../function.objects/unord.hash/pointer.pass.cpp | 16 + .../uninitialized_default_construct.pass.cpp | 2 +- .../uninitialized_default_construct_n.pass.cpp | 2 +- .../uninitialized_value_construct.pass.cpp | 2 +- .../uninitialized_value_construct_n.pass.cpp | 2 +- .../uninitialized.move/uninitialized_move.pass.cpp | 2 +- .../uninitialized_move_n.pass.cpp | 2 +- test/std/utilities/memory/unique.ptr/deleter.h | 338 ----------------- .../memory/unique.ptr/nothing_to_do.pass.cpp | 12 - .../unique.ptr.create/make_unique.array.pass.cpp | 44 --- .../unique.ptr.create/make_unique.array1.fail.cpp | 17 - .../unique.ptr.create/make_unique.array2.fail.cpp | 17 - .../unique.ptr.create/make_unique.array3.fail.cpp | 17 - .../unique.ptr.create/make_unique.array4.fail.cpp | 17 - .../unique.ptr.create/make_unique.single.pass.cpp | 32 -- .../unique.ptr.dltr/nothing_to_do.pass.cpp | 12 - .../unique.ptr.dltr.dflt/convert_ctor.pass.cpp | 48 --- .../unique.ptr.dltr.dflt/default.pass.cpp | 34 -- .../unique.ptr.dltr.dflt/incomplete.fail.cpp | 26 -- .../unique.ptr.dltr.dflt/void.fail.cpp | 24 -- .../unique.ptr.dltr.dflt1/convert_ctor.fail.cpp | 32 -- .../unique.ptr.dltr.dflt1/convert_ctor.pass.cpp | 28 -- .../unique.ptr.dltr.dflt1/default.pass.cpp | 36 -- .../unique.ptr.dltr.dflt1/incomplete.fail.cpp | 26 -- .../unique.ptr.dltr.general/nothing_to_do.pass.cpp | 12 - .../unique.ptr/unique.ptr.runtime/move01.fail.cpp | 28 -- .../unique.ptr/unique.ptr.runtime/move01.pass.cpp | 79 ---- .../unique.ptr/unique.ptr.runtime/move02.fail.cpp | 39 -- .../unique.ptr/unique.ptr.runtime/move03.fail.cpp | 57 --- .../unique.ptr/unique.ptr.runtime/move04.fail.cpp | 57 --- .../unique.ptr.runtime/move_convert01.fail.cpp | 57 --- .../unique.ptr.runtime/move_convert02.fail.cpp | 61 --- .../unique.ptr.runtime/move_convert03.fail.cpp | 62 --- .../unique.ptr.runtime/move_convert04.fail.cpp | 57 --- .../unique.ptr.runtime/move_convert05.fail.cpp | 61 --- .../unique.ptr.runtime/move_convert06.fail.cpp | 62 --- .../unique.ptr.runtime/move_convert07.fail.cpp | 56 --- .../unique.ptr.runtime/move_convert08.fail.cpp | 60 --- .../unique.ptr.runtime/move_convert09.fail.cpp | 62 --- .../unique.ptr.runtime/null_asgn.pass.cpp | 41 -- .../unique.ptr.runtime/null_ctor.pass.cpp | 55 --- .../unique.ptr.runtime/nullptr_asgn.pass.cpp | 41 -- .../unique.ptr.runtime/pointer_type.pass.cpp | 34 -- .../unique.ptr.runtime.ctor/default01.fail.cpp | 38 -- .../unique.ptr.runtime.ctor/default01.pass.cpp | 47 --- .../unique.ptr.runtime.ctor/default02.fail.cpp | 30 -- .../unique.ptr.runtime.ctor/default02.pass.cpp | 87 ----- .../unique.ptr.runtime.ctor/default03.fail.cpp | 23 -- .../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 --- .../unique.ptr.runtime.ctor/pointer01.fail.cpp | 36 -- .../unique.ptr.runtime.ctor/pointer01.pass.cpp | 63 ---- .../unique.ptr.runtime.ctor/pointer02.fail.cpp | 29 -- .../unique.ptr.runtime.ctor/pointer02.pass.cpp | 95 ----- .../unique.ptr.runtime.ctor/pointer03.fail.cpp | 23 -- .../unique.ptr.runtime.ctor/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 --- .../unique.ptr.runtime.modifiers/release.pass.cpp | 27 -- .../unique.ptr.runtime.modifiers/reset1.pass.cpp | 50 --- .../unique.ptr.runtime.modifiers/reset2.fail.cpp | 64 ---- .../unique.ptr.runtime.modifiers/swap.pass.cpp | 56 --- .../dereference.fail.cpp | 23 -- .../explicit_bool.pass.cpp | 39 -- .../unique.ptr.runtime.observers/get.pass.cpp | 24 -- .../get_deleter.pass.cpp | 37 -- .../unique.ptr.runtime.observers/index.pass.cpp | 47 --- .../unique.ptr.runtime.observers/op_arrow.fail.cpp | 30 -- .../unique.ptr.single/pointer_type.pass.cpp | 55 --- .../unique.ptr.single.asgn/move01.fail.cpp | 29 -- .../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 -- .../unique.ptr.single.asgn/move_convert.pass.cpp | 89 ----- .../unique.ptr.single.asgn/move_convert01.fail.cpp | 42 --- .../unique.ptr.single.asgn/move_convert02.fail.cpp | 43 --- .../unique.ptr.single.asgn/move_convert03.fail.cpp | 47 --- .../unique.ptr.single.asgn/move_convert04.fail.cpp | 43 --- .../unique.ptr.single.asgn/move_convert05.fail.cpp | 61 --- .../unique.ptr.single.asgn/move_convert06.fail.cpp | 62 --- .../unique.ptr.single.asgn/move_convert13.fail.cpp | 36 -- .../unique.ptr.single.asgn/null.pass.cpp | 41 -- .../unique.ptr.single.asgn/nullptr.pass.cpp | 41 -- .../unique.ptr.single.ctor/auto_pointer.pass.cpp | 80 ---- .../unique.ptr.single.ctor/auto_pointer01.fail.cpp | 67 ---- .../unique.ptr.single.ctor/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 --- .../unique.ptr.single.ctor/move_convert.pass.cpp | 171 --------- .../unique.ptr.single.ctor/move_convert01.fail.cpp | 56 --- .../unique.ptr.single.ctor/move_convert02.fail.cpp | 62 --- .../unique.ptr.single.ctor/move_convert03.fail.cpp | 79 ---- .../unique.ptr.single.ctor/move_convert04.fail.cpp | 58 --- .../unique.ptr.single.ctor/move_convert05.fail.cpp | 51 --- .../unique.ptr.single.ctor/move_convert06.fail.cpp | 79 ---- .../unique.ptr.single.ctor/move_convert07.fail.cpp | 58 --- .../unique.ptr.single.ctor/move_convert08.fail.cpp | 86 ----- .../unique.ptr.single.ctor/move_convert09.fail.cpp | 79 ---- .../unique.ptr.single.ctor/move_convert10.fail.cpp | 58 --- .../unique.ptr.single.ctor/move_convert11.fail.cpp | 86 ----- .../unique.ptr.single.ctor/move_convert12.fail.cpp | 79 ---- .../unique.ptr.single.ctor/move_convert13.fail.cpp | 35 -- .../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 ------ .../pointer_deleter04.fail.cpp | 30 -- .../unique.ptr.single.dtor/null.pass.cpp | 44 --- .../unique.ptr.single.modifiers/release.pass.cpp | 27 -- .../unique.ptr.single.modifiers/reset1.pass.cpp | 50 --- .../unique.ptr.single.modifiers/reset2.pass.cpp | 66 ---- .../reset_self.pass.cpp | 29 -- .../unique.ptr.single.modifiers/swap.pass.cpp | 59 --- .../dereference.pass.cpp | 23 -- .../explicit_bool.pass.cpp | 39 -- .../unique.ptr.single.observers/get.pass.cpp | 24 -- .../get_deleter.pass.cpp | 37 -- .../unique.ptr.single.observers/index.fail.cpp | 47 --- .../unique.ptr.single.observers/op_arrow.pass.cpp | 30 -- .../unique.ptr.special/cmp_nullptr.pass.cpp | 69 ---- .../unique.ptr/unique.ptr.special/eq.pass.cpp | 86 ----- .../unique.ptr/unique.ptr.special/rel.pass.cpp | 100 ----- .../unique.ptr/unique.ptr.special/swap.pass.cpp | 102 ----- .../enable_shared_from_this.pass.cpp | 8 +- .../util.smartptr.hash/enabled_hash.pass.cpp | 23 ++ .../util.smartptr.hash/hash_shared_ptr.pass.cpp | 14 + .../util.smartptr.hash/hash_unique_ptr.pass.cpp | 69 ++++ .../atomic_compare_exchange_strong.pass.cpp | 4 +- ...tomic_compare_exchange_strong_explicit.pass.cpp | 4 +- .../atomic_compare_exchange_weak.pass.cpp | 4 +- .../atomic_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 +- .../util.smartptr.shared/test_deleter.h | 70 ---- .../util.smartptr.getdeleter/get_deleter.pass.cpp | 2 +- .../auto_ptr_Y.pass.cpp | 1 + .../util.smartptr.shared.const/auto_ptr.pass.cpp | 2 + .../nullptr_t_deleter.pass.cpp | 2 +- .../nullptr_t_deleter_allocator.pass.cpp | 2 +- .../nullptr_t_deleter_allocator_throw.pass.cpp | 2 +- .../nullptr_t_deleter_throw.pass.cpp | 2 +- .../pointer_deleter.pass.cpp | 2 +- .../pointer_deleter_allocator.pass.cpp | 2 +- .../pointer_deleter_allocator_throw.pass.cpp | 2 +- .../pointer_deleter_throw.pass.cpp | 2 +- .../util.smartptr.shared.const/unique_ptr.pass.cpp | 1 + .../make_shared.pass.cpp | 2 +- .../reset_pointer_deleter.pass.cpp | 2 +- .../reset_pointer_deleter_allocator.pass.cpp | 2 +- .../owner_before_shared_ptr.pass.cpp | 4 +- .../owner_before_weak_ptr.pass.cpp | 4 +- .../util.smartptr.ownerless/owner_less.pass.cpp | 32 +- .../owner_before_shared_ptr.pass.cpp | 5 +- .../owner_before_weak_ptr.pass.cpp | 5 +- .../meta.trans.other/common_type.pass.cpp | 25 ++ .../meta.trans/meta.trans.other/decay.pass.cpp | 6 + .../meta.trans.other/result_of11.pass.cpp | 2 - .../meta.trans.other/underlying_type.pass.cpp | 26 +- .../meta/meta.unary.prop.query/void_t.pass.cpp | 2 +- .../meta.unary/meta.unary.cat/is_function.pass.cpp | 42 ++- .../meta.unary.cat/is_member_pointer.pass.cpp | 6 + .../member_function_pointer.pass.cpp | 235 ++++++++---- .../meta.unary.prop/is_abstract.pass.cpp | 10 + .../meta.unary.prop/is_aggregate.pass.cpp | 79 ++++ .../meta.unary.prop/is_assignable.pass.cpp | 1 - .../meta.unary.prop/is_constructible.pass.cpp | 1 + .../meta.unary.prop/is_literal_type.pass.cpp | 2 +- .../optional/optional.comp_with_t/equal.pass.cpp | 61 +-- .../optional/optional.comp_with_t/greater.pass.cpp | 63 ++-- .../optional.comp_with_t/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/enabled_hash.pass.cpp | 26 ++ .../utilities/optional/optional.hash/hash.pass.cpp | 28 ++ .../optional/optional.nullopt/nullopt_t.fail.cpp | 27 ++ .../optional/optional.nullopt/nullopt_t.pass.cpp | 11 +- .../optional.object.assign/assign_value.pass.cpp | 1 - .../optional.object.assign/emplace.pass.cpp | 64 +++- .../optional.object.ctor/U.pass.cpp | 19 +- .../optional.object.ctor/copy.fail.cpp | 36 ++ .../optional.object.ctor/move.fail.cpp | 37 ++ .../optional/optional.relops/equal.pass.cpp | 94 +++-- .../optional.relops/greater_equal.pass.cpp | 93 +++-- .../optional/optional.relops/greater_than.pass.cpp | 91 +++-- .../optional/optional.relops/less_equal.pass.cpp | 93 +++-- .../optional/optional.relops/less_than.pass.cpp | 91 +++-- .../optional/optional.relops/not_equal.pass.cpp | 94 +++-- test/std/utilities/smartptr/unique.ptr/README.TXT | 16 + .../smartptr/unique.ptr/nothing_to_do.pass.cpp | 12 + .../unique.ptr.class/pointer_type.pass.cpp | 61 +++ .../unique.ptr.class/unique.ptr.asgn/move.pass.cpp | 120 ++++++ .../unique.ptr.asgn/move_convert.pass.cpp | 420 +++++++++++++++++++++ .../unique.ptr.asgn/move_convert.runtime.pass.cpp | 124 ++++++ .../unique.ptr.asgn/move_convert.single.pass.cpp | 145 +++++++ .../unique.ptr.class/unique.ptr.asgn/null.pass.cpp | 39 ++ .../unique.ptr.asgn/nullptr.pass.cpp | 40 ++ .../unique.ptr.ctor/auto_pointer.pass.cpp | 97 +++++ .../unique.ptr.ctor/default.pass.cpp | 107 ++++++ .../unique.ptr.class/unique.ptr.ctor/move.pass.cpp | 174 +++++++++ .../unique.ptr.ctor/move_convert.pass.cpp | 124 ++++++ .../unique.ptr.ctor/move_convert.runtime.pass.cpp | 83 ++++ .../unique.ptr.ctor/move_convert.single.pass.cpp | 248 ++++++++++++ .../unique.ptr.class/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 | 29 ++ .../unique.ptr.ctor/pointer_deleter.pass.cpp | 328 ++++++++++++++++ .../unique.ptr.class/unique.ptr.dtor/null.pass.cpp | 48 +++ .../unique.ptr.modifiers/release.pass.cpp | 56 +++ .../unique.ptr.modifiers/reset.pass.cpp | 117 ++++++ .../unique.ptr.modifiers/reset.runtime.fail.cpp | 30 ++ .../unique.ptr.modifiers/reset.single.pass.cpp | 46 +++ .../unique.ptr.modifiers/reset_self.pass.cpp | 25 ++ .../unique.ptr.modifiers/swap.pass.cpp | 88 +++++ .../dereference.runtime.fail.cpp | 24 ++ .../dereference.single.pass.cpp | 22 ++ .../unique.ptr.observers/explicit_bool.pass.cpp | 66 ++++ .../unique.ptr.observers/get.pass.cpp | 51 +++ .../unique.ptr.observers/get_deleter.pass.cpp | 65 ++++ .../unique.ptr.observers/op_arrow.runtime.fail.cpp | 32 ++ .../unique.ptr.observers/op_arrow.single.pass.cpp | 28 ++ .../op_subscript.runtime.pass.cpp | 48 +++ .../op_subscript.single.fail.cpp | 24 ++ .../unique.ptr.create/make_unique.array.pass.cpp | 44 +++ .../unique.ptr.create/make_unique.array1.fail.cpp | 17 + .../unique.ptr.create/make_unique.array2.fail.cpp | 17 + .../unique.ptr.create/make_unique.array3.fail.cpp | 17 + .../unique.ptr.create/make_unique.array4.fail.cpp | 17 + .../unique.ptr.create/make_unique.single.pass.cpp | 32 ++ .../unique.ptr.dltr/nothing_to_do.pass.cpp | 12 + .../unique.ptr.dltr.dflt/convert_ctor.pass.cpp | 48 +++ .../unique.ptr.dltr.dflt/default.pass.cpp | 34 ++ .../unique.ptr.dltr.dflt/incomplete.fail.cpp | 26 ++ .../unique.ptr.dltr.dflt/void.fail.cpp | 24 ++ .../unique.ptr.dltr.dflt1/convert_ctor.fail.cpp | 32 ++ .../unique.ptr.dltr.dflt1/convert_ctor.pass.cpp | 28 ++ .../unique.ptr.dltr.dflt1/default.pass.cpp | 36 ++ .../unique.ptr.dltr.dflt1/incomplete.fail.cpp | 26 ++ .../unique.ptr.dltr.general/nothing_to_do.pass.cpp | 12 + .../unique.ptr.special/cmp_nullptr.pass.cpp | 69 ++++ .../unique.ptr/unique.ptr.special/eq.pass.cpp | 86 +++++ .../unique.ptr/unique.ptr.special/rel.pass.cpp | 100 +++++ .../unique.ptr/unique.ptr.special/swap.pass.cpp | 102 +++++ .../template.bitset/bitset.hash/bitset.pass.cpp | 2 + .../bitset.hash/enabled_hash.pass.cpp | 29 ++ .../template.bitset/bitset.members/all.pass.cpp | 4 +- .../template.bitset/bitset.members/any.pass.cpp | 4 +- .../template.bitset/bitset.members/index.pass.cpp | 4 +- .../bitset.members/index_const.pass.cpp | 4 +- .../template.bitset/bitset.members/none.pass.cpp | 4 +- .../bitset.members/op_eq_eq.pass.cpp | 4 +- .../bitset.members/to_ullong.pass.cpp | 6 +- .../bitset.members/to_ulong.pass.cpp | 6 +- .../time.clock.hires/consistency.pass.cpp | 4 +- .../time.clock.steady/consistency.pass.cpp | 4 +- .../time.clock.system/consistency.pass.cpp | 4 +- .../time.duration.arithmetic/op_+.pass.cpp | 17 +- .../time.duration.arithmetic/op_-.pass.cpp | 18 +- .../utilities/tuple/tuple.general/ignore.pass.cpp | 56 +++ .../tuple.apply/make_from_tuple.pass.cpp | 2 +- .../PR22806_constrain_tuple_like_ctor.pass.cpp | 6 +- .../tuple/tuple.tuple/tuple.cnstr/alloc.pass.cpp | 4 +- .../tuple/tuple.tuple/tuple.cnstr/default.pass.cpp | 4 +- .../tuple/tuple.tuple/tuple.creation/tie.pass.cpp | 21 ++ .../type.index.hash/enabled_hash.pass.cpp | 23 ++ .../type.index.synopsis/hash_type_index.pass.cpp | 12 + .../pairs/pairs.pair/assign_pair_cxx03.pass.cpp | 2 +- .../pairs/pairs.pair/default-sfinae.pass.cpp | 2 +- .../utility/pairs/pairs.pair/default.pass.cpp | 4 +- .../variant/variant.get/get_index.pass.cpp | 4 +- .../variant/variant.get/get_type.pass.cpp | 4 +- .../variant/variant.hash/enabled_hash.pass.cpp | 23 ++ .../utilities/variant/variant.hash/hash.pass.cpp | 35 ++ .../variant.mod/emplace_index_args.pass.cpp | 43 ++- .../emplace_index_init_list_args.pass.cpp | 14 +- .../variant.mod/emplace_type_args.pass.cpp | 42 ++- .../emplace_type_init_list_args.pass.cpp | 14 +- .../variant.variant/variant.status/index.pass.cpp | 7 +- .../variant.status/valueless_by_exception.pass.cpp | 7 +- 788 files changed, 9806 insertions(+), 10448 deletions(-) delete mode 100644 test/std/containers/sequences/forwardlist/forwardlist.cons/size.fail.cpp create mode 100644 test/std/containers/sequences/vector.bool/enabled_hash.pass.cpp create mode 100644 test/std/containers/sequences/vector/vector.modifiers/clear.pass.cpp create mode 100644 test/std/depr/depr.function.objects/depr.adaptors/depr.function.pointer.adaptors/pointer_to_binary_function.cxx1z.fail.cpp create mode 100644 test/std/depr/depr.function.objects/depr.adaptors/depr.function.pointer.adaptors/pointer_to_unary_function.cxx1z.fail.cpp create mode 100644 test/std/depr/depr.function.objects/depr.adaptors/depr.function.pointer.adaptors/ptr_fun1.cxx1z.fail.cpp create mode 100644 test/std/depr/depr.function.objects/depr.adaptors/depr.function.pointer.adaptors/ptr_fun2.cxx1z.fail.cpp 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 create mode 100644 test/std/depr/depr.function.objects/depr.adaptors/depr.member.pointer.adaptors/mem_fun.cxx1z.fail.cpp 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 create mode 100644 test/std/depr/depr.function.objects/depr.adaptors/depr.member.pointer.adaptors/mem_fun1_t.cxx1z.fail.cpp 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 create mode 100644 test/std/depr/depr.function.objects/depr.adaptors/depr.member.pointer.adaptors/mem_fun_t.cxx1z.fail.cpp create mode 100644 test/std/diagnostics/syserr/syserr.errcode/syserr.errcode.observers/bool.fail.cpp create mode 100644 test/std/diagnostics/syserr/syserr.hash/enabled_hash.pass.cpp create mode 100644 test/std/experimental/filesystem/class.path/path.member/path.assign/braced_init.pass.cpp create mode 100644 test/std/experimental/numeric/numeric.ops/numeric.ops.gcd/gcd.bool1.fail.cpp create mode 100644 test/std/experimental/numeric/numeric.ops/numeric.ops.gcd/gcd.bool2.fail.cpp create mode 100644 test/std/experimental/numeric/numeric.ops/numeric.ops.gcd/gcd.bool3.fail.cpp create mode 100644 test/std/experimental/numeric/numeric.ops/numeric.ops.gcd/gcd.bool4.fail.cpp create mode 100644 test/std/experimental/numeric/numeric.ops/numeric.ops.lcm/lcm.bool1.fail.cpp create mode 100644 test/std/experimental/numeric/numeric.ops/numeric.ops.lcm/lcm.bool2.fail.cpp create mode 100644 test/std/experimental/numeric/numeric.ops/numeric.ops.lcm/lcm.bool3.fail.cpp create mode 100644 test/std/experimental/numeric/numeric.ops/numeric.ops.lcm/lcm.bool4.fail.cpp create mode 100644 test/std/experimental/string.view/lit.local.cfg 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 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 create mode 100644 test/std/strings/basic.string.hash/enabled_hashes.pass.cpp create mode 100644 test/std/strings/basic.string/string.cons/implicit_deduction_guides.pass.cpp create mode 100644 test/std/strings/basic.string/traits_mismatch.fail.cpp delete mode 100644 test/std/strings/string.view/nothing_to_do.pass.cpp create mode 100644 test/std/strings/string.view/string.view.cons/assign.pass.cpp create mode 100644 test/std/strings/string.view/string.view.cons/implicit_deduction_guides.pass.cpp create mode 100644 test/std/strings/string.view/string.view.hash/enabled_hashes.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_adopt_lock.pass.cpp delete mode 100644 test/std/thread/thread.mutex/thread.lock/thread.lock.guard/variadic_assign.fail.cpp delete mode 100644 test/std/thread/thread.mutex/thread.lock/thread.lock.guard/variadic_copy.fail.cpp delete mode 100644 test/std/thread/thread.mutex/thread.lock/thread.lock.guard/variadic_mutex.fail.cpp delete mode 100644 test/std/thread/thread.mutex/thread.lock/thread.lock.guard/variadic_mutex.pass.cpp delete mode 100644 test/std/thread/thread.mutex/thread.lock/thread.lock.guard/variadic_mutex_cxx03.pass.cpp delete mode 100644 test/std/thread/thread.mutex/thread.lock/thread.lock.guard/variadic_types.pass.cpp create mode 100644 test/std/thread/thread.mutex/thread.lock/thread.lock.scoped/adopt_lock.pass.cpp create mode 100644 test/std/thread/thread.mutex/thread.lock/thread.lock.scoped/assign.fail.cpp create mode 100644 test/std/thread/thread.mutex/thread.lock/thread.lock.scoped/copy.fail.cpp create mode 100644 test/std/thread/thread.mutex/thread.lock/thread.lock.scoped/mutex.fail.cpp create mode 100644 test/std/thread/thread.mutex/thread.lock/thread.lock.scoped/mutex.pass.cpp create mode 100644 test/std/thread/thread.mutex/thread.lock/thread.lock.scoped/types.pass.cpp create mode 100644 test/std/thread/thread.threads/thread.thread.class/thread.thread.id/enabled_hashes.pass.cpp create mode 100644 test/std/utilities/function.objects/unord.hash/enabled_hashes.pass.cpp delete mode 100644 test/std/utilities/memory/unique.ptr/deleter.h delete mode 100644 test/std/utilities/memory/unique.ptr/nothing_to_do.pass.cpp delete mode 100644 test/std/utilities/memory/unique.ptr/unique.ptr.create/make_unique.array.pass.cpp delete mode 100644 test/std/utilities/memory/unique.ptr/unique.ptr.create/make_unique.array1.fail.cpp delete mode 100644 test/std/utilities/memory/unique.ptr/unique.ptr.create/make_unique.array2.fail.cpp delete mode 100644 test/std/utilities/memory/unique.ptr/unique.ptr.create/make_unique.array3.fail.cpp delete mode 100644 test/std/utilities/memory/unique.ptr/unique.ptr.create/make_unique.array4.fail.cpp delete mode 100644 test/std/utilities/memory/unique.ptr/unique.ptr.create/make_unique.single.pass.cpp delete mode 100644 test/std/utilities/memory/unique.ptr/unique.ptr.dltr/nothing_to_do.pass.cpp delete mode 100644 test/std/utilities/memory/unique.ptr/unique.ptr.dltr/unique.ptr.dltr.dflt/convert_ctor.pass.cpp delete mode 100644 test/std/utilities/memory/unique.ptr/unique.ptr.dltr/unique.ptr.dltr.dflt/default.pass.cpp delete mode 100644 test/std/utilities/memory/unique.ptr/unique.ptr.dltr/unique.ptr.dltr.dflt/incomplete.fail.cpp delete mode 100644 test/std/utilities/memory/unique.ptr/unique.ptr.dltr/unique.ptr.dltr.dflt/void.fail.cpp delete mode 100644 test/std/utilities/memory/unique.ptr/unique.ptr.dltr/unique.ptr.dltr.dflt1/convert_ctor.fail.cpp delete mode 100644 test/std/utilities/memory/unique.ptr/unique.ptr.dltr/unique.ptr.dltr.dflt1/convert_ctor.pass.cpp delete mode 100644 test/std/utilities/memory/unique.ptr/unique.ptr.dltr/unique.ptr.dltr.dflt1/default.pass.cpp delete mode 100644 test/std/utilities/memory/unique.ptr/unique.ptr.dltr/unique.ptr.dltr.dflt1/incomplete.fail.cpp delete mode 100644 test/std/utilities/memory/unique.ptr/unique.ptr.dltr/unique.ptr.dltr.general/nothing_to_do.pass.cpp delete mode 100644 test/std/utilities/memory/unique.ptr/unique.ptr.runtime/move01.fail.cpp 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/move02.fail.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_asgn.pass.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/pointer_type.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/default03.fail.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.fail.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/release.pass.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/dereference.fail.cpp delete mode 100644 test/std/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.observers/explicit_bool.pass.cpp delete mode 100644 test/std/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.observers/get.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.runtime/unique.ptr.runtime.observers/op_arrow.fail.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.fail.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.asgn/move_convert13.fail.cpp delete mode 100644 test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.asgn/null.pass.cpp delete mode 100644 test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.asgn/nullptr.pass.cpp delete mode 100644 test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/auto_pointer.pass.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/move_convert13.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.ctor/pointer_deleter04.fail.cpp delete mode 100644 test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.dtor/null.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/reset2.pass.cpp delete mode 100644 test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.modifiers/reset_self.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/dereference.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.pass.cpp delete mode 100644 test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.observers/get_deleter.pass.cpp delete mode 100644 test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.observers/index.fail.cpp delete mode 100644 test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.observers/op_arrow.pass.cpp delete mode 100644 test/std/utilities/memory/unique.ptr/unique.ptr.special/cmp_nullptr.pass.cpp delete mode 100644 test/std/utilities/memory/unique.ptr/unique.ptr.special/eq.pass.cpp delete mode 100644 test/std/utilities/memory/unique.ptr/unique.ptr.special/rel.pass.cpp delete mode 100644 test/std/utilities/memory/unique.ptr/unique.ptr.special/swap.pass.cpp create mode 100644 test/std/utilities/memory/util.smartptr/util.smartptr.hash/enabled_hash.pass.cpp delete mode 100644 test/std/utilities/memory/util.smartptr/util.smartptr.shared/test_deleter.h create mode 100644 test/std/utilities/meta/meta.unary/meta.unary.prop/is_aggregate.pass.cpp create mode 100644 test/std/utilities/optional/optional.hash/enabled_hash.pass.cpp create mode 100644 test/std/utilities/optional/optional.nullopt/nullopt_t.fail.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 create mode 100644 test/std/utilities/smartptr/unique.ptr/nothing_to_do.pass.cpp 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 create mode 100644 test/std/utilities/smartptr/unique.ptr/unique.ptr.class/unique.ptr.asgn/null.pass.cpp create mode 100644 test/std/utilities/smartptr/unique.ptr/unique.ptr.class/unique.ptr.asgn/nullptr.pass.cpp create mode 100644 test/std/utilities/smartptr/unique.ptr/unique.ptr.class/unique.ptr.ctor/auto_pointer.pass.cpp 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 create mode 100644 test/std/utilities/smartptr/unique.ptr/unique.ptr.class/unique.ptr.ctor/pointer_deleter.fail.cpp create mode 100644 test/std/utilities/smartptr/unique.ptr/unique.ptr.class/unique.ptr.ctor/pointer_deleter.pass.cpp create mode 100644 test/std/utilities/smartptr/unique.ptr/unique.ptr.class/unique.ptr.dtor/null.pass.cpp 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 create mode 100644 test/std/utilities/smartptr/unique.ptr/unique.ptr.class/unique.ptr.modifiers/reset.runtime.fail.cpp create mode 100644 test/std/utilities/smartptr/unique.ptr/unique.ptr.class/unique.ptr.modifiers/reset.single.pass.cpp create mode 100644 test/std/utilities/smartptr/unique.ptr/unique.ptr.class/unique.ptr.modifiers/reset_self.pass.cpp create mode 100644 test/std/utilities/smartptr/unique.ptr/unique.ptr.class/unique.ptr.modifiers/swap.pass.cpp create mode 100644 test/std/utilities/smartptr/unique.ptr/unique.ptr.class/unique.ptr.observers/dereference.runtime.fail.cpp create mode 100644 test/std/utilities/smartptr/unique.ptr/unique.ptr.class/unique.ptr.observers/dereference.single.pass.cpp 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 create mode 100644 test/std/utilities/smartptr/unique.ptr/unique.ptr.class/unique.ptr.observers/op_arrow.single.pass.cpp create mode 100644 test/std/utilities/smartptr/unique.ptr/unique.ptr.class/unique.ptr.observers/op_subscript.runtime.pass.cpp create mode 100644 test/std/utilities/smartptr/unique.ptr/unique.ptr.class/unique.ptr.observers/op_subscript.single.fail.cpp create mode 100644 test/std/utilities/smartptr/unique.ptr/unique.ptr.create/make_unique.array.pass.cpp create mode 100644 test/std/utilities/smartptr/unique.ptr/unique.ptr.create/make_unique.array1.fail.cpp create mode 100644 test/std/utilities/smartptr/unique.ptr/unique.ptr.create/make_unique.array2.fail.cpp create mode 100644 test/std/utilities/smartptr/unique.ptr/unique.ptr.create/make_unique.array3.fail.cpp create mode 100644 test/std/utilities/smartptr/unique.ptr/unique.ptr.create/make_unique.array4.fail.cpp create mode 100644 test/std/utilities/smartptr/unique.ptr/unique.ptr.create/make_unique.single.pass.cpp create mode 100644 test/std/utilities/smartptr/unique.ptr/unique.ptr.dltr/nothing_to_do.pass.cpp create mode 100644 test/std/utilities/smartptr/unique.ptr/unique.ptr.dltr/unique.ptr.dltr.dflt/convert_ctor.pass.cpp create mode 100644 test/std/utilities/smartptr/unique.ptr/unique.ptr.dltr/unique.ptr.dltr.dflt/default.pass.cpp create mode 100644 test/std/utilities/smartptr/unique.ptr/unique.ptr.dltr/unique.ptr.dltr.dflt/incomplete.fail.cpp create mode 100644 test/std/utilities/smartptr/unique.ptr/unique.ptr.dltr/unique.ptr.dltr.dflt/void.fail.cpp create mode 100644 test/std/utilities/smartptr/unique.ptr/unique.ptr.dltr/unique.ptr.dltr.dflt1/convert_ctor.fail.cpp create mode 100644 test/std/utilities/smartptr/unique.ptr/unique.ptr.dltr/unique.ptr.dltr.dflt1/convert_ctor.pass.cpp create mode 100644 test/std/utilities/smartptr/unique.ptr/unique.ptr.dltr/unique.ptr.dltr.dflt1/default.pass.cpp create mode 100644 test/std/utilities/smartptr/unique.ptr/unique.ptr.dltr/unique.ptr.dltr.dflt1/incomplete.fail.cpp create mode 100644 test/std/utilities/smartptr/unique.ptr/unique.ptr.dltr/unique.ptr.dltr.general/nothing_to_do.pass.cpp create mode 100644 test/std/utilities/smartptr/unique.ptr/unique.ptr.special/cmp_nullptr.pass.cpp create mode 100644 test/std/utilities/smartptr/unique.ptr/unique.ptr.special/eq.pass.cpp create mode 100644 test/std/utilities/smartptr/unique.ptr/unique.ptr.special/rel.pass.cpp create mode 100644 test/std/utilities/smartptr/unique.ptr/unique.ptr.special/swap.pass.cpp create mode 100644 test/std/utilities/template.bitset/bitset.hash/enabled_hash.pass.cpp create mode 100644 test/std/utilities/tuple/tuple.general/ignore.pass.cpp create mode 100644 test/std/utilities/type.index/type.index.hash/enabled_hash.pass.cpp create mode 100644 test/std/utilities/variant/variant.hash/enabled_hash.pass.cpp (limited to 'test/std') 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 e24598a9bc12..e2abf7cce42e 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 c923d847f11e..313b6bac402e 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_copy_if.pass.cpp b/test/std/algorithms/alg.modifying.operations/alg.remove/remove_copy_if.pass.cpp index de3f0a741045..1cf2d9e84562 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.replace/replace_copy_if.pass.cpp b/test/std/algorithms/alg.modifying.operations/alg.replace/replace_copy_if.pass.cpp index 1eff3d39e20e..f2ffece12e8b 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 8d6ab04e14dd..ebb2945d7c43 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.transform/unary_transform.pass.cpp b/test/std/algorithms/alg.modifying.operations/alg.transform/unary_transform.pass.cpp index 68556fd98817..6c5e621e4b20 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.nonmodifying/alg.count/count_if.pass.cpp b/test/std/algorithms/alg.nonmodifying/alg.count/count_if.pass.cpp index 025bc06a618d..0a05c6f659ca 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 bde6ff389d0c..c942d2e38a58 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 661e643f07d1..e68344b4b259 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.sorting/alg.heap.operations/make.heap/make_heap.pass.cpp b/test/std/algorithms/alg.sorting/alg.heap.operations/make.heap/make_heap.pass.cpp index 9da9356b0be1..082cad5f2d08 100644 --- a/test/std/algorithms/alg.sorting/alg.heap.operations/make.heap/make_heap.pass.cpp +++ b/test/std/algorithms/alg.sorting/alg.heap.operations/make.heap/make_heap.pass.cpp @@ -15,14 +15,17 @@ // make_heap(Iter first, Iter last); #include +#include #include +std::mt19937 randomness; + void test(int N) { int* ia = new int [N]; for (int i = 0; i < N; ++i) ia[i] = i; - std::random_shuffle(ia, ia+N); + std::shuffle(ia, ia+N, randomness); std::make_heap(ia, ia+N); assert(std::is_heap(ia, ia+N)); delete [] ia; diff --git a/test/std/algorithms/alg.sorting/alg.heap.operations/make.heap/make_heap_comp.pass.cpp b/test/std/algorithms/alg.sorting/alg.heap.operations/make.heap/make_heap_comp.pass.cpp index 9d0545f0d9c5..01183d16c927 100644 --- a/test/std/algorithms/alg.sorting/alg.heap.operations/make.heap/make_heap_comp.pass.cpp +++ b/test/std/algorithms/alg.sorting/alg.heap.operations/make.heap/make_heap_comp.pass.cpp @@ -17,6 +17,7 @@ #include #include #include +#include #include #include "test_macros.h" @@ -29,6 +30,7 @@ struct indirect_less {return *x < *y;} }; +std::mt19937 randomness; void test(int N) { @@ -36,7 +38,7 @@ void test(int N) { for (int i = 0; i < N; ++i) ia[i] = i; - std::random_shuffle(ia, ia+N); + std::shuffle(ia, ia+N, randomness); std::make_heap(ia, ia+N, std::greater()); assert(std::is_heap(ia, ia+N, std::greater())); } @@ -64,7 +66,7 @@ void test(int N) // Random { binary_counting_predicate, int, int> pred ((std::greater())); - std::random_shuffle(ia, ia+N); + std::shuffle(ia, ia+N, randomness); std::make_heap(ia, ia+N, std::ref(pred)); assert(pred.count() <= 3u*N); assert(std::is_heap(ia, ia+N, pred)); @@ -90,7 +92,7 @@ int main() std::unique_ptr* ia = new std::unique_ptr [N]; for (int i = 0; i < N; ++i) ia[i].reset(new int(i)); - std::random_shuffle(ia, ia+N); + std::shuffle(ia, ia+N, randomness); std::make_heap(ia, ia+N, indirect_less()); assert(std::is_heap(ia, ia+N, indirect_less())); delete [] ia; diff --git a/test/std/algorithms/alg.sorting/alg.heap.operations/pop.heap/pop_heap.pass.cpp b/test/std/algorithms/alg.sorting/alg.heap.operations/pop.heap/pop_heap.pass.cpp index 252fc758cb1f..8ba0f7194062 100644 --- a/test/std/algorithms/alg.sorting/alg.heap.operations/pop.heap/pop_heap.pass.cpp +++ b/test/std/algorithms/alg.sorting/alg.heap.operations/pop.heap/pop_heap.pass.cpp @@ -15,14 +15,17 @@ // pop_heap(Iter first, Iter last); #include +#include #include +std::mt19937 randomness; + void test(int N) { int* ia = new int [N]; for (int i = 0; i < N; ++i) ia[i] = i; - std::random_shuffle(ia, ia+N); + std::shuffle(ia, ia+N, randomness); std::make_heap(ia, ia+N); for (int i = N; i > 0; --i) { 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 0bfad61961ed..8e7931f7ea5d 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 @@ -16,10 +16,12 @@ #include #include +#include #include #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES #include + struct indirect_less { template @@ -29,12 +31,14 @@ struct indirect_less #endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES +std::mt19937 randomness; + void test(int N) { int* ia = new int [N]; for (int i = 0; i < N; ++i) ia[i] = i; - std::random_shuffle(ia, ia+N); + std::shuffle(ia, ia+N, randomness); std::make_heap(ia, ia+N, std::greater()); for (int i = N; i > 0; --i) { @@ -55,7 +59,7 @@ int main() std::unique_ptr* ia = new std::unique_ptr [N]; for (int i = 0; i < N; ++i) ia[i].reset(new int(i)); - std::random_shuffle(ia, ia+N); + std::shuffle(ia, ia+N, randomness); std::make_heap(ia, ia+N, indirect_less()); for (int i = N; i > 0; --i) { diff --git a/test/std/algorithms/alg.sorting/alg.heap.operations/push.heap/push_heap.pass.cpp b/test/std/algorithms/alg.sorting/alg.heap.operations/push.heap/push_heap.pass.cpp index d82896d6a916..38d7a425d82b 100644 --- a/test/std/algorithms/alg.sorting/alg.heap.operations/push.heap/push_heap.pass.cpp +++ b/test/std/algorithms/alg.sorting/alg.heap.operations/push.heap/push_heap.pass.cpp @@ -16,14 +16,17 @@ // push_heap(Iter first, Iter last); #include +#include #include +std::mt19937 randomness; + void test(int N) { int* ia = new int [N]; for (int i = 0; i < N; ++i) ia[i] = i; - std::random_shuffle(ia, ia+N); + std::shuffle(ia, ia+N, randomness); for (int i = 0; i <= N; ++i) { std::push_heap(ia, ia+i); 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 5d2985cc07fa..38d09ceda6e2 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 @@ -17,6 +17,7 @@ #include #include +#include #include #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES #include @@ -30,12 +31,14 @@ struct indirect_less #endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES +std::mt19937 randomness; + void test(int N) { int* ia = new int [N]; for (int i = 0; i < N; ++i) ia[i] = i; - std::random_shuffle(ia, ia+N); + std::shuffle(ia, ia+N, randomness); for (int i = 0; i <= N; ++i) { std::push_heap(ia, ia+i, std::greater()); @@ -54,7 +57,7 @@ int main() std::unique_ptr* ia = new std::unique_ptr [N]; for (int i = 0; i < N; ++i) ia[i].reset(new int(i)); - std::random_shuffle(ia, ia+N); + std::shuffle(ia, ia+N, randomness); for (int i = 0; i <= N; ++i) { std::push_heap(ia, ia+i, indirect_less()); diff --git a/test/std/algorithms/alg.sorting/alg.heap.operations/sort.heap/sort_heap.pass.cpp b/test/std/algorithms/alg.sorting/alg.heap.operations/sort.heap/sort_heap.pass.cpp index c6eaa8ccec86..003138099f5a 100644 --- a/test/std/algorithms/alg.sorting/alg.heap.operations/sort.heap/sort_heap.pass.cpp +++ b/test/std/algorithms/alg.sorting/alg.heap.operations/sort.heap/sort_heap.pass.cpp @@ -15,14 +15,17 @@ // sort_heap(Iter first, Iter last); #include +#include #include +std::mt19937 randomness; + void test(int N) { int* ia = new int [N]; for (int i = 0; i < N; ++i) ia[i] = i; - std::random_shuffle(ia, ia+N); + std::shuffle(ia, ia+N, randomness); std::make_heap(ia, ia+N); std::sort_heap(ia, ia+N); assert(std::is_sorted(ia, ia+N)); 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 1c072c5a12ca..c0a05e4209b3 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 @@ -16,6 +16,7 @@ #include #include +#include #include #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES #include @@ -29,12 +30,14 @@ struct indirect_less #endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES +std::mt19937 randomness; + void test(int N) { int* ia = new int [N]; for (int i = 0; i < N; ++i) ia[i] = i; - std::random_shuffle(ia, ia+N); + std::shuffle(ia, ia+N, randomness); std::make_heap(ia, ia+N, std::greater()); std::sort_heap(ia, ia+N, std::greater()); assert(std::is_sorted(ia, ia+N, std::greater())); @@ -56,7 +59,7 @@ int main() std::unique_ptr* ia = new std::unique_ptr [N]; for (int i = 0; i < N; ++i) ia[i].reset(new int(i)); - std::random_shuffle(ia, ia+N); + std::shuffle(ia, ia+N, randomness); std::make_heap(ia, ia+N, indirect_less()); std::sort_heap(ia, ia+N, indirect_less()); assert(std::is_sorted(ia, ia+N, indirect_less())); diff --git a/test/std/algorithms/alg.sorting/alg.merge/inplace_merge.pass.cpp b/test/std/algorithms/alg.sorting/alg.merge/inplace_merge.pass.cpp index 33a42a2f62a1..683b07d32089 100644 --- a/test/std/algorithms/alg.sorting/alg.merge/inplace_merge.pass.cpp +++ b/test/std/algorithms/alg.sorting/alg.merge/inplace_merge.pass.cpp @@ -16,6 +16,7 @@ // inplace_merge(Iter first, Iter middle, Iter last); #include +#include #include #include "test_iterators.h" @@ -42,6 +43,8 @@ struct S { }; #endif +std::mt19937 randomness; + template void test_one(unsigned N, unsigned M) @@ -51,7 +54,7 @@ test_one(unsigned N, unsigned M) value_type* ia = new value_type[N]; for (unsigned i = 0; i < N; ++i) ia[i] = i; - std::random_shuffle(ia, ia+N); + std::shuffle(ia, ia+N, randomness); std::sort(ia, ia+M); std::sort(ia+M, ia+N); std::inplace_merge(Iter(ia), Iter(ia+M), Iter(ia+N)); diff --git a/test/std/algorithms/alg.sorting/alg.merge/inplace_merge_comp.pass.cpp b/test/std/algorithms/alg.sorting/alg.merge/inplace_merge_comp.pass.cpp index fd9e5f13c26a..3d8902ec2271 100644 --- a/test/std/algorithms/alg.sorting/alg.merge/inplace_merge_comp.pass.cpp +++ b/test/std/algorithms/alg.sorting/alg.merge/inplace_merge_comp.pass.cpp @@ -17,6 +17,7 @@ #include #include +#include #include #include "test_macros.h" @@ -58,6 +59,8 @@ struct S { #include "test_iterators.h" #include "counting_predicates.hpp" +std::mt19937 randomness; + template void test_one(unsigned N, unsigned M) @@ -67,7 +70,7 @@ test_one(unsigned N, unsigned M) value_type* ia = new value_type[N]; for (unsigned i = 0; i < N; ++i) ia[i] = i; - std::random_shuffle(ia, ia+N); + std::shuffle(ia, ia+N, randomness); std::sort(ia, ia+M, std::greater()); std::sort(ia+M, ia+N, std::greater()); binary_counting_predicate, value_type, value_type> pred((std::greater())); @@ -130,7 +133,7 @@ int main() std::unique_ptr* ia = new std::unique_ptr[N]; for (int i = 0; i < N; ++i) ia[i].reset(new int(i)); - std::random_shuffle(ia, ia+N); + std::shuffle(ia, ia+N, randomness); std::sort(ia, ia+M, indirect_less()); std::sort(ia+M, ia+N, indirect_less()); std::inplace_merge(ia, ia+M, ia+N, indirect_less()); diff --git a/test/std/algorithms/alg.sorting/alg.merge/merge.pass.cpp b/test/std/algorithms/alg.sorting/alg.merge/merge.pass.cpp index 2a20cac0b79b..777461023e7d 100644 --- a/test/std/algorithms/alg.sorting/alg.merge/merge.pass.cpp +++ b/test/std/algorithms/alg.sorting/alg.merge/merge.pass.cpp @@ -19,10 +19,13 @@ // merge(InIter1 first1, InIter1 last1, InIter2 first2, InIter2 last2, OutIter result); #include +#include #include #include "test_iterators.h" +std::mt19937 randomness; + template void test() @@ -53,7 +56,7 @@ test() int* ic = new int[2*N]; for (unsigned i = 0; i < 2*N; ++i) ic[i] = i; - std::random_shuffle(ic, ic+2*N); + std::shuffle(ic, ic+2*N, randomness); std::copy(ic, ic+N, ia); std::copy(ic+N, ic+2*N, ib); std::sort(ia, ia+N); diff --git a/test/std/algorithms/alg.sorting/alg.merge/merge_comp.pass.cpp b/test/std/algorithms/alg.sorting/alg.merge/merge_comp.pass.cpp index 152c552381b9..3daaeebbeae9 100644 --- a/test/std/algorithms/alg.sorting/alg.merge/merge_comp.pass.cpp +++ b/test/std/algorithms/alg.sorting/alg.merge/merge_comp.pass.cpp @@ -22,11 +22,14 @@ #include #include +#include #include #include "test_iterators.h" #include "counting_predicates.hpp" +std::mt19937 randomness; + template void test() @@ -61,7 +64,7 @@ test() int* ic = new int[2*N]; for (unsigned i = 0; i < 2*N; ++i) ic[i] = i; - std::random_shuffle(ic, ic+2*N); + std::shuffle(ic, ic+2*N, randomness); std::copy(ic, ic+N, ia); std::copy(ic+N, ic+2*N, ib); std::sort(ia, ia+N, std::greater()); diff --git a/test/std/algorithms/alg.sorting/alg.min.max/max_element.pass.cpp b/test/std/algorithms/alg.sorting/alg.min.max/max_element.pass.cpp index e9cd086ab13d..471b08cc6e1f 100644 --- a/test/std/algorithms/alg.sorting/alg.min.max/max_element.pass.cpp +++ b/test/std/algorithms/alg.sorting/alg.min.max/max_element.pass.cpp @@ -15,10 +15,13 @@ // max_element(Iter first, Iter last); #include +#include #include #include "test_iterators.h" +std::mt19937 randomness; + template void test(Iter first, Iter last) @@ -40,7 +43,7 @@ test(int N) int* a = new int[N]; for (int i = 0; i < N; ++i) a[i] = i; - std::random_shuffle(a, a+N); + std::shuffle(a, a+N, randomness); test(Iter(a), Iter(a+N)); delete [] a; } diff --git a/test/std/algorithms/alg.sorting/alg.min.max/max_element_comp.pass.cpp b/test/std/algorithms/alg.sorting/alg.min.max/max_element_comp.pass.cpp index e60e156455f3..95c7dee2cdb7 100644 --- a/test/std/algorithms/alg.sorting/alg.min.max/max_element_comp.pass.cpp +++ b/test/std/algorithms/alg.sorting/alg.min.max/max_element_comp.pass.cpp @@ -16,11 +16,14 @@ #include #include +#include #include #include "test_macros.h" #include "test_iterators.h" +std::mt19937 randomness; + template void test(Iter first, Iter last) @@ -42,7 +45,7 @@ test(int N) int* a = new int[N]; for (int i = 0; i < N; ++i) a[i] = i; - std::random_shuffle(a, a+N); + std::shuffle(a, a+N, randomness); test(Iter(a), Iter(a+N)); delete [] a; } diff --git a/test/std/algorithms/alg.sorting/alg.min.max/min_element.pass.cpp b/test/std/algorithms/alg.sorting/alg.min.max/min_element.pass.cpp index c41884220857..7cd41eaeae46 100644 --- a/test/std/algorithms/alg.sorting/alg.min.max/min_element.pass.cpp +++ b/test/std/algorithms/alg.sorting/alg.min.max/min_element.pass.cpp @@ -15,10 +15,13 @@ // min_element(Iter first, Iter last); #include +#include #include #include "test_iterators.h" +std::mt19937 randomness; + template void test(Iter first, Iter last) @@ -40,7 +43,7 @@ test(int N) int* a = new int[N]; for (int i = 0; i < N; ++i) a[i] = i; - std::random_shuffle(a, a+N); + std::shuffle(a, a+N, randomness); test(Iter(a), Iter(a+N)); delete [] a; } diff --git a/test/std/algorithms/alg.sorting/alg.min.max/min_element_comp.pass.cpp b/test/std/algorithms/alg.sorting/alg.min.max/min_element_comp.pass.cpp index c4c6e31eb6dd..402d57dae69e 100644 --- a/test/std/algorithms/alg.sorting/alg.min.max/min_element_comp.pass.cpp +++ b/test/std/algorithms/alg.sorting/alg.min.max/min_element_comp.pass.cpp @@ -16,11 +16,14 @@ #include #include +#include #include #include "test_macros.h" #include "test_iterators.h" +std::mt19937 randomness; + template void test(Iter first, Iter last) @@ -42,7 +45,7 @@ test(int N) int* a = new int[N]; for (int i = 0; i < N; ++i) a[i] = i; - std::random_shuffle(a, a+N); + std::shuffle(a, a+N, randomness); test(Iter(a), Iter(a+N)); delete [] a; } diff --git a/test/std/algorithms/alg.sorting/alg.min.max/minmax_element.pass.cpp b/test/std/algorithms/alg.sorting/alg.min.max/minmax_element.pass.cpp index c2805a656137..acede6ff7b56 100644 --- a/test/std/algorithms/alg.sorting/alg.min.max/minmax_element.pass.cpp +++ b/test/std/algorithms/alg.sorting/alg.min.max/minmax_element.pass.cpp @@ -15,10 +15,13 @@ // minmax_element(Iter first, Iter last); #include +#include #include #include "test_iterators.h" +std::mt19937 randomness; + template void test(Iter first, Iter last) @@ -46,7 +49,7 @@ test(int N) int* a = new int[N]; for (int i = 0; i < N; ++i) a[i] = i; - std::random_shuffle(a, a+N); + std::shuffle(a, a+N, randomness); test(Iter(a), Iter(a+N)); delete [] a; } @@ -66,7 +69,7 @@ test() int* a = new int[N]; for (int i = 0; i < N; ++i) a[i] = 5; - std::random_shuffle(a, a+N); + std::shuffle(a, a+N, randomness); std::pair p = std::minmax_element(Iter(a), Iter(a+N)); assert(base(p.first) == a); assert(base(p.second) == a+N-1); diff --git a/test/std/algorithms/alg.sorting/alg.min.max/minmax_element_comp.pass.cpp b/test/std/algorithms/alg.sorting/alg.min.max/minmax_element_comp.pass.cpp index 7840638f742c..ff83d7e55d3d 100644 --- a/test/std/algorithms/alg.sorting/alg.min.max/minmax_element_comp.pass.cpp +++ b/test/std/algorithms/alg.sorting/alg.min.max/minmax_element_comp.pass.cpp @@ -16,11 +16,14 @@ #include #include +#include #include #include "test_macros.h" #include "test_iterators.h" +std::mt19937 randomness; + template void test(Iter first, Iter last) @@ -50,7 +53,7 @@ test(int N) int* a = new int[N]; for (int i = 0; i < N; ++i) a[i] = i; - std::random_shuffle(a, a+N); + std::shuffle(a, a+N, randomness); test(Iter(a), Iter(a+N)); delete [] a; } @@ -70,7 +73,7 @@ test() int* a = new int[N]; for (int i = 0; i < N; ++i) a[i] = 5; - std::random_shuffle(a, a+N); + std::shuffle(a, a+N, randomness); typedef std::greater Compare; Compare comp; std::pair p = std::minmax_element(Iter(a), Iter(a+N), comp); diff --git a/test/std/algorithms/alg.sorting/alg.nth.element/nth_element.pass.cpp b/test/std/algorithms/alg.sorting/alg.nth.element/nth_element.pass.cpp index 560bc902b482..b43d88fe0cc6 100644 --- a/test/std/algorithms/alg.sorting/alg.nth.element/nth_element.pass.cpp +++ b/test/std/algorithms/alg.sorting/alg.nth.element/nth_element.pass.cpp @@ -16,8 +16,11 @@ // nth_element(Iter first, Iter nth, Iter last); #include +#include #include +std::mt19937 randomness; + void test_one(int N, int M) { @@ -26,7 +29,7 @@ test_one(int N, int M) int* array = new int[N]; for (int i = 0; i < N; ++i) array[i] = i; - std::random_shuffle(array, array+N); + std::shuffle(array, array+N, randomness); std::nth_element(array, array+M, array+N); assert(array[M] == M); std::nth_element(array, array+N, array+N); // begin, end, end 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 f2c962724f09..88249ed78d27 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 @@ -18,6 +18,7 @@ #include #include #include +#include #include #include #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES @@ -32,6 +33,8 @@ struct indirect_less #endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES +std::mt19937 randomness; + void test_one(int N, int M) { @@ -40,7 +43,7 @@ test_one(int N, int M) int* array = new int[N]; for (int i = 0; i < N; ++i) array[i] = i; - std::random_shuffle(array, array+N); + std::shuffle(array, array+N, randomness); std::nth_element(array, array+M, array+N, std::greater()); assert(array[M] == N-M-1); std::nth_element(array, array+N, array+N, std::greater()); // begin, end, end diff --git a/test/std/algorithms/alg.sorting/alg.sort/partial.sort.copy/partial_sort_copy.pass.cpp b/test/std/algorithms/alg.sorting/alg.sort/partial.sort.copy/partial_sort_copy.pass.cpp index 1d4ca9925a86..d0b41cca3ca6 100644 --- a/test/std/algorithms/alg.sorting/alg.sort/partial.sort.copy/partial_sort_copy.pass.cpp +++ b/test/std/algorithms/alg.sorting/alg.sort/partial.sort.copy/partial_sort_copy.pass.cpp @@ -18,10 +18,13 @@ // partial_sort_copy(InIter first, InIter last, RAIter result_first, RAIter result_last); #include +#include #include #include "test_iterators.h" +std::mt19937 randomness; + template void test_larger_sorts(int N, int M) @@ -30,7 +33,7 @@ test_larger_sorts(int N, int M) int* output = new int[M]; for (int i = 0; i < N; ++i) input[i] = i; - std::random_shuffle(input, input+N); + std::shuffle(input, input+N, randomness); int* r = std::partial_sort_copy(Iter(input), Iter(input+N), output, output+M); int* e = output + std::min(N, M); assert(r == e); diff --git a/test/std/algorithms/alg.sorting/alg.sort/partial.sort.copy/partial_sort_copy_comp.pass.cpp b/test/std/algorithms/alg.sorting/alg.sort/partial.sort.copy/partial_sort_copy_comp.pass.cpp index 460ea4c08275..0ac2a86afce6 100644 --- a/test/std/algorithms/alg.sorting/alg.sort/partial.sort.copy/partial_sort_copy_comp.pass.cpp +++ b/test/std/algorithms/alg.sorting/alg.sort/partial.sort.copy/partial_sort_copy_comp.pass.cpp @@ -21,10 +21,13 @@ #include #include +#include #include #include "test_iterators.h" +std::mt19937 randomness; + template void test_larger_sorts(int N, int M) @@ -33,7 +36,7 @@ test_larger_sorts(int N, int M) int* output = new int[M]; for (int i = 0; i < N; ++i) input[i] = i; - std::random_shuffle(input, input+N); + std::shuffle(input, input+N, randomness); int* r = std::partial_sort_copy(Iter(input), Iter(input+N), output, output+M, std::greater()); int* e = output + std::min(N, M); diff --git a/test/std/algorithms/alg.sorting/alg.sort/partial.sort/partial_sort.pass.cpp b/test/std/algorithms/alg.sorting/alg.sort/partial.sort/partial_sort.pass.cpp index 0d32ba898b8f..05a06a9c3357 100644 --- a/test/std/algorithms/alg.sorting/alg.sort/partial.sort/partial_sort.pass.cpp +++ b/test/std/algorithms/alg.sorting/alg.sort/partial.sort/partial_sort.pass.cpp @@ -16,8 +16,11 @@ // partial_sort(Iter first, Iter middle, Iter last); #include +#include #include +std::mt19937 randomness; + void test_larger_sorts(int N, int M) { @@ -26,7 +29,7 @@ test_larger_sorts(int N, int M) int* array = new int[N]; for (int i = 0; i < N; ++i) array[i] = i; - std::random_shuffle(array, array+N); + std::shuffle(array, array+N, randomness); std::partial_sort(array, array+M, array+N); for (int i = 0; i < M; ++i) { 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 a4fe1cc5e7ca..847a5829140a 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 @@ -18,6 +18,7 @@ #include #include #include +#include #include #include #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES @@ -32,6 +33,8 @@ struct indirect_less #endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES +std::mt19937 randomness; + void test_larger_sorts(int N, int M) { @@ -40,7 +43,7 @@ test_larger_sorts(int N, int M) int* array = new int[N]; for (int i = 0; i < N; ++i) array[i] = i; - std::random_shuffle(array, array+N); + std::shuffle(array, array+N, randomness); std::partial_sort(array, array+M, array+N, std::greater()); for (int i = 0; i < M; ++i) { diff --git a/test/std/algorithms/alg.sorting/alg.sort/sort/sort.pass.cpp b/test/std/algorithms/alg.sorting/alg.sort/sort/sort.pass.cpp index 689433f9e45b..6149a574b230 100644 --- a/test/std/algorithms/alg.sorting/alg.sort/sort/sort.pass.cpp +++ b/test/std/algorithms/alg.sorting/alg.sort/sort/sort.pass.cpp @@ -17,8 +17,11 @@ #include #include +#include #include +std::mt19937 randomness; + template void test_sort_helper(RI f, RI l) @@ -92,7 +95,7 @@ test_larger_sorts(int N, int M) std::sort(array, array+N); assert(std::is_sorted(array, array+N)); // test random pattern - std::random_shuffle(array, array+N); + std::shuffle(array, array+N, randomness); std::sort(array, array+N); assert(std::is_sorted(array, array+N)); // test sorted pattern diff --git a/test/std/algorithms/alg.sorting/alg.sort/stable.sort/stable_sort.pass.cpp b/test/std/algorithms/alg.sorting/alg.sort/stable.sort/stable_sort.pass.cpp index 336fcd0b3dde..994d3a8c4a7c 100644 --- a/test/std/algorithms/alg.sorting/alg.sort/stable.sort/stable_sort.pass.cpp +++ b/test/std/algorithms/alg.sorting/alg.sort/stable.sort/stable_sort.pass.cpp @@ -17,8 +17,11 @@ #include #include +#include #include +std::mt19937 randomness; + template void test_sort_helper(RI f, RI l) @@ -92,7 +95,7 @@ test_larger_sorts(int N, int M) std::stable_sort(array, array+N); assert(std::is_sorted(array, array+N)); // test random pattern - std::random_shuffle(array, array+N); + std::shuffle(array, array+N, randomness); std::stable_sort(array, array+N); assert(std::is_sorted(array, array+N)); // test sorted pattern 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 49f7122cdb31..347711bf5e3a 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 @@ -18,6 +18,7 @@ #include #include #include +#include #include #include #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES @@ -32,6 +33,8 @@ struct indirect_less #endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES +std::mt19937 randomness; + struct first_only { bool operator()(const std::pair& x, const std::pair& y) @@ -59,7 +62,7 @@ void test() } for (int i = 0; i < N - M; i += M) { - std::random_shuffle(v.begin() + i, v.begin() + i + M); + std::shuffle(v.begin() + i, v.begin() + i + M, randomness); } std::stable_sort(v.begin(), v.end(), first_only()); assert(std::is_sorted(v.begin(), v.end())); diff --git a/test/std/containers/associative/map/PR28469_undefined_behavior_segfault.sh.cpp b/test/std/containers/associative/map/PR28469_undefined_behavior_segfault.sh.cpp index 32d34d90d7f8..646c6be7da61 100644 --- a/test/std/containers/associative/map/PR28469_undefined_behavior_segfault.sh.cpp +++ b/test/std/containers/associative/map/PR28469_undefined_behavior_segfault.sh.cpp @@ -13,7 +13,7 @@ // // Previously this code caused a segfault when compiled at -O2 due to undefined -// behavior in __tree. See https://llvm.org/bugs/show_bug.cgi?id=28469 +// behavior in __tree. See https://bugs.llvm.org/show_bug.cgi?id=28469 #include #include diff --git a/test/std/containers/associative/map/compare.pass.cpp b/test/std/containers/associative/map/compare.pass.cpp index 9d1c13d7b8e6..8c429cbd3c4b 100644 --- a/test/std/containers/associative/map/compare.pass.cpp +++ b/test/std/containers/associative/map/compare.pass.cpp @@ -13,8 +13,8 @@ // class Allocator = allocator>> // class map -// http://llvm.org/bugs/show_bug.cgi?id=16538 -// http://llvm.org/bugs/show_bug.cgi?id=16549 +// https://bugs.llvm.org/show_bug.cgi?id=16538 +// https://bugs.llvm.org/show_bug.cgi?id=16549 #include #include diff --git a/test/std/containers/associative/map/incomplete_type.pass.cpp b/test/std/containers/associative/map/incomplete_type.pass.cpp index 84c2451ce087..6acf83129e12 100644 --- a/test/std/containers/associative/map/incomplete_type.pass.cpp +++ b/test/std/containers/associative/map/incomplete_type.pass.cpp @@ -9,7 +9,7 @@ // -// Check that std::map and it's iterators can be instantiated with an incomplete +// Check that std::map and its iterators can be instantiated with an incomplete // type. #include 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 9a00829eadd6..f8fc21f1f2f5 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 @@ -13,7 +13,7 @@ // mapped_type& operator[](const key_type& k); -// http://llvm.org/bugs/show_bug.cgi?id=16542 +// https://bugs.llvm.org/show_bug.cgi?id=16542 #include diff --git a/test/std/containers/associative/map/map.cons/default_noexcept.pass.cpp b/test/std/containers/associative/map/map.cons/default_noexcept.pass.cpp index 817f1207ac94..e06410dcffa2 100644 --- a/test/std/containers/associative/map/map.cons/default_noexcept.pass.cpp +++ b/test/std/containers/associative/map/map.cons/default_noexcept.pass.cpp @@ -37,14 +37,16 @@ struct some_comp int main() { typedef std::pair V; +#if defined(_LIBCPP_VERSION) { typedef std::map C; - LIBCPP_STATIC_ASSERT(std::is_nothrow_default_constructible::value, ""); + static_assert(std::is_nothrow_default_constructible::value, ""); } { typedef std::map, test_allocator> C; - LIBCPP_STATIC_ASSERT(std::is_nothrow_default_constructible::value, ""); + static_assert(std::is_nothrow_default_constructible::value, ""); } +#endif // _LIBCPP_VERSION { typedef std::map, other_allocator> C; static_assert(!std::is_nothrow_default_constructible::value, ""); diff --git a/test/std/containers/associative/map/map.cons/dtor_noexcept.pass.cpp b/test/std/containers/associative/map/map.cons/dtor_noexcept.pass.cpp index a0cf689ed909..7f563b7cf635 100644 --- a/test/std/containers/associative/map/map.cons/dtor_noexcept.pass.cpp +++ b/test/std/containers/associative/map/map.cons/dtor_noexcept.pass.cpp @@ -43,8 +43,10 @@ int main() typedef std::map, other_allocator> C; static_assert(std::is_nothrow_destructible::value, ""); } +#if defined(_LIBCPP_VERSION) { typedef std::map> C; - LIBCPP_STATIC_ASSERT(!std::is_nothrow_destructible::value, ""); + static_assert(!std::is_nothrow_destructible::value, ""); } +#endif // _LIBCPP_VERSION } 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 705fb580487b..923a2124ece4 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_assign_noexcept.pass.cpp b/test/std/containers/associative/map/map.cons/move_assign_noexcept.pass.cpp index 84f115f1958e..b45e821ad0f9 100644 --- a/test/std/containers/associative/map/map.cons/move_assign_noexcept.pass.cpp +++ b/test/std/containers/associative/map/map.cons/move_assign_noexcept.pass.cpp @@ -45,10 +45,12 @@ int main() typedef std::map, test_allocator> C; static_assert(!std::is_nothrow_move_assignable::value, ""); } +#if defined(_LIBCPP_VERSION) { typedef std::map, other_allocator> C; - LIBCPP_STATIC_ASSERT(std::is_nothrow_move_assignable::value, ""); + static_assert(std::is_nothrow_move_assignable::value, ""); } +#endif // _LIBCPP_VERSION { typedef std::map> C; static_assert(!std::is_nothrow_move_assignable::value, ""); diff --git a/test/std/containers/associative/map/map.cons/move_noexcept.pass.cpp b/test/std/containers/associative/map/map.cons/move_noexcept.pass.cpp index b5301418e85a..84a9609742d3 100644 --- a/test/std/containers/associative/map/map.cons/move_noexcept.pass.cpp +++ b/test/std/containers/associative/map/map.cons/move_noexcept.pass.cpp @@ -34,19 +34,21 @@ struct some_comp int main() { +#if defined(_LIBCPP_VERSION) typedef std::pair V; { typedef std::map C; - LIBCPP_STATIC_ASSERT(std::is_nothrow_move_constructible::value, ""); + static_assert(std::is_nothrow_move_constructible::value, ""); } { typedef std::map, test_allocator> C; - LIBCPP_STATIC_ASSERT(std::is_nothrow_move_constructible::value, ""); + static_assert(std::is_nothrow_move_constructible::value, ""); } { typedef std::map, other_allocator> C; - LIBCPP_STATIC_ASSERT(std::is_nothrow_move_constructible::value, ""); + static_assert(std::is_nothrow_move_constructible::value, ""); } +#endif // _LIBCPP_VERSION { typedef std::map> C; static_assert(!std::is_nothrow_move_constructible::value, ""); diff --git a/test/std/containers/associative/map/map.special/swap_noexcept.pass.cpp b/test/std/containers/associative/map/map.special/swap_noexcept.pass.cpp index 84907945a90e..c1aa033845ec 100644 --- a/test/std/containers/associative/map/map.special/swap_noexcept.pass.cpp +++ b/test/std/containers/associative/map/map.special/swap_noexcept.pass.cpp @@ -99,14 +99,16 @@ int main() typedef std::map C; static_assert(noexcept(swap(std::declval(), std::declval())), ""); } +#if defined(_LIBCPP_VERSION) { typedef std::map, test_allocator> C; - LIBCPP_STATIC_ASSERT(noexcept(swap(std::declval(), std::declval())), ""); + static_assert(noexcept(swap(std::declval(), std::declval())), ""); } { typedef std::map, other_allocator> C; - LIBCPP_STATIC_ASSERT(noexcept(swap(std::declval(), std::declval())), ""); + static_assert(noexcept(swap(std::declval(), std::declval())), ""); } +#endif // _LIBCPP_VERSION { typedef std::map> C; static_assert(!noexcept(swap(std::declval(), std::declval())), ""); @@ -129,11 +131,12 @@ int main() typedef std::map, some_alloc2> C; static_assert( noexcept(swap(std::declval(), std::declval())), ""); } - +#if defined(_LIBCPP_VERSION) { // NOT always equal allocator, nothrow swap for comp typedef std::map, some_alloc3> C; - LIBCPP_STATIC_ASSERT( noexcept(swap(std::declval(), std::declval())), ""); + static_assert( noexcept(swap(std::declval(), std::declval())), ""); } +#endif // _LIBCPP_VERSION #endif } diff --git a/test/std/containers/associative/multimap/incomplete_type.pass.cpp b/test/std/containers/associative/multimap/incomplete_type.pass.cpp index c461eb38139d..306f3d9761f1 100644 --- a/test/std/containers/associative/multimap/incomplete_type.pass.cpp +++ b/test/std/containers/associative/multimap/incomplete_type.pass.cpp @@ -9,7 +9,7 @@ // -// Check that std::multimap and it's iterators can be instantiated with an incomplete +// Check that std::multimap and its iterators can be instantiated with an incomplete // type. #include diff --git a/test/std/containers/associative/multimap/multimap.cons/default_noexcept.pass.cpp b/test/std/containers/associative/multimap/multimap.cons/default_noexcept.pass.cpp index 6f97a5f3e756..6020334ed26b 100644 --- a/test/std/containers/associative/multimap/multimap.cons/default_noexcept.pass.cpp +++ b/test/std/containers/associative/multimap/multimap.cons/default_noexcept.pass.cpp @@ -37,14 +37,16 @@ struct some_comp int main() { typedef std::pair V; +#if defined(_LIBCPP_VERSION) { typedef std::multimap C; - LIBCPP_STATIC_ASSERT(std::is_nothrow_default_constructible::value, ""); + static_assert(std::is_nothrow_default_constructible::value, ""); } { typedef std::multimap, test_allocator> C; - LIBCPP_STATIC_ASSERT(std::is_nothrow_default_constructible::value, ""); + static_assert(std::is_nothrow_default_constructible::value, ""); } +#endif // _LIBCPP_VERSION { typedef std::multimap, other_allocator> C; static_assert(!std::is_nothrow_default_constructible::value, ""); diff --git a/test/std/containers/associative/multimap/multimap.cons/dtor_noexcept.pass.cpp b/test/std/containers/associative/multimap/multimap.cons/dtor_noexcept.pass.cpp index 669d23db57cd..2486e8f243cf 100644 --- a/test/std/containers/associative/multimap/multimap.cons/dtor_noexcept.pass.cpp +++ b/test/std/containers/associative/multimap/multimap.cons/dtor_noexcept.pass.cpp @@ -43,8 +43,10 @@ int main() typedef std::multimap, other_allocator> C; static_assert(std::is_nothrow_destructible::value, ""); } +#if defined(_LIBCPP_VERSION) { typedef std::multimap> C; - LIBCPP_STATIC_ASSERT(!std::is_nothrow_destructible::value, ""); + static_assert(!std::is_nothrow_destructible::value, ""); } +#endif // _LIBCPP_VERSION } diff --git a/test/std/containers/associative/multimap/multimap.cons/move_assign_noexcept.pass.cpp b/test/std/containers/associative/multimap/multimap.cons/move_assign_noexcept.pass.cpp index 7637885c81e1..549c1210b6f2 100644 --- a/test/std/containers/associative/multimap/multimap.cons/move_assign_noexcept.pass.cpp +++ b/test/std/containers/associative/multimap/multimap.cons/move_assign_noexcept.pass.cpp @@ -45,10 +45,12 @@ int main() typedef std::multimap, test_allocator> C; static_assert(!std::is_nothrow_move_assignable::value, ""); } +#if defined(_LIBCPP_VERSION) { typedef std::multimap, other_allocator> C; - LIBCPP_STATIC_ASSERT(std::is_nothrow_move_assignable::value, ""); + static_assert(std::is_nothrow_move_assignable::value, ""); } +#endif // _LIBCPP_VERSION { typedef std::multimap> C; static_assert(!std::is_nothrow_move_assignable::value, ""); diff --git a/test/std/containers/associative/multimap/multimap.cons/move_noexcept.pass.cpp b/test/std/containers/associative/multimap/multimap.cons/move_noexcept.pass.cpp index e42251527eb3..fdcdffbedb4b 100644 --- a/test/std/containers/associative/multimap/multimap.cons/move_noexcept.pass.cpp +++ b/test/std/containers/associative/multimap/multimap.cons/move_noexcept.pass.cpp @@ -34,19 +34,21 @@ struct some_comp int main() { +#if defined(_LIBCPP_VERSION) typedef std::pair V; { typedef std::multimap C; - LIBCPP_STATIC_ASSERT(std::is_nothrow_move_constructible::value, ""); + static_assert(std::is_nothrow_move_constructible::value, ""); } { typedef std::multimap, test_allocator> C; - LIBCPP_STATIC_ASSERT(std::is_nothrow_move_constructible::value, ""); + static_assert(std::is_nothrow_move_constructible::value, ""); } { typedef std::multimap, other_allocator> C; - LIBCPP_STATIC_ASSERT(std::is_nothrow_move_constructible::value, ""); + static_assert(std::is_nothrow_move_constructible::value, ""); } +#endif // _LIBCPP_VERSION { typedef std::multimap> C; static_assert(!std::is_nothrow_move_constructible::value, ""); 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 df46d376e028..9e67f97f9ac0 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 f5295e52d192..474b7b6ac59c 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 8a650fa55975..28ff332542b4 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 05760dc0e751..4f4b3884f28e 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/multimap/multimap.special/swap_noexcept.pass.cpp b/test/std/containers/associative/multimap/multimap.special/swap_noexcept.pass.cpp index ecc9c7ef5fd4..8148ea5b27ed 100644 --- a/test/std/containers/associative/multimap/multimap.special/swap_noexcept.pass.cpp +++ b/test/std/containers/associative/multimap/multimap.special/swap_noexcept.pass.cpp @@ -99,14 +99,16 @@ int main() typedef std::multimap C; static_assert(noexcept(swap(std::declval(), std::declval())), ""); } +#if defined(_LIBCPP_VERSION) { typedef std::multimap, test_allocator> C; - LIBCPP_STATIC_ASSERT(noexcept(swap(std::declval(), std::declval())), ""); + static_assert(noexcept(swap(std::declval(), std::declval())), ""); } { typedef std::multimap, other_allocator> C; - LIBCPP_STATIC_ASSERT(noexcept(swap(std::declval(), std::declval())), ""); + static_assert(noexcept(swap(std::declval(), std::declval())), ""); } +#endif // _LIBCPP_VERSION { typedef std::multimap> C; static_assert(!noexcept(swap(std::declval(), std::declval())), ""); @@ -129,10 +131,11 @@ int main() typedef std::multimap, some_alloc2> C; static_assert( noexcept(swap(std::declval(), std::declval())), ""); } - +#if defined(_LIBCPP_VERSION) { // NOT always equal allocator, nothrow swap for comp typedef std::multimap, some_alloc3> C; - LIBCPP_STATIC_ASSERT( noexcept(swap(std::declval(), std::declval())), ""); + static_assert( noexcept(swap(std::declval(), std::declval())), ""); } +#endif // _LIBCPP_VERSION #endif } diff --git a/test/std/containers/associative/multiset/incomplete_type.pass.cpp b/test/std/containers/associative/multiset/incomplete_type.pass.cpp index 0355e18f9f29..aecd77a18367 100644 --- a/test/std/containers/associative/multiset/incomplete_type.pass.cpp +++ b/test/std/containers/associative/multiset/incomplete_type.pass.cpp @@ -9,7 +9,7 @@ // -// Check that std::multiset and it's iterators can be instantiated with an incomplete +// Check that std::multiset and its iterators can be instantiated with an incomplete // type. #include diff --git a/test/std/containers/associative/multiset/multiset.cons/default_noexcept.pass.cpp b/test/std/containers/associative/multiset/multiset.cons/default_noexcept.pass.cpp index 15520e7834ff..3156003232db 100644 --- a/test/std/containers/associative/multiset/multiset.cons/default_noexcept.pass.cpp +++ b/test/std/containers/associative/multiset/multiset.cons/default_noexcept.pass.cpp @@ -36,14 +36,16 @@ struct some_comp int main() { +#if defined(_LIBCPP_VERSION) { typedef std::multiset C; - LIBCPP_STATIC_ASSERT(std::is_nothrow_default_constructible::value, ""); + static_assert(std::is_nothrow_default_constructible::value, ""); } { typedef std::multiset, test_allocator> C; - LIBCPP_STATIC_ASSERT(std::is_nothrow_default_constructible::value, ""); + static_assert(std::is_nothrow_default_constructible::value, ""); } +#endif // _LIBCPP_VERSION { typedef std::multiset, other_allocator> C; static_assert(!std::is_nothrow_default_constructible::value, ""); diff --git a/test/std/containers/associative/multiset/multiset.cons/dtor_noexcept.pass.cpp b/test/std/containers/associative/multiset/multiset.cons/dtor_noexcept.pass.cpp index b4b9d067704b..096696fcd94c 100644 --- a/test/std/containers/associative/multiset/multiset.cons/dtor_noexcept.pass.cpp +++ b/test/std/containers/associative/multiset/multiset.cons/dtor_noexcept.pass.cpp @@ -42,8 +42,10 @@ int main() typedef std::multiset, other_allocator> C; static_assert(std::is_nothrow_destructible::value, ""); } +#if defined(_LIBCPP_VERSION) { typedef std::multiset> C; - LIBCPP_STATIC_ASSERT(!std::is_nothrow_destructible::value, ""); + static_assert(!std::is_nothrow_destructible::value, ""); } +#endif // _LIBCPP_VERSION } diff --git a/test/std/containers/associative/multiset/multiset.cons/move_assign_noexcept.pass.cpp b/test/std/containers/associative/multiset/multiset.cons/move_assign_noexcept.pass.cpp index bae97cf4e48a..18d64bc5f2c8 100644 --- a/test/std/containers/associative/multiset/multiset.cons/move_assign_noexcept.pass.cpp +++ b/test/std/containers/associative/multiset/multiset.cons/move_assign_noexcept.pass.cpp @@ -44,10 +44,12 @@ int main() typedef std::multiset, test_allocator> C; static_assert(!std::is_nothrow_move_assignable::value, ""); } +#if defined(_LIBCPP_VERSION) { typedef std::multiset, other_allocator> C; - LIBCPP_STATIC_ASSERT(std::is_nothrow_move_assignable::value, ""); + static_assert(std::is_nothrow_move_assignable::value, ""); } +#endif // _LIBCPP_VERSION { typedef std::multiset> C; static_assert(!std::is_nothrow_move_assignable::value, ""); diff --git a/test/std/containers/associative/multiset/multiset.cons/move_noexcept.pass.cpp b/test/std/containers/associative/multiset/multiset.cons/move_noexcept.pass.cpp index 69759e03a28a..eab1787ec881 100644 --- a/test/std/containers/associative/multiset/multiset.cons/move_noexcept.pass.cpp +++ b/test/std/containers/associative/multiset/multiset.cons/move_noexcept.pass.cpp @@ -34,18 +34,20 @@ struct some_comp int main() { +#if defined(_LIBCPP_VERSION) { typedef std::multiset C; - LIBCPP_STATIC_ASSERT(std::is_nothrow_move_constructible::value, ""); + static_assert(std::is_nothrow_move_constructible::value, ""); } { typedef std::multiset, test_allocator> C; - LIBCPP_STATIC_ASSERT(std::is_nothrow_move_constructible::value, ""); + static_assert(std::is_nothrow_move_constructible::value, ""); } { typedef std::multiset, other_allocator> C; - LIBCPP_STATIC_ASSERT(std::is_nothrow_move_constructible::value, ""); + static_assert(std::is_nothrow_move_constructible::value, ""); } +#endif // _LIBCPP_VERSION { typedef std::multiset> C; static_assert(!std::is_nothrow_move_constructible::value, ""); diff --git a/test/std/containers/associative/multiset/multiset.special/swap_noexcept.pass.cpp b/test/std/containers/associative/multiset/multiset.special/swap_noexcept.pass.cpp index 89fabef0a3a0..9693ffb15903 100644 --- a/test/std/containers/associative/multiset/multiset.special/swap_noexcept.pass.cpp +++ b/test/std/containers/associative/multiset/multiset.special/swap_noexcept.pass.cpp @@ -98,14 +98,16 @@ int main() typedef std::multiset C; static_assert(noexcept(swap(std::declval(), std::declval())), ""); } +#if defined(_LIBCPP_VERSION) { typedef std::multiset, test_allocator> C; - LIBCPP_STATIC_ASSERT(noexcept(swap(std::declval(), std::declval())), ""); + static_assert(noexcept(swap(std::declval(), std::declval())), ""); } { typedef std::multiset, other_allocator> C; - LIBCPP_STATIC_ASSERT(noexcept(swap(std::declval(), std::declval())), ""); + static_assert(noexcept(swap(std::declval(), std::declval())), ""); } +#endif // _LIBCPP_VERSION { typedef std::multiset> C; static_assert(!noexcept(swap(std::declval(), std::declval())), ""); @@ -128,10 +130,11 @@ int main() typedef std::multiset, some_alloc2> C; static_assert( noexcept(swap(std::declval(), std::declval())), ""); } - +#if defined(_LIBCPP_VERSION) { // NOT always equal allocator, nothrow swap for comp typedef std::multiset, some_alloc3> C; - LIBCPP_STATIC_ASSERT( noexcept(swap(std::declval(), std::declval())), ""); + static_assert( noexcept(swap(std::declval(), std::declval())), ""); } +#endif // _LIBCPP_VERSION #endif } diff --git a/test/std/containers/associative/set/incomplete_type.pass.cpp b/test/std/containers/associative/set/incomplete_type.pass.cpp index d3a1d6638d7e..a200223051c8 100644 --- a/test/std/containers/associative/set/incomplete_type.pass.cpp +++ b/test/std/containers/associative/set/incomplete_type.pass.cpp @@ -9,7 +9,7 @@ // -// Check that std::set and it's iterators can be instantiated with an incomplete +// Check that std::set and its iterators can be instantiated with an incomplete // type. #include diff --git a/test/std/containers/associative/set/set.cons/default_noexcept.pass.cpp b/test/std/containers/associative/set/set.cons/default_noexcept.pass.cpp index 6293c24a43d3..d32cc3f48fef 100644 --- a/test/std/containers/associative/set/set.cons/default_noexcept.pass.cpp +++ b/test/std/containers/associative/set/set.cons/default_noexcept.pass.cpp @@ -36,14 +36,16 @@ struct some_comp int main() { +#if defined(_LIBCPP_VERSION) { typedef std::set C; - LIBCPP_STATIC_ASSERT(std::is_nothrow_default_constructible::value, ""); + static_assert(std::is_nothrow_default_constructible::value, ""); } { typedef std::set, test_allocator> C; - LIBCPP_STATIC_ASSERT(std::is_nothrow_default_constructible::value, ""); + static_assert(std::is_nothrow_default_constructible::value, ""); } +#endif // _LIBCPP_VERSION { typedef std::set, other_allocator> C; static_assert(!std::is_nothrow_default_constructible::value, ""); diff --git a/test/std/containers/associative/set/set.cons/dtor_noexcept.pass.cpp b/test/std/containers/associative/set/set.cons/dtor_noexcept.pass.cpp index 041f599c1f76..c91038e39040 100644 --- a/test/std/containers/associative/set/set.cons/dtor_noexcept.pass.cpp +++ b/test/std/containers/associative/set/set.cons/dtor_noexcept.pass.cpp @@ -42,8 +42,10 @@ int main() typedef std::set, other_allocator> C; static_assert(std::is_nothrow_destructible::value, ""); } +#if defined(_LIBCPP_VERSION) { typedef std::set> C; - LIBCPP_STATIC_ASSERT(!std::is_nothrow_destructible::value, ""); + static_assert(!std::is_nothrow_destructible::value, ""); } +#endif // _LIBCPP_VERSION } diff --git a/test/std/containers/associative/set/set.cons/move_assign_noexcept.pass.cpp b/test/std/containers/associative/set/set.cons/move_assign_noexcept.pass.cpp index ce44b69fe336..c07d4e6f9b88 100644 --- a/test/std/containers/associative/set/set.cons/move_assign_noexcept.pass.cpp +++ b/test/std/containers/associative/set/set.cons/move_assign_noexcept.pass.cpp @@ -44,10 +44,12 @@ int main() typedef std::set, test_allocator> C; static_assert(!std::is_nothrow_move_assignable::value, ""); } +#if defined(_LIBCPP_VERSION) { typedef std::set, other_allocator> C; - LIBCPP_STATIC_ASSERT(std::is_nothrow_move_assignable::value, ""); + static_assert(std::is_nothrow_move_assignable::value, ""); } +#endif // _LIBCPP_VERSION { typedef std::set> C; static_assert(!std::is_nothrow_move_assignable::value, ""); diff --git a/test/std/containers/associative/set/set.cons/move_noexcept.pass.cpp b/test/std/containers/associative/set/set.cons/move_noexcept.pass.cpp index 9a7538ca31bd..901fdbdb321c 100644 --- a/test/std/containers/associative/set/set.cons/move_noexcept.pass.cpp +++ b/test/std/containers/associative/set/set.cons/move_noexcept.pass.cpp @@ -34,18 +34,20 @@ struct some_comp int main() { +#if defined(_LIBCPP_VERSION) { typedef std::set C; - LIBCPP_STATIC_ASSERT(std::is_nothrow_move_constructible::value, ""); + static_assert(std::is_nothrow_move_constructible::value, ""); } { typedef std::set, test_allocator> C; - LIBCPP_STATIC_ASSERT(std::is_nothrow_move_constructible::value, ""); + static_assert(std::is_nothrow_move_constructible::value, ""); } { typedef std::set, other_allocator> C; - LIBCPP_STATIC_ASSERT(std::is_nothrow_move_constructible::value, ""); + static_assert(std::is_nothrow_move_constructible::value, ""); } +#endif // _LIBCPP_VERSION { typedef std::set> C; static_assert(!std::is_nothrow_move_constructible::value, ""); diff --git a/test/std/containers/associative/set/set.special/swap_noexcept.pass.cpp b/test/std/containers/associative/set/set.special/swap_noexcept.pass.cpp index b3edd31f749b..38b0ab8151aa 100644 --- a/test/std/containers/associative/set/set.special/swap_noexcept.pass.cpp +++ b/test/std/containers/associative/set/set.special/swap_noexcept.pass.cpp @@ -98,14 +98,16 @@ int main() typedef std::set C; static_assert(noexcept(swap(std::declval(), std::declval())), ""); } +#if defined(_LIBCPP_VERSION) { typedef std::set, test_allocator> C; - LIBCPP_STATIC_ASSERT(noexcept(swap(std::declval(), std::declval())), ""); + static_assert(noexcept(swap(std::declval(), std::declval())), ""); } { typedef std::set, other_allocator> C; - LIBCPP_STATIC_ASSERT(noexcept(swap(std::declval(), std::declval())), ""); + static_assert(noexcept(swap(std::declval(), std::declval())), ""); } +#endif // _LIBCPP_VERSION { typedef std::set> C; static_assert(!noexcept(swap(std::declval(), std::declval())), ""); @@ -128,11 +130,12 @@ int main() typedef std::set, some_alloc2> C; static_assert( noexcept(swap(std::declval(), std::declval())), ""); } - +#if defined(_LIBCPP_VERSION) { // NOT always equal allocator, nothrow swap for comp typedef std::set, some_alloc3> C; - LIBCPP_STATIC_ASSERT( noexcept(swap(std::declval(), std::declval())), ""); + static_assert( noexcept(swap(std::declval(), std::declval())), ""); } +#endif // _LIBCPP_VERSION #endif } 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 c79feb93eb6c..5dec2b910fb7 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 @@ -25,8 +25,10 @@ int main() { +#if defined(_LIBCPP_VERSION) { typedef std::priority_queue C; - LIBCPP_STATIC_ASSERT(std::is_nothrow_default_constructible::value, ""); + static_assert(std::is_nothrow_default_constructible::value, ""); } +#endif // _LIBCPP_VERSION } 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 43045893fe07..781d74016128 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 @@ -24,8 +24,10 @@ int main() { +#if defined(_LIBCPP_VERSION) { typedef std::queue C; - LIBCPP_STATIC_ASSERT(std::is_nothrow_default_constructible::value, ""); + static_assert(std::is_nothrow_default_constructible::value, ""); } +#endif // _LIBCPP_VERSION } 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 c8becb3ca98a..58c8f9ddfad1 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 @@ -24,8 +24,10 @@ int main() { +#if defined(_LIBCPP_VERSION) { typedef std::queue C; - LIBCPP_STATIC_ASSERT(std::is_nothrow_move_constructible::value, ""); + static_assert(std::is_nothrow_move_constructible::value, ""); } +#endif // _LIBCPP_VERSION } 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 2d1f9437fc45..2e217c545f9c 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 @@ -24,8 +24,10 @@ int main() { +#if defined(_LIBCPP_VERSION) { typedef std::stack C; - LIBCPP_STATIC_ASSERT(std::is_nothrow_default_constructible::value, ""); + static_assert(std::is_nothrow_default_constructible::value, ""); } +#endif // _LIBCPP_VERSION } 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 c34b7e07000e..af6793f465a2 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 @@ -24,8 +24,10 @@ int main() { +#if defined(_LIBCPP_VERSION) { typedef std::stack C; - LIBCPP_STATIC_ASSERT(std::is_nothrow_move_constructible::value, ""); + static_assert(std::is_nothrow_move_constructible::value, ""); } +#endif // _LIBCPP_VERSION } 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 a833fdc04715..2fe5355124ae 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/array/at.pass.cpp b/test/std/containers/sequences/array/at.pass.cpp index 8e7ff6dff702..efec4e403001 100644 --- a/test/std/containers/sequences/array/at.pass.cpp +++ b/test/std/containers/sequences/array/at.pass.cpp @@ -25,7 +25,7 @@ #if TEST_STD_VER > 14 constexpr bool check_idx( size_t idx, double val ) -{ +{ std::array arr = {1, 2, 3.5}; return arr.at(idx) == val; } diff --git a/test/std/containers/sequences/array/front_back.pass.cpp b/test/std/containers/sequences/array/front_back.pass.cpp index 239fda5c99d8..68fc6cdc4543 100644 --- a/test/std/containers/sequences/array/front_back.pass.cpp +++ b/test/std/containers/sequences/array/front_back.pass.cpp @@ -25,13 +25,13 @@ #if TEST_STD_VER > 14 constexpr bool check_front( double val ) -{ +{ std::array arr = {1, 2, 3.5}; return arr.front() == val; } constexpr bool check_back( double val ) -{ +{ std::array arr = {1, 2, 3.5}; return arr.back() == val; } diff --git a/test/std/containers/sequences/array/indexing.pass.cpp b/test/std/containers/sequences/array/indexing.pass.cpp index 6cb7941d92c5..3a5b9ee9727d 100644 --- a/test/std/containers/sequences/array/indexing.pass.cpp +++ b/test/std/containers/sequences/array/indexing.pass.cpp @@ -25,7 +25,7 @@ #if TEST_STD_VER > 14 constexpr bool check_idx( size_t idx, double val ) -{ +{ std::array arr = {1, 2, 3.5}; return arr[idx] == val; } 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 dea6492a515d..fdb751da6aaf 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/default_noexcept.pass.cpp b/test/std/containers/sequences/deque/deque.cons/default_noexcept.pass.cpp index 30cca929da11..e79e6eca3d95 100644 --- a/test/std/containers/sequences/deque/deque.cons/default_noexcept.pass.cpp +++ b/test/std/containers/sequences/deque/deque.cons/default_noexcept.pass.cpp @@ -32,14 +32,16 @@ struct some_alloc int main() { +#if defined(_LIBCPP_VERSION) { typedef std::deque C; - LIBCPP_STATIC_ASSERT(std::is_nothrow_default_constructible::value, ""); + static_assert(std::is_nothrow_default_constructible::value, ""); } { typedef std::deque> C; - LIBCPP_STATIC_ASSERT(std::is_nothrow_default_constructible::value, ""); + static_assert(std::is_nothrow_default_constructible::value, ""); } +#endif // _LIBCPP_VERSION { typedef std::deque> C; static_assert(!std::is_nothrow_default_constructible::value, ""); diff --git a/test/std/containers/sequences/deque/deque.cons/dtor_noexcept.pass.cpp b/test/std/containers/sequences/deque/deque.cons/dtor_noexcept.pass.cpp index 59955157421d..288810089e59 100644 --- a/test/std/containers/sequences/deque/deque.cons/dtor_noexcept.pass.cpp +++ b/test/std/containers/sequences/deque/deque.cons/dtor_noexcept.pass.cpp @@ -42,8 +42,10 @@ int main() typedef std::deque> C; static_assert(std::is_nothrow_destructible::value, ""); } +#if defined(_LIBCPP_VERSION) { typedef std::deque> C; - LIBCPP_STATIC_ASSERT(!std::is_nothrow_destructible::value, ""); + static_assert(!std::is_nothrow_destructible::value, ""); } +#endif // _LIBCPP_VERSION } 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 dbf27053a9f9..dd70cda1845b 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 9be3c63a6b31..2619569e154e 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 68875139da1a..6e935a52bb24 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 4aa0fa6827e7..5a9a77c746fc 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 ed8f1544bc8f..8a65bc2d2e84 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/move_assign_noexcept.pass.cpp b/test/std/containers/sequences/deque/deque.cons/move_assign_noexcept.pass.cpp index 9b813ce342a3..6ea72246fa05 100644 --- a/test/std/containers/sequences/deque/deque.cons/move_assign_noexcept.pass.cpp +++ b/test/std/containers/sequences/deque/deque.cons/move_assign_noexcept.pass.cpp @@ -42,12 +42,14 @@ int main() typedef std::deque> C; static_assert(!std::is_nothrow_move_assignable::value, ""); } +#if defined(_LIBCPP_VERSION) { typedef std::deque> C; - LIBCPP_STATIC_ASSERT(std::is_nothrow_move_assignable::value, ""); + static_assert(std::is_nothrow_move_assignable::value, ""); } { typedef std::deque> C; - LIBCPP_STATIC_ASSERT(!std::is_nothrow_move_assignable::value, ""); + static_assert(!std::is_nothrow_move_assignable::value, ""); } +#endif // _LIBCPP_VERSION } diff --git a/test/std/containers/sequences/deque/deque.cons/move_noexcept.pass.cpp b/test/std/containers/sequences/deque/deque.cons/move_noexcept.pass.cpp index e0669dc70ca9..fdf67d23a12d 100644 --- a/test/std/containers/sequences/deque/deque.cons/move_noexcept.pass.cpp +++ b/test/std/containers/sequences/deque/deque.cons/move_noexcept.pass.cpp @@ -32,18 +32,20 @@ struct some_alloc int main() { +#if defined(_LIBCPP_VERSION) { typedef std::deque C; - LIBCPP_STATIC_ASSERT(std::is_nothrow_move_constructible::value, ""); + static_assert(std::is_nothrow_move_constructible::value, ""); } { typedef std::deque> C; - LIBCPP_STATIC_ASSERT(std::is_nothrow_move_constructible::value, ""); + static_assert(std::is_nothrow_move_constructible::value, ""); } { typedef std::deque> C; - LIBCPP_STATIC_ASSERT(std::is_nothrow_move_constructible::value, ""); + static_assert(std::is_nothrow_move_constructible::value, ""); } +#endif // _LIBCPP_VERSION { typedef std::deque> C; static_assert(!std::is_nothrow_move_constructible::value, ""); 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 597f642db3ce..117e942895ba 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.cons/size.pass.cpp b/test/std/containers/sequences/deque/deque.cons/size.pass.cpp index 64b3d811fdc9..de7894234df3 100644 --- a/test/std/containers/sequences/deque/deque.cons/size.pass.cpp +++ b/test/std/containers/sequences/deque/deque.cons/size.pass.cpp @@ -68,7 +68,6 @@ test3(unsigned n, Allocator const &alloc = Allocator()) { #if TEST_STD_VER > 11 typedef std::deque C; - typedef typename C::const_iterator const_iterator; { C d(n, alloc); assert(d.size() == n); 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 5f7804023c7f..6d33424fe410 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 b5c881064a95..060d83b5e254 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 8e734a639344..df3d2d099c70 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/deque/deque.special/swap_noexcept.pass.cpp b/test/std/containers/sequences/deque/deque.special/swap_noexcept.pass.cpp index c0af762fb277..0db30a031282 100644 --- a/test/std/containers/sequences/deque/deque.special/swap_noexcept.pass.cpp +++ b/test/std/containers/sequences/deque/deque.special/swap_noexcept.pass.cpp @@ -59,14 +59,16 @@ int main() typedef std::deque C; static_assert(noexcept(swap(std::declval(), std::declval())), ""); } +#if defined(_LIBCPP_VERSION) { typedef std::deque> C; - LIBCPP_STATIC_ASSERT(noexcept(swap(std::declval(), std::declval())), ""); + static_assert(noexcept(swap(std::declval(), std::declval())), ""); } { typedef std::deque> C; - LIBCPP_STATIC_ASSERT(noexcept(swap(std::declval(), std::declval())), ""); + static_assert(noexcept(swap(std::declval(), std::declval())), ""); } +#endif // _LIBCPP_VERSION { typedef std::deque> C; #if TEST_STD_VER >= 14 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 d4dda02b8413..69fb6eb4ca4d 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 935284831d07..61118353dfb2 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 3d35916ccacb..84f1eb9963fd 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/default_noexcept.pass.cpp b/test/std/containers/sequences/forwardlist/forwardlist.cons/default_noexcept.pass.cpp index 0ec1f80562a8..57f09d7cefeb 100644 --- a/test/std/containers/sequences/forwardlist/forwardlist.cons/default_noexcept.pass.cpp +++ b/test/std/containers/sequences/forwardlist/forwardlist.cons/default_noexcept.pass.cpp @@ -32,14 +32,16 @@ struct some_alloc int main() { +#if defined(_LIBCPP_VERSION) { typedef std::forward_list C; - LIBCPP_STATIC_ASSERT(std::is_nothrow_default_constructible::value, ""); + static_assert(std::is_nothrow_default_constructible::value, ""); } { typedef std::forward_list> C; - LIBCPP_STATIC_ASSERT(std::is_nothrow_default_constructible::value, ""); + static_assert(std::is_nothrow_default_constructible::value, ""); } +#endif // _LIBCPP_VERSION { typedef std::forward_list> C; static_assert(!std::is_nothrow_default_constructible::value, ""); diff --git a/test/std/containers/sequences/forwardlist/forwardlist.cons/dtor_noexcept.pass.cpp b/test/std/containers/sequences/forwardlist/forwardlist.cons/dtor_noexcept.pass.cpp index f70119e3c2af..4d295d662da1 100644 --- a/test/std/containers/sequences/forwardlist/forwardlist.cons/dtor_noexcept.pass.cpp +++ b/test/std/containers/sequences/forwardlist/forwardlist.cons/dtor_noexcept.pass.cpp @@ -42,8 +42,10 @@ int main() typedef std::forward_list> C; static_assert(std::is_nothrow_destructible::value, ""); } +#if defined(_LIBCPP_VERSION) { typedef std::forward_list> C; - LIBCPP_STATIC_ASSERT(!std::is_nothrow_destructible::value, ""); + static_assert(!std::is_nothrow_destructible::value, ""); } +#endif // _LIBCPP_VERSION } 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 ac73d142a67e..7575c0e81242 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 844be20015dd..cf9cbffa7304 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 a5948b9ef799..92a9e39fc94b 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/move_alloc.pass.cpp b/test/std/containers/sequences/forwardlist/forwardlist.cons/move_alloc.pass.cpp index 6a1afe1334b0..5f5f5d0aef60 100644 --- a/test/std/containers/sequences/forwardlist/forwardlist.cons/move_alloc.pass.cpp +++ b/test/std/containers/sequences/forwardlist/forwardlist.cons/move_alloc.pass.cpp @@ -7,6 +7,8 @@ // //===----------------------------------------------------------------------===// +// UNSUPPORTED: c++98, c++03 + // // forward_list(forward_list&& x, const allocator_type& a); @@ -21,7 +23,6 @@ int main() { -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES { typedef MoveOnly T; typedef test_allocator A; @@ -33,7 +34,7 @@ int main() unsigned n = 0; for (C::const_iterator i = c.begin(), e = c.end(); i != e; ++i, ++n) assert(*i == n); - assert(n == std::end(t) - std::begin(t)); + assert(n == static_cast(std::end(t) - std::begin(t))); assert(c0.empty()); assert(c.get_allocator() == A(10)); } @@ -48,11 +49,10 @@ int main() unsigned n = 0; for (C::const_iterator i = c.begin(), e = c.end(); i != e; ++i, ++n) assert(*i == n); - assert(n == std::end(t) - std::begin(t)); + assert(n == static_cast(std::end(t) - std::begin(t))); assert(!c0.empty()); assert(c.get_allocator() == A(9)); } -#if TEST_STD_VER >= 11 { typedef MoveOnly T; typedef min_allocator A; @@ -64,10 +64,8 @@ int main() unsigned n = 0; for (C::const_iterator i = c.begin(), e = c.end(); i != e; ++i, ++n) assert(*i == n); - assert(n == std::end(t) - std::begin(t)); + assert(n == static_cast(std::end(t) - std::begin(t))); 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/move_assign_noexcept.pass.cpp b/test/std/containers/sequences/forwardlist/forwardlist.cons/move_assign_noexcept.pass.cpp index 5f278e31c0de..d4fe2591898a 100644 --- a/test/std/containers/sequences/forwardlist/forwardlist.cons/move_assign_noexcept.pass.cpp +++ b/test/std/containers/sequences/forwardlist/forwardlist.cons/move_assign_noexcept.pass.cpp @@ -42,12 +42,14 @@ int main() typedef std::forward_list> C; static_assert(!std::is_nothrow_move_assignable::value, ""); } +#if defined(_LIBCPP_VERSION) { typedef std::forward_list> C; - LIBCPP_STATIC_ASSERT(std::is_nothrow_move_assignable::value, ""); + static_assert(std::is_nothrow_move_assignable::value, ""); } { typedef std::forward_list> C; - LIBCPP_STATIC_ASSERT(!std::is_nothrow_move_assignable::value, ""); + static_assert(!std::is_nothrow_move_assignable::value, ""); } +#endif // _LIBCPP_VERSION } diff --git a/test/std/containers/sequences/forwardlist/forwardlist.cons/move_noexcept.pass.cpp b/test/std/containers/sequences/forwardlist/forwardlist.cons/move_noexcept.pass.cpp index 089f6d6807cb..3390c331e00e 100644 --- a/test/std/containers/sequences/forwardlist/forwardlist.cons/move_noexcept.pass.cpp +++ b/test/std/containers/sequences/forwardlist/forwardlist.cons/move_noexcept.pass.cpp @@ -32,18 +32,20 @@ struct some_alloc int main() { +#if defined(_LIBCPP_VERSION) { typedef std::forward_list C; - LIBCPP_STATIC_ASSERT(std::is_nothrow_move_constructible::value, ""); + static_assert(std::is_nothrow_move_constructible::value, ""); } { typedef std::forward_list> C; - LIBCPP_STATIC_ASSERT(std::is_nothrow_move_constructible::value, ""); + static_assert(std::is_nothrow_move_constructible::value, ""); } { typedef std::forward_list> C; - LIBCPP_STATIC_ASSERT(std::is_nothrow_move_constructible::value, ""); + static_assert(std::is_nothrow_move_constructible::value, ""); } +#endif // _LIBCPP_VERSION { typedef std::forward_list> C; static_assert(!std::is_nothrow_move_constructible::value, ""); 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 2d963a1be479..000000000000 --- 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 b536ccf4910e..061dd6da0785 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 dd8ea88c2c1a..8d7c4e9893a2 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 15e1a08b08bf..90ee0d2313ff 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 2e21cc79d269..173ccaa62d9f 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 d831ceb28918..545b0e68a24b 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 dfcd2cf90ebc..7fc2b9d76567 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/forwardlist/forwardlist.ops/sort.pass.cpp b/test/std/containers/sequences/forwardlist/forwardlist.ops/sort.pass.cpp index 65512e317cea..397f209f7226 100644 --- a/test/std/containers/sequences/forwardlist/forwardlist.ops/sort.pass.cpp +++ b/test/std/containers/sequences/forwardlist/forwardlist.ops/sort.pass.cpp @@ -15,10 +15,13 @@ #include #include #include +#include #include #include "min_allocator.h" +std::mt19937 randomness; + template void test(int N) { @@ -27,7 +30,7 @@ void test(int N) V v; for (int i = 0; i < N; ++i) v.push_back(i); - std::random_shuffle(v.begin(), v.end()); + std::shuffle(v.begin(), v.end(), randomness); C c(v.begin(), v.end()); c.sort(); assert(distance(c.begin(), c.end()) == N); diff --git a/test/std/containers/sequences/forwardlist/forwardlist.ops/sort_pred.pass.cpp b/test/std/containers/sequences/forwardlist/forwardlist.ops/sort_pred.pass.cpp index 6e5cce39e67d..ab6ae6bd327b 100644 --- a/test/std/containers/sequences/forwardlist/forwardlist.ops/sort_pred.pass.cpp +++ b/test/std/containers/sequences/forwardlist/forwardlist.ops/sort_pred.pass.cpp @@ -16,10 +16,13 @@ #include #include #include +#include #include #include "min_allocator.h" +std::mt19937 randomness; + template void test(int N) { @@ -28,7 +31,7 @@ void test(int N) V v; for (int i = 0; i < N; ++i) v.push_back(i); - std::random_shuffle(v.begin(), v.end()); + std::shuffle(v.begin(), v.end(), randomness); C c(v.begin(), v.end()); c.sort(std::greater()); assert(distance(c.begin(), c.end()) == N); diff --git a/test/std/containers/sequences/forwardlist/forwardlist.spec/swap_noexcept.pass.cpp b/test/std/containers/sequences/forwardlist/forwardlist.spec/swap_noexcept.pass.cpp index c63194f7ee64..d93c079e15ed 100644 --- a/test/std/containers/sequences/forwardlist/forwardlist.spec/swap_noexcept.pass.cpp +++ b/test/std/containers/sequences/forwardlist/forwardlist.spec/swap_noexcept.pass.cpp @@ -59,14 +59,16 @@ int main() typedef std::forward_list C; static_assert(noexcept(swap(std::declval(), std::declval())), ""); } +#if defined(_LIBCPP_VERSION) { typedef std::forward_list> C; - LIBCPP_STATIC_ASSERT(noexcept(swap(std::declval(), std::declval())), ""); + static_assert(noexcept(swap(std::declval(), std::declval())), ""); } { typedef std::forward_list> C; - LIBCPP_STATIC_ASSERT(noexcept(swap(std::declval(), std::declval())), ""); + static_assert(noexcept(swap(std::declval(), std::declval())), ""); } +#endif // _LIBCPP_VERSION { typedef std::forward_list> C; #if TEST_STD_VER >= 14 diff --git a/test/std/containers/sequences/list/incomplete_type.pass.cpp b/test/std/containers/sequences/list/incomplete_type.pass.cpp index adfb4d45fc81..aff8f0367893 100644 --- a/test/std/containers/sequences/list/incomplete_type.pass.cpp +++ b/test/std/containers/sequences/list/incomplete_type.pass.cpp @@ -9,7 +9,7 @@ // -// Check that std::list and it's iterators can be instantiated with an incomplete +// Check that std::list and its iterators can be instantiated with an incomplete // type. #include 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 9b2c6d68cbe5..4704cf40aafa 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 2f863c6169fc..eec214205178 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/default_noexcept.pass.cpp b/test/std/containers/sequences/list/list.cons/default_noexcept.pass.cpp index 6f76d8c56882..7f3114d6e1c4 100644 --- a/test/std/containers/sequences/list/list.cons/default_noexcept.pass.cpp +++ b/test/std/containers/sequences/list/list.cons/default_noexcept.pass.cpp @@ -32,14 +32,16 @@ struct some_alloc int main() { +#if defined(_LIBCPP_VERSION) { typedef std::list C; - LIBCPP_STATIC_ASSERT(std::is_nothrow_default_constructible::value, ""); + static_assert(std::is_nothrow_default_constructible::value, ""); } { typedef std::list> C; - LIBCPP_STATIC_ASSERT(std::is_nothrow_default_constructible::value, ""); + static_assert(std::is_nothrow_default_constructible::value, ""); } +#endif // _LIBCPP_VERSION { typedef std::list> C; static_assert(!std::is_nothrow_default_constructible::value, ""); diff --git a/test/std/containers/sequences/list/list.cons/dtor_noexcept.pass.cpp b/test/std/containers/sequences/list/list.cons/dtor_noexcept.pass.cpp index 66e40a30d1f1..b5ec50637ab8 100644 --- a/test/std/containers/sequences/list/list.cons/dtor_noexcept.pass.cpp +++ b/test/std/containers/sequences/list/list.cons/dtor_noexcept.pass.cpp @@ -42,8 +42,10 @@ int main() typedef std::list> C; static_assert(std::is_nothrow_destructible::value, ""); } +#if defined(_LIBCPP_VERSION) { typedef std::list> C; - LIBCPP_STATIC_ASSERT(!std::is_nothrow_destructible::value, ""); + static_assert(!std::is_nothrow_destructible::value, ""); } +#endif // _LIBCPP_VERSION } 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 40413203bdfc..8f04e7342fc6 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 6040c648e547..3388e00dfb03 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 9f8a536b33c5..7236f7cc6ac2 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/move_assign_noexcept.pass.cpp b/test/std/containers/sequences/list/list.cons/move_assign_noexcept.pass.cpp index 81f78116af2e..0d3ccfa68c93 100644 --- a/test/std/containers/sequences/list/list.cons/move_assign_noexcept.pass.cpp +++ b/test/std/containers/sequences/list/list.cons/move_assign_noexcept.pass.cpp @@ -42,12 +42,14 @@ int main() typedef std::list> C; static_assert(!std::is_nothrow_move_assignable::value, ""); } +#if defined(_LIBCPP_VERSION) { typedef std::list> C; - LIBCPP_STATIC_ASSERT(std::is_nothrow_move_assignable::value, ""); + static_assert(std::is_nothrow_move_assignable::value, ""); } { typedef std::list> C; - LIBCPP_STATIC_ASSERT(!std::is_nothrow_move_assignable::value, ""); + static_assert(!std::is_nothrow_move_assignable::value, ""); } +#endif // _LIBCPP_VERSION } diff --git a/test/std/containers/sequences/list/list.cons/move_noexcept.pass.cpp b/test/std/containers/sequences/list/list.cons/move_noexcept.pass.cpp index b40cb718a3f1..878dab66f0ad 100644 --- a/test/std/containers/sequences/list/list.cons/move_noexcept.pass.cpp +++ b/test/std/containers/sequences/list/list.cons/move_noexcept.pass.cpp @@ -32,18 +32,20 @@ struct some_alloc int main() { +#if defined(_LIBCPP_VERSION) { typedef std::list C; - LIBCPP_STATIC_ASSERT(std::is_nothrow_move_constructible::value, ""); + static_assert(std::is_nothrow_move_constructible::value, ""); } { typedef std::list> C; - LIBCPP_STATIC_ASSERT(std::is_nothrow_move_constructible::value, ""); + static_assert(std::is_nothrow_move_constructible::value, ""); } { typedef std::list> C; - LIBCPP_STATIC_ASSERT(std::is_nothrow_move_constructible::value, ""); + static_assert(std::is_nothrow_move_constructible::value, ""); } +#endif // _LIBCPP_VERSION { typedef std::list> C; static_assert(!std::is_nothrow_move_constructible::value, ""); 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 1097bdab2198..b638e219d9c8 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.cons/size_type.pass.cpp b/test/std/containers/sequences/list/list.cons/size_type.pass.cpp index 95cdeb0c8539..cbe790c0f3bc 100644 --- a/test/std/containers/sequences/list/list.cons/size_type.pass.cpp +++ b/test/std/containers/sequences/list/list.cons/size_type.pass.cpp @@ -25,7 +25,6 @@ test3(unsigned n, Allocator const &alloc = Allocator()) { #if TEST_STD_VER > 11 typedef std::list C; - typedef typename C::const_iterator const_iterator; { C d(n, alloc); assert(d.size() == n); 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 91845e564b02..2d5231e78209 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 10acede511f4..3d9d00abe52f 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 5321ee0faed3..6fef6ade9c79 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/list/list.special/swap_noexcept.pass.cpp b/test/std/containers/sequences/list/list.special/swap_noexcept.pass.cpp index 512635359c5d..cfe1bfd2f411 100644 --- a/test/std/containers/sequences/list/list.special/swap_noexcept.pass.cpp +++ b/test/std/containers/sequences/list/list.special/swap_noexcept.pass.cpp @@ -59,14 +59,16 @@ int main() typedef std::list C; static_assert(noexcept(swap(std::declval(), std::declval())), ""); } +#if defined(_LIBCPP_VERSION) { typedef std::list> C; - LIBCPP_STATIC_ASSERT(noexcept(swap(std::declval(), std::declval())), ""); + static_assert(noexcept(swap(std::declval(), std::declval())), ""); } { typedef std::list> C; - LIBCPP_STATIC_ASSERT(noexcept(swap(std::declval(), std::declval())), ""); + static_assert(noexcept(swap(std::declval(), std::declval())), ""); } +#endif // _LIBCPP_VERSION { typedef std::list> C; #if TEST_STD_VER >= 14 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 ac7a2ce38adf..60146a88b3b5 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 f07c1d90059d..13cd65f33123 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/default_noexcept.pass.cpp b/test/std/containers/sequences/vector.bool/default_noexcept.pass.cpp index 4f860dabac95..4e71df37421e 100644 --- a/test/std/containers/sequences/vector.bool/default_noexcept.pass.cpp +++ b/test/std/containers/sequences/vector.bool/default_noexcept.pass.cpp @@ -31,14 +31,16 @@ struct some_alloc int main() { +#if defined(_LIBCPP_VERSION) { typedef std::vector C; - LIBCPP_STATIC_ASSERT(std::is_nothrow_default_constructible::value, ""); + static_assert(std::is_nothrow_default_constructible::value, ""); } { typedef std::vector> C; - LIBCPP_STATIC_ASSERT(std::is_nothrow_default_constructible::value, ""); + static_assert(std::is_nothrow_default_constructible::value, ""); } +#endif // _LIBCPP_VERSION { typedef std::vector> C; static_assert(!std::is_nothrow_default_constructible::value, ""); diff --git a/test/std/containers/sequences/vector.bool/dtor_noexcept.pass.cpp b/test/std/containers/sequences/vector.bool/dtor_noexcept.pass.cpp index b8ff33c5d2e8..5f1f5d10485d 100644 --- a/test/std/containers/sequences/vector.bool/dtor_noexcept.pass.cpp +++ b/test/std/containers/sequences/vector.bool/dtor_noexcept.pass.cpp @@ -41,8 +41,10 @@ int main() typedef std::vector> C; static_assert(std::is_nothrow_destructible::value, ""); } +#if defined(_LIBCPP_VERSION) { typedef std::vector> C; - LIBCPP_STATIC_ASSERT(!std::is_nothrow_destructible::value, ""); + static_assert(!std::is_nothrow_destructible::value, ""); } +#endif // _LIBCPP_VERSION } diff --git a/test/std/containers/sequences/vector.bool/emplace.pass.cpp b/test/std/containers/sequences/vector.bool/emplace.pass.cpp index ccdce913c73c..8a1ed033488a 100644 --- a/test/std/containers/sequences/vector.bool/emplace.pass.cpp +++ b/test/std/containers/sequences/vector.bool/emplace.pass.cpp @@ -34,7 +34,7 @@ int main() assert(c.front() == false); assert(c.back() == true); - i = c.emplace(c.cbegin()+1, 1 == 1); + i = c.emplace(c.cbegin()+1, true); assert(i == c.begin()+1); assert(c.size() == 3); assert(c.front() == false); @@ -56,7 +56,7 @@ int main() assert(c.front() == false); assert(c.back() == true); - i = c.emplace(c.cbegin()+1, 1 == 1); + i = c.emplace(c.cbegin()+1, true); assert(i == c.begin()+1); assert(c.size() == 3); assert(c.size() == 3); diff --git a/test/std/containers/sequences/vector.bool/enabled_hash.pass.cpp b/test/std/containers/sequences/vector.bool/enabled_hash.pass.cpp new file mode 100644 index 000000000000..f8a8dbd8d6d4 --- /dev/null +++ b/test/std/containers/sequences/vector.bool/enabled_hash.pass.cpp @@ -0,0 +1,28 @@ +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// UNSUPPORTED: c++98, c++03 + +// + +// Test that provides all of the arithmetic, enum, and pointer +// hash specializations. + +#include + +#include "poisoned_hash_helper.hpp" +#include "min_allocator.h" + +int main() { + test_library_hash_specializations_available(); + { + test_hash_enabled_for_type >(); + test_hash_enabled_for_type>>(); + } +} diff --git a/test/std/containers/sequences/vector.bool/find.pass.cpp b/test/std/containers/sequences/vector.bool/find.pass.cpp index ffe844e0079c..d5c3f458c634 100644 --- a/test/std/containers/sequences/vector.bool/find.pass.cpp +++ b/test/std/containers/sequences/vector.bool/find.pass.cpp @@ -12,7 +12,7 @@ // std::find with vector::iterator -// http://llvm.org/bugs/show_bug.cgi?id=16816 +// https://bugs.llvm.org/show_bug.cgi?id=16816 #include #include 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 07bae0eb7089..a850fa2f1cdd 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 5f7f5144f841..9a2df4290e77 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 3a176d94e860..df4cb199b8fd 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 f3a11ec562c0..f189e2b97092 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 7aaa7c55550b..b3b6f964966b 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/move_assign_noexcept.pass.cpp b/test/std/containers/sequences/vector.bool/move_assign_noexcept.pass.cpp index dd4bf9e01ea9..556b6e656439 100644 --- a/test/std/containers/sequences/vector.bool/move_assign_noexcept.pass.cpp +++ b/test/std/containers/sequences/vector.bool/move_assign_noexcept.pass.cpp @@ -59,31 +59,40 @@ struct some_alloc3 int main() { +#if defined(_LIBCPP_VERSION) { typedef std::vector C; - LIBCPP_STATIC_ASSERT(std::is_nothrow_move_assignable::value, ""); + static_assert(std::is_nothrow_move_assignable::value, ""); } +#endif // _LIBCPP_VERSION { typedef std::vector> C; static_assert(!std::is_nothrow_move_assignable::value, ""); } +#if defined(_LIBCPP_VERSION) { typedef std::vector> C; - LIBCPP_STATIC_ASSERT(std::is_nothrow_move_assignable::value, ""); + static_assert(std::is_nothrow_move_assignable::value, ""); } +#endif // _LIBCPP_VERSION { - typedef std::vector> C; #if TEST_STD_VER > 14 - LIBCPP_STATIC_ASSERT( std::is_nothrow_move_assignable::value, ""); +#if defined(_LIBCPP_VERSION) + typedef std::vector> C; + static_assert( std::is_nothrow_move_assignable::value, ""); +#endif // _LIBCPP_VERSION #else + typedef std::vector> C; static_assert(!std::is_nothrow_move_assignable::value, ""); #endif } #if TEST_STD_VER > 14 +#if defined(_LIBCPP_VERSION) { // POCMA false, is_always_equal true typedef std::vector> C; - LIBCPP_STATIC_ASSERT( std::is_nothrow_move_assignable::value, ""); + static_assert( std::is_nothrow_move_assignable::value, ""); } +#endif // _LIBCPP_VERSION { // POCMA false, is_always_equal false typedef std::vector> C; static_assert(!std::is_nothrow_move_assignable::value, ""); diff --git a/test/std/containers/sequences/vector.bool/move_noexcept.pass.cpp b/test/std/containers/sequences/vector.bool/move_noexcept.pass.cpp index 3305d95e1ab8..f104eb32e5f4 100644 --- a/test/std/containers/sequences/vector.bool/move_noexcept.pass.cpp +++ b/test/std/containers/sequences/vector.bool/move_noexcept.pass.cpp @@ -31,24 +31,29 @@ struct some_alloc int main() { +#if defined(_LIBCPP_VERSION) { typedef std::vector C; - LIBCPP_STATIC_ASSERT(std::is_nothrow_move_constructible::value, ""); + static_assert(std::is_nothrow_move_constructible::value, ""); } { typedef std::vector> C; - LIBCPP_STATIC_ASSERT(std::is_nothrow_move_constructible::value, ""); + static_assert(std::is_nothrow_move_constructible::value, ""); } { typedef std::vector> C; - LIBCPP_STATIC_ASSERT(std::is_nothrow_move_constructible::value, ""); + static_assert(std::is_nothrow_move_constructible::value, ""); } +#endif // _LIBCPP_VERSION { - typedef std::vector> C; // In C++17, move constructors for allocators are not allowed to throw #if TEST_STD_VER > 14 - LIBCPP_STATIC_ASSERT( std::is_nothrow_move_constructible::value, ""); +#if defined(_LIBCPP_VERSION) + typedef std::vector> C; + static_assert( std::is_nothrow_move_constructible::value, ""); +#endif // _LIBCPP_VERSION #else + typedef std::vector> C; static_assert(!std::is_nothrow_move_constructible::value, ""); #endif } 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 4b959cf00ad3..61874338d655 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/swap_noexcept.pass.cpp b/test/std/containers/sequences/vector.bool/swap_noexcept.pass.cpp index 1b68eda2757b..d888af05f92f 100644 --- a/test/std/containers/sequences/vector.bool/swap_noexcept.pass.cpp +++ b/test/std/containers/sequences/vector.bool/swap_noexcept.pass.cpp @@ -55,32 +55,39 @@ struct some_alloc2 int main() { +#if defined(_LIBCPP_VERSION) { typedef std::vector C; - LIBCPP_STATIC_ASSERT(noexcept(swap(std::declval(), std::declval())), ""); + static_assert(noexcept(swap(std::declval(), std::declval())), ""); } { typedef std::vector> C; - LIBCPP_STATIC_ASSERT(noexcept(swap(std::declval(), std::declval())), ""); + static_assert(noexcept(swap(std::declval(), std::declval())), ""); } { typedef std::vector> C; - LIBCPP_STATIC_ASSERT(noexcept(swap(std::declval(), std::declval())), ""); + static_assert(noexcept(swap(std::declval(), std::declval())), ""); } +#endif // _LIBCPP_VERSION { - typedef std::vector> C; #if TEST_STD_VER >= 14 +#if defined(_LIBCPP_VERSION) // In c++14, if POCS is set, swapping the allocator is required not to throw - LIBCPP_STATIC_ASSERT( noexcept(swap(std::declval(), std::declval())), ""); + typedef std::vector> C; + static_assert( noexcept(swap(std::declval(), std::declval())), ""); +#endif // _LIBCPP_VERSION #else + typedef std::vector> C; static_assert(!noexcept(swap(std::declval(), std::declval())), ""); #endif } #if TEST_STD_VER >= 14 +#if defined(_LIBCPP_VERSION) { typedef std::vector> C; // if the allocators are always equal, then the swap can be noexcept - LIBCPP_STATIC_ASSERT( noexcept(swap(std::declval(), std::declval())), ""); + static_assert( noexcept(swap(std::declval(), std::declval())), ""); } +#endif // _LIBCPP_VERSION #endif } 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 4f82792fa1fd..64104a40ec74 100644 --- a/test/std/containers/sequences/vector.bool/vector_bool.pass.cpp +++ b/test/std/containers/sequences/vector.bool/vector_bool.pass.cpp @@ -31,7 +31,8 @@ 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; @@ -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 6409acaf65c1..273bdad9acdb 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,9 +22,8 @@ int main() { -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES { - std::vector v(100); + std::vector v(100); v.resize(50); assert(v.size() == 50); assert(v.capacity() == 100); @@ -34,7 +35,7 @@ int main() } { // Add 1 for implementations that dynamically allocate a container proxy. - std::vector > v(100); + std::vector > v(100); v.resize(50); assert(v.size() == 50); assert(v.capacity() == 100); @@ -44,9 +45,9 @@ int main() assert(v.capacity() >= 200); assert(is_contiguous_container_asan_correct(v)); } -#else // _LIBCPP_HAS_NO_RVALUE_REFERENCES +#if TEST_STD_VER >= 11 { - std::vector v(100); + std::vector v(100); v.resize(50); assert(v.size() == 50); assert(v.capacity() == 100); @@ -58,7 +59,7 @@ int main() } { // Add 1 for implementations that dynamically allocate a container proxy. - std::vector > v(100); + std::vector > v(100); v.resize(50); assert(v.size() == 50); assert(v.capacity() == 100); @@ -68,8 +69,6 @@ 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); 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 222fa9c78f92..853f75583ddc 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 acbee97bcd1c..c2b6b83784f2 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/dtor_noexcept.pass.cpp b/test/std/containers/sequences/vector/vector.cons/dtor_noexcept.pass.cpp index 10a381f9c8cc..1720866940ed 100644 --- a/test/std/containers/sequences/vector/vector.cons/dtor_noexcept.pass.cpp +++ b/test/std/containers/sequences/vector/vector.cons/dtor_noexcept.pass.cpp @@ -42,8 +42,10 @@ int main() typedef std::vector> C; static_assert(std::is_nothrow_destructible::value, ""); } +#if defined(_LIBCPP_VERSION) { typedef std::vector> C; - LIBCPP_STATIC_ASSERT(!std::is_nothrow_destructible::value, ""); + static_assert(!std::is_nothrow_destructible::value, ""); } +#endif // _LIBCPP_VERSION } 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 408bcc3b1499..edbad8c0d95b 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 f4c3b5c1e8e0..ac5d0178e73a 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 d51b364f3ba0..cd50d5432349 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 fcdd35ae1157..767a0ce3dce9 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 4e5a20413683..21dd5c384b58 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 000000000000..5f053eb8565a --- /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 7e4aed8c1b5e..e5e0277fa37a 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/insert_iter_initializer_list.pass.cpp b/test/std/containers/sequences/vector/vector.modifiers/insert_iter_initializer_list.pass.cpp index b0fe123aac48..9072d427cab7 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 f4a1f5d5f519..ac1fffd9d0d7 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/sequences/vector/vector.special/swap_noexcept.pass.cpp b/test/std/containers/sequences/vector/vector.special/swap_noexcept.pass.cpp index 214f9a577571..f92ab8a5c300 100644 --- a/test/std/containers/sequences/vector/vector.special/swap_noexcept.pass.cpp +++ b/test/std/containers/sequences/vector/vector.special/swap_noexcept.pass.cpp @@ -60,10 +60,12 @@ int main() typedef std::vector C; static_assert(noexcept(swap(std::declval(), std::declval())), ""); } +#if defined(_LIBCPP_VERSION) { typedef std::vector> C; - LIBCPP_STATIC_ASSERT(noexcept(swap(std::declval(), std::declval())), ""); + static_assert(noexcept(swap(std::declval(), std::declval())), ""); } +#endif // _LIBCPP_VERSION { typedef std::vector> C; static_assert(noexcept(swap(std::declval(), std::declval())), ""); diff --git a/test/std/containers/unord/unord.map/compare.pass.cpp b/test/std/containers/unord/unord.map/compare.pass.cpp index ea6d02f5fcbc..cffc1dbd42c1 100644 --- a/test/std/containers/unord/unord.map/compare.pass.cpp +++ b/test/std/containers/unord/unord.map/compare.pass.cpp @@ -13,8 +13,8 @@ // class Alloc = allocator>> // class unordered_map -// http://llvm.org/bugs/show_bug.cgi?id=16538 -// http://llvm.org/bugs/show_bug.cgi?id=16549 +// https://bugs.llvm.org/show_bug.cgi?id=16538 +// https://bugs.llvm.org/show_bug.cgi?id=16549 #include #include diff --git a/test/std/containers/unord/unord.map/incomplete_type.pass.cpp b/test/std/containers/unord/unord.map/incomplete_type.pass.cpp index d51b1d8d181f..9fc0fd471ef5 100644 --- a/test/std/containers/unord/unord.map/incomplete_type.pass.cpp +++ b/test/std/containers/unord/unord.map/incomplete_type.pass.cpp @@ -10,7 +10,7 @@ // -// Check that std::unordered_map and it's iterators can be instantiated with an incomplete +// Check that std::unordered_map and its iterators can be instantiated with an incomplete // type. #include diff --git a/test/std/containers/unord/unord.map/unord.map.cnstr/default_noexcept.pass.cpp b/test/std/containers/unord/unord.map/unord.map.cnstr/default_noexcept.pass.cpp index 939e0bcd4e69..7ef7f47ff865 100644 --- a/test/std/containers/unord/unord.map/unord.map.cnstr/default_noexcept.pass.cpp +++ b/test/std/containers/unord/unord.map/unord.map.cnstr/default_noexcept.pass.cpp @@ -42,19 +42,23 @@ struct some_hash typedef T value_type; some_hash(); some_hash(const some_hash&); + + std::size_t operator()(T const&) const; }; int main() { +#if defined(_LIBCPP_VERSION) { typedef std::unordered_map C; - LIBCPP_STATIC_ASSERT(std::is_nothrow_default_constructible::value, ""); + static_assert(std::is_nothrow_default_constructible::value, ""); } { typedef std::unordered_map, std::equal_to, test_allocator>> C; - LIBCPP_STATIC_ASSERT(std::is_nothrow_default_constructible::value, ""); + static_assert(std::is_nothrow_default_constructible::value, ""); } +#endif // _LIBCPP_VERSION { typedef std::unordered_map, std::equal_to, other_allocator>> C; diff --git a/test/std/containers/unord/unord.map/unord.map.cnstr/dtor_noexcept.pass.cpp b/test/std/containers/unord/unord.map/unord.map.cnstr/dtor_noexcept.pass.cpp index 4fb10afd4e59..0fe98abe774d 100644 --- a/test/std/containers/unord/unord.map/unord.map.cnstr/dtor_noexcept.pass.cpp +++ b/test/std/containers/unord/unord.map/unord.map.cnstr/dtor_noexcept.pass.cpp @@ -35,6 +35,8 @@ struct some_hash some_hash(); some_hash(const some_hash&); ~some_hash() noexcept(false); + + std::size_t operator()(T const&) const; }; int main() @@ -53,13 +55,15 @@ int main() std::equal_to, other_allocator>> C; static_assert(std::is_nothrow_destructible::value, ""); } +#if defined(_LIBCPP_VERSION) { typedef std::unordered_map> C; - LIBCPP_STATIC_ASSERT(!std::is_nothrow_destructible::value, ""); + static_assert(!std::is_nothrow_destructible::value, ""); } { typedef std::unordered_map, some_comp> C; - LIBCPP_STATIC_ASSERT(!std::is_nothrow_destructible::value, ""); + static_assert(!std::is_nothrow_destructible::value, ""); } +#endif // _LIBCPP_VERSION } diff --git a/test/std/containers/unord/unord.map/unord.map.cnstr/move_assign_noexcept.pass.cpp b/test/std/containers/unord/unord.map/unord.map.cnstr/move_assign_noexcept.pass.cpp index c0dc71da45d8..4191102a85ab 100644 --- a/test/std/containers/unord/unord.map/unord.map.cnstr/move_assign_noexcept.pass.cpp +++ b/test/std/containers/unord/unord.map/unord.map.cnstr/move_assign_noexcept.pass.cpp @@ -41,6 +41,8 @@ struct some_hash some_hash(); some_hash(const some_hash&); some_hash& operator=(const some_hash&); + + std::size_t operator()(T const&) const; }; int main() @@ -54,11 +56,13 @@ int main() std::equal_to, test_allocator>> C; static_assert(!std::is_nothrow_move_assignable::value, ""); } +#if defined(_LIBCPP_VERSION) { typedef std::unordered_map, std::equal_to, other_allocator>> C; - LIBCPP_STATIC_ASSERT(std::is_nothrow_move_assignable::value, ""); + static_assert(std::is_nothrow_move_assignable::value, ""); } +#endif // _LIBCPP_VERSION { typedef std::unordered_map> C; static_assert(!std::is_nothrow_move_assignable::value, ""); diff --git a/test/std/containers/unord/unord.map/unord.map.cnstr/move_noexcept.pass.cpp b/test/std/containers/unord/unord.map/unord.map.cnstr/move_noexcept.pass.cpp index c40173ede750..2eb8c946720f 100644 --- a/test/std/containers/unord/unord.map/unord.map.cnstr/move_noexcept.pass.cpp +++ b/test/std/containers/unord/unord.map/unord.map.cnstr/move_noexcept.pass.cpp @@ -38,24 +38,28 @@ struct some_hash typedef T value_type; some_hash(); some_hash(const some_hash&); + + std::size_t operator()(T const&) const; }; int main() { +#if defined(_LIBCPP_VERSION) { typedef std::unordered_map C; - LIBCPP_STATIC_ASSERT(std::is_nothrow_move_constructible::value, ""); + static_assert(std::is_nothrow_move_constructible::value, ""); } { typedef std::unordered_map, std::equal_to, test_allocator>> C; - LIBCPP_STATIC_ASSERT(std::is_nothrow_move_constructible::value, ""); + static_assert(std::is_nothrow_move_constructible::value, ""); } { typedef std::unordered_map, std::equal_to, other_allocator>> C; - LIBCPP_STATIC_ASSERT(std::is_nothrow_move_constructible::value, ""); + static_assert(std::is_nothrow_move_constructible::value, ""); } +#endif // _LIBCPP_VERSION { typedef std::unordered_map> C; static_assert(!std::is_nothrow_move_constructible::value, ""); diff --git a/test/std/containers/unord/unord.map/unord.map.elem/index_tuple.pass.cpp b/test/std/containers/unord/unord.map/unord.map.elem/index_tuple.pass.cpp index f2c694e86f74..400e0283fef2 100644 --- a/test/std/containers/unord/unord.map/unord.map.elem/index_tuple.pass.cpp +++ b/test/std/containers/unord/unord.map/unord.map.elem/index_tuple.pass.cpp @@ -17,7 +17,7 @@ // mapped_type& operator[](const key_type& k); -// http://llvm.org/bugs/show_bug.cgi?id=16542 +// https://bugs.llvm.org/show_bug.cgi?id=16542 #include #include diff --git a/test/std/containers/unord/unord.map/unord.map.swap/swap_noexcept.pass.cpp b/test/std/containers/unord/unord.map/unord.map.swap/swap_noexcept.pass.cpp index fc286ceec8eb..75807fa78889 100644 --- a/test/std/containers/unord/unord.map/unord.map.swap/swap_noexcept.pass.cpp +++ b/test/std/containers/unord/unord.map/unord.map.swap/swap_noexcept.pass.cpp @@ -64,6 +64,7 @@ struct some_hash typedef T value_type; some_hash() {} some_hash(const some_hash&); + std::size_t operator()(T const&) const; }; template @@ -72,6 +73,7 @@ struct some_hash2 typedef T value_type; some_hash2() {} some_hash2(const some_hash2&); + std::size_t operator()(T const&) const; }; #if TEST_STD_VER >= 14 @@ -125,16 +127,18 @@ int main() typedef std::unordered_map C; static_assert(noexcept(swap(std::declval(), std::declval())), ""); } +#if defined(_LIBCPP_VERSION) { typedef std::unordered_map, std::equal_to, test_allocator> C; - LIBCPP_STATIC_ASSERT(noexcept(swap(std::declval(), std::declval())), ""); + static_assert(noexcept(swap(std::declval(), std::declval())), ""); } { typedef std::unordered_map, std::equal_to, other_allocator> C; - LIBCPP_STATIC_ASSERT(noexcept(swap(std::declval(), std::declval())), ""); + static_assert(noexcept(swap(std::declval(), std::declval())), ""); } +#endif // _LIBCPP_VERSION { typedef std::unordered_map> C; static_assert(!noexcept(swap(std::declval(), std::declval())), ""); @@ -178,10 +182,11 @@ int main() typedef std::unordered_map, some_comp2, some_alloc2> C; static_assert( noexcept(swap(std::declval(), std::declval())), ""); } - +#if defined(_LIBCPP_VERSION) { // NOT always equal allocator, nothrow swap for hash, nothrow swap for comp typedef std::unordered_map, some_comp2, some_alloc3> C; - LIBCPP_STATIC_ASSERT( noexcept(swap(std::declval(), std::declval())), ""); + static_assert( noexcept(swap(std::declval(), std::declval())), ""); } +#endif // _LIBCPP_VERSION #endif } diff --git a/test/std/containers/unord/unord.multimap/bucket_count.pass.cpp b/test/std/containers/unord/unord.multimap/bucket_count.pass.cpp index 4eea3d0f6fb5..5cb60f6a6d91 100644 --- a/test/std/containers/unord/unord.multimap/bucket_count.pass.cpp +++ b/test/std/containers/unord/unord.multimap/bucket_count.pass.cpp @@ -25,14 +25,11 @@ int main() { { typedef std::unordered_multimap C; - typedef C::const_iterator I; - typedef std::pair P; const C c; LIBCPP_ASSERT(c.bucket_count() == 0); } { typedef std::unordered_multimap C; - typedef C::const_iterator I; typedef std::pair P; P a[] = { diff --git a/test/std/containers/unord/unord.multimap/incomplete.pass.cpp b/test/std/containers/unord/unord.multimap/incomplete.pass.cpp index 7822224e7366..67bff9419757 100644 --- a/test/std/containers/unord/unord.multimap/incomplete.pass.cpp +++ b/test/std/containers/unord/unord.multimap/incomplete.pass.cpp @@ -10,7 +10,7 @@ // -// Check that std::unordered_multimap and it's iterators can be instantiated with an incomplete +// Check that std::unordered_multimap and its iterators can be instantiated with an incomplete // type. #include diff --git a/test/std/containers/unord/unord.multimap/load_factor.pass.cpp b/test/std/containers/unord/unord.multimap/load_factor.pass.cpp index 9c42435946ff..ff3bc0105bd3 100644 --- a/test/std/containers/unord/unord.multimap/load_factor.pass.cpp +++ b/test/std/containers/unord/unord.multimap/load_factor.pass.cpp @@ -44,7 +44,6 @@ int main() } { typedef std::unordered_multimap C; - typedef std::pair P; const C c; assert(c.load_factor() == 0); } @@ -70,7 +69,6 @@ int main() { typedef std::unordered_multimap, std::equal_to, min_allocator>> C; - typedef std::pair P; const C c; assert(c.load_factor() == 0); } diff --git a/test/std/containers/unord/unord.multimap/max_bucket_count.pass.cpp b/test/std/containers/unord/unord.multimap/max_bucket_count.pass.cpp index a2ab399d3469..3e9a10ab798a 100644 --- a/test/std/containers/unord/unord.multimap/max_bucket_count.pass.cpp +++ b/test/std/containers/unord/unord.multimap/max_bucket_count.pass.cpp @@ -25,8 +25,6 @@ int main() { { typedef std::unordered_multimap C; - typedef C::const_iterator I; - typedef std::pair P; const C c; assert(c.max_bucket_count() > 0); } @@ -34,8 +32,6 @@ int main() { typedef std::unordered_multimap, std::equal_to, min_allocator>> C; - typedef C::const_iterator I; - typedef std::pair P; const C c; assert(c.max_bucket_count() > 0); } diff --git a/test/std/containers/unord/unord.multimap/max_load_factor.pass.cpp b/test/std/containers/unord/unord.multimap/max_load_factor.pass.cpp index b0b2b664f098..38c8285f5236 100644 --- a/test/std/containers/unord/unord.multimap/max_load_factor.pass.cpp +++ b/test/std/containers/unord/unord.multimap/max_load_factor.pass.cpp @@ -30,13 +30,11 @@ int main() { { typedef std::unordered_multimap C; - typedef std::pair P; const C c; assert(c.max_load_factor() == 1); } { typedef std::unordered_multimap C; - typedef std::pair P; C c; assert(c.max_load_factor() == 1); c.max_load_factor(2.5); @@ -46,14 +44,12 @@ int main() { typedef std::unordered_multimap, std::equal_to, min_allocator>> C; - typedef std::pair P; const C c; assert(c.max_load_factor() == 1); } { typedef std::unordered_multimap, std::equal_to, min_allocator>> C; - typedef std::pair P; C c; assert(c.max_load_factor() == 1); c.max_load_factor(2.5); diff --git a/test/std/containers/unord/unord.multimap/swap_member.pass.cpp b/test/std/containers/unord/unord.multimap/swap_member.pass.cpp index 0f898f1b73e0..8c5ddab054e5 100644 --- a/test/std/containers/unord/unord.multimap/swap_member.pass.cpp +++ b/test/std/containers/unord/unord.multimap/swap_member.pass.cpp @@ -34,7 +34,6 @@ int main() typedef test_compare > Compare; typedef test_allocator > Alloc; typedef std::unordered_multimap C; - typedef std::pair P; C c1(0, Hash(1), Compare(1), Alloc(1, 1)); C c2(0, Hash(2), Compare(2), Alloc(1, 2)); c2.max_load_factor(2); @@ -219,7 +218,6 @@ int main() typedef test_compare > Compare; typedef other_allocator > Alloc; typedef std::unordered_multimap C; - typedef std::pair P; C c1(0, Hash(1), Compare(1), Alloc(1)); C c2(0, Hash(2), Compare(2), Alloc(2)); c2.max_load_factor(2); @@ -404,7 +402,6 @@ int main() typedef test_compare > Compare; typedef min_allocator > Alloc; typedef std::unordered_multimap C; - typedef std::pair P; C c1(0, Hash(1), Compare(1), Alloc()); C c2(0, Hash(2), Compare(2), Alloc()); c2.max_load_factor(2); diff --git a/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/default_noexcept.pass.cpp b/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/default_noexcept.pass.cpp index e404612a754e..d924ef15c1a3 100644 --- a/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/default_noexcept.pass.cpp +++ b/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/default_noexcept.pass.cpp @@ -42,19 +42,22 @@ struct some_hash typedef T value_type; some_hash(); some_hash(const some_hash&); + std::size_t operator()(T const&) const; }; int main() { +#if defined(_LIBCPP_VERSION) { typedef std::unordered_multimap C; - LIBCPP_STATIC_ASSERT(std::is_nothrow_default_constructible::value, ""); + static_assert(std::is_nothrow_default_constructible::value, ""); } { typedef std::unordered_multimap, std::equal_to, test_allocator>> C; - LIBCPP_STATIC_ASSERT(std::is_nothrow_default_constructible::value, ""); + static_assert(std::is_nothrow_default_constructible::value, ""); } +#endif // _LIBCPP_VERSION { typedef std::unordered_multimap, std::equal_to, other_allocator>> C; diff --git a/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/dtor_noexcept.pass.cpp b/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/dtor_noexcept.pass.cpp index b5f4403174b8..2fbe7a674273 100644 --- a/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/dtor_noexcept.pass.cpp +++ b/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/dtor_noexcept.pass.cpp @@ -35,6 +35,7 @@ struct some_hash some_hash(); some_hash(const some_hash&); ~some_hash() noexcept(false); + std::size_t operator()(T const&) const; }; int main() @@ -53,13 +54,15 @@ int main() std::equal_to, other_allocator>> C; static_assert(std::is_nothrow_destructible::value, ""); } +#if defined(_LIBCPP_VERSION) { typedef std::unordered_multimap> C; - LIBCPP_STATIC_ASSERT(!std::is_nothrow_destructible::value, ""); + static_assert(!std::is_nothrow_destructible::value, ""); } { typedef std::unordered_multimap, some_comp> C; - LIBCPP_STATIC_ASSERT(!std::is_nothrow_destructible::value, ""); + static_assert(!std::is_nothrow_destructible::value, ""); } +#endif // _LIBCPP_VERSION } diff --git a/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/move_assign_noexcept.pass.cpp b/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/move_assign_noexcept.pass.cpp index b621449f2b74..2d5766946a6f 100644 --- a/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/move_assign_noexcept.pass.cpp +++ b/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/move_assign_noexcept.pass.cpp @@ -41,6 +41,7 @@ struct some_hash some_hash(); some_hash(const some_hash&); some_hash& operator=(const some_hash&); + std::size_t operator()(T const&) const; }; int main() @@ -54,11 +55,13 @@ int main() std::equal_to, test_allocator>> C; static_assert(!std::is_nothrow_move_assignable::value, ""); } +#if defined(_LIBCPP_VERSION) { typedef std::unordered_multimap, std::equal_to, other_allocator>> C; - LIBCPP_STATIC_ASSERT(std::is_nothrow_move_assignable::value, ""); + static_assert(std::is_nothrow_move_assignable::value, ""); } +#endif // _LIBCPP_VERSION { typedef std::unordered_multimap> C; static_assert(!std::is_nothrow_move_assignable::value, ""); diff --git a/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/move_noexcept.pass.cpp b/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/move_noexcept.pass.cpp index 94067c3161e2..7f3a337bddc4 100644 --- a/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/move_noexcept.pass.cpp +++ b/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/move_noexcept.pass.cpp @@ -38,24 +38,27 @@ struct some_hash typedef T value_type; some_hash(); some_hash(const some_hash&); + std::size_t operator()(T const&) const; }; int main() { +#if defined(_LIBCPP_VERSION) { typedef std::unordered_multimap C; - LIBCPP_STATIC_ASSERT(std::is_nothrow_move_constructible::value, ""); + static_assert(std::is_nothrow_move_constructible::value, ""); } { typedef std::unordered_multimap, std::equal_to, test_allocator>> C; - LIBCPP_STATIC_ASSERT(std::is_nothrow_move_constructible::value, ""); + static_assert(std::is_nothrow_move_constructible::value, ""); } { typedef std::unordered_multimap, std::equal_to, other_allocator>> C; - LIBCPP_STATIC_ASSERT(std::is_nothrow_move_constructible::value, ""); + static_assert(std::is_nothrow_move_constructible::value, ""); } +#endif // _LIBCPP_VERSION { typedef std::unordered_multimap> C; static_assert(!std::is_nothrow_move_constructible::value, ""); diff --git a/test/std/containers/unord/unord.multimap/unord.multimap.swap/swap_noexcept.pass.cpp b/test/std/containers/unord/unord.multimap/unord.multimap.swap/swap_noexcept.pass.cpp index 7a58709c9fc9..33d8e3c36361 100644 --- a/test/std/containers/unord/unord.multimap/unord.multimap.swap/swap_noexcept.pass.cpp +++ b/test/std/containers/unord/unord.multimap/unord.multimap.swap/swap_noexcept.pass.cpp @@ -64,6 +64,7 @@ struct some_hash typedef T value_type; some_hash() {} some_hash(const some_hash&); + std::size_t operator()(T const&) const; }; template @@ -72,6 +73,7 @@ struct some_hash2 typedef T value_type; some_hash2() {} some_hash2(const some_hash2&); + std::size_t operator()(T const&) const; }; #if TEST_STD_VER >= 14 @@ -124,16 +126,18 @@ int main() typedef std::unordered_multimap C; static_assert(noexcept(swap(std::declval(), std::declval())), ""); } +#if defined(_LIBCPP_VERSION) { typedef std::unordered_multimap, std::equal_to, test_allocator> C; - LIBCPP_STATIC_ASSERT(noexcept(swap(std::declval(), std::declval())), ""); + static_assert(noexcept(swap(std::declval(), std::declval())), ""); } { typedef std::unordered_multimap, std::equal_to, other_allocator> C; - LIBCPP_STATIC_ASSERT(noexcept(swap(std::declval(), std::declval())), ""); + static_assert(noexcept(swap(std::declval(), std::declval())), ""); } +#endif // _LIBCPP_VERSION { typedef std::unordered_multimap> C; static_assert(!noexcept(swap(std::declval(), std::declval())), ""); @@ -177,9 +181,11 @@ int main() typedef std::unordered_multimap, some_comp2, some_alloc2> C; static_assert( noexcept(swap(std::declval(), std::declval())), ""); } +#if defined(_LIBCPP_VERSION) { // NOT always equal allocator, nothrow swap for hash, nothrow swap for comp typedef std::unordered_multimap, some_comp2, some_alloc3> C; - LIBCPP_STATIC_ASSERT( noexcept(swap(std::declval(), std::declval())), ""); + static_assert( noexcept(swap(std::declval(), std::declval())), ""); } +#endif // _LIBCPP_VERSION #endif } diff --git a/test/std/containers/unord/unord.multimap/unord.multimap.swap/swap_non_member.pass.cpp b/test/std/containers/unord/unord.multimap/unord.multimap.swap/swap_non_member.pass.cpp index 06e6c65c991d..644af867dad4 100644 --- a/test/std/containers/unord/unord.multimap/unord.multimap.swap/swap_non_member.pass.cpp +++ b/test/std/containers/unord/unord.multimap/unord.multimap.swap/swap_non_member.pass.cpp @@ -33,7 +33,6 @@ int main() typedef test_compare > Compare; typedef test_allocator > Alloc; typedef std::unordered_multimap C; - typedef std::pair P; C c1(0, Hash(1), Compare(1), Alloc(1, 1)); C c2(0, Hash(2), Compare(2), Alloc(1, 2)); c2.max_load_factor(2); @@ -218,7 +217,6 @@ int main() typedef test_compare > Compare; typedef other_allocator > Alloc; typedef std::unordered_multimap C; - typedef std::pair P; C c1(0, Hash(1), Compare(1), Alloc(1)); C c2(0, Hash(2), Compare(2), Alloc(2)); c2.max_load_factor(2); @@ -403,7 +401,6 @@ int main() typedef test_compare > Compare; typedef min_allocator > Alloc; typedef std::unordered_multimap C; - typedef std::pair P; C c1(0, Hash(1), Compare(1), Alloc()); C c2(0, Hash(2), Compare(2), Alloc()); c2.max_load_factor(2); diff --git a/test/std/containers/unord/unord.multiset/bucket_count.pass.cpp b/test/std/containers/unord/unord.multiset/bucket_count.pass.cpp index ec4d0e675501..c60a811678fb 100644 --- a/test/std/containers/unord/unord.multiset/bucket_count.pass.cpp +++ b/test/std/containers/unord/unord.multiset/bucket_count.pass.cpp @@ -25,14 +25,11 @@ int main() { { typedef std::unordered_multiset C; - typedef C::const_iterator I; - typedef int P; const C c; LIBCPP_ASSERT(c.bucket_count() == 0); } { typedef std::unordered_multiset C; - typedef C::const_iterator I; typedef int P; P a[] = { @@ -52,15 +49,12 @@ int main() { typedef std::unordered_multiset, std::equal_to, min_allocator> C; - typedef C::const_iterator I; - typedef int P; const C c; LIBCPP_ASSERT(c.bucket_count() == 0); } { typedef std::unordered_multiset, std::equal_to, min_allocator> C; - typedef C::const_iterator I; typedef int P; P a[] = { diff --git a/test/std/containers/unord/unord.multiset/incomplete.pass.cpp b/test/std/containers/unord/unord.multiset/incomplete.pass.cpp index f6d8dc17c5a2..1b3c1492c4a4 100644 --- a/test/std/containers/unord/unord.multiset/incomplete.pass.cpp +++ b/test/std/containers/unord/unord.multiset/incomplete.pass.cpp @@ -11,7 +11,7 @@ // -// Check that std::unordered_multiset and it's iterators can be instantiated with an incomplete +// Check that std::unordered_multiset and its iterators can be instantiated with an incomplete // type. #include diff --git a/test/std/containers/unord/unord.multiset/load_factor.pass.cpp b/test/std/containers/unord/unord.multiset/load_factor.pass.cpp index fad1c182e6b7..df2cb7beff39 100644 --- a/test/std/containers/unord/unord.multiset/load_factor.pass.cpp +++ b/test/std/containers/unord/unord.multiset/load_factor.pass.cpp @@ -43,7 +43,6 @@ int main() } { typedef std::unordered_multiset C; - typedef int P; const C c; assert(c.load_factor() == 0); } @@ -69,7 +68,6 @@ int main() { typedef std::unordered_multiset, std::equal_to, min_allocator> C; - typedef int P; const C c; assert(c.load_factor() == 0); } diff --git a/test/std/containers/unord/unord.multiset/max_load_factor.pass.cpp b/test/std/containers/unord/unord.multiset/max_load_factor.pass.cpp index 00fe962327f8..f7ebaaf65d47 100644 --- a/test/std/containers/unord/unord.multiset/max_load_factor.pass.cpp +++ b/test/std/containers/unord/unord.multiset/max_load_factor.pass.cpp @@ -29,13 +29,11 @@ int main() { { typedef std::unordered_multiset C; - typedef int P; const C c; assert(c.max_load_factor() == 1); } { typedef std::unordered_multiset C; - typedef int P; C c; assert(c.max_load_factor() == 1); c.max_load_factor(2.5); @@ -45,14 +43,12 @@ int main() { typedef std::unordered_multiset, std::equal_to, min_allocator> C; - typedef int P; const C c; assert(c.max_load_factor() == 1); } { typedef std::unordered_multiset, std::equal_to, min_allocator> C; - typedef int P; C c; assert(c.max_load_factor() == 1); c.max_load_factor(2.5); diff --git a/test/std/containers/unord/unord.multiset/swap_member.pass.cpp b/test/std/containers/unord/unord.multiset/swap_member.pass.cpp index c0c9e9021712..9ffe3ad480be 100644 --- a/test/std/containers/unord/unord.multiset/swap_member.pass.cpp +++ b/test/std/containers/unord/unord.multiset/swap_member.pass.cpp @@ -32,7 +32,6 @@ int main() typedef test_compare > Compare; typedef test_allocator Alloc; typedef std::unordered_multiset C; - typedef int P; C c1(0, Hash(1), Compare(1), Alloc(1, 1)); C c2(0, Hash(2), Compare(2), Alloc(1, 2)); c2.max_load_factor(2); @@ -213,7 +212,6 @@ int main() typedef test_compare > Compare; typedef other_allocator Alloc; typedef std::unordered_multiset C; - typedef int P; C c1(0, Hash(1), Compare(1), Alloc(1)); C c2(0, Hash(2), Compare(2), Alloc(2)); c2.max_load_factor(2); @@ -394,7 +392,6 @@ int main() typedef test_compare > Compare; typedef min_allocator Alloc; typedef std::unordered_multiset C; - typedef int P; C c1(0, Hash(1), Compare(1), Alloc()); C c2(0, Hash(2), Compare(2), Alloc()); c2.max_load_factor(2); diff --git a/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/default_noexcept.pass.cpp b/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/default_noexcept.pass.cpp index fba024aed00e..3b69c1eed2e3 100644 --- a/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/default_noexcept.pass.cpp +++ b/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/default_noexcept.pass.cpp @@ -42,19 +42,22 @@ struct some_hash typedef T value_type; some_hash(); some_hash(const some_hash&); + std::size_t operator()(T const&) const; }; int main() { +#if defined(_LIBCPP_VERSION) { typedef std::unordered_multiset C; - LIBCPP_STATIC_ASSERT(std::is_nothrow_default_constructible::value, ""); + static_assert(std::is_nothrow_default_constructible::value, ""); } { typedef std::unordered_multiset, std::equal_to, test_allocator> C; - LIBCPP_STATIC_ASSERT(std::is_nothrow_default_constructible::value, ""); + static_assert(std::is_nothrow_default_constructible::value, ""); } +#endif // _LIBCPP_VERSION { typedef std::unordered_multiset, std::equal_to, other_allocator> C; diff --git a/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/dtor_noexcept.pass.cpp b/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/dtor_noexcept.pass.cpp index 62fe51e29903..1e927b9b3958 100644 --- a/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/dtor_noexcept.pass.cpp +++ b/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/dtor_noexcept.pass.cpp @@ -35,6 +35,7 @@ struct some_hash some_hash(); some_hash(const some_hash&); ~some_hash() noexcept(false); + std::size_t operator()(T const&) const; }; int main() @@ -53,13 +54,15 @@ int main() std::equal_to, other_allocator> C; static_assert(std::is_nothrow_destructible::value, ""); } +#if defined(_LIBCPP_VERSION) { typedef std::unordered_multiset> C; - LIBCPP_STATIC_ASSERT(!std::is_nothrow_destructible::value, ""); + static_assert(!std::is_nothrow_destructible::value, ""); } { typedef std::unordered_multiset, some_comp> C; - LIBCPP_STATIC_ASSERT(!std::is_nothrow_destructible::value, ""); + static_assert(!std::is_nothrow_destructible::value, ""); } +#endif // _LIBCPP_VERSION } diff --git a/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/move_assign_noexcept.pass.cpp b/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/move_assign_noexcept.pass.cpp index ac0a10a4b0ea..7336bb5afa7c 100644 --- a/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/move_assign_noexcept.pass.cpp +++ b/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/move_assign_noexcept.pass.cpp @@ -41,6 +41,7 @@ struct some_hash some_hash(); some_hash(const some_hash&); some_hash& operator=(const some_hash&); + std::size_t operator()(T const&) const; }; int main() @@ -54,11 +55,13 @@ int main() std::equal_to, test_allocator> C; static_assert(!std::is_nothrow_move_assignable::value, ""); } +#if defined(_LIBCPP_VERSION) { typedef std::unordered_multiset, std::equal_to, other_allocator> C; - LIBCPP_STATIC_ASSERT(std::is_nothrow_move_assignable::value, ""); + static_assert(std::is_nothrow_move_assignable::value, ""); } +#endif // _LIBCPP_VERSION { typedef std::unordered_multiset> C; static_assert(!std::is_nothrow_move_assignable::value, ""); diff --git a/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/move_noexcept.pass.cpp b/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/move_noexcept.pass.cpp index e44be18fa3b4..fcf2a5af3129 100644 --- a/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/move_noexcept.pass.cpp +++ b/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/move_noexcept.pass.cpp @@ -38,24 +38,27 @@ struct some_hash typedef T value_type; some_hash(); some_hash(const some_hash&); + std::size_t operator()(T const&) const; }; int main() { +#if defined(_LIBCPP_VERSION) { typedef std::unordered_multiset C; - LIBCPP_STATIC_ASSERT(std::is_nothrow_move_constructible::value, ""); + static_assert(std::is_nothrow_move_constructible::value, ""); } { typedef std::unordered_multiset, std::equal_to, test_allocator> C; - LIBCPP_STATIC_ASSERT(std::is_nothrow_move_constructible::value, ""); + static_assert(std::is_nothrow_move_constructible::value, ""); } { typedef std::unordered_multiset, std::equal_to, other_allocator> C; - LIBCPP_STATIC_ASSERT(std::is_nothrow_move_constructible::value, ""); + static_assert(std::is_nothrow_move_constructible::value, ""); } +#endif // _LIBCPP_VERSION { typedef std::unordered_multiset> C; static_assert(!std::is_nothrow_move_constructible::value, ""); diff --git a/test/std/containers/unord/unord.multiset/unord.multiset.swap/swap_noexcept.pass.cpp b/test/std/containers/unord/unord.multiset/unord.multiset.swap/swap_noexcept.pass.cpp index c221b6f2edb0..4afef42e6a60 100644 --- a/test/std/containers/unord/unord.multiset/unord.multiset.swap/swap_noexcept.pass.cpp +++ b/test/std/containers/unord/unord.multiset/unord.multiset.swap/swap_noexcept.pass.cpp @@ -125,16 +125,18 @@ int main() typedef std::unordered_multiset C; static_assert(noexcept(swap(std::declval(), std::declval())), ""); } +#if defined(_LIBCPP_VERSION) { typedef std::unordered_multiset, std::equal_to, test_allocator> C; - LIBCPP_STATIC_ASSERT(noexcept(swap(std::declval(), std::declval())), ""); + static_assert(noexcept(swap(std::declval(), std::declval())), ""); } { typedef std::unordered_multiset, std::equal_to, other_allocator> C; - LIBCPP_STATIC_ASSERT(noexcept(swap(std::declval(), std::declval())), ""); + static_assert(noexcept(swap(std::declval(), std::declval())), ""); } +#endif // _LIBCPP_VERSION { typedef std::unordered_multiset> C; static_assert(!noexcept(swap(std::declval(), std::declval())), ""); @@ -178,10 +180,11 @@ int main() typedef std::unordered_multiset, some_comp2, some_alloc2> C; static_assert( noexcept(swap(std::declval(), std::declval())), ""); } - +#if defined(_LIBCPP_VERSION) { // NOT always equal allocator, nothrow swap for hash, nothrow swap for comp typedef std::unordered_multiset, some_comp2, some_alloc3> C; - LIBCPP_STATIC_ASSERT( noexcept(swap(std::declval(), std::declval())), ""); + static_assert( noexcept(swap(std::declval(), std::declval())), ""); } +#endif // _LIBCPP_VERSION #endif } diff --git a/test/std/containers/unord/unord.multiset/unord.multiset.swap/swap_non_member.pass.cpp b/test/std/containers/unord/unord.multiset/unord.multiset.swap/swap_non_member.pass.cpp index d4efb6868026..ce290ff1c1e7 100644 --- a/test/std/containers/unord/unord.multiset/unord.multiset.swap/swap_non_member.pass.cpp +++ b/test/std/containers/unord/unord.multiset/unord.multiset.swap/swap_non_member.pass.cpp @@ -32,7 +32,6 @@ int main() typedef test_compare > Compare; typedef test_allocator Alloc; typedef std::unordered_multiset C; - typedef int P; C c1(0, Hash(1), Compare(1), Alloc(1, 1)); C c2(0, Hash(2), Compare(2), Alloc(1, 2)); c2.max_load_factor(2); @@ -213,7 +212,6 @@ int main() typedef test_compare > Compare; typedef other_allocator Alloc; typedef std::unordered_multiset C; - typedef int P; C c1(0, Hash(1), Compare(1), Alloc(1)); C c2(0, Hash(2), Compare(2), Alloc(2)); c2.max_load_factor(2); @@ -394,7 +392,6 @@ int main() typedef test_compare > Compare; typedef min_allocator Alloc; typedef std::unordered_multiset C; - typedef int P; C c1(0, Hash(1), Compare(1), Alloc()); C c2(0, Hash(2), Compare(2), Alloc()); c2.max_load_factor(2); diff --git a/test/std/containers/unord/unord.set/bucket_count.pass.cpp b/test/std/containers/unord/unord.set/bucket_count.pass.cpp index 6f1f526abaf6..227d9e123331 100644 --- a/test/std/containers/unord/unord.set/bucket_count.pass.cpp +++ b/test/std/containers/unord/unord.set/bucket_count.pass.cpp @@ -25,14 +25,11 @@ int main() { { typedef std::unordered_set C; - typedef C::const_iterator I; - typedef int P; const C c; LIBCPP_ASSERT(c.bucket_count() == 0); } { typedef std::unordered_set C; - typedef C::const_iterator I; typedef int P; P a[] = { @@ -51,14 +48,11 @@ int main() #if TEST_STD_VER >= 11 { typedef std::unordered_set, std::equal_to, min_allocator> C; - typedef C::const_iterator I; - typedef int P; const C c; LIBCPP_ASSERT(c.bucket_count() == 0); } { typedef std::unordered_set, std::equal_to, min_allocator> C; - typedef C::const_iterator I; typedef int P; P a[] = { diff --git a/test/std/containers/unord/unord.set/incomplete.pass.cpp b/test/std/containers/unord/unord.set/incomplete.pass.cpp index c970c1de5531..4f7a00c999e8 100644 --- a/test/std/containers/unord/unord.set/incomplete.pass.cpp +++ b/test/std/containers/unord/unord.set/incomplete.pass.cpp @@ -11,7 +11,7 @@ // -// Check that std::unordered_set and it's iterators can be instantiated with an incomplete +// Check that std::unordered_set and its iterators can be instantiated with an incomplete // type. #include diff --git a/test/std/containers/unord/unord.set/load_factor.pass.cpp b/test/std/containers/unord/unord.set/load_factor.pass.cpp index a342d472a3d5..94eb5d1bd04b 100644 --- a/test/std/containers/unord/unord.set/load_factor.pass.cpp +++ b/test/std/containers/unord/unord.set/load_factor.pass.cpp @@ -43,7 +43,6 @@ int main() } { typedef std::unordered_set C; - typedef int P; const C c; assert(c.load_factor() == 0); } @@ -69,7 +68,6 @@ int main() { typedef std::unordered_set, std::equal_to, min_allocator> C; - typedef int P; const C c; assert(c.load_factor() == 0); } diff --git a/test/std/containers/unord/unord.set/max_load_factor.pass.cpp b/test/std/containers/unord/unord.set/max_load_factor.pass.cpp index 542788cca967..e9e04bca8562 100644 --- a/test/std/containers/unord/unord.set/max_load_factor.pass.cpp +++ b/test/std/containers/unord/unord.set/max_load_factor.pass.cpp @@ -29,13 +29,11 @@ int main() { { typedef std::unordered_set C; - typedef int P; const C c; assert(c.max_load_factor() == 1); } { typedef std::unordered_set C; - typedef int P; C c; assert(c.max_load_factor() == 1); c.max_load_factor(2.5); @@ -45,14 +43,12 @@ int main() { typedef std::unordered_set, std::equal_to, min_allocator> C; - typedef int P; const C c; assert(c.max_load_factor() == 1); } { typedef std::unordered_set, std::equal_to, min_allocator> C; - typedef int P; C c; assert(c.max_load_factor() == 1); c.max_load_factor(2.5); diff --git a/test/std/containers/unord/unord.set/swap_member.pass.cpp b/test/std/containers/unord/unord.set/swap_member.pass.cpp index ea88c53a526c..597662112cef 100644 --- a/test/std/containers/unord/unord.set/swap_member.pass.cpp +++ b/test/std/containers/unord/unord.set/swap_member.pass.cpp @@ -32,7 +32,6 @@ int main() typedef test_compare > Compare; typedef test_allocator Alloc; typedef std::unordered_set C; - typedef int P; C c1(0, Hash(1), Compare(1), Alloc(1, 1)); C c2(0, Hash(2), Compare(2), Alloc(1, 2)); c2.max_load_factor(2); @@ -213,7 +212,6 @@ int main() typedef test_compare > Compare; typedef other_allocator Alloc; typedef std::unordered_set C; - typedef int P; C c1(0, Hash(1), Compare(1), Alloc(1)); C c2(0, Hash(2), Compare(2), Alloc(2)); c2.max_load_factor(2); @@ -394,7 +392,6 @@ int main() typedef test_compare > Compare; typedef min_allocator Alloc; typedef std::unordered_set C; - typedef int P; C c1(0, Hash(1), Compare(1), Alloc()); C c2(0, Hash(2), Compare(2), Alloc()); c2.max_load_factor(2); diff --git a/test/std/containers/unord/unord.set/unord.set.cnstr/default_noexcept.pass.cpp b/test/std/containers/unord/unord.set/unord.set.cnstr/default_noexcept.pass.cpp index 3dcc3247902e..b8d06dbfdd16 100644 --- a/test/std/containers/unord/unord.set/unord.set.cnstr/default_noexcept.pass.cpp +++ b/test/std/containers/unord/unord.set/unord.set.cnstr/default_noexcept.pass.cpp @@ -42,19 +42,22 @@ struct some_hash typedef T value_type; some_hash(); some_hash(const some_hash&); + std::size_t operator()(T const&) const; }; int main() { +#if defined(_LIBCPP_VERSION) { typedef std::unordered_set C; - LIBCPP_STATIC_ASSERT(std::is_nothrow_default_constructible::value, ""); + static_assert(std::is_nothrow_default_constructible::value, ""); } { typedef std::unordered_set, std::equal_to, test_allocator> C; - LIBCPP_STATIC_ASSERT(std::is_nothrow_default_constructible::value, ""); + static_assert(std::is_nothrow_default_constructible::value, ""); } +#endif // _LIBCPP_VERSION { typedef std::unordered_set, std::equal_to, other_allocator> C; diff --git a/test/std/containers/unord/unord.set/unord.set.cnstr/dtor_noexcept.pass.cpp b/test/std/containers/unord/unord.set/unord.set.cnstr/dtor_noexcept.pass.cpp index 82e184b8d3ea..4c10ed2d6290 100644 --- a/test/std/containers/unord/unord.set/unord.set.cnstr/dtor_noexcept.pass.cpp +++ b/test/std/containers/unord/unord.set/unord.set.cnstr/dtor_noexcept.pass.cpp @@ -35,6 +35,7 @@ struct some_hash some_hash(); some_hash(const some_hash&); ~some_hash() noexcept(false); + std::size_t operator()(T const&) const; }; int main() @@ -53,13 +54,15 @@ int main() std::equal_to, other_allocator> C; static_assert(std::is_nothrow_destructible::value, ""); } +#if defined(_LIBCPP_VERSION) { typedef std::unordered_set> C; - LIBCPP_STATIC_ASSERT(!std::is_nothrow_destructible::value, ""); + static_assert(!std::is_nothrow_destructible::value, ""); } { typedef std::unordered_set, some_comp> C; - LIBCPP_STATIC_ASSERT(!std::is_nothrow_destructible::value, ""); + static_assert(!std::is_nothrow_destructible::value, ""); } +#endif // _LIBCPP_VERSION } diff --git a/test/std/containers/unord/unord.set/unord.set.cnstr/move_assign_noexcept.pass.cpp b/test/std/containers/unord/unord.set/unord.set.cnstr/move_assign_noexcept.pass.cpp index b89d68002477..670a3484d15f 100644 --- a/test/std/containers/unord/unord.set/unord.set.cnstr/move_assign_noexcept.pass.cpp +++ b/test/std/containers/unord/unord.set/unord.set.cnstr/move_assign_noexcept.pass.cpp @@ -41,6 +41,7 @@ struct some_hash some_hash(); some_hash(const some_hash&); some_hash& operator=(const some_hash&); + std::size_t operator()(T const&) const; }; int main() @@ -54,11 +55,13 @@ int main() std::equal_to, test_allocator> C; static_assert(!std::is_nothrow_move_assignable::value, ""); } +#if defined(_LIBCPP_VERSION) { typedef std::unordered_set, std::equal_to, other_allocator> C; - LIBCPP_STATIC_ASSERT(std::is_nothrow_move_assignable::value, ""); + static_assert(std::is_nothrow_move_assignable::value, ""); } +#endif // _LIBCPP_VERSION { typedef std::unordered_set> C; static_assert(!std::is_nothrow_move_assignable::value, ""); diff --git a/test/std/containers/unord/unord.set/unord.set.cnstr/move_noexcept.pass.cpp b/test/std/containers/unord/unord.set/unord.set.cnstr/move_noexcept.pass.cpp index 7190a01208f0..43e06bd50463 100644 --- a/test/std/containers/unord/unord.set/unord.set.cnstr/move_noexcept.pass.cpp +++ b/test/std/containers/unord/unord.set/unord.set.cnstr/move_noexcept.pass.cpp @@ -38,24 +38,27 @@ struct some_hash typedef T value_type; some_hash(); some_hash(const some_hash&); + std::size_t operator()(T const&) const; }; int main() { +#if defined(_LIBCPP_VERSION) { typedef std::unordered_set C; - LIBCPP_STATIC_ASSERT(std::is_nothrow_move_constructible::value, ""); + static_assert(std::is_nothrow_move_constructible::value, ""); } { typedef std::unordered_set, std::equal_to, test_allocator> C; - LIBCPP_STATIC_ASSERT(std::is_nothrow_move_constructible::value, ""); + static_assert(std::is_nothrow_move_constructible::value, ""); } { typedef std::unordered_set, std::equal_to, other_allocator> C; - LIBCPP_STATIC_ASSERT(std::is_nothrow_move_constructible::value, ""); + static_assert(std::is_nothrow_move_constructible::value, ""); } +#endif // _LIBCPP_VERSION { typedef std::unordered_set> C; static_assert(!std::is_nothrow_move_constructible::value, ""); diff --git a/test/std/containers/unord/unord.set/unord.set.swap/swap_noexcept.pass.cpp b/test/std/containers/unord/unord.set/unord.set.swap/swap_noexcept.pass.cpp index 4a16ddd3f4ce..7187f94a28dc 100644 --- a/test/std/containers/unord/unord.set/unord.set.swap/swap_noexcept.pass.cpp +++ b/test/std/containers/unord/unord.set/unord.set.swap/swap_noexcept.pass.cpp @@ -125,16 +125,18 @@ int main() typedef std::unordered_set C; static_assert(noexcept(swap(std::declval(), std::declval())), ""); } +#if defined(_LIBCPP_VERSION) { typedef std::unordered_set, std::equal_to, test_allocator> C; - LIBCPP_STATIC_ASSERT(noexcept(swap(std::declval(), std::declval())), ""); + static_assert(noexcept(swap(std::declval(), std::declval())), ""); } { typedef std::unordered_set, std::equal_to, other_allocator> C; - LIBCPP_STATIC_ASSERT(noexcept(swap(std::declval(), std::declval())), ""); + static_assert(noexcept(swap(std::declval(), std::declval())), ""); } +#endif // _LIBCPP_VERSION { typedef std::unordered_set> C; static_assert(!noexcept(swap(std::declval(), std::declval())), ""); @@ -178,10 +180,11 @@ int main() typedef std::unordered_set, some_comp2, some_alloc2> C; static_assert( noexcept(swap(std::declval(), std::declval())), ""); } - +#if defined(_LIBCPP_VERSION) { // NOT always equal allocator, nothrow swap for hash, nothrow swap for comp typedef std::unordered_set, some_comp2, some_alloc3> C; - LIBCPP_STATIC_ASSERT( noexcept(swap(std::declval(), std::declval())), ""); + static_assert( noexcept(swap(std::declval(), std::declval())), ""); } +#endif // _LIBCPP_VERSION #endif } diff --git a/test/std/containers/unord/unord.set/unord.set.swap/swap_non_member.pass.cpp b/test/std/containers/unord/unord.set/unord.set.swap/swap_non_member.pass.cpp index c2bd75960d5b..9ca2f80f0561 100644 --- a/test/std/containers/unord/unord.set/unord.set.swap/swap_non_member.pass.cpp +++ b/test/std/containers/unord/unord.set/unord.set.swap/swap_non_member.pass.cpp @@ -32,7 +32,6 @@ int main() typedef test_compare > Compare; typedef test_allocator Alloc; typedef std::unordered_set C; - typedef int P; C c1(0, Hash(1), Compare(1), Alloc(1, 1)); C c2(0, Hash(2), Compare(2), Alloc(1, 2)); c2.max_load_factor(2); @@ -213,7 +212,6 @@ int main() typedef test_compare > Compare; typedef other_allocator Alloc; typedef std::unordered_set C; - typedef int P; C c1(0, Hash(1), Compare(1), Alloc(1)); C c2(0, Hash(2), Compare(2), Alloc(2)); c2.max_load_factor(2); @@ -394,7 +392,6 @@ int main() typedef test_compare > Compare; typedef min_allocator Alloc; typedef std::unordered_set C; - typedef int P; C c1(0, Hash(1), Compare(1), Alloc()); C c2(0, Hash(2), Compare(2), Alloc()); c2.max_load_factor(2); diff --git a/test/std/depr/depr.auto.ptr/auto.ptr/auto.ptr.cons/assignment.pass.cpp b/test/std/depr/depr.auto.ptr/auto.ptr/auto.ptr.cons/assignment.pass.cpp index 2c6acb5af12c..a5d52a6ef778 100644 --- a/test/std/depr/depr.auto.ptr/auto.ptr/auto.ptr.cons/assignment.pass.cpp +++ b/test/std/depr/depr.auto.ptr/auto.ptr/auto.ptr.cons/assignment.pass.cpp @@ -13,6 +13,8 @@ // auto_ptr& operator=(auto_ptr& a) throw(); +// REQUIRES: c++98 || c++03 || c++11 || c++14 + #include #include diff --git a/test/std/depr/depr.auto.ptr/auto.ptr/auto.ptr.cons/convert.pass.cpp b/test/std/depr/depr.auto.ptr/auto.ptr/auto.ptr.cons/convert.pass.cpp index aeea7dec9e34..cce3c79ef5ba 100644 --- a/test/std/depr/depr.auto.ptr/auto.ptr/auto.ptr.cons/convert.pass.cpp +++ b/test/std/depr/depr.auto.ptr/auto.ptr/auto.ptr.cons/convert.pass.cpp @@ -13,6 +13,8 @@ // auto_ptr(auto_ptr& a) throw(); +// REQUIRES: c++98 || c++03 || c++11 || c++14 + #include #include diff --git a/test/std/depr/depr.auto.ptr/auto.ptr/auto.ptr.cons/convert_assignment.pass.cpp b/test/std/depr/depr.auto.ptr/auto.ptr/auto.ptr.cons/convert_assignment.pass.cpp index 6809073c2d0c..b83c266fb9b2 100644 --- a/test/std/depr/depr.auto.ptr/auto.ptr/auto.ptr.cons/convert_assignment.pass.cpp +++ b/test/std/depr/depr.auto.ptr/auto.ptr/auto.ptr.cons/convert_assignment.pass.cpp @@ -13,6 +13,8 @@ // template auto_ptr& operator=(auto_ptr& a) throw(); +// REQUIRES: c++98 || c++03 || c++11 || c++14 + #include #include diff --git a/test/std/depr/depr.auto.ptr/auto.ptr/auto.ptr.cons/copy.pass.cpp b/test/std/depr/depr.auto.ptr/auto.ptr/auto.ptr.cons/copy.pass.cpp index 27ba0e513e45..10a432647199 100644 --- a/test/std/depr/depr.auto.ptr/auto.ptr/auto.ptr.cons/copy.pass.cpp +++ b/test/std/depr/depr.auto.ptr/auto.ptr/auto.ptr.cons/copy.pass.cpp @@ -13,6 +13,8 @@ // auto_ptr(auto_ptr& a) throw(); +// REQUIRES: c++98 || c++03 || c++11 || c++14 + #include #include diff --git a/test/std/depr/depr.auto.ptr/auto.ptr/auto.ptr.cons/pointer.pass.cpp b/test/std/depr/depr.auto.ptr/auto.ptr/auto.ptr.cons/pointer.pass.cpp index e29ff2e78244..3dfd200fafa9 100644 --- a/test/std/depr/depr.auto.ptr/auto.ptr/auto.ptr.cons/pointer.pass.cpp +++ b/test/std/depr/depr.auto.ptr/auto.ptr/auto.ptr.cons/pointer.pass.cpp @@ -13,6 +13,8 @@ // explicit auto_ptr(X* p =0) throw(); +// REQUIRES: c++98 || c++03 || c++11 || c++14 + #include #include diff --git a/test/std/depr/depr.auto.ptr/auto.ptr/auto.ptr.conv/assign_from_auto_ptr_ref.pass.cpp b/test/std/depr/depr.auto.ptr/auto.ptr/auto.ptr.conv/assign_from_auto_ptr_ref.pass.cpp index 6f53581af422..91801efac64a 100644 --- a/test/std/depr/depr.auto.ptr/auto.ptr/auto.ptr.conv/assign_from_auto_ptr_ref.pass.cpp +++ b/test/std/depr/depr.auto.ptr/auto.ptr/auto.ptr.conv/assign_from_auto_ptr_ref.pass.cpp @@ -13,6 +13,8 @@ // auto_ptr& operator=(auto_ptr_ref r) throw() +// REQUIRES: c++98 || c++03 || c++11 || c++14 + #include #include diff --git a/test/std/depr/depr.auto.ptr/auto.ptr/auto.ptr.conv/convert_from_auto_ptr_ref.pass.cpp b/test/std/depr/depr.auto.ptr/auto.ptr/auto.ptr.conv/convert_from_auto_ptr_ref.pass.cpp index 375780527cf0..e08df64377d5 100644 --- a/test/std/depr/depr.auto.ptr/auto.ptr/auto.ptr.conv/convert_from_auto_ptr_ref.pass.cpp +++ b/test/std/depr/depr.auto.ptr/auto.ptr/auto.ptr.conv/convert_from_auto_ptr_ref.pass.cpp @@ -13,6 +13,8 @@ // auto_ptr(auto_ptr_ref r) throw(); +// REQUIRES: c++98 || c++03 || c++11 || c++14 + #include #include diff --git a/test/std/depr/depr.auto.ptr/auto.ptr/auto.ptr.conv/convert_to_auto_ptr.pass.cpp b/test/std/depr/depr.auto.ptr/auto.ptr/auto.ptr.conv/convert_to_auto_ptr.pass.cpp index 00c0f6d30caf..572e5e686d49 100644 --- a/test/std/depr/depr.auto.ptr/auto.ptr/auto.ptr.conv/convert_to_auto_ptr.pass.cpp +++ b/test/std/depr/depr.auto.ptr/auto.ptr/auto.ptr.conv/convert_to_auto_ptr.pass.cpp @@ -13,6 +13,8 @@ // template operator auto_ptr() throw(); +// REQUIRES: c++98 || c++03 || c++11 || c++14 + #include #include diff --git a/test/std/depr/depr.auto.ptr/auto.ptr/auto.ptr.conv/convert_to_auto_ptr_ref.pass.cpp b/test/std/depr/depr.auto.ptr/auto.ptr/auto.ptr.conv/convert_to_auto_ptr_ref.pass.cpp index a5db81e6c632..cd9fed2fb10e 100644 --- a/test/std/depr/depr.auto.ptr/auto.ptr/auto.ptr.conv/convert_to_auto_ptr_ref.pass.cpp +++ b/test/std/depr/depr.auto.ptr/auto.ptr/auto.ptr.conv/convert_to_auto_ptr_ref.pass.cpp @@ -13,6 +13,8 @@ // template operator auto_ptr_ref() throw(); +// REQUIRES: c++98 || c++03 || c++11 || c++14 + #include #include diff --git a/test/std/depr/depr.auto.ptr/auto.ptr/auto.ptr.members/arrow.pass.cpp b/test/std/depr/depr.auto.ptr/auto.ptr/auto.ptr.members/arrow.pass.cpp index fce9332df846..305cf025ce45 100644 --- a/test/std/depr/depr.auto.ptr/auto.ptr/auto.ptr.members/arrow.pass.cpp +++ b/test/std/depr/depr.auto.ptr/auto.ptr/auto.ptr.members/arrow.pass.cpp @@ -13,6 +13,8 @@ // X& operator*() const throw(); +// REQUIRES: c++98 || c++03 || c++11 || c++14 + #include #include diff --git a/test/std/depr/depr.auto.ptr/auto.ptr/auto.ptr.members/deref.pass.cpp b/test/std/depr/depr.auto.ptr/auto.ptr/auto.ptr.members/deref.pass.cpp index dd5669563e35..7174b27fb862 100644 --- a/test/std/depr/depr.auto.ptr/auto.ptr/auto.ptr.members/deref.pass.cpp +++ b/test/std/depr/depr.auto.ptr/auto.ptr/auto.ptr.members/deref.pass.cpp @@ -13,6 +13,8 @@ // X& operator*() const throw(); +// REQUIRES: c++98 || c++03 || c++11 || c++14 + #include #include diff --git a/test/std/depr/depr.auto.ptr/auto.ptr/auto.ptr.members/release.pass.cpp b/test/std/depr/depr.auto.ptr/auto.ptr/auto.ptr.members/release.pass.cpp index 5860eb411143..650da2ef8196 100644 --- a/test/std/depr/depr.auto.ptr/auto.ptr/auto.ptr.members/release.pass.cpp +++ b/test/std/depr/depr.auto.ptr/auto.ptr/auto.ptr.members/release.pass.cpp @@ -16,6 +16,8 @@ #include #include +// REQUIRES: c++98 || c++03 || c++11 || c++14 + #include "../A.h" void diff --git a/test/std/depr/depr.auto.ptr/auto.ptr/auto.ptr.members/reset.pass.cpp b/test/std/depr/depr.auto.ptr/auto.ptr/auto.ptr.members/reset.pass.cpp index cdbdd73ab72d..55772b68808d 100644 --- a/test/std/depr/depr.auto.ptr/auto.ptr/auto.ptr.members/reset.pass.cpp +++ b/test/std/depr/depr.auto.ptr/auto.ptr/auto.ptr.members/reset.pass.cpp @@ -16,6 +16,8 @@ #include #include +// REQUIRES: c++98 || c++03 || c++11 || c++14 + #include "../A.h" void diff --git a/test/std/depr/depr.auto.ptr/auto.ptr/element_type.pass.cpp b/test/std/depr/depr.auto.ptr/auto.ptr/element_type.pass.cpp index 256563439a17..1895828aff64 100644 --- a/test/std/depr/depr.auto.ptr/auto.ptr/element_type.pass.cpp +++ b/test/std/depr/depr.auto.ptr/auto.ptr/element_type.pass.cpp @@ -17,6 +17,8 @@ // ... // }; +// REQUIRES: c++98 || c++03 || c++11 || c++14 + #include #include diff --git a/test/std/depr/depr.c.headers/stdio_h.pass.cpp b/test/std/depr/depr.c.headers/stdio_h.pass.cpp index 85f9d2986284..36c37a3beb3e 100644 --- a/test/std/depr/depr.c.headers/stdio_h.pass.cpp +++ b/test/std/depr/depr.c.headers/stdio_h.pass.cpp @@ -99,7 +99,7 @@ #include -#if defined(__GNUC__) +#if defined(__GNUC__) || defined(__clang__) #pragma GCC diagnostic ignored "-Wformat-zero-length" #pragma GCC diagnostic ignored "-Wdeprecated-declarations" // for tmpnam #endif @@ -107,7 +107,7 @@ int main() { FILE* fp = 0; - fpos_t fpos = {}; + fpos_t fpos = fpos_t(); size_t s = 0; char* cp = 0; char arr[] = {'a', 'b'}; diff --git a/test/std/depr/depr.function.objects/depr.adaptors/depr.function.pointer.adaptors/pointer_to_binary_function.cxx1z.fail.cpp b/test/std/depr/depr.function.objects/depr.adaptors/depr.function.pointer.adaptors/pointer_to_binary_function.cxx1z.fail.cpp new file mode 100644 index 000000000000..fc37c9a59797 --- /dev/null +++ b/test/std/depr/depr.function.objects/depr.adaptors/depr.function.pointer.adaptors/pointer_to_binary_function.cxx1z.fail.cpp @@ -0,0 +1,25 @@ +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// +// pointer_to_binary_function +// UNSUPPORTED: c++98, c++03, c++11, c++14 + +#include +#include +#include + +#include "test_macros.h" + +double binary_f(int i, short j) {return i - j + .75;} + +int main() +{ + 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 41c99998caeb..e47731a65133 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/depr/depr.function.objects/depr.adaptors/depr.function.pointer.adaptors/pointer_to_unary_function.cxx1z.fail.cpp b/test/std/depr/depr.function.objects/depr.adaptors/depr.function.pointer.adaptors/pointer_to_unary_function.cxx1z.fail.cpp new file mode 100644 index 000000000000..687a819a392d --- /dev/null +++ b/test/std/depr/depr.function.objects/depr.adaptors/depr.function.pointer.adaptors/pointer_to_unary_function.cxx1z.fail.cpp @@ -0,0 +1,25 @@ +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// +// pointer_to_unary_function +// UNSUPPORTED: c++98, c++03, c++11, c++14 + +#include +#include +#include + +#include "test_macros.h" + +double unary_f(int i) {return 0.5 - i;} + +int main() +{ + 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 126cf32af436..2d713b3beed2 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/depr/depr.function.objects/depr.adaptors/depr.function.pointer.adaptors/ptr_fun1.cxx1z.fail.cpp b/test/std/depr/depr.function.objects/depr.adaptors/depr.function.pointer.adaptors/ptr_fun1.cxx1z.fail.cpp new file mode 100644 index 000000000000..2d232193607b --- /dev/null +++ b/test/std/depr/depr.function.objects/depr.adaptors/depr.function.pointer.adaptors/ptr_fun1.cxx1z.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. +// +//===----------------------------------------------------------------------===// + +// + +// template +// pointer_to_unary_function +// ptr_fun(Result (*f)(Arg)); +// UNSUPPORTED: c++98, c++03, c++11, c++14 + +#include +#include +#include + +#include "test_macros.h" + +double unary_f(int i) {return 0.5 - i;} + +int main() +{ + 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 c7ce90df3eb7..65f2a8d34253 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/depr/depr.function.objects/depr.adaptors/depr.function.pointer.adaptors/ptr_fun2.cxx1z.fail.cpp b/test/std/depr/depr.function.objects/depr.adaptors/depr.function.pointer.adaptors/ptr_fun2.cxx1z.fail.cpp new file mode 100644 index 000000000000..202abe25e008 --- /dev/null +++ b/test/std/depr/depr.function.objects/depr.adaptors/depr.function.pointer.adaptors/ptr_fun2.cxx1z.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. +// +//===----------------------------------------------------------------------===// + +// + +// template +// pointer_to_binary_function +// ptr_fun(Result (*f)(Arg1, Arg2)); +// UNSUPPORTED: c++98, c++03, c++11, c++14 + +#include +#include +#include + +#include "test_macros.h" + +double binary_f(int i, short j) {return i - j + .75;} + +int main() +{ + 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 17c4b611a319..5628c026c95a 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 000000000000..1c56aa9f5dc5 --- /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 455eed9b3e3c..4693c816c338 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 000000000000..c727e955b1d5 --- /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 46fd6d28d514..9f0b605d9a91 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 000000000000..39b3112da94c --- /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 0c4bb93ff524..65fc8c07eb2c 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 000000000000..f07a3b798e72 --- /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 ca670bcde109..71588fa1f9d3 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 000000000000..fea1441b31f1 --- /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 74d8950dea7f..22f44c65cd6a 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 000000000000..f993b7ce1949 --- /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 b858561ae757..267b80681eaf 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 000000000000..e195213f9c02 --- /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 9eec24e5743c..6f80993cbcdf 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 000000000000..228eb3da60a6 --- /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 9681b74d7e61..01945fc46f9f 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/depr/depr.function.objects/depr.adaptors/depr.member.pointer.adaptors/mem_fun.cxx1z.fail.cpp b/test/std/depr/depr.function.objects/depr.adaptors/depr.member.pointer.adaptors/mem_fun.cxx1z.fail.cpp new file mode 100644 index 000000000000..8f59a1ae2f82 --- /dev/null +++ b/test/std/depr/depr.function.objects/depr.adaptors/depr.member.pointer.adaptors/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 +// mem_fun_t +// mem_fun(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(&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 d0d286009ada..f3c12973fc8b 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 000000000000..6191de3fbe63 --- /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 acee9afeec7a..30f3c9422d2b 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 000000000000..0effd33f3784 --- /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 a78cbf25c191..0b63bb76ddb7 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/depr/depr.function.objects/depr.adaptors/depr.member.pointer.adaptors/mem_fun1_t.cxx1z.fail.cpp b/test/std/depr/depr.function.objects/depr.adaptors/depr.member.pointer.adaptors/mem_fun1_t.cxx1z.fail.cpp new file mode 100644 index 000000000000..aa8e25abe438 --- /dev/null +++ b/test/std/depr/depr.function.objects/depr.adaptors/depr.member.pointer.adaptors/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. +// +//===----------------------------------------------------------------------===// + +// + +// 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::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 90ba9bbf788d..79895c4b4d89 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 000000000000..ff7f28af8e30 --- /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 d3843fc5344c..8a6a8b943e4b 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 000000000000..82d47fefd3d4 --- /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 39a324d10bc4..142b16a6b3e4 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 000000000000..f1cf01c5c424 --- /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 236d8d0945fb..5af028b39928 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/depr/depr.function.objects/depr.adaptors/depr.member.pointer.adaptors/mem_fun_t.cxx1z.fail.cpp b/test/std/depr/depr.function.objects/depr.adaptors/depr.member.pointer.adaptors/mem_fun_t.cxx1z.fail.cpp new file mode 100644 index 000000000000..e6a1ed330762 --- /dev/null +++ b/test/std/depr/depr.function.objects/depr.adaptors/depr.member.pointer.adaptors/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. +// +//===----------------------------------------------------------------------===// + +// + +// 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::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 3fc84cd05c63..c33e2f7d753f 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 b6b75263c602..796e4ad878be 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 b7feb243b839..cbf1dbf9fbd9 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 8b7aaf0fdae1..480148b7658e 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 645c1688c18a..3dfb1f02d2a2 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/exception.unexpected/set.unexpected/get_unexpected.pass.cpp b/test/std/depr/exception.unexpected/set.unexpected/get_unexpected.pass.cpp index 02f9a81aa6dd..5c596da5a0bc 100644 --- a/test/std/depr/exception.unexpected/set.unexpected/get_unexpected.pass.cpp +++ b/test/std/depr/exception.unexpected/set.unexpected/get_unexpected.pass.cpp @@ -7,6 +7,8 @@ // //===----------------------------------------------------------------------===// +// REQUIRES: c++98 || c++03 || c++11 || c++14 + // test get_unexpected #include diff --git a/test/std/depr/exception.unexpected/set.unexpected/set_unexpected.pass.cpp b/test/std/depr/exception.unexpected/set.unexpected/set_unexpected.pass.cpp index ed02fa618e8e..9b9d726f7f3c 100644 --- a/test/std/depr/exception.unexpected/set.unexpected/set_unexpected.pass.cpp +++ b/test/std/depr/exception.unexpected/set.unexpected/set_unexpected.pass.cpp @@ -7,6 +7,8 @@ // //===----------------------------------------------------------------------===// +// REQUIRES: c++98 || c++03 || c++11 || c++14 + // test set_unexpected #include diff --git a/test/std/depr/exception.unexpected/unexpected.handler/unexpected_handler.pass.cpp b/test/std/depr/exception.unexpected/unexpected.handler/unexpected_handler.pass.cpp index 5879529317ef..f6bc5bc5a68c 100644 --- a/test/std/depr/exception.unexpected/unexpected.handler/unexpected_handler.pass.cpp +++ b/test/std/depr/exception.unexpected/unexpected.handler/unexpected_handler.pass.cpp @@ -7,6 +7,8 @@ // //===----------------------------------------------------------------------===// +// REQUIRES: c++98 || c++03 || c++11 || c++14 + // test unexpected_handler #include diff --git a/test/std/depr/exception.unexpected/unexpected/unexpected.pass.cpp b/test/std/depr/exception.unexpected/unexpected/unexpected.pass.cpp index 03b484f7631a..92d4d38e272b 100644 --- a/test/std/depr/exception.unexpected/unexpected/unexpected.pass.cpp +++ b/test/std/depr/exception.unexpected/unexpected/unexpected.pass.cpp @@ -7,6 +7,8 @@ // //===----------------------------------------------------------------------===// +// REQUIRES: c++98 || c++03 || c++11 || c++14 + // test unexpected #include diff --git a/test/std/diagnostics/syserr/syserr.errcode/syserr.errcode.observers/bool.fail.cpp b/test/std/diagnostics/syserr/syserr.errcode/syserr.errcode.observers/bool.fail.cpp new file mode 100644 index 000000000000..8a9a1a232d0d --- /dev/null +++ b/test/std/diagnostics/syserr/syserr.errcode/syserr.errcode.observers/bool.fail.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. +// +//===----------------------------------------------------------------------===// + +// XFAIL: c++98, c++03 + +// + +// class error_code + +// explicit operator bool() const; + +#include + +bool test_func(void) +{ + const std::error_code ec(0, std::generic_category()); + return ec; // conversion to bool is explicit; should fail. +} + +int main() +{ + return 0; +} + diff --git a/test/std/diagnostics/syserr/syserr.hash/enabled_hash.pass.cpp b/test/std/diagnostics/syserr/syserr.hash/enabled_hash.pass.cpp new file mode 100644 index 000000000000..f1b460575917 --- /dev/null +++ b/test/std/diagnostics/syserr/syserr.hash/enabled_hash.pass.cpp @@ -0,0 +1,27 @@ +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// UNSUPPORTED: c++98, c++03 + +// + +// Test that provides all of the arithmetic, enum, and pointer +// hash specializations. + +#include + +#include "poisoned_hash_helper.hpp" + +int main() { + test_library_hash_specializations_available(); + { + test_hash_enabled_for_type(); + test_hash_enabled_for_type(); + } +} 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 4091f446af27..dac13bdb83c8 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 d455210c2697..eef37c68b6f0 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/algorithms/alg.random.sample/sample.pass.cpp b/test/std/experimental/algorithms/alg.random.sample/sample.pass.cpp index 531731791c5d..23098d83e4ea 100644 --- a/test/std/experimental/algorithms/alg.random.sample/sample.pass.cpp +++ b/test/std/experimental/algorithms/alg.random.sample/sample.pass.cpp @@ -58,19 +58,23 @@ void test() { const unsigned os = Expectations::os; SampleItem oa[os]; const int *oa1 = Expectations::oa1; + ((void)oa1); // Prevent unused warning const int *oa2 = Expectations::oa2; + ((void)oa2); // Prevent unused warning std::minstd_rand g; SampleIterator end; end = std::experimental::sample(PopulationIterator(ia), PopulationIterator(ia + is), SampleIterator(oa), os, g); - assert(end.base() - oa == std::min(os, is)); - assert(std::equal(oa, oa + os, oa1)); + assert(static_cast(end.base() - oa) == std::min(os, is)); + // sample() is deterministic but non-reproducible; + // its results can vary between implementations. + LIBCPP_ASSERT(std::equal(oa, oa + os, oa1)); end = std::experimental::sample(PopulationIterator(ia), PopulationIterator(ia + is), SampleIterator(oa), os, std::move(g)); - assert(end.base() - oa == std::min(os, is)); - assert(std::equal(oa, oa + os, oa2)); + assert(static_cast(end.base() - oa) == std::min(os, is)); + LIBCPP_ASSERT(std::equal(oa, oa + os, oa2)); } template class PopulationIteratorType, class PopulationItem, @@ -119,7 +123,7 @@ void test_small_population() { end = std::experimental::sample(PopulationIterator(ia), PopulationIterator(ia + is), SampleIterator(oa), os, g); - assert(end.base() - oa == std::min(os, is)); + assert(static_cast(end.base() - oa) == std::min(os, is)); assert(std::equal(oa, end.base(), oa1)); } diff --git a/test/std/experimental/filesystem/class.file_status/file_status.cons.pass.cpp b/test/std/experimental/filesystem/class.file_status/file_status.cons.pass.cpp index 585b0bb1dd5e..a744e659f5b5 100644 --- a/test/std/experimental/filesystem/class.file_status/file_status.cons.pass.cpp +++ b/test/std/experimental/filesystem/class.file_status/file_status.cons.pass.cpp @@ -30,8 +30,8 @@ int main() { { static_assert(std::is_nothrow_default_constructible::value, "The default constructor must be noexcept"); - static_assert(!test_convertible(), - "The default constructor must be explicit"); + static_assert(test_convertible(), + "The default constructor must not be explicit"); const file_status f; assert(f.type() == file_type::none); assert(f.permissions() == perms::unknown); diff --git a/test/std/experimental/filesystem/class.path/path.member/path.append.pass.cpp b/test/std/experimental/filesystem/class.path/path.member/path.append.pass.cpp index f344e1153071..a6172d1981cf 100644 --- a/test/std/experimental/filesystem/class.path/path.member/path.append.pass.cpp +++ b/test/std/experimental/filesystem/class.path/path.member/path.append.pass.cpp @@ -131,7 +131,7 @@ void doAppendSourceAllocTest(AppendOperatorTestcase const& TC) assert(LHS == E); } // input iterator - For non-native char types, appends needs to copy the - // iterator range into a contigious block of memory before it can perform the + // iterator range into a contiguous block of memory before it can perform the // code_cvt conversions. // For "char" no allocations will be performed because no conversion is // required. diff --git a/test/std/experimental/filesystem/class.path/path.member/path.assign/braced_init.pass.cpp b/test/std/experimental/filesystem/class.path/path.member/path.assign/braced_init.pass.cpp new file mode 100644 index 000000000000..c5da52f65248 --- /dev/null +++ b/test/std/experimental/filesystem/class.path/path.member/path.assign/braced_init.pass.cpp @@ -0,0 +1,32 @@ +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// UNSUPPORTED: c++98, c++03 + +// + +// class path + +// path& operator=(path const&); + +#include +#include +#include + +#include "test_macros.h" +#include "count_new.hpp" + +namespace fs = std::experimental::filesystem; + +int main() { + using namespace fs; + path p("abc"); + p = {}; + assert(p.native() == ""); +} diff --git a/test/std/experimental/filesystem/class.path/path.member/path.assign/source.pass.cpp b/test/std/experimental/filesystem/class.path/path.member/path.assign/source.pass.cpp index 9e48cbf1e7f2..8c31ef51d944 100644 --- a/test/std/experimental/filesystem/class.path/path.member/path.assign/source.pass.cpp +++ b/test/std/experimental/filesystem/class.path/path.member/path.assign/source.pass.cpp @@ -15,6 +15,7 @@ // template // path& operator=(Source const&); +// path& operator=(string_type&&); // template // path& assign(Source const&); // template @@ -49,7 +50,7 @@ void RunTestCase(MultiStringType const& MS) { const std::basic_string S(TestPath); path p; PathReserve(p, S.length() + 1); { - // string provides a contigious iterator. No allocation needed. + // string provides a contiguous iterator. No allocation needed. DisableAllocationGuard g; path& pref = (p = S); assert(&pref == &p); @@ -75,7 +76,7 @@ void RunTestCase(MultiStringType const& MS) { const std::basic_string_view S(TestPath); path p; PathReserve(p, S.length() + 1); { - // string provides a contigious iterator. No allocation needed. + // string provides a contiguous iterator. No allocation needed. DisableAllocationGuard g; path& pref = (p = S); assert(&pref == &p); @@ -101,7 +102,7 @@ void RunTestCase(MultiStringType const& MS) { { path p; PathReserve(p, Size + 1); { - // char* pointers are contigious and can be used with code_cvt directly. + // char* pointers are contiguous and can be used with code_cvt directly. // no allocations needed. DisableAllocationGuard g; path& pref = (p = TestPath); @@ -213,12 +214,29 @@ void test_sfinae() { } } +void RunStringMoveTest(const char* Expect) { + using namespace fs; + std::string ss(Expect); + path p; + { + DisableAllocationGuard g; ((void)g); + path& pr = (p = std::move(ss)); + assert(&pr == &p); + } + assert(p == Expect); + { + // Signature test + ASSERT_NOEXCEPT(p = std::move(ss)); + } +} + int main() { for (auto const& MS : PathList) { RunTestCase(MS); RunTestCase(MS); RunTestCase(MS); RunTestCase(MS); + RunStringMoveTest(MS); } test_sfinae(); } diff --git a/test/std/experimental/filesystem/class.path/path.member/path.concat.pass.cpp b/test/std/experimental/filesystem/class.path/path.member/path.concat.pass.cpp index 89269362d06f..76df0e9eef76 100644 --- a/test/std/experimental/filesystem/class.path/path.member/path.concat.pass.cpp +++ b/test/std/experimental/filesystem/class.path/path.member/path.concat.pass.cpp @@ -132,7 +132,7 @@ void doConcatSourceAllocTest(ConcatOperatorTestcase const& TC) assert(LHS == E); } // input iterator - For non-native char types, appends needs to copy the - // iterator range into a contigious block of memory before it can perform the + // iterator range into a contiguous block of memory before it can perform the // code_cvt conversions. // For "char" no allocations will be performed because no conversion is // required. 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 4c83481aaf2d..078e006663e9 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/filesystem/class.path/synop.pass.cpp b/test/std/experimental/filesystem/class.path/synop.pass.cpp index b0a7b5cd65e2..883feb287d06 100644 --- a/test/std/experimental/filesystem/class.path/synop.pass.cpp +++ b/test/std/experimental/filesystem/class.path/synop.pass.cpp @@ -32,7 +32,7 @@ int main() { { ASSERT_SAME_TYPE(const path::value_type, decltype(path::preferred_separator)); static_assert(path::preferred_separator == '/', ""); - // Make preferred_separator ODR used by taking it's address. + // Make preferred_separator ODR used by taking its address. const char* dummy = &path::preferred_separator; ((void)dummy); } diff --git a/test/std/experimental/filesystem/class.rec.dir.itr/rec.dir.itr.members/increment.pass.cpp b/test/std/experimental/filesystem/class.rec.dir.itr/rec.dir.itr.members/increment.pass.cpp index e67fc2f20f6e..26fc3ca28d8e 100644 --- a/test/std/experimental/filesystem/class.rec.dir.itr/rec.dir.itr.members/increment.pass.cpp +++ b/test/std/experimental/filesystem/class.rec.dir.itr/rec.dir.itr.members/increment.pass.cpp @@ -175,7 +175,7 @@ TEST_CASE(access_denied_on_recursion_test_case) TEST_CHECK(ec); TEST_CHECK(it == endIt); } - // Same as obove but test operator++(). + // Same as above but test operator++(). { std::error_code ec = GetTestEC(); recursive_directory_iterator it(startDir, ec); @@ -222,7 +222,7 @@ TEST_CASE(access_denied_on_recursion_test_case) TEST_REQUIRE(ec); TEST_REQUIRE(it == endIt); } - // Same as obove but testing the throwing constructors + // Same as above but testing the throwing constructors { TEST_REQUIRE_THROW(filesystem_error, recursive_directory_iterator(permDeniedDir)); diff --git a/test/std/experimental/filesystem/fs.filesystem.synopsis/file_time_type.pass.cpp b/test/std/experimental/filesystem/fs.filesystem.synopsis/file_time_type.pass.cpp index d8d92c5888ac..447fb46e840b 100644 --- a/test/std/experimental/filesystem/fs.filesystem.synopsis/file_time_type.pass.cpp +++ b/test/std/experimental/filesystem/fs.filesystem.synopsis/file_time_type.pass.cpp @@ -18,8 +18,8 @@ #include // system_clock is used because it meets the requirements of TrivialClock, -// and it's resolution and range of system_clock should match the operating -// systems file time type. +// and the resolution and range of system_clock should match the operating +// system's file time type. typedef std::chrono::system_clock ExpectedClock; typedef std::chrono::time_point ExpectedTimePoint; diff --git a/test/std/experimental/filesystem/fs.op.funcs/fs.op.absolute/absolute.pass.cpp b/test/std/experimental/filesystem/fs.op.funcs/fs.op.absolute/absolute.pass.cpp index 4d59235c722b..28e945b68970 100644 --- a/test/std/experimental/filesystem/fs.op.funcs/fs.op.absolute/absolute.pass.cpp +++ b/test/std/experimental/filesystem/fs.op.funcs/fs.op.absolute/absolute.pass.cpp @@ -54,7 +54,7 @@ TEST_CASE(absolute_path_test) TEST_REQUIRE(not p.has_root_name()); TEST_REQUIRE(p.has_root_directory()); TEST_CHECK(p.is_absolute()); - // ensure absolute(base) is not recursivly called + // ensure absolute(base) is not recursively called TEST_REQUIRE(base.has_root_name()); TEST_REQUIRE(base.has_root_directory()); @@ -73,7 +73,7 @@ TEST_CASE(absolute_path_test) TEST_REQUIRE(p.has_root_name()); TEST_REQUIRE(not p.has_root_directory()); TEST_CHECK(not p.is_absolute()); - // absolute is called recursivly on base. The following conditions + // absolute is called recursively on base. The following conditions // must be true for it to return base unmodified TEST_REQUIRE(base.has_root_name()); TEST_REQUIRE(base.has_root_directory()); diff --git a/test/std/experimental/filesystem/fs.op.funcs/fs.op.exists/exists.pass.cpp b/test/std/experimental/filesystem/fs.op.funcs/fs.op.exists/exists.pass.cpp index 252ced6fd65f..2b9f57e7e954 100644 --- a/test/std/experimental/filesystem/fs.op.funcs/fs.op.exists/exists.pass.cpp +++ b/test/std/experimental/filesystem/fs.op.funcs/fs.op.exists/exists.pass.cpp @@ -85,4 +85,13 @@ TEST_CASE(test_exists_fails) TEST_CHECK_THROW(filesystem_error, exists(file)); } +TEST_CASE(test_name_too_long) { + std::string long_name(2500, 'a'); + const path file(long_name); + + std::error_code ec; + TEST_CHECK(exists(file, ec) == false); + TEST_CHECK(ec); +} + TEST_SUITE_END() diff --git a/test/std/experimental/filesystem/fs.op.funcs/fs.op.permissions/permissions.pass.cpp b/test/std/experimental/filesystem/fs.op.funcs/fs.op.permissions/permissions.pass.cpp index 4177392141e5..794aeb992640 100644 --- a/test/std/experimental/filesystem/fs.op.funcs/fs.op.permissions/permissions.pass.cpp +++ b/test/std/experimental/filesystem/fs.op.funcs/fs.op.permissions/permissions.pass.cpp @@ -144,7 +144,7 @@ TEST_CASE(test_no_resolve_symlink_on_symlink) std::error_code expected_ec; #else // On linux symlink permissions are not supported. The error code should - // be 'operation_not_supported' and the sylink permissions should be + // be 'operation_not_supported' and the symlink permissions should be // unchanged. const auto expected_link_perms = symlink_status(sym).permissions(); std::error_code expected_ec = std::make_error_code(std::errc::operation_not_supported); diff --git a/test/std/experimental/filesystem/fs.op.funcs/fs.op.status/status.pass.cpp b/test/std/experimental/filesystem/fs.op.funcs/fs.op.status/status.pass.cpp index 2c76caf74c84..fdc3d2b4a61f 100644 --- a/test/std/experimental/filesystem/fs.op.funcs/fs.op.status/status.pass.cpp +++ b/test/std/experimental/filesystem/fs.op.funcs/fs.op.status/status.pass.cpp @@ -65,29 +65,36 @@ TEST_CASE(test_status_cannot_resolve) const std::error_code set_ec = std::make_error_code(std::errc::address_in_use); - const std::error_code expect_ec = + const std::error_code perm_ec = std::make_error_code(std::errc::permission_denied); + const std::error_code name_too_long_ec = + std::make_error_code(std::errc::filename_too_long); - const path cases[] = { - file, sym + struct TestCase { + path p; + std::error_code expect_ec; + } const TestCases[] = { + {file, perm_ec}, + {sym, perm_ec}, + {path(std::string(2500, 'a')), name_too_long_ec} }; - for (auto& p : cases) + for (auto& TC : TestCases) { { // test non-throwing case std::error_code ec = set_ec; - file_status st = status(p, ec); - TEST_CHECK(ec == expect_ec); + file_status st = status(TC.p, ec); + TEST_CHECK(ec == TC.expect_ec); TEST_CHECK(st.type() == file_type::none); TEST_CHECK(st.permissions() == perms::unknown); } #ifndef TEST_HAS_NO_EXCEPTIONS { // test throwing case try { - status(p); + status(TC.p); } catch (filesystem_error const& err) { - TEST_CHECK(err.path1() == p); + TEST_CHECK(err.path1() == TC.p); TEST_CHECK(err.path2() == ""); - TEST_CHECK(err.code() == expect_ec); + TEST_CHECK(err.code() == TC.expect_ec); } } #endif diff --git a/test/std/experimental/filesystem/fs.op.funcs/fs.op.temp_dir_path/temp_directory_path.pass.cpp b/test/std/experimental/filesystem/fs.op.funcs/fs.op.temp_dir_path/temp_directory_path.pass.cpp index 148564e61961..021dd7fc8160 100644 --- a/test/std/experimental/filesystem/fs.op.funcs/fs.op.temp_dir_path/temp_directory_path.pass.cpp +++ b/test/std/experimental/filesystem/fs.op.funcs/fs.op.temp_dir_path/temp_directory_path.pass.cpp @@ -97,6 +97,14 @@ TEST_CASE(basic_tests) TEST_CHECK(ec == std::make_error_code(std::errc::permission_denied)); TEST_CHECK(ret == ""); + // Set the env variable to point to a non-existent dir + PutEnv(TC.name, TC.p / "does_not_exist"); + ec = GetTestEC(); + ret = temp_directory_path(ec); + TEST_CHECK(ec != GetTestEC()); + TEST_CHECK(ec); + TEST_CHECK(ret == ""); + // Finally erase this env variable UnsetEnv(TC.name); } diff --git a/test/std/experimental/memory/memory.polymorphic.allocator.class/memory.polymorphic.allocator.mem/construct_types.pass.cpp b/test/std/experimental/memory/memory.polymorphic.allocator.class/memory.polymorphic.allocator.mem/construct_types.pass.cpp index a02dcf336960..3e83173555be 100644 --- a/test/std/experimental/memory/memory.polymorphic.allocator.class/memory.polymorphic.allocator.mem/construct_types.pass.cpp +++ b/test/std/experimental/memory/memory.polymorphic.allocator.class/memory.polymorphic.allocator.mem/construct_types.pass.cpp @@ -120,7 +120,7 @@ void test_pmr_uses_alloc(Args&&... args) } { // Test that T(std::allocator_arg_t, Alloc const&, Args...) construction - // is prefered when T(Args..., Alloc const&) is also available. + // is preferred when T(Args..., Alloc const&) is also available. using T = UsesAllocatorV3; assert((doTest(UA_AllocArg, std::forward(args)...))); } diff --git a/test/std/experimental/numeric/numeric.ops/numeric.ops.gcd/gcd.bool1.fail.cpp b/test/std/experimental/numeric/numeric.ops/numeric.ops.gcd/gcd.bool1.fail.cpp new file mode 100644 index 000000000000..c8d6c5367d7e --- /dev/null +++ b/test/std/experimental/numeric/numeric.ops/numeric.ops.gcd/gcd.bool1.fail.cpp @@ -0,0 +1,25 @@ +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual 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 +// constexpr common_type_t<_M,_N> gcd(_M __m, _N __n) + +// Remarks: If either M or N is not an integer type, +// or if either is (a possibly cv-qualified) bool, the program is ill-formed. + +#include + + +int main() +{ + std::experimental::gcd(false, 4); +} diff --git a/test/std/experimental/numeric/numeric.ops/numeric.ops.gcd/gcd.bool2.fail.cpp b/test/std/experimental/numeric/numeric.ops/numeric.ops.gcd/gcd.bool2.fail.cpp new file mode 100644 index 000000000000..a3a2206fba63 --- /dev/null +++ b/test/std/experimental/numeric/numeric.ops/numeric.ops.gcd/gcd.bool2.fail.cpp @@ -0,0 +1,25 @@ +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual 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 +// constexpr common_type_t<_M,_N> gcd(_M __m, _N __n) + +// Remarks: If either M or N is not an integer type, +// or if either is (a possibly cv-qualified) bool, the program is ill-formed. + +#include + + +int main() +{ + std::experimental::gcd(2, true); +} diff --git a/test/std/experimental/numeric/numeric.ops/numeric.ops.gcd/gcd.bool3.fail.cpp b/test/std/experimental/numeric/numeric.ops/numeric.ops.gcd/gcd.bool3.fail.cpp new file mode 100644 index 000000000000..1f04580ddabd --- /dev/null +++ b/test/std/experimental/numeric/numeric.ops/numeric.ops.gcd/gcd.bool3.fail.cpp @@ -0,0 +1,25 @@ +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual 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 +// constexpr common_type_t<_M,_N> gcd(_M __m, _N __n) + +// Remarks: If either M or N is not an integer type, +// or if either is (a possibly cv-qualified) bool, the program is ill-formed. + +#include + + +int main() +{ + std::experimental::gcd(false, 4); +} diff --git a/test/std/experimental/numeric/numeric.ops/numeric.ops.gcd/gcd.bool4.fail.cpp b/test/std/experimental/numeric/numeric.ops/numeric.ops.gcd/gcd.bool4.fail.cpp new file mode 100644 index 000000000000..1f0e8a2b3a2f --- /dev/null +++ b/test/std/experimental/numeric/numeric.ops/numeric.ops.gcd/gcd.bool4.fail.cpp @@ -0,0 +1,25 @@ +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual 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 +// constexpr common_type_t<_M,_N> gcd(_M __m, _N __n) + +// Remarks: If either M or N is not an integer type, +// or if either is (a possibly cv-qualified) bool, the program is ill-formed. + +#include + + +int main() +{ + std::experimental::gcd(2, true); +} diff --git a/test/std/experimental/numeric/numeric.ops/numeric.ops.gcd/gcd.pass.cpp b/test/std/experimental/numeric/numeric.ops/numeric.ops.gcd/gcd.pass.cpp index a52b50b391cd..3f86cfe4c7f0 100644 --- a/test/std/experimental/numeric/numeric.ops/numeric.ops.gcd/gcd.pass.cpp +++ b/test/std/experimental/numeric/numeric.ops/numeric.ops.gcd/gcd.pass.cpp @@ -129,4 +129,11 @@ int main() assert((do_test(non_cce))); assert((do_test(non_cce))); assert((do_test(non_cce))); + +// LWG#2792 + { + auto res = std::experimental::gcd((int64_t)1234, (int32_t)-2147483648); + static_assert( std::is_same::type>::value, ""); + assert(res == 2); + } } diff --git a/test/std/experimental/numeric/numeric.ops/numeric.ops.lcm/lcm.bool1.fail.cpp b/test/std/experimental/numeric/numeric.ops/numeric.ops.lcm/lcm.bool1.fail.cpp new file mode 100644 index 000000000000..e4c2ed8bf539 --- /dev/null +++ b/test/std/experimental/numeric/numeric.ops/numeric.ops.lcm/lcm.bool1.fail.cpp @@ -0,0 +1,25 @@ +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual 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 +// constexpr common_type_t<_M,_N> lcm(_M __m, _N __n) + +// Remarks: If either M or N is not an integer type, +// or if either is (a possibly cv-qualified) bool, the program is ill-formed. + +#include + + +int main() +{ + std::experimental::lcm(false, 4); +} diff --git a/test/std/experimental/numeric/numeric.ops/numeric.ops.lcm/lcm.bool2.fail.cpp b/test/std/experimental/numeric/numeric.ops/numeric.ops.lcm/lcm.bool2.fail.cpp new file mode 100644 index 000000000000..097b23eae6e4 --- /dev/null +++ b/test/std/experimental/numeric/numeric.ops/numeric.ops.lcm/lcm.bool2.fail.cpp @@ -0,0 +1,25 @@ +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual 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 +// constexpr common_type_t<_M,_N> lcm(_M __m, _N __n) + +// Remarks: If either M or N is not an integer type, +// or if either is (a possibly cv-qualified) bool, the program is ill-formed. + +#include + + +int main() +{ + std::experimental::lcm(2, true); +} diff --git a/test/std/experimental/numeric/numeric.ops/numeric.ops.lcm/lcm.bool3.fail.cpp b/test/std/experimental/numeric/numeric.ops/numeric.ops.lcm/lcm.bool3.fail.cpp new file mode 100644 index 000000000000..d5e6300818cc --- /dev/null +++ b/test/std/experimental/numeric/numeric.ops/numeric.ops.lcm/lcm.bool3.fail.cpp @@ -0,0 +1,25 @@ +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual 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 +// constexpr common_type_t<_M,_N> lcm(_M __m, _N __n) + +// Remarks: If either M or N is not an integer type, +// or if either is (a possibly cv-qualified) bool, the program is ill-formed. + +#include + + +int main() +{ + std::experimental::lcm(false, 4); +} diff --git a/test/std/experimental/numeric/numeric.ops/numeric.ops.lcm/lcm.bool4.fail.cpp b/test/std/experimental/numeric/numeric.ops/numeric.ops.lcm/lcm.bool4.fail.cpp new file mode 100644 index 000000000000..d88c490d64bf --- /dev/null +++ b/test/std/experimental/numeric/numeric.ops/numeric.ops.lcm/lcm.bool4.fail.cpp @@ -0,0 +1,25 @@ +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual 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 +// constexpr common_type_t<_M,_N> lcm(_M __m, _N __n) + +// Remarks: If either M or N is not an integer type, +// or if either is (a possibly cv-qualified) bool, the program is ill-formed. + +#include + + +int main() +{ + std::experimental::lcm(2, true); +} diff --git a/test/std/experimental/numeric/numeric.ops/numeric.ops.lcm/lcm.pass.cpp b/test/std/experimental/numeric/numeric.ops/numeric.ops.lcm/lcm.pass.cpp index e3c109f7447b..fd463e88e63f 100644 --- a/test/std/experimental/numeric/numeric.ops/numeric.ops.lcm/lcm.pass.cpp +++ b/test/std/experimental/numeric/numeric.ops/numeric.ops.lcm/lcm.pass.cpp @@ -128,4 +128,12 @@ int main() assert((do_test(non_cce))); assert((do_test(non_cce))); assert((do_test(non_cce))); + +// LWG#2792 + { + auto res1 = std::experimental::lcm((int64_t)1234, (int32_t)-2147483648); + (void) std::experimental::lcm(INT_MIN, 2); // this used to trigger UBSAN + static_assert( std::is_same::type>::value, ""); + assert(res1 == 1324997410816LL); + } } diff --git a/test/std/experimental/string.view/lit.local.cfg b/test/std/experimental/string.view/lit.local.cfg new file mode 100644 index 000000000000..376dbe7c16ec --- /dev/null +++ b/test/std/experimental/string.view/lit.local.cfg @@ -0,0 +1,3 @@ +# Disable all of the filesystem tests if the correct feature is not available. +if 'msvc' in config.available_features: + config.unsupported = True diff --git a/test/std/experimental/string.view/string.view.access/at.pass.cpp b/test/std/experimental/string.view/string.view.access/at.pass.cpp index 7ceaf5ab3d9f..eaea062987fb 100644 --- a/test/std/experimental/string.view/string.view.access/at.pass.cpp +++ b/test/std/experimental/string.view/string.view.access/at.pass.cpp @@ -7,7 +7,7 @@ // //===----------------------------------------------------------------------===// -// NOTE: Older versions of clang have a bug where they fail to evalute +// NOTE: Older versions of clang have a bug where they fail to evaluate // string_view::at as a constant expression. // XFAIL: clang-3.4, clang-3.3 diff --git a/test/std/experimental/utilities/tuple/tuple.apply/extended_types.pass.cpp b/test/std/experimental/utilities/tuple/tuple.apply/extended_types.pass.cpp index 0c5170f29cea..57dff44976bc 100644 --- a/test/std/experimental/utilities/tuple/tuple.apply/extended_types.pass.cpp +++ b/test/std/experimental/utilities/tuple/tuple.apply/extended_types.pass.cpp @@ -13,7 +13,7 @@ // template constexpr decltype(auto) apply(F &&, T &&) -// Testing extended function types. The extented function types are those +// Testing extended function types. The extended function types are those // named by INVOKE but that are not actual callable objects. These include // bullets 1-4 of invoke. diff --git a/test/std/input.output/file.streams/c.files/cstdio.pass.cpp b/test/std/input.output/file.streams/c.files/cstdio.pass.cpp index 5df8691ef1f9..1f1b0c3faa5b 100644 --- a/test/std/input.output/file.streams/c.files/cstdio.pass.cpp +++ b/test/std/input.output/file.streams/c.files/cstdio.pass.cpp @@ -89,7 +89,7 @@ int main() { std::FILE* fp = 0; - std::fpos_t fpos = {}; + std::fpos_t fpos = std::fpos_t(); std::size_t s = 0; char* cp = 0; std::va_list va; 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 ed68279d7b57..3095712b9dbc 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 @@ -12,7 +12,7 @@ // basic_istream& // ignore(streamsize n = 1, int_type delim = traits::eof()); -// http://llvm.org/bugs/show_bug.cgi?id=16427 +// https://bugs.llvm.org/show_bug.cgi?id=16427 #include #include 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 e68fb774335d..e09c0ed20461 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 @@ -23,6 +23,7 @@ #include #include +#include #include #include #include @@ -66,11 +67,15 @@ int main() test_octal("1777777777777777777777"); test_octal< int64_t>("1777777777777777777777"); test_octal("1777777777777777777777"); - if (sizeof(long) == sizeof(int64_t)) { + + 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_64) { test_octal< unsigned long>("1777777777777777777777"); test_octal< long>("1777777777777777777777"); } - if (sizeof(long long) == sizeof(int64_t)) { + if (long_long_is_64) { test_octal< unsigned long long>("1777777777777777777777"); test_octal< long long>("1777777777777777777777"); } @@ -81,11 +86,11 @@ int main() test_dec< int32_t>( "-1"); test_dec("18446744073709551615"); test_dec< int64_t>( "-1"); - if (sizeof(long) == sizeof(int64_t)) { + if (long_is_64) { test_dec("18446744073709551615"); test_dec< long>( "-1"); } - if (sizeof(long long) == sizeof(int64_t)) { + if (long_long_is_64) { test_dec("18446744073709551615"); test_dec< long long>( "-1"); } @@ -96,11 +101,11 @@ int main() test_hex< int32_t>( "FFFFFFFF"); test_hex("FFFFFFFFFFFFFFFF"); test_hex< int64_t>("FFFFFFFFFFFFFFFF"); - if (sizeof(long) == sizeof(int64_t)) { + if (long_is_64) { test_hex("FFFFFFFFFFFFFFFF"); test_hex< long>("FFFFFFFFFFFFFFFF"); } - if (sizeof(long long) == sizeof(int64_t)) { + if (long_long_is_64) { test_hex("FFFFFFFFFFFFFFFF"); test_hex< long long>("FFFFFFFFFFFFFFFF"); } diff --git a/test/std/input.output/iostream.format/output.streams/ostream.seeks/seekp.pass.cpp b/test/std/input.output/iostream.format/output.streams/ostream.seeks/seekp.pass.cpp index ec3fe48866c7..bed0d72af809 100644 --- a/test/std/input.output/iostream.format/output.streams/ostream.seeks/seekp.pass.cpp +++ b/test/std/input.output/iostream.format/output.streams/ostream.seeks/seekp.pass.cpp @@ -56,7 +56,7 @@ int main() assert(seekpos_called == 2); assert(os.fail()); } - { // See https://llvm.org/bugs/show_bug.cgi?id=21361 + { // See https://bugs.llvm.org/show_bug.cgi?id=21361 seekpos_called = 0; testbuf sb; std::ostream os(&sb); diff --git a/test/std/input.output/iostream.format/output.streams/ostream.seeks/seekp2.pass.cpp b/test/std/input.output/iostream.format/output.streams/ostream.seeks/seekp2.pass.cpp index ebfd24af91d5..eb76cbf9d28a 100644 --- a/test/std/input.output/iostream.format/output.streams/ostream.seeks/seekp2.pass.cpp +++ b/test/std/input.output/iostream.format/output.streams/ostream.seeks/seekp2.pass.cpp @@ -58,7 +58,7 @@ int main() assert(seekoff_called == 2); assert(os.fail()); } - { // See https://llvm.org/bugs/show_bug.cgi?id=21361 + { // See https://bugs.llvm.org/show_bug.cgi?id=21361 seekoff_called = 0; testbuf sb; std::ostream os(&sb); diff --git a/test/std/input.output/iostream.format/quoted.manip/quoted_char.fail.cpp b/test/std/input.output/iostream.format/quoted.manip/quoted_char.fail.cpp index c9fccea2c7d0..6b550b5dabe4 100644 --- a/test/std/input.output/iostream.format/quoted.manip/quoted_char.fail.cpp +++ b/test/std/input.output/iostream.format/quoted.manip/quoted_char.fail.cpp @@ -18,7 +18,7 @@ #include "test_macros.h" -// Test that mismatches between strings and wides streams are diagnosed +// Test that mismatches between strings and wide streams are diagnosed #if TEST_STD_VER > 11 diff --git a/test/std/input.output/iostreams.base/ios.base/ios.base.storage/iword.pass.cpp b/test/std/input.output/iostreams.base/ios.base/ios.base.storage/iword.pass.cpp index 1e2ee50632af..59f0bd478760 100644 --- a/test/std/input.output/iostreams.base/ios.base/ios.base.storage/iword.pass.cpp +++ b/test/std/input.output/iostreams.base/ios.base/ios.base.storage/iword.pass.cpp @@ -13,6 +13,9 @@ // long& iword(int idx); +// This test compiles but never completes when compiled against the MSVC STL +// UNSUPPORTED: msvc + #include #include #include diff --git a/test/std/input.output/iostreams.base/ios.base/ios.base.storage/pword.pass.cpp b/test/std/input.output/iostreams.base/ios.base/ios.base.storage/pword.pass.cpp index 5246ad8f644c..45115823b4c2 100644 --- a/test/std/input.output/iostreams.base/ios.base/ios.base.storage/pword.pass.cpp +++ b/test/std/input.output/iostreams.base/ios.base/ios.base.storage/pword.pass.cpp @@ -13,6 +13,9 @@ // void*& pword(int idx); +// This test compiles but never completes when compiled against the MSVC STL +// UNSUPPORTED: msvc + #include #include #include diff --git a/test/std/iterators/predef.iterators/insert.iterators/back.insert.iter.ops/back.insert.iter.op=/rv_value.pass.cpp b/test/std/iterators/predef.iterators/insert.iterators/back.insert.iter.ops/back.insert.iter.op=/rv_value.pass.cpp index a3c11f7881a9..d5df1b7c094e 100644 --- a/test/std/iterators/predef.iterators/insert.iterators/back.insert.iter.ops/back.insert.iter.op=/rv_value.pass.cpp +++ b/test/std/iterators/predef.iterators/insert.iterators/back.insert.iter.ops/back.insert.iter.op=/rv_value.pass.cpp @@ -7,6 +7,8 @@ // //===----------------------------------------------------------------------===// +// UNSUPPORTED: c++98, c++03 + // // back_insert_iterator @@ -17,8 +19,6 @@ #include -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES - #include #include #include @@ -32,11 +32,7 @@ test(C c) assert(c.back() == typename C::value_type()); } -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES - int main() { -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES test(std::vector >()); -#endif } diff --git a/test/std/iterators/predef.iterators/insert.iterators/front.insert.iter.ops/front.insert.iter.op=/rv_value.pass.cpp b/test/std/iterators/predef.iterators/insert.iterators/front.insert.iter.ops/front.insert.iter.op=/rv_value.pass.cpp index bd2bd44837ab..af880f871ff5 100644 --- a/test/std/iterators/predef.iterators/insert.iterators/front.insert.iter.ops/front.insert.iter.op=/rv_value.pass.cpp +++ b/test/std/iterators/predef.iterators/insert.iterators/front.insert.iter.ops/front.insert.iter.op=/rv_value.pass.cpp @@ -7,6 +7,8 @@ // //===----------------------------------------------------------------------===// +// UNSUPPORTED: c++98, c++03 + // // front_insert_iterator @@ -15,9 +17,6 @@ // operator=(Cont::value_type&& value); #include - -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES - #include #include #include @@ -31,11 +30,7 @@ test(C c) assert(c.front() == typename C::value_type()); } -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES - int main() { -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES test(std::list >()); -#endif } diff --git a/test/std/iterators/predef.iterators/insert.iterators/insert.iter.ops/insert.iter.op=/rv_value.pass.cpp b/test/std/iterators/predef.iterators/insert.iterators/insert.iter.ops/insert.iter.op=/rv_value.pass.cpp index f771688f1adc..ad1fa29ac7cf 100644 --- a/test/std/iterators/predef.iterators/insert.iterators/insert.iter.ops/insert.iter.op=/rv_value.pass.cpp +++ b/test/std/iterators/predef.iterators/insert.iterators/insert.iter.ops/insert.iter.op=/rv_value.pass.cpp @@ -7,6 +7,8 @@ // //===----------------------------------------------------------------------===// +// UNSUPPORTED: c++98, c++03 + // // insert_iterator @@ -17,7 +19,6 @@ #include -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES #include #include #include @@ -52,11 +53,8 @@ struct do_nothing void operator()(void*) const {} }; -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES - int main() { -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES { typedef std::unique_ptr Ptr; typedef std::vector C; @@ -94,5 +92,4 @@ int main() insert3at(c2, c2.begin()+3, Ptr(x+3), Ptr(x+4), Ptr(x+5)); test(std::move(c1), 3, Ptr(x+3), Ptr(x+4), Ptr(x+5), c2); } -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES } diff --git a/test/std/iterators/stream.iterators/istream.iterator/istream.iterator.cons/copy.pass.cpp b/test/std/iterators/stream.iterators/istream.iterator/istream.iterator.cons/copy.pass.cpp index 7f807b63e3ce..fc6dc0009a0d 100644 --- a/test/std/iterators/stream.iterators/istream.iterator/istream.iterator.cons/copy.pass.cpp +++ b/test/std/iterators/stream.iterators/istream.iterator/istream.iterator.cons/copy.pass.cpp @@ -13,7 +13,7 @@ // istream_iterator(const istream_iterator& x); // C++17 says: If is_trivially_copy_constructible_v is true, then -// this constructor shall beis a trivial copy constructor. +// this constructor is a trivial copy constructor. #include #include diff --git a/test/std/iterators/stream.iterators/istream.iterator/istream.iterator.cons/default.pass.cpp b/test/std/iterators/stream.iterators/istream.iterator/istream.iterator.cons/default.pass.cpp index 32dc62817bc4..22f2967f3281 100644 --- a/test/std/iterators/stream.iterators/istream.iterator/istream.iterator.cons/default.pass.cpp +++ b/test/std/iterators/stream.iterators/istream.iterator/istream.iterator.cons/default.pass.cpp @@ -8,8 +8,8 @@ //===----------------------------------------------------------------------===// // Usage of is_trivially_constructible is broken with these compilers. -// See https://llvm.org/bugs/show_bug.cgi?id=31016 -// XFAIL: clang-3.7, apple-clang-7, apple-clang-7.0 +// See https://bugs.llvm.org/show_bug.cgi?id=31016 +// XFAIL: clang-3.7, apple-clang-7 && c++1z // @@ -17,7 +17,7 @@ // constexpr istream_iterator(); // C++17 says: If is_trivially_default_constructible_v is true, then this -// constructor shall beis a constexpr constructor. +// constructor is a constexpr constructor. #include #include 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 b1bf75b11958..a680aa3f499b 100644 --- a/test/std/iterators/stream.iterators/istream.iterator/types.pass.cpp +++ b/test/std/iterators/stream.iterators/istream.iterator/types.pass.cpp @@ -29,11 +29,11 @@ // If T is a literal type, then this destructor shall be a trivial destructor. // C++17 says: // If is_trivially_default_constructible_v is true, then -// this constructor (the default ctor) shall beis a constexpr constructor. +// this constructor (the default ctor) is a constexpr constructor. // If is_trivially_copy_constructible_v is true, then -// this constructor (the copy ctor) shall beis a trivial copy constructor. +// this constructor (the copy ctor) is a trivial copy constructor. // If is_trivially_destructible_v is true, then this -// destructor shall beis a trivial destructor. +// destructor is a trivial destructor. // Testing the C++17 ctors for this are in the ctor tests. #include 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 28da3093f398..ec5d0a445baa 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 @@ -29,7 +29,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); @@ -44,7 +44,7 @@ struct alignas(OverAligned) A }; void test_max_alloc() { - std::set_new_handler(new_handler); + std::set_new_handler(my_new_handler); auto do_test = []() { void* vp = operator new [](std::numeric_limits::max(), std::align_val_t(OverAligned), diff --git a/test/std/language.support/support.dynamic/new.delete/new.delete.array/new_array.pass.cpp b/test/std/language.support/support.dynamic/new.delete/new.delete.array/new_array.pass.cpp index dd4ff46bceb9..5aecc2da0847 100644 --- a/test/std/language.support/support.dynamic/new.delete/new.delete.array/new_array.pass.cpp +++ b/test/std/language.support/support.dynamic/new.delete/new.delete.array/new_array.pass.cpp @@ -21,7 +21,7 @@ int new_handler_called = 0; -void new_handler() +void my_new_handler() { ++new_handler_called; std::set_new_handler(0); @@ -38,7 +38,7 @@ struct A int main() { #ifndef TEST_HAS_NO_EXCEPTIONS - std::set_new_handler(new_handler); + std::set_new_handler(my_new_handler); try { void* volatile vp = operator new[] (std::numeric_limits::max()); diff --git a/test/std/language.support/support.dynamic/new.delete/new.delete.array/new_array_nothrow.pass.cpp b/test/std/language.support/support.dynamic/new.delete/new.delete.array/new_array_nothrow.pass.cpp index 2f51b1990436..c1606b27da79 100644 --- a/test/std/language.support/support.dynamic/new.delete/new.delete.array/new_array_nothrow.pass.cpp +++ b/test/std/language.support/support.dynamic/new.delete/new.delete.array/new_array_nothrow.pass.cpp @@ -21,7 +21,7 @@ int new_handler_called = 0; -void new_handler() +void my_new_handler() { ++new_handler_called; std::set_new_handler(0); @@ -37,7 +37,7 @@ struct A int main() { - std::set_new_handler(new_handler); + std::set_new_handler(my_new_handler); #ifndef TEST_HAS_NO_EXCEPTIONS try #endif diff --git a/test/std/language.support/support.dynamic/new.delete/new.delete.array/sized_delete_array_calls_unsized_delete_array.pass.cpp b/test/std/language.support/support.dynamic/new.delete/new.delete.array/sized_delete_array_calls_unsized_delete_array.pass.cpp index ff55ec74e3cd..3925f2f5c313 100644 --- a/test/std/language.support/support.dynamic/new.delete/new.delete.array/sized_delete_array_calls_unsized_delete_array.pass.cpp +++ b/test/std/language.support/support.dynamic/new.delete/new.delete.array/sized_delete_array_calls_unsized_delete_array.pass.cpp @@ -46,9 +46,11 @@ void operator delete[](void* p, const std::nothrow_t&) TEST_NOEXCEPT // selected. struct A { ~A() {} }; +A *volatile x; + int main() { - A* x = new A[3]; + x = new A[3]; assert(0 == delete_called); assert(0 == delete_nothrow_called); diff --git a/test/std/language.support/support.dynamic/new.delete/new.delete.single/new.pass.cpp b/test/std/language.support/support.dynamic/new.delete/new.delete.single/new.pass.cpp index 26f7bc392c79..df002c60a6bb 100644 --- a/test/std/language.support/support.dynamic/new.delete/new.delete.single/new.pass.cpp +++ b/test/std/language.support/support.dynamic/new.delete/new.delete.single/new.pass.cpp @@ -21,7 +21,7 @@ int new_handler_called = 0; -void new_handler() +void my_new_handler() { ++new_handler_called; std::set_new_handler(0); @@ -38,7 +38,7 @@ struct A int main() { #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.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 fefae51dac93..5ebbc8a1a2d9 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 @@ -29,7 +29,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 +45,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.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 ca8503e8854d..6e2eca314771 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 @@ -29,7 +29,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); @@ -44,7 +44,7 @@ struct alignas(OverAligned) A }; void test_max_alloc() { - std::set_new_handler(new_handler); + std::set_new_handler(my_new_handler); auto do_test = []() { void* vp = operator new (std::numeric_limits::max(), std::align_val_t(OverAligned), diff --git a/test/std/language.support/support.dynamic/new.delete/new.delete.single/new_nothrow.pass.cpp b/test/std/language.support/support.dynamic/new.delete/new.delete.single/new_nothrow.pass.cpp index 757e8ae18a47..d85db6c499e9 100644 --- a/test/std/language.support/support.dynamic/new.delete/new.delete.single/new_nothrow.pass.cpp +++ b/test/std/language.support/support.dynamic/new.delete/new.delete.single/new_nothrow.pass.cpp @@ -21,7 +21,7 @@ int new_handler_called = 0; -void new_handler() +void my_new_handler() { ++new_handler_called; std::set_new_handler(0); @@ -37,7 +37,7 @@ struct A int main() { - std::set_new_handler(new_handler); + std::set_new_handler(my_new_handler); #ifndef TEST_HAS_NO_EXCEPTIONS try #endif diff --git a/test/std/language.support/support.dynamic/new.delete/new.delete.single/new_replace.pass.cpp b/test/std/language.support/support.dynamic/new.delete/new.delete.single/new_replace.pass.cpp index ad15b49483d0..ea6c9367b903 100644 --- a/test/std/language.support/support.dynamic/new.delete/new.delete.single/new_replace.pass.cpp +++ b/test/std/language.support/support.dynamic/new.delete/new.delete.single/new_replace.pass.cpp @@ -43,9 +43,11 @@ struct A ~A() {A_constructed = false;} }; +A *volatile ap; + int main() { - A* ap = new A; + ap = new A; assert(ap); assert(A_constructed); assert(new_called); diff --git a/test/std/language.support/support.dynamic/new.delete/new.delete.single/sized_delete11.pass.cpp b/test/std/language.support/support.dynamic/new.delete/new.delete.single/sized_delete11.pass.cpp index 7369c362fce2..57fb1eb88b6e 100644 --- a/test/std/language.support/support.dynamic/new.delete/new.delete.single/sized_delete11.pass.cpp +++ b/test/std/language.support/support.dynamic/new.delete/new.delete.single/sized_delete11.pass.cpp @@ -44,9 +44,11 @@ void operator delete(void* p, std::size_t) TEST_NOEXCEPT std::free(p); } +int *volatile x; + int main() { - int *x = new int(42); + x = new int(42); assert(0 == unsized_delete_called); assert(0 == unsized_delete_nothrow_called); assert(0 == sized_delete_called); diff --git a/test/std/language.support/support.dynamic/new.delete/new.delete.single/sized_delete14.pass.cpp b/test/std/language.support/support.dynamic/new.delete/new.delete.single/sized_delete14.pass.cpp index 6c91f5ceda86..b85b670fa2d4 100644 --- a/test/std/language.support/support.dynamic/new.delete/new.delete.single/sized_delete14.pass.cpp +++ b/test/std/language.support/support.dynamic/new.delete/new.delete.single/sized_delete14.pass.cpp @@ -49,9 +49,11 @@ void operator delete(void* p, std::size_t) TEST_NOEXCEPT std::free(p); } +int *volatile x; + int main() { - int *x = new int(42); + x = new int(42); assert(0 == unsized_delete_called); assert(0 == unsized_delete_nothrow_called); assert(0 == sized_delete_called); 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 1b6de2367e10..61fca5f125bf 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 @@ -17,7 +17,7 @@ // NOTE: Only clang-3.7 and GCC 5.1 and greater support -fsized-deallocation. // REQUIRES: fsized-deallocation -// RUN: %build -fsized-deallocation +// RUN: %build -fsized-deallocation -O3 // RUN: %run #if !defined(__cpp_sized_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 57d193a411cc..68cd85038b28 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 @@ -46,12 +46,19 @@ public: C * operator&() const { assert(false); } // should not be called }; +class D : private std::nested_exception {}; + + +class E1 : public std::nested_exception {}; +class E2 : public std::nested_exception {}; +class E : public E1, public E2 {}; + int main() { { try { - A a(3); + A a(3); // not a polymorphic type --> no effect std::rethrow_if_nested(a); assert(true); } @@ -60,6 +67,30 @@ int main() assert(false); } } + { + try + { + D s; // inaccessible base class --> no effect + std::rethrow_if_nested(s); + assert(true); + } + catch (...) + { + assert(false); + } + } + { + try + { + E s; // ambiguous base class --> no effect + std::rethrow_if_nested(s); + assert(true); + } + catch (...) + { + assert(false); + } + } { try { 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 a86d8bcbe201..26be4db38fba 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 * s) + { + } + } #if TEST_STD_VER > 11 { try 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 000000000000..aed44f91218f --- /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 000000000000..dec241eb0c41 --- /dev/null +++ b/test/std/language.support/support.types/byteops/and.assign.pass.cpp @@ -0,0 +1,42 @@ +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +#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 + +// 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{1}; + constexpr std::byte b8{8}; + constexpr std::byte b9{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 000000000000..22da6e3e0d4c --- /dev/null +++ b/test/std/language.support/support.types/byteops/and.pass.cpp @@ -0,0 +1,34 @@ +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +#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 + +// constexpr byte operator&(byte l, byte r) noexcept; + +int main () { + constexpr std::byte b1{1}; + constexpr std::byte b8{8}; + constexpr std::byte b9{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/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 000000000000..298edb22d249 --- /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 000000000000..f7e0dee9c6bb --- /dev/null +++ b/test/std/language.support/support.types/byteops/lshift.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 +// 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; + } + + +int main () { + std::byte b; // not constexpr, just used in noexcept check + constexpr std::byte b2{2}; + constexpr std::byte b3{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 000000000000..c950329334be --- /dev/null +++ b/test/std/language.support/support.types/byteops/lshift.fail.cpp @@ -0,0 +1,26 @@ +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +#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; +// These functions shall not participate in overload resolution unless +// is_integral_v is true. + +int main () { + constexpr std::byte b1{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 000000000000..b4a8325199ff --- /dev/null +++ b/test/std/language.support/support.types/byteops/lshift.pass.cpp @@ -0,0 +1,33 @@ +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +#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; +// These functions shall not participate in overload resolution unless +// is_integral_v is true. + +int main () { + constexpr std::byte b1{1}; + constexpr std::byte b3{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 000000000000..734780f194a0 --- /dev/null +++ b/test/std/language.support/support.types/byteops/not.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 +// 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 + +// constexpr byte operator~(byte b) noexcept; + +int main () { + constexpr std::byte b1{1}; + constexpr std::byte b2{2}; + constexpr std::byte b8{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 000000000000..75d6ab4d0a9d --- /dev/null +++ b/test/std/language.support/support.types/byteops/or.assign.pass.cpp @@ -0,0 +1,43 @@ +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +#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 + +// 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{1}; + constexpr std::byte b2{2}; + constexpr std::byte b8{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 000000000000..02c547f1dbb6 --- /dev/null +++ b/test/std/language.support/support.types/byteops/or.pass.cpp @@ -0,0 +1,34 @@ +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +#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 + +// constexpr byte operator|(byte l, byte r) noexcept; + +int main () { + constexpr std::byte b1{1}; + constexpr std::byte b2{2}; + constexpr std::byte b8{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 000000000000..3a0c218aff82 --- /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 000000000000..5b970258f5e0 --- /dev/null +++ b/test/std/language.support/support.types/byteops/rshift.assign.pass.cpp @@ -0,0 +1,38 @@ +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +#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; + } + + +int main () { + std::byte b; // not constexpr, just used in noexcept check + constexpr std::byte b16{16}; + constexpr std::byte b192{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 000000000000..14e2fcfa1301 --- /dev/null +++ b/test/std/language.support/support.types/byteops/rshift.fail.cpp @@ -0,0 +1,26 @@ +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +#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; +// These functions shall not participate in overload resolution unless +// is_integral_v is true. + +int main () { + constexpr std::byte b1{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 000000000000..5ff986a70ade --- /dev/null +++ b/test/std/language.support/support.types/byteops/rshift.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 +// 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; +// 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{100}; + constexpr std::byte b115{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 000000000000..8832e506a118 --- /dev/null +++ b/test/std/language.support/support.types/byteops/to_integer.fail.cpp @@ -0,0 +1,26 @@ +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +#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 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{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 000000000000..4aca0be82deb --- /dev/null +++ b/test/std/language.support/support.types/byteops/to_integer.pass.cpp @@ -0,0 +1,34 @@ +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +#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 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{1}; + constexpr std::byte b3{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 000000000000..c9b40177a17c --- /dev/null +++ b/test/std/language.support/support.types/byteops/xor.assign.pass.cpp @@ -0,0 +1,42 @@ +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +#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 + +// 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{1}; + constexpr std::byte b8{8}; + constexpr std::byte b9{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 000000000000..3d0402b30a55 --- /dev/null +++ b/test/std/language.support/support.types/byteops/xor.pass.cpp @@ -0,0 +1,34 @@ +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +#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 + +// constexpr byte operator^(byte l, byte r) noexcept; + +int main () { + constexpr std::byte b1{1}; + constexpr std::byte b8{8}; + constexpr std::byte b9{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 044ba2b976cb..2e2e97361994 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=x86_64-apple-macosx10.7 +// XFAIL: with_system_cxx_lib=x86_64-apple-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 4488e9c3f73b..94e45302f10b 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,8 +15,8 @@ // charT tolower(charT) const; -// 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-macosx10.7 +// XFAIL: with_system_cxx_lib=x86_64-apple-macosx10.8 #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 0c224e342fa9..d97dc5747e54 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,8 +15,8 @@ // 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 +// XFAIL: with_system_cxx_lib=x86_64-apple-macosx10.7 +// XFAIL: with_system_cxx_lib=x86_64-apple-macosx10.8 #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 0985de5007d6..d2ad328268f1 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,8 +15,8 @@ // charT toupper(charT) const; -// 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-macosx10.7 +// XFAIL: with_system_cxx_lib=x86_64-apple-macosx10.8 #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 ba047754916d..9ed3d138112a 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,8 +15,8 @@ // 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 +// XFAIL: with_system_cxx_lib=x86_64-apple-macosx10.7 +// XFAIL: with_system_cxx_lib=x86_64-apple-macosx10.8 #include #include diff --git a/test/std/localization/locale.categories/category.monetary/locale.moneypunct/locale.moneypunct.members/negative_sign.pass.cpp b/test/std/localization/locale.categories/category.monetary/locale.moneypunct/locale.moneypunct.members/negative_sign.pass.cpp index df350d3537af..1664c5537fa1 100644 --- a/test/std/localization/locale.categories/category.monetary/locale.moneypunct/locale.moneypunct.members/negative_sign.pass.cpp +++ b/test/std/localization/locale.categories/category.monetary/locale.moneypunct/locale.moneypunct.members/negative_sign.pass.cpp @@ -14,7 +14,7 @@ // string_type negative_sign() const; // The C++ and C standards are silent. -// On this one, commen sense is the guideline. +// On this one, common sense is the guideline. // If customers complain, I'll endeavor to minimize customer complaints #include 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 32e7249ab868..72e351f580b4 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=x86_64-apple-macosx10.7 +// XFAIL: with_system_cxx_lib=x86_64-apple-macosx10.8 // diff --git a/test/std/localization/locale.categories/category.numeric/locale.nm.put/facet.num.put.members/put_pointer.pass.cpp b/test/std/localization/locale.categories/category.numeric/locale.nm.put/facet.num.put.members/put_pointer.pass.cpp index 8edcfc415821..4d8c2af38383 100644 --- a/test/std/localization/locale.categories/category.numeric/locale.nm.put/facet.num.put.members/put_pointer.pass.cpp +++ b/test/std/localization/locale.categories/category.numeric/locale.nm.put/facet.num.put.members/put_pointer.pass.cpp @@ -38,6 +38,12 @@ int main() char str[50]; output_iterator iter = f.put(output_iterator(str), ios, '*', v); std::string ex(str, iter.base()); - assert(ex == "0x0" || ex == "(nil)"); + char expected_str[32] = {}; + // num_put::put uses %p for pointer types, but the exact format of %p is + // implementation defined behavior for the C library. Compare output to + // snprintf for portability. + int rc = snprintf(expected_str, sizeof(expected_str), "%p", v); + assert(rc > 0); + assert(ex == expected_str); } } 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 6d7f506bb2d4..272199b0e0d9 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,8 @@ // //===----------------------------------------------------------------------===// // -// 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-macosx10.7 +// XFAIL: with_system_cxx_lib=x86_64-apple-macosx10.8 // diff --git a/test/std/localization/locale.categories/category.time/locale.time.get.byname/get_date.pass.cpp b/test/std/localization/locale.categories/category.time/locale.time.get.byname/get_date.pass.cpp index 9a06157ada59..af15b174bcd2 100644 --- a/test/std/localization/locale.categories/category.time/locale.time.get.byname/get_date.pass.cpp +++ b/test/std/localization/locale.categories/category.time/locale.time.get.byname/get_date.pass.cpp @@ -13,7 +13,7 @@ // REQUIRES: locale.zh_CN.UTF-8 // GLIBC Expects "10/06/2009" for fr_FR as opposed to "10.06.2009" -// GLIBC also failes on the zh_CN test. +// GLIBC also fails on the zh_CN test. // XFAIL: linux // diff --git a/test/std/localization/locale.categories/category.time/locale.time.get.byname/get_date_wide.pass.cpp b/test/std/localization/locale.categories/category.time/locale.time.get.byname/get_date_wide.pass.cpp index 170f33ad9813..1cd9f462e38e 100644 --- a/test/std/localization/locale.categories/category.time/locale.time.get.byname/get_date_wide.pass.cpp +++ b/test/std/localization/locale.categories/category.time/locale.time.get.byname/get_date_wide.pass.cpp @@ -13,7 +13,7 @@ // REQUIRES: locale.zh_CN.UTF-8 // GLIBC Expects "10/06/2009" for fr_FR as opposed to "10.06.2009" -// GLIBC also failes on the zh_CN test. +// GLIBC also fails on the zh_CN test. // XFAIL: linux // diff --git a/test/std/localization/locale.stdcvt/codecvt_utf16_in.pass.cpp b/test/std/localization/locale.stdcvt/codecvt_utf16_in.pass.cpp index 4d710c1a9799..56d6262d0692 100644 --- a/test/std/localization/locale.stdcvt/codecvt_utf16_in.pass.cpp +++ b/test/std/localization/locale.stdcvt/codecvt_utf16_in.pass.cpp @@ -28,11 +28,11 @@ int main() { { - typedef std::codecvt_utf16 C; + typedef std::codecvt_utf16 C; C c; - wchar_t w = 0; + char32_t w = 0; char n[4] = {char(0xD8), char(0xC0), char(0xDC), char(0x03)}; - wchar_t* wp = nullptr; + 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+1, wp); @@ -67,11 +67,11 @@ int main() assert(w == 0x56); } { - typedef std::codecvt_utf16 C; + typedef std::codecvt_utf16 C; C c; - wchar_t w = 0; + char32_t w = 0; char n[4] = {char(0xD8), char(0xC0), char(0xDC), char(0x03)}; - wchar_t* wp = nullptr; + 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+1, wp); @@ -106,11 +106,11 @@ int main() assert(w == 0x56); } { - typedef std::codecvt_utf16 C; + typedef std::codecvt_utf16 C; C c; - wchar_t w = 0; + char32_t w = 0; char n[6] = {char(0xFE), char(0xFF), char(0xD8), char(0xC0), char(0xDC), char(0x03)}; - wchar_t* wp = nullptr; + char32_t* wp = nullptr; std::mbstate_t m; const char* np = nullptr; std::codecvt_base::result r = c.in(m, n, n+6, np, &w, &w+1, wp); @@ -145,11 +145,11 @@ int main() assert(w == 0x56); } { - typedef std::codecvt_utf16 C; + typedef std::codecvt_utf16 C; C c; - wchar_t w = 0; + char32_t w = 0; char n[4] = {char(0xC0), char(0xD8), char(0x03), char(0xDC)}; - wchar_t* wp = nullptr; + 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+1, wp); @@ -184,11 +184,11 @@ int main() assert(w == 0x56); } { - typedef std::codecvt_utf16 C; + typedef std::codecvt_utf16 C; C c; - wchar_t w = 0; + char32_t w = 0; char n[4] = {char(0xC0), char(0xD8), char(0x03), char(0xDC)}; - wchar_t* wp = nullptr; + 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+1, wp); @@ -223,13 +223,13 @@ int main() assert(w == 0x56); } { - typedef std::codecvt_utf16 C; + typedef std::codecvt_utf16 C; + C c; - wchar_t w = 0; + char32_t w = 0; char n[6] = {char(0xFF), char(0xFE), char(0xC0), char(0xD8), char(0x03), char(0xDC)}; - wchar_t* wp = nullptr; + char32_t* wp = nullptr; std::mbstate_t m; const char* np = nullptr; std::codecvt_base::result r = c.in(m, n, n+6, np, &w, &w+1, wp); diff --git a/test/std/localization/locale.stdcvt/codecvt_utf8_in.pass.cpp b/test/std/localization/locale.stdcvt/codecvt_utf8_in.pass.cpp index 382ea122641a..308bb9da2fc1 100644 --- a/test/std/localization/locale.stdcvt/codecvt_utf8_in.pass.cpp +++ b/test/std/localization/locale.stdcvt/codecvt_utf8_in.pass.cpp @@ -28,11 +28,11 @@ int main() { { - typedef std::codecvt_utf8 C; + typedef std::codecvt_utf8 C; C c; - wchar_t w = 0; + char32_t w = 0; char n[4] = {char(0xF1), char(0x80), char(0x80), char(0x83)}; - wchar_t* wp = nullptr; + 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+1, wp); @@ -67,11 +67,11 @@ int main() assert(w == 0x56); } { - typedef std::codecvt_utf8 C; + typedef std::codecvt_utf8 C; C c; - wchar_t w = 0; + char32_t w = 0; char n[4] = {char(0xF1), char(0x80), char(0x80), char(0x83)}; - wchar_t* wp = nullptr; + 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+1, wp); @@ -106,11 +106,11 @@ int main() assert(w == 0x56); } { - typedef std::codecvt_utf8 C; + typedef std::codecvt_utf8 C; C c; - wchar_t w = 0; + char32_t w = 0; char n[7] = {char(0xEF), char(0xBB), char(0xBF), char(0xF1), char(0x80), char(0x80), char(0x83)}; - wchar_t* wp = nullptr; + 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+1, wp); 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 0087f1943b6e..11346fb402d2 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: with_system_cxx_lib=x86_64-apple-macosx10.7 +// XFAIL: with_system_cxx_lib=x86_64-apple-macosx10.8 // diff --git a/test/std/numerics/complex.number/complex.transcendentals/atan.pass.cpp b/test/std/numerics/complex.number/complex.transcendentals/atan.pass.cpp index 8cc71f7bff27..9e2298cf7718 100644 --- a/test/std/numerics/complex.number/complex.transcendentals/atan.pass.cpp +++ b/test/std/numerics/complex.number/complex.transcendentals/atan.pass.cpp @@ -34,7 +34,6 @@ test() void test_edges() { - typedef std::complex C; const unsigned N = sizeof(testcases) / sizeof(testcases[0]); for (unsigned i = 0; i < N; ++i) { diff --git a/test/std/numerics/complex.number/complex.transcendentals/tan.pass.cpp b/test/std/numerics/complex.number/complex.transcendentals/tan.pass.cpp index 9f09ab5827de..f27ead3daf00 100644 --- a/test/std/numerics/complex.number/complex.transcendentals/tan.pass.cpp +++ b/test/std/numerics/complex.number/complex.transcendentals/tan.pass.cpp @@ -35,7 +35,6 @@ test() void test_edges() { - typedef std::complex C; const unsigned N = sizeof(testcases) / sizeof(testcases[0]); for (unsigned i = 0; i < N; ++i) { diff --git a/test/std/numerics/numarray/template.valarray/valarray.assign/move_assign.pass.cpp b/test/std/numerics/numarray/template.valarray/valarray.assign/move_assign.pass.cpp index d34ff1c64d83..19b74ba28bcd 100644 --- a/test/std/numerics/numarray/template.valarray/valarray.assign/move_assign.pass.cpp +++ b/test/std/numerics/numarray/template.valarray/valarray.assign/move_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_RVALUE_REFERENCES { typedef int T; T a[] = {1, 2, 3, 4, 5}; @@ -60,5 +61,4 @@ int main() assert(v2[i][j] == a[i][j]); } } -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES } diff --git a/test/std/numerics/numarray/template.valarray/valarray.cons/move.pass.cpp b/test/std/numerics/numarray/template.valarray/valarray.cons/move.pass.cpp index a9692618e75f..b8fb08e0f223 100644 --- a/test/std/numerics/numarray/template.valarray/valarray.cons/move.pass.cpp +++ b/test/std/numerics/numarray/template.valarray/valarray.cons/move.pass.cpp @@ -7,6 +7,8 @@ // //===----------------------------------------------------------------------===// +// UNSUPPORTED: c++98, c++03 + // // template class valarray; @@ -20,7 +22,6 @@ int main() { -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES { typedef int T; T a[] = {1, 2, 3, 4, 5}; @@ -58,5 +59,4 @@ int main() assert(v2[i][j] == a[i][j]); } } -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES } diff --git a/test/std/numerics/numeric.ops/adjacent.difference/adjacent_difference.pass.cpp b/test/std/numerics/numeric.ops/adjacent.difference/adjacent_difference.pass.cpp index 46741e1e41b7..f999c5045a5c 100644 --- a/test/std/numerics/numeric.ops/adjacent.difference/adjacent_difference.pass.cpp +++ b/test/std/numerics/numeric.ops/adjacent.difference/adjacent_difference.pass.cpp @@ -22,6 +22,7 @@ #include #include +#include "test_macros.h" #include "test_iterators.h" template @@ -38,7 +39,7 @@ test() assert(ib[i] == ir[i]); } -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES +#if TEST_STD_VER >= 11 class Y; @@ -107,7 +108,7 @@ int main() test >(); test(); -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES +#if TEST_STD_VER >= 11 X x[3] = {X(1), X(2), X(3)}; Y y[3] = {Y(1), Y(2), Y(3)}; std::adjacent_difference(x, x+3, y); diff --git a/test/std/numerics/numeric.ops/adjacent.difference/adjacent_difference_op.pass.cpp b/test/std/numerics/numeric.ops/adjacent.difference/adjacent_difference_op.pass.cpp index fb0bbdc2836d..8a30a82212de 100644 --- a/test/std/numerics/numeric.ops/adjacent.difference/adjacent_difference_op.pass.cpp +++ b/test/std/numerics/numeric.ops/adjacent.difference/adjacent_difference_op.pass.cpp @@ -23,6 +23,7 @@ #include #include +#include "test_macros.h" #include "test_iterators.h" template @@ -40,7 +41,7 @@ test() assert(ib[i] == ir[i]); } -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES +#if TEST_STD_VER >= 11 class Y; @@ -110,7 +111,7 @@ int main() test >(); test(); -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES +#if TEST_STD_VER >= 11 X x[3] = {X(1), X(2), X(3)}; Y y[3] = {Y(1), Y(2), Y(3)}; std::adjacent_difference(x, x+3, y, std::minus()); 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 af065b84d1bb..961b515ef8d8 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 @@ -8,6 +8,7 @@ //===----------------------------------------------------------------------===// // // UNSUPPORTED: c++98, c++03, c++11, c++14 + // // template @@ -129,4 +130,11 @@ int main() assert((do_test(non_cce))); assert((do_test(non_cce))); assert((do_test(non_cce))); + +// LWG#2837 + { + auto res = std::gcd((int64_t)1234, (int32_t)-2147483648); + static_assert( std::is_same::type>::value, ""); + 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 cd03d99ebf13..90d48398f54a 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 @@ -128,4 +128,12 @@ int main() assert((do_test(non_cce))); assert((do_test(non_cce))); assert((do_test(non_cce))); + +// 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); + } } diff --git a/test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.cauchy/eval.pass.cpp b/test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.cauchy/eval.pass.cpp index d70d8f072c39..ca669dc4194a 100644 --- a/test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.cauchy/eval.pass.cpp +++ b/test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.cauchy/eval.pass.cpp @@ -31,7 +31,6 @@ int main() { { typedef std::cauchy_distribution<> D; - typedef D::param_type P; typedef std::mt19937 G; G g; const double a = 10; @@ -47,7 +46,6 @@ int main() } { typedef std::cauchy_distribution<> D; - typedef D::param_type P; typedef std::mt19937 G; G g; const double a = -1.5; @@ -63,7 +61,6 @@ int main() } { typedef std::cauchy_distribution<> D; - typedef D::param_type P; typedef std::mt19937 G; G g; const double a = .5; diff --git a/test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.chisq/eval.pass.cpp b/test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.chisq/eval.pass.cpp index 3b54790aee0a..3261880c6d04 100644 --- a/test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.chisq/eval.pass.cpp +++ b/test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.chisq/eval.pass.cpp @@ -34,7 +34,6 @@ int main() { { typedef std::chi_squared_distribution<> D; - typedef D::param_type P; typedef std::minstd_rand G; G g; D d(0.5); @@ -74,7 +73,6 @@ int main() } { typedef std::chi_squared_distribution<> D; - typedef D::param_type P; typedef std::minstd_rand G; G g; D d(1); @@ -114,7 +112,6 @@ int main() } { typedef std::chi_squared_distribution<> D; - typedef D::param_type P; typedef std::mt19937 G; G g; D d(2); diff --git a/test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.f/eval.pass.cpp b/test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.f/eval.pass.cpp index 4da7f2e70e9b..8025880d8754 100644 --- a/test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.f/eval.pass.cpp +++ b/test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.f/eval.pass.cpp @@ -51,7 +51,6 @@ int main() // Purposefully only testing even integral values of m and n (for now) { typedef std::fisher_f_distribution<> D; - typedef D::param_type P; typedef std::mt19937 G; G g; D d(2, 4); @@ -69,7 +68,6 @@ int main() } { typedef std::fisher_f_distribution<> D; - typedef D::param_type P; typedef std::mt19937 G; G g; D d(4, 2); @@ -87,7 +85,6 @@ int main() } { typedef std::fisher_f_distribution<> D; - typedef D::param_type P; typedef std::mt19937 G; G g; D d(18, 20); diff --git a/test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.normal/eval.pass.cpp b/test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.normal/eval.pass.cpp index e1084d3ef03d..2bf9204d3a09 100644 --- a/test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.normal/eval.pass.cpp +++ b/test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.normal/eval.pass.cpp @@ -34,7 +34,6 @@ int main() { { typedef std::normal_distribution<> D; - typedef D::param_type P; typedef std::minstd_rand G; G g; D d(5, 4); diff --git a/test/std/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.exp/eval.pass.cpp b/test/std/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.exp/eval.pass.cpp index 223d6f4d2216..71aaa081b351 100644 --- a/test/std/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.exp/eval.pass.cpp +++ b/test/std/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.exp/eval.pass.cpp @@ -34,7 +34,6 @@ int main() { { typedef std::exponential_distribution<> D; - typedef D::param_type P; typedef std::mt19937 G; G g; D d(.75); @@ -74,7 +73,6 @@ int main() } { typedef std::exponential_distribution<> D; - typedef D::param_type P; typedef std::mt19937 G; G g; D d(1); @@ -114,7 +112,6 @@ int main() } { typedef std::exponential_distribution<> D; - typedef D::param_type P; typedef std::mt19937 G; G g; D d(10); diff --git a/test/std/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.weibull/eval.pass.cpp b/test/std/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.weibull/eval.pass.cpp index 10337907b964..ee0b68fb8f9c 100644 --- a/test/std/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.weibull/eval.pass.cpp +++ b/test/std/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.weibull/eval.pass.cpp @@ -34,7 +34,6 @@ int main() { { typedef std::weibull_distribution<> D; - typedef D::param_type P; typedef std::mt19937 G; G g; D d(0.5, 2); @@ -78,7 +77,6 @@ int main() } { typedef std::weibull_distribution<> D; - typedef D::param_type P; typedef std::mt19937 G; G g; D d(1, .5); @@ -122,7 +120,6 @@ int main() } { typedef std::weibull_distribution<> D; - typedef D::param_type P; typedef std::mt19937 G; G g; D d(2, 3); 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 f866929795db..9bd213f96746 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.alg/re.alg.match/parse_curly_brackets.pass.cpp b/test/std/re/re.alg/re.alg.match/parse_curly_brackets.pass.cpp index 59b2832c4580..d9c5172303fc 100644 --- a/test/std/re/re.alg/re.alg.match/parse_curly_brackets.pass.cpp +++ b/test/std/re/re.alg/re.alg.match/parse_curly_brackets.pass.cpp @@ -16,7 +16,7 @@ // const basic_regex& e, // regex_constants::match_flag_type flags = regex_constants::match_default); -// http://llvm.org/bugs/show_bug.cgi?id=16135 +// https://bugs.llvm.org/show_bug.cgi?id=16135 #include #include diff --git a/test/std/re/re.alg/re.alg.search/backup.pass.cpp b/test/std/re/re.alg/re.alg.search/backup.pass.cpp index f33b844bed9c..8de0b650ff05 100644 --- a/test/std/re/re.alg/re.alg.search/backup.pass.cpp +++ b/test/std/re/re.alg/re.alg.search/backup.pass.cpp @@ -25,7 +25,7 @@ int main() { // This regex_iterator uses regex_search(__wrap_iter<_Iter> __first, ...) - // Test for http://llvm.org/bugs/show_bug.cgi?id=16240 fixed in r185273. + // Test for https://bugs.llvm.org/show_bug.cgi?id=16240 fixed in r185273. { std::string s("aaaa a"); std::regex re("\\ba"); diff --git a/test/std/re/re.alg/re.alg.search/lookahead.pass.cpp b/test/std/re/re.alg/re.alg.search/lookahead.pass.cpp index 93424e188432..2d753ed14701 100644 --- a/test/std/re/re.alg/re.alg.search/lookahead.pass.cpp +++ b/test/std/re/re.alg/re.alg.search/lookahead.pass.cpp @@ -16,7 +16,7 @@ // const basic_regex& e, // regex_constants::match_flag_type flags = regex_constants::match_default); -// http://llvm.org/bugs/show_bug.cgi?id=11118 +// https://bugs.llvm.org/show_bug.cgi?id=11118 #include #include diff --git a/test/std/re/re.regex/re.regex.construct/bad_backref.pass.cpp b/test/std/re/re.regex/re.regex.construct/bad_backref.pass.cpp index aca4d674d9f9..e66d3e976db2 100644 --- a/test/std/re/re.regex/re.regex.construct/bad_backref.pass.cpp +++ b/test/std/re/re.regex/re.regex.construct/bad_backref.pass.cpp @@ -36,7 +36,7 @@ int main() assert(error_badbackref_thrown("ab(c)\\2def")); // only one reference // this should NOT throw, because we only should look at the '1' -// See https://llvm.org/bugs/show_bug.cgi?id=31387 +// See https://bugs.llvm.org/show_bug.cgi?id=31387 { const char *pat1 = "a(b)c\\1234"; std::regex re(pat1, pat1 + 7); // extra chars after the end. diff --git a/test/std/re/re.traits/lookup_classname.pass.cpp b/test/std/re/re.traits/lookup_classname.pass.cpp index 4f7cf61ebf99..2215b9043d5b 100644 --- a/test/std/re/re.traits/lookup_classname.pass.cpp +++ b/test/std/re/re.traits/lookup_classname.pass.cpp @@ -35,7 +35,7 @@ test(const char_type* A, int main() { // if __regex_word is not distinct from all the classes, bad things happen -// See https://llvm.org/bugs/show_bug.cgi?id=26476 for an example. +// 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); diff --git a/test/std/re/re.traits/translate_nocase.pass.cpp b/test/std/re/re.traits/translate_nocase.pass.cpp index bf79629d33b4..ab73db79d97f 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=x86_64-apple-macosx10.7 +// XFAIL: with_system_cxx_lib=x86_64-apple-macosx10.8 // TODO: investigation needed // XFAIL: linux-gnu diff --git a/test/std/strings/basic.string.hash/enabled_hashes.pass.cpp b/test/std/strings/basic.string.hash/enabled_hashes.pass.cpp new file mode 100644 index 000000000000..01f01218999d --- /dev/null +++ b/test/std/strings/basic.string.hash/enabled_hashes.pass.cpp @@ -0,0 +1,31 @@ +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// UNSUPPORTED: c++98, c++03 + +// + +// Test that provides all of the arithmetic, enum, and pointer +// hash specializations. + +#include + +#include "poisoned_hash_helper.hpp" + +int main() { + test_library_hash_specializations_available(); + { + test_hash_enabled_for_type(); + test_hash_enabled_for_type(); +#ifndef _LIBCPP_HAS_NO_UNICODE_CHARS + test_hash_enabled_for_type(); + test_hash_enabled_for_type(); +#endif + } +} diff --git a/test/std/strings/basic.string.hash/strings.pass.cpp b/test/std/strings/basic.string.hash/strings.pass.cpp index 5fc32c06a701..d74e485752fc 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.cons/copy_alloc.pass.cpp b/test/std/strings/basic.string/string.cons/copy_alloc.pass.cpp index b3447b94b803..982bb43289d7 100644 --- a/test/std/strings/basic.string/string.cons/copy_alloc.pass.cpp +++ b/test/std/strings/basic.string/string.cons/copy_alloc.pass.cpp @@ -18,6 +18,65 @@ #include "test_allocator.h" #include "min_allocator.h" +#ifndef TEST_HAS_NO_EXCEPTIONS +template +struct alloc_imp { + bool active; + + alloc_imp() : active(true) {} + + T* allocate(std::size_t n) + { + if (active) + return static_cast(std::malloc(n * sizeof(T))); + else + throw std::bad_alloc(); + } + + void deallocate(T* p, std::size_t) { std::free(p); } + void activate () { active = true; } + void deactivate() { active = false; } +}; + +template +struct poca_alloc { + typedef T value_type; + typedef std::true_type propagate_on_container_copy_assignment; + + alloc_imp *imp; + + poca_alloc(alloc_imp *imp_) : imp (imp_) {} + + template + poca_alloc(const poca_alloc& other) : imp(other.imp) {} + + T* allocate (std::size_t n) { return imp->allocate(n);} + void deallocate(T* p, std::size_t n) { imp->deallocate(p, n); } +}; + +template +bool operator==(const poca_alloc& lhs, const poca_alloc& rhs) +{ + return lhs.imp == rhs.imp; +} + +template +bool operator!=(const poca_alloc& lhs, const poca_alloc& rhs) +{ + return lhs.imp != rhs.imp; +} + +template +void test_assign(S &s1, const S& s2) +{ + try { s1 = s2; } + catch ( std::bad_alloc &) { return; } + assert(false); +} +#endif + + + template void test(S s1, const typename S::allocator_type& a) @@ -46,5 +105,27 @@ int main() test(S("1"), A()); test(S("1234567890123456789012345678901234567890123456789012345678901234567890"), A()); } + +#ifndef TEST_HAS_NO_EXCEPTIONS + { + typedef poca_alloc A; + typedef std::basic_string, A> S; + const char * p1 = "This is my first string"; + const char * p2 = "This is my second string"; + + alloc_imp imp1; + alloc_imp imp2; + S s1(p1, A(&imp1)); + S s2(p2, A(&imp2)); + + assert(s1 == p1); + assert(s2 == p2); + + imp2.deactivate(); + test_assign(s1, s2); + assert(s1 == p1); + assert(s2 == p2); + } +#endif #endif } diff --git a/test/std/strings/basic.string/string.cons/dtor_noexcept.pass.cpp b/test/std/strings/basic.string/string.cons/dtor_noexcept.pass.cpp index 0c6362d96863..f4ff0645afcf 100644 --- a/test/std/strings/basic.string/string.cons/dtor_noexcept.pass.cpp +++ b/test/std/strings/basic.string/string.cons/dtor_noexcept.pass.cpp @@ -42,8 +42,10 @@ int main() typedef std::basic_string, test_allocator> C; static_assert(std::is_nothrow_destructible::value, ""); } +#if defined(_LIBCPP_VERSION) { typedef std::basic_string, some_alloc> C; - LIBCPP_STATIC_ASSERT(!std::is_nothrow_destructible::value, ""); + static_assert(!std::is_nothrow_destructible::value, ""); } +#endif // _LIBCPP_VERSION } diff --git a/test/std/strings/basic.string/string.cons/implicit_deduction_guides.pass.cpp b/test/std/strings/basic.string/string.cons/implicit_deduction_guides.pass.cpp new file mode 100644 index 000000000000..0fbd663db4bc --- /dev/null +++ b/test/std/strings/basic.string/string.cons/implicit_deduction_guides.pass.cpp @@ -0,0 +1,300 @@ +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual 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 +// UNSUPPORTED: libcpp-no-deduction-guides + +// + +// Test that the constructors offered by std::basic_string are formulated +// so they're compatible with implicit deduction guides. + +#include +#include +#include + +#include "test_macros.h" +#include "test_allocator.h" +#include "test_iterators.h" +#include "constexpr_char_traits.hpp" + +template > +using BStr = std::basic_string, Alloc>; + +// Overloads +// using A = Allocator; +// using BS = basic_string +// using BSV = basic_string_view +// --------------- +// (1) basic_string() - NOT TESTED +// (2) basic_string(A const&) - BROKEN +// (3) basic_string(size_type, CharT, const A& = A()) +// (4) basic_string(BS const&, size_type, A const& = A()) +// (5) basic_string(BS const&, size_type, size_type, A const& = A()) - PARTIALLY BROKEN +// (6) basic_string(const CharT*, size_type, A const& = A()) +// (7) basic_string(const CharT*, A const& = A()) +// (8) basic_string(InputIt, InputIt, A const& = A()) - BROKEN +// (9) basic_string(BS const&) +// (10) basic_string(BS const&, A const&) +// (11) basic_string(BS&&) +// (12) basic_string(BS&&, A const&) +// (13) basic_string(initializer_list, A const& = A()) +// (14) basic_string(BSV, A const& = A()) +// (15) basic_string(const T&, size_type, size_type, A const& = A()) - BROKEN +int main() +{ + using TestSizeT = test_allocator::size_type; + { // Testing (1) + // Nothing TODO. Cannot deduce without any arguments. + } + { // Testing (2) + // This overload isn't compatible with implicit deduction guides as + // specified in the standard. + // const test_allocator alloc{}; + // std::basic_string s(alloc); + } + { // Testing (3) w/o allocator + std::basic_string s(6ull, 'a'); + ASSERT_SAME_TYPE(decltype(s), std::string); + assert(s == "aaaaaa"); + + std::basic_string w(2ull, L'b'); + ASSERT_SAME_TYPE(decltype(w), std::wstring); + assert(w == L"bb"); + } + { // Testing (3) w/ allocator + std::basic_string s(6ull, 'a', test_allocator{}); + ASSERT_SAME_TYPE(decltype(s), BStr>); + assert(s == "aaaaaa"); + + std::basic_string w(2ull, L'b', test_allocator{}); + ASSERT_SAME_TYPE(decltype(w), BStr>); + assert(w == L"bb"); + } + { // Testing (4) w/o allocator + const std::string sin("abc"); + std::basic_string s(sin, (size_t)1); + ASSERT_SAME_TYPE(decltype(s), std::string); + assert(s == "bc"); + + using WStr = std::basic_string, + test_allocator>; + const WStr win(L"abcdef"); + std::basic_string w(win, (TestSizeT)3); + ASSERT_SAME_TYPE(decltype(w), WStr); + assert(w == L"def"); + } + { // Testing (4) w/ allocator + const std::string sin("abc"); + std::basic_string s(sin, (size_t)1, std::allocator{}); + ASSERT_SAME_TYPE(decltype(s), std::string); + assert(s == "bc"); + + using WStr = std::basic_string, + test_allocator>; + const WStr win(L"abcdef"); + std::basic_string w(win, (TestSizeT)3, test_allocator{}); + ASSERT_SAME_TYPE(decltype(w), WStr); + assert(w == L"def"); + } + { // Testing (5) w/o allocator +#if 0 // FIXME: This doesn't work + const std::string sin("abc"); + std::basic_string s(sin, (size_t)1, (size_t)3); + ASSERT_SAME_TYPE(decltype(s), std::string); + assert(s == "bc"); + + using WStr = std::basic_string, + test_allocator>; + const WStr win(L"abcdef"); + std::basic_string w(win, (TestSizeT)2, (TestSizeT)3); + ASSERT_SAME_TYPE(decltype(w), WStr); + assert(w == L"cde"); +#endif + } + { // Testing (5) w/ allocator + const std::string sin("abc"); + std::basic_string s(sin, (size_t)1, (size_t)3, std::allocator{}); + ASSERT_SAME_TYPE(decltype(s), std::string); + assert(s == "bc"); + + using WStr = std::basic_string, + test_allocator>; + const WStr win(L"abcdef"); + std::basic_string w(win, (TestSizeT)2, (TestSizeT)3, test_allocator{}); + ASSERT_SAME_TYPE(decltype(w), WStr); + assert(w == L"cde"); + } + { // Testing (6) w/o allocator + std::basic_string s("abc", (size_t)2); + ASSERT_SAME_TYPE(decltype(s), std::string); + assert(s == "ab"); + + std::basic_string w(L"abcdef", (size_t)3); + ASSERT_SAME_TYPE(decltype(w), std::wstring); + assert(w == L"abc"); + } + { // Testing (6) w/ allocator + std::basic_string s("abc", (size_t)2, std::allocator{}); + ASSERT_SAME_TYPE(decltype(s), std::string); + assert(s == "ab"); + + using WStr = std::basic_string, + test_allocator>; + std::basic_string w(L"abcdef", (TestSizeT)3, test_allocator{}); + ASSERT_SAME_TYPE(decltype(w), WStr); + assert(w == L"abc"); + } + { // Testing (7) w/o allocator + std::basic_string s("abc"); + ASSERT_SAME_TYPE(decltype(s), std::string); + assert(s == "abc"); + + std::basic_string w(L"abcdef"); + ASSERT_SAME_TYPE(decltype(w), std::wstring); + assert(w == L"abcdef"); + } + { // Testing (7) w/ allocator + std::basic_string s("abc", std::allocator{}); + ASSERT_SAME_TYPE(decltype(s), std::string); + assert(s == "abc"); + + using WStr = std::basic_string, + test_allocator>; + std::basic_string w(L"abcdef", test_allocator{}); + ASSERT_SAME_TYPE(decltype(w), WStr); + assert(w == L"abcdef"); + } + { // (8) w/o allocator + // This overload isn't compatible with implicit deduction guides as + // specified in the standard. + // FIXME: Propose adding an explicit guide to the standard? + } + { // (8) w/ allocator + // This overload isn't compatible with implicit deduction guides as + // specified in the standard. + // FIXME: Propose adding an explicit guide to the standard? +#if 0 + using It = input_iterator; + const char* input = "abcdef"; + std::basic_string s(It(input), It(input + 3), std::allocator{}); + ASSERT_SAME_TYPE(decltype(s), std::string); +#endif + } + { // Testing (9) + const std::string sin("abc"); + std::basic_string s(sin); + ASSERT_SAME_TYPE(decltype(s), std::string); + assert(s == "abc"); + + using WStr = std::basic_string, + test_allocator>; + const WStr win(L"abcdef"); + std::basic_string w(win); + ASSERT_SAME_TYPE(decltype(w), WStr); + assert(w == L"abcdef"); + } + { // Testing (10) + const std::string sin("abc"); + std::basic_string s(sin, std::allocator{}); + ASSERT_SAME_TYPE(decltype(s), std::string); + assert(s == "abc"); + + using WStr = std::basic_string, + test_allocator>; + const WStr win(L"abcdef"); + std::basic_string w(win, test_allocator{}); + ASSERT_SAME_TYPE(decltype(w), WStr); + assert(w == L"abcdef"); + } + { // Testing (11) + std::string sin("abc"); + std::basic_string s(std::move(sin)); + ASSERT_SAME_TYPE(decltype(s), std::string); + assert(s == "abc"); + + using WStr = std::basic_string, + test_allocator>; + WStr win(L"abcdef"); + std::basic_string w(std::move(win)); + ASSERT_SAME_TYPE(decltype(w), WStr); + assert(w == L"abcdef"); + } + { // Testing (12) + std::string sin("abc"); + std::basic_string s(std::move(sin), std::allocator{}); + ASSERT_SAME_TYPE(decltype(s), std::string); + assert(s == "abc"); + + using WStr = std::basic_string, + test_allocator>; + WStr win(L"abcdef"); + std::basic_string w(std::move(win), test_allocator{}); + ASSERT_SAME_TYPE(decltype(w), WStr); + assert(w == L"abcdef"); + } + { // Testing (13) w/o allocator + std::basic_string s({'a', 'b', 'c'}); + ASSERT_SAME_TYPE(decltype(s), std::string); + assert(s == "abc"); + + std::basic_string w({L'a', L'b', L'c'}); + ASSERT_SAME_TYPE(decltype(w), std::wstring); + assert(w == L"abc"); + } + { // Testing (13) w/ allocator + std::basic_string s({'a', 'b', 'c'}, test_allocator{}); + ASSERT_SAME_TYPE(decltype(s), BStr>); + assert(s == "abc"); + + std::basic_string w({L'a', L'b', L'c'}, test_allocator{}); + ASSERT_SAME_TYPE(decltype(w), BStr>); + assert(w == L"abc"); + } + { // Testing (14) w/o allocator + std::string_view sv("abc"); + std::basic_string s(sv); + ASSERT_SAME_TYPE(decltype(s), std::string); + assert(s == "abc"); + + using Expect = std::basic_string>; + std::basic_string_view> BSV(L"abcdef"); + std::basic_string w(BSV); + ASSERT_SAME_TYPE(decltype(w), Expect); + assert(w == L"abcdef"); + } + { // Testing (14) w/ allocator + using ExpectS = std::basic_string, test_allocator>; + std::string_view sv("abc"); + std::basic_string s(sv, test_allocator{}); + ASSERT_SAME_TYPE(decltype(s), ExpectS); + assert(s == "abc"); + + using ExpectW = std::basic_string, + test_allocator>; + std::basic_string_view> BSV(L"abcdef"); + std::basic_string w(BSV, test_allocator{}); + ASSERT_SAME_TYPE(decltype(w), ExpectW); + assert(w == L"abcdef"); + } + { // Testing (15) + // This overload isn't compatible with implicit deduction guides as + // specified in the standard. + } +} diff --git a/test/std/strings/basic.string/string.cons/iter_alloc.pass.cpp b/test/std/strings/basic.string/string.cons/iter_alloc.pass.cpp index 1b10224cd9e7..1f83696891c4 100644 --- a/test/std/strings/basic.string/string.cons/iter_alloc.pass.cpp +++ b/test/std/strings/basic.string/string.cons/iter_alloc.pass.cpp @@ -29,7 +29,6 @@ test(It first, It last) { typedef typename std::iterator_traits::value_type charT; typedef std::basic_string, test_allocator > S; - typedef typename S::traits_type T; typedef typename S::allocator_type A; S s2(first, last); LIBCPP_ASSERT(s2.__invariants()); @@ -47,7 +46,6 @@ test(It first, It last, const A& a) { typedef typename std::iterator_traits::value_type charT; typedef std::basic_string, A> S; - typedef typename S::traits_type T; S s2(first, last, a); LIBCPP_ASSERT(s2.__invariants()); assert(s2.size() == static_cast(std::distance(first, last))); diff --git a/test/std/strings/basic.string/string.cons/pointer_alloc.pass.cpp b/test/std/strings/basic.string/string.cons/pointer_alloc.pass.cpp index f56780095b7f..d9d451dc7112 100644 --- a/test/std/strings/basic.string/string.cons/pointer_alloc.pass.cpp +++ b/test/std/strings/basic.string/string.cons/pointer_alloc.pass.cpp @@ -56,7 +56,6 @@ int main() { { typedef test_allocator A; - typedef std::basic_string, A> S; test(""); test("", A(2)); @@ -73,7 +72,6 @@ int main() #if TEST_STD_VER >= 11 { typedef min_allocator A; - typedef std::basic_string, A> S; test(""); test("", A()); diff --git a/test/std/strings/basic.string/string.cons/pointer_size_alloc.pass.cpp b/test/std/strings/basic.string/string.cons/pointer_size_alloc.pass.cpp index bcab9eb6789e..3c75a700eaed 100644 --- a/test/std/strings/basic.string/string.cons/pointer_size_alloc.pass.cpp +++ b/test/std/strings/basic.string/string.cons/pointer_size_alloc.pass.cpp @@ -53,7 +53,6 @@ int main() { { typedef test_allocator A; - typedef std::basic_string, A> S; test("", 0); test("", 0, A(2)); @@ -70,7 +69,6 @@ int main() #if TEST_STD_VER >= 11 { typedef min_allocator A; - typedef std::basic_string, A> S; test("", 0); test("", 0, A()); diff --git a/test/std/strings/basic.string/string.cons/size_char_alloc.pass.cpp b/test/std/strings/basic.string/string.cons/size_char_alloc.pass.cpp index 60443e9f358d..2adf0049a0b5 100644 --- a/test/std/strings/basic.string/string.cons/size_char_alloc.pass.cpp +++ b/test/std/strings/basic.string/string.cons/size_char_alloc.pass.cpp @@ -26,7 +26,6 @@ void test(unsigned n, charT c) { typedef std::basic_string, test_allocator > S; - typedef typename S::traits_type T; typedef typename S::allocator_type A; S s2(n, c); LIBCPP_ASSERT(s2.__invariants()); @@ -42,7 +41,6 @@ void test(unsigned n, charT c, const A& a) { typedef std::basic_string, A> S; - typedef typename S::traits_type T; S s2(n, c, a); LIBCPP_ASSERT(s2.__invariants()); assert(s2.size() == n); @@ -58,7 +56,6 @@ test(Tp n, Tp c) { typedef char charT; typedef std::basic_string, test_allocator > S; - typedef typename S::traits_type T; typedef typename S::allocator_type A; S s2(n, c); LIBCPP_ASSERT(s2.__invariants()); @@ -75,7 +72,6 @@ test(Tp n, Tp c, const A& a) { typedef char charT; typedef std::basic_string, A> S; - typedef typename S::traits_type T; S s2(n, c, a); LIBCPP_ASSERT(s2.__invariants()); assert(s2.size() == static_cast(n)); @@ -89,7 +85,6 @@ int main() { { typedef test_allocator A; - typedef std::basic_string, A> S; test(0, 'a'); test(0, 'a', A(2)); @@ -109,7 +104,6 @@ int main() #if TEST_STD_VER >= 11 { typedef min_allocator A; - typedef std::basic_string, A> S; test(0, 'a'); test(0, 'a', A()); diff --git a/test/std/strings/basic.string/string.cons/substr.pass.cpp b/test/std/strings/basic.string/string.cons/substr.pass.cpp index 4fd974273de9..13a9a4b96aab 100644 --- a/test/std/strings/basic.string/string.cons/substr.pass.cpp +++ b/test/std/strings/basic.string/string.cons/substr.pass.cpp @@ -98,7 +98,6 @@ void test(S str, unsigned pos, unsigned n, const typename S::allocator_type& a) { typedef typename S::traits_type T; - typedef typename S::allocator_type A; if (pos <= str.size()) { 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 dac8860f9a64..b464291d4c5d 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_insert/iter_iter_iter.pass.cpp b/test/std/strings/basic.string/string.modifiers/string_insert/iter_iter_iter.pass.cpp index e5ce8e51e1d6..2c8b6e4a1882 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/size_size_T_size_size.pass.cpp b/test/std/strings/basic.string/string.modifiers/string_replace/size_size_T_size_size.pass.cpp index 840b7614f482..dbf5f5b64446 100644 --- a/test/std/strings/basic.string/string.modifiers/string_replace/size_size_T_size_size.pass.cpp +++ b/test/std/strings/basic.string/string.modifiers/string_replace/size_size_T_size_size.pass.cpp @@ -29,16 +29,22 @@ test(S s, typename S::size_type pos1, typename S::size_type n1, SV sv, typename S::size_type pos2, typename S::size_type n2, S expected) { + typedef typename S::size_type SizeT; static_assert((!std::is_same::value), ""); - const typename S::size_type old_size = s.size(); + + // String and string_view may not always share the same size type, + // but both types should have the same size (ex. int vs long) + static_assert(sizeof(SizeT) == sizeof(typename SV::size_type), ""); + + const SizeT old_size = s.size(); S s0 = s; if (pos1 <= old_size && pos2 <= sv.size()) { s.replace(pos1, n1, sv, pos2, n2); LIBCPP_ASSERT(s.__invariants()); assert(s == expected); - typename S::size_type xlen = std::min(n1, old_size - pos1); - typename S::size_type rlen = std::min(n2, sv.size() - pos2); + SizeT xlen = std::min(n1, old_size - pos1); + SizeT rlen = std::min(n2, sv.size() - pos2); assert(s.size() == old_size - xlen + rlen); } #ifndef TEST_HAS_NO_EXCEPTIONS @@ -64,16 +70,17 @@ test_npos(S s, typename S::size_type pos1, typename S::size_type n1, SV sv, typename S::size_type pos2, S expected) { + typedef typename S::size_type SizeT; static_assert((!std::is_same::value), ""); - const typename S::size_type old_size = s.size(); + const SizeT old_size = s.size(); S s0 = s; if (pos1 <= old_size && pos2 <= sv.size()) { s.replace(pos1, n1, sv, pos2); LIBCPP_ASSERT(s.__invariants()); assert(s == expected); - typename S::size_type xlen = std::min(n1, old_size - pos1); - typename S::size_type rlen = std::min(S::npos, sv.size() - pos2); + SizeT xlen = std::min(n1, old_size - pos1); + SizeT rlen = std::min(S::npos, sv.size() - pos2); assert(s.size() == old_size - xlen + rlen); } #ifndef TEST_HAS_NO_EXCEPTIONS diff --git a/test/std/strings/basic.string/string.nonmembers/string.special/swap_noexcept.pass.cpp b/test/std/strings/basic.string/string.nonmembers/string.special/swap_noexcept.pass.cpp index 757d5eeb2dc3..88c1bee32512 100644 --- a/test/std/strings/basic.string/string.nonmembers/string.special/swap_noexcept.pass.cpp +++ b/test/std/strings/basic.string/string.nonmembers/string.special/swap_noexcept.pass.cpp @@ -59,10 +59,12 @@ int main() typedef std::string C; static_assert(noexcept(swap(std::declval(), std::declval())), ""); } +#if defined(_LIBCPP_VERSION) { typedef std::basic_string, test_allocator> C; - LIBCPP_STATIC_ASSERT(noexcept(swap(std::declval(), std::declval())), ""); + static_assert(noexcept(swap(std::declval(), std::declval())), ""); } +#endif // _LIBCPP_VERSION { typedef std::basic_string, some_alloc> C; #if TEST_STD_VER >= 14 diff --git a/test/std/strings/basic.string/traits_mismatch.fail.cpp b/test/std/strings/basic.string/traits_mismatch.fail.cpp new file mode 100644 index 000000000000..1d54238ae0c0 --- /dev/null +++ b/test/std/strings/basic.string/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 strings's value type must be the same as the traits's char_type + +#include + +int main() +{ + std::basic_string> s; +} diff --git a/test/std/strings/string.classes/typedefs.pass.cpp b/test/std/strings/string.classes/typedefs.pass.cpp index 11ee6c8a1215..3aba1c3f15dd 100644 --- a/test/std/strings/string.classes/typedefs.pass.cpp +++ b/test/std/strings/string.classes/typedefs.pass.cpp @@ -18,13 +18,14 @@ // typedef basic_string wstring; #include +#include int main() { - typedef std::string test1; - typedef std::wstring test2; + static_assert((std::is_same >::value), ""); + static_assert((std::is_same >::value), ""); #ifndef _LIBCPP_HAS_NO_UNICODE_CHARS - typedef std::u16string test3; - typedef std::u32string test4; + static_assert((std::is_same >::value), ""); + static_assert((std::is_same >::value), ""); #endif // _LIBCPP_HAS_NO_UNICODE_CHARS } diff --git a/test/std/strings/string.conversions/stof.pass.cpp b/test/std/strings/string.conversions/stof.pass.cpp index 1e17e1d3abdd..aeef0ddfbc78 100644 --- a/test/std/strings/string.conversions/stof.pass.cpp +++ b/test/std/strings/string.conversions/stof.pass.cpp @@ -7,8 +7,8 @@ // //===----------------------------------------------------------------------===// // -// 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-macosx10.7 +// XFAIL: with_system_cxx_lib=x86_64-apple-macosx10.8 // diff --git a/test/std/strings/string.conversions/stol.pass.cpp b/test/std/strings/string.conversions/stol.pass.cpp index 457cf0a76997..f01bbf8ce29e 100644 --- a/test/std/strings/string.conversions/stol.pass.cpp +++ b/test/std/strings/string.conversions/stol.pass.cpp @@ -7,8 +7,8 @@ // //===----------------------------------------------------------------------===// // -// 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-macosx10.7 +// XFAIL: with_system_cxx_lib=x86_64-apple-macosx10.8 // diff --git a/test/std/strings/string.conversions/stoll.pass.cpp b/test/std/strings/string.conversions/stoll.pass.cpp index ca8412aeb758..b823ab742626 100644 --- a/test/std/strings/string.conversions/stoll.pass.cpp +++ b/test/std/strings/string.conversions/stoll.pass.cpp @@ -7,8 +7,8 @@ // //===----------------------------------------------------------------------===// // -// 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-macosx10.7 +// XFAIL: with_system_cxx_lib=x86_64-apple-macosx10.8 // diff --git a/test/std/strings/string.conversions/stoul.pass.cpp b/test/std/strings/string.conversions/stoul.pass.cpp index 1acdf116458f..5e1f696cb6b7 100644 --- a/test/std/strings/string.conversions/stoul.pass.cpp +++ b/test/std/strings/string.conversions/stoul.pass.cpp @@ -7,8 +7,8 @@ // //===----------------------------------------------------------------------===// // -// 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-macosx10.7 +// XFAIL: with_system_cxx_lib=x86_64-apple-macosx10.8 // diff --git a/test/std/strings/string.conversions/stoull.pass.cpp b/test/std/strings/string.conversions/stoull.pass.cpp index e63679eed2f4..70563d9be51f 100644 --- a/test/std/strings/string.conversions/stoull.pass.cpp +++ b/test/std/strings/string.conversions/stoull.pass.cpp @@ -7,8 +7,8 @@ // //===----------------------------------------------------------------------===// // -// 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-macosx10.7 +// XFAIL: with_system_cxx_lib=x86_64-apple-macosx10.8 // diff --git a/test/std/strings/string.view/nothing_to_do.pass.cpp b/test/std/strings/string.view/nothing_to_do.pass.cpp deleted file mode 100644 index 353dd98f415e..000000000000 --- a/test/std/strings/string.view/nothing_to_do.pass.cpp +++ /dev/null @@ -1,12 +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. -// -//===----------------------------------------------------------------------===// - -#include - -int main () {} diff --git a/test/std/strings/string.view/string.view.access/at.pass.cpp b/test/std/strings/string.view/string.view.access/at.pass.cpp index 0f1636d3f94f..6df879898f44 100644 --- a/test/std/strings/string.view/string.view.access/at.pass.cpp +++ b/test/std/strings/string.view/string.view.access/at.pass.cpp @@ -7,7 +7,7 @@ // //===----------------------------------------------------------------------===// -// NOTE: Older versions of clang have a bug where they fail to evalute +// NOTE: Older versions of clang have a bug where they fail to evaluate // string_view::at as a constant expression. // XFAIL: clang-3.4, clang-3.3 diff --git a/test/std/strings/string.view/string.view.cons/assign.pass.cpp b/test/std/strings/string.view/string.view.cons/assign.pass.cpp new file mode 100644 index 000000000000..b7348ea226cf --- /dev/null +++ b/test/std/strings/string.view/string.view.cons/assign.pass.cpp @@ -0,0 +1,50 @@ +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + + +// + +// constexpr basic_string_view& operator=(const basic_string_view &) noexcept = default; + +#include +#include + +#include "test_macros.h" + +template +#if TEST_STD_VER > 11 +constexpr +#endif +bool test (T sv0) + { + T sv1; + sv1 = sv0; +// We can't just say "sv0 == sv1" here because string_view::compare +// isn't constexpr until C++17, and we want to support back to C++14 + return sv0.size() == sv1.size() && sv0.data() == sv1.data(); + } + +int main () { + + assert( test ( "1234")); +#ifdef _LIBCPP_HAS_NO_UNICODE_CHARS + assert( test (u"1234")); + assert( test (U"1234")); +#endif + assert( test (L"1234")); + +#if TEST_STD_VER > 11 + static_assert( test ({ "abc", 3}), ""); +#ifdef _LIBCPP_HAS_NO_UNICODE_CHARS + static_assert( test ({u"abc", 3}), ""); + static_assert( test ({U"abc", 3}), ""); +#endif + static_assert( test ({L"abc", 3}), ""); +#endif +} diff --git a/test/std/strings/string.view/string.view.cons/implicit_deduction_guides.pass.cpp b/test/std/strings/string.view/string.view.cons/implicit_deduction_guides.pass.cpp new file mode 100644 index 000000000000..7dd99d9c4405 --- /dev/null +++ b/test/std/strings/string.view/string.view.cons/implicit_deduction_guides.pass.cpp @@ -0,0 +1,65 @@ +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// UNSUPPORTED: c++98, c++03, c++11, c++14 +// UNSUPPORTED: libcpp-no-deduction-guides + +// + +// Test that the constructors offered by std::basic_string_view are formulated +// so they're compatible with implicit deduction guides. + +#include +#include + +#include "test_macros.h" +#include "constexpr_char_traits.hpp" + +// Overloads +// --------------- +// (1) basic_string_view() - NOT TESTED +// (2) basic_string_view(const basic_string_view&) +// (3) basic_string_view(const CharT*, size_type) +// (4) basic_string_view(const CharT*) +int main() +{ + { // Testing (1) + // Nothing TODO. Cannot deduce without any arguments. + } + { // Testing (2) + const std::string_view sin("abc"); + std::basic_string_view s(sin); + ASSERT_SAME_TYPE(decltype(s), std::string_view); + assert(s == "abc"); + + using WSV = std::basic_string_view>; + const WSV win(L"abcdef"); + std::basic_string_view w(win); + ASSERT_SAME_TYPE(decltype(w), WSV); + assert(w == L"abcdef"); + } + { // Testing (3) + std::basic_string_view s("abc", 2); + ASSERT_SAME_TYPE(decltype(s), std::string_view); + assert(s == "ab"); + + std::basic_string_view w(L"abcdef", 4); + ASSERT_SAME_TYPE(decltype(w), std::wstring_view); + assert(w == L"abcd"); + } + { // Testing (4) + std::basic_string_view s("abc"); + ASSERT_SAME_TYPE(decltype(s), std::string_view); + assert(s == "abc"); + + std::basic_string_view w(L"abcdef"); + ASSERT_SAME_TYPE(decltype(w), std::wstring_view); + assert(w == L"abcdef"); + } +} diff --git a/test/std/strings/string.view/string.view.hash/enabled_hashes.pass.cpp b/test/std/strings/string.view/string.view.hash/enabled_hashes.pass.cpp new file mode 100644 index 000000000000..2e9ebcb4c037 --- /dev/null +++ b/test/std/strings/string.view/string.view.hash/enabled_hashes.pass.cpp @@ -0,0 +1,31 @@ +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// UNSUPPORTED: c++98, c++03 + +// + +// Test that provides all of the arithmetic, enum, and pointer +// hash specializations. + +#include + +#include "poisoned_hash_helper.hpp" + +int main() { + test_library_hash_specializations_available(); + { + test_hash_enabled_for_type(); + test_hash_enabled_for_type(); +#ifndef _LIBCPP_HAS_NO_UNICODE_CHARS + test_hash_enabled_for_type(); + test_hash_enabled_for_type(); +#endif + } +} 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 63099e2c8864..53c3d261d882 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 @@ -19,29 +19,41 @@ // Not very portable #include +#include #include #include +#include "test_macros.h" + using std::string_view; -template +template void test() { - typedef std::hash H; - static_assert((std::is_same::value), "" ); + typedef std::hash H; + static_assert((std::is_same::value), "" ); static_assert((std::is_same::value), "" ); - H h; -// std::string g1 = "1234567890"; -// std::string g2 = "1234567891"; - typedef typename T::value_type char_type; + + 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 ]; for ( int i = 0; i < 10; ++i ) g1[i] = g2[9-i] = static_cast('0' + i); - T s1(g1, 10); - T s2(g2, 10); + H h; + SH sh; + SV s1(g1, 10); + String ss1(s1); + SV s2(g2, 10); + String ss2(s2); + assert(h(s1) == h(s1)); assert(h(s1) != h(s2)); + assert(sh(ss1) == h(s1)); + assert(sh(ss2) == h(s2)); } int main() diff --git a/test/std/strings/string.view/string.view.iterators/rbegin.pass.cpp b/test/std/strings/string.view/string.view.iterators/rbegin.pass.cpp index 381f792e5ce0..16a4da882739 100644 --- a/test/std/strings/string.view/string.view.iterators/rbegin.pass.cpp +++ b/test/std/strings/string.view/string.view.iterators/rbegin.pass.cpp @@ -58,4 +58,23 @@ int main() test(u16string_view{u"123"}); test(u32string_view{U"123"}); #endif + +#if TEST_STD_VER > 14 + { + constexpr string_view sv { "123", 3 }; + constexpr u16string_view u16sv {u"123", 3 }; + constexpr u32string_view u32sv {U"123", 3 }; + constexpr wstring_view wsv {L"123", 3 }; + + static_assert ( *sv.rbegin() == sv[2], "" ); + static_assert ( *u16sv.rbegin() == u16sv[2], "" ); + static_assert ( *u32sv.rbegin() == u32sv[2], "" ); + static_assert ( *wsv.rbegin() == wsv[2], "" ); + + static_assert ( *sv.crbegin() == sv[2], "" ); + static_assert ( *u16sv.crbegin() == u16sv[2], "" ); + static_assert ( *u32sv.crbegin() == u32sv[2], "" ); + static_assert ( *wsv.crbegin() == wsv[2], "" ); + } +#endif } diff --git a/test/std/strings/string.view/string.view.iterators/rend.pass.cpp b/test/std/strings/string.view/string.view.iterators/rend.pass.cpp index ca529fb708dc..08f9e5a7755b 100644 --- a/test/std/strings/string.view/string.view.iterators/rend.pass.cpp +++ b/test/std/strings/string.view/string.view.iterators/rend.pass.cpp @@ -66,4 +66,23 @@ int main() test(u16string_view{u"123"}); test(u32string_view{U"123"}); #endif + +#if TEST_STD_VER > 14 + { + constexpr string_view sv { "123", 3 }; + constexpr u16string_view u16sv {u"123", 3 }; + constexpr u32string_view u32sv {U"123", 3 }; + constexpr wstring_view wsv {L"123", 3 }; + + static_assert ( *--sv.rend() == sv[0], "" ); + static_assert ( *--u16sv.rend() == u16sv[0], "" ); + static_assert ( *--u32sv.rend() == u32sv[0], "" ); + static_assert ( *--wsv.rend() == wsv[0], "" ); + + static_assert ( *--sv.crend() == sv[0], "" ); + static_assert ( *--u16sv.crend() == u16sv[0], "" ); + static_assert ( *--u32sv.crend() == u32sv[0], "" ); + static_assert ( *--wsv.crend() == wsv[0], "" ); + } +#endif } diff --git a/test/std/strings/string.view/string_view.literals/literal.pass.cpp b/test/std/strings/string.view/string_view.literals/literal.pass.cpp index 9fb128ab0f55..710009cc51ee 100644 --- a/test/std/strings/string.view/string_view.literals/literal.pass.cpp +++ b/test/std/strings/string.view/string_view.literals/literal.pass.cpp @@ -48,7 +48,7 @@ int main() Lfoo = L"ABC"sv; assert(Lfoo == L"ABC"); assert(Lfoo == std::wstring_view ( L"ABC")); ufoo = u"ABC"sv; assert(ufoo == u"ABC"); assert(ufoo == std::u16string_view( u"ABC")); Ufoo = U"ABC"sv; assert(Ufoo == U"ABC"); assert(Ufoo == std::u32string_view( U"ABC")); - + static_assert( "ABC"sv.size() == 3, ""); static_assert(u8"ABC"sv.size() == 3, ""); static_assert( L"ABC"sv.size() == 3, ""); 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 000000000000..6cd15e6a67ba --- /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 a44f8af7d41b..cc2d978d2c2b 100644 --- a/test/std/thread/futures/futures.future_error/what.pass.cpp +++ b/test/std/thread/futures/futures.future_error/what.pass.cpp @@ -12,8 +12,8 @@ // 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-macosx10.7 +// XFAIL: with_system_cxx_lib=x86_64-apple-macosx10.8 // XFAIL: with_system_cxx_lib=x86_64-apple-darwin13 // diff --git a/test/std/thread/futures/futures.promise/set_rvalue.pass.cpp b/test/std/thread/futures/futures.promise/set_rvalue.pass.cpp index e0c6e15d98d5..e986885c0c71 100644 --- a/test/std/thread/futures/futures.promise/set_rvalue.pass.cpp +++ b/test/std/thread/futures/futures.promise/set_rvalue.pass.cpp @@ -6,7 +6,8 @@ // Source Licenses. See LICENSE.TXT for details. // //===----------------------------------------------------------------------===// -// + +// UNSUPPORTED: c++98, c++03 // UNSUPPORTED: libcpp-has-no-threads, libcpp-no-exceptions // @@ -19,8 +20,6 @@ #include #include -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES - struct A { A() {} @@ -28,11 +27,8 @@ struct A A(A&&) {throw 9;} }; -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES - int main() { -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES { typedef std::unique_ptr T; T i(new int(3)); @@ -65,5 +61,4 @@ int main() assert(j == 9); } } -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES } diff --git a/test/std/thread/futures/futures.promise/set_rvalue_at_thread_exit.pass.cpp b/test/std/thread/futures/futures.promise/set_rvalue_at_thread_exit.pass.cpp index 8f3b76865e2a..05675725bf43 100644 --- a/test/std/thread/futures/futures.promise/set_rvalue_at_thread_exit.pass.cpp +++ b/test/std/thread/futures/futures.promise/set_rvalue_at_thread_exit.pass.cpp @@ -7,7 +7,7 @@ // //===----------------------------------------------------------------------===// // -// UNSUPPORTED: libcpp-has-no-threads +// UNSUPPORTED: libcpp-has-no-threads, c++98, c++03 // @@ -19,23 +19,17 @@ #include #include -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES - void func(std::promise> p) { p.set_value_at_thread_exit(std::unique_ptr(new int(5))); } -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES - int main() { -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES { std::promise> p; std::future> f = p.get_future(); std::thread(func, std::move(p)).detach(); assert(*f.get() == 5); } -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES } 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 39784876b8c3..7cac21d48aef 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/futures/futures.unique_future/move_assign.pass.cpp b/test/std/thread/futures/futures.unique_future/move_assign.pass.cpp index 8d38b81f0cda..4a790b06cfdf 100644 --- a/test/std/thread/futures/futures.unique_future/move_assign.pass.cpp +++ b/test/std/thread/futures/futures.unique_future/move_assign.pass.cpp @@ -7,7 +7,7 @@ // //===----------------------------------------------------------------------===// // -// UNSUPPORTED: libcpp-has-no-threads +// UNSUPPORTED: libcpp-has-no-threads, c++98, c++03 // @@ -20,7 +20,6 @@ int main() { -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES { typedef int T; std::promise p; @@ -72,5 +71,4 @@ int main() assert(!f0.valid()); assert(!f.valid()); } -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES } diff --git a/test/std/thread/futures/futures.unique_future/move_ctor.pass.cpp b/test/std/thread/futures/futures.unique_future/move_ctor.pass.cpp index e12c920886fa..14e2eb416961 100644 --- a/test/std/thread/futures/futures.unique_future/move_ctor.pass.cpp +++ b/test/std/thread/futures/futures.unique_future/move_ctor.pass.cpp @@ -7,7 +7,7 @@ // //===----------------------------------------------------------------------===// // -// UNSUPPORTED: libcpp-has-no-threads +// UNSUPPORTED: libcpp-has-no-threads, c++98, c++03 // @@ -20,7 +20,6 @@ int main() { -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES { typedef int T; std::promise p; @@ -66,5 +65,4 @@ int main() assert(!f0.valid()); assert(!f.valid()); } -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES } diff --git a/test/std/thread/futures/futures.unique_future/share.pass.cpp b/test/std/thread/futures/futures.unique_future/share.pass.cpp index ef011d8df752..9b8667e538cc 100644 --- a/test/std/thread/futures/futures.unique_future/share.pass.cpp +++ b/test/std/thread/futures/futures.unique_future/share.pass.cpp @@ -25,14 +25,16 @@ int main() typedef int T; std::promise p; std::future f0 = p.get_future(); - std::shared_future f = std::move(f0.share()); + static_assert( noexcept(f0.share()), ""); + std::shared_future f = f0.share(); assert(!f0.valid()); assert(f.valid()); } { typedef int T; std::future f0; - std::shared_future f = std::move(f0.share()); + static_assert( noexcept(f0.share()), ""); + std::shared_future f = f0.share(); assert(!f0.valid()); assert(!f.valid()); } @@ -40,14 +42,16 @@ int main() typedef int& T; std::promise p; std::future f0 = p.get_future(); - std::shared_future f = std::move(f0.share()); + static_assert( noexcept(f0.share()), ""); + std::shared_future f = f0.share(); assert(!f0.valid()); assert(f.valid()); } { typedef int& T; std::future f0; - std::shared_future f = std::move(f0.share()); + static_assert( noexcept(f0.share()), ""); + std::shared_future f = f0.share(); assert(!f0.valid()); assert(!f.valid()); } @@ -55,14 +59,16 @@ int main() typedef void T; std::promise p; std::future f0 = p.get_future(); - std::shared_future f = std::move(f0.share()); + static_assert( noexcept(f0.share()), ""); + std::shared_future f = f0.share(); assert(!f0.valid()); assert(f.valid()); } { typedef void T; std::future f0; - std::shared_future f = std::move(f0.share()); + static_assert( noexcept(f0.share()), ""); + std::shared_future f = f0.share(); assert(!f0.valid()); assert(!f.valid()); } diff --git a/test/std/thread/thread.condition/PR30202_notify_from_pthread_created_thread.pass.cpp b/test/std/thread/thread.condition/PR30202_notify_from_pthread_created_thread.pass.cpp index d60e42918860..de225fe78384 100644 --- a/test/std/thread/thread.condition/PR30202_notify_from_pthread_created_thread.pass.cpp +++ b/test/std/thread/thread.condition/PR30202_notify_from_pthread_created_thread.pass.cpp @@ -8,6 +8,7 @@ //===----------------------------------------------------------------------===// // // UNSUPPORTED: libcpp-has-no-threads +// REQUIRES: libcpp-has-thread-api-pthread // notify_all_at_thread_exit(...) requires move semantics to transfer the // unique_lock. diff --git a/test/std/thread/thread.condition/thread.condition.condvarany/wait_terminates.sh.cpp b/test/std/thread/thread.condition/thread.condition.condvarany/wait_terminates.sh.cpp index a2b7061c2546..71cbc94a70a4 100644 --- a/test/std/thread/thread.condition/thread.condition.condvarany/wait_terminates.sh.cpp +++ b/test/std/thread/thread.condition/thread.condition.condvarany/wait_terminates.sh.cpp @@ -24,8 +24,8 @@ // ----------------------------------------------------------------------------- // Overview -// Check that std::terminate is called if wait(...) fails to meet it's post -// conditions. This can happens when reacquiring the mutex throws +// Check that std::terminate is called if wait(...) fails to meet its post +// conditions. This can happen when reacquiring the mutex throws // an exception. // // The following methods are tested within this file @@ -37,7 +37,7 @@ // 6. void wait_until(Lock& lock, TimePoint, Pred); // // Plan -// 1 Create a mutex type, 'ThrowingMutex', that throws when the lock is aquired +// 1 Create a mutex type, 'ThrowingMutex', that throws when the lock is acquired // for the *second* time. // // 2 Replace the terminate handler with one that exits with a '0' exit code. 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 46d04cdac350..245c480885b8 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 @@ -9,10 +9,10 @@ // // UNSUPPORTED: libcpp-has-no-threads -// This test hangs forever when built against libstdc++. In order to allow +// This test hangs forever when built against libstdc++ and MSVC. In order to allow // validation of the test suite against other STLs we have to mark it // unsupported. -// UNSUPPORTED: libstdc++ +// UNSUPPORTED: libstdc++, msvc // 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 a15405fcd98b..fffd087ee877 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_adopt_lock.pass.cpp b/test/std/thread/thread.mutex/thread.lock/thread.lock.guard/variadic_adopt_lock.pass.cpp deleted file mode 100644 index 81fc0d368f6a..000000000000 --- a/test/std/thread/thread.mutex/thread.lock/thread.lock.guard/variadic_adopt_lock.pass.cpp +++ /dev/null @@ -1,63 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// -// -// UNSUPPORTED: libcpp-has-no-threads -// UNSUPPORTED: c++98, c++03 - -// - -// template class lock_guard; - -// lock_guard(Mutex&..., adopt_lock_t); - -// MODULES_DEFINES: _LIBCPP_ABI_VARIADIC_LOCK_GUARD -#define _LIBCPP_ABI_VARIADIC_LOCK_GUARD -#include -#include - -struct TestMutex { - bool locked = false; - TestMutex() = default; - - void lock() { assert(!locked); locked = true; } - bool try_lock() { if (locked) return false; locked = true; return true; } - void unlock() { assert(locked); locked = false; } - - TestMutex(TestMutex const&) = delete; - TestMutex& operator=(TestMutex const&) = delete; -}; - -int main() -{ - { - using LG = std::lock_guard<>; - LG lg(std::adopt_lock); - } - { - TestMutex m1, m2; - using LG = std::lock_guard; - m1.lock(); m2.lock(); - { - LG lg(m1, m2, std::adopt_lock); - assert(m1.locked && m2.locked); - } - assert(!m1.locked && !m2.locked); - } - { - TestMutex m1, m2, m3; - using LG = std::lock_guard; - m1.lock(); m2.lock(); m3.lock(); - { - LG lg(m1, m2, m3, std::adopt_lock); - assert(m1.locked && m2.locked && m3.locked); - } - assert(!m1.locked && !m2.locked && !m3.locked); - } - -} 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.guard/variadic_assign.fail.cpp deleted file mode 100644 index 1b4c9d4bfd5d..000000000000 --- a/test/std/thread/thread.mutex/thread.lock/thread.lock.guard/variadic_assign.fail.cpp +++ /dev/null @@ -1,45 +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 -// UNSUPPORTED: c++98, c++03 - -// - -// template class lock_guard; - -// lock_guard& operator=(lock_guard const&) = delete; - -// MODULES_DEFINES: _LIBCPP_ABI_VARIADIC_LOCK_GUARD -#define _LIBCPP_ABI_VARIADIC_LOCK_GUARD -#include - -int main() -{ - using M = std::mutex; - M m0, m1, m2; - M om0, om1, om2; - { - using LG = std::lock_guard<>; - LG lg1, lg2; - lg1 = lg2; // expected-error{{overload resolution selected deleted operator '='}} - } - { - using LG = std::lock_guard; - LG lg1(m0, m1); - LG lg2(om0, om1); - lg1 = lg2; // expected-error{{overload resolution selected deleted operator '='}} - } - { - using LG = std::lock_guard; - 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.guard/variadic_copy.fail.cpp deleted file mode 100644 index c7fd0e94b771..000000000000 --- a/test/std/thread/thread.mutex/thread.lock/thread.lock.guard/variadic_copy.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. -// -//===----------------------------------------------------------------------===// - -// UNSUPPORTED: libcpp-has-no-threads -// UNSUPPORTED: c++98, c++03 - -// - -// template class lock_guard; - -// lock_guard(lock_guard const&) = delete; - -// MODULES_DEFINES: _LIBCPP_ABI_VARIADIC_LOCK_GUARD -#define _LIBCPP_ABI_VARIADIC_LOCK_GUARD -#include - -int main() -{ - using M = std::mutex; - M m0, m1, m2; - { - using LG = std::lock_guard<>; - const LG Orig; - LG Copy(Orig); // expected-error{{call to deleted constructor of 'LG'}} - } - { - using LG = std::lock_guard; - const LG Orig(m0, m1); - LG Copy(Orig); // expected-error{{call to deleted constructor of 'LG'}} - } - { - using LG = std::lock_guard; - 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.guard/variadic_mutex.fail.cpp deleted file mode 100644 index 1eef7e268fb2..000000000000 --- a/test/std/thread/thread.mutex/thread.lock/thread.lock.guard/variadic_mutex.fail.cpp +++ /dev/null @@ -1,48 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// UNSUPPORTED: libcpp-has-no-threads -// UNSUPPORTED: c++98, c++03 - -// - -// template class lock_guard; - -// explicit lock_guard(Mutex&...); - -// MODULES_DEFINES: _LIBCPP_ABI_VARIADIC_LOCK_GUARD -#define _LIBCPP_ABI_VARIADIC_LOCK_GUARD -#include - -template -void test_conversion(LG) {} - -int main() -{ - using M = std::mutex; - M m0, m1, m2; - M n0, n1, n2; - { - using LG = std::lock_guard<>; - 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; - 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; - 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.guard/variadic_mutex.pass.cpp deleted file mode 100644 index 8d83ddf98c6d..000000000000 --- a/test/std/thread/thread.mutex/thread.lock/thread.lock.guard/variadic_mutex.pass.cpp +++ /dev/null @@ -1,116 +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 -// UNSUPPORTED: c++98, c++03 - -// - -// template class lock_guard; - -// explicit lock_guard(mutex_type& m); - -// MODULES_DEFINES: _LIBCPP_ABI_VARIADIC_LOCK_GUARD -#define _LIBCPP_ABI_VARIADIC_LOCK_GUARD -#include -#include - -#include "test_macros.h" - -struct TestMutex { - bool locked = false; - TestMutex() = default; - ~TestMutex() { assert(!locked); } - - void lock() { assert(!locked); locked = true; } - bool try_lock() { if (locked) return false; locked = true; return true; } - void unlock() { assert(locked); locked = false; } - - TestMutex(TestMutex const&) = delete; - TestMutex& operator=(TestMutex const&) = delete; -}; - -#if !defined(TEST_HAS_NO_EXCEPTIONS) -struct TestMutexThrows { - bool locked = false; - bool throws_on_lock = false; - - TestMutexThrows() = default; - ~TestMutexThrows() { assert(!locked); } - - void lock() { - assert(!locked); - if (throws_on_lock) { - throw 42; - } - locked = true; - } - - bool try_lock() { - if (locked) return false; - lock(); - return true; - } - - void unlock() { assert(locked); locked = false; } - - TestMutexThrows(TestMutexThrows const&) = delete; - TestMutexThrows& operator=(TestMutexThrows const&) = delete; -}; -#endif // !defined(TEST_HAS_NO_EXCEPTIONS) - -int main() -{ - { - using LG = std::lock_guard<>; - LG lg; - } - { - using LG = std::lock_guard; - TestMutex m1, m2; - { - LG lg(m1, m2); - assert(m1.locked && m2.locked); - } - assert(!m1.locked && !m2.locked); - } - { - using LG = std::lock_guard; - TestMutex m1, m2, m3; - { - LG lg(m1, m2, m3); - assert(m1.locked && m2.locked && m3.locked); - } - assert(!m1.locked && !m2.locked && !m3.locked); - } -#if !defined(TEST_HAS_NO_EXCEPTIONS) - { - using MT = TestMutexThrows; - using LG = std::lock_guard; - MT m1, m2; - m1.throws_on_lock = true; - try { - LG lg(m1, m2); - assert(false); - } catch (int) {} - assert(!m1.locked && !m2.locked); - } - { - using MT = TestMutexThrows; - using LG = std::lock_guard; - MT m1, m2, m3; - m2.throws_on_lock = true; - try { - LG lg(m1, m2, m3); - assert(false); - } catch (int) {} - assert(!m1.locked && !m2.locked && !m3.locked); - } -#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 0ad16e2856fd..000000000000 --- 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_types.pass.cpp b/test/std/thread/thread.mutex/thread.lock/thread.lock.guard/variadic_types.pass.cpp deleted file mode 100644 index 600399d9793e..000000000000 --- a/test/std/thread/thread.mutex/thread.lock/thread.lock.guard/variadic_types.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. -// -//===----------------------------------------------------------------------===// -// -// UNSUPPORTED: libcpp-has-no-threads -// UNSUPPORTED: c++98, c++03 - -// - -// template -// class lock_guard -// { -// public: -// typedef Mutex mutex_type; -// ... -// }; - -// MODULES_DEFINES: _LIBCPP_ABI_VARIADIC_LOCK_GUARD -#define _LIBCPP_ABI_VARIADIC_LOCK_GUARD -#include -#include - -struct NAT {}; - -template -auto test_typedef(int) -> typename LG::mutex_type; - -template -auto test_typedef(...) -> NAT; - -template -constexpr bool has_mutex_type() { - return !std::is_same(0)), NAT>::value; -} - -int main() -{ - { - using T = std::lock_guard<>; - static_assert(!has_mutex_type(), ""); - } - { - using M1 = std::mutex; - using T = std::lock_guard; - static_assert(std::is_same::value, ""); - } - { - using M1 = std::recursive_mutex; - using T = std::lock_guard; - static_assert(std::is_same::value, ""); - } - { - using M1 = std::mutex; - using M2 = std::recursive_mutex; - using T = std::lock_guard; - static_assert(!has_mutex_type(), ""); - } - { - using M1 = std::mutex; - using M2 = std::recursive_mutex; - using T = std::lock_guard; - static_assert(!has_mutex_type(), ""); - } - { - using M1 = std::mutex; - using T = std::lock_guard; - static_assert(!has_mutex_type(), ""); - } - { - using M1 = std::recursive_mutex; - using T = std::lock_guard; - static_assert(!has_mutex_type(), ""); - } -} diff --git a/test/std/thread/thread.mutex/thread.lock/thread.lock.scoped/adopt_lock.pass.cpp b/test/std/thread/thread.mutex/thread.lock/thread.lock.scoped/adopt_lock.pass.cpp new file mode 100644 index 000000000000..78165383a158 --- /dev/null +++ b/test/std/thread/thread.mutex/thread.lock/thread.lock.scoped/adopt_lock.pass.cpp @@ -0,0 +1,72 @@ +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// +// +// UNSUPPORTED: libcpp-has-no-threads +// UNSUPPORTED: c++98, c++03, c++11, c++14 + +// + +// template class scoped_lock; + +// scoped_lock(Mutex&..., adopt_lock_t); + +#include +#include +#include "test_macros.h" + +struct TestMutex { + bool locked = false; + TestMutex() = default; + + void lock() { assert(!locked); locked = true; } + bool try_lock() { if (locked) return false; locked = true; return true; } + void unlock() { assert(locked); locked = false; } + + TestMutex(TestMutex const&) = delete; + TestMutex& operator=(TestMutex const&) = delete; +}; + +int main() +{ + { + 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::scoped_lock; + m1.lock(); m2.lock(); + { + LG lg(m1, m2, std::adopt_lock); + assert(m1.locked && m2.locked); + } + assert(!m1.locked && !m2.locked); + } + { + TestMutex m1, m2, m3; + using LG = std::scoped_lock; + m1.lock(); m2.lock(); m3.lock(); + { + LG lg(m1, m2, m3, std::adopt_lock); + assert(m1.locked && m2.locked && m3.locked); + } + assert(!m1.locked && !m2.locked && !m3.locked); + } + +} diff --git a/test/std/thread/thread.mutex/thread.lock/thread.lock.scoped/assign.fail.cpp b/test/std/thread/thread.mutex/thread.lock/thread.lock.scoped/assign.fail.cpp new file mode 100644 index 000000000000..a05472935526 --- /dev/null +++ b/test/std/thread/thread.mutex/thread.lock/thread.lock.scoped/assign.fail.cpp @@ -0,0 +1,50 @@ +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// UNSUPPORTED: libcpp-has-no-threads +// UNSUPPORTED: c++98, c++03, c++11, c++14 + +// + +// template class scoped_lock; + +// scoped_lock& operator=(scoped_lock const&) = delete; + +#include +#include "test_macros.h" + +int main() +{ + using M = std::mutex; + M m0, m1, m2; + M om0, om1, om2; + { + using LG = std::scoped_lock<>; + LG lg1, lg2; + lg1 = lg2; // expected-error{{overload resolution selected deleted operator '='}} + } + { + 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::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.scoped/copy.fail.cpp b/test/std/thread/thread.mutex/thread.lock/thread.lock.scoped/copy.fail.cpp new file mode 100644 index 000000000000..5075a4268095 --- /dev/null +++ b/test/std/thread/thread.mutex/thread.lock/thread.lock.scoped/copy.fail.cpp @@ -0,0 +1,46 @@ +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// UNSUPPORTED: libcpp-has-no-threads +// UNSUPPORTED: c++98, c++03, c++11, c++14 + +// + +// template class scoped_lock; + +// scoped_lock(scoped_lock const&) = delete; + +#include +#include "test_macros.h" + +int main() +{ + using M = std::mutex; + M m0, m1, m2; + { + using LG = std::scoped_lock<>; + const LG Orig; + LG Copy(Orig); // expected-error{{call to deleted constructor of 'LG'}} + } + { + 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::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.scoped/mutex.fail.cpp b/test/std/thread/thread.mutex/thread.lock/thread.lock.scoped/mutex.fail.cpp new file mode 100644 index 000000000000..7bb4673265cf --- /dev/null +++ b/test/std/thread/thread.mutex/thread.lock/thread.lock.scoped/mutex.fail.cpp @@ -0,0 +1,53 @@ +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// UNSUPPORTED: libcpp-has-no-threads +// UNSUPPORTED: c++98, c++03, c++11, c++14 + +// + +// template class scoped_lock; + +// explicit scoped_lock(Mutex&...); + +#include +#include "test_macros.h" + +template +void test_conversion(LG) {} + +int main() +{ + using M = std::mutex; + M m0, m1, m2; + M n0, n1, n2; + { + 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::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::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.scoped/mutex.pass.cpp b/test/std/thread/thread.mutex/thread.lock/thread.lock.scoped/mutex.pass.cpp new file mode 100644 index 000000000000..ef39bbcc5e88 --- /dev/null +++ b/test/std/thread/thread.mutex/thread.lock/thread.lock.scoped/mutex.pass.cpp @@ -0,0 +1,155 @@ +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// +// +// UNSUPPORTED: libcpp-has-no-threads +// UNSUPPORTED: c++98, c++03, c++11, c++14 + +// + +// template class scoped_lock; + +// explicit scoped_lock(mutex_type& m); + +#include +#include +#include "test_macros.h" + +struct TestMutex { + bool locked = false; + TestMutex() = default; + ~TestMutex() { assert(!locked); } + + void lock() { assert(!locked); locked = true; } + bool try_lock() { if (locked) return false; locked = true; return true; } + void unlock() { assert(locked); locked = false; } + + TestMutex(TestMutex const&) = delete; + TestMutex& operator=(TestMutex const&) = delete; +}; + +#if !defined(TEST_HAS_NO_EXCEPTIONS) +struct TestMutexThrows { + bool locked = false; + bool throws_on_lock = false; + + TestMutexThrows() = default; + ~TestMutexThrows() { assert(!locked); } + + void lock() { + assert(!locked); + if (throws_on_lock) { + throw 42; + } + locked = true; + } + + bool try_lock() { + if (locked) return false; + lock(); + return true; + } + + void unlock() { assert(locked); locked = false; } + + TestMutexThrows(TestMutexThrows const&) = delete; + TestMutexThrows& operator=(TestMutexThrows const&) = delete; +}; +#endif // !defined(TEST_HAS_NO_EXCEPTIONS) + +int main() +{ + { + using LG = std::scoped_lock<>; + LG lg; + } + { + 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); + assert(m1.locked && m2.locked); + } + assert(!m1.locked && !m2.locked); + } + { + using LG = std::scoped_lock; + TestMutex m1, m2, m3; + { + LG lg(m1, m2, m3); + assert(m1.locked && m2.locked && m3.locked); + } + assert(!m1.locked && !m2.locked && !m3.locked); + } +#if !defined(TEST_HAS_NO_EXCEPTIONS) + { + using MT = TestMutexThrows; + 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 { + LG lg(m1, m2); + assert(false); + } catch (int) {} + assert(!m1.locked && !m2.locked); + } + { + using MT = TestMutexThrows; + using LG = std::scoped_lock; + MT m1, m2, m3; + m2.throws_on_lock = true; + try { + LG lg(m1, m2, m3); + assert(false); + } catch (int) {} + 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.scoped/types.pass.cpp b/test/std/thread/thread.mutex/thread.lock/thread.lock.scoped/types.pass.cpp new file mode 100644 index 000000000000..6af3c6c952d7 --- /dev/null +++ b/test/std/thread/thread.mutex/thread.lock/thread.lock.scoped/types.pass.cpp @@ -0,0 +1,78 @@ +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// +// +// UNSUPPORTED: libcpp-has-no-threads +// UNSUPPORTED: c++98, c++03, c++11, c++14 + +// + +// template +// class scoped_lock +// { +// public: +// typedef Mutex mutex_type; // only if sizeof...(Mutex) == 1 +// ... +// }; + +#include +#include +#include "test_macros.h" + +struct NAT {}; + +template +auto test_typedef(int) -> typename LG::mutex_type; + +template +auto test_typedef(...) -> NAT; + +template +constexpr bool has_mutex_type() { + return !std::is_same(0)), NAT>::value; +} + +int main() +{ + { + using T = std::scoped_lock<>; + static_assert(!has_mutex_type(), ""); + } + { + using M1 = std::mutex; + using T = std::scoped_lock; + static_assert(std::is_same::value, ""); + } + { + using M1 = std::recursive_mutex; + using T = std::scoped_lock; + static_assert(std::is_same::value, ""); + } + { + using M1 = std::mutex; + using M2 = std::recursive_mutex; + using T = std::scoped_lock; + static_assert(!has_mutex_type(), ""); + } + { + using M1 = std::mutex; + using M2 = std::recursive_mutex; + using T = std::scoped_lock; + static_assert(!has_mutex_type(), ""); + } + { + using M1 = std::mutex; + using T = std::scoped_lock; + static_assert(!has_mutex_type(), ""); + } + { + using M1 = std::recursive_mutex; + using T = std::scoped_lock; + static_assert(!has_mutex_type(), ""); + } +} 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 f9a537085c30..ac338064d1fd 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/move_assign.pass.cpp b/test/std/thread/thread.mutex/thread.lock/thread.lock.unique/thread.lock.unique.cons/move_assign.pass.cpp index e5db685e46e7..6f17383298fd 100644 --- a/test/std/thread/thread.mutex/thread.lock/thread.lock.unique/thread.lock.unique.cons/move_assign.pass.cpp +++ b/test/std/thread/thread.mutex/thread.lock/thread.lock.unique/thread.lock.unique.cons/move_assign.pass.cpp @@ -7,7 +7,7 @@ // //===----------------------------------------------------------------------===// // -// UNSUPPORTED: libcpp-has-no-threads +// UNSUPPORTED: libcpp-has-no-threads, c++98, c++03 // @@ -21,7 +21,6 @@ int main() { -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES { typedef std::mutex M; M m0; @@ -46,5 +45,4 @@ int main() assert(lk0.mutex() == nullptr); assert(lk0.owns_lock() == false); } -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES } diff --git a/test/std/thread/thread.mutex/thread.lock/thread.lock.unique/thread.lock.unique.cons/move_ctor.pass.cpp b/test/std/thread/thread.mutex/thread.lock/thread.lock.unique/thread.lock.unique.cons/move_ctor.pass.cpp index 427deabc5a59..04aa79673431 100644 --- a/test/std/thread/thread.mutex/thread.lock/thread.lock.unique/thread.lock.unique.cons/move_ctor.pass.cpp +++ b/test/std/thread/thread.mutex/thread.lock/thread.lock.unique/thread.lock.unique.cons/move_ctor.pass.cpp @@ -7,7 +7,7 @@ // //===----------------------------------------------------------------------===// // -// UNSUPPORTED: libcpp-has-no-threads +// UNSUPPORTED: libcpp-has-no-threads, c++98, c++03 // @@ -21,7 +21,6 @@ int main() { -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES { typedef std::mutex M; M m; @@ -42,5 +41,4 @@ int main() assert(lk0.mutex() == nullptr); assert(lk0.owns_lock() == false); } -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES } 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 1f7217a8300e..ca8bc6982253 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.threads/thread.thread.class/thread.thread.assign/move.pass.cpp b/test/std/thread/thread.threads/thread.thread.class/thread.thread.assign/move.pass.cpp index 2db9430a698d..d3478818c056 100644 --- a/test/std/thread/thread.threads/thread.thread.class/thread.thread.assign/move.pass.cpp +++ b/test/std/thread/thread.threads/thread.thread.class/thread.thread.assign/move.pass.cpp @@ -7,7 +7,7 @@ // //===----------------------------------------------------------------------===// // -// UNSUPPORTED: libcpp-has-no-threads +// UNSUPPORTED: libcpp-has-no-threads, c++98, c++03 // @@ -44,7 +44,6 @@ bool G::op_run = false; int main() { -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES { assert(G::n_alive == 0); assert(!G::op_run); @@ -61,5 +60,4 @@ int main() assert(G::n_alive == 0); assert(G::op_run); } -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES } diff --git a/test/std/thread/thread.threads/thread.thread.class/thread.thread.constr/F.pass.cpp b/test/std/thread/thread.threads/thread.thread.class/thread.thread.constr/F.pass.cpp index 437b42037913..d419b8cc855c 100644 --- a/test/std/thread/thread.threads/thread.thread.class/thread.thread.constr/F.pass.cpp +++ b/test/std/thread/thread.threads/thread.thread.class/thread.thread.constr/F.pass.cpp @@ -106,7 +106,7 @@ public: // A Each allocation performed during thread construction should be performed // in the parent thread so that std::terminate is not called if // std::bad_alloc is thrown by new. -// B std::threads constructor should properly handle exceptions and not leak +// B std::thread's constructor should properly handle exceptions and not leak // memory. // Plan: // 1 Create a thread and count the number of allocations, 'N', it performs. diff --git a/test/std/thread/thread.threads/thread.thread.class/thread.thread.constr/move.pass.cpp b/test/std/thread/thread.threads/thread.thread.class/thread.thread.constr/move.pass.cpp index e88304ec8da9..f349e4c56fcb 100644 --- a/test/std/thread/thread.threads/thread.thread.class/thread.thread.constr/move.pass.cpp +++ b/test/std/thread/thread.threads/thread.thread.class/thread.thread.constr/move.pass.cpp @@ -7,7 +7,7 @@ // //===----------------------------------------------------------------------===// // -// UNSUPPORTED: libcpp-has-no-threads +// UNSUPPORTED: libcpp-has-no-threads, c++98, c++03 // @@ -53,7 +53,6 @@ bool G::op_run = false; int main() { -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES { G g; assert(G::n_alive == 1); @@ -68,5 +67,4 @@ int main() assert(G::op_run); } assert(G::n_alive == 0); -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES } diff --git a/test/std/thread/thread.threads/thread.thread.class/thread.thread.id/enabled_hashes.pass.cpp b/test/std/thread/thread.threads/thread.thread.class/thread.thread.id/enabled_hashes.pass.cpp new file mode 100644 index 000000000000..9799467c4529 --- /dev/null +++ b/test/std/thread/thread.threads/thread.thread.class/thread.thread.id/enabled_hashes.pass.cpp @@ -0,0 +1,27 @@ +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// UNSUPPORTED: libcpp-has-no-threads +// UNSUPPORTED: c++98, c++03 + +// + +// Test that provides all of the arithmetic, enum, and pointer +// hash specializations. + +#include + +#include "poisoned_hash_helper.hpp" + +int main() { + test_library_hash_specializations_available(); + { + test_hash_enabled_for_type(); + } +} 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 106c69e2e4a1..4f1491decd31 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 @@ -9,7 +9,7 @@ // // UNSUPPORTED: libcpp-has-no-threads -// +// // template // struct hash @@ -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/allocator.adaptor/allocator.adaptor.members/construct_pair_const_lvalue_pair.pass.cpp b/test/std/utilities/allocator.adaptor/allocator.adaptor.members/construct_pair_const_lvalue_pair.pass.cpp index ef3b9302c7a2..dfb187b6cc2d 100644 --- a/test/std/utilities/allocator.adaptor/allocator.adaptor.members/construct_pair_const_lvalue_pair.pass.cpp +++ b/test/std/utilities/allocator.adaptor/allocator.adaptor.members/construct_pair_const_lvalue_pair.pass.cpp @@ -87,7 +87,6 @@ void test_no_inner_alloc() void test_with_inner_alloc() { - using VoidAlloc1 = CountingAllocator; using VoidAlloc2 = CountingAllocator; AllocController POuter; diff --git a/test/std/utilities/allocator.adaptor/allocator.adaptor.members/construct_pair_piecewise.pass.cpp b/test/std/utilities/allocator.adaptor/allocator.adaptor.members/construct_pair_piecewise.pass.cpp index 6f31d264280a..9689fb014786 100644 --- a/test/std/utilities/allocator.adaptor/allocator.adaptor.members/construct_pair_piecewise.pass.cpp +++ b/test/std/utilities/allocator.adaptor/allocator.adaptor.members/construct_pair_piecewise.pass.cpp @@ -88,7 +88,6 @@ void test_no_inner_alloc() void test_with_inner_alloc() { - using VoidAlloc1 = CountingAllocator; using VoidAlloc2 = CountingAllocator; AllocController POuter; diff --git a/test/std/utilities/allocator.adaptor/allocator.adaptor.members/construct_pair_rvalue.pass.cpp b/test/std/utilities/allocator.adaptor/allocator.adaptor.members/construct_pair_rvalue.pass.cpp index a761b3288060..92df0f6f2264 100644 --- a/test/std/utilities/allocator.adaptor/allocator.adaptor.members/construct_pair_rvalue.pass.cpp +++ b/test/std/utilities/allocator.adaptor/allocator.adaptor.members/construct_pair_rvalue.pass.cpp @@ -87,7 +87,6 @@ void test_no_inner_alloc() void test_with_inner_alloc() { - using VoidAlloc1 = CountingAllocator; using VoidAlloc2 = CountingAllocator; AllocController POuter; diff --git a/test/std/utilities/allocator.adaptor/allocator.adaptor.members/construct_pair_values.pass.cpp b/test/std/utilities/allocator.adaptor/allocator.adaptor.members/construct_pair_values.pass.cpp index de33eeb2fbda..2b7fe3f641ae 100644 --- a/test/std/utilities/allocator.adaptor/allocator.adaptor.members/construct_pair_values.pass.cpp +++ b/test/std/utilities/allocator.adaptor/allocator.adaptor.members/construct_pair_values.pass.cpp @@ -83,7 +83,6 @@ void test_no_inner_alloc() void test_with_inner_alloc() { - using VoidAlloc1 = CountingAllocator; using VoidAlloc2 = CountingAllocator; AllocController POuter; diff --git a/test/std/utilities/allocator.adaptor/allocator.adaptor.members/construct_type.pass.cpp b/test/std/utilities/allocator.adaptor/allocator.adaptor.members/construct_type.pass.cpp index 867cc74082e7..8568c7380b6d 100644 --- a/test/std/utilities/allocator.adaptor/allocator.adaptor.members/construct_type.pass.cpp +++ b/test/std/utilities/allocator.adaptor/allocator.adaptor.members/construct_type.pass.cpp @@ -31,7 +31,6 @@ // OUTERMOST_ALLOC_TRAITS(*this)::construct( // OUTERMOST (*this), p, std::forward(args)...). void test_bullet_one() { - using VoidAlloc1 = CountingAllocator; using VoidAlloc2 = CountingAllocator; AllocController POuter; @@ -41,7 +40,6 @@ void test_bullet_one() { using Outer = CountingAllocator; using Inner = CountingAllocator; using SA = std::scoped_allocator_adaptor; - using SAInner = std::scoped_allocator_adaptor; static_assert(!std::uses_allocator::value, ""); static_assert(!std::uses_allocator::value, ""); T* ptr = (T*)::operator new(sizeof(T)); @@ -66,7 +64,6 @@ void test_bullet_one() { // true, calls OUTERMOST_ALLOC_TRAITS(*this)::construct(OUTERMOST (*this), p, // allocator_arg, inner_allocator(), std::forward(args)...). void test_bullet_two() { - using VoidAlloc1 = CountingAllocator; using VoidAlloc2 = CountingAllocator; AllocController POuter; @@ -76,7 +73,6 @@ void test_bullet_two() { using Outer = CountingAllocator; using Inner = CountingAllocator; using SA = std::scoped_allocator_adaptor; - using SAInner = std::scoped_allocator_adaptor; static_assert(!std::uses_allocator::value, ""); static_assert(std::uses_allocator::value, ""); T* ptr = (T*)::operator new(sizeof(T)); @@ -101,7 +97,6 @@ void test_bullet_two() { // OUTERMOST_ALLOC_TRAITS(*this)::construct(OUTERMOST (*this), p, // std::forward(args)..., inner_allocator()). void test_bullet_three() { - using VoidAlloc1 = CountingAllocator; using VoidAlloc2 = CountingAllocator; AllocController POuter; @@ -111,7 +106,6 @@ void test_bullet_three() { using Outer = CountingAllocator; using Inner = CountingAllocator; using SA = std::scoped_allocator_adaptor; - using SAInner = std::scoped_allocator_adaptor; static_assert(!std::uses_allocator::value, ""); static_assert(std::uses_allocator::value, ""); T* ptr = (T*)::operator new(sizeof(T)); 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 65d94fd1e0a4..75dfb0a2e704 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 @@ -11,9 +11,9 @@ // -// template emplace(Args&&...); +// template T& emplace(Args&&...); // template -// void emplace(initializer_list, Args&&...); +// T& emplace(initializer_list, Args&&...); #include #include @@ -42,7 +42,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 +58,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 +74,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 +95,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 +116,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 +127,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); } 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 99cc029971a8..bbc135051ef8 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/function.objects/bind/func.bind/func.bind.bind/PR23141_invoke_not_constexpr.pass.cpp b/test/std/utilities/function.objects/bind/func.bind/func.bind.bind/PR23141_invoke_not_constexpr.pass.cpp index 5e347c4c5715..943e162172b0 100644 --- a/test/std/utilities/function.objects/bind/func.bind/func.bind.bind/PR23141_invoke_not_constexpr.pass.cpp +++ b/test/std/utilities/function.objects/bind/func.bind/func.bind.bind/PR23141_invoke_not_constexpr.pass.cpp @@ -16,7 +16,7 @@ // template // unspecified bind(Fn, Types...); -// https://llvm.org/bugs/show_bug.cgi?id=23141 +// https://bugs.llvm.org/show_bug.cgi?id=23141 #include #include diff --git a/test/std/utilities/function.objects/bind/func.bind/func.bind.bind/copy.pass.cpp b/test/std/utilities/function.objects/bind/func.bind/func.bind.bind/copy.pass.cpp index ad03e8fb6bb2..a4d502bb800e 100644 --- a/test/std/utilities/function.objects/bind/func.bind/func.bind.bind/copy.pass.cpp +++ b/test/std/utilities/function.objects/bind/func.bind/func.bind.bind/copy.pass.cpp @@ -16,7 +16,7 @@ // template // unspecified bind(Fn, Types...); -// http://llvm.org/bugs/show_bug.cgi?id=16385 +// https://bugs.llvm.org/show_bug.cgi?id=16385 #include #include diff --git a/test/std/utilities/function.objects/bind/func.bind/func.bind.bind/invoke_function_object.pass.cpp b/test/std/utilities/function.objects/bind/func.bind/func.bind.bind/invoke_function_object.pass.cpp index 180433109f26..a9a38b83cb4e 100644 --- a/test/std/utilities/function.objects/bind/func.bind/func.bind.bind/invoke_function_object.pass.cpp +++ b/test/std/utilities/function.objects/bind/func.bind/func.bind.bind/invoke_function_object.pass.cpp @@ -16,7 +16,7 @@ // template // unspecified bind(Fn, Types...); -// http://llvm.org/bugs/show_bug.cgi?id=22003 +// https://bugs.llvm.org/show_bug.cgi?id=22003 #include diff --git a/test/std/utilities/function.objects/bind/func.bind/func.bind.bind/nested.pass.cpp b/test/std/utilities/function.objects/bind/func.bind/func.bind.bind/nested.pass.cpp index 0d4244b4d860..5b660da617a8 100644 --- a/test/std/utilities/function.objects/bind/func.bind/func.bind.bind/nested.pass.cpp +++ b/test/std/utilities/function.objects/bind/func.bind/func.bind.bind/nested.pass.cpp @@ -16,7 +16,7 @@ // template // unspecified bind(Fn, Types...); -// http://llvm.org/bugs/show_bug.cgi?id=16343 +// https://bugs.llvm.org/show_bug.cgi?id=16343 #include #include 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 47a3e1cc5969..2b19211be9bf 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 @@ -414,7 +414,14 @@ void throws_in_constructor_test() throw 42; } ThrowsOnCopy() = default; - bool operator()() const { assert(false); } + bool operator()() const { + assert(false); +#if defined(_LIBCPP_MSVC) + __assume(0); +#else + __builtin_unreachable(); +#endif + } }; { ThrowsOnCopy cp; diff --git a/test/std/utilities/function.objects/func.wrap/func.wrap.func/derive_from.pass.cpp b/test/std/utilities/function.objects/func.wrap/func.wrap.func/derive_from.pass.cpp index 5bdf9e98e897..812f6fc502d9 100644 --- a/test/std/utilities/function.objects/func.wrap/func.wrap.func/derive_from.pass.cpp +++ b/test/std/utilities/function.objects/func.wrap/func.wrap.func/derive_from.pass.cpp @@ -8,11 +8,11 @@ //===----------------------------------------------------------------------===// // UNSUPPORTED: c++98, c++03 -// REQUIRES-ANY: c++11, c++14 +// REQUIRES: c++11 || c++14 // -// See https://llvm.org/bugs/show_bug.cgi?id=20002 +// See https://bugs.llvm.org/show_bug.cgi?id=20002 #include #include diff --git a/test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/F_nullptr.pass.cpp b/test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/F_nullptr.pass.cpp index f89bde8e6544..3affd984af60 100644 --- a/test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/F_nullptr.pass.cpp +++ b/test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/F_nullptr.pass.cpp @@ -14,7 +14,7 @@ // function(Fp); // Ensure that __not_null works for all function types. -// See https://llvm.org/bugs/show_bug.cgi?id=23589 +// See https://bugs.llvm.org/show_bug.cgi?id=23589 //------------------------------------------------------------------------------ // TESTING std::function<...>::__not_null(Callable) @@ -31,7 +31,7 @@ // types can be null. The other categories are not tested here. // 3) '__not_null(Callable)' is well formed when the call signature includes // varargs. -// 4) '__not_null(Callable)' works for Callable types with all aritys less +// 4) '__not_null(Callable)' works for Callable types with all arities less // than or equal to 3 in C++03. // 5) '__not_null(Callable)' works when 'Callable' is a member function // pointer to a cv or ref qualified function type. diff --git a/test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/alloc.pass.cpp b/test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/alloc.pass.cpp index 392dfc1993bc..adc7856357e7 100644 --- a/test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/alloc.pass.cpp +++ b/test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/alloc.pass.cpp @@ -8,7 +8,7 @@ //===----------------------------------------------------------------------===// // -// REQUIRES-ANY: c++98, c++03, c++11, c++14 +// REQUIRES: c++98 || c++03 || c++11 || c++14 // class function diff --git a/test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/alloc_F.pass.cpp b/test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/alloc_F.pass.cpp index 8d454723320c..4c1a1ca95ff4 100644 --- a/test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/alloc_F.pass.cpp +++ b/test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/alloc_F.pass.cpp @@ -8,7 +8,7 @@ //===----------------------------------------------------------------------===// // -// REQUIRES-ANY: c++98, c++03, c++11, c++14 +// REQUIRES: c++98 || c++03 || c++11 ||c++14 // class function diff --git a/test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/alloc_function.pass.cpp b/test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/alloc_function.pass.cpp index 718aa49341d2..8b0e831287a5 100644 --- a/test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/alloc_function.pass.cpp +++ b/test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/alloc_function.pass.cpp @@ -8,7 +8,7 @@ //===----------------------------------------------------------------------===// // -// REQUIRES-ANY: c++98, c++03, c++11, c++14 +// REQUIRES: c++98 || c++03 || c++11 || c++14 // class function diff --git a/test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/alloc_nullptr.pass.cpp b/test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/alloc_nullptr.pass.cpp index 354ad955f207..943e170878f2 100644 --- a/test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/alloc_nullptr.pass.cpp +++ b/test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/alloc_nullptr.pass.cpp @@ -8,7 +8,7 @@ //===----------------------------------------------------------------------===// // -// REQUIRES-ANY: c++98, c++03, c++11, c++14 +// REQUIRES: c++98 || c++03 || c++11 || c++14 // class function diff --git a/test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/alloc_rfunction.pass.cpp b/test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/alloc_rfunction.pass.cpp index e328481b274d..3e5435da1a16 100644 --- a/test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/alloc_rfunction.pass.cpp +++ b/test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/alloc_rfunction.pass.cpp @@ -8,7 +8,7 @@ //===----------------------------------------------------------------------===// // UNSUPPORTED: c++98, c++03 -// REQUIRES-ANY: c++11, c++14 +// REQUIRES: c++11 || c++14 // diff --git a/test/std/utilities/function.objects/unord.hash/enabled_hashes.pass.cpp b/test/std/utilities/function.objects/unord.hash/enabled_hashes.pass.cpp new file mode 100644 index 000000000000..775247fc80b6 --- /dev/null +++ b/test/std/utilities/function.objects/unord.hash/enabled_hashes.pass.cpp @@ -0,0 +1,23 @@ +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// UNSUPPORTED: c++98, c++03 + +// + +// Test that provides all of the arithmetic, enum, and pointer +// hash specializations. + +#include + +#include "poisoned_hash_helper.hpp" + +int main() { + test_library_hash_specializations_available(); +} 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 af367789a105..a7ddd9a49997 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; @@ -43,7 +44,8 @@ test() for (int i = 0; i <= 5; ++i) { T t(static_cast (i)); - if (sizeof(T) <= sizeof(std::size_t)) + const bool small = std::integral_constant::value; // avoid compiler warnings + if (small) assert(h1(t) == h2(static_cast(i))); } } 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 643e2d8c5d86..e67aa016c1e7 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 2f3f9bee4bc3..ce87f5918b20 100644 --- a/test/std/utilities/function.objects/unord.hash/integral.pass.cpp +++ b/test/std/utilities/function.objects/unord.hash/integral.pass.cpp @@ -31,12 +31,14 @@ 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) { T t(static_cast(i)); - if (sizeof(T) <= sizeof(std::size_t)) + const bool small = std::integral_constant::value; // avoid compiler warnings + if (small) { const std::size_t result = h(t); LIBCPP_ASSERT(result == static_cast(t)); @@ -63,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 a48394495e2d..36280a38e0a7 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/specialized.algorithms/uninitialized.construct.default/uninitialized_default_construct.pass.cpp b/test/std/utilities/memory/specialized.algorithms/uninitialized.construct.default/uninitialized_default_construct.pass.cpp index 533d516707e1..05e55e3d9a4e 100644 --- a/test/std/utilities/memory/specialized.algorithms/uninitialized.construct.default/uninitialized_default_construct.pass.cpp +++ b/test/std/utilities/memory/specialized.algorithms/uninitialized.construct.default/uninitialized_default_construct.pass.cpp @@ -80,7 +80,7 @@ void test_counted() Counted* p = (Counted*)pool; std::uninitialized_default_construct(It(p), It(p+1)); assert(Counted::count == 1); - assert(Counted::constructed = 1); + assert(Counted::constructed == 1); std::uninitialized_default_construct(It(p+1), It(p+N)); assert(Counted::count == 5); assert(Counted::constructed == 5); diff --git a/test/std/utilities/memory/specialized.algorithms/uninitialized.construct.default/uninitialized_default_construct_n.pass.cpp b/test/std/utilities/memory/specialized.algorithms/uninitialized.construct.default/uninitialized_default_construct_n.pass.cpp index f22a74f1f832..e5b9eca439cf 100644 --- a/test/std/utilities/memory/specialized.algorithms/uninitialized.construct.default/uninitialized_default_construct_n.pass.cpp +++ b/test/std/utilities/memory/specialized.algorithms/uninitialized.construct.default/uninitialized_default_construct_n.pass.cpp @@ -80,7 +80,7 @@ void test_counted() It e = std::uninitialized_default_construct_n(It(p), 1); assert(e == It(p+1)); assert(Counted::count == 1); - assert(Counted::constructed = 1); + assert(Counted::constructed == 1); e = std::uninitialized_default_construct_n(It(p+1), 4); assert(e == It(p+N)); assert(Counted::count == 5); diff --git a/test/std/utilities/memory/specialized.algorithms/uninitialized.construct.value/uninitialized_value_construct.pass.cpp b/test/std/utilities/memory/specialized.algorithms/uninitialized.construct.value/uninitialized_value_construct.pass.cpp index c2d860694a75..8479ce123a78 100644 --- a/test/std/utilities/memory/specialized.algorithms/uninitialized.construct.value/uninitialized_value_construct.pass.cpp +++ b/test/std/utilities/memory/specialized.algorithms/uninitialized.construct.value/uninitialized_value_construct.pass.cpp @@ -79,7 +79,7 @@ void test_counted() Counted* p = (Counted*)pool; std::uninitialized_value_construct(It(p), It(p+1)); assert(Counted::count == 1); - assert(Counted::constructed = 1); + assert(Counted::constructed == 1); std::uninitialized_value_construct(It(p+1), It(p+N)); assert(Counted::count == 5); assert(Counted::constructed == 5); diff --git a/test/std/utilities/memory/specialized.algorithms/uninitialized.construct.value/uninitialized_value_construct_n.pass.cpp b/test/std/utilities/memory/specialized.algorithms/uninitialized.construct.value/uninitialized_value_construct_n.pass.cpp index 323d00f7c9c4..ad6a51500e36 100644 --- a/test/std/utilities/memory/specialized.algorithms/uninitialized.construct.value/uninitialized_value_construct_n.pass.cpp +++ b/test/std/utilities/memory/specialized.algorithms/uninitialized.construct.value/uninitialized_value_construct_n.pass.cpp @@ -81,7 +81,7 @@ void test_counted() It e = std::uninitialized_value_construct_n(It(p), 1); assert(e == It(p+1)); assert(Counted::count == 1); - assert(Counted::constructed = 1); + assert(Counted::constructed == 1); e = std::uninitialized_value_construct_n(It(p+1), 4); assert(e == It(p+N)); assert(Counted::count == 5); diff --git a/test/std/utilities/memory/specialized.algorithms/uninitialized.move/uninitialized_move.pass.cpp b/test/std/utilities/memory/specialized.algorithms/uninitialized.move/uninitialized_move.pass.cpp index d7a9542b4c27..6c535250fd1f 100644 --- a/test/std/utilities/memory/specialized.algorithms/uninitialized.move/uninitialized_move.pass.cpp +++ b/test/std/utilities/memory/specialized.algorithms/uninitialized.move/uninitialized_move.pass.cpp @@ -88,7 +88,7 @@ void test_counted() Counted* p = (Counted*)pool; auto ret = std::uninitialized_move(It(values), It(values + 1), FIt(p)); assert(ret == FIt(p +1)); - assert(Counted::constructed = 1); + assert(Counted::constructed == 1); assert(Counted::count == 1); assert(p[0].value == 1); assert(values[0] == 0); diff --git a/test/std/utilities/memory/specialized.algorithms/uninitialized.move/uninitialized_move_n.pass.cpp b/test/std/utilities/memory/specialized.algorithms/uninitialized.move/uninitialized_move_n.pass.cpp index f27e5726135f..4175c6bce688 100644 --- a/test/std/utilities/memory/specialized.algorithms/uninitialized.move/uninitialized_move_n.pass.cpp +++ b/test/std/utilities/memory/specialized.algorithms/uninitialized.move/uninitialized_move_n.pass.cpp @@ -89,7 +89,7 @@ void test_counted() auto ret = std::uninitialized_move_n(It(values), 1, FIt(p)); assert(ret.first == It(values +1)); assert(ret.second == FIt(p +1)); - assert(Counted::constructed = 1); + assert(Counted::constructed == 1); assert(Counted::count == 1); assert(p[0].value == 1); assert(values[0] == 0); diff --git a/test/std/utilities/memory/unique.ptr/deleter.h b/test/std/utilities/memory/unique.ptr/deleter.h deleted file mode 100644 index 1d8e19d5bc41..000000000000 --- a/test/std/utilities/memory/unique.ptr/deleter.h +++ /dev/null @@ -1,338 +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 - -// Example move-only deleter - -#ifndef DELETER_H -#define DELETER_H - -#include -#include -#include - -#include "test_macros.h" - -#if TEST_STD_VER >= 11 - -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_(0) {} - explicit Deleter(int s) : state_(s) {} - ~Deleter() {assert(state_ >= 0); state_ = -1;} - - 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;} -}; - -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_(0) {} - explicit Deleter(int s) : state_(s) {} - ~Deleter() {assert(state_ >= 0); state_ = -1;} - - int state() const {return state_;} - void set_state(int i) {state_ = i;} - - void operator()(T* p) {delete [] p;} -}; - -#else // TEST_STD_VER < 11 - -template -class Deleter -{ - mutable int state_; - -public: - Deleter() : state_(0) {} - explicit Deleter(int s) : state_(s) {} - - Deleter(Deleter const & other) : state_(other.state_) { - other.state_ = 0; - } - Deleter& operator=(Deleter const& other) { - state_ = other.state_; - other.state_ = 0; - return *this; - } - - ~Deleter() {assert(state_ >= 0); state_ = -1;} - - template - Deleter(Deleter d, - typename std::enable_if::value>::type* = 0) - : state_(d.state()) {} - -public: - int state() const {return state_;} - void set_state(int i) {state_ = i;} - - void operator()(T* p) {delete p;} -}; - -template -class Deleter -{ - mutable int state_; - -public: - - Deleter(Deleter const& other) : state_(other.state_) { - other.state_ = 0; - } - Deleter& operator=(Deleter const& other) { - state_ = other.state_; - other.state_ = 0; - return *this; - } - - Deleter() : state_(0) {} - explicit Deleter(int s) : state_(s) {} - ~Deleter() {assert(state_ >= 0); state_ = -1;} - - int state() const {return state_;} - void set_state(int i) {state_ = i;} - - void operator()(T* p) {delete [] p;} -}; - -#endif - -template -void -swap(Deleter& x, Deleter& y) -{ - Deleter t(std::move(x)); - x = std::move(y); - y = std::move(t); -} - - -template -class CDeleter -{ - int state_; - -public: - - CDeleter() : state_(0) {} - explicit CDeleter(int s) : state_(s) {} - ~CDeleter() {assert(state_ >= 0); state_ = -1;} - - template - CDeleter(const CDeleter& d) - : state_(d.state()) {} - - int state() const {return state_;} - void set_state(int i) {state_ = i;} - - void operator()(T* p) {delete p;} -}; - -template -class CDeleter -{ - int state_; - -public: - - CDeleter() : state_(0) {} - explicit CDeleter(int s) : state_(s) {} - ~CDeleter() {assert(state_ >= 0); state_ = -1;} - - int state() const {return state_;} - void set_state(int i) {state_ = i;} - - void operator()(T* p) {delete [] p;} -}; - -template -void -swap(CDeleter& x, CDeleter& y) -{ - CDeleter t(std::move(x)); - x = std::move(y); - y = std::move(t); -} - -// Non-copyable deleter -template -class NCDeleter -{ - int state_; - NCDeleter(NCDeleter const&); - NCDeleter& operator=(NCDeleter const&); -public: - - NCDeleter() : state_(0) {} - explicit NCDeleter(int s) : state_(s) {} - ~NCDeleter() {assert(state_ >= 0); state_ = -1;} - - int state() const {return state_;} - void set_state(int i) {state_ = i;} - - void operator()(T* p) {delete p;} -}; - - -template -class NCDeleter -{ - int state_; - NCDeleter(NCDeleter const&); - NCDeleter& operator=(NCDeleter const&); -public: - - NCDeleter() : state_(0) {} - explicit NCDeleter(int s) : state_(s) {} - ~NCDeleter() {assert(state_ >= 0); state_ = -1;} - - int state() const {return state_;} - void set_state(int i) {state_ = i;} - - void operator()(T* p) {delete [] p;} -}; - - -// Non-copyable deleter -template -class NCConstDeleter -{ - int state_; - NCConstDeleter(NCConstDeleter const&); - NCConstDeleter& operator=(NCConstDeleter const&); -public: - - NCConstDeleter() : state_(0) {} - explicit NCConstDeleter(int s) : state_(s) {} - ~NCConstDeleter() {assert(state_ >= 0); state_ = -1;} - - int state() const {return state_;} - void set_state(int i) {state_ = i;} - - void operator()(T* p) const {delete p;} -}; - - -template -class NCConstDeleter -{ - int state_; - NCConstDeleter(NCConstDeleter const&); - NCConstDeleter& operator=(NCConstDeleter const&); -public: - - NCConstDeleter() : state_(0) {} - explicit NCConstDeleter(int s) : state_(s) {} - ~NCConstDeleter() {assert(state_ >= 0); state_ = -1;} - - int state() const {return state_;} - void set_state(int i) {state_ = i;} - - void operator()(T* p) const {delete [] p;} -}; - - -// Non-copyable deleter -template -class CopyDeleter -{ - int state_; -public: - - CopyDeleter() : state_(0) {} - explicit CopyDeleter(int s) : state_(s) {} - ~CopyDeleter() {assert(state_ >= 0); state_ = -1;} - - CopyDeleter(CopyDeleter const& other) : state_(other.state_) {} - CopyDeleter& operator=(CopyDeleter const& other) { - state_ = other.state_; - return *this; - } - - int state() const {return state_;} - void set_state(int i) {state_ = i;} - - void operator()(T* p) {delete p;} -}; - - -template -class CopyDeleter -{ - int state_; - -public: - - CopyDeleter() : state_(0) {} - explicit CopyDeleter(int s) : state_(s) {} - ~CopyDeleter() {assert(state_ >= 0); state_ = -1;} - - CopyDeleter(CopyDeleter const& other) : state_(other.state_) {} - CopyDeleter& operator=(CopyDeleter const& other) { - state_ = other.state_; - return *this; - } - - int state() const {return state_;} - void set_state(int i) {state_ = i;} - - void operator()(T* p) {delete [] p;} -}; - - -#endif // DELETER_H diff --git a/test/std/utilities/memory/unique.ptr/nothing_to_do.pass.cpp b/test/std/utilities/memory/unique.ptr/nothing_to_do.pass.cpp deleted file mode 100644 index b58f5c55b643..000000000000 --- a/test/std/utilities/memory/unique.ptr/nothing_to_do.pass.cpp +++ /dev/null @@ -1,12 +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. -// -//===----------------------------------------------------------------------===// - -int main() -{ -} diff --git a/test/std/utilities/memory/unique.ptr/unique.ptr.create/make_unique.array.pass.cpp b/test/std/utilities/memory/unique.ptr/unique.ptr.create/make_unique.array.pass.cpp deleted file mode 100644 index 30b4ecb94e18..000000000000 --- a/test/std/utilities/memory/unique.ptr/unique.ptr.create/make_unique.array.pass.cpp +++ /dev/null @@ -1,44 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// UNSUPPORTED: c++98, c++03, c++11 -#include -#include -#include - -// The only way to create an unique_ptr is to default construct them. - -class foo { -public: - foo () : val_(3) {} - int get () const { return val_; } -private: - int val_; - }; - -int main() -{ - { - auto p1 = std::make_unique(5); - for ( int i = 0; i < 5; ++i ) - assert ( p1[i] == 0 ); - } - - { - auto p2 = std::make_unique(5); - for ( int i = 0; i < 5; ++i ) - assert ( p2[i].size () == 0 ); - } - - { - auto p3 = std::make_unique(7); - for ( int i = 0; i < 7; ++i ) - assert ( p3[i].get () == 3 ); - } -} diff --git a/test/std/utilities/memory/unique.ptr/unique.ptr.create/make_unique.array1.fail.cpp b/test/std/utilities/memory/unique.ptr/unique.ptr.create/make_unique.array1.fail.cpp deleted file mode 100644 index 00987919413b..000000000000 --- a/test/std/utilities/memory/unique.ptr/unique.ptr.create/make_unique.array1.fail.cpp +++ /dev/null @@ -1,17 +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. -// -//===----------------------------------------------------------------------===// - -#include -#include -#include - -int main() -{ - auto up1 = std::make_unique("error"); // doesn't compile - no bound -} diff --git a/test/std/utilities/memory/unique.ptr/unique.ptr.create/make_unique.array2.fail.cpp b/test/std/utilities/memory/unique.ptr/unique.ptr.create/make_unique.array2.fail.cpp deleted file mode 100644 index cc94e9ab3aaa..000000000000 --- a/test/std/utilities/memory/unique.ptr/unique.ptr.create/make_unique.array2.fail.cpp +++ /dev/null @@ -1,17 +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. -// -//===----------------------------------------------------------------------===// - -#include -#include -#include - -int main() -{ - auto up2 = std::make_unique(10, 20, 30, 40); -} diff --git a/test/std/utilities/memory/unique.ptr/unique.ptr.create/make_unique.array3.fail.cpp b/test/std/utilities/memory/unique.ptr/unique.ptr.create/make_unique.array3.fail.cpp deleted file mode 100644 index cfdc2e1d886b..000000000000 --- a/test/std/utilities/memory/unique.ptr/unique.ptr.create/make_unique.array3.fail.cpp +++ /dev/null @@ -1,17 +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. -// -//===----------------------------------------------------------------------===// - -#include -#include -#include - -int main() -{ - auto up3 = std::make_unique(); // this is deleted -} diff --git a/test/std/utilities/memory/unique.ptr/unique.ptr.create/make_unique.array4.fail.cpp b/test/std/utilities/memory/unique.ptr/unique.ptr.create/make_unique.array4.fail.cpp deleted file mode 100644 index 07aa659bd9b0..000000000000 --- a/test/std/utilities/memory/unique.ptr/unique.ptr.create/make_unique.array4.fail.cpp +++ /dev/null @@ -1,17 +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. -// -//===----------------------------------------------------------------------===// - -#include -#include -#include - -int main() -{ - auto up4 = std::make_unique(11, 22, 33, 44, 55); // deleted -} diff --git a/test/std/utilities/memory/unique.ptr/unique.ptr.create/make_unique.single.pass.cpp b/test/std/utilities/memory/unique.ptr/unique.ptr.create/make_unique.single.pass.cpp deleted file mode 100644 index ace2e4fc7137..000000000000 --- a/test/std/utilities/memory/unique.ptr/unique.ptr.create/make_unique.single.pass.cpp +++ /dev/null @@ -1,32 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// UNSUPPORTED: c++98, c++03, c++11 -#include -#include -#include - -int main() -{ - { - std::unique_ptr p1 = std::make_unique(1); - assert ( *p1 == 1 ); - p1 = std::make_unique (); - assert ( *p1 == 0 ); - } - - { - std::unique_ptr p2 = std::make_unique ( "Meow!" ); - assert ( *p2 == "Meow!" ); - p2 = std::make_unique (); - assert ( *p2 == "" ); - p2 = std::make_unique ( 6, 'z' ); - assert ( *p2 == "zzzzzz" ); - } -} diff --git a/test/std/utilities/memory/unique.ptr/unique.ptr.dltr/nothing_to_do.pass.cpp b/test/std/utilities/memory/unique.ptr/unique.ptr.dltr/nothing_to_do.pass.cpp deleted file mode 100644 index b58f5c55b643..000000000000 --- a/test/std/utilities/memory/unique.ptr/unique.ptr.dltr/nothing_to_do.pass.cpp +++ /dev/null @@ -1,12 +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. -// -//===----------------------------------------------------------------------===// - -int main() -{ -} diff --git a/test/std/utilities/memory/unique.ptr/unique.ptr.dltr/unique.ptr.dltr.dflt/convert_ctor.pass.cpp b/test/std/utilities/memory/unique.ptr/unique.ptr.dltr/unique.ptr.dltr.dflt/convert_ctor.pass.cpp deleted file mode 100644 index 9bf794caeda2..000000000000 --- a/test/std/utilities/memory/unique.ptr/unique.ptr.dltr/unique.ptr.dltr.dflt/convert_ctor.pass.cpp +++ /dev/null @@ -1,48 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// - -// default_delete - -#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::default_delete d2; - std::default_delete d1 = d2; - A* p = new B; - assert(A::count == 1); - assert(B::count == 1); - d1(p); - assert(A::count == 0); - assert(B::count == 0); -} diff --git a/test/std/utilities/memory/unique.ptr/unique.ptr.dltr/unique.ptr.dltr.dflt/default.pass.cpp b/test/std/utilities/memory/unique.ptr/unique.ptr.dltr/unique.ptr.dltr.dflt/default.pass.cpp deleted file mode 100644 index f686e9f01f11..000000000000 --- a/test/std/utilities/memory/unique.ptr/unique.ptr.dltr/unique.ptr.dltr.dflt/default.pass.cpp +++ /dev/null @@ -1,34 +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. -// -//===----------------------------------------------------------------------===// - -// - -// default_delete - -#include -#include - -struct A -{ - static int count; - A() {++count;} - A(const A&) {++count;} - ~A() {--count;} -}; - -int A::count = 0; - -int main() -{ - std::default_delete d; - A* p = new A; - assert(A::count == 1); - d(p); - assert(A::count == 0); -} diff --git a/test/std/utilities/memory/unique.ptr/unique.ptr.dltr/unique.ptr.dltr.dflt/incomplete.fail.cpp b/test/std/utilities/memory/unique.ptr/unique.ptr.dltr/unique.ptr.dltr.dflt/incomplete.fail.cpp deleted file mode 100644 index 255e5cd39c69..000000000000 --- a/test/std/utilities/memory/unique.ptr/unique.ptr.dltr/unique.ptr.dltr.dflt/incomplete.fail.cpp +++ /dev/null @@ -1,26 +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. -// -//===----------------------------------------------------------------------===// - -// - -// default_delete - -// Test that default_delete's operator() requires a complete type - -#include -#include - -struct A; - -int main() -{ - std::default_delete d; - A* p = 0; - d(p); -} diff --git a/test/std/utilities/memory/unique.ptr/unique.ptr.dltr/unique.ptr.dltr.dflt/void.fail.cpp b/test/std/utilities/memory/unique.ptr/unique.ptr.dltr/unique.ptr.dltr.dflt/void.fail.cpp deleted file mode 100644 index 5d1cf1ff4981..000000000000 --- a/test/std/utilities/memory/unique.ptr/unique.ptr.dltr/unique.ptr.dltr.dflt/void.fail.cpp +++ /dev/null @@ -1,24 +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. -// -//===----------------------------------------------------------------------===// - -// - -// default_delete - -// Test that default_delete's operator() requires a complete type - -#include -#include - -int main() -{ - std::default_delete d; - const void* p = 0; - d(p); -} diff --git a/test/std/utilities/memory/unique.ptr/unique.ptr.dltr/unique.ptr.dltr.dflt1/convert_ctor.fail.cpp b/test/std/utilities/memory/unique.ptr/unique.ptr.dltr/unique.ptr.dltr.dflt1/convert_ctor.fail.cpp deleted file mode 100644 index 41209d977b71..000000000000 --- a/test/std/utilities/memory/unique.ptr/unique.ptr.dltr/unique.ptr.dltr.dflt1/convert_ctor.fail.cpp +++ /dev/null @@ -1,32 +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. -// -//===----------------------------------------------------------------------===// - -// - -// default_delete - -// Test that default_delete does not have a working converting constructor - -#include -#include - -struct A -{ -}; - -struct B - : public A -{ -}; - -int main() -{ - std::default_delete d2; - std::default_delete d1 = d2; -} diff --git a/test/std/utilities/memory/unique.ptr/unique.ptr.dltr/unique.ptr.dltr.dflt1/convert_ctor.pass.cpp b/test/std/utilities/memory/unique.ptr/unique.ptr.dltr/unique.ptr.dltr.dflt1/convert_ctor.pass.cpp deleted file mode 100644 index 2949d6310c59..000000000000 --- a/test/std/utilities/memory/unique.ptr/unique.ptr.dltr/unique.ptr.dltr.dflt1/convert_ctor.pass.cpp +++ /dev/null @@ -1,28 +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. -// -//===----------------------------------------------------------------------===// - -// - -// default_delete[] - -// template -// default_delete(const default_delete&); -// -// This constructor shall not participate in overload resolution unless -// U(*)[] is convertible to T(*)[]. - -#include -#include - -int main() -{ - std::default_delete d1; - std::default_delete d2 = d1; - ((void)d2); -} diff --git a/test/std/utilities/memory/unique.ptr/unique.ptr.dltr/unique.ptr.dltr.dflt1/default.pass.cpp b/test/std/utilities/memory/unique.ptr/unique.ptr.dltr/unique.ptr.dltr.dflt1/default.pass.cpp deleted file mode 100644 index 7a409766412f..000000000000 --- a/test/std/utilities/memory/unique.ptr/unique.ptr.dltr/unique.ptr.dltr.dflt1/default.pass.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. -// -//===----------------------------------------------------------------------===// - -// - -// default_delete - -// Test that default_delete has a working default constructor - -#include -#include - -struct A -{ - static int count; - A() {++count;} - A(const A&) {++count;} - ~A() {--count;} -}; - -int A::count = 0; - -int main() -{ - std::default_delete d; - A* p = new A[3]; - assert(A::count == 3); - d(p); - assert(A::count == 0); -} diff --git a/test/std/utilities/memory/unique.ptr/unique.ptr.dltr/unique.ptr.dltr.dflt1/incomplete.fail.cpp b/test/std/utilities/memory/unique.ptr/unique.ptr.dltr/unique.ptr.dltr.dflt1/incomplete.fail.cpp deleted file mode 100644 index 528b10e9085d..000000000000 --- a/test/std/utilities/memory/unique.ptr/unique.ptr.dltr/unique.ptr.dltr.dflt1/incomplete.fail.cpp +++ /dev/null @@ -1,26 +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. -// -//===----------------------------------------------------------------------===// - -// - -// default_delete - -// Test that default_delete's operator() requires a complete type - -#include -#include - -struct A; - -int main() -{ - std::default_delete d; - A* p = 0; - d(p); -} diff --git a/test/std/utilities/memory/unique.ptr/unique.ptr.dltr/unique.ptr.dltr.general/nothing_to_do.pass.cpp b/test/std/utilities/memory/unique.ptr/unique.ptr.dltr/unique.ptr.dltr.general/nothing_to_do.pass.cpp deleted file mode 100644 index b58f5c55b643..000000000000 --- a/test/std/utilities/memory/unique.ptr/unique.ptr.dltr/unique.ptr.dltr.general/nothing_to_do.pass.cpp +++ /dev/null @@ -1,12 +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. -// -//===----------------------------------------------------------------------===// - -int main() -{ -} diff --git a/test/std/utilities/memory/unique.ptr/unique.ptr.runtime/move01.fail.cpp b/test/std/utilities/memory/unique.ptr/unique.ptr.runtime/move01.fail.cpp deleted file mode 100644 index ed94c1a1e470..000000000000 --- a/test/std/utilities/memory/unique.ptr/unique.ptr.runtime/move01.fail.cpp +++ /dev/null @@ -1,28 +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" - -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 -} 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 286e6bc9a7b9..000000000000 --- 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.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/move02.fail.cpp b/test/std/utilities/memory/unique.ptr/unique.ptr.runtime/move02.fail.cpp deleted file mode 100644 index 6e13873c2fb3..000000000000 --- a/test/std/utilities/memory/unique.ptr/unique.ptr.runtime/move02.fail.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 unique_ptr move assignment - -#include -#include -#include - -// 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[3]); - std::unique_ptr s2; - s2 = s; - } -} 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 3712a2796392..000000000000 --- 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 4e85e5b0fb90..000000000000 --- 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 9461958a431d..000000000000 --- 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 1737136f4d72..000000000000 --- 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.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 3c89bb12344e..000000000000 --- 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.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 970beb5a150e..000000000000 --- 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 786858dd4016..000000000000 --- 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.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 46d4c0985d71..000000000000 --- 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.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 65ee2694156f..000000000000 --- 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 da08195ffdd3..000000000000 --- 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.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 aeec076cb86a..000000000000 --- 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.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_asgn.pass.cpp b/test/std/utilities/memory/unique.ptr/unique.ptr.runtime/null_asgn.pass.cpp deleted file mode 100644 index e2d7956cda64..000000000000 --- a/test/std/utilities/memory/unique.ptr/unique.ptr.runtime/null_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); - assert(A::count == 1); - s2 = 0; - assert(A::count == 0); - assert(s2.get() == 0); - } - assert(A::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 50389978e8ab..000000000000 --- 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 30ecdded3cf7..000000000000 --- 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/pointer_type.pass.cpp b/test/std/utilities/memory/unique.ptr/unique.ptr.runtime/pointer_type.pass.cpp deleted file mode 100644 index e7ad6ad7ef33..000000000000 --- a/test/std/utilities/memory/unique.ptr/unique.ptr.runtime/pointer_type.pass.cpp +++ /dev/null @@ -1,34 +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 - -struct Deleter -{ - struct 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), ""); - } -} 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 b6bcad9a91c6..000000000000 --- 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 0cc54382b98d..000000000000 --- 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 82b84948f3f0..000000000000 --- 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 3ded41c419c8..000000000000 --- 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/default03.fail.cpp b/test/std/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/default03.fail.cpp deleted file mode 100644 index 74d24fd488b6..000000000000 --- a/test/std/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.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 - -// default unique_ptr ctor should require non-pointer Deleter - -#include - -int main() -{ - std::unique_ptr p; -} 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 bc49a0e5c31e..000000000000 --- 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 5088a4410e79..000000000000 --- 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.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 8e44c78bf1e9..000000000000 --- 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 89b6fa248845..000000000000 --- 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.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 c952cf2d4e13..000000000000 --- 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 0d091ff346d1..000000000000 --- 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 d175fbf93adc..000000000000 --- 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 1838511b4929..000000000000 --- 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.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 36ad75d8331a..000000000000 --- 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 3a19bde92889..000000000000 --- 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 bda2a70a4ef3..000000000000 --- 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.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 fba895137b05..000000000000 --- 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 24c646988f0a..000000000000 --- 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 486d90825d9e..000000000000 --- 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.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 e4cbef5c0560..000000000000 --- 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 73423d1b3751..000000000000 --- 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 cfc097ba0b84..000000000000 --- 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.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 fdb088250b9f..000000000000 --- 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 d9ef8e96fe8f..000000000000 --- 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 b4577a126c68..000000000000 --- 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.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 9325d07d0d0c..000000000000 --- 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 b090e593ec62..000000000000 --- 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 b2af3c7a6938..000000000000 --- 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.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 d1c0e8a781e6..000000000000 --- 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 9a8c17547bca..000000000000 --- 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 4c3161150831..000000000000 --- 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 dab42f277411..000000000000 --- 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.fail.cpp b/test/std/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/pointer02.fail.cpp deleted file mode 100644 index af7f27f73fc5..000000000000 --- a/test/std/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.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.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 1afb1c32ce8c..000000000000 --- 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 31f7ce367e3d..000000000000 --- 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 591144f7aa58..000000000000 --- 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 3de556563f97..000000000000 --- 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.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 a92fdbc1d2c4..000000000000 --- 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 dd27401731a6..000000000000 --- 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 9d3f94098a08..000000000000 --- 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 02f44d357561..000000000000 --- 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 0e03a7da07fb..000000000000 --- 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/release.pass.cpp b/test/std/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.modifiers/release.pass.cpp deleted file mode 100644 index d79a4e396eed..000000000000 --- a/test/std/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.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.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 195d877bbb70..000000000000 --- 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 bca6cb2470ac..000000000000 --- 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 e9754cc0f226..000000000000 --- 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.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/dereference.fail.cpp b/test/std/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.observers/dereference.fail.cpp deleted file mode 100644 index 46ba1395bb85..000000000000 --- a/test/std/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.observers/dereference.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 op*() - -#include -#include - -int main() -{ - std::unique_ptr p(new int(3)); - assert(*p == 3); -} diff --git a/test/std/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.observers/explicit_bool.pass.cpp b/test/std/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.observers/explicit_bool.pass.cpp deleted file mode 100644 index 9ec9b9527e8a..000000000000 --- a/test/std/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.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.runtime/unique.ptr.runtime.observers/get.pass.cpp b/test/std/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.observers/get.pass.cpp deleted file mode 100644 index 2ae0659adc26..000000000000 --- a/test/std/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.observers/get.pass.cpp +++ /dev/null @@ -1,24 +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 - -#include -#include - -int main() -{ - int* p = new int[3]; - std::unique_ptr s(p); - assert(s.get() == p); -} 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 4496740715a5..000000000000 --- 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 519eae688ec1..000000000000 --- 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.runtime/unique.ptr.runtime.observers/op_arrow.fail.cpp b/test/std/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.observers/op_arrow.fail.cpp deleted file mode 100644 index 1c90ba76af39..000000000000 --- a/test/std/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.observers/op_arrow.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 op->() - -#include -#include - -struct A -{ - int i_; - - A() : i_(7) {} -}; - -int main() -{ - std::unique_ptr p(new A); - assert(p->i_ == 7); -} 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 380f2e100eb6..000000000000 --- 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.fail.cpp b/test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.asgn/move01.fail.cpp deleted file mode 100644 index 87cfb72ad6e0..000000000000 --- a/test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.asgn/move01.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 move assignment - -#include - -#include "test_macros.h" - -// 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/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 9535ed0295d4..000000000000 --- 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.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 9cea12b1249f..000000000000 --- 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 05a057f9bb32..000000000000 --- 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 24703ec98238..000000000000 --- 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 4c4a32035641..000000000000 --- 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.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 816a598d9a23..000000000000 --- 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 1ddf1d811651..000000000000 --- 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.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 570c1c42f4fe..000000000000 --- 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.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 2ebc33d21d81..000000000000 --- 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.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 4694986c6773..000000000000 --- 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.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 220677cd6fa7..000000000000 --- 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.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.asgn/move_convert13.fail.cpp b/test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.asgn/move_convert13.fail.cpp deleted file mode 100644 index 412648420d46..000000000000 --- a/test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.asgn/move_convert13.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 converting move assignment - -// Do not convert from an array unique_ptr - -#include -#include -#include - -struct A -{ -}; - -struct Deleter -{ - void operator()(void*) {} -}; - -int main() -{ - std::unique_ptr s; - std::unique_ptr s2; - s2 = std::move(s); // expected-error {{no viable overloaded '='}} -} diff --git a/test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.asgn/null.pass.cpp b/test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.asgn/null.pass.cpp deleted file mode 100644 index e2d7956cda64..000000000000 --- a/test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.asgn/null.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); - assert(A::count == 1); - s2 = 0; - assert(A::count == 0); - assert(s2.get() == 0); - } - assert(A::count == 0); -} diff --git a/test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.asgn/nullptr.pass.cpp b/test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.asgn/nullptr.pass.cpp deleted file mode 100644 index fb1584951993..000000000000 --- a/test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.asgn/nullptr.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); - assert(A::count == 1); - 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.single/unique.ptr.single.ctor/auto_pointer.pass.cpp b/test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/auto_pointer.pass.cpp deleted file mode 100644 index 7c3ac462c287..000000000000 --- a/test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/auto_pointer.pass.cpp +++ /dev/null @@ -1,80 +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. -// -//===----------------------------------------------------------------------===// - -// libc++ cannot safely provide the auto_ptr constructor without rvalue -// references. -// XFAIL: c++98, c++03 - -// - -// unique_ptr - -// template unique_ptr(auto_ptr&&) noexcept - -#include -#include -#include - -#include "test_macros.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() -{ - { - B* p = new B; - std::auto_ptr ap(p); - std::unique_ptr up(std::move(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 = std::move(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); -#if TEST_STD_VER >= 11 - { - static_assert(std::is_nothrow_constructible< - std::unique_ptr, - std::auto_ptr&& - >::value, ""); - } -#endif -} 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 1f317c782454..000000000000 --- 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 2dd5ea30049b..000000000000 --- 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 2694538145b9..000000000000 --- 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 a incomplete element_type and -// various deleter types (C-1,2) - -#include -#include - -#include "../../deleter.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() { } \ No newline at end of file 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 2ffe1be190e0..000000000000 --- 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 690750143414..000000000000 --- 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 78f6e73a1d55..000000000000 --- 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 4c5cc843a138..000000000000 --- 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.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 68ad589b1148..000000000000 --- 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 897b889d6778..000000000000 --- 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 7fb1a0a74811..000000000000 --- 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 671e343fd7f5..000000000000 --- 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 f00fcfe15b80..000000000000 --- 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.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 ed1fe8c2bdd4..000000000000 --- 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 a1bf634b9995..000000000000 --- 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.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 7409199791b5..000000000000 --- 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 981ea706eb29..000000000000 --- 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 d055b80627f9..000000000000 --- 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.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 5b9b12e0d60b..000000000000 --- 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 bef022cfc143..000000000000 --- 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 016eadcb2460..000000000000 --- 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 a475c17547c9..000000000000 --- 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 f0da5efb6917..000000000000 --- 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 1b8bb736df20..000000000000 --- 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 095bec65669b..000000000000 --- 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/move_convert13.fail.cpp b/test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/move_convert13.fail.cpp deleted file mode 100644 index a4bd2cba1cef..000000000000 --- a/test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/move_convert13.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 converting move ctor - -// Do not convert from an array unique_ptr - -#include -#include -#include - -struct A -{ -}; - -struct Deleter -{ - void operator()(void*) {} -}; - -int main() -{ - std::unique_ptr s; - std::unique_ptr s2(std::move(s)); -} 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 67a48a3e7a12..000000000000 --- 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 faa554d8b320..000000000000 --- 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.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 1af04b2c0033..000000000000 --- 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 9b7dd8c70f28..000000000000 --- 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 a917d87eeede..000000000000 --- 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 7ddd16265107..000000000000 --- 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.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.ctor/pointer_deleter04.fail.cpp b/test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/pointer_deleter04.fail.cpp deleted file mode 100644 index ad64b5e4ea39..000000000000 --- a/test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/pointer_deleter04.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. -// -//===----------------------------------------------------------------------===// - -// Without rvalue references it is impossible to detect when a rvalue deleter -// is given. -// XFAIL: c++98, c++03 - -// - -// unique_ptr - -// unique_ptr(pointer, D()) should not compile - -#include - -struct Deleter { - void operator()(int* p) const {delete p;} -}; - -int main() -{ - // expected-error@memory:* {{static_assert failed "rvalue deleter bound to reference"}} - std::unique_ptr s((int*)nullptr, Deleter()); // expected-note {{requested here}} -} diff --git a/test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.dtor/null.pass.cpp b/test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.dtor/null.pass.cpp deleted file mode 100644 index 064f38c5f167..000000000000 --- a/test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.dtor/null.pass.cpp +++ /dev/null @@ -1,44 +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 - -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(0, d); - assert(p.get() == 0); - assert(&p.get_deleter() == &d); - } - assert(d.state() == 0); -} 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 dadd4ecbe590..000000000000 --- 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 2cf7f8b77568..000000000000 --- 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/reset2.pass.cpp b/test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.modifiers/reset2.pass.cpp deleted file mode 100644 index 2de7787b267e..000000000000 --- a/test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.modifiers/reset2.pass.cpp +++ /dev/null @@ -1,66 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// - -// 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(); - assert(i != nullptr); - 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(); - assert(i != nullptr); - 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.single/unique.ptr.single.modifiers/reset_self.pass.cpp b/test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.modifiers/reset_self.pass.cpp deleted file mode 100644 index 58b05efa25f6..000000000000 --- a/test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.modifiers/reset_self.pass.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 reset against resetting self - -#include - -struct A -{ - std::unique_ptr ptr_; - - A() : ptr_(this) {} - void reset() {ptr_.reset();} -}; - -int main() -{ - (new A)->reset(); -} 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 d0a03be80326..000000000000 --- 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.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/dereference.pass.cpp b/test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.observers/dereference.pass.cpp deleted file mode 100644 index 9d0cfcaaf353..000000000000 --- a/test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.observers/dereference.pass.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 op*() - -#include -#include - -int main() -{ - std::unique_ptr p(new int(3)); - assert(*p == 3); -} 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 d5c7445b0d86..000000000000 --- 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.pass.cpp b/test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.observers/get.pass.cpp deleted file mode 100644 index 24fa6beb4273..000000000000 --- a/test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.observers/get.pass.cpp +++ /dev/null @@ -1,24 +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 - -#include -#include - -int main() -{ - int* p = new int; - std::unique_ptr s(p); - assert(s.get() == p); -} 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 5ed8a22b14c4..000000000000 --- 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/unique.ptr/unique.ptr.single/unique.ptr.single.observers/index.fail.cpp b/test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.observers/index.fail.cpp deleted file mode 100644 index 21e829cbc444..000000000000 --- a/test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.observers/index.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 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/unique.ptr.single.observers/op_arrow.pass.cpp b/test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.observers/op_arrow.pass.cpp deleted file mode 100644 index 47de8f66ed2e..000000000000 --- a/test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.observers/op_arrow.pass.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 op->() - -#include -#include - -struct A -{ - int i_; - - A() : i_(7) {} -}; - -int main() -{ - std::unique_ptr p(new A); - assert(p->i_ == 7); -} diff --git a/test/std/utilities/memory/unique.ptr/unique.ptr.special/cmp_nullptr.pass.cpp b/test/std/utilities/memory/unique.ptr/unique.ptr.special/cmp_nullptr.pass.cpp deleted file mode 100644 index 22ae217a61d6..000000000000 --- a/test/std/utilities/memory/unique.ptr/unique.ptr.special/cmp_nullptr.pass.cpp +++ /dev/null @@ -1,69 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// - -// shared_ptr - -// template -// bool operator==(const unique_ptr& x, nullptr_t) noexcept; -// template -// bool operator==(nullptr_t, const unique_ptr& y) noexcept; -// template -// bool operator!=(const unique_ptr& x, nullptr_t) noexcept; -// template -// bool operator!=(nullptr_t, const unique_ptr& y) noexcept; -// template -// bool operator<(const unique_ptr& x, nullptr_t) noexcept; -// template -// bool operator<(nullptr_t, const unique_ptr& y) noexcept; -// template -// bool operator<=(const unique_ptr& x, nullptr_t) noexcept; -// template -// bool operator<=(nullptr_t, const unique_ptr& y) noexcept; -// template -// bool operator>(const unique_ptr& x, nullptr_t) noexcept; -// template -// bool operator>(nullptr_t, const unique_ptr& y) noexcept; -// template -// bool operator>=(const unique_ptr& x, nullptr_t) noexcept; -// template -// bool operator>=(nullptr_t, const unique_ptr& y) noexcept; - -#include -#include - -void do_nothing(int*) {} - -int main() -{ - const std::unique_ptr p1(new int(1)); - assert(!(p1 == nullptr)); - assert(!(nullptr == p1)); - assert(!(p1 < nullptr)); - assert( (nullptr < p1)); - assert(!(p1 <= nullptr)); - assert( (nullptr <= p1)); - assert( (p1 > nullptr)); - assert(!(nullptr > p1)); - assert( (p1 >= nullptr)); - assert(!(nullptr >= p1)); - - const std::unique_ptr p2; - assert( (p2 == nullptr)); - assert( (nullptr == p2)); - assert(!(p2 < nullptr)); - assert(!(nullptr < p2)); - assert( (p2 <= nullptr)); - assert( (nullptr <= p2)); - assert(!(p2 > nullptr)); - assert(!(nullptr > p2)); - assert( (p2 >= nullptr)); - assert( (nullptr >= p2)); -} diff --git a/test/std/utilities/memory/unique.ptr/unique.ptr.special/eq.pass.cpp b/test/std/utilities/memory/unique.ptr/unique.ptr.special/eq.pass.cpp deleted file mode 100644 index 37886548e721..000000000000 --- a/test/std/utilities/memory/unique.ptr/unique.ptr.special/eq.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 - -// template -// bool -// operator==(const unique_ptr& x, const unique_ptr& y); - -// template -// bool -// operator!=(const unique_ptr& x, const unique_ptr& y); - -#include -#include - -#include "../deleter.h" - -struct A -{ - static int count; - A() {++count;} - A(const A&) {++count;} - virtual ~A() {--count;} -}; - -int A::count = 0; - -struct B - : public A -{ - static int count; - B() {++count;} - B(const B&) {++count;} - virtual ~B() {--count;} -}; - -int B::count = 0; - -int main() -{ - { - const std::unique_ptr > p1(new A); - const std::unique_ptr > p2(new A); - assert(!(p1 == p2)); - assert(p1 != p2); - } - { - const std::unique_ptr > p1(new A); - const std::unique_ptr > p2(new B); - assert(!(p1 == p2)); - assert(p1 != p2); - } - { - const std::unique_ptr > p1(new A[3]); - const std::unique_ptr > p2(new A[3]); - assert(!(p1 == p2)); - assert(p1 != p2); - } - { - const std::unique_ptr > p1(new A[3]); - const std::unique_ptr > p2(new B[3]); - assert(!(p1 == p2)); - assert(p1 != p2); - } - { - const std::unique_ptr > p1; - const std::unique_ptr > p2; - assert(p1 == p2); - assert(!(p1 != p2)); - } - { - const std::unique_ptr > p1; - const std::unique_ptr > p2; - assert(p1 == p2); - assert(!(p1 != p2)); - } -} diff --git a/test/std/utilities/memory/unique.ptr/unique.ptr.special/rel.pass.cpp b/test/std/utilities/memory/unique.ptr/unique.ptr.special/rel.pass.cpp deleted file mode 100644 index 80653cf707c3..000000000000 --- a/test/std/utilities/memory/unique.ptr/unique.ptr.special/rel.pass.cpp +++ /dev/null @@ -1,100 +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 - -// template -// bool -// operator< (const unique_ptr& x, const unique_ptr& y); - -// template -// bool -// operator> (const unique_ptr& x, const unique_ptr& y); - -// template -// bool -// operator<=(const unique_ptr& x, const unique_ptr& y); - -// template -// bool -// operator>=(const unique_ptr& x, const unique_ptr& y); - -#include -#include - -#include "../deleter.h" - -struct A -{ - static int count; - A() {++count;} - A(const A&) {++count;} - virtual ~A() {--count;} -}; - -int A::count = 0; - -struct B - : public A -{ - static int count; - B() {++count;} - B(const B&) {++count;} - virtual ~B() {--count;} -}; - -int B::count = 0; - -int main() -{ - { - const std::unique_ptr > p1(new A); - const std::unique_ptr > p2(new A); - assert((p1 < p2) == !(p1 > p2)); - assert((p1 < p2) == (p1 <= p2)); - assert((p1 < p2) == !(p1 >= p2)); - } - { - const std::unique_ptr > p1(new A); - const std::unique_ptr > p2(new B); - assert((p1 < p2) == !(p1 > p2)); - assert((p1 < p2) == (p1 <= p2)); - assert((p1 < p2) == !(p1 >= p2)); - } - { - const std::unique_ptr > p1(new A[3]); - const std::unique_ptr > p2(new A[3]); - assert((p1 < p2) == !(p1 > p2)); - assert((p1 < p2) == (p1 <= p2)); - assert((p1 < p2) == !(p1 >= p2)); - } - { - const std::unique_ptr > p1(new A[3]); - const std::unique_ptr > p2(new B[3]); - assert((p1 < p2) == !(p1 > p2)); - assert((p1 < p2) == (p1 <= p2)); - assert((p1 < p2) == !(p1 >= p2)); - } - { - const std::unique_ptr > p1; - const std::unique_ptr > p2; - assert((p1 < p2) == (p1 > p2)); - assert((p1 < p2) == !(p1 <= p2)); - assert((p1 < p2) == !(p1 >= p2)); - } - { - const std::unique_ptr > p1; - const std::unique_ptr > p2; - assert((p1 < p2) == (p1 > p2)); - assert((p1 < p2) == !(p1 <= p2)); - assert((p1 < p2) == !(p1 >= p2)); - } -} diff --git a/test/std/utilities/memory/unique.ptr/unique.ptr.special/swap.pass.cpp b/test/std/utilities/memory/unique.ptr/unique.ptr.special/swap.pass.cpp deleted file mode 100644 index c525137d4841..000000000000 --- a/test/std/utilities/memory/unique.ptr/unique.ptr.special/swap.pass.cpp +++ /dev/null @@ -1,102 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// - -// unique_ptr - -// Test swap - -#include -#include - -#include "test_macros.h" -#include "../deleter.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; - -template -struct NonSwappableDeleter { - explicit NonSwappableDeleter(int) {} - NonSwappableDeleter& operator=(NonSwappableDeleter const&) { return *this; } - void operator()(T*) const {} -private: - NonSwappableDeleter(NonSwappableDeleter const&); - -}; - -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); - swap(s1, 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); - { - 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); - swap(s1, 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); -#if TEST_STD_VER >= 11 - { - // test that unique_ptr's specialized swap is disabled when the deleter - // is non-swappable. Instead we should pick up the generic swap(T, T) - // and perform 3 move constructions. - typedef NonSwappableDeleter D; - D d(42); - int x = 42; - int y = 43; - std::unique_ptr p(&x, d); - std::unique_ptr p2(&y, d); - std::swap(p, p2); - } -#endif -} 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 b9f8ee0746c3..5a0d9259c11d 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 @@ -51,11 +51,11 @@ struct Bar : public Foo { int main() { - { // https://llvm.org/bugs/show_bug.cgi?id=18843 + { // https://bugs.llvm.org/show_bug.cgi?id=18843 std::shared_ptr t1(new T); std::shared_ptr t2(std::make_shared()); } - { // https://llvm.org/bugs/show_bug.cgi?id=27115 + { // https://bugs.llvm.org/show_bug.cgi?id=27115 int x = 42; std::shared_ptr t1(new Bar(42)); assert(t1->shared_from_this() == t1); @@ -84,12 +84,12 @@ int main() T* ptr = new T; std::shared_ptr s(ptr); { - // Don't re-initialize the "enabled_shared_from_this" base + // Don't re-initialize the "enable_shared_from_this" base // because it already references a non-expired shared_ptr. std::shared_ptr s2(ptr, &nullDeleter); } #if TEST_STD_VER > 14 - // The enabled_shared_from_this base should still be referencing + // The enable_shared_from_this base should still be referencing // the original shared_ptr. assert(!ptr->weak_from_this().expired()); #endif diff --git a/test/std/utilities/memory/util.smartptr/util.smartptr.hash/enabled_hash.pass.cpp b/test/std/utilities/memory/util.smartptr/util.smartptr.hash/enabled_hash.pass.cpp new file mode 100644 index 000000000000..e9237c534fba --- /dev/null +++ b/test/std/utilities/memory/util.smartptr/util.smartptr.hash/enabled_hash.pass.cpp @@ -0,0 +1,23 @@ +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// UNSUPPORTED: c++98, c++03 + +// + +// Test that provides all of the arithmetic, enum, and pointer +// hash specializations. + +#include + +#include "poisoned_hash_helper.hpp" + +int main() { + test_library_hash_specializations_available(); +} diff --git a/test/std/utilities/memory/util.smartptr/util.smartptr.hash/hash_shared_ptr.pass.cpp b/test/std/utilities/memory/util.smartptr/util.smartptr.hash/hash_shared_ptr.pass.cpp index 990cb58722b1..5fba1fc0460b 100644 --- a/test/std/utilities/memory/util.smartptr/util.smartptr.hash/hash_shared_ptr.pass.cpp +++ b/test/std/utilities/memory/util.smartptr/util.smartptr.hash/hash_shared_ptr.pass.cpp @@ -20,11 +20,25 @@ #include #include +#if TEST_STD_VER >= 11 +#include "poisoned_hash_helper.hpp" + +struct A {}; +#endif + int main() { + { int* ptr = new int; std::shared_ptr p(ptr); std::hash > f; std::size_t h = f(p); assert(h == std::hash()(ptr)); + } +#if TEST_STD_VER >= 11 + { + test_hash_enabled_for_type>(); + test_hash_enabled_for_type>(); + } +#endif } 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 5cd4ab1f83d0..fc346d4dce7d 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 @@ -20,11 +20,80 @@ #include #include +#include "test_macros.h" + +#if TEST_STD_VER >= 11 +#include "poisoned_hash_helper.hpp" +#include "deleter_types.h" +#include "min_allocator.h" + +template +void test_enabled_with_deleter() { + using UPtr = std::unique_ptr; + using pointer = typename UPtr::pointer; + using RawDel = typename std::decay::type; + RawDel d(1); + UPtr p(nullptr, std::forward(d)); + test_hash_enabled_for_type(p); + test_hash_enabled_for_type(); +} + +template +void test_disabled_with_deleter() { + using UPtr = std::unique_ptr; + using pointer = typename UPtr::pointer; + test_hash_disabled_for_type(); + test_hash_disabled_for_type(); +} + +namespace std { + +template +struct hash<::min_pointer>> { + size_t operator()(::min_pointer> p) const noexcept(false) { + if (!p) return 0; + return std::hash{}(std::addressof(*p)); + } +}; +} + +struct A {}; + +#endif // TEST_STD_VER >= 11 + int main() { + { int* ptr = new int; std::unique_ptr p(ptr); std::hash > f; + ASSERT_NOT_NOEXCEPT(f(p)); std::size_t h = f(p); assert(h == std::hash()(ptr)); + } +#if TEST_STD_VER >= 11 + { + test_enabled_with_deleter>(); + test_enabled_with_deleter>(); + test_enabled_with_deleter>(); + test_enabled_with_deleter>(); + test_enabled_with_deleter&>(); + test_enabled_with_deleter&>(); + test_enabled_with_deleter const&>(); + test_enabled_with_deleter const&>(); + } + { + test_enabled_with_deleter>(); + test_enabled_with_deleter>(); + test_enabled_with_deleter>(); + test_enabled_with_deleter>(); + +#if TEST_STD_VER > 14 + test_disabled_with_deleter>(); + test_disabled_with_deleter>(); + test_disabled_with_deleter>(); + test_disabled_with_deleter>(); +#endif + } +#endif } 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 3bad537e3431..d1e13139bce3 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: with_system_cxx_lib=x86_64-apple-macosx10.7 +// XFAIL: with_system_cxx_lib=x86_64-apple-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 5cc1234ad34e..08e31e8d7d70 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: with_system_cxx_lib=x86_64-apple-macosx10.7 +// XFAIL: with_system_cxx_lib=x86_64-apple-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 a89c0dbd2207..f8f550deb051 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: with_system_cxx_lib=x86_64-apple-macosx10.7 +// XFAIL: with_system_cxx_lib=x86_64-apple-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 821cea6868e4..1ea11ceed43d 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: with_system_cxx_lib=x86_64-apple-macosx10.7 +// XFAIL: with_system_cxx_lib=x86_64-apple-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 66be756d54fd..9a5792f519d5 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: with_system_cxx_lib=x86_64-apple-macosx10.7 +// XFAIL: with_system_cxx_lib=x86_64-apple-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 493ba7fcc94d..aac9af082d74 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: with_system_cxx_lib=x86_64-apple-macosx10.7 +// XFAIL: with_system_cxx_lib=x86_64-apple-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 4820d05420a2..fa79e7cdd9ad 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: with_system_cxx_lib=x86_64-apple-macosx10.7 +// XFAIL: with_system_cxx_lib=x86_64-apple-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 ef8dc822102f..c650899f764a 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: with_system_cxx_lib=x86_64-apple-macosx10.7 +// XFAIL: with_system_cxx_lib=x86_64-apple-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 a13a7d57ab96..cbcc4ddbbc2c 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: with_system_cxx_lib=x86_64-apple-macosx10.7 +// XFAIL: with_system_cxx_lib=x86_64-apple-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 6dfe3166c8c5..eb5e246833c2 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: with_system_cxx_lib=x86_64-apple-macosx10.7 +// XFAIL: with_system_cxx_lib=x86_64-apple-macosx10.8 // diff --git a/test/std/utilities/memory/util.smartptr/util.smartptr.shared/test_deleter.h b/test/std/utilities/memory/util.smartptr/util.smartptr.shared/test_deleter.h deleted file mode 100644 index 6b3f1e2ab0de..000000000000 --- a/test/std/utilities/memory/util.smartptr/util.smartptr.shared/test_deleter.h +++ /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. -// -//===----------------------------------------------------------------------===// - -// - -// shared_ptr - -// Example move-only deleter - -#ifndef DELETER_H -#define DELETER_H - -#include -#include - -#include "test_macros.h" - -#if TEST_STD_VER >= 11 -#define DELETE_FUNCTION = delete -#else -#define DELETE_FUNCTION { assert(false); } -#endif - -struct test_deleter_base -{ - static int count; - static int dealloc_count; -}; - -int test_deleter_base::count = 0; -int test_deleter_base::dealloc_count = 0; - -template -class test_deleter - : public test_deleter_base -{ - int state_; - -public: - - test_deleter() : state_(0) {++count;} - explicit test_deleter(int s) : state_(s) {++count;} - test_deleter(const test_deleter& d) - : state_(d.state_) {++count;} - ~test_deleter() {assert(state_ >= 0); --count; state_ = -1;} - - int state() const {return state_;} - void set_state(int i) {state_ = i;} - - void operator()(T* p) {assert(state_ >= 0); ++dealloc_count; delete p;} - - test_deleter* operator&() const DELETE_FUNCTION; -}; - -template -void -swap(test_deleter& x, test_deleter& y) -{ - test_deleter t(std::move(x)); - x = std::move(y); - y = std::move(t); -} - -#endif // DELETER_H diff --git a/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.getdeleter/get_deleter.pass.cpp b/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.getdeleter/get_deleter.pass.cpp index a6c62496fd62..05a199cced63 100644 --- a/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.getdeleter/get_deleter.pass.cpp +++ b/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.getdeleter/get_deleter.pass.cpp @@ -15,7 +15,7 @@ #include #include -#include "../test_deleter.h" +#include "deleter_types.h" struct A { diff --git a/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.assign/auto_ptr_Y.pass.cpp b/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.assign/auto_ptr_Y.pass.cpp index 21cdf4a13e47..10d53c1268aa 100644 --- a/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.assign/auto_ptr_Y.pass.cpp +++ b/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.assign/auto_ptr_Y.pass.cpp @@ -10,6 +10,7 @@ // // shared_ptr +// REQUIRES: c++98 || c++03 || c++11 || c++14 // template shared_ptr& operator=(auto_ptr&& r); 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 f8fdb7a09478..3ad3232a90b4 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 @@ -10,6 +10,7 @@ // // template explicit shared_ptr(auto_ptr&& r); +// REQUIRES: c++98 || c++03 || c++11 || c++14 #include @@ -85,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/nullptr_t_deleter.pass.cpp b/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/nullptr_t_deleter.pass.cpp index 7d4dc38d4b9a..bf2a304011c8 100644 --- a/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/nullptr_t_deleter.pass.cpp +++ b/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/nullptr_t_deleter.pass.cpp @@ -15,7 +15,7 @@ #include #include -#include "../test_deleter.h" +#include "deleter_types.h" struct A { diff --git a/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/nullptr_t_deleter_allocator.pass.cpp b/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/nullptr_t_deleter_allocator.pass.cpp index 8a6cd0f352ff..aabc66a03c40 100644 --- a/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/nullptr_t_deleter_allocator.pass.cpp +++ b/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/nullptr_t_deleter_allocator.pass.cpp @@ -13,7 +13,7 @@ #include #include -#include "../test_deleter.h" +#include "deleter_types.h" #include "test_allocator.h" #include "min_allocator.h" diff --git a/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/nullptr_t_deleter_allocator_throw.pass.cpp b/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/nullptr_t_deleter_allocator_throw.pass.cpp index 2e6441d66316..55e52f49c752 100644 --- a/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/nullptr_t_deleter_allocator_throw.pass.cpp +++ b/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/nullptr_t_deleter_allocator_throw.pass.cpp @@ -14,7 +14,7 @@ #include #include -#include "../test_deleter.h" +#include "deleter_types.h" #include "test_allocator.h" struct A diff --git a/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/nullptr_t_deleter_throw.pass.cpp b/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/nullptr_t_deleter_throw.pass.cpp index 009b4cfc00f9..e82f0fdcc9ed 100644 --- a/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/nullptr_t_deleter_throw.pass.cpp +++ b/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/nullptr_t_deleter_throw.pass.cpp @@ -24,7 +24,7 @@ #include "test_macros.h" #include "count_new.hpp" -#include "../test_deleter.h" +#include "deleter_types.h" struct A { diff --git a/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/pointer_deleter.pass.cpp b/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/pointer_deleter.pass.cpp index 43eedee176c2..c813f6f6f9c5 100644 --- a/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/pointer_deleter.pass.cpp +++ b/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/pointer_deleter.pass.cpp @@ -15,7 +15,7 @@ #include #include -#include "../test_deleter.h" +#include "deleter_types.h" struct A { diff --git a/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/pointer_deleter_allocator.pass.cpp b/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/pointer_deleter_allocator.pass.cpp index b0facfc1a6eb..96a1779fe870 100644 --- a/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/pointer_deleter_allocator.pass.cpp +++ b/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/pointer_deleter_allocator.pass.cpp @@ -13,7 +13,7 @@ #include #include -#include "../test_deleter.h" +#include "deleter_types.h" #include "test_allocator.h" #include "min_allocator.h" diff --git a/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/pointer_deleter_allocator_throw.pass.cpp b/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/pointer_deleter_allocator_throw.pass.cpp index 388599bd7015..47d24c349871 100644 --- a/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/pointer_deleter_allocator_throw.pass.cpp +++ b/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/pointer_deleter_allocator_throw.pass.cpp @@ -14,7 +14,7 @@ #include #include -#include "../test_deleter.h" +#include "deleter_types.h" #include "test_allocator.h" struct A diff --git a/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/pointer_deleter_throw.pass.cpp b/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/pointer_deleter_throw.pass.cpp index 7b40d6df2164..13c2d435b93a 100644 --- a/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/pointer_deleter_throw.pass.cpp +++ b/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/pointer_deleter_throw.pass.cpp @@ -22,7 +22,7 @@ #include #include "count_new.hpp" -#include "../test_deleter.h" +#include "deleter_types.h" struct A { 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 877577c9ce58..17289197d35e 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 8d782716b94f..2a7ac9979d02 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 @@ -59,7 +59,7 @@ int main() assert(p->get_char() == 'e'); } - { // https://llvm.org/bugs/show_bug.cgi?id=24137 + { // https://bugs.llvm.org/show_bug.cgi?id=24137 std::shared_ptr p1 = std::make_shared(); assert(p1.get()); std::shared_ptr p2 = std::make_shared(); diff --git a/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.mod/reset_pointer_deleter.pass.cpp b/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.mod/reset_pointer_deleter.pass.cpp index 33965dfeb33c..c33133d79fdc 100644 --- a/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.mod/reset_pointer_deleter.pass.cpp +++ b/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.mod/reset_pointer_deleter.pass.cpp @@ -15,7 +15,7 @@ #include #include -#include "../test_deleter.h" +#include "deleter_types.h" struct B { diff --git a/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.mod/reset_pointer_deleter_allocator.pass.cpp b/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.mod/reset_pointer_deleter_allocator.pass.cpp index 09070e2c059b..58262eb4334e 100644 --- a/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.mod/reset_pointer_deleter_allocator.pass.cpp +++ b/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.mod/reset_pointer_deleter_allocator.pass.cpp @@ -15,7 +15,7 @@ #include #include -#include "../test_deleter.h" +#include "deleter_types.h" #include "test_allocator.h" struct B 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 3acd2f8c6f2d..9f6f1bc75c71 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 33447ba7da00..560293bbedb7 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 142eba2d9647..7ab60da77c7d 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; // }; @@ -69,16 +69,19 @@ int main() static_assert((std::is_same, CS::first_argument_type>::value), "" ); static_assert((std::is_same, CS::second_argument_type>::value), "" ); static_assert((std::is_same::value), "" ); - + assert(!cs(p1, p2)); 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 4aa49cfe8a24..458f8a11ed12 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 9fe2b6e39035..5cd171a53021 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.trans/meta.trans.other/common_type.pass.cpp b/test/std/utilities/meta/meta.trans/meta.trans.other/common_type.pass.cpp index 61523e4872d4..85b14726617f 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 bcd839849453..4f45a0340a91 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.trans/meta.trans.other/result_of11.pass.cpp b/test/std/utilities/meta/meta.trans/meta.trans.other/result_of11.pass.cpp index 8cb5853bbc6d..eac4e4a089fe 100644 --- a/test/std/utilities/meta/meta.trans/meta.trans.other/result_of11.pass.cpp +++ b/test/std/utilities/meta/meta.trans/meta.trans.other/result_of11.pass.cpp @@ -26,7 +26,6 @@ struct wat struct F {}; struct FD : public F {}; -struct NotDerived {}; template void test_result_of_imp() @@ -43,7 +42,6 @@ void test_result_of_imp() int main() { - typedef NotDerived ND; { typedef char F::*PMD; test_result_of_imp(); diff --git a/test/std/utilities/meta/meta.trans/meta.trans.other/underlying_type.pass.cpp b/test/std/utilities/meta/meta.trans/meta.trans.other/underlying_type.pass.cpp index 410e47e03bcc..b00798b72240 100644 --- a/test/std/utilities/meta/meta.trans/meta.trans.other/underlying_type.pass.cpp +++ b/test/std/utilities/meta/meta.trans/meta.trans.other/underlying_type.pass.cpp @@ -17,24 +17,32 @@ #include "test_macros.h" enum E { V = INT_MIN }; -enum F { W = UINT_MAX }; -int main() -{ #if !defined(_WIN32) || defined(__MINGW32__) - typedef unsigned ExpectUnsigned; + #define TEST_UNSIGNED_UNDERLYING_TYPE 1 #else - typedef int ExpectUnsigned; // MSVC's ABI doesn't follow the Standard + #define TEST_UNSIGNED_UNDERLYING_TYPE 0 // MSVC's ABI doesn't follow the Standard #endif + +#if TEST_UNSIGNED_UNDERLYING_TYPE +enum F { W = UINT_MAX }; +#endif // TEST_UNSIGNED_UNDERLYING_TYPE + +int main() +{ static_assert((std::is_same::type, int>::value), "E has the wrong underlying type"); - static_assert((std::is_same::type, ExpectUnsigned>::value), +#if TEST_UNSIGNED_UNDERLYING_TYPE + static_assert((std::is_same::type, unsigned>::value), "F has the wrong underlying type"); +#endif // TEST_UNSIGNED_UNDERLYING_TYPE #if TEST_STD_VER > 11 static_assert((std::is_same, int>::value), ""); - static_assert((std::is_same, ExpectUnsigned>::value), ""); -#endif +#if TEST_UNSIGNED_UNDERLYING_TYPE + static_assert((std::is_same, unsigned>::value), ""); +#endif // TEST_UNSIGNED_UNDERLYING_TYPE +#endif // TEST_STD_VER > 11 #if TEST_STD_VER >= 11 enum G : char { }; @@ -43,6 +51,6 @@ int main() "G has the wrong underlying type"); #if TEST_STD_VER > 11 static_assert((std::is_same, char>::value), ""); -#endif +#endif // TEST_STD_VER > 11 #endif // TEST_STD_VER >= 11 } diff --git a/test/std/utilities/meta/meta.unary.prop.query/void_t.pass.cpp b/test/std/utilities/meta/meta.unary.prop.query/void_t.pass.cpp index 05ef99d0ebf4..2d10fb0040a7 100644 --- a/test/std/utilities/meta/meta.unary.prop.query/void_t.pass.cpp +++ b/test/std/utilities/meta/meta.unary.prop.query/void_t.pass.cpp @@ -13,7 +13,7 @@ // UNSUPPORTED: c++98, c++03, c++11, c++14 -// XFAIL: gcc-5.1 gcc-5.2 +// XFAIL: gcc-5.1, gcc-5.2 #include 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 32e4f06beb04..c340ba69cda3 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 @@ -13,6 +13,7 @@ #include #include // for std::nullptr_t + #include "test_macros.h" template @@ -79,22 +80,27 @@ int main() test_is_function(); test_is_function(); - test_is_not_function(); - test_is_not_function(); - test_is_not_function(); - test_is_not_function(); - test_is_not_function(); - test_is_not_function(); - test_is_not_function(); - test_is_not_function(); - test_is_not_function(); - test_is_not_function(); - test_is_not_function(); - test_is_not_function(); // function pointer is not a function - test_is_not_function(); - test_is_not_function(); - test_is_not_function(); - test_is_not_function(); - test_is_not_function(); - test_is_not_function(); + test_is_not_function(); + test_is_not_function(); + test_is_not_function(); + test_is_not_function(); + test_is_not_function(); + test_is_not_function(); + test_is_not_function(); + test_is_not_function(); + test_is_not_function(); + test_is_not_function(); + test_is_not_function(); + test_is_not_function(); // function pointer is not a function + test_is_not_function(); + test_is_not_function(); + test_is_not_function(); + test_is_not_function(); + test_is_not_function(); + test_is_not_function(); + +#if TEST_STD_VER >= 11 + test_is_function(); + test_is_function(); +#endif } diff --git a/test/std/utilities/meta/meta.unary/meta.unary.cat/is_member_pointer.pass.cpp b/test/std/utilities/meta/meta.unary/meta.unary.cat/is_member_pointer.pass.cpp index d4043f48f98e..a63a88c4d18b 100644 --- a/test/std/utilities/meta/meta.unary/meta.unary.cat/is_member_pointer.pass.cpp +++ b/test/std/utilities/meta/meta.unary/meta.unary.cat/is_member_pointer.pass.cpp @@ -97,4 +97,10 @@ int main() test_is_not_member_pointer(); test_is_not_member_pointer(); test_is_not_member_pointer(); + +#if TEST_STD_VER >= 11 + test_is_member_pointer(); + test_is_member_pointer(); + test_is_member_pointer(); +#endif } 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 a895a8d447b6..691c549b5e78 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 @@ -52,90 +52,175 @@ struct incomplete_type; int main() { - test_member_function_pointer(); - test_member_function_pointer(); - test_member_function_pointer(); + test_member_function_pointer(); + test_member_function_pointer(); + test_member_function_pointer(); - test_member_function_pointer(); - test_member_function_pointer(); - test_member_function_pointer(); + test_member_function_pointer(); + test_member_function_pointer(); + test_member_function_pointer(); - test_member_function_pointer(); - test_member_function_pointer(); - test_member_function_pointer(); + test_member_function_pointer(); + test_member_function_pointer(); + test_member_function_pointer(); - test_member_function_pointer(); - test_member_function_pointer(); - test_member_function_pointer(); + test_member_function_pointer(); + test_member_function_pointer(); + test_member_function_pointer(); - test_member_function_pointer(); - test_member_function_pointer(); - test_member_function_pointer(); + test_member_function_pointer(); + test_member_function_pointer(); + test_member_function_pointer(); + + test_member_function_pointer(); + test_member_function_pointer(); + test_member_function_pointer(); - test_member_function_pointer(); - test_member_function_pointer(); - test_member_function_pointer(); // reference qualifiers on functions are a C++11 extension #if TEST_STD_VER >= 11 - test_member_function_pointer(); - test_member_function_pointer(); - test_member_function_pointer(); - test_member_function_pointer(); - test_member_function_pointer(); - test_member_function_pointer(); - - test_member_function_pointer(); - test_member_function_pointer(); - test_member_function_pointer(); - test_member_function_pointer(); - test_member_function_pointer(); - test_member_function_pointer(); - - test_member_function_pointer(); - test_member_function_pointer(); - test_member_function_pointer(); - test_member_function_pointer(); - test_member_function_pointer(); - test_member_function_pointer(); - - test_member_function_pointer(); - test_member_function_pointer(); - test_member_function_pointer(); - test_member_function_pointer(); - test_member_function_pointer(); - test_member_function_pointer(); - - // RValue qualifiers - test_member_function_pointer(); - test_member_function_pointer(); - test_member_function_pointer(); - test_member_function_pointer(); - test_member_function_pointer(); - test_member_function_pointer(); - - test_member_function_pointer(); - test_member_function_pointer(); - test_member_function_pointer(); - test_member_function_pointer(); - test_member_function_pointer(); - test_member_function_pointer(); - - test_member_function_pointer(); - test_member_function_pointer(); - test_member_function_pointer(); - test_member_function_pointer(); - test_member_function_pointer(); - test_member_function_pointer(); - - test_member_function_pointer(); - test_member_function_pointer(); - test_member_function_pointer(); - test_member_function_pointer(); - test_member_function_pointer(); - test_member_function_pointer(); + // Noexcept qualifiers + test_member_function_pointer(); + test_member_function_pointer(); + test_member_function_pointer(); + + test_member_function_pointer(); + test_member_function_pointer(); + test_member_function_pointer(); + + test_member_function_pointer(); + test_member_function_pointer(); + test_member_function_pointer(); + + test_member_function_pointer(); + test_member_function_pointer(); + test_member_function_pointer(); + + test_member_function_pointer(); + test_member_function_pointer(); + test_member_function_pointer(); + + test_member_function_pointer(); + test_member_function_pointer(); + test_member_function_pointer(); + + // lvalue qualifiers + test_member_function_pointer(); + test_member_function_pointer(); + test_member_function_pointer(); + test_member_function_pointer(); + test_member_function_pointer(); + test_member_function_pointer(); + + test_member_function_pointer(); + test_member_function_pointer(); + test_member_function_pointer(); + test_member_function_pointer(); + test_member_function_pointer(); + test_member_function_pointer(); + + test_member_function_pointer(); + test_member_function_pointer(); + test_member_function_pointer(); + test_member_function_pointer(); + test_member_function_pointer(); + test_member_function_pointer(); + + test_member_function_pointer(); + test_member_function_pointer(); + test_member_function_pointer(); + test_member_function_pointer(); + test_member_function_pointer(); + test_member_function_pointer(); + + // Lvalue qualifiers with noexcept + test_member_function_pointer(); + test_member_function_pointer(); + test_member_function_pointer(); + test_member_function_pointer(); + test_member_function_pointer(); + test_member_function_pointer(); + + test_member_function_pointer(); + test_member_function_pointer(); + test_member_function_pointer(); + test_member_function_pointer(); + test_member_function_pointer(); + test_member_function_pointer(); + + test_member_function_pointer(); + test_member_function_pointer(); + test_member_function_pointer(); + test_member_function_pointer(); + test_member_function_pointer(); + test_member_function_pointer(); + + test_member_function_pointer(); + test_member_function_pointer(); + test_member_function_pointer(); + test_member_function_pointer(); + test_member_function_pointer(); + test_member_function_pointer(); + + // RValue qualifiers + test_member_function_pointer(); + test_member_function_pointer(); + test_member_function_pointer(); + test_member_function_pointer(); + test_member_function_pointer(); + test_member_function_pointer(); + + test_member_function_pointer(); + test_member_function_pointer(); + test_member_function_pointer(); + test_member_function_pointer(); + test_member_function_pointer(); + test_member_function_pointer(); + + test_member_function_pointer(); + test_member_function_pointer(); + test_member_function_pointer(); + test_member_function_pointer(); + test_member_function_pointer(); + test_member_function_pointer(); + + test_member_function_pointer(); + test_member_function_pointer(); + test_member_function_pointer(); + test_member_function_pointer(); + test_member_function_pointer(); + test_member_function_pointer(); + + // RValue qualifiers with noexcept + test_member_function_pointer(); + test_member_function_pointer(); + test_member_function_pointer(); + test_member_function_pointer(); + test_member_function_pointer(); + test_member_function_pointer(); + + test_member_function_pointer(); + test_member_function_pointer(); + test_member_function_pointer(); + test_member_function_pointer(); + test_member_function_pointer(); + test_member_function_pointer(); + + test_member_function_pointer(); + test_member_function_pointer(); + test_member_function_pointer(); + test_member_function_pointer(); + test_member_function_pointer(); + test_member_function_pointer(); + + test_member_function_pointer(); + test_member_function_pointer(); + test_member_function_pointer(); + test_member_function_pointer(); + test_member_function_pointer(); + test_member_function_pointer(); #endif // LWG#2582 - static_assert(!std::is_member_function_pointer::value, ""); + static_assert(!std::is_member_function_pointer::value, ""); } diff --git a/test/std/utilities/meta/meta.unary/meta.unary.prop/is_abstract.pass.cpp b/test/std/utilities/meta/meta.unary/meta.unary.prop/is_abstract.pass.cpp index a54adf10258f..99ca74cc2fa9 100644 --- a/test/std/utilities/meta/meta.unary/meta.unary.prop/is_abstract.pass.cpp +++ b/test/std/utilities/meta/meta.unary/meta.unary.prop/is_abstract.pass.cpp @@ -65,6 +65,14 @@ class Abstract virtual ~Abstract() = 0; }; +template +struct AbstractTemplate { + virtual void test() = 0; +}; + +template <> +struct AbstractTemplate {}; + int main() { test_is_not_abstract(); @@ -81,4 +89,6 @@ int main() test_is_not_abstract(); test_is_abstract(); + test_is_abstract >(); + test_is_not_abstract >(); } 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 000000000000..9c72d4d44ce5 --- /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_assignable.pass.cpp b/test/std/utilities/meta/meta.unary/meta.unary.prop/is_assignable.pass.cpp index f4736e713422..3955d4bc3306 100644 --- a/test/std/utilities/meta/meta.unary/meta.unary.prop/is_assignable.pass.cpp +++ b/test/std/utilities/meta/meta.unary/meta.unary.prop/is_assignable.pass.cpp @@ -82,5 +82,4 @@ int main() // pointer to incomplete template type test_is_assignable*&, X*> (); - test_is_not_assignable(); } 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 f6ae401533a9..9d2ec5edea58 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_literal_type.pass.cpp b/test/std/utilities/meta/meta.unary/meta.unary.prop/is_literal_type.pass.cpp index 59aa5e26a292..7ead5f5d5df9 100644 --- a/test/std/utilities/meta/meta.unary/meta.unary.prop/is_literal_type.pass.cpp +++ b/test/std/utilities/meta/meta.unary/meta.unary.prop/is_literal_type.pass.cpp @@ -77,7 +77,7 @@ int main() #endif // Before C++14, void was not a literal type -// In C++14, cv-void is is a literal type +// In C++14, cv-void is a literal type #if TEST_STD_VER < 14 test_is_not_literal_type(); #else 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 b54a08f5575b..29fb7a8431f1 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 @@ -17,37 +17,48 @@ 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 - - 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), "" ); - } + 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(!(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 064114fb9db2..ae34eb20517e 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 @@ -17,39 +17,48 @@ 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 - - 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), "" ); - } + 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((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 663686cdf347..dac94002661f 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 @@ -17,39 +17,50 @@ 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 - - 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), "" ); - } + 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((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 05ac5eb12b48..b71f8363b0a6 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 @@ -17,39 +17,50 @@ 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 - - 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), "" ); - } + 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(!(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 d1891a286d7b..84456b3baa6e 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 @@ -17,39 +17,48 @@ 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 - - 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), "" ); - } + 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(!(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 ae2ff808fb25..a4ffdc25e721 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 @@ -17,37 +17,48 @@ 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 - - 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), "" ); - } + 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((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/enabled_hash.pass.cpp b/test/std/utilities/optional/optional.hash/enabled_hash.pass.cpp new file mode 100644 index 000000000000..e54a4ced8411 --- /dev/null +++ b/test/std/utilities/optional/optional.hash/enabled_hash.pass.cpp @@ -0,0 +1,26 @@ +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// UNSUPPORTED: c++98, c++03, c++11, c++14 + +// + +// Test that provides all of the arithmetic, enum, and pointer +// hash specializations. + +#include + +#include "poisoned_hash_helper.hpp" + +int main() { + test_library_hash_specializations_available(); + { + + } +} diff --git a/test/std/utilities/optional/optional.hash/hash.pass.cpp b/test/std/utilities/optional/optional.hash/hash.pass.cpp index dfdd07ddf452..8c91d6da761e 100644 --- a/test/std/utilities/optional/optional.hash/hash.pass.cpp +++ b/test/std/utilities/optional/optional.hash/hash.pass.cpp @@ -17,6 +17,19 @@ #include #include +#include "poisoned_hash_helper.hpp" + +struct A {}; +struct B {}; + +namespace std { + +template <> +struct hash { + size_t operator()(B const&) noexcept(false) { return 0; } +}; + +} int main() { @@ -27,6 +40,7 @@ int main() { typedef int T; optional opt; + ASSERT_NOT_NOEXCEPT(std::hash>()(opt)); assert(std::hash>{}(opt) == nullopt_hash); opt = 2; assert(std::hash>{}(opt) == std::hash{}(*opt)); @@ -34,6 +48,7 @@ int main() { typedef std::string T; optional opt; + ASSERT_NOT_NOEXCEPT(std::hash>()(opt)); assert(std::hash>{}(opt) == nullopt_hash); opt = std::string("123"); assert(std::hash>{}(opt) == std::hash{}(*opt)); @@ -41,8 +56,21 @@ int main() { typedef std::unique_ptr T; optional opt; + ASSERT_NOT_NOEXCEPT(std::hash>()(opt)); assert(std::hash>{}(opt) == nullopt_hash); opt = std::unique_ptr(new int(3)); assert(std::hash>{}(opt) == std::hash{}(*opt)); } + { + test_hash_enabled_for_type >(); + test_hash_enabled_for_type >(); + test_hash_enabled_for_type >(); + test_hash_enabled_for_type >(); + + test_hash_disabled_for_type>(); + test_hash_disabled_for_type>(); + + test_hash_enabled_for_type>(); + test_hash_enabled_for_type>(); + } } diff --git a/test/std/utilities/optional/optional.nullopt/nullopt_t.fail.cpp b/test/std/utilities/optional/optional.nullopt/nullopt_t.fail.cpp new file mode 100644 index 000000000000..f9ea7b47911f --- /dev/null +++ b/test/std/utilities/optional/optional.nullopt/nullopt_t.fail.cpp @@ -0,0 +1,27 @@ +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// UNSUPPORTED: c++98, c++03, c++11, c++14 +// + +// struct nullopt_t{see below}; +// constexpr nullopt_t nullopt(unspecified); + +// [optional.nullopt]/2: +// Type nullopt_t shall not have a default constructor or an initializer-list constructor. +// It shall not be an aggregate and shall be a literal type. +// Constant nullopt shall be initialized with an argument of literal type. + +#include +#include "test_macros.h" + +int main() +{ + std::nullopt_t n = {}; +} diff --git a/test/std/utilities/optional/optional.nullopt/nullopt_t.pass.cpp b/test/std/utilities/optional/optional.nullopt/nullopt_t.pass.cpp index 84bb29fabac8..9b752a665a83 100644 --- a/test/std/utilities/optional/optional.nullopt/nullopt_t.pass.cpp +++ b/test/std/utilities/optional/optional.nullopt/nullopt_t.pass.cpp @@ -13,6 +13,11 @@ // struct nullopt_t{see below}; // constexpr nullopt_t nullopt(unspecified); +// [optional.nullopt]/2: +// Type nullopt_t shall not have a default constructor or an initializer-list constructor. +// It shall not be an aggregate and shall be a literal type. +// Constant nullopt shall be initialized with an argument of literal type. + #include #include @@ -29,9 +34,9 @@ test(const nullopt_t&) int main() { - static_assert((std::is_class::value), ""); - static_assert((std::is_empty::value), ""); - static_assert((std::is_literal_type::value), ""); + static_assert(( std::is_class::value), ""); + static_assert(( std::is_empty::value), ""); + static_assert(( std::is_literal_type::value), ""); static_assert((!std::is_default_constructible::value), ""); static_assert(test(nullopt) == 3, ""); 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 1207e24150ff..0fcc52be1354 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 b5362589963c..0696c11526d5 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); } 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 c4d4763a6f0a..d068fbc2db7e 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 @@ -35,6 +35,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) @@ -61,11 +66,9 @@ constexpr bool explicit_conversion(Input&& in, const Expect& v) void test_implicit() { { - using T = long long; static_assert(implicit_conversion(42, 42), ""); } { - using T = long double; static_assert(implicit_conversion(3.14, 3.14), ""); } { @@ -81,6 +84,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 { @@ -97,18 +109,15 @@ void test_implicit() void test_explicit() { { using T = ExplicitTrivialTestTypes::TestType; - using O = optional; static_assert(explicit_conversion(42, 42), ""); } { using T = ExplicitConstexprTestTypes::TestType; - using O = optional; static_assert(explicit_conversion(42, 42), ""); static_assert(!std::is_convertible::value, ""); } { using T = ExplicitTestTypes::TestType; - using O = optional; T::reset(); { assert(explicit_conversion(42, 42)); 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 000000000000..d9e5ca821e85 --- /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/move.fail.cpp b/test/std/utilities/optional/optional.object/optional.object.ctor/move.fail.cpp new file mode 100644 index 000000000000..c7458d95abfd --- /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.relops/equal.pass.cpp b/test/std/utilities/optional/optional.relops/equal.pass.cpp index 6650b6720a8e..7667540f9760 100644 --- a/test/std/utilities/optional/optional.relops/equal.pass.cpp +++ b/test/std/utilities/optional/optional.relops/equal.pass.cpp @@ -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 - - static_assert ( o1 == o1 , "" ); - static_assert ( o1 == o2 , "" ); - static_assert ( !(o1 == o3), "" ); - static_assert ( !(o1 == o4), "" ); - static_assert ( !(o1 == o5), "" ); + 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 ( o2 == o1 , "" ); - static_assert ( o2 == o2 , "" ); - static_assert ( !(o2 == o3), "" ); - static_assert ( !(o2 == o4), "" ); - static_assert ( !(o2 == o5), "" ); + static_assert(o1 == o1, ""); + static_assert(o1 == o2, ""); + static_assert(!(o1 == o3), ""); + static_assert(!(o1 == o4), ""); + static_assert(!(o1 == o5), ""); - static_assert ( !(o3 == o1), "" ); - static_assert ( !(o3 == o2), "" ); - static_assert ( o3 == o3 , "" ); - static_assert ( !(o3 == o4), "" ); - static_assert ( o3 == o5 , "" ); + static_assert(o2 == o1, ""); + static_assert(o2 == o2, ""); + static_assert(!(o2 == o3), ""); + static_assert(!(o2 == o4), ""); + static_assert(!(o2 == o5), ""); - static_assert ( !(o4 == o1), "" ); - static_assert ( !(o4 == o2), "" ); - static_assert ( !(o4 == o3), "" ); - static_assert ( o4 == o4 , "" ); - static_assert ( !(o4 == o5), "" ); + static_assert(!(o3 == o1), ""); + static_assert(!(o3 == o2), ""); + static_assert(o3 == o3, ""); + static_assert(!(o3 == o4), ""); + static_assert(o3 == o5, ""); - static_assert ( !(o5 == o1), "" ); - static_assert ( !(o5 == o2), "" ); - static_assert ( o5 == o3 , "" ); - static_assert ( !(o5 == o4), "" ); - static_assert ( o5 == 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, ""); + } + { + 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 f9b30449638a..0e05834c147a 100644 --- a/test/std/utilities/optional/optional.relops/greater_equal.pass.cpp +++ b/test/std/utilities/optional/optional.relops/greater_equal.pass.cpp @@ -16,55 +16,68 @@ 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 8a27eb471f28..3946a6102ba9 100644 --- a/test/std/utilities/optional/optional.relops/greater_than.pass.cpp +++ b/test/std/utilities/optional/optional.relops/greater_than.pass.cpp @@ -16,55 +16,66 @@ 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 a7d594dd34a2..5a1954154f44 100644 --- a/test/std/utilities/optional/optional.relops/less_equal.pass.cpp +++ b/test/std/utilities/optional/optional.relops/less_equal.pass.cpp @@ -16,55 +16,68 @@ 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 deffa5e849f9..35956e6f4a70 100644 --- a/test/std/utilities/optional/optional.relops/less_than.pass.cpp +++ b/test/std/utilities/optional/optional.relops/less_than.pass.cpp @@ -16,55 +16,66 @@ 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 fd11b2a207ca..1256537d6a86 100644 --- a/test/std/utilities/optional/optional.relops/not_equal.pass.cpp +++ b/test/std/utilities/optional/optional.relops/not_equal.pass.cpp @@ -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 - - static_assert ( !(o1 != o1), "" ); - static_assert ( !(o1 != o2), "" ); - static_assert ( (o1 != o3), "" ); - static_assert ( (o1 != o4), "" ); - static_assert ( (o1 != o5), "" ); + 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 ( !(o2 != o1), "" ); - static_assert ( !(o2 != o2), "" ); - static_assert ( (o2 != o3), "" ); - static_assert ( (o2 != o4), "" ); - static_assert ( (o2 != o5), "" ); + static_assert(!(o1 != o1), ""); + static_assert(!(o1 != o2), ""); + static_assert((o1 != o3), ""); + static_assert((o1 != o4), ""); + static_assert((o1 != o5), ""); - static_assert ( (o3 != o1), "" ); - static_assert ( (o3 != o2), "" ); - static_assert ( !(o3 != o3), "" ); - static_assert ( (o3 != o4), "" ); - static_assert ( !(o3 != o5), "" ); + static_assert(!(o2 != o1), ""); + static_assert(!(o2 != o2), ""); + static_assert((o2 != o3), ""); + static_assert((o2 != o4), ""); + static_assert((o2 != o5), ""); - static_assert ( (o4 != o1), "" ); - static_assert ( (o4 != o2), "" ); - static_assert ( (o4 != o3), "" ); - static_assert ( !(o4 != o4), "" ); - static_assert ( (o4 != o5), "" ); + static_assert((o3 != o1), ""); + static_assert((o3 != o2), ""); + static_assert(!(o3 != o3), ""); + static_assert((o3 != o4), ""); + static_assert(!(o3 != o5), ""); - static_assert ( (o5 != o1), "" ); - static_assert ( (o5 != o2), "" ); - static_assert ( !(o5 != o3), "" ); - static_assert ( (o5 != o4), "" ); - static_assert ( !(o5 != 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), ""); + } + { + 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 000000000000..20f77f61827c --- /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/smartptr/unique.ptr/nothing_to_do.pass.cpp b/test/std/utilities/smartptr/unique.ptr/nothing_to_do.pass.cpp new file mode 100644 index 000000000000..b58f5c55b643 --- /dev/null +++ b/test/std/utilities/smartptr/unique.ptr/nothing_to_do.pass.cpp @@ -0,0 +1,12 @@ +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +int main() +{ +} 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 000000000000..54c2cf16ecc7 --- /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 000000000000..5d2f955aa185 --- /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 000000000000..8d83c3c8888a --- /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