[cfe-commits] [libcxx] r111767 [1/2] - in /libcxx/trunk/test/utilities: ./ date.time/ function.objects/ function.objects/arithmetic.operations/ function.objects/base/ function.objects/bind/ function.objects/bind/func.bind/ function.objects/bind/func.bind/func.bind.bind/ function.objects/bind/func.bind/func.bind.isbind/ function.objects/bind/func.bind/func.bind.place/ function.objects/bitwise.operations/ function.objects/comparisons/ function.objects/func.def/ function.objects/func.memfn/ function.objects/func.require/...

Howard Hinnant hhinnant at apple.com
Sat Aug 21 17:59:48 PDT 2010


Author: hhinnant
Date: Sat Aug 21 19:59:46 2010
New Revision: 111767

URL: http://llvm.org/viewvc/llvm-project?rev=111767&view=rev
Log:
Fixing whitespace problems

Modified:
    libcxx/trunk/test/utilities/date.time/tested_elsewhere.pass.cpp
    libcxx/trunk/test/utilities/function.objects/arithmetic.operations/divides.pass.cpp
    libcxx/trunk/test/utilities/function.objects/arithmetic.operations/minus.pass.cpp
    libcxx/trunk/test/utilities/function.objects/arithmetic.operations/modulus.pass.cpp
    libcxx/trunk/test/utilities/function.objects/arithmetic.operations/multiplies.pass.cpp
    libcxx/trunk/test/utilities/function.objects/arithmetic.operations/negate.pass.cpp
    libcxx/trunk/test/utilities/function.objects/arithmetic.operations/plus.pass.cpp
    libcxx/trunk/test/utilities/function.objects/base/nothing_to_do.pass.cpp
    libcxx/trunk/test/utilities/function.objects/bind/func.bind/func.bind.bind/invoke_int_0.pass.cpp
    libcxx/trunk/test/utilities/function.objects/bind/func.bind/func.bind.bind/invoke_lvalue.pass.cpp
    libcxx/trunk/test/utilities/function.objects/bind/func.bind/func.bind.bind/invoke_rvalue.pass.cpp
    libcxx/trunk/test/utilities/function.objects/bind/func.bind/func.bind.bind/invoke_void_0.pass.cpp
    libcxx/trunk/test/utilities/function.objects/bind/func.bind/func.bind.isbind/is_bind_expression.pass.cpp
    libcxx/trunk/test/utilities/function.objects/bind/func.bind/func.bind.isbind/is_placeholder.pass.cpp
    libcxx/trunk/test/utilities/function.objects/bind/func.bind/func.bind.place/placeholders.pass.cpp
    libcxx/trunk/test/utilities/function.objects/bind/func.bind/nothing_to_do.pass.cpp
    libcxx/trunk/test/utilities/function.objects/bind/nothing_to_do.pass.cpp
    libcxx/trunk/test/utilities/function.objects/bitwise.operations/bit_and.pass.cpp
    libcxx/trunk/test/utilities/function.objects/bitwise.operations/bit_or.pass.cpp
    libcxx/trunk/test/utilities/function.objects/bitwise.operations/bit_xor.pass.cpp
    libcxx/trunk/test/utilities/function.objects/comparisons/equal_to.pass.cpp
    libcxx/trunk/test/utilities/function.objects/comparisons/greater.pass.cpp
    libcxx/trunk/test/utilities/function.objects/comparisons/greater_equal.pass.cpp
    libcxx/trunk/test/utilities/function.objects/comparisons/less.pass.cpp
    libcxx/trunk/test/utilities/function.objects/comparisons/less_equal.pass.cpp
    libcxx/trunk/test/utilities/function.objects/comparisons/not_equal_to.pass.cpp
    libcxx/trunk/test/utilities/function.objects/func.def/nothing_to_do.pass.cpp
    libcxx/trunk/test/utilities/function.objects/func.memfn/member_data.fail.cpp
    libcxx/trunk/test/utilities/function.objects/func.memfn/member_data.pass.cpp
    libcxx/trunk/test/utilities/function.objects/func.memfn/member_function.pass.cpp
    libcxx/trunk/test/utilities/function.objects/func.memfn/member_function_const.pass.cpp
    libcxx/trunk/test/utilities/function.objects/func.memfn/member_function_const_volatile.pass.cpp
    libcxx/trunk/test/utilities/function.objects/func.memfn/member_function_volatile.pass.cpp
    libcxx/trunk/test/utilities/function.objects/func.require/binary_function.pass.cpp
    libcxx/trunk/test/utilities/function.objects/func.require/unary_function.pass.cpp
    libcxx/trunk/test/utilities/function.objects/func.wrap/func.wrap.badcall/bad_function_call.pass.cpp
    libcxx/trunk/test/utilities/function.objects/func.wrap/func.wrap.badcall/func.wrap.badcall.const/bad_function_call_ctor.pass.cpp
    libcxx/trunk/test/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.alg/swap.pass.cpp
    libcxx/trunk/test/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.cap/operator_bool.pass.cpp
    libcxx/trunk/test/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/F.pass.cpp
    libcxx/trunk/test/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/F_assign.pass.cpp
    libcxx/trunk/test/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/alloc_rfunction.pass.cpp
    libcxx/trunk/test/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/copy.pass.cpp
    libcxx/trunk/test/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/copy_assign.pass.cpp
    libcxx/trunk/test/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/default.pass.cpp
    libcxx/trunk/test/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/nullptr_t.pass.cpp
    libcxx/trunk/test/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/nullptr_t_assign.pass.cpp
    libcxx/trunk/test/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.inv/invoke.fail.cpp
    libcxx/trunk/test/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.inv/invoke.pass.cpp
    libcxx/trunk/test/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.inv/invoke_int_0.pass.cpp
    libcxx/trunk/test/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.inv/invoke_void_0.pass.cpp
    libcxx/trunk/test/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.mod/swap.pass.cpp
    libcxx/trunk/test/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.nullptr/operator_==.pass.cpp
    libcxx/trunk/test/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.targ/target.pass.cpp
    libcxx/trunk/test/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.targ/target_type.pass.cpp
    libcxx/trunk/test/utilities/function.objects/func.wrap/func.wrap.func/test_allocator.h
    libcxx/trunk/test/utilities/function.objects/func.wrap/func.wrap.func/types.pass.cpp
    libcxx/trunk/test/utilities/function.objects/func.wrap/nothing_to_do.pass.cpp
    libcxx/trunk/test/utilities/function.objects/function.pointer.adaptors/pointer_to_binary_function.pass.cpp
    libcxx/trunk/test/utilities/function.objects/function.pointer.adaptors/pointer_to_unary_function.pass.cpp
    libcxx/trunk/test/utilities/function.objects/function.pointer.adaptors/ptr_fun1.pass.cpp
    libcxx/trunk/test/utilities/function.objects/function.pointer.adaptors/ptr_fun2.pass.cpp
    libcxx/trunk/test/utilities/function.objects/logical.operations/logical_and.pass.cpp
    libcxx/trunk/test/utilities/function.objects/logical.operations/logical_not.pass.cpp
    libcxx/trunk/test/utilities/function.objects/logical.operations/logical_or.pass.cpp
    libcxx/trunk/test/utilities/function.objects/member.pointer.adaptors/const_mem_fun.pass.cpp
    libcxx/trunk/test/utilities/function.objects/member.pointer.adaptors/const_mem_fun1.pass.cpp
    libcxx/trunk/test/utilities/function.objects/member.pointer.adaptors/const_mem_fun1_ref_t.pass.cpp
    libcxx/trunk/test/utilities/function.objects/member.pointer.adaptors/const_mem_fun1_t.pass.cpp
    libcxx/trunk/test/utilities/function.objects/member.pointer.adaptors/const_mem_fun_ref.pass.cpp
    libcxx/trunk/test/utilities/function.objects/member.pointer.adaptors/const_mem_fun_ref1.pass.cpp
    libcxx/trunk/test/utilities/function.objects/member.pointer.adaptors/const_mem_fun_ref_t.pass.cpp
    libcxx/trunk/test/utilities/function.objects/member.pointer.adaptors/const_mem_fun_t.pass.cpp
    libcxx/trunk/test/utilities/function.objects/member.pointer.adaptors/mem_fun.pass.cpp
    libcxx/trunk/test/utilities/function.objects/member.pointer.adaptors/mem_fun1.pass.cpp
    libcxx/trunk/test/utilities/function.objects/member.pointer.adaptors/mem_fun1_ref_t.pass.cpp
    libcxx/trunk/test/utilities/function.objects/member.pointer.adaptors/mem_fun1_t.pass.cpp
    libcxx/trunk/test/utilities/function.objects/member.pointer.adaptors/mem_fun_ref.pass.cpp
    libcxx/trunk/test/utilities/function.objects/member.pointer.adaptors/mem_fun_ref1.pass.cpp
    libcxx/trunk/test/utilities/function.objects/member.pointer.adaptors/mem_fun_ref_t.pass.cpp
    libcxx/trunk/test/utilities/function.objects/member.pointer.adaptors/mem_fun_t.pass.cpp
    libcxx/trunk/test/utilities/function.objects/negators/binary_negate.pass.cpp
    libcxx/trunk/test/utilities/function.objects/negators/not1.pass.cpp
    libcxx/trunk/test/utilities/function.objects/negators/not2.pass.cpp
    libcxx/trunk/test/utilities/function.objects/negators/unary_negate.pass.cpp
    libcxx/trunk/test/utilities/function.objects/refwrap/binary.pass.cpp
    libcxx/trunk/test/utilities/function.objects/refwrap/refwrap.access/conversion.pass.cpp
    libcxx/trunk/test/utilities/function.objects/refwrap/refwrap.assign/copy_assign.pass.cpp
    libcxx/trunk/test/utilities/function.objects/refwrap/refwrap.const/copy_ctor.pass.cpp
    libcxx/trunk/test/utilities/function.objects/refwrap/refwrap.const/type_ctor.fail.cpp
    libcxx/trunk/test/utilities/function.objects/refwrap/refwrap.const/type_ctor.pass.cpp
    libcxx/trunk/test/utilities/function.objects/refwrap/refwrap.helpers/cref_1.pass.cpp
    libcxx/trunk/test/utilities/function.objects/refwrap/refwrap.helpers/cref_2.pass.cpp
    libcxx/trunk/test/utilities/function.objects/refwrap/refwrap.helpers/ref_1.fail.cpp
    libcxx/trunk/test/utilities/function.objects/refwrap/refwrap.helpers/ref_1.pass.cpp
    libcxx/trunk/test/utilities/function.objects/refwrap/refwrap.helpers/ref_2.pass.cpp
    libcxx/trunk/test/utilities/function.objects/refwrap/refwrap.invoke/invoke.fail.cpp
    libcxx/trunk/test/utilities/function.objects/refwrap/refwrap.invoke/invoke.pass.cpp
    libcxx/trunk/test/utilities/function.objects/refwrap/refwrap.invoke/invoke_int_0.pass.cpp
    libcxx/trunk/test/utilities/function.objects/refwrap/refwrap.invoke/invoke_void_0.pass.cpp
    libcxx/trunk/test/utilities/function.objects/refwrap/type.pass.cpp
    libcxx/trunk/test/utilities/function.objects/refwrap/unary.pass.cpp
    libcxx/trunk/test/utilities/function.objects/refwrap/weak_result.pass.cpp
    libcxx/trunk/test/utilities/function.objects/version.pass.cpp
    libcxx/trunk/test/utilities/memory/allocator.adaptor/allocator.adaptor.cnstr/allocs.pass.cpp
    libcxx/trunk/test/utilities/memory/allocator.adaptor/allocator.adaptor.cnstr/converting_copy.pass.cpp
    libcxx/trunk/test/utilities/memory/allocator.adaptor/allocator.adaptor.cnstr/converting_move.pass.cpp
    libcxx/trunk/test/utilities/memory/allocator.adaptor/allocator.adaptor.cnstr/copy.pass.cpp
    libcxx/trunk/test/utilities/memory/allocator.adaptor/allocator.adaptor.cnstr/default.pass.cpp
    libcxx/trunk/test/utilities/memory/allocator.adaptor/allocator.adaptor.members/allocate_size.pass.cpp
    libcxx/trunk/test/utilities/memory/allocator.adaptor/allocator.adaptor.members/allocate_size_hint.pass.cpp
    libcxx/trunk/test/utilities/memory/allocator.adaptor/allocator.adaptor.members/construct.pass.cpp
    libcxx/trunk/test/utilities/memory/allocator.adaptor/allocator.adaptor.members/deallocate.pass.cpp
    libcxx/trunk/test/utilities/memory/allocator.adaptor/allocator.adaptor.members/destroy.pass.cpp
    libcxx/trunk/test/utilities/memory/allocator.adaptor/allocator.adaptor.members/inner_allocator.pass.cpp
    libcxx/trunk/test/utilities/memory/allocator.adaptor/allocator.adaptor.members/max_size.pass.cpp
    libcxx/trunk/test/utilities/memory/allocator.adaptor/allocator.adaptor.members/outer_allocator.pass.cpp
    libcxx/trunk/test/utilities/memory/allocator.adaptor/allocator.adaptor.members/select_on_container_copy_construction.pass.cpp
    libcxx/trunk/test/utilities/memory/allocator.adaptor/allocator.adaptor.types/inner_allocator_type.pass.cpp
    libcxx/trunk/test/utilities/memory/allocator.adaptor/allocator.adaptor.types/propagate_on_container_copy_assignment.pass.cpp
    libcxx/trunk/test/utilities/memory/allocator.adaptor/allocator.adaptor.types/propagate_on_container_move_assignment.pass.cpp
    libcxx/trunk/test/utilities/memory/allocator.adaptor/allocator.adaptor.types/propagate_on_container_swap.pass.cpp
    libcxx/trunk/test/utilities/memory/allocator.adaptor/allocators.h
    libcxx/trunk/test/utilities/memory/allocator.adaptor/types.pass.cpp
    libcxx/trunk/test/utilities/memory/allocator.tag/allocator_arg.pass.cpp
    libcxx/trunk/test/utilities/memory/allocator.traits/allocator.traits.members/allocate.pass.cpp
    libcxx/trunk/test/utilities/memory/allocator.traits/allocator.traits.members/allocate_hint.pass.cpp
    libcxx/trunk/test/utilities/memory/allocator.traits/allocator.traits.members/construct.pass.cpp
    libcxx/trunk/test/utilities/memory/allocator.traits/allocator.traits.members/deallocate.pass.cpp
    libcxx/trunk/test/utilities/memory/allocator.traits/allocator.traits.members/destroy.pass.cpp
    libcxx/trunk/test/utilities/memory/allocator.traits/allocator.traits.members/max_size.pass.cpp
    libcxx/trunk/test/utilities/memory/allocator.traits/allocator.traits.members/select_on_container_copy_construction.pass.cpp
    libcxx/trunk/test/utilities/memory/allocator.traits/allocator.traits.types/const_pointer.pass.cpp
    libcxx/trunk/test/utilities/memory/allocator.traits/allocator.traits.types/const_void_pointer.pass.cpp
    libcxx/trunk/test/utilities/memory/allocator.traits/allocator.traits.types/difference_type.pass.cpp
    libcxx/trunk/test/utilities/memory/allocator.traits/allocator.traits.types/pointer.pass.cpp
    libcxx/trunk/test/utilities/memory/allocator.traits/allocator.traits.types/propagate_on_container_copy_assignment.pass.cpp
    libcxx/trunk/test/utilities/memory/allocator.traits/allocator.traits.types/propagate_on_container_move_assignment.pass.cpp
    libcxx/trunk/test/utilities/memory/allocator.traits/allocator.traits.types/propagate_on_container_swap.pass.cpp
    libcxx/trunk/test/utilities/memory/allocator.traits/allocator.traits.types/rebind_alloc.pass.cpp
    libcxx/trunk/test/utilities/memory/allocator.traits/allocator.traits.types/size_type.pass.cpp
    libcxx/trunk/test/utilities/memory/allocator.traits/allocator.traits.types/void_pointer.pass.cpp
    libcxx/trunk/test/utilities/memory/allocator.traits/allocator_type.pass.cpp
    libcxx/trunk/test/utilities/memory/allocator.traits/rebind_traits.pass.cpp
    libcxx/trunk/test/utilities/memory/allocator.traits/value_type.pass.cpp
    libcxx/trunk/test/utilities/memory/allocator.uses/allocator.uses.construction/tested_elsewhere.pass.cpp
    libcxx/trunk/test/utilities/memory/allocator.uses/allocator.uses.trait/uses_allocator.pass.cpp
    libcxx/trunk/test/utilities/memory/allocator.uses/nothing_to_do.pass.cpp
    libcxx/trunk/test/utilities/memory/c.malloc/nothing_to_do.pass.cpp
    libcxx/trunk/test/utilities/memory/default.allocator/allocator.globals/eq.pass.cpp
    libcxx/trunk/test/utilities/memory/default.allocator/allocator.members/address.pass.cpp
    libcxx/trunk/test/utilities/memory/default.allocator/allocator.members/allocate.pass.cpp
    libcxx/trunk/test/utilities/memory/default.allocator/allocator.members/construct.pass.cpp
    libcxx/trunk/test/utilities/memory/default.allocator/allocator.members/max_size.pass.cpp
    libcxx/trunk/test/utilities/memory/default.allocator/allocator_types.pass.cpp
    libcxx/trunk/test/utilities/memory/default.allocator/allocator_void.pass.cpp
    libcxx/trunk/test/utilities/memory/pointer.traits/difference_type.pass.cpp
    libcxx/trunk/test/utilities/memory/pointer.traits/element_type.pass.cpp
    libcxx/trunk/test/utilities/memory/pointer.traits/pointer.pass.cpp
    libcxx/trunk/test/utilities/memory/pointer.traits/pointer.traits.functions/pointer_to.pass.cpp
    libcxx/trunk/test/utilities/memory/pointer.traits/pointer.traits.types/difference_type.pass.cpp
    libcxx/trunk/test/utilities/memory/pointer.traits/pointer.traits.types/element_type.pass.cpp
    libcxx/trunk/test/utilities/memory/pointer.traits/pointer.traits.types/rebind.pass.cpp
    libcxx/trunk/test/utilities/memory/pointer.traits/pointer_to.pass.cpp
    libcxx/trunk/test/utilities/memory/pointer.traits/rebind.pass.cpp
    libcxx/trunk/test/utilities/memory/specialized.algorithms/nothing_to_do.pass.cpp
    libcxx/trunk/test/utilities/memory/specialized.algorithms/specialized.addressof/addressof.pass.cpp
    libcxx/trunk/test/utilities/memory/specialized.algorithms/uninitialized.copy/uninitialized_copy.pass.cpp
    libcxx/trunk/test/utilities/memory/specialized.algorithms/uninitialized.copy/uninitialized_copy_n.pass.cpp
    libcxx/trunk/test/utilities/memory/specialized.algorithms/uninitialized.fill.n/uninitialized_fill_n.pass.cpp
    libcxx/trunk/test/utilities/memory/specialized.algorithms/uninitialized.fill/uninitialized_fill.pass.cpp
    libcxx/trunk/test/utilities/memory/storage.iterator/raw_storag_iterator.pass.cpp
    libcxx/trunk/test/utilities/memory/temporary.buffer/temporary_buffer.pass.cpp
    libcxx/trunk/test/utilities/memory/unique.ptr/deleter.h
    libcxx/trunk/test/utilities/memory/unique.ptr/nothing_to_do.pass.cpp
    libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.dltr/nothing_to_do.pass.cpp
    libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.dltr/unique.ptr.dltr.dflt/convert_ctor.pass.cpp
    libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.dltr/unique.ptr.dltr.dflt/default.pass.cpp
    libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.dltr/unique.ptr.dltr.dflt/incomplete.fail.cpp
    libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.dltr/unique.ptr.dltr.dflt1/convert_ctor.fail.cpp
    libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.dltr/unique.ptr.dltr.dflt1/default.pass.cpp
    libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.dltr/unique.ptr.dltr.dflt1/incomplete.fail.cpp
    libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.dltr/unique.ptr.dltr.general/nothing_to_do.pass.cpp
    libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/move01.fail.cpp
    libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/move01.pass.cpp
    libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/move02.fail.cpp
    libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/move03.fail.cpp
    libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/move04.fail.cpp
    libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/move_convert01.fail.cpp
    libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/move_convert02.fail.cpp
    libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/move_convert03.fail.cpp
    libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/move_convert04.fail.cpp
    libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/move_convert05.fail.cpp
    libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/move_convert06.fail.cpp
    libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/move_convert07.fail.cpp
    libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/move_convert08.fail.cpp
    libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/move_convert09.fail.cpp
    libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/null_asgn.pass.cpp
    libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/null_ctor.pass.cpp
    libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/nullptr_asgn.pass.cpp
    libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/pointer_type.pass.cpp
    libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/default01.fail.cpp
    libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/default01.pass.cpp
    libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/default02.fail.cpp
    libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/default02.pass.cpp
    libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/default03.fail.cpp
    libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/move01.fail.cpp
    libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/move01.pass.cpp
    libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/move02.fail.cpp
    libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/move02.pass.cpp
    libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/move03.fail.cpp
    libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/move04.fail.cpp
    libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/move_convert01.fail.cpp
    libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/move_convert02.fail.cpp
    libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/move_convert03.fail.cpp
    libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/move_convert04.fail.cpp
    libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/move_convert05.fail.cpp
    libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/move_convert06.fail.cpp
    libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/move_convert07.fail.cpp
    libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/move_convert08.fail.cpp
    libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/move_convert09.fail.cpp
    libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/move_convert10.fail.cpp
    libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/move_convert11.fail.cpp
    libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/move_convert12.fail.cpp
    libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/move_convert13.fail.cpp
    libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/move_convert14.fail.cpp
    libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/move_convert15.fail.cpp
    libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/move_convert16.fail.cpp
    libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/move_convert17.fail.cpp
    libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/move_convert18.fail.cpp
    libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/nullptr.pass.cpp
    libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/pointer01.fail.cpp
    libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/pointer01.pass.cpp
    libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/pointer02.fail.cpp
    libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/pointer02.pass.cpp
    libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/pointer03.fail.cpp
    libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/pointer04.fail.cpp
    libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/pointer_deleter01.pass.cpp
    libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/pointer_deleter02.pass.cpp
    libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/pointer_deleter03.pass.cpp
    libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/pointer_deleter04.fail.cpp
    libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/pointer_deleter04.pass.cpp
    libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/pointer_deleter05.fail.cpp
    libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.modifiers/release.pass.cpp
    libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.modifiers/reset1.pass.cpp
    libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.modifiers/reset2.fail.cpp
    libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.modifiers/swap.pass.cpp
    libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.observers/dereference.fail.cpp
    libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.observers/explicit_bool.pass.cpp
    libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.observers/get.pass.cpp
    libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.observers/get_deleter.pass.cpp
    libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.observers/index.pass.cpp
    libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.observers/op_arrow.fail.cpp
    libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/pointer_type.pass.cpp
    libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.asgn/move01.fail.cpp
    libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.asgn/move01.pass.cpp
    libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.asgn/move02.fail.cpp
    libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.asgn/move03.fail.cpp
    libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.asgn/move04.fail.cpp
    libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.asgn/move_convert01.fail.cpp
    libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.asgn/move_convert01.pass.cpp
    libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.asgn/move_convert02.fail.cpp
    libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.asgn/move_convert02.pass.cpp
    libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.asgn/move_convert03.fail.cpp
    libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.asgn/move_convert03.pass.cpp
    libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.asgn/move_convert04.fail.cpp
    libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.asgn/move_convert05.fail.cpp
    libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.asgn/move_convert06.fail.cpp
    libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.asgn/move_convert13.fail.cpp
    libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.asgn/null.pass.cpp
    libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.asgn/nullptr.pass.cpp
    libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/auto_pointer.pass.cpp
    libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/auto_pointer01.fail.cpp
    libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/auto_pointer02.fail.cpp
    libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/default01.fail.cpp
    libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/default01.pass.cpp
    libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/default02.fail.cpp
    libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/default02.pass.cpp
    libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/default03.fail.cpp
    libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/move01.fail.cpp
    libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/move01.pass.cpp
    libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/move02.fail.cpp
    libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/move02.pass.cpp
    libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/move03.fail.cpp
    libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/move04.fail.cpp
    libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/move_convert01.fail.cpp
    libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/move_convert01.pass.cpp
    libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/move_convert02.fail.cpp
    libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/move_convert02.pass.cpp
    libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/move_convert03.fail.cpp
    libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/move_convert03.pass.cpp
    libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/move_convert04.fail.cpp
    libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/move_convert04.pass.cpp
    libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/move_convert05.fail.cpp
    libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/move_convert05.pass.cpp
    libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/move_convert06.fail.cpp
    libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/move_convert06.pass.cpp
    libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/move_convert07.fail.cpp
    libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/move_convert07.pass.cpp
    libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/move_convert08.fail.cpp
    libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/move_convert09.fail.cpp
    libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/move_convert10.fail.cpp
    libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/move_convert11.fail.cpp
    libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/move_convert12.fail.cpp
    libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/move_convert13.fail.cpp
    libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/nullptr.pass.cpp
    libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/pointer01.fail.cpp
    libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/pointer01.pass.cpp
    libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/pointer02.fail.cpp
    libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/pointer02.pass.cpp
    libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/pointer03.fail.cpp
    libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/pointer03.pass.cpp
    libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/pointer_deleter01.pass.cpp
    libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/pointer_deleter02.pass.cpp
    libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/pointer_deleter03.pass.cpp
    libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/pointer_deleter04.fail.cpp
    libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/pointer_deleter04.pass.cpp
    libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/pointer_deleter05.pass.cpp
    libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/pointer_deleter06.pass.cpp
    libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.dtor/null.pass.cpp
    libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.modifiers/release.pass.cpp
    libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.modifiers/reset1.pass.cpp
    libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.modifiers/reset2.pass.cpp
    libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.modifiers/reset_self.pass.cpp
    libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.modifiers/swap.pass.cpp
    libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.observers/dereference.pass.cpp
    libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.observers/explicit_bool.pass.cpp
    libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.observers/get.pass.cpp
    libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.observers/get_deleter.pass.cpp
    libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.observers/index.fail.cpp
    libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.observers/op_arrow.pass.cpp
    libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.special/eq.pass.cpp
    libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.special/rel.pass.cpp
    libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.special/swap.pass.cpp
    libcxx/trunk/test/utilities/memory/util.smartptr/nothing_to_do.pass.cpp
    libcxx/trunk/test/utilities/memory/util.smartptr/util.smartptr.enab/enable_shared_from_this.pass.cpp
    libcxx/trunk/test/utilities/memory/util.smartptr/util.smartptr.hash/hash_shared_ptr.pass.cpp
    libcxx/trunk/test/utilities/memory/util.smartptr/util.smartptr.hash/hash_unique_ptr.pass.cpp
    libcxx/trunk/test/utilities/memory/util.smartptr/util.smartptr.shared/test_allocator.h
    libcxx/trunk/test/utilities/memory/util.smartptr/util.smartptr.shared/test_deleter.h
    libcxx/trunk/test/utilities/memory/util.smartptr/util.smartptr.shared/types.pass.cpp
    libcxx/trunk/test/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.getdeleter/get_deleter.pass.cpp
    libcxx/trunk/test/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.assign/auto_ptr_Y.pass.cpp
    libcxx/trunk/test/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.assign/shared_ptr.pass.cpp
    libcxx/trunk/test/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.assign/shared_ptr_Y.pass.cpp
    libcxx/trunk/test/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.assign/shared_ptr_Y_rv.pass.cpp
    libcxx/trunk/test/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.assign/shared_ptr_rv.pass.cpp
    libcxx/trunk/test/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.assign/unique_ptr_Y.pass.cpp
    libcxx/trunk/test/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.cast/const_pointer_cast.pass.cpp
    libcxx/trunk/test/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.cast/dynamic_pointer_cast.pass.cpp
    libcxx/trunk/test/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.cast/static_pointer_cast.pass.cpp
    libcxx/trunk/test/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.cmp/eq.pass.cpp
    libcxx/trunk/test/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.cmp/lt.pass.cpp
    libcxx/trunk/test/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/auto_ptr.pass.cpp
    libcxx/trunk/test/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/default.pass.cpp
    libcxx/trunk/test/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/nullptr_t.pass.cpp
    libcxx/trunk/test/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/nullptr_t_deleter.pass.cpp
    libcxx/trunk/test/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/nullptr_t_deleter_allocator.pass.cpp
    libcxx/trunk/test/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/nullptr_t_deleter_allocator_throw.pass.cpp
    libcxx/trunk/test/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/nullptr_t_deleter_throw.pass.cpp
    libcxx/trunk/test/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/pointer.pass.cpp
    libcxx/trunk/test/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/pointer_deleter.pass.cpp
    libcxx/trunk/test/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/pointer_deleter_allocator.pass.cpp
    libcxx/trunk/test/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/pointer_deleter_allocator_throw.pass.cpp
    libcxx/trunk/test/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/pointer_deleter_throw.pass.cpp
    libcxx/trunk/test/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/pointer_throw.pass.cpp
    libcxx/trunk/test/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/shared_ptr.pass.cpp
    libcxx/trunk/test/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/shared_ptr_Y.pass.cpp
    libcxx/trunk/test/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/shared_ptr_Y_rv.pass.cpp
    libcxx/trunk/test/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/shared_ptr_pointer.pass.cpp
    libcxx/trunk/test/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/shared_ptr_rv.pass.cpp
    libcxx/trunk/test/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/unique_ptr.pass.cpp
    libcxx/trunk/test/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/weak_ptr.pass.cpp
    libcxx/trunk/test/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.create/allocate_shared.pass.cpp
    libcxx/trunk/test/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.create/make_shared.pass.cpp
    libcxx/trunk/test/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.dest/tested_elsewhere.pass.cpp
    libcxx/trunk/test/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.mod/reset.pass.cpp
    libcxx/trunk/test/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.mod/reset_pointer.pass.cpp
    libcxx/trunk/test/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.mod/reset_pointer_deleter.pass.cpp
    libcxx/trunk/test/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.mod/reset_pointer_deleter_allocator.pass.cpp
    libcxx/trunk/test/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.mod/swap.pass.cpp
    libcxx/trunk/test/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.obs/arrow.pass.cpp
    libcxx/trunk/test/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.obs/dereference.pass.cpp
    libcxx/trunk/test/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.obs/op_bool.pass.cpp
    libcxx/trunk/test/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.obs/owner_before_shared_ptr.pass.cpp
    libcxx/trunk/test/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.obs/owner_before_weak_ptr.pass.cpp
    libcxx/trunk/test/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.obs/unique.pass.cpp
    libcxx/trunk/test/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.spec/swap.pass.cpp
    libcxx/trunk/test/utilities/memory/util.smartptr/util.smartptr.weak/types.pass.cpp
    libcxx/trunk/test/utilities/memory/util.smartptr/util.smartptr.weak/util.smartptr.ownerless/owner_less.pass.cpp
    libcxx/trunk/test/utilities/memory/util.smartptr/util.smartptr.weak/util.smartptr.weak.assign/shared_ptr_Y.pass.cpp
    libcxx/trunk/test/utilities/memory/util.smartptr/util.smartptr.weak/util.smartptr.weak.assign/weak_ptr.pass.cpp
    libcxx/trunk/test/utilities/memory/util.smartptr/util.smartptr.weak/util.smartptr.weak.assign/weak_ptr_Y.pass.cpp
    libcxx/trunk/test/utilities/memory/util.smartptr/util.smartptr.weak/util.smartptr.weak.const/default.pass.cpp
    libcxx/trunk/test/utilities/memory/util.smartptr/util.smartptr.weak/util.smartptr.weak.const/shared_ptr_Y.pass.cpp
    libcxx/trunk/test/utilities/memory/util.smartptr/util.smartptr.weak/util.smartptr.weak.const/weak_ptr.pass.cpp
    libcxx/trunk/test/utilities/memory/util.smartptr/util.smartptr.weak/util.smartptr.weak.const/weak_ptr_Y.pass.cpp
    libcxx/trunk/test/utilities/memory/util.smartptr/util.smartptr.weak/util.smartptr.weak.dest/tested_elsewhere.pass.cpp
    libcxx/trunk/test/utilities/memory/util.smartptr/util.smartptr.weak/util.smartptr.weak.mod/reset.pass.cpp
    libcxx/trunk/test/utilities/memory/util.smartptr/util.smartptr.weak/util.smartptr.weak.mod/swap.pass.cpp
    libcxx/trunk/test/utilities/memory/util.smartptr/util.smartptr.weak/util.smartptr.weak.obs/expired.pass.cpp
    libcxx/trunk/test/utilities/memory/util.smartptr/util.smartptr.weak/util.smartptr.weak.obs/lock.pass.cpp
    libcxx/trunk/test/utilities/memory/util.smartptr/util.smartptr.weak/util.smartptr.weak.obs/not_less_than.fail.cpp
    libcxx/trunk/test/utilities/memory/util.smartptr/util.smartptr.weak/util.smartptr.weak.obs/owner_before_shared_ptr.pass.cpp
    libcxx/trunk/test/utilities/memory/util.smartptr/util.smartptr.weak/util.smartptr.weak.obs/owner_before_weak_ptr.pass.cpp
    libcxx/trunk/test/utilities/memory/util.smartptr/util.smartptr.weak/util.smartptr.weak.spec/swap.pass.cpp
    libcxx/trunk/test/utilities/memory/util.smartptr/util.smartptr.weakptr/bad_weak_ptr.pass.cpp
    libcxx/trunk/test/utilities/memory/version.pass.cpp
    libcxx/trunk/test/utilities/meta/meta.hel/integral_constant.pass.cpp
    libcxx/trunk/test/utilities/meta/meta.rel/is_base_of.pass.cpp
    libcxx/trunk/test/utilities/meta/meta.rel/is_convertible.pass.cpp
    libcxx/trunk/test/utilities/meta/meta.rel/is_same.pass.cpp
    libcxx/trunk/test/utilities/meta/meta.rqmts/nothing_to_do.pass.cpp
    libcxx/trunk/test/utilities/meta/meta.trans/meta.trans.arr/remove_all_extents.pass.cpp
    libcxx/trunk/test/utilities/meta/meta.trans/meta.trans.arr/remove_extent.pass.cpp
    libcxx/trunk/test/utilities/meta/meta.trans/meta.trans.cv/add_const.pass.cpp
    libcxx/trunk/test/utilities/meta/meta.trans/meta.trans.cv/add_cv.pass.cpp
    libcxx/trunk/test/utilities/meta/meta.trans/meta.trans.cv/add_volatile.pass.cpp
    libcxx/trunk/test/utilities/meta/meta.trans/meta.trans.cv/remove_const.pass.cpp
    libcxx/trunk/test/utilities/meta/meta.trans/meta.trans.cv/remove_cv.pass.cpp
    libcxx/trunk/test/utilities/meta/meta.trans/meta.trans.cv/remove_volatile.pass.cpp
    libcxx/trunk/test/utilities/meta/meta.trans/meta.trans.other/aligned_storage.pass.cpp
    libcxx/trunk/test/utilities/meta/meta.trans/meta.trans.other/common_type.pass.cpp
    libcxx/trunk/test/utilities/meta/meta.trans/meta.trans.other/conditional.pass.cpp
    libcxx/trunk/test/utilities/meta/meta.trans/meta.trans.other/decay.pass.cpp
    libcxx/trunk/test/utilities/meta/meta.trans/meta.trans.other/enable_if.fail.cpp
    libcxx/trunk/test/utilities/meta/meta.trans/meta.trans.other/enable_if.pass.cpp
    libcxx/trunk/test/utilities/meta/meta.trans/meta.trans.other/result_of.pass.cpp
    libcxx/trunk/test/utilities/meta/meta.trans/meta.trans.other/underlying_type.pass.cpp
    libcxx/trunk/test/utilities/meta/meta.trans/meta.trans.ptr/add_pointer.pass.cpp
    libcxx/trunk/test/utilities/meta/meta.trans/meta.trans.ptr/remove_pointer.pass.cpp
    libcxx/trunk/test/utilities/meta/meta.trans/meta.trans.ref/add_lvalue_ref.pass.cpp
    libcxx/trunk/test/utilities/meta/meta.trans/meta.trans.ref/add_rvalue_ref.pass.cpp
    libcxx/trunk/test/utilities/meta/meta.trans/meta.trans.ref/remove_ref.pass.cpp
    libcxx/trunk/test/utilities/meta/meta.trans/meta.trans.sign/make_signed.pass.cpp
    libcxx/trunk/test/utilities/meta/meta.trans/meta.trans.sign/make_unsigned.pass.cpp
    libcxx/trunk/test/utilities/meta/meta.trans/nothing_to_do.pass.cpp
    libcxx/trunk/test/utilities/meta/meta.type.synop/nothing_to_do.pass.cpp
    libcxx/trunk/test/utilities/meta/meta.unary/meta.unary.cat/array.pass.cpp
    libcxx/trunk/test/utilities/meta/meta.unary/meta.unary.cat/class.pass.cpp
    libcxx/trunk/test/utilities/meta/meta.unary/meta.unary.cat/enum.pass.cpp
    libcxx/trunk/test/utilities/meta/meta.unary/meta.unary.cat/floating_point.pass.cpp
    libcxx/trunk/test/utilities/meta/meta.unary/meta.unary.cat/function.pass.cpp
    libcxx/trunk/test/utilities/meta/meta.unary/meta.unary.cat/integral.pass.cpp
    libcxx/trunk/test/utilities/meta/meta.unary/meta.unary.cat/lvalue_ref.pass.cpp
    libcxx/trunk/test/utilities/meta/meta.unary/meta.unary.cat/member_function_pointer.pass.cpp
    libcxx/trunk/test/utilities/meta/meta.unary/meta.unary.cat/member_object_pointer.pass.cpp
    libcxx/trunk/test/utilities/meta/meta.unary/meta.unary.cat/pointer.pass.cpp
    libcxx/trunk/test/utilities/meta/meta.unary/meta.unary.cat/rvalue_ref.pass.cpp
    libcxx/trunk/test/utilities/meta/meta.unary/meta.unary.cat/union.pass.cpp
    libcxx/trunk/test/utilities/meta/meta.unary/meta.unary.cat/void.pass.cpp
    libcxx/trunk/test/utilities/meta/meta.unary/meta.unary.comp/array.pass.cpp
    libcxx/trunk/test/utilities/meta/meta.unary/meta.unary.comp/class.pass.cpp
    libcxx/trunk/test/utilities/meta/meta.unary/meta.unary.comp/enum.pass.cpp
    libcxx/trunk/test/utilities/meta/meta.unary/meta.unary.comp/floating_point.pass.cpp
    libcxx/trunk/test/utilities/meta/meta.unary/meta.unary.comp/function.pass.cpp
    libcxx/trunk/test/utilities/meta/meta.unary/meta.unary.comp/integral.pass.cpp
    libcxx/trunk/test/utilities/meta/meta.unary/meta.unary.comp/lvalue_ref.pass.cpp
    libcxx/trunk/test/utilities/meta/meta.unary/meta.unary.comp/member_function_pointer.pass.cpp
    libcxx/trunk/test/utilities/meta/meta.unary/meta.unary.comp/member_object_pointer.pass.cpp
    libcxx/trunk/test/utilities/meta/meta.unary/meta.unary.comp/pointer.pass.cpp
    libcxx/trunk/test/utilities/meta/meta.unary/meta.unary.comp/rvalue_ref.pass.cpp
    libcxx/trunk/test/utilities/meta/meta.unary/meta.unary.comp/union.pass.cpp
    libcxx/trunk/test/utilities/meta/meta.unary/meta.unary.comp/void.pass.cpp
    libcxx/trunk/test/utilities/meta/meta.unary/meta.unary.prop/alignment_of.pass.cpp
    libcxx/trunk/test/utilities/meta/meta.unary/meta.unary.prop/extent.pass.cpp
    libcxx/trunk/test/utilities/meta/meta.unary/meta.unary.prop/has_nothrow_copy_assign.pass.cpp
    libcxx/trunk/test/utilities/meta/meta.unary/meta.unary.prop/has_nothrow_copy_constructor.pass.cpp
    libcxx/trunk/test/utilities/meta/meta.unary/meta.unary.prop/has_nothrow_default_constructor.pass.cpp
    libcxx/trunk/test/utilities/meta/meta.unary/meta.unary.prop/has_trivial_copy_assign.pass.cpp
    libcxx/trunk/test/utilities/meta/meta.unary/meta.unary.prop/has_trivial_copy_constructor.pass.cpp
    libcxx/trunk/test/utilities/meta/meta.unary/meta.unary.prop/has_trivial_default_constructor.pass.cpp
    libcxx/trunk/test/utilities/meta/meta.unary/meta.unary.prop/has_trivial_destructor.pass.cpp
    libcxx/trunk/test/utilities/meta/meta.unary/meta.unary.prop/has_virtual_destructor.pass.cpp
    libcxx/trunk/test/utilities/meta/meta.unary/meta.unary.prop/is_abstract.pass.cpp
    libcxx/trunk/test/utilities/meta/meta.unary/meta.unary.prop/is_const.pass.cpp
    libcxx/trunk/test/utilities/meta/meta.unary/meta.unary.prop/is_constructible.pass.cpp
    libcxx/trunk/test/utilities/meta/meta.unary/meta.unary.prop/is_empty.pass.cpp
    libcxx/trunk/test/utilities/meta/meta.unary/meta.unary.prop/is_literal_type.pass.cpp
    libcxx/trunk/test/utilities/meta/meta.unary/meta.unary.prop/is_nothrow_constructible.pass.cpp
    libcxx/trunk/test/utilities/meta/meta.unary/meta.unary.prop/is_pod.pass.cpp
    libcxx/trunk/test/utilities/meta/meta.unary/meta.unary.prop/is_polymorphic.pass.cpp
    libcxx/trunk/test/utilities/meta/meta.unary/meta.unary.prop/is_signed.pass.cpp
    libcxx/trunk/test/utilities/meta/meta.unary/meta.unary.prop/is_standard_layout.pass.cpp
    libcxx/trunk/test/utilities/meta/meta.unary/meta.unary.prop/is_trivial.pass.cpp
    libcxx/trunk/test/utilities/meta/meta.unary/meta.unary.prop/is_trivialially_copyable.pass.cpp
    libcxx/trunk/test/utilities/meta/meta.unary/meta.unary.prop/is_unsigned.pass.cpp
    libcxx/trunk/test/utilities/meta/meta.unary/meta.unary.prop/is_volatile.pass.cpp
    libcxx/trunk/test/utilities/meta/meta.unary/meta.unary.prop/rank.pass.cpp
    libcxx/trunk/test/utilities/meta/meta.unary/nothing_to_do.pass.cpp
    libcxx/trunk/test/utilities/meta/version.pass.cpp
    libcxx/trunk/test/utilities/nothing_to_do.pass.cpp
    libcxx/trunk/test/utilities/ratio/ratio.arithmetic/ratio_add.fail.cpp
    libcxx/trunk/test/utilities/ratio/ratio.arithmetic/ratio_add.pass.cpp
    libcxx/trunk/test/utilities/ratio/ratio.arithmetic/ratio_divide.fail.cpp
    libcxx/trunk/test/utilities/ratio/ratio.arithmetic/ratio_divide.pass.cpp
    libcxx/trunk/test/utilities/ratio/ratio.arithmetic/ratio_multiply.fail.cpp
    libcxx/trunk/test/utilities/ratio/ratio.arithmetic/ratio_multiply.pass.cpp
    libcxx/trunk/test/utilities/ratio/ratio.arithmetic/ratio_subtract.fail.cpp
    libcxx/trunk/test/utilities/ratio/ratio.arithmetic/ratio_subtract.pass.cpp
    libcxx/trunk/test/utilities/ratio/ratio.comparison/ratio_equal.pass.cpp
    libcxx/trunk/test/utilities/ratio/ratio.comparison/ratio_greater.pass.cpp
    libcxx/trunk/test/utilities/ratio/ratio.comparison/ratio_greater_equal.pass.cpp
    libcxx/trunk/test/utilities/ratio/ratio.comparison/ratio_less.pass.cpp
    libcxx/trunk/test/utilities/ratio/ratio.comparison/ratio_less_equal.pass.cpp
    libcxx/trunk/test/utilities/ratio/ratio.comparison/ratio_not_equal.pass.cpp
    libcxx/trunk/test/utilities/ratio/ratio.ratio/ratio.pass.cpp
    libcxx/trunk/test/utilities/ratio/ratio.ratio/ratio1.fail.cpp
    libcxx/trunk/test/utilities/ratio/ratio.ratio/ratio2.fail.cpp
    libcxx/trunk/test/utilities/ratio/ratio.ratio/ratio3.fail.cpp
    libcxx/trunk/test/utilities/ratio/ratio.si/nothing_to_do.pass.cpp
    libcxx/trunk/test/utilities/ratio/typedefs.pass.cpp
    libcxx/trunk/test/utilities/ratio/version.pass.cpp
    libcxx/trunk/test/utilities/template.bitset/bitset.cons/char_ptr_ctor.pass.cpp
    libcxx/trunk/test/utilities/template.bitset/bitset.cons/default.pass.cpp
    libcxx/trunk/test/utilities/template.bitset/bitset.cons/string_ctor.pass.cpp
    libcxx/trunk/test/utilities/template.bitset/bitset.cons/ull_ctor.pass.cpp
    libcxx/trunk/test/utilities/template.bitset/bitset.members/all.pass.cpp
    libcxx/trunk/test/utilities/template.bitset/bitset.members/any.pass.cpp
    libcxx/trunk/test/utilities/template.bitset/bitset.members/count.pass.cpp
    libcxx/trunk/test/utilities/template.bitset/bitset.members/flip_all.pass.cpp
    libcxx/trunk/test/utilities/template.bitset/bitset.members/flip_one.pass.cpp
    libcxx/trunk/test/utilities/template.bitset/bitset.members/index.pass.cpp
    libcxx/trunk/test/utilities/template.bitset/bitset.members/index_const.pass.cpp
    libcxx/trunk/test/utilities/template.bitset/bitset.members/left_shift.pass.cpp
    libcxx/trunk/test/utilities/template.bitset/bitset.members/left_shift_eq.pass.cpp
    libcxx/trunk/test/utilities/template.bitset/bitset.members/none.pass.cpp
    libcxx/trunk/test/utilities/template.bitset/bitset.members/not_all.pass.cpp
    libcxx/trunk/test/utilities/template.bitset/bitset.members/op_and_eq.pass.cpp
    libcxx/trunk/test/utilities/template.bitset/bitset.members/op_eq_eq.pass.cpp
    libcxx/trunk/test/utilities/template.bitset/bitset.members/op_or_eq.pass.cpp
    libcxx/trunk/test/utilities/template.bitset/bitset.members/op_xor_eq.pass.cpp
    libcxx/trunk/test/utilities/template.bitset/bitset.members/reset_all.pass.cpp
    libcxx/trunk/test/utilities/template.bitset/bitset.members/reset_one.pass.cpp
    libcxx/trunk/test/utilities/template.bitset/bitset.members/right_shift.pass.cpp
    libcxx/trunk/test/utilities/template.bitset/bitset.members/right_shift_eq.pass.cpp
    libcxx/trunk/test/utilities/template.bitset/bitset.members/set_all.pass.cpp
    libcxx/trunk/test/utilities/template.bitset/bitset.members/set_one.pass.cpp
    libcxx/trunk/test/utilities/template.bitset/bitset.members/size.pass.cpp
    libcxx/trunk/test/utilities/template.bitset/bitset.members/test.pass.cpp
    libcxx/trunk/test/utilities/template.bitset/bitset.members/to_string.pass.cpp
    libcxx/trunk/test/utilities/template.bitset/bitset.members/to_ullong.pass.cpp
    libcxx/trunk/test/utilities/template.bitset/bitset.members/to_ulong.pass.cpp
    libcxx/trunk/test/utilities/template.bitset/bitset.operators/op_and.pass.cpp
    libcxx/trunk/test/utilities/template.bitset/bitset.operators/op_not.pass.cpp
    libcxx/trunk/test/utilities/template.bitset/bitset.operators/op_or.pass.cpp
    libcxx/trunk/test/utilities/template.bitset/bitset.operators/stream_in.pass.cpp
    libcxx/trunk/test/utilities/template.bitset/bitset.operators/stream_out.pass.cpp
    libcxx/trunk/test/utilities/template.bitset/includes.pass.cpp
    libcxx/trunk/test/utilities/template.bitset/version.pass.cpp
    libcxx/trunk/test/utilities/time/clock.h
    libcxx/trunk/test/utilities/time/hours.pass.cpp
    libcxx/trunk/test/utilities/time/microseconds.pass.cpp
    libcxx/trunk/test/utilities/time/milliseconds.pass.cpp
    libcxx/trunk/test/utilities/time/minutes.pass.cpp
    libcxx/trunk/test/utilities/time/nanoseconds.pass.cpp
    libcxx/trunk/test/utilities/time/rep.h
    libcxx/trunk/test/utilities/time/seconds.pass.cpp
    libcxx/trunk/test/utilities/time/time.clock.req/nothing_to_do.pass.cpp
    libcxx/trunk/test/utilities/time/time.clock/nothing_to_do.pass.cpp
    libcxx/trunk/test/utilities/time/time.clock/time.clock.hires/consistency.pass.cpp
    libcxx/trunk/test/utilities/time/time.clock/time.clock.hires/now.pass.cpp
    libcxx/trunk/test/utilities/time/time.clock/time.clock.monotonic/consistency.pass.cpp
    libcxx/trunk/test/utilities/time/time.clock/time.clock.monotonic/now.pass.cpp
    libcxx/trunk/test/utilities/time/time.clock/time.clock.system/consistency.pass.cpp
    libcxx/trunk/test/utilities/time/time.clock/time.clock.system/from_time_t.pass.cpp
    libcxx/trunk/test/utilities/time/time.clock/time.clock.system/now.pass.cpp
    libcxx/trunk/test/utilities/time/time.clock/time.clock.system/rep_signed.pass.cpp
    libcxx/trunk/test/utilities/time/time.clock/time.clock.system/to_time_t.pass.cpp
    libcxx/trunk/test/utilities/time/time.duration/default_ratio.pass.cpp
    libcxx/trunk/test/utilities/time/time.duration/duration.fail.cpp
    libcxx/trunk/test/utilities/time/time.duration/positive_num.fail.cpp
    libcxx/trunk/test/utilities/time/time.duration/ratio.fail.cpp
    libcxx/trunk/test/utilities/time/time.duration/time.duration.arithmetic/op_++.pass.cpp
    libcxx/trunk/test/utilities/time/time.duration/time.duration.arithmetic/op_++int.pass.cpp
    libcxx/trunk/test/utilities/time/time.duration/time.duration.arithmetic/op_+.pass.cpp
    libcxx/trunk/test/utilities/time/time.duration/time.duration.arithmetic/op_+=.pass.cpp
    libcxx/trunk/test/utilities/time/time.duration/time.duration.arithmetic/op_--.pass.cpp
    libcxx/trunk/test/utilities/time/time.duration/time.duration.arithmetic/op_--int.pass.cpp
    libcxx/trunk/test/utilities/time/time.duration/time.duration.arithmetic/op_-.pass.cpp
    libcxx/trunk/test/utilities/time/time.duration/time.duration.arithmetic/op_-=.pass.cpp
    libcxx/trunk/test/utilities/time/time.duration/time.duration.arithmetic/op_divide=.pass.cpp
    libcxx/trunk/test/utilities/time/time.duration/time.duration.arithmetic/op_mod=duration.pass.cpp
    libcxx/trunk/test/utilities/time/time.duration/time.duration.arithmetic/op_mod=rep.pass.cpp
    libcxx/trunk/test/utilities/time/time.duration/time.duration.arithmetic/op_times=.pass.cpp
    libcxx/trunk/test/utilities/time/time.duration/time.duration.cast/duration_cast.pass.cpp
    libcxx/trunk/test/utilities/time/time.duration/time.duration.cast/toduration.fail.cpp
    libcxx/trunk/test/utilities/time/time.duration/time.duration.comparisons/op_equal.pass.cpp
    libcxx/trunk/test/utilities/time/time.duration/time.duration.comparisons/op_less.pass.cpp
    libcxx/trunk/test/utilities/time/time.duration/time.duration.cons/convert_exact.pass.cpp
    libcxx/trunk/test/utilities/time/time.duration/time.duration.cons/convert_float_to_int.fail.cpp
    libcxx/trunk/test/utilities/time/time.duration/time.duration.cons/convert_inexact.fail.cpp
    libcxx/trunk/test/utilities/time/time.duration/time.duration.cons/convert_inexact.pass.cpp
    libcxx/trunk/test/utilities/time/time.duration/time.duration.cons/convert_int_to_float.pass.cpp
    libcxx/trunk/test/utilities/time/time.duration/time.duration.cons/default.pass.cpp
    libcxx/trunk/test/utilities/time/time.duration/time.duration.cons/rep.pass.cpp
    libcxx/trunk/test/utilities/time/time.duration/time.duration.cons/rep01.fail.cpp
    libcxx/trunk/test/utilities/time/time.duration/time.duration.cons/rep02.fail.cpp
    libcxx/trunk/test/utilities/time/time.duration/time.duration.cons/rep02.pass.cpp
    libcxx/trunk/test/utilities/time/time.duration/time.duration.cons/rep03.fail.cpp
    libcxx/trunk/test/utilities/time/time.duration/time.duration.nonmember/op_+.pass.cpp
    libcxx/trunk/test/utilities/time/time.duration/time.duration.nonmember/op_-.pass.cpp
    libcxx/trunk/test/utilities/time/time.duration/time.duration.nonmember/op_divide_duration.pass.cpp
    libcxx/trunk/test/utilities/time/time.duration/time.duration.nonmember/op_divide_rep.fail.cpp
    libcxx/trunk/test/utilities/time/time.duration/time.duration.nonmember/op_divide_rep.pass.cpp
    libcxx/trunk/test/utilities/time/time.duration/time.duration.nonmember/op_mod_duration.pass.cpp
    libcxx/trunk/test/utilities/time/time.duration/time.duration.nonmember/op_mod_rep.fail.cpp
    libcxx/trunk/test/utilities/time/time.duration/time.duration.nonmember/op_times_rep.pass.cpp
    libcxx/trunk/test/utilities/time/time.duration/time.duration.nonmember/op_times_rep1.fail.cpp
    libcxx/trunk/test/utilities/time/time.duration/time.duration.nonmember/op_times_rep2.fail.cpp
    libcxx/trunk/test/utilities/time/time.duration/types.pass.cpp
    libcxx/trunk/test/utilities/time/time.point/default_duration.pass.cpp
    libcxx/trunk/test/utilities/time/time.point/time.point.cast/time_point_cast.pass.cpp
    libcxx/trunk/test/utilities/time/time.point/time.point.cast/toduration.fail.cpp
    libcxx/trunk/test/utilities/time/time.point/time.point.comparisons/op_equal.fail.cpp
    libcxx/trunk/test/utilities/time/time.point/time.point.comparisons/op_equal.pass.cpp
    libcxx/trunk/test/utilities/time/time.point/time.point.comparisons/op_less.fail.cpp
    libcxx/trunk/test/utilities/time/time.point/time.point.comparisons/op_less.pass.cpp
    libcxx/trunk/test/utilities/time/time.point/time.point.cons/convert.fail.cpp
    libcxx/trunk/test/utilities/time/time.point/time.point.cons/convert.pass.cpp
    libcxx/trunk/test/utilities/time/time.point/time.point.nonmember/op_+.pass.cpp
    libcxx/trunk/test/utilities/time/time.point/time.point.nonmember/op_-duration.pass.cpp
    libcxx/trunk/test/utilities/time/time.point/time.point.nonmember/op_-time_point.pass.cpp
    libcxx/trunk/test/utilities/time/time.traits/time.traits.specializations/duration.pass.cpp
    libcxx/trunk/test/utilities/time/time.traits/time.traits.specializations/time_point.pass.cpp
    libcxx/trunk/test/utilities/tuple/tuple.tuple/DefaultOnly.h
    libcxx/trunk/test/utilities/tuple/tuple.tuple/MoveOnly.h
    libcxx/trunk/test/utilities/tuple/tuple.tuple/alloc_first.h
    libcxx/trunk/test/utilities/tuple/tuple.tuple/alloc_last.h
    libcxx/trunk/test/utilities/tuple/tuple.tuple/allocators.h
    libcxx/trunk/test/utilities/tuple/tuple.tuple/tuple.assign/move_pair.pass.cpp
    libcxx/trunk/test/utilities/tuple/tuple.tuple/tuple.cnstr/alloc_UTypes.pass.cpp
    libcxx/trunk/test/utilities/tuple/tuple.tuple/tuple.cnstr/alloc_move_pair.pass.cpp
    libcxx/trunk/test/utilities/tuple/tuple.tuple/tuple.cnstr/move_pair.pass.cpp
    libcxx/trunk/test/utilities/tuple/tuple.tuple/tuple.creation/forward_as_tuple.pass.cpp
    libcxx/trunk/test/utilities/utility/forward/forward.pass.cpp
    libcxx/trunk/test/utilities/utility/forward/move_copy.pass.cpp
    libcxx/trunk/test/utilities/utility/forward/move_if_noexcept.pass.cpp
    libcxx/trunk/test/utilities/utility/forward/move_only.pass.cpp
    libcxx/trunk/test/utilities/utility/forward/move_only1.fail.cpp
    libcxx/trunk/test/utilities/utility/forward/move_only2.fail.cpp
    libcxx/trunk/test/utilities/utility/forward/move_only3.fail.cpp
    libcxx/trunk/test/utilities/utility/forward/move_only4.fail.cpp
    libcxx/trunk/test/utilities/utility/pairs/pairs.pair/U_V.pass.cpp
    libcxx/trunk/test/utilities/utility/pairs/pairs.pair/assign_rv_pair.pass.cpp
    libcxx/trunk/test/utilities/utility/pairs/pairs.pair/assign_rv_pair_U_V.pass.cpp
    libcxx/trunk/test/utilities/utility/pairs/pairs.pair/make_pair.pass.cpp
    libcxx/trunk/test/utilities/utility/pairs/pairs.pair/piecewise.pass.cpp
    libcxx/trunk/test/utilities/utility/pairs/pairs.pair/rv_pair_U_V.pass.cpp
    libcxx/trunk/test/utilities/utility/pairs/pairs.pair/types.pass.cpp
    libcxx/trunk/test/utilities/utility/utility.swap/swap.pass.cpp
    libcxx/trunk/test/utilities/utility/utility.swap/swap_array.pass.cpp

Modified: libcxx/trunk/test/utilities/date.time/tested_elsewhere.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/date.time/tested_elsewhere.pass.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/date.time/tested_elsewhere.pass.cpp (original)
+++ libcxx/trunk/test/utilities/date.time/tested_elsewhere.pass.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,37 @@
-//===----------------------------------------------------------------------===//
//
//                     The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//

#include <ctime>
#include <type_traits>

#ifndef NULL
#error NULL not defined
#endif

#ifndef CLOCKS_PER_SEC
#error CLOCKS_PER_SEC not defined
#endif

int main()
{
    std::clock_t c = 0;
    std::size_t s = 0;
    std::time_t t = 0;
    std::tm tm = {0};
    char str[3];
    static_assert((std::is_same<decltype(std::clock()), std::clock_t>::value), "");
    static_assert((std::is_same<decltype(std::difftime(t,t)), double>::value), "");
    static_assert((std::is_same<decltype(std::mktime(&tm)), std::time_t>::value), "");
    static_assert((std::is_same<decltype(std::time(&t)), std::time_t>::value), "");
    static_assert((std::is_same<dec
 ltype(std::asctime(&tm)), char*>::value), "");
    static_assert((std::is_same<decltype(std::ctime(&t)), char*>::value), "");
    static_assert((std::is_same<decltype(std::gmtime(&t)), std::tm*>::value), "");
    static_assert((std::is_same<decltype(std::localtime(&t)), std::tm*>::value), "");
    static_assert((std::is_same<decltype(std::strftime(str,s,"",&tm)), std::size_t>::value), "");
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#include <ctime>
+#include <type_traits>
+
+#ifndef NULL
+#error NULL not defined
+#endif
+
+#ifndef CLOCKS_PER_SEC
+#error CLOCKS_PER_SEC not defined
+#endif
+
+int main()
+{
+    std::clock_t c = 0;
+    std::size_t s = 0;
+    std::time_t t = 0;
+    std::tm tm = {0};
+    char str[3];
+    static_assert((std::is_same<decltype(std::clock()), std::clock_t>::value), "");
+    static_assert((std::is_same<decltype(std::difftime(t,t)), double>::value), "");
+    static_assert((std::is_same<decltype(std::mktime(&tm)), std::time_t>::value), "");
+    static_assert((std::is_same<decltype(std::time(&t)), std::time_t>::value), "");
+    static_assert((std::is_same<decltype(std::asctime(&tm)), char*>::value), "");
+    static_assert((std::is_same<decltype(std::ctime(&t)), char*>::value), "");
+    static_assert((std::is_same<decltype(std::gmtime(&t)), std::tm*>::value), "");
+    static_assert((std::is_same<decltype(std::localtime(&t)), std::tm*>::value), "");
+    static_assert((std::is_same<decltype(std::strftime(str,s,"",&tm)), std::size_t>::value), "");
+}

Modified: libcxx/trunk/test/utilities/function.objects/arithmetic.operations/divides.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/function.objects/arithmetic.operations/divides.pass.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/function.objects/arithmetic.operations/divides.pass.cpp (original)
+++ libcxx/trunk/test/utilities/function.objects/arithmetic.operations/divides.pass.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,24 @@
-//===----------------------------------------------------------------------===//
//
//                     The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//

// <functional>

// divides

#include <functional>
#include <type_traits>
#include <cassert>

int main()
{
    typedef std::divides<int> F;
    const F f = F();
    static_assert((std::is_base_of<std::binary_function<int, int, int>, F>::value), "");
    assert(f(36, 4) == 9);
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <functional>
+
+// divides
+
+#include <functional>
+#include <type_traits>
+#include <cassert>
+
+int main()
+{
+    typedef std::divides<int> F;
+    const F f = F();
+    static_assert((std::is_base_of<std::binary_function<int, int, int>, F>::value), "");
+    assert(f(36, 4) == 9);
+}

Modified: libcxx/trunk/test/utilities/function.objects/arithmetic.operations/minus.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/function.objects/arithmetic.operations/minus.pass.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/function.objects/arithmetic.operations/minus.pass.cpp (original)
+++ libcxx/trunk/test/utilities/function.objects/arithmetic.operations/minus.pass.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,24 @@
-//===----------------------------------------------------------------------===//
//
//                     The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//

// <functional>

// minus

#include <functional>
#include <type_traits>
#include <cassert>

int main()
{
    typedef std::minus<int> F;
    const F f = F();
    static_assert((std::is_base_of<std::binary_function<int, int, int>, F>::value), "");
    assert(f(3, 2) == 1);
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <functional>
+
+// minus
+
+#include <functional>
+#include <type_traits>
+#include <cassert>
+
+int main()
+{
+    typedef std::minus<int> F;
+    const F f = F();
+    static_assert((std::is_base_of<std::binary_function<int, int, int>, F>::value), "");
+    assert(f(3, 2) == 1);
+}

Modified: libcxx/trunk/test/utilities/function.objects/arithmetic.operations/modulus.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/function.objects/arithmetic.operations/modulus.pass.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/function.objects/arithmetic.operations/modulus.pass.cpp (original)
+++ libcxx/trunk/test/utilities/function.objects/arithmetic.operations/modulus.pass.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,24 @@
-//===----------------------------------------------------------------------===//
//
//                     The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//

// <functional>

// modulus

#include <functional>
#include <type_traits>
#include <cassert>

int main()
{
    typedef std::modulus<int> F;
    const F f = F();
    static_assert((std::is_base_of<std::binary_function<int, int, int>, F>::value), "");
    assert(f(36, 8) == 4);
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <functional>
+
+// modulus
+
+#include <functional>
+#include <type_traits>
+#include <cassert>
+
+int main()
+{
+    typedef std::modulus<int> F;
+    const F f = F();
+    static_assert((std::is_base_of<std::binary_function<int, int, int>, F>::value), "");
+    assert(f(36, 8) == 4);
+}

Modified: libcxx/trunk/test/utilities/function.objects/arithmetic.operations/multiplies.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/function.objects/arithmetic.operations/multiplies.pass.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/function.objects/arithmetic.operations/multiplies.pass.cpp (original)
+++ libcxx/trunk/test/utilities/function.objects/arithmetic.operations/multiplies.pass.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,24 @@
-//===----------------------------------------------------------------------===//
//
//                     The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//

// <functional>

// multiplies

#include <functional>
#include <type_traits>
#include <cassert>

int main()
{
    typedef std::multiplies<int> F;
    const F f = F();
    static_assert((std::is_base_of<std::binary_function<int, int, int>, F>::value), "");
    assert(f(3, 2) == 6);
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <functional>
+
+// multiplies
+
+#include <functional>
+#include <type_traits>
+#include <cassert>
+
+int main()
+{
+    typedef std::multiplies<int> F;
+    const F f = F();
+    static_assert((std::is_base_of<std::binary_function<int, int, int>, F>::value), "");
+    assert(f(3, 2) == 6);
+}

Modified: libcxx/trunk/test/utilities/function.objects/arithmetic.operations/negate.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/function.objects/arithmetic.operations/negate.pass.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/function.objects/arithmetic.operations/negate.pass.cpp (original)
+++ libcxx/trunk/test/utilities/function.objects/arithmetic.operations/negate.pass.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,24 @@
-//===----------------------------------------------------------------------===//
//
//                     The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//

// <functional>

// negate

#include <functional>
#include <type_traits>
#include <cassert>

int main()
{
    typedef std::negate<int> F;
    const F f = F();
    static_assert((std::is_base_of<std::unary_function<int, int>, F>::value), "");
    assert(f(36) == -36);
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <functional>
+
+// negate
+
+#include <functional>
+#include <type_traits>
+#include <cassert>
+
+int main()
+{
+    typedef std::negate<int> F;
+    const F f = F();
+    static_assert((std::is_base_of<std::unary_function<int, int>, F>::value), "");
+    assert(f(36) == -36);
+}

Modified: libcxx/trunk/test/utilities/function.objects/arithmetic.operations/plus.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/function.objects/arithmetic.operations/plus.pass.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/function.objects/arithmetic.operations/plus.pass.cpp (original)
+++ libcxx/trunk/test/utilities/function.objects/arithmetic.operations/plus.pass.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,24 @@
-//===----------------------------------------------------------------------===//
//
//                     The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//

// <functional>

// plus

#include <functional>
#include <type_traits>
#include <cassert>

int main()
{
    typedef std::plus<int> F;
    const F f = F();
    static_assert((std::is_base_of<std::binary_function<int, int, int>, F>::value), "");
    assert(f(3, 2) == 5);
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <functional>
+
+// plus
+
+#include <functional>
+#include <type_traits>
+#include <cassert>
+
+int main()
+{
+    typedef std::plus<int> F;
+    const F f = F();
+    static_assert((std::is_base_of<std::binary_function<int, int, int>, F>::value), "");
+    assert(f(3, 2) == 5);
+}

Modified: libcxx/trunk/test/utilities/function.objects/base/nothing_to_do.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/function.objects/base/nothing_to_do.pass.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/function.objects/base/nothing_to_do.pass.cpp (original)
+++ libcxx/trunk/test/utilities/function.objects/base/nothing_to_do.pass.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,12 @@
-//===----------------------------------------------------------------------===//
//
//                     The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//

int main()
{
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+int main()
+{
+}

Modified: libcxx/trunk/test/utilities/function.objects/bind/func.bind/func.bind.bind/invoke_int_0.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/function.objects/bind/func.bind/func.bind.bind/invoke_int_0.pass.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/function.objects/bind/func.bind/func.bind.bind/invoke_int_0.pass.cpp (original)
+++ libcxx/trunk/test/utilities/function.objects/bind/func.bind/func.bind.bind/invoke_int_0.pass.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,53 @@
-//===----------------------------------------------------------------------===//
//
//                     The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//

// <functional>

// template<CopyConstructible Fn, CopyConstructible... Types> 
//   unspecified bind(Fn, Types...); 
// template<Returnable R, CopyConstructible Fn, CopyConstructible... Types> 
//   unspecified bind(Fn, Types...); 

#include <functional>
#include <cassert>

template <class R, class F>
void
test(F f, R expected)
{
    assert(f() == expected);
}

template <class R, class F>
void
test_const(const F& f, R expected)
{
    assert(f() == expected);
}

int f() {return 1;}

struct A_int_0
{
    int operator()() {return 4;}
    int operator()() const {return 5;}
};

int main()
{
    test(std::bind(f), 1);
    test(std::bind(&f), 1)
 ;
    test(std::bind(A_int_0()), 4);
    test_const(std::bind(A_int_0()), 5);

    test(std::bind<int>(f), 1);
    test(std::bind<int>(&f), 1);
    test(std::bind<int>(A_int_0()), 4);
    test_const(std::bind<int>(A_int_0()), 5);
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <functional>
+
+// template<CopyConstructible Fn, CopyConstructible... Types>
+//   unspecified bind(Fn, Types...);
+// template<Returnable R, CopyConstructible Fn, CopyConstructible... Types>
+//   unspecified bind(Fn, Types...);
+
+#include <functional>
+#include <cassert>
+
+template <class R, class F>
+void
+test(F f, R expected)
+{
+    assert(f() == expected);
+}
+
+template <class R, class F>
+void
+test_const(const F& f, R expected)
+{
+    assert(f() == expected);
+}
+
+int f() {return 1;}
+
+struct A_int_0
+{
+    int operator()() {return 4;}
+    int operator()() const {return 5;}
+};
+
+int main()
+{
+    test(std::bind(f), 1);
+    test(std::bind(&f), 1);
+    test(std::bind(A_int_0()), 4);
+    test_const(std::bind(A_int_0()), 5);
+
+    test(std::bind<int>(f), 1);
+    test(std::bind<int>(&f), 1);
+    test(std::bind<int>(A_int_0()), 4);
+    test_const(std::bind<int>(A_int_0()), 5);
+}

Modified: libcxx/trunk/test/utilities/function.objects/bind/func.bind/func.bind.bind/invoke_lvalue.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/function.objects/bind/func.bind/func.bind.bind/invoke_lvalue.pass.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/function.objects/bind/func.bind/func.bind.bind/invoke_lvalue.pass.cpp (original)
+++ libcxx/trunk/test/utilities/function.objects/bind/func.bind/func.bind.bind/invoke_lvalue.pass.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,267 @@
-//===----------------------------------------------------------------------===//
//
//                     The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//

// <functional>

// template<CopyConstructible Fn, CopyConstructible... Types> 
//   unspecified bind(Fn, Types...); 
// template<Returnable R, CopyConstructible Fn, CopyConstructible... Types> 
//   unspecified bind(Fn, Types...); 

#include <stdio.h>

#include <functional>
#include <cassert>

int count = 0;

// 1 arg, return void

void f_void_1(int i)
{
    count += i;
}

struct A_void_1
{
    void operator()(int i)
    {
        count += i;
    }

    void mem1() {++count;}
    void mem2() const {count += 2;}
};

void
test_void_1()
{
    using namespace std::placeholders;
    int save_count = count;
    // function
    {
    int i = 2;
     std::bind(f_void_1, _1)(i);
    assert(count == save_count + 2);
    save_count = count;
    }
    {
    int i = 2;
    std::bind(f_void_1, i)();
    assert(count == save_count + 2);
    save_count = count;
    }
    // function pointer
    {
    void (*fp)(int) = f_void_1;
    int i = 3;
    std::bind(fp, _1)(i);
    assert(count == save_count+3);
    save_count = count;
    }
    {
    void (*fp)(int) = f_void_1;
    int i = 3;
    std::bind(fp, i)();
    assert(count == save_count+3);
    save_count = count;
    }
    // functor
    {
    A_void_1 a0;
    int i = 4;
    std::bind(a0, _1)(i);
    assert(count == save_count+4);
    save_count = count;
    }
    {
    A_void_1 a0;
    int i = 4;
    std::bind(a0, i)();
    assert(count == save_count+4);
    save_count = count;
    }
    // member function pointer
    {
    void (A_void_1::*fp)() = &A_void_1::mem1;
    A_void_1 a;
    std::bind(fp, _1)(a);
    assert(count == save_count+1);
    save_count = count;
    A_v
 oid_1* ap = &a;
    std::bind(fp, _1)(ap);
    assert(count == save_count+1);
    save_count = count;
    }
    {
    void (A_void_1::*fp)() = &A_void_1::mem1;
    A_void_1 a;
    std::bind(fp, a)();
    assert(count == save_count+1);
    save_count = count;
    A_void_1* ap = &a;
    std::bind(fp, ap)();
    assert(count == save_count+1);
    save_count = count;
    }
    // const member function pointer
    {
    void (A_void_1::*fp)() const = &A_void_1::mem2;
    A_void_1 a;
    std::bind(fp, _1)(a);
    assert(count == save_count+2);
    save_count = count;
    A_void_1* ap = &a;
    std::bind(fp, _1)(ap);
    assert(count == save_count+2);
    save_count = count;
    }
    {
    void (A_void_1::*fp)() const = &A_void_1::mem2;
    A_void_1 a;
    std::bind(fp, a)();
    assert(count == save_count+2);
    save_count = count;
    A_void_1* ap = &a;
    std::bind(fp, ap)();
    assert(count == save_count+2);
    save_count = count;
    }
}

// 1 arg, return int

int f_int_1
 (int i)
{
    return i + 1;
}

struct A_int_1
{
    A_int_1() : data_(5) {}
    int operator()(int i)
    {
        return i - 1;
    }

    int mem1() {return 3;}
    int mem2() const {return 4;}
    int data_;
};

void
test_int_1()
{
    using namespace std::placeholders;
    // function
    {
    int i = 2;
    assert(std::bind(f_int_1, _1)(i) == 3);
    assert(std::bind(f_int_1, i)() == 3);
    }
    // function pointer
    {
    int (*fp)(int) = f_int_1;
    int i = 3;
    assert(std::bind(fp, _1)(i) == 4);
    assert(std::bind(fp, i)() == 4);
    }
    // functor
    {
    int i = 4;
    assert(std::bind(A_int_1(), _1)(i) == 3);
    assert(std::bind(A_int_1(), i)() == 3);
    }
    // member function pointer
    {
    A_int_1 a;
    assert(std::bind(&A_int_1::mem1, _1)(a) == 3);
    assert(std::bind(&A_int_1::mem1, a)() == 3);
    A_int_1* ap = &a;
    assert(std::bind(&A_int_1::mem1, _1)(ap) == 3);
    assert(std::bind(&A_int_1::mem1, ap)() == 3);
    }
    // const m
 ember function pointer
    {
    A_int_1 a;
    assert(std::bind(&A_int_1::mem2, _1)(A_int_1()) == 4);
    assert(std::bind(&A_int_1::mem2, A_int_1())() == 4);
    A_int_1* ap = &a;
    assert(std::bind(&A_int_1::mem2, _1)(ap) == 4);
    assert(std::bind(&A_int_1::mem2, ap)() == 4);
    }
    // member data pointer
    {
    A_int_1 a;
    assert(std::bind(&A_int_1::data_, _1)(a) == 5);
    assert(std::bind(&A_int_1::data_, a)() == 5);
    A_int_1* ap = &a;
    assert(std::bind(&A_int_1::data_, _1)(a) == 5);
    std::bind(&A_int_1::data_, _1)(a) = 6;
    assert(std::bind(&A_int_1::data_, _1)(a) == 6);
    assert(std::bind(&A_int_1::data_, _1)(ap) == 6);
    std::bind(&A_int_1::data_, _1)(ap) = 7;
    assert(std::bind(&A_int_1::data_, _1)(ap) == 7);
    }
}

// 2 arg, return void

void f_void_2(int i, int j)
{
    count += i+j;
}

struct A_void_2
{
    void operator()(int i, int j)
    {
        count += i+j;
    }

    void mem1(int i) {count += i;}
    void mem2(int i) cons
 t {count += i;}
};

void
test_void_2()
{
    using namespace std::placeholders;
    int save_count = count;
    // function
    {
    int i = 2;
    int j = 3;
    std::bind(f_void_2, _1, _2)(i, j);
    assert(count == save_count+5);
    save_count = count;
    std::bind(f_void_2, i, _1)(j);
    assert(count == save_count+5);
    save_count = count;
    std::bind(f_void_2, i, j)();
    assert(count == save_count+5);
    save_count = count;
    }
    // member function pointer
    {
    int j = 3;
    std::bind(&A_void_2::mem1, _1, _2)(A_void_2(), j);
    assert(count == save_count+3);
    save_count = count;
    std::bind(&A_void_2::mem1, _2, _1)(j, A_void_2());
    assert(count == save_count+3);
    save_count = count;
    }
}

int main()
{
    test_void_1();
    test_int_1();
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <functional>
+
+// template<CopyConstructible Fn, CopyConstructible... Types>
+//   unspecified bind(Fn, Types...);
+// template<Returnable R, CopyConstructible Fn, CopyConstructible... Types>
+//   unspecified bind(Fn, Types...);
+
+#include <stdio.h>
+
+#include <functional>
+#include <cassert>
+
+int count = 0;
+
+// 1 arg, return void
+
+void f_void_1(int i)
+{
+    count += i;
+}
+
+struct A_void_1
+{
+    void operator()(int i)
+    {
+        count += i;
+    }
+
+    void mem1() {++count;}
+    void mem2() const {count += 2;}
+};
+
+void
+test_void_1()
+{
+    using namespace std::placeholders;
+    int save_count = count;
+    // function
+    {
+    int i = 2;
+    std::bind(f_void_1, _1)(i);
+    assert(count == save_count + 2);
+    save_count = count;
+    }
+    {
+    int i = 2;
+    std::bind(f_void_1, i)();
+    assert(count == save_count + 2);
+    save_count = count;
+    }
+    // function pointer
+    {
+    void (*fp)(int) = f_void_1;
+    int i = 3;
+    std::bind(fp, _1)(i);
+    assert(count == save_count+3);
+    save_count = count;
+    }
+    {
+    void (*fp)(int) = f_void_1;
+    int i = 3;
+    std::bind(fp, i)();
+    assert(count == save_count+3);
+    save_count = count;
+    }
+    // functor
+    {
+    A_void_1 a0;
+    int i = 4;
+    std::bind(a0, _1)(i);
+    assert(count == save_count+4);
+    save_count = count;
+    }
+    {
+    A_void_1 a0;
+    int i = 4;
+    std::bind(a0, i)();
+    assert(count == save_count+4);
+    save_count = count;
+    }
+    // member function pointer
+    {
+    void (A_void_1::*fp)() = &A_void_1::mem1;
+    A_void_1 a;
+    std::bind(fp, _1)(a);
+    assert(count == save_count+1);
+    save_count = count;
+    A_void_1* ap = &a;
+    std::bind(fp, _1)(ap);
+    assert(count == save_count+1);
+    save_count = count;
+    }
+    {
+    void (A_void_1::*fp)() = &A_void_1::mem1;
+    A_void_1 a;
+    std::bind(fp, a)();
+    assert(count == save_count+1);
+    save_count = count;
+    A_void_1* ap = &a;
+    std::bind(fp, ap)();
+    assert(count == save_count+1);
+    save_count = count;
+    }
+    // const member function pointer
+    {
+    void (A_void_1::*fp)() const = &A_void_1::mem2;
+    A_void_1 a;
+    std::bind(fp, _1)(a);
+    assert(count == save_count+2);
+    save_count = count;
+    A_void_1* ap = &a;
+    std::bind(fp, _1)(ap);
+    assert(count == save_count+2);
+    save_count = count;
+    }
+    {
+    void (A_void_1::*fp)() const = &A_void_1::mem2;
+    A_void_1 a;
+    std::bind(fp, a)();
+    assert(count == save_count+2);
+    save_count = count;
+    A_void_1* ap = &a;
+    std::bind(fp, ap)();
+    assert(count == save_count+2);
+    save_count = count;
+    }
+}
+
+// 1 arg, return int
+
+int f_int_1(int i)
+{
+    return i + 1;
+}
+
+struct A_int_1
+{
+    A_int_1() : data_(5) {}
+    int operator()(int i)
+    {
+        return i - 1;
+    }
+
+    int mem1() {return 3;}
+    int mem2() const {return 4;}
+    int data_;
+};
+
+void
+test_int_1()
+{
+    using namespace std::placeholders;
+    // function
+    {
+    int i = 2;
+    assert(std::bind(f_int_1, _1)(i) == 3);
+    assert(std::bind(f_int_1, i)() == 3);
+    }
+    // function pointer
+    {
+    int (*fp)(int) = f_int_1;
+    int i = 3;
+    assert(std::bind(fp, _1)(i) == 4);
+    assert(std::bind(fp, i)() == 4);
+    }
+    // functor
+    {
+    int i = 4;
+    assert(std::bind(A_int_1(), _1)(i) == 3);
+    assert(std::bind(A_int_1(), i)() == 3);
+    }
+    // member function pointer
+    {
+    A_int_1 a;
+    assert(std::bind(&A_int_1::mem1, _1)(a) == 3);
+    assert(std::bind(&A_int_1::mem1, a)() == 3);
+    A_int_1* ap = &a;
+    assert(std::bind(&A_int_1::mem1, _1)(ap) == 3);
+    assert(std::bind(&A_int_1::mem1, ap)() == 3);
+    }
+    // const member function pointer
+    {
+    A_int_1 a;
+    assert(std::bind(&A_int_1::mem2, _1)(A_int_1()) == 4);
+    assert(std::bind(&A_int_1::mem2, A_int_1())() == 4);
+    A_int_1* ap = &a;
+    assert(std::bind(&A_int_1::mem2, _1)(ap) == 4);
+    assert(std::bind(&A_int_1::mem2, ap)() == 4);
+    }
+    // member data pointer
+    {
+    A_int_1 a;
+    assert(std::bind(&A_int_1::data_, _1)(a) == 5);
+    assert(std::bind(&A_int_1::data_, a)() == 5);
+    A_int_1* ap = &a;
+    assert(std::bind(&A_int_1::data_, _1)(a) == 5);
+    std::bind(&A_int_1::data_, _1)(a) = 6;
+    assert(std::bind(&A_int_1::data_, _1)(a) == 6);
+    assert(std::bind(&A_int_1::data_, _1)(ap) == 6);
+    std::bind(&A_int_1::data_, _1)(ap) = 7;
+    assert(std::bind(&A_int_1::data_, _1)(ap) == 7);
+    }
+}
+
+// 2 arg, return void
+
+void f_void_2(int i, int j)
+{
+    count += i+j;
+}
+
+struct A_void_2
+{
+    void operator()(int i, int j)
+    {
+        count += i+j;
+    }
+
+    void mem1(int i) {count += i;}
+    void mem2(int i) const {count += i;}
+};
+
+void
+test_void_2()
+{
+    using namespace std::placeholders;
+    int save_count = count;
+    // function
+    {
+    int i = 2;
+    int j = 3;
+    std::bind(f_void_2, _1, _2)(i, j);
+    assert(count == save_count+5);
+    save_count = count;
+    std::bind(f_void_2, i, _1)(j);
+    assert(count == save_count+5);
+    save_count = count;
+    std::bind(f_void_2, i, j)();
+    assert(count == save_count+5);
+    save_count = count;
+    }
+    // member function pointer
+    {
+    int j = 3;
+    std::bind(&A_void_2::mem1, _1, _2)(A_void_2(), j);
+    assert(count == save_count+3);
+    save_count = count;
+    std::bind(&A_void_2::mem1, _2, _1)(j, A_void_2());
+    assert(count == save_count+3);
+    save_count = count;
+    }
+}
+
+int main()
+{
+    test_void_1();
+    test_int_1();
+}

Modified: libcxx/trunk/test/utilities/function.objects/bind/func.bind/func.bind.bind/invoke_rvalue.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/function.objects/bind/func.bind/func.bind.bind/invoke_rvalue.pass.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/function.objects/bind/func.bind/func.bind.bind/invoke_rvalue.pass.cpp (original)
+++ libcxx/trunk/test/utilities/function.objects/bind/func.bind/func.bind.bind/invoke_rvalue.pass.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,248 @@
-//===----------------------------------------------------------------------===//
//
//                     The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//

// <functional>

// template<CopyConstructible Fn, CopyConstructible... Types> 
//   unspecified bind(Fn, Types...); 
// template<Returnable R, CopyConstructible Fn, CopyConstructible... Types> 
//   unspecified bind(Fn, Types...); 

#include <stdio.h>

#include <functional>
#include <cassert>

int count = 0;

// 1 arg, return void

void f_void_1(int i)
{
    count += i;
}

struct A_void_1
{
    void operator()(int i)
    {
        count += i;
    }

    void mem1() {++count;}
    void mem2() const {count += 2;}
};

void
test_void_1()
{
    using namespace std::placeholders;
    int save_count = count;
    // function
    {
    std::bind(f
 _void_1, _1)(2);
    assert(count == save_count + 2);
    save_count = count;
    }
    {
    std::bind(f_void_1, 2)();
    assert(count == save_count + 2);
    save_count = count;
    }
    // function pointer
    {
    void (*fp)(int) = f_void_1;
    std::bind(fp, _1)(3);
    assert(count == save_count+3);
    save_count = count;
    }
    {
    void (*fp)(int) = f_void_1;
    std::bind(fp, 3)();
    assert(count == save_count+3);
    save_count = count;
    }
    // functor
    {
    A_void_1 a0;
    std::bind(a0, _1)(4);
    assert(count == save_count+4);
    save_count = count;
    }
    {
    A_void_1 a0;
    std::bind(a0, 4)();
    assert(count == save_count+4);
    save_count = count;
    }
    // member function pointer
    {
    void (A_void_1::*fp)() = &A_void_1::mem1;
    std::bind(fp, _1)(A_void_1());
    assert(count == save_count+1);
    save_count = count;
    A_void_1 a;
    std::bind(fp, _1)(&a);
    assert(count == save_count+1);
    save_count = count;
  
   }
    {
    void (A_void_1::*fp)() = &A_void_1::mem1;
    std::bind(fp, A_void_1())();
    assert(count == save_count+1);
    save_count = count;
    A_void_1 a;
    std::bind(fp, &a)();
    assert(count == save_count+1);
    save_count = count;
    }
    // const member function pointer
    {
    void (A_void_1::*fp)() const = &A_void_1::mem2;
    std::bind(fp, _1)(A_void_1());
    assert(count == save_count+2);
    save_count = count;
    A_void_1 a;
    std::bind(fp, _1)(&a);
    assert(count == save_count+2);
    save_count = count;
    }
    {
    void (A_void_1::*fp)() const = &A_void_1::mem2;
    std::bind(fp, A_void_1())();
    assert(count == save_count+2);
    save_count = count;
    A_void_1 a;
    std::bind(fp, &a)();
    assert(count == save_count+2);
    save_count = count;
    }
}

// 1 arg, return int

int f_int_1(int i)
{
    return i + 1;
}

struct A_int_1
{
    A_int_1() : data_(5) {}
    int operator()(int i)
    {
        return i - 1;
    }

    int m
 em1() {return 3;}
    int mem2() const {return 4;}
    int data_;
};

void
test_int_1()
{
    using namespace std::placeholders;
    // function
    {
    assert(std::bind(f_int_1, _1)(2) == 3);
    assert(std::bind(f_int_1, 2)() == 3);
    }
    // function pointer
    {
    int (*fp)(int) = f_int_1;
    assert(std::bind(fp, _1)(3) == 4);
    assert(std::bind(fp, 3)() == 4);
    }
    // functor
    {
    assert(std::bind(A_int_1(), _1)(4) == 3);
    assert(std::bind(A_int_1(), 4)() == 3);
    }
    // member function pointer
    {
    assert(std::bind(&A_int_1::mem1, _1)(A_int_1()) == 3);
    assert(std::bind(&A_int_1::mem1, A_int_1())() == 3);
    A_int_1 a;
    assert(std::bind(&A_int_1::mem1, _1)(&a) == 3);
    assert(std::bind(&A_int_1::mem1, &a)() == 3);
    }
    // const member function pointer
    {
    assert(std::bind(&A_int_1::mem2, _1)(A_int_1()) == 4);
    assert(std::bind(&A_int_1::mem2, A_int_1())() == 4);
    A_int_1 a;
    assert(std::bind(&A_int_1::mem2, 
 _1)(&a) == 4);
    assert(std::bind(&A_int_1::mem2, &a)() == 4);
    }
    // member data pointer
    {
    assert(std::bind(&A_int_1::data_, _1)(A_int_1()) == 5);
    assert(std::bind(&A_int_1::data_, A_int_1())() == 5);
    A_int_1 a;
    assert(std::bind(&A_int_1::data_, _1)(a) == 5);
    std::bind(&A_int_1::data_, _1)(a) = 6;
    assert(std::bind(&A_int_1::data_, _1)(a) == 6);
    assert(std::bind(&A_int_1::data_, _1)(&a) == 6);
    std::bind(&A_int_1::data_, _1)(&a) = 7;
    assert(std::bind(&A_int_1::data_, _1)(&a) == 7);
    }
}

// 2 arg, return void

void f_void_2(int i, int j)
{
    count += i+j;
}

struct A_void_2
{
    void operator()(int i, int j)
    {
        count += i+j;
    }

    void mem1(int i) {count += i;}
    void mem2(int i) const {count += i;}
};

void
test_void_2()
{
    using namespace std::placeholders;
    int save_count = count;
    // function
    {
    std::bind(f_void_2, _1, _2)(2, 3);
    assert(count == save_count+5);
    save_count = coun
 t;
    std::bind(f_void_2, 2, _1)(3);
    assert(count == save_count+5);
    save_count = count;
    std::bind(f_void_2, 2, 3)();
    assert(count == save_count+5);
    save_count = count;
    }
    // member function pointer
    {
    std::bind(&A_void_2::mem1, _1, _2)(A_void_2(), 3);
    assert(count == save_count+3);
    save_count = count;
    std::bind(&A_void_2::mem1, _2, _1)(3, A_void_2());
    assert(count == save_count+3);
    save_count = count;
    }
}

int main()
{
    test_void_1();
    test_int_1();
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <functional>
+
+// template<CopyConstructible Fn, CopyConstructible... Types>
+//   unspecified bind(Fn, Types...);
+// template<Returnable R, CopyConstructible Fn, CopyConstructible... Types>
+//   unspecified bind(Fn, Types...);
+
+#include <stdio.h>
+
+#include <functional>
+#include <cassert>
+
+int count = 0;
+
+// 1 arg, return void
+
+void f_void_1(int i)
+{
+    count += i;
+}
+
+struct A_void_1
+{
+    void operator()(int i)
+    {
+        count += i;
+    }
+
+    void mem1() {++count;}
+    void mem2() const {count += 2;}
+};
+
+void
+test_void_1()
+{
+    using namespace std::placeholders;
+    int save_count = count;
+    // function
+    {
+    std::bind(f_void_1, _1)(2);
+    assert(count == save_count + 2);
+    save_count = count;
+    }
+    {
+    std::bind(f_void_1, 2)();
+    assert(count == save_count + 2);
+    save_count = count;
+    }
+    // function pointer
+    {
+    void (*fp)(int) = f_void_1;
+    std::bind(fp, _1)(3);
+    assert(count == save_count+3);
+    save_count = count;
+    }
+    {
+    void (*fp)(int) = f_void_1;
+    std::bind(fp, 3)();
+    assert(count == save_count+3);
+    save_count = count;
+    }
+    // functor
+    {
+    A_void_1 a0;
+    std::bind(a0, _1)(4);
+    assert(count == save_count+4);
+    save_count = count;
+    }
+    {
+    A_void_1 a0;
+    std::bind(a0, 4)();
+    assert(count == save_count+4);
+    save_count = count;
+    }
+    // member function pointer
+    {
+    void (A_void_1::*fp)() = &A_void_1::mem1;
+    std::bind(fp, _1)(A_void_1());
+    assert(count == save_count+1);
+    save_count = count;
+    A_void_1 a;
+    std::bind(fp, _1)(&a);
+    assert(count == save_count+1);
+    save_count = count;
+    }
+    {
+    void (A_void_1::*fp)() = &A_void_1::mem1;
+    std::bind(fp, A_void_1())();
+    assert(count == save_count+1);
+    save_count = count;
+    A_void_1 a;
+    std::bind(fp, &a)();
+    assert(count == save_count+1);
+    save_count = count;
+    }
+    // const member function pointer
+    {
+    void (A_void_1::*fp)() const = &A_void_1::mem2;
+    std::bind(fp, _1)(A_void_1());
+    assert(count == save_count+2);
+    save_count = count;
+    A_void_1 a;
+    std::bind(fp, _1)(&a);
+    assert(count == save_count+2);
+    save_count = count;
+    }
+    {
+    void (A_void_1::*fp)() const = &A_void_1::mem2;
+    std::bind(fp, A_void_1())();
+    assert(count == save_count+2);
+    save_count = count;
+    A_void_1 a;
+    std::bind(fp, &a)();
+    assert(count == save_count+2);
+    save_count = count;
+    }
+}
+
+// 1 arg, return int
+
+int f_int_1(int i)
+{
+    return i + 1;
+}
+
+struct A_int_1
+{
+    A_int_1() : data_(5) {}
+    int operator()(int i)
+    {
+        return i - 1;
+    }
+
+    int mem1() {return 3;}
+    int mem2() const {return 4;}
+    int data_;
+};
+
+void
+test_int_1()
+{
+    using namespace std::placeholders;
+    // function
+    {
+    assert(std::bind(f_int_1, _1)(2) == 3);
+    assert(std::bind(f_int_1, 2)() == 3);
+    }
+    // function pointer
+    {
+    int (*fp)(int) = f_int_1;
+    assert(std::bind(fp, _1)(3) == 4);
+    assert(std::bind(fp, 3)() == 4);
+    }
+    // functor
+    {
+    assert(std::bind(A_int_1(), _1)(4) == 3);
+    assert(std::bind(A_int_1(), 4)() == 3);
+    }
+    // member function pointer
+    {
+    assert(std::bind(&A_int_1::mem1, _1)(A_int_1()) == 3);
+    assert(std::bind(&A_int_1::mem1, A_int_1())() == 3);
+    A_int_1 a;
+    assert(std::bind(&A_int_1::mem1, _1)(&a) == 3);
+    assert(std::bind(&A_int_1::mem1, &a)() == 3);
+    }
+    // const member function pointer
+    {
+    assert(std::bind(&A_int_1::mem2, _1)(A_int_1()) == 4);
+    assert(std::bind(&A_int_1::mem2, A_int_1())() == 4);
+    A_int_1 a;
+    assert(std::bind(&A_int_1::mem2, _1)(&a) == 4);
+    assert(std::bind(&A_int_1::mem2, &a)() == 4);
+    }
+    // member data pointer
+    {
+    assert(std::bind(&A_int_1::data_, _1)(A_int_1()) == 5);
+    assert(std::bind(&A_int_1::data_, A_int_1())() == 5);
+    A_int_1 a;
+    assert(std::bind(&A_int_1::data_, _1)(a) == 5);
+    std::bind(&A_int_1::data_, _1)(a) = 6;
+    assert(std::bind(&A_int_1::data_, _1)(a) == 6);
+    assert(std::bind(&A_int_1::data_, _1)(&a) == 6);
+    std::bind(&A_int_1::data_, _1)(&a) = 7;
+    assert(std::bind(&A_int_1::data_, _1)(&a) == 7);
+    }
+}
+
+// 2 arg, return void
+
+void f_void_2(int i, int j)
+{
+    count += i+j;
+}
+
+struct A_void_2
+{
+    void operator()(int i, int j)
+    {
+        count += i+j;
+    }
+
+    void mem1(int i) {count += i;}
+    void mem2(int i) const {count += i;}
+};
+
+void
+test_void_2()
+{
+    using namespace std::placeholders;
+    int save_count = count;
+    // function
+    {
+    std::bind(f_void_2, _1, _2)(2, 3);
+    assert(count == save_count+5);
+    save_count = count;
+    std::bind(f_void_2, 2, _1)(3);
+    assert(count == save_count+5);
+    save_count = count;
+    std::bind(f_void_2, 2, 3)();
+    assert(count == save_count+5);
+    save_count = count;
+    }
+    // member function pointer
+    {
+    std::bind(&A_void_2::mem1, _1, _2)(A_void_2(), 3);
+    assert(count == save_count+3);
+    save_count = count;
+    std::bind(&A_void_2::mem1, _2, _1)(3, A_void_2());
+    assert(count == save_count+3);
+    save_count = count;
+    }
+}
+
+int main()
+{
+    test_void_1();
+    test_int_1();
+}

Modified: libcxx/trunk/test/utilities/function.objects/bind/func.bind/func.bind.bind/invoke_void_0.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/function.objects/bind/func.bind/func.bind.bind/invoke_void_0.pass.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/function.objects/bind/func.bind/func.bind.bind/invoke_void_0.pass.cpp (original)
+++ libcxx/trunk/test/utilities/function.objects/bind/func.bind/func.bind.bind/invoke_void_0.pass.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,59 @@
-//===----------------------------------------------------------------------===//
//
//                     The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//

// <functional>

// template<CopyConstructible Fn, CopyConstructible... Types> 
//   unspecified bind(Fn, Types...); 
// template<Returnable R, CopyConstructible Fn, CopyConstructible... Types> 
//   unspecified bind(Fn, Types...); 

#include <functional>
#include <cassert>

int count = 0;

template <class F>
void
test(F f)
{
    int save_count = count;
    f();
    assert(count == save_count + 1);
}

template <class F>
void
test_const(const F& f)
{
    int save_count = count;
    f();
    assert(count == save_count + 2);
}

void f() {++count;}

struct A_int_0
{
    void operator()() {++count;}
    void operator()() const {count += 2;}
};
 
int main()
{
    test(std::bind(f));
    test(std::bind(&f));
    test(std::bind(A_int_0()));
    test_const(std::bind(A_int_0()));

    test(std::bind<void>(f));
    test(std::bind<void>(&f));
    test(std::bind<void>(A_int_0()));
    test_const(std::bind<void>(A_int_0()));
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <functional>
+
+// template<CopyConstructible Fn, CopyConstructible... Types>
+//   unspecified bind(Fn, Types...);
+// template<Returnable R, CopyConstructible Fn, CopyConstructible... Types>
+//   unspecified bind(Fn, Types...);
+
+#include <functional>
+#include <cassert>
+
+int count = 0;
+
+template <class F>
+void
+test(F f)
+{
+    int save_count = count;
+    f();
+    assert(count == save_count + 1);
+}
+
+template <class F>
+void
+test_const(const F& f)
+{
+    int save_count = count;
+    f();
+    assert(count == save_count + 2);
+}
+
+void f() {++count;}
+
+struct A_int_0
+{
+    void operator()() {++count;}
+    void operator()() const {count += 2;}
+};
+
+int main()
+{
+    test(std::bind(f));
+    test(std::bind(&f));
+    test(std::bind(A_int_0()));
+    test_const(std::bind(A_int_0()));
+
+    test(std::bind<void>(f));
+    test(std::bind<void>(&f));
+    test(std::bind<void>(A_int_0()));
+    test_const(std::bind<void>(A_int_0()));
+}

Modified: libcxx/trunk/test/utilities/function.objects/bind/func.bind/func.bind.isbind/is_bind_expression.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/function.objects/bind/func.bind/func.bind.isbind/is_bind_expression.pass.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/function.objects/bind/func.bind/func.bind.isbind/is_bind_expression.pass.cpp (original)
+++ libcxx/trunk/test/utilities/function.objects/bind/func.bind/func.bind.isbind/is_bind_expression.pass.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,32 @@
-//===----------------------------------------------------------------------===//
//
//                     The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//

// <functional>

// template<class T> struct is_bind_expression

#include <functional>

template <bool Expected, class T>
void
test(const T&)
{
    static_assert(std::is_bind_expression<T>::value == Expected, "");
}

struct C {};

int main()
{
    test<true>(std::bind(C()));
    test<true>(std::bind(C(), std::placeholders::_2));
    test<true>(std::bind<int>(C()));
    test<false>(1);
    test<false>(std::placeholders::_2);
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <functional>
+
+// template<class T> struct is_bind_expression
+
+#include <functional>
+
+template <bool Expected, class T>
+void
+test(const T&)
+{
+    static_assert(std::is_bind_expression<T>::value == Expected, "");
+}
+
+struct C {};
+
+int main()
+{
+    test<true>(std::bind(C()));
+    test<true>(std::bind(C(), std::placeholders::_2));
+    test<true>(std::bind<int>(C()));
+    test<false>(1);
+    test<false>(std::placeholders::_2);
+}

Modified: libcxx/trunk/test/utilities/function.objects/bind/func.bind/func.bind.isbind/is_placeholder.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/function.objects/bind/func.bind/func.bind.isbind/is_placeholder.pass.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/function.objects/bind/func.bind/func.bind.isbind/is_placeholder.pass.cpp (original)
+++ libcxx/trunk/test/utilities/function.objects/bind/func.bind/func.bind.isbind/is_placeholder.pass.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,41 @@
-//===----------------------------------------------------------------------===//
//
//                     The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//

// <functional>

// struct is_placeholder

#include <functional>

template <int Expected, class T>
void
test(const T&)
{
    static_assert(std::is_placeholder<T>::value == Expected, "");
}

struct C {};

int main()
{
    test<1>(std::placeholders::_1);
    test<2>(std::placeholders::_2);
    test<3>(std::placeholders::_3);
    test<4>(std::placeholders::_4);
    test<5>(std::placeholders::_5);
    test<6>(std::placeholders::_6);
    test<7>(std::placeholders::_7);
    test<8>(std::placeholders::_8);
    test<9>(std::placeholders::_9);
    test<10>(std::placeholders::_10);
    test<0>(4);
    test<0>(5.5);
    test<0>('a');
    test<0>(C())
 ;
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <functional>
+
+// struct is_placeholder
+
+#include <functional>
+
+template <int Expected, class T>
+void
+test(const T&)
+{
+    static_assert(std::is_placeholder<T>::value == Expected, "");
+}
+
+struct C {};
+
+int main()
+{
+    test<1>(std::placeholders::_1);
+    test<2>(std::placeholders::_2);
+    test<3>(std::placeholders::_3);
+    test<4>(std::placeholders::_4);
+    test<5>(std::placeholders::_5);
+    test<6>(std::placeholders::_6);
+    test<7>(std::placeholders::_7);
+    test<8>(std::placeholders::_8);
+    test<9>(std::placeholders::_9);
+    test<10>(std::placeholders::_10);
+    test<0>(4);
+    test<0>(5.5);
+    test<0>('a');
+    test<0>(C());
+}

Modified: libcxx/trunk/test/utilities/function.objects/bind/func.bind/func.bind.place/placeholders.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/function.objects/bind/func.bind/func.bind.place/placeholders.pass.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/function.objects/bind/func.bind/func.bind.place/placeholders.pass.cpp (original)
+++ libcxx/trunk/test/utilities/function.objects/bind/func.bind/func.bind.place/placeholders.pass.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,36 @@
-//===----------------------------------------------------------------------===//
//
//                     The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//

// <functional>

// placeholders

#include <functional>

template <class T>
void
test(const T& t)
{
    T t2;
    T t3 = t;
}

int main()
{
    test(std::placeholders::_1);
    test(std::placeholders::_2);
    test(std::placeholders::_3);
    test(std::placeholders::_4);
    test(std::placeholders::_5);
    test(std::placeholders::_6);
    test(std::placeholders::_7);
    test(std::placeholders::_8);
    test(std::placeholders::_9);
    test(std::placeholders::_10);
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <functional>
+
+// placeholders
+
+#include <functional>
+
+template <class T>
+void
+test(const T& t)
+{
+    T t2;
+    T t3 = t;
+}
+
+int main()
+{
+    test(std::placeholders::_1);
+    test(std::placeholders::_2);
+    test(std::placeholders::_3);
+    test(std::placeholders::_4);
+    test(std::placeholders::_5);
+    test(std::placeholders::_6);
+    test(std::placeholders::_7);
+    test(std::placeholders::_8);
+    test(std::placeholders::_9);
+    test(std::placeholders::_10);
+}

Modified: libcxx/trunk/test/utilities/function.objects/bind/func.bind/nothing_to_do.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/function.objects/bind/func.bind/nothing_to_do.pass.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/function.objects/bind/func.bind/nothing_to_do.pass.cpp (original)
+++ libcxx/trunk/test/utilities/function.objects/bind/func.bind/nothing_to_do.pass.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,12 @@
-//===----------------------------------------------------------------------===//
//
//                     The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//

int main()
{
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+int main()
+{
+}

Modified: libcxx/trunk/test/utilities/function.objects/bind/nothing_to_do.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/function.objects/bind/nothing_to_do.pass.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/function.objects/bind/nothing_to_do.pass.cpp (original)
+++ libcxx/trunk/test/utilities/function.objects/bind/nothing_to_do.pass.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,12 @@
-//===----------------------------------------------------------------------===//
//
//                     The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//

int main()
{
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+int main()
+{
+}

Modified: libcxx/trunk/test/utilities/function.objects/bitwise.operations/bit_and.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/function.objects/bitwise.operations/bit_and.pass.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/function.objects/bitwise.operations/bit_and.pass.cpp (original)
+++ libcxx/trunk/test/utilities/function.objects/bitwise.operations/bit_and.pass.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,28 @@
-//===----------------------------------------------------------------------===//
//
//                     The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//

// <functional>

// bit_and

#include <functional>
#include <type_traits>
#include <cassert>

int main()
{
    typedef std::bit_and<int> F;
    const F f = F();
    static_assert((std::is_base_of<std::binary_function<int, int, int>, F>::value), "");
    assert(f(0xEA95, 0xEA95) == 0xEA95);
    assert(f(0xEA95, 0x58D3) == 0x4891);
    assert(f(0x58D3, 0xEA95) == 0x4891);
    assert(f(0x58D3, 0) == 0);
    assert(f(0xFFFF, 0x58D3) == 0x58D3);
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <functional>
+
+// bit_and
+
+#include <functional>
+#include <type_traits>
+#include <cassert>
+
+int main()
+{
+    typedef std::bit_and<int> F;
+    const F f = F();
+    static_assert((std::is_base_of<std::binary_function<int, int, int>, F>::value), "");
+    assert(f(0xEA95, 0xEA95) == 0xEA95);
+    assert(f(0xEA95, 0x58D3) == 0x4891);
+    assert(f(0x58D3, 0xEA95) == 0x4891);
+    assert(f(0x58D3, 0) == 0);
+    assert(f(0xFFFF, 0x58D3) == 0x58D3);
+}

Modified: libcxx/trunk/test/utilities/function.objects/bitwise.operations/bit_or.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/function.objects/bitwise.operations/bit_or.pass.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/function.objects/bitwise.operations/bit_or.pass.cpp (original)
+++ libcxx/trunk/test/utilities/function.objects/bitwise.operations/bit_or.pass.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,28 @@
-//===----------------------------------------------------------------------===//
//
//                     The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//

// <functional>

// bit_or

#include <functional>
#include <type_traits>
#include <cassert>

int main()
{
    typedef std::bit_or<int> F;
    const F f = F();
    static_assert((std::is_base_of<std::binary_function<int, int, int>, F>::value), "");
    assert(f(0xEA95, 0xEA95) == 0xEA95);
    assert(f(0xEA95, 0x58D3) == 0xFAD7);
    assert(f(0x58D3, 0xEA95) == 0xFAD7);
    assert(f(0x58D3, 0) == 0x58D3);
    assert(f(0xFFFF, 0x58D3) == 0xFFFF);
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <functional>
+
+// bit_or
+
+#include <functional>
+#include <type_traits>
+#include <cassert>
+
+int main()
+{
+    typedef std::bit_or<int> F;
+    const F f = F();
+    static_assert((std::is_base_of<std::binary_function<int, int, int>, F>::value), "");
+    assert(f(0xEA95, 0xEA95) == 0xEA95);
+    assert(f(0xEA95, 0x58D3) == 0xFAD7);
+    assert(f(0x58D3, 0xEA95) == 0xFAD7);
+    assert(f(0x58D3, 0) == 0x58D3);
+    assert(f(0xFFFF, 0x58D3) == 0xFFFF);
+}

Modified: libcxx/trunk/test/utilities/function.objects/bitwise.operations/bit_xor.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/function.objects/bitwise.operations/bit_xor.pass.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/function.objects/bitwise.operations/bit_xor.pass.cpp (original)
+++ libcxx/trunk/test/utilities/function.objects/bitwise.operations/bit_xor.pass.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,28 @@
-//===----------------------------------------------------------------------===//
//
//                     The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//

// <functional>

// bit_xor

#include <functional>
#include <type_traits>
#include <cassert>

int main()
{
    typedef std::bit_xor<int> F;
    const F f = F();
    static_assert((std::is_base_of<std::binary_function<int, int, int>, F>::value), "");
    assert(f(0xEA95, 0xEA95) == 0);
    assert(f(0xEA95, 0x58D3) == 0xB246);
    assert(f(0x58D3, 0xEA95) == 0xB246);
    assert(f(0x58D3, 0) == 0x58D3);
    assert(f(0xFFFF, 0x58D3) == 0xA72C);
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <functional>
+
+// bit_xor
+
+#include <functional>
+#include <type_traits>
+#include <cassert>
+
+int main()
+{
+    typedef std::bit_xor<int> F;
+    const F f = F();
+    static_assert((std::is_base_of<std::binary_function<int, int, int>, F>::value), "");
+    assert(f(0xEA95, 0xEA95) == 0);
+    assert(f(0xEA95, 0x58D3) == 0xB246);
+    assert(f(0x58D3, 0xEA95) == 0xB246);
+    assert(f(0x58D3, 0) == 0x58D3);
+    assert(f(0xFFFF, 0x58D3) == 0xA72C);
+}

Modified: libcxx/trunk/test/utilities/function.objects/comparisons/equal_to.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/function.objects/comparisons/equal_to.pass.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/function.objects/comparisons/equal_to.pass.cpp (original)
+++ libcxx/trunk/test/utilities/function.objects/comparisons/equal_to.pass.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,25 @@
-//===----------------------------------------------------------------------===//
//
//                     The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//

// <functional>

// equal_to

#include <functional>
#include <type_traits>
#include <cassert>

int main()
{
    typedef std::equal_to<int> F;
    const F f = F();
    static_assert((std::is_base_of<std::binary_function<int, int, bool>, F>::value), "");
    assert(f(36, 36));
    assert(!f(36, 6));
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <functional>
+
+// equal_to
+
+#include <functional>
+#include <type_traits>
+#include <cassert>
+
+int main()
+{
+    typedef std::equal_to<int> F;
+    const F f = F();
+    static_assert((std::is_base_of<std::binary_function<int, int, bool>, F>::value), "");
+    assert(f(36, 36));
+    assert(!f(36, 6));
+}

Modified: libcxx/trunk/test/utilities/function.objects/comparisons/greater.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/function.objects/comparisons/greater.pass.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/function.objects/comparisons/greater.pass.cpp (original)
+++ libcxx/trunk/test/utilities/function.objects/comparisons/greater.pass.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,26 @@
-//===----------------------------------------------------------------------===//
//
//                     The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//

// <functional>

// greater

#include <functional>
#include <type_traits>
#include <cassert>

int main()
{
    typedef std::greater<int> F;
    const F f = F();
    static_assert((std::is_base_of<std::binary_function<int, int, bool>, F>::value), "");
    assert(!f(36, 36));
    assert(f(36, 6));
    assert(!f(6, 36));
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <functional>
+
+// greater
+
+#include <functional>
+#include <type_traits>
+#include <cassert>
+
+int main()
+{
+    typedef std::greater<int> F;
+    const F f = F();
+    static_assert((std::is_base_of<std::binary_function<int, int, bool>, F>::value), "");
+    assert(!f(36, 36));
+    assert(f(36, 6));
+    assert(!f(6, 36));
+}

Modified: libcxx/trunk/test/utilities/function.objects/comparisons/greater_equal.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/function.objects/comparisons/greater_equal.pass.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/function.objects/comparisons/greater_equal.pass.cpp (original)
+++ libcxx/trunk/test/utilities/function.objects/comparisons/greater_equal.pass.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,26 @@
-//===----------------------------------------------------------------------===//
//
//                     The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//

// <functional>

// greater_equal

#include <functional>
#include <type_traits>
#include <cassert>

int main()
{
    typedef std::greater_equal<int> F;
    const F f = F();
    static_assert((std::is_base_of<std::binary_function<int, int, bool>, F>::value), "");
    assert(f(36, 36));
    assert(f(36, 6));
    assert(!f(6, 36));
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <functional>
+
+// greater_equal
+
+#include <functional>
+#include <type_traits>
+#include <cassert>
+
+int main()
+{
+    typedef std::greater_equal<int> F;
+    const F f = F();
+    static_assert((std::is_base_of<std::binary_function<int, int, bool>, F>::value), "");
+    assert(f(36, 36));
+    assert(f(36, 6));
+    assert(!f(6, 36));
+}

Modified: libcxx/trunk/test/utilities/function.objects/comparisons/less.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/function.objects/comparisons/less.pass.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/function.objects/comparisons/less.pass.cpp (original)
+++ libcxx/trunk/test/utilities/function.objects/comparisons/less.pass.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,26 @@
-//===----------------------------------------------------------------------===//
//
//                     The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//

// <functional>

// less

#include <functional>
#include <type_traits>
#include <cassert>

int main()
{
    typedef std::less<int> F;
    const F f = F();
    static_assert((std::is_base_of<std::binary_function<int, int, bool>, F>::value), "");
    assert(!f(36, 36));
    assert(!f(36, 6));
    assert(f(6, 36));
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <functional>
+
+// less
+
+#include <functional>
+#include <type_traits>
+#include <cassert>
+
+int main()
+{
+    typedef std::less<int> F;
+    const F f = F();
+    static_assert((std::is_base_of<std::binary_function<int, int, bool>, F>::value), "");
+    assert(!f(36, 36));
+    assert(!f(36, 6));
+    assert(f(6, 36));
+}

Modified: libcxx/trunk/test/utilities/function.objects/comparisons/less_equal.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/function.objects/comparisons/less_equal.pass.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/function.objects/comparisons/less_equal.pass.cpp (original)
+++ libcxx/trunk/test/utilities/function.objects/comparisons/less_equal.pass.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,26 @@
-//===----------------------------------------------------------------------===//
//
//                     The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//

// <functional>

// less_equal

#include <functional>
#include <type_traits>
#include <cassert>

int main()
{
    typedef std::less_equal<int> F;
    const F f = F();
    static_assert((std::is_base_of<std::binary_function<int, int, bool>, F>::value), "");
    assert(f(36, 36));
    assert(!f(36, 6));
    assert(f(6, 36));
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <functional>
+
+// less_equal
+
+#include <functional>
+#include <type_traits>
+#include <cassert>
+
+int main()
+{
+    typedef std::less_equal<int> F;
+    const F f = F();
+    static_assert((std::is_base_of<std::binary_function<int, int, bool>, F>::value), "");
+    assert(f(36, 36));
+    assert(!f(36, 6));
+    assert(f(6, 36));
+}

Modified: libcxx/trunk/test/utilities/function.objects/comparisons/not_equal_to.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/function.objects/comparisons/not_equal_to.pass.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/function.objects/comparisons/not_equal_to.pass.cpp (original)
+++ libcxx/trunk/test/utilities/function.objects/comparisons/not_equal_to.pass.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,25 @@
-//===----------------------------------------------------------------------===//
//
//                     The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//

// <functional>

// not_equal_to

#include <functional>
#include <type_traits>
#include <cassert>

int main()
{
    typedef std::not_equal_to<int> F;
    const F f = F();
    static_assert((std::is_base_of<std::binary_function<int, int, bool>, F>::value), "");
    assert(!f(36, 36));
    assert(f(36, 6));
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <functional>
+
+// not_equal_to
+
+#include <functional>
+#include <type_traits>
+#include <cassert>
+
+int main()
+{
+    typedef std::not_equal_to<int> F;
+    const F f = F();
+    static_assert((std::is_base_of<std::binary_function<int, int, bool>, F>::value), "");
+    assert(!f(36, 36));
+    assert(f(36, 6));
+}

Modified: libcxx/trunk/test/utilities/function.objects/func.def/nothing_to_do.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/function.objects/func.def/nothing_to_do.pass.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/function.objects/func.def/nothing_to_do.pass.cpp (original)
+++ libcxx/trunk/test/utilities/function.objects/func.def/nothing_to_do.pass.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,12 @@
-//===----------------------------------------------------------------------===//
//
//                     The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//

int main()
{
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+int main()
+{
+}

Modified: libcxx/trunk/test/utilities/function.objects/func.memfn/member_data.fail.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/function.objects/func.memfn/member_data.fail.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/function.objects/func.memfn/member_data.fail.cpp (original)
+++ libcxx/trunk/test/utilities/function.objects/func.memfn/member_data.fail.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,42 @@
-//===----------------------------------------------------------------------===//
//
//                     The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//

// <functional>

// template<Returnable R, class T> unspecified mem_fn(R T::* pm);

#include <functional>
#include <cassert>

struct A
{
    double data_;
};

template <class F>
void
test(F f)
{
    {
    A a;
    f(a) = 5;
    assert(a.data_ == 5);
    A* ap = &a;
    f(ap) = 6;
    assert(a.data_ == 6);
    const A* cap = ap;
    assert(f(cap) == f(ap));
    f(cap) = 7;
    }
}

int main()
{
    test(std::mem_fn(&A::data_));
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <functional>
+
+// template<Returnable R, class T> unspecified mem_fn(R T::* pm);
+
+#include <functional>
+#include <cassert>
+
+struct A
+{
+    double data_;
+};
+
+template <class F>
+void
+test(F f)
+{
+    {
+    A a;
+    f(a) = 5;
+    assert(a.data_ == 5);
+    A* ap = &a;
+    f(ap) = 6;
+    assert(a.data_ == 6);
+    const A* cap = ap;
+    assert(f(cap) == f(ap));
+    f(cap) = 7;
+    }
+}
+
+int main()
+{
+    test(std::mem_fn(&A::data_));
+}

Modified: libcxx/trunk/test/utilities/function.objects/func.memfn/member_data.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/function.objects/func.memfn/member_data.pass.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/function.objects/func.memfn/member_data.pass.cpp (original)
+++ libcxx/trunk/test/utilities/function.objects/func.memfn/member_data.pass.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,41 @@
-//===----------------------------------------------------------------------===//
//
//                     The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//

// <functional>

// template<Returnable R, class T> unspecified mem_fn(R T::* pm);

#include <functional>
#include <cassert>

struct A
{
    double data_;
};

template <class F>
void
test(F f)
{
    {
    A a;
    f(a) = 5;
    assert(a.data_ == 5);
    A* ap = &a;
    f(ap) = 6;
    assert(a.data_ == 6);
    const A* cap = ap;
    assert(f(cap) == f(ap));
    }
}

int main()
{
    test(std::mem_fn(&A::data_));
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <functional>
+
+// template<Returnable R, class T> unspecified mem_fn(R T::* pm);
+
+#include <functional>
+#include <cassert>
+
+struct A
+{
+    double data_;
+};
+
+template <class F>
+void
+test(F f)
+{
+    {
+    A a;
+    f(a) = 5;
+    assert(a.data_ == 5);
+    A* ap = &a;
+    f(ap) = 6;
+    assert(a.data_ == 6);
+    const A* cap = ap;
+    assert(f(cap) == f(ap));
+    }
+}
+
+int main()
+{
+    test(std::mem_fn(&A::data_));
+}

Modified: libcxx/trunk/test/utilities/function.objects/func.memfn/member_function.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/function.objects/func.memfn/member_function.pass.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/function.objects/func.memfn/member_function.pass.cpp (original)
+++ libcxx/trunk/test/utilities/function.objects/func.memfn/member_function.pass.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,66 @@
-//===----------------------------------------------------------------------===//
//
//                     The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//

// <functional>

// template<Returnable R, class T, CopyConstructible... Args> 
//   unspecified mem_fn(R (T::* pm)(Args...)); 

#include <functional>
#include <cassert>

struct A
{
    char test0() {return 'a';}
    char test1(int) {return 'b';}
    char test2(int, double) {return 'c';}
};

template <class F>
void
test0(F f)
{
    {
    A a;
    assert(f(a) == 'a');
    A* ap = &a;
    assert(f(ap) == 'a');
    }
}

template <class F>
void
test1(F f)
{
    {
    A a;
    assert(f(a, 1) == 'b');
    A* ap = &a;
    assert(f(ap, 2) == 'b');
    }
}

template <class F>
void
test2(F f)
{
    {
    A a;
    assert(f(a, 1, 2) == 'c');
    A* ap
  = &a;
    assert(f(ap, 2, 3.5) == 'c');
    }
}

int main()
{
    test0(std::mem_fn(&A::test0));
    test1(std::mem_fn(&A::test1));
    test2(std::mem_fn(&A::test2));
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <functional>
+
+// template<Returnable R, class T, CopyConstructible... Args>
+//   unspecified mem_fn(R (T::* pm)(Args...));
+
+#include <functional>
+#include <cassert>
+
+struct A
+{
+    char test0() {return 'a';}
+    char test1(int) {return 'b';}
+    char test2(int, double) {return 'c';}
+};
+
+template <class F>
+void
+test0(F f)
+{
+    {
+    A a;
+    assert(f(a) == 'a');
+    A* ap = &a;
+    assert(f(ap) == 'a');
+    }
+}
+
+template <class F>
+void
+test1(F f)
+{
+    {
+    A a;
+    assert(f(a, 1) == 'b');
+    A* ap = &a;
+    assert(f(ap, 2) == 'b');
+    }
+}
+
+template <class F>
+void
+test2(F f)
+{
+    {
+    A a;
+    assert(f(a, 1, 2) == 'c');
+    A* ap = &a;
+    assert(f(ap, 2, 3.5) == 'c');
+    }
+}
+
+int main()
+{
+    test0(std::mem_fn(&A::test0));
+    test1(std::mem_fn(&A::test1));
+    test2(std::mem_fn(&A::test2));
+}

Modified: libcxx/trunk/test/utilities/function.objects/func.memfn/member_function_const.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/function.objects/func.memfn/member_function_const.pass.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/function.objects/func.memfn/member_function_const.pass.cpp (original)
+++ libcxx/trunk/test/utilities/function.objects/func.memfn/member_function_const.pass.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,72 @@
-//===----------------------------------------------------------------------===//
//
//                     The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//

// <functional>

// template<Returnable R, class T, CopyConstructible... Args> 
//   unspecified mem_fn(R (T::* pm)(Args...) const); 

#include <functional>
#include <cassert>

struct A
{
    char test0() const {return 'a';}
    char test1(int) const {return 'b';}
    char test2(int, double) const {return 'c';}
};

template <class F>
void
test0(F f)
{
    {
    A a;
    assert(f(a) == 'a');
    A* ap = &a;
    assert(f(ap) == 'a');
    const A* cap = &a;
    assert(f(cap) == 'a');
    }
}

template <class F>
void
test1(F f)
{
    {
    A a;
    assert(f(a, 1) == 'b');
    A* ap = &a;
    assert(f(ap, 2) == 'b');
    const A* cap = &a;
    
 assert(f(cap, 2) == 'b');
    }
}

template <class F>
void
test2(F f)
{
    {
    A a;
    assert(f(a, 1, 2) == 'c');
    A* ap = &a;
    assert(f(ap, 2, 3.5) == 'c');
    const A* cap = &a;
    assert(f(cap, 2, 3.5) == 'c');
    }
}

int main()
{
    test0(std::mem_fn(&A::test0));
    test1(std::mem_fn(&A::test1));
    test2(std::mem_fn(&A::test2));
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <functional>
+
+// template<Returnable R, class T, CopyConstructible... Args>
+//   unspecified mem_fn(R (T::* pm)(Args...) const);
+
+#include <functional>
+#include <cassert>
+
+struct A
+{
+    char test0() const {return 'a';}
+    char test1(int) const {return 'b';}
+    char test2(int, double) const {return 'c';}
+};
+
+template <class F>
+void
+test0(F f)
+{
+    {
+    A a;
+    assert(f(a) == 'a');
+    A* ap = &a;
+    assert(f(ap) == 'a');
+    const A* cap = &a;
+    assert(f(cap) == 'a');
+    }
+}
+
+template <class F>
+void
+test1(F f)
+{
+    {
+    A a;
+    assert(f(a, 1) == 'b');
+    A* ap = &a;
+    assert(f(ap, 2) == 'b');
+    const A* cap = &a;
+    assert(f(cap, 2) == 'b');
+    }
+}
+
+template <class F>
+void
+test2(F f)
+{
+    {
+    A a;
+    assert(f(a, 1, 2) == 'c');
+    A* ap = &a;
+    assert(f(ap, 2, 3.5) == 'c');
+    const A* cap = &a;
+    assert(f(cap, 2, 3.5) == 'c');
+    }
+}
+
+int main()
+{
+    test0(std::mem_fn(&A::test0));
+    test1(std::mem_fn(&A::test1));
+    test2(std::mem_fn(&A::test2));
+}

Modified: libcxx/trunk/test/utilities/function.objects/func.memfn/member_function_const_volatile.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/function.objects/func.memfn/member_function_const_volatile.pass.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/function.objects/func.memfn/member_function_const_volatile.pass.cpp (original)
+++ libcxx/trunk/test/utilities/function.objects/func.memfn/member_function_const_volatile.pass.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,72 @@
-//===----------------------------------------------------------------------===//
//
//                     The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//

// <functional>

// template<Returnable R, class T, CopyConstructible... Args> 
//   unspecified mem_fn(R (T::* pm)(Args...) const volatile); 

#include <functional>
#include <cassert>

struct A
{
    char test0() const volatile {return 'a';}
    char test1(int) const volatile {return 'b';}
    char test2(int, double) const volatile {return 'c';}
};

template <class F>
void
test0(F f)
{
    {
    A a;
    assert(f(a) == 'a');
    A* ap = &a;
    assert(f(ap) == 'a');
    const volatile A* cap = &a;
    assert(f(cap) == 'a');
    }
}

template <class F>
void
test1(F f)
{
    {
    A a;
    assert(f(a, 1) == 'b');
    A* ap = &a;
    assert(
 f(ap, 2) == 'b');
    const volatile A* cap = &a;
    assert(f(cap, 2) == 'b');
    }
}

template <class F>
void
test2(F f)
{
    {
    A a;
    assert(f(a, 1, 2) == 'c');
    A* ap = &a;
    assert(f(ap, 2, 3.5) == 'c');
    const volatile A* cap = &a;
    assert(f(cap, 2, 3.5) == 'c');
    }
}

int main()
{
    test0(std::mem_fn(&A::test0));
    test1(std::mem_fn(&A::test1));
    test2(std::mem_fn(&A::test2));
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <functional>
+
+// template<Returnable R, class T, CopyConstructible... Args>
+//   unspecified mem_fn(R (T::* pm)(Args...) const volatile);
+
+#include <functional>
+#include <cassert>
+
+struct A
+{
+    char test0() const volatile {return 'a';}
+    char test1(int) const volatile {return 'b';}
+    char test2(int, double) const volatile {return 'c';}
+};
+
+template <class F>
+void
+test0(F f)
+{
+    {
+    A a;
+    assert(f(a) == 'a');
+    A* ap = &a;
+    assert(f(ap) == 'a');
+    const volatile A* cap = &a;
+    assert(f(cap) == 'a');
+    }
+}
+
+template <class F>
+void
+test1(F f)
+{
+    {
+    A a;
+    assert(f(a, 1) == 'b');
+    A* ap = &a;
+    assert(f(ap, 2) == 'b');
+    const volatile A* cap = &a;
+    assert(f(cap, 2) == 'b');
+    }
+}
+
+template <class F>
+void
+test2(F f)
+{
+    {
+    A a;
+    assert(f(a, 1, 2) == 'c');
+    A* ap = &a;
+    assert(f(ap, 2, 3.5) == 'c');
+    const volatile A* cap = &a;
+    assert(f(cap, 2, 3.5) == 'c');
+    }
+}
+
+int main()
+{
+    test0(std::mem_fn(&A::test0));
+    test1(std::mem_fn(&A::test1));
+    test2(std::mem_fn(&A::test2));
+}

Modified: libcxx/trunk/test/utilities/function.objects/func.memfn/member_function_volatile.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/function.objects/func.memfn/member_function_volatile.pass.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/function.objects/func.memfn/member_function_volatile.pass.cpp (original)
+++ libcxx/trunk/test/utilities/function.objects/func.memfn/member_function_volatile.pass.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,72 @@
-//===----------------------------------------------------------------------===//
//
//                     The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//

// <functional>

// template<Returnable R, class T, CopyConstructible... Args> 
//   unspecified mem_fn(R (T::* pm)(Args...) volatile); 

#include <functional>
#include <cassert>

struct A
{
    char test0() volatile {return 'a';}
    char test1(int) volatile {return 'b';}
    char test2(int, double) volatile {return 'c';}
};

template <class F>
void
test0(F f)
{
    {
    A a;
    assert(f(a) == 'a');
    A* ap = &a;
    assert(f(ap) == 'a');
    volatile A* cap = &a;
    assert(f(cap) == 'a');
    }
}

template <class F>
void
test1(F f)
{
    {
    A a;
    assert(f(a, 1) == 'b');
    A* ap = &a;
    assert(f(ap, 2) == 'b');
    volatile
  A* cap = &a;
    assert(f(cap, 2) == 'b');
    }
}

template <class F>
void
test2(F f)
{
    {
    A a;
    assert(f(a, 1, 2) == 'c');
    A* ap = &a;
    assert(f(ap, 2, 3.5) == 'c');
    volatile A* cap = &a;
    assert(f(cap, 2, 3.5) == 'c');
    }
}

int main()
{
    test0(std::mem_fn(&A::test0));
    test1(std::mem_fn(&A::test1));
    test2(std::mem_fn(&A::test2));
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <functional>
+
+// template<Returnable R, class T, CopyConstructible... Args>
+//   unspecified mem_fn(R (T::* pm)(Args...) volatile);
+
+#include <functional>
+#include <cassert>
+
+struct A
+{
+    char test0() volatile {return 'a';}
+    char test1(int) volatile {return 'b';}
+    char test2(int, double) volatile {return 'c';}
+};
+
+template <class F>
+void
+test0(F f)
+{
+    {
+    A a;
+    assert(f(a) == 'a');
+    A* ap = &a;
+    assert(f(ap) == 'a');
+    volatile A* cap = &a;
+    assert(f(cap) == 'a');
+    }
+}
+
+template <class F>
+void
+test1(F f)
+{
+    {
+    A a;
+    assert(f(a, 1) == 'b');
+    A* ap = &a;
+    assert(f(ap, 2) == 'b');
+    volatile A* cap = &a;
+    assert(f(cap, 2) == 'b');
+    }
+}
+
+template <class F>
+void
+test2(F f)
+{
+    {
+    A a;
+    assert(f(a, 1, 2) == 'c');
+    A* ap = &a;
+    assert(f(ap, 2, 3.5) == 'c');
+    volatile A* cap = &a;
+    assert(f(cap, 2, 3.5) == 'c');
+    }
+}
+
+int main()
+{
+    test0(std::mem_fn(&A::test0));
+    test1(std::mem_fn(&A::test1));
+    test2(std::mem_fn(&A::test2));
+}

Modified: libcxx/trunk/test/utilities/function.objects/func.require/binary_function.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/function.objects/func.require/binary_function.pass.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/function.objects/func.require/binary_function.pass.cpp (original)
+++ libcxx/trunk/test/utilities/function.objects/func.require/binary_function.pass.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,23 @@
-//===----------------------------------------------------------------------===//
//
//                     The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//

// <functional>

// binary_function

#include <functional>
#include <type_traits>

int main()
{
    typedef std::binary_function<int, short, bool> bf;
    static_assert((std::is_same<bf::first_argument_type, int>::value), "");
    static_assert((std::is_same<bf::second_argument_type, short>::value), "");
    static_assert((std::is_same<bf::result_type, bool>::value), "");
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <functional>
+
+// binary_function
+
+#include <functional>
+#include <type_traits>
+
+int main()
+{
+    typedef std::binary_function<int, short, bool> bf;
+    static_assert((std::is_same<bf::first_argument_type, int>::value), "");
+    static_assert((std::is_same<bf::second_argument_type, short>::value), "");
+    static_assert((std::is_same<bf::result_type, bool>::value), "");
+}

Modified: libcxx/trunk/test/utilities/function.objects/func.require/unary_function.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/function.objects/func.require/unary_function.pass.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/function.objects/func.require/unary_function.pass.cpp (original)
+++ libcxx/trunk/test/utilities/function.objects/func.require/unary_function.pass.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,22 @@
-//===----------------------------------------------------------------------===//
//
//                     The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//

// <functional>

// unary_function

#include <functional>
#include <type_traits>

int main()
{
    typedef std::unary_function<int, bool> uf;
    static_assert((std::is_same<uf::argument_type, int>::value), "");
    static_assert((std::is_same<uf::result_type, bool>::value), "");
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <functional>
+
+// unary_function
+
+#include <functional>
+#include <type_traits>
+
+int main()
+{
+    typedef std::unary_function<int, bool> uf;
+    static_assert((std::is_same<uf::argument_type, int>::value), "");
+    static_assert((std::is_same<uf::result_type, bool>::value), "");
+}

Modified: libcxx/trunk/test/utilities/function.objects/func.wrap/func.wrap.badcall/bad_function_call.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/function.objects/func.wrap/func.wrap.badcall/bad_function_call.pass.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/function.objects/func.wrap/func.wrap.badcall/bad_function_call.pass.cpp (original)
+++ libcxx/trunk/test/utilities/function.objects/func.wrap/func.wrap.badcall/bad_function_call.pass.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,26 @@
-//===----------------------------------------------------------------------===//
//
//                     The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//

// Class bad_function_call

// class bad_function_call
//     : public exception
// { 
// public: 
//   // 20.7.16.1.1, constructor: 
//   bad_function_call(); 
// };

#include <functional>
#include <type_traits>

int main()
{
    static_assert((std::is_base_of<std::exception, std::bad_function_call>::value), "");
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// Class bad_function_call
+
+// class bad_function_call
+//     : public exception
+// {
+// public:
+//   // 20.7.16.1.1, constructor:
+//   bad_function_call();
+// };
+
+#include <functional>
+#include <type_traits>
+
+int main()
+{
+    static_assert((std::is_base_of<std::exception, std::bad_function_call>::value), "");
+}

Modified: libcxx/trunk/test/utilities/function.objects/func.wrap/func.wrap.badcall/func.wrap.badcall.const/bad_function_call_ctor.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/function.objects/func.wrap/func.wrap.badcall/func.wrap.badcall.const/bad_function_call_ctor.pass.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/function.objects/func.wrap/func.wrap.badcall/func.wrap.badcall.const/bad_function_call_ctor.pass.cpp (original)
+++ libcxx/trunk/test/utilities/function.objects/func.wrap/func.wrap.badcall/func.wrap.badcall.const/bad_function_call_ctor.pass.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,20 @@
-//===----------------------------------------------------------------------===//
//
//                     The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//

// Class bad_function_call

// bad_function_call();

#include <functional>
#include <type_traits>

int main()
{
    std::bad_function_call ex;
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// Class bad_function_call
+
+// bad_function_call();
+
+#include <functional>
+#include <type_traits>
+
+int main()
+{
+    std::bad_function_call ex;
+}

Modified: libcxx/trunk/test/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.alg/swap.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.alg/swap.pass.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.alg/swap.pass.cpp (original)
+++ libcxx/trunk/test/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.alg/swap.pass.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,135 @@
-//===----------------------------------------------------------------------===//
//
//                     The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//

// <functional>

// class function<R(ArgTypes...)>

// template <MoveConstructible  R, MoveConstructible ... ArgTypes> 
//   void swap(function<R(ArgTypes...)>&, function<R(ArgTypes...)>&);

#include <functional>
#include <new>
#include <cstdlib>
#include <cassert>

int new_called = 0;

void* operator new(std::size_t s) throw(std::bad_alloc)
{
    ++new_called;
    return std::malloc(s);
}

void  operator delete(void* p) throw()
{
    --new_called;
    std::free(p);
}

class A
{
    int data_[10];
public:
    static int count;

    explicit A(int j)
    {
        ++count;
        data_[0] = j;
    }

    A(const A& a)
    {
        ++count
 ;
        for (int i = 0; i < 10; ++i)
            data_[i] = a.data_[i];
    }

    ~A() {--count;}

    int operator()(int i) const
    {
        for (int j = 0; j < 10; ++j)
            i += data_[j];
        return i;
    }

    int id() const {return data_[0];}
};

int A::count = 0;

int g(int) {return 0;}
int h(int) {return 1;}

int main()
{
    assert(new_called == 0);
    {
    std::function<int(int)> f1 = A(1);
    std::function<int(int)> f2 = A(2);
    assert(A::count == 2);
    assert(new_called == 2);
    assert(f1.target<A>()->id() == 1);
    assert(f2.target<A>()->id() == 2);
    swap(f1, f2);
    assert(A::count == 2);
    assert(new_called == 2);
    assert(f1.target<A>()->id() == 2);
    assert(f2.target<A>()->id() == 1);
    }
    assert(A::count == 0);
    assert(new_called == 0);
    {
    std::function<int(int)> f1 = A(1);
    std::function<int(int)> f2 = g;
    assert(A::count == 1);
    assert(new_called == 1);
    assert(f1.target<A>()->id() == 1);
  
   assert(*f2.target<int(*)(int)>() == g);
    swap(f1, f2);
    assert(A::count == 1);
    assert(new_called == 1);
    assert(*f1.target<int(*)(int)>() == g);
    assert(f2.target<A>()->id() == 1);
    }
    assert(A::count == 0);
    assert(new_called == 0);
    {
    std::function<int(int)> f1 = g;
    std::function<int(int)> f2 = A(1);
    assert(A::count == 1);
    assert(new_called == 1);
    assert(*f1.target<int(*)(int)>() == g);
    assert(f2.target<A>()->id() == 1);
    swap(f1, f2);
    assert(A::count == 1);
    assert(new_called == 1);
    assert(f1.target<A>()->id() == 1);
    assert(*f2.target<int(*)(int)>() == g);
    }
    assert(A::count == 0);
    assert(new_called == 0);
    {
    std::function<int(int)> f1 = g;
    std::function<int(int)> f2 = h;
    assert(A::count == 0);
    assert(new_called == 0);
    assert(*f1.target<int(*)(int)>() == g);
    assert(*f2.target<int(*)(int)>() == h);
    swap(f1, f2);
    assert(A::count == 0);
    assert(new_called 
 == 0);
    assert(*f1.target<int(*)(int)>() == h);
    assert(*f2.target<int(*)(int)>() == g);
    }
    assert(A::count == 0);
    assert(new_called == 0);
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <functional>
+
+// class function<R(ArgTypes...)>
+
+// template <MoveConstructible  R, MoveConstructible ... ArgTypes>
+//   void swap(function<R(ArgTypes...)>&, function<R(ArgTypes...)>&);
+
+#include <functional>
+#include <new>
+#include <cstdlib>
+#include <cassert>
+
+int new_called = 0;
+
+void* operator new(std::size_t s) throw(std::bad_alloc)
+{
+    ++new_called;
+    return std::malloc(s);
+}
+
+void  operator delete(void* p) throw()
+{
+    --new_called;
+    std::free(p);
+}
+
+class A
+{
+    int data_[10];
+public:
+    static int count;
+
+    explicit A(int j)
+    {
+        ++count;
+        data_[0] = j;
+    }
+
+    A(const A& a)
+    {
+        ++count;
+        for (int i = 0; i < 10; ++i)
+            data_[i] = a.data_[i];
+    }
+
+    ~A() {--count;}
+
+    int operator()(int i) const
+    {
+        for (int j = 0; j < 10; ++j)
+            i += data_[j];
+        return i;
+    }
+
+    int id() const {return data_[0];}
+};
+
+int A::count = 0;
+
+int g(int) {return 0;}
+int h(int) {return 1;}
+
+int main()
+{
+    assert(new_called == 0);
+    {
+    std::function<int(int)> f1 = A(1);
+    std::function<int(int)> f2 = A(2);
+    assert(A::count == 2);
+    assert(new_called == 2);
+    assert(f1.target<A>()->id() == 1);
+    assert(f2.target<A>()->id() == 2);
+    swap(f1, f2);
+    assert(A::count == 2);
+    assert(new_called == 2);
+    assert(f1.target<A>()->id() == 2);
+    assert(f2.target<A>()->id() == 1);
+    }
+    assert(A::count == 0);
+    assert(new_called == 0);
+    {
+    std::function<int(int)> f1 = A(1);
+    std::function<int(int)> f2 = g;
+    assert(A::count == 1);
+    assert(new_called == 1);
+    assert(f1.target<A>()->id() == 1);
+    assert(*f2.target<int(*)(int)>() == g);
+    swap(f1, f2);
+    assert(A::count == 1);
+    assert(new_called == 1);
+    assert(*f1.target<int(*)(int)>() == g);
+    assert(f2.target<A>()->id() == 1);
+    }
+    assert(A::count == 0);
+    assert(new_called == 0);
+    {
+    std::function<int(int)> f1 = g;
+    std::function<int(int)> f2 = A(1);
+    assert(A::count == 1);
+    assert(new_called == 1);
+    assert(*f1.target<int(*)(int)>() == g);
+    assert(f2.target<A>()->id() == 1);
+    swap(f1, f2);
+    assert(A::count == 1);
+    assert(new_called == 1);
+    assert(f1.target<A>()->id() == 1);
+    assert(*f2.target<int(*)(int)>() == g);
+    }
+    assert(A::count == 0);
+    assert(new_called == 0);
+    {
+    std::function<int(int)> f1 = g;
+    std::function<int(int)> f2 = h;
+    assert(A::count == 0);
+    assert(new_called == 0);
+    assert(*f1.target<int(*)(int)>() == g);
+    assert(*f2.target<int(*)(int)>() == h);
+    swap(f1, f2);
+    assert(A::count == 0);
+    assert(new_called == 0);
+    assert(*f1.target<int(*)(int)>() == h);
+    assert(*f2.target<int(*)(int)>() == g);
+    }
+    assert(A::count == 0);
+    assert(new_called == 0);
+}

Modified: libcxx/trunk/test/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.cap/operator_bool.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.cap/operator_bool.pass.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.cap/operator_bool.pass.cpp (original)
+++ libcxx/trunk/test/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.cap/operator_bool.pass.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,29 @@
-//===----------------------------------------------------------------------===//
//
//                     The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//

// <functional>

// class function<R(ArgTypes...)>

// explicit operator bool() const

#include <functional>
#include <cassert>

int g(int) {return 0;}

int main()
{
    {
    std::function<int(int)> f;
    assert(!f);
    f = g;
    assert(f);
    }
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <functional>
+
+// class function<R(ArgTypes...)>
+
+// explicit operator bool() const
+
+#include <functional>
+#include <cassert>
+
+int g(int) {return 0;}
+
+int main()
+{
+    {
+    std::function<int(int)> f;
+    assert(!f);
+    f = g;
+    assert(f);
+    }
+}

Modified: libcxx/trunk/test/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/F.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/F.pass.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/F.pass.cpp (original)
+++ libcxx/trunk/test/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/F.pass.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,98 @@
-//===----------------------------------------------------------------------===//
//
//                     The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//

// <functional>

// class function<R(ArgTypes...)>

// function(nullptr_t);

#include <functional>
#include <new>
#include <cstdlib>
#include <cassert>

int new_called = 0;

void* operator new(std::size_t s) throw(std::bad_alloc)
{
    ++new_called;
    return std::malloc(s);
}

void  operator delete(void* p) throw()
{
    --new_called;
    std::free(p);
}

class A
{
    int data_[10];
public:
    static int count;

    A()
    {
        ++count;
        for (int i = 0; i < 10; ++i)
            data_[i] = i;
    }

    A(const A&) {++count;}

    ~A() {--count;}

    int operator()(int i) const
    {
        for (int j = 0; j < 10; ++j)
  
           i += data_[j];
        return i;
    }

    int foo(int) const {return 1;}
};

int A::count = 0;

int g(int) {return 0;}

int main()
{
    assert(new_called == 0);
    {
    std::function<int(int)> f = A();
    assert(A::count == 1);
    assert(new_called == 1);
    assert(f.target<A>());
    assert(f.target<int(*)(int)>() == 0);
    }
    assert(A::count == 0);
    assert(new_called == 0);
    {
    std::function<int(int)> f = g;
    assert(new_called == 0);
    assert(f.target<int(*)(int)>());
    assert(f.target<A>() == 0);
    }
    assert(new_called == 0);
    {
    std::function<int(int)> f = (int (*)(int))0;
    assert(!f);
    assert(new_called == 0);
    assert(f.target<int(*)(int)>() == 0);
    assert(f.target<A>() == 0);
    }
    {
    std::function<int(const A*, int)> f = &A::foo;
    assert(f);
    assert(new_called == 0);
    assert(f.target<int (A::*)(int) const>() != 0);
    }
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <functional>
+
+// class function<R(ArgTypes...)>
+
+// function(nullptr_t);
+
+#include <functional>
+#include <new>
+#include <cstdlib>
+#include <cassert>
+
+int new_called = 0;
+
+void* operator new(std::size_t s) throw(std::bad_alloc)
+{
+    ++new_called;
+    return std::malloc(s);
+}
+
+void  operator delete(void* p) throw()
+{
+    --new_called;
+    std::free(p);
+}
+
+class A
+{
+    int data_[10];
+public:
+    static int count;
+
+    A()
+    {
+        ++count;
+        for (int i = 0; i < 10; ++i)
+            data_[i] = i;
+    }
+
+    A(const A&) {++count;}
+
+    ~A() {--count;}
+
+    int operator()(int i) const
+    {
+        for (int j = 0; j < 10; ++j)
+            i += data_[j];
+        return i;
+    }
+
+    int foo(int) const {return 1;}
+};
+
+int A::count = 0;
+
+int g(int) {return 0;}
+
+int main()
+{
+    assert(new_called == 0);
+    {
+    std::function<int(int)> f = A();
+    assert(A::count == 1);
+    assert(new_called == 1);
+    assert(f.target<A>());
+    assert(f.target<int(*)(int)>() == 0);
+    }
+    assert(A::count == 0);
+    assert(new_called == 0);
+    {
+    std::function<int(int)> f = g;
+    assert(new_called == 0);
+    assert(f.target<int(*)(int)>());
+    assert(f.target<A>() == 0);
+    }
+    assert(new_called == 0);
+    {
+    std::function<int(int)> f = (int (*)(int))0;
+    assert(!f);
+    assert(new_called == 0);
+    assert(f.target<int(*)(int)>() == 0);
+    assert(f.target<A>() == 0);
+    }
+    {
+    std::function<int(const A*, int)> f = &A::foo;
+    assert(f);
+    assert(new_called == 0);
+    assert(f.target<int (A::*)(int) const>() != 0);
+    }
+}

Modified: libcxx/trunk/test/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/F_assign.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/F_assign.pass.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/F_assign.pass.cpp (original)
+++ libcxx/trunk/test/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/F_assign.pass.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,105 @@
-//===----------------------------------------------------------------------===//
//
//                     The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//

// <functional>

// class function<R(ArgTypes...)>

// template<class F> 
//   requires CopyConstructible<F> && Callable<F, ArgTypes..> 
//         && Convertible<Callable<F, ArgTypes...>::result_type 
//   operator=(F f);

#include <functional>
#include <new>
#include <cstdlib>
#include <cassert>

int new_called = 0;

void* operator new(std::size_t s) throw(std::bad_alloc)
{
    ++new_called;
    return std::malloc(s);
}

void  operator delete(void* p) throw()
{
    --new_called;
    std::free(p);
}

class A
{
    int data_[10];
public:
    static int count;

    A()
    {
        ++count;
        for (int i = 0; i < 10; ++i)
            
 data_[i] = i;
    }

    A(const A&) {++count;}

    ~A() {--count;}

    int operator()(int i) const
    {
        for (int j = 0; j < 10; ++j)
            i += data_[j];
        return i;
    }

    int foo(int) const {return 1;}
};

int A::count = 0;

int g(int) {return 0;}

int main()
{
    assert(new_called == 0);
    {
    std::function<int(int)> f;
    f = A();
    assert(A::count == 1);
    assert(new_called == 1);
    assert(f.target<A>());
    assert(f.target<int(*)(int)>() == 0);
    }
    assert(A::count == 0);
    assert(new_called == 0);
    {
    std::function<int(int)> f;
    f = g;
    assert(new_called == 0);
    assert(f.target<int(*)(int)>());
    assert(f.target<A>() == 0);
    }
    assert(new_called == 0);
    {
    std::function<int(int)> f;
    f = (int (*)(int))0;
    assert(!f);
    assert(new_called == 0);
    assert(f.target<int(*)(int)>() == 0);
    assert(f.target<A>() == 0);
    }
    {
    std::function<int(const A*, int)> f;
    f = &A::foo;
 
    assert(f);
    assert(new_called == 0);
    assert(f.target<int (A::*)(int) const>() != 0);
    }
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <functional>
+
+// class function<R(ArgTypes...)>
+
+// template<class F>
+//   requires CopyConstructible<F> && Callable<F, ArgTypes..>
+//         && Convertible<Callable<F, ArgTypes...>::result_type
+//   operator=(F f);
+
+#include <functional>
+#include <new>
+#include <cstdlib>
+#include <cassert>
+
+int new_called = 0;
+
+void* operator new(std::size_t s) throw(std::bad_alloc)
+{
+    ++new_called;
+    return std::malloc(s);
+}
+
+void  operator delete(void* p) throw()
+{
+    --new_called;
+    std::free(p);
+}
+
+class A
+{
+    int data_[10];
+public:
+    static int count;
+
+    A()
+    {
+        ++count;
+        for (int i = 0; i < 10; ++i)
+            data_[i] = i;
+    }
+
+    A(const A&) {++count;}
+
+    ~A() {--count;}
+
+    int operator()(int i) const
+    {
+        for (int j = 0; j < 10; ++j)
+            i += data_[j];
+        return i;
+    }
+
+    int foo(int) const {return 1;}
+};
+
+int A::count = 0;
+
+int g(int) {return 0;}
+
+int main()
+{
+    assert(new_called == 0);
+    {
+    std::function<int(int)> f;
+    f = A();
+    assert(A::count == 1);
+    assert(new_called == 1);
+    assert(f.target<A>());
+    assert(f.target<int(*)(int)>() == 0);
+    }
+    assert(A::count == 0);
+    assert(new_called == 0);
+    {
+    std::function<int(int)> f;
+    f = g;
+    assert(new_called == 0);
+    assert(f.target<int(*)(int)>());
+    assert(f.target<A>() == 0);
+    }
+    assert(new_called == 0);
+    {
+    std::function<int(int)> f;
+    f = (int (*)(int))0;
+    assert(!f);
+    assert(new_called == 0);
+    assert(f.target<int(*)(int)>() == 0);
+    assert(f.target<A>() == 0);
+    }
+    {
+    std::function<int(const A*, int)> f;
+    f = &A::foo;
+    assert(f);
+    assert(new_called == 0);
+    assert(f.target<int (A::*)(int) const>() != 0);
+    }
+}

Modified: libcxx/trunk/test/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/alloc_rfunction.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/alloc_rfunction.pass.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/alloc_rfunction.pass.cpp (original)
+++ libcxx/trunk/test/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/alloc_rfunction.pass.cpp Sat Aug 21 19:59:46 2010
@@ -77,5 +77,5 @@
     assert(f.target<A>() == 0);
     assert(f.target<int(*)(int)>() == 0);
     }
-#endif
+#endif  // _LIBCPP_MOVE
 }

Modified: libcxx/trunk/test/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/copy.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/copy.pass.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/copy.pass.cpp (original)
+++ libcxx/trunk/test/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/copy.pass.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,119 @@
-//===----------------------------------------------------------------------===//
//
//                     The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//

// <functional>

// class function<R(ArgTypes...)>

// function(const function& f);

#include <functional>
#include <new>
#include <cstdlib>
#include <cassert>

int new_called = 0;

void* operator new(std::size_t s) throw(std::bad_alloc)
{
    ++new_called;
    return std::malloc(s);
}

void  operator delete(void* p) throw()
{
    --new_called;
    std::free(p);
}

class A
{
    int data_[10];
public:
    static int count;

    A()
    {
        ++count;
        for (int i = 0; i < 10; ++i)
            data_[i] = i;
    }

    A(const A&) {++count;}

    ~A() {--count;}

    int operator()(int i) const
    {
        for (int j = 0; j < 10;
  ++j)
            i += data_[j];
        return i;
    }
};

int A::count = 0;

int g(int) {return 0;}

int main()
{
    assert(new_called == 0);
    {
    std::function<int(int)> f = A();
    assert(A::count == 1);
    assert(new_called == 1);
    assert(f.target<A>());
    assert(f.target<int(*)(int)>() == 0);
    std::function<int(int)> f2 = f;
    assert(A::count == 2);
    assert(new_called == 2);
    assert(f2.target<A>());
    assert(f2.target<int(*)(int)>() == 0);
    }
    assert(A::count == 0);
    assert(new_called == 0);
    {
    std::function<int(int)> f = g;
    assert(new_called == 0);
    assert(f.target<int(*)(int)>());
    assert(f.target<A>() == 0);
    std::function<int(int)> f2 = f;
    assert(new_called == 0);
    assert(f2.target<int(*)(int)>());
    assert(f2.target<A>() == 0);
    }
    assert(new_called == 0);
    {
    std::function<int(int)> f;
    assert(new_called == 0);
    assert(f.target<int(*)(int)>() == 0);
    assert(f.target<A>() == 0);
     std::function<int(int)> f2 = f;
    assert(new_called == 0);
    assert(f2.target<int(*)(int)>() == 0);
    assert(f2.target<A>() == 0);
    }
#ifdef _LIBCPP_MOVE
    assert(new_called == 0);
    {
    std::function<int(int)> f = A();
    assert(A::count == 1);
    assert(new_called == 1);
    assert(f.target<A>());
    assert(f.target<int(*)(int)>() == 0);
    std::function<int(int)> f2 = _STD::move(f);
    assert(A::count == 1);
    assert(new_called == 1);
    assert(f2.target<A>());
    assert(f2.target<int(*)(int)>() == 0);
    assert(f.target<A>() == 0);
    assert(f.target<int(*)(int)>() == 0);
    }
#endif
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <functional>
+
+// class function<R(ArgTypes...)>
+
+// function(const function& f);
+
+#include <functional>
+#include <new>
+#include <cstdlib>
+#include <cassert>
+
+int new_called = 0;
+
+void* operator new(std::size_t s) throw(std::bad_alloc)
+{
+    ++new_called;
+    return std::malloc(s);
+}
+
+void  operator delete(void* p) throw()
+{
+    --new_called;
+    std::free(p);
+}
+
+class A
+{
+    int data_[10];
+public:
+    static int count;
+
+    A()
+    {
+        ++count;
+        for (int i = 0; i < 10; ++i)
+            data_[i] = i;
+    }
+
+    A(const A&) {++count;}
+
+    ~A() {--count;}
+
+    int operator()(int i) const
+    {
+        for (int j = 0; j < 10; ++j)
+            i += data_[j];
+        return i;
+    }
+};
+
+int A::count = 0;
+
+int g(int) {return 0;}
+
+int main()
+{
+    assert(new_called == 0);
+    {
+    std::function<int(int)> f = A();
+    assert(A::count == 1);
+    assert(new_called == 1);
+    assert(f.target<A>());
+    assert(f.target<int(*)(int)>() == 0);
+    std::function<int(int)> f2 = f;
+    assert(A::count == 2);
+    assert(new_called == 2);
+    assert(f2.target<A>());
+    assert(f2.target<int(*)(int)>() == 0);
+    }
+    assert(A::count == 0);
+    assert(new_called == 0);
+    {
+    std::function<int(int)> f = g;
+    assert(new_called == 0);
+    assert(f.target<int(*)(int)>());
+    assert(f.target<A>() == 0);
+    std::function<int(int)> f2 = f;
+    assert(new_called == 0);
+    assert(f2.target<int(*)(int)>());
+    assert(f2.target<A>() == 0);
+    }
+    assert(new_called == 0);
+    {
+    std::function<int(int)> f;
+    assert(new_called == 0);
+    assert(f.target<int(*)(int)>() == 0);
+    assert(f.target<A>() == 0);
+    std::function<int(int)> f2 = f;
+    assert(new_called == 0);
+    assert(f2.target<int(*)(int)>() == 0);
+    assert(f2.target<A>() == 0);
+    }
+#ifdef _LIBCPP_MOVE
+    assert(new_called == 0);
+    {
+    std::function<int(int)> f = A();
+    assert(A::count == 1);
+    assert(new_called == 1);
+    assert(f.target<A>());
+    assert(f.target<int(*)(int)>() == 0);
+    std::function<int(int)> f2 = _STD::move(f);
+    assert(A::count == 1);
+    assert(new_called == 1);
+    assert(f2.target<A>());
+    assert(f2.target<int(*)(int)>() == 0);
+    assert(f.target<A>() == 0);
+    assert(f.target<int(*)(int)>() == 0);
+    }
+#endif  // _LIBCPP_MOVE
+}

Modified: libcxx/trunk/test/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/copy_assign.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/copy_assign.pass.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/copy_assign.pass.cpp (original)
+++ libcxx/trunk/test/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/copy_assign.pass.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,123 @@
-//===----------------------------------------------------------------------===//
//
//                     The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//

// <functional>

// class function<R(ArgTypes...)>

// function& operator=(const function& f);

#include <functional>
#include <new>
#include <cstdlib>
#include <cassert>

int new_called = 0;

void* operator new(std::size_t s) throw(std::bad_alloc)
{
    ++new_called;
    return std::malloc(s);
}

void  operator delete(void* p) throw()
{
    --new_called;
    std::free(p);
}

class A
{
    int data_[10];
public:
    static int count;

    A()
    {
        ++count;
        for (int i = 0; i < 10; ++i)
            data_[i] = i;
    }

    A(const A&) {++count;}

    ~A() {--count;}

    int operator()(int i) const
    {
        for (int j =
  0; j < 10; ++j)
            i += data_[j];
        return i;
    }
};

int A::count = 0;

int g(int) {return 0;}

int main()
{
    assert(new_called == 0);
    {
    std::function<int(int)> f = A();
    assert(A::count == 1);
    assert(new_called == 1);
    assert(f.target<A>());
    assert(f.target<int(*)(int)>() == 0);
    std::function<int(int)> f2;
    f2 = f;
    assert(A::count == 2);
    assert(new_called == 2);
    assert(f2.target<A>());
    assert(f2.target<int(*)(int)>() == 0);
    }
    assert(A::count == 0);
    assert(new_called == 0);
    {
    std::function<int(int)> f = g;
    assert(new_called == 0);
    assert(f.target<int(*)(int)>());
    assert(f.target<A>() == 0);
    std::function<int(int)> f2;
    f2 = f;
    assert(new_called == 0);
    assert(f2.target<int(*)(int)>());
    assert(f2.target<A>() == 0);
    }
    assert(new_called == 0);
    {
    std::function<int(int)> f;
    assert(new_called == 0);
    assert(f.target<int(*)(int)>() == 0);
    a
 ssert(f.target<A>() == 0);
    std::function<int(int)> f2;
    f2 = f;
    assert(new_called == 0);
    assert(f2.target<int(*)(int)>() == 0);
    assert(f2.target<A>() == 0);
    }
#ifdef _LIBCPP_MOVE
    assert(new_called == 0);
    {
    std::function<int(int)> f = A();
    assert(A::count == 1);
    assert(new_called == 1);
    assert(f.target<A>());
    assert(f.target<int(*)(int)>() == 0);
    std::function<int(int)> f2;
    f2 = _STD::move(f);
    assert(A::count == 1);
    assert(new_called == 1);
    assert(f2.target<A>());
    assert(f2.target<int(*)(int)>() == 0);
    assert(f.target<A>() == 0);
    assert(f.target<int(*)(int)>() == 0);
    }
#endif
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <functional>
+
+// class function<R(ArgTypes...)>
+
+// function& operator=(const function& f);
+
+#include <functional>
+#include <new>
+#include <cstdlib>
+#include <cassert>
+
+int new_called = 0;
+
+void* operator new(std::size_t s) throw(std::bad_alloc)
+{
+    ++new_called;
+    return std::malloc(s);
+}
+
+void  operator delete(void* p) throw()
+{
+    --new_called;
+    std::free(p);
+}
+
+class A
+{
+    int data_[10];
+public:
+    static int count;
+
+    A()
+    {
+        ++count;
+        for (int i = 0; i < 10; ++i)
+            data_[i] = i;
+    }
+
+    A(const A&) {++count;}
+
+    ~A() {--count;}
+
+    int operator()(int i) const
+    {
+        for (int j = 0; j < 10; ++j)
+            i += data_[j];
+        return i;
+    }
+};
+
+int A::count = 0;
+
+int g(int) {return 0;}
+
+int main()
+{
+    assert(new_called == 0);
+    {
+    std::function<int(int)> f = A();
+    assert(A::count == 1);
+    assert(new_called == 1);
+    assert(f.target<A>());
+    assert(f.target<int(*)(int)>() == 0);
+    std::function<int(int)> f2;
+    f2 = f;
+    assert(A::count == 2);
+    assert(new_called == 2);
+    assert(f2.target<A>());
+    assert(f2.target<int(*)(int)>() == 0);
+    }
+    assert(A::count == 0);
+    assert(new_called == 0);
+    {
+    std::function<int(int)> f = g;
+    assert(new_called == 0);
+    assert(f.target<int(*)(int)>());
+    assert(f.target<A>() == 0);
+    std::function<int(int)> f2;
+    f2 = f;
+    assert(new_called == 0);
+    assert(f2.target<int(*)(int)>());
+    assert(f2.target<A>() == 0);
+    }
+    assert(new_called == 0);
+    {
+    std::function<int(int)> f;
+    assert(new_called == 0);
+    assert(f.target<int(*)(int)>() == 0);
+    assert(f.target<A>() == 0);
+    std::function<int(int)> f2;
+    f2 = f;
+    assert(new_called == 0);
+    assert(f2.target<int(*)(int)>() == 0);
+    assert(f2.target<A>() == 0);
+    }
+#ifdef _LIBCPP_MOVE
+    assert(new_called == 0);
+    {
+    std::function<int(int)> f = A();
+    assert(A::count == 1);
+    assert(new_called == 1);
+    assert(f.target<A>());
+    assert(f.target<int(*)(int)>() == 0);
+    std::function<int(int)> f2;
+    f2 = _STD::move(f);
+    assert(A::count == 1);
+    assert(new_called == 1);
+    assert(f2.target<A>());
+    assert(f2.target<int(*)(int)>() == 0);
+    assert(f.target<A>() == 0);
+    assert(f.target<int(*)(int)>() == 0);
+    }
+#endif  // _LIBCPP_MOVE
+}

Modified: libcxx/trunk/test/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/default.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/default.pass.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/default.pass.cpp (original)
+++ libcxx/trunk/test/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/default.pass.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,23 @@
-//===----------------------------------------------------------------------===//
//
//                     The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//

// <functional>

// class function<R(ArgTypes...)>

// explicit function();

#include <functional>
#include <cassert>

int main()
{
    std::function<int(int)> f;
    assert(!f);
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <functional>
+
+// class function<R(ArgTypes...)>
+
+// explicit function();
+
+#include <functional>
+#include <cassert>
+
+int main()
+{
+    std::function<int(int)> f;
+    assert(!f);
+}

Modified: libcxx/trunk/test/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/nullptr_t.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/nullptr_t.pass.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/nullptr_t.pass.cpp (original)
+++ libcxx/trunk/test/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/nullptr_t.pass.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,23 @@
-//===----------------------------------------------------------------------===//
//
//                     The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//

// <functional>

// class function<R(ArgTypes...)>

// function(nullptr_t);

#include <functional>
#include <cassert>

int main()
{
    std::function<int(int)> f(nullptr);
    assert(!f);
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <functional>
+
+// class function<R(ArgTypes...)>
+
+// function(nullptr_t);
+
+#include <functional>
+#include <cassert>
+
+int main()
+{
+    std::function<int(int)> f(nullptr);
+    assert(!f);
+}

Modified: libcxx/trunk/test/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/nullptr_t_assign.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/nullptr_t_assign.pass.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/nullptr_t_assign.pass.cpp (original)
+++ libcxx/trunk/test/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/nullptr_t_assign.pass.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,86 @@
-//===----------------------------------------------------------------------===//
//
//                     The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//

// <functional>

// class function<R(ArgTypes...)>

// function& operator=(nullptr_t);

#include <functional>
#include <new>
#include <cstdlib>
#include <cassert>

int new_called = 0;

void* operator new(std::size_t s) throw(std::bad_alloc)
{
    ++new_called;
    return std::malloc(s);
}

void  operator delete(void* p) throw()
{
    --new_called;
    std::free(p);
}

class A
{
    int data_[10];
public:
    static int count;

    A()
    {
        ++count;
        for (int i = 0; i < 10; ++i)
            data_[i] = i;
    }

    A(const A&) {++count;}

    ~A() {--count;}

    int operator()(int i) const
    {
        for (int j = 0; j < 
 10; ++j)
            i += data_[j];
        return i;
    }
};

int A::count = 0;

int g(int) {return 0;}

int main()
{
    assert(new_called == 0);
    {
    std::function<int(int)> f = A();
    assert(A::count == 1);
    assert(new_called == 1);
    assert(f.target<A>());
    f = nullptr;
    assert(A::count == 0);
    assert(new_called == 0);
    assert(f.target<A>() == 0);
    }
    {
    std::function<int(int)> f = g;
    assert(new_called == 0);
    assert(f.target<int(*)(int)>());
    assert(f.target<A>() == 0);
    f = nullptr;
    assert(new_called == 0);
    assert(f.target<int(*)(int)>() == 0);
    }
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <functional>
+
+// class function<R(ArgTypes...)>
+
+// function& operator=(nullptr_t);
+
+#include <functional>
+#include <new>
+#include <cstdlib>
+#include <cassert>
+
+int new_called = 0;
+
+void* operator new(std::size_t s) throw(std::bad_alloc)
+{
+    ++new_called;
+    return std::malloc(s);
+}
+
+void  operator delete(void* p) throw()
+{
+    --new_called;
+    std::free(p);
+}
+
+class A
+{
+    int data_[10];
+public:
+    static int count;
+
+    A()
+    {
+        ++count;
+        for (int i = 0; i < 10; ++i)
+            data_[i] = i;
+    }
+
+    A(const A&) {++count;}
+
+    ~A() {--count;}
+
+    int operator()(int i) const
+    {
+        for (int j = 0; j < 10; ++j)
+            i += data_[j];
+        return i;
+    }
+};
+
+int A::count = 0;
+
+int g(int) {return 0;}
+
+int main()
+{
+    assert(new_called == 0);
+    {
+    std::function<int(int)> f = A();
+    assert(A::count == 1);
+    assert(new_called == 1);
+    assert(f.target<A>());
+    f = nullptr;
+    assert(A::count == 0);
+    assert(new_called == 0);
+    assert(f.target<A>() == 0);
+    }
+    {
+    std::function<int(int)> f = g;
+    assert(new_called == 0);
+    assert(f.target<int(*)(int)>());
+    assert(f.target<A>() == 0);
+    f = nullptr;
+    assert(new_called == 0);
+    assert(f.target<int(*)(int)>() == 0);
+    }
+}

Modified: libcxx/trunk/test/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.inv/invoke.fail.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.inv/invoke.fail.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.inv/invoke.fail.cpp (original)
+++ libcxx/trunk/test/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.inv/invoke.fail.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,46 @@
-//===----------------------------------------------------------------------===//
//
//                     The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//

// <functional>

// class function<R(ArgTypes...)>

// R operator()(ArgTypes... args) const

#include <functional>
#include <cassert>

// member data pointer:  cv qualifiers should transfer from argument to return type

struct A_int_1
{
    A_int_1() : data_(5) {}

    int data_;
};

void
test_int_1()
{
    // member data pointer
    {
    int A_int_1::*fp = &A_int_1::data_;
    A_int_1 a;
    std::function<int& (const A_int_1*)> r2(fp);
    const A_int_1* ap = &a;
    assert(r2(ap) == 6);
    r2(ap) = 7;
    assert(r2(ap) == 7);
    }
}


int main()
{
    test_int_1();
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <functional>
+
+// class function<R(ArgTypes...)>
+
+// R operator()(ArgTypes... args) const
+
+#include <functional>
+#include <cassert>
+
+// member data pointer:  cv qualifiers should transfer from argument to return type
+
+struct A_int_1
+{
+    A_int_1() : data_(5) {}
+
+    int data_;
+};
+
+void
+test_int_1()
+{
+    // member data pointer
+    {
+    int A_int_1::*fp = &A_int_1::data_;
+    A_int_1 a;
+    std::function<int& (const A_int_1*)> r2(fp);
+    const A_int_1* ap = &a;
+    assert(r2(ap) == 6);
+    r2(ap) = 7;
+    assert(r2(ap) == 7);
+    }
+}
+
+int main()
+{
+    test_int_1();
+}

Modified: libcxx/trunk/test/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.inv/invoke.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.inv/invoke.pass.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.inv/invoke.pass.cpp (original)
+++ libcxx/trunk/test/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.inv/invoke.pass.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,335 @@
-//===----------------------------------------------------------------------===//
//
//                     The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//

// <functional>

// class function<R(ArgTypes...)>

// R operator()(ArgTypes... args) const

#include <functional>
#include <cassert>

int count = 0;

// 1 arg, return void

void f_void_1(int i)
{
    count += i;
}

struct A_void_1
{
    void operator()(int i)
    {
        count += i;
    }

    void mem1() {++count;}
    void mem2() const {++count;}
};

void
test_void_1()
{
    int save_count = count;
    // function
    {
    std::function<void (int)> r1(f_void_1);
    int i = 2;
    r1(i);
    assert(count == save_count+2);
    save_count = count;
    }
    // function pointer
    {
    void (*fp)(int) = f_void_1;
    std::function<voi
 d (int)> r1(fp);
    int i = 3;
    r1(i);
    assert(count == save_count+3);
    save_count = count;
    }
    // functor
    {
    A_void_1 a0;
    std::function<void (int)> r1(a0);
    int i = 4;
    r1(i);
    assert(count == save_count+4);
    save_count = count;
    }
    // member function pointer
    {
    void (A_void_1::*fp)() = &A_void_1::mem1;
    std::function<void (A_void_1)> r1(fp);
    A_void_1 a;
    r1(a);
    assert(count == save_count+1);
    save_count = count;
    A_void_1* ap = &a;
    std::function<void (A_void_1*)> r2 = fp;
    r2(ap);
    assert(count == save_count+1);
    save_count = count;
    }
    // const member function pointer
    {
    void (A_void_1::*fp)() const = &A_void_1::mem2;
    std::function<void (A_void_1)> r1(fp);
    A_void_1 a;
    r1(a);
    assert(count == save_count+1);
    save_count = count;
    std::function<void (A_void_1*)> r2(fp);
    A_void_1* ap = &a;
    r2(ap);
    assert(count == save_count+1);
    save_count = co
 unt;
    }
}

// 1 arg, return int

int f_int_1(int i)
{
    return i + 1;
}

struct A_int_1
{
    A_int_1() : data_(5) {}
    int operator()(int i)
    {
        return i - 1;
    }

    int mem1() {return 3;}
    int mem2() const {return 4;}
    int data_;
};

void
test_int_1()
{
    // function
    {
    std::function<int (int)> r1(f_int_1);
    int i = 2;
    assert(r1(i) == 3);
    }
    // function pointer
    {
    int (*fp)(int) = f_int_1;
    std::function<int (int)> r1(fp);
    int i = 3;
    assert(r1(i) == 4);
    }
    // functor
    {
    A_int_1 a0;
    std::function<int (int)> r1(a0);
    int i = 4;
    assert(r1(i) == 3);
    }
    // member function pointer
    {
    int (A_int_1::*fp)() = &A_int_1::mem1;
    std::function<int (A_int_1)> r1(fp);
    A_int_1 a;
    assert(r1(a) == 3);
    std::function<int (A_int_1*)> r2(fp);
    A_int_1* ap = &a;
    assert(r2(ap) == 3);
    }
    // const member function pointer
    {
    int (A_int_1::*fp)() const = &A_in
 t_1::mem2;
    std::function<int (A_int_1)> r1(fp);
    A_int_1 a;
    assert(r1(a) == 4);
    std::function<int (A_int_1*)> r2(fp);
    A_int_1* ap = &a;
    assert(r2(ap) == 4);
    }
    // member data pointer
    {
    int A_int_1::*fp = &A_int_1::data_;
    std::function<int& (A_int_1&)> r1(fp);
    A_int_1 a;
    assert(r1(a) == 5);
    r1(a) = 6;
    assert(r1(a) == 6);
    std::function<int& (A_int_1*)> r2(fp);
    A_int_1* ap = &a;
    assert(r2(ap) == 6);
    r2(ap) = 7;
    assert(r2(ap) == 7);
    }
}

// 2 arg, return void

void f_void_2(int i, int j)
{
    count += i+j;
}

struct A_void_2
{
    void operator()(int i, int j)
    {
        count += i+j;
    }

    void mem1(int i) {count += i;}
    void mem2(int i) const {count += i;}
};

void
test_void_2()
{
    int save_count = count;
    // function
    {
    std::function<void (int, int)> r1(f_void_2);
    int i = 2;
    int j = 3;
    r1(i, j);
    assert(count == save_count+5);
    save_count = count;
    }
 
    // function pointer
    {
    void (*fp)(int, int) = f_void_2;
    std::function<void (int, int)> r1(fp);
    int i = 3;
    int j = 4;
    r1(i, j);
    assert(count == save_count+7);
    save_count = count;
    }
    // functor
    {
    A_void_2 a0;
    std::function<void (int, int)> r1(a0);
    int i = 4;
    int j = 5;
    r1(i, j);
    assert(count == save_count+9);
    save_count = count;
    }
    // member function pointer
    {
    void (A_void_2::*fp)(int) = &A_void_2::mem1;
    std::function<void (A_void_2, int)> r1(fp);
    A_void_2 a;
    int i = 3;
    r1(a, i);
    assert(count == save_count+3);
    save_count = count;
    std::function<void (A_void_2*, int)> r2(fp);
    A_void_2* ap = &a;
    r2(ap, i);
    assert(count == save_count+3);
    save_count = count;
    }
    // const member function pointer
    {
    void (A_void_2::*fp)(int) const = &A_void_2::mem2;
    std::function<void (A_void_2, int)> r1(fp);
    A_void_2 a;
    int i = 4;
    r1(a, i)
 ;
    assert(count == save_count+4);
    save_count = count;
    std::function<void (A_void_2*, int)> r2(fp);
    A_void_2* ap = &a;
    r2(ap, i);
    assert(count == save_count+4);
    save_count = count;
    }
}

// 2 arg, return int

int f_int_2(int i, int j)
{
    return i+j;
}

struct A_int_2
{
    int operator()(int i, int j)
    {
        return i+j;
    }

    int mem1(int i) {return i+1;}
    int mem2(int i) const {return i+2;}
};

void
testint_2()
{
    // function
    {
    std::function<int (int, int)> r1(f_int_2);
    int i = 2;
    int j = 3;
    assert(r1(i, j) == i+j);
    }
    // function pointer
    {
    int (*fp)(int, int) = f_int_2;
    std::function<int (int, int)> r1(fp);
    int i = 3;
    int j = 4;
    assert(r1(i, j) == i+j);
    }
    // functor
    {
    A_int_2 a0;
    std::function<int (int, int)> r1(a0);
    int i = 4;
    int j = 5;
    assert(r1(i, j) == i+j);
    }
    // member function pointer
    {
    int(A_int_2::*fp)(int) = &A_int_2
 ::mem1;
    std::function<int (A_int_2, int)> r1(fp);
    A_int_2 a;
    int i = 3;
    assert(r1(a, i) == i+1);
    std::function<int (A_int_2*, int)> r2(fp);
    A_int_2* ap = &a;
    assert(r2(ap, i) == i+1);
    }
    // const member function pointer
    {
    int (A_int_2::*fp)(int) const = &A_int_2::mem2;
    std::function<int (A_int_2, int)> r1(fp);
    A_int_2 a;
    int i = 4;
    assert(r1(a, i) == i+2);
    std::function<int (A_int_2*, int)> r2(fp);
    A_int_2* ap = &a;
    assert(r2(ap, i) == i+2);
    }
}

int main()
{
    test_void_1();
    test_int_1();
    test_void_2();
    testint_2();
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <functional>
+
+// class function<R(ArgTypes...)>
+
+// R operator()(ArgTypes... args) const
+
+#include <functional>
+#include <cassert>
+
+int count = 0;
+
+// 1 arg, return void
+
+void f_void_1(int i)
+{
+    count += i;
+}
+
+struct A_void_1
+{
+    void operator()(int i)
+    {
+        count += i;
+    }
+
+    void mem1() {++count;}
+    void mem2() const {++count;}
+};
+
+void
+test_void_1()
+{
+    int save_count = count;
+    // function
+    {
+    std::function<void (int)> r1(f_void_1);
+    int i = 2;
+    r1(i);
+    assert(count == save_count+2);
+    save_count = count;
+    }
+    // function pointer
+    {
+    void (*fp)(int) = f_void_1;
+    std::function<void (int)> r1(fp);
+    int i = 3;
+    r1(i);
+    assert(count == save_count+3);
+    save_count = count;
+    }
+    // functor
+    {
+    A_void_1 a0;
+    std::function<void (int)> r1(a0);
+    int i = 4;
+    r1(i);
+    assert(count == save_count+4);
+    save_count = count;
+    }
+    // member function pointer
+    {
+    void (A_void_1::*fp)() = &A_void_1::mem1;
+    std::function<void (A_void_1)> r1(fp);
+    A_void_1 a;
+    r1(a);
+    assert(count == save_count+1);
+    save_count = count;
+    A_void_1* ap = &a;
+    std::function<void (A_void_1*)> r2 = fp;
+    r2(ap);
+    assert(count == save_count+1);
+    save_count = count;
+    }
+    // const member function pointer
+    {
+    void (A_void_1::*fp)() const = &A_void_1::mem2;
+    std::function<void (A_void_1)> r1(fp);
+    A_void_1 a;
+    r1(a);
+    assert(count == save_count+1);
+    save_count = count;
+    std::function<void (A_void_1*)> r2(fp);
+    A_void_1* ap = &a;
+    r2(ap);
+    assert(count == save_count+1);
+    save_count = count;
+    }
+}
+
+// 1 arg, return int
+
+int f_int_1(int i)
+{
+    return i + 1;
+}
+
+struct A_int_1
+{
+    A_int_1() : data_(5) {}
+    int operator()(int i)
+    {
+        return i - 1;
+    }
+
+    int mem1() {return 3;}
+    int mem2() const {return 4;}
+    int data_;
+};
+
+void
+test_int_1()
+{
+    // function
+    {
+    std::function<int (int)> r1(f_int_1);
+    int i = 2;
+    assert(r1(i) == 3);
+    }
+    // function pointer
+    {
+    int (*fp)(int) = f_int_1;
+    std::function<int (int)> r1(fp);
+    int i = 3;
+    assert(r1(i) == 4);
+    }
+    // functor
+    {
+    A_int_1 a0;
+    std::function<int (int)> r1(a0);
+    int i = 4;
+    assert(r1(i) == 3);
+    }
+    // member function pointer
+    {
+    int (A_int_1::*fp)() = &A_int_1::mem1;
+    std::function<int (A_int_1)> r1(fp);
+    A_int_1 a;
+    assert(r1(a) == 3);
+    std::function<int (A_int_1*)> r2(fp);
+    A_int_1* ap = &a;
+    assert(r2(ap) == 3);
+    }
+    // const member function pointer
+    {
+    int (A_int_1::*fp)() const = &A_int_1::mem2;
+    std::function<int (A_int_1)> r1(fp);
+    A_int_1 a;
+    assert(r1(a) == 4);
+    std::function<int (A_int_1*)> r2(fp);
+    A_int_1* ap = &a;
+    assert(r2(ap) == 4);
+    }
+    // member data pointer
+    {
+    int A_int_1::*fp = &A_int_1::data_;
+    std::function<int& (A_int_1&)> r1(fp);
+    A_int_1 a;
+    assert(r1(a) == 5);
+    r1(a) = 6;
+    assert(r1(a) == 6);
+    std::function<int& (A_int_1*)> r2(fp);
+    A_int_1* ap = &a;
+    assert(r2(ap) == 6);
+    r2(ap) = 7;
+    assert(r2(ap) == 7);
+    }
+}
+
+// 2 arg, return void
+
+void f_void_2(int i, int j)
+{
+    count += i+j;
+}
+
+struct A_void_2
+{
+    void operator()(int i, int j)
+    {
+        count += i+j;
+    }
+
+    void mem1(int i) {count += i;}
+    void mem2(int i) const {count += i;}
+};
+
+void
+test_void_2()
+{
+    int save_count = count;
+    // function
+    {
+    std::function<void (int, int)> r1(f_void_2);
+    int i = 2;
+    int j = 3;
+    r1(i, j);
+    assert(count == save_count+5);
+    save_count = count;
+    }
+    // function pointer
+    {
+    void (*fp)(int, int) = f_void_2;
+    std::function<void (int, int)> r1(fp);
+    int i = 3;
+    int j = 4;
+    r1(i, j);
+    assert(count == save_count+7);
+    save_count = count;
+    }
+    // functor
+    {
+    A_void_2 a0;
+    std::function<void (int, int)> r1(a0);
+    int i = 4;
+    int j = 5;
+    r1(i, j);
+    assert(count == save_count+9);
+    save_count = count;
+    }
+    // member function pointer
+    {
+    void (A_void_2::*fp)(int) = &A_void_2::mem1;
+    std::function<void (A_void_2, int)> r1(fp);
+    A_void_2 a;
+    int i = 3;
+    r1(a, i);
+    assert(count == save_count+3);
+    save_count = count;
+    std::function<void (A_void_2*, int)> r2(fp);
+    A_void_2* ap = &a;
+    r2(ap, i);
+    assert(count == save_count+3);
+    save_count = count;
+    }
+    // const member function pointer
+    {
+    void (A_void_2::*fp)(int) const = &A_void_2::mem2;
+    std::function<void (A_void_2, int)> r1(fp);
+    A_void_2 a;
+    int i = 4;
+    r1(a, i);
+    assert(count == save_count+4);
+    save_count = count;
+    std::function<void (A_void_2*, int)> r2(fp);
+    A_void_2* ap = &a;
+    r2(ap, i);
+    assert(count == save_count+4);
+    save_count = count;
+    }
+}
+
+// 2 arg, return int
+
+int f_int_2(int i, int j)
+{
+    return i+j;
+}
+
+struct A_int_2
+{
+    int operator()(int i, int j)
+    {
+        return i+j;
+    }
+
+    int mem1(int i) {return i+1;}
+    int mem2(int i) const {return i+2;}
+};
+
+void
+testint_2()
+{
+    // function
+    {
+    std::function<int (int, int)> r1(f_int_2);
+    int i = 2;
+    int j = 3;
+    assert(r1(i, j) == i+j);
+    }
+    // function pointer
+    {
+    int (*fp)(int, int) = f_int_2;
+    std::function<int (int, int)> r1(fp);
+    int i = 3;
+    int j = 4;
+    assert(r1(i, j) == i+j);
+    }
+    // functor
+    {
+    A_int_2 a0;
+    std::function<int (int, int)> r1(a0);
+    int i = 4;
+    int j = 5;
+    assert(r1(i, j) == i+j);
+    }
+    // member function pointer
+    {
+    int(A_int_2::*fp)(int) = &A_int_2::mem1;
+    std::function<int (A_int_2, int)> r1(fp);
+    A_int_2 a;
+    int i = 3;
+    assert(r1(a, i) == i+1);
+    std::function<int (A_int_2*, int)> r2(fp);
+    A_int_2* ap = &a;
+    assert(r2(ap, i) == i+1);
+    }
+    // const member function pointer
+    {
+    int (A_int_2::*fp)(int) const = &A_int_2::mem2;
+    std::function<int (A_int_2, int)> r1(fp);
+    A_int_2 a;
+    int i = 4;
+    assert(r1(a, i) == i+2);
+    std::function<int (A_int_2*, int)> r2(fp);
+    A_int_2* ap = &a;
+    assert(r2(ap, i) == i+2);
+    }
+}
+
+int main()
+{
+    test_void_1();
+    test_int_1();
+    test_void_2();
+    testint_2();
+}

Modified: libcxx/trunk/test/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.inv/invoke_int_0.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.inv/invoke_int_0.pass.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.inv/invoke_int_0.pass.cpp (original)
+++ libcxx/trunk/test/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.inv/invoke_int_0.pass.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,58 @@
-//===----------------------------------------------------------------------===//
//
//                     The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//

// <functional>

// class function<R(ArgTypes...)>

// R operator()(ArgTypes... args) const

#include <functional>
#include <cassert>

// 0 args, return int

int count = 0;

int f_int_0()
{
    return 3;
}

struct A_int_0
{
    int operator()() {return 4;}
};

void
test_int_0()
{
    // function
    {
    std::function<int ()> r1(f_int_0);
    assert(r1() == 3);
    }
    // function pointer
    {
    int (*fp)() = f_int_0;
    std::function<int ()> r1(fp);
    assert(r1() == 3);
    }
    // functor
    {
    A_int_0 a0;
    std::function<int ()> r1(a0);
    assert(r1() == 4);
    }
}

int main()
{
    test_int_0();
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <functional>
+
+// class function<R(ArgTypes...)>
+
+// R operator()(ArgTypes... args) const
+
+#include <functional>
+#include <cassert>
+
+// 0 args, return int
+
+int count = 0;
+
+int f_int_0()
+{
+    return 3;
+}
+
+struct A_int_0
+{
+    int operator()() {return 4;}
+};
+
+void
+test_int_0()
+{
+    // function
+    {
+    std::function<int ()> r1(f_int_0);
+    assert(r1() == 3);
+    }
+    // function pointer
+    {
+    int (*fp)() = f_int_0;
+    std::function<int ()> r1(fp);
+    assert(r1() == 3);
+    }
+    // functor
+    {
+    A_int_0 a0;
+    std::function<int ()> r1(a0);
+    assert(r1() == 4);
+    }
+}
+
+int main()
+{
+    test_int_0();
+}

Modified: libcxx/trunk/test/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.inv/invoke_void_0.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.inv/invoke_void_0.pass.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.inv/invoke_void_0.pass.cpp (original)
+++ libcxx/trunk/test/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.inv/invoke_void_0.pass.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,67 @@
-//===----------------------------------------------------------------------===//
//
//                     The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//

// <functional>

// class function<R(ArgTypes...)>

// R operator()(ArgTypes... args) const

#include <functional>
#include <new>
#include <cstdlib>
#include <cassert>

// 0 args, return void

int count = 0;

void f_void_0()
{
    ++count;
}

struct A_void_0
{
    void operator()() {++count;}
};

void
test_void_0()
{
    int save_count = count;
    // function
    {
    std::function<void ()> r1(f_void_0);
    r1();
    assert(count == save_count+1);
    save_count = count;
    }
    // function pointer
    {
    void (*fp)() = f_void_0;
    std::function<void ()> r1(fp);
    r1();
    assert(count == save_count+1);
    save_count = count;
 
    }
    // functor
    {
    A_void_0 a0;
    std::function<void ()> r1(a0);
    r1();
    assert(count == save_count+1);
    save_count = count;
    }
}

int main()
{
    test_void_0();
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <functional>
+
+// class function<R(ArgTypes...)>
+
+// R operator()(ArgTypes... args) const
+
+#include <functional>
+#include <new>
+#include <cstdlib>
+#include <cassert>
+
+// 0 args, return void
+
+int count = 0;
+
+void f_void_0()
+{
+    ++count;
+}
+
+struct A_void_0
+{
+    void operator()() {++count;}
+};
+
+void
+test_void_0()
+{
+    int save_count = count;
+    // function
+    {
+    std::function<void ()> r1(f_void_0);
+    r1();
+    assert(count == save_count+1);
+    save_count = count;
+    }
+    // function pointer
+    {
+    void (*fp)() = f_void_0;
+    std::function<void ()> r1(fp);
+    r1();
+    assert(count == save_count+1);
+    save_count = count;
+    }
+    // functor
+    {
+    A_void_0 a0;
+    std::function<void ()> r1(a0);
+    r1();
+    assert(count == save_count+1);
+    save_count = count;
+    }
+}
+
+int main()
+{
+    test_void_0();
+}

Modified: libcxx/trunk/test/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.mod/swap.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.mod/swap.pass.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.mod/swap.pass.cpp (original)
+++ libcxx/trunk/test/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.mod/swap.pass.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,134 @@
-//===----------------------------------------------------------------------===//
//
//                     The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//

// <functional>

// class function<R(ArgTypes...)>

// void swap(function& other);

#include <functional>
#include <new>
#include <cstdlib>
#include <cassert>

int new_called = 0;

void* operator new(std::size_t s) throw(std::bad_alloc)
{
    ++new_called;
    return std::malloc(s);
}

void  operator delete(void* p) throw()
{
    --new_called;
    std::free(p);
}

class A
{
    int data_[10];
public:
    static int count;

    explicit A(int j)
    {
        ++count;
        data_[0] = j;
    }

    A(const A& a)
    {
        ++count;
        for (int i = 0; i < 10; ++i)
            data_[i] = a.data_[i];
    }

    ~A() {--count;}

    i
 nt operator()(int i) const
    {
        for (int j = 0; j < 10; ++j)
            i += data_[j];
        return i;
    }

    int id() const {return data_[0];}
};

int A::count = 0;

int g(int) {return 0;}
int h(int) {return 1;}

int main()
{
    assert(new_called == 0);
    {
    std::function<int(int)> f1 = A(1);
    std::function<int(int)> f2 = A(2);
    assert(A::count == 2);
    assert(new_called == 2);
    assert(f1.target<A>()->id() == 1);
    assert(f2.target<A>()->id() == 2);
    f1.swap(f2);
    assert(A::count == 2);
    assert(new_called == 2);
    assert(f1.target<A>()->id() == 2);
    assert(f2.target<A>()->id() == 1);
    }
    assert(A::count == 0);
    assert(new_called == 0);
    {
    std::function<int(int)> f1 = A(1);
    std::function<int(int)> f2 = g;
    assert(A::count == 1);
    assert(new_called == 1);
    assert(f1.target<A>()->id() == 1);
    assert(*f2.target<int(*)(int)>() == g);
    f1.swap(f2);
    assert(A::count == 1);
    assert(new_called 
 == 1);
    assert(*f1.target<int(*)(int)>() == g);
    assert(f2.target<A>()->id() == 1);
    }
    assert(A::count == 0);
    assert(new_called == 0);
    {
    std::function<int(int)> f1 = g;
    std::function<int(int)> f2 = A(1);
    assert(A::count == 1);
    assert(new_called == 1);
    assert(*f1.target<int(*)(int)>() == g);
    assert(f2.target<A>()->id() == 1);
    f1.swap(f2);
    assert(A::count == 1);
    assert(new_called == 1);
    assert(f1.target<A>()->id() == 1);
    assert(*f2.target<int(*)(int)>() == g);
    }
    assert(A::count == 0);
    assert(new_called == 0);
    {
    std::function<int(int)> f1 = g;
    std::function<int(int)> f2 = h;
    assert(A::count == 0);
    assert(new_called == 0);
    assert(*f1.target<int(*)(int)>() == g);
    assert(*f2.target<int(*)(int)>() == h);
    f1.swap(f2);
    assert(A::count == 0);
    assert(new_called == 0);
    assert(*f1.target<int(*)(int)>() == h);
    assert(*f2.target<int(*)(int)>() == g);
    }
    assert
 (A::count == 0);
    assert(new_called == 0);
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <functional>
+
+// class function<R(ArgTypes...)>
+
+// void swap(function& other);
+
+#include <functional>
+#include <new>
+#include <cstdlib>
+#include <cassert>
+
+int new_called = 0;
+
+void* operator new(std::size_t s) throw(std::bad_alloc)
+{
+    ++new_called;
+    return std::malloc(s);
+}
+
+void  operator delete(void* p) throw()
+{
+    --new_called;
+    std::free(p);
+}
+
+class A
+{
+    int data_[10];
+public:
+    static int count;
+
+    explicit A(int j)
+    {
+        ++count;
+        data_[0] = j;
+    }
+
+    A(const A& a)
+    {
+        ++count;
+        for (int i = 0; i < 10; ++i)
+            data_[i] = a.data_[i];
+    }
+
+    ~A() {--count;}
+
+    int operator()(int i) const
+    {
+        for (int j = 0; j < 10; ++j)
+            i += data_[j];
+        return i;
+    }
+
+    int id() const {return data_[0];}
+};
+
+int A::count = 0;
+
+int g(int) {return 0;}
+int h(int) {return 1;}
+
+int main()
+{
+    assert(new_called == 0);
+    {
+    std::function<int(int)> f1 = A(1);
+    std::function<int(int)> f2 = A(2);
+    assert(A::count == 2);
+    assert(new_called == 2);
+    assert(f1.target<A>()->id() == 1);
+    assert(f2.target<A>()->id() == 2);
+    f1.swap(f2);
+    assert(A::count == 2);
+    assert(new_called == 2);
+    assert(f1.target<A>()->id() == 2);
+    assert(f2.target<A>()->id() == 1);
+    }
+    assert(A::count == 0);
+    assert(new_called == 0);
+    {
+    std::function<int(int)> f1 = A(1);
+    std::function<int(int)> f2 = g;
+    assert(A::count == 1);
+    assert(new_called == 1);
+    assert(f1.target<A>()->id() == 1);
+    assert(*f2.target<int(*)(int)>() == g);
+    f1.swap(f2);
+    assert(A::count == 1);
+    assert(new_called == 1);
+    assert(*f1.target<int(*)(int)>() == g);
+    assert(f2.target<A>()->id() == 1);
+    }
+    assert(A::count == 0);
+    assert(new_called == 0);
+    {
+    std::function<int(int)> f1 = g;
+    std::function<int(int)> f2 = A(1);
+    assert(A::count == 1);
+    assert(new_called == 1);
+    assert(*f1.target<int(*)(int)>() == g);
+    assert(f2.target<A>()->id() == 1);
+    f1.swap(f2);
+    assert(A::count == 1);
+    assert(new_called == 1);
+    assert(f1.target<A>()->id() == 1);
+    assert(*f2.target<int(*)(int)>() == g);
+    }
+    assert(A::count == 0);
+    assert(new_called == 0);
+    {
+    std::function<int(int)> f1 = g;
+    std::function<int(int)> f2 = h;
+    assert(A::count == 0);
+    assert(new_called == 0);
+    assert(*f1.target<int(*)(int)>() == g);
+    assert(*f2.target<int(*)(int)>() == h);
+    f1.swap(f2);
+    assert(A::count == 0);
+    assert(new_called == 0);
+    assert(*f1.target<int(*)(int)>() == h);
+    assert(*f2.target<int(*)(int)>() == g);
+    }
+    assert(A::count == 0);
+    assert(new_called == 0);
+}

Modified: libcxx/trunk/test/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.nullptr/operator_==.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.nullptr/operator_%3D%3D.pass.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.nullptr/operator_==.pass.cpp (original)
+++ libcxx/trunk/test/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.nullptr/operator_==.pass.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,41 @@
-//===----------------------------------------------------------------------===//
//
//                     The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//

// <functional>

// class function<R(ArgTypes...)>

// template <MoveConstructible R, MoveConstructible ... ArgTypes> 
//   bool operator==(const function<R(ArgTypes...)>&, nullptr_t); 
// 
// template <MoveConstructible R, MoveConstructible ... ArgTypes> 
//   bool operator==(nullptr_t, const function<R(ArgTypes...)>&); 
// 
// template <MoveConstructible R, MoveConstructible ... ArgTypes> 
//   bool operator!=(const function<R(ArgTypes...)>&, nullptr_t); 
// 
// template <MoveConstructible  R, MoveConstructible ... ArgTypes> 
//   bool operator!=(nullptr_t, const function<R(ArgTypes...)>&); 

#include <functional>
#include <cassert>

int
  g(int) {return 0;}

int main()
{
    {
    std::function<int(int)> f;
    assert(f == nullptr);
    assert(nullptr == f);
    f = g;
    assert(f != nullptr);
    assert(nullptr != f);
    }
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <functional>
+
+// class function<R(ArgTypes...)>
+
+// template <MoveConstructible R, MoveConstructible ... ArgTypes>
+//   bool operator==(const function<R(ArgTypes...)>&, nullptr_t);
+//
+// template <MoveConstructible R, MoveConstructible ... ArgTypes>
+//   bool operator==(nullptr_t, const function<R(ArgTypes...)>&);
+//
+// template <MoveConstructible R, MoveConstructible ... ArgTypes>
+//   bool operator!=(const function<R(ArgTypes...)>&, nullptr_t);
+//
+// template <MoveConstructible  R, MoveConstructible ... ArgTypes>
+//   bool operator!=(nullptr_t, const function<R(ArgTypes...)>&);
+
+#include <functional>
+#include <cassert>
+
+int g(int) {return 0;}
+
+int main()
+{
+    {
+    std::function<int(int)> f;
+    assert(f == nullptr);
+    assert(nullptr == f);
+    f = g;
+    assert(f != nullptr);
+    assert(nullptr != f);
+    }
+}

Modified: libcxx/trunk/test/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.targ/target.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.targ/target.pass.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.targ/target.pass.cpp (original)
+++ libcxx/trunk/test/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.targ/target.pass.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,89 @@
-//===----------------------------------------------------------------------===//
//
//                     The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//

// <functional>

// class function<R(ArgTypes...)>

// template<typename T> 
//   requires Callable<T, ArgTypes...> && Convertible<Callable<T, ArgTypes...>::result_type, R> 
//   T*
//   target(); 
// template<typename T> 
//   requires Callable<T, ArgTypes...> && Convertible<Callable<T, ArgTypes...>::result_type, R> 
//   const T*
//   target() const;

#include <functional>
#include <new>
#include <cstdlib>
#include <cassert>

class A
{
    int data_[10];
public:
    static int count;

    A()
    {
        ++count;
        for (int i = 0; i < 10; ++i)
            data_[i] = i;
    }

    A(const A&) {++count;}

    ~A() {--count;}

    i
 nt operator()(int i) const
    {
        for (int j = 0; j < 10; ++j)
            i += data_[j];
        return i;
    }

    int foo(int) const {return 1;}
};

int A::count = 0;

int g(int) {return 0;}

int main()
{
    {
    std::function<int(int)> f = A();
    assert(A::count == 1);
    assert(f.target<A>());
    assert(f.target<int(*)(int)>() == 0);
    }
    assert(A::count == 0);
    {
    std::function<int(int)> f = g;
    assert(A::count == 0);
    assert(f.target<int(*)(int)>());
    assert(f.target<A>() == 0);
    }
    assert(A::count == 0);
    {
    const std::function<int(int)> f = A();
    assert(A::count == 1);
    assert(f.target<A>());
    assert(f.target<int(*)(int)>() == 0);
    }
    assert(A::count == 0);
    {
    const std::function<int(int)> f = g;
    assert(A::count == 0);
    assert(f.target<int(*)(int)>());
    assert(f.target<A>() == 0);
    }
    assert(A::count == 0);
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <functional>
+
+// class function<R(ArgTypes...)>
+
+// template<typename T>
+//   requires Callable<T, ArgTypes...> && Convertible<Callable<T, ArgTypes...>::result_type, R>
+//   T*
+//   target();
+// template<typename T>
+//   requires Callable<T, ArgTypes...> && Convertible<Callable<T, ArgTypes...>::result_type, R>
+//   const T*
+//   target() const;
+
+#include <functional>
+#include <new>
+#include <cstdlib>
+#include <cassert>
+
+class A
+{
+    int data_[10];
+public:
+    static int count;
+
+    A()
+    {
+        ++count;
+        for (int i = 0; i < 10; ++i)
+            data_[i] = i;
+    }
+
+    A(const A&) {++count;}
+
+    ~A() {--count;}
+
+    int operator()(int i) const
+    {
+        for (int j = 0; j < 10; ++j)
+            i += data_[j];
+        return i;
+    }
+
+    int foo(int) const {return 1;}
+};
+
+int A::count = 0;
+
+int g(int) {return 0;}
+
+int main()
+{
+    {
+    std::function<int(int)> f = A();
+    assert(A::count == 1);
+    assert(f.target<A>());
+    assert(f.target<int(*)(int)>() == 0);
+    }
+    assert(A::count == 0);
+    {
+    std::function<int(int)> f = g;
+    assert(A::count == 0);
+    assert(f.target<int(*)(int)>());
+    assert(f.target<A>() == 0);
+    }
+    assert(A::count == 0);
+    {
+    const std::function<int(int)> f = A();
+    assert(A::count == 1);
+    assert(f.target<A>());
+    assert(f.target<int(*)(int)>() == 0);
+    }
+    assert(A::count == 0);
+    {
+    const std::function<int(int)> f = g;
+    assert(A::count == 0);
+    assert(f.target<int(*)(int)>());
+    assert(f.target<A>() == 0);
+    }
+    assert(A::count == 0);
+}

Modified: libcxx/trunk/test/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.targ/target_type.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.targ/target_type.pass.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.targ/target_type.pass.cpp (original)
+++ libcxx/trunk/test/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.targ/target_type.pass.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,61 @@
-//===----------------------------------------------------------------------===//
//
//                     The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//

// <functional>

// class function<R(ArgTypes...)>

// const std::type_info& target_type() const;

#include <functional>
#include <typeinfo>
#include <cassert>

class A
{
    int data_[10];
public:
    static int count;

    A()
    {
        ++count;
        for (int i = 0; i < 10; ++i)
            data_[i] = i;
    }

    A(const A&) {++count;}

    ~A() {--count;}

    int operator()(int i) const
    {
        for (int j = 0; j < 10; ++j)
            i += data_[j];
        return i;
    }

    int foo(int) const {return 1;}
};

int A::count = 0;

int g(int) {return 0;}

int main()
{
    {
    std::function<int(int)> f = A();
    assert(
 f.target_type() == typeid(A));
    }
    {
    std::function<int(int)> f;
    assert(f.target_type() == typeid(void));
    }
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <functional>
+
+// class function<R(ArgTypes...)>
+
+// const std::type_info& target_type() const;
+
+#include <functional>
+#include <typeinfo>
+#include <cassert>
+
+class A
+{
+    int data_[10];
+public:
+    static int count;
+
+    A()
+    {
+        ++count;
+        for (int i = 0; i < 10; ++i)
+            data_[i] = i;
+    }
+
+    A(const A&) {++count;}
+
+    ~A() {--count;}
+
+    int operator()(int i) const
+    {
+        for (int j = 0; j < 10; ++j)
+            i += data_[j];
+        return i;
+    }
+
+    int foo(int) const {return 1;}
+};
+
+int A::count = 0;
+
+int g(int) {return 0;}
+
+int main()
+{
+    {
+    std::function<int(int)> f = A();
+    assert(f.target_type() == typeid(A));
+    }
+    {
+    std::function<int(int)> f;
+    assert(f.target_type() == typeid(void));
+    }
+}

Modified: libcxx/trunk/test/utilities/function.objects/func.wrap/func.wrap.func/test_allocator.h
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/function.objects/func.wrap/func.wrap.func/test_allocator.h?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/function.objects/func.wrap/func.wrap.func/test_allocator.h (original)
+++ libcxx/trunk/test/utilities/function.objects/func.wrap/func.wrap.func/test_allocator.h Sat Aug 21 19:59:46 2010
@@ -62,7 +62,7 @@
 #ifdef _LIBCPP_MOVE
     void construct(pointer p, T&& val)
         {::new(p) T(std::move(val));}
-#endif
+#endif  // _LIBCPP_MOVE
     void destroy(pointer p) {p->~T();}
 
     friend bool operator==(const test_allocator& x, const test_allocator& y)
@@ -105,8 +105,8 @@
 #ifdef _LIBCPP_HAS_NO_ADVANCED_SFINAE
     std::size_t max_size() const
         {return UINT_MAX / sizeof(T);}
-#endif
+#endif  // _LIBCPP_HAS_NO_ADVANCED_SFINAE
 
 };
 
-#endif
+#endif  // TEST_ALLOCATOR_H

Modified: libcxx/trunk/test/utilities/function.objects/func.wrap/func.wrap.func/types.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/function.objects/func.wrap/func.wrap.func/types.pass.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/function.objects/func.wrap/func.wrap.func/types.pass.cpp (original)
+++ libcxx/trunk/test/utilities/function.objects/func.wrap/func.wrap.func/types.pass.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,49 @@
-//===----------------------------------------------------------------------===//
//
//                     The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//

// <functional>

// template<Returnable R, CopyConstructible... ArgTypes>
// class function<R(ArgTypes...)>
//   : public unary_function<T1, R>      // iff sizeof...(ArgTypes) == 1 and
//                                       // ArgTypes contains T1
//   : public binary_function<T1, T2, R> // iff sizeof...(ArgTypes) == 2 and
//                                       // ArgTypes contains T1 and T2
// {
// public:
//     typedef R result_type;
//     ...
// };

#include <functional>
#include <type_traits>

int main()
{
    static_assert((!std::is_base_of<std::unary_function <int, int>,
                                           std::function<
 int()> >::value), "");
    static_assert((!std::is_base_of<std::binary_function<int, int, int>,
                                           std::function<int()> >::value), "");
    static_assert(( std::is_same<          std::function<int()>::result_type,
                                                         int>::value), "");

    static_assert(( std::is_base_of<std::unary_function <int, double>,
                                           std::function<double(int)> >::value), "");
    static_assert((!std::is_base_of<std::binary_function<int, int, double>,
                                           std::function<double(int)> >::value), "");
    static_assert(( std::is_same<          std::function<double(int)>::result_type,
                                                         double>::value), "");

    static_assert((!std::is_base_of<std::unary_function <int, double>,
                                           std::function<double(int, char)> >::value), "");
    static_a
 ssert(( std::is_base_of<std::binary_function<int, char, double>,
                                           std::function<double(int, char)> >::value), "");
    static_assert(( std::is_same<          std::function<double(int, char)>::result_type,
                                                         double>::value), "");
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <functional>
+
+// template<Returnable R, CopyConstructible... ArgTypes>
+// class function<R(ArgTypes...)>
+//   : public unary_function<T1, R>      // iff sizeof...(ArgTypes) == 1 and
+//                                       // ArgTypes contains T1
+//   : public binary_function<T1, T2, R> // iff sizeof...(ArgTypes) == 2 and
+//                                       // ArgTypes contains T1 and T2
+// {
+// public:
+//     typedef R result_type;
+//     ...
+// };
+
+#include <functional>
+#include <type_traits>
+
+int main()
+{
+    static_assert((!std::is_base_of<std::unary_function <int, int>,
+                                           std::function<int()> >::value), "");
+    static_assert((!std::is_base_of<std::binary_function<int, int, int>,
+                                           std::function<int()> >::value), "");
+    static_assert(( std::is_same<          std::function<int()>::result_type,
+                                                         int>::value), "");
+
+    static_assert(( std::is_base_of<std::unary_function <int, double>,
+                                           std::function<double(int)> >::value), "");
+    static_assert((!std::is_base_of<std::binary_function<int, int, double>,
+                                           std::function<double(int)> >::value), "");
+    static_assert(( std::is_same<          std::function<double(int)>::result_type,
+                                                         double>::value), "");
+
+    static_assert((!std::is_base_of<std::unary_function <int, double>,
+                                           std::function<double(int, char)> >::value), "");
+    static_assert(( std::is_base_of<std::binary_function<int, char, double>,
+                                           std::function<double(int, char)> >::value), "");
+    static_assert(( std::is_same<          std::function<double(int, char)>::result_type,
+                                                         double>::value), "");
+}

Modified: libcxx/trunk/test/utilities/function.objects/func.wrap/nothing_to_do.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/function.objects/func.wrap/nothing_to_do.pass.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/function.objects/func.wrap/nothing_to_do.pass.cpp (original)
+++ libcxx/trunk/test/utilities/function.objects/func.wrap/nothing_to_do.pass.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,12 @@
-//===----------------------------------------------------------------------===//
//
//                     The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//

int main()
{
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+int main()
+{
+}

Modified: libcxx/trunk/test/utilities/function.objects/function.pointer.adaptors/pointer_to_binary_function.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/function.objects/function.pointer.adaptors/pointer_to_binary_function.pass.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/function.objects/function.pointer.adaptors/pointer_to_binary_function.pass.cpp (original)
+++ libcxx/trunk/test/utilities/function.objects/function.pointer.adaptors/pointer_to_binary_function.pass.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,26 @@
-//===----------------------------------------------------------------------===//
//
//                     The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//

// <functional>

// pointer_to_binary_function

#include <functional>
#include <type_traits>
#include <cassert>

double binary_f(int i, short j) {return i - j + .75;}

int main()
{
    typedef std::pointer_to_binary_function<int, short, double> F;
    static_assert((std::is_base_of<std::binary_function<int, short, double>, F>::value), "");
    const F f(binary_f);
    assert(f(36, 27) == 9.75);
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <functional>
+
+// pointer_to_binary_function
+
+#include <functional>
+#include <type_traits>
+#include <cassert>
+
+double binary_f(int i, short j) {return i - j + .75;}
+
+int main()
+{
+    typedef std::pointer_to_binary_function<int, short, double> F;
+    static_assert((std::is_base_of<std::binary_function<int, short, double>, F>::value), "");
+    const F f(binary_f);
+    assert(f(36, 27) == 9.75);
+}

Modified: libcxx/trunk/test/utilities/function.objects/function.pointer.adaptors/pointer_to_unary_function.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/function.objects/function.pointer.adaptors/pointer_to_unary_function.pass.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/function.objects/function.pointer.adaptors/pointer_to_unary_function.pass.cpp (original)
+++ libcxx/trunk/test/utilities/function.objects/function.pointer.adaptors/pointer_to_unary_function.pass.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,26 @@
-//===----------------------------------------------------------------------===//
//
//                     The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//

// <functional>

// pointer_to_unary_function

#include <functional>
#include <type_traits>
#include <cassert>

double unary_f(int i) {return 0.5 - i;}

int main()
{
    typedef std::pointer_to_unary_function<int, double> F;
    static_assert((std::is_base_of<std::unary_function<int, double>, F>::value), "");
    const F f(unary_f);
    assert(f(36) == -35.5);
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <functional>
+
+// pointer_to_unary_function
+
+#include <functional>
+#include <type_traits>
+#include <cassert>
+
+double unary_f(int i) {return 0.5 - i;}
+
+int main()
+{
+    typedef std::pointer_to_unary_function<int, double> F;
+    static_assert((std::is_base_of<std::unary_function<int, double>, F>::value), "");
+    const F f(unary_f);
+    assert(f(36) == -35.5);
+}

Modified: libcxx/trunk/test/utilities/function.objects/function.pointer.adaptors/ptr_fun1.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/function.objects/function.pointer.adaptors/ptr_fun1.pass.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/function.objects/function.pointer.adaptors/ptr_fun1.pass.cpp (original)
+++ libcxx/trunk/test/utilities/function.objects/function.pointer.adaptors/ptr_fun1.pass.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,25 @@
-//===----------------------------------------------------------------------===//
//
//                     The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//

// <functional>

// template <CopyConstructible Arg, Returnable Result> 
// pointer_to_unary_function<Arg, Result>
// ptr_fun(Result (*f)(Arg));

#include <functional>
#include <type_traits>
#include <cassert>

double unary_f(int i) {return 0.5 - i;}

int main()
{
    assert(std::ptr_fun(unary_f)(36) == -35.5);
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <functional>
+
+// template <CopyConstructible Arg, Returnable Result>
+// pointer_to_unary_function<Arg, Result>
+// ptr_fun(Result (*f)(Arg));
+
+#include <functional>
+#include <type_traits>
+#include <cassert>
+
+double unary_f(int i) {return 0.5 - i;}
+
+int main()
+{
+    assert(std::ptr_fun(unary_f)(36) == -35.5);
+}

Modified: libcxx/trunk/test/utilities/function.objects/function.pointer.adaptors/ptr_fun2.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/function.objects/function.pointer.adaptors/ptr_fun2.pass.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/function.objects/function.pointer.adaptors/ptr_fun2.pass.cpp (original)
+++ libcxx/trunk/test/utilities/function.objects/function.pointer.adaptors/ptr_fun2.pass.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,25 @@
-//===----------------------------------------------------------------------===//
//
//                     The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//

// <functional>

// template <CopyConstructible Arg1, CopyConstructible Arg2, Returnable Result> 
// pointer_to_binary_function<Arg1,Arg2,Result> 
// ptr_fun(Result (*f)(Arg1, Arg2));

#include <functional>
#include <type_traits>
#include <cassert>

double binary_f(int i, short j) {return i - j + .75;}

int main()
{
    assert(std::ptr_fun(binary_f)(36, 27) == 9.75);
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <functional>
+
+// template <CopyConstructible Arg1, CopyConstructible Arg2, Returnable Result>
+// pointer_to_binary_function<Arg1,Arg2,Result>
+// ptr_fun(Result (*f)(Arg1, Arg2));
+
+#include <functional>
+#include <type_traits>
+#include <cassert>
+
+double binary_f(int i, short j) {return i - j + .75;}
+
+int main()
+{
+    assert(std::ptr_fun(binary_f)(36, 27) == 9.75);
+}

Modified: libcxx/trunk/test/utilities/function.objects/logical.operations/logical_and.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/function.objects/logical.operations/logical_and.pass.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/function.objects/logical.operations/logical_and.pass.cpp (original)
+++ libcxx/trunk/test/utilities/function.objects/logical.operations/logical_and.pass.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,27 @@
-//===----------------------------------------------------------------------===//
//
//                     The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//

// <functional>

// logical_and

#include <functional>
#include <type_traits>
#include <cassert>

int main()
{
    typedef std::logical_and<int> F;
    const F f = F();
    static_assert((std::is_base_of<std::binary_function<int, int, bool>, F>::value), "");
    assert(f(36, 36));
    assert(!f(36, 0));
    assert(!f(0, 36));
    assert(!f(0, 0));
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <functional>
+
+// logical_and
+
+#include <functional>
+#include <type_traits>
+#include <cassert>
+
+int main()
+{
+    typedef std::logical_and<int> F;
+    const F f = F();
+    static_assert((std::is_base_of<std::binary_function<int, int, bool>, F>::value), "");
+    assert(f(36, 36));
+    assert(!f(36, 0));
+    assert(!f(0, 36));
+    assert(!f(0, 0));
+}

Modified: libcxx/trunk/test/utilities/function.objects/logical.operations/logical_not.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/function.objects/logical.operations/logical_not.pass.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/function.objects/logical.operations/logical_not.pass.cpp (original)
+++ libcxx/trunk/test/utilities/function.objects/logical.operations/logical_not.pass.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,25 @@
-//===----------------------------------------------------------------------===//
//
//                     The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//

// <functional>

// logical_not

#include <functional>
#include <type_traits>
#include <cassert>

int main()
{
    typedef std::logical_not<int> F;
    const F f = F();
    static_assert((std::is_base_of<std::unary_function<int, bool>, F>::value), "");
    assert(!f(36));
    assert(f(0));
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <functional>
+
+// logical_not
+
+#include <functional>
+#include <type_traits>
+#include <cassert>
+
+int main()
+{
+    typedef std::logical_not<int> F;
+    const F f = F();
+    static_assert((std::is_base_of<std::unary_function<int, bool>, F>::value), "");
+    assert(!f(36));
+    assert(f(0));
+}

Modified: libcxx/trunk/test/utilities/function.objects/logical.operations/logical_or.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/function.objects/logical.operations/logical_or.pass.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/function.objects/logical.operations/logical_or.pass.cpp (original)
+++ libcxx/trunk/test/utilities/function.objects/logical.operations/logical_or.pass.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,27 @@
-//===----------------------------------------------------------------------===//
//
//                     The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//

// <functional>

// logical_or

#include <functional>
#include <type_traits>
#include <cassert>

int main()
{
    typedef std::logical_or<int> F;
    const F f = F();
    static_assert((std::is_base_of<std::binary_function<int, int, bool>, F>::value), "");
    assert(f(36, 36));
    assert(f(36, 0));
    assert(f(0, 36));
    assert(!f(0, 0));
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <functional>
+
+// logical_or
+
+#include <functional>
+#include <type_traits>
+#include <cassert>
+
+int main()
+{
+    typedef std::logical_or<int> F;
+    const F f = F();
+    static_assert((std::is_base_of<std::binary_function<int, int, bool>, F>::value), "");
+    assert(f(36, 36));
+    assert(f(36, 0));
+    assert(f(0, 36));
+    assert(!f(0, 0));
+}

Modified: libcxx/trunk/test/utilities/function.objects/member.pointer.adaptors/const_mem_fun.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/function.objects/member.pointer.adaptors/const_mem_fun.pass.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/function.objects/member.pointer.adaptors/const_mem_fun.pass.cpp (original)
+++ libcxx/trunk/test/utilities/function.objects/member.pointer.adaptors/const_mem_fun.pass.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,31 @@
-//===----------------------------------------------------------------------===//
//
//                     The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//

// <functional>

// template<cReturnable S, ClassType T>
//   const_mem_fun_t<S,T> 
//   mem_fun(S (T::*f)() const);

#include <functional>
#include <cassert>

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);
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <functional>
+
+// template<cReturnable S, ClassType T>
+//   const_mem_fun_t<S,T>
+//   mem_fun(S (T::*f)() const);
+
+#include <functional>
+#include <cassert>
+
+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);
+}

Modified: libcxx/trunk/test/utilities/function.objects/member.pointer.adaptors/const_mem_fun1.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/function.objects/member.pointer.adaptors/const_mem_fun1.pass.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/function.objects/member.pointer.adaptors/const_mem_fun1.pass.cpp (original)
+++ libcxx/trunk/test/utilities/function.objects/member.pointer.adaptors/const_mem_fun1.pass.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,31 @@
-//===----------------------------------------------------------------------===//
//
//                     The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//

// <functional>

// template<Returnable S, ClassType T, CopyConstructible A>
//   const_mem_fun1_t<S,T,A> 
//   mem_fun(S (T::*f)(A) const);

#include <functional>
#include <cassert>

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);
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <functional>
+
+// template<Returnable S, ClassType T, CopyConstructible A>
+//   const_mem_fun1_t<S,T,A>
+//   mem_fun(S (T::*f)(A) const);
+
+#include <functional>
+#include <cassert>
+
+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);
+}

Modified: libcxx/trunk/test/utilities/function.objects/member.pointer.adaptors/const_mem_fun1_ref_t.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/function.objects/member.pointer.adaptors/const_mem_fun1_ref_t.pass.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/function.objects/member.pointer.adaptors/const_mem_fun1_ref_t.pass.cpp (original)
+++ libcxx/trunk/test/utilities/function.objects/member.pointer.adaptors/const_mem_fun1_ref_t.pass.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,33 @@
-//===----------------------------------------------------------------------===//
//
//                     The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//

// <functional>

// const_mem_fun1_ref_t

#include <functional>
#include <type_traits>
#include <cassert>

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<double, A, unsigned> F;
    static_assert((std::is_base_of<std::binary_function<A, unsigned, double>, F>::value), "");
    const F f(&A::a4);
    const A a = A();
    assert(f(a, 6) == 5);
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <functional>
+
+// const_mem_fun1_ref_t
+
+#include <functional>
+#include <type_traits>
+#include <cassert>
+
+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<double, A, unsigned> F;
+    static_assert((std::is_base_of<std::binary_function<A, unsigned, double>, F>::value), "");
+    const F f(&A::a4);
+    const A a = A();
+    assert(f(a, 6) == 5);
+}

Modified: libcxx/trunk/test/utilities/function.objects/member.pointer.adaptors/const_mem_fun1_t.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/function.objects/member.pointer.adaptors/const_mem_fun1_t.pass.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/function.objects/member.pointer.adaptors/const_mem_fun1_t.pass.cpp (original)
+++ libcxx/trunk/test/utilities/function.objects/member.pointer.adaptors/const_mem_fun1_t.pass.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,33 @@
-//===----------------------------------------------------------------------===//
//
//                     The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//

// <functional>

// const_mem_fun1_t

#include <functional>
#include <type_traits>
#include <cassert>

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<double, A, unsigned> F;
    static_assert((std::is_base_of<std::binary_function<const A*, unsigned, double>, F>::value), "");
    const F f(&A::a4);
    const A a = A();
    assert(f(&a, 6) == 5);
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <functional>
+
+// const_mem_fun1_t
+
+#include <functional>
+#include <type_traits>
+#include <cassert>
+
+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<double, A, unsigned> F;
+    static_assert((std::is_base_of<std::binary_function<const A*, unsigned, double>, F>::value), "");
+    const F f(&A::a4);
+    const A a = A();
+    assert(f(&a, 6) == 5);
+}

Modified: libcxx/trunk/test/utilities/function.objects/member.pointer.adaptors/const_mem_fun_ref.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/function.objects/member.pointer.adaptors/const_mem_fun_ref.pass.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/function.objects/member.pointer.adaptors/const_mem_fun_ref.pass.cpp (original)
+++ libcxx/trunk/test/utilities/function.objects/member.pointer.adaptors/const_mem_fun_ref.pass.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,31 @@
-//===----------------------------------------------------------------------===//
//
//                     The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//

// <functional>

// template<Returnable S, ClassType T>
//   const_mem_fun_ref_t<S,T> 
//   mem_fun_ref(S (T::*f)() const);

#include <functional>
#include <cassert>

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);
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <functional>
+
+// template<Returnable S, ClassType T>
+//   const_mem_fun_ref_t<S,T>
+//   mem_fun_ref(S (T::*f)() const);
+
+#include <functional>
+#include <cassert>
+
+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);
+}

Modified: libcxx/trunk/test/utilities/function.objects/member.pointer.adaptors/const_mem_fun_ref1.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/function.objects/member.pointer.adaptors/const_mem_fun_ref1.pass.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/function.objects/member.pointer.adaptors/const_mem_fun_ref1.pass.cpp (original)
+++ libcxx/trunk/test/utilities/function.objects/member.pointer.adaptors/const_mem_fun_ref1.pass.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,31 @@
-//===----------------------------------------------------------------------===//
//
//                     The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//

// <functional>

// template<Returnable S, ClassType T, CopyConstructible A>
//   const_mem_fun1_ref_t<S,T,A> 
//   mem_fun_ref(S (T::*f)(A) const);

#include <functional>
#include <cassert>

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);
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <functional>
+
+// template<Returnable S, ClassType T, CopyConstructible A>
+//   const_mem_fun1_ref_t<S,T,A>
+//   mem_fun_ref(S (T::*f)(A) const);
+
+#include <functional>
+#include <cassert>
+
+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);
+}

Modified: libcxx/trunk/test/utilities/function.objects/member.pointer.adaptors/const_mem_fun_ref_t.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/function.objects/member.pointer.adaptors/const_mem_fun_ref_t.pass.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/function.objects/member.pointer.adaptors/const_mem_fun_ref_t.pass.cpp (original)
+++ libcxx/trunk/test/utilities/function.objects/member.pointer.adaptors/const_mem_fun_ref_t.pass.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,33 @@
-//===----------------------------------------------------------------------===//
//
//                     The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//

// <functional>

// const_mem_fun_ref_t

#include <functional>
#include <type_traits>
#include <cassert>

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<int, A> F;
    static_assert((std::is_base_of<std::unary_function<A, int>, F>::value), "");
    const F f(&A::a3);
    const A a = A();
    assert(f(a) == 1);
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <functional>
+
+// const_mem_fun_ref_t
+
+#include <functional>
+#include <type_traits>
+#include <cassert>
+
+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<int, A> F;
+    static_assert((std::is_base_of<std::unary_function<A, int>, F>::value), "");
+    const F f(&A::a3);
+    const A a = A();
+    assert(f(a) == 1);
+}

Modified: libcxx/trunk/test/utilities/function.objects/member.pointer.adaptors/const_mem_fun_t.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/function.objects/member.pointer.adaptors/const_mem_fun_t.pass.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/function.objects/member.pointer.adaptors/const_mem_fun_t.pass.cpp (original)
+++ libcxx/trunk/test/utilities/function.objects/member.pointer.adaptors/const_mem_fun_t.pass.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,33 @@
-//===----------------------------------------------------------------------===//
//
//                     The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//

// <functional>

// const_mem_fun_t

#include <functional>
#include <type_traits>
#include <cassert>

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<int, A> F;
    static_assert((std::is_base_of<std::unary_function<const A*, int>, F>::value), "");
    const F f(&A::a3);
    const A a = A();
    assert(f(&a) == 1);
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <functional>
+
+// const_mem_fun_t
+
+#include <functional>
+#include <type_traits>
+#include <cassert>
+
+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<int, A> F;
+    static_assert((std::is_base_of<std::unary_function<const A*, int>, F>::value), "");
+    const F f(&A::a3);
+    const A a = A();
+    assert(f(&a) == 1);
+}

Modified: libcxx/trunk/test/utilities/function.objects/member.pointer.adaptors/mem_fun.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/function.objects/member.pointer.adaptors/mem_fun.pass.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/function.objects/member.pointer.adaptors/mem_fun.pass.cpp (original)
+++ libcxx/trunk/test/utilities/function.objects/member.pointer.adaptors/mem_fun.pass.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,31 @@
-//===----------------------------------------------------------------------===//
//
//                     The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//

// <functional>

// template<Returnable S, ClassType T>
//   mem_fun_t<S,T> 
//   mem_fun(S (T::*f)());

#include <functional>
#include <cassert>

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);
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <functional>
+
+// template<Returnable S, ClassType T>
+//   mem_fun_t<S,T>
+//   mem_fun(S (T::*f)());
+
+#include <functional>
+#include <cassert>
+
+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);
+}

Modified: libcxx/trunk/test/utilities/function.objects/member.pointer.adaptors/mem_fun1.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/function.objects/member.pointer.adaptors/mem_fun1.pass.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/function.objects/member.pointer.adaptors/mem_fun1.pass.cpp (original)
+++ libcxx/trunk/test/utilities/function.objects/member.pointer.adaptors/mem_fun1.pass.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,31 @@
-//===----------------------------------------------------------------------===//
//
//                     The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//

// <functional>

// template<Returnable S, ClassType T, CopyConstructible A>
//   mem_fun1_t<S,T,A> 
//   mem_fun(S (T::*f)(A));

#include <functional>
#include <cassert>

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);
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <functional>
+
+// template<Returnable S, ClassType T, CopyConstructible A>
+//   mem_fun1_t<S,T,A>
+//   mem_fun(S (T::*f)(A));
+
+#include <functional>
+#include <cassert>
+
+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);
+}

Modified: libcxx/trunk/test/utilities/function.objects/member.pointer.adaptors/mem_fun1_ref_t.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/function.objects/member.pointer.adaptors/mem_fun1_ref_t.pass.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/function.objects/member.pointer.adaptors/mem_fun1_ref_t.pass.cpp (original)
+++ libcxx/trunk/test/utilities/function.objects/member.pointer.adaptors/mem_fun1_ref_t.pass.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,33 @@
-//===----------------------------------------------------------------------===//
//
//                     The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//

// <functional>

// mem_fun1_ref_t

#include <functional>
#include <type_traits>
#include <cassert>

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<short, A, int> F;
    static_assert((std::is_base_of<std::binary_function<A, int, short>, F>::value), "");
    const F f(&A::a2);
    A a;
    assert(f(a, 5) == 6);
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <functional>
+
+// mem_fun1_ref_t
+
+#include <functional>
+#include <type_traits>
+#include <cassert>
+
+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<short, A, int> F;
+    static_assert((std::is_base_of<std::binary_function<A, int, short>, F>::value), "");
+    const F f(&A::a2);
+    A a;
+    assert(f(a, 5) == 6);
+}

Modified: libcxx/trunk/test/utilities/function.objects/member.pointer.adaptors/mem_fun1_t.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/function.objects/member.pointer.adaptors/mem_fun1_t.pass.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/function.objects/member.pointer.adaptors/mem_fun1_t.pass.cpp (original)
+++ libcxx/trunk/test/utilities/function.objects/member.pointer.adaptors/mem_fun1_t.pass.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,33 @@
-//===----------------------------------------------------------------------===//
//
//                     The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//

// <functional>

// mem_fun1_t

#include <functional>
#include <type_traits>
#include <cassert>

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<short, A, int> F;
    static_assert((std::is_base_of<std::binary_function<A*, int, short>, F>::value), "");
    const F f(&A::a2);
    A a;
    assert(f(&a, 5) == 6);
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <functional>
+
+// mem_fun1_t
+
+#include <functional>
+#include <type_traits>
+#include <cassert>
+
+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<short, A, int> F;
+    static_assert((std::is_base_of<std::binary_function<A*, int, short>, F>::value), "");
+    const F f(&A::a2);
+    A a;
+    assert(f(&a, 5) == 6);
+}

Modified: libcxx/trunk/test/utilities/function.objects/member.pointer.adaptors/mem_fun_ref.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/function.objects/member.pointer.adaptors/mem_fun_ref.pass.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/function.objects/member.pointer.adaptors/mem_fun_ref.pass.cpp (original)
+++ libcxx/trunk/test/utilities/function.objects/member.pointer.adaptors/mem_fun_ref.pass.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,31 @@
-//===----------------------------------------------------------------------===//
//
//                     The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//

// <functional>

// template<Returnable S, ClassType T>
//   mem_fun_ref_t<S,T> 
//   mem_fun_ref(S (T::*f)());

#include <functional>
#include <cassert>

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);
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <functional>
+
+// template<Returnable S, ClassType T>
+//   mem_fun_ref_t<S,T>
+//   mem_fun_ref(S (T::*f)());
+
+#include <functional>
+#include <cassert>
+
+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);
+}

Modified: libcxx/trunk/test/utilities/function.objects/member.pointer.adaptors/mem_fun_ref1.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/function.objects/member.pointer.adaptors/mem_fun_ref1.pass.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/function.objects/member.pointer.adaptors/mem_fun_ref1.pass.cpp (original)
+++ libcxx/trunk/test/utilities/function.objects/member.pointer.adaptors/mem_fun_ref1.pass.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,31 @@
-//===----------------------------------------------------------------------===//
//
//                     The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//

// <functional>

// template<Returnable S, ClassType T, CopyConstructible A>
//   mem_fun1_ref_t<S,T,A> 
//   mem_fun_ref(S (T::*f)(A));

#include <functional>
#include <cassert>

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);
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <functional>
+
+// template<Returnable S, ClassType T, CopyConstructible A>
+//   mem_fun1_ref_t<S,T,A>
+//   mem_fun_ref(S (T::*f)(A));
+
+#include <functional>
+#include <cassert>
+
+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);
+}

Modified: libcxx/trunk/test/utilities/function.objects/member.pointer.adaptors/mem_fun_ref_t.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/function.objects/member.pointer.adaptors/mem_fun_ref_t.pass.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/function.objects/member.pointer.adaptors/mem_fun_ref_t.pass.cpp (original)
+++ libcxx/trunk/test/utilities/function.objects/member.pointer.adaptors/mem_fun_ref_t.pass.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,33 @@
-//===----------------------------------------------------------------------===//
//
//                     The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//

// <functional>

// mem_fun_ref_t

#include <functional>
#include <type_traits>
#include <cassert>

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<char, A> F;
    static_assert((std::is_base_of<std::unary_function<A, char>, F>::value), "");
    const F f(&A::a1);
    A a;
    assert(f(a) == 5);
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <functional>
+
+// mem_fun_ref_t
+
+#include <functional>
+#include <type_traits>
+#include <cassert>
+
+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<char, A> F;
+    static_assert((std::is_base_of<std::unary_function<A, char>, F>::value), "");
+    const F f(&A::a1);
+    A a;
+    assert(f(a) == 5);
+}

Modified: libcxx/trunk/test/utilities/function.objects/member.pointer.adaptors/mem_fun_t.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/function.objects/member.pointer.adaptors/mem_fun_t.pass.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/function.objects/member.pointer.adaptors/mem_fun_t.pass.cpp (original)
+++ libcxx/trunk/test/utilities/function.objects/member.pointer.adaptors/mem_fun_t.pass.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,33 @@
-//===----------------------------------------------------------------------===//
//
//                     The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//

// <functional>

// mem_fun_t

#include <functional>
#include <type_traits>
#include <cassert>

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<char, A> F;
    static_assert((std::is_base_of<std::unary_function<A*, char>, F>::value), "");
    const F f(&A::a1);
    A a;
    assert(f(&a) == 5);
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <functional>
+
+// mem_fun_t
+
+#include <functional>
+#include <type_traits>
+#include <cassert>
+
+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<char, A> F;
+    static_assert((std::is_base_of<std::unary_function<A*, char>, F>::value), "");
+    const F f(&A::a1);
+    A a;
+    assert(f(&a) == 5);
+}

Modified: libcxx/trunk/test/utilities/function.objects/negators/binary_negate.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/function.objects/negators/binary_negate.pass.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/function.objects/negators/binary_negate.pass.cpp (original)
+++ libcxx/trunk/test/utilities/function.objects/negators/binary_negate.pass.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,27 @@
-//===----------------------------------------------------------------------===//
//
//                     The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//

// <functional>

// binary_negate

#include <functional>
#include <type_traits>
#include <cassert>

int main()
{
    typedef std::binary_negate<std::logical_and<int> > F;
    const F f = F(std::logical_and<int>());
    static_assert((std::is_base_of<std::binary_function<int, int, bool>, F>::value), "");
    assert(!f(36, 36));
    assert( f(36, 0));
    assert( f(0, 36));
    assert( f(0, 0));
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <functional>
+
+// binary_negate
+
+#include <functional>
+#include <type_traits>
+#include <cassert>
+
+int main()
+{
+    typedef std::binary_negate<std::logical_and<int> > F;
+    const F f = F(std::logical_and<int>());
+    static_assert((std::is_base_of<std::binary_function<int, int, bool>, F>::value), "");
+    assert(!f(36, 36));
+    assert( f(36, 0));
+    assert( f(0, 36));
+    assert( f(0, 0));
+}

Modified: libcxx/trunk/test/utilities/function.objects/negators/not1.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/function.objects/negators/not1.pass.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/function.objects/negators/not1.pass.cpp (original)
+++ libcxx/trunk/test/utilities/function.objects/negators/not1.pass.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,22 @@
-//===----------------------------------------------------------------------===//
//
//                     The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//

// <functional>

// not1

#include <functional>
#include <cassert>

int main()
{
    typedef std::logical_not<int> F;
    assert(std::not1(F())(36));
    assert(!std::not1(F())(0));
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <functional>
+
+// not1
+
+#include <functional>
+#include <cassert>
+
+int main()
+{
+    typedef std::logical_not<int> F;
+    assert(std::not1(F())(36));
+    assert(!std::not1(F())(0));
+}

Modified: libcxx/trunk/test/utilities/function.objects/negators/not2.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/function.objects/negators/not2.pass.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/function.objects/negators/not2.pass.cpp (original)
+++ libcxx/trunk/test/utilities/function.objects/negators/not2.pass.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,24 @@
-//===----------------------------------------------------------------------===//
//
//                     The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//

// <functional>

// not2

#include <functional>
#include <cassert>

int main()
{
    typedef std::logical_and<int> F;
    assert(!std::not2(F())(36, 36));
    assert( std::not2(F())(36, 0));
    assert( std::not2(F())(0, 36));
    assert( std::not2(F())(0, 0));
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <functional>
+
+// not2
+
+#include <functional>
+#include <cassert>
+
+int main()
+{
+    typedef std::logical_and<int> F;
+    assert(!std::not2(F())(36, 36));
+    assert( std::not2(F())(36, 0));
+    assert( std::not2(F())(0, 36));
+    assert( std::not2(F())(0, 0));
+}

Modified: libcxx/trunk/test/utilities/function.objects/negators/unary_negate.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/function.objects/negators/unary_negate.pass.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/function.objects/negators/unary_negate.pass.cpp (original)
+++ libcxx/trunk/test/utilities/function.objects/negators/unary_negate.pass.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,25 @@
-//===----------------------------------------------------------------------===//
//
//                     The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//

// <functional>

// unary_negate

#include <functional>
#include <type_traits>
#include <cassert>

int main()
{
    typedef std::unary_negate<std::logical_not<int> > F;
    const F f = F(std::logical_not<int>());
    static_assert((std::is_base_of<std::unary_function<int, bool>, F>::value), "");
    assert(f(36));
    assert(!f(0));
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <functional>
+
+// unary_negate
+
+#include <functional>
+#include <type_traits>
+#include <cassert>
+
+int main()
+{
+    typedef std::unary_negate<std::logical_not<int> > F;
+    const F f = F(std::logical_not<int>());
+    static_assert((std::is_base_of<std::unary_function<int, bool>, F>::value), "");
+    assert(f(36));
+    assert(!f(0));
+}

Modified: libcxx/trunk/test/utilities/function.objects/refwrap/binary.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/function.objects/refwrap/binary.pass.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/function.objects/refwrap/binary.pass.cpp (original)
+++ libcxx/trunk/test/utilities/function.objects/refwrap/binary.pass.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,80 @@
-//===----------------------------------------------------------------------===//
//
//                     The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//

// <functional>

// reference_wrapper

// check for deriving from binary_function

#include <functional>
#include <type_traits>

class functor1
    : public std::unary_function<int, char>
{
};

class functor2
    : public std::binary_function<char, int, double>
{
};

class functor3
    : public std::unary_function<int, int>,
      public std::binary_function<char, int, double>
{
public:
    typedef float result_type;
};

class functor4
    : public std::unary_function<int, int>,
      public std::binary_function<char, int, double>
{
public:
};

struct C
{
    typedef int argument_type;
    typedef int result_type;
};

int main()
{
    stat
 ic_assert((!std::is_base_of<std::binary_function<int, char, int>,
                                    std::reference_wrapper<functor1> >::value), "");
    static_assert((std::is_base_of<std::binary_function<char, int, double>,
                                   std::reference_wrapper<functor2> >::value), "");
    static_assert((std::is_base_of<std::binary_function<char, int, double>,
                                   std::reference_wrapper<functor3> >::value), "");
    static_assert((std::is_base_of<std::binary_function<char, int, double>,
                                   std::reference_wrapper<functor4> >::value), "");
    static_assert((!std::is_base_of<std::binary_function<int, int, int>,
                                    std::reference_wrapper<C> >::value), "");
    static_assert((!std::is_base_of<std::binary_function<int, int, float>,
                                    std::reference_wrapper<float ()> >::value), "");
    static_assert((!std::is_base_of<std::binary
 _function<int, int, float>,
                                   std::reference_wrapper<float (int)> >::value), "");
    static_assert((std::is_base_of<std::binary_function<int, int, float>,
                                    std::reference_wrapper<float (int, int)> >::value), "");
    static_assert((!std::is_base_of<std::binary_function<int, int, float>,
                                    std::reference_wrapper<float(*)()> >::value), "");
    static_assert((!std::is_base_of<std::binary_function<int, int, float>,
                                   std::reference_wrapper<float(*)(int)> >::value), "");
    static_assert((std::is_base_of<std::binary_function<int, int, float>,
                                    std::reference_wrapper<float(*)(int, int)> >::value), "");
    static_assert((!std::is_base_of<std::binary_function<C*, int, float>,
                                   std::reference_wrapper<float(C::*)()> >::value), "");
    static_assert((std::is_base_of<std::binary_fu
 nction<C*, int, float>,
                                   std::reference_wrapper<float(C::*)(int)> >::value), "");
    static_assert((std::is_base_of<std::binary_function<const volatile C*, int, float>,
                                   std::reference_wrapper<float(C::*)(int) const volatile> >::value), "");
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <functional>
+
+// reference_wrapper
+
+// check for deriving from binary_function
+
+#include <functional>
+#include <type_traits>
+
+class functor1
+    : public std::unary_function<int, char>
+{
+};
+
+class functor2
+    : public std::binary_function<char, int, double>
+{
+};
+
+class functor3
+    : public std::unary_function<int, int>,
+      public std::binary_function<char, int, double>
+{
+public:
+    typedef float result_type;
+};
+
+class functor4
+    : public std::unary_function<int, int>,
+      public std::binary_function<char, int, double>
+{
+public:
+};
+
+struct C
+{
+    typedef int argument_type;
+    typedef int result_type;
+};
+
+int main()
+{
+    static_assert((!std::is_base_of<std::binary_function<int, char, int>,
+                                    std::reference_wrapper<functor1> >::value), "");
+    static_assert((std::is_base_of<std::binary_function<char, int, double>,
+                                   std::reference_wrapper<functor2> >::value), "");
+    static_assert((std::is_base_of<std::binary_function<char, int, double>,
+                                   std::reference_wrapper<functor3> >::value), "");
+    static_assert((std::is_base_of<std::binary_function<char, int, double>,
+                                   std::reference_wrapper<functor4> >::value), "");
+    static_assert((!std::is_base_of<std::binary_function<int, int, int>,
+                                    std::reference_wrapper<C> >::value), "");
+    static_assert((!std::is_base_of<std::binary_function<int, int, float>,
+                                    std::reference_wrapper<float ()> >::value), "");
+    static_assert((!std::is_base_of<std::binary_function<int, int, float>,
+                                   std::reference_wrapper<float (int)> >::value), "");
+    static_assert((std::is_base_of<std::binary_function<int, int, float>,
+                                    std::reference_wrapper<float (int, int)> >::value), "");
+    static_assert((!std::is_base_of<std::binary_function<int, int, float>,
+                                    std::reference_wrapper<float(*)()> >::value), "");
+    static_assert((!std::is_base_of<std::binary_function<int, int, float>,
+                                   std::reference_wrapper<float(*)(int)> >::value), "");
+    static_assert((std::is_base_of<std::binary_function<int, int, float>,
+                                    std::reference_wrapper<float(*)(int, int)> >::value), "");
+    static_assert((!std::is_base_of<std::binary_function<C*, int, float>,
+                                   std::reference_wrapper<float(C::*)()> >::value), "");
+    static_assert((std::is_base_of<std::binary_function<C*, int, float>,
+                                   std::reference_wrapper<float(C::*)(int)> >::value), "");
+    static_assert((std::is_base_of<std::binary_function<const volatile C*, int, float>,
+                                   std::reference_wrapper<float(C::*)(int) const volatile> >::value), "");
+}

Modified: libcxx/trunk/test/utilities/function.objects/refwrap/refwrap.access/conversion.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/function.objects/refwrap/refwrap.access/conversion.pass.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/function.objects/refwrap/refwrap.access/conversion.pass.cpp (original)
+++ libcxx/trunk/test/utilities/function.objects/refwrap/refwrap.access/conversion.pass.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,46 @@
-//===----------------------------------------------------------------------===//
//
//                     The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//

// <functional>

// reference_wrapper

// operator T& () const;

#include <functional>
#include <cassert>

class functor1
    : public std::unary_function<int, char>
{
};

template <class T>
void
test(T& t)
{
    std::reference_wrapper<T> r(t);
    T& r2 = r;
    assert(&r2 == &t);
}

void f() {}

int main()
{
    void (*fp)() = f;
    test(fp);
    test(f);
    functor1 f1;
    test(f1);
    int i = 0;
    test(i);
    const int j = 0;
    test(j);
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <functional>
+
+// reference_wrapper
+
+// operator T& () const;
+
+#include <functional>
+#include <cassert>
+
+class functor1
+    : public std::unary_function<int, char>
+{
+};
+
+template <class T>
+void
+test(T& t)
+{
+    std::reference_wrapper<T> r(t);
+    T& r2 = r;
+    assert(&r2 == &t);
+}
+
+void f() {}
+
+int main()
+{
+    void (*fp)() = f;
+    test(fp);
+    test(f);
+    functor1 f1;
+    test(f1);
+    int i = 0;
+    test(i);
+    const int j = 0;
+    test(j);
+}

Modified: libcxx/trunk/test/utilities/function.objects/refwrap/refwrap.assign/copy_assign.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/function.objects/refwrap/refwrap.assign/copy_assign.pass.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/function.objects/refwrap/refwrap.assign/copy_assign.pass.cpp (original)
+++ libcxx/trunk/test/utilities/function.objects/refwrap/refwrap.assign/copy_assign.pass.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,58 @@
-//===----------------------------------------------------------------------===//
//
//                     The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//

// <functional>

// reference_wrapper

// reference_wrapper& operator=(const reference_wrapper<T>& x);

#include <functional>
#include <cassert>

class functor1
    : public std::unary_function<int, char>
{
};

template <class T>
void
test(T& t)
{
    std::reference_wrapper<T> r(t);
    T t2 = t;
    std::reference_wrapper<T> r2(t2);
    r2 = r;
    assert(&r2.get() == &t);
}

void f() {}
void g() {}

void
test_function()
{
    std::reference_wrapper<void ()> r(f);
    std::reference_wrapper<void ()> r2(g);
    r2 = r;
    assert(&r2.get() == &f);
}

int main()
{
    void (*fp)() = f;
    test(fp);
    test_function();
    functor1 f1;
   
  test(f1);
    int i = 0;
    test(i);
    const int j = 0;
    test(j);
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <functional>
+
+// reference_wrapper
+
+// reference_wrapper& operator=(const reference_wrapper<T>& x);
+
+#include <functional>
+#include <cassert>
+
+class functor1
+    : public std::unary_function<int, char>
+{
+};
+
+template <class T>
+void
+test(T& t)
+{
+    std::reference_wrapper<T> r(t);
+    T t2 = t;
+    std::reference_wrapper<T> r2(t2);
+    r2 = r;
+    assert(&r2.get() == &t);
+}
+
+void f() {}
+void g() {}
+
+void
+test_function()
+{
+    std::reference_wrapper<void ()> r(f);
+    std::reference_wrapper<void ()> r2(g);
+    r2 = r;
+    assert(&r2.get() == &f);
+}
+
+int main()
+{
+    void (*fp)() = f;
+    test(fp);
+    test_function();
+    functor1 f1;
+    test(f1);
+    int i = 0;
+    test(i);
+    const int j = 0;
+    test(j);
+}

Modified: libcxx/trunk/test/utilities/function.objects/refwrap/refwrap.const/copy_ctor.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/function.objects/refwrap/refwrap.const/copy_ctor.pass.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/function.objects/refwrap/refwrap.const/copy_ctor.pass.cpp (original)
+++ libcxx/trunk/test/utilities/function.objects/refwrap/refwrap.const/copy_ctor.pass.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,46 @@
-//===----------------------------------------------------------------------===//
//
//                     The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//

// <functional>

// reference_wrapper

// reference_wrapper(const reference_wrapper<T>& x);

#include <functional>
#include <cassert>

class functor1
    : public std::unary_function<int, char>
{
};

template <class T>
void
test(T& t)
{
    std::reference_wrapper<T> r(t);
    std::reference_wrapper<T> r2 = r;
    assert(&r2.get() == &t);
}

void f() {}

int main()
{
    void (*fp)() = f;
    test(fp);
    test(f);
    functor1 f1;
    test(f1);
    int i = 0;
    test(i);
    const int j = 0;
    test(j);
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <functional>
+
+// reference_wrapper
+
+// reference_wrapper(const reference_wrapper<T>& x);
+
+#include <functional>
+#include <cassert>
+
+class functor1
+    : public std::unary_function<int, char>
+{
+};
+
+template <class T>
+void
+test(T& t)
+{
+    std::reference_wrapper<T> r(t);
+    std::reference_wrapper<T> r2 = r;
+    assert(&r2.get() == &t);
+}
+
+void f() {}
+
+int main()
+{
+    void (*fp)() = f;
+    test(fp);
+    test(f);
+    functor1 f1;
+    test(f1);
+    int i = 0;
+    test(i);
+    const int j = 0;
+    test(j);
+}

Modified: libcxx/trunk/test/utilities/function.objects/refwrap/refwrap.const/type_ctor.fail.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/function.objects/refwrap/refwrap.const/type_ctor.fail.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/function.objects/refwrap/refwrap.const/type_ctor.fail.cpp (original)
+++ libcxx/trunk/test/utilities/function.objects/refwrap/refwrap.const/type_ctor.fail.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,22 @@
-//===----------------------------------------------------------------------===//
//
//                     The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//

// <functional>

// reference_wrapper

// reference_wrapper(T&&) = delete;

#include <functional>
#include <cassert>

int main()
{
    std::reference_wrapper<const int> r(3);
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <functional>
+
+// reference_wrapper
+
+// reference_wrapper(T&&) = delete;
+
+#include <functional>
+#include <cassert>
+
+int main()
+{
+    std::reference_wrapper<const int> r(3);
+}

Modified: libcxx/trunk/test/utilities/function.objects/refwrap/refwrap.const/type_ctor.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/function.objects/refwrap/refwrap.const/type_ctor.pass.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/function.objects/refwrap/refwrap.const/type_ctor.pass.cpp (original)
+++ libcxx/trunk/test/utilities/function.objects/refwrap/refwrap.const/type_ctor.pass.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,45 @@
-//===----------------------------------------------------------------------===//
//
//                     The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//

// <functional>

// reference_wrapper

// reference_wrapper(T& t);

#include <functional>
#include <cassert>

class functor1
    : public std::unary_function<int, char>
{
};

template <class T>
void
test(T& t)
{
    std::reference_wrapper<T> r(t);
    assert(&r.get() == &t);
}

void f() {}

int main()
{
    void (*fp)() = f;
    test(fp);
    test(f);
    functor1 f1;
    test(f1);
    int i = 0;
    test(i);
    const int j = 0;
    test(j);
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <functional>
+
+// reference_wrapper
+
+// reference_wrapper(T& t);
+
+#include <functional>
+#include <cassert>
+
+class functor1
+    : public std::unary_function<int, char>
+{
+};
+
+template <class T>
+void
+test(T& t)
+{
+    std::reference_wrapper<T> r(t);
+    assert(&r.get() == &t);
+}
+
+void f() {}
+
+int main()
+{
+    void (*fp)() = f;
+    test(fp);
+    test(f);
+    functor1 f1;
+    test(f1);
+    int i = 0;
+    test(i);
+    const int j = 0;
+    test(j);
+}

Modified: libcxx/trunk/test/utilities/function.objects/refwrap/refwrap.helpers/cref_1.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/function.objects/refwrap/refwrap.helpers/cref_1.pass.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/function.objects/refwrap/refwrap.helpers/cref_1.pass.cpp (original)
+++ libcxx/trunk/test/utilities/function.objects/refwrap/refwrap.helpers/cref_1.pass.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,24 @@
-//===----------------------------------------------------------------------===//
//
//                     The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//

// <functional>

// reference_wrapper

// template <ObjectType T> reference_wrapper<const T> cref(const T& t);

#include <functional>
#include <cassert>

int main()
{
    int i = 0;
    std::reference_wrapper<const int> r = std::cref(i);
    assert(&r.get() == &i);
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <functional>
+
+// reference_wrapper
+
+// template <ObjectType T> reference_wrapper<const T> cref(const T& t);
+
+#include <functional>
+#include <cassert>
+
+int main()
+{
+    int i = 0;
+    std::reference_wrapper<const int> r = std::cref(i);
+    assert(&r.get() == &i);
+}

Modified: libcxx/trunk/test/utilities/function.objects/refwrap/refwrap.helpers/cref_2.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/function.objects/refwrap/refwrap.helpers/cref_2.pass.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/function.objects/refwrap/refwrap.helpers/cref_2.pass.cpp (original)
+++ libcxx/trunk/test/utilities/function.objects/refwrap/refwrap.helpers/cref_2.pass.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,25 @@
-//===----------------------------------------------------------------------===//
//
//                     The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//

// <functional>

// reference_wrapper

// template <ObjectType T> reference_wrapper<const T> cref(reference_wrapper<T> t);

#include <functional>
#include <cassert>

int main()
{
    const int i = 0;
    std::reference_wrapper<const int> r1 = std::cref(i);
    std::reference_wrapper<const int> r2 = std::cref(r1);
    assert(&r2.get() == &i);
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <functional>
+
+// reference_wrapper
+
+// template <ObjectType T> reference_wrapper<const T> cref(reference_wrapper<T> t);
+
+#include <functional>
+#include <cassert>
+
+int main()
+{
+    const int i = 0;
+    std::reference_wrapper<const int> r1 = std::cref(i);
+    std::reference_wrapper<const int> r2 = std::cref(r1);
+    assert(&r2.get() == &i);
+}

Modified: libcxx/trunk/test/utilities/function.objects/refwrap/refwrap.helpers/ref_1.fail.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/function.objects/refwrap/refwrap.helpers/ref_1.fail.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/function.objects/refwrap/refwrap.helpers/ref_1.fail.cpp (original)
+++ libcxx/trunk/test/utilities/function.objects/refwrap/refwrap.helpers/ref_1.fail.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,27 @@
-//===----------------------------------------------------------------------===//
//
//                     The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//

// <functional>

// reference_wrapper

// template <ObjectType T> reference_wrapper<T> ref(T& t);

// Don't allow binding to a temp

#include <functional>

struct A {};

const A source() {return A();}

int main()
{
    std::reference_wrapper<const A> r = std::ref(source());
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <functional>
+
+// reference_wrapper
+
+// template <ObjectType T> reference_wrapper<T> ref(T& t);
+
+// Don't allow binding to a temp
+
+#include <functional>
+
+struct A {};
+
+const A source() {return A();}
+
+int main()
+{
+    std::reference_wrapper<const A> r = std::ref(source());
+}

Modified: libcxx/trunk/test/utilities/function.objects/refwrap/refwrap.helpers/ref_1.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/function.objects/refwrap/refwrap.helpers/ref_1.pass.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/function.objects/refwrap/refwrap.helpers/ref_1.pass.cpp (original)
+++ libcxx/trunk/test/utilities/function.objects/refwrap/refwrap.helpers/ref_1.pass.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,24 @@
-//===----------------------------------------------------------------------===//
//
//                     The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//

// <functional>

// reference_wrapper

// template <ObjectType T> reference_wrapper<T> ref(T& t);

#include <functional>
#include <cassert>

int main()
{
    int i = 0;
    std::reference_wrapper<int> r = std::ref(i);
    assert(&r.get() == &i);
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <functional>
+
+// reference_wrapper
+
+// template <ObjectType T> reference_wrapper<T> ref(T& t);
+
+#include <functional>
+#include <cassert>
+
+int main()
+{
+    int i = 0;
+    std::reference_wrapper<int> r = std::ref(i);
+    assert(&r.get() == &i);
+}

Modified: libcxx/trunk/test/utilities/function.objects/refwrap/refwrap.helpers/ref_2.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/function.objects/refwrap/refwrap.helpers/ref_2.pass.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/function.objects/refwrap/refwrap.helpers/ref_2.pass.cpp (original)
+++ libcxx/trunk/test/utilities/function.objects/refwrap/refwrap.helpers/ref_2.pass.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,25 @@
-//===----------------------------------------------------------------------===//
//
//                     The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//

// <functional>

// reference_wrapper

// template <ObjectType T> reference_wrapper<T> ref(reference_wrapper<T>t);

#include <functional>
#include <cassert>

int main()
{
    int i = 0;
    std::reference_wrapper<int> r1 = std::ref(i);
    std::reference_wrapper<int> r2 = std::ref(r1);
    assert(&r2.get() == &i);
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <functional>
+
+// reference_wrapper
+
+// template <ObjectType T> reference_wrapper<T> ref(reference_wrapper<T>t);
+
+#include <functional>
+#include <cassert>
+
+int main()
+{
+    int i = 0;
+    std::reference_wrapper<int> r1 = std::ref(i);
+    std::reference_wrapper<int> r2 = std::ref(r1);
+    assert(&r2.get() == &i);
+}

Modified: libcxx/trunk/test/utilities/function.objects/refwrap/refwrap.invoke/invoke.fail.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/function.objects/refwrap/refwrap.invoke/invoke.fail.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/function.objects/refwrap/refwrap.invoke/invoke.fail.cpp (original)
+++ libcxx/trunk/test/utilities/function.objects/refwrap/refwrap.invoke/invoke.fail.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,52 @@
-//===----------------------------------------------------------------------===//
//
//                     The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//

// <functional>

// reference_wrapper

// template <class... ArgTypes> 
//   requires Callable<T, ArgTypes&&...> 
//   Callable<T, ArgTypes&&...>::result_type 
//   operator()(ArgTypes&&... args) const;

#include <functional>
#include <cassert>

// member data pointer:  cv qualifiers should transfer from argument to return type

struct A_int_1
{
    A_int_1() : data_(5) {}

    int data_;
};

void
test_int_1()
{
    // member data pointer
    {
    int A_int_1::*fp = &A_int_1::data_;
    std::reference_wrapper<int A_int_1::*> r1(fp);
    A_int_1 a;
    assert(r1(a) == 5);
    r1(a) = 6;
    assert(r1(a) == 6);
    const A_int_1* ap = &a;
 
    assert(r1(ap) == 6);
    r1(ap) = 7;
    assert(r1(ap) == 7);
    }
}


int main()
{
    test_int_1();
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <functional>
+
+// reference_wrapper
+
+// template <class... ArgTypes>
+//   requires Callable<T, ArgTypes&&...>
+//   Callable<T, ArgTypes&&...>::result_type
+//   operator()(ArgTypes&&... args) const;
+
+#include <functional>
+#include <cassert>
+
+// member data pointer:  cv qualifiers should transfer from argument to return type
+
+struct A_int_1
+{
+    A_int_1() : data_(5) {}
+
+    int data_;
+};
+
+void
+test_int_1()
+{
+    // member data pointer
+    {
+    int A_int_1::*fp = &A_int_1::data_;
+    std::reference_wrapper<int A_int_1::*> r1(fp);
+    A_int_1 a;
+    assert(r1(a) == 5);
+    r1(a) = 6;
+    assert(r1(a) == 6);
+    const A_int_1* ap = &a;
+    assert(r1(ap) == 6);
+    r1(ap) = 7;
+    assert(r1(ap) == 7);
+    }
+}
+
+int main()
+{
+    test_int_1();
+}

Modified: libcxx/trunk/test/utilities/function.objects/refwrap/refwrap.invoke/invoke.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/function.objects/refwrap/refwrap.invoke/invoke.pass.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/function.objects/refwrap/refwrap.invoke/invoke.pass.cpp (original)
+++ libcxx/trunk/test/utilities/function.objects/refwrap/refwrap.invoke/invoke.pass.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,329 @@
-//===----------------------------------------------------------------------===//
//
//                     The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//

// <functional>

// reference_wrapper

// template <class... ArgTypes> 
//   requires Callable<T, ArgTypes&&...> 
//   Callable<T, ArgTypes&&...>::result_type 
//   operator()(ArgTypes&&... args) const;

#include <functional>
#include <cassert>

int count = 0;

// 1 arg, return void

void f_void_1(int i)
{
    count += i;
}

struct A_void_1
{
    void operator()(int i)
    {
        count += i;
    }

    void mem1() {++count;}
    void mem2() const {++count;}
};

void
test_void_1()
{
    int save_count = count;
    // function
    {
    std::reference_wrapper<void (int)> r1(f_void_1);
    int i = 2;
    r1(i);
    assert(count == save_cou
 nt+2);
    save_count = count;
    }
    // function pointer
    {
    void (*fp)(int) = f_void_1;
    std::reference_wrapper<void (*)(int)> r1(fp);
    int i = 3;
    r1(i);
    assert(count == save_count+3);
    save_count = count;
    }
    // functor
    {
    A_void_1 a0;
    std::reference_wrapper<A_void_1> r1(a0);
    int i = 4;
    r1(i);
    assert(count == save_count+4);
    save_count = count;
    }
    // member function pointer
    {
    void (A_void_1::*fp)() = &A_void_1::mem1;
    std::reference_wrapper<void (A_void_1::*)()> r1(fp);
    A_void_1 a;
    r1(a);
    assert(count == save_count+1);
    save_count = count;
    A_void_1* ap = &a;
    r1(ap);
    assert(count == save_count+1);
    save_count = count;
    }
    // const member function pointer
    {
    void (A_void_1::*fp)() const = &A_void_1::mem2;
    std::reference_wrapper<void (A_void_1::*)() const> r1(fp);
    A_void_1 a;
    r1(a);
    assert(count == save_count+1);
    save_count = count;
    A
 _void_1* ap = &a;
    r1(ap);
    assert(count == save_count+1);
    save_count = count;
    }
}

// 1 arg, return int

int f_int_1(int i)
{
    return i + 1;
}

struct A_int_1
{
    A_int_1() : data_(5) {}
    int operator()(int i)
    {
        return i - 1;
    }

    int mem1() {return 3;}
    int mem2() const {return 4;}
    int data_;
};

void
test_int_1()
{
    // function
    {
    std::reference_wrapper<int (int)> r1(f_int_1);
    int i = 2;
    assert(r1(i) == 3);
    }
    // function pointer
    {
    int (*fp)(int) = f_int_1;
    std::reference_wrapper<int (*)(int)> r1(fp);
    int i = 3;
    assert(r1(i) == 4);
    }
    // functor
    {
    A_int_1 a0;
    std::reference_wrapper<A_int_1> r1(a0);
    int i = 4;
    assert(r1(i) == 3);
    }
    // member function pointer
    {
    int (A_int_1::*fp)() = &A_int_1::mem1;
    std::reference_wrapper<int (A_int_1::*)()> r1(fp);
    A_int_1 a;
    assert(r1(a) == 3);
    A_int_1* ap = &a;
    assert(r1(ap) == 3);
   
  }
    // const member function pointer
    {
    int (A_int_1::*fp)() const = &A_int_1::mem2;
    std::reference_wrapper<int (A_int_1::*)() const> r1(fp);
    A_int_1 a;
    assert(r1(a) == 4);
    A_int_1* ap = &a;
    assert(r1(ap) == 4);
    }
    // member data pointer
    {
    int A_int_1::*fp = &A_int_1::data_;
    std::reference_wrapper<int A_int_1::*> r1(fp);
    A_int_1 a;
    assert(r1(a) == 5);
    r1(a) = 6;
    assert(r1(a) == 6);
    A_int_1* ap = &a;
    assert(r1(ap) == 6);
    r1(ap) = 7;
    assert(r1(ap) == 7);
    }
}

// 2 arg, return void

void f_void_2(int i, int j)
{
    count += i+j;
}

struct A_void_2
{
    void operator()(int i, int j)
    {
        count += i+j;
    }

    void mem1(int i) {count += i;}
    void mem2(int i) const {count += i;}
};

void
test_void_2()
{
    int save_count = count;
    // function
    {
    std::reference_wrapper<void (int, int)> r1(f_void_2);
    int i = 2;
    int j = 3;
    r1(i, j);
    assert(count == save_cou
 nt+5);
    save_count = count;
    }
    // function pointer
    {
    void (*fp)(int, int) = f_void_2;
    std::reference_wrapper<void (*)(int, int)> r1(fp);
    int i = 3;
    int j = 4;
    r1(i, j);
    assert(count == save_count+7);
    save_count = count;
    }
    // functor
    {
    A_void_2 a0;
    std::reference_wrapper<A_void_2> r1(a0);
    int i = 4;
    int j = 5;
    r1(i, j);
    assert(count == save_count+9);
    save_count = count;
    }
    // member function pointer
    {
    void (A_void_2::*fp)(int) = &A_void_2::mem1;
    std::reference_wrapper<void (A_void_2::*)(int)> r1(fp);
    A_void_2 a;
    int i = 3;
    r1(a, i);
    assert(count == save_count+3);
    save_count = count;
    A_void_2* ap = &a;
    r1(ap, i);
    assert(count == save_count+3);
    save_count = count;
    }
    // const member function pointer
    {
    void (A_void_2::*fp)(int) const = &A_void_2::mem2;
    std::reference_wrapper<void (A_void_2::*)(int) const> r1(fp);
    A_void_2
  a;
    int i = 4;
    r1(a, i);
    assert(count == save_count+4);
    save_count = count;
    A_void_2* ap = &a;
    r1(ap, i);
    assert(count == save_count+4);
    save_count = count;
    }
}

// 2 arg, return int

int f_int_2(int i, int j)
{
    return i+j;
}

struct A_int_2
{
    int operator()(int i, int j)
    {
        return i+j;
    }

    int mem1(int i) {return i+1;}
    int mem2(int i) const {return i+2;}
};

void
testint_2()
{
    // function
    {
    std::reference_wrapper<int (int, int)> r1(f_int_2);
    int i = 2;
    int j = 3;
    assert(r1(i, j) == i+j);
    }
    // function pointer
    {
    int (*fp)(int, int) = f_int_2;
    std::reference_wrapper<int (*)(int, int)> r1(fp);
    int i = 3;
    int j = 4;
    assert(r1(i, j) == i+j);
    }
    // functor
    {
    A_int_2 a0;
    std::reference_wrapper<A_int_2> r1(a0);
    int i = 4;
    int j = 5;
    assert(r1(i, j) == i+j);
    }
    // member function pointer
    {
    int(A_int_2::*fp)(int) = &A_
 int_2::mem1;
    std::reference_wrapper<int (A_int_2::*)(int)> r1(fp);
    A_int_2 a;
    int i = 3;
    assert(r1(a, i) == i+1);
    A_int_2* ap = &a;
    assert(r1(ap, i) == i+1);
    }
    // const member function pointer
    {
    int (A_int_2::*fp)(int) const = &A_int_2::mem2;
    std::reference_wrapper<int (A_int_2::*)(int) const> r1(fp);
    A_int_2 a;
    int i = 4;
    assert(r1(a, i) == i+2);
    A_int_2* ap = &a;
    assert(r1(ap, i) == i+2);
    }
}

int main()
{
    test_void_1();
    test_int_1();
    test_void_2();
    testint_2();
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <functional>
+
+// reference_wrapper
+
+// template <class... ArgTypes>
+//   requires Callable<T, ArgTypes&&...>
+//   Callable<T, ArgTypes&&...>::result_type
+//   operator()(ArgTypes&&... args) const;
+
+#include <functional>
+#include <cassert>
+
+int count = 0;
+
+// 1 arg, return void
+
+void f_void_1(int i)
+{
+    count += i;
+}
+
+struct A_void_1
+{
+    void operator()(int i)
+    {
+        count += i;
+    }
+
+    void mem1() {++count;}
+    void mem2() const {++count;}
+};
+
+void
+test_void_1()
+{
+    int save_count = count;
+    // function
+    {
+    std::reference_wrapper<void (int)> r1(f_void_1);
+    int i = 2;
+    r1(i);
+    assert(count == save_count+2);
+    save_count = count;
+    }
+    // function pointer
+    {
+    void (*fp)(int) = f_void_1;
+    std::reference_wrapper<void (*)(int)> r1(fp);
+    int i = 3;
+    r1(i);
+    assert(count == save_count+3);
+    save_count = count;
+    }
+    // functor
+    {
+    A_void_1 a0;
+    std::reference_wrapper<A_void_1> r1(a0);
+    int i = 4;
+    r1(i);
+    assert(count == save_count+4);
+    save_count = count;
+    }
+    // member function pointer
+    {
+    void (A_void_1::*fp)() = &A_void_1::mem1;
+    std::reference_wrapper<void (A_void_1::*)()> r1(fp);
+    A_void_1 a;
+    r1(a);
+    assert(count == save_count+1);
+    save_count = count;
+    A_void_1* ap = &a;
+    r1(ap);
+    assert(count == save_count+1);
+    save_count = count;
+    }
+    // const member function pointer
+    {
+    void (A_void_1::*fp)() const = &A_void_1::mem2;
+    std::reference_wrapper<void (A_void_1::*)() const> r1(fp);
+    A_void_1 a;
+    r1(a);
+    assert(count == save_count+1);
+    save_count = count;
+    A_void_1* ap = &a;
+    r1(ap);
+    assert(count == save_count+1);
+    save_count = count;
+    }
+}
+
+// 1 arg, return int
+
+int f_int_1(int i)
+{
+    return i + 1;
+}
+
+struct A_int_1
+{
+    A_int_1() : data_(5) {}
+    int operator()(int i)
+    {
+        return i - 1;
+    }
+
+    int mem1() {return 3;}
+    int mem2() const {return 4;}
+    int data_;
+};
+
+void
+test_int_1()
+{
+    // function
+    {
+    std::reference_wrapper<int (int)> r1(f_int_1);
+    int i = 2;
+    assert(r1(i) == 3);
+    }
+    // function pointer
+    {
+    int (*fp)(int) = f_int_1;
+    std::reference_wrapper<int (*)(int)> r1(fp);
+    int i = 3;
+    assert(r1(i) == 4);
+    }
+    // functor
+    {
+    A_int_1 a0;
+    std::reference_wrapper<A_int_1> r1(a0);
+    int i = 4;
+    assert(r1(i) == 3);
+    }
+    // member function pointer
+    {
+    int (A_int_1::*fp)() = &A_int_1::mem1;
+    std::reference_wrapper<int (A_int_1::*)()> r1(fp);
+    A_int_1 a;
+    assert(r1(a) == 3);
+    A_int_1* ap = &a;
+    assert(r1(ap) == 3);
+    }
+    // const member function pointer
+    {
+    int (A_int_1::*fp)() const = &A_int_1::mem2;
+    std::reference_wrapper<int (A_int_1::*)() const> r1(fp);
+    A_int_1 a;
+    assert(r1(a) == 4);
+    A_int_1* ap = &a;
+    assert(r1(ap) == 4);
+    }
+    // member data pointer
+    {
+    int A_int_1::*fp = &A_int_1::data_;
+    std::reference_wrapper<int A_int_1::*> r1(fp);
+    A_int_1 a;
+    assert(r1(a) == 5);
+    r1(a) = 6;
+    assert(r1(a) == 6);
+    A_int_1* ap = &a;
+    assert(r1(ap) == 6);
+    r1(ap) = 7;
+    assert(r1(ap) == 7);
+    }
+}
+
+// 2 arg, return void
+
+void f_void_2(int i, int j)
+{
+    count += i+j;
+}
+
+struct A_void_2
+{
+    void operator()(int i, int j)
+    {
+        count += i+j;
+    }
+
+    void mem1(int i) {count += i;}
+    void mem2(int i) const {count += i;}
+};
+
+void
+test_void_2()
+{
+    int save_count = count;
+    // function
+    {
+    std::reference_wrapper<void (int, int)> r1(f_void_2);
+    int i = 2;
+    int j = 3;
+    r1(i, j);
+    assert(count == save_count+5);
+    save_count = count;
+    }
+    // function pointer
+    {
+    void (*fp)(int, int) = f_void_2;
+    std::reference_wrapper<void (*)(int, int)> r1(fp);
+    int i = 3;
+    int j = 4;
+    r1(i, j);
+    assert(count == save_count+7);
+    save_count = count;
+    }
+    // functor
+    {
+    A_void_2 a0;
+    std::reference_wrapper<A_void_2> r1(a0);
+    int i = 4;
+    int j = 5;
+    r1(i, j);
+    assert(count == save_count+9);
+    save_count = count;
+    }
+    // member function pointer
+    {
+    void (A_void_2::*fp)(int) = &A_void_2::mem1;
+    std::reference_wrapper<void (A_void_2::*)(int)> r1(fp);
+    A_void_2 a;
+    int i = 3;
+    r1(a, i);
+    assert(count == save_count+3);
+    save_count = count;
+    A_void_2* ap = &a;
+    r1(ap, i);
+    assert(count == save_count+3);
+    save_count = count;
+    }
+    // const member function pointer
+    {
+    void (A_void_2::*fp)(int) const = &A_void_2::mem2;
+    std::reference_wrapper<void (A_void_2::*)(int) const> r1(fp);
+    A_void_2 a;
+    int i = 4;
+    r1(a, i);
+    assert(count == save_count+4);
+    save_count = count;
+    A_void_2* ap = &a;
+    r1(ap, i);
+    assert(count == save_count+4);
+    save_count = count;
+    }
+}
+
+// 2 arg, return int
+
+int f_int_2(int i, int j)
+{
+    return i+j;
+}
+
+struct A_int_2
+{
+    int operator()(int i, int j)
+    {
+        return i+j;
+    }
+
+    int mem1(int i) {return i+1;}
+    int mem2(int i) const {return i+2;}
+};
+
+void
+testint_2()
+{
+    // function
+    {
+    std::reference_wrapper<int (int, int)> r1(f_int_2);
+    int i = 2;
+    int j = 3;
+    assert(r1(i, j) == i+j);
+    }
+    // function pointer
+    {
+    int (*fp)(int, int) = f_int_2;
+    std::reference_wrapper<int (*)(int, int)> r1(fp);
+    int i = 3;
+    int j = 4;
+    assert(r1(i, j) == i+j);
+    }
+    // functor
+    {
+    A_int_2 a0;
+    std::reference_wrapper<A_int_2> r1(a0);
+    int i = 4;
+    int j = 5;
+    assert(r1(i, j) == i+j);
+    }
+    // member function pointer
+    {
+    int(A_int_2::*fp)(int) = &A_int_2::mem1;
+    std::reference_wrapper<int (A_int_2::*)(int)> r1(fp);
+    A_int_2 a;
+    int i = 3;
+    assert(r1(a, i) == i+1);
+    A_int_2* ap = &a;
+    assert(r1(ap, i) == i+1);
+    }
+    // const member function pointer
+    {
+    int (A_int_2::*fp)(int) const = &A_int_2::mem2;
+    std::reference_wrapper<int (A_int_2::*)(int) const> r1(fp);
+    A_int_2 a;
+    int i = 4;
+    assert(r1(a, i) == i+2);
+    A_int_2* ap = &a;
+    assert(r1(ap, i) == i+2);
+    }
+}
+
+int main()
+{
+    test_void_1();
+    test_int_1();
+    test_void_2();
+    testint_2();
+}

Modified: libcxx/trunk/test/utilities/function.objects/refwrap/refwrap.invoke/invoke_int_0.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/function.objects/refwrap/refwrap.invoke/invoke_int_0.pass.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/function.objects/refwrap/refwrap.invoke/invoke_int_0.pass.cpp (original)
+++ libcxx/trunk/test/utilities/function.objects/refwrap/refwrap.invoke/invoke_int_0.pass.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,76 @@
-//===----------------------------------------------------------------------===//
//
//                     The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//

// <functional>

// reference_wrapper

// template <class... ArgTypes> 
//   requires Callable<T, ArgTypes&&...> 
//   Callable<T, ArgTypes&&...>::result_type 
//   operator()(ArgTypes&&... args) const;

#include <functional>
#include <cassert>

// 0 args, return int

int count = 0;

int f_int_0()
{
    return 3;
}

struct A_int_0
{
    int operator()() {return 4;}
};

void
test_int_0()
{
    // function
    {
    std::reference_wrapper<int ()> r1(f_int_0);
    assert(r1() == 3);
    }
    // function pointer
    {
    int (*fp)() = f_int_0;
    std::reference_wrapper<int (*)()> r1(fp);
    assert(r1() == 3);
    }
    // functor
    {
   
  A_int_0 a0;
    std::reference_wrapper<A_int_0> r1(a0);
    assert(r1() == 4);
    }
}


// 1 arg, return void

void f_void_1(int i)
{
    count += i;
}

struct A_void_1
{
    void operator()(int i)
    {
        count += i;
    }
};

int main()
{
    test_int_0();
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <functional>
+
+// reference_wrapper
+
+// template <class... ArgTypes>
+//   requires Callable<T, ArgTypes&&...>
+//   Callable<T, ArgTypes&&...>::result_type
+//   operator()(ArgTypes&&... args) const;
+
+#include <functional>
+#include <cassert>
+
+// 0 args, return int
+
+int count = 0;
+
+int f_int_0()
+{
+    return 3;
+}
+
+struct A_int_0
+{
+    int operator()() {return 4;}
+};
+
+void
+test_int_0()
+{
+    // function
+    {
+    std::reference_wrapper<int ()> r1(f_int_0);
+    assert(r1() == 3);
+    }
+    // function pointer
+    {
+    int (*fp)() = f_int_0;
+    std::reference_wrapper<int (*)()> r1(fp);
+    assert(r1() == 3);
+    }
+    // functor
+    {
+    A_int_0 a0;
+    std::reference_wrapper<A_int_0> r1(a0);
+    assert(r1() == 4);
+    }
+}
+
+// 1 arg, return void
+
+void f_void_1(int i)
+{
+    count += i;
+}
+
+struct A_void_1
+{
+    void operator()(int i)
+    {
+        count += i;
+    }
+};
+
+int main()
+{
+    test_int_0();
+}

Modified: libcxx/trunk/test/utilities/function.objects/refwrap/refwrap.invoke/invoke_void_0.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/function.objects/refwrap/refwrap.invoke/invoke_void_0.pass.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/function.objects/refwrap/refwrap.invoke/invoke_void_0.pass.cpp (original)
+++ libcxx/trunk/test/utilities/function.objects/refwrap/refwrap.invoke/invoke_void_0.pass.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,68 @@
-//===----------------------------------------------------------------------===//
//
//                     The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//

// <functional>

// reference_wrapper

// template <class... ArgTypes> 
//   requires Callable<T, ArgTypes&&...> 
//   Callable<T, ArgTypes&&...>::result_type 
//   operator()(ArgTypes&&... args) const;

#include <functional>
#include <cassert>

// 0 args, return void

int count = 0;

void f_void_0()
{
    ++count;
}

struct A_void_0
{
    void operator()() {++count;}
};

void
test_void_0()
{
    int save_count = count;
    // function
    {
    std::reference_wrapper<void ()> r1(f_void_0);
    r1();
    assert(count == save_count+1);
    save_count = count;
    }
    // function pointer
    {
    void (*fp)() = f_void_0;
    std::referenc
 e_wrapper<void (*)()> r1(fp);
    r1();
    assert(count == save_count+1);
    save_count = count;
    }
    // functor
    {
    A_void_0 a0;
    std::reference_wrapper<A_void_0> r1(a0);
    r1();
    assert(count == save_count+1);
    save_count = count;
    }
}

int main()
{
    test_void_0();
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <functional>
+
+// reference_wrapper
+
+// template <class... ArgTypes>
+//   requires Callable<T, ArgTypes&&...>
+//   Callable<T, ArgTypes&&...>::result_type
+//   operator()(ArgTypes&&... args) const;
+
+#include <functional>
+#include <cassert>
+
+// 0 args, return void
+
+int count = 0;
+
+void f_void_0()
+{
+    ++count;
+}
+
+struct A_void_0
+{
+    void operator()() {++count;}
+};
+
+void
+test_void_0()
+{
+    int save_count = count;
+    // function
+    {
+    std::reference_wrapper<void ()> r1(f_void_0);
+    r1();
+    assert(count == save_count+1);
+    save_count = count;
+    }
+    // function pointer
+    {
+    void (*fp)() = f_void_0;
+    std::reference_wrapper<void (*)()> r1(fp);
+    r1();
+    assert(count == save_count+1);
+    save_count = count;
+    }
+    // functor
+    {
+    A_void_0 a0;
+    std::reference_wrapper<A_void_0> r1(a0);
+    r1();
+    assert(count == save_count+1);
+    save_count = count;
+    }
+}
+
+int main()
+{
+    test_void_0();
+}

Modified: libcxx/trunk/test/utilities/function.objects/refwrap/type.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/function.objects/refwrap/type.pass.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/function.objects/refwrap/type.pass.cpp (original)
+++ libcxx/trunk/test/utilities/function.objects/refwrap/type.pass.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,37 @@
-//===----------------------------------------------------------------------===//
//
//                     The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//

// <functional>

// reference_wrapper

// check for member typedef type

#include <functional>
#include <type_traits>

class C {};

int main()
{
    static_assert((std::is_same<std::reference_wrapper<C>::type,
                                                       C>::value), "");
    static_assert((std::is_same<std::reference_wrapper<void ()>::type,
                                                       void ()>::value), "");
    static_assert((std::is_same<std::reference_wrapper<int* (double*)>::type,
                                                       int* (double*)>::value), "");
    static_assert((std::is_same<std::reference_wrappe
 r<void(*)()>::type,
                                                       void(*)()>::value), "");
    static_assert((std::is_same<std::reference_wrapper<int*(*)(double*)>::type,
                                                       int*(*)(double*)>::value), "");
    static_assert((std::is_same<std::reference_wrapper<int*(C::*)(double*)>::type,
                                                       int*(C::*)(double*)>::value), "");
    static_assert((std::is_same<std::reference_wrapper<int (C::*)(double*) const volatile>::type,
                                                       int (C::*)(double*) const volatile>::value), "");
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <functional>
+
+// reference_wrapper
+
+// check for member typedef type
+
+#include <functional>
+#include <type_traits>
+
+class C {};
+
+int main()
+{
+    static_assert((std::is_same<std::reference_wrapper<C>::type,
+                                                       C>::value), "");
+    static_assert((std::is_same<std::reference_wrapper<void ()>::type,
+                                                       void ()>::value), "");
+    static_assert((std::is_same<std::reference_wrapper<int* (double*)>::type,
+                                                       int* (double*)>::value), "");
+    static_assert((std::is_same<std::reference_wrapper<void(*)()>::type,
+                                                       void(*)()>::value), "");
+    static_assert((std::is_same<std::reference_wrapper<int*(*)(double*)>::type,
+                                                       int*(*)(double*)>::value), "");
+    static_assert((std::is_same<std::reference_wrapper<int*(C::*)(double*)>::type,
+                                                       int*(C::*)(double*)>::value), "");
+    static_assert((std::is_same<std::reference_wrapper<int (C::*)(double*) const volatile>::type,
+                                                       int (C::*)(double*) const volatile>::value), "");
+}

Modified: libcxx/trunk/test/utilities/function.objects/refwrap/unary.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/function.objects/refwrap/unary.pass.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/function.objects/refwrap/unary.pass.cpp (original)
+++ libcxx/trunk/test/utilities/function.objects/refwrap/unary.pass.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,78 @@
-//===----------------------------------------------------------------------===//
//
//                     The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//

// <functional>

// reference_wrapper

// check for deriving from unary_function

#include <functional>
#include <type_traits>

class functor1
    : public std::unary_function<int, char>
{
};

class functor2
    : public std::binary_function<char, int, double>
{
};

class functor3
    : public std::unary_function<int, int>,
      public std::binary_function<char, int, double>
{
public:
    typedef float result_type;
};

class functor4
    : public std::unary_function<int, int>,
      public std::binary_function<char, int, double>
{
public:
};

struct C
{
    typedef int argument_type;
    typedef int result_type;
};

int main()
{
    stati
 c_assert((std::is_base_of<std::unary_function<int, char>,
                                   std::reference_wrapper<functor1> >::value), "");
    static_assert((!std::is_base_of<std::unary_function<char, int>,
                                    std::reference_wrapper<functor2> >::value), "");
    static_assert((std::is_base_of<std::unary_function<int, int>,
                                   std::reference_wrapper<functor3> >::value), "");
    static_assert((std::is_base_of<std::unary_function<int, int>,
                                   std::reference_wrapper<functor4> >::value), "");
    static_assert((!std::is_base_of<std::unary_function<int, int>,
                                    std::reference_wrapper<C> >::value), "");
    static_assert((!std::is_base_of<std::unary_function<int, float>,
                                    std::reference_wrapper<float(*)()> >::value), "");
    static_assert((std::is_base_of<std::unary_function<int, float>,
                         
           std::reference_wrapper<float (int)> >::value), "");
    static_assert((!std::is_base_of<std::unary_function<int, float>,
                                    std::reference_wrapper<float (int, int)> >::value), "");
    static_assert((std::is_base_of<std::unary_function<int, float>,
                                   std::reference_wrapper<float(*)(int)> >::value), "");
    static_assert((!std::is_base_of<std::unary_function<int, float>,
                                    std::reference_wrapper<float(*)(int, int)> >::value), "");
    static_assert((std::is_base_of<std::unary_function<C*, float>,
                                   std::reference_wrapper<float(C::*)()> >::value), "");
    static_assert((std::is_base_of<std::unary_function<const volatile C*, float>,
                                   std::reference_wrapper<float(C::*)() const volatile> >::value), "");
    static_assert((!std::is_base_of<std::unary_function<C*, float>,
                                  
  std::reference_wrapper<float(C::*)(int)> >::value), "");
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <functional>
+
+// reference_wrapper
+
+// check for deriving from unary_function
+
+#include <functional>
+#include <type_traits>
+
+class functor1
+    : public std::unary_function<int, char>
+{
+};
+
+class functor2
+    : public std::binary_function<char, int, double>
+{
+};
+
+class functor3
+    : public std::unary_function<int, int>,
+      public std::binary_function<char, int, double>
+{
+public:
+    typedef float result_type;
+};
+
+class functor4
+    : public std::unary_function<int, int>,
+      public std::binary_function<char, int, double>
+{
+public:
+};
+
+struct C
+{
+    typedef int argument_type;
+    typedef int result_type;
+};
+
+int main()
+{
+    static_assert((std::is_base_of<std::unary_function<int, char>,
+                                   std::reference_wrapper<functor1> >::value), "");
+    static_assert((!std::is_base_of<std::unary_function<char, int>,
+                                    std::reference_wrapper<functor2> >::value), "");
+    static_assert((std::is_base_of<std::unary_function<int, int>,
+                                   std::reference_wrapper<functor3> >::value), "");
+    static_assert((std::is_base_of<std::unary_function<int, int>,
+                                   std::reference_wrapper<functor4> >::value), "");
+    static_assert((!std::is_base_of<std::unary_function<int, int>,
+                                    std::reference_wrapper<C> >::value), "");
+    static_assert((!std::is_base_of<std::unary_function<int, float>,
+                                    std::reference_wrapper<float(*)()> >::value), "");
+    static_assert((std::is_base_of<std::unary_function<int, float>,
+                                   std::reference_wrapper<float (int)> >::value), "");
+    static_assert((!std::is_base_of<std::unary_function<int, float>,
+                                    std::reference_wrapper<float (int, int)> >::value), "");
+    static_assert((std::is_base_of<std::unary_function<int, float>,
+                                   std::reference_wrapper<float(*)(int)> >::value), "");
+    static_assert((!std::is_base_of<std::unary_function<int, float>,
+                                    std::reference_wrapper<float(*)(int, int)> >::value), "");
+    static_assert((std::is_base_of<std::unary_function<C*, float>,
+                                   std::reference_wrapper<float(C::*)()> >::value), "");
+    static_assert((std::is_base_of<std::unary_function<const volatile C*, float>,
+                                   std::reference_wrapper<float(C::*)() const volatile> >::value), "");
+    static_assert((!std::is_base_of<std::unary_function<C*, float>,
+                                   std::reference_wrapper<float(C::*)(int)> >::value), "");
+}

Modified: libcxx/trunk/test/utilities/function.objects/refwrap/weak_result.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/function.objects/refwrap/weak_result.pass.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/function.objects/refwrap/weak_result.pass.cpp (original)
+++ libcxx/trunk/test/utilities/function.objects/refwrap/weak_result.pass.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,82 @@
-//===----------------------------------------------------------------------===//
//
//                     The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//

// <functional>

// reference_wrapper

// has weak result type

#include <functional>
#include <type_traits>

class functor1
    : public std::unary_function<int, char>
{
};

class functor2
    : public std::binary_function<char, int, double>
{
};

class functor3
    : public std::unary_function<char, int>,
      public std::binary_function<char, int, double>
{
public:
    typedef float result_type;
};

class functor4
    : public std::unary_function<char, int>,
      public std::binary_function<char, int, double>
{
public:
};

class C {};

template <class T>
struct has_result_type
{
private:
    struct two {char _; char __;};
    template
  <class U> static two test(...);
    template <class U> static char test(typename U::result_type* = 0);
public:
    static const bool value = sizeof(test<T>(0)) == 1;
};

int main()
{
    static_assert((std::is_same<std::reference_wrapper<functor1>::result_type,
                                char>::value), "");
    static_assert((std::is_same<std::reference_wrapper<functor2>::result_type,
                                double>::value), "");
    static_assert((std::is_same<std::reference_wrapper<functor3>::result_type,
                                float>::value), "");
    static_assert((std::is_same<std::reference_wrapper<void()>::result_type,
                                void>::value), "");
    static_assert((std::is_same<std::reference_wrapper<int*(double*)>::result_type,
                                int*>::value), "");
    static_assert((std::is_same<std::reference_wrapper<void(*)()>::result_type,
                                void>::value), "");
    static_a
 ssert((std::is_same<std::reference_wrapper<int*(*)(double*)>::result_type,
                                int*>::value), "");
    static_assert((std::is_same<std::reference_wrapper<int*(C::*)(double*)>::result_type,
                                int*>::value), "");
    static_assert((std::is_same<std::reference_wrapper<int (C::*)(double*) const volatile>::result_type,
                                int>::value), "");
    static_assert((std::is_same<std::reference_wrapper<C()>::result_type,
                                C>::value), "");
    static_assert(has_result_type<std::reference_wrapper<functor3> >::value, "");
    static_assert(!has_result_type<std::reference_wrapper<functor4> >::value, "");
    static_assert(!has_result_type<std::reference_wrapper<C> >::value, "");
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <functional>
+
+// reference_wrapper
+
+// has weak result type
+
+#include <functional>
+#include <type_traits>
+
+class functor1
+    : public std::unary_function<int, char>
+{
+};
+
+class functor2
+    : public std::binary_function<char, int, double>
+{
+};
+
+class functor3
+    : public std::unary_function<char, int>,
+      public std::binary_function<char, int, double>
+{
+public:
+    typedef float result_type;
+};
+
+class functor4
+    : public std::unary_function<char, int>,
+      public std::binary_function<char, int, double>
+{
+public:
+};
+
+class C {};
+
+template <class T>
+struct has_result_type
+{
+private:
+    struct two {char _; char __;};
+    template <class U> static two test(...);
+    template <class U> static char test(typename U::result_type* = 0);
+public:
+    static const bool value = sizeof(test<T>(0)) == 1;
+};
+
+int main()
+{
+    static_assert((std::is_same<std::reference_wrapper<functor1>::result_type,
+                                char>::value), "");
+    static_assert((std::is_same<std::reference_wrapper<functor2>::result_type,
+                                double>::value), "");
+    static_assert((std::is_same<std::reference_wrapper<functor3>::result_type,
+                                float>::value), "");
+    static_assert((std::is_same<std::reference_wrapper<void()>::result_type,
+                                void>::value), "");
+    static_assert((std::is_same<std::reference_wrapper<int*(double*)>::result_type,
+                                int*>::value), "");
+    static_assert((std::is_same<std::reference_wrapper<void(*)()>::result_type,
+                                void>::value), "");
+    static_assert((std::is_same<std::reference_wrapper<int*(*)(double*)>::result_type,
+                                int*>::value), "");
+    static_assert((std::is_same<std::reference_wrapper<int*(C::*)(double*)>::result_type,
+                                int*>::value), "");
+    static_assert((std::is_same<std::reference_wrapper<int (C::*)(double*) const volatile>::result_type,
+                                int>::value), "");
+    static_assert((std::is_same<std::reference_wrapper<C()>::result_type,
+                                C>::value), "");
+    static_assert(has_result_type<std::reference_wrapper<functor3> >::value, "");
+    static_assert(!has_result_type<std::reference_wrapper<functor4> >::value, "");
+    static_assert(!has_result_type<std::reference_wrapper<C> >::value, "");
+}

Modified: libcxx/trunk/test/utilities/function.objects/version.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/function.objects/version.pass.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/function.objects/version.pass.cpp (original)
+++ libcxx/trunk/test/utilities/function.objects/version.pass.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,20 @@
-//===----------------------------------------------------------------------===//
//
//                     The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//

// <functional>

#include <functional>

#ifndef _LIBCPP_VERSION
#error _LIBCPP_VERSION not defined
#endif

int main()
{
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <functional>
+
+#include <functional>
+
+#ifndef _LIBCPP_VERSION
+#error _LIBCPP_VERSION not defined
+#endif
+
+int main()
+{
+}

Modified: libcxx/trunk/test/utilities/memory/allocator.adaptor/allocator.adaptor.cnstr/allocs.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/memory/allocator.adaptor/allocator.adaptor.cnstr/allocs.pass.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/memory/allocator.adaptor/allocator.adaptor.cnstr/allocs.pass.cpp (original)
+++ libcxx/trunk/test/utilities/memory/allocator.adaptor/allocator.adaptor.cnstr/allocs.pass.cpp Sat Aug 21 19:59:46 2010
@@ -108,5 +108,5 @@
             std::scoped_allocator_adaptor<A2<int>, A3<int>>(A2<int>(5), A3<int>(6))));
     }
 
-#endif
+#endif  // _LIBCPP_MOVE
 }

Modified: libcxx/trunk/test/utilities/memory/allocator.adaptor/allocator.adaptor.cnstr/converting_copy.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/memory/allocator.adaptor/allocator.adaptor.cnstr/converting_copy.pass.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/memory/allocator.adaptor/allocator.adaptor.cnstr/converting_copy.pass.cpp (original)
+++ libcxx/trunk/test/utilities/memory/allocator.adaptor/allocator.adaptor.cnstr/converting_copy.pass.cpp Sat Aug 21 19:59:46 2010
@@ -65,5 +65,5 @@
         assert(a2 == a1);
     }
 
-#endif
+#endif  // _LIBCPP_MOVE
 }

Modified: libcxx/trunk/test/utilities/memory/allocator.adaptor/allocator.adaptor.cnstr/converting_move.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/memory/allocator.adaptor/allocator.adaptor.cnstr/converting_move.pass.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/memory/allocator.adaptor/allocator.adaptor.cnstr/converting_move.pass.cpp (original)
+++ libcxx/trunk/test/utilities/memory/allocator.adaptor/allocator.adaptor.cnstr/converting_move.pass.cpp Sat Aug 21 19:59:46 2010
@@ -71,5 +71,5 @@
         assert(a2 == a1);
     }
 
-#endif
+#endif  // _LIBCPP_MOVE
 }

Modified: libcxx/trunk/test/utilities/memory/allocator.adaptor/allocator.adaptor.cnstr/copy.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/memory/allocator.adaptor/allocator.adaptor.cnstr/copy.pass.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/memory/allocator.adaptor/allocator.adaptor.cnstr/copy.pass.cpp (original)
+++ libcxx/trunk/test/utilities/memory/allocator.adaptor/allocator.adaptor.cnstr/copy.pass.cpp Sat Aug 21 19:59:46 2010
@@ -66,5 +66,5 @@
         assert(a2 == a1);
     }
 
-#endif
+#endif  // _LIBCPP_MOVE
 }

Modified: libcxx/trunk/test/utilities/memory/allocator.adaptor/allocator.adaptor.cnstr/default.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/memory/allocator.adaptor/allocator.adaptor.cnstr/default.pass.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/memory/allocator.adaptor/allocator.adaptor.cnstr/default.pass.cpp (original)
+++ libcxx/trunk/test/utilities/memory/allocator.adaptor/allocator.adaptor.cnstr/default.pass.cpp Sat Aug 21 19:59:46 2010
@@ -54,5 +54,5 @@
         assert(A3<int>::move_called == false);
     }
 
-#endif
+#endif  // _LIBCPP_MOVE
 }

Modified: libcxx/trunk/test/utilities/memory/allocator.adaptor/allocator.adaptor.members/allocate_size.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/memory/allocator.adaptor/allocator.adaptor.members/allocate_size.pass.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/memory/allocator.adaptor/allocator.adaptor.members/allocate_size.pass.cpp (original)
+++ libcxx/trunk/test/utilities/memory/allocator.adaptor/allocator.adaptor.members/allocate_size.pass.cpp Sat Aug 21 19:59:46 2010
@@ -45,5 +45,5 @@
         assert(A1<int>::allocate_called == true);
     }
 
-#endif
+#endif  // _LIBCPP_MOVE
 }

Modified: libcxx/trunk/test/utilities/memory/allocator.adaptor/allocator.adaptor.members/allocate_size_hint.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/memory/allocator.adaptor/allocator.adaptor.members/allocate_size_hint.pass.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/memory/allocator.adaptor/allocator.adaptor.members/allocate_size_hint.pass.cpp (original)
+++ libcxx/trunk/test/utilities/memory/allocator.adaptor/allocator.adaptor.members/allocate_size_hint.pass.cpp Sat Aug 21 19:59:46 2010
@@ -66,5 +66,5 @@
         assert(a.allocate(10, (const void*)20) == (int*)20);
         assert(A2<int>::allocate_called == true);
     }
-#endif
+#endif  // _LIBCPP_MOVE
 }

Modified: libcxx/trunk/test/utilities/memory/allocator.adaptor/allocator.adaptor.members/construct.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/memory/allocator.adaptor/allocator.adaptor.members/construct.pass.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/memory/allocator.adaptor/allocator.adaptor.members/construct.pass.cpp (original)
+++ libcxx/trunk/test/utilities/memory/allocator.adaptor/allocator.adaptor.members/construct.pass.cpp Sat Aug 21 19:59:46 2010
@@ -111,7 +111,7 @@
 
 bool F::constructed = false;
 
-#endif
+#endif  // _LIBCPP_MOVE
 
 int main()
 {
@@ -189,5 +189,5 @@
         s->~S();
     }
 
-#endif
+#endif  // _LIBCPP_MOVE
 }

Modified: libcxx/trunk/test/utilities/memory/allocator.adaptor/allocator.adaptor.members/deallocate.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/memory/allocator.adaptor/allocator.adaptor.members/deallocate.pass.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/memory/allocator.adaptor/allocator.adaptor.members/deallocate.pass.cpp (original)
+++ libcxx/trunk/test/utilities/memory/allocator.adaptor/allocator.adaptor.members/deallocate.pass.cpp Sat Aug 21 19:59:46 2010
@@ -42,5 +42,5 @@
         assert((A1<int>::deallocate_called == std::pair<int*, std::size_t>((int*)10, 20)));
     }
 
-#endif
+#endif  // _LIBCPP_MOVE
 }

Modified: libcxx/trunk/test/utilities/memory/allocator.adaptor/allocator.adaptor.members/destroy.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/memory/allocator.adaptor/allocator.adaptor.members/destroy.pass.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/memory/allocator.adaptor/allocator.adaptor.members/destroy.pass.cpp (original)
+++ libcxx/trunk/test/utilities/memory/allocator.adaptor/allocator.adaptor.members/destroy.pass.cpp Sat Aug 21 19:59:46 2010
@@ -66,5 +66,5 @@
         assert(A3<S>::destroy_called);
     }
 
-#endif
+#endif  // _LIBCPP_MOVE
 }

Modified: libcxx/trunk/test/utilities/memory/allocator.adaptor/allocator.adaptor.members/inner_allocator.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/memory/allocator.adaptor/allocator.adaptor.members/inner_allocator.pass.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/memory/allocator.adaptor/allocator.adaptor.members/inner_allocator.pass.cpp (original)
+++ libcxx/trunk/test/utilities/memory/allocator.adaptor/allocator.adaptor.members/inner_allocator.pass.cpp Sat Aug 21 19:59:46 2010
@@ -41,5 +41,5 @@
             std::scoped_allocator_adaptor<A2<int>, A3<int>>(A2<int>(6), A3<int>(8))));
     }
 
-#endif
+#endif  // _LIBCPP_MOVE
 }

Modified: libcxx/trunk/test/utilities/memory/allocator.adaptor/allocator.adaptor.members/max_size.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/memory/allocator.adaptor/allocator.adaptor.members/max_size.pass.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/memory/allocator.adaptor/allocator.adaptor.members/max_size.pass.cpp (original)
+++ libcxx/trunk/test/utilities/memory/allocator.adaptor/allocator.adaptor.members/max_size.pass.cpp Sat Aug 21 19:59:46 2010
@@ -39,5 +39,5 @@
         assert(a.max_size() == 200);
     }
 
-#endif
+#endif  // _LIBCPP_MOVE
 }

Modified: libcxx/trunk/test/utilities/memory/allocator.adaptor/allocator.adaptor.members/outer_allocator.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/memory/allocator.adaptor/allocator.adaptor.members/outer_allocator.pass.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/memory/allocator.adaptor/allocator.adaptor.members/outer_allocator.pass.cpp (original)
+++ libcxx/trunk/test/utilities/memory/allocator.adaptor/allocator.adaptor.members/outer_allocator.pass.cpp Sat Aug 21 19:59:46 2010
@@ -40,5 +40,5 @@
         assert(a.outer_allocator() == A1<int>(5));
     }
 
-#endif
+#endif  // _LIBCPP_MOVE
 }

Modified: libcxx/trunk/test/utilities/memory/allocator.adaptor/allocator.adaptor.members/select_on_container_copy_construction.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/memory/allocator.adaptor/allocator.adaptor.members/select_on_container_copy_construction.pass.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/memory/allocator.adaptor/allocator.adaptor.members/select_on_container_copy_construction.pass.cpp (original)
+++ libcxx/trunk/test/utilities/memory/allocator.adaptor/allocator.adaptor.members/select_on_container_copy_construction.pass.cpp Sat Aug 21 19:59:46 2010
@@ -51,5 +51,5 @@
         assert(a2.inner_allocator().inner_allocator().outer_allocator().id() == -1);
     }
 
-#endif
+#endif  // _LIBCPP_MOVE
 }

Modified: libcxx/trunk/test/utilities/memory/allocator.adaptor/allocator.adaptor.types/inner_allocator_type.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/memory/allocator.adaptor/allocator.adaptor.types/inner_allocator_type.pass.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/memory/allocator.adaptor/allocator.adaptor.types/inner_allocator_type.pass.cpp (original)
+++ libcxx/trunk/test/utilities/memory/allocator.adaptor/allocator.adaptor.types/inner_allocator_type.pass.cpp Sat Aug 21 19:59:46 2010
@@ -35,5 +35,5 @@
         std::scoped_allocator_adaptor<A1<int>, A2<int>, A3<int>>::inner_allocator_type,
         std::scoped_allocator_adaptor<A2<int>, A3<int>>>::value), "");
 
-#endif
+#endif  // _LIBCPP_MOVE
 }

Modified: libcxx/trunk/test/utilities/memory/allocator.adaptor/allocator.adaptor.types/propagate_on_container_copy_assignment.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/memory/allocator.adaptor/allocator.adaptor.types/propagate_on_container_copy_assignment.pass.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/memory/allocator.adaptor/allocator.adaptor.types/propagate_on_container_copy_assignment.pass.cpp (original)
+++ libcxx/trunk/test/utilities/memory/allocator.adaptor/allocator.adaptor.types/propagate_on_container_copy_assignment.pass.cpp Sat Aug 21 19:59:46 2010
@@ -35,5 +35,5 @@
         std::scoped_allocator_adaptor<A1<int>, A2<int>, A3<int>>::propagate_on_container_copy_assignment,
         std::true_type>::value), "");
 
-#endif
+#endif  // _LIBCPP_MOVE
 }

Modified: libcxx/trunk/test/utilities/memory/allocator.adaptor/allocator.adaptor.types/propagate_on_container_move_assignment.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/memory/allocator.adaptor/allocator.adaptor.types/propagate_on_container_move_assignment.pass.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/memory/allocator.adaptor/allocator.adaptor.types/propagate_on_container_move_assignment.pass.cpp (original)
+++ libcxx/trunk/test/utilities/memory/allocator.adaptor/allocator.adaptor.types/propagate_on_container_move_assignment.pass.cpp Sat Aug 21 19:59:46 2010
@@ -35,5 +35,5 @@
         std::scoped_allocator_adaptor<A1<int>, A2<int>, A3<int>>::propagate_on_container_move_assignment,
         std::true_type>::value), "");
 
-#endif
+#endif  // _LIBCPP_MOVE
 }

Modified: libcxx/trunk/test/utilities/memory/allocator.adaptor/allocator.adaptor.types/propagate_on_container_swap.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/memory/allocator.adaptor/allocator.adaptor.types/propagate_on_container_swap.pass.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/memory/allocator.adaptor/allocator.adaptor.types/propagate_on_container_swap.pass.cpp (original)
+++ libcxx/trunk/test/utilities/memory/allocator.adaptor/allocator.adaptor.types/propagate_on_container_swap.pass.cpp Sat Aug 21 19:59:46 2010
@@ -35,5 +35,5 @@
         std::scoped_allocator_adaptor<A1<int>, A2<int>, A3<int>>::propagate_on_container_swap,
         std::true_type>::value), "");
 
-#endif
+#endif  // _LIBCPP_MOVE
 }

Modified: libcxx/trunk/test/utilities/memory/allocator.adaptor/allocators.h
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/memory/allocator.adaptor/allocators.h?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/memory/allocator.adaptor/allocators.h (original)
+++ libcxx/trunk/test/utilities/memory/allocator.adaptor/allocators.h Sat Aug 21 19:59:46 2010
@@ -150,8 +150,6 @@
     A3 select_on_container_copy_construction() const {return A3(-1);}
 };
 
-
-
 template <class T> bool A3<T>::copy_called = false;
 template <class T> bool A3<T>::move_called = false;
 template <class T> bool A3<T>::constructed = false;
@@ -171,6 +169,6 @@
     return !(x == y);
 }
 
-#endif
+#endif  // _LIBCPP_MOVE
 
-#endif
+#endif  // ALLOCATORS_H

Modified: libcxx/trunk/test/utilities/memory/allocator.adaptor/types.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/memory/allocator.adaptor/types.pass.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/memory/allocator.adaptor/types.pass.cpp (original)
+++ libcxx/trunk/test/utilities/memory/allocator.adaptor/types.pass.cpp Sat Aug 21 19:59:46 2010
@@ -65,7 +65,6 @@
         std::scoped_allocator_adaptor<A1<int>>::const_void_pointer,
         const void*>::value), "");
 
-
     static_assert((std::is_base_of<
         A2<int>,
         std::scoped_allocator_adaptor<A2<int>, A1<int>>
@@ -99,5 +98,5 @@
         std::scoped_allocator_adaptor<A2<int>, A1<int>>::const_void_pointer,
         const void*>::value), "");
 
-#endif
+#endif  // _LIBCPP_MOVE
 }

Modified: libcxx/trunk/test/utilities/memory/allocator.tag/allocator_arg.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/memory/allocator.tag/allocator_arg.pass.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/memory/allocator.tag/allocator_arg.pass.cpp (original)
+++ libcxx/trunk/test/utilities/memory/allocator.tag/allocator_arg.pass.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,22 @@
-//===----------------------------------------------------------------------===//
//
//                     The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//

// <memory>

// struct allocator_arg_t { };
// const allocator_arg_t allocator_arg = allocator_arg_t();

#include <memory>

void test(std::allocator_arg_t) {}

int main()
{
    test(std::allocator_arg);
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <memory>
+
+// struct allocator_arg_t { };
+// const allocator_arg_t allocator_arg = allocator_arg_t();
+
+#include <memory>
+
+void test(std::allocator_arg_t) {}
+
+int main()
+{
+    test(std::allocator_arg);
+}

Modified: libcxx/trunk/test/utilities/memory/allocator.traits/allocator.traits.members/allocate.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/memory/allocator.traits/allocator.traits.members/allocate.pass.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/memory/allocator.traits/allocator.traits.members/allocate.pass.cpp (original)
+++ libcxx/trunk/test/utilities/memory/allocator.traits/allocator.traits.members/allocate.pass.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,38 @@
-//===----------------------------------------------------------------------===//
//
//                     The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//

// <memory>

// template <class Alloc>
// struct allocator_traits
// {
//     static pointer allocate(allocator_type& a, size_type n);
//     ...
// };

#include <memory>
#include <cassert>

template <class T>
struct A
{
    typedef T value_type;

    value_type* allocate(std::size_t n)
    {
        assert(n == 10);
        return (value_type*)0xDEADBEEF;
    }
};

int main()
{
    A<int> a;
    assert(std::allocator_traits<A<int> >::allocate(a, 10) == (int*)0xDEADBEEF);
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <memory>
+
+// template <class Alloc>
+// struct allocator_traits
+// {
+//     static pointer allocate(allocator_type& a, size_type n);
+//     ...
+// };
+
+#include <memory>
+#include <cassert>
+
+template <class T>
+struct A
+{
+    typedef T value_type;
+
+    value_type* allocate(std::size_t n)
+    {
+        assert(n == 10);
+        return (value_type*)0xDEADBEEF;
+    }
+};
+
+int main()
+{
+    A<int> a;
+    assert(std::allocator_traits<A<int> >::allocate(a, 10) == (int*)0xDEADBEEF);
+}

Modified: libcxx/trunk/test/utilities/memory/allocator.traits/allocator.traits.members/allocate_hint.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/memory/allocator.traits/allocator.traits.members/allocate_hint.pass.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/memory/allocator.traits/allocator.traits.members/allocate_hint.pass.cpp (original)
+++ libcxx/trunk/test/utilities/memory/allocator.traits/allocator.traits.members/allocate_hint.pass.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,60 @@
-//===----------------------------------------------------------------------===//
//
//                     The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//

// <memory>

// template <class Alloc>
// struct allocator_traits
// {
//     static pointer allocate(allocator_type& a, size_type n, const_void_pointer hint);
//     ...
// };

#include <memory>
#include <cassert>

template <class T>
struct A
{
    typedef T value_type;

    value_type* allocate(std::size_t n)
    {
        assert(n == 10);
        return (value_type*)0xDEADBEEF;
    }
};

template <class T>
struct B
{
    typedef T value_type;

    value_type* allocate(std::size_t n)
    {
        assert(n == 12);
        return (value_type*)0xEEADBEEF;
    }
    value_type* allocate(std::size_t n, const void* p)
    {
        assert(n =
 = 11);
        assert(p == 0);
        return (value_type*)0xFEADBEEF;
    }
};

int main()
{
#ifndef _LIBCPP_HAS_NO_ADVANCED_SFINAE
    A<int> a;
    assert(std::allocator_traits<A<int> >::allocate(a, 10, nullptr) == (int*)0xDEADBEEF);
#endif
    B<int> b;
    assert(std::allocator_traits<B<int> >::allocate(b, 11, nullptr) == (int*)0xFEADBEEF);
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <memory>
+
+// template <class Alloc>
+// struct allocator_traits
+// {
+//     static pointer allocate(allocator_type& a, size_type n, const_void_pointer hint);
+//     ...
+// };
+
+#include <memory>
+#include <cassert>
+
+template <class T>
+struct A
+{
+    typedef T value_type;
+
+    value_type* allocate(std::size_t n)
+    {
+        assert(n == 10);
+        return (value_type*)0xDEADBEEF;
+    }
+};
+
+template <class T>
+struct B
+{
+    typedef T value_type;
+
+    value_type* allocate(std::size_t n)
+    {
+        assert(n == 12);
+        return (value_type*)0xEEADBEEF;
+    }
+    value_type* allocate(std::size_t n, const void* p)
+    {
+        assert(n == 11);
+        assert(p == 0);
+        return (value_type*)0xFEADBEEF;
+    }
+};
+
+int main()
+{
+#ifndef _LIBCPP_HAS_NO_ADVANCED_SFINAE
+    A<int> a;
+    assert(std::allocator_traits<A<int> >::allocate(a, 10, nullptr) == (int*)0xDEADBEEF);
+#endif  // _LIBCPP_HAS_NO_ADVANCED_SFINAE
+    B<int> b;
+    assert(std::allocator_traits<B<int> >::allocate(b, 11, nullptr) == (int*)0xFEADBEEF);
+}

Modified: libcxx/trunk/test/utilities/memory/allocator.traits/allocator.traits.members/construct.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/memory/allocator.traits/allocator.traits.members/construct.pass.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/memory/allocator.traits/allocator.traits.members/construct.pass.cpp (original)
+++ libcxx/trunk/test/utilities/memory/allocator.traits/allocator.traits.members/construct.pass.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,143 @@
-//===----------------------------------------------------------------------===//
//
//                     The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//

// <memory>

// template <class Alloc>
// struct allocator_traits
// {
//     template <class Ptr, class... Args>
//         static void construct(allocator_type& a, Ptr p, Args&&... args);
//     ...
// };

#include <memory>
#include <new>
#include <type_traits>
#include <cassert>

template <class T>
struct A
{
    typedef T value_type;

};

int b_construct = 0;

template <class T>
struct B
{
    typedef T value_type;

#ifndef _LIBCPP_HAS_NO_VARIADICS
    template <class U, class ...Args>
    void construct(U* p, Args&& ...args)
    {
        ++b_construct;
        ::new ((void*)p) U(std::forward<Args>(args)...);
    }
#endif
};

struct A
 0
{
    static int count;
    A0() {++count;}
};

int A0::count = 0;

struct A1
{
    static int count;
    A1(char c)
    {
        assert(c == 'c');
        ++count;
    }
};

int A1::count = 0;

struct A2
{
    static int count;
    A2(char c, int i)
    {
        assert(c == 'd');
        assert(i == 5);
        ++count;
    }
};

int A2::count = 0;

int main()
{
    {
        A0::count = 0;
        A<int> a;
        std::aligned_storage<sizeof(A0)>::type a0;
        assert(A0::count == 0);
        std::allocator_traits<A<int> >::construct(a, (A0*)&a0);
        assert(A0::count == 1);
    }
    {
        A1::count = 0;
        A<int> a;
        std::aligned_storage<sizeof(A1)>::type a1;
        assert(A1::count == 0);
        std::allocator_traits<A<int> >::construct(a, (A1*)&a1, 'c');
        assert(A1::count == 1);
    }
    {
        A2::count = 0;
        A<int> a;
        std::aligned_storage<sizeof(A2)>::type a2;
        assert(A2::count == 0);
        std::allocat
 or_traits<A<int> >::construct(a, (A2*)&a2, 'd', 5);
        assert(A2::count == 1);
    }
#ifndef _LIBCPP_HAS_NO_VARIADICS
    {
        A0::count = 0;
        b_construct = 0;
        B<int> b;
        std::aligned_storage<sizeof(A0)>::type a0;
        assert(A0::count == 0);
        assert(b_construct == 0);
        std::allocator_traits<B<int> >::construct(b, (A0*)&a0);
        assert(A0::count == 1);
        assert(b_construct == 1);
    }
    {
        A1::count = 0;
        b_construct = 0;
        B<int> b;
        std::aligned_storage<sizeof(A1)>::type a1;
        assert(A1::count == 0);
        assert(b_construct == 0);
        std::allocator_traits<B<int> >::construct(b, (A1*)&a1, 'c');
        assert(A1::count == 1);
        assert(b_construct == 1);
    }
    {
        A2::count = 0;
        b_construct = 0;
        B<int> b;
        std::aligned_storage<sizeof(A2)>::type a2;
        assert(A2::count == 0);
        assert(b_construct == 0);
        std::allocator
 _traits<B<int> >::construct(b, (A2*)&a2, 'd', 5);
        assert(A2::count == 1);
        assert(b_construct == 1);
    }
#endif
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <memory>
+
+// template <class Alloc>
+// struct allocator_traits
+// {
+//     template <class Ptr, class... Args>
+//         static void construct(allocator_type& a, Ptr p, Args&&... args);
+//     ...
+// };
+
+#include <memory>
+#include <new>
+#include <type_traits>
+#include <cassert>
+
+template <class T>
+struct A
+{
+    typedef T value_type;
+
+};
+
+int b_construct = 0;
+
+template <class T>
+struct B
+{
+    typedef T value_type;
+
+#ifndef _LIBCPP_HAS_NO_VARIADICS
+    template <class U, class ...Args>
+    void construct(U* p, Args&& ...args)
+    {
+        ++b_construct;
+        ::new ((void*)p) U(std::forward<Args>(args)...);
+    }
+#endif  // _LIBCPP_HAS_NO_VARIADICS
+};
+
+struct A0
+{
+    static int count;
+    A0() {++count;}
+};
+
+int A0::count = 0;
+
+struct A1
+{
+    static int count;
+    A1(char c)
+    {
+        assert(c == 'c');
+        ++count;
+    }
+};
+
+int A1::count = 0;
+
+struct A2
+{
+    static int count;
+    A2(char c, int i)
+    {
+        assert(c == 'd');
+        assert(i == 5);
+        ++count;
+    }
+};
+
+int A2::count = 0;
+
+int main()
+{
+    {
+        A0::count = 0;
+        A<int> a;
+        std::aligned_storage<sizeof(A0)>::type a0;
+        assert(A0::count == 0);
+        std::allocator_traits<A<int> >::construct(a, (A0*)&a0);
+        assert(A0::count == 1);
+    }
+    {
+        A1::count = 0;
+        A<int> a;
+        std::aligned_storage<sizeof(A1)>::type a1;
+        assert(A1::count == 0);
+        std::allocator_traits<A<int> >::construct(a, (A1*)&a1, 'c');
+        assert(A1::count == 1);
+    }
+    {
+        A2::count = 0;
+        A<int> a;
+        std::aligned_storage<sizeof(A2)>::type a2;
+        assert(A2::count == 0);
+        std::allocator_traits<A<int> >::construct(a, (A2*)&a2, 'd', 5);
+        assert(A2::count == 1);
+    }
+#ifndef _LIBCPP_HAS_NO_VARIADICS
+    {
+        A0::count = 0;
+        b_construct = 0;
+        B<int> b;
+        std::aligned_storage<sizeof(A0)>::type a0;
+        assert(A0::count == 0);
+        assert(b_construct == 0);
+        std::allocator_traits<B<int> >::construct(b, (A0*)&a0);
+        assert(A0::count == 1);
+        assert(b_construct == 1);
+    }
+    {
+        A1::count = 0;
+        b_construct = 0;
+        B<int> b;
+        std::aligned_storage<sizeof(A1)>::type a1;
+        assert(A1::count == 0);
+        assert(b_construct == 0);
+        std::allocator_traits<B<int> >::construct(b, (A1*)&a1, 'c');
+        assert(A1::count == 1);
+        assert(b_construct == 1);
+    }
+    {
+        A2::count = 0;
+        b_construct = 0;
+        B<int> b;
+        std::aligned_storage<sizeof(A2)>::type a2;
+        assert(A2::count == 0);
+        assert(b_construct == 0);
+        std::allocator_traits<B<int> >::construct(b, (A2*)&a2, 'd', 5);
+        assert(A2::count == 1);
+        assert(b_construct == 1);
+    }
+#endif  // _LIBCPP_HAS_NO_VARIADICS
+}

Modified: libcxx/trunk/test/utilities/memory/allocator.traits/allocator.traits.members/deallocate.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/memory/allocator.traits/allocator.traits.members/deallocate.pass.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/memory/allocator.traits/allocator.traits.members/deallocate.pass.cpp (original)
+++ libcxx/trunk/test/utilities/memory/allocator.traits/allocator.traits.members/deallocate.pass.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,42 @@
-//===----------------------------------------------------------------------===//
//
//                     The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//

// <memory>

// template <class Alloc>
// struct allocator_traits
// {
//     static void deallocate(allocator_type& a, pointer p, size_type n);
//     ...
// };

#include <memory>
#include <cassert>

int called = 0;

template <class T>
struct A
{
    typedef T value_type;

    void deallocate(value_type* p, std::size_t n)
    {
        assert(p == (value_type*)0xDEADBEEF);
        assert(n == 10);
        ++called;
    }
};

int main()
{
    A<int> a;
    std::allocator_traits<A<int> >::deallocate(a, (int*)0xDEADBEEF, 10);
    assert(called == 1);
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <memory>
+
+// template <class Alloc>
+// struct allocator_traits
+// {
+//     static void deallocate(allocator_type& a, pointer p, size_type n);
+//     ...
+// };
+
+#include <memory>
+#include <cassert>
+
+int called = 0;
+
+template <class T>
+struct A
+{
+    typedef T value_type;
+
+    void deallocate(value_type* p, std::size_t n)
+    {
+        assert(p == (value_type*)0xDEADBEEF);
+        assert(n == 10);
+        ++called;
+    }
+};
+
+int main()
+{
+    A<int> a;
+    std::allocator_traits<A<int> >::deallocate(a, (int*)0xDEADBEEF, 10);
+    assert(called == 1);
+}

Modified: libcxx/trunk/test/utilities/memory/allocator.traits/allocator.traits.members/destroy.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/memory/allocator.traits/allocator.traits.members/destroy.pass.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/memory/allocator.traits/allocator.traits.members/destroy.pass.cpp (original)
+++ libcxx/trunk/test/utilities/memory/allocator.traits/allocator.traits.members/destroy.pass.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,80 @@
-//===----------------------------------------------------------------------===//
//
//                     The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//

// <memory>

// template <class Alloc>
// struct allocator_traits
// {
//     template <class Ptr>
//         static void destroy(allocator_type& a, Ptr p);
//     ...
// };

#include <memory>
#include <new>
#include <type_traits>
#include <cassert>

template <class T>
struct A
{
    typedef T value_type;

};

int b_destroy = 0;

template <class T>
struct B
{
    typedef T value_type;

    template <class U>
    void destroy(U* p)
    {
        ++b_destroy;
        p->~U();
    }
};

struct A0
{
    static int count;
    ~A0() {++count;}
};

int A0::count = 0;

int main()
{
    {
        A0::count = 0;
        A<int> a;
        std::aligne
 d_storage<sizeof(A0)>::type a0;
        std::allocator_traits<A<int> >::construct(a, (A0*)&a0);
        assert(A0::count == 0);
        std::allocator_traits<A<int> >::destroy(a, (A0*)&a0);
        assert(A0::count == 1);
    }
#ifndef _LIBCPP_HAS_NO_ADVANCED_SFINAE
    {
        A0::count = 0;
        b_destroy = 0;
        B<int> b;
        std::aligned_storage<sizeof(A0)>::type a0;
        std::allocator_traits<B<int> >::construct(b, (A0*)&a0);
        assert(A0::count == 0);
        assert(b_destroy == 0);
        std::allocator_traits<B<int> >::destroy(b, (A0*)&a0);
        assert(A0::count == 1);
        assert(b_destroy == 1);
    }
#endif
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <memory>
+
+// template <class Alloc>
+// struct allocator_traits
+// {
+//     template <class Ptr>
+//         static void destroy(allocator_type& a, Ptr p);
+//     ...
+// };
+
+#include <memory>
+#include <new>
+#include <type_traits>
+#include <cassert>
+
+template <class T>
+struct A
+{
+    typedef T value_type;
+
+};
+
+int b_destroy = 0;
+
+template <class T>
+struct B
+{
+    typedef T value_type;
+
+    template <class U>
+    void destroy(U* p)
+    {
+        ++b_destroy;
+        p->~U();
+    }
+};
+
+struct A0
+{
+    static int count;
+    ~A0() {++count;}
+};
+
+int A0::count = 0;
+
+int main()
+{
+    {
+        A0::count = 0;
+        A<int> a;
+        std::aligned_storage<sizeof(A0)>::type a0;
+        std::allocator_traits<A<int> >::construct(a, (A0*)&a0);
+        assert(A0::count == 0);
+        std::allocator_traits<A<int> >::destroy(a, (A0*)&a0);
+        assert(A0::count == 1);
+    }
+#ifndef _LIBCPP_HAS_NO_ADVANCED_SFINAE
+    {
+        A0::count = 0;
+        b_destroy = 0;
+        B<int> b;
+        std::aligned_storage<sizeof(A0)>::type a0;
+        std::allocator_traits<B<int> >::construct(b, (A0*)&a0);
+        assert(A0::count == 0);
+        assert(b_destroy == 0);
+        std::allocator_traits<B<int> >::destroy(b, (A0*)&a0);
+        assert(A0::count == 1);
+        assert(b_destroy == 1);
+    }
+#endif  // _LIBCPP_HAS_NO_ADVANCED_SFINAE
+}

Modified: libcxx/trunk/test/utilities/memory/allocator.traits/allocator.traits.members/max_size.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/memory/allocator.traits/allocator.traits.members/max_size.pass.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/memory/allocator.traits/allocator.traits.members/max_size.pass.cpp (original)
+++ libcxx/trunk/test/utilities/memory/allocator.traits/allocator.traits.members/max_size.pass.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,64 @@
-//===----------------------------------------------------------------------===//
//
//                     The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//

// <memory>

// template <class Alloc>
// struct allocator_traits
// {
//     static size_type max_size(const allocator_type& a);
//     ...
// };

#include <memory>
#include <new>
#include <type_traits>
#include <cassert>

template <class T>
struct A
{
    typedef T value_type;

};

template <class T>
struct B
{
    typedef T value_type;

    size_t max_size() const
    {
        return 100;
    }
};

int main()
{
#ifndef _LIBCPP_HAS_NO_ADVANCED_SFINAE
    {
        A<int> a;
        assert(std::allocator_traits<A<int> >::max_size(a) ==
               std::numeric_limits<std::size_t>::max());
    }
    {
        const A<int> a = {};
     
    assert(std::allocator_traits<A<int> >::max_size(a) ==
               std::numeric_limits<std::size_t>::max());
    }
#endif
    {
        B<int> b;
        assert(std::allocator_traits<B<int> >::max_size(b) == 100);
    }
    {
        const B<int> b = {};
        assert(std::allocator_traits<B<int> >::max_size(b) == 100);
    }
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <memory>
+
+// template <class Alloc>
+// struct allocator_traits
+// {
+//     static size_type max_size(const allocator_type& a);
+//     ...
+// };
+
+#include <memory>
+#include <new>
+#include <type_traits>
+#include <cassert>
+
+template <class T>
+struct A
+{
+    typedef T value_type;
+
+};
+
+template <class T>
+struct B
+{
+    typedef T value_type;
+
+    size_t max_size() const
+    {
+        return 100;
+    }
+};
+
+int main()
+{
+#ifndef _LIBCPP_HAS_NO_ADVANCED_SFINAE
+    {
+        A<int> a;
+        assert(std::allocator_traits<A<int> >::max_size(a) ==
+               std::numeric_limits<std::size_t>::max());
+    }
+    {
+        const A<int> a = {};
+        assert(std::allocator_traits<A<int> >::max_size(a) ==
+               std::numeric_limits<std::size_t>::max());
+    }
+#endif  // _LIBCPP_HAS_NO_ADVANCED_SFINAE
+    {
+        B<int> b;
+        assert(std::allocator_traits<B<int> >::max_size(b) == 100);
+    }
+    {
+        const B<int> b = {};
+        assert(std::allocator_traits<B<int> >::max_size(b) == 100);
+    }
+}

Modified: libcxx/trunk/test/utilities/memory/allocator.traits/allocator.traits.members/select_on_container_copy_construction.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/memory/allocator.traits/allocator.traits.members/select_on_container_copy_construction.pass.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/memory/allocator.traits/allocator.traits.members/select_on_container_copy_construction.pass.cpp (original)
+++ libcxx/trunk/test/utilities/memory/allocator.traits/allocator.traits.members/select_on_container_copy_construction.pass.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,68 @@
-//===----------------------------------------------------------------------===//
//
//                     The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//

// <memory>

// template <class Alloc>
// struct allocator_traits
// {
//     static allocator_type
//         select_on_container_copy_construction(const allocator_type& a);
//     ...
// };

#include <memory>
#include <new>
#include <type_traits>
#include <cassert>

template <class T>
struct A
{
    typedef T value_type;
    int id;
    explicit A(int i = 0) : id(i) {}

};

template <class T>
struct B
{
    typedef T value_type;

    int id;
    explicit B(int i = 0) : id(i) {}

    B select_on_container_copy_construction() const
    {
        return B(100);
    }
};

int main()
{
    {
        A<int> a;
        assert(std::allocator_tra
 its<A<int> >::select_on_container_copy_construction(a).id == 0);
    }
    {
        const A<int> a(0);
        assert(std::allocator_traits<A<int> >::select_on_container_copy_construction(a).id == 0);
    }
#ifndef _LIBCPP_HAS_NO_ADVANCED_SFINAE
    {
        B<int> b;
        assert(std::allocator_traits<B<int> >::select_on_container_copy_construction(b).id == 100);
    }
    {
        const B<int> b(0);
        assert(std::allocator_traits<B<int> >::select_on_container_copy_construction(b).id == 100);
    }
#endif
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <memory>
+
+// template <class Alloc>
+// struct allocator_traits
+// {
+//     static allocator_type
+//         select_on_container_copy_construction(const allocator_type& a);
+//     ...
+// };
+
+#include <memory>
+#include <new>
+#include <type_traits>
+#include <cassert>
+
+template <class T>
+struct A
+{
+    typedef T value_type;
+    int id;
+    explicit A(int i = 0) : id(i) {}
+
+};
+
+template <class T>
+struct B
+{
+    typedef T value_type;
+
+    int id;
+    explicit B(int i = 0) : id(i) {}
+
+    B select_on_container_copy_construction() const
+    {
+        return B(100);
+    }
+};
+
+int main()
+{
+    {
+        A<int> a;
+        assert(std::allocator_traits<A<int> >::select_on_container_copy_construction(a).id == 0);
+    }
+    {
+        const A<int> a(0);
+        assert(std::allocator_traits<A<int> >::select_on_container_copy_construction(a).id == 0);
+    }
+#ifndef _LIBCPP_HAS_NO_ADVANCED_SFINAE
+    {
+        B<int> b;
+        assert(std::allocator_traits<B<int> >::select_on_container_copy_construction(b).id == 100);
+    }
+    {
+        const B<int> b(0);
+        assert(std::allocator_traits<B<int> >::select_on_container_copy_construction(b).id == 100);
+    }
+#endif  // _LIBCPP_HAS_NO_ADVANCED_SFINAE
+}

Modified: libcxx/trunk/test/utilities/memory/allocator.traits/allocator.traits.types/const_pointer.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/memory/allocator.traits/allocator.traits.types/const_pointer.pass.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/memory/allocator.traits/allocator.traits.types/const_pointer.pass.cpp (original)
+++ libcxx/trunk/test/utilities/memory/allocator.traits/allocator.traits.types/const_pointer.pass.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,55 @@
-//===----------------------------------------------------------------------===//
//
//                     The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//

// <memory>

// template <class Alloc>
// struct allocator_traits
// {
//     typedef Alloc::const_pointer
//           | pointer_traits<pointer>::rebind<const value_type>
//     ...
// };

#include <memory>
#include <type_traits>

template <class T>
struct Ptr {};

template <class T>
struct A
{
    typedef T value_type;
    typedef Ptr<T> pointer;
};

template <class T>
struct B
{
    typedef T value_type;
};

template <class T>
struct CPtr {};

template <class T>
struct C
{
    typedef T value_type;
    typedef CPtr<T> pointer;
    typedef CPtr<const T> const_pointer;
};

int main()
{
    static_assert((std::is_same<std::allocator_traits
 <A<char> >::const_pointer, Ptr<const char> >::value), "");
    static_assert((std::is_same<std::allocator_traits<B<char> >::const_pointer, const char*>::value), "");
    static_assert((std::is_same<std::allocator_traits<C<char> >::const_pointer, CPtr<const char> >::value), "");
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <memory>
+
+// template <class Alloc>
+// struct allocator_traits
+// {
+//     typedef Alloc::const_pointer
+//           | pointer_traits<pointer>::rebind<const value_type>
+//     ...
+// };
+
+#include <memory>
+#include <type_traits>
+
+template <class T>
+struct Ptr {};
+
+template <class T>
+struct A
+{
+    typedef T value_type;
+    typedef Ptr<T> pointer;
+};
+
+template <class T>
+struct B
+{
+    typedef T value_type;
+};
+
+template <class T>
+struct CPtr {};
+
+template <class T>
+struct C
+{
+    typedef T value_type;
+    typedef CPtr<T> pointer;
+    typedef CPtr<const T> const_pointer;
+};
+
+int main()
+{
+    static_assert((std::is_same<std::allocator_traits<A<char> >::const_pointer, Ptr<const char> >::value), "");
+    static_assert((std::is_same<std::allocator_traits<B<char> >::const_pointer, const char*>::value), "");
+    static_assert((std::is_same<std::allocator_traits<C<char> >::const_pointer, CPtr<const char> >::value), "");
+}

Modified: libcxx/trunk/test/utilities/memory/allocator.traits/allocator.traits.types/const_void_pointer.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/memory/allocator.traits/allocator.traits.types/const_void_pointer.pass.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/memory/allocator.traits/allocator.traits.types/const_void_pointer.pass.cpp (original)
+++ libcxx/trunk/test/utilities/memory/allocator.traits/allocator.traits.types/const_void_pointer.pass.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,55 @@
-//===----------------------------------------------------------------------===//
//
//                     The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//

// <memory>

// template <class Alloc>
// struct allocator_traits
// {
//     typedef Alloc::const_void_pointer
//           | pointer_traits<pointer>::rebind<const void>
//                                          const_void_pointer;
//     ...
// };

#include <memory>
#include <type_traits>

template <class T>
struct Ptr {};

template <class T>
struct A
{
    typedef T value_type;
    typedef Ptr<T> pointer;
};

template <class T>
struct B
{
    typedef T value_type;
};

template <class T>
struct CPtr {};

template <class T>
struct C
{
    typedef T value_type;
    typedef CPtr<const void> const_void_pointer;
};

int main()
{
    static_
 assert((std::is_same<std::allocator_traits<A<char> >::const_void_pointer, Ptr<const void> >::value), "");
    static_assert((std::is_same<std::allocator_traits<B<char> >::const_void_pointer, const void*>::value), "");
    static_assert((std::is_same<std::allocator_traits<C<char> >::const_void_pointer, CPtr<const void> >::value), "");
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <memory>
+
+// template <class Alloc>
+// struct allocator_traits
+// {
+//     typedef Alloc::const_void_pointer
+//           | pointer_traits<pointer>::rebind<const void>
+//                                          const_void_pointer;
+//     ...
+// };
+
+#include <memory>
+#include <type_traits>
+
+template <class T>
+struct Ptr {};
+
+template <class T>
+struct A
+{
+    typedef T value_type;
+    typedef Ptr<T> pointer;
+};
+
+template <class T>
+struct B
+{
+    typedef T value_type;
+};
+
+template <class T>
+struct CPtr {};
+
+template <class T>
+struct C
+{
+    typedef T value_type;
+    typedef CPtr<const void> const_void_pointer;
+};
+
+int main()
+{
+    static_assert((std::is_same<std::allocator_traits<A<char> >::const_void_pointer, Ptr<const void> >::value), "");
+    static_assert((std::is_same<std::allocator_traits<B<char> >::const_void_pointer, const void*>::value), "");
+    static_assert((std::is_same<std::allocator_traits<C<char> >::const_void_pointer, CPtr<const void> >::value), "");
+}

Modified: libcxx/trunk/test/utilities/memory/allocator.traits/allocator.traits.types/difference_type.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/memory/allocator.traits/allocator.traits.types/difference_type.pass.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/memory/allocator.traits/allocator.traits.types/difference_type.pass.cpp (original)
+++ libcxx/trunk/test/utilities/memory/allocator.traits/allocator.traits.types/difference_type.pass.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,40 @@
-//===----------------------------------------------------------------------===//
//
//                     The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//

// <memory>

// template <class Alloc>
// struct allocator_traits
// {
//     typedef Alloc::difference_type
//           | ptrdiff_t                    difference_type;
//     ...
// };

#include <memory>
#include <type_traits>

template <class T>
struct A
{
    typedef T value_type;
    typedef short difference_type;
};

template <class T>
struct B
{
    typedef T value_type;
};

int main()
{
    static_assert((std::is_same<std::allocator_traits<A<char> >::difference_type, short>::value), "");
    static_assert((std::is_same<std::allocator_traits<B<char> >::difference_type, std::ptrdiff_t>::value), "");
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <memory>
+
+// template <class Alloc>
+// struct allocator_traits
+// {
+//     typedef Alloc::difference_type
+//           | ptrdiff_t                    difference_type;
+//     ...
+// };
+
+#include <memory>
+#include <type_traits>
+
+template <class T>
+struct A
+{
+    typedef T value_type;
+    typedef short difference_type;
+};
+
+template <class T>
+struct B
+{
+    typedef T value_type;
+};
+
+int main()
+{
+    static_assert((std::is_same<std::allocator_traits<A<char> >::difference_type, short>::value), "");
+    static_assert((std::is_same<std::allocator_traits<B<char> >::difference_type, std::ptrdiff_t>::value), "");
+}

Modified: libcxx/trunk/test/utilities/memory/allocator.traits/allocator.traits.types/pointer.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/memory/allocator.traits/allocator.traits.types/pointer.pass.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/memory/allocator.traits/allocator.traits.types/pointer.pass.cpp (original)
+++ libcxx/trunk/test/utilities/memory/allocator.traits/allocator.traits.types/pointer.pass.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,42 @@
-//===----------------------------------------------------------------------===//
//
//                     The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//

// <memory>

// template <class Alloc>
// struct allocator_traits
// {
//     typedef Alloc::pointer | value_type* pointer;
//     ...
// };

#include <memory>
#include <type_traits>

template <class T>
struct Ptr {};

template <class T>
struct A
{
    typedef T value_type;
    typedef Ptr<T> pointer;
};

template <class T>
struct B
{
    typedef T value_type;
};

int main()
{
    static_assert((std::is_same<std::allocator_traits<A<char> >::pointer, Ptr<char> >::value), "");
    static_assert((std::is_same<std::allocator_traits<B<char> >::pointer, char*>::value), "");
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <memory>
+
+// template <class Alloc>
+// struct allocator_traits
+// {
+//     typedef Alloc::pointer | value_type* pointer;
+//     ...
+// };
+
+#include <memory>
+#include <type_traits>
+
+template <class T>
+struct Ptr {};
+
+template <class T>
+struct A
+{
+    typedef T value_type;
+    typedef Ptr<T> pointer;
+};
+
+template <class T>
+struct B
+{
+    typedef T value_type;
+};
+
+int main()
+{
+    static_assert((std::is_same<std::allocator_traits<A<char> >::pointer, Ptr<char> >::value), "");
+    static_assert((std::is_same<std::allocator_traits<B<char> >::pointer, char*>::value), "");
+}

Modified: libcxx/trunk/test/utilities/memory/allocator.traits/allocator.traits.types/propagate_on_container_copy_assignment.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/memory/allocator.traits/allocator.traits.types/propagate_on_container_copy_assignment.pass.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/memory/allocator.traits/allocator.traits.types/propagate_on_container_copy_assignment.pass.cpp (original)
+++ libcxx/trunk/test/utilities/memory/allocator.traits/allocator.traits.types/propagate_on_container_copy_assignment.pass.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,40 @@
-//===----------------------------------------------------------------------===//
//
//                     The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//

// <memory>

// template <class Alloc>
// struct allocator_traits
// {
//     typedef Alloc::propagate_on_container_copy_assignment
//           | false_type                   propagate_on_container_copy_assignment;
//     ...
// };

#include <memory>
#include <type_traits>

template <class T>
struct A
{
    typedef T value_type;
    typedef std::true_type propagate_on_container_copy_assignment;
};

template <class T>
struct B
{
    typedef T value_type;
};

int main()
{
    static_assert((std::is_same<std::allocator_traits<A<char> >::propagate_on_container_copy_assignment, std::true_type>::value), "");
    static_assert((std::is_same<std:
 :allocator_traits<B<char> >::propagate_on_container_copy_assignment, std::false_type>::value), "");
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <memory>
+
+// template <class Alloc>
+// struct allocator_traits
+// {
+//     typedef Alloc::propagate_on_container_copy_assignment
+//           | false_type                   propagate_on_container_copy_assignment;
+//     ...
+// };
+
+#include <memory>
+#include <type_traits>
+
+template <class T>
+struct A
+{
+    typedef T value_type;
+    typedef std::true_type propagate_on_container_copy_assignment;
+};
+
+template <class T>
+struct B
+{
+    typedef T value_type;
+};
+
+int main()
+{
+    static_assert((std::is_same<std::allocator_traits<A<char> >::propagate_on_container_copy_assignment, std::true_type>::value), "");
+    static_assert((std::is_same<std::allocator_traits<B<char> >::propagate_on_container_copy_assignment, std::false_type>::value), "");
+}

Modified: libcxx/trunk/test/utilities/memory/allocator.traits/allocator.traits.types/propagate_on_container_move_assignment.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/memory/allocator.traits/allocator.traits.types/propagate_on_container_move_assignment.pass.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/memory/allocator.traits/allocator.traits.types/propagate_on_container_move_assignment.pass.cpp (original)
+++ libcxx/trunk/test/utilities/memory/allocator.traits/allocator.traits.types/propagate_on_container_move_assignment.pass.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,40 @@
-//===----------------------------------------------------------------------===//
//
//                     The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//

// <memory>

// template <class Alloc>
// struct allocator_traits
// {
//     typedef Alloc::propagate_on_container_move_assignment
//           | false_type                   propagate_on_container_move_assignment;
//     ...
// };

#include <memory>
#include <type_traits>

template <class T>
struct A
{
    typedef T value_type;
    typedef std::true_type propagate_on_container_move_assignment;
};

template <class T>
struct B
{
    typedef T value_type;
};

int main()
{
    static_assert((std::is_same<std::allocator_traits<A<char> >::propagate_on_container_move_assignment, std::true_type>::value), "");
    static_assert((std::is_same<std:
 :allocator_traits<B<char> >::propagate_on_container_move_assignment, std::false_type>::value), "");
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <memory>
+
+// template <class Alloc>
+// struct allocator_traits
+// {
+//     typedef Alloc::propagate_on_container_move_assignment
+//           | false_type                   propagate_on_container_move_assignment;
+//     ...
+// };
+
+#include <memory>
+#include <type_traits>
+
+template <class T>
+struct A
+{
+    typedef T value_type;
+    typedef std::true_type propagate_on_container_move_assignment;
+};
+
+template <class T>
+struct B
+{
+    typedef T value_type;
+};
+
+int main()
+{
+    static_assert((std::is_same<std::allocator_traits<A<char> >::propagate_on_container_move_assignment, std::true_type>::value), "");
+    static_assert((std::is_same<std::allocator_traits<B<char> >::propagate_on_container_move_assignment, std::false_type>::value), "");
+}

Modified: libcxx/trunk/test/utilities/memory/allocator.traits/allocator.traits.types/propagate_on_container_swap.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/memory/allocator.traits/allocator.traits.types/propagate_on_container_swap.pass.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/memory/allocator.traits/allocator.traits.types/propagate_on_container_swap.pass.cpp (original)
+++ libcxx/trunk/test/utilities/memory/allocator.traits/allocator.traits.types/propagate_on_container_swap.pass.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,40 @@
-//===----------------------------------------------------------------------===//
//
//                     The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//

// <memory>

// template <class Alloc>
// struct allocator_traits
// {
//     typedef Alloc::propagate_on_container_swap
//           | false_type                   propagate_on_container_swap;
//     ...
// };

#include <memory>
#include <type_traits>

template <class T>
struct A
{
    typedef T value_type;
    typedef std::true_type propagate_on_container_swap;
};

template <class T>
struct B
{
    typedef T value_type;
};

int main()
{
    static_assert((std::is_same<std::allocator_traits<A<char> >::propagate_on_container_swap, std::true_type>::value), "");
    static_assert((std::is_same<std::allocator_traits<B<char> >::propagate_on_co
 ntainer_swap, std::false_type>::value), "");
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <memory>
+
+// template <class Alloc>
+// struct allocator_traits
+// {
+//     typedef Alloc::propagate_on_container_swap
+//           | false_type                   propagate_on_container_swap;
+//     ...
+// };
+
+#include <memory>
+#include <type_traits>
+
+template <class T>
+struct A
+{
+    typedef T value_type;
+    typedef std::true_type propagate_on_container_swap;
+};
+
+template <class T>
+struct B
+{
+    typedef T value_type;
+};
+
+int main()
+{
+    static_assert((std::is_same<std::allocator_traits<A<char> >::propagate_on_container_swap, std::true_type>::value), "");
+    static_assert((std::is_same<std::allocator_traits<B<char> >::propagate_on_container_swap, std::false_type>::value), "");
+}

Modified: libcxx/trunk/test/utilities/memory/allocator.traits/allocator.traits.types/rebind_alloc.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/memory/allocator.traits/allocator.traits.types/rebind_alloc.pass.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/memory/allocator.traits/allocator.traits.types/rebind_alloc.pass.cpp (original)
+++ libcxx/trunk/test/utilities/memory/allocator.traits/allocator.traits.types/rebind_alloc.pass.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,79 @@
-//===----------------------------------------------------------------------===//
//
//                     The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//

// <memory>

// template <class Alloc>
// struct allocator_traits
// {
//     template <class T> using rebind_alloc  = Alloc::rebind<U>::other | Alloc<T, Args...>;
//     ...
// };

#include <memory>
#include <type_traits>

template <class T>
struct ReboundA {};

template <class T>
struct A
{
    typedef T value_type;

    template <class U> struct rebind {typedef ReboundA<U> other;};
};

template <class T, class U>
struct ReboundB {};

template <class T, class U>
struct B
{
    typedef T value_type;

    template <class V> struct rebind {typedef ReboundB<V, U> other;};
};

template <class T>
struct C
{
    typedef T value_type;
};

templa
 te <class T, class U>
struct D
{
    typedef T value_type;
};

template <class T>
struct E
{
    typedef T value_type;

    template <class U> struct rebind {typedef ReboundA<U> otter;};
};

int main()
{
#ifndef _LIBCPP_HAS_NO_TEMPLATE_ALIASES
    static_assert((std::is_same<std::allocator_traits<A<char> >::rebind_alloc<double>, ReboundA<double> >::value), "");
    static_assert((std::is_same<std::allocator_traits<B<int, char> >::rebind_alloc<double>, ReboundB<double, char> >::value), "");
    static_assert((std::is_same<std::allocator_traits<C<char> >::rebind_alloc<double>, C<double> >::value), "");
    static_assert((std::is_same<std::allocator_traits<D<int, char> >::rebind_alloc<double>, D<double, char> >::value), "");
    static_assert((std::is_same<std::allocator_traits<E<char> >::rebind_alloc<double>, E<double> >::value), "");
#else
    static_assert((std::is_same<std::allocator_traits<A<char> >::rebind_alloc<double>::other, ReboundA<double> >::value), "");
    static_
 assert((std::is_same<std::allocator_traits<B<int, char> >::rebind_alloc<double>::other, ReboundB<double, char> >::value), "");
    static_assert((std::is_same<std::allocator_traits<C<char> >::rebind_alloc<double>::other, C<double> >::value), "");
    static_assert((std::is_same<std::allocator_traits<D<int, char> >::rebind_alloc<double>::other, D<double, char> >::value), "");
    static_assert((std::is_same<std::allocator_traits<E<char> >::rebind_alloc<double>::other, E<double> >::value), "");
#endif
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <memory>
+
+// template <class Alloc>
+// struct allocator_traits
+// {
+//     template <class T> using rebind_alloc  = Alloc::rebind<U>::other | Alloc<T, Args...>;
+//     ...
+// };
+
+#include <memory>
+#include <type_traits>
+
+template <class T>
+struct ReboundA {};
+
+template <class T>
+struct A
+{
+    typedef T value_type;
+
+    template <class U> struct rebind {typedef ReboundA<U> other;};
+};
+
+template <class T, class U>
+struct ReboundB {};
+
+template <class T, class U>
+struct B
+{
+    typedef T value_type;
+
+    template <class V> struct rebind {typedef ReboundB<V, U> other;};
+};
+
+template <class T>
+struct C
+{
+    typedef T value_type;
+};
+
+template <class T, class U>
+struct D
+{
+    typedef T value_type;
+};
+
+template <class T>
+struct E
+{
+    typedef T value_type;
+
+    template <class U> struct rebind {typedef ReboundA<U> otter;};
+};
+
+int main()
+{
+#ifndef _LIBCPP_HAS_NO_TEMPLATE_ALIASES
+    static_assert((std::is_same<std::allocator_traits<A<char> >::rebind_alloc<double>, ReboundA<double> >::value), "");
+    static_assert((std::is_same<std::allocator_traits<B<int, char> >::rebind_alloc<double>, ReboundB<double, char> >::value), "");
+    static_assert((std::is_same<std::allocator_traits<C<char> >::rebind_alloc<double>, C<double> >::value), "");
+    static_assert((std::is_same<std::allocator_traits<D<int, char> >::rebind_alloc<double>, D<double, char> >::value), "");
+    static_assert((std::is_same<std::allocator_traits<E<char> >::rebind_alloc<double>, E<double> >::value), "");
+#else  // _LIBCPP_HAS_NO_TEMPLATE_ALIASES
+    static_assert((std::is_same<std::allocator_traits<A<char> >::rebind_alloc<double>::other, ReboundA<double> >::value), "");
+    static_assert((std::is_same<std::allocator_traits<B<int, char> >::rebind_alloc<double>::other, ReboundB<double, char> >::value), "");
+    static_assert((std::is_same<std::allocator_traits<C<char> >::rebind_alloc<double>::other, C<double> >::value), "");
+    static_assert((std::is_same<std::allocator_traits<D<int, char> >::rebind_alloc<double>::other, D<double, char> >::value), "");
+    static_assert((std::is_same<std::allocator_traits<E<char> >::rebind_alloc<double>::other, E<double> >::value), "");
+#endif  // _LIBCPP_HAS_NO_TEMPLATE_ALIASES
+}

Modified: libcxx/trunk/test/utilities/memory/allocator.traits/allocator.traits.types/size_type.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/memory/allocator.traits/allocator.traits.types/size_type.pass.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/memory/allocator.traits/allocator.traits.types/size_type.pass.cpp (original)
+++ libcxx/trunk/test/utilities/memory/allocator.traits/allocator.traits.types/size_type.pass.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,39 @@
-//===----------------------------------------------------------------------===//
//
//                     The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//

// <memory>

// template <class Alloc>
// struct allocator_traits
// {
//     typedef Alloc::size_type | size_t    size_type;
//     ...
// };

#include <memory>
#include <type_traits>

template <class T>
struct A
{
    typedef T value_type;
    typedef unsigned short size_type;
};

template <class T>
struct B
{
    typedef T value_type;
};

int main()
{
    static_assert((std::is_same<std::allocator_traits<A<char> >::size_type, unsigned short>::value), "");
    static_assert((std::is_same<std::allocator_traits<B<char> >::size_type, std::size_t>::value), "");
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <memory>
+
+// template <class Alloc>
+// struct allocator_traits
+// {
+//     typedef Alloc::size_type | size_t    size_type;
+//     ...
+// };
+
+#include <memory>
+#include <type_traits>
+
+template <class T>
+struct A
+{
+    typedef T value_type;
+    typedef unsigned short size_type;
+};
+
+template <class T>
+struct B
+{
+    typedef T value_type;
+};
+
+int main()
+{
+    static_assert((std::is_same<std::allocator_traits<A<char> >::size_type, unsigned short>::value), "");
+    static_assert((std::is_same<std::allocator_traits<B<char> >::size_type, std::size_t>::value), "");
+}

Modified: libcxx/trunk/test/utilities/memory/allocator.traits/allocator.traits.types/void_pointer.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/memory/allocator.traits/allocator.traits.types/void_pointer.pass.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/memory/allocator.traits/allocator.traits.types/void_pointer.pass.cpp (original)
+++ libcxx/trunk/test/utilities/memory/allocator.traits/allocator.traits.types/void_pointer.pass.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,55 @@
-//===----------------------------------------------------------------------===//
//
//                     The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//

// <memory>

// template <class Alloc>
// struct allocator_traits
// {
//     typedef Alloc::void_pointer
//           | pointer_traits<pointer>::rebind<void>
//                                          void_pointer;
//     ...
// };

#include <memory>
#include <type_traits>

template <class T>
struct Ptr {};

template <class T>
struct A
{
    typedef T value_type;
    typedef Ptr<T> pointer;
};

template <class T>
struct B
{
    typedef T value_type;
};

template <class T>
struct CPtr {};

template <class T>
struct C
{
    typedef T value_type;
    typedef CPtr<void> void_pointer;
};

int main()
{
    static_assert((std::is_same<std::allo
 cator_traits<A<char> >::void_pointer, Ptr<void> >::value), "");
    static_assert((std::is_same<std::allocator_traits<B<char> >::void_pointer, void*>::value), "");
    static_assert((std::is_same<std::allocator_traits<C<char> >::void_pointer, CPtr<void> >::value), "");
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <memory>
+
+// template <class Alloc>
+// struct allocator_traits
+// {
+//     typedef Alloc::void_pointer
+//           | pointer_traits<pointer>::rebind<void>
+//                                          void_pointer;
+//     ...
+// };
+
+#include <memory>
+#include <type_traits>
+
+template <class T>
+struct Ptr {};
+
+template <class T>
+struct A
+{
+    typedef T value_type;
+    typedef Ptr<T> pointer;
+};
+
+template <class T>
+struct B
+{
+    typedef T value_type;
+};
+
+template <class T>
+struct CPtr {};
+
+template <class T>
+struct C
+{
+    typedef T value_type;
+    typedef CPtr<void> void_pointer;
+};
+
+int main()
+{
+    static_assert((std::is_same<std::allocator_traits<A<char> >::void_pointer, Ptr<void> >::value), "");
+    static_assert((std::is_same<std::allocator_traits<B<char> >::void_pointer, void*>::value), "");
+    static_assert((std::is_same<std::allocator_traits<C<char> >::void_pointer, CPtr<void> >::value), "");
+}

Modified: libcxx/trunk/test/utilities/memory/allocator.traits/allocator_type.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/memory/allocator.traits/allocator_type.pass.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/memory/allocator.traits/allocator_type.pass.cpp (original)
+++ libcxx/trunk/test/utilities/memory/allocator.traits/allocator_type.pass.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,31 @@
-//===----------------------------------------------------------------------===//
//
//                     The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//

// <memory>

// template <class Alloc>
// struct allocator_traits
// {
//     typedef Alloc allocator_type;
//     ...
// };

#include <memory>
#include <type_traits>

template <class T>
struct A
{
    typedef T value_type;
};

int main()
{
    static_assert((std::is_same<std::allocator_traits<A<char> >::allocator_type, A<char> >::value), "");
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <memory>
+
+// template <class Alloc>
+// struct allocator_traits
+// {
+//     typedef Alloc allocator_type;
+//     ...
+// };
+
+#include <memory>
+#include <type_traits>
+
+template <class T>
+struct A
+{
+    typedef T value_type;
+};
+
+int main()
+{
+    static_assert((std::is_same<std::allocator_traits<A<char> >::allocator_type, A<char> >::value), "");
+}

Modified: libcxx/trunk/test/utilities/memory/allocator.traits/rebind_traits.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/memory/allocator.traits/rebind_traits.pass.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/memory/allocator.traits/rebind_traits.pass.cpp (original)
+++ libcxx/trunk/test/utilities/memory/allocator.traits/rebind_traits.pass.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,79 @@
-//===----------------------------------------------------------------------===//
//
//                     The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//

// <memory>

// template <class Alloc>
// struct allocator_traits
// {
//     template <class T> using rebind_traits = allocator_traits<rebind_alloc<T>>;
//     ...
// };

#include <memory>
#include <type_traits>

template <class T>
struct ReboundA {};

template <class T>
struct A
{
    typedef T value_type;

    template <class U> struct rebind {typedef ReboundA<U> other;};
};

template <class T, class U>
struct ReboundB {};

template <class T, class U>
struct B
{
    typedef T value_type;

    template <class V> struct rebind {typedef ReboundB<V, U> other;};
};

template <class T>
struct C
{
    typedef T value_type;
};

template <class 
 T, class U>
struct D
{
    typedef T value_type;
};

template <class T>
struct E
{
    typedef T value_type;

    template <class U> struct rebind {typedef ReboundA<U> otter;};
};

int main()
{
#ifndef _LIBCPP_HAS_NO_TEMPLATE_ALIASES
    static_assert((std::is_same<std::allocator_traits<A<char> >::rebind_traits<double>, std::allocator_traits<ReboundA<double> > >::value), "");
    static_assert((std::is_same<std::allocator_traits<B<int, char> >::rebind_traits<double>, std::allocator_traits<ReboundB<double, char> > >::value), "");
    static_assert((std::is_same<std::allocator_traits<C<char> >::rebind_traits<double>, std::allocator_traits<C<double> > >::value), "");
    static_assert((std::is_same<std::allocator_traits<D<int, char> >::rebind_traits<double>, std::allocator_traits<D<double, char> > >::value), "");
    static_assert((std::is_same<std::allocator_traits<E<char> >::rebind_traits<double>, std::allocator_traits<E<double> > >::value), "");
#else
    static_assert((std:
 :is_same<std::allocator_traits<A<char> >::rebind_traits<double>::other, std::allocator_traits<ReboundA<double> > >::value), "");
    static_assert((std::is_same<std::allocator_traits<B<int, char> >::rebind_traits<double>::other, std::allocator_traits<ReboundB<double, char> > >::value), "");
    static_assert((std::is_same<std::allocator_traits<C<char> >::rebind_traits<double>::other, std::allocator_traits<C<double> > >::value), "");
    static_assert((std::is_same<std::allocator_traits<D<int, char> >::rebind_traits<double>::other, std::allocator_traits<D<double, char> > >::value), "");
    static_assert((std::is_same<std::allocator_traits<E<char> >::rebind_traits<double>::other, std::allocator_traits<E<double> > >::value), "");
#endif
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <memory>
+
+// template <class Alloc>
+// struct allocator_traits
+// {
+//     template <class T> using rebind_traits = allocator_traits<rebind_alloc<T>>;
+//     ...
+// };
+
+#include <memory>
+#include <type_traits>
+
+template <class T>
+struct ReboundA {};
+
+template <class T>
+struct A
+{
+    typedef T value_type;
+
+    template <class U> struct rebind {typedef ReboundA<U> other;};
+};
+
+template <class T, class U>
+struct ReboundB {};
+
+template <class T, class U>
+struct B
+{
+    typedef T value_type;
+
+    template <class V> struct rebind {typedef ReboundB<V, U> other;};
+};
+
+template <class T>
+struct C
+{
+    typedef T value_type;
+};
+
+template <class T, class U>
+struct D
+{
+    typedef T value_type;
+};
+
+template <class T>
+struct E
+{
+    typedef T value_type;
+
+    template <class U> struct rebind {typedef ReboundA<U> otter;};
+};
+
+int main()
+{
+#ifndef _LIBCPP_HAS_NO_TEMPLATE_ALIASES
+    static_assert((std::is_same<std::allocator_traits<A<char> >::rebind_traits<double>, std::allocator_traits<ReboundA<double> > >::value), "");
+    static_assert((std::is_same<std::allocator_traits<B<int, char> >::rebind_traits<double>, std::allocator_traits<ReboundB<double, char> > >::value), "");
+    static_assert((std::is_same<std::allocator_traits<C<char> >::rebind_traits<double>, std::allocator_traits<C<double> > >::value), "");
+    static_assert((std::is_same<std::allocator_traits<D<int, char> >::rebind_traits<double>, std::allocator_traits<D<double, char> > >::value), "");
+    static_assert((std::is_same<std::allocator_traits<E<char> >::rebind_traits<double>, std::allocator_traits<E<double> > >::value), "");
+#else  // _LIBCPP_HAS_NO_TEMPLATE_ALIASES
+    static_assert((std::is_same<std::allocator_traits<A<char> >::rebind_traits<double>::other, std::allocator_traits<ReboundA<double> > >::value), "");
+    static_assert((std::is_same<std::allocator_traits<B<int, char> >::rebind_traits<double>::other, std::allocator_traits<ReboundB<double, char> > >::value), "");
+    static_assert((std::is_same<std::allocator_traits<C<char> >::rebind_traits<double>::other, std::allocator_traits<C<double> > >::value), "");
+    static_assert((std::is_same<std::allocator_traits<D<int, char> >::rebind_traits<double>::other, std::allocator_traits<D<double, char> > >::value), "");
+    static_assert((std::is_same<std::allocator_traits<E<char> >::rebind_traits<double>::other, std::allocator_traits<E<double> > >::value), "");
+#endif  // _LIBCPP_HAS_NO_TEMPLATE_ALIASES
+}

Modified: libcxx/trunk/test/utilities/memory/allocator.traits/value_type.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/memory/allocator.traits/value_type.pass.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/memory/allocator.traits/value_type.pass.cpp (original)
+++ libcxx/trunk/test/utilities/memory/allocator.traits/value_type.pass.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,31 @@
-//===----------------------------------------------------------------------===//
//
//                     The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//

// <memory>

// template <class Alloc>
// struct allocator_traits
// {
//     typedef typename Alloc::value_type value_type;
//     ...
// };

#include <memory>
#include <type_traits>

template <class T>
struct A
{
    typedef T value_type;
};

int main()
{
    static_assert((std::is_same<std::allocator_traits<A<char> >::value_type, char>::value), "");
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <memory>
+
+// template <class Alloc>
+// struct allocator_traits
+// {
+//     typedef typename Alloc::value_type value_type;
+//     ...
+// };
+
+#include <memory>
+#include <type_traits>
+
+template <class T>
+struct A
+{
+    typedef T value_type;
+};
+
+int main()
+{
+    static_assert((std::is_same<std::allocator_traits<A<char> >::value_type, char>::value), "");
+}

Modified: libcxx/trunk/test/utilities/memory/allocator.uses/allocator.uses.construction/tested_elsewhere.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/memory/allocator.uses/allocator.uses.construction/tested_elsewhere.pass.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/memory/allocator.uses/allocator.uses.construction/tested_elsewhere.pass.cpp (original)
+++ libcxx/trunk/test/utilities/memory/allocator.uses/allocator.uses.construction/tested_elsewhere.pass.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,12 @@
-//===----------------------------------------------------------------------===//
//
//                     The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//

int main()
{
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+int main()
+{
+}

Modified: libcxx/trunk/test/utilities/memory/allocator.uses/allocator.uses.trait/uses_allocator.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/memory/allocator.uses/allocator.uses.trait/uses_allocator.pass.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/memory/allocator.uses/allocator.uses.trait/uses_allocator.pass.cpp (original)
+++ libcxx/trunk/test/utilities/memory/allocator.uses/allocator.uses.trait/uses_allocator.pass.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,33 @@
-//===----------------------------------------------------------------------===//
//
//                     The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//

// <memory>

// template <class T, class Alloc> struct uses_allocator;

#include <memory>
#include <vector>

struct A
{
};

struct B
{
    typedef int allocator_type;
};

int main()
{
    static_assert((!std::uses_allocator<int, std::allocator<int> >::value), "");
    static_assert(( std::uses_allocator<std::vector<int>, std::allocator<int> >::value), "");
    static_assert((!std::uses_allocator<A, std::allocator<int> >::value), "");
    static_assert((!std::uses_allocator<B, std::allocator<int> >::value), "");
    static_assert(( std::uses_allocator<B, double>::value), "");
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <memory>
+
+// template <class T, class Alloc> struct uses_allocator;
+
+#include <memory>
+#include <vector>
+
+struct A
+{
+};
+
+struct B
+{
+    typedef int allocator_type;
+};
+
+int main()
+{
+    static_assert((!std::uses_allocator<int, std::allocator<int> >::value), "");
+    static_assert(( std::uses_allocator<std::vector<int>, std::allocator<int> >::value), "");
+    static_assert((!std::uses_allocator<A, std::allocator<int> >::value), "");
+    static_assert((!std::uses_allocator<B, std::allocator<int> >::value), "");
+    static_assert(( std::uses_allocator<B, double>::value), "");
+}

Modified: libcxx/trunk/test/utilities/memory/allocator.uses/nothing_to_do.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/memory/allocator.uses/nothing_to_do.pass.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/memory/allocator.uses/nothing_to_do.pass.cpp (original)
+++ libcxx/trunk/test/utilities/memory/allocator.uses/nothing_to_do.pass.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,12 @@
-//===----------------------------------------------------------------------===//
//
//                     The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//

int main()
{
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+int main()
+{
+}

Modified: libcxx/trunk/test/utilities/memory/c.malloc/nothing_to_do.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/memory/c.malloc/nothing_to_do.pass.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/memory/c.malloc/nothing_to_do.pass.cpp (original)
+++ libcxx/trunk/test/utilities/memory/c.malloc/nothing_to_do.pass.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,14 @@
-//===----------------------------------------------------------------------===//
//
//                     The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//

// <cstdlib> and <cstring> are already tested elsewhere

int main()
{
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <cstdlib> and <cstring> are already tested elsewhere
+
+int main()
+{
+}

Modified: libcxx/trunk/test/utilities/memory/default.allocator/allocator.globals/eq.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/memory/default.allocator/allocator.globals/eq.pass.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/memory/default.allocator/allocator.globals/eq.pass.cpp (original)
+++ libcxx/trunk/test/utilities/memory/default.allocator/allocator.globals/eq.pass.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,31 @@
-//===----------------------------------------------------------------------===//
//
//                     The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//

// <memory>

// allocator:

// template <class T1, class T2> 
//   bool
//   operator==(const allocator<T1>&, const allocator<T2>&) throw();
// 
// template <class T1, class T2> 
//   bool
//   operator!=(const allocator<T1>&, const allocator<T2>&) throw();

#include <memory>
#include <cassert>

int main()
{
    std::allocator<int> a1;
    std::allocator<int> a2;
    assert(a1 == a2);
    assert(!(a1 != a2));
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <memory>
+
+// allocator:
+
+// template <class T1, class T2>
+//   bool
+//   operator==(const allocator<T1>&, const allocator<T2>&) throw();
+//
+// template <class T1, class T2>
+//   bool
+//   operator!=(const allocator<T1>&, const allocator<T2>&) throw();
+
+#include <memory>
+#include <cassert>
+
+int main()
+{
+    std::allocator<int> a1;
+    std::allocator<int> a2;
+    assert(a1 == a2);
+    assert(!(a1 != a2));
+}

Modified: libcxx/trunk/test/utilities/memory/default.allocator/allocator.members/address.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/memory/default.allocator/allocator.members/address.pass.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/memory/default.allocator/allocator.members/address.pass.cpp (original)
+++ libcxx/trunk/test/utilities/memory/default.allocator/allocator.members/address.pass.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,39 @@
-//===----------------------------------------------------------------------===//
//
//                     The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//

// <memory>

// allocator:
// pointer address(reference x) const;
// const_pointer address(const_reference x) const;

#include <memory>
#include <cassert>

template <class T>
void test_address()
{
    T* tp = new T();
    const T* ctp = tp;
    const std::allocator<T> a;
    assert(a.address(*tp) == tp);
    assert(a.address(*ctp) == tp);
    delete tp;
}

struct A
{
    void operator&() const {}
};

int main()
{
    test_address<int>();
    test_address<A>();
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <memory>
+
+// allocator:
+// pointer address(reference x) const;
+// const_pointer address(const_reference x) const;
+
+#include <memory>
+#include <cassert>
+
+template <class T>
+void test_address()
+{
+    T* tp = new T();
+    const T* ctp = tp;
+    const std::allocator<T> a;
+    assert(a.address(*tp) == tp);
+    assert(a.address(*ctp) == tp);
+    delete tp;
+}
+
+struct A
+{
+    void operator&() const {}
+};
+
+int main()
+{
+    test_address<int>();
+    test_address<A>();
+}

Modified: libcxx/trunk/test/utilities/memory/default.allocator/allocator.members/allocate.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/memory/default.allocator/allocator.members/allocate.pass.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/memory/default.allocator/allocator.members/allocate.pass.cpp (original)
+++ libcxx/trunk/test/utilities/memory/default.allocator/allocator.members/allocate.pass.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,63 @@
-//===----------------------------------------------------------------------===//
//
//                     The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//

// <memory>

// allocator:
// pointer allocate(size_type n, allocator<void>::const_pointer hint=0);

#include <memory>
#include <new>
#include <cstdlib>
#include <cassert>

int new_called = 0;

void* operator new(std::size_t s) throw(std::bad_alloc)
{
    ++new_called;
    assert(s == 3 * sizeof(int));
    return std::malloc(s);
}

void  operator delete(void* p) throw()
{
    --new_called;
    std::free(p);
}

int A_constructed = 0;

struct A
{
    int data;
    A() {++A_constructed;}
    A(const A&) {++A_constructed;}
    ~A() {--A_constructed;}
};

int main()
{
    std::allocator<A> a;
    assert(new_called == 0);
    assert(A_constructe
 d == 0);
    A* ap = a.allocate(3);
    assert(new_called == 1);
    assert(A_constructed == 0);
    a.deallocate(ap, 3);
    assert(new_called == 0);
    assert(A_constructed == 0);

    A* ap2 = a.allocate(3, (const void*)5);
    assert(new_called == 1);
    assert(A_constructed == 0);
    a.deallocate(ap2, 3);
    assert(new_called == 0);
    assert(A_constructed == 0);
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <memory>
+
+// allocator:
+// pointer allocate(size_type n, allocator<void>::const_pointer hint=0);
+
+#include <memory>
+#include <new>
+#include <cstdlib>
+#include <cassert>
+
+int new_called = 0;
+
+void* operator new(std::size_t s) throw(std::bad_alloc)
+{
+    ++new_called;
+    assert(s == 3 * sizeof(int));
+    return std::malloc(s);
+}
+
+void  operator delete(void* p) throw()
+{
+    --new_called;
+    std::free(p);
+}
+
+int A_constructed = 0;
+
+struct A
+{
+    int data;
+    A() {++A_constructed;}
+    A(const A&) {++A_constructed;}
+    ~A() {--A_constructed;}
+};
+
+int main()
+{
+    std::allocator<A> a;
+    assert(new_called == 0);
+    assert(A_constructed == 0);
+    A* ap = a.allocate(3);
+    assert(new_called == 1);
+    assert(A_constructed == 0);
+    a.deallocate(ap, 3);
+    assert(new_called == 0);
+    assert(A_constructed == 0);
+
+    A* ap2 = a.allocate(3, (const void*)5);
+    assert(new_called == 1);
+    assert(A_constructed == 0);
+    a.deallocate(ap2, 3);
+    assert(new_called == 0);
+    assert(A_constructed == 0);
+}

Modified: libcxx/trunk/test/utilities/memory/default.allocator/allocator.members/construct.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/memory/default.allocator/allocator.members/construct.pass.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/memory/default.allocator/allocator.members/construct.pass.cpp (original)
+++ libcxx/trunk/test/utilities/memory/default.allocator/allocator.members/construct.pass.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,153 @@
-//===----------------------------------------------------------------------===//
//
//                     The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//

// <memory>

// allocator:
// template <class... Args> void construct(pointer p, Args&&... args);

#include <memory>
#include <new>
#include <cstdlib>
#include <cassert>

int new_called = 0;

void* operator new(std::size_t s) throw(std::bad_alloc)
{
    ++new_called;
    assert(s == 3 * sizeof(int));
    return std::malloc(s);
}

void  operator delete(void* p) throw()
{
    --new_called;
    std::free(p);
}

int A_constructed = 0;

struct A
{
    int data;
    A() {++A_constructed;}

    A(const A&) {++A_constructed;}

    explicit A(int) {++A_constructed;}
    A(int, int*) {++A_constructed;}

    ~A() {--A_constructed;}
};

int move_only_
 constructed = 0;

class move_only
{
    int data;
#ifdef _LIBCPP_MOVE
    move_only(const move_only&);
    move_only& operator=(const move_only&);
#else
    move_only(move_only&);
    move_only& operator=(move_only&);
#endif

public:

#ifdef _LIBCPP_MOVE
    move_only(move_only&&) {++move_only_constructed;}
    move_only& operator=(move_only&&) {}
#else
    operator std::__rv<move_only> () {return std::__rv<move_only>(*this);}
    move_only(std::__rv<move_only>) {++move_only_constructed;}
#endif

    move_only() {++move_only_constructed;}
    ~move_only() {--move_only_constructed;}
};

int main()
{
    {
    std::allocator<A> a;
    assert(new_called == 0);
    assert(A_constructed == 0);

    A* ap = a.allocate(3);
    assert(new_called == 1);
    assert(A_constructed == 0);

    a.construct(ap);
    assert(new_called == 1);
    assert(A_constructed == 1);

    a.destroy(ap);
    assert(new_called == 1);
    assert(A_constructed == 0);

    a.construct(ap, A());
    assert(
 new_called == 1);
    assert(A_constructed == 1);

    a.destroy(ap);
    assert(new_called == 1);
    assert(A_constructed == 0);

    a.construct(ap, 5);
    assert(new_called == 1);
    assert(A_constructed == 1);

    a.destroy(ap);
    assert(new_called == 1);
    assert(A_constructed == 0);

    a.construct(ap, 5, (int*)0);
    assert(new_called == 1);
    assert(A_constructed == 1);

    a.destroy(ap);
    assert(new_called == 1);
    assert(A_constructed == 0);

    a.deallocate(ap, 3);
    assert(new_called == 0);
    assert(A_constructed == 0);
    }
    {
    std::allocator<move_only> a;
    assert(new_called == 0);
    assert(move_only_constructed == 0);

    move_only* ap = a.allocate(3);
    assert(new_called == 1);
    assert(move_only_constructed == 0);

    a.construct(ap);
    assert(new_called == 1);
    assert(move_only_constructed == 1);

    a.destroy(ap);
    assert(new_called == 1);
    assert(move_only_constructed == 0);

    a.construct(ap, move_onl
 y());
    assert(new_called == 1);
    assert(move_only_constructed == 1);

    a.destroy(ap);
    assert(new_called == 1);
    assert(move_only_constructed == 0);

    a.deallocate(ap, 3);
    assert(new_called == 0);
    assert(move_only_constructed == 0);
    }
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <memory>
+
+// allocator:
+// template <class... Args> void construct(pointer p, Args&&... args);
+
+#include <memory>
+#include <new>
+#include <cstdlib>
+#include <cassert>
+
+int new_called = 0;
+
+void* operator new(std::size_t s) throw(std::bad_alloc)
+{
+    ++new_called;
+    assert(s == 3 * sizeof(int));
+    return std::malloc(s);
+}
+
+void  operator delete(void* p) throw()
+{
+    --new_called;
+    std::free(p);
+}
+
+int A_constructed = 0;
+
+struct A
+{
+    int data;
+    A() {++A_constructed;}
+
+    A(const A&) {++A_constructed;}
+
+    explicit A(int) {++A_constructed;}
+    A(int, int*) {++A_constructed;}
+
+    ~A() {--A_constructed;}
+};
+
+int move_only_constructed = 0;
+
+class move_only
+{
+    int data;
+#ifdef _LIBCPP_MOVE
+    move_only(const move_only&);
+    move_only& operator=(const move_only&);
+#else  // _LIBCPP_MOVE
+    move_only(move_only&);
+    move_only& operator=(move_only&);
+#endif  // _LIBCPP_MOVE
+
+public:
+
+#ifdef _LIBCPP_MOVE
+    move_only(move_only&&) {++move_only_constructed;}
+    move_only& operator=(move_only&&) {}
+#else  // _LIBCPP_MOVE
+    operator std::__rv<move_only> () {return std::__rv<move_only>(*this);}
+    move_only(std::__rv<move_only>) {++move_only_constructed;}
+#endif  // _LIBCPP_MOVE
+
+    move_only() {++move_only_constructed;}
+    ~move_only() {--move_only_constructed;}
+};
+
+int main()
+{
+    {
+    std::allocator<A> a;
+    assert(new_called == 0);
+    assert(A_constructed == 0);
+
+    A* ap = a.allocate(3);
+    assert(new_called == 1);
+    assert(A_constructed == 0);
+
+    a.construct(ap);
+    assert(new_called == 1);
+    assert(A_constructed == 1);
+
+    a.destroy(ap);
+    assert(new_called == 1);
+    assert(A_constructed == 0);
+
+    a.construct(ap, A());
+    assert(new_called == 1);
+    assert(A_constructed == 1);
+
+    a.destroy(ap);
+    assert(new_called == 1);
+    assert(A_constructed == 0);
+
+    a.construct(ap, 5);
+    assert(new_called == 1);
+    assert(A_constructed == 1);
+
+    a.destroy(ap);
+    assert(new_called == 1);
+    assert(A_constructed == 0);
+
+    a.construct(ap, 5, (int*)0);
+    assert(new_called == 1);
+    assert(A_constructed == 1);
+
+    a.destroy(ap);
+    assert(new_called == 1);
+    assert(A_constructed == 0);
+
+    a.deallocate(ap, 3);
+    assert(new_called == 0);
+    assert(A_constructed == 0);
+    }
+    {
+    std::allocator<move_only> a;
+    assert(new_called == 0);
+    assert(move_only_constructed == 0);
+
+    move_only* ap = a.allocate(3);
+    assert(new_called == 1);
+    assert(move_only_constructed == 0);
+
+    a.construct(ap);
+    assert(new_called == 1);
+    assert(move_only_constructed == 1);
+
+    a.destroy(ap);
+    assert(new_called == 1);
+    assert(move_only_constructed == 0);
+
+    a.construct(ap, move_only());
+    assert(new_called == 1);
+    assert(move_only_constructed == 1);
+
+    a.destroy(ap);
+    assert(new_called == 1);
+    assert(move_only_constructed == 0);
+
+    a.deallocate(ap, 3);
+    assert(new_called == 0);
+    assert(move_only_constructed == 0);
+    }
+}

Modified: libcxx/trunk/test/utilities/memory/default.allocator/allocator.members/max_size.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/memory/default.allocator/allocator.members/max_size.pass.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/memory/default.allocator/allocator.members/max_size.pass.cpp (original)
+++ libcxx/trunk/test/utilities/memory/default.allocator/allocator.members/max_size.pass.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,27 @@
-//===----------------------------------------------------------------------===//
//
//                     The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//

// <memory>

// allocator:
// size_type max_size() const throw();

#include <memory>
#include <limits>
#include <cstddef>
#include <cassert>

int new_called = 0;

int main()
{
    const std::allocator<int> a;
    std::size_t M = a.max_size() * sizeof(int);
    assert(M > 0xFFFF && M <= std::numeric_limits<std::size_t>::max());
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <memory>
+
+// allocator:
+// size_type max_size() const throw();
+
+#include <memory>
+#include <limits>
+#include <cstddef>
+#include <cassert>
+
+int new_called = 0;
+
+int main()
+{
+    const std::allocator<int> a;
+    std::size_t M = a.max_size() * sizeof(int);
+    assert(M > 0xFFFF && M <= std::numeric_limits<std::size_t>::max());
+}

Modified: libcxx/trunk/test/utilities/memory/default.allocator/allocator_types.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/memory/default.allocator/allocator_types.pass.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/memory/default.allocator/allocator_types.pass.cpp (original)
+++ libcxx/trunk/test/utilities/memory/default.allocator/allocator_types.pass.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,49 @@
-//===----------------------------------------------------------------------===//
//
//                     The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//

// <memory>

// check nested types:

// template <class T>
// class allocator
// {
// public:
//     typedef size_t                                size_type;
//     typedef ptrdiff_t                             difference_type;
//     typedef T*                                    pointer;
//     typedef const T*                              const_pointer;
//     typedef typename add_lvalue_reference<T>::type       reference;
//     typedef typename add_lvalue_reference<const T>::type const_reference;
//     typedef T                                     value_type;
// 
//     template <class U> struct rebind {typedef allocator<U> other;};
/
 / ...
// };

#include <memory>
#include <type_traits>
#include <cstddef>

int main()
{
    static_assert((std::is_same<std::allocator<char>::size_type, std::size_t>::value), "");
    static_assert((std::is_same<std::allocator<char>::difference_type, std::ptrdiff_t>::value), "");
    static_assert((std::is_same<std::allocator<char>::pointer, char*>::value), "");
    static_assert((std::is_same<std::allocator<char>::const_pointer, const char*>::value), "");
    static_assert((std::is_same<std::allocator<char>::value_type, char>::value), "");
    static_assert((std::is_same<std::allocator<char>::reference, char&>::value), "");
    static_assert((std::is_same<std::allocator<char>::const_reference, const char&>::value), "");
    static_assert((std::is_same<std::allocator<char>::rebind<int>::other,
                                std::allocator<int> >::value), "");
    std::allocator<char> a;
    std::allocator<char> a2 = a;
    a2 = a;
    std::allocator<int> a3 = a2;
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <memory>
+
+// check nested types:
+
+// template <class T>
+// class allocator
+// {
+// public:
+//     typedef size_t                                size_type;
+//     typedef ptrdiff_t                             difference_type;
+//     typedef T*                                    pointer;
+//     typedef const T*                              const_pointer;
+//     typedef typename add_lvalue_reference<T>::type       reference;
+//     typedef typename add_lvalue_reference<const T>::type const_reference;
+//     typedef T                                     value_type;
+//
+//     template <class U> struct rebind {typedef allocator<U> other;};
+// ...
+// };
+
+#include <memory>
+#include <type_traits>
+#include <cstddef>
+
+int main()
+{
+    static_assert((std::is_same<std::allocator<char>::size_type, std::size_t>::value), "");
+    static_assert((std::is_same<std::allocator<char>::difference_type, std::ptrdiff_t>::value), "");
+    static_assert((std::is_same<std::allocator<char>::pointer, char*>::value), "");
+    static_assert((std::is_same<std::allocator<char>::const_pointer, const char*>::value), "");
+    static_assert((std::is_same<std::allocator<char>::value_type, char>::value), "");
+    static_assert((std::is_same<std::allocator<char>::reference, char&>::value), "");
+    static_assert((std::is_same<std::allocator<char>::const_reference, const char&>::value), "");
+    static_assert((std::is_same<std::allocator<char>::rebind<int>::other,
+                                std::allocator<int> >::value), "");
+    std::allocator<char> a;
+    std::allocator<char> a2 = a;
+    a2 = a;
+    std::allocator<int> a3 = a2;
+}

Modified: libcxx/trunk/test/utilities/memory/default.allocator/allocator_void.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/memory/default.allocator/allocator_void.pass.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/memory/default.allocator/allocator_void.pass.cpp (original)
+++ libcxx/trunk/test/utilities/memory/default.allocator/allocator_void.pass.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,36 @@
-//===----------------------------------------------------------------------===//
//
//                     The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//

// <memory>

// template <>
// class allocator<void>
// {
// public:
//     typedef void*                                 pointer;
//     typedef const void*                           const_pointer;
//     typedef void                                  value_type;
// 
//     template <class _Up> struct rebind {typedef allocator<_Up> other;};
// };

#include <memory>
#include <type_traits>

int main()
{
    static_assert((std::is_same<std::allocator<void>::pointer, void*>::value), "");
    static_assert((std::is_same<std::allocator<void>::const_pointer, const void*>::value), "");
    static_assert((std::is_same<std::allocator<void>::value_ty
 pe, void>::value), "");
    static_assert((std::is_same<std::allocator<void>::rebind<int>::other,
                                std::allocator<int> >::value), "");
    std::allocator<void> a;
    std::allocator<void> a2 = a;
    a2 = a;
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <memory>
+
+// template <>
+// class allocator<void>
+// {
+// public:
+//     typedef void*                                 pointer;
+//     typedef const void*                           const_pointer;
+//     typedef void                                  value_type;
+//
+//     template <class _Up> struct rebind {typedef allocator<_Up> other;};
+// };
+
+#include <memory>
+#include <type_traits>
+
+int main()
+{
+    static_assert((std::is_same<std::allocator<void>::pointer, void*>::value), "");
+    static_assert((std::is_same<std::allocator<void>::const_pointer, const void*>::value), "");
+    static_assert((std::is_same<std::allocator<void>::value_type, void>::value), "");
+    static_assert((std::is_same<std::allocator<void>::rebind<int>::other,
+                                std::allocator<int> >::value), "");
+    std::allocator<void> a;
+    std::allocator<void> a2 = a;
+    a2 = a;
+}

Modified: libcxx/trunk/test/utilities/memory/pointer.traits/difference_type.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/memory/pointer.traits/difference_type.pass.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/memory/pointer.traits/difference_type.pass.cpp (original)
+++ libcxx/trunk/test/utilities/memory/pointer.traits/difference_type.pass.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,25 @@
-//===----------------------------------------------------------------------===//
//
//                     The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//

// <memory>

// template <class T>
// struct pointer_traits<T*>
// {
//     typedef ptrdiff_t difference_type;
//     ...
// };

#include <memory>
#include <type_traits>

int main()
{
    static_assert((std::is_same<std::pointer_traits<double*>::difference_type, std::ptrdiff_t>::value), "");
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <memory>
+
+// template <class T>
+// struct pointer_traits<T*>
+// {
+//     typedef ptrdiff_t difference_type;
+//     ...
+// };
+
+#include <memory>
+#include <type_traits>
+
+int main()
+{
+    static_assert((std::is_same<std::pointer_traits<double*>::difference_type, std::ptrdiff_t>::value), "");
+}

Modified: libcxx/trunk/test/utilities/memory/pointer.traits/element_type.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/memory/pointer.traits/element_type.pass.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/memory/pointer.traits/element_type.pass.cpp (original)
+++ libcxx/trunk/test/utilities/memory/pointer.traits/element_type.pass.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,25 @@
-//===----------------------------------------------------------------------===//
//
//                     The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//

// <memory>

// template <class T>
// struct pointer_traits<T*>
// {
//     typedef T element_type;
//     ...
// };

#include <memory>
#include <type_traits>

int main()
{
    static_assert((std::is_same<std::pointer_traits<const short*>::element_type, const short>::value), "");
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <memory>
+
+// template <class T>
+// struct pointer_traits<T*>
+// {
+//     typedef T element_type;
+//     ...
+// };
+
+#include <memory>
+#include <type_traits>
+
+int main()
+{
+    static_assert((std::is_same<std::pointer_traits<const short*>::element_type, const short>::value), "");
+}

Modified: libcxx/trunk/test/utilities/memory/pointer.traits/pointer.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/memory/pointer.traits/pointer.pass.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/memory/pointer.traits/pointer.pass.cpp (original)
+++ libcxx/trunk/test/utilities/memory/pointer.traits/pointer.pass.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,32 @@
-//===----------------------------------------------------------------------===//
//
//                     The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//

// <memory>

// template <class Ptr>
// struct pointer_traits
// {
//     typedef Ptr pointer;
//     ...
// };

#include <memory>
#include <type_traits>

struct A
{
    typedef short element_type;
    typedef char difference_type;
};

int main()
{
    static_assert((std::is_same<std::pointer_traits<A>::pointer, A>::value), "");
    static_assert((std::is_same<std::pointer_traits<int*>::pointer, int*>::value), "");
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <memory>
+
+// template <class Ptr>
+// struct pointer_traits
+// {
+//     typedef Ptr pointer;
+//     ...
+// };
+
+#include <memory>
+#include <type_traits>
+
+struct A
+{
+    typedef short element_type;
+    typedef char difference_type;
+};
+
+int main()
+{
+    static_assert((std::is_same<std::pointer_traits<A>::pointer, A>::value), "");
+    static_assert((std::is_same<std::pointer_traits<int*>::pointer, int*>::value), "");
+}

Modified: libcxx/trunk/test/utilities/memory/pointer.traits/pointer.traits.functions/pointer_to.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/memory/pointer.traits/pointer.traits.functions/pointer_to.pass.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/memory/pointer.traits/pointer.traits.functions/pointer_to.pass.cpp (original)
+++ libcxx/trunk/test/utilities/memory/pointer.traits/pointer.traits.functions/pointer_to.pass.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,48 @@
-//===----------------------------------------------------------------------===//
//
//                     The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//

// <memory>

// template <class Ptr>
// struct pointer_traits
// {
//     static pointer pointer_to(<details>);
//     ...
// };

#include <memory>
#include <cassert>

template <class T>
struct A
{
private:
    struct nat {};
public:
    typedef T element_type;
    element_type* t_;

    A(element_type* t) : t_(t) {}

    static A pointer_to(typename std::conditional<std::is_void<element_type>::value,
                                           nat, element_type>::type& et)
        {return A(&et);}
};

int main()
{
    {
        int i = 0;
        A<int> a = std::pointer_traits<A<int> >::pointer_to(i);
        assert(a.t_ = &i);
    }
    {
 
        (std::pointer_traits<A<void> >::element_type)0;
    }
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <memory>
+
+// template <class Ptr>
+// struct pointer_traits
+// {
+//     static pointer pointer_to(<details>);
+//     ...
+// };
+
+#include <memory>
+#include <cassert>
+
+template <class T>
+struct A
+{
+private:
+    struct nat {};
+public:
+    typedef T element_type;
+    element_type* t_;
+
+    A(element_type* t) : t_(t) {}
+
+    static A pointer_to(typename std::conditional<std::is_void<element_type>::value,
+                                           nat, element_type>::type& et)
+        {return A(&et);}
+};
+
+int main()
+{
+    {
+        int i = 0;
+        A<int> a = std::pointer_traits<A<int> >::pointer_to(i);
+        assert(a.t_ = &i);
+    }
+    {
+        (std::pointer_traits<A<void> >::element_type)0;
+    }
+}

Modified: libcxx/trunk/test/utilities/memory/pointer.traits/pointer.traits.types/difference_type.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/memory/pointer.traits/pointer.traits.types/difference_type.pass.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/memory/pointer.traits/pointer.traits.types/difference_type.pass.cpp (original)
+++ libcxx/trunk/test/utilities/memory/pointer.traits/pointer.traits.types/difference_type.pass.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,48 @@
-//===----------------------------------------------------------------------===//
//
//                     The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//

// <memory>

// template <class Ptr>
// struct pointer_traits
// {
//     typedef <details> difference_type;
//     ...
// };

#include <memory>
#include <type_traits>

struct A
{
    typedef short element_type;
    typedef char difference_type;
};

struct B
{
    typedef short element_type;
};

template <class T>
struct C {};

template <class T>
struct D
{
    typedef char difference_type;
};

int main()
{
    static_assert((std::is_same<std::pointer_traits<A>::difference_type, char>::value), "");
    static_assert((std::is_same<std::pointer_traits<B>::difference_type, std::ptrdiff_t>::value), "");
    static_assert((std::is_same<std::poi
 nter_traits<C<double> >::difference_type, std::ptrdiff_t>::value), "");
    static_assert((std::is_same<std::pointer_traits<D<int> >::difference_type, char>::value), "");
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <memory>
+
+// template <class Ptr>
+// struct pointer_traits
+// {
+//     typedef <details> difference_type;
+//     ...
+// };
+
+#include <memory>
+#include <type_traits>
+
+struct A
+{
+    typedef short element_type;
+    typedef char difference_type;
+};
+
+struct B
+{
+    typedef short element_type;
+};
+
+template <class T>
+struct C {};
+
+template <class T>
+struct D
+{
+    typedef char difference_type;
+};
+
+int main()
+{
+    static_assert((std::is_same<std::pointer_traits<A>::difference_type, char>::value), "");
+    static_assert((std::is_same<std::pointer_traits<B>::difference_type, std::ptrdiff_t>::value), "");
+    static_assert((std::is_same<std::pointer_traits<C<double> >::difference_type, std::ptrdiff_t>::value), "");
+    static_assert((std::is_same<std::pointer_traits<D<int> >::difference_type, char>::value), "");
+}

Modified: libcxx/trunk/test/utilities/memory/pointer.traits/pointer.traits.types/element_type.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/memory/pointer.traits/pointer.traits.types/element_type.pass.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/memory/pointer.traits/pointer.traits.types/element_type.pass.cpp (original)
+++ libcxx/trunk/test/utilities/memory/pointer.traits/pointer.traits.types/element_type.pass.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,49 @@
-//===----------------------------------------------------------------------===//
//
//                     The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//

// <memory>

// template <class Ptr>
// struct pointer_traits
// {
//     typedef <details> element_type;
//     ...
// };

#include <memory>
#include <type_traits>

struct A
{
    typedef char element_type;
};

template <class T>
struct B
{
    typedef char element_type;
};

template <class T>
struct C
{
};

template <class T, class U>
struct D
{
};

int main()
{
    static_assert((std::is_same<std::pointer_traits<A>::element_type, char>::value), "");
    static_assert((std::is_same<std::pointer_traits<B<int> >::element_type, char>::value), "");
    static_assert((std::is_same<std::pointer_traits<C<int> >::element_type, int>::value), "");
 
    static_assert((std::is_same<std::pointer_traits<D<double, int> >::element_type, double>::value), "");
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <memory>
+
+// template <class Ptr>
+// struct pointer_traits
+// {
+//     typedef <details> element_type;
+//     ...
+// };
+
+#include <memory>
+#include <type_traits>
+
+struct A
+{
+    typedef char element_type;
+};
+
+template <class T>
+struct B
+{
+    typedef char element_type;
+};
+
+template <class T>
+struct C
+{
+};
+
+template <class T, class U>
+struct D
+{
+};
+
+int main()
+{
+    static_assert((std::is_same<std::pointer_traits<A>::element_type, char>::value), "");
+    static_assert((std::is_same<std::pointer_traits<B<int> >::element_type, char>::value), "");
+    static_assert((std::is_same<std::pointer_traits<C<int> >::element_type, int>::value), "");
+    static_assert((std::is_same<std::pointer_traits<D<double, int> >::element_type, double>::value), "");
+}

Modified: libcxx/trunk/test/utilities/memory/pointer.traits/pointer.traits.types/rebind.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/memory/pointer.traits/pointer.traits.types/rebind.pass.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/memory/pointer.traits/pointer.traits.types/rebind.pass.cpp (original)
+++ libcxx/trunk/test/utilities/memory/pointer.traits/pointer.traits.types/rebind.pass.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,69 @@
-//===----------------------------------------------------------------------===//
//
//                     The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//

// <memory>

// template <class Ptr>
// struct pointer_traits
// {
//     template <class U> using rebind = <details>;
//     ...
// };

#include <memory>
#include <type_traits>

template <class T>
struct A
{
};

template <class T> struct B1 {};

template <class T>
struct B
{
#ifndef _LIBCPP_HAS_NO_TEMPLATE_ALIASES
    template <class U> using rebind = B1<U>;
#else
    template <class U> struct rebind {typedef B1<U> other;};
#endif
};

template <class T, class U>
struct C
{
};

template <class T, class U> struct D1 {};

template <class T, class U>
struct D
{
#ifndef _LIBCPP_HAS_NO_TEMPLATE_ALIASES
    template <class V> using rebind = D1<V
 , U>;
#else
    template <class V> struct rebind {typedef D1<V, U> other;};
#endif
};

int main()
{
#ifndef _LIBCPP_HAS_NO_TEMPLATE_ALIASES
    static_assert((std::is_same<std::pointer_traits<A<int*> >::rebind<double*>, A<double*> >::value), "");
    static_assert((std::is_same<std::pointer_traits<B<int> >::rebind<double>, B1<double> >::value), "");
    static_assert((std::is_same<std::pointer_traits<C<char, int> >::rebind<double>, C<double, int> >::value), "");
    static_assert((std::is_same<std::pointer_traits<D<char, int> >::rebind<double>, D1<double, int> >::value), "");
#else
    static_assert((std::is_same<std::pointer_traits<A<int*> >::rebind<double*>::other, A<double*> >::value), "");
    static_assert((std::is_same<std::pointer_traits<B<int> >::rebind<double>::other, B1<double> >::value), "");
    static_assert((std::is_same<std::pointer_traits<C<char, int> >::rebind<double>::other, C<double, int> >::value), "");
    static_assert((std::is_same<std::pointer_traits<
 D<char, int> >::rebind<double>::other, D1<double, int> >::value), "");
#endif
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <memory>
+
+// template <class Ptr>
+// struct pointer_traits
+// {
+//     template <class U> using rebind = <details>;
+//     ...
+// };
+
+#include <memory>
+#include <type_traits>
+
+template <class T>
+struct A
+{
+};
+
+template <class T> struct B1 {};
+
+template <class T>
+struct B
+{
+#ifndef _LIBCPP_HAS_NO_TEMPLATE_ALIASES
+    template <class U> using rebind = B1<U>;
+#else
+    template <class U> struct rebind {typedef B1<U> other;};
+#endif
+};
+
+template <class T, class U>
+struct C
+{
+};
+
+template <class T, class U> struct D1 {};
+
+template <class T, class U>
+struct D
+{
+#ifndef _LIBCPP_HAS_NO_TEMPLATE_ALIASES
+    template <class V> using rebind = D1<V, U>;
+#else
+    template <class V> struct rebind {typedef D1<V, U> other;};
+#endif
+};
+
+int main()
+{
+#ifndef _LIBCPP_HAS_NO_TEMPLATE_ALIASES
+    static_assert((std::is_same<std::pointer_traits<A<int*> >::rebind<double*>, A<double*> >::value), "");
+    static_assert((std::is_same<std::pointer_traits<B<int> >::rebind<double>, B1<double> >::value), "");
+    static_assert((std::is_same<std::pointer_traits<C<char, int> >::rebind<double>, C<double, int> >::value), "");
+    static_assert((std::is_same<std::pointer_traits<D<char, int> >::rebind<double>, D1<double, int> >::value), "");
+#else  // _LIBCPP_HAS_NO_TEMPLATE_ALIASES
+    static_assert((std::is_same<std::pointer_traits<A<int*> >::rebind<double*>::other, A<double*> >::value), "");
+    static_assert((std::is_same<std::pointer_traits<B<int> >::rebind<double>::other, B1<double> >::value), "");
+    static_assert((std::is_same<std::pointer_traits<C<char, int> >::rebind<double>::other, C<double, int> >::value), "");
+    static_assert((std::is_same<std::pointer_traits<D<char, int> >::rebind<double>::other, D1<double, int> >::value), "");
+#endif  // _LIBCPP_HAS_NO_TEMPLATE_ALIASES
+}

Modified: libcxx/trunk/test/utilities/memory/pointer.traits/pointer_to.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/memory/pointer.traits/pointer_to.pass.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/memory/pointer.traits/pointer_to.pass.cpp (original)
+++ libcxx/trunk/test/utilities/memory/pointer.traits/pointer_to.pass.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,32 @@
-//===----------------------------------------------------------------------===//
//
//                     The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//

// <memory>

// template <class T>
// struct pointer_traits<T*>
// {
//     static pointer pointer_to(<details>);
//     ...
// };

#include <memory>
#include <cassert>

int main()
{
    {
        int i = 0;
        int* a = std::pointer_traits<int*>::pointer_to(i);
        assert(a = &i);
    }
    {
        (std::pointer_traits<void*>::element_type)0;
    }
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <memory>
+
+// template <class T>
+// struct pointer_traits<T*>
+// {
+//     static pointer pointer_to(<details>);
+//     ...
+// };
+
+#include <memory>
+#include <cassert>
+
+int main()
+{
+    {
+        int i = 0;
+        int* a = std::pointer_traits<int*>::pointer_to(i);
+        assert(a = &i);
+    }
+    {
+        (std::pointer_traits<void*>::element_type)0;
+    }
+}

Modified: libcxx/trunk/test/utilities/memory/pointer.traits/rebind.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/memory/pointer.traits/rebind.pass.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/memory/pointer.traits/rebind.pass.cpp (original)
+++ libcxx/trunk/test/utilities/memory/pointer.traits/rebind.pass.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,29 @@
-//===----------------------------------------------------------------------===//
//
//                     The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//

// <memory>

// template <class T>
// struct pointer_traits<T*>
// {
//     template <class U> using rebind = U*;
//     ...
// };

#include <memory>
#include <type_traits>

int main()
{
#ifndef _LIBCPP_HAS_NO_TEMPLATE_ALIASES
    static_assert((std::is_same<std::pointer_traits<int*>::rebind<double>, double*>::value), "");
#else
    static_assert((std::is_same<std::pointer_traits<int*>::rebind<double>::other, double*>::value), "");
#endif
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <memory>
+
+// template <class T>
+// struct pointer_traits<T*>
+// {
+//     template <class U> using rebind = U*;
+//     ...
+// };
+
+#include <memory>
+#include <type_traits>
+
+int main()
+{
+#ifndef _LIBCPP_HAS_NO_TEMPLATE_ALIASES
+    static_assert((std::is_same<std::pointer_traits<int*>::rebind<double>, double*>::value), "");
+#else
+    static_assert((std::is_same<std::pointer_traits<int*>::rebind<double>::other, double*>::value), "");
+#endif
+}

Modified: libcxx/trunk/test/utilities/memory/specialized.algorithms/nothing_to_do.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/memory/specialized.algorithms/nothing_to_do.pass.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/memory/specialized.algorithms/nothing_to_do.pass.cpp (original)
+++ libcxx/trunk/test/utilities/memory/specialized.algorithms/nothing_to_do.pass.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,12 @@
-//===----------------------------------------------------------------------===//
//
//                     The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//

int main()
{
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+int main()
+{
+}

Modified: libcxx/trunk/test/utilities/memory/specialized.algorithms/specialized.addressof/addressof.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/memory/specialized.algorithms/specialized.addressof/addressof.pass.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/memory/specialized.algorithms/specialized.addressof/addressof.pass.cpp (original)
+++ libcxx/trunk/test/utilities/memory/specialized.algorithms/specialized.addressof/addressof.pass.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,33 @@
-//===----------------------------------------------------------------------===//
//
//                     The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//

// <memory>

// template <ObjectType T> T* addressof(T& r);

#include <memory>
#include <cassert>

struct A
{
    void operator&() const {}
};

int main()
{
    int i;
    double d;
    assert(std::addressof(i) == &i);
    assert(std::addressof(d) == &d);
    A* tp = new A;
    const A* ctp = tp;
    assert(std::addressof(*tp) == tp);
    assert(std::addressof(*ctp) == tp);
    delete tp;
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <memory>
+
+// template <ObjectType T> T* addressof(T& r);
+
+#include <memory>
+#include <cassert>
+
+struct A
+{
+    void operator&() const {}
+};
+
+int main()
+{
+    int i;
+    double d;
+    assert(std::addressof(i) == &i);
+    assert(std::addressof(d) == &d);
+    A* tp = new A;
+    const A* ctp = tp;
+    assert(std::addressof(*tp) == tp);
+    assert(std::addressof(*ctp) == tp);
+    delete tp;
+}

Modified: libcxx/trunk/test/utilities/memory/specialized.algorithms/uninitialized.copy/uninitialized_copy.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/memory/specialized.algorithms/uninitialized.copy/uninitialized_copy.pass.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/memory/specialized.algorithms/uninitialized.copy/uninitialized_copy.pass.cpp (original)
+++ libcxx/trunk/test/utilities/memory/specialized.algorithms/uninitialized.copy/uninitialized_copy.pass.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,51 @@
-//===----------------------------------------------------------------------===//
//
//                     The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//

// <memory>

// template <class InputIterator, class ForwardIterator> 
//   ForwardIterator
//   uninitialized_copy(InputIterator first, InputIterator last,
//                      ForwardIterator result);

#include <memory>
#include <cassert>

struct B
{
    static int count_;
    int data_;
    explicit B() : data_(1) {}
    B(const B& b) {if (++count_ == 3) throw 1; data_ = b.data_;}
    ~B() {data_ = 0;}
};

int B::count_ = 0;

int main()
{
    const int N = 5;
    char pool[sizeof(B)*N] = {0};
    B* bp = (B*)pool;
    B b[N];
    try
    {
        std::uninitialized_copy(b, b+N, bp);
        assert(false);
    }
    catch (...)
    {
 
        for (int i = 0; i < N; ++i)
            assert(bp[i].data_ == 0);
    }
    B::count_ = 0;
    std::uninitialized_copy(b, b+2, bp);
    for (int i = 0; i < 2; ++i)
        assert(bp[i].data_ == 1);
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <memory>
+
+// template <class InputIterator, class ForwardIterator>
+//   ForwardIterator
+//   uninitialized_copy(InputIterator first, InputIterator last,
+//                      ForwardIterator result);
+
+#include <memory>
+#include <cassert>
+
+struct B
+{
+    static int count_;
+    int data_;
+    explicit B() : data_(1) {}
+    B(const B& b) {if (++count_ == 3) throw 1; data_ = b.data_;}
+    ~B() {data_ = 0;}
+};
+
+int B::count_ = 0;
+
+int main()
+{
+    const int N = 5;
+    char pool[sizeof(B)*N] = {0};
+    B* bp = (B*)pool;
+    B b[N];
+    try
+    {
+        std::uninitialized_copy(b, b+N, bp);
+        assert(false);
+    }
+    catch (...)
+    {
+        for (int i = 0; i < N; ++i)
+            assert(bp[i].data_ == 0);
+    }
+    B::count_ = 0;
+    std::uninitialized_copy(b, b+2, bp);
+    for (int i = 0; i < 2; ++i)
+        assert(bp[i].data_ == 1);
+}

Modified: libcxx/trunk/test/utilities/memory/specialized.algorithms/uninitialized.copy/uninitialized_copy_n.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/memory/specialized.algorithms/uninitialized.copy/uninitialized_copy_n.pass.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/memory/specialized.algorithms/uninitialized.copy/uninitialized_copy_n.pass.cpp (original)
+++ libcxx/trunk/test/utilities/memory/specialized.algorithms/uninitialized.copy/uninitialized_copy_n.pass.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,51 @@
-//===----------------------------------------------------------------------===//
//
//                     The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//

// <memory>

// template <class InputIterator, class Size, class ForwardIterator> 
//   ForwardIterator
//   uninitialized_copy_n(InputIterator first, Size n, 
//                        ForwardIterator result);

#include <memory>
#include <cassert>

struct B
{
    static int count_;
    int data_;
    explicit B() : data_(1) {}
    B(const B& b) {if (++count_ == 3) throw 1; data_ = b.data_;}
    ~B() {data_ = 0;}
};

int B::count_ = 0;

int main()
{
    const int N = 5;
    char pool[sizeof(B)*N] = {0};
    B* bp = (B*)pool;
    B b[N];
    try
    {
        std::uninitialized_copy_n(b, 5, bp);
        assert(false);
    }
    catch (...)
     {
        for (int i = 0; i < N; ++i)
            assert(bp[i].data_ == 0);
    }
    B::count_ = 0;
    std::uninitialized_copy_n(b, 2, bp);
    for (int i = 0; i < 2; ++i)
        assert(bp[i].data_ == 1);
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <memory>
+
+// template <class InputIterator, class Size, class ForwardIterator>
+//   ForwardIterator
+//   uninitialized_copy_n(InputIterator first, Size n,
+//                        ForwardIterator result);
+
+#include <memory>
+#include <cassert>
+
+struct B
+{
+    static int count_;
+    int data_;
+    explicit B() : data_(1) {}
+    B(const B& b) {if (++count_ == 3) throw 1; data_ = b.data_;}
+    ~B() {data_ = 0;}
+};
+
+int B::count_ = 0;
+
+int main()
+{
+    const int N = 5;
+    char pool[sizeof(B)*N] = {0};
+    B* bp = (B*)pool;
+    B b[N];
+    try
+    {
+        std::uninitialized_copy_n(b, 5, bp);
+        assert(false);
+    }
+    catch (...)
+    {
+        for (int i = 0; i < N; ++i)
+            assert(bp[i].data_ == 0);
+    }
+    B::count_ = 0;
+    std::uninitialized_copy_n(b, 2, bp);
+    for (int i = 0; i < 2; ++i)
+        assert(bp[i].data_ == 1);
+}

Modified: libcxx/trunk/test/utilities/memory/specialized.algorithms/uninitialized.fill.n/uninitialized_fill_n.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/memory/specialized.algorithms/uninitialized.fill.n/uninitialized_fill_n.pass.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/memory/specialized.algorithms/uninitialized.fill.n/uninitialized_fill_n.pass.cpp (original)
+++ libcxx/trunk/test/utilities/memory/specialized.algorithms/uninitialized.fill.n/uninitialized_fill_n.pass.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,49 @@
-//===----------------------------------------------------------------------===//
//
//                     The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//

// <memory>

// template <class ForwardIterator, class Size, class T> 
//   void
//   uninitialized_fill_n(ForwardIterator first, Size n, const T& x);

#include <memory>
#include <cassert>

struct B
{
    static int count_;
    int data_;
    explicit B() : data_(1) {}
    B(const B& b) {if (++count_ == 3) throw 1; data_ = b.data_;}
    ~B() {data_ = 0;}
};

int B::count_ = 0;

int main()
{
    const int N = 5;
    char pool[sizeof(B)*N] = {0};
    B* bp = (B*)pool;
    try
    {
        std::uninitialized_fill_n(bp, 5, B());
        assert(false);
    }
    catch (...)
    {
        for (int i = 0; i < N; ++i)
            assert(bp[i].dat
 a_ == 0);
    }
    B::count_ = 0;
    std::uninitialized_fill_n(bp, 2, B());
    for (int i = 0; i < 2; ++i)
        assert(bp[i].data_ == 1);
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <memory>
+
+// template <class ForwardIterator, class Size, class T>
+//   void
+//   uninitialized_fill_n(ForwardIterator first, Size n, const T& x);
+
+#include <memory>
+#include <cassert>
+
+struct B
+{
+    static int count_;
+    int data_;
+    explicit B() : data_(1) {}
+    B(const B& b) {if (++count_ == 3) throw 1; data_ = b.data_;}
+    ~B() {data_ = 0;}
+};
+
+int B::count_ = 0;
+
+int main()
+{
+    const int N = 5;
+    char pool[sizeof(B)*N] = {0};
+    B* bp = (B*)pool;
+    try
+    {
+        std::uninitialized_fill_n(bp, 5, B());
+        assert(false);
+    }
+    catch (...)
+    {
+        for (int i = 0; i < N; ++i)
+            assert(bp[i].data_ == 0);
+    }
+    B::count_ = 0;
+    std::uninitialized_fill_n(bp, 2, B());
+    for (int i = 0; i < 2; ++i)
+        assert(bp[i].data_ == 1);
+}

Modified: libcxx/trunk/test/utilities/memory/specialized.algorithms/uninitialized.fill/uninitialized_fill.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/memory/specialized.algorithms/uninitialized.fill/uninitialized_fill.pass.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/memory/specialized.algorithms/uninitialized.fill/uninitialized_fill.pass.cpp (original)
+++ libcxx/trunk/test/utilities/memory/specialized.algorithms/uninitialized.fill/uninitialized_fill.pass.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,50 @@
-//===----------------------------------------------------------------------===//
//
//                     The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//

// <memory>

// template <class ForwardIterator, class T> 
//   void
//   uninitialized_fill(ForwardIterator first, ForwardIterator last, 
//                      const T& x);

#include <memory>
#include <cassert>

struct B
{
    static int count_;
    int data_;
    explicit B() : data_(1) {}
    B(const B& b) {if (++count_ == 3) throw 1; data_ = b.data_;}
    ~B() {data_ = 0;}
};

int B::count_ = 0;

int main()
{
    const int N = 5;
    char pool[sizeof(B)*N] = {0};
    B* bp = (B*)pool;
    try
    {
        std::uninitialized_fill(bp, bp+N, B());
        assert(false);
    }
    catch (...)
    {
        for (int i = 0; i < N; ++i)
  
           assert(bp[i].data_ == 0);
    }
    B::count_ = 0;
    std::uninitialized_fill(bp, bp+2, B());
    for (int i = 0; i < 2; ++i)
        assert(bp[i].data_ == 1);
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <memory>
+
+// template <class ForwardIterator, class T>
+//   void
+//   uninitialized_fill(ForwardIterator first, ForwardIterator last,
+//                      const T& x);
+
+#include <memory>
+#include <cassert>
+
+struct B
+{
+    static int count_;
+    int data_;
+    explicit B() : data_(1) {}
+    B(const B& b) {if (++count_ == 3) throw 1; data_ = b.data_;}
+    ~B() {data_ = 0;}
+};
+
+int B::count_ = 0;
+
+int main()
+{
+    const int N = 5;
+    char pool[sizeof(B)*N] = {0};
+    B* bp = (B*)pool;
+    try
+    {
+        std::uninitialized_fill(bp, bp+N, B());
+        assert(false);
+    }
+    catch (...)
+    {
+        for (int i = 0; i < N; ++i)
+            assert(bp[i].data_ == 0);
+    }
+    B::count_ = 0;
+    std::uninitialized_fill(bp, bp+2, B());
+    for (int i = 0; i < 2; ++i)
+        assert(bp[i].data_ == 1);
+}

Modified: libcxx/trunk/test/utilities/memory/storage.iterator/raw_storag_iterator.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/memory/storage.iterator/raw_storag_iterator.pass.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/memory/storage.iterator/raw_storag_iterator.pass.cpp (original)
+++ libcxx/trunk/test/utilities/memory/storage.iterator/raw_storag_iterator.pass.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,44 @@
-//===----------------------------------------------------------------------===//
//
//                     The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//

// raw_storage_iterator

#include <memory>
#include <type_traits>
#include <cassert>

int A_constructed = 0;

struct A
{
    int data_;
public:
    explicit A(int i) : data_(i) {++A_constructed;}

    A(const A& a) : data_(a.data_)  {++A_constructed;}
    ~A() {--A_constructed; data_ = 0;}

    bool operator==(int i) const {return data_ == i;}
};

int main()
{
    typedef std::aligned_storage<3*sizeof(A), std::alignment_of<A>::value>::type
            Storage;
    Storage buffer;
    std::raw_storage_iterator<A*, A> it((A*)&buffer);
    assert(A_constructed == 0);
    for (int i = 0; i < 3; ++i)
    {
        *it++ = A(i+1);
        A* ap 
 = (A*)&buffer + i;
        assert(*ap == i+1);
        assert(A_constructed == i+1);
    }
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// raw_storage_iterator
+
+#include <memory>
+#include <type_traits>
+#include <cassert>
+
+int A_constructed = 0;
+
+struct A
+{
+    int data_;
+public:
+    explicit A(int i) : data_(i) {++A_constructed;}
+
+    A(const A& a) : data_(a.data_)  {++A_constructed;}
+    ~A() {--A_constructed; data_ = 0;}
+
+    bool operator==(int i) const {return data_ == i;}
+};
+
+int main()
+{
+    typedef std::aligned_storage<3*sizeof(A), std::alignment_of<A>::value>::type
+            Storage;
+    Storage buffer;
+    std::raw_storage_iterator<A*, A> it((A*)&buffer);
+    assert(A_constructed == 0);
+    for (int i = 0; i < 3; ++i)
+    {
+        *it++ = A(i+1);
+        A* ap = (A*)&buffer + i;
+        assert(*ap == i+1);
+        assert(A_constructed == i+1);
+    }
+}

Modified: libcxx/trunk/test/utilities/memory/temporary.buffer/temporary_buffer.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/memory/temporary.buffer/temporary_buffer.pass.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/memory/temporary.buffer/temporary_buffer.pass.cpp (original)
+++ libcxx/trunk/test/utilities/memory/temporary.buffer/temporary_buffer.pass.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,29 @@
-//===----------------------------------------------------------------------===//
//
//                     The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//

// <memory>

// template <class T> 
//   pair<T*, ptrdiff_t>
//   get_temporary_buffer(ptrdiff_t n);
// 
// template <class T>
//   void
//   return_temporary_buffer(T* p);

#include <memory>
#include <cassert>

int main()
{
    std::pair<int*, std::ptrdiff_t> ip = std::get_temporary_buffer<int>(5);
    assert(ip.first);
    assert(ip.second == 5);
    std::return_temporary_buffer(ip.first);
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <memory>
+
+// template <class T>
+//   pair<T*, ptrdiff_t>
+//   get_temporary_buffer(ptrdiff_t n);
+//
+// template <class T>
+//   void
+//   return_temporary_buffer(T* p);
+
+#include <memory>
+#include <cassert>
+
+int main()
+{
+    std::pair<int*, std::ptrdiff_t> ip = std::get_temporary_buffer<int>(5);
+    assert(ip.first);
+    assert(ip.second == 5);
+    std::return_temporary_buffer(ip.first);
+}

Modified: libcxx/trunk/test/utilities/memory/unique.ptr/deleter.h
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/memory/unique.ptr/deleter.h?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/memory/unique.ptr/deleter.h (original)
+++ libcxx/trunk/test/utilities/memory/unique.ptr/deleter.h Sat Aug 21 19:59:46 2010
@@ -1 +1,181 @@
-//===----------------------------------------------------------------------===//
//
//                     The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//

// <memory>

// unique_ptr

// Example move-only deleter

#ifndef DELETER_H
#define DELETER_H

#include <type_traits>
#include <cassert>

template <class T>
class Deleter
{
    int state_;

#ifdef _LIBCPP_MOVE
    Deleter(const Deleter&);
    Deleter& operator=(const Deleter&);
#else
    Deleter(Deleter&);
    Deleter& operator=(Deleter&);
#endif

public:
#ifdef _LIBCPP_MOVE
    Deleter(Deleter&& r) : state_(r.state_) {r.state_ = 0;}
    Deleter& operator=(Deleter&& r)
    {
        state_ = r.state_;
        r.state_ = 0;
        return *this;
    }
#else
    operator std::__rv<Deleter>() {return std::__rv<Deleter>(*this);}
    Deleter(st
 d::__rv<Deleter> r) : state_(r->state_) {r->state_ = 0;}
    Deleter& operator=(std::__rv<Deleter> r)
    {
        state_ = r->state_;
        r->state_ = 0;
        return *this;
    }
#endif

    Deleter() : state_(0) {}
    explicit Deleter(int s) : state_(s) {}
    ~Deleter() {assert(state_ >= 0); state_ = -1;}

#ifdef _LIBCPP_MOVE
    template <class U>
        Deleter(Deleter<U>&& d,
            typename std::enable_if<!std::is_same<U, T>::value>::type* = 0)
            : state_(d.state()) {d.set_state(0);}

private:
    template <class U>
        Deleter(const Deleter<U>& d,
            typename std::enable_if<!std::is_same<U, T>::value>::type* = 0);
#else
    template <class U>
        Deleter(Deleter<U> d,
            typename std::enable_if<!std::is_same<U, T>::value>::type* = 0)
            : state_(d.state()) {}
#endif
public:
    int state() const {return state_;}
    void set_state(int i) {state_ = i;}

    void operator()(T* p) {delete p;}
};

template <class
  T>
class Deleter<T[]>
{
    int state_;

#ifdef _LIBCPP_MOVE
    Deleter(const Deleter&);
    Deleter& operator=(const Deleter&);
#else
    Deleter(Deleter&);
    Deleter& operator=(Deleter&);
#endif

public:
#ifdef _LIBCPP_MOVE
    Deleter(Deleter&& r) : state_(r.state_) {r.state_ = 0;}
    Deleter& operator=(Deleter&& r)
    {
        state_ = r.state_;
        r.state_ = 0;
        return *this;
    }
#else
    operator std::__rv<Deleter>() {return std::__rv<Deleter>(*this);}
    Deleter(std::__rv<Deleter> r) : state_(r->state_) {r->state_ = 0;}
    Deleter& operator=(std::__rv<Deleter> r)
    {
        state_ = r->state_;
        r->state_ = 0;
        return *this;
    }
#endif

    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;}
};

template <class T>
void
swap(Deleter<T>& x, De
 leter<T>& y)
{
    Deleter<T> t(std::move(x));
    x = std::move(y);
    y = std::move(t);
}

template <class T>
class CDeleter
{
    int state_;

public:

    CDeleter() : state_(0) {}
    explicit CDeleter(int s) : state_(s) {}
    ~CDeleter() {assert(state_ >= 0); state_ = -1;}

    template <class U>
        CDeleter(const CDeleter<U>& d)
            : state_(d.state()) {}

    int state() const {return state_;}
    void set_state(int i) {state_ = i;}

    void operator()(T* p) {delete p;}
};

template <class T>
class CDeleter<T[]>
{
    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 <class T>
void
swap(CDeleter<T>& x, CDeleter<T>& y)
{
    CDeleter<T> t(std::move(x));
    x = std::move(y);
    y = std::move(t);
}

#endif
\ No newline at end of file
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <memory>
+
+// unique_ptr
+
+// Example move-only deleter
+
+#ifndef DELETER_H
+#define DELETER_H
+
+#include <type_traits>
+#include <cassert>
+
+template <class T>
+class Deleter
+{
+    int state_;
+
+#ifdef _LIBCPP_MOVE
+    Deleter(const Deleter&);
+    Deleter& operator=(const Deleter&);
+#else  // _LIBCPP_MOVE
+    Deleter(Deleter&);
+    Deleter& operator=(Deleter&);
+#endif  // _LIBCPP_MOVE
+
+public:
+#ifdef _LIBCPP_MOVE
+    Deleter(Deleter&& r) : state_(r.state_) {r.state_ = 0;}
+    Deleter& operator=(Deleter&& r)
+    {
+        state_ = r.state_;
+        r.state_ = 0;
+        return *this;
+    }
+#else  // _LIBCPP_MOVE
+    operator std::__rv<Deleter>() {return std::__rv<Deleter>(*this);}
+    Deleter(std::__rv<Deleter> r) : state_(r->state_) {r->state_ = 0;}
+    Deleter& operator=(std::__rv<Deleter> r)
+    {
+        state_ = r->state_;
+        r->state_ = 0;
+        return *this;
+    }
+#endif  // _LIBCPP_MOVE
+
+    Deleter() : state_(0) {}
+    explicit Deleter(int s) : state_(s) {}
+    ~Deleter() {assert(state_ >= 0); state_ = -1;}
+
+#ifdef _LIBCPP_MOVE
+    template <class U>
+        Deleter(Deleter<U>&& d,
+            typename std::enable_if<!std::is_same<U, T>::value>::type* = 0)
+            : state_(d.state()) {d.set_state(0);}
+
+private:
+    template <class U>
+        Deleter(const Deleter<U>& d,
+            typename std::enable_if<!std::is_same<U, T>::value>::type* = 0);
+#else  // _LIBCPP_MOVE
+    template <class U>
+        Deleter(Deleter<U> d,
+            typename std::enable_if<!std::is_same<U, T>::value>::type* = 0)
+            : state_(d.state()) {}
+#endif  // _LIBCPP_MOVE
+public:
+    int state() const {return state_;}
+    void set_state(int i) {state_ = i;}
+
+    void operator()(T* p) {delete p;}
+};
+
+template <class T>
+class Deleter<T[]>
+{
+    int state_;
+
+#ifdef _LIBCPP_MOVE
+    Deleter(const Deleter&);
+    Deleter& operator=(const Deleter&);
+#else  // _LIBCPP_MOVE
+    Deleter(Deleter&);
+    Deleter& operator=(Deleter&);
+#endif  // _LIBCPP_MOVE
+
+public:
+#ifdef _LIBCPP_MOVE
+    Deleter(Deleter&& r) : state_(r.state_) {r.state_ = 0;}
+    Deleter& operator=(Deleter&& r)
+    {
+        state_ = r.state_;
+        r.state_ = 0;
+        return *this;
+    }
+#else  // _LIBCPP_MOVE
+    operator std::__rv<Deleter>() {return std::__rv<Deleter>(*this);}
+    Deleter(std::__rv<Deleter> r) : state_(r->state_) {r->state_ = 0;}
+    Deleter& operator=(std::__rv<Deleter> r)
+    {
+        state_ = r->state_;
+        r->state_ = 0;
+        return *this;
+    }
+#endif  // _LIBCPP_MOVE
+
+    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;}
+};
+
+template <class T>
+void
+swap(Deleter<T>& x, Deleter<T>& y)
+{
+    Deleter<T> t(std::move(x));
+    x = std::move(y);
+    y = std::move(t);
+}
+
+template <class T>
+class CDeleter
+{
+    int state_;
+
+public:
+
+    CDeleter() : state_(0) {}
+    explicit CDeleter(int s) : state_(s) {}
+    ~CDeleter() {assert(state_ >= 0); state_ = -1;}
+
+    template <class U>
+        CDeleter(const CDeleter<U>& d)
+            : state_(d.state()) {}
+
+    int state() const {return state_;}
+    void set_state(int i) {state_ = i;}
+
+    void operator()(T* p) {delete p;}
+};
+
+template <class T>
+class CDeleter<T[]>
+{
+    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 <class T>
+void
+swap(CDeleter<T>& x, CDeleter<T>& y)
+{
+    CDeleter<T> t(std::move(x));
+    x = std::move(y);
+    y = std::move(t);
+}
+
+#endif  // DELETER_H

Modified: libcxx/trunk/test/utilities/memory/unique.ptr/nothing_to_do.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/memory/unique.ptr/nothing_to_do.pass.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/memory/unique.ptr/nothing_to_do.pass.cpp (original)
+++ libcxx/trunk/test/utilities/memory/unique.ptr/nothing_to_do.pass.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,12 @@
-//===----------------------------------------------------------------------===//
//
//                     The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//

int main()
{
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+int main()
+{
+}

Modified: libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.dltr/nothing_to_do.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.dltr/nothing_to_do.pass.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.dltr/nothing_to_do.pass.cpp (original)
+++ libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.dltr/nothing_to_do.pass.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,12 @@
-//===----------------------------------------------------------------------===//
//
//                     The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//

int main()
{
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+int main()
+{
+}

Modified: libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.dltr/unique.ptr.dltr.dflt/convert_ctor.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.dltr/unique.ptr.dltr.dflt/convert_ctor.pass.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.dltr/unique.ptr.dltr.dflt/convert_ctor.pass.cpp (original)
+++ libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.dltr/unique.ptr.dltr.dflt/convert_ctor.pass.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,48 @@
-//===----------------------------------------------------------------------===//
//
//                     The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//

// <memory>

// default_delete

#include <memory>
#include <cassert>

struct A
{
    static int count;
    A() {++count;}
    A(const A&) {++count;}
    virtual ~A() {--count;}
};

int A::count = 0;

struct B
    : public A
{
    static int count;
    B() {++count;}
    B(const B&) {++count;}
    virtual ~B() {--count;}
};

int B::count = 0;

int main()
{
    std::default_delete<B> d2;
    std::default_delete<A> d1 = d2;
    A* p = new B;
    assert(A::count == 1);
    assert(B::count == 1);
    d1(p);
    assert(A::count == 0);
    assert(B::count == 0);
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <memory>
+
+// default_delete
+
+#include <memory>
+#include <cassert>
+
+struct A
+{
+    static int count;
+    A() {++count;}
+    A(const A&) {++count;}
+    virtual ~A() {--count;}
+};
+
+int A::count = 0;
+
+struct B
+    : public A
+{
+    static int count;
+    B() {++count;}
+    B(const B&) {++count;}
+    virtual ~B() {--count;}
+};
+
+int B::count = 0;
+
+int main()
+{
+    std::default_delete<B> d2;
+    std::default_delete<A> d1 = d2;
+    A* p = new B;
+    assert(A::count == 1);
+    assert(B::count == 1);
+    d1(p);
+    assert(A::count == 0);
+    assert(B::count == 0);
+}

Modified: libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.dltr/unique.ptr.dltr.dflt/default.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.dltr/unique.ptr.dltr.dflt/default.pass.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.dltr/unique.ptr.dltr.dflt/default.pass.cpp (original)
+++ libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.dltr/unique.ptr.dltr.dflt/default.pass.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,34 @@
-//===----------------------------------------------------------------------===//
//
//                     The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//

// <memory>

// default_delete

#include <memory>
#include <cassert>

struct A
{
    static int count;
    A() {++count;}
    A(const A&) {++count;}
    ~A() {--count;}
};

int A::count = 0;

int main()
{
    std::default_delete<A> d;
    A* p = new A;
    assert(A::count == 1);
    d(p);
    assert(A::count == 0);
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <memory>
+
+// default_delete
+
+#include <memory>
+#include <cassert>
+
+struct A
+{
+    static int count;
+    A() {++count;}
+    A(const A&) {++count;}
+    ~A() {--count;}
+};
+
+int A::count = 0;
+
+int main()
+{
+    std::default_delete<A> d;
+    A* p = new A;
+    assert(A::count == 1);
+    d(p);
+    assert(A::count == 0);
+}

Modified: libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.dltr/unique.ptr.dltr.dflt/incomplete.fail.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.dltr/unique.ptr.dltr.dflt/incomplete.fail.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.dltr/unique.ptr.dltr.dflt/incomplete.fail.cpp (original)
+++ libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.dltr/unique.ptr.dltr.dflt/incomplete.fail.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,26 @@
-//===----------------------------------------------------------------------===//
//
//                     The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//

// <memory>

// default_delete

// Test that default_delete's operator() requires a complete type

#include <memory>
#include <cassert>

struct A;

int main()
{
    std::default_delete<A> d;
    A* p = 0;
    d(p);
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <memory>
+
+// default_delete
+
+// Test that default_delete's operator() requires a complete type
+
+#include <memory>
+#include <cassert>
+
+struct A;
+
+int main()
+{
+    std::default_delete<A> d;
+    A* p = 0;
+    d(p);
+}

Modified: libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.dltr/unique.ptr.dltr.dflt1/convert_ctor.fail.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.dltr/unique.ptr.dltr.dflt1/convert_ctor.fail.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.dltr/unique.ptr.dltr.dflt1/convert_ctor.fail.cpp (original)
+++ libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.dltr/unique.ptr.dltr.dflt1/convert_ctor.fail.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,32 @@
-//===----------------------------------------------------------------------===//
//
//                     The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//

// <memory>

// default_delete

// Test that default_delete<T[]> does not have a working converting constructor

#include <memory>
#include <cassert>

struct A
{
};

struct B
    : public A
{
};

int main()
{
    std::default_delete<B[]> d2;
    std::default_delete<A[]> d1 = d2;
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <memory>
+
+// default_delete
+
+// Test that default_delete<T[]> does not have a working converting constructor
+
+#include <memory>
+#include <cassert>
+
+struct A
+{
+};
+
+struct B
+    : public A
+{
+};
+
+int main()
+{
+    std::default_delete<B[]> d2;
+    std::default_delete<A[]> d1 = d2;
+}

Modified: libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.dltr/unique.ptr.dltr.dflt1/default.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.dltr/unique.ptr.dltr.dflt1/default.pass.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.dltr/unique.ptr.dltr.dflt1/default.pass.cpp (original)
+++ libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.dltr/unique.ptr.dltr.dflt1/default.pass.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,36 @@
-//===----------------------------------------------------------------------===//
//
//                     The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//

// <memory>

// default_delete

// Test that default_delete<T[]> has a working default constructor

#include <memory>
#include <cassert>

struct A
{
    static int count;
    A() {++count;}
    A(const A&) {++count;}
    ~A() {--count;}
};

int A::count = 0;

int main()
{
    std::default_delete<A[]> d;
    A* p = new A[3];
    assert(A::count == 3);
    d(p);
    assert(A::count == 0);
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <memory>
+
+// default_delete
+
+// Test that default_delete<T[]> has a working default constructor
+
+#include <memory>
+#include <cassert>
+
+struct A
+{
+    static int count;
+    A() {++count;}
+    A(const A&) {++count;}
+    ~A() {--count;}
+};
+
+int A::count = 0;
+
+int main()
+{
+    std::default_delete<A[]> d;
+    A* p = new A[3];
+    assert(A::count == 3);
+    d(p);
+    assert(A::count == 0);
+}

Modified: libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.dltr/unique.ptr.dltr.dflt1/incomplete.fail.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.dltr/unique.ptr.dltr.dflt1/incomplete.fail.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.dltr/unique.ptr.dltr.dflt1/incomplete.fail.cpp (original)
+++ libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.dltr/unique.ptr.dltr.dflt1/incomplete.fail.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,26 @@
-//===----------------------------------------------------------------------===//
//
//                     The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//

// <memory>

// default_delete

// Test that default_delete<T[]>'s operator() requires a complete type

#include <memory>
#include <cassert>

struct A;

int main()
{
    std::default_delete<A[]> d;
    A* p = 0;
    d(p);
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <memory>
+
+// default_delete
+
+// Test that default_delete<T[]>'s operator() requires a complete type
+
+#include <memory>
+#include <cassert>
+
+struct A;
+
+int main()
+{
+    std::default_delete<A[]> d;
+    A* p = 0;
+    d(p);
+}

Modified: libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.dltr/unique.ptr.dltr.general/nothing_to_do.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.dltr/unique.ptr.dltr.general/nothing_to_do.pass.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.dltr/unique.ptr.dltr.general/nothing_to_do.pass.cpp (original)
+++ libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.dltr/unique.ptr.dltr.general/nothing_to_do.pass.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,12 @@
-//===----------------------------------------------------------------------===//
//
//                     The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//

int main()
{
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+int main()
+{
+}

Modified: libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/move01.fail.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/move01.fail.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/move01.fail.cpp (original)
+++ libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/move01.fail.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,38 @@
-//===----------------------------------------------------------------------===//
//
//                     The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//

// <memory>

// unique_ptr

// Test unique_ptr move assignment

#include <memory>
#include <cassert>

// Can't copy from lvalue

struct A
{
    static int count;
    A() {++count;}
    A(const A&) {++count;}
    ~A() {--count;}
};

int A::count = 0;

int main()
{
    {
    std::unique_ptr<A> s(new A);
    std::unique_ptr<A> s2;
    s2 = s;
    }
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <memory>
+
+// unique_ptr
+
+// Test unique_ptr move assignment
+
+#include <memory>
+#include <cassert>
+
+// Can't copy from lvalue
+
+struct A
+{
+    static int count;
+    A() {++count;}
+    A(const A&) {++count;}
+    ~A() {--count;}
+};
+
+int A::count = 0;
+
+int main()
+{
+    {
+    std::unique_ptr<A> s(new A);
+    std::unique_ptr<A> s2;
+    s2 = s;
+    }
+}

Modified: libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/move01.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/move01.pass.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/move01.pass.cpp (original)
+++ libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/move01.pass.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,78 @@
-//===----------------------------------------------------------------------===//
//
//                     The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//

// <memory>

// 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 <memory>
#include <cassert>

#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<A[]> s1(new A[3]);
    A* p = s1.get();
    assert(A::count == 3);
    std::unique_ptr<A[]> 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<A[], Deleter<A[]> > s1(new A[4], Deleter<A[]>(5));
    A* p = s1.get();
    assert(A::count == 4);
    std::unique_ptr<A[], Deleter<A[]> > 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<A[]> d1(5);
    std::unique_ptr<A[], CDeleter<A[]>&> s1(new A[6], d1);
    A* p = s1.get();
    assert(A::count == 6);
    CDeleter<A[]> d2(6);
    std::unique_ptr<A[], CDeleter<A[]>&> 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);
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <memory>
+
+// 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 <memory>
+#include <cassert>
+
+#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<A[]> s1(new A[3]);
+    A* p = s1.get();
+    assert(A::count == 3);
+    std::unique_ptr<A[]> 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<A[], Deleter<A[]> > s1(new A[4], Deleter<A[]>(5));
+    A* p = s1.get();
+    assert(A::count == 4);
+    std::unique_ptr<A[], Deleter<A[]> > 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<A[]> d1(5);
+    std::unique_ptr<A[], CDeleter<A[]>&> s1(new A[6], d1);
+    A* p = s1.get();
+    assert(A::count == 6);
+    CDeleter<A[]> d2(6);
+    std::unique_ptr<A[], CDeleter<A[]>&> 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);
+}

Modified: libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/move02.fail.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/move02.fail.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/move02.fail.cpp (original)
+++ libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/move02.fail.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,38 @@
-//===----------------------------------------------------------------------===//
//
//                     The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//

// <memory>

// unique_ptr

// Test unique_ptr move assignment

#include <memory>
#include <cassert>

// Can't copy from const lvalue

struct A
{
    static int count;
    A() {++count;}
    A(const A&) {++count;}
    ~A() {--count;}
};

int A::count = 0;

int main()
{
    {
    const std::unique_ptr<A[]> s(new A[3]);
    std::unique_ptr<A[]> s2;
    s2 = s;
    }
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <memory>
+
+// unique_ptr
+
+// Test unique_ptr move assignment
+
+#include <memory>
+#include <cassert>
+
+// Can't copy from const lvalue
+
+struct A
+{
+    static int count;
+    A() {++count;}
+    A(const A&) {++count;}
+    ~A() {--count;}
+};
+
+int A::count = 0;
+
+int main()
+{
+    {
+    const std::unique_ptr<A[]> s(new A[3]);
+    std::unique_ptr<A[]> s2;
+    s2 = s;
+    }
+}

Modified: libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/move03.fail.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/move03.fail.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/move03.fail.cpp (original)
+++ libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/move03.fail.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,56 @@
-//===----------------------------------------------------------------------===//
//
//                     The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//

// <memory>

// unique_ptr

// Test unique_ptr move assignment

#include <memory>
#include <cassert>

// Can't copy from lvalue

struct A
{
    static int count;
    A() {++count;}
    A(const A&) {++count;}
    ~A() {--count;}
};

int A::count = 0;

class Deleter
{
    int state_;

public:

    Deleter() : state_(5) {}

    int state() const {return state_;}

    void operator()(A* p) {delete p;}
};

int main()
{
    {
    std::unique_ptr<A, Deleter> s(new A);
    A* p = s.get();
    std::unique_ptr<A, Deleter> s2;
    s2 = s;
    assert(s2.get() == p);
    assert(s.get() == 0);
    assert(A::count == 1);
    }
    assert(A::count == 0);
 }
\ No newline at end of file
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <memory>
+
+// unique_ptr
+
+// Test unique_ptr move assignment
+
+#include <memory>
+#include <cassert>
+
+// Can't copy from lvalue
+
+struct A
+{
+    static int count;
+    A() {++count;}
+    A(const A&) {++count;}
+    ~A() {--count;}
+};
+
+int A::count = 0;
+
+class Deleter
+{
+    int state_;
+
+public:
+
+    Deleter() : state_(5) {}
+
+    int state() const {return state_;}
+
+    void operator()(A* p) {delete p;}
+};
+
+int main()
+{
+    {
+    std::unique_ptr<A, Deleter> s(new A);
+    A* p = s.get();
+    std::unique_ptr<A, Deleter> s2;
+    s2 = s;
+    assert(s2.get() == p);
+    assert(s.get() == 0);
+    assert(A::count == 1);
+    }
+    assert(A::count == 0);
+}

Modified: libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/move04.fail.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/move04.fail.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/move04.fail.cpp (original)
+++ libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/move04.fail.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,56 @@
-//===----------------------------------------------------------------------===//
//
//                     The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//

// <memory>

// unique_ptr

// Test unique_ptr move ctor

#include <memory>
#include <cassert>

// 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<A, Deleter> s(new A);
    A* p = s.get();
    std::unique_ptr<A, Deleter> s2;
    s2 = s;
    assert(s2.get() == p);
    assert(s.get() == 0);
    assert(A::count == 1);
    }
    
 assert(A::count == 0);
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <memory>
+
+// unique_ptr
+
+// Test unique_ptr move ctor
+
+#include <memory>
+#include <cassert>
+
+// 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<A, Deleter> s(new A);
+    A* p = s.get();
+    std::unique_ptr<A, Deleter> s2;
+    s2 = s;
+    assert(s2.get() == p);
+    assert(s.get() == 0);
+    assert(A::count == 1);
+    }
+    assert(A::count == 0);
+}

Modified: libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/move_convert01.fail.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/move_convert01.fail.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/move_convert01.fail.cpp (original)
+++ libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/move_convert01.fail.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,56 @@
-//===----------------------------------------------------------------------===//
//
//                     The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//

// <memory>

// unique_ptr

// Test unique_ptr converting move assignment

#include <memory>
#include <cassert>

// 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<B[]> s(new B);
    A* p = s.get();
    std::unique_ptr<A[]> s2;
    s2 = s;
    assert(s2.get() == p);
    assert(s.get() == 0);
    assert(A::count == 1);
    assert(B::count == 1);
    }
  
   assert(A::count == 0);
    assert(B::count == 0);
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <memory>
+
+// unique_ptr
+
+// Test unique_ptr converting move assignment
+
+#include <memory>
+#include <cassert>
+
+// 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<B[]> s(new B);
+    A* p = s.get();
+    std::unique_ptr<A[]> s2;
+    s2 = s;
+    assert(s2.get() == p);
+    assert(s.get() == 0);
+    assert(A::count == 1);
+    assert(B::count == 1);
+    }
+    assert(A::count == 0);
+    assert(B::count == 0);
+}

Modified: libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/move_convert02.fail.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/move_convert02.fail.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/move_convert02.fail.cpp (original)
+++ libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/move_convert02.fail.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,60 @@
-//===----------------------------------------------------------------------===//
//
//                     The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//

// <memory>

// unique_ptr

// Test unique_ptr converting move assignment

// Can't assign from lvalue

#include <memory>
#include <cassert>

#include "../deleter.h"

struct A
{
    static int count;
    A() {++count;}
    A(const A&) {++count;}
    virtual ~A() {--count;}
};

int A::count = 0;

struct B
    : public A
{
    static int count;
    B() {++count;}
    B(const B&) {++count;}
    virtual ~B() {--count;}
};

int B::count = 0;

int main()
{
    {
    boost::unique_ptr<B[], Deleter<B> > s(new B);
    A* p = s.get();
    boost::unique_ptr<A[], Deleter<A> > s2;
    s2 = s;
    assert(s2.get() == p);
    assert(s.get() == 0);
    ass
 ert(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);
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <memory>
+
+// unique_ptr
+
+// Test unique_ptr converting move assignment
+
+// Can't assign from lvalue
+
+#include <memory>
+#include <cassert>
+
+#include "../deleter.h"
+
+struct A
+{
+    static int count;
+    A() {++count;}
+    A(const A&) {++count;}
+    virtual ~A() {--count;}
+};
+
+int A::count = 0;
+
+struct B
+    : public A
+{
+    static int count;
+    B() {++count;}
+    B(const B&) {++count;}
+    virtual ~B() {--count;}
+};
+
+int B::count = 0;
+
+int main()
+{
+    {
+    boost::unique_ptr<B[], Deleter<B> > s(new B);
+    A* p = s.get();
+    boost::unique_ptr<A[], Deleter<A> > s2;
+    s2 = s;
+    assert(s2.get() == p);
+    assert(s.get() == 0);
+    assert(A::count == 1);
+    assert(B::count == 1);
+    assert(s2.get_deleter().state() == 5);
+    assert(s.get_deleter().state() == 0);
+    }
+    assert(A::count == 0);
+    assert(B::count == 0);
+}

Modified: libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/move_convert03.fail.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/move_convert03.fail.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/move_convert03.fail.cpp (original)
+++ libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/move_convert03.fail.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,61 @@
-//===----------------------------------------------------------------------===//
//
//                     The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//

// <memory>

// unique_ptr

// Test unique_ptr converting move assignment

// Can't assign from lvalue

#include <memory>
#include <cassert>

#include "../deleter.h"

struct A
{
    static int count;
    A() {++count;}
    A(const A&) {++count;}
    virtual ~A() {--count;}
};

int A::count = 0;

struct B
    : public A
{
    static int count;
    B() {++count;}
    B(const B&) {++count;}
    virtual ~B() {--count;}
};

int B::count = 0;

int main()
{
    {
    Deleter<B> db(5);
    boost::unique_ptr<B[], Deleter<B>&> s(new B, db);
    A* p = s.get();
    Deleter<A> da(6);
    boost::unique_ptr<A[], Deleter<A>&> s2(new A, da);
    s2 = s;
 
    assert(s2.get() == p);
    assert(s.get() == 0);
    assert(A::count == 1);
    assert(B::count == 1);
    assert(s2.get_deleter().state() == 5);
    }
    assert(A::count == 0);
    assert(B::count == 0);
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <memory>
+
+// unique_ptr
+
+// Test unique_ptr converting move assignment
+
+// Can't assign from lvalue
+
+#include <memory>
+#include <cassert>
+
+#include "../deleter.h"
+
+struct A
+{
+    static int count;
+    A() {++count;}
+    A(const A&) {++count;}
+    virtual ~A() {--count;}
+};
+
+int A::count = 0;
+
+struct B
+    : public A
+{
+    static int count;
+    B() {++count;}
+    B(const B&) {++count;}
+    virtual ~B() {--count;}
+};
+
+int B::count = 0;
+
+int main()
+{
+    {
+    Deleter<B> db(5);
+    boost::unique_ptr<B[], Deleter<B>&> s(new B, db);
+    A* p = s.get();
+    Deleter<A> da(6);
+    boost::unique_ptr<A[], Deleter<A>&> s2(new A, da);
+    s2 = s;
+    assert(s2.get() == p);
+    assert(s.get() == 0);
+    assert(A::count == 1);
+    assert(B::count == 1);
+    assert(s2.get_deleter().state() == 5);
+    }
+    assert(A::count == 0);
+    assert(B::count == 0);
+}

Modified: libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/move_convert04.fail.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/move_convert04.fail.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/move_convert04.fail.cpp (original)
+++ libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/move_convert04.fail.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,56 @@
-//===----------------------------------------------------------------------===//
//
//                     The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//

// <memory>

// unique_ptr

// Test unique_ptr converting move assignment

#include <memory>
#include <cassert>

// 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<B[]> s(new B);
    A* p = s.get();
    boost::unique_ptr<A[]> s2;
    s2 = s;
    assert(s2.get() == p);
    assert(s.get() == 0);
    assert(A::count == 1);
    assert(B::count
  == 1);
    }
    assert(A::count == 0);
    assert(B::count == 0);
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <memory>
+
+// unique_ptr
+
+// Test unique_ptr converting move assignment
+
+#include <memory>
+#include <cassert>
+
+// 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<B[]> s(new B);
+    A* p = s.get();
+    boost::unique_ptr<A[]> s2;
+    s2 = s;
+    assert(s2.get() == p);
+    assert(s.get() == 0);
+    assert(A::count == 1);
+    assert(B::count == 1);
+    }
+    assert(A::count == 0);
+    assert(B::count == 0);
+}

Modified: libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/move_convert05.fail.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/move_convert05.fail.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/move_convert05.fail.cpp (original)
+++ libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/move_convert05.fail.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,60 @@
-//===----------------------------------------------------------------------===//
//
//                     The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//

// <memory>

// unique_ptr

// Test unique_ptr converting move assignment

// Can't assign from const lvalue

#include <memory>
#include <cassert>

#include "../deleter.h"

struct A
{
    static int count;
    A() {++count;}
    A(const A&) {++count;}
    virtual ~A() {--count;}
};

int A::count = 0;

struct B
    : public A
{
    static int count;
    B() {++count;}
    B(const B&) {++count;}
    virtual ~B() {--count;}
};

int B::count = 0;

int main()
{
    {
    const boost::unique_ptr<B[], Deleter<B> > s(new B);
    A* p = s.get();
    boost::unique_ptr<A[], Deleter<A> > s2;
    s2 = s;
    assert(s2.get() == p);
    assert(s.get() ==
  0);
    assert(A::count == 1);
    assert(B::count == 1);
    assert(s2.get_deleter().state() == 5);
    assert(s.get_deleter().state() == 0);
    }
    assert(A::count == 0);
    assert(B::count == 0);
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <memory>
+
+// unique_ptr
+
+// Test unique_ptr converting move assignment
+
+// Can't assign from const lvalue
+
+#include <memory>
+#include <cassert>
+
+#include "../deleter.h"
+
+struct A
+{
+    static int count;
+    A() {++count;}
+    A(const A&) {++count;}
+    virtual ~A() {--count;}
+};
+
+int A::count = 0;
+
+struct B
+    : public A
+{
+    static int count;
+    B() {++count;}
+    B(const B&) {++count;}
+    virtual ~B() {--count;}
+};
+
+int B::count = 0;
+
+int main()
+{
+    {
+    const boost::unique_ptr<B[], Deleter<B> > s(new B);
+    A* p = s.get();
+    boost::unique_ptr<A[], Deleter<A> > s2;
+    s2 = s;
+    assert(s2.get() == p);
+    assert(s.get() == 0);
+    assert(A::count == 1);
+    assert(B::count == 1);
+    assert(s2.get_deleter().state() == 5);
+    assert(s.get_deleter().state() == 0);
+    }
+    assert(A::count == 0);
+    assert(B::count == 0);
+}

Modified: libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/move_convert06.fail.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/move_convert06.fail.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/move_convert06.fail.cpp (original)
+++ libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/move_convert06.fail.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,61 @@
-//===----------------------------------------------------------------------===//
//
//                     The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//

// <memory>

// unique_ptr

// Test unique_ptr converting move assignment

// Can't assign from const lvalue

#include <memory>
#include <cassert>

#include "../deleter.h"

struct A
{
    static int count;
    A() {++count;}
    A(const A&) {++count;}
    virtual ~A() {--count;}
};

int A::count = 0;

struct B
    : public A
{
    static int count;
    B() {++count;}
    B(const B&) {++count;}
    virtual ~B() {--count;}
};

int B::count = 0;

int main()
{
    {
    Deleter<B> db(5);
    const boost::unique_ptr<B[], Deleter<B>&> s(new B, db);
    A* p = s.get();
    Deleter<A> da(6);
    boost::unique_ptr<A[], Deleter<A>&> s2(new A, da);
 
    s2 = s;
    assert(s2.get() == p);
    assert(s.get() == 0);
    assert(A::count == 1);
    assert(B::count == 1);
    assert(s2.get_deleter().state() == 5);
    }
    assert(A::count == 0);
    assert(B::count == 0);
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <memory>
+
+// unique_ptr
+
+// Test unique_ptr converting move assignment
+
+// Can't assign from const lvalue
+
+#include <memory>
+#include <cassert>
+
+#include "../deleter.h"
+
+struct A
+{
+    static int count;
+    A() {++count;}
+    A(const A&) {++count;}
+    virtual ~A() {--count;}
+};
+
+int A::count = 0;
+
+struct B
+    : public A
+{
+    static int count;
+    B() {++count;}
+    B(const B&) {++count;}
+    virtual ~B() {--count;}
+};
+
+int B::count = 0;
+
+int main()
+{
+    {
+    Deleter<B> db(5);
+    const boost::unique_ptr<B[], Deleter<B>&> s(new B, db);
+    A* p = s.get();
+    Deleter<A> da(6);
+    boost::unique_ptr<A[], Deleter<A>&> s2(new A, da);
+    s2 = s;
+    assert(s2.get() == p);
+    assert(s.get() == 0);
+    assert(A::count == 1);
+    assert(B::count == 1);
+    assert(s2.get_deleter().state() == 5);
+    }
+    assert(A::count == 0);
+    assert(B::count == 0);
+}

Modified: libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/move_convert07.fail.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/move_convert07.fail.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/move_convert07.fail.cpp (original)
+++ libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/move_convert07.fail.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,55 @@
-//===----------------------------------------------------------------------===//
//
//                     The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//

// <memory>

// unique_ptr

// Test unique_ptr converting move assignment

#include <memory>
#include <cassert>

struct A
{
    static int count;
    A() {++count;}
    A(const A&) {++count;}
    virtual ~A() {--count;}
};

int A::count = 0;

struct B
    : public A
{
    static int count;
    B() {++count;}
    B(const B&) {++count;}
    virtual ~B() {--count;}
};

int B::count = 0;

int main()
{
    {
    boost::unique_ptr<B[]> s(new B);
    A* p = s.get();
    boost::unique_ptr<A[]> 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);
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <memory>
+
+// unique_ptr
+
+// Test unique_ptr converting move assignment
+
+#include <memory>
+#include <cassert>
+
+struct A
+{
+    static int count;
+    A() {++count;}
+    A(const A&) {++count;}
+    virtual ~A() {--count;}
+};
+
+int A::count = 0;
+
+struct B
+    : public A
+{
+    static int count;
+    B() {++count;}
+    B(const B&) {++count;}
+    virtual ~B() {--count;}
+};
+
+int B::count = 0;
+
+int main()
+{
+    {
+    boost::unique_ptr<B[]> s(new B);
+    A* p = s.get();
+    boost::unique_ptr<A[]> 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);
+}

Modified: libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/move_convert08.fail.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/move_convert08.fail.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/move_convert08.fail.cpp (original)
+++ libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/move_convert08.fail.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,59 @@
-//===----------------------------------------------------------------------===//
//
//                     The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//

// <memory>

// unique_ptr

// Test unique_ptr converting move assignment

#include <memory>
#include <cassert>

#include "../deleter.h"

struct A
{
    static int count;
    A() {++count;}
    A(const A&) {++count;}
    virtual ~A() {--count;}
};

int A::count = 0;

struct B
    : public A
{
    static int count;
    B() {++count;}
    B(const B&) {++count;}
    virtual ~B() {--count;}
};

int B::count = 0;

int main()
{
    {
    boost::unique_ptr<B[], Deleter<B> > s(new B);
    A* p = s.get();
    boost::unique_ptr<A[], Deleter<A> > 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);
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <memory>
+
+// unique_ptr
+
+// Test unique_ptr converting move assignment
+
+#include <memory>
+#include <cassert>
+
+#include "../deleter.h"
+
+struct A
+{
+    static int count;
+    A() {++count;}
+    A(const A&) {++count;}
+    virtual ~A() {--count;}
+};
+
+int A::count = 0;
+
+struct B
+    : public A
+{
+    static int count;
+    B() {++count;}
+    B(const B&) {++count;}
+    virtual ~B() {--count;}
+};
+
+int B::count = 0;
+
+int main()
+{
+    {
+    boost::unique_ptr<B[], Deleter<B> > s(new B);
+    A* p = s.get();
+    boost::unique_ptr<A[], Deleter<A> > 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);
+}

Modified: libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/move_convert09.fail.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/move_convert09.fail.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/move_convert09.fail.cpp (original)
+++ libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/move_convert09.fail.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,61 @@
-//===----------------------------------------------------------------------===//
//
//                     The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//

// <memory>

// unique_ptr

// Test unique_ptr converting move assignment

// test converting move assignment with reference deleters

#include <memory>
#include <cassert>

#include "../deleter.h"

struct A
{
    static int count;
    A() {++count;}
    A(const A&) {++count;}
    virtual ~A() {--count;}
};

int A::count = 0;

struct B
    : public A
{
    static int count;
    B() {++count;}
    B(const B&) {++count;}
    virtual ~B() {--count;}
};

int B::count = 0;

int main()
{
    {
    Deleter<B> db(5);
    boost::unique_ptr<B[], Deleter<B>&> s(new B, db);
    A* p = s.get();
    Deleter<A> da(6);
    boost::unique_ptr<A[], Deleter<A>
 &> 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);
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <memory>
+
+// unique_ptr
+
+// Test unique_ptr converting move assignment
+
+// test converting move assignment with reference deleters
+
+#include <memory>
+#include <cassert>
+
+#include "../deleter.h"
+
+struct A
+{
+    static int count;
+    A() {++count;}
+    A(const A&) {++count;}
+    virtual ~A() {--count;}
+};
+
+int A::count = 0;
+
+struct B
+    : public A
+{
+    static int count;
+    B() {++count;}
+    B(const B&) {++count;}
+    virtual ~B() {--count;}
+};
+
+int B::count = 0;
+
+int main()
+{
+    {
+    Deleter<B> db(5);
+    boost::unique_ptr<B[], Deleter<B>&> s(new B, db);
+    A* p = s.get();
+    Deleter<A> da(6);
+    boost::unique_ptr<A[], Deleter<A>&> 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);
+}

Modified: libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/null_asgn.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/null_asgn.pass.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/null_asgn.pass.cpp (original)
+++ libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/null_asgn.pass.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,41 @@
-//===----------------------------------------------------------------------===//
//
//                     The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//

// <memory>

// unique_ptr

// Test unique_ptr move assignment

#include <memory>
#include <cassert>

// 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<A> s2(new A);
    assert(A::count == 1);
    s2 = 0;
    assert(A::count == 0);
    assert(s2.get() == 0);
    }
    assert(A::count == 0);
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <memory>
+
+// unique_ptr
+
+// Test unique_ptr move assignment
+
+#include <memory>
+#include <cassert>
+
+// 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<A> s2(new A);
+    assert(A::count == 1);
+    s2 = 0;
+    assert(A::count == 0);
+    assert(s2.get() == 0);
+    }
+    assert(A::count == 0);
+}

Modified: libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/null_ctor.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/null_ctor.pass.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/null_ctor.pass.cpp (original)
+++ libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/null_ctor.pass.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,44 @@
-//===----------------------------------------------------------------------===//
//
//                     The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//

// <memory>

// unique_ptr

// The deleter is not called if get() == 0

#include <memory>
#include <cassert>

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<int[], Deleter&> p(0, d);
    assert(p.get() == 0);
    assert(&p.get_deleter() == &d);
    }
    assert(d.state() == 0);
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <memory>
+
+// unique_ptr
+
+// The deleter is not called if get() == 0
+
+#include <memory>
+#include <cassert>
+
+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<int[], Deleter&> p(0, d);
+    assert(p.get() == 0);
+    assert(&p.get_deleter() == &d);
+    }
+    assert(d.state() == 0);
+}

Modified: libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/nullptr_asgn.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/nullptr_asgn.pass.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/nullptr_asgn.pass.cpp (original)
+++ libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/nullptr_asgn.pass.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,41 @@
-//===----------------------------------------------------------------------===//
//
//                     The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//

// <memory>

// unique_ptr

// Test unique_ptr move assignment

#include <memory>
#include <cassert>

// 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<A[]> s2(new A[3]);
    assert(A::count == 3);
    s2 = nullptr;
    assert(A::count == 0);
    assert(s2.get() == 0);
    }
    assert(A::count == 0);
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <memory>
+
+// unique_ptr
+
+// Test unique_ptr move assignment
+
+#include <memory>
+#include <cassert>
+
+// 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<A[]> s2(new A[3]);
+    assert(A::count == 3);
+    s2 = nullptr;
+    assert(A::count == 0);
+    assert(s2.get() == 0);
+    }
+    assert(A::count == 0);
+}

Modified: libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/pointer_type.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/pointer_type.pass.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/pointer_type.pass.cpp (original)
+++ libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/pointer_type.pass.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,34 @@
-//===----------------------------------------------------------------------===//
//
//                     The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//

// <memory>

// unique_ptr

// Test unique_ptr<T[]>::pointer type

#include <memory>
#include <type_traits>

struct Deleter
{
    struct pointer {};
};

int main()
{
    {
    typedef std::unique_ptr<int[]> P;
    static_assert((std::is_same<P::pointer, int*>::value), "");
    }
    {
    typedef std::unique_ptr<int[], Deleter> P;
    static_assert((std::is_same<P::pointer, Deleter::pointer>::value), "");
    }
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <memory>
+
+// unique_ptr
+
+// Test unique_ptr<T[]>::pointer type
+
+#include <memory>
+#include <type_traits>
+
+struct Deleter
+{
+    struct pointer {};
+};
+
+int main()
+{
+    {
+    typedef std::unique_ptr<int[]> P;
+    static_assert((std::is_same<P::pointer, int*>::value), "");
+    }
+    {
+    typedef std::unique_ptr<int[], Deleter> P;
+    static_assert((std::is_same<P::pointer, Deleter::pointer>::value), "");
+    }
+}

Modified: libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/default01.fail.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/default01.fail.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/default01.fail.cpp (original)
+++ libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/default01.fail.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,36 @@
-//===----------------------------------------------------------------------===//
//
//                     The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//

// <memory>

// unique_ptr

// Test unique_ptr default ctor

// default unique_ptr ctor should require default Deleter ctor

#include <memory>

class Deleter
{

    Deleter() {}

public:

    Deleter(Deleter&) {}
    Deleter& operator=(Deleter&) {}

    void operator()(void*) const {}
};


int main()
{
    std::unique_ptr<int[], Deleter> p;
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <memory>
+
+// unique_ptr
+
+// Test unique_ptr default ctor
+
+// default unique_ptr ctor should require default Deleter ctor
+
+#include <memory>
+
+class Deleter
+{
+
+    Deleter() {}
+
+public:
+
+    Deleter(Deleter&) {}
+    Deleter& operator=(Deleter&) {}
+
+    void operator()(void*) const {}
+};
+
+int main()
+{
+    std::unique_ptr<int[], Deleter> p;
+}

Modified: libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/default01.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/default01.pass.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/default01.pass.cpp (original)
+++ libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/default01.pass.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,47 @@
-//===----------------------------------------------------------------------===//
//
//                     The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//

// <memory>

// unique_ptr

// Test unique_ptr default ctor

// default unique_ptr ctor should only require default Deleter ctor

#include <memory>
#include <cassert>

class Deleter
{
    int state_;

    Deleter(Deleter&);
    Deleter& operator=(Deleter&);

public:
    Deleter() : state_(5) {}

    int state() const {return state_;}

    void operator()(void*) {}
};


int main()
{
    {
    std::unique_ptr<int[]> p;
    assert(p.get() == 0);
    }
    {
    std::unique_ptr<int[], Deleter> p;
    assert(p.get() == 0);
    assert(p.get_deleter().state() == 5);
    }
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <memory>
+
+// unique_ptr
+
+// Test unique_ptr default ctor
+
+// default unique_ptr ctor should only require default Deleter ctor
+
+#include <memory>
+#include <cassert>
+
+class Deleter
+{
+    int state_;
+
+    Deleter(Deleter&);
+    Deleter& operator=(Deleter&);
+
+public:
+    Deleter() : state_(5) {}
+
+    int state() const {return state_;}
+
+    void operator()(void*) {}
+};
+
+int main()
+{
+    {
+    std::unique_ptr<int[]> p;
+    assert(p.get() == 0);
+    }
+    {
+    std::unique_ptr<int[], Deleter> p;
+    assert(p.get() == 0);
+    assert(p.get_deleter().state() == 5);
+    }
+}

Modified: libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/default02.fail.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/default02.fail.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/default02.fail.cpp (original)
+++ libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/default02.fail.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,30 @@
-//===----------------------------------------------------------------------===//
//
//                     The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//

// <memory>

// unique_ptr

// Test unique_ptr default ctor

// default unique_ptr ctor should require non-reference Deleter ctor

#include <memory>

class Deleter
{
public:

    void operator()(void*) {}
};


int main()
{
    std::unique_ptr<int[], Deleter&> p;
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <memory>
+
+// unique_ptr
+
+// Test unique_ptr default ctor
+
+// default unique_ptr ctor should require non-reference Deleter ctor
+
+#include <memory>
+
+class Deleter
+{
+public:
+
+    void operator()(void*) {}
+};
+
+int main()
+{
+    std::unique_ptr<int[], Deleter&> p;
+}

Modified: libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/default02.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/default02.pass.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/default02.pass.cpp (original)
+++ libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/default02.pass.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,87 @@
-//===----------------------------------------------------------------------===//
//
//                     The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//

// <memory>

// unique_ptr

// Test default unique_ptr<T[]> ctor

// default unique_ptr<T[]> ctor shouldn't require complete type

#include <memory>
#include <cassert>

struct A;

class Deleter
{
    int state_;

    Deleter(Deleter&);
    Deleter& operator=(Deleter&);

public:
    Deleter() : state_(5) {}

    int state() const {return state_;}

    void operator()(A* p);
};

void check(int i);

template <class D = std::default_delete<A> >
struct B
{
    std::unique_ptr<A[], D> a_;
    B();
    ~B();

    A* get() const {return a_.get();}
    D& get_deleter() {return a_.get_deleter();}
};

int main()
{
    {
    B<> s;
    assert(s.get() 
 == 0);
    }
    check(0);
    {
    B<Deleter> s;
    assert(s.get() == 0);
    assert(s.get_deleter().state() == 5);
    }
    check(0);
}

struct A
{
    static int count;
    A() {++count;}
    A(const A&) {++count;}
    ~A() {--count;}
};

int A::count = 0;

void Deleter::operator()(A* p) {delete p;}

void check(int i)
{
    assert(A::count == i);
}

template <class D>
B<D>::B() {}

template <class D>
B<D>::~B() {}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <memory>
+
+// unique_ptr
+
+// Test default unique_ptr<T[]> ctor
+
+// default unique_ptr<T[]> ctor shouldn't require complete type
+
+#include <memory>
+#include <cassert>
+
+struct A;
+
+class Deleter
+{
+    int state_;
+
+    Deleter(Deleter&);
+    Deleter& operator=(Deleter&);
+
+public:
+    Deleter() : state_(5) {}
+
+    int state() const {return state_;}
+
+    void operator()(A* p);
+};
+
+void check(int i);
+
+template <class D = std::default_delete<A> >
+struct B
+{
+    std::unique_ptr<A[], D> a_;
+    B();
+    ~B();
+
+    A* get() const {return a_.get();}
+    D& get_deleter() {return a_.get_deleter();}
+};
+
+int main()
+{
+    {
+    B<> s;
+    assert(s.get() == 0);
+    }
+    check(0);
+    {
+    B<Deleter> s;
+    assert(s.get() == 0);
+    assert(s.get_deleter().state() == 5);
+    }
+    check(0);
+}
+
+struct A
+{
+    static int count;
+    A() {++count;}
+    A(const A&) {++count;}
+    ~A() {--count;}
+};
+
+int A::count = 0;
+
+void Deleter::operator()(A* p) {delete p;}
+
+void check(int i)
+{
+    assert(A::count == i);
+}
+
+template <class D>
+B<D>::B() {}
+
+template <class D>
+B<D>::~B() {}

Modified: libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/default03.fail.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/default03.fail.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/default03.fail.cpp (original)
+++ libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/default03.fail.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,23 @@
-//===----------------------------------------------------------------------===//
//
//                     The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//

// <memory>

// unique_ptr

// Test unique_ptr default ctor

// default unique_ptr ctor should require non-pointer Deleter

#include <memory>

int main()
{
    std::unique_ptr<int[], void (*)(void*)> p;
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <memory>
+
+// unique_ptr
+
+// Test unique_ptr default ctor
+
+// default unique_ptr ctor should require non-pointer Deleter
+
+#include <memory>
+
+int main()
+{
+    std::unique_ptr<int[], void (*)(void*)> p;
+}

Modified: libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/move01.fail.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/move01.fail.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/move01.fail.cpp (original)
+++ libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/move01.fail.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,42 @@
-//===----------------------------------------------------------------------===//
//
//                     The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//

// <memory>

// unique_ptr

// Test unique_ptr move ctor

#include <memory>
#include <cassert>

// 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<A[]> s(new A[3]);
    A* p = s.get();
    std::unique_ptr<A[]> s2 = s;
    assert(s2.get() == p);
    assert(s.get() == 0);
    assert(A::count == 1);
    }
    assert(A::count == 0);
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <memory>
+
+// unique_ptr
+
+// Test unique_ptr move ctor
+
+#include <memory>
+#include <cassert>
+
+// 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<A[]> s(new A[3]);
+    A* p = s.get();
+    std::unique_ptr<A[]> s2 = s;
+    assert(s2.get() == p);
+    assert(s.get() == 0);
+    assert(A::count == 1);
+    }
+    assert(A::count == 0);
+}

Modified: libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/move01.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/move01.pass.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/move01.pass.cpp (original)
+++ libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/move01.pass.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,85 @@
-//===----------------------------------------------------------------------===//
//
//                     The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//

// <memory>

// 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 <memory>
#include <cassert>

#include "../../deleter.h"

struct A
{
    static int count;
    A() {++count;}
    A(const A&) {++count;}
    ~A() {--count;}
};

int A::count = 0;

class NCDeleter
{
    int state_;

    NCDeleter(NCDeleter&);
    NCDeleter& operator=(NCDeleter&);
public:

    NCDeleter() : state_(5) {}

    int state() const {return state_;}
    void set_state(int s) {state_ = s;}

    void operator()(A* p) {delete [] p;}
};

int main()
{
 
    {
    std::unique_ptr<A[]> s(new A[3]);
    A* p = s.get();
    std::unique_ptr<A[]> s2 = std::move(s);
    assert(s2.get() == p);
    assert(s.get() == 0);
    assert(A::count == 3);
    }
    assert(A::count == 0);
    {
    std::unique_ptr<A[], Deleter<A[]> > s(new A[3], Deleter<A[]>(5));
    A* p = s.get();
    std::unique_ptr<A[], Deleter<A[]> > s2 = std::move(s);
    assert(s2.get() == p);
    assert(s.get() == 0);
    assert(A::count == 3);
    assert(s2.get_deleter().state() == 5);
    assert(s.get_deleter().state() == 0);
    }
    assert(A::count == 0);
    {
    NCDeleter d;
    std::unique_ptr<A[], NCDeleter&> s(new A[3], d);
    A* p = s.get();
    std::unique_ptr<A[], NCDeleter&> 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);
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <memory>
+
+// 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 <memory>
+#include <cassert>
+
+#include "../../deleter.h"
+
+struct A
+{
+    static int count;
+    A() {++count;}
+    A(const A&) {++count;}
+    ~A() {--count;}
+};
+
+int A::count = 0;
+
+class NCDeleter
+{
+    int state_;
+
+    NCDeleter(NCDeleter&);
+    NCDeleter& operator=(NCDeleter&);
+public:
+
+    NCDeleter() : state_(5) {}
+
+    int state() const {return state_;}
+    void set_state(int s) {state_ = s;}
+
+    void operator()(A* p) {delete [] p;}
+};
+
+int main()
+{
+    {
+    std::unique_ptr<A[]> s(new A[3]);
+    A* p = s.get();
+    std::unique_ptr<A[]> s2 = std::move(s);
+    assert(s2.get() == p);
+    assert(s.get() == 0);
+    assert(A::count == 3);
+    }
+    assert(A::count == 0);
+    {
+    std::unique_ptr<A[], Deleter<A[]> > s(new A[3], Deleter<A[]>(5));
+    A* p = s.get();
+    std::unique_ptr<A[], Deleter<A[]> > s2 = std::move(s);
+    assert(s2.get() == p);
+    assert(s.get() == 0);
+    assert(A::count == 3);
+    assert(s2.get_deleter().state() == 5);
+    assert(s.get_deleter().state() == 0);
+    }
+    assert(A::count == 0);
+    {
+    NCDeleter d;
+    std::unique_ptr<A[], NCDeleter&> s(new A[3], d);
+    A* p = s.get();
+    std::unique_ptr<A[], NCDeleter&> 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);
+}

Modified: libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/move02.fail.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/move02.fail.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/move02.fail.cpp (original)
+++ libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/move02.fail.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,42 @@
-//===----------------------------------------------------------------------===//
//
//                     The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//

// <memory>

// unique_ptr

// Test unique_ptr move ctor

// test move ctor.  Can't copy from const lvalue

#include <memory>
#include <cassert>

struct A
{
    static int count;
    A() {++count;}
    A(const A&) {++count;}
    ~A() {--count;}
};

int A::count = 0;

int main()
{
    {
    const std::unique_ptr<A[]> s(new A[3]);
    A* p = s.get();
    std::unique_ptr<A[]> s2 = s;
    assert(s2.get() == p);
    assert(s.get() == 0);
    assert(A::count == 1);
    }
    assert(A::count == 0);
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <memory>
+
+// unique_ptr
+
+// Test unique_ptr move ctor
+
+// test move ctor.  Can't copy from const lvalue
+
+#include <memory>
+#include <cassert>
+
+struct A
+{
+    static int count;
+    A() {++count;}
+    A(const A&) {++count;}
+    ~A() {--count;}
+};
+
+int A::count = 0;
+
+int main()
+{
+    {
+    const std::unique_ptr<A[]> s(new A[3]);
+    A* p = s.get();
+    std::unique_ptr<A[]> s2 = s;
+    assert(s2.get() == p);
+    assert(s.get() == 0);
+    assert(A::count == 1);
+    }
+    assert(A::count == 0);
+}

Modified: libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/move02.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/move02.pass.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/move02.pass.cpp (original)
+++ libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/move02.pass.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,87 @@
-//===----------------------------------------------------------------------===//
//
//                     The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//

// <memory>

// 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 <memory>
#include <cassert>

#include "../../deleter.h"

struct A
{
    static int count;
    A() {++count;}
    A(const A&) {++count;}
    ~A() {--count;}
};

int A::count = 0;

class NCDeleter
{
    int state_;

    NCDeleter(NCDeleter&);
    NCDeleter& operator=(NCDeleter&);
public:

    NCDeleter() : state_(5) {}

    int state() const {return state_;}
    void set_state(int s) {state_ = s;}

    void operator()(A* p) {delete [] p;}
};

std::unique_pt
 r<A[]>
source1()
{
    return std::unique_ptr<A[]>(new A[3]);
}

void sink1(std::unique_ptr<A[]> p)
{
}

std::unique_ptr<A[], Deleter<A[]> >
source2()
{
    return std::unique_ptr<A[], Deleter<A[]> >(new A[3]);
}

void sink2(std::unique_ptr<A[], Deleter<A[]> > p)
{
}

std::unique_ptr<A[], NCDeleter&>
source3()
{
    static NCDeleter d;
    return std::unique_ptr<A[], NCDeleter&>(new A[3], d);
}

void sink3(std::unique_ptr<A[], NCDeleter&> p)
{
}

int main()
{
    sink1(source1());
    sink2(source2());
    sink3(source3());
    assert(A::count == 0);
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <memory>
+
+// 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 <memory>
+#include <cassert>
+
+#include "../../deleter.h"
+
+struct A
+{
+    static int count;
+    A() {++count;}
+    A(const A&) {++count;}
+    ~A() {--count;}
+};
+
+int A::count = 0;
+
+class NCDeleter
+{
+    int state_;
+
+    NCDeleter(NCDeleter&);
+    NCDeleter& operator=(NCDeleter&);
+public:
+
+    NCDeleter() : state_(5) {}
+
+    int state() const {return state_;}
+    void set_state(int s) {state_ = s;}
+
+    void operator()(A* p) {delete [] p;}
+};
+
+std::unique_ptr<A[]>
+source1()
+{
+    return std::unique_ptr<A[]>(new A[3]);
+}
+
+void sink1(std::unique_ptr<A[]> p)
+{
+}
+
+std::unique_ptr<A[], Deleter<A[]> >
+source2()
+{
+    return std::unique_ptr<A[], Deleter<A[]> >(new A[3]);
+}
+
+void sink2(std::unique_ptr<A[], Deleter<A[]> > p)
+{
+}
+
+std::unique_ptr<A[], NCDeleter&>
+source3()
+{
+    static NCDeleter d;
+    return std::unique_ptr<A[], NCDeleter&>(new A[3], d);
+}
+
+void sink3(std::unique_ptr<A[], NCDeleter&> p)
+{
+}
+
+int main()
+{
+    sink1(source1());
+    sink2(source2());
+    sink3(source3());
+    assert(A::count == 0);
+}

Modified: libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/move03.fail.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/move03.fail.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/move03.fail.cpp (original)
+++ libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/move03.fail.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,55 @@
-//===----------------------------------------------------------------------===//
//
//                     The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//

// <memory>

// unique_ptr

// Test unique_ptr move ctor

// test move ctor.  Can't copy from lvalue

#include <memory>
#include <cassert>

struct A
{
    static int count;
    A() {++count;}
    A(const A&) {++count;}
    ~A() {--count;}
};

int A::count = 0;

class Deleter
{
    int state_;

public:

    Deleter() : state_(5) {}

    int state() const {return state_;}

    void operator()(A* p) {delete [] p;}
};

int main()
{
    {
    std::unique_ptr<A[], Deleter> s(new A[3]);
    A* p = s.get();
    std::unique_ptr<A[], Deleter> s2 = s;
    assert(s2.get() == p);
    assert(s.get() == 0);
    assert(A::count == 1);
    }
    assert(A::
 count == 0);
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <memory>
+
+// unique_ptr
+
+// Test unique_ptr move ctor
+
+// test move ctor.  Can't copy from lvalue
+
+#include <memory>
+#include <cassert>
+
+struct A
+{
+    static int count;
+    A() {++count;}
+    A(const A&) {++count;}
+    ~A() {--count;}
+};
+
+int A::count = 0;
+
+class Deleter
+{
+    int state_;
+
+public:
+
+    Deleter() : state_(5) {}
+
+    int state() const {return state_;}
+
+    void operator()(A* p) {delete [] p;}
+};
+
+int main()
+{
+    {
+    std::unique_ptr<A[], Deleter> s(new A[3]);
+    A* p = s.get();
+    std::unique_ptr<A[], Deleter> s2 = s;
+    assert(s2.get() == p);
+    assert(s.get() == 0);
+    assert(A::count == 1);
+    }
+    assert(A::count == 0);
+}

Modified: libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/move04.fail.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/move04.fail.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/move04.fail.cpp (original)
+++ libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/move04.fail.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,55 @@
-//===----------------------------------------------------------------------===//
//
//                     The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//

// <memory>

// unique_ptr

// Test unique_ptr move ctor

// test move ctor.  Can't copy from const lvalue

#include <memory>
#include <cassert>

struct A
{
    static int count;
    A() {++count;}
    A(const A&) {++count;}
    ~A() {--count;}
};

int A::count = 0;

class Deleter
{
    int state_;

public:

    Deleter() : state_(5) {}

    int state() const {return state_;}

    void operator()(A* p) {delete [] p;}
};

int main()
{
    {
    const std::unique_ptr<A[], Deleter> s(new A[3]);
    A* p = s.get();
    std::unique_ptr<A[], Deleter> s2 = s;
    assert(s2.get() == p);
    assert(s.get() == 0);
    assert(A::count == 1);
    }
  
   assert(A::count == 0);
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <memory>
+
+// unique_ptr
+
+// Test unique_ptr move ctor
+
+// test move ctor.  Can't copy from const lvalue
+
+#include <memory>
+#include <cassert>
+
+struct A
+{
+    static int count;
+    A() {++count;}
+    A(const A&) {++count;}
+    ~A() {--count;}
+};
+
+int A::count = 0;
+
+class Deleter
+{
+    int state_;
+
+public:
+
+    Deleter() : state_(5) {}
+
+    int state() const {return state_;}
+
+    void operator()(A* p) {delete [] p;}
+};
+
+int main()
+{
+    {
+    const std::unique_ptr<A[], Deleter> s(new A[3]);
+    A* p = s.get();
+    std::unique_ptr<A[], Deleter> s2 = s;
+    assert(s2.get() == p);
+    assert(s.get() == 0);
+    assert(A::count == 1);
+    }
+    assert(A::count == 0);
+}

Modified: libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/move_convert01.fail.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/move_convert01.fail.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/move_convert01.fail.cpp (original)
+++ libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/move_convert01.fail.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,57 @@
-//===----------------------------------------------------------------------===//
//
//                     The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//

// <memory>

// 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 <memory>
#include <cassert>

struct A
{
    static int count;
    A() {++count;}
    A(const A&) {++count;}
    virtual ~A() {--count;}
};

int A::count = 0;

struct B
    : public A
{
    static int count;
    B() {++count;}
    B(const B&) {++count;}
    virtual ~B() {--count;}
};

int B::count = 0;

int main()
{
    {
    std::unique_ptr<B[]> s(new B);
    A* p = s.get();
    std::unique_ptr<A[]> s2(s);
    ass
 ert(s2.get() == p);
    assert(s.get() == 0);
    assert(A::count == 1);
    assert(B::count == 1);
    }
    assert(A::count == 0);
    assert(B::count == 0);
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <memory>
+
+// 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 <memory>
+#include <cassert>
+
+struct A
+{
+    static int count;
+    A() {++count;}
+    A(const A&) {++count;}
+    virtual ~A() {--count;}
+};
+
+int A::count = 0;
+
+struct B
+    : public A
+{
+    static int count;
+    B() {++count;}
+    B(const B&) {++count;}
+    virtual ~B() {--count;}
+};
+
+int B::count = 0;
+
+int main()
+{
+    {
+    std::unique_ptr<B[]> s(new B);
+    A* p = s.get();
+    std::unique_ptr<A[]> s2(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);
+}

Modified: libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/move_convert02.fail.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/move_convert02.fail.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/move_convert02.fail.cpp (original)
+++ libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/move_convert02.fail.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,61 @@
-//===----------------------------------------------------------------------===//
//
//                     The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//

// <memory>

// 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 <memory>
#include <cassert>

#include "../../deleter.h"

struct A
{
    static int count;
    A() {++count;}
    A(const A&) {++count;}
    virtual ~A() {--count;}
};

int A::count = 0;

struct B
    : public A
{
    static int count;
    B() {++count;}
    B(const B&) {++count;}
    virtual ~B() {--count;}
};

int B::count = 0;

int main()
{
    {
    std::unique_ptr<B[], Deleter<B[]> > s(new B);
    A* p = s.get
 ();
    std::unique_ptr<A[], Deleter<A[]> > 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);
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <memory>
+
+// 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 <memory>
+#include <cassert>
+
+#include "../../deleter.h"
+
+struct A
+{
+    static int count;
+    A() {++count;}
+    A(const A&) {++count;}
+    virtual ~A() {--count;}
+};
+
+int A::count = 0;
+
+struct B
+    : public A
+{
+    static int count;
+    B() {++count;}
+    B(const B&) {++count;}
+    virtual ~B() {--count;}
+};
+
+int B::count = 0;
+
+int main()
+{
+    {
+    std::unique_ptr<B[], Deleter<B[]> > s(new B);
+    A* p = s.get();
+    std::unique_ptr<A[], Deleter<A[]> > 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);
+}

Modified: libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/move_convert03.fail.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/move_convert03.fail.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/move_convert03.fail.cpp (original)
+++ libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/move_convert03.fail.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,78 @@
-//===----------------------------------------------------------------------===//
//
//                     The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//

// <memory>

// 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 <memory>
#include <cassert>

struct A
{
    static int count;
    A() {++count;}
    A(const A&) {++count;}
    virtual ~A() {--count;}
};

int A::count = 0;

struct B
    : public A
{
    static int count;
    B() {++count;}
    B(const B&) {++count;}
    virtual ~B() {--count;}
};

int B::count = 0;

template <class T>
class CDeleter
{
    int state_;

    CDeleter(CDeleter&);
    CDeleter& operator=(CDeleter&);
 
public:

    CDeleter() : state_(5) {}

    int state() const {return state_;}
    void set_state(int s) {state_ = s;}

    void operator()(T* p) {delete p;}
};

int main()
{
    {
    CDeleter<A> d;
    std::unique_ptr<B[], CDeleter<A>&> s(new B, d);
    A* p = s.get();
    std::unique_ptr<A[], CDeleter<A>&> s2(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);
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <memory>
+
+// 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 <memory>
+#include <cassert>
+
+struct A
+{
+    static int count;
+    A() {++count;}
+    A(const A&) {++count;}
+    virtual ~A() {--count;}
+};
+
+int A::count = 0;
+
+struct B
+    : public A
+{
+    static int count;
+    B() {++count;}
+    B(const B&) {++count;}
+    virtual ~B() {--count;}
+};
+
+int B::count = 0;
+
+template <class T>
+class CDeleter
+{
+    int state_;
+
+    CDeleter(CDeleter&);
+    CDeleter& operator=(CDeleter&);
+public:
+
+    CDeleter() : state_(5) {}
+
+    int state() const {return state_;}
+    void set_state(int s) {state_ = s;}
+
+    void operator()(T* p) {delete p;}
+};
+
+int main()
+{
+    {
+    CDeleter<A> d;
+    std::unique_ptr<B[], CDeleter<A>&> s(new B, d);
+    A* p = s.get();
+    std::unique_ptr<A[], CDeleter<A>&> s2(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);
+}

Modified: libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/move_convert04.fail.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/move_convert04.fail.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/move_convert04.fail.cpp (original)
+++ libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/move_convert04.fail.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,57 @@
-//===----------------------------------------------------------------------===//
//
//                     The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//

// <memory>

// 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 <memory>
#include <cassert>

struct A
{
    static int count;
    A() {++count;}
    A(const A&) {++count;}
    virtual ~A() {--count;}
};

int A::count = 0;

struct B
    : public A
{
    static int count;
    B() {++count;}
    B(const B&) {++count;}
    virtual ~B() {--count;}
};

int B::count = 0;

int main()
{
    {
    std::unique_ptr<B[]> s(new B);
    A* p = s.get();
    std::unique_ptr<A[]> s2 = s;
    as
 sert(s2.get() == p);
    assert(s.get() == 0);
    assert(A::count == 1);
    assert(B::count == 1);
    }
    assert(A::count == 0);
    assert(B::count == 0);
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <memory>
+
+// 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 <memory>
+#include <cassert>
+
+struct A
+{
+    static int count;
+    A() {++count;}
+    A(const A&) {++count;}
+    virtual ~A() {--count;}
+};
+
+int A::count = 0;
+
+struct B
+    : public A
+{
+    static int count;
+    B() {++count;}
+    B(const B&) {++count;}
+    virtual ~B() {--count;}
+};
+
+int B::count = 0;
+
+int main()
+{
+    {
+    std::unique_ptr<B[]> s(new B);
+    A* p = s.get();
+    std::unique_ptr<A[]> s2 = 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);
+}

Modified: libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/move_convert05.fail.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/move_convert05.fail.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/move_convert05.fail.cpp (original)
+++ libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/move_convert05.fail.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,61 @@
-//===----------------------------------------------------------------------===//
//
//                     The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//

// <memory>

// 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 <memory>
#include <cassert>

#include "../../deleter.h"

struct A
{
    static int count;
    A() {++count;}
    A(const A&) {++count;}
    virtual ~A() {--count;}
};

int A::count = 0;

struct B
    : public A
{
    static int count;
    B() {++count;}
    B(const B&) {++count;}
    virtual ~B() {--count;}
};

int B::count = 0;

int main()
{
    {
    std::unique_ptr<B[], Deleter<B[]> > s(new B);
    A* p = s.get
 ();
    std::unique_ptr<A[], Deleter<A[]> > 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);
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <memory>
+
+// 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 <memory>
+#include <cassert>
+
+#include "../../deleter.h"
+
+struct A
+{
+    static int count;
+    A() {++count;}
+    A(const A&) {++count;}
+    virtual ~A() {--count;}
+};
+
+int A::count = 0;
+
+struct B
+    : public A
+{
+    static int count;
+    B() {++count;}
+    B(const B&) {++count;}
+    virtual ~B() {--count;}
+};
+
+int B::count = 0;
+
+int main()
+{
+    {
+    std::unique_ptr<B[], Deleter<B[]> > s(new B);
+    A* p = s.get();
+    std::unique_ptr<A[], Deleter<A[]> > 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);
+}

Modified: libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/move_convert06.fail.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/move_convert06.fail.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/move_convert06.fail.cpp (original)
+++ libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/move_convert06.fail.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,78 @@
-//===----------------------------------------------------------------------===//
//
//                     The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//

// <memory>

// 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 <memory>
#include <cassert>

struct A
{
    static int count;
    A() {++count;}
    A(const A&) {++count;}
    virtual ~A() {--count;}
};

int A::count = 0;

struct B
    : public A
{
    static int count;
    B() {++count;}
    B(const B&) {++count;}
    virtual ~B() {--count;}
};

int B::count = 0;

template <class T>
class CDeleter
{
    int state_;

    CDeleter(CDeleter&);
    CDeleter& operator=(CDeleter&);
 
public:

    CDeleter() : state_(5) {}

    int state() const {return state_;}
    void set_state(int s) {state_ = s;}

    void operator()(T* p) {delete p;}
};

int main()
{
    {
    CDeleter<A> d;
    std::unique_ptr<B[], CDeleter<A>&> s(new B, d);
    A* p = s.get();
    std::unique_ptr<A[], CDeleter<A>&> s2 = 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);
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <memory>
+
+// 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 <memory>
+#include <cassert>
+
+struct A
+{
+    static int count;
+    A() {++count;}
+    A(const A&) {++count;}
+    virtual ~A() {--count;}
+};
+
+int A::count = 0;
+
+struct B
+    : public A
+{
+    static int count;
+    B() {++count;}
+    B(const B&) {++count;}
+    virtual ~B() {--count;}
+};
+
+int B::count = 0;
+
+template <class T>
+class CDeleter
+{
+    int state_;
+
+    CDeleter(CDeleter&);
+    CDeleter& operator=(CDeleter&);
+public:
+
+    CDeleter() : state_(5) {}
+
+    int state() const {return state_;}
+    void set_state(int s) {state_ = s;}
+
+    void operator()(T* p) {delete p;}
+};
+
+int main()
+{
+    {
+    CDeleter<A> d;
+    std::unique_ptr<B[], CDeleter<A>&> s(new B, d);
+    A* p = s.get();
+    std::unique_ptr<A[], CDeleter<A>&> s2 = 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);
+}

Modified: libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/move_convert07.fail.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/move_convert07.fail.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/move_convert07.fail.cpp (original)
+++ libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/move_convert07.fail.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,57 @@
-//===----------------------------------------------------------------------===//
//
//                     The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//

// <memory>

// 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 <memory>
#include <cassert>

struct A
{
    static int count;
    A() {++count;}
    A(const A&) {++count;}
    virtual ~A() {--count;}
};

int A::count = 0;

struct B
    : public A
{
    static int count;
    B() {++count;}
    B(const B&) {++count;}
    virtual ~B() {--count;}
};

int B::count = 0;

int main()
{
    {
    const std::unique_ptr<B[]> s(new B);
    A* p = s.get();
    std::unique_ptr<A[]> 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);
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <memory>
+
+// 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 <memory>
+#include <cassert>
+
+struct A
+{
+    static int count;
+    A() {++count;}
+    A(const A&) {++count;}
+    virtual ~A() {--count;}
+};
+
+int A::count = 0;
+
+struct B
+    : public A
+{
+    static int count;
+    B() {++count;}
+    B(const B&) {++count;}
+    virtual ~B() {--count;}
+};
+
+int B::count = 0;
+
+int main()
+{
+    {
+    const std::unique_ptr<B[]> s(new B);
+    A* p = s.get();
+    std::unique_ptr<A[]> 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);
+}

Modified: libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/move_convert08.fail.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/move_convert08.fail.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/move_convert08.fail.cpp (original)
+++ libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/move_convert08.fail.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,61 @@
-//===----------------------------------------------------------------------===//
//
//                     The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//

// <memory>

// 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 <memory>
#include <cassert>

#include "../../deleter.h"

struct A
{
    static int count;
    A() {++count;}
    A(const A&) {++count;}
    virtual ~A() {--count;}
};

int A::count = 0;

struct B
    : public A
{
    static int count;
    B() {++count;}
    B(const B&) {++count;}
    virtual ~B() {--count;}
};

int B::count = 0;

int main()
{
    {
    const std::unique_ptr<B[], Deleter<B[]> > s(new B);
    A* p =
  s.get();
    std::unique_ptr<A[], Deleter<A[]> > 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);
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <memory>
+
+// 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 <memory>
+#include <cassert>
+
+#include "../../deleter.h"
+
+struct A
+{
+    static int count;
+    A() {++count;}
+    A(const A&) {++count;}
+    virtual ~A() {--count;}
+};
+
+int A::count = 0;
+
+struct B
+    : public A
+{
+    static int count;
+    B() {++count;}
+    B(const B&) {++count;}
+    virtual ~B() {--count;}
+};
+
+int B::count = 0;
+
+int main()
+{
+    {
+    const std::unique_ptr<B[], Deleter<B[]> > s(new B);
+    A* p = s.get();
+    std::unique_ptr<A[], Deleter<A[]> > 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);
+}

Modified: libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/move_convert09.fail.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/move_convert09.fail.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/move_convert09.fail.cpp (original)
+++ libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/move_convert09.fail.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,78 @@
-//===----------------------------------------------------------------------===//
//
//                     The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//

// <memory>

// 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 <memory>
#include <cassert>

struct A
{
    static int count;
    A() {++count;}
    A(const A&) {++count;}
    virtual ~A() {--count;}
};

int A::count = 0;

struct B
    : public A
{
    static int count;
    B() {++count;}
    B(const B&) {++count;}
    virtual ~B() {--count;}
};

int B::count = 0;

template <class T>
class CDeleter
{
    int state_;

    CDeleter(CDeleter&);
    CDeleter& operator=(CDeleter&);
 
public:

    CDeleter() : state_(5) {}

    int state() const {return state_;}
    void set_state(int s) {state_ = s;}

    void operator()(T* p) {delete p;}
};

int main()
{
    {
    CDeleter<A> d;
    const std::unique_ptr<B[], CDeleter<A>&> s(new B, d);
    A* p = s.get();
    std::unique_ptr<A[], CDeleter<A>&> 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);
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <memory>
+
+// 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 <memory>
+#include <cassert>
+
+struct A
+{
+    static int count;
+    A() {++count;}
+    A(const A&) {++count;}
+    virtual ~A() {--count;}
+};
+
+int A::count = 0;
+
+struct B
+    : public A
+{
+    static int count;
+    B() {++count;}
+    B(const B&) {++count;}
+    virtual ~B() {--count;}
+};
+
+int B::count = 0;
+
+template <class T>
+class CDeleter
+{
+    int state_;
+
+    CDeleter(CDeleter&);
+    CDeleter& operator=(CDeleter&);
+public:
+
+    CDeleter() : state_(5) {}
+
+    int state() const {return state_;}
+    void set_state(int s) {state_ = s;}
+
+    void operator()(T* p) {delete p;}
+};
+
+int main()
+{
+    {
+    CDeleter<A> d;
+    const std::unique_ptr<B[], CDeleter<A>&> s(new B, d);
+    A* p = s.get();
+    std::unique_ptr<A[], CDeleter<A>&> 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);
+}

Modified: libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/move_convert10.fail.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/move_convert10.fail.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/move_convert10.fail.cpp (original)
+++ libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/move_convert10.fail.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,57 @@
-//===----------------------------------------------------------------------===//
//
//                     The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//

// <memory>

// 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 <memory>
#include <cassert>

struct A
{
    static int count;
    A() {++count;}
    A(const A&) {++count;}
    virtual ~A() {--count;}
};

int A::count = 0;

struct B
    : public A
{
    static int count;
    B() {++count;}
    B(const B&) {++count;}
    virtual ~B() {--count;}
};

int B::count = 0;

int main()
{
    {
    const std::unique_ptr<B[]> s(new B);
    A* p = s.get();
    std::unique_ptr<A[]> 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);
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <memory>
+
+// 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 <memory>
+#include <cassert>
+
+struct A
+{
+    static int count;
+    A() {++count;}
+    A(const A&) {++count;}
+    virtual ~A() {--count;}
+};
+
+int A::count = 0;
+
+struct B
+    : public A
+{
+    static int count;
+    B() {++count;}
+    B(const B&) {++count;}
+    virtual ~B() {--count;}
+};
+
+int B::count = 0;
+
+int main()
+{
+    {
+    const std::unique_ptr<B[]> s(new B);
+    A* p = s.get();
+    std::unique_ptr<A[]> 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);
+}

Modified: libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/move_convert11.fail.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/move_convert11.fail.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/move_convert11.fail.cpp (original)
+++ libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/move_convert11.fail.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,61 @@
-//===----------------------------------------------------------------------===//
//
//                     The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//

// <memory>

// 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 <memory>
#include <cassert>

#include "../../deleter.h"

struct A
{
    static int count;
    A() {++count;}
    A(const A&) {++count;}
    virtual ~A() {--count;}
};

int A::count = 0;

struct B
    : public A
{
    static int count;
    B() {++count;}
    B(const B&) {++count;}
    virtual ~B() {--count;}
};

int B::count = 0;

int main()
{
    {
    const std::unique_ptr<B[], Deleter<B[]> > s(new B);
    A* p =
  s.get();
    std::unique_ptr<A[], Deleter<A[]> > 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);
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <memory>
+
+// 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 <memory>
+#include <cassert>
+
+#include "../../deleter.h"
+
+struct A
+{
+    static int count;
+    A() {++count;}
+    A(const A&) {++count;}
+    virtual ~A() {--count;}
+};
+
+int A::count = 0;
+
+struct B
+    : public A
+{
+    static int count;
+    B() {++count;}
+    B(const B&) {++count;}
+    virtual ~B() {--count;}
+};
+
+int B::count = 0;
+
+int main()
+{
+    {
+    const std::unique_ptr<B[], Deleter<B[]> > s(new B);
+    A* p = s.get();
+    std::unique_ptr<A[], Deleter<A[]> > 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);
+}

Modified: libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/move_convert12.fail.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/move_convert12.fail.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/move_convert12.fail.cpp (original)
+++ libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/move_convert12.fail.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,78 @@
-//===----------------------------------------------------------------------===//
//
//                     The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//

// <memory>

// 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 <memory>
#include <cassert>

struct A
{
    static int count;
    A() {++count;}
    A(const A&) {++count;}
    virtual ~A() {--count;}
};

int A::count = 0;

struct B
    : public A
{
    static int count;
    B() {++count;}
    B(const B&) {++count;}
    virtual ~B() {--count;}
};

int B::count = 0;

template <class T>
class CDeleter
{
    int state_;

    CDeleter(CDeleter&);
    CDeleter& operator=(CDeleter&);
 
public:

    CDeleter() : state_(5) {}

    int state() const {return state_;}
    void set_state(int s) {state_ = s;}

    void operator()(T* p) {delete p;}
};

int main()
{
    {
    CDeleter<A> d;
    const std::unique_ptr<B[], CDeleter<A>&> s(new B, d);
    A* p = s.get();
    std::unique_ptr<A[], CDeleter<A>&> 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);
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <memory>
+
+// 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 <memory>
+#include <cassert>
+
+struct A
+{
+    static int count;
+    A() {++count;}
+    A(const A&) {++count;}
+    virtual ~A() {--count;}
+};
+
+int A::count = 0;
+
+struct B
+    : public A
+{
+    static int count;
+    B() {++count;}
+    B(const B&) {++count;}
+    virtual ~B() {--count;}
+};
+
+int B::count = 0;
+
+template <class T>
+class CDeleter
+{
+    int state_;
+
+    CDeleter(CDeleter&);
+    CDeleter& operator=(CDeleter&);
+public:
+
+    CDeleter() : state_(5) {}
+
+    int state() const {return state_;}
+    void set_state(int s) {state_ = s;}
+
+    void operator()(T* p) {delete p;}
+};
+
+int main()
+{
+    {
+    CDeleter<A> d;
+    const std::unique_ptr<B[], CDeleter<A>&> s(new B, d);
+    A* p = s.get();
+    std::unique_ptr<A[], CDeleter<A>&> 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);
+}

Modified: libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/move_convert13.fail.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/move_convert13.fail.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/move_convert13.fail.cpp (original)
+++ libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/move_convert13.fail.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,57 @@
-//===----------------------------------------------------------------------===//
//
//                     The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//

// <memory>

// 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 <memory>
#include <cassert>

struct A
{
    static int count;
    A() {++count;}
    A(const A&) {++count;}
    virtual ~A() {--count;}
};

int A::count = 0;

struct B
    : public A
{
    static int count;
    B() {++count;}
    B(const B&) {++count;}
    virtual ~B() {--count;}
};

int B::count = 0;

int main()
{
    {
    std::unique_ptr<B[]> s(new B);
    A* p = s.get();
    std::unique_ptr<A[]> s2(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);
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <memory>
+
+// 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 <memory>
+#include <cassert>
+
+struct A
+{
+    static int count;
+    A() {++count;}
+    A(const A&) {++count;}
+    virtual ~A() {--count;}
+};
+
+int A::count = 0;
+
+struct B
+    : public A
+{
+    static int count;
+    B() {++count;}
+    B(const B&) {++count;}
+    virtual ~B() {--count;}
+};
+
+int B::count = 0;
+
+int main()
+{
+    {
+    std::unique_ptr<B[]> s(new B);
+    A* p = s.get();
+    std::unique_ptr<A[]> s2(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);
+}

Modified: libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/move_convert14.fail.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/move_convert14.fail.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/move_convert14.fail.cpp (original)
+++ libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/move_convert14.fail.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,61 @@
-//===----------------------------------------------------------------------===//
//
//                     The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//

// <memory>

// 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 <memory>
#include <cassert>

#include "../../deleter.h"

struct A
{
    static int count;
    A() {++count;}
    A(const A&) {++count;}
    virtual ~A() {--count;}
};

int A::count = 0;

struct B
    : public A
{
    static int count;
    B() {++count;}
    B(const B&) {++count;}
    virtual ~B() {--count;}
};

int B::count = 0;

int main()
{
    {
    std::unique_ptr<B[], Deleter<B[]> > s(new B);
    A* p = s.get
 ();
    std::unique_ptr<A[], Deleter<A[]> > s2(std::move(s));
    assert(s2.get() == p);
    assert(s.get() == 0);
    assert(A::count == 1);
    assert(B::count == 1);
    assert(s2.get_deleter().state() == 5);
    assert(s.get_deleter().state() == 0);
    }
    assert(A::count == 0);
    assert(B::count == 0);
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <memory>
+
+// 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 <memory>
+#include <cassert>
+
+#include "../../deleter.h"
+
+struct A
+{
+    static int count;
+    A() {++count;}
+    A(const A&) {++count;}
+    virtual ~A() {--count;}
+};
+
+int A::count = 0;
+
+struct B
+    : public A
+{
+    static int count;
+    B() {++count;}
+    B(const B&) {++count;}
+    virtual ~B() {--count;}
+};
+
+int B::count = 0;
+
+int main()
+{
+    {
+    std::unique_ptr<B[], Deleter<B[]> > s(new B);
+    A* p = s.get();
+    std::unique_ptr<A[], Deleter<A[]> > s2(std::move(s));
+    assert(s2.get() == p);
+    assert(s.get() == 0);
+    assert(A::count == 1);
+    assert(B::count == 1);
+    assert(s2.get_deleter().state() == 5);
+    assert(s.get_deleter().state() == 0);
+    }
+    assert(A::count == 0);
+    assert(B::count == 0);
+}

Modified: libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/move_convert15.fail.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/move_convert15.fail.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/move_convert15.fail.cpp (original)
+++ libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/move_convert15.fail.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,78 @@
-//===----------------------------------------------------------------------===//
//
//                     The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//

// <memory>

// 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 <memory>
#include <cassert>

struct A
{
    static int count;
    A() {++count;}
    A(const A&) {++count;}
    virtual ~A() {--count;}
};

int A::count = 0;

struct B
    : public A
{
    static int count;
    B() {++count;}
    B(const B&) {++count;}
    virtual ~B() {--count;}
};

int B::count = 0;

template <class T>
class CDeleter
{
    int state_;

    CDeleter(CDeleter&);
    CDeleter& operator=(CDeleter&);
 
public:

    CDeleter() : state_(5) {}

    int state() const {return state_;}
    void set_state(int s) {state_ = s;}

    void operator()(T* p) {delete p;}
};

int main()
{
    {
    CDeleter<A> d;
    std::unique_ptr<B[], CDeleter<A>&> s(new B, d);
    A* p = s.get();
    std::unique_ptr<A[], CDeleter<A>&> s2(std::move(s));
    assert(s2.get() == p);
    assert(s.get() == 0);
    assert(A::count == 1);
    assert(B::count == 1);
    d.set_state(6);
    assert(s2.get_deleter().state() == d.state());
    assert(s.get_deleter().state() ==  d.state());
    }
    assert(A::count == 0);
    assert(B::count == 0);
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <memory>
+
+// 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 <memory>
+#include <cassert>
+
+struct A
+{
+    static int count;
+    A() {++count;}
+    A(const A&) {++count;}
+    virtual ~A() {--count;}
+};
+
+int A::count = 0;
+
+struct B
+    : public A
+{
+    static int count;
+    B() {++count;}
+    B(const B&) {++count;}
+    virtual ~B() {--count;}
+};
+
+int B::count = 0;
+
+template <class T>
+class CDeleter
+{
+    int state_;
+
+    CDeleter(CDeleter&);
+    CDeleter& operator=(CDeleter&);
+public:
+
+    CDeleter() : state_(5) {}
+
+    int state() const {return state_;}
+    void set_state(int s) {state_ = s;}
+
+    void operator()(T* p) {delete p;}
+};
+
+int main()
+{
+    {
+    CDeleter<A> d;
+    std::unique_ptr<B[], CDeleter<A>&> s(new B, d);
+    A* p = s.get();
+    std::unique_ptr<A[], CDeleter<A>&> s2(std::move(s));
+    assert(s2.get() == p);
+    assert(s.get() == 0);
+    assert(A::count == 1);
+    assert(B::count == 1);
+    d.set_state(6);
+    assert(s2.get_deleter().state() == d.state());
+    assert(s.get_deleter().state() ==  d.state());
+    }
+    assert(A::count == 0);
+    assert(B::count == 0);
+}

Modified: libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/move_convert16.fail.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/move_convert16.fail.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/move_convert16.fail.cpp (original)
+++ libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/move_convert16.fail.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,57 @@
-//===----------------------------------------------------------------------===//
//
//                     The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//

// <memory>

// 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 <memory>
#include <cassert>

struct A
{
    static int count;
    A() {++count;}
    A(const A&) {++count;}
    virtual ~A() {--count;}
};

int A::count = 0;

struct B
    : public A
{
    static int count;
    B() {++count;}
    B(const B&) {++count;}
    virtual ~B() {--count;}
};

int B::count = 0;

int main()
{
    {
    std::unique_ptr<B[]> s(new B);
    A* p = s.get();
    std::unique_ptr<A[]> s2 = 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);
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <memory>
+
+// 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 <memory>
+#include <cassert>
+
+struct A
+{
+    static int count;
+    A() {++count;}
+    A(const A&) {++count;}
+    virtual ~A() {--count;}
+};
+
+int A::count = 0;
+
+struct B
+    : public A
+{
+    static int count;
+    B() {++count;}
+    B(const B&) {++count;}
+    virtual ~B() {--count;}
+};
+
+int B::count = 0;
+
+int main()
+{
+    {
+    std::unique_ptr<B[]> s(new B);
+    A* p = s.get();
+    std::unique_ptr<A[]> s2 = 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);
+}

Modified: libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/move_convert17.fail.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/move_convert17.fail.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/move_convert17.fail.cpp (original)
+++ libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/move_convert17.fail.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,61 @@
-//===----------------------------------------------------------------------===//
//
//                     The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//

// <memory>

// 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 <memory>
#include <cassert>

#include "../../deleter.h"

struct A
{
    static int count;
    A() {++count;}
    A(const A&) {++count;}
    virtual ~A() {--count;}
};

int A::count = 0;

struct B
    : public A
{
    static int count;
    B() {++count;}
    B(const B&) {++count;}
    virtual ~B() {--count;}
};

int B::count = 0;

int main()
{
    {
    std::unique_ptr<B[], Deleter<B[]> > s(new B);
    A* p = s.get
 ();
    std::unique_ptr<A[], Deleter<A[]> > s2 = std::move(s);
    assert(s2.get() == p);
    assert(s.get() == 0);
    assert(A::count == 1);
    assert(B::count == 1);
    assert(s2.get_deleter().state() == 5);
    assert(s.get_deleter().state() == 0);
    }
    assert(A::count == 0);
    assert(B::count == 0);
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <memory>
+
+// 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 <memory>
+#include <cassert>
+
+#include "../../deleter.h"
+
+struct A
+{
+    static int count;
+    A() {++count;}
+    A(const A&) {++count;}
+    virtual ~A() {--count;}
+};
+
+int A::count = 0;
+
+struct B
+    : public A
+{
+    static int count;
+    B() {++count;}
+    B(const B&) {++count;}
+    virtual ~B() {--count;}
+};
+
+int B::count = 0;
+
+int main()
+{
+    {
+    std::unique_ptr<B[], Deleter<B[]> > s(new B);
+    A* p = s.get();
+    std::unique_ptr<A[], Deleter<A[]> > s2 = std::move(s);
+    assert(s2.get() == p);
+    assert(s.get() == 0);
+    assert(A::count == 1);
+    assert(B::count == 1);
+    assert(s2.get_deleter().state() == 5);
+    assert(s.get_deleter().state() == 0);
+    }
+    assert(A::count == 0);
+    assert(B::count == 0);
+}

Modified: libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/move_convert18.fail.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/move_convert18.fail.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/move_convert18.fail.cpp (original)
+++ libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/move_convert18.fail.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,78 @@
-//===----------------------------------------------------------------------===//
//
//                     The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//

// <memory>

// 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 <memory>
#include <cassert>

struct A
{
    static int count;
    A() {++count;}
    A(const A&) {++count;}
    virtual ~A() {--count;}
};

int A::count = 0;

struct B
    : public A
{
    static int count;
    B() {++count;}
    B(const B&) {++count;}
    virtual ~B() {--count;}
};

int B::count = 0;

template <class T>
class CDeleter
{
    int state_;

    CDeleter(CDeleter&);
    CDeleter& operator=(CDeleter&);
 
public:

    CDeleter() : state_(5) {}

    int state() const {return state_;}
    void set_state(int s) {state_ = s;}

    void operator()(T* p) {delete p;}
};

int main()
{
    {
    CDeleter<A> d;
    std::unique_ptr<B[], CDeleter<A>&> s(new B, d);
    A* p = s.get();
    std::unique_ptr<A[], CDeleter<A>&> s2 = std::move(s);
    assert(s2.get() == p);
    assert(s.get() == 0);
    assert(A::count == 1);
    assert(B::count == 1);
    d.set_state(6);
    assert(s2.get_deleter().state() == d.state());
    assert(s.get_deleter().state() ==  d.state());
    }
    assert(A::count == 0);
    assert(B::count == 0);
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <memory>
+
+// 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 <memory>
+#include <cassert>
+
+struct A
+{
+    static int count;
+    A() {++count;}
+    A(const A&) {++count;}
+    virtual ~A() {--count;}
+};
+
+int A::count = 0;
+
+struct B
+    : public A
+{
+    static int count;
+    B() {++count;}
+    B(const B&) {++count;}
+    virtual ~B() {--count;}
+};
+
+int B::count = 0;
+
+template <class T>
+class CDeleter
+{
+    int state_;
+
+    CDeleter(CDeleter&);
+    CDeleter& operator=(CDeleter&);
+public:
+
+    CDeleter() : state_(5) {}
+
+    int state() const {return state_;}
+    void set_state(int s) {state_ = s;}
+
+    void operator()(T* p) {delete p;}
+};
+
+int main()
+{
+    {
+    CDeleter<A> d;
+    std::unique_ptr<B[], CDeleter<A>&> s(new B, d);
+    A* p = s.get();
+    std::unique_ptr<A[], CDeleter<A>&> s2 = std::move(s);
+    assert(s2.get() == p);
+    assert(s.get() == 0);
+    assert(A::count == 1);
+    assert(B::count == 1);
+    d.set_state(6);
+    assert(s2.get_deleter().state() == d.state());
+    assert(s.get_deleter().state() ==  d.state());
+    }
+    assert(A::count == 0);
+    assert(B::count == 0);
+}

Modified: libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/nullptr.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/nullptr.pass.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/nullptr.pass.cpp (original)
+++ libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/nullptr.pass.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,46 @@
-//===----------------------------------------------------------------------===//
//
//                     The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//

// <memory>

// unique_ptr

// unique_ptr(nullptr_t);

#include <memory>
#include <cassert>

// default unique_ptr ctor should only require default Deleter ctor
class Deleter
{
    int state_;

    Deleter(Deleter&);
    Deleter& operator=(Deleter&);

public:
    Deleter() : state_(5) {}

    int state() const {return state_;}

    void operator()(void*) {}
};


int main()
{
    {
    std::unique_ptr<int[]> p(nullptr);
    assert(p.get() == 0);
    }
    {
    std::unique_ptr<int[], Deleter> p(nullptr);
    assert(p.get() == 0);
    assert(p.get_deleter().state() == 5);
    }
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <memory>
+
+// unique_ptr
+
+// unique_ptr(nullptr_t);
+
+#include <memory>
+#include <cassert>
+
+// default unique_ptr ctor should only require default Deleter ctor
+class Deleter
+{
+    int state_;
+
+    Deleter(Deleter&);
+    Deleter& operator=(Deleter&);
+
+public:
+    Deleter() : state_(5) {}
+
+    int state() const {return state_;}
+
+    void operator()(void*) {}
+};
+
+int main()
+{
+    {
+    std::unique_ptr<int[]> p(nullptr);
+    assert(p.get() == 0);
+    }
+    {
+    std::unique_ptr<int[], Deleter> p(nullptr);
+    assert(p.get() == 0);
+    assert(p.get_deleter().state() == 5);
+    }
+}

Modified: libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/pointer01.fail.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/pointer01.fail.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/pointer01.fail.cpp (original)
+++ libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/pointer01.fail.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,36 @@
-//===----------------------------------------------------------------------===//
//
//                     The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//

// <memory>

// unique_ptr

// Test unique_ptr<T[]>(pointer) ctor

// unique_ptr<T[]>(pointer) ctor should require default Deleter ctor

#include <memory>

class Deleter
{

    Deleter() {}

public:

    Deleter(Deleter&) {}
    Deleter& operator=(Deleter&) {}

    void operator()(void*) const {}
};


int main()
{
    std::unique_ptr<int[], Deleter> p(new int);
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <memory>
+
+// unique_ptr
+
+// Test unique_ptr<T[]>(pointer) ctor
+
+// unique_ptr<T[]>(pointer) ctor should require default Deleter ctor
+
+#include <memory>
+
+class Deleter
+{
+
+    Deleter() {}
+
+public:
+
+    Deleter(Deleter&) {}
+    Deleter& operator=(Deleter&) {}
+
+    void operator()(void*) const {}
+};
+
+int main()
+{
+    std::unique_ptr<int[], Deleter> p(new int);
+}

Modified: libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/pointer01.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/pointer01.pass.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/pointer01.pass.cpp (original)
+++ libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/pointer01.pass.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,63 @@
-//===----------------------------------------------------------------------===//
//
//                     The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//

// <memory>

// unique_ptr

// Test unique_ptr(pointer) ctor

// unique_ptr<T[]>(pointer) ctor should only require default Deleter ctor

#include <memory>
#include <cassert>

struct A
{
    static int count;
    A() {++count;}
    A(const A&) {++count;}
    ~A() {--count;}
};

int A::count = 0;

class Deleter
{
    int state_;

    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<A[]> s(p);
    assert(s.get() == p);
    }
    as
 sert(A::count == 0);
    {
    A* p = new A[3];
    assert(A::count == 3);
    std::unique_ptr<A[], Deleter> s(p);
    assert(s.get() == p);
    assert(s.get_deleter().state() == 5);
    }
    assert(A::count == 0);
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <memory>
+
+// unique_ptr
+
+// Test unique_ptr(pointer) ctor
+
+// unique_ptr<T[]>(pointer) ctor should only require default Deleter ctor
+
+#include <memory>
+#include <cassert>
+
+struct A
+{
+    static int count;
+    A() {++count;}
+    A(const A&) {++count;}
+    ~A() {--count;}
+};
+
+int A::count = 0;
+
+class Deleter
+{
+    int state_;
+
+    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<A[]> s(p);
+    assert(s.get() == p);
+    }
+    assert(A::count == 0);
+    {
+    A* p = new A[3];
+    assert(A::count == 3);
+    std::unique_ptr<A[], Deleter> s(p);
+    assert(s.get() == p);
+    assert(s.get_deleter().state() == 5);
+    }
+    assert(A::count == 0);
+}

Modified: libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/pointer02.fail.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/pointer02.fail.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/pointer02.fail.cpp (original)
+++ libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/pointer02.fail.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,29 @@
-//===----------------------------------------------------------------------===//
//
//                     The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//

// <memory>

// unique_ptr

// Test unique_ptr<T[]>(pointer) ctor

#include <memory>

// unique_ptr<T[]>(pointer) ctor should require non-reference Deleter ctor
class Deleter
{
public:

    void operator()(void*) {}
};


int main()
{
    std::unique_ptr<int[], Deleter&> p(new int);
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <memory>
+
+// unique_ptr
+
+// Test unique_ptr<T[]>(pointer) ctor
+
+#include <memory>
+
+// unique_ptr<T[]>(pointer) ctor should require non-reference Deleter ctor
+class Deleter
+{
+public:
+
+    void operator()(void*) {}
+};
+
+int main()
+{
+    std::unique_ptr<int[], Deleter&> p(new int);
+}

Modified: libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/pointer02.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/pointer02.pass.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/pointer02.pass.cpp (original)
+++ libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/pointer02.pass.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,95 @@
-//===----------------------------------------------------------------------===//
//
//                     The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//

// <memory>

// unique_ptr

// Test unique_ptr<T[]>(pointer) ctor

// unique_ptr<T[]>(pointer) ctor shouldn't require complete type

#include <memory>
#include <cassert>

struct A;

class Deleter
{
    int state_;

    Deleter(Deleter&);
    Deleter& operator=(Deleter&);

public:
    Deleter() : state_(5) {}

    int state() const {return state_;}

    void operator()(A* p);
};

void check(int i);

template <class D = std::default_delete<A[]> >
struct B
{
    std::unique_ptr<A[], D> a_;
    explicit B(A*);
    ~B();

    A* get() const {return a_.get();}
    D& get_deleter() {return a_.get_deleter();}
};

A* get();

int main()
{
    {
    
 A* p = get();
    check(3);
    B<> s(p);
    assert(s.get() == p);
    }
    check(0);
    {
    A* p = get();
    check(3);
    B<Deleter> s(p);
    assert(s.get() == p);
    assert(s.get_deleter().state() == 5);
    }
    check(0);
}

struct A
{
    static int count;
    A() {++count;}
    A(const A&) {++count;}
    ~A() {--count;}
};

int A::count = 0;

A* get() {return new A[3];}

void Deleter::operator()(A* p) {delete [] p;}

void check(int i)
{
    assert(A::count == i);
}

template <class D>
B<D>::B(A* a) : a_(a) {}

template <class D>
B<D>::~B() {}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <memory>
+
+// unique_ptr
+
+// Test unique_ptr<T[]>(pointer) ctor
+
+// unique_ptr<T[]>(pointer) ctor shouldn't require complete type
+
+#include <memory>
+#include <cassert>
+
+struct A;
+
+class Deleter
+{
+    int state_;
+
+    Deleter(Deleter&);
+    Deleter& operator=(Deleter&);
+
+public:
+    Deleter() : state_(5) {}
+
+    int state() const {return state_;}
+
+    void operator()(A* p);
+};
+
+void check(int i);
+
+template <class D = std::default_delete<A[]> >
+struct B
+{
+    std::unique_ptr<A[], D> a_;
+    explicit B(A*);
+    ~B();
+
+    A* get() const {return a_.get();}
+    D& get_deleter() {return a_.get_deleter();}
+};
+
+A* get();
+
+int main()
+{
+    {
+    A* p = get();
+    check(3);
+    B<> s(p);
+    assert(s.get() == p);
+    }
+    check(0);
+    {
+    A* p = get();
+    check(3);
+    B<Deleter> s(p);
+    assert(s.get() == p);
+    assert(s.get_deleter().state() == 5);
+    }
+    check(0);
+}
+
+struct A
+{
+    static int count;
+    A() {++count;}
+    A(const A&) {++count;}
+    ~A() {--count;}
+};
+
+int A::count = 0;
+
+A* get() {return new A[3];}
+
+void Deleter::operator()(A* p) {delete [] p;}
+
+void check(int i)
+{
+    assert(A::count == i);
+}
+
+template <class D>
+B<D>::B(A* a) : a_(a) {}
+
+template <class D>
+B<D>::~B() {}

Modified: libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/pointer03.fail.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/pointer03.fail.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/pointer03.fail.cpp (original)
+++ libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/pointer03.fail.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,23 @@
-//===----------------------------------------------------------------------===//
//
//                     The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//

// <memory>

// unique_ptr

// Test unique_ptr<T[]>(pointer) ctor

// unique_ptr<T[]>(pointer) ctor should require non-pointer Deleter

#include <memory>

int main()
{
    std::unique_ptr<int[], void (*)(void*)> p(new int);
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <memory>
+
+// unique_ptr
+
+// Test unique_ptr<T[]>(pointer) ctor
+
+// unique_ptr<T[]>(pointer) ctor should require non-pointer Deleter
+
+#include <memory>
+
+int main()
+{
+    std::unique_ptr<int[], void (*)(void*)> p(new int);
+}

Modified: libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/pointer04.fail.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/pointer04.fail.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/pointer04.fail.cpp (original)
+++ libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/pointer04.fail.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,67 @@
-//===----------------------------------------------------------------------===//
//
//                     The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//

// <memory>

// unique_ptr

// Test unique_ptr(pointer) ctor

// unique_ptr(pointer) ctor should not work with derived pointers

#include <memory>
#include <cassert>

struct A
{
    static int count;
    A() {++count;}
    A(const A&) {++count;}
    virtual ~A() {--count;}
};

int A::count = 0;

struct B
    : public A
{
    static int count;
    B() {++count;}
    B(const B&) {++count;}
    virtual ~B() {--count;}
};

int B::count = 0;

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<A[]> s(p);
    }
    {
    B* p = new B[3];
    std::unique_ptr<A[], Deleter> s(p);
    }
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <memory>
+
+// unique_ptr
+
+// Test unique_ptr(pointer) ctor
+
+// unique_ptr(pointer) ctor should not work with derived pointers
+
+#include <memory>
+#include <cassert>
+
+struct A
+{
+    static int count;
+    A() {++count;}
+    A(const A&) {++count;}
+    virtual ~A() {--count;}
+};
+
+int A::count = 0;
+
+struct B
+    : public A
+{
+    static int count;
+    B() {++count;}
+    B(const B&) {++count;}
+    virtual ~B() {--count;}
+};
+
+int B::count = 0;
+
+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<A[]> s(p);
+    }
+    {
+    B* p = new B[3];
+    std::unique_ptr<A[], Deleter> s(p);
+    }
+}

Modified: libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/pointer_deleter01.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/pointer_deleter01.pass.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/pointer_deleter01.pass.cpp (original)
+++ libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/pointer_deleter01.pass.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,43 @@
-//===----------------------------------------------------------------------===//
//
//                     The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//

// <memory>

// unique_ptr

// Test unique_ptr(pointer, deleter) ctor

// unique_ptr(pointer, deleter()) only requires MoveConstructible deleter

#include <memory>
#include <cassert>

#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<A[], Deleter<A[]> > s(p, Deleter<A[]>());
    assert(s.get() == p);
    assert(s.get_deleter().state() == 0);
    }
    assert(A::count == 0);
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <memory>
+
+// unique_ptr
+
+// Test unique_ptr(pointer, deleter) ctor
+
+// unique_ptr(pointer, deleter()) only requires MoveConstructible deleter
+
+#include <memory>
+#include <cassert>
+
+#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<A[], Deleter<A[]> > s(p, Deleter<A[]>());
+    assert(s.get() == p);
+    assert(s.get_deleter().state() == 0);
+    }
+    assert(A::count == 0);
+}

Modified: libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/pointer_deleter02.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/pointer_deleter02.pass.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/pointer_deleter02.pass.cpp (original)
+++ libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/pointer_deleter02.pass.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,58 @@
-//===----------------------------------------------------------------------===//
//
//                     The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//

// <memory>

// unique_ptr

// Test unique_ptr(pointer, deleter) ctor

// unique_ptr(pointer, d) requires CopyConstructible deleter

#include <memory>
#include <cassert>

struct A
{
    static int count;
    A() {++count;}
    A(const A&) {++count;}
    ~A() {--count;}
};

int A::count = 0;

class Deleter
{
    int state_;

public:

    Deleter() : state_(5) {}

    int state() const {return state_;}
    void set_state(int s) {state_ = s;}

    void operator()(A* p) {delete [] p;}
};

int main()
{
    {
    A* p = new A[3];
    assert(A::count == 3);
    Deleter d;
    std::unique_ptr<A[], Deleter> s(p, d);
    assert(s.get() == p);
    as
 sert(s.get_deleter().state() == 5);
    d.set_state(6);
    assert(s.get_deleter().state() == 5);
    }
    assert(A::count == 0);
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <memory>
+
+// unique_ptr
+
+// Test unique_ptr(pointer, deleter) ctor
+
+// unique_ptr(pointer, d) requires CopyConstructible deleter
+
+#include <memory>
+#include <cassert>
+
+struct A
+{
+    static int count;
+    A() {++count;}
+    A(const A&) {++count;}
+    ~A() {--count;}
+};
+
+int A::count = 0;
+
+class Deleter
+{
+    int state_;
+
+public:
+
+    Deleter() : state_(5) {}
+
+    int state() const {return state_;}
+    void set_state(int s) {state_ = s;}
+
+    void operator()(A* p) {delete [] p;}
+};
+
+int main()
+{
+    {
+    A* p = new A[3];
+    assert(A::count == 3);
+    Deleter d;
+    std::unique_ptr<A[], Deleter> s(p, d);
+    assert(s.get() == p);
+    assert(s.get_deleter().state() == 5);
+    d.set_state(6);
+    assert(s.get_deleter().state() == 5);
+    }
+    assert(A::count == 0);
+}

Modified: libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/pointer_deleter03.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/pointer_deleter03.pass.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/pointer_deleter03.pass.cpp (original)
+++ libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/pointer_deleter03.pass.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,60 @@
-//===----------------------------------------------------------------------===//
//
//                     The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//

// <memory>

// unique_ptr

// Test unique_ptr(pointer, deleter) ctor

// unique_ptr<T[], D&>(pointer, d) does not requires CopyConstructible deleter

#include <memory>
#include <cassert>

struct A
{
    static int count;
    A() {++count;}
    A(const A&) {++count;}
    ~A() {--count;}
};

int A::count = 0;

class Deleter
{
    int state_;

    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<A[], Deleter&> s(p, d);
    assert(s.get() == p);
    assert(s.get_deleter().state() == 5);
    d.set_state(6);
    assert(s.get_deleter().state() == 6);
    }
    assert(A::count == 0);
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <memory>
+
+// unique_ptr
+
+// Test unique_ptr(pointer, deleter) ctor
+
+// unique_ptr<T[], D&>(pointer, d) does not requires CopyConstructible deleter
+
+#include <memory>
+#include <cassert>
+
+struct A
+{
+    static int count;
+    A() {++count;}
+    A(const A&) {++count;}
+    ~A() {--count;}
+};
+
+int A::count = 0;
+
+class Deleter
+{
+    int state_;
+
+    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<A[], Deleter&> s(p, d);
+    assert(s.get() == p);
+    assert(s.get_deleter().state() == 5);
+    d.set_state(6);
+    assert(s.get_deleter().state() == 6);
+    }
+    assert(A::count == 0);
+}

Modified: libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/pointer_deleter04.fail.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/pointer_deleter04.fail.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/pointer_deleter04.fail.cpp (original)
+++ libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/pointer_deleter04.fail.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,55 @@
-//===----------------------------------------------------------------------===//
//
//                     The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//

// <memory>

// unique_ptr

// Test unique_ptr(pointer, deleter) ctor

// unique_ptr<T, const D&>(pointer, D()) should not compile

#include <memory>
#include <cassert>

struct A
{
    static int count;
    A() {++count;}
    A(const A&) {++count;}
    ~A() {--count;}
};

int A::count = 0;

class Deleter
{
    int state_;

public:

    Deleter() : state_(5) {}

    int state() const {return state_;}
    void set_state(int s) {state_ = s;}

    void operator()(A* p) const {delete [] p;}
};

int main()
{
    {
    A* p = new A[3];
    assert(A::count == 3);
    std::unique_ptr<A[], const Deleter&> s(p, Deleter());
    assert(s.get() == p);
 
    assert(s.get_deleter().state() == 5);
    }
    assert(A::count == 0);
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <memory>
+
+// unique_ptr
+
+// Test unique_ptr(pointer, deleter) ctor
+
+// unique_ptr<T, const D&>(pointer, D()) should not compile
+
+#include <memory>
+#include <cassert>
+
+struct A
+{
+    static int count;
+    A() {++count;}
+    A(const A&) {++count;}
+    ~A() {--count;}
+};
+
+int A::count = 0;
+
+class Deleter
+{
+    int state_;
+
+public:
+
+    Deleter() : state_(5) {}
+
+    int state() const {return state_;}
+    void set_state(int s) {state_ = s;}
+
+    void operator()(A* p) const {delete [] p;}
+};
+
+int main()
+{
+    {
+    A* p = new A[3];
+    assert(A::count == 3);
+    std::unique_ptr<A[], const Deleter&> s(p, Deleter());
+    assert(s.get() == p);
+    assert(s.get_deleter().state() == 5);
+    }
+    assert(A::count == 0);
+}

Modified: libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/pointer_deleter04.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/pointer_deleter04.pass.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/pointer_deleter04.pass.cpp (original)
+++ libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/pointer_deleter04.pass.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,58 @@
-//===----------------------------------------------------------------------===//
//
//                     The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//

// <memory>

// unique_ptr

// Test unique_ptr(pointer, deleter) ctor

// unique_ptr<T[], const D&>(pointer, d) does not requires CopyConstructible deleter

#include <memory>
#include <cassert>

struct A
{
    static int count;
    A() {++count;}
    A(const A&) {++count;}
    ~A() {--count;}
};

int A::count = 0;

class Deleter
{
    int state_;

    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::coun
 t == 3);
    Deleter d;
    std::unique_ptr<A[], const Deleter&> s(p, d);
    assert(s.get() == p);
    assert(s.get_deleter().state() == 5);
    }
    assert(A::count == 0);
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <memory>
+
+// unique_ptr
+
+// Test unique_ptr(pointer, deleter) ctor
+
+// unique_ptr<T[], const D&>(pointer, d) does not requires CopyConstructible deleter
+
+#include <memory>
+#include <cassert>
+
+struct A
+{
+    static int count;
+    A() {++count;}
+    A(const A&) {++count;}
+    ~A() {--count;}
+};
+
+int A::count = 0;
+
+class Deleter
+{
+    int state_;
+
+    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<A[], const Deleter&> s(p, d);
+    assert(s.get() == p);
+    assert(s.get_deleter().state() == 5);
+    }
+    assert(A::count == 0);
+}

Modified: libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/pointer_deleter05.fail.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/pointer_deleter05.fail.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/pointer_deleter05.fail.cpp (original)
+++ libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/pointer_deleter05.fail.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,58 @@
-//===----------------------------------------------------------------------===//
//
//                     The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//

// <memory>

// unique_ptr

// Test unique_ptr(pointer, deleter) ctor

// unique_ptr(pointer, deleter) should not work with derived pointers

#include <memory>
#include <cassert>

struct A
{
    static int count;
    A() {++count;}
    A(const A&) {++count;}
    virtual ~A() {--count;}
};

int A::count = 0;

struct B
    : public A
{
    static int count;
    B() {++count;}
    B(const B&) {++count;}
    virtual ~B() {--count;}
};

int B::count = 0;

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<A[], Deleter> s(p, Deleter());
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <memory>
+
+// unique_ptr
+
+// Test unique_ptr(pointer, deleter) ctor
+
+// unique_ptr(pointer, deleter) should not work with derived pointers
+
+#include <memory>
+#include <cassert>
+
+struct A
+{
+    static int count;
+    A() {++count;}
+    A(const A&) {++count;}
+    virtual ~A() {--count;}
+};
+
+int A::count = 0;
+
+struct B
+    : public A
+{
+    static int count;
+    B() {++count;}
+    B(const B&) {++count;}
+    virtual ~B() {--count;}
+};
+
+int B::count = 0;
+
+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<A[], Deleter> s(p, Deleter());
+}

Modified: libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.modifiers/release.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.modifiers/release.pass.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.modifiers/release.pass.cpp (original)
+++ libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.modifiers/release.pass.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,27 @@
-//===----------------------------------------------------------------------===//
//
//                     The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//

// <memory>

// unique_ptr

// test release

#include <memory>
#include <cassert>

int main()
{
    std::unique_ptr<int[]> p(new int[3]);
    int* i = p.get();
    int* j = p.release();
    assert(p.get() == 0);
    assert(i == j);
    delete [] j;
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <memory>
+
+// unique_ptr
+
+// test release
+
+#include <memory>
+#include <cassert>
+
+int main()
+{
+    std::unique_ptr<int[]> p(new int[3]);
+    int* i = p.get();
+    int* j = p.release();
+    assert(p.get() == 0);
+    assert(i == j);
+    delete [] j;
+}

Modified: libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.modifiers/reset1.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.modifiers/reset1.pass.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.modifiers/reset1.pass.cpp (original)
+++ libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.modifiers/reset1.pass.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,48 @@
-//===----------------------------------------------------------------------===//
//
//                     The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//

// <memory>

// unique_ptr

// test reset

#include <memory>
#include <cassert>

struct A
{
    static int count;
    A() {++count;}
    A(const A&) {++count;}
    ~A() {--count;}
};

int A::count = 0;

int main()
{
    {
    std::unique_ptr<A[]> p(new A[3]);
    assert(A::count == 3);
    A* i = p.get();
    p.reset();
    assert(A::count == 0);
    assert(p.get() == 0);
    }
    assert(A::count == 0);
    {
    std::unique_ptr<A[]> p(new A[4]);
    assert(A::count == 4);
    A* i = p.get();
    p.reset(new A[5]);
    assert(A::count == 5);
    }
    assert(A::count == 0);
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <memory>
+
+// unique_ptr
+
+// test reset
+
+#include <memory>
+#include <cassert>
+
+struct A
+{
+    static int count;
+    A() {++count;}
+    A(const A&) {++count;}
+    ~A() {--count;}
+};
+
+int A::count = 0;
+
+int main()
+{
+    {
+    std::unique_ptr<A[]> p(new A[3]);
+    assert(A::count == 3);
+    A* i = p.get();
+    p.reset();
+    assert(A::count == 0);
+    assert(p.get() == 0);
+    }
+    assert(A::count == 0);
+    {
+    std::unique_ptr<A[]> p(new A[4]);
+    assert(A::count == 4);
+    A* i = p.get();
+    p.reset(new A[5]);
+    assert(A::count == 5);
+    }
+    assert(A::count == 0);
+}

Modified: libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.modifiers/reset2.fail.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.modifiers/reset2.fail.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.modifiers/reset2.fail.cpp (original)
+++ libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.modifiers/reset2.fail.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,64 @@
-//===----------------------------------------------------------------------===//
//
//                     The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//

// <memory>

// unique_ptr

// test reset

#include <memory>
#include <cassert>

struct A
{
    static int count;
    A() {++count;}
    A(const A&) {++count;}
    virtual ~A() {--count;}
};

int A::count = 0;

struct B
    : public A
{
    static int count;
    B() {++count;}
    B(const B&) {++count;}
    virtual ~B() {--count;}
};

int B::count = 0;

int main()
{
    {
    std::unique_ptr<A[]> 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<A[]
 > 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);
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <memory>
+
+// unique_ptr
+
+// test reset
+
+#include <memory>
+#include <cassert>
+
+struct A
+{
+    static int count;
+    A() {++count;}
+    A(const A&) {++count;}
+    virtual ~A() {--count;}
+};
+
+int A::count = 0;
+
+struct B
+    : public A
+{
+    static int count;
+    B() {++count;}
+    B(const B&) {++count;}
+    virtual ~B() {--count;}
+};
+
+int B::count = 0;
+
+int main()
+{
+    {
+    std::unique_ptr<A[]> 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<A[]> 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);
+}

Modified: libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.modifiers/swap.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.modifiers/swap.pass.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.modifiers/swap.pass.cpp (original)
+++ libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.modifiers/swap.pass.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,56 @@
-//===----------------------------------------------------------------------===//
//
//                     The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//

// <memory>

// unique_ptr

// test swap

#include <memory>
#include <cassert>

#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<A[], Deleter<A[]> > s1(p1, Deleter<A[]>(1));
    A* p2 = new A[3];
    std::unique_ptr<A[], Deleter<A[]> > 
 s2(p2, Deleter<A[]>(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);
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <memory>
+
+// unique_ptr
+
+// test swap
+
+#include <memory>
+#include <cassert>
+
+#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<A[], Deleter<A[]> > s1(p1, Deleter<A[]>(1));
+    A* p2 = new A[3];
+    std::unique_ptr<A[], Deleter<A[]> > s2(p2, Deleter<A[]>(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);
+}

Modified: libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.observers/dereference.fail.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.observers/dereference.fail.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.observers/dereference.fail.cpp (original)
+++ libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.observers/dereference.fail.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,23 @@
-//===----------------------------------------------------------------------===//
//
//                     The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//

// <memory>

// unique_ptr

// test op*()

#include <memory>
#include <cassert>

int main()
{
    std::unique_ptr<int[]> p(new int(3));
    assert(*p == 3);
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <memory>
+
+// unique_ptr
+
+// test op*()
+
+#include <memory>
+#include <cassert>
+
+int main()
+{
+    std::unique_ptr<int[]> p(new int(3));
+    assert(*p == 3);
+}

Modified: libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.observers/explicit_bool.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.observers/explicit_bool.pass.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.observers/explicit_bool.pass.cpp (original)
+++ libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.observers/explicit_bool.pass.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,39 @@
-//===----------------------------------------------------------------------===//
//
//                     The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//

// <memory>

// unique_ptr

// test op*()

#include <memory>
#include <cassert>

int main()
{
    {
    std::unique_ptr<int[]> p(new int [3]);
    if (p)
        ;
    else
        assert(false);
    if (!p)
        assert(false);
    }
    {
    std::unique_ptr<int[]> p;
    if (!p)
        ;
    else
        assert(false);
    if (p)
        assert(false);
    }
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <memory>
+
+// unique_ptr
+
+// test op*()
+
+#include <memory>
+#include <cassert>
+
+int main()
+{
+    {
+    std::unique_ptr<int[]> p(new int [3]);
+    if (p)
+        ;
+    else
+        assert(false);
+    if (!p)
+        assert(false);
+    }
+    {
+    std::unique_ptr<int[]> p;
+    if (!p)
+        ;
+    else
+        assert(false);
+    if (p)
+        assert(false);
+    }
+}

Modified: libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.observers/get.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.observers/get.pass.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.observers/get.pass.cpp (original)
+++ libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.observers/get.pass.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,24 @@
-//===----------------------------------------------------------------------===//
//
//                     The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//

// <memory>

// unique_ptr

// test get

#include <memory>
#include <cassert>

int main()
{
    int* p = new int[3];
    std::unique_ptr<int[]> s(p);
    assert(s.get() == p);
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <memory>
+
+// unique_ptr
+
+// test get
+
+#include <memory>
+#include <cassert>
+
+int main()
+{
+    int* p = new int[3];
+    std::unique_ptr<int[]> s(p);
+    assert(s.get() == p);
+}

Modified: libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.observers/get_deleter.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.observers/get_deleter.pass.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.observers/get_deleter.pass.cpp (original)
+++ libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.observers/get_deleter.pass.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,37 @@
-//===----------------------------------------------------------------------===//
//
//                     The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//

// <memory>

// unique_ptr

// test get_deleter()

#include <memory>
#include <cassert>

struct Deleter
{
    void operator()(void*) {}

    int test() {return 5;}
    int test() const {return 6;}
};

int main()
{
    {
    std::unique_ptr<int[], Deleter> p;
    assert(p.get_deleter().test() == 5);
    }
    {
    const std::unique_ptr<int[], Deleter> p;
    assert(p.get_deleter().test() == 6);
    }
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <memory>
+
+// unique_ptr
+
+// test get_deleter()
+
+#include <memory>
+#include <cassert>
+
+struct Deleter
+{
+    void operator()(void*) {}
+
+    int test() {return 5;}
+    int test() const {return 6;}
+};
+
+int main()
+{
+    {
+    std::unique_ptr<int[], Deleter> p;
+    assert(p.get_deleter().test() == 5);
+    }
+    {
+    const std::unique_ptr<int[], Deleter> p;
+    assert(p.get_deleter().test() == 6);
+    }
+}

Modified: libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.observers/index.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.observers/index.pass.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.observers/index.pass.cpp (original)
+++ libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.observers/index.pass.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,47 @@
-//===----------------------------------------------------------------------===//
//
//                     The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//

// <memory>

// unique_ptr

// test op[](size_t)

#include <memory>
#include <cassert>

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<A[]> 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);
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <memory>
+
+// unique_ptr
+
+// test op[](size_t)
+
+#include <memory>
+#include <cassert>
+
+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<A[]> 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);
+}

Modified: libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.observers/op_arrow.fail.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.observers/op_arrow.fail.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.observers/op_arrow.fail.cpp (original)
+++ libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.observers/op_arrow.fail.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,30 @@
-//===----------------------------------------------------------------------===//
//
//                     The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//

// <memory>

// unique_ptr

// test op->()

#include <memory>
#include <cassert>

struct A
{
    int i_;

    A() : i_(7) {}
};

int main()
{
    std::unique_ptr<A[]> p(new A);
    assert(p->i_ == 7);
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <memory>
+
+// unique_ptr
+
+// test op->()
+
+#include <memory>
+#include <cassert>
+
+struct A
+{
+    int i_;
+
+    A() : i_(7) {}
+};
+
+int main()
+{
+    std::unique_ptr<A[]> p(new A);
+    assert(p->i_ == 7);
+}

Modified: libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/pointer_type.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/pointer_type.pass.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/pointer_type.pass.cpp (original)
+++ libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/pointer_type.pass.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,34 @@
-//===----------------------------------------------------------------------===//
//
//                     The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//

// <memory>

// unique_ptr

// Test unique_ptr::pointer type

#include <memory>
#include <type_traits>

struct Deleter
{
    struct pointer {};
};

int main()
{
    {
    typedef std::unique_ptr<int> P;
    static_assert((std::is_same<P::pointer, int*>::value), "");
    }
    {
    typedef std::unique_ptr<int, Deleter> P;
    static_assert((std::is_same<P::pointer, Deleter::pointer>::value), "");
    }
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <memory>
+
+// unique_ptr
+
+// Test unique_ptr::pointer type
+
+#include <memory>
+#include <type_traits>
+
+struct Deleter
+{
+    struct pointer {};
+};
+
+int main()
+{
+    {
+    typedef std::unique_ptr<int> P;
+    static_assert((std::is_same<P::pointer, int*>::value), "");
+    }
+    {
+    typedef std::unique_ptr<int, Deleter> P;
+    static_assert((std::is_same<P::pointer, Deleter::pointer>::value), "");
+    }
+}

Modified: libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.asgn/move01.fail.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.asgn/move01.fail.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.asgn/move01.fail.cpp (original)
+++ libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.asgn/move01.fail.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,38 @@
-//===----------------------------------------------------------------------===//
//
//                     The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//

// <memory>

// unique_ptr

// Test unique_ptr move assignment

#include <memory>
#include <cassert>

// Can't copy from lvalue

struct A
{
    static int count;
    A() {++count;}
    A(const A&) {++count;}
    ~A() {--count;}
};

int A::count = 0;

int main()
{
    {
    std::unique_ptr<A> s(new A);
    std::unique_ptr<A> s2;
    s2 = s;
    }
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <memory>
+
+// unique_ptr
+
+// Test unique_ptr move assignment
+
+#include <memory>
+#include <cassert>
+
+// Can't copy from lvalue
+
+struct A
+{
+    static int count;
+    A() {++count;}
+    A(const A&) {++count;}
+    ~A() {--count;}
+};
+
+int A::count = 0;
+
+int main()
+{
+    {
+    std::unique_ptr<A> s(new A);
+    std::unique_ptr<A> s2;
+    s2 = s;
+    }
+}

Modified: libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.asgn/move01.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.asgn/move01.pass.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.asgn/move01.pass.cpp (original)
+++ libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.asgn/move01.pass.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,74 @@
-//===----------------------------------------------------------------------===//
//
//                     The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//

// <memory>

// 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 <memory>
#include <cassert>

#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<A> s1(new A);
    A* p = s1.get();
    std::unique_ptr<A> 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<A, Deleter<A> > s1(new A, Deleter<A>(5));
    A* p = s1.get();
    std::unique_ptr<A, Deleter<A> > 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<A> d1(5);
    std::unique_ptr<A, CDeleter<A>&> s1(new A, d1);
    A* p = s1.get();
    CDeleter<A> d2(6);
    std::unique_ptr<A, CDeleter<A>&> 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);
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <memory>
+
+// 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 <memory>
+#include <cassert>
+
+#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<A> s1(new A);
+    A* p = s1.get();
+    std::unique_ptr<A> 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<A, Deleter<A> > s1(new A, Deleter<A>(5));
+    A* p = s1.get();
+    std::unique_ptr<A, Deleter<A> > 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<A> d1(5);
+    std::unique_ptr<A, CDeleter<A>&> s1(new A, d1);
+    A* p = s1.get();
+    CDeleter<A> d2(6);
+    std::unique_ptr<A, CDeleter<A>&> 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);
+}

Modified: libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.asgn/move02.fail.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.asgn/move02.fail.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.asgn/move02.fail.cpp (original)
+++ libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.asgn/move02.fail.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,38 @@
-//===----------------------------------------------------------------------===//
//
//                     The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//

// <memory>

// unique_ptr

// Test unique_ptr move assignment

#include <memory>
#include <cassert>

// Can't copy from const lvalue

struct A
{
    static int count;
    A() {++count;}
    A(const A&) {++count;}
    ~A() {--count;}
};

int A::count = 0;

int main()
{
    {
    const std::unique_ptr<A> s(new A);
    std::unique_ptr<A> s2;
    s2 = s;
    }
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <memory>
+
+// unique_ptr
+
+// Test unique_ptr move assignment
+
+#include <memory>
+#include <cassert>
+
+// Can't copy from const lvalue
+
+struct A
+{
+    static int count;
+    A() {++count;}
+    A(const A&) {++count;}
+    ~A() {--count;}
+};
+
+int A::count = 0;
+
+int main()
+{
+    {
+    const std::unique_ptr<A> s(new A);
+    std::unique_ptr<A> s2;
+    s2 = s;
+    }
+}

Modified: libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.asgn/move03.fail.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.asgn/move03.fail.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.asgn/move03.fail.cpp (original)
+++ libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.asgn/move03.fail.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,56 @@
-//===----------------------------------------------------------------------===//
//
//                     The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//

// <memory>

// unique_ptr

// Test unique_ptr move assignment

#include <memory>
#include <cassert>

// Can't copy from lvalue

struct A
{
    static int count;
    A() {++count;}
    A(const A&) {++count;}
    ~A() {--count;}
};

int A::count = 0;

class Deleter
{
    int state_;

public:

    Deleter() : state_(5) {}

    int state() const {return state_;}

    void operator()(A* p) {delete p;}
};

int main()
{
    {
    std::unique_ptr<A, Deleter> s(new A);
    A* p = s.get();
    std::unique_ptr<A, Deleter> s2;
    s2 = s;
    assert(s2.get() == p);
    assert(s.get() == 0);
    assert(A::count == 1);
    }
    assert(A::count == 0);
 }
\ No newline at end of file
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <memory>
+
+// unique_ptr
+
+// Test unique_ptr move assignment
+
+#include <memory>
+#include <cassert>
+
+// Can't copy from lvalue
+
+struct A
+{
+    static int count;
+    A() {++count;}
+    A(const A&) {++count;}
+    ~A() {--count;}
+};
+
+int A::count = 0;
+
+class Deleter
+{
+    int state_;
+
+public:
+
+    Deleter() : state_(5) {}
+
+    int state() const {return state_;}
+
+    void operator()(A* p) {delete p;}
+};
+
+int main()
+{
+    {
+    std::unique_ptr<A, Deleter> s(new A);
+    A* p = s.get();
+    std::unique_ptr<A, Deleter> s2;
+    s2 = s;
+    assert(s2.get() == p);
+    assert(s.get() == 0);
+    assert(A::count == 1);
+    }
+    assert(A::count == 0);
+}

Modified: libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.asgn/move04.fail.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.asgn/move04.fail.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.asgn/move04.fail.cpp (original)
+++ libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.asgn/move04.fail.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,56 @@
-//===----------------------------------------------------------------------===//
//
//                     The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//

// <memory>

// unique_ptr

// Test unique_ptr move ctor

#include <memory>
#include <cassert>

// 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<A, Deleter> s(new A);
    A* p = s.get();
    std::unique_ptr<A, Deleter> s2;
    s2 = s;
    assert(s2.get() == p);
    assert(s.get() == 0);
    assert(A::count == 1);
    }
    
 assert(A::count == 0);
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <memory>
+
+// unique_ptr
+
+// Test unique_ptr move ctor
+
+#include <memory>
+#include <cassert>
+
+// 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<A, Deleter> s(new A);
+    A* p = s.get();
+    std::unique_ptr<A, Deleter> s2;
+    s2 = s;
+    assert(s2.get() == p);
+    assert(s.get() == 0);
+    assert(A::count == 1);
+    }
+    assert(A::count == 0);
+}

Modified: libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.asgn/move_convert01.fail.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.asgn/move_convert01.fail.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.asgn/move_convert01.fail.cpp (original)
+++ libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.asgn/move_convert01.fail.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,56 @@
-//===----------------------------------------------------------------------===//
//
//                     The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//

// <memory>

// unique_ptr

// Test unique_ptr converting move assignment

#include <memory>
#include <cassert>

// 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<B> s(new B);
    A* p = s.get();
    std::unique_ptr<A> s2;
    s2 = s;
    assert(s2.get() == p);
    assert(s.get() == 0);
    assert(A::count == 1);
    assert(B::count == 1);
    }
    as
 sert(A::count == 0);
    assert(B::count == 0);
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <memory>
+
+// unique_ptr
+
+// Test unique_ptr converting move assignment
+
+#include <memory>
+#include <cassert>
+
+// 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<B> s(new B);
+    A* p = s.get();
+    std::unique_ptr<A> s2;
+    s2 = s;
+    assert(s2.get() == p);
+    assert(s.get() == 0);
+    assert(A::count == 1);
+    assert(B::count == 1);
+    }
+    assert(A::count == 0);
+    assert(B::count == 0);
+}

Modified: libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.asgn/move_convert01.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.asgn/move_convert01.pass.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.asgn/move_convert01.pass.cpp (original)
+++ libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.asgn/move_convert01.pass.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,55 @@
-//===----------------------------------------------------------------------===//
//
//                     The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//

// <memory>

// unique_ptr

// Test unique_ptr converting move assignment

#include <memory>
#include <cassert>

struct A
{
    static int count;
    A() {++count;}
    A(const A&) {++count;}
    virtual ~A() {--count;}
};

int A::count = 0;

struct B
    : public A
{
    static int count;
    B() {++count;}
    B(const B&) {++count;}
    virtual ~B() {--count;}
};

int B::count = 0;

int main()
{
    {
    std::unique_ptr<B> s(new B);
    A* p = s.get();
    std::unique_ptr<A> s2(new A);
    assert(A::count == 2);
    s2 = std::move(s);
    assert(s2.get() == p);
    assert(s.get() == 0);
    assert(A::count == 1);
    assert(B::count == 
 1);
    }
    assert(A::count == 0);
    assert(B::count == 0);
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <memory>
+
+// unique_ptr
+
+// Test unique_ptr converting move assignment
+
+#include <memory>
+#include <cassert>
+
+struct A
+{
+    static int count;
+    A() {++count;}
+    A(const A&) {++count;}
+    virtual ~A() {--count;}
+};
+
+int A::count = 0;
+
+struct B
+    : public A
+{
+    static int count;
+    B() {++count;}
+    B(const B&) {++count;}
+    virtual ~B() {--count;}
+};
+
+int B::count = 0;
+
+int main()
+{
+    {
+    std::unique_ptr<B> s(new B);
+    A* p = s.get();
+    std::unique_ptr<A> s2(new A);
+    assert(A::count == 2);
+    s2 = std::move(s);
+    assert(s2.get() == p);
+    assert(s.get() == 0);
+    assert(A::count == 1);
+    assert(B::count == 1);
+    }
+    assert(A::count == 0);
+    assert(B::count == 0);
+}

Modified: libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.asgn/move_convert02.fail.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.asgn/move_convert02.fail.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.asgn/move_convert02.fail.cpp (original)
+++ libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.asgn/move_convert02.fail.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,60 @@
-//===----------------------------------------------------------------------===//
//
//                     The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//

// <memory>

// unique_ptr

// Test unique_ptr converting move assignment

#include <memory>
#include <cassert>

#include "../../deleter.h"

// 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<B, Deleter<B> > s(new B);
    A* p = s.get();
    std::unique_ptr<A, Deleter<A> > s2;
    s2 = s;
    assert(s2.get() == p);
    assert(s.get() == 0);
    assert(A
 ::count == 1);
    assert(B::count == 1);
    assert(s2.get_deleter().state() == 5);
    assert(s.get_deleter().state() == 0);
    }
    assert(A::count == 0);
    assert(B::count == 0);
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <memory>
+
+// unique_ptr
+
+// Test unique_ptr converting move assignment
+
+#include <memory>
+#include <cassert>
+
+#include "../../deleter.h"
+
+// 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<B, Deleter<B> > s(new B);
+    A* p = s.get();
+    std::unique_ptr<A, Deleter<A> > s2;
+    s2 = s;
+    assert(s2.get() == p);
+    assert(s.get() == 0);
+    assert(A::count == 1);
+    assert(B::count == 1);
+    assert(s2.get_deleter().state() == 5);
+    assert(s.get_deleter().state() == 0);
+    }
+    assert(A::count == 0);
+    assert(B::count == 0);
+}

Modified: libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.asgn/move_convert02.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.asgn/move_convert02.pass.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.asgn/move_convert02.pass.cpp (original)
+++ libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.asgn/move_convert02.pass.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,59 @@
-//===----------------------------------------------------------------------===//
//
//                     The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//

// <memory>

// unique_ptr

// Test unique_ptr converting move assignment

#include <memory>
#include <cassert>

#include "../../deleter.h"

struct A
{
    static int count;
    A() {++count;}
    A(const A&) {++count;}
    virtual ~A() {--count;}
};

int A::count = 0;

struct B
    : public A
{
    static int count;
    B() {++count;}
    B(const B&) {++count;}
    virtual ~B() {--count;}
};

int B::count = 0;

int main()
{
    {
    std::unique_ptr<B, Deleter<B> > s(new B, Deleter<B>(5));
    A* p = s.get();
    std::unique_ptr<A, Deleter<A> > s2(new A);
    assert(A::count == 2);
    s2 = std::move(s);
    assert(s2.get() == p);
    ass
 ert(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);
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <memory>
+
+// unique_ptr
+
+// Test unique_ptr converting move assignment
+
+#include <memory>
+#include <cassert>
+
+#include "../../deleter.h"
+
+struct A
+{
+    static int count;
+    A() {++count;}
+    A(const A&) {++count;}
+    virtual ~A() {--count;}
+};
+
+int A::count = 0;
+
+struct B
+    : public A
+{
+    static int count;
+    B() {++count;}
+    B(const B&) {++count;}
+    virtual ~B() {--count;}
+};
+
+int B::count = 0;
+
+int main()
+{
+    {
+    std::unique_ptr<B, Deleter<B> > s(new B, Deleter<B>(5));
+    A* p = s.get();
+    std::unique_ptr<A, Deleter<A> > s2(new A);
+    assert(A::count == 2);
+    s2 = std::move(s);
+    assert(s2.get() == p);
+    assert(s.get() == 0);
+    assert(A::count == 1);
+    assert(B::count == 1);
+    assert(s2.get_deleter().state() == 5);
+    assert(s.get_deleter().state() == 0);
+    }
+    assert(A::count == 0);
+    assert(B::count == 0);
+}

Modified: libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.asgn/move_convert03.fail.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.asgn/move_convert03.fail.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.asgn/move_convert03.fail.cpp (original)
+++ libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.asgn/move_convert03.fail.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,61 @@
-//===----------------------------------------------------------------------===//
//
//                     The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//

// <memory>

// unique_ptr

// Test unique_ptr converting move assignment

// Can't assign from lvalue

#include <memory>
#include <cassert>

#include "../../deleter.h"

struct A
{
    static int count;
    A() {++count;}
    A(const A&) {++count;}
    virtual ~A() {--count;}
};

int A::count = 0;

struct B
    : public A
{
    static int count;
    B() {++count;}
    B(const B&) {++count;}
    virtual ~B() {--count;}
};

int B::count = 0;

int main()
{
    {
    Deleter<B> db(5);
    std::unique_ptr<B, Deleter<B>&> s(new B, db);
    A* p = s.get();
    Deleter<A> da(6);
    std::unique_ptr<A, Deleter<A>&> s2(new A, da);
    s2 = s;
    as
 sert(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);
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <memory>
+
+// unique_ptr
+
+// Test unique_ptr converting move assignment
+
+// Can't assign from lvalue
+
+#include <memory>
+#include <cassert>
+
+#include "../../deleter.h"
+
+struct A
+{
+    static int count;
+    A() {++count;}
+    A(const A&) {++count;}
+    virtual ~A() {--count;}
+};
+
+int A::count = 0;
+
+struct B
+    : public A
+{
+    static int count;
+    B() {++count;}
+    B(const B&) {++count;}
+    virtual ~B() {--count;}
+};
+
+int B::count = 0;
+
+int main()
+{
+    {
+    Deleter<B> db(5);
+    std::unique_ptr<B, Deleter<B>&> s(new B, db);
+    A* p = s.get();
+    Deleter<A> da(6);
+    std::unique_ptr<A, Deleter<A>&> s2(new A, da);
+    s2 = s;
+    assert(s2.get() == p);
+    assert(s.get() == 0);
+    assert(A::count == 1);
+    assert(B::count == 1);
+    assert(s2.get_deleter().state() == 5);
+    }
+    assert(A::count == 0);
+    assert(B::count == 0);
+}

Modified: libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.asgn/move_convert03.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.asgn/move_convert03.pass.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.asgn/move_convert03.pass.cpp (original)
+++ libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.asgn/move_convert03.pass.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,62 @@
-//===----------------------------------------------------------------------===//
//
//                     The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//

// <memory>

// unique_ptr

// Test unique_ptr converting move assignment

// test converting move assignment with reference deleters

#include <memory>
#include <cassert>

#include "../../deleter.h"

struct A
{
    static int count;
    A() {++count;}
    A(const A&) {++count;}
    virtual ~A() {--count;}
};

int A::count = 0;

struct B
    : public A
{
    static int count;
    B() {++count;}
    B(const B&) {++count;}
    virtual ~B() {--count;}
};

int B::count = 0;

int main()
{
    {
    CDeleter<B> db(5);
    std::unique_ptr<B, CDeleter<B>&> s(new B, db);
    A* p = s.get();
    CDeleter<A> da(6);
    std::unique_ptr<A, CDeleter<A>&
 > s2(new A, da);
    s2 = std::move(s);
    assert(s2.get() == p);
    assert(s.get() == 0);
    assert(A::count == 1);
    assert(B::count == 1);
    assert(s.get_deleter().state() == 5);
    assert(s2.get_deleter().state() == 5);
    }
    assert(A::count == 0);
    assert(B::count == 0);
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <memory>
+
+// unique_ptr
+
+// Test unique_ptr converting move assignment
+
+// test converting move assignment with reference deleters
+
+#include <memory>
+#include <cassert>
+
+#include "../../deleter.h"
+
+struct A
+{
+    static int count;
+    A() {++count;}
+    A(const A&) {++count;}
+    virtual ~A() {--count;}
+};
+
+int A::count = 0;
+
+struct B
+    : public A
+{
+    static int count;
+    B() {++count;}
+    B(const B&) {++count;}
+    virtual ~B() {--count;}
+};
+
+int B::count = 0;
+
+int main()
+{
+    {
+    CDeleter<B> db(5);
+    std::unique_ptr<B, CDeleter<B>&> s(new B, db);
+    A* p = s.get();
+    CDeleter<A> da(6);
+    std::unique_ptr<A, CDeleter<A>&> s2(new A, da);
+    s2 = std::move(s);
+    assert(s2.get() == p);
+    assert(s.get() == 0);
+    assert(A::count == 1);
+    assert(B::count == 1);
+    assert(s.get_deleter().state() == 5);
+    assert(s2.get_deleter().state() == 5);
+    }
+    assert(A::count == 0);
+    assert(B::count == 0);
+}

Modified: libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.asgn/move_convert04.fail.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.asgn/move_convert04.fail.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.asgn/move_convert04.fail.cpp (original)
+++ libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.asgn/move_convert04.fail.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,56 @@
-//===----------------------------------------------------------------------===//
//
//                     The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//

// <memory>

// unique_ptr

// Test unique_ptr converting move assignment

#include <memory>
#include <cassert>

// 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 std::unique_ptr<B> s(new B);
    A* p = s.get();
    std::unique_ptr<A> s2;
    s2 = s;
    assert(s2.get() == p);
    assert(s.get() == 0);
    assert(A::count == 1);
    assert(B::count == 1);
     }
    assert(A::count == 0);
    assert(B::count == 0);
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <memory>
+
+// unique_ptr
+
+// Test unique_ptr converting move assignment
+
+#include <memory>
+#include <cassert>
+
+// 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 std::unique_ptr<B> s(new B);
+    A* p = s.get();
+    std::unique_ptr<A> s2;
+    s2 = s;
+    assert(s2.get() == p);
+    assert(s.get() == 0);
+    assert(A::count == 1);
+    assert(B::count == 1);
+    }
+    assert(A::count == 0);
+    assert(B::count == 0);
+}

Modified: libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.asgn/move_convert05.fail.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.asgn/move_convert05.fail.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.asgn/move_convert05.fail.cpp (original)
+++ libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.asgn/move_convert05.fail.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,60 @@
-//===----------------------------------------------------------------------===//
//
//                     The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//

// <memory>

// unique_ptr

// Test unique_ptr converting move assignment

// Can't assign from const lvalue

#include <memory>
#include <cassert>

#include "../../deleter.h"

struct A
{
    static int count;
    A() {++count;}
    A(const A&) {++count;}
    virtual ~A() {--count;}
};

int A::count = 0;

struct B
    : public A
{
    static int count;
    B() {++count;}
    B(const B&) {++count;}
    virtual ~B() {--count;}
};

int B::count = 0;

int main()
{
    {
    const std::unique_ptr<B, Deleter<B> > s(new B);
    A* p = s.get();
    std::unique_ptr<A, Deleter<A> > s2;
    s2 = s;
    assert(s2.get() == p);
    assert(s.get() == 0);
     assert(A::count == 1);
    assert(B::count == 1);
    assert(s2.get_deleter().state() == 5);
    assert(s.get_deleter().state() == 0);
    }
    assert(A::count == 0);
    assert(B::count == 0);
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <memory>
+
+// unique_ptr
+
+// Test unique_ptr converting move assignment
+
+// Can't assign from const lvalue
+
+#include <memory>
+#include <cassert>
+
+#include "../../deleter.h"
+
+struct A
+{
+    static int count;
+    A() {++count;}
+    A(const A&) {++count;}
+    virtual ~A() {--count;}
+};
+
+int A::count = 0;
+
+struct B
+    : public A
+{
+    static int count;
+    B() {++count;}
+    B(const B&) {++count;}
+    virtual ~B() {--count;}
+};
+
+int B::count = 0;
+
+int main()
+{
+    {
+    const std::unique_ptr<B, Deleter<B> > s(new B);
+    A* p = s.get();
+    std::unique_ptr<A, Deleter<A> > s2;
+    s2 = s;
+    assert(s2.get() == p);
+    assert(s.get() == 0);
+    assert(A::count == 1);
+    assert(B::count == 1);
+    assert(s2.get_deleter().state() == 5);
+    assert(s.get_deleter().state() == 0);
+    }
+    assert(A::count == 0);
+    assert(B::count == 0);
+}

Modified: libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.asgn/move_convert06.fail.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.asgn/move_convert06.fail.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.asgn/move_convert06.fail.cpp (original)
+++ libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.asgn/move_convert06.fail.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,61 @@
-//===----------------------------------------------------------------------===//
//
//                     The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//

// <memory>

// unique_ptr

// Test unique_ptr converting move assignment

// Can't assign from const lvalue

#include <memory>
#include <cassert>

#include "../../deleter.h"

struct A
{
    static int count;
    A() {++count;}
    A(const A&) {++count;}
    virtual ~A() {--count;}
};

int A::count = 0;

struct B
    : public A
{
    static int count;
    B() {++count;}
    B(const B&) {++count;}
    virtual ~B() {--count;}
};

int B::count = 0;

int main()
{
    {
    Deleter<B> db(5);
    const std::unique_ptr<B, Deleter<B>&> s(new B, db);
    A* p = s.get();
    Deleter<A> da(6);
    std::unique_ptr<A, Deleter<A>&> s2(new A, da);
    s2
  = s;
    assert(s2.get() == p);
    assert(s.get() == 0);
    assert(A::count == 1);
    assert(B::count == 1);
    assert(s2.get_deleter().state() == 5);
    }
    assert(A::count == 0);
    assert(B::count == 0);
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <memory>
+
+// unique_ptr
+
+// Test unique_ptr converting move assignment
+
+// Can't assign from const lvalue
+
+#include <memory>
+#include <cassert>
+
+#include "../../deleter.h"
+
+struct A
+{
+    static int count;
+    A() {++count;}
+    A(const A&) {++count;}
+    virtual ~A() {--count;}
+};
+
+int A::count = 0;
+
+struct B
+    : public A
+{
+    static int count;
+    B() {++count;}
+    B(const B&) {++count;}
+    virtual ~B() {--count;}
+};
+
+int B::count = 0;
+
+int main()
+{
+    {
+    Deleter<B> db(5);
+    const std::unique_ptr<B, Deleter<B>&> s(new B, db);
+    A* p = s.get();
+    Deleter<A> da(6);
+    std::unique_ptr<A, Deleter<A>&> s2(new A, da);
+    s2 = s;
+    assert(s2.get() == p);
+    assert(s.get() == 0);
+    assert(A::count == 1);
+    assert(B::count == 1);
+    assert(s2.get_deleter().state() == 5);
+    }
+    assert(A::count == 0);
+    assert(B::count == 0);
+}

Modified: libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.asgn/move_convert13.fail.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.asgn/move_convert13.fail.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.asgn/move_convert13.fail.cpp (original)
+++ libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.asgn/move_convert13.fail.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,35 @@
-//===----------------------------------------------------------------------===//
//
//                     The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//

// <memory>

// unique_ptr

// Test unique_ptr converting move assignment

// Do not convert from an array unique_ptr

#include <memory>
#include <cassert>

struct A
{
};

struct Deleter
{
    void operator()(void*) {}
};

int main()
{
    std::unique_ptr<A[], Deleter> s;
    std::unique_ptr<A, Deleter> s2;
    s2 = std::move(s);
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <memory>
+
+// unique_ptr
+
+// Test unique_ptr converting move assignment
+
+// Do not convert from an array unique_ptr
+
+#include <memory>
+#include <cassert>
+
+struct A
+{
+};
+
+struct Deleter
+{
+    void operator()(void*) {}
+};
+
+int main()
+{
+    std::unique_ptr<A[], Deleter> s;
+    std::unique_ptr<A, Deleter> s2;
+    s2 = std::move(s);
+}

Modified: libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.asgn/null.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.asgn/null.pass.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.asgn/null.pass.cpp (original)
+++ libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.asgn/null.pass.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,41 @@
-//===----------------------------------------------------------------------===//
//
//                     The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//

// <memory>

// unique_ptr

// Test unique_ptr move assignment

#include <memory>
#include <cassert>

// 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<A> s2(new A);
    assert(A::count == 1);
    s2 = 0;
    assert(A::count == 0);
    assert(s2.get() == 0);
    }
    assert(A::count == 0);
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <memory>
+
+// unique_ptr
+
+// Test unique_ptr move assignment
+
+#include <memory>
+#include <cassert>
+
+// 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<A> s2(new A);
+    assert(A::count == 1);
+    s2 = 0;
+    assert(A::count == 0);
+    assert(s2.get() == 0);
+    }
+    assert(A::count == 0);
+}

Modified: libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.asgn/nullptr.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.asgn/nullptr.pass.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.asgn/nullptr.pass.cpp (original)
+++ libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.asgn/nullptr.pass.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,41 @@
-//===----------------------------------------------------------------------===//
//
//                     The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//

// <memory>

// unique_ptr

// Test unique_ptr move assignment

#include <memory>
#include <cassert>

// 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<A> s2(new A);
    assert(A::count == 1);
    s2 = nullptr;
    assert(A::count == 0);
    assert(s2.get() == 0);
    }
    assert(A::count == 0);
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <memory>
+
+// unique_ptr
+
+// Test unique_ptr move assignment
+
+#include <memory>
+#include <cassert>
+
+// 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<A> s2(new A);
+    assert(A::count == 1);
+    s2 = nullptr;
+    assert(A::count == 0);
+    assert(s2.get() == 0);
+    }
+    assert(A::count == 0);
+}

Modified: libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/auto_pointer.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/auto_pointer.pass.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/auto_pointer.pass.cpp (original)
+++ libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/auto_pointer.pass.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,67 @@
-//===----------------------------------------------------------------------===//
//
//                     The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//

// <memory>

// unique_ptr

// Test unique_ptr(pointer) ctor

#include <memory>
#include <cassert>

// template <class U> explicit unique_ptr(auto_ptr<U>&);

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<B> ap(p);
    std::unique_ptr<A> 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<B> ap(p);
    std::unique_ptr<A> 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);
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <memory>
+
+// unique_ptr
+
+// Test unique_ptr(pointer) ctor
+
+#include <memory>
+#include <cassert>
+
+// template <class U> explicit unique_ptr(auto_ptr<U>&);
+
+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<B> ap(p);
+    std::unique_ptr<A> 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<B> ap(p);
+    std::unique_ptr<A> 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);
+}

Modified: libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/auto_pointer01.fail.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/auto_pointer01.fail.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/auto_pointer01.fail.cpp (original)
+++ libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/auto_pointer01.fail.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,67 @@
-//===----------------------------------------------------------------------===//
//
//                     The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//

// <memory>

// unique_ptr

// Test unique_ptr(pointer) ctor

#include <memory>
#include <cassert>

// template <class U> explicit unique_ptr(auto_ptr<U>&);

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<B> ap(p);
    std::unique_ptr<A> 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<B> ap(p);
    std::unique_ptr<A> 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);
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <memory>
+
+// unique_ptr
+
+// Test unique_ptr(pointer) ctor
+
+#include <memory>
+#include <cassert>
+
+// template <class U> explicit unique_ptr(auto_ptr<U>&);
+
+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<B> ap(p);
+    std::unique_ptr<A> 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<B> ap(p);
+    std::unique_ptr<A> 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);
+}

Modified: libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/auto_pointer02.fail.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/auto_pointer02.fail.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/auto_pointer02.fail.cpp (original)
+++ libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/auto_pointer02.fail.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,61 @@
-//===----------------------------------------------------------------------===//
//
//                     The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//

// <memory>

// unique_ptr

// Test unique_ptr(pointer) ctor

#include <memory>
#include <cassert>

// template <class U> explicit unique_ptr(auto_ptr<U>&);

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 <class T>
        void operator()(T*) {}
};

int main()
{
    {
    B* p = new B;
    std::auto_ptr<B> ap(p);
    std::unique_ptr<A, Deleter> up(ap);
    assert(up.get() == p);
    ass
 ert(ap.get() == 0);
    assert(A::count == 1);
    assert(B::count == 1);
    }
    assert(A::count == 0);
    assert(B::count == 0);
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <memory>
+
+// unique_ptr
+
+// Test unique_ptr(pointer) ctor
+
+#include <memory>
+#include <cassert>
+
+// template <class U> explicit unique_ptr(auto_ptr<U>&);
+
+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 <class T>
+        void operator()(T*) {}
+};
+
+int main()
+{
+    {
+    B* p = new B;
+    std::auto_ptr<B> ap(p);
+    std::unique_ptr<A, Deleter> 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);
+}

Modified: libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/default01.fail.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/default01.fail.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/default01.fail.cpp (original)
+++ libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/default01.fail.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,35 @@
-//===----------------------------------------------------------------------===//
//
//                     The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//

// <memory>

// unique_ptr

// Test unique_ptr default ctor

#include <memory>

// 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<int, Deleter> p;
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <memory>
+
+// unique_ptr
+
+// Test unique_ptr default ctor
+
+#include <memory>
+
+// 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<int, Deleter> p;
+}

Modified: libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/default01.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/default01.pass.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/default01.pass.cpp (original)
+++ libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/default01.pass.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,46 @@
-//===----------------------------------------------------------------------===//
//
//                     The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//

// <memory>

// unique_ptr

// Test unique_ptr default ctor

#include <memory>
#include <cassert>

// default unique_ptr ctor should only require default Deleter ctor
class Deleter
{
    int state_;

    Deleter(Deleter&);
    Deleter& operator=(Deleter&);

public:
    Deleter() : state_(5) {}

    int state() const {return state_;}

    void operator()(void*) {}
};


int main()
{
    {
    std::unique_ptr<int> p;
    assert(p.get() == 0);
    }
    {
    std::unique_ptr<int, Deleter> p;
    assert(p.get() == 0);
    assert(p.get_deleter().state() == 5);
    }
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <memory>
+
+// unique_ptr
+
+// Test unique_ptr default ctor
+
+#include <memory>
+#include <cassert>
+
+// default unique_ptr ctor should only require default Deleter ctor
+class Deleter
+{
+    int state_;
+
+    Deleter(Deleter&);
+    Deleter& operator=(Deleter&);
+
+public:
+    Deleter() : state_(5) {}
+
+    int state() const {return state_;}
+
+    void operator()(void*) {}
+};
+
+int main()
+{
+    {
+    std::unique_ptr<int> p;
+    assert(p.get() == 0);
+    }
+    {
+    std::unique_ptr<int, Deleter> p;
+    assert(p.get() == 0);
+    assert(p.get_deleter().state() == 5);
+    }
+}

Modified: libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/default02.fail.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/default02.fail.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/default02.fail.cpp (original)
+++ libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/default02.fail.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,29 @@
-//===----------------------------------------------------------------------===//
//
//                     The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//

// <memory>

// unique_ptr

// Test unique_ptr default ctor

#include <memory>

// default unique_ptr ctor should require non-reference Deleter ctor
class Deleter
{
public:

    void operator()(void*) {}
};


int main()
{
    std::unique_ptr<int, Deleter&> p;
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <memory>
+
+// unique_ptr
+
+// Test unique_ptr default ctor
+
+#include <memory>
+
+// default unique_ptr ctor should require non-reference Deleter ctor
+class Deleter
+{
+public:
+
+    void operator()(void*) {}
+};
+
+int main()
+{
+    std::unique_ptr<int, Deleter&> p;
+}

Modified: libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/default02.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/default02.pass.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/default02.pass.cpp (original)
+++ libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/default02.pass.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,84 @@
-//===----------------------------------------------------------------------===//
//
//                     The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//

// <memory>

// unique_ptr

// Test default unique_ptr ctor

#include <memory>
#include <cassert>

// default unique_ptr ctor shouldn't require complete type

struct A;

class Deleter
{
    int state_;

    Deleter(Deleter&);
    Deleter& operator=(Deleter&);

public:
    Deleter() : state_(5) {}

    int state() const {return state_;}

    void operator()(A* p);
};

void check(int i);

template <class D = std::default_delete<A> >
struct B
{
    std::unique_ptr<A, D> a_;
    B() {}
    ~B();

    A* get() const {return a_.get();}
    D& get_deleter() {return a_.get_deleter();}
};

int main()
{
    {
    B<> s;
    assert(s.get() == 0);
   
  }
    check(0);
    {
    B<Deleter> s;
    assert(s.get() == 0);
    assert(s.get_deleter().state() == 5);
    }
    check(0);
}

struct A
{
    static int count;
    A() {++count;}
    A(const A&) {++count;}
    ~A() {--count;}
};

int A::count = 0;

void Deleter::operator()(A* p) {delete p;}

void check(int i)
{
    assert(A::count == i);
}

template <class D>
B<D>::~B() {}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <memory>
+
+// unique_ptr
+
+// Test default unique_ptr ctor
+
+#include <memory>
+#include <cassert>
+
+// default unique_ptr ctor shouldn't require complete type
+
+struct A;
+
+class Deleter
+{
+    int state_;
+
+    Deleter(Deleter&);
+    Deleter& operator=(Deleter&);
+
+public:
+    Deleter() : state_(5) {}
+
+    int state() const {return state_;}
+
+    void operator()(A* p);
+};
+
+void check(int i);
+
+template <class D = std::default_delete<A> >
+struct B
+{
+    std::unique_ptr<A, D> a_;
+    B() {}
+    ~B();
+
+    A* get() const {return a_.get();}
+    D& get_deleter() {return a_.get_deleter();}
+};
+
+int main()
+{
+    {
+    B<> s;
+    assert(s.get() == 0);
+    }
+    check(0);
+    {
+    B<Deleter> s;
+    assert(s.get() == 0);
+    assert(s.get_deleter().state() == 5);
+    }
+    check(0);
+}
+
+struct A
+{
+    static int count;
+    A() {++count;}
+    A(const A&) {++count;}
+    ~A() {--count;}
+};
+
+int A::count = 0;
+
+void Deleter::operator()(A* p) {delete p;}
+
+void check(int i)
+{
+    assert(A::count == i);
+}
+
+template <class D>
+B<D>::~B() {}

Modified: libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/default03.fail.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/default03.fail.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/default03.fail.cpp (original)
+++ libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/default03.fail.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,23 @@
-//===----------------------------------------------------------------------===//
//
//                     The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//

// <memory>

// unique_ptr

// Test unique_ptr default ctor

#include <memory>

// default unique_ptr ctor should require non-pointer Deleter

int main()
{
    std::unique_ptr<int, void (*)(void*)> p;
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <memory>
+
+// unique_ptr
+
+// Test unique_ptr default ctor
+
+#include <memory>
+
+// default unique_ptr ctor should require non-pointer Deleter
+
+int main()
+{
+    std::unique_ptr<int, void (*)(void*)> p;
+}

Modified: libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/move01.fail.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/move01.fail.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/move01.fail.cpp (original)
+++ libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/move01.fail.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,42 @@
-//===----------------------------------------------------------------------===//
//
//                     The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//

// <memory>

// unique_ptr

// Test unique_ptr move ctor

#include <memory>
#include <cassert>

// 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<A> s(new A);
    A* p = s.get();
    std::unique_ptr<A> s2 = s;
    assert(s2.get() == p);
    assert(s.get() == 0);
    assert(A::count == 1);
    }
    assert(A::count == 0);
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <memory>
+
+// unique_ptr
+
+// Test unique_ptr move ctor
+
+#include <memory>
+#include <cassert>
+
+// 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<A> s(new A);
+    A* p = s.get();
+    std::unique_ptr<A> s2 = s;
+    assert(s2.get() == p);
+    assert(s.get() == 0);
+    assert(A::count == 1);
+    }
+    assert(A::count == 0);
+}

Modified: libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/move01.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/move01.pass.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/move01.pass.cpp (original)
+++ libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/move01.pass.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,141 @@
-//===----------------------------------------------------------------------===//
//
//                     The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//

// <memory>

// unique_ptr

// Test unique_ptr move ctor

#include <memory>
#include <cassert>

// test move ctor.  Should only require a MoveConstructible deleter, or if
//    deleter is a reference, not even that.

struct A
{
    static int count;
    A() {++count;}
    A(const A&) {++count;}
    ~A() {--count;}
};

int A::count = 0;

template <class T>
class Deleter
{
    int state_;

#ifdef _LIBCPP_MOVE
    Deleter(const Deleter&);
    Deleter& operator=(const Deleter&);
#else
    Deleter(Deleter&);
    Deleter& operator=(Deleter&);
#endif

public:
#ifdef _LIBCPP_MOVE
    Deleter(Deleter&& r) : state_(r.state_) {r.state_ = 0;}
    Dele
 ter& operator=(Deleter&& r)
    {
        state_ = r.state_;
        r.state_ = 0;
        return *this;
    }
#else
    operator std::__rv<Deleter>() {return std::__rv<Deleter>(*this);}
    Deleter(std::__rv<Deleter> r) : state_(r->state_) {r->state_ = 0;}
    Deleter& operator=(std::__rv<Deleter> r)
    {
        state_ = r->state_;
        r->state_ = 0;
        return *this;
    }
#endif

    Deleter() : state_(5) {}

#ifdef _LIBCPP_MOVE
    template <class U>
        Deleter(Deleter<U>&& d,
            typename std::enable_if<!std::is_same<U, T>::value>::type* = 0)
            : state_(d.state()) {d.set_state(0);}

private:
    template <class U>
        Deleter(const Deleter<U>& d,
            typename std::enable_if<!std::is_same<U, T>::value>::type* = 0);
#else
    template <class U>
        Deleter(Deleter<U> d,
            typename std::enable_if<!std::is_same<U, T>::value>::type* = 0)
            : state_(d.state()) {}
#endif
public:
    int state() const {return 
 state_;}
    void set_state(int i) {state_ = i;}

    void operator()(T* p) {delete p;}
};

class CDeleter
{
    int state_;

    CDeleter(CDeleter&);
    CDeleter& operator=(CDeleter&);
public:

    CDeleter() : state_(5) {}

    int state() const {return state_;}
    void set_state(int s) {state_ = s;}

    void operator()(A* p) {delete p;}
};

int main()
{
    {
    std::unique_ptr<A> s(new A);
    A* p = s.get();
    std::unique_ptr<A> s2 = std::move(s);
    assert(s2.get() == p);
    assert(s.get() == 0);
    assert(A::count == 1);
    }
    assert(A::count == 0);
    {
    std::unique_ptr<A, Deleter<A> > s(new A);
    A* p = s.get();
    std::unique_ptr<A, Deleter<A> > s2 = std::move(s);
    assert(s2.get() == p);
    assert(s.get() == 0);
    assert(A::count == 1);
    assert(s2.get_deleter().state() == 5);
    assert(s.get_deleter().state() == 0);
    }
    assert(A::count == 0);
    {
    CDeleter d;
    std::unique_ptr<A, CDeleter&> s(new A, d);
    A* p = s.get();
 
    std::unique_ptr<A, CDeleter&> s2 = std::move(s);
    assert(s2.get() == p);
    assert(s.get() == 0);
    assert(A::count == 1);
    d.set_state(6);
    assert(s2.get_deleter().state() == d.state());
    assert(s.get_deleter().state() ==  d.state());
    }
    assert(A::count == 0);
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <memory>
+
+// unique_ptr
+
+// Test unique_ptr move ctor
+
+#include <memory>
+#include <cassert>
+
+// test move ctor.  Should only require a MoveConstructible deleter, or if
+//    deleter is a reference, not even that.
+
+struct A
+{
+    static int count;
+    A() {++count;}
+    A(const A&) {++count;}
+    ~A() {--count;}
+};
+
+int A::count = 0;
+
+template <class T>
+class Deleter
+{
+    int state_;
+
+#ifdef _LIBCPP_MOVE
+    Deleter(const Deleter&);
+    Deleter& operator=(const Deleter&);
+#else  // _LIBCPP_MOVE
+    Deleter(Deleter&);
+    Deleter& operator=(Deleter&);
+#endif  // _LIBCPP_MOVE
+
+public:
+#ifdef _LIBCPP_MOVE
+    Deleter(Deleter&& r) : state_(r.state_) {r.state_ = 0;}
+    Deleter& operator=(Deleter&& r)
+    {
+        state_ = r.state_;
+        r.state_ = 0;
+        return *this;
+    }
+#else  // _LIBCPP_MOVE
+    operator std::__rv<Deleter>() {return std::__rv<Deleter>(*this);}
+    Deleter(std::__rv<Deleter> r) : state_(r->state_) {r->state_ = 0;}
+    Deleter& operator=(std::__rv<Deleter> r)
+    {
+        state_ = r->state_;
+        r->state_ = 0;
+        return *this;
+    }
+#endif  // _LIBCPP_MOVE
+
+    Deleter() : state_(5) {}
+
+#ifdef _LIBCPP_MOVE
+    template <class U>
+        Deleter(Deleter<U>&& d,
+            typename std::enable_if<!std::is_same<U, T>::value>::type* = 0)
+            : state_(d.state()) {d.set_state(0);}
+
+private:
+    template <class U>
+        Deleter(const Deleter<U>& d,
+            typename std::enable_if<!std::is_same<U, T>::value>::type* = 0);
+#else  // _LIBCPP_MOVE
+    template <class U>
+        Deleter(Deleter<U> d,
+            typename std::enable_if<!std::is_same<U, T>::value>::type* = 0)
+            : state_(d.state()) {}
+#endif  // _LIBCPP_MOVE
+public:
+    int state() const {return state_;}
+    void set_state(int i) {state_ = i;}
+
+    void operator()(T* p) {delete p;}
+};
+
+class CDeleter
+{
+    int state_;
+
+    CDeleter(CDeleter&);
+    CDeleter& operator=(CDeleter&);
+public:
+
+    CDeleter() : state_(5) {}
+
+    int state() const {return state_;}
+    void set_state(int s) {state_ = s;}
+
+    void operator()(A* p) {delete p;}
+};
+
+int main()
+{
+    {
+    std::unique_ptr<A> s(new A);
+    A* p = s.get();
+    std::unique_ptr<A> s2 = std::move(s);
+    assert(s2.get() == p);
+    assert(s.get() == 0);
+    assert(A::count == 1);
+    }
+    assert(A::count == 0);
+    {
+    std::unique_ptr<A, Deleter<A> > s(new A);
+    A* p = s.get();
+    std::unique_ptr<A, Deleter<A> > s2 = std::move(s);
+    assert(s2.get() == p);
+    assert(s.get() == 0);
+    assert(A::count == 1);
+    assert(s2.get_deleter().state() == 5);
+    assert(s.get_deleter().state() == 0);
+    }
+    assert(A::count == 0);
+    {
+    CDeleter d;
+    std::unique_ptr<A, CDeleter&> s(new A, d);
+    A* p = s.get();
+    std::unique_ptr<A, CDeleter&> s2 = std::move(s);
+    assert(s2.get() == p);
+    assert(s.get() == 0);
+    assert(A::count == 1);
+    d.set_state(6);
+    assert(s2.get_deleter().state() == d.state());
+    assert(s.get_deleter().state() ==  d.state());
+    }
+    assert(A::count == 0);
+}

Modified: libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/move02.fail.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/move02.fail.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/move02.fail.cpp (original)
+++ libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/move02.fail.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,42 @@
-//===----------------------------------------------------------------------===//
//
//                     The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//

// <memory>

// unique_ptr

// Test unique_ptr move ctor

#include <memory>
#include <cassert>

// 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<A> s(new A);
    A* p = s.get();
    std::unique_ptr<A> s2 = s;
    assert(s2.get() == p);
    assert(s.get() == 0);
    assert(A::count == 1);
    }
    assert(A::count == 0);
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <memory>
+
+// unique_ptr
+
+// Test unique_ptr move ctor
+
+#include <memory>
+#include <cassert>
+
+// 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<A> s(new A);
+    A* p = s.get();
+    std::unique_ptr<A> s2 = s;
+    assert(s2.get() == p);
+    assert(s.get() == 0);
+    assert(A::count == 1);
+    }
+    assert(A::count == 0);
+}

Modified: libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/move02.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/move02.pass.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/move02.pass.cpp (original)
+++ libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/move02.pass.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,143 @@
-//===----------------------------------------------------------------------===//
//
//                     The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//

// <memory>

// unique_ptr

// Test unique_ptr move ctor

#include <memory>
#include <cassert>

// test move ctor.  Should only require a MoveConstructible deleter, or if
//    deleter is a reference, not even that.

struct A
{
    static int count;
    A() {++count;}
    A(const A&) {++count;}
    ~A() {--count;}
};

int A::count = 0;

template <class T>
class Deleter
{
    int state_;

#ifdef _LIBCPP_MOVE
    Deleter(const Deleter&);
    Deleter& operator=(const Deleter&);
#else
    Deleter(Deleter&);
    Deleter& operator=(Deleter&);
#endif

public:
#ifdef _LIBCPP_MOVE
    Deleter(Deleter&& r) : state_(r.state_) {r.state_ = 0;}
    Dele
 ter& operator=(Deleter&& r)
    {
        state_ = r.state_;
        r.state_ = 0;
        return *this;
    }
#else
    operator std::__rv<Deleter>() {return std::__rv<Deleter>(*this);}
    Deleter(std::__rv<Deleter> r) : state_(r->state_) {r->state_ = 0;}
    Deleter& operator=(std::__rv<Deleter> r)
    {
        state_ = r->state_;
        r->state_ = 0;
        return *this;
    }
#endif

    Deleter() : state_(5) {}

#ifdef _LIBCPP_MOVE
    template <class U>
        Deleter(Deleter<U>&& d,
            typename std::enable_if<!std::is_same<U, T>::value>::type* = 0)
            : state_(d.state()) {d.set_state(0);}

private:
    template <class U>
        Deleter(const Deleter<U>& d,
            typename std::enable_if<!std::is_same<U, T>::value>::type* = 0);
#else
    template <class U>
        Deleter(Deleter<U> d,
            typename std::enable_if<!std::is_same<U, T>::value>::type* = 0)
            : state_(d.state()) {}
#endif
public:
    int state() const {return 
 state_;}
    void set_state(int i) {state_ = i;}

    void operator()(T* p) {delete p;}
};

class CDeleter
{
    int state_;

    CDeleter(CDeleter&);
    CDeleter& operator=(CDeleter&);
public:

    CDeleter() : state_(5) {}

    int state() const {return state_;}
    void set_state(int s) {state_ = s;}

    void operator()(A* p) {delete p;}
};

std::unique_ptr<A>
source1()
{
    return std::unique_ptr<A>(new A);
}

void sink1(std::unique_ptr<A> p)
{
}

std::unique_ptr<A, Deleter<A> >
source2()
{
    return std::unique_ptr<A, Deleter<A> >(new A);
}

void sink2(std::unique_ptr<A, Deleter<A> > p)
{
}

std::unique_ptr<A, CDeleter&>
source3()
{
    static CDeleter d;
    return std::unique_ptr<A, CDeleter&>(new A, d);
}

void sink3(std::unique_ptr<A, CDeleter&> p)
{
}

int main()
{
    sink1(source1());
    sink2(source2());
    sink3(source3());
    assert(A::count == 0);
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <memory>
+
+// unique_ptr
+
+// Test unique_ptr move ctor
+
+#include <memory>
+#include <cassert>
+
+// test move ctor.  Should only require a MoveConstructible deleter, or if
+//    deleter is a reference, not even that.
+
+struct A
+{
+    static int count;
+    A() {++count;}
+    A(const A&) {++count;}
+    ~A() {--count;}
+};
+
+int A::count = 0;
+
+template <class T>
+class Deleter
+{
+    int state_;
+
+#ifdef _LIBCPP_MOVE
+    Deleter(const Deleter&);
+    Deleter& operator=(const Deleter&);
+#else  // _LIBCPP_MOVE
+    Deleter(Deleter&);
+    Deleter& operator=(Deleter&);
+#endif  // _LIBCPP_MOVE
+
+public:
+#ifdef _LIBCPP_MOVE
+    Deleter(Deleter&& r) : state_(r.state_) {r.state_ = 0;}
+    Deleter& operator=(Deleter&& r)
+    {
+        state_ = r.state_;
+        r.state_ = 0;
+        return *this;
+    }
+#else  // _LIBCPP_MOVE
+    operator std::__rv<Deleter>() {return std::__rv<Deleter>(*this);}
+    Deleter(std::__rv<Deleter> r) : state_(r->state_) {r->state_ = 0;}
+    Deleter& operator=(std::__rv<Deleter> r)
+    {
+        state_ = r->state_;
+        r->state_ = 0;
+        return *this;
+    }
+#endif  // _LIBCPP_MOVE
+
+    Deleter() : state_(5) {}
+
+#ifdef _LIBCPP_MOVE
+    template <class U>
+        Deleter(Deleter<U>&& d,
+            typename std::enable_if<!std::is_same<U, T>::value>::type* = 0)
+            : state_(d.state()) {d.set_state(0);}
+
+private:
+    template <class U>
+        Deleter(const Deleter<U>& d,
+            typename std::enable_if<!std::is_same<U, T>::value>::type* = 0);
+#else  // _LIBCPP_MOVE
+    template <class U>
+        Deleter(Deleter<U> d,
+            typename std::enable_if<!std::is_same<U, T>::value>::type* = 0)
+            : state_(d.state()) {}
+#endif  // _LIBCPP_MOVE
+public:
+    int state() const {return state_;}
+    void set_state(int i) {state_ = i;}
+
+    void operator()(T* p) {delete p;}
+};
+
+class CDeleter
+{
+    int state_;
+
+    CDeleter(CDeleter&);
+    CDeleter& operator=(CDeleter&);
+public:
+
+    CDeleter() : state_(5) {}
+
+    int state() const {return state_;}
+    void set_state(int s) {state_ = s;}
+
+    void operator()(A* p) {delete p;}
+};
+
+std::unique_ptr<A>
+source1()
+{
+    return std::unique_ptr<A>(new A);
+}
+
+void sink1(std::unique_ptr<A> p)
+{
+}
+
+std::unique_ptr<A, Deleter<A> >
+source2()
+{
+    return std::unique_ptr<A, Deleter<A> >(new A);
+}
+
+void sink2(std::unique_ptr<A, Deleter<A> > p)
+{
+}
+
+std::unique_ptr<A, CDeleter&>
+source3()
+{
+    static CDeleter d;
+    return std::unique_ptr<A, CDeleter&>(new A, d);
+}
+
+void sink3(std::unique_ptr<A, CDeleter&> p)
+{
+}
+
+int main()
+{
+    sink1(source1());
+    sink2(source2());
+    sink3(source3());
+    assert(A::count == 0);
+}

Modified: libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/move03.fail.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/move03.fail.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/move03.fail.cpp (original)
+++ libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/move03.fail.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,55 @@
-//===----------------------------------------------------------------------===//
//
//                     The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//

// <memory>

// unique_ptr

// Test unique_ptr move ctor

#include <memory>
#include <cassert>

// 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<A, Deleter> s(new A);
    A* p = s.get();
    std::unique_ptr<A, Deleter> s2 = s;
    assert(s2.get() == p);
    assert(s.get() == 0);
    assert(A::count == 1);
    }
    assert(A::count == 0
 );
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <memory>
+
+// unique_ptr
+
+// Test unique_ptr move ctor
+
+#include <memory>
+#include <cassert>
+
+// 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<A, Deleter> s(new A);
+    A* p = s.get();
+    std::unique_ptr<A, Deleter> s2 = s;
+    assert(s2.get() == p);
+    assert(s.get() == 0);
+    assert(A::count == 1);
+    }
+    assert(A::count == 0);
+}

Modified: libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/move04.fail.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/move04.fail.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/move04.fail.cpp (original)
+++ libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/move04.fail.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,55 @@
-//===----------------------------------------------------------------------===//
//
//                     The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//

// <memory>

// unique_ptr

// Test unique_ptr move ctor

#include <memory>
#include <cassert>

// 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<A, Deleter> s(new A);
    A* p = s.get();
    std::unique_ptr<A, Deleter> s2 = s;
    assert(s2.get() == p);
    assert(s.get() == 0);
    assert(A::count == 1);
    }
    assert(A
 ::count == 0);
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <memory>
+
+// unique_ptr
+
+// Test unique_ptr move ctor
+
+#include <memory>
+#include <cassert>
+
+// 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<A, Deleter> s(new A);
+    A* p = s.get();
+    std::unique_ptr<A, Deleter> s2 = s;
+    assert(s2.get() == p);
+    assert(s.get() == 0);
+    assert(A::count == 1);
+    }
+    assert(A::count == 0);
+}

Modified: libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/move_convert01.fail.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/move_convert01.fail.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/move_convert01.fail.cpp (original)
+++ libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/move_convert01.fail.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,55 @@
-//===----------------------------------------------------------------------===//
//
//                     The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//

// <memory>

// unique_ptr

// Test unique_ptr converting move ctor

#include <memory>
#include <cassert>

// 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<B> s(new B);
    A* p = s.get();
    std::unique_ptr<A> s2(s);
    assert(s2.get() == p);
    assert(s.get() == 0);
    assert(A::count == 1);
    assert(B::count == 1);
    }
    assert(A::coun
 t == 0);
    assert(B::count == 0);
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <memory>
+
+// unique_ptr
+
+// Test unique_ptr converting move ctor
+
+#include <memory>
+#include <cassert>
+
+// 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<B> s(new B);
+    A* p = s.get();
+    std::unique_ptr<A> 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);
+}

Modified: libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/move_convert01.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/move_convert01.pass.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/move_convert01.pass.cpp (original)
+++ libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/move_convert01.pass.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,57 @@
-//===----------------------------------------------------------------------===//
//
//                     The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//

// <memory>

// unique_ptr

// Test unique_ptr converting move ctor

#include <memory>
#include <cassert>

// test converting move ctor.  Should only require a MoveConstructible deleter, or if
//    deleter is a reference, not even that.
// Explicit version

struct A
{
    static int count;
    A() {++count;}
    A(const A&) {++count;}
    virtual ~A() {--count;}
};

int A::count = 0;

struct B
    : public A
{
    static int count;
    B() {++count;}
    B(const B&) {++count;}
    virtual ~B() {--count;}
};

int B::count = 0;

int main()
{
    {
    std::unique_ptr<B> s(new B);
    A* p = s.get();
    std::unique_ptr<A> s2(std::move(s));
     assert(s2.get() == p);
    assert(s.get() == 0);
    assert(A::count == 1);
    assert(B::count == 1);
    }
    assert(A::count == 0);
    assert(B::count == 0);
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <memory>
+
+// unique_ptr
+
+// Test unique_ptr converting move ctor
+
+#include <memory>
+#include <cassert>
+
+// test converting move ctor.  Should only require a MoveConstructible deleter, or if
+//    deleter is a reference, not even that.
+// Explicit version
+
+struct A
+{
+    static int count;
+    A() {++count;}
+    A(const A&) {++count;}
+    virtual ~A() {--count;}
+};
+
+int A::count = 0;
+
+struct B
+    : public A
+{
+    static int count;
+    B() {++count;}
+    B(const B&) {++count;}
+    virtual ~B() {--count;}
+};
+
+int B::count = 0;
+
+int main()
+{
+    {
+    std::unique_ptr<B> s(new B);
+    A* p = s.get();
+    std::unique_ptr<A> s2(std::move(s));
+    assert(s2.get() == p);
+    assert(s.get() == 0);
+    assert(A::count == 1);
+    assert(B::count == 1);
+    }
+    assert(A::count == 0);
+    assert(B::count == 0);
+}

Modified: libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/move_convert02.fail.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/move_convert02.fail.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/move_convert02.fail.cpp (original)
+++ libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/move_convert02.fail.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,61 @@
-//===----------------------------------------------------------------------===//
//
//                     The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//

// <memory>

// 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 <memory>
#include <cassert>

#include "../../deleter.h"

struct A
{
    static int count;
    A() {++count;}
    A(const A&) {++count;}
    virtual ~A() {--count;}
};

int A::count = 0;

struct B
    : public A
{
    static int count;
    B() {++count;}
    B(const B&) {++count;}
    virtual ~B() {--count;}
};

int B::count = 0;

int main()
{
    {
    std::unique_ptr<B, Deleter<B> > s(new B);
    A* p = s.get();
     std::unique_ptr<A, Deleter<A> > 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);
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <memory>
+
+// 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 <memory>
+#include <cassert>
+
+#include "../../deleter.h"
+
+struct A
+{
+    static int count;
+    A() {++count;}
+    A(const A&) {++count;}
+    virtual ~A() {--count;}
+};
+
+int A::count = 0;
+
+struct B
+    : public A
+{
+    static int count;
+    B() {++count;}
+    B(const B&) {++count;}
+    virtual ~B() {--count;}
+};
+
+int B::count = 0;
+
+int main()
+{
+    {
+    std::unique_ptr<B, Deleter<B> > s(new B);
+    A* p = s.get();
+    std::unique_ptr<A, Deleter<A> > 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);
+}

Modified: libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/move_convert02.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/move_convert02.pass.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/move_convert02.pass.cpp (original)
+++ libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/move_convert02.pass.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,61 @@
-//===----------------------------------------------------------------------===//
//
//                     The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//

// <memory>

// unique_ptr

// Test unique_ptr converting move ctor

#include <memory>
#include <cassert>

#include "../../deleter.h"

// test converting move ctor.  Should only require a MoveConstructible deleter, or if
//    deleter is a reference, not even that.
// Explicit version

struct A
{
    static int count;
    A() {++count;}
    A(const A&) {++count;}
    virtual ~A() {--count;}
};

int A::count = 0;

struct B
    : public A
{
    static int count;
    B() {++count;}
    B(const B&) {++count;}
    virtual ~B() {--count;}
};

int B::count = 0;

int main()
{
    {
    std::unique_ptr<B, Deleter<B> > s(new B, Deleter<B>(5));
    A
 * p = s.get();
    std::unique_ptr<A, Deleter<A> > s2(std::move(s));
    assert(s2.get() == p);
    assert(s.get() == 0);
    assert(A::count == 1);
    assert(B::count == 1);
    assert(s2.get_deleter().state() == 5);
    assert(s.get_deleter().state() == 0);
    }
    assert(A::count == 0);
    assert(B::count == 0);
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <memory>
+
+// unique_ptr
+
+// Test unique_ptr converting move ctor
+
+#include <memory>
+#include <cassert>
+
+#include "../../deleter.h"
+
+// test converting move ctor.  Should only require a MoveConstructible deleter, or if
+//    deleter is a reference, not even that.
+// Explicit version
+
+struct A
+{
+    static int count;
+    A() {++count;}
+    A(const A&) {++count;}
+    virtual ~A() {--count;}
+};
+
+int A::count = 0;
+
+struct B
+    : public A
+{
+    static int count;
+    B() {++count;}
+    B(const B&) {++count;}
+    virtual ~B() {--count;}
+};
+
+int B::count = 0;
+
+int main()
+{
+    {
+    std::unique_ptr<B, Deleter<B> > s(new B, Deleter<B>(5));
+    A* p = s.get();
+    std::unique_ptr<A, Deleter<A> > s2(std::move(s));
+    assert(s2.get() == p);
+    assert(s.get() == 0);
+    assert(A::count == 1);
+    assert(B::count == 1);
+    assert(s2.get_deleter().state() == 5);
+    assert(s.get_deleter().state() == 0);
+    }
+    assert(A::count == 0);
+    assert(B::count == 0);
+}

Modified: libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/move_convert03.fail.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/move_convert03.fail.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/move_convert03.fail.cpp (original)
+++ libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/move_convert03.fail.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,78 @@
-//===----------------------------------------------------------------------===//
//
//                     The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//

// <memory>

// unique_ptr

// Test unique_ptr converting move ctor

#include <memory>
#include <cassert>

// test converting move ctor.  Should only require a MoveConstructible deleter, or if
//    deleter is a reference, not even that.
// Explicit version

struct A
{
    static int count;
    A() {++count;}
    A(const A&) {++count;}
    virtual ~A() {--count;}
};

int A::count = 0;

struct B
    : public A
{
    static int count;
    B() {++count;}
    B(const B&) {++count;}
    virtual ~B() {--count;}
};

int B::count = 0;

template <class T>
class CDeleter
{
    int state_;

    CDeleter(CDeleter&);
    CDeleter& operator=(CDeleter&);
 
public:

    CDeleter() : state_(5) {}

    int state() const {return state_;}
    void set_state(int s) {state_ = s;}

    void operator()(T* p) {delete p;}
};

int main()
{
    {
    CDeleter<A> d;
    std::unique_ptr<B, CDeleter<A>&> s(new B, d);
    A* p = s.get();
    std::unique_ptr<A, CDeleter<A>&> s2(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);
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <memory>
+
+// unique_ptr
+
+// Test unique_ptr converting move ctor
+
+#include <memory>
+#include <cassert>
+
+// test converting move ctor.  Should only require a MoveConstructible deleter, or if
+//    deleter is a reference, not even that.
+// Explicit version
+
+struct A
+{
+    static int count;
+    A() {++count;}
+    A(const A&) {++count;}
+    virtual ~A() {--count;}
+};
+
+int A::count = 0;
+
+struct B
+    : public A
+{
+    static int count;
+    B() {++count;}
+    B(const B&) {++count;}
+    virtual ~B() {--count;}
+};
+
+int B::count = 0;
+
+template <class T>
+class CDeleter
+{
+    int state_;
+
+    CDeleter(CDeleter&);
+    CDeleter& operator=(CDeleter&);
+public:
+
+    CDeleter() : state_(5) {}
+
+    int state() const {return state_;}
+    void set_state(int s) {state_ = s;}
+
+    void operator()(T* p) {delete p;}
+};
+
+int main()
+{
+    {
+    CDeleter<A> d;
+    std::unique_ptr<B, CDeleter<A>&> s(new B, d);
+    A* p = s.get();
+    std::unique_ptr<A, CDeleter<A>&> s2(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);
+}

Modified: libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/move_convert03.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/move_convert03.pass.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/move_convert03.pass.cpp (original)
+++ libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/move_convert03.pass.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,78 @@
-//===----------------------------------------------------------------------===//
//
//                     The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//

// <memory>

// unique_ptr

// Test unique_ptr converting move ctor

#include <memory>
#include <cassert>

// test converting move ctor.  Should only require a MoveConstructible deleter, or if
//    deleter is a reference, not even that.
// Explicit version

struct A
{
    static int count;
    A() {++count;}
    A(const A&) {++count;}
    virtual ~A() {--count;}
};

int A::count = 0;

struct B
    : public A
{
    static int count;
    B() {++count;}
    B(const B&) {++count;}
    virtual ~B() {--count;}
};

int B::count = 0;

template <class T>
class CDeleter
{
    int state_;

    CDeleter(CDeleter&);
    CDeleter& operator=(CDeleter&);
 
public:

    CDeleter() : state_(5) {}

    int state() const {return state_;}
    void set_state(int s) {state_ = s;}

    void operator()(T* p) {delete p;}
};

int main()
{
    {
    CDeleter<A> d;
    std::unique_ptr<B, CDeleter<A>&> s(new B, d);
    A* p = s.get();
    std::unique_ptr<A, CDeleter<A>&> s2(std::move(s));
    assert(s2.get() == p);
    assert(s.get() == 0);
    assert(A::count == 1);
    assert(B::count == 1);
    d.set_state(6);
    assert(s2.get_deleter().state() == d.state());
    assert(s.get_deleter().state() ==  d.state());
    }
    assert(A::count == 0);
    assert(B::count == 0);
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <memory>
+
+// unique_ptr
+
+// Test unique_ptr converting move ctor
+
+#include <memory>
+#include <cassert>
+
+// test converting move ctor.  Should only require a MoveConstructible deleter, or if
+//    deleter is a reference, not even that.
+// Explicit version
+
+struct A
+{
+    static int count;
+    A() {++count;}
+    A(const A&) {++count;}
+    virtual ~A() {--count;}
+};
+
+int A::count = 0;
+
+struct B
+    : public A
+{
+    static int count;
+    B() {++count;}
+    B(const B&) {++count;}
+    virtual ~B() {--count;}
+};
+
+int B::count = 0;
+
+template <class T>
+class CDeleter
+{
+    int state_;
+
+    CDeleter(CDeleter&);
+    CDeleter& operator=(CDeleter&);
+public:
+
+    CDeleter() : state_(5) {}
+
+    int state() const {return state_;}
+    void set_state(int s) {state_ = s;}
+
+    void operator()(T* p) {delete p;}
+};
+
+int main()
+{
+    {
+    CDeleter<A> d;
+    std::unique_ptr<B, CDeleter<A>&> s(new B, d);
+    A* p = s.get();
+    std::unique_ptr<A, CDeleter<A>&> s2(std::move(s));
+    assert(s2.get() == p);
+    assert(s.get() == 0);
+    assert(A::count == 1);
+    assert(B::count == 1);
+    d.set_state(6);
+    assert(s2.get_deleter().state() == d.state());
+    assert(s.get_deleter().state() ==  d.state());
+    }
+    assert(A::count == 0);
+    assert(B::count == 0);
+}

Modified: libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/move_convert04.fail.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/move_convert04.fail.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/move_convert04.fail.cpp (original)
+++ libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/move_convert04.fail.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,57 @@
-//===----------------------------------------------------------------------===//
//
//                     The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//

// <memory>

// unique_ptr

// Test unique_ptr converting move ctor

#include <memory>
#include <cassert>

// test converting move ctor.  Should only require a MoveConstructible deleter, or if
//    deleter is a reference, not even that.
// implicit version

struct A
{
    static int count;
    A() {++count;}
    A(const A&) {++count;}
    virtual ~A() {--count;}
};

int A::count = 0;

struct B
    : public A
{
    static int count;
    B() {++count;}
    B(const B&) {++count;}
    virtual ~B() {--count;}
};

int B::count = 0;

int main()
{
    {
    std::unique_ptr<B> s(new B);
    A* p = s.get();
    std::unique_ptr<A> s2 = 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);
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <memory>
+
+// unique_ptr
+
+// Test unique_ptr converting move ctor
+
+#include <memory>
+#include <cassert>
+
+// test converting move ctor.  Should only require a MoveConstructible deleter, or if
+//    deleter is a reference, not even that.
+// implicit version
+
+struct A
+{
+    static int count;
+    A() {++count;}
+    A(const A&) {++count;}
+    virtual ~A() {--count;}
+};
+
+int A::count = 0;
+
+struct B
+    : public A
+{
+    static int count;
+    B() {++count;}
+    B(const B&) {++count;}
+    virtual ~B() {--count;}
+};
+
+int B::count = 0;
+
+int main()
+{
+    {
+    std::unique_ptr<B> s(new B);
+    A* p = s.get();
+    std::unique_ptr<A> s2 = 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);
+}

Modified: libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/move_convert04.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/move_convert04.pass.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/move_convert04.pass.cpp (original)
+++ libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/move_convert04.pass.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,57 @@
-//===----------------------------------------------------------------------===//
//
//                     The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//

// <memory>

// unique_ptr

// Test unique_ptr converting move ctor

#include <memory>
#include <cassert>

// test converting move ctor.  Should only require a MoveConstructible deleter, or if
//    deleter is a reference, not even that.
// implicit version

struct A
{
    static int count;
    A() {++count;}
    A(const A&) {++count;}
    virtual ~A() {--count;}
};

int A::count = 0;

struct B
    : public A
{
    static int count;
    B() {++count;}
    B(const B&) {++count;}
    virtual ~B() {--count;}
};

int B::count = 0;

int main()
{
    {
    std::unique_ptr<B> s(new B);
    A* p = s.get();
    std::unique_ptr<A> s2 = std::move(s);
 
    assert(s2.get() == p);
    assert(s.get() == 0);
    assert(A::count == 1);
    assert(B::count == 1);
    }
    assert(A::count == 0);
    assert(B::count == 0);
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <memory>
+
+// unique_ptr
+
+// Test unique_ptr converting move ctor
+
+#include <memory>
+#include <cassert>
+
+// test converting move ctor.  Should only require a MoveConstructible deleter, or if
+//    deleter is a reference, not even that.
+// implicit version
+
+struct A
+{
+    static int count;
+    A() {++count;}
+    A(const A&) {++count;}
+    virtual ~A() {--count;}
+};
+
+int A::count = 0;
+
+struct B
+    : public A
+{
+    static int count;
+    B() {++count;}
+    B(const B&) {++count;}
+    virtual ~B() {--count;}
+};
+
+int B::count = 0;
+
+int main()
+{
+    {
+    std::unique_ptr<B> s(new B);
+    A* p = s.get();
+    std::unique_ptr<A> s2 = std::move(s);
+    assert(s2.get() == p);
+    assert(s.get() == 0);
+    assert(A::count == 1);
+    assert(B::count == 1);
+    }
+    assert(A::count == 0);
+    assert(B::count == 0);
+}

Modified: libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/move_convert05.fail.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/move_convert05.fail.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/move_convert05.fail.cpp (original)
+++ libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/move_convert05.fail.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,50 @@
-//===----------------------------------------------------------------------===//
//
//                     The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//

// <memory>

// unique_ptr

// Test unique_ptr converting move ctor

#include <memory>
#include <cassert>

#include "../../deleter.h"

// test converting move ctor.  Should only require a MoveConstructible deleter, or if
//    deleter is a reference, not even that.
// Implicit version

struct A
{
    static int count;
    A() {++count;}
    A(const A&) {++count;}
    virtual ~A() {--count;}
};

int A::count = 0;

struct B
    : public A
{
    static int count;
    B() {++count;}
    B(const B&) {++count;}
    virtual ~B() {--count;}
};

int B::count = 0;

int main()
{
    std::unique_ptr<B, Deleter<B> > s(new B);
    std::unique_ptr<A, Del
 eter<A> > s2 = s;
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <memory>
+
+// unique_ptr
+
+// Test unique_ptr converting move ctor
+
+#include <memory>
+#include <cassert>
+
+#include "../../deleter.h"
+
+// test converting move ctor.  Should only require a MoveConstructible deleter, or if
+//    deleter is a reference, not even that.
+// Implicit version
+
+struct A
+{
+    static int count;
+    A() {++count;}
+    A(const A&) {++count;}
+    virtual ~A() {--count;}
+};
+
+int A::count = 0;
+
+struct B
+    : public A
+{
+    static int count;
+    B() {++count;}
+    B(const B&) {++count;}
+    virtual ~B() {--count;}
+};
+
+int B::count = 0;
+
+int main()
+{
+    std::unique_ptr<B, Deleter<B> > s(new B);
+    std::unique_ptr<A, Deleter<A> > s2 = s;
+}

Modified: libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/move_convert05.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/move_convert05.pass.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/move_convert05.pass.cpp (original)
+++ libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/move_convert05.pass.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,61 @@
-//===----------------------------------------------------------------------===//
//
//                     The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//

// <memory>

// unique_ptr

// Test unique_ptr converting move ctor

#include <memory>
#include <cassert>

#include "../../deleter.h"

// test converting move ctor.  Should only require a MoveConstructible deleter, or if
//    deleter is a reference, not even that.
// Implicit version

struct A
{
    static int count;
    A() {++count;}
    A(const A&) {++count;}
    virtual ~A() {--count;}
};

int A::count = 0;

struct B
    : public A
{
    static int count;
    B() {++count;}
    B(const B&) {++count;}
    virtual ~B() {--count;}
};

int B::count = 0;

int main()
{
    {
    std::unique_ptr<B, Deleter<B> > s(new B, Deleter<B>(5));
    A
 * p = s.get();
    std::unique_ptr<A, Deleter<A> > s2 = std::move(s);
    assert(s2.get() == p);
    assert(s.get() == 0);
    assert(A::count == 1);
    assert(B::count == 1);
    assert(s2.get_deleter().state() == 5);
    assert(s.get_deleter().state() == 0);
    }
    assert(A::count == 0);
    assert(B::count == 0);
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <memory>
+
+// unique_ptr
+
+// Test unique_ptr converting move ctor
+
+#include <memory>
+#include <cassert>
+
+#include "../../deleter.h"
+
+// test converting move ctor.  Should only require a MoveConstructible deleter, or if
+//    deleter is a reference, not even that.
+// Implicit version
+
+struct A
+{
+    static int count;
+    A() {++count;}
+    A(const A&) {++count;}
+    virtual ~A() {--count;}
+};
+
+int A::count = 0;
+
+struct B
+    : public A
+{
+    static int count;
+    B() {++count;}
+    B(const B&) {++count;}
+    virtual ~B() {--count;}
+};
+
+int B::count = 0;
+
+int main()
+{
+    {
+    std::unique_ptr<B, Deleter<B> > s(new B, Deleter<B>(5));
+    A* p = s.get();
+    std::unique_ptr<A, Deleter<A> > s2 = std::move(s);
+    assert(s2.get() == p);
+    assert(s.get() == 0);
+    assert(A::count == 1);
+    assert(B::count == 1);
+    assert(s2.get_deleter().state() == 5);
+    assert(s.get_deleter().state() == 0);
+    }
+    assert(A::count == 0);
+    assert(B::count == 0);
+}

Modified: libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/move_convert06.fail.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/move_convert06.fail.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/move_convert06.fail.cpp (original)
+++ libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/move_convert06.fail.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,78 @@
-//===----------------------------------------------------------------------===//
//
//                     The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//

// <memory>

// unique_ptr

// Test unique_ptr converting move ctor

#include <memory>
#include <cassert>

// test converting move ctor.  Should only require a MoveConstructible deleter, or if
//    deleter is a reference, not even that.
// Explicit version

struct A
{
    static int count;
    A() {++count;}
    A(const A&) {++count;}
    virtual ~A() {--count;}
};

int A::count = 0;

struct B
    : public A
{
    static int count;
    B() {++count;}
    B(const B&) {++count;}
    virtual ~B() {--count;}
};

int B::count = 0;

template <class T>
class CDeleter
{
    int state_;

    CDeleter(CDeleter&);
    CDeleter& operator=(CDeleter&);
 
public:

    CDeleter() : state_(5) {}

    int state() const {return state_;}
    void set_state(int s) {state_ = s;}

    void operator()(T* p) {delete p;}
};

int main()
{
    {
    CDeleter<A> d;
    std::unique_ptr<B, CDeleter<A>&> s(new B, d);
    A* p = s.get();
    std::unique_ptr<A, CDeleter<A>&> s2 = 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);
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <memory>
+
+// unique_ptr
+
+// Test unique_ptr converting move ctor
+
+#include <memory>
+#include <cassert>
+
+// test converting move ctor.  Should only require a MoveConstructible deleter, or if
+//    deleter is a reference, not even that.
+// Explicit version
+
+struct A
+{
+    static int count;
+    A() {++count;}
+    A(const A&) {++count;}
+    virtual ~A() {--count;}
+};
+
+int A::count = 0;
+
+struct B
+    : public A
+{
+    static int count;
+    B() {++count;}
+    B(const B&) {++count;}
+    virtual ~B() {--count;}
+};
+
+int B::count = 0;
+
+template <class T>
+class CDeleter
+{
+    int state_;
+
+    CDeleter(CDeleter&);
+    CDeleter& operator=(CDeleter&);
+public:
+
+    CDeleter() : state_(5) {}
+
+    int state() const {return state_;}
+    void set_state(int s) {state_ = s;}
+
+    void operator()(T* p) {delete p;}
+};
+
+int main()
+{
+    {
+    CDeleter<A> d;
+    std::unique_ptr<B, CDeleter<A>&> s(new B, d);
+    A* p = s.get();
+    std::unique_ptr<A, CDeleter<A>&> s2 = 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);
+}

Modified: libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/move_convert06.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/move_convert06.pass.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/move_convert06.pass.cpp (original)
+++ libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/move_convert06.pass.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,78 @@
-//===----------------------------------------------------------------------===//
//
//                     The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//

// <memory>

// unique_ptr

// Test unique_ptr converting move ctor

#include <memory>
#include <cassert>

// test converting move ctor.  Should only require a MoveConstructible deleter, or if
//    deleter is a reference, not even that.
// Explicit version

struct A
{
    static int count;
    A() {++count;}
    A(const A&) {++count;}
    virtual ~A() {--count;}
};

int A::count = 0;

struct B
    : public A
{
    static int count;
    B() {++count;}
    B(const B&) {++count;}
    virtual ~B() {--count;}
};

int B::count = 0;

template <class T>
class CDeleter
{
    int state_;

    CDeleter(CDeleter&);
    CDeleter& operator=(CDeleter&);
 
public:

    CDeleter() : state_(5) {}

    int state() const {return state_;}
    void set_state(int s) {state_ = s;}

    void operator()(T* p) {delete p;}
};

int main()
{
    {
    CDeleter<A> d;
    std::unique_ptr<B, CDeleter<A>&> s(new B, d);
    A* p = s.get();
    std::unique_ptr<A, CDeleter<A>&> s2 = std::move(s);
    assert(s2.get() == p);
    assert(s.get() == 0);
    assert(A::count == 1);
    assert(B::count == 1);
    d.set_state(6);
    assert(s2.get_deleter().state() == d.state());
    assert(s.get_deleter().state() ==  d.state());
    }
    assert(A::count == 0);
    assert(B::count == 0);
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <memory>
+
+// unique_ptr
+
+// Test unique_ptr converting move ctor
+
+#include <memory>
+#include <cassert>
+
+// test converting move ctor.  Should only require a MoveConstructible deleter, or if
+//    deleter is a reference, not even that.
+// Explicit version
+
+struct A
+{
+    static int count;
+    A() {++count;}
+    A(const A&) {++count;}
+    virtual ~A() {--count;}
+};
+
+int A::count = 0;
+
+struct B
+    : public A
+{
+    static int count;
+    B() {++count;}
+    B(const B&) {++count;}
+    virtual ~B() {--count;}
+};
+
+int B::count = 0;
+
+template <class T>
+class CDeleter
+{
+    int state_;
+
+    CDeleter(CDeleter&);
+    CDeleter& operator=(CDeleter&);
+public:
+
+    CDeleter() : state_(5) {}
+
+    int state() const {return state_;}
+    void set_state(int s) {state_ = s;}
+
+    void operator()(T* p) {delete p;}
+};
+
+int main()
+{
+    {
+    CDeleter<A> d;
+    std::unique_ptr<B, CDeleter<A>&> s(new B, d);
+    A* p = s.get();
+    std::unique_ptr<A, CDeleter<A>&> s2 = std::move(s);
+    assert(s2.get() == p);
+    assert(s.get() == 0);
+    assert(A::count == 1);
+    assert(B::count == 1);
+    d.set_state(6);
+    assert(s2.get_deleter().state() == d.state());
+    assert(s.get_deleter().state() ==  d.state());
+    }
+    assert(A::count == 0);
+    assert(B::count == 0);
+}

Modified: libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/move_convert07.fail.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/move_convert07.fail.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/move_convert07.fail.cpp (original)
+++ libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/move_convert07.fail.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,57 @@
-//===----------------------------------------------------------------------===//
//
//                     The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//

// <memory>

// unique_ptr

// Test unique_ptr converting move ctor

#include <memory>
#include <cassert>

// test converting move ctor.  Should only require a MoveConstructible deleter, or if
//    deleter is a reference, not even that.
// Explicit version

struct A
{
    static int count;
    A() {++count;}
    A(const A&) {++count;}
    virtual ~A() {--count;}
};

int A::count = 0;

struct B
    : public A
{
    static int count;
    B() {++count;}
    B(const B&) {++count;}
    virtual ~B() {--count;}
};

int B::count = 0;

int main()
{
    {
    const std::unique_ptr<B> s(new B);
    A* p = s.get();
    std::unique_ptr<A> s2(s);
    a
 ssert(s2.get() == p);
    assert(s.get() == 0);
    assert(A::count == 1);
    assert(B::count == 1);
    }
    assert(A::count == 0);
    assert(B::count == 0);
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <memory>
+
+// unique_ptr
+
+// Test unique_ptr converting move ctor
+
+#include <memory>
+#include <cassert>
+
+// test converting move ctor.  Should only require a MoveConstructible deleter, or if
+//    deleter is a reference, not even that.
+// Explicit version
+
+struct A
+{
+    static int count;
+    A() {++count;}
+    A(const A&) {++count;}
+    virtual ~A() {--count;}
+};
+
+int A::count = 0;
+
+struct B
+    : public A
+{
+    static int count;
+    B() {++count;}
+    B(const B&) {++count;}
+    virtual ~B() {--count;}
+};
+
+int B::count = 0;
+
+int main()
+{
+    {
+    const std::unique_ptr<B> s(new B);
+    A* p = s.get();
+    std::unique_ptr<A> 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);
+}

Modified: libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/move_convert07.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/move_convert07.pass.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/move_convert07.pass.cpp (original)
+++ libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/move_convert07.pass.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,62 @@
-//===----------------------------------------------------------------------===//
//
//                     The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//

// <memory>

// unique_ptr

// Test unique_ptr converting move ctor

#include <memory>
#include <cassert>

#include "../../deleter.h"

// test converting move ctor.  Should only require a MoveConstructible deleter, or if
//    deleter is a reference, not even that.
// Implicit version

struct A
{
    static int count;
    A() {++count;}
    A(const A&) {++count;}
    virtual ~A() {--count;}
};

int A::count = 0;

struct B
    : public A
{
    static int count;
    B() {++count;}
    B(const B&) {++count;}
    virtual ~B() {--count;}
};

int B::count = 0;

int main()
{
    {
    CDeleter<B> b(5);
    std::unique_ptr<B, CDeleter<B>&> s(new B
 , b);
    A* p = s.get();
    std::unique_ptr<A, CDeleter<A> > s2 = std::move(s);
    assert(s2.get() == p);
    assert(s.get() == 0);
    assert(A::count == 1);
    assert(B::count == 1);
    assert(s2.get_deleter().state() == 5);
    assert(s.get_deleter().state() == 5);
    }
    assert(A::count == 0);
    assert(B::count == 0);
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <memory>
+
+// unique_ptr
+
+// Test unique_ptr converting move ctor
+
+#include <memory>
+#include <cassert>
+
+#include "../../deleter.h"
+
+// test converting move ctor.  Should only require a MoveConstructible deleter, or if
+//    deleter is a reference, not even that.
+// Implicit version
+
+struct A
+{
+    static int count;
+    A() {++count;}
+    A(const A&) {++count;}
+    virtual ~A() {--count;}
+};
+
+int A::count = 0;
+
+struct B
+    : public A
+{
+    static int count;
+    B() {++count;}
+    B(const B&) {++count;}
+    virtual ~B() {--count;}
+};
+
+int B::count = 0;
+
+int main()
+{
+    {
+    CDeleter<B> b(5);
+    std::unique_ptr<B, CDeleter<B>&> s(new B, b);
+    A* p = s.get();
+    std::unique_ptr<A, CDeleter<A> > s2 = std::move(s);
+    assert(s2.get() == p);
+    assert(s.get() == 0);
+    assert(A::count == 1);
+    assert(B::count == 1);
+    assert(s2.get_deleter().state() == 5);
+    assert(s.get_deleter().state() == 5);
+    }
+    assert(A::count == 0);
+    assert(B::count == 0);
+}

Modified: libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/move_convert08.fail.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/move_convert08.fail.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/move_convert08.fail.cpp (original)
+++ libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/move_convert08.fail.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,117 @@
-//===----------------------------------------------------------------------===//
//
//                     The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//

// <memory>

// unique_ptr

// Test unique_ptr converting move ctor

#include <memory>
#include <cassert>

// test converting move ctor.  Should only require a MoveConstructible deleter, or if
//    deleter is a reference, not even that.
// Explicit version

struct A
{
    static int count;
    A() {++count;}
    A(const A&) {++count;}
    virtual ~A() {--count;}
};

int A::count = 0;

struct B
    : public A
{
    static int count;
    B() {++count;}
    B(const B&) {++count;}
    virtual ~B() {--count;}
};

int B::count = 0;

template <class T>
class Deleter
{
    int state_;

#ifdef _LIBCPP_MOVE
    Deleter(const Deleter&);
    Deleter&
  operator=(const Deleter&);
#else
    Deleter(Deleter&);
    Deleter& operator=(Deleter&);
#endif

public:
#ifdef _LIBCPP_MOVE
    Deleter(Deleter&& r) : state_(r.state_) {r.state_ = 0;}
    Deleter& operator=(Deleter&& r)
    {
        state_ = r.state_;
        r.state_ = 0;
        return *this;
    }
#else
    operator std::__rv<Deleter>() {return std::__rv<Deleter>(*this);}
    Deleter(std::__rv<Deleter> r) : state_(r->state_) {r->state_ = 0;}
    Deleter& operator=(std::__rv<Deleter> r)
    {
        state_ = r->state_;
        r->state_ = 0;
        return *this;
    }
#endif

    Deleter() : state_(5) {}

#ifdef _LIBCPP_MOVE
    template <class U>
        Deleter(Deleter<U>&& d,
            typename std::enable_if<!std::is_same<U, T>::value>::type* = 0)
            : state_(d.state()) {d.set_state(0);}

private:
    template <class U>
        Deleter(const Deleter<U>& d,
            typename std::enable_if<!std::is_same<U, T>::value>::type* = 0);
#else
    template <
 class U>
        Deleter(Deleter<U> d,
            typename std::enable_if<!std::is_same<U, T>::value>::type* = 0)
            : state_(d.state()) {}
#endif
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<B, Deleter<B> > s(new B);
    A* p = s.get();
    std::unique_ptr<A, Deleter<A> > 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);
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <memory>
+
+// unique_ptr
+
+// Test unique_ptr converting move ctor
+
+#include <memory>
+#include <cassert>
+
+// test converting move ctor.  Should only require a MoveConstructible deleter, or if
+//    deleter is a reference, not even that.
+// Explicit version
+
+struct A
+{
+    static int count;
+    A() {++count;}
+    A(const A&) {++count;}
+    virtual ~A() {--count;}
+};
+
+int A::count = 0;
+
+struct B
+    : public A
+{
+    static int count;
+    B() {++count;}
+    B(const B&) {++count;}
+    virtual ~B() {--count;}
+};
+
+int B::count = 0;
+
+template <class T>
+class Deleter
+{
+    int state_;
+
+#ifdef _LIBCPP_MOVE
+    Deleter(const Deleter&);
+    Deleter& operator=(const Deleter&);
+#else  // _LIBCPP_MOVE
+    Deleter(Deleter&);
+    Deleter& operator=(Deleter&);
+#endif  // _LIBCPP_MOVE
+
+public:
+#ifdef _LIBCPP_MOVE
+    Deleter(Deleter&& r) : state_(r.state_) {r.state_ = 0;}
+    Deleter& operator=(Deleter&& r)
+    {
+        state_ = r.state_;
+        r.state_ = 0;
+        return *this;
+    }
+#else  // _LIBCPP_MOVE
+    operator std::__rv<Deleter>() {return std::__rv<Deleter>(*this);}
+    Deleter(std::__rv<Deleter> r) : state_(r->state_) {r->state_ = 0;}
+    Deleter& operator=(std::__rv<Deleter> r)
+    {
+        state_ = r->state_;
+        r->state_ = 0;
+        return *this;
+    }
+#endif  // _LIBCPP_MOVE
+
+    Deleter() : state_(5) {}
+
+#ifdef _LIBCPP_MOVE
+    template <class U>
+        Deleter(Deleter<U>&& d,
+            typename std::enable_if<!std::is_same<U, T>::value>::type* = 0)
+            : state_(d.state()) {d.set_state(0);}
+
+private:
+    template <class U>
+        Deleter(const Deleter<U>& d,
+            typename std::enable_if<!std::is_same<U, T>::value>::type* = 0);
+#else  // _LIBCPP_MOVE
+    template <class U>
+        Deleter(Deleter<U> d,
+            typename std::enable_if<!std::is_same<U, T>::value>::type* = 0)
+            : state_(d.state()) {}
+#endif  // _LIBCPP_MOVE
+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<B, Deleter<B> > s(new B);
+    A* p = s.get();
+    std::unique_ptr<A, Deleter<A> > 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);
+}

Modified: libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/move_convert09.fail.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/move_convert09.fail.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/move_convert09.fail.cpp (original)
+++ libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/move_convert09.fail.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,78 @@
-//===----------------------------------------------------------------------===//
//
//                     The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//

// <memory>

// unique_ptr

// Test unique_ptr converting move ctor

#include <memory>
#include <cassert>

// test converting move ctor.  Should only require a MoveConstructible deleter, or if
//    deleter is a reference, not even that.
// Explicit version

struct A
{
    static int count;
    A() {++count;}
    A(const A&) {++count;}
    virtual ~A() {--count;}
};

int A::count = 0;

struct B
    : public A
{
    static int count;
    B() {++count;}
    B(const B&) {++count;}
    virtual ~B() {--count;}
};

int B::count = 0;

template <class T>
class CDeleter
{
    int state_;

    CDeleter(CDeleter&);
    CDeleter& operator=(CDeleter&);
 
public:

    CDeleter() : state_(5) {}

    int state() const {return state_;}
    void set_state(int s) {state_ = s;}

    void operator()(T* p) {delete p;}
};

int main()
{
    {
    CDeleter<A> d;
    const std::unique_ptr<B, CDeleter<A>&> s(new B, d);
    A* p = s.get();
    std::unique_ptr<A, CDeleter<A>&> 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);
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <memory>
+
+// unique_ptr
+
+// Test unique_ptr converting move ctor
+
+#include <memory>
+#include <cassert>
+
+// test converting move ctor.  Should only require a MoveConstructible deleter, or if
+//    deleter is a reference, not even that.
+// Explicit version
+
+struct A
+{
+    static int count;
+    A() {++count;}
+    A(const A&) {++count;}
+    virtual ~A() {--count;}
+};
+
+int A::count = 0;
+
+struct B
+    : public A
+{
+    static int count;
+    B() {++count;}
+    B(const B&) {++count;}
+    virtual ~B() {--count;}
+};
+
+int B::count = 0;
+
+template <class T>
+class CDeleter
+{
+    int state_;
+
+    CDeleter(CDeleter&);
+    CDeleter& operator=(CDeleter&);
+public:
+
+    CDeleter() : state_(5) {}
+
+    int state() const {return state_;}
+    void set_state(int s) {state_ = s;}
+
+    void operator()(T* p) {delete p;}
+};
+
+int main()
+{
+    {
+    CDeleter<A> d;
+    const std::unique_ptr<B, CDeleter<A>&> s(new B, d);
+    A* p = s.get();
+    std::unique_ptr<A, CDeleter<A>&> 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);
+}

Modified: libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/move_convert10.fail.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/move_convert10.fail.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/move_convert10.fail.cpp (original)
+++ libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/move_convert10.fail.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,57 @@
-//===----------------------------------------------------------------------===//
//
//                     The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//

// <memory>

// unique_ptr

// Test unique_ptr converting move ctor

#include <memory>
#include <cassert>

// test converting move ctor.  Should only require a MoveConstructible deleter, or if
//    deleter is a reference, not even that.
// implicit version

struct A
{
    static int count;
    A() {++count;}
    A(const A&) {++count;}
    virtual ~A() {--count;}
};

int A::count = 0;

struct B
    : public A
{
    static int count;
    B() {++count;}
    B(const B&) {++count;}
    virtual ~B() {--count;}
};

int B::count = 0;

int main()
{
    {
    const std::unique_ptr<B> s(new B);
    A* p = s.get();
    std::unique_ptr<A> 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);
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <memory>
+
+// unique_ptr
+
+// Test unique_ptr converting move ctor
+
+#include <memory>
+#include <cassert>
+
+// test converting move ctor.  Should only require a MoveConstructible deleter, or if
+//    deleter is a reference, not even that.
+// implicit version
+
+struct A
+{
+    static int count;
+    A() {++count;}
+    A(const A&) {++count;}
+    virtual ~A() {--count;}
+};
+
+int A::count = 0;
+
+struct B
+    : public A
+{
+    static int count;
+    B() {++count;}
+    B(const B&) {++count;}
+    virtual ~B() {--count;}
+};
+
+int B::count = 0;
+
+int main()
+{
+    {
+    const std::unique_ptr<B> s(new B);
+    A* p = s.get();
+    std::unique_ptr<A> 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);
+}

Modified: libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/move_convert11.fail.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/move_convert11.fail.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/move_convert11.fail.cpp (original)
+++ libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/move_convert11.fail.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,117 @@
-//===----------------------------------------------------------------------===//
//
//                     The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//

// <memory>

// unique_ptr

// Test unique_ptr converting move ctor

#include <memory>
#include <cassert>

// test converting move ctor.  Should only require a MoveConstructible deleter, or if
//    deleter is a reference, not even that.
// Implicit version

struct A
{
    static int count;
    A() {++count;}
    A(const A&) {++count;}
    virtual ~A() {--count;}
};

int A::count = 0;

struct B
    : public A
{
    static int count;
    B() {++count;}
    B(const B&) {++count;}
    virtual ~B() {--count;}
};

int B::count = 0;

template <class T>
class Deleter
{
    int state_;

#ifdef _LIBCPP_MOVE
    Deleter(const Deleter&);
    Deleter&
  operator=(const Deleter&);
#else
    Deleter(Deleter&);
    Deleter& operator=(Deleter&);
#endif

public:
#ifdef _LIBCPP_MOVE
    Deleter(Deleter&& r) : state_(r.state_) {r.state_ = 0;}
    Deleter& operator=(Deleter&& r)
    {
        state_ = r.state_;
        r.state_ = 0;
        return *this;
    }
#else
    operator std::__rv<Deleter>() {return std::__rv<Deleter>(*this);}
    Deleter(std::__rv<Deleter> r) : state_(r->state_) {r->state_ = 0;}
    Deleter& operator=(std::__rv<Deleter> r)
    {
        state_ = r->state_;
        r->state_ = 0;
        return *this;
    }
#endif

    Deleter() : state_(5) {}

#ifdef _LIBCPP_MOVE
    template <class U>
        Deleter(Deleter<U>&& d,
            typename std::enable_if<!std::is_same<U, T>::value>::type* = 0)
            : state_(d.state()) {d.set_state(0);}

private:
    template <class U>
        Deleter(const Deleter<U>& d,
            typename std::enable_if<!std::is_same<U, T>::value>::type* = 0);
#else
    template <
 class U>
        Deleter(Deleter<U> d,
            typename std::enable_if<!std::is_same<U, T>::value>::type* = 0)
            : state_(d.state()) {}
#endif
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<B, Deleter<B> > s(new B);
    A* p = s.get();
    std::unique_ptr<A, Deleter<A> > 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);
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <memory>
+
+// unique_ptr
+
+// Test unique_ptr converting move ctor
+
+#include <memory>
+#include <cassert>
+
+// test converting move ctor.  Should only require a MoveConstructible deleter, or if
+//    deleter is a reference, not even that.
+// Implicit version
+
+struct A
+{
+    static int count;
+    A() {++count;}
+    A(const A&) {++count;}
+    virtual ~A() {--count;}
+};
+
+int A::count = 0;
+
+struct B
+    : public A
+{
+    static int count;
+    B() {++count;}
+    B(const B&) {++count;}
+    virtual ~B() {--count;}
+};
+
+int B::count = 0;
+
+template <class T>
+class Deleter
+{
+    int state_;
+
+#ifdef _LIBCPP_MOVE
+    Deleter(const Deleter&);
+    Deleter& operator=(const Deleter&);
+#else  // _LIBCPP_MOVE
+    Deleter(Deleter&);
+    Deleter& operator=(Deleter&);
+#endif  // _LIBCPP_MOVE
+
+public:
+#ifdef _LIBCPP_MOVE
+    Deleter(Deleter&& r) : state_(r.state_) {r.state_ = 0;}
+    Deleter& operator=(Deleter&& r)
+    {
+        state_ = r.state_;
+        r.state_ = 0;
+        return *this;
+    }
+#else  // _LIBCPP_MOVE
+    operator std::__rv<Deleter>() {return std::__rv<Deleter>(*this);}
+    Deleter(std::__rv<Deleter> r) : state_(r->state_) {r->state_ = 0;}
+    Deleter& operator=(std::__rv<Deleter> r)
+    {
+        state_ = r->state_;
+        r->state_ = 0;
+        return *this;
+    }
+#endif  // _LIBCPP_MOVE
+
+    Deleter() : state_(5) {}
+
+#ifdef _LIBCPP_MOVE
+    template <class U>
+        Deleter(Deleter<U>&& d,
+            typename std::enable_if<!std::is_same<U, T>::value>::type* = 0)
+            : state_(d.state()) {d.set_state(0);}
+
+private:
+    template <class U>
+        Deleter(const Deleter<U>& d,
+            typename std::enable_if<!std::is_same<U, T>::value>::type* = 0);
+#else  // _LIBCPP_MOVE
+    template <class U>
+        Deleter(Deleter<U> d,
+            typename std::enable_if<!std::is_same<U, T>::value>::type* = 0)
+            : state_(d.state()) {}
+#endif  // _LIBCPP_MOVE
+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<B, Deleter<B> > s(new B);
+    A* p = s.get();
+    std::unique_ptr<A, Deleter<A> > 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);
+}

Modified: libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/move_convert12.fail.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/move_convert12.fail.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/move_convert12.fail.cpp (original)
+++ libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/move_convert12.fail.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,78 @@
-//===----------------------------------------------------------------------===//
//
//                     The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//

// <memory>

// unique_ptr

// Test unique_ptr converting move ctor

#include <memory>
#include <cassert>

// test converting move ctor.  Should only require a MoveConstructible deleter, or if
//    deleter is a reference, not even that.
// Explicit version

struct A
{
    static int count;
    A() {++count;}
    A(const A&) {++count;}
    virtual ~A() {--count;}
};

int A::count = 0;

struct B
    : public A
{
    static int count;
    B() {++count;}
    B(const B&) {++count;}
    virtual ~B() {--count;}
};

int B::count = 0;

template <class T>
class CDeleter
{
    int state_;

    CDeleter(CDeleter&);
    CDeleter& operator=(CDeleter&);
 
public:

    CDeleter() : state_(5) {}

    int state() const {return state_;}
    void set_state(int s) {state_ = s;}

    void operator()(T* p) {delete p;}
};

int main()
{
    {
    CDeleter<A> d;
    const std::unique_ptr<B, CDeleter<A>&> s(new B, d);
    A* p = s.get();
    std::unique_ptr<A, CDeleter<A>&> 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);
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <memory>
+
+// unique_ptr
+
+// Test unique_ptr converting move ctor
+
+#include <memory>
+#include <cassert>
+
+// test converting move ctor.  Should only require a MoveConstructible deleter, or if
+//    deleter is a reference, not even that.
+// Explicit version
+
+struct A
+{
+    static int count;
+    A() {++count;}
+    A(const A&) {++count;}
+    virtual ~A() {--count;}
+};
+
+int A::count = 0;
+
+struct B
+    : public A
+{
+    static int count;
+    B() {++count;}
+    B(const B&) {++count;}
+    virtual ~B() {--count;}
+};
+
+int B::count = 0;
+
+template <class T>
+class CDeleter
+{
+    int state_;
+
+    CDeleter(CDeleter&);
+    CDeleter& operator=(CDeleter&);
+public:
+
+    CDeleter() : state_(5) {}
+
+    int state() const {return state_;}
+    void set_state(int s) {state_ = s;}
+
+    void operator()(T* p) {delete p;}
+};
+
+int main()
+{
+    {
+    CDeleter<A> d;
+    const std::unique_ptr<B, CDeleter<A>&> s(new B, d);
+    A* p = s.get();
+    std::unique_ptr<A, CDeleter<A>&> 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);
+}

Modified: libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/move_convert13.fail.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/move_convert13.fail.cpp?rev=111767&r1=111766&r2=111767&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/move_convert13.fail.cpp (original)
+++ libcxx/trunk/test/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/move_convert13.fail.cpp Sat Aug 21 19:59:46 2010
@@ -1 +1,34 @@
-//===----------------------------------------------------------------------===//
//
//                     The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//

// <memory>

// unique_ptr

// Test unique_ptr converting move ctor

// Do not convert from an array unique_ptr

#include <memory>
#include <cassert>

struct A
{
};

struct Deleter
{
    void operator()(void*) {}
};

int main()
{
    std::unique_ptr<A[], Deleter> s;
    std::unique_ptr<A, Deleter> s2(std::move(s));
}
\ No newline at end of file
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+